@asyra/core 0.2.5 → 0.5.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/LICENSE +21 -0
- package/README.md +52 -0
- package/dist/apis/create-apis.d.ts +8 -0
- package/dist/apis/create-apis.d.ts.map +1 -0
- package/dist/apis/create-apis.js +272 -0
- package/dist/apis/create-apis.js.map +1 -0
- package/dist/apis/element-properties.d.ts +10 -0
- package/dist/apis/element-properties.d.ts.map +1 -0
- package/dist/apis/element-properties.js +33 -0
- package/dist/apis/element-properties.js.map +1 -0
- package/dist/apis/element-selection.d.ts +4 -2
- package/dist/apis/element-selection.d.ts.map +1 -1
- package/dist/apis/element-selection.js +155 -6
- package/dist/apis/element-selection.js.map +1 -1
- package/dist/apis/feature-system.d.ts +11 -0
- package/dist/apis/feature-system.d.ts.map +1 -0
- package/dist/apis/feature-system.js +9 -0
- package/dist/apis/feature-system.js.map +1 -0
- package/dist/apis/index.d.ts +1 -2
- package/dist/apis/index.d.ts.map +1 -1
- package/dist/apis/index.js +1 -24
- package/dist/apis/index.js.map +1 -1
- package/dist/apis/input-system.d.ts +1 -1
- package/dist/apis/input-system.d.ts.map +1 -1
- package/dist/apis/props.d.ts +18 -2
- package/dist/apis/props.d.ts.map +1 -1
- package/dist/apis/props.js +28 -9
- package/dist/apis/props.js.map +1 -1
- package/dist/apis/render.d.ts +39 -2
- package/dist/apis/render.d.ts.map +1 -1
- package/dist/apis/render.js +35 -2
- package/dist/apis/render.js.map +1 -1
- package/dist/apis/scene-bounds.d.ts +4 -0
- package/dist/apis/scene-bounds.d.ts.map +1 -0
- package/dist/apis/scene-bounds.js +112 -0
- package/dist/apis/scene-bounds.js.map +1 -0
- package/dist/apis/scene-tree.d.ts +24 -2
- package/dist/apis/scene-tree.d.ts.map +1 -1
- package/dist/apis/scene-tree.js +116 -25
- package/dist/apis/scene-tree.js.map +1 -1
- package/dist/apis/system-properties.d.ts +18 -0
- package/dist/apis/system-properties.d.ts.map +1 -0
- package/dist/apis/system-properties.js +21 -0
- package/dist/apis/system-properties.js.map +1 -0
- package/dist/apis/ui-context.d.ts +10 -0
- package/dist/apis/ui-context.d.ts.map +1 -0
- package/dist/apis/ui-context.js +22 -0
- package/dist/apis/ui-context.js.map +1 -0
- package/dist/canvas-pipeline-debugger/debugger.d.ts +29 -0
- package/dist/canvas-pipeline-debugger/debugger.d.ts.map +1 -0
- package/dist/canvas-pipeline-debugger/debugger.js +251 -0
- package/dist/canvas-pipeline-debugger/debugger.js.map +1 -0
- package/dist/canvas-pipeline-debugger/index.d.ts +2 -0
- package/dist/canvas-pipeline-debugger/index.d.ts.map +1 -0
- package/dist/canvas-pipeline-debugger/index.js +2 -0
- package/dist/canvas-pipeline-debugger/index.js.map +1 -0
- package/dist/core.d.ts +196 -40
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +1055 -38
- package/dist/core.js.map +1 -1
- package/dist/data-channel-observer.d.ts +35 -0
- package/dist/data-channel-observer.d.ts.map +1 -0
- package/dist/data-channel-observer.js +77 -0
- package/dist/data-channel-observer.js.map +1 -0
- package/dist/define-component.d.ts +102 -0
- package/dist/define-component.d.ts.map +1 -0
- package/dist/define-component.js +429 -0
- package/dist/define-component.js.map +1 -0
- package/dist/define-property-component.d.ts +29 -0
- package/dist/define-property-component.d.ts.map +1 -0
- package/dist/define-property-component.js +140 -0
- package/dist/define-property-component.js.map +1 -0
- package/dist/feature-integration.d.ts +16 -0
- package/dist/feature-integration.d.ts.map +1 -0
- package/dist/feature-integration.js +19 -0
- package/dist/feature-integration.js.map +1 -0
- package/dist/index.d.ts +43 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -1
- package/dist/index.js.map +1 -1
- package/dist/types/canonical-changes.d.ts +39 -0
- package/dist/types/canonical-changes.d.ts.map +1 -0
- package/dist/types/canonical-changes.js +2 -0
- package/dist/types/canonical-changes.js.map +1 -0
- package/dist/types/deps.d.ts +0 -2
- package/dist/types/deps.d.ts.map +1 -1
- package/dist/types/element-properties.d.ts +24 -0
- package/dist/types/element-properties.d.ts.map +1 -0
- package/dist/types/element-properties.js +2 -0
- package/dist/types/element-properties.js.map +1 -0
- package/dist/types/element-selection.d.ts +5 -1
- package/dist/types/element-selection.d.ts.map +1 -1
- package/dist/types/feature-system.d.ts +5 -0
- package/dist/types/feature-system.d.ts.map +1 -0
- package/dist/types/feature-system.js +2 -0
- package/dist/types/feature-system.js.map +1 -0
- package/dist/types/index.d.ts +18 -14
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/load-migration.d.ts +12 -0
- package/dist/types/load-migration.d.ts.map +1 -0
- package/dist/types/load-migration.js +16 -0
- package/dist/types/load-migration.js.map +1 -0
- package/dist/types/load-validation.d.ts +12 -0
- package/dist/types/load-validation.d.ts.map +1 -0
- package/dist/types/load-validation.js +2 -0
- package/dist/types/load-validation.js.map +1 -0
- package/dist/types/props.d.ts +8 -1
- package/dist/types/props.d.ts.map +1 -1
- package/dist/types/render.d.ts +20 -1
- package/dist/types/render.d.ts.map +1 -1
- package/dist/types/scene-tree.d.ts +21 -9
- package/dist/types/scene-tree.d.ts.map +1 -1
- package/dist/types/system-properties.d.ts +19 -0
- package/dist/types/system-properties.d.ts.map +1 -0
- package/dist/types/system-properties.js +2 -0
- package/dist/types/system-properties.js.map +1 -0
- package/dist/types/ui-context.d.ts +11 -0
- package/dist/types/ui-context.d.ts.map +1 -0
- package/dist/types/ui-context.js +2 -0
- package/dist/types/ui-context.js.map +1 -0
- package/dist/types/vector.d.ts +131 -0
- package/dist/types/vector.d.ts.map +1 -0
- package/dist/types/vector.js +83 -0
- package/dist/types/vector.js.map +1 -0
- package/package.json +39 -12
- package/.turbo/turbo-test$colon$ci.log +0 -132
- package/.turbo/turbo-test$colon$local.log +0 -21
- package/.turbo/turbo-test.log +0 -0
- package/CHANGELOG.md +0 -86
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -991
- package/coverage/coverage-final.json +0 -14952
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -236
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/coverage/src/apis/element-selection.ts.html +0 -133
- package/coverage/src/apis/index.html +0 -266
- package/coverage/src/apis/index.ts.html +0 -175
- package/coverage/src/apis/input-system.ts.html +0 -121
- package/coverage/src/apis/interaction-core.ts.html +0 -190
- package/coverage/src/apis/props.ts.html +0 -124
- package/coverage/src/apis/render.ts.html +0 -130
- package/coverage/src/apis/scene-tree.ts.html +0 -292
- package/coverage/src/apis/system-context.ts.html +0 -154
- package/coverage/src/apis/transaction.ts.html +0 -124
- package/coverage/src/apis/undo.ts.html +0 -124
- package/coverage/src/apis/viewport.ts.html +0 -193
- package/coverage/src/combinations.ts.html +0 -223
- package/coverage/src/core.ts.html +0 -559
- package/coverage/src/index.html +0 -146
- package/coverage/src/index.ts.html +0 -97
- package/coverage/src/requests/factory.ts.html +0 -127
- package/coverage/src/requests/index.html +0 -206
- package/coverage/src/requests/index.ts.html +0 -154
- package/coverage/src/requests/props.ts.html +0 -133
- package/coverage/src/requests/render.ts.html +0 -187
- package/coverage/src/requests/scene-tree.ts.html +0 -163
- package/coverage/src/requests/selection.ts.html +0 -127
- package/coverage/src/requests/system-context.ts.html +0 -130
- package/coverage/src/subscribes/index.html +0 -116
- package/coverage/src/subscribes/index.ts.html +0 -109
- package/coverage/src/subscribes/input-system/index.html +0 -176
- package/coverage/src/subscribes/input-system/index.ts.html +0 -226
- package/coverage/src/subscribes/input-system/primary-tool.ts.html +0 -160
- package/coverage/src/subscribes/input-system/render.ts.html +0 -484
- package/coverage/src/subscribes/input-system/undo.ts.html +0 -172
- package/coverage/src/subscribes/input-system/viewport.ts.html +0 -259
- package/coverage/src/subscribes/interaction-core/create-element.ts.html +0 -151
- package/coverage/src/subscribes/interaction-core/index.html +0 -236
- package/coverage/src/subscribes/interaction-core/index.ts.html +0 -289
- package/coverage/src/subscribes/interaction-core/primary-tool.ts.html +0 -109
- package/coverage/src/subscribes/interaction-core/reset-element-size.ts.html +0 -127
- package/coverage/src/subscribes/interaction-core/resize-element.ts.html +0 -181
- package/coverage/src/subscribes/interaction-core/select-elements.ts.html +0 -109
- package/coverage/src/subscribes/interaction-core/transaction.ts.html +0 -130
- package/coverage/src/subscribes/interaction-core/undoredo.ts.html +0 -133
- package/coverage/src/subscribes/interaction-core/viewport.ts.html +0 -193
- package/coverage/src/types/deps.ts.html +0 -118
- package/coverage/src/types/element-selection.ts.html +0 -100
- package/coverage/src/types/index.html +0 -266
- package/coverage/src/types/index.ts.html +0 -385
- package/coverage/src/types/input-system.ts.html +0 -100
- package/coverage/src/types/interaction-core.ts.html +0 -127
- package/coverage/src/types/props.ts.html +0 -109
- package/coverage/src/types/render.ts.html +0 -106
- package/coverage/src/types/requests/factory.ts.html +0 -127
- package/coverage/src/types/requests/index.html +0 -206
- package/coverage/src/types/requests/index.ts.html +0 -214
- package/coverage/src/types/requests/props.ts.html +0 -133
- package/coverage/src/types/requests/render.ts.html +0 -139
- package/coverage/src/types/requests/scene-tree.ts.html +0 -133
- package/coverage/src/types/requests/selection.ts.html +0 -127
- package/coverage/src/types/requests/system-context.ts.html +0 -142
- package/coverage/src/types/scene-tree.ts.html +0 -178
- package/coverage/src/types/system-context/index.html +0 -161
- package/coverage/src/types/system-context/index.ts.html +0 -112
- package/coverage/src/types/system-context/key-state.ts.html +0 -106
- package/coverage/src/types/system-context/mouse-state.ts.html +0 -106
- package/coverage/src/types/system-context/primary-tool.ts.html +0 -112
- package/coverage/src/types/transaction.ts.html +0 -103
- package/coverage/src/types/undo.ts.html +0 -103
- package/coverage/src/types/viewport.ts.html +0 -127
- package/dist/__tests__/core.test.d.ts +0 -2
- package/dist/__tests__/core.test.d.ts.map +0 -1
- package/dist/__tests__/core.test.js +0 -122
- package/dist/__tests__/core.test.js.map +0 -1
- package/dist/apis/interaction-core.d.ts +0 -3
- package/dist/apis/interaction-core.d.ts.map +0 -1
- package/dist/apis/interaction-core.js +0 -22
- package/dist/apis/interaction-core.js.map +0 -1
- package/dist/apis/system-context.d.ts +0 -3
- package/dist/apis/system-context.d.ts.map +0 -1
- package/dist/apis/system-context.js +0 -16
- package/dist/apis/system-context.js.map +0 -1
- package/dist/apis/transaction.d.ts +0 -3
- package/dist/apis/transaction.d.ts.map +0 -1
- package/dist/apis/transaction.js +0 -12
- package/dist/apis/transaction.js.map +0 -1
- package/dist/apis/undo.d.ts +0 -3
- package/dist/apis/undo.d.ts.map +0 -1
- package/dist/apis/undo.js +0 -12
- package/dist/apis/undo.js.map +0 -1
- package/dist/apis/viewport.d.ts +0 -4
- package/dist/apis/viewport.d.ts.map +0 -1
- package/dist/apis/viewport.js +0 -27
- package/dist/apis/viewport.js.map +0 -1
- package/dist/combinations.d.ts +0 -4
- package/dist/combinations.d.ts.map +0 -1
- package/dist/combinations.js +0 -42
- package/dist/combinations.js.map +0 -1
- package/dist/requests/factory copy.d.ts +0 -7
- package/dist/requests/factory copy.d.ts.map +0 -1
- package/dist/requests/factory copy.js +0 -10
- package/dist/requests/factory copy.js.map +0 -1
- package/dist/requests/factory.d.ts +0 -7
- package/dist/requests/factory.d.ts.map +0 -1
- package/dist/requests/factory.js +0 -10
- package/dist/requests/factory.js.map +0 -1
- package/dist/requests/index.d.ts +0 -3
- package/dist/requests/index.d.ts.map +0 -1
- package/dist/requests/index.js +0 -21
- package/dist/requests/index.js.map +0 -1
- package/dist/requests/primary-tool.d.ts +0 -7
- package/dist/requests/primary-tool.d.ts.map +0 -1
- package/dist/requests/primary-tool.js +0 -13
- package/dist/requests/primary-tool.js.map +0 -1
- package/dist/requests/props copy.d.ts +0 -7
- package/dist/requests/props copy.d.ts.map +0 -1
- package/dist/requests/props copy.js +0 -13
- package/dist/requests/props copy.js.map +0 -1
- package/dist/requests/props.d.ts +0 -7
- package/dist/requests/props.d.ts.map +0 -1
- package/dist/requests/props.js +0 -13
- package/dist/requests/props.js.map +0 -1
- package/dist/requests/render.d.ts +0 -3
- package/dist/requests/render.d.ts.map +0 -1
- package/dist/requests/render.js +0 -22
- package/dist/requests/render.js.map +0 -1
- package/dist/requests/scene-tree.d.ts +0 -7
- package/dist/requests/scene-tree.d.ts.map +0 -1
- package/dist/requests/scene-tree.js +0 -17
- package/dist/requests/scene-tree.js.map +0 -1
- package/dist/requests/selection.d.ts +0 -7
- package/dist/requests/selection.d.ts.map +0 -1
- package/dist/requests/selection.js +0 -10
- package/dist/requests/selection.js.map +0 -1
- package/dist/requests/system-context copy.d.ts +0 -7
- package/dist/requests/system-context copy.d.ts.map +0 -1
- package/dist/requests/system-context copy.js +0 -19
- package/dist/requests/system-context copy.js.map +0 -1
- package/dist/requests/system-context.d.ts +0 -7
- package/dist/requests/system-context.d.ts.map +0 -1
- package/dist/requests/system-context.js +0 -10
- package/dist/requests/system-context.js.map +0 -1
- package/dist/requests/types.d.ts +0 -7
- package/dist/requests/types.d.ts.map +0 -1
- package/dist/requests/types.js +0 -4
- package/dist/requests/types.js.map +0 -1
- package/dist/requests/viewport.d.ts +0 -19
- package/dist/requests/viewport.d.ts.map +0 -1
- package/dist/requests/viewport.js +0 -6
- package/dist/requests/viewport.js.map +0 -1
- package/dist/subscribes/index.d.ts +0 -3
- package/dist/subscribes/index.d.ts.map +0 -1
- package/dist/subscribes/index.js +0 -7
- package/dist/subscribes/index.js.map +0 -1
- package/dist/subscribes/input-system/index.d.ts +0 -3
- package/dist/subscribes/input-system/index.d.ts.map +0 -1
- package/dist/subscribes/input-system/index.js +0 -26
- package/dist/subscribes/input-system/index.js.map +0 -1
- package/dist/subscribes/input-system/primary-tool.d.ts +0 -10
- package/dist/subscribes/input-system/primary-tool.d.ts.map +0 -1
- package/dist/subscribes/input-system/primary-tool.js +0 -15
- package/dist/subscribes/input-system/primary-tool.js.map +0 -1
- package/dist/subscribes/input-system/render.d.ts +0 -16
- package/dist/subscribes/input-system/render.d.ts.map +0 -1
- package/dist/subscribes/input-system/render.js +0 -97
- package/dist/subscribes/input-system/render.js.map +0 -1
- package/dist/subscribes/input-system/undo.d.ts +0 -10
- package/dist/subscribes/input-system/undo.d.ts.map +0 -1
- package/dist/subscribes/input-system/undo.js +0 -18
- package/dist/subscribes/input-system/undo.js.map +0 -1
- package/dist/subscribes/input-system/viewport.d.ts +0 -11
- package/dist/subscribes/input-system/viewport.d.ts.map +0 -1
- package/dist/subscribes/input-system/viewport.js +0 -36
- package/dist/subscribes/input-system/viewport.js.map +0 -1
- package/dist/subscribes/interaction-core/create-and-resize.d.ts +0 -5
- package/dist/subscribes/interaction-core/create-and-resize.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/create-and-resize.js +0 -86
- package/dist/subscribes/interaction-core/create-and-resize.js.map +0 -1
- package/dist/subscribes/interaction-core/create-element copy.d.ts +0 -3
- package/dist/subscribes/interaction-core/create-element copy.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/create-element copy.js +0 -17
- package/dist/subscribes/interaction-core/create-element copy.js.map +0 -1
- package/dist/subscribes/interaction-core/create-element.d.ts +0 -3
- package/dist/subscribes/interaction-core/create-element.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/create-element.js +0 -17
- package/dist/subscribes/interaction-core/create-element.js.map +0 -1
- package/dist/subscribes/interaction-core/index.d.ts +0 -3
- package/dist/subscribes/interaction-core/index.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/index.js +0 -42
- package/dist/subscribes/interaction-core/index.js.map +0 -1
- package/dist/subscribes/interaction-core/input-to-decision.d.ts +0 -5
- package/dist/subscribes/interaction-core/input-to-decision.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/input-to-decision.js +0 -48
- package/dist/subscribes/interaction-core/input-to-decision.js.map +0 -1
- package/dist/subscribes/interaction-core/primary-tool.d.ts +0 -3
- package/dist/subscribes/interaction-core/primary-tool.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/primary-tool.js +0 -7
- package/dist/subscribes/interaction-core/primary-tool.js.map +0 -1
- package/dist/subscribes/interaction-core/reset-element-size.d.ts +0 -5
- package/dist/subscribes/interaction-core/reset-element-size.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/reset-element-size.js +0 -9
- package/dist/subscribes/interaction-core/reset-element-size.js.map +0 -1
- package/dist/subscribes/interaction-core/resize-element.d.ts +0 -3
- package/dist/subscribes/interaction-core/resize-element.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/resize-element.js +0 -24
- package/dist/subscribes/interaction-core/resize-element.js.map +0 -1
- package/dist/subscribes/interaction-core/select-elements.d.ts +0 -3
- package/dist/subscribes/interaction-core/select-elements.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/select-elements.js +0 -7
- package/dist/subscribes/interaction-core/select-elements.js.map +0 -1
- package/dist/subscribes/interaction-core/transaction.d.ts +0 -3
- package/dist/subscribes/interaction-core/transaction.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/transaction.js +0 -10
- package/dist/subscribes/interaction-core/transaction.js.map +0 -1
- package/dist/subscribes/interaction-core/undoredo.d.ts +0 -3
- package/dist/subscribes/interaction-core/undoredo.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/undoredo.js +0 -15
- package/dist/subscribes/interaction-core/undoredo.js.map +0 -1
- package/dist/subscribes/interaction-core/viewport.d.ts +0 -3
- package/dist/subscribes/interaction-core/viewport.d.ts.map +0 -1
- package/dist/subscribes/interaction-core/viewport.js +0 -29
- package/dist/subscribes/interaction-core/viewport.js.map +0 -1
- package/dist/subscribes/render.d.ts +0 -6
- package/dist/subscribes/render.d.ts.map +0 -1
- package/dist/subscribes/render.js +0 -28
- package/dist/subscribes/render.js.map +0 -1
- package/dist/types/interaction-core.d.ts +0 -11
- package/dist/types/interaction-core.d.ts.map +0 -1
- package/dist/types/interaction-core.js +0 -2
- package/dist/types/interaction-core.js.map +0 -1
- package/dist/types/requests/factory copy.d.ts +0 -12
- package/dist/types/requests/factory copy.d.ts.map +0 -1
- package/dist/types/requests/factory copy.js +0 -2
- package/dist/types/requests/factory copy.js.map +0 -1
- package/dist/types/requests/factory.d.ts +0 -12
- package/dist/types/requests/factory.d.ts.map +0 -1
- package/dist/types/requests/factory.js +0 -2
- package/dist/types/requests/factory.js.map +0 -1
- package/dist/types/requests/index.d.ts +0 -17
- package/dist/types/requests/index.d.ts.map +0 -1
- package/dist/types/requests/index.js +0 -4
- package/dist/types/requests/index.js.map +0 -1
- package/dist/types/requests/primary-tool.d.ts +0 -13
- package/dist/types/requests/primary-tool.d.ts.map +0 -1
- package/dist/types/requests/primary-tool.js +0 -2
- package/dist/types/requests/primary-tool.js.map +0 -1
- package/dist/types/requests/props copy.d.ts +0 -14
- package/dist/types/requests/props copy.d.ts.map +0 -1
- package/dist/types/requests/props copy.js +0 -2
- package/dist/types/requests/props copy.js.map +0 -1
- package/dist/types/requests/props.d.ts +0 -14
- package/dist/types/requests/props.d.ts.map +0 -1
- package/dist/types/requests/props.js +0 -2
- package/dist/types/requests/props.js.map +0 -1
- package/dist/types/requests/render.d.ts +0 -15
- package/dist/types/requests/render.d.ts.map +0 -1
- package/dist/types/requests/render.js +0 -2
- package/dist/types/requests/render.js.map +0 -1
- package/dist/types/requests/scene-tree.d.ts +0 -14
- package/dist/types/requests/scene-tree.d.ts.map +0 -1
- package/dist/types/requests/scene-tree.js +0 -2
- package/dist/types/requests/scene-tree.js.map +0 -1
- package/dist/types/requests/selection.d.ts +0 -12
- package/dist/types/requests/selection.d.ts.map +0 -1
- package/dist/types/requests/selection.js +0 -2
- package/dist/types/requests/selection.js.map +0 -1
- package/dist/types/requests/system-context.d.ts +0 -17
- package/dist/types/requests/system-context.d.ts.map +0 -1
- package/dist/types/requests/system-context.js +0 -2
- package/dist/types/requests/system-context.js.map +0 -1
- package/dist/types/requests/system.d.ts +0 -13
- package/dist/types/requests/system.d.ts.map +0 -1
- package/dist/types/requests/system.js +0 -2
- package/dist/types/requests/system.js.map +0 -1
- package/dist/types/requests/viewport.d.ts +0 -20
- package/dist/types/requests/viewport.d.ts.map +0 -1
- package/dist/types/requests/viewport.js +0 -6
- package/dist/types/requests/viewport.js.map +0 -1
- package/dist/types/requests.d.ts +0 -8
- package/dist/types/requests.d.ts.map +0 -1
- package/dist/types/requests.js +0 -2
- package/dist/types/requests.js.map +0 -1
- package/dist/types/system-context/index.d.ts +0 -8
- package/dist/types/system-context/index.d.ts.map +0 -1
- package/dist/types/system-context/index.js +0 -4
- package/dist/types/system-context/index.js.map +0 -1
- package/dist/types/system-context/key-state.d.ts +0 -6
- package/dist/types/system-context/key-state.d.ts.map +0 -1
- package/dist/types/system-context/key-state.js +0 -2
- package/dist/types/system-context/key-state.js.map +0 -1
- package/dist/types/system-context/mouse-state.d.ts +0 -6
- package/dist/types/system-context/mouse-state.d.ts.map +0 -1
- package/dist/types/system-context/mouse-state.js +0 -2
- package/dist/types/system-context/mouse-state.js.map +0 -1
- package/dist/types/system-context/primary-tool.d.ts +0 -8
- package/dist/types/system-context/primary-tool.d.ts.map +0 -1
- package/dist/types/system-context/primary-tool.js +0 -2
- package/dist/types/system-context/primary-tool.js.map +0 -1
- package/dist/types/transaction.d.ts +0 -6
- package/dist/types/transaction.d.ts.map +0 -1
- package/dist/types/transaction.js +0 -2
- package/dist/types/transaction.js.map +0 -1
- package/dist/types/undo.d.ts +0 -6
- package/dist/types/undo.d.ts.map +0 -1
- package/dist/types/undo.js +0 -2
- package/dist/types/undo.js.map +0 -1
- package/dist/types/viewport.d.ts +0 -12
- package/dist/types/viewport.d.ts.map +0 -1
- package/dist/types/viewport.js +0 -2
- package/dist/types/viewport.js.map +0 -1
- package/src/__tests__/core.test.ts +0 -153
- package/src/apis/element-selection.ts +0 -16
- package/src/apis/index.ts +0 -30
- package/src/apis/input-system.ts +0 -12
- package/src/apis/interaction-core.ts +0 -35
- package/src/apis/props.ts +0 -13
- package/src/apis/render.ts +0 -15
- package/src/apis/scene-tree.ts +0 -69
- package/src/apis/system-context.ts +0 -23
- package/src/apis/transaction.ts +0 -13
- package/src/apis/undo.ts +0 -13
- package/src/apis/viewport.ts +0 -36
- package/src/combinations.ts +0 -46
- package/src/core.ts +0 -158
- package/src/index.ts +0 -4
- package/src/requests/factory.ts +0 -14
- package/src/requests/index.ts +0 -23
- package/src/requests/props.ts +0 -16
- package/src/requests/render.ts +0 -34
- package/src/requests/scene-tree.ts +0 -26
- package/src/requests/selection.ts +0 -14
- package/src/requests/system-context.ts +0 -15
- package/src/subscribes/index.ts +0 -8
- package/src/subscribes/input-system/index.ts +0 -47
- package/src/subscribes/input-system/primary-tool.ts +0 -25
- package/src/subscribes/input-system/render.ts +0 -133
- package/src/subscribes/input-system/undo.ts +0 -29
- package/src/subscribes/input-system/viewport.ts +0 -58
- package/src/subscribes/interaction-core/create-element.ts +0 -22
- package/src/subscribes/interaction-core/index.ts +0 -68
- package/src/subscribes/interaction-core/primary-tool.ts +0 -8
- package/src/subscribes/interaction-core/reset-element-size.ts +0 -12
- package/src/subscribes/interaction-core/resize-element.ts +0 -31
- package/src/subscribes/interaction-core/select-elements.ts +0 -8
- package/src/subscribes/interaction-core/transaction.ts +0 -15
- package/src/subscribes/interaction-core/undoredo.ts +0 -16
- package/src/subscribes/interaction-core/viewport.ts +0 -35
- package/src/types/deps.ts +0 -11
- package/src/types/element-selection.ts +0 -5
- package/src/types/index.ts +0 -100
- package/src/types/input-system.ts +0 -5
- package/src/types/interaction-core.ts +0 -14
- package/src/types/props.ts +0 -8
- package/src/types/render.ts +0 -7
- package/src/types/requests/factory.ts +0 -14
- package/src/types/requests/index.ts +0 -43
- package/src/types/requests/props.ts +0 -16
- package/src/types/requests/render.ts +0 -18
- package/src/types/requests/scene-tree.ts +0 -16
- package/src/types/requests/selection.ts +0 -14
- package/src/types/requests/system-context.ts +0 -19
- package/src/types/scene-tree.ts +0 -31
- package/src/types/system-context/index.ts +0 -9
- package/src/types/system-context/key-state.ts +0 -7
- package/src/types/system-context/mouse-state.ts +0 -7
- package/src/types/system-context/primary-tool.ts +0 -9
- package/src/types/transaction.ts +0 -6
- package/src/types/undo.ts +0 -6
- package/src/types/viewport.ts +0 -14
- package/test-setup.ts +0 -6
- package/tsconfig.json +0 -22
- package/vitest.config.ts +0 -8
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
import sceneTree, { componentRegistry, createDynamicComponent } from '@asyra/scene-tree';
|
|
2
|
+
import { elementPropertyRegistry, getPropertyComponent, propertySchemaRegistry, registerPropertySchema } from '@asyra/props-manager';
|
|
3
|
+
import { renderStrategyRegistry } from '@asyra/render';
|
|
4
|
+
import { failRegistrationRelation as relationFailure, nameCounter, idCounter } from '@asyra/utils';
|
|
5
|
+
const createUnregisterResult = () => ({
|
|
6
|
+
ok: false,
|
|
7
|
+
removed: [],
|
|
8
|
+
skipped: []
|
|
9
|
+
});
|
|
10
|
+
const ensureRegistrationPreconditions = (type, renderStrategy, properties) => {
|
|
11
|
+
// NOTE:
|
|
12
|
+
// Base registries already reject duplicates via MapRegistry.register().
|
|
13
|
+
// This preflight exists to fail before any side-effects (id/name/property writes),
|
|
14
|
+
// so defineComponent remains all-or-nothing and does not leave partial state.
|
|
15
|
+
if (componentRegistry.has(type)) {
|
|
16
|
+
throw new Error(`Component "${type}" is already registered`);
|
|
17
|
+
}
|
|
18
|
+
if (renderStrategy && renderStrategyRegistry.has(type)) {
|
|
19
|
+
throw new Error(`Render strategy for "${type}" is already registered`);
|
|
20
|
+
}
|
|
21
|
+
for (const property of properties) {
|
|
22
|
+
const schemaType = property.schema?.type;
|
|
23
|
+
if (!schemaType) {
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
if (propertySchemaRegistry.has(schemaType)) {
|
|
27
|
+
throw new Error(`Property schema "${schemaType}" is already registered`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
for (let index = 0; index < properties.length; index += 1) {
|
|
31
|
+
const schemaType = properties[index].schema?.type;
|
|
32
|
+
if (!schemaType) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
// Guard duplicate schema types inside one component definition early.
|
|
36
|
+
// Even though registry-level checks exist, this catches local config issues
|
|
37
|
+
// before any registration writes have started.
|
|
38
|
+
for (let nextIndex = index + 1; nextIndex < properties.length; nextIndex += 1) {
|
|
39
|
+
if (properties[nextIndex].schema?.type === schemaType) {
|
|
40
|
+
throw new Error(`[Core] Duplicate schema type "${schemaType}" in component "${type}" definition`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const countActiveSceneInstances = (type, sceneTreeOwner = sceneTree) => {
|
|
46
|
+
// Runtime guard source:
|
|
47
|
+
// unregister is blocked by default when scene instances still use this type.
|
|
48
|
+
let count = 0;
|
|
49
|
+
sceneTreeOwner.getAllElements().forEach((element) => {
|
|
50
|
+
if (element.get('type') === type) {
|
|
51
|
+
count += 1;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
return count;
|
|
55
|
+
};
|
|
56
|
+
const clonePropertyDefinition = (property) => ({
|
|
57
|
+
...property,
|
|
58
|
+
alias: property.alias ? [...property.alias] : undefined,
|
|
59
|
+
schema: property.schema
|
|
60
|
+
? {
|
|
61
|
+
...property.schema,
|
|
62
|
+
fields: property.schema.fields.map((field) => ({ ...field }))
|
|
63
|
+
}
|
|
64
|
+
: undefined
|
|
65
|
+
});
|
|
66
|
+
const createComponentDefaults = (properties) => {
|
|
67
|
+
const defaults = {};
|
|
68
|
+
properties.forEach((property) => {
|
|
69
|
+
if (property.defaultValue !== undefined) {
|
|
70
|
+
defaults[property.name] = property.defaultValue;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return defaults;
|
|
74
|
+
};
|
|
75
|
+
const assertComponentRelationMutationAllowed = (componentType, operation, sceneTreeOwner = sceneTree) => {
|
|
76
|
+
if (!componentRegistry.has(componentType)) {
|
|
77
|
+
return relationFailure('REGISTRATION_NOT_FOUND', operation, `Component "${componentType}" is not registered`, { source: { kind: 'component', key: componentType } });
|
|
78
|
+
}
|
|
79
|
+
const activeInstances = countActiveSceneInstances(componentType, sceneTreeOwner);
|
|
80
|
+
if (activeInstances > 0) {
|
|
81
|
+
return relationFailure('REGISTRATION_IN_USE', operation, `Component "${componentType}" has ${activeInstances} active instance(s)`, {
|
|
82
|
+
registration: { kind: 'component', key: componentType },
|
|
83
|
+
source: { kind: 'component', key: componentType }
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const commitComponentRegistration = (current, next) => {
|
|
88
|
+
const restoreProperties = (properties) => {
|
|
89
|
+
elementPropertyRegistry.unregisterComponent(current.type);
|
|
90
|
+
properties.forEach((property) => elementPropertyRegistry.register(property, current.type));
|
|
91
|
+
};
|
|
92
|
+
componentRegistry.unregister(current.type);
|
|
93
|
+
try {
|
|
94
|
+
componentRegistry.register(next);
|
|
95
|
+
restoreProperties(next.properties);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
componentRegistry.unregister(current.type);
|
|
99
|
+
componentRegistry.register(current);
|
|
100
|
+
restoreProperties(current.properties);
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const rebuildComponentProperties = (componentType, properties) => {
|
|
105
|
+
const registration = componentRegistry.get(componentType);
|
|
106
|
+
if (!registration) {
|
|
107
|
+
return relationFailure('REGISTRATION_NOT_FOUND', 'define-relation', `Component "${componentType}" is not registered`, { registration: { kind: 'component', key: componentType } });
|
|
108
|
+
}
|
|
109
|
+
const defaults = createComponentDefaults(properties);
|
|
110
|
+
const Constructor = createDynamicComponent(registration.type, registration.idPrefix, registration.namePrefix, properties, defaults, registration.isContainer);
|
|
111
|
+
const nextRegistration = {
|
|
112
|
+
...registration,
|
|
113
|
+
constructor: Constructor,
|
|
114
|
+
properties,
|
|
115
|
+
defaults
|
|
116
|
+
};
|
|
117
|
+
commitComponentRegistration(registration, nextRegistration);
|
|
118
|
+
};
|
|
119
|
+
export const getComponentPropertyRelations = (componentType) => {
|
|
120
|
+
const registration = componentRegistry.get(componentType);
|
|
121
|
+
if (!registration) {
|
|
122
|
+
return relationFailure('REGISTRATION_NOT_FOUND', 'define-relation', `Component "${componentType}" is not registered`, { registration: { kind: 'component', key: componentType } });
|
|
123
|
+
}
|
|
124
|
+
return registration.properties.map((property) => ({
|
|
125
|
+
source: { kind: 'component', key: componentType },
|
|
126
|
+
name: property.name,
|
|
127
|
+
target: { kind: 'property', key: property.type },
|
|
128
|
+
onTargetUnregister: 'detach',
|
|
129
|
+
componentType,
|
|
130
|
+
propertyName: property.name,
|
|
131
|
+
property: clonePropertyDefinition(property)
|
|
132
|
+
}));
|
|
133
|
+
};
|
|
134
|
+
const removeComponentPropertyRelationWithOwner = (componentType, propertyName, sceneTreeOwner) => {
|
|
135
|
+
assertComponentRelationMutationAllowed(componentType, 'remove-relation', sceneTreeOwner);
|
|
136
|
+
const registration = componentRegistry.get(componentType);
|
|
137
|
+
if (!registration) {
|
|
138
|
+
return relationFailure('REGISTRATION_NOT_FOUND', 'remove-relation', `Component "${componentType}" is not registered`, { source: { kind: 'component', key: componentType } });
|
|
139
|
+
}
|
|
140
|
+
const property = registration.properties.find((candidate) => candidate.name === propertyName);
|
|
141
|
+
if (!property) {
|
|
142
|
+
return relationFailure('RELATION_NOT_FOUND', 'remove-relation', `Component property relation "${componentType}/${propertyName}" was not found`, {
|
|
143
|
+
source: { kind: 'component', key: componentType },
|
|
144
|
+
relationName: propertyName
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
const properties = registration.properties.filter((candidate) => candidate.name !== propertyName);
|
|
148
|
+
rebuildComponentProperties(componentType, properties);
|
|
149
|
+
const relation = {
|
|
150
|
+
source: { kind: 'component', key: componentType },
|
|
151
|
+
name: property.name,
|
|
152
|
+
target: { kind: 'property', key: property.type },
|
|
153
|
+
onTargetUnregister: 'detach'
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
ok: true,
|
|
157
|
+
operation: 'remove-relation',
|
|
158
|
+
source: relation.source,
|
|
159
|
+
relation
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
export const removeComponentPropertyRelation = (componentType, propertyName) => removeComponentPropertyRelationWithOwner(componentType, propertyName, sceneTree);
|
|
163
|
+
export const removeComponentPropertyRelationForSceneTree = removeComponentPropertyRelationWithOwner;
|
|
164
|
+
const defineComponentPropertyRelationWithOwner = (componentType, property, sceneTreeOwner) => {
|
|
165
|
+
assertComponentRelationMutationAllowed(componentType, 'define-relation', sceneTreeOwner);
|
|
166
|
+
const registration = componentRegistry.get(componentType);
|
|
167
|
+
if (!registration) {
|
|
168
|
+
return relationFailure('REGISTRATION_NOT_FOUND', 'define-relation', `Component "${componentType}" is not registered`, { source: { kind: 'component', key: componentType } });
|
|
169
|
+
}
|
|
170
|
+
if (registration.properties.some((candidate) => candidate.name === property.name)) {
|
|
171
|
+
return relationFailure('DUPLICATE_RELATION', 'define-relation', `Component property relation "${componentType}/${property.name}" is already defined`, {
|
|
172
|
+
source: { kind: 'component', key: componentType },
|
|
173
|
+
relationName: property.name
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (!getPropertyComponent(property.type)) {
|
|
177
|
+
return relationFailure('RELATION_TARGET_NOT_FOUND', 'define-relation', `Property runtime "${property.type}" is not registered`, {
|
|
178
|
+
source: { kind: 'component', key: componentType },
|
|
179
|
+
relationName: property.name,
|
|
180
|
+
target: { kind: 'property', key: property.type }
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
if (property.schema?.type &&
|
|
184
|
+
propertySchemaRegistry.has(property.schema.type)) {
|
|
185
|
+
throw new Error(`Property schema "${property.schema.type}" is already registered`);
|
|
186
|
+
}
|
|
187
|
+
const properties = [
|
|
188
|
+
...registration.properties,
|
|
189
|
+
clonePropertyDefinition(property)
|
|
190
|
+
];
|
|
191
|
+
const defaults = createComponentDefaults(properties);
|
|
192
|
+
const Constructor = createDynamicComponent(registration.type, registration.idPrefix, registration.namePrefix, properties, defaults, registration.isContainer);
|
|
193
|
+
if (property.schema?.type) {
|
|
194
|
+
registerPropertySchema(property.schema);
|
|
195
|
+
}
|
|
196
|
+
commitComponentRegistration(registration, {
|
|
197
|
+
...registration,
|
|
198
|
+
constructor: Constructor,
|
|
199
|
+
properties,
|
|
200
|
+
defaults
|
|
201
|
+
});
|
|
202
|
+
const relation = {
|
|
203
|
+
source: { kind: 'component', key: componentType },
|
|
204
|
+
name: property.name,
|
|
205
|
+
target: { kind: 'property', key: property.type },
|
|
206
|
+
onTargetUnregister: 'detach'
|
|
207
|
+
};
|
|
208
|
+
return {
|
|
209
|
+
ok: true,
|
|
210
|
+
operation: 'define-relation',
|
|
211
|
+
source: relation.source,
|
|
212
|
+
relation
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
export const defineComponentPropertyRelation = (componentType, property) => defineComponentPropertyRelationWithOwner(componentType, property, sceneTree);
|
|
216
|
+
export const defineComponentPropertyRelationForSceneTree = defineComponentPropertyRelationWithOwner;
|
|
217
|
+
const addUniqueRemoved = (result, removedSet, item) => {
|
|
218
|
+
// Keep removed report deterministic and duplicate-free.
|
|
219
|
+
if (removedSet.has(item)) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
removedSet.add(item);
|
|
223
|
+
result.removed.push(item);
|
|
224
|
+
};
|
|
225
|
+
/**
|
|
226
|
+
* Define a custom component type that can be used in the scene tree
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```ts
|
|
230
|
+
* defineComponent({
|
|
231
|
+
* type: 'star',
|
|
232
|
+
* idPrefix: 'star',
|
|
233
|
+
* namePrefix: 'Star',
|
|
234
|
+
* properties: [
|
|
235
|
+
* { name: 'count', type: PropertyTypes.CUSTOM, defaultValue: 5 },
|
|
236
|
+
* { name: 'x', type: PropertyTypes.NUMBER, defaultValue: 0 },
|
|
237
|
+
* { name: 'y', type: PropertyTypes.NUMBER, defaultValue: 0 },
|
|
238
|
+
* { name: 'width', type: PropertyTypes.NUMBER, defaultValue: 100 },
|
|
239
|
+
* { name: 'height', type: PropertyTypes.NUMBER, defaultValue: 100 }
|
|
240
|
+
* ],
|
|
241
|
+
* renderStrategy: (graphic, data) => {
|
|
242
|
+
* // Custom star rendering logic
|
|
243
|
+
* const count = data.count || 5
|
|
244
|
+
* // ... draw star with 'count' points
|
|
245
|
+
* }
|
|
246
|
+
* })
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
export function defineComponent(definition) {
|
|
250
|
+
const { type, idPrefix, namePrefix, properties, renderStrategy, isContainer } = definition;
|
|
251
|
+
// Phase A: preflight checks before any writes.
|
|
252
|
+
ensureRegistrationPreconditions(type, renderStrategy, properties);
|
|
253
|
+
// 0. Register type with nameCounter for auto-numbering
|
|
254
|
+
// This allows app-level components to register without modifying framework NameTypes
|
|
255
|
+
nameCounter.registerType(type, namePrefix, undefined, { override: true });
|
|
256
|
+
// 1. Register type with idCounter for auto-numbering
|
|
257
|
+
// This allows app-level components to register without modifying framework IDTypes
|
|
258
|
+
idCounter.registerType(type, idPrefix, undefined, { override: true });
|
|
259
|
+
// Phase B: register counters + properties, and derive default values.
|
|
260
|
+
const defaults = createComponentDefaults(properties);
|
|
261
|
+
for (const prop of properties) {
|
|
262
|
+
elementPropertyRegistry.register(prop, type);
|
|
263
|
+
}
|
|
264
|
+
// Phase C: register schema types declared by this component definition.
|
|
265
|
+
for (const prop of properties) {
|
|
266
|
+
const schema = prop.schema;
|
|
267
|
+
if (!schema?.type) {
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
registerPropertySchema(schema);
|
|
271
|
+
}
|
|
272
|
+
// Phase D: construct runtime class and register component metadata.
|
|
273
|
+
const ComponentClass = createDynamicComponent(type, idPrefix, namePrefix, properties, defaults, isContainer);
|
|
274
|
+
componentRegistry.register({
|
|
275
|
+
type,
|
|
276
|
+
idPrefix,
|
|
277
|
+
namePrefix,
|
|
278
|
+
constructor: ComponentClass,
|
|
279
|
+
properties,
|
|
280
|
+
defaults,
|
|
281
|
+
isContainer
|
|
282
|
+
});
|
|
283
|
+
// Phase E: optional render strategy registration.
|
|
284
|
+
if (renderStrategy) {
|
|
285
|
+
renderStrategyRegistry.register(type, renderStrategy);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Graph-owned component cleanup. Property capabilities and render strategies
|
|
290
|
+
* are independent registration nodes and are intentionally preserved.
|
|
291
|
+
*/
|
|
292
|
+
export const unregisterComponentGraphRegistration = (type) => {
|
|
293
|
+
if (!componentRegistry.unregister(type))
|
|
294
|
+
return false;
|
|
295
|
+
elementPropertyRegistry.unregisterComponent(type);
|
|
296
|
+
idCounter.unregisterType(type);
|
|
297
|
+
nameCounter.unregisterType(type);
|
|
298
|
+
return true;
|
|
299
|
+
};
|
|
300
|
+
export function unregisterComponent(type, options = {}) {
|
|
301
|
+
const { cascade = true, force = false, detailed = false } = options;
|
|
302
|
+
const result = createUnregisterResult();
|
|
303
|
+
const removedSet = new Set();
|
|
304
|
+
let didMutate = false;
|
|
305
|
+
const registration = componentRegistry.get(type);
|
|
306
|
+
const activeInstances = countActiveSceneInstances(type);
|
|
307
|
+
// Phase 1: runtime safety guard.
|
|
308
|
+
if (activeInstances > 0 && !force) {
|
|
309
|
+
result.skipped.push({
|
|
310
|
+
item: `component:${type}`,
|
|
311
|
+
reason: `Blocked because ${activeInstances} active scene instance(s) still use this type. Pass { force: true } to override.`
|
|
312
|
+
});
|
|
313
|
+
return detailed ? result : false;
|
|
314
|
+
}
|
|
315
|
+
const hasComponentRegistration = componentRegistry.has(type);
|
|
316
|
+
const hasRenderRegistration = renderStrategyRegistry.has(type);
|
|
317
|
+
const hasPropertyRegistration = elementPropertyRegistry.getPropertiesForComponent(type).length > 0;
|
|
318
|
+
const hasCounterRegistration = idCounter.hasType(type) || nameCounter.hasType(type);
|
|
319
|
+
// Phase 2: no-op fast exit for unknown component type.
|
|
320
|
+
if (!hasComponentRegistration &&
|
|
321
|
+
!hasRenderRegistration &&
|
|
322
|
+
!hasPropertyRegistration &&
|
|
323
|
+
!hasCounterRegistration) {
|
|
324
|
+
result.skipped.push({
|
|
325
|
+
item: `component:${type}`,
|
|
326
|
+
reason: 'No component-related registrations found'
|
|
327
|
+
});
|
|
328
|
+
return detailed ? result : false;
|
|
329
|
+
}
|
|
330
|
+
if (componentRegistry.unregister(type)) {
|
|
331
|
+
didMutate = true;
|
|
332
|
+
addUniqueRemoved(result, removedSet, `component:${type}`);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
result.skipped.push({
|
|
336
|
+
item: `component:${type}`,
|
|
337
|
+
reason: 'Component registry entry not found'
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
if (!cascade) {
|
|
341
|
+
// Compatibility path: only remove the component registry entry.
|
|
342
|
+
result.ok = didMutate;
|
|
343
|
+
return detailed ? result : didMutate;
|
|
344
|
+
}
|
|
345
|
+
// Phase 3 (cascade): discover what this component owns from its own record.
|
|
346
|
+
const registeredProperties = registration?.properties ??
|
|
347
|
+
elementPropertyRegistry.getPropertiesForComponent(type);
|
|
348
|
+
const ownedPropertyNames = [];
|
|
349
|
+
for (const property of registeredProperties) {
|
|
350
|
+
const propertyName = property.name;
|
|
351
|
+
if (!propertyName) {
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
const owners = elementPropertyRegistry.getComponentTypesForProperty(propertyName);
|
|
355
|
+
if (owners.includes(type)) {
|
|
356
|
+
ownedPropertyNames.push(propertyName);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (ownedPropertyNames.length > 0) {
|
|
360
|
+
// Remove component ownership from property definitions.
|
|
361
|
+
elementPropertyRegistry.unregisterComponent(type);
|
|
362
|
+
for (const propertyName of ownedPropertyNames) {
|
|
363
|
+
didMutate = true;
|
|
364
|
+
addUniqueRemoved(result, removedSet, `property-owner:${type}.${propertyName}`);
|
|
365
|
+
if (!elementPropertyRegistry.has(propertyName)) {
|
|
366
|
+
// Last owner removed => property definition removed from registry.
|
|
367
|
+
addUniqueRemoved(result, removedSet, `property-definition:${propertyName}`);
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
const ownersAfter = elementPropertyRegistry.getComponentTypesForProperty(propertyName);
|
|
371
|
+
// Shared definition: keep it and report remaining owners.
|
|
372
|
+
result.skipped.push({
|
|
373
|
+
item: `property-definition:${propertyName}`,
|
|
374
|
+
reason: `Kept because shared by: ${ownersAfter.join(', ')}`
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
for (const property of registration?.properties ?? []) {
|
|
379
|
+
const schemaType = property.schema?.type;
|
|
380
|
+
if (!schemaType) {
|
|
381
|
+
continue;
|
|
382
|
+
}
|
|
383
|
+
if (propertySchemaRegistry.has(schemaType)) {
|
|
384
|
+
// Schema ownership is defined by component property declaration.
|
|
385
|
+
propertySchemaRegistry.unregister(schemaType);
|
|
386
|
+
didMutate = true;
|
|
387
|
+
addUniqueRemoved(result, removedSet, `property-schema:${schemaType}`);
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
result.skipped.push({
|
|
391
|
+
item: `property-schema:${schemaType}`,
|
|
392
|
+
reason: 'Schema registry entry not found'
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
if (renderStrategyRegistry.unregister(type)) {
|
|
396
|
+
didMutate = true;
|
|
397
|
+
addUniqueRemoved(result, removedSet, `render:${type}`);
|
|
398
|
+
}
|
|
399
|
+
else if (hasRenderRegistration) {
|
|
400
|
+
result.skipped.push({
|
|
401
|
+
item: `render:${type}`,
|
|
402
|
+
reason: 'Render strategy entry not found'
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
if (idCounter.unregisterType(type)) {
|
|
406
|
+
didMutate = true;
|
|
407
|
+
addUniqueRemoved(result, removedSet, `id-counter:${type}`);
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
result.skipped.push({
|
|
411
|
+
item: `id-counter:${type}`,
|
|
412
|
+
reason: 'ID counter entry not found'
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
if (nameCounter.unregisterType(type)) {
|
|
416
|
+
didMutate = true;
|
|
417
|
+
addUniqueRemoved(result, removedSet, `name-counter:${type}`);
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
result.skipped.push({
|
|
421
|
+
item: `name-counter:${type}`,
|
|
422
|
+
reason: 'Name counter entry not found'
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
// Phase 4: finalize compatibility + detailed reporting.
|
|
426
|
+
result.ok = didMutate;
|
|
427
|
+
return detailed ? result : didMutate;
|
|
428
|
+
}
|
|
429
|
+
//# sourceMappingURL=define-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-component.js","sourceRoot":"","sources":["../src/define-component.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,EAAE,EAChB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAEvB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,sBAAsB,EAAuB,MAAM,eAAe,CAAA;AAC3E,OAAO,EACL,wBAAwB,IAAI,eAAe,EAC3C,WAAW,EACX,SAAS,EAIV,MAAM,cAAc,CAAA;AA8DrB,MAAM,sBAAsB,GAAG,GAA8B,EAAE,CAAC,CAAC;IAC/D,EAAE,EAAE,KAAK;IACT,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,EAAE;CACZ,CAAC,CAAA;AAEF,MAAM,+BAA+B,GAAG,CACtC,IAAY,EACZ,cAA0C,EAC1C,UAAgC,EAChC,EAAE;IACF,QAAQ;IACR,wEAAwE;IACxE,mFAAmF;IACnF,8EAA8E;IAC9E,IAAI,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,yBAAyB,CAAC,CA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AC;QACrC,SAAS,GAAG,IAAI,CAAA;QAChB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,gBAAgB,IAAI,EAAE,CAAC,CAAA;IAC9D,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;YAClB,IAAI,EAAE,gBAAgB,IAAI,EAAE;YAC5B,MAAM,EAAE,8BAA8B;SACvC,CAAC,CAAA;IACJ,CAAC;IAED,wDAAwD;IACxD,MAAM,CAAC,EAAE,GAAG,SAAS,CAAA;IACrB,OAAO,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;AACtC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type PropertyChildRelationDefinition, type PropertyComponentConfigRegistration, type PropertyComponentConstructor, type PropertyRegistrationOptions, type PropsManager } from '@asyra/props-manager';
|
|
2
|
+
import { type RegistrationDefinitionMetadata, type RegistrationRelationMetadata, type RelationOperationSuccess } from '@asyra/utils';
|
|
3
|
+
export interface PropertyComponentConstructorDefinition {
|
|
4
|
+
type: string;
|
|
5
|
+
constructor: PropertyComponentConstructor;
|
|
6
|
+
canonicalChildren?: PropertyChildRelationDefinition;
|
|
7
|
+
options?: PropertyRegistrationOptions;
|
|
8
|
+
registration?: RegistrationDefinitionMetadata;
|
|
9
|
+
}
|
|
10
|
+
export interface PropertyComponentConfigDefinition extends PropertyComponentConfigRegistration {
|
|
11
|
+
options?: PropertyRegistrationOptions;
|
|
12
|
+
registration?: RegistrationDefinitionMetadata;
|
|
13
|
+
}
|
|
14
|
+
export type PropertyComponentDefinition = PropertyComponentConstructorDefinition | PropertyComponentConfigDefinition;
|
|
15
|
+
export interface PropertyChildRelationMetadata extends RegistrationRelationMetadata, PropertyChildRelationDefinition {
|
|
16
|
+
parentPropertyType: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const getPropertyChildRelations: (parentPropertyType: string) => readonly PropertyChildRelationMetadata[];
|
|
19
|
+
export declare const removePropertyChildRelation: (parentPropertyType: string, key: string, manager?: PropsManager) => RelationOperationSuccess;
|
|
20
|
+
export declare const definePropertyChildRelation: (parentPropertyType: string, relationDefinition: PropertyChildRelationDefinition, manager?: PropsManager) => RelationOperationSuccess;
|
|
21
|
+
/**
|
|
22
|
+
* Define a property component constructor for a property type.
|
|
23
|
+
*/
|
|
24
|
+
export declare function definePropertyComponent(definition: PropertyComponentDefinition): PropertyComponentConstructor;
|
|
25
|
+
/**
|
|
26
|
+
* Unregister a property component constructor by property type.
|
|
27
|
+
*/
|
|
28
|
+
export declare function unregisterPropertyComponent(type: string): boolean;
|
|
29
|
+
//# sourceMappingURL=define-property-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-property-component.d.ts","sourceRoot":"","sources":["../src/define-property-component.ts"],"names":[],"mappings":"AAAA,OAAqB,EAOnB,KAAK,+BAA+B,EACpC,KAAK,mCAAmC,EACxC,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC9B,MAAM,cAAc,CAAA;AAErB,MAAM,WAAW,sCAAsC;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,4BAA4B,CAAA;IACzC,iBAAiB,CAAC,EAAE,+BAA+B,CAAA;IACnD,OAAO,CAAC,EAAE,2BAA2B,CAAA;IACrC,YAAY,CAAC,EAAE,8BAA8B,CAAA;CAC9C;AAED,MAAM,WAAW,iCACf,SAAQ,mCAAmC;IAC3C,OAAO,CAAC,EAAE,2BAA2B,CAAA;IACrC,YAAY,CAAC,EAAE,8BAA8B,CAAA;CAC9C;AAED,MAAM,MAAM,2BAA2B,GACnC,sCAAsC,GACtC,iCAAiC,CAAA;AAErC,MAAM,WAAW,6BACf,SAAQ,4BAA4B,EAClC,+BAA+B;IACjC,kBAAkB,EAAE,MAAM,CAAA;CAC3B;AAgFD,eAAO,MAAM,yBAAyB,GACpC,oBAAoB,MAAM,KACzB,SAAS,6BAA6B,EAuBxC,CAAA;AAED,eAAO,MAAM,2BAA2B,GACtC,oBAAoB,MAAM,EAC1B,KAAK,MAAM,EACX,UAAS,YAA2B,KACnC,wBAuCF,CAAA;AAED,eAAO,MAAM,2BAA2B,GACtC,oBAAoB,MAAM,EAC1B,oBAAoB,+BAA+B,EACnD,UAAS,YAA2B,KACnC,wBAqDF,CAAA;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,2BAA2B,GACtC,4BAA4B,CAuB9B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOjE"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import propsManager, { createPropertyComponentFromConfig as createPropertyComponentFromConfigOwner, clonePropertyComponentConfigRegistration, getPropertyComponent, getPropertyComponentConfigDefinition, propertyComponentRegistry, registerPropertyComponent } from '@asyra/props-manager';
|
|
2
|
+
import { failRegistrationRelation as relationFailure } from '@asyra/utils';
|
|
3
|
+
const createPropertyComponentFromConfig = createPropertyComponentFromConfigOwner;
|
|
4
|
+
const assertPropertyRelationMutationAllowed = (parentPropertyType, operation, manager) => {
|
|
5
|
+
if (!getPropertyComponent(parentPropertyType)) {
|
|
6
|
+
return relationFailure('REGISTRATION_NOT_FOUND', operation, `Property runtime "${parentPropertyType}" is not registered`, { source: { kind: 'property', key: parentPropertyType } });
|
|
7
|
+
}
|
|
8
|
+
const propertyIds = manager.getPropertyIdsByType(parentPropertyType);
|
|
9
|
+
if (propertyIds.length > 0) {
|
|
10
|
+
return relationFailure('REGISTRATION_IN_USE', operation, `Property runtime "${parentPropertyType}" is in use by: ${propertyIds.join(', ')}`, {
|
|
11
|
+
registration: { kind: 'property', key: parentPropertyType },
|
|
12
|
+
source: { kind: 'property', key: parentPropertyType }
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
const definition = getPropertyComponentConfigDefinition(parentPropertyType);
|
|
16
|
+
if (!definition) {
|
|
17
|
+
return relationFailure('RELATION_REMOVE_FAILED', operation, `Property runtime "${parentPropertyType}" does not use a declarative config definition`, { source: { kind: 'property', key: parentPropertyType } });
|
|
18
|
+
}
|
|
19
|
+
return clonePropertyComponentConfigRegistration(definition);
|
|
20
|
+
};
|
|
21
|
+
const commitPropertyComponentRegistration = (type, component, configDefinition) => {
|
|
22
|
+
const currentComponent = getPropertyComponent(type);
|
|
23
|
+
const currentDefinition = getPropertyComponentConfigDefinition(type);
|
|
24
|
+
if (!currentComponent) {
|
|
25
|
+
return relationFailure('REGISTRATION_NOT_FOUND', 'define-relation', `Property runtime "${type}" is not registered`, { registration: { kind: 'property', key: type } });
|
|
26
|
+
}
|
|
27
|
+
propertyComponentRegistry.unregister(type);
|
|
28
|
+
try {
|
|
29
|
+
propertyComponentRegistry.register(type, component, undefined, configDefinition);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
propertyComponentRegistry.register(type, currentComponent, undefined, currentDefinition);
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
export const getPropertyChildRelations = (parentPropertyType) => {
|
|
37
|
+
if (!getPropertyComponent(parentPropertyType)) {
|
|
38
|
+
return relationFailure('REGISTRATION_NOT_FOUND', 'define-relation', `Property runtime "${parentPropertyType}" is not registered`, { registration: { kind: 'property', key: parentPropertyType } });
|
|
39
|
+
}
|
|
40
|
+
const children = getPropertyComponentConfigDefinition(parentPropertyType)?.children;
|
|
41
|
+
if (!children)
|
|
42
|
+
return [];
|
|
43
|
+
return [
|
|
44
|
+
{
|
|
45
|
+
source: { kind: 'property', key: parentPropertyType },
|
|
46
|
+
name: children.key,
|
|
47
|
+
target: { kind: 'property', key: children.childType },
|
|
48
|
+
onTargetUnregister: 'detach',
|
|
49
|
+
parentPropertyType,
|
|
50
|
+
...children
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
};
|
|
54
|
+
export const removePropertyChildRelation = (parentPropertyType, key, manager = propsManager) => {
|
|
55
|
+
const definition = assertPropertyRelationMutationAllowed(parentPropertyType, 'remove-relation', manager);
|
|
56
|
+
const children = definition.children;
|
|
57
|
+
if (!children || children.key !== key) {
|
|
58
|
+
return relationFailure('RELATION_NOT_FOUND', 'remove-relation', `Property child relation "${parentPropertyType}/${key}" was not found`, {
|
|
59
|
+
source: { kind: 'property', key: parentPropertyType },
|
|
60
|
+
relationName: key
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const nextDefinition = { ...definition, children: undefined };
|
|
64
|
+
const Constructor = createPropertyComponentFromConfig(nextDefinition);
|
|
65
|
+
commitPropertyComponentRegistration(parentPropertyType, Constructor, nextDefinition);
|
|
66
|
+
const relation = {
|
|
67
|
+
source: { kind: 'property', key: parentPropertyType },
|
|
68
|
+
name: children.key,
|
|
69
|
+
target: { kind: 'property', key: children.childType },
|
|
70
|
+
onTargetUnregister: 'detach'
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
ok: true,
|
|
74
|
+
operation: 'remove-relation',
|
|
75
|
+
source: relation.source,
|
|
76
|
+
relation
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export const definePropertyChildRelation = (parentPropertyType, relationDefinition, manager = propsManager) => {
|
|
80
|
+
const definition = assertPropertyRelationMutationAllowed(parentPropertyType, 'define-relation', manager);
|
|
81
|
+
if (definition.children) {
|
|
82
|
+
return relationFailure('DUPLICATE_RELATION', 'define-relation', `Property runtime "${parentPropertyType}" already defines child relation "${definition.children.key}"`, {
|
|
83
|
+
source: { kind: 'property', key: parentPropertyType },
|
|
84
|
+
relationName: relationDefinition.key
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
if (!getPropertyComponent(relationDefinition.childType)) {
|
|
88
|
+
return relationFailure('RELATION_TARGET_NOT_FOUND', 'define-relation', `Child property runtime "${relationDefinition.childType}" is not registered`, {
|
|
89
|
+
source: { kind: 'property', key: parentPropertyType },
|
|
90
|
+
relationName: relationDefinition.key,
|
|
91
|
+
target: { kind: 'property', key: relationDefinition.childType }
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
const nextDefinition = {
|
|
95
|
+
...definition,
|
|
96
|
+
children: { ...relationDefinition }
|
|
97
|
+
};
|
|
98
|
+
const Constructor = createPropertyComponentFromConfig(nextDefinition);
|
|
99
|
+
commitPropertyComponentRegistration(parentPropertyType, Constructor, nextDefinition);
|
|
100
|
+
const relation = {
|
|
101
|
+
source: { kind: 'property', key: parentPropertyType },
|
|
102
|
+
name: relationDefinition.key,
|
|
103
|
+
target: { kind: 'property', key: relationDefinition.childType },
|
|
104
|
+
onTargetUnregister: 'detach'
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
ok: true,
|
|
108
|
+
operation: 'define-relation',
|
|
109
|
+
source: relation.source,
|
|
110
|
+
relation
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Define a property component constructor for a property type.
|
|
115
|
+
*/
|
|
116
|
+
export function definePropertyComponent(definition) {
|
|
117
|
+
const hasConstructor = Object.prototype.hasOwnProperty.call(definition, 'constructor') &&
|
|
118
|
+
typeof definition
|
|
119
|
+
.constructor === 'function';
|
|
120
|
+
const constructor = hasConstructor
|
|
121
|
+
? definition.constructor
|
|
122
|
+
: createPropertyComponentFromConfig(definition);
|
|
123
|
+
registerPropertyComponent(definition.type, constructor, definition.options, hasConstructor
|
|
124
|
+
? undefined
|
|
125
|
+
: definition, hasConstructor
|
|
126
|
+
? definition.canonicalChildren
|
|
127
|
+
: undefined);
|
|
128
|
+
return constructor;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Unregister a property component constructor by property type.
|
|
132
|
+
*/
|
|
133
|
+
export function unregisterPropertyComponent(type) {
|
|
134
|
+
if (!propertyComponentRegistry.has(type)) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
propertyComponentRegistry.unregister(type);
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=define-property-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define-property-component.js","sourceRoot":"","sources":["../src/define-property-component.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,EAAE,EACnB,iCAAiC,IAAI,sCAAsC,EAC3E,wCAAwC,EACxC,oBAAoB,EACpB,oCAAoC,EACpC,yBAAyB,EACzB,yBAAyB,EAM1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,wBAAwB,IAAI,eAAe,EAI5C,MAAM,cAAc,CAAA;AA0BrB,MAAM,iCAAiC,GAAG,sCAAsC,CAAA;AAEhF,MAAM,qCAAqC,GAAG,CAC5C,kBAA0B,EAC1B,SAAgD,EAChD,OAAqB,EACc,EAAE;IACrC,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC9C,OAAO,eAAe,CACpB,wBAAwB,EACxB,SAAS,EACT,qBAAqB,kBAAkB,qBAAqB,EAC5D,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,kBAAkB,EAAE,EAAE,CAC1D,CAAA;IACH,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,kBAAkB,CAAC,CAAA;IACpE,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,OAAO,eAAe,CACpB,qBAAqB,EACrB,SAAS,EACT,qBAAqB,kBAAkB,mBAAmB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAClF;YACE,YAAY,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,kBAAkB,EAAE;YAC3D,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,kBAAkB,EAAE;SACtD,CACF,CAAA;IACH,CAAC;IAED,MAAM,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;QACZ,CAAC,CAAE,UAAqD,CAAC,iBAAiB;QAC1E,CAAC,CAAC,SAAS,CACd,CAAA;IAED,OAAO,WAAW,CAAA;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAAY;IACtD,IAAI,CAAC,yBAAyB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,OAAO,KAAK,CAAA;IACd,CAAC;IAED,yBAAyB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IAC1C,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { getSessionManager, getFeatureRegistry } from '@asyra/feature-system';
|
|
2
|
+
import type { CorePackages } from '@asyra/feature-system';
|
|
3
|
+
/**
|
|
4
|
+
* Integrate feature-system with core
|
|
5
|
+
* Connects session manager to input-system events
|
|
6
|
+
*/
|
|
7
|
+
export declare function initFeatureSystem(coreDeps: CorePackages): void;
|
|
8
|
+
/**
|
|
9
|
+
* Get feature registry instance
|
|
10
|
+
*/
|
|
11
|
+
export { getFeatureRegistry };
|
|
12
|
+
/**
|
|
13
|
+
* Get session manager instance
|
|
14
|
+
*/
|
|
15
|
+
export { getSessionManager };
|
|
16
|
+
//# sourceMappingURL=feature-integration.d.ts.map
|