diff --git a/libs/components/board-shapes/src/TDShapeUtil.tsx b/libs/components/board-shapes/src/TDShapeUtil.tsx index 2c7afe480e..bb8da6905e 100644 --- a/libs/components/board-shapes/src/TDShapeUtil.tsx +++ b/libs/components/board-shapes/src/TDShapeUtil.tsx @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { Utils, TLShapeUtil } from '@tldraw/core'; -import type { TLPointerInfo, TLBounds } from '@tldraw/core'; +import type { TLBounds, TLPointerInfo } from '@tldraw/core'; +import { TLShapeUtil, Utils } from '@tldraw/core'; import { intersectLineSegmentBounds, intersectLineSegmentPolyline, @@ -15,9 +15,9 @@ import type { } from '@toeverything/components/board-types'; import { BINDING_DISTANCE } from '@toeverything/components/board-types'; import { createRef } from 'react'; -import { getTextSvgElement } from './shared/get-text-svg-element'; -import { getTextLabelSize } from './shared/get-text-size'; import { getFontStyle, getShapeStyle } from './shared'; +import { getTextLabelSize } from './shared/get-text-size'; +import { getTextSvgElement } from './shared/get-text-svg-element'; export abstract class TDShapeUtil< T extends TDShape, diff --git a/libs/components/board-shapes/src/arrow-util/arrow-helpers.ts b/libs/components/board-shapes/src/arrow-util/arrow-helpers.ts index 9b3b747870..47916eeb63 100644 --- a/libs/components/board-shapes/src/arrow-util/arrow-helpers.ts +++ b/libs/components/board-shapes/src/arrow-util/arrow-helpers.ts @@ -4,14 +4,14 @@ import { intersectCircleLineSegment, } from '@tldraw/intersect'; import Vec from '@tldraw/vec'; -import getStroke from 'perfect-freehand'; -import { EASINGS } from '@toeverything/components/board-types'; -import { getShapeStyle } from '../shared/shape-styles'; import type { ArrowShape, Decoration, ShapeStyles, } from '@toeverything/components/board-types'; +import { EASINGS } from '@toeverything/components/board-types'; +import getStroke from 'perfect-freehand'; +import { getShapeStyle } from '../shared/shape-styles'; export function getArrowArcPath( start: number[], diff --git a/libs/components/board-shapes/src/arrow-util/arrow-util.tsx b/libs/components/board-shapes/src/arrow-util/arrow-util.tsx index 321ef27d2e..42045918f4 100644 --- a/libs/components/board-shapes/src/arrow-util/arrow-util.tsx +++ b/libs/components/board-shapes/src/arrow-util/arrow-util.tsx @@ -1,22 +1,30 @@ -import * as React from 'react'; -import { Utils, TLBounds, SVGContainer } from '@tldraw/core'; -import { Vec } from '@tldraw/vec'; -import { defaultStyle } from '../shared/shape-styles'; -import { - ArrowShape, - TransformInfo, - Decoration, - TDShapeType, - DashStyle, - TDMeta, - GHOSTED_OPACITY, -} from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; +import { SVGContainer, TLBounds, Utils } from '@tldraw/core'; import { intersectArcBounds, intersectLineSegmentBounds, intersectLineSegmentLineSegment, } from '@tldraw/intersect'; +import { Vec } from '@tldraw/vec'; +import { + ArrowShape, + DashStyle, + Decoration, + GHOSTED_OPACITY, + TDMeta, + TDShapeType, + TransformInfo, +} from '@toeverything/components/board-types'; +import { styled } from '@toeverything/components/ui'; +import * as React from 'react'; +import { + getFontStyle, + getShapeStyle, + getTextLabelSize, + LabelMask, + TextLabel, +} from '../shared'; +import { defaultStyle } from '../shared/shape-styles'; +import { TDShapeUtil } from '../TDShapeUtil'; import { getArcLength, getArcPoints, @@ -25,16 +33,8 @@ import { getCtp, isAngleBetween, } from './arrow-helpers'; -import { styled } from '@toeverything/components/ui'; -import { - TextLabel, - getFontStyle, - getShapeStyle, - getTextLabelSize, - LabelMask, -} from '../shared'; -import { StraightArrow } from './components/straight-arrow'; import { CurvedArrow } from './components/curved-arrow'; +import { StraightArrow } from './components/straight-arrow'; type T = ArrowShape; type E = HTMLDivElement; diff --git a/libs/components/board-shapes/src/arrow-util/components/arrow-head.tsx b/libs/components/board-shapes/src/arrow-util/components/arrow-head.tsx index 18fa47fecb..e574e500d5 100644 --- a/libs/components/board-shapes/src/arrow-util/components/arrow-head.tsx +++ b/libs/components/board-shapes/src/arrow-util/components/arrow-head.tsx @@ -1,5 +1,3 @@ -import * as React from 'react'; - export interface ArrowheadProps { left: number[]; middle: number[]; diff --git a/libs/components/board-shapes/src/arrow-util/components/curved-arrow.tsx b/libs/components/board-shapes/src/arrow-util/components/curved-arrow.tsx index 5fc8056cf3..9eed25c430 100644 --- a/libs/components/board-shapes/src/arrow-util/components/curved-arrow.tsx +++ b/libs/components/board-shapes/src/arrow-util/components/curved-arrow.tsx @@ -1,12 +1,12 @@ import { Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; -import * as React from 'react'; -import { EASINGS } from '@toeverything/components/board-types'; -import { getShapeStyle } from '../../shared'; import type { Decoration, ShapeStyles, } from '@toeverything/components/board-types'; +import { EASINGS } from '@toeverything/components/board-types'; +import * as React from 'react'; +import { getShapeStyle } from '../../shared'; import { getArcLength, getArrowArcPath, diff --git a/libs/components/board-shapes/src/arrow-util/components/straight-arrow.tsx b/libs/components/board-shapes/src/arrow-util/components/straight-arrow.tsx index 5414574a92..20d0d3c93f 100644 --- a/libs/components/board-shapes/src/arrow-util/components/straight-arrow.tsx +++ b/libs/components/board-shapes/src/arrow-util/components/straight-arrow.tsx @@ -1,11 +1,11 @@ import { Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; -import * as React from 'react'; -import { getShapeStyle } from '../../shared'; import type { Decoration, ShapeStyles, } from '@toeverything/components/board-types'; +import * as React from 'react'; +import { getShapeStyle } from '../../shared'; import { getStraightArrowHeadPoints, renderFreehandArrowShaft, diff --git a/libs/components/board-shapes/src/draw-util/DrawUtil.tsx b/libs/components/board-shapes/src/draw-util/DrawUtil.tsx index 9f78d0aa2c..db36aa0ef3 100644 --- a/libs/components/board-shapes/src/draw-util/DrawUtil.tsx +++ b/libs/components/board-shapes/src/draw-util/DrawUtil.tsx @@ -1,22 +1,22 @@ -import * as React from 'react'; -import { Utils, SVGContainer, TLBounds } from '@tldraw/core'; -import { Vec } from '@tldraw/vec'; -import { defaultStyle, getShapeStyle } from '../shared/shape-styles'; -import { - DrawShape, - DashStyle, - TDShapeType, - TransformInfo, - TDMeta, - GHOSTED_OPACITY, -} from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; +import { SVGContainer, TLBounds, Utils } from '@tldraw/core'; import { intersectBoundsBounds, intersectBoundsPolyline, intersectLineSegmentBounds, intersectLineSegmentLineSegment, } from '@tldraw/intersect'; +import { Vec } from '@tldraw/vec'; +import { + DashStyle, + DrawShape, + GHOSTED_OPACITY, + TDMeta, + TDShapeType, + TransformInfo, +} from '@toeverything/components/board-types'; +import * as React from 'react'; +import { defaultStyle, getShapeStyle } from '../shared/shape-styles'; +import { TDShapeUtil } from '../TDShapeUtil'; import { getDrawStrokePathTDSnapshot, getFillPath, diff --git a/libs/components/board-shapes/src/draw-util/draw-helpers.ts b/libs/components/board-shapes/src/draw-util/draw-helpers.ts index 58a59db027..f0cb0d434a 100644 --- a/libs/components/board-shapes/src/draw-util/draw-helpers.ts +++ b/libs/components/board-shapes/src/draw-util/draw-helpers.ts @@ -1,11 +1,11 @@ import { Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; +import type { DrawShape } from '@toeverything/components/board-types'; import { getStrokeOutlinePoints, getStrokePoints, StrokeOptions, } from 'perfect-freehand'; -import type { DrawShape } from '@toeverything/components/board-types'; import { getShapeStyle } from '../shared/shape-styles'; const simulatePressureSettings: StrokeOptions = { diff --git a/libs/components/board-shapes/src/editor-util/EditorUtil.tsx b/libs/components/board-shapes/src/editor-util/EditorUtil.tsx index 2f1820e0c3..f8b032dc17 100644 --- a/libs/components/board-shapes/src/editor-util/EditorUtil.tsx +++ b/libs/components/board-shapes/src/editor-util/EditorUtil.tsx @@ -1,24 +1,24 @@ /* eslint-disable no-restricted-syntax */ -import { useRef, useCallback, useEffect, memo } from 'react'; -import type { SyntheticEvent } from 'react'; -import { Utils, HTMLContainer, TLBounds } from '@tldraw/core'; +import { HTMLContainer, TLBounds, Utils } from '@tldraw/core'; +import { Vec } from '@tldraw/vec'; +import { AffineEditor } from '@toeverything/components/affine-editor'; import { EditorShape, TDMeta, TDShapeType, TransformInfo, } from '@toeverything/components/board-types'; +import { MIN_PAGE_WIDTH } from '@toeverything/components/editor-core'; +import { styled } from '@toeverything/components/ui'; +import type { SyntheticEvent } from 'react'; +import { memo, useCallback, useEffect, useRef } from 'react'; import { defaultTextStyle, getBoundsRectangle, getTextSvgElement, } from '../shared'; -import { TDShapeUtil } from '../TDShapeUtil'; import { getShapeStyle } from '../shared/shape-styles'; -import { styled } from '@toeverything/components/ui'; -import { Vec } from '@tldraw/vec'; -import { AffineEditor } from '@toeverything/components/affine-editor'; -import { MIN_PAGE_WIDTH } from '@toeverything/components/editor-core'; +import { TDShapeUtil } from '../TDShapeUtil'; const MemoAffineEditor = memo(AffineEditor, (prev, next) => { return ( prev.workspace === next.workspace && diff --git a/libs/components/board-shapes/src/ellipse-util/EllipseUtil.tsx b/libs/components/board-shapes/src/ellipse-util/EllipseUtil.tsx index 4cbd2cd897..1a25760094 100644 --- a/libs/components/board-shapes/src/ellipse-util/EllipseUtil.tsx +++ b/libs/components/board-shapes/src/ellipse-util/EllipseUtil.tsx @@ -1,32 +1,32 @@ -import * as React from 'react'; -import { Utils, SVGContainer, TLBounds } from '@tldraw/core'; -import { Vec } from '@tldraw/vec'; -import { - defaultStyle, - getShapeStyle, - getFontStyle, - TextLabel, -} from '../shared'; -import { - EllipseShape, - DashStyle, - TDShapeType, - TDShape, - TransformInfo, - TDMeta, - GHOSTED_OPACITY, - LABEL_POINT, -} from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; +import { SVGContainer, TLBounds, Utils } from '@tldraw/core'; import { intersectEllipseBounds, intersectLineSegmentEllipse, intersectRayEllipse, } from '@tldraw/intersect'; -import { getEllipseIndicatorPath } from './ellipse-helpers'; -import { DrawEllipse } from './components/DrawEllipse'; -import { DashedEllipse } from './components/DashedEllipse'; +import { Vec } from '@tldraw/vec'; +import { + DashStyle, + EllipseShape, + GHOSTED_OPACITY, + LABEL_POINT, + TDMeta, + TDShape, + TDShapeType, + TransformInfo, +} from '@toeverything/components/board-types'; import { styled } from '@toeverything/components/ui'; +import * as React from 'react'; +import { + defaultStyle, + getFontStyle, + getShapeStyle, + TextLabel, +} from '../shared'; +import { TDShapeUtil } from '../TDShapeUtil'; +import { DashedEllipse } from './components/DashedEllipse'; +import { DrawEllipse } from './components/DrawEllipse'; +import { getEllipseIndicatorPath } from './ellipse-helpers'; type T = EllipseShape; type E = HTMLDivElement; diff --git a/libs/components/board-shapes/src/ellipse-util/components/DashedEllipse.tsx b/libs/components/board-shapes/src/ellipse-util/components/DashedEllipse.tsx index 23dbaf5247..e24c017628 100644 --- a/libs/components/board-shapes/src/ellipse-util/components/DashedEllipse.tsx +++ b/libs/components/board-shapes/src/ellipse-util/components/DashedEllipse.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; import { Utils } from '@tldraw/core'; import type { ShapeStyles } from '@toeverything/components/board-types'; +import * as React from 'react'; import { getShapeStyle } from '../../shared'; interface EllipseSvgProps { diff --git a/libs/components/board-shapes/src/ellipse-util/components/DrawEllipse.tsx b/libs/components/board-shapes/src/ellipse-util/components/DrawEllipse.tsx index e768679512..7d1f9f4e7b 100644 --- a/libs/components/board-shapes/src/ellipse-util/components/DrawEllipse.tsx +++ b/libs/components/board-shapes/src/ellipse-util/components/DrawEllipse.tsx @@ -1,6 +1,6 @@ +import type { ShapeStyles } from '@toeverything/components/board-types'; import * as React from 'react'; import { getShapeStyle } from '../../shared'; -import type { ShapeStyles } from '@toeverything/components/board-types'; import { getEllipseIndicatorPath, getEllipsePath } from '../ellipse-helpers'; interface EllipseSvgProps { diff --git a/libs/components/board-shapes/src/ellipse-util/ellipse-helpers.ts b/libs/components/board-shapes/src/ellipse-util/ellipse-helpers.ts index be85174b2a..dcb2dcab5e 100644 --- a/libs/components/board-shapes/src/ellipse-util/ellipse-helpers.ts +++ b/libs/components/board-shapes/src/ellipse-util/ellipse-helpers.ts @@ -1,7 +1,7 @@ import { Utils } from '@tldraw/core'; -import { getStrokeOutlinePoints, getStrokePoints } from 'perfect-freehand'; -import { EASINGS } from '@toeverything/components/board-types'; import type { ShapeStyles } from '@toeverything/components/board-types'; +import { EASINGS } from '@toeverything/components/board-types'; +import { getStrokeOutlinePoints, getStrokePoints } from 'perfect-freehand'; import { getShapeStyle } from '../shared/shape-styles'; export function getEllipseStrokePoints( diff --git a/libs/components/board-shapes/src/frame-util/FrameUtil.tsx b/libs/components/board-shapes/src/frame-util/FrameUtil.tsx index 47fc778da7..22710dc9b7 100644 --- a/libs/components/board-shapes/src/frame-util/FrameUtil.tsx +++ b/libs/components/board-shapes/src/frame-util/FrameUtil.tsx @@ -1,20 +1,20 @@ /* eslint-disable no-restricted-syntax */ -import { Utils, SVGContainer } from '@tldraw/core'; +import { SVGContainer, Utils } from '@tldraw/core'; import { FrameShape, - TDShapeType, TDMeta, + TDShapeType, } from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; +import { styled } from '@toeverything/components/ui'; import { defaultStyle, - getShapeStyle, getBoundsRectangle, + getShapeStyle, transformRectangle, transformSingleRectangle, } from '../shared'; +import { TDShapeUtil } from '../TDShapeUtil'; import { Frame } from './components/Frame'; -import { styled } from '@toeverything/components/ui'; type T = FrameShape; type E = SVGSVGElement; diff --git a/libs/components/board-shapes/src/frame-util/components/Frame.tsx b/libs/components/board-shapes/src/frame-util/components/Frame.tsx index 57a6fa878a..57736495d8 100644 --- a/libs/components/board-shapes/src/frame-util/components/Frame.tsx +++ b/libs/components/board-shapes/src/frame-util/components/Frame.tsx @@ -1,6 +1,6 @@ -import * as React from 'react'; -import { BINDING_DISTANCE } from '@toeverything/components/board-types'; import type { ShapeStyles } from '@toeverything/components/board-types'; +import { BINDING_DISTANCE } from '@toeverything/components/board-types'; +import * as React from 'react'; import { getShapeStyle } from '../../shared'; interface RectangleSvgProps { diff --git a/libs/components/board-shapes/src/frame-util/components/frame-binding-indicator.tsx b/libs/components/board-shapes/src/frame-util/components/frame-binding-indicator.tsx index 3fab0bfd74..ee349f1634 100644 --- a/libs/components/board-shapes/src/frame-util/components/frame-binding-indicator.tsx +++ b/libs/components/board-shapes/src/frame-util/components/frame-binding-indicator.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { BINDING_DISTANCE } from '@toeverything/components/board-types'; interface BindingIndicatorProps { diff --git a/libs/components/board-shapes/src/group-util/group-util.tsx b/libs/components/board-shapes/src/group-util/group-util.tsx index f19792d340..07b8d2a6fe 100644 --- a/libs/components/board-shapes/src/group-util/group-util.tsx +++ b/libs/components/board-shapes/src/group-util/group-util.tsx @@ -1,15 +1,14 @@ -import * as React from 'react'; -import { styled } from '@toeverything/components/ui'; -import { Utils, SVGContainer } from '@tldraw/core'; -import { defaultStyle } from '../shared/shape-styles'; +import { SVGContainer, Utils } from '@tldraw/core'; import { - TDShapeType, + GHOSTED_OPACITY, GroupShape, TDMeta, - GHOSTED_OPACITY, + TDShapeType, } from '@toeverything/components/board-types'; +import { styled } from '@toeverything/components/ui'; +import { commonColors, getBoundsRectangle } from '../shared'; +import { defaultStyle } from '../shared/shape-styles'; import { TDShapeUtil } from '../TDShapeUtil'; -import { getBoundsRectangle, commonColors } from '../shared'; type T = GroupShape; type E = SVGSVGElement; diff --git a/libs/components/board-shapes/src/hexagon-util/HexagonUtil.tsx b/libs/components/board-shapes/src/hexagon-util/HexagonUtil.tsx index 2b0ba9921a..dd32d61056 100644 --- a/libs/components/board-shapes/src/hexagon-util/HexagonUtil.tsx +++ b/libs/components/board-shapes/src/hexagon-util/HexagonUtil.tsx @@ -1,36 +1,36 @@ -import * as React from 'react'; -import { Utils, SVGContainer, TLBounds } from '@tldraw/core'; -import { - HexagonShape, - TDShapeType, - TDMeta, - TDShape, - DashStyle, - BINDING_DISTANCE, - GHOSTED_OPACITY, - LABEL_POINT, -} from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; -import { - defaultStyle, - getBoundsRectangle, - transformRectangle, - transformSingleRectangle, - getFontStyle, - TextLabel, - getShapeStyle, -} from '../shared'; +import { SVGContainer, TLBounds, Utils } from '@tldraw/core'; import { intersectBoundsPolygon, intersectLineSegmentPolyline, intersectRayLineSegment, } from '@tldraw/intersect'; import Vec from '@tldraw/vec'; -import { getHexagonCentroid, getHexagonPoints } from './hexagon-helpers'; +import { + BINDING_DISTANCE, + DashStyle, + GHOSTED_OPACITY, + HexagonShape, + LABEL_POINT, + TDMeta, + TDShape, + TDShapeType, +} from '@toeverything/components/board-types'; import { styled } from '@toeverything/components/ui'; -import { DrawHexagon } from './components/DrawHexagon'; +import * as React from 'react'; +import { + defaultStyle, + getBoundsRectangle, + getFontStyle, + getShapeStyle, + TextLabel, + transformRectangle, + transformSingleRectangle, +} from '../shared'; +import { TDShapeUtil } from '../TDShapeUtil'; import { DashedHexagon } from './components/DashedHexagon'; +import { DrawHexagon } from './components/DrawHexagon'; import { HexagonBindingIndicator } from './components/HexagonBindingIndicator'; +import { getHexagonCentroid, getHexagonPoints } from './hexagon-helpers'; type T = HexagonShape; type E = HTMLDivElement; diff --git a/libs/components/board-shapes/src/hexagon-util/components/DashedHexagon.tsx b/libs/components/board-shapes/src/hexagon-util/components/DashedHexagon.tsx index 6a93e2ff36..4080ced2cb 100644 --- a/libs/components/board-shapes/src/hexagon-util/components/DashedHexagon.tsx +++ b/libs/components/board-shapes/src/hexagon-util/components/DashedHexagon.tsx @@ -1,9 +1,9 @@ -import * as React from 'react'; import { Utils } from '@tldraw/core'; +import Vec from '@tldraw/vec'; import type { ShapeStyles } from '@toeverything/components/board-types'; +import * as React from 'react'; import { getShapeStyle } from '../../shared'; import { getHexagonPoints } from '../hexagon-helpers'; -import Vec from '@tldraw/vec'; interface HexagonSvgProps { id: string; diff --git a/libs/components/board-shapes/src/hexagon-util/components/DrawHexagon.tsx b/libs/components/board-shapes/src/hexagon-util/components/DrawHexagon.tsx index 5d94b05b45..90018e312b 100644 --- a/libs/components/board-shapes/src/hexagon-util/components/DrawHexagon.tsx +++ b/libs/components/board-shapes/src/hexagon-util/components/DrawHexagon.tsx @@ -1,6 +1,6 @@ +import type { ShapeStyles } from '@toeverything/components/board-types'; import * as React from 'react'; import { getShapeStyle } from '../../shared'; -import type { ShapeStyles } from '@toeverything/components/board-types'; import { getHexagonIndicatorPathTDSnapshot, getHexagonPath, diff --git a/libs/components/board-shapes/src/hexagon-util/components/HexagonBindingIndicator.tsx b/libs/components/board-shapes/src/hexagon-util/components/HexagonBindingIndicator.tsx index 20cc6c7914..9ea7746669 100644 --- a/libs/components/board-shapes/src/hexagon-util/components/HexagonBindingIndicator.tsx +++ b/libs/components/board-shapes/src/hexagon-util/components/HexagonBindingIndicator.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { BINDING_DISTANCE } from '@toeverything/components/board-types'; import { getHexagonPoints } from '../hexagon-helpers'; diff --git a/libs/components/board-shapes/src/hexagon-util/hexagon-helpers.ts b/libs/components/board-shapes/src/hexagon-util/hexagon-helpers.ts index ea8497a3d0..77a17b32d2 100644 --- a/libs/components/board-shapes/src/hexagon-util/hexagon-helpers.ts +++ b/libs/components/board-shapes/src/hexagon-util/hexagon-helpers.ts @@ -1,8 +1,8 @@ import { Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; -import getStroke, { getStrokePoints } from 'perfect-freehand'; import type { ShapeStyles } from '@toeverything/components/board-types'; -import { getShapeStyle, getOffsetPolygon } from '../shared'; +import getStroke, { getStrokePoints } from 'perfect-freehand'; +import { getOffsetPolygon, getShapeStyle } from '../shared'; function getPonits(w: number, h: number) { return [ [w / 5, 0], diff --git a/libs/components/board-shapes/src/image-util/image-util.tsx b/libs/components/board-shapes/src/image-util/image-util.tsx index 95515fd23b..2becfdcc84 100644 --- a/libs/components/board-shapes/src/image-util/image-util.tsx +++ b/libs/components/board-shapes/src/image-util/image-util.tsx @@ -1,20 +1,20 @@ -import * as React from 'react'; -import { Utils, HTMLContainer } from '@tldraw/core'; +import { HTMLContainer, Utils } from '@tldraw/core'; import { - TDShapeType, - TDMeta, + GHOSTED_OPACITY, ImageShape, TDImageAsset, - GHOSTED_OPACITY, + TDMeta, + TDShapeType, } from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; +import { styled } from '@toeverything/components/ui'; +import * as React from 'react'; import { defaultStyle, getBoundsRectangle, transformRectangle, transformSingleRectangle, } from '../shared'; -import { styled } from '@toeverything/components/ui'; +import { TDShapeUtil } from '../TDShapeUtil'; type T = ImageShape; type E = HTMLDivElement; diff --git a/libs/components/board-shapes/src/index.ts b/libs/components/board-shapes/src/index.ts index 1c7fd3be39..3fc00bbbbd 100644 --- a/libs/components/board-shapes/src/index.ts +++ b/libs/components/board-shapes/src/index.ts @@ -1,20 +1,23 @@ import { TDShape, TDShapeType } from '@toeverything/components/board-types'; -import type { TDShapeUtil } from './TDShapeUtil'; -import { RectangleUtil } from './rectangle-util'; -import { TriangleUtil } from './triangle-util'; -import { HexagonUtil } from './hexagon-util'; import { ArrowUtil } from './arrow-util'; import { DrawUtil } from './draw-util'; -import { EllipseUtil } from './ellipse-util'; -import { GroupUtil } from './group-util'; -import { ImageUtil } from './image-util'; -import { VideoUtil } from './video-util'; import { EditorUtil } from './editor-util'; -import { PentagramUtil } from './pentagram-util'; -import { WhiteArrowUtil } from './white-arrow-util'; +import { EllipseUtil } from './ellipse-util'; import { FrameUtil } from './frame-util'; +import { GroupUtil } from './group-util'; +import { HexagonUtil } from './hexagon-util'; +import { ImageUtil } from './image-util'; +import { PentagramUtil } from './pentagram-util'; +import { RectangleUtil } from './rectangle-util'; +import type { TDShapeUtil } from './TDShapeUtil'; +import { TriangleUtil } from './triangle-util'; +import { VideoUtil } from './video-util'; +import { WhiteArrowUtil } from './white-arrow-util'; +export { clearPrevSize } from './shared/get-text-size'; +export { defaultStyle } from './shared/shape-styles'; export { TDShapeUtil } from './TDShapeUtil'; +export { getTrianglePoints } from './triangle-util/triangle-helpers'; export const Rectangle = new RectangleUtil(); export const Triangle = new TriangleUtil(); @@ -54,7 +57,3 @@ export const getShapeUtil = ( return shapeUtils[shape] as unknown as TDShapeUtil; return shapeUtils[shape.type] as unknown as TDShapeUtil; }; - -export { getTrianglePoints } from './triangle-util/triangle-helpers'; -export { defaultStyle } from './shared/shape-styles'; -export { clearPrevSize } from './shared/get-text-size'; diff --git a/libs/components/board-shapes/src/pentagram-util/PentagramUtil.tsx b/libs/components/board-shapes/src/pentagram-util/PentagramUtil.tsx index 74eb074c34..02770f4eea 100644 --- a/libs/components/board-shapes/src/pentagram-util/PentagramUtil.tsx +++ b/libs/components/board-shapes/src/pentagram-util/PentagramUtil.tsx @@ -1,36 +1,36 @@ -import * as React from 'react'; -import { Utils, SVGContainer, TLBounds } from '@tldraw/core'; -import { - PentagramShape, - TDShapeType, - TDMeta, - TDShape, - DashStyle, - BINDING_DISTANCE, - GHOSTED_OPACITY, - LABEL_POINT, -} from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; -import { - defaultStyle, - getBoundsRectangle, - transformRectangle, - transformSingleRectangle, - getFontStyle, - TextLabel, - getShapeStyle, -} from '../shared'; +import { SVGContainer, TLBounds, Utils } from '@tldraw/core'; import { intersectBoundsPolygon, intersectLineSegmentPolyline, intersectRayLineSegment, } from '@tldraw/intersect'; import Vec from '@tldraw/vec'; -import { getPentagramCentroid, getPentagramPoints } from './pentagram-helpers'; +import { + BINDING_DISTANCE, + DashStyle, + GHOSTED_OPACITY, + LABEL_POINT, + PentagramShape, + TDMeta, + TDShape, + TDShapeType, +} from '@toeverything/components/board-types'; import { styled } from '@toeverything/components/ui'; -import { DrawPentagram } from './components/DrawPentagram'; +import * as React from 'react'; +import { + defaultStyle, + getBoundsRectangle, + getFontStyle, + getShapeStyle, + TextLabel, + transformRectangle, + transformSingleRectangle, +} from '../shared'; +import { TDShapeUtil } from '../TDShapeUtil'; import { DashedPentagram } from './components/DashedPentagram'; +import { DrawPentagram } from './components/DrawPentagram'; import { PentagramBindingIndicator } from './components/PentagramBindingIndicator'; +import { getPentagramCentroid, getPentagramPoints } from './pentagram-helpers'; type T = PentagramShape; type E = HTMLDivElement; diff --git a/libs/components/board-shapes/src/pentagram-util/components/DashedPentagram.tsx b/libs/components/board-shapes/src/pentagram-util/components/DashedPentagram.tsx index 42c0189e49..5fc715e0c3 100644 --- a/libs/components/board-shapes/src/pentagram-util/components/DashedPentagram.tsx +++ b/libs/components/board-shapes/src/pentagram-util/components/DashedPentagram.tsx @@ -1,9 +1,9 @@ -import * as React from 'react'; import { Utils } from '@tldraw/core'; +import Vec from '@tldraw/vec'; import type { ShapeStyles } from '@toeverything/components/board-types'; +import * as React from 'react'; import { getShapeStyle } from '../../shared'; import { getPentagramPoints } from '../pentagram-helpers'; -import Vec from '@tldraw/vec'; interface PentagramSvgProps { id: string; diff --git a/libs/components/board-shapes/src/pentagram-util/components/DrawPentagram.tsx b/libs/components/board-shapes/src/pentagram-util/components/DrawPentagram.tsx index 9d2e1b99b9..17210e40aa 100644 --- a/libs/components/board-shapes/src/pentagram-util/components/DrawPentagram.tsx +++ b/libs/components/board-shapes/src/pentagram-util/components/DrawPentagram.tsx @@ -1,6 +1,6 @@ +import type { ShapeStyles } from '@toeverything/components/board-types'; import * as React from 'react'; import { getShapeStyle } from '../../shared'; -import type { ShapeStyles } from '@toeverything/components/board-types'; import { getPentagramIndicatorPathTDSnapshot, getPentagramPath, diff --git a/libs/components/board-shapes/src/pentagram-util/components/PentagramBindingIndicator.tsx b/libs/components/board-shapes/src/pentagram-util/components/PentagramBindingIndicator.tsx index 27981cbe38..61be5887ec 100644 --- a/libs/components/board-shapes/src/pentagram-util/components/PentagramBindingIndicator.tsx +++ b/libs/components/board-shapes/src/pentagram-util/components/PentagramBindingIndicator.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { BINDING_DISTANCE } from '@toeverything/components/board-types'; import { getPentagramPoints } from '../pentagram-helpers'; diff --git a/libs/components/board-shapes/src/pentagram-util/pentagram-helpers.ts b/libs/components/board-shapes/src/pentagram-util/pentagram-helpers.ts index addd55a5c6..155109bb1b 100644 --- a/libs/components/board-shapes/src/pentagram-util/pentagram-helpers.ts +++ b/libs/components/board-shapes/src/pentagram-util/pentagram-helpers.ts @@ -1,8 +1,8 @@ import { Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; -import getStroke, { getStrokePoints } from 'perfect-freehand'; import type { ShapeStyles } from '@toeverything/components/board-types'; -import { getShapeStyle, getOffsetPolygon } from '../shared'; +import getStroke, { getStrokePoints } from 'perfect-freehand'; +import { getOffsetPolygon, getShapeStyle } from '../shared'; function getPonits(w: number, h: number) { return [ [0, (76 / 200) * h], diff --git a/libs/components/board-shapes/src/rectangle-util/RectangleUtil.tsx b/libs/components/board-shapes/src/rectangle-util/RectangleUtil.tsx index ec6cebb2f0..c5fbbaa4da 100644 --- a/libs/components/board-shapes/src/rectangle-util/RectangleUtil.tsx +++ b/libs/components/board-shapes/src/rectangle-util/RectangleUtil.tsx @@ -1,28 +1,28 @@ -import * as React from 'react'; -import { Utils, SVGContainer } from '@tldraw/core'; +import { SVGContainer, Utils } from '@tldraw/core'; import { - RectangleShape, DashStyle, - TDShapeType, - TDMeta, GHOSTED_OPACITY, LABEL_POINT, + RectangleShape, + TDMeta, + TDShapeType, } from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; +import { styled } from '@toeverything/components/ui'; +import * as React from 'react'; import { defaultStyle, - getShapeStyle, getBoundsRectangle, - transformRectangle, getFontStyle, + getShapeStyle, + transformRectangle, transformSingleRectangle, } from '../shared'; import { TextLabel } from '../shared/text-label'; -import { getRectangleIndicatorPathTDSnapshot } from './rectangle-helpers'; -import { DrawRectangle } from './components/DrawRectangle'; -import { DashedRectangle } from './components/DashedRectangle'; +import { TDShapeUtil } from '../TDShapeUtil'; import { BindingIndicator } from './components/BindingIndicator'; -import { styled } from '@toeverything/components/ui'; +import { DashedRectangle } from './components/DashedRectangle'; +import { DrawRectangle } from './components/DrawRectangle'; +import { getRectangleIndicatorPathTDSnapshot } from './rectangle-helpers'; type T = RectangleShape; type E = HTMLDivElement; diff --git a/libs/components/board-shapes/src/rectangle-util/components/BindingIndicator.tsx b/libs/components/board-shapes/src/rectangle-util/components/BindingIndicator.tsx index 3fab0bfd74..ee349f1634 100644 --- a/libs/components/board-shapes/src/rectangle-util/components/BindingIndicator.tsx +++ b/libs/components/board-shapes/src/rectangle-util/components/BindingIndicator.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { BINDING_DISTANCE } from '@toeverything/components/board-types'; interface BindingIndicatorProps { diff --git a/libs/components/board-shapes/src/rectangle-util/components/DashedRectangle.tsx b/libs/components/board-shapes/src/rectangle-util/components/DashedRectangle.tsx index 6b5289cac0..77ee2cec6a 100644 --- a/libs/components/board-shapes/src/rectangle-util/components/DashedRectangle.tsx +++ b/libs/components/board-shapes/src/rectangle-util/components/DashedRectangle.tsx @@ -1,7 +1,7 @@ -import * as React from 'react'; import { Utils } from '@tldraw/core'; -import { BINDING_DISTANCE } from '@toeverything/components/board-types'; import type { ShapeStyles } from '@toeverything/components/board-types'; +import { BINDING_DISTANCE } from '@toeverything/components/board-types'; +import * as React from 'react'; import { getShapeStyle } from '../../shared'; interface RectangleSvgProps { diff --git a/libs/components/board-shapes/src/rectangle-util/components/DrawRectangle.tsx b/libs/components/board-shapes/src/rectangle-util/components/DrawRectangle.tsx index 291c7fea18..9858ac6983 100644 --- a/libs/components/board-shapes/src/rectangle-util/components/DrawRectangle.tsx +++ b/libs/components/board-shapes/src/rectangle-util/components/DrawRectangle.tsx @@ -1,6 +1,6 @@ +import type { ShapeStyles } from '@toeverything/components/board-types'; import * as React from 'react'; import { getShapeStyle } from '../../shared'; -import type { ShapeStyles } from '@toeverything/components/board-types'; import { getRectangleIndicatorPathTDSnapshot, getRectanglePath, diff --git a/libs/components/board-shapes/src/rectangle-util/rectangle-helpers.ts b/libs/components/board-shapes/src/rectangle-util/rectangle-helpers.ts index a815c6d550..4b10de4e38 100644 --- a/libs/components/board-shapes/src/rectangle-util/rectangle-helpers.ts +++ b/libs/components/board-shapes/src/rectangle-util/rectangle-helpers.ts @@ -1,7 +1,7 @@ import { Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; -import getStroke, { getStrokePoints } from 'perfect-freehand'; import type { ShapeStyles } from '@toeverything/components/board-types'; +import getStroke, { getStrokePoints } from 'perfect-freehand'; import { getShapeStyle } from '../shared'; function getRectangleDrawPoints( diff --git a/libs/components/board-shapes/src/shared/get-text-svg-element.ts b/libs/components/board-shapes/src/shared/get-text-svg-element.ts index f6584e9a40..3f5a496ed7 100644 --- a/libs/components/board-shapes/src/shared/get-text-svg-element.ts +++ b/libs/components/board-shapes/src/shared/get-text-svg-element.ts @@ -1,11 +1,11 @@ import type { TLBounds } from '@tldraw/core'; -import { getFontFace, getFontSize } from './shape-styles'; -import { getTextAlign } from './get-text-align'; import { - LINE_HEIGHT, AlignStyle, + LINE_HEIGHT, ShapeStyles, } from '@toeverything/components/board-types'; +import { getTextAlign } from './get-text-align'; +import { getFontFace, getFontSize } from './shape-styles'; export function getTextSvgElement( text: string, diff --git a/libs/components/board-shapes/src/shared/index.ts b/libs/components/board-shapes/src/shared/index.ts index b2a3abd316..95fe5ace99 100644 --- a/libs/components/board-shapes/src/shared/index.ts +++ b/libs/components/board-shapes/src/shared/index.ts @@ -1,12 +1,12 @@ +export * from './get-bounds-rectangle'; export * from './get-text-align'; export * from './get-text-size'; export * from './get-text-svg-element'; -export * from './shape-styles'; -export * from './get-bounds-rectangle'; -export * from './transform-rectangle'; -export * from './transform-single-rectangle'; -export * from './text-label'; -export * from './polygon-utils'; export * from './label-mask'; export * from './normalize-text'; +export * from './polygon-utils'; +export * from './shape-styles'; export * from './stop-propagation'; +export * from './text-label'; +export * from './transform-rectangle'; +export * from './transform-single-rectangle'; diff --git a/libs/components/board-shapes/src/shared/label-mask.tsx b/libs/components/board-shapes/src/shared/label-mask.tsx index fe61b0e92f..d7b62eda1b 100644 --- a/libs/components/board-shapes/src/shared/label-mask.tsx +++ b/libs/components/board-shapes/src/shared/label-mask.tsx @@ -1,5 +1,4 @@ import type { TLBounds } from '@tldraw/core'; -import * as React from 'react'; interface WithLabelMaskProps { id: string; diff --git a/libs/components/board-shapes/src/shared/shape-styles.ts b/libs/components/board-shapes/src/shared/shape-styles.ts index 9d0cc4fe29..b21ab6152a 100644 --- a/libs/components/board-shapes/src/shared/shape-styles.ts +++ b/libs/components/board-shapes/src/shared/shape-styles.ts @@ -1,13 +1,13 @@ import { Utils } from '@tldraw/core'; import { - Theme, + AlignStyle, ColorStyle, DashStyle, - ShapeStyles, FontSizeStyle, FontStyle, - AlignStyle, + ShapeStyles, StrokeWidth, + Theme, } from '@toeverything/components/board-types'; const canvasLight = '#fafafa'; diff --git a/libs/components/board-shapes/src/shared/text-label.tsx b/libs/components/board-shapes/src/shared/text-label.tsx index 02dc0056de..ba40f38f01 100644 --- a/libs/components/board-shapes/src/shared/text-label.tsx +++ b/libs/components/board-shapes/src/shared/text-label.tsx @@ -1,12 +1,12 @@ -import * as React from 'react'; -import { stopPropagation } from './stop-propagation'; import { GHOSTED_OPACITY, LETTER_SPACING, } from '@toeverything/components/board-types'; -import { normalizeText } from './normalize-text'; import { styled } from '@toeverything/components/ui'; +import * as React from 'react'; import { getTextLabelSize } from './get-text-size'; +import { normalizeText } from './normalize-text'; +import { stopPropagation } from './stop-propagation'; import { TextAreaUtils } from './text-area-utils'; export interface TextLabelProps { diff --git a/libs/components/board-shapes/src/triangle-util/TriangleUtil.tsx b/libs/components/board-shapes/src/triangle-util/TriangleUtil.tsx index 7a5fc6963a..514287b1bd 100644 --- a/libs/components/board-shapes/src/triangle-util/TriangleUtil.tsx +++ b/libs/components/board-shapes/src/triangle-util/TriangleUtil.tsx @@ -1,36 +1,36 @@ -import * as React from 'react'; -import { Utils, SVGContainer, TLBounds } from '@tldraw/core'; -import { - TriangleShape, - TDShapeType, - TDMeta, - TDShape, - DashStyle, - BINDING_DISTANCE, - GHOSTED_OPACITY, - LABEL_POINT, -} from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; -import { - defaultStyle, - getBoundsRectangle, - transformRectangle, - transformSingleRectangle, - getFontStyle, - TextLabel, - getShapeStyle, -} from '../shared'; +import { SVGContainer, TLBounds, Utils } from '@tldraw/core'; import { intersectBoundsPolygon, intersectLineSegmentPolyline, intersectRayLineSegment, } from '@tldraw/intersect'; import Vec from '@tldraw/vec'; -import { getTriangleCentroid, getTrianglePoints } from './triangle-helpers'; +import { + BINDING_DISTANCE, + DashStyle, + GHOSTED_OPACITY, + LABEL_POINT, + TDMeta, + TDShape, + TDShapeType, + TriangleShape, +} from '@toeverything/components/board-types'; import { styled } from '@toeverything/components/ui'; -import { DrawTriangle } from './components/DrawTriangle'; +import * as React from 'react'; +import { + defaultStyle, + getBoundsRectangle, + getFontStyle, + getShapeStyle, + TextLabel, + transformRectangle, + transformSingleRectangle, +} from '../shared'; +import { TDShapeUtil } from '../TDShapeUtil'; import { DashedTriangle } from './components/DashedTriangle'; +import { DrawTriangle } from './components/DrawTriangle'; import { TriangleBindingIndicator } from './components/TriangleBindingIndicator'; +import { getTriangleCentroid, getTrianglePoints } from './triangle-helpers'; type T = TriangleShape; type E = HTMLDivElement; diff --git a/libs/components/board-shapes/src/triangle-util/components/DashedTriangle.tsx b/libs/components/board-shapes/src/triangle-util/components/DashedTriangle.tsx index 71b49b626b..b33914a43b 100644 --- a/libs/components/board-shapes/src/triangle-util/components/DashedTriangle.tsx +++ b/libs/components/board-shapes/src/triangle-util/components/DashedTriangle.tsx @@ -1,9 +1,9 @@ -import * as React from 'react'; import { Utils } from '@tldraw/core'; +import Vec from '@tldraw/vec'; import type { ShapeStyles } from '@toeverything/components/board-types'; +import * as React from 'react'; import { getShapeStyle } from '../../shared'; import { getTrianglePoints } from '../triangle-helpers'; -import Vec from '@tldraw/vec'; interface TriangleSvgProps { id: string; diff --git a/libs/components/board-shapes/src/triangle-util/components/DrawTriangle.tsx b/libs/components/board-shapes/src/triangle-util/components/DrawTriangle.tsx index b6a21cc449..4cbfdf8ce0 100644 --- a/libs/components/board-shapes/src/triangle-util/components/DrawTriangle.tsx +++ b/libs/components/board-shapes/src/triangle-util/components/DrawTriangle.tsx @@ -1,6 +1,6 @@ +import type { ShapeStyles } from '@toeverything/components/board-types'; import * as React from 'react'; import { getShapeStyle } from '../../shared'; -import type { ShapeStyles } from '@toeverything/components/board-types'; import { getTriangleIndicatorPathTDSnapshot, getTrianglePath, diff --git a/libs/components/board-shapes/src/triangle-util/components/TriangleBindingIndicator.tsx b/libs/components/board-shapes/src/triangle-util/components/TriangleBindingIndicator.tsx index 3953d705e9..078b534887 100644 --- a/libs/components/board-shapes/src/triangle-util/components/TriangleBindingIndicator.tsx +++ b/libs/components/board-shapes/src/triangle-util/components/TriangleBindingIndicator.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { BINDING_DISTANCE } from '@toeverything/components/board-types'; import { getTrianglePoints } from '../triangle-helpers'; diff --git a/libs/components/board-shapes/src/triangle-util/triangle-helpers.ts b/libs/components/board-shapes/src/triangle-util/triangle-helpers.ts index d1475364d4..892eb7eb1b 100644 --- a/libs/components/board-shapes/src/triangle-util/triangle-helpers.ts +++ b/libs/components/board-shapes/src/triangle-util/triangle-helpers.ts @@ -1,8 +1,8 @@ import { Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; -import getStroke, { getStrokePoints } from 'perfect-freehand'; import type { ShapeStyles } from '@toeverything/components/board-types'; -import { getShapeStyle, getOffsetPolygon } from '../shared'; +import getStroke, { getStrokePoints } from 'perfect-freehand'; +import { getOffsetPolygon, getShapeStyle } from '../shared'; export function getTrianglePoints(size: number[], offset = 0, rotation = 0) { const [w, h] = size; diff --git a/libs/components/board-shapes/src/video-util/video-util.tsx b/libs/components/board-shapes/src/video-util/video-util.tsx index 1e00d830ad..22b51284d4 100644 --- a/libs/components/board-shapes/src/video-util/video-util.tsx +++ b/libs/components/board-shapes/src/video-util/video-util.tsx @@ -1,20 +1,20 @@ -import * as React from 'react'; -import { Utils, HTMLContainer } from '@tldraw/core'; +import { HTMLContainer, Utils } from '@tldraw/core'; import { - TDShapeType, - TDMeta, - VideoShape, - TDVideoAsset, GHOSTED_OPACITY, + TDMeta, + TDShapeType, + TDVideoAsset, + VideoShape, } from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; +import { styled } from '@toeverything/components/ui'; +import * as React from 'react'; import { defaultStyle, getBoundsRectangle, transformRectangle, transformSingleRectangle, } from '../shared'; -import { styled } from '@toeverything/components/ui'; +import { TDShapeUtil } from '../TDShapeUtil'; type T = VideoShape; type E = HTMLDivElement; diff --git a/libs/components/board-shapes/src/white-arrow-util/WhiteArrowUtil.tsx b/libs/components/board-shapes/src/white-arrow-util/WhiteArrowUtil.tsx index 877fe60f4b..b767dde966 100644 --- a/libs/components/board-shapes/src/white-arrow-util/WhiteArrowUtil.tsx +++ b/libs/components/board-shapes/src/white-arrow-util/WhiteArrowUtil.tsx @@ -1,39 +1,39 @@ -import * as React from 'react'; -import { Utils, SVGContainer, TLBounds } from '@tldraw/core'; -import { - WhiteArrowShape, - TDShapeType, - TDMeta, - TDShape, - DashStyle, - BINDING_DISTANCE, - GHOSTED_OPACITY, - LABEL_POINT, -} from '@toeverything/components/board-types'; -import { TDShapeUtil } from '../TDShapeUtil'; -import { - defaultStyle, - getBoundsRectangle, - transformRectangle, - transformSingleRectangle, - getFontStyle, - TextLabel, - getShapeStyle, -} from '../shared'; +import { SVGContainer, TLBounds, Utils } from '@tldraw/core'; import { intersectBoundsPolygon, intersectLineSegmentPolyline, intersectRayLineSegment, } from '@tldraw/intersect'; import Vec from '@tldraw/vec'; +import { + BINDING_DISTANCE, + DashStyle, + GHOSTED_OPACITY, + LABEL_POINT, + TDMeta, + TDShape, + TDShapeType, + WhiteArrowShape, +} from '@toeverything/components/board-types'; +import { styled } from '@toeverything/components/ui'; +import * as React from 'react'; +import { + defaultStyle, + getBoundsRectangle, + getFontStyle, + getShapeStyle, + TextLabel, + transformRectangle, + transformSingleRectangle, +} from '../shared'; +import { TDShapeUtil } from '../TDShapeUtil'; +import { DashedWhiteArrow } from './components/DashedWhiteArrow'; +import { DrawWhiteArrow } from './components/DrawWhiteArrow'; +import { WhiteArrowBindingIndicator } from './components/WhiteArrowBindingIndicator'; import { getWhiteArrowCentroid, getWhiteArrowPoints, } from './white-arrow-helpers'; -import { styled } from '@toeverything/components/ui'; -import { DrawWhiteArrow } from './components/DrawWhiteArrow'; -import { DashedWhiteArrow } from './components/DashedWhiteArrow'; -import { WhiteArrowBindingIndicator } from './components/WhiteArrowBindingIndicator'; type T = WhiteArrowShape; type E = HTMLDivElement; diff --git a/libs/components/board-shapes/src/white-arrow-util/components/DashedWhiteArrow.tsx b/libs/components/board-shapes/src/white-arrow-util/components/DashedWhiteArrow.tsx index 7ad535e69c..16e3e12543 100644 --- a/libs/components/board-shapes/src/white-arrow-util/components/DashedWhiteArrow.tsx +++ b/libs/components/board-shapes/src/white-arrow-util/components/DashedWhiteArrow.tsx @@ -1,9 +1,9 @@ -import * as React from 'react'; import { Utils } from '@tldraw/core'; +import Vec from '@tldraw/vec'; import type { ShapeStyles } from '@toeverything/components/board-types'; +import * as React from 'react'; import { getShapeStyle } from '../../shared'; import { getWhiteArrowPoints } from '../white-arrow-helpers'; -import Vec from '@tldraw/vec'; interface WhiteArrowSvgProps { id: string; diff --git a/libs/components/board-shapes/src/white-arrow-util/components/DrawWhiteArrow.tsx b/libs/components/board-shapes/src/white-arrow-util/components/DrawWhiteArrow.tsx index 352d756837..ff404c79d0 100644 --- a/libs/components/board-shapes/src/white-arrow-util/components/DrawWhiteArrow.tsx +++ b/libs/components/board-shapes/src/white-arrow-util/components/DrawWhiteArrow.tsx @@ -1,6 +1,6 @@ +import type { ShapeStyles } from '@toeverything/components/board-types'; import * as React from 'react'; import { getShapeStyle } from '../../shared'; -import type { ShapeStyles } from '@toeverything/components/board-types'; import { getWhiteArrowIndicatorPathTDSnapshot, getWhiteArrowPath, diff --git a/libs/components/board-shapes/src/white-arrow-util/components/WhiteArrowBindingIndicator.tsx b/libs/components/board-shapes/src/white-arrow-util/components/WhiteArrowBindingIndicator.tsx index e5196cf77b..d8bac6163c 100644 --- a/libs/components/board-shapes/src/white-arrow-util/components/WhiteArrowBindingIndicator.tsx +++ b/libs/components/board-shapes/src/white-arrow-util/components/WhiteArrowBindingIndicator.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import { BINDING_DISTANCE } from '@toeverything/components/board-types'; import { getWhiteArrowPoints } from '../white-arrow-helpers'; diff --git a/libs/components/board-shapes/src/white-arrow-util/white-arrow-helpers.ts b/libs/components/board-shapes/src/white-arrow-util/white-arrow-helpers.ts index f05f5b42b2..587dbd251b 100644 --- a/libs/components/board-shapes/src/white-arrow-util/white-arrow-helpers.ts +++ b/libs/components/board-shapes/src/white-arrow-util/white-arrow-helpers.ts @@ -1,8 +1,8 @@ import { Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; -import getStroke, { getStrokePoints } from 'perfect-freehand'; import type { ShapeStyles } from '@toeverything/components/board-types'; -import { getShapeStyle, getOffsetPolygon } from '../shared'; +import getStroke, { getStrokePoints } from 'perfect-freehand'; +import { getOffsetPolygon, getShapeStyle } from '../shared'; function getPonits(w: number, h: number) { return [ [w / 2, 0], diff --git a/libs/components/board-state/src/data/filesystem.ts b/libs/components/board-state/src/data/filesystem.ts index 79b6ba6c49..9825b1e591 100644 --- a/libs/components/board-state/src/data/filesystem.ts +++ b/libs/components/board-state/src/data/filesystem.ts @@ -1,11 +1,11 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ import type { TDDocument, TDFile } from '@toeverything/components/board-types'; -import type { FileSystemHandle } from './browser-fs-access'; -import { get as getFromIdb, set as setToIdb } from 'idb-keyval'; import { IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, } from '@toeverything/components/board-types'; +import { get as getFromIdb, set as setToIdb } from 'idb-keyval'; +import type { FileSystemHandle } from './browser-fs-access'; const options = { mode: 'readwrite' as const }; diff --git a/libs/components/board-state/src/data/index.ts b/libs/components/board-state/src/data/index.ts index 6d9a5d19e1..a00fd2a70b 100644 --- a/libs/components/board-state/src/data/index.ts +++ b/libs/components/board-state/src/data/index.ts @@ -1,3 +1,3 @@ -export * from './migrate'; -export * from './filesystem'; export * from './browser-fs-access'; +export * from './filesystem'; +export * from './migrate'; diff --git a/libs/components/board-state/src/data/migrate.spec.ts b/libs/components/board-state/src/data/migrate.spec.ts index d26024f1b4..30e0612c5f 100644 --- a/libs/components/board-state/src/data/migrate.spec.ts +++ b/libs/components/board-state/src/data/migrate.spec.ts @@ -1,7 +1,7 @@ -import type { TDDocument } from '~types'; import { TldrawApp } from '~state'; import oldDoc from '~test/documents/old-doc'; import oldDoc2 from '~test/documents/old-doc-2'; +import type { TDDocument } from '~types'; describe('When migrating bindings', () => { it('migrates a document without a version', () => { diff --git a/libs/components/board-state/src/data/migrate.ts b/libs/components/board-state/src/data/migrate.ts index 98eb1dd330..d4c14a5edf 100644 --- a/libs/components/board-state/src/data/migrate.ts +++ b/libs/components/board-state/src/data/migrate.ts @@ -1,10 +1,8 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ import { Decoration, - FontStyle, TDDocument, TDShapeType, - // TextShape } from '@toeverything/components/board-types'; export function migrate(document: TDDocument, newVersion: number): TDDocument { diff --git a/libs/components/board-state/src/idb-clipboard.ts b/libs/components/board-state/src/idb-clipboard.ts index d7f47cc4a8..15af99f995 100644 --- a/libs/components/board-state/src/idb-clipboard.ts +++ b/libs/components/board-state/src/idb-clipboard.ts @@ -1,4 +1,4 @@ -import { get, set, del } from 'idb-keyval'; +import { del, get, set } from 'idb-keyval'; // Used for clipboard diff --git a/libs/components/board-state/src/index.ts b/libs/components/board-state/src/index.ts index 11dcb37c9f..e43f912111 100644 --- a/libs/components/board-state/src/index.ts +++ b/libs/components/board-state/src/index.ts @@ -1,5 +1,5 @@ +export { deepCopy } from './manager/deep-copy'; +export { TLDR } from './tldr'; export { TldrawApp } from './tldraw-app'; export type { TldrawAppCtorProps } from './tldraw-app'; -export { TLDR } from './tldr'; -export { deepCopy } from './manager/deep-copy'; export { BaseTool, Status as BaseToolStatus } from './types/tool'; diff --git a/libs/components/board-state/src/manager/state-manager.ts b/libs/components/board-state/src/manager/state-manager.ts index ae3c757da6..908e9134ad 100644 --- a/libs/components/board-state/src/manager/state-manager.ts +++ b/libs/components/board-state/src/manager/state-manager.ts @@ -1,9 +1,9 @@ -import createVanilla, { StoreApi } from 'zustand/vanilla'; -import create, { UseBoundStore } from 'zustand'; -import * as idb from 'idb-keyval'; -import { deepCopy } from './deep-copy'; -import type { Patch, Command } from '@toeverything/components/board-types'; import { Utils } from '@tldraw/core'; +import type { Command, Patch } from '@toeverything/components/board-types'; +import * as idb from 'idb-keyval'; +import create, { UseBoundStore } from 'zustand'; +import createVanilla, { StoreApi } from 'zustand/vanilla'; +import { deepCopy } from './deep-copy'; export class StateManager> { /** diff --git a/libs/components/board-state/src/tldr.ts b/libs/components/board-state/src/tldr.ts index a96f33317b..fbd3304121 100644 --- a/libs/components/board-state/src/tldr.ts +++ b/libs/components/board-state/src/tldr.ts @@ -1,31 +1,31 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import { TLBounds, TLTransformInfo, Utils, TLPageState } from '@tldraw/core'; +import { TLBounds, TLPageState, TLTransformInfo, Utils } from '@tldraw/core'; import { - TDSnapshot, - ShapesWithProp, - TDShape, - TDBinding, - TDPage, - TldrawCommand, - TldrawPatch, - TDShapeType, - ArrowShape, - TDHandle, - TDExportType, - BINDING_DISTANCE, -} from '@toeverything/components/board-types'; + intersectRayBounds, + intersectRayEllipse, + intersectRayLineSegment, +} from '@tldraw/intersect'; import { Vec } from '@tldraw/vec'; import type { TDShapeUtil } from '@toeverything/components/board-shapes'; import { getShapeUtil, getTrianglePoints, } from '@toeverything/components/board-shapes'; -import { deepCopy } from './manager/deep-copy'; import { - intersectRayBounds, - intersectRayEllipse, - intersectRayLineSegment, -} from '@tldraw/intersect'; + ArrowShape, + BINDING_DISTANCE, + ShapesWithProp, + TDBinding, + TDExportType, + TDHandle, + TDPage, + TDShape, + TDShapeType, + TDSnapshot, + TldrawCommand, + TldrawPatch, +} from '@toeverything/components/board-types'; +import { deepCopy } from './manager/deep-copy'; const isDev = process.env['NODE_ENV'] === 'development'; diff --git a/libs/components/board-state/src/tldraw-app.ts b/libs/components/board-state/src/tldraw-app.ts index b062cc8b8c..16d6edc1eb 100644 --- a/libs/components/board-state/src/tldraw-app.ts +++ b/libs/components/board-state/src/tldraw-app.ts @@ -3,77 +3,77 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable no-restricted-syntax */ -import { Vec } from '@tldraw/vec'; import { + TLBounds, TLBoundsEventHandler, TLBoundsHandleEventHandler, - TLKeyboardEventHandler, - TLShapeCloneHandler, TLCanvasEventHandler, + TLDropEventHandler, + TLKeyboardEventHandler, TLPageState, TLPinchEventHandler, TLPointerEventHandler, + TLShapeCloneHandler, TLWheelEventHandler, Utils, - TLBounds, - TLDropEventHandler, } from '@tldraw/core'; +import { Vec } from '@tldraw/vec'; +import { + clearPrevSize, + defaultStyle, + shapeUtils, +} from '@toeverything/components/board-shapes'; import { - FlipType, - TDDocument, - MoveType, AlignType, - StretchType, + ArrowShape, + BaseSessionType, DistributeType, + FIT_TO_SCREEN_PADDING, + FlipType, + GRID_SIZE, + GroupShape, + IMAGE_EXTENSIONS, + MoveType, + SessionType, ShapeStyles, + StretchType, + SVG_EXPORT_PADDING, + TDAsset, + TDAssets, + TDAssetType, + TDBinding, + TDDocument, + TDExport, + TDExportType, + TDPage, TDShape, TDShapeType, TDSnapshot, TDStatus, - TDPage, - TDBinding, - GroupShape, - TldrawCommand, - TDUser, - SessionType, TDToolType, - TDAssetType, - TDAsset, - TDAssets, - TDExport, - ArrowShape, - TDExportType, + TDUser, + TldrawCommand, USER_COLORS, - FIT_TO_SCREEN_PADDING, - GRID_SIZE, - IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, - SVG_EXPORT_PADDING, - BaseSessionType, } from '@toeverything/components/board-types'; +import { MIN_PAGE_WIDTH } from '@toeverything/components/editor-core'; import { - migrate, FileSystemHandle, - loadFileHandle, - openFromFileSystem, - saveToFileSystem, - openAssetFromFileSystem, fileToBase64, fileToText, getImageSizeFromSrc, getVideoSizeFromSrc, + loadFileHandle, + migrate, + openAssetFromFileSystem, + openFromFileSystem, + saveToFileSystem, } from './data'; -import { TLDR } from './tldr'; -import { - shapeUtils, - defaultStyle, - clearPrevSize, -} from '@toeverything/components/board-shapes'; -import { StateManager } from './manager/state-manager'; import { getClipboard, setClipboard } from './idb-clipboard'; +import { StateManager } from './manager/state-manager'; +import { TLDR } from './tldr'; import type { Commands } from './types/commands'; import type { BaseTool } from './types/tool'; -import { MIN_PAGE_WIDTH } from '@toeverything/components/editor-core'; const uuid = Utils.uniqueId(); diff --git a/libs/components/board-state/src/types/commands.ts b/libs/components/board-state/src/types/commands.ts index 5a26a22788..44e4b4025c 100644 --- a/libs/components/board-state/src/types/commands.ts +++ b/libs/components/board-state/src/types/commands.ts @@ -1,17 +1,17 @@ import type { TLBounds } from '@tldraw/core'; -import type { TldrawApp } from '../tldraw-app'; import type { - TldrawCommand, AlignType, - TDShape, - TDBinding, DistributeType, FlipType, - MoveType, - StretchType, - ShapeStyles, GroupShape, + MoveType, + ShapeStyles, + StretchType, + TDBinding, + TDShape, + TldrawCommand, } from '@toeverything/components/board-types'; +import type { TldrawApp } from '../tldraw-app'; export interface Commands { alignShapes(app: TldrawApp, ids: string[], type: AlignType): TldrawCommand; diff --git a/libs/components/board-state/src/types/tool.ts b/libs/components/board-state/src/types/tool.ts index d318a8b679..931d8bc63c 100644 --- a/libs/components/board-state/src/types/tool.ts +++ b/libs/components/board-state/src/types/tool.ts @@ -4,11 +4,11 @@ import { TLPointerEventHandler, Utils, } from '@tldraw/core'; -import type { TldrawApp } from '../tldraw-app'; import { TDEventHandler, TDToolType, } from '@toeverything/components/board-types'; +import type { TldrawApp } from '../tldraw-app'; export enum Status { Idle = 'idle', diff --git a/libs/components/board-tools/src/arrow-tool/arrow-tool.ts b/libs/components/board-tools/src/arrow-tool/arrow-tool.ts index 8ad9f4255f..49be807408 100644 --- a/libs/components/board-tools/src/arrow-tool/arrow-tool.ts +++ b/libs/components/board-tools/src/arrow-tool/arrow-tool.ts @@ -1,9 +1,8 @@ -import { Utils, TLPointerEventHandler } from '@tldraw/core'; +import { TLPointerEventHandler, Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { Arrow } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; -import { services } from '@toeverything/datasource/db-service'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; export class ArrowTool extends BaseTool { override type = TDShapeType.Arrow as const; diff --git a/libs/components/board-tools/src/draw-tool/draw-tool.ts b/libs/components/board-tools/src/draw-tool/draw-tool.ts index a82eabfe4c..ad1a73ad87 100644 --- a/libs/components/board-tools/src/draw-tool/draw-tool.ts +++ b/libs/components/board-tools/src/draw-tool/draw-tool.ts @@ -1,7 +1,7 @@ -import { Utils, TLPointerEventHandler } from '@tldraw/core'; +import { TLPointerEventHandler, Utils } from '@tldraw/core'; import { Draw } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; enum Status { Idle = 'idle', diff --git a/libs/components/board-tools/src/editor-tool/editor-tool.ts b/libs/components/board-tools/src/editor-tool/editor-tool.ts index f0da22a0c1..ae12af6c59 100644 --- a/libs/components/board-tools/src/editor-tool/editor-tool.ts +++ b/libs/components/board-tools/src/editor-tool/editor-tool.ts @@ -2,8 +2,8 @@ import { TLPointerEventHandler } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { Editor } from '@toeverything/components/board-shapes'; -import { TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; +import { TDShapeType } from '@toeverything/components/board-types'; import { services } from '@toeverything/datasource/db-service'; export class EditorTool extends BaseTool { diff --git a/libs/components/board-tools/src/ellipse-tool/ellipse-tool.ts b/libs/components/board-tools/src/ellipse-tool/ellipse-tool.ts index d0b8edfdbc..dff670ac3c 100644 --- a/libs/components/board-tools/src/ellipse-tool/ellipse-tool.ts +++ b/libs/components/board-tools/src/ellipse-tool/ellipse-tool.ts @@ -1,8 +1,8 @@ -import { Utils, TLPointerEventHandler, TLBoundsCorner } from '@tldraw/core'; +import { TLBoundsCorner, TLPointerEventHandler, Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { Ellipse } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; export class EllipseTool extends BaseTool { override type = TDShapeType.Ellipse as const; diff --git a/libs/components/board-tools/src/erase-tool/erase-tool.ts b/libs/components/board-tools/src/erase-tool/erase-tool.ts index a5b68aea00..64be36aac1 100644 --- a/libs/components/board-tools/src/erase-tool/erase-tool.ts +++ b/libs/components/board-tools/src/erase-tool/erase-tool.ts @@ -1,7 +1,7 @@ -import Vec from '@tldraw/vec'; import type { TLPointerEventHandler } from '@tldraw/core'; -import { SessionType, DEAD_ZONE } from '@toeverything/components/board-types'; +import Vec from '@tldraw/vec'; import { BaseTool } from '@toeverything/components/board-state'; +import { DEAD_ZONE, SessionType } from '@toeverything/components/board-types'; enum Status { Idle = 'idle', diff --git a/libs/components/board-tools/src/frame-tool/frame-tool.ts b/libs/components/board-tools/src/frame-tool/frame-tool.ts index 7e9b34ec36..8f50e45d46 100644 --- a/libs/components/board-tools/src/frame-tool/frame-tool.ts +++ b/libs/components/board-tools/src/frame-tool/frame-tool.ts @@ -1,13 +1,8 @@ -import { - Utils, - TLPointerEventHandler, - TLBoundsCorner, - TLBoundsHandleEventHandler, -} from '@tldraw/core'; +import { TLBoundsCorner, TLPointerEventHandler, Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { Frame } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; export class FrameTool extends BaseTool { override type = TDShapeType.Frame as const; diff --git a/libs/components/board-tools/src/hand-draw/hand-draw-tool.ts b/libs/components/board-tools/src/hand-draw/hand-draw-tool.ts index 180b936442..df0d80e1be 100644 --- a/libs/components/board-tools/src/hand-draw/hand-draw-tool.ts +++ b/libs/components/board-tools/src/hand-draw/hand-draw-tool.ts @@ -1,9 +1,7 @@ -import { TLPointerEventHandler } from '@tldraw/core'; // import { Draw } from '@toeverything/components/board-shapes'; -import { Vec } from '@tldraw/vec'; -import { TDShapeType } from '@toeverything/components/board-types'; import { BaseTool } from '@toeverything/components/board-state'; +import { TDShapeType } from '@toeverything/components/board-types'; enum Status { Idle = 'idle', diff --git a/libs/components/board-tools/src/hexagon-tool/hexagon-tool.ts b/libs/components/board-tools/src/hexagon-tool/hexagon-tool.ts index 60b2269a4a..cc4a1a6ab7 100644 --- a/libs/components/board-tools/src/hexagon-tool/hexagon-tool.ts +++ b/libs/components/board-tools/src/hexagon-tool/hexagon-tool.ts @@ -1,8 +1,8 @@ -import { Utils, TLPointerEventHandler, TLBoundsCorner } from '@tldraw/core'; +import { TLBoundsCorner, TLPointerEventHandler, Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { Hexagon } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; export class HexagonTool extends BaseTool { override type = TDShapeType.Triangle as const; diff --git a/libs/components/board-tools/src/highlight-tool/highlight-tool.ts b/libs/components/board-tools/src/highlight-tool/highlight-tool.ts index 9e7096d2e2..dd4aa270a8 100644 --- a/libs/components/board-tools/src/highlight-tool/highlight-tool.ts +++ b/libs/components/board-tools/src/highlight-tool/highlight-tool.ts @@ -1,12 +1,12 @@ -import { Utils, TLPointerEventHandler } from '@tldraw/core'; +import { TLPointerEventHandler, Utils } from '@tldraw/core'; import { Draw } from '@toeverything/components/board-shapes'; -import { - SessionType, - TDShapeType, - DashStyle, - StrokeWidth, -} from '@toeverything/components/board-types'; import { BaseTool } from '@toeverything/components/board-state'; +import { + DashStyle, + SessionType, + StrokeWidth, + TDShapeType, +} from '@toeverything/components/board-types'; enum Status { Idle = 'idle', diff --git a/libs/components/board-tools/src/index.ts b/libs/components/board-tools/src/index.ts index 1bc068a078..caf7e80d1f 100644 --- a/libs/components/board-tools/src/index.ts +++ b/libs/components/board-tools/src/index.ts @@ -1,21 +1,21 @@ import { TDShapeType, TDToolType } from '@toeverything/components/board-types'; import { ArrowTool } from './arrow-tool'; -import { LineTool } from './line-tool'; import { DrawTool } from './draw-tool'; -import { PencilTool } from './pencil-tool'; -import { HighlightTool } from './highlight-tool'; -import { EllipseTool } from './ellipse-tool'; -import { RectangleTool } from './rectangle-tool'; -import { TriangleTool } from './triangle-tool'; -import { SelectTool } from './select-tool'; -import { EraseTool } from './erase-tool'; import { EditorTool } from './editor-tool'; -import { HexagonTool } from './hexagon-tool'; -import { PentagramTool } from './pentagram-tool'; -import { WhiteArrowTool } from './white-arrow-tool'; -import { LaserTool } from './laser-tool'; -import { HandDrawTool } from './hand-draw'; +import { EllipseTool } from './ellipse-tool'; +import { EraseTool } from './erase-tool'; import { FrameTool } from './frame-tool/frame-tool'; +import { HandDrawTool } from './hand-draw'; +import { HexagonTool } from './hexagon-tool'; +import { HighlightTool } from './highlight-tool'; +import { LaserTool } from './laser-tool'; +import { LineTool } from './line-tool'; +import { PencilTool } from './pencil-tool'; +import { PentagramTool } from './pentagram-tool'; +import { RectangleTool } from './rectangle-tool'; +import { SelectTool } from './select-tool'; +import { TriangleTool } from './triangle-tool'; +import { WhiteArrowTool } from './white-arrow-tool'; export interface ToolsMap { select: typeof SelectTool; diff --git a/libs/components/board-tools/src/laser-tool/laser-tool.ts b/libs/components/board-tools/src/laser-tool/laser-tool.ts index 2f0d754112..2c48f3aaea 100644 --- a/libs/components/board-tools/src/laser-tool/laser-tool.ts +++ b/libs/components/board-tools/src/laser-tool/laser-tool.ts @@ -2,8 +2,8 @@ import { TLPointerEventHandler } from '@tldraw/core'; // import { Draw } from '@toeverything/components/board-shapes'; import { Vec } from '@tldraw/vec'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; enum Status { Idle = 'idle', diff --git a/libs/components/board-tools/src/line-tool/line-tool.ts b/libs/components/board-tools/src/line-tool/line-tool.ts index 48e27cc5f6..9d552e746f 100644 --- a/libs/components/board-tools/src/line-tool/line-tool.ts +++ b/libs/components/board-tools/src/line-tool/line-tool.ts @@ -1,8 +1,8 @@ -import { Utils, TLPointerEventHandler } from '@tldraw/core'; +import { TLPointerEventHandler, Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { Arrow } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; export class LineTool extends BaseTool { override type = TDShapeType.Line as const; diff --git a/libs/components/board-tools/src/pencil-tool/pencil-tool.ts b/libs/components/board-tools/src/pencil-tool/pencil-tool.ts index d174dab6f9..ebfdef462c 100644 --- a/libs/components/board-tools/src/pencil-tool/pencil-tool.ts +++ b/libs/components/board-tools/src/pencil-tool/pencil-tool.ts @@ -1,11 +1,11 @@ -import { Utils, TLPointerEventHandler } from '@tldraw/core'; +import { TLPointerEventHandler, Utils } from '@tldraw/core'; import { Draw } from '@toeverything/components/board-shapes'; +import { BaseTool } from '@toeverything/components/board-state'; import { DashStyle, SessionType, TDShapeType, } from '@toeverything/components/board-types'; -import { BaseTool } from '@toeverything/components/board-state'; enum Status { Idle = 'idle', diff --git a/libs/components/board-tools/src/pentagram-tool/pentagram-tool.ts b/libs/components/board-tools/src/pentagram-tool/pentagram-tool.ts index 98c8fd474a..395e561704 100644 --- a/libs/components/board-tools/src/pentagram-tool/pentagram-tool.ts +++ b/libs/components/board-tools/src/pentagram-tool/pentagram-tool.ts @@ -1,8 +1,8 @@ -import { Utils, TLPointerEventHandler, TLBoundsCorner } from '@tldraw/core'; +import { TLBoundsCorner, TLPointerEventHandler, Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { Pentagram } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; export class PentagramTool extends BaseTool { override type = TDShapeType.Pentagram as const; diff --git a/libs/components/board-tools/src/rectangle-tool/rectangle-tool.ts b/libs/components/board-tools/src/rectangle-tool/rectangle-tool.ts index 2bbd3dec2d..4d9db886c7 100644 --- a/libs/components/board-tools/src/rectangle-tool/rectangle-tool.ts +++ b/libs/components/board-tools/src/rectangle-tool/rectangle-tool.ts @@ -1,8 +1,8 @@ -import { Utils, TLPointerEventHandler, TLBoundsCorner } from '@tldraw/core'; +import { TLBoundsCorner, TLPointerEventHandler, Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { Rectangle } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; export class RectangleTool extends BaseTool { override type = TDShapeType.Rectangle as const; diff --git a/libs/components/board-tools/src/select-tool/select-tool.ts b/libs/components/board-tools/src/select-tool/select-tool.ts index 3c96d0fa56..44028e1077 100644 --- a/libs/components/board-tools/src/select-tool/select-tool.ts +++ b/libs/components/board-tools/src/select-tool/select-tool.ts @@ -4,19 +4,18 @@ import { TLBoundsEventHandler, TLBoundsHandleEventHandler, TLCanvasEventHandler, - TLPointerEventHandler, TLKeyboardEventHandler, + TLPointerEventHandler, TLShapeCloneHandler, Utils, } from '@tldraw/core'; +import Vec from '@tldraw/vec'; +import { BaseTool, TLDR } from '@toeverything/components/board-state'; import { - SessionType, - TDShapeType, CLONING_DISTANCE, DEAD_ZONE, + SessionType, } from '@toeverything/components/board-types'; -import { BaseTool, TLDR } from '@toeverything/components/board-state'; -import Vec from '@tldraw/vec'; enum Status { Idle = 'idle', diff --git a/libs/components/board-tools/src/triangle-tool/triangle-tool.ts b/libs/components/board-tools/src/triangle-tool/triangle-tool.ts index 519124fd0c..901c593c7e 100644 --- a/libs/components/board-tools/src/triangle-tool/triangle-tool.ts +++ b/libs/components/board-tools/src/triangle-tool/triangle-tool.ts @@ -1,8 +1,8 @@ -import { Utils, TLPointerEventHandler, TLBoundsCorner } from '@tldraw/core'; +import { TLBoundsCorner, TLPointerEventHandler, Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { Triangle } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; export class TriangleTool extends BaseTool { override type = TDShapeType.Triangle as const; diff --git a/libs/components/board-tools/src/white-arrow-tool/white-arrow-tool.ts b/libs/components/board-tools/src/white-arrow-tool/white-arrow-tool.ts index b658367609..52f266d1bd 100644 --- a/libs/components/board-tools/src/white-arrow-tool/white-arrow-tool.ts +++ b/libs/components/board-tools/src/white-arrow-tool/white-arrow-tool.ts @@ -1,8 +1,8 @@ -import { Utils, TLPointerEventHandler, TLBoundsCorner } from '@tldraw/core'; +import { TLBoundsCorner, TLPointerEventHandler, Utils } from '@tldraw/core'; import Vec from '@tldraw/vec'; import { WhiteArrow } from '@toeverything/components/board-shapes'; -import { SessionType, TDShapeType } from '@toeverything/components/board-types'; import { BaseTool, BaseToolStatus } from '@toeverything/components/board-state'; +import { SessionType, TDShapeType } from '@toeverything/components/board-types'; export class WhiteArrowTool extends BaseTool { override type = TDShapeType.Triangle as const; diff --git a/libs/components/board-types/src/index.ts b/libs/components/board-types/src/index.ts index ffe2c74601..be20e4cb42 100644 --- a/libs/components/board-types/src/index.ts +++ b/libs/components/board-types/src/index.ts @@ -1,3 +1,3 @@ -export * from './types'; export * from './constants'; export * from './session'; +export * from './types'; diff --git a/libs/components/board-types/src/session.ts b/libs/components/board-types/src/session.ts index 1ae279f987..5954eef165 100644 --- a/libs/components/board-types/src/session.ts +++ b/libs/components/board-types/src/session.ts @@ -1,5 +1,5 @@ import { TLPerformanceMode } from '@tldraw/core'; -import { TDSnapshot, Patch } from './types'; +import { Patch, TDSnapshot } from './types'; export enum SessionType { Transform = 'transform', diff --git a/libs/components/board-types/src/types.ts b/libs/components/board-types/src/types.ts index 6f80a965bc..71326a504c 100644 --- a/libs/components/board-types/src/types.ts +++ b/libs/components/board-types/src/types.ts @@ -1,24 +1,24 @@ /* eslint-disable max-lines */ import type { - TLPage, - TLUser, - TLPageState, + TLAsset, TLBinding, TLBoundsCorner, TLBoundsEdge, - TLShape, - TLHandle, - TLSnapLine, - TLPinchEventHandler, - TLKeyboardEventHandler, - TLPointerEventHandler, - TLWheelEventHandler, - TLCanvasEventHandler, TLBoundsEventHandler, TLBoundsHandleEventHandler, + TLCanvasEventHandler, + TLHandle, + TLKeyboardEventHandler, + TLPage, + TLPageState, + TLPinchEventHandler, + TLPointerEventHandler, + TLShape, TLShapeBlurHandler, TLShapeCloneHandler, - TLAsset, + TLSnapLine, + TLUser, + TLWheelEventHandler, } from '@tldraw/core'; /* -------------------------------------------------- */ diff --git a/libs/components/layout/src/header/EditorBoardSwitcher/StatusIcon.tsx b/libs/components/layout/src/header/EditorBoardSwitcher/StatusIcon.tsx index 0c38b3f4e7..e7008da3df 100644 --- a/libs/components/layout/src/header/EditorBoardSwitcher/StatusIcon.tsx +++ b/libs/components/layout/src/header/EditorBoardSwitcher/StatusIcon.tsx @@ -1,5 +1,5 @@ +import { BoardViewIcon, DocViewIcon } from '@toeverything/components/icons'; import { styled } from '@toeverything/components/ui'; -import { DocViewIcon, BoardViewIcon } from '@toeverything/components/icons'; import { DocMode } from './type'; interface StatusIconProps { diff --git a/libs/components/layout/src/header/EditorBoardSwitcher/StatusTrack.tsx b/libs/components/layout/src/header/EditorBoardSwitcher/StatusTrack.tsx index 6fa7ac73f4..11eba1f663 100644 --- a/libs/components/layout/src/header/EditorBoardSwitcher/StatusTrack.tsx +++ b/libs/components/layout/src/header/EditorBoardSwitcher/StatusTrack.tsx @@ -1,6 +1,6 @@ -import type { DocMode } from './type'; import { styled } from '@toeverything/components/ui'; import { StatusIcon } from './StatusIcon'; +import type { DocMode } from './type'; interface StatusTrackProps { mode: DocMode; diff --git a/libs/components/layout/src/header/EditorBoardSwitcher/Switcher.tsx b/libs/components/layout/src/header/EditorBoardSwitcher/Switcher.tsx index d373850446..78239dac9e 100644 --- a/libs/components/layout/src/header/EditorBoardSwitcher/Switcher.tsx +++ b/libs/components/layout/src/header/EditorBoardSwitcher/Switcher.tsx @@ -1,5 +1,5 @@ -import { useLocation, useParams, useNavigate } from 'react-router-dom'; import { styled } from '@toeverything/components/ui'; +import { useLocation, useNavigate, useParams } from 'react-router-dom'; import { StatusText } from './StatusText'; import { StatusTrack } from './StatusTrack'; import { DocMode } from './type'; diff --git a/libs/components/layout/src/header/Header.tsx b/libs/components/layout/src/header/Header.tsx index baa3706747..36c82f7361 100644 --- a/libs/components/layout/src/header/Header.tsx +++ b/libs/components/layout/src/header/Header.tsx @@ -1,24 +1,23 @@ -import { useNavigate, useParams, useLocation } from 'react-router-dom'; -import MenuIconBak from '@mui/icons-material/Menu'; -import { - useUserAndSpaces, - useShowSpaceSidebar, - useShowSettingsSidebar, -} from '@toeverything/datasource/state'; +import { ListIcon, LogoLink, SpaceIcon } from '@toeverything/components/common'; +import { SideBarViewIcon } from '@toeverything/components/icons'; import { MuiIconButton as IconButton, styled, Tooltip, useTheme, } from '@toeverything/components/ui'; -import { SideBarViewIcon } from '@toeverything/components/icons'; -import { LogoLink, ListIcon, SpaceIcon } from '@toeverything/components/common'; +import { useFlag } from '@toeverything/datasource/feature-flags'; +import { + useShowSettingsSidebar, + useShowSpaceSidebar, + useUserAndSpaces, +} from '@toeverything/datasource/state'; +import { useLocation, useNavigate, useParams } from 'react-router-dom'; import { PageHistoryPortal } from './PageHistoryPortal'; -import { PageSharePortal } from './PageSharePortal'; import { PageSettingPortal } from './PageSettingPortal'; +import { PageSharePortal } from './PageSharePortal'; import { CurrentPageTitle } from './Title'; import { UserMenuIcon } from './user-menu-icon'; -import { useFlag } from '@toeverything/datasource/feature-flags'; function hideAffineHeader(pathname: string): boolean { return ['/', '/login', '/error/workspace', '/error/404', '/ui'].includes( diff --git a/libs/components/layout/src/header/LayoutHeader.tsx b/libs/components/layout/src/header/LayoutHeader.tsx index 5118233907..57d037ad2f 100644 --- a/libs/components/layout/src/header/LayoutHeader.tsx +++ b/libs/components/layout/src/header/LayoutHeader.tsx @@ -1,19 +1,19 @@ import { useMemo } from 'react'; -import { IconButton, styled } from '@toeverything/components/ui'; import { LogoIcon, - SideBarViewIcon, SearchIcon, SideBarViewCloseIcon, + SideBarViewIcon, } from '@toeverything/components/icons'; +import { IconButton, styled } from '@toeverything/components/ui'; import { - useShowSettingsSidebar, useLocalTrigger, + useShowSettingsSidebar, } from '@toeverything/datasource/state'; import { EditorBoardSwitcher } from './EditorBoardSwitcher'; -import { fsApiSupported, FileSystem } from './FileSystem'; +import { FileSystem, fsApiSupported } from './FileSystem'; import { CurrentPageTitle } from './Title'; export const LayoutHeader = () => { diff --git a/libs/components/layout/src/header/PageSettingPortal.tsx b/libs/components/layout/src/header/PageSettingPortal.tsx index 9c33f8d3fd..452734ff3c 100644 --- a/libs/components/layout/src/header/PageSettingPortal.tsx +++ b/libs/components/layout/src/header/PageSettingPortal.tsx @@ -1,22 +1,22 @@ -import { useState, MouseEvent, useCallback, useEffect } from 'react'; import { services } from '@toeverything/datasource/db-service'; -import { useParams, useNavigate } from 'react-router-dom'; +import { useCallback, useEffect, useState } from 'react'; +import { useNavigate, useParams } from 'react-router-dom'; -import { copyToClipboard } from '@toeverything/utils'; import { MoreIcon } from '@toeverything/components/icons'; import { - MuiSnackbar as Snackbar, - Popover, ListButton, MuiDivider as Divider, + MuiSnackbar as Snackbar, MuiSwitch as Switch, + Popover, styled, } from '@toeverything/components/ui'; -import { useUserAndSpaces } from '@toeverything/datasource/state'; -import format from 'date-fns/format'; import { useFlag } from '@toeverything/datasource/feature-flags'; -import { PageBlock } from './types'; +import { useUserAndSpaces } from '@toeverything/datasource/state'; +import { copyToClipboard } from '@toeverything/utils'; +import format from 'date-fns/format'; import { FileExporter } from './file-exporter/file-exporter'; +import { PageBlock } from './types'; const PageSettingPortalContainer = styled('div')({ width: '320p', padding: '15px', diff --git a/libs/components/layout/src/header/PageSharePortal.tsx b/libs/components/layout/src/header/PageSharePortal.tsx index d311b403b8..ea5fdcddeb 100644 --- a/libs/components/layout/src/header/PageSharePortal.tsx +++ b/libs/components/layout/src/header/PageSharePortal.tsx @@ -1,18 +1,17 @@ -import style9 from 'style9'; -import LanguageIcon from '@mui/icons-material/Language'; -import { useState, MouseEvent } from 'react'; import InsertLinkIcon from '@mui/icons-material/InsertLink'; +import LanguageIcon from '@mui/icons-material/Language'; import ShareIcon from '@mui/icons-material/Share'; import { - MuiSnackbar as Snackbar, MuiButton as Button, - MuiDivider as Divider, MuiInputBase as InputBase, MuiPaper as Paper, + MuiSnackbar as Snackbar, MuiSwitch as Switch, Popover, } from '@toeverything/components/ui'; import { copyToClipboard } from '@toeverything/utils'; +import { useState } from 'react'; +import style9 from 'style9'; const styles = style9.create({ pageShareBox: { diff --git a/libs/components/layout/src/header/Title.tsx b/libs/components/layout/src/header/Title.tsx index 61f2d3a246..0447cd52f6 100644 --- a/libs/components/layout/src/header/Title.tsx +++ b/libs/components/layout/src/header/Title.tsx @@ -1,6 +1,6 @@ -import { useEffect, useState, useCallback } from 'react'; +import { styled, Typography } from '@toeverything/components/ui'; +import { useCallback, useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; -import { Typography, styled } from '@toeverything/components/ui'; import { services } from '@toeverything/datasource/db-service'; import { useUserAndSpaces } from '@toeverything/datasource/state'; diff --git a/libs/components/layout/src/header/file-exporter/file-exporter.ts b/libs/components/layout/src/header/file-exporter/file-exporter.ts index ccbe9bc5f5..7fea0ea2fd 100644 --- a/libs/components/layout/src/header/file-exporter/file-exporter.ts +++ b/libs/components/layout/src/header/file-exporter/file-exporter.ts @@ -1,4 +1,3 @@ -import { PageBlock } from '../types'; import TurndownService from 'turndown'; const FileExporter = { exportFile: (filename: string, text: string, format: string) => { diff --git a/libs/components/layout/src/header/user-menu-icon/UserMenuList.tsx b/libs/components/layout/src/header/user-menu-icon/UserMenuList.tsx index cee1d7e2ab..6e8d93303a 100644 --- a/libs/components/layout/src/header/user-menu-icon/UserMenuList.tsx +++ b/libs/components/layout/src/header/user-menu-icon/UserMenuList.tsx @@ -1,14 +1,14 @@ -import { useMemo } from 'react'; import { getAuth, signOut } from 'firebase/auth'; +import { useMemo } from 'react'; -import { LOGOUT_COOKIES, LOGOUT_LOCAL_STORAGE } from '@toeverything/utils'; -import { useUserAndSpaces } from '@toeverything/datasource/state'; import { MuiDivider as Divider, MuiList as List, MuiListItem as ListItem, MuiListItemText as ListItemText, } from '@toeverything/components/ui'; +import { useUserAndSpaces } from '@toeverything/datasource/state'; +import { LOGOUT_COOKIES, LOGOUT_LOCAL_STORAGE } from '@toeverything/utils'; export const UserMenuList = () => { const { user } = useUserAndSpaces(); diff --git a/libs/components/layout/src/settings-sidebar/Comments/CommentItem.tsx b/libs/components/layout/src/settings-sidebar/Comments/CommentItem.tsx index 2ac99e7185..0351529760 100644 --- a/libs/components/layout/src/settings-sidebar/Comments/CommentItem.tsx +++ b/libs/components/layout/src/settings-sidebar/Comments/CommentItem.tsx @@ -1,10 +1,10 @@ -import { Fragment, useState, useEffect, useCallback } from 'react'; -import { styled, MuiClickAwayListener } from '@toeverything/components/ui'; +import { MuiClickAwayListener, styled } from '@toeverything/components/ui'; import { services } from '@toeverything/datasource/db-service'; +import { Fragment, useCallback, useEffect, useState } from 'react'; import { QuotedContent } from './item/QuotedContent'; -import { ReplyItem } from './item/ReplyItem'; import { ReplyInput } from './item/ReplyInput'; +import { ReplyItem } from './item/ReplyItem'; import { CommentInfo } from './type'; export const CommentItem = (props: CommentInfo) => { diff --git a/libs/components/layout/src/settings-sidebar/Comments/Comments.tsx b/libs/components/layout/src/settings-sidebar/Comments/Comments.tsx index 3d03e3e82f..e2aeb949eb 100644 --- a/libs/components/layout/src/settings-sidebar/Comments/Comments.tsx +++ b/libs/components/layout/src/settings-sidebar/Comments/Comments.tsx @@ -1,6 +1,6 @@ import { styled } from '@toeverything/components/ui'; -import { useComments } from './use-comments'; import { CommentItem } from './CommentItem'; +import { useComments } from './use-comments'; type CommentsProps = { activeCommentId: string; diff --git a/libs/components/layout/src/settings-sidebar/Comments/item/CommentedByUser.tsx b/libs/components/layout/src/settings-sidebar/Comments/item/CommentedByUser.tsx index 97e7be1977..2aa1a3efbf 100644 --- a/libs/components/layout/src/settings-sidebar/Comments/item/CommentedByUser.tsx +++ b/libs/components/layout/src/settings-sidebar/Comments/item/CommentedByUser.tsx @@ -1,7 +1,7 @@ -import { useMemo } from 'react'; -import { styled, MuiAvatar as Avatar } from '@toeverything/components/ui'; +import { MuiAvatar as Avatar, styled } from '@toeverything/components/ui'; import { useUserAndSpaces } from '@toeverything/datasource/state'; import { getUserDisplayName } from '@toeverything/utils'; +import { useMemo } from 'react'; type CommentedByUserProps = { username: string; diff --git a/libs/components/layout/src/settings-sidebar/Comments/item/QuotedContent.tsx b/libs/components/layout/src/settings-sidebar/Comments/item/QuotedContent.tsx index 0e50baafc7..3756580c76 100644 --- a/libs/components/layout/src/settings-sidebar/Comments/item/QuotedContent.tsx +++ b/libs/components/layout/src/settings-sidebar/Comments/item/QuotedContent.tsx @@ -1,5 +1,5 @@ -import { styled } from '@toeverything/components/ui'; import { DoneIcon } from '@toeverything/components/icons'; +import { styled } from '@toeverything/components/ui'; type QuotedContentProps = { content: string; diff --git a/libs/components/layout/src/settings-sidebar/Comments/item/ReplyInput.tsx b/libs/components/layout/src/settings-sidebar/Comments/item/ReplyInput.tsx index b9e7015dca..2ccf8c1ece 100644 --- a/libs/components/layout/src/settings-sidebar/Comments/item/ReplyInput.tsx +++ b/libs/components/layout/src/settings-sidebar/Comments/item/ReplyInput.tsx @@ -1,10 +1,10 @@ -import { - useState, - useCallback, - KeyboardEventHandler, - ChangeEvent, -} from 'react'; import { styled } from '@toeverything/components/ui'; +import { + ChangeEvent, + KeyboardEventHandler, + useCallback, + useState, +} from 'react'; export const ReplyInput = (props: any) => { const { onSubmit } = props; diff --git a/libs/components/layout/src/settings-sidebar/Comments/item/ReplyItem.tsx b/libs/components/layout/src/settings-sidebar/Comments/item/ReplyItem.tsx index 30edeb9ca8..4879d672cb 100644 --- a/libs/components/layout/src/settings-sidebar/Comments/item/ReplyItem.tsx +++ b/libs/components/layout/src/settings-sidebar/Comments/item/ReplyItem.tsx @@ -1,4 +1,3 @@ -import { styled } from '@toeverything/components/ui'; import type { CommentReply } from '@toeverything/datasource/db-service'; import { CommentContent } from './CommentContent'; diff --git a/libs/components/layout/src/settings-sidebar/Comments/use-comments.ts b/libs/components/layout/src/settings-sidebar/Comments/use-comments.ts index 18d3db4bce..510b4e1bfb 100644 --- a/libs/components/layout/src/settings-sidebar/Comments/use-comments.ts +++ b/libs/components/layout/src/settings-sidebar/Comments/use-comments.ts @@ -1,11 +1,11 @@ -import { useState, useCallback, useEffect, useMemo } from 'react'; -import { useParams } from 'react-router-dom'; -import { services } from '@toeverything/datasource/db-service'; import type { Virgo } from '@toeverything/components/editor-core'; +import { services } from '@toeverything/datasource/db-service'; import { useCurrentEditors, useShowSettingsSidebar, } from '@toeverything/datasource/state'; +import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useParams } from 'react-router-dom'; import type { CommentInfo } from './type'; export const useComments = () => { diff --git a/libs/components/layout/src/settings-sidebar/Comments/utils.ts b/libs/components/layout/src/settings-sidebar/Comments/utils.ts index 560f73a09a..2588bde5c6 100644 --- a/libs/components/layout/src/settings-sidebar/Comments/utils.ts +++ b/libs/components/layout/src/settings-sidebar/Comments/utils.ts @@ -1,6 +1,6 @@ import type { - ReturnEditorBlock, Comment, + ReturnEditorBlock, } from '@toeverything/datasource/db-service'; export const getCommentsFromEditorBlocks = ( diff --git a/libs/components/layout/src/settings-sidebar/ContainerTabs/ContainerTabs.tsx b/libs/components/layout/src/settings-sidebar/ContainerTabs/ContainerTabs.tsx index 404af63c9f..dc5320c19d 100644 --- a/libs/components/layout/src/settings-sidebar/ContainerTabs/ContainerTabs.tsx +++ b/libs/components/layout/src/settings-sidebar/ContainerTabs/ContainerTabs.tsx @@ -1,13 +1,13 @@ -import { cloneElement, useMemo, useCallback, type ReactElement } from 'react'; -import { styled } from '@toeverything/components/ui'; import { CommentIcon, LayoutIcon, SettingsIcon, } from '@toeverything/components/icons'; -import { LayoutSettings } from '../Layout'; +import { styled } from '@toeverything/components/ui'; +import { cloneElement, useCallback, useMemo, type ReactElement } from 'react'; import { Comments } from '../Comments'; import { useActiveComment } from '../Comments/use-comments'; +import { LayoutSettings } from '../Layout'; import { SettingsPanel } from '../Settings'; import { TabItemTitle } from './TabItemTitle'; import { useTabs } from './use-tabs'; diff --git a/libs/components/layout/src/settings-sidebar/ContainerTabs/TabItemTitle.tsx b/libs/components/layout/src/settings-sidebar/ContainerTabs/TabItemTitle.tsx index 899b9b25a0..4dc7166d59 100644 --- a/libs/components/layout/src/settings-sidebar/ContainerTabs/TabItemTitle.tsx +++ b/libs/components/layout/src/settings-sidebar/ContainerTabs/TabItemTitle.tsx @@ -1,5 +1,5 @@ +import { ListIcon, ListItem, styled } from '@toeverything/components/ui'; import type { ReactNode } from 'react'; -import { styled, ListItem, ListIcon } from '@toeverything/components/ui'; type TabItemTitleProps = { icon: ReactNode; diff --git a/libs/components/layout/src/settings-sidebar/ContainerTabs/use-tabs.ts b/libs/components/layout/src/settings-sidebar/ContainerTabs/use-tabs.ts index dad121a838..c1dc07cc28 100644 --- a/libs/components/layout/src/settings-sidebar/ContainerTabs/use-tabs.ts +++ b/libs/components/layout/src/settings-sidebar/ContainerTabs/use-tabs.ts @@ -1,4 +1,4 @@ -import { useRef, useEffect, useState, useMemo } from 'react'; +import { useEffect, useMemo, useRef, useState } from 'react'; function usePrevious(value: T) { const ref = useRef(); diff --git a/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx b/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx index 56528159d0..57e4a2fbf0 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx +++ b/libs/components/layout/src/settings-sidebar/Settings/SettingsList.tsx @@ -1,4 +1,4 @@ -import { styled, ListItem, Divider, Switch } from '@toeverything/components/ui'; +import { Divider, ListItem, styled, Switch } from '@toeverything/components/ui'; import { useSettings } from './use-settings'; export const SettingsList = () => { diff --git a/libs/components/layout/src/settings-sidebar/Settings/SettingsPanel.tsx b/libs/components/layout/src/settings-sidebar/Settings/SettingsPanel.tsx index c3d3b516ea..1f392eedb7 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/SettingsPanel.tsx +++ b/libs/components/layout/src/settings-sidebar/Settings/SettingsPanel.tsx @@ -1,6 +1,6 @@ import { styled } from '@toeverything/components/ui'; -import { SettingsList } from './SettingsList'; import { Footer } from './footer'; +import { SettingsList } from './SettingsList'; export const SettingsPanel = () => { return ( diff --git a/libs/components/layout/src/settings-sidebar/Settings/footer/LastModified.tsx b/libs/components/layout/src/settings-sidebar/Settings/footer/LastModified.tsx index 6619d0191f..1bcf8a83be 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/footer/LastModified.tsx +++ b/libs/components/layout/src/settings-sidebar/Settings/footer/LastModified.tsx @@ -1,6 +1,6 @@ -import format from 'date-fns/format'; -import { Typography, styled } from '@toeverything/components/ui'; +import { styled, Typography } from '@toeverything/components/ui'; import { useUserAndSpaces } from '@toeverything/datasource/state'; +import format from 'date-fns/format'; import { usePageLastUpdated, useWorkspaceAndPageId } from '../util'; export const LastModified = () => { diff --git a/libs/components/layout/src/settings-sidebar/Settings/footer/Logout.tsx b/libs/components/layout/src/settings-sidebar/Settings/footer/Logout.tsx index 2c2d429034..a168f25b6d 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/footer/Logout.tsx +++ b/libs/components/layout/src/settings-sidebar/Settings/footer/Logout.tsx @@ -1,10 +1,5 @@ import { MoveToIcon } from '@toeverything/components/icons'; -import { - ListItem, - ListIcon, - styled, - Typography, -} from '@toeverything/components/ui'; +import { ListItem, styled, Typography } from '@toeverything/components/ui'; import { LOGOUT_COOKIES, LOGOUT_LOCAL_STORAGE } from '@toeverything/utils'; import { getAuth, signOut } from 'firebase/auth'; diff --git a/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts b/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts index 639afef92b..0dd9413c89 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/use-settings.ts @@ -1,17 +1,17 @@ -import { useNavigate } from 'react-router-dom'; import { message } from '@toeverything/components/ui'; -import { useSettingFlags, type SettingFlags } from './use-setting-flags'; import { copyToClipboard } from '@toeverything/utils'; +import { useNavigate } from 'react-router-dom'; +import { useSettingFlags, type SettingFlags } from './use-setting-flags'; import { - duplicatePage, - getPageTitle, - exportHtml, - exportMarkdown, - importWorkspace, - exportWorkspace, - useWorkspaceAndPageId, // useReadingMode, clearWorkspace, + duplicatePage, + exportHtml, + exportMarkdown, + exportWorkspace, + getPageTitle, + importWorkspace, + useWorkspaceAndPageId, } from './util'; interface BaseSettingItem { diff --git a/libs/components/layout/src/settings-sidebar/Settings/util/get-page-info.ts b/libs/components/layout/src/settings-sidebar/Settings/util/get-page-info.ts index d945c751a4..95054e5dc3 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/util/get-page-info.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/util/get-page-info.ts @@ -1,5 +1,5 @@ -import { useState, useEffect } from 'react'; import { services } from '@toeverything/datasource/db-service'; +import { useEffect, useState } from 'react'; const UNTITLED = 'untitled'; diff --git a/libs/components/layout/src/settings-sidebar/Settings/util/handle-export.ts b/libs/components/layout/src/settings-sidebar/Settings/util/handle-export.ts index ca667e22b4..fe284b986c 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/util/handle-export.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/util/handle-export.ts @@ -1,5 +1,5 @@ -import { ClipboardParse } from '@toeverything/components/editor-core'; import { createEditor } from '@toeverything/components/affine-editor'; +import { ClipboardParse } from '@toeverything/components/editor-core'; import { fileExporter } from './file-exporter'; interface CreateClipboardParseProps { diff --git a/libs/components/layout/src/settings-sidebar/Settings/util/index.ts b/libs/components/layout/src/settings-sidebar/Settings/util/index.ts index 0068aad56b..792a6a74cc 100644 --- a/libs/components/layout/src/settings-sidebar/Settings/util/index.ts +++ b/libs/components/layout/src/settings-sidebar/Settings/util/index.ts @@ -1,10 +1,10 @@ export { duplicatePage } from './duplicate-page'; -export { exportHtml, exportMarkdown } from './handle-export'; export { getPageTitle, usePageLastUpdated } from './get-page-info'; +export { exportHtml, exportMarkdown } from './handle-export'; export { - importWorkspace, - exportWorkspace, clearWorkspace, + exportWorkspace, + importWorkspace, } from './inspector-workspace'; -export { useWorkspaceAndPageId } from './use-workspace-page'; export { useReadingMode } from './use-reading-mode'; +export { useWorkspaceAndPageId } from './use-workspace-page'; diff --git a/libs/components/layout/src/workspace-sidebar/activities/activities.tsx b/libs/components/layout/src/workspace-sidebar/activities/activities.tsx index 50c552c0ad..ffef663a81 100644 --- a/libs/components/layout/src/workspace-sidebar/activities/activities.tsx +++ b/libs/components/layout/src/workspace-sidebar/activities/activities.tsx @@ -1,15 +1,14 @@ -import { services } from '@toeverything/datasource/db-service'; -import { useUserAndSpaces } from '@toeverything/datasource/state'; -import { useCallback, useEffect, useState } from 'react'; -import { styled } from '@toeverything/components/ui'; import { MuiList as List, MuiListItem as ListItem, MuiListItemText as ListItemText, - MuiListItemButton as ListItemButton, + styled, } from '@toeverything/components/ui'; -import { useNavigate } from 'react-router'; +import { services } from '@toeverything/datasource/db-service'; +import { useUserAndSpaces } from '@toeverything/datasource/state'; import { formatDistanceToNow } from 'date-fns'; +import { useCallback, useEffect, useState } from 'react'; +import { useNavigate } from 'react-router'; import { DotIcon } from '../dot-icon'; const StyledWrapper = styled('div')({ diff --git a/libs/components/layout/src/workspace-sidebar/calendar-heatmap/CalendarHeatmap.tsx b/libs/components/layout/src/workspace-sidebar/calendar-heatmap/CalendarHeatmap.tsx index ca737f58c9..bdbe1f10f0 100644 --- a/libs/components/layout/src/workspace-sidebar/calendar-heatmap/CalendarHeatmap.tsx +++ b/libs/components/layout/src/workspace-sidebar/calendar-heatmap/CalendarHeatmap.tsx @@ -1,13 +1,12 @@ -import { ComponentType, useEffect } from 'react'; import { - styled, - MuiBox as Box, - MuiTextField as TextField, + AdapterDateFns, // CalendarPickerSkeleton, LocalizationProvider, - AdapterDateFns, + MuiBox as Box, + MuiTextField as TextField, StaticDatePicker, } from '@toeverything/components/ui'; +import { useEffect } from 'react'; import type { Theme } from './types'; import { useCalendarHeatmap } from './use-calendar-heatmap'; diff --git a/libs/components/layout/src/workspace-sidebar/calendar-heatmap/HeatedDay.tsx b/libs/components/layout/src/workspace-sidebar/calendar-heatmap/HeatedDay.tsx index 6762b841f4..194e4de528 100644 --- a/libs/components/layout/src/workspace-sidebar/calendar-heatmap/HeatedDay.tsx +++ b/libs/components/layout/src/workspace-sidebar/calendar-heatmap/HeatedDay.tsx @@ -1,9 +1,9 @@ -import type { ComponentType } from 'react'; import { - styled, PickersDay, + styled, type PickersDayProps, } from '@toeverything/components/ui'; +import type { ComponentType } from 'react'; import type { Theme } from './types'; import { DEFAULT_THEME } from './utils'; diff --git a/libs/components/layout/src/workspace-sidebar/calendar-heatmap/use-calendar-heatmap.ts b/libs/components/layout/src/workspace-sidebar/calendar-heatmap/use-calendar-heatmap.ts index 830a4d9cd7..9307e18665 100644 --- a/libs/components/layout/src/workspace-sidebar/calendar-heatmap/use-calendar-heatmap.ts +++ b/libs/components/layout/src/workspace-sidebar/calendar-heatmap/use-calendar-heatmap.ts @@ -1,11 +1,10 @@ -import { useCallback, useEffect, useState, createElement } from 'react'; -import { atom, useAtom } from 'jotai'; import type { PickersDayProps } from '@toeverything/components/ui'; +import { atom, useAtom } from 'jotai'; +import { createElement, useCallback, useState } from 'react'; -import type { CalendarDay } from './types'; import type { CalendarHeatmapProps } from './CalendarHeatmap'; import { HeatedDay } from './HeatedDay'; -import { fakeFetch, fetchActivitiesHeatmap } from './utils'; +import type { CalendarDay } from './types'; // import { usePageTree } from 'PageTree'; const highlightedDaysAtom = atom([]); diff --git a/libs/components/layout/src/workspace-sidebar/calendar-heatmap/utils.ts b/libs/components/layout/src/workspace-sidebar/calendar-heatmap/utils.ts index 428d4999d7..6b440103f0 100644 --- a/libs/components/layout/src/workspace-sidebar/calendar-heatmap/utils.ts +++ b/libs/components/layout/src/workspace-sidebar/calendar-heatmap/utils.ts @@ -6,7 +6,7 @@ import { getDateIsoStringWithTimezone } from '@toeverything/utils'; import getDaysInMonth from 'date-fns/getDaysInMonth'; import color, { ColorInput } from 'tinycolor2'; -import type { Theme, CalendarDay } from './types'; +import type { CalendarDay, Theme } from './types'; // export const DEFAULT_THEME = createCalendarTheme('#3E6FDB'); export const DEFAULT_THEME: Theme = { diff --git a/libs/components/layout/src/workspace-sidebar/index.ts b/libs/components/layout/src/workspace-sidebar/index.ts index 267622fe22..5c6a207f27 100644 --- a/libs/components/layout/src/workspace-sidebar/index.ts +++ b/libs/components/layout/src/workspace-sidebar/index.ts @@ -1,3 +1,3 @@ -export * from './page-tree'; -export * from './calendar-heatmap'; export * from './activities'; +export * from './calendar-heatmap'; +export * from './page-tree'; diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/DndTree.tsx b/libs/components/layout/src/workspace-sidebar/page-tree/DndTree.tsx index 6db19e3e86..2b9659d0c2 100755 --- a/libs/components/layout/src/workspace-sidebar/page-tree/DndTree.tsx +++ b/libs/components/layout/src/workspace-sidebar/page-tree/DndTree.tsx @@ -1,12 +1,12 @@ -import React, { useMemo } from 'react'; +import { useMemo } from 'react'; import { + defaultDropAnimation, DndContext, DragOverlay, DropAnimation, MeasuringStrategy, PointerSensor, - defaultDropAnimation, useSensor, useSensors, } from '@dnd-kit/core'; diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/index.ts b/libs/components/layout/src/workspace-sidebar/page-tree/index.ts index 3e1ca6026d..836e68fa95 100644 --- a/libs/components/layout/src/workspace-sidebar/page-tree/index.ts +++ b/libs/components/layout/src/workspace-sidebar/page-tree/index.ts @@ -1,6 +1,5 @@ export { PageTree } from './PageTree'; +export * from './types'; export { usePageTree } from './use-page-tree'; -export * from './types'; - // export { getRecentPages, setRecentPages } from './block-page'; diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/DndTreeItem.tsx b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/DndTreeItem.tsx index 432c6e9a6f..e7990a5ee1 100755 --- a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/DndTreeItem.tsx +++ b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/DndTreeItem.tsx @@ -1,4 +1,4 @@ -import React, { CSSProperties } from 'react'; +import { CSSProperties } from 'react'; import { useSortable } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities'; diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/NewFromTemplatePortal.tsx b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/NewFromTemplatePortal.tsx index c60864f341..5eee1bc1ac 100644 --- a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/NewFromTemplatePortal.tsx +++ b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/NewFromTemplatePortal.tsx @@ -1,26 +1,15 @@ -import React, { - useState, - MouseEvent, - useCallback, - useEffect, - useRef, -} from 'react'; import { services, TemplateFactory } from '@toeverything/datasource/db-service'; -import { useParams, useNavigate } from 'react-router-dom'; +import React, { useRef, useState } from 'react'; +import { useNavigate, useParams } from 'react-router-dom'; -import { copyToClipboard } from '@toeverything/utils'; -import { ViewSidebarIcon } from '@toeverything/components/common'; import { - MuiSnackbar as Snackbar, - MuiPopover as Popover, - ListButton, - MuiDivider as Divider, - MuiSwitch as Switch, - styled, BaseButton, + ListButton, + MuiPopover as Popover, + styled, } from '@toeverything/components/ui'; -import { useUserAndSpaces } from '@toeverything/datasource/state'; import { useFlag } from '@toeverything/datasource/feature-flags'; +import { useUserAndSpaces } from '@toeverything/datasource/state'; const NewFromTemplatePortalContainer = styled('div')({ width: '320p', padding: '15px', diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/TreeItem.tsx b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/TreeItem.tsx index 334f2a504a..8ed5db75e8 100755 --- a/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/TreeItem.tsx +++ b/libs/components/layout/src/workspace-sidebar/page-tree/tree-item/TreeItem.tsx @@ -7,8 +7,8 @@ import { useParams } from 'react-router-dom'; import { useFlag } from '@toeverything/datasource/feature-flags'; -import MoreActions from './MoreActions'; import { DotIcon } from '../../dot-icon'; +import MoreActions from './MoreActions'; import { ActionButton, Counter, diff --git a/libs/components/layout/src/workspace-sidebar/page-tree/use-page-tree.ts b/libs/components/layout/src/workspace-sidebar/page-tree/use-page-tree.ts index 1cea945cc0..b088242ee2 100755 --- a/libs/components/layout/src/workspace-sidebar/page-tree/use-page-tree.ts +++ b/libs/components/layout/src/workspace-sidebar/page-tree/use-page-tree.ts @@ -1,13 +1,8 @@ -import { useCallback, useMemo, useState, useEffect } from 'react'; -import { useNavigate, useParams } from 'react-router-dom'; -import { atom, useAtom } from 'jotai'; -import type { - DragEndEvent, - DragMoveEvent, - DragOverEvent, - DragStartEvent, -} from '@dnd-kit/core'; +import type { DragEndEvent, DragMoveEvent } from '@dnd-kit/core'; import { arrayMove } from '@dnd-kit/sortable'; +import { atom, useAtom } from 'jotai'; +import { useCallback, useEffect, useMemo, useState } from 'react'; +import { useNavigate, useParams } from 'react-router-dom'; import { services } from '@toeverything/datasource/db-service'; import type { DndTreeProps } from './DndTree'; diff --git a/libs/components/ui/src/PatchElements.tsx b/libs/components/ui/src/PatchElements.tsx index c1326df98c..f0955a5dbc 100644 --- a/libs/components/ui/src/PatchElements.tsx +++ b/libs/components/ui/src/PatchElements.tsx @@ -1,6 +1,6 @@ -import type { ReactNode } from 'react'; -import { useState, Fragment } from 'react'; import { has } from '@toeverything/utils'; +import type { ReactNode } from 'react'; +import { Fragment, useState } from 'react'; export type UnPatchNode = () => void; export type PatchNode = (key: string, node: ReactNode) => UnPatchNode; diff --git a/libs/components/ui/src/autocomplete/index.tsx b/libs/components/ui/src/autocomplete/index.tsx index b296cfb9d9..4ec36764b1 100644 --- a/libs/components/ui/src/autocomplete/index.tsx +++ b/libs/components/ui/src/autocomplete/index.tsx @@ -1,3 +1,3 @@ /* eslint-disable no-restricted-imports */ -export { autocompleteClasses } from '@mui/material/Autocomplete'; export { useAutocomplete } from '@mui/material'; +export { autocompleteClasses } from '@mui/material/Autocomplete'; diff --git a/libs/components/ui/src/button/IconButton.tsx b/libs/components/ui/src/button/IconButton.tsx index 43773d46ba..0421ecdaf7 100644 --- a/libs/components/ui/src/button/IconButton.tsx +++ b/libs/components/ui/src/button/IconButton.tsx @@ -1,11 +1,11 @@ import type { - MouseEventHandler, CSSProperties, + MouseEventHandler, PropsWithChildren, } from 'react'; +import { cx } from '../clsx'; import { styled } from '../styled'; import { buttonStatus } from './constants'; -import { cx } from '../clsx'; /* Temporary solution, needs to be adjusted */ const SIZE_SMALL = 'small' as const; diff --git a/libs/components/ui/src/button/ListButton.tsx b/libs/components/ui/src/button/ListButton.tsx index d29db359b4..1d6cead375 100644 --- a/libs/components/ui/src/button/ListButton.tsx +++ b/libs/components/ui/src/button/ListButton.tsx @@ -1,9 +1,8 @@ -import React from 'react'; import clsx from 'clsx'; import style9 from 'style9'; -import { BaseButton } from './base-button'; import { SvgIconProps } from '../svg-icon'; +import { BaseButton } from './base-button'; const styles = style9.create({ item: { diff --git a/libs/components/ui/src/button/index.ts b/libs/components/ui/src/button/index.ts index bac4da3799..15fe2dce7e 100644 --- a/libs/components/ui/src/button/index.ts +++ b/libs/components/ui/src/button/index.ts @@ -1,3 +1,3 @@ export { BaseButton } from './base-button'; -export { ListButton } from './ListButton'; export { IconButton } from './IconButton'; +export { ListButton } from './ListButton'; diff --git a/libs/components/ui/src/cascader/Cascader.tsx b/libs/components/ui/src/cascader/Cascader.tsx index ef486e5029..1ba44aab6b 100644 --- a/libs/components/ui/src/cascader/Cascader.tsx +++ b/libs/components/ui/src/cascader/Cascader.tsx @@ -1,12 +1,12 @@ -import { useRef, useState, ReactElement } from 'react'; +import { ArrowRightIcon } from '@toeverything/components/icons'; +import { ReactElement, useRef, useState } from 'react'; +import { Divider } from '../divider'; import { MuiGrow as Grow, MuiPopper as Popper, MuiPopperPlacementType as PopperPlacementType, } from '../mui'; import { styled } from '../styled'; -import { ArrowRightIcon } from '@toeverything/components/icons'; -import { Divider } from '../divider'; export interface CascaderItemProps { title: string; @@ -39,7 +39,7 @@ function CascaderItem(props: ItemProps) { const [open, setOpen] = useState(false); if (isDivide) { - return ; + return ; } const on_click_item = () => { diff --git a/libs/components/ui/src/checkbox/Checkbox.tsx b/libs/components/ui/src/checkbox/Checkbox.tsx index e3d7121a4c..ee39f5572f 100644 --- a/libs/components/ui/src/checkbox/Checkbox.tsx +++ b/libs/components/ui/src/checkbox/Checkbox.tsx @@ -1,9 +1,8 @@ -import * as React from 'react'; /* eslint-disable no-restricted-imports */ import MuiCheckbox, { type CheckboxProps } from '@mui/material/Checkbox'; import { - CheckBoxUncheckIcon, CheckBoxCheckIcon, + CheckBoxUncheckIcon, } from '@toeverything/components/icons'; import { styled } from '../styled'; diff --git a/libs/components/ui/src/date/Calendar.tsx b/libs/components/ui/src/date/Calendar.tsx index 9104544b4a..e45c138b4f 100644 --- a/libs/components/ui/src/date/Calendar.tsx +++ b/libs/components/ui/src/date/Calendar.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Calendar as ReactCalendar, type CalendarProps, diff --git a/libs/components/ui/src/date/index.ts b/libs/components/ui/src/date/index.ts index 3582a92041..b884e0bbb8 100644 --- a/libs/components/ui/src/date/index.ts +++ b/libs/components/ui/src/date/index.ts @@ -2,10 +2,9 @@ import 'react-date-range/dist/styles.css'; // main css file import 'react-date-range/dist/theme/default.css'; // theme css file // export { DateRange } from 'react-date-range'; -export { DateRange } from './DateRange'; export { Calendar } from './Calendar'; - -export type { DateRangeProps, Range } from './DateRange'; export type { CalendarProps } from './Calendar'; +export { DateRange } from './DateRange'; +export type { DateRangeProps, Range } from './DateRange'; // export const NewDateRange = DateRange; diff --git a/libs/components/ui/src/divider/Divider.tsx b/libs/components/ui/src/divider/Divider.tsx index 86fc8ee923..d08e758759 100644 --- a/libs/components/ui/src/divider/Divider.tsx +++ b/libs/components/ui/src/divider/Divider.tsx @@ -1,7 +1,7 @@ -import type { ReactNode, CSSProperties } from 'react'; -import { styled } from '../styled'; -import { MuiDivider } from '../mui'; +import type { CSSProperties, ReactNode } from 'react'; import type { MuiDividerProps } from '../mui'; +import { MuiDivider } from '../mui'; +import { styled } from '../styled'; interface DividerProps { orientation?: 'horizontal' | 'vertical'; diff --git a/libs/components/ui/src/event-away/index.ts b/libs/components/ui/src/event-away/index.ts index 155e71ad5d..5903c3432b 100644 --- a/libs/components/ui/src/event-away/index.ts +++ b/libs/components/ui/src/event-away/index.ts @@ -1,4 +1,4 @@ -import { useState, useEffect, useRef } from 'react'; +import { useEffect, useRef, useState } from 'react'; type Equal = // prettier-ignore diff --git a/libs/components/ui/src/index.ts b/libs/components/ui/src/index.ts index 7d55074540..fea8c1b041 100644 --- a/libs/components/ui/src/index.ts +++ b/libs/components/ui/src/index.ts @@ -1,52 +1,47 @@ // Base abstract feature for all UI components -export { Theme, useTheme, withTheme, ThemeProvider } from './theme'; -export { styled, keyframes } from './styled'; -export type { SxProps } from './styled'; - -export * from './mui'; -export * from './svg-icon'; - -export { StaticDatePicker } from '@mui/x-date-pickers/StaticDatePicker'; export { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; export { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; export { PickersDay, type PickersDayProps, } from '@mui/x-date-pickers/PickersDay'; - +export { StaticDatePicker } from '@mui/x-date-pickers/StaticDatePicker'; +export { autocompleteClasses, useAutocomplete } from './autocomplete'; // Components -export { BaseButton, ListButton, IconButton } from './button'; +export { BaseButton, IconButton, ListButton } from './button'; +export * from './cascader'; +export { Checkbox } from './checkbox'; +export type { CheckboxProps } from './checkbox'; +export { Clickable } from './clickable'; +export * from './clsx'; +export { Calendar, DateRange } from './date'; +export type { CalendarProps, DateRangeProps, Range } from './date'; +export { Divider } from './divider'; +export { Input } from './input'; +export type { InputProps } from './input'; +export { ListIcon, ListItem } from './list'; +export { message } from './message'; export { TransitionsModal } from './model'; +export * from './mui'; +export { usePatchNodes } from './PatchElements'; +export type { PatchNode, UnPatchNode } from './PatchElements'; export { Popover, PopoverContainer } from './popover'; export type { PopoverProps } from './popover'; export { Popper } from './popper'; -export type { PopperProps, PopperHandler } from './popper'; - -export { OldSelect, Select, Option } from './select'; -export { message } from './message'; -export { Input } from './input'; -export type { InputProps } from './input'; -export { Tooltip } from './tooltip'; -export { usePatchNodes } from './PatchElements'; -export type { PatchNode, UnPatchNode } from './PatchElements'; -export { Tag } from './tag'; -export type { TagProps } from './tag'; -export { Divider } from './divider'; -export { autocompleteClasses, useAutocomplete } from './autocomplete'; -export { Slider } from './slider'; -export { Typography } from './typography'; -export { ListItem, ListIcon } from './list'; -export { Clickable } from './clickable'; -export { DateRange, Calendar } from './date'; -export type { DateRangeProps, Range, CalendarProps } from './date'; +export type { PopperHandler, PopperProps } from './popper'; export { Radio } from './radio'; export type { RadioProps } from './radio'; -export { Checkbox } from './checkbox'; -export type { CheckboxProps } from './checkbox'; -export * from './cascader'; -export { Switch } from './switch'; -export type { SwitchProps } from './switch'; +export { OldSelect, Option, Select } from './select'; +export { Slider } from './slider'; +export { keyframes, styled } from './styled'; +export type { SxProps } from './styled'; +export * from './svg-icon'; /* types */ export type { SvgIconProps } from './svg-icon'; - -export * from './clsx'; +export { Switch } from './switch'; +export type { SwitchProps } from './switch'; +export { Tag } from './tag'; +export type { TagProps } from './tag'; +export { Theme, ThemeProvider, useTheme, withTheme } from './theme'; +export { Tooltip } from './tooltip'; +export { Typography } from './typography'; diff --git a/libs/components/ui/src/input/Input.tsx b/libs/components/ui/src/input/Input.tsx index aeb5c97404..fff60cb069 100644 --- a/libs/components/ui/src/input/Input.tsx +++ b/libs/components/ui/src/input/Input.tsx @@ -1,8 +1,8 @@ import React, { forwardRef, + type CSSProperties, type ForwardedRef, type InputHTMLAttributes, - type CSSProperties, } from 'react'; import { styled } from '../styled'; diff --git a/libs/components/ui/src/list/ListItem.tsx b/libs/components/ui/src/list/ListItem.tsx index 080aff416f..39c3d90492 100644 --- a/libs/components/ui/src/list/ListItem.tsx +++ b/libs/components/ui/src/list/ListItem.tsx @@ -1,4 +1,4 @@ -import type { PropsWithChildren, CSSProperties } from 'react'; +import type { CSSProperties, PropsWithChildren } from 'react'; import { Clickable } from '../clickable'; import { styled } from '../styled'; diff --git a/libs/components/ui/src/list/index.ts b/libs/components/ui/src/list/index.ts index bf332e9e8c..4a5fe5a433 100644 --- a/libs/components/ui/src/list/index.ts +++ b/libs/components/ui/src/list/index.ts @@ -1,2 +1,2 @@ -export { ListItem } from './ListItem'; export { ListIcon } from './ListIcon'; +export { ListItem } from './ListItem'; diff --git a/libs/components/ui/src/message/Message.tsx b/libs/components/ui/src/message/Message.tsx index ecc9a8ad1c..fc25565471 100644 --- a/libs/components/ui/src/message/Message.tsx +++ b/libs/components/ui/src/message/Message.tsx @@ -1,15 +1,15 @@ import { NotificationInstance, + type NotificationContent, type NotificationController, type NotificationInstanceProps, - type NotificationContent, - type NotificationOption, type NotificationKey, + type NotificationOption, } from '../notification'; import { - SuccessMessage, ErrorMessage, InfoMessage, + SuccessMessage, WarningMessage, } from './MessageContent'; diff --git a/libs/components/ui/src/model/index.tsx b/libs/components/ui/src/model/index.tsx index 7211dfed32..baeb5db9ac 100644 --- a/libs/components/ui/src/model/index.tsx +++ b/libs/components/ui/src/model/index.tsx @@ -1,7 +1,5 @@ -import { useState } from 'react'; - -import { styled } from '@mui/system'; import ModalUnstyled from '@mui/base/ModalUnstyled'; +import { styled } from '@mui/system'; // eslint-disable-next-line no-restricted-imports import Fade from '@mui/material/Fade'; diff --git a/libs/components/ui/src/mui.ts b/libs/components/ui/src/mui.ts index 47588ce5e6..6b085e52d9 100644 --- a/libs/components/ui/src/mui.ts +++ b/libs/components/ui/src/mui.ts @@ -22,6 +22,7 @@ import { Collapse, Container, Divider, + Fade, FormControlLabel, Grid, Grow, @@ -52,7 +53,6 @@ import { tooltipClasses, Typography, Zoom, - Fade, } from '@mui/material'; export { alpha } from '@mui/system'; diff --git a/libs/components/ui/src/notification/Notification.tsx b/libs/components/ui/src/notification/Notification.tsx index 7d4305c462..f980e816a4 100644 --- a/libs/components/ui/src/notification/Notification.tsx +++ b/libs/components/ui/src/notification/Notification.tsx @@ -1,12 +1,12 @@ -import React, { forwardRef, useImperativeHandle } from 'react'; +import { forwardRef, useImperativeHandle } from 'react'; import { SnackbarProvider, useSnackbar, - type SnackbarProviderProps, type OptionsObject, - type SnackbarMessage, type SnackbarKey, + type SnackbarMessage, + type SnackbarProviderProps, } from 'notistack'; import { createRoot } from 'react-dom/client'; diff --git a/libs/components/ui/src/popover/Popover.tsx b/libs/components/ui/src/popover/Popover.tsx index c165b45197..ec919811dc 100644 --- a/libs/components/ui/src/popover/Popover.tsx +++ b/libs/components/ui/src/popover/Popover.tsx @@ -1,8 +1,8 @@ +import { type PropsWithChildren } from 'react'; import type { MuiPopperPlacementType as PopperPlacementType } from '../mui'; -import React, { type PropsWithChildren } from 'react'; import { Popper } from '../popper'; import { PopoverContainer } from './Container'; -import type { PopoverProps, PopoverDirection } from './interface'; +import type { PopoverDirection, PopoverProps } from './interface'; export const placementToContainerDirection: Record< PopperPlacementType, diff --git a/libs/components/ui/src/popover/index.ts b/libs/components/ui/src/popover/index.ts index 718c074cce..5f27c95d85 100644 --- a/libs/components/ui/src/popover/index.ts +++ b/libs/components/ui/src/popover/index.ts @@ -1,3 +1,3 @@ -export * from './Popover'; -export * from './interface'; export { PopoverContainer } from './Container'; +export * from './interface'; +export * from './Popover'; diff --git a/libs/components/ui/src/popover/interface.ts b/libs/components/ui/src/popover/interface.ts index d26ebc7f48..15a332feae 100644 --- a/libs/components/ui/src/popover/interface.ts +++ b/libs/components/ui/src/popover/interface.ts @@ -1,4 +1,4 @@ -import type { ReactNode, CSSProperties } from 'react'; +import type { CSSProperties, ReactNode } from 'react'; import { PopperProps } from '../popper'; export type PopoverDirection = diff --git a/libs/components/ui/src/popper/PopoverArrow.tsx b/libs/components/ui/src/popper/PopoverArrow.tsx index 148202effc..61bd6de7e5 100644 --- a/libs/components/ui/src/popper/PopoverArrow.tsx +++ b/libs/components/ui/src/popper/PopoverArrow.tsx @@ -1,6 +1,6 @@ -import React, { forwardRef } from 'react'; -import { PopperArrowProps } from './interface'; +import { forwardRef } from 'react'; import { styled } from '../styled'; +import { PopperArrowProps } from './interface'; export const PopperArrow = forwardRef( ({ placement }, ref) => { diff --git a/libs/components/ui/src/popper/Popper.tsx b/libs/components/ui/src/popper/Popper.tsx index 4cf9f6a78b..0a6e00747c 100644 --- a/libs/components/ui/src/popper/Popper.tsx +++ b/libs/components/ui/src/popper/Popper.tsx @@ -1,4 +1,4 @@ -import React, { +import { useEffect, useImperativeHandle, useMemo, diff --git a/libs/components/ui/src/popper/index.ts b/libs/components/ui/src/popper/index.ts index 8d8b52cd2b..88fac67073 100644 --- a/libs/components/ui/src/popper/index.ts +++ b/libs/components/ui/src/popper/index.ts @@ -1,2 +1,2 @@ -export * from './Popper'; export * from './interface'; +export * from './Popper'; diff --git a/libs/components/ui/src/popper/interface.ts b/libs/components/ui/src/popper/interface.ts index d60fac29f7..b449eff61f 100644 --- a/libs/components/ui/src/popper/interface.ts +++ b/libs/components/ui/src/popper/interface.ts @@ -1,8 +1,8 @@ import type { CSSProperties, ReactNode, Ref } from 'react'; /* eslint-disable no-restricted-imports */ import { - type PopperUnstyledProps, type PopperPlacementType, + type PopperUnstyledProps, } from '@mui/base/PopperUnstyled'; export type VirtualElement = { getBoundingClientRect: () => ClientRect | DOMRect; diff --git a/libs/components/ui/src/radio/Radio.tsx b/libs/components/ui/src/radio/Radio.tsx index f31a319f8e..ba97c6ca77 100644 --- a/libs/components/ui/src/radio/Radio.tsx +++ b/libs/components/ui/src/radio/Radio.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; /* eslint-disable no-restricted-imports */ import MuiRadio, { type RadioProps } from '@mui/material/Radio'; import { styled } from '../styled'; diff --git a/libs/components/ui/src/select/OldSelect.tsx b/libs/components/ui/src/select/OldSelect.tsx index 0c49c67c8a..5f3350a199 100644 --- a/libs/components/ui/src/select/OldSelect.tsx +++ b/libs/components/ui/src/select/OldSelect.tsx @@ -1,6 +1,6 @@ +import type { ChangeEvent, CSSProperties } from 'react'; import { useCallback } from 'react'; import { styled } from '../styled'; -import type { CSSProperties, ChangeEvent } from 'react'; /** * WARNING: This component is about to be deprecated, use Select replace diff --git a/libs/components/ui/src/select/Select.tsx b/libs/components/ui/src/select/Select.tsx index 607c3bfa62..7dcfcdc45a 100644 --- a/libs/components/ui/src/select/Select.tsx +++ b/libs/components/ui/src/select/Select.tsx @@ -2,13 +2,13 @@ import { forwardRef, type CSSProperties, type ForwardedRef, - type RefAttributes, type ReactNode, + type RefAttributes, } from 'react'; /* eslint-disable no-restricted-imports */ import SelectUnstyled, { - type SelectUnstyledProps, selectUnstyledClasses, + type SelectUnstyledProps, } from '@mui/base/SelectUnstyled'; /* eslint-disable no-restricted-imports */ import PopperUnstyled from '@mui/base/PopperUnstyled'; diff --git a/libs/components/ui/src/select/index.ts b/libs/components/ui/src/select/index.ts index afea72a2b0..516e039935 100644 --- a/libs/components/ui/src/select/index.ts +++ b/libs/components/ui/src/select/index.ts @@ -1,4 +1,4 @@ -export { Select } from './Select'; +export { OldSelect } from './OldSelect'; export { Option } from './Option'; export { OptionGroup } from './OptionGroup'; -export { OldSelect } from './OldSelect'; +export { Select } from './Select'; diff --git a/libs/components/ui/src/slider/Slider.tsx b/libs/components/ui/src/slider/Slider.tsx index b676ca1cab..88b1e92344 100644 --- a/libs/components/ui/src/slider/Slider.tsx +++ b/libs/components/ui/src/slider/Slider.tsx @@ -1,5 +1,5 @@ -import { SliderUnstyled, sliderUnstyledClasses } from '@mui/base'; import type { SliderUnstyledProps } from '@mui/base'; +import { SliderUnstyled, sliderUnstyledClasses } from '@mui/base'; import { alpha } from '@mui/system'; import { styled } from '../styled'; diff --git a/libs/components/ui/src/styled/index.ts b/libs/components/ui/src/styled/index.ts index 9784a93951..6116b6cc25 100644 --- a/libs/components/ui/src/styled/index.ts +++ b/libs/components/ui/src/styled/index.ts @@ -1,8 +1,9 @@ -// eslint-disable-next-line no-restricted-imports -import { styled as muiStyled, keyframes } from '@mui/material/styles'; -import { ReactHTML, ReactSVG } from 'react'; import isPropValid from '@emotion/is-prop-valid'; +// eslint-disable-next-line no-restricted-imports +import { keyframes, styled as muiStyled } from '@mui/material/styles'; +import { ReactHTML, ReactSVG } from 'react'; export type { SxProps } from '@mui/system'; +export { keyframes }; // Props that will be passed to DOM const ALLOW_LIST_PROPS: string[] = []; @@ -71,5 +72,3 @@ export const styled: typeof muiStyled = ( options.shouldForwardProp = isValidProp; return muiStyled(component, options); }; - -export { keyframes }; diff --git a/libs/components/ui/src/switch/Switch.tsx b/libs/components/ui/src/switch/Switch.tsx index fd48070a63..b31c1828fe 100644 --- a/libs/components/ui/src/switch/Switch.tsx +++ b/libs/components/ui/src/switch/Switch.tsx @@ -1,7 +1,7 @@ -import type { CSSProperties } from 'react'; -import { styled } from '../styled'; import { useSwitch, UseSwitchParameters } from '@mui/base/SwitchUnstyled'; +import type { CSSProperties } from 'react'; import { ReactNode } from 'react'; +import { styled } from '../styled'; /** * Switch is extend by mui SwitchUnstyled diff --git a/libs/components/ui/src/tag/Tag.tsx b/libs/components/ui/src/tag/Tag.tsx index 5c582b6da3..429e99422b 100644 --- a/libs/components/ui/src/tag/Tag.tsx +++ b/libs/components/ui/src/tag/Tag.tsx @@ -1,12 +1,7 @@ -import type { - ChangeEventHandler, - PropsWithChildren, - CSSProperties, - ReactNode, -} from 'react'; +import type { CSSProperties, PropsWithChildren, ReactNode } from 'react'; -import { MouseEventHandler } from 'react'; import CloseIcon from '@mui/icons-material/Close'; +import { MouseEventHandler } from 'react'; import { StyledTag } from './style'; export interface TagProps { diff --git a/libs/components/ui/src/theme/theme.ts b/libs/components/ui/src/theme/theme.ts index b8055da052..76d42e3a0a 100644 --- a/libs/components/ui/src/theme/theme.ts +++ b/libs/components/ui/src/theme/theme.ts @@ -1,4 +1,3 @@ -import ColorObject from './color'; // import { ThemeOptions } from '@mui/material/styles'; /** * @deprecated Please use the new {@link ThemeOptions} type. diff --git a/libs/components/ui/src/theme/utils.tsx b/libs/components/ui/src/theme/utils.tsx index c31f47d124..b99343a35f 100644 --- a/libs/components/ui/src/theme/utils.tsx +++ b/libs/components/ui/src/theme/utils.tsx @@ -1,10 +1,10 @@ -import type { PropsWithChildren, ReactNode } from 'react'; +import type { ReactNode } from 'react'; // eslint-disable-next-line no-restricted-imports import { createTheme, + Theme as MuiTheme, ThemeProvider as MuiThemeProvider, useTheme as muiUseTheme, - Theme as MuiTheme, } from '@mui/material/styles'; import type { ThemeOptions as AffineThemeOptions } from './theme'; import { Theme } from './theme'; diff --git a/libs/components/ui/src/tooltip/Tooltip.tsx b/libs/components/ui/src/tooltip/Tooltip.tsx index ff0b47262c..ea34352744 100644 --- a/libs/components/ui/src/tooltip/Tooltip.tsx +++ b/libs/components/ui/src/tooltip/Tooltip.tsx @@ -1,8 +1,8 @@ -import { type PropsWithChildren, type CSSProperties } from 'react'; -import { type PopperProps, Popper } from '../popper'; -import { PopoverContainer, placementToContainerDirection } from '../popover'; -import type { TooltipProps } from './interface'; +import { type CSSProperties, type PropsWithChildren } from 'react'; +import { placementToContainerDirection, PopoverContainer } from '../popover'; +import { Popper, type PopperProps } from '../popper'; import { useTheme } from '../theme'; +import type { TooltipProps } from './interface'; const useTooltipStyle = (): CSSProperties => { const theme = useTheme(); diff --git a/libs/datasource/db-service/src/index.ts b/libs/datasource/db-service/src/index.ts index 304552820f..3d4ffb01a9 100644 --- a/libs/datasource/db-service/src/index.ts +++ b/libs/datasource/db-service/src/index.ts @@ -1,13 +1,48 @@ -import { diContainer, serviceMapByCallName } from './services'; import type { DbServicesMap } from './services'; -export type { Template } from './services/editor-block/templates/types'; +import { diContainer, serviceMapByCallName } from './services'; +export { Protocol } from './protocol'; +export { + ColumnType, + isBooleanColumn, + isContentColumn, + isDateColumn, + isEnumColumn, + isFileColumn, + isNumberColumn, + isStringColumn, +} from './services'; +export type { + BlockFlavorKeys, + BlockFlavors, + BooleanColumn, + BooleanColumnValue, + Column, + ContentColumn, + ContentColumnValue, + CreateEditorBlock, + DateColumn, + DateColumnValue, + DefaultColumnsValue, + DeleteEditorBlock, + EnumColumn, + EnumColumnValue, + FileColumn, + FileColumnValue, + GetEditorBlock, + NumberColumn, + NumberColumnValue, + ReturnEditorBlock, + StringColumnValue, + UpdateEditorBlock, +} from './services'; +export type { Comment, CommentReply } from './services/comment/types'; +export type { ReturnUnobserve } from './services/database'; export { TemplateFactory, type TemplateMeta, } from './services/editor-block/templates'; - -export type { ReturnUnobserve } from './services/database'; -export type { Comment, CommentReply } from './services/comment/types'; +export type { Template } from './services/editor-block/templates/types'; +export { DEFAULT_COLUMN_KEYS } from './services/editor-block/utils/column/default-config'; const api = new Proxy({} as DbServicesMap, { get(target, prop) { @@ -23,40 +58,3 @@ export const services = { api, }; (window as any)['services'] = services; - -export type { - CreateEditorBlock, - ReturnEditorBlock, - GetEditorBlock, - UpdateEditorBlock, - DeleteEditorBlock, - BlockFlavors, - BlockFlavorKeys, - Column, - ContentColumn, - NumberColumn, - EnumColumn, - DateColumn, - BooleanColumn, - FileColumn, - DefaultColumnsValue, - ContentColumnValue, - NumberColumnValue, - EnumColumnValue, - BooleanColumnValue, - DateColumnValue, - FileColumnValue, - StringColumnValue, -} from './services'; -export { - ColumnType, - isBooleanColumn, - isContentColumn, - isDateColumn, - isFileColumn, - isNumberColumn, - isEnumColumn, - isStringColumn, -} from './services'; -export { Protocol } from './protocol'; -export { DEFAULT_COLUMN_KEYS } from './services/editor-block/utils/column/default-config'; diff --git a/libs/datasource/db-service/src/services/base.ts b/libs/datasource/db-service/src/services/base.ts index 9e10af9177..df0f7133a5 100644 --- a/libs/datasource/db-service/src/services/base.ts +++ b/libs/datasource/db-service/src/services/base.ts @@ -1,9 +1,9 @@ import { BlockClientInstance, - BlockInitOptions, - BlockImplInstance, - BlockMatcher, BlockContentExporter, + BlockImplInstance, + BlockInitOptions, + BlockMatcher, QueryIndexMetadata, } from '@toeverything/datasource/jwt'; import { DependencyCallOrConstructProps } from '@toeverything/utils'; diff --git a/libs/datasource/db-service/src/services/comment/comment.ts b/libs/datasource/db-service/src/services/comment/comment.ts index 968e201cc1..0c90f9691a 100644 --- a/libs/datasource/db-service/src/services/comment/comment.ts +++ b/libs/datasource/db-service/src/services/comment/comment.ts @@ -1,23 +1,23 @@ import { DependencyCallOrConstructProps } from '@toeverything/utils'; +import { WORKSPACE_COMMENTS } from '../../utils'; import type { ReturnUnobserve } from '../database/observer'; +import { EditorBlock, ObserveCallback } from '../editor-block'; import { DeleteEditorBlock, GetEditorBlock, ReturnEditorBlock, } from '../editor-block/types'; -import { EditorBlock, ObserveCallback } from '../editor-block'; +import { CommentColumnValue } from '../editor-block/utils/column/types'; +import { DefaultColumnsValue } from './../index'; import { + Comment, CommentReply, CreateCommentBlock, CreateReplyBlock, + GetCommentsBlock, UpdateCommentBlock, UpdateReplyBlock, - GetCommentsBlock, - Comment, } from './types'; -import { DefaultColumnsValue } from './../index'; -import { CommentColumnValue } from '../editor-block/utils/column/types'; -import { WORKSPACE_COMMENTS } from '../../utils'; export class CommentService { protected editor_block: EditorBlock; diff --git a/libs/datasource/db-service/src/services/comment/types.ts b/libs/datasource/db-service/src/services/comment/types.ts index d69206385c..65ac21c519 100644 --- a/libs/datasource/db-service/src/services/comment/types.ts +++ b/libs/datasource/db-service/src/services/comment/types.ts @@ -1,4 +1,4 @@ -import { ContentColumnValue, BlockFlavorKeys } from '../index'; +import { BlockFlavorKeys, ContentColumnValue } from '../index'; export interface CommentReply { id: string; workspace: string; diff --git a/libs/datasource/db-service/src/services/database/index.ts b/libs/datasource/db-service/src/services/database/index.ts index f7b9eb0261..4ea5bbbace 100644 --- a/libs/datasource/db-service/src/services/database/index.ts +++ b/libs/datasource/db-service/src/services/database/index.ts @@ -4,14 +4,14 @@ import { BlockClient, BlockClientInstance, BlockContentExporter, - BlockMatcher, BlockInitOptions, + BlockMatcher, Connectivity, } from '@toeverything/datasource/jwt'; import { sleep } from '@toeverything/utils'; -import { ObserverManager, getObserverName } from './observer'; import type { ObserveCallback, ReturnUnobserve } from './observer'; +import { getObserverName, ObserverManager } from './observer'; export type { ObserveCallback, ReturnUnobserve } from './observer'; const workspaces: Record = {}; diff --git a/libs/datasource/db-service/src/services/database/observer.ts b/libs/datasource/db-service/src/services/database/observer.ts index feabf57d1c..12b64aa39e 100644 --- a/libs/datasource/db-service/src/services/database/observer.ts +++ b/libs/datasource/db-service/src/services/database/observer.ts @@ -1,4 +1,4 @@ -import { ChangedStates, BlockImplInstance } from '@toeverything/datasource/jwt'; +import { BlockImplInstance, ChangedStates } from '@toeverything/datasource/jwt'; export type ObserveCallback = ( changeStates: ChangedStates, diff --git a/libs/datasource/db-service/src/services/editor-block/index.ts b/libs/datasource/db-service/src/services/editor-block/index.ts index 1bec99a5b9..d24efb9221 100644 --- a/libs/datasource/db-service/src/services/editor-block/index.ts +++ b/libs/datasource/db-service/src/services/editor-block/index.ts @@ -1,28 +1,28 @@ -import { diffArrays } from 'diff'; +import { BlockImplInstance, MapOperation } from '@toeverything/datasource/jwt'; import { has } from '@toeverything/utils'; +import { diffArrays } from 'diff'; import { ServiceBaseClass } from '../base'; import type { ReturnUnobserve } from '../database/observer'; +import { Template, TemplateProperties } from './templates/types'; import { - CreateEditorBlock, - ReturnEditorBlock, - GetEditorBlock, - UpdateEditorBlock, - DeleteEditorBlock, AddColumnProps, - RemoveColumnProps, - UpdateColumnProps, BlockFlavorKeys, + CreateEditorBlock, + DeleteEditorBlock, + GetEditorBlock, + RemoveColumnProps, + ReturnEditorBlock, + UpdateColumnProps, + UpdateEditorBlock, } from './types'; import { - dbBlock2BusinessBlock, - serializeColumnConfig, - deserializeColumnConfig, - getOrInitBlockContentColumnsField, addColumn, Column, + dbBlock2BusinessBlock, + deserializeColumnConfig, + getOrInitBlockContentColumnsField, + serializeColumnConfig, } from './utils'; -import { BlockImplInstance, MapOperation } from '@toeverything/datasource/jwt'; -import { TemplateProperties, Template } from './templates/types'; export type ObserveCallback = (businessBlock: ReturnEditorBlock) => void; export class EditorBlock extends ServiceBaseClass { async create({ @@ -398,39 +398,38 @@ export class EditorBlock extends ServiceBaseClass { } export type { - CreateEditorBlock, - ReturnEditorBlock, - GetEditorBlock, - UpdateEditorBlock, - DeleteEditorBlock, - BlockFlavors, BlockFlavorKeys, + BlockFlavors, + CreateEditorBlock, + DeleteEditorBlock, + GetEditorBlock, + ReturnEditorBlock, + UpdateEditorBlock, } from './types'; - -export type { - Column, - ContentColumn, - NumberColumn, - EnumColumn, - DateColumn, - BooleanColumn, - FileColumn, - DefaultColumnsValue, - ContentColumnValue, - NumberColumnValue, - EnumColumnValue, - BooleanColumnValue, - DateColumnValue, - FileColumnValue, - StringColumnValue, -} from './utils/column'; export { ColumnType, isBooleanColumn, isContentColumn, isDateColumn, + isEnumColumn, isFileColumn, isNumberColumn, - isEnumColumn, isStringColumn, } from './utils/column'; +export type { + BooleanColumn, + BooleanColumnValue, + Column, + ContentColumn, + ContentColumnValue, + DateColumn, + DateColumnValue, + DefaultColumnsValue, + EnumColumn, + EnumColumnValue, + FileColumn, + FileColumnValue, + NumberColumn, + NumberColumnValue, + StringColumnValue, +} from './utils/column'; diff --git a/libs/datasource/db-service/src/services/editor-block/templates/index.ts b/libs/datasource/db-service/src/services/editor-block/templates/index.ts index a4e0e82300..61b236ff3b 100644 --- a/libs/datasource/db-service/src/services/editor-block/templates/index.ts +++ b/libs/datasource/db-service/src/services/editor-block/templates/index.ts @@ -1,3 +1,2 @@ export { TemplateFactory } from './template-factory'; - export * from './types'; diff --git a/libs/datasource/db-service/src/services/editor-block/templates/template-factory.ts b/libs/datasource/db-service/src/services/editor-block/templates/template-factory.ts index 10af0eebb9..9acbaf17ed 100644 --- a/libs/datasource/db-service/src/services/editor-block/templates/template-factory.ts +++ b/libs/datasource/db-service/src/services/editor-block/templates/template-factory.ts @@ -1,10 +1,10 @@ -import { Template, TemplateMeta, GroupTemplate } from './types'; import blogTemplate from './blog.json'; import emptyTemplate from './empty.json'; -import gridTemplate from './grid.json'; -import todoTemplate from './todo.json'; import getStartedGroup0 from './get-started-group0.json'; import getStartedGroup1 from './get-started-group1.json'; +import gridTemplate from './grid.json'; +import todoTemplate from './todo.json'; +import { Template, TemplateMeta } from './types'; export type GroupTemplateKeys = | 'todolist' diff --git a/libs/datasource/db-service/src/services/editor-block/utils/column/default-config.ts b/libs/datasource/db-service/src/services/editor-block/utils/column/default-config.ts index 2577c94ce4..13c5e6e4c2 100644 --- a/libs/datasource/db-service/src/services/editor-block/utils/column/default-config.ts +++ b/libs/datasource/db-service/src/services/editor-block/utils/column/default-config.ts @@ -1,15 +1,15 @@ import { + BooleanColumnValue, Column, ColumnType, + CommentColumnValue, ContentColumnValue, - BooleanColumnValue, - StringColumnValue, - FileColumnValue, DateColumnValue, EnumColumnValue, - CommentColumnValue, + FileColumnValue, FilterConstraint, SorterConstraint, + StringColumnValue, } from './types'; export enum GroupScene { diff --git a/libs/datasource/db-service/src/services/editor-block/utils/column/index.ts b/libs/datasource/db-service/src/services/editor-block/utils/column/index.ts index 25809f8b06..8f469a591c 100644 --- a/libs/datasource/db-service/src/services/editor-block/utils/column/index.ts +++ b/libs/datasource/db-service/src/services/editor-block/utils/column/index.ts @@ -1,11 +1,11 @@ -import { nanoid } from 'nanoid'; import { + ArrayOperation, BlockImplInstance, MapOperation, - ArrayOperation, } from '@toeverything/datasource/jwt'; -import type { Column } from './types'; +import { nanoid } from 'nanoid'; import { DEFAULT_COLUMNS } from './default-config'; +import type { Column } from './types'; export const serializeColumnConfig = (column: Column): string => { // TODO: Do the type check of the column parameter here return JSON.stringify(column); @@ -87,31 +87,30 @@ export const getBlockColumns = ( return columns; }; +export type { DefaultColumnsValue } from './default-config'; +export { ColumnType } from './types'; export type { + BooleanColumn, + BooleanColumnValue, Column, ContentColumn, - NumberColumn, - EnumColumn, - DateColumn, - BooleanColumn, - FileColumn, ContentColumnValue, - NumberColumnValue, - EnumColumnValue, - BooleanColumnValue, + DateColumn, DateColumnValue, + EnumColumn, + EnumColumnValue, + FileColumn, FileColumnValue, + NumberColumn, + NumberColumnValue, StringColumnValue, } from './types'; -export { ColumnType } from './types'; -export type { DefaultColumnsValue } from './default-config'; - export { + isBooleanColumn, isContentColumn, isDateColumn, + isEnumColumn, isFileColumn, isNumberColumn, - isEnumColumn, isStringColumn, - isBooleanColumn, } from './utils'; diff --git a/libs/datasource/db-service/src/services/editor-block/utils/column/types.ts b/libs/datasource/db-service/src/services/editor-block/utils/column/types.ts index d5c15ebaac..241400d8e3 100644 --- a/libs/datasource/db-service/src/services/editor-block/utils/column/types.ts +++ b/libs/datasource/db-service/src/services/editor-block/utils/column/types.ts @@ -1,5 +1,4 @@ /** Column */ -import type { CSSProperties } from 'react'; export enum ColumnType { /** diff --git a/libs/datasource/db-service/src/services/editor-block/utils/column/utils.ts b/libs/datasource/db-service/src/services/editor-block/utils/column/utils.ts index 77822235a4..96e8639c15 100644 --- a/libs/datasource/db-service/src/services/editor-block/utils/column/utils.ts +++ b/libs/datasource/db-service/src/services/editor-block/utils/column/utils.ts @@ -1,12 +1,12 @@ import type { + BooleanColumn, Column, ContentColumn, - StringColumn, - NumberColumn, - EnumColumn, DateColumn, + EnumColumn, FileColumn, - BooleanColumn, + NumberColumn, + StringColumn, } from './types'; export const isContentColumn = (column: Column): column is ContentColumn => { diff --git a/libs/datasource/db-service/src/services/editor-block/utils/index.ts b/libs/datasource/db-service/src/services/editor-block/utils/index.ts index 400c592148..b9a6f5efa5 100644 --- a/libs/datasource/db-service/src/services/editor-block/utils/index.ts +++ b/libs/datasource/db-service/src/services/editor-block/utils/index.ts @@ -1,7 +1,7 @@ import type { BlockImplInstance } from '@toeverything/datasource/jwt'; import { ReturnEditorBlock } from '../types'; -import { getClosestGroup } from './common'; import { getBlockColumns } from './column'; +import { getClosestGroup } from './common'; interface DbBlock2BusinessBlockProps { workspace: string; @@ -31,27 +31,27 @@ export const dbBlock2BusinessBlock = ({ }; export { - getOrInitBlockContentColumnsField, - serializeColumnConfig, - deserializeColumnConfig, addColumn, ColumnType, + deserializeColumnConfig, + getOrInitBlockContentColumnsField, isBooleanColumn, isContentColumn, isDateColumn, + isEnumColumn, isFileColumn, isNumberColumn, - isEnumColumn, isStringColumn, + serializeColumnConfig, } from './column'; export type { - Column, - DefaultColumnsValue, - ContentColumnValue, - NumberColumnValue, - EnumColumnValue, BooleanColumnValue, + Column, + ContentColumnValue, DateColumnValue, + DefaultColumnsValue, + EnumColumnValue, FileColumnValue, + NumberColumnValue, StringColumnValue, } from './column'; diff --git a/libs/datasource/db-service/src/services/index.ts b/libs/datasource/db-service/src/services/index.ts index 827f90ebea..315ee84496 100644 --- a/libs/datasource/db-service/src/services/index.ts +++ b/libs/datasource/db-service/src/services/index.ts @@ -1,46 +1,46 @@ -import { DiContainer } from '@toeverything/utils'; import type { RegisterDependencyConfig } from '@toeverything/utils'; +import { DiContainer } from '@toeverything/utils'; +import { CommentService } from './comment'; import { Database } from './database'; -import { PageTree } from './workspace/page-tree'; -import { UserConfig } from './workspace/user-config'; import { EditorBlock } from './editor-block'; import { FileService } from './file'; -import { CommentService } from './comment'; +import { PageTree } from './workspace/page-tree'; +import { UserConfig } from './workspace/user-config'; -export type { - CreateEditorBlock, - ReturnEditorBlock, - GetEditorBlock, - DeleteEditorBlock, - UpdateEditorBlock, - BlockFlavors, - BlockFlavorKeys, - Column, - ContentColumn, - NumberColumn, - EnumColumn, - DateColumn, - BooleanColumn, - FileColumn, - DefaultColumnsValue, - ContentColumnValue, - NumberColumnValue, - EnumColumnValue, - BooleanColumnValue, - DateColumnValue, - FileColumnValue, - StringColumnValue, -} from './editor-block'; export { ColumnType, isBooleanColumn, isContentColumn, isDateColumn, + isEnumColumn, isFileColumn, isNumberColumn, - isEnumColumn, isStringColumn, } from './editor-block'; +export type { + BlockFlavorKeys, + BlockFlavors, + BooleanColumn, + BooleanColumnValue, + Column, + ContentColumn, + ContentColumnValue, + CreateEditorBlock, + DateColumn, + DateColumnValue, + DefaultColumnsValue, + DeleteEditorBlock, + EnumColumn, + EnumColumnValue, + FileColumn, + FileColumnValue, + GetEditorBlock, + NumberColumn, + NumberColumnValue, + ReturnEditorBlock, + StringColumnValue, + UpdateEditorBlock, +} from './editor-block'; export interface DbServicesMap { editorBlock: EditorBlock; diff --git a/libs/datasource/db-service/src/services/workspace/page-tree.ts b/libs/datasource/db-service/src/services/workspace/page-tree.ts index 9b4a348c2f..51d4f23c8c 100644 --- a/libs/datasource/db-service/src/services/workspace/page-tree.ts +++ b/libs/datasource/db-service/src/services/workspace/page-tree.ts @@ -1,7 +1,7 @@ import type { BlockClientInstance } from '@toeverything/datasource/jwt'; import { PAGE_TREE as pageTreeName } from '../../utils'; -import type { ReturnUnobserve } from '../database/observer'; import { ServiceBaseClass } from '../base'; +import type { ReturnUnobserve } from '../database/observer'; import { TreeItem } from './types'; export type ObserveCallback = () => void; diff --git a/libs/datasource/db-service/src/services/workspace/user-config.ts b/libs/datasource/db-service/src/services/workspace/user-config.ts index 277c3473c7..5a52581c21 100644 --- a/libs/datasource/db-service/src/services/workspace/user-config.ts +++ b/libs/datasource/db-service/src/services/workspace/user-config.ts @@ -1,9 +1,9 @@ +import type { QueryIndexMetadata } from '@toeverything/datasource/jwt'; import { RECENT_PAGES, WORKSPACE_CONFIG } from '../../utils'; import { ServiceBaseClass } from '../base'; import { ObserveCallback, ReturnUnobserve } from '../database'; import { PageTree } from './page-tree'; import { PageConfigItem } from './types'; -import type { QueryIndexMetadata } from '@toeverything/datasource/jwt'; /** Operate the user configuration at the workspace level */ export class UserConfig extends ServiceBaseClass { diff --git a/libs/datasource/jwt-rpc/src/broadcast.ts b/libs/datasource/jwt-rpc/src/broadcast.ts index ed5dfd2ebc..b0f344aad7 100644 --- a/libs/datasource/jwt-rpc/src/broadcast.ts +++ b/libs/datasource/jwt-rpc/src/broadcast.ts @@ -1,8 +1,8 @@ -import * as Y from 'yjs'; import * as bc from 'lib0/broadcastchannel'; import * as encoding from 'lib0/encoding'; -import * as syncProtocol from 'y-protocols/sync'; import * as awarenessProtocol from 'y-protocols/awareness'; +import * as syncProtocol from 'y-protocols/sync'; +import * as Y from 'yjs'; import { Message } from './handler'; import { readMessage } from './processor'; diff --git a/libs/datasource/jwt-rpc/src/handler.ts b/libs/datasource/jwt-rpc/src/handler.ts index 4bfd5a20f0..e803fb4bab 100644 --- a/libs/datasource/jwt-rpc/src/handler.ts +++ b/libs/datasource/jwt-rpc/src/handler.ts @@ -1,5 +1,5 @@ -import * as encoding from 'lib0/encoding'; import * as decoding from 'lib0/decoding'; +import * as encoding from 'lib0/encoding'; import * as authProtocol from 'y-protocols/auth'; import * as awarenessProtocol from 'y-protocols/awareness'; import * as syncProtocol from 'y-protocols/sync'; diff --git a/libs/datasource/jwt-rpc/src/indexeddb.ts b/libs/datasource/jwt-rpc/src/indexeddb.ts index 512daea6d4..fbaaab1ac8 100644 --- a/libs/datasource/jwt-rpc/src/indexeddb.ts +++ b/libs/datasource/jwt-rpc/src/indexeddb.ts @@ -1,7 +1,7 @@ -import * as Y from 'yjs'; import * as idb from 'lib0/indexeddb.js'; import * as mutex from 'lib0/mutex.js'; import { Observable } from 'lib0/observable.js'; +import * as Y from 'yjs'; const customStoreName = 'custom'; const updatesStoreName = 'updates'; diff --git a/libs/datasource/jwt-rpc/src/processor.ts b/libs/datasource/jwt-rpc/src/processor.ts index 4270fdf8dd..c7097156b8 100644 --- a/libs/datasource/jwt-rpc/src/processor.ts +++ b/libs/datasource/jwt-rpc/src/processor.ts @@ -1,8 +1,8 @@ -import * as Y from 'yjs'; -import * as encoding from 'lib0/encoding'; import * as decoding from 'lib0/decoding'; -import * as syncProtocol from 'y-protocols/sync'; +import * as encoding from 'lib0/encoding'; import * as awarenessProtocol from 'y-protocols/awareness'; +import * as syncProtocol from 'y-protocols/sync'; +import * as Y from 'yjs'; import { Message } from './handler'; import { WebsocketProvider } from './provider'; diff --git a/libs/datasource/jwt-rpc/src/provider.ts b/libs/datasource/jwt-rpc/src/provider.ts index 86a59b14c3..0ce7f6a1b3 100644 --- a/libs/datasource/jwt-rpc/src/provider.ts +++ b/libs/datasource/jwt-rpc/src/provider.ts @@ -6,9 +6,8 @@ import * as url from 'lib0/url'; import * as awarenessProtocol from 'y-protocols/awareness'; import { handler } from './handler'; -import { registerBroadcastSubscriber } from './broadcast'; -import { registerWebsocket } from './websocket'; import { registerUpdateHandler } from './processor'; +import { registerWebsocket } from './websocket'; /** * Websocket Provider for Yjs. Creates a websocket connection to sync the shared document. diff --git a/libs/datasource/jwt-rpc/src/sqlite.ts b/libs/datasource/jwt-rpc/src/sqlite.ts index 1753edda8b..f88a59247f 100644 --- a/libs/datasource/jwt-rpc/src/sqlite.ts +++ b/libs/datasource/jwt-rpc/src/sqlite.ts @@ -1,6 +1,6 @@ -import * as Y from 'yjs'; -import sqlite, { Database, SqlJsStatic } from 'sql.js'; import { Observable } from 'lib0/observable.js'; +import sqlite, { Database, SqlJsStatic } from 'sql.js'; +import * as Y from 'yjs'; const PREFERRED_TRIM_SIZE = 500; diff --git a/libs/datasource/jwt-rpc/src/websocket.ts b/libs/datasource/jwt-rpc/src/websocket.ts index fa43db554b..4395cf5d53 100644 --- a/libs/datasource/jwt-rpc/src/websocket.ts +++ b/libs/datasource/jwt-rpc/src/websocket.ts @@ -1,8 +1,8 @@ -import * as time from 'lib0/time'; import * as encoding from 'lib0/encoding'; -import * as syncProtocol from 'y-protocols/sync'; -import * as awarenessProtocol from 'y-protocols/awareness'; import * as math from 'lib0/math'; +import * as time from 'lib0/time'; +import * as awarenessProtocol from 'y-protocols/awareness'; +import * as syncProtocol from 'y-protocols/sync'; import { Message } from './handler'; import { readMessage } from './processor'; diff --git a/libs/datasource/jwt/src/adapter/index.ts b/libs/datasource/jwt/src/adapter/index.ts index 2fa2ec551d..2d7176e6be 100644 --- a/libs/datasource/jwt/src/adapter/index.ts +++ b/libs/datasource/jwt/src/adapter/index.ts @@ -184,11 +184,11 @@ export const getDataExporter = () => { return { importData, exportData, hasExporter, installExporter }; }; +export { YjsAdapter } from './yjs'; +export type { YjsContentOperation, YjsInitOptions } from './yjs'; export type { AsyncDatabaseAdapter, BlockPosition, BlockInstance, ContentOperation, }; -export type { YjsInitOptions, YjsContentOperation } from './yjs'; -export { YjsAdapter } from './yjs'; diff --git a/libs/datasource/jwt/src/adapter/yjs/block.ts b/libs/datasource/jwt/src/adapter/yjs/block.ts index 1f49ad0ed1..3f2b756799 100644 --- a/libs/datasource/jwt/src/adapter/yjs/block.ts +++ b/libs/datasource/jwt/src/adapter/yjs/block.ts @@ -5,12 +5,12 @@ import { transact, } from 'yjs'; -import { BlockInstance, BlockListener, HistoryManager } from '../index'; import { BlockItem, BlockTypes } from '../../types'; +import { BlockInstance, BlockListener, HistoryManager } from '../index'; -import { YjsContentOperation } from './operation'; -import { ChildrenListenerHandler, ContentListenerHandler } from './listener'; import { YjsHistoryManager } from './history'; +import { ChildrenListenerHandler, ContentListenerHandler } from './listener'; +import { YjsContentOperation } from './operation'; const GET_BLOCK_ITEM = Symbol('GET_BLOCK_ITEM'); diff --git a/libs/datasource/jwt/src/adapter/yjs/index.ts b/libs/datasource/jwt/src/adapter/yjs/index.ts index 77f1ac4902..ef7e481a42 100644 --- a/libs/datasource/jwt/src/adapter/yjs/index.ts +++ b/libs/datasource/jwt/src/adapter/yjs/index.ts @@ -5,17 +5,17 @@ import { Buffer } from 'buffer'; import { saveAs } from 'file-saver'; import { fromEvent } from 'file-selector'; import LRUCache from 'lru-cache'; -import { debounce } from 'ts-debounce'; import { nanoid } from 'nanoid'; +import { debounce } from 'ts-debounce'; import { Awareness } from 'y-protocols/awareness.js'; import { - Doc, - Array as YArray, - Map as YMap, - transact, - encodeStateAsUpdate, applyUpdate, + Array as YArray, + Doc, + encodeStateAsUpdate, + Map as YMap, snapshot, + transact, } from 'yjs'; import { @@ -31,12 +31,12 @@ import { getLogger, sha3, sleep } from '../../utils'; import { YjsRemoteBinaries } from './binary'; import { YjsBlockInstance } from './block'; import { GateKeeper } from './gatekeeper'; -import { - YjsContentOperation, - DO_NOT_USE_THIS_OR_YOU_WILL_BE_FIRED_SYMBOL_INTO_INNER as INTO_INNER, -} from './operation'; -import { EmitEvents, Suspend } from './listener'; import { YjsHistoryManager } from './history'; +import { EmitEvents, Suspend } from './listener'; +import { + DO_NOT_USE_THIS_OR_YOU_WILL_BE_FIRED_SYMBOL_INTO_INNER as INTO_INNER, + YjsContentOperation, +} from './operation'; import { YjsProvider } from './provider'; declare const JWT_DEV: boolean; @@ -142,6 +142,8 @@ async function _initYjsDatabase( export type { YjsBlockInstance } from './block'; export type { YjsContentOperation } from './operation'; +export { getYjsProviders } from './provider'; +export type { YjsProviderOptions } from './provider'; export type YjsInitOptions = { userId?: string; @@ -149,9 +151,6 @@ export type YjsInitOptions = { provider?: Record; }; -export { getYjsProviders } from './provider'; -export type { YjsProviderOptions } from './provider'; - export class YjsAdapter implements AsyncDatabaseAdapter { private readonly _provider: YjsProviders; private readonly _doc: Doc; // doc instance diff --git a/libs/datasource/jwt/src/adapter/yjs/provider.ts b/libs/datasource/jwt/src/adapter/yjs/provider.ts index e4cebd1f01..ba1835cc52 100644 --- a/libs/datasource/jwt/src/adapter/yjs/provider.ts +++ b/libs/datasource/jwt/src/adapter/yjs/provider.ts @@ -1,5 +1,5 @@ -import { Doc } from 'yjs'; import { Awareness } from 'y-protocols/awareness.js'; +import { Doc } from 'yjs'; import { IndexedDBProvider, diff --git a/libs/datasource/jwt/src/block/abstract.ts b/libs/datasource/jwt/src/block/abstract.ts index 468fd53321..38ee415e05 100644 --- a/libs/datasource/jwt/src/block/abstract.ts +++ b/libs/datasource/jwt/src/block/abstract.ts @@ -8,10 +8,10 @@ import { MapOperation, } from '../adapter'; import { - BlockTypes, - BlockTypeKeys, - BlockFlavors, BlockFlavorKeys, + BlockFlavors, + BlockTypeKeys, + BlockTypes, } from '../types'; import { getLogger } from '../utils'; diff --git a/libs/datasource/jwt/src/block/index.ts b/libs/datasource/jwt/src/block/index.ts index a23b29fb14..4d9322c38d 100644 --- a/libs/datasource/jwt/src/block/index.ts +++ b/libs/datasource/jwt/src/block/index.ts @@ -8,5 +8,5 @@ export type BlockSearchItem = Partial< export { BaseBlock } from './base'; export type { Decoration, ReadableContentExporter } from './base'; -export { BlockIndexer } from './indexer'; export type { BlockCapability } from './capability'; +export { BlockIndexer } from './indexer'; diff --git a/libs/datasource/jwt/src/block/indexer.ts b/libs/datasource/jwt/src/block/indexer.ts index d9ecde1658..dfee685b7e 100644 --- a/libs/datasource/jwt/src/block/indexer.ts +++ b/libs/datasource/jwt/src/block/indexer.ts @@ -1,8 +1,8 @@ /* eslint-disable max-lines */ import { createNewSortInstance } from 'fast-sort'; -import { deflateSync, inflateSync, strToU8, strFromU8 } from 'fflate'; +import { deflateSync, inflateSync, strFromU8, strToU8 } from 'fflate'; import { Document as DocumentIndexer, DocumentSearchOptions } from 'flexsearch'; -import { get, set, keys, del, createStore } from 'idb-keyval'; +import { createStore, del, get, keys, set } from 'idb-keyval'; import produce from 'immer'; import LRUCache from 'lru-cache'; import sift, { Query } from 'sift'; diff --git a/libs/datasource/jwt/src/index.ts b/libs/datasource/jwt/src/index.ts index 38bc11396e..50fec96d5e 100644 --- a/libs/datasource/jwt/src/index.ts +++ b/libs/datasource/jwt/src/index.ts @@ -4,18 +4,18 @@ import LRUCache from 'lru-cache'; import { AsyncDatabaseAdapter, - YjsAdapter, - YjsInitOptions, - YjsContentOperation, - ChangedStates, - BlockListener, BlockInstance, - ContentOperation, - HistoryManager, - ContentTypes, + BlockListener, + ChangedStates, Connectivity, + ContentOperation, + ContentTypes, DataExporter, getDataExporter, + HistoryManager, + YjsAdapter, + YjsContentOperation, + YjsInitOptions, } from './adapter'; import { getYjsProviders, @@ -30,14 +30,14 @@ import { } from './block'; import { QueryIndexMetadata } from './block/indexer'; import { - BlockTypes, - BlockTypeKeys, - BlockFlavors, - UUID, BlockFlavorKeys, + BlockFlavors, BlockItem, - ExcludeFunction, + BlockTypeKeys, + BlockTypes, BucketBackend, + ExcludeFunction, + UUID, } from './types'; import { BlockEventBus, genUUID, getLogger } from './utils'; @@ -649,18 +649,18 @@ export type BlockInitOptions = NonNullable< >; export type { - TextOperation, ArrayOperation, - MapOperation, ChangedStates, Connectivity, + MapOperation, + TextOperation, } from './adapter'; export type { BlockSearchItem, Decoration as BlockDecoration, ReadableContentExporter as BlockContentExporter, } from './block'; -export type { BlockTypeKeys } from './types'; export { BlockTypes, BucketBackend as BlockBackend } from './types'; +export type { BlockTypeKeys } from './types'; export { isBlock } from './utils'; export type { QueryIndexMetadata }; diff --git a/libs/datasource/jwt/src/types/index.ts b/libs/datasource/jwt/src/types/index.ts index d23b301f36..a205f2a685 100644 --- a/libs/datasource/jwt/src/types/index.ts +++ b/libs/datasource/jwt/src/types/index.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/naming-convention */ -export { BlockTypes, BlockFlavors } from './block'; -export type { BlockTypeKeys, BlockFlavorKeys, BlockItem } from './block'; -export type { UUID } from './uuid'; +export { BlockFlavors, BlockTypes } from './block'; +export type { BlockFlavorKeys, BlockItem, BlockTypeKeys } from './block'; export type { ExcludeFunction } from './utils'; +export type { UUID } from './uuid'; function getLocation() { try { diff --git a/libs/datasource/remote-kv/src/aws/aws-attachment.ts b/libs/datasource/remote-kv/src/aws/aws-attachment.ts index ee13dc771b..a9eac2861a 100644 --- a/libs/datasource/remote-kv/src/aws/aws-attachment.ts +++ b/libs/datasource/remote-kv/src/aws/aws-attachment.ts @@ -1,8 +1,10 @@ -import * as AWS from 'aws-sdk'; import type { Credentials } from 'aws-sdk'; +import * as AWS from 'aws-sdk'; import type { ManagedUpload } from 'aws-sdk/lib/s3/managed_upload'; import { saveAs } from 'file-saver'; +import { MESSAGE_INFO } from '../constant/message-info'; +import toAsync from '../utils/to-async'; import { bucketName, bucketRegion, @@ -10,8 +12,6 @@ import { identityPoolId, keyCreator, } from './aws-config'; -import toAsync from '../utils/to-async'; -import { MESSAGE_INFO } from '../constant/message-info'; export default class AwsAttachment { readonly #s3; diff --git a/libs/datasource/state/src/index.ts b/libs/datasource/state/src/index.ts index 19ee32136b..fbd263f5d7 100644 --- a/libs/datasource/state/src/index.ts +++ b/libs/datasource/state/src/index.ts @@ -1,3 +1,3 @@ +export * from './page'; export * from './ui'; export * from './user'; -export * from './page'; diff --git a/libs/datasource/state/src/page.ts b/libs/datasource/state/src/page.ts index b296d2824e..093ee78398 100644 --- a/libs/datasource/state/src/page.ts +++ b/libs/datasource/state/src/page.ts @@ -1,6 +1,6 @@ -import { useCallback, useEffect } from 'react'; -import { useParams, useLocation } from 'react-router-dom'; import { atom, useAtom } from 'jotai'; +import { useEffect } from 'react'; +import { useLocation, useParams } from 'react-router-dom'; // import { Virgo } from '@toeverything/components/editor-core'; // type EditorsMap = Record; diff --git a/libs/datasource/state/src/ui.ts b/libs/datasource/state/src/ui.ts index a47c0498db..90844d39c6 100644 --- a/libs/datasource/state/src/ui.ts +++ b/libs/datasource/state/src/ui.ts @@ -1,5 +1,5 @@ -import { useCallback } from 'react'; import { atom, useAtom } from 'jotai'; +import { useCallback } from 'react'; const _showSpaceSidebarAtom = atom(true); const _fixedDisplayAtom = atom(true); diff --git a/libs/datasource/state/src/user.ts b/libs/datasource/state/src/user.ts index d32fef2c56..1d47fcb4c7 100644 --- a/libs/datasource/state/src/user.ts +++ b/libs/datasource/state/src/user.ts @@ -1,4 +1,3 @@ -import { useNavigate } from 'react-router'; import { getAuth, onAuthStateChanged, @@ -6,6 +5,7 @@ import { } from 'firebase/auth'; import { atom, useAtom } from 'jotai'; import { useEffect, useMemo } from 'react'; +import { useNavigate } from 'react-router'; import { useIdentifyUser } from '@toeverything/datasource/feature-flags'; import { UserInfo } from '@toeverything/utils';