tldraw 5.3.1 → 5.4.0-canary.042da660fa66

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 (99) hide show
  1. package/DOCS.md +2822 -3224
  2. package/RELEASE_NOTES.md +21 -33
  3. package/dist-cjs/index.d.ts +264 -275
  4. package/dist-cjs/index.js +1 -1
  5. package/dist-cjs/lib/defaultExternalContentHandlers.js +2 -2
  6. package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
  7. package/dist-cjs/lib/shapes/draw/toolStates/Drawing.js +2 -2
  8. package/dist-cjs/lib/shapes/draw/toolStates/Drawing.js.map +2 -2
  9. package/dist-cjs/lib/shapes/frame/frameHelpers.js +3 -0
  10. package/dist-cjs/lib/shapes/frame/frameHelpers.js.map +2 -2
  11. package/dist-cjs/lib/shapes/video/VideoShapeUtil.js +3 -2
  12. package/dist-cjs/lib/shapes/video/VideoShapeUtil.js.map +2 -2
  13. package/dist-cjs/lib/ui/TldrawUi.js +2 -3
  14. package/dist-cjs/lib/ui/TldrawUi.js.map +2 -2
  15. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js +0 -3
  16. package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js.map +2 -2
  17. package/dist-cjs/lib/ui/components/ContextMenu/DefaultContextMenuContent.js +1 -1
  18. package/dist-cjs/lib/ui/components/ContextMenu/DefaultContextMenuContent.js.map +2 -2
  19. package/dist-cjs/lib/ui/components/Dialogs.js +8 -0
  20. package/dist-cjs/lib/ui/components/Dialogs.js.map +2 -2
  21. package/dist-cjs/lib/ui/components/SharePanel/DefaultPeopleMenuItem.js +1 -2
  22. package/dist-cjs/lib/ui/components/SharePanel/DefaultPeopleMenuItem.js.map +2 -2
  23. package/dist-cjs/lib/ui/context/actions.js +0 -1
  24. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  25. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +2 -0
  26. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +2 -2
  27. package/dist-cjs/lib/ui/hooks/useCommentingEnabled.js +1 -1
  28. package/dist-cjs/lib/ui/hooks/useCommentingEnabled.js.map +2 -2
  29. package/dist-cjs/lib/ui/hooks/useFlatten.js +42 -23
  30. package/dist-cjs/lib/ui/hooks/useFlatten.js.map +2 -2
  31. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +5 -17
  32. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
  33. package/dist-cjs/lib/ui/kbd-utils.js +22 -3
  34. package/dist-cjs/lib/ui/kbd-utils.js.map +2 -2
  35. package/dist-cjs/lib/ui/version.js +3 -3
  36. package/dist-cjs/lib/ui/version.js.map +1 -1
  37. package/dist-esm/index.d.mts +264 -275
  38. package/dist-esm/index.mjs +1 -1
  39. package/dist-esm/lib/defaultExternalContentHandlers.mjs +2 -2
  40. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  41. package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs +2 -2
  42. package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs.map +2 -2
  43. package/dist-esm/lib/shapes/frame/frameHelpers.mjs +3 -0
  44. package/dist-esm/lib/shapes/frame/frameHelpers.mjs.map +2 -2
  45. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs +3 -2
  46. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs.map +2 -2
  47. package/dist-esm/lib/ui/TldrawUi.mjs +2 -3
  48. package/dist-esm/lib/ui/TldrawUi.mjs.map +2 -2
  49. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs +2 -5
  50. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs.map +2 -2
  51. package/dist-esm/lib/ui/components/ContextMenu/DefaultContextMenuContent.mjs +1 -1
  52. package/dist-esm/lib/ui/components/ContextMenu/DefaultContextMenuContent.mjs.map +2 -2
  53. package/dist-esm/lib/ui/components/Dialogs.mjs +9 -1
  54. package/dist-esm/lib/ui/components/Dialogs.mjs.map +2 -2
  55. package/dist-esm/lib/ui/components/SharePanel/DefaultPeopleMenuItem.mjs +1 -2
  56. package/dist-esm/lib/ui/components/SharePanel/DefaultPeopleMenuItem.mjs.map +2 -2
  57. package/dist-esm/lib/ui/context/actions.mjs +0 -1
  58. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  59. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +2 -0
  60. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +2 -2
  61. package/dist-esm/lib/ui/hooks/useCommentingEnabled.mjs +2 -2
  62. package/dist-esm/lib/ui/hooks/useCommentingEnabled.mjs.map +2 -2
  63. package/dist-esm/lib/ui/hooks/useFlatten.mjs +42 -23
  64. package/dist-esm/lib/ui/hooks/useFlatten.mjs.map +2 -2
  65. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +5 -17
  66. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
  67. package/dist-esm/lib/ui/kbd-utils.mjs +22 -3
  68. package/dist-esm/lib/ui/kbd-utils.mjs.map +2 -2
  69. package/dist-esm/lib/ui/version.mjs +3 -3
  70. package/dist-esm/lib/ui/version.mjs.map +1 -1
  71. package/package.json +12 -6
  72. package/src/lib/defaultExternalContentHandlers.ts +2 -2
  73. package/src/lib/shapes/draw/DrawShapeTool.test.ts +19 -0
  74. package/src/lib/shapes/draw/toolStates/Drawing.ts +2 -2
  75. package/src/lib/shapes/frame/frameHelpers.ts +10 -1
  76. package/src/lib/shapes/video/VideoShapeUtil.tsx +4 -2
  77. package/src/lib/ui/TldrawUi.tsx +1 -2
  78. package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +2 -6
  79. package/src/lib/ui/components/ContextMenu/DefaultContextMenuContent.tsx +5 -1
  80. package/src/lib/ui/components/Dialogs.tsx +17 -1
  81. package/src/lib/ui/components/SharePanel/DefaultPeopleMenuItem.tsx +2 -3
  82. package/src/lib/ui/context/actions.tsx +0 -1
  83. package/src/lib/ui/hooks/useClipboardEvents.ts +2 -0
  84. package/src/lib/ui/hooks/useCommentingEnabled.ts +5 -3
  85. package/src/lib/ui/hooks/useFlatten.ts +56 -23
  86. package/src/lib/ui/hooks/useKeyboardShortcuts.ts +5 -23
  87. package/src/lib/ui/kbd-utils.test.ts +11 -0
  88. package/src/lib/ui/kbd-utils.ts +27 -4
  89. package/src/lib/ui/version.ts +3 -3
  90. package/src/lib/ui.css +7 -16
  91. package/src/test/TldrawEditor.test.tsx +3 -0
  92. package/src/test/VideoShapeUtil.test.tsx +126 -0
  93. package/src/test/bookmark-shapes.test.ts +110 -0
  94. package/src/test/commands/alignShapes.test.tsx +19 -10
  95. package/src/test/commands/clipboard.test.ts +36 -1
  96. package/src/test/flatten.test.ts +135 -0
  97. package/src/test/modifiers.test.ts +104 -0
  98. package/src/test/ui-outside-editor.test.tsx +74 -0
  99. package/tldraw.css +7 -16
