@tldraw/editor 3.16.0-canary.acb40a76700b → 3.16.0-canary.b0fec0f5b729

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.
Files changed (192) hide show
  1. package/dist-cjs/index.d.ts +113 -105
  2. package/dist-cjs/index.js +3 -5
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +6 -8
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/Shape.js +7 -10
  7. package/dist-cjs/lib/components/Shape.js.map +2 -2
  8. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +14 -23
  9. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  10. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +1 -1
  11. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
  12. package/dist-cjs/lib/config/TLUserPreferences.js +1 -1
  13. package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
  14. package/dist-cjs/lib/editor/Editor.js +79 -114
  15. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  16. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +4 -0
  17. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +2 -2
  18. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +4 -2
  19. package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +2 -2
  20. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +1 -1
  21. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
  22. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +23 -0
  23. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  24. package/dist-cjs/lib/editor/types/misc-types.js.map +1 -1
  25. package/dist-cjs/lib/exports/getSvgJsx.js +34 -14
  26. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  27. package/dist-cjs/lib/hooks/useCanvasEvents.js +26 -21
  28. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  29. package/dist-cjs/lib/hooks/useDocumentEvents.js +5 -5
  30. package/dist-cjs/lib/hooks/useDocumentEvents.js.map +2 -2
  31. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js +1 -2
  32. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
  33. package/dist-cjs/lib/hooks/useGestureEvents.js +1 -1
  34. package/dist-cjs/lib/hooks/useGestureEvents.js.map +2 -2
  35. package/dist-cjs/lib/hooks/useHandleEvents.js +6 -6
  36. package/dist-cjs/lib/hooks/useHandleEvents.js.map +2 -2
  37. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +4 -1
  38. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +2 -2
  39. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js +4 -1
  40. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  41. package/dist-cjs/lib/hooks/useSelectionEvents.js +8 -8
  42. package/dist-cjs/lib/hooks/useSelectionEvents.js.map +2 -2
  43. package/dist-cjs/lib/license/LicenseManager.js +143 -53
  44. package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
  45. package/dist-cjs/lib/license/LicenseProvider.js +39 -1
  46. package/dist-cjs/lib/license/LicenseProvider.js.map +2 -2
  47. package/dist-cjs/lib/license/Watermark.js +144 -75
  48. package/dist-cjs/lib/license/Watermark.js.map +3 -3
  49. package/dist-cjs/lib/license/useLicenseManagerState.js.map +2 -2
  50. package/dist-cjs/lib/options.js +6 -0
  51. package/dist-cjs/lib/options.js.map +2 -2
  52. package/dist-cjs/lib/primitives/Box.js +3 -0
  53. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  54. package/dist-cjs/lib/primitives/Vec.js +0 -4
  55. package/dist-cjs/lib/primitives/Vec.js.map +2 -2
  56. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +50 -20
  57. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  58. package/dist-cjs/lib/primitives/geometry/Group2d.js +8 -1
  59. package/dist-cjs/lib/primitives/geometry/Group2d.js.map +2 -2
  60. package/dist-cjs/lib/utils/dom.js.map +2 -2
  61. package/dist-cjs/lib/utils/getPointerInfo.js +2 -3
  62. package/dist-cjs/lib/utils/getPointerInfo.js.map +2 -2
  63. package/dist-cjs/lib/utils/reparenting.js +2 -35
  64. package/dist-cjs/lib/utils/reparenting.js.map +3 -3
  65. package/dist-cjs/version.js +3 -3
  66. package/dist-cjs/version.js.map +1 -1
  67. package/dist-esm/index.d.mts +113 -105
  68. package/dist-esm/index.mjs +3 -5
  69. package/dist-esm/index.mjs.map +2 -2
  70. package/dist-esm/lib/TldrawEditor.mjs +6 -8
  71. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  72. package/dist-esm/lib/components/Shape.mjs +7 -10
  73. package/dist-esm/lib/components/Shape.mjs.map +2 -2
  74. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +14 -23
  75. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  76. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -1
  77. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
  78. package/dist-esm/lib/config/TLUserPreferences.mjs +1 -1
  79. package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
  80. package/dist-esm/lib/editor/Editor.mjs +79 -114
  81. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  82. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +4 -0
  83. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +2 -2
  84. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +4 -2
  85. package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +2 -2
  86. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +1 -1
  87. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
  88. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +23 -0
  89. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  90. package/dist-esm/lib/exports/getSvgJsx.mjs +34 -14
  91. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  92. package/dist-esm/lib/hooks/useCanvasEvents.mjs +27 -27
  93. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  94. package/dist-esm/lib/hooks/useDocumentEvents.mjs +6 -6
  95. package/dist-esm/lib/hooks/useDocumentEvents.mjs.map +2 -2
  96. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +1 -2
  97. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
  98. package/dist-esm/lib/hooks/useGestureEvents.mjs +2 -2
  99. package/dist-esm/lib/hooks/useGestureEvents.mjs.map +2 -2
  100. package/dist-esm/lib/hooks/useHandleEvents.mjs +6 -6
  101. package/dist-esm/lib/hooks/useHandleEvents.mjs.map +2 -2
  102. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +4 -1
  103. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +2 -2
  104. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs +4 -1
  105. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  106. package/dist-esm/lib/hooks/useSelectionEvents.mjs +9 -14
  107. package/dist-esm/lib/hooks/useSelectionEvents.mjs.map +2 -2
  108. package/dist-esm/lib/license/LicenseManager.mjs +144 -54
  109. package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
  110. package/dist-esm/lib/license/LicenseProvider.mjs +39 -2
  111. package/dist-esm/lib/license/LicenseProvider.mjs.map +2 -2
  112. package/dist-esm/lib/license/Watermark.mjs +145 -76
  113. package/dist-esm/lib/license/Watermark.mjs.map +3 -3
  114. package/dist-esm/lib/license/useLicenseManagerState.mjs.map +2 -2
  115. package/dist-esm/lib/options.mjs +6 -0
  116. package/dist-esm/lib/options.mjs.map +2 -2
  117. package/dist-esm/lib/primitives/Box.mjs +4 -1
  118. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  119. package/dist-esm/lib/primitives/Vec.mjs +0 -4
  120. package/dist-esm/lib/primitives/Vec.mjs.map +2 -2
  121. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +53 -21
  122. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  123. package/dist-esm/lib/primitives/geometry/Group2d.mjs +8 -1
  124. package/dist-esm/lib/primitives/geometry/Group2d.mjs.map +2 -2
  125. package/dist-esm/lib/utils/dom.mjs.map +2 -2
  126. package/dist-esm/lib/utils/getPointerInfo.mjs +2 -3
  127. package/dist-esm/lib/utils/getPointerInfo.mjs.map +2 -2
  128. package/dist-esm/lib/utils/reparenting.mjs +3 -40
  129. package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
  130. package/dist-esm/version.mjs +3 -3
  131. package/dist-esm/version.mjs.map +1 -1
  132. package/editor.css +16 -3
  133. package/package.json +14 -37
  134. package/src/index.ts +2 -9
  135. package/src/lib/TldrawEditor.tsx +7 -16
  136. package/src/lib/components/Shape.tsx +6 -12
  137. package/src/lib/components/default-components/DefaultCanvas.tsx +11 -22
  138. package/src/lib/components/default-components/DefaultErrorFallback.tsx +1 -1
  139. package/src/lib/config/TLUserPreferences.ts +1 -1
  140. package/src/lib/editor/Editor.test.ts +102 -11
  141. package/src/lib/editor/Editor.ts +98 -151
  142. package/src/lib/editor/derivations/notVisibleShapes.ts +6 -0
  143. package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +15 -14
  144. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +16 -15
  145. package/src/lib/editor/managers/FocusManager/FocusManager.test.ts +49 -48
  146. package/src/lib/editor/managers/FocusManager/FocusManager.ts +6 -2
  147. package/src/lib/editor/managers/FontManager/FontManager.test.ts +24 -23
  148. package/src/lib/editor/managers/HistoryManager/HistoryManager.test.ts +7 -6
  149. package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +12 -11
  150. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +57 -50
  151. package/src/lib/editor/managers/TextManager/TextManager.test.ts +51 -26
  152. package/src/lib/editor/managers/TickManager/TickManager.test.ts +14 -13
  153. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +21 -26
  154. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +1 -1
  155. package/src/lib/editor/shapes/ShapeUtil.ts +46 -0
  156. package/src/lib/editor/types/misc-types.ts +0 -6
  157. package/src/lib/exports/getSvgJsx.test.ts +868 -0
  158. package/src/lib/exports/getSvgJsx.tsx +76 -19
  159. package/src/lib/hooks/useCanvasEvents.ts +26 -26
  160. package/src/lib/hooks/useDocumentEvents.ts +6 -6
  161. package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +1 -1
  162. package/src/lib/hooks/useGestureEvents.ts +2 -2
  163. package/src/lib/hooks/useHandleEvents.ts +6 -6
  164. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +4 -1
  165. package/src/lib/hooks/usePassThroughWheelEvents.ts +6 -1
  166. package/src/lib/hooks/useSelectionEvents.ts +9 -14
  167. package/src/lib/license/LicenseManager.test.ts +724 -383
  168. package/src/lib/license/LicenseManager.ts +204 -58
  169. package/src/lib/license/LicenseProvider.tsx +74 -2
  170. package/src/lib/license/Watermark.test.tsx +2 -1
  171. package/src/lib/license/Watermark.tsx +152 -77
  172. package/src/lib/license/useLicenseManagerState.ts +2 -2
  173. package/src/lib/options.ts +6 -0
  174. package/src/lib/primitives/Box.test.ts +126 -0
  175. package/src/lib/primitives/Box.ts +10 -1
  176. package/src/lib/primitives/Vec.ts +0 -5
  177. package/src/lib/primitives/geometry/Geometry2d.test.ts +420 -0
  178. package/src/lib/primitives/geometry/Geometry2d.ts +78 -21
  179. package/src/lib/primitives/geometry/Group2d.ts +10 -1
  180. package/src/lib/test/InFrontOfTheCanvas.test.tsx +187 -0
  181. package/src/lib/utils/dom.test.ts +103 -0
  182. package/src/lib/utils/dom.ts +8 -1
  183. package/src/lib/utils/getPointerInfo.ts +3 -2
  184. package/src/lib/utils/reparenting.ts +3 -69
  185. package/src/lib/utils/sync/LocalIndexedDb.test.ts +2 -1
  186. package/src/lib/utils/sync/TLLocalSyncClient.test.ts +15 -15
  187. package/src/version.ts +3 -3
  188. package/dist-cjs/lib/utils/nearestMultiple.js +0 -34
  189. package/dist-cjs/lib/utils/nearestMultiple.js.map +0 -7
  190. package/dist-esm/lib/utils/nearestMultiple.mjs +0 -14
  191. package/dist-esm/lib/utils/nearestMultiple.mjs.map +0 -7
  192. package/src/lib/utils/nearestMultiple.ts +0 -13
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/utils/reparenting.ts"],
4
- "sourcesContent": ["import { EMPTY_ARRAY } from '@tldraw/state'\nimport { TLGroupShape, TLParentId, TLShape, TLShapeId } from '@tldraw/tlschema'\nimport { IndexKey, compact, getIndexAbove, getIndexBetween } from '@tldraw/utils'\nimport { Editor } from '../editor/Editor'\nimport { Vec } from '../primitives/Vec'\nimport { Geometry2d } from '../primitives/geometry/Geometry2d'\nimport { Group2d } from '../primitives/geometry/Group2d'\nimport {\n\tintersectPolygonPolygon,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from '../primitives/intersect'\nimport { pointInPolygon } from '../primitives/utils'\n\n/**\n * Reparents shapes that are no longer contained within their parent shapes.\n * todo: rename me to something more descriptive, like `reparentOccludedShapes` or `reparentAutoDroppedShapes`\n *\n * @param editor - The editor instance.\n * @param shapeIds - The IDs of the shapes to reparent.\n * @param opts - Optional options, including a callback to filter out certain parents, such as when removing a frame.\n *\n * @public\n */\nexport function kickoutOccludedShapes(\n\teditor: Editor,\n\tshapeIds: TLShapeId[],\n\topts?: { filter?(parent: TLShape): boolean }\n) {\n\tconst parentsToCheck = new Set<TLShape>()\n\n\tfor (const id of shapeIds) {\n\t\tconst shape = editor.getShape(id)\n\n\t\tif (!shape) continue\n\t\tparentsToCheck.add(shape)\n\n\t\tconst parent = editor.getShape(shape.parentId)\n\t\tif (!parent) continue\n\t\tparentsToCheck.add(parent)\n\t}\n\n\t// Check all of the parents and gather up parents who have lost children\n\tconst parentsToLostChildren = new Map<TLShape, TLShapeId[]>()\n\n\tfor (const parent of parentsToCheck) {\n\t\tconst childIds = editor.getSortedChildIdsForParent(parent)\n\t\tif (opts?.filter && !opts.filter(parent)) {\n\t\t\t// If the shape is filtered out, we kick out all of its children\n\t\t\tparentsToLostChildren.set(parent, childIds)\n\t\t} else {\n\t\t\tconst overlappingChildren = getOverlappingShapes(editor, parent.id, childIds)\n\t\t\tif (overlappingChildren.length < childIds.length) {\n\t\t\t\tparentsToLostChildren.set(\n\t\t\t\t\tparent,\n\t\t\t\t\tchildIds.filter((id) => !overlappingChildren.includes(id))\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Get all of the shapes on the current page, sorted by their index\n\tconst sortedShapeIds = editor.getCurrentPageShapesSorted().map((s) => s.id)\n\n\tconst parentsToNewChildren: Record<\n\t\tTLParentId,\n\t\t{ parentId: TLParentId; shapeIds: TLShapeId[]; index?: IndexKey }\n\t> = {}\n\n\tfor (const [prevParent, lostChildrenIds] of parentsToLostChildren) {\n\t\tconst lostChildren = compact(lostChildrenIds.map((id) => editor.getShape(id)))\n\n\t\t// Don't fall \"up\" into frames in front of the shape\n\t\t// if (pageShapes.indexOf(shape) < frameSortPosition) continue shapeCheck\n\n\t\t// Otherwise, we have no next dropping shape under the cursor, so go find\n\t\t// all the frames on the page where the moving shapes will fall into\n\t\tconst { reparenting, remainingShapesToReparent } = getDroppedShapesToNewParents(\n\t\t\teditor,\n\t\t\tlostChildren,\n\t\t\t(shape, maybeNewParent) => {\n\t\t\t\t// If we're filtering out a potential parent, don't reparent shapes to the filtered out shape\n\t\t\t\tif (opts?.filter && !opts.filter(maybeNewParent)) return false\n\t\t\t\treturn (\n\t\t\t\t\tmaybeNewParent.id !== prevParent.id &&\n\t\t\t\t\tsortedShapeIds.indexOf(maybeNewParent.id) < sortedShapeIds.indexOf(shape.id)\n\t\t\t\t)\n\t\t\t}\n\t\t)\n\n\t\treparenting.forEach((childrenToReparent, newParentId) => {\n\t\t\tif (childrenToReparent.length === 0) return\n\t\t\tif (!parentsToNewChildren[newParentId]) {\n\t\t\t\tparentsToNewChildren[newParentId] = {\n\t\t\t\t\tparentId: newParentId,\n\t\t\t\t\tshapeIds: [],\n\t\t\t\t}\n\t\t\t}\n\t\t\tparentsToNewChildren[newParentId].shapeIds.push(...childrenToReparent.map((s) => s.id))\n\t\t})\n\n\t\t// Reparent the rest to the page (or containing group)\n\t\tif (remainingShapesToReparent.size > 0) {\n\t\t\t// The remaining shapes are going to be reparented to the old parent's containing group, if there was one, or else to the page\n\t\t\tconst newParentId =\n\t\t\t\teditor.findShapeAncestor(prevParent, (s) => editor.isShapeOfType<TLGroupShape>(s, 'group'))\n\t\t\t\t\t?.id ?? editor.getCurrentPageId()\n\n\t\t\tremainingShapesToReparent.forEach((shape) => {\n\t\t\t\tif (!parentsToNewChildren[newParentId]) {\n\t\t\t\t\tlet insertIndexKey: IndexKey | undefined\n\n\t\t\t\t\tconst oldParentSiblingIds = editor.getSortedChildIdsForParent(newParentId)\n\t\t\t\t\tconst oldParentIndex = oldParentSiblingIds.indexOf(prevParent.id)\n\t\t\t\t\tif (oldParentIndex > -1) {\n\t\t\t\t\t\t// If the old parent is a direct child of the new parent, then we'll add them above the old parent but below the next sibling.\n\t\t\t\t\t\tconst siblingsIndexAbove = oldParentSiblingIds[oldParentIndex + 1]\n\t\t\t\t\t\tconst indexKeyAbove = siblingsIndexAbove\n\t\t\t\t\t\t\t? editor.getShape(siblingsIndexAbove)!.index\n\t\t\t\t\t\t\t: getIndexAbove(prevParent.index)\n\t\t\t\t\t\tinsertIndexKey = getIndexBetween(prevParent.index, indexKeyAbove)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the old parent is not a direct child of the new parent, then we'll add them to the \"top\" of the new parent's children.\n\t\t\t\t\t\t// This is done automatically if we leave the index undefined, so let's do that.\n\t\t\t\t\t}\n\n\t\t\t\t\tparentsToNewChildren[newParentId] = {\n\t\t\t\t\t\tparentId: newParentId,\n\t\t\t\t\t\tshapeIds: [],\n\t\t\t\t\t\tindex: insertIndexKey,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tparentsToNewChildren[newParentId].shapeIds.push(shape.id)\n\t\t\t})\n\t\t}\n\t}\n\n\teditor.run(() => {\n\t\tObject.values(parentsToNewChildren).forEach(({ parentId, shapeIds, index }) => {\n\t\t\tif (shapeIds.length === 0) return\n\t\t\t// Before we reparent, sort the new shape ids by their place in the original absolute order on the page\n\t\t\tshapeIds.sort((a, b) => (sortedShapeIds.indexOf(a) < sortedShapeIds.indexOf(b) ? -1 : 1))\n\t\t\teditor.reparentShapes(shapeIds, parentId, index)\n\t\t})\n\t})\n}\n\n/**\n * Get the shapes that overlap with a given shape.\n *\n * @param editor - The editor instance.\n * @param shape - The shapes or shape IDs to check against.\n * @param otherShapes - The shapes or shape IDs to check for overlap.\n * @returns An array of shapes or shape IDs that overlap with the given shape.\n */\nfunction getOverlappingShapes<T extends TLShape[] | TLShapeId[]>(\n\teditor: Editor,\n\tshape: T[number],\n\totherShapes: T\n) {\n\tif (otherShapes.length === 0) {\n\t\treturn EMPTY_ARRAY\n\t}\n\n\tconst parentPageBounds = editor.getShapePageBounds(shape)\n\tif (!parentPageBounds) return EMPTY_ARRAY\n\n\tconst parentGeometry = editor.getShapeGeometry(shape)\n\tconst parentPageTransform = editor.getShapePageTransform(shape)\n\tconst parentPageCorners = parentPageTransform.applyToPoints(parentGeometry.vertices)\n\n\tconst parentPageMaskVertices = editor.getShapeMask(shape)\n\tconst parentPagePolygon = parentPageMaskVertices\n\t\t? intersectPolygonPolygon(parentPageMaskVertices, parentPageCorners)\n\t\t: parentPageCorners\n\n\tif (!parentPagePolygon) return EMPTY_ARRAY\n\n\treturn otherShapes.filter((childId) => {\n\t\tconst shapePageBounds = editor.getShapePageBounds(childId)\n\t\tif (!shapePageBounds || !parentPageBounds.includes(shapePageBounds)) return false\n\n\t\tconst parentPolygonInShapeShape = editor\n\t\t\t.getShapePageTransform(childId)\n\t\t\t.clone()\n\t\t\t.invert()\n\t\t\t.applyToPoints(parentPagePolygon)\n\n\t\tconst geometry = editor.getShapeGeometry(childId)\n\n\t\treturn doesGeometryOverlapPolygon(geometry, parentPolygonInShapeShape)\n\t})\n}\n\n/**\n * @public\n */\nexport function doesGeometryOverlapPolygon(\n\tgeometry: Geometry2d,\n\tparentCornersInShapeSpace: Vec[]\n): boolean {\n\t// If the child is a group, check if any of its children overlap the box\n\tif (geometry instanceof Group2d) {\n\t\treturn geometry.children.some((childGeometry) =>\n\t\t\tdoesGeometryOverlapPolygon(childGeometry, parentCornersInShapeSpace)\n\t\t)\n\t}\n\n\t// Otherwise, check if the geometry overlaps the box\n\tconst { vertices, center, isFilled, isEmptyLabel, isClosed } = geometry\n\n\t// We'll do things in order of cheapest to most expensive checks\n\n\t// Skip empty labels\n\tif (isEmptyLabel) return false\n\n\t// If any of the shape's vertices are inside the occluder, it's inside\n\tif (vertices.some((v) => pointInPolygon(v, parentCornersInShapeSpace))) {\n\t\treturn true\n\t}\n\n\t// If the shape is filled and closed and its center is inside the parent, it's inside\n\tif (isClosed) {\n\t\tif (isFilled) {\n\t\t\t// If closed and filled, check if the center is inside the parent\n\t\t\tif (pointInPolygon(center, parentCornersInShapeSpace)) {\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\t// ..then, slightly more expensive check, see the shape covers the entire parent but not its center\n\t\t\tif (parentCornersInShapeSpace.every((v) => pointInPolygon(v, vertices))) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\t// If any the shape's vertices intersect the edge of the occluder, it's inside.\n\t\t// for example when a rotated rectangle is moved over the corner of a parent rectangle\n\t\t// If the child shape is closed, intersect as a polygon\n\t\tif (polygonsIntersect(parentCornersInShapeSpace, vertices)) {\n\t\t\treturn true\n\t\t}\n\t} else {\n\t\t// if the child shape is not closed, intersect as a polyline\n\t\tif (polygonIntersectsPolyline(parentCornersInShapeSpace, vertices)) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// If none of the above checks passed, the shape is outside the parent\n\treturn false\n}\n\n/**\n * Get the shapes that will be reparented to new parents when the shapes are dropped.\n *\n * @param editor - The editor instance.\n * @param shapes - The shapes to check.\n * @param cb - A callback to filter out certain shapes.\n * @returns An object with the shapes that will be reparented to new parents and the shapes that will be reparented to the page or their ancestral group.\n *\n * @public\n */\nexport function getDroppedShapesToNewParents(\n\teditor: Editor,\n\tshapes: Set<TLShape> | TLShape[],\n\tcb?: (shape: TLShape, parent: TLShape) => boolean\n) {\n\tconst shapesToActuallyCheck = new Set<TLShape>(shapes)\n\tconst movingGroups = new Set<TLGroupShape>()\n\n\tfor (const shape of shapes) {\n\t\tconst parent = editor.getShapeParent(shape)\n\t\tif (parent && editor.isShapeOfType<TLGroupShape>(parent, 'group')) {\n\t\t\tif (!movingGroups.has(parent)) {\n\t\t\t\tmovingGroups.add(parent)\n\t\t\t}\n\t\t}\n\t}\n\n\t// If all of a group's children are moving, then move the group instead\n\tfor (const movingGroup of movingGroups) {\n\t\tconst children = compact(\n\t\t\teditor.getSortedChildIdsForParent(movingGroup).map((id) => editor.getShape(id))\n\t\t)\n\t\tfor (const child of children) {\n\t\t\tshapesToActuallyCheck.delete(child)\n\t\t}\n\t\tshapesToActuallyCheck.add(movingGroup)\n\t}\n\n\t// this could be cached and passed in\n\tconst shapeGroupIds = new Map<TLShapeId, TLShapeId | undefined>()\n\n\tconst reparenting = new Map<TLShapeId, TLShape[]>()\n\n\tconst remainingShapesToReparent = new Set(shapesToActuallyCheck)\n\n\tconst potentialParentShapes = editor\n\t\t.getCurrentPageShapesSorted()\n\t\t// filter out any shapes that aren't frames or that are included among the provided shapes\n\t\t.filter(\n\t\t\t(s) =>\n\t\t\t\teditor.getShapeUtil(s).canReceiveNewChildrenOfType?.(s, s.type) &&\n\t\t\t\t!remainingShapesToReparent.has(s)\n\t\t)\n\n\tparentCheck: for (let i = potentialParentShapes.length - 1; i >= 0; i--) {\n\t\tconst parentShape = potentialParentShapes[i]\n\t\tconst parentShapeContainingGroupId = editor.findShapeAncestor(parentShape, (s) =>\n\t\t\teditor.isShapeOfType<TLGroupShape>(s, 'group')\n\t\t)?.id\n\n\t\tconst parentGeometry = editor.getShapeGeometry(parentShape)\n\t\tconst parentPageTransform = editor.getShapePageTransform(parentShape)\n\t\tconst parentPageMaskVertices = editor.getShapeMask(parentShape)\n\t\tconst parentPageCorners = parentPageTransform.applyToPoints(parentGeometry.vertices)\n\t\tconst parentPagePolygon = parentPageMaskVertices\n\t\t\t? intersectPolygonPolygon(parentPageMaskVertices, parentPageCorners)\n\t\t\t: parentPageCorners\n\n\t\tif (!parentPagePolygon) continue parentCheck\n\n\t\tconst childrenToReparent = []\n\n\t\t// For each of the dropping shapes...\n\t\tshapeCheck: for (const shape of remainingShapesToReparent) {\n\t\t\t// Don't reparent a frame to itself\n\t\t\tif (parentShape.id === shape.id) continue shapeCheck\n\n\t\t\t// Use the callback to filter out certain shapes\n\t\t\tif (cb && !cb(shape, parentShape)) continue shapeCheck\n\n\t\t\tif (!shapeGroupIds.has(shape.id)) {\n\t\t\t\tshapeGroupIds.set(\n\t\t\t\t\tshape.id,\n\t\t\t\t\teditor.findShapeAncestor(shape, (s) => editor.isShapeOfType<TLGroupShape>(s, 'group'))?.id\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst shapeGroupId = shapeGroupIds.get(shape.id)\n\n\t\t\t// Are the shape and the parent part of different groups?\n\t\t\tif (shapeGroupId !== parentShapeContainingGroupId) continue shapeCheck\n\n\t\t\t// Is the shape is actually the ancestor of the parent?\n\t\t\tif (editor.findShapeAncestor(parentShape, (s) => shape.id === s.id)) continue shapeCheck\n\n\t\t\t// Convert the parent polygon to the shape's space\n\t\t\tconst parentPolygonInShapeSpace = editor\n\t\t\t\t.getShapePageTransform(shape)\n\t\t\t\t.clone()\n\t\t\t\t.invert()\n\t\t\t\t.applyToPoints(parentPagePolygon)\n\n\t\t\t// If the shape overlaps the parent polygon, reparent it to that parent\n\t\t\tif (doesGeometryOverlapPolygon(editor.getShapeGeometry(shape), parentPolygonInShapeSpace)) {\n\t\t\t\t// Use the util to check if the shape can be reparented to the parent\n\t\t\t\tif (\n\t\t\t\t\t!editor.getShapeUtil(parentShape).canReceiveNewChildrenOfType?.(parentShape, shape.type)\n\t\t\t\t)\n\t\t\t\t\tcontinue shapeCheck\n\n\t\t\t\tif (shape.parentId !== parentShape.id) {\n\t\t\t\t\tchildrenToReparent.push(shape)\n\t\t\t\t}\n\t\t\t\tremainingShapesToReparent.delete(shape)\n\t\t\t\tcontinue shapeCheck\n\t\t\t}\n\t\t}\n\n\t\tif (childrenToReparent.length) {\n\t\t\treparenting.set(parentShape.id, childrenToReparent)\n\t\t}\n\t}\n\n\treturn {\n\t\t// these are the shapes that will be reparented to new parents\n\t\treparenting,\n\t\t// these are the shapes that will be reparented to the page or their ancestral group\n\t\tremainingShapesToReparent,\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4B;AAE5B,mBAAkE;AAIlE,qBAAwB;AACxB,uBAIO;AACP,IAAAA,gBAA+B;AAYxB,SAAS,sBACf,QACA,UACA,MACC;AACD,QAAM,iBAAiB,oBAAI,IAAa;AAExC,aAAW,MAAM,UAAU;AAC1B,UAAM,QAAQ,OAAO,SAAS,EAAE;AAEhC,QAAI,CAAC,MAAO;AACZ,mBAAe,IAAI,KAAK;AAExB,UAAM,SAAS,OAAO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AA,EACD;AACD;",
6
- "names": ["import_utils", "shapeIds"]
4
+ "sourcesContent": ["import { EMPTY_ARRAY } from '@tldraw/state'\nimport { TLGroupShape, TLParentId, TLShape, TLShapeId } from '@tldraw/tlschema'\nimport { IndexKey, compact, getIndexAbove, getIndexBetween } from '@tldraw/utils'\nimport { Editor } from '../editor/Editor'\nimport { intersectPolygonPolygon } from '../primitives/intersect'\n\n/**\n * Reparents shapes that are no longer contained within their parent shapes.\n * todo: rename me to something more descriptive, like `reparentOccludedShapes` or `reparentAutoDroppedShapes`\n *\n * @param editor - The editor instance.\n * @param shapeIds - The IDs of the shapes to reparent.\n * @param opts - Optional options, including a callback to filter out certain parents, such as when removing a frame.\n *\n * @public\n */\nexport function kickoutOccludedShapes(\n\teditor: Editor,\n\tshapeIds: TLShapeId[],\n\topts?: { filter?(parent: TLShape): boolean }\n) {\n\tconst parentsToCheck = new Set<TLShape>()\n\n\tfor (const id of shapeIds) {\n\t\tconst shape = editor.getShape(id)\n\n\t\tif (!shape) continue\n\t\tparentsToCheck.add(shape)\n\n\t\tconst parent = editor.getShape(shape.parentId)\n\t\tif (!parent) continue\n\t\tparentsToCheck.add(parent)\n\t}\n\n\t// Check all of the parents and gather up parents who have lost children\n\tconst parentsToLostChildren = new Map<TLShape, TLShapeId[]>()\n\n\tfor (const parent of parentsToCheck) {\n\t\tconst childIds = editor.getSortedChildIdsForParent(parent)\n\t\tif (opts?.filter && !opts.filter(parent)) {\n\t\t\t// If the shape is filtered out, we kick out all of its children\n\t\t\tparentsToLostChildren.set(parent, childIds)\n\t\t} else {\n\t\t\tconst overlappingChildren = getOverlappingShapes(editor, parent.id, childIds)\n\t\t\tif (overlappingChildren.length < childIds.length) {\n\t\t\t\tparentsToLostChildren.set(\n\t\t\t\t\tparent,\n\t\t\t\t\tchildIds.filter((id) => !overlappingChildren.includes(id))\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Get all of the shapes on the current page, sorted by their index\n\tconst sortedShapeIds = editor.getCurrentPageShapesSorted().map((s) => s.id)\n\n\tconst parentsToNewChildren: Record<\n\t\tTLParentId,\n\t\t{ parentId: TLParentId; shapeIds: TLShapeId[]; index?: IndexKey }\n\t> = {}\n\n\tfor (const [prevParent, lostChildrenIds] of parentsToLostChildren) {\n\t\tconst lostChildren = compact(lostChildrenIds.map((id) => editor.getShape(id)))\n\n\t\t// Don't fall \"up\" into frames in front of the shape\n\t\t// if (pageShapes.indexOf(shape) < frameSortPosition) continue shapeCheck\n\n\t\t// Otherwise, we have no next dropping shape under the cursor, so go find\n\t\t// all the frames on the page where the moving shapes will fall into\n\t\tconst { reparenting, remainingShapesToReparent } = getDroppedShapesToNewParents(\n\t\t\teditor,\n\t\t\tlostChildren,\n\t\t\t(shape, maybeNewParent) => {\n\t\t\t\t// If we're filtering out a potential parent, don't reparent shapes to the filtered out shape\n\t\t\t\tif (opts?.filter && !opts.filter(maybeNewParent)) return false\n\t\t\t\treturn (\n\t\t\t\t\tmaybeNewParent.id !== prevParent.id &&\n\t\t\t\t\tsortedShapeIds.indexOf(maybeNewParent.id) < sortedShapeIds.indexOf(shape.id)\n\t\t\t\t)\n\t\t\t}\n\t\t)\n\n\t\treparenting.forEach((childrenToReparent, newParentId) => {\n\t\t\tif (childrenToReparent.length === 0) return\n\t\t\tif (!parentsToNewChildren[newParentId]) {\n\t\t\t\tparentsToNewChildren[newParentId] = {\n\t\t\t\t\tparentId: newParentId,\n\t\t\t\t\tshapeIds: [],\n\t\t\t\t}\n\t\t\t}\n\t\t\tparentsToNewChildren[newParentId].shapeIds.push(...childrenToReparent.map((s) => s.id))\n\t\t})\n\n\t\t// Reparent the rest to the page (or containing group)\n\t\tif (remainingShapesToReparent.size > 0) {\n\t\t\t// The remaining shapes are going to be reparented to the old parent's containing group, if there was one, or else to the page\n\t\t\tconst newParentId =\n\t\t\t\teditor.findShapeAncestor(prevParent, (s) => editor.isShapeOfType<TLGroupShape>(s, 'group'))\n\t\t\t\t\t?.id ?? editor.getCurrentPageId()\n\n\t\t\tremainingShapesToReparent.forEach((shape) => {\n\t\t\t\tif (!parentsToNewChildren[newParentId]) {\n\t\t\t\t\tlet insertIndexKey: IndexKey | undefined\n\n\t\t\t\t\tconst oldParentSiblingIds = editor.getSortedChildIdsForParent(newParentId)\n\t\t\t\t\tconst oldParentIndex = oldParentSiblingIds.indexOf(prevParent.id)\n\t\t\t\t\tif (oldParentIndex > -1) {\n\t\t\t\t\t\t// If the old parent is a direct child of the new parent, then we'll add them above the old parent but below the next sibling.\n\t\t\t\t\t\tconst siblingsIndexAbove = oldParentSiblingIds[oldParentIndex + 1]\n\t\t\t\t\t\tconst indexKeyAbove = siblingsIndexAbove\n\t\t\t\t\t\t\t? editor.getShape(siblingsIndexAbove)!.index\n\t\t\t\t\t\t\t: getIndexAbove(prevParent.index)\n\t\t\t\t\t\tinsertIndexKey = getIndexBetween(prevParent.index, indexKeyAbove)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If the old parent is not a direct child of the new parent, then we'll add them to the \"top\" of the new parent's children.\n\t\t\t\t\t\t// This is done automatically if we leave the index undefined, so let's do that.\n\t\t\t\t\t}\n\n\t\t\t\t\tparentsToNewChildren[newParentId] = {\n\t\t\t\t\t\tparentId: newParentId,\n\t\t\t\t\t\tshapeIds: [],\n\t\t\t\t\t\tindex: insertIndexKey,\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tparentsToNewChildren[newParentId].shapeIds.push(shape.id)\n\t\t\t})\n\t\t}\n\t}\n\n\teditor.run(() => {\n\t\tObject.values(parentsToNewChildren).forEach(({ parentId, shapeIds, index }) => {\n\t\t\tif (shapeIds.length === 0) return\n\t\t\t// Before we reparent, sort the new shape ids by their place in the original absolute order on the page\n\t\t\tshapeIds.sort((a, b) => (sortedShapeIds.indexOf(a) < sortedShapeIds.indexOf(b) ? -1 : 1))\n\t\t\teditor.reparentShapes(shapeIds, parentId, index)\n\t\t})\n\t})\n}\n\n/**\n * Get the shapes that overlap with a given shape.\n *\n * @param editor - The editor instance.\n * @param shape - The shapes or shape IDs to check against.\n * @param otherShapes - The shapes or shape IDs to check for overlap.\n * @returns An array of shapes or shape IDs that overlap with the given shape.\n */\nfunction getOverlappingShapes<T extends TLShape[] | TLShapeId[]>(\n\teditor: Editor,\n\tshape: T[number],\n\totherShapes: T\n) {\n\tif (otherShapes.length === 0) {\n\t\treturn EMPTY_ARRAY\n\t}\n\n\tconst parentPageBounds = editor.getShapePageBounds(shape)\n\tif (!parentPageBounds) return EMPTY_ARRAY\n\n\tconst parentGeometry = editor.getShapeGeometry(shape)\n\tconst parentPageTransform = editor.getShapePageTransform(shape)\n\tconst parentPageCorners = parentPageTransform.applyToPoints(parentGeometry.vertices)\n\n\tconst parentPageMaskVertices = editor.getShapeMask(shape)\n\tconst parentPagePolygon = parentPageMaskVertices\n\t\t? intersectPolygonPolygon(parentPageMaskVertices, parentPageCorners)\n\t\t: parentPageCorners\n\n\tif (!parentPagePolygon) return EMPTY_ARRAY\n\n\treturn otherShapes.filter((childId) => {\n\t\tconst shapePageBounds = editor.getShapePageBounds(childId)\n\t\tif (!shapePageBounds || !parentPageBounds.includes(shapePageBounds)) return false\n\n\t\tconst parentPolygonInShapeShape = editor\n\t\t\t.getShapePageTransform(childId)\n\t\t\t.clone()\n\t\t\t.invert()\n\t\t\t.applyToPoints(parentPagePolygon)\n\n\t\tconst geometry = editor.getShapeGeometry(childId)\n\n\t\treturn geometry.overlapsPolygon(parentPolygonInShapeShape)\n\t})\n}\n\n/**\n * Get the shapes that will be reparented to new parents when the shapes are dropped.\n *\n * @param editor - The editor instance.\n * @param shapes - The shapes to check.\n * @param cb - A callback to filter out certain shapes.\n * @returns An object with the shapes that will be reparented to new parents and the shapes that will be reparented to the page or their ancestral group.\n *\n * @public\n */\nexport function getDroppedShapesToNewParents(\n\teditor: Editor,\n\tshapes: Set<TLShape> | TLShape[],\n\tcb?: (shape: TLShape, parent: TLShape) => boolean\n) {\n\tconst shapesToActuallyCheck = new Set<TLShape>(shapes)\n\tconst movingGroups = new Set<TLGroupShape>()\n\n\tfor (const shape of shapes) {\n\t\tconst parent = editor.getShapeParent(shape)\n\t\tif (parent && editor.isShapeOfType<TLGroupShape>(parent, 'group')) {\n\t\t\tif (!movingGroups.has(parent)) {\n\t\t\t\tmovingGroups.add(parent)\n\t\t\t}\n\t\t}\n\t}\n\n\t// If all of a group's children are moving, then move the group instead\n\tfor (const movingGroup of movingGroups) {\n\t\tconst children = compact(\n\t\t\teditor.getSortedChildIdsForParent(movingGroup).map((id) => editor.getShape(id))\n\t\t)\n\t\tfor (const child of children) {\n\t\t\tshapesToActuallyCheck.delete(child)\n\t\t}\n\t\tshapesToActuallyCheck.add(movingGroup)\n\t}\n\n\t// this could be cached and passed in\n\tconst shapeGroupIds = new Map<TLShapeId, TLShapeId | undefined>()\n\n\tconst reparenting = new Map<TLShapeId, TLShape[]>()\n\n\tconst remainingShapesToReparent = new Set(shapesToActuallyCheck)\n\n\tconst potentialParentShapes = editor\n\t\t.getCurrentPageShapesSorted()\n\t\t// filter out any shapes that aren't frames or that are included among the provided shapes\n\t\t.filter(\n\t\t\t(s) =>\n\t\t\t\teditor.getShapeUtil(s).canReceiveNewChildrenOfType?.(s, s.type) &&\n\t\t\t\t!remainingShapesToReparent.has(s)\n\t\t)\n\n\tparentCheck: for (let i = potentialParentShapes.length - 1; i >= 0; i--) {\n\t\tconst parentShape = potentialParentShapes[i]\n\t\tconst parentShapeContainingGroupId = editor.findShapeAncestor(parentShape, (s) =>\n\t\t\teditor.isShapeOfType<TLGroupShape>(s, 'group')\n\t\t)?.id\n\n\t\tconst parentGeometry = editor.getShapeGeometry(parentShape)\n\t\tconst parentPageTransform = editor.getShapePageTransform(parentShape)\n\t\tconst parentPageMaskVertices = editor.getShapeMask(parentShape)\n\t\tconst parentPageCorners = parentPageTransform.applyToPoints(parentGeometry.vertices)\n\t\tconst parentPagePolygon = parentPageMaskVertices\n\t\t\t? intersectPolygonPolygon(parentPageMaskVertices, parentPageCorners)\n\t\t\t: parentPageCorners\n\n\t\tif (!parentPagePolygon) continue parentCheck\n\n\t\tconst childrenToReparent = []\n\n\t\t// For each of the dropping shapes...\n\t\tshapeCheck: for (const shape of remainingShapesToReparent) {\n\t\t\t// Don't reparent a frame to itself\n\t\t\tif (parentShape.id === shape.id) continue shapeCheck\n\n\t\t\t// Use the callback to filter out certain shapes\n\t\t\tif (cb && !cb(shape, parentShape)) continue shapeCheck\n\n\t\t\tif (!shapeGroupIds.has(shape.id)) {\n\t\t\t\tshapeGroupIds.set(\n\t\t\t\t\tshape.id,\n\t\t\t\t\teditor.findShapeAncestor(shape, (s) => editor.isShapeOfType<TLGroupShape>(s, 'group'))?.id\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst shapeGroupId = shapeGroupIds.get(shape.id)\n\n\t\t\t// Are the shape and the parent part of different groups?\n\t\t\tif (shapeGroupId !== parentShapeContainingGroupId) continue shapeCheck\n\n\t\t\t// Is the shape is actually the ancestor of the parent?\n\t\t\tif (editor.findShapeAncestor(parentShape, (s) => shape.id === s.id)) continue shapeCheck\n\n\t\t\t// Convert the parent polygon to the shape's space\n\t\t\tconst parentPolygonInShapeSpace = editor\n\t\t\t\t.getShapePageTransform(shape)\n\t\t\t\t.clone()\n\t\t\t\t.invert()\n\t\t\t\t.applyToPoints(parentPagePolygon)\n\n\t\t\t// If the shape overlaps the parent polygon, reparent it to that parent\n\t\t\tif (editor.getShapeGeometry(shape).overlapsPolygon(parentPolygonInShapeSpace)) {\n\t\t\t\t// Use the util to check if the shape can be reparented to the parent\n\t\t\t\tif (\n\t\t\t\t\t!editor.getShapeUtil(parentShape).canReceiveNewChildrenOfType?.(parentShape, shape.type)\n\t\t\t\t)\n\t\t\t\t\tcontinue shapeCheck\n\n\t\t\t\tif (shape.parentId !== parentShape.id) {\n\t\t\t\t\tchildrenToReparent.push(shape)\n\t\t\t\t}\n\t\t\t\tremainingShapesToReparent.delete(shape)\n\t\t\t\tcontinue shapeCheck\n\t\t\t}\n\t\t}\n\n\t\tif (childrenToReparent.length) {\n\t\t\treparenting.set(parentShape.id, childrenToReparent)\n\t\t}\n\t}\n\n\treturn {\n\t\t// these are the shapes that will be reparented to new parents\n\t\treparenting,\n\t\t// these are the shapes that will be reparented to the page or their ancestral group\n\t\tremainingShapesToReparent,\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA4B;AAE5B,mBAAkE;AAElE,uBAAwC;AAYjC,SAAS,sBACf,QACA,UACA,MACC;AACD,QAAM,iBAAiB,oBAAI,IAAa;AAExC,aAAW,MAAM,UAAU;AAC1B,UAAM,QAAQ,OAAO,SAAS,EAAE;AAEhC,QAAI,CAAC,MAAO;AACZ,mBAAe,IAAI,KAAK;AAExB,UAAM,SAAS,OAAO,SAAS,MAAM,QAAQ;AAC7C,QAAI,CAAC,OAAQ;AACb,mBAAe,IAAI,MAAM;AAAA,EAC1B;AAGA,QAAM,wBAAwB,oBAAI,IAA0B;AAE5D,aAAW,UAAU,gBAAgB;AACpC,UAAM,WAAW,OAAO,2BAA2B,MAAM;AACzD,QAAI,MAAM,UAAU,CAAC,KAAK,OAAO,MAAM,GAAG;AAEzC,4BAAsB,IAAI,QAAQ,QAAQ;AAAA,IAC3C,OAAO;AACN,YAAM,sBAAsB,qBAAqB,QAAQ,OAAO,IAAI,QAAQ;AAC5E,UAAI,oBAAoB,SAAS,SAAS,QAAQ;AACjD,8BAAsB;AAAA,UACrB;AAAA,UACA,SAAS,OAAO,CAAC,OAAO,CAAC,oBAAoB,SAAS,EAAE,CAAC;AAAA,QAC1D;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAGA,QAAM,iBAAiB,OAAO,2BAA2B,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE;AAE1E,QAAM,uBAGF,CAAC;AAEL,aAAW,CAAC,YAAY,eAAe,KAAK,uBAAuB;AAClE,UAAM,mBAAe,sBAAQ,gBAAgB,IAAI,CAAC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H,QAAI,CAAC,kBAAmB,UAAS;AAEjC,UAAM,qBAAqB,CAAC;AAG5B,eAAY,YAAW,SAAS,2BAA2B;AAE1D,UAAI,YAAY,OAAO,MAAM,GAAI,UAAS;AAG1C,UAAI,MAAM,CAAC,GAAG,OAAO,WAAW,EAAG,UAAS;AAE5C,UAAI,CAAC,cAAc,IAAI,MAAM,EAAE,GAAG;AACjC,sBAAc;AAAA,UACb,MAAM;AAAA,UACN,OAAO,kBAAkB,OAAO,CAAC,MAAM,OAAO,cAA4B,GAAG,OAAO,CAAC,GAAG;AAAA,QACzF;AAAA,MACD;AAEA,YAAM,eAAe,cAAc,IAAI,MAAM,EAAE;AAG/C,UAAI,iBAAiB,6BAA8B,UAAS;AAG5D,UAAI,OAAO,kBAAkB,aAAa,CAAC,MAAM,MAAM,OAAO,EAAE,EAAE,EAAG,UAAS;AAG9E,YAAM,4BAA4B,OAChC,sBAAsB,KAAK,EAC3B,MAAM,EACN,OAAO,EACP,cAAc,iBAAiB;AAGjC,UAAI,OAAO,iBAAiB,KAAK,EAAE,gBAAgB,yBAAyB,GAAG;AAE9E,YACC,CAAC,OAAO,aAAa,WAAW,EAAE,8BAA8B,aAAa,MAAM,IAAI;AAEvF,mBAAS;AAEV,YAAI,MAAM,aAAa,YAAY,IAAI;AACtC,6BAAmB,KAAK,KAAK;AAAA,QAC9B;AACA,kCAA0B,OAAO,KAAK;AACtC,iBAAS;AAAA,MACV;AAAA,IACD;AAEA,QAAI,mBAAmB,QAAQ;AAC9B,kBAAY,IAAI,YAAY,IAAI,kBAAkB;AAAA,IACnD;AAAA,EACD;AAEA,SAAO;AAAA;AAAA,IAEN;AAAA;AAAA,IAEA;AAAA,EACD;AACD;",
6
+ "names": ["shapeIds"]
7
7
  }
@@ -22,10 +22,10 @@ __export(version_exports, {
22
22
  version: () => version
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- const version = "3.16.0-canary.acb40a76700b";
25
+ const version = "3.16.0-canary.b0fec0f5b729";
26
26
  const publishDates = {
27
27
  major: "2024-09-13T14:36:29.063Z",
28
- minor: "2025-08-14T14:04:21.487Z",
29
- patch: "2025-08-14T14:04:21.487Z"
28
+ minor: "2025-09-18T10:31:47.703Z",
29
+ patch: "2025-09-18T10:31:47.703Z"
30
30
  };
31
31
  //# sourceMappingURL=version.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/version.ts"],
4
- "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.16.0-canary.acb40a76700b'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-08-14T14:04:21.487Z',\n\tpatch: '2025-08-14T14:04:21.487Z',\n}\n"],
4
+ "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '3.16.0-canary.b0fec0f5b729'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-09-18T10:31:47.703Z',\n\tpatch: '2025-09-18T10:31:47.703Z',\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -510,6 +510,7 @@ export declare class Box {
510
510
  static ExpandBy(A: Box, n: number): Box;
511
511
  static Collides(A: Box, B: Box): boolean;
512
512
  static Contains(A: Box, B: Box): boolean;
513
+ static ContainsApproximately(A: Box, B: Box, precision?: number): boolean;
513
514
  static Includes(A: Box, B: Box): boolean;
514
515
  static ContainsPoint(A: Box, B: VecLike, margin?: number): boolean;
515
516
  static Common(boxes: Box[]): Box;
@@ -760,11 +761,6 @@ export declare class CubicSpline2d extends Geometry2d {
760
761
  /** @public */
761
762
  export declare function dataUrlToFile(url: string, filename: string, mimeType: string): Promise<File>;
762
763
 
763
- /**
764
- * @deprecated Licensing is now enabled in the tldraw SDK.
765
- * @public */
766
- export declare function debugEnableLicensing(): void;
767
-
768
764
  /* Excluded from this release type: DebugFlag */
769
765
 
770
766
  /* Excluded from this release type: DebugFlagDef */
@@ -890,6 +886,8 @@ export declare const defaultTldrawOptions: {
890
886
  readonly temporaryAssetPreviewLifetimeMs: 180000;
891
887
  readonly textShadowLod: 0.35;
892
888
  readonly tooltipDelayMs: 700;
889
+ readonly uiCoarseDragDistanceSquared: 625;
890
+ readonly uiDragDistanceSquared: 16;
893
891
  };
894
892
 
895
893
  /** @public */
@@ -981,7 +979,7 @@ export declare class EdgeScrollManager {
981
979
  /** @public */
982
980
  export declare class Editor extends EventEmitter<TLEventMap> {
983
981
  readonly id: string;
984
- constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, textOptions, initialState, autoFocus, inferDarkMode, options, isShapeHidden, getShapeVisibility, fontAssetUrls, }: TLEditorOptions);
982
+ constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, textOptions, initialState, autoFocus, inferDarkMode, options, getShapeVisibility, fontAssetUrls, }: TLEditorOptions);
985
983
  private readonly _getShapeVisibility?;
986
984
  private getIsShapeHiddenCache;
987
985
  isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
@@ -1048,22 +1046,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1048
1046
  * @public
1049
1047
  */
1050
1048
  readonly fonts: FontManager;
1051
- /**
1052
- * A manager for the editor's environment.
1053
- *
1054
- * @deprecated This is deprecated and will be removed in a future version. Use the `tlenv` global export instead.
1055
- * @public
1056
- */
1057
- readonly environment: {
1058
- hasCanvasSupport: boolean;
1059
- isAndroid: boolean;
1060
- isChromeForIos: boolean;
1061
- isDarwin: boolean;
1062
- isFirefox: boolean;
1063
- isIos: boolean;
1064
- isSafari: boolean;
1065
- isWebview: boolean;
1066
- };
1067
1049
  /**
1068
1050
  * A manager for the editor's scribbles.
1069
1051
  *
@@ -1206,22 +1188,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1206
1188
  * @public
1207
1189
  */
1208
1190
  getCanRedo(): boolean;
1209
- /**
1210
- * Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
1211
- * any redos.
1212
- *
1213
- * @example
1214
- * ```ts
1215
- * editor.mark()
1216
- * editor.mark('flip shapes')
1217
- * ```
1218
- *
1219
- * @param markId - The mark's id, usually the reason for adding the mark.
1220
- *
1221
- * @public
1222
- * @deprecated use {@link Editor.markHistoryStoppingPoint} instead
1223
- */
1224
- mark(markId?: string): this;
1225
1191
  /**
1226
1192
  * Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
1227
1193
  * any redos. You typically want to do this just before a user interaction begins or is handled.
@@ -1311,10 +1277,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1311
1277
  * @public
1312
1278
  */
1313
1279
  run(fn: () => void, opts?: TLEditorRunOptions): this;
1314
- /**
1315
- * @deprecated Use `Editor.run` instead.
1316
- */
1317
- batch(fn: () => void, opts?: TLEditorRunOptions): this;
1318
1280
  /* Excluded from this release type: annotateError */
1319
1281
  /* Excluded from this release type: createErrorAnnotations */
1320
1282
  /* Excluded from this release type: _crashingError */
@@ -1436,36 +1398,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1436
1398
  hasOpenMenus: () => boolean;
1437
1399
  isMenuOpen: (id: string) => boolean;
1438
1400
  };
