tldraw 4.3.0-canary.d8da2a99f394 → 4.3.0-canary.e1766dd4eab3

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 (310) hide show
  1. package/dist-cjs/index.d.ts +26 -5
  2. package/dist-cjs/index.js +2 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/bindings/arrow/ArrowBindingUtil.js.map +2 -2
  5. package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +2 -2
  6. package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
  7. package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
  8. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +9 -12
  9. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
  10. package/dist-cjs/lib/shapes/arrow/arrow-types.js.map +1 -1
  11. package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
  12. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
  13. package/dist-cjs/lib/shapes/arrow/elbow/elbowArrowSnapLines.js.map +2 -2
  14. package/dist-cjs/lib/shapes/arrow/shared.js.map +2 -2
  15. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
  16. package/dist-cjs/lib/shapes/bookmark/bookmarks.js.map +2 -2
  17. package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +3 -3
  18. package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
  19. package/dist-cjs/lib/shapes/draw/toolStates/Drawing.js.map +2 -2
  20. package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js.map +2 -2
  21. package/dist-cjs/lib/shapes/frame/FrameShapeTool.js.map +1 -1
  22. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +1 -1
  23. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
  24. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +10 -6
  25. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
  26. package/dist-cjs/lib/shapes/geo/toolStates/Pointing.js.map +2 -2
  27. package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +1 -1
  28. package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
  29. package/dist-cjs/lib/shapes/line/toolStates/Pointing.js.map +2 -2
  30. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +5 -5
  31. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
  32. package/dist-cjs/lib/shapes/note/noteHelpers.js.map +2 -2
  33. package/dist-cjs/lib/shapes/shared/HyperlinkButton.js +2 -1
  34. package/dist-cjs/lib/shapes/shared/HyperlinkButton.js.map +2 -2
  35. package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +14 -2
  36. package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +3 -3
  37. package/dist-cjs/lib/shapes/shared/RichTextLabel.js +11 -3
  38. package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +3 -3
  39. package/dist-cjs/lib/shapes/shared/ShapeFill.js +2 -2
  40. package/dist-cjs/lib/shapes/shared/ShapeFill.js.map +2 -2
  41. package/dist-cjs/lib/shapes/shared/crop.js +1 -0
  42. package/dist-cjs/lib/shapes/shared/crop.js.map +2 -2
  43. package/dist-cjs/lib/shapes/shared/useEditablePlainText.js.map +2 -2
  44. package/dist-cjs/lib/shapes/shared/useEditableRichText.js.map +2 -2
  45. package/dist-cjs/lib/shapes/shared/{useForceSolid.js → useEfficientZoomThreshold.js} +10 -7
  46. package/dist-cjs/lib/shapes/shared/useEfficientZoomThreshold.js.map +7 -0
  47. package/dist-cjs/lib/shapes/shared/useImageOrVideoAsset.js +1 -1
  48. package/dist-cjs/lib/shapes/shared/useImageOrVideoAsset.js.map +2 -2
  49. package/dist-cjs/lib/shapes/text/TextShapeUtil.js +5 -2
  50. package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
  51. package/dist-cjs/lib/shapes/text/toolStates/Pointing.js.map +2 -2
  52. package/dist-cjs/lib/shapes/video/VideoShapeUtil.js +1 -1
  53. package/dist-cjs/lib/shapes/video/VideoShapeUtil.js.map +2 -2
  54. package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
  55. package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js.map +2 -2
  56. package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js +1 -4
  57. package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js.map +2 -2
  58. package/dist-cjs/lib/tools/SelectTool/childStates/Brushing.js.map +2 -2
  59. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Idle.js.map +2 -2
  60. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +1 -1
  61. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
  62. package/dist-cjs/lib/tools/SelectTool/childStates/EditingShape.js +30 -10
  63. package/dist-cjs/lib/tools/SelectTool/childStates/EditingShape.js.map +2 -2
  64. package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
  65. package/dist-cjs/lib/tools/SelectTool/childStates/PointingArrowLabel.js.map +2 -2
  66. package/dist-cjs/lib/tools/SelectTool/childStates/PointingHandle.js.map +2 -2
  67. package/dist-cjs/lib/tools/SelectTool/childStates/PointingSelection.js.map +2 -2
  68. package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
  69. package/dist-cjs/lib/tools/SelectTool/childStates/ScribbleBrushing.js.map +2 -2
  70. package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
  71. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.js +3 -9
  72. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.js.map +2 -2
  73. package/dist-cjs/lib/ui/components/EditLinkDialog.js +11 -1
  74. package/dist-cjs/lib/ui/components/EditLinkDialog.js.map +2 -2
  75. package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
  76. package/dist-cjs/lib/ui/components/ZoomMenu/DefaultZoomMenu.js +1 -1
  77. package/dist-cjs/lib/ui/components/ZoomMenu/DefaultZoomMenu.js.map +2 -2
  78. package/dist-cjs/lib/ui/components/menu-items.js +3 -1
  79. package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
  80. package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +1 -1
  81. package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
  82. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +143 -88
  83. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +2 -2
  84. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +1 -1
  85. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
  86. package/dist-cjs/lib/ui/context/actions.js +1 -2
  87. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  88. package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
  89. package/dist-cjs/lib/ui/hooks/useFlatten.js.map +2 -2
  90. package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
  91. package/dist-cjs/lib/ui/version.js +3 -3
  92. package/dist-cjs/lib/ui/version.js.map +1 -1
  93. package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js +8 -0
  94. package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
  95. package/dist-cjs/lib/utils/export/exportAs.js.map +2 -2
  96. package/dist-cjs/lib/utils/frames/frames.js.map +2 -2
  97. package/dist-cjs/lib/utils/text/richText.js +7 -17
  98. package/dist-cjs/lib/utils/text/richText.js.map +3 -3
  99. package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
  100. package/dist-esm/index.d.mts +26 -5
  101. package/dist-esm/index.mjs +3 -1
  102. package/dist-esm/index.mjs.map +2 -2
  103. package/dist-esm/lib/bindings/arrow/ArrowBindingUtil.mjs.map +2 -2
  104. package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +2 -2
  105. package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
  106. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  107. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +10 -14
  108. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
  109. package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
  110. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
  111. package/dist-esm/lib/shapes/arrow/elbow/elbowArrowSnapLines.mjs.map +2 -2
  112. package/dist-esm/lib/shapes/arrow/shared.mjs.map +2 -2
  113. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
  114. package/dist-esm/lib/shapes/bookmark/bookmarks.mjs.map +2 -2
  115. package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +3 -3
  116. package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
  117. package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs.map +2 -2
  118. package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs.map +2 -2
  119. package/dist-esm/lib/shapes/frame/FrameShapeTool.mjs.map +1 -1
  120. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +1 -1
  121. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
  122. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +10 -6
  123. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
  124. package/dist-esm/lib/shapes/geo/toolStates/Pointing.mjs.map +2 -2
  125. package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +1 -1
  126. package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
  127. package/dist-esm/lib/shapes/line/toolStates/Pointing.mjs.map +2 -2
  128. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +5 -5
  129. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
  130. package/dist-esm/lib/shapes/note/noteHelpers.mjs.map +2 -2
  131. package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs +3 -2
  132. package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs.map +2 -2
  133. package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +14 -2
  134. package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
  135. package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +11 -3
  136. package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
  137. package/dist-esm/lib/shapes/shared/ShapeFill.mjs +2 -2
  138. package/dist-esm/lib/shapes/shared/ShapeFill.mjs.map +2 -2
  139. package/dist-esm/lib/shapes/shared/crop.mjs +1 -0
  140. package/dist-esm/lib/shapes/shared/crop.mjs.map +2 -2
  141. package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs.map +2 -2
  142. package/dist-esm/lib/shapes/shared/useEditableRichText.mjs.map +2 -2
  143. package/dist-esm/lib/shapes/shared/useEfficientZoomThreshold.mjs +12 -0
  144. package/dist-esm/lib/shapes/shared/useEfficientZoomThreshold.mjs.map +7 -0
  145. package/dist-esm/lib/shapes/shared/useImageOrVideoAsset.mjs +1 -1
  146. package/dist-esm/lib/shapes/shared/useImageOrVideoAsset.mjs.map +2 -2
  147. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +5 -2
  148. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
  149. package/dist-esm/lib/shapes/text/toolStates/Pointing.mjs.map +2 -2
  150. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs +1 -1
  151. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs.map +2 -2
  152. package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
  153. package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs +1 -4
  154. package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs.map +2 -2
  155. package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs +1 -4
  156. package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs.map +2 -2
  157. package/dist-esm/lib/tools/SelectTool/childStates/Brushing.mjs.map +2 -2
  158. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Idle.mjs.map +2 -2
  159. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +1 -1
  160. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
  161. package/dist-esm/lib/tools/SelectTool/childStates/EditingShape.mjs +30 -10
  162. package/dist-esm/lib/tools/SelectTool/childStates/EditingShape.mjs.map +2 -2
  163. package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
  164. package/dist-esm/lib/tools/SelectTool/childStates/PointingArrowLabel.mjs.map +2 -2
  165. package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs +1 -4
  166. package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs.map +2 -2
  167. package/dist-esm/lib/tools/SelectTool/childStates/PointingSelection.mjs.map +2 -2
  168. package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
  169. package/dist-esm/lib/tools/SelectTool/childStates/ScribbleBrushing.mjs.map +2 -2
  170. package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
  171. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.mjs +2 -8
  172. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.mjs.map +2 -2
  173. package/dist-esm/lib/ui/components/EditLinkDialog.mjs +11 -1
  174. package/dist-esm/lib/ui/components/EditLinkDialog.mjs.map +2 -2
  175. package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
  176. package/dist-esm/lib/ui/components/ZoomMenu/DefaultZoomMenu.mjs +1 -1
  177. package/dist-esm/lib/ui/components/ZoomMenu/DefaultZoomMenu.mjs.map +2 -2
  178. package/dist-esm/lib/ui/components/menu-items.mjs +4 -5
  179. package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
  180. package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +2 -2
  181. package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
  182. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +151 -90
  183. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +2 -2
  184. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +2 -2
  185. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
  186. package/dist-esm/lib/ui/context/actions.mjs +1 -2
  187. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  188. package/dist-esm/lib/ui/hooks/menu-hooks.mjs +1 -4
  189. package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
  190. package/dist-esm/lib/ui/hooks/useFlatten.mjs.map +2 -2
  191. package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
  192. package/dist-esm/lib/ui/version.mjs +3 -3
  193. package/dist-esm/lib/ui/version.mjs.map +1 -1
  194. package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs +8 -0
  195. package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
  196. package/dist-esm/lib/utils/export/exportAs.mjs +1 -3
  197. package/dist-esm/lib/utils/export/exportAs.mjs.map +2 -2
  198. package/dist-esm/lib/utils/frames/frames.mjs.map +2 -2
  199. package/dist-esm/lib/utils/text/richText.mjs +3 -3
  200. package/dist-esm/lib/utils/text/richText.mjs.map +2 -2
  201. package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
  202. package/package.json +10 -10
  203. package/src/index.ts +1 -0
  204. package/src/lib/bindings/arrow/ArrowBindingUtil.ts +1 -1
  205. package/src/lib/canvas/TldrawSelectionForeground.tsx +6 -11
  206. package/src/lib/defaultExternalContentHandlers.ts +3 -4
  207. package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +2 -2
  208. package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +11 -13
  209. package/src/lib/shapes/arrow/arrow-types.ts +2 -0
  210. package/src/lib/shapes/arrow/arrowLabel.ts +1 -1
  211. package/src/lib/shapes/arrow/arrowTargetState.ts +1 -1
  212. package/src/lib/shapes/arrow/elbow/elbowArrowSnapLines.tsx +3 -3
  213. package/src/lib/shapes/arrow/shared.ts +4 -4
  214. package/src/lib/shapes/arrow/toolStates/Pointing.tsx +1 -1
  215. package/src/lib/shapes/bookmark/bookmarks.ts +3 -3
  216. package/src/lib/shapes/draw/DrawShapeUtil.tsx +3 -3
  217. package/src/lib/shapes/draw/toolStates/Drawing.ts +4 -4
  218. package/src/lib/shapes/embed/EmbedShapeUtil.tsx +1 -1
  219. package/src/lib/shapes/frame/FrameShapeTool.ts +1 -1
  220. package/src/lib/shapes/frame/FrameShapeUtil.tsx +1 -1
  221. package/src/lib/shapes/geo/GeoShapeUtil.test.tsx +10 -2
  222. package/src/lib/shapes/geo/GeoShapeUtil.tsx +9 -4
  223. package/src/lib/shapes/geo/toolStates/Pointing.ts +3 -3
  224. package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +1 -1
  225. package/src/lib/shapes/line/LineShapeTool.test.ts +6 -6
  226. package/src/lib/shapes/line/LineShapeUtil.test.tsx +5 -5
  227. package/src/lib/shapes/line/toolStates/Pointing.ts +1 -1
  228. package/src/lib/shapes/note/NoteShapeTool.test.ts +2 -1
  229. package/src/lib/shapes/note/NoteShapeUtil.tsx +7 -8
  230. package/src/lib/shapes/note/noteHelpers.ts +2 -2
  231. package/src/lib/shapes/shared/HyperlinkButton.tsx +3 -2
  232. package/src/lib/shapes/shared/PlainTextLabel.tsx +12 -2
  233. package/src/lib/shapes/shared/RichTextLabel.tsx +13 -3
  234. package/src/lib/shapes/shared/ShapeFill.tsx +2 -2
  235. package/src/lib/shapes/shared/crop.ts +1 -0
  236. package/src/lib/shapes/shared/useEditablePlainText.ts +7 -3
  237. package/src/lib/shapes/shared/useEditableRichText.ts +7 -3
  238. package/src/lib/shapes/shared/useEfficientZoomThreshold.ts +10 -0
  239. package/src/lib/shapes/shared/useImageOrVideoAsset.ts +1 -1
  240. package/src/lib/shapes/text/TextShapeTool.test.ts +4 -4
  241. package/src/lib/shapes/text/TextShapeUtil.tsx +5 -0
  242. package/src/lib/shapes/text/toolStates/Pointing.ts +1 -1
  243. package/src/lib/shapes/video/VideoShapeUtil.tsx +2 -1
  244. package/src/lib/tools/EraserTool/childStates/Erasing.ts +3 -5
  245. package/src/lib/tools/EraserTool/childStates/Pointing.ts +3 -16
  246. package/src/lib/tools/SelectTool/DragAndDropManager.ts +2 -4
  247. package/src/lib/tools/SelectTool/childStates/Brushing.ts +2 -6
  248. package/src/lib/tools/SelectTool/childStates/Crop/children/Idle.ts +2 -3
  249. package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +4 -7
  250. package/src/lib/tools/SelectTool/childStates/EditingShape.ts +46 -15
  251. package/src/lib/tools/SelectTool/childStates/Idle.ts +6 -10
  252. package/src/lib/tools/SelectTool/childStates/PointingArrowLabel.ts +1 -1
  253. package/src/lib/tools/SelectTool/childStates/PointingHandle.ts +4 -12
  254. package/src/lib/tools/SelectTool/childStates/PointingSelection.ts +2 -2
  255. package/src/lib/tools/SelectTool/childStates/Resizing.ts +2 -4
  256. package/src/lib/tools/SelectTool/childStates/ScribbleBrushing.ts +2 -4
  257. package/src/lib/tools/SelectTool/childStates/Translating.ts +1 -3
  258. package/src/lib/ui/components/ActionsMenu/DefaultActionsMenuContent.tsx +1 -9
  259. package/src/lib/ui/components/EditLinkDialog.tsx +16 -6
  260. package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +2 -2
  261. package/src/lib/ui/components/ZoomMenu/DefaultZoomMenu.tsx +1 -1
  262. package/src/lib/ui/components/menu-items.tsx +9 -15
  263. package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +2 -2
  264. package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +196 -108
  265. package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +2 -2
  266. package/src/lib/ui/context/actions.tsx +9 -13
  267. package/src/lib/ui/hooks/menu-hooks.ts +9 -19
  268. package/src/lib/ui/hooks/useFlatten.ts +1 -2
  269. package/src/lib/ui/hooks/useTools.tsx +1 -2
  270. package/src/lib/ui/version.ts +3 -3
  271. package/src/lib/utils/excalidraw/putExcalidrawContent.ts +8 -0
  272. package/src/lib/utils/export/exportAs.ts +2 -9
  273. package/src/lib/utils/frames/frames.ts +1 -1
  274. package/src/lib/utils/text/richText.ts +3 -3
  275. package/src/lib/utils/tldr/buildFromV1Document.ts +12 -17
  276. package/src/test/Editor.test.tsx +38 -12
  277. package/src/test/SelectTool.test.ts +11 -19
  278. package/src/test/TestEditor.ts +1 -4
  279. package/src/test/TldrawEditor.test.tsx +21 -18
  280. package/src/test/bindings.test.tsx +29 -25
  281. package/src/test/bindingsIndex.test.tsx +4 -4
  282. package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +2 -2
  283. package/src/test/commands/cameraState.test.ts +299 -0
  284. package/src/test/commands/createShape.test.ts +64 -0
  285. package/src/test/commands/createShapes.test.ts +15 -1
  286. package/src/test/commands/getSvgString.test.ts +2 -2
  287. package/src/test/commands/isShapeOfType.test.ts +44 -0
  288. package/src/test/commands/putContent.test.ts +80 -1
  289. package/src/test/commands/updateShape.test.ts +67 -0
  290. package/src/test/commands/updateShapes.test.ts +21 -5
  291. package/src/test/custom-clipping.test.ts +36 -35
  292. package/src/test/customSnapping.test.tsx +77 -62
  293. package/src/test/duplicate.test.ts +1 -1
  294. package/src/test/frames.test.ts +2 -2
  295. package/src/test/getCulledShapes.test.tsx +11 -3
  296. package/src/test/getShapeAtPoint.test.ts +2 -2
  297. package/src/test/groups.test.tsx +6 -3
  298. package/src/test/resizing.test.ts +9 -13
  299. package/src/test/selection-omnibus.test.ts +11 -11
  300. package/src/test/shapeutils.test.ts +1 -1
  301. package/src/test/styles2.test.tsx +1 -1
  302. package/src/test/styles3.test.ts +5 -5
  303. package/src/test/test-jsx.tsx +69 -57
  304. package/src/test/text.test.ts +15 -17
  305. package/src/test/translating.test.ts +6 -8
  306. package/tldraw.css +8 -4
  307. package/dist-cjs/lib/shapes/shared/useForceSolid.js.map +0 -7
  308. package/dist-esm/lib/shapes/shared/useForceSolid.mjs +0 -9
  309. package/dist-esm/lib/shapes/shared/useForceSolid.mjs.map +0 -7
  310. package/src/lib/shapes/shared/useForceSolid.ts +0 -6
