tldraw 4.3.0-next.2b3bfbba757b → 4.3.0-next.39f1d5b92226
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 +14 -5
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/bindings/arrow/ArrowBindingUtil.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/elbow/elbowArrowSnapLines.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/shared.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/bookmark/bookmarks.js.map +2 -2
- package/dist-cjs/lib/shapes/draw/toolStates/Drawing.js.map +2 -2
- package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/FrameShapeTool.js.map +1 -1
- package/dist-cjs/lib/shapes/geo/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/line/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/note/noteHelpers.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/crop.js +1 -0
- package/dist-cjs/lib/shapes/shared/crop.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/useEditablePlainText.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/useEditableRichText.js.map +2 -2
- package/dist-cjs/lib/shapes/text/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js +1 -4
- package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Brushing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +1 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/EditingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingArrowLabel.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingSelection.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/ScribbleBrushing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/ui/components/EditLinkDialog.js +11 -1
- package/dist-cjs/lib/ui/components/EditLinkDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +1 -2
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useFlatten.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.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 +8 -0
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
- package/dist-cjs/lib/utils/export/exportAs.js.map +2 -2
- package/dist-cjs/lib/utils/frames/frames.js.map +2 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
- package/dist-esm/index.d.mts +14 -5
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/bindings/arrow/ArrowBindingUtil.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/elbow/elbowArrowSnapLines.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/shared.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/bookmark/bookmarks.mjs.map +2 -2
- package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs.map +2 -2
- package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/FrameShapeTool.mjs.map +1 -1
- package/dist-esm/lib/shapes/geo/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/line/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/noteHelpers.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/crop.mjs +1 -0
- package/dist-esm/lib/shapes/shared/crop.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/useEditableRichText.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs +1 -4
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs +1 -4
- package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Brushing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +1 -1
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/EditingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingArrowLabel.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs +1 -4
- package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingSelection.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/ScribbleBrushing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/ui/components/EditLinkDialog.mjs +11 -1
- package/dist-esm/lib/ui/components/EditLinkDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +1 -4
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +1 -2
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs +1 -4
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useFlatten.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.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 +8 -0
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
- package/dist-esm/lib/utils/export/exportAs.mjs +1 -3
- package/dist-esm/lib/utils/export/exportAs.mjs.map +2 -2
- package/dist-esm/lib/utils/frames/frames.mjs.map +2 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
- package/package.json +10 -10
- package/src/lib/bindings/arrow/ArrowBindingUtil.ts +1 -1
- package/src/lib/canvas/TldrawSelectionForeground.tsx +4 -9
- package/src/lib/defaultExternalContentHandlers.ts +3 -4
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +2 -2
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +1 -1
- package/src/lib/shapes/arrow/arrowLabel.ts +1 -1
- package/src/lib/shapes/arrow/arrowTargetState.ts +1 -1
- package/src/lib/shapes/arrow/elbow/elbowArrowSnapLines.tsx +3 -3
- package/src/lib/shapes/arrow/shared.ts +4 -4
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +1 -1
- package/src/lib/shapes/bookmark/bookmarks.ts +3 -3
- package/src/lib/shapes/draw/toolStates/Drawing.ts +4 -4
- package/src/lib/shapes/embed/EmbedShapeUtil.tsx +1 -1
- package/src/lib/shapes/frame/FrameShapeTool.ts +1 -1
- package/src/lib/shapes/geo/GeoShapeUtil.test.tsx +10 -2
- package/src/lib/shapes/geo/toolStates/Pointing.ts +3 -3
- package/src/lib/shapes/line/LineShapeTool.test.ts +6 -6
- package/src/lib/shapes/line/LineShapeUtil.test.tsx +5 -5
- package/src/lib/shapes/line/toolStates/Pointing.ts +1 -1
- package/src/lib/shapes/note/NoteShapeTool.test.ts +2 -1
- package/src/lib/shapes/note/noteHelpers.ts +2 -2
- package/src/lib/shapes/shared/PlainTextLabel.tsx +2 -1
- package/src/lib/shapes/shared/RichTextLabel.tsx +2 -1
- package/src/lib/shapes/shared/crop.ts +1 -0
- package/src/lib/shapes/shared/useEditablePlainText.ts +7 -3
- package/src/lib/shapes/shared/useEditableRichText.ts +7 -3
- package/src/lib/shapes/text/TextShapeTool.test.ts +4 -4
- package/src/lib/shapes/text/toolStates/Pointing.ts +1 -1
- package/src/lib/tools/EraserTool/childStates/Erasing.ts +3 -5
- package/src/lib/tools/EraserTool/childStates/Pointing.ts +3 -16
- package/src/lib/tools/SelectTool/DragAndDropManager.ts +2 -4
- package/src/lib/tools/SelectTool/childStates/Brushing.ts +2 -6
- package/src/lib/tools/SelectTool/childStates/Crop/children/Idle.ts +2 -3
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +4 -7
- package/src/lib/tools/SelectTool/childStates/EditingShape.ts +2 -4
- package/src/lib/tools/SelectTool/childStates/Idle.ts +6 -10
- package/src/lib/tools/SelectTool/childStates/PointingArrowLabel.ts +1 -1
- package/src/lib/tools/SelectTool/childStates/PointingHandle.ts +4 -12
- package/src/lib/tools/SelectTool/childStates/PointingSelection.ts +2 -2
- package/src/lib/tools/SelectTool/childStates/Resizing.ts +2 -4
- package/src/lib/tools/SelectTool/childStates/ScribbleBrushing.ts +2 -4
- package/src/lib/tools/SelectTool/childStates/Translating.ts +1 -3
- package/src/lib/ui/components/EditLinkDialog.tsx +16 -6
- package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +2 -2
- package/src/lib/ui/components/menu-items.tsx +6 -14
- package/src/lib/ui/context/actions.tsx +9 -13
- package/src/lib/ui/hooks/menu-hooks.ts +9 -19
- package/src/lib/ui/hooks/useFlatten.ts +1 -2
- package/src/lib/ui/hooks/useTools.tsx +1 -2
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/utils/excalidraw/putExcalidrawContent.ts +8 -0
- package/src/lib/utils/export/exportAs.ts +2 -9
- package/src/lib/utils/frames/frames.ts +1 -1
- package/src/lib/utils/tldr/buildFromV1Document.ts +12 -17
- package/src/test/Editor.test.tsx +38 -12
- package/src/test/SelectTool.test.ts +11 -19
- package/src/test/TestEditor.ts +1 -4
- package/src/test/TldrawEditor.test.tsx +21 -18
- package/src/test/bindings.test.tsx +29 -25
- package/src/test/bindingsIndex.test.tsx +4 -4
- package/src/test/commands/createShape.test.ts +64 -0
- package/src/test/commands/createShapes.test.ts +15 -1
- package/src/test/commands/getSvgString.test.ts +2 -2
- package/src/test/commands/isShapeOfType.test.ts +44 -0
- package/src/test/commands/putContent.test.ts +1 -0
- package/src/test/commands/updateShape.test.ts +67 -0
- package/src/test/commands/updateShapes.test.ts +21 -5
- package/src/test/custom-clipping.test.ts +36 -35
- package/src/test/customSnapping.test.tsx +77 -62
- package/src/test/duplicate.test.ts +1 -1
- package/src/test/frames.test.ts +2 -2
- package/src/test/getCulledShapes.test.tsx +11 -3
- package/src/test/getShapeAtPoint.test.ts +2 -2
- package/src/test/groups.test.tsx +6 -3
- package/src/test/resizing.test.ts +9 -13
- package/src/test/selection-omnibus.test.ts +11 -11
- package/src/test/shapeutils.test.ts +1 -1
- package/src/test/styles2.test.tsx +1 -1
- package/src/test/styles3.test.ts +5 -5
- package/src/test/test-jsx.tsx +69 -57
- package/src/test/text.test.ts +15 -17
- package/src/test/translating.test.ts +6 -8
|
@@ -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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBA6BO;AACP,oBAAiC;AAEjC,MAAM,oBAAoB;AAGnB,SAAS,oBAAoB,QAAgB,WAAoB;AACvE,MAAI,WAAW;AACf,SAAO,IAAI,MAAM;AAChB,eAAW,QAAQ,UAAU,iBAAiB;AAE9C,WAAO,OAA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AS,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\tTLGeoShape,\n\tTLPageId,\n\tTLShapeId,\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([\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([\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([\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([\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([\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([\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([\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([\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([\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([\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([\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([\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(is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AAC,iBAAkB,GAAG;AACvB;AAEA,SAAS,WAAW,OAAwD;AAC3E,SAAO,QAAS,mBAAmB,KAAK,KAAK,UAAW;AACzD;AAEA,SAAS,UAAU,MAAqD;AACvE,SAAO,OAAQ,iBAAiB,IAAI,KAAK,SAAU;AACpD;AAEA,SAAS,WAAW,OAAkE;AACrF,SAAO,QAAS,mBAAmB,KAAK,KAAK,WAAY;AAC1D;AAEA,SAAS,eAAe,OAA4D;AACnF,SAAO,QAAS,2BAA2B,KAAK,KAAK,WAAY;AAClE;AAEA,SAAS,cAAc,MAAqD;AAC3E,SAAO,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;",
|
|
6
6
|
"names": ["bounds", "TLV1ShapeType", "TLV1ColorStyle", "TLV1SizeStyle", "TLV1DashStyle", "TLV1AlignStyle", "TLV1FontStyle", "TLV1Decoration", "TLV1AssetType"]
|
|
7
7
|
}
|
package/dist-esm/index.d.mts
CHANGED
|
@@ -15,6 +15,7 @@ import { Editor } from '@tldraw/editor';
|
|
|
15
15
|
import { ElbowArrowSnap } from '@tldraw/editor';
|
|
16
16
|
import { Extension } from '@tiptap/core';
|
|
17
17
|
import { Extensions } from '@tiptap/core';
|
|
18
|
+
import { ExtractShapeByProps } from '@tldraw/editor';
|
|
18
19
|
import { ForwardRefExoticComponent } from 'react';
|
|
19
20
|
import { Geometry2d } from '@tldraw/editor';
|
|
20
21
|
import { Geometry2dFilters } from '@tldraw/editor';
|
|
@@ -1615,7 +1616,7 @@ export declare interface FrameShapeOptions {
|
|
|
1615
1616
|
export declare class FrameShapeTool extends BaseBoxShapeTool {
|
|
1616
1617
|
static id: string;
|
|
1617
1618
|
static initial: string;
|
|
1618
|
-
shapeType:
|
|
1619
|
+
shapeType: "frame";
|
|
1619
1620
|
onCreate(shape: null | TLShape): void;
|
|
1620
1621
|
}
|
|
1621
1622
|
|
|
@@ -2414,7 +2415,9 @@ export declare const PlainTextLabel: React_3.NamedExoticComponent<PlainTextLabel
|
|
|
2414
2415
|
/** @public */
|
|
2415
2416
|
export declare interface PlainTextLabelProps {
|
|
2416
2417
|
shapeId: TLShapeId;
|
|
2417
|
-
type:
|
|
2418
|
+
type: ExtractShapeByProps<{
|
|
2419
|
+
text: string;
|
|
2420
|
+
}>['type'];
|
|
2418
2421
|
font: TLDefaultFontStyle;
|
|
2419
2422
|
fontSize: number;
|
|
2420
2423
|
lineHeight: number;
|
|
@@ -2556,7 +2559,9 @@ export declare const RichTextLabel: React_3.NamedExoticComponent<RichTextLabelPr
|
|
|
2556
2559
|
/** @public */
|
|
2557
2560
|
export declare interface RichTextLabelProps {
|
|
2558
2561
|
shapeId: TLShapeId;
|
|
2559
|
-
type:
|
|
2562
|
+
type: ExtractShapeByProps<{
|
|
2563
|
+
richText: TLRichText;
|
|
2564
|
+
}>['type'];
|
|
2560
2565
|
font: TLDefaultFontStyle;
|
|
2561
2566
|
fontSize: number;
|
|
2562
2567
|
lineHeight: number;
|
|
@@ -4614,7 +4619,9 @@ export declare function useDefaultHelpers(): {
|
|
|
4614
4619
|
export declare function useDialogs(): TLUiDialogsContextType;
|
|
4615
4620
|
|
|
4616
4621
|
/** @public */
|
|
4617
|
-
export declare function useEditablePlainText(shapeId: TLShapeId, type:
|
|
4622
|
+
export declare function useEditablePlainText(shapeId: TLShapeId, type: ExtractShapeByProps<{
|
|
4623
|
+
text: string;
|
|
4624
|
+
}>['type'], text?: string): {
|
|
4618
4625
|
handleBlur: () => void;
|
|
4619
4626
|
handleChange: ({ plaintext }: {
|
|
4620
4627
|
plaintext: string;
|
|
@@ -4633,7 +4640,9 @@ export declare function useEditablePlainText(shapeId: TLShapeId, type: string, t
|
|
|
4633
4640
|
};
|
|
4634
4641
|
|
|
4635
4642
|
/** @public */
|
|
4636
|
-
export declare function useEditableRichText(shapeId: TLShapeId, type:
|
|
4643
|
+
export declare function useEditableRichText(shapeId: TLShapeId, type: ExtractShapeByProps<{
|
|
4644
|
+
richText: TLRichText;
|
|
4645
|
+
}>['type'], richText?: TLRichText): {
|
|
4637
4646
|
handleBlur: () => void;
|
|
4638
4647
|
handleChange: ({ richText }: {
|
|
4639
4648
|
richText: TLRichText;
|
package/dist-esm/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/bindings/arrow/ArrowBindingUtil.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n\tBindingOnChangeOptions,\n\tBindingOnCreateOptions,\n\tBindingOnShapeChangeOptions,\n\tBindingOnShapeIsolateOptions,\n\tBindingUtil,\n\tEditor,\n\tIndexKey,\n\tTLArrowBinding,\n\tTLArrowBindingProps,\n\tTLArrowShape,\n\tTLParentId,\n\tTLShape,\n\tTLShapeId,\n\tTLShapePartial,\n\tVec,\n\tapproximately,\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\tassert,\n\tgetIndexAbove,\n\tgetIndexBetween,\n\tintersectLineSegmentCircle,\n} from '@tldraw/editor'\nimport { getArrowBindings, getArrowInfo, removeArrowBinding } from '../../shapes/arrow/shared'\n\n/**\n * @public\n */\nexport class ArrowBindingUtil extends BindingUtil<TLArrowBinding> {\n\tstatic override type = 'arrow'\n\n\tstatic override props = arrowBindingProps\n\tstatic override migrations = arrowBindingMigrations\n\n\toverride getDefaultProps(): Partial<TLArrowBindingProps> {\n\t\treturn {\n\t\t\tisPrecise: false,\n\t\t\tisExact: false,\n\t\t\tnormalizedAnchor: { x: 0.5, y: 0.5 },\n\t\t\tsnap: 'none',\n\t\t}\n\t}\n\n\t// when the binding itself changes\n\toverride onAfterCreate({ binding }: BindingOnCreateOptions<TLArrowBinding>): void {\n\t\tconst arrow = this.editor.getShape(binding.fromId) as TLArrowShape | undefined\n\t\tif (!arrow) return\n\t\tarrowDidUpdate(this.editor, arrow)\n\t}\n\n\t// when the binding itself changes\n\toverride onAfterChange({ bindingAfter }: BindingOnChangeOptions<TLArrowBinding>): void {\n\t\tconst arrow = this.editor.getShape(bindingAfter.fromId) as TLArrowShape | undefined\n\t\tif (!arrow) return\n\t\tarrowDidUpdate(this.editor, arrow)\n\t}\n\n\t// when the arrow itself changes\n\toverride onAfterChangeFromShape({\n\t\tshapeAfter,\n\t}: BindingOnShapeChangeOptions<TLArrowBinding>): void {\n\t\tarrowDidUpdate(this.editor, shapeAfter as TLArrowShape)\n\t}\n\n\t// when the shape an arrow is bound to changes\n\toverride onAfterChangeToShape({\n\t\tbinding,\n\t\tshapeBefore,\n\t\tshapeAfter,\n\t\treason,\n\t}: BindingOnShapeChangeOptions<TLArrowBinding>): void {\n\t\tif (\n\t\t\treason !== 'ancestry' &&\n\t\t\tshapeBefore.parentId === shapeAfter.parentId &&\n\t\t\tshapeBefore.index === shapeAfter.index\n\t\t) {\n\t\t\treturn\n\t\t}\n\t\treparentArrow(this.editor, binding.fromId)\n\t}\n\n\t// when the arrow is isolated we need to update it's x,y positions\n\toverride onBeforeIsolateFromShape({\n\t\tbinding,\n\t}: BindingOnShapeIsolateOptions<TLArrowBinding>): void {\n\t\tconst arrow = this.editor.getShape<TLArrowShape>(binding.fromId)\n\t\tif (!arrow) return\n\t\tupdateArrowTerminal({\n\t\t\teditor: this.editor,\n\t\t\tarrow,\n\t\t\tterminal: binding.props.terminal,\n\t\t})\n\t}\n}\n\nfunction reparentArrow(editor: Editor, arrowId: TLShapeId) {\n\tconst arrow = editor.getShape<TLArrowShape>(arrowId)\n\tif (!arrow) return\n\tconst bindings = getArrowBindings(editor, arrow)\n\tconst { start, end } = bindings\n\tconst startShape = start ? editor.getShape(start.toId) : undefined\n\tconst endShape = end ? editor.getShape(end.toId) : undefined\n\n\tconst parentPageId = editor.getAncestorPageId(arrow)\n\tif (!parentPageId) return\n\n\tlet nextParentId: TLParentId\n\tif (startShape && endShape) {\n\t\t// if arrow has two bindings, always parent arrow to closest common ancestor of the bindings\n\t\tnextParentId = editor.findCommonAncestor([startShape, endShape]) ?? parentPageId\n\t} else if (startShape || endShape) {\n\t\tconst bindingParentId = (startShape || endShape)?.parentId\n\t\t// If the arrow and the shape that it is bound to have the same parent, then keep that parent\n\t\tif (bindingParentId && bindingParentId === arrow.parentId) {\n\t\t\tnextParentId = arrow.parentId\n\t\t} else {\n\t\t\t// if arrow has one binding, keep arrow on its own page\n\t\t\tnextParentId = parentPageId\n\t\t}\n\t} else {\n\t\treturn\n\t}\n\n\tif (nextParentId && nextParentId !== arrow.parentId) {\n\t\teditor.reparentShapes([arrowId], nextParentId)\n\t}\n\n\tconst reparentedArrow = editor.getShape<TLArrowShape>(arrowId)\n\tif (!reparentedArrow) throw Error('no reparented arrow')\n\n\tconst startSibling = editor.getShapeNearestSibling(reparentedArrow, startShape)\n\tconst endSibling = editor.getShapeNearestSibling(reparentedArrow, endShape)\n\n\tlet highestSibling: TLShape | undefined\n\n\tif (startSibling && endSibling) {\n\t\thighestSibling = startSibling.index > endSibling.index ? startSibling : endSibling\n\t} else if (startSibling && !endSibling) {\n\t\thighestSibling = startSibling\n\t} else if (endSibling && !startSibling) {\n\t\thighestSibling = endSibling\n\t} else {\n\t\treturn\n\t}\n\n\tlet finalIndex: IndexKey\n\n\tconst higherSiblings = editor\n\t\t.getSortedChildIdsForParent(highestSibling.parentId)\n\t\t.map((id) => editor.getShape(id)!)\n\t\t.filter((sibling) => sibling.index > highestSibling!.index)\n\n\tif (higherSiblings.length) {\n\t\t// there are siblings above the highest bound sibling, we need to\n\t\t// insert between them.\n\n\t\t// if the next sibling is also a bound arrow though, we can end up\n\t\t// all fighting for the same indexes. so lets find the next\n\t\t// non-arrow sibling...\n\t\tconst nextHighestNonArrowSibling = higherSiblings.find((sibling) => sibling.type !== 'arrow')\n\n\t\tif (\n\t\t\t// ...then, if we're above the last shape we want to be above...\n\t\t\treparentedArrow.index > highestSibling.index &&\n\t\t\t// ...but below the next non-arrow sibling...\n\t\t\t(!nextHighestNonArrowSibling || reparentedArrow.index < nextHighestNonArrowSibling.index)\n\t\t) {\n\t\t\t// ...then we're already in the right place. no need to update!\n\t\t\treturn\n\t\t}\n\n\t\t// otherwise, we need to find the index between the highest sibling\n\t\t// we want to be above, and the next highest sibling we want to be\n\t\t// below:\n\t\tfinalIndex = getIndexBetween(highestSibling.index, higherSiblings[0].index)\n\t} else {\n\t\t// if there are no siblings above us, we can just get the next index:\n\t\tfinalIndex = getIndexAbove(highestSibling.index)\n\t}\n\n\tif (finalIndex !== reparentedArrow.index) {\n\t\teditor.updateShapes
|
|
5
|
-
"mappings": "AAAA;AAAA,EAKC;AAAA,EAUA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,kBAAkB,cAAc,0BAA0B;AAK5D,MAAM,yBAAyB,YAA4B;AAAA,EACjE,OAAgB,OAAO;AAAA,EAEvB,OAAgB,QAAQ;AAAA,EACxB,OAAgB,aAAa;AAAA,EAEpB,kBAAgD;AACxD,WAAO;AAAA,MACN,WAAW;AAAA,MACX,SAAS;AAAA,MACT,kBAAkB,EAAE,GAAG,KAAK,GAAG,IAAI;AAAA,MACnC,MAAM;AAAA,IACP;AAAA,EACD;AAAA;AAAA,EAGS,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AE,KAAK;AAAA,EAC3E,OAAO;AAEN,iBAAa,cAAc,eAAe,KAAK;AAAA,EAChD;AAEA,MAAI,eAAe,gBAAgB,OAAO;AACzC,WAAO,
|
|
4
|
+
"sourcesContent": ["import {\n\tBindingOnChangeOptions,\n\tBindingOnCreateOptions,\n\tBindingOnShapeChangeOptions,\n\tBindingOnShapeIsolateOptions,\n\tBindingUtil,\n\tEditor,\n\tIndexKey,\n\tTLArrowBinding,\n\tTLArrowBindingProps,\n\tTLArrowShape,\n\tTLParentId,\n\tTLShape,\n\tTLShapeId,\n\tTLShapePartial,\n\tVec,\n\tapproximately,\n\tarrowBindingMigrations,\n\tarrowBindingProps,\n\tassert,\n\tgetIndexAbove,\n\tgetIndexBetween,\n\tintersectLineSegmentCircle,\n} from '@tldraw/editor'\nimport { getArrowBindings, getArrowInfo, removeArrowBinding } from '../../shapes/arrow/shared'\n\n/**\n * @public\n */\nexport class ArrowBindingUtil extends BindingUtil<TLArrowBinding> {\n\tstatic override type = 'arrow'\n\n\tstatic override props = arrowBindingProps\n\tstatic override migrations = arrowBindingMigrations\n\n\toverride getDefaultProps(): Partial<TLArrowBindingProps> {\n\t\treturn {\n\t\t\tisPrecise: false,\n\t\t\tisExact: false,\n\t\t\tnormalizedAnchor: { x: 0.5, y: 0.5 },\n\t\t\tsnap: 'none',\n\t\t}\n\t}\n\n\t// when the binding itself changes\n\toverride onAfterCreate({ binding }: BindingOnCreateOptions<TLArrowBinding>): void {\n\t\tconst arrow = this.editor.getShape(binding.fromId) as TLArrowShape | undefined\n\t\tif (!arrow) return\n\t\tarrowDidUpdate(this.editor, arrow)\n\t}\n\n\t// when the binding itself changes\n\toverride onAfterChange({ bindingAfter }: BindingOnChangeOptions<TLArrowBinding>): void {\n\t\tconst arrow = this.editor.getShape(bindingAfter.fromId) as TLArrowShape | undefined\n\t\tif (!arrow) return\n\t\tarrowDidUpdate(this.editor, arrow)\n\t}\n\n\t// when the arrow itself changes\n\toverride onAfterChangeFromShape({\n\t\tshapeAfter,\n\t}: BindingOnShapeChangeOptions<TLArrowBinding>): void {\n\t\tarrowDidUpdate(this.editor, shapeAfter as TLArrowShape)\n\t}\n\n\t// when the shape an arrow is bound to changes\n\toverride onAfterChangeToShape({\n\t\tbinding,\n\t\tshapeBefore,\n\t\tshapeAfter,\n\t\treason,\n\t}: BindingOnShapeChangeOptions<TLArrowBinding>): void {\n\t\tif (\n\t\t\treason !== 'ancestry' &&\n\t\t\tshapeBefore.parentId === shapeAfter.parentId &&\n\t\t\tshapeBefore.index === shapeAfter.index\n\t\t) {\n\t\t\treturn\n\t\t}\n\t\treparentArrow(this.editor, binding.fromId)\n\t}\n\n\t// when the arrow is isolated we need to update it's x,y positions\n\toverride onBeforeIsolateFromShape({\n\t\tbinding,\n\t}: BindingOnShapeIsolateOptions<TLArrowBinding>): void {\n\t\tconst arrow = this.editor.getShape<TLArrowShape>(binding.fromId)\n\t\tif (!arrow) return\n\t\tupdateArrowTerminal({\n\t\t\teditor: this.editor,\n\t\t\tarrow,\n\t\t\tterminal: binding.props.terminal,\n\t\t})\n\t}\n}\n\nfunction reparentArrow(editor: Editor, arrowId: TLShapeId) {\n\tconst arrow = editor.getShape<TLArrowShape>(arrowId)\n\tif (!arrow) return\n\tconst bindings = getArrowBindings(editor, arrow)\n\tconst { start, end } = bindings\n\tconst startShape = start ? editor.getShape(start.toId) : undefined\n\tconst endShape = end ? editor.getShape(end.toId) : undefined\n\n\tconst parentPageId = editor.getAncestorPageId(arrow)\n\tif (!parentPageId) return\n\n\tlet nextParentId: TLParentId\n\tif (startShape && endShape) {\n\t\t// if arrow has two bindings, always parent arrow to closest common ancestor of the bindings\n\t\tnextParentId = editor.findCommonAncestor([startShape, endShape]) ?? parentPageId\n\t} else if (startShape || endShape) {\n\t\tconst bindingParentId = (startShape || endShape)?.parentId\n\t\t// If the arrow and the shape that it is bound to have the same parent, then keep that parent\n\t\tif (bindingParentId && bindingParentId === arrow.parentId) {\n\t\t\tnextParentId = arrow.parentId\n\t\t} else {\n\t\t\t// if arrow has one binding, keep arrow on its own page\n\t\t\tnextParentId = parentPageId\n\t\t}\n\t} else {\n\t\treturn\n\t}\n\n\tif (nextParentId && nextParentId !== arrow.parentId) {\n\t\teditor.reparentShapes([arrowId], nextParentId)\n\t}\n\n\tconst reparentedArrow = editor.getShape<TLArrowShape>(arrowId)\n\tif (!reparentedArrow) throw Error('no reparented arrow')\n\n\tconst startSibling = editor.getShapeNearestSibling(reparentedArrow, startShape)\n\tconst endSibling = editor.getShapeNearestSibling(reparentedArrow, endShape)\n\n\tlet highestSibling: TLShape | undefined\n\n\tif (startSibling && endSibling) {\n\t\thighestSibling = startSibling.index > endSibling.index ? startSibling : endSibling\n\t} else if (startSibling && !endSibling) {\n\t\thighestSibling = startSibling\n\t} else if (endSibling && !startSibling) {\n\t\thighestSibling = endSibling\n\t} else {\n\t\treturn\n\t}\n\n\tlet finalIndex: IndexKey\n\n\tconst higherSiblings = editor\n\t\t.getSortedChildIdsForParent(highestSibling.parentId)\n\t\t.map((id) => editor.getShape(id)!)\n\t\t.filter((sibling) => sibling.index > highestSibling!.index)\n\n\tif (higherSiblings.length) {\n\t\t// there are siblings above the highest bound sibling, we need to\n\t\t// insert between them.\n\n\t\t// if the next sibling is also a bound arrow though, we can end up\n\t\t// all fighting for the same indexes. so lets find the next\n\t\t// non-arrow sibling...\n\t\tconst nextHighestNonArrowSibling = higherSiblings.find((sibling) => sibling.type !== 'arrow')\n\n\t\tif (\n\t\t\t// ...then, if we're above the last shape we want to be above...\n\t\t\treparentedArrow.index > highestSibling.index &&\n\t\t\t// ...but below the next non-arrow sibling...\n\t\t\t(!nextHighestNonArrowSibling || reparentedArrow.index < nextHighestNonArrowSibling.index)\n\t\t) {\n\t\t\t// ...then we're already in the right place. no need to update!\n\t\t\treturn\n\t\t}\n\n\t\t// otherwise, we need to find the index between the highest sibling\n\t\t// we want to be above, and the next highest sibling we want to be\n\t\t// below:\n\t\tfinalIndex = getIndexBetween(highestSibling.index, higherSiblings[0].index)\n\t} else {\n\t\t// if there are no siblings above us, we can just get the next index:\n\t\tfinalIndex = getIndexAbove(highestSibling.index)\n\t}\n\n\tif (finalIndex !== reparentedArrow.index) {\n\t\teditor.updateShapes([{ id: arrowId, type: 'arrow', index: finalIndex }])\n\t}\n}\n\nfunction arrowDidUpdate(editor: Editor, arrow: TLArrowShape) {\n\tconst bindings = getArrowBindings(editor, arrow)\n\t// if the shape is an arrow and its bound shape is on another page\n\t// or was deleted, unbind it\n\tfor (const handle of ['start', 'end'] as const) {\n\t\tconst binding = bindings[handle]\n\t\tif (!binding) continue\n\t\tconst boundShape = editor.getShape(binding.toId)\n\t\tconst isShapeInSamePageAsArrow =\n\t\t\teditor.getAncestorPageId(arrow) === editor.getAncestorPageId(boundShape)\n\t\tif (!boundShape || !isShapeInSamePageAsArrow) {\n\t\t\tupdateArrowTerminal({ editor, arrow, terminal: handle, unbind: true })\n\t\t}\n\t}\n\n\t// always check the arrow parents\n\treparentArrow(editor, arrow.id)\n}\n\n/** @internal */\nexport function updateArrowTerminal({\n\teditor,\n\tarrow,\n\tterminal,\n\tunbind = false,\n\tuseHandle = false,\n}: {\n\teditor: Editor\n\tarrow: TLArrowShape\n\tterminal: 'start' | 'end'\n\tunbind?: boolean\n\tuseHandle?: boolean\n}) {\n\tconst info = getArrowInfo(editor, arrow)\n\tif (!info) {\n\t\tthrow new Error('expected arrow info')\n\t}\n\n\tconst startPoint = useHandle ? info.start.handle : info.start.point\n\tconst endPoint = useHandle ? info.end.handle : info.end.point\n\tconst point = terminal === 'start' ? startPoint : endPoint\n\n\tconst update = {\n\t\tid: arrow.id,\n\t\ttype: 'arrow',\n\t\tprops: {\n\t\t\t[terminal]: { x: point.x, y: point.y },\n\t\t\tbend: arrow.props.bend,\n\t\t},\n\t} satisfies TLShapePartial<TLArrowShape>\n\n\t// fix up the bend:\n\tif (info.type === 'arc') {\n\t\t// find the new start/end points of the resulting arrow\n\t\tconst newStart = terminal === 'start' ? startPoint : info.start.handle\n\t\tconst newEnd = terminal === 'end' ? endPoint : info.end.handle\n\t\tconst newMidPoint = Vec.Med(newStart, newEnd)\n\n\t\t// intersect a line segment perpendicular to the new arrow with the old arrow arc to\n\t\t// find the new mid-point\n\t\tconst lineSegment = Vec.Sub(newStart, newEnd)\n\t\t\t.per()\n\t\t\t.uni()\n\t\t\t.mul(info.handleArc.radius * 2 * Math.sign(arrow.props.bend))\n\n\t\t// find the intersections with the old arrow arc:\n\t\tconst intersections = intersectLineSegmentCircle(\n\t\t\tinfo.handleArc.center,\n\t\t\tVec.Add(newMidPoint, lineSegment),\n\t\t\tinfo.handleArc.center,\n\t\t\tinfo.handleArc.radius\n\t\t)\n\n\t\tassert(intersections?.length === 1)\n\t\tconst bend = Vec.Dist(newMidPoint, intersections[0]) * Math.sign(arrow.props.bend)\n\t\t// use `approximately` to avoid endless update loops\n\t\tif (!approximately(bend, update.props.bend)) {\n\t\t\tupdate.props.bend = bend\n\t\t}\n\t}\n\n\teditor.updateShape(update)\n\tif (unbind) {\n\t\tremoveArrowBinding(editor, arrow, terminal)\n\t}\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EAKC;AAAA,EAUA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,kBAAkB,cAAc,0BAA0B;AAK5D,MAAM,yBAAyB,YAA4B;AAAA,EACjE,OAAgB,OAAO;AAAA,EAEvB,OAAgB,QAAQ;AAAA,EACxB,OAAgB,aAAa;AAAA,EAEpB,kBAAgD;AACxD,WAAO;AAAA,MACN,WAAW;AAAA,MACX,SAAS;AAAA,MACT,kBAAkB,EAAE,GAAG,KAAK,GAAG,IAAI;AAAA,MACnC,MAAM;AAAA,IACP;AAAA,EACD;AAAA;AAAA,EAGS,cAAc,EAAE,QAAQ,GAAiD;AACjF,UAAM,QAAQ,KAAK,OAAO,SAAS,QAAQ,MAAM;AACjD,QAAI,CAAC,MAAO;AAC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M,cAAc,IAAI,IAAI,UAAU,MAAM;AAI5C,UAAM,cAAc,IAAI,IAAI,UAAU,MAAM,EAC1C,IAAI,EACJ,IAAI,EACJ,IAAI,KAAK,UAAU,SAAS,IAAI,KAAK,KAAK,MAAM,MAAM,IAAI,CAAC;AAG7D,UAAM,gBAAgB;AAAA,MACrB,KAAK,UAAU;AAAA,MACf,IAAI,IAAI,aAAa,WAAW;AAAA,MAChC,KAAK,UAAU;AAAA,MACf,KAAK,UAAU;AAAA,IAChB;AAEA,WAAO,eAAe,WAAW,CAAC;AAClC,UAAM,OAAO,IAAI,KAAK,aAAa,cAAc,CAAC,CAAC,IAAI,KAAK,KAAK,MAAM,MAAM,IAAI;AAEjF,QAAI,CAAC,cAAc,MAAM,OAAO,MAAM,IAAI,GAAG;AAC5C,aAAO,MAAM,OAAO;AAAA,IACrB;AAAA,EACD;AAEA,SAAO,YAAY,MAAM;AACzB,MAAI,QAAQ;AACX,uBAAmB,QAAQ,OAAO,QAAQ;AAAA,EAC3C;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/canvas/TldrawSelectionForeground.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n\tBox,\n\tHALF_PI,\n\tRotateCorner,\n\tTLEmbedShape,\n\tTLImageShape,\n\tTLSelectionForegroundProps,\n\tTLTextShape,\n\tTLVideoShape,\n\tgetCursor,\n\ttlenv,\n\ttoDomPrecision,\n\ttrack,\n\tuseEditor,\n\tuseSelectionEvents,\n\tuseTransform,\n\tuseValue,\n} from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { PointerEventHandler, useRef } from 'react'\nimport { useReadonly } from '../ui/hooks/useReadonly'\nimport { useTranslation } from '../ui/hooks/useTranslation/useTranslation'\nimport { TldrawCropHandles } from './TldrawCropHandles'\n\n/** @public */\nexport const TldrawSelectionForeground = track(function TldrawSelectionForeground({\n\tbounds,\n\trotation,\n}: TLSelectionForegroundProps) {\n\tconst editor = useEditor()\n\tconst msg = useTranslation()\n\tconst rSvg = useRef<SVGSVGElement>(null)\n\n\tconst isReadonlyMode = useReadonly()\n\tconst topEvents = useSelectionEvents('top')\n\tconst rightEvents = useSelectionEvents('right')\n\tconst bottomEvents = useSelectionEvents('bottom')\n\tconst leftEvents = useSelectionEvents('left')\n\tconst topLeftEvents = useSelectionEvents('top_left')\n\tconst topRightEvents = useSelectionEvents('top_right')\n\tconst bottomRightEvents = useSelectionEvents('bottom_right')\n\tconst bottomLeftEvents = useSelectionEvents('bottom_left')\n\n\tconst isDefaultCursor = editor.getInstanceState().cursor.type === 'default'\n\tconst isCoarsePointer = editor.getInstanceState().isCoarsePointer\n\n\tconst onlyShape = editor.getOnlySelectedShape()\n\tconst isLockedShape = onlyShape && editor.isShapeOrAncestorLocked(onlyShape)\n\n\t// if all shapes have an expandBy for the selection outline, we can expand by the l\n\tconst expandOutlineBy = onlyShape\n\t\t? editor.getShapeUtil(onlyShape).expandSelectionOutlinePx(onlyShape)\n\t\t: 0\n\n\tconst expandedBounds =\n\t\texpandOutlineBy instanceof Box\n\t\t\t? bounds.clone().expand(expandOutlineBy).zeroFix()\n\t\t\t: bounds.clone().expandBy(expandOutlineBy).zeroFix()\n\n\tconst selectionRotation = editor.getSelectionRotation()\n\tconst isShapeTooCloseToContextualToolbar =\n\t\tselectionRotation / HALF_PI > 1.6 && selectionRotation / HALF_PI < 2.4\n\tuseTransform(rSvg, bounds?.x, bounds?.y, 1, selectionRotation, {\n\t\tx: expandedBounds.x - bounds.x,\n\t\ty: expandedBounds.y - bounds.y,\n\t})\n\n\tif (onlyShape && editor.isShapeHidden(onlyShape)) return null\n\n\tconst zoom = editor.getZoomLevel()\n\tconst isChangingStyle = editor.getInstanceState().isChangingStyle\n\n\tconst width = expandedBounds.width\n\tconst height = expandedBounds.height\n\n\tconst size = 8 / zoom\n\tconst isTinyX = width < size * 2\n\tconst isTinyY = height < size * 2\n\n\tconst isSmallX = width < size * 4\n\tconst isSmallY = height < size * 4\n\tconst isSmallCropX = width < size * 5\n\tconst isSmallCropY = height < size * 5\n\n\tconst mobileHandleMultiplier = isCoarsePointer ? 1.75 : 1\n\tconst targetSize = (6 / zoom) * mobileHandleMultiplier\n\n\tconst targetSizeX = (isSmallX ? targetSize / 2 : targetSize) * (mobileHandleMultiplier * 0.75)\n\tconst targetSizeY = (isSmallY ? targetSize / 2 : targetSize) * (mobileHandleMultiplier * 0.75)\n\n\tconst showSelectionBounds =\n\t\t(onlyShape ? !editor.getShapeUtil(onlyShape).hideSelectionBoundsFg(onlyShape) : true) &&\n\t\t!isChangingStyle\n\n\tlet shouldDisplayBox =\n\t\t(showSelectionBounds &&\n\t\t\teditor.isInAny(\n\t\t\t\t'select.idle',\n\t\t\t\t'select.brushing',\n\t\t\t\t'select.scribble_brushing',\n\t\t\t\t'select.pointing_canvas',\n\t\t\t\t'select.pointing_selection',\n\t\t\t\t'select.pointing_shape',\n\t\t\t\t'select.crop.idle',\n\t\t\t\t'select.crop.pointing_crop',\n\t\t\t\t'select.crop.pointing_crop_handle',\n\t\t\t\t'select.pointing_resize_handle'\n\t\t\t)) ||\n\t\t(showSelectionBounds &&\n\t\t\teditor.isIn('select.resizing') &&\n\t\t\tonlyShape &&\n\t\t\teditor.isShapeOfType<TLTextShape>(onlyShape, 'text'))\n\n\tif (onlyShape && shouldDisplayBox) {\n\t\tif (tlenv.isFirefox && editor.isShapeOfType<TLEmbedShape>(onlyShape, 'embed')) {\n\t\t\tshouldDisplayBox = false\n\t\t}\n\t}\n\n\tconst showCropHandles =\n\t\teditor.isInAny(\n\t\t\t'select.crop.idle',\n\t\t\t'select.crop.pointing_crop',\n\t\t\t'select.crop.pointing_crop_handle'\n\t\t) &&\n\t\t!isChangingStyle &&\n\t\t!isReadonlyMode\n\n\tconst shouldDisplayControls =\n\t\teditor.isInAny(\n\t\t\t'select.idle',\n\t\t\t'select.pointing_selection',\n\t\t\t'select.pointing_shape',\n\t\t\t'select.crop.idle'\n\t\t) &&\n\t\t!isChangingStyle &&\n\t\t!isReadonlyMode\n\n\tconst showCornerRotateHandles =\n\t\t!isCoarsePointer &&\n\t\t!(isTinyX || isTinyY) &&\n\t\t(shouldDisplayControls || showCropHandles) &&\n\t\t(onlyShape ? !editor.getShapeUtil(onlyShape).hideRotateHandle(onlyShape) : true) &&\n\t\t!isLockedShape\n\n\tconst showMobileRotateHandle =\n\t\tisCoarsePointer &&\n\t\t(!isSmallX || !isSmallY) &&\n\t\t(shouldDisplayControls || showCropHandles) &&\n\t\t(onlyShape ? !editor.getShapeUtil(onlyShape).hideRotateHandle(onlyShape) : true) &&\n\t\t!isLockedShape\n\n\tconst showResizeHandles =\n\t\tshouldDisplayControls &&\n\t\t(onlyShape\n\t\t\t? editor.getShapeUtil(onlyShape).canResize(onlyShape) &&\n\t\t\t\t!editor.getShapeUtil(onlyShape).hideResizeHandles(onlyShape)\n\t\t\t: true) &&\n\t\t!showCropHandles &&\n\t\t!isLockedShape\n\n\tconst hideAlternateCornerHandles = isTinyX || isTinyY\n\tconst showOnlyOneHandle = isTinyX && isTinyY\n\tconst hideAlternateCropHandles = isSmallCropX || isSmallCropY\n\n\tconst showHandles = showResizeHandles || showCropHandles\n\tconst hideRotateCornerHandles = !showCornerRotateHandles\n\tconst hideMobileRotateHandle = !shouldDisplayControls || !showMobileRotateHandle\n\tconst hideTopLeftCorner = !shouldDisplayControls || !showHandles\n\tconst hideTopRightCorner = !shouldDisplayControls || !showHandles || hideAlternateCornerHandles\n\tconst hideBottomLeftCorner = !shouldDisplayControls || !showHandles || hideAlternateCornerHandles\n\tconst hideBottomRightCorner =\n\t\t!shouldDisplayControls || !showHandles || (showOnlyOneHandle && !showCropHandles)\n\n\t// If we're showing crop handles, then show the edges too.\n\t// If we're showing resize handles, then show the edges only\n\t// if we're not hiding them for some other reason.\n\tlet hideVerticalEdgeTargets = true\n\t// The same logic above applies here, except another nuance is that\n\t// we enable resizing for text on mobile (coarse).\n\tlet hideHorizontalEdgeTargets = true\n\n\tif (showCropHandles) {\n\t\thideVerticalEdgeTargets = hideAlternateCropHandles\n\t\thideHorizontalEdgeTargets = hideAlternateCropHandles\n\t} else if (showResizeHandles) {\n\t\thideVerticalEdgeTargets = hideAlternateCornerHandles || showOnlyOneHandle || isCoarsePointer\n\t\tconst isMobileAndTextShape = isCoarsePointer && onlyShape && onlyShape.type === 'text'\n\t\thideHorizontalEdgeTargets = hideVerticalEdgeTargets && !isMobileAndTextShape\n\t}\n\n\tconst textHandleHeight = Math.min(24 / zoom, height - targetSizeY * 3)\n\tconst showTextResizeHandles =\n\t\tshouldDisplayControls &&\n\t\tisCoarsePointer &&\n\t\tonlyShape &&\n\t\teditor.isShapeOfType<TLTextShape>(onlyShape, 'text') &&\n\t\ttextHandleHeight * zoom >= 4\n\tconst isMediaShape =\n\t\tonlyShape &&\n\t\t(editor.isShapeOfType<TLImageShape>(onlyShape, 'image') ||\n\t\t\teditor.isShapeOfType<TLVideoShape>(onlyShape, 'video'))\n\n\treturn (\n\t\t<svg\n\t\t\tclassName=\"tl-overlays__item tl-selection__fg\"\n\t\t\tdata-testid=\"selection-foreground\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<g ref={rSvg}>\n\t\t\t\t{shouldDisplayBox && (\n\t\t\t\t\t<rect\n\t\t\t\t\t\tclassName=\"tl-selection__fg__outline\"\n\t\t\t\t\t\twidth={toDomPrecision(width)}\n\t\t\t\t\t\theight={toDomPrecision(height)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<RotateCornerHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.top-left\"\n\t\t\t\t\tcx={0}\n\t\t\t\t\tcy={0}\n\t\t\t\t\ttargetSize={targetSize}\n\t\t\t\t\tcorner=\"top_left_rotate\"\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nwse-rotate', rotation) : undefined}\n\t\t\t\t\tisHidden={hideRotateCornerHandles}\n\t\t\t\t/>\n\t\t\t\t<RotateCornerHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.top-right\"\n\t\t\t\t\tcx={width + targetSize * 3}\n\t\t\t\t\tcy={0}\n\t\t\t\t\ttargetSize={targetSize}\n\t\t\t\t\tcorner=\"top_right_rotate\"\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nesw-rotate', rotation) : undefined}\n\t\t\t\t\tisHidden={hideRotateCornerHandles}\n\t\t\t\t/>\n\t\t\t\t<RotateCornerHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.bottom-left\"\n\t\t\t\t\tcx={0}\n\t\t\t\t\tcy={height + targetSize * 3}\n\t\t\t\t\ttargetSize={targetSize}\n\t\t\t\t\tcorner=\"bottom_left_rotate\"\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('swne-rotate', rotation) : undefined}\n\t\t\t\t\tisHidden={hideRotateCornerHandles}\n\t\t\t\t/>\n\t\t\t\t<RotateCornerHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.bottom-right\"\n\t\t\t\t\tcx={width + targetSize * 3}\n\t\t\t\t\tcy={height + targetSize * 3}\n\t\t\t\t\ttargetSize={targetSize}\n\t\t\t\t\tcorner=\"bottom_right_rotate\"\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('senw-rotate', rotation) : undefined}\n\t\t\t\t\tisHidden={hideRotateCornerHandles}\n\t\t\t\t/>\n\t\t\t\t<MobileRotateHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.mobile\"\n\t\t\t\t\tcx={isSmallX ? -targetSize * 1.5 : width / 2}\n\t\t\t\t\tcy={\n\t\t\t\t\t\tisSmallX\n\t\t\t\t\t\t\t? height / 2\n\t\t\t\t\t\t\t: isMediaShape && !isShapeTooCloseToContextualToolbar\n\t\t\t\t\t\t\t\t? height + targetSize * 1.5\n\t\t\t\t\t\t\t\t: -targetSize * 1.5\n\t\t\t\t\t}\n\t\t\t\t\tsize={size}\n\t\t\t\t\tisHidden={hideMobileRotateHandle}\n\t\t\t\t/>\n\t\t\t\t{/* Targets */}\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideVerticalEdgeTargets}\n\t\t\t\t\tdataTestId=\"selection.resize.top\"\n\t\t\t\t\tariaLabel={msg('handle.resize-top')}\n\t\t\t\t\tx={0}\n\t\t\t\t\ty={toDomPrecision(0 - (isSmallY ? targetSizeY * 2 : targetSizeY))}\n\t\t\t\t\twidth={toDomPrecision(width)}\n\t\t\t\t\theight={toDomPrecision(Math.max(1, targetSizeY * 2))}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('ns-resize', rotation) : undefined}\n\t\t\t\t\tevents={topEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideHorizontalEdgeTargets}\n\t\t\t\t\tdataTestId=\"selection.resize.right\"\n\t\t\t\t\tariaLabel={msg('handle.resize-right')}\n\t\t\t\t\tx={toDomPrecision(width - (isSmallX ? 0 : targetSizeX))}\n\t\t\t\t\ty={0}\n\t\t\t\t\theight={toDomPrecision(height)}\n\t\t\t\t\twidth={toDomPrecision(Math.max(1, targetSizeX * 2))}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('ew-resize', rotation) : undefined}\n\t\t\t\t\tevents={rightEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideVerticalEdgeTargets}\n\t\t\t\t\tdataTestId=\"selection.resize.bottom\"\n\t\t\t\t\tariaLabel={msg('handle.resize-bottom')}\n\t\t\t\t\tx={0}\n\t\t\t\t\ty={toDomPrecision(height - (isSmallY ? 0 : targetSizeY))}\n\t\t\t\t\twidth={toDomPrecision(width)}\n\t\t\t\t\theight={toDomPrecision(Math.max(1, targetSizeY * 2))}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('ns-resize', rotation) : undefined}\n\t\t\t\t\tevents={bottomEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideHorizontalEdgeTargets}\n\t\t\t\t\tdataTestId=\"selection.resize.left\"\n\t\t\t\t\tariaLabel={msg('handle.resize-left')}\n\t\t\t\t\tx={toDomPrecision(0 - (isSmallX ? targetSizeX * 2 : targetSizeX))}\n\t\t\t\t\ty={0}\n\t\t\t\t\theight={toDomPrecision(height)}\n\t\t\t\t\twidth={toDomPrecision(Math.max(1, targetSizeX * 2))}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('ew-resize', rotation) : undefined}\n\t\t\t\t\tevents={leftEvents}\n\t\t\t\t/>\n\t\t\t\t{/* Corner Targets */}\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideTopLeftCorner}\n\t\t\t\t\tdataTestId=\"selection.target.top-left\"\n\t\t\t\t\tariaLabel={msg('handle.resize-top-left')}\n\t\t\t\t\tx={toDomPrecision(0 - (isSmallX ? targetSizeX * 2 : targetSizeX * 1.5))}\n\t\t\t\t\ty={toDomPrecision(0 - (isSmallY ? targetSizeY * 2 : targetSizeY * 1.5))}\n\t\t\t\t\twidth={toDomPrecision(targetSizeX * 3)}\n\t\t\t\t\theight={toDomPrecision(targetSizeY * 3)}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nwse-resize', rotation) : undefined}\n\t\t\t\t\tevents={topLeftEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideTopRightCorner}\n\t\t\t\t\tdataTestId=\"selection.target.top-right\"\n\t\t\t\t\tariaLabel={msg('handle.resize-top-right')}\n\t\t\t\t\tx={toDomPrecision(width - (isSmallX ? 0 : targetSizeX * 1.5))}\n\t\t\t\t\ty={toDomPrecision(0 - (isSmallY ? targetSizeY * 2 : targetSizeY * 1.5))}\n\t\t\t\t\twidth={toDomPrecision(targetSizeX * 3)}\n\t\t\t\t\theight={toDomPrecision(targetSizeY * 3)}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nesw-resize', rotation) : undefined}\n\t\t\t\t\tevents={topRightEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideBottomRightCorner}\n\t\t\t\t\tdataTestId=\"selection.target.bottom-right\"\n\t\t\t\t\tariaLabel={msg('handle.resize-bottom-right')}\n\t\t\t\t\tx={toDomPrecision(width - (isSmallX ? targetSizeX : targetSizeX * 1.5))}\n\t\t\t\t\ty={toDomPrecision(height - (isSmallY ? targetSizeY : targetSizeY * 1.5))}\n\t\t\t\t\twidth={toDomPrecision(targetSizeX * 3)}\n\t\t\t\t\theight={toDomPrecision(targetSizeY * 3)}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nwse-resize', rotation) : undefined}\n\t\t\t\t\tevents={bottomRightEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideBottomLeftCorner}\n\t\t\t\t\tdataTestId=\"selection.target.bottom-left\"\n\t\t\t\t\tariaLabel={msg('handle.resize-bottom-left')}\n\t\t\t\t\tx={toDomPrecision(0 - (isSmallX ? targetSizeX * 3 : targetSizeX * 1.5))}\n\t\t\t\t\ty={toDomPrecision(height - (isSmallY ? 0 : targetSizeY * 1.5))}\n\t\t\t\t\twidth={toDomPrecision(targetSizeX * 3)}\n\t\t\t\t\theight={toDomPrecision(targetSizeY * 3)}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nesw-resize', rotation) : undefined}\n\t\t\t\t\tevents={bottomLeftEvents}\n\t\t\t\t/>\n\t\t\t\t{/* Resize Handles */}\n\t\t\t\t{showResizeHandles && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.resize.top-left\"\n\t\t\t\t\t\t\tclassName={classNames('tl-corner-handle', {\n\t\t\t\t\t\t\t\t'tl-hidden': hideTopLeftCorner,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tx={toDomPrecision(0 - size / 2)}\n\t\t\t\t\t\t\ty={toDomPrecision(0 - size / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size)}\n\t\t\t\t\t\t\theight={toDomPrecision(size)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.resize.top-right\"\n\t\t\t\t\t\t\tclassName={classNames('tl-corner-handle', {\n\t\t\t\t\t\t\t\t'tl-hidden': hideTopRightCorner,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tx={toDomPrecision(width - size / 2)}\n\t\t\t\t\t\t\ty={toDomPrecision(0 - size / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size)}\n\t\t\t\t\t\t\theight={toDomPrecision(size)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.resize.bottom-right\"\n\t\t\t\t\t\t\tclassName={classNames('tl-corner-handle', {\n\t\t\t\t\t\t\t\t'tl-hidden': hideBottomRightCorner,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tx={toDomPrecision(width - size / 2)}\n\t\t\t\t\t\t\ty={toDomPrecision(height - size / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size)}\n\t\t\t\t\t\t\theight={toDomPrecision(size)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.resize.bottom-left\"\n\t\t\t\t\t\t\tclassName={classNames('tl-corner-handle', {\n\t\t\t\t\t\t\t\t'tl-hidden': hideBottomLeftCorner,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tx={toDomPrecision(0 - size / 2)}\n\t\t\t\t\t\t\ty={toDomPrecision(height - size / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size)}\n\t\t\t\t\t\t\theight={toDomPrecision(size)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{showTextResizeHandles && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.text-resize.left.handle\"\n\t\t\t\t\t\t\tclassName=\"tl-text-handle\"\n\t\t\t\t\t\t\tx={toDomPrecision(0 - size / 4)}\n\t\t\t\t\t\t\ty={toDomPrecision(height / 2 - textHandleHeight / 2)}\n\t\t\t\t\t\t\trx={size / 4}\n\t\t\t\t\t\t\twidth={toDomPrecision(size / 2)}\n\t\t\t\t\t\t\theight={toDomPrecision(textHandleHeight)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.text-resize.right.handle\"\n\t\t\t\t\t\t\tclassName=\"tl-text-handle\"\n\t\t\t\t\t\t\trx={size / 4}\n\t\t\t\t\t\t\tx={toDomPrecision(width - size / 4)}\n\t\t\t\t\t\t\ty={toDomPrecision(height / 2 - textHandleHeight / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size / 2)}\n\t\t\t\t\t\t\theight={toDomPrecision(textHandleHeight)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{/* Crop Handles */}\n\t\t\t\t{showCropHandles && (\n\t\t\t\t\t<TldrawCropHandles\n\t\t\t\t\t\t{...{\n\t\t\t\t\t\t\tsize,\n\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\theight,\n\t\t\t\t\t\t\thideAlternateHandles: hideAlternateCropHandles,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</g>\n\t\t</svg>\n\t)\n})\n\nexport const ResizeHandle = function ResizeHandle({\n\thide,\n\tdataTestId,\n\tariaLabel,\n\tx,\n\ty,\n\twidth,\n\theight,\n\tcursor,\n\tevents,\n}: {\n\thide: boolean\n\tdataTestId: string\n\tariaLabel: string\n\tx: number\n\ty: number\n\twidth: number\n\theight: number\n\tcursor?: string\n\tevents: {\n\t\tonPointerUp: PointerEventHandler<Element>\n\t\tonPointerMove(e: React.PointerEvent<Element>): void\n\t\tonPointerDown: PointerEventHandler<Element>\n\t}\n}) {\n\treturn (\n\t\t<rect\n\t\t\tclassName={classNames('tl-resize-handle', 'tl-transparent', {\n\t\t\t\t'tl-hidden': hide,\n\t\t\t})}\n\t\t\tdata-testid={dataTestId}\n\t\t\trole=\"button\"\n\t\t\taria-label={ariaLabel}\n\t\t\tpointerEvents=\"all\"\n\t\t\tx={x}\n\t\t\ty={y}\n\t\t\twidth={width}\n\t\t\theight={height}\n\t\t\tcursor={cursor}\n\t\t\t{...events}\n\t\t/>\n\t)\n}\n\nexport const RotateCornerHandle = function RotateCornerHandle({\n\tcx,\n\tcy,\n\ttargetSize,\n\tcorner,\n\tcursor,\n\tisHidden,\n\t'data-testid': testId,\n}: {\n\tcx: number\n\tcy: number\n\ttargetSize: number\n\tcorner: RotateCorner\n\tcursor?: string\n\tisHidden: boolean\n\t'data-testid'?: string\n}) {\n\tconst events = useSelectionEvents(corner)\n\tconst msg = useTranslation()\n\tconst label = msg(`handle.rotate.${corner}`)\n\n\treturn (\n\t\t<rect\n\t\t\tclassName={classNames('tl-transparent', 'tl-rotate-corner', { 'tl-hidden': isHidden })}\n\t\t\tdata-testid={testId}\n\t\t\trole=\"button\"\n\t\t\taria-label={label}\n\t\t\tpointerEvents=\"all\"\n\t\t\tx={toDomPrecision(cx - targetSize * 3)}\n\t\t\ty={toDomPrecision(cy - targetSize * 3)}\n\t\t\twidth={toDomPrecision(Math.max(1, targetSize * 3))}\n\t\t\theight={toDomPrecision(Math.max(1, targetSize * 3))}\n\t\t\tcursor={cursor}\n\t\t\t{...events}\n\t\t/>\n\t)\n}\n\nconst SQUARE_ROOT_PI = Math.sqrt(Math.PI)\n\nexport const MobileRotateHandle = function RotateHandle({\n\tcx,\n\tcy,\n\tsize,\n\tisHidden,\n\t'data-testid': testId,\n}: {\n\tcx: number\n\tcy: number\n\tsize: number\n\tisHidden: boolean\n\t'data-testid'?: string\n}) {\n\tconst events = useSelectionEvents('mobile_rotate')\n\n\tconst editor = useEditor()\n\tconst zoom = useValue('zoom level', () => editor.getZoomLevel(), [editor])\n\tconst bgRadius = Math.max(14 * (1 / zoom), 20 / Math.max(1, zoom))\n\tconst msg = useTranslation()\n\treturn (\n\t\t<g role=\"button\" aria-label={msg('handle.rotate.mobile_rotate')}>\n\t\t\t<circle\n\t\t\t\tdata-testid={testId}\n\t\t\t\tpointerEvents=\"all\"\n\t\t\t\tclassName={classNames('tl-transparent', 'tl-mobile-rotate__bg', { 'tl-hidden': isHidden })}\n\t\t\t\tcx={cx}\n\t\t\t\tcy={cy}\n\t\t\t\tr={bgRadius}\n\t\t\t\t{...events}\n\t\t\t/>\n\t\t\t<circle\n\t\t\t\tclassName={classNames('tl-mobile-rotate__fg', { 'tl-hidden': isHidden })}\n\t\t\t\tcx={cx}\n\t\t\t\tcy={cy}\n\t\t\t\tr={size / SQUARE_ROOT_PI}\n\t\t\t/>\n\t\t</g>\n\t)\n}\n"],
|
|
5
|
-
"mappings": "AAmNK,SAmJA,UAnJA,KAmJA,YAnJA;AAnNL;AAAA,EACC;AAAA,EACA;AAAA,EAOA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,gBAAgB;AACvB,SAA8B,cAAc;AAC5C,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAG3B,MAAM,4BAA4B,MAAM,SAASA,2BAA0B;AAAA,EACjF;AAAA,EACA;AACD,GAA+B;AAC9B,QAAM,SAAS,UAAU;AACzB,QAAM,MAAM,eAAe;AAC3B,QAAM,OAAO,OAAsB,IAAI;AAEvC,QAAM,iBAAiB,YAAY;AACnC,QAAM,YAAY,mBAAmB,KAAK;AAC1C,QAAM,cAAc,mBAAmB,OAAO;AAC9C,QAAM,eAAe,mBAAmB,QAAQ;AAChD,QAAM,aAAa,mBAAmB,MAAM;AAC5C,QAAM,gBAAgB,mBAAmB,UAAU;AACnD,QAAM,iBAAiB,mBAAmB,WAAW;AACrD,QAAM,oBAAoB,mBAAmB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I,\n\tRotateCorner,\n\tTLSelectionForegroundProps,\n\tgetCursor,\n\ttlenv,\n\ttoDomPrecision,\n\ttrack,\n\tuseEditor,\n\tuseSelectionEvents,\n\tuseTransform,\n\tuseValue,\n} from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { PointerEventHandler, useRef } from 'react'\nimport { useReadonly } from '../ui/hooks/useReadonly'\nimport { useTranslation } from '../ui/hooks/useTranslation/useTranslation'\nimport { TldrawCropHandles } from './TldrawCropHandles'\n\n/** @public */\nexport const TldrawSelectionForeground = track(function TldrawSelectionForeground({\n\tbounds,\n\trotation,\n}: TLSelectionForegroundProps) {\n\tconst editor = useEditor()\n\tconst msg = useTranslation()\n\tconst rSvg = useRef<SVGSVGElement>(null)\n\n\tconst isReadonlyMode = useReadonly()\n\tconst topEvents = useSelectionEvents('top')\n\tconst rightEvents = useSelectionEvents('right')\n\tconst bottomEvents = useSelectionEvents('bottom')\n\tconst leftEvents = useSelectionEvents('left')\n\tconst topLeftEvents = useSelectionEvents('top_left')\n\tconst topRightEvents = useSelectionEvents('top_right')\n\tconst bottomRightEvents = useSelectionEvents('bottom_right')\n\tconst bottomLeftEvents = useSelectionEvents('bottom_left')\n\n\tconst isDefaultCursor = editor.getInstanceState().cursor.type === 'default'\n\tconst isCoarsePointer = editor.getInstanceState().isCoarsePointer\n\n\tconst onlyShape = editor.getOnlySelectedShape()\n\tconst isLockedShape = onlyShape && editor.isShapeOrAncestorLocked(onlyShape)\n\n\t// if all shapes have an expandBy for the selection outline, we can expand by the l\n\tconst expandOutlineBy = onlyShape\n\t\t? editor.getShapeUtil(onlyShape).expandSelectionOutlinePx(onlyShape)\n\t\t: 0\n\n\tconst expandedBounds =\n\t\texpandOutlineBy instanceof Box\n\t\t\t? bounds.clone().expand(expandOutlineBy).zeroFix()\n\t\t\t: bounds.clone().expandBy(expandOutlineBy).zeroFix()\n\n\tconst selectionRotation = editor.getSelectionRotation()\n\tconst isShapeTooCloseToContextualToolbar =\n\t\tselectionRotation / HALF_PI > 1.6 && selectionRotation / HALF_PI < 2.4\n\tuseTransform(rSvg, bounds?.x, bounds?.y, 1, selectionRotation, {\n\t\tx: expandedBounds.x - bounds.x,\n\t\ty: expandedBounds.y - bounds.y,\n\t})\n\n\tif (onlyShape && editor.isShapeHidden(onlyShape)) return null\n\n\tconst zoom = editor.getZoomLevel()\n\tconst isChangingStyle = editor.getInstanceState().isChangingStyle\n\n\tconst width = expandedBounds.width\n\tconst height = expandedBounds.height\n\n\tconst size = 8 / zoom\n\tconst isTinyX = width < size * 2\n\tconst isTinyY = height < size * 2\n\n\tconst isSmallX = width < size * 4\n\tconst isSmallY = height < size * 4\n\tconst isSmallCropX = width < size * 5\n\tconst isSmallCropY = height < size * 5\n\n\tconst mobileHandleMultiplier = isCoarsePointer ? 1.75 : 1\n\tconst targetSize = (6 / zoom) * mobileHandleMultiplier\n\n\tconst targetSizeX = (isSmallX ? targetSize / 2 : targetSize) * (mobileHandleMultiplier * 0.75)\n\tconst targetSizeY = (isSmallY ? targetSize / 2 : targetSize) * (mobileHandleMultiplier * 0.75)\n\n\tconst showSelectionBounds =\n\t\t(onlyShape ? !editor.getShapeUtil(onlyShape).hideSelectionBoundsFg(onlyShape) : true) &&\n\t\t!isChangingStyle\n\n\tlet shouldDisplayBox =\n\t\t(showSelectionBounds &&\n\t\t\teditor.isInAny(\n\t\t\t\t'select.idle',\n\t\t\t\t'select.brushing',\n\t\t\t\t'select.scribble_brushing',\n\t\t\t\t'select.pointing_canvas',\n\t\t\t\t'select.pointing_selection',\n\t\t\t\t'select.pointing_shape',\n\t\t\t\t'select.crop.idle',\n\t\t\t\t'select.crop.pointing_crop',\n\t\t\t\t'select.crop.pointing_crop_handle',\n\t\t\t\t'select.pointing_resize_handle'\n\t\t\t)) ||\n\t\t(showSelectionBounds &&\n\t\t\teditor.isIn('select.resizing') &&\n\t\t\tonlyShape &&\n\t\t\teditor.isShapeOfType(onlyShape, 'text'))\n\n\tif (onlyShape && shouldDisplayBox) {\n\t\tif (tlenv.isFirefox && editor.isShapeOfType(onlyShape, 'embed')) {\n\t\t\tshouldDisplayBox = false\n\t\t}\n\t}\n\n\tconst showCropHandles =\n\t\teditor.isInAny(\n\t\t\t'select.crop.idle',\n\t\t\t'select.crop.pointing_crop',\n\t\t\t'select.crop.pointing_crop_handle'\n\t\t) &&\n\t\t!isChangingStyle &&\n\t\t!isReadonlyMode\n\n\tconst shouldDisplayControls =\n\t\teditor.isInAny(\n\t\t\t'select.idle',\n\t\t\t'select.pointing_selection',\n\t\t\t'select.pointing_shape',\n\t\t\t'select.crop.idle'\n\t\t) &&\n\t\t!isChangingStyle &&\n\t\t!isReadonlyMode\n\n\tconst showCornerRotateHandles =\n\t\t!isCoarsePointer &&\n\t\t!(isTinyX || isTinyY) &&\n\t\t(shouldDisplayControls || showCropHandles) &&\n\t\t(onlyShape ? !editor.getShapeUtil(onlyShape).hideRotateHandle(onlyShape) : true) &&\n\t\t!isLockedShape\n\n\tconst showMobileRotateHandle =\n\t\tisCoarsePointer &&\n\t\t(!isSmallX || !isSmallY) &&\n\t\t(shouldDisplayControls || showCropHandles) &&\n\t\t(onlyShape ? !editor.getShapeUtil(onlyShape).hideRotateHandle(onlyShape) : true) &&\n\t\t!isLockedShape\n\n\tconst showResizeHandles =\n\t\tshouldDisplayControls &&\n\t\t(onlyShape\n\t\t\t? editor.getShapeUtil(onlyShape).canResize(onlyShape) &&\n\t\t\t\t!editor.getShapeUtil(onlyShape).hideResizeHandles(onlyShape)\n\t\t\t: true) &&\n\t\t!showCropHandles &&\n\t\t!isLockedShape\n\n\tconst hideAlternateCornerHandles = isTinyX || isTinyY\n\tconst showOnlyOneHandle = isTinyX && isTinyY\n\tconst hideAlternateCropHandles = isSmallCropX || isSmallCropY\n\n\tconst showHandles = showResizeHandles || showCropHandles\n\tconst hideRotateCornerHandles = !showCornerRotateHandles\n\tconst hideMobileRotateHandle = !shouldDisplayControls || !showMobileRotateHandle\n\tconst hideTopLeftCorner = !shouldDisplayControls || !showHandles\n\tconst hideTopRightCorner = !shouldDisplayControls || !showHandles || hideAlternateCornerHandles\n\tconst hideBottomLeftCorner = !shouldDisplayControls || !showHandles || hideAlternateCornerHandles\n\tconst hideBottomRightCorner =\n\t\t!shouldDisplayControls || !showHandles || (showOnlyOneHandle && !showCropHandles)\n\n\t// If we're showing crop handles, then show the edges too.\n\t// If we're showing resize handles, then show the edges only\n\t// if we're not hiding them for some other reason.\n\tlet hideVerticalEdgeTargets = true\n\t// The same logic above applies here, except another nuance is that\n\t// we enable resizing for text on mobile (coarse).\n\tlet hideHorizontalEdgeTargets = true\n\n\tif (showCropHandles) {\n\t\thideVerticalEdgeTargets = hideAlternateCropHandles\n\t\thideHorizontalEdgeTargets = hideAlternateCropHandles\n\t} else if (showResizeHandles) {\n\t\thideVerticalEdgeTargets = hideAlternateCornerHandles || showOnlyOneHandle || isCoarsePointer\n\t\tconst isMobileAndTextShape = isCoarsePointer && onlyShape && onlyShape.type === 'text'\n\t\thideHorizontalEdgeTargets = hideVerticalEdgeTargets && !isMobileAndTextShape\n\t}\n\n\tconst textHandleHeight = Math.min(24 / zoom, height - targetSizeY * 3)\n\tconst showTextResizeHandles =\n\t\tshouldDisplayControls &&\n\t\tisCoarsePointer &&\n\t\tonlyShape &&\n\t\teditor.isShapeOfType(onlyShape, 'text') &&\n\t\ttextHandleHeight * zoom >= 4\n\tconst isMediaShape =\n\t\tonlyShape &&\n\t\t(editor.isShapeOfType(onlyShape, 'image') || editor.isShapeOfType(onlyShape, 'video'))\n\n\treturn (\n\t\t<svg\n\t\t\tclassName=\"tl-overlays__item tl-selection__fg\"\n\t\t\tdata-testid=\"selection-foreground\"\n\t\t\taria-hidden=\"true\"\n\t\t>\n\t\t\t<g ref={rSvg}>\n\t\t\t\t{shouldDisplayBox && (\n\t\t\t\t\t<rect\n\t\t\t\t\t\tclassName=\"tl-selection__fg__outline\"\n\t\t\t\t\t\twidth={toDomPrecision(width)}\n\t\t\t\t\t\theight={toDomPrecision(height)}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t\t<RotateCornerHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.top-left\"\n\t\t\t\t\tcx={0}\n\t\t\t\t\tcy={0}\n\t\t\t\t\ttargetSize={targetSize}\n\t\t\t\t\tcorner=\"top_left_rotate\"\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nwse-rotate', rotation) : undefined}\n\t\t\t\t\tisHidden={hideRotateCornerHandles}\n\t\t\t\t/>\n\t\t\t\t<RotateCornerHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.top-right\"\n\t\t\t\t\tcx={width + targetSize * 3}\n\t\t\t\t\tcy={0}\n\t\t\t\t\ttargetSize={targetSize}\n\t\t\t\t\tcorner=\"top_right_rotate\"\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nesw-rotate', rotation) : undefined}\n\t\t\t\t\tisHidden={hideRotateCornerHandles}\n\t\t\t\t/>\n\t\t\t\t<RotateCornerHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.bottom-left\"\n\t\t\t\t\tcx={0}\n\t\t\t\t\tcy={height + targetSize * 3}\n\t\t\t\t\ttargetSize={targetSize}\n\t\t\t\t\tcorner=\"bottom_left_rotate\"\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('swne-rotate', rotation) : undefined}\n\t\t\t\t\tisHidden={hideRotateCornerHandles}\n\t\t\t\t/>\n\t\t\t\t<RotateCornerHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.bottom-right\"\n\t\t\t\t\tcx={width + targetSize * 3}\n\t\t\t\t\tcy={height + targetSize * 3}\n\t\t\t\t\ttargetSize={targetSize}\n\t\t\t\t\tcorner=\"bottom_right_rotate\"\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('senw-rotate', rotation) : undefined}\n\t\t\t\t\tisHidden={hideRotateCornerHandles}\n\t\t\t\t/>\n\t\t\t\t<MobileRotateHandle\n\t\t\t\t\tdata-testid=\"selection.rotate.mobile\"\n\t\t\t\t\tcx={isSmallX ? -targetSize * 1.5 : width / 2}\n\t\t\t\t\tcy={\n\t\t\t\t\t\tisSmallX\n\t\t\t\t\t\t\t? height / 2\n\t\t\t\t\t\t\t: isMediaShape && !isShapeTooCloseToContextualToolbar\n\t\t\t\t\t\t\t\t? height + targetSize * 1.5\n\t\t\t\t\t\t\t\t: -targetSize * 1.5\n\t\t\t\t\t}\n\t\t\t\t\tsize={size}\n\t\t\t\t\tisHidden={hideMobileRotateHandle}\n\t\t\t\t/>\n\t\t\t\t{/* Targets */}\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideVerticalEdgeTargets}\n\t\t\t\t\tdataTestId=\"selection.resize.top\"\n\t\t\t\t\tariaLabel={msg('handle.resize-top')}\n\t\t\t\t\tx={0}\n\t\t\t\t\ty={toDomPrecision(0 - (isSmallY ? targetSizeY * 2 : targetSizeY))}\n\t\t\t\t\twidth={toDomPrecision(width)}\n\t\t\t\t\theight={toDomPrecision(Math.max(1, targetSizeY * 2))}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('ns-resize', rotation) : undefined}\n\t\t\t\t\tevents={topEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideHorizontalEdgeTargets}\n\t\t\t\t\tdataTestId=\"selection.resize.right\"\n\t\t\t\t\tariaLabel={msg('handle.resize-right')}\n\t\t\t\t\tx={toDomPrecision(width - (isSmallX ? 0 : targetSizeX))}\n\t\t\t\t\ty={0}\n\t\t\t\t\theight={toDomPrecision(height)}\n\t\t\t\t\twidth={toDomPrecision(Math.max(1, targetSizeX * 2))}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('ew-resize', rotation) : undefined}\n\t\t\t\t\tevents={rightEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideVerticalEdgeTargets}\n\t\t\t\t\tdataTestId=\"selection.resize.bottom\"\n\t\t\t\t\tariaLabel={msg('handle.resize-bottom')}\n\t\t\t\t\tx={0}\n\t\t\t\t\ty={toDomPrecision(height - (isSmallY ? 0 : targetSizeY))}\n\t\t\t\t\twidth={toDomPrecision(width)}\n\t\t\t\t\theight={toDomPrecision(Math.max(1, targetSizeY * 2))}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('ns-resize', rotation) : undefined}\n\t\t\t\t\tevents={bottomEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideHorizontalEdgeTargets}\n\t\t\t\t\tdataTestId=\"selection.resize.left\"\n\t\t\t\t\tariaLabel={msg('handle.resize-left')}\n\t\t\t\t\tx={toDomPrecision(0 - (isSmallX ? targetSizeX * 2 : targetSizeX))}\n\t\t\t\t\ty={0}\n\t\t\t\t\theight={toDomPrecision(height)}\n\t\t\t\t\twidth={toDomPrecision(Math.max(1, targetSizeX * 2))}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('ew-resize', rotation) : undefined}\n\t\t\t\t\tevents={leftEvents}\n\t\t\t\t/>\n\t\t\t\t{/* Corner Targets */}\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideTopLeftCorner}\n\t\t\t\t\tdataTestId=\"selection.target.top-left\"\n\t\t\t\t\tariaLabel={msg('handle.resize-top-left')}\n\t\t\t\t\tx={toDomPrecision(0 - (isSmallX ? targetSizeX * 2 : targetSizeX * 1.5))}\n\t\t\t\t\ty={toDomPrecision(0 - (isSmallY ? targetSizeY * 2 : targetSizeY * 1.5))}\n\t\t\t\t\twidth={toDomPrecision(targetSizeX * 3)}\n\t\t\t\t\theight={toDomPrecision(targetSizeY * 3)}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nwse-resize', rotation) : undefined}\n\t\t\t\t\tevents={topLeftEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideTopRightCorner}\n\t\t\t\t\tdataTestId=\"selection.target.top-right\"\n\t\t\t\t\tariaLabel={msg('handle.resize-top-right')}\n\t\t\t\t\tx={toDomPrecision(width - (isSmallX ? 0 : targetSizeX * 1.5))}\n\t\t\t\t\ty={toDomPrecision(0 - (isSmallY ? targetSizeY * 2 : targetSizeY * 1.5))}\n\t\t\t\t\twidth={toDomPrecision(targetSizeX * 3)}\n\t\t\t\t\theight={toDomPrecision(targetSizeY * 3)}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nesw-resize', rotation) : undefined}\n\t\t\t\t\tevents={topRightEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideBottomRightCorner}\n\t\t\t\t\tdataTestId=\"selection.target.bottom-right\"\n\t\t\t\t\tariaLabel={msg('handle.resize-bottom-right')}\n\t\t\t\t\tx={toDomPrecision(width - (isSmallX ? targetSizeX : targetSizeX * 1.5))}\n\t\t\t\t\ty={toDomPrecision(height - (isSmallY ? targetSizeY : targetSizeY * 1.5))}\n\t\t\t\t\twidth={toDomPrecision(targetSizeX * 3)}\n\t\t\t\t\theight={toDomPrecision(targetSizeY * 3)}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nwse-resize', rotation) : undefined}\n\t\t\t\t\tevents={bottomRightEvents}\n\t\t\t\t/>\n\t\t\t\t<ResizeHandle\n\t\t\t\t\thide={hideBottomLeftCorner}\n\t\t\t\t\tdataTestId=\"selection.target.bottom-left\"\n\t\t\t\t\tariaLabel={msg('handle.resize-bottom-left')}\n\t\t\t\t\tx={toDomPrecision(0 - (isSmallX ? targetSizeX * 3 : targetSizeX * 1.5))}\n\t\t\t\t\ty={toDomPrecision(height - (isSmallY ? 0 : targetSizeY * 1.5))}\n\t\t\t\t\twidth={toDomPrecision(targetSizeX * 3)}\n\t\t\t\t\theight={toDomPrecision(targetSizeY * 3)}\n\t\t\t\t\tcursor={isDefaultCursor ? getCursor('nesw-resize', rotation) : undefined}\n\t\t\t\t\tevents={bottomLeftEvents}\n\t\t\t\t/>\n\t\t\t\t{/* Resize Handles */}\n\t\t\t\t{showResizeHandles && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.resize.top-left\"\n\t\t\t\t\t\t\tclassName={classNames('tl-corner-handle', {\n\t\t\t\t\t\t\t\t'tl-hidden': hideTopLeftCorner,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tx={toDomPrecision(0 - size / 2)}\n\t\t\t\t\t\t\ty={toDomPrecision(0 - size / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size)}\n\t\t\t\t\t\t\theight={toDomPrecision(size)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.resize.top-right\"\n\t\t\t\t\t\t\tclassName={classNames('tl-corner-handle', {\n\t\t\t\t\t\t\t\t'tl-hidden': hideTopRightCorner,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tx={toDomPrecision(width - size / 2)}\n\t\t\t\t\t\t\ty={toDomPrecision(0 - size / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size)}\n\t\t\t\t\t\t\theight={toDomPrecision(size)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.resize.bottom-right\"\n\t\t\t\t\t\t\tclassName={classNames('tl-corner-handle', {\n\t\t\t\t\t\t\t\t'tl-hidden': hideBottomRightCorner,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tx={toDomPrecision(width - size / 2)}\n\t\t\t\t\t\t\ty={toDomPrecision(height - size / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size)}\n\t\t\t\t\t\t\theight={toDomPrecision(size)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.resize.bottom-left\"\n\t\t\t\t\t\t\tclassName={classNames('tl-corner-handle', {\n\t\t\t\t\t\t\t\t'tl-hidden': hideBottomLeftCorner,\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tx={toDomPrecision(0 - size / 2)}\n\t\t\t\t\t\t\ty={toDomPrecision(height - size / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size)}\n\t\t\t\t\t\t\theight={toDomPrecision(size)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{showTextResizeHandles && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.text-resize.left.handle\"\n\t\t\t\t\t\t\tclassName=\"tl-text-handle\"\n\t\t\t\t\t\t\tx={toDomPrecision(0 - size / 4)}\n\t\t\t\t\t\t\ty={toDomPrecision(height / 2 - textHandleHeight / 2)}\n\t\t\t\t\t\t\trx={size / 4}\n\t\t\t\t\t\t\twidth={toDomPrecision(size / 2)}\n\t\t\t\t\t\t\theight={toDomPrecision(textHandleHeight)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\tdata-testid=\"selection.text-resize.right.handle\"\n\t\t\t\t\t\t\tclassName=\"tl-text-handle\"\n\t\t\t\t\t\t\trx={size / 4}\n\t\t\t\t\t\t\tx={toDomPrecision(width - size / 4)}\n\t\t\t\t\t\t\ty={toDomPrecision(height / 2 - textHandleHeight / 2)}\n\t\t\t\t\t\t\twidth={toDomPrecision(size / 2)}\n\t\t\t\t\t\t\theight={toDomPrecision(textHandleHeight)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t\t{/* Crop Handles */}\n\t\t\t\t{showCropHandles && (\n\t\t\t\t\t<TldrawCropHandles\n\t\t\t\t\t\t{...{\n\t\t\t\t\t\t\tsize,\n\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\theight,\n\t\t\t\t\t\t\thideAlternateHandles: hideAlternateCropHandles,\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</g>\n\t\t</svg>\n\t)\n})\n\nexport const ResizeHandle = function ResizeHandle({\n\thide,\n\tdataTestId,\n\tariaLabel,\n\tx,\n\ty,\n\twidth,\n\theight,\n\tcursor,\n\tevents,\n}: {\n\thide: boolean\n\tdataTestId: string\n\tariaLabel: string\n\tx: number\n\ty: number\n\twidth: number\n\theight: number\n\tcursor?: string\n\tevents: {\n\t\tonPointerUp: PointerEventHandler<Element>\n\t\tonPointerMove(e: React.PointerEvent<Element>): void\n\t\tonPointerDown: PointerEventHandler<Element>\n\t}\n}) {\n\treturn (\n\t\t<rect\n\t\t\tclassName={classNames('tl-resize-handle', 'tl-transparent', {\n\t\t\t\t'tl-hidden': hide,\n\t\t\t})}\n\t\t\tdata-testid={dataTestId}\n\t\t\trole=\"button\"\n\t\t\taria-label={ariaLabel}\n\t\t\tpointerEvents=\"all\"\n\t\t\tx={x}\n\t\t\ty={y}\n\t\t\twidth={width}\n\t\t\theight={height}\n\t\t\tcursor={cursor}\n\t\t\t{...events}\n\t\t/>\n\t)\n}\n\nexport const RotateCornerHandle = function RotateCornerHandle({\n\tcx,\n\tcy,\n\ttargetSize,\n\tcorner,\n\tcursor,\n\tisHidden,\n\t'data-testid': testId,\n}: {\n\tcx: number\n\tcy: number\n\ttargetSize: number\n\tcorner: RotateCorner\n\tcursor?: string\n\tisHidden: boolean\n\t'data-testid'?: string\n}) {\n\tconst events = useSelectionEvents(corner)\n\tconst msg = useTranslation()\n\tconst label = msg(`handle.rotate.${corner}`)\n\n\treturn (\n\t\t<rect\n\t\t\tclassName={classNames('tl-transparent', 'tl-rotate-corner', { 'tl-hidden': isHidden })}\n\t\t\tdata-testid={testId}\n\t\t\trole=\"button\"\n\t\t\taria-label={label}\n\t\t\tpointerEvents=\"all\"\n\t\t\tx={toDomPrecision(cx - targetSize * 3)}\n\t\t\ty={toDomPrecision(cy - targetSize * 3)}\n\t\t\twidth={toDomPrecision(Math.max(1, targetSize * 3))}\n\t\t\theight={toDomPrecision(Math.max(1, targetSize * 3))}\n\t\t\tcursor={cursor}\n\t\t\t{...events}\n\t\t/>\n\t)\n}\n\nconst SQUARE_ROOT_PI = Math.sqrt(Math.PI)\n\nexport const MobileRotateHandle = function RotateHandle({\n\tcx,\n\tcy,\n\tsize,\n\tisHidden,\n\t'data-testid': testId,\n}: {\n\tcx: number\n\tcy: number\n\tsize: number\n\tisHidden: boolean\n\t'data-testid'?: string\n}) {\n\tconst events = useSelectionEvents('mobile_rotate')\n\n\tconst editor = useEditor()\n\tconst zoom = useValue('zoom level', () => editor.getZoomLevel(), [editor])\n\tconst bgRadius = Math.max(14 * (1 / zoom), 20 / Math.max(1, zoom))\n\tconst msg = useTranslation()\n\treturn (\n\t\t<g role=\"button\" aria-label={msg('handle.rotate.mobile_rotate')}>\n\t\t\t<circle\n\t\t\t\tdata-testid={testId}\n\t\t\t\tpointerEvents=\"all\"\n\t\t\t\tclassName={classNames('tl-transparent', 'tl-mobile-rotate__bg', { 'tl-hidden': isHidden })}\n\t\t\t\tcx={cx}\n\t\t\t\tcy={cy}\n\t\t\t\tr={bgRadius}\n\t\t\t\t{...events}\n\t\t\t/>\n\t\t\t<circle\n\t\t\t\tclassName={classNames('tl-mobile-rotate__fg', { 'tl-hidden': isHidden })}\n\t\t\t\tcx={cx}\n\t\t\t\tcy={cy}\n\t\t\t\tr={size / SQUARE_ROOT_PI}\n\t\t\t/>\n\t\t</g>\n\t)\n}\n"],
|
|
5
|
+
"mappings": "AA8MK,SAmJA,UAnJA,KAmJA,YAnJA;AA9ML;AAAA,EACC;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,OAAO,gBAAgB;AACvB,SAA8B,cAAc;AAC5C,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,yBAAyB;AAG3B,MAAM,4BAA4B,MAAM,SAASA,2BAA0B;AAAA,EACjF;AAAA,EACA;AACD,GAA+B;AAC9B,QAAM,SAAS,UAAU;AACzB,QAAM,MAAM,eAAe;AAC3B,Q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