@asyra/reactive-events 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 +137 -0
- package/.turbo/turbo-test$colon$local.log +18 -0
- package/.turbo/turbo-test.log +19 -0
- package/README.md +1 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +1956 -0
- package/coverage/coverage-final.json +24117 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +341 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/scripts/add-event.ts.html +1429 -0
- package/coverage/scripts/add-interaction.ts.html +1621 -0
- package/coverage/scripts/index.html +131 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/src/app/events.ts.html +238 -0
- package/coverage/src/app/index.html +176 -0
- package/coverage/src/app/index.ts.html +97 -0
- package/coverage/src/app/publish.ts.html +268 -0
- package/coverage/src/app/stream.ts.html +100 -0
- package/coverage/src/app/subscribes.ts.html +193 -0
- package/coverage/src/constants.ts.html +151 -0
- package/coverage/src/core/events.ts.html +124 -0
- package/coverage/src/core/index.html +161 -0
- package/coverage/src/core/index.ts.html +94 -0
- package/coverage/src/core/publish.ts.html +121 -0
- package/coverage/src/core/subscribes.ts.html +103 -0
- package/coverage/src/event-bus.ts.html +298 -0
- package/coverage/src/index.html +161 -0
- package/coverage/src/index.ts.html +124 -0
- package/coverage/src/input-system/events.ts.html +115 -0
- package/coverage/src/input-system/index.html +161 -0
- package/coverage/src/input-system/index.ts.html +94 -0
- package/coverage/src/input-system/publish.ts.html +124 -0
- package/coverage/src/input-system/subscribes.ts.html +109 -0
- package/coverage/src/interaction-core/events.ts.html +529 -0
- package/coverage/src/interaction-core/index.html +161 -0
- package/coverage/src/interaction-core/index.ts.html +94 -0
- package/coverage/src/interaction-core/publish.ts.html +652 -0
- package/coverage/src/interaction-core/subscribes.ts.html +331 -0
- package/coverage/src/props-manager/events.ts.html +169 -0
- package/coverage/src/props-manager/index.html +161 -0
- package/coverage/src/props-manager/index.ts.html +94 -0
- package/coverage/src/props-manager/publish.ts.html +175 -0
- package/coverage/src/props-manager/subscribes.ts.html +136 -0
- package/coverage/src/render/events.ts.html +409 -0
- package/coverage/src/render/index.html +161 -0
- package/coverage/src/render/index.ts.html +94 -0
- package/coverage/src/render/publish.ts.html +730 -0
- package/coverage/src/render/subscribes.ts.html +286 -0
- package/coverage/src/scene-tree/events.ts.html +298 -0
- package/coverage/src/scene-tree/index.html +176 -0
- package/coverage/src/scene-tree/index.ts.html +97 -0
- package/coverage/src/scene-tree/publish.ts.html +364 -0
- package/coverage/src/scene-tree/stream.ts.html +100 -0
- package/coverage/src/scene-tree/subscribes.ts.html +190 -0
- package/coverage/src/selection/events.ts.html +115 -0
- package/coverage/src/selection/index.html +161 -0
- package/coverage/src/selection/index.ts.html +94 -0
- package/coverage/src/selection/publish.ts.html +118 -0
- package/coverage/src/selection/subscribes.ts.html +103 -0
- package/coverage/src/system-context/index.html +116 -0
- package/coverage/src/system-context/index.ts.html +127 -0
- package/coverage/src/system-context/key-state/events.ts.html +112 -0
- package/coverage/src/system-context/key-state/index.html +161 -0
- package/coverage/src/system-context/key-state/index.ts.html +94 -0
- package/coverage/src/system-context/key-state/publish.ts.html +121 -0
- package/coverage/src/system-context/key-state/subscribes.ts.html +103 -0
- package/coverage/src/system-context/mouse-state/events.ts.html +112 -0
- package/coverage/src/system-context/mouse-state/index.html +161 -0
- package/coverage/src/system-context/mouse-state/index.ts.html +94 -0
- package/coverage/src/system-context/mouse-state/publish.ts.html +121 -0
- package/coverage/src/system-context/mouse-state/subscribes.ts.html +103 -0
- package/coverage/src/system-context/primary-tool/events.ts.html +187 -0
- package/coverage/src/system-context/primary-tool/index.html +161 -0
- package/coverage/src/system-context/primary-tool/index.ts.html +94 -0
- package/coverage/src/system-context/primary-tool/publish.ts.html +265 -0
- package/coverage/src/system-context/primary-tool/subscribes.ts.html +163 -0
- package/coverage/src/system-context/target-state/events.ts.html +115 -0
- package/coverage/src/system-context/target-state/index.html +161 -0
- package/coverage/src/system-context/target-state/index.ts.html +94 -0
- package/coverage/src/system-context/target-state/publish.ts.html +118 -0
- package/coverage/src/system-context/target-state/subscribes.ts.html +109 -0
- package/coverage/src/types.ts.html +568 -0
- package/coverage/src/ui-context/events.ts.html +133 -0
- package/coverage/src/ui-context/index.html +161 -0
- package/coverage/src/ui-context/index.ts.html +94 -0
- package/coverage/src/ui-context/publish.ts.html +181 -0
- package/coverage/src/ui-context/subscribes.ts.html +133 -0
- package/dist/__tests__/event-bus.test.d.ts +2 -0
- package/dist/__tests__/event-bus.test.d.ts.map +1 -0
- package/dist/__tests__/event-bus.test.js +148 -0
- package/dist/__tests__/event-bus.test.js.map +1 -0
- package/dist/__tests__/event-types.test.d.ts +2 -0
- package/dist/__tests__/event-types.test.d.ts.map +1 -0
- package/dist/__tests__/event-types.test.js +121 -0
- package/dist/__tests__/event-types.test.js.map +1 -0
- package/dist/app/events.d.ts +34 -0
- package/dist/app/events.d.ts.map +1 -0
- package/dist/app/events.js +2 -0
- package/dist/app/events.js.map +1 -0
- package/dist/app/index.d.ts +5 -0
- package/dist/app/index.d.ts.map +1 -0
- package/dist/app/index.js +5 -0
- package/dist/app/index.js.map +1 -0
- package/dist/app/publish.d.ts +10 -0
- package/dist/app/publish.d.ts.map +1 -0
- package/dist/app/publish.js +49 -0
- package/dist/app/publish.js.map +1 -0
- package/dist/app/stream.d.ts +2 -0
- package/dist/app/stream.d.ts.map +1 -0
- package/dist/app/stream.js +4 -0
- package/dist/app/stream.js.map +1 -0
- package/dist/app/subscribes.d.ts +10 -0
- package/dist/app/subscribes.d.ts.map +1 -0
- package/dist/app/subscribes.js +11 -0
- package/dist/app/subscribes.js.map +1 -0
- package/dist/constants.d.ts +12 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/events.d.ts +12 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/events.js +2 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/publish.d.ts +3 -0
- package/dist/core/publish.d.ts.map +1 -0
- package/dist/core/publish.js +11 -0
- package/dist/core/publish.js.map +1 -0
- package/dist/core/subscribes.d.ts +3 -0
- package/dist/core/subscribes.d.ts.map +1 -0
- package/dist/core/subscribes.js +4 -0
- package/dist/core/subscribes.js.map +1 -0
- package/dist/event-bus.d.ts +12 -0
- package/dist/event-bus.d.ts.map +1 -0
- package/dist/event-bus.js +31 -0
- package/dist/event-bus.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/input-system/events.d.ts +9 -0
- package/dist/input-system/events.d.ts.map +1 -0
- package/dist/input-system/events.js +2 -0
- package/dist/input-system/events.js.map +1 -0
- package/dist/input-system/index.d.ts +4 -0
- package/dist/input-system/index.d.ts.map +1 -0
- package/dist/input-system/index.js +4 -0
- package/dist/input-system/index.js.map +1 -0
- package/dist/input-system/publish.d.ts +2 -0
- package/dist/input-system/publish.d.ts.map +1 -0
- package/dist/input-system/publish.js +11 -0
- package/dist/input-system/publish.js.map +1 -0
- package/dist/input-system/subscribes.d.ts +3 -0
- package/dist/input-system/subscribes.d.ts.map +1 -0
- package/dist/input-system/subscribes.js +4 -0
- package/dist/input-system/subscribes.js.map +1 -0
- package/dist/interaction-core/events.d.ts +108 -0
- package/dist/interaction-core/events.d.ts.map +1 -0
- package/dist/interaction-core/events.js +2 -0
- package/dist/interaction-core/events.js.map +1 -0
- package/dist/interaction-core/index.d.ts +4 -0
- package/dist/interaction-core/index.d.ts.map +1 -0
- package/dist/interaction-core/index.js +4 -0
- package/dist/interaction-core/index.js.map +1 -0
- package/dist/interaction-core/publish.d.ts +20 -0
- package/dist/interaction-core/publish.d.ts.map +1 -0
- package/dist/interaction-core/publish.js +130 -0
- package/dist/interaction-core/publish.js.map +1 -0
- package/dist/interaction-core/subscribes.d.ts +17 -0
- package/dist/interaction-core/subscribes.d.ts.map +1 -0
- package/dist/interaction-core/subscribes.js +18 -0
- package/dist/interaction-core/subscribes.js.map +1 -0
- package/dist/props-manager/events.d.ts +22 -0
- package/dist/props-manager/events.d.ts.map +1 -0
- package/dist/props-manager/events.js +2 -0
- package/dist/props-manager/events.js.map +1 -0
- package/dist/props-manager/index.d.ts +4 -0
- package/dist/props-manager/index.d.ts.map +1 -0
- package/dist/props-manager/index.js +4 -0
- package/dist/props-manager/index.js.map +1 -0
- package/dist/props-manager/publish.d.ts +5 -0
- package/dist/props-manager/publish.d.ts.map +1 -0
- package/dist/props-manager/publish.js +27 -0
- package/dist/props-manager/publish.js.map +1 -0
- package/dist/props-manager/subscribes.d.ts +5 -0
- package/dist/props-manager/subscribes.d.ts.map +1 -0
- package/dist/props-manager/subscribes.js +6 -0
- package/dist/props-manager/subscribes.js.map +1 -0
- package/dist/render/events.d.ts +83 -0
- package/dist/render/events.d.ts.map +1 -0
- package/dist/render/events.js +2 -0
- package/dist/render/events.js.map +1 -0
- package/dist/render/index.d.ts +4 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/index.js +4 -0
- package/dist/render/index.js.map +1 -0
- package/dist/render/publish.d.ts +17 -0
- package/dist/render/publish.d.ts.map +1 -0
- package/dist/render/publish.js +159 -0
- package/dist/render/publish.js.map +1 -0
- package/dist/render/subscribes.d.ts +14 -0
- package/dist/render/subscribes.d.ts.map +1 -0
- package/dist/render/subscribes.js +15 -0
- package/dist/render/subscribes.js.map +1 -0
- package/dist/scene-tree/events.d.ts +52 -0
- package/dist/scene-tree/events.d.ts.map +1 -0
- package/dist/scene-tree/events.js +2 -0
- package/dist/scene-tree/events.js.map +1 -0
- package/dist/scene-tree/index.d.ts +5 -0
- package/dist/scene-tree/index.d.ts.map +1 -0
- package/dist/scene-tree/index.js +5 -0
- package/dist/scene-tree/index.js.map +1 -0
- package/dist/scene-tree/publish.d.ts +11 -0
- package/dist/scene-tree/publish.d.ts.map +1 -0
- package/dist/scene-tree/publish.js +63 -0
- package/dist/scene-tree/publish.js.map +1 -0
- package/dist/scene-tree/stream.d.ts +2 -0
- package/dist/scene-tree/stream.d.ts.map +1 -0
- package/dist/scene-tree/stream.js +4 -0
- package/dist/scene-tree/stream.js.map +1 -0
- package/dist/scene-tree/subscribes.d.ts +9 -0
- package/dist/scene-tree/subscribes.d.ts.map +1 -0
- package/dist/scene-tree/subscribes.js +10 -0
- package/dist/scene-tree/subscribes.js.map +1 -0
- package/dist/scripts/add-event.d.ts +2 -0
- package/dist/scripts/add-event.d.ts.map +1 -0
- package/dist/scripts/add-event.js +373 -0
- package/dist/scripts/add-event.js.map +1 -0
- package/dist/scripts/add-interaction.d.ts +2 -0
- package/dist/scripts/add-interaction.d.ts.map +1 -0
- package/dist/scripts/add-interaction.js +344 -0
- package/dist/scripts/add-interaction.js.map +1 -0
- package/dist/selection/events.d.ts +9 -0
- package/dist/selection/events.d.ts.map +1 -0
- package/dist/selection/events.js +2 -0
- package/dist/selection/events.js.map +1 -0
- package/dist/selection/index.d.ts +4 -0
- package/dist/selection/index.d.ts.map +1 -0
- package/dist/selection/index.js +4 -0
- package/dist/selection/index.js.map +1 -0
- package/dist/selection/publish.d.ts +2 -0
- package/dist/selection/publish.d.ts.map +1 -0
- package/dist/selection/publish.js +11 -0
- package/dist/selection/publish.js.map +1 -0
- package/dist/selection/subscribes.d.ts +3 -0
- package/dist/selection/subscribes.d.ts.map +1 -0
- package/dist/selection/subscribes.js +4 -0
- package/dist/selection/subscribes.js.map +1 -0
- package/dist/src/app/events.d.ts +34 -0
- package/dist/src/app/events.d.ts.map +1 -0
- package/dist/src/app/events.js +2 -0
- package/dist/src/app/events.js.map +1 -0
- package/dist/src/app/index.d.ts +5 -0
- package/dist/src/app/index.d.ts.map +1 -0
- package/dist/src/app/index.js +5 -0
- package/dist/src/app/index.js.map +1 -0
- package/dist/src/app/publish.d.ts +10 -0
- package/dist/src/app/publish.d.ts.map +1 -0
- package/dist/src/app/publish.js +49 -0
- package/dist/src/app/publish.js.map +1 -0
- package/dist/src/app/stream.d.ts +2 -0
- package/dist/src/app/stream.d.ts.map +1 -0
- package/dist/src/app/stream.js +4 -0
- package/dist/src/app/stream.js.map +1 -0
- package/dist/src/app/subscribes.d.ts +10 -0
- package/dist/src/app/subscribes.d.ts.map +1 -0
- package/dist/src/app/subscribes.js +11 -0
- package/dist/src/app/subscribes.js.map +1 -0
- package/dist/src/constants.d.ts +12 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +2 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/core/events.d.ts +12 -0
- package/dist/src/core/events.d.ts.map +1 -0
- package/dist/src/core/events.js +2 -0
- package/dist/src/core/events.js.map +1 -0
- package/dist/src/core/index.d.ts +4 -0
- package/dist/src/core/index.d.ts.map +1 -0
- package/dist/src/core/index.js +4 -0
- package/dist/src/core/index.js.map +1 -0
- package/dist/src/core/publish.d.ts +3 -0
- package/dist/src/core/publish.d.ts.map +1 -0
- package/dist/src/core/publish.js +11 -0
- package/dist/src/core/publish.js.map +1 -0
- package/dist/src/core/subscribes.d.ts +3 -0
- package/dist/src/core/subscribes.d.ts.map +1 -0
- package/dist/src/core/subscribes.js +4 -0
- package/dist/src/core/subscribes.js.map +1 -0
- package/dist/src/event-bus.d.ts +12 -0
- package/dist/src/event-bus.d.ts.map +1 -0
- package/dist/src/event-bus.js +31 -0
- package/dist/src/event-bus.js.map +1 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +14 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/input-system/events.d.ts +9 -0
- package/dist/src/input-system/events.d.ts.map +1 -0
- package/dist/src/input-system/events.js +2 -0
- package/dist/src/input-system/events.js.map +1 -0
- package/dist/src/input-system/index.d.ts +4 -0
- package/dist/src/input-system/index.d.ts.map +1 -0
- package/dist/src/input-system/index.js +4 -0
- package/dist/src/input-system/index.js.map +1 -0
- package/dist/src/input-system/publish.d.ts +2 -0
- package/dist/src/input-system/publish.d.ts.map +1 -0
- package/dist/src/input-system/publish.js +11 -0
- package/dist/src/input-system/publish.js.map +1 -0
- package/dist/src/input-system/subscribes.d.ts +3 -0
- package/dist/src/input-system/subscribes.d.ts.map +1 -0
- package/dist/src/input-system/subscribes.js +4 -0
- package/dist/src/input-system/subscribes.js.map +1 -0
- package/dist/src/interaction-core/events.d.ts +108 -0
- package/dist/src/interaction-core/events.d.ts.map +1 -0
- package/dist/src/interaction-core/events.js +2 -0
- package/dist/src/interaction-core/events.js.map +1 -0
- package/dist/src/interaction-core/index.d.ts +4 -0
- package/dist/src/interaction-core/index.d.ts.map +1 -0
- package/dist/src/interaction-core/index.js +4 -0
- package/dist/src/interaction-core/index.js.map +1 -0
- package/dist/src/interaction-core/publish.d.ts +20 -0
- package/dist/src/interaction-core/publish.d.ts.map +1 -0
- package/dist/src/interaction-core/publish.js +130 -0
- package/dist/src/interaction-core/publish.js.map +1 -0
- package/dist/src/interaction-core/subscribes.d.ts +17 -0
- package/dist/src/interaction-core/subscribes.d.ts.map +1 -0
- package/dist/src/interaction-core/subscribes.js +18 -0
- package/dist/src/interaction-core/subscribes.js.map +1 -0
- package/dist/src/props-manager/events.d.ts +41 -0
- package/dist/src/props-manager/events.d.ts.map +1 -0
- package/dist/src/props-manager/events.js +2 -0
- package/dist/src/props-manager/events.js.map +1 -0
- package/dist/src/props-manager/index.d.ts +4 -0
- package/dist/src/props-manager/index.d.ts.map +1 -0
- package/dist/src/props-manager/index.js +4 -0
- package/dist/src/props-manager/index.js.map +1 -0
- package/dist/src/props-manager/publish.d.ts +8 -0
- package/dist/src/props-manager/publish.d.ts.map +1 -0
- package/dist/src/props-manager/publish.js +67 -0
- package/dist/src/props-manager/publish.js.map +1 -0
- package/dist/src/props-manager/subscribes.d.ts +8 -0
- package/dist/src/props-manager/subscribes.d.ts.map +1 -0
- package/dist/src/props-manager/subscribes.js +9 -0
- package/dist/src/props-manager/subscribes.js.map +1 -0
- package/dist/src/render/events.d.ts +83 -0
- package/dist/src/render/events.d.ts.map +1 -0
- package/dist/src/render/events.js +2 -0
- package/dist/src/render/events.js.map +1 -0
- package/dist/src/render/index.d.ts +4 -0
- package/dist/src/render/index.d.ts.map +1 -0
- package/dist/src/render/index.js +4 -0
- package/dist/src/render/index.js.map +1 -0
- package/dist/src/render/publish.d.ts +17 -0
- package/dist/src/render/publish.d.ts.map +1 -0
- package/dist/src/render/publish.js +159 -0
- package/dist/src/render/publish.js.map +1 -0
- package/dist/src/render/subscribes.d.ts +14 -0
- package/dist/src/render/subscribes.d.ts.map +1 -0
- package/dist/src/render/subscribes.js +15 -0
- package/dist/src/render/subscribes.js.map +1 -0
- package/dist/src/scene-tree/events.d.ts +73 -0
- package/dist/src/scene-tree/events.d.ts.map +1 -0
- package/dist/src/scene-tree/events.js +2 -0
- package/dist/src/scene-tree/events.js.map +1 -0
- package/dist/src/scene-tree/index.d.ts +5 -0
- package/dist/src/scene-tree/index.d.ts.map +1 -0
- package/dist/src/scene-tree/index.js +5 -0
- package/dist/src/scene-tree/index.js.map +1 -0
- package/dist/src/scene-tree/publish.d.ts +14 -0
- package/dist/src/scene-tree/publish.d.ts.map +1 -0
- package/dist/src/scene-tree/publish.js +121 -0
- package/dist/src/scene-tree/publish.js.map +1 -0
- package/dist/src/scene-tree/stream.d.ts +2 -0
- package/dist/src/scene-tree/stream.d.ts.map +1 -0
- package/dist/src/scene-tree/stream.js +4 -0
- package/dist/src/scene-tree/stream.js.map +1 -0
- package/dist/src/scene-tree/subscribes.d.ts +12 -0
- package/dist/src/scene-tree/subscribes.d.ts.map +1 -0
- package/dist/src/scene-tree/subscribes.js +13 -0
- package/dist/src/scene-tree/subscribes.js.map +1 -0
- package/dist/src/selection/events.d.ts +9 -0
- package/dist/src/selection/events.d.ts.map +1 -0
- package/dist/src/selection/events.js +2 -0
- package/dist/src/selection/events.js.map +1 -0
- package/dist/src/selection/index.d.ts +4 -0
- package/dist/src/selection/index.d.ts.map +1 -0
- package/dist/src/selection/index.js +4 -0
- package/dist/src/selection/index.js.map +1 -0
- package/dist/src/selection/publish.d.ts +2 -0
- package/dist/src/selection/publish.d.ts.map +1 -0
- package/dist/src/selection/publish.js +11 -0
- package/dist/src/selection/publish.js.map +1 -0
- package/dist/src/selection/subscribes.d.ts +3 -0
- package/dist/src/selection/subscribes.d.ts.map +1 -0
- package/dist/src/selection/subscribes.js +4 -0
- package/dist/src/selection/subscribes.js.map +1 -0
- package/dist/src/system-context/index.d.ts +12 -0
- package/dist/src/system-context/index.d.ts.map +1 -0
- package/dist/src/system-context/index.js +6 -0
- package/dist/src/system-context/index.js.map +1 -0
- package/dist/src/system-context/key-state/events.d.ts +8 -0
- package/dist/src/system-context/key-state/events.d.ts.map +1 -0
- package/dist/src/system-context/key-state/events.js +2 -0
- package/dist/src/system-context/key-state/events.js.map +1 -0
- package/dist/src/system-context/key-state/index.d.ts +4 -0
- package/dist/src/system-context/key-state/index.d.ts.map +1 -0
- package/dist/src/system-context/key-state/index.js +4 -0
- package/dist/src/system-context/key-state/index.js.map +1 -0
- package/dist/src/system-context/key-state/publish.d.ts +3 -0
- package/dist/src/system-context/key-state/publish.d.ts.map +1 -0
- package/dist/src/system-context/key-state/publish.js +11 -0
- package/dist/src/system-context/key-state/publish.js.map +1 -0
- package/dist/src/system-context/key-state/subscribes.d.ts +3 -0
- package/dist/src/system-context/key-state/subscribes.d.ts.map +1 -0
- package/dist/src/system-context/key-state/subscribes.js +4 -0
- package/dist/src/system-context/key-state/subscribes.js.map +1 -0
- package/dist/src/system-context/mouse-state/events.d.ts +8 -0
- package/dist/src/system-context/mouse-state/events.d.ts.map +1 -0
- package/dist/src/system-context/mouse-state/events.js +2 -0
- package/dist/src/system-context/mouse-state/events.js.map +1 -0
- package/dist/src/system-context/mouse-state/index.d.ts +4 -0
- package/dist/src/system-context/mouse-state/index.d.ts.map +1 -0
- package/dist/src/system-context/mouse-state/index.js +4 -0
- package/dist/src/system-context/mouse-state/index.js.map +1 -0
- package/dist/src/system-context/mouse-state/publish.d.ts +3 -0
- package/dist/src/system-context/mouse-state/publish.d.ts.map +1 -0
- package/dist/src/system-context/mouse-state/publish.js +11 -0
- package/dist/src/system-context/mouse-state/publish.js.map +1 -0
- package/dist/src/system-context/mouse-state/subscribes.d.ts +3 -0
- package/dist/src/system-context/mouse-state/subscribes.d.ts.map +1 -0
- package/dist/src/system-context/mouse-state/subscribes.js +4 -0
- package/dist/src/system-context/mouse-state/subscribes.js.map +1 -0
- package/dist/src/system-context/primary-tool/events.d.ts +26 -0
- package/dist/src/system-context/primary-tool/events.d.ts.map +1 -0
- package/dist/src/system-context/primary-tool/events.js +2 -0
- package/dist/src/system-context/primary-tool/events.js.map +1 -0
- package/dist/src/system-context/primary-tool/index.d.ts +4 -0
- package/dist/src/system-context/primary-tool/index.d.ts.map +1 -0
- package/dist/src/system-context/primary-tool/index.js +4 -0
- package/dist/src/system-context/primary-tool/index.js.map +1 -0
- package/dist/src/system-context/primary-tool/publish.d.ts +6 -0
- package/dist/src/system-context/primary-tool/publish.d.ts.map +1 -0
- package/dist/src/system-context/primary-tool/publish.js +48 -0
- package/dist/src/system-context/primary-tool/publish.js.map +1 -0
- package/dist/src/system-context/primary-tool/subscribes.d.ts +6 -0
- package/dist/src/system-context/primary-tool/subscribes.d.ts.map +1 -0
- package/dist/src/system-context/primary-tool/subscribes.js +7 -0
- package/dist/src/system-context/primary-tool/subscribes.js.map +1 -0
- package/dist/src/system-context/system-context/events.d.ts +17 -0
- package/dist/src/system-context/system-context/events.d.ts.map +1 -0
- package/dist/src/system-context/system-context/events.js +2 -0
- package/dist/src/system-context/system-context/events.js.map +1 -0
- package/dist/src/system-context/system-context/index.d.ts +4 -0
- package/dist/src/system-context/system-context/index.d.ts.map +1 -0
- package/dist/src/system-context/system-context/index.js +4 -0
- package/dist/src/system-context/system-context/index.js.map +1 -0
- package/dist/src/system-context/system-context/publish.d.ts +4 -0
- package/dist/src/system-context/system-context/publish.d.ts.map +1 -0
- package/dist/src/system-context/system-context/publish.js +35 -0
- package/dist/src/system-context/system-context/publish.js.map +1 -0
- package/dist/src/system-context/system-context/subscribes.d.ts +4 -0
- package/dist/src/system-context/system-context/subscribes.d.ts.map +1 -0
- package/dist/src/system-context/system-context/subscribes.js +5 -0
- package/dist/src/system-context/system-context/subscribes.js.map +1 -0
- package/dist/src/system-context/target-state/events.d.ts +9 -0
- package/dist/src/system-context/target-state/events.d.ts.map +1 -0
- package/dist/src/system-context/target-state/events.js +2 -0
- package/dist/src/system-context/target-state/events.js.map +1 -0
- package/dist/src/system-context/target-state/index.d.ts +4 -0
- package/dist/src/system-context/target-state/index.d.ts.map +1 -0
- package/dist/src/system-context/target-state/index.js +4 -0
- package/dist/src/system-context/target-state/index.js.map +1 -0
- package/dist/src/system-context/target-state/publish.d.ts +2 -0
- package/dist/src/system-context/target-state/publish.d.ts.map +1 -0
- package/dist/src/system-context/target-state/publish.js +11 -0
- package/dist/src/system-context/target-state/publish.js.map +1 -0
- package/dist/src/system-context/target-state/subscribes.d.ts +3 -0
- package/dist/src/system-context/target-state/subscribes.d.ts.map +1 -0
- package/dist/src/system-context/target-state/subscribes.js +4 -0
- package/dist/src/system-context/target-state/subscribes.js.map +1 -0
- package/dist/src/types.d.ts +174 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +160 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/ui-context/events.d.ts +12 -0
- package/dist/src/ui-context/events.d.ts.map +1 -0
- package/dist/src/ui-context/events.js +2 -0
- package/dist/src/ui-context/events.js.map +1 -0
- package/dist/src/ui-context/index.d.ts +4 -0
- package/dist/src/ui-context/index.d.ts.map +1 -0
- package/dist/src/ui-context/index.js +4 -0
- package/dist/src/ui-context/index.js.map +1 -0
- package/dist/src/ui-context/publish.d.ts +3 -0
- package/dist/src/ui-context/publish.d.ts.map +1 -0
- package/dist/src/ui-context/publish.js +21 -0
- package/dist/src/ui-context/publish.js.map +1 -0
- package/dist/src/ui-context/subscribes.d.ts +4 -0
- package/dist/src/ui-context/subscribes.d.ts.map +1 -0
- package/dist/src/ui-context/subscribes.js +5 -0
- package/dist/src/ui-context/subscribes.js.map +1 -0
- package/dist/system-context/index.d.ts +10 -0
- package/dist/system-context/index.d.ts.map +1 -0
- package/dist/system-context/index.js +5 -0
- package/dist/system-context/index.js.map +1 -0
- package/dist/system-context/key-state/events.d.ts +8 -0
- package/dist/system-context/key-state/events.d.ts.map +1 -0
- package/dist/system-context/key-state/events.js +2 -0
- package/dist/system-context/key-state/events.js.map +1 -0
- package/dist/system-context/key-state/index.d.ts +4 -0
- package/dist/system-context/key-state/index.d.ts.map +1 -0
- package/dist/system-context/key-state/index.js +4 -0
- package/dist/system-context/key-state/index.js.map +1 -0
- package/dist/system-context/key-state/publish.d.ts +3 -0
- package/dist/system-context/key-state/publish.d.ts.map +1 -0
- package/dist/system-context/key-state/publish.js +11 -0
- package/dist/system-context/key-state/publish.js.map +1 -0
- package/dist/system-context/key-state/subscribes.d.ts +3 -0
- package/dist/system-context/key-state/subscribes.d.ts.map +1 -0
- package/dist/system-context/key-state/subscribes.js +4 -0
- package/dist/system-context/key-state/subscribes.js.map +1 -0
- package/dist/system-context/mouse-state/events.d.ts +8 -0
- package/dist/system-context/mouse-state/events.d.ts.map +1 -0
- package/dist/system-context/mouse-state/events.js +2 -0
- package/dist/system-context/mouse-state/events.js.map +1 -0
- package/dist/system-context/mouse-state/index.d.ts +4 -0
- package/dist/system-context/mouse-state/index.d.ts.map +1 -0
- package/dist/system-context/mouse-state/index.js +4 -0
- package/dist/system-context/mouse-state/index.js.map +1 -0
- package/dist/system-context/mouse-state/publish.d.ts +3 -0
- package/dist/system-context/mouse-state/publish.d.ts.map +1 -0
- package/dist/system-context/mouse-state/publish.js +11 -0
- package/dist/system-context/mouse-state/publish.js.map +1 -0
- package/dist/system-context/mouse-state/subscribes.d.ts +3 -0
- package/dist/system-context/mouse-state/subscribes.d.ts.map +1 -0
- package/dist/system-context/mouse-state/subscribes.js +4 -0
- package/dist/system-context/mouse-state/subscribes.js.map +1 -0
- package/dist/system-context/primary-tool/events.d.ts +26 -0
- package/dist/system-context/primary-tool/events.d.ts.map +1 -0
- package/dist/system-context/primary-tool/events.js +2 -0
- package/dist/system-context/primary-tool/events.js.map +1 -0
- package/dist/system-context/primary-tool/index.d.ts +4 -0
- package/dist/system-context/primary-tool/index.d.ts.map +1 -0
- package/dist/system-context/primary-tool/index.js +4 -0
- package/dist/system-context/primary-tool/index.js.map +1 -0
- package/dist/system-context/primary-tool/publish.d.ts +6 -0
- package/dist/system-context/primary-tool/publish.d.ts.map +1 -0
- package/dist/system-context/primary-tool/publish.js +48 -0
- package/dist/system-context/primary-tool/publish.js.map +1 -0
- package/dist/system-context/primary-tool/subscribes.d.ts +6 -0
- package/dist/system-context/primary-tool/subscribes.d.ts.map +1 -0
- package/dist/system-context/primary-tool/subscribes.js +7 -0
- package/dist/system-context/primary-tool/subscribes.js.map +1 -0
- package/dist/system-context/system-context/events.d.ts +17 -0
- package/dist/system-context/system-context/events.d.ts.map +1 -0
- package/dist/system-context/system-context/events.js +2 -0
- package/dist/system-context/system-context/events.js.map +1 -0
- package/dist/system-context/system-context/index.d.ts +4 -0
- package/dist/system-context/system-context/index.d.ts.map +1 -0
- package/dist/system-context/system-context/index.js +4 -0
- package/dist/system-context/system-context/index.js.map +1 -0
- package/dist/system-context/system-context/publish.d.ts +4 -0
- package/dist/system-context/system-context/publish.d.ts.map +1 -0
- package/dist/system-context/system-context/publish.js +35 -0
- package/dist/system-context/system-context/publish.js.map +1 -0
- package/dist/system-context/system-context/subscribes.d.ts +4 -0
- package/dist/system-context/system-context/subscribes.d.ts.map +1 -0
- package/dist/system-context/system-context/subscribes.js +5 -0
- package/dist/system-context/system-context/subscribes.js.map +1 -0
- package/dist/system-context/target-state/events.d.ts +9 -0
- package/dist/system-context/target-state/events.d.ts.map +1 -0
- package/dist/system-context/target-state/events.js +2 -0
- package/dist/system-context/target-state/events.js.map +1 -0
- package/dist/system-context/target-state/index.d.ts +4 -0
- package/dist/system-context/target-state/index.d.ts.map +1 -0
- package/dist/system-context/target-state/index.js +4 -0
- package/dist/system-context/target-state/index.js.map +1 -0
- package/dist/system-context/target-state/publish.d.ts +2 -0
- package/dist/system-context/target-state/publish.d.ts.map +1 -0
- package/dist/system-context/target-state/publish.js +11 -0
- package/dist/system-context/target-state/publish.js.map +1 -0
- package/dist/system-context/target-state/subscribes.d.ts +3 -0
- package/dist/system-context/target-state/subscribes.d.ts.map +1 -0
- package/dist/system-context/target-state/subscribes.js +4 -0
- package/dist/system-context/target-state/subscribes.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +174 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +160 -0
- package/dist/types.js.map +1 -0
- package/dist/ui-context/events.d.ts +12 -0
- package/dist/ui-context/events.d.ts.map +1 -0
- package/dist/ui-context/events.js +2 -0
- package/dist/ui-context/events.js.map +1 -0
- package/dist/ui-context/index.d.ts +4 -0
- package/dist/ui-context/index.d.ts.map +1 -0
- package/dist/ui-context/index.js +4 -0
- package/dist/ui-context/index.js.map +1 -0
- package/dist/ui-context/publish.d.ts +3 -0
- package/dist/ui-context/publish.d.ts.map +1 -0
- package/dist/ui-context/publish.js +21 -0
- package/dist/ui-context/publish.js.map +1 -0
- package/dist/ui-context/subscribes.d.ts +4 -0
- package/dist/ui-context/subscribes.d.ts.map +1 -0
- package/dist/ui-context/subscribes.js +5 -0
- package/dist/ui-context/subscribes.js.map +1 -0
- package/package.json +38 -0
- package/scripts/add-event.ts +448 -0
- package/scripts/add-interaction.ts +512 -0
- package/scripts/tsconfig.json +4 -0
- package/src/__tests__/event-bus.test.ts +208 -0
- package/src/__tests__/event-types.test.ts +151 -0
- package/src/app/events.ts +51 -0
- package/src/app/index.ts +4 -0
- package/src/app/publish.ts +61 -0
- package/src/app/stream.ts +5 -0
- package/src/app/subscribes.ts +36 -0
- package/src/constants.ts +22 -0
- package/src/core/events.ts +13 -0
- package/src/core/index.ts +3 -0
- package/src/core/publish.ts +12 -0
- package/src/core/subscribes.ts +6 -0
- package/src/event-bus.ts +71 -0
- package/src/index.ts +13 -0
- package/src/input-system/events.ts +10 -0
- package/src/input-system/index.ts +3 -0
- package/src/input-system/publish.ts +13 -0
- package/src/input-system/subscribes.ts +8 -0
- package/src/interaction-core/events.ts +148 -0
- package/src/interaction-core/index.ts +3 -0
- package/src/interaction-core/publish.ts +189 -0
- package/src/interaction-core/subscribes.ts +82 -0
- package/src/props-manager/events.ts +28 -0
- package/src/props-manager/index.ts +3 -0
- package/src/props-manager/publish.ts +30 -0
- package/src/props-manager/subscribes.ts +17 -0
- package/src/render/events.ts +108 -0
- package/src/render/index.ts +3 -0
- package/src/render/publish.ts +215 -0
- package/src/render/subscribes.ts +67 -0
- package/src/scene-tree/events.ts +71 -0
- package/src/scene-tree/index.ts +4 -0
- package/src/scene-tree/publish.ts +93 -0
- package/src/scene-tree/stream.ts +5 -0
- package/src/scene-tree/subscribes.ts +35 -0
- package/src/selection/events.ts +10 -0
- package/src/selection/index.ts +3 -0
- package/src/selection/publish.ts +11 -0
- package/src/selection/subscribes.ts +6 -0
- package/src/system-context/index.ts +14 -0
- package/src/system-context/key-state/events.ts +9 -0
- package/src/system-context/key-state/index.ts +3 -0
- package/src/system-context/key-state/publish.ts +12 -0
- package/src/system-context/key-state/subscribes.ts +6 -0
- package/src/system-context/mouse-state/events.ts +9 -0
- package/src/system-context/mouse-state/index.ts +3 -0
- package/src/system-context/mouse-state/publish.ts +12 -0
- package/src/system-context/mouse-state/subscribes.ts +6 -0
- package/src/system-context/primary-tool/events.ts +34 -0
- package/src/system-context/primary-tool/index.ts +3 -0
- package/src/system-context/primary-tool/publish.ts +60 -0
- package/src/system-context/primary-tool/subscribes.ts +26 -0
- package/src/system-context/target-state/events.ts +10 -0
- package/src/system-context/target-state/index.ts +3 -0
- package/src/system-context/target-state/publish.ts +11 -0
- package/src/system-context/target-state/subscribes.ts +8 -0
- package/src/types.ts +161 -0
- package/src/ui-context/events.ts +16 -0
- package/src/ui-context/index.ts +3 -0
- package/src/ui-context/publish.ts +32 -0
- package/src/ui-context/subscribes.ts +16 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
|
2
|
+
import {
|
|
3
|
+
publishEvent,
|
|
4
|
+
createSubscribeEvent,
|
|
5
|
+
subscribeToEvents,
|
|
6
|
+
getEventBus,
|
|
7
|
+
createEventStream
|
|
8
|
+
} from '../event-bus'
|
|
9
|
+
import { EventTypes } from '../types'
|
|
10
|
+
|
|
11
|
+
// Mock event for testing
|
|
12
|
+
interface TestEvent {
|
|
13
|
+
type: EventTypes
|
|
14
|
+
payload: { message: string }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe('Event Bus - Communication Backbone', () => {
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
// Clear any existing events
|
|
20
|
+
const _eventBus = getEventBus()
|
|
21
|
+
// Note: ReplaySubject doesn't have a clear method, but we can work with it
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
describe('publishEvent', () => {
|
|
25
|
+
it('should demonstrate how events are published to the system', () => {
|
|
26
|
+
// Demonstrates: How components publish events to communicate
|
|
27
|
+
const mockSubscriber = vi.fn()
|
|
28
|
+
|
|
29
|
+
// Subscribe to all events
|
|
30
|
+
const subscription = subscribeToEvents(mockSubscriber)
|
|
31
|
+
|
|
32
|
+
// Publish a test event
|
|
33
|
+
const testEvent: TestEvent = {
|
|
34
|
+
type: EventTypes.ADD_ELEMENT,
|
|
35
|
+
payload: { message: 'Element created' }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
publishEvent(testEvent)
|
|
39
|
+
|
|
40
|
+
// Verify the event was received
|
|
41
|
+
expect(mockSubscriber).toHaveBeenCalledWith(testEvent)
|
|
42
|
+
|
|
43
|
+
subscription.unsubscribe()
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
describe('createSubscribeEvent', () => {
|
|
48
|
+
it('should demonstrate typed event subscription for specific event types', () => {
|
|
49
|
+
// Demonstrates: How components subscribe to specific event types
|
|
50
|
+
const mockSubscriber = vi.fn()
|
|
51
|
+
|
|
52
|
+
// Create a typed subscription for UNDO events (using a fresh event type)
|
|
53
|
+
const subscribeToUndo = createSubscribeEvent<TestEvent>(EventTypes.UNDO)
|
|
54
|
+
|
|
55
|
+
const subscription = subscribeToUndo(mockSubscriber)
|
|
56
|
+
|
|
57
|
+
// Publish different types of events
|
|
58
|
+
publishEvent({
|
|
59
|
+
type: EventTypes.UNDO,
|
|
60
|
+
payload: { message: 'This should be received' }
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
publishEvent({
|
|
64
|
+
type: EventTypes.REDO,
|
|
65
|
+
payload: { message: 'This should be filtered out' }
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
// Only UNDO events should be received
|
|
69
|
+
expect(mockSubscriber).toHaveBeenCalledTimes(1)
|
|
70
|
+
expect(mockSubscriber).toHaveBeenCalledWith({
|
|
71
|
+
type: EventTypes.UNDO,
|
|
72
|
+
payload: { message: 'This should be received' }
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
subscription.unsubscribe()
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('should handle multiple subscribers for the same event type', () => {
|
|
79
|
+
// Demonstrates: Multiple components can listen to the same events
|
|
80
|
+
const subscriber1 = vi.fn()
|
|
81
|
+
const subscriber2 = vi.fn()
|
|
82
|
+
|
|
83
|
+
const subscribeToSelect = createSubscribeEvent<TestEvent>(
|
|
84
|
+
EventTypes.SELECT_ELEMENTS
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
const sub1 = subscribeToSelect(subscriber1)
|
|
88
|
+
const sub2 = subscribeToSelect(subscriber2)
|
|
89
|
+
|
|
90
|
+
const selectEvent: TestEvent = {
|
|
91
|
+
type: EventTypes.SELECT_ELEMENTS,
|
|
92
|
+
payload: { message: 'Elements selected' }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
publishEvent(selectEvent)
|
|
96
|
+
|
|
97
|
+
// Both subscribers should receive the event
|
|
98
|
+
expect(subscriber1).toHaveBeenCalledWith(selectEvent)
|
|
99
|
+
expect(subscriber2).toHaveBeenCalledWith(selectEvent)
|
|
100
|
+
|
|
101
|
+
sub1.unsubscribe()
|
|
102
|
+
sub2.unsubscribe()
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
describe('createEventStream', () => {
|
|
107
|
+
it('should demonstrate reactive event streams for real-time updates', () => {
|
|
108
|
+
// Demonstrates: How to create reactive streams for continuous event monitoring
|
|
109
|
+
const reloadAction = vi.fn()
|
|
110
|
+
|
|
111
|
+
// Create a stream for transaction events with reload action
|
|
112
|
+
const transactionStream = createEventStream<TestEvent>(
|
|
113
|
+
EventTypes.START_TRANSACTION,
|
|
114
|
+
reloadAction
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
const streamSubscriber = vi.fn()
|
|
118
|
+
const subscription = transactionStream.subscribe(streamSubscriber)
|
|
119
|
+
|
|
120
|
+
// Publish transaction events
|
|
121
|
+
const startTransactionEvent: TestEvent = {
|
|
122
|
+
type: EventTypes.START_TRANSACTION,
|
|
123
|
+
payload: { message: 'Transaction started' }
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
publishEvent(startTransactionEvent)
|
|
127
|
+
|
|
128
|
+
// Both stream subscriber and reload action should be called
|
|
129
|
+
expect(streamSubscriber).toHaveBeenCalledWith(startTransactionEvent)
|
|
130
|
+
expect(reloadAction).toHaveBeenCalled()
|
|
131
|
+
|
|
132
|
+
subscription.unsubscribe()
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
it('should filter events correctly in streams', () => {
|
|
136
|
+
// Demonstrates: Event streams only receive their specific event types
|
|
137
|
+
const streamSubscriber = vi.fn()
|
|
138
|
+
|
|
139
|
+
const undoStream = createEventStream<TestEvent>(EventTypes.UNDO)
|
|
140
|
+
const subscription = undoStream.subscribe(streamSubscriber)
|
|
141
|
+
|
|
142
|
+
// Publish various events
|
|
143
|
+
publishEvent({
|
|
144
|
+
type: EventTypes.UNDO,
|
|
145
|
+
payload: { message: 'Undo action' }
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
publishEvent({
|
|
149
|
+
type: EventTypes.REDO,
|
|
150
|
+
payload: { message: 'Redo action' }
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
publishEvent({
|
|
154
|
+
type: EventTypes.UNDO,
|
|
155
|
+
payload: { message: 'Another undo' }
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
// Only UNDO events should be received
|
|
159
|
+
expect(streamSubscriber).toHaveBeenCalledTimes(2)
|
|
160
|
+
expect(streamSubscriber).toHaveBeenNthCalledWith(1, {
|
|
161
|
+
type: EventTypes.UNDO,
|
|
162
|
+
payload: { message: 'Undo action' }
|
|
163
|
+
})
|
|
164
|
+
expect(streamSubscriber).toHaveBeenNthCalledWith(2, {
|
|
165
|
+
type: EventTypes.UNDO,
|
|
166
|
+
payload: { message: 'Another undo' }
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
subscription.unsubscribe()
|
|
170
|
+
})
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
describe('event system integration', () => {
|
|
174
|
+
it('should demonstrate complete event flow from publish to multiple subscribers', () => {
|
|
175
|
+
// Demonstrates: Complete event communication flow in the system
|
|
176
|
+
const coreSubscriber = vi.fn()
|
|
177
|
+
const uiSubscriber = vi.fn()
|
|
178
|
+
const renderSubscriber = vi.fn()
|
|
179
|
+
|
|
180
|
+
// Different components subscribing to the same event
|
|
181
|
+
const subscribeToRender = createSubscribeEvent<TestEvent>(
|
|
182
|
+
EventTypes.INIT_RENDER
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
const coreSub = subscribeToRender(coreSubscriber)
|
|
186
|
+
const uiSub = subscribeToRender(uiSubscriber)
|
|
187
|
+
const renderSub = subscribeToRender(renderSubscriber)
|
|
188
|
+
|
|
189
|
+
// Simulate render initialization event
|
|
190
|
+
const renderEvent: TestEvent = {
|
|
191
|
+
type: EventTypes.INIT_RENDER,
|
|
192
|
+
payload: { message: 'Render system initializing' }
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
publishEvent(renderEvent)
|
|
196
|
+
|
|
197
|
+
// All components should receive the event
|
|
198
|
+
expect(coreSubscriber).toHaveBeenCalledWith(renderEvent)
|
|
199
|
+
expect(uiSubscriber).toHaveBeenCalledWith(renderEvent)
|
|
200
|
+
expect(renderSubscriber).toHaveBeenCalledWith(renderEvent)
|
|
201
|
+
|
|
202
|
+
// Clean up
|
|
203
|
+
coreSub.unsubscribe()
|
|
204
|
+
uiSub.unsubscribe()
|
|
205
|
+
renderSub.unsubscribe()
|
|
206
|
+
})
|
|
207
|
+
})
|
|
208
|
+
})
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import {
|
|
3
|
+
EventTypes,
|
|
4
|
+
CoreEventTypes,
|
|
5
|
+
InteractionCoreEventTypes,
|
|
6
|
+
SceneTreeEventTypes,
|
|
7
|
+
TransactionEventTypes,
|
|
8
|
+
SelectionEventTypes
|
|
9
|
+
} from '../types'
|
|
10
|
+
|
|
11
|
+
describe('Event Types - System Communication Contract', () => {
|
|
12
|
+
describe('event type definitions', () => {
|
|
13
|
+
it('should demonstrate core system events for orchestration', () => {
|
|
14
|
+
// Demonstrates: Core events that coordinate system-wide operations
|
|
15
|
+
expect(CoreEventTypes.CORE_ADD_ELEMENT).toBe('coreAddElement')
|
|
16
|
+
|
|
17
|
+
// Shows this is used for high-level element creation coordination
|
|
18
|
+
expect(EventTypes.CORE_ADD_ELEMENT).toBe(CoreEventTypes.CORE_ADD_ELEMENT)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('should demonstrate interaction events for user action processing', () => {
|
|
22
|
+
// Demonstrates: How user interactions are communicated through the system
|
|
23
|
+
const interactionEvents = [
|
|
24
|
+
InteractionCoreEventTypes.EXECUTE_ACTION,
|
|
25
|
+
InteractionCoreEventTypes.START_SESSION,
|
|
26
|
+
InteractionCoreEventTypes.UPDATE_SESSION,
|
|
27
|
+
InteractionCoreEventTypes.END_SESSION
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
// These events represent the interaction lifecycle
|
|
31
|
+
expect(interactionEvents).toEqual([
|
|
32
|
+
'executeAction',
|
|
33
|
+
'startSession',
|
|
34
|
+
'updateSession',
|
|
35
|
+
'endSession'
|
|
36
|
+
])
|
|
37
|
+
|
|
38
|
+
// Shows how user interactions flow through the system
|
|
39
|
+
expect(EventTypes.EXECUTE_ACTION).toBe('executeAction')
|
|
40
|
+
expect(EventTypes.START_SESSION).toBe('startSession')
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('should demonstrate decision events for interaction outcomes', () => {
|
|
44
|
+
// Demonstrates: How interaction decisions are communicated
|
|
45
|
+
const decisionEvents = [
|
|
46
|
+
InteractionCoreEventTypes.DECIDE_TO_CREATE_ELEMENT,
|
|
47
|
+
InteractionCoreEventTypes.DECIDE_TO_SELECT_ELEMENTS,
|
|
48
|
+
InteractionCoreEventTypes.DECIDE_TO_RESIZE_ELEMENT,
|
|
49
|
+
InteractionCoreEventTypes.DECIDE_TO_UNDOREDO
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
// These events represent decisions made by the interaction core
|
|
53
|
+
expect(decisionEvents).toEqual([
|
|
54
|
+
'decideToCreateElement',
|
|
55
|
+
'decideToSelectElements',
|
|
56
|
+
'decideToResizeElement',
|
|
57
|
+
'decideToUndoRedo'
|
|
58
|
+
])
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
describe('scene tree events', () => {
|
|
63
|
+
it('should demonstrate document model communication events', () => {
|
|
64
|
+
// Demonstrates: How document changes are communicated
|
|
65
|
+
const sceneEvents = [
|
|
66
|
+
SceneTreeEventTypes.SCENE_TREE_INIT,
|
|
67
|
+
SceneTreeEventTypes.SCENE_TREE_LOAD_DATA,
|
|
68
|
+
SceneTreeEventTypes.SCENE_TREE_SAVE_DATA,
|
|
69
|
+
SceneTreeEventTypes.SCENE_TREE_CHANGED
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
expect(sceneEvents).toEqual([
|
|
73
|
+
'sceneTreeInit',
|
|
74
|
+
'sceneTreeLoadData',
|
|
75
|
+
'sceneTreeSaveData',
|
|
76
|
+
'sceneTreeChanged'
|
|
77
|
+
])
|
|
78
|
+
|
|
79
|
+
// Shows the document lifecycle events
|
|
80
|
+
expect(EventTypes.SCENE_TREE_INIT).toBe('sceneTreeInit')
|
|
81
|
+
expect(EventTypes.SCENE_TREE_CHANGED).toBe('sceneTreeChanged')
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
describe('transaction events', () => {
|
|
86
|
+
it('should demonstrate undo/redo system communication', () => {
|
|
87
|
+
// Demonstrates: How transaction boundaries are communicated for undo/redo
|
|
88
|
+
const transactionEvents = [
|
|
89
|
+
TransactionEventTypes.START_TRANSACTION,
|
|
90
|
+
TransactionEventTypes.UPDATE_TRANSACTION,
|
|
91
|
+
TransactionEventTypes.END_TRANSACTION
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
expect(transactionEvents).toEqual([
|
|
95
|
+
'startTransaction',
|
|
96
|
+
'updateTransaction',
|
|
97
|
+
'endTransaction'
|
|
98
|
+
])
|
|
99
|
+
|
|
100
|
+
// Critical for undo/redo system - shows transaction boundaries
|
|
101
|
+
expect(EventTypes.START_TRANSACTION).toBe('startTransaction')
|
|
102
|
+
expect(EventTypes.END_TRANSACTION).toBe('endTransaction')
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
describe('selection events', () => {
|
|
107
|
+
it('should demonstrate element selection communication', () => {
|
|
108
|
+
// Demonstrates: How element selection is communicated across components
|
|
109
|
+
expect(SelectionEventTypes.SELECT_ELEMENTS).toBe('selectElements')
|
|
110
|
+
expect(EventTypes.SELECT_ELEMENTS).toBe('selectElements')
|
|
111
|
+
|
|
112
|
+
// This event is critical for UI synchronization
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
describe('event type consolidation', () => {
|
|
117
|
+
it('should demonstrate unified event type system', () => {
|
|
118
|
+
// Demonstrates: All event types are consolidated into single EventTypes object
|
|
119
|
+
// This ensures type safety and prevents event name conflicts
|
|
120
|
+
|
|
121
|
+
// Core events
|
|
122
|
+
expect(EventTypes.CORE_ADD_ELEMENT).toBeDefined()
|
|
123
|
+
|
|
124
|
+
// Interaction events
|
|
125
|
+
expect(EventTypes.EXECUTE_ACTION).toBeDefined()
|
|
126
|
+
expect(EventTypes.DECIDE_TO_CREATE_ELEMENT).toBeDefined()
|
|
127
|
+
|
|
128
|
+
// Scene tree events
|
|
129
|
+
expect(EventTypes.SCENE_TREE_INIT).toBeDefined()
|
|
130
|
+
expect(EventTypes.ADD_ELEMENT).toBeDefined()
|
|
131
|
+
|
|
132
|
+
// Transaction events
|
|
133
|
+
expect(EventTypes.START_TRANSACTION).toBeDefined()
|
|
134
|
+
expect(EventTypes.UNDO).toBeDefined()
|
|
135
|
+
|
|
136
|
+
// Selection events
|
|
137
|
+
expect(EventTypes.SELECT_ELEMENTS).toBeDefined()
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
it('should ensure no event type conflicts exist', () => {
|
|
141
|
+
// Demonstrates: Event type uniqueness prevents communication errors
|
|
142
|
+
const allEventValues = Object.values(EventTypes)
|
|
143
|
+
const uniqueEventValues = [...new Set(allEventValues)]
|
|
144
|
+
|
|
145
|
+
// All event types should be unique
|
|
146
|
+
expect(allEventValues.length).toBe(uniqueEventValues.length)
|
|
147
|
+
|
|
148
|
+
// This prevents accidental event conflicts that could cause bugs
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { EVENT_OPTIONS, UNDO } from '@asyra/utils'
|
|
2
|
+
import type { EventTypes } from '../types'
|
|
3
|
+
|
|
4
|
+
export interface RenderIsReadyEvent {
|
|
5
|
+
type: EventTypes
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface FileLoadCompleteEvent {
|
|
9
|
+
type: EventTypes
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface StartTransactionEvent {
|
|
13
|
+
type: EventTypes
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface UpdateTransactionEvent {
|
|
17
|
+
type: EventTypes
|
|
18
|
+
eventName: string
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
|
+
payload: any
|
|
21
|
+
options?: EVENT_OPTIONS
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface EndTransactionEvent {
|
|
25
|
+
type: EventTypes
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface UpdateUndoRedoStatusEvent {
|
|
29
|
+
type: EventTypes
|
|
30
|
+
payload: {
|
|
31
|
+
status: UNDO
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface UndoEvent {
|
|
36
|
+
type: EventTypes
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface RedoEvent {
|
|
40
|
+
type: EventTypes
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type AppEvent =
|
|
44
|
+
| RenderIsReadyEvent
|
|
45
|
+
| FileLoadCompleteEvent
|
|
46
|
+
| StartTransactionEvent
|
|
47
|
+
| UpdateTransactionEvent
|
|
48
|
+
| EndTransactionEvent
|
|
49
|
+
| UpdateUndoRedoStatusEvent
|
|
50
|
+
| UndoEvent
|
|
51
|
+
| RedoEvent
|
package/src/app/index.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { EVENT_OPTIONS, UNDO } from '@asyra/utils'
|
|
2
|
+
import { publishEvent } from '../event-bus'
|
|
3
|
+
import { EventTypes } from '../types'
|
|
4
|
+
|
|
5
|
+
export const renderIsReady = () => {
|
|
6
|
+
publishEvent({
|
|
7
|
+
type: EventTypes.RENDER_IS_READY
|
|
8
|
+
})
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const fileLoadComplete = () => {
|
|
12
|
+
publishEvent({
|
|
13
|
+
type: EventTypes.FILE_LOAD_COMPLETE
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const startTransaction = () => {
|
|
18
|
+
publishEvent({
|
|
19
|
+
type: EventTypes.START_TRANSACTION
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const updateTransaction = (
|
|
24
|
+
eventName: string,
|
|
25
|
+
payload: unknown,
|
|
26
|
+
options?: EVENT_OPTIONS
|
|
27
|
+
) => {
|
|
28
|
+
publishEvent({
|
|
29
|
+
type: EventTypes.UPDATE_TRANSACTION,
|
|
30
|
+
eventName: eventName,
|
|
31
|
+
payload: payload,
|
|
32
|
+
options
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const endTransaction = () => {
|
|
37
|
+
publishEvent({
|
|
38
|
+
type: EventTypes.END_TRANSACTION
|
|
39
|
+
})
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const updateUndoRedoStatus = (status: UNDO) => {
|
|
43
|
+
publishEvent({
|
|
44
|
+
type: EventTypes.UPDATE_UNDOREDO_STATUS,
|
|
45
|
+
payload: {
|
|
46
|
+
status
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const undo = () => {
|
|
52
|
+
publishEvent({
|
|
53
|
+
type: EventTypes.UNDO
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const redo = () => {
|
|
58
|
+
publishEvent({
|
|
59
|
+
type: EventTypes.REDO
|
|
60
|
+
})
|
|
61
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FileLoadCompleteEvent,
|
|
3
|
+
StartTransactionEvent,
|
|
4
|
+
UpdateTransactionEvent,
|
|
5
|
+
EndTransactionEvent,
|
|
6
|
+
UpdateUndoRedoStatusEvent,
|
|
7
|
+
RenderIsReadyEvent,
|
|
8
|
+
UndoEvent,
|
|
9
|
+
RedoEvent
|
|
10
|
+
} from './events'
|
|
11
|
+
import { createSubscribeEvent } from '../event-bus'
|
|
12
|
+
import { EventTypes } from '../types'
|
|
13
|
+
|
|
14
|
+
export const subscribeToRenderIsReady =
|
|
15
|
+
createSubscribeEvent<RenderIsReadyEvent>(EventTypes.RENDER_IS_READY)
|
|
16
|
+
|
|
17
|
+
export const subscribeToFileLoadComplete =
|
|
18
|
+
createSubscribeEvent<FileLoadCompleteEvent>(EventTypes.FILE_LOAD_COMPLETE)
|
|
19
|
+
|
|
20
|
+
export const subscribeToStartTransaction =
|
|
21
|
+
createSubscribeEvent<StartTransactionEvent>(EventTypes.START_TRANSACTION)
|
|
22
|
+
|
|
23
|
+
export const subscribeToUpdateTransaction =
|
|
24
|
+
createSubscribeEvent<UpdateTransactionEvent>(EventTypes.UPDATE_TRANSACTION)
|
|
25
|
+
|
|
26
|
+
export const subscribeToEndTransaction =
|
|
27
|
+
createSubscribeEvent<EndTransactionEvent>(EventTypes.END_TRANSACTION)
|
|
28
|
+
|
|
29
|
+
export const subscribeToUpdateUndoRedoStatus =
|
|
30
|
+
createSubscribeEvent<UpdateUndoRedoStatusEvent>(
|
|
31
|
+
EventTypes.UPDATE_UNDOREDO_STATUS
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
export const subscribeToUndo = createSubscribeEvent<UndoEvent>(EventTypes.UNDO)
|
|
35
|
+
|
|
36
|
+
export const subscribeToRedo = createSubscribeEvent<RedoEvent>(EventTypes.REDO)
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AppEvent } from './app'
|
|
2
|
+
import type { CoreEvents } from './core'
|
|
3
|
+
import type { SceneTreeEvents } from './scene-tree'
|
|
4
|
+
import type { SelectionEvents } from './selection'
|
|
5
|
+
import type { PropEvents } from './props-manager'
|
|
6
|
+
import type { UIContextEvents } from './ui-context'
|
|
7
|
+
import type { RenderEvents } from './render'
|
|
8
|
+
import type { InputSystemEvents } from './input-system'
|
|
9
|
+
import type { InteractionCoreEvents } from './interaction-core'
|
|
10
|
+
import type { KeyStateEvents } from './system-context'
|
|
11
|
+
|
|
12
|
+
export type AllEvent =
|
|
13
|
+
| AppEvent
|
|
14
|
+
| CoreEvents
|
|
15
|
+
| SceneTreeEvents
|
|
16
|
+
| SelectionEvents
|
|
17
|
+
| PropEvents
|
|
18
|
+
| UIContextEvents
|
|
19
|
+
| RenderEvents
|
|
20
|
+
| InputSystemEvents
|
|
21
|
+
| InteractionCoreEvents
|
|
22
|
+
| KeyStateEvents
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PositionData, DimensionData } from '@asyra/utils'
|
|
2
|
+
import { publishEvent } from '../event-bus'
|
|
3
|
+
import { EventTypes } from '../types'
|
|
4
|
+
|
|
5
|
+
export const coreAddElement = (data: PositionData & Partial<DimensionData>) => {
|
|
6
|
+
publishEvent({
|
|
7
|
+
type: EventTypes.CORE_ADD_ELEMENT,
|
|
8
|
+
payload: {
|
|
9
|
+
...data
|
|
10
|
+
}
|
|
11
|
+
})
|
|
12
|
+
}
|
package/src/event-bus.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Observable,
|
|
3
|
+
Subscription,
|
|
4
|
+
filter,
|
|
5
|
+
share,
|
|
6
|
+
UnaryFunction,
|
|
7
|
+
ReplaySubject
|
|
8
|
+
} from 'rxjs'
|
|
9
|
+
import { EventTypes } from './types'
|
|
10
|
+
import { AllEvent } from './constants'
|
|
11
|
+
|
|
12
|
+
const eventBus = new ReplaySubject<AllEvent>(1)
|
|
13
|
+
|
|
14
|
+
export const publishEvent = (event: AllEvent) => {
|
|
15
|
+
eventBus.next(event)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const DefaultOperator = <T extends AllEvent>(
|
|
19
|
+
type: EventTypes
|
|
20
|
+
): UnaryFunction<Observable<T>, Observable<AllEvent>> => {
|
|
21
|
+
return filter((event: AllEvent): event is T => event.type === type)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type AppOperatorFunction<T extends AllEvent> = UnaryFunction<
|
|
25
|
+
Observable<T>,
|
|
26
|
+
Observable<AllEvent>
|
|
27
|
+
>
|
|
28
|
+
export const createSubscribeEvent = <T extends AllEvent>(
|
|
29
|
+
type: EventTypes,
|
|
30
|
+
operators: [...AppOperatorFunction<T>[]] = [],
|
|
31
|
+
defaultIndex = 0
|
|
32
|
+
) => {
|
|
33
|
+
return (subscriber: (event: T) => void): Subscription => {
|
|
34
|
+
const pipeline = [...operators]
|
|
35
|
+
pipeline.splice(defaultIndex, 0, DefaultOperator<T>(type))
|
|
36
|
+
|
|
37
|
+
const final$ = pipeline.reduce(
|
|
38
|
+
(observer, op) => observer.pipe(op),
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
+
getEventBusObserve() as Observable<any>
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
return final$.subscribe(subscriber)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const subscribeToEvents = (
|
|
48
|
+
subscriber: (event: AllEvent) => void
|
|
49
|
+
): Subscription => {
|
|
50
|
+
return getEventBusObserve().subscribe(subscriber)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const getEventBus = (): ReplaySubject<AllEvent> => eventBus
|
|
54
|
+
export const getEventBusObserve = (): Observable<AllEvent> =>
|
|
55
|
+
eventBus.asObservable()
|
|
56
|
+
|
|
57
|
+
export const createEventStream = <T extends AllEvent>(
|
|
58
|
+
eventType: EventTypes,
|
|
59
|
+
reloadAction?: () => void
|
|
60
|
+
) => {
|
|
61
|
+
const eventStream = getEventBusObserve().pipe(
|
|
62
|
+
filter((event): event is T => event.type === eventType),
|
|
63
|
+
share()
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
if (reloadAction) {
|
|
67
|
+
eventStream.subscribe(() => reloadAction())
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return eventStream
|
|
71
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './constants'
|
|
2
|
+
export * from './types'
|
|
3
|
+
export * from './core'
|
|
4
|
+
export * from './app'
|
|
5
|
+
export * from './event-bus'
|
|
6
|
+
export * from './props-manager'
|
|
7
|
+
export * from './scene-tree'
|
|
8
|
+
export * from './selection'
|
|
9
|
+
export * from './ui-context'
|
|
10
|
+
export * from './render'
|
|
11
|
+
export * from './system-context'
|
|
12
|
+
export * from './input-system'
|
|
13
|
+
export * from './interaction-core'
|