tldraw 5.3.2 → 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 (93) hide show
  1. package/DOCS.md +2822 -3224
  2. package/RELEASE_NOTES.md +11 -39
  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/useFlatten.js +42 -23
  28. package/dist-cjs/lib/ui/hooks/useFlatten.js.map +2 -2
  29. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +5 -17
  30. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
  31. package/dist-cjs/lib/ui/kbd-utils.js +22 -3
  32. package/dist-cjs/lib/ui/kbd-utils.js.map +2 -2
  33. package/dist-cjs/lib/ui/version.js +3 -3
  34. package/dist-cjs/lib/ui/version.js.map +1 -1
  35. package/dist-esm/index.d.mts +264 -275
  36. package/dist-esm/index.mjs +1 -1
  37. package/dist-esm/lib/defaultExternalContentHandlers.mjs +2 -2
  38. package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
  39. package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs +2 -2
  40. package/dist-esm/lib/shapes/draw/toolStates/Drawing.mjs.map +2 -2
  41. package/dist-esm/lib/shapes/frame/frameHelpers.mjs +3 -0
  42. package/dist-esm/lib/shapes/frame/frameHelpers.mjs.map +2 -2
  43. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs +3 -2
  44. package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs.map +2 -2
  45. package/dist-esm/lib/ui/TldrawUi.mjs +2 -3
  46. package/dist-esm/lib/ui/TldrawUi.mjs.map +2 -2
  47. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs +2 -5
  48. package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs.map +2 -2
  49. package/dist-esm/lib/ui/components/ContextMenu/DefaultContextMenuContent.mjs +1 -1
  50. package/dist-esm/lib/ui/components/ContextMenu/DefaultContextMenuContent.mjs.map +2 -2
  51. package/dist-esm/lib/ui/components/Dialogs.mjs +9 -1
  52. package/dist-esm/lib/ui/components/Dialogs.mjs.map +2 -2
  53. package/dist-esm/lib/ui/components/SharePanel/DefaultPeopleMenuItem.mjs +1 -2
  54. package/dist-esm/lib/ui/components/SharePanel/DefaultPeopleMenuItem.mjs.map +2 -2
  55. package/dist-esm/lib/ui/context/actions.mjs +0 -1
  56. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  57. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +2 -0
  58. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +2 -2
  59. package/dist-esm/lib/ui/hooks/useFlatten.mjs +42 -23
  60. package/dist-esm/lib/ui/hooks/useFlatten.mjs.map +2 -2
  61. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +5 -17
  62. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
  63. package/dist-esm/lib/ui/kbd-utils.mjs +22 -3
  64. package/dist-esm/lib/ui/kbd-utils.mjs.map +2 -2
  65. package/dist-esm/lib/ui/version.mjs +3 -3
  66. package/dist-esm/lib/ui/version.mjs.map +1 -1
  67. package/package.json +6 -6
  68. package/src/lib/defaultExternalContentHandlers.ts +2 -2
  69. package/src/lib/shapes/draw/DrawShapeTool.test.ts +19 -0
  70. package/src/lib/shapes/draw/toolStates/Drawing.ts +2 -2
  71. package/src/lib/shapes/frame/frameHelpers.ts +10 -1
  72. package/src/lib/shapes/video/VideoShapeUtil.tsx +4 -2
  73. package/src/lib/ui/TldrawUi.tsx +1 -2
  74. package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +2 -6
  75. package/src/lib/ui/components/ContextMenu/DefaultContextMenuContent.tsx +5 -1
  76. package/src/lib/ui/components/Dialogs.tsx +17 -1
  77. package/src/lib/ui/components/SharePanel/DefaultPeopleMenuItem.tsx +2 -3
  78. package/src/lib/ui/context/actions.tsx +0 -1
  79. package/src/lib/ui/hooks/useClipboardEvents.ts +2 -0
  80. package/src/lib/ui/hooks/useFlatten.ts +56 -23
  81. package/src/lib/ui/hooks/useKeyboardShortcuts.ts +5 -23
  82. package/src/lib/ui/kbd-utils.test.ts +11 -0
  83. package/src/lib/ui/kbd-utils.ts +27 -4
  84. package/src/lib/ui/version.ts +3 -3
  85. package/src/lib/ui.css +7 -16
  86. package/src/test/TldrawEditor.test.tsx +3 -0
  87. package/src/test/VideoShapeUtil.test.tsx +126 -0
  88. package/src/test/bookmark-shapes.test.ts +110 -0
  89. package/src/test/commands/alignShapes.test.tsx +19 -10
  90. package/src/test/commands/clipboard.test.ts +36 -1
  91. package/src/test/flatten.test.ts +135 -0
  92. package/src/test/modifiers.test.ts +104 -0
  93. package/tldraw.css +7 -16
