tldraw 3.16.0-next.282b7be564ae → 3.16.0-next.2f9d39693e4c
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 +224 -102
- package/dist-cjs/index.js +33 -14
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/Tldraw.js +12 -2
- package/dist-cjs/lib/Tldraw.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +5 -4
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- 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/frame/FrameShapeUtil.js +6 -0
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.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/freehand/svg.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/useEditablePlainText.js +0 -2
- 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/tools/EraserTool/childStates/Erasing.js +25 -1
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js +12 -0
- package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/ui/TldrawUi.js +13 -12
- package/dist-cjs/lib/ui/TldrawUi.js.map +2 -2
- package/dist-cjs/lib/ui/assetUrls.js +13 -10
- package/dist-cjs/lib/ui/assetUrls.js.map +2 -2
- package/dist-cjs/lib/ui/components/{FollowingIndicator.js → DefaultFollowingIndicator.js} +6 -6
- package/dist-cjs/lib/ui/components/DefaultFollowingIndicator.js.map +7 -0
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +6 -6
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +1 -1
- 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/{primitives/TldrawUiButtonPicker.js → StylePanel/StylePanelButtonPicker.js} +52 -45
- 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} +24 -21
- 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 +3 -2
- 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 +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +10 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +17 -4
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +2 -0
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +37 -36
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +2 -1
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +23 -10
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/components.js +2 -0
- package/dist-cjs/lib/ui/context/components.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +1 -1
- 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 +2 -0
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/kbd-utils.js +9 -3
- package/dist-cjs/lib/ui/kbd-utils.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-cjs/lib/utils/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 +224 -102
- package/dist-esm/index.mjs +61 -29
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/Tldraw.mjs +14 -4
- package/dist-esm/lib/Tldraw.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +5 -4
- 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/frame/FrameShapeUtil.mjs +6 -0
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/image/ImageShapeUtil.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/freehand/svg.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs +0 -2
- 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/tools/EraserTool/childStates/Erasing.mjs +26 -1
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs +13 -0
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/ui/TldrawUi.mjs +13 -12
- package/dist-esm/lib/ui/TldrawUi.mjs.map +2 -2
- package/dist-esm/lib/ui/assetUrls.mjs +13 -10
- package/dist-esm/lib/ui/assetUrls.mjs.map +2 -2
- package/dist-esm/lib/ui/components/{FollowingIndicator.mjs → DefaultFollowingIndicator.mjs} +3 -3
- package/dist-esm/lib/ui/components/DefaultFollowingIndicator.mjs.map +7 -0
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +6 -6
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +1 -1
- 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/{primitives/TldrawUiButtonPicker.mjs → StylePanel/StylePanelButtonPicker.mjs} +54 -43
- 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} +21 -18
- 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 +3 -2
- 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 +3 -3
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +10 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +17 -4
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +2 -0
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +37 -36
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +2 -1
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +23 -10
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/components.mjs +2 -0
- package/dist-esm/lib/ui/context/components.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +1 -1
- 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 +2 -0
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/kbd-utils.mjs +9 -3
- package/dist-esm/lib/ui/kbd-utils.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/dist-esm/lib/utils/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 +11 -34
- package/src/index.ts +44 -22
- package/src/lib/Tldraw.tsx +15 -2
- package/src/lib/defaultExternalContentHandlers.ts +12 -4
- package/src/lib/shapes/arrow/ArrowShapeOptions.test.ts +2 -1
- package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +4 -3
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +7 -6
- package/src/lib/shapes/arrow/arrowLabel.ts +8 -0
- package/src/lib/shapes/draw/DrawShapeTool.test.ts +0 -5
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +8 -0
- package/src/lib/shapes/image/ImageShapeUtil.tsx +3 -0
- package/src/lib/shapes/line/LineShapeUtil.test.tsx +4 -3
- package/src/lib/shapes/line/__snapshots__/LineShapeUtil.test.tsx.snap +2 -2
- package/src/lib/shapes/shared/PlainTextLabel.tsx +0 -6
- package/src/lib/shapes/shared/freehand/svg.ts +2 -0
- package/src/lib/shapes/shared/useEditablePlainText.ts +0 -6
- package/src/lib/shapes/shared/useImageOrVideoAsset.ts +0 -7
- package/src/lib/shapes/text/TextShapeTool.test.ts +6 -5
- package/src/lib/tools/EraserTool/childStates/Erasing.ts +34 -1
- package/src/lib/tools/EraserTool/childStates/Pointing.ts +20 -0
- package/src/lib/ui/TldrawUi.tsx +16 -10
- package/src/lib/ui/assetUrls.ts +13 -10
- package/src/lib/ui/components/{FollowingIndicator.tsx → DefaultFollowingIndicator.tsx} +2 -1
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +6 -6
- 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} +63 -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 +4 -3
- 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 +5 -5
- package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +6 -1
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +50 -30
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +3 -0
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +29 -21
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +3 -2
- package/src/lib/ui/context/actions.tsx +23 -10
- package/src/lib/ui/context/components.tsx +3 -0
- package/src/lib/ui/context/events.tsx +1 -1
- 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 +2 -0
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +2 -0
- package/src/lib/ui/kbd-utils.ts +10 -3
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +19 -2
- package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +5 -5
- 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/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +4 -4
- package/src/test/A11y.test.tsx +3 -2
- package/src/test/ClickManager.test.ts +7 -6
- package/src/test/Editor.test.tsx +20 -19
- package/src/test/EraserTool.test.ts +184 -13
- package/src/test/HandTool.test.ts +10 -9
- package/src/test/HighlightShape.test.ts +2 -1
- package/src/test/SelectTool.test.ts +3 -2
- package/src/test/TLUserPreferences.test.ts +4 -3
- package/src/test/TestEditor.ts +13 -15
- package/src/test/TldrawEditor.test.tsx +11 -10
- package/src/test/ZoomTool.test.ts +7 -6
- package/src/test/__snapshots__/drawing.test.ts.snap +2 -2
- package/src/test/__snapshots__/groups.test.tsx.snap +6 -6
- package/src/test/__snapshots__/resizing.test.ts.snap +2 -2
- package/src/test/arrows-megabus.test.tsx +5 -4
- package/src/test/bindings.test.tsx +24 -37
- package/src/test/bookmark-shapes.test.ts +1 -8
- package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +23 -7
- package/src/test/commands/__snapshots__/packShapes.test.ts.snap +8 -8
- package/src/test/commands/__snapshots__/zoomToFit.test.ts.snap +2 -2
- package/src/test/commands/alignShapes.test.tsx +25 -24
- package/src/test/commands/animationSpeed.test.ts +2 -1
- package/src/test/commands/centerOnPoint.test.ts +3 -2
- package/src/test/commands/clipboard.test.ts +3 -2
- package/src/test/commands/createShapes.test.ts +2 -1
- package/src/test/commands/deleteShapes.test.ts +2 -1
- package/src/test/commands/distributeShapes.test.tsx +11 -10
- package/src/test/commands/getSvgString.test.ts +2 -1
- package/src/test/commands/packShapes.test.ts +5 -4
- package/src/test/commands/resizeShape.test.ts +2 -1
- package/src/test/commands/rotateShapes.test.ts +7 -6
- package/src/test/commands/setCamera.test.ts +4 -3
- package/src/test/commands/setCurrentPage.test.ts +3 -2
- package/src/test/commands/stackShapes.test.ts +11 -10
- package/src/test/commands/stretch.test.tsx +13 -12
- package/src/test/createDeepLink.test.tsx +2 -1
- package/src/test/cropping.test.ts +3 -2
- package/src/test/custom-clipping.test.ts +436 -0
- package/src/test/drawing.test.ts +2 -1
- package/src/test/flipShapes.test.ts +4 -3
- package/src/test/frames.test.ts +25 -24
- package/src/test/getCulledShapes.test.tsx +3 -2
- package/src/test/groups.test.tsx +1 -1
- package/src/test/handleDeepLink.test.tsx +2 -1
- package/src/test/maxShapes.test.ts +3 -2
- package/src/test/modifiers.test.ts +5 -4
- package/src/test/navigation.test.ts +12 -11
- package/src/test/panning.test.ts +2 -1
- package/src/test/perf/perf.test.ts +2 -1
- package/src/test/registerDeepLinkListener.test.tsx +10 -9
- package/src/test/resizing.test.ts +39 -38
- package/src/test/select.test.tsx +4 -3
- package/src/test/selection-omnibus.test.ts +11 -10
- package/src/test/shapeutils.test.ts +4 -3
- package/src/test/translating.test.ts +9 -8
- package/tldraw.css +27 -2
- package/dist-cjs/lib/ui/components/FollowingIndicator.js.map +0 -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.map +0 -7
- package/dist-esm/lib/ui/components/FollowingIndicator.mjs.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.map +0 -7
- package/src/lib/ui/components/StylePanel/DropdownPicker.tsx +0 -110
|
@@ -13,312 +13,275 @@ import {
|
|
|
13
13
|
DefaultVerticalAlignStyle,
|
|
14
14
|
GeoShapeGeoStyle,
|
|
15
15
|
LineShapeSplineStyle,
|
|
16
|
-
getDefaultColorTheme,
|
|
17
16
|
kickoutOccludedShapes,
|
|
18
17
|
minBy,
|
|
19
18
|
useEditor,
|
|
20
|
-
useIsDarkMode,
|
|
21
19
|
useValue
|
|
22
20
|
} from "@tldraw/editor";
|
|
23
|
-
import React
|
|
21
|
+
import React from "react";
|
|
24
22
|
import { STYLES } from "../../../styles.mjs";
|
|
25
23
|
import { useUiEvents } from "../../context/events.mjs";
|
|
26
24
|
import { useTranslation } from "../../hooks/useTranslation/useTranslation.mjs";
|
|
27
25
|
import { TldrawUiButtonIcon } from "../primitives/Button/TldrawUiButtonIcon.mjs";
|
|
28
|
-
import { TldrawUiButtonPicker } from "../primitives/TldrawUiButtonPicker.mjs";
|
|
29
26
|
import { TldrawUiSlider } from "../primitives/TldrawUiSlider.mjs";
|
|
30
27
|
import { TldrawUiToolbar, TldrawUiToolbarButton } from "../primitives/TldrawUiToolbar.mjs";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
function DefaultStylePanelContent(
|
|
37
|
-
const isDarkMode = useIsDarkMode();
|
|
38
|
-
if (!styles) return null;
|
|
39
|
-
const geo = styles.get(GeoShapeGeoStyle);
|
|
40
|
-
const arrowheadEnd = styles.get(ArrowShapeArrowheadEndStyle);
|
|
41
|
-
const arrowheadStart = styles.get(ArrowShapeArrowheadStartStyle);
|
|
42
|
-
const arrowKind = styles.get(ArrowShapeKindStyle);
|
|
43
|
-
const spline = styles.get(LineShapeSplineStyle);
|
|
44
|
-
const font = styles.get(DefaultFontStyle);
|
|
45
|
-
const hideGeo = geo === void 0;
|
|
46
|
-
const hideArrowHeads = arrowheadEnd === void 0 && arrowheadStart === void 0;
|
|
47
|
-
const hideSpline = spline === void 0;
|
|
48
|
-
const hideArrowKind = arrowKind === void 0;
|
|
49
|
-
const hideText = font === void 0;
|
|
50
|
-
const theme = getDefaultColorTheme({ isDarkMode });
|
|
28
|
+
import { StylePanelButtonPicker } from "./StylePanelButtonPicker.mjs";
|
|
29
|
+
import { useStylePanelContext } from "./StylePanelContext.mjs";
|
|
30
|
+
import { StylePanelDoubleDropdownPicker } from "./StylePanelDoubleDropdownPicker.mjs";
|
|
31
|
+
import { StylePanelDropdownPicker } from "./StylePanelDropdownPicker.mjs";
|
|
32
|
+
import { StylePanelSubheading } from "./StylePanelSubheading.mjs";
|
|
33
|
+
function DefaultStylePanelContent() {
|
|
51
34
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/* @__PURE__ */ jsx(
|
|
58
|
-
/* @__PURE__ */ jsx(
|
|
35
|
+
/* @__PURE__ */ jsxs(StylePanelSection, { children: [
|
|
36
|
+
/* @__PURE__ */ jsx(StylePanelColorPicker, {}),
|
|
37
|
+
/* @__PURE__ */ jsx(StylePanelOpacityPicker, {})
|
|
38
|
+
] }),
|
|
39
|
+
/* @__PURE__ */ jsxs(StylePanelSection, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(StylePanelFillPicker, {}),
|
|
41
|
+
/* @__PURE__ */ jsx(StylePanelDashPicker, {}),
|
|
42
|
+
/* @__PURE__ */ jsx(StylePanelSizePicker, {})
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ jsxs(StylePanelSection, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(StylePanelFontPicker, {}),
|
|
46
|
+
/* @__PURE__ */ jsx(StylePanelTextAlignPicker, {}),
|
|
47
|
+
/* @__PURE__ */ jsx(StylePanelLabelAlignPicker, {})
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ jsxs(StylePanelSection, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(StylePanelGeoShapePicker, {}),
|
|
51
|
+
/* @__PURE__ */ jsx(StylePanelArrowKindPicker, {}),
|
|
52
|
+
/* @__PURE__ */ jsx(StylePanelArrowheadPicker, {}),
|
|
53
|
+
/* @__PURE__ */ jsx(StylePanelSplinePicker, {})
|
|
59
54
|
] })
|
|
60
55
|
] });
|
|
61
56
|
}
|
|
62
|
-
function
|
|
57
|
+
function StylePanelSection({ children }) {
|
|
58
|
+
return /* @__PURE__ */ jsx("div", { className: "tlui-style-panel__section", children });
|
|
59
|
+
}
|
|
60
|
+
function StylePanelColorPicker() {
|
|
61
|
+
const { styles } = useStylePanelContext();
|
|
62
|
+
const msg = useTranslation();
|
|
63
|
+
const color = styles.get(DefaultColorStyle);
|
|
64
|
+
if (color === void 0) return null;
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
StylePanelButtonPicker,
|
|
67
|
+
{
|
|
68
|
+
title: msg("style-panel.color"),
|
|
69
|
+
uiType: "color",
|
|
70
|
+
style: DefaultColorStyle,
|
|
71
|
+
items: STYLES.color,
|
|
72
|
+
value: color
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
const tldrawSupportedOpacities = [0.1, 0.25, 0.5, 0.75, 1];
|
|
77
|
+
function StylePanelOpacityPicker() {
|
|
63
78
|
const editor = useEditor();
|
|
79
|
+
const { onHistoryMark, showUiLabels } = useStylePanelContext();
|
|
80
|
+
const opacity = useValue("opacity", () => editor.getSharedOpacity(), [editor]);
|
|
64
81
|
const trackEvent = useUiEvents();
|
|
65
|
-
|
|
66
|
-
|
|
82
|
+
const msg = useTranslation();
|
|
83
|
+
const handleOpacityValueChange = React.useCallback(
|
|
84
|
+
(value) => {
|
|
85
|
+
const item = tldrawSupportedOpacities[value];
|
|
67
86
|
editor.run(() => {
|
|
68
87
|
if (editor.isIn("select")) {
|
|
69
|
-
editor.
|
|
88
|
+
editor.setOpacityForSelectedShapes(item);
|
|
70
89
|
}
|
|
71
|
-
editor.
|
|
90
|
+
editor.setOpacityForNextShapes(item);
|
|
72
91
|
editor.updateInstanceState({ isChangingStyle: true });
|
|
73
92
|
});
|
|
74
|
-
trackEvent("set-style", { source: "style-panel", id:
|
|
75
|
-
}
|
|
93
|
+
trackEvent("set-style", { source: "style-panel", id: "opacity", value });
|
|
94
|
+
},
|
|
76
95
|
[editor, trackEvent]
|
|
77
96
|
);
|
|
97
|
+
if (opacity === void 0) return null;
|
|
98
|
+
const opacityIndex = opacity.type === "mixed" ? -1 : tldrawSupportedOpacities.indexOf(
|
|
99
|
+
minBy(
|
|
100
|
+
tldrawSupportedOpacities,
|
|
101
|
+
(supportedOpacity) => Math.abs(supportedOpacity - opacity.value)
|
|
102
|
+
)
|
|
103
|
+
);
|
|
104
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
105
|
+
showUiLabels && /* @__PURE__ */ jsx(StylePanelSubheading, { children: msg("style-panel.opacity") }),
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
107
|
+
TldrawUiSlider,
|
|
108
|
+
{
|
|
109
|
+
"data-testid": "style.opacity",
|
|
110
|
+
value: opacityIndex >= 0 ? opacityIndex : tldrawSupportedOpacities.length - 1,
|
|
111
|
+
label: opacity.type === "mixed" ? "style-panel.mixed" : `opacity-style.${opacity.value}`,
|
|
112
|
+
onValueChange: handleOpacityValueChange,
|
|
113
|
+
steps: tldrawSupportedOpacities.length - 1,
|
|
114
|
+
title: msg("style-panel.opacity"),
|
|
115
|
+
onHistoryMark,
|
|
116
|
+
ariaValueModifier: 25
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] });
|
|
78
120
|
}
|
|
79
|
-
function
|
|
121
|
+
function StylePanelFillPicker() {
|
|
122
|
+
const { styles } = useStylePanelContext();
|
|
80
123
|
const msg = useTranslation();
|
|
81
|
-
const editor = useEditor();
|
|
82
|
-
const onHistoryMark = useCallback((id) => editor.markHistoryStoppingPoint(id), [editor]);
|
|
83
|
-
const showUiLabels = useValue("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
84
|
-
const handleValueChange = useStyleChangeCallback();
|
|
85
|
-
const color = styles.get(DefaultColorStyle);
|
|
86
124
|
const fill = styles.get(DefaultFillStyle);
|
|
125
|
+
if (fill === void 0) return null;
|
|
126
|
+
return /* @__PURE__ */ jsx(
|
|
127
|
+
StylePanelButtonPicker,
|
|
128
|
+
{
|
|
129
|
+
title: msg("style-panel.fill"),
|
|
130
|
+
uiType: "fill",
|
|
131
|
+
style: DefaultFillStyle,
|
|
132
|
+
items: STYLES.fill,
|
|
133
|
+
value: fill
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
function StylePanelDashPicker() {
|
|
138
|
+
const { styles } = useStylePanelContext();
|
|
139
|
+
const msg = useTranslation();
|
|
87
140
|
const dash = styles.get(DefaultDashStyle);
|
|
141
|
+
if (dash === void 0) return null;
|
|
142
|
+
return /* @__PURE__ */ jsx(
|
|
143
|
+
StylePanelButtonPicker,
|
|
144
|
+
{
|
|
145
|
+
title: msg("style-panel.dash"),
|
|
146
|
+
uiType: "dash",
|
|
147
|
+
style: DefaultDashStyle,
|
|
148
|
+
items: STYLES.dash,
|
|
149
|
+
value: dash
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function StylePanelSizePicker() {
|
|
154
|
+
const editor = useEditor();
|
|
155
|
+
const { styles, onValueChange } = useStylePanelContext();
|
|
156
|
+
const msg = useTranslation();
|
|
88
157
|
const size = styles.get(DefaultSizeStyle);
|
|
89
|
-
|
|
90
|
-
return /* @__PURE__ */
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
] }),
|
|
108
|
-
/* @__PURE__ */ jsx(OpacitySlider, {})
|
|
109
|
-
] }),
|
|
110
|
-
showPickers && /* @__PURE__ */ jsxs("div", { className: "tlui-style-panel__section", children: [
|
|
111
|
-
fill === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
112
|
-
showUiLabels && /* @__PURE__ */ jsx(StylePanelSubheading, { children: msg("style-panel.fill") }),
|
|
113
|
-
/* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.fill"), children: /* @__PURE__ */ jsx(
|
|
114
|
-
TldrawUiButtonPicker,
|
|
115
|
-
{
|
|
116
|
-
title: msg("style-panel.fill"),
|
|
117
|
-
uiType: "fill",
|
|
118
|
-
style: DefaultFillStyle,
|
|
119
|
-
items: STYLES.fill,
|
|
120
|
-
value: fill,
|
|
121
|
-
onValueChange: handleValueChange,
|
|
122
|
-
theme,
|
|
123
|
-
onHistoryMark
|
|
124
|
-
}
|
|
125
|
-
) })
|
|
126
|
-
] }),
|
|
127
|
-
dash === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
128
|
-
showUiLabels && /* @__PURE__ */ jsx(StylePanelSubheading, { children: msg("style-panel.dash") }),
|
|
129
|
-
/* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.dash"), children: /* @__PURE__ */ jsx(
|
|
130
|
-
TldrawUiButtonPicker,
|
|
131
|
-
{
|
|
132
|
-
title: msg("style-panel.dash"),
|
|
133
|
-
uiType: "dash",
|
|
134
|
-
style: DefaultDashStyle,
|
|
135
|
-
items: STYLES.dash,
|
|
136
|
-
value: dash,
|
|
137
|
-
onValueChange: handleValueChange,
|
|
138
|
-
theme,
|
|
139
|
-
onHistoryMark
|
|
140
|
-
}
|
|
141
|
-
) })
|
|
142
|
-
] }),
|
|
143
|
-
size === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
144
|
-
showUiLabels && /* @__PURE__ */ jsx(StylePanelSubheading, { children: msg("style-panel.size") }),
|
|
145
|
-
/* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.size"), children: /* @__PURE__ */ jsx(
|
|
146
|
-
TldrawUiButtonPicker,
|
|
147
|
-
{
|
|
148
|
-
title: msg("style-panel.size"),
|
|
149
|
-
uiType: "size",
|
|
150
|
-
style: DefaultSizeStyle,
|
|
151
|
-
items: STYLES.size,
|
|
152
|
-
value: size,
|
|
153
|
-
onValueChange: (style, value) => {
|
|
154
|
-
handleValueChange(style, value);
|
|
155
|
-
const selectedShapeIds = editor.getSelectedShapeIds();
|
|
156
|
-
if (selectedShapeIds.length > 0) {
|
|
157
|
-
kickoutOccludedShapes(editor, selectedShapeIds);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
theme,
|
|
161
|
-
onHistoryMark
|
|
162
|
-
}
|
|
163
|
-
) })
|
|
164
|
-
] })
|
|
165
|
-
] })
|
|
166
|
-
] });
|
|
158
|
+
if (size === void 0) return null;
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
StylePanelButtonPicker,
|
|
161
|
+
{
|
|
162
|
+
title: msg("style-panel.size"),
|
|
163
|
+
uiType: "size",
|
|
164
|
+
style: DefaultSizeStyle,
|
|
165
|
+
items: STYLES.size,
|
|
166
|
+
value: size,
|
|
167
|
+
onValueChange: (style, value) => {
|
|
168
|
+
onValueChange(style, value);
|
|
169
|
+
const selectedShapeIds = editor.getSelectedShapeIds();
|
|
170
|
+
if (selectedShapeIds.length > 0) {
|
|
171
|
+
kickoutOccludedShapes(editor, selectedShapeIds);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
);
|
|
167
176
|
}
|
|
168
|
-
function
|
|
177
|
+
function StylePanelFontPicker() {
|
|
178
|
+
const { styles } = useStylePanelContext();
|
|
169
179
|
const msg = useTranslation();
|
|
170
|
-
const handleValueChange = useStyleChangeCallback();
|
|
171
|
-
const editor = useEditor();
|
|
172
|
-
const onHistoryMark = useCallback((id) => editor.markHistoryStoppingPoint(id), [editor]);
|
|
173
|
-
const showUiLabels = useValue("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
174
|
-
const labelStr = showUiLabels && msg("style-panel.font");
|
|
175
180
|
const font = styles.get(DefaultFontStyle);
|
|
181
|
+
if (font === void 0) return null;
|
|
182
|
+
return /* @__PURE__ */ jsx(
|
|
183
|
+
StylePanelButtonPicker,
|
|
184
|
+
{
|
|
185
|
+
title: msg("style-panel.font"),
|
|
186
|
+
uiType: "font",
|
|
187
|
+
style: DefaultFontStyle,
|
|
188
|
+
items: STYLES.font,
|
|
189
|
+
value: font
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
function StylePanelTextAlignPicker() {
|
|
194
|
+
const { styles } = useStylePanelContext();
|
|
195
|
+
const msg = useTranslation();
|
|
176
196
|
const textAlign = styles.get(DefaultTextAlignStyle);
|
|
197
|
+
if (textAlign === void 0) return null;
|
|
198
|
+
return /* @__PURE__ */ jsxs(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.align"), children: [
|
|
199
|
+
/* @__PURE__ */ jsx(
|
|
200
|
+
StylePanelButtonPicker,
|
|
201
|
+
{
|
|
202
|
+
title: msg("style-panel.align"),
|
|
203
|
+
uiType: "align",
|
|
204
|
+
style: DefaultTextAlignStyle,
|
|
205
|
+
items: STYLES.textAlign,
|
|
206
|
+
value: textAlign
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
/* @__PURE__ */ jsx(
|
|
210
|
+
TldrawUiToolbarButton,
|
|
211
|
+
{
|
|
212
|
+
type: "icon",
|
|
213
|
+
title: msg("style-panel.vertical-align"),
|
|
214
|
+
"data-testid": "vertical-align",
|
|
215
|
+
disabled: true,
|
|
216
|
+
children: /* @__PURE__ */ jsx(TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
] });
|
|
220
|
+
}
|
|
221
|
+
function StylePanelLabelAlignPicker() {
|
|
222
|
+
const { styles } = useStylePanelContext();
|
|
223
|
+
const msg = useTranslation();
|
|
177
224
|
const labelAlign = styles.get(DefaultHorizontalAlignStyle);
|
|
178
225
|
const verticalLabelAlign = styles.get(DefaultVerticalAlignStyle);
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
onHistoryMark
|
|
213
|
-
}
|
|
214
|
-
),
|
|
215
|
-
/* @__PURE__ */ jsx(
|
|
216
|
-
TldrawUiToolbarButton,
|
|
217
|
-
{
|
|
218
|
-
type: "icon",
|
|
219
|
-
title: msg("style-panel.vertical-align"),
|
|
220
|
-
"data-testid": "vertical-align",
|
|
221
|
-
disabled: true,
|
|
222
|
-
children: /* @__PURE__ */ jsx(TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
223
|
-
}
|
|
224
|
-
)
|
|
225
|
-
] })
|
|
226
|
-
] }),
|
|
227
|
-
labelAlign === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
228
|
-
showUiLabels && /* @__PURE__ */ jsx(StylePanelSubheading, { children: msg("style-panel.label-align") }),
|
|
229
|
-
/* @__PURE__ */ jsxs(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.label-align"), children: [
|
|
230
|
-
/* @__PURE__ */ jsx(
|
|
231
|
-
TldrawUiButtonPicker,
|
|
232
|
-
{
|
|
233
|
-
title: msg("style-panel.label-align"),
|
|
234
|
-
uiType: "align",
|
|
235
|
-
style: DefaultHorizontalAlignStyle,
|
|
236
|
-
items: STYLES.horizontalAlign,
|
|
237
|
-
value: labelAlign,
|
|
238
|
-
onValueChange: handleValueChange,
|
|
239
|
-
theme,
|
|
240
|
-
onHistoryMark
|
|
241
|
-
}
|
|
242
|
-
),
|
|
243
|
-
verticalLabelAlign === void 0 ? /* @__PURE__ */ jsx(
|
|
244
|
-
TldrawUiToolbarButton,
|
|
245
|
-
{
|
|
246
|
-
type: "icon",
|
|
247
|
-
title: msg("style-panel.vertical-align"),
|
|
248
|
-
"data-testid": "vertical-align",
|
|
249
|
-
disabled: true,
|
|
250
|
-
children: /* @__PURE__ */ jsx(TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
251
|
-
}
|
|
252
|
-
) : /* @__PURE__ */ jsx(
|
|
253
|
-
DropdownPicker,
|
|
254
|
-
{
|
|
255
|
-
type: "icon",
|
|
256
|
-
id: "geo-vertical-alignment",
|
|
257
|
-
uiType: "verticalAlign",
|
|
258
|
-
stylePanelType: "vertical-align",
|
|
259
|
-
style: DefaultVerticalAlignStyle,
|
|
260
|
-
items: STYLES.verticalAlign,
|
|
261
|
-
value: verticalLabelAlign,
|
|
262
|
-
onValueChange: handleValueChange
|
|
263
|
-
}
|
|
264
|
-
)
|
|
265
|
-
] })
|
|
266
|
-
] })
|
|
226
|
+
if (labelAlign === void 0) return null;
|
|
227
|
+
return /* @__PURE__ */ jsxs(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.label-align"), children: [
|
|
228
|
+
/* @__PURE__ */ jsx(
|
|
229
|
+
StylePanelButtonPicker,
|
|
230
|
+
{
|
|
231
|
+
title: msg("style-panel.label-align"),
|
|
232
|
+
uiType: "align",
|
|
233
|
+
style: DefaultHorizontalAlignStyle,
|
|
234
|
+
items: STYLES.horizontalAlign,
|
|
235
|
+
value: labelAlign
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
verticalLabelAlign === void 0 ? /* @__PURE__ */ jsx(
|
|
239
|
+
TldrawUiToolbarButton,
|
|
240
|
+
{
|
|
241
|
+
type: "icon",
|
|
242
|
+
title: msg("style-panel.vertical-align"),
|
|
243
|
+
"data-testid": "vertical-align",
|
|
244
|
+
disabled: true,
|
|
245
|
+
children: /* @__PURE__ */ jsx(TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
246
|
+
}
|
|
247
|
+
) : /* @__PURE__ */ jsx(
|
|
248
|
+
StylePanelDropdownPicker,
|
|
249
|
+
{
|
|
250
|
+
type: "icon",
|
|
251
|
+
id: "geo-vertical-alignment",
|
|
252
|
+
uiType: "verticalAlign",
|
|
253
|
+
stylePanelType: "vertical-align",
|
|
254
|
+
style: DefaultVerticalAlignStyle,
|
|
255
|
+
items: STYLES.verticalAlign,
|
|
256
|
+
value: verticalLabelAlign
|
|
257
|
+
}
|
|
258
|
+
)
|
|
267
259
|
] });
|
|
268
260
|
}
|
|
269
|
-
function
|
|
270
|
-
const
|
|
271
|
-
const handleValueChange = useStyleChangeCallback();
|
|
261
|
+
function StylePanelGeoShapePicker() {
|
|
262
|
+
const { styles } = useStylePanelContext();
|
|
272
263
|
const geo = styles.get(GeoShapeGeoStyle);
|
|
273
|
-
if (geo === void 0)
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
return /* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.geo"), children: /* @__PURE__ */ jsx(
|
|
277
|
-
DropdownPicker,
|
|
264
|
+
if (geo === void 0) return null;
|
|
265
|
+
return /* @__PURE__ */ jsx(
|
|
266
|
+
StylePanelDropdownPicker,
|
|
278
267
|
{
|
|
279
|
-
id: "geo",
|
|
280
|
-
type: "menu",
|
|
281
268
|
label: "style-panel.geo",
|
|
269
|
+
type: "menu",
|
|
270
|
+
id: "geo",
|
|
282
271
|
uiType: "geo",
|
|
283
272
|
stylePanelType: "geo",
|
|
284
273
|
style: GeoShapeGeoStyle,
|
|
285
274
|
items: STYLES.geo,
|
|
286
|
-
value: geo
|
|
287
|
-
onValueChange: handleValueChange
|
|
275
|
+
value: geo
|
|
288
276
|
}
|
|
289
|
-
)
|
|
290
|
-
}
|
|
291
|
-
function SplineStylePickerSet({ styles }) {
|
|
292
|
-
const msg = useTranslation();
|
|
293
|
-
const handleValueChange = useStyleChangeCallback();
|
|
294
|
-
const spline = styles.get(LineShapeSplineStyle);
|
|
295
|
-
if (spline === void 0) {
|
|
296
|
-
return null;
|
|
297
|
-
}
|
|
298
|
-
return /* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.spline"), children: /* @__PURE__ */ jsx(
|
|
299
|
-
DropdownPicker,
|
|
300
|
-
{
|
|
301
|
-
id: "spline",
|
|
302
|
-
type: "menu",
|
|
303
|
-
label: "style-panel.spline",
|
|
304
|
-
uiType: "spline",
|
|
305
|
-
stylePanelType: "spline",
|
|
306
|
-
style: LineShapeSplineStyle,
|
|
307
|
-
items: STYLES.spline,
|
|
308
|
-
value: spline,
|
|
309
|
-
onValueChange: handleValueChange
|
|
310
|
-
}
|
|
311
|
-
) });
|
|
277
|
+
);
|
|
312
278
|
}
|
|
313
|
-
function
|
|
314
|
-
const
|
|
315
|
-
const handleValueChange = useStyleChangeCallback();
|
|
279
|
+
function StylePanelArrowKindPicker() {
|
|
280
|
+
const { styles } = useStylePanelContext();
|
|
316
281
|
const arrowKind = styles.get(ArrowShapeKindStyle);
|
|
317
|
-
if (arrowKind === void 0)
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
return /* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.arrow-kind"), children: /* @__PURE__ */ jsx(
|
|
321
|
-
DropdownPicker,
|
|
282
|
+
if (arrowKind === void 0) return null;
|
|
283
|
+
return /* @__PURE__ */ jsx(
|
|
284
|
+
StylePanelDropdownPicker,
|
|
322
285
|
{
|
|
323
286
|
id: "arrow-kind",
|
|
324
287
|
type: "menu",
|
|
@@ -327,20 +290,17 @@ function ArrowStylePickerSet({ styles }) {
|
|
|
327
290
|
stylePanelType: "arrow-kind",
|
|
328
291
|
style: ArrowShapeKindStyle,
|
|
329
292
|
items: STYLES.arrowKind,
|
|
330
|
-
value: arrowKind
|
|
331
|
-
onValueChange: handleValueChange
|
|
293
|
+
value: arrowKind
|
|
332
294
|
}
|
|
333
|
-
)
|
|
295
|
+
);
|
|
334
296
|
}
|
|
335
|
-
function
|
|
336
|
-
const
|
|
297
|
+
function StylePanelArrowheadPicker() {
|
|
298
|
+
const { styles } = useStylePanelContext();
|
|
337
299
|
const arrowheadEnd = styles.get(ArrowShapeArrowheadEndStyle);
|
|
338
300
|
const arrowheadStart = styles.get(ArrowShapeArrowheadStartStyle);
|
|
339
|
-
if (
|
|
340
|
-
return null;
|
|
341
|
-
}
|
|
301
|
+
if (arrowheadEnd === void 0 || arrowheadStart === void 0) return null;
|
|
342
302
|
return /* @__PURE__ */ jsx(
|
|
343
|
-
|
|
303
|
+
StylePanelDoubleDropdownPicker,
|
|
344
304
|
{
|
|
345
305
|
label: "style-panel.arrowheads",
|
|
346
306
|
uiTypeA: "arrowheadStart",
|
|
@@ -351,66 +311,43 @@ function ArrowheadStylePickerSet({ styles }) {
|
|
|
351
311
|
styleB: ArrowShapeArrowheadEndStyle,
|
|
352
312
|
itemsB: STYLES.arrowheadEnd,
|
|
353
313
|
valueB: arrowheadEnd,
|
|
354
|
-
onValueChange: handleValueChange,
|
|
355
314
|
labelA: "style-panel.arrowhead-start",
|
|
356
315
|
labelB: "style-panel.arrowhead-end"
|
|
357
316
|
}
|
|
358
317
|
);
|
|
359
318
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
editor.updateInstanceState({ isChangingStyle: true });
|
|
377
|
-
});
|
|
378
|
-
trackEvent("set-style", { source: "style-panel", id: "opacity", value });
|
|
379
|
-
},
|
|
380
|
-
[editor, trackEvent]
|
|
381
|
-
);
|
|
382
|
-
if (opacity === void 0) return null;
|
|
383
|
-
const opacityIndex = opacity.type === "mixed" ? -1 : tldrawSupportedOpacities.indexOf(
|
|
384
|
-
minBy(
|
|
385
|
-
tldrawSupportedOpacities,
|
|
386
|
-
(supportedOpacity) => Math.abs(supportedOpacity - opacity.value)
|
|
387
|
-
)
|
|
319
|
+
function StylePanelSplinePicker() {
|
|
320
|
+
const { styles } = useStylePanelContext();
|
|
321
|
+
const spline = styles.get(LineShapeSplineStyle);
|
|
322
|
+
if (spline === void 0) return null;
|
|
323
|
+
return /* @__PURE__ */ jsx(
|
|
324
|
+
StylePanelDropdownPicker,
|
|
325
|
+
{
|
|
326
|
+
type: "menu",
|
|
327
|
+
id: "spline",
|
|
328
|
+
uiType: "spline",
|
|
329
|
+
stylePanelType: "spline",
|
|
330
|
+
label: "style-panel.spline",
|
|
331
|
+
style: LineShapeSplineStyle,
|
|
332
|
+
items: STYLES.spline,
|
|
333
|
+
value: spline
|
|
334
|
+
}
|
|
388
335
|
);
|
|
389
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
390
|
-
showUiLabels && /* @__PURE__ */ jsx(StylePanelSubheading, { children: msg("style-panel.opacity") }),
|
|
391
|
-
/* @__PURE__ */ jsx(
|
|
392
|
-
TldrawUiSlider,
|
|
393
|
-
{
|
|
394
|
-
"data-testid": "style.opacity",
|
|
395
|
-
value: opacityIndex >= 0 ? opacityIndex : tldrawSupportedOpacities.length - 1,
|
|
396
|
-
label: opacity.type === "mixed" ? "style-panel.mixed" : `opacity-style.${opacity.value}`,
|
|
397
|
-
onValueChange: handleOpacityValueChange,
|
|
398
|
-
steps: tldrawSupportedOpacities.length - 1,
|
|
399
|
-
title: msg("style-panel.opacity"),
|
|
400
|
-
onHistoryMark,
|
|
401
|
-
ariaValueModifier: 25
|
|
402
|
-
}
|
|
403
|
-
)
|
|
404
|
-
] });
|
|
405
336
|
}
|
|
406
337
|
export {
|
|
407
|
-
ArrowStylePickerSet,
|
|
408
|
-
ArrowheadStylePickerSet,
|
|
409
|
-
CommonStylePickerSet,
|
|
410
338
|
DefaultStylePanelContent,
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
339
|
+
StylePanelArrowKindPicker,
|
|
340
|
+
StylePanelArrowheadPicker,
|
|
341
|
+
StylePanelColorPicker,
|
|
342
|
+
StylePanelDashPicker,
|
|
343
|
+
StylePanelFillPicker,
|
|
344
|
+
StylePanelFontPicker,
|
|
345
|
+
StylePanelGeoShapePicker,
|
|
346
|
+
StylePanelLabelAlignPicker,
|
|
347
|
+
StylePanelOpacityPicker,
|
|
348
|
+
StylePanelSection,
|
|
349
|
+
StylePanelSizePicker,
|
|
350
|
+
StylePanelSplinePicker,
|
|
351
|
+
StylePanelTextAlignPicker
|
|
415
352
|
};
|
|
416
353
|
//# sourceMappingURL=DefaultStylePanelContent.mjs.map
|