@tldraw/editor 3.16.0-internal.a478398270c6 → 3.16.0-internal.f8b97f0c414f

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 (325) hide show
  1. package/dist-cjs/index.d.ts +350 -142
  2. package/dist-cjs/index.js +13 -6
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +10 -8
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/MenuClickCapture.js +0 -5
  7. package/dist-cjs/lib/components/MenuClickCapture.js.map +2 -2
  8. package/dist-cjs/lib/components/SVGContainer.js +1 -1
  9. package/dist-cjs/lib/components/SVGContainer.js.map +2 -2
  10. package/dist-cjs/lib/components/Shape.js +11 -36
  11. package/dist-cjs/lib/components/Shape.js.map +2 -2
  12. package/dist-cjs/lib/components/default-components/DefaultBrush.js +1 -1
  13. package/dist-cjs/lib/components/default-components/DefaultBrush.js.map +2 -2
  14. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +15 -24
  15. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  16. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +2 -2
  17. package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +2 -2
  18. package/dist-cjs/lib/components/default-components/DefaultCursor.js +1 -1
  19. package/dist-cjs/lib/components/default-components/DefaultCursor.js.map +2 -2
  20. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +1 -1
  21. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
  22. package/dist-cjs/lib/components/default-components/DefaultGrid.js +1 -1
  23. package/dist-cjs/lib/components/default-components/DefaultGrid.js.map +2 -2
  24. package/dist-cjs/lib/components/default-components/DefaultHandles.js +1 -1
  25. package/dist-cjs/lib/components/default-components/DefaultHandles.js.map +2 -2
  26. package/dist-cjs/lib/components/default-components/DefaultScribble.js +1 -1
  27. package/dist-cjs/lib/components/default-components/DefaultScribble.js.map +2 -2
  28. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +9 -1
  29. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
  30. package/dist-cjs/lib/components/default-components/DefaultShapeWrapper.js +53 -0
  31. package/dist-cjs/lib/components/default-components/DefaultShapeWrapper.js.map +7 -0
  32. package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js +1 -1
  33. package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js.map +2 -2
  34. package/dist-cjs/lib/components/default-components/DefaultSpinner.js +27 -15
  35. package/dist-cjs/lib/components/default-components/DefaultSpinner.js.map +3 -3
  36. package/dist-cjs/lib/config/TLUserPreferences.js +15 -3
  37. package/dist-cjs/lib/config/TLUserPreferences.js.map +2 -2
  38. package/dist-cjs/lib/editor/Editor.js +174 -180
  39. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  40. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +4 -0
  41. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +2 -2
  42. package/dist-cjs/lib/editor/derivations/parentsToChildren.js.map +2 -2
  43. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +14 -4
  44. package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
  45. package/dist-cjs/lib/editor/shapes/BaseBoxShapeUtil.js.map +1 -1
  46. package/dist-cjs/lib/editor/shapes/ShapeUtil.js +23 -0
  47. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  48. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.js.map +2 -2
  49. package/dist-cjs/lib/editor/tools/StateNode.js +20 -1
  50. package/dist-cjs/lib/editor/tools/StateNode.js.map +2 -2
  51. package/dist-cjs/lib/editor/types/misc-types.js.map +1 -1
  52. package/dist-cjs/lib/exports/getSvgJsx.js +35 -16
  53. package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
  54. package/dist-cjs/lib/hooks/useCanvasEvents.js +44 -35
  55. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  56. package/dist-cjs/lib/hooks/useDocumentEvents.js +5 -5
  57. package/dist-cjs/lib/hooks/useDocumentEvents.js.map +2 -2
  58. package/dist-cjs/lib/hooks/useEditor.js +1 -4
  59. package/dist-cjs/lib/hooks/useEditor.js.map +2 -2
  60. package/dist-cjs/lib/hooks/useEditorComponents.js +2 -0
  61. package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
  62. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js +1 -2
  63. package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
  64. package/dist-cjs/lib/hooks/useGestureEvents.js +1 -1
  65. package/dist-cjs/lib/hooks/useGestureEvents.js.map +2 -2
  66. package/dist-cjs/lib/hooks/useHandleEvents.js +3 -3
  67. package/dist-cjs/lib/hooks/useHandleEvents.js.map +2 -2
  68. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +4 -1
  69. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +2 -2
  70. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js +4 -1
  71. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
  72. package/dist-cjs/lib/hooks/useSelectionEvents.js +4 -4
  73. package/dist-cjs/lib/hooks/useSelectionEvents.js.map +2 -2
  74. package/dist-cjs/lib/{utils/nearestMultiple.js → hooks/useStateAttribute.js} +15 -14
  75. package/dist-cjs/lib/hooks/useStateAttribute.js.map +7 -0
  76. package/dist-cjs/lib/license/LicenseManager.js +140 -53
  77. package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
  78. package/dist-cjs/lib/license/LicenseProvider.js +39 -1
  79. package/dist-cjs/lib/license/LicenseProvider.js.map +2 -2
  80. package/dist-cjs/lib/license/Watermark.js +75 -13
  81. package/dist-cjs/lib/license/Watermark.js.map +3 -3
  82. package/dist-cjs/lib/license/useLicenseManagerState.js.map +2 -2
  83. package/dist-cjs/lib/options.js +7 -0
  84. package/dist-cjs/lib/options.js.map +2 -2
  85. package/dist-cjs/lib/primitives/Box.js +3 -0
  86. package/dist-cjs/lib/primitives/Box.js.map +2 -2
  87. package/dist-cjs/lib/primitives/Vec.js +0 -4
  88. package/dist-cjs/lib/primitives/Vec.js.map +2 -2
  89. package/dist-cjs/lib/primitives/geometry/Arc2d.js +1 -1
  90. package/dist-cjs/lib/primitives/geometry/Arc2d.js.map +2 -2
  91. package/dist-cjs/lib/primitives/geometry/Circle2d.js +1 -1
  92. package/dist-cjs/lib/primitives/geometry/Circle2d.js.map +2 -2
  93. package/dist-cjs/lib/primitives/geometry/CubicBezier2d.js +3 -1
  94. package/dist-cjs/lib/primitives/geometry/CubicBezier2d.js.map +2 -2
  95. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js +1 -1
  96. package/dist-cjs/lib/primitives/geometry/Ellipse2d.js.map +2 -2
  97. package/dist-cjs/lib/primitives/geometry/Geometry2d.js +50 -20
  98. package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
  99. package/dist-cjs/lib/primitives/geometry/Group2d.js +8 -1
  100. package/dist-cjs/lib/primitives/geometry/Group2d.js.map +2 -2
  101. package/dist-cjs/lib/primitives/geometry/geometry-constants.js +2 -2
  102. package/dist-cjs/lib/primitives/geometry/geometry-constants.js.map +2 -2
  103. package/dist-cjs/lib/primitives/intersect.js +4 -4
  104. package/dist-cjs/lib/primitives/intersect.js.map +2 -2
  105. package/dist-cjs/lib/primitives/utils.js +4 -0
  106. package/dist-cjs/lib/primitives/utils.js.map +2 -2
  107. package/dist-cjs/lib/utils/EditorAtom.js +45 -0
  108. package/dist-cjs/lib/utils/EditorAtom.js.map +7 -0
  109. package/dist-cjs/lib/utils/dom.js +12 -1
  110. package/dist-cjs/lib/utils/dom.js.map +2 -2
  111. package/dist-cjs/lib/utils/getPointerInfo.js +2 -2
  112. package/dist-cjs/lib/utils/getPointerInfo.js.map +2 -2
  113. package/dist-cjs/lib/utils/reparenting.js +2 -35
  114. package/dist-cjs/lib/utils/reparenting.js.map +3 -3
  115. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js +0 -1
  116. package/dist-cjs/lib/utils/sync/TLLocalSyncClient.js.map +2 -2
  117. package/dist-cjs/version.js +3 -3
  118. package/dist-cjs/version.js.map +1 -1
  119. package/dist-esm/index.d.mts +350 -142
  120. package/dist-esm/index.mjs +24 -8
  121. package/dist-esm/index.mjs.map +2 -2
  122. package/dist-esm/lib/TldrawEditor.mjs +11 -9
  123. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  124. package/dist-esm/lib/components/MenuClickCapture.mjs +0 -5
  125. package/dist-esm/lib/components/MenuClickCapture.mjs.map +2 -2
  126. package/dist-esm/lib/components/SVGContainer.mjs +1 -1
  127. package/dist-esm/lib/components/SVGContainer.mjs.map +2 -2
  128. package/dist-esm/lib/components/Shape.mjs +11 -36
  129. package/dist-esm/lib/components/Shape.mjs.map +2 -2
  130. package/dist-esm/lib/components/default-components/DefaultBrush.mjs +1 -1
  131. package/dist-esm/lib/components/default-components/DefaultBrush.mjs.map +2 -2
  132. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +16 -25
  133. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  134. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +2 -2
  135. package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +2 -2
  136. package/dist-esm/lib/components/default-components/DefaultCursor.mjs +1 -1
  137. package/dist-esm/lib/components/default-components/DefaultCursor.mjs.map +2 -2
  138. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +1 -1
  139. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
  140. package/dist-esm/lib/components/default-components/DefaultGrid.mjs +1 -1
  141. package/dist-esm/lib/components/default-components/DefaultGrid.mjs.map +2 -2
  142. package/dist-esm/lib/components/default-components/DefaultHandles.mjs +1 -1
  143. package/dist-esm/lib/components/default-components/DefaultHandles.mjs.map +2 -2
  144. package/dist-esm/lib/components/default-components/DefaultScribble.mjs +1 -1
  145. package/dist-esm/lib/components/default-components/DefaultScribble.mjs.map +2 -2
  146. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +9 -1
  147. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
  148. package/dist-esm/lib/components/default-components/DefaultShapeWrapper.mjs +23 -0
  149. package/dist-esm/lib/components/default-components/DefaultShapeWrapper.mjs.map +7 -0
  150. package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs +1 -1
  151. package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs.map +2 -2
  152. package/dist-esm/lib/components/default-components/DefaultSpinner.mjs +17 -15
  153. package/dist-esm/lib/components/default-components/DefaultSpinner.mjs.map +2 -2
  154. package/dist-esm/lib/config/TLUserPreferences.mjs +15 -3
  155. package/dist-esm/lib/config/TLUserPreferences.mjs.map +2 -2
  156. package/dist-esm/lib/editor/Editor.mjs +174 -180
  157. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  158. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +4 -0
  159. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +2 -2
  160. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs.map +2 -2
  161. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +14 -4
  162. package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
  163. package/dist-esm/lib/editor/shapes/BaseBoxShapeUtil.mjs.map +1 -1
  164. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +23 -0
  165. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  166. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.mjs.map +2 -2
  167. package/dist-esm/lib/editor/tools/StateNode.mjs +20 -1
  168. package/dist-esm/lib/editor/tools/StateNode.mjs.map +2 -2
  169. package/dist-esm/lib/exports/getSvgJsx.mjs +36 -16
  170. package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
  171. package/dist-esm/lib/hooks/useCanvasEvents.mjs +47 -37
  172. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  173. package/dist-esm/lib/hooks/useDocumentEvents.mjs +11 -6
  174. package/dist-esm/lib/hooks/useDocumentEvents.mjs.map +2 -2
  175. package/dist-esm/lib/hooks/useEditor.mjs +1 -4
  176. package/dist-esm/lib/hooks/useEditor.mjs.map +2 -2
  177. package/dist-esm/lib/hooks/useEditorComponents.mjs +4 -0
  178. package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
  179. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs +2 -3
  180. package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
  181. package/dist-esm/lib/hooks/useGestureEvents.mjs +2 -2
  182. package/dist-esm/lib/hooks/useGestureEvents.mjs.map +2 -2
  183. package/dist-esm/lib/hooks/useHandleEvents.mjs +9 -4
  184. package/dist-esm/lib/hooks/useHandleEvents.mjs.map +2 -2
  185. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +4 -1
  186. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +2 -2
  187. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs +4 -1
  188. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
  189. package/dist-esm/lib/hooks/useSelectionEvents.mjs +6 -5
  190. package/dist-esm/lib/hooks/useSelectionEvents.mjs.map +2 -2
  191. package/dist-esm/lib/hooks/useStateAttribute.mjs +15 -0
  192. package/dist-esm/lib/hooks/useStateAttribute.mjs.map +7 -0
  193. package/dist-esm/lib/license/LicenseManager.mjs +141 -54
  194. package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
  195. package/dist-esm/lib/license/LicenseProvider.mjs +39 -2
  196. package/dist-esm/lib/license/LicenseProvider.mjs.map +2 -2
  197. package/dist-esm/lib/license/Watermark.mjs +76 -14
  198. package/dist-esm/lib/license/Watermark.mjs.map +3 -3
  199. package/dist-esm/lib/license/useLicenseManagerState.mjs.map +2 -2
  200. package/dist-esm/lib/options.mjs +7 -0
  201. package/dist-esm/lib/options.mjs.map +2 -2
  202. package/dist-esm/lib/primitives/Box.mjs +4 -1
  203. package/dist-esm/lib/primitives/Box.mjs.map +2 -2
  204. package/dist-esm/lib/primitives/Vec.mjs +0 -4
  205. package/dist-esm/lib/primitives/Vec.mjs.map +2 -2
  206. package/dist-esm/lib/primitives/geometry/Arc2d.mjs +2 -2
  207. package/dist-esm/lib/primitives/geometry/Arc2d.mjs.map +2 -2
  208. package/dist-esm/lib/primitives/geometry/Circle2d.mjs +2 -2
  209. package/dist-esm/lib/primitives/geometry/Circle2d.mjs.map +2 -2
  210. package/dist-esm/lib/primitives/geometry/CubicBezier2d.mjs +3 -1
  211. package/dist-esm/lib/primitives/geometry/CubicBezier2d.mjs.map +2 -2
  212. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs +2 -2
  213. package/dist-esm/lib/primitives/geometry/Ellipse2d.mjs.map +2 -2
  214. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +53 -21
  215. package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
  216. package/dist-esm/lib/primitives/geometry/Group2d.mjs +8 -1
  217. package/dist-esm/lib/primitives/geometry/Group2d.mjs.map +2 -2
  218. package/dist-esm/lib/primitives/geometry/geometry-constants.mjs +2 -2
  219. package/dist-esm/lib/primitives/geometry/geometry-constants.mjs.map +2 -2
  220. package/dist-esm/lib/primitives/intersect.mjs +5 -5
  221. package/dist-esm/lib/primitives/intersect.mjs.map +2 -2
  222. package/dist-esm/lib/primitives/utils.mjs +4 -0
  223. package/dist-esm/lib/primitives/utils.mjs.map +2 -2
  224. package/dist-esm/lib/utils/EditorAtom.mjs +25 -0
  225. package/dist-esm/lib/utils/EditorAtom.mjs.map +7 -0
  226. package/dist-esm/lib/utils/dom.mjs +12 -1
  227. package/dist-esm/lib/utils/dom.mjs.map +2 -2
  228. package/dist-esm/lib/utils/getPointerInfo.mjs +2 -2
  229. package/dist-esm/lib/utils/getPointerInfo.mjs.map +2 -2
  230. package/dist-esm/lib/utils/reparenting.mjs +3 -40
  231. package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
  232. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs +0 -1
  233. package/dist-esm/lib/utils/sync/TLLocalSyncClient.mjs.map +2 -2
  234. package/dist-esm/version.mjs +3 -3
  235. package/dist-esm/version.mjs.map +1 -1
  236. package/editor.css +327 -315
  237. package/package.json +16 -38
  238. package/src/index.ts +19 -10
  239. package/src/lib/TldrawEditor.tsx +16 -21
  240. package/src/lib/components/MenuClickCapture.tsx +0 -8
  241. package/src/lib/components/SVGContainer.tsx +1 -1
  242. package/src/lib/components/Shape.tsx +12 -33
  243. package/src/lib/components/default-components/DefaultBrush.tsx +1 -1
  244. package/src/lib/components/default-components/DefaultCanvas.tsx +13 -24
  245. package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +2 -2
  246. package/src/lib/components/default-components/DefaultCursor.tsx +1 -1
  247. package/src/lib/components/default-components/DefaultErrorFallback.tsx +1 -1
  248. package/src/lib/components/default-components/DefaultGrid.tsx +1 -1
  249. package/src/lib/components/default-components/DefaultHandles.tsx +5 -1
  250. package/src/lib/components/default-components/DefaultScribble.tsx +1 -1
  251. package/src/lib/components/default-components/DefaultShapeIndicator.tsx +6 -2
  252. package/src/lib/components/default-components/DefaultShapeWrapper.tsx +35 -0
  253. package/src/lib/components/default-components/DefaultSnapIndictor.tsx +1 -1
  254. package/src/lib/components/default-components/DefaultSpinner.tsx +12 -12
  255. package/src/lib/config/TLUserPreferences.ts +15 -1
  256. package/src/lib/editor/Editor.test.ts +512 -8
  257. package/src/lib/editor/Editor.ts +252 -267
  258. package/src/lib/editor/derivations/notVisibleShapes.ts +6 -0
  259. package/src/lib/editor/derivations/parentsToChildren.ts +1 -1
  260. package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +15 -14
  261. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +16 -15
  262. package/src/lib/editor/managers/FocusManager/FocusManager.test.ts +49 -48
  263. package/src/lib/editor/managers/FontManager/FontManager.test.ts +38 -27
  264. package/src/lib/editor/managers/HistoryManager/HistoryManager.test.ts +7 -6
  265. package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +12 -11
  266. package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +57 -50
  267. package/src/lib/editor/managers/TextManager/TextManager.test.ts +51 -26
  268. package/src/lib/editor/managers/TickManager/TickManager.test.ts +14 -13
  269. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +55 -26
  270. package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +14 -1
  271. package/src/lib/editor/shapes/BaseBoxShapeUtil.tsx +2 -2
  272. package/src/lib/editor/shapes/ShapeUtil.ts +108 -8
  273. package/src/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.ts +2 -1
  274. package/src/lib/editor/tools/StateNode.test.ts +285 -0
  275. package/src/lib/editor/tools/StateNode.ts +27 -1
  276. package/src/lib/editor/types/misc-types.ts +73 -7
  277. package/src/lib/exports/getSvgJsx.test.ts +874 -0
  278. package/src/lib/exports/getSvgJsx.tsx +78 -21
  279. package/src/lib/hooks/useCanvasEvents.ts +60 -47
  280. package/src/lib/hooks/useDocumentEvents.ts +11 -6
  281. package/src/lib/hooks/useEditor.tsx +6 -5
  282. package/src/lib/hooks/useEditorComponents.tsx +8 -2
  283. package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +2 -2
  284. package/src/lib/hooks/useGestureEvents.ts +2 -2
  285. package/src/lib/hooks/useHandleEvents.ts +9 -4
  286. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +4 -1
  287. package/src/lib/hooks/usePassThroughWheelEvents.ts +6 -1
  288. package/src/lib/hooks/useSelectionEvents.ts +6 -5
  289. package/src/lib/hooks/useStateAttribute.ts +15 -0
  290. package/src/lib/license/LicenseManager.test.ts +724 -383
  291. package/src/lib/license/LicenseManager.ts +201 -58
  292. package/src/lib/license/LicenseProvider.tsx +74 -2
  293. package/src/lib/license/Watermark.test.tsx +2 -1
  294. package/src/lib/license/Watermark.tsx +81 -14
  295. package/src/lib/license/useLicenseManagerState.ts +2 -2
  296. package/src/lib/options.ts +8 -0
  297. package/src/lib/primitives/Box.test.ts +126 -0
  298. package/src/lib/primitives/Box.ts +10 -1
  299. package/src/lib/primitives/Vec.ts +0 -5
  300. package/src/lib/primitives/geometry/Arc2d.ts +2 -2
  301. package/src/lib/primitives/geometry/Circle2d.ts +2 -2
  302. package/src/lib/primitives/geometry/CubicBezier2d.ts +4 -1
  303. package/src/lib/primitives/geometry/Ellipse2d.ts +2 -2
  304. package/src/lib/primitives/geometry/Geometry2d.test.ts +420 -0
  305. package/src/lib/primitives/geometry/Geometry2d.ts +78 -21
  306. package/src/lib/primitives/geometry/Group2d.ts +10 -1
  307. package/src/lib/primitives/geometry/geometry-constants.ts +2 -1
  308. package/src/lib/primitives/intersect.test.ts +946 -0
  309. package/src/lib/primitives/intersect.ts +12 -5
  310. package/src/lib/primitives/utils.ts +11 -0
  311. package/src/lib/test/InFrontOfTheCanvas.test.tsx +187 -0
  312. package/src/lib/utils/EditorAtom.ts +37 -0
  313. package/src/lib/utils/dom.test.ts +94 -0
  314. package/src/lib/utils/dom.ts +38 -1
  315. package/src/lib/utils/getPointerInfo.ts +2 -1
  316. package/src/lib/utils/reparenting.ts +3 -69
  317. package/src/lib/utils/sync/LocalIndexedDb.test.ts +2 -1
  318. package/src/lib/utils/sync/TLLocalSyncClient.test.ts +15 -15
  319. package/src/lib/utils/sync/TLLocalSyncClient.ts +0 -1
  320. package/src/version.ts +3 -3
  321. package/dist-cjs/lib/utils/nearestMultiple.js.map +0 -7
  322. package/dist-esm/lib/utils/nearestMultiple.mjs +0 -14
  323. package/dist-esm/lib/utils/nearestMultiple.mjs.map +0 -7
  324. package/src/lib/test/currentToolIdMask.test.ts +0 -49
  325. package/src/lib/utils/nearestMultiple.ts +0 -13
