tldraw 3.16.0-next.f9f54ec051f3 → 3.16.0-next.fe14f1b4181f
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 +222 -6
- package/dist-cjs/index.js +22 -1
- 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/canvas/TldrawScribble.js +1 -1
- package/dist-cjs/lib/canvas/TldrawScribble.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/ArrowShapeUtil.js +3 -3
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +1 -1
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/elbow/ElbowArrowDebug.js +3 -3
- package/dist-cjs/lib/shapes/arrow/elbow/ElbowArrowDebug.js.map +1 -1
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +3 -3
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js +1 -1
- package/dist-cjs/lib/shapes/embed/EmbedShapeUtil.js.map +1 -1
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +15 -12
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/components/FrameHeading.js +1 -1
- package/dist-cjs/lib/shapes/frame/components/FrameHeading.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js +2 -1
- package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js.map +2 -2
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +5 -1
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js +6 -3
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js +5 -1
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +4 -4
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/ShapeFill.js +4 -4
- package/dist-cjs/lib/shapes/shared/ShapeFill.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/freehand/svg.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +10 -1
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js +2 -2
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/video/VideoShapeUtil.js +3 -3
- package/dist-cjs/lib/shapes/video/VideoShapeUtil.js.map +1 -1
- 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/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/ui/TldrawUi.js +27 -12
- package/dist-cjs/lib/ui/TldrawUi.js.map +3 -3
- 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/AccessibilityMenu.js +35 -0
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +7 -0
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js +12 -3
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.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/DefaultMenuPanel.js +3 -2
- package/dist-cjs/lib/ui/components/DefaultMenuPanel.js.map +2 -2
- 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/MainMenu/DefaultMainMenuContent.js +3 -3
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js +4 -4
- package/dist-cjs/lib/ui/components/Minimap/MinimapManager.js.map +2 -2
- package/dist-cjs/lib/ui/components/MobileStylePanel.js +5 -3
- package/dist-cjs/lib/ui/components/MobileStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +1 -1
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +2 -1
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js +3 -2
- package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/UserPresenceColorPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +2 -0
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +171 -140
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js +3 -3
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js +26 -25
- package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js +1 -1
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js +66 -21
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +189 -80
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +5 -4
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +6 -0
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +5 -16
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +3 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js +3 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js.map +3 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +6 -4
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +30 -7
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +262 -0
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +7 -0
- package/dist-cjs/lib/ui/components/primitives/layout.js +76 -0
- package/dist-cjs/lib/ui/components/primitives/layout.js.map +7 -0
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuContext.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js +25 -12
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +154 -20
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +3 -2
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +31 -2
- 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 +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.js +94 -9
- 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 +4 -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-esm/index.d.mts +222 -6
- package/dist-esm/index.mjs +35 -2
- 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/canvas/TldrawScribble.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawScribble.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/ArrowShapeUtil.mjs +4 -3
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +1 -1
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/elbow/ElbowArrowDebug.mjs +3 -3
- package/dist-esm/lib/shapes/arrow/elbow/ElbowArrowDebug.mjs.map +1 -1
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +4 -3
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs +1 -1
- package/dist-esm/lib/shapes/embed/EmbedShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +16 -12
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs +1 -1
- package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +3 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs +2 -1
- package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs.map +2 -2
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +6 -1
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs +6 -3
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +6 -1
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +5 -4
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/ShapeFill.mjs +5 -4
- package/dist-esm/lib/shapes/shared/ShapeFill.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/freehand/svg.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +10 -1
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +3 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs +3 -3
- package/dist-esm/lib/shapes/video/VideoShapeUtil.mjs.map +1 -1
- 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/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/ui/TldrawUi.mjs +29 -14
- package/dist-esm/lib/ui/TldrawUi.mjs.map +3 -3
- 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/AccessibilityMenu.mjs +19 -0
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +7 -0
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs +12 -3
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.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/DefaultMenuPanel.mjs +3 -2
- package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs.map +2 -2
- 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/MainMenu/DefaultMainMenuContent.mjs +3 -5
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs +4 -4
- package/dist-esm/lib/ui/components/Minimap/MinimapManager.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MobileStylePanel.mjs +6 -3
- package/dist-esm/lib/ui/components/MobileStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +1 -1
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +2 -1
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs +3 -2
- package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs +2 -2
- package/dist-esm/lib/ui/components/SharePanel/UserPresenceColorPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +3 -1
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +171 -140
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs +3 -3
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs +26 -25
- package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs +1 -1
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs +56 -21
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +192 -81
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +3 -3
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +5 -4
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +6 -0
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +6 -6
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +1 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs +3 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +6 -4
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +30 -7
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +239 -0
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +7 -0
- package/dist-esm/lib/ui/components/primitives/layout.mjs +46 -0
- package/dist-esm/lib/ui/components/primitives/layout.mjs.map +7 -0
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuContext.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs +25 -12
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +162 -22
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +3 -2
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +31 -2
- 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 +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs +102 -10
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +4 -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/package.json +11 -34
- package/src/index.ts +26 -1
- package/src/lib/Tldraw.tsx +15 -2
- package/src/lib/canvas/TldrawScribble.tsx +1 -1
- 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/ArrowShapeUtil.tsx +4 -3
- package/src/lib/shapes/arrow/arrowTargetState.ts +2 -1
- package/src/lib/shapes/arrow/elbow/ElbowArrowDebug.tsx +3 -3
- package/src/lib/shapes/draw/DrawShapeTool.test.ts +0 -5
- package/src/lib/shapes/draw/DrawShapeUtil.tsx +4 -3
- package/src/lib/shapes/embed/EmbedShapeUtil.tsx +1 -1
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +25 -14
- package/src/lib/shapes/frame/components/FrameHeading.tsx +1 -1
- package/src/lib/shapes/geo/GeoShapeUtil.tsx +3 -2
- package/src/lib/shapes/geo/components/GeoShapeBody.tsx +2 -2
- package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +7 -1
- package/src/lib/shapes/image/ImageShapeUtil.tsx +6 -3
- package/src/lib/shapes/line/LineShapeUtil.test.tsx +4 -3
- package/src/lib/shapes/line/LineShapeUtil.tsx +6 -1
- package/src/lib/shapes/line/__snapshots__/LineShapeUtil.test.tsx.snap +2 -2
- package/src/lib/shapes/note/NoteShapeUtil.tsx +9 -4
- package/src/lib/shapes/shared/ShapeFill.tsx +5 -4
- package/src/lib/shapes/shared/freehand/svg.ts +2 -0
- package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +11 -1
- package/src/lib/shapes/text/TextShapeTool.test.ts +6 -5
- package/src/lib/shapes/text/TextShapeUtil.tsx +3 -2
- package/src/lib/shapes/video/VideoShapeUtil.tsx +3 -3
- package/src/lib/tools/EraserTool/childStates/Erasing.ts +34 -1
- package/src/lib/tools/EraserTool/childStates/Pointing.ts +20 -0
- package/src/lib/tools/SelectTool/childStates/Translating.ts +0 -1
- package/src/lib/ui/TldrawUi.tsx +33 -12
- package/src/lib/ui/assetUrls.ts +13 -10
- package/src/lib/ui/components/AccessibilityMenu.tsx +20 -0
- package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +15 -3
- package/src/lib/ui/components/{FollowingIndicator.tsx → DefaultFollowingIndicator.tsx} +2 -1
- package/src/lib/ui/components/DefaultMenuPanel.tsx +4 -3
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +6 -6
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +4 -4
- package/src/lib/ui/components/Minimap/MinimapManager.ts +4 -4
- package/src/lib/ui/components/MobileStylePanel.tsx +9 -6
- package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +1 -1
- package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +3 -2
- package/src/lib/ui/components/SharePanel/PeopleMenuItem.tsx +4 -3
- package/src/lib/ui/components/SharePanel/UserPresenceColorPicker.tsx +3 -3
- package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +3 -1
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +146 -107
- package/src/lib/ui/components/StylePanel/DoubleDropdownPicker.tsx +3 -3
- package/src/lib/ui/components/StylePanel/DropdownPicker.tsx +7 -6
- package/src/lib/ui/components/Toolbar/DefaultImageToolbarContent.tsx +1 -1
- package/src/lib/ui/components/Toolbar/DefaultToolbar.tsx +55 -23
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +212 -61
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +14 -11
- package/src/lib/ui/components/menu-items.tsx +8 -0
- package/src/lib/ui/components/primitives/TldrawUiButtonPicker.tsx +40 -37
- package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiPopover.tsx +4 -2
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +35 -30
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +51 -12
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +325 -0
- package/src/lib/ui/components/primitives/layout.tsx +107 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuContext.tsx +0 -1
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuGroup.tsx +29 -16
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +221 -19
- package/src/lib/ui/context/TldrawUiContextProvider.tsx +23 -20
- package/src/lib/ui/context/actions.tsx +31 -2
- package/src/lib/ui/context/components.tsx +3 -0
- package/src/lib/ui/context/events.tsx +2 -0
- package/src/lib/ui/hooks/useTools.tsx +140 -10
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +4 -0
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +4 -0
- package/src/lib/ui/kbd-utils.ts +10 -3
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +409 -292
- package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +5 -5
- 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 +17 -10
- 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/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/inner-outer-margin.test.ts +315 -0
- 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 +710 -580
- package/dist-cjs/lib/ui/components/FollowingIndicator.js.map +0 -7
- package/dist-esm/lib/ui/components/FollowingIndicator.mjs.map +0 -7
|
@@ -6,6 +6,7 @@ import { useUiEvents } from "../../context/events.mjs";
|
|
|
6
6
|
import { useTranslation } from "../../hooks/useTranslation/useTranslation.mjs";
|
|
7
7
|
import { TldrawUiButton } from "../primitives/Button/TldrawUiButton.mjs";
|
|
8
8
|
import { TldrawUiButtonIcon } from "../primitives/Button/TldrawUiButtonIcon.mjs";
|
|
9
|
+
import { TldrawUiGrid } from "../primitives/layout.mjs";
|
|
9
10
|
const UserPresenceColorPicker = track(function UserPresenceColorPicker2() {
|
|
10
11
|
const editor = useEditor();
|
|
11
12
|
const container = useContainer();
|
|
@@ -84,7 +85,7 @@ const UserPresenceColorPicker = track(function UserPresenceColorPicker2() {
|
|
|
84
85
|
align: "start",
|
|
85
86
|
side: "left",
|
|
86
87
|
sideOffset: 8,
|
|
87
|
-
children: /* @__PURE__ */ jsx(
|
|
88
|
+
children: /* @__PURE__ */ jsx(TldrawUiGrid, { children: USER_COLORS.map((item) => /* @__PURE__ */ jsx(
|
|
88
89
|
TldrawUiButton,
|
|
89
90
|
{
|
|
90
91
|
type: "icon",
|
|
@@ -93,7 +94,6 @@ const UserPresenceColorPicker = track(function UserPresenceColorPicker2() {
|
|
|
93
94
|
"aria-label": item,
|
|
94
95
|
isActive: value === item,
|
|
95
96
|
title: item,
|
|
96
|
-
className: "tlui-button-grid__button",
|
|
97
97
|
style: { color: item },
|
|
98
98
|
onPointerEnter: handleButtonPointerEnter,
|
|
99
99
|
onPointerDown: handleButtonPointerDown,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/lib/ui/components/SharePanel/UserPresenceColorPicker.tsx"],
|
|
4
|
-
"sourcesContent": ["import { USER_COLORS, track, useContainer, useEditor } from '@tldraw/editor'\nimport { Popover as _Popover } from 'radix-ui'\nimport React, { useCallback, useRef, useState } from 'react'\nimport { useUiEvents } from '../../context/events'\nimport { useTranslation } from '../../hooks/useTranslation/useTranslation'\nimport { TldrawUiButton } from '../primitives/Button/TldrawUiButton'\nimport { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'\n\nexport const UserPresenceColorPicker = track(function UserPresenceColorPicker() {\n\tconst editor = useEditor()\n\tconst container = useContainer()\n\tconst msg = useTranslation()\n\tconst trackEvent = useUiEvents()\n\n\tconst rPointing = useRef(false)\n\n\tconst [isOpen, setIsOpen] = useState(false)\n\tconst handleOpenChange = useCallback((isOpen: boolean) => {\n\t\tsetIsOpen(isOpen)\n\t}, [])\n\n\tconst value = editor.user.getColor()\n\n\tconst onValueChange = useCallback(\n\t\t(item: string) => {\n\t\t\teditor.user.updateUserPreferences({ color: item })\n\t\t\ttrackEvent('set-color', { source: 'people-menu' })\n\t\t},\n\t\t[editor, trackEvent]\n\t)\n\n\tconst {\n\t\thandleButtonClick,\n\t\thandleButtonPointerDown,\n\t\thandleButtonPointerEnter,\n\t\thandleButtonPointerUp,\n\t} = React.useMemo(() => {\n\t\tconst handlePointerUp = () => {\n\t\t\trPointing.current = false\n\t\t\twindow.removeEventListener('pointerup', handlePointerUp)\n\t\t}\n\n\t\tconst handleButtonClick = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tif (value === id) return\n\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\tconst handleButtonPointerDown = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\n\t\t\tonValueChange(id)\n\n\t\t\trPointing.current = true\n\t\t\twindow.addEventListener('pointerup', handlePointerUp) // see TLD-658\n\t\t}\n\n\t\tconst handleButtonPointerEnter = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tif (!rPointing.current) return\n\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\tconst handleButtonPointerUp = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\treturn {\n\t\t\thandleButtonClick,\n\t\t\thandleButtonPointerDown,\n\t\t\thandleButtonPointerEnter,\n\t\t\thandleButtonPointerUp,\n\t\t}\n\t}, [value, onValueChange])\n\n\treturn (\n\t\t<_Popover.Root onOpenChange={handleOpenChange} open={isOpen}>\n\t\t\t<_Popover.Trigger dir=\"ltr\" asChild>\n\t\t\t\t<TldrawUiButton\n\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\tclassName=\"tlui-people-menu__user__color\"\n\t\t\t\t\tstyle={{ color: editor.user.getColor() }}\n\t\t\t\t\ttitle={msg('people-menu.change-color')}\n\t\t\t\t>\n\t\t\t\t\t<TldrawUiButtonIcon icon=\"color\" />\n\t\t\t\t</TldrawUiButton>\n\t\t\t</_Popover.Trigger>\n\t\t\t<_Popover.Portal container={container}>\n\t\t\t\t<_Popover.Content\n\t\t\t\t\tdir=\"ltr\"\n\t\t\t\t\tclassName=\"tlui-menu tlui-people-menu__user__color-picker\"\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tside=\"left\"\n\t\t\t\t\tsideOffset={8}\n\t\t\t\t>\n\t\t\t\t\t<
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { USER_COLORS, track, useContainer, useEditor } from '@tldraw/editor'\nimport { Popover as _Popover } from 'radix-ui'\nimport React, { useCallback, useRef, useState } from 'react'\nimport { useUiEvents } from '../../context/events'\nimport { useTranslation } from '../../hooks/useTranslation/useTranslation'\nimport { TldrawUiButton } from '../primitives/Button/TldrawUiButton'\nimport { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'\nimport { TldrawUiGrid } from '../primitives/layout'\n\nexport const UserPresenceColorPicker = track(function UserPresenceColorPicker() {\n\tconst editor = useEditor()\n\tconst container = useContainer()\n\tconst msg = useTranslation()\n\tconst trackEvent = useUiEvents()\n\n\tconst rPointing = useRef(false)\n\n\tconst [isOpen, setIsOpen] = useState(false)\n\tconst handleOpenChange = useCallback((isOpen: boolean) => {\n\t\tsetIsOpen(isOpen)\n\t}, [])\n\n\tconst value = editor.user.getColor()\n\n\tconst onValueChange = useCallback(\n\t\t(item: string) => {\n\t\t\teditor.user.updateUserPreferences({ color: item })\n\t\t\ttrackEvent('set-color', { source: 'people-menu' })\n\t\t},\n\t\t[editor, trackEvent]\n\t)\n\n\tconst {\n\t\thandleButtonClick,\n\t\thandleButtonPointerDown,\n\t\thandleButtonPointerEnter,\n\t\thandleButtonPointerUp,\n\t} = React.useMemo(() => {\n\t\tconst handlePointerUp = () => {\n\t\t\trPointing.current = false\n\t\t\twindow.removeEventListener('pointerup', handlePointerUp)\n\t\t}\n\n\t\tconst handleButtonClick = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tif (value === id) return\n\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\tconst handleButtonPointerDown = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\n\t\t\tonValueChange(id)\n\n\t\t\trPointing.current = true\n\t\t\twindow.addEventListener('pointerup', handlePointerUp) // see TLD-658\n\t\t}\n\n\t\tconst handleButtonPointerEnter = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tif (!rPointing.current) return\n\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\tconst handleButtonPointerUp = (e: React.PointerEvent<HTMLButtonElement>) => {\n\t\t\tconst { id } = e.currentTarget.dataset\n\t\t\tif (!id) return\n\t\t\tonValueChange(id)\n\t\t}\n\n\t\treturn {\n\t\t\thandleButtonClick,\n\t\t\thandleButtonPointerDown,\n\t\t\thandleButtonPointerEnter,\n\t\t\thandleButtonPointerUp,\n\t\t}\n\t}, [value, onValueChange])\n\n\treturn (\n\t\t<_Popover.Root onOpenChange={handleOpenChange} open={isOpen}>\n\t\t\t<_Popover.Trigger dir=\"ltr\" asChild>\n\t\t\t\t<TldrawUiButton\n\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\tclassName=\"tlui-people-menu__user__color\"\n\t\t\t\t\tstyle={{ color: editor.user.getColor() }}\n\t\t\t\t\ttitle={msg('people-menu.change-color')}\n\t\t\t\t>\n\t\t\t\t\t<TldrawUiButtonIcon icon=\"color\" />\n\t\t\t\t</TldrawUiButton>\n\t\t\t</_Popover.Trigger>\n\t\t\t<_Popover.Portal container={container}>\n\t\t\t\t<_Popover.Content\n\t\t\t\t\tdir=\"ltr\"\n\t\t\t\t\tclassName=\"tlui-menu tlui-people-menu__user__color-picker\"\n\t\t\t\t\talign=\"start\"\n\t\t\t\t\tside=\"left\"\n\t\t\t\t\tsideOffset={8}\n\t\t\t\t>\n\t\t\t\t\t<TldrawUiGrid>\n\t\t\t\t\t\t{USER_COLORS.map((item: string) => (\n\t\t\t\t\t\t\t<TldrawUiButton\n\t\t\t\t\t\t\t\ttype=\"icon\"\n\t\t\t\t\t\t\t\tkey={item}\n\t\t\t\t\t\t\t\tdata-id={item}\n\t\t\t\t\t\t\t\tdata-testid={item}\n\t\t\t\t\t\t\t\taria-label={item}\n\t\t\t\t\t\t\t\tisActive={value === item}\n\t\t\t\t\t\t\t\ttitle={item}\n\t\t\t\t\t\t\t\tstyle={{ color: item }}\n\t\t\t\t\t\t\t\tonPointerEnter={handleButtonPointerEnter}\n\t\t\t\t\t\t\t\tonPointerDown={handleButtonPointerDown}\n\t\t\t\t\t\t\t\tonPointerUp={handleButtonPointerUp}\n\t\t\t\t\t\t\t\tonClick={handleButtonClick}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<TldrawUiButtonIcon icon=\"color\" />\n\t\t\t\t\t\t\t</TldrawUiButton>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</TldrawUiGrid>\n\t\t\t\t</_Popover.Content>\n\t\t\t</_Popover.Portal>\n\t\t</_Popover.Root>\n\t)\n})\n"],
|
|
5
|
+
"mappings": "AAoFE,SAQG,KARH;AApFF,SAAS,aAAa,OAAO,cAAc,iBAAiB;AAC5D,SAAS,WAAW,gBAAgB;AACpC,OAAO,SAAS,aAAa,QAAQ,gBAAgB;AACrD,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AACnC,SAAS,oBAAoB;AAEtB,MAAM,0BAA0B,MAAM,SAASA,2BAA0B;AAC/E,QAAM,SAAS,UAAU;AACzB,QAAM,YAAY,aAAa;AAC/B,QAAM,MAAM,eAAe;AAC3B,QAAM,aAAa,YAAY;AAE/B,QAAM,YAAY,OAAO,KAAK;AAE9B,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAC1C,QAAM,mBAAmB,YAAY,CAACC,YAAoB;AACzD,cAAUA,OAAM;AAAA,EACjB,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ,OAAO,KAAK,SAAS;AAEnC,QAAM,gBAAgB;AAAA,IACrB,CAAC,SAAiB;AACjB,aAAO,KAAK,sBAAsB,EAAE,OAAO,KAAK,CAAC;AACjD,iBAAW,aAAa,EAAE,QAAQ,cAAc,CAAC;AAAA,IAClD;AAAA,IACA,CAAC,QAAQ,UAAU;AAAA,EACpB;AAEA,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,MAAM,QAAQ,MAAM;AACvB,UAAM,kBAAkB,MAAM;AAC7B,gBAAU,UAAU;AACpB,aAAO,oBAAoB,aAAa,eAAe;AAAA,IACxD;AAEA,UAAMC,qBAAoB,CAAC,MAA6C;AACvE,YAAM,EAAE,GAAG,IAAI,EAAE,cAAc;AAC/B,UAAI,CAAC,GAAI;AACT,UAAI,UAAU,GAAI;AAElB,oBAAc,EAAE;AAAA,IACjB;AAEA,UAAMC,2BAA0B,CAAC,MAA6C;AAC7E,YAAM,EAAE,GAAG,IAAI,EAAE,cAAc;AAC/B,UAAI,CAAC,GAAI;AAET,oBAAc,EAAE;AAEhB,gBAAU,UAAU;AACpB,aAAO,iBAAiB,aAAa,eAAe;AAAA,IACrD;AAEA,UAAMC,4BAA2B,CAAC,MAA6C;AAC9E,UAAI,CAAC,UAAU,QAAS;AAExB,YAAM,EAAE,GAAG,IAAI,EAAE,cAAc;AAC/B,UAAI,CAAC,GAAI;AACT,oBAAc,EAAE;AAAA,IACjB;AAEA,UAAMC,yBAAwB,CAAC,MAA6C;AAC3E,YAAM,EAAE,GAAG,IAAI,EAAE,cAAc;AAC/B,UAAI,CAAC,GAAI;AACT,oBAAc,EAAE;AAAA,IACjB;AAEA,WAAO;AAAA,MACN,mBAAAH;AAAA,MACA,yBAAAC;AAAA,MACA,0BAAAC;AAAA,MACA,uBAAAC;AAAA,IACD;AAAA,EACD,GAAG,CAAC,OAAO,aAAa,CAAC;AAEzB,SACC,qBAAC,SAAS,MAAT,EAAc,cAAc,kBAAkB,MAAM,QACpD;AAAA,wBAAC,SAAS,SAAT,EAAiB,KAAI,OAAM,SAAO,MAClC;AAAA,MAAC;AAAA;AAAA,QACA,MAAK;AAAA,QACL,WAAU;AAAA,QACV,OAAO,EAAE,OAAO,OAAO,KAAK,SAAS,EAAE;AAAA,QACvC,OAAO,IAAI,0BAA0B;AAAA,QAErC,8BAAC,sBAAmB,MAAK,SAAQ;AAAA;AAAA,IAClC,GACD;AAAA,IACA,oBAAC,SAAS,QAAT,EAAgB,WAChB;AAAA,MAAC,SAAS;AAAA,MAAT;AAAA,QACA,KAAI;AAAA,QACJ,WAAU;AAAA,QACV,OAAM;AAAA,QACN,MAAK;AAAA,QACL,YAAY;AAAA,QAEZ,8BAAC,gBACC,sBAAY,IAAI,CAAC,SACjB;AAAA,UAAC;AAAA;AAAA,YACA,MAAK;AAAA,YAEL,WAAS;AAAA,YACT,eAAa;AAAA,YACb,cAAY;AAAA,YACZ,UAAU,UAAU;AAAA,YACpB,OAAO;AAAA,YACP,OAAO,EAAE,OAAO,KAAK;AAAA,YACrB,gBAAgB;AAAA,YAChB,eAAe;AAAA,YACf,aAAa;AAAA,YACb,SAAS;AAAA,YAET,8BAAC,sBAAmB,MAAK,SAAQ;AAAA;AAAA,UAZ5B;AAAA,QAaN,CACA,GACF;AAAA;AAAA,IACD,GACD;AAAA,KACD;AAEF,CAAC;",
|
|
6
6
|
"names": ["UserPresenceColorPicker", "isOpen", "handleButtonClick", "handleButtonPointerDown", "handleButtonPointerEnter", "handleButtonPointerUp"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEditor, usePassThroughWheelEvents } from "@tldraw/editor";
|
|
2
|
+
import { useEditor, usePassThroughWheelEvents, useValue } from "@tldraw/editor";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { memo, useCallback, useEffect, useRef } from "react";
|
|
5
5
|
import { useRelevantStyles } from "../../hooks/useRelevantStyles.mjs";
|
|
@@ -9,6 +9,7 @@ const DefaultStylePanel = memo(function DefaultStylePanel2({
|
|
|
9
9
|
children
|
|
10
10
|
}) {
|
|
11
11
|
const editor = useEditor();
|
|
12
|
+
const showUiLabels = useValue("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
12
13
|
const ref = useRef(null);
|
|
13
14
|
usePassThroughWheelEvents(ref);
|
|
14
15
|
const styles = useRelevantStyles();
|
|
@@ -37,6 +38,7 @@ const DefaultStylePanel = memo(function DefaultStylePanel2({
|
|
|
37
38
|
ref,
|
|
38
39
|
className: classNames("tlui-style-panel", { "tlui-style-panel__wrapper": !isMobile }),
|
|
39
40
|
"data-ismobile": isMobile,
|
|
41
|
+
"data-show-ui-labels": showUiLabels,
|
|
40
42
|
onPointerLeave: handlePointerOut,
|
|
41
43
|
children: content
|
|
42
44
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/lib/ui/components/StylePanel/DefaultStylePanel.tsx"],
|
|
4
|
-
"sourcesContent": ["import { useEditor, usePassThroughWheelEvents } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { ReactNode, memo, useCallback, useEffect, useRef } from 'react'\nimport { useRelevantStyles } from '../../hooks/useRelevantStyles'\nimport { DefaultStylePanelContent } from './DefaultStylePanelContent'\n\n/** @public */\nexport interface TLUiStylePanelProps {\n\tisMobile?: boolean\n\tchildren?: ReactNode\n}\n\n/** @public @react */\nexport const DefaultStylePanel = memo(function DefaultStylePanel({\n\tisMobile,\n\tchildren,\n}: TLUiStylePanelProps) {\n\tconst editor = useEditor()\n\n\tconst ref = useRef<HTMLDivElement>(null)\n\tusePassThroughWheelEvents(ref)\n\n\tconst styles = useRelevantStyles()\n\n\tconst handlePointerOut = useCallback(() => {\n\t\tif (!isMobile) {\n\t\t\teditor.updateInstanceState({ isChangingStyle: false })\n\t\t}\n\t}, [editor, isMobile])\n\n\tconst content = children ?? <DefaultStylePanelContent styles={styles} />\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.key === 'Escape' && ref.current?.contains(document.activeElement)) {\n\t\t\t\tevent.stopPropagation()\n\t\t\t\teditor.getContainer().focus()\n\t\t\t}\n\t\t}\n\n\t\tconst stylePanelContainerEl = ref.current\n\t\tstylePanelContainerEl?.addEventListener('keydown', handleKeyDown, { capture: true })\n\t\treturn () => {\n\t\t\tstylePanelContainerEl?.removeEventListener('keydown', handleKeyDown, { capture: true })\n\t\t}\n\t}, [editor])\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={classNames('tlui-style-panel', { 'tlui-style-panel__wrapper': !isMobile })}\n\t\t\tdata-ismobile={isMobile}\n\t\t\tonPointerLeave={handlePointerOut}\n\t\t>\n\t\t\t{content}\n\t\t</div>\n\t)\n})\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { useEditor, usePassThroughWheelEvents, useValue } from '@tldraw/editor'\nimport classNames from 'classnames'\nimport { ReactNode, memo, useCallback, useEffect, useRef } from 'react'\nimport { useRelevantStyles } from '../../hooks/useRelevantStyles'\nimport { DefaultStylePanelContent } from './DefaultStylePanelContent'\n\n/** @public */\nexport interface TLUiStylePanelProps {\n\tisMobile?: boolean\n\tchildren?: ReactNode\n}\n\n/** @public @react */\nexport const DefaultStylePanel = memo(function DefaultStylePanel({\n\tisMobile,\n\tchildren,\n}: TLUiStylePanelProps) {\n\tconst editor = useEditor()\n\tconst showUiLabels = useValue('showUiLabels', () => editor.user.getShowUiLabels(), [editor])\n\n\tconst ref = useRef<HTMLDivElement>(null)\n\tusePassThroughWheelEvents(ref)\n\n\tconst styles = useRelevantStyles()\n\n\tconst handlePointerOut = useCallback(() => {\n\t\tif (!isMobile) {\n\t\t\teditor.updateInstanceState({ isChangingStyle: false })\n\t\t}\n\t}, [editor, isMobile])\n\n\tconst content = children ?? <DefaultStylePanelContent styles={styles} />\n\n\tuseEffect(() => {\n\t\tfunction handleKeyDown(event: KeyboardEvent) {\n\t\t\tif (event.key === 'Escape' && ref.current?.contains(document.activeElement)) {\n\t\t\t\tevent.stopPropagation()\n\t\t\t\teditor.getContainer().focus()\n\t\t\t}\n\t\t}\n\n\t\tconst stylePanelContainerEl = ref.current\n\t\tstylePanelContainerEl?.addEventListener('keydown', handleKeyDown, { capture: true })\n\t\treturn () => {\n\t\t\tstylePanelContainerEl?.removeEventListener('keydown', handleKeyDown, { capture: true })\n\t\t}\n\t}, [editor])\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={classNames('tlui-style-panel', { 'tlui-style-panel__wrapper': !isMobile })}\n\t\t\tdata-ismobile={isMobile}\n\t\t\tdata-show-ui-labels={showUiLabels}\n\t\t\tonPointerLeave={handlePointerOut}\n\t\t>\n\t\t\t{content}\n\t\t</div>\n\t)\n})\n"],
|
|
5
|
+
"mappings": "AA+B6B;AA/B7B,SAAS,WAAW,2BAA2B,gBAAgB;AAC/D,OAAO,gBAAgB;AACvB,SAAoB,MAAM,aAAa,WAAW,cAAc;AAChE,SAAS,yBAAyB;AAClC,SAAS,gCAAgC;AASlC,MAAM,oBAAoB,KAAK,SAASA,mBAAkB;AAAA,EAChE;AAAA,EACA;AACD,GAAwB;AACvB,QAAM,SAAS,UAAU;AACzB,QAAM,eAAe,SAAS,gBAAgB,MAAM,OAAO,KAAK,gBAAgB,GAAG,CAAC,MAAM,CAAC;AAE3F,QAAM,MAAM,OAAuB,IAAI;AACvC,4BAA0B,GAAG;AAE7B,QAAM,SAAS,kBAAkB;AAEjC,QAAM,mBAAmB,YAAY,MAAM;AAC1C,QAAI,CAAC,UAAU;AACd,aAAO,oBAAoB,EAAE,iBAAiB,MAAM,CAAC;AAAA,IACtD;AAAA,EACD,GAAG,CAAC,QAAQ,QAAQ,CAAC;AAErB,QAAM,UAAU,YAAY,oBAAC,4BAAyB,QAAgB;AAEtE,YAAU,MAAM;AACf,aAAS,cAAc,OAAsB;AAC5C,UAAI,MAAM,QAAQ,YAAY,IAAI,SAAS,SAAS,SAAS,aAAa,GAAG;AAC5E,cAAM,gBAAgB;AACtB,eAAO,aAAa,EAAE,MAAM;AAAA,MAC7B;AAAA,IACD;AAEA,UAAM,wBAAwB,IAAI;AAClC,2BAAuB,iBAAiB,WAAW,eAAe,EAAE,SAAS,KAAK,CAAC;AACnF,WAAO,MAAM;AACZ,6BAAuB,oBAAoB,WAAW,eAAe,EAAE,SAAS,KAAK,CAAC;AAAA,IACvF;AAAA,EACD,GAAG,CAAC,MAAM,CAAC;AAEX,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,WAAW,WAAW,oBAAoB,EAAE,6BAA6B,CAAC,SAAS,CAAC;AAAA,MACpF,iBAAe;AAAA,MACf,uBAAqB;AAAA,MACrB,gBAAgB;AAAA,MAEf;AAAA;AAAA,EACF;AAEF,CAAC;",
|
|
6
6
|
"names": ["DefaultStylePanel"]
|
|
7
7
|
}
|
|
@@ -30,6 +30,9 @@ import { TldrawUiSlider } from "../primitives/TldrawUiSlider.mjs";
|
|
|
30
30
|
import { TldrawUiToolbar, TldrawUiToolbarButton } from "../primitives/TldrawUiToolbar.mjs";
|
|
31
31
|
import { DoubleDropdownPicker } from "./DoubleDropdownPicker.mjs";
|
|
32
32
|
import { DropdownPicker } from "./DropdownPicker.mjs";
|
|
33
|
+
function StylePanelSubheading({ children }) {
|
|
34
|
+
return /* @__PURE__ */ jsx("h3", { className: "tlui-style-panel__subheading", children });
|
|
35
|
+
}
|
|
33
36
|
function DefaultStylePanelContent({ styles }) {
|
|
34
37
|
const isDarkMode = useIsDarkMode();
|
|
35
38
|
if (!styles) return null;
|
|
@@ -77,6 +80,7 @@ function CommonStylePickerSet({ styles, theme }) {
|
|
|
77
80
|
const msg = useTranslation();
|
|
78
81
|
const editor = useEditor();
|
|
79
82
|
const onHistoryMark = useCallback((id) => editor.markHistoryStoppingPoint(id), [editor]);
|
|
83
|
+
const showUiLabels = useValue("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
80
84
|
const handleValueChange = useStyleChangeCallback();
|
|
81
85
|
const color = styles.get(DefaultColorStyle);
|
|
82
86
|
const fill = styles.get(DefaultFillStyle);
|
|
@@ -85,67 +89,79 @@ function CommonStylePickerSet({ styles, theme }) {
|
|
|
85
89
|
const showPickers = fill !== void 0 || dash !== void 0 || size !== void 0;
|
|
86
90
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
87
91
|
/* @__PURE__ */ jsxs("div", { className: "tlui-style-panel__section__common", "data-testid": "style.panel", children: [
|
|
88
|
-
color === void 0 ? null : /* @__PURE__ */
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
color === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
93
|
+
showUiLabels && /* @__PURE__ */ jsx(StylePanelSubheading, { children: msg("style-panel.color") }),
|
|
94
|
+
/* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.color"), children: /* @__PURE__ */ jsx(
|
|
95
|
+
TldrawUiButtonPicker,
|
|
96
|
+
{
|
|
97
|
+
title: msg("style-panel.color"),
|
|
98
|
+
uiType: "color",
|
|
99
|
+
style: DefaultColorStyle,
|
|
100
|
+
items: STYLES.color,
|
|
101
|
+
value: color,
|
|
102
|
+
onValueChange: handleValueChange,
|
|
103
|
+
theme,
|
|
104
|
+
onHistoryMark
|
|
105
|
+
}
|
|
106
|
+
) })
|
|
107
|
+
] }),
|
|
101
108
|
/* @__PURE__ */ jsx(OpacitySlider, {})
|
|
102
109
|
] }),
|
|
103
110
|
showPickers && /* @__PURE__ */ jsxs("div", { className: "tlui-style-panel__section", children: [
|
|
104
|
-
fill === void 0 ? null : /* @__PURE__ */
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
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
|
+
] })
|
|
149
165
|
] })
|
|
150
166
|
] });
|
|
151
167
|
}
|
|
@@ -154,6 +170,8 @@ function TextStylePickerSet({ theme, styles }) {
|
|
|
154
170
|
const handleValueChange = useStyleChangeCallback();
|
|
155
171
|
const editor = useEditor();
|
|
156
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");
|
|
157
175
|
const font = styles.get(DefaultFontStyle);
|
|
158
176
|
const textAlign = styles.get(DefaultTextAlignStyle);
|
|
159
177
|
const labelAlign = styles.get(DefaultHorizontalAlignStyle);
|
|
@@ -162,80 +180,89 @@ function TextStylePickerSet({ theme, styles }) {
|
|
|
162
180
|
return null;
|
|
163
181
|
}
|
|
164
182
|
return /* @__PURE__ */ jsxs("div", { className: "tlui-style-panel__section", children: [
|
|
165
|
-
font === void 0 ? null : /* @__PURE__ */
|
|
166
|
-
|
|
167
|
-
{
|
|
168
|
-
title: msg("style-panel.font"),
|
|
169
|
-
uiType: "font",
|
|
170
|
-
style: DefaultFontStyle,
|
|
171
|
-
items: STYLES.font,
|
|
172
|
-
value: font,
|
|
173
|
-
onValueChange: handleValueChange,
|
|
174
|
-
theme,
|
|
175
|
-
onHistoryMark
|
|
176
|
-
}
|
|
177
|
-
) }),
|
|
178
|
-
textAlign === void 0 ? null : /* @__PURE__ */ jsxs(TldrawUiToolbar, { label: msg("style-panel.align"), className: "tlui-style-panel__row", children: [
|
|
179
|
-
/* @__PURE__ */ jsx(
|
|
183
|
+
font === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
184
|
+
labelStr && /* @__PURE__ */ jsx(StylePanelSubheading, { children: labelStr }),
|
|
185
|
+
/* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.font"), children: /* @__PURE__ */ jsx(
|
|
180
186
|
TldrawUiButtonPicker,
|
|
181
187
|
{
|
|
182
|
-
title: msg("style-panel.
|
|
183
|
-
uiType: "
|
|
184
|
-
style:
|
|
185
|
-
items: STYLES.
|
|
186
|
-
value:
|
|
188
|
+
title: msg("style-panel.font"),
|
|
189
|
+
uiType: "font",
|
|
190
|
+
style: DefaultFontStyle,
|
|
191
|
+
items: STYLES.font,
|
|
192
|
+
value: font,
|
|
187
193
|
onValueChange: handleValueChange,
|
|
188
194
|
theme,
|
|
189
195
|
onHistoryMark
|
|
190
196
|
}
|
|
191
|
-
),
|
|
192
|
-
/* @__PURE__ */ jsx("div", { className: "tlui-style-panel__row__extra-button", children: /* @__PURE__ */ jsx(
|
|
193
|
-
TldrawUiToolbarButton,
|
|
194
|
-
{
|
|
195
|
-
type: "icon",
|
|
196
|
-
title: msg("style-panel.vertical-align"),
|
|
197
|
-
"data-testid": "vertical-align",
|
|
198
|
-
disabled: true,
|
|
199
|
-
children: /* @__PURE__ */ jsx(TldrawUiButtonIcon, { icon: "vertical-align-middle" })
|
|
200
|
-
}
|
|
201
197
|
) })
|
|
202
198
|
] }),
|
|
203
|
-
|
|
204
|
-
/* @__PURE__ */ jsx(
|
|
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
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
199
|
+
textAlign === void 0 ? null : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
200
|
+
showUiLabels && /* @__PURE__ */ jsx(StylePanelSubheading, { children: msg("style-panel.align") }),
|
|
201
|
+
/* @__PURE__ */ jsxs(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.align"), children: [
|
|
202
|
+
/* @__PURE__ */ jsx(
|
|
203
|
+
TldrawUiButtonPicker,
|
|
204
|
+
{
|
|
205
|
+
title: msg("style-panel.align"),
|
|
206
|
+
uiType: "align",
|
|
207
|
+
style: DefaultTextAlignStyle,
|
|
208
|
+
items: STYLES.textAlign,
|
|
209
|
+
value: textAlign,
|
|
210
|
+
onValueChange: handleValueChange,
|
|
211
|
+
theme,
|
|
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
|
+
] })
|
|
239
266
|
] })
|
|
240
267
|
] });
|
|
241
268
|
}
|
|
@@ -246,7 +273,7 @@ function GeoStylePickerSet({ styles }) {
|
|
|
246
273
|
if (geo === void 0) {
|
|
247
274
|
return null;
|
|
248
275
|
}
|
|
249
|
-
return /* @__PURE__ */ jsx(TldrawUiToolbar, { label: msg("style-panel.geo"), children: /* @__PURE__ */ jsx(
|
|
276
|
+
return /* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.geo"), children: /* @__PURE__ */ jsx(
|
|
250
277
|
DropdownPicker,
|
|
251
278
|
{
|
|
252
279
|
id: "geo",
|
|
@@ -268,7 +295,7 @@ function SplineStylePickerSet({ styles }) {
|
|
|
268
295
|
if (spline === void 0) {
|
|
269
296
|
return null;
|
|
270
297
|
}
|
|
271
|
-
return /* @__PURE__ */ jsx(TldrawUiToolbar, { label: msg("style-panel.spline"), children: /* @__PURE__ */ jsx(
|
|
298
|
+
return /* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.spline"), children: /* @__PURE__ */ jsx(
|
|
272
299
|
DropdownPicker,
|
|
273
300
|
{
|
|
274
301
|
id: "spline",
|
|
@@ -290,7 +317,7 @@ function ArrowStylePickerSet({ styles }) {
|
|
|
290
317
|
if (arrowKind === void 0) {
|
|
291
318
|
return null;
|
|
292
319
|
}
|
|
293
|
-
return /* @__PURE__ */ jsx(TldrawUiToolbar, { label: msg("style-panel.arrow-kind"), children: /* @__PURE__ */ jsx(
|
|
320
|
+
return /* @__PURE__ */ jsx(TldrawUiToolbar, { orientation: "horizontal", label: msg("style-panel.arrow-kind"), children: /* @__PURE__ */ jsx(
|
|
294
321
|
DropdownPicker,
|
|
295
322
|
{
|
|
296
323
|
id: "arrow-kind",
|
|
@@ -334,6 +361,7 @@ const tldrawSupportedOpacities = [0.1, 0.25, 0.5, 0.75, 1];
|
|
|
334
361
|
function OpacitySlider() {
|
|
335
362
|
const editor = useEditor();
|
|
336
363
|
const onHistoryMark = useCallback((id) => editor.markHistoryStoppingPoint(id), [editor]);
|
|
364
|
+
const showUiLabels = useValue("showUiLabels", () => editor.user.getShowUiLabels(), [editor]);
|
|
337
365
|
const opacity = useValue("opacity", () => editor.getSharedOpacity(), [editor]);
|
|
338
366
|
const trackEvent = useUiEvents();
|
|
339
367
|
const msg = useTranslation();
|
|
@@ -358,19 +386,22 @@ function OpacitySlider() {
|
|
|
358
386
|
(supportedOpacity) => Math.abs(supportedOpacity - opacity.value)
|
|
359
387
|
)
|
|
360
388
|
);
|
|
361
|
-
return /* @__PURE__ */
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
+
] });
|
|
374
405
|
}
|
|
375
406
|
export {
|
|
376
407
|
ArrowStylePickerSet,
|