tldraw 3.16.0-canary.ffdf566dd0a8 → 3.16.0-internal.a478398270c6
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 +19 -125
- package/dist-cjs/index.js +2 -19
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawImage.js +2 -5
- package/dist-cjs/lib/TldrawImage.js.map +3 -3
- package/dist-cjs/lib/canvas/TldrawCropHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawCropHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawOverlays.js +1 -1
- package/dist-cjs/lib/canvas/TldrawOverlays.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +271 -279
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +0 -1
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +41 -24
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js +4 -16
- package/dist-cjs/lib/shapes/arrow/arrowLabel.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/toolStates/Pointing.js +0 -3
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +5 -5
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js +4 -15
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +1 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PathBuilder.js +3 -21
- package/dist-cjs/lib/shapes/shared/PathBuilder.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +0 -1
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js +2 -5
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/SvgTextLabel.js +3 -4
- package/dist-cjs/lib/shapes/shared/SvgTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +1 -10
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js +11 -5
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
- package/dist-cjs/lib/styles.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js +1 -7
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +22 -43
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +15 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +0 -5
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.js.map +2 -2
- package/dist-cjs/lib/ui/assetUrls.js +13 -10
- package/dist-cjs/lib/ui/assetUrls.js.map +2 -2
- package/dist-cjs/lib/ui/components/A11y.js +12 -14
- package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +1 -51
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +2 -3
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +4 -3
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/Spinner.js +25 -2
- package/dist-cjs/lib/ui/components/Spinner.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +0 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +136 -168
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js +7 -21
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +2 -3
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +0 -22
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButtonIcon.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +0 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js +1 -35
- package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +2 -6
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +3 -12
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +2 -0
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +2 -3
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +8 -57
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
- 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 +0 -11
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/kbd-utils.js +1 -2
- 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/excalidraw/putExcalidrawContent.js +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js +2 -3
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
- package/dist-esm/index.d.mts +19 -125
- package/dist-esm/index.mjs +4 -33
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawImage.mjs +2 -5
- package/dist-esm/lib/TldrawImage.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawOverlays.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawOverlays.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +271 -279
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +0 -1
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +41 -26
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +5 -19
- package/dist-esm/lib/shapes/arrow/arrowLabel.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/toolStates/Pointing.mjs +0 -3
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +5 -5
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +4 -15
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +1 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs +3 -22
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +0 -1
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +2 -5
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs +3 -4
- package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +1 -10
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +11 -5
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/styles.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs +1 -7
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +22 -43
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +15 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +0 -5
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.mjs.map +2 -2
- package/dist-esm/lib/ui/assetUrls.mjs +13 -10
- package/dist-esm/lib/ui/assetUrls.mjs.map +2 -2
- package/dist-esm/lib/ui/components/A11y.mjs +12 -14
- package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +1 -51
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +3 -3
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +4 -3
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Spinner.mjs +26 -3
- package/dist-esm/lib/ui/components/Spinner.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +1 -3
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +136 -168
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs +9 -23
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs.map +3 -3
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +3 -3
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +2 -3
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +0 -22
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButtonIcon.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +0 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs +1 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs +2 -36
- package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +2 -6
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +3 -12
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +2 -0
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +2 -3
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +8 -57
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +0 -11
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/kbd-utils.mjs +1 -2
- 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/excalidraw/putExcalidrawContent.mjs +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs +2 -3
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
- package/package.json +3 -4
- package/src/index.ts +2 -24
- package/src/lib/TldrawImage.tsx +2 -6
- package/src/lib/canvas/TldrawCropHandles.tsx +1 -3
- package/src/lib/canvas/TldrawHandles.tsx +1 -5
- package/src/lib/canvas/TldrawOverlays.tsx +1 -1
- package/src/lib/canvas/TldrawSelectionForeground.tsx +1 -5
- package/src/lib/defaultExternalContentHandlers.ts +1 -2
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +5 -5
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +43 -26
- package/src/lib/shapes/arrow/arrowLabel.ts +3 -23
- package/src/lib/shapes/arrow/arrowTargetState.ts +1 -2
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +0 -3
- package/src/lib/shapes/draw/DrawShapeUtil.tsx +4 -0
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +7 -5
- package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +3 -0
- package/src/lib/shapes/line/LineShapeUtil.tsx +5 -19
- package/src/lib/shapes/note/NoteShapeUtil.tsx +0 -1
- package/src/lib/shapes/shared/PathBuilder.test.tsx +1 -1
- package/src/lib/shapes/shared/PathBuilder.tsx +1 -35
- package/src/lib/shapes/shared/PlainTextLabel.tsx +0 -1
- package/src/lib/shapes/shared/RichTextLabel.tsx +0 -4
- package/src/lib/shapes/shared/SvgTextLabel.tsx +2 -4
- package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +1 -11
- package/src/lib/shapes/text/TextShapeUtil.tsx +12 -5
- package/src/lib/styles.tsx +1 -3
- package/src/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.ts +1 -8
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +30 -54
- package/src/lib/tools/SelectTool/childStates/Idle.ts +24 -2
- package/src/lib/tools/SelectTool/childStates/PointingShape.ts +0 -7
- package/src/lib/tools/SelectTool/childStates/Resizing.ts +1 -12
- package/src/lib/tools/SelectTool/childStates/Rotating.ts +0 -11
- package/src/lib/tools/SelectTool/childStates/Translating.ts +0 -11
- package/src/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.ts +0 -1
- package/src/lib/ui/assetUrls.ts +13 -10
- package/src/lib/ui/components/A11y.tsx +13 -15
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +0 -40
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +2 -4
- package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +4 -3
- package/src/lib/ui/components/Spinner.tsx +24 -2
- package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +1 -3
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +127 -171
- package/src/lib/ui/components/Toolbar/DefaultImageToolbar.tsx +9 -25
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +3 -3
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +12 -17
- package/src/lib/ui/components/menu-items.tsx +0 -25
- package/src/lib/ui/components/primitives/Button/TldrawUiButtonIcon.tsx +2 -2
- package/src/lib/ui/components/primitives/TldrawUiButtonPicker.tsx +0 -2
- package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiIcon.tsx +3 -41
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +1 -6
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +3 -24
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +2 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +4 -3
- package/src/lib/ui/context/TldrawUiContextProvider.tsx +20 -23
- package/src/lib/ui/context/actions.tsx +9 -59
- package/src/lib/ui/context/events.tsx +2 -5
- package/src/lib/ui/hooks/menu-hooks.ts +0 -1
- package/src/lib/ui/hooks/useKeyboardShortcuts.ts +2 -3
- package/src/lib/ui/hooks/useTools.tsx +1 -2
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +0 -11
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +0 -11
- package/src/lib/ui/kbd-utils.ts +1 -2
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +23 -65
- package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +2 -16
- package/src/lib/utils/excalidraw/putExcalidrawContent.ts +1 -1
- package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +3 -24
- package/src/lib/utils/tldr/buildFromV1Document.ts +1 -2
- package/src/test/Editor.test.tsx +1 -1
- package/src/test/SelectTool.test.ts +11 -37
- package/src/test/arrows-megabus.test.tsx +6 -12
- package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +2 -2
- package/src/test/commands/deletePage.test.ts +1 -84
- package/src/test/groups.test.tsx +1 -1
- package/src/test/navigation.test.ts +0 -254
- package/src/test/shapeutils.test.ts +45 -394
- package/src/test/translating.test.ts +1 -1
- package/tldraw.css +50 -88
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js +0 -35
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +0 -7
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +0 -267
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +0 -7
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +0 -19
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +0 -7
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +0 -237
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +0 -7
- package/src/lib/ui/components/AccessibilityMenu.tsx +0 -20
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +0 -313
- package/src/test/inner-outer-margin.test.ts +0 -315
|
@@ -35,11 +35,6 @@ import { TldrawUiToolbar, TldrawUiToolbarButton } from '../primitives/TldrawUiTo
|
|
|
35
35
|
import { DoubleDropdownPicker } from './DoubleDropdownPicker'
|
|
36
36
|
import { DropdownPicker } from './DropdownPicker'
|
|
37
37
|
|
|
38
|
-
// Local component for style panel subheadings
|
|
39
|
-
function StylePanelSubheading({ children }: { children: React.ReactNode }) {
|
|
40
|
-
return <h3 className="tlui-style-panel__subheading">{children}</h3>
|
|
41
|
-
}
|
|
42
|
-
|
|
43
38
|
/** @public */
|
|
44
39
|
export interface TLUiStylePanelContentProps {
|
|
45
40
|
styles: ReturnType<typeof useRelevantStyles>
|
|
@@ -120,7 +115,6 @@ export function CommonStylePickerSet({ styles, theme }: ThemeStylePickerSetProps
|
|
|
120
115
|
const editor = useEditor()
|
|
121
116
|
|
|
122
117
|
const onHistoryMark = useCallback((id: string) => editor.markHistoryStoppingPoint(id), [editor])
|
|
123
|
-
const showUiLabels = useValue('showUiLabels', () => editor.user.getShowUiLabels(), [editor])
|
|
124
118
|
|
|
125
119
|
const handleValueChange = useStyleChangeCallback()
|
|
126
120
|
|
|
@@ -135,90 +129,70 @@ export function CommonStylePickerSet({ styles, theme }: ThemeStylePickerSetProps
|
|
|
135
129
|
<>
|
|
136
130
|
<div className="tlui-style-panel__section__common" data-testid="style.panel">
|
|
137
131
|
{color === undefined ? null : (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
theme={theme}
|
|
151
|
-
onHistoryMark={onHistoryMark}
|
|
152
|
-
/>
|
|
153
|
-
</TldrawUiToolbar>
|
|
154
|
-
</>
|
|
132
|
+
<TldrawUiToolbar label={msg('style-panel.color')}>
|
|
133
|
+
<TldrawUiButtonPicker
|
|
134
|
+
title={msg('style-panel.color')}
|
|
135
|
+
uiType="color"
|
|
136
|
+
style={DefaultColorStyle}
|
|
137
|
+
items={STYLES.color}
|
|
138
|
+
value={color}
|
|
139
|
+
onValueChange={handleValueChange}
|
|
140
|
+
theme={theme}
|
|
141
|
+
onHistoryMark={onHistoryMark}
|
|
142
|
+
/>
|
|
143
|
+
</TldrawUiToolbar>
|
|
155
144
|
)}
|
|
156
145
|
<OpacitySlider />
|
|
157
146
|
</div>
|
|
158
147
|
{showPickers && (
|
|
159
148
|
<div className="tlui-style-panel__section">
|
|
160
149
|
{fill === undefined ? null : (
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
theme={theme}
|
|
174
|
-
onHistoryMark={onHistoryMark}
|
|
175
|
-
/>
|
|
176
|
-
</TldrawUiToolbar>
|
|
177
|
-
</>
|
|
150
|
+
<TldrawUiToolbar label={msg('style-panel.fill')}>
|
|
151
|
+
<TldrawUiButtonPicker
|
|
152
|
+
title={msg('style-panel.fill')}
|
|
153
|
+
uiType="fill"
|
|
154
|
+
style={DefaultFillStyle}
|
|
155
|
+
items={STYLES.fill}
|
|
156
|
+
value={fill}
|
|
157
|
+
onValueChange={handleValueChange}
|
|
158
|
+
theme={theme}
|
|
159
|
+
onHistoryMark={onHistoryMark}
|
|
160
|
+
/>
|
|
161
|
+
</TldrawUiToolbar>
|
|
178
162
|
)}
|
|
179
163
|
{dash === undefined ? null : (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
theme={theme}
|
|
193
|
-
onHistoryMark={onHistoryMark}
|
|
194
|
-
/>
|
|
195
|
-
</TldrawUiToolbar>
|
|
196
|
-
</>
|
|
164
|
+
<TldrawUiToolbar label={msg('style-panel.dash')}>
|
|
165
|
+
<TldrawUiButtonPicker
|
|
166
|
+
title={msg('style-panel.dash')}
|
|
167
|
+
uiType="dash"
|
|
168
|
+
style={DefaultDashStyle}
|
|
169
|
+
items={STYLES.dash}
|
|
170
|
+
value={dash}
|
|
171
|
+
onValueChange={handleValueChange}
|
|
172
|
+
theme={theme}
|
|
173
|
+
onHistoryMark={onHistoryMark}
|
|
174
|
+
/>
|
|
175
|
+
</TldrawUiToolbar>
|
|
197
176
|
)}
|
|
198
177
|
{size === undefined ? null : (
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
style
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
theme={theme}
|
|
218
|
-
onHistoryMark={onHistoryMark}
|
|
219
|
-
/>
|
|
220
|
-
</TldrawUiToolbar>
|
|
221
|
-
</>
|
|
178
|
+
<TldrawUiToolbar label={msg('style-panel.size')}>
|
|
179
|
+
<TldrawUiButtonPicker
|
|
180
|
+
title={msg('style-panel.size')}
|
|
181
|
+
uiType="size"
|
|
182
|
+
style={DefaultSizeStyle}
|
|
183
|
+
items={STYLES.size}
|
|
184
|
+
value={size}
|
|
185
|
+
onValueChange={(style, value) => {
|
|
186
|
+
handleValueChange(style, value)
|
|
187
|
+
const selectedShapeIds = editor.getSelectedShapeIds()
|
|
188
|
+
if (selectedShapeIds.length > 0) {
|
|
189
|
+
kickoutOccludedShapes(editor, selectedShapeIds)
|
|
190
|
+
}
|
|
191
|
+
}}
|
|
192
|
+
theme={theme}
|
|
193
|
+
onHistoryMark={onHistoryMark}
|
|
194
|
+
/>
|
|
195
|
+
</TldrawUiToolbar>
|
|
222
196
|
)}
|
|
223
197
|
</div>
|
|
224
198
|
)}
|
|
@@ -233,8 +207,6 @@ export function TextStylePickerSet({ theme, styles }: ThemeStylePickerSetProps)
|
|
|
233
207
|
|
|
234
208
|
const editor = useEditor()
|
|
235
209
|
const onHistoryMark = useCallback((id: string) => editor.markHistoryStoppingPoint(id), [editor])
|
|
236
|
-
const showUiLabels = useValue('showUiLabels', () => editor.user.getShowUiLabels(), [editor])
|
|
237
|
-
const labelStr = showUiLabels && msg('style-panel.font')
|
|
238
210
|
|
|
239
211
|
const font = styles.get(DefaultFontStyle)
|
|
240
212
|
const textAlign = styles.get(DefaultTextAlignStyle)
|
|
@@ -247,38 +219,59 @@ export function TextStylePickerSet({ theme, styles }: ThemeStylePickerSetProps)
|
|
|
247
219
|
return (
|
|
248
220
|
<div className="tlui-style-panel__section">
|
|
249
221
|
{font === undefined ? null : (
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
/>
|
|
263
|
-
</TldrawUiToolbar>
|
|
264
|
-
</>
|
|
222
|
+
<TldrawUiToolbar label={msg('style-panel.font')}>
|
|
223
|
+
<TldrawUiButtonPicker
|
|
224
|
+
title={msg('style-panel.font')}
|
|
225
|
+
uiType="font"
|
|
226
|
+
style={DefaultFontStyle}
|
|
227
|
+
items={STYLES.font}
|
|
228
|
+
value={font}
|
|
229
|
+
onValueChange={handleValueChange}
|
|
230
|
+
theme={theme}
|
|
231
|
+
onHistoryMark={onHistoryMark}
|
|
232
|
+
/>
|
|
233
|
+
</TldrawUiToolbar>
|
|
265
234
|
)}
|
|
266
235
|
|
|
267
236
|
{textAlign === undefined ? null : (
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
237
|
+
<TldrawUiToolbar label={msg('style-panel.align')} className="tlui-style-panel__row">
|
|
238
|
+
<TldrawUiButtonPicker
|
|
239
|
+
title={msg('style-panel.align')}
|
|
240
|
+
uiType="align"
|
|
241
|
+
style={DefaultTextAlignStyle}
|
|
242
|
+
items={STYLES.textAlign}
|
|
243
|
+
value={textAlign}
|
|
244
|
+
onValueChange={handleValueChange}
|
|
245
|
+
theme={theme}
|
|
246
|
+
onHistoryMark={onHistoryMark}
|
|
247
|
+
/>
|
|
248
|
+
<div className="tlui-style-panel__row__extra-button">
|
|
249
|
+
<TldrawUiToolbarButton
|
|
250
|
+
type="icon"
|
|
251
|
+
title={msg('style-panel.vertical-align')}
|
|
252
|
+
data-testid="vertical-align"
|
|
253
|
+
disabled
|
|
254
|
+
>
|
|
255
|
+
<TldrawUiButtonIcon icon="vertical-align-middle" />
|
|
256
|
+
</TldrawUiToolbarButton>
|
|
257
|
+
</div>
|
|
258
|
+
</TldrawUiToolbar>
|
|
259
|
+
)}
|
|
260
|
+
|
|
261
|
+
{labelAlign === undefined ? null : (
|
|
262
|
+
<TldrawUiToolbar label={msg('style-panel.label-align')} className="tlui-style-panel__row">
|
|
263
|
+
<TldrawUiButtonPicker
|
|
264
|
+
title={msg('style-panel.label-align')}
|
|
265
|
+
uiType="align"
|
|
266
|
+
style={DefaultHorizontalAlignStyle}
|
|
267
|
+
items={STYLES.horizontalAlign}
|
|
268
|
+
value={labelAlign}
|
|
269
|
+
onValueChange={handleValueChange}
|
|
270
|
+
theme={theme}
|
|
271
|
+
onHistoryMark={onHistoryMark}
|
|
272
|
+
/>
|
|
273
|
+
<div className="tlui-style-panel__row__extra-button">
|
|
274
|
+
{verticalLabelAlign === undefined ? (
|
|
282
275
|
<TldrawUiToolbarButton
|
|
283
276
|
type="icon"
|
|
284
277
|
title={msg('style-panel.vertical-align')}
|
|
@@ -287,52 +280,20 @@ export function TextStylePickerSet({ theme, styles }: ThemeStylePickerSetProps)
|
|
|
287
280
|
>
|
|
288
281
|
<TldrawUiButtonIcon icon="vertical-align-middle" />
|
|
289
282
|
</TldrawUiToolbarButton>
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
style={DefaultHorizontalAlignStyle}
|
|
305
|
-
items={STYLES.horizontalAlign}
|
|
306
|
-
value={labelAlign}
|
|
307
|
-
onValueChange={handleValueChange}
|
|
308
|
-
theme={theme}
|
|
309
|
-
onHistoryMark={onHistoryMark}
|
|
310
|
-
/>
|
|
311
|
-
<div className="tlui-style-panel__row__extra-button">
|
|
312
|
-
{verticalLabelAlign === undefined ? (
|
|
313
|
-
<TldrawUiToolbarButton
|
|
314
|
-
type="icon"
|
|
315
|
-
title={msg('style-panel.vertical-align')}
|
|
316
|
-
data-testid="vertical-align"
|
|
317
|
-
disabled
|
|
318
|
-
>
|
|
319
|
-
<TldrawUiButtonIcon icon="vertical-align-middle" />
|
|
320
|
-
</TldrawUiToolbarButton>
|
|
321
|
-
) : (
|
|
322
|
-
<DropdownPicker
|
|
323
|
-
type="icon"
|
|
324
|
-
id="geo-vertical-alignment"
|
|
325
|
-
uiType="verticalAlign"
|
|
326
|
-
stylePanelType="vertical-align"
|
|
327
|
-
style={DefaultVerticalAlignStyle}
|
|
328
|
-
items={STYLES.verticalAlign}
|
|
329
|
-
value={verticalLabelAlign}
|
|
330
|
-
onValueChange={handleValueChange}
|
|
331
|
-
/>
|
|
332
|
-
)}
|
|
333
|
-
</div>
|
|
334
|
-
</TldrawUiToolbar>
|
|
335
|
-
</>
|
|
283
|
+
) : (
|
|
284
|
+
<DropdownPicker
|
|
285
|
+
type="icon"
|
|
286
|
+
id="geo-vertical-alignment"
|
|
287
|
+
uiType="verticalAlign"
|
|
288
|
+
stylePanelType="vertical-align"
|
|
289
|
+
style={DefaultVerticalAlignStyle}
|
|
290
|
+
items={STYLES.verticalAlign}
|
|
291
|
+
value={verticalLabelAlign}
|
|
292
|
+
onValueChange={handleValueChange}
|
|
293
|
+
/>
|
|
294
|
+
)}
|
|
295
|
+
</div>
|
|
296
|
+
</TldrawUiToolbar>
|
|
336
297
|
)}
|
|
337
298
|
</div>
|
|
338
299
|
)
|
|
@@ -449,7 +410,6 @@ export function OpacitySlider() {
|
|
|
449
410
|
const editor = useEditor()
|
|
450
411
|
|
|
451
412
|
const onHistoryMark = useCallback((id: string) => editor.markHistoryStoppingPoint(id), [editor])
|
|
452
|
-
const showUiLabels = useValue('showUiLabels', () => editor.user.getShowUiLabels(), [editor])
|
|
453
413
|
|
|
454
414
|
const opacity = useValue('opacity', () => editor.getSharedOpacity(), [editor])
|
|
455
415
|
const trackEvent = useUiEvents()
|
|
@@ -483,18 +443,14 @@ export function OpacitySlider() {
|
|
|
483
443
|
)
|
|
484
444
|
|
|
485
445
|
return (
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
onHistoryMark={onHistoryMark}
|
|
496
|
-
ariaValueModifier={25}
|
|
497
|
-
/>
|
|
498
|
-
</>
|
|
446
|
+
<TldrawUiSlider
|
|
447
|
+
data-testid="style.opacity"
|
|
448
|
+
value={opacityIndex >= 0 ? opacityIndex : tldrawSupportedOpacities.length - 1}
|
|
449
|
+
label={opacity.type === 'mixed' ? 'style-panel.mixed' : `opacity-style.${opacity.value}`}
|
|
450
|
+
onValueChange={handleOpacityValueChange}
|
|
451
|
+
steps={tldrawSupportedOpacities.length - 1}
|
|
452
|
+
title={msg('style-panel.opacity')}
|
|
453
|
+
onHistoryMark={onHistoryMark}
|
|
454
|
+
/>
|
|
499
455
|
)
|
|
500
456
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Box, TLImageShape, useEditor, useValue } from '@tldraw/editor'
|
|
2
|
-
import { useCallback,
|
|
1
|
+
import { Box, TLImageShape, track, useEditor, useValue } from '@tldraw/editor'
|
|
2
|
+
import { useCallback, useRef, useState } from 'react'
|
|
3
3
|
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
4
4
|
import { TldrawUiContextualToolbar } from '../primitives/TldrawUiContextualToolbar'
|
|
5
5
|
import { AltTextEditor } from './AltTextEditor'
|
|
@@ -11,7 +11,9 @@ export interface TLUiImageToolbarProps {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
/** @public @react */
|
|
14
|
-
export
|
|
14
|
+
export const DefaultImageToolbar = track(function DefaultImageToolbar({
|
|
15
|
+
children,
|
|
16
|
+
}: TLUiImageToolbarProps) {
|
|
15
17
|
const editor = useEditor()
|
|
16
18
|
const imageShapeId = useValue(
|
|
17
19
|
'imageShape',
|
|
@@ -22,11 +24,7 @@ export function DefaultImageToolbar({ children }: TLUiImageToolbarProps) {
|
|
|
22
24
|
},
|
|
23
25
|
[editor]
|
|
24
26
|
)
|
|
25
|
-
const showToolbar =
|
|
26
|
-
'showToolbar',
|
|
27
|
-
() => editor.isInAny('select.idle', 'select.pointing_shape', 'select.crop'),
|
|
28
|
-
[editor]
|
|
29
|
-
)
|
|
27
|
+
const showToolbar = editor.isInAny('select.idle', 'select.pointing_shape', 'select.crop')
|
|
30
28
|
const isLocked = useValue(
|
|
31
29
|
'locked',
|
|
32
30
|
() => (imageShapeId ? editor.getShape<TLImageShape>(imageShapeId)?.isLocked : false),
|
|
@@ -39,7 +37,7 @@ export function DefaultImageToolbar({ children }: TLUiImageToolbarProps) {
|
|
|
39
37
|
{children}
|
|
40
38
|
</ContextualToolbarInner>
|
|
41
39
|
)
|
|
42
|
-
}
|
|
40
|
+
})
|
|
43
41
|
|
|
44
42
|
function ContextualToolbarInner({
|
|
45
43
|
children,
|
|
@@ -51,18 +49,8 @@ function ContextualToolbarInner({
|
|
|
51
49
|
const editor = useEditor()
|
|
52
50
|
const msg = useTranslation()
|
|
53
51
|
|
|
54
|
-
const isChangingCrop = useValue(
|
|
55
|
-
'editor path',
|
|
56
|
-
() =>
|
|
57
|
-
editor.isInAny(
|
|
58
|
-
'select.crop.cropping',
|
|
59
|
-
'select.crop.pointing_crop_handle',
|
|
60
|
-
'select.crop.translating_crop'
|
|
61
|
-
),
|
|
62
|
-
[editor]
|
|
63
|
-
)
|
|
64
|
-
const camera = useValue('camera', () => editor.getCamera(), [editor])
|
|
65
52
|
const isInCropTool = useValue('editor path', () => editor.isIn('select.crop.'), [editor])
|
|
53
|
+
const isCropping = useValue('editor path', () => editor.isIn('select.crop.cropping'), [editor])
|
|
66
54
|
const previousSelectionBounds = useRef<Box | undefined>()
|
|
67
55
|
const handleManipulatingEnd = useCallback(() => {
|
|
68
56
|
editor.setCroppingShape(null)
|
|
@@ -77,10 +65,6 @@ function ContextualToolbarInner({
|
|
|
77
65
|
)
|
|
78
66
|
const onEditAltTextClose = useCallback(() => setIsEditingAltText(false), [])
|
|
79
67
|
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
previousSelectionBounds.current = undefined
|
|
82
|
-
}, [camera])
|
|
83
|
-
|
|
84
68
|
const getSelectionBounds = useCallback(() => {
|
|
85
69
|
if (isInCropTool && previousSelectionBounds.current) {
|
|
86
70
|
// If we're cropping we want to be able to keep the toolbar in the same position.
|
|
@@ -93,7 +77,7 @@ function ContextualToolbarInner({
|
|
|
93
77
|
return bounds
|
|
94
78
|
}, [editor, isInCropTool])
|
|
95
79
|
|
|
96
|
-
if (
|
|
80
|
+
if (isCropping) {
|
|
97
81
|
previousSelectionBounds.current = undefined
|
|
98
82
|
return null
|
|
99
83
|
}
|
|
@@ -61,13 +61,13 @@ export function OverflowingToolbar({ children }: OverflowingToolbarProps) {
|
|
|
61
61
|
const activeCss = lastActiveOverflowItem ? `:not([data-value="${lastActiveOverflowItem}"])` : ''
|
|
62
62
|
|
|
63
63
|
return `
|
|
64
|
-
#${id}_main > *:nth-
|
|
64
|
+
#${id}_main > *:nth-child(n + ${overflowIndex + (lastActiveOverflowItem ? 1 : 2)})${activeCss} {
|
|
65
65
|
display: none;
|
|
66
66
|
}
|
|
67
|
-
#${id}_more > *:nth-
|
|
67
|
+
#${id}_more > *:nth-child(-n + ${overflowIndex}) {
|
|
68
68
|
display: none;
|
|
69
69
|
}
|
|
70
|
-
#${id}_more > *:nth-
|
|
70
|
+
#${id}_more > *:nth-child(-n + ${overflowIndex + 4}) {
|
|
71
71
|
margin-top: 0;
|
|
72
72
|
}
|
|
73
73
|
`
|
|
@@ -5,14 +5,11 @@ import { useBreakpoint } from '../../context/breakpoints'
|
|
|
5
5
|
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
6
6
|
import { TldrawUiButton } from '../primitives/Button/TldrawUiButton'
|
|
7
7
|
import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
|
|
8
|
-
import { TldrawUiTooltip } from '../primitives/TldrawUiTooltip'
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
export interface ToggleToolLockedButtonProps {
|
|
9
|
+
interface ToggleToolLockedButtonProps {
|
|
12
10
|
activeToolId?: string
|
|
13
11
|
}
|
|
14
12
|
|
|
15
|
-
/** @public @react */
|
|
16
13
|
export function ToggleToolLockedButton({ activeToolId }: ToggleToolLockedButtonProps) {
|
|
17
14
|
const editor = useEditor()
|
|
18
15
|
const breakpoint = useBreakpoint()
|
|
@@ -26,18 +23,16 @@ export function ToggleToolLockedButton({ activeToolId }: ToggleToolLockedButtonP
|
|
|
26
23
|
if (!activeToolId || !tool.isLockable) return null
|
|
27
24
|
|
|
28
25
|
return (
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</TldrawUiButton>
|
|
41
|
-
</TldrawUiTooltip>
|
|
26
|
+
<TldrawUiButton
|
|
27
|
+
type="normal"
|
|
28
|
+
title={msg('action.toggle-tool-lock')}
|
|
29
|
+
data-testid="tool-lock"
|
|
30
|
+
className={classNames('tlui-toolbar__lock-button', {
|
|
31
|
+
'tlui-toolbar__lock-button__mobile': breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM,
|
|
32
|
+
})}
|
|
33
|
+
onClick={() => editor.updateInstanceState({ isToolLocked: !isToolLocked })}
|
|
34
|
+
>
|
|
35
|
+
<TldrawUiButtonIcon icon={isToolLocked ? 'lock' : 'unlock'} small />
|
|
36
|
+
</TldrawUiButton>
|
|
42
37
|
)
|
|
43
38
|
}
|
|
@@ -634,31 +634,6 @@ export function ToggleReduceMotionItem() {
|
|
|
634
634
|
)
|
|
635
635
|
}
|
|
636
636
|
|
|
637
|
-
/** @public @react */
|
|
638
|
-
export function ToggleKeyboardShortcutsItem() {
|
|
639
|
-
const editor = useEditor()
|
|
640
|
-
const keyboardShortcuts = useValue(
|
|
641
|
-
'keyboardShortcuts',
|
|
642
|
-
() => editor.user.getAreKeyboardShortcutsEnabled(),
|
|
643
|
-
[editor]
|
|
644
|
-
)
|
|
645
|
-
|
|
646
|
-
return (
|
|
647
|
-
<TldrawUiMenuActionCheckboxItem
|
|
648
|
-
actionId="toggle-keyboard-shortcuts"
|
|
649
|
-
checked={keyboardShortcuts}
|
|
650
|
-
/>
|
|
651
|
-
)
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
/** @public @react */
|
|
655
|
-
export function ToggleUiLabelsItem() {
|
|
656
|
-
const editor = useEditor()
|
|
657
|
-
const showUiLabels = useValue('showUiLabels', () => editor.user.getShowUiLabels(), [editor])
|
|
658
|
-
|
|
659
|
-
return <TldrawUiMenuActionCheckboxItem actionId="toggle-ui-labels" checked={showUiLabels} />
|
|
660
|
-
}
|
|
661
|
-
|
|
662
637
|
/** @public @react */
|
|
663
638
|
export function ToggleDebugModeItem() {
|
|
664
639
|
const editor = useEditor()
|
|
@@ -121,7 +121,6 @@ export const TldrawUiButtonPicker = memo(function TldrawUiButtonPicker<T extends
|
|
|
121
121
|
data-testid={`style.${uiType}`}
|
|
122
122
|
type="single"
|
|
123
123
|
className={classNames('tlui-buttons__grid')}
|
|
124
|
-
value={value.type === 'shared' ? value.value : undefined}
|
|
125
124
|
>
|
|
126
125
|
{items.map((item) => {
|
|
127
126
|
const label = title + ' — ' + msg(`${uiType}-style.${item.value}` as TLUiTranslationKey)
|
|
@@ -133,7 +132,6 @@ export const TldrawUiButtonPicker = memo(function TldrawUiButtonPicker<T extends
|
|
|
133
132
|
data-testid={`style.${uiType}.${item.value}`}
|
|
134
133
|
aria-label={label}
|
|
135
134
|
value={item.value}
|
|
136
|
-
data-state={value.type === 'shared' && value.value === item.value ? 'on' : 'off'}
|
|
137
135
|
data-isactive={value.type === 'shared' && value.value === item.value}
|
|
138
136
|
title={label}
|
|
139
137
|
className={classNames('tlui-button-grid__button')}
|
|
@@ -65,7 +65,7 @@ export interface TLUiDialogBodyProps {
|
|
|
65
65
|
/** @public @react */
|
|
66
66
|
export function TldrawUiDialogBody({ className, children, style }: TLUiDialogBodyProps) {
|
|
67
67
|
return (
|
|
68
|
-
<div className={classNames('tlui-dialog__body', className)} style={style}
|
|
68
|
+
<div className={classNames('tlui-dialog__body', className)} style={style}>
|
|
69
69
|
{children}
|
|
70
70
|
</div>
|
|
71
71
|
)
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import classNames from 'classnames'
|
|
2
|
-
import {
|
|
2
|
+
import { memo, useLayoutEffect, useRef } from 'react'
|
|
3
3
|
import { useAssetUrls } from '../../context/asset-urls'
|
|
4
4
|
import { TLUiIconType } from '../../icon-types'
|
|
5
5
|
|
|
6
|
-
/** @public */
|
|
7
|
-
export type TLUiIconJsx = ReactElement<React.HTMLAttributes<HTMLDivElement>>
|
|
8
|
-
|
|
9
6
|
/** @public */
|
|
10
7
|
export interface TLUiIconProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
-
icon: TLUiIconType | Exclude<string, TLUiIconType>
|
|
8
|
+
icon: TLUiIconType | Exclude<string, TLUiIconType>
|
|
12
9
|
label: string
|
|
13
10
|
small?: boolean
|
|
14
11
|
color?: string
|
|
@@ -27,41 +24,6 @@ export const TldrawUiIcon = memo(function TldrawUiIcon({
|
|
|
27
24
|
className,
|
|
28
25
|
...props
|
|
29
26
|
}: TLUiIconProps) {
|
|
30
|
-
if (typeof icon === 'string') {
|
|
31
|
-
return (
|
|
32
|
-
<TldrawUIIconInner
|
|
33
|
-
label={label}
|
|
34
|
-
small={small}
|
|
35
|
-
invertIcon={invertIcon}
|
|
36
|
-
icon={icon}
|
|
37
|
-
color={color}
|
|
38
|
-
className={className}
|
|
39
|
-
{...props}
|
|
40
|
-
/>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return cloneElement(icon, {
|
|
45
|
-
...props,
|
|
46
|
-
className: classNames({ 'tlui-icon__small': small }, className, icon.props.className),
|
|
47
|
-
'aria-label': label,
|
|
48
|
-
style: {
|
|
49
|
-
color,
|
|
50
|
-
transform: invertIcon ? 'scale(-1, 1)' : undefined,
|
|
51
|
-
...icon.props.style,
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
function TldrawUIIconInner({
|
|
57
|
-
label,
|
|
58
|
-
small,
|
|
59
|
-
invertIcon,
|
|
60
|
-
icon,
|
|
61
|
-
color,
|
|
62
|
-
className,
|
|
63
|
-
...props
|
|
64
|
-
}: TLUiIconProps & { icon: TLUiIconType | Exclude<string, TLUiIconType> }) {
|
|
65
27
|
const assetUrls = useAssetUrls()
|
|
66
28
|
const asset = assetUrls.icons[icon as TLUiIconType] ?? assetUrls.icons['question-mark-circle']
|
|
67
29
|
const ref = useRef<HTMLDivElement>(null)
|
|
@@ -107,4 +69,4 @@ function TldrawUIIconInner({
|
|
|
107
69
|
}}
|
|
108
70
|
/>
|
|
109
71
|
)
|
|
110
|
-
}
|
|
72
|
+
})
|
|
@@ -13,7 +13,6 @@ export interface TLUiSliderProps {
|
|
|
13
13
|
onValueChange(value: number): void
|
|
14
14
|
onHistoryMark(id: string): void
|
|
15
15
|
'data-testid'?: string
|
|
16
|
-
ariaValueModifier?: number
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
/** @public @react */
|
|
@@ -27,7 +26,6 @@ export const TldrawUiSlider = React.forwardRef<HTMLDivElement, TLUiSliderProps>(
|
|
|
27
26
|
label,
|
|
28
27
|
onValueChange,
|
|
29
28
|
['data-testid']: testId,
|
|
30
|
-
ariaValueModifier = 1,
|
|
31
29
|
}: TLUiSliderProps,
|
|
32
30
|
ref
|
|
33
31
|
) {
|
|
@@ -83,10 +81,7 @@ export const TldrawUiSlider = React.forwardRef<HTMLDivElement, TLUiSliderProps>(
|
|
|
83
81
|
</_Slider.Track>
|
|
84
82
|
{value !== null && (
|
|
85
83
|
<_Slider.Thumb
|
|
86
|
-
aria-
|
|
87
|
-
aria-valuenow={value * ariaValueModifier}
|
|
88
|
-
aria-valuemax={steps * ariaValueModifier}
|
|
89
|
-
aria-label={title + ' — ' + msg(label as TLUiTranslationKey)}
|
|
84
|
+
aria-label={msg('style-panel.opacity')}
|
|
90
85
|
className="tlui-slider__thumb"
|
|
91
86
|
dir="ltr"
|
|
92
87
|
ref={ref}
|