tldraw 4.2.0-next.f100cedfc45b → 4.3.0-canary.03ae87dcc44b

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 (268) hide show
  1. package/dist-cjs/index.d.ts +17 -7
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/lib/bindings/arrow/ArrowBindingUtil.js.map +2 -2
  4. package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +5 -2
  5. package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
  6. package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
  7. package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
  8. package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
  9. package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
  10. package/dist-cjs/lib/shapes/arrow/elbow/elbowArrowSnapLines.js.map +2 -2
  11. package/dist-cjs/lib/shapes/arrow/shared.js.map +2 -2
  12. package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
  13. package/dist-cjs/lib/shapes/bookmark/bookmarks.js.map +2 -2
  14. package/dist-cjs/lib/shapes/draw/toolStates/Drawing.js.map +2 -2
  15. package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js.map +2 -2
  16. package/dist-cjs/lib/shapes/frame/FrameShapeTool.js.map +1 -1
  17. package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js +63 -36
  18. package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js.map +2 -2
  19. package/dist-cjs/lib/shapes/geo/toolStates/Pointing.js.map +2 -2
  20. package/dist-cjs/lib/shapes/line/toolStates/Pointing.js.map +2 -2
  21. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +3 -3
  22. package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
  23. package/dist-cjs/lib/shapes/note/noteHelpers.js.map +2 -2
  24. package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
  25. package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
  26. package/dist-cjs/lib/shapes/shared/ShapeFill.js +3 -0
  27. package/dist-cjs/lib/shapes/shared/ShapeFill.js.map +2 -2
  28. package/dist-cjs/lib/shapes/shared/crop.js +1 -0
  29. package/dist-cjs/lib/shapes/shared/crop.js.map +2 -2
  30. package/dist-cjs/lib/shapes/shared/useEditablePlainText.js.map +2 -2
  31. package/dist-cjs/lib/shapes/shared/useEditableRichText.js.map +2 -2
  32. package/dist-cjs/lib/shapes/text/toolStates/Pointing.js.map +2 -2
  33. package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
  34. package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js.map +2 -2
  35. package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js +1 -4
  36. package/dist-cjs/lib/tools/SelectTool/DragAndDropManager.js.map +2 -2
  37. package/dist-cjs/lib/tools/SelectTool/childStates/Brushing.js.map +2 -2
  38. package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/Idle.js.map +2 -2
  39. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +15 -7
  40. package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
  41. package/dist-cjs/lib/tools/SelectTool/childStates/EditingShape.js.map +2 -2
  42. package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +2 -2
  43. package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
  44. package/dist-cjs/lib/tools/SelectTool/childStates/PointingArrowLabel.js.map +2 -2
  45. package/dist-cjs/lib/tools/SelectTool/childStates/PointingHandle.js.map +2 -2
  46. package/dist-cjs/lib/tools/SelectTool/childStates/PointingSelection.js.map +2 -2
  47. package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
  48. package/dist-cjs/lib/tools/SelectTool/childStates/ScribbleBrushing.js.map +2 -2
  49. package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
  50. package/dist-cjs/lib/ui/components/Dialogs.js +2 -14
  51. package/dist-cjs/lib/ui/components/Dialogs.js.map +2 -2
  52. package/dist-cjs/lib/ui/components/EditLinkDialog.js +11 -1
  53. package/dist-cjs/lib/ui/components/EditLinkDialog.js.map +2 -2
  54. package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +5 -4
  55. package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
  56. package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
  57. package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.js +2 -1
  58. package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.js.map +2 -2
  59. package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
  60. package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButton.js +2 -2
  61. package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButton.js.map +2 -2
  62. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +2 -1
  63. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
  64. package/dist-cjs/lib/ui/context/actions.js +17 -2
  65. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  66. package/dist-cjs/lib/ui/context/events.js.map +2 -2
  67. package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
  68. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +18 -16
  69. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +3 -3
  70. package/dist-cjs/lib/ui/hooks/useFlatten.js.map +2 -2
  71. package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
  72. package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
  73. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +1 -0
  74. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
  75. package/dist-cjs/lib/ui/hooks/useTranslation/useTranslation.js +1 -0
  76. package/dist-cjs/lib/ui/hooks/useTranslation/useTranslation.js.map +2 -2
  77. package/dist-cjs/lib/ui/version.js +3 -3
  78. package/dist-cjs/lib/ui/version.js.map +1 -1
  79. package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js +8 -0
  80. package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
  81. package/dist-cjs/lib/utils/export/exportAs.js.map +2 -2
  82. package/dist-cjs/lib/utils/frames/frames.js.map +2 -2
  83. package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
  84. package/dist-esm/index.d.mts +17 -7
  85. package/dist-esm/index.mjs +1 -1
  86. package/dist-esm/lib/bindings/arrow/ArrowBindingUtil.mjs.map +2 -2
  87. package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +6 -2
  88. package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
  89. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  90. package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
  91. package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
  92. package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
  93. package/dist-esm/lib/shapes/arrow/elbow/elbowArrowSnapLines.mjs.map +2 -2
  94. package/dist-esm/lib/shapes/arrow/shared.mjs.map +2 -2
  95. package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
  96. package/dist-esm/lib/shapes/bookmark/bookmarks.mjs.map +2 -2
  97. package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs.map +2 -2
  98. package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs.map +2 -2
  99. package/dist-esm/lib/shapes/frame/FrameShapeTool.mjs.map +1 -1
  100. package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs +65 -38
  101. package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs.map +2 -2
  102. package/dist-esm/lib/shapes/geo/toolStates/Pointing.mjs.map +2 -2
  103. package/dist-esm/lib/shapes/line/toolStates/Pointing.mjs.map +2 -2
  104. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +5 -5
  105. package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
  106. package/dist-esm/lib/shapes/note/noteHelpers.mjs.map +2 -2
  107. package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
  108. package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
  109. package/dist-esm/lib/shapes/shared/ShapeFill.mjs +3 -0
  110. package/dist-esm/lib/shapes/shared/ShapeFill.mjs.map +2 -2
  111. package/dist-esm/lib/shapes/shared/crop.mjs +1 -0
  112. package/dist-esm/lib/shapes/shared/crop.mjs.map +2 -2
  113. package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs.map +2 -2
  114. package/dist-esm/lib/shapes/shared/useEditableRichText.mjs.map +2 -2
  115. package/dist-esm/lib/shapes/text/toolStates/Pointing.mjs.map +2 -2
  116. package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
  117. package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs +1 -4
  118. package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs.map +2 -2
  119. package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs +1 -4
  120. package/dist-esm/lib/tools/SelectTool/DragAndDropManager.mjs.map +2 -2
  121. package/dist-esm/lib/tools/SelectTool/childStates/Brushing.mjs.map +2 -2
  122. package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/Idle.mjs.map +2 -2
  123. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +15 -7
  124. package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
  125. package/dist-esm/lib/tools/SelectTool/childStates/EditingShape.mjs.map +2 -2
  126. package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +2 -2
  127. package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
  128. package/dist-esm/lib/tools/SelectTool/childStates/PointingArrowLabel.mjs.map +2 -2
  129. package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs +1 -4
  130. package/dist-esm/lib/tools/SelectTool/childStates/PointingHandle.mjs.map +2 -2
  131. package/dist-esm/lib/tools/SelectTool/childStates/PointingSelection.mjs.map +2 -2
  132. package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
  133. package/dist-esm/lib/tools/SelectTool/childStates/ScribbleBrushing.mjs.map +2 -2
  134. package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
  135. package/dist-esm/lib/ui/components/Dialogs.mjs +2 -14
  136. package/dist-esm/lib/ui/components/Dialogs.mjs.map +2 -2
  137. package/dist-esm/lib/ui/components/EditLinkDialog.mjs +11 -1
  138. package/dist-esm/lib/ui/components/EditLinkDialog.mjs.map +2 -2
  139. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +5 -5
  140. package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
  141. package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
  142. package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.mjs +2 -1
  143. package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.mjs.map +2 -2
  144. package/dist-esm/lib/ui/components/menu-items.mjs +1 -4
  145. package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
  146. package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButton.mjs +2 -2
  147. package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButton.mjs.map +2 -2
  148. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +2 -1
  149. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
  150. package/dist-esm/lib/ui/context/actions.mjs +17 -2
  151. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  152. package/dist-esm/lib/ui/context/events.mjs.map +2 -2
  153. package/dist-esm/lib/ui/hooks/menu-hooks.mjs +1 -4
  154. package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
  155. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +18 -16
  156. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +3 -3
  157. package/dist-esm/lib/ui/hooks/useFlatten.mjs.map +2 -2
  158. package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
  159. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +1 -0
  160. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
  161. package/dist-esm/lib/ui/hooks/useTranslation/useTranslation.mjs +1 -0
  162. package/dist-esm/lib/ui/hooks/useTranslation/useTranslation.mjs.map +2 -2
  163. package/dist-esm/lib/ui/version.mjs +3 -3
  164. package/dist-esm/lib/ui/version.mjs.map +1 -1
  165. package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs +8 -0
  166. package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
  167. package/dist-esm/lib/utils/export/exportAs.mjs +1 -3
  168. package/dist-esm/lib/utils/export/exportAs.mjs.map +2 -2
  169. package/dist-esm/lib/utils/frames/frames.mjs.map +2 -2
  170. package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
  171. package/package.json +10 -10
  172. package/src/lib/bindings/arrow/ArrowBindingUtil.ts +1 -1
  173. package/src/lib/canvas/TldrawSelectionForeground.tsx +18 -7
  174. package/src/lib/defaultExternalContentHandlers.ts +3 -4
  175. package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +2 -2
  176. package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +1 -1
  177. package/src/lib/shapes/arrow/arrowLabel.ts +1 -1
  178. package/src/lib/shapes/arrow/arrowTargetState.ts +1 -1
  179. package/src/lib/shapes/arrow/elbow/elbowArrowSnapLines.tsx +3 -3
  180. package/src/lib/shapes/arrow/shared.ts +4 -4
  181. package/src/lib/shapes/arrow/toolStates/Pointing.tsx +1 -1
  182. package/src/lib/shapes/bookmark/bookmarks.ts +3 -3
  183. package/src/lib/shapes/draw/toolStates/Drawing.ts +4 -4
  184. package/src/lib/shapes/embed/EmbedShapeUtil.tsx +1 -1
  185. package/src/lib/shapes/frame/FrameShapeTool.ts +1 -1
  186. package/src/lib/shapes/frame/components/FrameLabelInput.tsx +48 -24
  187. package/src/lib/shapes/geo/GeoShapeUtil.test.tsx +10 -2
  188. package/src/lib/shapes/geo/toolStates/Pointing.ts +3 -3
  189. package/src/lib/shapes/line/LineShapeTool.test.ts +6 -6
  190. package/src/lib/shapes/line/LineShapeUtil.test.tsx +5 -5
  191. package/src/lib/shapes/line/toolStates/Pointing.ts +1 -1
  192. package/src/lib/shapes/note/NoteShapeTool.test.ts +2 -1
  193. package/src/lib/shapes/note/NoteShapeUtil.tsx +6 -5
  194. package/src/lib/shapes/note/noteHelpers.ts +2 -2
  195. package/src/lib/shapes/shared/PlainTextLabel.tsx +2 -1
  196. package/src/lib/shapes/shared/RichTextLabel.tsx +2 -1
  197. package/src/lib/shapes/shared/ShapeFill.tsx +3 -0
  198. package/src/lib/shapes/shared/crop.ts +1 -0
  199. package/src/lib/shapes/shared/useEditablePlainText.ts +7 -3
  200. package/src/lib/shapes/shared/useEditableRichText.ts +7 -3
  201. package/src/lib/shapes/text/TextShapeTool.test.ts +4 -4
  202. package/src/lib/shapes/text/toolStates/Pointing.ts +1 -1
  203. package/src/lib/tools/EraserTool/childStates/Erasing.ts +3 -5
  204. package/src/lib/tools/EraserTool/childStates/Pointing.ts +3 -16
  205. package/src/lib/tools/SelectTool/DragAndDropManager.ts +2 -4
  206. package/src/lib/tools/SelectTool/childStates/Brushing.ts +2 -6
  207. package/src/lib/tools/SelectTool/childStates/Crop/children/Idle.ts +2 -3
  208. package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +23 -15
  209. package/src/lib/tools/SelectTool/childStates/EditingShape.ts +2 -4
  210. package/src/lib/tools/SelectTool/childStates/Idle.ts +8 -12
  211. package/src/lib/tools/SelectTool/childStates/PointingArrowLabel.ts +1 -1
  212. package/src/lib/tools/SelectTool/childStates/PointingHandle.ts +4 -12
  213. package/src/lib/tools/SelectTool/childStates/PointingSelection.ts +2 -2
  214. package/src/lib/tools/SelectTool/childStates/Resizing.ts +2 -4
  215. package/src/lib/tools/SelectTool/childStates/ScribbleBrushing.ts +2 -4
  216. package/src/lib/tools/SelectTool/childStates/Translating.ts +1 -3
  217. package/src/lib/ui/components/Dialogs.tsx +2 -14
  218. package/src/lib/ui/components/EditLinkDialog.tsx +16 -6
  219. package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +6 -5
  220. package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +2 -2
  221. package/src/lib/ui/components/Toolbar/DefaultRichTextToolbarContent.tsx +4 -1
  222. package/src/lib/ui/components/menu-items.tsx +6 -14
  223. package/src/lib/ui/components/primitives/Button/TldrawUiButton.tsx +3 -2
  224. package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +1 -0
  225. package/src/lib/ui/context/actions.tsx +25 -13
  226. package/src/lib/ui/context/events.tsx +1 -0
  227. package/src/lib/ui/hooks/menu-hooks.ts +9 -19
  228. package/src/lib/ui/hooks/useClipboardEvents.ts +12 -9
  229. package/src/lib/ui/hooks/useFlatten.ts +1 -2
  230. package/src/lib/ui/hooks/useTools.tsx +1 -2
  231. package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +1 -0
  232. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +1 -0
  233. package/src/lib/ui/hooks/useTranslation/useTranslation.tsx +2 -1
  234. package/src/lib/ui/version.ts +3 -3
  235. package/src/lib/ui.css +4 -6
  236. package/src/lib/utils/excalidraw/putExcalidrawContent.ts +8 -0
  237. package/src/lib/utils/export/exportAs.ts +2 -9
  238. package/src/lib/utils/frames/frames.ts +1 -1
  239. package/src/lib/utils/tldr/buildFromV1Document.ts +12 -17
  240. package/src/test/Editor.test.tsx +38 -12
  241. package/src/test/SelectTool.test.ts +11 -19
  242. package/src/test/TestEditor.ts +1 -4
  243. package/src/test/TldrawEditor.test.tsx +87 -40
  244. package/src/test/bindings.test.tsx +29 -25
  245. package/src/test/bindingsIndex.test.tsx +4 -4
  246. package/src/test/commands/createShape.test.ts +64 -0
  247. package/src/test/commands/createShapes.test.ts +15 -1
  248. package/src/test/commands/getSvgString.test.ts +2 -2
  249. package/src/test/commands/isShapeOfType.test.ts +44 -0
  250. package/src/test/commands/putContent.test.ts +1 -0
  251. package/src/test/commands/updateShape.test.ts +67 -0
  252. package/src/test/commands/updateShapes.test.ts +21 -5
  253. package/src/test/custom-clipping.test.ts +36 -35
  254. package/src/test/customSnapping.test.tsx +254 -54
  255. package/src/test/duplicate.test.ts +1 -1
  256. package/src/test/frames.test.ts +2 -2
  257. package/src/test/getCulledShapes.test.tsx +11 -3
  258. package/src/test/getShapeAtPoint.test.ts +2 -2
  259. package/src/test/groups.test.tsx +6 -3
  260. package/src/test/resizing.test.ts +9 -13
  261. package/src/test/selection-omnibus.test.ts +11 -11
  262. package/src/test/shapeutils.test.ts +1 -1
  263. package/src/test/styles2.test.tsx +1 -1
  264. package/src/test/styles3.test.ts +5 -5
  265. package/src/test/test-jsx.tsx +69 -57
  266. package/src/test/text.test.ts +15 -17
  267. package/src/test/translating.test.ts +6 -8
  268. package/tldraw.css +4 -6