package/RELEASE_NOTES.md CHANGED
@@ -1,40 +1,9 @@
1
1
  # Releases
2
2
 
3
- Version: `5.3.1`
3
+ Version: `5.4.0-canary.042da660fa66`
4
4
 
5
5
  This file is generated during package publishing from the tldraw release notes content for this exact package version.
6
6
 
7
- ## v5.3.1
8
-
9
- This release adds a `center` operation to `Editor.alignShapes`, `iterateGraphemes` to `@tldraw/utils`, and two new reactive methods on `AtomMap`. It also deprecates `useViewportHeight` and fixes a batch of crashes and interaction bugs across dialogs, sync reconnection, undo, and keyboard shortcut tooltips.
10
-
11
- ### API changes
12
-
13
- - 🔜 **`useViewportHeight()`** is deprecated. Read `window.visualViewport` directly instead. The hook returns only the visible viewport's bottom edge, and keeping a panel clear of the software keyboard generally needs the whole visible rectangle. ([#9826](https://github.com/tldraw/tldraw/pull/9826))
14
- - Add `'center'` as an `Editor.alignShapes` operation. It applies the existing `'center-horizontal'` and `'center-vertical'` operations together, so shapes center on both axes in one command. ([#9074](https://github.com/tldraw/tldraw/pull/9074))
15
- - Add `getOrInsert(key, defaultValue)` and `getOrInsertComputed(key, callback)` to `AtomMap`, matching the `Map` methods added in newer JavaScript runtimes. Both are reactive, and the callback only runs when the key is absent. ([#9752](https://github.com/tldraw/tldraw/pull/9752))
16
- - Add `iterateGraphemes(str)` to `@tldraw/utils`. It iterates a string's grapheme clusters, using `Intl.Segmenter` when it's available and falling back to code-point iteration when it isn't. ([#9896](https://github.com/tldraw/tldraw/pull/9896))
17
-
18
- ### Improvements
19
-
20
- - Reduce per-pointer-event allocations in `Group2d` and `Editor` hit-testing. ([#8600](https://github.com/tldraw/tldraw/pull/8600))
21
-
22
- ### Bug fixes
23
-
24
- - Fix the editor failing to load on older browsers that lack `Intl.Segmenter`, such as Firefox before 125. ([#9896](https://github.com/tldraw/tldraw/pull/9896))
25
- - Fix a crash when computing a frame's geometry if its heading text couldn't be measured yet. ([#9496](https://github.com/tldraw/tldraw/pull/9496))
26
- - Fix undo after a cut also reverting the change made before it. ([#9920](https://github.com/tldraw/tldraw/pull/9920))
27
- - Fix modifier keys (Shift, Alt, Ctrl, Cmd) briefly being treated as held at the start of a new click or drag right after being released, which could momentarily affect snapping and other modifier-dependent behavior. ([#9523](https://github.com/tldraw/tldraw/pull/9523))
28
- - Fix **Flatten to image** producing different groupings depending on selection order, and not merging clusters that were only connected through a bridging shape. ([#8661](https://github.com/tldraw/tldraw/pull/8661))
29
- - Fix pasted links showing a broken preview image when the linked page has no Open Graph image. ([#9909](https://github.com/tldraw/tldraw/pull/9909))
30
- - Fix closing a stacked dialog by touch also closing the dialog beneath it. ([#10002](https://github.com/tldraw/tldraw/pull/10002))
31
- - Fix wheel event normalization passing through non-finite delta values. ([#9586](https://github.com/tldraw/tldraw/pull/9586))
32
- - Fix the counterclockwise rotation tooltip not showing its comma key. ([#9772](https://github.com/tldraw/tldraw/pull/9772))
33
- - Fix the spacing around the cursor chat item in the context menu. ([#9921](https://github.com/tldraw/tldraw/pull/9921))
34
- - Fix the people menu's collaborator rows not lining up with your own row above them: the follow icon sat too close to the right edge, and collaborator names sat slightly left of your own. ([#9900](https://github.com/tldraw/tldraw/pull/9900))
35
- - Fix the comment thread popover briefly rendering with a doubled shadow the first time a thread is opened. ([#9886](https://github.com/tldraw/tldraw/pull/9886))
36
- - Fix background tabs repeatedly dropping and re-establishing their sync connection when the browser throttles timers. ([#9964](https://github.com/tldraw/tldraw/pull/9964))
37
-
38
7
  ## v5.3.0
39
8
 
40
9
  [View on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.3.0)
@@ -125,6 +94,25 @@ See the [commenting docs](https://tldraw.dev/docs/commenting) for setup.
125
94
  - Fix a crash when a custom font failed to load after its editor had been disposed. ([#9494](https://github.com/tldraw/tldraw/pull/9494))
126
95
  - Fix license expiry being evaluated in local time, which could deactivate a license a calendar day early for users west of UTC; the expiry date is now treated as the last fully usable day in UTC. ([#9475](https://github.com/tldraw/tldraw/pull/9475))
127
96
 
97
+ ---
98
+
99
+ ### Patch releases
100
+
101
+ #### v5.3.1
102
+
103
+ - Fix touches in part of the canvas being ignored on iOS when the editor was inset from the edge of the page, such as beside a sidebar. ([#9989](https://github.com/tldraw/tldraw/pull/9989))
104
+
105
+ [View release on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.3.1)
106
+
107
+ #### v5.3.2
108
+
109
+ - Fix default UI components, such as `DefaultToolbar` and `DefaultQuickActionsContent`, crashing when mounted outside the `Tldraw` component. ([#10007](https://github.com/tldraw/tldraw/pull/10007))
110
+ - Fix license validation treating native apps served from custom protocols as development environments. ([#10021](https://github.com/tldraw/tldraw/pull/10021))
111
+ - Fix wildcard license host matching so `*.example.com` matches only that domain's subdomains. ([#10053](https://github.com/tldraw/tldraw/pull/10053))
112
+ - Add product metadata to each published package's `package.json`, so which product or feature a package implements is clearer, and ship the missing `LICENSE.md` files. ([#9977](https://github.com/tldraw/tldraw/pull/9977))
113
+
114
+ [View release on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.3.2)
115
+
128
116
  ## v5.2.0
129
117
 
130
118
  [View on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.2.0)
@@ -1376,7 +1364,7 @@ Draw and highlight shape point data is now stored using a compact delta-encoded
1376
1364
  <details>
1377
1365
  <summary>Breaking change details</summary>
1378
1366
 
1379
- If you were reading or writing draw shape data programatically you might need to update your code to use the new format.
1367
+ If you were reading or writing draw shape data programmatically you might need to update your code to use the new format.
1380
1368
 
1381
1369
  - `TLDrawShapeSegment.points` renamed to `.path` and changed from `VecModel[]` to `string` (base64-encoded)
1382
1370
  - Added `scaleX` and `scaleY` properties to draw and highlight shapes