package/RELEASE_NOTES.md CHANGED
@@ -1,46 +1,9 @@
1
1
  # Releases
2
2
 
3
- Version: `5.3.2`
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.2
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`, speeds up the signals and store layers, 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 `isPage(record)` to `@tldraw/tlschema`, a type guard that narrows an unknown record to `TLPage`. ([#9774](https://github.com/tldraw/tldraw/pull/9774))
17
- - 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))
18
- - Add `isPage(record)` to `@tldraw/tlschema`, a type guard for page records that matches the guards already exported for the other record types. ([#9774](https://github.com/tldraw/tldraw/pull/9774))
19
-
20
- ### Improvements
21
-
22
- - Reduce per-pointer-event allocations in `Group2d` and `Editor` hit-testing. ([#8600](https://github.com/tldraw/tldraw/pull/8600))
23
- - Speed up signal reads in `@tldraw/state`. Capturing a parent used to scan the capturing signal's parent set twice, once to check for the parent and again to add it. ([#9690](https://github.com/tldraw/tldraw/pull/9690))
24
- - Reduce the work and allocations in `@tldraw/store` history bookkeeping, so squashing record diffs and filtering query history no longer build intermediate copies on every tick. ([#9689](https://github.com/tldraw/tldraw/pull/9689), [#9869](https://github.com/tldraw/tldraw/pull/9869))
25
-
26
- ### Bug fixes
27
-
28
- - 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))
29
- - 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))
30
- - Fix undo after a cut also reverting the change made before it. ([#9920](https://github.com/tldraw/tldraw/pull/9920))
31
- - 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))
32
- - 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))
33
- - 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))
34
- - Fix video shapes showing a floating spinner with no bounding box while their asset uploads or loads. They now show the same loading plate as image shapes. ([#9994](https://github.com/tldraw/tldraw/pull/9994))
35
- - Fix closing a stacked dialog by touch also closing the dialog beneath it. ([#10002](https://github.com/tldraw/tldraw/pull/10002))
36
- - Fix wheel event normalization passing through non-finite delta values. ([#9586](https://github.com/tldraw/tldraw/pull/9586))
37
- - Fix the counterclockwise rotation tooltip not showing its comma key. ([#9772](https://github.com/tldraw/tldraw/pull/9772))
38
- - Fix the spacing around the cursor chat item in the context menu. ([#9921](https://github.com/tldraw/tldraw/pull/9921))
39
- - 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))
40
- - 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))
41
- - Fix background tabs repeatedly dropping and re-establishing their sync connection when the browser throttles timers. ([#9964](https://github.com/tldraw/tldraw/pull/9964))
42
- - Fix video shapes showing a floating spinner with no bounding box while the video asset uploads or loads. They now show the same loading plate as image shapes. ([#9994](https://github.com/tldraw/tldraw/pull/9994))
43
-
44
7
  ## v5.3.0
45
8
 
46
9
  [View on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.3.0)
@@ -141,6 +104,15 @@ See the [commenting docs](https://tldraw.dev/docs/commenting) for setup.
141
104
 
142
105
  [View release on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.3.1)
143
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
+
144
116
  ## v5.2.0
145
117
 
146
118
  [View on GitHub](https://github.com/tldraw/tldraw/releases/tag/v5.2.0)
@@ -1392,7 +1364,7 @@ Draw and highlight shape point data is now stored using a compact delta-encoded
1392
1364
  <details>
1393
1365
  <summary>Breaking change details</summary>
1394
1366
 
1395
- 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.
1396
1368
 
1397
1369
  - `TLDrawShapeSegment.points` renamed to `.path` and changed from `VecModel[]` to `string` (base64-encoded)
1398
1370
  - Added `scaleX` and `scaleY` properties to draw and highlight shapes