@sulesky/next-core 1.0.3
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 +1 -0
- package/dist/designable.core.umd.production.min.js +7994 -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 +94 -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 +933 -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 +97 -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 +62 -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 +936 -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 +43 -0
- package/rollup.config.mjs +3 -0
- package/src/drivers/DragDropDriver.ts +143 -0
- package/src/drivers/KeyboardDriver.ts +49 -0
- package/src/drivers/MouseClickDriver.ts +61 -0
- package/src/drivers/MouseMoveDriver.ts +34 -0
- package/src/drivers/ViewportResizeDriver.ts +52 -0
- package/src/drivers/ViewportScrollDriver.ts +34 -0
- package/src/drivers/index.ts +6 -0
- package/src/effects/index.ts +11 -0
- package/src/effects/useAutoScrollEffect.ts +82 -0
- package/src/effects/useContentEditableEffect.ts +207 -0
- package/src/effects/useCursorEffect.ts +62 -0
- package/src/effects/useDragDropEffect.ts +185 -0
- package/src/effects/useFreeSelectionEffect.ts +66 -0
- package/src/effects/useKeyboardEffect.ts +20 -0
- package/src/effects/useResizeEffect.ts +92 -0
- package/src/effects/useSelectionEffect.ts +68 -0
- package/src/effects/useTranslateEffect.ts +59 -0
- package/src/effects/useViewportEffect.ts +29 -0
- package/src/effects/useWorkspaceEffect.ts +35 -0
- package/src/events/cursor/AbstractCursorEvent.ts +62 -0
- package/src/events/cursor/DragMoveEvent.ts +6 -0
- package/src/events/cursor/DragStartEvent.ts +9 -0
- package/src/events/cursor/DragStopEvent.ts +6 -0
- package/src/events/cursor/MouseClickEvent.ts +16 -0
- package/src/events/cursor/MouseMoveEvent.ts +9 -0
- package/src/events/cursor/index.ts +5 -0
- package/src/events/history/AbstractHistoryEvent.ts +9 -0
- package/src/events/history/HistoryGotoEvent.ts +9 -0
- package/src/events/history/HistoryPushEvent.ts +9 -0
- package/src/events/history/HistoryRedoEvent.ts +9 -0
- package/src/events/history/HistoryUndoEvent.ts +9 -0
- package/src/events/history/index.ts +4 -0
- package/src/events/index.ts +6 -0
- package/src/events/keyboard/AbstractKeyboardEvent.ts +48 -0
- package/src/events/keyboard/KeyDownEvent.ts +9 -0
- package/src/events/keyboard/KeyUpEvent.ts +6 -0
- package/src/events/keyboard/index.ts +2 -0
- package/src/events/mutation/AbstractMutationNodeEvent.ts +21 -0
- package/src/events/mutation/AppendNodeEvent.ts +9 -0
- package/src/events/mutation/CloneNodeEvent.ts +9 -0
- package/src/events/mutation/DragNodeEvent.ts +9 -0
- package/src/events/mutation/DropNodeEvent.ts +9 -0
- package/src/events/mutation/FromNodeEvent.ts +19 -0
- package/src/events/mutation/HoverNodeEvent.ts +9 -0
- package/src/events/mutation/InsertAfterEvent.ts +9 -0
- package/src/events/mutation/InsertBeforeEvent.ts +9 -0
- package/src/events/mutation/InsertChildrenEvent.ts +9 -0
- package/src/events/mutation/PrependNodeEvent.ts +9 -0
- package/src/events/mutation/RemoveNodeEvent.ts +9 -0
- package/src/events/mutation/SelectNodeEvent.ts +9 -0
- package/src/events/mutation/UnSelectNodeEvent.ts +9 -0
- package/src/events/mutation/UpdateChildrenEvent.ts +9 -0
- package/src/events/mutation/UpdateNodePropsEvent.ts +9 -0
- package/src/events/mutation/UserSelectNodeEvent.ts +9 -0
- package/src/events/mutation/WrapNodeEvent.ts +9 -0
- package/src/events/mutation/index.ts +16 -0
- package/src/events/viewport/AbstractViewportEvent.ts +30 -0
- package/src/events/viewport/ViewportResizeEvent.ts +9 -0
- package/src/events/viewport/ViewportScrollEvent.ts +9 -0
- package/src/events/viewport/index.ts +2 -0
- package/src/events/workbench/AbstractWorkspaceEvent.ts +10 -0
- package/src/events/workbench/AddWorkspaceEvent.ts +8 -0
- package/src/events/workbench/RemoveWorkspaceEvent.ts +9 -0
- package/src/events/workbench/SwitchWorkspaceEvent.ts +9 -0
- package/src/events/workbench/index.ts +3 -0
- package/src/exports.ts +5 -0
- package/src/externals.ts +87 -0
- package/src/index.ts +15 -0
- package/src/internals.ts +37 -0
- package/src/models/Cursor.ts +198 -0
- package/src/models/Engine.ts +108 -0
- package/src/models/History.ts +125 -0
- package/src/models/Hover.ts +49 -0
- package/src/models/Keyboard.ts +126 -0
- package/src/models/MoveHelper.ts +383 -0
- package/src/models/Operation.ts +91 -0
- package/src/models/Screen.ts +83 -0
- package/src/models/Selection.ts +177 -0
- package/src/models/Shortcut.ts +81 -0
- package/src/models/SnapLine.ts +129 -0
- package/src/models/SpaceBlock.ts +199 -0
- package/src/models/TransformHelper.ts +648 -0
- package/src/models/TreeNode.ts +894 -0
- package/src/models/Viewport.ts +516 -0
- package/src/models/Workbench.ts +120 -0
- package/src/models/Workspace.ts +142 -0
- package/src/models/index.ts +13 -0
- package/src/presets.ts +73 -0
- package/src/registry.ts +147 -0
- package/src/shortcuts/CursorSwitch.ts +11 -0
- package/src/shortcuts/MultiSelection.ts +31 -0
- package/src/shortcuts/NodeMutation.ts +49 -0
- package/src/shortcuts/QuickSelection.ts +81 -0
- package/src/shortcuts/UndoRedo.ts +29 -0
- package/src/shortcuts/index.ts +5 -0
- package/src/types.ts +185 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +5 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Engine } from './Engine'
|
|
2
|
+
import { Viewport } from './Viewport'
|
|
3
|
+
import { Operation, IOperation } from './Operation'
|
|
4
|
+
import { History } from './History'
|
|
5
|
+
import { uid, ICustomEvent, EventContainer } from '@sulesky/next-shared'
|
|
6
|
+
import {
|
|
7
|
+
HistoryGotoEvent,
|
|
8
|
+
HistoryRedoEvent,
|
|
9
|
+
HistoryUndoEvent,
|
|
10
|
+
HistoryPushEvent,
|
|
11
|
+
} from '../events'
|
|
12
|
+
import { IEngineContext } from '../types'
|
|
13
|
+
export interface IViewportMatcher {
|
|
14
|
+
contentWindow?: Window
|
|
15
|
+
viewportElement?: HTMLElement
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface IWorkspace {
|
|
19
|
+
id?: string
|
|
20
|
+
title?: string
|
|
21
|
+
description?: string
|
|
22
|
+
operation: IOperation
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface IWorkspaceProps {
|
|
26
|
+
id?: string
|
|
27
|
+
title?: string
|
|
28
|
+
description?: string
|
|
29
|
+
contentWindow?: Window
|
|
30
|
+
viewportElement?: HTMLElement
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//工作区模型
|
|
34
|
+
export class Workspace {
|
|
35
|
+
id: string
|
|
36
|
+
|
|
37
|
+
title: string
|
|
38
|
+
|
|
39
|
+
description: string
|
|
40
|
+
|
|
41
|
+
engine: Engine
|
|
42
|
+
|
|
43
|
+
viewport: Viewport
|
|
44
|
+
|
|
45
|
+
outline: Viewport
|
|
46
|
+
|
|
47
|
+
operation: Operation
|
|
48
|
+
|
|
49
|
+
history: History<Workspace>
|
|
50
|
+
|
|
51
|
+
props: IWorkspaceProps
|
|
52
|
+
|
|
53
|
+
constructor(engine: Engine, props: IWorkspaceProps) {
|
|
54
|
+
this.engine = engine
|
|
55
|
+
this.props = props
|
|
56
|
+
this.id = props.id || uid()
|
|
57
|
+
this.title = props.title
|
|
58
|
+
this.description = props.description
|
|
59
|
+
this.viewport = new Viewport({
|
|
60
|
+
engine: this.engine,
|
|
61
|
+
workspace: this,
|
|
62
|
+
viewportElement: props.viewportElement,
|
|
63
|
+
contentWindow: props.contentWindow,
|
|
64
|
+
nodeIdAttrName: this.engine.props.nodeIdAttrName,
|
|
65
|
+
moveSensitive: true,
|
|
66
|
+
moveInsertionType: 'all',
|
|
67
|
+
})
|
|
68
|
+
this.outline = new Viewport({
|
|
69
|
+
engine: this.engine,
|
|
70
|
+
workspace: this,
|
|
71
|
+
viewportElement: props.viewportElement,
|
|
72
|
+
contentWindow: props.contentWindow,
|
|
73
|
+
nodeIdAttrName: this.engine.props.outlineNodeIdAttrName,
|
|
74
|
+
moveSensitive: false,
|
|
75
|
+
moveInsertionType: 'block',
|
|
76
|
+
})
|
|
77
|
+
this.operation = new Operation(this)
|
|
78
|
+
this.history = new History(this, {
|
|
79
|
+
onPush: (item) => {
|
|
80
|
+
this.operation.dispatch(new HistoryPushEvent(item))
|
|
81
|
+
},
|
|
82
|
+
onRedo: (item) => {
|
|
83
|
+
this.operation.hover.clear()
|
|
84
|
+
this.operation.dispatch(new HistoryRedoEvent(item))
|
|
85
|
+
},
|
|
86
|
+
onUndo: (item) => {
|
|
87
|
+
this.operation.hover.clear()
|
|
88
|
+
this.operation.dispatch(new HistoryUndoEvent(item))
|
|
89
|
+
},
|
|
90
|
+
onGoto: (item) => {
|
|
91
|
+
this.operation.hover.clear()
|
|
92
|
+
this.operation.dispatch(new HistoryGotoEvent(item))
|
|
93
|
+
},
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
getEventContext(): IEngineContext {
|
|
98
|
+
return {
|
|
99
|
+
workbench: this.engine.workbench,
|
|
100
|
+
workspace: this,
|
|
101
|
+
engine: this.engine,
|
|
102
|
+
viewport: this.viewport,
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
attachEvents(container: EventContainer, contentWindow: Window) {
|
|
107
|
+
this.engine.attachEvents(container, contentWindow, this.getEventContext())
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
detachEvents(container: EventContainer) {
|
|
111
|
+
this.engine.detachEvents(container)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
dispatch(event: ICustomEvent) {
|
|
115
|
+
return this.engine.dispatch(event, this.getEventContext())
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
serialize(): IWorkspace {
|
|
119
|
+
return {
|
|
120
|
+
id: this.id,
|
|
121
|
+
title: this.title,
|
|
122
|
+
description: this.description,
|
|
123
|
+
operation: this.operation.serialize(),
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
from(workspace?: IWorkspace) {
|
|
128
|
+
if (!workspace) return
|
|
129
|
+
if (workspace.operation) {
|
|
130
|
+
this.operation.from(workspace.operation)
|
|
131
|
+
}
|
|
132
|
+
if (workspace.id) {
|
|
133
|
+
this.id = workspace.id
|
|
134
|
+
}
|
|
135
|
+
if (workspace.title) {
|
|
136
|
+
this.title = workspace.title
|
|
137
|
+
}
|
|
138
|
+
if (workspace.description) {
|
|
139
|
+
this.description = workspace.description
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './Engine'
|
|
2
|
+
export * from './Screen'
|
|
3
|
+
export * from './Cursor'
|
|
4
|
+
export * from './Operation'
|
|
5
|
+
export * from './Viewport'
|
|
6
|
+
export * from './TreeNode'
|
|
7
|
+
export * from './Workbench'
|
|
8
|
+
export * from './Workspace'
|
|
9
|
+
export * from './Selection'
|
|
10
|
+
export * from './MoveHelper'
|
|
11
|
+
export * from './Keyboard'
|
|
12
|
+
export * from './Shortcut'
|
|
13
|
+
export * from './History'
|
package/src/presets.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DragDropDriver,
|
|
3
|
+
MouseClickDriver,
|
|
4
|
+
MouseMoveDriver,
|
|
5
|
+
ViewportResizeDriver,
|
|
6
|
+
ViewportScrollDriver,
|
|
7
|
+
KeyboardDriver,
|
|
8
|
+
} from './drivers'
|
|
9
|
+
import {
|
|
10
|
+
useCursorEffect,
|
|
11
|
+
useViewportEffect,
|
|
12
|
+
useDragDropEffect,
|
|
13
|
+
useSelectionEffect,
|
|
14
|
+
useResizeEffect,
|
|
15
|
+
useKeyboardEffect,
|
|
16
|
+
useAutoScrollEffect,
|
|
17
|
+
useWorkspaceEffect,
|
|
18
|
+
useFreeSelectionEffect,
|
|
19
|
+
useContentEditableEffect,
|
|
20
|
+
useTranslateEffect,
|
|
21
|
+
} from './effects'
|
|
22
|
+
import {
|
|
23
|
+
SelectNodes,
|
|
24
|
+
SelectAllNodes,
|
|
25
|
+
SelectSameTypeNodes,
|
|
26
|
+
DeleteNodes,
|
|
27
|
+
CopyNodes,
|
|
28
|
+
PasteNodes,
|
|
29
|
+
UndoMutation,
|
|
30
|
+
RedoMutation,
|
|
31
|
+
CursorSwitchSelection,
|
|
32
|
+
PreventCommandX,
|
|
33
|
+
SelectPrevNode,
|
|
34
|
+
SelectNextNode,
|
|
35
|
+
} from './shortcuts'
|
|
36
|
+
|
|
37
|
+
export const DEFAULT_EFFECTS = [
|
|
38
|
+
useFreeSelectionEffect,
|
|
39
|
+
useCursorEffect,
|
|
40
|
+
useViewportEffect,
|
|
41
|
+
useDragDropEffect,
|
|
42
|
+
useSelectionEffect,
|
|
43
|
+
useKeyboardEffect,
|
|
44
|
+
useAutoScrollEffect,
|
|
45
|
+
useWorkspaceEffect,
|
|
46
|
+
useContentEditableEffect,
|
|
47
|
+
useTranslateEffect,
|
|
48
|
+
useResizeEffect,
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
export const DEFAULT_DRIVERS = [
|
|
52
|
+
MouseMoveDriver,
|
|
53
|
+
DragDropDriver,
|
|
54
|
+
MouseClickDriver,
|
|
55
|
+
ViewportResizeDriver,
|
|
56
|
+
ViewportScrollDriver,
|
|
57
|
+
KeyboardDriver,
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
export const DEFAULT_SHORTCUTS = [
|
|
61
|
+
PreventCommandX,
|
|
62
|
+
SelectNodes,
|
|
63
|
+
SelectAllNodes,
|
|
64
|
+
SelectSameTypeNodes,
|
|
65
|
+
DeleteNodes,
|
|
66
|
+
CopyNodes,
|
|
67
|
+
PasteNodes,
|
|
68
|
+
SelectPrevNode,
|
|
69
|
+
SelectNextNode,
|
|
70
|
+
UndoMutation,
|
|
71
|
+
RedoMutation,
|
|
72
|
+
CursorSwitchSelection,
|
|
73
|
+
]
|
package/src/registry.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { each } from '@sulesky/next-shared'
|
|
2
|
+
import { Path } from '@formily/path'
|
|
3
|
+
import { observable } from '@formily/reactive'
|
|
4
|
+
import {
|
|
5
|
+
IDesignerBehaviorStore,
|
|
6
|
+
IDesignerIconsStore,
|
|
7
|
+
IDesignerLocaleStore,
|
|
8
|
+
IDesignerLanguageStore,
|
|
9
|
+
IDesignerBehaviors,
|
|
10
|
+
IDesignerLocales,
|
|
11
|
+
IDesignerIcons,
|
|
12
|
+
IBehaviorLike,
|
|
13
|
+
IBehavior,
|
|
14
|
+
} from './types'
|
|
15
|
+
import { mergeLocales, lowerSnake, getBrowserLanguage } from './internals'
|
|
16
|
+
import { isBehaviorHost } from './externals'
|
|
17
|
+
import { TreeNode } from './models'
|
|
18
|
+
import { isBehaviorList } from './externals'
|
|
19
|
+
|
|
20
|
+
const getISOCode = (language: string) => {
|
|
21
|
+
let isoCode = DESIGNER_LANGUAGE_STORE.value
|
|
22
|
+
let lang = lowerSnake(language)
|
|
23
|
+
if (DESIGNER_LOCALES_STORE.value[lang]) {
|
|
24
|
+
return lang
|
|
25
|
+
}
|
|
26
|
+
each(DESIGNER_LOCALES_STORE.value, (_, key: string) => {
|
|
27
|
+
if (key.indexOf(lang) > -1 || String(lang).indexOf(key) > -1) {
|
|
28
|
+
isoCode = key
|
|
29
|
+
return false
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
return isoCode
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const reSortBehaviors = (target: IBehavior[], sources: IDesignerBehaviors) => {
|
|
36
|
+
const findTargetBehavior = (behavior: IBehavior) => target.includes(behavior)
|
|
37
|
+
const findSourceBehavior = (name: string) => {
|
|
38
|
+
for (let key in sources) {
|
|
39
|
+
const { Behavior } = sources[key]
|
|
40
|
+
for (let i = 0; i < Behavior.length; i++) {
|
|
41
|
+
if (Behavior[i].name === name) return Behavior[i]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
each(sources, (item) => {
|
|
46
|
+
if (!item) return
|
|
47
|
+
if (!isBehaviorHost(item)) return
|
|
48
|
+
const { Behavior } = item
|
|
49
|
+
each(Behavior, (behavior) => {
|
|
50
|
+
if (findTargetBehavior(behavior)) return
|
|
51
|
+
const name = behavior.name
|
|
52
|
+
each(behavior.extends, (dep) => {
|
|
53
|
+
const behavior = findSourceBehavior(dep)
|
|
54
|
+
if (!behavior)
|
|
55
|
+
throw new Error(`No ${dep} behavior that ${name} depends on`)
|
|
56
|
+
if (!findTargetBehavior(behavior)) {
|
|
57
|
+
target.unshift(behavior)
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
target.push(behavior)
|
|
61
|
+
})
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const DESIGNER_BEHAVIORS_STORE: IDesignerBehaviorStore = observable.ref([])
|
|
66
|
+
|
|
67
|
+
const DESIGNER_ICONS_STORE: IDesignerIconsStore = observable.ref({})
|
|
68
|
+
|
|
69
|
+
const DESIGNER_LOCALES_STORE: IDesignerLocaleStore = observable.ref({})
|
|
70
|
+
|
|
71
|
+
const DESIGNER_LANGUAGE_STORE: IDesignerLanguageStore = observable.ref(
|
|
72
|
+
getBrowserLanguage()
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
const DESIGNER_GlobalRegistry = {
|
|
76
|
+
setDesignerLanguage: (lang: string) => {
|
|
77
|
+
DESIGNER_LANGUAGE_STORE.value = lang
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
setDesignerBehaviors: (behaviors: IBehaviorLike[]) => {
|
|
81
|
+
DESIGNER_BEHAVIORS_STORE.value = behaviors.reduce<IBehavior[]>(
|
|
82
|
+
(buf, behavior) => {
|
|
83
|
+
if (isBehaviorHost(behavior)) {
|
|
84
|
+
return buf.concat(behavior.Behavior)
|
|
85
|
+
} else if (isBehaviorList(behavior)) {
|
|
86
|
+
return buf.concat(behavior)
|
|
87
|
+
}
|
|
88
|
+
return buf
|
|
89
|
+
},
|
|
90
|
+
[]
|
|
91
|
+
)
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
getDesignerBehaviors: (node: TreeNode) => {
|
|
95
|
+
return DESIGNER_BEHAVIORS_STORE.value.filter((pattern) =>
|
|
96
|
+
pattern.selector(node)
|
|
97
|
+
)
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
getDesignerIcon: (name: string) => {
|
|
101
|
+
return DESIGNER_ICONS_STORE[name]
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
getDesignerLanguage: () => {
|
|
105
|
+
return getISOCode(DESIGNER_LANGUAGE_STORE.value)
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
getDesignerMessage: (token: string, locales?: IDesignerLocales) => {
|
|
109
|
+
const lang = getISOCode(DESIGNER_LANGUAGE_STORE.value)
|
|
110
|
+
const locale = locales ? locales[lang] : DESIGNER_LOCALES_STORE.value[lang]
|
|
111
|
+
if (!locale) {
|
|
112
|
+
for (let key in DESIGNER_LOCALES_STORE.value) {
|
|
113
|
+
const message = Path.getIn(
|
|
114
|
+
DESIGNER_LOCALES_STORE.value[key],
|
|
115
|
+
lowerSnake(token)
|
|
116
|
+
)
|
|
117
|
+
if (message) return message
|
|
118
|
+
}
|
|
119
|
+
return
|
|
120
|
+
}
|
|
121
|
+
return Path.getIn(locale, lowerSnake(token))
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
registerDesignerIcons: (map: IDesignerIcons) => {
|
|
125
|
+
Object.assign(DESIGNER_ICONS_STORE, map)
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
registerDesignerLocales: (...packages: IDesignerLocales[]) => {
|
|
129
|
+
packages.forEach((locales) => {
|
|
130
|
+
mergeLocales(DESIGNER_LOCALES_STORE.value, locales)
|
|
131
|
+
})
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
registerDesignerBehaviors: (...packages: IDesignerBehaviors[]) => {
|
|
135
|
+
const results: IBehavior[] = []
|
|
136
|
+
packages.forEach((sources) => {
|
|
137
|
+
reSortBehaviors(results, sources)
|
|
138
|
+
})
|
|
139
|
+
if (results.length) {
|
|
140
|
+
DESIGNER_BEHAVIORS_STORE.value = results
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export type IDesignerRegistry = typeof DESIGNER_GlobalRegistry
|
|
146
|
+
|
|
147
|
+
export const GlobalRegistry: IDesignerRegistry = DESIGNER_GlobalRegistry
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CursorType, KeyCode, Shortcut } from '../models'
|
|
2
|
+
|
|
3
|
+
export const CursorSwitchSelection = new Shortcut({
|
|
4
|
+
codes: [KeyCode.Shift, KeyCode.S],
|
|
5
|
+
handler(context) {
|
|
6
|
+
const engine = context?.engine
|
|
7
|
+
if (engine) {
|
|
8
|
+
engine.cursor.setType(CursorType.Selection)
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { KeyCode, Shortcut } from '../models'
|
|
2
|
+
|
|
3
|
+
export const SelectNodes = new Shortcut({
|
|
4
|
+
codes: [[KeyCode.Meta], [KeyCode.Control]],
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export const SelectSameTypeNodes = new Shortcut({
|
|
8
|
+
codes: [KeyCode.Shift],
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const PreventCommandX = new Shortcut({
|
|
12
|
+
codes: [
|
|
13
|
+
[KeyCode.Meta, KeyCode.X],
|
|
14
|
+
[KeyCode.Control, KeyCode.X],
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const SelectAllNodes = new Shortcut({
|
|
19
|
+
codes: [
|
|
20
|
+
[KeyCode.Meta, KeyCode.A],
|
|
21
|
+
[KeyCode.Control, KeyCode.A],
|
|
22
|
+
],
|
|
23
|
+
handler(context) {
|
|
24
|
+
const operation = context?.workspace.operation
|
|
25
|
+
if (operation) {
|
|
26
|
+
const tree = operation.tree
|
|
27
|
+
const selection = operation.selection
|
|
28
|
+
selection.batchSelect(tree.descendants)
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
})
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { KeyCode, Shortcut, TreeNode } from '../models'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 快捷删除,快捷复制粘贴
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const DeleteNodes = new Shortcut({
|
|
8
|
+
codes: [[KeyCode.Backspace], [KeyCode.Delete]],
|
|
9
|
+
handler(context) {
|
|
10
|
+
const operation = context?.workspace.operation
|
|
11
|
+
if (operation) {
|
|
12
|
+
TreeNode.remove(operation.selection.selectedNodes)
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
interface IClipboard {
|
|
18
|
+
nodes: TreeNode[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const Clipboard: IClipboard = {
|
|
22
|
+
nodes: [],
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const CopyNodes = new Shortcut({
|
|
26
|
+
codes: [
|
|
27
|
+
[KeyCode.Meta, KeyCode.C],
|
|
28
|
+
[KeyCode.Control, KeyCode.C],
|
|
29
|
+
],
|
|
30
|
+
handler(context) {
|
|
31
|
+
const operation = context?.workspace.operation
|
|
32
|
+
if (operation) {
|
|
33
|
+
Clipboard.nodes = operation.selection.selectedNodes
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
export const PasteNodes = new Shortcut({
|
|
39
|
+
codes: [
|
|
40
|
+
[KeyCode.Meta, KeyCode.V],
|
|
41
|
+
[KeyCode.Control, KeyCode.V],
|
|
42
|
+
],
|
|
43
|
+
handler(context) {
|
|
44
|
+
const operation = context?.workspace.operation
|
|
45
|
+
if (operation) {
|
|
46
|
+
TreeNode.clone(Clipboard.nodes)
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
})
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { KeyCode, Shortcut, TreeNode } from '../models'
|
|
2
|
+
|
|
3
|
+
const findBottomLastChild = (node: TreeNode) => {
|
|
4
|
+
if (!node) return node
|
|
5
|
+
if (node.lastChild) {
|
|
6
|
+
return findBottomLastChild(node.lastChild)
|
|
7
|
+
}
|
|
8
|
+
return node
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const findTopParentNext = (node: TreeNode) => {
|
|
12
|
+
if (!node.parent) return node
|
|
13
|
+
if (node.parent?.next) return node.parent.next
|
|
14
|
+
return findTopParentNext(node.parent)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const SelectPrevNode = new Shortcut({
|
|
18
|
+
codes: [
|
|
19
|
+
[KeyCode.Up],
|
|
20
|
+
[KeyCode.PageUp],
|
|
21
|
+
[KeyCode.ArrowUp],
|
|
22
|
+
[KeyCode.Left],
|
|
23
|
+
[KeyCode.LeftWindowKey],
|
|
24
|
+
[KeyCode.ArrowLeft],
|
|
25
|
+
],
|
|
26
|
+
handler(context) {
|
|
27
|
+
const operation = context?.workspace.operation
|
|
28
|
+
if (operation) {
|
|
29
|
+
const tree = operation.tree
|
|
30
|
+
const selection = operation.selection
|
|
31
|
+
const selectedNode = tree.findById(selection.last)
|
|
32
|
+
if (selectedNode) {
|
|
33
|
+
const previousNode = selectedNode.previous
|
|
34
|
+
if (previousNode) {
|
|
35
|
+
const bottom = findBottomLastChild(previousNode)
|
|
36
|
+
if (bottom) {
|
|
37
|
+
selection.select(bottom)
|
|
38
|
+
} else {
|
|
39
|
+
selection.select(previousNode)
|
|
40
|
+
}
|
|
41
|
+
} else if (selectedNode.parent) {
|
|
42
|
+
selection.select(selectedNode.parent)
|
|
43
|
+
} else {
|
|
44
|
+
const bottom = findBottomLastChild(selectedNode.lastChild)
|
|
45
|
+
if (bottom) {
|
|
46
|
+
selection.select(bottom)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
export const SelectNextNode = new Shortcut({
|
|
55
|
+
codes: [
|
|
56
|
+
[KeyCode.Down],
|
|
57
|
+
[KeyCode.PageDown],
|
|
58
|
+
[KeyCode.ArrowDown],
|
|
59
|
+
[KeyCode.Right],
|
|
60
|
+
[KeyCode.RightWindowKey],
|
|
61
|
+
[KeyCode.ArrowRight],
|
|
62
|
+
],
|
|
63
|
+
handler(context) {
|
|
64
|
+
const operation = context?.workspace.operation
|
|
65
|
+
if (operation) {
|
|
66
|
+
const tree = operation.tree
|
|
67
|
+
const selection = operation.selection
|
|
68
|
+
const selectedNode = tree.findById(selection.last)
|
|
69
|
+
if (selectedNode) {
|
|
70
|
+
const nextNode = selectedNode.firstChild
|
|
71
|
+
? selectedNode.firstChild
|
|
72
|
+
: selectedNode.next
|
|
73
|
+
if (nextNode) {
|
|
74
|
+
selection.select(nextNode)
|
|
75
|
+
} else {
|
|
76
|
+
selection.select(findTopParentNext(selectedNode))
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { KeyCode, Shortcut } from '../models'
|
|
2
|
+
|
|
3
|
+
export const UndoMutation = new Shortcut({
|
|
4
|
+
codes: [
|
|
5
|
+
[KeyCode.Meta, KeyCode.Z],
|
|
6
|
+
[KeyCode.Control, KeyCode.Z],
|
|
7
|
+
],
|
|
8
|
+
handler(context) {
|
|
9
|
+
const workspace = context?.workspace
|
|
10
|
+
if (workspace) {
|
|
11
|
+
workspace.history.undo()
|
|
12
|
+
}
|
|
13
|
+
workspace.operation.hover.clear()
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const RedoMutation = new Shortcut({
|
|
18
|
+
codes: [
|
|
19
|
+
[KeyCode.Meta, KeyCode.Shift, KeyCode.Z],
|
|
20
|
+
[KeyCode.Control, KeyCode.Shift, KeyCode.Z],
|
|
21
|
+
],
|
|
22
|
+
handler(context) {
|
|
23
|
+
const workspace = context?.workspace
|
|
24
|
+
if (workspace) {
|
|
25
|
+
workspace.history.redo()
|
|
26
|
+
}
|
|
27
|
+
workspace.operation.hover.clear()
|
|
28
|
+
},
|
|
29
|
+
})
|