@asyra/core 0.2.4 → 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 -30
- package/.turbo/turbo-test.log +0 -0
- package/CHANGELOG.md +0 -69
- 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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Asa Tsai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1,53 @@
|
|
|
1
1
|
# Core
|
|
2
|
+
|
|
3
|
+
`@asyra/core` coordinates framework lifecycle, persistence, app load hooks,
|
|
4
|
+
package validation, and canonical state apply.
|
|
5
|
+
|
|
6
|
+
## App-owned load migration
|
|
7
|
+
|
|
8
|
+
Register synchronous app migrations with `core.registerLoadHook(...)`. Hooks
|
|
9
|
+
run from a registration snapshot taken at load start on that Core instance; a
|
|
10
|
+
hook registered during execution begins with the next load. The first hook
|
|
11
|
+
receives the unnormalized raw document as `unknown`, so app code narrows version eligibility.
|
|
12
|
+
Every successful hook must return a `VersionedLoadDocument`; package fields stay
|
|
13
|
+
raw until the complete chain reaches package-owner validation.
|
|
14
|
+
|
|
15
|
+
The app owns its connected linear migration chain and domain transforms. A
|
|
16
|
+
copyable app helper can validate the complete batch and install one conditional
|
|
17
|
+
dispatcher that repeatedly follows the current version; when no matching
|
|
18
|
+
version exists, the document passes through unchanged. The helper permits one
|
|
19
|
+
non-empty installation per Core instance, treats empty batches as no-ops, and
|
|
20
|
+
keeps its instance-isolated installation guard app-owned. Core rejects Promise or
|
|
21
|
+
invalid hook results before validation through `LoadHookExecutionError`, and
|
|
22
|
+
contains an eventual rejected Promise behind that single synchronous failure.
|
|
23
|
+
It does not infer app schema history, enforce an app target version, or provide
|
|
24
|
+
a second migration pipeline.
|
|
25
|
+
|
|
26
|
+
After migration, Props Manager, Scene Tree, and System Context each produce a
|
|
27
|
+
validation/fallback result as an owner-issued, instance-bound, one-shot
|
|
28
|
+
artifact. Core obtains all artifacts before updating the version, then returns
|
|
29
|
+
each complete artifact to its package apply facade without rerunning validators.
|
|
30
|
+
Migration or validation failure cannot apply a canonical prefix. Direct and
|
|
31
|
+
provider-backed loads share this exact ordering and only nullish input means no
|
|
32
|
+
document.
|
|
33
|
+
|
|
34
|
+
Load diagnostics run only after successful apply and only when warnings exist.
|
|
35
|
+
Every hook receives detached diagnostics and post-apply load evidence assembled
|
|
36
|
+
from normalized/validated apply inputs and applied managed-system serialization.
|
|
37
|
+
The detached evidence is not a canonical state artifact or state owner. Mutation
|
|
38
|
+
or failure remains observational and cannot change canonical state, load success,
|
|
39
|
+
or later hooks in that emission. Core assembles evidence only when diagnostics
|
|
40
|
+
and an observer exist; assembly failure skips emission and preserves load success.
|
|
41
|
+
|
|
42
|
+
See `docs/examples/app-owned-versioned-load-migration.mjs` for a reusable
|
|
43
|
+
connected-registry example.
|
|
44
|
+
|
|
45
|
+
`core.setPersistence(...)` is a warn-once, load-only compatibility adapter for
|
|
46
|
+
`core.setLoadSource(...)`. It remains available through the `0.2.x` migration
|
|
47
|
+
window and is planned for removal in the next major release.
|
|
48
|
+
|
|
49
|
+
## Release support
|
|
50
|
+
|
|
51
|
+
The `@asyra/core` `0.2.5` ESM artifact supports Node.js 24.x. Use only
|
|
52
|
+
package-root or explicitly exported subpath APIs. See the
|
|
53
|
+
[Framework release support contract](../../docs/ai/framework/RELEASE_SUPPORT.md).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SceneTree } from '@asyra/scene-tree';
|
|
2
|
+
import { Render } from '@asyra/render';
|
|
3
|
+
import type { PropsManager } from '@asyra/props-manager';
|
|
4
|
+
import type { SelectionManager } from '@asyra/selection';
|
|
5
|
+
import type { Factory } from '@asyra/factory';
|
|
6
|
+
import type { CoreAPIs } from '../types/index.js';
|
|
7
|
+
export declare const createAPIs: (sceneTree: SceneTree, render: Render, selection: SelectionManager, props: PropsManager, factory: Factory) => CoreAPIs;
|
|
8
|
+
//# sourceMappingURL=create-apis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-apis.d.ts","sourceRoot":"","sources":["../../src/apis/create-apis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKV,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACL,MAAM,EAIP,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAmB7C,OAAO,KAAK,EAAmB,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAElE,eAAO,MAAM,UAAU,GACrB,WAAW,SAAS,EACpB,QAAQ,MAAM,EACd,WAAW,gBAAgB,EAC3B,OAAO,YAAY,EACnB,SAAS,OAAO,KACf,QA6ZF,CAAA"}
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { componentRegistry } from '@asyra/scene-tree';
|
|
2
|
+
import { createRenderGradientFillStyle, createEvenOddFillStyle, createMeshProjection } from '@asyra/render';
|
|
3
|
+
import { EntityTypes } from '@asyra/utils';
|
|
4
|
+
import { createPropsAPIs } from './props.js';
|
|
5
|
+
import { createRenderAPIs } from './render.js';
|
|
6
|
+
import { createSceneTreeAPIs } from './scene-tree.js';
|
|
7
|
+
import { createElementSelectionAPIs } from './element-selection.js';
|
|
8
|
+
import { createInputSystemAPIs } from './input-system.js';
|
|
9
|
+
import { createFeatureSystemAPIs } from './feature-system.js';
|
|
10
|
+
import { createUIContextAPIs } from './ui-context.js';
|
|
11
|
+
import { createSystemPropertyAPIs } from './system-properties.js';
|
|
12
|
+
import { createElementPropertyAPIs } from './element-properties.js';
|
|
13
|
+
import { getAllElementsWorldBounds } from './scene-bounds.js';
|
|
14
|
+
export const createAPIs = (sceneTree, render, selection, props, factory) => {
|
|
15
|
+
const requireContainerParent = (parentId) => {
|
|
16
|
+
const parent = sceneTree.getElementById(parentId);
|
|
17
|
+
const parentType = parent?.get('type');
|
|
18
|
+
const parentIsContainer = parentType === EntityTypes.WORKSPACE ||
|
|
19
|
+
parentType === EntityTypes.FRAME ||
|
|
20
|
+
parentType === EntityTypes.GROUP ||
|
|
21
|
+
(typeof parentType === 'string' &&
|
|
22
|
+
componentRegistry.get(parentType)?.isContainer === true);
|
|
23
|
+
if (!parent || !parentIsContainer) {
|
|
24
|
+
throw new Error(`[Core] Cannot create element batch: parent "${parentId}" is unavailable`);
|
|
25
|
+
}
|
|
26
|
+
return parent;
|
|
27
|
+
};
|
|
28
|
+
const freezeOrderedElementIds = (elementIds) => Object.freeze([...elementIds]);
|
|
29
|
+
const requireOrderedIds = (owner, actual, expected) => {
|
|
30
|
+
if (actual.length !== expected.length ||
|
|
31
|
+
actual.some((elementId, index) => elementId !== expected[index])) {
|
|
32
|
+
throw new Error(`[Core] ${owner} returned canonical ids that do not match the requested order`);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const prepareOrphanPropertyMutation = (preparedSceneRemoval, options) => {
|
|
36
|
+
if (preparedSceneRemoval.orphanRootPropertyIds.length === 0) {
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
return props.preparePropertyMutationBatch({
|
|
40
|
+
operations: [
|
|
41
|
+
{
|
|
42
|
+
kind: 'remove-exact-orphan-property-graphs',
|
|
43
|
+
orphanRootPropertyIds: preparedSceneRemoval.orphanRootPropertyIds,
|
|
44
|
+
retainedRootPropertyIds: preparedSceneRemoval.retainedRootPropertyIds
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
options
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
const applyFullRemoval = (preparedSceneRemoval, preparedProperties, options) => {
|
|
51
|
+
const sceneResult = sceneTree.applyPreparedElementMutation(preparedSceneRemoval, options);
|
|
52
|
+
if (preparedProperties) {
|
|
53
|
+
props.applyPreparedPropertyMutationBatch(preparedProperties);
|
|
54
|
+
}
|
|
55
|
+
return freezeOrderedElementIds(sceneResult.orderedElementIds);
|
|
56
|
+
};
|
|
57
|
+
const applyPreparedSubtreeRemoval = (preparedSceneRemoval, options) => {
|
|
58
|
+
const preparedProperties = prepareOrphanPropertyMutation(preparedSceneRemoval, options);
|
|
59
|
+
applyFullRemoval(preparedSceneRemoval, preparedProperties, options);
|
|
60
|
+
const evidence = preparedSceneRemoval.evidence[0];
|
|
61
|
+
if (!evidence) {
|
|
62
|
+
throw new Error('[Core] Subtree removal requires one Scene-owned subtree result');
|
|
63
|
+
}
|
|
64
|
+
return Object.freeze({
|
|
65
|
+
elementId: evidence.elementId,
|
|
66
|
+
removed: evidence.removed,
|
|
67
|
+
rootParentChildrenAfter: evidence.rootParentChildrenAfter
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const sceneTreeRequests = {
|
|
71
|
+
sceneTreeSaveData: () => sceneTree.save(),
|
|
72
|
+
getCurrentWorkspaceId: () => sceneTree.workspace,
|
|
73
|
+
getElementComputedData: (elementId) => sceneTree.getElementById(elementId)?.getAllComputedData(),
|
|
74
|
+
moveElements: (request, options) => sceneTree.moveElements(request, options),
|
|
75
|
+
applyHierarchyMoves: (moves, options) => sceneTree.applyHierarchyMoves(moves, options),
|
|
76
|
+
applyElementDataChanges: (changes, options) => {
|
|
77
|
+
const preparedSceneMutation = sceneTree.prepareCanonicalElementDataMutation(changes);
|
|
78
|
+
return freezeOrderedElementIds(sceneTree.applyPreparedElementMutation(preparedSceneMutation, options)
|
|
79
|
+
.orderedElementIds);
|
|
80
|
+
},
|
|
81
|
+
removeSubtree: (elementId, options) => applyPreparedSubtreeRemoval(sceneTree.prepareSubtreeRemoval(elementId), options),
|
|
82
|
+
removeSubtreeFromCanonicalData: (change, options) => applyPreparedSubtreeRemoval(sceneTree.prepareCanonicalSubtreeRemoval(change), options),
|
|
83
|
+
removeElementsFromCanonicalData: (removals, options) => {
|
|
84
|
+
if (removals.length === 0) {
|
|
85
|
+
return Object.freeze([]);
|
|
86
|
+
}
|
|
87
|
+
const preparedSceneRemoval = sceneTree.prepareCanonicalElementRemoval(removals);
|
|
88
|
+
const preparedProperties = prepareOrphanPropertyMutation(preparedSceneRemoval, options);
|
|
89
|
+
return applyFullRemoval(preparedSceneRemoval, preparedProperties, options);
|
|
90
|
+
},
|
|
91
|
+
preflightRestoreSubtree: (snapshot, options) => options === undefined
|
|
92
|
+
? sceneTree.preflightRestoreSubtree(snapshot)
|
|
93
|
+
: sceneTree.preflightRestoreSubtree(snapshot, options),
|
|
94
|
+
applyRestoreSubtree: (preparedRestore, options) => sceneTree.applyRestoreSubtree(preparedRestore, options),
|
|
95
|
+
createElementsInParent: (data, parentId, index, options) => {
|
|
96
|
+
const parent = requireContainerParent(parentId);
|
|
97
|
+
return freezeOrderedElementIds(sceneTree.addNewElements(data, parent, index ?? -1, options));
|
|
98
|
+
},
|
|
99
|
+
createElementsInParentFromCanonicalData: (elements, properties, parentId, index, options) => {
|
|
100
|
+
const parent = requireContainerParent(parentId);
|
|
101
|
+
const parentChildren = parent.get('children');
|
|
102
|
+
const insertionIndex = index === undefined ? parentChildren.length : index;
|
|
103
|
+
const preparedSceneInsertion = sceneTree.prepareCanonicalElementInsertion({
|
|
104
|
+
entries: elements.map((data, offset) => ({
|
|
105
|
+
data,
|
|
106
|
+
parentId,
|
|
107
|
+
index: insertionIndex + offset
|
|
108
|
+
}))
|
|
109
|
+
});
|
|
110
|
+
const preparedProperties = preparedSceneInsertion.ownerRelations.length > 0 ||
|
|
111
|
+
properties.length > 0
|
|
112
|
+
? props.preparePropertyMutationBatch({
|
|
113
|
+
operations: [
|
|
114
|
+
{
|
|
115
|
+
kind: 'create-exact-property-graph',
|
|
116
|
+
ownerRelations: preparedSceneInsertion.ownerRelations,
|
|
117
|
+
components: properties
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
options
|
|
121
|
+
})
|
|
122
|
+
: undefined;
|
|
123
|
+
if (preparedProperties) {
|
|
124
|
+
props.applyPreparedPropertyMutationBatch(preparedProperties);
|
|
125
|
+
}
|
|
126
|
+
const sceneResult = sceneTree.applyPreparedElementMutation(preparedSceneInsertion, options);
|
|
127
|
+
return freezeOrderedElementIds(sceneResult.orderedElementIds);
|
|
128
|
+
},
|
|
129
|
+
updateLocalComputedData: (updates) => sceneTree.updateLocalComputedData(updates),
|
|
130
|
+
patchLocalComputedData: (updates) => sceneTree.patchLocalComputedData(updates),
|
|
131
|
+
projectLocalComputedDataFromPropertyIds: (propertyIds) => sceneTree.projectLocalComputedDataFromPropertyIds(propertyIds),
|
|
132
|
+
isContainerType: (type) => {
|
|
133
|
+
if (type === EntityTypes.WORKSPACE ||
|
|
134
|
+
type === EntityTypes.FRAME ||
|
|
135
|
+
type === EntityTypes.GROUP) {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
return componentRegistry.get(type)?.isContainer ?? false;
|
|
139
|
+
},
|
|
140
|
+
getAllElementsBounds: () => getAllElementsWorldBounds(sceneTree)
|
|
141
|
+
};
|
|
142
|
+
const renderRequests = {
|
|
143
|
+
initRender: (width, height, color) => render.init(width, height, color),
|
|
144
|
+
getViewportPosition: () => render.getViewportPosition(),
|
|
145
|
+
getViewportScale: () => render.getViewportScale(),
|
|
146
|
+
registerRenderLayer: (registration, options) => render.registerLayer(registration, options),
|
|
147
|
+
unregisterRenderLayer: (name) => render.unregisterLayer(name),
|
|
148
|
+
createRenderGradientFillStyle,
|
|
149
|
+
createEvenOddFillStyle,
|
|
150
|
+
createMeshProjection,
|
|
151
|
+
registerRenderInteractionTargets: (targets, options) => render.registerInteractionTargets(targets, options),
|
|
152
|
+
updateRenderInteractionTarget: (targetId, patch) => render.updateInteractionTarget(targetId, patch),
|
|
153
|
+
unregisterRenderInteractionTarget: (targetId) => render.unregisterInteractionTarget(targetId),
|
|
154
|
+
clearRenderInteractionTargets: () => render.clearInteractionTargets(),
|
|
155
|
+
registerRenderInteractionHandler: (targetId, registration) => render.registerInteractionHandler(targetId, registration),
|
|
156
|
+
unregisterRenderInteractionHandler: (targetId, eventType) => render.unregisterInteractionHandler(targetId, eventType)
|
|
157
|
+
};
|
|
158
|
+
const propsRequests = {
|
|
159
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
160
|
+
propsLoadData: (data) => props.load(data),
|
|
161
|
+
propsSaveData: () => props.save(),
|
|
162
|
+
preflightRestoreProperties: (snapshot, ownerRelations) => props.preflightRestoreProperties(snapshot, ownerRelations),
|
|
163
|
+
applyRestoreProperties: (preparedRestore, options) => props.applyRestoreProperties(preparedRestore, options),
|
|
164
|
+
preparePropertyMutationBatch: (request) => props.preparePropertyMutationBatch(request),
|
|
165
|
+
applyPreparedPropertyMutationBatch: (preparedBatch) => props.applyPreparedPropertyMutationBatch(preparedBatch)
|
|
166
|
+
};
|
|
167
|
+
const propsAPIs = createPropsAPIs(propsRequests);
|
|
168
|
+
const sceneTreeAPIs = createSceneTreeAPIs(sceneTreeRequests);
|
|
169
|
+
const applyCanonicalChanges = (changes) => {
|
|
170
|
+
for (const change of changes) {
|
|
171
|
+
switch (change.kind) {
|
|
172
|
+
case 'property-components': {
|
|
173
|
+
const records = change.records ?? [];
|
|
174
|
+
if (records.length === 0) {
|
|
175
|
+
const propertyIds = propsAPIs.updatePropertyComponents(change.updates);
|
|
176
|
+
requireOrderedIds('property-component owner', propertyIds, change.updates.map(({ propertyId }) => propertyId));
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
const orderedPropertyIds = [];
|
|
180
|
+
const seenPropertyIds = new Set();
|
|
181
|
+
const operations = [];
|
|
182
|
+
records.forEach(({ propertyId, key, set, remove }) => {
|
|
183
|
+
if (!seenPropertyIds.has(propertyId)) {
|
|
184
|
+
seenPropertyIds.add(propertyId);
|
|
185
|
+
orderedPropertyIds.push(propertyId);
|
|
186
|
+
}
|
|
187
|
+
operations.push({
|
|
188
|
+
kind: 'records',
|
|
189
|
+
propertyId,
|
|
190
|
+
key,
|
|
191
|
+
...(set === undefined ? {} : { set }),
|
|
192
|
+
...(remove === undefined ? {} : { remove })
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
change.updates.forEach(({ propertyId, values }) => {
|
|
196
|
+
if (!seenPropertyIds.has(propertyId)) {
|
|
197
|
+
seenPropertyIds.add(propertyId);
|
|
198
|
+
orderedPropertyIds.push(propertyId);
|
|
199
|
+
}
|
|
200
|
+
operations.push({
|
|
201
|
+
kind: 'values',
|
|
202
|
+
propertyId,
|
|
203
|
+
values
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
const preparedBatch = props.preparePropertyMutationBatch({
|
|
207
|
+
operations
|
|
208
|
+
});
|
|
209
|
+
const result = props.applyPreparedPropertyMutationBatch(preparedBatch);
|
|
210
|
+
requireOrderedIds('property-component owner', result.orderedPropertyIds, orderedPropertyIds);
|
|
211
|
+
break;
|
|
212
|
+
}
|
|
213
|
+
case 'element-data': {
|
|
214
|
+
const elementIds = sceneTreeAPIs.applyElementDataChanges(change.changes);
|
|
215
|
+
requireOrderedIds('element-data owner', elementIds, change.changes.map(({ id: elementId }) => elementId));
|
|
216
|
+
break;
|
|
217
|
+
}
|
|
218
|
+
case 'hierarchy-moves': {
|
|
219
|
+
if (change.moves.length > 0 &&
|
|
220
|
+
!sceneTreeAPIs.applyHierarchyMoves(change.moves)) {
|
|
221
|
+
throw new Error('[Core] Hierarchy owner rejected a non-empty canonical move batch');
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
case 'subtree-removal': {
|
|
226
|
+
const result = sceneTreeAPIs.removeSubtreeFromCanonicalData(change.change);
|
|
227
|
+
if (result.elementId !== change.change.elementId) {
|
|
228
|
+
throw new Error('[Core] Subtree owner returned a different canonical root id');
|
|
229
|
+
}
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
case 'subtree-restore': {
|
|
233
|
+
const preparedSceneRestore = sceneTreeAPIs.preflightRestoreSubtree(change.sceneSnapshot, { propertyState: 'pending-restore' });
|
|
234
|
+
const preparedPropsRestore = propsAPIs.preflightRestoreProperties(change.propsSnapshot, preparedSceneRestore.propertyOwnerRelations);
|
|
235
|
+
propsAPIs.applyRestoreProperties(preparedPropsRestore);
|
|
236
|
+
const result = sceneTreeAPIs.applyRestoreSubtree(preparedSceneRestore);
|
|
237
|
+
if (result.elementId !== change.sceneSnapshot.elementId) {
|
|
238
|
+
throw new Error('[Core] Restore owner returned a different canonical root id');
|
|
239
|
+
}
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
case 'element-creation': {
|
|
243
|
+
const elementIds = sceneTreeAPIs.createElementsInParentFromCanonicalData(change.elements, change.properties, change.parentId, change.index);
|
|
244
|
+
requireOrderedIds('element-creation owner', elementIds, change.elements.map(({ id: elementId }) => elementId));
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
case 'element-removal': {
|
|
248
|
+
const elementIds = sceneTreeAPIs.removeElementsFromCanonicalData(change.removals);
|
|
249
|
+
requireOrderedIds('element-removal owner', elementIds, change.removals.map(({ data }) => data.id));
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
return {
|
|
256
|
+
...createInputSystemAPIs(),
|
|
257
|
+
...createFeatureSystemAPIs(),
|
|
258
|
+
...propsAPIs,
|
|
259
|
+
...createRenderAPIs(renderRequests),
|
|
260
|
+
...sceneTreeAPIs,
|
|
261
|
+
...createElementPropertyAPIs({
|
|
262
|
+
resolveElementPropertyTargets: (requests) => sceneTree.resolveElementPropertyTargets(requests),
|
|
263
|
+
preparePropertyMutationBatch: (request) => props.preparePropertyMutationBatch(request),
|
|
264
|
+
applyPreparedPropertyMutationBatch: (preparedBatch) => props.applyPreparedPropertyMutationBatch(preparedBatch)
|
|
265
|
+
}),
|
|
266
|
+
...createElementSelectionAPIs(selection, factory),
|
|
267
|
+
...createUIContextAPIs(),
|
|
268
|
+
...createSystemPropertyAPIs(),
|
|
269
|
+
applyCanonicalChanges
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
//# sourceMappingURL=create-apis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-apis.js","sourceRoot":"","sources":["../../src/apis/create-apis.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAIlB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAEL,6BAA6B,EAC7B,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,eAAe,CAAA;AAQtB,OAAO,EAKL,WAAW,EACZ,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,eAAe,EAAsB,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAuB,MA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AAC,SAAS,CAAC,CACtD,CAAA;oBACD,MAAK;gBACP,CAAC;gBACD,KAAK,iBAAiB,CAAC,CAAC,CAAC;oBACvB,MAAM,UAAU,GAAG,aAAa,CAAC,+BAA+B,CAC9D,MAAM,CAAC,QAAQ,CAChB,CAAA;oBACD,iBAAiB,CACf,uBAAuB,EACvB,UAAU,EACV,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAC3C,CAAA;oBACD,MAAK;gBACP,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC,CAAA;IAED,OAAO;QACL,GAAG,qBAAqB,EAAE;QAC1B,GAAG,uBAAuB,EAAE;QAC5B,GAAG,SAAS;QACZ,GAAG,gBAAgB,CAAC,cAAc,CAAC;QACnC,GAAG,aAAa;QAChB,GAAG,yBAAyB,CAAC;YAC3B,6BAA6B,EAAE,CAAC,QAAQ,EAAE,EAAE,CAC1C,SAAS,CAAC,6BAA6B,CAAC,QAAQ,CAAC;YACnD,4BAA4B,EAAE,CAAC,OAAO,EAAE,EAAE,CACxC,KAAK,CAAC,4BAA4B,CAAC,OAAO,CAAC;YAC7C,kCAAkC,EAAE,CAAC,aAAa,EAAE,EAAE,CACpD,KAAK,CAAC,kCAAkC,CAAC,aAAa,CAAC;SAC1D,CAAC;QACF,GAAG,0BAA0B,CAAC,SAAS,EAAE,OAAO,CAAC;QACjD,GAAG,mBAAmB,EAAE;QACxB,GAAG,wBAAwB,EAAE;QAC7B,qBAAqB;KACtB,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PropertyMutationBatchRequest, PreparedPropertyMutationBatch, PropertyMutationBatchResult } from '@asyra/props-manager';
|
|
2
|
+
import type { ResolvedElementPropertyTargets, ElementPropertyTargetRequest } from '@asyra/scene-tree';
|
|
3
|
+
import type { ElementPropertyAPIs } from '../types/element-properties.js';
|
|
4
|
+
export interface ElementPropertyRequests {
|
|
5
|
+
resolveElementPropertyTargets: (requests: readonly ElementPropertyTargetRequest[]) => ResolvedElementPropertyTargets;
|
|
6
|
+
preparePropertyMutationBatch: (request: PropertyMutationBatchRequest) => PreparedPropertyMutationBatch;
|
|
7
|
+
applyPreparedPropertyMutationBatch: (preparedBatch: PreparedPropertyMutationBatch) => PropertyMutationBatchResult;
|
|
8
|
+
}
|
|
9
|
+
export declare const createElementPropertyAPIs: (requests: ElementPropertyRequests) => ElementPropertyAPIs;
|
|
10
|
+
//# sourceMappingURL=element-properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-properties.d.ts","sourceRoot":"","sources":["../../src/apis/element-properties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,4BAA4B,EAC5B,6BAA6B,EAC7B,2BAA2B,EAC5B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,8BAA8B,EAC9B,4BAA4B,EAC7B,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,gCAAgC,CAAA;AAEvC,MAAM,WAAW,uBAAuB;IACtC,6BAA6B,EAAE,CAC7B,QAAQ,EAAE,SAAS,4BAA4B,EAAE,KAC9C,8BAA8B,CAAA;IACnC,4BAA4B,EAAE,CAC5B,OAAO,EAAE,4BAA4B,KAClC,6BAA6B,CAAA;IAClC,kCAAkC,EAAE,CAClC,aAAa,EAAE,6BAA6B,KACzC,2BAA2B,CAAA;CACjC;AAMD,eAAO,MAAM,yBAAyB,GACpC,UAAU,uBAAuB,KAChC,mBA+CF,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const freezeOrderedElementIds = (resolvedTargets) => Object.freeze([...resolvedTargets.orderedElementIds]);
|
|
2
|
+
export const createElementPropertyAPIs = (requests) => {
|
|
3
|
+
const applyResolvedTargets = (targetRequests, options) => {
|
|
4
|
+
if (targetRequests.length === 0) {
|
|
5
|
+
return Object.freeze([]);
|
|
6
|
+
}
|
|
7
|
+
const resolvedTargets = requests.resolveElementPropertyTargets(targetRequests);
|
|
8
|
+
const preparedProperties = requests.preparePropertyMutationBatch({
|
|
9
|
+
operations: resolvedTargets.mutations,
|
|
10
|
+
options
|
|
11
|
+
});
|
|
12
|
+
requests.applyPreparedPropertyMutationBatch(preparedProperties);
|
|
13
|
+
return freezeOrderedElementIds(resolvedTargets);
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
updateElementProperties(updates, options) {
|
|
17
|
+
return applyResolvedTargets(updates.map(({ elementId, values }) => ({
|
|
18
|
+
kind: 'values',
|
|
19
|
+
elementId,
|
|
20
|
+
values
|
|
21
|
+
})), options);
|
|
22
|
+
},
|
|
23
|
+
patchElementProperties(patches, options) {
|
|
24
|
+
return applyResolvedTargets(patches.map(({ elementId, values, records }) => ({
|
|
25
|
+
kind: 'records',
|
|
26
|
+
elementId,
|
|
27
|
+
...(values === undefined ? {} : { values }),
|
|
28
|
+
records
|
|
29
|
+
})), options);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=element-properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-properties.js","sourceRoot":"","sources":["../../src/apis/element-properties.ts"],"names":[],"mappings":"AA4BA,MAAM,uBAAuB,GAAG,CAC9B,eAA+C,EAC5B,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,eAAe,CAAC,iBAAiB,CAAC,CAAC,CAAA;AAE7E,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,QAAiC,EACZ,EAAE;IACvB,MAAM,oBAAoB,GAAG,CAC3B,cAAuD,EACvD,OAAuB,EACJ,EAAE;QACrB,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAChC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAC1B,CAAC;QACD,MAAM,eAAe,GACnB,QAAQ,CAAC,6BAA6B,CAAC,cAAc,CAAC,CAAA;QACxD,MAAM,kBAAkB,GAAG,QAAQ,CAAC,4BAA4B,CAAC;YAC/D,UAAU,EAAE,eAAe,CAAC,SAAS;YACrC,OAAO;SACR,CAAC,CAAA;QACF,QAAQ,CAAC,kCAAkC,CAAC,kBAAkB,CAAC,CAAA;QAC/D,OAAO,uBAAuB,CAAC,eAAe,CAAC,CAAA;IACjD,CAAC,CAAA;IAED,OAAO;QACL,uBAAuB,CACrB,OAA+C,EAC/C,OAAuB;YAEvB,OAAO,oBAAoB,CACzB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;gBACtC,IAAI,EAAE,QAAQ;gBACd,SAAS;gBACT,MAAM;aACP,CAAC,CAAC,EACH,OAAO,CACR,CAAA;QACH,CAAC;QACD,sBAAsB,CACpB,OAA8C,EAC9C,OAAuB;YAEvB,OAAO,oBAAoB,CACzB,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC/C,IAAI,EAAE,SAAS;gBACf,SAAS;gBACT,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;gBAC3C,OAAO;aACR,CAAC,CAAC,EACH,OAAO,CACR,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { Factory } from '@asyra/factory';
|
|
2
|
+
import type { SelectionManager } from '@asyra/selection';
|
|
3
|
+
import { ElementSelectionActionAPIs } from '../types/index.js';
|
|
4
|
+
export declare const createElementSelectionAPIs: (selection: Pick<SelectionManager, "get" | "getChannelByAction">, factory?: Factory) => ElementSelectionActionAPIs;
|
|
3
5
|
//# sourceMappingURL=element-selection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-selection.d.ts","sourceRoot":"","sources":["../../src/apis/element-selection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"element-selection.d.ts","sourceRoot":"","sources":["../../src/apis/element-selection.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAM7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAsK9D,eAAO,MAAM,0BAA0B,GACrC,WAAW,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,oBAAoB,CAAC,EAC/D,UAAU,OAAO,KAChB,0BAoDF,CAAA"}
|
|
@@ -1,11 +1,160 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { acknowledgeTransactionReplayApplied, EventTypes, runTransaction, runWithTransactionOwner, updateTransaction } from '@asyra/reactive-events';
|
|
2
|
+
import { SharedDataChannelNames } from '@asyra/utils';
|
|
3
|
+
const toSharedSelectionOptions = (options) => ({
|
|
4
|
+
...(options ?? {}),
|
|
5
|
+
shared: options?.shared ?? SharedDataChannelNames.SELECTION
|
|
6
|
+
});
|
|
7
|
+
// Wrapper method names used to resolve channels from registered selection metadata.
|
|
8
|
+
// These are local lookup keys for core wrapper APIs (not a global registry contract).
|
|
9
|
+
const WrapperSelectionActionNames = {
|
|
10
|
+
ELEMENT: 'selectElements',
|
|
11
|
+
VECTOR_POINT: 'selectVectorPoints',
|
|
12
|
+
VECTOR_SEGMENT: 'selectVectorSegments'
|
|
13
|
+
};
|
|
14
|
+
const BuiltInSelectionEventNames = new Set([
|
|
15
|
+
EventTypes.SELECT_ELEMENTS,
|
|
16
|
+
EventTypes.SELECT_VECTOR_POINTS,
|
|
17
|
+
EventTypes.SELECT_VECTOR_SEGMENTS
|
|
18
|
+
]);
|
|
19
|
+
// Publishes one selection mutation as a transaction-bounded shared update.
|
|
20
|
+
const publishSelectionChange = (selectionState, change, options, factory) => {
|
|
21
|
+
const mutate = () => runTransaction(() => {
|
|
22
|
+
updateTransaction({
|
|
23
|
+
type: EventTypes.UPDATE_TRANSACTION,
|
|
24
|
+
eventName: change.eventName,
|
|
25
|
+
payload: change,
|
|
26
|
+
options: toSharedSelectionOptions(options)
|
|
27
|
+
});
|
|
28
|
+
selectionState.select(change.after, options);
|
|
29
|
+
selectionState.cleanChanges();
|
|
30
|
+
});
|
|
31
|
+
if (factory) {
|
|
32
|
+
return runWithTransactionOwner(factory.getTransactionOwner(), mutate);
|
|
33
|
+
}
|
|
34
|
+
return mutate();
|
|
35
|
+
};
|
|
36
|
+
const applySelectionReplay = (selection, apis, event, mode) => {
|
|
37
|
+
const change = event.payload;
|
|
38
|
+
const selectionState = selection.get(change.selectionType);
|
|
39
|
+
if (!selectionState) {
|
|
40
|
+
throw new Error(`Selection replay channel is not registered: ${change.selectionType}`);
|
|
41
|
+
}
|
|
42
|
+
const before = [...selectionState.getSelectedIds()];
|
|
43
|
+
const didSelectionChange = () => {
|
|
44
|
+
const after = selectionState.getSelectedIds();
|
|
45
|
+
return before.length !== after.size || before.some((id) => !after.has(id));
|
|
46
|
+
};
|
|
47
|
+
try {
|
|
48
|
+
if (mode === 'rollback') {
|
|
49
|
+
selectionState.select(change.after, change.options);
|
|
50
|
+
if (didSelectionChange()) {
|
|
51
|
+
acknowledgeTransactionReplayApplied();
|
|
52
|
+
}
|
|
53
|
+
selectionState.cleanChanges();
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
apis.selectByChannel(change.selectionType, change.after, change.options);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (failure) {
|
|
60
|
+
if (didSelectionChange()) {
|
|
61
|
+
acknowledgeTransactionReplayApplied();
|
|
62
|
+
}
|
|
63
|
+
throw failure;
|
|
64
|
+
}
|
|
65
|
+
const applied = didSelectionChange();
|
|
66
|
+
if (applied) {
|
|
67
|
+
acknowledgeTransactionReplayApplied();
|
|
68
|
+
}
|
|
69
|
+
return applied;
|
|
70
|
+
};
|
|
71
|
+
const invertSelectionEvent = (event) => {
|
|
72
|
+
const change = event.payload;
|
|
73
|
+
return {
|
|
74
|
+
...event,
|
|
75
|
+
payload: {
|
|
76
|
+
...change,
|
|
77
|
+
before: [...change.after],
|
|
78
|
+
after: [...change.before]
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const createSelectionReplayRegistrar = (selection, factory, apis) => {
|
|
83
|
+
const registeredEventNames = new Set();
|
|
84
|
+
return (eventName) => {
|
|
85
|
+
if (registeredEventNames.has(eventName)) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (!BuiltInSelectionEventNames.has(eventName)) {
|
|
89
|
+
factory.registerTransactionInverter(eventName, invertSelectionEvent);
|
|
90
|
+
}
|
|
91
|
+
factory.registerTransactionReplayHandler(eventName, (event, mode) => {
|
|
92
|
+
return applySelectionReplay(selection, apis, event, mode);
|
|
93
|
+
});
|
|
94
|
+
registeredEventNames.add(eventName);
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
// Converts current runtime state + target ids into a normalized transaction payload.
|
|
98
|
+
const buildSelectionChange = (selectionState, after, options) => {
|
|
99
|
+
const before = Array.from(selectionState.getSelectedIds());
|
|
100
|
+
const beforeSet = new Set(before);
|
|
101
|
+
if (before.length === after.length &&
|
|
102
|
+
after.every((selectionId) => beforeSet.has(selectionId))) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const action = selectionState.getSelectAction();
|
|
3
106
|
return {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
107
|
+
selectionType: selectionState.getSelectionType(),
|
|
108
|
+
action,
|
|
109
|
+
eventName: selectionState.getEventName(),
|
|
110
|
+
before,
|
|
111
|
+
after,
|
|
112
|
+
options
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
// Strictly resolves a selection channel by action name.
|
|
116
|
+
// We fail fast instead of using fallback channels so selection flow stays registration-driven.
|
|
117
|
+
const getRequiredChannelByAction = (selection, action) => {
|
|
118
|
+
const channel = selection.getChannelByAction(action);
|
|
119
|
+
if (!channel) {
|
|
120
|
+
throw new Error(`[Core] Selection channel is not registered for action "${action}". Register selection definitions before invoking selection APIs.`);
|
|
121
|
+
}
|
|
122
|
+
return channel;
|
|
123
|
+
};
|
|
124
|
+
export const createElementSelectionAPIs = (selection, factory) => {
|
|
125
|
+
let ensureSelectionReplayContract = () => undefined;
|
|
126
|
+
const apis = {
|
|
127
|
+
// Low-level API: caller provides the concrete selection channel directly.
|
|
128
|
+
selectByChannel(channel, ids, options) {
|
|
129
|
+
const selectionState = selection.get(channel);
|
|
130
|
+
if (!selectionState) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const change = buildSelectionChange(selectionState, ids, options);
|
|
134
|
+
if (!change) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
ensureSelectionReplayContract(change.eventName);
|
|
138
|
+
publishSelectionChange(selectionState, change, options, factory);
|
|
139
|
+
},
|
|
140
|
+
// Convenience wrappers: resolve channel from registration metadata, then delegate.
|
|
141
|
+
selectElements(elementIds, options) {
|
|
142
|
+
const channel = getRequiredChannelByAction(selection, WrapperSelectionActionNames.ELEMENT);
|
|
143
|
+
this.selectByChannel(channel, elementIds, options);
|
|
144
|
+
},
|
|
145
|
+
selectVectorPoints(pointIds, options) {
|
|
146
|
+
const channel = getRequiredChannelByAction(selection, WrapperSelectionActionNames.VECTOR_POINT);
|
|
147
|
+
this.selectByChannel(channel, pointIds, options);
|
|
148
|
+
},
|
|
149
|
+
selectVectorSegments(segmentIds, options) {
|
|
150
|
+
const channel = getRequiredChannelByAction(selection, WrapperSelectionActionNames.VECTOR_SEGMENT);
|
|
151
|
+
this.selectByChannel(channel, segmentIds, options);
|
|
8
152
|
}
|
|
9
153
|
};
|
|
154
|
+
if (factory) {
|
|
155
|
+
ensureSelectionReplayContract = createSelectionReplayRegistrar(selection, factory, apis);
|
|
156
|
+
BuiltInSelectionEventNames.forEach(ensureSelectionReplayContract);
|
|
157
|
+
}
|
|
158
|
+
return apis;
|
|
10
159
|
};
|
|
11
160
|
//# sourceMappingURL=element-selection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element-selection.js","sourceRoot":"","sources":["../../src/apis/element-selection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,
|
|
1
|
+
{"version":3,"file":"element-selection.js","sourceRoot":"","sources":["../../src/apis/element-selection.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,UAAU,EACV,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EAGlB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EAEL,sBAAsB,EAEvB,MAAM,cAAc,CAAA;AAIrB,MAAM,wBAAwB,GAAG,CAAC,OAAuB,EAAiB,EAAE,CAAC,CAAC;IAC5E,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;IAClB,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,sBAAsB,CAAC,SAAS;CAC5D,CAAC,CAAA;AAEF,oFAAoF;AACpF,sFAAsF;AACtF,MAAM,2BAA2B,GAAG;IAClC,OAAO,EAAE,gBAAgB;IACzB,YAAY,EAAE,oBAAoB;IAClC,cAAc,EAAE,sBAAsB;CAC9B,CAAA;AAIV,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAS;IACjD,UAAU,CAAC,eAAe;IAC1B,UAAU,CAAC,oBAAoB;IAC/B,UAAU,CAAC,sBAAsB;CAClC,CAAC,CAAA;AAEF,2EAA2E;AAC3E,MAAM,sBAAsB,GAAG,CAC7B,cAAgC,EAChC,MAAuB,EACvB,OAAuB,EACvB,OAAiB,EACjB,EAAE;IACF,MAAM,MAAM,GAAG,GAAG,EAAE,CAClB,cAA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