@@ -4,9 +4,10 @@ import { ComponentType } from 'react';
4
4
  import { Computed } from '@tldraw/state';
5
5
  import { Dispatch } from 'react';
6
6
  import { Editor as Editor_2 } from '@tiptap/core';
7
- import { EditorProviderProps } from '@tiptap/react';
7
+ import { EditorProviderProps as EditorProviderProps_2 } from '@tiptap/react';
8
8
  import EventEmitter from 'eventemitter3';
9
9
  import { ExoticComponent } from 'react';
10
+ import { ForwardRefExoticComponent } from 'react';
10
11
  import { HistoryEntry } from '@tldraw/store';
11
12
  import { IndexKey } from '@tldraw/utils';
12
13
  import { JsonObject } from '@tldraw/utils';
@@ -23,6 +24,7 @@ import { ReactElement } from 'react';
23
24
  import { ReactNode } from 'react';
24
25
  import { RecordProps } from '@tldraw/tlschema';
25
26
  import { RecordsDiff } from '@tldraw/store';
27
+ import { RefAttributes } from 'react';
26
28
  import { RefObject } from 'react';
27
29
  import { SerializedSchema } from '@tldraw/store';
28
30
  import { SerializedStore } from '@tldraw/store';
@@ -145,7 +147,7 @@ export declare abstract class BaseBoxShapeTool extends StateNode {
145
147
  static id: string;
146
148
  static initial: string;
147
149
  static children(): TLStateNodeConstructor[];
148
- abstract shapeType: string;
150
+ abstract shapeType: TLBaseBoxShape['type'];
149
151
  onCreate?(_shape: null | TLShape): null | void;
150
152
  }
