tldraw 3.16.0-internal.51e99e128bd4 → 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 +23 -297
- package/dist-cjs/index.js +2 -30
- 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/TldrawScribble.js +1 -1
- package/dist-cjs/lib/canvas/TldrawScribble.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 +44 -27
- 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/elbow/ElbowArrowDebug.js +3 -3
- package/dist-cjs/lib/shapes/arrow/elbow/ElbowArrowDebug.js.map +1 -1
- 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 +6 -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 +17 -17
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/components/FrameHeading.js +1 -1
- package/dist-cjs/lib/shapes/frame/components/FrameHeading.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +2 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js +1 -2
- package/dist-cjs/lib/shapes/geo/components/GeoShapeBody.js.map +2 -2
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +4 -5
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js +3 -3
- package/dist-cjs/lib/shapes/image/ImageShapeUtil.js.map +1 -1
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js +5 -20
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +5 -6
- 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/ShapeFill.js +4 -4
- package/dist-cjs/lib/shapes/shared/ShapeFill.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/freehand/svg.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 +13 -7
- 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/styles.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js +1 -25
- package/dist-cjs/lib/tools/EraserTool/childStates/Erasing.js.map +2 -2
- package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.js +0 -12
- package/dist-cjs/lib/tools/EraserTool/childStates/Pointing.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/TldrawUi.js +0 -14
- package/dist-cjs/lib/ui/TldrawUi.js.map +3 -3
- 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/ActionsMenu/DefaultActionsMenu.js +3 -12
- package/dist-cjs/lib/ui/components/ActionsMenu/DefaultActionsMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/DefaultMenuPanel.js +2 -3
- package/dist-cjs/lib/ui/components/DefaultMenuPanel.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/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 +3 -5
- package/dist-cjs/lib/ui/components/MobileStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +5 -4
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +1 -2
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/SharePanel/PeopleMenuItem.js +2 -3
- 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/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 +139 -171
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js +3 -3
- package/dist-cjs/lib/ui/components/StylePanel/DoubleDropdownPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js +25 -26
- package/dist-cjs/lib/ui/components/StylePanel/DropdownPicker.js.map +3 -3
- 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/DefaultImageToolbarContent.js +1 -1
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbarContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js +21 -66
- package/dist-cjs/lib/ui/components/Toolbar/DefaultToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +80 -189
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +4 -5
- 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 +16 -7
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +3 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/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/TldrawUiPopover.js +2 -3
- package/dist-cjs/lib/ui/components/primitives/TldrawUiPopover.js.map +3 -3
- 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 +7 -31
- 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/TldrawUiMenuContext.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js +12 -25
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuGroup.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +22 -154
- 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 +9 -94
- 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 +23 -297
- package/dist-esm/index.mjs +4 -51
- 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/TldrawScribble.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawScribble.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 +44 -30
- 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/elbow/ElbowArrowDebug.mjs +3 -3
- package/dist-esm/lib/shapes/arrow/elbow/ElbowArrowDebug.mjs.map +1 -1
- 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 +6 -4
- 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 +17 -18
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs +1 -1
- package/dist-esm/lib/shapes/frame/components/FrameHeading.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +2 -3
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs +1 -2
- package/dist-esm/lib/shapes/geo/components/GeoShapeBody.mjs.map +2 -2
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +4 -6
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs +3 -3
- package/dist-esm/lib/shapes/image/ImageShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +5 -21
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +5 -7
- 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/ShapeFill.mjs +4 -5
- package/dist-esm/lib/shapes/shared/ShapeFill.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/freehand/svg.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 +13 -8
- 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/styles.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs +1 -26
- package/dist-esm/lib/tools/EraserTool/childStates/Erasing.mjs.map +2 -2
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.mjs +0 -13
- package/dist-esm/lib/tools/EraserTool/childStates/Pointing.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/TldrawUi.mjs +2 -16
- package/dist-esm/lib/ui/TldrawUi.mjs.map +3 -3
- 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/ActionsMenu/DefaultActionsMenu.mjs +3 -12
- package/dist-esm/lib/ui/components/ActionsMenu/DefaultActionsMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/DefaultMenuPanel.mjs +2 -3
- package/dist-esm/lib/ui/components/DefaultMenuPanel.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/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 +3 -6
- package/dist-esm/lib/ui/components/MobileStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +5 -4
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +1 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/SharePanel/PeopleMenuItem.mjs +2 -3
- 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/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 +139 -171
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs +3 -3
- package/dist-esm/lib/ui/components/StylePanel/DoubleDropdownPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.mjs +25 -26
- package/dist-esm/lib/ui/components/StylePanel/DropdownPicker.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/DefaultImageToolbarContent.mjs +1 -1
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbarContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs +21 -56
- package/dist-esm/lib/ui/components/Toolbar/DefaultToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +81 -192
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +3 -3
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +4 -5
- 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 +6 -8
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +1 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/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/TldrawUiPopover.mjs +2 -3
- package/dist-esm/lib/ui/components/primitives/TldrawUiPopover.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 +7 -31
- 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/TldrawUiMenuContext.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs +12 -25
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuGroup.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +24 -162
- 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 +10 -102
- 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 +34 -12
- package/src/index.ts +2 -39
- 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/TldrawScribble.tsx +1 -1
- package/src/lib/canvas/TldrawSelectionForeground.tsx +1 -5
- package/src/lib/defaultExternalContentHandlers.ts +1 -2
- package/src/lib/shapes/arrow/ArrowShapeOptions.test.ts +1 -2
- package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +3 -4
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +11 -12
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +46 -30
- package/src/lib/shapes/arrow/arrowLabel.ts +3 -23
- package/src/lib/shapes/arrow/arrowTargetState.ts +1 -2
- package/src/lib/shapes/arrow/elbow/ElbowArrowDebug.tsx +3 -3
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +0 -3
- package/src/lib/shapes/draw/DrawShapeTool.test.ts +5 -0
- package/src/lib/shapes/draw/DrawShapeUtil.tsx +7 -4
- package/src/lib/shapes/embed/EmbedShapeUtil.tsx +1 -1
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +21 -26
- package/src/lib/shapes/frame/components/FrameHeading.tsx +1 -1
- package/src/lib/shapes/geo/GeoShapeUtil.tsx +2 -3
- package/src/lib/shapes/geo/components/GeoShapeBody.tsx +2 -2
- package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +4 -7
- package/src/lib/shapes/image/ImageShapeUtil.tsx +3 -3
- package/src/lib/shapes/line/LineShapeUtil.test.tsx +3 -4
- package/src/lib/shapes/line/LineShapeUtil.tsx +6 -25
- package/src/lib/shapes/line/__snapshots__/LineShapeUtil.test.tsx.snap +2 -2
- package/src/lib/shapes/note/NoteShapeUtil.tsx +4 -10
- 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/ShapeFill.tsx +4 -5
- package/src/lib/shapes/shared/SvgTextLabel.tsx +2 -4
- package/src/lib/shapes/shared/freehand/svg.ts +0 -2
- package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +1 -11
- package/src/lib/shapes/text/TextShapeTool.test.ts +5 -6
- package/src/lib/shapes/text/TextShapeUtil.tsx +14 -8
- package/src/lib/shapes/video/VideoShapeUtil.tsx +3 -3
- package/src/lib/styles.tsx +1 -3
- package/src/lib/tools/EraserTool/childStates/Erasing.ts +1 -34
- package/src/lib/tools/EraserTool/childStates/Pointing.ts +0 -20
- 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 +1 -11
- package/src/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.ts +0 -1
- package/src/lib/ui/TldrawUi.tsx +2 -17
- package/src/lib/ui/components/A11y.tsx +13 -15
- package/src/lib/ui/components/ActionsMenu/DefaultActionsMenu.tsx +3 -15
- package/src/lib/ui/components/DefaultMenuPanel.tsx +3 -4
- 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/Minimap/MinimapManager.ts +4 -4
- package/src/lib/ui/components/MobileStylePanel.tsx +6 -9
- package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +5 -4
- package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +2 -3
- package/src/lib/ui/components/SharePanel/PeopleMenuItem.tsx +3 -4
- package/src/lib/ui/components/SharePanel/UserPresenceColorPicker.tsx +3 -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 +106 -146
- package/src/lib/ui/components/StylePanel/DoubleDropdownPicker.tsx +3 -3
- package/src/lib/ui/components/StylePanel/DropdownPicker.tsx +6 -7
- package/src/lib/ui/components/Toolbar/DefaultImageToolbar.tsx +9 -25
- package/src/lib/ui/components/Toolbar/DefaultImageToolbarContent.tsx +1 -1
- package/src/lib/ui/components/Toolbar/DefaultToolbar.tsx +23 -55
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +61 -212
- 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 +35 -40
- package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +1 -1
- 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/TldrawUiPopover.tsx +2 -4
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +1 -6
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +12 -56
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +2 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuContext.tsx +1 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuGroup.tsx +16 -29
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +23 -224
- 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 -6
- 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 +11 -142
- 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 +314 -414
- package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +7 -21
- package/src/lib/utils/excalidraw/putExcalidrawContent.ts +1 -1
- package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +7 -28
- package/src/lib/utils/tldr/buildFromV1Document.ts +1 -2
- package/src/test/A11y.test.tsx +2 -3
- package/src/test/ClickManager.test.ts +6 -7
- package/src/test/Editor.test.tsx +20 -21
- package/src/test/EraserTool.test.ts +13 -184
- package/src/test/HandTool.test.ts +9 -10
- package/src/test/HighlightShape.test.ts +1 -2
- package/src/test/SelectTool.test.ts +13 -40
- package/src/test/TLUserPreferences.test.ts +3 -4
- package/src/test/TestEditor.ts +15 -13
- package/src/test/TldrawEditor.test.tsx +10 -11
- package/src/test/ZoomTool.test.ts +6 -7
- 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 +10 -17
- package/src/test/bindings.test.tsx +37 -24
- package/src/test/bookmark-shapes.test.ts +8 -1
- package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +7 -23
- 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 +24 -25
- package/src/test/commands/animationSpeed.test.ts +1 -2
- package/src/test/commands/centerOnPoint.test.ts +2 -3
- package/src/test/commands/clipboard.test.ts +2 -3
- package/src/test/commands/createShapes.test.ts +1 -2
- package/src/test/commands/deletePage.test.ts +1 -84
- package/src/test/commands/deleteShapes.test.ts +1 -2
- package/src/test/commands/distributeShapes.test.tsx +10 -11
- package/src/test/commands/getSvgString.test.ts +1 -2
- package/src/test/commands/packShapes.test.ts +4 -5
- package/src/test/commands/resizeShape.test.ts +1 -2
- package/src/test/commands/rotateShapes.test.ts +6 -7
- package/src/test/commands/setCamera.test.ts +3 -4
- package/src/test/commands/setCurrentPage.test.ts +2 -3
- package/src/test/commands/stackShapes.test.ts +10 -11
- package/src/test/commands/stretch.test.tsx +12 -13
- package/src/test/createDeepLink.test.tsx +1 -2
- package/src/test/cropping.test.ts +2 -3
- package/src/test/drawing.test.ts +1 -2
- package/src/test/flipShapes.test.ts +3 -4
- package/src/test/frames.test.ts +24 -25
- package/src/test/getCulledShapes.test.tsx +2 -3
- package/src/test/groups.test.tsx +2 -2
- package/src/test/handleDeepLink.test.tsx +1 -2
- package/src/test/maxShapes.test.ts +2 -3
- package/src/test/modifiers.test.ts +4 -5
- package/src/test/navigation.test.ts +9 -264
- package/src/test/panning.test.ts +1 -2
- package/src/test/perf/perf.test.ts +1 -2
- package/src/test/registerDeepLinkListener.test.tsx +9 -10
- package/src/test/resizing.test.ts +38 -39
- package/src/test/select.test.tsx +3 -4
- package/src/test/selection-omnibus.test.ts +10 -11
- package/src/test/shapeutils.test.ts +48 -398
- package/src/test/translating.test.ts +9 -10
- package/tldraw.css +627 -726
- 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 -268
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +0 -7
- package/dist-cjs/lib/ui/components/primitives/layout.js +0 -76
- package/dist-cjs/lib/ui/components/primitives/layout.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 -245
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +0 -7
- package/dist-esm/lib/ui/components/primitives/layout.mjs +0 -46
- package/dist-esm/lib/ui/components/primitives/layout.mjs.map +0 -7
- package/src/lib/ui/components/AccessibilityMenu.tsx +0 -20
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +0 -327
- package/src/lib/ui/components/primitives/layout.tsx +0 -107
- package/src/test/inner-outer-margin.test.ts +0 -315
|
@@ -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}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import classnames from 'classnames'
|
|
2
2
|
import { Toolbar as _Toolbar } from 'radix-ui'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import { TldrawUiColumn, TldrawUiGrid, TldrawUiRow } from './layout'
|
|
5
|
-
import { TldrawUiTooltip } from './TldrawUiTooltip'
|
|
6
4
|
|
|
7
5
|
/** @public */
|
|
8
6
|
export interface TLUiToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -10,42 +8,20 @@ export interface TLUiToolbarProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
10
8
|
className?: string
|
|
11
9
|
dir?: 'ltr' | 'rtl'
|
|
12
10
|
label: string
|
|
13
|
-
orientation?: 'horizontal' | 'vertical' | 'grid'
|
|
14
|
-
tooltipSide?: 'top' | 'right' | 'bottom' | 'left'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const LayoutByOrientation = {
|
|
18
|
-
horizontal: TldrawUiRow,
|
|
19
|
-
vertical: TldrawUiColumn,
|
|
20
|
-
grid: TldrawUiGrid,
|
|
21
11
|
}
|
|
22
12
|
|
|
23
13
|
/** @public @react */
|
|
24
14
|
export const TldrawUiToolbar = React.forwardRef<HTMLDivElement, TLUiToolbarProps>(
|
|
25
|
-
(
|
|
26
|
-
{
|
|
27
|
-
children,
|
|
28
|
-
className,
|
|
29
|
-
label,
|
|
30
|
-
orientation = 'horizontal',
|
|
31
|
-
tooltipSide,
|
|
32
|
-
...props
|
|
33
|
-
}: TLUiToolbarProps,
|
|
34
|
-
ref
|
|
35
|
-
) => {
|
|
36
|
-
const Layout = LayoutByOrientation[orientation]
|
|
15
|
+
({ children, className, label, ...props }: TLUiToolbarProps, ref) => {
|
|
37
16
|
return (
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{children}
|
|
47
|
-
</_Toolbar.Root>
|
|
48
|
-
</Layout>
|
|
17
|
+
<_Toolbar.Root
|
|
18
|
+
ref={ref}
|
|
19
|
+
{...props}
|
|
20
|
+
className={classnames('tlui-toolbar-container', className)}
|
|
21
|
+
aria-label={label}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</_Toolbar.Root>
|
|
49
25
|
)
|
|
50
26
|
}
|
|
51
27
|
)
|
|
@@ -58,30 +34,23 @@ export interface TLUiToolbarButtonProps extends React.HTMLAttributes<HTMLButtonE
|
|
|
58
34
|
disabled?: boolean
|
|
59
35
|
isActive?: boolean
|
|
60
36
|
type: 'icon' | 'tool' | 'menu'
|
|
61
|
-
tooltip?: string
|
|
62
37
|
}
|
|
63
38
|
|
|
64
39
|
/** @public @react */
|
|
65
40
|
export const TldrawUiToolbarButton = React.forwardRef<HTMLButtonElement, TLUiToolbarButtonProps>(
|
|
66
|
-
({ asChild, children, type, isActive,
|
|
67
|
-
|
|
41
|
+
({ asChild, children, type, isActive, ...props }: TLUiToolbarButtonProps, ref) => {
|
|
42
|
+
return (
|
|
68
43
|
<_Toolbar.Button
|
|
69
44
|
ref={ref}
|
|
70
45
|
asChild={asChild}
|
|
71
46
|
draggable={false}
|
|
72
47
|
data-isactive={isActive}
|
|
73
48
|
{...props}
|
|
74
|
-
// The tooltip takes care of this.
|
|
75
|
-
title={undefined}
|
|
76
49
|
className={classnames('tlui-button', `tlui-button__${type}`, props.className)}
|
|
77
50
|
>
|
|
78
51
|
{children}
|
|
79
52
|
</_Toolbar.Button>
|
|
80
53
|
)
|
|
81
|
-
|
|
82
|
-
const tooltipContent = tooltip || props.title
|
|
83
|
-
|
|
84
|
-
return <TldrawUiTooltip content={tooltipContent}>{button}</TldrawUiTooltip>
|
|
85
54
|
}
|
|
86
55
|
)
|
|
87
56
|
|
|
@@ -90,7 +59,6 @@ export interface TLUiToolbarToggleGroupProps extends React.HTMLAttributes<HTMLDi
|
|
|
90
59
|
children?: React.ReactNode
|
|
91
60
|
className?: string
|
|
92
61
|
dir?: 'ltr' | 'rtl'
|
|
93
|
-
value: any
|
|
94
62
|
// TODO: fix up this type later
|
|
95
63
|
defaultValue?: any
|
|
96
64
|
type: 'single' | 'multiple'
|
|
@@ -107,10 +75,6 @@ export const TldrawUiToolbarToggleGroup = ({
|
|
|
107
75
|
<_Toolbar.ToggleGroup
|
|
108
76
|
type={type}
|
|
109
77
|
{...props}
|
|
110
|
-
// TODO: this fixes a bug in Radix until they fix it.
|
|
111
|
-
// https://github.com/radix-ui/primitives/issues/3188
|
|
112
|
-
// https://github.com/radix-ui/primitives/pull/3189
|
|
113
|
-
role="radiogroup"
|
|
114
78
|
className={classnames('tlui-toolbar-toggle-group', className)}
|
|
115
79
|
>
|
|
116
80
|
{children}
|
|
@@ -124,7 +88,6 @@ export interface TLUiToolbarToggleItemProps extends React.HTMLAttributes<HTMLBut
|
|
|
124
88
|
className?: string
|
|
125
89
|
type: 'icon' | 'tool'
|
|
126
90
|
value: string
|
|
127
|
-
tooltip?: string
|
|
128
91
|
}
|
|
129
92
|
|
|
130
93
|
/** @public @react */
|
|
@@ -133,14 +96,11 @@ export const TldrawUiToolbarToggleItem = ({
|
|
|
133
96
|
className,
|
|
134
97
|
type,
|
|
135
98
|
value,
|
|
136
|
-
tooltip,
|
|
137
99
|
...props
|
|
138
100
|
}: TLUiToolbarToggleItemProps) => {
|
|
139
|
-
|
|
101
|
+
return (
|
|
140
102
|
<_Toolbar.ToggleItem
|
|
141
103
|
{...props}
|
|
142
|
-
// The tooltip takes care of this.
|
|
143
|
-
title={undefined}
|
|
144
104
|
className={classnames(
|
|
145
105
|
'tlui-button',
|
|
146
106
|
`tlui-button__${type}`,
|
|
@@ -152,8 +112,4 @@ export const TldrawUiToolbarToggleItem = ({
|
|
|
152
112
|
{children}
|
|
153
113
|
</_Toolbar.ToggleItem>
|
|
154
114
|
)
|
|
155
|
-
|
|
156
|
-
const tooltipContent = tooltip || props.title
|
|
157
|
-
|
|
158
|
-
return <TldrawUiTooltip content={tooltipContent}>{toggleItem}</TldrawUiTooltip>
|
|
159
115
|
}
|
|
@@ -5,7 +5,7 @@ import { TLUiEventSource } from '../../../context/events'
|
|
|
5
5
|
import { useReadonly } from '../../../hooks/useReadonly'
|
|
6
6
|
import { TLUiTranslationKey } from '../../../hooks/useTranslation/TLUiTranslationKey'
|
|
7
7
|
import { useTranslation } from '../../../hooks/useTranslation/useTranslation'
|
|
8
|
-
import { TldrawUiIcon
|
|
8
|
+
import { TldrawUiIcon } from '../TldrawUiIcon'
|
|
9
9
|
import { TldrawUiKbd } from '../TldrawUiKbd'
|
|
10
10
|
import { useTldrawUiMenuContext } from './TldrawUiMenuContext'
|
|
11
11
|
|
|
@@ -14,7 +14,7 @@ export interface TLUiMenuCheckboxItemProps<
|
|
|
14
14
|
TranslationKey extends string = string,
|
|
15
15
|
IconType extends string = string,
|
|
16
16
|
> {
|
|
17
|
-
icon?: IconType
|
|
17
|
+
icon?: IconType
|
|
18
18
|
id: string
|
|
19
19
|
kbd?: string
|
|
20
20
|
title?: string
|
|
@@ -3,7 +3,6 @@ import { ReactNode } from 'react'
|
|
|
3
3
|
import { unwrapLabel } from '../../../context/actions'
|
|
4
4
|
import { TLUiTranslationKey } from '../../../hooks/useTranslation/TLUiTranslationKey'
|
|
5
5
|
import { useTranslation } from '../../../hooks/useTranslation/useTranslation'
|
|
6
|
-
import { TldrawUiColumn, TldrawUiGrid, TldrawUiRow, useTldrawUiOrientation } from '../layout'
|
|
7
6
|
import { TldrawUiDropdownMenuGroup } from '../TldrawUiDropdownMenu'
|
|
8
7
|
import { useTldrawUiMenuContext } from './TldrawUiMenuContext'
|
|
9
8
|
|
|
@@ -20,20 +19,26 @@ export interface TLUiMenuGroupProps<TranslationKey extends string = string> {
|
|
|
20
19
|
|
|
21
20
|
/** @public @react */
|
|
22
21
|
export function TldrawUiMenuGroup({ id, label, className, children }: TLUiMenuGroupProps) {
|
|
23
|
-
const
|
|
24
|
-
const { orientation } = useTldrawUiOrientation()
|
|
22
|
+
const { type: menuType, sourceId } = useTldrawUiMenuContext()
|
|
25
23
|
const msg = useTranslation()
|
|
26
|
-
const labelToUse = unwrapLabel(label,
|
|
24
|
+
const labelToUse = unwrapLabel(label, menuType)
|
|
27
25
|
const labelStr = labelToUse ? msg(labelToUse as TLUiTranslationKey) : undefined
|
|
28
26
|
|
|
29
|
-
switch (
|
|
30
|
-
case '
|
|
27
|
+
switch (menuType) {
|
|
28
|
+
case 'panel': {
|
|
31
29
|
return (
|
|
32
|
-
<
|
|
33
|
-
className={className}
|
|
34
|
-
data-testid={`${
|
|
30
|
+
<div
|
|
31
|
+
className={classNames('tlui-menu__group', className)}
|
|
32
|
+
data-testid={`${sourceId}-group.${id}`}
|
|
35
33
|
>
|
|
36
34
|
{children}
|
|
35
|
+
</div>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
case 'menu': {
|
|
39
|
+
return (
|
|
40
|
+
<TldrawUiDropdownMenuGroup className={className} data-testid={`${sourceId}-group.${id}`}>
|
|
41
|
+
{children}
|
|
37
42
|
</TldrawUiDropdownMenuGroup>
|
|
38
43
|
)
|
|
39
44
|
}
|
|
@@ -42,7 +47,7 @@ export function TldrawUiMenuGroup({ id, label, className, children }: TLUiMenuGr
|
|
|
42
47
|
<div
|
|
43
48
|
dir="ltr"
|
|
44
49
|
className={classNames('tlui-menu__group', className)}
|
|
45
|
-
data-testid={`${
|
|
50
|
+
data-testid={`${sourceId}-group.${id}`}
|
|
46
51
|
>
|
|
47
52
|
{children}
|
|
48
53
|
</div>
|
|
@@ -51,30 +56,12 @@ export function TldrawUiMenuGroup({ id, label, className, children }: TLUiMenuGr
|
|
|
51
56
|
case 'keyboard-shortcuts': {
|
|
52
57
|
// todo: if groups need a label, let's give em a label
|
|
53
58
|
return (
|
|
54
|
-
<div className="tlui-shortcuts-dialog__group" data-testid={`${
|
|
59
|
+
<div className="tlui-shortcuts-dialog__group" data-testid={`${sourceId}-group.${id}`}>
|
|
55
60
|
<h2 className="tlui-shortcuts-dialog__group__title">{labelStr}</h2>
|
|
56
61
|
<div className="tlui-shortcuts-dialog__group__content">{children}</div>
|
|
57
62
|
</div>
|
|
58
63
|
)
|
|
59
64
|
}
|
|
60
|
-
case 'toolbar': {
|
|
61
|
-
const Layout = orientation === 'horizontal' ? TldrawUiRow : TldrawUiColumn
|
|
62
|
-
return (
|
|
63
|
-
<Layout className="tlui-main-toolbar__group" data-testid={`${menu.sourceId}-group.${id}`}>
|
|
64
|
-
{children}
|
|
65
|
-
</Layout>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
case 'toolbar-overflow': {
|
|
69
|
-
return (
|
|
70
|
-
<TldrawUiGrid
|
|
71
|
-
className="tlui-main-toolbar__group"
|
|
72
|
-
data-testid={`${menu.sourceId}-group.${id}`}
|
|
73
|
-
>
|
|
74
|
-
{children}
|
|
75
|
-
</TldrawUiGrid>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
65
|
default: {
|
|
79
66
|
return children
|
|
80
67
|
}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
exhaustiveSwitchError,
|
|
3
|
-
getPointerInfo,
|
|
4
|
-
preventDefault,
|
|
5
|
-
TLPointerEventInfo,
|
|
6
|
-
useEditor,
|
|
7
|
-
Vec,
|
|
8
|
-
VecModel,
|
|
9
|
-
} from '@tldraw/editor'
|
|
1
|
+
import { exhaustiveSwitchError, preventDefault } from '@tldraw/editor'
|
|
10
2
|
import { ContextMenu as _ContextMenu } from 'radix-ui'
|
|
11
|
-
import {
|
|
3
|
+
import { useState } from 'react'
|
|
12
4
|
import { unwrapLabel } from '../../../context/actions'
|
|
13
5
|
import { TLUiEventSource } from '../../../context/events'
|
|
14
6
|
import { useReadonly } from '../../../hooks/useReadonly'
|
|
15
|
-
import { TLUiToolItem } from '../../../hooks/useTools'
|
|
16
7
|
import { TLUiTranslationKey } from '../../../hooks/useTranslation/TLUiTranslationKey'
|
|
17
8
|
import { useTranslation } from '../../../hooks/useTranslation/useTranslation'
|
|
18
9
|
import { kbdStr } from '../../../kbd-utils'
|
|
@@ -21,10 +12,8 @@ import { TldrawUiButton } from '../Button/TldrawUiButton'
|
|
|
21
12
|
import { TldrawUiButtonIcon } from '../Button/TldrawUiButtonIcon'
|
|
22
13
|
import { TldrawUiButtonLabel } from '../Button/TldrawUiButtonLabel'
|
|
23
14
|
import { TldrawUiDropdownMenuItem } from '../TldrawUiDropdownMenu'
|
|
24
|
-
import { TLUiIconJsx } from '../TldrawUiIcon'
|
|
25
15
|
import { TldrawUiKbd } from '../TldrawUiKbd'
|
|
26
16
|
import { TldrawUiToolbarButton } from '../TldrawUiToolbar'
|
|
27
|
-
import { tooltipManager } from '../TldrawUiTooltip'
|
|
28
17
|
import { useTldrawUiMenuContext } from './TldrawUiMenuContext'
|
|
29
18
|
|
|
30
19
|
/** @public */
|
|
@@ -36,11 +25,11 @@ export interface TLUiMenuItemProps<
|
|
|
36
25
|
/**
|
|
37
26
|
* The icon to display on the item. Icons are only shown in certain menu types.
|
|
38
27
|
*/
|
|
39
|
-
icon?: IconType
|
|
28
|
+
icon?: IconType
|
|
40
29
|
/**
|
|
41
30
|
* An icon to display to the left of the menu item.
|
|
42
31
|
*/
|
|
43
|
-
iconLeft?: IconType
|
|
32
|
+
iconLeft?: IconType
|
|
44
33
|
/**
|
|
45
34
|
* The keyboard shortcut to display on the item.
|
|
46
35
|
*/
|
|
@@ -73,10 +62,6 @@ export interface TLUiMenuItemProps<
|
|
|
73
62
|
* Whether the item is selected.
|
|
74
63
|
*/
|
|
75
64
|
isSelected?: boolean
|
|
76
|
-
/**
|
|
77
|
-
* The function to call when the item is dragged. If this is provided, the item will be draggable.
|
|
78
|
-
*/
|
|
79
|
-
onDragStart?(source: TLUiEventSource, info: TLPointerEventInfo): void
|
|
80
65
|
}
|
|
81
66
|
|
|
82
67
|
/** @public @react */
|
|
@@ -95,7 +80,6 @@ export function TldrawUiMenuItem<
|
|
|
95
80
|
onSelect,
|
|
96
81
|
noClose,
|
|
97
82
|
isSelected,
|
|
98
|
-
onDragStart,
|
|
99
83
|
}: TLUiMenuItemProps<TranslationKey, IconType>) {
|
|
100
84
|
const { type: menuType, sourceId } = useTldrawUiMenuContext()
|
|
101
85
|
|
|
@@ -120,6 +104,7 @@ export function TldrawUiMenuItem<
|
|
|
120
104
|
type="menu"
|
|
121
105
|
data-testid={`${sourceId}.${id}`}
|
|
122
106
|
disabled={disabled}
|
|
107
|
+
title={titleStr}
|
|
123
108
|
onClick={(e) => {
|
|
124
109
|
if (noClose) {
|
|
125
110
|
preventDefault(e)
|
|
@@ -145,6 +130,7 @@ export function TldrawUiMenuItem<
|
|
|
145
130
|
return (
|
|
146
131
|
<_ContextMenu.Item
|
|
147
132
|
dir="ltr"
|
|
133
|
+
title={titleStr}
|
|
148
134
|
draggable={false}
|
|
149
135
|
className="tlui-button tlui-button__menu"
|
|
150
136
|
data-testid={`${sourceId}.${id}`}
|
|
@@ -166,6 +152,20 @@ export function TldrawUiMenuItem<
|
|
|
166
152
|
</_ContextMenu.Item>
|
|
167
153
|
)
|
|
168
154
|
}
|
|
155
|
+
case 'panel': {
|
|
156
|
+
return (
|
|
157
|
+
<TldrawUiButton
|
|
158
|
+
data-testid={`${sourceId}.${id}`}
|
|
159
|
+
type="menu"
|
|
160
|
+
title={titleStr}
|
|
161
|
+
disabled={disabled}
|
|
162
|
+
onClick={() => onSelect(sourceId)}
|
|
163
|
+
>
|
|
164
|
+
<TldrawUiButtonLabel>{labelStr}</TldrawUiButtonLabel>
|
|
165
|
+
{spinner ? <Spinner /> : icon && <TldrawUiButtonIcon icon={icon} />}
|
|
166
|
+
</TldrawUiButton>
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
169
|
case 'small-icons':
|
|
170
170
|
case 'icons': {
|
|
171
171
|
return (
|
|
@@ -206,20 +206,6 @@ export function TldrawUiMenuItem<
|
|
|
206
206
|
)
|
|
207
207
|
}
|
|
208
208
|
case 'toolbar': {
|
|
209
|
-
if (onDragStart) {
|
|
210
|
-
return (
|
|
211
|
-
<DraggableToolbarButton
|
|
212
|
-
id={id}
|
|
213
|
-
icon={icon}
|
|
214
|
-
onSelect={onSelect}
|
|
215
|
-
onDragStart={onDragStart}
|
|
216
|
-
labelToUse={labelToUse}
|
|
217
|
-
titleStr={titleStr}
|
|
218
|
-
disabled={disabled}
|
|
219
|
-
isSelected={isSelected}
|
|
220
|
-
/>
|
|
221
|
-
)
|
|
222
|
-
}
|
|
223
209
|
return (
|
|
224
210
|
<TldrawUiToolbarButton
|
|
225
211
|
aria-label={labelStr}
|
|
@@ -232,6 +218,7 @@ export function TldrawUiMenuItem<
|
|
|
232
218
|
preventDefault(e)
|
|
233
219
|
onSelect('toolbar')
|
|
234
220
|
}}
|
|
221
|
+
role="option"
|
|
235
222
|
title={titleStr}
|
|
236
223
|
type="tool"
|
|
237
224
|
>
|
|
@@ -240,30 +227,17 @@ export function TldrawUiMenuItem<
|
|
|
240
227
|
)
|
|
241
228
|
}
|
|
242
229
|
case 'toolbar-overflow': {
|
|
243
|
-
if (onDragStart) {
|
|
244
|
-
return (
|
|
245
|
-
<DraggableToolbarButton
|
|
246
|
-
id={id}
|
|
247
|
-
icon={icon}
|
|
248
|
-
onSelect={onSelect}
|
|
249
|
-
onDragStart={onDragStart}
|
|
250
|
-
labelToUse={labelToUse}
|
|
251
|
-
titleStr={titleStr}
|
|
252
|
-
disabled={disabled}
|
|
253
|
-
isSelected={isSelected}
|
|
254
|
-
overflow
|
|
255
|
-
/>
|
|
256
|
-
)
|
|
257
|
-
}
|
|
258
230
|
return (
|
|
259
231
|
<TldrawUiToolbarButton
|
|
260
232
|
aria-label={labelStr}
|
|
261
233
|
aria-pressed={isSelected ? 'true' : 'false'}
|
|
262
234
|
isActive={isSelected}
|
|
235
|
+
className="tlui-button-grid__button"
|
|
263
236
|
data-testid={`tools.more.${id}`}
|
|
264
237
|
data-value={id}
|
|
265
238
|
disabled={disabled}
|
|
266
239
|
onClick={() => onSelect('toolbar')}
|
|
240
|
+
role="option"
|
|
267
241
|
title={titleStr}
|
|
268
242
|
type="icon"
|
|
269
243
|
>
|
|
@@ -276,178 +250,3 @@ export function TldrawUiMenuItem<
|
|
|
276
250
|
}
|
|
277
251
|
}
|
|
278
252
|
}
|
|
279
|
-
|
|
280
|
-
function useDraggableEvents(
|
|
281
|
-
onDragStart: TLUiToolItem['onDragStart'],
|
|
282
|
-
onSelect: TLUiToolItem['onSelect']
|
|
283
|
-
) {
|
|
284
|
-
const editor = useEditor()
|
|
285
|
-
const events = useMemo(() => {
|
|
286
|
-
let state = { name: 'idle' } as
|
|
287
|
-
| {
|
|
288
|
-
name: 'idle'
|
|
289
|
-
}
|
|
290
|
-
| {
|
|
291
|
-
name: 'pointing'
|
|
292
|
-
screenSpaceStart: VecModel
|
|
293
|
-
}
|
|
294
|
-
| {
|
|
295
|
-
name: 'dragging'
|
|
296
|
-
screenSpaceStart: VecModel
|
|
297
|
-
}
|
|
298
|
-
| {
|
|
299
|
-
name: 'dragged'
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function handlePointerDown(e: React.PointerEvent<HTMLButtonElement>) {
|
|
303
|
-
state = {
|
|
304
|
-
name: 'pointing',
|
|
305
|
-
screenSpaceStart: { x: e.clientX, y: e.clientY },
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
e.currentTarget.setPointerCapture(e.pointerId)
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
function handlePointerMove(e: React.PointerEvent<HTMLButtonElement>) {
|
|
312
|
-
if ((e as any).isSpecialRedispatchedEvent) return
|
|
313
|
-
|
|
314
|
-
if (state.name === 'pointing') {
|
|
315
|
-
const distanceSq = Vec.Dist2(state.screenSpaceStart, { x: e.clientX, y: e.clientY })
|
|
316
|
-
if (
|
|
317
|
-
distanceSq >
|
|
318
|
-
(editor.getInstanceState().isCoarsePointer
|
|
319
|
-
? editor.options.uiCoarseDragDistanceSquared
|
|
320
|
-
: editor.options.uiDragDistanceSquared)
|
|
321
|
-
) {
|
|
322
|
-
const screenSpaceStart = state.screenSpaceStart
|
|
323
|
-
state = {
|
|
324
|
-
name: 'dragging',
|
|
325
|
-
screenSpaceStart,
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
editor.run(() => {
|
|
329
|
-
editor.setCurrentTool('select')
|
|
330
|
-
|
|
331
|
-
// Set origin point
|
|
332
|
-
editor.dispatch({
|
|
333
|
-
type: 'pointer',
|
|
334
|
-
target: 'canvas',
|
|
335
|
-
name: 'pointer_down',
|
|
336
|
-
...getPointerInfo(e),
|
|
337
|
-
point: screenSpaceStart,
|
|
338
|
-
})
|
|
339
|
-
|
|
340
|
-
// Pointer down potentially selects shapes, so we need to deselect them.
|
|
341
|
-
editor.selectNone()
|
|
342
|
-
|
|
343
|
-
// start drag
|
|
344
|
-
onDragStart?.('toolbar', {
|
|
345
|
-
type: 'pointer',
|
|
346
|
-
target: 'canvas',
|
|
347
|
-
name: 'pointer_move',
|
|
348
|
-
...getPointerInfo(e),
|
|
349
|
-
point: screenSpaceStart,
|
|
350
|
-
})
|
|
351
|
-
|
|
352
|
-
tooltipManager.hideAllTooltips()
|
|
353
|
-
editor.getContainer().focus()
|
|
354
|
-
})
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function handlePointerUp(e: React.PointerEvent<HTMLButtonElement>) {
|
|
360
|
-
if ((e as any).isSpecialRedispatchedEvent) return
|
|
361
|
-
|
|
362
|
-
e.currentTarget.releasePointerCapture(e.pointerId)
|
|
363
|
-
|
|
364
|
-
editor.dispatch({
|
|
365
|
-
type: 'pointer',
|
|
366
|
-
target: 'canvas',
|
|
367
|
-
name: 'pointer_up',
|
|
368
|
-
...getPointerInfo(e),
|
|
369
|
-
})
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
function handleClick() {
|
|
373
|
-
if (state.name === 'dragging' || state.name === 'dragged') {
|
|
374
|
-
state = { name: 'idle' }
|
|
375
|
-
return true
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
state = { name: 'idle' }
|
|
379
|
-
onSelect?.('toolbar')
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
return {
|
|
383
|
-
onPointerDown: handlePointerDown,
|
|
384
|
-
onPointerMove: handlePointerMove,
|
|
385
|
-
onPointerUp: handlePointerUp,
|
|
386
|
-
onClick: handleClick,
|
|
387
|
-
}
|
|
388
|
-
}, [onDragStart, editor, onSelect])
|
|
389
|
-
|
|
390
|
-
return events
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function DraggableToolbarButton({
|
|
394
|
-
id,
|
|
395
|
-
labelToUse,
|
|
396
|
-
titleStr,
|
|
397
|
-
disabled,
|
|
398
|
-
isSelected,
|
|
399
|
-
icon,
|
|
400
|
-
onSelect,
|
|
401
|
-
onDragStart,
|
|
402
|
-
overflow,
|
|
403
|
-
}: {
|
|
404
|
-
id: string
|
|
405
|
-
disabled: boolean
|
|
406
|
-
labelToUse?: string
|
|
407
|
-
titleStr?: string
|
|
408
|
-
isSelected?: boolean
|
|
409
|
-
icon: TLUiMenuItemProps['icon']
|
|
410
|
-
onSelect: TLUiMenuItemProps['onSelect']
|
|
411
|
-
onDragStart: TLUiMenuItemProps['onDragStart']
|
|
412
|
-
overflow?: boolean
|
|
413
|
-
}) {
|
|
414
|
-
const events = useDraggableEvents(onDragStart, onSelect)
|
|
415
|
-
|
|
416
|
-
if (overflow) {
|
|
417
|
-
return (
|
|
418
|
-
<TldrawUiToolbarButton
|
|
419
|
-
aria-label={labelToUse}
|
|
420
|
-
aria-pressed={isSelected ? 'true' : 'false'}
|
|
421
|
-
isActive={isSelected}
|
|
422
|
-
className="tlui-button-grid__button"
|
|
423
|
-
data-testid={`tools.more.${id}`}
|
|
424
|
-
data-value={id}
|
|
425
|
-
disabled={disabled}
|
|
426
|
-
title={titleStr}
|
|
427
|
-
type="icon"
|
|
428
|
-
{...events}
|
|
429
|
-
>
|
|
430
|
-
<TldrawUiButtonIcon icon={icon!} />
|
|
431
|
-
</TldrawUiToolbarButton>
|
|
432
|
-
)
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
return (
|
|
436
|
-
<TldrawUiToolbarButton
|
|
437
|
-
aria-label={labelToUse}
|
|
438
|
-
aria-pressed={isSelected ? 'true' : 'false'}
|
|
439
|
-
data-testid={`tools.${id}`}
|
|
440
|
-
data-value={id}
|
|
441
|
-
disabled={disabled}
|
|
442
|
-
onTouchStart={(e) => {
|
|
443
|
-
preventDefault(e)
|
|
444
|
-
onSelect('toolbar')
|
|
445
|
-
}}
|
|
446
|
-
title={titleStr}
|
|
447
|
-
type="tool"
|
|
448
|
-
{...events}
|
|
449
|
-
>
|
|
450
|
-
<TldrawUiButtonIcon icon={icon!} />
|
|
451
|
-
</TldrawUiToolbarButton>
|
|
452
|
-
)
|
|
453
|
-
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RecursivePartial, defaultUserPreferences, track, useMaybeEditor } from '@tldraw/editor'
|
|
2
2
|
import { ReactNode } from 'react'
|
|
3
3
|
import { TLUiAssetUrls, useDefaultUiAssetUrlsWithOverrides } from '../assetUrls'
|
|
4
|
-
import { TldrawUiTooltipProvider } from '../components/primitives/TldrawUiTooltip'
|
|
5
4
|
import { ToolsProvider } from '../hooks/useTools'
|
|
6
5
|
import { TldrawUiTranslationProvider } from '../hooks/useTranslation/useTranslation'
|
|
7
6
|
import {
|
|
@@ -73,28 +72,26 @@ export const TldrawUiContextProvider = track(function TldrawUiContextProvider({
|
|
|
73
72
|
const editor = useMaybeEditor()
|
|
74
73
|
return (
|
|
75
74
|
<MimeTypeContext.Provider value={mediaMimeTypes}>
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
>
|
|
82
|
-
<
|
|
83
|
-
<
|
|
84
|
-
<
|
|
85
|
-
<
|
|
86
|
-
<
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</AssetUrlsProvider>
|
|
97
|
-
</TldrawUiTooltipProvider>
|
|
75
|
+
<AssetUrlsProvider assetUrls={useDefaultUiAssetUrlsWithOverrides(assetUrls)}>
|
|
76
|
+
<TldrawUiTranslationProvider
|
|
77
|
+
overrides={useMergedTranslationOverrides(overrides)}
|
|
78
|
+
locale={editor?.user.getLocale() ?? defaultUserPreferences.locale}
|
|
79
|
+
>
|
|
80
|
+
<TldrawUiEventsProvider onEvent={onUiEvent}>
|
|
81
|
+
<TldrawUiToastsProvider>
|
|
82
|
+
<TldrawUiDialogsProvider context={'tla'}>
|
|
83
|
+
<TldrawUiA11yProvider>
|
|
84
|
+
<BreakPointProvider forceMobile={forceMobile}>
|
|
85
|
+
<TldrawUiComponentsProvider overrides={components}>
|
|
86
|
+
<InternalProviders overrides={overrides}>{children}</InternalProviders>
|
|
87
|
+
</TldrawUiComponentsProvider>
|
|
88
|
+
</BreakPointProvider>
|
|
89
|
+
</TldrawUiA11yProvider>
|
|
90
|
+
</TldrawUiDialogsProvider>
|
|
91
|
+
</TldrawUiToastsProvider>
|
|
92
|
+
</TldrawUiEventsProvider>
|
|
93
|
+
</TldrawUiTranslationProvider>
|
|
94
|
+
</AssetUrlsProvider>
|
|
98
95
|
</MimeTypeContext.Provider>
|
|
99
96
|
)
|
|
100
97
|
})
|