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,4 +1,3 @@
1
- import { vi } from 'vitest'
2
1
  import { HandTool } from '../lib/tools/HandTool/HandTool'
3
2
  import { TestEditor, createDefaultShapes } from './TestEditor'
4
3
 
@@ -15,7 +14,7 @@ afterEach(() => {
15
14
  editor?.dispose()
16
15
  })
17
16
 
18
- vi.useFakeTimers()
17
+ jest.useFakeTimers()
19
18
 
20
19
  describe(HandTool, () => {
21
20
  it('Double taps to zoom in', () => {
@@ -23,9 +22,9 @@ describe(HandTool, () => {
23
22
  expect(editor.getZoomLevel()).toBe(1)
24
23
  editor.click()
25
24
  editor.click() // double click!
26
- vi.advanceTimersByTime(300)
25
+ jest.advanceTimersByTime(300)
27
26
  expect(editor.getZoomLevel()).not.toBe(1) // animating
28
- vi.advanceTimersByTime(300)
27
+ jest.advanceTimersByTime(300)
29
28
  expect(editor.getZoomLevel()).toBe(2) // all done
30
29
  })
31
30
 
@@ -35,9 +34,9 @@ describe(HandTool, () => {
35
34
  editor.click()
36
35
  editor.click()
37
36
  editor.click() // triple click!
38
- vi.advanceTimersByTime(300)
37
+ jest.advanceTimersByTime(300)
39
38
  expect(editor.getZoomLevel()).not.toBe(1) // animating
40
- vi.advanceTimersByTime(300)
39
+ jest.advanceTimersByTime(300)
41
40
  expect(editor.getZoomLevel()).toBe(0.5) // all done
42
41
  })
43
42
 
@@ -49,9 +48,9 @@ describe(HandTool, () => {
49
48
  editor.click()
50
49
  editor.click()
51
50
  editor.click() // quad click!
52
- vi.advanceTimersByTime(300)
51
+ jest.advanceTimersByTime(300)
53
52
  expect(editor.getZoomLevel()).not.toBe(2) // animating
54
- vi.advanceTimersByTime(300)
53
+ jest.advanceTimersByTime(300)
55
54
  expect(editor.getZoomLevel()).toBe(1) // all done
56
55
  })
57
56
 
@@ -63,9 +62,9 @@ describe(HandTool, () => {
63
62
  editor.click()
64
63
  editor.click()
65
64
  editor.click() // quad click!
66
- vi.advanceTimersByTime(300)
65
+ jest.advanceTimersByTime(300)
67
66
  expect(editor.getZoomLevel()).not.toBe(1) // animating
68
- vi.advanceTimersByTime(300)
67
+ jest.advanceTimersByTime(300)
69
68
  const z = editor.getZoomLevel()
70
69
  editor.zoomToFit() // call zoom to fit manually to compare
71
70
  expect(editor.getZoomLevel()).toBe(z) // zoom should not have changed
@@ -1,7 +1,6 @@
1
- import { vi } from 'vitest'
2
1
  import { TestEditor } from './TestEditor'
3
2
 
4
- vi.useFakeTimers()
3
+ jest.useFakeTimers()
5
4
 
6
5
  let editor: TestEditor
7
6
 
@@ -7,7 +7,6 @@ import {
7
7
  createShapeId,
8
8
  toRichText,
9
9
  } from '@tldraw/editor'
10
- import { vi } from 'vitest'
11
10
  import { TestEditor } from './TestEditor'
12
11
 
13
12
  let editor: TestEditor
@@ -19,7 +18,7 @@ const ids = {
19
18
  arrow1: createShapeId('arrow1'),
20
19
  }
21
20
 
22
- vi.useFakeTimers()
21
+ jest.useFakeTimers()
23
22
 
24
23
  beforeEach(() => {
25
24
  editor = new TestEditor()
@@ -161,7 +160,7 @@ describe('TLSelectTool.Translating', () => {
161
160
  // There's a timer here! We shouldn't end the clone until the timer is done
162
161
  expect(editor.getCurrentPageShapes().length).toBe(2)
163
162
 
164
- vi.advanceTimersByTime(250) // tick tock
163
+ jest.advanceTimersByTime(250) // tick tock
165
164
 
166
165
  // Timer is done! We should have ended the clone.
167
166
  expect(editor.getCurrentPageShapes().length).toBe(1)
@@ -276,27 +275,17 @@ describe('PointingLabel', () => {
276
275
  type: 'arrow',
277
276
  x: 100,
278
277
  y: 100,
279
- props: {
280
- richText: toRichText('Test Label'),
281
- start: { x: 0, y: 0 },
282
- end: { x: 100, y: 0 },
283
- },
278
+ props: { text: 'Test Label', end: { x: 100, y: 100 } },
284
279
  },
285
280
  ])
286
- const shape = editor.getShape(ids.arrow1)!
287
- // First select the shape so it's already selected
288
- editor.select(shape.id)
289
-
290
- // Click at the middle of the arrow where the label would be and drag to move the label
291
- editor.pointerDown(150, 100, {
281
+ const shape = editor.getShape(ids.arrow1)
282
+ editor.pointerDown(150, 150, {
292
283
  target: 'shape',
293
284
  shape,
294
285
  })
295
- editor.pointerMove(160, 100)
286
+ editor.pointerMove(100, 100)
296
287
  editor.expectToBeIn('select.pointing_arrow_label')
297
288
 
298
- // Continue dragging to actually move the label, then it should go to idle
299
- editor.pointerMove(170, 100)
300
289
  editor.pointerUp()
301
290
  editor.expectToBeIn('select.idle')
302
291
  })
@@ -308,21 +297,16 @@ describe('PointingLabel', () => {
308
297
  type: 'arrow',
309
298
  x: 100,
310
299
  y: 100,
311
- props: {
312
- richText: toRichText('Test Label'),
313
- start: { x: 0, y: 0 },
314
- end: { x: 100, y: 0 },
315
- },
300
+ props: { text: 'Test Label', end: { x: 100, y: 100 } },
316
301
  },
317
302
  ])
318
303
  const shape = editor.getShape(ids.arrow1)
319
304
 
320
- // Click at the middle of the arrow where the label would be
321
- editor.pointerDown(150, 100, {
305
+ editor.pointerDown(150, 150, {
322
306
  target: 'shape',
323
307
  shape,
324
308
  })
325
- editor.pointerMove(160, 100)
309
+ editor.pointerMove(100, 100)
326
310
  editor.expectToBeIn('select.pointing_arrow_label')
327
311
  editor.cancel()
328
312
  editor.expectToBeIn('select.idle')
@@ -330,25 +314,14 @@ describe('PointingLabel', () => {
330
314
 
331
315
  it('Doesnt go into pointing_arrow_label mode if not selecting the arrow shape', () => {
332
316
  editor.createShapes<TLArrowShape>([
333
- {
334
- id: ids.arrow1,
335
- type: 'arrow',
336
- x: 100,
337
- y: 100,
338
- props: {
339
- richText: toRichText(''), // Empty label
340
- start: { x: 0, y: 0 },
341
- end: { x: 100, y: 0 },
342
- },
343
- },
317
+ { id: ids.arrow1, type: 'arrow', x: 100, y: 100, props: { text: 'Test Label' } },
344
318
  ])
345
- const shape = editor.getShape(ids.arrow1)!
346
- // Click anywhere on the arrow - since there's no label, it should go to translating
347
- editor.pointerDown(150, 100, {
319
+ const shape = editor.getShape(ids.arrow1)
320
+ editor.pointerDown(0, 150, {
348
321
  target: 'shape',
349
322
  shape,
350
323
  })
351
- editor.pointerMove(155, 105)
324
+ editor.pointerMove(100, 100)
352
325
  editor.expectToBeIn('select.translating')
353
326
 
354
327
  editor.pointerUp()
@@ -1,5 +1,4 @@
1
1
  import { TLUserPreferences, atom, createTLUser } from '@tldraw/editor'
2
- import { vi } from 'vitest'
3
2
  import { TestEditor } from './TestEditor'
4
3
 
5
4
  let editor: TestEditor
@@ -60,7 +59,7 @@ describe('TLUserPreferences', () => {
60
59
  locale: null,
61
60
  name: null,
62
61
  })
63
- const setUserPreferences = vi.fn((preferences) => userPreferences.set(preferences))
62
+ const setUserPreferences = jest.fn((preferences) => userPreferences.set(preferences))
64
63
 
65
64
  editor = new TestEditor({
66
65
  user: createTLUser({
@@ -81,7 +80,7 @@ describe('TLUserPreferences', () => {
81
80
  id: '123',
82
81
  name: 'blah',
83
82
  })
84
- const setUserPreferences = vi.fn((preferences) => userPreferences.set(preferences))
83
+ const setUserPreferences = jest.fn((preferences) => userPreferences.set(preferences))
85
84
 
86
85
  editor = new TestEditor({
87
86
  user: createTLUser({
@@ -102,7 +101,7 @@ describe('TLUserPreferences', () => {
102
101
  id: '123',
103
102
  name: 'blah',
104
103
  })
105
- const setUserPreferences = vi.fn((preferences) => userPreferences.set(preferences))
104
+ const setUserPreferences = jest.fn((preferences) => userPreferences.set(preferences))
106
105
 
107
106
  editor = new TestEditor({
108
107
  user: createTLUser({
@@ -34,7 +34,6 @@ import {
34
34
  rotateSelectionHandle,
35
35
  tlenv,
36
36
  } from '@tldraw/editor'
37
- import { vi } from 'vitest'
38
37
  import { defaultBindingUtils } from '../lib/defaultBindingUtils'
39
38
  import { defaultShapeTools } from '../lib/defaultShapeTools'
40
39
  import { defaultShapeUtils } from '../lib/defaultShapeUtils'
@@ -43,14 +42,7 @@ import { defaultTools } from '../lib/defaultTools'
43
42
  import { defaultAddFontsFromNode, tipTapDefaultExtensions } from '../lib/utils/text/richText'
44
43
  import { shapesFromJsx } from './test-jsx'
45
44
 
46
- declare module 'vitest' {
47
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
48
- interface Matchers<T = any> {
49
- toCloselyMatchObject(expected: any, roundToNearest?: number): void
50
- }
51
- }
52
-
53
- vi.useFakeTimers()
45
+ jest.useFakeTimers()
54
46
 
55
47
  Object.assign(navigator, {
56
48
  clipboard: {
@@ -63,6 +55,16 @@ Object.assign(navigator, {
63
55
  // @ts-expect-error
64
56
  window.ClipboardItem = class {}
65
57
 
58
+ declare global {
59
+ // eslint-disable-next-line @typescript-eslint/no-namespace
60
+ namespace jest {
61
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
62
+ interface Matchers<R> {
63
+ toCloselyMatchObject(value: any, precision?: number): void
64
+ }
65
+ }
66
+ }
67
+
66
68
  export class TestEditor extends Editor {
67
69
  constructor(
68
70
  options: Partial<Omit<TLEditorOptions, 'store'>> = {},
@@ -80,8 +82,8 @@ export class TestEditor extends Editor {
80
82
  right: 1080,
81
83
  }
82
84
  // make the app full screen for the sake of the insets property
83
- vi.spyOn(document.body, 'scrollWidth', 'get').mockImplementation(() => bounds.width)
84
- vi.spyOn(document.body, 'scrollHeight', 'get').mockImplementation(() => bounds.height)
85
+ jest.spyOn(document.body, 'scrollWidth', 'get').mockImplementation(() => bounds.width)
86
+ jest.spyOn(document.body, 'scrollHeight', 'get').mockImplementation(() => bounds.height)
85
87
 
86
88
  elm.tabIndex = 0
87
89
  elm.getBoundingClientRect = () => bounds as DOMRect
@@ -270,12 +272,12 @@ export class TestEditor extends Editor {
270
272
  * methods, or call mockRestore() to restore the actual implementation (e.g.
271
273
  * _transformPointerDownSpy.mockRestore())
272
274
  */
273
- _transformPointerDownSpy = vi
275
+ _transformPointerDownSpy = jest
274
276
  .spyOn(this._clickManager, 'handlePointerEvent')
275
277
  .mockImplementation((info) => {
276
278
  return info
277
279
  })
278
- _transformPointerUpSpy = vi
280
+ _transformPointerUpSpy = jest
279
281
  .spyOn(this._clickManager, 'handlePointerEvent')
280
282
  .mockImplementation((info) => {
281
283
  return info
@@ -12,7 +12,6 @@ import {
12
12
  noop,
13
13
  } from '@tldraw/editor'
14
14
  import { StrictMode } from 'react'
15
- import { vi } from 'vitest'
16
15
  import { defaultShapeUtils } from '../lib/defaultShapeUtils'
17
16
  import { defaultTools } from '../lib/defaultTools'
18
17
  import { GeoShapeUtil } from '../lib/shapes/geo/GeoShapeUtil'
@@ -90,7 +89,7 @@ describe('<TldrawEditor />', () => {
90
89
  })
91
90
 
92
91
  it('throws if the store has different shapes to the ones passed in', async () => {
93
- const spy = vi.spyOn(console, 'error').mockImplementation(noop)
92
+ const spy = jest.spyOn(console, 'error').mockImplementation(noop)
94
93
  // expect(() =>
95
94
  // render(
96
95
  // <TldrawEditor
@@ -130,7 +129,7 @@ describe('<TldrawEditor />', () => {
130
129
 
131
130
  it('Accepts fresh versions of store and calls `onMount` for each one', async () => {
132
131
  const initialStore = createTLStore({ shapeUtils: [], bindingUtils: [] })
133
- const onMount = vi.fn()
132
+ const onMount = jest.fn()
134
133
  const rendered = await renderTldrawComponent(
135
134
  <TldrawEditor
136
135
  initialState="select"
@@ -140,8 +139,8 @@ describe('<TldrawEditor />', () => {
140
139
  />,
141
140
  { waitForPatterns: false }
142
141
  )
143
- const initialEditor = onMount.mock.lastCall![0]
144
- vi.spyOn(initialEditor, 'dispose')
142
+ const initialEditor = onMount.mock.lastCall[0]
143
+ jest.spyOn(initialEditor, 'dispose')
145
144
  expect(initialEditor.store).toBe(initialStore)
146
145
  // re-render with the same store:
147
146
  rendered.rerender(
@@ -162,7 +161,7 @@ describe('<TldrawEditor />', () => {
162
161
  await rendered.findAllByTestId('canvas')
163
162
  expect(initialEditor.dispose).toHaveBeenCalledTimes(1)
164
163
  expect(onMount).toHaveBeenCalledTimes(2)
165
- expect(onMount.mock.lastCall![0].store).toBe(newStore)
164
+ expect(onMount.mock.lastCall[0].store).toBe(newStore)
166
165
  })
167
166
 
168
167
  it('Renders the canvas and shapes', async () => {
@@ -228,7 +227,7 @@ describe('<TldrawEditor />', () => {
228
227
 
229
228
  it('renders correctly in strict mode', async () => {
230
229
  const editorInstances = new Set<Editor>()
231
- const onMount = vi.fn((editor: Editor) => {
230
+ const onMount = jest.fn((editor: Editor) => {
232
231
  editorInstances.add(editor)
233
232
  })
234
233
  await renderTldrawComponent(
@@ -246,7 +245,7 @@ describe('<TldrawEditor />', () => {
246
245
 
247
246
  it('allows updating camera options without re-creating the editor', async () => {
248
247
  const editors: Editor[] = []
249
- const onMount = vi.fn((editor: Editor) => {
248
+ const onMount = jest.fn((editor: Editor) => {
250
249
  if (!editors.includes(editor)) editors.push(editor)
251
250
  })
252
251
 
@@ -362,7 +361,7 @@ describe('<TldrawEditor />', () => {
362
361
  })
363
362
 
364
363
  it('passes through the `assets` prop when creating its own in-memory store', async () => {
365
- const myUploadFn = vi.fn()
364
+ const myUploadFn = jest.fn()
366
365
  const assetStore: TLAssetStore = { upload: myUploadFn }
367
366
 
368
367
  const { editor } = await renderTldrawComponentWithEditor(
@@ -376,7 +375,7 @@ describe('<TldrawEditor />', () => {
376
375
  })
377
376
 
378
377
  it('passes through the `assets` prop when using `persistenceKey`', async () => {
379
- const myUploadFn = vi.fn()
378
+ const myUploadFn = jest.fn()
380
379
  const assetStore: TLAssetStore = { upload: myUploadFn }
381
380
 
382
381
  const { editor } = await renderTldrawComponentWithEditor(
@@ -395,7 +394,7 @@ describe('<TldrawEditor />', () => {
395
394
  })
396
395
 
397
396
  it('will not re-create the editor if re-rendered with identical options', async () => {
398
- const onMount = vi.fn()
397
+ const onMount = jest.fn()
399
398
 
400
399
  const renderer = await renderTldrawComponent(
401
400
  <TldrawEditor onMount={onMount} options={{ maxPages: 1 }} />,
@@ -1,5 +1,4 @@
1
1
  import { createShapeId } from '@tldraw/editor'
2
- import { vi } from 'vitest'
3
2
  import { TestEditor } from './TestEditor'
4
3
 
5
4
  let editor: TestEditor
@@ -8,7 +7,7 @@ const ids = {
8
7
  box1: createShapeId('box1'),
9
8
  }
10
9
 
11
- vi.useFakeTimers()
10
+ jest.useFakeTimers()
12
11
 
13
12
  beforeEach(() => {
14
13
  editor = new TestEditor()
@@ -45,7 +44,7 @@ describe('TLSelectTool.Zooming', () => {
45
44
  expect(editor.getViewportPageCenter()).toMatchObject({ x: 540, y: 360 })
46
45
  editor.click()
47
46
  editor.expectToBeIn('zoom.idle')
48
- vi.advanceTimersByTime(300)
47
+ jest.advanceTimersByTime(300)
49
48
  expect(editor.getZoomLevel()).toBe(2)
50
49
  })
51
50
 
@@ -56,7 +55,7 @@ describe('TLSelectTool.Zooming', () => {
56
55
  expect(editor.getViewportPageBounds()).toMatchObject({ x: -0, y: -0, w: 1080, h: 720 })
57
56
  expect(editor.getViewportPageCenter()).toMatchObject({ x: 540, y: 360 })
58
57
  editor.click()
59
- vi.advanceTimersByTime(300)
58
+ jest.advanceTimersByTime(300)
60
59
  expect(editor.getZoomLevel()).toBe(0.5)
61
60
  })
62
61
 
@@ -123,7 +122,7 @@ describe('TLSelectTool.Zooming', () => {
123
122
  editor.expectToBeIn('zoom.zoom_brushing')
124
123
  editor.pointerUp(change, change)
125
124
  editor.expectToBeIn('zoom.idle')
126
- vi.advanceTimersByTime(300)
125
+ jest.advanceTimersByTime(300)
127
126
  expect(editor.getZoomLevel()).toBe(2)
128
127
  expect(editor.getViewportPageBounds()).toMatchObject({
129
128
  x: change / 2,
@@ -157,7 +156,7 @@ describe('TLSelectTool.Zooming', () => {
157
156
  h: newBoundsHeight,
158
157
  })
159
158
  editor.pointerUp(newBoundsX + newBoundsWidth, newBoundsY + newBoundsHeight)
160
- vi.advanceTimersByTime(300)
159
+ jest.advanceTimersByTime(300)
161
160
  expect(editor.getZoomLevel()).toBeCloseTo(1.64)
162
161
  expect(editor.getViewportPageBounds()).toMatchInlineSnapshot(`
163
162
  Box {
@@ -196,7 +195,7 @@ describe('TLSelectTool.Zooming', () => {
196
195
  h: newBoundsHeight,
197
196
  })
198
197
  editor.pointerUp()
199
- vi.advanceTimersByTime(500)
198
+ jest.advanceTimersByTime(500)
200
199
  expect(editor.getZoomLevel()).toBeCloseTo(originalZoomLevel / 2)
201
200
  expect(editor.getViewportPageBounds()).toMatchObject({
202
201
  x: -440,
@@ -1,6 +1,6 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`Draws a bunch > draw shape 1`] = `
3
+ exports[`Draws a bunch: draw shape 1`] = `
4
4
  {
5
5
  "index": "a1",
6
6
  "isLocked": false,
@@ -1,6 +1,6 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`creating new shapes > pencil > lines > will reisze the group appropriately if the new shape changes the group bounds > box shape after second resize 1`] = `
3
+ exports[`creating new shapes pencil lines will reisze the group appropriately if the new shape changes the group bounds: box shape after second resize 1`] = `
4
4
  {
5
5
  "h": 40,
6
6
  "w": 40,
@@ -9,7 +9,7 @@ exports[`creating new shapes > pencil > lines > will reisze the group appropriat
9
9
  }
10
10
  `;
11
11
 
12
- exports[`creating new shapes > pencil > lines > will reisze the group appropriately if the new shape changes the group bounds > group shape after second resize 1`] = `
12
+ exports[`creating new shapes pencil lines will reisze the group appropriately if the new shape changes the group bounds: group shape after second resize 1`] = `
13
13
  {
14
14
  "h": 120,
15
15
  "w": 120,
@@ -18,7 +18,7 @@ exports[`creating new shapes > pencil > lines > will reisze the group appropriat
18
18
  }
19
19
  `;
20
20
 
21
- exports[`creating new shapes > pencil > lines > will reisze the group appropriately if the new shape changes the group bounds > group with line shape 1`] = `
21
+ exports[`creating new shapes pencil lines will reisze the group appropriately if the new shape changes the group bounds: group with line shape 1`] = `
22
22
  Box {
23
23
  "h": 110,
24
24
  "w": 110,
@@ -27,7 +27,7 @@ Box {
27
27
  }
28
28
  `;
29
29
 
30
- exports[`creating new shapes > pencil > lines > works if the shape drawing begins outside of the current group bounds > box shape after resize 1`] = `
30
+ exports[`creating new shapes pencil lines works if the shape drawing begins outside of the current group bounds: box shape after resize 1`] = `
31
31
  {
32
32
  "h": 50,
33
33
  "w": 50,
@@ -36,7 +36,7 @@ exports[`creating new shapes > pencil > lines > works if the shape drawing begin
36
36
  }
37
37
  `;
38
38
 
39
- exports[`creating new shapes > pencil > lines > works if the shape drawing begins outside of the current group bounds > group with line 1`] = `
39
+ exports[`creating new shapes pencil lines works if the shape drawing begins outside of the current group bounds: group with line 1`] = `
40
40
  {
41
41
  "h": 200,
42
42
  "w": 200,
@@ -1,6 +1,6 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`When resizing a shape with children > Resizes a rotated draw shape > draw shape after rotating 1`] = `
3
+ exports[`When resizing a shape with children Resizes a rotated draw shape: draw shape after rotating 1`] = `
4
4
  {
5
5
  "id": "shape:lineA",
6
6
  "index": "a3",
@@ -1,5 +1,4 @@
1
1
  import { TLArrowShape, TLShapeId, Vec, createShapeId } from '@tldraw/editor'
2
- import { vi } from 'vitest'
3
2
  import { getArrowBindings } from '../lib/shapes/arrow/shared'
4
3
  import { TestEditor } from './TestEditor'
5
4
  import { TL } from './test-jsx'
@@ -209,7 +208,7 @@ describe('When binding an arrow to a shape', () => {
209
208
 
210
209
  editor.keyUp('Control')
211
210
  expect(bindings().end).toBeUndefined() // there's a short delay here, it should still be a point
212
- vi.advanceTimersByTime(1000) // once the timer runs out...
211
+ jest.advanceTimersByTime(1000) // once the timer runs out...
213
212
  expect(bindings().end).toBeDefined()
214
213
 
215
214
  editor.keyDown('Control') // no delay when pressing control again though
@@ -217,7 +216,7 @@ describe('When binding an arrow to a shape', () => {
217
216
 
218
217
  editor.keyUp('Control')
219
218
  editor.pointerUp()
220
- vi.advanceTimersByTime(1000) // once the timer runs out...
219
+ jest.advanceTimersByTime(1000) // once the timer runs out...
221
220
  expect(bindings().end).toBeUndefined() // still a point because interaction ended before timer ended
222
221
  })
223
222
 
@@ -238,7 +237,7 @@ describe('When binding an arrow to a shape', () => {
238
237
  // Releasing ctrl should restore binding (after timer)
239
238
  editor.keyUp('Control')
240
239
  expect(bindings().end).toBeUndefined() // Still no binding immediately
241
- vi.advanceTimersByTime(1000)
240
+ jest.advanceTimersByTime(1000)
242
241
  expect(bindings().end).toBeDefined()
243
242
  })
244
243
  })
@@ -289,13 +288,11 @@ describe('When shapes are overlapping', () => {
289
288
  editor.pointerDown(0, 50) // over nothing
290
289
  editor.pointerMove(125, 50) // over box1 only
291
290
  expect(bindings().end).toMatchObject({ toId: ids.box1 })
292
- editor.pointerMove(175, 50) // box2 is higher but box1 is filled, but we're on the edge ofd box 2
293
- expect(bindings().end).toMatchObject({ toId: ids.box2 })
294
- editor.pointerMove(175, 70) // box2 is higher but box1 is filled, and we're inside of box2
291
+ editor.pointerMove(175, 50) // box2 is higher but box1 is filled?
295
292
  expect(bindings().end).toMatchObject({ toId: ids.box1 })
296
- editor.pointerMove(225, 70) // box3 is higher
293
+ editor.pointerMove(225, 50) // box3 is higher
297
294
  expect(bindings().end).toMatchObject({ toId: ids.box3 })
298
- editor.pointerMove(275, 70) // box4 is higher but box 3 is filled
295
+ editor.pointerMove(275, 50) // box4 is higher but box 3 is filled
299
296
  expect(bindings().end).toMatchObject({ toId: ids.box3 })
300
297
  })
301
298
 
@@ -307,18 +304,14 @@ describe('When shapes are overlapping', () => {
307
304
  ])
308
305
  editor.setCurrentTool('arrow')
309
306
  editor.pointerDown(0, 50)
310
- editor.pointerMove(175, 50) // box1 is smaller even though it's behind box2, but we're on the edge of box 2
311
- expect(bindings().end).toMatchObject({ toId: ids.box2 })
312
- editor.pointerMove(175, 70) // box1 is smaller even though it's behind box2
307
+ editor.pointerMove(175, 50) // box1 is smaller even though it's behind box2
313
308
  expect(bindings().end).toMatchObject({ toId: ids.box1 })
314
- editor.pointerMove(150, 90) // box3 is smaller and at the front but we're on the edge of box 2
315
- expect(bindings().end).toMatchObject({ toId: ids.box2 })
316
- editor.pointerMove(160, 90) // box3 is smaller and at the front and we're in box1 and box 3 and box 2
309
+ editor.pointerMove(150, 90) // box3 is smaller and at the front
317
310
  expect(bindings().end).toMatchObject({ toId: ids.box3 })
318
311
  editor.sendToBack([ids.box3])
319
312
  editor.pointerMove(149, 90) // box3 is smaller, even when at the back
320
313
  expect(bindings().end).toMatchObject({ toId: ids.box3 })
321
- editor.pointerMove(175, 60) // inside of box1 and box 2, but box 1 is smaller
314
+ editor.pointerMove(175, 50)
322
315
  expect(bindings().end).toMatchObject({ toId: ids.box1 })
323
316
  })
324
317
  })
@@ -410,7 +403,7 @@ describe('When starting an arrow inside of multiple shapes', () => {
410
403
  editor.pointerDown(20, 20) // upper left
411
404
  expect(editor.getCurrentPageShapes().length).toBe(1)
412
405
  expect(arrow()).toBe(null)
413
- vi.advanceTimersByTime(1000)
406
+ jest.advanceTimersByTime(1000)
414
407
  editor.pointerMove(25, 20)
415
408
  expect(editor.getCurrentPageShapes().length).toBe(2)
416
409
  expect(arrow()).toMatchObject({ x: 20, y: 20 })
@@ -11,7 +11,6 @@ import {
11
11
  createBindingId,
12
12
  createShapeId,
13
13
  } from '@tldraw/editor'
14
- import { vi } from 'vitest'
15
14
  import { TestEditor } from './TestEditor'
16
15
  import { TL } from './test-jsx'
17
16
 
@@ -24,19 +23,37 @@ const ids = {
24
23
  box4: createShapeId('box4'),
25
24
  }
26
25
 
27
- const mockOnOperationComplete = vi.fn()
28
- const mockOnBeforeDelete = vi.fn()
29
- const mockOnAfterDelete = vi.fn()
30
- const mockOnBeforeFromShapeDelete = vi.fn()
31
- const mockOnBeforeToShapeDelete = vi.fn()
32
- const mockOnBeforeFromShapeIsolate = vi.fn()
33
- const mockOnBeforeToShapeIsolate = vi.fn()
34
- const mockOnBeforeCreate = vi.fn()
35
- const mockOnAfterCreate = vi.fn()
36
- const mockOnBeforeChange = vi.fn()
37
- const mockOnAfterChange = vi.fn()
38
- const mockOnAfterChangeFromShape = vi.fn()
39
- const mockOnAfterChangeToShape = vi.fn()
26
+ const mockOnOperationComplete = jest.fn() as jest.Mock<void, []>
27
+ const mockOnBeforeDelete = jest.fn() as jest.Mock<void, [BindingOnDeleteOptions<TLUnknownBinding>]>
28
+ const mockOnAfterDelete = jest.fn() as jest.Mock<void, [BindingOnDeleteOptions<TLUnknownBinding>]>
29
+ const mockOnBeforeFromShapeDelete = jest.fn() as jest.Mock<
30
+ void,
31
+ [BindingOnShapeDeleteOptions<TLUnknownBinding>]
32
+ >
33
+ const mockOnBeforeToShapeDelete = jest.fn() as jest.Mock<
34
+ void,
35
+ [BindingOnShapeDeleteOptions<TLUnknownBinding>]
36
+ >
37
+ const mockOnBeforeFromShapeIsolate = jest.fn() as jest.Mock<
38
+ void,
39
+ [BindingOnShapeIsolateOptions<TLUnknownBinding>]
40
+ >
41
+ const mockOnBeforeToShapeIsolate = jest.fn() as jest.Mock<
42
+ void,
43
+ [BindingOnShapeIsolateOptions<TLUnknownBinding>]
44
+ >
45
+ const mockOnBeforeCreate = jest.fn() as jest.Mock<void, [BindingOnCreateOptions<TLUnknownBinding>]>
46
+ const mockOnAfterCreate = jest.fn() as jest.Mock<void, [BindingOnCreateOptions<TLUnknownBinding>]>
47
+ const mockOnBeforeChange = jest.fn() as jest.Mock<void, [BindingOnChangeOptions<TLUnknownBinding>]>
48
+ const mockOnAfterChange = jest.fn() as jest.Mock<void, [BindingOnChangeOptions<TLUnknownBinding>]>
49
+ const mockOnAfterChangeFromShape = jest.fn() as jest.Mock<
50
+ void,
51
+ [BindingOnShapeChangeOptions<TLUnknownBinding>]
52
+ >
53
+ const mockOnAfterChangeToShape = jest.fn() as jest.Mock<
54
+ void,
55
+ [BindingOnShapeChangeOptions<TLUnknownBinding>]
56
+ >
40
57
 
41
58
  const calls: string[] = []
42
59
 
@@ -256,11 +273,9 @@ test('copying the to shape on its own does trigger the unbind operation', () =>
256
273
  })
257
274
 
258
275
  test('cascading deletes in beforeFromShapeDelete are handled correctly', () => {
259
- mockOnBeforeFromShapeDelete.mockImplementation(
260
- (options: BindingOnShapeDeleteOptions<TLUnknownBinding>) => {
261
- editor.deleteShape(options.binding.toId)
262
- }
263
- )
276
+ mockOnBeforeFromShapeDelete.mockImplementation((options) => {
277
+ editor.deleteShape(options.binding.toId)
278
+ })
264
279
 
265
280
  bindShapes(ids.box1, ids.box2)
266
281
  bindShapes(ids.box2, ids.box3)
@@ -301,11 +316,9 @@ test('cascading deletes in beforeFromShapeDelete are handled correctly', () => {
301
316
  })
302
317
 
303
318
  test('cascading deletes in beforeToShapeDelete are handled correctly', () => {
304
- mockOnBeforeToShapeDelete.mockImplementation(
305
- (options: BindingOnShapeDeleteOptions<TLUnknownBinding>) => {
306
- editor.deleteShape(options.binding.fromId)
307
- }
308
- )
319
+ mockOnBeforeToShapeDelete.mockImplementation((options) => {
320
+ editor.deleteShape(options.binding.fromId)
321
+ })
309
322
 
310
323
  bindShapes(ids.box1, ids.box2)
311
324
  bindShapes(ids.box2, ids.box3)