tldraw 3.15.0-canary.c4b9179d0b38 → 3.15.0-canary.c5c8f9bb0ec2

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 (71) hide show
  1. package/dist-cjs/index.d.ts +84 -77
  2. package/dist-cjs/index.js +30 -31
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +5 -5
  5. package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
  6. package/dist-cjs/lib/shapes/text/TextShapeUtil.js +11 -5
  7. package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
  8. package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +1 -11
  9. package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
  10. package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +0 -1
  11. package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
  12. package/dist-cjs/lib/ui/components/menu-items.js +0 -16
  13. package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
  14. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +2 -0
  15. package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
  16. package/dist-cjs/lib/ui/context/actions.js +1 -28
  17. package/dist-cjs/lib/ui/context/actions.js.map +2 -2
  18. package/dist-cjs/lib/ui/context/events.js.map +2 -2
  19. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +7 -24
  20. package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +2 -2
  21. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +2 -2
  22. package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
  23. package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
  24. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +0 -4
  25. package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
  26. package/dist-cjs/lib/ui/version.js +3 -3
  27. package/dist-cjs/lib/ui/version.js.map +1 -1
  28. package/dist-esm/index.d.mts +84 -77
  29. package/dist-esm/index.mjs +132 -134
  30. package/dist-esm/index.mjs.map +2 -2
  31. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +5 -5
  32. package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
  33. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +11 -5
  34. package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
  35. package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +1 -11
  36. package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
  37. package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +0 -2
  38. package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
  39. package/dist-esm/lib/ui/components/menu-items.mjs +0 -16
  40. package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
  41. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +2 -0
  42. package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
  43. package/dist-esm/lib/ui/context/actions.mjs +1 -28
  44. package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
  45. package/dist-esm/lib/ui/context/events.mjs.map +2 -2
  46. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +7 -24
  47. package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +2 -2
  48. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +2 -2
  49. package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
  50. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +0 -4
  51. package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
  52. package/dist-esm/lib/ui/version.mjs +3 -3
  53. package/dist-esm/lib/ui/version.mjs.map +1 -1
  54. package/package.json +3 -3
  55. package/src/index.ts +158 -159
  56. package/src/lib/shapes/frame/FrameShapeUtil.tsx +7 -5
  57. package/src/lib/shapes/text/TextShapeUtil.tsx +12 -5
  58. package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +0 -8
  59. package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +0 -2
  60. package/src/lib/ui/components/menu-items.tsx +0 -17
  61. package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +2 -0
  62. package/src/lib/ui/context/actions.tsx +1 -29
  63. package/src/lib/ui/context/events.tsx +0 -2
  64. package/src/lib/ui/hooks/useClipboardEvents.ts +10 -31
  65. package/src/lib/ui/hooks/useKeyboardShortcuts.ts +2 -3
  66. package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +0 -4
  67. package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +0 -4
  68. package/src/lib/ui/version.ts +3 -3
  69. package/src/test/Editor.test.tsx +1 -68
  70. package/src/test/commands/clipboard.test.ts +1 -1
  71. package/src/test/editor.test.ts +77 -0
package/src/index.ts CHANGED
@@ -24,6 +24,7 @@ export { usePrefersReducedMotion } from './lib/shapes/shared/usePrefersReducedMo
24
24
  export { DefaultA11yAnnouncer, useSelectedShapesAnnouncer } from './lib/ui/components/A11y'
25
25
  export { ColorSchemeMenu } from './lib/ui/components/ColorSchemeMenu'
26
26
  export { DefaultDialogs } from './lib/ui/components/Dialogs'
