tldraw 3.16.0-canary.ffdf566dd0a8 → 3.16.0-internal.a478398270c6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/dist-cjs/index.d.ts +19 -125
  2. package/dist-cjs/index.js +2 -19
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawImage.js +2 -5
  5. package/dist-cjs/lib/TldrawImage.js.map +3 -3
  6. package/dist-cjs/lib/canvas/TldrawCropHandles.js +1 -1
  7. package/dist-cjs/lib/canvas/TldrawCropHandles.js.map +2 -2
  8. package/dist-cjs/lib/canvas/TldrawHandles.js +1 -1
  9. package/dist-cjs/lib/canvas/TldrawHandles.js.map +2 -2
  10. package/dist-cjs/lib/canvas/TldrawOverlays.js +1 -1
  11. package/dist-cjs/lib/canvas/TldrawOverlays.js.map +2 -2
  12. package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +271 -279
  13. package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
  14. package/dist-cjs/lib/defaultExternalContentHandlers.js +0 -1
  15. package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
  16. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +41 -24
  17. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
  18. package/dist-cjs/lib/shapes/arrow/arrowLabel.js +4 -16
  19. package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
  20. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +1 -1
  21. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
  22. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +0 -3
  23. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
  24. package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +3 -0
  25. package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
  26. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +5 -5
  27. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
  28. package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +3 -0
  29. package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
  30. package/dist-cjs/lib/shapes/line/LineShapeUtil.js +4 -15
  31. package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
  32. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +1 -2
  33. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
  34. package/dist-cjs/lib/shapes/shared/PathBuilder.js +3 -21
  35. package/dist-cjs/lib/shapes/shared/PathBuilder.js.map +2 -2
  36. package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +0 -1
  37. package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
  38. package/dist-cjs/lib/shapes/shared/RichTextLabel.js +2 -5
  39. package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
  40. package/dist-cjs/lib/shapes/shared/SvgTextLabel.js +3 -4
  41. package/dist-cjs/lib/shapes/shared/SvgTextLabel.js.map +2 -2
  42. package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +1 -10
  43. package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
  44. package/dist-cjs/lib/shapes/text/TextShapeUtil.js +11 -5
  45. package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
  46. package/dist-cjs/lib/styles.js.map +2 -2
  47. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js +1 -7
  48. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js.map +2 -2
  49. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +22 -43
  50. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
  51. package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +15 -2
  52. package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
  53. package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +0 -5
  54. package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
  55. package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +0 -8
  56. package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
  57. package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +0 -8
  58. package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
  59. package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +0 -8
  60. package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
  61. package/dist-cjs/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.js.map +2 -2
  62. package/dist-cjs/lib/ui/assetUrls.js +13 -10
  63. package/dist-cjs/lib/ui/assetUrls.js.map +2 -2
  64. package/dist-cjs/lib/ui/components/A11y.js +12 -14
  65. package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
  66. package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +1 -51
  67. package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
  68. package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +2 -3
  69. package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
  70. package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +4 -3
  71. package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
  72. package/dist-cjs/lib/ui/components/Spinner.js +25 -2
  73. package/dist-cjs/lib/ui/components/Spinner.js.map +2 -2
  74. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +0 -2
  75. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
  76. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +136 -168
  77. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
  78. package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js +7 -21
  79. package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js.map +3 -3
  80. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +3 -3
  81. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
  82. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +2 -3
  83. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
  84. package/dist-cjs/lib/ui/components/menu-items.js +0 -22
  85. package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
  86. package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButtonIcon.js.map +2 -2
  87. package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +0 -2
  88. package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +2 -2
  89. package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js +1 -1
  90. package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js.map +2 -2
  91. package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js +1 -35
  92. package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js.map +2 -2
  93. package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +2 -6
  94. package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
  95. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +3 -12
  96. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
  97. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
  98. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +2 -0
  99. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
  100. package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +2 -3
  101. package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
  102. package/dist-cjs/lib/ui/context/actions.js +8 -57
  103. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  104. package/dist-cjs/lib/ui/context/events.js.map +2 -2
  105. package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
  106. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +2 -2
  107. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
  108. package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
  109. package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
  110. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +0 -11
  111. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
  112. package/dist-cjs/lib/ui/kbd-utils.js +1 -2
  113. package/dist-cjs/lib/ui/kbd-utils.js.map +2 -2
  114. package/dist-cjs/lib/ui/version.js +3 -3
  115. package/dist-cjs/lib/ui/version.js.map +1 -1
  116. package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js +1 -1
  117. package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
  118. package/dist-cjs/lib/utils/tldr/buildFromV1Document.js +2 -3
  119. package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
  120. package/dist-esm/index.d.mts +19 -125
  121. package/dist-esm/index.mjs +4 -33
  122. package/dist-esm/index.mjs.map +2 -2
  123. package/dist-esm/lib/TldrawImage.mjs +2 -5
  124. package/dist-esm/lib/TldrawImage.mjs.map +2 -2
  125. package/dist-esm/lib/canvas/TldrawCropHandles.mjs +1 -1
  126. package/dist-esm/lib/canvas/TldrawCropHandles.mjs.map +2 -2
  127. package/dist-esm/lib/canvas/TldrawHandles.mjs +1 -1
  128. package/dist-esm/lib/canvas/TldrawHandles.mjs.map +2 -2
  129. package/dist-esm/lib/canvas/TldrawOverlays.mjs +1 -1
  130. package/dist-esm/lib/canvas/TldrawOverlays.mjs.map +2 -2
  131. package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +271 -279
  132. package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
  133. package/dist-esm/lib/defaultExternalContentHandlers.mjs +0 -1
  134. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  135. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +41 -26
  136. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
  137. package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +5 -19
  138. package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
  139. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +1 -1
  140. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
  141. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +0 -3
  142. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
  143. package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +3 -0
  144. package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
  145. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +5 -5
  146. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
  147. package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +3 -0
  148. package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
  149. package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +4 -15
  150. package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
  151. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +1 -2
  152. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
  153. package/dist-esm/lib/shapes/shared/PathBuilder.mjs +3 -22
  154. package/dist-esm/lib/shapes/shared/PathBuilder.mjs.map +2 -2
  155. package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +0 -1
  156. package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
  157. package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +2 -5
  158. package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
  159. package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs +3 -4
  160. package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs.map +2 -2
  161. package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +1 -10
  162. package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
  163. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +11 -5
  164. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
  165. package/dist-esm/lib/styles.mjs.map +2 -2
  166. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs +1 -7
  167. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs.map +2 -2
  168. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +22 -43
  169. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
  170. package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +15 -2
  171. package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
  172. package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +0 -5
  173. package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
  174. package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +0 -8
  175. package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
  176. package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +0 -8
  177. package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
  178. package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +0 -8
  179. package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
  180. package/dist-esm/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.mjs.map +2 -2
  181. package/dist-esm/lib/ui/assetUrls.mjs +13 -10
  182. package/dist-esm/lib/ui/assetUrls.mjs.map +2 -2
  183. package/dist-esm/lib/ui/components/A11y.mjs +12 -14
  184. package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
  185. package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +1 -51
  186. package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
  187. package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +3 -3
  188. package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
  189. package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +4 -3
  190. package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
  191. package/dist-esm/lib/ui/components/Spinner.mjs +26 -3
  192. package/dist-esm/lib/ui/components/Spinner.mjs.map +2 -2
  193. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +1 -3
  194. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
  195. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +136 -168
  196. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
  197. package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs +9 -23
  198. package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs.map +3 -3
  199. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +3 -3
  200. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
  201. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +2 -3
  202. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
  203. package/dist-esm/lib/ui/components/menu-items.mjs +0 -22
  204. package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
  205. package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButtonIcon.mjs.map +2 -2
  206. package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +0 -2
  207. package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
  208. package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs +1 -1
  209. package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs.map +2 -2
  210. package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs +2 -36
  211. package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs.map +2 -2
  212. package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +2 -6
  213. package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
  214. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +3 -12
  215. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
  216. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
  217. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +2 -0
  218. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
  219. package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +2 -3
  220. package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
  221. package/dist-esm/lib/ui/context/actions.mjs +8 -57
  222. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  223. package/dist-esm/lib/ui/context/events.mjs.map +2 -2
  224. package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
  225. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +2 -2
  226. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
  227. package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
  228. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +0 -11
  229. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
  230. package/dist-esm/lib/ui/kbd-utils.mjs +1 -2
  231. package/dist-esm/lib/ui/kbd-utils.mjs.map +2 -2
  232. package/dist-esm/lib/ui/version.mjs +3 -3
  233. package/dist-esm/lib/ui/version.mjs.map +1 -1
  234. package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs +1 -1
  235. package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
  236. package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs +2 -3
  237. package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
  238. package/package.json +3 -4
  239. package/src/index.ts +2 -24
  240. package/src/lib/TldrawImage.tsx +2 -6
  241. package/src/lib/canvas/TldrawCropHandles.tsx +1 -3
  242. package/src/lib/canvas/TldrawHandles.tsx +1 -5
  243. package/src/lib/canvas/TldrawOverlays.tsx +1 -1
  244. package/src/lib/canvas/TldrawSelectionForeground.tsx +1 -5
  245. package/src/lib/defaultExternalContentHandlers.ts +1 -2
  246. package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +5 -5
  247. package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +43 -26
  248. package/src/lib/shapes/arrow/arrowLabel.ts +3 -23
  249. package/src/lib/shapes/arrow/arrowTargetState.ts +1 -2
  250. package/src/lib/shapes/arrow/toolStates/Pointing.tsx +0 -3
  251. package/src/lib/shapes/draw/DrawShapeUtil.tsx +4 -0
  252. package/src/lib/shapes/frame/FrameShapeUtil.tsx +7 -5
  253. package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +3 -0
  254. package/src/lib/shapes/line/LineShapeUtil.tsx +5 -19
  255. package/src/lib/shapes/note/NoteShapeUtil.tsx +0 -1
  256. package/src/lib/shapes/shared/PathBuilder.test.tsx +1 -1
  257. package/src/lib/shapes/shared/PathBuilder.tsx +1 -35
  258. package/src/lib/shapes/shared/PlainTextLabel.tsx +0 -1
  259. package/src/lib/shapes/shared/RichTextLabel.tsx +0 -4
  260. package/src/lib/shapes/shared/SvgTextLabel.tsx +2 -4
  261. package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +1 -11
  262. package/src/lib/shapes/text/TextShapeUtil.tsx +12 -5
  263. package/src/lib/styles.tsx +1 -3
  264. package/src/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.ts +1 -8
  265. package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +30 -54
  266. package/src/lib/tools/SelectTool/childStates/Idle.ts +24 -2
  267. package/src/lib/tools/SelectTool/childStates/PointingShape.ts +0 -7
  268. package/src/lib/tools/SelectTool/childStates/Resizing.ts +1 -12
  269. package/src/lib/tools/SelectTool/childStates/Rotating.ts +0 -11
  270. package/src/lib/tools/SelectTool/childStates/Translating.ts +0 -11
  271. package/src/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.ts +0 -1
  272. package/src/lib/ui/assetUrls.ts +13 -10
  273. package/src/lib/ui/components/A11y.tsx +13 -15
  274. package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +0 -40
  275. package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +2 -4
  276. package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +4 -3
  277. package/src/lib/ui/components/Spinner.tsx +24 -2
  278. package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +1 -3
  279. package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +127 -171
  280. package/src/lib/ui/components/Toolbar/DefaultImageToolbar.tsx +9 -25
  281. package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +3 -3
  282. package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +12 -17
  283. package/src/lib/ui/components/menu-items.tsx +0 -25
  284. package/src/lib/ui/components/primitives/Button/TldrawUiButtonIcon.tsx +2 -2
  285. package/src/lib/ui/components/primitives/TldrawUiButtonPicker.tsx +0 -2
  286. package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +1 -1
  287. package/src/lib/ui/components/primitives/TldrawUiIcon.tsx +3 -41
  288. package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +1 -6
  289. package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +3 -24
  290. package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +2 -2
  291. package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +4 -3
  292. package/src/lib/ui/context/TldrawUiContextProvider.tsx +20 -23
  293. package/src/lib/ui/context/actions.tsx +9 -59
  294. package/src/lib/ui/context/events.tsx +2 -5
  295. package/src/lib/ui/hooks/menu-hooks.ts +0 -1
  296. package/src/lib/ui/hooks/useKeyboardShortcuts.ts +2 -3
  297. package/src/lib/ui/hooks/useTools.tsx +1 -2
  298. package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +0 -11
  299. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +0 -11
  300. package/src/lib/ui/kbd-utils.ts +1 -2
  301. package/src/lib/ui/version.ts +3 -3
  302. package/src/lib/ui.css +23 -65
  303. package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +2 -16
  304. package/src/lib/utils/excalidraw/putExcalidrawContent.ts +1 -1
  305. package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +3 -24
  306. package/src/lib/utils/tldr/buildFromV1Document.ts +1 -2
  307. package/src/test/Editor.test.tsx +1 -1
  308. package/src/test/SelectTool.test.ts +11 -37
  309. package/src/test/arrows-megabus.test.tsx +6 -12
  310. package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +2 -2
  311. package/src/test/commands/deletePage.test.ts +1 -84
  312. package/src/test/groups.test.tsx +1 -1
  313. package/src/test/navigation.test.ts +0 -254
  314. package/src/test/shapeutils.test.ts +45 -394
  315. package/src/test/translating.test.ts +1 -1
  316. package/tldraw.css +50 -88
  317. package/dist-cjs/lib/ui/components/AccessibilityMenu.js +0 -35
  318. package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +0 -7
  319. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +0 -267
  320. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +0 -7
  321. package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +0 -19
  322. package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +0 -7
  323. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +0 -237
  324. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +0 -7
  325. package/src/lib/ui/components/AccessibilityMenu.tsx +0 -20
  326. package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +0 -313
  327. package/src/test/inner-outer-margin.test.ts +0 -315