@@ -4,10 +4,10 @@ import {
4
4
  Polyline2d,
5
5
  ShapeUtil,
6
6
  TLAnyShapeUtilConstructor,
7
- TLBaseShape,
8
7
  TLHandle,
9
8
  TLHandleDragInfo,
10
9
  TLLineShape,
10
+ TLShape,
11
11
  TLShapeId,
12
12
  Vec,
13
13
  VecModel,
@@ -16,13 +16,19 @@ import {
16
16
  import { TestEditor } from './TestEditor'
17
17
  import { TL } from './test-jsx'
18
18
 
19
+ const TEST1_TYPE = 'test1'
20
+
21
+ declare module '@tldraw/tlschema' {
22
+ export interface TLGlobalShapePropsMap {
23
+ [TEST1_TYPE]: { w: number; h: number; boundsSnapPoints: VecModel[] | null }
24
+ }
25
+ }
26
+
27
+ type Test1Shape = TLShape<typeof TEST1_TYPE>
28
+
19
29
  describe('custom shape bounds snapping - translate', () => {
20
- type TestShape = TLBaseShape<
21
- 'test',
22
- { w: number; h: number; boundsSnapPoints: VecModel[] | null }
23
- >
24
- class TestShapeUtil extends BaseBoxShapeUtil<TestShape> {
25
- static override type = 'test'
30
+ class TestShapeUtil extends BaseBoxShapeUtil<Test1Shape> {
31
+ static override type = TEST1_TYPE
26
32
  override getDefaultProps() {
27
33
  return { w: 100, h: 100, boundsSnapPoints: null }
28
34
  }
@@ -32,7 +38,7 @@ describe('custom shape bounds snapping - translate', () => {
32
38
  override indicator() {
33
39
  throw new Error('Method not implemented.')
34
40
  }
35
- override getBoundsSnapGeometry(shape: TestShape) {
41
+ override getBoundsSnapGeometry(shape: Test1Shape) {
36
42
  return {
37
43
  points: shape.props.boundsSnapPoints ?? undefined,
38
44
  }
@@ -46,14 +52,14 @@ describe('custom shape bounds snapping - translate', () => {
46
52
  editor = new TestEditor({ shapeUtils })
47
53
  ids = editor.createShapesFromJsx([
48
54
  <TL.geo ref="box" x={0} y={0} w={100} h={100} />,
49
- <TL.test ref="test" x={200} y={200} w={100} h={100} boundsSnapPoints={null} />,
55
+ <TL.test1 ref="test1" x={200} y={200} w={100} h={100} boundsSnapPoints={null} />,
50
56
  ])
51
57
  })
52
58
 
53
59
  describe('with default boundSnapPoints', () => {
54
60
  test('normal snapping works with default boundSnapPoints when moving test shape', () => {
55
61
  // start translating the test shape
56
- editor.setSelectedShapes([ids.test]).pointerDown(250, 250)
62
+ editor.setSelectedShapes([ids.test1]).pointerDown(250, 250)
57
63
 
58
64
  // move the left edge of the test shape to the right edge of the box shape - it should snap
59
65
  editor.pointerMove(155, 250, undefined, { ctrlKey: true })
@@ -84,15 +90,15 @@ describe('custom shape bounds snapping - translate', () => {
84
90
 
85
91
  describe('with only the center in boundSnapPoints', () => {
86
92
  beforeEach(() => {
87
- editor.updateShape<TestShape>({
88
- id: ids.test,
89
- type: 'test',
93
+ editor.updateShape({
94
+ id: ids.test1,
95
+ type: TEST1_TYPE,
90
96
  props: { boundsSnapPoints: [{ x: 50, y: 50 }] },
91
97
  })
92
98
  })
93
99
 
94
100
  describe('when moving the test shape', () => {
95
- beforeEach(() => editor.select(ids.test).pointerDown(250, 250))
101
+ beforeEach(() => editor.select(ids.test1).pointerDown(250, 250))
96
102
 
97
103
  test('does not snap its edges to the box edges', () => {
98
104
  editor.pointerMove(155, 250, undefined, { ctrlKey: true })
@@ -126,15 +132,15 @@ describe('custom shape bounds snapping - translate', () => {
126
132
 
127
133
  describe('with empty boundSnapPoints', () => {
128
134
  beforeEach(() => {
129
- editor.updateShape<TestShape>({
130
- id: ids.test,
131
- type: 'test',
135
+ editor.updateShape({
136
+ id: ids.test1,
137
+ type: TEST1_TYPE,
132
138
  props: { boundsSnapPoints: [] },
133
139
  })
134
140
  })
135
141
 
136
142
  test('test shape does not snap to anything', () => {
137
- editor.select(ids.test).pointerDown(250, 250)
143
+ editor.select(ids.test1).pointerDown(250, 250)
138
144
 
139
145
  // try to snap our left edge to the right edge of the box shape - it should not snap
140
146
  editor.pointerMove(155, 250, undefined, { ctrlKey: true })
@@ -163,10 +169,11 @@ describe('custom shape bounds snapping - translate', () => {
163
169
  })
164
170
  })
165
171
 
166
- describe('custom handle snapping', () => {
167
- type TestShape = TLBaseShape<
168
- 'test',
169
- {
172
+ const TEST2_TYPE = 'test2'
173
+
174
+ declare module '@tldraw/tlschema' {
175
+ export interface TLGlobalShapePropsMap {
176
+ [TEST2_TYPE]: {
170
177
  w: number
171
178
  h: number
172
179
  ownHandle: VecModel
@@ -176,10 +183,15 @@ describe('custom handle snapping', () => {
176
183
  selfSnapPoints: VecModel[] | 'default'
177
184
  handleSnapType?: 'point' | 'align'
178
185
  }
179
- >
180
- class TestShapeUtil extends BaseBoxShapeUtil<TestShape> {
181
- static override type = 'test'
182
- override getDefaultProps(): TestShape['props'] {
186
+ }
187
+ }
188
+
189
+ type Test2Shape = TLShape<typeof TEST2_TYPE>
190
+
191
+ describe('custom handle snapping', () => {
192
+ class TestShapeUtil extends BaseBoxShapeUtil<Test2Shape> {
193
+ static override type = TEST2_TYPE
194
+ override getDefaultProps(): Test2Shape['props'] {
183
195
  return {
184
196
  w: 100,
185
197
  h: 100,
@@ -196,7 +208,7 @@ describe('custom handle snapping', () => {
196
208
  override indicator() {
197
209
  throw new Error('Method not implemented.')
198
210
  }
199
- override getHandleSnapGeometry(shape: TestShape) {
211
+ override getHandleSnapGeometry(shape: Test2Shape) {
200
212
  const { handleOutline, handlePoints, selfSnapOutline, selfSnapPoints } = shape.props
201
213
  return {
202
214
  outline:
@@ -214,7 +226,7 @@ describe('custom handle snapping', () => {
214
226
  getSelfSnapPoints: selfSnapPoints === 'default' ? undefined : () => selfSnapPoints,
215
227
  }
216
228
  }
217
- override getHandles(shape: TestShape): TLHandle[] {
229
+ override getHandles(shape: Test2Shape): TLHandle[] {
218
230
  const handle: TLHandle = {
219
231
  id: 'handle',
220
232
  label: 'handle',
@@ -233,7 +245,7 @@ describe('custom handle snapping', () => {
233
245
 
234
246
  return [handle]
235
247
  }
236
- override onHandleDrag(shape: TestShape, { handle }: TLHandleDragInfo<TestShape>) {
248
+ override onHandleDrag(shape: Test2Shape, { handle }: TLHandleDragInfo<Test2Shape>) {
237
249
  return { ...shape, props: { ...shape.props, ownHandle: { x: handle.x, y: handle.y } } }
238
250
  }
239
251
  }
@@ -253,7 +265,7 @@ describe('custom handle snapping', () => {
253
265
  a2: { id: 'a2', index: 'a2' as IndexKey, x: 100, y: 100 },
254
266
  }}
255
267
  />,
256
- <TL.test ref="test" x={200} y={200} w={100} h={100} boundsSnapPoints={null} />,
268
+ <TL.test2 ref="test2" x={200} y={200} w={100} h={100} />,
257
269
  ])
258
270
  })
259
271
 
@@ -296,9 +308,9 @@ describe('custom handle snapping', () => {
296
308
 
297
309
  describe('with empty handleSnapGeometry.outline', () => {
298
310
  beforeEach(() => {
299
- editor.updateShape<TestShape>({
300
- id: ids.test,
301
- type: 'test',
311
+ editor.updateShape({
312
+ id: ids.test2,
313
+ type: TEST2_TYPE,
302
314
  props: { handleOutline: null },
303
315
  })
304
316
  })
@@ -313,9 +325,9 @@ describe('custom handle snapping', () => {
313
325
 
314
326
  describe('with custom handleSnapGeometry.outline', () => {
315
327
  beforeEach(() => {
316
- editor.updateShape<TestShape>({
317
- id: ids.test,
318
- type: 'test',
328
+ editor.updateShape({
329
+ id: ids.test2,
330
+ type: TEST2_TYPE,
319
331
  props: {
320
332
  // a diagonal line from the top left to the bottom right
321
333
  handleOutline: [
@@ -360,9 +372,9 @@ describe('custom handle snapping', () => {
360
372
 
361
373
  describe('with custom handleSnapGeometry.points', () => {
362
374
  beforeEach(() => {
363
- editor.updateShape<TestShape>({
364
- id: ids.test,
365
- type: 'test',
375
+ editor.updateShape({
376
+ id: ids.test2,
377
+ type: TEST2_TYPE,
366
378
  props: {
367
379
  handlePoints: [
368
380
  { x: 30, y: 30 },
@@ -387,12 +399,12 @@ describe('custom handle snapping', () => {
387
399
 
388
400
  describe('with custom handleSnapGeometry.points along the outline', () => {
389
401
  beforeEach(() => {
390
- editor.updateShape<TestShape>({
391
- id: ids.test,
392
- type: 'test',
402
+ editor.updateShape({
403
+ id: ids.test2,
404
+ type: TEST2_TYPE,
393
405
  props: {
394
406
  handlePoints: editor
395
- .getShapeGeometry(ids.test)
407
+ .getShapeGeometry(ids.test2)
396
408
  .bounds.cornersAndCenter.map(({ x, y }) => ({ x, y })),
397
409
  },
398
410
  })
@@ -426,9 +438,9 @@ describe('custom handle snapping', () => {
426
438
  describe('self snapping', () => {
427
439
  beforeEach(() => {
428
440
  editor.deleteShape(ids.line)
429
- editor.updateShape<TestShape>({
430
- id: ids.test,
431
- type: 'test',
441
+ editor.updateShape({
442
+ id: ids.test2,
443
+ type: TEST2_TYPE,
432
444
  x: 0,
433
445
  y: 0,
434
446
  props: {
@@ -437,12 +449,12 @@ describe('custom handle snapping', () => {
437
449
  })
438
450
  })
439
451
  function startDraggingOwnHandle() {
440
- const shape = editor.select(ids.test).getOnlySelectedShape()!
452
+ const shape = editor.select(ids.test2).getOnlySelectedShape()!
441
453
  const handles = editor.getShapeHandles(shape)!
442
454
  editor.pointerDown(0, 0, { target: 'handle', shape, handle: handles[0] })
443
455
  }
444
456
  function ownHandlePosition() {
445
- const shape = editor.select(ids.test).getOnlySelectedShape()!
457
+ const shape = editor.select(ids.test2).getOnlySelectedShape()!
446
458
  const handle = editor.getShapeHandles(shape)![0]
447
459
  return { x: handle.x, y: handle.y }
448
460
  }
@@ -462,9 +474,9 @@ describe('custom handle snapping', () => {
462
474
  })
463
475
  describe('with custom self snap outline & points', () => {
464
476
  beforeEach(() => {
465
- editor.updateShape<TestShape>({
466
- id: ids.test,
467
- type: 'test',
477
+ editor.updateShape({
478
+ id: ids.test2,
479
+ type: TEST2_TYPE,
468
480
  props: {
469
481
  selfSnapOutline: [
470
482
  { x: 20, y: 50 },
@@ -506,9 +518,9 @@ describe('custom handle snapping', () => {
506
518
 
507
519
  describe('with snapType set to align', () => {
508
520
  beforeEach(() => {
509
- editor.updateShape<TestShape>({
510
- id: ids.test,
511
- type: 'test',
521
+ editor.updateShape({
522
+ id: ids.test2,
523
+ type: TEST2_TYPE,
512
524
  props: {
513
525
  selfSnapPoints: [
514
526
  { x: 20, y: 50 },
@@ -543,19 +555,24 @@ describe('custom handle snapping', () => {
543
555
  })
544
556
  })
545
557
 
546
- describe('custom adjacent handle for shift snapping', () => {
547
- type BezierShape = TLBaseShape<
548
- 'bezier',
549
- {
558
+ const BEZIER_TYPE = 'bezier'
559
+
560
+ declare module '@tldraw/tlschema' {
561
+ export interface TLGlobalShapePropsMap {
562
+ [BEZIER_TYPE]: {
550
563
  start: VecModel
551
564
  cp1: VecModel
552
565
  cp2: VecModel
553
566
  end: VecModel
554
567
  }
555
- >
568
+ }
569
+ }
570
+
571
+ type BezierShape = TLShape<typeof BEZIER_TYPE>
556
572
 
573
+ describe('custom adjacent handle for shift snapping', () => {
557
574
  class BezierShapeUtil extends ShapeUtil<BezierShape> {
558
- static override type = 'bezier'
575
+ static override type = BEZIER_TYPE
559
576
  override getDefaultProps() {
560
577
  return {
561
578
  start: { x: 0, y: 0 },
@@ -632,8 +649,6 @@ describe('custom adjacent handle for shift snapping', () => {
632
649
  ref="bezier"
633
650
  x={0}
634
651
  y={0}
635
- w={100}
636
- h={100}
637
652
  start={{ x: 0, y: 0 }}
638
653
  cp1={{ x: 50, y: 0 }}
639
654
  cp2={{ x: 50, y: 100 }}
@@ -295,7 +295,7 @@ describe('When duplicating shapes that include arrows', () => {
295
295
  .select(
296
296
  ...editor
297
297
  .getCurrentPageShapes()
298
- .filter((s) => editor.isShapeOfType<TLArrowShape>(s, 'arrow'))
298
+ .filter((s) => editor.isShapeOfType(s, 'arrow'))
299
299
  .map((s) => s.id)
300
300
  )
301
301
 
@@ -1363,13 +1363,13 @@ describe('Unparenting behavior', () => {
1363
1363
 
1364
1364
  // When the shape has a fill, it should not fall out of the frame
1365
1365
  editor.undo()
1366
- editor.updateShape<TLGeoShape>({ ...largeRect, props: { fill: 'solid' } })
1366
+ editor.updateShape({ ...largeRect, props: { fill: 'solid' } })
1367
1367
  dragOntoFrame()
1368
1368
  expect(editor.getShape(largeRect.id)!.parentId).toBe(frameId)
1369
1369
 
1370
1370
  // When the shape has a label and that label is on top of the frame, it should not fall out of the frame
1371
1371
  editor.undo()
1372
- editor.updateShape<TLGeoShape>({
1372
+ editor.updateShape({
1373
1373
  ...largeRect,
1374
1374
  props: { fill: 'none', richText: toRichText('hello') },
1375
1375
  })
@@ -3,7 +3,7 @@ import {
3
3
  Box,
4
4
  RecordProps,
5
5
  T,
6
- TLBaseShape,
6
+ TLShape,
7
7
  TLShapeId,
8
8
  createShapeId,
9
9
  } from '@tldraw/editor'
@@ -11,11 +11,19 @@ import { vi } from 'vitest'
11
11
  import { TestEditor } from './TestEditor'
12
12
  import { TL } from './test-jsx'
13
13
 
14
+ const UNCULLABLE_TYPE = 'uncullable'
15
+
16
+ declare module '@tldraw/tlschema' {
17
+ export interface TLGlobalShapePropsMap {
18
+ [UNCULLABLE_TYPE]: { w: number; h: number }
19
+ }
20
+ }
21
+
14
22
  // Custom uncullable shape type for testing canCull override
15
- type UncullableShape = TLBaseShape<'uncullable', { w: number; h: number }>
23
+ type UncullableShape = TLShape<typeof UNCULLABLE_TYPE>
16
24
 
17
25
  class UncullableShapeUtil extends BaseBoxShapeUtil<UncullableShape> {
18
- static override type = 'uncullable' as const
26
+ static override type = UNCULLABLE_TYPE
19
27
  static override props: RecordProps<UncullableShape> = {
20
28
  w: T.number,
21
29
  h: T.number,
@@ -1,4 +1,4 @@
1
- import { TLGeoShape, TLShape, createShapeId, toRichText } from '@tldraw/editor'
1
+ import { TLShape, createShapeId, toRichText } from '@tldraw/editor'
2
2
  import { TestEditor } from './TestEditor'
3
3
 
4
4
  let editor: TestEditor
@@ -146,7 +146,7 @@ describe('with hitLabels=true', () => {
146
146
  it('hits geo shape label behind overlapping hollow shape', () => {
147
147
  // label is empty
148
148
  expect(editor.getShapeAtPoint({ x: 350, y: 350 }, opts)?.id).toBe(ids.box3)
149
- editor.updateShape<TLGeoShape>({
149
+ editor.updateShape({
150
150
  id: ids.box2,
151
151
  type: 'geo',
152
152
  props: { richText: toRichText('hello') },
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  Box,
3
+ ExtractShapeByProps,
3
4
  GroupShapeUtil,
4
5
  TLArrowShape,
5
6
  TLGroupShape,
@@ -35,14 +36,16 @@ const ids = {
35
36
  groupA: createShapeId('groupA'),
36
37
  }
37
38
 
39
+ type BoxShape = ExtractShapeByProps<{ fill: string }>
40
+
38
41
  const box = (
39
42
  id: TLShapeId,
40
43
  x: number,
41
44
  y: number,
42
45
  w = 10,
43
46
  h = 10,
44
- fill = 'solid'
45
- ): TLShapePartial => ({
47
+ fill: BoxShape['props']['fill'] = 'solid'
48
+ ): TLShapePartial<BoxShape> => ({
46
49
  type: 'geo',
47
50
  id,
48
51
  x,
@@ -1980,7 +1983,7 @@ describe('Group opacity', () => {
1980
1983
  editor.setOpacityForNextShapes(0.5)
1981
1984
  editor.groupShapes(editor.getSelectedShapeIds())
1982
1985
  const group = editor.getShape(onlySelectedId())!
1983
- assert(editor.isShapeOfType<TLGroupShape>(group, 'group'))
1986
+ assert(editor.isShapeOfType(group, 'group'))
1984
1987
  expect(group.opacity).toBe(1)
1985
1988
  })
1986
1989
  })
@@ -3876,10 +3876,8 @@ it('uses the cross cursor when create resizing', () => {
3876
3876
  describe('Resizing text from the right edge', () => {
3877
3877
  it('Resizes text from the right edge', () => {
3878
3878
  const id = createShapeId()
3879
- editor.createShapes<TLTextShape>([{ id, type: 'text', props: { richText: toRichText('H') } }])
3880
- editor.updateShapes<TLTextShape>([
3881
- { id, type: 'text', props: { richText: toRichText('Hello World') } },
3882
- ]) // auto size
3879
+ editor.createShapes([{ id, type: 'text', props: { richText: toRichText('H') } }])
3880
+ editor.updateShapes([{ id, type: 'text', props: { richText: toRichText('Hello World') } }]) // auto size
3883
3881
 
3884
3882
  editor.select(id)
3885
3883
 
@@ -3905,10 +3903,8 @@ describe('Resizing text from the right edge', () => {
3905
3903
  editor.updateInstanceState({ isCoarsePointer: true })
3906
3904
 
3907
3905
  const id = createShapeId()
3908
- editor.createShapes<TLTextShape>([{ id, type: 'text', props: { richText: toRichText('H') } }])
3909
- editor.updateShapes<TLTextShape>([
3910
- { id, type: 'text', props: { richText: toRichText('Hello World') } },
3911
- ]) // auto size
3906
+ editor.createShapes([{ id, type: 'text', props: { richText: toRichText('H') } }])
3907
+ editor.updateShapes([{ id, type: 'text', props: { richText: toRichText('Hello World') } }]) // auto size
3912
3908
 
3913
3909
  editor.select(id)
3914
3910
 
@@ -3954,7 +3950,7 @@ describe('When resizing near the edges of the screen', () => {
3954
3950
 
3955
3951
  describe('resizing text with autosize true', () => {
3956
3952
  it('resizes text from the right side', () => {
3957
- editor.createShape<TLTextShape>({
3953
+ editor.createShape({
3958
3954
  type: 'text',
3959
3955
  x: 0,
3960
3956
  y: 0,
@@ -3980,7 +3976,7 @@ describe('resizing text with autosize true', () => {
3980
3976
  })
3981
3977
 
3982
3978
  it('resizes text from the right side when alt key is pressed', () => {
3983
- editor.createShape<TLTextShape>({
3979
+ editor.createShape({
3984
3980
  type: 'text',
3985
3981
  x: 0,
3986
3982
  y: 0,
@@ -4007,7 +4003,7 @@ describe('resizing text with autosize true', () => {
4007
4003
  })
4008
4004
 
4009
4005
  it('resizes text from the left side', () => {
4010
- editor.createShape<TLTextShape>({
4006
+ editor.createShape({
4011
4007
  type: 'text',
4012
4008
  x: 0,
4013
4009
  y: 0,
@@ -4033,7 +4029,7 @@ describe('resizing text with autosize true', () => {
4033
4029
  })
4034
4030
 
4035
4031
  it('resizes text from the left side when alt is pressed', () => {
4036
- editor.createShape<TLTextShape>({
4032
+ editor.createShape({
4037
4033
  type: 'text',
4038
4034
  x: 0,
4039
4035
  y: 0,
@@ -4062,7 +4058,7 @@ describe('resizing text with autosize true', () => {
4062
4058
 
4063
4059
  describe('cancelling a resize operation', () => {
4064
4060
  it('undoes any changes since the start of the resize operation', () => {
4065
- editor.createShape<TLGeoShape>({
4061
+ editor.createShape({
4066
4062
  type: 'geo',
4067
4063
  x: 0,
4068
4064
  y: 0,
@@ -76,7 +76,7 @@ describe('Hovering shapes', () => {
76
76
  editor.pointerMove(50, 50)
77
77
  expect(editor.getHoveredShapeId()).toBe(null)
78
78
 
79
- editor.updateShape<TLGeoShape>({
79
+ editor.updateShape({
80
80
  id: ids.box1,
81
81
  type: 'geo',
82
82
  props: { richText: toRichText('hello') },
@@ -88,7 +88,7 @@ describe('Hovering shapes', () => {
88
88
  })
89
89
 
90
90
  it('selects a shape with a full label on pointer down', () => {
91
- editor.updateShape<TLGeoShape>({
91
+ editor.updateShape({
92
92
  id: ids.box1,
93
93
  type: 'geo',
94
94
  props: { richText: toRichText('hello') },
@@ -462,7 +462,7 @@ describe('when shape is hollow', () => {
462
462
  describe('when shape is a frame', () => {
463
463
  let frame1: TLFrameShape
464
464
  beforeEach(() => {
465
- editor.createShape<TLFrameShape>({ id: ids.frame1, type: 'frame', props: { w: 100, h: 100 } })
465
+ editor.createShape({ id: ids.frame1, type: 'frame', props: { w: 100, h: 100 } })
466
466
  frame1 = editor.getShape<TLFrameShape>(ids.frame1)!
467
467
  })
468
468
 
@@ -517,8 +517,8 @@ describe('when shape is a frame', () => {
517
517
  describe('When a shape is behind a frame', () => {
518
518
  beforeEach(() => {
519
519
  editor.selectAll().deleteShapes(editor.getSelectedShapeIds())
520
- editor.createShape<TLGeoShape>({ id: ids.box1, type: 'geo', x: 25, y: 25 })
521
- editor.createShape<TLFrameShape>({ id: ids.frame1, type: 'frame', props: { w: 100, h: 100 } })
520
+ editor.createShape({ id: ids.box1, type: 'geo', x: 25, y: 25 })
521
+ editor.createShape({ id: ids.frame1, type: 'frame', props: { w: 100, h: 100 } })
522
522
  })
523
523
 
524
524
  it('does not select the shape when clicked inside', () => {
@@ -548,8 +548,8 @@ describe('when shape is inside of a frame', () => {
548
548
  let frame1: TLFrameShape
549
549
  let box1: TLGeoShape
550
550
  beforeEach(() => {
551
- editor.createShape<TLFrameShape>({ id: ids.frame1, type: 'frame', props: { w: 100, h: 100 } })
552
- editor.createShape<TLGeoShape>({
551
+ editor.createShape({ id: ids.frame1, type: 'frame', props: { w: 100, h: 100 } })
552
+ editor.createShape({
553
553
  id: ids.box1,
554
554
  parentId: ids.frame1,
555
555
  type: 'geo',
@@ -703,15 +703,15 @@ describe('when a frame has multiple children', () => {
703
703
  let box2: TLGeoShape
704
704
  beforeEach(() => {
705
705
  editor
706
- .createShape<TLFrameShape>({ id: ids.frame1, type: 'frame', props: { w: 100, h: 100 } })
707
- .createShape<TLGeoShape>({
706
+ .createShape({ id: ids.frame1, type: 'frame', props: { w: 100, h: 100 } })
707
+ .createShape({
708
708
  id: ids.box1,
709
709
  parentId: ids.frame1,
710
710
  type: 'geo',
711
711
  x: 25,
712
712
  y: 25,
713
713
  })
714
- .createShape<TLGeoShape>({
714
+ .createShape({
715
715
  id: ids.box2,
716
716
  parentId: ids.frame1,
717
717
  type: 'geo',
@@ -849,7 +849,7 @@ describe('When shapes are overlapping', () => {
849
849
  let box4: TLGeoShape
850
850
  let box5: TLGeoShape
851
851
  beforeEach(() => {
852
- editor.createShapes<TLGeoShape>([
852
+ editor.createShapes([
853
853
  {
854
854
  id: ids.box1,
855
855
  type: 'geo',
@@ -470,7 +470,7 @@ describe('When interacting with a shape...', () => {
470
470
  })
471
471
 
472
472
  it('Fires handle dragging cancel events', () => {
473
- const util = editor.getShapeUtil<TLLineShape>('line')
473
+ const util = editor.getShapeUtil('line')
474
474
 
475
475
  const calls: string[] = []
476
476
 
@@ -88,7 +88,7 @@ describe('Editor.styles', () => {
88
88
  })
89
89
 
90
90
  it('should return mixed for all mixed styles', () => {
91
- editor.updateShapes<TLGeoShape>([
91
+ editor.updateShapes([
92
92
  {
93
93
  id: defaultShapesIds.box1,
94
94
  type: 'geo',
@@ -1,4 +1,4 @@
1
- import { TLGeoShape, createShapeId, toRichText } from '@tldraw/editor'
1
+ import { createShapeId, toRichText } from '@tldraw/editor'
2
2
  import { TestEditor } from './TestEditor'
3
3
 
4
4
  let editor: TestEditor
@@ -14,7 +14,7 @@ afterEach(() => {
14
14
  it("When changing the style of a geo shape, if the text label is empty, don't measure it", () => {
15
15
  const id = createShapeId()
16
16
 
17
- editor.createShapes<TLGeoShape>([
17
+ editor.createShapes([
18
18
  {
19
19
  id,
20
20
  type: 'geo',
@@ -29,7 +29,7 @@ it("When changing the style of a geo shape, if the text label is empty, don't me
29
29
 
30
30
  const boundsBefore = editor.getShapeGeometry(id).bounds
31
31
 
32
- editor.updateShapes<TLGeoShape>([
32
+ editor.updateShapes([
33
33
  {
34
34
  id,
35
35
  type: 'geo',
@@ -43,7 +43,7 @@ it("When changing the style of a geo shape, if the text label is empty, don't me
43
43
  it('When changing the style of a geo shape, if the text label has text, measure it and possibly update the size', () => {
44
44
  const id = createShapeId()
45
45
 
46
- editor.createShapes<TLGeoShape>([
46
+ editor.createShapes([
47
47
  {
48
48
  id,
49
49
  type: 'geo',
@@ -58,7 +58,7 @@ it('When changing the style of a geo shape, if the text label has text, measure
58
58
 
59
59
  const boundsBefore = editor.getShapeGeometry(id).bounds!
60
60
 
61
- editor.updateShapes<TLGeoShape>([
61
+ editor.updateShapes([
62
62
  {
63
63
  id,
64
64
  type: 'geo',