tldraw 3.16.0-canary.ffdf566dd0a8 → 3.16.0-internal.a478398270c6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +19 -125
- package/dist-cjs/index.js +2 -19
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawImage.js +2 -5
- package/dist-cjs/lib/TldrawImage.js.map +3 -3
- package/dist-cjs/lib/canvas/TldrawCropHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawCropHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawOverlays.js +1 -1
- package/dist-cjs/lib/canvas/TldrawOverlays.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +271 -279
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +0 -1
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +41 -24
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js +4 -16
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +1 -1
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +0 -3
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +5 -5
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js +4 -15
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +1 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PathBuilder.js +3 -21
- package/dist-cjs/lib/shapes/shared/PathBuilder.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +0 -1
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js +2 -5
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/SvgTextLabel.js +3 -4
- package/dist-cjs/lib/shapes/shared/SvgTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +1 -10
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js +11 -5
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
- package/dist-cjs/lib/styles.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js +1 -7
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +22 -43
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +15 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +0 -5
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.js.map +2 -2
- package/dist-cjs/lib/ui/assetUrls.js +13 -10
- package/dist-cjs/lib/ui/assetUrls.js.map +2 -2
- package/dist-cjs/lib/ui/components/A11y.js +12 -14
- package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +1 -51
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +2 -3
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +4 -3
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/Spinner.js +25 -2
- package/dist-cjs/lib/ui/components/Spinner.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +0 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +136 -168
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js +7 -21
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +2 -3
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +0 -22
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButtonIcon.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +0 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js +1 -35
- package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +2 -6
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +3 -12
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +2 -0
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +2 -3
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +8 -57
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +0 -11
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/kbd-utils.js +1 -2
- package/dist-cjs/lib/ui/kbd-utils.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js +2 -3
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
- package/dist-esm/index.d.mts +19 -125
- package/dist-esm/index.mjs +4 -33
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawImage.mjs +2 -5
- package/dist-esm/lib/TldrawImage.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawOverlays.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawOverlays.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +271 -279
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +0 -1
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +41 -26
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +5 -19
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +1 -1
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +0 -3
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +5 -5
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +4 -15
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +1 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs +3 -22
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +0 -1
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +2 -5
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs +3 -4
- package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +1 -10
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +11 -5
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/styles.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs +1 -7
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +22 -43
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +15 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +0 -5
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.mjs.map +2 -2
- package/dist-esm/lib/ui/assetUrls.mjs +13 -10
- package/dist-esm/lib/ui/assetUrls.mjs.map +2 -2
- package/dist-esm/lib/ui/components/A11y.mjs +12 -14
- package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +1 -51
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +3 -3
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +4 -3
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Spinner.mjs +26 -3
- package/dist-esm/lib/ui/components/Spinner.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +1 -3
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +136 -168
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs +9 -23
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs.map +3 -3
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +3 -3
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +2 -3
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +0 -22
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButtonIcon.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +0 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs +1 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs +2 -36
- package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +2 -6
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +3 -12
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +2 -0
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +2 -3
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +8 -57
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +0 -11
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/kbd-utils.mjs +1 -2
- package/dist-esm/lib/ui/kbd-utils.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs +2 -3
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
- package/package.json +3 -4
- package/src/index.ts +2 -24
- package/src/lib/TldrawImage.tsx +2 -6
- package/src/lib/canvas/TldrawCropHandles.tsx +1 -3
- package/src/lib/canvas/TldrawHandles.tsx +1 -5
- package/src/lib/canvas/TldrawOverlays.tsx +1 -1
- package/src/lib/canvas/TldrawSelectionForeground.tsx +1 -5
- package/src/lib/defaultExternalContentHandlers.ts +1 -2
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +5 -5
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +43 -26
- package/src/lib/shapes/arrow/arrowLabel.ts +3 -23
- package/src/lib/shapes/arrow/arrowTargetState.ts +1 -2
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +0 -3
- package/src/lib/shapes/draw/DrawShapeUtil.tsx +4 -0
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +7 -5
- package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +3 -0
- package/src/lib/shapes/line/LineShapeUtil.tsx +5 -19
- package/src/lib/shapes/note/NoteShapeUtil.tsx +0 -1
- package/src/lib/shapes/shared/PathBuilder.test.tsx +1 -1
- package/src/lib/shapes/shared/PathBuilder.tsx +1 -35
- package/src/lib/shapes/shared/PlainTextLabel.tsx +0 -1
- package/src/lib/shapes/shared/RichTextLabel.tsx +0 -4
- package/src/lib/shapes/shared/SvgTextLabel.tsx +2 -4
- package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +1 -11
- package/src/lib/shapes/text/TextShapeUtil.tsx +12 -5
- package/src/lib/styles.tsx +1 -3
- package/src/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.ts +1 -8
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +30 -54
- package/src/lib/tools/SelectTool/childStates/Idle.ts +24 -2
- package/src/lib/tools/SelectTool/childStates/PointingShape.ts +0 -7
- package/src/lib/tools/SelectTool/childStates/Resizing.ts +1 -12
- package/src/lib/tools/SelectTool/childStates/Rotating.ts +0 -11
- package/src/lib/tools/SelectTool/childStates/Translating.ts +0 -11
- package/src/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.ts +0 -1
- package/src/lib/ui/assetUrls.ts +13 -10
- package/src/lib/ui/components/A11y.tsx +13 -15
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +0 -40
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +2 -4
- package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +4 -3
- package/src/lib/ui/components/Spinner.tsx +24 -2
- package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +1 -3
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +127 -171
- package/src/lib/ui/components/Toolbar/DefaultImageToolbar.tsx +9 -25
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +3 -3
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +12 -17
- package/src/lib/ui/components/menu-items.tsx +0 -25
- package/src/lib/ui/components/primitives/Button/TldrawUiButtonIcon.tsx +2 -2
- package/src/lib/ui/components/primitives/TldrawUiButtonPicker.tsx +0 -2
- package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiIcon.tsx +3 -41
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +1 -6
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +3 -24
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +2 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +4 -3
- package/src/lib/ui/context/TldrawUiContextProvider.tsx +20 -23
- package/src/lib/ui/context/actions.tsx +9 -59
- package/src/lib/ui/context/events.tsx +2 -5
- package/src/lib/ui/hooks/menu-hooks.ts +0 -1
- package/src/lib/ui/hooks/useKeyboardShortcuts.ts +2 -3
- package/src/lib/ui/hooks/useTools.tsx +1 -2
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +0 -11
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +0 -11
- package/src/lib/ui/kbd-utils.ts +1 -2
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +23 -65
- package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +2 -16
- package/src/lib/utils/excalidraw/putExcalidrawContent.ts +1 -1
- package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +3 -24
- package/src/lib/utils/tldr/buildFromV1Document.ts +1 -2
- package/src/test/Editor.test.tsx +1 -1
- package/src/test/SelectTool.test.ts +11 -37
- package/src/test/arrows-megabus.test.tsx +6 -12
- package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +2 -2
- package/src/test/commands/deletePage.test.ts +1 -84
- package/src/test/groups.test.tsx +1 -1
- package/src/test/navigation.test.ts +0 -254
- package/src/test/shapeutils.test.ts +45 -394
- package/src/test/translating.test.ts +1 -1
- package/tldraw.css +50 -88
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js +0 -35
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +0 -7
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +0 -267
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +0 -7
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +0 -19
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +0 -7
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +0 -237
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +0 -7
- package/src/lib/ui/components/AccessibilityMenu.tsx +0 -20
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +0 -313
- package/src/test/inner-outer-margin.test.ts +0 -315
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/utils/tldr/buildFromV1Document.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tAssetRecordType,\n\tEditor,\n\tPageRecordType,\n\tTLArrowShape,\n\tTLArrowShapeArrowheadStyle,\n\tTLAsset,\n\tTLAssetId,\n\tTLDefaultColorStyle,\n\tTLDefaultDashStyle,\n\tTLDefaultFontStyle,\n\tTLDefaultHorizontalAlignStyle,\n\tTLDefaultSizeStyle,\n\tTLDefaultTextAlignStyle,\n\tTLDrawShape,\n\tTLGeoShape,\n\tTLImageShape,\n\tTLNoteShape,\n\tTLPageId,\n\tTLShapeId,\n\tTLTextShape,\n\tTLVideoShape,\n\tVec,\n\tVecModel,\n\tclamp,\n\tcreateShapeId,\n\tfetch,\n\tstructuredClone,\n\ttoRichText,\n} from '@tldraw/editor'\nimport { getArrowBindings } from '../../shapes/arrow/shared'\n\nconst TLDRAW_V1_VERSION = 15.5\n\n/** @internal */\nexport function buildFromV1Document(editor: Editor, _document: unknown) {\n\tlet document = _document as TLV1Document\n\teditor.run(() => {\n\t\tdocument = migrate(document, TLDRAW_V1_VERSION)\n\t\t// Cancel any interactions / states\n\t\teditor.cancel().cancel().cancel().cancel()\n\n\t\tconst firstPageId = editor.getPages()[0].id\n\n\t\t// Set the current page to the first page\n\t\teditor.setCurrentPage(firstPageId)\n\n\t\t// Delete all pages except first page\n\t\tfor (const page of editor.getPages().slice(1)) {\n\t\t\teditor.deletePage(page.id)\n\t\t}\n\n\t\t// Delete all of the shapes on the current page\n\t\teditor.selectAll()\n\t\teditor.deleteShapes(editor.getSelectedShapeIds())\n\n\t\t// Create assets\n\t\tconst v1AssetIdsToV2AssetIds = new Map<string, TLAssetId>()\n\n\t\tObject.values(document.assets ?? {}).forEach((v1Asset) => {\n\t\t\tswitch (v1Asset.type) {\n\t\t\t\tcase TLV1AssetType.Image: {\n\t\t\t\t\tconst assetId: TLAssetId = AssetRecordType.createId()\n\t\t\t\t\tv1AssetIdsToV2AssetIds.set(v1Asset.id, assetId)\n\t\t\t\t\tconst placeholderAsset: TLAsset = {\n\t\t\t\t\t\tid: assetId,\n\t\t\t\t\t\ttypeName: 'asset',\n\t\t\t\t\t\ttype: 'image',\n\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\tw: coerceDimension(v1Asset.size[0]),\n\t\t\t\t\t\t\th: coerceDimension(v1Asset.size[1]),\n\t\t\t\t\t\t\tname: v1Asset.fileName ?? 'Untitled',\n\t\t\t\t\t\t\tisAnimated: false,\n\t\t\t\t\t\t\tmimeType: null,\n\t\t\t\t\t\t\tsrc: v1Asset.src,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmeta: {},\n\t\t\t\t\t}\n\t\t\t\t\teditor.createAssets([placeholderAsset])\n\t\t\t\t\ttryMigrateAsset(editor, placeholderAsset)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase TLV1AssetType.Video:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst assetId: TLAssetId = AssetRecordType.createId()\n\t\t\t\t\t\tv1AssetIdsToV2AssetIds.set(v1Asset.id, assetId)\n\t\t\t\t\t\teditor.createAssets([\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tid: assetId,\n\t\t\t\t\t\t\t\ttypeName: 'asset',\n\t\t\t\t\t\t\t\ttype: 'video',\n\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Asset.size[0]),\n\t\t\t\t\t\t\t\t\th: coerceDimension(v1Asset.size[1]),\n\t\t\t\t\t\t\t\t\tname: v1Asset.fileName ?? 'Untitled',\n\t\t\t\t\t\t\t\t\tisAnimated: true,\n\t\t\t\t\t\t\t\t\tmimeType: null,\n\t\t\t\t\t\t\t\t\tsrc: v1Asset.src,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tmeta: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t])\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t})\n\n\t\t// Create pages\n\n\t\tconst v1PageIdsToV2PageIds = new Map<string, TLPageId>()\n\n\t\tObject.values(document.pages ?? {})\n\t\t\t.sort((a, b) => ((a.childIndex ?? 1) < (b.childIndex ?? 1) ? -1 : 1))\n\t\t\t.forEach((v1Page, i) => {\n\t\t\t\tif (i === 0) {\n\t\t\t\t\tv1PageIdsToV2PageIds.set(v1Page.id, editor.getCurrentPageId())\n\t\t\t\t} else {\n\t\t\t\t\tconst pageId = PageRecordType.createId()\n\t\t\t\t\tv1PageIdsToV2PageIds.set(v1Page.id, pageId)\n\t\t\t\t\teditor.createPage({ name: v1Page.name ?? 'Page', id: pageId })\n\t\t\t\t}\n\t\t\t})\n\n\t\tObject.values(document.pages ?? {})\n\t\t\t.sort((a, b) => ((a.childIndex ?? 1) < (b.childIndex ?? 1) ? -1 : 1))\n\t\t\t.forEach((v1Page) => {\n\t\t\t\t// Set the current page id to the current page\n\t\t\t\teditor.setCurrentPage(v1PageIdsToV2PageIds.get(v1Page.id)!)\n\n\t\t\t\tconst v1ShapeIdsToV2ShapeIds = new Map<string, TLShapeId>()\n\t\t\t\tconst v1GroupShapeIdsToV1ChildIds = new Map<string, string[]>()\n\n\t\t\t\tconst v1Shapes = Object.values(v1Page.shapes ?? {})\n\t\t\t\t\t.sort((a, b) => (a.childIndex < b.childIndex ? -1 : 1))\n\t\t\t\t\t.slice(0, editor.options.maxShapesPerPage)\n\n\t\t\t\t// Groups only\n\t\t\t\tv1Shapes.forEach((v1Shape) => {\n\t\t\t\t\tif (v1Shape.type !== TLV1ShapeType.Group) return\n\n\t\t\t\t\tconst shapeId = createShapeId()\n\t\t\t\t\tv1ShapeIdsToV2ShapeIds.set(v1Shape.id, shapeId)\n\t\t\t\t\tv1GroupShapeIdsToV1ChildIds.set(v1Shape.id, [])\n\t\t\t\t})\n\n\t\t\t\tfunction decideNotToCreateShape(v1Shape: TLV1Shape) {\n\t\t\t\t\tv1ShapeIdsToV2ShapeIds.delete(v1Shape.id)\n\t\t\t\t\tconst v1GroupParent = v1GroupShapeIdsToV1ChildIds.has(v1Shape.parentId)\n\t\t\t\t\tif (v1GroupParent) {\n\t\t\t\t\t\tconst ids = v1GroupShapeIdsToV1ChildIds\n\t\t\t\t\t\t\t.get(v1Shape.parentId)!\n\t\t\t\t\t\t\t.filter((id) => id !== v1Shape.id)\n\t\t\t\t\t\tv1GroupShapeIdsToV1ChildIds.set(v1Shape.parentId, ids)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Non-groups only\n\t\t\t\tv1Shapes.forEach((v1Shape) => {\n\t\t\t\t\t// Skip groups for now, we'll create groups via the app's API\n\t\t\t\t\tif (v1Shape.type === TLV1ShapeType.Group) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tconst shapeId = createShapeId()\n\t\t\t\t\tv1ShapeIdsToV2ShapeIds.set(v1Shape.id, shapeId)\n\n\t\t\t\t\tif (v1Shape.parentId !== v1Page.id) {\n\t\t\t\t\t\t// If the parent is a group, then add the shape to the group's children\n\t\t\t\t\t\tif (v1GroupShapeIdsToV1ChildIds.has(v1Shape.parentId)) {\n\t\t\t\t\t\t\tv1GroupShapeIdsToV1ChildIds.get(v1Shape.parentId)!.push(v1Shape.id)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconsole.warn('parent does not exist', v1Shape)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// First, try to find the shape's parent among the existing groups\n\t\t\t\t\tconst parentId = v1PageIdsToV2PageIds.get(v1Page.id)!\n\n\t\t\t\t\tconst inCommon = {\n\t\t\t\t\t\tid: shapeId,\n\t\t\t\t\t\tparentId,\n\t\t\t\t\t\tx: coerceNumber(v1Shape.point[0]),\n\t\t\t\t\t\ty: coerceNumber(v1Shape.point[1]),\n\t\t\t\t\t\trotation: 0,\n\t\t\t\t\t\tisLocked: !!v1Shape.isLocked,\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (v1Shape.type) {\n\t\t\t\t\t\tcase TLV1ShapeType.Sticky: {\n\t\t\t\t\t\t\teditor.createShapes<TLNoteShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'note',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.text ?? ''),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\talign: getV2Align(v1Shape.style.textAlign),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Rectangle: {\n\t\t\t\t\t\t\teditor.createShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tgeo: 'rectangle',\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.size[0]),\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.size[1]),\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.label ?? ''),\n\t\t\t\t\t\t\t\t\t\tfill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tlabelColor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\talign: 'middle',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tconst pageBoundsBeforeLabel = editor.getShapePageBounds(inCommon.id)!\n\n\t\t\t\t\t\t\teditor.updateShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.label ?? ''),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tif (pageBoundsBeforeLabel.width === pageBoundsBeforeLabel.height) {\n\t\t\t\t\t\t\t\tconst shape = editor.getShape<TLGeoShape>(inCommon.id)!\n\t\t\t\t\t\t\t\tconst { growY } = shape.props\n\t\t\t\t\t\t\t\tconst w = coerceDimension(shape.props.w)\n\t\t\t\t\t\t\t\tconst h = coerceDimension(shape.props.h)\n\t\t\t\t\t\t\t\tconst newW = w + growY / 2\n\t\t\t\t\t\t\t\tconst newH = h + growY / 2\n\n\t\t\t\t\t\t\t\teditor.updateShapes([\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\t\tx: coerceNumber(shape.x) - (newW - w) / 2,\n\t\t\t\t\t\t\t\t\t\ty: coerceNumber(shape.y) - (newH - h) / 2,\n\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\tw: newW,\n\t\t\t\t\t\t\t\t\t\t\th: newH,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Triangle: {\n\t\t\t\t\t\t\teditor.createShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tgeo: 'triangle',\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.size[0]),\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.size[1]),\n\t\t\t\t\t\t\t\t\t\tfill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tlabelColor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\talign: 'middle',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tconst pageBoundsBeforeLabel = editor.getShapePageBounds(inCommon.id)!\n\n\t\t\t\t\t\t\teditor.updateShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.label ?? ''),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tif (pageBoundsBeforeLabel.width === pageBoundsBeforeLabel.height) {\n\t\t\t\t\t\t\t\tconst shape = editor.getShape<TLGeoShape>(inCommon.id)!\n\t\t\t\t\t\t\t\tconst { growY } = shape.props\n\t\t\t\t\t\t\t\tconst w = coerceDimension(shape.props.w)\n\t\t\t\t\t\t\t\tconst h = coerceDimension(shape.props.h)\n\t\t\t\t\t\t\t\tconst newW = w + growY / 2\n\t\t\t\t\t\t\t\tconst newH = h + growY / 2\n\n\t\t\t\t\t\t\t\teditor.updateShapes([\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\t\tx: coerceNumber(shape.x) - (newW - w) / 2,\n\t\t\t\t\t\t\t\t\t\ty: coerceNumber(shape.y) - (newH - h) / 2,\n\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\tw: newW,\n\t\t\t\t\t\t\t\t\t\t\th: newH,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Ellipse: {\n\t\t\t\t\t\t\teditor.createShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tgeo: 'ellipse',\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.radius[0]) * 2,\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.radius[1]) * 2,\n\t\t\t\t\t\t\t\t\t\tfill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tlabelColor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\talign: 'middle',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tconst pageBoundsBeforeLabel = editor.getShapePageBounds(inCommon.id)!\n\n\t\t\t\t\t\t\teditor.updateShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.label ?? ''),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tif (pageBoundsBeforeLabel.width === pageBoundsBeforeLabel.height) {\n\t\t\t\t\t\t\t\tconst shape = editor.getShape<TLGeoShape>(inCommon.id)!\n\t\t\t\t\t\t\t\tconst { growY } = shape.props\n\t\t\t\t\t\t\t\tconst w = coerceDimension(shape.props.w)\n\t\t\t\t\t\t\t\tconst h = coerceDimension(shape.props.h)\n\t\t\t\t\t\t\t\tconst newW = w + growY / 2\n\t\t\t\t\t\t\t\tconst newH = h + growY / 2\n\n\t\t\t\t\t\t\t\teditor.updateShapes([\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\t\tx: coerceNumber(shape.x) - (newW - w) / 2,\n\t\t\t\t\t\t\t\t\t\ty: coerceNumber(shape.y) - (newH - h) / 2,\n\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\tw: newW,\n\t\t\t\t\t\t\t\t\t\t\th: newH,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Draw: {\n\t\t\t\t\t\t\tif (v1Shape.points.length === 0) {\n\t\t\t\t\t\t\t\tdecideNotToCreateShape(v1Shape)\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\teditor.createShapes<TLDrawShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'draw',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tfill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\tisPen: false,\n\t\t\t\t\t\t\t\t\t\tisComplete: v1Shape.isComplete,\n\t\t\t\t\t\t\t\t\t\tsegments: [{ type: 'free', points: v1Shape.points.map(getV2Point) }],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Arrow: {\n\t\t\t\t\t\t\tconst v1Bend = coerceNumber(v1Shape.bend)\n\t\t\t\t\t\t\tconst v1Start = getV2Point(v1Shape.handles.start.point)\n\t\t\t\t\t\t\tconst v1End = getV2Point(v1Shape.handles.end.point)\n\t\t\t\t\t\t\tconst dist = Vec.Dist(v1Start, v1End)\n\t\t\t\t\t\t\tconst v2Bend = (dist * -v1Bend) / 2\n\n\t\t\t\t\t\t\t// Could also be a line... but we'll use it as an arrow anyway\n\t\t\t\t\t\t\teditor.createShapes<TLArrowShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'arrow',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.label ?? ''),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tlabelColor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\tarrowheadStart: getV2Arrowhead(v1Shape.decorations?.start),\n\t\t\t\t\t\t\t\t\t\tarrowheadEnd: getV2Arrowhead(v1Shape.decorations?.end),\n\t\t\t\t\t\t\t\t\t\tstart: {\n\t\t\t\t\t\t\t\t\t\t\tx: coerceNumber(v1Shape.handles.start.point[0]),\n\t\t\t\t\t\t\t\t\t\t\ty: coerceNumber(v1Shape.handles.start.point[1]),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tend: {\n\t\t\t\t\t\t\t\t\t\t\tx: coerceNumber(v1Shape.handles.end.point[0]),\n\t\t\t\t\t\t\t\t\t\t\ty: coerceNumber(v1Shape.handles.end.point[1]),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tbend: v2Bend,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Text: {\n\t\t\t\t\t\t\teditor.createShapes<TLTextShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.text ?? ' '),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2TextSize(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\ttextAlign: getV2TextAlign(v1Shape.style.textAlign),\n\t\t\t\t\t\t\t\t\t\tscale: v1Shape.style.scale ?? 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Image: {\n\t\t\t\t\t\t\tconst assetId = v1AssetIdsToV2AssetIds.get(v1Shape.assetId)\n\n\t\t\t\t\t\t\tif (!assetId) {\n\t\t\t\t\t\t\t\tconsole.warn('Could not find asset id', v1Shape.assetId)\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\teditor.createShapes<TLImageShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'image',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.size[0]),\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.size[1]),\n\t\t\t\t\t\t\t\t\t\tassetId,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Video: {\n\t\t\t\t\t\t\tconst assetId = v1AssetIdsToV2AssetIds.get(v1Shape.assetId)\n\n\t\t\t\t\t\t\tif (!assetId) {\n\t\t\t\t\t\t\t\tconsole.warn('Could not find asset id', v1Shape.assetId)\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\teditor.createShapes<TLVideoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'video',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.size[0]),\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.size[1]),\n\t\t\t\t\t\t\t\t\t\tassetId,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst rotation = coerceNumber(v1Shape.rotation)\n\n\t\t\t\t\tif (rotation !== 0) {\n\t\t\t\t\t\teditor.select(shapeId)\n\t\t\t\t\t\teditor.rotateShapesBy([shapeId], rotation)\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\t// Create groups\n\t\t\t\tv1GroupShapeIdsToV1ChildIds.forEach((v1ChildIds, v1GroupId) => {\n\t\t\t\t\tconst v2ChildShapeIds = v1ChildIds.map((id) => v1ShapeIdsToV2ShapeIds.get(id)!)\n\t\t\t\t\tconst v2GroupId = v1ShapeIdsToV2ShapeIds.get(v1GroupId)!\n\t\t\t\t\teditor.groupShapes(v2ChildShapeIds, { groupId: v2GroupId })\n\n\t\t\t\t\tconst v1Group = v1Page.shapes[v1GroupId]\n\t\t\t\t\tconst rotation = coerceNumber(v1Group.rotation)\n\n\t\t\t\t\tif (rotation !== 0) {\n\t\t\t\t\t\teditor.select(v2GroupId)\n\t\t\t\t\t\teditor.rotateShapesBy([v2GroupId], rotation)\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\t// Bind arrows to shapes\n\n\t\t\t\tv1Shapes.forEach((v1Shape) => {\n\t\t\t\t\tif (v1Shape.type !== TLV1ShapeType.Arrow) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tconst v2ShapeId = v1ShapeIdsToV2ShapeIds.get(v1Shape.id)!\n\t\t\t\t\tconst util = editor.getShapeUtil<TLArrowShape>('arrow')\n\n\t\t\t\t\t// dumb but necessary\n\t\t\t\t\teditor.inputs.ctrlKey = false\n\n\t\t\t\t\tfor (const handleId of ['start', 'end'] as const) {\n\t\t\t\t\t\tconst bindingId = v1Shape.handles[handleId].bindingId\n\t\t\t\t\t\tif (bindingId) {\n\t\t\t\t\t\t\tconst binding = v1Page.bindings[bindingId]\n\t\t\t\t\t\t\tif (!binding) {\n\t\t\t\t\t\t\t\t// arrow has a reference to a binding that no longer exists\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst targetId = v1ShapeIdsToV2ShapeIds.get(binding.toId)!\n\n\t\t\t\t\t\t\tconst targetShape = editor.getShape(targetId)!\n\n\t\t\t\t\t\t\t// (unexpected) We didn't create the target shape\n\t\t\t\t\t\t\tif (!targetShape) continue\n\n\t\t\t\t\t\t\tif (targetId) {\n\t\t\t\t\t\t\t\tconst bounds = editor.getShapePageBounds(targetId)!\n\n\t\t\t\t\t\t\t\tconst v2ShapeFresh = editor.getShape<TLArrowShape>(v2ShapeId)!\n\n\t\t\t\t\t\t\t\tconst nx = clamp((coerceNumber(binding.point[0]) + 0.5) / 2, 0.2, 0.8)\n\t\t\t\t\t\t\t\tconst ny = clamp((coerceNumber(binding.point[1]) + 0.5) / 2, 0.2, 0.8)\n\n\t\t\t\t\t\t\t\tconst point = editor.getPointInShapeSpace(v2ShapeFresh, {\n\t\t\t\t\t\t\t\t\tx: bounds.minX + bounds.width * nx,\n\t\t\t\t\t\t\t\t\ty: bounds.minY + bounds.height * ny,\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\tconst handles = editor.getShapeHandles(v2ShapeFresh)!\n\t\t\t\t\t\t\t\tconst change = util.onHandleDrag!(v2ShapeFresh, {\n\t\t\t\t\t\t\t\t\thandle: {\n\t\t\t\t\t\t\t\t\t\t...handles.find((h) => h.id === handleId)!,\n\t\t\t\t\t\t\t\t\t\tx: point.x,\n\t\t\t\t\t\t\t\t\t\ty: point.y,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tisPrecise: point.x !== 0.5 || point.y !== 0.5,\n\t\t\t\t\t\t\t\t\tisCreatingShape: true,\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\tif (change) {\n\t\t\t\t\t\t\t\t\teditor.updateShape(change)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst freshBinding = getArrowBindings(\n\t\t\t\t\t\t\t\t\teditor,\n\t\t\t\t\t\t\t\t\teditor.getShape<TLArrowShape>(v2ShapeId)!\n\t\t\t\t\t\t\t\t)[handleId]\n\t\t\t\t\t\t\t\tif (freshBinding) {\n\t\t\t\t\t\t\t\t\tconst updatedFreshBinding = structuredClone(freshBinding)\n\t\t\t\t\t\t\t\t\tif (binding.distance === 0) {\n\t\t\t\t\t\t\t\t\t\tupdatedFreshBinding.props.isExact = true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (updatedFreshBinding.toId !== targetId) {\n\t\t\t\t\t\t\t\t\t\tupdatedFreshBinding.toId = targetId\n\t\t\t\t\t\t\t\t\t\tupdatedFreshBinding.props.normalizedAnchor = { x: nx, y: ny }\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\teditor.updateBinding(updatedFreshBinding)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\n\t\t// Set the current page to the first page again\n\t\teditor.setCurrentPage(firstPageId)\n\n\t\teditor.clearHistory()\n\t\teditor.selectNone()\n\n\t\tconst bounds = editor.getCurrentPageBounds()\n\t\tif (bounds) {\n\t\t\teditor.zoomToBounds(bounds, { targetZoom: 1 })\n\t\t}\n\t})\n}\n\nfunction coerceNumber(n: unknown): number {\n\tif (typeof n !== 'number') return 0\n\tif (Number.isNaN(n)) return 0\n\tif (!Number.isFinite(n)) return 0\n\treturn n\n}\n\nfunction coerceDimension(d: unknown): number {\n\tconst n = coerceNumber(d)\n\tif (n <= 0) return 1\n\treturn n\n}\n\n/**\n * We want to move assets over to our new S3 bucket & extract any relevant metadata. That process is\n * async though, where the rest of our migration is synchronous.\n *\n * We'll write placeholder assets to the app using the old asset URLs, then kick off a process async\n * to try and download the real assets, extract the metadata, and upload them to our new bucket.\n * It's not a big deal if this fails though.\n */\nasync function tryMigrateAsset(editor: Editor, placeholderAsset: TLAsset) {\n\ttry {\n\t\tif (placeholderAsset.type === 'bookmark' || !placeholderAsset.props.src) return\n\n\t\tconst response = await fetch(placeholderAsset.props.src)\n\t\tif (!response.ok) return\n\n\t\tconst file = new File([await response.blob()], placeholderAsset.props.name, {\n\t\t\ttype: response.headers.get('content-type') ?? placeholderAsset.props.mimeType ?? undefined,\n\t\t})\n\n\t\tconst newAsset = await editor.getAssetForExternalContent({ type: 'file', file })\n\t\tif (!newAsset) throw new Error('Could not get asset for external content')\n\t\tif (newAsset.type === 'bookmark') return\n\n\t\teditor.updateAssets([\n\t\t\t{\n\t\t\t\tid: placeholderAsset.id,\n\t\t\t\ttype: placeholderAsset.type,\n\t\t\t\tprops: {\n\t\t\t\t\t...newAsset.props,\n\t\t\t\t\tname: placeholderAsset.props.name,\n\t\t\t\t},\n\t\t\t},\n\t\t])\n\t} catch {\n\t\t// not a big deal, we'll just keep the placeholder asset\n\t}\n}\n\nfunction migrate(document: TLV1Document, newVersion: number): TLV1Document {\n\tconst { version = 0 } = document\n\n\tif (!document.assets) {\n\t\tdocument.assets = {}\n\t}\n\n\t// Remove unused assets when loading a document\n\tconst assetIdsInUse = new Set<string>()\n\n\tObject.values(document.pages).forEach((page) =>\n\t\tObject.values(page.shapes).forEach((shape) => {\n\t\t\tconst { parentId, children, assetId } = shape\n\n\t\t\tif (assetId) {\n\t\t\t\tassetIdsInUse.add(assetId)\n\t\t\t}\n\n\t\t\t// Fix missing parent bug\n\t\t\tif (parentId !== page.id && !page.shapes[parentId]) {\n\t\t\t\tconsole.warn('Encountered a shape with a missing parent!')\n\t\t\t\tshape.parentId = page.id\n\t\t\t}\n\n\t\t\tif (shape.type === TLV1ShapeType.Group && children) {\n\t\t\t\tchildren.forEach((childId) => {\n\t\t\t\t\tif (!page.shapes[childId]) {\n\t\t\t\t\t\tconsole.warn('Encountered a parent with a missing child!', shape.id, childId)\n\t\t\t\t\t\tchildren?.splice(children.indexOf(childId), 1)\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\t// TODO: Remove the shape if it has no children\n\t\t\t}\n\t\t})\n\t)\n\n\tObject.keys(document.assets).forEach((assetId) => {\n\t\tif (!assetIdsInUse.has(assetId)) {\n\t\t\tdelete document.assets[assetId]\n\t\t}\n\t})\n\n\tif (version !== newVersion) {\n\t\tif (version < 14) {\n\t\t\tObject.values(document.pages).forEach((page) => {\n\t\t\t\tObject.values(page.shapes)\n\t\t\t\t\t.filter((shape) => shape.type === TLV1ShapeType.Text)\n\t\t\t\t\t.forEach((shape) => {\n\t\t\t\t\t\tif ((shape as TLV1TextShape).style.font === undefined) {\n\t\t\t\t\t\t\t;(shape as TLV1TextShape).style.font = TLV1FontStyle.Script\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t})\n\t\t}\n\n\t\t// Lowercase styles, move binding meta to binding\n\t\tif (version <= 13) {\n\t\t\tObject.values(document.pages).forEach((page) => {\n\t\t\t\tObject.values(page.bindings).forEach((binding) => {\n\t\t\t\t\tObject.assign(binding, (binding as any).meta)\n\t\t\t\t})\n\n\t\t\t\tObject.values(page.shapes).forEach((shape) => {\n\t\t\t\t\tObject.entries(shape.style).forEach(([id, style]) => {\n\t\t\t\t\t\tif (typeof style === 'string') {\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\tshape.style[id] = style.toLowerCase()\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tif (shape.type === TLV1ShapeType.Arrow) {\n\t\t\t\t\t\tif (shape.decorations) {\n\t\t\t\t\t\t\tObject.entries(shape.decorations).forEach(([id, decoration]) => {\n\t\t\t\t\t\t\t\tif ((decoration as unknown) === 'Arrow') {\n\t\t\t\t\t\t\t\t\tshape.decorations = {\n\t\t\t\t\t\t\t\t\t\t...shape.decorations,\n\t\t\t\t\t\t\t\t\t\t[id]: TLV1Decoration.Arrow,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\n\t\t// Add document name and file system handle\n\t\tif (version <= 13.1 && document.name == null) {\n\t\t\tdocument.name = 'New Document'\n\t\t}\n\n\t\tif (version < 15 && document.assets == null) {\n\t\t\tdocument.assets = {}\n\t\t}\n\n\t\tObject.values(document.pages).forEach((page) => {\n\t\t\tObject.values(page.shapes).forEach((shape) => {\n\t\t\t\tif (version < 15.2) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t(shape.type === TLV1ShapeType.Image || shape.type === TLV1ShapeType.Video) &&\n\t\t\t\t\t\tshape.style.isFilled == null\n\t\t\t\t\t) {\n\t\t\t\t\t\tshape.style.isFilled = true\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (version < 15.3) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tshape.type === TLV1ShapeType.Rectangle ||\n\t\t\t\t\t\tshape.type === TLV1ShapeType.Triangle ||\n\t\t\t\t\t\tshape.type === TLV1ShapeType.Ellipse ||\n\t\t\t\t\t\tshape.type === TLV1ShapeType.Arrow\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ('text' in shape && typeof shape.text === 'string') {\n\t\t\t\t\t\t\tshape.label = shape.text\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!shape.label) {\n\t\t\t\t\t\t\tshape.label = ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!shape.labelPoint) {\n\t\t\t\t\t\t\tshape.labelPoint = [0.5, 0.5]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t}\n\n\t// Cleanup\n\tObject.values(document.pageStates).forEach((pageState) => {\n\t\tpageState.selectedIds = pageState.selectedIds.filter((id) => {\n\t\t\treturn document.pages[pageState.id].shapes[id] !== undefined\n\t\t})\n\t\tpageState.bindingId = undefined\n\t\tpageState.editingId = undefined\n\t\tpageState.hoveredId = undefined\n\t\tpageState.pointedId = undefined\n\t})\n\n\tdocument.version = newVersion\n\n\treturn document\n}\n\n/* -------------------- TLV1 Types -------------------- */\n\n/** @internal */\nexport interface TLV1Handle {\n\tid: string\n\tindex: number\n\tpoint: number[]\n\tcanBind?: boolean\n\tbindingId?: string\n}\n\n/** @internal */\nexport interface TLV1BaseBinding {\n\tid: string\n\ttoId: string\n\tfromId: string\n}\n\n/** @internal */\nexport enum TLV1ShapeType {\n\tSticky = 'sticky',\n\tEllipse = 'ellipse',\n\tRectangle = 'rectangle',\n\tTriangle = 'triangle',\n\tDraw = 'draw',\n\tArrow = 'arrow',\n\tText = 'text',\n\tGroup = 'group',\n\tImage = 'image',\n\tVideo = 'video',\n}\n\n/** @internal */\nexport enum TLV1ColorStyle {\n\tWhite = 'white',\n\tLightGray = 'lightGray',\n\tGray = 'gray',\n\tBlack = 'black',\n\tGreen = 'green',\n\tCyan = 'cyan',\n\tBlue = 'blue',\n\tIndigo = 'indigo',\n\tViolet = 'violet',\n\tRed = 'red',\n\tOrange = 'orange',\n\tYellow = 'yellow',\n}\n\n/** @internal */\nexport enum TLV1SizeStyle {\n\tSmall = 'small',\n\tMedium = 'medium',\n\tLarge = 'large',\n}\n\n/** @internal */\nexport enum TLV1DashStyle {\n\tDraw = 'draw',\n\tSolid = 'solid',\n\tDashed = 'dashed',\n\tDotted = 'dotted',\n}\n\n/** @internal */\nexport enum TLV1AlignStyle {\n\tStart = 'start',\n\tMiddle = 'middle',\n\tEnd = 'end',\n\tJustify = 'justify',\n}\n\n/** @internal */\nexport enum TLV1FontStyle {\n\tScript = 'script',\n\tSans = 'sans',\n\tSerif = 'serif',\n\tMono = 'mono',\n}\n\n/** @internal */\nexport interface TLV1ShapeStyles {\n\tcolor: TLV1ColorStyle\n\tsize: TLV1SizeStyle\n\tdash: TLV1DashStyle\n\tfont?: TLV1FontStyle\n\ttextAlign?: TLV1AlignStyle\n\tisFilled?: boolean\n\tscale?: number\n}\n\n/** @internal */\nexport interface TLV1BaseShape {\n\tid: string\n\tparentId: string\n\tchildIndex: number\n\tname: string\n\tpoint: number[]\n\tassetId?: string\n\trotation?: number\n\tchildren?: string[]\n\tisGhost?: boolean\n\tisHidden?: boolean\n\tisLocked?: boolean\n\tisGenerated?: boolean\n\tisAspectRatioLocked?: boolean\n\tstyle: TLV1ShapeStyles\n\ttype: TLV1ShapeType\n\tlabel?: string\n\thandles?: Record<string, TLV1Handle>\n}\n\n/** @internal */\nexport interface TLV1DrawShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Draw\n\tpoints: number[][]\n\tisComplete: boolean\n}\n\n/** @internal */\nexport interface TLV1RectangleShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Rectangle\n\tsize: number[]\n\tlabel?: string\n\tlabelPoint?: number[]\n}\n\n/** @internal */\nexport interface TLV1EllipseShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Ellipse\n\tradius: number[]\n\tlabel?: string\n\tlabelPoint?: number[]\n}\n\n/** @internal */\nexport interface TLV1TriangleShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Triangle\n\tsize: number[]\n\tlabel?: string\n\tlabelPoint?: number[]\n}\n\n/** @internal */\nexport enum TLV1Decoration {\n\tArrow = 'arrow',\n}\n\n// The shape created with the arrow tool\n/** @internal */\nexport interface TLV1ArrowShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Arrow\n\tbend: number\n\thandles: {\n\t\tstart: TLV1Handle\n\t\tbend: TLV1Handle\n\t\tend: TLV1Handle\n\t}\n\tdecorations?: {\n\t\tstart?: TLV1Decoration\n\t\tend?: TLV1Decoration\n\t\tmiddle?: TLV1Decoration\n\t}\n\tlabel?: string\n\tlabelPoint?: number[]\n}\n\n/** @internal */\nexport interface TLV1ArrowBinding extends TLV1BaseBinding {\n\thandleId: keyof TLV1ArrowShape['handles']\n\tdistance: number\n\tpoint: number[]\n}\n\n/** @internal */\nexport type TLV1Binding = TLV1ArrowBinding\n\n/** @internal */\nexport interface TLV1ImageShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Image\n\tsize: number[]\n\tassetId: string\n}\n\n/** @internal */\nexport interface TLV1VideoShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Video\n\tsize: number[]\n\tassetId: string\n\tisPlaying: boolean\n\tcurrentTime: number\n}\n\n// The shape created by the text tool\n/** @internal */\nexport interface TLV1TextShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Text\n\ttext: string\n}\n\n// The shape created by the sticky tool\n/** @internal */\nexport interface TLV1StickyShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Sticky\n\tsize: number[]\n\ttext: string\n}\n\n// The shape created when multiple shapes are grouped\n/** @internal */\nexport interface TLV1GroupShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Group\n\tsize: number[]\n\tchildren: string[]\n}\n\n/** @internal */\nexport type TLV1Shape =\n\t| TLV1RectangleShape\n\t| TLV1EllipseShape\n\t| TLV1TriangleShape\n\t| TLV1DrawShape\n\t| TLV1ArrowShape\n\t| TLV1TextShape\n\t| TLV1GroupShape\n\t| TLV1StickyShape\n\t| TLV1ImageShape\n\t| TLV1VideoShape\n\n/** @internal */\nexport interface TLV1Page {\n\tid: string\n\tname?: string\n\tchildIndex?: number\n\tshapes: Record<string, TLV1Shape>\n\tbindings: Record<string, TLV1Binding>\n}\n\n/** @internal */\nexport interface TLV1Bounds {\n\tminX: number\n\tminY: number\n\tmaxX: number\n\tmaxY: number\n\twidth: number\n\theight: number\n\trotation?: number\n}\n\n/** @internal */\nexport interface TLV1PageState {\n\tid: string\n\tselectedIds: string[]\n\tcamera: {\n\t\tpoint: number[]\n\t\tzoom: number\n\t}\n\tbrush?: TLV1Bounds | null\n\tpointedId?: string | null\n\thoveredId?: string | null\n\teditingId?: string | null\n\tbindingId?: string | null\n}\n\n/** @internal */\nexport enum TLV1AssetType {\n\tImage = 'image',\n\tVideo = 'video',\n}\n\n/** @internal */\nexport interface TLV1ImageAsset extends TLV1BaseAsset {\n\ttype: TLV1AssetType.Image\n\tfileName: string\n\tsrc: string\n\tsize: number[]\n}\n\n/** @internal */\nexport interface TLV1VideoAsset extends TLV1BaseAsset {\n\ttype: TLV1AssetType.Video\n\tfileName: string\n\tsrc: string\n\tsize: number[]\n}\n\n/** @internal */\nexport interface TLV1BaseAsset {\n\tid: string\n\ttype: string\n}\n\n/** @internal */\nexport type TLV1Asset = TLV1ImageAsset | TLV1VideoAsset\n\n/** @internal */\nexport interface TLV1Document {\n\tid: string\n\tname: string\n\tversion: number\n\tpages: Record<string, TLV1Page>\n\tpageStates: Record<string, TLV1PageState>\n\tassets: Record<string, TLV1Asset>\n}\n\n/* ------------------ Translations ------------------ */\n\nconst v1ColorsToV2Colors: Record<TLV1ColorStyle, TLDefaultColorStyle> = {\n\t[TLV1ColorStyle.White]: 'black',\n\t[TLV1ColorStyle.Black]: 'black',\n\t[TLV1ColorStyle.LightGray]: 'grey',\n\t[TLV1ColorStyle.Gray]: 'grey',\n\t[TLV1ColorStyle.Green]: 'light-green',\n\t[TLV1ColorStyle.Cyan]: 'green',\n\t[TLV1ColorStyle.Blue]: 'light-blue',\n\t[TLV1ColorStyle.Indigo]: 'blue',\n\t[TLV1ColorStyle.Orange]: 'orange',\n\t[TLV1ColorStyle.Yellow]: 'yellow',\n\t[TLV1ColorStyle.Red]: 'red',\n\t[TLV1ColorStyle.Violet]: 'light-violet',\n}\n\nconst v1FontsToV2Fonts: Record<TLV1FontStyle, TLDefaultFontStyle> = {\n\t[TLV1FontStyle.Mono]: 'mono',\n\t[TLV1FontStyle.Sans]: 'sans',\n\t[TLV1FontStyle.Script]: 'draw',\n\t[TLV1FontStyle.Serif]: 'serif',\n}\n\nconst v1AlignsToV2Aligns: Record<TLV1AlignStyle, TLDefaultHorizontalAlignStyle> = {\n\t[TLV1AlignStyle.Start]: 'start',\n\t[TLV1AlignStyle.Middle]: 'middle',\n\t[TLV1AlignStyle.End]: 'end',\n\t[TLV1AlignStyle.Justify]: 'start',\n}\n\nconst v1TextAlignsToV2TextAligns: Record<TLV1AlignStyle, TLDefaultTextAlignStyle> = {\n\t[TLV1AlignStyle.Start]: 'start',\n\t[TLV1AlignStyle.Middle]: 'middle',\n\t[TLV1AlignStyle.End]: 'end',\n\t[TLV1AlignStyle.Justify]: 'start',\n}\n\nconst v1TextSizesToV2TextSizes: Record<TLV1SizeStyle, TLDefaultSizeStyle> = {\n\t[TLV1SizeStyle.Small]: 's',\n\t[TLV1SizeStyle.Medium]: 'l',\n\t[TLV1SizeStyle.Large]: 'xl',\n}\n\nconst v1SizesToV2Sizes: Record<TLV1SizeStyle, TLDefaultSizeStyle> = {\n\t[TLV1SizeStyle.Small]: 'm',\n\t[TLV1SizeStyle.Medium]: 'l',\n\t[TLV1SizeStyle.Large]: 'xl',\n}\n\nconst v1DashesToV2Dashes: Record<TLV1DashStyle, TLDefaultDashStyle> = {\n\t[TLV1DashStyle.Solid]: 'solid',\n\t[TLV1DashStyle.Dashed]: 'dashed',\n\t[TLV1DashStyle.Dotted]: 'dotted',\n\t[TLV1DashStyle.Draw]: 'draw',\n}\n\nfunction getV2Color(color: TLV1ColorStyle | undefined): TLDefaultColorStyle {\n\treturn color ? (v1ColorsToV2Colors[color] ?? 'black') : 'black'\n}\n\nfunction getV2Font(font: TLV1FontStyle | undefined): TLDefaultFontStyle {\n\treturn font ? (v1FontsToV2Fonts[font] ?? 'draw') : 'draw'\n}\n\nfunction getV2Align(align: TLV1AlignStyle | undefined): TLDefaultHorizontalAlignStyle {\n\treturn align ? (v1AlignsToV2Aligns[align] ?? 'middle') : 'middle'\n}\n\nfunction getV2TextAlign(align: TLV1AlignStyle | undefined): TLDefaultTextAlignStyle {\n\treturn align ? (v1TextAlignsToV2TextAligns[align] ?? 'middle') : 'middle'\n}\n\nfunction getV2TextSize(size: TLV1SizeStyle | undefined): TLDefaultSizeStyle {\n\treturn size ? (v1TextSizesToV2TextSizes[size] ?? 'm') : 'm'\n}\n\nfunction getV2Size(size: TLV1SizeStyle | undefined): TLDefaultSizeStyle {\n\treturn size ? (v1SizesToV2Sizes[size] ?? 'l') : 'l'\n}\n\nfunction getV2Dash(dash: TLV1DashStyle | undefined): TLDefaultDashStyle {\n\treturn dash ? (v1DashesToV2Dashes[dash] ?? 'draw') : 'draw'\n}\n\nfunction getV2Point(point: number[]): VecModel {\n\treturn {\n\t\tx: coerceNumber(point[0]),\n\t\ty: coerceNumber(point[1]),\n\t\tz: point[2] == null ? 0.5 : coerceNumber(point[2]),\n\t}\n}\n\nfunction getV2Arrowhead(decoration: TLV1Decoration | undefined): TLArrowShapeArrowheadStyle {\n\treturn decoration === TLV1Decoration.Arrow ? 'arrow' : 'none'\n}\n\nfunction getV2Fill(isFilled: boolean | undefined, color: TLV1ColorStyle) {\n\treturn isFilled\n\t\t? color === TLV1ColorStyle.Black || color === TLV1ColorStyle.White\n\t\t\t? 'semi'\n\t\t\t: 'solid'\n\t\t: 'none'\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EACC;AAAA,EAEA;AAAA,EAmBA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,wBAAwB;AAEjC,MAAM,oBAAoB;AAGnB,SAAS,oBAAoB,QAAgB,WAAoB;AACvE,MAAI,WAAW;AACf,S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,OAAQ,yBAAyB,IAAI,KAAK,MAAO;AACzD;AAEA,SAAS,UAAU,MAAqD;AACvE,SAAO,OAAQ,iBAAiB,IAAI,KAAK,MAAO;AACjD;AAEA,SAAS,UAAU,MAAqD;AACvE,SAAO,OAAQ,mBAAmB,IAAI,KAAK,SAAU;AACtD;AAEA,SAAS,WAAW,OAA2B;AAC9C,SAAO;AAAA,IACN,GAAG,aAAa,MAAM,CAAC,CAAC;AAAA,IACxB,GAAG,aAAa,MAAM,CAAC,CAAC;AAAA,IACxB,GAAG,MAAM,CAAC,KAAK,OAAO,MAAM,aAAa,MAAM,CAAC,CAAC;AAAA,EAClD;AACD;AAEA,SAAS,eAAe,YAAoE;AAC3F,SAAO,eAAe,sBAAuB,UAAU;AACxD;AAEA,SAAS,UAAU,UAA+B,OAAuB;AACxE,SAAO,WACJ,UAAU,uBAAwB,UAAU,sBAC3C,SACA,UACD;AACJ;",
|
|
4
|
+
"sourcesContent": ["import {\n\tAssetRecordType,\n\tEditor,\n\tPageRecordType,\n\tTLArrowShape,\n\tTLArrowShapeArrowheadStyle,\n\tTLAsset,\n\tTLAssetId,\n\tTLDefaultColorStyle,\n\tTLDefaultDashStyle,\n\tTLDefaultFontStyle,\n\tTLDefaultHorizontalAlignStyle,\n\tTLDefaultSizeStyle,\n\tTLDefaultTextAlignStyle,\n\tTLDrawShape,\n\tTLGeoShape,\n\tTLImageShape,\n\tTLNoteShape,\n\tTLPageId,\n\tTLShapeId,\n\tTLTextShape,\n\tTLVideoShape,\n\tVec,\n\tVecModel,\n\tclamp,\n\tcreateShapeId,\n\tfetch,\n\tstructuredClone,\n\ttoRichText,\n} from '@tldraw/editor'\nimport { getArrowBindings } from '../../shapes/arrow/shared'\n\nconst TLDRAW_V1_VERSION = 15.5\n\n/** @internal */\nexport function buildFromV1Document(editor: Editor, _document: unknown) {\n\tlet document = _document as TLV1Document\n\teditor.run(() => {\n\t\tdocument = migrate(document, TLDRAW_V1_VERSION)\n\t\t// Cancel any interactions / states\n\t\teditor.cancel().cancel().cancel().cancel()\n\n\t\tconst firstPageId = editor.getPages()[0].id\n\n\t\t// Set the current page to the first page\n\t\teditor.setCurrentPage(firstPageId)\n\n\t\t// Delete all pages except first page\n\t\tfor (const page of editor.getPages().slice(1)) {\n\t\t\teditor.deletePage(page.id)\n\t\t}\n\n\t\t// Delete all of the shapes on the current page\n\t\teditor.selectAll()\n\t\teditor.deleteShapes(editor.getSelectedShapeIds())\n\n\t\t// Create assets\n\t\tconst v1AssetIdsToV2AssetIds = new Map<string, TLAssetId>()\n\n\t\tObject.values(document.assets ?? {}).forEach((v1Asset) => {\n\t\t\tswitch (v1Asset.type) {\n\t\t\t\tcase TLV1AssetType.Image: {\n\t\t\t\t\tconst assetId: TLAssetId = AssetRecordType.createId()\n\t\t\t\t\tv1AssetIdsToV2AssetIds.set(v1Asset.id, assetId)\n\t\t\t\t\tconst placeholderAsset: TLAsset = {\n\t\t\t\t\t\tid: assetId,\n\t\t\t\t\t\ttypeName: 'asset',\n\t\t\t\t\t\ttype: 'image',\n\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\tw: coerceDimension(v1Asset.size[0]),\n\t\t\t\t\t\t\th: coerceDimension(v1Asset.size[1]),\n\t\t\t\t\t\t\tname: v1Asset.fileName ?? 'Untitled',\n\t\t\t\t\t\t\tisAnimated: false,\n\t\t\t\t\t\t\tmimeType: null,\n\t\t\t\t\t\t\tsrc: v1Asset.src,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmeta: {},\n\t\t\t\t\t}\n\t\t\t\t\teditor.createAssets([placeholderAsset])\n\t\t\t\t\ttryMigrateAsset(editor, placeholderAsset)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase TLV1AssetType.Video:\n\t\t\t\t\t{\n\t\t\t\t\t\tconst assetId: TLAssetId = AssetRecordType.createId()\n\t\t\t\t\t\tv1AssetIdsToV2AssetIds.set(v1Asset.id, assetId)\n\t\t\t\t\t\teditor.createAssets([\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tid: assetId,\n\t\t\t\t\t\t\t\ttypeName: 'asset',\n\t\t\t\t\t\t\t\ttype: 'video',\n\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Asset.size[0]),\n\t\t\t\t\t\t\t\t\th: coerceDimension(v1Asset.size[1]),\n\t\t\t\t\t\t\t\t\tname: v1Asset.fileName ?? 'Untitled',\n\t\t\t\t\t\t\t\t\tisAnimated: true,\n\t\t\t\t\t\t\t\t\tmimeType: null,\n\t\t\t\t\t\t\t\t\tsrc: v1Asset.src,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tmeta: {},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t])\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t})\n\n\t\t// Create pages\n\n\t\tconst v1PageIdsToV2PageIds = new Map<string, TLPageId>()\n\n\t\tObject.values(document.pages ?? {})\n\t\t\t.sort((a, b) => ((a.childIndex ?? 1) < (b.childIndex ?? 1) ? -1 : 1))\n\t\t\t.forEach((v1Page, i) => {\n\t\t\t\tif (i === 0) {\n\t\t\t\t\tv1PageIdsToV2PageIds.set(v1Page.id, editor.getCurrentPageId())\n\t\t\t\t} else {\n\t\t\t\t\tconst pageId = PageRecordType.createId()\n\t\t\t\t\tv1PageIdsToV2PageIds.set(v1Page.id, pageId)\n\t\t\t\t\teditor.createPage({ name: v1Page.name ?? 'Page', id: pageId })\n\t\t\t\t}\n\t\t\t})\n\n\t\tObject.values(document.pages ?? {})\n\t\t\t.sort((a, b) => ((a.childIndex ?? 1) < (b.childIndex ?? 1) ? -1 : 1))\n\t\t\t.forEach((v1Page) => {\n\t\t\t\t// Set the current page id to the current page\n\t\t\t\teditor.setCurrentPage(v1PageIdsToV2PageIds.get(v1Page.id)!)\n\n\t\t\t\tconst v1ShapeIdsToV2ShapeIds = new Map<string, TLShapeId>()\n\t\t\t\tconst v1GroupShapeIdsToV1ChildIds = new Map<string, string[]>()\n\n\t\t\t\tconst v1Shapes = Object.values(v1Page.shapes ?? {})\n\t\t\t\t\t.sort((a, b) => (a.childIndex < b.childIndex ? -1 : 1))\n\t\t\t\t\t.slice(0, editor.options.maxShapesPerPage)\n\n\t\t\t\t// Groups only\n\t\t\t\tv1Shapes.forEach((v1Shape) => {\n\t\t\t\t\tif (v1Shape.type !== TLV1ShapeType.Group) return\n\n\t\t\t\t\tconst shapeId = createShapeId()\n\t\t\t\t\tv1ShapeIdsToV2ShapeIds.set(v1Shape.id, shapeId)\n\t\t\t\t\tv1GroupShapeIdsToV1ChildIds.set(v1Shape.id, [])\n\t\t\t\t})\n\n\t\t\t\tfunction decideNotToCreateShape(v1Shape: TLV1Shape) {\n\t\t\t\t\tv1ShapeIdsToV2ShapeIds.delete(v1Shape.id)\n\t\t\t\t\tconst v1GroupParent = v1GroupShapeIdsToV1ChildIds.has(v1Shape.parentId)\n\t\t\t\t\tif (v1GroupParent) {\n\t\t\t\t\t\tconst ids = v1GroupShapeIdsToV1ChildIds\n\t\t\t\t\t\t\t.get(v1Shape.parentId)!\n\t\t\t\t\t\t\t.filter((id) => id !== v1Shape.id)\n\t\t\t\t\t\tv1GroupShapeIdsToV1ChildIds.set(v1Shape.parentId, ids)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Non-groups only\n\t\t\t\tv1Shapes.forEach((v1Shape) => {\n\t\t\t\t\t// Skip groups for now, we'll create groups via the app's API\n\t\t\t\t\tif (v1Shape.type === TLV1ShapeType.Group) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tconst shapeId = createShapeId()\n\t\t\t\t\tv1ShapeIdsToV2ShapeIds.set(v1Shape.id, shapeId)\n\n\t\t\t\t\tif (v1Shape.parentId !== v1Page.id) {\n\t\t\t\t\t\t// If the parent is a group, then add the shape to the group's children\n\t\t\t\t\t\tif (v1GroupShapeIdsToV1ChildIds.has(v1Shape.parentId)) {\n\t\t\t\t\t\t\tv1GroupShapeIdsToV1ChildIds.get(v1Shape.parentId)!.push(v1Shape.id)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconsole.warn('parent does not exist', v1Shape)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// First, try to find the shape's parent among the existing groups\n\t\t\t\t\tconst parentId = v1PageIdsToV2PageIds.get(v1Page.id)!\n\n\t\t\t\t\tconst inCommon = {\n\t\t\t\t\t\tid: shapeId,\n\t\t\t\t\t\tparentId,\n\t\t\t\t\t\tx: coerceNumber(v1Shape.point[0]),\n\t\t\t\t\t\ty: coerceNumber(v1Shape.point[1]),\n\t\t\t\t\t\trotation: 0,\n\t\t\t\t\t\tisLocked: !!v1Shape.isLocked,\n\t\t\t\t\t}\n\n\t\t\t\t\tswitch (v1Shape.type) {\n\t\t\t\t\t\tcase TLV1ShapeType.Sticky: {\n\t\t\t\t\t\t\teditor.createShapes<TLNoteShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'note',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.text ?? ''),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\talign: getV2Align(v1Shape.style.textAlign),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Rectangle: {\n\t\t\t\t\t\t\teditor.createShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tgeo: 'rectangle',\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.size[0]),\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.size[1]),\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.label ?? ''),\n\t\t\t\t\t\t\t\t\t\tfill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tlabelColor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\talign: 'middle',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tconst pageBoundsBeforeLabel = editor.getShapePageBounds(inCommon.id)!\n\n\t\t\t\t\t\t\teditor.updateShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.label ?? ''),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tif (pageBoundsBeforeLabel.width === pageBoundsBeforeLabel.height) {\n\t\t\t\t\t\t\t\tconst shape = editor.getShape<TLGeoShape>(inCommon.id)!\n\t\t\t\t\t\t\t\tconst { growY } = shape.props\n\t\t\t\t\t\t\t\tconst w = coerceDimension(shape.props.w)\n\t\t\t\t\t\t\t\tconst h = coerceDimension(shape.props.h)\n\t\t\t\t\t\t\t\tconst newW = w + growY / 2\n\t\t\t\t\t\t\t\tconst newH = h + growY / 2\n\n\t\t\t\t\t\t\t\teditor.updateShapes([\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\t\tx: coerceNumber(shape.x) - (newW - w) / 2,\n\t\t\t\t\t\t\t\t\t\ty: coerceNumber(shape.y) - (newH - h) / 2,\n\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\tw: newW,\n\t\t\t\t\t\t\t\t\t\t\th: newH,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Triangle: {\n\t\t\t\t\t\t\teditor.createShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tgeo: 'triangle',\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.size[0]),\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.size[1]),\n\t\t\t\t\t\t\t\t\t\tfill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tlabelColor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\talign: 'middle',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tconst pageBoundsBeforeLabel = editor.getShapePageBounds(inCommon.id)!\n\n\t\t\t\t\t\t\teditor.updateShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.label ?? ''),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tif (pageBoundsBeforeLabel.width === pageBoundsBeforeLabel.height) {\n\t\t\t\t\t\t\t\tconst shape = editor.getShape<TLGeoShape>(inCommon.id)!\n\t\t\t\t\t\t\t\tconst { growY } = shape.props\n\t\t\t\t\t\t\t\tconst w = coerceDimension(shape.props.w)\n\t\t\t\t\t\t\t\tconst h = coerceDimension(shape.props.h)\n\t\t\t\t\t\t\t\tconst newW = w + growY / 2\n\t\t\t\t\t\t\t\tconst newH = h + growY / 2\n\n\t\t\t\t\t\t\t\teditor.updateShapes([\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\t\tx: coerceNumber(shape.x) - (newW - w) / 2,\n\t\t\t\t\t\t\t\t\t\ty: coerceNumber(shape.y) - (newH - h) / 2,\n\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\tw: newW,\n\t\t\t\t\t\t\t\t\t\t\th: newH,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Ellipse: {\n\t\t\t\t\t\t\teditor.createShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tgeo: 'ellipse',\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.radius[0]) * 2,\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.radius[1]) * 2,\n\t\t\t\t\t\t\t\t\t\tfill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tlabelColor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\talign: 'middle',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tconst pageBoundsBeforeLabel = editor.getShapePageBounds(inCommon.id)!\n\n\t\t\t\t\t\t\teditor.updateShapes<TLGeoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.label ?? ''),\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tif (pageBoundsBeforeLabel.width === pageBoundsBeforeLabel.height) {\n\t\t\t\t\t\t\t\tconst shape = editor.getShape<TLGeoShape>(inCommon.id)!\n\t\t\t\t\t\t\t\tconst { growY } = shape.props\n\t\t\t\t\t\t\t\tconst w = coerceDimension(shape.props.w)\n\t\t\t\t\t\t\t\tconst h = coerceDimension(shape.props.h)\n\t\t\t\t\t\t\t\tconst newW = w + growY / 2\n\t\t\t\t\t\t\t\tconst newH = h + growY / 2\n\n\t\t\t\t\t\t\t\teditor.updateShapes([\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tid: inCommon.id,\n\t\t\t\t\t\t\t\t\t\ttype: 'geo',\n\t\t\t\t\t\t\t\t\t\tx: coerceNumber(shape.x) - (newW - w) / 2,\n\t\t\t\t\t\t\t\t\t\ty: coerceNumber(shape.y) - (newH - h) / 2,\n\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\tw: newW,\n\t\t\t\t\t\t\t\t\t\t\th: newH,\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Draw: {\n\t\t\t\t\t\t\tif (v1Shape.points.length === 0) {\n\t\t\t\t\t\t\t\tdecideNotToCreateShape(v1Shape)\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\teditor.createShapes<TLDrawShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'draw',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tfill: getV2Fill(v1Shape.style.isFilled, v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\tisPen: false,\n\t\t\t\t\t\t\t\t\t\tisComplete: v1Shape.isComplete,\n\t\t\t\t\t\t\t\t\t\tsegments: [{ type: 'free', points: v1Shape.points.map(getV2Point) }],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Arrow: {\n\t\t\t\t\t\t\tconst v1Bend = coerceNumber(v1Shape.bend)\n\t\t\t\t\t\t\tconst v1Start = getV2Point(v1Shape.handles.start.point)\n\t\t\t\t\t\t\tconst v1End = getV2Point(v1Shape.handles.end.point)\n\t\t\t\t\t\t\tconst dist = Vec.Dist(v1Start, v1End)\n\t\t\t\t\t\t\tconst v2Bend = (dist * -v1Bend) / 2\n\n\t\t\t\t\t\t\t// Could also be a line... but we'll use it as an arrow anyway\n\t\t\t\t\t\t\teditor.createShapes<TLArrowShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'arrow',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\ttext: v1Shape.label ?? '',\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tlabelColor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2Size(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\tdash: getV2Dash(v1Shape.style.dash),\n\t\t\t\t\t\t\t\t\t\tarrowheadStart: getV2Arrowhead(v1Shape.decorations?.start),\n\t\t\t\t\t\t\t\t\t\tarrowheadEnd: getV2Arrowhead(v1Shape.decorations?.end),\n\t\t\t\t\t\t\t\t\t\tstart: {\n\t\t\t\t\t\t\t\t\t\t\tx: coerceNumber(v1Shape.handles.start.point[0]),\n\t\t\t\t\t\t\t\t\t\t\ty: coerceNumber(v1Shape.handles.start.point[1]),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tend: {\n\t\t\t\t\t\t\t\t\t\t\tx: coerceNumber(v1Shape.handles.end.point[0]),\n\t\t\t\t\t\t\t\t\t\t\ty: coerceNumber(v1Shape.handles.end.point[1]),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tbend: v2Bend,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Text: {\n\t\t\t\t\t\t\teditor.createShapes<TLTextShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\trichText: toRichText(v1Shape.text ?? ' '),\n\t\t\t\t\t\t\t\t\t\tcolor: getV2Color(v1Shape.style.color),\n\t\t\t\t\t\t\t\t\t\tsize: getV2TextSize(v1Shape.style.size),\n\t\t\t\t\t\t\t\t\t\tfont: getV2Font(v1Shape.style.font),\n\t\t\t\t\t\t\t\t\t\ttextAlign: getV2TextAlign(v1Shape.style.textAlign),\n\t\t\t\t\t\t\t\t\t\tscale: v1Shape.style.scale ?? 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Image: {\n\t\t\t\t\t\t\tconst assetId = v1AssetIdsToV2AssetIds.get(v1Shape.assetId)\n\n\t\t\t\t\t\t\tif (!assetId) {\n\t\t\t\t\t\t\t\tconsole.warn('Could not find asset id', v1Shape.assetId)\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\teditor.createShapes<TLImageShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'image',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.size[0]),\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.size[1]),\n\t\t\t\t\t\t\t\t\t\tassetId,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase TLV1ShapeType.Video: {\n\t\t\t\t\t\t\tconst assetId = v1AssetIdsToV2AssetIds.get(v1Shape.assetId)\n\n\t\t\t\t\t\t\tif (!assetId) {\n\t\t\t\t\t\t\t\tconsole.warn('Could not find asset id', v1Shape.assetId)\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\teditor.createShapes<TLVideoShape>([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t...inCommon,\n\t\t\t\t\t\t\t\t\ttype: 'video',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tw: coerceDimension(v1Shape.size[0]),\n\t\t\t\t\t\t\t\t\t\th: coerceDimension(v1Shape.size[1]),\n\t\t\t\t\t\t\t\t\t\tassetId,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst rotation = coerceNumber(v1Shape.rotation)\n\n\t\t\t\t\tif (rotation !== 0) {\n\t\t\t\t\t\teditor.select(shapeId)\n\t\t\t\t\t\teditor.rotateShapesBy([shapeId], rotation)\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\t// Create groups\n\t\t\t\tv1GroupShapeIdsToV1ChildIds.forEach((v1ChildIds, v1GroupId) => {\n\t\t\t\t\tconst v2ChildShapeIds = v1ChildIds.map((id) => v1ShapeIdsToV2ShapeIds.get(id)!)\n\t\t\t\t\tconst v2GroupId = v1ShapeIdsToV2ShapeIds.get(v1GroupId)!\n\t\t\t\t\teditor.groupShapes(v2ChildShapeIds, { groupId: v2GroupId })\n\n\t\t\t\t\tconst v1Group = v1Page.shapes[v1GroupId]\n\t\t\t\t\tconst rotation = coerceNumber(v1Group.rotation)\n\n\t\t\t\t\tif (rotation !== 0) {\n\t\t\t\t\t\teditor.select(v2GroupId)\n\t\t\t\t\t\teditor.rotateShapesBy([v2GroupId], rotation)\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\t// Bind arrows to shapes\n\n\t\t\t\tv1Shapes.forEach((v1Shape) => {\n\t\t\t\t\tif (v1Shape.type !== TLV1ShapeType.Arrow) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tconst v2ShapeId = v1ShapeIdsToV2ShapeIds.get(v1Shape.id)!\n\t\t\t\t\tconst util = editor.getShapeUtil<TLArrowShape>('arrow')\n\n\t\t\t\t\t// dumb but necessary\n\t\t\t\t\teditor.inputs.ctrlKey = false\n\n\t\t\t\t\tfor (const handleId of ['start', 'end'] as const) {\n\t\t\t\t\t\tconst bindingId = v1Shape.handles[handleId].bindingId\n\t\t\t\t\t\tif (bindingId) {\n\t\t\t\t\t\t\tconst binding = v1Page.bindings[bindingId]\n\t\t\t\t\t\t\tif (!binding) {\n\t\t\t\t\t\t\t\t// arrow has a reference to a binding that no longer exists\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst targetId = v1ShapeIdsToV2ShapeIds.get(binding.toId)!\n\n\t\t\t\t\t\t\tconst targetShape = editor.getShape(targetId)!\n\n\t\t\t\t\t\t\t// (unexpected) We didn't create the target shape\n\t\t\t\t\t\t\tif (!targetShape) continue\n\n\t\t\t\t\t\t\tif (targetId) {\n\t\t\t\t\t\t\t\tconst bounds = editor.getShapePageBounds(targetId)!\n\n\t\t\t\t\t\t\t\tconst v2ShapeFresh = editor.getShape<TLArrowShape>(v2ShapeId)!\n\n\t\t\t\t\t\t\t\tconst nx = clamp((coerceNumber(binding.point[0]) + 0.5) / 2, 0.2, 0.8)\n\t\t\t\t\t\t\t\tconst ny = clamp((coerceNumber(binding.point[1]) + 0.5) / 2, 0.2, 0.8)\n\n\t\t\t\t\t\t\t\tconst point = editor.getPointInShapeSpace(v2ShapeFresh, {\n\t\t\t\t\t\t\t\t\tx: bounds.minX + bounds.width * nx,\n\t\t\t\t\t\t\t\t\ty: bounds.minY + bounds.height * ny,\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\tconst handles = editor.getShapeHandles(v2ShapeFresh)!\n\t\t\t\t\t\t\t\tconst change = util.onHandleDrag!(v2ShapeFresh, {\n\t\t\t\t\t\t\t\t\thandle: {\n\t\t\t\t\t\t\t\t\t\t...handles.find((h) => h.id === handleId)!,\n\t\t\t\t\t\t\t\t\t\tx: point.x,\n\t\t\t\t\t\t\t\t\t\ty: point.y,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\tisPrecise: point.x !== 0.5 || point.y !== 0.5,\n\t\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\t\tif (change) {\n\t\t\t\t\t\t\t\t\teditor.updateShape(change)\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst freshBinding = getArrowBindings(\n\t\t\t\t\t\t\t\t\teditor,\n\t\t\t\t\t\t\t\t\teditor.getShape<TLArrowShape>(v2ShapeId)!\n\t\t\t\t\t\t\t\t)[handleId]\n\t\t\t\t\t\t\t\tif (freshBinding) {\n\t\t\t\t\t\t\t\t\tconst updatedFreshBinding = structuredClone(freshBinding)\n\t\t\t\t\t\t\t\t\tif (binding.distance === 0) {\n\t\t\t\t\t\t\t\t\t\tupdatedFreshBinding.props.isExact = true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (updatedFreshBinding.toId !== targetId) {\n\t\t\t\t\t\t\t\t\t\tupdatedFreshBinding.toId = targetId\n\t\t\t\t\t\t\t\t\t\tupdatedFreshBinding.props.normalizedAnchor = { x: nx, y: ny }\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\teditor.updateBinding(updatedFreshBinding)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\n\t\t// Set the current page to the first page again\n\t\teditor.setCurrentPage(firstPageId)\n\n\t\teditor.clearHistory()\n\t\teditor.selectNone()\n\n\t\tconst bounds = editor.getCurrentPageBounds()\n\t\tif (bounds) {\n\t\t\teditor.zoomToBounds(bounds, { targetZoom: 1 })\n\t\t}\n\t})\n}\n\nfunction coerceNumber(n: unknown): number {\n\tif (typeof n !== 'number') return 0\n\tif (Number.isNaN(n)) return 0\n\tif (!Number.isFinite(n)) return 0\n\treturn n\n}\n\nfunction coerceDimension(d: unknown): number {\n\tconst n = coerceNumber(d)\n\tif (n <= 0) return 1\n\treturn n\n}\n\n/**\n * We want to move assets over to our new S3 bucket & extract any relevant metadata. That process is\n * async though, where the rest of our migration is synchronous.\n *\n * We'll write placeholder assets to the app using the old asset URLs, then kick off a process async\n * to try and download the real assets, extract the metadata, and upload them to our new bucket.\n * It's not a big deal if this fails though.\n */\nasync function tryMigrateAsset(editor: Editor, placeholderAsset: TLAsset) {\n\ttry {\n\t\tif (placeholderAsset.type === 'bookmark' || !placeholderAsset.props.src) return\n\n\t\tconst response = await fetch(placeholderAsset.props.src)\n\t\tif (!response.ok) return\n\n\t\tconst file = new File([await response.blob()], placeholderAsset.props.name, {\n\t\t\ttype: response.headers.get('content-type') ?? placeholderAsset.props.mimeType ?? undefined,\n\t\t})\n\n\t\tconst newAsset = await editor.getAssetForExternalContent({ type: 'file', file })\n\t\tif (!newAsset) throw new Error('Could not get asset for external content')\n\t\tif (newAsset.type === 'bookmark') return\n\n\t\teditor.updateAssets([\n\t\t\t{\n\t\t\t\tid: placeholderAsset.id,\n\t\t\t\ttype: placeholderAsset.type,\n\t\t\t\tprops: {\n\t\t\t\t\t...newAsset.props,\n\t\t\t\t\tname: placeholderAsset.props.name,\n\t\t\t\t},\n\t\t\t},\n\t\t])\n\t} catch {\n\t\t// not a big deal, we'll just keep the placeholder asset\n\t}\n}\n\nfunction migrate(document: TLV1Document, newVersion: number): TLV1Document {\n\tconst { version = 0 } = document\n\n\tif (!document.assets) {\n\t\tdocument.assets = {}\n\t}\n\n\t// Remove unused assets when loading a document\n\tconst assetIdsInUse = new Set<string>()\n\n\tObject.values(document.pages).forEach((page) =>\n\t\tObject.values(page.shapes).forEach((shape) => {\n\t\t\tconst { parentId, children, assetId } = shape\n\n\t\t\tif (assetId) {\n\t\t\t\tassetIdsInUse.add(assetId)\n\t\t\t}\n\n\t\t\t// Fix missing parent bug\n\t\t\tif (parentId !== page.id && !page.shapes[parentId]) {\n\t\t\t\tconsole.warn('Encountered a shape with a missing parent!')\n\t\t\t\tshape.parentId = page.id\n\t\t\t}\n\n\t\t\tif (shape.type === TLV1ShapeType.Group && children) {\n\t\t\t\tchildren.forEach((childId) => {\n\t\t\t\t\tif (!page.shapes[childId]) {\n\t\t\t\t\t\tconsole.warn('Encountered a parent with a missing child!', shape.id, childId)\n\t\t\t\t\t\tchildren?.splice(children.indexOf(childId), 1)\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\t// TODO: Remove the shape if it has no children\n\t\t\t}\n\t\t})\n\t)\n\n\tObject.keys(document.assets).forEach((assetId) => {\n\t\tif (!assetIdsInUse.has(assetId)) {\n\t\t\tdelete document.assets[assetId]\n\t\t}\n\t})\n\n\tif (version !== newVersion) {\n\t\tif (version < 14) {\n\t\t\tObject.values(document.pages).forEach((page) => {\n\t\t\t\tObject.values(page.shapes)\n\t\t\t\t\t.filter((shape) => shape.type === TLV1ShapeType.Text)\n\t\t\t\t\t.forEach((shape) => {\n\t\t\t\t\t\tif ((shape as TLV1TextShape).style.font === undefined) {\n\t\t\t\t\t\t\t;(shape as TLV1TextShape).style.font = TLV1FontStyle.Script\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t})\n\t\t}\n\n\t\t// Lowercase styles, move binding meta to binding\n\t\tif (version <= 13) {\n\t\t\tObject.values(document.pages).forEach((page) => {\n\t\t\t\tObject.values(page.bindings).forEach((binding) => {\n\t\t\t\t\tObject.assign(binding, (binding as any).meta)\n\t\t\t\t})\n\n\t\t\t\tObject.values(page.shapes).forEach((shape) => {\n\t\t\t\t\tObject.entries(shape.style).forEach(([id, style]) => {\n\t\t\t\t\t\tif (typeof style === 'string') {\n\t\t\t\t\t\t\t// @ts-ignore\n\t\t\t\t\t\t\tshape.style[id] = style.toLowerCase()\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\n\t\t\t\t\tif (shape.type === TLV1ShapeType.Arrow) {\n\t\t\t\t\t\tif (shape.decorations) {\n\t\t\t\t\t\t\tObject.entries(shape.decorations).forEach(([id, decoration]) => {\n\t\t\t\t\t\t\t\tif ((decoration as unknown) === 'Arrow') {\n\t\t\t\t\t\t\t\t\tshape.decorations = {\n\t\t\t\t\t\t\t\t\t\t...shape.decorations,\n\t\t\t\t\t\t\t\t\t\t[id]: TLV1Decoration.Arrow,\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t\t}\n\n\t\t// Add document name and file system handle\n\t\tif (version <= 13.1 && document.name == null) {\n\t\t\tdocument.name = 'New Document'\n\t\t}\n\n\t\tif (version < 15 && document.assets == null) {\n\t\t\tdocument.assets = {}\n\t\t}\n\n\t\tObject.values(document.pages).forEach((page) => {\n\t\t\tObject.values(page.shapes).forEach((shape) => {\n\t\t\t\tif (version < 15.2) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t(shape.type === TLV1ShapeType.Image || shape.type === TLV1ShapeType.Video) &&\n\t\t\t\t\t\tshape.style.isFilled == null\n\t\t\t\t\t) {\n\t\t\t\t\t\tshape.style.isFilled = true\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (version < 15.3) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tshape.type === TLV1ShapeType.Rectangle ||\n\t\t\t\t\t\tshape.type === TLV1ShapeType.Triangle ||\n\t\t\t\t\t\tshape.type === TLV1ShapeType.Ellipse ||\n\t\t\t\t\t\tshape.type === TLV1ShapeType.Arrow\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ('text' in shape && typeof shape.text === 'string') {\n\t\t\t\t\t\t\tshape.label = shape.text\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!shape.label) {\n\t\t\t\t\t\t\tshape.label = ''\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!shape.labelPoint) {\n\t\t\t\t\t\t\tshape.labelPoint = [0.5, 0.5]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t}\n\n\t// Cleanup\n\tObject.values(document.pageStates).forEach((pageState) => {\n\t\tpageState.selectedIds = pageState.selectedIds.filter((id) => {\n\t\t\treturn document.pages[pageState.id].shapes[id] !== undefined\n\t\t})\n\t\tpageState.bindingId = undefined\n\t\tpageState.editingId = undefined\n\t\tpageState.hoveredId = undefined\n\t\tpageState.pointedId = undefined\n\t})\n\n\tdocument.version = newVersion\n\n\treturn document\n}\n\n/* -------------------- TLV1 Types -------------------- */\n\n/** @internal */\nexport interface TLV1Handle {\n\tid: string\n\tindex: number\n\tpoint: number[]\n\tcanBind?: boolean\n\tbindingId?: string\n}\n\n/** @internal */\nexport interface TLV1BaseBinding {\n\tid: string\n\ttoId: string\n\tfromId: string\n}\n\n/** @internal */\nexport enum TLV1ShapeType {\n\tSticky = 'sticky',\n\tEllipse = 'ellipse',\n\tRectangle = 'rectangle',\n\tTriangle = 'triangle',\n\tDraw = 'draw',\n\tArrow = 'arrow',\n\tText = 'text',\n\tGroup = 'group',\n\tImage = 'image',\n\tVideo = 'video',\n}\n\n/** @internal */\nexport enum TLV1ColorStyle {\n\tWhite = 'white',\n\tLightGray = 'lightGray',\n\tGray = 'gray',\n\tBlack = 'black',\n\tGreen = 'green',\n\tCyan = 'cyan',\n\tBlue = 'blue',\n\tIndigo = 'indigo',\n\tViolet = 'violet',\n\tRed = 'red',\n\tOrange = 'orange',\n\tYellow = 'yellow',\n}\n\n/** @internal */\nexport enum TLV1SizeStyle {\n\tSmall = 'small',\n\tMedium = 'medium',\n\tLarge = 'large',\n}\n\n/** @internal */\nexport enum TLV1DashStyle {\n\tDraw = 'draw',\n\tSolid = 'solid',\n\tDashed = 'dashed',\n\tDotted = 'dotted',\n}\n\n/** @internal */\nexport enum TLV1AlignStyle {\n\tStart = 'start',\n\tMiddle = 'middle',\n\tEnd = 'end',\n\tJustify = 'justify',\n}\n\n/** @internal */\nexport enum TLV1FontStyle {\n\tScript = 'script',\n\tSans = 'sans',\n\tSerif = 'serif',\n\tMono = 'mono',\n}\n\n/** @internal */\nexport interface TLV1ShapeStyles {\n\tcolor: TLV1ColorStyle\n\tsize: TLV1SizeStyle\n\tdash: TLV1DashStyle\n\tfont?: TLV1FontStyle\n\ttextAlign?: TLV1AlignStyle\n\tisFilled?: boolean\n\tscale?: number\n}\n\n/** @internal */\nexport interface TLV1BaseShape {\n\tid: string\n\tparentId: string\n\tchildIndex: number\n\tname: string\n\tpoint: number[]\n\tassetId?: string\n\trotation?: number\n\tchildren?: string[]\n\tisGhost?: boolean\n\tisHidden?: boolean\n\tisLocked?: boolean\n\tisGenerated?: boolean\n\tisAspectRatioLocked?: boolean\n\tstyle: TLV1ShapeStyles\n\ttype: TLV1ShapeType\n\tlabel?: string\n\thandles?: Record<string, TLV1Handle>\n}\n\n/** @internal */\nexport interface TLV1DrawShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Draw\n\tpoints: number[][]\n\tisComplete: boolean\n}\n\n/** @internal */\nexport interface TLV1RectangleShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Rectangle\n\tsize: number[]\n\tlabel?: string\n\tlabelPoint?: number[]\n}\n\n/** @internal */\nexport interface TLV1EllipseShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Ellipse\n\tradius: number[]\n\tlabel?: string\n\tlabelPoint?: number[]\n}\n\n/** @internal */\nexport interface TLV1TriangleShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Triangle\n\tsize: number[]\n\tlabel?: string\n\tlabelPoint?: number[]\n}\n\n/** @internal */\nexport enum TLV1Decoration {\n\tArrow = 'arrow',\n}\n\n// The shape created with the arrow tool\n/** @internal */\nexport interface TLV1ArrowShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Arrow\n\tbend: number\n\thandles: {\n\t\tstart: TLV1Handle\n\t\tbend: TLV1Handle\n\t\tend: TLV1Handle\n\t}\n\tdecorations?: {\n\t\tstart?: TLV1Decoration\n\t\tend?: TLV1Decoration\n\t\tmiddle?: TLV1Decoration\n\t}\n\tlabel?: string\n\tlabelPoint?: number[]\n}\n\n/** @internal */\nexport interface TLV1ArrowBinding extends TLV1BaseBinding {\n\thandleId: keyof TLV1ArrowShape['handles']\n\tdistance: number\n\tpoint: number[]\n}\n\n/** @internal */\nexport type TLV1Binding = TLV1ArrowBinding\n\n/** @internal */\nexport interface TLV1ImageShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Image\n\tsize: number[]\n\tassetId: string\n}\n\n/** @internal */\nexport interface TLV1VideoShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Video\n\tsize: number[]\n\tassetId: string\n\tisPlaying: boolean\n\tcurrentTime: number\n}\n\n// The shape created by the text tool\n/** @internal */\nexport interface TLV1TextShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Text\n\ttext: string\n}\n\n// The shape created by the sticky tool\n/** @internal */\nexport interface TLV1StickyShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Sticky\n\tsize: number[]\n\ttext: string\n}\n\n// The shape created when multiple shapes are grouped\n/** @internal */\nexport interface TLV1GroupShape extends TLV1BaseShape {\n\ttype: TLV1ShapeType.Group\n\tsize: number[]\n\tchildren: string[]\n}\n\n/** @internal */\nexport type TLV1Shape =\n\t| TLV1RectangleShape\n\t| TLV1EllipseShape\n\t| TLV1TriangleShape\n\t| TLV1DrawShape\n\t| TLV1ArrowShape\n\t| TLV1TextShape\n\t| TLV1GroupShape\n\t| TLV1StickyShape\n\t| TLV1ImageShape\n\t| TLV1VideoShape\n\n/** @internal */\nexport interface TLV1Page {\n\tid: string\n\tname?: string\n\tchildIndex?: number\n\tshapes: Record<string, TLV1Shape>\n\tbindings: Record<string, TLV1Binding>\n}\n\n/** @internal */\nexport interface TLV1Bounds {\n\tminX: number\n\tminY: number\n\tmaxX: number\n\tmaxY: number\n\twidth: number\n\theight: number\n\trotation?: number\n}\n\n/** @internal */\nexport interface TLV1PageState {\n\tid: string\n\tselectedIds: string[]\n\tcamera: {\n\t\tpoint: number[]\n\t\tzoom: number\n\t}\n\tbrush?: TLV1Bounds | null\n\tpointedId?: string | null\n\thoveredId?: string | null\n\teditingId?: string | null\n\tbindingId?: string | null\n}\n\n/** @internal */\nexport enum TLV1AssetType {\n\tImage = 'image',\n\tVideo = 'video',\n}\n\n/** @internal */\nexport interface TLV1ImageAsset extends TLV1BaseAsset {\n\ttype: TLV1AssetType.Image\n\tfileName: string\n\tsrc: string\n\tsize: number[]\n}\n\n/** @internal */\nexport interface TLV1VideoAsset extends TLV1BaseAsset {\n\ttype: TLV1AssetType.Video\n\tfileName: string\n\tsrc: string\n\tsize: number[]\n}\n\n/** @internal */\nexport interface TLV1BaseAsset {\n\tid: string\n\ttype: string\n}\n\n/** @internal */\nexport type TLV1Asset = TLV1ImageAsset | TLV1VideoAsset\n\n/** @internal */\nexport interface TLV1Document {\n\tid: string\n\tname: string\n\tversion: number\n\tpages: Record<string, TLV1Page>\n\tpageStates: Record<string, TLV1PageState>\n\tassets: Record<string, TLV1Asset>\n}\n\n/* ------------------ Translations ------------------ */\n\nconst v1ColorsToV2Colors: Record<TLV1ColorStyle, TLDefaultColorStyle> = {\n\t[TLV1ColorStyle.White]: 'black',\n\t[TLV1ColorStyle.Black]: 'black',\n\t[TLV1ColorStyle.LightGray]: 'grey',\n\t[TLV1ColorStyle.Gray]: 'grey',\n\t[TLV1ColorStyle.Green]: 'light-green',\n\t[TLV1ColorStyle.Cyan]: 'green',\n\t[TLV1ColorStyle.Blue]: 'light-blue',\n\t[TLV1ColorStyle.Indigo]: 'blue',\n\t[TLV1ColorStyle.Orange]: 'orange',\n\t[TLV1ColorStyle.Yellow]: 'yellow',\n\t[TLV1ColorStyle.Red]: 'red',\n\t[TLV1ColorStyle.Violet]: 'light-violet',\n}\n\nconst v1FontsToV2Fonts: Record<TLV1FontStyle, TLDefaultFontStyle> = {\n\t[TLV1FontStyle.Mono]: 'mono',\n\t[TLV1FontStyle.Sans]: 'sans',\n\t[TLV1FontStyle.Script]: 'draw',\n\t[TLV1FontStyle.Serif]: 'serif',\n}\n\nconst v1AlignsToV2Aligns: Record<TLV1AlignStyle, TLDefaultHorizontalAlignStyle> = {\n\t[TLV1AlignStyle.Start]: 'start',\n\t[TLV1AlignStyle.Middle]: 'middle',\n\t[TLV1AlignStyle.End]: 'end',\n\t[TLV1AlignStyle.Justify]: 'start',\n}\n\nconst v1TextAlignsToV2TextAligns: Record<TLV1AlignStyle, TLDefaultTextAlignStyle> = {\n\t[TLV1AlignStyle.Start]: 'start',\n\t[TLV1AlignStyle.Middle]: 'middle',\n\t[TLV1AlignStyle.End]: 'end',\n\t[TLV1AlignStyle.Justify]: 'start',\n}\n\nconst v1TextSizesToV2TextSizes: Record<TLV1SizeStyle, TLDefaultSizeStyle> = {\n\t[TLV1SizeStyle.Small]: 's',\n\t[TLV1SizeStyle.Medium]: 'l',\n\t[TLV1SizeStyle.Large]: 'xl',\n}\n\nconst v1SizesToV2Sizes: Record<TLV1SizeStyle, TLDefaultSizeStyle> = {\n\t[TLV1SizeStyle.Small]: 'm',\n\t[TLV1SizeStyle.Medium]: 'l',\n\t[TLV1SizeStyle.Large]: 'xl',\n}\n\nconst v1DashesToV2Dashes: Record<TLV1DashStyle, TLDefaultDashStyle> = {\n\t[TLV1DashStyle.Solid]: 'solid',\n\t[TLV1DashStyle.Dashed]: 'dashed',\n\t[TLV1DashStyle.Dotted]: 'dotted',\n\t[TLV1DashStyle.Draw]: 'draw',\n}\n\nfunction getV2Color(color: TLV1ColorStyle | undefined): TLDefaultColorStyle {\n\treturn color ? (v1ColorsToV2Colors[color] ?? 'black') : 'black'\n}\n\nfunction getV2Font(font: TLV1FontStyle | undefined): TLDefaultFontStyle {\n\treturn font ? (v1FontsToV2Fonts[font] ?? 'draw') : 'draw'\n}\n\nfunction getV2Align(align: TLV1AlignStyle | undefined): TLDefaultHorizontalAlignStyle {\n\treturn align ? (v1AlignsToV2Aligns[align] ?? 'middle') : 'middle'\n}\n\nfunction getV2TextAlign(align: TLV1AlignStyle | undefined): TLDefaultTextAlignStyle {\n\treturn align ? (v1TextAlignsToV2TextAligns[align] ?? 'middle') : 'middle'\n}\n\nfunction getV2TextSize(size: TLV1SizeStyle | undefined): TLDefaultSizeStyle {\n\treturn size ? (v1TextSizesToV2TextSizes[size] ?? 'm') : 'm'\n}\n\nfunction getV2Size(size: TLV1SizeStyle | undefined): TLDefaultSizeStyle {\n\treturn size ? (v1SizesToV2Sizes[size] ?? 'l') : 'l'\n}\n\nfunction getV2Dash(dash: TLV1DashStyle | undefined): TLDefaultDashStyle {\n\treturn dash ? (v1DashesToV2Dashes[dash] ?? 'draw') : 'draw'\n}\n\nfunction getV2Point(point: number[]): VecModel {\n\treturn {\n\t\tx: coerceNumber(point[0]),\n\t\ty: coerceNumber(point[1]),\n\t\tz: point[2] == null ? 0.5 : coerceNumber(point[2]),\n\t}\n}\n\nfunction getV2Arrowhead(decoration: TLV1Decoration | undefined): TLArrowShapeArrowheadStyle {\n\treturn decoration === TLV1Decoration.Arrow ? 'arrow' : 'none'\n}\n\nfunction getV2Fill(isFilled: boolean | undefined, color: TLV1ColorStyle) {\n\treturn isFilled\n\t\t? color === TLV1ColorStyle.Black || color === TLV1ColorStyle.White\n\t\t\t? 'semi'\n\t\t\t: 'solid'\n\t\t: 'none'\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACC;AAAA,EAEA;AAAA,EAmBA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,wBAAwB;AAEjC,MAAM,oBAAoB;AAGnB,SAAS,oBAAoB,QAAgB,WAAoB;AACvE,MAAI,WAAW;AACf,SAAO,IAAI,MAAM;AAChB,eAAW,QAAQ,UAAU,iBAAiB;AAE9C,WAAO,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO;AAEzC,UAAM,cAAc,OAAO,SAAS,EAAE,CAAC,EAAE;AAGzC,WAAO,eAAe,WAAW;AAGjC,eAAW,QAAQ,OAAO,SAAS,EAAE,MAAM,CAAC,GAAG;AAC9C,aAAO,WAAW,KAAK,EAAE;AAAA,IAC1B;AAGA,WAAO,UAAU;AACjB,WAAO,aAAa,OAAO,oBAAoB,CAAC;AAGhD,UAAM,yBAAyB,oBAAI,IAAuB;AAE1D,WAAO,OAAO,SAAS,UAAU,CAAC,CAAC,EAAE,QAAQ,CAAC,YAAY;AACzD,cAAQ,QAAQ,MAAM;AAAA,QACrB,KAAK,qBAAqB;AACzB,gBAAM,UAAqB,gBAAgB,SAAS;AACpD,iCAAuB,IAAI,QAAQ,IAAI,OAAO;AAC9C,gBAAM,mBAA4B;AAAA,YACjC,IAAI;AAAA,YACJ,UAAU;AAAA,YACV,MAAM;AAAA,YACN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V1AssetType"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tldraw",
|
|
3
3
|
"description": "A tiny little drawing editor.",
|
|
4
|
-
"version": "3.16.0-
|
|
4
|
+
"version": "3.16.0-internal.a478398270c6",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"tldraw",
|
|
20
|
-
"sdk",
|
|
21
20
|
"drawing",
|
|
22
21
|
"app",
|
|
23
22
|
"development",
|
|
@@ -54,8 +53,8 @@
|
|
|
54
53
|
"@tiptap/pm": "^2.9.1",
|
|
55
54
|
"@tiptap/react": "^2.9.1",
|
|
56
55
|
"@tiptap/starter-kit": "^2.9.1",
|
|
57
|
-
"@tldraw/editor": "3.16.0-
|
|
58
|
-
"@tldraw/store": "3.16.0-
|
|
56
|
+
"@tldraw/editor": "3.16.0-internal.a478398270c6",
|
|
57
|
+
"@tldraw/store": "3.16.0-internal.a478398270c6",
|
|
59
58
|
"classnames": "^2.5.1",
|
|
60
59
|
"hotkeys-js": "^3.13.9",
|
|
61
60
|
"idb": "^7.1.1",
|
package/src/index.ts
CHANGED
|
@@ -22,7 +22,6 @@ export {
|
|
|
22
22
|
} from './lib/shapes/shared/PathBuilder'
|
|
23
23
|
export { usePrefersReducedMotion } from './lib/shapes/shared/usePrefersReducedMotion'
|
|
24
24
|
export { DefaultA11yAnnouncer, useSelectedShapesAnnouncer } from './lib/ui/components/A11y'
|
|
25
|
-
export { AccessibilityMenu } from './lib/ui/components/AccessibilityMenu'
|
|
26
25
|
export { ColorSchemeMenu } from './lib/ui/components/ColorSchemeMenu'
|
|
27
26
|
export { DefaultDialogs } from './lib/ui/components/Dialogs'
|
|
28
27
|
export {
|
|
@@ -42,7 +41,6 @@ export { TldrawUiTranslationProvider } from './lib/ui/hooks/useTranslation/useTr
|
|
|
42
41
|
// eslint-disable-next-line local/no-export-star
|
|
43
42
|
export * from '@tldraw/editor'
|
|
44
43
|
export { ArrowBindingUtil } from './lib/bindings/arrow/ArrowBindingUtil'
|
|
45
|
-
export { TldrawCropHandles, type TldrawCropHandlesProps } from './lib/canvas/TldrawCropHandles'
|
|
46
44
|
export { TldrawHandles } from './lib/canvas/TldrawHandles'
|
|
47
45
|
export { TldrawArrowHints, TldrawOverlays } from './lib/canvas/TldrawOverlays'
|
|
48
46
|
export { TldrawScribble } from './lib/canvas/TldrawScribble'
|
|
@@ -73,7 +71,6 @@ export {
|
|
|
73
71
|
defaultHandleExternalTldrawContent,
|
|
74
72
|
defaultHandleExternalUrlAsset,
|
|
75
73
|
defaultHandleExternalUrlContent,
|
|
76
|
-
getAssetInfo,
|
|
77
74
|
getMediaAssetInfoPartial,
|
|
78
75
|
registerDefaultExternalContentHandlers,
|
|
79
76
|
type TLDefaultExternalContentHandlerOpts,
|
|
@@ -186,7 +183,6 @@ export { TldrawImage, type TldrawImageProps } from './lib/TldrawImage'
|
|
|
186
183
|
export { EraserTool } from './lib/tools/EraserTool/EraserTool'
|
|
187
184
|
export { HandTool } from './lib/tools/HandTool/HandTool'
|
|
188
185
|
export { LaserTool } from './lib/tools/LaserTool/LaserTool'
|
|
189
|
-
export { getHitShapeOnCanvasPointerDown } from './lib/tools/selection-logic/getHitShapeOnCanvasPointerDown'
|
|
190
186
|
export { SelectTool } from './lib/tools/SelectTool/SelectTool'
|
|
191
187
|
export { ZoomTool } from './lib/tools/ZoomTool/ZoomTool'
|
|
192
188
|
export {
|
|
@@ -254,7 +250,6 @@ export {
|
|
|
254
250
|
EditSubmenu,
|
|
255
251
|
ExportFileContentSubMenu,
|
|
256
252
|
ExtrasGroup,
|
|
257
|
-
LockGroup,
|
|
258
253
|
MiscMenuGroup,
|
|
259
254
|
PreferencesGroup,
|
|
260
255
|
UndoRedoGroup,
|
|
@@ -288,14 +283,12 @@ export {
|
|
|
288
283
|
ToggleEdgeScrollingItem,
|
|
289
284
|
ToggleFocusModeItem,
|
|
290
285
|
ToggleGridItem,
|
|
291
|
-
ToggleKeyboardShortcutsItem,
|
|
292
286
|
ToggleLockMenuItem,
|
|
293
287
|
TogglePasteAtCursorItem,
|
|
294
288
|
ToggleReduceMotionItem,
|
|
295
289
|
ToggleSnapModeItem,
|
|
296
290
|
ToggleToolLockItem,
|
|
297
291
|
ToggleTransparentBgMenuItem,
|
|
298
|
-
ToggleUiLabelsItem,
|
|
299
292
|
ToggleWrapModeItem,
|
|
300
293
|
UngroupMenuItem,
|
|
301
294
|
UnlockAllMenuItem,
|
|
@@ -388,11 +381,7 @@ export {
|
|
|
388
381
|
type TLUiDropdownMenuSubTriggerProps,
|
|
389
382
|
type TLUiDropdownMenuTriggerProps,
|
|
390
383
|
} from './lib/ui/components/primitives/TldrawUiDropdownMenu'
|
|
391
|
-
export {
|
|
392
|
-
TldrawUiIcon,
|
|
393
|
-
type TLUiIconJsx,
|
|
394
|
-
type TLUiIconProps,
|
|
395
|
-
} from './lib/ui/components/primitives/TldrawUiIcon'
|
|
384
|
+
export { TldrawUiIcon, type TLUiIconProps } from './lib/ui/components/primitives/TldrawUiIcon'
|
|
396
385
|
export { TldrawUiInput, type TLUiInputProps } from './lib/ui/components/primitives/TldrawUiInput'
|
|
397
386
|
export { TldrawUiKbd, type TLUiKbdProps } from './lib/ui/components/primitives/TldrawUiKbd'
|
|
398
387
|
export {
|
|
@@ -414,12 +403,6 @@ export {
|
|
|
414
403
|
type TLUiToolbarToggleGroupProps,
|
|
415
404
|
type TLUiToolbarToggleItemProps,
|
|
416
405
|
} from './lib/ui/components/primitives/TldrawUiToolbar'
|
|
417
|
-
export {
|
|
418
|
-
TldrawUiTooltip,
|
|
419
|
-
TldrawUiTooltipProvider,
|
|
420
|
-
type TldrawUiTooltipProps,
|
|
421
|
-
type TldrawUiTooltipProviderProps,
|
|
422
|
-
} from './lib/ui/components/primitives/TldrawUiTooltip'
|
|
423
406
|
export {
|
|
424
407
|
DefaultQuickActions,
|
|
425
408
|
type TLUiQuickActionsProps,
|
|
@@ -480,7 +463,6 @@ export {
|
|
|
480
463
|
EraserToolbarItem,
|
|
481
464
|
FrameToolbarItem,
|
|
482
465
|
HandToolbarItem,
|
|
483
|
-
HeartToolbarItem,
|
|
484
466
|
HexagonToolbarItem,
|
|
485
467
|
HighlightToolbarItem,
|
|
486
468
|
LaserToolbarItem,
|
|
@@ -511,10 +493,6 @@ export {
|
|
|
511
493
|
OverflowingToolbar,
|
|
512
494
|
type OverflowingToolbarProps,
|
|
513
495
|
} from './lib/ui/components/Toolbar/OverflowingToolbar'
|
|
514
|
-
export {
|
|
515
|
-
ToggleToolLockedButton,
|
|
516
|
-
type ToggleToolLockedButtonProps,
|
|
517
|
-
} from './lib/ui/components/Toolbar/ToggleToolLockedButton'
|
|
518
496
|
export {
|
|
519
497
|
CenteredTopPanelContainer,
|
|
520
498
|
type CenteredTopPanelContainerProps,
|
|
@@ -584,7 +562,7 @@ export {
|
|
|
584
562
|
type TLUiToastsContextType,
|
|
585
563
|
type TLUiToastsProviderProps,
|
|
586
564
|
} from './lib/ui/context/toasts'
|
|
587
|
-
export { useCanRedo, useCanUndo
|
|
565
|
+
export { useCanRedo, useCanUndo } from './lib/ui/hooks/menu-hooks'
|
|
588
566
|
export { useMenuClipboardEvents, useNativeClipboardEvents } from './lib/ui/hooks/useClipboardEvents'
|
|
589
567
|
export {
|
|
590
568
|
useCollaborationStatus,
|
package/src/lib/TldrawImage.tsx
CHANGED
|
@@ -15,7 +15,6 @@ import { memo, useEffect, useLayoutEffect, useMemo, useState } from 'react'
|
|
|
15
15
|
import { defaultBindingUtils } from './defaultBindingUtils'
|
|
16
16
|
import { defaultShapeUtils } from './defaultShapeUtils'
|
|
17
17
|
import { TLUiAssetUrlOverrides } from './ui/assetUrls'
|
|
18
|
-
import { useDefaultEditorAssetsWithOverrides } from './utils/static-assets/assetUrls'
|
|
19
18
|
import { defaultAddFontsFromNode, tipTapDefaultExtensions } from './utils/text/richText'
|
|
20
19
|
|
|
21
20
|
/** @public */
|
|
@@ -112,7 +111,6 @@ export const TldrawImage = memo(function TldrawImage(props: TldrawImageProps) {
|
|
|
112
111
|
assetUrls,
|
|
113
112
|
textOptions = defaultTextOptions,
|
|
114
113
|
} = props
|
|
115
|
-
const assetUrlsWithOverrides = useDefaultEditorAssetsWithOverrides(assetUrls)
|
|
116
114
|
|
|
117
115
|
useLayoutEffect(() => {
|
|
118
116
|
if (!container) return
|
|
@@ -131,7 +129,7 @@ export const TldrawImage = memo(function TldrawImage(props: TldrawImageProps) {
|
|
|
131
129
|
tools: [],
|
|
132
130
|
getContainer: () => tempElm,
|
|
133
131
|
licenseKey,
|
|
134
|
-
fontAssetUrls:
|
|
132
|
+
fontAssetUrls: assetUrls?.fonts,
|
|
135
133
|
textOptions,
|
|
136
134
|
})
|
|
137
135
|
|
|
@@ -140,8 +138,6 @@ export const TldrawImage = memo(function TldrawImage(props: TldrawImageProps) {
|
|
|
140
138
|
const shapeIds = editor.getCurrentPageShapeIds()
|
|
141
139
|
|
|
142
140
|
async function setSvg() {
|
|
143
|
-
// We have to wait for the fonts to load so that we can correctly measure text sizes
|
|
144
|
-
await editor.fonts.loadRequiredFontsForCurrentPage(editor.options.maxFontsToLoadBeforeRender)
|
|
145
141
|
const imageResult = await editor.toImage([...shapeIds], {
|
|
146
142
|
bounds,
|
|
147
143
|
scale,
|
|
@@ -179,7 +175,7 @@ export const TldrawImage = memo(function TldrawImage(props: TldrawImageProps) {
|
|
|
179
175
|
preserveAspectRatio,
|
|
180
176
|
licenseKey,
|
|
181
177
|
pixelRatio,
|
|
182
|
-
|
|
178
|
+
assetUrls,
|
|
183
179
|
textOptions,
|
|
184
180
|
])
|
|
185
181
|
|
|
@@ -2,7 +2,6 @@ import { toDomPrecision } from '@tldraw/editor'
|
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { useTranslation } from '../ui/hooks/useTranslation/useTranslation'
|
|
4
4
|
|
|
5
|
-
/** @public */
|
|
6
5
|
export interface TldrawCropHandlesProps {
|
|
7
6
|
size: number
|
|
8
7
|
width: number
|
|
@@ -10,7 +9,6 @@ export interface TldrawCropHandlesProps {
|
|
|
10
9
|
hideAlternateHandles: boolean
|
|
11
10
|
}
|
|
12
11
|
|
|
13
|
-
/** @public @react */
|
|
14
12
|
export function TldrawCropHandles({
|
|
15
13
|
size,
|
|
16
14
|
width,
|
|
@@ -22,7 +20,7 @@ export function TldrawCropHandles({
|
|
|
22
20
|
const msg = useTranslation()
|
|
23
21
|
|
|
24
22
|
return (
|
|
25
|
-
<svg className="tl-overlays__item"
|
|
23
|
+
<svg className="tl-overlays__item">
|
|
26
24
|
{/* Top left */}
|
|
27
25
|
<polyline
|
|
28
26
|
className="tl-corner-crop-handle"
|
|
@@ -23,9 +23,5 @@ export function TldrawHandles({ children }: TLHandlesProps) {
|
|
|
23
23
|
|
|
24
24
|
if (!shouldDisplayHandles) return null
|
|
25
25
|
|
|
26
|
-
return
|
|
27
|
-
<svg className="tl-user-handles tl-overlays__item" aria-hidden="true">
|
|
28
|
-
{children}
|
|
29
|
-
</svg>
|
|
30
|
-
)
|
|
26
|
+
return <svg className="tl-user-handles tl-overlays__item">{children}</svg>
|
|
31
27
|
}
|
|
@@ -60,7 +60,7 @@ export function TldrawArrowHints() {
|
|
|
60
60
|
{ShapeIndicator && <ShapeIndicator shapeId={targetInfo.target.id} />}
|
|
61
61
|
|
|
62
62
|
{showEdgeHints && (
|
|
63
|
-
<svg className="tl-overlays__item"
|
|
63
|
+
<svg className="tl-overlays__item">
|
|
64
64
|
<circle
|
|
65
65
|
cx={anchorInPageSpace.x}
|
|
66
66
|
cy={anchorInPageSpace.y}
|
|
@@ -192,11 +192,7 @@ export const TldrawSelectionForeground = track(function TldrawSelectionForegroun
|
|
|
192
192
|
textHandleHeight * zoom >= 4
|
|
193
193
|
|
|
194
194
|
return (
|
|
195
|
-
<svg
|
|
196
|
-
className="tl-overlays__item tl-selection__fg"
|
|
197
|
-
data-testid="selection-foreground"
|
|
198
|
-
aria-hidden="true"
|
|
199
|
-
>
|
|
195
|
+
<svg className="tl-overlays__item tl-selection__fg" data-testid="selection-foreground">
|
|
200
196
|
<g ref={rSvg}>
|
|
201
197
|
{shouldDisplayBox && (
|
|
202
198
|
<rect
|
|
@@ -915,8 +915,7 @@ function runFileChecks(file: File, options: TLDefaultExternalContentHandlerOpts)
|
|
|
915
915
|
return true
|
|
916
916
|
}
|
|
917
917
|
|
|
918
|
-
|
|
919
|
-
export async function getAssetInfo(
|
|
918
|
+
async function getAssetInfo(
|
|
920
919
|
file: File,
|
|
921
920
|
options: TLDefaultExternalContentHandlerOpts,
|
|
922
921
|
assetId?: TLAssetId
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HALF_PI, TLArrowShape, TLShapeId, createShapeId
|
|
1
|
+
import { HALF_PI, TLArrowShape, TLShapeId, createShapeId } from '@tldraw/editor'
|
|
2
2
|
import { TestEditor } from '../../../test/TestEditor'
|
|
3
3
|
import { createOrUpdateArrowBinding, getArrowBindings } from './shared'
|
|
4
4
|
|
|
@@ -333,7 +333,7 @@ describe('Arrow labels', () => {
|
|
|
333
333
|
editor.setCurrentTool('arrow').pointerDown(10, 10).pointerMove(100, 100).pointerUp()
|
|
334
334
|
const arrowId = editor.getOnlySelectedShape()!.id
|
|
335
335
|
editor.updateShapes<TLArrowShape>([
|
|
336
|
-
{ id: arrowId, type: 'arrow', props: {
|
|
336
|
+
{ id: arrowId, type: 'arrow', props: { text: 'Test Label' } },
|
|
337
337
|
])
|
|
338
338
|
})
|
|
339
339
|
|
|
@@ -341,7 +341,7 @@ describe('Arrow labels', () => {
|
|
|
341
341
|
const arrowId = editor.getOnlySelectedShape()!.id
|
|
342
342
|
expect(arrow(arrowId)).toMatchObject({
|
|
343
343
|
props: {
|
|
344
|
-
|
|
344
|
+
text: 'Test Label',
|
|
345
345
|
},
|
|
346
346
|
})
|
|
347
347
|
})
|
|
@@ -349,11 +349,11 @@ describe('Arrow labels', () => {
|
|
|
349
349
|
it('should update the label of an arrow', () => {
|
|
350
350
|
const arrowId = editor.getOnlySelectedShape()!.id
|
|
351
351
|
editor.updateShapes<TLArrowShape>([
|
|
352
|
-
{ id: arrowId, type: 'arrow', props: {
|
|
352
|
+
{ id: arrowId, type: 'arrow', props: { text: 'New Label' } },
|
|
353
353
|
])
|
|
354
354
|
expect(arrow(arrowId)).toMatchObject({
|
|
355
355
|
props: {
|
|
356
|
-
|
|
356
|
+
text: 'New Label',
|
|
357
357
|
},
|
|
358
358
|
})
|
|
359
359
|
})
|