tldraw 3.15.0-canary.db14db4f5395 → 3.15.0-canary.fc319eb96b77
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.
- package/dist-cjs/index.d.ts +82 -84
- package/dist-cjs/index.js +32 -30
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +5 -5
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PathBuilder.js +21 -3
- package/dist-cjs/lib/shapes/shared/PathBuilder.js.map +2 -2
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js +5 -11
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +11 -1
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +1 -0
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +2 -1
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +16 -0
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +5 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +1 -0
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +28 -1
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +24 -7
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +4 -0
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-esm/index.d.mts +82 -84
- package/dist-esm/index.mjs +136 -132
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +5 -5
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs +22 -3
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +5 -11
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +11 -1
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +2 -0
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +2 -1
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +16 -0
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs +1 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +5 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +1 -0
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +28 -1
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +24 -7
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +4 -0
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +160 -158
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +5 -7
- package/src/lib/shapes/shared/PathBuilder.test.tsx +1 -1
- package/src/lib/shapes/shared/PathBuilder.tsx +35 -1
- package/src/lib/shapes/text/TextShapeUtil.tsx +5 -12
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +8 -0
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +2 -0
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +1 -0
- package/src/lib/ui/components/menu-items.tsx +17 -0
- package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +5 -1
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +4 -0
- package/src/lib/ui/context/actions.tsx +29 -1
- package/src/lib/ui/context/events.tsx +2 -0
- package/src/lib/ui/hooks/useClipboardEvents.ts +31 -10
- package/src/lib/ui/hooks/useKeyboardShortcuts.ts +3 -2
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +4 -0
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +4 -0
- package/src/lib/ui/version.ts +3 -3
- package/src/test/Editor.test.tsx +68 -1
- package/src/test/commands/clipboard.test.ts +1 -1
- package/src/test/editor.test.ts +0 -77
package/src/index.ts
CHANGED
|
@@ -24,7 +24,6 @@ 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'
|
|
28
27
|
export {
|
|
29
28
|
TldrawUiMenuActionCheckboxItem,
|
|
30
29
|
type TLUiMenuActionCheckboxItemProps,
|
|
@@ -37,11 +36,10 @@ export {
|
|
|
37
36
|
TldrawUiMenuToolItem,
|
|
38
37
|
type TLUiMenuToolItemProps,
|
|
39
38
|
} 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'
|
|
45
43
|
export { ArrowBindingUtil } from './lib/bindings/arrow/ArrowBindingUtil'
|
|
46
44
|
export { TldrawHandles } from './lib/canvas/TldrawHandles'
|
|
47
45
|
export { TldrawArrowHints, TldrawOverlays } from './lib/canvas/TldrawOverlays'
|
|
@@ -59,11 +57,11 @@ export {
|
|
|
59
57
|
type TLEmbedShapePermissions,
|
|
60
58
|
} from './lib/defaultEmbedDefinitions'
|
|
61
59
|
export {
|
|
62
|
-
DEFAULT_MAX_ASSET_SIZE,
|
|
63
|
-
DEFAULT_MAX_IMAGE_DIMENSION,
|
|
64
60
|
centerSelectionAroundPoint,
|
|
65
61
|
createEmptyBookmarkShape,
|
|
66
62
|
createShapesForAssets,
|
|
63
|
+
DEFAULT_MAX_ASSET_SIZE,
|
|
64
|
+
DEFAULT_MAX_IMAGE_DIMENSION,
|
|
67
65
|
defaultHandleExternalEmbedContent,
|
|
68
66
|
defaultHandleExternalExcalidrawContent,
|
|
69
67
|
defaultHandleExternalFileAsset,
|
|
@@ -82,8 +80,6 @@ export { defaultShapeTools } from './lib/defaultShapeTools'
|
|
|
82
80
|
export { defaultShapeUtils } from './lib/defaultShapeUtils'
|
|
83
81
|
export { registerDefaultSideEffects } from './lib/defaultSideEffects'
|
|
84
82
|
export { defaultTools } from './lib/defaultTools'
|
|
85
|
-
export { ArrowShapeTool } from './lib/shapes/arrow/ArrowShapeTool'
|
|
86
|
-
export { ArrowShapeUtil } from './lib/shapes/arrow/ArrowShapeUtil'
|
|
87
83
|
export {
|
|
88
84
|
type ArrowShapeOptions,
|
|
89
85
|
type TLArcArrowInfo,
|
|
@@ -93,6 +89,8 @@ export {
|
|
|
93
89
|
type TLElbowArrowInfo,
|
|
94
90
|
type TLStraightArrowInfo,
|
|
95
91
|
} from './lib/shapes/arrow/arrow-types'
|
|
92
|
+
export { ArrowShapeTool } from './lib/shapes/arrow/ArrowShapeTool'
|
|
93
|
+
export { ArrowShapeUtil } from './lib/shapes/arrow/ArrowShapeUtil'
|
|
96
94
|
export {
|
|
97
95
|
type ElbowArrowBox,
|
|
98
96
|
type ElbowArrowBoxEdges,
|
|
@@ -132,17 +130,6 @@ export { LineShapeTool } from './lib/shapes/line/LineShapeTool'
|
|
|
132
130
|
export { LineShapeUtil } from './lib/shapes/line/LineShapeUtil'
|
|
133
131
|
export { NoteShapeTool } from './lib/shapes/note/NoteShapeTool'
|
|
134
132
|
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'
|
|
146
133
|
export {
|
|
147
134
|
ASPECT_RATIO_OPTIONS,
|
|
148
135
|
ASPECT_RATIO_TO_VALUE,
|
|
@@ -161,11 +148,22 @@ export {
|
|
|
161
148
|
TEXT_PROPS,
|
|
162
149
|
} from './lib/shapes/shared/default-shape-constants'
|
|
163
150
|
export {
|
|
164
|
-
DefaultFontFaces,
|
|
165
151
|
allDefaultFontFaces,
|
|
152
|
+
DefaultFontFaces,
|
|
166
153
|
type TLDefaultFont,
|
|
167
154
|
type TLDefaultFonts,
|
|
168
155
|
} 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'
|
|
169
167
|
export { useDefaultColorTheme } from './lib/shapes/shared/useDefaultColorTheme'
|
|
170
168
|
export { useEditablePlainText, useEditableText } from './lib/shapes/shared/useEditablePlainText'
|
|
171
169
|
export { useEditableRichText } from './lib/shapes/shared/useEditableRichText'
|
|
@@ -180,12 +178,13 @@ export { TextShapeTool } from './lib/shapes/text/TextShapeTool'
|
|
|
180
178
|
export { TextShapeUtil, type TextShapeOptions } from './lib/shapes/text/TextShapeUtil'
|
|
181
179
|
export { VideoShapeUtil, type VideoShapeOptions } from './lib/shapes/video/VideoShapeUtil'
|
|
182
180
|
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'
|
|
189
188
|
export {
|
|
190
189
|
setDefaultUiAssetUrls,
|
|
191
190
|
type TLUiAssetUrlOverrides,
|
|
@@ -223,6 +222,11 @@ export {
|
|
|
223
222
|
type ExampleDialogProps,
|
|
224
223
|
} from './lib/ui/components/DebugMenu/DefaultDebugMenuContent'
|
|
225
224
|
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'
|
|
226
230
|
export {
|
|
227
231
|
DefaultHelpMenu,
|
|
228
232
|
type TLUiHelpMenuProps,
|
|
@@ -231,11 +235,6 @@ export {
|
|
|
231
235
|
DefaultHelpMenuContent,
|
|
232
236
|
KeyboardShortcutsMenuItem,
|
|
233
237
|
} 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'
|
|
239
238
|
export {
|
|
240
239
|
DefaultKeyboardShortcutsDialog,
|
|
241
240
|
type TLUiKeyboardShortcutsDialogProps,
|
|
@@ -256,116 +255,6 @@ export {
|
|
|
256
255
|
UndoRedoGroup,
|
|
257
256
|
ViewSubmenu,
|
|
258
257
|
} 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'
|
|
369
258
|
export {
|
|
370
259
|
ArrangeMenuSubmenu,
|
|
371
260
|
ClipboardMenuGroup,
|
|
@@ -394,6 +283,7 @@ export {
|
|
|
394
283
|
ToggleEdgeScrollingItem,
|
|
395
284
|
ToggleFocusModeItem,
|
|
396
285
|
ToggleGridItem,
|
|
286
|
+
ToggleKeyboardShortcutsItem,
|
|
397
287
|
ToggleLockMenuItem,
|
|
398
288
|
TogglePasteAtCursorItem,
|
|
399
289
|
ToggleReduceMotionItem,
|
|
@@ -407,6 +297,16 @@ export {
|
|
|
407
297
|
ZoomToFitMenuItem,
|
|
408
298
|
ZoomToSelectionMenuItem,
|
|
409
299
|
} 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'
|
|
410
310
|
export {
|
|
411
311
|
TldrawUiButton,
|
|
412
312
|
type TLUiButtonProps,
|
|
@@ -423,6 +323,27 @@ export {
|
|
|
423
323
|
TldrawUiButtonLabel,
|
|
424
324
|
type TLUiButtonLabelProps,
|
|
425
325
|
} 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'
|
|
426
347
|
export {
|
|
427
348
|
TldrawUiButtonPicker,
|
|
428
349
|
type TLUiButtonPickerProps,
|
|
@@ -484,31 +405,107 @@ export {
|
|
|
484
405
|
type TLUiToolbarToggleItemProps,
|
|
485
406
|
} from './lib/ui/components/primitives/TldrawUiToolbar'
|
|
486
407
|
export {
|
|
487
|
-
|
|
488
|
-
type
|
|
489
|
-
} from './lib/ui/components/
|
|
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'
|
|
490
415
|
export {
|
|
491
|
-
|
|
492
|
-
type
|
|
493
|
-
|
|
494
|
-
} from './lib/ui/components/primitives/menus/TldrawUiMenuContext'
|
|
416
|
+
DefaultStylePanel,
|
|
417
|
+
type TLUiStylePanelProps,
|
|
418
|
+
} from './lib/ui/components/StylePanel/DefaultStylePanel'
|
|
495
419
|
export {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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'
|
|
499
431
|
export {
|
|
500
|
-
|
|
501
|
-
type
|
|
502
|
-
} from './lib/ui/components/
|
|
432
|
+
DefaultImageToolbar,
|
|
433
|
+
type TLUiImageToolbarProps,
|
|
434
|
+
} from './lib/ui/components/Toolbar/DefaultImageToolbar'
|
|
503
435
|
export {
|
|
504
|
-
|
|
505
|
-
type
|
|
506
|
-
} from './lib/ui/components/
|
|
507
|
-
export { PORTRAIT_BREAKPOINT } from './lib/ui/constants'
|
|
436
|
+
DefaultImageToolbarContent,
|
|
437
|
+
type DefaultImageToolbarContentProps,
|
|
438
|
+
} from './lib/ui/components/Toolbar/DefaultImageToolbarContent'
|
|
508
439
|
export {
|
|
509
|
-
|
|
510
|
-
type
|
|
511
|
-
} from './lib/ui/
|
|
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
|
+
HeartToolbarItem,
|
|
468
|
+
HexagonToolbarItem,
|
|
469
|
+
HighlightToolbarItem,
|
|
470
|
+
LaserToolbarItem,
|
|
471
|
+
LineToolbarItem,
|
|
472
|
+
NoteToolbarItem,
|
|
473
|
+
OvalToolbarItem,
|
|
474
|
+
RectangleToolbarItem,
|
|
475
|
+
RhombusToolbarItem,
|
|
476
|
+
SelectToolbarItem,
|
|
477
|
+
StarToolbarItem,
|
|
478
|
+
TextToolbarItem,
|
|
479
|
+
ToolbarItem,
|
|
480
|
+
TrapezoidToolbarItem,
|
|
481
|
+
TriangleToolbarItem,
|
|
482
|
+
useIsToolSelected,
|
|
483
|
+
XBoxToolbarItem,
|
|
484
|
+
type ToolbarItemProps,
|
|
485
|
+
} from './lib/ui/components/Toolbar/DefaultToolbarContent'
|
|
486
|
+
export {
|
|
487
|
+
DefaultVideoToolbar,
|
|
488
|
+
type TLUiVideoToolbarProps,
|
|
489
|
+
} from './lib/ui/components/Toolbar/DefaultVideoToolbar'
|
|
490
|
+
export {
|
|
491
|
+
DefaultVideoToolbarContent,
|
|
492
|
+
type DefaultVideoToolbarContentProps,
|
|
493
|
+
} from './lib/ui/components/Toolbar/DefaultVideoToolbarContent'
|
|
494
|
+
export {
|
|
495
|
+
OverflowingToolbar,
|
|
496
|
+
type OverflowingToolbarProps,
|
|
497
|
+
} from './lib/ui/components/Toolbar/OverflowingToolbar'
|
|
498
|
+
export {
|
|
499
|
+
CenteredTopPanelContainer,
|
|
500
|
+
type CenteredTopPanelContainerProps,
|
|
501
|
+
} from './lib/ui/components/TopPanel/CenteredTopPanelContainer'
|
|
502
|
+
export { DefaultTopPanel } from './lib/ui/components/TopPanel/DefaultTopPanel'
|
|
503
|
+
export {
|
|
504
|
+
DefaultZoomMenu,
|
|
505
|
+
type TLUiZoomMenuProps,
|
|
506
|
+
} from './lib/ui/components/ZoomMenu/DefaultZoomMenu'
|
|
507
|
+
export { DefaultZoomMenuContent } from './lib/ui/components/ZoomMenu/DefaultZoomMenuContent'
|
|
508
|
+
export { PORTRAIT_BREAKPOINT } from './lib/ui/constants'
|
|
512
509
|
export {
|
|
513
510
|
TldrawUiA11yProvider,
|
|
514
511
|
useA11y,
|
|
@@ -554,6 +551,10 @@ export {
|
|
|
554
551
|
type TLUiEventMap,
|
|
555
552
|
type TLUiEventSource,
|
|
556
553
|
} from './lib/ui/context/events'
|
|
554
|
+
export {
|
|
555
|
+
TldrawUiContextProvider,
|
|
556
|
+
type TLUiContextProviderProps,
|
|
557
|
+
} from './lib/ui/context/TldrawUiContextProvider'
|
|
557
558
|
export {
|
|
558
559
|
TldrawUiToastsProvider,
|
|
559
560
|
useToasts,
|
|
@@ -592,6 +593,7 @@ export {
|
|
|
592
593
|
} from './lib/ui/hooks/useTranslation/useTranslation'
|
|
593
594
|
export { type TLUiIconType } from './lib/ui/icon-types'
|
|
594
595
|
export { useDefaultHelpers, type TLUiOverrideHelpers, type TLUiOverrides } from './lib/ui/overrides'
|
|
596
|
+
export { TldrawUi, type TldrawUiProps } from './lib/ui/TldrawUi'
|
|
595
597
|
export { containBoxSize, downsizeImage, type BoxWidthHeight } from './lib/utils/assets/assets'
|
|
596
598
|
export { preloadFont, type TLTypeFace } from './lib/utils/assets/preload-font'
|
|
597
599
|
export { getEmbedInfo, type TLEmbedResult } from './lib/utils/embeds/embeds'
|
|
@@ -606,8 +608,8 @@ export {
|
|
|
606
608
|
type TLEditorAssetUrls,
|
|
607
609
|
} from './lib/utils/static-assets/assetUrls'
|
|
608
610
|
export {
|
|
609
|
-
KeyboardShiftEnterTweakExtension,
|
|
610
611
|
defaultAddFontsFromNode,
|
|
612
|
+
KeyboardShiftEnterTweakExtension,
|
|
611
613
|
renderHtmlFromRichText,
|
|
612
614
|
renderHtmlFromRichTextForMeasurement,
|
|
613
615
|
renderPlaintextFromRichText,
|
|
@@ -617,6 +619,7 @@ export {
|
|
|
617
619
|
export { truncateStringWithEllipsis } from './lib/utils/text/text'
|
|
618
620
|
export { TextDirection } from './lib/utils/text/textDirection'
|
|
619
621
|
export {
|
|
622
|
+
buildFromV1Document,
|
|
620
623
|
TLV1AlignStyle,
|
|
621
624
|
TLV1AssetType,
|
|
622
625
|
TLV1ColorStyle,
|
|
@@ -625,7 +628,6 @@ export {
|
|
|
625
628
|
TLV1FontStyle,
|
|
626
629
|
TLV1ShapeType,
|
|
627
630
|
TLV1SizeStyle,
|
|
628
|
-
buildFromV1Document,
|
|
629
631
|
type TLV1ArrowBinding,
|
|
630
632
|
type TLV1ArrowShape,
|
|
631
633
|
type TLV1Asset,
|
|
@@ -653,11 +655,11 @@ export {
|
|
|
653
655
|
type TLV1VideoShape,
|
|
654
656
|
} from './lib/utils/tldr/buildFromV1Document'
|
|
655
657
|
export {
|
|
656
|
-
TLDRAW_FILE_EXTENSION,
|
|
657
658
|
parseAndLoadDocument,
|
|
658
659
|
parseTldrawJsonFile,
|
|
659
660
|
serializeTldrawJson,
|
|
660
661
|
serializeTldrawJsonBlob,
|
|
662
|
+
TLDRAW_FILE_EXTENSION,
|
|
661
663
|
type TldrawFile,
|
|
662
664
|
type TldrawFileParseError,
|
|
663
665
|
} from './lib/utils/tldr/file'
|
|
@@ -219,9 +219,6 @@ 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
|
-
|
|
225
222
|
const showFrameColors = this.options.showColors
|
|
226
223
|
|
|
227
224
|
const color = theme[shape.props.color]
|
|
@@ -236,12 +233,13 @@ export class FrameShapeUtil extends BaseBoxShapeUtil<TLFrameShape> {
|
|
|
236
233
|
<SVGContainer>
|
|
237
234
|
<rect
|
|
238
235
|
className={classNames('tl-frame__body', { 'tl-frame__creating': isCreating })}
|
|
239
|
-
width={shape.props.w + 1 / zoomLevel}
|
|
240
|
-
height={shape.props.h + 1 / zoomLevel}
|
|
241
236
|
fill={frameFill}
|
|
242
237
|
stroke={frameStroke}
|
|
243
|
-
|
|
244
|
-
|
|
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
|
+
}}
|
|
245
243
|
/>
|
|
246
244
|
</SVGContainer>
|
|
247
245
|
{isCreating ? null : (
|
|
@@ -138,7 +138,7 @@ describe('PathBuilder', () => {
|
|
|
138
138
|
.toGeometry()
|
|
139
139
|
|
|
140
140
|
expect(geometry?.toSimpleSvgPath()).toMatchInlineSnapshot(
|
|
141
|
-
`"M0,0L100,100L100,
|
|
141
|
+
`"M0,0L100,100L100,0L84.92197106154207,-11.50593202657044L67.93757691512266,-18.409491194065584L50.000000178767834,-20.71067750830319L32.06242347050369,-18.409490975101022L15.078029408356239,-11.505931600276853L6.103515630684342e-7,6.103515559630068e-7L-11.505931600276849,15.078029408356231L-18.409490975101022,32.062423470503674L-20.710677508303192,50.00000017876782L-18.409491194065588,67.93757691512262L-11.50593202657045,84.92197106154204L-1.4210854715202004e-14,99.99999999999999L0,0Z"`
|
|
142
142
|
)
|
|
143
143
|
})
|
|
144
144
|
})
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
Geometry2dFilters,
|
|
11
11
|
Geometry2dOptions,
|
|
12
12
|
getPerfectDashProps,
|
|
13
|
+
getVerticesCountForArcLength,
|
|
13
14
|
Group2d,
|
|
14
15
|
modulate,
|
|
15
16
|
PerfectDashTerminal,
|
|
@@ -121,6 +122,7 @@ export interface CubicBezierToPathBuilderCommand extends PathBuilderCommandBase
|
|
|
121
122
|
type: 'cubic'
|
|
122
123
|
cp1: VecModel
|
|
123
124
|
cp2: VecModel
|
|
125
|
+
resolution?: number
|
|
124
126
|
}
|
|
125
127
|
|
|
126
128
|
/** @internal */
|
|
@@ -317,8 +319,17 @@ export class PathBuilder {
|
|
|
317
319
|
// Calculate the sweep angle
|
|
318
320
|
const sweepAngle = endAngle - startAngle
|
|
319
321
|
|
|
322
|
+
// Calculate the approximate arc length. General ellipse arc length is expensive - there's
|
|
323
|
+
// no closed form solution, so we have to do iterative numerical approximation. As we only
|
|
324
|
+
// use this to control the resolution of later approximations, let's cheat and just use the
|
|
325
|
+
// circular arc length with the largest radius:
|
|
326
|
+
const approximateArcLength = Math.max(rx1, ry1) * Math.abs(sweepAngle)
|
|
327
|
+
|
|
320
328
|
// Approximate the arc using cubic bezier curves
|
|
321
329
|
const numSegments = Math.min(4, Math.ceil(Math.abs(sweepAngle) / (Math.PI / 2)))
|
|
330
|
+
const resolutionPerSegment = Math.ceil(
|
|
331
|
+
getVerticesCountForArcLength(approximateArcLength) / numSegments
|
|
332
|
+
)
|
|
322
333
|
const anglePerSegment = sweepAngle / numSegments
|
|
323
334
|
|
|
324
335
|
// Helper function to compute point on ellipse
|
|
@@ -364,7 +375,16 @@ export class PathBuilder {
|
|
|
364
375
|
const cp2y = end.y - handleScale * d2.y
|
|
365
376
|
|
|
366
377
|
const bezierOpts = i === 0 ? opts : { ...opts, mergeWithPrevious: true }
|
|
367
|
-
this.
|
|
378
|
+
this.cubicBezierToWithResolution(
|
|
379
|
+
end.x,
|
|
380
|
+
end.y,
|
|
381
|
+
cp1x,
|
|
382
|
+
cp1y,
|
|
383
|
+
cp2x,
|
|
384
|
+
cp2y,
|
|
385
|
+
bezierOpts,
|
|
386
|
+
resolutionPerSegment
|
|
387
|
+
)
|
|
368
388
|
}
|
|
369
389
|
|
|
370
390
|
return this
|
|
@@ -378,6 +398,18 @@ export class PathBuilder {
|
|
|
378
398
|
cp2X: number,
|
|
379
399
|
cp2Y: number,
|
|
380
400
|
opts?: PathBuilderCommandOpts
|
|
401
|
+
) {
|
|
402
|
+
return this.cubicBezierToWithResolution(x, y, cp1X, cp1Y, cp2X, cp2Y, opts)
|
|
403
|
+
}
|
|
404
|
+
private cubicBezierToWithResolution(
|
|
405
|
+
x: number,
|
|
406
|
+
y: number,
|
|
407
|
+
cp1X: number,
|
|
408
|
+
cp1Y: number,
|
|
409
|
+
cp2X: number,
|
|
410
|
+
cp2Y: number,
|
|
411
|
+
opts?: PathBuilderCommandOpts,
|
|
412
|
+
resolution?: number
|
|
381
413
|
) {
|
|
382
414
|
this.assertHasMoveTo()
|
|
383
415
|
this.commands.push({
|
|
@@ -388,6 +420,7 @@ export class PathBuilder {
|
|
|
388
420
|
cp2: { x: cp2X, y: cp2Y },
|
|
389
421
|
isClose: false,
|
|
390
422
|
opts,
|
|
423
|
+
resolution,
|
|
391
424
|
})
|
|
392
425
|
return this
|
|
393
426
|
}
|
|
@@ -972,6 +1005,7 @@ export class PathBuilderGeometry2d extends Geometry2d {
|
|
|
972
1005
|
cp1: Vec.From(command.cp1),
|
|
973
1006
|
cp2: Vec.From(command.cp2),
|
|
974
1007
|
end: Vec.From(command),
|
|
1008
|
+
resolution: command.resolution,
|
|
975
1009
|
})
|
|
976
1010
|
)
|
|
977
1011
|
break
|
|
@@ -303,33 +303,26 @@ export class TextShapeUtil extends ShapeUtil<TLTextShape> {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
function getTextSize(editor: Editor, props: TLTextShape['props']) {
|
|
306
|
-
const { font, richText,
|
|
306
|
+
const { font, richText, size, w } = props
|
|
307
307
|
|
|
308
|
-
const minWidth =
|
|
308
|
+
const minWidth = 16
|
|
309
309
|
const fontSize = FONT_SIZES[size]
|
|
310
310
|
|
|
311
|
-
const
|
|
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))
|
|
311
|
+
const maybeFixedWidth = props.autoSize ? null : Math.max(minWidth, Math.floor(w))
|
|
315
312
|
|
|
316
313
|
const html = renderHtmlFromRichTextForMeasurement(editor, richText)
|
|
317
314
|
const result = editor.textMeasure.measureHtml(html, {
|
|
318
315
|
...TEXT_PROPS,
|
|
319
316
|
fontFamily: FONT_FAMILIES[font],
|
|
320
317
|
fontSize: fontSize,
|
|
321
|
-
maxWidth:
|
|
318
|
+
maxWidth: maybeFixedWidth,
|
|
322
319
|
})
|
|
323
320
|
|
|
324
321
|
// If we're autosizing the measureText will essentially `Math.floor`
|
|
325
322
|
// the numbers so `19` rather than `19.3`, this means we must +1 to
|
|
326
323
|
// whatever we get to avoid wrapping.
|
|
327
|
-
if (autoSize) {
|
|
328
|
-
result.w += 1
|
|
329
|
-
}
|
|
330
|
-
|
|
331
324
|
return {
|
|
332
|
-
width: Math.max(minWidth, result.w),
|
|
325
|
+
width: maybeFixedWidth ?? Math.max(minWidth, result.w + 1),
|
|
333
326
|
height: Math.max(fontSize, result.h),
|
|
334
327
|
}
|
|
335
328
|
}
|
package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx
CHANGED
|
@@ -213,6 +213,14 @@ 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
|
+
/>
|
|
216
224
|
</TldrawUiMenuGroup>
|
|
217
225
|
{showCollaborationUi && (
|
|
218
226
|
<TldrawUiMenuGroup label="shortcuts-dialog.collaboration" id="collaboration">
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
ToggleEdgeScrollingItem,
|
|
20
20
|
ToggleFocusModeItem,
|
|
21
21
|
ToggleGridItem,
|
|
22
|
+
ToggleKeyboardShortcutsItem,
|
|
22
23
|
ToggleLockMenuItem,
|
|
23
24
|
TogglePasteAtCursorItem,
|
|
24
25
|
ToggleReduceMotionItem,
|
|
@@ -161,6 +162,7 @@ export function PreferencesGroup() {
|
|
|
161
162
|
<ToggleFocusModeItem />
|
|
162
163
|
<ToggleEdgeScrollingItem />
|
|
163
164
|
<ToggleReduceMotionItem />
|
|
165
|
+
<ToggleKeyboardShortcutsItem />
|
|
164
166
|
<ToggleDynamicSizeModeItem />
|
|
165
167
|
<TogglePasteAtCursorItem />
|
|
166
168
|
<ToggleDebugModeItem />
|