tldraw 3.16.0-internal.51e99e128bd4 → 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 (517) hide show
  1. package/dist-cjs/index.d.ts +23 -297
  2. package/dist-cjs/index.js +2 -30
  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/TldrawScribble.js +1 -1
  13. package/dist-cjs/lib/canvas/TldrawScribble.js.map +2 -2
  14. package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +271 -279
  15. package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
  16. package/dist-cjs/lib/defaultExternalContentHandlers.js +0 -1
  17. package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
  18. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +44 -27
  19. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
  20. package/dist-cjs/lib/shapes/arrow/arrowLabel.js +4 -16
  21. package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
  22. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +1 -1
  23. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
  24. package/dist-cjs/lib/shapes/arrow/elbow/ElbowArrowDebug.js +3 -3
  25. package/dist-cjs/lib/shapes/arrow/elbow/ElbowArrowDebug.js.map +1 -1
  26. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +0 -3
  27. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
  28. package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +6 -3
  29. package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
  30. package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js +1 -1
  31. package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js.map +1 -1
  32. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +17 -17
  33. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
  34. package/dist-cjs/lib/shapes/frame/components/FrameHeading.js +1 -1
  35. package/dist-cjs/lib/shapes/frame/components/FrameHeading.js.map +2 -2
  36. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +2 -2
  37. package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
  38. package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js +1 -2
  39. package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js.map +2 -2
  40. package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +4 -5
  41. package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
  42. package/dist-cjs/lib/shapes/image/ImageShapeUtil.js +3 -3
  43. package/dist-cjs/lib/shapes/image/ImageShapeUtil.js.map +1 -1
  44. package/dist-cjs/lib/shapes/line/LineShapeUtil.js +5 -20
  45. package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
  46. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +5 -6
  47. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
  48. package/dist-cjs/lib/shapes/shared/PathBuilder.js +3 -21
  49. package/dist-cjs/lib/shapes/shared/PathBuilder.js.map +2 -2
  50. package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +0 -1
  51. package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
  52. package/dist-cjs/lib/shapes/shared/RichTextLabel.js +2 -5
  53. package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
  54. package/dist-cjs/lib/shapes/shared/ShapeFill.js +4 -4
  55. package/dist-cjs/lib/shapes/shared/ShapeFill.js.map +2 -2
  56. package/dist-cjs/lib/shapes/shared/SvgTextLabel.js +3 -4
  57. package/dist-cjs/lib/shapes/shared/SvgTextLabel.js.map +2 -2
  58. package/dist-cjs/lib/shapes/shared/freehand/svg.js.map +2 -2
  59. package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +1 -10
  60. package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
  61. package/dist-cjs/lib/shapes/text/TextShapeUtil.js +13 -7
  62. package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
  63. package/dist-cjs/lib/shapes/video/VideoShapeUtil.js +3 -3
  64. package/dist-cjs/lib/shapes/video/VideoShapeUtil.js.map +1 -1
  65. package/dist-cjs/lib/styles.js.map +2 -2
  66. package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js +1 -25
  67. package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
  68. package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js +0 -12
  69. package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js.map +2 -2
  70. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js +1 -7
  71. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js.map +2 -2
  72. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +22 -43
  73. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
  74. package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +15 -2
  75. package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
  76. package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +0 -5
  77. package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
  78. package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +0 -8
  79. package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
  80. package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +0 -8
  81. package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
  82. package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +0 -8
  83. package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
  84. package/dist-cjs/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.js.map +2 -2
  85. package/dist-cjs/lib/ui/TldrawUi.js +0 -14
  86. package/dist-cjs/lib/ui/TldrawUi.js.map +3 -3
  87. package/dist-cjs/lib/ui/components/A11y.js +12 -14
  88. package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
  89. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js +3 -12
  90. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js.map +2 -2
  91. package/dist-cjs/lib/ui/components/DefaultMenuPanel.js +2 -3
  92. package/dist-cjs/lib/ui/components/DefaultMenuPanel.js.map +2 -2
  93. package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +1 -51
  94. package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
  95. package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +2 -3
  96. package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
  97. package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js +4 -4
  98. package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js.map +2 -2
  99. package/dist-cjs/lib/ui/components/MobileStylePanel.js +3 -5
  100. package/dist-cjs/lib/ui/components/MobileStylePanel.js.map +2 -2
  101. package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +5 -4
  102. package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
  103. package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +1 -2
  104. package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
  105. package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js +2 -3
  106. package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js.map +2 -2
  107. package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js +2 -2
  108. package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js.map +2 -2
  109. package/dist-cjs/lib/ui/components/Spinner.js +25 -2
  110. package/dist-cjs/lib/ui/components/Spinner.js.map +2 -2
  111. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +0 -2
  112. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
  113. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +139 -171
  114. package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
  115. package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js +3 -3
  116. package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js.map +2 -2
  117. package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js +25 -26
  118. package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js.map +3 -3
  119. package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js +7 -21
  120. package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js.map +3 -3
  121. package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js +1 -1
  122. package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js.map +2 -2
  123. package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js +21 -66
  124. package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js.map +3 -3
  125. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +80 -189
  126. package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +3 -3
  127. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +4 -5
  128. package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
  129. package/dist-cjs/lib/ui/components/menu-items.js +0 -22
  130. package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
  131. package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButtonIcon.js.map +2 -2
  132. package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +16 -7
  133. package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +3 -3
  134. package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +1 -1
  135. package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
  136. package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js +1 -1
  137. package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js.map +2 -2
  138. package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js +1 -35
  139. package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js.map +2 -2
  140. package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js +2 -3
  141. package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js.map +3 -3
  142. package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +2 -6
  143. package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
  144. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +7 -31
  145. package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
  146. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
  147. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuContext.js.map +2 -2
  148. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js +12 -25
  149. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js.map +2 -2
  150. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +22 -154
  151. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
  152. package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +2 -3
  153. package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
  154. package/dist-cjs/lib/ui/context/actions.js +8 -57
  155. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  156. package/dist-cjs/lib/ui/context/events.js.map +2 -2
  157. package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
  158. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +2 -2
  159. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
  160. package/dist-cjs/lib/ui/hooks/useTools.js +9 -94
  161. package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
  162. package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
  163. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +0 -11
  164. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
  165. package/dist-cjs/lib/ui/kbd-utils.js +1 -2
  166. package/dist-cjs/lib/ui/kbd-utils.js.map +2 -2
  167. package/dist-cjs/lib/ui/version.js +3 -3
  168. package/dist-cjs/lib/ui/version.js.map +1 -1
  169. package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js +1 -1
  170. package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
  171. package/dist-cjs/lib/utils/tldr/buildFromV1Document.js +2 -3
  172. package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
  173. package/dist-esm/index.d.mts +23 -297
  174. package/dist-esm/index.mjs +4 -51
  175. package/dist-esm/index.mjs.map +2 -2
  176. package/dist-esm/lib/TldrawImage.mjs +2 -5
  177. package/dist-esm/lib/TldrawImage.mjs.map +2 -2
  178. package/dist-esm/lib/canvas/TldrawCropHandles.mjs +1 -1
  179. package/dist-esm/lib/canvas/TldrawCropHandles.mjs.map +2 -2
  180. package/dist-esm/lib/canvas/TldrawHandles.mjs +1 -1
  181. package/dist-esm/lib/canvas/TldrawHandles.mjs.map +2 -2
  182. package/dist-esm/lib/canvas/TldrawOverlays.mjs +1 -1
  183. package/dist-esm/lib/canvas/TldrawOverlays.mjs.map +2 -2
  184. package/dist-esm/lib/canvas/TldrawScribble.mjs +1 -1
  185. package/dist-esm/lib/canvas/TldrawScribble.mjs.map +2 -2
  186. package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +271 -279
  187. package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
  188. package/dist-esm/lib/defaultExternalContentHandlers.mjs +0 -1
  189. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  190. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +44 -30
  191. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
  192. package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +5 -19
  193. package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
  194. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +1 -1
  195. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
  196. package/dist-esm/lib/shapes/arrow/elbow/ElbowArrowDebug.mjs +3 -3
  197. package/dist-esm/lib/shapes/arrow/elbow/ElbowArrowDebug.mjs.map +1 -1
  198. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +0 -3
  199. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
  200. package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +6 -4
  201. package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
  202. package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs +1 -1
  203. package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs.map +1 -1
  204. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +17 -18
  205. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
  206. package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs +1 -1
  207. package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs.map +2 -2
  208. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +2 -3
  209. package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
  210. package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs +1 -2
  211. package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs.map +2 -2
  212. package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +4 -6
  213. package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
  214. package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs +3 -3
  215. package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs.map +1 -1
  216. package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +5 -21
  217. package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
  218. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +5 -7
  219. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
  220. package/dist-esm/lib/shapes/shared/PathBuilder.mjs +3 -22
  221. package/dist-esm/lib/shapes/shared/PathBuilder.mjs.map +2 -2
  222. package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +0 -1
  223. package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
  224. package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +2 -5
  225. package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
  226. package/dist-esm/lib/shapes/shared/ShapeFill.mjs +4 -5
  227. package/dist-esm/lib/shapes/shared/ShapeFill.mjs.map +2 -2
  228. package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs +3 -4
  229. package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs.map +2 -2
  230. package/dist-esm/lib/shapes/shared/freehand/svg.mjs.map +2 -2
  231. package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +1 -10
  232. package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
  233. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +13 -8
  234. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
  235. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs +3 -3
  236. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs.map +1 -1
  237. package/dist-esm/lib/styles.mjs.map +2 -2
  238. package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs +1 -26
  239. package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
  240. package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs +0 -13
  241. package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs.map +2 -2
  242. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs +1 -7
  243. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs.map +2 -2
  244. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +22 -43
  245. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
  246. package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +15 -2
  247. package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
  248. package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +0 -5
  249. package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
  250. package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +0 -8
  251. package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
  252. package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +0 -8
  253. package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
  254. package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +0 -8
  255. package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
  256. package/dist-esm/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.mjs.map +2 -2
  257. package/dist-esm/lib/ui/TldrawUi.mjs +2 -16
  258. package/dist-esm/lib/ui/TldrawUi.mjs.map +3 -3
  259. package/dist-esm/lib/ui/components/A11y.mjs +12 -14
  260. package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
  261. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs +3 -12
  262. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs.map +2 -2
  263. package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs +2 -3
  264. package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs.map +2 -2
  265. package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +1 -51
  266. package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
  267. package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +3 -3
  268. package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
  269. package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs +4 -4
  270. package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs.map +2 -2
  271. package/dist-esm/lib/ui/components/MobileStylePanel.mjs +3 -6
  272. package/dist-esm/lib/ui/components/MobileStylePanel.mjs.map +2 -2
  273. package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +5 -4
  274. package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
  275. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +1 -2
  276. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
  277. package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs +2 -3
  278. package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs.map +2 -2
  279. package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs +2 -2
  280. package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs.map +2 -2
  281. package/dist-esm/lib/ui/components/Spinner.mjs +26 -3
  282. package/dist-esm/lib/ui/components/Spinner.mjs.map +2 -2
  283. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +1 -3
  284. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
  285. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +139 -171
  286. package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
  287. package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs +3 -3
  288. package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs.map +2 -2
  289. package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs +25 -26
  290. package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs.map +2 -2
  291. package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs +9 -23
  292. package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs.map +3 -3
  293. package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs +1 -1
  294. package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs.map +2 -2
  295. package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs +21 -56
  296. package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs.map +2 -2
  297. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +81 -192
  298. package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +3 -3
  299. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +4 -5
  300. package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
  301. package/dist-esm/lib/ui/components/menu-items.mjs +0 -22
  302. package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
  303. package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButtonIcon.mjs.map +2 -2
  304. package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +6 -8
  305. package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
  306. package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +1 -1
  307. package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
  308. package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs +1 -1
  309. package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs.map +2 -2
  310. package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs +2 -36
  311. package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs.map +2 -2
  312. package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs +2 -3
  313. package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs.map +2 -2
  314. package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +2 -6
  315. package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
  316. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +7 -31
  317. package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
  318. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
  319. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuContext.mjs.map +2 -2
  320. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs +12 -25
  321. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs.map +2 -2
  322. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +24 -162
  323. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
  324. package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +2 -3
  325. package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
  326. package/dist-esm/lib/ui/context/actions.mjs +8 -57
  327. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  328. package/dist-esm/lib/ui/context/events.mjs.map +2 -2
  329. package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
  330. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +2 -2
  331. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
  332. package/dist-esm/lib/ui/hooks/useTools.mjs +10 -102
  333. package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
  334. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +0 -11
  335. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
  336. package/dist-esm/lib/ui/kbd-utils.mjs +1 -2
  337. package/dist-esm/lib/ui/kbd-utils.mjs.map +2 -2
  338. package/dist-esm/lib/ui/version.mjs +3 -3
  339. package/dist-esm/lib/ui/version.mjs.map +1 -1
  340. package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs +1 -1
  341. package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
  342. package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs +2 -3
  343. package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
  344. package/package.json +34 -12
  345. package/src/index.ts +2 -39
  346. package/src/lib/TldrawImage.tsx +2 -6
  347. package/src/lib/canvas/TldrawCropHandles.tsx +1 -3
  348. package/src/lib/canvas/TldrawHandles.tsx +1 -5
  349. package/src/lib/canvas/TldrawOverlays.tsx +1 -1
  350. package/src/lib/canvas/TldrawScribble.tsx +1 -1
  351. package/src/lib/canvas/TldrawSelectionForeground.tsx +1 -5
  352. package/src/lib/defaultExternalContentHandlers.ts +1 -2
  353. package/src/lib/shapes/arrow/ArrowShapeOptions.test.ts +1 -2
  354. package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +3 -4
  355. package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +11 -12
  356. package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +46 -30
  357. package/src/lib/shapes/arrow/arrowLabel.ts +3 -23
  358. package/src/lib/shapes/arrow/arrowTargetState.ts +1 -2
  359. package/src/lib/shapes/arrow/elbow/ElbowArrowDebug.tsx +3 -3
  360. package/src/lib/shapes/arrow/toolStates/Pointing.tsx +0 -3
  361. package/src/lib/shapes/draw/DrawShapeTool.test.ts +5 -0
  362. package/src/lib/shapes/draw/DrawShapeUtil.tsx +7 -4
  363. package/src/lib/shapes/embed/EmbedShapeUtil.tsx +1 -1
  364. package/src/lib/shapes/frame/FrameShapeUtil.tsx +21 -26
  365. package/src/lib/shapes/frame/components/FrameHeading.tsx +1 -1
  366. package/src/lib/shapes/geo/GeoShapeUtil.tsx +2 -3
  367. package/src/lib/shapes/geo/components/GeoShapeBody.tsx +2 -2
  368. package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +4 -7
  369. package/src/lib/shapes/image/ImageShapeUtil.tsx +3 -3
  370. package/src/lib/shapes/line/LineShapeUtil.test.tsx +3 -4
  371. package/src/lib/shapes/line/LineShapeUtil.tsx +6 -25
  372. package/src/lib/shapes/line/__snapshots__/LineShapeUtil.test.tsx.snap +2 -2
  373. package/src/lib/shapes/note/NoteShapeUtil.tsx +4 -10
  374. package/src/lib/shapes/shared/PathBuilder.test.tsx +1 -1
  375. package/src/lib/shapes/shared/PathBuilder.tsx +1 -35
  376. package/src/lib/shapes/shared/PlainTextLabel.tsx +0 -1
  377. package/src/lib/shapes/shared/RichTextLabel.tsx +0 -4
  378. package/src/lib/shapes/shared/ShapeFill.tsx +4 -5
  379. package/src/lib/shapes/shared/SvgTextLabel.tsx +2 -4
  380. package/src/lib/shapes/shared/freehand/svg.ts +0 -2
  381. package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +1 -11
  382. package/src/lib/shapes/text/TextShapeTool.test.ts +5 -6
  383. package/src/lib/shapes/text/TextShapeUtil.tsx +14 -8
  384. package/src/lib/shapes/video/VideoShapeUtil.tsx +3 -3
  385. package/src/lib/styles.tsx +1 -3
  386. package/src/lib/tools/EraserTool/childStates/Erasing.ts +1 -34
  387. package/src/lib/tools/EraserTool/childStates/Pointing.ts +0 -20
  388. package/src/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.ts +1 -8
  389. package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +30 -54
  390. package/src/lib/tools/SelectTool/childStates/Idle.ts +24 -2
  391. package/src/lib/tools/SelectTool/childStates/PointingShape.ts +0 -7
  392. package/src/lib/tools/SelectTool/childStates/Resizing.ts +1 -12
  393. package/src/lib/tools/SelectTool/childStates/Rotating.ts +0 -11
  394. package/src/lib/tools/SelectTool/childStates/Translating.ts +1 -11
  395. package/src/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.ts +0 -1
  396. package/src/lib/ui/TldrawUi.tsx +2 -17
  397. package/src/lib/ui/components/A11y.tsx +13 -15
  398. package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +3 -15
  399. package/src/lib/ui/components/DefaultMenuPanel.tsx +3 -4
  400. package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +0 -40
  401. package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +2 -4
  402. package/src/lib/ui/components/Minimap/MinimapManager.ts +4 -4
  403. package/src/lib/ui/components/MobileStylePanel.tsx +6 -9
  404. package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +5 -4
  405. package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +2 -3
  406. package/src/lib/ui/components/SharePanel/PeopleMenuItem.tsx +3 -4
  407. package/src/lib/ui/components/SharePanel/UserPresenceColorPicker.tsx +3 -3
  408. package/src/lib/ui/components/Spinner.tsx +24 -2
  409. package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +1 -3
  410. package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +106 -146
  411. package/src/lib/ui/components/StylePanel/DoubleDropdownPicker.tsx +3 -3
  412. package/src/lib/ui/components/StylePanel/DropdownPicker.tsx +6 -7
  413. package/src/lib/ui/components/Toolbar/DefaultImageToolbar.tsx +9 -25
  414. package/src/lib/ui/components/Toolbar/DefaultImageToolbarContent.tsx +1 -1
  415. package/src/lib/ui/components/Toolbar/DefaultToolbar.tsx +23 -55
  416. package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +61 -212
  417. package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +12 -17
  418. package/src/lib/ui/components/menu-items.tsx +0 -25
  419. package/src/lib/ui/components/primitives/Button/TldrawUiButtonIcon.tsx +2 -2
  420. package/src/lib/ui/components/primitives/TldrawUiButtonPicker.tsx +35 -40
  421. package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +1 -1
  422. package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +1 -1
  423. package/src/lib/ui/components/primitives/TldrawUiIcon.tsx +3 -41
  424. package/src/lib/ui/components/primitives/TldrawUiPopover.tsx +2 -4
  425. package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +1 -6
  426. package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +12 -56
  427. package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +2 -2
  428. package/src/lib/ui/components/primitives/menus/TldrawUiMenuContext.tsx +1 -0
  429. package/src/lib/ui/components/primitives/menus/TldrawUiMenuGroup.tsx +16 -29
  430. package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +23 -224
  431. package/src/lib/ui/context/TldrawUiContextProvider.tsx +20 -23
  432. package/src/lib/ui/context/actions.tsx +9 -59
  433. package/src/lib/ui/context/events.tsx +2 -6
  434. package/src/lib/ui/hooks/menu-hooks.ts +0 -1
  435. package/src/lib/ui/hooks/useKeyboardShortcuts.ts +2 -3
  436. package/src/lib/ui/hooks/useTools.tsx +11 -142
  437. package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +0 -11
  438. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +0 -11
  439. package/src/lib/ui/kbd-utils.ts +1 -2
  440. package/src/lib/ui/version.ts +3 -3
  441. package/src/lib/ui.css +314 -414
  442. package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +7 -21
  443. package/src/lib/utils/excalidraw/putExcalidrawContent.ts +1 -1
  444. package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +7 -28
  445. package/src/lib/utils/tldr/buildFromV1Document.ts +1 -2
  446. package/src/test/A11y.test.tsx +2 -3
  447. package/src/test/ClickManager.test.ts +6 -7
  448. package/src/test/Editor.test.tsx +20 -21
  449. package/src/test/EraserTool.test.ts +13 -184
  450. package/src/test/HandTool.test.ts +9 -10
  451. package/src/test/HighlightShape.test.ts +1 -2
  452. package/src/test/SelectTool.test.ts +13 -40
  453. package/src/test/TLUserPreferences.test.ts +3 -4
  454. package/src/test/TestEditor.ts +15 -13
  455. package/src/test/TldrawEditor.test.tsx +10 -11
  456. package/src/test/ZoomTool.test.ts +6 -7
  457. package/src/test/__snapshots__/drawing.test.ts.snap +2 -2
  458. package/src/test/__snapshots__/groups.test.tsx.snap +6 -6
  459. package/src/test/__snapshots__/resizing.test.ts.snap +2 -2
  460. package/src/test/arrows-megabus.test.tsx +10 -17
  461. package/src/test/bindings.test.tsx +37 -24
  462. package/src/test/bookmark-shapes.test.ts +8 -1
  463. package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +7 -23
  464. package/src/test/commands/__snapshots__/packShapes.test.ts.snap +8 -8
  465. package/src/test/commands/__snapshots__/zoomToFit.test.ts.snap +2 -2
  466. package/src/test/commands/alignShapes.test.tsx +24 -25
  467. package/src/test/commands/animationSpeed.test.ts +1 -2
  468. package/src/test/commands/centerOnPoint.test.ts +2 -3
  469. package/src/test/commands/clipboard.test.ts +2 -3
  470. package/src/test/commands/createShapes.test.ts +1 -2
  471. package/src/test/commands/deletePage.test.ts +1 -84
  472. package/src/test/commands/deleteShapes.test.ts +1 -2
  473. package/src/test/commands/distributeShapes.test.tsx +10 -11
  474. package/src/test/commands/getSvgString.test.ts +1 -2
  475. package/src/test/commands/packShapes.test.ts +4 -5
  476. package/src/test/commands/resizeShape.test.ts +1 -2
  477. package/src/test/commands/rotateShapes.test.ts +6 -7
  478. package/src/test/commands/setCamera.test.ts +3 -4
  479. package/src/test/commands/setCurrentPage.test.ts +2 -3
  480. package/src/test/commands/stackShapes.test.ts +10 -11
  481. package/src/test/commands/stretch.test.tsx +12 -13
  482. package/src/test/createDeepLink.test.tsx +1 -2
  483. package/src/test/cropping.test.ts +2 -3
  484. package/src/test/drawing.test.ts +1 -2
  485. package/src/test/flipShapes.test.ts +3 -4
  486. package/src/test/frames.test.ts +24 -25
  487. package/src/test/getCulledShapes.test.tsx +2 -3
  488. package/src/test/groups.test.tsx +2 -2
  489. package/src/test/handleDeepLink.test.tsx +1 -2
  490. package/src/test/maxShapes.test.ts +2 -3
  491. package/src/test/modifiers.test.ts +4 -5
  492. package/src/test/navigation.test.ts +9 -264
  493. package/src/test/panning.test.ts +1 -2
  494. package/src/test/perf/perf.test.ts +1 -2
  495. package/src/test/registerDeepLinkListener.test.tsx +9 -10
  496. package/src/test/resizing.test.ts +38 -39
  497. package/src/test/select.test.tsx +3 -4
  498. package/src/test/selection-omnibus.test.ts +10 -11
  499. package/src/test/shapeutils.test.ts +48 -398
  500. package/src/test/translating.test.ts +9 -10
  501. package/tldraw.css +627 -726
  502. package/dist-cjs/lib/ui/components/AccessibilityMenu.js +0 -35
  503. package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +0 -7
  504. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +0 -268
  505. package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +0 -7
  506. package/dist-cjs/lib/ui/components/primitives/layout.js +0 -76
  507. package/dist-cjs/lib/ui/components/primitives/layout.js.map +0 -7
  508. package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +0 -19
  509. package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +0 -7
  510. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +0 -245
  511. package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +0 -7
  512. package/dist-esm/lib/ui/components/primitives/layout.mjs +0 -46
  513. package/dist-esm/lib/ui/components/primitives/layout.mjs.map +0 -7
  514. package/src/lib/ui/components/AccessibilityMenu.tsx +0 -20
  515. package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +0 -327
  516. package/src/lib/ui/components/primitives/layout.tsx +0 -107
  517. package/src/test/inner-outer-margin.test.ts +0 -315
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/shapes/shared/ShapeFill.tsx"],
4
- "sourcesContent": ["import {\n\tgetColorValue,\n\tTLDefaultColorStyle,\n\tTLDefaultColorTheme,\n\tTLDefaultFillStyle,\n\tuseEditor,\n\tuseSvgExportContext,\n\tuseValue,\n} from '@tldraw/editor'\nimport React from 'react'\nimport { useGetHashPatternZoomName } from './defaultStyleDefs'\n\ninterface ShapeFillProps {\n\td: string\n\tfill: TLDefaultFillStyle\n\tcolor: TLDefaultColorStyle\n\ttheme: TLDefaultColorTheme\n\tscale: number\n}\n\nexport const ShapeFill = React.memo(function ShapeFill({\n\ttheme,\n\td,\n\tcolor,\n\tfill,\n\tscale,\n}: ShapeFillProps) {\n\tswitch (fill) {\n\t\tcase 'none': {\n\t\t\treturn null\n\t\t}\n\t\tcase 'solid': {\n\t\t\treturn <path fill={getColorValue(theme, color, 'semi')} d={d} />\n\t\t}\n\t\tcase 'semi': {\n\t\t\treturn <path fill={theme.solid} d={d} />\n\t\t}\n\t\tcase 'fill': {\n\t\t\treturn <path fill={getColorValue(theme, color, 'fill')} d={d} />\n\t\t}\n\t\tcase 'pattern': {\n\t\t\treturn <PatternFill theme={theme} color={color} fill={fill} d={d} scale={scale} />\n\t\t}\n\t}\n})\n\nexport function PatternFill({ d, color, theme }: ShapeFillProps) {\n\tconst editor = useEditor()\n\tconst svgExport = useSvgExportContext()\n\tconst zoomLevel = useValue('zoomLevel', () => editor.getZoomLevel(), [editor])\n\tconst getHashPatternZoomName = useGetHashPatternZoomName()\n\n\tconst teenyTiny = editor.getZoomLevel() <= 0.18\n\n\treturn (\n\t\t<>\n\t\t\t<path fill={getColorValue(theme, color, 'pattern')} d={d} />\n\t\t\t<path\n\t\t\t\tfill={\n\t\t\t\t\tsvgExport\n\t\t\t\t\t\t? `url(#${getHashPatternZoomName(1, theme.id)})`\n\t\t\t\t\t\t: teenyTiny\n\t\t\t\t\t\t\t? getColorValue(theme, color, 'semi')\n\t\t\t\t\t\t\t: `url(#${getHashPatternZoomName(zoomLevel, theme.id)})`\n\t\t\t\t}\n\t\t\t\td={d}\n\t\t\t/>\n\t\t</>\n\t)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCU;AAhCV,oBAQO;AACP,mBAAkB;AAClB,8BAA0C;AAUnC,MAAM,YAAY,aAAAA,QAAM,KAAK,SAASC,WAAU;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAmB;AAClB,UAAQ,MAAM;AAAA,IACb,KAAK,QAAQ;AACZ,aAAO;AAAA,IACR;AAAA,IACA,KAAK,SAAS;AACb,aAAO,4CAAC,UAAK,UAAM,6BAAc,OAAO,OAAO,MAAM,GAAG,GAAM;AAAA,IAC/D;AAAA,IACA,KAAK,QAAQ;AACZ,aAAO,4CAAC,UAAK,MAAM,MAAM,OAAO,GAAM;AAAA,IACvC;AAAA,IACA,KAAK,QAAQ;AACZ,aAAO,4CAAC,UAAK,UAAM,6BAAc,OAAO,OAAO,MAAM,GAAG,GAAM;AAAA,IAC/D;AAAA,IACA,KAAK,WAAW;AACf,aAAO,4CAAC,eAAY,OAAc,OAAc,MAAY,GAAM,OAAc;AAAA,IACjF;AAAA,EACD;AACD,CAAC;AAEM,SAAS,YAAY,EAAE,GAAG,OAAO,MAAM,GAAmB;AAChE,QAAM,aAAS,yBAAU;AACzB,QAAM,gBAAY,mCAAoB;AACtC,QAAM,gBAAY,wBAAS,aAAa,MAAM,OAAO,aAAa,GAAG,CAAC,MAAM,CAAC;AAC7E,QAAM,6BAAyB,mDAA0B;AAEzD,QAAM,YAAY,OAAO,aAAa,KAAK;AAE3C,SACC,4EACC;AAAA,gDAAC,UAAK,UAAM,6BAAc,OAAO,OAAO,SAAS,GAAG,GAAM;AAAA,IAC1D;AAAA,MAAC;AAAA;AAAA,QACA,MACC,YACG,QAAQ,uBAAuB,GAAG,MAAM,EAAE,CAAC,MAC3C,gBACC,6BAAc,OAAO,OAAO,MAAM,IAClC,QAAQ,uBAAuB,WAAW,MAAM,EAAE,CAAC;AAAA,QAExD;AAAA;AAAA,IACD;AAAA,KACD;AAEF;",
4
+ "sourcesContent": ["import {\n\tTLDefaultColorStyle,\n\tTLDefaultColorTheme,\n\tTLDefaultFillStyle,\n\tuseEditor,\n\tuseSvgExportContext,\n\tuseValue,\n} from '@tldraw/editor'\nimport React from 'react'\nimport { useGetHashPatternZoomName } from './defaultStyleDefs'\n\ninterface ShapeFillProps {\n\td: string\n\tfill: TLDefaultFillStyle\n\tcolor: TLDefaultColorStyle\n\ttheme: TLDefaultColorTheme\n\tscale: number\n}\n\nexport const ShapeFill = React.memo(function ShapeFill({\n\ttheme,\n\td,\n\tcolor,\n\tfill,\n\tscale,\n}: ShapeFillProps) {\n\tswitch (fill) {\n\t\tcase 'none': {\n\t\t\treturn null\n\t\t}\n\t\tcase 'solid': {\n\t\t\treturn <path fill={theme[color].semi} d={d} />\n\t\t}\n\t\tcase 'semi': {\n\t\t\treturn <path fill={theme.solid} d={d} />\n\t\t}\n\t\tcase 'fill': {\n\t\t\treturn <path fill={theme[color].fill} d={d} />\n\t\t}\n\t\tcase 'pattern': {\n\t\t\treturn <PatternFill theme={theme} color={color} fill={fill} d={d} scale={scale} />\n\t\t}\n\t}\n})\n\nexport function PatternFill({ d, color, theme }: ShapeFillProps) {\n\tconst editor = useEditor()\n\tconst svgExport = useSvgExportContext()\n\tconst zoomLevel = useValue('zoomLevel', () => editor.getZoomLevel(), [editor])\n\tconst getHashPatternZoomName = useGetHashPatternZoomName()\n\n\tconst teenyTiny = editor.getZoomLevel() <= 0.18\n\n\treturn (\n\t\t<>\n\t\t\t<path fill={theme[color].pattern} d={d} />\n\t\t\t<path\n\t\t\t\tfill={\n\t\t\t\t\tsvgExport\n\t\t\t\t\t\t? `url(#${getHashPatternZoomName(1, theme.id)})`\n\t\t\t\t\t\t: teenyTiny\n\t\t\t\t\t\t\t? theme[color].semi\n\t\t\t\t\t\t\t: `url(#${getHashPatternZoomName(zoomLevel, theme.id)})`\n\t\t\t\t}\n\t\t\t\td={d}\n\t\t\t/>\n\t\t</>\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BU;AA/BV,oBAOO;AACP,mBAAkB;AAClB,8BAA0C;AAUnC,MAAM,YAAY,aAAAA,QAAM,KAAK,SAASC,WAAU;AAAA,EACtD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAmB;AAClB,UAAQ,MAAM;AAAA,IACb,KAAK,QAAQ;AACZ,aAAO;AAAA,IACR;AAAA,IACA,KAAK,SAAS;AACb,aAAO,4CAAC,UAAK,MAAM,MAAM,KAAK,EAAE,MAAM,GAAM;AAAA,IAC7C;AAAA,IACA,KAAK,QAAQ;AACZ,aAAO,4CAAC,UAAK,MAAM,MAAM,OAAO,GAAM;AAAA,IACvC;AAAA,IACA,KAAK,QAAQ;AACZ,aAAO,4CAAC,UAAK,MAAM,MAAM,KAAK,EAAE,MAAM,GAAM;AAAA,IAC7C;AAAA,IACA,KAAK,WAAW;AACf,aAAO,4CAAC,eAAY,OAAc,OAAc,MAAY,GAAM,OAAc;AAAA,IACjF;AAAA,EACD;AACD,CAAC;AAEM,SAAS,YAAY,EAAE,GAAG,OAAO,MAAM,GAAmB;AAChE,QAAM,aAAS,yBAAU;AACzB,QAAM,gBAAY,mCAAoB;AACtC,QAAM,gBAAY,wBAAS,aAAa,MAAM,OAAO,aAAa,GAAG,CAAC,MAAM,CAAC;AAC7E,QAAM,6BAAyB,mDAA0B;AAEzD,QAAM,YAAY,OAAO,aAAa,KAAK;AAE3C,SACC,4EACC;AAAA,gDAAC,UAAK,MAAM,MAAM,KAAK,EAAE,SAAS,GAAM;AAAA,IACxC;AAAA,MAAC;AAAA;AAAA,QACA,MACC,YACG,QAAQ,uBAAuB,GAAG,MAAM,EAAE,CAAC,MAC3C,YACC,MAAM,KAAK,EAAE,OACb,QAAQ,uBAAuB,WAAW,MAAM,EAAE,CAAC;AAAA,QAExD;AAAA;AAAA,IACD;AAAA,KACD;AAEF;",
6
6
  "names": ["React", "ShapeFill"]
7
7
  }
@@ -36,8 +36,7 @@ function SvgTextLabel({
36
36
  labelColor,
37
37
  bounds,
38
38
  padding = 16,
39
- stroke = true,
40
- showTextOutline = true
39
+ stroke = true
41
40
  }) {
42
41
  const editor = (0, import_editor.useEditor)();
43
42
  const theme = (0, import_useDefaultColorTheme.useDefaultColorTheme)();
@@ -68,10 +67,10 @@ function SvgTextLabel({
68
67
  opts.offsetY += bounds.y;
69
68
  const mainSpans = (0, import_createTextJsxFromSpans.createTextJsxFromSpans)(editor, spans, opts);
70
69
  let outlineSpans = null;
71
- if (showTextOutline && stroke) {
70
+ if (stroke) {
72
71
  opts.fill = theme.background;
73
72
  opts.stroke = theme.background;
74
- opts.strokeWidth = 3;
73
+ opts.strokeWidth = 2;
75
74
  outlineSpans = (0, import_createTextJsxFromSpans.createTextJsxFromSpans)(editor, spans, opts);
76
75
  }
77
76
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/shapes/shared/SvgTextLabel.tsx"],
4
- "sourcesContent": ["import {\n\tBox,\n\tDefaultFontFamilies,\n\tTLDefaultFontStyle,\n\tTLDefaultHorizontalAlignStyle,\n\tTLDefaultVerticalAlignStyle,\n\tuseEditor,\n} from '@tldraw/editor'\nimport { createTextJsxFromSpans } from './createTextJsxFromSpans'\nimport { TEXT_PROPS } from './default-shape-constants'\nimport { getLegacyOffsetX } from './legacyProps'\nimport { useDefaultColorTheme } from './useDefaultColorTheme'\n\nexport function SvgTextLabel({\n\tfontSize,\n\tfont,\n\talign,\n\tverticalAlign,\n\ttext,\n\tlabelColor,\n\tbounds,\n\tpadding = 16,\n\tstroke = true,\n\tshowTextOutline = true,\n}: {\n\tfontSize: number\n\tfont: TLDefaultFontStyle\n\t// fill?: TLDefaultFillStyle\n\talign: TLDefaultHorizontalAlignStyle\n\tverticalAlign: TLDefaultVerticalAlignStyle\n\twrap?: boolean\n\ttext: string\n\tlabelColor: string\n\tbounds: Box\n\tpadding?: number\n\tstroke?: boolean\n\tshowTextOutline?: boolean\n}) {\n\tconst editor = useEditor()\n\tconst theme = useDefaultColorTheme()\n\n\tconst opts = {\n\t\tfontSize,\n\t\tfontFamily: DefaultFontFamilies[font],\n\t\ttextAlign: align,\n\t\tverticalTextAlign: verticalAlign,\n\t\twidth: Math.ceil(bounds.width),\n\t\theight: Math.ceil(bounds.height),\n\t\tpadding,\n\t\tlineHeight: TEXT_PROPS.lineHeight,\n\t\tfontStyle: 'normal',\n\t\tfontWeight: 'normal',\n\t\toverflow: 'wrap' as const,\n\t\toffsetX: 0,\n\t\toffsetY: 0,\n\t\tfill: labelColor,\n\t\tstroke: undefined as string | undefined,\n\t\tstrokeWidth: undefined as number | undefined,\n\t}\n\n\tconst spans = editor.textMeasure.measureTextSpans(text, opts)\n\tconst offsetX = getLegacyOffsetX(align, padding, spans, bounds.width)\n\tif (offsetX) {\n\t\topts.offsetX = offsetX\n\t}\n\n\topts.offsetX += bounds.x\n\topts.offsetY += bounds.y\n\n\tconst mainSpans = createTextJsxFromSpans(editor, spans, opts)\n\n\tlet outlineSpans = null\n\tif (showTextOutline && stroke) {\n\t\topts.fill = theme.background\n\t\topts.stroke = theme.background\n\t\topts.strokeWidth = 3\n\t\toutlineSpans = createTextJsxFromSpans(editor, spans, opts)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{outlineSpans}\n\t\t\t{mainSpans}\n\t\t</>\n\t)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgFE;AAhFF,oBAOO;AACP,oCAAuC;AACvC,qCAA2B;AAC3B,yBAAiC;AACjC,kCAAqC;AAE9B,SAAS,aAAa;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AAAA,EACT,kBAAkB;AACnB,GAaG;AACF,QAAM,aAAS,yBAAU;AACzB,QAAM,YAAQ,kDAAqB;AAEnC,QAAM,OAAO;AAAA,IACZ;AAAA,IACA,YAAY,kCAAoB,IAAI;AAAA,IACpC,WAAW;AAAA,IACX,mBAAmB;AAAA,IACnB,OAAO,KAAK,KAAK,OAAO,KAAK;AAAA,IAC7B,QAAQ,KAAK,KAAK,OAAO,MAAM;AAAA,IAC/B;AAAA,IACA,YAAY,0CAAW;AAAA,IACvB,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,SAAS;AAAA,IACT,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,EACd;AAEA,QAAM,QAAQ,OAAO,YAAY,iBAAiB,MAAM,IAAI;AAC5D,QAAM,cAAU,qCAAiB,OAAO,SAAS,OAAO,OAAO,KAAK;AACpE,MAAI,SAAS;AACZ,SAAK,UAAU;AAAA,EAChB;AAEA,OAAK,WAAW,OAAO;AACvB,OAAK,WAAW,OAAO;AAEvB,QAAM,gBAAY,sDAAuB,QAAQ,OAAO,IAAI;AAE5D,MAAI,eAAe;AACnB,MAAI,mBAAmB,QAAQ;AAC9B,SAAK,OAAO,MAAM;AAClB,SAAK,SAAS,MAAM;AACpB,SAAK,cAAc;AACnB,uBAAe,sDAAuB,QAAQ,OAAO,IAAI;AAAA,EAC1D;AAEA,SACC,4EACE;AAAA;AAAA,IACA;AAAA,KACF;AAEF;",
4
+ "sourcesContent": ["import {\n\tBox,\n\tDefaultFontFamilies,\n\tTLDefaultFontStyle,\n\tTLDefaultHorizontalAlignStyle,\n\tTLDefaultVerticalAlignStyle,\n\tuseEditor,\n} from '@tldraw/editor'\nimport { createTextJsxFromSpans } from './createTextJsxFromSpans'\nimport { TEXT_PROPS } from './default-shape-constants'\nimport { getLegacyOffsetX } from './legacyProps'\nimport { useDefaultColorTheme } from './useDefaultColorTheme'\n\nexport function SvgTextLabel({\n\tfontSize,\n\tfont,\n\talign,\n\tverticalAlign,\n\ttext,\n\tlabelColor,\n\tbounds,\n\tpadding = 16,\n\tstroke = true,\n}: {\n\tfontSize: number\n\tfont: TLDefaultFontStyle\n\t// fill?: TLDefaultFillStyle\n\talign: TLDefaultHorizontalAlignStyle\n\tverticalAlign: TLDefaultVerticalAlignStyle\n\twrap?: boolean\n\ttext: string\n\tlabelColor: string\n\tbounds: Box\n\tpadding?: number\n\tstroke?: boolean\n}) {\n\tconst editor = useEditor()\n\tconst theme = useDefaultColorTheme()\n\n\tconst opts = {\n\t\tfontSize,\n\t\tfontFamily: DefaultFontFamilies[font],\n\t\ttextAlign: align,\n\t\tverticalTextAlign: verticalAlign,\n\t\twidth: Math.ceil(bounds.width),\n\t\theight: Math.ceil(bounds.height),\n\t\tpadding,\n\t\tlineHeight: TEXT_PROPS.lineHeight,\n\t\tfontStyle: 'normal',\n\t\tfontWeight: 'normal',\n\t\toverflow: 'wrap' as const,\n\t\toffsetX: 0,\n\t\toffsetY: 0,\n\t\tfill: labelColor,\n\t\tstroke: undefined as string | undefined,\n\t\tstrokeWidth: undefined as number | undefined,\n\t}\n\n\tconst spans = editor.textMeasure.measureTextSpans(text, opts)\n\tconst offsetX = getLegacyOffsetX(align, padding, spans, bounds.width)\n\tif (offsetX) {\n\t\topts.offsetX = offsetX\n\t}\n\n\topts.offsetX += bounds.x\n\topts.offsetY += bounds.y\n\n\tconst mainSpans = createTextJsxFromSpans(editor, spans, opts)\n\n\tlet outlineSpans = null\n\tif (stroke) {\n\t\topts.fill = theme.background\n\t\topts.stroke = theme.background\n\t\topts.strokeWidth = 2\n\t\toutlineSpans = createTextJsxFromSpans(editor, spans, opts)\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{outlineSpans}\n\t\t\t{mainSpans}\n\t\t</>\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8EE;AA9EF,oBAOO;AACP,oCAAuC;AACvC,qCAA2B;AAC3B,yBAAiC;AACjC,kCAAqC;AAE9B,SAAS,aAAa;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV,SAAS;AACV,GAYG;AACF,QAAM,aAAS,yBAAU;AACzB,QAAM,YAAQ,kDAAqB;AAEnC,QAAM,OAAO;AAAA,IACZ;AAAA,IACA,YAAY,kCAAoB,IAAI;AAAA,IACpC,WAAW;AAAA,IACX,mBAAmB;AAAA,IACnB,OAAO,KAAK,KAAK,OAAO,KAAK;AAAA,IAC7B,QAAQ,KAAK,KAAK,OAAO,MAAM;AAAA,IAC/B;AAAA,IACA,YAAY,0CAAW;AAAA,IACvB,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,SAAS;AAAA,IACT,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,aAAa;AAAA,EACd;AAEA,QAAM,QAAQ,OAAO,YAAY,iBAAiB,MAAM,IAAI;AAC5D,QAAM,cAAU,qCAAiB,OAAO,SAAS,OAAO,OAAO,KAAK;AACpE,MAAI,SAAS;AACZ,SAAK,UAAU;AAAA,EAChB;AAEA,OAAK,WAAW,OAAO;AACvB,OAAK,WAAW,OAAO;AAEvB,QAAM,gBAAY,sDAAuB,QAAQ,OAAO,IAAI;AAE5D,MAAI,eAAe;AACnB,MAAI,QAAQ;AACX,SAAK,OAAO,MAAM;AAClB,SAAK,SAAS,MAAM;AACpB,SAAK,cAAc;AACnB,uBAAe,sDAAuB,QAAQ,OAAO,IAAI;AAAA,EAC1D;AAEA,SACC,4EACE;AAAA;AAAA,IACA;AAAA,KACF;AAEF;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/shapes/shared/freehand/svg.ts"],
4
- "sourcesContent": ["import { average, precise } from '@tldraw/editor'\nimport { StrokePoint } from './types'\n\n/**\n * Turn an array of stroke points into a path of quadradic curves.\n *\n * @param points - The stroke points returned from perfect-freehand\n * @param closed - Whether the shape is closed\n *\n * @public\n */\nexport function getSvgPathFromStrokePoints(points: StrokePoint[], closed = false): string {\n\tconst len = points.length\n\n\tif (len < 2) {\n\t\treturn ''\n\t}\n\n\tlet a = points[0].point\n\tlet b = points[1].point\n\n\tif (len === 2) {\n\t\treturn `M${precise(a)}L${precise(b)}`\n\t}\n\n\tlet result = ''\n\n\tfor (let i = 2, max = len - 1; i < max; i++) {\n\t\ta = points[i].point\n\t\tb = points[i + 1].point\n\t\tresult += average(a, b)\n\t}\n\n\tif (closed) {\n\t\t// If closed, draw a curve from the last point to the first\n\t\treturn `M${average(points[0].point, points[1].point)}Q${precise(points[1].point)}${average(\n\t\t\tpoints[1].point,\n\t\t\tpoints[2].point\n\t\t)}T${result}${average(points[len - 1].point, points[0].point)}${average(\n\t\t\tpoints[0].point,\n\t\t\tpoints[1].point\n\t\t)}Z`\n\t} else {\n\t\t// If not closed, draw a curve starting at the first point and\n\t\t// ending at the midpoint of the last and second-last point, then\n\t\t// complete the curve with a line segment to the last point.\n\t\treturn `M${precise(points[0].point)}Q${precise(points[1].point)}${average(\n\t\t\tpoints[1].point,\n\t\t\tpoints[2].point\n\t\t)}${points.length > 3 ? 'T' : ''}${result}L${precise(points[len - 1].point)}`\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AAW1B,SAAS,2BAA2B,QAAuB,SAAS,OAAe;AACzF,QAAM,MAAM,OAAO;AAEnB,MAAI,MAAM,GAAG;AACZ,WAAO;AAAA,EACR;AAEA,MAAI,IAAI,OAAO,CAAC,EAAE;AAClB,MAAI,IAAI,OAAO,CAAC,EAAE;AAElB,MAAI,QAAQ,GAAG;AACd,WAAO,QAAI,uBAAQ,CAAC,CAAC,QAAI,uBAAQ,CAAC,CAAC;AAAA,EACpC;AAEA,MAAI,SAAS;AAEb,WAAS,IAAI,GAAG,MAAM,MAAM,GAAG,IAAI,KAAK,KAAK;AAC5C,QAAI,OAAO,CAAC,EAAE;AACd,QAAI,OAAO,IAAI,CAAC,EAAE;AAClB,kBAAU,uBAAQ,GAAG,CAAC;AAAA,EACvB;AAEA,MAAI,QAAQ;AAEX,WAAO,QAAI,uBAAQ,OAAO,CAAC,EAAE,OAAO,OAAO,CAAC,EAAE,KAAK,CAAC,QAAI,uBAAQ,OAAO,CAAC,EAAE,KAAK,CAAC,OAAG;AAAA,MAClF,OAAO,CAAC,EAAE;AAAA,MACV,OAAO,CAAC,EAAE;AAAA,IACX,CAAC,IAAI,MAAM,OAAG,uBAAQ,OAAO,MAAM,CAAC,EAAE,OAAO,OAAO,CAAC,EAAE,KAAK,CAAC,OAAG;AAAA,MAC/D,OAAO,CAAC,EAAE;AAAA,MACV,OAAO,CAAC,EAAE;AAAA,IACX,CAAC;AAAA,EACF,OAAO;AAIN,WAAO,QAAI,uBAAQ,OAAO,CAAC,EAAE,KAAK,CAAC,QAAI,uBAAQ,OAAO,CAAC,EAAE,KAAK,CAAC,OAAG;AAAA,MACjE,OAAO,CAAC,EAAE;AAAA,MACV,OAAO,CAAC,EAAE;AAAA,IACX,CAAC,GAAG,OAAO,SAAS,IAAI,MAAM,EAAE,GAAG,MAAM,QAAI,uBAAQ,OAAO,MAAM,CAAC,EAAE,KAAK,CAAC;AAAA,EAC5E;AACD;",
4
+ "sourcesContent": ["import { average, precise } from '@tldraw/editor'\nimport { StrokePoint } from './types'\n\n/**\n * Turn an array of stroke points into a path of quadradic curves.\n *\n * @param points - The stroke points returned from perfect-freehand\n * @param closed - Whether the shape is closed\n */\nexport function getSvgPathFromStrokePoints(points: StrokePoint[], closed = false): string {\n\tconst len = points.length\n\n\tif (len < 2) {\n\t\treturn ''\n\t}\n\n\tlet a = points[0].point\n\tlet b = points[1].point\n\n\tif (len === 2) {\n\t\treturn `M${precise(a)}L${precise(b)}`\n\t}\n\n\tlet result = ''\n\n\tfor (let i = 2, max = len - 1; i < max; i++) {\n\t\ta = points[i].point\n\t\tb = points[i + 1].point\n\t\tresult += average(a, b)\n\t}\n\n\tif (closed) {\n\t\t// If closed, draw a curve from the last point to the first\n\t\treturn `M${average(points[0].point, points[1].point)}Q${precise(points[1].point)}${average(\n\t\t\tpoints[1].point,\n\t\t\tpoints[2].point\n\t\t)}T${result}${average(points[len - 1].point, points[0].point)}${average(\n\t\t\tpoints[0].point,\n\t\t\tpoints[1].point\n\t\t)}Z`\n\t} else {\n\t\t// If not closed, draw a curve starting at the first point and\n\t\t// ending at the midpoint of the last and second-last point, then\n\t\t// complete the curve with a line segment to the last point.\n\t\treturn `M${precise(points[0].point)}Q${precise(points[1].point)}${average(\n\t\t\tpoints[1].point,\n\t\t\tpoints[2].point\n\t\t)}${points.length > 3 ? 'T' : ''}${result}L${precise(points[len - 1].point)}`\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAiC;AAS1B,SAAS,2BAA2B,QAAuB,SAAS,OAAe;AACzF,QAAM,MAAM,OAAO;AAEnB,MAAI,MAAM,GAAG;AACZ,WAAO;AAAA,EACR;AAEA,MAAI,IAAI,OAAO,CAAC,EAAE;AAClB,MAAI,IAAI,OAAO,CAAC,EAAE;AAElB,MAAI,QAAQ,GAAG;AACd,WAAO,QAAI,uBAAQ,CAAC,CAAC,QAAI,uBAAQ,CAAC,CAAC;AAAA,EACpC;AAEA,MAAI,SAAS;AAEb,WAAS,IAAI,GAAG,MAAM,MAAM,GAAG,IAAI,KAAK,KAAK;AAC5C,QAAI,OAAO,CAAC,EAAE;AACd,QAAI,OAAO,IAAI,CAAC,EAAE;AAClB,kBAAU,uBAAQ,GAAG,CAAC;AAAA,EACvB;AAEA,MAAI,QAAQ;AAEX,WAAO,QAAI,uBAAQ,OAAO,CAAC,EAAE,OAAO,OAAO,CAAC,EAAE,KAAK,CAAC,QAAI,uBAAQ,OAAO,CAAC,EAAE,KAAK,CAAC,OAAG;AAAA,MAClF,OAAO,CAAC,EAAE;AAAA,MACV,OAAO,CAAC,EAAE;AAAA,IACX,CAAC,IAAI,MAAM,OAAG,uBAAQ,OAAO,MAAM,CAAC,EAAE,OAAO,OAAO,CAAC,EAAE,KAAK,CAAC,OAAG;AAAA,MAC/D,OAAO,CAAC,EAAE;AAAA,MACV,OAAO,CAAC,EAAE;AAAA,IACX,CAAC;AAAA,EACF,OAAO;AAIN,WAAO,QAAI,uBAAQ,OAAO,CAAC,EAAE,KAAK,CAAC,QAAI,uBAAQ,OAAO,CAAC,EAAE,KAAK,CAAC,OAAG;AAAA,MACjE,OAAO,CAAC,EAAE;AAAA,MACV,OAAO,CAAC,EAAE;AAAA,IACX,CAAC,GAAG,OAAO,SAAS,IAAI,MAAM,EAAE,GAAG,MAAM,QAAI,uBAAQ,OAAO,MAAM,CAAC,EAAE,KAAK,CAAC;AAAA,EAC5E;AACD;",
6
6
  "names": []
7
7
  }
@@ -21,19 +21,10 @@ __export(usePrefersReducedMotion_exports, {
21
21
  usePrefersReducedMotion: () => usePrefersReducedMotion
22
22
  });
23
23
  module.exports = __toCommonJS(usePrefersReducedMotion_exports);
24
- var import_editor = require("@tldraw/editor");
25
24
  var import_react = require("react");
26
25
  function usePrefersReducedMotion() {
27
- const editor = (0, import_editor.useMaybeEditor)();
28
- const animationSpeed = (0, import_editor.useValue)("animationSpeed", () => editor?.user.getAnimationSpeed(), [
29
- editor
30
- ]);
31
26
  const [prefersReducedMotion, setPrefersReducedMotion] = (0, import_react.useState)(false);
32
27
  (0, import_react.useEffect)(() => {
33
- if (animationSpeed !== void 0) {
34
- setPrefersReducedMotion(animationSpeed === 0 ? true : false);
35
- return;
36
- }
37
28
  if (typeof window === "undefined" || !("matchMedia" in window)) return;
38
29
  const mql = window.matchMedia("(prefers-reduced-motion: reduce)");
39
30
  const handler = () => {
@@ -42,7 +33,7 @@ function usePrefersReducedMotion() {
42
33
  handler();
43
34
  mql.addEventListener("change", handler);
44
35
  return () => mql.removeEventListener("change", handler);
45
- }, [animationSpeed]);
36
+ }, []);
46
37
  return prefersReducedMotion;
47
38
  }
48
39
  //# sourceMappingURL=usePrefersReducedMotion.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/shapes/shared/usePrefersReducedMotion.tsx"],
4
- "sourcesContent": ["import { useMaybeEditor, useValue } from '@tldraw/editor'\nimport { useEffect, useState } from 'react'\n\n/** @public */\nexport function usePrefersReducedMotion() {\n\tconst editor = useMaybeEditor()\n\tconst animationSpeed = useValue('animationSpeed', () => editor?.user.getAnimationSpeed(), [\n\t\teditor,\n\t])\n\tconst [prefersReducedMotion, setPrefersReducedMotion] = useState(false)\n\n\tuseEffect(() => {\n\t\tif (animationSpeed !== undefined) {\n\t\t\tsetPrefersReducedMotion(animationSpeed === 0 ? true : false)\n\t\t\treturn\n\t\t}\n\n\t\tif (typeof window === 'undefined' || !('matchMedia' in window)) return\n\t\tconst mql = window.matchMedia('(prefers-reduced-motion: reduce)')\n\t\tconst handler = () => {\n\t\t\tsetPrefersReducedMotion(mql.matches)\n\t\t}\n\t\thandler()\n\t\tmql.addEventListener('change', handler)\n\t\treturn () => mql.removeEventListener('change', handler)\n\t}, [animationSpeed])\n\n\treturn prefersReducedMotion\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyC;AACzC,mBAAoC;AAG7B,SAAS,0BAA0B;AACzC,QAAM,aAAS,8BAAe;AAC9B,QAAM,qBAAiB,wBAAS,kBAAkB,MAAM,QAAQ,KAAK,kBAAkB,GAAG;AAAA,IACzF;AAAA,EACD,CAAC;AACD,QAAM,CAAC,sBAAsB,uBAAuB,QAAI,uBAAS,KAAK;AAEtE,8BAAU,MAAM;AACf,QAAI,mBAAmB,QAAW;AACjC,8BAAwB,mBAAmB,IAAI,OAAO,KAAK;AAC3D;AAAA,IACD;AAEA,QAAI,OAAO,WAAW,eAAe,EAAE,gBAAgB,QAAS;AAChE,UAAM,MAAM,OAAO,WAAW,kCAAkC;AAChE,UAAM,UAAU,MAAM;AACrB,8BAAwB,IAAI,OAAO;AAAA,IACpC;AACA,YAAQ;AACR,QAAI,iBAAiB,UAAU,OAAO;AACtC,WAAO,MAAM,IAAI,oBAAoB,UAAU,OAAO;AAAA,EACvD,GAAG,CAAC,cAAc,CAAC;AAEnB,SAAO;AACR;",
4
+ "sourcesContent": ["import { useEffect, useState } from 'react'\n\n/** @public */\nexport function usePrefersReducedMotion() {\n\tconst [prefersReducedMotion, setPrefersReducedMotion] = useState(false)\n\n\tuseEffect(() => {\n\t\tif (typeof window === 'undefined' || !('matchMedia' in window)) return\n\t\tconst mql = window.matchMedia('(prefers-reduced-motion: reduce)')\n\t\tconst handler = () => {\n\t\t\tsetPrefersReducedMotion(mql.matches)\n\t\t}\n\t\thandler()\n\t\tmql.addEventListener('change', handler)\n\t\treturn () => mql.removeEventListener('change', handler)\n\t}, [])\n\n\treturn prefersReducedMotion\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAoC;AAG7B,SAAS,0BAA0B;AACzC,QAAM,CAAC,sBAAsB,uBAAuB,QAAI,uBAAS,KAAK;AAEtE,8BAAU,MAAM;AACf,QAAI,OAAO,WAAW,eAAe,EAAE,gBAAgB,QAAS;AAChE,UAAM,MAAM,OAAO,WAAW,kCAAkC;AAChE,UAAM,UAAU,MAAM;AACrB,8BAAwB,IAAI,OAAO;AAAA,IACpC;AACA,YAAQ;AACR,QAAI,iBAAiB,UAAU,OAAO;AACtC,WAAO,MAAM,IAAI,oBAAoB,UAAU,OAAO;AAAA,EACvD,GAAG,CAAC,CAAC;AAEL,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -108,7 +108,7 @@ class TextShapeUtil extends import_editor.ShapeUtil {
108
108
  align: textAlign,
109
109
  verticalAlign: "middle",
110
110
  richText,
111
- labelColor: (0, import_editor.getColorValue)(theme, color, "solid"),
111
+ labelColor: theme[color].solid,
112
112
  isSelected,
113
113
  textWidth: width,
114
114
  textHeight: height,
@@ -141,7 +141,7 @@ class TextShapeUtil extends import_editor.ShapeUtil {
141
141
  align: shape.props.textAlign,
142
142
  verticalAlign: "middle",
143
143
  richText: shape.props.richText,
144
- labelColor: (0, import_editor.getColorValue)(theme, shape.props.color, "solid"),
144
+ labelColor: theme[shape.props.color].solid,
145
145
  bounds: exportBounds,
146
146
  padding: 0
147
147
  }
@@ -245,19 +245,25 @@ class TextShapeUtil extends import_editor.ShapeUtil {
245
245
  // }
246
246
  }
247
247
  function getTextSize(editor, props) {
248
- const { font, richText, size, w } = props;
249
- const minWidth = 16;
248
+ const { font, richText, autoSize, size, w } = props;
249
+ const minWidth = autoSize ? 16 : Math.max(16, w);
250
250
  const fontSize = import_default_shape_constants.FONT_SIZES[size];
251
- const maybeFixedWidth = props.autoSize ? null : Math.max(minWidth, Math.floor(w));
251
+ const cw = autoSize ? null : (
252
+ // `measureText` floors the number so we need to do the same here to avoid issues.
253
+ Math.floor(Math.max(minWidth, w))
254
+ );
252
255
  const html = (0, import_richText.renderHtmlFromRichTextForMeasurement)(editor, richText);
253
256
  const result = editor.textMeasure.measureHtml(html, {
254
257
  ...import_default_shape_constants.TEXT_PROPS,
255
258
  fontFamily: import_default_shape_constants.FONT_FAMILIES[font],
256
259
  fontSize,
257
- maxWidth: maybeFixedWidth
260
+ maxWidth: cw
258
261
  });
262
+ if (autoSize) {
263
+ result.w += 1;
264
+ }
259
265
  return {
260
- width: maybeFixedWidth ?? Math.max(minWidth, result.w + 1),
266
+ width: Math.max(minWidth, result.w),
261
267
  height: Math.max(fontSize, result.h)
262
268
  };
263
269
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/shapes/text/TextShapeUtil.tsx"],
4
- "sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport {\n\tBox,\n\tEditor,\n\tRectangle2d,\n\tShapeUtil,\n\tSvgExportContext,\n\tTLGeometryOpts,\n\tTLResizeInfo,\n\tTLShapeId,\n\tTLTextShape,\n\tVec,\n\tcreateComputedCache,\n\tgetColorValue,\n\tgetDefaultColorTheme,\n\tgetFontsFromRichText,\n\tisEqual,\n\tresizeScaled,\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttoDomPrecision,\n\ttoRichText,\n\tuseEditor,\n} from '@tldraw/editor'\nimport { useCallback } from 'react'\nimport {\n\trenderHtmlFromRichTextForMeasurement,\n\trenderPlaintextFromRichText,\n} from '../../utils/text/richText'\nimport { RichTextLabel, RichTextSVG } from '../shared/RichTextLabel'\nimport { FONT_FAMILIES, FONT_SIZES, TEXT_PROPS } from '../shared/default-shape-constants'\nimport { useDefaultColorTheme } from '../shared/useDefaultColorTheme'\n\nconst sizeCache = createComputedCache(\n\t'text size',\n\t(editor: Editor, shape: TLTextShape) => {\n\t\teditor.fonts.trackFontsForShape(shape)\n\t\treturn getTextSize(editor, shape.props)\n\t},\n\t{ areRecordsEqual: (a, b) => a.props === b.props }\n)\n/** @public */\nexport interface TextShapeOptions {\n\t/** How much addition padding should be added to the horizontal geometry of the shape when binding to an arrow? */\n\textraArrowHorizontalPadding: number\n}\n\n/** @public */\nexport class TextShapeUtil extends ShapeUtil<TLTextShape> {\n\tstatic override type = 'text' as const\n\tstatic override props = textShapeProps\n\tstatic override migrations = textShapeMigrations\n\n\toverride options: TextShapeOptions = {\n\t\textraArrowHorizontalPadding: 10,\n\t}\n\n\tgetDefaultProps(): TLTextShape['props'] {\n\t\treturn {\n\t\t\tcolor: 'black',\n\t\t\tsize: 'm',\n\t\t\tw: 8,\n\t\t\tfont: 'draw',\n\t\t\ttextAlign: 'start',\n\t\t\tautoSize: true,\n\t\t\tscale: 1,\n\t\t\trichText: toRichText(''),\n\t\t}\n\t}\n\n\tgetMinDimensions(shape: TLTextShape) {\n\t\treturn sizeCache.get(this.editor, shape.id)!\n\t}\n\n\tgetGeometry(shape: TLTextShape, opts: TLGeometryOpts) {\n\t\tconst { scale } = shape.props\n\t\tconst { width, height } = this.getMinDimensions(shape)!\n\t\tconst context = opts?.context ?? 'none'\n\t\treturn new Rectangle2d({\n\t\t\tx:\n\t\t\t\t(context === '@tldraw/arrow-without-arrowhead'\n\t\t\t\t\t? -this.options.extraArrowHorizontalPadding\n\t\t\t\t\t: 0) * scale,\n\t\t\twidth:\n\t\t\t\t(width +\n\t\t\t\t\t(context === '@tldraw/arrow-without-arrowhead'\n\t\t\t\t\t\t? this.options.extraArrowHorizontalPadding * 2\n\t\t\t\t\t\t: 0)) *\n\t\t\t\tscale,\n\t\t\theight: height * scale,\n\t\t\tisFilled: true,\n\t\t\tisLabel: true,\n\t\t})\n\t}\n\n\toverride getFontFaces(shape: TLTextShape) {\n\t\t// no need for an empty rich text check here\n\t\treturn getFontsFromRichText(this.editor, shape.props.richText, {\n\t\t\tfamily: `tldraw_${shape.props.font}`,\n\t\t\tweight: 'normal',\n\t\t\tstyle: 'normal',\n\t\t})\n\t}\n\n\toverride getText(shape: TLTextShape) {\n\t\treturn renderPlaintextFromRichText(this.editor, shape.props.richText)\n\t}\n\n\toverride canEdit() {\n\t\treturn true\n\t}\n\n\toverride isAspectRatioLocked() {\n\t\treturn true\n\t} // WAIT NO THIS IS HARD CODED IN THE RESIZE HANDLER\n\n\tcomponent(shape: TLTextShape) {\n\t\tconst {\n\t\t\tid,\n\t\t\tprops: { font, size, richText, color, scale, textAlign },\n\t\t} = shape\n\n\t\tconst { width, height } = this.getMinDimensions(shape)\n\t\tconst isSelected = shape.id === this.editor.getOnlySelectedShapeId()\n\t\tconst theme = useDefaultColorTheme()\n\t\tconst handleKeyDown = useTextShapeKeydownHandler(id)\n\n\t\treturn (\n\t\t\t<RichTextLabel\n\t\t\t\tshapeId={id}\n\t\t\t\tclassNamePrefix=\"tl-text-shape\"\n\t\t\t\ttype=\"text\"\n\t\t\t\tfont={font}\n\t\t\t\tfontSize={FONT_SIZES[size]}\n\t\t\t\tlineHeight={TEXT_PROPS.lineHeight}\n\t\t\t\talign={textAlign}\n\t\t\t\tverticalAlign=\"middle\"\n\t\t\t\trichText={richText}\n\t\t\t\tlabelColor={getColorValue(theme, color, 'solid')}\n\t\t\t\tisSelected={isSelected}\n\t\t\t\ttextWidth={width}\n\t\t\t\ttextHeight={height}\n\t\t\t\tstyle={{\n\t\t\t\t\ttransform: `scale(${scale})`,\n\t\t\t\t\ttransformOrigin: 'top left',\n\t\t\t\t}}\n\t\t\t\twrap\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t/>\n\t\t)\n\t}\n\n\tindicator(shape: TLTextShape) {\n\t\tconst bounds = this.editor.getShapeGeometry(shape).bounds\n\t\tconst editor = useEditor()\n\t\tif (shape.props.autoSize && editor.getEditingShapeId() === shape.id) return null\n\t\treturn <rect width={toDomPrecision(bounds.width)} height={toDomPrecision(bounds.height)} />\n\t}\n\n\toverride toSvg(shape: TLTextShape, ctx: SvgExportContext) {\n\t\tconst bounds = this.editor.getShapeGeometry(shape).bounds\n\t\tconst width = bounds.width / (shape.props.scale ?? 1)\n\t\tconst height = bounds.height / (shape.props.scale ?? 1)\n\n\t\tconst theme = getDefaultColorTheme(ctx)\n\n\t\tconst exportBounds = new Box(0, 0, width, height)\n\t\treturn (\n\t\t\t<RichTextSVG\n\t\t\t\tfontSize={FONT_SIZES[shape.props.size]}\n\t\t\t\tfont={shape.props.font}\n\t\t\t\talign={shape.props.textAlign}\n\t\t\t\tverticalAlign=\"middle\"\n\t\t\t\trichText={shape.props.richText}\n\t\t\t\tlabelColor={getColorValue(theme, shape.props.color, 'solid')}\n\t\t\t\tbounds={exportBounds}\n\t\t\t\tpadding={0}\n\t\t\t/>\n\t\t)\n\t}\n\n\toverride onResize(shape: TLTextShape, info: TLResizeInfo<TLTextShape>) {\n\t\tconst { newPoint, initialBounds, initialShape, scaleX, handle } = info\n\n\t\tif (info.mode === 'scale_shape' || (handle !== 'right' && handle !== 'left')) {\n\t\t\treturn {\n\t\t\t\tid: shape.id,\n\t\t\t\ttype: shape.type,\n\t\t\t\t...resizeScaled(shape, info),\n\t\t\t}\n\t\t} else {\n\t\t\tconst nextWidth = Math.max(1, Math.abs(initialBounds.width * scaleX))\n\t\t\tconst { x, y } =\n\t\t\t\tscaleX < 0 ? Vec.Sub(newPoint, Vec.FromAngle(shape.rotation).mul(nextWidth)) : newPoint\n\n\t\t\treturn {\n\t\t\t\tid: shape.id,\n\t\t\t\ttype: shape.type,\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\tprops: {\n\t\t\t\t\tw: nextWidth / initialShape.props.scale,\n\t\t\t\t\tautoSize: false,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\n\toverride onEditEnd(shape: TLTextShape) {\n\t\t// todo: find a way to check if the rich text has any nodes that aren't empty spaces\n\t\tconst trimmedText = renderPlaintextFromRichText(this.editor, shape.props.richText).trimEnd()\n\n\t\tif (trimmedText.length === 0) {\n\t\t\tthis.editor.deleteShapes([shape.id])\n\t\t}\n\t}\n\n\toverride onBeforeUpdate(prev: TLTextShape, next: TLTextShape) {\n\t\tif (!next.props.autoSize) return\n\n\t\tconst styleDidChange =\n\t\t\tprev.props.size !== next.props.size ||\n\t\t\tprev.props.textAlign !== next.props.textAlign ||\n\t\t\tprev.props.font !== next.props.font ||\n\t\t\t(prev.props.scale !== 1 && next.props.scale === 1)\n\n\t\tconst textDidChange = !isEqual(prev.props.richText, next.props.richText)\n\n\t\t// Only update position if either changed\n\t\tif (!styleDidChange && !textDidChange) return\n\n\t\t// Might return a cached value for the bounds\n\t\tconst boundsA = this.getMinDimensions(prev)\n\n\t\t// Will always be a fresh call to getTextSize\n\t\tconst boundsB = getTextSize(this.editor, next.props)\n\n\t\tconst wA = boundsA.width * prev.props.scale\n\t\tconst hA = boundsA.height * prev.props.scale\n\t\tconst wB = boundsB.width * next.props.scale\n\t\tconst hB = boundsB.height * next.props.scale\n\n\t\tlet delta: Vec | undefined\n\n\t\tswitch (next.props.textAlign) {\n\t\t\tcase 'middle': {\n\t\t\t\tdelta = new Vec((wB - wA) / 2, textDidChange ? 0 : (hB - hA) / 2)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'end': {\n\t\t\t\tdelta = new Vec(wB - wA, textDidChange ? 0 : (hB - hA) / 2)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tif (textDidChange) break\n\t\t\t\tdelta = new Vec(0, (hB - hA) / 2)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif (delta) {\n\t\t\t// account for shape rotation when writing text:\n\t\t\tdelta.rot(next.rotation)\n\t\t\tconst { x, y } = next\n\t\t\treturn {\n\t\t\t\t...next,\n\t\t\t\tx: x - delta.x,\n\t\t\t\ty: y - delta.y,\n\t\t\t\tprops: { ...next.props, w: wB },\n\t\t\t}\n\t\t} else {\n\t\t\treturn {\n\t\t\t\t...next,\n\t\t\t\tprops: { ...next.props, w: wB },\n\t\t\t}\n\t\t}\n\t}\n\n\t// \ttodo: The edge doubleclicking feels like a mistake more often than\n\t// not, especially on multiline text. Removed June 16 2024\n\n\t// override onDoubleClickEdge = (shape: TLTextShape) => {\n\t// \t// If the shape has a fixed width, set it to autoSize.\n\t// \tif (!shape.props.autoSize) {\n\t// \t\treturn {\n\t// \t\t\tid: shape.id,\n\t// \t\t\ttype: shape.type,\n\t// \t\t\tprops: {\n\t// \t\t\t\tautoSize: true,\n\t// \t\t\t},\n\t// \t\t}\n\t// \t}\n\t// \t// If the shape is scaled, reset the scale to 1.\n\t// \tif (shape.props.scale !== 1) {\n\t// \t\treturn {\n\t// \t\t\tid: shape.id,\n\t// \t\t\ttype: shape.type,\n\t// \t\t\tprops: {\n\t// \t\t\t\tscale: 1,\n\t// \t\t\t},\n\t// \t\t}\n\t// \t}\n\t// }\n}\n\nfunction getTextSize(editor: Editor, props: TLTextShape['props']) {\n\tconst { font, richText, size, w } = props\n\n\tconst minWidth = 16\n\tconst fontSize = FONT_SIZES[size]\n\n\tconst maybeFixedWidth = props.autoSize ? null : Math.max(minWidth, Math.floor(w))\n\n\tconst html = renderHtmlFromRichTextForMeasurement(editor, richText)\n\tconst result = editor.textMeasure.measureHtml(html, {\n\t\t...TEXT_PROPS,\n\t\tfontFamily: FONT_FAMILIES[font],\n\t\tfontSize: fontSize,\n\t\tmaxWidth: maybeFixedWidth,\n\t})\n\n\t// If we're autosizing the measureText will essentially `Math.floor`\n\t// the numbers so `19` rather than `19.3`, this means we must +1 to\n\t// whatever we get to avoid wrapping.\n\treturn {\n\t\twidth: maybeFixedWidth ?? Math.max(minWidth, result.w + 1),\n\t\theight: Math.max(fontSize, result.h),\n\t}\n}\n\nfunction useTextShapeKeydownHandler(id: TLShapeId) {\n\tconst editor = useEditor()\n\n\treturn useCallback(\n\t\t(e: KeyboardEvent) => {\n\t\t\tif (editor.getEditingShapeId() !== id) return\n\n\t\t\tswitch (e.key) {\n\t\t\t\tcase 'Enter': {\n\t\t\t\t\tif (e.ctrlKey || e.metaKey) {\n\t\t\t\t\t\teditor.complete()\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[editor, id]\n\t)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgIG;AA/HH,oBAsBO;AACP,mBAA4B;AAC5B,sBAGO;AACP,2BAA2C;AAC3C,qCAAsD;AACtD,kCAAqC;AAErC,MAAM,gBAAY;AAAA,EACjB;AAAA,EACA,CAAC,QAAgB,UAAuB;AACvC,WAAO,MAAM,mBAAmB,KAAK;AACrC,WAAO,YAAY,QAAQ,MAAM,KAAK;AAAA,EACvC;AAAA,EACA,EAAE,iBAAiB,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM;AAClD;AAQO,MAAM,sBAAsB,wBAAuB;AAAA,EACzD,OAAgB,OAAO;AAAA,EACvB,OAAgB,QAAQ;AAAA,EACxB,OAAgB,aAAa;AAAA,EAEpB,UAA4B;AAAA,IACpC,6BAA6B;AAAA,EAC9B;AAAA,EAEA,kBAAwC;AACvC,WAAO;AAAA,MACN,OAAO;AAAA,MACP,MAAM;AAAA,MACN,GAAG;AAAA,MACH,MAAM;AAAA,MACN,WAAW;AAAA,MACX,UAAU;AAAA,MACV,OAAO;AAAA,MACP,cAAU,0BAAW,EAAE;AAAA,IACxB;AAAA,EACD;AAAA,EAEA,iBAAiB,OAAoB;AACpC,WAAO,UAAU,IAAI,KAAK,QAAQ,MAAM,EAAE;AAAA,EAC3C;AAAA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,CAAC;AAEhF,QAAM,WAAO,sDAAqC,QAAQ,QAAQ;AAClE,QAAM,SAAS,OAAO,YAAY,YAAY,MAAM;AAAA,IACnD,GAAG;AAAA,IACH,YAAY,6CAAc,IAAI;AAAA,IAC9B;AAAA,IACA,UAAU;AAAA,EACX,CAAC;AAKD,SAAO;AAAA,IACN,OAAO,mBAAmB,KAAK,IAAI,UAAU,OAAO,IAAI,CAAC;AAAA,IACzD,QAAQ,KAAK,IAAI,UAAU,OAAO,CAAC;AAAA,EACpC;AACD;AAEA,SAAS,2BAA2B,IAAe;AAClD,QAAM,aAAS,yBAAU;AAEzB,aAAO;AAAA,IACN,CAAC,MAAqB;AACrB,UAAI,OAAO,kBAAkB,MAAM,GAAI;AAEvC,cAAQ,EAAE,KAAK;AAAA,QACd,KAAK,SAAS;AACb,cAAI,EAAE,WAAW,EAAE,SAAS;AAC3B,mBAAO,SAAS;AAAA,UACjB;AACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAC,QAAQ,EAAE;AAAA,EACZ;AACD;",
4
+ "sourcesContent": ["/* eslint-disable react-hooks/rules-of-hooks */\nimport {\n\tBox,\n\tEditor,\n\tRectangle2d,\n\tShapeUtil,\n\tSvgExportContext,\n\tTLGeometryOpts,\n\tTLResizeInfo,\n\tTLShapeId,\n\tTLTextShape,\n\tVec,\n\tcreateComputedCache,\n\tgetDefaultColorTheme,\n\tgetFontsFromRichText,\n\tisEqual,\n\tresizeScaled,\n\ttextShapeMigrations,\n\ttextShapeProps,\n\ttoDomPrecision,\n\ttoRichText,\n\tuseEditor,\n} from '@tldraw/editor'\nimport { useCallback } from 'react'\nimport {\n\trenderHtmlFromRichTextForMeasurement,\n\trenderPlaintextFromRichText,\n} from '../../utils/text/richText'\nimport { RichTextLabel, RichTextSVG } from '../shared/RichTextLabel'\nimport { FONT_FAMILIES, FONT_SIZES, TEXT_PROPS } from '../shared/default-shape-constants'\nimport { useDefaultColorTheme } from '../shared/useDefaultColorTheme'\n\nconst sizeCache = createComputedCache(\n\t'text size',\n\t(editor: Editor, shape: TLTextShape) => {\n\t\teditor.fonts.trackFontsForShape(shape)\n\t\treturn getTextSize(editor, shape.props)\n\t},\n\t{ areRecordsEqual: (a, b) => a.props === b.props }\n)\n/** @public */\nexport interface TextShapeOptions {\n\t/** How much addition padding should be added to the horizontal geometry of the shape when binding to an arrow? */\n\textraArrowHorizontalPadding: number\n}\n\n/** @public */\nexport class TextShapeUtil extends ShapeUtil<TLTextShape> {\n\tstatic override type = 'text' as const\n\tstatic override props = textShapeProps\n\tstatic override migrations = textShapeMigrations\n\n\toverride options: TextShapeOptions = {\n\t\textraArrowHorizontalPadding: 10,\n\t}\n\n\tgetDefaultProps(): TLTextShape['props'] {\n\t\treturn {\n\t\t\tcolor: 'black',\n\t\t\tsize: 'm',\n\t\t\tw: 8,\n\t\t\tfont: 'draw',\n\t\t\ttextAlign: 'start',\n\t\t\tautoSize: true,\n\t\t\tscale: 1,\n\t\t\trichText: toRichText(''),\n\t\t}\n\t}\n\n\tgetMinDimensions(shape: TLTextShape) {\n\t\treturn sizeCache.get(this.editor, shape.id)!\n\t}\n\n\tgetGeometry(shape: TLTextShape, opts: TLGeometryOpts) {\n\t\tconst { scale } = shape.props\n\t\tconst { width, height } = this.getMinDimensions(shape)!\n\t\tconst context = opts?.context ?? 'none'\n\t\treturn new Rectangle2d({\n\t\t\tx:\n\t\t\t\t(context === '@tldraw/arrow-without-arrowhead'\n\t\t\t\t\t? -this.options.extraArrowHorizontalPadding\n\t\t\t\t\t: 0) * scale,\n\t\t\twidth:\n\t\t\t\t(width +\n\t\t\t\t\t(context === '@tldraw/arrow-without-arrowhead'\n\t\t\t\t\t\t? this.options.extraArrowHorizontalPadding * 2\n\t\t\t\t\t\t: 0)) *\n\t\t\t\tscale,\n\t\t\theight: height * scale,\n\t\t\tisFilled: true,\n\t\t\tisLabel: true,\n\t\t})\n\t}\n\n\toverride getFontFaces(shape: TLTextShape) {\n\t\t// no need for an empty rich text check here\n\t\treturn getFontsFromRichText(this.editor, shape.props.richText, {\n\t\t\tfamily: `tldraw_${shape.props.font}`,\n\t\t\tweight: 'normal',\n\t\t\tstyle: 'normal',\n\t\t})\n\t}\n\n\toverride getText(shape: TLTextShape) {\n\t\treturn renderPlaintextFromRichText(this.editor, shape.props.richText)\n\t}\n\n\toverride canEdit() {\n\t\treturn true\n\t}\n\n\toverride isAspectRatioLocked() {\n\t\treturn true\n\t} // WAIT NO THIS IS HARD CODED IN THE RESIZE HANDLER\n\n\tcomponent(shape: TLTextShape) {\n\t\tconst {\n\t\t\tid,\n\t\t\tprops: { font, size, richText, color, scale, textAlign },\n\t\t} = shape\n\n\t\tconst { width, height } = this.getMinDimensions(shape)\n\t\tconst isSelected = shape.id === this.editor.getOnlySelectedShapeId()\n\t\tconst theme = useDefaultColorTheme()\n\t\tconst handleKeyDown = useTextShapeKeydownHandler(id)\n\n\t\treturn (\n\t\t\t<RichTextLabel\n\t\t\t\tshapeId={id}\n\t\t\t\tclassNamePrefix=\"tl-text-shape\"\n\t\t\t\ttype=\"text\"\n\t\t\t\tfont={font}\n\t\t\t\tfontSize={FONT_SIZES[size]}\n\t\t\t\tlineHeight={TEXT_PROPS.lineHeight}\n\t\t\t\talign={textAlign}\n\t\t\t\tverticalAlign=\"middle\"\n\t\t\t\trichText={richText}\n\t\t\t\tlabelColor={theme[color].solid}\n\t\t\t\tisSelected={isSelected}\n\t\t\t\ttextWidth={width}\n\t\t\t\ttextHeight={height}\n\t\t\t\tstyle={{\n\t\t\t\t\ttransform: `scale(${scale})`,\n\t\t\t\t\ttransformOrigin: 'top left',\n\t\t\t\t}}\n\t\t\t\twrap\n\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t/>\n\t\t)\n\t}\n\n\tindicator(shape: TLTextShape) {\n\t\tconst bounds = this.editor.getShapeGeometry(shape).bounds\n\t\tconst editor = useEditor()\n\t\tif (shape.props.autoSize && editor.getEditingShapeId() === shape.id) return null\n\t\treturn <rect width={toDomPrecision(bounds.width)} height={toDomPrecision(bounds.height)} />\n\t}\n\n\toverride toSvg(shape: TLTextShape, ctx: SvgExportContext) {\n\t\tconst bounds = this.editor.getShapeGeometry(shape).bounds\n\t\tconst width = bounds.width / (shape.props.scale ?? 1)\n\t\tconst height = bounds.height / (shape.props.scale ?? 1)\n\n\t\tconst theme = getDefaultColorTheme(ctx)\n\n\t\tconst exportBounds = new Box(0, 0, width, height)\n\t\treturn (\n\t\t\t<RichTextSVG\n\t\t\t\tfontSize={FONT_SIZES[shape.props.size]}\n\t\t\t\tfont={shape.props.font}\n\t\t\t\talign={shape.props.textAlign}\n\t\t\t\tverticalAlign=\"middle\"\n\t\t\t\trichText={shape.props.richText}\n\t\t\t\tlabelColor={theme[shape.props.color].solid}\n\t\t\t\tbounds={exportBounds}\n\t\t\t\tpadding={0}\n\t\t\t/>\n\t\t)\n\t}\n\n\toverride onResize(shape: TLTextShape, info: TLResizeInfo<TLTextShape>) {\n\t\tconst { newPoint, initialBounds, initialShape, scaleX, handle } = info\n\n\t\tif (info.mode === 'scale_shape' || (handle !== 'right' && handle !== 'left')) {\n\t\t\treturn {\n\t\t\t\tid: shape.id,\n\t\t\t\ttype: shape.type,\n\t\t\t\t...resizeScaled(shape, info),\n\t\t\t}\n\t\t} else {\n\t\t\tconst nextWidth = Math.max(1, Math.abs(initialBounds.width * scaleX))\n\t\t\tconst { x, y } =\n\t\t\t\tscaleX < 0 ? Vec.Sub(newPoint, Vec.FromAngle(shape.rotation).mul(nextWidth)) : newPoint\n\n\t\t\treturn {\n\t\t\t\tid: shape.id,\n\t\t\t\ttype: shape.type,\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\tprops: {\n\t\t\t\t\tw: nextWidth / initialShape.props.scale,\n\t\t\t\t\tautoSize: false,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t}\n\n\toverride onEditEnd(shape: TLTextShape) {\n\t\t// todo: find a way to check if the rich text has any nodes that aren't empty spaces\n\t\tconst trimmedText = renderPlaintextFromRichText(this.editor, shape.props.richText).trimEnd()\n\n\t\tif (trimmedText.length === 0) {\n\t\t\tthis.editor.deleteShapes([shape.id])\n\t\t}\n\t}\n\n\toverride onBeforeUpdate(prev: TLTextShape, next: TLTextShape) {\n\t\tif (!next.props.autoSize) return\n\n\t\tconst styleDidChange =\n\t\t\tprev.props.size !== next.props.size ||\n\t\t\tprev.props.textAlign !== next.props.textAlign ||\n\t\t\tprev.props.font !== next.props.font ||\n\t\t\t(prev.props.scale !== 1 && next.props.scale === 1)\n\n\t\tconst textDidChange = !isEqual(prev.props.richText, next.props.richText)\n\n\t\t// Only update position if either changed\n\t\tif (!styleDidChange && !textDidChange) return\n\n\t\t// Might return a cached value for the bounds\n\t\tconst boundsA = this.getMinDimensions(prev)\n\n\t\t// Will always be a fresh call to getTextSize\n\t\tconst boundsB = getTextSize(this.editor, next.props)\n\n\t\tconst wA = boundsA.width * prev.props.scale\n\t\tconst hA = boundsA.height * prev.props.scale\n\t\tconst wB = boundsB.width * next.props.scale\n\t\tconst hB = boundsB.height * next.props.scale\n\n\t\tlet delta: Vec | undefined\n\n\t\tswitch (next.props.textAlign) {\n\t\t\tcase 'middle': {\n\t\t\t\tdelta = new Vec((wB - wA) / 2, textDidChange ? 0 : (hB - hA) / 2)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase 'end': {\n\t\t\t\tdelta = new Vec(wB - wA, textDidChange ? 0 : (hB - hA) / 2)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tif (textDidChange) break\n\t\t\t\tdelta = new Vec(0, (hB - hA) / 2)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif (delta) {\n\t\t\t// account for shape rotation when writing text:\n\t\t\tdelta.rot(next.rotation)\n\t\t\tconst { x, y } = next\n\t\t\treturn {\n\t\t\t\t...next,\n\t\t\t\tx: x - delta.x,\n\t\t\t\ty: y - delta.y,\n\t\t\t\tprops: { ...next.props, w: wB },\n\t\t\t}\n\t\t} else {\n\t\t\treturn {\n\t\t\t\t...next,\n\t\t\t\tprops: { ...next.props, w: wB },\n\t\t\t}\n\t\t}\n\t}\n\n\t// \ttodo: The edge doubleclicking feels like a mistake more often than\n\t// not, especially on multiline text. Removed June 16 2024\n\n\t// override onDoubleClickEdge = (shape: TLTextShape) => {\n\t// \t// If the shape has a fixed width, set it to autoSize.\n\t// \tif (!shape.props.autoSize) {\n\t// \t\treturn {\n\t// \t\t\tid: shape.id,\n\t// \t\t\ttype: shape.type,\n\t// \t\t\tprops: {\n\t// \t\t\t\tautoSize: true,\n\t// \t\t\t},\n\t// \t\t}\n\t// \t}\n\t// \t// If the shape is scaled, reset the scale to 1.\n\t// \tif (shape.props.scale !== 1) {\n\t// \t\treturn {\n\t// \t\t\tid: shape.id,\n\t// \t\t\ttype: shape.type,\n\t// \t\t\tprops: {\n\t// \t\t\t\tscale: 1,\n\t// \t\t\t},\n\t// \t\t}\n\t// \t}\n\t// }\n}\n\nfunction getTextSize(editor: Editor, props: TLTextShape['props']) {\n\tconst { font, richText, autoSize, size, w } = props\n\n\tconst minWidth = autoSize ? 16 : Math.max(16, w)\n\tconst fontSize = FONT_SIZES[size]\n\n\tconst cw = autoSize\n\t\t? null\n\t\t: // `measureText` floors the number so we need to do the same here to avoid issues.\n\t\t\tMath.floor(Math.max(minWidth, w))\n\n\tconst html = renderHtmlFromRichTextForMeasurement(editor, richText)\n\tconst result = editor.textMeasure.measureHtml(html, {\n\t\t...TEXT_PROPS,\n\t\tfontFamily: FONT_FAMILIES[font],\n\t\tfontSize: fontSize,\n\t\tmaxWidth: cw,\n\t})\n\n\t// If we're autosizing the measureText will essentially `Math.floor`\n\t// the numbers so `19` rather than `19.3`, this means we must +1 to\n\t// whatever we get to avoid wrapping.\n\tif (autoSize) {\n\t\tresult.w += 1\n\t}\n\n\treturn {\n\t\twidth: Math.max(minWidth, result.w),\n\t\theight: Math.max(fontSize, result.h),\n\t}\n}\n\nfunction useTextShapeKeydownHandler(id: TLShapeId) {\n\tconst editor = useEditor()\n\n\treturn useCallback(\n\t\t(e: KeyboardEvent) => {\n\t\t\tif (editor.getEditingShapeId() !== id) return\n\n\t\t\tswitch (e.key) {\n\t\t\t\tcase 'Enter': {\n\t\t\t\t\tif (e.ctrlKey || e.metaKey) {\n\t\t\t\t\t\teditor.complete()\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[editor, id]\n\t)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+HG;AA9HH,oBAqBO;AACP,mBAA4B;AAC5B,sBAGO;AACP,2BAA2C;AAC3C,qCAAsD;AACtD,kCAAqC;AAErC,MAAM,gBAAY;AAAA,EACjB;AAAA,EACA,CAAC,QAAgB,UAAuB;AACvC,WAAO,MAAM,mBAAmB,KAAK;AACrC,WAAO,YAAY,QAAQ,MAAM,KAAK;AAAA,EACvC;AAAA,EACA,EAAE,iBAAiB,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM;AAClD;AAQO,MAAM,sBAAsB,wBAAuB;AAAA,EACzD,OAAgB,OAAO;AAAA,EACvB,OAAgB,QAAQ;AAAA,EACxB,OAAgB,aAAa;AAAA,EAEpB,UAA4B;AAAA,IACpC,6BAA6B;AAAA,EAC9B;AAAA,EAEA,kBAAwC;AACvC,WAAO;AAAA,MACN,OAAO;AAAA,MACP,MAAM;AAAA,MACN,GAAG;AAAA,MACH,MAAM;AAAA,MACN,WAAW;AAAA,MACX,UAAU;AAAA,MACV,OAAO;AAAA,MACP,cAAU,0BAAW,EAAE;AAAA,IACxB;AAAA,EACD;AAAA,EAEA,iBAAiB,OAAoB;AACpC,WAAO,UAAU,IAAI,KAAK,QAAQ,MAAM,EAAE;AAAA,EAC3C;AAAA,EAEA,YAAY,OAAoB,MAAsB;AACrD,UAAM,EAAE,MAAM,IAAI,MAAM;AACxB,UAAM,EAAE,OAAO,OAAO,IAAI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AAO,YAAY,YAAY,MAAM;AAAA,IACnD,GAAG;AAAA,IACH,YAAY,6CAAc,IAAI;AAAA,IAC9B;AAAA,IACA,UAAU;AAAA,EACX,CAAC;AAKD,MAAI,UAAU;AACb,WAAO,KAAK;AAAA,EACb;AAEA,SAAO;AAAA,IACN,OAAO,KAAK,IAAI,UAAU,OAAO,CAAC;AAAA,IAClC,QAAQ,KAAK,IAAI,UAAU,OAAO,CAAC;AAAA,EACpC;AACD;AAEA,SAAS,2BAA2B,IAAe;AAClD,QAAM,aAAS,yBAAU;AAEzB,aAAO;AAAA,IACN,CAAC,MAAqB;AACrB,UAAI,OAAO,kBAAkB,MAAM,GAAI;AAEvC,cAAQ,EAAE,KAAK;AAAA,QACd,KAAK,SAAS;AACb,cAAI,EAAE,WAAW,EAAE,SAAS;AAC3B,mBAAO,SAAS;AAAA,UACjB;AACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAC,QAAQ,EAAE;AAAA,EACZ;AACD;",
6
6
  "names": []
7
7
  }
@@ -129,9 +129,9 @@ const VideoShape = (0, import_react.memo)(function VideoShape2({ shape }) {
129
129
  {
130
130
  id: shape.id,
131
131
  style: {
132
- color: "var(--tl-color-text-3)",
133
- backgroundColor: asset ? "transparent" : "var(--tl-color-low)",
134
- border: asset ? "none" : "1px solid var(--tl-color-low-border)"
132
+ color: "var(--color-text-3)",
133
+ backgroundColor: asset ? "transparent" : "var(--color-low)",
134
+ border: asset ? "none" : "1px solid var(--color-low-border)"
135
135
  },
136
136
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tl-counter-scaled", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tl-video-container", children: !asset ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BrokenAssetIcon.BrokenAssetIcon, {}) : Spinner && !asset.props.src ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}) : url ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
137
137
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/shapes/video/VideoShapeUtil.tsx"],
4
- "sourcesContent": ["import {\n\tBaseBoxShapeUtil,\n\tHTMLContainer,\n\tMediaHelpers,\n\tSvgExportContext,\n\tTLAsset,\n\tTLVideoShape,\n\tWeakCache,\n\ttoDomPrecision,\n\tuseEditor,\n\tuseEditorComponents,\n\tuseIsEditing,\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n} from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { ReactEventHandler, memo, useCallback, useEffect, useRef, useState } from 'react'\nimport { BrokenAssetIcon } from '../shared/BrokenAssetIcon'\nimport { HyperlinkButton } from '../shared/HyperlinkButton'\nimport { useImageOrVideoAsset } from '../shared/useImageOrVideoAsset'\nimport { usePrefersReducedMotion } from '../shared/usePrefersReducedMotion'\n\nconst videoSvgExportCache = new WeakCache<TLAsset, Promise<string | null>>()\n\n/** @public */\nexport interface VideoShapeOptions {\n\t/**\n\t * Should videos play automatically?\n\t */\n\tautoplay: boolean\n}\n\n/** @public */\nexport class VideoShapeUtil extends BaseBoxShapeUtil<TLVideoShape> {\n\tstatic override type = 'video' as const\n\tstatic override props = videoShapeProps\n\tstatic override migrations = videoShapeMigrations\n\n\toverride options: VideoShapeOptions = {\n\t\tautoplay: true,\n\t}\n\n\toverride canEdit() {\n\t\treturn true\n\t}\n\toverride isAspectRatioLocked() {\n\t\treturn true\n\t}\n\n\toverride getDefaultProps(): TLVideoShape['props'] {\n\t\treturn {\n\t\t\tw: 100,\n\t\t\th: 100,\n\t\t\tassetId: null,\n\t\t\tautoplay: this.options.autoplay,\n\t\t\turl: '',\n\t\t\taltText: '',\n\t\t\t// Not used, but once upon a time were used to sync video state between users\n\t\t\ttime: 0,\n\t\t\tplaying: true,\n\t\t}\n\t}\n\n\toverride getAriaDescriptor(shape: TLVideoShape) {\n\t\treturn shape.props.altText\n\t}\n\n\tcomponent(shape: TLVideoShape) {\n\t\treturn <VideoShape shape={shape} />\n\t}\n\n\tindicator(shape: TLVideoShape) {\n\t\treturn <rect width={toDomPrecision(shape.props.w)} height={toDomPrecision(shape.props.h)} />\n\t}\n\n\toverride async toSvg(shape: TLVideoShape, ctx: SvgExportContext) {\n\t\tconst props = shape.props\n\t\tif (!props.assetId) return null\n\n\t\tconst asset = this.editor.getAsset<TLAsset>(props.assetId)\n\t\tif (!asset) return null\n\n\t\tconst src = await videoSvgExportCache.get(asset, async () => {\n\t\t\tconst assetUrl = await ctx.resolveAssetUrl(asset.id, props.w)\n\t\t\tif (!assetUrl) return null\n\t\t\tconst video = await MediaHelpers.loadVideo(assetUrl)\n\t\t\treturn await MediaHelpers.getVideoFrameAsDataUrl(video, 0)\n\t\t})\n\n\t\tif (!src) return null\n\n\t\treturn <image href={src} width={props.w} height={props.h} aria-label={shape.props.altText} />\n\t}\n}\n\nconst VideoShape = memo(function VideoShape({ shape }: { shape: TLVideoShape }) {\n\tconst editor = useEditor()\n\tconst showControls = editor.getShapeGeometry(shape).bounds.w * editor.getZoomLevel() >= 110\n\tconst isEditing = useIsEditing(shape.id)\n\tconst prefersReducedMotion = usePrefersReducedMotion()\n\tconst { Spinner } = useEditorComponents()\n\n\tconst { asset, url } = useImageOrVideoAsset({\n\t\tshapeId: shape.id,\n\t\tassetId: shape.props.assetId,\n\t\twidth: shape.props.w,\n\t})\n\n\tconst rVideo = useRef<HTMLVideoElement>(null!)\n\n\tconst [isLoaded, setIsLoaded] = useState(false)\n\n\tconst handleLoadedData = useCallback<ReactEventHandler<HTMLVideoElement>>((e) => {\n\t\tconst video = e.currentTarget\n\t\tif (!video) return\n\t\tsetIsLoaded(true)\n\t}, [])\n\n\tconst [isFullscreen, setIsFullscreen] = useState(false)\n\n\tuseEffect(() => {\n\t\tconst fullscreenChange = () => setIsFullscreen(document.fullscreenElement === rVideo.current)\n\t\tdocument.addEventListener('fullscreenchange', fullscreenChange)\n\n\t\treturn () => document.removeEventListener('fullscreenchange', fullscreenChange)\n\t})\n\n\t// Focus the video when editing\n\tuseEffect(() => {\n\t\tconst video = rVideo.current\n\t\tif (!video) return\n\n\t\tif (isEditing) {\n\t\t\tif (document.activeElement !== video) {\n\t\t\t\tvideo.focus()\n\t\t\t}\n\t\t}\n\t}, [isEditing, isLoaded])\n\n\treturn (\n\t\t<>\n\t\t\t<HTMLContainer\n\t\t\t\tid={shape.id}\n\t\t\t\tstyle={{\n\t\t\t\t\tcolor: 'var(--tl-color-text-3)',\n\t\t\t\t\tbackgroundColor: asset ? 'transparent' : 'var(--tl-color-low)',\n\t\t\t\t\tborder: asset ? 'none' : '1px solid var(--tl-color-low-border)',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div className=\"tl-counter-scaled\">\n\t\t\t\t\t<div className=\"tl-video-container\">\n\t\t\t\t\t\t{!asset ? (\n\t\t\t\t\t\t\t<BrokenAssetIcon />\n\t\t\t\t\t\t) : Spinner && !asset.props.src ? (\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t) : url ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<video\n\t\t\t\t\t\t\t\t\tkey={url}\n\t\t\t\t\t\t\t\t\tref={rVideo}\n\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\tisEditing\n\t\t\t\t\t\t\t\t\t\t\t? { pointerEvents: 'all' }\n\t\t\t\t\t\t\t\t\t\t\t: !isLoaded\n\t\t\t\t\t\t\t\t\t\t\t\t? { display: 'none' }\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={classNames('tl-video', `tl-video-shape-${shape.id.split(':')[1]}`, {\n\t\t\t\t\t\t\t\t\t\t'tl-video-is-fullscreen': isFullscreen,\n\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t\theight=\"100%\"\n\t\t\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\t\t\tplaysInline\n\t\t\t\t\t\t\t\t\tautoPlay={shape.props.autoplay && !prefersReducedMotion}\n\t\t\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\t\t\tdisableRemotePlayback\n\t\t\t\t\t\t\t\t\tdisablePictureInPicture\n\t\t\t\t\t\t\t\t\tcontrols={isEditing && showControls}\n\t\t\t\t\t\t\t\t\tonLoadedData={handleLoadedData}\n\t\t\t\t\t\t\t\t\thidden={!isLoaded}\n\t\t\t\t\t\t\t\t\taria-label={shape.props.altText}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<source src={url} />\n\t\t\t\t\t\t\t\t</video>\n\t\t\t\t\t\t\t\t{!isLoaded && Spinner && <Spinner />}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</HTMLContainer>\n\t\t\t{'url' in shape.props && shape.props.url && <HyperlinkButton url={shape.props.url} />}\n\t\t</>\n\t)\n})\n"],
4
+ "sourcesContent": ["import {\n\tBaseBoxShapeUtil,\n\tHTMLContainer,\n\tMediaHelpers,\n\tSvgExportContext,\n\tTLAsset,\n\tTLVideoShape,\n\tWeakCache,\n\ttoDomPrecision,\n\tuseEditor,\n\tuseEditorComponents,\n\tuseIsEditing,\n\tvideoShapeMigrations,\n\tvideoShapeProps,\n} from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { ReactEventHandler, memo, useCallback, useEffect, useRef, useState } from 'react'\nimport { BrokenAssetIcon } from '../shared/BrokenAssetIcon'\nimport { HyperlinkButton } from '../shared/HyperlinkButton'\nimport { useImageOrVideoAsset } from '../shared/useImageOrVideoAsset'\nimport { usePrefersReducedMotion } from '../shared/usePrefersReducedMotion'\n\nconst videoSvgExportCache = new WeakCache<TLAsset, Promise<string | null>>()\n\n/** @public */\nexport interface VideoShapeOptions {\n\t/**\n\t * Should videos play automatically?\n\t */\n\tautoplay: boolean\n}\n\n/** @public */\nexport class VideoShapeUtil extends BaseBoxShapeUtil<TLVideoShape> {\n\tstatic override type = 'video' as const\n\tstatic override props = videoShapeProps\n\tstatic override migrations = videoShapeMigrations\n\n\toverride options: VideoShapeOptions = {\n\t\tautoplay: true,\n\t}\n\n\toverride canEdit() {\n\t\treturn true\n\t}\n\toverride isAspectRatioLocked() {\n\t\treturn true\n\t}\n\n\toverride getDefaultProps(): TLVideoShape['props'] {\n\t\treturn {\n\t\t\tw: 100,\n\t\t\th: 100,\n\t\t\tassetId: null,\n\t\t\tautoplay: this.options.autoplay,\n\t\t\turl: '',\n\t\t\taltText: '',\n\t\t\t// Not used, but once upon a time were used to sync video state between users\n\t\t\ttime: 0,\n\t\t\tplaying: true,\n\t\t}\n\t}\n\n\toverride getAriaDescriptor(shape: TLVideoShape) {\n\t\treturn shape.props.altText\n\t}\n\n\tcomponent(shape: TLVideoShape) {\n\t\treturn <VideoShape shape={shape} />\n\t}\n\n\tindicator(shape: TLVideoShape) {\n\t\treturn <rect width={toDomPrecision(shape.props.w)} height={toDomPrecision(shape.props.h)} />\n\t}\n\n\toverride async toSvg(shape: TLVideoShape, ctx: SvgExportContext) {\n\t\tconst props = shape.props\n\t\tif (!props.assetId) return null\n\n\t\tconst asset = this.editor.getAsset<TLAsset>(props.assetId)\n\t\tif (!asset) return null\n\n\t\tconst src = await videoSvgExportCache.get(asset, async () => {\n\t\t\tconst assetUrl = await ctx.resolveAssetUrl(asset.id, props.w)\n\t\t\tif (!assetUrl) return null\n\t\t\tconst video = await MediaHelpers.loadVideo(assetUrl)\n\t\t\treturn await MediaHelpers.getVideoFrameAsDataUrl(video, 0)\n\t\t})\n\n\t\tif (!src) return null\n\n\t\treturn <image href={src} width={props.w} height={props.h} aria-label={shape.props.altText} />\n\t}\n}\n\nconst VideoShape = memo(function VideoShape({ shape }: { shape: TLVideoShape }) {\n\tconst editor = useEditor()\n\tconst showControls = editor.getShapeGeometry(shape).bounds.w * editor.getZoomLevel() >= 110\n\tconst isEditing = useIsEditing(shape.id)\n\tconst prefersReducedMotion = usePrefersReducedMotion()\n\tconst { Spinner } = useEditorComponents()\n\n\tconst { asset, url } = useImageOrVideoAsset({\n\t\tshapeId: shape.id,\n\t\tassetId: shape.props.assetId,\n\t\twidth: shape.props.w,\n\t})\n\n\tconst rVideo = useRef<HTMLVideoElement>(null!)\n\n\tconst [isLoaded, setIsLoaded] = useState(false)\n\n\tconst handleLoadedData = useCallback<ReactEventHandler<HTMLVideoElement>>((e) => {\n\t\tconst video = e.currentTarget\n\t\tif (!video) return\n\t\tsetIsLoaded(true)\n\t}, [])\n\n\tconst [isFullscreen, setIsFullscreen] = useState(false)\n\n\tuseEffect(() => {\n\t\tconst fullscreenChange = () => setIsFullscreen(document.fullscreenElement === rVideo.current)\n\t\tdocument.addEventListener('fullscreenchange', fullscreenChange)\n\n\t\treturn () => document.removeEventListener('fullscreenchange', fullscreenChange)\n\t})\n\n\t// Focus the video when editing\n\tuseEffect(() => {\n\t\tconst video = rVideo.current\n\t\tif (!video) return\n\n\t\tif (isEditing) {\n\t\t\tif (document.activeElement !== video) {\n\t\t\t\tvideo.focus()\n\t\t\t}\n\t\t}\n\t}, [isEditing, isLoaded])\n\n\treturn (\n\t\t<>\n\t\t\t<HTMLContainer\n\t\t\t\tid={shape.id}\n\t\t\t\tstyle={{\n\t\t\t\t\tcolor: 'var(--color-text-3)',\n\t\t\t\t\tbackgroundColor: asset ? 'transparent' : 'var(--color-low)',\n\t\t\t\t\tborder: asset ? 'none' : '1px solid var(--color-low-border)',\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div className=\"tl-counter-scaled\">\n\t\t\t\t\t<div className=\"tl-video-container\">\n\t\t\t\t\t\t{!asset ? (\n\t\t\t\t\t\t\t<BrokenAssetIcon />\n\t\t\t\t\t\t) : Spinner && !asset.props.src ? (\n\t\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t\t) : url ? (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<video\n\t\t\t\t\t\t\t\t\tkey={url}\n\t\t\t\t\t\t\t\t\tref={rVideo}\n\t\t\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t\t\tisEditing\n\t\t\t\t\t\t\t\t\t\t\t? { pointerEvents: 'all' }\n\t\t\t\t\t\t\t\t\t\t\t: !isLoaded\n\t\t\t\t\t\t\t\t\t\t\t\t? { display: 'none' }\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={classNames('tl-video', `tl-video-shape-${shape.id.split(':')[1]}`, {\n\t\t\t\t\t\t\t\t\t\t'tl-video-is-fullscreen': isFullscreen,\n\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t\theight=\"100%\"\n\t\t\t\t\t\t\t\t\tdraggable={false}\n\t\t\t\t\t\t\t\t\tplaysInline\n\t\t\t\t\t\t\t\t\tautoPlay={shape.props.autoplay && !prefersReducedMotion}\n\t\t\t\t\t\t\t\t\tmuted\n\t\t\t\t\t\t\t\t\tloop\n\t\t\t\t\t\t\t\t\tdisableRemotePlayback\n\t\t\t\t\t\t\t\t\tdisablePictureInPicture\n\t\t\t\t\t\t\t\t\tcontrols={isEditing && showControls}\n\t\t\t\t\t\t\t\t\tonLoadedData={handleLoadedData}\n\t\t\t\t\t\t\t\t\thidden={!isLoaded}\n\t\t\t\t\t\t\t\t\taria-label={shape.props.altText}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<source src={url} />\n\t\t\t\t\t\t\t\t</video>\n\t\t\t\t\t\t\t\t{!isLoaded && Spinner && <Spinner />}\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</HTMLContainer>\n\t\t\t{'url' in shape.props && shape.props.url && <HyperlinkButton url={shape.props.url} />}\n\t\t</>\n\t)\n})\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoES;AApET,oBAcO;AACP,wBAAuB;AACvB,mBAAkF;AAClF,6BAAgC;AAChC,6BAAgC;AAChC,kCAAqC;AACrC,qCAAwC;AAExC,MAAM,sBAAsB,IAAI,wBAA2C;AAWpE,MAAM,uBAAuB,+BAA+B;AAAA,EAClE,OAAgB,OAAO;AAAA,EACvB,OAAgB,QAAQ;AAAA,EACxB,OAAgB,aAAa;AAAA,EAEpB,UAA6B;AAAA,IACrC,UAAU;AAAA,EACX;AAAA,EAES,UAAU;AAClB,WAAO;AAAA,EACR;AAAA,EACS,sBAAsB;AAC9B,WAAO;AAAA,EACR;AAAA,EAES,kBAAyC;AACjD,WAAO;AAAA,MACN,GAAG;AAAA,MACH,GAAG;AAAA,MACH,SAAS;AAAA,MACT,UAAU,KAAK,QAAQ;AAAA,MACvB,KAAK;AAAA,MACL,SAAS;AAAA;AAAA,MAET,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,EACD;AAAA,EAES,kBAAkB,OAAqB;AAC/C,WAAO,MAAM,MAAM;AAAA,EACpB;AAAA,EAEA,UAAU,OAAqB;AAC9B,WAAO,4CAAC,cAAW,OAAc;AAAA,EAClC;AAAA,EAEA,UAAU,OAAqB;AAC9B,WAAO,4CAAC,UAAK,WAAO,8BAAe,MAAM,MAAM,CAAC,GAAG,YAAQ,8BAAe,MAAM,MAAM,CAAC,GAAG;AAAA,EAC3F;AAAA,EAEA,MAAe,MAAM,OAAqB,KAAuB;AAChE,UAAM,QAAQ,MAAM;AACpB,QAAI,CAAC,MAAM,QAAS,QAAO;AAE3B,UAAM,QAAQ,KAAK,OAAO,SAAkB,MAAM,OAAO;AACzD,QAAI,CAAC,MAAO,QAAO;AAEnB,UA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,IACG,MACL,GACD;AAAA;AAAA,IACD;AAAA,IACC,SAAS,MAAM,SAAS,MAAM,MAAM,OAAO,4CAAC,0CAAgB,KAAK,MAAM,MAAM,KAAK;AAAA,KACpF;AAEF,CAAC;",
6
6
  "names": ["VideoShape", "classNames"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/lib/styles.tsx"],
4
- "sourcesContent": ["import { TLUiIconJsx } from './ui/components/primitives/TldrawUiIcon'\n\n/** @public */\nexport type StyleValuesForUi<T> = readonly {\n\treadonly value: T\n\treadonly icon: string | TLUiIconJsx\n}[]\n\n// todo: default styles prop?\nexport const STYLES = {\n\tcolor: [\n\t\t{ value: 'black', icon: 'color' },\n\t\t{ value: 'grey', icon: 'color' },\n\t\t{ value: 'light-violet', icon: 'color' },\n\t\t{ value: 'violet', icon: 'color' },\n\t\t{ value: 'blue', icon: 'color' },\n\t\t{ value: 'light-blue', icon: 'color' },\n\t\t{ value: 'yellow', icon: 'color' },\n\t\t{ value: 'orange', icon: 'color' },\n\t\t{ value: 'green', icon: 'color' },\n\t\t{ value: 'light-green', icon: 'color' },\n\t\t{ value: 'light-red', icon: 'color' },\n\t\t{ value: 'red', icon: 'color' },\n\t],\n\tfill: [\n\t\t{ value: 'none', icon: 'fill-none' },\n\t\t{ value: 'semi', icon: 'fill-semi' },\n\t\t{ value: 'solid', icon: 'fill-solid' },\n\t\t{ value: 'pattern', icon: 'fill-pattern' },\n\t\t// { value: 'fill', icon: 'fill-fill' },\n\t],\n\tdash: [\n\t\t{ value: 'draw', icon: 'dash-draw' },\n\t\t{ value: 'dashed', icon: 'dash-dashed' },\n\t\t{ value: 'dotted', icon: 'dash-dotted' },\n\t\t{ value: 'solid', icon: 'dash-solid' },\n\t],\n\tsize: [\n\t\t{ value: 's', icon: 'size-small' },\n\t\t{ value: 'm', icon: 'size-medium' },\n\t\t{ value: 'l', icon: 'size-large' },\n\t\t{ value: 'xl', icon: 'size-extra-large' },\n\t],\n\tfont: [\n\t\t{ value: 'draw', icon: 'font-draw' },\n\t\t{ value: 'sans', icon: 'font-sans' },\n\t\t{ value: 'serif', icon: 'font-serif' },\n\t\t{ value: 'mono', icon: 'font-mono' },\n\t],\n\ttextAlign: [\n\t\t{ value: 'start', icon: 'text-align-left' },\n\t\t{ value: 'middle', icon: 'text-align-center' },\n\t\t{ value: 'end', icon: 'text-align-right' },\n\t],\n\thorizontalAlign: [\n\t\t{ value: 'start', icon: 'horizontal-align-start' },\n\t\t{ value: 'middle', icon: 'horizontal-align-middle' },\n\t\t{ value: 'end', icon: 'horizontal-align-end' },\n\t],\n\tverticalAlign: [\n\t\t{ value: 'start', icon: 'vertical-align-start' },\n\t\t{ value: 'middle', icon: 'vertical-align-middle' },\n\t\t{ value: 'end', icon: 'vertical-align-end' },\n\t],\n\tgeo: [\n\t\t{ value: 'rectangle', icon: 'geo-rectangle' },\n\t\t{ value: 'ellipse', icon: 'geo-ellipse' },\n\t\t{ value: 'triangle', icon: 'geo-triangle' },\n\t\t{ value: 'diamond', icon: 'geo-diamond' },\n\t\t{ value: 'star', icon: 'geo-star' },\n\t\t{ value: 'pentagon', icon: 'geo-pentagon' },\n\t\t{ value: 'hexagon', icon: 'geo-hexagon' },\n\t\t{ value: 'octagon', icon: 'geo-octagon' },\n\t\t{ value: 'rhombus', icon: 'geo-rhombus' },\n\t\t{ value: 'rhombus-2', icon: 'geo-rhombus-2' },\n\t\t{ value: 'oval', icon: 'geo-oval' },\n\t\t{ value: 'trapezoid', icon: 'geo-trapezoid' },\n\t\t{ value: 'arrow-left', icon: 'geo-arrow-left' },\n\t\t{ value: 'arrow-up', icon: 'geo-arrow-up' },\n\t\t{ value: 'arrow-down', icon: 'geo-arrow-down' },\n\t\t{ value: 'arrow-right', icon: 'geo-arrow-right' },\n\t\t{ value: 'cloud', icon: 'geo-cloud' },\n\t\t{ value: 'x-box', icon: 'geo-x-box' },\n\t\t{ value: 'check-box', icon: 'geo-check-box' },\n\t\t{ value: 'heart', icon: 'geo-heart' },\n\t],\n\tarrowKind: [\n\t\t{ value: 'arc', icon: 'arrow-arc' },\n\t\t{ value: 'elbow', icon: 'arrow-elbow' },\n\t],\n\tarrowheadStart: [\n\t\t{ value: 'none', icon: 'arrowhead-none' },\n\t\t{ value: 'arrow', icon: 'arrowhead-arrow' },\n\t\t{ value: 'triangle', icon: 'arrowhead-triangle' },\n\t\t{ value: 'square', icon: 'arrowhead-square' },\n\t\t{ value: 'dot', icon: 'arrowhead-dot' },\n\t\t{ value: 'diamond', icon: 'arrowhead-diamond' },\n\t\t{ value: 'inverted', icon: 'arrowhead-triangle-inverted' },\n\t\t{ value: 'bar', icon: 'arrowhead-bar' },\n\t],\n\tarrowheadEnd: [\n\t\t{ value: 'none', icon: 'arrowhead-none' },\n\t\t{ value: 'arrow', icon: 'arrowhead-arrow' },\n\t\t{ value: 'triangle', icon: 'arrowhead-triangle' },\n\t\t{ value: 'square', icon: 'arrowhead-square' },\n\t\t{ value: 'dot', icon: 'arrowhead-dot' },\n\t\t{ value: 'diamond', icon: 'arrowhead-diamond' },\n\t\t{ value: 'inverted', icon: 'arrowhead-triangle-inverted' },\n\t\t{ value: 'bar', icon: 'arrowhead-bar' },\n\t],\n\tspline: [\n\t\t{ value: 'line', icon: 'spline-line' },\n\t\t{ value: 'cubic', icon: 'spline-cubic' },\n\t],\n} as const satisfies Record<string, StyleValuesForUi<string>>\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASO,MAAM,SAAS;AAAA,EACrB,OAAO;AAAA,IACN,EAAE,OAAO,SAAS,MAAM,QAAQ;AAAA,IAChC,EAAE,OAAO,QAAQ,MAAM,QAAQ;AAAA,IAC/B,EAAE,OAAO,gBAAgB,MAAM,QAAQ;AAAA,IACvC,EAAE,OAAO,UAAU,MAAM,QAAQ;AAAA,IACjC,EAAE,OAAO,QAAQ,MAAM,QAAQ;AAAA,IAC/B,EAAE,OAAO,cAAc,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,YAAY;AAAA,EACrC;AAAA,EACA,WAAW;AAAA,IACV,EAAE,OAAO,OAAO,MAAM,YAAY;AAAA,IAClC,EAAE,OAAO,SAAS,MAAM,cAAc;AAAA,EACvC;AAAA,EACA,gBAAgB;AAAA,IACf,EAAE,OAAO,QAAQ,MAAM,iBAAiB;AAAA,IACxC,EAAE,OAAO,SAAS,MAAM,kBAAkB;AAAA,IAC1C,EAAE,OAAO,YAAY,MAAM,qBAAqB;AAAA,IAChD,EAAE,OAAO,UAAU,MAAM,mBAAmB;AAAA,IAC5C,EAAE,OAAO,OAAO,MAAM,gBAAgB;AAAA,IACtC,EAAE,OAAO,WAAW,MAAM,oBAAoB;AAAA,IAC9C,EAAE,OAAO,YAAY,MAAM,8BAA8B;AAAA,IACzD,EAAE,OAAO,OAAO,MAAM,gBAAgB;AAAA,EACvC;AAAA,EACA,cAAc;AAAA,IACb,EAAE,OAAO,QAAQ,MAAM,iBAAiB;AAAA,IACxC,EAAE,OAAO,SAAS,MAAM,kBAAkB;AAAA,IAC1C,EAAE,OAAO,YAAY,MAAM,qBAAqB;AAAA,IAChD,EAAE,OAAO,UAAU,MAAM,mBAAmB;AAAA,IAC5C,EAAE,OAAO,OAAO,MAAM,gBAAgB;AAAA,IACtC,EAAE,OAAO,WAAW,MAAM,oBAAoB;AAAA,IAC9C,EAAE,OAAO,YAAY,MAAM,8BAA8B;AAAA,IACzD,EAAE,OAAO,OAAO,MAAM,gBAAgB;AAAA,EACvC;AAAA,EACA,QAAQ;AAAA,IACP,EAAE,OAAO,QAAQ,MAAM,cAAc;AAAA,IACrC,EAAE,OAAO,SAAS,MAAM,eAAe;AAAA,EACxC;AACD;",
4
+ "sourcesContent": ["/** @public */\nexport type StyleValuesForUi<T> = readonly {\n\treadonly value: T\n\treadonly icon: string\n}[]\n\n// todo: default styles prop?\nexport const STYLES = {\n\tcolor: [\n\t\t{ value: 'black', icon: 'color' },\n\t\t{ value: 'grey', icon: 'color' },\n\t\t{ value: 'light-violet', icon: 'color' },\n\t\t{ value: 'violet', icon: 'color' },\n\t\t{ value: 'blue', icon: 'color' },\n\t\t{ value: 'light-blue', icon: 'color' },\n\t\t{ value: 'yellow', icon: 'color' },\n\t\t{ value: 'orange', icon: 'color' },\n\t\t{ value: 'green', icon: 'color' },\n\t\t{ value: 'light-green', icon: 'color' },\n\t\t{ value: 'light-red', icon: 'color' },\n\t\t{ value: 'red', icon: 'color' },\n\t],\n\tfill: [\n\t\t{ value: 'none', icon: 'fill-none' },\n\t\t{ value: 'semi', icon: 'fill-semi' },\n\t\t{ value: 'solid', icon: 'fill-solid' },\n\t\t{ value: 'pattern', icon: 'fill-pattern' },\n\t\t// { value: 'fill', icon: 'fill-fill' },\n\t],\n\tdash: [\n\t\t{ value: 'draw', icon: 'dash-draw' },\n\t\t{ value: 'dashed', icon: 'dash-dashed' },\n\t\t{ value: 'dotted', icon: 'dash-dotted' },\n\t\t{ value: 'solid', icon: 'dash-solid' },\n\t],\n\tsize: [\n\t\t{ value: 's', icon: 'size-small' },\n\t\t{ value: 'm', icon: 'size-medium' },\n\t\t{ value: 'l', icon: 'size-large' },\n\t\t{ value: 'xl', icon: 'size-extra-large' },\n\t],\n\tfont: [\n\t\t{ value: 'draw', icon: 'font-draw' },\n\t\t{ value: 'sans', icon: 'font-sans' },\n\t\t{ value: 'serif', icon: 'font-serif' },\n\t\t{ value: 'mono', icon: 'font-mono' },\n\t],\n\ttextAlign: [\n\t\t{ value: 'start', icon: 'text-align-left' },\n\t\t{ value: 'middle', icon: 'text-align-center' },\n\t\t{ value: 'end', icon: 'text-align-right' },\n\t],\n\thorizontalAlign: [\n\t\t{ value: 'start', icon: 'horizontal-align-start' },\n\t\t{ value: 'middle', icon: 'horizontal-align-middle' },\n\t\t{ value: 'end', icon: 'horizontal-align-end' },\n\t],\n\tverticalAlign: [\n\t\t{ value: 'start', icon: 'vertical-align-start' },\n\t\t{ value: 'middle', icon: 'vertical-align-middle' },\n\t\t{ value: 'end', icon: 'vertical-align-end' },\n\t],\n\tgeo: [\n\t\t{ value: 'rectangle', icon: 'geo-rectangle' },\n\t\t{ value: 'ellipse', icon: 'geo-ellipse' },\n\t\t{ value: 'triangle', icon: 'geo-triangle' },\n\t\t{ value: 'diamond', icon: 'geo-diamond' },\n\t\t{ value: 'star', icon: 'geo-star' },\n\t\t{ value: 'pentagon', icon: 'geo-pentagon' },\n\t\t{ value: 'hexagon', icon: 'geo-hexagon' },\n\t\t{ value: 'octagon', icon: 'geo-octagon' },\n\t\t{ value: 'rhombus', icon: 'geo-rhombus' },\n\t\t{ value: 'rhombus-2', icon: 'geo-rhombus-2' },\n\t\t{ value: 'oval', icon: 'geo-oval' },\n\t\t{ value: 'trapezoid', icon: 'geo-trapezoid' },\n\t\t{ value: 'arrow-left', icon: 'geo-arrow-left' },\n\t\t{ value: 'arrow-up', icon: 'geo-arrow-up' },\n\t\t{ value: 'arrow-down', icon: 'geo-arrow-down' },\n\t\t{ value: 'arrow-right', icon: 'geo-arrow-right' },\n\t\t{ value: 'cloud', icon: 'geo-cloud' },\n\t\t{ value: 'x-box', icon: 'geo-x-box' },\n\t\t{ value: 'check-box', icon: 'geo-check-box' },\n\t\t{ value: 'heart', icon: 'geo-heart' },\n\t],\n\tarrowKind: [\n\t\t{ value: 'arc', icon: 'arrow-arc' },\n\t\t{ value: 'elbow', icon: 'arrow-elbow' },\n\t],\n\tarrowheadStart: [\n\t\t{ value: 'none', icon: 'arrowhead-none' },\n\t\t{ value: 'arrow', icon: 'arrowhead-arrow' },\n\t\t{ value: 'triangle', icon: 'arrowhead-triangle' },\n\t\t{ value: 'square', icon: 'arrowhead-square' },\n\t\t{ value: 'dot', icon: 'arrowhead-dot' },\n\t\t{ value: 'diamond', icon: 'arrowhead-diamond' },\n\t\t{ value: 'inverted', icon: 'arrowhead-triangle-inverted' },\n\t\t{ value: 'bar', icon: 'arrowhead-bar' },\n\t],\n\tarrowheadEnd: [\n\t\t{ value: 'none', icon: 'arrowhead-none' },\n\t\t{ value: 'arrow', icon: 'arrowhead-arrow' },\n\t\t{ value: 'triangle', icon: 'arrowhead-triangle' },\n\t\t{ value: 'square', icon: 'arrowhead-square' },\n\t\t{ value: 'dot', icon: 'arrowhead-dot' },\n\t\t{ value: 'diamond', icon: 'arrowhead-diamond' },\n\t\t{ value: 'inverted', icon: 'arrowhead-triangle-inverted' },\n\t\t{ value: 'bar', icon: 'arrowhead-bar' },\n\t],\n\tspline: [\n\t\t{ value: 'line', icon: 'spline-line' },\n\t\t{ value: 'cubic', icon: 'spline-cubic' },\n\t],\n} as const satisfies Record<string, StyleValuesForUi<string>>\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOO,MAAM,SAAS;AAAA,EACrB,OAAO;AAAA,IACN,EAAE,OAAO,SAAS,MAAM,QAAQ;AAAA,IAChC,EAAE,OAAO,QAAQ,MAAM,QAAQ;AAAA,IAC/B,EAAE,OAAO,gBAAgB,MAAM,QAAQ;AAAA,IACvC,EAAE,OAAO,UAAU,MAAM,QAAQ;AAAA,IACjC,EAAE,OAAO,QAAQ,MAAM,QAAQ;AAAA,IAC/B,EAAE,OAAO,cAAc,MAAM,QAAQ;AAAA,IACrC,EAAE,OAAO,UAAU,MAAM,QAAQ;AAAA,IACjC,EAAE,OAAO,UAAU,MAAM,QAAQ;AAAA,IACjC,EAAE,OAAO,SAAS,MAAM,QAAQ;AAAA,IAChC,EAAE,OAAO,eAAe,MAAM,QAAQ;AAAA,IACtC,EAAE,OAAO,aAAa,MAAM,QAAQ;AAAA,IACpC,EAAE,OAAO,OAAO,MAAM,QAAQ;AAAA,EAC/B;AAAA,EACA,MAAM;AAAA,IACL,EAAE,OAAO,QAAQ,MAAM,YAAY;AAAA,IACnC,EAAE,OAAO,QAAQ,MAAM,YAAY;AAAA,IACnC,EAAE,OAAO,SAAS,MAAM,aAAa;AAAA,IACrC,EAAE,OAAO,WAAW,MAAM,eAAe;AAAA;AAAA,EAE1C;AAAA,EACA,MAAM;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;AAAA,EACvC;AAAA,EACA,cAAc;AAAA,IACb,EAAE,OAAO,QAAQ,MAAM,iBAAiB;AAAA,IACxC,EAAE,OAAO,SAAS,MAAM,kBAAkB;AAAA,IAC1C,EAAE,OAAO,YAAY,MAAM,qBAAqB;AAAA,IAChD,EAAE,OAAO,UAAU,MAAM,mBAAmB;AAAA,IAC5C,EAAE,OAAO,OAAO,MAAM,gBAAgB;AAAA,IACtC,EAAE,OAAO,WAAW,MAAM,oBAAoB;AAAA,IAC9C,EAAE,OAAO,YAAY,MAAM,8BAA8B;AAAA,IACzD,EAAE,OAAO,OAAO,MAAM,gBAAgB;AAAA,EACvC;AAAA,EACA,QAAQ;AAAA,IACP,EAAE,OAAO,QAAQ,MAAM,cAAc;AAAA,IACrC,EAAE,OAAO,SAAS,MAAM,eAAe;AAAA,EACxC;AACD;",
6
6
  "names": []
7
7
  }
@@ -28,13 +28,7 @@ class Erasing extends import_editor.StateNode {
28
28
  scribbleId = "id";
29
29
  markId = "";
30
30
  excludedShapeIds = /* @__PURE__ */ new Set();
31
- _isHoldingAccelKey = false;
32
- _firstErasingShapeId = null;
33
- _erasingShapeIds = [];
34
31
  onEnter(info) {
35
- this._isHoldingAccelKey = (0, import_editor.isAccelKey)(this.editor.inputs);
36
- this._firstErasingShapeId = this.editor.getErasingShapeIds()[0];
37
- this._erasingShapeIds = this.editor.getErasingShapeIds();
38
32
  this.markId = this.editor.markHistoryStoppingPoint("erase scribble begin");
39
33
  this.info = info;
40
34
  const { originPagePoint } = this.editor.inputs;
@@ -76,14 +70,6 @@ class Erasing extends import_editor.StateNode {
76
70
  onComplete() {
77
71
  this.complete();
78
72
  }
79
- onKeyUp() {
80
- this._isHoldingAccelKey = (0, import_editor.isAccelKey)(this.editor.inputs);
81
- this.update();
82
- }
83
- onKeyDown() {
84
- this._isHoldingAccelKey = (0, import_editor.isAccelKey)(this.editor.inputs);
85
- this.update();
86
- }
87
73
  update() {
88
74
  const { editor, excludedShapeIds } = this;
89
75
  const erasingShapeIds = editor.getErasingShapeIds();
@@ -114,23 +100,13 @@ class Erasing extends import_editor.StateNode {
114
100
  if (geometry.hitTestLineSegment(A, B, minDist)) {
115
101
  erasing.add(editor.getOutermostSelectableShape(shape).id);
116
102
  }
117
- this._erasingShapeIds = [...erasing];
118
- }
119
- if (this._isHoldingAccelKey && this._firstErasingShapeId) {
120
- const erasingShapeId = this._firstErasingShapeId;
121
- if (erasingShapeId && this.editor.getShape(erasingShapeId)) {
122
- editor.setErasingShapes([erasingShapeId]);
123
- }
124
- return;
125
103
  }
126
- this.editor.setErasingShapes(this._erasingShapeIds.filter((id) => !excludedShapeIds.has(id)));
104
+ this.editor.setErasingShapes([...erasing].filter((id) => !excludedShapeIds.has(id)));
127
105
  }
128
106
  complete() {
129
107
  const { editor } = this;
130
108
  editor.deleteShapes(editor.getCurrentPageState().erasingShapeIds);
131
109
  this.parent.transition("idle");
132
- this._erasingShapeIds = [];
133
- this._firstErasingShapeId = null;
134
110
  }
135
111
  cancel() {
136
112
  const { editor } = this;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/tools/EraserTool/childStates/Erasing.ts"],
4
- "sourcesContent": ["import {\n\tStateNode,\n\tTLFrameShape,\n\tTLGroupShape,\n\tTLPointerEventInfo,\n\tTLShapeId,\n\tisAccelKey,\n\tpointInPolygon,\n} from '@tldraw/editor'\n\nexport class Erasing extends StateNode {\n\tstatic override id = 'erasing'\n\n\tprivate info = {} as TLPointerEventInfo\n\tprivate scribbleId = 'id'\n\tprivate markId = ''\n\tprivate excludedShapeIds = new Set<TLShapeId>()\n\n\t_isHoldingAccelKey = false\n\t_firstErasingShapeId: TLShapeId | null = null\n\t_erasingShapeIds: TLShapeId[] = []\n\n\toverride onEnter(info: TLPointerEventInfo) {\n\t\tthis._isHoldingAccelKey = isAccelKey(this.editor.inputs)\n\t\tthis._firstErasingShapeId = this.editor.getErasingShapeIds()[0] // the first one should be the first one we hit... is it?\n\t\tthis._erasingShapeIds = this.editor.getErasingShapeIds()\n\n\t\tthis.markId = this.editor.markHistoryStoppingPoint('erase scribble begin')\n\t\tthis.info = info\n\n\t\tconst { originPagePoint } = this.editor.inputs\n\t\tthis.excludedShapeIds = new Set(\n\t\t\tthis.editor\n\t\t\t\t.getCurrentPageShapes()\n\t\t\t\t.filter((shape) => {\n\t\t\t\t\t//If the shape is locked, we shouldn't erase it\n\t\t\t\t\tif (this.editor.isShapeOrAncestorLocked(shape)) return true\n\t\t\t\t\t//If the shape is a group or frame, check we're inside it when we start erasing\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.editor.isShapeOfType<TLGroupShape>(shape, 'group') ||\n\t\t\t\t\t\tthis.editor.isShapeOfType<TLFrameShape>(shape, 'frame')\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst pointInShapeShape = this.editor.getPointInShapeSpace(shape, originPagePoint)\n\t\t\t\t\t\tconst geometry = this.editor.getShapeGeometry(shape)\n\t\t\t\t\t\treturn geometry.bounds.containsPoint(pointInShapeShape)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false\n\t\t\t\t})\n\t\t\t\t.map((shape) => shape.id)\n\t\t)\n\n\t\tconst scribble = this.editor.scribbles.addScribble({\n\t\t\tcolor: 'muted-1',\n\t\t\tsize: 12,\n\t\t})\n\t\tthis.scribbleId = scribble.id\n\n\t\tthis.update()\n\t}\n\n\tprivate pushPointToScribble() {\n\t\tconst { x, y } = this.editor.inputs.currentPagePoint\n\t\tthis.editor.scribbles.addPoint(this.scribbleId, x, y)\n\t}\n\n\toverride onExit() {\n\t\tthis.editor.setErasingShapes([])\n\t\tthis.editor.scribbles.stop(this.scribbleId)\n\t}\n\n\toverride onPointerMove() {\n\t\tthis.update()\n\t}\n\n\toverride onPointerUp() {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel() {\n\t\tthis.cancel()\n\t}\n\n\toverride onComplete() {\n\t\tthis.complete()\n\t}\n\n\toverride onKeyUp() {\n\t\tthis._isHoldingAccelKey = isAccelKey(this.editor.inputs)\n\t\tthis.update()\n\t}\n\n\toverride onKeyDown() {\n\t\tthis._isHoldingAccelKey = isAccelKey(this.editor.inputs)\n\t\tthis.update()\n\t}\n\n\tupdate() {\n\t\tconst { editor, excludedShapeIds } = this\n\t\tconst erasingShapeIds = editor.getErasingShapeIds()\n\t\tconst zoomLevel = editor.getZoomLevel()\n\t\tconst currentPageShapes = editor.getCurrentPageRenderingShapesSorted()\n\t\tconst {\n\t\t\tinputs: { currentPagePoint, previousPagePoint },\n\t\t} = editor\n\n\t\tthis.pushPointToScribble()\n\n\t\t// Otherwise, erasing shapes are all the shapes that were hit before plus any new shapes that are hit\n\t\tconst erasing = new Set<TLShapeId>(erasingShapeIds)\n\t\tconst minDist = this.editor.options.hitTestMargin / zoomLevel\n\n\t\tfor (const shape of currentPageShapes) {\n\t\t\tif (editor.isShapeOfType<TLGroupShape>(shape, 'group')) continue\n\n\t\t\t// Avoid testing masked shapes, unless the pointer is inside the mask\n\t\t\tconst pageMask = editor.getShapeMask(shape.id)\n\t\t\tif (pageMask && !pointInPolygon(currentPagePoint, pageMask)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Hit test the shape using a line segment\n\t\t\tconst geometry = editor.getShapeGeometry(shape)\n\t\t\tconst pageTransform = editor.getShapePageTransform(shape)\n\t\t\tif (!geometry || !pageTransform) continue\n\t\t\tconst pt = pageTransform.clone().invert()\n\t\t\tconst A = pt.applyToPoint(previousPagePoint)\n\t\t\tconst B = pt.applyToPoint(currentPagePoint)\n\n\t\t\t// If the line segment is entirely above / below / left / right of the shape's bounding box, skip the hit test\n\t\t\tconst { bounds } = geometry\n\t\t\tif (\n\t\t\t\tbounds.minX - minDist > Math.max(A.x, B.x) ||\n\t\t\t\tbounds.minY - minDist > Math.max(A.y, B.y) ||\n\t\t\t\tbounds.maxX + minDist < Math.min(A.x, B.x) ||\n\t\t\t\tbounds.maxY + minDist < Math.min(A.y, B.y)\n\t\t\t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (geometry.hitTestLineSegment(A, B, minDist)) {\n\t\t\t\terasing.add(editor.getOutermostSelectableShape(shape).id)\n\t\t\t}\n\n\t\t\tthis._erasingShapeIds = [...erasing]\n\t\t}\n\n\t\t// If the user is holding the meta / ctrl key, we should only erase the first shape we hit\n\t\tif (this._isHoldingAccelKey && this._firstErasingShapeId) {\n\t\t\tconst erasingShapeId = this._firstErasingShapeId\n\t\t\tif (erasingShapeId && this.editor.getShape(erasingShapeId)) {\n\t\t\t\teditor.setErasingShapes([erasingShapeId])\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Remove the hit shapes, except if they're in the list of excluded shapes\n\t\t// (these excluded shapes will be any frames or groups the pointer was inside of\n\t\t// when the user started erasing)\n\t\tthis.editor.setErasingShapes(this._erasingShapeIds.filter((id) => !excludedShapeIds.has(id)))\n\t}\n\n\tcomplete() {\n\t\tconst { editor } = this\n\t\teditor.deleteShapes(editor.getCurrentPageState().erasingShapeIds)\n\t\tthis.parent.transition('idle')\n\t\tthis._erasingShapeIds = []\n\t\tthis._firstErasingShapeId = null\n\t}\n\n\tcancel() {\n\t\tconst { editor } = this\n\t\teditor.bailToMark(this.markId)\n\t\tthis.parent.transition('idle', this.info)\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAQO;AAEA,MAAM,gBAAgB,wBAAU;AAAA,EACtC,OAAgB,KAAK;AAAA,EAEb,OAAO,CAAC;AAAA,EACR,aAAa;AAAA,EACb,SAAS;AAAA,EACT,mBAAmB,oBAAI,IAAe;AAAA,EAE9C,qBAAqB;AAAA,EACrB,uBAAyC;AAAA,EACzC,mBAAgC,CAAC;AAAA,EAExB,QAAQ,MAA0B;AAC1C,SAAK,yBAAqB,0BAAW,KAAK,OAAO,MAAM;AACvD,SAAK,uBAAuB,KAAK,OAAO,mBAAmB,EAAE,CAAC;AAC9D,SAAK,mBA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/C,gBAAQ,IAAI,OAAO,4BAA4B,KAAK,EAAE,EAAE;AAAA,MACzD;AAEA,WAAK,mBAAmB,CAAC,GAAG,OAAO;AAAA,IACpC;AAGA,QAAI,KAAK,sBAAsB,KAAK,sBAAsB;AACzD,YAAM,iBAAiB,KAAK;AAC5B,UAAI,kBAAkB,KAAK,OAAO,SAAS,cAAc,GAAG;AAC3D,eAAO,iBAAiB,CAAC,cAAc,CAAC;AAAA,MACzC;AACA;AAAA,IACD;AAKA,SAAK,OAAO,iBAAiB,KAAK,iBAAiB,OAAO,CAAC,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;AAAA,EAC7F;AAAA,EAEA,WAAW;AACV,UAAM,EAAE,OAAO,IAAI;AACnB,WAAO,aAAa,OAAO,oBAAoB,EAAE,eAAe;AAChE,SAAK,OAAO,WAAW,MAAM;AAC7B,SAAK,mBAAmB,CAAC;AACzB,SAAK,uBAAuB;AAAA,EAC7B;AAAA,EAEA,SAAS;AACR,UAAM,EAAE,OAAO,IAAI;AACnB,WAAO,WAAW,KAAK,MAAM;AAC7B,SAAK,OAAO,WAAW,QAAQ,KAAK,IAAI;AAAA,EACzC;AACD;",
4
+ "sourcesContent": ["import {\n\tStateNode,\n\tTLFrameShape,\n\tTLGroupShape,\n\tTLPointerEventInfo,\n\tTLShapeId,\n\tpointInPolygon,\n} from '@tldraw/editor'\n\nexport class Erasing extends StateNode {\n\tstatic override id = 'erasing'\n\n\tprivate info = {} as TLPointerEventInfo\n\tprivate scribbleId = 'id'\n\tprivate markId = ''\n\tprivate excludedShapeIds = new Set<TLShapeId>()\n\n\toverride onEnter(info: TLPointerEventInfo) {\n\t\tthis.markId = this.editor.markHistoryStoppingPoint('erase scribble begin')\n\t\tthis.info = info\n\n\t\tconst { originPagePoint } = this.editor.inputs\n\t\tthis.excludedShapeIds = new Set(\n\t\t\tthis.editor\n\t\t\t\t.getCurrentPageShapes()\n\t\t\t\t.filter((shape) => {\n\t\t\t\t\t//If the shape is locked, we shouldn't erase it\n\t\t\t\t\tif (this.editor.isShapeOrAncestorLocked(shape)) return true\n\t\t\t\t\t//If the shape is a group or frame, check we're inside it when we start erasing\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.editor.isShapeOfType<TLGroupShape>(shape, 'group') ||\n\t\t\t\t\t\tthis.editor.isShapeOfType<TLFrameShape>(shape, 'frame')\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst pointInShapeShape = this.editor.getPointInShapeSpace(shape, originPagePoint)\n\t\t\t\t\t\tconst geometry = this.editor.getShapeGeometry(shape)\n\t\t\t\t\t\treturn geometry.bounds.containsPoint(pointInShapeShape)\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false\n\t\t\t\t})\n\t\t\t\t.map((shape) => shape.id)\n\t\t)\n\n\t\tconst scribble = this.editor.scribbles.addScribble({\n\t\t\tcolor: 'muted-1',\n\t\t\tsize: 12,\n\t\t})\n\t\tthis.scribbleId = scribble.id\n\n\t\tthis.update()\n\t}\n\n\tprivate pushPointToScribble() {\n\t\tconst { x, y } = this.editor.inputs.currentPagePoint\n\t\tthis.editor.scribbles.addPoint(this.scribbleId, x, y)\n\t}\n\n\toverride onExit() {\n\t\tthis.editor.setErasingShapes([])\n\t\tthis.editor.scribbles.stop(this.scribbleId)\n\t}\n\n\toverride onPointerMove() {\n\t\tthis.update()\n\t}\n\n\toverride onPointerUp() {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel() {\n\t\tthis.cancel()\n\t}\n\n\toverride onComplete() {\n\t\tthis.complete()\n\t}\n\n\tupdate() {\n\t\tconst { editor, excludedShapeIds } = this\n\t\tconst erasingShapeIds = editor.getErasingShapeIds()\n\t\tconst zoomLevel = editor.getZoomLevel()\n\t\tconst currentPageShapes = editor.getCurrentPageRenderingShapesSorted()\n\t\tconst {\n\t\t\tinputs: { currentPagePoint, previousPagePoint },\n\t\t} = editor\n\n\t\tthis.pushPointToScribble()\n\n\t\tconst erasing = new Set<TLShapeId>(erasingShapeIds)\n\t\tconst minDist = this.editor.options.hitTestMargin / zoomLevel\n\n\t\tfor (const shape of currentPageShapes) {\n\t\t\tif (editor.isShapeOfType<TLGroupShape>(shape, 'group')) continue\n\n\t\t\t// Avoid testing masked shapes, unless the pointer is inside the mask\n\t\t\tconst pageMask = editor.getShapeMask(shape.id)\n\t\t\tif (pageMask && !pointInPolygon(currentPagePoint, pageMask)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Hit test the shape using a line segment\n\t\t\tconst geometry = editor.getShapeGeometry(shape)\n\t\t\tconst pageTransform = editor.getShapePageTransform(shape)\n\t\t\tif (!geometry || !pageTransform) continue\n\t\t\tconst pt = pageTransform.clone().invert()\n\t\t\tconst A = pt.applyToPoint(previousPagePoint)\n\t\t\tconst B = pt.applyToPoint(currentPagePoint)\n\n\t\t\t// If the line segment is entirely above / below / left / right of the shape's bounding box, skip the hit test\n\t\t\tconst { bounds } = geometry\n\t\t\tif (\n\t\t\t\tbounds.minX - minDist > Math.max(A.x, B.x) ||\n\t\t\t\tbounds.minY - minDist > Math.max(A.y, B.y) ||\n\t\t\t\tbounds.maxX + minDist < Math.min(A.x, B.x) ||\n\t\t\t\tbounds.maxY + minDist < Math.min(A.y, B.y)\n\t\t\t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (geometry.hitTestLineSegment(A, B, minDist)) {\n\t\t\t\terasing.add(editor.getOutermostSelectableShape(shape).id)\n\t\t\t}\n\t\t}\n\n\t\t// Remove the hit shapes, except if they're in the list of excluded shapes\n\t\t// (these excluded shapes will be any frames or groups the pointer was inside of\n\t\t// when the user started erasing)\n\t\tthis.editor.setErasingShapes([...erasing].filter((id) => !excludedShapeIds.has(id)))\n\t}\n\n\tcomplete() {\n\t\tconst { editor } = this\n\t\teditor.deleteShapes(editor.getCurrentPageState().erasingShapeIds)\n\t\tthis.parent.transition('idle')\n\t}\n\n\tcancel() {\n\t\tconst { editor } = this\n\t\teditor.bailToMark(this.markId)\n\t\tthis.parent.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;AAAA,MACD;AAEA,UAAI,SAAS,mBAAmB,GAAG,GAAG,OAAO,GAAG;AAC/C,gBAAQ,IAAI,OAAO,4BAA4B,KAAK,EAAE,EAAE;AAAA,MACzD;AAAA,IACD;AAKA,SAAK,OAAO,iBAAiB,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;AAAA,EACpF;AAAA,EAEA,WAAW;AACV,UAAM,EAAE,OAAO,IAAI;AACnB,WAAO,aAAa,OAAO,oBAAoB,EAAE,eAAe;AAChE,SAAK,OAAO,WAAW,MAAM;AAAA,EAC9B;AAAA,EAEA,SAAS;AACR,UAAM,EAAE,OAAO,IAAI;AACnB,WAAO,WAAW,KAAK,MAAM;AAC7B,SAAK,OAAO,WAAW,QAAQ,KAAK,IAAI;AAAA,EACzC;AACD;",
6
6
  "names": []
7
7
  }
@@ -24,9 +24,7 @@ module.exports = __toCommonJS(Pointing_exports);
24
24
  var import_editor = require("@tldraw/editor");
25
25
  class Pointing extends import_editor.StateNode {
26
26
  static id = "pointing";
27
- _isHoldingAccelKey = false;
28
27
  onEnter() {
29
- this._isHoldingAccelKey = (0, import_editor.isAccelKey)(this.editor.inputs);
30
28
  const zoomLevel = this.editor.getZoomLevel();
31
29
  const currentPageShapesSorted = this.editor.getCurrentPageRenderingShapesSorted();
32
30
  const {
@@ -48,19 +46,10 @@ class Pointing extends import_editor.StateNode {
48
46
  break;
49
47
  }
50
48
  erasing.add(hitShape.id);
51
- if (this._isHoldingAccelKey) {
52
- break;
53
- }
54
49
  }
55
50
  }
56
51
  this.editor.setErasingShapes([...erasing]);
57
52
  }
58
- onKeyUp() {
59
- this._isHoldingAccelKey = (0, import_editor.isAccelKey)(this.editor.inputs);
60
- }
61
- onKeyDown() {
62
- this._isHoldingAccelKey = (0, import_editor.isAccelKey)(this.editor.inputs);
63
- }
64
53
  onLongPress(info) {
65
54
  this.startErasing(info);
66
55
  }
@@ -70,7 +59,6 @@ class Pointing extends import_editor.StateNode {
70
59
  }
71
60
  }
72
61
  onPointerMove(info) {
73
- if (this._isHoldingAccelKey) return;
74
62
  if (this.editor.inputs.isDragging) {
75
63
  this.startErasing(info);
76
64
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/lib/tools/EraserTool/childStates/Pointing.ts"],
4
- "sourcesContent": ["import {\n\tisAccelKey,\n\tStateNode,\n\tTLFrameShape,\n\tTLGroupShape,\n\tTLPointerEventInfo,\n\tTLShapeId,\n} from '@tldraw/editor'\n\nexport class Pointing extends StateNode {\n\tstatic override id = 'pointing'\n\n\t_isHoldingAccelKey = false\n\n\toverride onEnter() {\n\t\tthis._isHoldingAccelKey = isAccelKey(this.editor.inputs)\n\n\t\tconst zoomLevel = this.editor.getZoomLevel()\n\t\tconst currentPageShapesSorted = this.editor.getCurrentPageRenderingShapesSorted()\n\t\tconst {\n\t\t\tinputs: { currentPagePoint },\n\t\t} = this.editor\n\n\t\tconst erasing = new Set<TLShapeId>()\n\n\t\tconst initialSize = erasing.size\n\n\t\tfor (let n = currentPageShapesSorted.length, i = n - 1; i >= 0; i--) {\n\t\t\tconst shape = currentPageShapesSorted[i]\n\t\t\tif (\n\t\t\t\tthis.editor.isShapeOrAncestorLocked(shape) ||\n\t\t\t\tthis.editor.isShapeOfType<TLGroupShape>(shape, 'group')\n\t\t\t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tthis.editor.isPointInShape(shape, currentPagePoint, {\n\t\t\t\t\thitInside: false,\n\t\t\t\t\tmargin: this.editor.options.hitTestMargin / zoomLevel,\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\tconst hitShape = this.editor.getOutermostSelectableShape(shape)\n\t\t\t\t// If we've hit a frame after hitting any other shape, stop here\n\t\t\t\tif (\n\t\t\t\t\tthis.editor.isShapeOfType<TLFrameShape>(hitShape, 'frame') &&\n\t\t\t\t\terasing.size > initialSize\n\t\t\t\t) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\terasing.add(hitShape.id)\n\n\t\t\t\t// If the user is holding the meta / ctrl key, stop after the first shape\n\t\t\t\tif (this._isHoldingAccelKey) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.editor.setErasingShapes([...erasing])\n\t}\n\n\toverride onKeyUp() {\n\t\tthis._isHoldingAccelKey = isAccelKey(this.editor.inputs)\n\t}\n\n\toverride onKeyDown() {\n\t\tthis._isHoldingAccelKey = isAccelKey(this.editor.inputs)\n\t}\n\n\toverride onLongPress(info: TLPointerEventInfo) {\n\t\tthis.startErasing(info)\n\t}\n\n\toverride onExit(_info: any, to: string) {\n\t\tif (to !== 'erasing') {\n\t\t\tthis.editor.setErasingShapes([])\n\t\t}\n\t}\n\n\toverride onPointerMove(info: TLPointerEventInfo) {\n\t\tif (this._isHoldingAccelKey) return\n\n\t\tif (this.editor.inputs.isDragging) {\n\t\t\tthis.startErasing(info)\n\t\t}\n\t}\n\n\toverride onPointerUp() {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel() {\n\t\tthis.cancel()\n\t}\n\n\toverride onComplete() {\n\t\tthis.complete()\n\t}\n\n\toverride onInterrupt() {\n\t\tthis.cancel()\n\t}\n\n\tprivate startErasing(info: TLPointerEventInfo) {\n\t\tthis.parent.transition('erasing', info)\n\t}\n\n\tcomplete() {\n\t\tconst erasingShapeIds = this.editor.getErasingShapeIds()\n\n\t\tif (erasingShapeIds.length) {\n\t\t\tthis.editor.markHistoryStoppingPoint('erase end')\n\t\t\tthis.editor.deleteShapes(erasingShapeIds)\n\t\t}\n\n\t\tthis.parent.transition('idle')\n\t}\n\n\tcancel() {\n\t\tthis.parent.transition('idle')\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAOO;AAEA,MAAM,iBAAiB,wBAAU;AAAA,EACvC,OAAgB,KAAK;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,EACD;AAAA,EAES,cAAc,MAA0B;AAChD,QAAI,KAAK,mBAAoB;AAE7B,QAAI,KAAK,OAAO,OAAO,YAAY;AAClC,WAAK,aAAa,IAAI;AAAA,IACvB;AAAA,EACD;AAAA,EAES,cAAc;AACtB,SAAK,SAAS;AAAA,EACf;AAAA,EAES,WAAW;AACnB,SAAK,OAAO;AAAA,EACb;AAAA,EAES,aAAa;AACrB,SAAK,SAAS;AAAA,EACf;AAAA,EAES,cAAc;AACtB,SAAK,OAAO;AAAA,EACb;AAAA,EAEQ,aAAa,MAA0B;AAC9C,SAAK,OAAO,WAAW,WAAW,IAAI;AAAA,EACvC;AAAA,EAEA,WAAW;AACV,UAAM,kBAAkB,KAAK,OAAO,mBAAmB;AAEvD,QAAI,gBAAgB,QAAQ;AAC3B,WAAK,OAAO,yBAAyB,WAAW;AAChD,WAAK,OAAO,aAAa,eAAe;AAAA,IACzC;AAEA,SAAK,OAAO,WAAW,MAAM;AAAA,EAC9B;AAAA,EAEA,SAAS;AACR,SAAK,OAAO,WAAW,MAAM;AAAA,EAC9B;AACD;",
4
+ "sourcesContent": ["import {\n\tStateNode,\n\tTLFrameShape,\n\tTLGroupShape,\n\tTLPointerEventInfo,\n\tTLShapeId,\n} from '@tldraw/editor'\n\nexport class Pointing extends StateNode {\n\tstatic override id = 'pointing'\n\n\toverride onEnter() {\n\t\tconst zoomLevel = this.editor.getZoomLevel()\n\t\tconst currentPageShapesSorted = this.editor.getCurrentPageRenderingShapesSorted()\n\t\tconst {\n\t\t\tinputs: { currentPagePoint },\n\t\t} = this.editor\n\n\t\tconst erasing = new Set<TLShapeId>()\n\n\t\tconst initialSize = erasing.size\n\n\t\tfor (let n = currentPageShapesSorted.length, i = n - 1; i >= 0; i--) {\n\t\t\tconst shape = currentPageShapesSorted[i]\n\t\t\tif (\n\t\t\t\tthis.editor.isShapeOrAncestorLocked(shape) ||\n\t\t\t\tthis.editor.isShapeOfType<TLGroupShape>(shape, 'group')\n\t\t\t) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tthis.editor.isPointInShape(shape, currentPagePoint, {\n\t\t\t\t\thitInside: false,\n\t\t\t\t\tmargin: this.editor.options.hitTestMargin / zoomLevel,\n\t\t\t\t})\n\t\t\t) {\n\t\t\t\tconst hitShape = this.editor.getOutermostSelectableShape(shape)\n\t\t\t\t// If we've hit a frame after hitting any other shape, stop here\n\t\t\t\tif (\n\t\t\t\t\tthis.editor.isShapeOfType<TLFrameShape>(hitShape, 'frame') &&\n\t\t\t\t\terasing.size > initialSize\n\t\t\t\t) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\terasing.add(hitShape.id)\n\t\t\t}\n\t\t}\n\n\t\tthis.editor.setErasingShapes([...erasing])\n\t}\n\n\toverride onLongPress(info: TLPointerEventInfo) {\n\t\tthis.startErasing(info)\n\t}\n\n\toverride onExit(_info: any, to: string) {\n\t\tif (to !== 'erasing') {\n\t\t\tthis.editor.setErasingShapes([])\n\t\t}\n\t}\n\n\toverride onPointerMove(info: TLPointerEventInfo) {\n\t\tif (this.editor.inputs.isDragging) {\n\t\t\tthis.startErasing(info)\n\t\t}\n\t}\n\n\toverride onPointerUp() {\n\t\tthis.complete()\n\t}\n\n\toverride onCancel() {\n\t\tthis.cancel()\n\t}\n\n\toverride onComplete() {\n\t\tthis.complete()\n\t}\n\n\toverride onInterrupt() {\n\t\tthis.cancel()\n\t}\n\n\tprivate startErasing(info: TLPointerEventInfo) {\n\t\tthis.parent.transition('erasing', info)\n\t}\n\n\tcomplete() {\n\t\tconst erasingShapeIds = this.editor.getErasingShapeIds()\n\n\t\tif (erasingShapeIds.length) {\n\t\t\tthis.editor.markHistoryStoppingPoint('erase end')\n\t\t\tthis.editor.deleteShapes(erasingShapeIds)\n\t\t}\n\n\t\tthis.parent.transition('idle')\n\t}\n\n\tcancel() {\n\t\tthis.parent.transition('idle')\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;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AAW;AACnB,SAAK,OAAO;AAAA,EACb;AAAA,EAES,aAAa;AACrB,SAAK,SAAS;AAAA,EACf;AAAA,EAES,cAAc;AACtB,SAAK,OAAO;AAAA,EACb;AAAA,EAEQ,aAAa,MAA0B;AAC9C,SAAK,OAAO,WAAW,WAAW,IAAI;AAAA,EACvC;AAAA,EAEA,WAAW;AACV,UAAM,kBAAkB,KAAK,OAAO,mBAAmB;AAEvD,QAAI,gBAAgB,QAAQ;AAC3B,WAAK,OAAO,yBAAyB,WAAW;AAChD,WAAK,OAAO,aAAa,eAAe;AAAA,IACzC;AAEA,SAAK,OAAO,WAAW,MAAM;AAAA,EAC9B;AAAA,EAEA,SAAS;AACR,SAAK,OAAO,WAAW,MAAM;AAAA,EAC9B;AACD;",
6
6
  "names": []
7
7
  }
@@ -29,17 +29,11 @@ class PointingCrop extends import_editor.StateNode {
29
29
  }
30
30
  onPointerMove(info) {
31
31
  if (this.editor.inputs.isDragging) {
32
- this.startDragging(info);
32
+ this.editor.setCurrentTool("select.crop.translating_crop", info);
33
33
  }
34
34
  }
35
- onLongPress(info) {
36
- this.startDragging(info);
37
- }
38
35
  onPointerUp(info) {
39
36
  this.editor.setCurrentTool("select.crop.idle", info);
40
37
  }
41
- startDragging(info) {
42
- this.editor.setCurrentTool("select.crop.translating_crop", info);
43
- }
44
38
  }
45
39
  //# sourceMappingURL=PointingCrop.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.ts"],
4
- "sourcesContent": ["import { StateNode, TLPointerEventInfo } from '@tldraw/editor'\n\nexport class PointingCrop extends StateNode {\n\tstatic override id = 'pointing_crop'\n\n\toverride onCancel() {\n\t\tthis.editor.setCurrentTool('select.crop.idle', {})\n\t}\n\n\toverride onPointerMove(info: TLPointerEventInfo) {\n\t\tif (this.editor.inputs.isDragging) {\n\t\t\tthis.startDragging(info)\n\t\t}\n\t}\n\toverride onLongPress(info: TLPointerEventInfo) {\n\t\tthis.startDragging(info)\n\t}\n\n\toverride onPointerUp(info: TLPointerEventInfo) {\n\t\tthis.editor.setCurrentTool('select.crop.idle', info)\n\t}\n\n\tstartDragging(info: TLPointerEventInfo) {\n\t\tthis.editor.setCurrentTool('select.crop.translating_crop', info)\n\t}\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA8C;AAEvC,MAAM,qBAAqB,wBAAU;AAAA,EAC3C,OAAgB,KAAK;AAAA,EAEZ,WAAW;AACnB,SAAK,OAAO,eAAe,oBAAoB,CAAC,CAAC;AAAA,EAClD;AAAA,EAES,cAAc,MAA0B;AAChD,QAAI,KAAK,OAAO,OAAO,YAAY;AAClC,WAAK,cAAc,IAAI;AAAA,IACxB;AAAA,EACD;AAAA,EACS,YAAY,MAA0B;AAC9C,SAAK,cAAc,IAAI;AAAA,EACxB;AAAA,EAES,YAAY,MAA0B;AAC9C,SAAK,OAAO,eAAe,oBAAoB,IAAI;AAAA,EACpD;AAAA,EAEA,cAAc,MAA0B;AACvC,SAAK,OAAO,eAAe,gCAAgC,IAAI;AAAA,EAChE;AACD;",
4
+ "sourcesContent": ["import { StateNode, TLPointerEventInfo } from '@tldraw/editor'\n\nexport class PointingCrop extends StateNode {\n\tstatic override id = 'pointing_crop'\n\n\toverride onCancel() {\n\t\tthis.editor.setCurrentTool('select.crop.idle', {})\n\t}\n\n\toverride onPointerMove(info: TLPointerEventInfo) {\n\t\tif (this.editor.inputs.isDragging) {\n\t\t\tthis.editor.setCurrentTool('select.crop.translating_crop', info)\n\t\t}\n\t}\n\n\toverride onPointerUp(info: TLPointerEventInfo) {\n\t\tthis.editor.setCurrentTool('select.crop.idle', info)\n\t}\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA8C;AAEvC,MAAM,qBAAqB,wBAAU;AAAA,EAC3C,OAAgB,KAAK;AAAA,EAEZ,WAAW;AACnB,SAAK,OAAO,eAAe,oBAAoB,CAAC,CAAC;AAAA,EAClD;AAAA,EAES,cAAc,MAA0B;AAChD,QAAI,KAAK,OAAO,OAAO,YAAY;AAClC,WAAK,OAAO,eAAe,gCAAgC,IAAI;AAAA,IAChE;AAAA,EACD;AAAA,EAES,YAAY,MAA0B;AAC9C,SAAK,OAAO,eAAe,oBAAoB,IAAI;AAAA,EACpD;AACD;",
6
6
  "names": []
7
7
  }