@asyra/core 0.2.0
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/.turbo/turbo-test$colon$ci.log +132 -0
- package/.turbo/turbo-test$colon$local.log +30 -0
- package/.turbo/turbo-test.log +0 -0
- package/README.md +1 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +991 -0
- package/coverage/coverage-final.json +14952 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +236 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/src/apis/element-selection.ts.html +133 -0
- package/coverage/src/apis/index.html +266 -0
- package/coverage/src/apis/index.ts.html +175 -0
- package/coverage/src/apis/input-system.ts.html +121 -0
- package/coverage/src/apis/interaction-core.ts.html +190 -0
- package/coverage/src/apis/props.ts.html +124 -0
- package/coverage/src/apis/render.ts.html +130 -0
- package/coverage/src/apis/scene-tree.ts.html +292 -0
- package/coverage/src/apis/system-context.ts.html +154 -0
- package/coverage/src/apis/transaction.ts.html +124 -0
- package/coverage/src/apis/undo.ts.html +124 -0
- package/coverage/src/apis/viewport.ts.html +193 -0
- package/coverage/src/combinations.ts.html +223 -0
- package/coverage/src/core.ts.html +559 -0
- package/coverage/src/index.html +146 -0
- package/coverage/src/index.ts.html +97 -0
- package/coverage/src/requests/factory.ts.html +127 -0
- package/coverage/src/requests/index.html +206 -0
- package/coverage/src/requests/index.ts.html +154 -0
- package/coverage/src/requests/props.ts.html +133 -0
- package/coverage/src/requests/render.ts.html +187 -0
- package/coverage/src/requests/scene-tree.ts.html +163 -0
- package/coverage/src/requests/selection.ts.html +127 -0
- package/coverage/src/requests/system-context.ts.html +130 -0
- package/coverage/src/subscribes/index.html +116 -0
- package/coverage/src/subscribes/index.ts.html +109 -0
- package/coverage/src/subscribes/input-system/index.html +176 -0
- package/coverage/src/subscribes/input-system/index.ts.html +226 -0
- package/coverage/src/subscribes/input-system/primary-tool.ts.html +160 -0
- package/coverage/src/subscribes/input-system/render.ts.html +484 -0
- package/coverage/src/subscribes/input-system/undo.ts.html +172 -0
- package/coverage/src/subscribes/input-system/viewport.ts.html +259 -0
- package/coverage/src/subscribes/interaction-core/create-element.ts.html +151 -0
- package/coverage/src/subscribes/interaction-core/index.html +236 -0
- package/coverage/src/subscribes/interaction-core/index.ts.html +289 -0
- package/coverage/src/subscribes/interaction-core/primary-tool.ts.html +109 -0
- package/coverage/src/subscribes/interaction-core/reset-element-size.ts.html +127 -0
- package/coverage/src/subscribes/interaction-core/resize-element.ts.html +181 -0
- package/coverage/src/subscribes/interaction-core/select-elements.ts.html +109 -0
- package/coverage/src/subscribes/interaction-core/transaction.ts.html +130 -0
- package/coverage/src/subscribes/interaction-core/undoredo.ts.html +133 -0
- package/coverage/src/subscribes/interaction-core/viewport.ts.html +193 -0
- package/coverage/src/types/deps.ts.html +118 -0
- package/coverage/src/types/element-selection.ts.html +100 -0
- package/coverage/src/types/index.html +266 -0
- package/coverage/src/types/index.ts.html +385 -0
- package/coverage/src/types/input-system.ts.html +100 -0
- package/coverage/src/types/interaction-core.ts.html +127 -0
- package/coverage/src/types/props.ts.html +109 -0
- package/coverage/src/types/render.ts.html +106 -0
- package/coverage/src/types/requests/factory.ts.html +127 -0
- package/coverage/src/types/requests/index.html +206 -0
- package/coverage/src/types/requests/index.ts.html +214 -0
- package/coverage/src/types/requests/props.ts.html +133 -0
- package/coverage/src/types/requests/render.ts.html +139 -0
- package/coverage/src/types/requests/scene-tree.ts.html +133 -0
- package/coverage/src/types/requests/selection.ts.html +127 -0
- package/coverage/src/types/requests/system-context.ts.html +142 -0
- package/coverage/src/types/scene-tree.ts.html +178 -0
- package/coverage/src/types/system-context/index.html +161 -0
- package/coverage/src/types/system-context/index.ts.html +112 -0
- package/coverage/src/types/system-context/key-state.ts.html +106 -0
- package/coverage/src/types/system-context/mouse-state.ts.html +106 -0
- package/coverage/src/types/system-context/primary-tool.ts.html +112 -0
- package/coverage/src/types/transaction.ts.html +103 -0
- package/coverage/src/types/undo.ts.html +103 -0
- package/coverage/src/types/viewport.ts.html +127 -0
- package/dist/__tests__/core.test.d.ts +2 -0
- package/dist/__tests__/core.test.d.ts.map +1 -0
- package/dist/__tests__/core.test.js +122 -0
- package/dist/__tests__/core.test.js.map +1 -0
- package/dist/apis/element-selection.d.ts +3 -0
- package/dist/apis/element-selection.d.ts.map +1 -0
- package/dist/apis/element-selection.js +11 -0
- package/dist/apis/element-selection.js.map +1 -0
- package/dist/apis/index.d.ts +3 -0
- package/dist/apis/index.d.ts.map +1 -0
- package/dist/apis/index.js +25 -0
- package/dist/apis/index.js.map +1 -0
- package/dist/apis/input-system.d.ts +3 -0
- package/dist/apis/input-system.d.ts.map +1 -0
- package/dist/apis/input-system.js +11 -0
- package/dist/apis/input-system.js.map +1 -0
- package/dist/apis/interaction-core.d.ts +3 -0
- package/dist/apis/interaction-core.d.ts.map +1 -0
- package/dist/apis/interaction-core.js +22 -0
- package/dist/apis/interaction-core.js.map +1 -0
- package/dist/apis/props.d.ts +3 -0
- package/dist/apis/props.d.ts.map +1 -0
- package/dist/apis/props.js +11 -0
- package/dist/apis/props.js.map +1 -0
- package/dist/apis/render.d.ts +3 -0
- package/dist/apis/render.d.ts.map +1 -0
- package/dist/apis/render.js +12 -0
- package/dist/apis/render.js.map +1 -0
- package/dist/apis/scene-tree.d.ts +3 -0
- package/dist/apis/scene-tree.d.ts.map +1 -0
- package/dist/apis/scene-tree.js +39 -0
- package/dist/apis/scene-tree.js.map +1 -0
- package/dist/apis/system-context.d.ts +3 -0
- package/dist/apis/system-context.d.ts.map +1 -0
- package/dist/apis/system-context.js +16 -0
- package/dist/apis/system-context.js.map +1 -0
- package/dist/apis/transaction.d.ts +3 -0
- package/dist/apis/transaction.d.ts.map +1 -0
- package/dist/apis/transaction.js +12 -0
- package/dist/apis/transaction.js.map +1 -0
- package/dist/apis/undo.d.ts +3 -0
- package/dist/apis/undo.d.ts.map +1 -0
- package/dist/apis/undo.js +12 -0
- package/dist/apis/undo.js.map +1 -0
- package/dist/apis/viewport.d.ts +4 -0
- package/dist/apis/viewport.d.ts.map +1 -0
- package/dist/apis/viewport.js +27 -0
- package/dist/apis/viewport.js.map +1 -0
- package/dist/combinations.d.ts +4 -0
- package/dist/combinations.d.ts.map +1 -0
- package/dist/combinations.js +42 -0
- package/dist/combinations.js.map +1 -0
- package/dist/core.d.ts +68 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +76 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/requests/factory copy.d.ts +7 -0
- package/dist/requests/factory copy.d.ts.map +1 -0
- package/dist/requests/factory copy.js +10 -0
- package/dist/requests/factory copy.js.map +1 -0
- package/dist/requests/factory.d.ts +7 -0
- package/dist/requests/factory.d.ts.map +1 -0
- package/dist/requests/factory.js +10 -0
- package/dist/requests/factory.js.map +1 -0
- package/dist/requests/index.d.ts +3 -0
- package/dist/requests/index.d.ts.map +1 -0
- package/dist/requests/index.js +21 -0
- package/dist/requests/index.js.map +1 -0
- package/dist/requests/primary-tool.d.ts +7 -0
- package/dist/requests/primary-tool.d.ts.map +1 -0
- package/dist/requests/primary-tool.js +13 -0
- package/dist/requests/primary-tool.js.map +1 -0
- package/dist/requests/props copy.d.ts +7 -0
- package/dist/requests/props copy.d.ts.map +1 -0
- package/dist/requests/props copy.js +13 -0
- package/dist/requests/props copy.js.map +1 -0
- package/dist/requests/props.d.ts +7 -0
- package/dist/requests/props.d.ts.map +1 -0
- package/dist/requests/props.js +13 -0
- package/dist/requests/props.js.map +1 -0
- package/dist/requests/render.d.ts +3 -0
- package/dist/requests/render.d.ts.map +1 -0
- package/dist/requests/render.js +22 -0
- package/dist/requests/render.js.map +1 -0
- package/dist/requests/scene-tree.d.ts +7 -0
- package/dist/requests/scene-tree.d.ts.map +1 -0
- package/dist/requests/scene-tree.js +17 -0
- package/dist/requests/scene-tree.js.map +1 -0
- package/dist/requests/selection.d.ts +7 -0
- package/dist/requests/selection.d.ts.map +1 -0
- package/dist/requests/selection.js +10 -0
- package/dist/requests/selection.js.map +1 -0
- package/dist/requests/system-context copy.d.ts +7 -0
- package/dist/requests/system-context copy.d.ts.map +1 -0
- package/dist/requests/system-context copy.js +19 -0
- package/dist/requests/system-context copy.js.map +1 -0
- package/dist/requests/system-context.d.ts +7 -0
- package/dist/requests/system-context.d.ts.map +1 -0
- package/dist/requests/system-context.js +10 -0
- package/dist/requests/system-context.js.map +1 -0
- package/dist/requests/types.d.ts +7 -0
- package/dist/requests/types.d.ts.map +1 -0
- package/dist/requests/types.js +4 -0
- package/dist/requests/types.js.map +1 -0
- package/dist/requests/viewport.d.ts +19 -0
- package/dist/requests/viewport.d.ts.map +1 -0
- package/dist/requests/viewport.js +6 -0
- package/dist/requests/viewport.js.map +1 -0
- package/dist/subscribes/index.d.ts +3 -0
- package/dist/subscribes/index.d.ts.map +1 -0
- package/dist/subscribes/index.js +7 -0
- package/dist/subscribes/index.js.map +1 -0
- package/dist/subscribes/input-system/index.d.ts +3 -0
- package/dist/subscribes/input-system/index.d.ts.map +1 -0
- package/dist/subscribes/input-system/index.js +26 -0
- package/dist/subscribes/input-system/index.js.map +1 -0
- package/dist/subscribes/input-system/primary-tool.d.ts +10 -0
- package/dist/subscribes/input-system/primary-tool.d.ts.map +1 -0
- package/dist/subscribes/input-system/primary-tool.js +15 -0
- package/dist/subscribes/input-system/primary-tool.js.map +1 -0
- package/dist/subscribes/input-system/render.d.ts +16 -0
- package/dist/subscribes/input-system/render.d.ts.map +1 -0
- package/dist/subscribes/input-system/render.js +97 -0
- package/dist/subscribes/input-system/render.js.map +1 -0
- package/dist/subscribes/input-system/undo.d.ts +10 -0
- package/dist/subscribes/input-system/undo.d.ts.map +1 -0
- package/dist/subscribes/input-system/undo.js +18 -0
- package/dist/subscribes/input-system/undo.js.map +1 -0
- package/dist/subscribes/input-system/viewport.d.ts +11 -0
- package/dist/subscribes/input-system/viewport.d.ts.map +1 -0
- package/dist/subscribes/input-system/viewport.js +36 -0
- package/dist/subscribes/input-system/viewport.js.map +1 -0
- package/dist/subscribes/interaction-core/create-and-resize.d.ts +5 -0
- package/dist/subscribes/interaction-core/create-and-resize.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/create-and-resize.js +86 -0
- package/dist/subscribes/interaction-core/create-and-resize.js.map +1 -0
- package/dist/subscribes/interaction-core/create-element copy.d.ts +3 -0
- package/dist/subscribes/interaction-core/create-element copy.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/create-element copy.js +17 -0
- package/dist/subscribes/interaction-core/create-element copy.js.map +1 -0
- package/dist/subscribes/interaction-core/create-element.d.ts +3 -0
- package/dist/subscribes/interaction-core/create-element.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/create-element.js +17 -0
- package/dist/subscribes/interaction-core/create-element.js.map +1 -0
- package/dist/subscribes/interaction-core/index.d.ts +3 -0
- package/dist/subscribes/interaction-core/index.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/index.js +42 -0
- package/dist/subscribes/interaction-core/index.js.map +1 -0
- package/dist/subscribes/interaction-core/input-to-decision.d.ts +5 -0
- package/dist/subscribes/interaction-core/input-to-decision.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/input-to-decision.js +48 -0
- package/dist/subscribes/interaction-core/input-to-decision.js.map +1 -0
- package/dist/subscribes/interaction-core/primary-tool.d.ts +3 -0
- package/dist/subscribes/interaction-core/primary-tool.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/primary-tool.js +7 -0
- package/dist/subscribes/interaction-core/primary-tool.js.map +1 -0
- package/dist/subscribes/interaction-core/reset-element-size.d.ts +5 -0
- package/dist/subscribes/interaction-core/reset-element-size.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/reset-element-size.js +9 -0
- package/dist/subscribes/interaction-core/reset-element-size.js.map +1 -0
- package/dist/subscribes/interaction-core/resize-element.d.ts +3 -0
- package/dist/subscribes/interaction-core/resize-element.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/resize-element.js +25 -0
- package/dist/subscribes/interaction-core/resize-element.js.map +1 -0
- package/dist/subscribes/interaction-core/select-elements.d.ts +3 -0
- package/dist/subscribes/interaction-core/select-elements.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/select-elements.js +7 -0
- package/dist/subscribes/interaction-core/select-elements.js.map +1 -0
- package/dist/subscribes/interaction-core/transaction.d.ts +3 -0
- package/dist/subscribes/interaction-core/transaction.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/transaction.js +10 -0
- package/dist/subscribes/interaction-core/transaction.js.map +1 -0
- package/dist/subscribes/interaction-core/undoredo.d.ts +3 -0
- package/dist/subscribes/interaction-core/undoredo.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/undoredo.js +15 -0
- package/dist/subscribes/interaction-core/undoredo.js.map +1 -0
- package/dist/subscribes/interaction-core/viewport.d.ts +3 -0
- package/dist/subscribes/interaction-core/viewport.d.ts.map +1 -0
- package/dist/subscribes/interaction-core/viewport.js +29 -0
- package/dist/subscribes/interaction-core/viewport.js.map +1 -0
- package/dist/subscribes/render.d.ts +6 -0
- package/dist/subscribes/render.d.ts.map +1 -0
- package/dist/subscribes/render.js +28 -0
- package/dist/subscribes/render.js.map +1 -0
- package/dist/types/deps.d.ts +11 -0
- package/dist/types/deps.d.ts.map +1 -0
- package/dist/types/deps.js +2 -0
- package/dist/types/deps.js.map +1 -0
- package/dist/types/element-selection.d.ts +5 -0
- package/dist/types/element-selection.d.ts.map +1 -0
- package/dist/types/element-selection.js +2 -0
- package/dist/types/element-selection.js.map +1 -0
- package/dist/types/index.d.ts +15 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/input-system.d.ts +5 -0
- package/dist/types/input-system.d.ts.map +1 -0
- package/dist/types/input-system.js +2 -0
- package/dist/types/input-system.js.map +1 -0
- package/dist/types/interaction-core.d.ts +11 -0
- package/dist/types/interaction-core.d.ts.map +1 -0
- package/dist/types/interaction-core.js +2 -0
- package/dist/types/interaction-core.js.map +1 -0
- package/dist/types/props.d.ts +7 -0
- package/dist/types/props.d.ts.map +1 -0
- package/dist/types/props.js +2 -0
- package/dist/types/props.js.map +1 -0
- package/dist/types/render.d.ts +6 -0
- package/dist/types/render.d.ts.map +1 -0
- package/dist/types/render.js +2 -0
- package/dist/types/render.js.map +1 -0
- package/dist/types/requests/factory copy.d.ts +12 -0
- package/dist/types/requests/factory copy.d.ts.map +1 -0
- package/dist/types/requests/factory copy.js +2 -0
- package/dist/types/requests/factory copy.js.map +1 -0
- package/dist/types/requests/factory.d.ts +12 -0
- package/dist/types/requests/factory.d.ts.map +1 -0
- package/dist/types/requests/factory.js +2 -0
- package/dist/types/requests/factory.js.map +1 -0
- package/dist/types/requests/index.d.ts +17 -0
- package/dist/types/requests/index.d.ts.map +1 -0
- package/dist/types/requests/index.js +4 -0
- package/dist/types/requests/index.js.map +1 -0
- package/dist/types/requests/primary-tool.d.ts +13 -0
- package/dist/types/requests/primary-tool.d.ts.map +1 -0
- package/dist/types/requests/primary-tool.js +2 -0
- package/dist/types/requests/primary-tool.js.map +1 -0
- package/dist/types/requests/props copy.d.ts +14 -0
- package/dist/types/requests/props copy.d.ts.map +1 -0
- package/dist/types/requests/props copy.js +2 -0
- package/dist/types/requests/props copy.js.map +1 -0
- package/dist/types/requests/props.d.ts +14 -0
- package/dist/types/requests/props.d.ts.map +1 -0
- package/dist/types/requests/props.js +2 -0
- package/dist/types/requests/props.js.map +1 -0
- package/dist/types/requests/render.d.ts +15 -0
- package/dist/types/requests/render.d.ts.map +1 -0
- package/dist/types/requests/render.js +2 -0
- package/dist/types/requests/render.js.map +1 -0
- package/dist/types/requests/scene-tree.d.ts +14 -0
- package/dist/types/requests/scene-tree.d.ts.map +1 -0
- package/dist/types/requests/scene-tree.js +2 -0
- package/dist/types/requests/scene-tree.js.map +1 -0
- package/dist/types/requests/selection.d.ts +12 -0
- package/dist/types/requests/selection.d.ts.map +1 -0
- package/dist/types/requests/selection.js +2 -0
- package/dist/types/requests/selection.js.map +1 -0
- package/dist/types/requests/system-context.d.ts +17 -0
- package/dist/types/requests/system-context.d.ts.map +1 -0
- package/dist/types/requests/system-context.js +2 -0
- package/dist/types/requests/system-context.js.map +1 -0
- package/dist/types/requests/system.d.ts +13 -0
- package/dist/types/requests/system.d.ts.map +1 -0
- package/dist/types/requests/system.js +2 -0
- package/dist/types/requests/system.js.map +1 -0
- package/dist/types/requests/viewport.d.ts +20 -0
- package/dist/types/requests/viewport.d.ts.map +1 -0
- package/dist/types/requests/viewport.js +6 -0
- package/dist/types/requests/viewport.js.map +1 -0
- package/dist/types/requests.d.ts +8 -0
- package/dist/types/requests.d.ts.map +1 -0
- package/dist/types/requests.js +2 -0
- package/dist/types/requests.js.map +1 -0
- package/dist/types/scene-tree.d.ts +15 -0
- package/dist/types/scene-tree.d.ts.map +1 -0
- package/dist/types/scene-tree.js +2 -0
- package/dist/types/scene-tree.js.map +1 -0
- package/dist/types/system-context/index.d.ts +8 -0
- package/dist/types/system-context/index.d.ts.map +1 -0
- package/dist/types/system-context/index.js +4 -0
- package/dist/types/system-context/index.js.map +1 -0
- package/dist/types/system-context/key-state.d.ts +6 -0
- package/dist/types/system-context/key-state.d.ts.map +1 -0
- package/dist/types/system-context/key-state.js +2 -0
- package/dist/types/system-context/key-state.js.map +1 -0
- package/dist/types/system-context/mouse-state.d.ts +6 -0
- package/dist/types/system-context/mouse-state.d.ts.map +1 -0
- package/dist/types/system-context/mouse-state.js +2 -0
- package/dist/types/system-context/mouse-state.js.map +1 -0
- package/dist/types/system-context/primary-tool.d.ts +8 -0
- package/dist/types/system-context/primary-tool.d.ts.map +1 -0
- package/dist/types/system-context/primary-tool.js +2 -0
- package/dist/types/system-context/primary-tool.js.map +1 -0
- package/dist/types/transaction.d.ts +6 -0
- package/dist/types/transaction.d.ts.map +1 -0
- package/dist/types/transaction.js +2 -0
- package/dist/types/transaction.js.map +1 -0
- package/dist/types/undo.d.ts +6 -0
- package/dist/types/undo.d.ts.map +1 -0
- package/dist/types/undo.js +2 -0
- package/dist/types/undo.js.map +1 -0
- package/dist/types/viewport.d.ts +12 -0
- package/dist/types/viewport.d.ts.map +1 -0
- package/dist/types/viewport.js +2 -0
- package/dist/types/viewport.js.map +1 -0
- package/package.json +37 -0
- package/src/__tests__/core.test.ts +153 -0
- package/src/apis/element-selection.ts +16 -0
- package/src/apis/index.ts +30 -0
- package/src/apis/input-system.ts +12 -0
- package/src/apis/interaction-core.ts +35 -0
- package/src/apis/props.ts +13 -0
- package/src/apis/render.ts +15 -0
- package/src/apis/scene-tree.ts +69 -0
- package/src/apis/system-context.ts +23 -0
- package/src/apis/transaction.ts +13 -0
- package/src/apis/undo.ts +13 -0
- package/src/apis/viewport.ts +36 -0
- package/src/combinations.ts +46 -0
- package/src/core.ts +158 -0
- package/src/index.ts +4 -0
- package/src/requests/factory.ts +14 -0
- package/src/requests/index.ts +23 -0
- package/src/requests/props.ts +16 -0
- package/src/requests/render.ts +34 -0
- package/src/requests/scene-tree.ts +26 -0
- package/src/requests/selection.ts +14 -0
- package/src/requests/system-context.ts +15 -0
- package/src/subscribes/index.ts +8 -0
- package/src/subscribes/input-system/index.ts +47 -0
- package/src/subscribes/input-system/primary-tool.ts +25 -0
- package/src/subscribes/input-system/render.ts +133 -0
- package/src/subscribes/input-system/undo.ts +29 -0
- package/src/subscribes/input-system/viewport.ts +58 -0
- package/src/subscribes/interaction-core/create-element.ts +22 -0
- package/src/subscribes/interaction-core/index.ts +68 -0
- package/src/subscribes/interaction-core/primary-tool.ts +8 -0
- package/src/subscribes/interaction-core/reset-element-size.ts +12 -0
- package/src/subscribes/interaction-core/resize-element.ts +31 -0
- package/src/subscribes/interaction-core/select-elements.ts +8 -0
- package/src/subscribes/interaction-core/transaction.ts +15 -0
- package/src/subscribes/interaction-core/undoredo.ts +16 -0
- package/src/subscribes/interaction-core/viewport.ts +35 -0
- package/src/types/deps.ts +11 -0
- package/src/types/element-selection.ts +5 -0
- package/src/types/index.ts +100 -0
- package/src/types/input-system.ts +5 -0
- package/src/types/interaction-core.ts +14 -0
- package/src/types/props.ts +8 -0
- package/src/types/render.ts +7 -0
- package/src/types/requests/factory.ts +14 -0
- package/src/types/requests/index.ts +43 -0
- package/src/types/requests/props.ts +16 -0
- package/src/types/requests/render.ts +18 -0
- package/src/types/requests/scene-tree.ts +16 -0
- package/src/types/requests/selection.ts +14 -0
- package/src/types/requests/system-context.ts +19 -0
- package/src/types/scene-tree.ts +31 -0
- package/src/types/system-context/index.ts +9 -0
- package/src/types/system-context/key-state.ts +7 -0
- package/src/types/system-context/mouse-state.ts +7 -0
- package/src/types/system-context/primary-tool.ts +9 -0
- package/src/types/transaction.ts +6 -0
- package/src/types/undo.ts +6 -0
- package/src/types/viewport.ts +14 -0
- package/test-setup.ts +6 -0
- package/tsconfig.json +22 -0
- package/vitest.config.ts +8 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
endTransaction,
|
|
3
|
+
selectElements,
|
|
4
|
+
startTransaction,
|
|
5
|
+
sceneTreeLoadComplete,
|
|
6
|
+
changeComputedData,
|
|
7
|
+
sceneTreeInit,
|
|
8
|
+
sceneTreeLoadData
|
|
9
|
+
} from '@asyra/reactive-events'
|
|
10
|
+
import {
|
|
11
|
+
SceneTreeRawData,
|
|
12
|
+
DataTypes,
|
|
13
|
+
PositionData,
|
|
14
|
+
DimensionData,
|
|
15
|
+
EVENT_OPTIONS,
|
|
16
|
+
CreateElementData
|
|
17
|
+
} from '@asyra/utils'
|
|
18
|
+
import {
|
|
19
|
+
SceneTreeAPIs,
|
|
20
|
+
SceneTreeRequests,
|
|
21
|
+
FactoryRequests,
|
|
22
|
+
SelectionRequests
|
|
23
|
+
} from '../types'
|
|
24
|
+
|
|
25
|
+
export const createSceneTreeAPIs = (
|
|
26
|
+
sceneTreeRequests: SceneTreeRequests,
|
|
27
|
+
factoryRequests: FactoryRequests,
|
|
28
|
+
selectionRequests: SelectionRequests
|
|
29
|
+
): SceneTreeAPIs => {
|
|
30
|
+
return {
|
|
31
|
+
sceneTreeInit() {
|
|
32
|
+
sceneTreeInit()
|
|
33
|
+
sceneTreeLoadComplete()
|
|
34
|
+
},
|
|
35
|
+
sceneTreeLoadData(data: SceneTreeRawData) {
|
|
36
|
+
sceneTreeLoadData(data)
|
|
37
|
+
sceneTreeLoadComplete()
|
|
38
|
+
},
|
|
39
|
+
sceneTreeSaveData() {
|
|
40
|
+
return sceneTreeRequests.sceneTreeSaveData()
|
|
41
|
+
},
|
|
42
|
+
addRectangle(data: CreateElementData) {
|
|
43
|
+
startTransaction()
|
|
44
|
+
const inUndoRedo = factoryRequests.isInUndoRedo()
|
|
45
|
+
const newElementId = sceneTreeRequests.addRectangle(data, inUndoRedo)
|
|
46
|
+
selectElements([newElementId])
|
|
47
|
+
endTransaction()
|
|
48
|
+
},
|
|
49
|
+
changeComputedData(key: string, data: DataTypes) {
|
|
50
|
+
startTransaction()
|
|
51
|
+
const elementIds = selectionRequests.getElementSelectionIds()
|
|
52
|
+
changeComputedData(elementIds, key, data)
|
|
53
|
+
endTransaction()
|
|
54
|
+
},
|
|
55
|
+
resizeElement(
|
|
56
|
+
pos: PositionData,
|
|
57
|
+
dimension: DimensionData,
|
|
58
|
+
options?: EVENT_OPTIONS
|
|
59
|
+
) {
|
|
60
|
+
startTransaction()
|
|
61
|
+
const elementIds = selectionRequests.getElementSelectionIds()
|
|
62
|
+
changeComputedData(elementIds, 'x', pos.x, options)
|
|
63
|
+
changeComputedData(elementIds, 'y', pos.y, options)
|
|
64
|
+
changeComputedData(elementIds, 'width', dimension.width, options)
|
|
65
|
+
changeComputedData(elementIds, 'height', dimension.height, options)
|
|
66
|
+
endTransaction()
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PrimaryToolType, MouseSnapshot, KeySnapshot } from '@asyra/utils'
|
|
2
|
+
import {
|
|
3
|
+
emitSwitchPrimaryTool,
|
|
4
|
+
switchPrimaryTool,
|
|
5
|
+
updateKeyState,
|
|
6
|
+
updateMouseState
|
|
7
|
+
} from '@asyra/reactive-events'
|
|
8
|
+
import { SystemContextAPIs } from '../types'
|
|
9
|
+
|
|
10
|
+
export const createSystemContextAPIs = (): SystemContextAPIs => {
|
|
11
|
+
return {
|
|
12
|
+
switchPrimaryTool(tool: PrimaryToolType) {
|
|
13
|
+
switchPrimaryTool(tool)
|
|
14
|
+
emitSwitchPrimaryTool()
|
|
15
|
+
},
|
|
16
|
+
updateMouseState(mouseSnapshot: MouseSnapshot) {
|
|
17
|
+
updateMouseState(mouseSnapshot)
|
|
18
|
+
},
|
|
19
|
+
updateKeyState(keySnapshot: KeySnapshot) {
|
|
20
|
+
updateKeyState(keySnapshot)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { endTransaction, startTransaction } from '@asyra/reactive-events'
|
|
2
|
+
import { TransactionActionAPIs } from '../types'
|
|
3
|
+
|
|
4
|
+
export const createTransactionAPIs = (): TransactionActionAPIs => {
|
|
5
|
+
return {
|
|
6
|
+
startTransaction() {
|
|
7
|
+
startTransaction()
|
|
8
|
+
},
|
|
9
|
+
endTransaction() {
|
|
10
|
+
endTransaction()
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/apis/undo.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
emitZoomFit,
|
|
3
|
+
panTo,
|
|
4
|
+
zoomFit,
|
|
5
|
+
zoomToCenter
|
|
6
|
+
} from '@asyra/reactive-events'
|
|
7
|
+
import { RenderRequests } from '../types'
|
|
8
|
+
import { ViewportAPIs } from '../types'
|
|
9
|
+
|
|
10
|
+
export const createViewportAPIs = (
|
|
11
|
+
renderRequests: RenderRequests
|
|
12
|
+
): ViewportAPIs => {
|
|
13
|
+
return {
|
|
14
|
+
getViewportPosition() {
|
|
15
|
+
return renderRequests.getViewportPosition()
|
|
16
|
+
},
|
|
17
|
+
getViewportScale() {
|
|
18
|
+
return renderRequests.getViewportScale()
|
|
19
|
+
},
|
|
20
|
+
zoomFit() {
|
|
21
|
+
const centerDiv = document.querySelector('#viewport-anchor')
|
|
22
|
+
const uiBounds = centerDiv?.getBoundingClientRect()
|
|
23
|
+
if (uiBounds) {
|
|
24
|
+
zoomFit(uiBounds)
|
|
25
|
+
emitZoomFit()
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
panTo(x: number, y: number) {
|
|
29
|
+
panTo(x, y)
|
|
30
|
+
},
|
|
31
|
+
zoomToCenter(scale: number, centerX: number, centerY: number) {
|
|
32
|
+
zoomToCenter(scale, centerX, centerY)
|
|
33
|
+
emitZoomFit()
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const combinations: Record<string, string[]> = {
|
|
2
|
+
UNDO: ['Meta', 'Z'],
|
|
3
|
+
REDO: ['Meta', 'Shift', 'Z'],
|
|
4
|
+
COPY: ['Meta', 'C'],
|
|
5
|
+
PASTE: ['Meta', 'V'],
|
|
6
|
+
CUT: ['Meta', 'X'],
|
|
7
|
+
SELECT_ALL: ['Meta', 'A'],
|
|
8
|
+
DELETE: ['Delete'],
|
|
9
|
+
CANCEL: ['Escape'],
|
|
10
|
+
SAVE: ['Meta', 'S'],
|
|
11
|
+
SAVE_AS: ['Meta', 'Shift', 'S'],
|
|
12
|
+
SWITCH_WINDOW: ['Alt', 'Tab'],
|
|
13
|
+
MULTI_SELECT: ['Meta', 'LeftMouseDown'],
|
|
14
|
+
RANGE_SELECT: ['Shift', 'LeftMouseDown'],
|
|
15
|
+
PRECISE_DRAG: ['Alt', 'LeftMouseDown'],
|
|
16
|
+
CONTEXT_MENU: ['Meta', 'RightMouseDown'],
|
|
17
|
+
MOVE_UP: ['ArrowUp'],
|
|
18
|
+
MOVE_DOWN: ['ArrowDown'],
|
|
19
|
+
MOVE_LEFT: ['ArrowLeft'],
|
|
20
|
+
MOVE_RIGHT: ['ArrowRight'],
|
|
21
|
+
MOVE_UP_FAST: ['Shift', 'ArrowUp'],
|
|
22
|
+
MOVE_DOWN_FAST: ['Shift', 'ArrowDown'],
|
|
23
|
+
MOVE_LEFT_FAST: ['Shift', 'ArrowLeft'],
|
|
24
|
+
MOVE_RIGHT_FAST: ['Shift', 'ArrowRight'],
|
|
25
|
+
ZOOM: ['Meta', 'Wheel'],
|
|
26
|
+
ZOOM_FIT: ['Meta', '1'],
|
|
27
|
+
PAN: ['Wheel'],
|
|
28
|
+
HOVER: ['LeftMouseMove'],
|
|
29
|
+
DRAG_START: ['LeftMouseDown'],
|
|
30
|
+
DRAG_UPDATE: ['LeftMouseDown', 'LeftMouseMove'],
|
|
31
|
+
DRAG_END: ['LeftMouseUp'],
|
|
32
|
+
RIGHT_CLICK: ['RightMouseUp'],
|
|
33
|
+
DOUBLE_CLICK: ['MouseDoubleClick'],
|
|
34
|
+
SWITCH_TO_SELECT_TOOL: ['V'],
|
|
35
|
+
SWITCH_TO_RECTANGLE_TOOL: ['R']
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const Events = Object.keys(combinations).reduce(
|
|
39
|
+
(acc, eventName) => {
|
|
40
|
+
acc[eventName] = eventName
|
|
41
|
+
return acc
|
|
42
|
+
},
|
|
43
|
+
{} as Record<string, string>
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
export default combinations
|
package/src/core.ts
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import type { PropsComponentRawData, SceneTreeRawData } from '@asyra/utils'
|
|
2
|
+
import factory, { Factory } from '@asyra/factory'
|
|
3
|
+
import inputSystem, { InputSystem } from '@asyra/input-system'
|
|
4
|
+
import sceneTree, { SceneTree } from '@asyra/scene-tree'
|
|
5
|
+
import render, { Render } from '@asyra/render'
|
|
6
|
+
import props, { PropsManager } from '@asyra/props-manager'
|
|
7
|
+
import selection, { SelectionManager } from '@asyra/selection'
|
|
8
|
+
import systemContext, { SystemContext } from '@asyra/system-context'
|
|
9
|
+
import interactionCore, { InteractionCore } from '@asyra/interaction-core'
|
|
10
|
+
|
|
11
|
+
import { initAllHandlers } from './subscribes'
|
|
12
|
+
import {
|
|
13
|
+
CoreAPIs,
|
|
14
|
+
InputSystemAPIs,
|
|
15
|
+
RenderAPIs,
|
|
16
|
+
ViewportAPIs,
|
|
17
|
+
UndoActionAPIs,
|
|
18
|
+
SceneTreeAPIs,
|
|
19
|
+
ElementSelectionAPIs,
|
|
20
|
+
PropsAPIs,
|
|
21
|
+
SystemContextAPIs,
|
|
22
|
+
InteractionCoreAPIs,
|
|
23
|
+
TransactionAPIs
|
|
24
|
+
} from './types'
|
|
25
|
+
import { createAPIs } from './apis'
|
|
26
|
+
import { createRequests } from './requests'
|
|
27
|
+
|
|
28
|
+
import combinations from './combinations'
|
|
29
|
+
inputSystem.setCombinations(combinations)
|
|
30
|
+
|
|
31
|
+
interface CoreRawData {
|
|
32
|
+
version: string
|
|
33
|
+
sceneTree: SceneTreeRawData
|
|
34
|
+
props: PropsComponentRawData
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface CoreDeps {
|
|
38
|
+
inputSystem: InputSystem
|
|
39
|
+
factory: Factory
|
|
40
|
+
props: PropsManager
|
|
41
|
+
render: Render
|
|
42
|
+
sceneTree: SceneTree
|
|
43
|
+
selection: SelectionManager
|
|
44
|
+
systemContext: SystemContext
|
|
45
|
+
interactionCore: InteractionCore
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const DEFAULT_VERSION = '1.0.0'
|
|
49
|
+
const DATA_VERSION = '1.0.0'
|
|
50
|
+
|
|
51
|
+
class Core implements CoreAPIs {
|
|
52
|
+
version: string = DEFAULT_VERSION
|
|
53
|
+
|
|
54
|
+
startTransaction!: TransactionAPIs['startTransaction']
|
|
55
|
+
endTransaction!: TransactionAPIs['endTransaction']
|
|
56
|
+
|
|
57
|
+
setupInputSystem!: InputSystemAPIs['setupInputSystem']
|
|
58
|
+
|
|
59
|
+
initRender!: RenderAPIs['initRender']
|
|
60
|
+
renderIsReady!: RenderAPIs['renderIsReady']
|
|
61
|
+
getViewportPosition!: ViewportAPIs['getViewportPosition']
|
|
62
|
+
getViewportScale!: ViewportAPIs['getViewportScale']
|
|
63
|
+
zoomFit!: ViewportAPIs['zoomFit']
|
|
64
|
+
panTo!: ViewportAPIs['panTo']
|
|
65
|
+
zoomToCenter!: ViewportAPIs['zoomToCenter']
|
|
66
|
+
|
|
67
|
+
undo!: UndoActionAPIs['undo']
|
|
68
|
+
redo!: UndoActionAPIs['redo']
|
|
69
|
+
|
|
70
|
+
sceneTreeInit!: SceneTreeAPIs['sceneTreeInit']
|
|
71
|
+
sceneTreeLoadData!: SceneTreeAPIs['sceneTreeLoadData']
|
|
72
|
+
sceneTreeSaveData!: SceneTreeAPIs['sceneTreeSaveData']
|
|
73
|
+
addRectangle!: SceneTreeAPIs['addRectangle']
|
|
74
|
+
changeComputedData!: SceneTreeAPIs['changeComputedData']
|
|
75
|
+
resizeElement!: SceneTreeAPIs['resizeElement']
|
|
76
|
+
selectElements!: ElementSelectionAPIs['selectElements']
|
|
77
|
+
|
|
78
|
+
propsLoadData!: PropsAPIs['propsLoadData']
|
|
79
|
+
propsSaveData!: PropsAPIs['propsSaveData']
|
|
80
|
+
|
|
81
|
+
switchPrimaryTool!: SystemContextAPIs['switchPrimaryTool']
|
|
82
|
+
updateMouseState!: SystemContextAPIs['updateMouseState']
|
|
83
|
+
updateKeyState!: SystemContextAPIs['updateKeyState']
|
|
84
|
+
|
|
85
|
+
executeAction!: InteractionCoreAPIs['executeAction']
|
|
86
|
+
startSession!: InteractionCoreAPIs['startSession']
|
|
87
|
+
updateSession!: InteractionCoreAPIs['updateSession']
|
|
88
|
+
endSession!: InteractionCoreAPIs['endSession']
|
|
89
|
+
|
|
90
|
+
constructor(private readonly deps: CoreDeps) {
|
|
91
|
+
const requests = createRequests({
|
|
92
|
+
systemContext: this.deps.systemContext,
|
|
93
|
+
props: this.deps.props,
|
|
94
|
+
sceneTree: this.deps.sceneTree,
|
|
95
|
+
factory: this.deps.factory,
|
|
96
|
+
render: this.deps.render,
|
|
97
|
+
selection: this.deps.selection
|
|
98
|
+
})
|
|
99
|
+
const apis = createAPIs(requests)
|
|
100
|
+
|
|
101
|
+
initAllHandlers(
|
|
102
|
+
{
|
|
103
|
+
inputSystem: this.deps.inputSystem,
|
|
104
|
+
render: this.deps.render,
|
|
105
|
+
factory: this.deps.factory,
|
|
106
|
+
interactionCore: this.deps.interactionCore
|
|
107
|
+
},
|
|
108
|
+
apis
|
|
109
|
+
)
|
|
110
|
+
Object.assign(this, apis as CoreAPIs)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
load(data: CoreRawData): void {
|
|
114
|
+
if (!data) {
|
|
115
|
+
return
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.version = data.version ?? DATA_VERSION
|
|
119
|
+
if (data.props) {
|
|
120
|
+
this.propsLoadData(data.props)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (data.sceneTree) {
|
|
124
|
+
this.sceneTreeLoadData(data.sceneTree)
|
|
125
|
+
} else {
|
|
126
|
+
this.sceneTreeInit()
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
this.zoomFit()
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async save() {
|
|
133
|
+
const propsData = await this.propsSaveData()
|
|
134
|
+
const sceneTreeData = await this.sceneTreeSaveData()
|
|
135
|
+
|
|
136
|
+
const data = {
|
|
137
|
+
version: this.version,
|
|
138
|
+
sceneTree: sceneTreeData,
|
|
139
|
+
props: propsData
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return data
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export { Core }
|
|
147
|
+
|
|
148
|
+
const core = new Core({
|
|
149
|
+
inputSystem,
|
|
150
|
+
factory,
|
|
151
|
+
props,
|
|
152
|
+
render,
|
|
153
|
+
sceneTree,
|
|
154
|
+
selection,
|
|
155
|
+
systemContext,
|
|
156
|
+
interactionCore
|
|
157
|
+
})
|
|
158
|
+
export default core
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FactoryRequestDeps, FactoryRequests } from '../types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Request API for Factory data
|
|
5
|
+
* Provides synchronous access to factory state with dependency injection
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const createFactoryRequests = (
|
|
9
|
+
deps: FactoryRequestDeps
|
|
10
|
+
): FactoryRequests => ({
|
|
11
|
+
isInUndoRedo: (): boolean => {
|
|
12
|
+
return deps.factory.isInUndoRedo()
|
|
13
|
+
}
|
|
14
|
+
})
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Request API Layer - Pure data access functions
|
|
2
|
+
// This layer provides synchronous access to system data without business logic
|
|
3
|
+
|
|
4
|
+
import { createSystemContextRequests } from './system-context'
|
|
5
|
+
import { createPropsRequests } from './props'
|
|
6
|
+
import { createSceneTreeRequests } from './scene-tree'
|
|
7
|
+
import { Requests, RequestsDeps } from '../types'
|
|
8
|
+
import { createFactoryRequests } from './factory'
|
|
9
|
+
import { createRenderRequests } from './render'
|
|
10
|
+
import { createSelectionRequests } from './selection'
|
|
11
|
+
|
|
12
|
+
export const createRequests = (deps: RequestsDeps): Requests => {
|
|
13
|
+
return {
|
|
14
|
+
systemContextRequests: createSystemContextRequests({
|
|
15
|
+
systemContext: deps.systemContext
|
|
16
|
+
}),
|
|
17
|
+
propsRequests: createPropsRequests({ props: deps.props }),
|
|
18
|
+
sceneTreeRequests: createSceneTreeRequests({ sceneTree: deps.sceneTree }),
|
|
19
|
+
factoryRequests: createFactoryRequests({ factory: deps.factory }),
|
|
20
|
+
renderRequests: createRenderRequests({ render: deps.render }),
|
|
21
|
+
selectionRequests: createSelectionRequests({ selection: deps.selection })
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropsComponentRawData } from '@asyra/utils'
|
|
2
|
+
import { PropsRequestDeps, PropsRequests } from '../types'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Request API for Props data
|
|
6
|
+
* Provides synchronous access to props state with dependency injection
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const createPropsRequests = (deps: PropsRequestDeps): PropsRequests => ({
|
|
10
|
+
propsLoadData: (data: PropsComponentRawData): void => {
|
|
11
|
+
deps.props.load(data)
|
|
12
|
+
},
|
|
13
|
+
propsSaveData: (): PropsComponentRawData => {
|
|
14
|
+
return deps.props.save()
|
|
15
|
+
}
|
|
16
|
+
})
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RenderRequestDeps, RenderRequests } from '../types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Request API for Render data
|
|
5
|
+
* Provides synchronous access to render state with dependency injection
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
let hasInitRender = false
|
|
9
|
+
|
|
10
|
+
export const createRenderRequests = (
|
|
11
|
+
deps: RenderRequestDeps
|
|
12
|
+
): RenderRequests => ({
|
|
13
|
+
initRender: async (
|
|
14
|
+
width: number,
|
|
15
|
+
height: number,
|
|
16
|
+
color: number
|
|
17
|
+
): // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
Promise<any> => {
|
|
19
|
+
if (hasInitRender) {
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const app = await deps.render.init(width, height, color)
|
|
24
|
+
hasInitRender = true
|
|
25
|
+
|
|
26
|
+
return app
|
|
27
|
+
},
|
|
28
|
+
getViewportPosition: () => {
|
|
29
|
+
return deps.render.getViewportPosition()
|
|
30
|
+
},
|
|
31
|
+
getViewportScale: () => {
|
|
32
|
+
return deps.render.getViewportScale()
|
|
33
|
+
}
|
|
34
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SceneTreeRawData, EntityTypes, CreateElementData } from '@asyra/utils'
|
|
2
|
+
import { SceneTreeRequestDeps, SceneTreeRequests } from '../types'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Request API for SceneTree data
|
|
6
|
+
* Provides synchronous access to scene-tree state with dependency injection
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const createSceneTreeRequests = (
|
|
10
|
+
deps: SceneTreeRequestDeps
|
|
11
|
+
): SceneTreeRequests => ({
|
|
12
|
+
sceneTreeSaveData: (): SceneTreeRawData => {
|
|
13
|
+
return deps.sceneTree.save()
|
|
14
|
+
},
|
|
15
|
+
addRectangle: (data: CreateElementData, inUndoRedo: boolean): string => {
|
|
16
|
+
return deps.sceneTree.addNewElement(
|
|
17
|
+
{
|
|
18
|
+
...data,
|
|
19
|
+
type: EntityTypes.RECTANGLE
|
|
20
|
+
},
|
|
21
|
+
undefined,
|
|
22
|
+
-1,
|
|
23
|
+
inUndoRedo
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SelectionRequestDeps, SelectionRequests } from '../types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Request API for Selection data
|
|
5
|
+
* Provides synchronous access to selection state with dependency injection
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const createSelectionRequests = (
|
|
9
|
+
deps: SelectionRequestDeps
|
|
10
|
+
): SelectionRequests => ({
|
|
11
|
+
getElementSelectionIds: (): string[] => {
|
|
12
|
+
return deps.selection.getElementSelectionIds()
|
|
13
|
+
}
|
|
14
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SystemContextSnapshot } from '@asyra/utils'
|
|
2
|
+
import { SystemContextRequestsDeps, SystemContextRequests } from '../types'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Request API for System Context data
|
|
6
|
+
* Provides synchronous access to system context state with dependency injection
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const createSystemContextRequests = (
|
|
10
|
+
deps: SystemContextRequestsDeps
|
|
11
|
+
): SystemContextRequests => ({
|
|
12
|
+
getSystemContextSnapshot: (): SystemContextSnapshot => {
|
|
13
|
+
return deps.systemContext.getSystemContextSnapshot()
|
|
14
|
+
}
|
|
15
|
+
})
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { initInputSystemHandlers } from './input-system'
|
|
2
|
+
import { initInteractionCoreHandlers } from './interaction-core'
|
|
3
|
+
import { CoreAPIs, HandlerDeps } from '../types'
|
|
4
|
+
|
|
5
|
+
export const initAllHandlers = (deps: HandlerDeps, apis: CoreAPIs) => {
|
|
6
|
+
initInputSystemHandlers(deps, apis)
|
|
7
|
+
initInteractionCoreHandlers(deps, apis)
|
|
8
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
KeySnapshot,
|
|
3
|
+
MouseSnapshot,
|
|
4
|
+
InputSystemEvents,
|
|
5
|
+
DetailType
|
|
6
|
+
} from '@asyra/utils'
|
|
7
|
+
import { UndoHandler } from './undo'
|
|
8
|
+
import { ViewportHandler } from './viewport'
|
|
9
|
+
import { RenderHandler } from './render'
|
|
10
|
+
import { PrimaryToolHandler } from './primary-tool'
|
|
11
|
+
import { CoreAPIs, HandlerDeps } from '../../types'
|
|
12
|
+
|
|
13
|
+
export const initInputSystemHandlers = (deps: HandlerDeps, apis: CoreAPIs) => {
|
|
14
|
+
new UndoHandler(deps.inputSystem, {
|
|
15
|
+
updateKeyState: (keySnapshot: KeySnapshot) =>
|
|
16
|
+
apis.updateKeyState(keySnapshot),
|
|
17
|
+
executeAction: (eventName: InputSystemEvents, detail?: DetailType) =>
|
|
18
|
+
apis.executeAction(eventName, detail)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
new ViewportHandler(deps.inputSystem, {
|
|
22
|
+
updateMouseState: (mouseSnapshot: MouseSnapshot) =>
|
|
23
|
+
apis.updateMouseState(mouseSnapshot),
|
|
24
|
+
updateKeyState: (keySnapshot: KeySnapshot) =>
|
|
25
|
+
apis.updateKeyState(keySnapshot),
|
|
26
|
+
executeAction: (eventName: InputSystemEvents, detail?: DetailType) =>
|
|
27
|
+
apis.executeAction(eventName, detail)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
new RenderHandler(deps.inputSystem, {
|
|
31
|
+
updateMouseState: (mouseSnapshot: MouseSnapshot) =>
|
|
32
|
+
apis.updateMouseState(mouseSnapshot),
|
|
33
|
+
updateKeyState: (keySnapshot: KeySnapshot) =>
|
|
34
|
+
apis.updateKeyState(keySnapshot),
|
|
35
|
+
startSession: (eventName: InputSystemEvents, detail?: DetailType) =>
|
|
36
|
+
apis.startSession(eventName, detail),
|
|
37
|
+
updateSession: (eventName: InputSystemEvents, detail?: DetailType) =>
|
|
38
|
+
apis.updateSession(eventName, detail),
|
|
39
|
+
endSession: (eventName: InputSystemEvents, detail?: DetailType) =>
|
|
40
|
+
apis.endSession(eventName, detail)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
new PrimaryToolHandler(deps.inputSystem, {
|
|
44
|
+
executeAction: (eventName: InputSystemEvents, detail?: DetailType) =>
|
|
45
|
+
apis.executeAction(eventName, detail)
|
|
46
|
+
})
|
|
47
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { InputSystemEvents, RawInputEvent } from '@asyra/utils'
|
|
2
|
+
import { HandlerDeps, InteractionCoreActionAPIs } from '../../types'
|
|
3
|
+
|
|
4
|
+
export class PrimaryToolHandler {
|
|
5
|
+
constructor(
|
|
6
|
+
private inputSystem: HandlerDeps['inputSystem'],
|
|
7
|
+
private deps: InteractionCoreActionAPIs
|
|
8
|
+
) {
|
|
9
|
+
this.init()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
init() {
|
|
13
|
+
this.inputSystem.on(
|
|
14
|
+
InputSystemEvents.INPUT_SHORTCUT_SWITCH_PRIMARY_TOOL,
|
|
15
|
+
this._handleSwitchPrimaryTool
|
|
16
|
+
)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
_handleSwitchPrimaryTool = (raw: RawInputEvent) => {
|
|
20
|
+
this.deps.executeAction(
|
|
21
|
+
InputSystemEvents.INPUT_SHORTCUT_SWITCH_PRIMARY_TOOL,
|
|
22
|
+
raw.detail
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
}
|