@@ -1,5 +1,8 @@
1
- import { TLFrameShape, TLShapeId, useEditor } from '@tldraw/editor'
2
- import { forwardRef, useCallback } from 'react'
1
+ import { TLFrameShape, TLShapeId, useEditor, useValue } from '@tldraw/editor'
2
+ import { forwardRef, useCallback, useEffect, useRef } from 'react'
3
+ import { PORTRAIT_BREAKPOINT } from '../../../ui/constants'
4
+ import { useBreakpoint } from '../../../ui/context/breakpoints'
5
+ import { useTranslation } from '../../../ui/hooks/useTranslation/useTranslation'
3
6
  import { defaultEmptyAs } from '../FrameShapeUtil'
4
7
 
5
8
  export const FrameLabelInput = forwardRef<
@@ -7,6 +10,15 @@ export const FrameLabelInput = forwardRef<
7
10
  { id: TLShapeId; name: string; isEditing: boolean }
8
11
  >(({ id, name, isEditing }, ref) => {
9
12
  const editor = useEditor()
13
+ const breakpoint = useBreakpoint()
14
+ const isCoarsePointer = useValue(
15
+ 'isCoarsePointer',
16
+ () => editor.getInstanceState().isCoarsePointer,
17
+ [editor]
18
+ )
19
+ const shouldUseWindowPrompt = breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM && isCoarsePointer
20
+ const promptOpen = useRef<boolean>(false)
21
+ const msg = useTranslation()
10
22
 
11
23
  const handlePointerDown = useCallback(
12
24
  (e: React.PointerEvent) => {
@@ -28,13 +40,12 @@ export const FrameLabelInput = forwardRef<
28
40
  [editor]
29
41
  )
30
42
 
31
- const handleBlur = useCallback(
32
- (e: React.FocusEvent<HTMLInputElement>) => {
43
+ const renameFrame = useCallback(
44
+ (value: string) => {
33
45
  const shape = editor.getShape<TLFrameShape>(id)
34
46
  if (!shape) return
35
47
 
36
48
  const name = shape.props.name
37
- const value = e.currentTarget.value.trim()
38
49
  if (name === value) return
39
50
 
40
51
  editor.updateShapes([
@@ -48,36 +59,49 @@ export const FrameLabelInput = forwardRef<
48
59
  [id, editor]
49
60
  )
50
61
 
62
+ const handleBlur = useCallback(
63
+ (e: React.FocusEvent<HTMLInputElement>) => {
64
+ renameFrame(e.currentTarget.value)
65
+ },
66
+ [renameFrame]
67
+ )
68
+
51
69
  const handleChange = useCallback(
52
70
  (e: React.ChangeEvent<HTMLInputElement>) => {
53
- const shape = editor.getShape<TLFrameShape>(id)
54
- if (!shape) return
55
-
56
- const name = shape.props.name
57
- const value = e.currentTarget.value
58
- if (name === value) return
59
-
60
- editor.updateShapes([
61
- {
62
- id,
63
- type: 'frame',
64
- props: { name: value },
65
- },
66
- ])
71
+ renameFrame(e.currentTarget.value)
67
72
  },
68
- [id, editor]
73
+ [renameFrame]
69
74
  )
70
75
 
76
+ /* Mobile rename uses window.prompt */
77
+ useEffect(() => {
78
+ if (!isEditing) {
79
+ promptOpen.current = false
80
+ return
81
+ }
82
+ if (isEditing && shouldUseWindowPrompt && !promptOpen.current) {
83
+ promptOpen.current = true
84
+ const shape = editor.getShape<TLFrameShape>(id)
85
+ const currentName = shape?.props.name ?? ''
86
+ const newName = window.prompt(msg('action.rename'), currentName)
87
+ promptOpen.current = false
88
+ if (newName !== null) renameFrame(newName)
89
+ editor.setEditingShape(null)
90
+ }
91
+ }, [isEditing, shouldUseWindowPrompt, id, msg, renameFrame, editor])
92
+
71
93
  return (
72
- <div className={`tl-frame-label ${isEditing ? 'tl-frame-label__editing' : ''}`}>
94
+ <div
95
+ className={`tl-frame-label ${isEditing && !shouldUseWindowPrompt ? 'tl-frame-label__editing' : ''}`}
96
+ >
73
97
  <input
74
98
  className="tl-frame-name-input"
75
99
  ref={ref}
76
- disabled={!isEditing}
77
- readOnly={!isEditing}
100
+ disabled={!isEditing || shouldUseWindowPrompt}
101
+ readOnly={!isEditing || shouldUseWindowPrompt}
78
102
  style={{ display: isEditing ? undefined : 'none' }}
79
103
  value={name}
80
- autoFocus
104
+ autoFocus={!shouldUseWindowPrompt}
81
105
  onKeyDown={handleKeyDown}
82
106
  onBlur={handleBlur}
83
107
  onChange={handleChange}
@@ -27,8 +27,16 @@ describe('Handle snapping', () => {
27
27
  )
28
28
  })
29
29
 
30
- const geoShape = () => editor.getShape(ids.geo)!
31
- const lineShape = () => editor.getShape(ids.line)!
30
+ const geoShape = () => {
31
+ const shape = editor.getShape(ids.geo)!
32
+ assert(editor.isShapeOfType(shape, 'geo'))
33
+ return shape
34
+ }
35
+ const lineShape = () => {
36
+ const shape = editor.getShape(ids.line)!
37
+ assert(editor.isShapeOfType(shape, 'line'))
38
+ return shape
39
+ }
32
40
  const lineHandles = () => editor.getShapeUtil('line').getHandles!(lineShape())!
33
41
 
34
42
  function startDraggingHandle() {
@@ -24,7 +24,7 @@ export class Pointing extends StateNode {
24
24
  const creatingMarkId = this.editor.markHistoryStoppingPoint(`creating_geo:${id}`)
25
25
  const newPoint = maybeSnapToGrid(originPagePoint, this.editor)
26
26
  this.editor
27
- .createShapes<TLGeoShape>([
27
+ .createShapes([
28
28
  {
29
29
  id,
30
30
  type: 'geo',
@@ -88,7 +88,7 @@ export class Pointing extends StateNode {
88
88
  ? { w: 300, h: 180 }
89
89
  : { w: 200, h: 200 }
90
90
 
91
- this.editor.createShapes<TLGeoShape>([
91
+ this.editor.createShapes([
92
92
  {
93
93
  id,
94
94
  type: 'geo',
@@ -115,7 +115,7 @@ export class Pointing extends StateNode {
115
115
  if (parentTransform) delta.rot(-parentTransform.rotation())
116
116
  const newPoint = maybeSnapToGrid(new Vec(shape.x - delta.x, shape.y - delta.y), this.editor)
117
117
  this.editor.select(id)
118
- this.editor.updateShape<TLGeoShape>({
118
+ this.editor.updateShape({
119
119
  id: shape.id,
120
120
  type: 'geo',
121
121
  x: newPoint.x,
@@ -1,4 +1,4 @@
1
- import { TLLineShape, assert } from '@tldraw/editor'
1
+ import { assert } from '@tldraw/editor'
2
2
  import { TestEditor } from '../../../test/TestEditor'
3
3
 
4
4
  let editor: TestEditor
@@ -127,7 +127,7 @@ describe('When extending the line with the shift-key in tool-lock mode', () => {
127
127
  .pointerUp(20, 10)
128
128
 
129
129
  const line = editor.getCurrentPageShapes()[editor.getCurrentPageShapes().length - 1]
130
- assert(editor.isShapeOfType<TLLineShape>(line, 'line'))
130
+ assert(editor.isShapeOfType(line, 'line'))
131
131
  expect(Object.keys(line.props.points).length).toBe(3)
132
132
  })
133
133
 
@@ -143,7 +143,7 @@ describe('When extending the line with the shift-key in tool-lock mode', () => {
143
143
  .pointerUp(30, 10)
144
144
 
145
145
  const line = editor.getCurrentPageShapes()[editor.getCurrentPageShapes().length - 1]
146
- assert(editor.isShapeOfType<TLLineShape>(line, 'line'))
146
+ assert(editor.isShapeOfType(line, 'line'))
147
147
  expect(Object.keys(line.props.points).length).toBe(2)
148
148
  })
149
149
 
@@ -160,7 +160,7 @@ describe('When extending the line with the shift-key in tool-lock mode', () => {
160
160
  .pointerUp(30, 10)
161
161
 
162
162
  const line = editor.getCurrentPageShapes()[editor.getCurrentPageShapes().length - 1]
163
- assert(editor.isShapeOfType<TLLineShape>(line, 'line'))
163
+ assert(editor.isShapeOfType(line, 'line'))
164
164
  expect(Object.keys(line.props.points).length).toBe(3)
165
165
  })
166
166
 
@@ -179,7 +179,7 @@ describe('When extending the line with the shift-key in tool-lock mode', () => {
179
179
  .pointerUp(30, 10)
180
180
 
181
181
  const line = editor.getCurrentPageShapes()[editor.getCurrentPageShapes().length - 1]
182
- assert(editor.isShapeOfType<TLLineShape>(line, 'line'))
182
+ assert(editor.isShapeOfType(line, 'line'))
183
183
  expect(Object.keys(line.props.points).length).toBe(3)
184
184
  })
185
185
 
@@ -200,7 +200,7 @@ describe('When extending the line with the shift-key in tool-lock mode', () => {
200
200
  .pointerUp(40, 10)
201
201
 
202
202
  const line = editor.getCurrentPageShapes()[editor.getCurrentPageShapes().length - 1]
203
- assert(editor.isShapeOfType<TLLineShape>(line, 'line'))
203
+ assert(editor.isShapeOfType(line, 'line'))
204
204
  expect(Object.keys(line.props.points).length).toBe(3)
205
205
  })
206
206
  })
@@ -24,7 +24,7 @@ beforeEach(() => {
24
24
  editor
25
25
  .selectAll()
26
26
  .deleteShapes(editor.getSelectedShapeIds())
27
- .createShapes<TLLineShape>([
27
+ .createShapes([
28
28
  {
29
29
  id: id,
30
30
  type: 'line',
@@ -168,10 +168,10 @@ describe('Snapping', () => {
168
168
  type: 'line',
169
169
  props: {
170
170
  points: {
171
- a1: { id: 'a1', index: 'a1', x: 0, y: 0 },
172
- a2: { id: 'a2', index: 'a2', x: 100, y: 0 },
173
- a3: { id: 'a3', index: 'a3', x: 100, y: 100 },
174
- a4: { id: 'a4', index: 'a4', x: 0, y: 100 },
171
+ a1: { id: 'a1', index: 'a1' as IndexKey, x: 0, y: 0 },
172
+ a2: { id: 'a2', index: 'a2' as IndexKey, x: 100, y: 0 },
173
+ a3: { id: 'a3', index: 'a3' as IndexKey, x: 100, y: 100 },
174
+ a4: { id: 'a4', index: 'a4' as IndexKey, x: 0, y: 100 },
175
175
  },
176
176
  },
177
177
  })
@@ -89,7 +89,7 @@ export class Pointing extends StateNode {
89
89
 
90
90
  const newPoint = maybeSnapToGrid(currentPagePoint, this.editor)
91
91
 
92
- this.editor.createShapes<TLLineShape>([
92
+ this.editor.createShapes([
93
93
  {
94
94
  id,
95
95
  type: 'line',
@@ -1,3 +1,4 @@
1
+ import { TLNoteShape } from '@tldraw/editor'
1
2
  import { TestEditor } from '../../../test/TestEditor'
2
3
  import { NoteShapeTool } from './NoteShapeTool'
3
4
 
@@ -242,7 +243,7 @@ describe('Adjacent note position helpers (sticky pits)', () => {
242
243
 
243
244
  it('Falls into correct pit below notes with growY', () => {
244
245
  editor.createShape({ type: 'note', x: 0, y: 0 }).updateShape({
245
- ...editor.getLastCreatedShape(),
246
+ ...editor.getLastCreatedShape<TLNoteShape>(),
246
247
  props: { growY: 100 },
247
248
  })
248
249
 
@@ -31,9 +31,9 @@ import {
31
31
  useEditor,
32
32
  useValue,
33
33
  } from '@tldraw/editor'
34
- import { useCallback } from 'react'
34
+ import { useCallback, useContext } from 'react'
35
35
  import { startEditingShapeWithLabel } from '../../tools/SelectTool/selectHelpers'
36
- import { useCurrentTranslation } from '../../ui/hooks/useTranslation/useTranslation'
36
+ import { TranslationsContext } from '../../ui/hooks/useTranslation/useTranslation'
37
37
  import {
38
38
  isEmptyRichText,
39
39
  renderHtmlFromRichTextForMeasurement,
@@ -493,7 +493,8 @@ function getLabelSize(editor: Editor, shape: TLNoteShape) {
493
493
 
494
494
  function useNoteKeydownHandler(id: TLShapeId) {
495
495
  const editor = useEditor()
496
- const translation = useCurrentTranslation()
496
+ // Try to get the translation context, but fallback to ltr if it doesn't exist
497
+ const translation = useContext(TranslationsContext)
497
498
 
498
499
  return useCallback(
499
500
  (e: KeyboardEvent) => {
@@ -512,7 +513,7 @@ function useNoteKeydownHandler(id: TLShapeId) {
512
513
  // tab controls x axis (shift inverts direction set by RTL)
513
514
  // cmd enter is the y axis (shift inverts direction)
514
515
  const isRTL = !!(
515
- translation.dir === 'rtl' ||
516
+ translation?.dir === 'rtl' ||
516
517
  // todo: can we check a partial of the text, so that we don't have to render the whole thing?
517
518
  isRightToLeftLanguage(renderPlaintextFromRichText(editor, shape.props.richText))
518
519
  )
@@ -540,7 +541,7 @@ function useNoteKeydownHandler(id: TLShapeId) {
540
541
  }
541
542
  }
542
543
  },
543
- [id, editor, translation.dir]
544
+ [id, editor, translation?.dir]
544
545
  )
545
546
  }
546
547
 
@@ -104,7 +104,7 @@ export function getAvailableNoteAdjacentPositions(
104
104
  // Get all the positions that are adjacent to the selected note shapes
105
105
  for (const shape of editor.getCurrentPageShapes()) {
106
106
  if (
107
- !editor.isShapeOfType<TLNoteShape>(shape, 'note') ||
107
+ !editor.isShapeOfType(shape, 'note') ||
108
108
  scale !== shape.props.scale ||
109
109
  selectedShapeIds.has(shape.id)
110
110
  ) {
@@ -204,7 +204,7 @@ export function getNoteShapeForAdjacentPosition(
204
204
 
205
205
  // We create it at the center first, so that it becomes
206
206
  // the child of whatever parent was at that center
207
- editor.createShape<TLNoteShape>({
207
+ editor.createShape({
208
208
  id,
209
209
  type: 'note',
210
210
  x: center.x,
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  Box,
3
+ ExtractShapeByProps,
3
4
  TLDefaultFillStyle,
4
5
  TLDefaultFontStyle,
5
6
  TLDefaultHorizontalAlignStyle,
@@ -15,7 +16,7 @@ import { useEditablePlainText } from './useEditablePlainText'
15
16
  /** @public */
16
17
  export interface PlainTextLabelProps {
17
18
  shapeId: TLShapeId
18
- type: string
19
+ type: ExtractShapeByProps<{ text: string }>['type']
19
20
  font: TLDefaultFontStyle
20
21
  fontSize: number
21
22
  lineHeight: number
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Box,
3
3
  DefaultFontFamilies,
4
+ ExtractShapeByProps,
4
5
  TLDefaultFillStyle,
5
6
  TLDefaultFontStyle,
6
7
  TLDefaultHorizontalAlignStyle,
@@ -24,7 +25,7 @@ import { useEditableRichText } from './useEditableRichText'
24
25
  /** @public */
25
26
  export interface RichTextLabelProps {
26
27
  shapeId: TLShapeId
27
- type: string
28
+ type: ExtractShapeByProps<{ richText: TLRichText }>['type']
28
29
  font: TLDefaultFontStyle
29
30
  fontSize: number
30
31
  lineHeight: number
@@ -41,6 +41,9 @@ export const ShapeFill = React.memo(function ShapeFill({
41
41
  case 'pattern': {
42
42
  return <PatternFill theme={theme} color={color} fill={fill} d={d} scale={scale} />
43
43
  }
44
+ case 'lined-fill': {
45
+ return <path fill={getColorValue(theme, color, 'linedFill')} d={d} />
46
+ }
44
47
  }
45
48
  })
46
49
 
@@ -361,6 +361,7 @@ export function getCropBox<T extends ShapeWithCrop>(
361
361
  x: newPoint.x,
362
362
  y: newPoint.y,
363
363
  props: {
364
+ ...shape.props,
364
365
  w: tempBox.w,
365
366
  h: tempBox.h,
366
367
  crop: newCrop,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Editor,
3
+ ExtractShapeByProps,
3
4
  TLShapeId,
4
- TLUnknownShape,
5
5
  getPointerInfo,
6
6
  noop,
7
7
  preventDefault,
@@ -13,7 +13,11 @@ import React, { useCallback, useEffect, useRef } from 'react'
13
13
  import { TextHelpers } from './TextHelpers'
14
14
 
15
15
  /** @public */
16
- export function useEditablePlainText(shapeId: TLShapeId, type: string, text?: string) {
16
+ export function useEditablePlainText(
17
+ shapeId: TLShapeId,
18
+ type: ExtractShapeByProps<{ text: string }>['type'],
19
+ text?: string
20
+ ) {
17
21
  const commonUseEditableTextHandlers = useEditableTextCommon(shapeId)
18
22
  const isEditing = commonUseEditableTextHandlers.isEditing
19
23
  const editor = useEditor()
@@ -75,7 +79,7 @@ export function useEditablePlainText(shapeId: TLShapeId, type: string, text?: st
75
79
  if (editor.getEditingShapeId() !== shapeId) return
76
80
 
77
81
  const normalizedPlaintext = TextHelpers.normalizeText(plaintext || '')
78
- editor.updateShape<TLUnknownShape & { props: { text: string } }>({
82
+ editor.updateShape({
79
83
  id: shapeId,
80
84
  type,
81
85
  props: { text: normalizedPlaintext },
@@ -1,10 +1,14 @@
1
- import { TLRichText, TLShapeId, TLUnknownShape, isAccelKey, useEditor } from '@tldraw/editor'
1
+ import { ExtractShapeByProps, TLRichText, TLShapeId, isAccelKey, useEditor } from '@tldraw/editor'
2
2
  import { useCallback, useEffect, useRef } from 'react'
3
3
  import { isEmptyRichText } from '../../utils/text/richText'
4
4
  import { useEditableTextCommon } from './useEditablePlainText'
5
5
 
6
6
  /** @public */
7
- export function useEditableRichText(shapeId: TLShapeId, type: string, richText?: TLRichText) {
7
+ export function useEditableRichText(
8
+ shapeId: TLShapeId,
9
+ type: ExtractShapeByProps<{ richText: TLRichText }>['type'],
10
+ richText?: TLRichText
11
+ ) {
8
12
  const commonUseEditableTextHandlers = useEditableTextCommon(shapeId)
9
13
  const isEditing = commonUseEditableTextHandlers.isEditing
10
14
  const editor = useEditor()
@@ -39,7 +43,7 @@ export function useEditableRichText(shapeId: TLShapeId, type: string, richText?:
39
43
  ({ richText }: { richText: TLRichText }) => {
40
44
  if (editor.getEditingShapeId() !== shapeId) return
41
45
 
42
- editor.updateShape<TLUnknownShape & { props: { richText: TLRichText } }>({
46
+ editor.updateShape({
43
47
  id: shapeId,
44
48
  type,
45
49
  props: { richText },
@@ -1,4 +1,4 @@
1
- import { DefaultTextAlignStyle, TLTextShape, toRichText } from '@tldraw/editor'
1
+ import { DefaultTextAlignStyle, toRichText } from '@tldraw/editor'
2
2
  import { vi } from 'vitest'
3
3
  import { TestEditor } from '../../../test/TestEditor'
4
4
  import { TextShapeTool } from './TextShapeTool'
@@ -24,7 +24,7 @@ describe(TextShapeTool, () => {
24
24
  editor.pointerUp()
25
25
  editor.expectToBeIn('select.editing_shape')
26
26
  // This comes from the component, not the state chart
27
- editor.updateShapes<TLTextShape>([
27
+ editor.updateShapes([
28
28
  {
29
29
  ...editor.getCurrentPageShapes()[0]!,
30
30
  type: 'text',
@@ -96,7 +96,7 @@ describe('When in idle state', () => {
96
96
  editor.expectToBeIn('select.editing_shape')
97
97
 
98
98
  // Update the text shape with some content
99
- editor.updateShapes<TLTextShape>([
99
+ editor.updateShapes([
100
100
  {
101
101
  ...editor.getCurrentPageShapes()[0]!,
102
102
  type: 'text',
@@ -133,7 +133,7 @@ describe('When in idle state', () => {
133
133
  editor.expectToBeIn('select.editing_shape')
134
134
 
135
135
  // Update the text shape with some content
136
- editor.updateShapes<TLTextShape>([
136
+ editor.updateShapes([
137
137
  {
138
138
  ...editor.getCurrentPageShapes()[0]!,
139
139
  type: 'text',
@@ -124,7 +124,7 @@ export class Pointing extends StateNode {
124
124
  }
125
125
 
126
126
  private createTextShape(id: TLShapeId, point: Vec, autoSize: boolean, width: number) {
127
- this.editor.createShape<TLTextShape>({
127
+ this.editor.createShape({
128
128
  id,
129
129
  type: 'text',
130
130
  x: point.x,
@@ -1,7 +1,5 @@
1
1
  import {
2
2
  StateNode,
3
- TLFrameShape,
4
- TLGroupShape,
5
3
  TLPointerEventInfo,
6
4
  TLShapeId,
7
5
  isAccelKey,
@@ -37,8 +35,8 @@ export class Erasing extends StateNode {
37
35
  if (this.editor.isShapeOrAncestorLocked(shape)) return true
38
36
  //If the shape is a group or frame, check we're inside it when we start erasing
39
37
  if (
40
- this.editor.isShapeOfType<TLGroupShape>(shape, 'group') ||
41
- this.editor.isShapeOfType<TLFrameShape>(shape, 'frame')
38
+ this.editor.isShapeOfType(shape, 'group') ||
39
+ this.editor.isShapeOfType(shape, 'frame')
42
40
  ) {
43
41
  const pointInShapeShape = this.editor.getPointInShapeSpace(shape, originPagePoint)
44
42
  const geometry = this.editor.getShapeGeometry(shape)
@@ -111,7 +109,7 @@ export class Erasing extends StateNode {
111
109
  const minDist = this.editor.options.hitTestMargin / zoomLevel
112
110
 
113
111
  for (const shape of currentPageShapes) {
114
- if (editor.isShapeOfType<TLGroupShape>(shape, 'group')) continue
112
+ if (editor.isShapeOfType(shape, 'group')) continue
115
113
 
116
114
  // Avoid testing masked shapes, unless the pointer is inside the mask
117
115
  const pageMask = editor.getShapeMask(shape.id)
@@ -1,11 +1,4 @@
1
- import {
2
- isAccelKey,
3
- StateNode,
4
- TLFrameShape,
5
- TLGroupShape,
6
- TLPointerEventInfo,
7
- TLShapeId,
8
- } from '@tldraw/editor'
1
+ import { isAccelKey, StateNode, TLPointerEventInfo, TLShapeId } from '@tldraw/editor'
9
2
 
10
3
  export class Pointing extends StateNode {
11
4
  static override id = 'pointing'
@@ -27,10 +20,7 @@ export class Pointing extends StateNode {
27
20
 
28
21
  for (let n = currentPageShapesSorted.length, i = n - 1; i >= 0; i--) {
29
22
  const shape = currentPageShapesSorted[i]
30
- if (
31
- this.editor.isShapeOrAncestorLocked(shape) ||
32
- this.editor.isShapeOfType<TLGroupShape>(shape, 'group')
33
- ) {
23
+ if (this.editor.isShapeOrAncestorLocked(shape) || this.editor.isShapeOfType(shape, 'group')) {
34
24
  continue
35
25
  }
36
26
 
@@ -42,10 +32,7 @@ export class Pointing extends StateNode {
42
32
  ) {
43
33
  const hitShape = this.editor.getOutermostSelectableShape(shape)
44
34
  // If we've hit a frame after hitting any other shape, stop here
45
- if (
46
- this.editor.isShapeOfType<TLFrameShape>(hitShape, 'frame') &&
47
- erasing.size > initialSize
48
- ) {
35
+ if (this.editor.isShapeOfType(hitShape, 'frame') && erasing.size > initialSize) {
49
36
  break
50
37
  }
51
38
 
@@ -44,7 +44,7 @@ export class DragAndDropManager {
44
44
 
45
45
  for (const shape of shapesToActuallyMove) {
46
46
  const parent = editor.getShapeParent(shape)
47
- if (parent && editor.isShapeOfType<TLGroupShape>(parent, 'group')) {
47
+ if (parent && editor.isShapeOfType(parent, 'group')) {
48
48
  if (!movingGroups.has(parent)) {
49
49
  movingGroups.add(parent)
50
50
  }
@@ -70,9 +70,7 @@ export class DragAndDropManager {
70
70
  }
71
71
  this.initialIndices.set(shape.id, shape.index)
72
72
 
73
- const group = editor.findShapeAncestor(shape, (s) =>
74
- editor.isShapeOfType<TLGroupShape>(s, 'group')
75
- )
73
+ const group = editor.findShapeAncestor(shape, (s) => editor.isShapeOfType(s, 'group'))
76
74
  if (group) {
77
75
  this.initialGroupIds.set(shape.id, group.id)
78
76
  }
@@ -3,8 +3,6 @@ import {
3
3
  Mat,
4
4
  StateNode,
5
5
  TLCancelEventInfo,
6
- TLFrameShape,
7
- TLGroupShape,
8
6
  TLKeyboardEventInfo,
9
7
  TLPageId,
10
8
  TLPointerEventInfo,
@@ -57,9 +55,7 @@ export class Brushing extends StateNode {
57
55
  editor
58
56
  .getCurrentPageShapes()
59
57
  .filter(
60
- (shape) =>
61
- editor.isShapeOfType<TLGroupShape>(shape, 'group') ||
62
- editor.isShapeOrAncestorLocked(shape)
58
+ (shape) => editor.isShapeOfType(shape, 'group') || editor.isShapeOrAncestorLocked(shape)
63
59
  )
64
60
  .map((shape) => shape.id)
65
61
  )
@@ -177,7 +173,7 @@ export class Brushing extends StateNode {
177
173
 
178
174
  // If we're in wrap mode and the brush did not fully encloses the shape, it's a miss
179
175
  // We also skip frames unless we've completely selected the frame.
180
- if (isWrapping || editor.isShapeOfType<TLFrameShape>(shape, 'frame')) {
176
+ if (isWrapping || editor.isShapeOfType(shape, 'frame')) {
181
177
  continue testAllShapes
182
178
  }
183
179
 
@@ -2,7 +2,6 @@ import {
2
2
  ShapeWithCrop,
3
3
  StateNode,
4
4
  TLClickEventInfo,
5
- TLGroupShape,
6
5
  TLKeyboardEventInfo,
7
6
  TLPointerEventInfo,
8
7
  Vec,
@@ -43,7 +42,7 @@ export class Idle extends StateNode {
43
42
  switch (info.target) {
44
43
  case 'canvas': {
45
44
  const hitShape = getHitShapeOnCanvasPointerDown(this.editor)
46
- if (hitShape && !this.editor.isShapeOfType<TLGroupShape>(hitShape, 'group')) {
45
+ if (hitShape && !this.editor.isShapeOfType(hitShape, 'group')) {
47
46
  this.onPointerDown({
48
47
  ...info,
49
48
  shape: hitShape,
@@ -191,7 +190,7 @@ export class Idle extends StateNode {
191
190
  this.editor.markHistoryStoppingPoint('translate crop')
192
191
  }
193
192
 
194
- this.editor.updateShapes<ShapeWithCrop>([partial])
193
+ this.editor.updateShapes([partial])
195
194
  }
196
195
  }
197
196
  }