@mdesignable/core 1.0.0-beta.64
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/LICENSE.md +20 -0
- package/README.md +1 -0
- package/dist/designable.core.umd.production.js +10 -0
- package/dist/designable.core.umd.production.min.js +23505 -0
- package/esm/drivers/DragDropDriver.d.ts +14 -0
- package/esm/drivers/DragDropDriver.js +157 -0
- package/esm/drivers/KeyboardDriver.d.ts +7 -0
- package/esm/drivers/KeyboardDriver.js +90 -0
- package/esm/drivers/MouseClickDriver.d.ts +8 -0
- package/esm/drivers/MouseClickDriver.js +95 -0
- package/esm/drivers/MouseMoveDriver.d.ts +8 -0
- package/esm/drivers/MouseMoveDriver.js +75 -0
- package/esm/drivers/ViewportResizeDriver.d.ts +10 -0
- package/esm/drivers/ViewportResizeDriver.js +95 -0
- package/esm/drivers/ViewportScrollDriver.d.ts +8 -0
- package/esm/drivers/ViewportScrollDriver.js +74 -0
- package/esm/drivers/index.d.ts +6 -0
- package/esm/drivers/index.js +6 -0
- package/esm/effects/index.d.ts +11 -0
- package/esm/effects/index.js +11 -0
- package/esm/effects/useAutoScrollEffect.d.ts +2 -0
- package/esm/effects/useAutoScrollEffect.js +65 -0
- package/esm/effects/useContentEditableEffect.d.ts +2 -0
- package/esm/effects/useContentEditableEffect.js +167 -0
- package/esm/effects/useCursorEffect.d.ts +2 -0
- package/esm/effects/useCursorEffect.js +55 -0
- package/esm/effects/useDragDropEffect.d.ts +2 -0
- package/esm/effects/useDragDropEffect.js +168 -0
- package/esm/effects/useFreeSelectionEffect.d.ts +2 -0
- package/esm/effects/useFreeSelectionEffect.js +59 -0
- package/esm/effects/useKeyboardEffect.d.ts +2 -0
- package/esm/effects/useKeyboardEffect.js +17 -0
- package/esm/effects/useResizeEffect.d.ts +2 -0
- package/esm/effects/useResizeEffect.js +80 -0
- package/esm/effects/useSelectionEffect.d.ts +2 -0
- package/esm/effects/useSelectionEffect.js +68 -0
- package/esm/effects/useTranslateEffect.d.ts +2 -0
- package/esm/effects/useTranslateEffect.js +58 -0
- package/esm/effects/useViewportEffect.d.ts +2 -0
- package/esm/effects/useViewportEffect.js +31 -0
- package/esm/effects/useWorkspaceEffect.d.ts +2 -0
- package/esm/effects/useWorkspaceEffect.js +29 -0
- package/esm/events/cursor/AbstractCursorEvent.d.ts +21 -0
- package/esm/events/cursor/AbstractCursorEvent.js +40 -0
- package/esm/events/cursor/DragMoveEvent.d.ts +5 -0
- package/esm/events/cursor/DragMoveEvent.js +51 -0
- package/esm/events/cursor/DragStartEvent.d.ts +5 -0
- package/esm/events/cursor/DragStartEvent.js +51 -0
- package/esm/events/cursor/DragStopEvent.d.ts +5 -0
- package/esm/events/cursor/DragStopEvent.js +51 -0
- package/esm/events/cursor/MouseClickEvent.d.ts +8 -0
- package/esm/events/cursor/MouseClickEvent.js +61 -0
- package/esm/events/cursor/MouseMoveEvent.d.ts +5 -0
- package/esm/events/cursor/MouseMoveEvent.js +51 -0
- package/esm/events/cursor/index.d.ts +5 -0
- package/esm/events/cursor/index.js +5 -0
- package/esm/events/history/AbstractHistoryEvent.d.ts +6 -0
- package/esm/events/history/AbstractHistoryEvent.js +7 -0
- package/esm/events/history/HistoryGotoEvent.d.ts +5 -0
- package/esm/events/history/HistoryGotoEvent.js +51 -0
- package/esm/events/history/HistoryPushEvent.d.ts +5 -0
- package/esm/events/history/HistoryPushEvent.js +51 -0
- package/esm/events/history/HistoryRedoEvent.d.ts +5 -0
- package/esm/events/history/HistoryRedoEvent.js +51 -0
- package/esm/events/history/HistoryUndoEvent.d.ts +5 -0
- package/esm/events/history/HistoryUndoEvent.js +51 -0
- package/esm/events/history/index.d.ts +4 -0
- package/esm/events/history/index.js +4 -0
- package/esm/events/index.d.ts +6 -0
- package/esm/events/index.js +6 -0
- package/esm/events/keyboard/AbstractKeyboardEvent.d.ts +15 -0
- package/esm/events/keyboard/AbstractKeyboardEvent.js +61 -0
- package/esm/events/keyboard/KeyDownEvent.d.ts +5 -0
- package/esm/events/keyboard/KeyDownEvent.js +51 -0
- package/esm/events/keyboard/KeyUpEvent.d.ts +5 -0
- package/esm/events/keyboard/KeyUpEvent.js +51 -0
- package/esm/events/keyboard/index.d.ts +2 -0
- package/esm/events/keyboard/index.js +2 -0
- package/esm/events/mutation/AbstractMutationNodeEvent.d.ts +13 -0
- package/esm/events/mutation/AbstractMutationNodeEvent.js +7 -0
- package/esm/events/mutation/AppendNodeEvent.d.ts +5 -0
- package/esm/events/mutation/AppendNodeEvent.js +51 -0
- package/esm/events/mutation/CloneNodeEvent.d.ts +5 -0
- package/esm/events/mutation/CloneNodeEvent.js +51 -0
- package/esm/events/mutation/DragNodeEvent.d.ts +5 -0
- package/esm/events/mutation/DragNodeEvent.js +51 -0
- package/esm/events/mutation/DropNodeEvent.d.ts +5 -0
- package/esm/events/mutation/DropNodeEvent.js +51 -0
- package/esm/events/mutation/FromNodeEvent.d.ts +13 -0
- package/esm/events/mutation/FromNodeEvent.js +8 -0
- package/esm/events/mutation/HoverNodeEvent.d.ts +5 -0
- package/esm/events/mutation/HoverNodeEvent.js +51 -0
- package/esm/events/mutation/InsertAfterEvent.d.ts +5 -0
- package/esm/events/mutation/InsertAfterEvent.js +51 -0
- package/esm/events/mutation/InsertBeforeEvent.d.ts +5 -0
- package/esm/events/mutation/InsertBeforeEvent.js +51 -0
- package/esm/events/mutation/InsertChildrenEvent.d.ts +5 -0
- package/esm/events/mutation/InsertChildrenEvent.js +51 -0
- package/esm/events/mutation/PrependNodeEvent.d.ts +5 -0
- package/esm/events/mutation/PrependNodeEvent.js +51 -0
- package/esm/events/mutation/RemoveNodeEvent.d.ts +5 -0
- package/esm/events/mutation/RemoveNodeEvent.js +51 -0
- package/esm/events/mutation/SelectNodeEvent.d.ts +5 -0
- package/esm/events/mutation/SelectNodeEvent.js +51 -0
- package/esm/events/mutation/UnSelectNodeEvent.d.ts +5 -0
- package/esm/events/mutation/UnSelectNodeEvent.js +51 -0
- package/esm/events/mutation/UpdateChildrenEvent.d.ts +5 -0
- package/esm/events/mutation/UpdateChildrenEvent.js +51 -0
- package/esm/events/mutation/UpdateNodePropsEvent.d.ts +5 -0
- package/esm/events/mutation/UpdateNodePropsEvent.js +51 -0
- package/esm/events/mutation/UserSelectNodeEvent.d.ts +5 -0
- package/esm/events/mutation/UserSelectNodeEvent.js +51 -0
- package/esm/events/mutation/WrapNodeEvent.d.ts +5 -0
- package/esm/events/mutation/WrapNodeEvent.js +51 -0
- package/esm/events/mutation/index.d.ts +16 -0
- package/esm/events/mutation/index.js +16 -0
- package/esm/events/viewport/AbstractViewportEvent.d.ts +16 -0
- package/esm/events/viewport/AbstractViewportEvent.js +17 -0
- package/esm/events/viewport/ViewportResizeEvent.d.ts +5 -0
- package/esm/events/viewport/ViewportResizeEvent.js +51 -0
- package/esm/events/viewport/ViewportScrollEvent.d.ts +5 -0
- package/esm/events/viewport/ViewportScrollEvent.js +51 -0
- package/esm/events/viewport/index.d.ts +2 -0
- package/esm/events/viewport/index.js +2 -0
- package/esm/events/workbench/AbstractWorkspaceEvent.d.ts +7 -0
- package/esm/events/workbench/AbstractWorkspaceEvent.js +7 -0
- package/esm/events/workbench/AddWorkspaceEvent.d.ts +5 -0
- package/esm/events/workbench/AddWorkspaceEvent.js +51 -0
- package/esm/events/workbench/RemoveWorkspaceEvent.d.ts +5 -0
- package/esm/events/workbench/RemoveWorkspaceEvent.js +51 -0
- package/esm/events/workbench/SwitchWorkspaceEvent.d.ts +5 -0
- package/esm/events/workbench/SwitchWorkspaceEvent.js +51 -0
- package/esm/events/workbench/index.d.ts +3 -0
- package/esm/events/workbench/index.js +3 -0
- package/esm/exports.d.ts +5 -0
- package/esm/exports.js +5 -0
- package/esm/externals.d.ts +12 -0
- package/esm/externals.js +113 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.js +24 -0
- package/esm/internals.d.ts +3 -0
- package/esm/internals.js +34 -0
- package/esm/models/Cursor.d.ts +60 -0
- package/esm/models/Cursor.js +151 -0
- package/esm/models/Engine.d.ts +29 -0
- package/esm/models/Engine.js +112 -0
- package/esm/models/History.d.ts +34 -0
- package/esm/models/History.js +110 -0
- package/esm/models/Hover.d.ts +14 -0
- package/esm/models/Hover.js +38 -0
- package/esm/models/Keyboard.d.ts +29 -0
- package/esm/models/Keyboard.js +126 -0
- package/esm/models/MoveHelper.d.ts +66 -0
- package/esm/models/MoveHelper.js +363 -0
- package/esm/models/Operation.d.ts +29 -0
- package/esm/models/Operation.js +75 -0
- package/esm/models/Screen.d.ts +31 -0
- package/esm/models/Screen.js +73 -0
- package/esm/models/Selection.d.ts +29 -0
- package/esm/models/Selection.js +192 -0
- package/esm/models/Shortcut.d.ts +20 -0
- package/esm/models/Shortcut.js +69 -0
- package/esm/models/SnapLine.d.ts +27 -0
- package/esm/models/SnapLine.js +141 -0
- package/esm/models/SpaceBlock.d.ts +40 -0
- package/esm/models/SpaceBlock.js +171 -0
- package/esm/models/TransformHelper.d.ts +80 -0
- package/esm/models/TransformHelper.js +601 -0
- package/esm/models/TreeNode.d.ts +115 -0
- package/esm/models/TreeNode.js +932 -0
- package/esm/models/Viewport.d.ts +90 -0
- package/esm/models/Viewport.js +474 -0
- package/esm/models/Workbench.d.ts +23 -0
- package/esm/models/Workbench.js +98 -0
- package/esm/models/Workspace.d.ts +41 -0
- package/esm/models/Workspace.js +95 -0
- package/esm/models/index.d.ts +13 -0
- package/esm/models/index.js +13 -0
- package/esm/presets.d.ts +4 -0
- package/esm/presets.js +38 -0
- package/esm/registry.d.ts +16 -0
- package/esm/registry.js +123 -0
- package/esm/shortcuts/CursorSwitch.d.ts +2 -0
- package/esm/shortcuts/CursorSwitch.js +10 -0
- package/esm/shortcuts/MultiSelection.d.ts +5 -0
- package/esm/shortcuts/MultiSelection.js +27 -0
- package/esm/shortcuts/NodeMutation.d.ts +7 -0
- package/esm/shortcuts/NodeMutation.js +40 -0
- package/esm/shortcuts/QuickSelection.d.ts +3 -0
- package/esm/shortcuts/QuickSelection.js +85 -0
- package/esm/shortcuts/UndoRedo.d.ts +3 -0
- package/esm/shortcuts/UndoRedo.js +27 -0
- package/esm/shortcuts/index.d.ts +5 -0
- package/esm/shortcuts/index.js +5 -0
- package/esm/types.d.ts +131 -0
- package/esm/types.js +1 -0
- package/lib/drivers/DragDropDriver.d.ts +14 -0
- package/lib/drivers/DragDropDriver.js +160 -0
- package/lib/drivers/KeyboardDriver.d.ts +7 -0
- package/lib/drivers/KeyboardDriver.js +93 -0
- package/lib/drivers/MouseClickDriver.d.ts +8 -0
- package/lib/drivers/MouseClickDriver.js +98 -0
- package/lib/drivers/MouseMoveDriver.d.ts +8 -0
- package/lib/drivers/MouseMoveDriver.js +78 -0
- package/lib/drivers/ViewportResizeDriver.d.ts +10 -0
- package/lib/drivers/ViewportResizeDriver.js +98 -0
- package/lib/drivers/ViewportScrollDriver.d.ts +8 -0
- package/lib/drivers/ViewportScrollDriver.js +77 -0
- package/lib/drivers/index.d.ts +6 -0
- package/lib/drivers/index.js +22 -0
- package/lib/effects/index.d.ts +11 -0
- package/lib/effects/index.js +27 -0
- package/lib/effects/useAutoScrollEffect.d.ts +2 -0
- package/lib/effects/useAutoScrollEffect.js +69 -0
- package/lib/effects/useContentEditableEffect.d.ts +2 -0
- package/lib/effects/useContentEditableEffect.js +171 -0
- package/lib/effects/useCursorEffect.d.ts +2 -0
- package/lib/effects/useCursorEffect.js +59 -0
- package/lib/effects/useDragDropEffect.d.ts +2 -0
- package/lib/effects/useDragDropEffect.js +172 -0
- package/lib/effects/useFreeSelectionEffect.d.ts +2 -0
- package/lib/effects/useFreeSelectionEffect.js +63 -0
- package/lib/effects/useKeyboardEffect.d.ts +2 -0
- package/lib/effects/useKeyboardEffect.js +21 -0
- package/lib/effects/useResizeEffect.d.ts +2 -0
- package/lib/effects/useResizeEffect.js +84 -0
- package/lib/effects/useSelectionEffect.d.ts +2 -0
- package/lib/effects/useSelectionEffect.js +72 -0
- package/lib/effects/useTranslateEffect.d.ts +2 -0
- package/lib/effects/useTranslateEffect.js +62 -0
- package/lib/effects/useViewportEffect.d.ts +2 -0
- package/lib/effects/useViewportEffect.js +35 -0
- package/lib/effects/useWorkspaceEffect.d.ts +2 -0
- package/lib/effects/useWorkspaceEffect.js +33 -0
- package/lib/events/cursor/AbstractCursorEvent.d.ts +21 -0
- package/lib/events/cursor/AbstractCursorEvent.js +43 -0
- package/lib/events/cursor/DragMoveEvent.d.ts +5 -0
- package/lib/events/cursor/DragMoveEvent.js +54 -0
- package/lib/events/cursor/DragStartEvent.d.ts +5 -0
- package/lib/events/cursor/DragStartEvent.js +54 -0
- package/lib/events/cursor/DragStopEvent.d.ts +5 -0
- package/lib/events/cursor/DragStopEvent.js +54 -0
- package/lib/events/cursor/MouseClickEvent.d.ts +8 -0
- package/lib/events/cursor/MouseClickEvent.js +64 -0
- package/lib/events/cursor/MouseMoveEvent.d.ts +5 -0
- package/lib/events/cursor/MouseMoveEvent.js +54 -0
- package/lib/events/cursor/index.d.ts +5 -0
- package/lib/events/cursor/index.js +21 -0
- package/lib/events/history/AbstractHistoryEvent.d.ts +6 -0
- package/lib/events/history/AbstractHistoryEvent.js +10 -0
- package/lib/events/history/HistoryGotoEvent.d.ts +5 -0
- package/lib/events/history/HistoryGotoEvent.js +54 -0
- package/lib/events/history/HistoryPushEvent.d.ts +5 -0
- package/lib/events/history/HistoryPushEvent.js +54 -0
- package/lib/events/history/HistoryRedoEvent.d.ts +5 -0
- package/lib/events/history/HistoryRedoEvent.js +54 -0
- package/lib/events/history/HistoryUndoEvent.d.ts +5 -0
- package/lib/events/history/HistoryUndoEvent.js +54 -0
- package/lib/events/history/index.d.ts +4 -0
- package/lib/events/history/index.js +20 -0
- package/lib/events/index.d.ts +6 -0
- package/lib/events/index.js +22 -0
- package/lib/events/keyboard/AbstractKeyboardEvent.d.ts +15 -0
- package/lib/events/keyboard/AbstractKeyboardEvent.js +64 -0
- package/lib/events/keyboard/KeyDownEvent.d.ts +5 -0
- package/lib/events/keyboard/KeyDownEvent.js +54 -0
- package/lib/events/keyboard/KeyUpEvent.d.ts +5 -0
- package/lib/events/keyboard/KeyUpEvent.js +54 -0
- package/lib/events/keyboard/index.d.ts +2 -0
- package/lib/events/keyboard/index.js +18 -0
- package/lib/events/mutation/AbstractMutationNodeEvent.d.ts +13 -0
- package/lib/events/mutation/AbstractMutationNodeEvent.js +10 -0
- package/lib/events/mutation/AppendNodeEvent.d.ts +5 -0
- package/lib/events/mutation/AppendNodeEvent.js +54 -0
- package/lib/events/mutation/CloneNodeEvent.d.ts +5 -0
- package/lib/events/mutation/CloneNodeEvent.js +54 -0
- package/lib/events/mutation/DragNodeEvent.d.ts +5 -0
- package/lib/events/mutation/DragNodeEvent.js +54 -0
- package/lib/events/mutation/DropNodeEvent.d.ts +5 -0
- package/lib/events/mutation/DropNodeEvent.js +54 -0
- package/lib/events/mutation/FromNodeEvent.d.ts +13 -0
- package/lib/events/mutation/FromNodeEvent.js +11 -0
- package/lib/events/mutation/HoverNodeEvent.d.ts +5 -0
- package/lib/events/mutation/HoverNodeEvent.js +54 -0
- package/lib/events/mutation/InsertAfterEvent.d.ts +5 -0
- package/lib/events/mutation/InsertAfterEvent.js +54 -0
- package/lib/events/mutation/InsertBeforeEvent.d.ts +5 -0
- package/lib/events/mutation/InsertBeforeEvent.js +54 -0
- package/lib/events/mutation/InsertChildrenEvent.d.ts +5 -0
- package/lib/events/mutation/InsertChildrenEvent.js +54 -0
- package/lib/events/mutation/PrependNodeEvent.d.ts +5 -0
- package/lib/events/mutation/PrependNodeEvent.js +54 -0
- package/lib/events/mutation/RemoveNodeEvent.d.ts +5 -0
- package/lib/events/mutation/RemoveNodeEvent.js +54 -0
- package/lib/events/mutation/SelectNodeEvent.d.ts +5 -0
- package/lib/events/mutation/SelectNodeEvent.js +54 -0
- package/lib/events/mutation/UnSelectNodeEvent.d.ts +5 -0
- package/lib/events/mutation/UnSelectNodeEvent.js +54 -0
- package/lib/events/mutation/UpdateChildrenEvent.d.ts +5 -0
- package/lib/events/mutation/UpdateChildrenEvent.js +54 -0
- package/lib/events/mutation/UpdateNodePropsEvent.d.ts +5 -0
- package/lib/events/mutation/UpdateNodePropsEvent.js +54 -0
- package/lib/events/mutation/UserSelectNodeEvent.d.ts +5 -0
- package/lib/events/mutation/UserSelectNodeEvent.js +54 -0
- package/lib/events/mutation/WrapNodeEvent.d.ts +5 -0
- package/lib/events/mutation/WrapNodeEvent.js +54 -0
- package/lib/events/mutation/index.d.ts +16 -0
- package/lib/events/mutation/index.js +32 -0
- package/lib/events/viewport/AbstractViewportEvent.d.ts +16 -0
- package/lib/events/viewport/AbstractViewportEvent.js +20 -0
- package/lib/events/viewport/ViewportResizeEvent.d.ts +5 -0
- package/lib/events/viewport/ViewportResizeEvent.js +54 -0
- package/lib/events/viewport/ViewportScrollEvent.d.ts +5 -0
- package/lib/events/viewport/ViewportScrollEvent.js +54 -0
- package/lib/events/viewport/index.d.ts +2 -0
- package/lib/events/viewport/index.js +18 -0
- package/lib/events/workbench/AbstractWorkspaceEvent.d.ts +7 -0
- package/lib/events/workbench/AbstractWorkspaceEvent.js +10 -0
- package/lib/events/workbench/AddWorkspaceEvent.d.ts +5 -0
- package/lib/events/workbench/AddWorkspaceEvent.js +54 -0
- package/lib/events/workbench/RemoveWorkspaceEvent.d.ts +5 -0
- package/lib/events/workbench/RemoveWorkspaceEvent.js +54 -0
- package/lib/events/workbench/SwitchWorkspaceEvent.d.ts +5 -0
- package/lib/events/workbench/SwitchWorkspaceEvent.js +54 -0
- package/lib/events/workbench/index.d.ts +3 -0
- package/lib/events/workbench/index.js +19 -0
- package/lib/exports.d.ts +5 -0
- package/lib/exports.js +21 -0
- package/lib/externals.d.ts +12 -0
- package/lib/externals.js +126 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +52 -0
- package/lib/internals.d.ts +3 -0
- package/lib/internals.js +40 -0
- package/lib/models/Cursor.d.ts +60 -0
- package/lib/models/Cursor.js +154 -0
- package/lib/models/Engine.d.ts +29 -0
- package/lib/models/Engine.js +115 -0
- package/lib/models/History.d.ts +34 -0
- package/lib/models/History.js +113 -0
- package/lib/models/Hover.d.ts +14 -0
- package/lib/models/Hover.js +41 -0
- package/lib/models/Keyboard.d.ts +29 -0
- package/lib/models/Keyboard.js +129 -0
- package/lib/models/MoveHelper.d.ts +66 -0
- package/lib/models/MoveHelper.js +366 -0
- package/lib/models/Operation.d.ts +29 -0
- package/lib/models/Operation.js +78 -0
- package/lib/models/Screen.d.ts +31 -0
- package/lib/models/Screen.js +76 -0
- package/lib/models/Selection.d.ts +29 -0
- package/lib/models/Selection.js +195 -0
- package/lib/models/Shortcut.d.ts +20 -0
- package/lib/models/Shortcut.js +72 -0
- package/lib/models/SnapLine.d.ts +27 -0
- package/lib/models/SnapLine.js +144 -0
- package/lib/models/SpaceBlock.d.ts +40 -0
- package/lib/models/SpaceBlock.js +174 -0
- package/lib/models/TransformHelper.d.ts +80 -0
- package/lib/models/TransformHelper.js +604 -0
- package/lib/models/TreeNode.d.ts +115 -0
- package/lib/models/TreeNode.js +935 -0
- package/lib/models/Viewport.d.ts +90 -0
- package/lib/models/Viewport.js +477 -0
- package/lib/models/Workbench.d.ts +23 -0
- package/lib/models/Workbench.js +101 -0
- package/lib/models/Workspace.d.ts +41 -0
- package/lib/models/Workspace.js +98 -0
- package/lib/models/index.d.ts +13 -0
- package/lib/models/index.js +29 -0
- package/lib/presets.d.ts +4 -0
- package/lib/presets.js +41 -0
- package/lib/registry.d.ts +16 -0
- package/lib/registry.js +126 -0
- package/lib/shortcuts/CursorSwitch.d.ts +2 -0
- package/lib/shortcuts/CursorSwitch.js +13 -0
- package/lib/shortcuts/MultiSelection.d.ts +5 -0
- package/lib/shortcuts/MultiSelection.js +30 -0
- package/lib/shortcuts/NodeMutation.d.ts +7 -0
- package/lib/shortcuts/NodeMutation.js +43 -0
- package/lib/shortcuts/QuickSelection.d.ts +3 -0
- package/lib/shortcuts/QuickSelection.js +88 -0
- package/lib/shortcuts/UndoRedo.d.ts +3 -0
- package/lib/shortcuts/UndoRedo.js +30 -0
- package/lib/shortcuts/index.d.ts +5 -0
- package/lib/shortcuts/index.js +21 -0
- package/lib/types.d.ts +131 -0
- package/lib/types.js +2 -0
- package/package.json +49 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
import { EventDriver } from '@mdesignable/shared';
|
2
|
+
import { Engine } from '../models/Engine';
|
3
|
+
export declare class DragDropDriver extends EventDriver<Engine> {
|
4
|
+
mouseDownTimer: any;
|
5
|
+
startEvent: MouseEvent;
|
6
|
+
onMouseDown: (e: MouseEvent) => boolean;
|
7
|
+
onMouseUp: (e: MouseEvent) => void;
|
8
|
+
onMouseMove: (e: MouseEvent | DragEvent) => void;
|
9
|
+
onContextMenuWhileDragging: (e: MouseEvent) => void;
|
10
|
+
onStartDrag: (e: MouseEvent | DragEvent) => void;
|
11
|
+
onDistanceChange: (e: MouseEvent) => void;
|
12
|
+
attach(): void;
|
13
|
+
detach(): void;
|
14
|
+
}
|
@@ -0,0 +1,157 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
18
|
+
if (!m) return o;
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
20
|
+
try {
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
22
|
+
}
|
23
|
+
catch (error) { e = { error: error }; }
|
24
|
+
finally {
|
25
|
+
try {
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
27
|
+
}
|
28
|
+
finally { if (e) throw e.error; }
|
29
|
+
}
|
30
|
+
return ar;
|
31
|
+
};
|
32
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
33
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
34
|
+
if (ar || !(i in from)) {
|
35
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
36
|
+
ar[i] = from[i];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
40
|
+
};
|
41
|
+
import { EventDriver } from '@mdesignable/shared';
|
42
|
+
import { DragStartEvent, DragMoveEvent, DragStopEvent } from '../events';
|
43
|
+
var GlobalState = {
|
44
|
+
dragging: false,
|
45
|
+
onMouseDownAt: 0,
|
46
|
+
startEvent: null,
|
47
|
+
moveEvent: null,
|
48
|
+
};
|
49
|
+
var DragDropDriver = /** @class */ (function (_super) {
|
50
|
+
__extends(DragDropDriver, _super);
|
51
|
+
function DragDropDriver() {
|
52
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
53
|
+
_this.mouseDownTimer = null;
|
54
|
+
_this.onMouseDown = function (e) {
|
55
|
+
var _a, _b;
|
56
|
+
if (e.button !== 0 || e.ctrlKey || e.metaKey) {
|
57
|
+
return;
|
58
|
+
}
|
59
|
+
if (e.target['isContentEditable'] ||
|
60
|
+
e.target['contentEditable'] === 'true') {
|
61
|
+
return true;
|
62
|
+
}
|
63
|
+
if ((_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a['closest']) === null || _b === void 0 ? void 0 : _b.call(_a, '.monaco-editor'))
|
64
|
+
return;
|
65
|
+
GlobalState.startEvent = e;
|
66
|
+
GlobalState.dragging = false;
|
67
|
+
GlobalState.onMouseDownAt = Date.now();
|
68
|
+
_this.batchAddEventListener('mouseup', _this.onMouseUp);
|
69
|
+
_this.batchAddEventListener('dragend', _this.onMouseUp);
|
70
|
+
_this.batchAddEventListener('dragstart', _this.onStartDrag);
|
71
|
+
_this.batchAddEventListener('mousemove', _this.onDistanceChange);
|
72
|
+
};
|
73
|
+
_this.onMouseUp = function (e) {
|
74
|
+
if (GlobalState.dragging) {
|
75
|
+
_this.dispatch(new DragStopEvent({
|
76
|
+
clientX: e.clientX,
|
77
|
+
clientY: e.clientY,
|
78
|
+
pageX: e.pageX,
|
79
|
+
pageY: e.pageY,
|
80
|
+
target: e.target,
|
81
|
+
view: e.view,
|
82
|
+
}));
|
83
|
+
}
|
84
|
+
_this.batchRemoveEventListener('contextmenu', _this.onContextMenuWhileDragging, true);
|
85
|
+
_this.batchRemoveEventListener('mouseup', _this.onMouseUp);
|
86
|
+
_this.batchRemoveEventListener('mousedown', _this.onMouseDown);
|
87
|
+
_this.batchRemoveEventListener('dragover', _this.onMouseMove);
|
88
|
+
_this.batchRemoveEventListener('mousemove', _this.onMouseMove);
|
89
|
+
_this.batchRemoveEventListener('mousemove', _this.onDistanceChange);
|
90
|
+
GlobalState.dragging = false;
|
91
|
+
};
|
92
|
+
_this.onMouseMove = function (e) {
|
93
|
+
var _a, _b;
|
94
|
+
if (e.clientX === ((_a = GlobalState.moveEvent) === null || _a === void 0 ? void 0 : _a.clientX) &&
|
95
|
+
e.clientY === ((_b = GlobalState.moveEvent) === null || _b === void 0 ? void 0 : _b.clientY))
|
96
|
+
return;
|
97
|
+
_this.dispatch(new DragMoveEvent({
|
98
|
+
clientX: e.clientX,
|
99
|
+
clientY: e.clientY,
|
100
|
+
pageX: e.pageX,
|
101
|
+
pageY: e.pageY,
|
102
|
+
target: e.target,
|
103
|
+
view: e.view,
|
104
|
+
}));
|
105
|
+
GlobalState.moveEvent = e;
|
106
|
+
};
|
107
|
+
_this.onContextMenuWhileDragging = function (e) {
|
108
|
+
e.preventDefault();
|
109
|
+
};
|
110
|
+
_this.onStartDrag = function (e) {
|
111
|
+
if (GlobalState.dragging)
|
112
|
+
return;
|
113
|
+
GlobalState.startEvent = GlobalState.startEvent || e;
|
114
|
+
_this.batchAddEventListener('dragover', _this.onMouseMove);
|
115
|
+
_this.batchAddEventListener('mousemove', _this.onMouseMove);
|
116
|
+
_this.batchAddEventListener('contextmenu', _this.onContextMenuWhileDragging, true);
|
117
|
+
_this.dispatch(new DragStartEvent({
|
118
|
+
clientX: GlobalState.startEvent.clientX,
|
119
|
+
clientY: GlobalState.startEvent.clientY,
|
120
|
+
pageX: GlobalState.startEvent.pageX,
|
121
|
+
pageY: GlobalState.startEvent.pageY,
|
122
|
+
target: GlobalState.startEvent.target,
|
123
|
+
view: GlobalState.startEvent.view,
|
124
|
+
}));
|
125
|
+
GlobalState.dragging = true;
|
126
|
+
};
|
127
|
+
_this.onDistanceChange = function (e) {
|
128
|
+
var distance = Math.sqrt(Math.pow(e.pageX - GlobalState.startEvent.pageX, 2) +
|
129
|
+
Math.pow(e.pageY - GlobalState.startEvent.pageY, 2));
|
130
|
+
var timeDelta = Date.now() - GlobalState.onMouseDownAt;
|
131
|
+
if (timeDelta > 10 && e !== GlobalState.startEvent && distance > 4) {
|
132
|
+
_this.batchRemoveEventListener('mousemove', _this.onDistanceChange);
|
133
|
+
_this.onStartDrag(e);
|
134
|
+
}
|
135
|
+
};
|
136
|
+
return _this;
|
137
|
+
}
|
138
|
+
DragDropDriver.prototype.attach = function () {
|
139
|
+
this.batchAddEventListener('mousedown', this.onMouseDown, true);
|
140
|
+
};
|
141
|
+
DragDropDriver.prototype.detach = function () {
|
142
|
+
GlobalState.dragging = false;
|
143
|
+
GlobalState.moveEvent = null;
|
144
|
+
GlobalState.onMouseDownAt = null;
|
145
|
+
GlobalState.startEvent = null;
|
146
|
+
this.batchRemoveEventListener('mousedown', this.onMouseDown, true);
|
147
|
+
this.batchRemoveEventListener('dragstart', this.onStartDrag);
|
148
|
+
this.batchRemoveEventListener('dragend', this.onMouseUp);
|
149
|
+
this.batchRemoveEventListener('dragover', this.onMouseMove);
|
150
|
+
this.batchRemoveEventListener('mouseup', this.onMouseUp);
|
151
|
+
this.batchRemoveEventListener('mousemove', this.onMouseMove);
|
152
|
+
this.batchRemoveEventListener('mousemove', this.onDistanceChange);
|
153
|
+
this.batchRemoveEventListener('contextmenu', this.onContextMenuWhileDragging, true);
|
154
|
+
};
|
155
|
+
return DragDropDriver;
|
156
|
+
}(EventDriver));
|
157
|
+
export { DragDropDriver };
|
@@ -0,0 +1,90 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
18
|
+
if (!m) return o;
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
20
|
+
try {
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
22
|
+
}
|
23
|
+
catch (error) { e = { error: error }; }
|
24
|
+
finally {
|
25
|
+
try {
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
27
|
+
}
|
28
|
+
finally { if (e) throw e.error; }
|
29
|
+
}
|
30
|
+
return ar;
|
31
|
+
};
|
32
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
33
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
34
|
+
if (ar || !(i in from)) {
|
35
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
36
|
+
ar[i] = from[i];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
40
|
+
};
|
41
|
+
import { EventDriver } from '@mdesignable/shared';
|
42
|
+
import { KeyDownEvent, KeyUpEvent } from '../events';
|
43
|
+
function filter(event) {
|
44
|
+
var target = event.target;
|
45
|
+
var tagName = target.tagName;
|
46
|
+
var flag = true;
|
47
|
+
// ignore: isContentEditable === 'true', <input> and <textarea> when readOnly state is false, <select>、Web Components
|
48
|
+
if (target['isContentEditable'] ||
|
49
|
+
((tagName === 'INPUT' ||
|
50
|
+
tagName === 'TEXTAREA' ||
|
51
|
+
tagName === 'SELECT' ||
|
52
|
+
customElements.get(tagName.toLocaleLowerCase())) &&
|
53
|
+
!target.readOnly)) {
|
54
|
+
flag = false;
|
55
|
+
}
|
56
|
+
return flag;
|
57
|
+
}
|
58
|
+
var KeyboardDriver = /** @class */ (function (_super) {
|
59
|
+
__extends(KeyboardDriver, _super);
|
60
|
+
function KeyboardDriver() {
|
61
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
62
|
+
_this.onKeyDown = function (e) {
|
63
|
+
if (!filter(e))
|
64
|
+
return;
|
65
|
+
_this.dispatch(new KeyDownEvent(e));
|
66
|
+
};
|
67
|
+
_this.onKeyUp = function (e) {
|
68
|
+
_this.dispatch(new KeyUpEvent(e));
|
69
|
+
};
|
70
|
+
return _this;
|
71
|
+
}
|
72
|
+
KeyboardDriver.prototype.attach = function () {
|
73
|
+
this.addEventListener('keydown', this.onKeyDown, {
|
74
|
+
mode: 'onlyParent',
|
75
|
+
});
|
76
|
+
this.addEventListener('keyup', this.onKeyUp, {
|
77
|
+
mode: 'onlyParent',
|
78
|
+
});
|
79
|
+
};
|
80
|
+
KeyboardDriver.prototype.detach = function () {
|
81
|
+
this.removeEventListener('keydown', this.onKeyDown, {
|
82
|
+
mode: 'onlyParent',
|
83
|
+
});
|
84
|
+
this.removeEventListener('keyup', this.onKeyUp, {
|
85
|
+
mode: 'onlyParent',
|
86
|
+
});
|
87
|
+
};
|
88
|
+
return KeyboardDriver;
|
89
|
+
}(EventDriver));
|
90
|
+
export { KeyboardDriver };
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { EventDriver } from '@mdesignable/shared';
|
2
|
+
import { Engine } from '../models/Engine';
|
3
|
+
export declare class MouseClickDriver extends EventDriver<Engine> {
|
4
|
+
onMouseClick: (e: MouseEvent) => void;
|
5
|
+
onMouseDoubleClick: (e: MouseEvent) => void;
|
6
|
+
attach(): void;
|
7
|
+
detach(): void;
|
8
|
+
}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
18
|
+
if (!m) return o;
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
20
|
+
try {
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
22
|
+
}
|
23
|
+
catch (error) { e = { error: error }; }
|
24
|
+
finally {
|
25
|
+
try {
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
27
|
+
}
|
28
|
+
finally { if (e) throw e.error; }
|
29
|
+
}
|
30
|
+
return ar;
|
31
|
+
};
|
32
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
33
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
34
|
+
if (ar || !(i in from)) {
|
35
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
36
|
+
ar[i] = from[i];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
40
|
+
};
|
41
|
+
import { EventDriver } from '@mdesignable/shared';
|
42
|
+
import { MouseClickEvent, MouseDoubleClickEvent } from '../events';
|
43
|
+
var MouseClickDriver = /** @class */ (function (_super) {
|
44
|
+
__extends(MouseClickDriver, _super);
|
45
|
+
function MouseClickDriver() {
|
46
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
47
|
+
_this.onMouseClick = function (e) {
|
48
|
+
var target = e.target;
|
49
|
+
if (target === null || target === void 0 ? void 0 : target.closest("*[".concat(_this.engine.props.clickStopPropagationAttrName, "]"))) {
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
_this.dispatch(new MouseClickEvent({
|
53
|
+
clientX: e.clientX,
|
54
|
+
clientY: e.clientY,
|
55
|
+
pageX: e.pageX,
|
56
|
+
pageY: e.pageY,
|
57
|
+
target: e.target,
|
58
|
+
view: e.view,
|
59
|
+
}));
|
60
|
+
};
|
61
|
+
_this.onMouseDoubleClick = function (e) {
|
62
|
+
var target = e.target;
|
63
|
+
if (target === null || target === void 0 ? void 0 : target.closest("*[".concat(_this.engine.props.clickStopPropagationAttrName, "]"))) {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
_this.dispatch(new MouseDoubleClickEvent({
|
67
|
+
clientX: e.clientX,
|
68
|
+
clientY: e.clientY,
|
69
|
+
pageX: e.pageX,
|
70
|
+
pageY: e.pageY,
|
71
|
+
target: e.target,
|
72
|
+
view: e.view,
|
73
|
+
}));
|
74
|
+
};
|
75
|
+
return _this;
|
76
|
+
}
|
77
|
+
MouseClickDriver.prototype.attach = function () {
|
78
|
+
this.addEventListener('click', this.onMouseClick, {
|
79
|
+
mode: 'onlyChild',
|
80
|
+
});
|
81
|
+
this.addEventListener('dblclick', this.onMouseDoubleClick, {
|
82
|
+
mode: 'onlyChild',
|
83
|
+
});
|
84
|
+
};
|
85
|
+
MouseClickDriver.prototype.detach = function () {
|
86
|
+
this.removeEventListener('click', this.onMouseClick, {
|
87
|
+
mode: 'onlyChild',
|
88
|
+
});
|
89
|
+
this.removeEventListener('dblclick', this.onMouseDoubleClick, {
|
90
|
+
mode: 'onlyChild',
|
91
|
+
});
|
92
|
+
};
|
93
|
+
return MouseClickDriver;
|
94
|
+
}(EventDriver));
|
95
|
+
export { MouseClickDriver };
|
@@ -0,0 +1,75 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
18
|
+
if (!m) return o;
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
20
|
+
try {
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
22
|
+
}
|
23
|
+
catch (error) { e = { error: error }; }
|
24
|
+
finally {
|
25
|
+
try {
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
27
|
+
}
|
28
|
+
finally { if (e) throw e.error; }
|
29
|
+
}
|
30
|
+
return ar;
|
31
|
+
};
|
32
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
33
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
34
|
+
if (ar || !(i in from)) {
|
35
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
36
|
+
ar[i] = from[i];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
40
|
+
};
|
41
|
+
import { EventDriver } from '@mdesignable/shared';
|
42
|
+
import { MouseMoveEvent } from '../events';
|
43
|
+
var MouseMoveDriver = /** @class */ (function (_super) {
|
44
|
+
__extends(MouseMoveDriver, _super);
|
45
|
+
function MouseMoveDriver() {
|
46
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
47
|
+
_this.request = null;
|
48
|
+
_this.onMouseMove = function (e) {
|
49
|
+
_this.request = requestAnimationFrame(function () {
|
50
|
+
cancelAnimationFrame(_this.request);
|
51
|
+
_this.dispatch(new MouseMoveEvent({
|
52
|
+
clientX: e.clientX,
|
53
|
+
clientY: e.clientY,
|
54
|
+
pageX: e.pageX,
|
55
|
+
pageY: e.pageY,
|
56
|
+
target: e.target,
|
57
|
+
view: e.view,
|
58
|
+
}));
|
59
|
+
});
|
60
|
+
};
|
61
|
+
return _this;
|
62
|
+
}
|
63
|
+
MouseMoveDriver.prototype.attach = function () {
|
64
|
+
this.addEventListener('mousemove', this.onMouseMove, {
|
65
|
+
mode: 'onlyOne',
|
66
|
+
});
|
67
|
+
};
|
68
|
+
MouseMoveDriver.prototype.detach = function () {
|
69
|
+
this.removeEventListener('mouseover', this.onMouseMove, {
|
70
|
+
mode: 'onlyOne',
|
71
|
+
});
|
72
|
+
};
|
73
|
+
return MouseMoveDriver;
|
74
|
+
}(EventDriver));
|
75
|
+
export { MouseMoveDriver };
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { EventDriver } from '@mdesignable/shared';
|
2
|
+
import { Engine } from '../models/Engine';
|
3
|
+
import { ResizeObserver } from '@juggle/resize-observer';
|
4
|
+
export declare class ViewportResizeDriver extends EventDriver<Engine> {
|
5
|
+
request: any;
|
6
|
+
resizeObserver: ResizeObserver;
|
7
|
+
onResize: import("lodash").DebouncedFunc<(e: any) => void>;
|
8
|
+
attach(): void;
|
9
|
+
detach(): void;
|
10
|
+
}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
18
|
+
if (!m) return o;
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
20
|
+
try {
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
22
|
+
}
|
23
|
+
catch (error) { e = { error: error }; }
|
24
|
+
finally {
|
25
|
+
try {
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
27
|
+
}
|
28
|
+
finally { if (e) throw e.error; }
|
29
|
+
}
|
30
|
+
return ar;
|
31
|
+
};
|
32
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
33
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
34
|
+
if (ar || !(i in from)) {
|
35
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
36
|
+
ar[i] = from[i];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
40
|
+
};
|
41
|
+
import { EventDriver } from '@mdesignable/shared';
|
42
|
+
import { ViewportResizeEvent } from '../events';
|
43
|
+
import { ResizeObserver } from '@juggle/resize-observer';
|
44
|
+
import { globalThisPolyfill } from '@mdesignable/shared';
|
45
|
+
import { debounce } from 'lodash';
|
46
|
+
var ViewportResizeDriver = /** @class */ (function (_super) {
|
47
|
+
__extends(ViewportResizeDriver, _super);
|
48
|
+
function ViewportResizeDriver() {
|
49
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
50
|
+
_this.request = null;
|
51
|
+
_this.resizeObserver = null;
|
52
|
+
_this.onResize = debounce(function (e) {
|
53
|
+
if (e.preventDefault)
|
54
|
+
e.preventDefault();
|
55
|
+
_this.request = requestAnimationFrame(function () {
|
56
|
+
cancelAnimationFrame(_this.request);
|
57
|
+
_this.dispatch(new ViewportResizeEvent({
|
58
|
+
scrollX: _this.contentWindow.scrollX,
|
59
|
+
scrollY: _this.contentWindow.scrollY,
|
60
|
+
width: _this.contentWindow.innerWidth,
|
61
|
+
height: _this.contentWindow.innerHeight,
|
62
|
+
innerHeight: _this.contentWindow.innerHeight,
|
63
|
+
innerWidth: _this.contentWindow.innerWidth,
|
64
|
+
view: _this.contentWindow,
|
65
|
+
target: e.target || _this.container,
|
66
|
+
}));
|
67
|
+
});
|
68
|
+
}, 500);
|
69
|
+
return _this;
|
70
|
+
}
|
71
|
+
ViewportResizeDriver.prototype.attach = function () {
|
72
|
+
if (this.contentWindow && this.contentWindow !== globalThisPolyfill) {
|
73
|
+
this.addEventListener('resize', this.onResize);
|
74
|
+
}
|
75
|
+
else {
|
76
|
+
if (this.container && this.container !== document) {
|
77
|
+
this.resizeObserver = new ResizeObserver(this.onResize);
|
78
|
+
this.resizeObserver.observe(this.container);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
};
|
82
|
+
ViewportResizeDriver.prototype.detach = function () {
|
83
|
+
if (this.contentWindow && this.contentWindow !== globalThisPolyfill) {
|
84
|
+
this.removeEventListener('resize', this.onResize);
|
85
|
+
}
|
86
|
+
else if (this.resizeObserver) {
|
87
|
+
if (this.container && this.container !== document) {
|
88
|
+
this.resizeObserver.unobserve(this.container);
|
89
|
+
this.resizeObserver.disconnect();
|
90
|
+
}
|
91
|
+
}
|
92
|
+
};
|
93
|
+
return ViewportResizeDriver;
|
94
|
+
}(EventDriver));
|
95
|
+
export { ViewportResizeDriver };
|
@@ -0,0 +1,74 @@
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
2
|
+
var extendStatics = function (d, b) {
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
+
return extendStatics(d, b);
|
7
|
+
};
|
8
|
+
return function (d, b) {
|
9
|
+
if (typeof b !== "function" && b !== null)
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
+
extendStatics(d, b);
|
12
|
+
function __() { this.constructor = d; }
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
+
};
|
15
|
+
})();
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
18
|
+
if (!m) return o;
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
20
|
+
try {
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
22
|
+
}
|
23
|
+
catch (error) { e = { error: error }; }
|
24
|
+
finally {
|
25
|
+
try {
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
27
|
+
}
|
28
|
+
finally { if (e) throw e.error; }
|
29
|
+
}
|
30
|
+
return ar;
|
31
|
+
};
|
32
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
33
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
34
|
+
if (ar || !(i in from)) {
|
35
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
36
|
+
ar[i] = from[i];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
40
|
+
};
|
41
|
+
import { EventDriver, globalThisPolyfill } from '@mdesignable/shared';
|
42
|
+
import { ViewportScrollEvent } from '../events';
|
43
|
+
var ViewportScrollDriver = /** @class */ (function (_super) {
|
44
|
+
__extends(ViewportScrollDriver, _super);
|
45
|
+
function ViewportScrollDriver() {
|
46
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
47
|
+
_this.request = null;
|
48
|
+
_this.onScroll = function (e) {
|
49
|
+
e.preventDefault();
|
50
|
+
_this.request = globalThisPolyfill.requestAnimationFrame(function () {
|
51
|
+
_this.dispatch(new ViewportScrollEvent({
|
52
|
+
scrollX: _this.contentWindow.scrollX,
|
53
|
+
scrollY: _this.contentWindow.scrollY,
|
54
|
+
width: _this.contentWindow.document.body.clientWidth,
|
55
|
+
height: _this.contentWindow.document.body.clientHeight,
|
56
|
+
innerHeight: _this.contentWindow.innerHeight,
|
57
|
+
innerWidth: _this.contentWindow.innerWidth,
|
58
|
+
view: _this.contentWindow,
|
59
|
+
target: e.target,
|
60
|
+
}));
|
61
|
+
cancelAnimationFrame(_this.request);
|
62
|
+
});
|
63
|
+
};
|
64
|
+
return _this;
|
65
|
+
}
|
66
|
+
ViewportScrollDriver.prototype.attach = function () {
|
67
|
+
this.addEventListener('scroll', this.onScroll);
|
68
|
+
};
|
69
|
+
ViewportScrollDriver.prototype.detach = function () {
|
70
|
+
this.removeEventListener('scroll', this.onScroll);
|
71
|
+
};
|
72
|
+
return ViewportScrollDriver;
|
73
|
+
}(EventDriver));
|
74
|
+
export { ViewportScrollDriver };
|