1439
- /**
1440
- * @deprecated Use `editor.menus.getOpenMenus` instead.
1441
- *
1442
- * @public
1443
- */
1444
- getOpenMenus(): string[];
1445
- /**
1446
- * @deprecated Use `editor.menus.addOpenMenu` instead.
1447
- *
1448
- * @public
1449
- */
1450
- addOpenMenu(id: string): this;
1451
- /**
1452
- * @deprecated Use `editor.menus.deleteOpenMenu` instead.
1453
- *
1454
- * @public
1455
- */
1456
- deleteOpenMenu(id: string): this;
1457
- /**
1458
- * @deprecated Use `editor.menus.clearOpenMenus` instead.
1459
- *
1460
- * @public
1461
- */
1462
- clearOpenMenus(): this;
1463
- /**
1464
- * @deprecated Use `editor.menus.hasAnyOpenMenus` instead.
1465
- *
1466
- * @public
1467
- */
1468
- getIsMenuOpen(): boolean;
1469
1401
  /**
1470
1402
  * Set the cursor.
1471
1403
  *
@@ -2914,8 +2846,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2914
2846
  * @public
2915
2847
  */
2916
2848
  getShapeAndDescendantIds(ids: TLShapeId[]): Set<TLShapeId>;
2917
- /** @deprecated Use {@link Editor.getDraggingOverShape} instead */
2918
- getDroppingOverShape(point: Vec, droppingShapes: TLShape[]): TLShape | undefined;
2919
2849
  /**
2920
2850
  * Get the shape that some shapes should be dropped on at a given point.
2921
2851
  *
@@ -3627,14 +3557,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3627
3557
  * Handle external content, such as files, urls, embeds, or plain text which has been put into the app, for example by pasting external text or dropping external images onto canvas.
3628
3558
  *
3629
3559
  * @param info - Info about the external content.
3560
+ * @param opts - Options for handling external content, including force flag to bypass readonly checks.
3630
3561
  */