@@ -32,14 +32,12 @@ import {
32
32
  debugFlags,
33
33
  exhaustiveSwitchError,
34
34
  getDefaultColorTheme,
35
- getFontsFromRichText,
36
35
  invLerp,
37
36
  lerp,
38
37
  mapObjectMapValues,
39
38
  maybeSnapToGrid,
40
39
  structuredClone,
41
40
  toDomPrecision,
42
- toRichText,
43
41
  track,
44
42
  useEditor,
45
43
  useIsEditing,
@@ -48,11 +46,12 @@ import {
48
46
  } from '@tldraw/editor'
49
47
  import React, { useMemo } from 'react'
50
48
  import { updateArrowTerminal } from '../../bindings/arrow/ArrowBindingUtil'
51
- import { isEmptyRichText, renderPlaintextFromRichText } from '../../utils/text/richText'
52
49
  import { PathBuilder } from '../shared/PathBuilder'
53
- import { RichTextLabel, RichTextSVG } from '../shared/RichTextLabel'
50
+ import { PlainTextLabel } from '../shared/PlainTextLabel'
54
51
  import { ShapeFill } from '../shared/ShapeFill'
52
+ import { SvgTextLabel } from '../shared/SvgTextLabel'
55
53
  import { ARROW_LABEL_PADDING, STROKE_SIZES, TEXT_PROPS } from '../shared/default-shape-constants'
54
+ import { DefaultFontFaces } from '../shared/defaultFonts'
56
55
  import { getFillDefForCanvas, getFillDefForExport } from '../shared/defaultStyleDefs'
57
56
  import { useDefaultColorTheme } from '../shared/useDefaultColorTheme'
58
57
  import { getArrowBodyPath, getArrowHandlePath } from './ArrowPath'
@@ -131,6 +130,10 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
131
130
  override canSnap() {
132
131
  return false
133
132
  }
133
+ override canTabTo(shape: TLArrowShape) {
134
+ const bindings = getArrowBindings(this.editor, shape)
135
+ return !!(bindings.start || bindings.end || shape.props.text)
136
+ }
134
137
  override hideResizeHandles() {
135
138
  return true
136
139
  }
@@ -157,13 +160,8 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
157
160
  }
