@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 @@
|
|
|
1
|
+
{"version":3,"file":"system-context.js","sourceRoot":"","sources":["../../../src/types/requests/system-context.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PrimaryToolManager } from '@asyra/primary-tool-manager';
|
|
2
|
+
import { PrimaryToolType } from '@asyra/utils';
|
|
3
|
+
/**
|
|
4
|
+
* Request API for PrimaryTool data
|
|
5
|
+
* Provides synchronous access to primary tool manager state
|
|
6
|
+
*/
|
|
7
|
+
export interface PrimaryToolRequests {
|
|
8
|
+
switchPrimaryTool: (toolType: PrimaryToolType) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface PrimaryToolRequestDeps {
|
|
11
|
+
primaryTool: PrimaryToolManager;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../../../src/types/requests/system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;;GAGG;AAEH,MAAM,WAAW,mBAAmB;IAClC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAA;CACvD;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,kBAAkB,CAAA;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../../../src/types/requests/system.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SystemContext } from '@asyra/system-context';
|
|
2
|
+
/**
|
|
3
|
+
* Dependencies for System Context Request APIs
|
|
4
|
+
* System context dependencies injected from outside
|
|
5
|
+
*/
|
|
6
|
+
export interface ViewportRequestsDeps {
|
|
7
|
+
systemContext: SystemContext;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Request API types for Viewport
|
|
11
|
+
* Type definitions for synchronous viewport data access
|
|
12
|
+
*/
|
|
13
|
+
export interface ViewportRequests {
|
|
14
|
+
getViewportPosition: () => {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
getViewportScale: () => number;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=viewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../../src/types/requests/viewport.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGpD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,aAAa,CAAA;CAC7B;AAED;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,mBAAmB,EAAE,MAAM;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACnD,gBAAgB,EAAE,MAAM,MAAM,CAAA;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.js","sourceRoot":"","sources":["../../../src/types/requests/viewport.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,6BAA6B;AAC7B,yBAAyB;AACzB,iCAAiC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SystemContextSnapshot, PrimaryToolType, MouseSnapshot, KeySnapshot } from '@asyra/utils';
|
|
2
|
+
export interface SystemContextRequest {
|
|
3
|
+
getSystemContextSnapshot: () => SystemContextSnapshot;
|
|
4
|
+
getCurrentPrimaryTool: () => PrimaryToolType;
|
|
5
|
+
getMouseState: () => MouseSnapshot;
|
|
6
|
+
getKeyState: () => KeySnapshot;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=requests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requests.d.ts","sourceRoot":"","sources":["../../src/types/requests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,WAAW,EACZ,MAAM,aAAa,CAAA;AAKpB,MAAM,WAAW,oBAAoB;IACnC,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;IACrD,qBAAqB,EAAE,MAAM,eAAe,CAAA;IAC5C,aAAa,EAAE,MAAM,aAAa,CAAA;IAClC,WAAW,EAAE,MAAM,WAAW,CAAA;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requests.js","sourceRoot":"","sources":["../../src/types/requests.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CreateElementData, DataTypes, DimensionData, EVENT_OPTIONS, PositionData, SceneTreeRawData } from '@asyra/utils';
|
|
2
|
+
export interface SceneTreeRawAPIs {
|
|
3
|
+
sceneTreeInit: () => void;
|
|
4
|
+
sceneTreeLoadData: (data: SceneTreeRawData) => void;
|
|
5
|
+
sceneTreeSaveData: () => SceneTreeRawData;
|
|
6
|
+
}
|
|
7
|
+
export interface SceneTreeActionAPIs {
|
|
8
|
+
changeComputedData: (key: string, data: DataTypes) => void;
|
|
9
|
+
resizeElement: (pos: PositionData, dimension: DimensionData, options?: EVENT_OPTIONS) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface SceneTreeHandlerAPIs {
|
|
12
|
+
addRectangle: (data: CreateElementData) => void;
|
|
13
|
+
}
|
|
14
|
+
export type SceneTreeAPIs = SceneTreeRawAPIs & SceneTreeActionAPIs & SceneTreeHandlerAPIs;
|
|
15
|
+
//# sourceMappingURL=scene-tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-tree.d.ts","sourceRoot":"","sources":["../../src/types/scene-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,aAAa,EACb,YAAY,EACZ,gBAAgB,EACjB,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,iBAAiB,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAA;IACnD,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;CAC1C;AAED,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IAC1D,aAAa,EAAE,CACb,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,aAAa,EACxB,OAAO,CAAC,EAAE,aAAa,KACpB,IAAI,CAAA;CACV;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI,CAAA;CAChD;AAED,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAC1C,mBAAmB,GACnB,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene-tree.js","sourceRoot":"","sources":["../../src/types/scene-tree.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PrimaryToolAPIs } from './primary-tool';
|
|
2
|
+
import { MouseStateAPIs } from './mouse-state';
|
|
3
|
+
import { KeyStateAPIs } from './key-state';
|
|
4
|
+
export * from './primary-tool';
|
|
5
|
+
export * from './mouse-state';
|
|
6
|
+
export * from './key-state';
|
|
7
|
+
export type SystemContextAPIs = PrimaryToolAPIs & MouseStateAPIs & KeyStateAPIs;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/system-context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE1C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAE3B,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG,cAAc,GAAG,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/system-context/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-state.d.ts","sourceRoot":"","sources":["../../../src/types/system-context/key-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,CAAA;CACnD;AAED,MAAM,MAAM,YAAY,GAAG,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-state.js","sourceRoot":"","sources":["../../../src/types/system-context/key-state.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouse-state.d.ts","sourceRoot":"","sources":["../../../src/types/system-context/mouse-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAE5C,MAAM,WAAW,oBAAoB;IACnC,gBAAgB,EAAE,CAAC,aAAa,EAAE,aAAa,KAAK,IAAI,CAAA;CACzD;AAED,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouse-state.js","sourceRoot":"","sources":["../../../src/types/system-context/mouse-state.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PrimaryToolType } from '@asyra/utils';
|
|
2
|
+
export interface PrimaryToolRawAPIs {
|
|
3
|
+
}
|
|
4
|
+
export interface PrimaryToolActionAPIs {
|
|
5
|
+
switchPrimaryTool: (tool: PrimaryToolType) => void;
|
|
6
|
+
}
|
|
7
|
+
export type PrimaryToolAPIs = PrimaryToolRawAPIs & PrimaryToolActionAPIs;
|
|
8
|
+
//# sourceMappingURL=primary-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primary-tool.d.ts","sourceRoot":"","sources":["../../../src/types/system-context/primary-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,MAAM,WAAW,kBAAkB;CAAG;AAEtC,MAAM,WAAW,qBAAqB;IACpC,iBAAiB,EAAE,CAAC,IAAI,EAAE,eAAe,KAAK,IAAI,CAAA;CACnD;AAED,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAAG,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primary-tool.js","sourceRoot":"","sources":["../../../src/types/system-context/primary-tool.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/types/transaction.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,EAAE,MAAM,IAAI,CAAA;IAC5B,cAAc,EAAE,MAAM,IAAI,CAAA;CAC3B;AAED,MAAM,MAAM,eAAe,GAAG,qBAAqB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/types/transaction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undo.d.ts","sourceRoot":"","sources":["../../src/types/undo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,IAAI,EAAE,MAAM,IAAI,CAAA;CACjB;AAED,MAAM,MAAM,QAAQ,GAAG,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undo.js","sourceRoot":"","sources":["../../src/types/undo.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PositionData } from '@asyra/utils';
|
|
2
|
+
export interface ViewportRawAPIs {
|
|
3
|
+
getViewportPosition: () => PositionData;
|
|
4
|
+
getViewportScale: () => number;
|
|
5
|
+
}
|
|
6
|
+
export interface ViewportActionAPIs {
|
|
7
|
+
zoomFit: () => void;
|
|
8
|
+
panTo: (x: number, y: number) => void;
|
|
9
|
+
zoomToCenter: (scale: number, centerX: number, centerY: number) => void;
|
|
10
|
+
}
|
|
11
|
+
export type ViewportAPIs = ViewportRawAPIs & ViewportActionAPIs;
|
|
12
|
+
//# sourceMappingURL=viewport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../src/types/viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,MAAM,WAAW,eAAe;IAC9B,mBAAmB,EAAE,MAAM,YAAY,CAAA;IACvC,gBAAgB,EAAE,MAAM,MAAM,CAAA;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACxE;AAED,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewport.js","sourceRoot":"","sources":["../../src/types/viewport.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@asyra/core",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Core of Asyra.",
|
|
5
|
+
"author": "Asa Tsai",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"packageManager": "yarn@4.3.1",
|
|
8
|
+
"keywords": [],
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"types": "dist/index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "tsc --watch --preserveWatchOutput",
|
|
13
|
+
"build:core": "tsc",
|
|
14
|
+
"clean": "rm -rf dist",
|
|
15
|
+
"has:test": "find . -type f \\( -name \"*.test.ts\" -o -name \"*.test.tsx\" \\) | grep -q .",
|
|
16
|
+
"test": "yarn has:test && vitest || echo 'No test files found. Skipping test.'",
|
|
17
|
+
"test:local": "yarn has:test && vitest run || echo 'No test files found. Skipping test:local.'",
|
|
18
|
+
"test:ci": "yarn has:test && vitest run --coverage --reporter=default --reporter=junit || echo 'No test files found. Skipping test:ci.'"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
22
|
+
"typescript": "^5.7.2",
|
|
23
|
+
"vitest": "^2.1.8"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@asyra/factory": "workspace:*",
|
|
27
|
+
"@asyra/input-system": "workspace:*",
|
|
28
|
+
"@asyra/interaction-core": "workspace:*",
|
|
29
|
+
"@asyra/props-manager": "workspace:*",
|
|
30
|
+
"@asyra/reactive-events": "workspace:*",
|
|
31
|
+
"@asyra/render": "workspace:*",
|
|
32
|
+
"@asyra/scene-tree": "workspace:*",
|
|
33
|
+
"@asyra/selection": "workspace:*",
|
|
34
|
+
"@asyra/system-context": "workspace:*",
|
|
35
|
+
"@asyra/utils": "workspace:*"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
2
|
+
import factory from '@asyra/factory'
|
|
3
|
+
import inputSystem from '@asyra/input-system'
|
|
4
|
+
import sceneTree from '@asyra/scene-tree'
|
|
5
|
+
import render from '@asyra/render'
|
|
6
|
+
import props from '@asyra/props-manager'
|
|
7
|
+
import selection from '@asyra/selection'
|
|
8
|
+
import systemContext from '@asyra/system-context'
|
|
9
|
+
import interactionCore from '@asyra/interaction-core'
|
|
10
|
+
import {
|
|
11
|
+
PrimaryToolType,
|
|
12
|
+
InputSystemEvents,
|
|
13
|
+
PropsComponentRawData,
|
|
14
|
+
Unit
|
|
15
|
+
} from '@asyra/utils'
|
|
16
|
+
|
|
17
|
+
import { Core } from '../core'
|
|
18
|
+
|
|
19
|
+
describe('Core', () => {
|
|
20
|
+
let core: Core
|
|
21
|
+
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
vi.clearAllMocks()
|
|
24
|
+
|
|
25
|
+
core = new Core({
|
|
26
|
+
inputSystem,
|
|
27
|
+
factory,
|
|
28
|
+
props,
|
|
29
|
+
render,
|
|
30
|
+
sceneTree,
|
|
31
|
+
selection,
|
|
32
|
+
systemContext,
|
|
33
|
+
interactionCore
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
// Test load method
|
|
38
|
+
it('should load data correctly and call appropriate methods', () => {
|
|
39
|
+
const mockSceneTreeData = {
|
|
40
|
+
elements: {},
|
|
41
|
+
workspace: 'ws-1',
|
|
42
|
+
workspaceList: ['ws-1']
|
|
43
|
+
}
|
|
44
|
+
const mockPropsData = {
|
|
45
|
+
'pp-1': {
|
|
46
|
+
id: 'pp-1',
|
|
47
|
+
x: 100,
|
|
48
|
+
y: 100,
|
|
49
|
+
xUnit: Unit.PX,
|
|
50
|
+
yUnit: Unit.PX
|
|
51
|
+
},
|
|
52
|
+
'pp-2': {
|
|
53
|
+
id: 'pp-2',
|
|
54
|
+
width: 100,
|
|
55
|
+
height: 100,
|
|
56
|
+
widthUnit: Unit.PX,
|
|
57
|
+
heightUnit: Unit.PX
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const dataToLoad = {
|
|
61
|
+
version: '1.0.0',
|
|
62
|
+
sceneTree: mockSceneTreeData,
|
|
63
|
+
props: mockPropsData as unknown as PropsComponentRawData
|
|
64
|
+
}
|
|
65
|
+
// Mock the methods that will be called during load
|
|
66
|
+
core.propsLoadData = vi.fn()
|
|
67
|
+
core.sceneTreeLoadData = vi.fn()
|
|
68
|
+
core.sceneTreeInit = vi.fn()
|
|
69
|
+
core.zoomFit = vi.fn()
|
|
70
|
+
|
|
71
|
+
core.load(dataToLoad)
|
|
72
|
+
|
|
73
|
+
expect(core.version).toBe('1.0.0')
|
|
74
|
+
expect(core.propsLoadData).toHaveBeenCalledWith(mockPropsData)
|
|
75
|
+
expect(core.sceneTreeLoadData).toHaveBeenCalledWith(mockSceneTreeData)
|
|
76
|
+
expect(core.sceneTreeInit).not.toHaveBeenCalled()
|
|
77
|
+
expect(core.zoomFit).toHaveBeenCalledTimes(1)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('should call sceneTreeInit if no sceneTree data is provided', () => {
|
|
81
|
+
const dataToLoad = {
|
|
82
|
+
version: '1.0.0',
|
|
83
|
+
props: {}
|
|
84
|
+
}
|
|
85
|
+
core.sceneTreeInit = vi.fn()
|
|
86
|
+
core.sceneTreeLoadData = vi.fn()
|
|
87
|
+
|
|
88
|
+
core.load(dataToLoad as unknown as Parameters<typeof core.load>[0])
|
|
89
|
+
|
|
90
|
+
expect(core.sceneTreeInit).toHaveBeenCalledTimes(1)
|
|
91
|
+
expect(core.sceneTreeLoadData).not.toHaveBeenCalled()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
// Test save method
|
|
95
|
+
it('should save data correctly and call appropriate methods', async () => {
|
|
96
|
+
const mockSceneTreeData = {
|
|
97
|
+
elements: {},
|
|
98
|
+
workspace: 'ws-1',
|
|
99
|
+
workspaceList: ['ws-1']
|
|
100
|
+
}
|
|
101
|
+
const mockPropsData = { someProp: 'value' }
|
|
102
|
+
core.propsSaveData = vi.fn().mockResolvedValue(mockPropsData)
|
|
103
|
+
core.sceneTreeSaveData = vi.fn().mockResolvedValue(mockSceneTreeData)
|
|
104
|
+
|
|
105
|
+
const savedData = await core.save()
|
|
106
|
+
|
|
107
|
+
expect(core.propsSaveData).toHaveBeenCalledTimes(1)
|
|
108
|
+
expect(core.sceneTreeSaveData).toHaveBeenCalledTimes(1)
|
|
109
|
+
expect(savedData).toEqual({
|
|
110
|
+
version: '1.0.0',
|
|
111
|
+
sceneTree: mockSceneTreeData,
|
|
112
|
+
props: mockPropsData
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
// Test delegation of various APIs
|
|
117
|
+
it('should delegate startTransaction to factory', () => {
|
|
118
|
+
core.startTransaction = vi.fn()
|
|
119
|
+
|
|
120
|
+
core.startTransaction()
|
|
121
|
+
|
|
122
|
+
expect(core.startTransaction).toHaveBeenCalledTimes(1)
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
it('should delegate switchPrimaryTool to systemContext', () => {
|
|
126
|
+
core.switchPrimaryTool = vi.fn()
|
|
127
|
+
|
|
128
|
+
core.switchPrimaryTool(PrimaryToolType.RECTANGLE)
|
|
129
|
+
|
|
130
|
+
expect(core.switchPrimaryTool).toHaveBeenCalledWith(
|
|
131
|
+
PrimaryToolType.RECTANGLE
|
|
132
|
+
)
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
it('should delegate addRectangle to sceneTree', () => {
|
|
136
|
+
const position = { x: 10, y: 20 }
|
|
137
|
+
core.addRectangle = vi.fn()
|
|
138
|
+
|
|
139
|
+
core.addRectangle(position)
|
|
140
|
+
|
|
141
|
+
expect(core.addRectangle).toHaveBeenCalledWith(position)
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
it('should call executeAction without error', async () => {
|
|
145
|
+
const eventName: InputSystemEvents = InputSystemEvents.INPUT_MOUSE_MOVE
|
|
146
|
+
const detail = { some: 'detail' }
|
|
147
|
+
core.executeAction = vi.fn()
|
|
148
|
+
|
|
149
|
+
await core.executeAction(eventName, detail)
|
|
150
|
+
|
|
151
|
+
expect(core.executeAction).toHaveBeenCalledWith(eventName, detail)
|
|
152
|
+
})
|
|
153
|
+
})
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
endTransaction,
|
|
3
|
+
selectElements,
|
|
4
|
+
startTransaction
|
|
5
|
+
} from '@asyra/reactive-events'
|
|
6
|
+
import { ElementSelectionActionAPIs } from '../types'
|
|
7
|
+
|
|
8
|
+
export const createElementSelectionAPIs = (): ElementSelectionActionAPIs => {
|
|
9
|
+
return {
|
|
10
|
+
selectElements(elementIds: string[]) {
|
|
11
|
+
startTransaction()
|
|
12
|
+
selectElements(elementIds)
|
|
13
|
+
endTransaction()
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createTransactionAPIs } from './transaction'
|
|
2
|
+
import { createViewportAPIs } from './viewport'
|
|
3
|
+
import { createUndoAPIs } from './undo'
|
|
4
|
+
import { createRenderAPIs } from './render'
|
|
5
|
+
import { createSceneTreeAPIs } from './scene-tree'
|
|
6
|
+
import { createElementSelectionAPIs } from './element-selection'
|
|
7
|
+
import { createInputSystemAPIs } from './input-system'
|
|
8
|
+
import { createPropsAPIs } from './props'
|
|
9
|
+
import { createSystemContextAPIs } from './system-context'
|
|
10
|
+
import { createInteractionCoreAPIs } from './interaction-core'
|
|
11
|
+
import { CoreAPIs, Requests } from '../types'
|
|
12
|
+
|
|
13
|
+
export const createAPIs = (requests: Requests): CoreAPIs => {
|
|
14
|
+
return {
|
|
15
|
+
...createTransactionAPIs(),
|
|
16
|
+
...createInputSystemAPIs(),
|
|
17
|
+
...createViewportAPIs(requests.renderRequests),
|
|
18
|
+
...createUndoAPIs(),
|
|
19
|
+
...createRenderAPIs(requests.renderRequests),
|
|
20
|
+
...createSceneTreeAPIs(
|
|
21
|
+
requests.sceneTreeRequests,
|
|
22
|
+
requests.factoryRequests,
|
|
23
|
+
requests.selectionRequests
|
|
24
|
+
),
|
|
25
|
+
...createPropsAPIs(requests.propsRequests),
|
|
26
|
+
...createElementSelectionAPIs(),
|
|
27
|
+
...createSystemContextAPIs(),
|
|
28
|
+
...createInteractionCoreAPIs(requests.systemContextRequests)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { switchInputSystemWatchedElement } from '@asyra/reactive-events'
|
|
2
|
+
import { InputSystemRawAPIs } from '../types'
|
|
3
|
+
|
|
4
|
+
export const createInputSystemAPIs = (): InputSystemRawAPIs => {
|
|
5
|
+
return {
|
|
6
|
+
setupInputSystem(watchedElement?: HTMLElement) {
|
|
7
|
+
if (watchedElement) {
|
|
8
|
+
switchInputSystemWatchedElement(watchedElement)
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
endSession,
|
|
3
|
+
executeAction,
|
|
4
|
+
startSession,
|
|
5
|
+
updateSession
|
|
6
|
+
} from '@asyra/reactive-events'
|
|
7
|
+
import { InputSystemEvents, DetailType } from '@asyra/utils'
|
|
8
|
+
import { InteractionCoreAPIs, SystemContextRequests } from '../types'
|
|
9
|
+
|
|
10
|
+
export const createInteractionCoreAPIs = (
|
|
11
|
+
systemContextRequests: SystemContextRequests
|
|
12
|
+
): InteractionCoreAPIs => {
|
|
13
|
+
return {
|
|
14
|
+
executeAction(eventName: InputSystemEvents, detail?: DetailType) {
|
|
15
|
+
const systemContextSnapshot =
|
|
16
|
+
systemContextRequests.getSystemContextSnapshot()
|
|
17
|
+
executeAction(eventName, systemContextSnapshot, detail)
|
|
18
|
+
},
|
|
19
|
+
startSession(eventName: InputSystemEvents, detail?: DetailType) {
|
|
20
|
+
const systemContextSnapshot =
|
|
21
|
+
systemContextRequests.getSystemContextSnapshot()
|
|
22
|
+
startSession(eventName, systemContextSnapshot, detail)
|
|
23
|
+
},
|
|
24
|
+
updateSession(eventName: InputSystemEvents, detail?: DetailType) {
|
|
25
|
+
const systemContextSnapshot =
|
|
26
|
+
systemContextRequests.getSystemContextSnapshot()
|
|
27
|
+
updateSession(eventName, systemContextSnapshot, detail)
|
|
28
|
+
},
|
|
29
|
+
endSession(eventName: InputSystemEvents, detail?: DetailType) {
|
|
30
|
+
const systemContextSnapshot =
|
|
31
|
+
systemContextRequests.getSystemContextSnapshot()
|
|
32
|
+
endSession(eventName, systemContextSnapshot, detail)
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PropsComponentRawData } from '@asyra/utils'
|
|
2
|
+
import { PropsRawAPIs, PropsRequests } from '../types'
|
|
3
|
+
|
|
4
|
+
export const createPropsAPIs = (propsRequests: PropsRequests): PropsRawAPIs => {
|
|
5
|
+
return {
|
|
6
|
+
propsLoadData(data: PropsComponentRawData) {
|
|
7
|
+
propsRequests.propsLoadData(data)
|
|
8
|
+
},
|
|
9
|
+
propsSaveData() {
|
|
10
|
+
return propsRequests.propsSaveData()
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { renderIsReady } from '@asyra/reactive-events'
|
|
2
|
+
import { RenderRawAPIs, RenderRequests } from '../types'
|
|
3
|
+
|
|
4
|
+
export const createRenderAPIs = (
|
|
5
|
+
renderRequests: RenderRequests
|
|
6
|
+
): RenderRawAPIs => {
|
|
7
|
+
return {
|
|
8
|
+
renderIsReady() {
|
|
9
|
+
renderIsReady()
|
|
10
|
+
},
|
|
11
|
+
async initRender(width: number, height: number, color: number) {
|
|
12
|
+
return await renderRequests.initRender(width, height, color)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|