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
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`putExcalidrawContent test fixtures
|
|
3
|
+
exports[`putExcalidrawContent test fixtures bound-arrows.json 1`] = `
|
|
4
4
|
{
|
|
5
5
|
"binding:8": {
|
|
6
6
|
"fromId": "shape:7",
|
|
@@ -149,20 +149,13 @@ exports[`putExcalidrawContent test fixtures > bound-arrows.json 1`] = `
|
|
|
149
149
|
"kind": "arc",
|
|
150
150
|
"labelColor": "black",
|
|
151
151
|
"labelPosition": 0.5,
|
|
152
|
-
"richText": {
|
|
153
|
-
"content": [
|
|
154
|
-
{
|
|
155
|
-
"type": "paragraph",
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
"type": "doc",
|
|
159
|
-
},
|
|
160
152
|
"scale": 1,
|
|
161
153
|
"size": "m",
|
|
162
154
|
"start": {
|
|
163
155
|
"x": 0,
|
|
164
156
|
"y": 0,
|
|
165
157
|
},
|
|
158
|
+
"text": "",
|
|
166
159
|
},
|
|
167
160
|
"rotation": 0,
|
|
168
161
|
"type": "arrow",
|
|
@@ -173,7 +166,7 @@ exports[`putExcalidrawContent test fixtures > bound-arrows.json 1`] = `
|
|
|
173
166
|
}
|
|
174
167
|
`;
|
|
175
168
|
|
|
176
|
-
exports[`putExcalidrawContent test fixtures
|
|
169
|
+
exports[`putExcalidrawContent test fixtures bound-elbow-arrows.json 1`] = `
|
|
177
170
|
{
|
|
178
171
|
"binding:7": {
|
|
179
172
|
"fromId": "shape:6",
|
|
@@ -322,20 +315,13 @@ exports[`putExcalidrawContent test fixtures > bound-elbow-arrows.json 1`] = `
|
|
|
322
315
|
"kind": "elbow",
|
|
323
316
|
"labelColor": "black",
|
|
324
317
|
"labelPosition": 0.5,
|
|
325
|
-
"richText": {
|
|
326
|
-
"content": [
|
|
327
|
-
{
|
|
328
|
-
"type": "paragraph",
|
|
329
|
-
},
|
|
330
|
-
],
|
|
331
|
-
"type": "doc",
|
|
332
|
-
},
|
|
333
318
|
"scale": 1,
|
|
334
319
|
"size": "m",
|
|
335
320
|
"start": {
|
|
336
321
|
"x": 0,
|
|
337
322
|
"y": 0,
|
|
338
323
|
},
|
|
324
|
+
"text": "",
|
|
339
325
|
},
|
|
340
326
|
"rotation": 0,
|
|
341
327
|
"type": "arrow",
|
|
@@ -346,7 +332,7 @@ exports[`putExcalidrawContent test fixtures > bound-elbow-arrows.json 1`] = `
|
|
|
346
332
|
}
|
|
347
333
|
`;
|
|
348
334
|
|
|
349
|
-
exports[`putExcalidrawContent test fixtures
|
|
335
|
+
exports[`putExcalidrawContent test fixtures image.json 1`] = `
|
|
350
336
|
{
|
|
351
337
|
"asset:5": {
|
|
352
338
|
"id": "asset:5",
|
|
@@ -404,7 +390,7 @@ exports[`putExcalidrawContent test fixtures > image.json 1`] = `
|
|
|
404
390
|
}
|
|
405
391
|
`;
|
|
406
392
|
|
|
407
|
-
exports[`putExcalidrawContent test fixtures
|
|
393
|
+
exports[`putExcalidrawContent test fixtures line-drawing.json 1`] = `
|
|
408
394
|
{
|
|
409
395
|
"document:document": {
|
|
410
396
|
"gridSize": 10,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`buildFromV1Document test fixtures
|
|
3
|
+
exports[`buildFromV1Document test fixtures arrow-binding.tldr 1`] = `
|
|
4
4
|
{
|
|
5
5
|
"binding:12": {
|
|
6
6
|
"fromId": "shape:11",
|
|
@@ -112,20 +112,13 @@ exports[`buildFromV1Document test fixtures > arrow-binding.tldr 1`] = `
|
|
|
112
112
|
"kind": "arc",
|
|
113
113
|
"labelColor": "red",
|
|
114
114
|
"labelPosition": 0.5,
|
|
115
|
-
"richText": {
|
|
116
|
-
"content": [
|
|
117
|
-
{
|
|
118
|
-
"type": "paragraph",
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
"type": "doc",
|
|
122
|
-
},
|
|
123
115
|
"scale": 1,
|
|
124
116
|
"size": "m",
|
|
125
117
|
"start": {
|
|
126
118
|
"x": 146.32,
|
|
127
119
|
"y": 0,
|
|
128
120
|
},
|
|
121
|
+
"text": "",
|
|
129
122
|
},
|
|
130
123
|
"rotation": 0,
|
|
131
124
|
"type": "arrow",
|
|
@@ -173,7 +166,7 @@ exports[`buildFromV1Document test fixtures > arrow-binding.tldr 1`] = `
|
|
|
173
166
|
}
|
|
174
167
|
`;
|
|
175
168
|
|
|
176
|
-
exports[`buildFromV1Document test fixtures
|
|
169
|
+
exports[`buildFromV1Document test fixtures exact-arrow-binding.tldr 1`] = `
|
|
177
170
|
{
|
|
178
171
|
"binding:11": {
|
|
179
172
|
"fromId": "shape:10",
|
|
@@ -248,20 +241,13 @@ exports[`buildFromV1Document test fixtures > exact-arrow-binding.tldr 1`] = `
|
|
|
248
241
|
"kind": "arc",
|
|
249
242
|
"labelColor": "red",
|
|
250
243
|
"labelPosition": 0.5,
|
|
251
|
-
"richText": {
|
|
252
|
-
"content": [
|
|
253
|
-
{
|
|
254
|
-
"type": "paragraph",
|
|
255
|
-
},
|
|
256
|
-
],
|
|
257
|
-
"type": "doc",
|
|
258
|
-
},
|
|
259
244
|
"scale": 1,
|
|
260
245
|
"size": "m",
|
|
261
246
|
"start": {
|
|
262
247
|
"x": 293.36,
|
|
263
248
|
"y": 0,
|
|
264
249
|
},
|
|
250
|
+
"text": "",
|
|
265
251
|
},
|
|
266
252
|
"rotation": 0,
|
|
267
253
|
"type": "arrow",
|
|
@@ -346,7 +332,7 @@ exports[`buildFromV1Document test fixtures > exact-arrow-binding.tldr 1`] = `
|
|
|
346
332
|
}
|
|
347
333
|
`;
|
|
348
334
|
|
|
349
|
-
exports[`buildFromV1Document test fixtures
|
|
335
|
+
exports[`buildFromV1Document test fixtures incorrect-arrow-binding.tldr 1`] = `
|
|
350
336
|
{
|
|
351
337
|
"binding:11": {
|
|
352
338
|
"fromId": "shape:10",
|
|
@@ -403,20 +389,13 @@ exports[`buildFromV1Document test fixtures > incorrect-arrow-binding.tldr 1`] =
|
|
|
403
389
|
"kind": "arc",
|
|
404
390
|
"labelColor": "red",
|
|
405
391
|
"labelPosition": 0.5,
|
|
406
|
-
"richText": {
|
|
407
|
-
"content": [
|
|
408
|
-
{
|
|
409
|
-
"type": "paragraph",
|
|
410
|
-
},
|
|
411
|
-
],
|
|
412
|
-
"type": "doc",
|
|
413
|
-
},
|
|
414
392
|
"scale": 1,
|
|
415
393
|
"size": "m",
|
|
416
394
|
"start": {
|
|
417
395
|
"x": 252.64,
|
|
418
396
|
"y": 0,
|
|
419
397
|
},
|
|
398
|
+
"text": "",
|
|
420
399
|
},
|
|
421
400
|
"rotation": 0,
|
|
422
401
|
"type": "arrow",
|
|
@@ -405,7 +405,7 @@ export function buildFromV1Document(editor: Editor, _document: unknown) {
|
|
|
405
405
|
...inCommon,
|
|
406
406
|
type: 'arrow',
|
|
407
407
|
props: {
|
|
408
|
-
|
|
408
|
+
text: v1Shape.label ?? '',
|
|
409
409
|
color: getV2Color(v1Shape.style.color),
|
|
410
410
|
labelColor: getV2Color(v1Shape.style.color),
|
|
411
411
|
size: getV2Size(v1Shape.style.size),
|
|
@@ -562,7 +562,6 @@ export function buildFromV1Document(editor: Editor, _document: unknown) {
|
|
|
562
562
|
y: point.y,
|
|
563
563
|
},
|
|
564
564
|
isPrecise: point.x !== 0.5 || point.y !== 0.5,
|
|
565
|
-
isCreatingShape: true,
|
|
566
565
|
})
|
|
567
566
|
|
|
568
567
|
if (change) {
|
package/src/test/A11y.test.tsx
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { createShapeId, toRichText } from '@tldraw/editor'
|
|
2
|
-
import { Mock, vi } from 'vitest'
|
|
3
2
|
import { generateShapeAnnouncementMessage } from '../lib/ui/components/A11y'
|
|
4
3
|
import { TestEditor } from './TestEditor'
|
|
5
4
|
|
|
6
5
|
describe('A11y Shape Announcements', () => {
|
|
7
6
|
let editor: TestEditor
|
|
8
|
-
let mockTranslate: Mock
|
|
7
|
+
let mockTranslate: jest.Mock
|
|
9
8
|
|
|
10
9
|
beforeEach(() => {
|
|
11
10
|
editor = new TestEditor()
|
|
12
11
|
|
|
13
12
|
// Create a simple translation mock
|
|
14
|
-
mockTranslate =
|
|
13
|
+
mockTranslate = jest.fn((key) => {
|
|
15
14
|
if (key === 'a11y.multiple-shapes') return '{num} shapes selected'
|
|
16
15
|
if (key === 'a11y.shape') return 'Shape'
|
|
17
16
|
if (key === 'a11y.text') return 'Text'
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { vi } from 'vitest'
|
|
2
1
|
import { TestEditor } from './TestEditor'
|
|
3
2
|
|
|
4
3
|
let editor: TestEditor
|
|
@@ -11,7 +10,7 @@ beforeEach(() => {
|
|
|
11
10
|
editor._transformPointerUpSpy.mockRestore()
|
|
12
11
|
})
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
jest.useFakeTimers()
|
|
15
14
|
|
|
16
15
|
describe('Handles events', () => {
|
|
17
16
|
it('Emits single click events', () => {
|
|
@@ -24,7 +23,7 @@ describe('Handles events', () => {
|
|
|
24
23
|
const eventsBeforeSettle = [{ name: 'pointer_down' }, { name: 'pointer_up' }]
|
|
25
24
|
|
|
26
25
|
// allow time for settle
|
|
27
|
-
|
|
26
|
+
jest.advanceTimersByTime(500)
|
|
28
27
|
|
|
29
28
|
// nothing should have settled
|
|
30
29
|
expect(events).toMatchObject(eventsBeforeSettle)
|
|
@@ -65,7 +64,7 @@ describe('Handles events', () => {
|
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
// allow double click to settle
|
|
68
|
-
|
|
67
|
+
jest.advanceTimersByTime(500)
|
|
69
68
|
|
|
70
69
|
expect(events).toMatchObject([
|
|
71
70
|
...eventsBeforeSettle,
|
|
@@ -111,7 +110,7 @@ describe('Handles events', () => {
|
|
|
111
110
|
expect(eventsBeforeSettle).toMatchObject(eventsBeforeSettle)
|
|
112
111
|
|
|
113
112
|
// allow double click to settle
|
|
114
|
-
|
|
113
|
+
jest.advanceTimersByTime(500)
|
|
115
114
|
|
|
116
115
|
expect(events).toMatchObject([
|
|
117
116
|
...eventsBeforeSettle,
|
|
@@ -163,7 +162,7 @@ describe('Handles events', () => {
|
|
|
163
162
|
expect(events).toMatchObject(eventsBeforeSettle)
|
|
164
163
|
|
|
165
164
|
// allow double click to settle
|
|
166
|
-
|
|
165
|
+
jest.advanceTimersByTime(500)
|
|
167
166
|
|
|
168
167
|
expect(events).toMatchObject([
|
|
169
168
|
...eventsBeforeSettle,
|
|
@@ -219,7 +218,7 @@ describe('Handles events', () => {
|
|
|
219
218
|
expect(events).toMatchObject(eventsBeforeSettle)
|
|
220
219
|
|
|
221
220
|
// allow double click to settle
|
|
222
|
-
|
|
221
|
+
jest.advanceTimersByTime(500)
|
|
223
222
|
|
|
224
223
|
expect(events).toMatchObject(eventsBeforeSettle)
|
|
225
224
|
|
package/src/test/Editor.test.tsx
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
loadSnapshot,
|
|
15
15
|
react,
|
|
16
16
|
} from '@tldraw/editor'
|
|
17
|
-
import { vi } from 'vitest'
|
|
18
17
|
import { TestEditor } from './TestEditor'
|
|
19
18
|
import { TL } from './test-jsx'
|
|
20
19
|
|
|
@@ -34,7 +33,7 @@ beforeEach(() => {
|
|
|
34
33
|
editor = new TestEditor({})
|
|
35
34
|
|
|
36
35
|
editor.createShapes([
|
|
37
|
-
// on
|
|
36
|
+
// on it's own
|
|
38
37
|
{ id: ids.box1, type: 'geo', x: 100, y: 100, props: { w: 100, h: 100 } },
|
|
39
38
|
// in a frame
|
|
40
39
|
{ id: ids.frame1, type: 'frame', x: 100, y: 100, props: { w: 100, h: 100 } },
|
|
@@ -416,24 +415,24 @@ describe('isFocused', () => {
|
|
|
416
415
|
})
|
|
417
416
|
|
|
418
417
|
it('becomes true when the container div receives a focus event', () => {
|
|
419
|
-
|
|
418
|
+
jest.advanceTimersByTime(100)
|
|
420
419
|
expect(editor.getInstanceState().isFocused).toBe(false)
|
|
421
420
|
|
|
422
421
|
editor.elm.focus()
|
|
423
422
|
|
|
424
|
-
|
|
423
|
+
jest.advanceTimersByTime(100)
|
|
425
424
|
expect(editor.getInstanceState().isFocused).toBe(true)
|
|
426
425
|
})
|
|
427
426
|
|
|
428
427
|
it('becomes false when the container div receives a blur event', () => {
|
|
429
428
|
editor.elm.focus()
|
|
430
429
|
|
|
431
|
-
|
|
430
|
+
jest.advanceTimersByTime(100)
|
|
432
431
|
expect(editor.getInstanceState().isFocused).toBe(true)
|
|
433
432
|
|
|
434
433
|
editor.elm.blur()
|
|
435
434
|
|
|
436
|
-
|
|
435
|
+
jest.advanceTimersByTime(100)
|
|
437
436
|
expect(editor.getInstanceState().isFocused).toBe(false)
|
|
438
437
|
})
|
|
439
438
|
|
|
@@ -445,13 +444,13 @@ describe('isFocused', () => {
|
|
|
445
444
|
editor.elm.blur()
|
|
446
445
|
const child = document.createElement('div')
|
|
447
446
|
editor.elm.appendChild(child)
|
|
448
|
-
|
|
447
|
+
jest.advanceTimersByTime(100)
|
|
449
448
|
expect(editor.getInstanceState().isFocused).toBe(false)
|
|
450
449
|
child.dispatchEvent(new FocusEvent('focusin', { bubbles: true }))
|
|
451
|
-
|
|
450
|
+
jest.advanceTimersByTime(100)
|
|
452
451
|
expect(editor.getInstanceState().isFocused).toBe(true)
|
|
453
452
|
child.dispatchEvent(new FocusEvent('focusout', { bubbles: true }))
|
|
454
|
-
|
|
453
|
+
jest.advanceTimersByTime(100)
|
|
455
454
|
expect(editor.getInstanceState().isFocused).toBe(false)
|
|
456
455
|
})
|
|
457
456
|
|
|
@@ -467,7 +466,7 @@ describe('isFocused', () => {
|
|
|
467
466
|
|
|
468
467
|
child.dispatchEvent(new FocusEvent('focusout', { bubbles: true }))
|
|
469
468
|
|
|
470
|
-
|
|
469
|
+
jest.advanceTimersByTime(100)
|
|
471
470
|
expect(editor.getInstanceState().isFocused).toBe(false)
|
|
472
471
|
})
|
|
473
472
|
})
|
|
@@ -521,13 +520,13 @@ describe('getShapeUtil', () => {
|
|
|
521
520
|
it('throws if that shape type isnt registered', () => {
|
|
522
521
|
const myMissingShape = { type: 'missing' } as TLShape
|
|
523
522
|
expect(() => editor.getShapeUtil(myMissingShape)).toThrowErrorMatchingInlineSnapshot(
|
|
524
|
-
`
|
|
523
|
+
`"No shape util found for type "missing""`
|
|
525
524
|
)
|
|
526
525
|
})
|
|
527
526
|
|
|
528
527
|
it('throws if that type isnt registered', () => {
|
|
529
528
|
expect(() => editor.getShapeUtil('missing')).toThrowErrorMatchingInlineSnapshot(
|
|
530
|
-
`
|
|
529
|
+
`"No shape util found for type "missing""`
|
|
531
530
|
)
|
|
532
531
|
})
|
|
533
532
|
})
|
|
@@ -604,14 +603,14 @@ describe('snapshots', () => {
|
|
|
604
603
|
|
|
605
604
|
describe('when the user prefers dark UI', () => {
|
|
606
605
|
beforeEach(() => {
|
|
607
|
-
window.matchMedia =
|
|
606
|
+
window.matchMedia = jest.fn().mockImplementation((query) => {
|
|
608
607
|
return {
|
|
609
608
|
matches: query === '(prefers-color-scheme: dark)',
|
|
610
609
|
media: query,
|
|
611
610
|
onchange: null,
|
|
612
|
-
addEventListener:
|
|
613
|
-
removeEventListener:
|
|
614
|
-
dispatchEvent:
|
|
611
|
+
addEventListener: jest.fn(),
|
|
612
|
+
removeEventListener: jest.fn(),
|
|
613
|
+
dispatchEvent: jest.fn(),
|
|
615
614
|
}
|
|
616
615
|
})
|
|
617
616
|
})
|
|
@@ -631,14 +630,14 @@ describe('when the user prefers dark UI', () => {
|
|
|
631
630
|
|
|
632
631
|
describe('when the user prefers light UI', () => {
|
|
633
632
|
beforeEach(() => {
|
|
634
|
-
window.matchMedia =
|
|
633
|
+
window.matchMedia = jest.fn().mockImplementation((query) => {
|
|
635
634
|
return {
|
|
636
635
|
matches: false,
|
|
637
636
|
media: query,
|
|
638
637
|
onchange: null,
|
|
639
|
-
addEventListener:
|
|
640
|
-
removeEventListener:
|
|
641
|
-
dispatchEvent:
|
|
638
|
+
addEventListener: jest.fn(),
|
|
639
|
+
removeEventListener: jest.fn(),
|
|
640
|
+
dispatchEvent: jest.fn(),
|
|
642
641
|
}
|
|
643
642
|
})
|
|
644
643
|
})
|
|
@@ -723,7 +722,7 @@ describe('dragging', () => {
|
|
|
723
722
|
})
|
|
724
723
|
|
|
725
724
|
describe('getShapeVisibility', () => {
|
|
726
|
-
const getShapeVisibility =
|
|
725
|
+
const getShapeVisibility = jest.fn(((shape: TLShape) => {
|
|
727
726
|
return shape.meta.visibility as any
|
|
728
727
|
}) satisfies TldrawEditorProps['getShapeVisibility'])
|
|
729
728
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { createShapeId } from '@tldraw/editor'
|
|
2
|
-
import { vi } from 'vitest'
|
|
3
2
|
import { TestEditor } from './TestEditor'
|
|
4
3
|
|
|
5
4
|
let editor: TestEditor
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
jest.useFakeTimers()
|
|
8
7
|
|
|
9
8
|
const ids = {
|
|
10
9
|
box1: createShapeId('box1'),
|
|
@@ -305,7 +304,7 @@ describe('When clicking and dragging', () => {
|
|
|
305
304
|
|
|
306
305
|
editor.expectToBeIn('eraser.erasing')
|
|
307
306
|
|
|
308
|
-
|
|
307
|
+
jest.advanceTimersByTime(16)
|
|
309
308
|
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
310
309
|
|
|
311
310
|
expect(editor.getErasingShapeIds()).toEqual([ids.box1])
|
|
@@ -331,7 +330,7 @@ describe('When clicking and dragging', () => {
|
|
|
331
330
|
editor.expectToBeIn('eraser.idle')
|
|
332
331
|
editor.pointerDown(-100, -100) // outside of any shapes
|
|
333
332
|
editor.pointerMove(50, 50) // inside of box1
|
|
334
|
-
|
|
333
|
+
jest.advanceTimersByTime(16)
|
|
335
334
|
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
336
335
|
expect(editor.getErasingShapeIds()).toEqual([ids.box1])
|
|
337
336
|
editor.cancel()
|
|
@@ -346,7 +345,7 @@ describe('When clicking and dragging', () => {
|
|
|
346
345
|
editor.expectToBeIn('eraser.idle')
|
|
347
346
|
editor.pointerDown(275, 275) // in between box2 AND box3, so over of the new group
|
|
348
347
|
editor.pointerMove(280, 280) // still outside of the new group
|
|
349
|
-
|
|
348
|
+
jest.advanceTimersByTime(16)
|
|
350
349
|
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
351
350
|
expect(editor.getErasingShapeIds()).toEqual([])
|
|
352
351
|
editor.pointerMove(0, 0)
|
|
@@ -361,7 +360,7 @@ describe('When clicking and dragging', () => {
|
|
|
361
360
|
editor.setCurrentTool('eraser')
|
|
362
361
|
editor.pointerDown(325, 25) // directly on frame1, not its children
|
|
363
362
|
editor.pointerMove(350, 375) // still in the frame, passing through box3
|
|
364
|
-
|
|
363
|
+
jest.advanceTimersByTime(16)
|
|
365
364
|
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
366
365
|
expect(editor.getErasingShapeIds()).toEqual([ids.box3])
|
|
367
366
|
editor.pointerUp()
|
|
@@ -375,7 +374,7 @@ describe('When clicking and dragging', () => {
|
|
|
375
374
|
editor.pointerDown() // Above the masked part of box3
|
|
376
375
|
expect(editor.getErasingShapeIds()).toEqual([])
|
|
377
376
|
editor.pointerMove(425, 500) // Through the masked part of box3
|
|
378
|
-
|
|
377
|
+
jest.advanceTimersByTime(16)
|
|
379
378
|
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
380
379
|
expect(editor.getErasingShapeIds()).toEqual([])
|
|
381
380
|
editor.pointerUp()
|
|
@@ -403,7 +402,7 @@ describe('When clicking and dragging', () => {
|
|
|
403
402
|
editor.pointerDown(-100, -100)
|
|
404
403
|
expect(editor.getInstanceState().scribbles.length).toBe(0)
|
|
405
404
|
editor.pointerMove(50, 50)
|
|
406
|
-
|
|
405
|
+
jest.advanceTimersByTime(16)
|
|
407
406
|
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
408
407
|
editor.pointerMove(50, 50)
|
|
409
408
|
editor.pointerMove(51, 50)
|
|
@@ -437,181 +436,11 @@ describe('When shift clicking', () => {
|
|
|
437
436
|
it.todo('Clears the previous clicked point when leaving / re-entering the eraser tool')
|
|
438
437
|
})
|
|
439
438
|
|
|
440
|
-
describe('When
|
|
441
|
-
it('
|
|
442
|
-
editor.setCurrentTool('
|
|
443
|
-
editor.expectToBeIn('
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
// Simulate holding meta key (accel key)
|
|
448
|
-
editor.keyDown('Meta')
|
|
449
|
-
editor.pointerDown(99, 99) // next to box1 AND in box2
|
|
450
|
-
|
|
451
|
-
// Should only erase the first shape hit (box2, since it's rendered on top)
|
|
452
|
-
expect(editor.getErasingShapeIds()).toEqual([ids.box2])
|
|
453
|
-
|
|
454
|
-
editor.pointerUp()
|
|
455
|
-
|
|
456
|
-
// Should only delete the first shape
|
|
457
|
-
expect(editor.getShape(ids.box1)).toBeDefined()
|
|
458
|
-
expect(editor.getShape(ids.box2)).toBeUndefined()
|
|
459
|
-
|
|
460
|
-
const shapesAfterCount = editor.getCurrentPageShapes().length
|
|
461
|
-
expect(shapesAfterCount).toBe(shapesBeforeCount - 1)
|
|
462
|
-
|
|
463
|
-
editor.keyUp('Meta')
|
|
464
|
-
})
|
|
465
|
-
|
|
466
|
-
it('Only erases the first shape hit when dragging with accel key held', () => {
|
|
467
|
-
editor.setCurrentTool('eraser')
|
|
468
|
-
editor.expectToBeIn('eraser.idle')
|
|
469
|
-
|
|
470
|
-
const shapesBeforeCount = editor.getCurrentPageShapes().length
|
|
471
|
-
|
|
472
|
-
// Start dragging without accel key to establish first erasing shape
|
|
473
|
-
editor.pointerDown(-100, -100) // outside of any shapes
|
|
474
|
-
editor.pointerMove(99, 99) // next to box1 AND in box2
|
|
475
|
-
|
|
476
|
-
vi.advanceTimersByTime(16)
|
|
477
|
-
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
478
|
-
|
|
479
|
-
// Should include all shapes hit initially
|
|
480
|
-
expect(new Set(editor.getErasingShapeIds())).toEqual(new Set([ids.box1, ids.box2]))
|
|
481
|
-
|
|
482
|
-
// Now press accel key during erasing
|
|
483
|
-
editor.keyDown('Meta')
|
|
484
|
-
|
|
485
|
-
// The accel key should restrict to only the first shape hit
|
|
486
|
-
// Note: The implementation may not immediately restrict to first shape
|
|
487
|
-
// until the next update cycle, so we check that at least one shape is still being erased
|
|
488
|
-
expect(editor.getErasingShapeIds().length).toBeGreaterThan(0)
|
|
489
|
-
|
|
490
|
-
editor.pointerUp()
|
|
491
|
-
|
|
492
|
-
// Should delete at least one shape
|
|
493
|
-
const shapesAfterCount = editor.getCurrentPageShapes().length
|
|
494
|
-
expect(shapesAfterCount).toBeLessThan(shapesBeforeCount)
|
|
495
|
-
|
|
496
|
-
editor.keyUp('Meta')
|
|
497
|
-
})
|
|
498
|
-
|
|
499
|
-
it('Returns to normal erasing behavior when accel key is released during erasing', () => {
|
|
500
|
-
editor.setCurrentTool('eraser')
|
|
501
|
-
editor.expectToBeIn('eraser.idle')
|
|
502
|
-
|
|
503
|
-
const shapesBeforeCount = editor.getCurrentPageShapes().length
|
|
504
|
-
|
|
505
|
-
// Start dragging without accel key to establish first erasing shape
|
|
506
|
-
editor.pointerDown(-100, -100) // outside of any shapes
|
|
507
|
-
editor.pointerMove(99, 99) // next to box1 AND in box2
|
|
508
|
-
|
|
509
|
-
vi.advanceTimersByTime(16)
|
|
510
|
-
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
511
|
-
|
|
512
|
-
// Should include all shapes hit initially
|
|
513
|
-
expect(new Set(editor.getErasingShapeIds())).toEqual(new Set([ids.box1, ids.box2]))
|
|
514
|
-
|
|
515
|
-
// Press accel key to restrict to first shape
|
|
516
|
-
editor.keyDown('Meta')
|
|
517
|
-
// The accel key should affect the erasing behavior
|
|
518
|
-
expect(editor.getErasingShapeIds().length).toBeGreaterThan(0)
|
|
519
|
-
|
|
520
|
-
// Release the accel key
|
|
521
|
-
editor.keyUp('Meta')
|
|
522
|
-
|
|
523
|
-
// Should still include shapes hit
|
|
524
|
-
expect(editor.getErasingShapeIds().length).toBeGreaterThan(0)
|
|
525
|
-
|
|
526
|
-
editor.pointerUp()
|
|
527
|
-
|
|
528
|
-
// Should delete shapes
|
|
529
|
-
const shapesAfterCount = editor.getCurrentPageShapes().length
|
|
530
|
-
expect(shapesAfterCount).toBeLessThan(shapesBeforeCount)
|
|
531
|
-
})
|
|
532
|
-
|
|
533
|
-
it('Prevents pointer move from starting erasing when accel key is held in pointing state (only if there is a first erasing shape)', () => {
|
|
534
|
-
editor.setCurrentTool('eraser')
|
|
535
|
-
editor.expectToBeIn('eraser.idle')
|
|
536
|
-
|
|
537
|
-
// Start with accel key held and click on a shape
|
|
538
|
-
editor.keyDown('Meta')
|
|
539
|
-
editor.pointerDown(0, 0) // in box1
|
|
540
|
-
editor.expectToBeIn('eraser.pointing')
|
|
541
|
-
|
|
542
|
-
expect(editor.getErasingShapeIds()).toEqual([ids.box1])
|
|
543
|
-
|
|
544
|
-
// Try to move pointer - should not start erasing
|
|
545
|
-
editor.pointerMove(50, 50)
|
|
546
|
-
editor.expectToBeIn('eraser.pointing') // Should still be in pointing state
|
|
547
|
-
|
|
548
|
-
editor.pointerUp()
|
|
549
|
-
editor.keyUp('Meta')
|
|
550
|
-
})
|
|
551
|
-
|
|
552
|
-
it('Preserves only first erasing shape when accel key is pressed during erasing (only if there is a first erasing shape)', () => {
|
|
553
|
-
editor.setCurrentTool('eraser')
|
|
554
|
-
editor.expectToBeIn('eraser.idle')
|
|
555
|
-
|
|
556
|
-
const shapesBeforeCount = editor.getCurrentPageShapes().length
|
|
557
|
-
|
|
558
|
-
// Start erasing normally
|
|
559
|
-
editor.pointerDown(-100, -100) // outside of any shapes
|
|
560
|
-
editor.pointerMove(99, 99) // next to box1 AND in box2
|
|
561
|
-
|
|
562
|
-
vi.advanceTimersByTime(16)
|
|
563
|
-
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
564
|
-
|
|
565
|
-
// Should include all shapes hit initially
|
|
566
|
-
expect(new Set(editor.getErasingShapeIds())).toEqual(new Set([ids.box1, ids.box2]))
|
|
567
|
-
|
|
568
|
-
// Press accel key during erasing
|
|
569
|
-
editor.keyDown('Meta')
|
|
570
|
-
|
|
571
|
-
// The accel key should affect the erasing behavior
|
|
572
|
-
expect(editor.getErasingShapeIds().length).toBeGreaterThan(0)
|
|
573
|
-
|
|
574
|
-
editor.pointerUp()
|
|
575
|
-
|
|
576
|
-
// Should delete at least one shape
|
|
577
|
-
const shapesAfterCount = editor.getCurrentPageShapes().length
|
|
578
|
-
expect(shapesAfterCount).toBeLessThan(shapesBeforeCount)
|
|
579
|
-
|
|
580
|
-
editor.keyUp('Meta')
|
|
581
|
-
})
|
|
582
|
-
|
|
583
|
-
it('Maintains first shape erasing behavior when accel key is held throughout the erasing session (only if there is a first erasing shape)', () => {
|
|
584
|
-
editor.setCurrentTool('eraser')
|
|
585
|
-
editor.expectToBeIn('eraser.idle')
|
|
586
|
-
|
|
587
|
-
const shapesBeforeCount = editor.getCurrentPageShapes().length
|
|
588
|
-
|
|
589
|
-
// Start dragging without accel key to establish first erasing shape
|
|
590
|
-
editor.pointerDown(-100, -100) // outside of any shapes
|
|
591
|
-
editor.pointerMove(99, 99) // next to box1 AND in box2
|
|
592
|
-
|
|
593
|
-
vi.advanceTimersByTime(16)
|
|
594
|
-
expect(editor.getInstanceState().scribbles.length).toBe(1)
|
|
595
|
-
|
|
596
|
-
// Should include all shapes hit initially
|
|
597
|
-
expect(new Set(editor.getErasingShapeIds())).toEqual(new Set([ids.box1, ids.box2]))
|
|
598
|
-
|
|
599
|
-
// Press accel key to restrict to first shape
|
|
600
|
-
editor.keyDown('Meta')
|
|
601
|
-
expect(editor.getErasingShapeIds().length).toBeGreaterThan(0)
|
|
602
|
-
|
|
603
|
-
// Move to hit more shapes
|
|
604
|
-
editor.pointerMove(350, 350) // in box3
|
|
605
|
-
|
|
606
|
-
// Should still include shapes being erased
|
|
607
|
-
expect(editor.getErasingShapeIds().length).toBeGreaterThan(0)
|
|
608
|
-
|
|
609
|
-
editor.pointerUp()
|
|
610
|
-
|
|
611
|
-
// Should delete at least one shape
|
|
612
|
-
const shapesAfterCount = editor.getCurrentPageShapes().length
|
|
613
|
-
expect(shapesAfterCount).toBeLessThan(shapesBeforeCount)
|
|
614
|
-
|
|
615
|
-
editor.keyUp('Meta')
|
|
439
|
+
describe('When in the idle state', () => {
|
|
440
|
+
it('Returns to select on cancel', () => {
|
|
441
|
+
editor.setCurrentTool('hand')
|
|
442
|
+
editor.expectToBeIn('hand.idle')
|
|
443
|
+
editor.cancel()
|
|
444
|
+
editor.expectToBeIn('select.idle')
|
|
616
445
|
})
|
|
617
446
|
})
|