tldraw 3.15.0-canary.d3401abd19b9 → 3.15.0-canary.db14db4f5395
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 +84 -79
- package/dist-cjs/index.js +30 -31
- 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 +3 -21
- package/dist-cjs/lib/shapes/shared/PathBuilder.js.map +2 -2
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js +11 -5
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +1 -11
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +0 -1
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +1 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +0 -16
- 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 +2 -5
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +0 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +1 -28
- 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 +7 -24
- 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 +0 -4
- 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 +84 -79
- package/dist-esm/index.mjs +132 -134
- 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 +3 -22
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +11 -5
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +1 -11
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +0 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +1 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +0 -16
- 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 +2 -5
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +0 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +1 -28
- 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 +7 -24
- 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 +0 -4
- 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 +158 -159
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +7 -5
- package/src/lib/shapes/shared/PathBuilder.test.tsx +1 -1
- package/src/lib/shapes/shared/PathBuilder.tsx +1 -35
- package/src/lib/shapes/text/TextShapeUtil.tsx +12 -5
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +0 -8
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +0 -2
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +0 -1
- package/src/lib/ui/components/menu-items.tsx +0 -17
- package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +1 -5
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +0 -4
- package/src/lib/ui/context/actions.tsx +1 -29
- package/src/lib/ui/context/events.tsx +0 -2
- package/src/lib/ui/hooks/useClipboardEvents.ts +10 -31
- package/src/lib/ui/hooks/useKeyboardShortcuts.ts +2 -3
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +0 -4
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +0 -4
- package/src/lib/ui/version.ts +3 -3
- package/src/test/Editor.test.tsx +1 -68
- package/src/test/commands/clipboard.test.ts +1 -1
- 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
|
-
|
|
409
|
-
type
|
|
410
|
-
} from './lib/ui/components/
|
|
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
|
-
|
|
491
|
-
type
|
|
492
|
-
|
|
491
|
+
TldrawUiMenuContextProvider,
|
|
492
|
+
type TLUiMenuContextProviderProps,
|
|
493
|
+
type TLUiMenuContextType,
|
|
494
|
+
} from './lib/ui/components/primitives/menus/TldrawUiMenuContext'
|
|
493
495
|
export {
|
|
494
|
-
|
|
495
|
-
type
|
|
496
|
-
} from './lib/ui/components/
|
|
496
|
+
TldrawUiMenuGroup,
|
|
497
|
+
type TLUiMenuGroupProps,
|
|
498
|
+
} from './lib/ui/components/primitives/menus/TldrawUiMenuGroup'
|
|
497
499
|
export {
|
|
498
|
-
|
|
499
|
-
type
|
|
500
|
-
} from './lib/ui/components/
|
|
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
|
-
|
|
504
|
-
type
|
|
505
|
-
} from './lib/ui/components/
|
|
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
|
-
|
|
239
|
-
|
|
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 : (
|
|
@@ -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,0L91.23532468849007,-7.455843959357096L81.64709960511827,-13.25483368860933L71.44121219537817,-17.39696918901332L60.82354990476352,-19.882250461825734L50.000000178767834,-20.71067750830319L39.17645046288481,-19.882250329702327L28.558788202608024,-17.396968927279783L18.35290084343114,-13.254833302292194L8.764675830847777,-7.455843455996203L6.103515630684342e-7,6.103515559630068e-7L-7.4558434559962,8.764675830847771L-13.254833302292194,18.35290084343114L-17.396968927279772,28.55878820260801L-19.882250329702327,39.17645046288479L-20.710677508303192,50.00000017876782L-19.88225046182574,60.823549904763496L-17.39696918901333,71.44121219537817L-13.254833688609331,81.64709960511824L-7.455843959357106,91.23532468849007L-1.4210854715202004e-14,99.99999999999999L0,0Z"`
|
|
142
142
|
)
|
|
143
143
|
})
|
|
144
144
|
})
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
Geometry2dFilters,
|
|
11
11
|
Geometry2dOptions,
|
|
12
12
|
getPerfectDashProps,
|
|
13
|
-
getVerticesCountForArcLength,
|
|
14
13
|
Group2d,
|
|
15
14
|
modulate,
|
|
16
15
|
PerfectDashTerminal,
|
|
@@ -122,7 +121,6 @@ export interface CubicBezierToPathBuilderCommand extends PathBuilderCommandBase
|
|
|
122
121
|
type: 'cubic'
|
|
123
122
|
cp1: VecModel
|
|
124
123
|
cp2: VecModel
|
|
125
|
-
resolution?: number
|
|
126
124
|
}
|
|
127
125
|
|
|
128
126
|
/** @internal */
|
|
@@ -319,17 +317,8 @@ export class PathBuilder {
|
|
|
319
317
|
// Calculate the sweep angle
|
|
320
318
|
const sweepAngle = endAngle - startAngle
|
|
321
319
|
|
|
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
|
-
|
|
328
320
|
// Approximate the arc using cubic bezier curves
|
|
329
321
|
const numSegments = Math.min(4, Math.ceil(Math.abs(sweepAngle) / (Math.PI / 2)))
|
|
330
|
-
const resolutionPerSegment = Math.ceil(
|
|
331
|
-
getVerticesCountForArcLength(approximateArcLength) / numSegments
|
|
332
|
-
)
|
|
333
322
|
const anglePerSegment = sweepAngle / numSegments
|
|
334
323
|
|
|
335
324
|
// Helper function to compute point on ellipse
|
|
@@ -375,16 +364,7 @@ export class PathBuilder {
|
|
|
375
364
|
const cp2y = end.y - handleScale * d2.y
|
|
376
365
|
|
|
377
366
|
const bezierOpts = i === 0 ? opts : { ...opts, mergeWithPrevious: true }
|
|
378
|
-
this.
|
|
379
|
-
end.x,
|
|
380
|
-
end.y,
|
|
381
|
-
cp1x,
|
|
382
|
-
cp1y,
|
|
383
|
-
cp2x,
|
|
384
|
-
cp2y,
|
|
385
|
-
bezierOpts,
|
|
386
|
-
resolutionPerSegment
|
|
387
|
-
)
|
|
367
|
+
this.cubicBezierTo(end.x, end.y, cp1x, cp1y, cp2x, cp2y, bezierOpts)
|
|
388
368
|
}
|
|
389
369
|
|
|
390
370
|
return this
|
|
@@ -398,18 +378,6 @@ export class PathBuilder {
|
|
|
398
378
|
cp2X: number,
|
|
399
379
|
cp2Y: number,
|
|
400
380
|
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
|
|
413
381
|
) {
|
|
414
382
|
this.assertHasMoveTo()
|
|
415
383
|
this.commands.push({
|
|
@@ -420,7 +388,6 @@ export class PathBuilder {
|
|
|
420
388
|
cp2: { x: cp2X, y: cp2Y },
|
|
421
389
|
isClose: false,
|
|
422
390
|
opts,
|
|
423
|
-
resolution,
|
|
424
391
|
})
|
|
425
392
|
return this
|
|
426
393
|
}
|
|
@@ -1005,7 +972,6 @@ export class PathBuilderGeometry2d extends Geometry2d {
|
|
|
1005
972
|
cp1: Vec.From(command.cp1),
|
|
1006
973
|
cp2: Vec.From(command.cp2),
|
|
1007
974
|
end: Vec.From(command),
|
|
1008
|
-
resolution: command.resolution,
|
|
1009
975
|
})
|
|
1010
976
|
)
|
|
1011
977
|
break
|
|
@@ -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
|
|
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:
|
|
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:
|
|
332
|
+
width: Math.max(minWidth, result.w),
|
|
326
333
|
height: Math.max(fontSize, result.h),
|
|
327
334
|
}
|
|
328
335
|
}
|
package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx
CHANGED
|
@@ -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 />
|