chore: sort imports

This commit is contained in:
DarkSky
2022-08-13 02:45:04 +08:00
parent 617f9b9bfc
commit 5462b1707f
83 changed files with 343 additions and 1481 deletions
+22 -22
View File
@@ -1,43 +1,43 @@
/* eslint-disable max-lines */
import { Renderer } from '@tldraw/core';
import { shapeUtils } from '@toeverything/components/board-shapes';
import {
TLDR,
TldrawApp,
TldrawAppCtorProps,
} from '@toeverything/components/board-state';
import {
GRID_SIZE,
TDDocument,
TDMeta,
TDStatus,
} from '@toeverything/components/board-types';
import { styled } from '@toeverything/components/ui';
import {
memo,
useEffect,
useLayoutEffect,
useRef,
useMemo,
useRef,
useState,
type RefObject,
} from 'react';
import { Renderer } from '@tldraw/core';
import { styled } from '@toeverything/components/ui';
import {
TDDocument,
TDStatus,
GRID_SIZE,
TDMeta,
} from '@toeverything/components/board-types';
import {
TldrawApp,
TldrawAppCtorProps,
TLDR,
} from '@toeverything/components/board-state';
import { ToolsPanel } from './components/tools-panel';
import {
TldrawContext,
useStylesheet,
useKeyboardShortcuts,
useStylesheet,
useTldrawApp,
} from './hooks';
import { shapeUtils } from '@toeverything/components/board-shapes';
import { ToolsPanel } from './components/tools-panel';
// import { TopPanel } from '~components/TopPanel';
import { ContextMenu } from './components/context-menu';
// import { FocusButton } from '~components/FocusButton';
import { Loading } from './components/loading';
import { ErrorBoundary } from 'react-error-boundary';
import { ErrorFallback } from './components/error-fallback';
import { ZoomBar } from './components/zoom-bar';
import { CommandPanel } from './components/command-panel';
import { usePageClientWidth } from '@toeverything/datasource/state';
import { ErrorBoundary } from 'react-error-boundary';
import { CommandPanel } from './components/command-panel';
import { ErrorFallback } from './components/error-fallback';
import { Loading } from './components/loading';
import { ZoomBar } from './components/zoom-bar';
export interface TldrawProps extends TldrawAppCtorProps {
/**
@@ -1,13 +1,13 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types';
import { Popover, Tooltip, IconButton } from '@toeverything/components/ui';
import {
BorderColorNoneIcon,
BorderColorDuotoneIcon,
BorderColorNoneIcon,
} from '@toeverything/components/icons';
import { IconButton, Popover, Tooltip } from '@toeverything/components/ui';
import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from './utils';
import { Palette } from '../palette';
import { getShapeIds } from './utils';
interface BorderColorConfigProps {
app: TldrawApp;
@@ -1,16 +1,15 @@
import { TLDR, TldrawApp } from '@toeverything/components/board-state';
import { Divider, Popover, styled } from '@toeverything/components/ui';
import { Fragment } from 'react';
import { Vec } from '@tldraw/vec';
import { TldrawApp, TLDR } from '@toeverything/components/board-state';
import { Popover, styled, Divider } from '@toeverything/components/ui';
import { getAnchor, useConfig } from './utils';
import { BorderColorConfig } from './BorderColorConfig';
import { DeleteShapes } from './DeleteOperation';
import { FillColorConfig } from './FillColorConfig';
import { FontSizeConfig } from './FontSizeConfig';
import { StrokeLineStyleConfig } from './stroke-line-style-config';
import { Group, UnGroup } from './GroupOperation';
import { DeleteShapes } from './DeleteOperation';
import { Lock, Unlock } from './LockOperation';
import { FrameFillColorConfig } from './FrameFillColorConfig';
import { Group, UnGroup } from './GroupOperation';
import { Lock, Unlock } from './LockOperation';
import { StrokeLineStyleConfig } from './stroke-line-style-config';
import { getAnchor, useConfig } from './utils';
export const CommandPanel = ({ app }: { app: TldrawApp }) => {
const state = app.useStore();
@@ -1,7 +1,7 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types';
import { IconButton, Tooltip } from '@toeverything/components/ui';
import { DeleteCashBinIcon } from '@toeverything/components/icons';
import { IconButton, Tooltip } from '@toeverything/components/ui';
import { getShapeIds } from './utils';
interface DeleteShapesProps {
@@ -1,18 +1,18 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types';
import {
ShapeColorDuotoneIcon,
ShapeColorNoneIcon,
} from '@toeverything/components/icons';
import {
IconButton,
Popover,
Tooltip,
IconButton,
useTheme,
} from '@toeverything/components/ui';
import {
ShapeColorNoneIcon,
ShapeColorDuotoneIcon,
} from '@toeverything/components/icons';
import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from './utils';
import { Palette } from '../palette';
import { getShapeIds } from './utils';
interface BorderColorConfigProps {
app: TldrawApp;
@@ -2,17 +2,17 @@ import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types';
import { FontSizeStyle } from '@toeverything/components/board-types';
import {
Popover,
Tooltip,
IconButton,
styled,
} from '@toeverything/components/ui';
import {
TextFontIcon,
HeadingOneIcon,
HeadingTwoIcon,
HeadingThreeIcon,
HeadingTwoIcon,
TextFontIcon,
} from '@toeverything/components/icons';
import {
IconButton,
Popover,
styled,
Tooltip,
} from '@toeverything/components/ui';
import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from './utils';
@@ -1,18 +1,18 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types';
import {
ShapeColorDuotoneIcon,
ShapeColorNoneIcon,
} from '@toeverything/components/icons';
import {
IconButton,
Popover,
Tooltip,
IconButton,
useTheme,
} from '@toeverything/components/ui';
import {
ShapeColorNoneIcon,
ShapeColorDuotoneIcon,
} from '@toeverything/components/icons';
import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from './utils';
import { Palette } from '../palette';
import { getShapeIds } from './utils';
interface BorderColorConfigProps {
app: TldrawApp;
@@ -1,7 +1,7 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types';
import { IconButton, Tooltip } from '@toeverything/components/ui';
import { GroupIcon, UngroupIcon } from '@toeverything/components/icons';
import { IconButton, Tooltip } from '@toeverything/components/ui';
import { getShapeIds } from './utils';
interface GroupAndUnGroupProps {
@@ -1,7 +1,7 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types';
import { IconButton, Tooltip } from '@toeverything/components/ui';
import { LockIcon, UnlockIcon } from '@toeverything/components/icons';
import { IconButton, Tooltip } from '@toeverything/components/ui';
import { getShapeIds } from './utils';
interface GroupAndUnGroupProps {
@@ -1,15 +1,15 @@
import { DashStyle, StrokeWidth } from '@toeverything/components/board-types';
import {
LineNoneIcon,
DashLineIcon,
SolidLineIcon,
BrushIcon,
DashLineIcon,
LineNoneIcon,
SolidLineIcon,
} from '@toeverything/components/icons';
import {
IconButton,
Slider,
styled,
Tooltip,
Slider,
} from '@toeverything/components/ui';
export const lineStyles = [
@@ -1,8 +1,8 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import { DashStyle, StrokeWidth } from '@toeverything/components/board-types';
import type { TDShape } from '@toeverything/components/board-types';
import { Popover, IconButton, Tooltip } from '@toeverything/components/ui';
import { DashStyle, StrokeWidth } from '@toeverything/components/board-types';
import { BrushIcon } from '@toeverything/components/icons';
import { IconButton, Popover, Tooltip } from '@toeverything/components/ui';
import { countBy, maxBy } from '@toeverything/utils';
import { getShapeIds } from '../utils';
import { LineStyle, lineStyles } from './LineStyle';
@@ -1,2 +1,2 @@
export { getAnchor } from './get-anchor';
export { useConfig, getShapeIds } from './use-config';
export { getShapeIds, useConfig } from './use-config';
@@ -1,7 +1,7 @@
import type { TldrawApp } from '@toeverything/components/board-state';
import { TLDR } from '@toeverything/components/board-state';
import type { TDShape } from '@toeverything/components/board-types';
import { TDShapeType } from '@toeverything/components/board-types';
import { TLDR } from '@toeverything/components/board-state';
interface Config {
type:
@@ -1,7 +1,6 @@
import * as React from 'react';
import { styled } from '@toeverything/components/ui';
import { FallbackProps } from 'react-error-boundary';
import { useTldrawApp } from '../../hooks';
import { styled } from '@toeverything/components/ui';
export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
const app = useTldrawApp();
@@ -1,7 +1,6 @@
import * as React from 'react';
import { useTldrawApp } from '../../hooks';
import { styled } from '@toeverything/components/ui';
import type { TDSnapshot } from '@toeverything/components/board-types';
import { styled } from '@toeverything/components/ui';
import { useTldrawApp } from '../../hooks';
const loadingSelector = (s: TDSnapshot) => s.appState.isLoading;
@@ -1,7 +1,6 @@
import type { PropsWithChildren } from 'react';
import { useMemo } from 'react';
import { styled, Tooltip } from '@toeverything/components/ui';
import { ShapeColorNoneIcon } from '@toeverything/components/icons';
import { styled, Tooltip } from '@toeverything/components/ui';
import { useMemo } from 'react';
interface ColorObject {
name?: string;
@@ -1,18 +1,18 @@
import { useState, useEffect } from 'react';
import {
ConnectorIcon,
ConectorLineIcon,
ConectorArrowIcon,
ConectorLineIcon,
ConnectorIcon,
} from '@toeverything/components/icons';
import {
Tooltip,
Popover,
IconButton,
Popover,
styled,
Tooltip,
} from '@toeverything/components/ui';
import { useEffect, useState } from 'react';
import { TDSnapshot, TDShapeType } from '@toeverything/components/board-types';
import { TldrawApp } from '@toeverything/components/board-state';
import { TDShapeType, TDSnapshot } from '@toeverything/components/board-types';
export type ShapeTypes = TDShapeType.Line | TDShapeType.Arrow;
@@ -1,22 +1,22 @@
import { useState, useEffect } from 'react';
import {
ShapeIcon,
RectangleIcon,
EllipseIcon,
TriangleIcon,
PolygonIcon,
StarIcon,
ArrowIcon,
EllipseIcon,
PolygonIcon,
RectangleIcon,
ShapeIcon,
StarIcon,
TriangleIcon,
} from '@toeverything/components/icons';
import {
Tooltip,
Popover,
IconButton,
Popover,
styled,
Tooltip,
} from '@toeverything/components/ui';
import { useEffect, useState } from 'react';
import { TDSnapshot, TDShapeType } from '@toeverything/components/board-types';
import { TldrawApp } from '@toeverything/components/board-state';
import { TDShapeType, TDSnapshot } from '@toeverything/components/board-types';
export type ShapeTypes =
| TDShapeType.Rectangle
@@ -1,35 +1,35 @@
import style9 from 'style9';
import {
EraserIcon,
EraserIconProps,
FrameIcon,
HandToolIcon,
HandToolIconProps,
SelectIcon,
SelectIconProps,
TextIcon,
TextIconProps,
} from '@toeverything/components/icons';
import {
IconButton,
PopoverContainer,
// MuiIconButton as IconButton,
// MuiTooltip as Tooltip,
Tooltip,
PopoverContainer,
IconButton,
useTheme,
} from '@toeverything/components/ui';
import {
FrameIcon,
HandToolIcon,
SelectIcon,
TextIcon,
EraserIcon,
SelectIconProps,
EraserIconProps,
HandToolIconProps,
TextIconProps,
} from '@toeverything/components/icons';
import style9 from 'style9';
import { TldrawApp } from '@toeverything/components/board-state';
import {
TDSnapshot,
TDShapeType,
TDSnapshot,
TDToolType,
} from '@toeverything/components/board-types';
import { TldrawApp } from '@toeverything/components/board-state';
import { ShapeTools } from './ShapeTools';
import { PenTools } from './pen-tools';
import { ComponentType } from 'react';
import { LineTools } from './LineTools';
import { ComponentType, Component } from 'react';
import { PenTools } from './pen-tools';
import { ShapeTools } from './ShapeTools';
const activeToolSelector = (s: TDSnapshot) => s.appState.activeTool;
const toolLockedSelector = (s: TDSnapshot) => s.appState.isToolLocked;
@@ -1,5 +1,5 @@
import { IconButton, styled, Tooltip } from '@toeverything/components/ui';
import type { ReactNode } from 'react';
import { Tooltip, styled, IconButton } from '@toeverything/components/ui';
interface PenProps {
name: string;
@@ -1,19 +1,18 @@
import { ReactElement, type CSSProperties } from 'react';
import style9 from 'style9';
import {
MuiDivider as Divider,
Popover,
Tooltip,
IconButton,
styled,
} from '@toeverything/components/ui';
import { TDShapeType, TDToolType } from '@toeverything/components/board-types';
import { TldrawApp } from '@toeverything/components/board-state';
import { TDShapeType, TDToolType } from '@toeverything/components/board-types';
import {
PencilDuotoneIcon,
HighlighterDuotoneIcon,
LaserPenDuotoneIcon,
PencilDuotoneIcon,
} from '@toeverything/components/icons';
import {
IconButton,
MuiDivider as Divider,
Popover,
styled,
Tooltip,
} from '@toeverything/components/ui';
import { ReactElement, type CSSProperties } from 'react';
import { Palette } from '../../palette';
import { Pen } from './Pen';
@@ -1,14 +1,14 @@
import AddIcon from '@mui/icons-material/Add';
import RemoveIcon from '@mui/icons-material/Remove';
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
import {
MuiIconButton as IconButton,
MuiButton as Button,
MuiIconButton as IconButton,
styled,
} from '@toeverything/components/ui';
import RemoveIcon from '@mui/icons-material/Remove';
import AddIcon from '@mui/icons-material/Add';
import UnfoldMoreIcon from '@mui/icons-material/UnfoldMore';
import { useTldrawApp } from '../../hooks';
import { TDSnapshot } from '@toeverything/components/board-types';
import { useTldrawApp } from '../../hooks';
import { MiniMap } from './mini-map';
@@ -4,9 +4,9 @@ import { TLDR } from '@toeverything/components/board-state';
import { styled } from '@toeverything/components/ui';
import { useTldrawApp } from '../../../hooks';
import { getViewportBound, processBound } from './bounds';
import { SimplifiedShape } from './SimplifiedShape';
import { Viewport } from './Viewport';
import { processBound, getViewportBound } from './bounds';
const MINI_MAP_WIDTH = 150;
const MINI_MAP_HEIGHT = 100;
@@ -1,6 +1,6 @@
import type { CSSProperties } from 'react';
import type { TLBounds } from '@tldraw/core';
import { styled } from '@toeverything/components/ui';
import type { CSSProperties } from 'react';
interface SimplifiedShapeProps extends TLBounds {
onClick?: () => void;
@@ -1,8 +1,8 @@
import type { CSSProperties, PointerEventHandler } from 'react';
import { useState, useRef } from 'react';
import type { TLBounds } from '@tldraw/core';
import Vec from '@tldraw/vec';
import { styled, alpha } from '@toeverything/components/ui';
import { alpha, styled } from '@toeverything/components/ui';
import type { CSSProperties, PointerEventHandler } from 'react';
import { useRef, useState } from 'react';
interface ViewportProps extends TLBounds {
onPan?: (delta: [number, number]) => void;
@@ -1,6 +1,6 @@
export * from './use-file-system-handlers';
export * from './use-keyboard-shortcuts';
export * from './use-tldraw-app';
// export * from './useTheme';
export * from './use-stylesheet';
export * from './use-file-system-handlers';
export * from './use-tldraw-app';
// export * from './useFileSystem';
@@ -1,8 +1,8 @@
import { AlignStyle, TDShapeType } from '@toeverything/components/board-types';
import * as React from 'react';
import { useHotkeys } from 'react-hotkeys-hook';
import { AlignStyle, TDShapeType } from '@toeverything/components/board-types';
import { useTldrawApp } from './use-tldraw-app';
import { useFileSystemHandlers } from './use-file-system-handlers';
import { useTldrawApp } from './use-tldraw-app';
export function useKeyboardShortcuts(ref: React.RefObject<HTMLDivElement>) {
const app = useTldrawApp();
@@ -1,5 +1,5 @@
import * as React from 'react';
import type { TldrawApp } from '@toeverything/components/board-state';
import * as React from 'react';
export const TldrawContext = React.createContext<TldrawApp>({} as TldrawApp);
+1 -1
View File
@@ -1,2 +1,2 @@
export { Tldraw } from './TlDraw';
export { useTldrawApp } from './hooks';
export { Tldraw } from './TlDraw';