@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,512 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Project,
|
|
3
|
+
SyntaxKind,
|
|
4
|
+
QuoteKind,
|
|
5
|
+
IndentationText,
|
|
6
|
+
VariableDeclarationKind
|
|
7
|
+
} from 'ts-morph'
|
|
8
|
+
import { Command } from 'commander'
|
|
9
|
+
import inquirer from 'inquirer'
|
|
10
|
+
import chalk from 'chalk'
|
|
11
|
+
import path from 'path'
|
|
12
|
+
import fs from 'fs'
|
|
13
|
+
|
|
14
|
+
// --- Configuration ---
|
|
15
|
+
const PACKAGES_DIR = path.resolve(__dirname, '../../..', 'packages')
|
|
16
|
+
const UTILS_PKG = path.join(PACKAGES_DIR, 'utils')
|
|
17
|
+
const REACTIVE_EVENTS_PKG = path.join(PACKAGES_DIR, 'reactive-events')
|
|
18
|
+
const INTERACTION_CORE_PKG = path.join(PACKAGES_DIR, 'interaction-core')
|
|
19
|
+
const CORE_PKG = path.join(PACKAGES_DIR, 'core')
|
|
20
|
+
|
|
21
|
+
// --- Helpers ---
|
|
22
|
+
const toPascalCase = (str: string) =>
|
|
23
|
+
str
|
|
24
|
+
.replace(/(?:^\w|[A-Z]|\b\w)/g, (word) => word.toUpperCase())
|
|
25
|
+
.replace(/[\s-_]+/g, '')
|
|
26
|
+
|
|
27
|
+
const toKebabCase = (str: string) =>
|
|
28
|
+
str
|
|
29
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
30
|
+
.replace(/[\s_]+/g, '-')
|
|
31
|
+
.toLowerCase()
|
|
32
|
+
|
|
33
|
+
const toConstantCase = (str: string) =>
|
|
34
|
+
str
|
|
35
|
+
.replace(/([a-z])([A-Z])/g, '$1_$2')
|
|
36
|
+
.replace(/[\s-]+/g, '_')
|
|
37
|
+
.toUpperCase()
|
|
38
|
+
|
|
39
|
+
const logSuccess = (msg: string) => console.log(chalk.green(`✔ ${msg}`))
|
|
40
|
+
const logInfo = (msg: string) => console.log(chalk.blue(`ℹ ${msg}`))
|
|
41
|
+
const logWarning = (msg: string) => console.log(chalk.yellow(`⚠ ${msg}`))
|
|
42
|
+
const logStep = (msg: string) => console.log(chalk.cyan(`\n➤ ${msg}`))
|
|
43
|
+
|
|
44
|
+
// --- Main Script ---
|
|
45
|
+
const program = new Command()
|
|
46
|
+
|
|
47
|
+
program
|
|
48
|
+
.name('gen:interaction')
|
|
49
|
+
.description('Generate new Interaction Flow boilerplate')
|
|
50
|
+
.action(async () => {
|
|
51
|
+
console.log(chalk.bold.magenta('\n🚀 Interaction Architect CLI \n'))
|
|
52
|
+
|
|
53
|
+
// 1. Inputs
|
|
54
|
+
const answers = await inquirer.prompt([
|
|
55
|
+
{
|
|
56
|
+
type: 'input',
|
|
57
|
+
name: 'interactionName',
|
|
58
|
+
message: 'Interaction Name (e.g. RotateElement):',
|
|
59
|
+
validate: (input) => !!input || 'Interaction Name is required'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'input',
|
|
63
|
+
name: 'scope',
|
|
64
|
+
message: 'Scope (folder name, e.g. transform):',
|
|
65
|
+
validate: (input) => !!input || 'Scope is required'
|
|
66
|
+
}
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
const { interactionName, scope } = answers
|
|
70
|
+
|
|
71
|
+
const pascalName = toPascalCase(interactionName)
|
|
72
|
+
const constantName = `INTERACTION_${toConstantCase(interactionName)}`
|
|
73
|
+
const kebabName = toKebabCase(interactionName)
|
|
74
|
+
const kebabScope = toKebabCase(scope)
|
|
75
|
+
const scopeDirInteraction = path.join(
|
|
76
|
+
INTERACTION_CORE_PKG,
|
|
77
|
+
'src',
|
|
78
|
+
'handlers'
|
|
79
|
+
)
|
|
80
|
+
const scopeDirDeciderBehavior = path.join(
|
|
81
|
+
INTERACTION_CORE_PKG,
|
|
82
|
+
'src',
|
|
83
|
+
'decider',
|
|
84
|
+
'behavior'
|
|
85
|
+
)
|
|
86
|
+
const scopeDirDeciderRules = path.join(
|
|
87
|
+
INTERACTION_CORE_PKG,
|
|
88
|
+
'src',
|
|
89
|
+
'decider',
|
|
90
|
+
'rules'
|
|
91
|
+
)
|
|
92
|
+
const scopeDirCoreSub = path.join(
|
|
93
|
+
CORE_PKG,
|
|
94
|
+
'src',
|
|
95
|
+
'subscribes',
|
|
96
|
+
'interaction-core'
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
// Init Project
|
|
100
|
+
const project = new Project({
|
|
101
|
+
manipulationSettings: {
|
|
102
|
+
quoteKind: QuoteKind.Single,
|
|
103
|
+
indentationText: IndentationText.TwoSpaces
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
logStep('Step 1: Updating Global Registry (@asyra/utils)')
|
|
108
|
+
await updateRegistry(project, pascalName, constantName)
|
|
109
|
+
|
|
110
|
+
logStep('Step 2: Generating Reactive Events')
|
|
111
|
+
await updateReactiveEvents(project, pascalName, constantName, kebabName)
|
|
112
|
+
|
|
113
|
+
logStep('Step 3: Generating Interaction Core Logic')
|
|
114
|
+
await generateInteractionCore(
|
|
115
|
+
project,
|
|
116
|
+
pascalName,
|
|
117
|
+
constantName,
|
|
118
|
+
kebabName,
|
|
119
|
+
kebabScope,
|
|
120
|
+
scopeDirDeciderBehavior,
|
|
121
|
+
scopeDirDeciderRules,
|
|
122
|
+
scopeDirInteraction
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
logStep('Step 4: Generating Core Subscriptions')
|
|
126
|
+
await generateCoreSubscription(
|
|
127
|
+
project,
|
|
128
|
+
pascalName,
|
|
129
|
+
kebabName,
|
|
130
|
+
kebabScope,
|
|
131
|
+
scopeDirCoreSub
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
logStep('Finalizing...')
|
|
135
|
+
await project.save()
|
|
136
|
+
logSuccess('All files generated successfully!')
|
|
137
|
+
|
|
138
|
+
// --- NEXT STEPS LOG ---
|
|
139
|
+
console.log(chalk.bold.yellow('\n👉 NEXT STEPS CHECKLIST:'))
|
|
140
|
+
console.log(
|
|
141
|
+
`1. [LOGIC] Edit ${chalk.cyan(
|
|
142
|
+
`packages/interaction-core/src/decider/rules/${kebabName}-rules.ts`
|
|
143
|
+
)} definitions.`
|
|
144
|
+
)
|
|
145
|
+
console.log(
|
|
146
|
+
'2. [FLOW] Hook your behavior in a Behavior file (e.g. drag-start-behavior.ts):'
|
|
147
|
+
)
|
|
148
|
+
console.log(
|
|
149
|
+
chalk.gray(
|
|
150
|
+
` import { decideFrom${pascalName}Behavior } from './${kebabName}-behavior'\n // inside switch/case:\n return decideFrom${pascalName}Behavior(snapshot)`
|
|
151
|
+
)
|
|
152
|
+
)
|
|
153
|
+
console.log(
|
|
154
|
+
`3. [API] Implement the actual system call in ${chalk.cyan(
|
|
155
|
+
`packages/core/src/subscribes/interaction-core/${kebabScope}.ts`
|
|
156
|
+
)}.`
|
|
157
|
+
)
|
|
158
|
+
console.log('\nHappy Coding! 🚀\n')
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
// --- Sub-functions ---
|
|
162
|
+
|
|
163
|
+
async function updateRegistry(
|
|
164
|
+
project: Project,
|
|
165
|
+
pascalName: string,
|
|
166
|
+
constantName: string
|
|
167
|
+
) {
|
|
168
|
+
const filePath = path.join(
|
|
169
|
+
UTILS_PKG,
|
|
170
|
+
'src',
|
|
171
|
+
'constants',
|
|
172
|
+
'interaction-types.ts'
|
|
173
|
+
)
|
|
174
|
+
const sourceFile = project.addSourceFileAtPath(filePath)
|
|
175
|
+
|
|
176
|
+
// Find the InteractionActions variable declaration
|
|
177
|
+
const variableDecl = sourceFile.getVariableDeclaration('InteractionActions')
|
|
178
|
+
if (!variableDecl) {
|
|
179
|
+
logWarning(
|
|
180
|
+
'Could not find InteractionActions constant. Skipping registry update.'
|
|
181
|
+
)
|
|
182
|
+
return
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Find the object literal initializer
|
|
186
|
+
const objectLiteral = variableDecl?.getInitializerIfKind(
|
|
187
|
+
SyntaxKind.ObjectLiteralExpression
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
if (objectLiteral) {
|
|
191
|
+
// We want to add a new enum for this interaction type first
|
|
192
|
+
// But for simplicity in this generated script, we will just add the Key-Value pair to the Enum if possible
|
|
193
|
+
// Actually, the Utils file has separate enums spread into the object.
|
|
194
|
+
// It's cleaner to create a new Enum or append to a "Misc" one.
|
|
195
|
+
// Let's check for a "GeneralInteraction" or create one if needed?
|
|
196
|
+
// For simplicity, we will append it to a new Enum block at the end of file and spread it.
|
|
197
|
+
|
|
198
|
+
// 1. Create the new Enum
|
|
199
|
+
const enumName = `${pascalName}Interaction` // e.g. RotateElementInteraction
|
|
200
|
+
|
|
201
|
+
// Check if enum exists (unlikely for new feature)
|
|
202
|
+
let enumDecl = sourceFile.getEnum(enumName)
|
|
203
|
+
if (!enumDecl) {
|
|
204
|
+
enumDecl = sourceFile.addEnum({
|
|
205
|
+
name: enumName,
|
|
206
|
+
isExported: true,
|
|
207
|
+
members: [
|
|
208
|
+
{
|
|
209
|
+
name: constantName,
|
|
210
|
+
value: constantName
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
})
|
|
214
|
+
logInfo(`Created new Enum: ${enumName}`)
|
|
215
|
+
|
|
216
|
+
// 2. Add spread to InteractionActions
|
|
217
|
+
// We need to assume the structure: const InteractionActions = { ...Enum1, ...Enum2 }
|
|
218
|
+
objectLiteral.addSpreadAssignment({ expression: enumName })
|
|
219
|
+
logInfo(`Added spread assignment for ${enumName}`)
|
|
220
|
+
} else {
|
|
221
|
+
// Enum exists, append member
|
|
222
|
+
if (!enumDecl.getMember(constantName)) {
|
|
223
|
+
enumDecl.addMember({
|
|
224
|
+
name: constantName,
|
|
225
|
+
value: constantName
|
|
226
|
+
})
|
|
227
|
+
logInfo(`Updated Enum ${enumName}`)
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async function updateReactiveEvents(
|
|
234
|
+
project: Project,
|
|
235
|
+
pascalName: string,
|
|
236
|
+
constantName: string,
|
|
237
|
+
kebabName: string
|
|
238
|
+
) {
|
|
239
|
+
const eventsDir = path.join(REACTIVE_EVENTS_PKG, 'src', 'interaction-core')
|
|
240
|
+
|
|
241
|
+
// 1. events.ts - Add Interface
|
|
242
|
+
const eventsFile = project.addSourceFileAtPath(
|
|
243
|
+
path.join(eventsDir, 'events.ts')
|
|
244
|
+
)
|
|
245
|
+
const interfaceName = `DecideTo${pascalName}Event`
|
|
246
|
+
|
|
247
|
+
if (!eventsFile.getInterface(interfaceName)) {
|
|
248
|
+
eventsFile.addInterface({
|
|
249
|
+
name: interfaceName,
|
|
250
|
+
isExported: true,
|
|
251
|
+
properties: [
|
|
252
|
+
{ name: 'type', type: 'EventTypes' },
|
|
253
|
+
{ name: 'payload', type: '{ /* TODO: Add payload properties */ }' }
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
// Update Union Type
|
|
258
|
+
const typeAlias = eventsFile.getTypeAlias('InteractionCoreEvents')
|
|
259
|
+
if (typeAlias) {
|
|
260
|
+
const typeNode = typeAlias.getTypeNode()
|
|
261
|
+
if (typeNode) {
|
|
262
|
+
const currentType = typeNode.getText()
|
|
263
|
+
typeAlias.setType(`${currentType} | ${interfaceName}`)
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
logInfo(`Added interface ${interfaceName}`)
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// 2. publish.ts
|
|
270
|
+
const publishFile = project.addSourceFileAtPath(
|
|
271
|
+
path.join(eventsDir, 'publish.ts')
|
|
272
|
+
)
|
|
273
|
+
const funcName = `decideTo${pascalName}`
|
|
274
|
+
|
|
275
|
+
if (!publishFile.getFunction(funcName)) {
|
|
276
|
+
publishFile.addFunction({
|
|
277
|
+
name: funcName,
|
|
278
|
+
isExported: true,
|
|
279
|
+
parameters: [{ name: 'payload', type: 'any' }], // Generic for now
|
|
280
|
+
statements: `publishEvent({
|
|
281
|
+
type: EventTypes.DECIDE_TO_${toConstantCase(pascalName)},
|
|
282
|
+
payload
|
|
283
|
+
})`
|
|
284
|
+
})
|
|
285
|
+
logInfo(`Added publisher ${funcName}`)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// 3. subscribes.ts
|
|
289
|
+
const subscribesFile = project.addSourceFileAtPath(
|
|
290
|
+
path.join(eventsDir, 'subscribes.ts')
|
|
291
|
+
)
|
|
292
|
+
const subFuncName = `subscribeToDecideTo${pascalName}`
|
|
293
|
+
|
|
294
|
+
if (!subscribesFile.getFunction(subFuncName)) {
|
|
295
|
+
// Need to add import
|
|
296
|
+
subscribesFile.addImportDeclaration({
|
|
297
|
+
namedImports: [interfaceName],
|
|
298
|
+
moduleSpecifier: './events'
|
|
299
|
+
})
|
|
300
|
+
|
|
301
|
+
subscribesFile.addVariableStatement({
|
|
302
|
+
declarationKind: VariableDeclarationKind.Const,
|
|
303
|
+
isExported: true,
|
|
304
|
+
declarations: [
|
|
305
|
+
{
|
|
306
|
+
name: subFuncName,
|
|
307
|
+
initializer: `createSubscribeEvent<${interfaceName}>(EventTypes.DECIDE_TO_${toConstantCase(pascalName)})`
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
})
|
|
311
|
+
logInfo(`Added subscriber ${subFuncName}`)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// 4. types.ts (EventTypes Enum)
|
|
315
|
+
// This is usually in a simpler location ../types.ts
|
|
316
|
+
const typesFile = project.addSourceFileAtPath(
|
|
317
|
+
path.join(REACTIVE_EVENTS_PKG, 'src', 'types.ts')
|
|
318
|
+
)
|
|
319
|
+
const eventTypesEnum = typesFile.getEnum('EventTypes')
|
|
320
|
+
const eventTypeKey = `DECIDE_TO_${toConstantCase(pascalName)}`
|
|
321
|
+
|
|
322
|
+
if (eventTypesEnum && !eventTypesEnum.getMember(eventTypeKey)) {
|
|
323
|
+
eventTypesEnum?.addMember({
|
|
324
|
+
name: eventTypeKey,
|
|
325
|
+
value: eventTypeKey
|
|
326
|
+
})
|
|
327
|
+
logInfo(`Added EventType ${eventTypeKey}`)
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
async function generateInteractionCore(
|
|
332
|
+
project: Project,
|
|
333
|
+
pascalName: string,
|
|
334
|
+
constantName: string,
|
|
335
|
+
kebabName: string,
|
|
336
|
+
kebabScope: string,
|
|
337
|
+
scopeDirBehavior: string,
|
|
338
|
+
scopeDirRules: string,
|
|
339
|
+
scopeDirHandlers: string
|
|
340
|
+
) {
|
|
341
|
+
// 1. Rules
|
|
342
|
+
const rulesFile = project.createSourceFile(
|
|
343
|
+
path.join(scopeDirRules, `${kebabName}-rules.ts`),
|
|
344
|
+
`import { InteractionActions, InteractionEvent, SystemContextSnapshot } from '@asyra/utils'
|
|
345
|
+
|
|
346
|
+
export const decideFrom${pascalName}Rules = (
|
|
347
|
+
systemContextSnapshot: SystemContextSnapshot
|
|
348
|
+
): InteractionEvent | null => {
|
|
349
|
+
// TODO: Add logic here
|
|
350
|
+
const { primaryTool } = systemContextSnapshot
|
|
351
|
+
|
|
352
|
+
// Example condition
|
|
353
|
+
/*
|
|
354
|
+
if (primaryTool === 'SOME_TOOL') {
|
|
355
|
+
return {
|
|
356
|
+
type: InteractionActions.${constantName},
|
|
357
|
+
payload: {}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
*/
|
|
361
|
+
return null
|
|
362
|
+
}`,
|
|
363
|
+
{ overwrite: true }
|
|
364
|
+
)
|
|
365
|
+
logInfo(`Created Rules: ${rulesFile.getBaseName()}`)
|
|
366
|
+
|
|
367
|
+
// Update Rules index
|
|
368
|
+
const rulesIndex = project.addSourceFileAtPath(
|
|
369
|
+
path.join(scopeDirRules, 'index.ts')
|
|
370
|
+
)
|
|
371
|
+
rulesIndex.addExportDeclaration({ moduleSpecifier: `./${kebabName}-rules` })
|
|
372
|
+
|
|
373
|
+
// 2. Behavior
|
|
374
|
+
const behaviorFile = project.createSourceFile(
|
|
375
|
+
path.join(scopeDirBehavior, `${kebabName}-behavior.ts`),
|
|
376
|
+
`import { InteractionEvent, SystemContextSnapshot } from '@asyra/utils'
|
|
377
|
+
import { decideFrom${pascalName}Rules } from '../rules'
|
|
378
|
+
|
|
379
|
+
export const decide${pascalName}Behavior = (
|
|
380
|
+
systemContextSnapshot: SystemContextSnapshot
|
|
381
|
+
): InteractionEvent | null => {
|
|
382
|
+
return decideFrom${pascalName}Rules(systemContextSnapshot)
|
|
383
|
+
}`,
|
|
384
|
+
{ overwrite: true }
|
|
385
|
+
)
|
|
386
|
+
logInfo(`Created Behavior: ${behaviorFile.getBaseName()}`)
|
|
387
|
+
|
|
388
|
+
// Update Behavior Index
|
|
389
|
+
const behaviorIndex = project.addSourceFileAtPath(
|
|
390
|
+
path.join(scopeDirBehavior, 'index.ts')
|
|
391
|
+
)
|
|
392
|
+
behaviorIndex.addExportDeclaration({
|
|
393
|
+
moduleSpecifier: `./${kebabName}-behavior`
|
|
394
|
+
})
|
|
395
|
+
|
|
396
|
+
// 3. Handlers
|
|
397
|
+
// Check if scope file exists
|
|
398
|
+
const handlerPath = path.join(scopeDirHandlers, `${kebabScope}.ts`)
|
|
399
|
+
let handlerFile
|
|
400
|
+
const handlerVarName = `${toPascalCase(kebabScope)}Handlers` // e.g. TransformHandlers
|
|
401
|
+
|
|
402
|
+
if (fs.existsSync(handlerPath)) {
|
|
403
|
+
handlerFile = project.addSourceFileAtPath(handlerPath)
|
|
404
|
+
// Add to existing object
|
|
405
|
+
const handlerObj = handlerFile
|
|
406
|
+
.getVariableDeclaration(handlerVarName)
|
|
407
|
+
?.getInitializerIfKind(SyntaxKind.ObjectLiteralExpression)
|
|
408
|
+
|
|
409
|
+
if (handlerObj) {
|
|
410
|
+
handlerObj.addPropertyAssignment({
|
|
411
|
+
name: `[InteractionActions.${constantName}]`,
|
|
412
|
+
initializer: `(payload?: InteractionEvent['payload']) => {
|
|
413
|
+
// TODO: Call Reactive Event Publisher
|
|
414
|
+
// decideTo${pascalName}(payload)
|
|
415
|
+
}`
|
|
416
|
+
})
|
|
417
|
+
}
|
|
418
|
+
} else {
|
|
419
|
+
// Create new
|
|
420
|
+
handlerFile = project.createSourceFile(
|
|
421
|
+
handlerPath,
|
|
422
|
+
`import { InteractionActions, InteractionEvent } from '@asyra/utils'
|
|
423
|
+
// import { decideTo${pascalName} } from '@asyra/reactive-events'
|
|
424
|
+
|
|
425
|
+
export const ${handlerVarName} = {
|
|
426
|
+
[InteractionActions.${constantName}]: (
|
|
427
|
+
payload?: InteractionEvent['payload']
|
|
428
|
+
) => {
|
|
429
|
+
// decideTo${pascalName}(payload)
|
|
430
|
+
}
|
|
431
|
+
}`
|
|
432
|
+
)
|
|
433
|
+
// Update Handlers Index
|
|
434
|
+
const handlersIndex = project.addSourceFileAtPath(
|
|
435
|
+
path.join(scopeDirHandlers, 'index.ts')
|
|
436
|
+
)
|
|
437
|
+
handlersIndex.addImportDeclaration({
|
|
438
|
+
namedImports: [handlerVarName],
|
|
439
|
+
moduleSpecifier: `./${kebabScope}`
|
|
440
|
+
})
|
|
441
|
+
|
|
442
|
+
// Update the export object
|
|
443
|
+
const exportVar = handlersIndex.getVariableDeclaration(
|
|
444
|
+
'InteractionCoreHandlers'
|
|
445
|
+
)
|
|
446
|
+
const exportObj = exportVar?.getInitializerIfKind(
|
|
447
|
+
SyntaxKind.ObjectLiteralExpression
|
|
448
|
+
)
|
|
449
|
+
if (exportObj) {
|
|
450
|
+
exportObj.addSpreadAssignment({ expression: handlerVarName })
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
logInfo(`Updated Handlers: ${handlerFile.getBaseName()}`)
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
async function generateCoreSubscription(
|
|
457
|
+
project: Project,
|
|
458
|
+
pascalName: string,
|
|
459
|
+
kebabName: string,
|
|
460
|
+
kebabScope: string,
|
|
461
|
+
scopeDir: string
|
|
462
|
+
) {
|
|
463
|
+
const filePath = path.join(scopeDir, `${kebabScope}.ts`)
|
|
464
|
+
const funcName = `init${toPascalCase(kebabScope)}Handlers` // e.g. initTransformHandlers
|
|
465
|
+
let sourceFile
|
|
466
|
+
|
|
467
|
+
if (fs.existsSync(filePath)) {
|
|
468
|
+
sourceFile = project.addSourceFileAtPath(filePath)
|
|
469
|
+
const func = sourceFile.getFunction(funcName)
|
|
470
|
+
if (func) {
|
|
471
|
+
func.addStatements(`
|
|
472
|
+
subscribeToDecideTo${pascalName}(({ payload }) => {
|
|
473
|
+
// apis.doSomething(payload)
|
|
474
|
+
})`)
|
|
475
|
+
// Add Import
|
|
476
|
+
sourceFile.addImportDeclaration({
|
|
477
|
+
namedImports: [`subscribeToDecideTo${pascalName}`],
|
|
478
|
+
moduleSpecifier: '@asyra/reactive-events'
|
|
479
|
+
})
|
|
480
|
+
}
|
|
481
|
+
} else {
|
|
482
|
+
sourceFile = project.createSourceFile(
|
|
483
|
+
filePath,
|
|
484
|
+
`import { subscribeToDecideTo${pascalName} } from '@asyra/reactive-events'
|
|
485
|
+
import { HandlerDeps, SceneTreeHandlerAPIs } from '../../types'
|
|
486
|
+
|
|
487
|
+
export const ${funcName} = (
|
|
488
|
+
deps: HandlerDeps,
|
|
489
|
+
apis: SceneTreeHandlerAPIs
|
|
490
|
+
) => {
|
|
491
|
+
subscribeToDecideTo${pascalName}(({ payload }) => {
|
|
492
|
+
// apis.doSomething(payload)
|
|
493
|
+
})
|
|
494
|
+
}`
|
|
495
|
+
)
|
|
496
|
+
|
|
497
|
+
// Update Index - Wait, user needs to manually do deps injection usually?
|
|
498
|
+
// We can try to update index if logic is simple
|
|
499
|
+
const indexFile = project.addSourceFileAtPath(
|
|
500
|
+
path.join(scopeDir, 'index.ts')
|
|
501
|
+
)
|
|
502
|
+
indexFile.addImportDeclaration({
|
|
503
|
+
namedImports: [funcName],
|
|
504
|
+
moduleSpecifier: `./${kebabScope}`
|
|
505
|
+
})
|
|
506
|
+
// But we can't easily auto-wire the function call in initInteractionCoreHandlers because arguments vary.
|
|
507
|
+
// We'll leave that to the user.
|
|
508
|
+
}
|
|
509
|
+
logInfo(`Updated Core Subscriber: ${sourceFile.getBaseName()}`)
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
program.parse(process.argv)
|