158
161
 
159
162
  override getFontFaces(shape: TLArrowShape) {
160
- if (isEmptyRichText(shape.props.richText)) return EMPTY_ARRAY
161
-
162
- return getFontsFromRichText(this.editor, shape.props.richText, {
163
- family: `tldraw_${shape.props.font}`,
164
- weight: 'normal',
165
- style: 'normal',
166
- })
163
+ if (!shape.props.text) return EMPTY_ARRAY
164
+ return [DefaultFontFaces[`tldraw_${shape.props.font}`].normal.normal]
167
165
  }
168
166
 
169
167
  override getDefaultProps(): TLArrowShape['props'] {
@@ -180,7 +178,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
180
178
  end: { x: 2, y: 0 },
181
179
  arrowheadStart: 'none',
182
180
  arrowheadEnd: 'arrow',
183
- richText: toRichText(''),
181
+ text: '',
184
182
  labelPosition: 0.5,
185
183
  font: 'draw',
186
184
  scale: 1,
@@ -210,7 +208,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
210
208
  : new Polyline2d({ points: info.route.points })
211
209
 
212
210
  let labelGeom
213
- if (isEditing || !isEmptyRichText(shape.props.richText)) {
211
+ if (isEditing || shape.props.text.trim()) {
214
212
  const labelPosition = getArrowLabelPosition(this.editor, shape)
215
213
  if (debugFlags.debugGeometry.get()) {
216
214
  debugGeom.push(...labelPosition.debugGeom)
@@ -282,7 +280,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
282
280
  }
283
281
 
284
282
  override getText(shape: TLArrowShape) {
285
- return renderPlaintextFromRichText(this.editor, shape.props.richText)
283
+ return shape.props.text
286
284
  }
287
285
 
288
286
  override onHandleDrag(shape: TLArrowShape, info: TLHandleDragInfo<TLArrowShape>) {
@@ -763,7 +761,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
763
761
  const labelPosition = getArrowLabelPosition(this.editor, shape)
764
762
  const isSelected = shape.id === this.editor.getOnlySelectedShapeId()
765
763
  const isEditing = this.editor.getEditingShapeId() === shape.id
766
- const showArrowLabel = isEditing || !isEmptyRichText(shape.props.richText)
764
+ const showArrowLabel = isEditing || shape.props.text
767
765
 
768
766
  return (
769
767
  <>
@@ -777,15 +775,16 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
777
775
  )}
778
776
  </SVGContainer>
779
777
  {showArrowLabel && (
780
- <RichTextLabel
778
+ <PlainTextLabel
781
779
  shapeId={shape.id}
780
+ classNamePrefix="tl-arrow"
782
781
  type="arrow"
783
782
  font={shape.props.font}
784
783
  fontSize={getArrowLabelFontSize(shape)}
785
784
  lineHeight={TEXT_PROPS.lineHeight}
786
785
  align="middle"
787
786
  verticalAlign="middle"
788
- richText={shape.props.richText}
787
+ text={shape.props.text}
789
788
  labelColor={theme[shape.props.labelColor].solid}
790
789
  textWidth={labelPosition.box.w - ARROW_LABEL_PADDING * 2 * shape.props.scale}
791
790
  isSelected={isSelected}
@@ -811,9 +810,9 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
811
810
  const { start, end } = getArrowTerminalsInArrowSpace(this.editor, shape, info?.bindings)
812
811
  const geometry = this.editor.getShapeGeometry<Group2d>(shape)
813
812
  const bounds = geometry.bounds
814
- const isEmpty = isEmptyRichText(shape.props.richText)
815
813
 
816
- const labelGeometry = isEditing || !isEmpty ? (geometry.children[1] as Rectangle2d) : null
814
+ const labelGeometry =
815
+ isEditing || shape.props.text.trim() ? (geometry.children[1] as Rectangle2d) : null
817
816
 
818
817
  if (Vec.Equals(start, end)) return null
819
818
 
@@ -852,7 +851,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
852
851
  <defs>
853
852
  <ArrowClipPath
854
853
  radius={3.5 * shape.props.scale}
855
- hasText={!isEmpty}
854
+ hasText={shape.props.text.trim().length > 0}
856
855
  bounds={bounds}
857
856
  labelBounds={labelBounds}
858
857
  as={clipStartArrowhead && as ? as : ''}
@@ -910,7 +909,7 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
910
909
  }
911
910
 
912
911
  override onEditStart(shape: TLArrowShape) {
913
- if (isEmptyRichText(shape.props.richText)) {
912
+ if (shape.props.text.trim() === '') {
914
913
  // editing text for the first time, so set the position to the default:
915
914
  const labelPosition = getArrowLabelDefaultPosition(this.editor, shape)
916
915
  this.editor.updateShape<TLArrowShape>({
@@ -921,6 +920,26 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
921
920
  }
922
921
  }
923
922
 
923
+ override onEditEnd(shape: TLArrowShape) {
924
+ const {
925
+ id,
926
+ type,
927
+ props: { text },
928
+ } = shape
929
+
930
+ if (text.trimEnd() !== shape.props.text) {
931
+ this.editor.updateShapes<TLArrowShape>([
932
+ {
933
+ id,
934
+ type,
935
+ props: {
936
+ text: text.trimEnd(),
937
+ },
938
+ },
939
+ ])
940
+ }
941
+ }
942
+
924
943
  override toSvg(shape: TLArrowShape, ctx: SvgExportContext) {
925
944
  ctx.addExportDef(getFillDefForExport(shape.props.fill))
926
945
  const theme = getDefaultColorTheme(ctx)
@@ -929,18 +948,17 @@ export class ArrowShapeUtil extends ShapeUtil<TLArrowShape> {
929
948
  return (
930
949
  <g transform={`scale(${scaleFactor})`}>
931
950
  <ArrowSvg shape={shape} shouldDisplayHandles={false} />
932
- <RichTextSVG
951
+ <SvgTextLabel
933
952
  fontSize={getArrowLabelFontSize(shape)}
934
953
  font={shape.props.font}
935
954
  align="middle"
936
955
  verticalAlign="middle"
937
- richText={shape.props.richText}
956
+ text={shape.props.text}
938
957
  labelColor={theme[shape.props.labelColor].solid}
939
958
  bounds={getArrowLabelPosition(this.editor, shape)
940
959
  .box.clone()
941
960
  .expandBy(-ARROW_LABEL_PADDING * shape.props.scale)}
942
961
  padding={0}
943
- showTextOutline={true}
944
962
  />
945
963
  </g>
946
964
  )
@@ -1016,7 +1034,6 @@ const ArrowSvg = track(function ArrowSvg({
1016
1034
  if (!geometry) return null
1017
1035
  const bounds = Box.ZeroFix(geometry.bounds)
1018
1036
  const bindings = getArrowBindings(editor, shape)
1019
- const isEmpty = isEmptyRichText(shape.props.richText)
1020
1037
 
1021
1038
  if (!info?.isValid) return null
1022
1039
 
@@ -1067,7 +1084,7 @@ const ArrowSvg = track(function ArrowSvg({
1067
1084
  <clipPath id={clipPathId}>
1068
1085
  <ArrowClipPath
1069
1086
  radius={3.5 * shape.props.scale}
1070
- hasText={isEditing || !isEmpty}
1087
+ hasText={isEditing || shape.props.text.trim().length > 0}
1071
1088
  bounds={bounds}
1072
1089
  labelBounds={labelPosition.box}
1073
1090
  as={clipStartArrowhead && as ? as : ''}
@@ -9,17 +9,13 @@ import {
9
9
  Polygon2d,
10
10
  Polyline2d,
11
11
  TLArrowShape,
12
- TLShape,
13
12
  Vec,
14
13
  VecLike,
15
14
  clamp,
16
15
  createComputedCache,
17
16
  exhaustiveSwitchError,
18
17
  getChangedKeys,
19
- pointInPolygon,
20
- toRichText,
21
18
  } from '@tldraw/editor'
22
- import { isEmptyRichText, renderHtmlFromRichTextForMeasurement } from '../../utils/text/richText'
23
19
  import {
24
20
  ARROW_LABEL_FONT_SIZES,
25
21
  ARROW_LABEL_PADDING,
@@ -63,18 +59,14 @@ const labelSizeCache = createComputedCache(
63
59
 
64
60
  const bodyGeom = getArrowBodyGeometry(editor, shape)
65
61
  // We use 'i' as a default label to measure against as a minimum width.
66
- const isEmpty = isEmptyRichText(shape.props.richText)
67
- const html = renderHtmlFromRichTextForMeasurement(
68
- editor,
69
- isEmpty ? toRichText('i') : shape.props.richText
70
- )
62
+ const text = shape.props.text || 'i'
71
63
 
72
64
  const bodyBounds = bodyGeom.bounds
73
65
 
74
66
  const fontSize = getArrowLabelFontSize(shape)
75
67
 
76
68
  // First we measure the text with no constraints
77
- const { w, h } = editor.textMeasure.measureHtml(html, {
69
+ const { w, h } = editor.textMeasure.measureText(text, {
78
70
  ...TEXT_PROPS,
79
71
  fontFamily: FONT_FAMILIES[shape.props.font],
80
72
  fontSize,
@@ -104,7 +96,7 @@ const labelSizeCache = createComputedCache(
104
96
  }
105
97
 
106
98
  if (shouldSquish) {
107
- const { w: squishedWidth, h: squishedHeight } = editor.textMeasure.measureHtml(html, {
99
+ const { w: squishedWidth, h: squishedHeight } = editor.textMeasure.measureText(text, {
108
100
  ...TEXT_PROPS,
109
101
  fontFamily: FONT_FAMILIES[shape.props.font],
110
102
  fontSize,
@@ -300,15 +292,3 @@ export function getArrowLabelDefaultPosition(editor: Editor, shape: TLArrowShape
300
292
  exhaustiveSwitchError(info, 'type')
301
293
  }
302
294
  }
303
-
304
- /** @internal */
305
- export function isOverArrowLabel(editor: Editor, shape: TLShape) {
306
- if (!editor.isShapeOfType<TLArrowShape>(shape, 'arrow')) return false
307
-
308
- const pointInShapeSpace = editor.getPointInShapeSpace(shape, editor.inputs.currentPagePoint)
309
- // How should we handle multiple labels? Do shapes ever have multiple labels?
310
- const labelGeometry = editor.getShapeGeometry<Group2d>(shape).children[1]
311
- // Knowing what we know about arrows... if the shape has no text in its label,
312
- // then the label geometry should not be there.
313
- return labelGeometry && pointInPolygon(pointInShapeSpace, labelGeometry.vertices)
314
- }
@@ -94,7 +94,7 @@ export function updateArrowTargetState({
94
94
  const target = editor.getShapeAtPoint(pointInPageSpace, {
95
95
  hitInside: true,
96
96
  hitFrameInside: true,
97
- margin: arrowKind === 'elbow' ? 8 : [8, 0],
97
+ margin: arrowKind === 'elbow' ? 8 : 0,
98
98
  filter: (targetShape) => {
99
99
  return (
100
100
  !targetShape.isLocked &&
@@ -187,7 +187,6 @@ export function updateArrowTargetState({
187
187
  }
188
188
 
189
189
  const shouldSnapCenter = !isExact && precise && targetGeometryInTargetSpace.isClosed
190
- // const shouldSnapEdges = !isExact && (precise || !targetGeometryInTargetSpace.isClosed)
191
190
  const shouldSnapEdges =
192
191
  !isExact && ((precise && arrowKind === 'elbow') || !targetGeometryInTargetSpace.isClosed)
193
192
  const shouldSnapEdgePoints =
@@ -118,7 +118,6 @@ export class Pointing extends StateNode {
118
118
  const change = util.onHandleDrag?.(shape, {
119
119
  handle: { ...startHandle, x: 0, y: 0 },
120
120
  isPrecise: true,
121
- isCreatingShape: true,
122
121
  initial: initial,
123
122
  })
124
123
 
@@ -146,7 +145,6 @@ export class Pointing extends StateNode {
146
145
  const change = util.onHandleDrag?.(shape, {
147
146
  handle: { ...startHandle, x: 0, y: 0 },
148
147
  isPrecise: this.isPrecise,
149
- isCreatingShape: true,
150
148
  initial: initial,
151
149
  })
152
150
 
@@ -164,7 +162,6 @@ export class Pointing extends StateNode {
164
162
  const change = util.onHandleDrag?.(this.editor.getShape(shape)!, {
165
163
  handle: { ...endHandle, x: point.x, y: point.y },
166
164
  isPrecise: false,
167
- isCreatingShape: true,
168
165
  initial: initial,
169
166
  })
170
167
 
@@ -51,6 +51,10 @@ export class DrawShapeUtil extends ShapeUtil<TLDrawShape> {
51
51
  maxPointsPerShape: 600,
52
52
  }
53
53
 
54
+ override canTabTo() {
55
+ return false
56
+ }
57
+
54
58
  override hideResizeHandles(shape: TLDrawShape) {
55
59
  return getIsDot(shape)
56
60
  }
@@ -219,6 +219,9 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
219
219
  [shape.id]
220
220
  )
221
221
 
222
+ // eslint-disable-next-line react-hooks/rules-of-hooks
223
+ const zoomLevel = useValue('zoom level', () => this.editor.getZoomLevel(), [this.editor])
224
+
222
225
  const showFrameColors = this.options.showColors
223
226
 
224
227
  const color = theme[shape.props.color]
@@ -233,13 +236,12 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
233
236
  <SVGContainer>
234
237
  <rect
235
238
  className={classNames('tl-frame__body', { 'tl-frame__creating': isCreating })}
239
+ width={shape.props.w + 1 / zoomLevel}
240
+ height={shape.props.h + 1 / zoomLevel}
236
241
  fill={frameFill}
237
242
  stroke={frameStroke}
238
- style={{
239
- width: `calc(${shape.props.w}px + 1px / var(--tl-zoom))`,
240
- height: `calc(${shape.props.h}px + 1px / var(--tl-zoom))`,
241
- transform: `translate(calc(-0.5px / var(--tl-zoom)), calc(-0.5px / var(--tl-zoom)))`,
242
- }}
243
+ y={-0.5 / zoomLevel}
244
+ x={-0.5 / zoomLevel}
243
245
  />
244
246
  </SVGContainer>
245
247
  {isCreating ? null : (
@@ -51,6 +51,9 @@ export class HighlightShapeUtil extends ShapeUtil<TLHighlightShape> {
51
51
  overlayOpacity: 0.35,
52
52
  }
53
53
 
54
+ override canTabTo() {
55
+ return false
56
+ }
54
57
  override hideResizeHandles(shape: TLHighlightShape) {
55
58
  return getIsDot(shape)
56
59
  }
@@ -35,6 +35,9 @@ export class LineShapeUtil extends ShapeUtil<TLLineShape> {
35
35
  static override props = lineShapeProps
36
36
  static override migrations = lineShapeMigrations
37
37
 
38
+ override canTabTo() {
39
+ return false
40
+ }
38
41
  override hideResizeHandles() {
39
42
  return true
40
43
  }
@@ -145,6 +148,8 @@ export class LineShapeUtil extends ShapeUtil<TLLineShape> {
145
148
  }
146
149
 
147
150
  override onHandleDrag(shape: TLLineShape, { handle }: TLHandleDragInfo<TLLineShape>) {
151
+ // we should only ever be dragging vertex handles
152
+ if (handle.type !== 'vertex') return
148
153
  const newPoint = maybeSnapToGrid(new Vec(handle.x, handle.y), this.editor)
149
154
  return {
150
155
  ...shape,
@@ -158,25 +163,6 @@ export class LineShapeUtil extends ShapeUtil<TLLineShape> {
158
163
  }
159
164
  }
160
165
 
161
- override onHandleDragStart(shape: TLLineShape, { handle }: TLHandleDragInfo<TLLineShape>) {
162
- // For line shapes, if we're dragging a "create" handle, then
163
- // create a new vertex handle at that point; and make this handle
164
- // the handle that we're dragging.
165
- if (handle.type === 'create') {
166
- return {
167
- ...shape,
168
- props: {
169
- ...shape.props,
170
- points: {
171
- ...shape.props.points,
172
- [handle.index]: { id: handle.index, index: handle.index, x: handle.x, y: handle.y },
173
- },
174
- },
175
- }
176
- }
177
- return
178
- }
179
-
180
166
  component(shape: TLLineShape) {
181
167
  return (
182
168
  <SVGContainer style={{ minWidth: 50, minHeight: 50 }}>
@@ -346,7 +346,6 @@ export class NoteShapeUtil extends ShapeUtil<TLNoteShape> {
346
346
  labelColor={theme[shape.props.color].note.text}
347
347
  bounds={bounds}
348
348
  padding={LABEL_PADDING}
349
- showTextOutline={false}
350
349
  />
351
350
  )
352
351
 
@@ -138,7 +138,7 @@ describe('PathBuilder', () => {
138
138
  .toGeometry()
139
139
 
140
140
  expect(geometry?.toSimpleSvgPath()).toMatchInlineSnapshot(
141
- `"M0,0L100,100L100,0L84.92197106154207,-11.50593202657044L67.93757691512266,-18.409491194065584L50.000000178767834,-20.71067750830319L32.06242347050369,-18.409490975101022L15.078029408356239,-11.505931600276853L6.103515630684342e-7,6.103515559630068e-7L-11.505931600276849,15.078029408356231L-18.409490975101022,32.062423470503674L-20.710677508303192,50.00000017876782L-18.409491194065588,67.93757691512262L-11.50593202657045,84.92197106154204L-1.4210854715202004e-14,99.99999999999999L0,0Z"`
141
+ `"M0,0L100,100L100,0L91.23532468849007,-7.455843959357096L81.64709960511827,-13.25483368860933L71.44121219537817,-17.39696918901332L60.82354990476352,-19.882250461825734L50.000000178767834,-20.71067750830319L39.17645046288481,-19.882250329702327L28.558788202608024,-17.396968927279783L18.35290084343114,-13.254833302292194L8.764675830847777,-7.455843455996203L6.103515630684342e-7,6.103515559630068e-7L-7.4558434559962,8.764675830847771L-13.254833302292194,18.35290084343114L-17.396968927279772,28.55878820260801L-19.882250329702327,39.17645046288479L-20.710677508303192,50.00000017876782L-19.88225046182574,60.823549904763496L-17.39696918901333,71.44121219537817L-13.254833688609331,81.64709960511824L-7.455843959357106,91.23532468849007L-1.4210854715202004e-14,99.99999999999999L0,0Z"`
142
142
  )
143
143
  })
144
144
  })
@@ -10,7 +10,6 @@ import {
10
10
  Geometry2dFilters,
11
11
  Geometry2dOptions,
12
12
  getPerfectDashProps,
13
- getVerticesCountForArcLength,
14
13
  Group2d,
15
14
  modulate,
16
15
  PerfectDashTerminal,
@@ -122,7 +121,6 @@ export interface CubicBezierToPathBuilderCommand extends PathBuilderCommandBase
122
121
  type: 'cubic'
123
122
  cp1: VecModel
124
123
  cp2: VecModel
125
- resolution?: number
126
124
  }
127
125
 
128
126
  /** @internal */
@@ -319,17 +317,8 @@ export class PathBuilder {
319
317
  // Calculate the sweep angle
320
318
  const sweepAngle = endAngle - startAngle
321
319
 
322
- // Calculate the approximate arc length. General ellipse arc length is expensive - there's
323
- // no closed form solution, so we have to do iterative numerical approximation. As we only
324
- // use this to control the resolution of later approximations, let's cheat and just use the
325
- // circular arc length with the largest radius:
326
- const approximateArcLength = Math.max(rx1, ry1) * Math.abs(sweepAngle)
327
-
328
320
  // Approximate the arc using cubic bezier curves
329
321
  const numSegments = Math.min(4, Math.ceil(Math.abs(sweepAngle) / (Math.PI / 2)))
330
- const resolutionPerSegment = Math.ceil(
331
- getVerticesCountForArcLength(approximateArcLength) / numSegments
332
- )
333
322
  const anglePerSegment = sweepAngle / numSegments
334
323
 
335
324
  // Helper function to compute point on ellipse
@@ -375,16 +364,7 @@ export class PathBuilder {
375
364
  const cp2y = end.y - handleScale * d2.y
376
365
 
377
366
  const bezierOpts = i === 0 ? opts : { ...opts, mergeWithPrevious: true }
378
- this.cubicBezierToWithResolution(
379
- end.x,
380
- end.y,
381
- cp1x,
382
- cp1y,
383
- cp2x,
384
- cp2y,
385
- bezierOpts,
386
- resolutionPerSegment
387
- )
367
+ this.cubicBezierTo(end.x, end.y, cp1x, cp1y, cp2x, cp2y, bezierOpts)
388
368
  }
389
369
 
390
370
  return this
@@ -398,18 +378,6 @@ export class PathBuilder {
398
378
  cp2X: number,
399
379
  cp2Y: number,
400
380
  opts?: PathBuilderCommandOpts
401
- ) {
402
- return this.cubicBezierToWithResolution(x, y, cp1X, cp1Y, cp2X, cp2Y, opts)
403
- }
404
- private cubicBezierToWithResolution(
405
- x: number,
406
- y: number,
407
- cp1X: number,
408
- cp1Y: number,
409
- cp2X: number,
410
- cp2Y: number,
411
- opts?: PathBuilderCommandOpts,
412
- resolution?: number
413
381
  ) {
414
382
  this.assertHasMoveTo()
415
383
  this.commands.push({
@@ -420,7 +388,6 @@ export class PathBuilder {
420
388
  cp2: { x: cp2X, y: cp2Y },
421
389
  isClose: false,
422
390
  opts,
423
- resolution,
424
391
  })
425
392
  return this
426
393
  }
@@ -1005,7 +972,6 @@ export class PathBuilderGeometry2d extends Geometry2d {
1005
972
  cp1: Vec.From(command.cp1),
1006
973
  cp2: Vec.From(command.cp2),
1007
974
  end: Vec.From(command),
1008
- resolution: command.resolution,
1009
975
  })
1010
976
  )
1011
977
  break
@@ -81,7 +81,6 @@ export const PlainTextLabel = React.memo(function PlainTextLabel({
81
81
  return (
82
82
  <div
83
83
  className={`${cssPrefix}-label tl-text-wrapper tl-plain-text-wrapper`}
84
- aria-hidden={!isEditing}
85
84
  data-font={font}
86
85
  data-align={align}
87
86
  data-hastext={!isEmpty}
@@ -128,7 +128,6 @@ export const RichTextLabel = React.memo(function RichTextLabel({
128
128
  return (
129
129
  <div
130
130
  className={`${cssPrefix}-label tl-text-wrapper tl-rich-text-wrapper`}
131
- aria-hidden={!isEditing}
132
131
  data-font={font}
133
132
  data-align={align}
134
133
  data-hastext={!isEmpty}
@@ -194,7 +193,6 @@ export interface RichTextSVGProps {
194
193
  wrap?: boolean
195
194
  labelColor: string
196
195
  padding: number
197
- showTextOutline?: boolean
198
196
  }
199
197
 
200
198
  /**
@@ -212,7 +210,6 @@ export function RichTextSVG({
212
210
  wrap,
213
211
  labelColor,
214
212
  padding,
215
- showTextOutline = true,
216
213
  }: RichTextSVGProps) {
217
214
  const editor = useEditor()
218
215
  const html = renderHtmlFromRichText(editor, richText)
@@ -248,7 +245,6 @@ export function RichTextSVG({
248
245
  wordWrap: 'break-word' as const,
249
246
  overflowWrap: 'break-word' as const,
250
247
  whiteSpace: 'pre-wrap',
251
- textShadow: showTextOutline ? 'var(--tl-text-outline)' : 'none',
252
248
  }
253
249
 
254
250
  return (
@@ -21,7 +21,6 @@ export function SvgTextLabel({
21
21
  bounds,
22
22
  padding = 16,
23
23
  stroke = true,
24
- showTextOutline = true,
25
24
  }: {
26
25
  fontSize: number
27
26
  font: TLDefaultFontStyle
@@ -34,7 +33,6 @@ export function SvgTextLabel({
34
33
  bounds: Box
35
34
  padding?: number
36
35
  stroke?: boolean
37
- showTextOutline?: boolean
38
36
  }) {
39
37
  const editor = useEditor()
40
38
  const theme = useDefaultColorTheme()
@@ -70,10 +68,10 @@ export function SvgTextLabel({
70
68
  const mainSpans = createTextJsxFromSpans(editor, spans, opts)
71
69
 
72
70
  let outlineSpans = null
73
- if (showTextOutline && stroke) {
71
+ if (stroke) {
74
72
  opts.fill = theme.background
75
73
  opts.stroke = theme.background
76
- opts.strokeWidth = 3
74
+ opts.strokeWidth = 2
77
75
  outlineSpans = createTextJsxFromSpans(editor, spans, opts)
78
76
  }
79
77
 
@@ -1,20 +1,10 @@
1
- import { useMaybeEditor, useValue } from '@tldraw/editor'
2
1
  import { useEffect, useState } from 'react'
3
2
 
4
3
  /** @public */
5
4
  export function usePrefersReducedMotion() {
6
- const editor = useMaybeEditor()
7
- const animationSpeed = useValue('animationSpeed', () => editor?.user.getAnimationSpeed(), [
8
- editor,
9
- ])
10
5
  const [prefersReducedMotion, setPrefersReducedMotion] = useState(false)
11
6
 
12
7
  useEffect(() => {
13
- if (animationSpeed !== undefined) {
14
- setPrefersReducedMotion(animationSpeed === 0 ? true : false)
15
- return
16
- }
17
-
18
8
  if (typeof window === 'undefined' || !('matchMedia' in window)) return
19
9
  const mql = window.matchMedia('(prefers-reduced-motion: reduce)')
20
10
  const handler = () => {
@@ -23,7 +13,7 @@ export function usePrefersReducedMotion() {
23
13
  handler()
24
14
  mql.addEventListener('change', handler)
25
15
  return () => mql.removeEventListener('change', handler)
26
- }, [animationSpeed])
16
+ }, [])
27
17
 
28
18
  return prefersReducedMotion
29
19
  }
@@ -303,26 +303,33 @@ export class TextShapeUtil extends ShapeUtil<TLTextShape> {
303
303
  }
304
304
 
305
305
  function getTextSize(editor: Editor, props: TLTextShape['props']) {
306
- const { font, richText, size, w } = props
306
+ const { font, richText, autoSize, size, w } = props
307
307
 
308
- const minWidth = 16
308
+ const minWidth = autoSize ? 16 : Math.max(16, w)
309
309
  const fontSize = FONT_SIZES[size]
310
310
 
311
- const maybeFixedWidth = props.autoSize ? null : Math.max(minWidth, Math.floor(w))
311
+ const cw = autoSize
312
+ ? null
313
+ : // `measureText` floors the number so we need to do the same here to avoid issues.
314
+ Math.floor(Math.max(minWidth, w))
312
315
 
313
316
  const html = renderHtmlFromRichTextForMeasurement(editor, richText)
314
317
  const result = editor.textMeasure.measureHtml(html, {
315
318
  ...TEXT_PROPS,
316
319
  fontFamily: FONT_FAMILIES[font],
317
320
  fontSize: fontSize,
318
- maxWidth: maybeFixedWidth,
321
+ maxWidth: cw,
319
322
  })
320
323
 
321
324
  // If we're autosizing the measureText will essentially `Math.floor`
322
325
  // the numbers so `19` rather than `19.3`, this means we must +1 to
323
326
  // whatever we get to avoid wrapping.
327
+ if (autoSize) {
328
+ result.w += 1
329
+ }
330
+
324
331
  return {
325
- width: maybeFixedWidth ?? Math.max(minWidth, result.w + 1),
332
+ width: Math.max(minWidth, result.w),
326
333
  height: Math.max(fontSize, result.h),
327
334
  }
328
335
  }
@@ -1,9 +1,7 @@
1
- import { TLUiIconJsx } from './ui/components/primitives/TldrawUiIcon'
2
-
3
1
  /** @public */
4
2
  export type StyleValuesForUi<T> = readonly {
5
3
  readonly value: T
6
- readonly icon: string | TLUiIconJsx
4
+ readonly icon: string
7
5
  }[]
8
6
 
9
7
  // todo: default styles prop?
@@ -9,18 +9,11 @@ export class PointingCrop extends StateNode {
9
9
 
10
10
  override onPointerMove(info: TLPointerEventInfo) {
11
11
  if (this.editor.inputs.isDragging) {
12
- this.startDragging(info)
12
+ this.editor.setCurrentTool('select.crop.translating_crop', info)
13
13
  }
14
14
  }
15
- override onLongPress(info: TLPointerEventInfo) {
16
- this.startDragging(info)
17
- }
18
15
 
19
16
  override onPointerUp(info: TLPointerEventInfo) {
20
17
  this.editor.setCurrentTool('select.crop.idle', info)
21
18
  }
22
-
23
- startDragging(info: TLPointerEventInfo) {
24
- this.editor.setCurrentTool('select.crop.translating_crop', info)
25
- }
26
19
  }