3631
- putExternalContent<E>(info: TLExternalContent<E>): Promise<void>;
3562
+ putExternalContent<E>(info: TLExternalContent<E>, opts?: {
3563
+ force?: boolean;
3564
+ }): Promise<void>;
3632
3565
  /**
3633
3566
  * Handle replacing external content.
3634
3567
  *
3635
3568
  * @param info - Info about the external content.
3569
+ * @param opts - Options for handling external content, including force flag to bypass readonly checks.
3636
3570
  */
3637
- replaceExternalContent<E>(info: TLExternalContent<E>): Promise<void>;
3571
+ replaceExternalContent<E>(info: TLExternalContent<E>, opts?: {
3572
+ force?: boolean;
3573
+ }): Promise<void>;
3638
3574
  /**
3639
3575
  * Get content that can be exported for the given shape ids.
3640
3576
  *
@@ -3690,8 +3626,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3690
3626
  svg: string;
3691
3627
  width: number;
3692
3628
  } | undefined>;
3693
- /** @deprecated Use {@link Editor.getSvgString} or {@link Editor.getSvgElement} instead. */
3694
- getSvg(shapes: TLShape[] | TLShapeId[], opts?: TLSvgExportOptions): Promise<SVGSVGElement | undefined>;
3695
3629
  /**
3696
3630
  * Get an exported image of the given shapes.
3697
3631
  *
@@ -3706,6 +3640,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3706
3640
  height: number;
3707
3641
  width: number;
3708
3642
  }>;
3643
+ /**
3644
+ * Get an exported image of the given shapes as a data URL.
3645
+ *
3646
+ * @param shapes - The shapes (or shape ids) to export.
3647
+ * @param opts - Options for the export.
3648
+ *
3649
+ * @returns A data URL of the image.
3650
+ * @public
3651
+ */
3652
+ toImageDataUrl(shapes: TLShape[] | TLShapeId[], opts?: TLImageExportOptions): Promise<{
3653
+ height: number;
3654
+ url: string;
3655
+ width: number;
3656
+ }>;
3709
3657
  /**
3710
3658
  * The app's current input state.
3711
3659
  *
@@ -4011,6 +3959,31 @@ export declare class Editor extends EventEmitter<TLEventMap> {
4011
3959
  /* Excluded from this release type: capturedPointerId */
