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,5 +1,8 @@
|
|
|
1
1
|
import { TLBookmarkShape, createShapeId } from '@tldraw/editor'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
BookmarkShapeUtil,
|
|
4
|
+
getHumanReadableAddress,
|
|
5
|
+
} from '../lib/shapes/bookmark/BookmarkShapeUtil'
|
|
3
6
|
import { TestEditor } from './TestEditor'
|
|
4
7
|
|
|
5
8
|
let editor: TestEditor
|
|
@@ -11,6 +14,10 @@ afterEach(() => {
|
|
|
11
14
|
editor?.dispose()
|
|
12
15
|
})
|
|
13
16
|
|
|
17
|
+
describe(BookmarkShapeUtil, () => {
|
|
18
|
+
return
|
|
19
|
+
})
|
|
20
|
+
|
|
14
21
|
describe('The URL formatter', () => {
|
|
15
22
|
it('Formats URLs as human-readable', () => {
|
|
16
23
|
const ids = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`Matches a snapshot
|
|
3
|
+
exports[`Matches a snapshot: Basic SVG 1`] = `
|
|
4
4
|
<wrapper>
|
|
5
5
|
<svg
|
|
6
6
|
class="tl-container tl-theme__force-sRGB tl-theme__light"
|
|
@@ -64,13 +64,6 @@ exports[`Matches a snapshot > Basic SVG 1`] = `
|
|
|
64
64
|
y="0"
|
|
65
65
|
/>
|
|
66
66
|
</pattern>
|
|
67
|
-
<style>
|
|
68
|
-
@font-face {
|
|
69
|
-
font-family: "tldraw_draw";
|
|
70
|
-
font-weight: normal;
|
|
71
|
-
src: url("data:font/woff2;base64,") format(woff2);
|
|
72
|
-
}
|
|
73
|
-
</style>
|
|
74
67
|
</defs>
|
|
75
68
|
<g
|
|
76
69
|
opacity="1"
|
|
@@ -90,15 +83,14 @@ exports[`Matches a snapshot > Basic SVG 1`] = `
|
|
|
90
83
|
y="0"
|
|
91
84
|
>
|
|
92
85
|
<div
|
|
93
|
-
style="display:
|
|
86
|
+
style="display: flex; font-family: 'tldraw_draw', sans-serif; height: 100%; justify-content: center; align-items: center; padding: 16px 16px 16px 16px; visibility: visible;"
|
|
94
87
|
xmlns="http://www.w3.org/1999/xhtml"
|
|
95
88
|
>
|
|
96
89
|
<div
|
|
97
|
-
style="font-size: 22px; color: rgb(
|
|
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;"
|
|
98
91
|
>
|
|
99
92
|
<p
|
|
100
93
|
dir="auto"
|
|
101
|
-
style="position: static; width: 0px; height: 0px; margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);"
|
|
102
94
|
>
|
|
103
95
|
Hello world
|
|
104
96
|
</p>
|
|
@@ -140,7 +132,7 @@ exports[`Matches a snapshot > Basic SVG 1`] = `
|
|
|
140
132
|
</wrapper>
|
|
141
133
|
`;
|
|
142
134
|
|
|
143
|
-
exports[`Returns all shapes when no ids are provided
|
|
135
|
+
exports[`Returns all shapes when no ids are provided: All shapes 1`] = `
|
|
144
136
|
<wrapper>
|
|
145
137
|
<svg
|
|
146
138
|
class="tl-container tl-theme__force-sRGB tl-theme__light"
|
|
@@ -204,13 +196,6 @@ exports[`Returns all shapes when no ids are provided > All shapes 1`] = `
|
|
|
204
196
|
y="0"
|
|
205
197
|
/>
|
|
206
198
|
</pattern>
|
|
207
|
-
<style>
|
|
208
|
-
@font-face {
|
|
209
|
-
font-family: "tldraw_draw";
|
|
210
|
-
font-weight: normal;
|
|
211
|
-
src: url("data:font/woff2;base64,") format(woff2);
|
|
212
|
-
}
|
|
213
|
-
</style>
|
|
214
199
|
</defs>
|
|
215
200
|
<g
|
|
216
201
|
opacity="1"
|
|
@@ -230,15 +215,14 @@ exports[`Returns all shapes when no ids are provided > All shapes 1`] = `
|
|
|
230
215
|
y="0"
|
|
231
216
|
>
|
|
232
217
|
<div
|
|
233
|
-
style="display:
|
|
218
|
+
style="display: flex; font-family: 'tldraw_draw', sans-serif; height: 100%; justify-content: center; align-items: center; padding: 16px 16px 16px 16px; visibility: visible;"
|
|
234
219
|
xmlns="http://www.w3.org/1999/xhtml"
|
|
235
220
|
>
|
|
236
221
|
<div
|
|
237
|
-
style="font-size: 22px; color: rgb(
|
|
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;"
|
|
238
223
|
>
|
|
239
224
|
<p
|
|
240
225
|
dir="auto"
|
|
241
|
-
style="position: static; width: 0px; height: 0px; margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);"
|
|
242
226
|
>
|
|
243
227
|
Hello world
|
|
244
228
|
</p>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`editor.packShapes
|
|
3
|
+
exports[`editor.packShapes packs rotated shapes: packed shapes 1`] = `
|
|
4
4
|
[
|
|
5
5
|
{
|
|
6
6
|
"id": "shape:boxA",
|
|
@@ -116,7 +116,7 @@ exports[`editor.packShapes > packs rotated shapes > packed shapes 1`] = `
|
|
|
116
116
|
]
|
|
117
117
|
`;
|
|
118
118
|
|
|
119
|
-
exports[`editor.packShapes
|
|
119
|
+
exports[`editor.packShapes packs shapes using the adjacent shape margin option: packed shapes 1`] = `
|
|
120
120
|
[
|
|
121
121
|
{
|
|
122
122
|
"id": "shape:boxA",
|
|
@@ -152,7 +152,7 @@ exports[`editor.packShapes > packs shapes > packed shapes 1`] = `
|
|
|
152
152
|
"rotation": 0,
|
|
153
153
|
"type": "geo",
|
|
154
154
|
"typeName": "shape",
|
|
155
|
-
"x":
|
|
155
|
+
"x": 99,
|
|
156
156
|
"y": 200,
|
|
157
157
|
},
|
|
158
158
|
{
|
|
@@ -226,13 +226,13 @@ exports[`editor.packShapes > packs shapes > packed shapes 1`] = `
|
|
|
226
226
|
"rotation": 0,
|
|
227
227
|
"type": "geo",
|
|
228
228
|
"typeName": "shape",
|
|
229
|
-
"x":
|
|
229
|
+
"x": 301,
|
|
230
230
|
"y": 200,
|
|
231
231
|
},
|
|
232
232
|
]
|
|
233
233
|
`;
|
|
234
234
|
|
|
235
|
-
exports[`editor.packShapes
|
|
235
|
+
exports[`editor.packShapes packs shapes: packed shapes 1`] = `
|
|
236
236
|
[
|
|
237
237
|
{
|
|
238
238
|
"id": "shape:boxA",
|
|
@@ -268,7 +268,7 @@ exports[`editor.packShapes > packs shapes using the adjacent shape margin option
|
|
|
268
268
|
"rotation": 0,
|
|
269
269
|
"type": "geo",
|
|
270
270
|
"typeName": "shape",
|
|
271
|
-
"x":
|
|
271
|
+
"x": 84,
|
|
272
272
|
"y": 200,
|
|
273
273
|
},
|
|
274
274
|
{
|
|
@@ -342,7 +342,7 @@ exports[`editor.packShapes > packs shapes using the adjacent shape margin option
|
|
|
342
342
|
"rotation": 0,
|
|
343
343
|
"type": "geo",
|
|
344
344
|
"typeName": "shape",
|
|
345
|
-
"x":
|
|
345
|
+
"x": 316,
|
|
346
346
|
"y": 200,
|
|
347
347
|
},
|
|
348
348
|
]
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { Box, PI, TLShapeId } from '@tldraw/editor'
|
|
2
|
-
import { vi } from 'vitest'
|
|
3
2
|
import { TestEditor } from '../TestEditor'
|
|
4
3
|
import { TL } from '../test-jsx'
|
|
5
4
|
|
|
6
5
|
let editor: TestEditor
|
|
7
6
|
let ids: Record<string, TLShapeId>
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
jest.useFakeTimers()
|
|
10
9
|
|
|
11
10
|
beforeEach(() => {
|
|
12
11
|
editor = new TestEditor()
|
|
@@ -23,10 +22,10 @@ describe('when less than two shapes are selected', () => {
|
|
|
23
22
|
it('does nothing', () => {
|
|
24
23
|
editor.setSelectedShapes([ids.boxB])
|
|
25
24
|
|
|
26
|
-
const fn =
|
|
25
|
+
const fn = jest.fn()
|
|
27
26
|
editor.store.listen(fn)
|
|
28
27
|
editor.alignShapes(editor.getSelectedShapeIds(), 'top')
|
|
29
|
-
|
|
28
|
+
jest.advanceTimersByTime(1000)
|
|
30
29
|
expect(fn).not.toHaveBeenCalled()
|
|
31
30
|
})
|
|
32
31
|
})
|
|
@@ -35,7 +34,7 @@ describe('when multiple shapes are selected', () => {
|
|
|
35
34
|
it('does, undoes and redoes command', () => {
|
|
36
35
|
editor.markHistoryStoppingPoint('align')
|
|
37
36
|
editor.alignShapes(editor.getSelectedShapeIds(), 'top')
|
|
38
|
-
|
|
37
|
+
jest.advanceTimersByTime(1000)
|
|
39
38
|
|
|
40
39
|
editor.expectShapeToMatch({ id: ids.boxB, y: 0 })
|
|
41
40
|
editor.undo()
|
|
@@ -46,7 +45,7 @@ describe('when multiple shapes are selected', () => {
|
|
|
46
45
|
|
|
47
46
|
it('aligns top', () => {
|
|
48
47
|
editor.alignShapes(editor.getSelectedShapeIds(), 'top')
|
|
49
|
-
|
|
48
|
+
jest.advanceTimersByTime(1000)
|
|
50
49
|
|
|
51
50
|
editor.expectShapeToMatch(
|
|
52
51
|
{ id: ids.boxA, y: 0 },
|
|
@@ -57,7 +56,7 @@ describe('when multiple shapes are selected', () => {
|
|
|
57
56
|
|
|
58
57
|
it('aligns right', () => {
|
|
59
58
|
editor.alignShapes(editor.getSelectedShapeIds(), 'right')
|
|
60
|
-
|
|
59
|
+
jest.advanceTimersByTime(1000)
|
|
61
60
|
|
|
62
61
|
editor.expectShapeToMatch(
|
|
63
62
|
{ id: ids.boxA, x: 400 },
|
|
@@ -68,7 +67,7 @@ describe('when multiple shapes are selected', () => {
|
|
|
68
67
|
|
|
69
68
|
it('aligns bottom', () => {
|
|
70
69
|
editor.alignShapes(editor.getSelectedShapeIds(), 'bottom')
|
|
71
|
-
|
|
70
|
+
jest.advanceTimersByTime(1000)
|
|
72
71
|
|
|
73
72
|
editor.expectShapeToMatch(
|
|
74
73
|
{ id: ids.boxA, y: 400 },
|
|
@@ -79,7 +78,7 @@ describe('when multiple shapes are selected', () => {
|
|
|
79
78
|
|
|
80
79
|
it('aligns left', () => {
|
|
81
80
|
editor.alignShapes(editor.getSelectedShapeIds(), 'left')
|
|
82
|
-
|
|
81
|
+
jest.advanceTimersByTime(1000)
|
|
83
82
|
|
|
84
83
|
editor.expectShapeToMatch(
|
|
85
84
|
{ id: ids.boxA, x: 0 },
|
|
@@ -90,7 +89,7 @@ describe('when multiple shapes are selected', () => {
|
|
|
90
89
|
|
|
91
90
|
it('aligns center horizontal', () => {
|
|
92
91
|
editor.alignShapes(editor.getSelectedShapeIds(), 'center-horizontal')
|
|
93
|
-
|
|
92
|
+
jest.advanceTimersByTime(1000)
|
|
94
93
|
|
|
95
94
|
editor.expectShapeToMatch(
|
|
96
95
|
{ id: ids.boxA, x: 200 },
|
|
@@ -101,7 +100,7 @@ describe('when multiple shapes are selected', () => {
|
|
|
101
100
|
|
|
102
101
|
it('aligns center vertical', () => {
|
|
103
102
|
editor.alignShapes(editor.getSelectedShapeIds(), 'center-vertical')
|
|
104
|
-
|
|
103
|
+
jest.advanceTimersByTime(1000)
|
|
105
104
|
|
|
106
105
|
editor.expectShapeToMatch(
|
|
107
106
|
{ id: ids.boxA, y: 200 },
|
|
@@ -130,9 +129,9 @@ describe('when multiple shapes are selected', () => {
|
|
|
130
129
|
])
|
|
131
130
|
|
|
132
131
|
editor.alignShapes(editor.getSelectedShapeIds(), 'center-vertical')
|
|
133
|
-
|
|
132
|
+
jest.advanceTimersByTime(1000)
|
|
134
133
|
editor.alignShapes(editor.getSelectedShapeIds(), 'center-horizontal')
|
|
135
|
-
|
|
134
|
+
jest.advanceTimersByTime(1000)
|
|
136
135
|
|
|
137
136
|
const commonBounds = Box.Common([
|
|
138
137
|
editor.getShapePageBounds(ids.boxA)!,
|
|
@@ -169,9 +168,9 @@ describe('when multiple shapes are selected', () => {
|
|
|
169
168
|
])
|
|
170
169
|
|
|
171
170
|
editor.alignShapes(editor.getSelectedShapeIds(), 'top')
|
|
172
|
-
|
|
171
|
+
jest.advanceTimersByTime(1000)
|
|
173
172
|
editor.alignShapes(editor.getSelectedShapeIds(), 'left')
|
|
174
|
-
|
|
173
|
+
jest.advanceTimersByTime(1000)
|
|
175
174
|
|
|
176
175
|
const commonBounds = Box.Common([
|
|
177
176
|
editor.getShapePageBounds(ids.boxA)!,
|
|
@@ -209,9 +208,9 @@ describe('when multiple shapes are selected', () => {
|
|
|
209
208
|
|
|
210
209
|
editor.setSelectedShapes([ids.boxA, ids.boxB, ids.boxC])
|
|
211
210
|
editor.alignShapes(editor.getSelectedShapeIds(), 'bottom')
|
|
212
|
-
|
|
211
|
+
jest.advanceTimersByTime(1000)
|
|
213
212
|
editor.alignShapes(editor.getSelectedShapeIds(), 'right')
|
|
214
|
-
|
|
213
|
+
jest.advanceTimersByTime(1000)
|
|
215
214
|
|
|
216
215
|
const commonBounds = Box.Common([
|
|
217
216
|
editor.getShapePageBounds(ids.boxA)!,
|
|
@@ -252,9 +251,9 @@ describe('When shapes are parented to other shapes...', () => {
|
|
|
252
251
|
])
|
|
253
252
|
|
|
254
253
|
editor.alignShapes(editor.getSelectedShapeIds(), 'top')
|
|
255
|
-
|
|
254
|
+
jest.advanceTimersByTime(1000)
|
|
256
255
|
editor.alignShapes(editor.getSelectedShapeIds(), 'left')
|
|
257
|
-
|
|
256
|
+
jest.advanceTimersByTime(1000)
|
|
258
257
|
|
|
259
258
|
const commonBoundsAfter = Box.Common([
|
|
260
259
|
editor.getShapePageBounds(ids.boxC)!,
|
|
@@ -274,9 +273,9 @@ describe('When shapes are parented to other shapes...', () => {
|
|
|
274
273
|
])
|
|
275
274
|
|
|
276
275
|
editor.alignShapes(editor.getSelectedShapeIds(), 'bottom')
|
|
277
|
-
|
|
276
|
+
jest.advanceTimersByTime(1000)
|
|
278
277
|
editor.alignShapes(editor.getSelectedShapeIds(), 'right')
|
|
279
|
-
|
|
278
|
+
jest.advanceTimersByTime(1000)
|
|
280
279
|
|
|
281
280
|
const commonBoundsAfter = Box.Common([
|
|
282
281
|
editor.getShapePageBounds(ids.boxC)!,
|
|
@@ -340,9 +339,9 @@ describe('When shapes are parented to a rotated shape...', () => {
|
|
|
340
339
|
])
|
|
341
340
|
|
|
342
341
|
editor.alignShapes(editor.getSelectedShapeIds(), 'top')
|
|
343
|
-
|
|
342
|
+
jest.advanceTimersByTime(1000)
|
|
344
343
|
editor.alignShapes(editor.getSelectedShapeIds(), 'left')
|
|
345
|
-
|
|
344
|
+
jest.advanceTimersByTime(1000)
|
|
346
345
|
|
|
347
346
|
const commonBoundsAfter = Box.Common([
|
|
348
347
|
editor.getShapePageBounds(ids.boxC)!,
|
|
@@ -368,9 +367,9 @@ describe('When shapes are parented to a rotated shape...', () => {
|
|
|
368
367
|
])
|
|
369
368
|
|
|
370
369
|
editor.alignShapes(editor.getSelectedShapeIds(), 'bottom')
|
|
371
|
-
|
|
370
|
+
jest.advanceTimersByTime(1000)
|
|
372
371
|
editor.alignShapes(editor.getSelectedShapeIds(), 'right')
|
|
373
|
-
|
|
372
|
+
jest.advanceTimersByTime(1000)
|
|
374
373
|
|
|
375
374
|
const commonBoundsAfter = Box.Common([
|
|
376
375
|
editor.getShapePageBounds(ids.boxC)!,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { vi } from 'vitest'
|
|
2
1
|
import { TestEditor } from '../TestEditor'
|
|
3
2
|
|
|
4
3
|
let editor: TestEditor
|
|
@@ -7,7 +6,7 @@ beforeEach(() => {
|
|
|
7
6
|
editor = new TestEditor()
|
|
8
7
|
})
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
jest.useFakeTimers()
|
|
11
10
|
|
|
12
11
|
it('zooms in gradually when duration is present and animtion speed is default', () => {
|
|
13
12
|
expect(editor.getZoomLevel()).toBe(1)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { vi } from 'vitest'
|
|
2
1
|
import { TestEditor } from '../TestEditor'
|
|
3
2
|
|
|
4
3
|
let editor: TestEditor
|
|
@@ -15,9 +14,9 @@ it('centers on the point', () => {
|
|
|
15
14
|
it('centers on the point with animation', () => {
|
|
16
15
|
editor.centerOnPoint({ x: 400, y: 400 }, { animation: { duration: 200 } })
|
|
17
16
|
expect(editor.getViewportPageCenter()).not.toMatchObject({ x: 400, y: 400 })
|
|
18
|
-
|
|
17
|
+
jest.advanceTimersByTime(100)
|
|
19
18
|
expect(editor.getViewportPageCenter()).not.toMatchObject({ x: 400, y: 400 })
|
|
20
|
-
|
|
19
|
+
jest.advanceTimersByTime(200)
|
|
21
20
|
expect(editor.getViewportPageCenter()).toMatchObject({ x: 400, y: 400 })
|
|
22
21
|
})
|
|
23
22
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createShapeId, TLArrowShape } from '@tldraw/editor'
|
|
2
|
-
import { vi } from 'vitest'
|
|
3
2
|
import { getArrowBindings } from '../../lib/shapes/arrow/shared'
|
|
4
3
|
import { TestEditor } from '../TestEditor'
|
|
5
4
|
|
|
@@ -28,13 +27,13 @@ const doMockClipboard = () => {
|
|
|
28
27
|
|
|
29
28
|
Object.assign(window.navigator, {
|
|
30
29
|
clipboard: {
|
|
31
|
-
write:
|
|
30
|
+
write: jest.fn((content: any) => {
|
|
32
31
|
context.current = content
|
|
33
32
|
}),
|
|
34
33
|
},
|
|
35
34
|
})
|
|
36
35
|
|
|
37
|
-
globalThis.ClipboardItem =
|
|
36
|
+
globalThis.ClipboardItem = jest.fn((payload: any) => payload) as any
|
|
38
37
|
|
|
39
38
|
return context
|
|
40
39
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DefaultColorStyle, TLArrowShape, TLGeoShape, createShapeId } from '@tldraw/editor'
|
|
2
|
-
import { vi } from 'vitest'
|
|
3
2
|
import { TestEditor } from '../TestEditor'
|
|
4
3
|
|
|
5
4
|
let editor: TestEditor
|
|
@@ -127,7 +126,7 @@ it('Throws out all shapes if any shape is invalid', () => {
|
|
|
127
126
|
|
|
128
127
|
expect(editor.getCurrentPageShapeIds().size).toBe(n + 1)
|
|
129
128
|
|
|
130
|
-
console.error =
|
|
129
|
+
console.error = jest.fn()
|
|
131
130
|
|
|
132
131
|
// But these will need to be thrown out
|
|
133
132
|
expect(() => {
|
|
@@ -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
|
})
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { createBindingId, createShapeId } from '@tldraw/editor'
|
|
2
|
-
import { vi } from 'vitest'
|
|
3
2
|
import { getArrowBindings } from '../../lib/shapes/arrow/shared'
|
|
4
3
|
import { TestEditor } from '../TestEditor'
|
|
5
4
|
|
|
@@ -13,7 +12,7 @@ const ids = {
|
|
|
13
12
|
arrow1: createShapeId('arrow1'),
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
jest.useFakeTimers()
|
|
17
16
|
|
|
18
17
|
beforeEach(() => {
|
|
19
18
|
editor = new TestEditor()
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { PI, TLShapeId, createShapeId } from '@tldraw/editor'
|
|
2
|
-
import { vi } from 'vitest'
|
|
3
2
|
import { TestEditor } from '../TestEditor'
|
|
4
3
|
import { TL } from '../test-jsx'
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
jest.useFakeTimers()
|
|
7
6
|
|
|
8
7
|
let editor: TestEditor
|
|
9
8
|
|
|
@@ -47,10 +46,10 @@ describe('distributeShapes command', () => {
|
|
|
47
46
|
describe('when less than three shapes are selected', () => {
|
|
48
47
|
it('does nothing', () => {
|
|
49
48
|
editor.setSelectedShapes([ids.boxA, ids.boxB])
|
|
50
|
-
const fn =
|
|
49
|
+
const fn = jest.fn()
|
|
51
50
|
editor.store.listen(fn)
|
|
52
51
|
editor.distributeShapes(editor.getSelectedShapeIds(), 'horizontal')
|
|
53
|
-
|
|
52
|
+
jest.advanceTimersByTime(1000)
|
|
54
53
|
expect(fn).not.toHaveBeenCalled()
|
|
55
54
|
})
|
|
56
55
|
})
|
|
@@ -59,7 +58,7 @@ describe('distributeShapes command', () => {
|
|
|
59
58
|
it('distributeShapes horizontally', () => {
|
|
60
59
|
editor.selectAll()
|
|
61
60
|
editor.distributeShapes(editor.getSelectedShapeIds(), 'horizontal')
|
|
62
|
-
|
|
61
|
+
jest.advanceTimersByTime(1000)
|
|
63
62
|
editor.expectShapeToMatch(
|
|
64
63
|
{ id: ids.boxA, x: 0 },
|
|
65
64
|
{ id: ids.boxB, x: 200 },
|
|
@@ -71,7 +70,7 @@ describe('distributeShapes command', () => {
|
|
|
71
70
|
editor.updateShapes([{ id: ids.boxC, type: 'geo', x: 25 }])
|
|
72
71
|
editor.selectAll()
|
|
73
72
|
editor.distributeShapes(editor.getSelectedShapeIds(), 'horizontal')
|
|
74
|
-
|
|
73
|
+
jest.advanceTimersByTime(1000)
|
|
75
74
|
editor.expectShapeToMatch(
|
|
76
75
|
{ id: ids.boxA, x: 0 },
|
|
77
76
|
{ id: ids.boxB, x: 100 },
|
|
@@ -82,7 +81,7 @@ describe('distributeShapes command', () => {
|
|
|
82
81
|
it('distributeShapes vertically', () => {
|
|
83
82
|
editor.selectAll()
|
|
84
83
|
editor.distributeShapes(editor.getSelectedShapeIds(), 'vertical')
|
|
85
|
-
|
|
84
|
+
jest.advanceTimersByTime(1000)
|
|
86
85
|
editor.expectShapeToMatch(
|
|
87
86
|
{ id: ids.boxA, y: 0 },
|
|
88
87
|
{ id: ids.boxB, y: 200 },
|
|
@@ -94,7 +93,7 @@ describe('distributeShapes command', () => {
|
|
|
94
93
|
editor.updateShapes([{ id: ids.boxC, type: 'geo', y: 25 }])
|
|
95
94
|
editor.selectAll()
|
|
96
95
|
editor.distributeShapes(editor.getSelectedShapeIds(), 'vertical')
|
|
97
|
-
|
|
96
|
+
jest.advanceTimersByTime(1000)
|
|
98
97
|
editor.expectShapeToMatch(
|
|
99
98
|
{ id: ids.boxA, y: 0 },
|
|
100
99
|
{ id: ids.boxB, y: 100 },
|
|
@@ -136,7 +135,7 @@ describe('distributeShapes command', () => {
|
|
|
136
135
|
editor.setSelectedShapes([ids.boxB, ids.boxC, ids.boxD])
|
|
137
136
|
|
|
138
137
|
editor.distributeShapes(editor.getSelectedShapeIds(), 'horizontal')
|
|
139
|
-
|
|
138
|
+
jest.advanceTimersByTime(1000)
|
|
140
139
|
|
|
141
140
|
editor.expectShapeToMatch(
|
|
142
141
|
{ id: ids.boxB, x: 100 },
|
|
@@ -178,7 +177,7 @@ describe('distributeShapes command', () => {
|
|
|
178
177
|
editor.setSelectedShapes([ids.boxB, ids.boxC, ids.boxD])
|
|
179
178
|
|
|
180
179
|
editor.distributeShapes(editor.getSelectedShapeIds(), 'horizontal')
|
|
181
|
-
|
|
180
|
+
jest.advanceTimersByTime(1000)
|
|
182
181
|
|
|
183
182
|
editor.expectShapeToMatch(
|
|
184
183
|
{ id: ids.boxB, x: 100 },
|
|
@@ -223,7 +222,7 @@ describe('distributeShapes command', () => {
|
|
|
223
222
|
editor.setSelectedShapes([ids.boxB, ids.boxC, ids.boxD])
|
|
224
223
|
|
|
225
224
|
editor.distributeShapes(editor.getSelectedShapeIds(), 'horizontal')
|
|
226
|
-
|
|
225
|
+
jest.advanceTimersByTime(1000)
|
|
227
226
|
|
|
228
227
|
editor.expectShapeToMatch(
|
|
229
228
|
{ id: ids.boxB, x: 100 },
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DefaultDashStyle, TLGeoShape, createShapeId, toRichText } from '@tldraw/editor'
|
|
2
|
-
import { vi } from 'vitest'
|
|
3
2
|
import { TestEditor } from '../TestEditor'
|
|
4
3
|
|
|
5
4
|
let editor: TestEditor
|
|
@@ -15,7 +14,7 @@ function parseSvg({ svg }: { svg: string } = { svg: '' }) {
|
|
|
15
14
|
return parser.parseFromString(svg, 'image/svg+xml').firstElementChild as SVGSVGElement
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
jest.useRealTimers()
|
|
19
18
|
|
|
20
19
|
beforeEach(() => {
|
|
21
20
|
editor = new TestEditor()
|
|
@@ -1,5 +1,4 @@
|
|
|
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
|
|
@@ -11,7 +10,7 @@ const ids = {
|
|
|
11
10
|
boxD: createShapeId('boxD'),
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
jest.useFakeTimers()
|
|
15
14
|
|
|
16
15
|
beforeEach(() => {
|
|
17
16
|
editor = new TestEditor()
|
|
@@ -46,7 +45,7 @@ describe('editor.packShapes', () => {
|
|
|
46
45
|
editor.selectAll()
|
|
47
46
|
const centerBefore = editor.getSelectionRotatedPageBounds()!.center.clone()
|
|
48
47
|
editor.packShapes(editor.getSelectedShapeIds())
|
|
49
|
-
|
|
48
|
+
jest.advanceTimersByTime(1000)
|
|
50
49
|
expect(
|
|
51
50
|
editor.getCurrentPageShapes().map((s) => ({ ...s, parentId: 'wahtever' }))
|
|
52
51
|
).toMatchSnapshot('packed shapes')
|
|
@@ -58,7 +57,7 @@ describe('editor.packShapes', () => {
|
|
|
58
57
|
editor.selectAll()
|
|
59
58
|
const centerBefore = editor.getSelectionRotatedPageBounds()!.center.clone()
|
|
60
59
|
editor.packShapes(editor.getSelectedShapeIds(), 16)
|
|
61
|
-
|
|
60
|
+
jest.advanceTimersByTime(1000)
|
|
62
61
|
expect(
|
|
63
62
|
editor.getCurrentPageShapes().map((s) => ({ ...s, parentId: 'wahtever' }))
|
|
64
63
|
).toMatchSnapshot('packed shapes')
|
|
@@ -69,7 +68,7 @@ describe('editor.packShapes', () => {
|
|
|
69
68
|
it('packs rotated shapes', () => {
|
|
70
69
|
editor.updateShapes([{ id: ids.boxA, type: 'geo', rotation: Math.PI }])
|
|
71
70
|
editor.selectAll().packShapes(editor.getSelectedShapeIds(), 16)
|
|
72
|
-
|
|
71
|
+
jest.advanceTimersByTime(1000)
|
|
73
72
|
expect(
|
|
74
73
|
editor.getCurrentPageShapes().map((s) => ({ ...s, parentId: 'wahtever' }))
|
|
75
74
|
).toMatchSnapshot('packed shapes')
|