tldraw 3.16.0-next.fe14f1b4181f → 4.0.0
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 +232 -114
- package/dist-cjs/index.js +30 -15
- 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 +5 -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/AccessibilityMenu.js +1 -1
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/InputModeMenu.js +77 -0
- package/dist-cjs/lib/ui/components/InputModeMenu.js.map +7 -0
- 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/MainMenu/DefaultMainMenuContent.js +2 -0
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.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 +13 -6
- 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 +70 -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/menu-items.js +6 -4
- package/dist-cjs/lib/ui/components/menu-items.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 +13 -2
- 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 +75 -20
- 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 +18 -33
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +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 +12 -3
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +4 -4
- 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 +232 -114
- package/dist-esm/index.mjs +61 -30
- 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 +5 -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/AccessibilityMenu.mjs +3 -3
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/InputModeMenu.mjs +57 -0
- package/dist-esm/lib/ui/components/InputModeMenu.mjs.map +7 -0
- 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/MainMenu/DefaultMainMenuContent.mjs +2 -0
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.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 +18 -7
- 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 +50 -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/menu-items.mjs +6 -4
- package/dist-esm/lib/ui/components/menu-items.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 +13 -2
- 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 +76 -20
- 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 +18 -33
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +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 +12 -3
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +4 -4
- 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 +46 -22
- 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 +5 -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/AccessibilityMenu.tsx +2 -2
- package/src/lib/ui/components/InputModeMenu.tsx +65 -0
- package/src/lib/ui/components/LanguageMenu.tsx +1 -0
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +4 -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 +30 -14
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +262 -381
- package/src/lib/ui/components/{primitives/TldrawUiButtonPicker.tsx → StylePanel/StylePanelButtonPicker.tsx} +70 -50
- package/src/lib/ui/components/StylePanel/StylePanelContext.tsx +65 -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/menu-items.tsx +5 -3
- 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 +19 -4
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +5 -1
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +75 -14
- 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 +25 -35
- package/src/lib/ui/context/events.tsx +3 -2
- 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 +11 -2
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +12 -3
- package/src/lib/ui/version.ts +4 -4
- package/src/lib/ui.css +41 -4
- 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/commands/setCamera.test.ts +13 -0
- package/src/test/custom-clipping.test.ts +436 -0
- package/src/test/frames.test.ts +15 -0
- package/src/test/getCulledShapes.test.tsx +71 -2
- package/tldraw.css +49 -7
- 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
|
@@ -28,14 +28,20 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var DefaultStylePanelContent_exports = {};
|
|
30
30
|
__export(DefaultStylePanelContent_exports, {
|
|
31
|
-
ArrowStylePickerSet: () => ArrowStylePickerSet,
|
|
32
|
-
ArrowheadStylePickerSet: () => ArrowheadStylePickerSet,
|
|
33
|
-
CommonStylePickerSet: () => CommonStylePickerSet,
|
|
34
31
|
DefaultStylePanelContent: () => DefaultStylePanelContent,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
StylePanelArrowKindPicker: () => StylePanelArrowKindPicker,
|
|
33
|
+
StylePanelArrowheadPicker: () => StylePanelArrowheadPicker,
|
|
34
|
+
StylePanelColorPicker: () => StylePanelColorPicker,
|
|
35
|
+
StylePanelDashPicker: () => StylePanelDashPicker,
|
|
36
|
+
StylePanelFillPicker: () => StylePanelFillPicker,
|
|
37
|
+
StylePanelFontPicker: () => StylePanelFontPicker,
|
|
38
|
+
StylePanelGeoShapePicker: () => StylePanelGeoShapePicker,
|
|
39
|
+
StylePanelLabelAlignPicker: () => StylePanelLabelAlignPicker,
|
|
40
|
+
StylePanelOpacityPicker: () => StylePanelOpacityPicker,
|
|
41
|
+
StylePanelSection: () => StylePanelSection,
|
|
42
|
+
StylePanelSizePicker: () => StylePanelSizePicker,
|
|
43
|
+
StylePanelSplinePicker: () => StylePanelSplinePicker,
|
|
44
|
+
StylePanelTextAlignPicker: () => StylePanelTextAlignPicker
|
|
39
45
|
});
|
|
40
46
|
module.exports = __toCommonJS(DefaultStylePanelContent_exports);
|
|
41
47
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -45,300 +51,265 @@ var import_styles = require("../../../styles");
|
|
|
45
51
|
var import_events = require("../../context/events");
|
|
46
52
|
var import_useTranslation = require("../../hooks/useTranslation/useTranslation");
|
|
47
53
|
var import_TldrawUiButtonIcon = require("../primitives/Button/TldrawUiButtonIcon");
|
|
48
|
-
var import_TldrawUiButtonPicker = require("../primitives/TldrawUiButtonPicker");
|
|
49
54
|
var import_TldrawUiSlider = require("../primitives/TldrawUiSlider");
|
|
50
55
|
var import_TldrawUiToolbar = require("../primitives/TldrawUiToolbar");
|
|
51
|
-
var
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
function DefaultStylePanelContent(
|
|
57
|
-
const isDarkMode = (0, import_editor.useIsDarkMode)();
|
|
58
|
-
if (!styles) return null;
|
|
59
|
-
const geo = styles.get(import_editor.GeoShapeGeoStyle);
|
|
60
|
-
const arrowheadEnd = styles.get(import_editor.ArrowShapeArrowheadEndStyle);
|
|
61
|
-
const arrowheadStart = styles.get(import_editor.ArrowShapeArrowheadStartStyle);
|
|
62
|
-
const arrowKind = styles.get(import_editor.ArrowShapeKindStyle);
|
|
63
|
-
const spline = styles.get(import_editor.LineShapeSplineStyle);
|
|
64
|
-
const font = styles.get(import_editor.DefaultFontStyle);
|
|
65
|
-
const hideGeo = geo === void 0;
|
|
66
|
-
const hideArrowHeads = arrowheadEnd === void 0 && arrowheadStart === void 0;
|
|
67
|
-
const hideSpline = spline === void 0;
|
|
68
|
-
const hideArrowKind = arrowKind === void 0;
|
|
69
|
-
const hideText = font === void 0;
|
|
70
|
-
const theme = (0, import_editor.getDefaultColorTheme)({ isDarkMode });
|
|
56
|
+
var import_StylePanelButtonPicker = require("./StylePanelButtonPicker");
|
|
57
|
+
var import_StylePanelContext = require("./StylePanelContext");
|
|
58
|
+
var import_StylePanelDoubleDropdownPicker = require("./StylePanelDoubleDropdownPicker");
|
|
59
|
+
var import_StylePanelDropdownPicker = require("./StylePanelDropdownPicker");
|
|
60
|
+
var import_StylePanelSubheading = require("./StylePanelSubheading");
|
|
61
|
+
function DefaultStylePanelContent() {
|
|
71
62
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
72
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StylePanelSection, { children: [
|
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelColorPicker, {}),
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelOpacityPicker, {})
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StylePanelSection, { children: [
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelFillPicker, {}),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelDashPicker, {}),
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSizePicker, {})
|
|
71
|
+
] }),
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StylePanelSection, { children: [
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelFontPicker, {}),
|
|
74
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelTextAlignPicker, {}),
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelLabelAlignPicker, {})
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StylePanelSection, { children: [
|
|
78
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelGeoShapePicker, {}),
|
|
79
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelArrowKindPicker, {}),
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelArrowheadPicker, {}),
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSplinePicker, {})
|
|
79
82
|
] })
|
|
80
83
|
] });
|
|
81
84
|
}
|
|
82
|
-
function
|
|
85
|
+
function StylePanelSection({ children }) {
|
|
86
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tlui-style-panel__section", children });
|
|
87
|
+
}
|
|
88
|
+
function StylePanelColorPicker() {
|
|
89
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
90
|
+
const msg = (0, import_useTranslation.useTranslation)();
|
|
91
|
+
const color = styles.get(import_editor.DefaultColorStyle);
|
|
92
|
+
if (color === void 0) return null;
|
|
93
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
94
|
+
import_StylePanelButtonPicker.StylePanelButtonPicker,
|
|
95
|
+
{
|
|
96
|
+
title: msg("style-panel.color"),
|
|
97
|
+
uiType: "color",
|
|
98
|
+
style: import_editor.DefaultColorStyle,
|
|
99
|
+
items: import_styles.STYLES.color,
|
|
100
|
+
value: color
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
const tldrawSupportedOpacities = [0.1, 0.25, 0.5, 0.75, 1];
|
|
105
|
+
function StylePanelOpacityPicker() {
|
|
83
106
|
const editor = (0, import_editor.useEditor)();
|
|
107
|
+
const { onHistoryMark, enhancedA11yMode } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
108
|
+
const opacity = (0, import_editor.useValue)("opacity", () => editor.getSharedOpacity(), [editor]);
|
|
84
109
|
const trackEvent = (0, import_events.useUiEvents)();
|
|
85
|
-
|
|
86
|
-
|
|
110
|
+
const msg = (0, import_useTranslation.useTranslation)();
|
|
111
|
+
const handleOpacityValueChange = import_react.default.useCallback(
|
|
112
|
+
(value) => {
|
|
113
|
+
const item = tldrawSupportedOpacities[value];
|
|
87
114
|
editor.run(() => {
|
|
88
115
|
if (editor.isIn("select")) {
|
|
89
|
-
editor.
|
|
116
|
+
editor.setOpacityForSelectedShapes(item);
|
|
90
117
|
}
|
|
91
|
-
editor.
|
|
118
|
+
editor.setOpacityForNextShapes(item);
|
|
92
119
|
editor.updateInstanceState({ isChangingStyle: true });
|
|
93
120
|
});
|
|
94
|
-
trackEvent("set-style", { source: "style-panel", id:
|
|
121
|
+
trackEvent("set-style", { source: "style-panel", id: "opacity", value });
|
|
95
122
|
},
|
|
96
123
|
[editor, trackEvent]
|
|
97
124
|
);
|
|
125
|
+
if (opacity === void 0) return null;
|
|
126
|
+
const opacityIndex = opacity.type === "mixed" ? -1 : tldrawSupportedOpacities.indexOf(
|
|
127
|
+
(0, import_editor.minBy)(
|
|
128
|
+
tldrawSupportedOpacities,
|
|
129
|
+
(supportedOpacity) => Math.abs(supportedOpacity - opacity.value)
|
|
130
|
+
)
|
|
131
|
+
);
|
|
132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
133
|
+
enhancedA11yMode && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_StylePanelSubheading.StylePanelSubheading, { children: msg("style-panel.opacity") }),
|
|
134
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
135
|
+
import_TldrawUiSlider.TldrawUiSlider,
|
|
136
|
+
{
|
|
137
|
+
"data-testid": "style.opacity",
|
|
138
|
+
value: opacityIndex >= 0 ? opacityIndex : tldrawSupportedOpacities.length - 1,
|
|
139
|
+
label: opacity.type === "mixed" ? "style-panel.mixed" : `opacity-style.${opacity.value}`,
|
|
140
|
+
onValueChange: handleOpacityValueChange,
|
|
141
|
+
steps: tldrawSupportedOpacities.length - 1,
|
|
142
|
+
title: msg("style-panel.opacity"),
|
|
143
|
+
onHistoryMark,
|
|
144
|
+
ariaValueModifier: 25
|
|
145
|
+
}
|
|
146
|
+
)
|
|
147
|
+
] });
|
|
98
148
|
}
|
|
99
|
-
function
|
|
149
|
+
function StylePanelFillPicker() {
|
|
150
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
100
151
|
const msg = (0, import_useTranslation.useTranslation)();
|
|
101
|
-
const editor = (0, import_editor.useEditor)();
|
|
102
|
-
const onHistoryMark = (0, import_react.useCallback)((id) => editor.markHistoryStoppingPoint(id), [editor]);
|
|
103
|
-
const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
104
|
-
const handleValueChange = useStyleChangeCallback();
|
|
105
|
-
const color = styles.get(import_editor.DefaultColorStyle);
|
|
106
152
|
const fill = styles.get(import_editor.DefaultFillStyle);
|
|
153
|
+
if (fill === void 0) return null;
|
|
154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
155
|
+
import_StylePanelButtonPicker.StylePanelButtonPicker,
|
|
156
|
+
{
|
|
157
|
+
title: msg("style-panel.fill"),
|
|
158
|
+
uiType: "fill",
|
|
159
|
+
style: import_editor.DefaultFillStyle,
|
|
160
|
+
items: import_styles.STYLES.fill,
|
|
161
|
+
value: fill
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
function StylePanelDashPicker() {
|
|
166
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
167
|
+
const msg = (0, import_useTranslation.useTranslation)();
|
|
107
168
|
const dash = styles.get(import_editor.DefaultDashStyle);
|
|
169
|
+
if (dash === void 0) return null;
|
|
170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
171
|
+
import_StylePanelButtonPicker.StylePanelButtonPicker,
|
|
172
|
+
{
|
|
173
|
+
title: msg("style-panel.dash"),
|
|
174
|
+
uiType: "dash",
|
|
175
|
+
style: import_editor.DefaultDashStyle,
|
|
176
|
+
items: import_styles.STYLES.dash,
|
|
177
|
+
value: dash
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
function StylePanelSizePicker() {
|
|
182
|
+
const editor = (0, import_editor.useEditor)();
|
|
183
|
+
const { styles, onValueChange } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
184
|
+
const msg = (0, import_useTranslation.useTranslation)();
|
|
108
185
|
const size = styles.get(import_editor.DefaultSizeStyle);
|
|
109
|
-
|
|
110
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
] }),
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(OpacitySlider, {})
|
|
129
|
-
] }),
|
|
130
|
-
showPickers && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "tlui-style-panel__section", children: [
|
|
131
|
-
fill === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
132
|
-
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.fill") }),
|
|
133
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.fill"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
-
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
135
|
-
{
|
|
136
|
-
title: msg("style-panel.fill"),
|
|
137
|
-
uiType: "fill",
|
|
138
|
-
style: import_editor.DefaultFillStyle,
|
|
139
|
-
items: import_styles.STYLES.fill,
|
|
140
|
-
value: fill,
|
|
141
|
-
onValueChange: handleValueChange,
|
|
142
|
-
theme,
|
|
143
|
-
onHistoryMark
|
|
144
|
-
}
|
|
145
|
-
) })
|
|
146
|
-
] }),
|
|
147
|
-
dash === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
148
|
-
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.dash") }),
|
|
149
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.dash"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
150
|
-
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
151
|
-
{
|
|
152
|
-
title: msg("style-panel.dash"),
|
|
153
|
-
uiType: "dash",
|
|
154
|
-
style: import_editor.DefaultDashStyle,
|
|
155
|
-
items: import_styles.STYLES.dash,
|
|
156
|
-
value: dash,
|
|
157
|
-
onValueChange: handleValueChange,
|
|
158
|
-
theme,
|
|
159
|
-
onHistoryMark
|
|
160
|
-
}
|
|
161
|
-
) })
|
|
162
|
-
] }),
|
|
163
|
-
size === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
164
|
-
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.size") }),
|
|
165
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.size"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
166
|
-
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
167
|
-
{
|
|
168
|
-
title: msg("style-panel.size"),
|
|
169
|
-
uiType: "size",
|
|
170
|
-
style: import_editor.DefaultSizeStyle,
|
|
171
|
-
items: import_styles.STYLES.size,
|
|
172
|
-
value: size,
|
|
173
|
-
onValueChange: (style, value) => {
|
|
174
|
-
handleValueChange(style, value);
|
|
175
|
-
const selectedShapeIds = editor.getSelectedShapeIds();
|
|
176
|
-
if (selectedShapeIds.length > 0) {
|
|
177
|
-
(0, import_editor.kickoutOccludedShapes)(editor, selectedShapeIds);
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
theme,
|
|
181
|
-
onHistoryMark
|
|
182
|
-
}
|
|
183
|
-
) })
|
|
184
|
-
] })
|
|
185
|
-
] })
|
|
186
|
-
] });
|
|
186
|
+
if (size === void 0) return null;
|
|
187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
188
|
+
import_StylePanelButtonPicker.StylePanelButtonPicker,
|
|
189
|
+
{
|
|
190
|
+
title: msg("style-panel.size"),
|
|
191
|
+
uiType: "size",
|
|
192
|
+
style: import_editor.DefaultSizeStyle,
|
|
193
|
+
items: import_styles.STYLES.size,
|
|
194
|
+
value: size,
|
|
195
|
+
onValueChange: (style, value) => {
|
|
196
|
+
onValueChange(style, value);
|
|
197
|
+
const selectedShapeIds = editor.getSelectedShapeIds();
|
|
198
|
+
if (selectedShapeIds.length > 0) {
|
|
199
|
+
(0, import_editor.kickoutOccludedShapes)(editor, selectedShapeIds);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
);
|
|
187
204
|
}
|
|
188
|
-
function
|
|
205
|
+
function StylePanelFontPicker() {
|
|
206
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
189
207
|
const msg = (0, import_useTranslation.useTranslation)();
|
|
190
|
-
const handleValueChange = useStyleChangeCallback();
|
|
191
|
-
const editor = (0, import_editor.useEditor)();
|
|
192
|
-
const onHistoryMark = (0, import_react.useCallback)((id) => editor.markHistoryStoppingPoint(id), [editor]);
|
|
193
|
-
const showUiLabels = (0, import_editor.useValue)("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
194
|
-
const labelStr = showUiLabels && msg("style-panel.font");
|
|
195
208
|
const font = styles.get(import_editor.DefaultFontStyle);
|
|
209
|
+
if (font === void 0) return null;
|
|
210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
211
|
+
import_StylePanelButtonPicker.StylePanelButtonPicker,
|
|
212
|
+
{
|
|
213
|
+
title: msg("style-panel.font"),
|
|
214
|
+
uiType: "font",
|
|
215
|
+
style: import_editor.DefaultFontStyle,
|
|
216
|
+
items: import_styles.STYLES.font,
|
|
217
|
+
value: font
|
|
218
|
+
}
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
function StylePanelTextAlignPicker() {
|
|
222
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
223
|
+
const msg = (0, import_useTranslation.useTranslation)();
|
|
196
224
|
const textAlign = styles.get(import_editor.DefaultTextAlignStyle);
|
|
225
|
+
if (textAlign === void 0) return null;
|
|
226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.align"), children: [
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
228
|
+
import_StylePanelButtonPicker.StylePanelButtonPicker,
|
|
229
|
+
{
|
|
230
|
+
title: msg("style-panel.align"),
|
|
231
|
+
uiType: "align",
|
|
232
|
+
style: import_editor.DefaultTextAlignStyle,
|
|
233
|
+
items: import_styles.STYLES.textAlign,
|
|
234
|
+
value: textAlign
|
|
235
|
+
}
|
|
236
|
+
),
|
|
237
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
238
|
+
import_TldrawUiToolbar.TldrawUiToolbarButton,
|
|
239
|
+
{
|
|
240
|
+
type: "icon",
|
|
241
|
+
title: msg("style-panel.vertical-align"),
|
|
242
|
+
"data-testid": "vertical-align",
|
|
243
|
+
disabled: true,
|
|
244
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
245
|
+
}
|
|
246
|
+
)
|
|
247
|
+
] });
|
|
248
|
+
}
|
|
249
|
+
function StylePanelLabelAlignPicker() {
|
|
250
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
251
|
+
const msg = (0, import_useTranslation.useTranslation)();
|
|
197
252
|
const labelAlign = styles.get(import_editor.DefaultHorizontalAlignStyle);
|
|
198
253
|
const verticalLabelAlign = styles.get(import_editor.DefaultVerticalAlignStyle);
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
onHistoryMark
|
|
233
|
-
}
|
|
234
|
-
),
|
|
235
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
236
|
-
import_TldrawUiToolbar.TldrawUiToolbarButton,
|
|
237
|
-
{
|
|
238
|
-
type: "icon",
|
|
239
|
-
title: msg("style-panel.vertical-align"),
|
|
240
|
-
"data-testid": "vertical-align",
|
|
241
|
-
disabled: true,
|
|
242
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
243
|
-
}
|
|
244
|
-
)
|
|
245
|
-
] })
|
|
246
|
-
] }),
|
|
247
|
-
labelAlign === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
248
|
-
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.label-align") }),
|
|
249
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.label-align"), children: [
|
|
250
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
251
|
-
import_TldrawUiButtonPicker.TldrawUiButtonPicker,
|
|
252
|
-
{
|
|
253
|
-
title: msg("style-panel.label-align"),
|
|
254
|
-
uiType: "align",
|
|
255
|
-
style: import_editor.DefaultHorizontalAlignStyle,
|
|
256
|
-
items: import_styles.STYLES.horizontalAlign,
|
|
257
|
-
value: labelAlign,
|
|
258
|
-
onValueChange: handleValueChange,
|
|
259
|
-
theme,
|
|
260
|
-
onHistoryMark
|
|
261
|
-
}
|
|
262
|
-
),
|
|
263
|
-
verticalLabelAlign === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
264
|
-
import_TldrawUiToolbar.TldrawUiToolbarButton,
|
|
265
|
-
{
|
|
266
|
-
type: "icon",
|
|
267
|
-
title: msg("style-panel.vertical-align"),
|
|
268
|
-
"data-testid": "vertical-align",
|
|
269
|
-
disabled: true,
|
|
270
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
271
|
-
}
|
|
272
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
273
|
-
import_DropdownPicker.DropdownPicker,
|
|
274
|
-
{
|
|
275
|
-
type: "icon",
|
|
276
|
-
id: "geo-vertical-alignment",
|
|
277
|
-
uiType: "verticalAlign",
|
|
278
|
-
stylePanelType: "vertical-align",
|
|
279
|
-
style: import_editor.DefaultVerticalAlignStyle,
|
|
280
|
-
items: import_styles.STYLES.verticalAlign,
|
|
281
|
-
value: verticalLabelAlign,
|
|
282
|
-
onValueChange: handleValueChange
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
] })
|
|
286
|
-
] })
|
|
254
|
+
if (labelAlign === void 0) return null;
|
|
255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.label-align"), children: [
|
|
256
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
257
|
+
import_StylePanelButtonPicker.StylePanelButtonPicker,
|
|
258
|
+
{
|
|
259
|
+
title: msg("style-panel.label-align"),
|
|
260
|
+
uiType: "align",
|
|
261
|
+
style: import_editor.DefaultHorizontalAlignStyle,
|
|
262
|
+
items: import_styles.STYLES.horizontalAlign,
|
|
263
|
+
value: labelAlign
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
verticalLabelAlign === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
267
|
+
import_TldrawUiToolbar.TldrawUiToolbarButton,
|
|
268
|
+
{
|
|
269
|
+
type: "icon",
|
|
270
|
+
title: msg("style-panel.vertical-align"),
|
|
271
|
+
"data-testid": "vertical-align",
|
|
272
|
+
disabled: true,
|
|
273
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiButtonIcon.TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
274
|
+
}
|
|
275
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
276
|
+
import_StylePanelDropdownPicker.StylePanelDropdownPicker,
|
|
277
|
+
{
|
|
278
|
+
type: "icon",
|
|
279
|
+
id: "geo-vertical-alignment",
|
|
280
|
+
uiType: "verticalAlign",
|
|
281
|
+
stylePanelType: "vertical-align",
|
|
282
|
+
style: import_editor.DefaultVerticalAlignStyle,
|
|
283
|
+
items: import_styles.STYLES.verticalAlign,
|
|
284
|
+
value: verticalLabelAlign
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
287
|
] });
|
|
288
288
|
}
|
|
289
|
-
function
|
|
290
|
-
const
|
|
291
|
-
const handleValueChange = useStyleChangeCallback();
|
|
289
|
+
function StylePanelGeoShapePicker() {
|
|
290
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
292
291
|
const geo = styles.get(import_editor.GeoShapeGeoStyle);
|
|
293
|
-
if (geo === void 0)
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.geo"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
297
|
-
import_DropdownPicker.DropdownPicker,
|
|
292
|
+
if (geo === void 0) return null;
|
|
293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
294
|
+
import_StylePanelDropdownPicker.StylePanelDropdownPicker,
|
|
298
295
|
{
|
|
299
|
-
id: "geo",
|
|
300
|
-
type: "menu",
|
|
301
296
|
label: "style-panel.geo",
|
|
297
|
+
type: "menu",
|
|
298
|
+
id: "geo",
|
|
302
299
|
uiType: "geo",
|
|
303
300
|
stylePanelType: "geo",
|
|
304
301
|
style: import_editor.GeoShapeGeoStyle,
|
|
305
302
|
items: import_styles.STYLES.geo,
|
|
306
|
-
value: geo
|
|
307
|
-
onValueChange: handleValueChange
|
|
303
|
+
value: geo
|
|
308
304
|
}
|
|
309
|
-
)
|
|
310
|
-
}
|
|
311
|
-
function SplineStylePickerSet({ styles }) {
|
|
312
|
-
const msg = (0, import_useTranslation.useTranslation)();
|
|
313
|
-
const handleValueChange = useStyleChangeCallback();
|
|
314
|
-
const spline = styles.get(import_editor.LineShapeSplineStyle);
|
|
315
|
-
if (spline === void 0) {
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.spline"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
319
|
-
import_DropdownPicker.DropdownPicker,
|
|
320
|
-
{
|
|
321
|
-
id: "spline",
|
|
322
|
-
type: "menu",
|
|
323
|
-
label: "style-panel.spline",
|
|
324
|
-
uiType: "spline",
|
|
325
|
-
stylePanelType: "spline",
|
|
326
|
-
style: import_editor.LineShapeSplineStyle,
|
|
327
|
-
items: import_styles.STYLES.spline,
|
|
328
|
-
value: spline,
|
|
329
|
-
onValueChange: handleValueChange
|
|
330
|
-
}
|
|
331
|
-
) });
|
|
305
|
+
);
|
|
332
306
|
}
|
|
333
|
-
function
|
|
334
|
-
const
|
|
335
|
-
const handleValueChange = useStyleChangeCallback();
|
|
307
|
+
function StylePanelArrowKindPicker() {
|
|
308
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
336
309
|
const arrowKind = styles.get(import_editor.ArrowShapeKindStyle);
|
|
337
|
-
if (arrowKind === void 0)
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TldrawUiToolbar.TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.arrow-kind"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
341
|
-
import_DropdownPicker.DropdownPicker,
|
|
310
|
+
if (arrowKind === void 0) return null;
|
|
311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
312
|
+
import_StylePanelDropdownPicker.StylePanelDropdownPicker,
|
|
342
313
|
{
|
|
343
314
|
id: "arrow-kind",
|
|
344
315
|
type: "menu",
|
|
@@ -347,20 +318,17 @@ function ArrowStylePickerSet({ styles }) {
|
|
|
347
318
|
stylePanelType: "arrow-kind",
|
|
348
319
|
style: import_editor.ArrowShapeKindStyle,
|
|
349
320
|
items: import_styles.STYLES.arrowKind,
|
|
350
|
-
value: arrowKind
|
|
351
|
-
onValueChange: handleValueChange
|
|
321
|
+
value: arrowKind
|
|
352
322
|
}
|
|
353
|
-
)
|
|
323
|
+
);
|
|
354
324
|
}
|
|
355
|
-
function
|
|
356
|
-
const
|
|
325
|
+
function StylePanelArrowheadPicker() {
|
|
326
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
357
327
|
const arrowheadEnd = styles.get(import_editor.ArrowShapeArrowheadEndStyle);
|
|
358
328
|
const arrowheadStart = styles.get(import_editor.ArrowShapeArrowheadStartStyle);
|
|
359
|
-
if (
|
|
360
|
-
return null;
|
|
361
|
-
}
|
|
329
|
+
if (arrowheadEnd === void 0 || arrowheadStart === void 0) return null;
|
|
362
330
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
363
|
-
|
|
331
|
+
import_StylePanelDoubleDropdownPicker.StylePanelDoubleDropdownPicker,
|
|
364
332
|
{
|
|
365
333
|
label: "style-panel.arrowheads",
|
|
366
334
|
uiTypeA: "arrowheadStart",
|
|
@@ -371,56 +339,27 @@ function ArrowheadStylePickerSet({ styles }) {
|
|
|
371
339
|
styleB: import_editor.ArrowShapeArrowheadEndStyle,
|
|
372
340
|
itemsB: import_styles.STYLES.arrowheadEnd,
|
|
373
341
|
valueB: arrowheadEnd,
|
|
374
|
-
onValueChange: handleValueChange,
|
|
375
342
|
labelA: "style-panel.arrowhead-start",
|
|
376
343
|
labelB: "style-panel.arrowhead-end"
|
|
377
344
|
}
|
|
378
345
|
);
|
|
379
346
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
editor.updateInstanceState({ isChangingStyle: true });
|
|
397
|
-
});
|
|
398
|
-
trackEvent("set-style", { source: "style-panel", id: "opacity", value });
|
|
399
|
-
},
|
|
400
|
-
[editor, trackEvent]
|
|
401
|
-
);
|
|
402
|
-
if (opacity === void 0) return null;
|
|
403
|
-
const opacityIndex = opacity.type === "mixed" ? -1 : tldrawSupportedOpacities.indexOf(
|
|
404
|
-
(0, import_editor.minBy)(
|
|
405
|
-
tldrawSupportedOpacities,
|
|
406
|
-
(supportedOpacity) => Math.abs(supportedOpacity - opacity.value)
|
|
407
|
-
)
|
|
347
|
+
function StylePanelSplinePicker() {
|
|
348
|
+
const { styles } = (0, import_StylePanelContext.useStylePanelContext)();
|
|
349
|
+
const spline = styles.get(import_editor.LineShapeSplineStyle);
|
|
350
|
+
if (spline === void 0) return null;
|
|
351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
352
|
+
import_StylePanelDropdownPicker.StylePanelDropdownPicker,
|
|
353
|
+
{
|
|
354
|
+
type: "menu",
|
|
355
|
+
id: "spline",
|
|
356
|
+
uiType: "spline",
|
|
357
|
+
stylePanelType: "spline",
|
|
358
|
+
label: "style-panel.spline",
|
|
359
|
+
style: import_editor.LineShapeSplineStyle,
|
|
360
|
+
items: import_styles.STYLES.spline,
|
|
361
|
+
value: spline
|
|
362
|
+
}
|
|
408
363
|
);
|
|
409
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
410
|
-
showUiLabels && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StylePanelSubheading, { children: msg("style-panel.opacity") }),
|
|
411
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
412
|
-
import_TldrawUiSlider.TldrawUiSlider,
|
|
413
|
-
{
|
|
414
|
-
"data-testid": "style.opacity",
|
|
415
|
-
value: opacityIndex >= 0 ? opacityIndex : tldrawSupportedOpacities.length - 1,
|
|
416
|
-
label: opacity.type === "mixed" ? "style-panel.mixed" : `opacity-style.${opacity.value}`,
|
|
417
|
-
onValueChange: handleOpacityValueChange,
|
|
418
|
-
steps: tldrawSupportedOpacities.length - 1,
|
|
419
|
-
title: msg("style-panel.opacity"),
|
|
420
|
-
onHistoryMark,
|
|
421
|
-
ariaValueModifier: 25
|
|
422
|
-
}
|
|
423
|
-
)
|
|
424
|
-
] });
|
|
425
364
|
}
|
|
426
365
|
//# sourceMappingURL=DefaultStylePanelContent.js.map
|