tldraw 3.16.0-canary.fa3749606e52 → 3.16.0-canary.fe4babe9c1ad
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 +328 -109
- package/dist-cjs/index.js +45 -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/canvas/TldrawScribble.js +1 -1
- package/dist-cjs/lib/canvas/TldrawScribble.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +15 -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/arrowLabel.js +6 -0
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +3 -3
- 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/bookmark/BookmarkShapeUtil.js +4 -4
- package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js.map +2 -2
- 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 +20 -13
- 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/frame/components/FrameLabelInput.js +2 -2
- package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +3 -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 +6 -5
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/HyperlinkButton.js +4 -4
- package/dist-cjs/lib/shapes/shared/HyperlinkButton.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +1 -3
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/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/useEditablePlainText.js +3 -4
- package/dist-cjs/lib/shapes/shared/useEditablePlainText.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/useImageOrVideoAsset.js +0 -2
- package/dist-cjs/lib/shapes/shared/useImageOrVideoAsset.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +10 -1
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
- package/dist-cjs/lib/shapes/text/PlainTextArea.js +2 -2
- package/dist-cjs/lib/shapes/text/PlainTextArea.js.map +2 -2
- package/dist-cjs/lib/shapes/text/RichTextArea.js +3 -3
- package/dist-cjs/lib/shapes/text/RichTextArea.js.map +2 -2
- package/dist-cjs/lib/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/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/A11y.js +1 -1
- package/dist-cjs/lib/ui/components/A11y.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/LanguageMenu.js +1 -0
- package/dist-cjs/lib/ui/components/LanguageMenu.js.map +2 -2
- 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/DefaultMinimap.js +1 -0
- package/dist-cjs/lib/ui/components/Minimap/DefaultMinimap.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 +3 -2
- 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 +11 -4
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +249 -279
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js +147 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js.map +7 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelContext.js +68 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelContext.js.map +7 -0
- package/dist-cjs/lib/ui/components/StylePanel/{DoubleDropdownPicker.js → StylePanelDoubleDropdownPicker.js} +26 -25
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.js.map +7 -0
- package/dist-cjs/lib/ui/components/StylePanel/{DropdownPicker.js → StylePanelDropdownPicker.js} +47 -43
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelDropdownPicker.js.map +7 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelSubheading.js +28 -0
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelSubheading.js.map +7 -0
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js +2 -0
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js +39 -10
- 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/DefaultVideoToolbarContent.js +15 -3
- package/dist-cjs/lib/ui/components/Toolbar/DefaultVideoToolbarContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js +2 -1
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +189 -80
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +10 -5
- 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/TldrawUiContextualToolbar.js +11 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js +5 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/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 +18 -5
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +33 -7
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +306 -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/TldrawUiMenuCheckboxItem.js +3 -0
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/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 +17 -31
- 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 +44 -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 +2 -2
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +1 -1
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useExportAs.js +3 -2
- package/dist-cjs/lib/ui/hooks/useExportAs.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.js +22 -4
- package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +8 -1
- 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 +328 -109
- package/dist-esm/index.mjs +83 -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/canvas/TldrawScribble.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawScribble.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +15 -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/arrowLabel.mjs +6 -0
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +3 -3
- 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/bookmark/BookmarkShapeUtil.mjs +5 -5
- package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs.map +2 -2
- 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 +21 -13
- 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/frame/components/FrameLabelInput.mjs +3 -3
- package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +4 -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 +7 -5
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs +5 -5
- package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +1 -3
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/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/useEditablePlainText.mjs +4 -5
- package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/useImageOrVideoAsset.mjs +0 -2
- package/dist-esm/lib/shapes/shared/useImageOrVideoAsset.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +10 -1
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/PlainTextArea.mjs +3 -3
- package/dist-esm/lib/shapes/text/PlainTextArea.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/RichTextArea.mjs +3 -4
- package/dist-esm/lib/shapes/text/RichTextArea.mjs.map +2 -2
- package/dist-esm/lib/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/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/A11y.mjs +2 -2
- package/dist-esm/lib/ui/components/A11y.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/LanguageMenu.mjs +1 -0
- package/dist-esm/lib/ui/components/LanguageMenu.mjs.map +2 -2
- 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/DefaultMinimap.mjs +1 -0
- package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.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 +4 -3
- 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 +16 -5
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +251 -283
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs +135 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs.map +7 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelContext.mjs +48 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelContext.mjs.map +7 -0
- package/dist-esm/lib/ui/components/StylePanel/{DoubleDropdownPicker.mjs → StylePanelDoubleDropdownPicker.mjs} +23 -22
- package/dist-esm/lib/ui/components/StylePanel/StylePanelDoubleDropdownPicker.mjs.map +7 -0
- package/dist-esm/lib/ui/components/StylePanel/{DropdownPicker.mjs → StylePanelDropdownPicker.mjs} +44 -40
- package/dist-esm/lib/ui/components/StylePanel/StylePanelDropdownPicker.mjs.map +7 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelSubheading.mjs +8 -0
- package/dist-esm/lib/ui/components/StylePanel/StylePanelSubheading.mjs.map +7 -0
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs +2 -0
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs +39 -10
- 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/DefaultVideoToolbarContent.mjs +15 -3
- package/dist-esm/lib/ui/components/Toolbar/DefaultVideoToolbarContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +2 -1
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +192 -81
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +3 -3
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +10 -5
- 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/TldrawUiContextualToolbar.mjs +12 -3
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs +6 -4
- package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/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 +18 -5
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +33 -7
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +284 -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/TldrawUiMenuCheckboxItem.mjs +3 -0
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/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 +17 -31
- 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 +44 -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 +2 -2
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +2 -2
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useExportAs.mjs +3 -2
- package/dist-esm/lib/ui/hooks/useExportAs.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs +23 -4
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +8 -1
- 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 +62 -22
- package/src/lib/Tldraw.tsx +15 -2
- package/src/lib/canvas/TldrawScribble.tsx +1 -1
- package/src/lib/defaultExternalContentHandlers.ts +26 -4
- package/src/lib/shapes/arrow/ArrowShapeOptions.test.ts +2 -1
- package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +6 -5
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +48 -6
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +4 -3
- package/src/lib/shapes/arrow/arrowLabel.ts +8 -0
- package/src/lib/shapes/arrow/arrowTargetState.ts +2 -1
- package/src/lib/shapes/arrow/elbow/ElbowArrowDebug.tsx +3 -3
- package/src/lib/shapes/bookmark/BookmarkShapeUtil.tsx +5 -5
- 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 +30 -14
- package/src/lib/shapes/frame/components/FrameHeading.tsx +1 -1
- package/src/lib/shapes/frame/components/FrameLabelInput.tsx +3 -3
- package/src/lib/shapes/geo/GeoShapeUtil.tsx +4 -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 +10 -4
- package/src/lib/shapes/shared/HyperlinkButton.tsx +5 -5
- package/src/lib/shapes/shared/PlainTextLabel.tsx +0 -6
- package/src/lib/shapes/shared/ShapeFill.tsx +5 -4
- package/src/lib/shapes/shared/freehand/svg.ts +2 -0
- package/src/lib/shapes/shared/useEditablePlainText.ts +5 -9
- package/src/lib/shapes/shared/useImageOrVideoAsset.ts +0 -7
- package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +11 -1
- package/src/lib/shapes/text/PlainTextArea.tsx +3 -3
- package/src/lib/shapes/text/RichTextArea.tsx +3 -4
- 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/ui/TldrawUi.tsx +33 -12
- package/src/lib/ui/assetUrls.ts +13 -10
- package/src/lib/ui/components/A11y.tsx +2 -2
- 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/LanguageMenu.tsx +1 -0
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +4 -4
- package/src/lib/ui/components/Minimap/DefaultMinimap.tsx +1 -0
- 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 +5 -4
- 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 +28 -12
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +261 -343
- package/src/lib/ui/components/{primitives/TldrawUiButtonPicker.tsx → StylePanel/StylePanelButtonPicker.tsx} +73 -50
- package/src/lib/ui/components/StylePanel/StylePanelContext.tsx +63 -0
- package/src/lib/ui/components/StylePanel/{DoubleDropdownPicker.tsx → StylePanelDoubleDropdownPicker.tsx} +31 -22
- package/src/lib/ui/components/StylePanel/StylePanelDropdownPicker.tsx +119 -0
- package/src/lib/ui/components/StylePanel/StylePanelSubheading.tsx +9 -0
- package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +2 -0
- package/src/lib/ui/components/Toolbar/DefaultImageToolbarContent.tsx +33 -16
- package/src/lib/ui/components/Toolbar/DefaultToolbar.tsx +55 -23
- package/src/lib/ui/components/Toolbar/DefaultVideoToolbarContent.tsx +12 -4
- package/src/lib/ui/components/Toolbar/LinkEditor.tsx +1 -0
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +212 -61
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +21 -11
- package/src/lib/ui/components/menu-items.tsx +8 -0
- package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +8 -3
- package/src/lib/ui/components/primitives/TldrawUiInput.tsx +6 -3
- package/src/lib/ui/components/primitives/TldrawUiPopover.tsx +4 -2
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +52 -32
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +55 -12
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +379 -0
- package/src/lib/ui/components/primitives/layout.tsx +107 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +4 -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 +24 -33
- package/src/lib/ui/context/TldrawUiContextProvider.tsx +23 -20
- package/src/lib/ui/context/actions.tsx +51 -10
- package/src/lib/ui/context/components.tsx +3 -0
- package/src/lib/ui/context/events.tsx +2 -1
- package/src/lib/ui/hooks/useClipboardEvents.ts +2 -2
- package/src/lib/ui/hooks/useExportAs.ts +3 -2
- package/src/lib/ui/hooks/useTools.tsx +26 -4
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +7 -0
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +8 -1
- package/src/lib/ui/kbd-utils.ts +10 -3
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +434 -293
- 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 +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/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 +74 -4
- 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 +742 -583
- 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 +0 -142
- 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 +0 -115
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +0 -7
- package/src/lib/ui/components/StylePanel/DropdownPicker.tsx +0 -109
|
@@ -1,48 +1,55 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DefaultColorStyle,
|
|
3
|
+
getColorValue,
|
|
3
4
|
SharedStyle,
|
|
4
5
|
StyleProp,
|
|
5
6
|
TLDefaultColorStyle,
|
|
6
|
-
TLDefaultColorTheme,
|
|
7
7
|
useEditor,
|
|
8
8
|
} from '@tldraw/editor'
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
9
|
+
import { memo, ReactElement, useMemo, useRef } from 'react'
|
|
10
|
+
import { useDefaultColorTheme } from '../../../shapes/shared/useDefaultColorTheme'
|
|
11
11
|
import { StyleValuesForUi } from '../../../styles'
|
|
12
12
|
import { PORTRAIT_BREAKPOINT } from '../../constants'
|
|
13
13
|
import { useBreakpoint } from '../../context/breakpoints'
|
|
14
14
|
import { TLUiTranslationKey } from '../../hooks/useTranslation/TLUiTranslationKey'
|
|
15
15
|
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
16
|
-
import { TldrawUiButtonIcon } from '
|
|
17
|
-
import {
|
|
16
|
+
import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
|
|
17
|
+
import {
|
|
18
|
+
TldrawUiToolbar,
|
|
19
|
+
TldrawUiToolbarToggleGroup,
|
|
20
|
+
TldrawUiToolbarToggleItem,
|
|
21
|
+
} from '../primitives/TldrawUiToolbar'
|
|
22
|
+
import { TldrawUiGrid, TldrawUiRow } from '../primitives/layout'
|
|
23
|
+
import { useStylePanelContext } from './StylePanelContext'
|
|
24
|
+
import { StylePanelSubheading } from './StylePanelSubheading'
|
|
18
25
|
|
|
19
26
|
/** @public */
|
|
20
|
-
export interface
|
|
27
|
+
export interface StylePanelButtonPickerProps<T extends string> {
|
|
21
28
|
title: string
|
|
22
29
|
uiType: string
|
|
23
30
|
style: StyleProp<T>
|
|
24
31
|
value: SharedStyle<T>
|
|
25
32
|
items: StyleValuesForUi<T>
|
|
26
|
-
|
|
27
|
-
onValueChange(style: StyleProp<T>, value: T): void
|
|
33
|
+
onValueChange?(style: StyleProp<T>, value: T): void
|
|
28
34
|
onHistoryMark?(id: string): void
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
/** @public */
|
|
32
|
-
export const
|
|
33
|
-
props:
|
|
38
|
+
export const StylePanelButtonPicker = memo(function StylePanelButtonPicker<T extends string>(
|
|
39
|
+
props: StylePanelButtonPickerProps<T>
|
|
34
40
|
) {
|
|
41
|
+
const ctx = useStylePanelContext()
|
|
42
|
+
|
|
35
43
|
const {
|
|
36
44
|
uiType,
|
|
37
45
|
items,
|
|
38
46
|
title,
|
|
39
47
|
style,
|
|
40
48
|
value,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onHistoryMark,
|
|
44
|
-
theme,
|
|
49
|
+
onValueChange = ctx.onValueChange,
|
|
50
|
+
onHistoryMark = ctx.onHistoryMark,
|
|
45
51
|
} = props
|
|
52
|
+
const theme = useDefaultColorTheme()
|
|
46
53
|
const editor = useEditor()
|
|
47
54
|
const msg = useTranslation()
|
|
48
55
|
const breakpoint = useBreakpoint()
|
|
@@ -116,41 +123,57 @@ export const TldrawUiButtonPicker = memo(function TldrawUiButtonPicker<T extends
|
|
|
116
123
|
}
|
|
117
124
|
}, [editor, breakpoint, value, onHistoryMark, onValueChange, style])
|
|
118
125
|
|
|
126
|
+
const Layout = items.length > 4 ? TldrawUiGrid : TldrawUiRow
|
|
127
|
+
|
|
119
128
|
return (
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
129
|
+
<>
|
|
130
|
+
{ctx.showUiLabels && <StylePanelSubheading>{title}</StylePanelSubheading>}
|
|
131
|
+
<TldrawUiToolbar label={title}>
|
|
132
|
+
<TldrawUiToolbarToggleGroup
|
|
133
|
+
data-testid={`style.${uiType}`}
|
|
134
|
+
type="single"
|
|
135
|
+
value={value.type === 'shared' ? value.value : undefined}
|
|
136
|
+
asChild
|
|
137
|
+
>
|
|
138
|
+
<Layout>
|
|
139
|
+
{items.map((item) => {
|
|
140
|
+
const isActive = value.type === 'shared' && value.value === item.value
|
|
141
|
+
const label =
|
|
142
|
+
title + ' — ' + msg(`${uiType}-style.${item.value}` as TLUiTranslationKey)
|
|
143
|
+
return (
|
|
144
|
+
<TldrawUiToolbarToggleItem
|
|
145
|
+
type="icon"
|
|
146
|
+
key={item.value}
|
|
147
|
+
data-id={item.value}
|
|
148
|
+
data-testid={`style.${uiType}.${item.value}`}
|
|
149
|
+
aria-label={label + (isActive ? ` (${msg('style-panel.selected')})` : '')}
|
|
150
|
+
tooltip={
|
|
151
|
+
<>
|
|
152
|
+
<div>{label}</div>
|
|
153
|
+
{isActive ? <div>({msg('style-panel.selected')})</div> : null}
|
|
154
|
+
</>
|
|
155
|
+
}
|
|
156
|
+
value={item.value}
|
|
157
|
+
data-state={value.type === 'shared' && value.value === item.value ? 'on' : 'off'}
|
|
158
|
+
data-isactive={isActive}
|
|
159
|
+
title={label}
|
|
160
|
+
style={
|
|
161
|
+
style === (DefaultColorStyle as StyleProp<unknown>)
|
|
162
|
+
? { color: getColorValue(theme, item.value as TLDefaultColorStyle, 'solid') }
|
|
163
|
+
: undefined
|
|
164
|
+
}
|
|
165
|
+
onPointerEnter={handleButtonPointerEnter}
|
|
166
|
+
onPointerDown={handleButtonPointerDown}
|
|
167
|
+
onPointerUp={handleButtonPointerUp}
|
|
168
|
+
onClick={handleButtonClick}
|
|
169
|
+
>
|
|
170
|
+
<TldrawUiButtonIcon icon={item.icon} />
|
|
171
|
+
</TldrawUiToolbarToggleItem>
|
|
172
|
+
)
|
|
173
|
+
})}
|
|
174
|
+
</Layout>
|
|
175
|
+
</TldrawUiToolbarToggleGroup>
|
|
176
|
+
</TldrawUiToolbar>
|
|
177
|
+
</>
|
|
155
178
|
)
|
|
156
|
-
}) as <T extends string>(props:
|
|
179
|
+
}) as <T extends string>(props: StylePanelButtonPickerProps<T>) => ReactElement
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ReadonlySharedStyleMap, StyleProp, useEditor, useValue } from '@tldraw/editor'
|
|
2
|
+
import { createContext, useCallback, useContext } from 'react'
|
|
3
|
+
import { useUiEvents } from '../../context/events'
|
|
4
|
+
|
|
5
|
+
/** @public */
|
|
6
|
+
export interface StylePanelContext {
|
|
7
|
+
styles: ReadonlySharedStyleMap
|
|
8
|
+
showUiLabels: boolean
|
|
9
|
+
onHistoryMark(id: string): void
|
|
10
|
+
onValueChange<T>(style: StyleProp<T>, value: T): void
|
|
11
|
+
}
|
|
12
|
+
const StylePanelContext = createContext<null | StylePanelContext>(null)
|
|
13
|
+
|
|
14
|
+
/** @public */
|
|
15
|
+
export interface StylePanelContextProviderProps {
|
|
16
|
+
children: React.ReactNode
|
|
17
|
+
styles: ReadonlySharedStyleMap
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** @public @react */
|
|
21
|
+
export function StylePanelContextProvider({ children, styles }: StylePanelContextProviderProps) {
|
|
22
|
+
const editor = useEditor()
|
|
23
|
+
const trackEvent = useUiEvents()
|
|
24
|
+
|
|
25
|
+
const onHistoryMark = useCallback((id: string) => editor.markHistoryStoppingPoint(id), [editor])
|
|
26
|
+
const showUiLabels = useValue('showUiLabels', () => editor.user.getShowUiLabels(), [editor])
|
|
27
|
+
const onValueChange = useCallback(
|
|
28
|
+
function <T>(style: StyleProp<T>, value: T) {
|
|
29
|
+
editor.run(() => {
|
|
30
|
+
if (editor.isIn('select')) {
|
|
31
|
+
editor.setStyleForSelectedShapes(style, value)
|
|
32
|
+
}
|
|
33
|
+
editor.setStyleForNextShapes(style, value)
|
|
34
|
+
editor.updateInstanceState({ isChangingStyle: true })
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
trackEvent('set-style', { source: 'style-panel', id: style.id, value: value as string })
|
|
38
|
+
},
|
|
39
|
+
[editor, trackEvent]
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<StylePanelContext.Provider
|
|
44
|
+
value={{
|
|
45
|
+
styles: styles,
|
|
46
|
+
showUiLabels,
|
|
47
|
+
onHistoryMark,
|
|
48
|
+
onValueChange,
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
{children}
|
|
52
|
+
</StylePanelContext.Provider>
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** @public */
|
|
57
|
+
export function useStylePanelContext() {
|
|
58
|
+
const context = useContext(StylePanelContext)
|
|
59
|
+
if (!context) {
|
|
60
|
+
throw new Error('useStylePanelContext must be used within a StylePanelContextProvider')
|
|
61
|
+
}
|
|
62
|
+
return context
|
|
63
|
+
}
|
|
@@ -11,8 +11,10 @@ import {
|
|
|
11
11
|
} from '../primitives/TldrawUiPopover'
|
|
12
12
|
import { TldrawUiToolbar, TldrawUiToolbarButton } from '../primitives/TldrawUiToolbar'
|
|
13
13
|
import { TldrawUiMenuContextProvider } from '../primitives/menus/TldrawUiMenuContext'
|
|
14
|
+
import { useStylePanelContext } from './StylePanelContext'
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
/** @public */
|
|
17
|
+
export interface StylePanelDoubleDropdownPickerProps<T extends string> {
|
|
16
18
|
uiTypeA: string
|
|
17
19
|
uiTypeB: string
|
|
18
20
|
label: TLUiTranslationKey | Exclude<string, TLUiTranslationKey>
|
|
@@ -24,23 +26,27 @@ interface DoubleDropdownPickerProps<T extends string> {
|
|
|
24
26
|
styleB: StyleProp<T>
|
|
25
27
|
valueA: SharedStyle<T>
|
|
26
28
|
valueB: SharedStyle<T>
|
|
27
|
-
onValueChange(style: StyleProp<T>, value: T): void
|
|
29
|
+
onValueChange?(style: StyleProp<T>, value: T): void
|
|
28
30
|
}
|
|
29
31
|
|
|
30
|
-
function DoubleDropdownPickerInner<T extends string>(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
function DoubleDropdownPickerInner<T extends string>(
|
|
33
|
+
props: StylePanelDoubleDropdownPickerProps<T>
|
|
34
|
+
) {
|
|
35
|
+
const ctx = useStylePanelContext()
|
|
36
|
+
const {
|
|
37
|
+
label,
|
|
38
|
+
uiTypeA,
|
|
39
|
+
uiTypeB,
|
|
40
|
+
labelA,
|
|
41
|
+
labelB,
|
|
42
|
+
itemsA,
|
|
43
|
+
itemsB,
|
|
44
|
+
styleA,
|
|
45
|
+
styleB,
|
|
46
|
+
valueA,
|
|
47
|
+
valueB,
|
|
48
|
+
onValueChange = ctx.onValueChange,
|
|
49
|
+
} = props
|
|
44
50
|
const editor = useEditor()
|
|
45
51
|
const msg = useTranslation()
|
|
46
52
|
const [isOpenA, setIsOpenA] = React.useState(false)
|
|
@@ -68,7 +74,7 @@ function DoubleDropdownPickerInner<T extends string>({
|
|
|
68
74
|
<div title={msg(label)} className="tlui-style-panel__double-select-picker-label">
|
|
69
75
|
{msg(label)}
|
|
70
76
|
</div>
|
|
71
|
-
<TldrawUiToolbar label={msg(label)}
|
|
77
|
+
<TldrawUiToolbar orientation="horizontal" label={msg(label)}>
|
|
72
78
|
<TldrawUiPopover id={idA} open={isOpenA} onOpenChange={setIsOpenA}>
|
|
73
79
|
<TldrawUiPopoverTrigger>
|
|
74
80
|
<TldrawUiToolbarButton
|
|
@@ -86,7 +92,7 @@ function DoubleDropdownPickerInner<T extends string>({
|
|
|
86
92
|
</TldrawUiToolbarButton>
|
|
87
93
|
</TldrawUiPopoverTrigger>
|
|
88
94
|
<TldrawUiPopoverContent side="left" align="center" sideOffset={80} alignOffset={0}>
|
|
89
|
-
<TldrawUiToolbar label={msg(labelA)}
|
|
95
|
+
<TldrawUiToolbar orientation="grid" label={msg(labelA)}>
|
|
90
96
|
<TldrawUiMenuContextProvider type="icons" sourceId="style-panel">
|
|
91
97
|
{itemsA.map((item) => {
|
|
92
98
|
return (
|
|
@@ -126,7 +132,7 @@ function DoubleDropdownPickerInner<T extends string>({
|
|
|
126
132
|
</TldrawUiToolbarButton>
|
|
127
133
|
</TldrawUiPopoverTrigger>
|
|
128
134
|
<TldrawUiPopoverContent side="left" align="center" sideOffset={116} alignOffset={0}>
|
|
129
|
-
<TldrawUiToolbar label={msg(labelB)}
|
|
135
|
+
<TldrawUiToolbar orientation="grid" label={msg(labelB)}>
|
|
130
136
|
<TldrawUiMenuContextProvider type="icons" sourceId="style-panel">
|
|
131
137
|
{itemsB.map((item) => {
|
|
132
138
|
return (
|
|
@@ -155,6 +161,9 @@ function DoubleDropdownPickerInner<T extends string>({
|
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
// need to memo like this to get generics
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
/** @public @react */
|
|
165
|
+
export const StylePanelDoubleDropdownPicker = React.memo(DoubleDropdownPickerInner) as <
|
|
166
|
+
T extends string,
|
|
167
|
+
>(
|
|
168
|
+
props: StylePanelDoubleDropdownPickerProps<T>
|
|
169
|
+
) => React.JSX.Element
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { SharedStyle, StyleProp, tlmenus, useEditor } from '@tldraw/editor'
|
|
2
|
+
import * as React from 'react'
|
|
3
|
+
import { StyleValuesForUi } from '../../../styles'
|
|
4
|
+
import { TLUiTranslationKey } from '../../hooks/useTranslation/TLUiTranslationKey'
|
|
5
|
+
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
6
|
+
import { TLUiIconType } from '../../icon-types'
|
|
7
|
+
import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
|
|
8
|
+
import { TldrawUiButtonLabel } from '../primitives/Button/TldrawUiButtonLabel'
|
|
9
|
+
import {
|
|
10
|
+
TldrawUiPopover,
|
|
11
|
+
TldrawUiPopoverContent,
|
|
12
|
+
TldrawUiPopoverTrigger,
|
|
13
|
+
} from '../primitives/TldrawUiPopover'
|
|
14
|
+
import { TldrawUiToolbar, TldrawUiToolbarButton } from '../primitives/TldrawUiToolbar'
|
|
15
|
+
import { TldrawUiMenuContextProvider } from '../primitives/menus/TldrawUiMenuContext'
|
|
16
|
+
import { useStylePanelContext } from './StylePanelContext'
|
|
17
|
+
|
|
18
|
+
/** @public */
|
|
19
|
+
export interface StylePanelDropdownPickerProps<T extends string> {
|
|
20
|
+
id: string
|
|
21
|
+
label?: TLUiTranslationKey | Exclude<string, TLUiTranslationKey>
|
|
22
|
+
uiType: string
|
|
23
|
+
stylePanelType: string
|
|
24
|
+
style: StyleProp<T>
|
|
25
|
+
value: SharedStyle<T>
|
|
26
|
+
items: StyleValuesForUi<T>
|
|
27
|
+
type: 'icon' | 'tool' | 'menu'
|
|
28
|
+
onValueChange?(style: StyleProp<T>, value: T): void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function DropdownPickerInner<T extends string>(props: StylePanelDropdownPickerProps<T>) {
|
|
32
|
+
const ctx = useStylePanelContext()
|
|
33
|
+
const {
|
|
34
|
+
id,
|
|
35
|
+
label,
|
|
36
|
+
uiType,
|
|
37
|
+
stylePanelType,
|
|
38
|
+
style,
|
|
39
|
+
items,
|
|
40
|
+
type,
|
|
41
|
+
value,
|
|
42
|
+
onValueChange = ctx.onValueChange,
|
|
43
|
+
} = props
|
|
44
|
+
const msg = useTranslation()
|
|
45
|
+
const editor = useEditor()
|
|
46
|
+
const [isOpen, setIsOpen] = React.useState(false)
|
|
47
|
+
|
|
48
|
+
const icon = React.useMemo(
|
|
49
|
+
() => items.find((item) => value.type === 'shared' && item.value === value.value)?.icon,
|
|
50
|
+
[items, value]
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
const stylePanelName = msg(`style-panel.${stylePanelType}` as TLUiTranslationKey)
|
|
54
|
+
|
|
55
|
+
const titleStr =
|
|
56
|
+
value.type === 'mixed'
|
|
57
|
+
? msg('style-panel.mixed')
|
|
58
|
+
: stylePanelName + ' — ' + msg(`${uiType}-style.${value.value}` as TLUiTranslationKey)
|
|
59
|
+
const labelStr = label ? msg(label) : ''
|
|
60
|
+
|
|
61
|
+
const popoverId = `style panel ${id}`
|
|
62
|
+
return (
|
|
63
|
+
<TldrawUiToolbar label={stylePanelName}>
|
|
64
|
+
<TldrawUiPopover
|
|
65
|
+
id={popoverId}
|
|
66
|
+
open={isOpen}
|
|
67
|
+
onOpenChange={setIsOpen}
|
|
68
|
+
className="tlui-style-panel__dropdown-picker"
|
|
69
|
+
>
|
|
70
|
+
<TldrawUiPopoverTrigger>
|
|
71
|
+
<TldrawUiToolbarButton
|
|
72
|
+
type={type}
|
|
73
|
+
data-testid={`style.${uiType}`}
|
|
74
|
+
data-direction="left"
|
|
75
|
+
title={titleStr}
|
|
76
|
+
>
|
|
77
|
+
{labelStr && <TldrawUiButtonLabel>{labelStr}</TldrawUiButtonLabel>}
|
|
78
|
+
<TldrawUiButtonIcon icon={(icon as TLUiIconType) ?? 'mixed'} />
|
|
79
|
+
</TldrawUiToolbarButton>
|
|
80
|
+
</TldrawUiPopoverTrigger>
|
|
81
|
+
<TldrawUiPopoverContent side="left" align="center">
|
|
82
|
+
<TldrawUiToolbar orientation={items.length > 4 ? 'grid' : 'horizontal'} label={labelStr}>
|
|
83
|
+
<TldrawUiMenuContextProvider type="icons" sourceId="style-panel">
|
|
84
|
+
{items.map((item) => {
|
|
85
|
+
return (
|
|
86
|
+
<TldrawUiToolbarButton
|
|
87
|
+
key={item.value}
|
|
88
|
+
type="icon"
|
|
89
|
+
data-testid={`style.${uiType}.${item.value}`}
|
|
90
|
+
title={
|
|
91
|
+
stylePanelName +
|
|
92
|
+
' — ' +
|
|
93
|
+
msg(`${uiType}-style.${item.value}` as TLUiTranslationKey)
|
|
94
|
+
}
|
|
95
|
+
isActive={icon === item.icon}
|
|
96
|
+
onClick={() => {
|
|
97
|
+
ctx.onHistoryMark('select style dropdown item')
|
|
98
|
+
onValueChange(style, item.value)
|
|
99
|
+
tlmenus.deleteOpenMenu(popoverId, editor.contextId)
|
|
100
|
+
setIsOpen(false)
|
|
101
|
+
}}
|
|
102
|
+
>
|
|
103
|
+
<TldrawUiButtonIcon icon={item.icon} />
|
|
104
|
+
</TldrawUiToolbarButton>
|
|
105
|
+
)
|
|
106
|
+
})}
|
|
107
|
+
</TldrawUiMenuContextProvider>
|
|
108
|
+
</TldrawUiToolbar>
|
|
109
|
+
</TldrawUiPopoverContent>
|
|
110
|
+
</TldrawUiPopover>
|
|
111
|
+
</TldrawUiToolbar>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// need to export like this to get generics
|
|
116
|
+
/** @public @react */
|
|
117
|
+
export const StylePanelDropdownPicker = React.memo(DropdownPickerInner) as <T extends string>(
|
|
118
|
+
props: StylePanelDropdownPickerProps<T>
|
|
119
|
+
) => React.JSX.Element
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @public */
|
|
2
|
+
export interface StylePanelSubheadingProps {
|
|
3
|
+
children: React.ReactNode
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/** @public @react */
|
|
7
|
+
export function StylePanelSubheading({ children }: StylePanelSubheadingProps) {
|
|
8
|
+
return <h3 className="tlui-style-panel__subheading">{children}</h3>
|
|
9
|
+
}
|
|
@@ -70,6 +70,7 @@ export function AltTextEditor({ shapeId, onClose, source }: AltTextEditorProps)
|
|
|
70
70
|
data-testid="media-toolbar.alt-text-input"
|
|
71
71
|
value={altText}
|
|
72
72
|
placeholder={msg('tool.media-alt-text-desc')}
|
|
73
|
+
aria-label={msg('tool.media-alt-text-desc')}
|
|
73
74
|
onValueChange={handleValueChange}
|
|
74
75
|
onComplete={handleComplete}
|
|
75
76
|
onCancel={handleAltTextCancel}
|
|
@@ -78,6 +79,7 @@ export function AltTextEditor({ shapeId, onClose, source }: AltTextEditorProps)
|
|
|
78
79
|
{!isReadonly && (
|
|
79
80
|
<TldrawUiButton
|
|
80
81
|
title={msg('tool.media-alt-text-confirm')}
|
|
82
|
+
data-testid="tool.media-alt-text-confirm"
|
|
81
83
|
type="icon"
|
|
82
84
|
onPointerDown={preventDefault}
|
|
83
85
|
onClick={handleConfirm}
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
import { useActions } from '../../context/actions'
|
|
23
23
|
import { useUiEvents } from '../../context/events'
|
|
24
24
|
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
25
|
-
import { TldrawUiButton } from '../primitives/Button/TldrawUiButton'
|
|
26
25
|
import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
|
|
27
26
|
import { TldrawUiButtonLabel } from '../primitives/Button/TldrawUiButtonLabel'
|
|
28
27
|
import {
|
|
@@ -32,6 +31,7 @@ import {
|
|
|
32
31
|
TldrawUiDropdownMenuTrigger,
|
|
33
32
|
} from '../primitives/TldrawUiDropdownMenu'
|
|
34
33
|
import { TldrawUiSlider } from '../primitives/TldrawUiSlider'
|
|
34
|
+
import { TldrawUiToolbarButton } from '../primitives/TldrawUiToolbar'
|
|
35
35
|
|
|
36
36
|
/** @public */
|
|
37
37
|
export interface DefaultImageToolbarContentProps {
|
|
@@ -226,9 +226,13 @@ export const DefaultImageToolbarContent = track(function DefaultImageToolbarCont
|
|
|
226
226
|
/>
|
|
227
227
|
<TldrawUiDropdownMenuRoot id="image-toolbar-aspect-ratio">
|
|
228
228
|
<TldrawUiDropdownMenuTrigger>
|
|
229
|
-
<
|
|
229
|
+
<TldrawUiToolbarButton
|
|
230
|
+
title={msg('tool.aspect-ratio')}
|
|
231
|
+
type="icon"
|
|
232
|
+
data-testid="tool.image-aspect-ratio"
|
|
233
|
+
>
|
|
230
234
|
<TldrawUiButtonIcon icon="corners" />
|
|
231
|
-
</
|
|
235
|
+
</TldrawUiToolbarButton>
|
|
232
236
|
</TldrawUiDropdownMenuTrigger>
|
|
233
237
|
<TldrawUiDropdownMenuContent side="top" align="center">
|
|
234
238
|
{ASPECT_RATIO_OPTIONS.map((aspectRatio) => {
|
|
@@ -268,14 +272,15 @@ export const DefaultImageToolbarContent = track(function DefaultImageToolbarCont
|
|
|
268
272
|
})}
|
|
269
273
|
</TldrawUiDropdownMenuContent>
|
|
270
274
|
</TldrawUiDropdownMenuRoot>
|
|
271
|
-
<
|
|
275
|
+
<TldrawUiToolbarButton
|
|
272
276
|
type="icon"
|
|
273
277
|
onClick={onManipulatingEnd}
|
|
274
|
-
data-testid="tool.image-confirm"
|
|
275
|
-
style={{ borderLeft: '1px solid var(--color-divider)', marginLeft: '2px' }}
|
|
278
|
+
data-testid="tool.image-crop-confirm"
|
|
279
|
+
style={{ borderLeft: '1px solid var(--tl-color-divider)', marginLeft: '2px' }}
|
|
280
|
+
title={msg('tool.image-crop-confirm')}
|
|
276
281
|
>
|
|
277
282
|
<TldrawUiButtonIcon small icon="check" />
|
|
278
|
-
</
|
|
283
|
+
</TldrawUiToolbarButton>
|
|
279
284
|
</>
|
|
280
285
|
)
|
|
281
286
|
}
|
|
@@ -283,33 +288,45 @@ export const DefaultImageToolbarContent = track(function DefaultImageToolbarCont
|
|
|
283
288
|
return (
|
|
284
289
|
<>
|
|
285
290
|
{!isReadonly && (
|
|
286
|
-
<
|
|
291
|
+
<TldrawUiToolbarButton
|
|
292
|
+
type="icon"
|
|
293
|
+
data-testid="tool.image-replace"
|
|
294
|
+
onClick={handleImageReplace}
|
|
295
|
+
title={msg('tool.replace-media')}
|
|
296
|
+
>
|
|
287
297
|
<TldrawUiButtonIcon small icon="tool-media" />
|
|
288
|
-
</
|
|
298
|
+
</TldrawUiToolbarButton>
|
|
289
299
|
)}
|
|
290
300
|
{!isReadonly && (
|
|
291
|
-
<
|
|
301
|
+
<TldrawUiToolbarButton
|
|
302
|
+
type="icon"
|
|
303
|
+
title={msg('tool.image-crop')}
|
|
304
|
+
onClick={onManipulatingStart}
|
|
305
|
+
data-testid="tool.image-crop"
|
|
306
|
+
>
|
|
292
307
|
<TldrawUiButtonIcon small icon="crop" />
|
|
293
|
-
</
|
|
308
|
+
</TldrawUiToolbarButton>
|
|
294
309
|
)}
|
|
295
|
-
<
|
|
310
|
+
<TldrawUiToolbarButton
|
|
296
311
|
type="icon"
|
|
297
312
|
title={msg('action.download-original')}
|
|
298
313
|
onClick={handleImageDownload}
|
|
314
|
+
data-testid="tool.image-download"
|
|
299
315
|
>
|
|
300
316
|
<TldrawUiButtonIcon small icon="download" />
|
|
301
|
-
</
|
|
317
|
+
</TldrawUiToolbarButton>
|
|
302
318
|
{(altText || !isReadonly) && (
|
|
303
|
-
<
|
|
304
|
-
type="
|
|
319
|
+
<TldrawUiToolbarButton
|
|
320
|
+
type="icon"
|
|
305
321
|
title={msg('tool.media-alt-text')}
|
|
322
|
+
data-testid="tool.image-alt-text"
|
|
306
323
|
onClick={() => {
|
|
307
324
|
trackEvent('alt-text-start', { source })
|
|
308
325
|
onEditAltTextStart()
|
|
309
326
|
}}
|
|
310
327
|
>
|
|
311
328
|
<TldrawUiButtonIcon small icon="alt" />
|
|
312
|
-
</
|
|
329
|
+
</TldrawUiToolbarButton>
|
|
313
330
|
)}
|
|
314
331
|
</>
|
|
315
332
|
)
|