4012
3960
  /* Excluded from this release type: performanceTracker */
4013
3961
  /* Excluded from this release type: performanceTrackerTimeout */
3962
+ /* Excluded from this release type: handledEvents */
3963
+ /**
3964
+ * In tldraw, events are sometimes handled by multiple components. For example, the shapes might
3965
+ * have events, but the canvas handles events too. The way that the canvas handles events can
3966
+ * interfere with the with the shapes event handlers - for example, it calls `.preventDefault()`
3967
+ * on `pointerDown`, which also prevents `click` events from firing on the shapes.
3968
+ *
3969
+ * You can use `.stopPropagation()` to prevent the event from propagating to the rest of the
3970
+ * DOM, but that can impact non-tldraw event handlers set up elsewhere. By using
3971
+ * `markEventAsHandled`, you'll stop other parts of tldraw from handling the event without
3972
+ * impacting other, non-tldraw event handlers. See also {@link Editor.wasEventAlreadyHandled}.
3973
+ *
3974
+ * @public
3975
+ */
3976
+ markEventAsHandled(e: {
3977
+ nativeEvent: Event;
3978
+ } | Event): void;
3979
+ /**
3980
+ * Checks if an event has already been handled. See {@link Editor.markEventAsHandled}.
3981
+ *
3982
+ * @public
3983
+ */
3984
+ wasEventAlreadyHandled(e: {
3985
+ nativeEvent: Event;
3986
+ } | Event): boolean;
4014
3987
  /**
4015
3988
  * Dispatch an event to the editor.
4016
3989
  *
@@ -4147,6 +4120,7 @@ export declare abstract class Geometry2d {
4147
4120
  isLabel: boolean;
4148
4121
  isEmptyLabel: boolean;
4149
4122
  isInternal: boolean;
4123
+ excludeFromShapeBounds: boolean;
4150
4124
  debugColor?: string;
4151
4125
  ignore?: boolean;
4152
4126
  constructor(opts: Geometry2dOptions);
@@ -4170,12 +4144,14 @@ export declare abstract class Geometry2d {
4170
4144
  * along the edge it is as a fraction of the total length.
4171
4145
  */
