tldraw 3.16.0-canary.ffdf566dd0a8 → 3.16.0-internal.a478398270c6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +19 -125
- package/dist-cjs/index.js +2 -19
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawImage.js +2 -5
- package/dist-cjs/lib/TldrawImage.js.map +3 -3
- package/dist-cjs/lib/canvas/TldrawCropHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawCropHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawHandles.js +1 -1
- package/dist-cjs/lib/canvas/TldrawHandles.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawOverlays.js +1 -1
- package/dist-cjs/lib/canvas/TldrawOverlays.js.map +2 -2
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js +271 -279
- package/dist-cjs/lib/canvas/TldrawSelectionForeground.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +0 -1
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +41 -24
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js +4 -16
- package/dist-cjs/lib/shapes/arrow/arrowLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +1 -1
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +0 -3
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/draw/DrawShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js +5 -5
- package/dist-cjs/lib/shapes/frame/FrameShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js +3 -0
- package/dist-cjs/lib/shapes/highlight/HighlightShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js +4 -15
- package/dist-cjs/lib/shapes/line/LineShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +1 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PathBuilder.js +3 -21
- package/dist-cjs/lib/shapes/shared/PathBuilder.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +0 -1
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js +2 -5
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/SvgTextLabel.js +3 -4
- package/dist-cjs/lib/shapes/shared/SvgTextLabel.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js +1 -10
- package/dist-cjs/lib/shapes/shared/usePrefersReducedMotion.js.map +2 -2
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js +11 -5
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js.map +2 -2
- package/dist-cjs/lib/styles.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js +1 -7
- package/dist-cjs/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +22 -43
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js +15 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Idle.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js +0 -5
- package/dist-cjs/lib/tools/SelectTool/childStates/PointingShape.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Resizing.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Rotating.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js +0 -8
- package/dist-cjs/lib/tools/SelectTool/childStates/Translating.js.map +2 -2
- package/dist-cjs/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.js.map +2 -2
- package/dist-cjs/lib/ui/assetUrls.js +13 -10
- package/dist-cjs/lib/ui/assetUrls.js.map +2 -2
- package/dist-cjs/lib/ui/components/A11y.js +12 -14
- package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js +1 -51
- package/dist-cjs/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +2 -3
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js +4 -3
- package/dist-cjs/lib/ui/components/NavigationPanel/DefaultNavigationPanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/Spinner.js +25 -2
- package/dist-cjs/lib/ui/components/Spinner.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +0 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +136 -168
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js +7 -21
- package/dist-cjs/lib/ui/components/Toolbar/DefaultImageToolbar.js.map +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +3 -3
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +2 -3
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +0 -22
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/Button/TldrawUiButtonIcon.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js +0 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiButtonPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiDialog.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js +1 -35
- package/dist-cjs/lib/ui/components/primitives/TldrawUiIcon.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js +2 -6
- package/dist-cjs/lib/ui/components/primitives/TldrawUiSlider.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +3 -12
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +2 -0
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js +2 -3
- package/dist-cjs/lib/ui/context/TldrawUiContextProvider.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +8 -57
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/menu-hooks.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js +2 -2
- package/dist-cjs/lib/ui/hooks/useKeyboardShortcuts.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTools.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +0 -11
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js.map +2 -2
- package/dist-cjs/lib/ui/kbd-utils.js +1 -2
- package/dist-cjs/lib/ui/kbd-utils.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js +1 -1
- package/dist-cjs/lib/utils/excalidraw/putExcalidrawContent.js.map +2 -2
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js +2 -3
- package/dist-cjs/lib/utils/tldr/buildFromV1Document.js.map +2 -2
- package/dist-esm/index.d.mts +19 -125
- package/dist-esm/index.mjs +4 -33
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawImage.mjs +2 -5
- package/dist-esm/lib/TldrawImage.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawCropHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawHandles.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawHandles.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawOverlays.mjs +1 -1
- package/dist-esm/lib/canvas/TldrawOverlays.mjs.map +2 -2
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs +271 -279
- package/dist-esm/lib/canvas/TldrawSelectionForeground.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +0 -1
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +41 -26
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs +5 -19
- package/dist-esm/lib/shapes/arrow/arrowLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +1 -1
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +0 -3
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/draw/DrawShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs +5 -5
- package/dist-esm/lib/shapes/frame/FrameShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs +3 -0
- package/dist-esm/lib/shapes/highlight/HighlightShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs +4 -15
- package/dist-esm/lib/shapes/line/LineShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +1 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs +3 -22
- package/dist-esm/lib/shapes/shared/PathBuilder.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +0 -1
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +2 -5
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs +3 -4
- package/dist-esm/lib/shapes/shared/SvgTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs +1 -10
- package/dist-esm/lib/shapes/shared/usePrefersReducedMotion.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +11 -5
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/styles.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs +1 -7
- package/dist-esm/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +22 -43
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs +15 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Idle.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs +0 -5
- package/dist-esm/lib/tools/SelectTool/childStates/PointingShape.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Resizing.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Rotating.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs +0 -8
- package/dist-esm/lib/tools/SelectTool/childStates/Translating.mjs.map +2 -2
- package/dist-esm/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.mjs.map +2 -2
- package/dist-esm/lib/ui/assetUrls.mjs +13 -10
- package/dist-esm/lib/ui/assetUrls.mjs.map +2 -2
- package/dist-esm/lib/ui/components/A11y.mjs +12 -14
- package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs +1 -51
- package/dist-esm/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +3 -3
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs +4 -3
- package/dist-esm/lib/ui/components/NavigationPanel/DefaultNavigationPanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Spinner.mjs +26 -3
- package/dist-esm/lib/ui/components/Spinner.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +1 -3
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +136 -168
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs +9 -23
- package/dist-esm/lib/ui/components/Toolbar/DefaultImageToolbar.mjs.map +3 -3
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +3 -3
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +2 -3
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +0 -22
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/Button/TldrawUiButtonIcon.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs +0 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiButtonPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs +1 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiDialog.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs +2 -36
- package/dist-esm/lib/ui/components/primitives/TldrawUiIcon.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs +2 -6
- package/dist-esm/lib/ui/components/primitives/TldrawUiSlider.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +3 -12
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +2 -0
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs +2 -3
- package/dist-esm/lib/ui/context/TldrawUiContextProvider.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +8 -57
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/menu-hooks.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs +2 -2
- package/dist-esm/lib/ui/hooks/useKeyboardShortcuts.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTools.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +0 -11
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs.map +2 -2
- package/dist-esm/lib/ui/kbd-utils.mjs +1 -2
- package/dist-esm/lib/ui/kbd-utils.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs +1 -1
- package/dist-esm/lib/utils/excalidraw/putExcalidrawContent.mjs.map +2 -2
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs +2 -3
- package/dist-esm/lib/utils/tldr/buildFromV1Document.mjs.map +2 -2
- package/package.json +3 -4
- package/src/index.ts +2 -24
- package/src/lib/TldrawImage.tsx +2 -6
- package/src/lib/canvas/TldrawCropHandles.tsx +1 -3
- package/src/lib/canvas/TldrawHandles.tsx +1 -5
- package/src/lib/canvas/TldrawOverlays.tsx +1 -1
- package/src/lib/canvas/TldrawSelectionForeground.tsx +1 -5
- package/src/lib/defaultExternalContentHandlers.ts +1 -2
- package/src/lib/shapes/arrow/ArrowShapeUtil.test.ts +5 -5
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +43 -26
- package/src/lib/shapes/arrow/arrowLabel.ts +3 -23
- package/src/lib/shapes/arrow/arrowTargetState.ts +1 -2
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +0 -3
- package/src/lib/shapes/draw/DrawShapeUtil.tsx +4 -0
- package/src/lib/shapes/frame/FrameShapeUtil.tsx +7 -5
- package/src/lib/shapes/highlight/HighlightShapeUtil.tsx +3 -0
- package/src/lib/shapes/line/LineShapeUtil.tsx +5 -19
- package/src/lib/shapes/note/NoteShapeUtil.tsx +0 -1
- package/src/lib/shapes/shared/PathBuilder.test.tsx +1 -1
- package/src/lib/shapes/shared/PathBuilder.tsx +1 -35
- package/src/lib/shapes/shared/PlainTextLabel.tsx +0 -1
- package/src/lib/shapes/shared/RichTextLabel.tsx +0 -4
- package/src/lib/shapes/shared/SvgTextLabel.tsx +2 -4
- package/src/lib/shapes/shared/usePrefersReducedMotion.tsx +1 -11
- package/src/lib/shapes/text/TextShapeUtil.tsx +12 -5
- package/src/lib/styles.tsx +1 -3
- package/src/lib/tools/SelectTool/childStates/Crop/children/PointingCrop.ts +1 -8
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +30 -54
- package/src/lib/tools/SelectTool/childStates/Idle.ts +24 -2
- package/src/lib/tools/SelectTool/childStates/PointingShape.ts +0 -7
- package/src/lib/tools/SelectTool/childStates/Resizing.ts +1 -12
- package/src/lib/tools/SelectTool/childStates/Rotating.ts +0 -11
- package/src/lib/tools/SelectTool/childStates/Translating.ts +0 -11
- package/src/lib/tools/selection-logic/getHitShapeOnCanvasPointerDown.ts +0 -1
- package/src/lib/ui/assetUrls.ts +13 -10
- package/src/lib/ui/components/A11y.tsx +13 -15
- package/src/lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent.tsx +0 -40
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +2 -4
- package/src/lib/ui/components/NavigationPanel/DefaultNavigationPanel.tsx +4 -3
- package/src/lib/ui/components/Spinner.tsx +24 -2
- package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +1 -3
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +127 -171
- package/src/lib/ui/components/Toolbar/DefaultImageToolbar.tsx +9 -25
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +3 -3
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +12 -17
- package/src/lib/ui/components/menu-items.tsx +0 -25
- package/src/lib/ui/components/primitives/Button/TldrawUiButtonIcon.tsx +2 -2
- package/src/lib/ui/components/primitives/TldrawUiButtonPicker.tsx +0 -2
- package/src/lib/ui/components/primitives/TldrawUiDialog.tsx +1 -1
- package/src/lib/ui/components/primitives/TldrawUiIcon.tsx +3 -41
- package/src/lib/ui/components/primitives/TldrawUiSlider.tsx +1 -6
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +3 -24
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +2 -2
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +4 -3
- package/src/lib/ui/context/TldrawUiContextProvider.tsx +20 -23
- package/src/lib/ui/context/actions.tsx +9 -59
- package/src/lib/ui/context/events.tsx +2 -5
- package/src/lib/ui/hooks/menu-hooks.ts +0 -1
- package/src/lib/ui/hooks/useKeyboardShortcuts.ts +2 -3
- package/src/lib/ui/hooks/useTools.tsx +1 -2
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +0 -11
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +0 -11
- package/src/lib/ui/kbd-utils.ts +1 -2
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +23 -65
- package/src/lib/utils/excalidraw/__snapshots__/putExcalidrawContent.test.tsx.snap +2 -16
- package/src/lib/utils/excalidraw/putExcalidrawContent.ts +1 -1
- package/src/lib/utils/tldr/__snapshots__/buildFromV1Document.test.ts.snap +3 -24
- package/src/lib/utils/tldr/buildFromV1Document.ts +1 -2
- package/src/test/Editor.test.tsx +1 -1
- package/src/test/SelectTool.test.ts +11 -37
- package/src/test/arrows-megabus.test.tsx +6 -12
- package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +2 -2
- package/src/test/commands/deletePage.test.ts +1 -84
- package/src/test/groups.test.tsx +1 -1
- package/src/test/navigation.test.ts +0 -254
- package/src/test/shapeutils.test.ts +45 -394
- package/src/test/translating.test.ts +1 -1
- package/tldraw.css +50 -88
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js +0 -35
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +0 -7
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +0 -267
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +0 -7
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +0 -19
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +0 -7
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +0 -237
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +0 -7
- package/src/lib/ui/components/AccessibilityMenu.tsx +0 -20
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +0 -313
- package/src/test/inner-outer-margin.test.ts +0 -315
package/src/lib/ui.css
CHANGED
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
opacity: 1;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
.tlui-button[aria-expanded='true'][data-direction='left'] {
|
|
100
|
+
.tlui-button[aria-expanded='true'][data-direction='left']::after {
|
|
101
101
|
background: linear-gradient(270deg, rgba(144, 144, 144, 0) 0%, var(--color-muted-2) 100%);
|
|
102
102
|
opacity: 1;
|
|
103
103
|
}
|
|
@@ -964,7 +964,7 @@
|
|
|
964
964
|
justify-content: center;
|
|
965
965
|
border-radius: 99px;
|
|
966
966
|
opacity: 0;
|
|
967
|
-
animation:
|
|
967
|
+
animation: fade-in;
|
|
968
968
|
animation-duration: 0.12s;
|
|
969
969
|
animation-delay: 2s;
|
|
970
970
|
animation-fill-mode: forwards;
|
|
@@ -1000,12 +1000,6 @@
|
|
|
1000
1000
|
max-width: 148px;
|
|
1001
1001
|
}
|
|
1002
1002
|
|
|
1003
|
-
.tlui-style-panel[data-show-ui-labels='true'] .tlui-button[data-isactive='true'] {
|
|
1004
|
-
border-radius: 10px;
|
|
1005
|
-
outline: 2px solid var(--color-text);
|
|
1006
|
-
outline-offset: -5px;
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
1003
|
.tlui-style-panel::-webkit-scrollbar {
|
|
1010
1004
|
display: none;
|
|
1011
1005
|
}
|
|
@@ -1070,26 +1064,6 @@
|
|
|
1070
1064
|
}
|
|
1071
1065
|
}
|
|
1072
1066
|
|
|
1073
|
-
/* Accessibility subheadings */
|
|
1074
|
-
|
|
1075
|
-
.tlui-style-panel__section .tlui-style-panel__subheading,
|
|
1076
|
-
.tlui-style-panel__section__common .tlui-style-panel__subheading,
|
|
1077
|
-
.tlui-style-panel__subheading + .tlui-slider__container {
|
|
1078
|
-
margin: 0;
|
|
1079
|
-
padding: var(--space-2) var(--space-3) 0px var(--space-4);
|
|
1080
|
-
font-size: 12px;
|
|
1081
|
-
font-weight: inherit;
|
|
1082
|
-
line-height: inherit;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
.tlui-style-panel .tlui-style-panel__subheading:nth-of-type(1) {
|
|
1086
|
-
padding-top: var(--space-3);
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
.tlui-style-panel__subheading + .tlui-slider__container {
|
|
1090
|
-
padding-top: 0px;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
1067
|
/* --------------------- Bottom --------------------- */
|
|
1094
1068
|
|
|
1095
1069
|
.tlui-layout__bottom {
|
|
@@ -1134,6 +1108,20 @@
|
|
|
1134
1108
|
display: none;
|
|
1135
1109
|
}
|
|
1136
1110
|
|
|
1111
|
+
.tlui-navigation-panel__toggle .tlui-icon {
|
|
1112
|
+
opacity: 0.24;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
.tlui-navigation-panel__toggle:active .tlui-icon {
|
|
1116
|
+
opacity: 1;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
@media (hover: hover) {
|
|
1120
|
+
.tlui-navigation-panel__toggle:hover .tlui-icon {
|
|
1121
|
+
opacity: 1;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1137
1125
|
/* Minimap */
|
|
1138
1126
|
|
|
1139
1127
|
.tlui-minimap {
|
|
@@ -1248,36 +1236,6 @@
|
|
|
1248
1236
|
transition: transform 0.15s ease-out 0.05s;
|
|
1249
1237
|
}
|
|
1250
1238
|
|
|
1251
|
-
/* ------------------- Tooltip -------------------- */
|
|
1252
|
-
|
|
1253
|
-
.tlui-tooltip {
|
|
1254
|
-
font-size: 12px;
|
|
1255
|
-
padding: 2px 8px;
|
|
1256
|
-
border-radius: 4px;
|
|
1257
|
-
background-color: var(--color-tooltip);
|
|
1258
|
-
box-shadow: none;
|
|
1259
|
-
color: var(--color-text-shadow);
|
|
1260
|
-
max-width: 400px;
|
|
1261
|
-
width: fit-content;
|
|
1262
|
-
text-align: center;
|
|
1263
|
-
pointer-events: none;
|
|
1264
|
-
will-change: transform, opacity;
|
|
1265
|
-
z-index: 2;
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
.tlui-tooltip__arrow {
|
|
1269
|
-
fill: var(--color-tooltip);
|
|
1270
|
-
will-change: opacity;
|
|
1271
|
-
}
|
|
1272
|
-
|
|
1273
|
-
[data-radix-popper-content-wrapper]:has(.tlui-tooltip) {
|
|
1274
|
-
z-index: var(--layer-toasts) !important;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
[data-radix-popper-content-wrapper]:has(.tlui-tooltip[data-should-animate='true']) {
|
|
1278
|
-
transition: all 0.1s ease-out;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
1239
|
/* ------------------- Debug panel ------------------ */
|
|
1282
1240
|
|
|
1283
1241
|
.tlui-debug-panel {
|
|
@@ -1421,11 +1379,11 @@
|
|
|
1421
1379
|
|
|
1422
1380
|
@media (prefers-reduced-motion: no-preference) {
|
|
1423
1381
|
.tlui-toast__container[data-state='open'] {
|
|
1424
|
-
animation:
|
|
1382
|
+
animation: slide-in 200ms cubic-bezier(0.785, 0.135, 0.15, 0.86);
|
|
1425
1383
|
}
|
|
1426
1384
|
|
|
1427
1385
|
.tlui-toast__container[data-state='closed'] {
|
|
1428
|
-
animation:
|
|
1386
|
+
animation: hide 100ms ease-in;
|
|
1429
1387
|
}
|
|
1430
1388
|
|
|
1431
1389
|
.tlui-toast__container[data-swipe='move'] {
|
|
@@ -1438,7 +1396,7 @@
|
|
|
1438
1396
|
}
|
|
1439
1397
|
|
|
1440
1398
|
.tlui-toast__container[data-swipe='end'] {
|
|
1441
|
-
animation:
|
|
1399
|
+
animation: swipe-out 100ms ease-out;
|
|
1442
1400
|
}
|
|
1443
1401
|
}
|
|
1444
1402
|
|
|
@@ -1453,7 +1411,7 @@
|
|
|
1453
1411
|
z-index: var(--layer-canvas-overlays);
|
|
1454
1412
|
background-color: var(--color-overlay);
|
|
1455
1413
|
pointer-events: all;
|
|
1456
|
-
animation:
|
|
1414
|
+
animation: fadeIn 0.12s ease-out;
|
|
1457
1415
|
display: grid;
|
|
1458
1416
|
place-items: center;
|
|
1459
1417
|
overflow-y: auto;
|
|
@@ -2020,7 +1978,7 @@
|
|
|
2020
1978
|
}
|
|
2021
1979
|
|
|
2022
1980
|
/* ------------------- Animations ------------------- */
|
|
2023
|
-
@keyframes
|
|
1981
|
+
@keyframes hide {
|
|
2024
1982
|
0% {
|
|
2025
1983
|
opacity: 1;
|
|
2026
1984
|
}
|
|
@@ -2029,7 +1987,7 @@
|
|
|
2029
1987
|
}
|
|
2030
1988
|
}
|
|
2031
1989
|
|
|
2032
|
-
@keyframes
|
|
1990
|
+
@keyframes slide-in {
|
|
2033
1991
|
from {
|
|
2034
1992
|
transform: translateX(calc(100% + var(--space-3)));
|
|
2035
1993
|
}
|
|
@@ -2038,7 +1996,7 @@
|
|
|
2038
1996
|
}
|
|
2039
1997
|
}
|
|
2040
1998
|
|
|
2041
|
-
@keyframes
|
|
1999
|
+
@keyframes swipe-out {
|
|
2042
2000
|
from {
|
|
2043
2001
|
transform: translateX(var(--radix-toast-swipe-end-x));
|
|
2044
2002
|
}
|
|
@@ -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",
|
|
@@ -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",
|
|
@@ -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",
|
|
@@ -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",
|
|
@@ -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/Editor.test.tsx
CHANGED
|
@@ -33,7 +33,7 @@ beforeEach(() => {
|
|
|
33
33
|
editor = new TestEditor({})
|
|
34
34
|
|
|
35
35
|
editor.createShapes([
|
|
36
|
-
// on
|
|
36
|
+
// on it's own
|
|
37
37
|
{ id: ids.box1, type: 'geo', x: 100, y: 100, props: { w: 100, h: 100 } },
|
|
38
38
|
// in a frame
|
|
39
39
|
{ id: ids.frame1, type: 'frame', x: 100, y: 100, props: { w: 100, h: 100 } },
|
|
@@ -275,27 +275,17 @@ describe('PointingLabel', () => {
|
|
|
275
275
|
type: 'arrow',
|
|
276
276
|
x: 100,
|
|
277
277
|
y: 100,
|
|
278
|
-
props: {
|
|
279
|
-
richText: toRichText('Test Label'),
|
|
280
|
-
start: { x: 0, y: 0 },
|
|
281
|
-
end: { x: 100, y: 0 },
|
|
282
|
-
},
|
|
278
|
+
props: { text: 'Test Label', end: { x: 100, y: 100 } },
|
|
283
279
|
},
|
|
284
280
|
])
|
|
285
|
-
const shape = editor.getShape(ids.arrow1)
|
|
286
|
-
|
|
287
|
-
editor.select(shape.id)
|
|
288
|
-
|
|
289
|
-
// Click at the middle of the arrow where the label would be and drag to move the label
|
|
290
|
-
editor.pointerDown(150, 100, {
|
|
281
|
+
const shape = editor.getShape(ids.arrow1)
|
|
282
|
+
editor.pointerDown(150, 150, {
|
|
291
283
|
target: 'shape',
|
|
292
284
|
shape,
|
|
293
285
|
})
|
|
294
|
-
editor.pointerMove(
|
|
286
|
+
editor.pointerMove(100, 100)
|
|
295
287
|
editor.expectToBeIn('select.pointing_arrow_label')
|
|
296
288
|
|
|
297
|
-
// Continue dragging to actually move the label, then it should go to idle
|
|
298
|
-
editor.pointerMove(170, 100)
|
|
299
289
|
editor.pointerUp()
|
|
300
290
|
editor.expectToBeIn('select.idle')
|
|
301
291
|
})
|
|
@@ -307,21 +297,16 @@ describe('PointingLabel', () => {
|
|
|
307
297
|
type: 'arrow',
|
|
308
298
|
x: 100,
|
|
309
299
|
y: 100,
|
|
310
|
-
props: {
|
|
311
|
-
richText: toRichText('Test Label'),
|
|
312
|
-
start: { x: 0, y: 0 },
|
|
313
|
-
end: { x: 100, y: 0 },
|
|
314
|
-
},
|
|
300
|
+
props: { text: 'Test Label', end: { x: 100, y: 100 } },
|
|
315
301
|
},
|
|
316
302
|
])
|
|
317
303
|
const shape = editor.getShape(ids.arrow1)
|
|
318
304
|
|
|
319
|
-
|
|
320
|
-
editor.pointerDown(150, 100, {
|
|
305
|
+
editor.pointerDown(150, 150, {
|
|
321
306
|
target: 'shape',
|
|
322
307
|
shape,
|
|
323
308
|
})
|
|
324
|
-
editor.pointerMove(
|
|
309
|
+
editor.pointerMove(100, 100)
|
|
325
310
|
editor.expectToBeIn('select.pointing_arrow_label')
|
|
326
311
|
editor.cancel()
|
|
327
312
|
editor.expectToBeIn('select.idle')
|
|
@@ -329,25 +314,14 @@ describe('PointingLabel', () => {
|
|
|
329
314
|
|
|
330
315
|
it('Doesnt go into pointing_arrow_label mode if not selecting the arrow shape', () => {
|
|
331
316
|
editor.createShapes<TLArrowShape>([
|
|
332
|
-
{
|
|
333
|
-
id: ids.arrow1,
|
|
334
|
-
type: 'arrow',
|
|
335
|
-
x: 100,
|
|
336
|
-
y: 100,
|
|
337
|
-
props: {
|
|
338
|
-
richText: toRichText(''), // Empty label
|
|
339
|
-
start: { x: 0, y: 0 },
|
|
340
|
-
end: { x: 100, y: 0 },
|
|
341
|
-
},
|
|
342
|
-
},
|
|
317
|
+
{ id: ids.arrow1, type: 'arrow', x: 100, y: 100, props: { text: 'Test Label' } },
|
|
343
318
|
])
|
|
344
|
-
const shape = editor.getShape(ids.arrow1)
|
|
345
|
-
|
|
346
|
-
editor.pointerDown(150, 100, {
|
|
319
|
+
const shape = editor.getShape(ids.arrow1)
|
|
320
|
+
editor.pointerDown(0, 150, {
|
|
347
321
|
target: 'shape',
|
|
348
322
|
shape,
|
|
349
323
|
})
|
|
350
|
-
editor.pointerMove(
|
|
324
|
+
editor.pointerMove(100, 100)
|
|
351
325
|
editor.expectToBeIn('select.translating')
|
|
352
326
|
|
|
353
327
|
editor.pointerUp()
|
|
@@ -288,13 +288,11 @@ describe('When shapes are overlapping', () => {
|
|
|
288
288
|
editor.pointerDown(0, 50) // over nothing
|
|
289
289
|
editor.pointerMove(125, 50) // over box1 only
|
|
290
290
|
expect(bindings().end).toMatchObject({ toId: ids.box1 })
|
|
291
|
-
editor.pointerMove(175, 50) // box2 is higher but box1 is filled
|
|
292
|
-
expect(bindings().end).toMatchObject({ toId: ids.box2 })
|
|
293
|
-
editor.pointerMove(175, 70) // box2 is higher but box1 is filled, and we're inside of box2
|
|
291
|
+
editor.pointerMove(175, 50) // box2 is higher but box1 is filled?
|
|
294
292
|
expect(bindings().end).toMatchObject({ toId: ids.box1 })
|
|
295
|
-
editor.pointerMove(225,
|
|
293
|
+
editor.pointerMove(225, 50) // box3 is higher
|
|
296
294
|
expect(bindings().end).toMatchObject({ toId: ids.box3 })
|
|
297
|
-
editor.pointerMove(275,
|
|
295
|
+
editor.pointerMove(275, 50) // box4 is higher but box 3 is filled
|
|
298
296
|
expect(bindings().end).toMatchObject({ toId: ids.box3 })
|
|
299
297
|
})
|
|
300
298
|
|
|
@@ -306,18 +304,14 @@ describe('When shapes are overlapping', () => {
|
|
|
306
304
|
])
|
|
307
305
|
editor.setCurrentTool('arrow')
|
|
308
306
|
editor.pointerDown(0, 50)
|
|
309
|
-
editor.pointerMove(175, 50) // box1 is smaller even though it's behind box2
|
|
310
|
-
expect(bindings().end).toMatchObject({ toId: ids.box2 })
|
|
311
|
-
editor.pointerMove(175, 70) // box1 is smaller even though it's behind box2
|
|
307
|
+
editor.pointerMove(175, 50) // box1 is smaller even though it's behind box2
|
|
312
308
|
expect(bindings().end).toMatchObject({ toId: ids.box1 })
|
|
313
|
-
editor.pointerMove(150, 90) // box3 is smaller and at the front
|
|
314
|
-
expect(bindings().end).toMatchObject({ toId: ids.box2 })
|
|
315
|
-
editor.pointerMove(160, 90) // box3 is smaller and at the front and we're in box1 and box 3 and box 2
|
|
309
|
+
editor.pointerMove(150, 90) // box3 is smaller and at the front
|
|
316
310
|
expect(bindings().end).toMatchObject({ toId: ids.box3 })
|
|
317
311
|
editor.sendToBack([ids.box3])
|
|
318
312
|
editor.pointerMove(149, 90) // box3 is smaller, even when at the back
|
|
319
313
|
expect(bindings().end).toMatchObject({ toId: ids.box3 })
|
|
320
|
-
editor.pointerMove(175,
|
|
314
|
+
editor.pointerMove(175, 50)
|
|
321
315
|
expect(bindings().end).toMatchObject({ toId: ids.box1 })
|
|
322
316
|
})
|
|
323
317
|
})
|
|
@@ -87,7 +87,7 @@ exports[`Matches a snapshot: Basic SVG 1`] = `
|
|
|
87
87
|
xmlns="http://www.w3.org/1999/xhtml"
|
|
88
88
|
>
|
|
89
89
|
<div
|
|
90
|
-
style="font-size: 22px; color: rgb(29, 29, 29); line-height: 1.35; text-align: center; width: 100%; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap;
|
|
90
|
+
style="font-size: 22px; color: rgb(29, 29, 29); line-height: 1.35; text-align: center; width: 100%; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap;"
|
|
91
91
|
>
|
|
92
92
|
<p
|
|
93
93
|
dir="auto"
|
|
@@ -219,7 +219,7 @@ exports[`Returns all shapes when no ids are provided: All shapes 1`] = `
|
|
|
219
219
|
xmlns="http://www.w3.org/1999/xhtml"
|
|
220
220
|
>
|
|
221
221
|
<div
|
|
222
|
-
style="font-size: 22px; color: rgb(29, 29, 29); line-height: 1.35; text-align: center; width: 100%; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap;
|
|
222
|
+
style="font-size: 22px; color: rgb(29, 29, 29); line-height: 1.35; text-align: center; width: 100%; word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap;"
|
|
223
223
|
>
|
|
224
224
|
<p
|
|
225
225
|
dir="auto"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PageRecordType
|
|
1
|
+
import { PageRecordType } from '@tldraw/editor'
|
|
2
2
|
import { TestEditor } from '../TestEditor'
|
|
3
3
|
|
|
4
4
|
let editor: TestEditor
|
|
@@ -76,87 +76,4 @@ describe('deletePage', () => {
|
|
|
76
76
|
expect(editor.getCurrentPageId()).not.toBe(currentPageId)
|
|
77
77
|
expect(editor.getCurrentPageId()).toBe(editor.getPages()[0].id)
|
|
78
78
|
})
|
|
79
|
-
|
|
80
|
-
it('deletes all shapes that belong to the deleted page', () => {
|
|
81
|
-
// Create a second page
|
|
82
|
-
const page2Id = PageRecordType.createId('page2')
|
|
83
|
-
editor.createPage({ name: 'Page 2', id: page2Id })
|
|
84
|
-
|
|
85
|
-
// Switch to the second page
|
|
86
|
-
editor.setCurrentPage(page2Id)
|
|
87
|
-
|
|
88
|
-
// Add some shapes to the second page
|
|
89
|
-
const shape1Id = createShapeId('shape1')
|
|
90
|
-
const shape2Id = createShapeId('shape2')
|
|
91
|
-
const shape3Id = createShapeId('shape3')
|
|
92
|
-
|
|
93
|
-
editor.createShape({ id: shape1Id, type: 'text', x: 100, y: 100 })
|
|
94
|
-
editor.createShape({ id: shape2Id, type: 'geo', x: 200, y: 200, props: { geo: 'rectangle' } })
|
|
95
|
-
editor.createShape({ id: shape3Id, type: 'geo', x: 300, y: 300, props: { geo: 'ellipse' } })
|
|
96
|
-
|
|
97
|
-
// Verify shapes were created and belong to the second page
|
|
98
|
-
expect(editor.getShape(shape1Id)).toBeDefined()
|
|
99
|
-
expect(editor.getShape(shape2Id)).toBeDefined()
|
|
100
|
-
expect(editor.getShape(shape3Id)).toBeDefined()
|
|
101
|
-
expect(editor.getShape(shape1Id)?.parentId).toBe(page2Id)
|
|
102
|
-
expect(editor.getShape(shape2Id)?.parentId).toBe(page2Id)
|
|
103
|
-
expect(editor.getShape(shape3Id)?.parentId).toBe(page2Id)
|
|
104
|
-
|
|
105
|
-
// Delete the second page
|
|
106
|
-
editor.deletePage(page2Id)
|
|
107
|
-
|
|
108
|
-
// Verify the page was deleted
|
|
109
|
-
expect(editor.getPages().length).toBe(1)
|
|
110
|
-
expect(editor.getPages()[0].id).not.toBe(page2Id)
|
|
111
|
-
|
|
112
|
-
// Verify all shapes that belonged to the deleted page were also deleted
|
|
113
|
-
expect(editor.getShape(shape1Id)).toBeUndefined()
|
|
114
|
-
expect(editor.getShape(shape2Id)).toBeUndefined()
|
|
115
|
-
expect(editor.getShape(shape3Id)).toBeUndefined()
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
it('deletes locked shapes that belong to the deleted page', () => {
|
|
119
|
-
// Create a second page
|
|
120
|
-
const page2Id = PageRecordType.createId('page2')
|
|
121
|
-
editor.createPage({ name: 'Page 2', id: page2Id })
|
|
122
|
-
|
|
123
|
-
// Switch to the second page
|
|
124
|
-
editor.setCurrentPage(page2Id)
|
|
125
|
-
|
|
126
|
-
// Add some shapes to the second page
|
|
127
|
-
const shape1Id = createShapeId('shape1')
|
|
128
|
-
const shape2Id = createShapeId('shape2')
|
|
129
|
-
const shape3Id = createShapeId('shape3')
|
|
130
|
-
|
|
131
|
-
editor.createShape({ id: shape1Id, type: 'text', x: 100, y: 100 })
|
|
132
|
-
editor.createShape({ id: shape2Id, type: 'geo', x: 200, y: 200, props: { geo: 'rectangle' } })
|
|
133
|
-
editor.createShape({ id: shape3Id, type: 'geo', x: 300, y: 300, props: { geo: 'ellipse' } })
|
|
134
|
-
|
|
135
|
-
// Lock some of the shapes
|
|
136
|
-
editor.updateShape({ id: shape1Id, type: 'text', isLocked: true })
|
|
137
|
-
editor.updateShape({ id: shape2Id, type: 'geo', isLocked: true })
|
|
138
|
-
|
|
139
|
-
// Verify shapes were created and belong to the second page
|
|
140
|
-
expect(editor.getShape(shape1Id)).toBeDefined()
|
|
141
|
-
expect(editor.getShape(shape2Id)).toBeDefined()
|
|
142
|
-
expect(editor.getShape(shape3Id)).toBeDefined()
|
|
143
|
-
expect(editor.getShape(shape1Id)?.parentId).toBe(page2Id)
|
|
144
|
-
expect(editor.getShape(shape2Id)?.parentId).toBe(page2Id)
|
|
145
|
-
expect(editor.getShape(shape3Id)?.parentId).toBe(page2Id)
|
|
146
|
-
expect(editor.getShape(shape1Id)?.isLocked).toBe(true)
|
|
147
|
-
expect(editor.getShape(shape2Id)?.isLocked).toBe(true)
|
|
148
|
-
expect(editor.getShape(shape3Id)?.isLocked).toBe(false)
|
|
149
|
-
|
|
150
|
-
// Delete the second page
|
|
151
|
-
editor.deletePage(page2Id)
|
|
152
|
-
|
|
153
|
-
// Verify the page was deleted
|
|
154
|
-
expect(editor.getPages().length).toBe(1)
|
|
155
|
-
expect(editor.getPages()[0].id).not.toBe(page2Id)
|
|
156
|
-
|
|
157
|
-
// Verify all shapes that belonged to the deleted page were also deleted, including locked ones
|
|
158
|
-
expect(editor.getShape(shape1Id)).toBeUndefined()
|
|
159
|
-
expect(editor.getShape(shape2Id)).toBeUndefined()
|
|
160
|
-
expect(editor.getShape(shape3Id)).toBeUndefined()
|
|
161
|
-
})
|
|
162
79
|
})
|
package/src/test/groups.test.tsx
CHANGED
|
@@ -1941,7 +1941,7 @@ describe('snapping', () => {
|
|
|
1941
1941
|
expect(editor.snaps.getIndicators().length).toBe(0)
|
|
1942
1942
|
})
|
|
1943
1943
|
|
|
1944
|
-
it('does not happen between children and
|
|
1944
|
+
it('does not happen between children and thier group', () => {
|
|
1945
1945
|
editor.select(ids.boxD)
|
|
1946
1946
|
editor.pointerDown(65, 5, ids.boxD)
|
|
1947
1947
|
editor.pointerMove(80, 105, ids.boxD, { ctrlKey: true })
|