27
+ export { DefaultToasts } from './lib/ui/components/Toasts'
27
28
  export {
28
29
  TldrawUiMenuActionCheckboxItem,
29
30
  type TLUiMenuActionCheckboxItemProps,
@@ -36,10 +37,11 @@ export {
36
37
  TldrawUiMenuToolItem,
37
38
  type TLUiMenuToolItemProps,
38
39
  } from './lib/ui/components/primitives/menus/TldrawUiMenuToolItem'
39
- export { DefaultToasts } from './lib/ui/components/Toasts'
40
40
  export { TldrawUiTranslationProvider } from './lib/ui/hooks/useTranslation/useTranslation'
41
41
  // eslint-disable-next-line local/no-export-star
42
42
  export * from '@tldraw/editor'
43
+ export { Tldraw, type TLComponents, type TldrawBaseProps, type TldrawProps } from './lib/Tldraw'
44
+ export { TldrawImage, type TldrawImageProps } from './lib/TldrawImage'
43
45
  export { ArrowBindingUtil } from './lib/bindings/arrow/ArrowBindingUtil'
44
46
  export { TldrawHandles } from './lib/canvas/TldrawHandles'
45
47
  export { TldrawArrowHints, TldrawOverlays } from './lib/canvas/TldrawOverlays'
@@ -57,11 +59,11 @@ export {
57
59
  type TLEmbedShapePermissions,
58
60
  } from './lib/defaultEmbedDefinitions'
59
61
  export {
62
+ DEFAULT_MAX_ASSET_SIZE,
63
+ DEFAULT_MAX_IMAGE_DIMENSION,
60
64
  centerSelectionAroundPoint,
61
65
  createEmptyBookmarkShape,
62
66
  createShapesForAssets,
63
- DEFAULT_MAX_ASSET_SIZE,
64
- DEFAULT_MAX_IMAGE_DIMENSION,
65
67
  defaultHandleExternalEmbedContent,
66
68
  defaultHandleExternalExcalidrawContent,
67
69
  defaultHandleExternalFileAsset,
@@ -80,6 +82,8 @@ export { defaultShapeTools } from './lib/defaultShapeTools'
80
82
  export { defaultShapeUtils } from './lib/defaultShapeUtils'
81
83
  export { registerDefaultSideEffects } from './lib/defaultSideEffects'
82
84
  export { defaultTools } from './lib/defaultTools'
85
+ export { ArrowShapeTool } from './lib/shapes/arrow/ArrowShapeTool'
86
+ export { ArrowShapeUtil } from './lib/shapes/arrow/ArrowShapeUtil'
83
87
  export {
84
88
  type ArrowShapeOptions,
85
89
  type TLArcArrowInfo,
@@ -89,8 +93,6 @@ export {
89
93
  type TLElbowArrowInfo,
90
94
  type TLStraightArrowInfo,
91
95
  } from './lib/shapes/arrow/arrow-types'
92
- export { ArrowShapeTool } from './lib/shapes/arrow/ArrowShapeTool'
93
- export { ArrowShapeUtil } from './lib/shapes/arrow/ArrowShapeUtil'
94
96
  export {
95
97
  type ElbowArrowBox,
96
98
  type ElbowArrowBoxEdges,
@@ -130,6 +132,17 @@ export { LineShapeTool } from './lib/shapes/line/LineShapeTool'
130
132
  export { LineShapeUtil } from './lib/shapes/line/LineShapeUtil'
131
133
  export { NoteShapeTool } from './lib/shapes/note/NoteShapeTool'
132
134
  export { NoteShapeUtil, type NoteShapeOptions } from './lib/shapes/note/NoteShapeUtil'
135
+ export {
136
+ PlainTextLabel,
137
+ TextLabel,
138
+ type PlainTextLabelProps,
139
+ } from './lib/shapes/shared/PlainTextLabel'
140
+ export {
141
+ RichTextLabel,
142
+ RichTextSVG,
143
+ type RichTextLabelProps,
144
+ type RichTextSVGProps,
145
+ } from './lib/shapes/shared/RichTextLabel'
133
146
  export {
134
147
  ASPECT_RATIO_OPTIONS,
135
148
  ASPECT_RATIO_TO_VALUE,
@@ -148,22 +161,11 @@ export {
148
161
  TEXT_PROPS,
149
162
  } from './lib/shapes/shared/default-shape-constants'
150
163
  export {
151
- allDefaultFontFaces,
152
164
  DefaultFontFaces,
165
+ allDefaultFontFaces,
153
166
  type TLDefaultFont,
154
167
  type TLDefaultFonts,
155
168
  } from './lib/shapes/shared/defaultFonts'
156
- export {
157
- PlainTextLabel,
158
- TextLabel,
159
- type PlainTextLabelProps,
160
- } from './lib/shapes/shared/PlainTextLabel'
161
- export {
162
- RichTextLabel,
163
- RichTextSVG,
164
- type RichTextLabelProps,
165
- type RichTextSVGProps,
166
- } from './lib/shapes/shared/RichTextLabel'
167
169
  export { useDefaultColorTheme } from './lib/shapes/shared/useDefaultColorTheme'
168
170
  export { useEditablePlainText, useEditableText } from './lib/shapes/shared/useEditablePlainText'
169
171
  export { useEditableRichText } from './lib/shapes/shared/useEditableRichText'
@@ -178,13 +180,12 @@ export { TextShapeTool } from './lib/shapes/text/TextShapeTool'
178
180
  export { TextShapeUtil, type TextShapeOptions } from './lib/shapes/text/TextShapeUtil'
179
181
  export { VideoShapeUtil, type VideoShapeOptions } from './lib/shapes/video/VideoShapeUtil'
180
182
  export { type StyleValuesForUi } from './lib/styles'
181
- export { Tldraw, type TLComponents, type TldrawBaseProps, type TldrawProps } from './lib/Tldraw'
182
- export { TldrawImage, type TldrawImageProps } from './lib/TldrawImage'
183
183
  export { EraserTool } from './lib/tools/EraserTool/EraserTool'
184
184
  export { HandTool } from './lib/tools/HandTool/HandTool'
185
185
  export { LaserTool } from './lib/tools/LaserTool/LaserTool'
186
186
  export { SelectTool } from './lib/tools/SelectTool/SelectTool'
187
187
  export { ZoomTool } from './lib/tools/ZoomTool/ZoomTool'
188
+ export { TldrawUi, type TldrawUiProps } from './lib/ui/TldrawUi'
188
189
  export {
189
190
  setDefaultUiAssetUrls,
190
191
  type TLUiAssetUrlOverrides,
@@ -222,11 +223,6 @@ export {
222
223
  type ExampleDialogProps,
223
224
  } from './lib/ui/components/DebugMenu/DefaultDebugMenuContent'
224
225
  export { DefaultMenuPanel } from './lib/ui/components/DefaultMenuPanel'
225
- export {
226
- DefaultHelperButtons,
227
- type TLUiHelperButtonsProps,
228
- } from './lib/ui/components/HelperButtons/DefaultHelperButtons'
229
- export { DefaultHelperButtonsContent } from './lib/ui/components/HelperButtons/DefaultHelperButtonsContent'
230
226
  export {
231
227
  DefaultHelpMenu,
232
228
  type TLUiHelpMenuProps,
@@ -235,6 +231,11 @@ export {
235
231
  DefaultHelpMenuContent,
236
232
  KeyboardShortcutsMenuItem,
237
233
  } from './lib/ui/components/HelpMenu/DefaultHelpMenuContent'
234
+ export {
235
+ DefaultHelperButtons,
236
+ type TLUiHelperButtonsProps,
237
+ } from './lib/ui/components/HelperButtons/DefaultHelperButtons'
238
+ export { DefaultHelperButtonsContent } from './lib/ui/components/HelperButtons/DefaultHelperButtonsContent'
238
239
  export {
239
240
  DefaultKeyboardShortcutsDialog,
240
241
  type TLUiKeyboardShortcutsDialogProps,
@@ -255,6 +256,116 @@ export {
255
256
  UndoRedoGroup,
256
257
  ViewSubmenu,
257
258
  } from './lib/ui/components/MainMenu/DefaultMainMenuContent'
259
+ export { DefaultMinimap } from './lib/ui/components/Minimap/DefaultMinimap'
260
+ export { MobileStylePanel } from './lib/ui/components/MobileStylePanel'
261
+ export { DefaultNavigationPanel } from './lib/ui/components/NavigationPanel/DefaultNavigationPanel'
262
+ export { OfflineIndicator } from './lib/ui/components/OfflineIndicator/OfflineIndicator'
263
+ export { DefaultPageMenu } from './lib/ui/components/PageMenu/DefaultPageMenu'
264
+ export { PageItemInput, type PageItemInputProps } from './lib/ui/components/PageMenu/PageItemInput'
265
+ export {
266
+ PageItemSubmenu,
267
+ type PageItemSubmenuProps,
268
+ } from './lib/ui/components/PageMenu/PageItemSubmenu'
269
+ export {
270
+ DefaultQuickActions,
271
+ type TLUiQuickActionsProps,
272
+ } from './lib/ui/components/QuickActions/DefaultQuickActions'
273
+ export { DefaultQuickActionsContent } from './lib/ui/components/QuickActions/DefaultQuickActionsContent'
274
+ export { DefaultSharePanel } from './lib/ui/components/SharePanel/DefaultSharePanel'
275
+ export { PeopleMenu, type PeopleMenuProps } from './lib/ui/components/SharePanel/PeopleMenu'
276
+ export { Spinner } from './lib/ui/components/Spinner'
277
+ export {
278
+ DefaultStylePanel,
279
+ type TLUiStylePanelProps,
280
+ } from './lib/ui/components/StylePanel/DefaultStylePanel'
281
+ export {
282
+ ArrowheadStylePickerSet,
283
+ CommonStylePickerSet,
284
+ DefaultStylePanelContent,
285
+ GeoStylePickerSet,
286
+ OpacitySlider,
287
+ SplineStylePickerSet,
288
+ TextStylePickerSet,
289
+ type StylePickerSetProps,
290
+ type TLUiStylePanelContentProps,
291
+ type ThemeStylePickerSetProps,
292
+ } from './lib/ui/components/StylePanel/DefaultStylePanelContent'
293
+ export {
294
+ DefaultImageToolbar,
295
+ type TLUiImageToolbarProps,
296
+ } from './lib/ui/components/Toolbar/DefaultImageToolbar'
297
+ export {
298
+ DefaultImageToolbarContent,
299
+ type DefaultImageToolbarContentProps,
300
+ } from './lib/ui/components/Toolbar/DefaultImageToolbarContent'
301
+ export {
302
+ DefaultRichTextToolbar,
303
+ type TLUiRichTextToolbarProps,
304
+ } from './lib/ui/components/Toolbar/DefaultRichTextToolbar'
305
+ export {
306
+ DefaultRichTextToolbarContent,
307
+ type DefaultRichTextToolbarContentProps,
308
+ } from './lib/ui/components/Toolbar/DefaultRichTextToolbarContent'
309
+ export {
310
+ DefaultToolbar,
311
+ type DefaultToolbarProps,
312
+ } from './lib/ui/components/Toolbar/DefaultToolbar'
313
+ export {
314
+ ArrowDownToolbarItem,
315
+ ArrowLeftToolbarItem,
316
+ ArrowRightToolbarItem,
317
+ ArrowToolbarItem,
318
+ ArrowUpToolbarItem,
319
+ AssetToolbarItem,
320
+ CheckBoxToolbarItem,
321
+ CloudToolbarItem,
322
+ DefaultToolbarContent,
323
+ DiamondToolbarItem,
324
+ DrawToolbarItem,
325
+ EllipseToolbarItem,
326
+ EraserToolbarItem,
327
+ FrameToolbarItem,
328
+ HandToolbarItem,
329
+ HexagonToolbarItem,
330
+ HighlightToolbarItem,
331
+ LaserToolbarItem,
332
+ LineToolbarItem,
333
+ NoteToolbarItem,
334
+ OvalToolbarItem,
335
+ RectangleToolbarItem,
336
+ RhombusToolbarItem,
337
+ SelectToolbarItem,
338
+ StarToolbarItem,
339
+ TextToolbarItem,
340
+ ToolbarItem,
341
+ TrapezoidToolbarItem,
342
+ TriangleToolbarItem,
343
+ XBoxToolbarItem,
344
+ useIsToolSelected,
345
+ type ToolbarItemProps,
346
+ } from './lib/ui/components/Toolbar/DefaultToolbarContent'
347
+ export {
348
+ DefaultVideoToolbar,
349
+ type TLUiVideoToolbarProps,
350
+ } from './lib/ui/components/Toolbar/DefaultVideoToolbar'
351
+ export {
352
+ DefaultVideoToolbarContent,
353
+ type DefaultVideoToolbarContentProps,
354
+ } from './lib/ui/components/Toolbar/DefaultVideoToolbarContent'
355
+ export {
356
+ OverflowingToolbar,
357
+ type OverflowingToolbarProps,
358
+ } from './lib/ui/components/Toolbar/OverflowingToolbar'
359
+ export {
360
+ CenteredTopPanelContainer,
361
+ type CenteredTopPanelContainerProps,
362
+ } from './lib/ui/components/TopPanel/CenteredTopPanelContainer'
363
+ export { DefaultTopPanel } from './lib/ui/components/TopPanel/DefaultTopPanel'
364
+ export {
365
+ DefaultZoomMenu,
366
+ type TLUiZoomMenuProps,
367
+ } from './lib/ui/components/ZoomMenu/DefaultZoomMenu'
368
+ export { DefaultZoomMenuContent } from './lib/ui/components/ZoomMenu/DefaultZoomMenuContent'
258
369
  export {
259
370
  ArrangeMenuSubmenu,
260
371
  ClipboardMenuGroup,
@@ -283,7 +394,6 @@ export {
283
394
  ToggleEdgeScrollingItem,
284
395
  ToggleFocusModeItem,
285
396
  ToggleGridItem,
286
- ToggleKeyboardShortcutsItem,
287
397
  ToggleLockMenuItem,
288
398
  TogglePasteAtCursorItem,
289
399
  ToggleReduceMotionItem,
@@ -297,16 +407,6 @@ export {
297
407
  ZoomToFitMenuItem,
298
408
  ZoomToSelectionMenuItem,
299
409
  } from './lib/ui/components/menu-items'
300
- export { DefaultMinimap } from './lib/ui/components/Minimap/DefaultMinimap'
301
- export { MobileStylePanel } from './lib/ui/components/MobileStylePanel'
302
- export { DefaultNavigationPanel } from './lib/ui/components/NavigationPanel/DefaultNavigationPanel'
303
- export { OfflineIndicator } from './lib/ui/components/OfflineIndicator/OfflineIndicator'
304
- export { DefaultPageMenu } from './lib/ui/components/PageMenu/DefaultPageMenu'
305
- export { PageItemInput, type PageItemInputProps } from './lib/ui/components/PageMenu/PageItemInput'
306
- export {
307
- PageItemSubmenu,
308
- type PageItemSubmenuProps,
309
- } from './lib/ui/components/PageMenu/PageItemSubmenu'
310
410
  export {
311
411
  TldrawUiButton,
312
412
  type TLUiButtonProps,
@@ -323,27 +423,6 @@ export {
323
423
  TldrawUiButtonLabel,
324
424
  type TLUiButtonLabelProps,
325
425
  } from './lib/ui/components/primitives/Button/TldrawUiButtonLabel'
326
- export {
327
- TldrawUiMenuCheckboxItem,
328
- type TLUiMenuCheckboxItemProps,
329
- } from './lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem'
330
- export {
331
- TldrawUiMenuContextProvider,
332
- type TLUiMenuContextProviderProps,
333
- type TLUiMenuContextType,
334
- } from './lib/ui/components/primitives/menus/TldrawUiMenuContext'
335
- export {
336
- TldrawUiMenuGroup,
337
- type TLUiMenuGroupProps,
338
- } from './lib/ui/components/primitives/menus/TldrawUiMenuGroup'
339
- export {
340
- TldrawUiMenuItem,
341
- type TLUiMenuItemProps,
342
- } from './lib/ui/components/primitives/menus/TldrawUiMenuItem'
343
- export {
344
- TldrawUiMenuSubmenu,
345
- type TLUiMenuSubmenuProps,
346
- } from './lib/ui/components/primitives/menus/TldrawUiMenuSubmenu'
347
426
  export {
348
427
  TldrawUiButtonPicker,
349
428
  type TLUiButtonPickerProps,
@@ -405,106 +484,31 @@ export {
405
484
  type TLUiToolbarToggleItemProps,
406
485
  } from './lib/ui/components/primitives/TldrawUiToolbar'
407
486
  export {
408
- DefaultQuickActions,
409
- type TLUiQuickActionsProps,
410
- } from './lib/ui/components/QuickActions/DefaultQuickActions'
411
- export { DefaultQuickActionsContent } from './lib/ui/components/QuickActions/DefaultQuickActionsContent'
412
- export { DefaultSharePanel } from './lib/ui/components/SharePanel/DefaultSharePanel'
413
- export { PeopleMenu, type PeopleMenuProps } from './lib/ui/components/SharePanel/PeopleMenu'
414
- export { Spinner } from './lib/ui/components/Spinner'
415
- export {
416
- DefaultStylePanel,
417
- type TLUiStylePanelProps,
418
- } from './lib/ui/components/StylePanel/DefaultStylePanel'
419
- export {
420
- ArrowheadStylePickerSet,
421
- CommonStylePickerSet,
422
- DefaultStylePanelContent,
423
- GeoStylePickerSet,
424
- OpacitySlider,
425
- SplineStylePickerSet,
426
- TextStylePickerSet,
427
- type StylePickerSetProps,
428
- type ThemeStylePickerSetProps,
429
- type TLUiStylePanelContentProps,
430
- } from './lib/ui/components/StylePanel/DefaultStylePanelContent'
431
- export {
432
- DefaultImageToolbar,
433
- type TLUiImageToolbarProps,
434
- } from './lib/ui/components/Toolbar/DefaultImageToolbar'
435
- export {
436
- DefaultImageToolbarContent,
437
- type DefaultImageToolbarContentProps,
438
- } from './lib/ui/components/Toolbar/DefaultImageToolbarContent'
439
- export {
440
- DefaultRichTextToolbar,
441
- type TLUiRichTextToolbarProps,
442
- } from './lib/ui/components/Toolbar/DefaultRichTextToolbar'
443
- export {
444
- DefaultRichTextToolbarContent,
445
- type DefaultRichTextToolbarContentProps,
446
- } from './lib/ui/components/Toolbar/DefaultRichTextToolbarContent'
447
- export {
448
- DefaultToolbar,
449
- type DefaultToolbarProps,
450
- } from './lib/ui/components/Toolbar/DefaultToolbar'
451
- export {
452
- ArrowDownToolbarItem,
453
- ArrowLeftToolbarItem,
454
- ArrowRightToolbarItem,
455
- ArrowToolbarItem,
456
- ArrowUpToolbarItem,
457
- AssetToolbarItem,
458
- CheckBoxToolbarItem,
459
- CloudToolbarItem,
460
- DefaultToolbarContent,
461
- DiamondToolbarItem,
462
- DrawToolbarItem,
463
- EllipseToolbarItem,
464
- EraserToolbarItem,
465
- FrameToolbarItem,
466
- HandToolbarItem,
467
- HexagonToolbarItem,
468
- HighlightToolbarItem,
469
- LaserToolbarItem,
470
- LineToolbarItem,
471
- NoteToolbarItem,
472
- OvalToolbarItem,
473
- RectangleToolbarItem,
474
- RhombusToolbarItem,
475
- SelectToolbarItem,
476
- StarToolbarItem,
477
- TextToolbarItem,
478
- ToolbarItem,
479
- TrapezoidToolbarItem,
480
- TriangleToolbarItem,
481
- useIsToolSelected,
482
- XBoxToolbarItem,
483
- type ToolbarItemProps,
484
- } from './lib/ui/components/Toolbar/DefaultToolbarContent'
485
- export {
486
- DefaultVideoToolbar,
487
- type TLUiVideoToolbarProps,
488
- } from './lib/ui/components/Toolbar/DefaultVideoToolbar'
487
+ TldrawUiMenuCheckboxItem,
488
+ type TLUiMenuCheckboxItemProps,
489
+ } from './lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem'
489
490
  export {
490
- DefaultVideoToolbarContent,
491
- type DefaultVideoToolbarContentProps,
492
- } from './lib/ui/components/Toolbar/DefaultVideoToolbarContent'
491
+ TldrawUiMenuContextProvider,
492
+ type TLUiMenuContextProviderProps,
493
+ type TLUiMenuContextType,
494
+ } from './lib/ui/components/primitives/menus/TldrawUiMenuContext'
493
495
  export {
494
- OverflowingToolbar,
495
- type OverflowingToolbarProps,
496
- } from './lib/ui/components/Toolbar/OverflowingToolbar'
496
+ TldrawUiMenuGroup,
497
+ type TLUiMenuGroupProps,
498
+ } from './lib/ui/components/primitives/menus/TldrawUiMenuGroup'
497
499
  export {
498
- CenteredTopPanelContainer,
499
- type CenteredTopPanelContainerProps,
500
- } from './lib/ui/components/TopPanel/CenteredTopPanelContainer'
501
- export { DefaultTopPanel } from './lib/ui/components/TopPanel/DefaultTopPanel'
500
+ TldrawUiMenuItem,
501
+ type TLUiMenuItemProps,
502
+ } from './lib/ui/components/primitives/menus/TldrawUiMenuItem'
502
503
  export {
503
- DefaultZoomMenu,
504
- type TLUiZoomMenuProps,
505
- } from './lib/ui/components/ZoomMenu/DefaultZoomMenu'
506
- export { DefaultZoomMenuContent } from './lib/ui/components/ZoomMenu/DefaultZoomMenuContent'
504
+ TldrawUiMenuSubmenu,
505
+ type TLUiMenuSubmenuProps,
506
+ } from './lib/ui/components/primitives/menus/TldrawUiMenuSubmenu'
507
507
  export { PORTRAIT_BREAKPOINT } from './lib/ui/constants'
508
+ export {
509
+ TldrawUiContextProvider,
510
+ type TLUiContextProviderProps,
511
+ } from './lib/ui/context/TldrawUiContextProvider'
508
512
  export {
509
513
  TldrawUiA11yProvider,
510
514
  useA11y,
@@ -550,10 +554,6 @@ export {
550
554
  type TLUiEventMap,
551
555
  type TLUiEventSource,
552
556
  } from './lib/ui/context/events'
553
- export {
554
- TldrawUiContextProvider,
555
- type TLUiContextProviderProps,
556
- } from './lib/ui/context/TldrawUiContextProvider'
557
557
  export {
558
558
  TldrawUiToastsProvider,
559
559
  useToasts,
@@ -592,7 +592,6 @@ export {
592
592
  } from './lib/ui/hooks/useTranslation/useTranslation'
593
593
  export { type TLUiIconType } from './lib/ui/icon-types'
594
594
  export { useDefaultHelpers, type TLUiOverrideHelpers, type TLUiOverrides } from './lib/ui/overrides'
595
- export { TldrawUi, type TldrawUiProps } from './lib/ui/TldrawUi'
596
595
  export { containBoxSize, downsizeImage, type BoxWidthHeight } from './lib/utils/assets/assets'
597
596
  export { preloadFont, type TLTypeFace } from './lib/utils/assets/preload-font'
598
597
  export { getEmbedInfo, type TLEmbedResult } from './lib/utils/embeds/embeds'
@@ -607,8 +606,8 @@ export {
607
606
  type TLEditorAssetUrls,
608
607
  } from './lib/utils/static-assets/assetUrls'
609
608
  export {
610
- defaultAddFontsFromNode,
611
609
  KeyboardShiftEnterTweakExtension,
610
+ defaultAddFontsFromNode,
612
611
  renderHtmlFromRichText,
613
612
  renderHtmlFromRichTextForMeasurement,
614
613
  renderPlaintextFromRichText,
@@ -618,7 +617,6 @@ export {
618
617
  export { truncateStringWithEllipsis } from './lib/utils/text/text'
619
618
  export { TextDirection } from './lib/utils/text/textDirection'
620
619
  export {
621
- buildFromV1Document,
622
620
  TLV1AlignStyle,
623
621
  TLV1AssetType,
624
622
  TLV1ColorStyle,
@@ -627,6 +625,7 @@ export {
627
625
  TLV1FontStyle,
628
626
  TLV1ShapeType,
629
627
  TLV1SizeStyle,
628
+ buildFromV1Document,
630
629
  type TLV1ArrowBinding,
631
630
  type TLV1ArrowShape,
632
631
  type TLV1Asset,
@@ -654,11 +653,11 @@ export {
654
653
  type TLV1VideoShape,
655
654
  } from './lib/utils/tldr/buildFromV1Document'
656
655
  export {
656
+ TLDRAW_FILE_EXTENSION,
657
657
  parseAndLoadDocument,
658
658
  parseTldrawJsonFile,
659
659
  serializeTldrawJson,
660
660
  serializeTldrawJsonBlob,
661
- TLDRAW_FILE_EXTENSION,
662
661
  type TldrawFile,
663
662
  type TldrawFileParseError,
664
663
  } from './lib/utils/tldr/file'
@@ -219,6 +219,9 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
219
219
  [shape.id]
220
220
  )
221
221
 
222
+ // eslint-disable-next-line react-hooks/rules-of-hooks
223
+ const zoomLevel = useValue('zoom level', () => this.editor.getZoomLevel(), [this.editor])
224
+
222
225
  const showFrameColors = this.options.showColors
223
226
 
224
227
  const color = theme[shape.props.color]
@@ -233,13 +236,12 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
233
236
  <SVGContainer>
234
237
  <rect
235
238
  className={classNames('tl-frame__body', { 'tl-frame__creating': isCreating })}
239
+ width={shape.props.w + 1 / zoomLevel}
240
+ height={shape.props.h + 1 / zoomLevel}
236
241
  fill={frameFill}
237
242
  stroke={frameStroke}
238
- style={{
239
- width: `calc(${shape.props.w}px + 1px / var(--tl-zoom))`,
240
- height: `calc(${shape.props.h}px + 1px / var(--tl-zoom))`,
241
- transform: `translate(calc(-0.5px / var(--tl-zoom)), calc(-0.5px / var(--tl-zoom)))`,
242
- }}
243
+ y={-0.5 / zoomLevel}
244
+ x={-0.5 / zoomLevel}
243
245
  />
244
246
  </SVGContainer>
245
247
  {isCreating ? null : (
@@ -303,26 +303,33 @@ export class TextShapeUtil extends ShapeUtil<TLTextShape> {
303
303
  }
304
304
 
305
305
  function getTextSize(editor: Editor, props: TLTextShape['props']) {
306
- const { font, richText, size, w } = props
306
+ const { font, richText, autoSize, size, w } = props
307
307
 
308
- const minWidth = 16
308
+ const minWidth = autoSize ? 16 : Math.max(16, w)
309
309
  const fontSize = FONT_SIZES[size]
310
310
 
311
- const maybeFixedWidth = props.autoSize ? null : Math.max(minWidth, Math.floor(w))
311
+ const cw = autoSize
312
+ ? null
313
+ : // `measureText` floors the number so we need to do the same here to avoid issues.
314
+ Math.floor(Math.max(minWidth, w))
312
315
 
313
316
  const html = renderHtmlFromRichTextForMeasurement(editor, richText)
314
317
  const result = editor.textMeasure.measureHtml(html, {
315
318
  ...TEXT_PROPS,
316
319
  fontFamily: FONT_FAMILIES[font],
317
320
  fontSize: fontSize,
318
- maxWidth: maybeFixedWidth,
321
+ maxWidth: cw,
319
322
  })
320
323
 
321
324
  // If we're autosizing the measureText will essentially `Math.floor`
322
325
  // the numbers so `19` rather than `19.3`, this means we must +1 to
323
326
  // whatever we get to avoid wrapping.
327
+ if (autoSize) {
328
+ result.w += 1
329
+ }
330
+
324
331
  return {
325
- width: maybeFixedWidth ?? Math.max(minWidth, result.w + 1),
332
+ width: Math.max(minWidth, result.w),
326
333
  height: Math.max(fontSize, result.h),
327
334
  }
328
335
  }
@@ -213,14 +213,6 @@ export function DefaultKeyboardShortcutsDialogContent() {
213
213
  <TldrawUiMenuActionItem actionId="enlarge-shapes" />
214
214
  <TldrawUiMenuActionItem actionId="shrink-shapes" />
215
215
  <TldrawUiMenuActionItem actionId="a11y-repeat-shape-announce" />
216
- <TldrawUiMenuItem
217
- id="a11y-open-keyboard-shortcuts"
218
- label="a11y.open-keyboard-shortcuts"
219
- kbd="cmd+alt+/"
220
- onSelect={() => {
221
- /* do nothing */
222
- }}
223
- />
224
216
  </TldrawUiMenuGroup>
225
217
  {showCollaborationUi && (
226
218
  <TldrawUiMenuGroup label="shortcuts-dialog.collaboration" id="collaboration">
@@ -19,7 +19,6 @@ import {
19
19
  ToggleEdgeScrollingItem,
20
20
  ToggleFocusModeItem,
21
21
  ToggleGridItem,
22
- ToggleKeyboardShortcutsItem,
23
22
  ToggleLockMenuItem,
24
23
  TogglePasteAtCursorItem,
25
24
  ToggleReduceMotionItem,
@@ -162,7 +161,6 @@ export function PreferencesGroup() {
162
161
  <ToggleFocusModeItem />
163
162
  <ToggleEdgeScrollingItem />
164
163
  <ToggleReduceMotionItem />
165
- <ToggleKeyboardShortcutsItem />
166
164
  <ToggleDynamicSizeModeItem />
167
165
  <TogglePasteAtCursorItem />
168
166
  <ToggleDebugModeItem />
@@ -634,23 +634,6 @@ export function ToggleReduceMotionItem() {
634
634
  )
635
635
  }
636
636
 
637
- /** @public @react */
638
- export function ToggleKeyboardShortcutsItem() {
639
- const editor = useEditor()
640
- const keyboardShortcuts = useValue(
641
- 'keyboardShortcuts',
642
- () => editor.user.getAreKeyboardShortcutsEnabled(),
643
- [editor]
644
- )
645
-
646
- return (
647
- <TldrawUiMenuActionCheckboxItem
648
- actionId="toggle-keyboard-shortcuts"
649
- checked={keyboardShortcuts}
650
- />
651
- )
652
- }
653
-
654
637
  /** @public @react */
655
638
  export function ToggleDebugModeItem() {
656
639
  const editor = useEditor()
@@ -218,6 +218,7 @@ export function TldrawUiMenuItem<
218
218
  preventDefault(e)
219
219
  onSelect('toolbar')
220
220
  }}
221
+ role="option"
221
222
  title={titleStr}
222
223
  type="tool"
223
224
  >
@@ -236,6 +237,7 @@ export function TldrawUiMenuItem<
236
237
  data-value={id}
237
238
  disabled={disabled}
238
239
  onClick={() => onSelect('toolbar')}
240
+ role="option"
239
241
  title={titleStr}
240
242
  type="icon"
241
243
  >