4172
4146
  uninterpolateAlongEdge(point: VecLike, _filters?: Geometry2dFilters): number;
4173
- /** @deprecated Iterate the vertices instead. */
4174
- nearestPointOnLineSegment(A: VecLike, B: VecLike): Vec;
4175
4147
  isPointInBounds(point: VecLike, margin?: number): boolean;
4148
+ overlapsPolygon(_polygon: VecLike[]): boolean;
4176
4149
  transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
4177
4150
  private _vertices;
4178
4151
  get vertices(): Vec[];
4152
+ getBoundsVertices(): Vec[];
4153
+ private _boundsVertices;
4154
+ get boundsVertices(): Vec[];
4179
4155
  getBounds(): Box;
4180
4156
  private _bounds;
4181
4157
  get bounds(): Box;
@@ -4283,7 +4259,7 @@ export declare function getPerfectDashProps(totalLength: number, strokeWidth: nu
4283
4259
  };
4284
4260
 
4285
4261
  /** @public */
4286
- export declare function getPointerInfo(e: PointerEvent | React.PointerEvent): {
4262
+ export declare function getPointerInfo(editor: Editor, e: PointerEvent | React.PointerEvent): {
4287
4263
  accelKey: boolean;
4288
4264
  altKey: boolean;
4289
4265
  button: number;
@@ -4372,6 +4348,7 @@ export declare class Group2d extends Geometry2d {
4372
4348
  hitTestLineSegment(A: VecLike, B: VecLike, zoom: number, filters?: Geometry2dFilters): boolean;
4373
4349
  intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): VecLike[];
4374
4350
  intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): VecLike[];
4351
+ getBoundsVertices(): Vec[];
4375
4352
  intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
4376
4353
  intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
4377
4354
  interpolateAlongEdge(t: number, filters?: Geometry2dFilters): Vec;
@@ -4381,6 +4358,7 @@ export declare class Group2d extends Geometry2d {
4381
4358
  toSimpleSvgPath(): string;
4382
4359
  getLength(filters?: Geometry2dFilters): number;
4383
4360
  getSvgPathData(): string;
4361
+ overlapsPolygon(polygon: VecLike[]): boolean;
4384
4362
  }
4385
4363
 
4386
4364
  /** @public */
@@ -4621,12 +4599,16 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
4621
4599
  filter?(parent: TLShape): boolean;
4622
4600
  }): void;
