@asyra/reactive-events 0.2.5 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -1
- package/dist/app/events.d.ts +44 -3
- package/dist/app/events.d.ts.map +1 -1
- package/dist/app/index.d.ts +4 -4
- package/dist/app/index.d.ts.map +1 -1
- package/dist/app/index.js +4 -4
- package/dist/app/index.js.map +1 -1
- package/dist/app/publish.d.ts +23 -3
- package/dist/app/publish.d.ts.map +1 -1
- package/dist/app/publish.js +307 -11
- package/dist/app/publish.js.map +1 -1
- package/dist/app/stream.d.ts +1 -1
- package/dist/app/stream.d.ts.map +1 -1
- package/dist/app/stream.js +2 -2
- package/dist/app/stream.js.map +1 -1
- package/dist/app/subscribes.d.ts +10 -1
- package/dist/app/subscribes.d.ts.map +1 -1
- package/dist/app/subscribes.js +11 -2
- package/dist/app/subscribes.js.map +1 -1
- package/dist/constants.d.ts +7 -11
- package/dist/constants.d.ts.map +1 -1
- package/dist/cooperative-render.d.ts +16 -0
- package/dist/cooperative-render.d.ts.map +1 -0
- package/dist/cooperative-render.js +50 -0
- package/dist/cooperative-render.js.map +1 -0
- package/dist/event-bus.d.ts +14 -3
- package/dist/event-bus.d.ts.map +1 -1
- package/dist/event-bus.js +163 -6
- package/dist/event-bus.js.map +1 -1
- package/dist/event-registry.d.ts +47 -0
- package/dist/event-registry.d.ts.map +1 -0
- package/dist/event-registry.js +82 -0
- package/dist/event-registry.js.map +1 -0
- package/dist/index.d.ts +14 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -13
- package/dist/index.js.map +1 -1
- package/dist/input-system/events.d.ts +1 -1
- package/dist/input-system/events.d.ts.map +1 -1
- package/dist/input-system/index.d.ts +3 -3
- package/dist/input-system/index.d.ts.map +1 -1
- package/dist/input-system/index.js +3 -3
- package/dist/input-system/index.js.map +1 -1
- package/dist/input-system/publish.js +2 -2
- package/dist/input-system/publish.js.map +1 -1
- package/dist/input-system/subscribes.d.ts +1 -1
- package/dist/input-system/subscribes.d.ts.map +1 -1
- package/dist/input-system/subscribes.js +2 -2
- package/dist/input-system/subscribes.js.map +1 -1
- package/dist/persistence.d.ts +2 -0
- package/dist/persistence.d.ts.map +1 -0
- package/dist/persistence.js +4 -0
- package/dist/persistence.js.map +1 -0
- package/dist/props-manager/events.d.ts +7 -8
- package/dist/props-manager/events.d.ts.map +1 -1
- package/dist/props-manager/index.d.ts +3 -3
- package/dist/props-manager/index.d.ts.map +1 -1
- package/dist/props-manager/index.js +3 -3
- package/dist/props-manager/index.js.map +1 -1
- package/dist/props-manager/publish.d.ts +4 -4
- package/dist/props-manager/publish.d.ts.map +1 -1
- package/dist/props-manager/publish.js +11 -8
- package/dist/props-manager/publish.js.map +1 -1
- package/dist/props-manager/subscribes.d.ts +3 -3
- package/dist/props-manager/subscribes.d.ts.map +1 -1
- package/dist/props-manager/subscribes.js +2 -2
- package/dist/props-manager/subscribes.js.map +1 -1
- package/dist/render/events.d.ts +3 -67
- package/dist/render/events.d.ts.map +1 -1
- package/dist/render/index.d.ts +3 -3
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +3 -3
- package/dist/render/index.js.map +1 -1
- package/dist/render/publish.d.ts +2 -16
- package/dist/render/publish.d.ts.map +1 -1
- package/dist/render/publish.js +3 -124
- package/dist/render/publish.js.map +1 -1
- package/dist/render/subscribes.d.ts +1 -11
- package/dist/render/subscribes.d.ts.map +1 -1
- package/dist/render/subscribes.js +2 -12
- package/dist/render/subscribes.js.map +1 -1
- package/dist/scene-tree/events.d.ts +45 -11
- package/dist/scene-tree/events.d.ts.map +1 -1
- package/dist/scene-tree/index.d.ts +4 -4
- package/dist/scene-tree/index.d.ts.map +1 -1
- package/dist/scene-tree/index.js +4 -4
- package/dist/scene-tree/index.js.map +1 -1
- package/dist/scene-tree/publish.d.ts +11 -6
- package/dist/scene-tree/publish.d.ts.map +1 -1
- package/dist/scene-tree/publish.js +70 -20
- package/dist/scene-tree/publish.js.map +1 -1
- package/dist/scene-tree/stream.d.ts +1 -1
- package/dist/scene-tree/stream.d.ts.map +1 -1
- package/dist/scene-tree/stream.js +2 -2
- package/dist/scene-tree/stream.js.map +1 -1
- package/dist/scene-tree/subscribes.d.ts +7 -2
- package/dist/scene-tree/subscribes.d.ts.map +1 -1
- package/dist/scene-tree/subscribes.js +8 -3
- package/dist/scene-tree/subscribes.js.map +1 -1
- package/dist/selection/events.d.ts +8 -3
- package/dist/selection/events.d.ts.map +1 -1
- package/dist/selection/index.d.ts +3 -3
- package/dist/selection/index.d.ts.map +1 -1
- package/dist/selection/index.js +3 -3
- package/dist/selection/index.js.map +1 -1
- package/dist/selection/publish.d.ts +4 -1
- package/dist/selection/publish.d.ts.map +1 -1
- package/dist/selection/publish.js +23 -4
- package/dist/selection/publish.js.map +1 -1
- package/dist/selection/subscribes.d.ts +3 -2
- package/dist/selection/subscribes.d.ts.map +1 -1
- package/dist/selection/subscribes.js +4 -2
- package/dist/selection/subscribes.js.map +1 -1
- package/dist/transaction-owner.d.ts +16 -0
- package/dist/transaction-owner.d.ts.map +1 -0
- package/dist/transaction-owner.js +25 -0
- package/dist/transaction-owner.js.map +1 -0
- package/dist/transaction-replay.d.ts +7 -0
- package/dist/transaction-replay.d.ts.map +1 -0
- package/dist/transaction-replay.js +57 -0
- package/dist/transaction-replay.js.map +1 -0
- package/dist/types.d.ts +55 -100
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +42 -90
- package/dist/types.js.map +1 -1
- package/package.json +23 -5
- package/.turbo/turbo-test$colon$ci.log +0 -137
- package/.turbo/turbo-test$colon$local.log +0 -18
- package/.turbo/turbo-test.log +0 -19
- package/CHANGELOG.md +0 -41
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -1956
- package/coverage/coverage-final.json +0 -24117
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -341
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/scripts/add-event.ts.html +0 -1429
- package/coverage/scripts/add-interaction.ts.html +0 -1621
- package/coverage/scripts/index.html +0 -131
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/coverage/src/app/events.ts.html +0 -238
- package/coverage/src/app/index.html +0 -176
- package/coverage/src/app/index.ts.html +0 -97
- package/coverage/src/app/publish.ts.html +0 -268
- package/coverage/src/app/stream.ts.html +0 -100
- package/coverage/src/app/subscribes.ts.html +0 -193
- package/coverage/src/constants.ts.html +0 -151
- package/coverage/src/core/events.ts.html +0 -124
- package/coverage/src/core/index.html +0 -161
- package/coverage/src/core/index.ts.html +0 -94
- package/coverage/src/core/publish.ts.html +0 -121
- package/coverage/src/core/subscribes.ts.html +0 -103
- package/coverage/src/event-bus.ts.html +0 -298
- package/coverage/src/index.html +0 -161
- package/coverage/src/index.ts.html +0 -124
- package/coverage/src/input-system/events.ts.html +0 -115
- package/coverage/src/input-system/index.html +0 -161
- package/coverage/src/input-system/index.ts.html +0 -94
- package/coverage/src/input-system/publish.ts.html +0 -124
- package/coverage/src/input-system/subscribes.ts.html +0 -109
- package/coverage/src/interaction-core/events.ts.html +0 -529
- package/coverage/src/interaction-core/index.html +0 -161
- package/coverage/src/interaction-core/index.ts.html +0 -94
- package/coverage/src/interaction-core/publish.ts.html +0 -652
- package/coverage/src/interaction-core/subscribes.ts.html +0 -331
- package/coverage/src/props-manager/events.ts.html +0 -169
- package/coverage/src/props-manager/index.html +0 -161
- package/coverage/src/props-manager/index.ts.html +0 -94
- package/coverage/src/props-manager/publish.ts.html +0 -175
- package/coverage/src/props-manager/subscribes.ts.html +0 -136
- package/coverage/src/render/events.ts.html +0 -409
- package/coverage/src/render/index.html +0 -161
- package/coverage/src/render/index.ts.html +0 -94
- package/coverage/src/render/publish.ts.html +0 -730
- package/coverage/src/render/subscribes.ts.html +0 -286
- package/coverage/src/scene-tree/events.ts.html +0 -298
- package/coverage/src/scene-tree/index.html +0 -176
- package/coverage/src/scene-tree/index.ts.html +0 -97
- package/coverage/src/scene-tree/publish.ts.html +0 -364
- package/coverage/src/scene-tree/stream.ts.html +0 -100
- package/coverage/src/scene-tree/subscribes.ts.html +0 -190
- package/coverage/src/selection/events.ts.html +0 -115
- package/coverage/src/selection/index.html +0 -161
- package/coverage/src/selection/index.ts.html +0 -94
- package/coverage/src/selection/publish.ts.html +0 -118
- package/coverage/src/selection/subscribes.ts.html +0 -103
- package/coverage/src/system-context/index.html +0 -116
- package/coverage/src/system-context/index.ts.html +0 -127
- package/coverage/src/system-context/key-state/events.ts.html +0 -112
- package/coverage/src/system-context/key-state/index.html +0 -161
- package/coverage/src/system-context/key-state/index.ts.html +0 -94
- package/coverage/src/system-context/key-state/publish.ts.html +0 -121
- package/coverage/src/system-context/key-state/subscribes.ts.html +0 -103
- package/coverage/src/system-context/mouse-state/events.ts.html +0 -112
- package/coverage/src/system-context/mouse-state/index.html +0 -161
- package/coverage/src/system-context/mouse-state/index.ts.html +0 -94
- package/coverage/src/system-context/mouse-state/publish.ts.html +0 -121
- package/coverage/src/system-context/mouse-state/subscribes.ts.html +0 -103
- package/coverage/src/system-context/primary-tool/events.ts.html +0 -187
- package/coverage/src/system-context/primary-tool/index.html +0 -161
- package/coverage/src/system-context/primary-tool/index.ts.html +0 -94
- package/coverage/src/system-context/primary-tool/publish.ts.html +0 -265
- package/coverage/src/system-context/primary-tool/subscribes.ts.html +0 -163
- package/coverage/src/system-context/target-state/events.ts.html +0 -115
- package/coverage/src/system-context/target-state/index.html +0 -161
- package/coverage/src/system-context/target-state/index.ts.html +0 -94
- package/coverage/src/system-context/target-state/publish.ts.html +0 -118
- package/coverage/src/system-context/target-state/subscribes.ts.html +0 -109
- package/coverage/src/types.ts.html +0 -568
- package/coverage/src/ui-context/events.ts.html +0 -133
- package/coverage/src/ui-context/index.html +0 -161
- package/coverage/src/ui-context/index.ts.html +0 -94
- package/coverage/src/ui-context/publish.ts.html +0 -181
- package/coverage/src/ui-context/subscribes.ts.html +0 -133
- package/dist/__tests__/event-bus.test.d.ts +0 -2
- package/dist/__tests__/event-bus.test.d.ts.map +0 -1
- package/dist/__tests__/event-bus.test.js +0 -148
- package/dist/__tests__/event-bus.test.js.map +0 -1
- package/dist/__tests__/event-types.test.d.ts +0 -2
- package/dist/__tests__/event-types.test.d.ts.map +0 -1
- package/dist/__tests__/event-types.test.js +0 -121
- package/dist/__tests__/event-types.test.js.map +0 -1
- package/dist/core/events.d.ts +0 -12
- package/dist/core/events.d.ts.map +0 -1
- package/dist/core/events.js +0 -2
- package/dist/core/events.js.map +0 -1
- package/dist/core/index.d.ts +0 -4
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -4
- package/dist/core/index.js.map +0 -1
- package/dist/core/publish.d.ts +0 -3
- package/dist/core/publish.d.ts.map +0 -1
- package/dist/core/publish.js +0 -11
- package/dist/core/publish.js.map +0 -1
- package/dist/core/subscribes.d.ts +0 -3
- package/dist/core/subscribes.d.ts.map +0 -1
- package/dist/core/subscribes.js +0 -4
- package/dist/core/subscribes.js.map +0 -1
- package/dist/interaction-core/events.d.ts +0 -108
- package/dist/interaction-core/events.d.ts.map +0 -1
- package/dist/interaction-core/events.js +0 -2
- package/dist/interaction-core/events.js.map +0 -1
- package/dist/interaction-core/index.d.ts +0 -4
- package/dist/interaction-core/index.d.ts.map +0 -1
- package/dist/interaction-core/index.js +0 -4
- package/dist/interaction-core/index.js.map +0 -1
- package/dist/interaction-core/publish.d.ts +0 -20
- package/dist/interaction-core/publish.d.ts.map +0 -1
- package/dist/interaction-core/publish.js +0 -130
- package/dist/interaction-core/publish.js.map +0 -1
- package/dist/interaction-core/subscribes.d.ts +0 -17
- package/dist/interaction-core/subscribes.d.ts.map +0 -1
- package/dist/interaction-core/subscribes.js +0 -18
- package/dist/interaction-core/subscribes.js.map +0 -1
- package/dist/scripts/add-event.d.ts +0 -2
- package/dist/scripts/add-event.d.ts.map +0 -1
- package/dist/scripts/add-event.js +0 -373
- package/dist/scripts/add-event.js.map +0 -1
- package/dist/scripts/add-interaction.d.ts +0 -2
- package/dist/scripts/add-interaction.d.ts.map +0 -1
- package/dist/scripts/add-interaction.js +0 -344
- package/dist/scripts/add-interaction.js.map +0 -1
- package/dist/src/app/events.d.ts +0 -34
- package/dist/src/app/events.d.ts.map +0 -1
- package/dist/src/app/events.js +0 -2
- package/dist/src/app/events.js.map +0 -1
- package/dist/src/app/index.d.ts +0 -5
- package/dist/src/app/index.d.ts.map +0 -1
- package/dist/src/app/index.js +0 -5
- package/dist/src/app/index.js.map +0 -1
- package/dist/src/app/publish.d.ts +0 -10
- package/dist/src/app/publish.d.ts.map +0 -1
- package/dist/src/app/publish.js +0 -49
- package/dist/src/app/publish.js.map +0 -1
- package/dist/src/app/stream.d.ts +0 -2
- package/dist/src/app/stream.d.ts.map +0 -1
- package/dist/src/app/stream.js +0 -4
- package/dist/src/app/stream.js.map +0 -1
- package/dist/src/app/subscribes.d.ts +0 -10
- package/dist/src/app/subscribes.d.ts.map +0 -1
- package/dist/src/app/subscribes.js +0 -11
- package/dist/src/app/subscribes.js.map +0 -1
- package/dist/src/constants.d.ts +0 -12
- package/dist/src/constants.d.ts.map +0 -1
- package/dist/src/constants.js +0 -2
- package/dist/src/constants.js.map +0 -1
- package/dist/src/core/events.d.ts +0 -12
- package/dist/src/core/events.d.ts.map +0 -1
- package/dist/src/core/events.js +0 -2
- package/dist/src/core/events.js.map +0 -1
- package/dist/src/core/index.d.ts +0 -4
- package/dist/src/core/index.d.ts.map +0 -1
- package/dist/src/core/index.js +0 -4
- package/dist/src/core/index.js.map +0 -1
- package/dist/src/core/publish.d.ts +0 -3
- package/dist/src/core/publish.d.ts.map +0 -1
- package/dist/src/core/publish.js +0 -11
- package/dist/src/core/publish.js.map +0 -1
- package/dist/src/core/subscribes.d.ts +0 -3
- package/dist/src/core/subscribes.d.ts.map +0 -1
- package/dist/src/core/subscribes.js +0 -4
- package/dist/src/core/subscribes.js.map +0 -1
- package/dist/src/event-bus.d.ts +0 -12
- package/dist/src/event-bus.d.ts.map +0 -1
- package/dist/src/event-bus.js +0 -31
- package/dist/src/event-bus.js.map +0 -1
- package/dist/src/index.d.ts +0 -14
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -14
- package/dist/src/index.js.map +0 -1
- package/dist/src/input-system/events.d.ts +0 -9
- package/dist/src/input-system/events.d.ts.map +0 -1
- package/dist/src/input-system/events.js +0 -2
- package/dist/src/input-system/events.js.map +0 -1
- package/dist/src/input-system/index.d.ts +0 -4
- package/dist/src/input-system/index.d.ts.map +0 -1
- package/dist/src/input-system/index.js +0 -4
- package/dist/src/input-system/index.js.map +0 -1
- package/dist/src/input-system/publish.d.ts +0 -2
- package/dist/src/input-system/publish.d.ts.map +0 -1
- package/dist/src/input-system/publish.js +0 -11
- package/dist/src/input-system/publish.js.map +0 -1
- package/dist/src/input-system/subscribes.d.ts +0 -3
- package/dist/src/input-system/subscribes.d.ts.map +0 -1
- package/dist/src/input-system/subscribes.js +0 -4
- package/dist/src/input-system/subscribes.js.map +0 -1
- package/dist/src/interaction-core/events.d.ts +0 -108
- package/dist/src/interaction-core/events.d.ts.map +0 -1
- package/dist/src/interaction-core/events.js +0 -2
- package/dist/src/interaction-core/events.js.map +0 -1
- package/dist/src/interaction-core/index.d.ts +0 -4
- package/dist/src/interaction-core/index.d.ts.map +0 -1
- package/dist/src/interaction-core/index.js +0 -4
- package/dist/src/interaction-core/index.js.map +0 -1
- package/dist/src/interaction-core/publish.d.ts +0 -20
- package/dist/src/interaction-core/publish.d.ts.map +0 -1
- package/dist/src/interaction-core/publish.js +0 -130
- package/dist/src/interaction-core/publish.js.map +0 -1
- package/dist/src/interaction-core/subscribes.d.ts +0 -17
- package/dist/src/interaction-core/subscribes.d.ts.map +0 -1
- package/dist/src/interaction-core/subscribes.js +0 -18
- package/dist/src/interaction-core/subscribes.js.map +0 -1
- package/dist/src/props-manager/events.d.ts +0 -41
- package/dist/src/props-manager/events.d.ts.map +0 -1
- package/dist/src/props-manager/events.js +0 -2
- package/dist/src/props-manager/events.js.map +0 -1
- package/dist/src/props-manager/index.d.ts +0 -4
- package/dist/src/props-manager/index.d.ts.map +0 -1
- package/dist/src/props-manager/index.js +0 -4
- package/dist/src/props-manager/index.js.map +0 -1
- package/dist/src/props-manager/publish.d.ts +0 -8
- package/dist/src/props-manager/publish.d.ts.map +0 -1
- package/dist/src/props-manager/publish.js +0 -67
- package/dist/src/props-manager/publish.js.map +0 -1
- package/dist/src/props-manager/subscribes.d.ts +0 -8
- package/dist/src/props-manager/subscribes.d.ts.map +0 -1
- package/dist/src/props-manager/subscribes.js +0 -9
- package/dist/src/props-manager/subscribes.js.map +0 -1
- package/dist/src/render/events.d.ts +0 -83
- package/dist/src/render/events.d.ts.map +0 -1
- package/dist/src/render/events.js +0 -2
- package/dist/src/render/events.js.map +0 -1
- package/dist/src/render/index.d.ts +0 -4
- package/dist/src/render/index.d.ts.map +0 -1
- package/dist/src/render/index.js +0 -4
- package/dist/src/render/index.js.map +0 -1
- package/dist/src/render/publish.d.ts +0 -17
- package/dist/src/render/publish.d.ts.map +0 -1
- package/dist/src/render/publish.js +0 -159
- package/dist/src/render/publish.js.map +0 -1
- package/dist/src/render/subscribes.d.ts +0 -14
- package/dist/src/render/subscribes.d.ts.map +0 -1
- package/dist/src/render/subscribes.js +0 -15
- package/dist/src/render/subscribes.js.map +0 -1
- package/dist/src/scene-tree/events.d.ts +0 -73
- package/dist/src/scene-tree/events.d.ts.map +0 -1
- package/dist/src/scene-tree/events.js +0 -2
- package/dist/src/scene-tree/events.js.map +0 -1
- package/dist/src/scene-tree/index.d.ts +0 -5
- package/dist/src/scene-tree/index.d.ts.map +0 -1
- package/dist/src/scene-tree/index.js +0 -5
- package/dist/src/scene-tree/index.js.map +0 -1
- package/dist/src/scene-tree/publish.d.ts +0 -14
- package/dist/src/scene-tree/publish.d.ts.map +0 -1
- package/dist/src/scene-tree/publish.js +0 -121
- package/dist/src/scene-tree/publish.js.map +0 -1
- package/dist/src/scene-tree/stream.d.ts +0 -2
- package/dist/src/scene-tree/stream.d.ts.map +0 -1
- package/dist/src/scene-tree/stream.js +0 -4
- package/dist/src/scene-tree/stream.js.map +0 -1
- package/dist/src/scene-tree/subscribes.d.ts +0 -12
- package/dist/src/scene-tree/subscribes.d.ts.map +0 -1
- package/dist/src/scene-tree/subscribes.js +0 -13
- package/dist/src/scene-tree/subscribes.js.map +0 -1
- package/dist/src/selection/events.d.ts +0 -9
- package/dist/src/selection/events.d.ts.map +0 -1
- package/dist/src/selection/events.js +0 -2
- package/dist/src/selection/events.js.map +0 -1
- package/dist/src/selection/index.d.ts +0 -4
- package/dist/src/selection/index.d.ts.map +0 -1
- package/dist/src/selection/index.js +0 -4
- package/dist/src/selection/index.js.map +0 -1
- package/dist/src/selection/publish.d.ts +0 -2
- package/dist/src/selection/publish.d.ts.map +0 -1
- package/dist/src/selection/publish.js +0 -11
- package/dist/src/selection/publish.js.map +0 -1
- package/dist/src/selection/subscribes.d.ts +0 -3
- package/dist/src/selection/subscribes.d.ts.map +0 -1
- package/dist/src/selection/subscribes.js +0 -4
- package/dist/src/selection/subscribes.js.map +0 -1
- package/dist/src/system-context/index.d.ts +0 -12
- package/dist/src/system-context/index.d.ts.map +0 -1
- package/dist/src/system-context/index.js +0 -6
- package/dist/src/system-context/index.js.map +0 -1
- package/dist/src/system-context/key-state/events.d.ts +0 -8
- package/dist/src/system-context/key-state/events.d.ts.map +0 -1
- package/dist/src/system-context/key-state/events.js +0 -2
- package/dist/src/system-context/key-state/events.js.map +0 -1
- package/dist/src/system-context/key-state/index.d.ts +0 -4
- package/dist/src/system-context/key-state/index.d.ts.map +0 -1
- package/dist/src/system-context/key-state/index.js +0 -4
- package/dist/src/system-context/key-state/index.js.map +0 -1
- package/dist/src/system-context/key-state/publish.d.ts +0 -3
- package/dist/src/system-context/key-state/publish.d.ts.map +0 -1
- package/dist/src/system-context/key-state/publish.js +0 -11
- package/dist/src/system-context/key-state/publish.js.map +0 -1
- package/dist/src/system-context/key-state/subscribes.d.ts +0 -3
- package/dist/src/system-context/key-state/subscribes.d.ts.map +0 -1
- package/dist/src/system-context/key-state/subscribes.js +0 -4
- package/dist/src/system-context/key-state/subscribes.js.map +0 -1
- package/dist/src/system-context/mouse-state/events.d.ts +0 -8
- package/dist/src/system-context/mouse-state/events.d.ts.map +0 -1
- package/dist/src/system-context/mouse-state/events.js +0 -2
- package/dist/src/system-context/mouse-state/events.js.map +0 -1
- package/dist/src/system-context/mouse-state/index.d.ts +0 -4
- package/dist/src/system-context/mouse-state/index.d.ts.map +0 -1
- package/dist/src/system-context/mouse-state/index.js +0 -4
- package/dist/src/system-context/mouse-state/index.js.map +0 -1
- package/dist/src/system-context/mouse-state/publish.d.ts +0 -3
- package/dist/src/system-context/mouse-state/publish.d.ts.map +0 -1
- package/dist/src/system-context/mouse-state/publish.js +0 -11
- package/dist/src/system-context/mouse-state/publish.js.map +0 -1
- package/dist/src/system-context/mouse-state/subscribes.d.ts +0 -3
- package/dist/src/system-context/mouse-state/subscribes.d.ts.map +0 -1
- package/dist/src/system-context/mouse-state/subscribes.js +0 -4
- package/dist/src/system-context/mouse-state/subscribes.js.map +0 -1
- package/dist/src/system-context/primary-tool/events.d.ts +0 -26
- package/dist/src/system-context/primary-tool/events.d.ts.map +0 -1
- package/dist/src/system-context/primary-tool/events.js +0 -2
- package/dist/src/system-context/primary-tool/events.js.map +0 -1
- package/dist/src/system-context/primary-tool/index.d.ts +0 -4
- package/dist/src/system-context/primary-tool/index.d.ts.map +0 -1
- package/dist/src/system-context/primary-tool/index.js +0 -4
- package/dist/src/system-context/primary-tool/index.js.map +0 -1
- package/dist/src/system-context/primary-tool/publish.d.ts +0 -6
- package/dist/src/system-context/primary-tool/publish.d.ts.map +0 -1
- package/dist/src/system-context/primary-tool/publish.js +0 -48
- package/dist/src/system-context/primary-tool/publish.js.map +0 -1
- package/dist/src/system-context/primary-tool/subscribes.d.ts +0 -6
- package/dist/src/system-context/primary-tool/subscribes.d.ts.map +0 -1
- package/dist/src/system-context/primary-tool/subscribes.js +0 -7
- package/dist/src/system-context/primary-tool/subscribes.js.map +0 -1
- package/dist/src/system-context/system-context/events.d.ts +0 -17
- package/dist/src/system-context/system-context/events.d.ts.map +0 -1
- package/dist/src/system-context/system-context/events.js +0 -2
- package/dist/src/system-context/system-context/events.js.map +0 -1
- package/dist/src/system-context/system-context/index.d.ts +0 -4
- package/dist/src/system-context/system-context/index.d.ts.map +0 -1
- package/dist/src/system-context/system-context/index.js +0 -4
- package/dist/src/system-context/system-context/index.js.map +0 -1
- package/dist/src/system-context/system-context/publish.d.ts +0 -4
- package/dist/src/system-context/system-context/publish.d.ts.map +0 -1
- package/dist/src/system-context/system-context/publish.js +0 -35
- package/dist/src/system-context/system-context/publish.js.map +0 -1
- package/dist/src/system-context/system-context/subscribes.d.ts +0 -4
- package/dist/src/system-context/system-context/subscribes.d.ts.map +0 -1
- package/dist/src/system-context/system-context/subscribes.js +0 -5
- package/dist/src/system-context/system-context/subscribes.js.map +0 -1
- package/dist/src/system-context/target-state/events.d.ts +0 -9
- package/dist/src/system-context/target-state/events.d.ts.map +0 -1
- package/dist/src/system-context/target-state/events.js +0 -2
- package/dist/src/system-context/target-state/events.js.map +0 -1
- package/dist/src/system-context/target-state/index.d.ts +0 -4
- package/dist/src/system-context/target-state/index.d.ts.map +0 -1
- package/dist/src/system-context/target-state/index.js +0 -4
- package/dist/src/system-context/target-state/index.js.map +0 -1
- package/dist/src/system-context/target-state/publish.d.ts +0 -2
- package/dist/src/system-context/target-state/publish.d.ts.map +0 -1
- package/dist/src/system-context/target-state/publish.js +0 -11
- package/dist/src/system-context/target-state/publish.js.map +0 -1
- package/dist/src/system-context/target-state/subscribes.d.ts +0 -3
- package/dist/src/system-context/target-state/subscribes.d.ts.map +0 -1
- package/dist/src/system-context/target-state/subscribes.js +0 -4
- package/dist/src/system-context/target-state/subscribes.js.map +0 -1
- package/dist/src/types.d.ts +0 -174
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -160
- package/dist/src/types.js.map +0 -1
- package/dist/src/ui-context/events.d.ts +0 -12
- package/dist/src/ui-context/events.d.ts.map +0 -1
- package/dist/src/ui-context/events.js +0 -2
- package/dist/src/ui-context/events.js.map +0 -1
- package/dist/src/ui-context/index.d.ts +0 -4
- package/dist/src/ui-context/index.d.ts.map +0 -1
- package/dist/src/ui-context/index.js +0 -4
- package/dist/src/ui-context/index.js.map +0 -1
- package/dist/src/ui-context/publish.d.ts +0 -3
- package/dist/src/ui-context/publish.d.ts.map +0 -1
- package/dist/src/ui-context/publish.js +0 -21
- package/dist/src/ui-context/publish.js.map +0 -1
- package/dist/src/ui-context/subscribes.d.ts +0 -4
- package/dist/src/ui-context/subscribes.d.ts.map +0 -1
- package/dist/src/ui-context/subscribes.js +0 -5
- package/dist/src/ui-context/subscribes.js.map +0 -1
- package/dist/system-context/index.d.ts +0 -10
- package/dist/system-context/index.d.ts.map +0 -1
- package/dist/system-context/index.js +0 -5
- package/dist/system-context/index.js.map +0 -1
- package/dist/system-context/key-state/events.d.ts +0 -8
- package/dist/system-context/key-state/events.d.ts.map +0 -1
- package/dist/system-context/key-state/events.js +0 -2
- package/dist/system-context/key-state/events.js.map +0 -1
- package/dist/system-context/key-state/index.d.ts +0 -4
- package/dist/system-context/key-state/index.d.ts.map +0 -1
- package/dist/system-context/key-state/index.js +0 -4
- package/dist/system-context/key-state/index.js.map +0 -1
- package/dist/system-context/key-state/publish.d.ts +0 -3
- package/dist/system-context/key-state/publish.d.ts.map +0 -1
- package/dist/system-context/key-state/publish.js +0 -11
- package/dist/system-context/key-state/publish.js.map +0 -1
- package/dist/system-context/key-state/subscribes.d.ts +0 -3
- package/dist/system-context/key-state/subscribes.d.ts.map +0 -1
- package/dist/system-context/key-state/subscribes.js +0 -4
- package/dist/system-context/key-state/subscribes.js.map +0 -1
- package/dist/system-context/mouse-state/events.d.ts +0 -8
- package/dist/system-context/mouse-state/events.d.ts.map +0 -1
- package/dist/system-context/mouse-state/events.js +0 -2
- package/dist/system-context/mouse-state/events.js.map +0 -1
- package/dist/system-context/mouse-state/index.d.ts +0 -4
- package/dist/system-context/mouse-state/index.d.ts.map +0 -1
- package/dist/system-context/mouse-state/index.js +0 -4
- package/dist/system-context/mouse-state/index.js.map +0 -1
- package/dist/system-context/mouse-state/publish.d.ts +0 -3
- package/dist/system-context/mouse-state/publish.d.ts.map +0 -1
- package/dist/system-context/mouse-state/publish.js +0 -11
- package/dist/system-context/mouse-state/publish.js.map +0 -1
- package/dist/system-context/mouse-state/subscribes.d.ts +0 -3
- package/dist/system-context/mouse-state/subscribes.d.ts.map +0 -1
- package/dist/system-context/mouse-state/subscribes.js +0 -4
- package/dist/system-context/mouse-state/subscribes.js.map +0 -1
- package/dist/system-context/primary-tool/events.d.ts +0 -26
- package/dist/system-context/primary-tool/events.d.ts.map +0 -1
- package/dist/system-context/primary-tool/events.js +0 -2
- package/dist/system-context/primary-tool/events.js.map +0 -1
- package/dist/system-context/primary-tool/index.d.ts +0 -4
- package/dist/system-context/primary-tool/index.d.ts.map +0 -1
- package/dist/system-context/primary-tool/index.js +0 -4
- package/dist/system-context/primary-tool/index.js.map +0 -1
- package/dist/system-context/primary-tool/publish.d.ts +0 -6
- package/dist/system-context/primary-tool/publish.d.ts.map +0 -1
- package/dist/system-context/primary-tool/publish.js +0 -48
- package/dist/system-context/primary-tool/publish.js.map +0 -1
- package/dist/system-context/primary-tool/subscribes.d.ts +0 -6
- package/dist/system-context/primary-tool/subscribes.d.ts.map +0 -1
- package/dist/system-context/primary-tool/subscribes.js +0 -7
- package/dist/system-context/primary-tool/subscribes.js.map +0 -1
- package/dist/system-context/system-context/events.d.ts +0 -17
- package/dist/system-context/system-context/events.d.ts.map +0 -1
- package/dist/system-context/system-context/events.js +0 -2
- package/dist/system-context/system-context/events.js.map +0 -1
- package/dist/system-context/system-context/index.d.ts +0 -4
- package/dist/system-context/system-context/index.d.ts.map +0 -1
- package/dist/system-context/system-context/index.js +0 -4
- package/dist/system-context/system-context/index.js.map +0 -1
- package/dist/system-context/system-context/publish.d.ts +0 -4
- package/dist/system-context/system-context/publish.d.ts.map +0 -1
- package/dist/system-context/system-context/publish.js +0 -35
- package/dist/system-context/system-context/publish.js.map +0 -1
- package/dist/system-context/system-context/subscribes.d.ts +0 -4
- package/dist/system-context/system-context/subscribes.d.ts.map +0 -1
- package/dist/system-context/system-context/subscribes.js +0 -5
- package/dist/system-context/system-context/subscribes.js.map +0 -1
- package/dist/system-context/target-state/events.d.ts +0 -9
- package/dist/system-context/target-state/events.d.ts.map +0 -1
- package/dist/system-context/target-state/events.js +0 -2
- package/dist/system-context/target-state/events.js.map +0 -1
- package/dist/system-context/target-state/index.d.ts +0 -4
- package/dist/system-context/target-state/index.d.ts.map +0 -1
- package/dist/system-context/target-state/index.js +0 -4
- package/dist/system-context/target-state/index.js.map +0 -1
- package/dist/system-context/target-state/publish.d.ts +0 -2
- package/dist/system-context/target-state/publish.d.ts.map +0 -1
- package/dist/system-context/target-state/publish.js +0 -11
- package/dist/system-context/target-state/publish.js.map +0 -1
- package/dist/system-context/target-state/subscribes.d.ts +0 -3
- package/dist/system-context/target-state/subscribes.d.ts.map +0 -1
- package/dist/system-context/target-state/subscribes.js +0 -4
- package/dist/system-context/target-state/subscribes.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/ui-context/events.d.ts +0 -12
- package/dist/ui-context/events.d.ts.map +0 -1
- package/dist/ui-context/events.js +0 -2
- package/dist/ui-context/events.js.map +0 -1
- package/dist/ui-context/index.d.ts +0 -4
- package/dist/ui-context/index.d.ts.map +0 -1
- package/dist/ui-context/index.js +0 -4
- package/dist/ui-context/index.js.map +0 -1
- package/dist/ui-context/publish.d.ts +0 -3
- package/dist/ui-context/publish.d.ts.map +0 -1
- package/dist/ui-context/publish.js +0 -21
- package/dist/ui-context/publish.js.map +0 -1
- package/dist/ui-context/subscribes.d.ts +0 -4
- package/dist/ui-context/subscribes.d.ts.map +0 -1
- package/dist/ui-context/subscribes.js +0 -5
- package/dist/ui-context/subscribes.js.map +0 -1
- package/scripts/add-event.ts +0 -448
- package/scripts/add-interaction.ts +0 -512
- package/scripts/tsconfig.json +0 -4
- package/src/__tests__/event-bus.test.ts +0 -208
- package/src/__tests__/event-types.test.ts +0 -151
- package/src/app/events.ts +0 -51
- package/src/app/index.ts +0 -4
- package/src/app/publish.ts +0 -61
- package/src/app/stream.ts +0 -5
- package/src/app/subscribes.ts +0 -36
- package/src/constants.ts +0 -22
- package/src/core/events.ts +0 -13
- package/src/core/index.ts +0 -3
- package/src/core/publish.ts +0 -12
- package/src/core/subscribes.ts +0 -6
- package/src/event-bus.ts +0 -71
- package/src/index.ts +0 -13
- package/src/input-system/events.ts +0 -10
- package/src/input-system/index.ts +0 -3
- package/src/input-system/publish.ts +0 -13
- package/src/input-system/subscribes.ts +0 -8
- package/src/interaction-core/events.ts +0 -148
- package/src/interaction-core/index.ts +0 -3
- package/src/interaction-core/publish.ts +0 -189
- package/src/interaction-core/subscribes.ts +0 -82
- package/src/props-manager/events.ts +0 -28
- package/src/props-manager/index.ts +0 -3
- package/src/props-manager/publish.ts +0 -30
- package/src/props-manager/subscribes.ts +0 -17
- package/src/render/events.ts +0 -108
- package/src/render/index.ts +0 -3
- package/src/render/publish.ts +0 -215
- package/src/render/subscribes.ts +0 -67
- package/src/scene-tree/events.ts +0 -71
- package/src/scene-tree/index.ts +0 -4
- package/src/scene-tree/publish.ts +0 -93
- package/src/scene-tree/stream.ts +0 -5
- package/src/scene-tree/subscribes.ts +0 -35
- package/src/selection/events.ts +0 -10
- package/src/selection/index.ts +0 -3
- package/src/selection/publish.ts +0 -11
- package/src/selection/subscribes.ts +0 -6
- package/src/system-context/index.ts +0 -14
- package/src/system-context/key-state/events.ts +0 -9
- package/src/system-context/key-state/index.ts +0 -3
- package/src/system-context/key-state/publish.ts +0 -12
- package/src/system-context/key-state/subscribes.ts +0 -6
- package/src/system-context/mouse-state/events.ts +0 -9
- package/src/system-context/mouse-state/index.ts +0 -3
- package/src/system-context/mouse-state/publish.ts +0 -12
- package/src/system-context/mouse-state/subscribes.ts +0 -6
- package/src/system-context/primary-tool/events.ts +0 -34
- package/src/system-context/primary-tool/index.ts +0 -3
- package/src/system-context/primary-tool/publish.ts +0 -60
- package/src/system-context/primary-tool/subscribes.ts +0 -26
- package/src/system-context/target-state/events.ts +0 -10
- package/src/system-context/target-state/index.ts +0 -3
- package/src/system-context/target-state/publish.ts +0 -11
- package/src/system-context/target-state/subscribes.ts +0 -8
- package/src/types.ts +0 -161
- package/src/ui-context/events.ts +0 -16
- package/src/ui-context/index.ts +0 -3
- package/src/ui-context/publish.ts +0 -32
- package/src/ui-context/subscribes.ts +0 -16
- package/tsconfig.json +0 -17
|
@@ -1,512 +0,0 @@
|
|
|
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)
|
package/scripts/tsconfig.json
DELETED