tldraw 3.15.0-next.f1dfcef63951 → 3.16.0-next.c30b1b5e551a
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 +161 -95
- package/dist-cjs/index.js +42 -31
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawImage.js +5 -2
- package/dist-cjs/lib/TldrawImage.js.map +3 -3
- package/dist-cjs/lib/canvas/TldrawCropHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawCropHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawOverlays.js +1 -1
- package/dist-cjs/lib/canvas/TldrawOverlays.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +279 -271
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +1 -0
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +22 -36
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js +16 -4
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +3 -0
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.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/line/LineShapeUtil.js +15 -1
- package/dist-cjs/lib/shapes/line/LineShapeUtil.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/shared/PlainTextLabel.js +1 -0
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js +1 -0
- package/dist-cjs/lib/shapes/shared/RichTextLabel.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/styles.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +43 -22
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +2 -15
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +5 -0
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +8 -0
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +8 -0
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +8 -0
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +51 -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/NavigationPanel/DefaultNavigationPanel.js +3 -4
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/Spinner.js +2 -25
- package/dist-cjs/lib/ui/components/Spinner.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/Toolbar/ToggleToolLockedButton.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/Button/TldrawUiButtonIcon.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/TldrawUiIcon.js +35 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +6 -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/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +0 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +42 -8
- 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/menu-hooks.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/useTools.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 +8 -0
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/kbd-utils.js +2 -1
- package/dist-cjs/lib/ui/kbd-utils.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-cjs/lib/utils/excalidraw/putExcalidrawContent.js +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js +3 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
- package/dist-esm/index.d.mts +161 -95
- package/dist-esm/index.mjs +154 -135
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawImage.mjs +5 -2
- package/dist-esm/lib/TldrawImage.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawOverlays.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawOverlays.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +279 -271
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +1 -0
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +24 -36
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +19 -5
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +3 -0
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.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/line/LineShapeUtil.mjs +15 -1
- package/dist-esm/lib/shapes/line/LineShapeUtil.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/shared/PlainTextLabel.mjs +1 -0
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +1 -0
- package/dist-esm/lib/shapes/shared/RichTextLabel.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/styles.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +43 -22
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +2 -15
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +5 -0
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +8 -0
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +8 -0
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +8 -0
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +51 -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/NavigationPanel/DefaultNavigationPanel.mjs +3 -4
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Spinner.mjs +3 -26
- package/dist-esm/lib/ui/components/Spinner.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/Toolbar/ToggleToolLockedButton.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/Button/TldrawUiButtonIcon.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/TldrawUiIcon.mjs +36 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +6 -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/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +0 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +42 -8
- 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/menu-hooks.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/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +8 -0
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/kbd-utils.mjs +2 -1
- package/dist-esm/lib/ui/kbd-utils.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs +3 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
- package/package.json +4 -3
- package/src/index.ts +174 -160
- package/src/lib/TldrawImage.tsx +6 -2
- package/src/lib/canvas/TldrawCropHandles.tsx +3 -1
- package/src/lib/canvas/TldrawHandles.tsx +5 -1
- package/src/lib/canvas/TldrawOverlays.tsx +1 -1
- package/src/lib/canvas/TldrawSelectionForeground.tsx +5 -1
- package/src/lib/defaultExternalContentHandlers.ts +2 -1
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +5 -5
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +25 -39
- package/src/lib/shapes/arrow/arrowLabel.ts +23 -3
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +3 -0
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +5 -7
- package/src/lib/shapes/line/LineShapeUtil.tsx +19 -2
- package/src/lib/shapes/shared/PathBuilder.test.tsx +1 -1
- package/src/lib/shapes/shared/PathBuilder.tsx +35 -1
- package/src/lib/shapes/shared/PlainTextLabel.tsx +1 -0
- package/src/lib/shapes/shared/RichTextLabel.tsx +1 -0
- package/src/lib/shapes/text/TextShapeUtil.tsx +5 -12
- package/src/lib/styles.tsx +3 -1
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +54 -30
- package/src/lib/tools/SelectTool/childStates/Idle.ts +2 -24
- package/src/lib/tools/SelectTool/childStates/PointingShape.ts +7 -0
- package/src/lib/tools/SelectTool/childStates/Resizing.ts +12 -1
- package/src/lib/tools/SelectTool/childStates/Rotating.ts +11 -0
- package/src/lib/tools/SelectTool/childStates/Translating.ts +11 -0
- package/src/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.ts +1 -0
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +40 -0
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +2 -0
- package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +3 -4
- package/src/lib/ui/components/Spinner.tsx +2 -24
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +1 -0
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +3 -1
- package/src/lib/ui/components/menu-items.tsx +17 -0
- package/src/lib/ui/components/primitives/Button/TldrawUiButtonIcon.tsx +2 -2
- package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiIcon.tsx +41 -3
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +6 -1
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +4 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +2 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +3 -4
- package/src/lib/ui/context/actions.tsx +44 -9
- package/src/lib/ui/context/events.tsx +4 -2
- package/src/lib/ui/hooks/menu-hooks.ts +1 -0
- package/src/lib/ui/hooks/useClipboardEvents.ts +31 -10
- package/src/lib/ui/hooks/useKeyboardShortcuts.ts +3 -2
- package/src/lib/ui/hooks/useTools.tsx +2 -1
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +8 -0
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +8 -0
- package/src/lib/ui/kbd-utils.ts +2 -1
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +8 -22
- package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +16 -2
- package/src/lib/utils/excalidraw/putExcalidrawContent.ts +1 -1
- package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +24 -3
- package/src/lib/utils/tldr/buildFromV1Document.ts +2 -1
- package/src/test/Editor.test.tsx +68 -1
- package/src/test/SelectTool.test.ts +37 -11
- package/src/test/commands/clipboard.test.ts +1 -1
- package/src/test/commands/deletePage.test.ts +84 -1
- package/src/test/navigation.test.ts +254 -0
- package/src/test/shapeutils.test.ts +394 -45
- package/tldraw.css +29 -49
- 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,12 +36,12 @@ 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'
|
|
44
|
+
export { TldrawCropHandles, type TldrawCropHandlesProps } from './lib/canvas/TldrawCropHandles'
|
|
46
45
|
export { TldrawHandles } from './lib/canvas/TldrawHandles'
|
|
47
46
|
export { TldrawArrowHints, TldrawOverlays } from './lib/canvas/TldrawOverlays'
|
|
48
47
|
export { TldrawScribble } from './lib/canvas/TldrawScribble'
|
|
@@ -59,11 +58,11 @@ export {
|
|
|
59
58
|
type TLEmbedShapePermissions,
|
|
60
59
|
} from './lib/defaultEmbedDefinitions'
|
|
61
60
|
export {
|
|
62
|
-
DEFAULT_MAX_ASSET_SIZE,
|
|
63
|
-
DEFAULT_MAX_IMAGE_DIMENSION,
|
|
64
61
|
centerSelectionAroundPoint,
|
|
65
62
|
createEmptyBookmarkShape,
|
|
66
63
|
createShapesForAssets,
|
|
64
|
+
DEFAULT_MAX_ASSET_SIZE,
|
|
65
|
+
DEFAULT_MAX_IMAGE_DIMENSION,
|
|
67
66
|
defaultHandleExternalEmbedContent,
|
|
68
67
|
defaultHandleExternalExcalidrawContent,
|
|
69
68
|
defaultHandleExternalFileAsset,
|
|
@@ -73,6 +72,7 @@ export {
|
|
|
73
72
|
defaultHandleExternalTldrawContent,
|
|
74
73
|
defaultHandleExternalUrlAsset,
|
|
75
74
|
defaultHandleExternalUrlContent,
|
|
75
|
+
getAssetInfo,
|
|
76
76
|
getMediaAssetInfoPartial,
|
|
77
77
|
registerDefaultExternalContentHandlers,
|
|
78
78
|
type TLDefaultExternalContentHandlerOpts,
|
|
@@ -82,8 +82,6 @@ export { defaultShapeTools } from './lib/defaultShapeTools'
|
|
|
82
82
|
export { defaultShapeUtils } from './lib/defaultShapeUtils'
|
|
83
83
|
export { registerDefaultSideEffects } from './lib/defaultSideEffects'
|
|
84
84
|
export { defaultTools } from './lib/defaultTools'
|
|
85
|
-
export { ArrowShapeTool } from './lib/shapes/arrow/ArrowShapeTool'
|
|
86
|
-
export { ArrowShapeUtil } from './lib/shapes/arrow/ArrowShapeUtil'
|
|
87
85
|
export {
|
|
88
86
|
type ArrowShapeOptions,
|
|
89
87
|
type TLArcArrowInfo,
|
|
@@ -93,6 +91,8 @@ export {
|
|
|
93
91
|
type TLElbowArrowInfo,
|
|
94
92
|
type TLStraightArrowInfo,
|
|
95
93
|
} from './lib/shapes/arrow/arrow-types'
|
|
94
|
+
export { ArrowShapeTool } from './lib/shapes/arrow/ArrowShapeTool'
|
|
95
|
+
export { ArrowShapeUtil } from './lib/shapes/arrow/ArrowShapeUtil'
|
|
96
96
|
export {
|
|
97
97
|
type ElbowArrowBox,
|
|
98
98
|
type ElbowArrowBoxEdges,
|
|
@@ -132,17 +132,6 @@ export { LineShapeTool } from './lib/shapes/line/LineShapeTool'
|
|
|
132
132
|
export { LineShapeUtil } from './lib/shapes/line/LineShapeUtil'
|
|
133
133
|
export { NoteShapeTool } from './lib/shapes/note/NoteShapeTool'
|
|
134
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'
|
|
146
135
|
export {
|
|
147
136
|
ASPECT_RATIO_OPTIONS,
|
|
148
137
|
ASPECT_RATIO_TO_VALUE,
|
|
@@ -161,11 +150,22 @@ export {
|
|
|
161
150
|
TEXT_PROPS,
|
|
162
151
|
} from './lib/shapes/shared/default-shape-constants'
|
|
163
152
|
export {
|
|
164
|
-
DefaultFontFaces,
|
|
165
153
|
allDefaultFontFaces,
|
|
154
|
+
DefaultFontFaces,
|
|
166
155
|
type TLDefaultFont,
|
|
167
156
|
type TLDefaultFonts,
|
|
168
157
|
} from './lib/shapes/shared/defaultFonts'
|
|
158
|
+
export {
|
|
159
|
+
PlainTextLabel,
|
|
160
|
+
TextLabel,
|
|
161
|
+
type PlainTextLabelProps,
|
|
162
|
+
} from './lib/shapes/shared/PlainTextLabel'
|
|
163
|
+
export {
|
|
164
|
+
RichTextLabel,
|
|
165
|
+
RichTextSVG,
|
|
166
|
+
type RichTextLabelProps,
|
|
167
|
+
type RichTextSVGProps,
|
|
168
|
+
} from './lib/shapes/shared/RichTextLabel'
|
|
169
169
|
export { useDefaultColorTheme } from './lib/shapes/shared/useDefaultColorTheme'
|
|
170
170
|
export { useEditablePlainText, useEditableText } from './lib/shapes/shared/useEditablePlainText'
|
|
171
171
|
export { useEditableRichText } from './lib/shapes/shared/useEditableRichText'
|
|
@@ -180,12 +180,14 @@ export { TextShapeTool } from './lib/shapes/text/TextShapeTool'
|
|
|
180
180
|
export { TextShapeUtil, type TextShapeOptions } from './lib/shapes/text/TextShapeUtil'
|
|
181
181
|
export { VideoShapeUtil, type VideoShapeOptions } from './lib/shapes/video/VideoShapeUtil'
|
|
182
182
|
export { type StyleValuesForUi } from './lib/styles'
|
|
183
|
+
export { Tldraw, type TLComponents, type TldrawBaseProps, type TldrawProps } from './lib/Tldraw'
|
|
184
|
+
export { TldrawImage, type TldrawImageProps } from './lib/TldrawImage'
|
|
183
185
|
export { EraserTool } from './lib/tools/EraserTool/EraserTool'
|
|
184
186
|
export { HandTool } from './lib/tools/HandTool/HandTool'
|
|
185
187
|
export { LaserTool } from './lib/tools/LaserTool/LaserTool'
|
|
188
|
+
export { getHitShapeOnCanvasPointerDown } from './lib/tools/selection-logic/getHitShapeOnCanvasPointerDown'
|
|
186
189
|
export { SelectTool } from './lib/tools/SelectTool/SelectTool'
|
|
187
190
|
export { ZoomTool } from './lib/tools/ZoomTool/ZoomTool'
|
|
188
|
-
export { TldrawUi, type TldrawUiProps } from './lib/ui/TldrawUi'
|
|
189
191
|
export {
|
|
190
192
|
setDefaultUiAssetUrls,
|
|
191
193
|
type TLUiAssetUrlOverrides,
|
|
@@ -223,6 +225,11 @@ export {
|
|
|
223
225
|
type ExampleDialogProps,
|
|
224
226
|
} from './lib/ui/components/DebugMenu/DefaultDebugMenuContent'
|
|
225
227
|
export { DefaultMenuPanel } from './lib/ui/components/DefaultMenuPanel'
|
|
228
|
+
export {
|
|
229
|
+
DefaultHelperButtons,
|
|
230
|
+
type TLUiHelperButtonsProps,
|
|
231
|
+
} from './lib/ui/components/HelperButtons/DefaultHelperButtons'
|
|
232
|
+
export { DefaultHelperButtonsContent } from './lib/ui/components/HelperButtons/DefaultHelperButtonsContent'
|
|
226
233
|
export {
|
|
227
234
|
DefaultHelpMenu,
|
|
228
235
|
type TLUiHelpMenuProps,
|
|
@@ -231,11 +238,6 @@ export {
|
|
|
231
238
|
DefaultHelpMenuContent,
|
|
232
239
|
KeyboardShortcutsMenuItem,
|
|
233
240
|
} 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
241
|
export {
|
|
240
242
|
DefaultKeyboardShortcutsDialog,
|
|
241
243
|
type TLUiKeyboardShortcutsDialogProps,
|
|
@@ -251,121 +253,12 @@ export {
|
|
|
251
253
|
EditSubmenu,
|
|
252
254
|
ExportFileContentSubMenu,
|
|
253
255
|
ExtrasGroup,
|
|
256
|
+
LockGroup,
|
|
254
257
|
MiscMenuGroup,
|
|
255
258
|
PreferencesGroup,
|
|
256
259
|
UndoRedoGroup,
|
|
257
260
|
ViewSubmenu,
|
|
258
261
|
} 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
262
|
export {
|
|
370
263
|
ArrangeMenuSubmenu,
|
|
371
264
|
ClipboardMenuGroup,
|
|
@@ -394,6 +287,7 @@ export {
|
|
|
394
287
|
ToggleEdgeScrollingItem,
|
|
395
288
|
ToggleFocusModeItem,
|
|
396
289
|
ToggleGridItem,
|
|
290
|
+
ToggleKeyboardShortcutsItem,
|
|
397
291
|
ToggleLockMenuItem,
|
|
398
292
|
TogglePasteAtCursorItem,
|
|
399
293
|
ToggleReduceMotionItem,
|
|
@@ -407,6 +301,16 @@ export {
|
|
|
407
301
|
ZoomToFitMenuItem,
|
|
408
302
|
ZoomToSelectionMenuItem,
|
|
409
303
|
} from './lib/ui/components/menu-items'
|
|
304
|
+
export { DefaultMinimap } from './lib/ui/components/Minimap/DefaultMinimap'
|
|
305
|
+
export { MobileStylePanel } from './lib/ui/components/MobileStylePanel'
|
|
306
|
+
export { DefaultNavigationPanel } from './lib/ui/components/NavigationPanel/DefaultNavigationPanel'
|
|
307
|
+
export { OfflineIndicator } from './lib/ui/components/OfflineIndicator/OfflineIndicator'
|
|
308
|
+
export { DefaultPageMenu } from './lib/ui/components/PageMenu/DefaultPageMenu'
|
|
309
|
+
export { PageItemInput, type PageItemInputProps } from './lib/ui/components/PageMenu/PageItemInput'
|
|
310
|
+
export {
|
|
311
|
+
PageItemSubmenu,
|
|
312
|
+
type PageItemSubmenuProps,
|
|
313
|
+
} from './lib/ui/components/PageMenu/PageItemSubmenu'
|
|
410
314
|
export {
|
|
411
315
|
TldrawUiButton,
|
|
412
316
|
type TLUiButtonProps,
|
|
@@ -423,6 +327,27 @@ export {
|
|
|
423
327
|
TldrawUiButtonLabel,
|
|
424
328
|
type TLUiButtonLabelProps,
|
|
425
329
|
} from './lib/ui/components/primitives/Button/TldrawUiButtonLabel'
|
|
330
|
+
export {
|
|
331
|
+
TldrawUiMenuCheckboxItem,
|
|
332
|
+
type TLUiMenuCheckboxItemProps,
|
|
333
|
+
} from './lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem'
|
|
334
|
+
export {
|
|
335
|
+
TldrawUiMenuContextProvider,
|
|
336
|
+
type TLUiMenuContextProviderProps,
|
|
337
|
+
type TLUiMenuContextType,
|
|
338
|
+
} from './lib/ui/components/primitives/menus/TldrawUiMenuContext'
|
|
339
|
+
export {
|
|
340
|
+
TldrawUiMenuGroup,
|
|
341
|
+
type TLUiMenuGroupProps,
|
|
342
|
+
} from './lib/ui/components/primitives/menus/TldrawUiMenuGroup'
|
|
343
|
+
export {
|
|
344
|
+
TldrawUiMenuItem,
|
|
345
|
+
type TLUiMenuItemProps,
|
|
346
|
+
} from './lib/ui/components/primitives/menus/TldrawUiMenuItem'
|
|
347
|
+
export {
|
|
348
|
+
TldrawUiMenuSubmenu,
|
|
349
|
+
type TLUiMenuSubmenuProps,
|
|
350
|
+
} from './lib/ui/components/primitives/menus/TldrawUiMenuSubmenu'
|
|
426
351
|
export {
|
|
427
352
|
TldrawUiButtonPicker,
|
|
428
353
|
type TLUiButtonPickerProps,
|
|
@@ -461,7 +386,11 @@ export {
|
|
|
461
386
|
type TLUiDropdownMenuSubTriggerProps,
|
|
462
387
|
type TLUiDropdownMenuTriggerProps,
|
|
463
388
|
} from './lib/ui/components/primitives/TldrawUiDropdownMenu'
|
|
464
|
-
export {
|
|
389
|
+
export {
|
|
390
|
+
TldrawUiIcon,
|
|
391
|
+
type TLUiIconJsx,
|
|
392
|
+
type TLUiIconProps,
|
|
393
|
+
} from './lib/ui/components/primitives/TldrawUiIcon'
|
|
465
394
|
export { TldrawUiInput, type TLUiInputProps } from './lib/ui/components/primitives/TldrawUiInput'
|
|
466
395
|
export { TldrawUiKbd, type TLUiKbdProps } from './lib/ui/components/primitives/TldrawUiKbd'
|
|
467
396
|
export {
|
|
@@ -484,31 +413,111 @@ export {
|
|
|
484
413
|
type TLUiToolbarToggleItemProps,
|
|
485
414
|
} from './lib/ui/components/primitives/TldrawUiToolbar'
|
|
486
415
|
export {
|
|
487
|
-
|
|
488
|
-
type
|
|
489
|
-
} from './lib/ui/components/
|
|
416
|
+
DefaultQuickActions,
|
|
417
|
+
type TLUiQuickActionsProps,
|
|
418
|
+
} from './lib/ui/components/QuickActions/DefaultQuickActions'
|
|
419
|
+
export { DefaultQuickActionsContent } from './lib/ui/components/QuickActions/DefaultQuickActionsContent'
|
|
420
|
+
export { DefaultSharePanel } from './lib/ui/components/SharePanel/DefaultSharePanel'
|
|
421
|
+
export { PeopleMenu, type PeopleMenuProps } from './lib/ui/components/SharePanel/PeopleMenu'
|
|
422
|
+
export { Spinner } from './lib/ui/components/Spinner'
|
|
490
423
|
export {
|
|
491
|
-
|
|
492
|
-
type
|
|
493
|
-
|
|
494
|
-
} from './lib/ui/components/primitives/menus/TldrawUiMenuContext'
|
|
424
|
+
DefaultStylePanel,
|
|
425
|
+
type TLUiStylePanelProps,
|
|
426
|
+
} from './lib/ui/components/StylePanel/DefaultStylePanel'
|
|
495
427
|
export {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
428
|
+
ArrowheadStylePickerSet,
|
|
429
|
+
CommonStylePickerSet,
|
|
430
|
+
DefaultStylePanelContent,
|
|
431
|
+
GeoStylePickerSet,
|
|
432
|
+
OpacitySlider,
|
|
433
|
+
SplineStylePickerSet,
|
|
434
|
+
TextStylePickerSet,
|
|
435
|
+
type StylePickerSetProps,
|
|
436
|
+
type ThemeStylePickerSetProps,
|
|
437
|
+
type TLUiStylePanelContentProps,
|
|
438
|
+
} from './lib/ui/components/StylePanel/DefaultStylePanelContent'
|
|
499
439
|
export {
|
|
500
|
-
|
|
501
|
-
type
|
|
502
|
-
} from './lib/ui/components/
|
|
440
|
+
DefaultImageToolbar,
|
|
441
|
+
type TLUiImageToolbarProps,
|
|
442
|
+
} from './lib/ui/components/Toolbar/DefaultImageToolbar'
|
|
503
443
|
export {
|
|
504
|
-
|
|
505
|
-
type
|
|
506
|
-
} from './lib/ui/components/
|
|
507
|
-
export { PORTRAIT_BREAKPOINT } from './lib/ui/constants'
|
|
444
|
+
DefaultImageToolbarContent,
|
|
445
|
+
type DefaultImageToolbarContentProps,
|
|
446
|
+
} from './lib/ui/components/Toolbar/DefaultImageToolbarContent'
|
|
508
447
|
export {
|
|
509
|
-
|
|
510
|
-
type
|
|
511
|
-
} from './lib/ui/
|
|
448
|
+
DefaultRichTextToolbar,
|
|
449
|
+
type TLUiRichTextToolbarProps,
|
|
450
|
+
} from './lib/ui/components/Toolbar/DefaultRichTextToolbar'
|
|
451
|
+
export {
|
|
452
|
+
DefaultRichTextToolbarContent,
|
|
453
|
+
type DefaultRichTextToolbarContentProps,
|
|
454
|
+
} from './lib/ui/components/Toolbar/DefaultRichTextToolbarContent'
|
|
455
|
+
export {
|
|
456
|
+
DefaultToolbar,
|
|
457
|
+
type DefaultToolbarProps,
|
|
458
|
+
} from './lib/ui/components/Toolbar/DefaultToolbar'
|
|
459
|
+
export {
|
|
460
|
+
ArrowDownToolbarItem,
|
|
461
|
+
ArrowLeftToolbarItem,
|
|
462
|
+
ArrowRightToolbarItem,
|
|
463
|
+
ArrowToolbarItem,
|
|
464
|
+
ArrowUpToolbarItem,
|
|
465
|
+
AssetToolbarItem,
|
|
466
|
+
CheckBoxToolbarItem,
|
|
467
|
+
CloudToolbarItem,
|
|
468
|
+
DefaultToolbarContent,
|
|
469
|
+
DiamondToolbarItem,
|
|
470
|
+
DrawToolbarItem,
|
|
471
|
+
EllipseToolbarItem,
|
|
472
|
+
EraserToolbarItem,
|
|
473
|
+
FrameToolbarItem,
|
|
474
|
+
HandToolbarItem,
|
|
475
|
+
HeartToolbarItem,
|
|
476
|
+
HexagonToolbarItem,
|
|
477
|
+
HighlightToolbarItem,
|
|
478
|
+
LaserToolbarItem,
|
|
479
|
+
LineToolbarItem,
|
|
480
|
+
NoteToolbarItem,
|
|
481
|
+
OvalToolbarItem,
|
|
482
|
+
RectangleToolbarItem,
|
|
483
|
+
RhombusToolbarItem,
|
|
484
|
+
SelectToolbarItem,
|
|
485
|
+
StarToolbarItem,
|
|
486
|
+
TextToolbarItem,
|
|
487
|
+
ToolbarItem,
|
|
488
|
+
TrapezoidToolbarItem,
|
|
489
|
+
TriangleToolbarItem,
|
|
490
|
+
useIsToolSelected,
|
|
491
|
+
XBoxToolbarItem,
|
|
492
|
+
type ToolbarItemProps,
|
|
493
|
+
} from './lib/ui/components/Toolbar/DefaultToolbarContent'
|
|
494
|
+
export {
|
|
495
|
+
DefaultVideoToolbar,
|
|
496
|
+
type TLUiVideoToolbarProps,
|
|
497
|
+
} from './lib/ui/components/Toolbar/DefaultVideoToolbar'
|
|
498
|
+
export {
|
|
499
|
+
DefaultVideoToolbarContent,
|
|
500
|
+
type DefaultVideoToolbarContentProps,
|
|
501
|
+
} from './lib/ui/components/Toolbar/DefaultVideoToolbarContent'
|
|
502
|
+
export {
|
|
503
|
+
OverflowingToolbar,
|
|
504
|
+
type OverflowingToolbarProps,
|
|
505
|
+
} from './lib/ui/components/Toolbar/OverflowingToolbar'
|
|
506
|
+
export {
|
|
507
|
+
ToggleToolLockedButton,
|
|
508
|
+
type ToggleToolLockedButtonProps,
|
|
509
|
+
} from './lib/ui/components/Toolbar/ToggleToolLockedButton'
|
|
510
|
+
export {
|
|
511
|
+
CenteredTopPanelContainer,
|
|
512
|
+
type CenteredTopPanelContainerProps,
|
|
513
|
+
} from './lib/ui/components/TopPanel/CenteredTopPanelContainer'
|
|
514
|
+
export { DefaultTopPanel } from './lib/ui/components/TopPanel/DefaultTopPanel'
|
|
515
|
+
export {
|
|
516
|
+
DefaultZoomMenu,
|
|
517
|
+
type TLUiZoomMenuProps,
|
|
518
|
+
} from './lib/ui/components/ZoomMenu/DefaultZoomMenu'
|
|
519
|
+
export { DefaultZoomMenuContent } from './lib/ui/components/ZoomMenu/DefaultZoomMenuContent'
|
|
520
|
+
export { PORTRAIT_BREAKPOINT } from './lib/ui/constants'
|
|
512
521
|
export {
|
|
513
522
|
TldrawUiA11yProvider,
|
|
514
523
|
useA11y,
|
|
@@ -554,6 +563,10 @@ export {
|
|
|
554
563
|
type TLUiEventMap,
|
|
555
564
|
type TLUiEventSource,
|
|
556
565
|
} from './lib/ui/context/events'
|
|
566
|
+
export {
|
|
567
|
+
TldrawUiContextProvider,
|
|
568
|
+
type TLUiContextProviderProps,
|
|
569
|
+
} from './lib/ui/context/TldrawUiContextProvider'
|
|
557
570
|
export {
|
|
558
571
|
TldrawUiToastsProvider,
|
|
559
572
|
useToasts,
|
|
@@ -563,7 +576,7 @@ export {
|
|
|
563
576
|
type TLUiToastsContextType,
|
|
564
577
|
type TLUiToastsProviderProps,
|
|
565
578
|
} from './lib/ui/context/toasts'
|
|
566
|
-
export { useCanRedo, useCanUndo } from './lib/ui/hooks/menu-hooks'
|
|
579
|
+
export { useCanRedo, useCanUndo, useUnlockedSelectedShapesCount } from './lib/ui/hooks/menu-hooks'
|
|
567
580
|
export { useMenuClipboardEvents, useNativeClipboardEvents } from './lib/ui/hooks/useClipboardEvents'
|
|
568
581
|
export {
|
|
569
582
|
useCollaborationStatus,
|
|
@@ -592,6 +605,7 @@ export {
|
|
|
592
605
|
} from './lib/ui/hooks/useTranslation/useTranslation'
|
|
593
606
|
export { type TLUiIconType } from './lib/ui/icon-types'
|
|
594
607
|
export { useDefaultHelpers, type TLUiOverrideHelpers, type TLUiOverrides } from './lib/ui/overrides'
|
|
608
|
+
export { TldrawUi, type TldrawUiProps } from './lib/ui/TldrawUi'
|
|
595
609
|
export { containBoxSize, downsizeImage, type BoxWidthHeight } from './lib/utils/assets/assets'
|
|
596
610
|
export { preloadFont, type TLTypeFace } from './lib/utils/assets/preload-font'
|
|
597
611
|
export { getEmbedInfo, type TLEmbedResult } from './lib/utils/embeds/embeds'
|
|
@@ -606,8 +620,8 @@ export {
|
|
|
606
620
|
type TLEditorAssetUrls,
|
|
607
621
|
} from './lib/utils/static-assets/assetUrls'
|
|
608
622
|
export {
|
|
609
|
-
KeyboardShiftEnterTweakExtension,
|
|
610
623
|
defaultAddFontsFromNode,
|
|
624
|
+
KeyboardShiftEnterTweakExtension,
|
|
611
625
|
renderHtmlFromRichText,
|
|
612
626
|
renderHtmlFromRichTextForMeasurement,
|
|
613
627
|
renderPlaintextFromRichText,
|
|
@@ -617,6 +631,7 @@ export {
|
|
|
617
631
|
export { truncateStringWithEllipsis } from './lib/utils/text/text'
|
|
618
632
|
export { TextDirection } from './lib/utils/text/textDirection'
|
|
619
633
|
export {
|
|
634
|
+
buildFromV1Document,
|
|
620
635
|
TLV1AlignStyle,
|
|
621
636
|
TLV1AssetType,
|
|
622
637
|
TLV1ColorStyle,
|
|
@@ -625,7 +640,6 @@ export {
|
|
|
625
640
|
TLV1FontStyle,
|
|
626
641
|
TLV1ShapeType,
|
|
627
642
|
TLV1SizeStyle,
|
|
628
|
-
buildFromV1Document,
|
|
629
643
|
type TLV1ArrowBinding,
|
|
630
644
|
type TLV1ArrowShape,
|
|
631
645
|
type TLV1Asset,
|
|
@@ -653,11 +667,11 @@ export {
|
|
|
653
667
|
type TLV1VideoShape,
|
|
654
668
|
} from './lib/utils/tldr/buildFromV1Document'
|
|
655
669
|
export {
|
|
656
|
-
TLDRAW_FILE_EXTENSION,
|
|
657
670
|
parseAndLoadDocument,
|
|
658
671
|
parseTldrawJsonFile,
|
|
659
672
|
serializeTldrawJson,
|
|
660
673
|
serializeTldrawJsonBlob,
|
|
674
|
+
TLDRAW_FILE_EXTENSION,
|
|
661
675
|
type TldrawFile,
|
|
662
676
|
type TldrawFileParseError,
|
|
663
677
|
} from './lib/utils/tldr/file'
|
package/src/lib/TldrawImage.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { memo, useEffect, useLayoutEffect, useMemo, useState } from 'react'
|
|
|
15
15
|
import { defaultBindingUtils } from './defaultBindingUtils'
|
|
16
16
|
import { defaultShapeUtils } from './defaultShapeUtils'
|
|
17
17
|
import { TLUiAssetUrlOverrides } from './ui/assetUrls'
|
|
18
|
+
import { useDefaultEditorAssetsWithOverrides } from './utils/static-assets/assetUrls'
|
|
18
19
|
import { defaultAddFontsFromNode, tipTapDefaultExtensions } from './utils/text/richText'
|
|
19
20
|
|
|
20
21
|
/** @public */
|
|
@@ -111,6 +112,7 @@ export const TldrawImage = memo(function TldrawImage(props: TldrawImageProps) {
|
|
|
111
112
|
assetUrls,
|
|
112
113
|
textOptions = defaultTextOptions,
|
|
113
114
|
} = props
|
|
115
|
+
const assetUrlsWithOverrides = useDefaultEditorAssetsWithOverrides(assetUrls)
|
|
114
116
|
|
|
115
117
|
useLayoutEffect(() => {
|
|
116
118
|
if (!container) return
|
|
@@ -129,7 +131,7 @@ export const TldrawImage = memo(function TldrawImage(props: TldrawImageProps) {
|
|
|
129
131
|
tools: [],
|
|
130
132
|
getContainer: () => tempElm,
|
|
131
133
|
licenseKey,
|
|
132
|
-
fontAssetUrls:
|
|
134
|
+
fontAssetUrls: assetUrlsWithOverrides.fonts,
|
|
133
135
|
textOptions,
|
|
134
136
|
})
|
|
135
137
|
|
|
@@ -138,6 +140,8 @@ export const TldrawImage = memo(function TldrawImage(props: TldrawImageProps) {
|
|
|
138
140
|
const shapeIds = editor.getCurrentPageShapeIds()
|
|
139
141
|
|
|
140
142
|
async function setSvg() {
|
|
143
|
+
// We have to wait for the fonts to load so that we can correctly measure text sizes
|
|
144
|
+
await editor.fonts.loadRequiredFontsForCurrentPage(editor.options.maxFontsToLoadBeforeRender)
|
|
141
145
|
const imageResult = await editor.toImage([...shapeIds], {
|
|
142
146
|
bounds,
|
|
143
147
|
scale,
|
|
@@ -175,7 +179,7 @@ export const TldrawImage = memo(function TldrawImage(props: TldrawImageProps) {
|
|
|
175
179
|
preserveAspectRatio,
|
|
176
180
|
licenseKey,
|
|
177
181
|
pixelRatio,
|
|
178
|
-
|
|
182
|
+
assetUrlsWithOverrides,
|
|
179
183
|
textOptions,
|
|
180
184
|
])
|
|
181
185
|
|
|
@@ -2,6 +2,7 @@ import { toDomPrecision } from '@tldraw/editor'
|
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { useTranslation } from '../ui/hooks/useTranslation/useTranslation'
|
|
4
4
|
|
|
5
|
+
/** @public */
|
|
5
6
|
export interface TldrawCropHandlesProps {
|
|
6
7
|
size: number
|
|
7
8
|
width: number
|
|
@@ -9,6 +10,7 @@ export interface TldrawCropHandlesProps {
|
|
|
9
10
|
hideAlternateHandles: boolean
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
/** @public @react */
|
|
12
14
|
export function TldrawCropHandles({
|
|
13
15
|
size,
|
|
14
16
|
width,
|
|
@@ -20,7 +22,7 @@ export function TldrawCropHandles({
|
|
|
20
22
|
const msg = useTranslation()
|
|
21
23
|
|
|
22
24
|
return (
|
|
23
|
-
<svg className="tl-overlays__item">
|
|
25
|
+
<svg className="tl-overlays__item" aria-hidden="true">
|
|
24
26
|
{/* Top left */}
|
|
25
27
|
<polyline
|
|
26
28
|
className="tl-corner-crop-handle"
|
|
@@ -23,5 +23,9 @@ export function TldrawHandles({ children }: TLHandlesProps) {
|
|
|
23
23
|
|
|
24
24
|
if (!shouldDisplayHandles) return null
|
|
25
25
|
|
|
26
|
-
return
|
|
26
|
+
return (
|
|
27
|
+
<svg className="tl-user-handles tl-overlays__item" aria-hidden="true">
|
|
28
|
+
{children}
|
|
29
|
+
</svg>
|
|
30
|
+
)
|
|
27
31
|
}
|
|
@@ -60,7 +60,7 @@ export function TldrawArrowHints() {
|
|
|
60
60
|
{ShapeIndicator && <ShapeIndicator shapeId={targetInfo.target.id} />}
|
|
61
61
|
|
|
62
62
|
{showEdgeHints && (
|
|
63
|
-
<svg className="tl-overlays__item">
|
|
63
|
+
<svg className="tl-overlays__item" aria-hidden="true">
|
|
64
64
|
<circle
|
|
65
65
|
cx={anchorInPageSpace.x}
|
|
66
66
|
cy={anchorInPageSpace.y}
|
|
@@ -192,7 +192,11 @@ export const TldrawSelectionForeground = track(function TldrawSelectionForegroun
|
|
|
192
192
|
textHandleHeight * zoom >= 4
|
|
193
193
|
|
|
194
194
|
return (
|
|
195
|
-
<svg
|
|
195
|
+
<svg
|
|
196
|
+
className="tl-overlays__item tl-selection__fg"
|
|
197
|
+
data-testid="selection-foreground"
|
|
198
|
+
aria-hidden="true"
|
|
199
|
+
>
|
|
196
200
|
<g ref={rSvg}>
|
|
197
201
|
{shouldDisplayBox && (
|
|
198
202
|
<rect
|
|
@@ -915,7 +915,8 @@ function runFileChecks(file: File, options: TLDefaultExternalContentHandlerOpts)
|
|
|
915
915
|
return true
|
|
916
916
|
}
|
|
917
917
|
|
|
918
|
-
|
|
918
|
+
/** @public */
|
|
919
|
+
export async function getAssetInfo(
|
|
919
920
|
file: File,
|
|
920
921
|
options: TLDefaultExternalContentHandlerOpts,
|
|
921
922
|
assetId?: TLAssetId
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HALF_PI, TLArrowShape, TLShapeId, createShapeId } from '@tldraw/editor'
|
|
1
|
+
import { HALF_PI, TLArrowShape, TLShapeId, createShapeId, toRichText } from '@tldraw/editor'
|
|
2
2
|
import { TestEditor } from '../../../test/TestEditor'
|
|
3
3
|
import { createOrUpdateArrowBinding, getArrowBindings } from './shared'
|
|
4
4
|
|
|
@@ -333,7 +333,7 @@ describe('Arrow labels', () => {
|
|
|
333
333
|
editor.setCurrentTool('arrow').pointerDown(10, 10).pointerMove(100, 100).pointerUp()
|
|
334
334
|
const arrowId = editor.getOnlySelectedShape()!.id
|
|
335
335
|
editor.updateShapes<TLArrowShape>([
|
|
336
|
-
{ id: arrowId, type: 'arrow', props: {
|
|
336
|
+
{ id: arrowId, type: 'arrow', props: { richText: toRichText('Test Label') } },
|
|
337
337
|
])
|
|
338
338
|
})
|
|
339
339
|
|
|
@@ -341,7 +341,7 @@ describe('Arrow labels', () => {
|
|
|
341
341
|
const arrowId = editor.getOnlySelectedShape()!.id
|
|
342
342
|
expect(arrow(arrowId)).toMatchObject({
|
|
343
343
|
props: {
|
|
344
|
-
|
|
344
|
+
richText: toRichText('Test Label'),
|
|
345
345
|
},
|
|
346
346
|
})
|
|
347
347
|
})
|
|
@@ -349,11 +349,11 @@ describe('Arrow labels', () => {
|
|
|
349
349
|
it('should update the label of an arrow', () => {
|
|
350
350
|
const arrowId = editor.getOnlySelectedShape()!.id
|
|
351
351
|
editor.updateShapes<TLArrowShape>([
|
|
352
|
-
{ id: arrowId, type: 'arrow', props: {
|
|
352
|
+
{ id: arrowId, type: 'arrow', props: { richText: toRichText('New Label') } },
|
|
353
353
|
])
|
|
354
354
|
expect(arrow(arrowId)).toMatchObject({
|
|
355
355
|
props: {
|
|
356
|
-
|
|
356
|
+
richText: toRichText('New Label'),
|
|
357
357
|
},
|
|
358
358
|
})
|
|
359
359
|
})
|