4623
4601
 
4602
+ /* Excluded from this release type: LICENSE_TIMEOUT */
4603
+
4624
4604
  /* Excluded from this release type: LicenseFromKeyResult */
4625
4605
 
4626
4606
  /* Excluded from this release type: LicenseInfo */
4627
4607
 
4628
4608
  /* Excluded from this release type: LicenseManager */
4629
4609
 
4610
+ /* Excluded from this release type: LicenseState */
4611
+
4630
4612
  /** @public */
4631
4613
  export declare function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
4632
4614
 
@@ -5232,7 +5214,34 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5232
5214
  * @public
5233
5215
  */
5234
5216
  canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean;
5217
+ /**
5218
+ * Whether this shape can be culled. By default, shapes are culled for
5219
+ * performance reasons when they are outside of the viewport. Culled shapes are still rendered
5220
+ * to the DOM, but have their `display` property set to `none`.
5221
+ *
5222
+ * @param shape - The shape.
5223
+ */
5224
+ canCull(_shape: Shape): boolean;
5235
5225
  /* Excluded from this release type: providesBackgroundForChildren */
5226
+ /**
5227
+ * Get the clip path to apply to this shape's children.
5228
+ *
5229
+ * @param shape - The shape to get the clip path for
5230
+ * @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
5231
+ * @public
5232
+ */
5233
+ getClipPath?(shape: Shape): undefined | Vec[];
5234
+ /**
5235
+ * Whether a specific child shape should be clipped by this shape.
5236
+ * Only called if getClipPath returns a valid polygon.
5237
+ *
5238
+ * If not defined, the default behavior is to clip all children.
5239
+ *
5240
+ * @param child - The child shape to check
5241
+ * @returns boolean indicating if this child should be clipped
5242
+ * @public
5243
+ */
5244
+ shouldClipChild?(child: TLShape): boolean;
5236
5245
  /**
5237
5246
  * Whether the shape should hide its resize handles when selected.
5238
5247
  *
@@ -5263,6 +5272,17 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5263
5272
  * @public
5264
5273
  */