151
153
 
@@ -508,6 +510,7 @@ export declare class Box {
508
510
  static ExpandBy(A: Box, n: number): Box;
509
511
  static Collides(A: Box, B: Box): boolean;
510
512
  static Contains(A: Box, B: Box): boolean;
513
+ static ContainsApproximately(A: Box, B: Box, precision?: number): boolean;
511
514
  static Includes(A: Box, B: Box): boolean;
512
515
  static ContainsPoint(A: Box, B: VecLike, margin?: number): boolean;
513
516
  static Common(boxes: Box[]): Box;
@@ -725,10 +728,12 @@ export declare class CubicBezier2d extends Polyline2d {
725
728
  private _b;
726
729
  private _c;
727
730
  private _d;
731
+ private _resolution;
728
732
  constructor(config: Omit<Geometry2dOptions, 'isClosed' | 'isFilled'> & {
729
733
  cp1: Vec;
730
734
  cp2: Vec;
731
735
  end: Vec;
736
+ resolution?: number;
732
737
  start: Vec;
733
738
  });
734
739
  getVertices(): Vec[];
@@ -756,11 +761,6 @@ export declare class CubicSpline2d extends Geometry2d {
756
761
  /** @public */
757
762
  export declare function dataUrlToFile(url: string, filename: string, mimeType: string): Promise<File>;
758
763
 
759
- /**
760
- * @deprecated Licensing is now enabled in the tldraw SDK.
761
- * @public */
762
- export declare function debugEnableLicensing(): void;
763
-
764
764
  /* Excluded from this release type: DebugFlag */
765
765
 
766
766
  /* Excluded from this release type: DebugFlagDef */
@@ -815,11 +815,14 @@ export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicato
815
815
  /** @public @react */
816
816
  export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicatorsProps>;
817
817
 
818
+ /** @public @react */
819
+ export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
820
+
818
821
  /** @public @react */
819
822
  export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX_2.Element;
820
823
 
821
824
  /** @public @react */
822
- export declare function DefaultSpinner(): JSX_2.Element;
825
+ export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX_2.Element;
823
826
 
824
827
  /** @public @react */
825
828
  export declare const DefaultSvgDefs: () => null;
@@ -882,11 +885,15 @@ export declare const defaultTldrawOptions: {
882
885
  readonly nonce: undefined;
883
886
  readonly temporaryAssetPreviewLifetimeMs: 180000;
884
887
  readonly textShadowLod: 0.35;
888
+ readonly tooltipDelayMs: 700;
889
+ readonly uiCoarseDragDistanceSquared: 625;
890
+ readonly uiDragDistanceSquared: 16;
885
891
  };
886
892
 
887
893
  /** @public */
888
894
  export declare const defaultUserPreferences: Readonly<{
889
895
  animationSpeed: 0 | 1;
896
+ areKeyboardShortcutsEnabled: true;
890
897
  color: "#02B1CC" | "#11B3A3" | "#39B178" | "#55B467" | "#7B66DC" | "#9D5BD2" | "#BD54C6" | "#E34BA9" | "#EC5E41" | "#F04F88" | "#F2555A" | "#FF802B";
891
898
  colorScheme: "light";
892
899
  edgeScrollSpeed: 1;
@@ -896,6 +903,7 @@ export declare const defaultUserPreferences: Readonly<{
896
903
  isWrapMode: false;
897
904
  locale: "ar" | "bn" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "fa" | "fi" | "fr" | "gl" | "gu-in" | "he" | "hi-in" | "hr" | "hu" | "id" | "it" | "ja" | "km-kh" | "kn" | "ko-kr" | "ml" | "mr" | "ms" | "ne" | "nl" | "no" | "pa" | "pl" | "pt-br" | "pt-pt" | "ro" | "ru" | "sl" | "so" | "sv" | "ta" | "te" | "th" | "tl" | "tr" | "uk" | "ur" | "vi" | "zh-cn" | "zh-tw";
898
905
  name: "";
906
+ showUiLabels: false;
899
907
  }>;
900
908
 
901
909
  /**
@@ -971,7 +979,7 @@ export declare class EdgeScrollManager {
971
979
  /** @public */
972
980
  export declare class Editor extends EventEmitter<TLEventMap> {
973
981
  readonly id: string;
974
- 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);
975
983
  private readonly _getShapeVisibility?;
976
984
  private getIsShapeHiddenCache;
977
985
  isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
@@ -1038,22 +1046,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1038
1046
  * @public
1039
1047
  */
1040
1048
  readonly fonts: FontManager;
1041
- /**
1042
- * A manager for the editor's environment.
1043
- *
1044
- * @deprecated This is deprecated and will be removed in a future version. Use the `tlenv` global export instead.
1045
- * @public
1046
- */
1047
- readonly environment: {
1048
- hasCanvasSupport: boolean;
1049
- isAndroid: boolean;
1050
- isChromeForIos: boolean;
1051
- isDarwin: boolean;
1052
- isFirefox: boolean;
1053
- isIos: boolean;
1054
- isSafari: boolean;
1055
- isWebview: boolean;
1056
- };
1057
1049
  /**
1058
1050
  * A manager for the editor's scribbles.
1059
1051
  *
@@ -1096,7 +1088,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1096
1088
  * @public
1097
1089
  */
1098
1090
  shapeUtils: {
1099
- readonly [K in string]?: ShapeUtil<TLUnknownShape>;
1091
+ readonly [K in string]?: ShapeUtil<TLShape>;
1100
1092
  };
1101
1093
  styleProps: {
1102
1094
  [key: string]: Map<StyleProp<any>, string>;
@@ -1116,16 +1108,16 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1116
1108
  *
1117
1109
  * @public
1118
1110
  */
1119
- getShapeUtil<S extends TLUnknownShape>(shape: S | TLShapePartial<S>): ShapeUtil<S>;
1120
- getShapeUtil<S extends TLUnknownShape>(type: S['type']): ShapeUtil<S>;
1111
+ getShapeUtil<S extends TLShape>(shape: S | TLShapePartial<S>): ShapeUtil<S>;
1112
+ getShapeUtil<S extends TLShape>(type: S['type']): ShapeUtil<S>;
1121
1113
  getShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): T;
1122
1114
  /**
1123
1115
  * Returns true if the editor has a shape util for the given shape / shape type.
1124
1116
  *
1125
1117
  * @param shape - A shape, shape partial, or shape type.
1126
1118
  */
1127
- hasShapeUtil<S extends TLUnknownShape>(shape: S | TLShapePartial<S>): boolean;
1128
- hasShapeUtil<S extends TLUnknownShape>(type: S['type']): boolean;
1119
+ hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
1120
+ hasShapeUtil(type: TLShape['type']): boolean;
1129
1121
  hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
1130
1122
  /**
1131
1123
  * A map of shape utility classes (TLShapeUtils) by shape type.
@@ -1196,22 +1188,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1196
1188
  * @public
1197
1189
  */
1198
1190
  getCanRedo(): boolean;
1199
- /**
1200
- * Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
1201
- * any redos.
1202
- *
1203
- * @example
1204
- * ```ts
1205
- * editor.mark()
1206
- * editor.mark('flip shapes')
1207
- * ```
1208
- *
1209
- * @param markId - The mark's id, usually the reason for adding the mark.
1210
- *
1211
- * @public
1212
- * @deprecated use {@link Editor.markHistoryStoppingPoint} instead
1213
- */
1214
- mark(markId?: string): this;
1215
1191
  /**
1216
1192
  * Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
1217
1193
  * any redos. You typically want to do this just before a user interaction begins or is handled.
@@ -1301,10 +1277,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1301
1277
  * @public
1302
1278
  */
1303
1279
  run(fn: () => void, opts?: TLEditorRunOptions): this;
1304
- /**
1305
- * @deprecated Use `Editor.run` instead.
1306
- */
1307
- batch(fn: () => void, opts?: TLEditorRunOptions): this;
1308
1280
  /* Excluded from this release type: annotateError */
1309
1281
  /* Excluded from this release type: createErrorAnnotations */
1310
1282
  /* Excluded from this release type: _crashingError */
@@ -1426,36 +1398,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1426
1398
  hasOpenMenus: () => boolean;
1427
1399
  isMenuOpen: (id: string) => boolean;
1428
1400
  };
1429
- /**
1430
- * @deprecated Use `editor.menus.getOpenMenus` instead.
1431
- *
1432
- * @public
1433
- */
1434
- getOpenMenus(): string[];
1435
- /**
1436
- * @deprecated Use `editor.menus.addOpenMenu` instead.
1437
- *
1438
- * @public
1439
- */
1440
- addOpenMenu(id: string): this;
1441
- /**
1442
- * @deprecated Use `editor.menus.deleteOpenMenu` instead.
1443
- *
1444
- * @public
1445
- */
1446
- deleteOpenMenu(id: string): this;
1447
- /**
1448
- * @deprecated Use `editor.menus.clearOpenMenus` instead.
1449
- *
1450
- * @public
1451
- */
1452
- clearOpenMenus(): this;
1453
- /**
1454
- * @deprecated Use `editor.menus.hasAnyOpenMenus` instead.
1455
- *
1456
- * @public
1457
- */
1458
- getIsMenuOpen(): boolean;
1459
1401
  /**
1460
1402
  * Set the cursor.
1461
1403
  *
@@ -1552,7 +1494,9 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1552
1494
  */
1553
1495
  deselect(...shapes: TLShape[] | TLShapeId[]): this;
1554
1496
  /**
1555
- * Select all direct children of the current page.
1497
+ * Select all shapes. If the user has selected shapes that share a parent,
1498
+ * select all shapes within that parent. If the user has not selected any shapes,
1499
+ * or if the shapes shapes are only on select all shapes on the current page.
1556
1500
  *
1557
1501
  * @example
1558
1502
  * ```ts
@@ -1586,7 +1530,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1586
1530
  *
1587
1531
  * @public
1588
1532
  */
1589
- getNearestAdjacentShape(currentShapeId: TLShapeId, direction: 'down' | 'left' | 'right' | 'up'): TLShapeId;
1533
+ getNearestAdjacentShape(shapes: TLShape[], currentShapeId: TLShapeId, direction: 'down' | 'left' | 'right' | 'up'): TLShapeId;
1590
1534
  selectParentShape(): void;
1591
1535
  selectFirstChildShape(): void;
1592
1536
  private _selectShapesAndZoom;
@@ -2680,15 +2624,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2680
2624
  *
2681
2625
  * @returns The shape at the given point, or undefined if there is no shape at the point.
2682
2626
  */
2683
- getShapeAtPoint(point: VecLike, opts?: {
2684
- filter?(shape: TLShape): boolean;
2685
- hitFrameInside?: boolean;
2686
- hitInside?: boolean;
2687
- hitLabels?: boolean;
2688
- hitLocked?: boolean;
2689
- margin?: number;
2690
- renderingOnly?: boolean;
2691
- }): TLShape | undefined;
2627
+ getShapeAtPoint(point: VecLike, opts?: TLGetShapeAtPointOptions): TLShape | undefined;
2692
2628
  /**
2693
2629
  * Get the shapes, if any, at a given page point.
2694
2630
  *
@@ -2791,8 +2727,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2791
2727
  *
2792
2728
  * @public
2793
2729
  */
2794
- isShapeOfType<T extends TLUnknownShape>(shape: TLUnknownShape, type: T['type']): shape is T;
2795
- isShapeOfType<T extends TLUnknownShape>(shapeId: TLUnknownShape['id'], type: T['type']): shapeId is T['id'];
2730
+ isShapeOfType<T extends TLShape>(shape: TLShape, type: T['type']): shape is T;
2731
+ isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
2796
2732
  /**
2797
2733
  * Get a shape by its id.
2798
2734
  *
@@ -2910,8 +2846,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2910
2846
  * @public
2911
2847
  */
2912
2848
  getShapeAndDescendantIds(ids: TLShapeId[]): Set<TLShapeId>;
2913
- /** @deprecated Use {@link Editor.getDraggingOverShape} instead */
2914
- getDroppingOverShape(point: Vec, droppingShapes: TLShape[]): TLShape | undefined;
2915
2849
  /**
2916
2850
  * Get the shape that some shapes should be dropped on at a given point.
2917
2851
  *
@@ -3270,7 +3204,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3270
3204
  *
3271
3205
  * @public
3272
3206
  */
3273
- canCreateShape<T extends TLUnknownShape>(shape: OptionalKeys<TLShapePartial<T>, 'id'> | T['id']): boolean;
3207
+ canCreateShape(shape: OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id']): boolean;
3274
3208
  /**
3275
3209
  * Get whether the provided shapes can be created.
3276
3210
  *
@@ -3278,7 +3212,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3278
3212
  *
3279
3213
  * @public
3280
3214
  */
3281
- canCreateShapes<T extends TLUnknownShape>(shapes: (OptionalKeys<TLShapePartial<T>, 'id'> | T['id'])[]): boolean;
3215
+ canCreateShapes(shapes: (OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id'])[]): boolean;
3282
3216
  /**
3283
3217
  * Create a single shape.
3284
3218
  *
@@ -3292,7 +3226,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3292
3226
  *
3293
3227
  * @public
3294
3228
  */
3295
- createShape<T extends TLUnknownShape>(shape: OptionalKeys<TLShapePartial<T>, 'id'>): this;
3229
+ createShape<TShape extends TLShape>(shape: OptionalKeys<TLShapePartial<TShape>, 'id'>): this;
3296
3230
  /**
3297
3231
  * Create shapes.
3298
3232
  *
@@ -3306,7 +3240,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3306
3240
  *
3307
3241
  * @public
3308
3242
  */
3309
- createShapes<T extends TLUnknownShape>(shapes: OptionalKeys<TLShapePartial<T>, 'id'>[]): this;
3243
+ createShapes<TShape extends TLShape = TLShape>(shapes: OptionalKeys<TLShapePartial<TShape>, 'id'>[]): this;
3310
3244
  private animatingShapes;
3311
3245
  /**
3312
3246
  * Animate a shape.
@@ -3392,7 +3326,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3392
3326
  *
3393
3327
  * @public
3394
3328
  */
3395
- updateShape<T extends TLUnknownShape>(partial: null | TLShapePartial<T> | undefined): this;
3329
+ updateShape<T extends TLShape = TLShape>(partial: null | TLShapePartial<T> | undefined): this;
3396
3330
  /**
3397
3331
  * Update shapes using partials of each shape.
3398
3332
  *
@@ -3405,7 +3339,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3405
3339
  *
3406
3340
  * @public
3407
3341
  */
3408
- updateShapes<T extends TLUnknownShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
3342
+ updateShapes<T extends TLShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
3409
3343
  /* Excluded from this release type: _updateShapes */
3410
3344
  /* Excluded from this release type: _getUnlockedShapeIds */
3411
3345
  /**
@@ -3623,14 +3557,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3623
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.
3624
3558
  *
3625
3559
  * @param info - Info about the external content.
3560
+ * @param opts - Options for handling external content, including force flag to bypass readonly checks.
3626
3561
  */
3627
- putExternalContent<E>(info: TLExternalContent<E>): Promise<void>;
3562
+ putExternalContent<E>(info: TLExternalContent<E>, opts?: {
3563
+ force?: boolean;
3564
+ }): Promise<void>;
3628
3565
  /**
3629
3566
  * Handle replacing external content.
3630
3567
  *
3631
3568
  * @param info - Info about the external content.
3569
+ * @param opts - Options for handling external content, including force flag to bypass readonly checks.
3632
3570
  */
3633
- replaceExternalContent<E>(info: TLExternalContent<E>): Promise<void>;
3571
+ replaceExternalContent<E>(info: TLExternalContent<E>, opts?: {
3572
+ force?: boolean;
3573
+ }): Promise<void>;
3634
3574
  /**
3635
3575
  * Get content that can be exported for the given shape ids.
3636
3576
  *
@@ -3686,8 +3626,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3686
3626
  svg: string;
3687
3627
  width: number;
3688
3628
  } | undefined>;
3689
- /** @deprecated Use {@link Editor.getSvgString} or {@link Editor.getSvgElement} instead. */
3690
- getSvg(shapes: TLShape[] | TLShapeId[], opts?: TLSvgExportOptions): Promise<SVGSVGElement | undefined>;
3691
3629
  /**
3692
3630
  * Get an exported image of the given shapes.
3693
3631
  *
@@ -3702,6 +3640,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3702
3640
  height: number;
3703
3641
  width: number;
3704
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
+ }>;
3705
3657
  /**
3706
3658
  * The app's current input state.
3707
3659
  *
@@ -3788,6 +3740,21 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3788
3740
  * @public
3789
3741
  */
3790
3742
  complete(): this;
3743
+ /**
3744
+ * Dispatch a pointer move event in the current position of the pointer. This is useful when
3745
+ * external circumstances have changed (e.g. the camera moved or a shape was moved) and you want
3746
+ * the current interaction to respond to that change.
3747
+ *
3748
+ * @example
3749
+ * ```ts
3750
+ * editor.updatePointer()
3751
+ * ```
3752
+ *
3753
+ * @param options - The options for updating the pointer.
3754
+ * @returns The editor instance.
3755
+ * @public
3756
+ */
3757
+ updatePointer(options?: TLUpdatePointerOptions): this;
3791
3758
  /**
3792
3759
  * Puts the editor into focused mode.
3793
3760
  *
@@ -4011,9 +3978,38 @@ export declare class Editor extends EventEmitter<TLEventMap> {
4011
3978
  /* Excluded from this release type: maybeTrackPerformance */
4012
3979
  }
4013
3980
 
3981
+ /**
3982
+ * An Atom that is scoped to the lifetime of an Editor.
3983
+ *
3984
+ * This is useful for storing UI state for tldraw applications. Keeping state scoped to an editor
3985
+ * instead of stored in a global atom can prevent issues with state being shared between editors
3986
+ * when navigating between pages, or when multiple editor instances are used on the same page.
3987
+ *
3988
+ * @public
3989
+ */
3990
+ export declare class EditorAtom<T> {
3991
+ private name;
3992
+ private getInitialState;
3993
+ private states;
3994
+ constructor(name: string, getInitialState: (editor: Editor) => T);
3995
+ getAtom(editor: Editor): Atom<T>;
3996
+ get(editor: Editor): T;
3997
+ update(editor: Editor, update: (state: T) => T): T;
3998
+ set(editor: Editor, state: T): T;
3999
+ }
4000
+
4014
4001
  /** @public */
4015
4002
  export declare const EditorContext: React_3.Context<Editor | null>;
4016
4003
 
4004
+ /** @public @react */
4005
+ export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX_2.Element;
4006
+
4007
+ /** @public */
4008
+ export declare interface EditorProviderProps {
4009
+ editor: Editor;
4010
+ children: React_3.ReactNode;
4011
+ }
4012
+
4017
4013
  /** @public */
4018
4014
  export declare class Ellipse2d extends Geometry2d {
4019
4015
  config: Omit<Geometry2dOptions, 'isClosed'> & {
@@ -4099,6 +4095,7 @@ export declare abstract class Geometry2d {
4099
4095
  isLabel: boolean;
4100
4096
  isEmptyLabel: boolean;
4101
4097
  isInternal: boolean;
4098
+ excludeFromShapeBounds: boolean;
4102
4099
  debugColor?: string;
4103
4100
  ignore?: boolean;
4104
4101
  constructor(opts: Geometry2dOptions);
@@ -4122,12 +4119,14 @@ export declare abstract class Geometry2d {
4122
4119
  * along the edge it is as a fraction of the total length.
4123
4120
  */
4124
4121
  uninterpolateAlongEdge(point: VecLike, _filters?: Geometry2dFilters): number;
4125
- /** @deprecated Iterate the vertices instead. */
4126
- nearestPointOnLineSegment(A: VecLike, B: VecLike): Vec;
4127
4122
  isPointInBounds(point: VecLike, margin?: number): boolean;
4123
+ overlapsPolygon(_polygon: VecLike[]): boolean;
4128
4124
  transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
4129
4125
  private _vertices;
4130
4126
  get vertices(): Vec[];
4127
+ getBoundsVertices(): Vec[];
4128
+ private _boundsVertices;
4129
+ get boundsVertices(): Vec[];
4131
4130
  getBounds(): Box;
4132
4131
  private _bounds;
4133
4132
  get bounds(): Box;
@@ -4308,6 +4307,8 @@ export declare function getSvgPathFromPoints(points: VecLike[], closed?: boolean
4308
4307
  /** @public */
4309
4308
  export declare function getUserPreferences(): TLUserPreferences;
4310
4309
 
4310
+ /* Excluded from this release type: getVerticesCountForArcLength */
4311
+
4311
4312
  /** @public */
4312
4313
  export declare class Group2d extends Geometry2d {
4313
4314
  children: Geometry2d[];
@@ -4322,6 +4323,7 @@ export declare class Group2d extends Geometry2d {
4322
4323
  hitTestLineSegment(A: VecLike, B: VecLike, zoom: number, filters?: Geometry2dFilters): boolean;
4323
4324
  intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): VecLike[];
4324
4325
  intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): VecLike[];
4326
+ getBoundsVertices(): Vec[];
4325
4327
  intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
4326
4328
  intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
4327
4329
  interpolateAlongEdge(t: number, filters?: Geometry2dFilters): Vec;
@@ -4331,6 +4333,7 @@ export declare class Group2d extends Geometry2d {
4331
4333
  toSimpleSvgPath(): string;
4332
4334
  getLength(filters?: Geometry2dFilters): number;
4333
4335
  getSvgPathData(): string;
4336
+ overlapsPolygon(polygon: VecLike[]): boolean;
4334
4337
  }
4335
4338
 
4336
4339
  /** @public */
@@ -4507,7 +4510,7 @@ export declare function intersectLineSegmentCircle(a1: VecLike, a2: VecLike, c:
4507
4510
  * @param b2 - The second segment's second point.
4508
4511
  * @public
4509
4512
  */
4510
- export declare function intersectLineSegmentLineSegment(a1: VecLike, a2: VecLike, b1: VecLike, b2: VecLike): null | Vec;
4513
+ export declare function intersectLineSegmentLineSegment(a1: VecLike, a2: VecLike, b1: VecLike, b2: VecLike, precision?: number): null | Vec;
4511
4514
 
4512
4515
  /**
4513
4516
  * Find the intersections between a line segment and a closed polygon.
@@ -4571,12 +4574,16 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
4571
4574
  filter?(parent: TLShape): boolean;
4572
4575
  }): void;
4573
4576
 
4577
+ /* Excluded from this release type: LICENSE_TIMEOUT */
4578
+
4574
4579
  /* Excluded from this release type: LicenseFromKeyResult */
4575
4580
 
4576
4581
  /* Excluded from this release type: LicenseInfo */
4577
4582
 
4578
4583
  /* Excluded from this release type: LicenseManager */
4579
4584
 
4585
+ /* Excluded from this release type: LicenseState */
4586
+
4580
4587
  /** @public */
4581
4588
  export declare function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
4582
4589
 
@@ -4609,6 +4616,23 @@ export declare function loadSnapshot(store: TLStore, _snapshot: Partial<TLEditor
4609
4616
  /** @public */
4610
4617
  export declare function loopToHtmlElement(elm: Element): HTMLElement;
4611
4618
 
4619
+ /**
4620
+ * In tldraw, events are sometimes handled by multiple components. For example, the shapes might
4621
+ * have events, but the canvas handles events too. The way that the canvas handles events can
4622
+ * interfere with the with the shapes event handlers - for example, it calls `.preventDefault()` on
4623
+ * `pointerDown`, which also prevents `click` events from firing on the shapes.
4624
+ *
4625
+ * You can use `.stopPropagation()` to prevent the event from propagating to the rest of the DOM,
4626
+ * but that can impact non-tldraw event handlers set up elsewhere. By using `markEventAsHandled`,
4627
+ * you'll stop other parts of tldraw from handling the event without impacting other, non-tldraw
4628
+ * event handlers. See also {@link wasEventAlreadyHandled}.
4629
+ *
4630
+ * @public
4631
+ */
4632
+ export declare function markEventAsHandled(e: {
4633
+ nativeEvent: Event;
4634
+ } | Event): void;
4635
+
4612
4636
  /** @public */
4613
4637
  export declare class Mat {
4614
4638
  constructor(a: number, b: number, c: number, d: number, e: number, f: number);
@@ -5027,7 +5051,7 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
5027
5051
  export declare function setUserPreferences(user: TLUserPreferences): void;
5028
5052
 
5029
5053
  /** @public */
5030
- export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknownShape> {
5054
+ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
5031
5055
  editor: Editor;
5032
5056
  /** Configure this shape utils {@link ShapeUtil.options | `options`}. */
5033
5057
  static configure<T extends TLShapeUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
@@ -5182,7 +5206,34 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5182
5206
  * @public
5183
5207
  */
5184
5208
  canBeLaidOut(_shape: Shape, _info: TLShapeUtilCanBeLaidOutOpts): boolean;
5209
+ /**
5210
+ * Whether this shape can be culled. By default, shapes are culled for
5211
+ * performance reasons when they are outside of the viewport. Culled shapes are still rendered
5212
+ * to the DOM, but have their `display` property set to `none`.
5213
+ *
5214
+ * @param shape - The shape.
5215
+ */
5216
+ canCull(_shape: Shape): boolean;
5185
5217
  /* Excluded from this release type: providesBackgroundForChildren */
5218
+ /**
5219
+ * Get the clip path to apply to this shape's children.
5220
+ *
5221
+ * @param shape - The shape to get the clip path for
5222
+ * @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
5223
+ * @public
5224
+ */
5225
+ getClipPath?(shape: Shape): undefined | Vec[];
5226
+ /**
5227
+ * Whether a specific child shape should be clipped by this shape.
5228
+ * Only called if getClipPath returns a valid polygon.
5229
+ *
5230
+ * If not defined, the default behavior is to clip all children.
5231
+ *
5232
+ * @param child - The child shape to check
5233
+ * @returns boolean indicating if this child should be clipped
5234
+ * @public
5235
+ */
5236
+ shouldClipChild?(child: TLShape): boolean;
5186
5237
  /**
5187
5238
  * Whether the shape should hide its resize handles when selected.
5188
5239
  *
@@ -5213,6 +5264,17 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5213
5264
  * @public
5214
5265
  */
5215
5266
  isAspectRatioLocked(_shape: Shape): boolean;
5267
+ /**
5268
+ * By default, the bounds of an image export are the bounds of all the shapes it contains, plus
5269
+ * some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
5270
+ * padding is skipped _if the bounds of that shape contains all the other shapes_. This is
5271
+ * useful in cases like annotating on top of an image, where you usually want to avoid extra
5272
+ * padding around the image if you don't need it.
5273
+ *
5274
+ * @param _shape - The shape to check
5275
+ * @returns True if this shape should be treated as an export bounds container
5276
+ */
5277
+ isExportBoundsContainer(_shape: Shape): boolean;
5216
5278
  /* Excluded from this release type: backgroundComponent */
5217
5279
  /**
5218
5280
  * Get the interpolated props for an animating shape. This is an optional method.
@@ -5402,6 +5464,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5402
5464
  * @public
5403
5465
  */
5404
5466
  onResizeEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
5467
+ /**
5468
+ * A callback called when a shape resize is cancelled.
5469
+ *
5470
+ * @param initial - The shape at the start of the resize.
5471
+ * @param current - The current shape.
5472
+ * @public
5473
+ */
5474
+ onResizeCancel?(initial: Shape, current: Shape): void;
5405
5475
  /**
5406
5476
  * A callback called when a shape starts being translated.
5407
5477
  *
@@ -5428,6 +5498,23 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5428
5498
  * @public
5429
5499
  */
5430
5500
  onTranslateEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
5501
+ /**
5502
+ * A callback called when a shape translation is cancelled.
5503
+ *
5504
+ * @param initial - The shape at the start of the translation.
5505
+ * @param current - The current shape.
5506
+ * @public
5507
+ */
5508
+ onTranslateCancel?(initial: Shape, current: Shape): void;
5509
+ /**
5510
+ * A callback called when a shape's handle starts being dragged.
5511
+ *
5512
+ * @param shape - The shape.
5513
+ * @param info - An object containing the handle and whether the handle is 'precise' or not.
5514
+ * @returns A change to apply to the shape, or void.
5515
+ * @public
5516
+ */
5517
+ onHandleDragStart?(shape: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
5431
5518
  /**
5432
5519
  * A callback called when a shape's handle changes.
5433
5520
  *
@@ -5437,6 +5524,23 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5437
5524
  * @public
5438
5525
  */
5439
5526
  onHandleDrag?(shape: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
5527
+ /**
5528
+ * A callback called when a shape's handle finishes being dragged.
5529
+ *
5530
+ * @param current - The current shape.
5531
+ * @param info - An object containing the handle and whether the handle is 'precise' or not.
5532
+ * @returns A change to apply to the shape, or void.
5533
+ * @public
5534
+ */
5535
+ onHandleDragEnd?(current: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
5536
+ /**
5537
+ * A callback called when a shape's handle drag is cancelled.
5538
+ *
5539
+ * @param current - The current shape.
5540
+ * @param info - An object containing the handle and whether the handle is 'precise' or not.
5541
+ * @public
5542
+ */
5543
+ onHandleDragCancel?(current: Shape, info: TLHandleDragInfo<Shape>): void;
5440
5544
  /**
5441
5545
  * A callback called when a shape starts being rotated.
5442
5546
  *
@@ -5463,6 +5567,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
5463
5567
  * @public
5464
5568
  */
5465
5569
  onRotateEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
5570
+ /**
5571
+ * A callback called when a shape rotation is cancelled.
5572
+ *
5573
+ * @param initial - The shape at the start of the rotation.
5574
+ * @param current - The current shape.
5575
+ * @public
5576
+ */
5577
+ onRotateCancel?(initial: Shape, current: Shape): void;
5466
5578
  /* Excluded from this release type: onBindingChange */
5467
5579
  /**
5468
5580
  * A callback called when a shape's children change.
@@ -5691,6 +5803,12 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
5691
5803
  _currentToolIdMask: Atom<string | undefined, unknown>;
5692
5804
  getCurrentToolIdMask(): string | undefined;
5693
5805
  setCurrentToolIdMask(id: string | undefined): void;
5806
+ /**
5807
+ * Add a child node to this state node.
5808
+ *
5809
+ * @public
5810
+ */
5811
+ addChild(childConstructor: TLStateNodeConstructor): this;
5694
5812
  onWheel?(info: TLWheelEventInfo): void;
5695
5813
  onPointerDown?(info: TLPointerEventInfo): void;
5696
5814
  onPointerMove?(info: TLPointerEventInfo): void;
@@ -5712,7 +5830,14 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
5712
5830
  onExit?(info: any, to: string): void;
5713
5831
  }
5714
5832
 
5715
- /** @public */
5833
+ /**
5834
+ * Calls `event.stopPropagation()`.
5835
+ *
5836
+ * @deprecated Use {@link markEventAsHandled} instead, or manually call `event.stopPropagation()` if
5837
+ * that's what you really want.
5838
+ *
5839
+ * @public
5840
+ */
5716
5841
  export declare const stopEventPropagation: (e: any) => any;
5717
5842
 
5718
5843
  /* Excluded from this release type: StoreName */
@@ -5844,9 +5969,11 @@ export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
5844
5969
  export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
5845
5970
 
5846
5971
  /** @public */
5847
- export declare type TLBaseBoxShape = TLBaseShape<string, {
5848
- h: number;
5849
- w: number;
5972
+ export declare type TLBaseBoxShape = Extract<TLShape, {
5973
+ props: {
5974
+ h: number;
5975
+ w: number;
5976
+ };
5850
5977
  }>;
5851
5978
 
5852
5979
  /** @public */
@@ -6203,12 +6330,6 @@ export declare interface TldrawEditorBaseProps {
6203
6330
  * Options for syncing the editor's camera state with the URL.
6204
6331
  */
6205
6332
  deepLinks?: TLDeepLinkOptions | true;
6206
- /**
6207
- * Predicate for whether or not a shape should be hidden.
6208
- *
6209
- * @deprecated Use {@link TldrawEditorBaseProps#getShapeVisibility} instead.
6210
- */
6211
- isShapeHidden?(shape: TLShape, editor: Editor): boolean;
6212
6333
  /**
6213
6334
  * Provides a way to hide shapes.
6214
6335
  *
@@ -6316,6 +6437,8 @@ export declare interface TldrawOptions {
6316
6437
  readonly multiClickDurationMs: number;
6317
6438
  readonly coarseDragDistanceSquared: number;
6318
6439
  readonly dragDistanceSquared: number;
6440
+ readonly uiDragDistanceSquared: number;
6441
+ readonly uiCoarseDragDistanceSquared: number;
6319
6442
  readonly defaultSvgPadding: number;
6320
6443
  readonly cameraSlideFriction: number;
6321
6444
  readonly gridSteps: readonly {
@@ -6342,6 +6465,7 @@ export declare interface TldrawOptions {
6342
6465
  readonly flattenImageBoundsPadding: number;
6343
6466
  readonly laserDelayMs: number;
6344
6467
  readonly maxExportDelayMs: number;
6468
+ readonly tooltipDelayMs: number;
6345
6469
  /**
6346
6470
  * How long should previews created by {@link Editor.createTemporaryAssetPreview} last before
6347
6471
  * they expire? Defaults to 3 minutes.
@@ -6407,8 +6531,9 @@ export declare interface TLEditorComponents {
6407
6531
  SelectionForeground?: ComponentType<TLSelectionForegroundProps> | null;
6408
6532
  ShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
6409
6533
  ShapeIndicators?: ComponentType | null;
6534
+ ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
6410
6535
  SnapIndicator?: ComponentType<TLSnapIndicatorProps> | null;
6411
- Spinner?: ComponentType | null;
6536
+ Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
6412
6537
  SvgDefs?: ComponentType | null;
6413
6538
  ZoomBrush?: ComponentType<TLBrushProps> | null;
6414
6539
  ErrorFallback?: TLErrorFallbackComponent;
@@ -6466,15 +6591,6 @@ export declare interface TLEditorOptions {
6466
6591
  fontAssetUrls?: {
6467
6592
  [key: string]: string | undefined;
6468
6593
  };
6469
- /**
6470
- * A predicate that should return true if the given shape should be hidden.
6471
- *
6472
- * @deprecated Use {@link Editor#getShapeVisibility} instead.
6473
- *
6474
- * @param shape - The shape to check.
6475
- * @param editor - The editor instance.
6476
- */
6477
- isShapeHidden?(shape: TLShape, editor: Editor): boolean;
6478
6594
  /**
6479
6595
  * Provides a way to hide shapes.
6480
6596
  *
@@ -6742,6 +6858,59 @@ export declare interface TLGeometryOpts {
6742
6858
  context?: string;
6743
6859
  }
6744
6860
 
6861
+ /**
6862
+ * Options to {@link Editor.getShapeAtPoint}.
6863
+ *
6864
+ * @public
6865
+ */
6866
+ export declare interface TLGetShapeAtPointOptions {
6867
+ /**
6868
+ * The margin to apply to the shape.
6869
+ * If a number, it will be applied to both the inside and outside of the shape.
6870
+ * If an array, the first element will be applied to the inside of the shape, and the second element will be applied to the outside.
6871
+ *
6872
+ * @example
6873
+ * ```ts
6874
+ * // Get the shape at the center of the screen
6875
+ * const shape = editor.getShapeAtProps({
6876
+ * margin: 10,
6877
+ * })
6878
+ *
6879
+ * // Get the shape at the center of the screen with a 10px inner margin and a 5px outer margin
6880
+ * const shape = editor.getShapeAtProps({
6881
+ * margin: [10, 5],
6882
+ * })
6883
+ * ```
6884
+ */
6885
+ margin?: [number, number] | number;
6886
+ /**
6887
+ * Whether to register hits inside of shapes (beyond the margin), such as the inside of a solid shape.
6888
+ */
6889
+ hitInside?: boolean;
6890
+ /**
6891
+ * Whether to register hits on locked shapes.
6892
+ */
6893
+ hitLocked?: boolean;
6894
+ /**
6895
+ * Whether to register hits on labels.
6896
+ */
6897
+ hitLabels?: boolean;
6898
+ /**
6899
+ * Whether to only return hits on shapes that are currently being rendered.
6900
+ * todo: rename this to hitCulled or hitNotRendering
6901
+ */
6902
+ renderingOnly?: boolean;
6903
+ /**
6904
+ * Whether to register hits on the inside of frame shapes.
6905
+ * todo: rename this to hitInsideFrames
6906
+ */
6907
+ hitFrameInside?: boolean;
6908
+ /**
6909
+ * A filter function to apply to the shapes.
6910
+ */
6911
+ filter?(shape: TLShape): boolean;
6912
+ }
6913
+
6745
6914
  /** @public */
6746
6915
  export declare interface TLGridProps {
6747
6916
  x: number;
@@ -6754,6 +6923,7 @@ export declare interface TLGridProps {
6754
6923
  export declare interface TLHandleDragInfo<T extends TLShape> {
6755
6924
  handle: TLHandle;
6756
6925
  isPrecise: boolean;
6926
+ isCreatingShape: boolean;
6757
6927
  initial?: T | undefined;
6758
6928
  }
6759
6929
 
@@ -7257,11 +7427,11 @@ export declare interface TLShapeUtilCanBeLaidOutOpts {
7257
7427
  *
7258
7428
  * @public
7259
7429
  */
7260
- export declare interface TLShapeUtilCanBindOpts<Shape extends TLUnknownShape = TLUnknownShape> {
7430
+ export declare interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
7261
7431
  /** The type of shape referenced by the `fromId` of the binding. */
7262
- fromShapeType: string;
7432
+ fromShapeType: TLShape['type'];
7263
7433
  /** The type of shape referenced by the `toId` of the binding. */
7264
- toShapeType: string;
7434
+ toShapeType: TLShape['type'];
7265
7435
  /** The type of binding. */
7266
7436
  bindingType: string;
7267
7437
  }
@@ -7273,13 +7443,23 @@ export declare interface TLShapeUtilCanvasSvgDef {
7273
7443
  }
7274
7444
 
7275
7445
  /** @public */
7276
- export declare interface TLShapeUtilConstructor<T extends TLUnknownShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
7446
+ export declare interface TLShapeUtilConstructor<T extends TLShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
7277
7447
  new (editor: Editor): U;
7278
7448
  type: T['type'];
7279
7449
  props?: RecordProps<T>;
7280
7450
  migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
7281
7451
  }
7282
7452
 
7453
+ /** @public */
7454
+ export declare interface TLShapeWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
7455
+ /** The shape being rendered. */
7456
+ shape: TLShape;
7457
+ /** Whether this is the shapes regular, or background component. */
7458
+ isBackground: boolean;
7459
+ /** The shape's rendered component. */
7460
+ children: ReactNode;
7461
+ }
7462
+
7283
7463
  /** @public */
7284
7464
  export declare interface TLSnapIndicatorProps {
7285
7465
  className?: string;
@@ -7401,12 +7581,6 @@ export declare interface TLSvgExportOptions {
7401
7581
  preserveAspectRatio?: React.SVGAttributes<SVGSVGElement>['preserveAspectRatio'];
7402
7582
  }
7403
7583
 
7404
- /**
7405
- * @public
7406
- * @deprecated use {@link TLImageExportOptions} instead
7407
- */
7408
- export declare type TLSvgOptions = TLImageExportOptions;
7409
-
7410
7584
  /** @public */
7411
7585
  export declare interface TLSvgTextExternalContent extends TLBaseExternalContent {
7412
7586
  type: 'svg-text';
@@ -7429,7 +7603,7 @@ export declare interface TLTextExternalContentSource {
7429
7603
 
7430
7604
  /** @public */
7431
7605
  export declare interface TLTextOptions {
7432
- tipTapConfig?: EditorProviderProps;
7606
+ tipTapConfig?: EditorProviderProps_2;
7433
7607
  addFontsFromNode?: RichTextFontVisitor;
7434
7608
  }
7435
7609
 
@@ -7462,6 +7636,25 @@ export declare interface TLTldrawExternalContentSource {
7462
7636
  data: TLContent;
7463
7637
  }
7464
7638
 
7639
+ /** @public */
7640
+ export declare interface TLUpdatePointerOptions {
7641
+ /** Whether to update the pointer immediately, rather than on the next tick. */
7642
+ immediate?: boolean;
7643
+ /**
7644
+ * The point, in screen-space, to update the pointer to. Defaults to the position of the last
7645
+ * pointer event.
7646
+ */
7647
+ point?: VecLike;
7648
+ pointerId?: number;
7649
+ ctrlKey?: boolean;
7650
+ altKey?: boolean;
7651
+ shiftKey?: boolean;
7652
+ metaKey?: boolean;
7653
+ accelKey?: boolean;
7654
+ isPen?: boolean;
7655
+ button?: number;
7656
+ }
7657
+
7465
7658
  /** @public */
7466
7659
  export declare interface TLUrlExternalAsset {
7467
7660
  type: 'url';
@@ -7491,12 +7684,14 @@ export declare interface TLUserPreferences {
7491
7684
  color?: null | string;
7492
7685
  locale?: null | string;
7493
7686
  animationSpeed?: null | number;
7687
+ areKeyboardShortcutsEnabled?: boolean | null;
7494
7688
  edgeScrollSpeed?: null | number;
7495
7689
  colorScheme?: 'dark' | 'light' | 'system';
7496
7690
  isSnapMode?: boolean | null;
7497
7691
  isWrapMode?: boolean | null;
7498
7692
  isDynamicSizeMode?: boolean | null;
7499
7693
  isPasteAtCursorMode?: boolean | null;
7694
+ showUiLabels?: boolean | null;
7500
7695
  }
7501
7696
 
7502
7697
  /** @public */
@@ -7539,6 +7734,7 @@ export declare class TransformedGeometry2d extends Geometry2d {
7539
7734
  private readonly decomposed;
7540
7735
  constructor(geometry: Geometry2d, matrix: MatModel, opts?: TransformedGeometry2dOptions);
7541
7736
  getVertices(filters: Geometry2dFilters): Vec[];
7737
+ getBoundsVertices(): Vec[];
7542
7738
  nearestPoint(point: VecLike, filters?: Geometry2dFilters): Vec;
7543
7739
  hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean, filters?: Geometry2dFilters): boolean;
7544
7740
  distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
@@ -7559,6 +7755,7 @@ export declare interface TransformedGeometry2dOptions {
7559
7755
  isInternal?: boolean;
7560
7756
  debugColor?: string;
7561
7757
  ignore?: boolean;
7758
+ excludeFromShapeBounds?: boolean;
7562
7759
  }
7563
7760
 
7564
7761
  /** @public */
@@ -7659,6 +7856,7 @@ export declare class UserPreferencesManager {
7659
7856
  updateUserPreferences(userPreferences: Partial<TLUserPreferences>): void;
7660
7857
  getUserPreferences(): {
7661
7858
  animationSpeed: number;
7859
+ areKeyboardShortcutsEnabled: boolean;
7662
7860
  color: string;
7663
7861
  colorScheme: "dark" | "light" | "system" | undefined;
7664
7862
  id: string;
@@ -7668,6 +7866,7 @@ export declare class UserPreferencesManager {
7668
7866
  isWrapMode: boolean;
7669
7867
  locale: string;
7670
7868
  name: string;
7869
+ showUiLabels: boolean;
7671
7870
  };
7672
7871
  getIsDarkMode(): boolean;
7673
7872
  /**
@@ -7675,6 +7874,7 @@ export declare class UserPreferencesManager {
7675
7874
  */
7676
7875
  getEdgeScrollSpeed(): number;
7677
7876
  getAnimationSpeed(): number;
7877
+ getAreKeyboardShortcutsEnabled(): boolean;
7678
7878
  getId(): string;
7679
7879
  getName(): string;
7680
7880
  getLocale(): string;
@@ -7683,6 +7883,7 @@ export declare class UserPreferencesManager {
7683
7883
  getIsWrapMode(): boolean;
7684
7884
  getIsDynamicResizeMode(): boolean;
7685
7885
  getIsPasteAtCursorMode(): boolean;
7886
+ getShowUiLabels(): boolean;
7686
7887
  }
7687
7888
 
7688
7889
  /** @public */
@@ -7789,8 +7990,6 @@ export declare class Vec {
7789
7990
  lrp(B: VecLike, t: number): Vec;
7790
7991
  equals(B: VecLike): boolean;
7791
7992
  equalsXY(x: number, y: number): boolean;
7792
- /** @deprecated use `uni` instead */
7793
- norm(): this;
7794
7993
  toFixed(): this;
7795
7994
  toString(): string;
7796
7995
  toJson(): VecModel;
@@ -7912,6 +8111,15 @@ export declare class Vec {
7912
8111
  /** @public */
7913
8112
  export declare type VecLike = Vec | VecModel;
7914
8113
 
8114
+ /**
8115
+ * Checks if an event has already been handled. See {@link markEventAsHandled}.
8116
+ *
8117
+ * @public
8118
+ */
8119
+ export declare function wasEventAlreadyHandled(e: {
8120
+ nativeEvent: Event;
8121
+ } | Event): boolean;
8122
+
7915
8123
 
7916
8124
  export * from "@tldraw/state";
7917
8125
  export * from "@tldraw/state-react";