tldraw 3.16.0-canary.f56a36d13420 → 3.16.0-canary.f5bf2b535ea7
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 +223 -109
- package/dist-cjs/index.js +29 -14
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +10 -0
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrow-types.js.map +1 -1
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js +6 -0
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +3 -3
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +3 -2
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +1 -1
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js +4 -4
- package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +2 -1
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js +8 -2
- package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +1 -0
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +2 -1
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/HyperlinkButton.js +4 -4
- package/dist-cjs/lib/shapes/shared/HyperlinkButton.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +1 -3
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/useEditablePlainText.js +3 -5
- package/dist-cjs/lib/shapes/shared/useEditablePlainText.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/useImageOrVideoAsset.js +0 -2
- package/dist-cjs/lib/shapes/shared/useImageOrVideoAsset.js.map +2 -2
- package/dist-cjs/lib/shapes/text/PlainTextArea.js +3 -2
- package/dist-cjs/lib/shapes/text/PlainTextArea.js.map +2 -2
- package/dist-cjs/lib/shapes/text/RichTextArea.js +3 -3
- package/dist-cjs/lib/shapes/text/RichTextArea.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +3 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/ui/components/A11y.js +1 -1
- package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
- package/dist-cjs/lib/ui/components/LanguageMenu.js +1 -0
- package/dist-cjs/lib/ui/components/LanguageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/Minimap/DefaultMinimap.js +2 -1
- package/dist-cjs/lib/ui/components/Minimap/DefaultMinimap.js.map +2 -2
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +1 -1
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +9 -4
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +255 -316
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js +147 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js.map +7 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelContext.js +68 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelContext.js.map +7 -0
- package/dist-cjs/lib/ui/components/StylePanel/{DoubleDropdownPicker.js → StylePanelDoubleDropdownPicker.js} +23 -22
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.js.map +7 -0
- package/dist-cjs/lib/ui/components/StylePanel/{DropdownPicker.js → StylePanelDropdownPicker.js} +23 -20
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelDropdownPicker.js.map +7 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelSubheading.js +28 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelSubheading.js.map +7 -0
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js +2 -0
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js +38 -9
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultVideoToolbarContent.js +15 -3
- package/dist-cjs/lib/ui/components/Toolbar/DefaultVideoToolbarContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js +2 -1
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +1 -1
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +6 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +11 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js +5 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +18 -5
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +3 -0
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +47 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js +3 -0
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +8 -8
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +13 -8
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +1 -1
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useExportAs.js +3 -2
- package/dist-cjs/lib/ui/hooks/useExportAs.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.js +1 -1
- 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 +5 -2
- 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-cjs/lib/utils/export/copyAs.js +1 -2
- package/dist-cjs/lib/utils/export/copyAs.js.map +2 -2
- package/dist-cjs/lib/utils/export/export.js +0 -20
- package/dist-cjs/lib/utils/export/export.js.map +2 -2
- package/dist-cjs/lib/utils/export/exportAs.js +1 -2
- package/dist-cjs/lib/utils/export/exportAs.js.map +2 -2
- package/dist-esm/index.d.mts +223 -109
- package/dist-esm/index.mjs +59 -28
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +10 -0
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +6 -0
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +3 -3
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +3 -2
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +1 -1
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs +4 -5
- package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +2 -1
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs +9 -3
- package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +1 -0
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +2 -1
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs +5 -5
- package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +1 -3
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs +3 -6
- package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/useImageOrVideoAsset.mjs +0 -2
- package/dist-esm/lib/shapes/shared/useImageOrVideoAsset.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/PlainTextArea.mjs +4 -3
- package/dist-esm/lib/shapes/text/PlainTextArea.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/RichTextArea.mjs +3 -4
- package/dist-esm/lib/shapes/text/RichTextArea.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +3 -1
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/ui/components/A11y.mjs +1 -2
- package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
- package/dist-esm/lib/ui/components/LanguageMenu.mjs +1 -0
- package/dist-esm/lib/ui/components/LanguageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs +2 -1
- package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs.map +2 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +1 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +14 -5
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +257 -320
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs +135 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs.map +7 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelContext.mjs +48 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelContext.mjs.map +7 -0
- package/dist-esm/lib/ui/components/StylePanel/{DoubleDropdownPicker.mjs → StylePanelDoubleDropdownPicker.mjs} +20 -19
- package/dist-esm/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.mjs.map +7 -0
- package/dist-esm/lib/ui/components/StylePanel/{DropdownPicker.mjs → StylePanelDropdownPicker.mjs} +20 -17
- package/dist-esm/lib/ui/components/StylePanel/StylePanelDropdownPicker.mjs.map +7 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelSubheading.mjs +8 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelSubheading.mjs.map +7 -0
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs +2 -0
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs +38 -9
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultVideoToolbarContent.mjs +15 -3
- package/dist-esm/lib/ui/components/Toolbar/DefaultVideoToolbarContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +2 -1
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +1 -1
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +6 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +11 -3
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs +6 -4
- package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +18 -5
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +3 -0
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +48 -3
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs +3 -0
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +8 -8
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +13 -8
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +1 -2
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useExportAs.mjs +3 -2
- package/dist-esm/lib/ui/hooks/useExportAs.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs +1 -1
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +5 -2
- 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/dist-esm/lib/utils/export/copyAs.mjs +1 -2
- package/dist-esm/lib/utils/export/copyAs.mjs.map +2 -2
- package/dist-esm/lib/utils/export/export.mjs +0 -20
- package/dist-esm/lib/utils/export/export.mjs.map +2 -2
- package/dist-esm/lib/utils/export/exportAs.mjs +1 -2
- package/dist-esm/lib/utils/export/exportAs.mjs.map +2 -2
- package/package.json +3 -3
- package/src/index.ts +45 -21
- package/src/lib/defaultExternalContentHandlers.ts +14 -0
- package/src/lib/shapes/arrow/ArrowShapeOptions.test.ts +83 -13
- package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +99 -5
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +41 -0
- package/src/lib/shapes/arrow/arrow-types.ts +3 -5
- package/src/lib/shapes/arrow/arrowLabel.ts +8 -0
- package/src/lib/shapes/arrow/arrowTargetState.ts +34 -3
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +1 -1
- package/src/lib/shapes/bookmark/BookmarkShapeUtil.tsx +4 -5
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +1 -0
- package/src/lib/shapes/frame/components/FrameLabelInput.tsx +10 -3
- package/src/lib/shapes/geo/GeoShapeUtil.tsx +1 -0
- package/src/lib/shapes/note/NoteShapeUtil.tsx +1 -0
- package/src/lib/shapes/shared/HyperlinkButton.tsx +5 -5
- package/src/lib/shapes/shared/PlainTextLabel.tsx +0 -6
- package/src/lib/shapes/shared/useEditablePlainText.ts +3 -10
- package/src/lib/shapes/shared/useImageOrVideoAsset.ts +0 -7
- package/src/lib/shapes/text/PlainTextArea.tsx +4 -3
- package/src/lib/shapes/text/RichTextArea.tsx +3 -4
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +6 -2
- package/src/lib/ui/components/A11y.tsx +1 -2
- package/src/lib/ui/components/LanguageMenu.tsx +1 -0
- package/src/lib/ui/components/Minimap/DefaultMinimap.tsx +2 -1
- package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +1 -2
- package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +27 -13
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +260 -381
- package/src/lib/ui/components/{primitives/TldrawUiButtonPicker.tsx → StylePanel/StylePanelButtonPicker.tsx} +70 -50
- package/src/lib/ui/components/StylePanel/StylePanelContext.tsx +63 -0
- package/src/lib/ui/components/StylePanel/{DoubleDropdownPicker.tsx → StylePanelDoubleDropdownPicker.tsx} +28 -19
- package/src/lib/ui/components/StylePanel/StylePanelDropdownPicker.tsx +119 -0
- package/src/lib/ui/components/StylePanel/StylePanelSubheading.tsx +9 -0
- package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +2 -0
- package/src/lib/ui/components/Toolbar/DefaultImageToolbarContent.tsx +32 -15
- package/src/lib/ui/components/Toolbar/DefaultVideoToolbarContent.tsx +12 -4
- package/src/lib/ui/components/Toolbar/LinkEditor.tsx +1 -0
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +1 -1
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +9 -2
- package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +7 -3
- package/src/lib/ui/components/primitives/TldrawUiInput.tsx +6 -3
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +52 -32
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +5 -1
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +67 -13
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +4 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +9 -9
- package/src/lib/ui/context/actions.tsx +20 -8
- package/src/lib/ui/hooks/useClipboardEvents.ts +1 -2
- package/src/lib/ui/hooks/useExportAs.ts +3 -2
- package/src/lib/ui/hooks/useTools.tsx +1 -1
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +3 -0
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +5 -2
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +40 -3
- package/src/lib/utils/export/copyAs.ts +1 -24
- package/src/lib/utils/export/export.ts +0 -36
- package/src/lib/utils/export/exportAs.ts +1 -32
- package/src/test/TestEditor.ts +8 -2
- package/src/test/frames.test.ts +15 -0
- package/src/test/getCulledShapes.test.tsx +71 -2
- package/tldraw.css +48 -6
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js.map +0 -7
- package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js.map +0 -7
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +0 -131
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +0 -7
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs.map +0 -7
- package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs.map +0 -7
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +0 -115
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +0 -7
- package/src/lib/ui/components/StylePanel/DropdownPicker.tsx +0 -110
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
clamp,
|
|
5
5
|
Editor,
|
|
6
6
|
react,
|
|
7
|
-
stopEventPropagation,
|
|
8
7
|
useAtom,
|
|
9
8
|
useEditor,
|
|
10
9
|
usePassThroughMouseOverEvents,
|
|
@@ -170,9 +169,14 @@ export const TldrawUiContextualToolbar = ({
|
|
|
170
169
|
data-visible={false}
|
|
171
170
|
data-testid="contextual-toolbar"
|
|
172
171
|
className={classNames('tlui-contextual-toolbar', className)}
|
|
173
|
-
onPointerDown={
|
|
172
|
+
onPointerDown={editor.markEventAsHandled}
|
|
174
173
|
>
|
|
175
|
-
<TldrawUiToolbar
|
|
174
|
+
<TldrawUiToolbar
|
|
175
|
+
orientation="horizontal"
|
|
176
|
+
className="tlui-menu"
|
|
177
|
+
label={label}
|
|
178
|
+
tooltipSide="top"
|
|
179
|
+
>
|
|
176
180
|
{children}
|
|
177
181
|
</TldrawUiToolbar>
|
|
178
182
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { tlenv, tltime, useMaybeEditor } from '@tldraw/editor'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import * as React from 'react'
|
|
4
4
|
import { TLUiTranslationKey } from '../../hooks/useTranslation/TLUiTranslationKey'
|
|
@@ -35,6 +35,7 @@ export interface TLUiInputProps {
|
|
|
35
35
|
shouldManuallyMaintainScrollPositionWhenFocused?: boolean
|
|
36
36
|
value?: string
|
|
37
37
|
'data-testid'?: string
|
|
38
|
+
'aria-label'?: string
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
/** @public @react */
|
|
@@ -60,6 +61,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
|
|
|
60
61
|
value,
|
|
61
62
|
'data-testid': dataTestId,
|
|
62
63
|
disabled,
|
|
64
|
+
'aria-label': ariaLabel,
|
|
63
65
|
},
|
|
64
66
|
ref
|
|
65
67
|
) {
|
|
@@ -118,7 +120,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
|
|
|
118
120
|
// `onChange` with a duplicated text value.
|
|
119
121
|
if (isComposing.current) return
|
|
120
122
|
e.currentTarget.blur()
|
|
121
|
-
|
|
123
|
+
e.stopPropagation()
|
|
122
124
|
onComplete?.(e.currentTarget.value)
|
|
123
125
|
break
|
|
124
126
|
}
|
|
@@ -126,7 +128,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
|
|
|
126
128
|
e.currentTarget.value = rInitialValue.current
|
|
127
129
|
onCancel?.(e.currentTarget.value)
|
|
128
130
|
e.currentTarget.blur()
|
|
129
|
-
|
|
131
|
+
e.stopPropagation()
|
|
130
132
|
break
|
|
131
133
|
}
|
|
132
134
|
}
|
|
@@ -198,6 +200,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
|
|
|
198
200
|
onCompositionStart={handleCompositionStart}
|
|
199
201
|
onCompositionEnd={handleCompositionEnd}
|
|
200
202
|
autoFocus={autoFocus}
|
|
203
|
+
aria-label={ariaLabel}
|
|
201
204
|
placeholder={placeholder}
|
|
202
205
|
value={value}
|
|
203
206
|
data-testid={dataTestId}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { tltime } from '@tldraw/editor'
|
|
1
2
|
import { Slider as _Slider } from 'radix-ui'
|
|
2
3
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
3
4
|
import { TLUiTranslationKey } from '../../hooks/useTranslation/TLUiTranslationKey'
|
|
4
5
|
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
6
|
+
import { TldrawUiTooltip, tooltipManager } from './TldrawUiTooltip'
|
|
5
7
|
|
|
6
8
|
/** @public */
|
|
7
9
|
export interface TLUiSliderProps {
|
|
@@ -11,7 +13,7 @@ export interface TLUiSliderProps {
|
|
|
11
13
|
label: string
|
|
12
14
|
title: string
|
|
13
15
|
onValueChange(value: number): void
|
|
14
|
-
onHistoryMark(id: string): void
|
|
16
|
+
onHistoryMark?(id: string): void
|
|
15
17
|
'data-testid'?: string
|
|
16
18
|
ariaValueModifier?: number
|
|
17
19
|
}
|
|
@@ -32,6 +34,7 @@ export const TldrawUiSlider = React.forwardRef<HTMLDivElement, TLUiSliderProps>(
|
|
|
32
34
|
ref
|
|
33
35
|
) {
|
|
34
36
|
const msg = useTranslation()
|
|
37
|
+
const [titleAndLabel, setTitleAndLabel] = useState('')
|
|
35
38
|
|
|
36
39
|
// XXX: Radix starts out our slider with a tabIndex of 0
|
|
37
40
|
// This causes some tab focusing issues, most prevelant in MobileStylePanel,
|
|
@@ -49,9 +52,25 @@ export const TldrawUiSlider = React.forwardRef<HTMLDivElement, TLUiSliderProps>(
|
|
|
49
52
|
)
|
|
50
53
|
|
|
51
54
|
const handlePointerDown = useCallback(() => {
|
|
52
|
-
|
|
55
|
+
tooltipManager.hideAllTooltips()
|
|
56
|
+
onHistoryMark?.('click slider')
|
|
53
57
|
}, [onHistoryMark])
|
|
54
58
|
|
|
59
|
+
// N.B. This is a bit silly. The Radix slider auto-focuses which
|
|
60
|
+
// triggers TldrawUiTooltip handleFocus when we dbl-click to edit an image,
|
|
61
|
+
// which in turn makes the tooltip display prematurely.
|
|
62
|
+
// This makes it wait until we've focused to show the tooltip.
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const timeout = tltime.setTimeout(
|
|
65
|
+
'set title and label',
|
|
66
|
+
() => {
|
|
67
|
+
setTitleAndLabel(title + ' — ' + msg(label as TLUiTranslationKey))
|
|
68
|
+
},
|
|
69
|
+
0
|
|
70
|
+
)
|
|
71
|
+
return () => clearTimeout(timeout)
|
|
72
|
+
}, [label, msg, title])
|
|
73
|
+
|
|
55
74
|
// N.B. Annoying. For a11y purposes, we need Tab to work.
|
|
56
75
|
// For some reason, Radix has some custom behavior here
|
|
57
76
|
// that interferes with tabbing past the slider and then
|
|
@@ -64,36 +83,37 @@ export const TldrawUiSlider = React.forwardRef<HTMLDivElement, TLUiSliderProps>(
|
|
|
64
83
|
|
|
65
84
|
return (
|
|
66
85
|
<div className="tlui-slider__container">
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
<TldrawUiTooltip content={titleAndLabel}>
|
|
87
|
+
<_Slider.Root
|
|
88
|
+
data-testid={testId}
|
|
89
|
+
className="tlui-slider"
|
|
90
|
+
dir="ltr"
|
|
91
|
+
min={min ?? 0}
|
|
92
|
+
max={steps}
|
|
93
|
+
step={1}
|
|
94
|
+
value={value !== null ? [value] : undefined}
|
|
95
|
+
onPointerDown={handlePointerDown}
|
|
96
|
+
onValueChange={handleValueChange}
|
|
97
|
+
onKeyDownCapture={handleKeyEvent}
|
|
98
|
+
onKeyUpCapture={handleKeyEvent}
|
|
99
|
+
>
|
|
100
|
+
<_Slider.Track className="tlui-slider__track" dir="ltr">
|
|
101
|
+
{value !== null && <_Slider.Range className="tlui-slider__range" dir="ltr" />}
|
|
102
|
+
</_Slider.Track>
|
|
103
|
+
{value !== null && (
|
|
104
|
+
<_Slider.Thumb
|
|
105
|
+
aria-valuemin={(min ?? 0) * ariaValueModifier}
|
|
106
|
+
aria-valuenow={value * ariaValueModifier}
|
|
107
|
+
aria-valuemax={steps * ariaValueModifier}
|
|
108
|
+
aria-label={titleAndLabel}
|
|
109
|
+
className="tlui-slider__thumb"
|
|
110
|
+
dir="ltr"
|
|
111
|
+
ref={ref}
|
|
112
|
+
tabIndex={tabIndex}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
</_Slider.Root>
|
|
116
|
+
</TldrawUiTooltip>
|
|
97
117
|
</div>
|
|
98
118
|
)
|
|
99
119
|
})
|
|
@@ -71,6 +71,7 @@ export const TldrawUiToolbarButton = React.forwardRef<HTMLButtonElement, TLUiToo
|
|
|
71
71
|
draggable={false}
|
|
72
72
|
data-isactive={isActive}
|
|
73
73
|
{...props}
|
|
74
|
+
aria-label={props.title}
|
|
74
75
|
// The tooltip takes care of this.
|
|
75
76
|
title={undefined}
|
|
76
77
|
className={classnames('tlui-button', `tlui-button__${type}`, props.className)}
|
|
@@ -94,6 +95,7 @@ export interface TLUiToolbarToggleGroupProps extends React.HTMLAttributes<HTMLDi
|
|
|
94
95
|
// TODO: fix up this type later
|
|
95
96
|
defaultValue?: any
|
|
96
97
|
type: 'single' | 'multiple'
|
|
98
|
+
asChild?: boolean
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
/** @public @react */
|
|
@@ -101,10 +103,12 @@ export const TldrawUiToolbarToggleGroup = ({
|
|
|
101
103
|
children,
|
|
102
104
|
className,
|
|
103
105
|
type,
|
|
106
|
+
asChild,
|
|
104
107
|
...props
|
|
105
108
|
}: TLUiToolbarToggleGroupProps) => {
|
|
106
109
|
return (
|
|
107
110
|
<_Toolbar.ToggleGroup
|
|
111
|
+
asChild={asChild}
|
|
108
112
|
type={type}
|
|
109
113
|
{...props}
|
|
110
114
|
// TODO: this fixes a bug in Radix until they fix it.
|
|
@@ -124,7 +128,7 @@ export interface TLUiToolbarToggleItemProps extends React.HTMLAttributes<HTMLBut
|
|
|
124
128
|
className?: string
|
|
125
129
|
type: 'icon' | 'tool'
|
|
126
130
|
value: string
|
|
127
|
-
tooltip?:
|
|
131
|
+
tooltip?: React.ReactNode
|
|
128
132
|
}
|
|
129
133
|
|
|
130
134
|
/** @public @react */
|
|
@@ -6,6 +6,7 @@ import React, {
|
|
|
6
6
|
ReactNode,
|
|
7
7
|
useContext,
|
|
8
8
|
useEffect,
|
|
9
|
+
useLayoutEffect,
|
|
9
10
|
useRef,
|
|
10
11
|
useState,
|
|
11
12
|
} from 'react'
|
|
@@ -24,18 +25,20 @@ export interface TldrawUiTooltipProps {
|
|
|
24
25
|
delayDuration?: number
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
interface CurrentTooltip {
|
|
29
|
+
id: string
|
|
30
|
+
content: ReactNode
|
|
31
|
+
side: 'top' | 'right' | 'bottom' | 'left'
|
|
32
|
+
sideOffset: number
|
|
33
|
+
showOnMobile: boolean
|
|
34
|
+
targetElement: HTMLElement
|
|
35
|
+
delayDuration: number
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
// Singleton tooltip manager
|
|
28
39
|
class TooltipManager {
|
|
29
40
|
private static instance: TooltipManager | null = null
|
|
30
|
-
private currentTooltip = atom<
|
|
31
|
-
id: string
|
|
32
|
-
content: ReactNode
|
|
33
|
-
side: 'top' | 'right' | 'bottom' | 'left'
|
|
34
|
-
sideOffset: number
|
|
35
|
-
showOnMobile: boolean
|
|
36
|
-
targetElement: HTMLElement
|
|
37
|
-
delayDuration: number
|
|
38
|
-
} | null>('current tooltip', null)
|
|
41
|
+
private currentTooltip = atom<CurrentTooltip | null>('current tooltip', null)
|
|
39
42
|
private destroyTimeoutId: number | null = null
|
|
40
43
|
|
|
41
44
|
static getInstance(): TooltipManager {
|
|
@@ -72,6 +75,15 @@ class TooltipManager {
|
|
|
72
75
|
})
|
|
73
76
|
}
|
|
74
77
|
|
|
78
|
+
updateCurrentTooltip(tooltipId: string, update: (tooltip: CurrentTooltip) => CurrentTooltip) {
|
|
79
|
+
this.currentTooltip.update((tooltip) => {
|
|
80
|
+
if (tooltip?.id === tooltipId) {
|
|
81
|
+
return update(tooltip)
|
|
82
|
+
}
|
|
83
|
+
return tooltip
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
75
87
|
hideTooltip(editor: Editor | null, tooltipId: string, instant: boolean = false) {
|
|
76
88
|
const hide = () => {
|
|
77
89
|
// Only hide if this is the current tooltip
|
|
@@ -142,6 +154,7 @@ function TooltipSingleton() {
|
|
|
142
154
|
const [isOpen, setIsOpen] = useState(false)
|
|
143
155
|
const triggerRef = useRef<HTMLDivElement>(null)
|
|
144
156
|
const isFirstShowRef = useRef(true)
|
|
157
|
+
const editor = useMaybeEditor()
|
|
145
158
|
|
|
146
159
|
const currentTooltip = useValue(
|
|
147
160
|
'current tooltip',
|
|
@@ -149,6 +162,29 @@ function TooltipSingleton() {
|
|
|
149
162
|
[]
|
|
150
163
|
)
|
|
151
164
|
|
|
165
|
+
const cameraState = useValue('camera state', () => editor?.getCameraState(), [editor])
|
|
166
|
+
|
|
167
|
+
// Hide tooltip when camera is moving (panning/zooming)
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if (cameraState === 'moving' && isOpen && currentTooltip) {
|
|
170
|
+
tooltipManager.hideTooltip(editor, currentTooltip.id, true)
|
|
171
|
+
}
|
|
172
|
+
}, [cameraState, isOpen, currentTooltip, editor])
|
|
173
|
+
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
176
|
+
if (event.key === 'Escape' && currentTooltip && isOpen) {
|
|
177
|
+
tooltipManager.hideTooltip(editor, currentTooltip.id)
|
|
178
|
+
event.stopPropagation()
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
document.addEventListener('keydown', handleKeyDown, { capture: true })
|
|
183
|
+
return () => {
|
|
184
|
+
document.removeEventListener('keydown', handleKeyDown, { capture: true })
|
|
185
|
+
}
|
|
186
|
+
}, [editor, currentTooltip, isOpen])
|
|
187
|
+
|
|
152
188
|
// Update open state and trigger position
|
|
153
189
|
useEffect(() => {
|
|
154
190
|
let timer: ReturnType<typeof setTimeout> | null = null
|
|
@@ -231,6 +267,7 @@ export const TldrawUiTooltip = forwardRef<HTMLButtonElement, TldrawUiTooltipProp
|
|
|
231
267
|
const editor = useMaybeEditor()
|
|
232
268
|
const tooltipId = useRef<string>(uniqueId())
|
|
233
269
|
const hasProvider = useContext(TooltipSingletonContext)
|
|
270
|
+
const showUiLabels = useValue('showUiLabels', () => editor?.user.getShowUiLabels(), [editor])
|
|
234
271
|
|
|
235
272
|
const orientationCtx = useTldrawUiOrientation()
|
|
236
273
|
const sideToUse = side ?? orientationCtx.tooltipSide
|
|
@@ -244,18 +281,35 @@ export const TldrawUiTooltip = forwardRef<HTMLButtonElement, TldrawUiTooltipProp
|
|
|
244
281
|
}
|
|
245
282
|
}, [editor, hasProvider])
|
|
246
283
|
|
|
284
|
+
useLayoutEffect(() => {
|
|
285
|
+
if (hasProvider && tooltipManager.getCurrentTooltipData()?.id === tooltipId.current) {
|
|
286
|
+
tooltipManager.updateCurrentTooltip(tooltipId.current, (tooltip) => ({
|
|
287
|
+
...tooltip,
|
|
288
|
+
content,
|
|
289
|
+
side: sideToUse,
|
|
290
|
+
sideOffset,
|
|
291
|
+
showOnMobile,
|
|
292
|
+
}))
|
|
293
|
+
}
|
|
294
|
+
}, [content, sideToUse, sideOffset, showOnMobile, hasProvider])
|
|
295
|
+
|
|
247
296
|
// Don't show tooltip if disabled, no content, or UI labels are disabled
|
|
248
297
|
if (disabled || !content) {
|
|
249
298
|
return <>{children}</>
|
|
250
299
|
}
|
|
251
300
|
|
|
252
|
-
|
|
253
|
-
|
|
301
|
+
let delayDurationToUse
|
|
302
|
+
if (showUiLabels) {
|
|
303
|
+
delayDurationToUse = 0
|
|
304
|
+
} else {
|
|
305
|
+
delayDurationToUse =
|
|
306
|
+
delayDuration ?? (editor?.options.tooltipDelayMs || DEFAULT_TOOLTIP_DELAY_MS)
|
|
307
|
+
}
|
|
254
308
|
|
|
255
309
|
// Fallback to old behavior if no provider
|
|
256
|
-
if (!hasProvider) {
|
|
310
|
+
if (!hasProvider || showUiLabels) {
|
|
257
311
|
return (
|
|
258
|
-
<_Tooltip.Root delayDuration={delayDurationToUse} disableHoverableContent>
|
|
312
|
+
<_Tooltip.Root delayDuration={delayDurationToUse} disableHoverableContent={!showUiLabels}>
|
|
259
313
|
<_Tooltip.Trigger asChild ref={ref}>
|
|
260
314
|
{children}
|
|
261
315
|
</_Tooltip.Trigger>
|
|
@@ -19,6 +19,7 @@ export interface TLUiMenuCheckboxItemProps<
|
|
|
19
19
|
kbd?: string
|
|
20
20
|
title?: string
|
|
21
21
|
label?: TranslationKey | { [key: string]: TranslationKey }
|
|
22
|
+
lang?: string
|
|
22
23
|
readonlyOk?: boolean
|
|
23
24
|
onSelect(source: TLUiEventSource): Promise<void> | void
|
|
24
25
|
toggle?: boolean
|
|
@@ -34,6 +35,7 @@ export function TldrawUiMenuCheckboxItem<
|
|
|
34
35
|
id,
|
|
35
36
|
kbd,
|
|
36
37
|
label,
|
|
38
|
+
lang,
|
|
37
39
|
readonlyOk,
|
|
38
40
|
onSelect,
|
|
39
41
|
toggle = false,
|
|
@@ -55,6 +57,7 @@ export function TldrawUiMenuCheckboxItem<
|
|
|
55
57
|
return (
|
|
56
58
|
<_DropdownMenu.CheckboxItem
|
|
57
59
|
dir="ltr"
|
|
60
|
+
lang={lang}
|
|
58
61
|
className="tlui-button tlui-button__menu tlui-button__checkbox"
|
|
59
62
|
title={labelStr}
|
|
60
63
|
onSelect={(e) => {
|
|
@@ -84,6 +87,7 @@ export function TldrawUiMenuCheckboxItem<
|
|
|
84
87
|
key={id}
|
|
85
88
|
className="tlui-button tlui-button__menu tlui-button__checkbox"
|
|
86
89
|
dir="ltr"
|
|
90
|
+
lang={lang}
|
|
87
91
|
title={labelStr}
|
|
88
92
|
onSelect={(e) => {
|
|
89
93
|
onSelect(sourceId)
|
|
@@ -213,7 +213,7 @@ export function TldrawUiMenuItem<
|
|
|
213
213
|
icon={icon}
|
|
214
214
|
onSelect={onSelect}
|
|
215
215
|
onDragStart={onDragStart}
|
|
216
|
-
|
|
216
|
+
labelStr={labelStr}
|
|
217
217
|
titleStr={titleStr}
|
|
218
218
|
disabled={disabled}
|
|
219
219
|
isSelected={isSelected}
|
|
@@ -247,7 +247,7 @@ export function TldrawUiMenuItem<
|
|
|
247
247
|
icon={icon}
|
|
248
248
|
onSelect={onSelect}
|
|
249
249
|
onDragStart={onDragStart}
|
|
250
|
-
|
|
250
|
+
labelStr={labelStr}
|
|
251
251
|
titleStr={titleStr}
|
|
252
252
|
disabled={disabled}
|
|
253
253
|
isSelected={isSelected}
|
|
@@ -333,7 +333,7 @@ function useDraggableEvents(
|
|
|
333
333
|
type: 'pointer',
|
|
334
334
|
target: 'canvas',
|
|
335
335
|
name: 'pointer_down',
|
|
336
|
-
...getPointerInfo(e),
|
|
336
|
+
...getPointerInfo(editor, e),
|
|
337
337
|
point: screenSpaceStart,
|
|
338
338
|
})
|
|
339
339
|
|
|
@@ -345,7 +345,7 @@ function useDraggableEvents(
|
|
|
345
345
|
type: 'pointer',
|
|
346
346
|
target: 'canvas',
|
|
347
347
|
name: 'pointer_move',
|
|
348
|
-
...getPointerInfo(e),
|
|
348
|
+
...getPointerInfo(editor, e),
|
|
349
349
|
point: screenSpaceStart,
|
|
350
350
|
})
|
|
351
351
|
|
|
@@ -365,7 +365,7 @@ function useDraggableEvents(
|
|
|
365
365
|
type: 'pointer',
|
|
366
366
|
target: 'canvas',
|
|
367
367
|
name: 'pointer_up',
|
|
368
|
-
...getPointerInfo(e),
|
|
368
|
+
...getPointerInfo(editor, e),
|
|
369
369
|
})
|
|
370
370
|
}
|
|
371
371
|
|
|
@@ -392,7 +392,7 @@ function useDraggableEvents(
|
|
|
392
392
|
|
|
393
393
|
function DraggableToolbarButton({
|
|
394
394
|
id,
|
|
395
|
-
|
|
395
|
+
labelStr,
|
|
396
396
|
titleStr,
|
|
397
397
|
disabled,
|
|
398
398
|
isSelected,
|
|
@@ -403,7 +403,7 @@ function DraggableToolbarButton({
|
|
|
403
403
|
}: {
|
|
404
404
|
id: string
|
|
405
405
|
disabled: boolean
|
|
406
|
-
|
|
406
|
+
labelStr?: string
|
|
407
407
|
titleStr?: string
|
|
408
408
|
isSelected?: boolean
|
|
409
409
|
icon: TLUiMenuItemProps['icon']
|
|
@@ -416,7 +416,7 @@ function DraggableToolbarButton({
|
|
|
416
416
|
if (overflow) {
|
|
417
417
|
return (
|
|
418
418
|
<TldrawUiToolbarButton
|
|
419
|
-
aria-label={
|
|
419
|
+
aria-label={labelStr}
|
|
420
420
|
aria-pressed={isSelected ? 'true' : 'false'}
|
|
421
421
|
isActive={isSelected}
|
|
422
422
|
className="tlui-button-grid__button"
|
|
@@ -434,7 +434,7 @@ function DraggableToolbarButton({
|
|
|
434
434
|
|
|
435
435
|
return (
|
|
436
436
|
<TldrawUiToolbarButton
|
|
437
|
-
aria-label={
|
|
437
|
+
aria-label={labelStr}
|
|
438
438
|
aria-pressed={isSelected ? 'true' : 'false'}
|
|
439
439
|
data-testid={`tools.${id}`}
|
|
440
440
|
data-value={id}
|
|
@@ -225,7 +225,7 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|
|
225
225
|
if (ids.length === 0) ids = Array.from(editor.getCurrentPageShapeIds().values())
|
|
226
226
|
if (ids.length === 0) return
|
|
227
227
|
trackEvent('export-as', { format: 'svg', source })
|
|
228
|
-
helpers.exportAs(ids, 'svg', getExportName(editor, defaultDocumentName))
|
|
228
|
+
helpers.exportAs(ids, { format: 'svg', name: getExportName(editor, defaultDocumentName) })
|
|
229
229
|
},
|
|
230
230
|
},
|
|
231
231
|
{
|
|
@@ -241,7 +241,7 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|
|
241
241
|
if (ids.length === 0) ids = Array.from(editor.getCurrentPageShapeIds().values())
|
|
242
242
|
if (ids.length === 0) return
|
|
243
243
|
trackEvent('export-as', { format: 'png', source })
|
|
244
|
-
helpers.exportAs(ids, 'png', getExportName(editor, defaultDocumentName))
|
|
244
|
+
helpers.exportAs(ids, { format: 'png', name: getExportName(editor, defaultDocumentName) })
|
|
245
245
|
},
|
|
246
246
|
},
|
|
247
247
|
{
|
|
@@ -257,11 +257,10 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|
|
257
257
|
if (ids.length === 0) ids = Array.from(editor.getCurrentPageShapeIds().values())
|
|
258
258
|
if (ids.length === 0) return
|
|
259
259
|
trackEvent('export-all-as', { format: 'svg', source })
|
|
260
|
-
helpers.exportAs(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
)
|
|
260
|
+
helpers.exportAs(Array.from(editor.getCurrentPageShapeIds()), {
|
|
261
|
+
format: 'svg',
|
|
262
|
+
name: getExportName(editor, defaultDocumentName),
|
|
263
|
+
})
|
|
265
264
|
},
|
|
266
265
|
},
|
|
267
266
|
{
|
|
@@ -276,7 +275,7 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|
|
276
275
|
const ids = Array.from(editor.getCurrentPageShapeIds().values())
|
|
277
276
|
if (ids.length === 0) return
|
|
278
277
|
trackEvent('export-all-as', { format: 'png', source })
|
|
279
|
-
helpers.exportAs(ids, 'png', getExportName(editor, defaultDocumentName))
|
|
278
|
+
helpers.exportAs(ids, { format: 'png', name: getExportName(editor, defaultDocumentName) })
|
|
280
279
|
},
|
|
281
280
|
},
|
|
282
281
|
{
|
|
@@ -1585,6 +1584,19 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|
|
1585
1584
|
onSelect: async (source) => {
|
|
1586
1585
|
if (!canApplySelectionAction()) return
|
|
1587
1586
|
|
|
1587
|
+
const onlySelectedShape = editor.getOnlySelectedShape()
|
|
1588
|
+
if (
|
|
1589
|
+
onlySelectedShape &&
|
|
1590
|
+
(editor.isShapeOfType<TLImageShape>(onlySelectedShape, 'image') ||
|
|
1591
|
+
editor.isShapeOfType<TLVideoShape>(onlySelectedShape, 'video'))
|
|
1592
|
+
) {
|
|
1593
|
+
const firstToolbarButton = editor
|
|
1594
|
+
.getContainer()
|
|
1595
|
+
.querySelector('.tlui-contextual-toolbar button:first-child') as HTMLElement | null
|
|
1596
|
+
firstToolbarButton?.focus()
|
|
1597
|
+
return
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1588
1600
|
const firstButton = editor
|
|
1589
1601
|
.getContainer()
|
|
1590
1602
|
.querySelector('.tlui-style-panel button') as HTMLElement | null
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
compact,
|
|
9
9
|
isDefined,
|
|
10
10
|
preventDefault,
|
|
11
|
-
stopEventPropagation,
|
|
12
11
|
uniq,
|
|
13
12
|
useEditor,
|
|
14
13
|
useMaybeEditor,
|
|
@@ -763,7 +762,7 @@ export function useNativeClipboardEvents() {
|
|
|
763
762
|
|
|
764
763
|
const paste = (e: ClipboardEvent) => {
|
|
765
764
|
if (disablingMiddleClickPaste) {
|
|
766
|
-
|
|
765
|
+
editor.markEventAsHandled(e)
|
|
767
766
|
return
|
|
768
767
|
}
|
|
769
768
|
|
|
@@ -11,12 +11,13 @@ export function useExportAs() {
|
|
|
11
11
|
const msg = useTranslation()
|
|
12
12
|
|
|
13
13
|
return useCallback(
|
|
14
|
-
(ids: TLShapeId[],
|
|
14
|
+
(ids: TLShapeId[], opts: { format?: TLExportType; name?: string; scale?: number } = {}) => {
|
|
15
15
|
assert(editor, 'useExportAs: editor is required')
|
|
16
|
+
const { format = 'png', name, scale = 1 } = opts
|
|
16
17
|
exportAs(editor, ids, {
|
|
17
18
|
format,
|
|
18
19
|
name,
|
|
19
|
-
scale
|
|
20
|
+
scale,
|
|
20
21
|
}).catch((e) => {
|
|
21
22
|
console.error(e.message)
|
|
22
23
|
addToast({
|
|
@@ -176,7 +176,7 @@ export function ToolsProvider({ overrides, children }: TLUiToolsProviderProps) {
|
|
|
176
176
|
editor.createShape({
|
|
177
177
|
id,
|
|
178
178
|
type: 'arrow',
|
|
179
|
-
props: { start: { x: 0, y:
|
|
179
|
+
props: { start: { x: 0, y: 200 }, end: { x: 200, y: 0 } },
|
|
180
180
|
}),
|
|
181
181
|
})
|
|
182
182
|
trackEvent('drag-tool', { source, id: 'arrow' })
|
|
@@ -122,6 +122,7 @@ export type TLUiTranslationKey =
|
|
|
122
122
|
| 'action.zoom-to-fit'
|
|
123
123
|
| 'action.zoom-to-selection'
|
|
124
124
|
| 'assets.files.size-too-big'
|
|
125
|
+
| 'assets.files.maximum-size'
|
|
125
126
|
| 'assets.files.type-not-allowed'
|
|
126
127
|
| 'assets.files.upload-failed'
|
|
127
128
|
| 'assets.files.amount-too-many'
|
|
@@ -261,6 +262,7 @@ export type TLUiTranslationKey =
|
|
|
261
262
|
| 'tool.aspect-ratio.wide'
|
|
262
263
|
| 'tool.image-toolbar-title'
|
|
263
264
|
| 'tool.image-crop'
|
|
265
|
+
| 'tool.image-crop-confirm'
|
|
264
266
|
| 'tool.media-alt-text'
|
|
265
267
|
| 'tool.media-alt-text-desc'
|
|
266
268
|
| 'tool.media-alt-text-confirm'
|
|
@@ -410,6 +412,7 @@ export type TLUiTranslationKey =
|
|
|
410
412
|
| 'style-panel.opacity'
|
|
411
413
|
| 'style-panel.size'
|
|
412
414
|
| 'style-panel.spline'
|
|
415
|
+
| 'style-panel.selected'
|
|
413
416
|
| 'tool-panel.title'
|
|
414
417
|
| 'tool-panel.more'
|
|
415
418
|
| 'navigation-zone.title'
|
|
@@ -92,9 +92,9 @@ export const DEFAULT_TRANSLATION = {
|
|
|
92
92
|
'action.toggle-wrap-mode': 'Toggle Select on wrap',
|
|
93
93
|
'action.toggle-reduce-motion.menu': 'Reduce motion',
|
|
94
94
|
'action.toggle-reduce-motion': 'Toggle reduce motion',
|
|
95
|
-
'action.toggle-keyboard-shortcuts.menu': '
|
|
95
|
+
'action.toggle-keyboard-shortcuts.menu': 'Enable keyboard shortcuts',
|
|
96
96
|
'action.toggle-keyboard-shortcuts': 'Toggle keyboard shortcuts',
|
|
97
|
-
'action.toggle-ui-labels.menu': 'UI labels',
|
|
97
|
+
'action.toggle-ui-labels.menu': 'Enable UI labels',
|
|
98
98
|
'action.toggle-ui-labels': 'Toggle UI labels',
|
|
99
99
|
'action.toggle-edge-scrolling.menu': 'Edge scrolling',
|
|
100
100
|
'action.toggle-edge-scrolling': 'Toggle edge scrolling',
|
|
@@ -123,6 +123,7 @@ export const DEFAULT_TRANSLATION = {
|
|
|
123
123
|
'action.zoom-to-fit': 'Zoom to fit',
|
|
124
124
|
'action.zoom-to-selection': 'Zoom to selection',
|
|
125
125
|
'assets.files.size-too-big': 'File size is too big',
|
|
126
|
+
'assets.files.maximum-size': 'Maximum file size is {size}',
|
|
126
127
|
'assets.files.type-not-allowed': 'File type is not allowed',
|
|
127
128
|
'assets.files.upload-failed': 'Upload failed',
|
|
128
129
|
'assets.files.amount-too-many': 'Too many files',
|
|
@@ -262,6 +263,7 @@ export const DEFAULT_TRANSLATION = {
|
|
|
262
263
|
'tool.aspect-ratio.wide': 'Wide (16:9)',
|
|
263
264
|
'tool.image-toolbar-title': 'Image tools',
|
|
264
265
|
'tool.image-crop': 'Crop image',
|
|
266
|
+
'tool.image-crop-confirm': 'Confirm',
|
|
265
267
|
'tool.media-alt-text': 'Alternative text',
|
|
266
268
|
'tool.media-alt-text-desc': 'Give a description…',
|
|
267
269
|
'tool.media-alt-text-confirm': 'Confirm',
|
|
@@ -413,6 +415,7 @@ export const DEFAULT_TRANSLATION = {
|
|
|
413
415
|
'style-panel.opacity': 'Opacity',
|
|
414
416
|
'style-panel.size': 'Size',
|
|
415
417
|
'style-panel.spline': 'Spline',
|
|
418
|
+
'style-panel.selected': 'selected',
|
|
416
419
|
'tool-panel.title': 'Tools',
|
|
417
420
|
'tool-panel.more': 'More',
|
|
418
421
|
'navigation-zone.title': 'Navigation',
|
package/src/lib/ui/version.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// This file is automatically generated by internal/scripts/refresh-assets.ts.
|
|
2
2
|
// Do not edit manually. Or do, I'm a comment, not a cop.
|
|
3
3
|
|
|
4
|
-
export const version = '3.16.0-canary.
|
|
4
|
+
export const version = '3.16.0-canary.f5bf2b535ea7'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2024-09-13T14:36:29.063Z',
|
|
7
|
-
minor: '2025-
|
|
8
|
-
patch: '2025-
|
|
7
|
+
minor: '2025-09-18T13:10:54.219Z',
|
|
8
|
+
patch: '2025-09-18T13:10:54.219Z',
|
|
9
9
|
}
|