5265
5274
  isAspectRatioLocked(_shape: Shape): boolean;
5275
+ /**
5276
+ * By default, the bounds of an image export are the bounds of all the shapes it contains, plus
5277
+ * some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
5278
+ * padding is skipped _if the bounds of that shape contains all the other shapes_. This is
5279
+ * useful in cases like annotating on top of an image, where you usually want to avoid extra
5280
+ * padding around the image if you don't need it.
5281
+ *
5282
+ * @param _shape - The shape to check
5283
+ * @returns True if this shape should be treated as an export bounds container
5284
+ */
5285
+ isExportBoundsContainer(_shape: Shape): boolean;
5266
5286
  /* Excluded from this release type: backgroundComponent */
5267
5287
  /**
5268
5288
  * Get the interpolated props for an animating shape. This is an optional method.
@@ -5818,7 +5838,14 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
5818
5838
  onExit?(info: any, to: string): void;
5819
5839
  }
5820
5840
 
5821
- /** @public */
5841
+ /**
5842
+ * Calls `event.stopPropagation()`.
5843
+ *
5844
+ * @deprecated Use {@link Editor.markEventAsHandled} instead, or manually call `event.stopPropagation()` if
5845
+ * that's what you really want.
5846
+ *
5847
+ * @public
5848
+ */
5822
5849
  export declare const stopEventPropagation: (e: any) => any;
5823
5850
 
5824
5851
  /* Excluded from this release type: StoreName */
@@ -6309,12 +6336,6 @@ export declare interface TldrawEditorBaseProps {
6309
6336
  * Options for syncing the editor's camera state with the URL.
6310
6337
  */
6311
6338
  deepLinks?: TLDeepLinkOptions | true;
6312
- /**
6313
- * Predicate for whether or not a shape should be hidden.
6314
- *
6315
- * @deprecated Use {@link TldrawEditorBaseProps#getShapeVisibility} instead.
6316
- */
6317
- isShapeHidden?(shape: TLShape, editor: Editor): boolean;
6318
6339
  /**
6319
6340
  * Provides a way to hide shapes.
6320
6341
  *
@@ -6422,6 +6443,8 @@ export declare interface TldrawOptions {
6422
6443
  readonly multiClickDurationMs: number;
6423
6444
  readonly coarseDragDistanceSquared: number;
6424
6445
  readonly dragDistanceSquared: number;
6446
+ readonly uiDragDistanceSquared: number;
6447
+ readonly uiCoarseDragDistanceSquared: number;
6425
6448
  readonly defaultSvgPadding: number;
6426
6449
  readonly cameraSlideFriction: number;
6427
6450
  readonly gridSteps: readonly {
@@ -6574,15 +6597,6 @@ export declare interface TLEditorOptions {
6574
6597
  fontAssetUrls?: {
6575
6598
  [key: string]: string | undefined;
6576
6599
  };
6577
- /**
6578
- * A predicate that should return true if the given shape should be hidden.
6579
- *
6580
- * @deprecated Use {@link Editor#getShapeVisibility} instead.
6581
- *
6582
- * @param shape - The shape to check.
6583
- * @param editor - The editor instance.
6584
- */
6585
- isShapeHidden?(shape: TLShape, editor: Editor): boolean;
6586
6600
  /**
6587
6601
  * Provides a way to hide shapes.
6588
6602
  *
@@ -7573,12 +7587,6 @@ export declare interface TLSvgExportOptions {
7573
7587
  preserveAspectRatio?: React.SVGAttributes<SVGSVGElement>['preserveAspectRatio'];
7574
7588
  }
7575
7589
 
7576
- /**
7577
- * @public
7578
- * @deprecated use {@link TLImageExportOptions} instead
7579
- */
7580
- export declare type TLSvgOptions = TLImageExportOptions;
7581
-
7582
7590
  /** @public */
7583
7591
  export declare interface TLSvgTextExternalContent extends TLBaseExternalContent {
7584
7592
  type: 'svg-text';
@@ -7732,6 +7740,7 @@ export declare class TransformedGeometry2d extends Geometry2d {
7732
7740
  private readonly decomposed;
7733
7741
  constructor(geometry: Geometry2d, matrix: MatModel, opts?: TransformedGeometry2dOptions);
7734
7742
  getVertices(filters: Geometry2dFilters): Vec[];
7743
+ getBoundsVertices(): Vec[];
7735
7744
  nearestPoint(point: VecLike, filters?: Geometry2dFilters): Vec;
7736
7745
  hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean, filters?: Geometry2dFilters): boolean;
7737
7746
  distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
@@ -7752,6 +7761,7 @@ export declare interface TransformedGeometry2dOptions {
7752
7761
  isInternal?: boolean;
7753
7762
  debugColor?: string;
7754
7763
  ignore?: boolean;
7764
+ excludeFromShapeBounds?: boolean;
7755
7765
  }
7756
7766
 
7757
7767
  /** @public */
@@ -7986,8 +7996,6 @@ export declare class Vec {
7986
7996
  lrp(B: VecLike, t: number): Vec;
7987
7997
  equals(B: VecLike): boolean;
7988
7998
  equalsXY(x: number, y: number): boolean;
7989
- /** @deprecated use `uni` instead */
7990
- norm(): this;
7991
7999
  toFixed(): this;
7992
8000
  toString(): string;
7993
8001
  toJson(): VecModel;
@@ -175,6 +175,7 @@ import { useViewportHeight } from "./lib/hooks/useViewportHeight.mjs";
175
175
  import {
176
176
  LicenseManager
177
177
  } from "./lib/license/LicenseManager.mjs";
178
+ import { LICENSE_TIMEOUT } from "./lib/license/LicenseProvider.mjs";
178
179
  import { defaultTldrawOptions } from "./lib/options.mjs";
179
180
  import {
180
181
  Box,
@@ -298,12 +299,9 @@ import { hardReset } from "./lib/utils/sync/hardReset.mjs";
298
299
  import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
299
300
  import { uniq } from "./lib/utils/uniq.mjs";
300
301
  import { openWindow } from "./lib/utils/window-open.mjs";
301
- function debugEnableLicensing() {
302
- return;
303
- }
304
302
  registerTldrawLibraryVersion(
305
303
  "@tldraw/editor",
306
- "3.16.0-canary.acb40a76700b",
304
+ "3.16.0-canary.b0fec0f5b729",
307
305
  "esm"
308
306
  );
309
307
  export {
@@ -358,6 +356,7 @@ export {
358
356
  HTMLContainer,
359
357
  HandleSnaps,
360
358
  HistoryManager,
359
+ LICENSE_TIMEOUT,
361
360
  LicenseManager,
362
361
  LoadingScreen,
363
362
  LocalIndexedDb,
@@ -409,7 +408,6 @@ export {
409
408
  createTLStore,
410
409
  createTLUser,
411
410
  dataUrlToFile,
412
- debugEnableLicensing,
413
411
  debugFlags,
414
412
  defaultTldrawOptions,
415
413
  defaultUserPreferences,