@asyra/core 0.5.6 → 0.6.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.
Files changed (90) hide show
  1. package/CHANGELOG.md +319 -0
  2. package/README.md +11 -5
  3. package/dist/apis/create-apis.d.ts.map +1 -1
  4. package/dist/apis/create-apis.js +103 -48
  5. package/dist/apis/create-apis.js.map +1 -1
  6. package/dist/apis/element-properties.d.ts +5 -8
  7. package/dist/apis/element-properties.d.ts.map +1 -1
  8. package/dist/apis/element-properties.js +19 -6
  9. package/dist/apis/element-properties.js.map +1 -1
  10. package/dist/apis/element-selection.d.ts.map +1 -1
  11. package/dist/apis/element-selection.js.map +1 -1
  12. package/dist/apis/property-intents.d.ts +9 -0
  13. package/dist/apis/property-intents.d.ts.map +1 -0
  14. package/dist/apis/property-intents.js +94 -0
  15. package/dist/apis/property-intents.js.map +1 -0
  16. package/dist/apis/props.d.ts +4 -1
  17. package/dist/apis/props.d.ts.map +1 -1
  18. package/dist/apis/props.js +5 -2
  19. package/dist/apis/props.js.map +1 -1
  20. package/dist/apis/render.d.ts +21 -0
  21. package/dist/apis/render.d.ts.map +1 -1
  22. package/dist/apis/render.js +15 -0
  23. package/dist/apis/render.js.map +1 -1
  24. package/dist/apis/scene-bounds.d.ts.map +1 -1
  25. package/dist/apis/scene-bounds.js +8 -1
  26. package/dist/apis/scene-bounds.js.map +1 -1
  27. package/dist/apis/scene-tree.d.ts +2 -1
  28. package/dist/apis/scene-tree.d.ts.map +1 -1
  29. package/dist/apis/scene-tree.js +23 -11
  30. package/dist/apis/scene-tree.js.map +1 -1
  31. package/dist/canvas-pipeline-debugger/debugger.d.ts.map +1 -1
  32. package/dist/canvas-pipeline-debugger/debugger.js.map +1 -1
  33. package/dist/contracts/index.d.ts +1 -0
  34. package/dist/contracts/index.d.ts.map +1 -1
  35. package/dist/contracts/index.js +1 -0
  36. package/dist/contracts/index.js.map +1 -1
  37. package/dist/core.d.ts +73 -4
  38. package/dist/core.d.ts.map +1 -1
  39. package/dist/core.js +378 -36
  40. package/dist/core.js.map +1 -1
  41. package/dist/data-channel-observer.d.ts +4 -0
  42. package/dist/data-channel-observer.d.ts.map +1 -1
  43. package/dist/data-channel-observer.js +58 -6
  44. package/dist/data-channel-observer.js.map +1 -1
  45. package/dist/define-component.d.ts.map +1 -1
  46. package/dist/define-component.js +2 -1
  47. package/dist/define-component.js.map +1 -1
  48. package/dist/define-property-component.d.ts.map +1 -1
  49. package/dist/define-property-component.js +2 -1
  50. package/dist/define-property-component.js.map +1 -1
  51. package/dist/index.d.ts +12 -5
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +5 -3
  54. package/dist/index.js.map +1 -1
  55. package/dist/runtime-lifetime.d.ts +30 -0
  56. package/dist/runtime-lifetime.d.ts.map +1 -0
  57. package/dist/runtime-lifetime.js +201 -0
  58. package/dist/runtime-lifetime.js.map +1 -0
  59. package/dist/types/canonical-changes.d.ts +10 -9
  60. package/dist/types/canonical-changes.d.ts.map +1 -1
  61. package/dist/types/element-properties.d.ts +5 -3
  62. package/dist/types/element-properties.d.ts.map +1 -1
  63. package/dist/types/history.d.ts +4 -0
  64. package/dist/types/history.d.ts.map +1 -0
  65. package/dist/types/history.js +2 -0
  66. package/dist/types/history.js.map +1 -0
  67. package/dist/types/index.d.ts +3 -1
  68. package/dist/types/index.d.ts.map +1 -1
  69. package/dist/types/index.js.map +1 -1
  70. package/dist/types/load-migration.d.ts.map +1 -1
  71. package/dist/types/load-migration.js.map +1 -1
  72. package/dist/types/property-intents.d.ts +35 -0
  73. package/dist/types/property-intents.d.ts.map +1 -0
  74. package/dist/types/property-intents.js +2 -0
  75. package/dist/types/property-intents.js.map +1 -0
  76. package/dist/types/property-mutation-receipt.d.ts +6 -0
  77. package/dist/types/property-mutation-receipt.d.ts.map +1 -0
  78. package/dist/types/property-mutation-receipt.js +2 -0
  79. package/dist/types/property-mutation-receipt.js.map +1 -0
  80. package/dist/types/props.d.ts +2 -1
  81. package/dist/types/props.d.ts.map +1 -1
  82. package/dist/types/render.d.ts +5 -0
  83. package/dist/types/render.d.ts.map +1 -1
  84. package/dist/types/scene-tree.d.ts +6 -1
  85. package/dist/types/scene-tree.d.ts.map +1 -1
  86. package/dist/types/scene-tree.js +4 -1
  87. package/dist/types/scene-tree.js.map +1 -1
  88. package/dist/types/vector.d.ts.map +1 -1
  89. package/dist/types/vector.js.map +1 -1
  90. package/package.json +17 -17
package/CHANGELOG.md ADDED
@@ -0,0 +1,319 @@
1
+ # @asyra/core
2
+
3
+ ## Pending Identity allocation facade
4
+
5
+ ```update-note
6
+ {
7
+ "change": "identity-allocation-facade",
8
+ "owner": "Core identity allocation",
9
+ "summary": "Delegate batch identity reservation to the existing namespace-aware ID counter without document writes or history.",
10
+ "sources": [
11
+ "packages/core/src/core.ts"
12
+ ],
13
+ "impact": "no-action",
14
+ "guides": [],
15
+ "reason": "New allocateIds facade is documented with ordering, failure and persistence boundaries."
16
+ }
17
+ ```
18
+
19
+ ## Pending computed field selection contract
20
+
21
+ ```update-note
22
+ {
23
+ "change": "computed-field-selection-contract",
24
+ "owner": "Core computed reads",
25
+ "summary": "Expose unchanged computed field selection limits through the pure contracts entry for schema consumers.",
26
+ "sources": [
27
+ "packages/core/src/types/scene-tree.ts",
28
+ "packages/core/src/apis/scene-tree.ts",
29
+ "packages/core/src/contracts/index.ts"
30
+ ],
31
+ "impact": "no-action",
32
+ "guides": [],
33
+ "reason": "The existing 64-field and 128-character limits, snapshot isolation and validation remain unchanged. No persisted format or migration changes."
34
+ }
35
+ ```
36
+
37
+ ## Pending ordinary creation input normalization
38
+
39
+ ```update-note
40
+ {
41
+ "change": "ordinary-creation-input-normalization",
42
+ "owner": "Core creation input normalization",
43
+ "summary": "Remove unused creation input envelopes and the second projection while retaining the existing Core normalization owner, defaults, supplied/generated IDs, input isolation and complete owner results.",
44
+ "sources": [
45
+ "packages/core/src/apis/scene-tree.ts",
46
+ "packages/core/src/__tests__/scene-tree-api.test.ts"
47
+ ],
48
+ "impact": "no-action",
49
+ "guides": [],
50
+ "reason": "Public creation inputs and output, validation, geometry, history and retained-source recovery remain unchanged. No migration, new cache or additional model exchange is required."
51
+ }
52
+ ```
53
+
54
+ ## Pending ordinary creation result handoff
55
+
56
+ ```update-note
57
+ {
58
+ "change": "ordinary-creation-result-handoff",
59
+ "owner": "Core creation results",
60
+ "summary": "Forward the existing Scene Tree frozen ordered creation result through Core and App without redundant ID array copies; verify actual saved-input flows and immutable receipts.",
61
+ "sources": [
62
+ "packages/core/src/apis/create-apis.ts",
63
+ "packages/core/src/apis/scene-tree.ts",
64
+ "packages/core/src/__tests__/scene-tree-api.test.ts"
65
+ ],
66
+ "impact": "no-action",
67
+ "guides": [],
68
+ "reason": "Creation inputs, ordered IDs, frozen isolation, history and retained-source recovery are unchanged. No migration or new model exchange is required."
69
+ }
70
+ ```
71
+
72
+ ## Pending computed snapshot selection
73
+
74
+ ```update-note
75
+ {
76
+ "change": "computed-snapshot-selection",
77
+ "owner": "Core computed reads",
78
+ "summary": "Carry computed field selection to the existing snapshot owner before materialization, avoiding omitted-field copies while retaining detached full reads and mechanical evidence behavior.",
79
+ "sources": [
80
+ "packages/core/src/apis/scene-tree.ts",
81
+ "packages/core/src/apis/create-apis.ts",
82
+ "packages/core/src/__tests__/scene-tree-api.test.ts"
83
+ ],
84
+ "impact": "no-action",
85
+ "guides": [],
86
+ "reason": "Existing Core query inputs and outputs, persistence and transaction behavior are unchanged. No new cache, model exchange or migration is required."
87
+ }
88
+ ```
89
+
90
+ ## Pending metadata child counts
91
+
92
+ ```update-note
93
+ {
94
+ "change": "metadata-child-count",
95
+ "owner": "Core metadata facade",
96
+ "summary": "Read child counts from the canonical Group membership owner without materializing full child snapshots during scalar metadata reads.",
97
+ "sources": [
98
+ "packages/core/src/core.ts",
99
+ "packages/core/src/__tests__/app-runtime-facade.test.ts"
100
+ ],
101
+ "impact": "no-action",
102
+ "guides": [],
103
+ "reason": "Existing public metadata values and membership ownership remain unchanged. No persisted format or consumer migration is required."
104
+ }
105
+ ```
106
+
107
+ ## 0.5.7
108
+
109
+ ### Patch Changes
110
+
111
+ - 22883b1: Support owner-coordinated runtime replacement for applications such as Asyra Sim.
112
+ Quiesce feature work before retiring runtime-owned state, subscriptions, input
113
+ bindings, render resources, and registration graphs. Retain preset installation
114
+ cleanup and prevent callbacks from a retired runtime from affecting its successor.
115
+
116
+ Expose Core document-load preflight and validated renderer resizing through the
117
+ public facade. Applications can validate a replacement document before retiring
118
+ the active runtime, while ordinary document loading retains its existing history
119
+ ownership contract.
120
+
121
+ - Updated dependencies [22883b1]
122
+ - @asyra/factory@0.5.4
123
+ - @asyra/feature-system@0.5.4
124
+ - @asyra/input-system@0.5.5
125
+ - @asyra/props-manager@0.5.4
126
+ - @asyra/render@0.5.7
127
+ - @asyra/scene-tree@0.5.4
128
+ - @asyra/selection@0.5.3
129
+ - @asyra/system-context@0.5.3
130
+ - @asyra/ui-context@0.5.4
131
+ - @asyra/utils@0.5.2
132
+ - @asyra/persistence@0.5.3
133
+ - @asyra/reactive-events@0.5.4
134
+
135
+ ## 0.5.6
136
+
137
+ ### Patch Changes
138
+
139
+ - Updated dependencies
140
+ - @asyra/render@0.5.6
141
+
142
+ ## 0.5.5
143
+
144
+ ### Patch Changes
145
+
146
+ - Republish the affected Framework packages with publishable internal dependency
147
+ ranges instead of monorepo-only `workspace:*` metadata.
148
+ - Updated dependencies
149
+ - @asyra/factory@0.5.3
150
+ - @asyra/feature-system@0.5.3
151
+ - @asyra/input-system@0.5.4
152
+ - @asyra/persistence@0.5.2
153
+ - @asyra/props-manager@0.5.3
154
+ - @asyra/reactive-events@0.5.3
155
+ - @asyra/render@0.5.5
156
+ - @asyra/scene-tree@0.5.3
157
+ - @asyra/selection@0.5.2
158
+ - @asyra/system-context@0.5.2
159
+ - @asyra/ui-context@0.5.3
160
+
161
+ ## 0.5.4
162
+
163
+ ### Patch Changes
164
+
165
+ - Exceptional synchronized patch release for the fixed 19-package Framework set.
166
+ - Updated dependencies
167
+ - @asyra/factory@0.5.2
168
+ - @asyra/feature-system@0.5.2
169
+ - @asyra/input-system@0.5.3
170
+ - @asyra/persistence@0.5.1
171
+ - @asyra/props-manager@0.5.2
172
+ - @asyra/reactive-events@0.5.2
173
+ - @asyra/render@0.5.3
174
+ - @asyra/render-engine@0.5.1
175
+ - @asyra/scene-tree@0.5.2
176
+ - @asyra/selection@0.5.1
177
+ - @asyra/system-context@0.5.1
178
+ - @asyra/ui-context@0.5.2
179
+ - @asyra/utils@0.5.1
180
+
181
+ ## 0.5.3
182
+
183
+ ### Patch Changes
184
+
185
+ - Updated dependencies [c714696]
186
+ - @asyra/input-system@0.5.2
187
+
188
+ ## 0.5.2
189
+
190
+ ### Patch Changes
191
+
192
+ - Updated dependencies [889f7b4]
193
+ - @asyra/factory@0.5.1
194
+ - @asyra/props-manager@0.5.1
195
+ - @asyra/reactive-events@0.5.1
196
+ - @asyra/render@0.5.2
197
+ - @asyra/scene-tree@0.5.1
198
+ - @asyra/feature-system@0.5.1
199
+ - @asyra/input-system@0.5.1
200
+ - @asyra/ui-context@0.5.1
201
+
202
+ ## 0.5.1
203
+
204
+ ### Patch Changes
205
+
206
+ - 6559efc: Route app runtime and collaboration through Core, restore fast authoritative collaboration synchronization, and refresh the standalone Asyra Design template.
207
+
208
+ Initialize document connection state at `none`, publish only actual state changes, and notify every connection transition except the initial `none` to `connected` transition.
209
+
210
+ - Updated dependencies [6559efc]
211
+ - @asyra/render@0.5.1
212
+
213
+ ## 0.5.0
214
+
215
+ ### Minor Changes
216
+
217
+ - Exceptional synchronized minor release for the fixed 19-package Framework set.
218
+
219
+ ### Patch Changes
220
+
221
+ - Updated dependencies
222
+ - @asyra/factory@0.5.0
223
+ - @asyra/feature-system@0.5.0
224
+ - @asyra/input-system@0.5.0
225
+ - @asyra/persistence@0.5.0
226
+ - @asyra/props-manager@0.5.0
227
+ - @asyra/reactive-events@0.5.0
228
+ - @asyra/render@0.5.0
229
+ - @asyra/render-engine@0.5.0
230
+ - @asyra/scene-tree@0.5.0
231
+ - @asyra/selection@0.5.0
232
+ - @asyra/system-context@0.5.0
233
+ - @asyra/ui-context@0.5.0
234
+ - @asyra/utils@0.5.0
235
+
236
+ ## 0.2.5
237
+
238
+ ### Patch Changes
239
+
240
+ - Auto-patch all packages.
241
+ - Updated dependencies
242
+ - @asyra/factory@0.2.5
243
+ - @asyra/input-system@0.2.5
244
+ - @asyra/interaction-core@0.2.5
245
+ - @asyra/props-manager@0.2.5
246
+ - @asyra/reactive-events@0.2.5
247
+ - @asyra/render@0.2.5
248
+ - @asyra/scene-tree@0.2.5
249
+ - @asyra/selection@0.2.5
250
+ - @asyra/system-context@0.2.5
251
+ - @asyra/utils@0.2.5
252
+
253
+ ## 0.2.4
254
+
255
+ ### Patch Changes
256
+
257
+ - Auto-patch all packages.
258
+ - Updated dependencies
259
+ - @asyra/factory@0.2.4
260
+ - @asyra/input-system@0.2.4
261
+ - @asyra/interaction-core@0.2.4
262
+ - @asyra/props-manager@0.2.4
263
+ - @asyra/reactive-events@0.2.4
264
+ - @asyra/render@0.2.4
265
+ - @asyra/scene-tree@0.2.4
266
+ - @asyra/selection@0.2.4
267
+ - @asyra/system-context@0.2.4
268
+ - @asyra/utils@0.2.4
269
+
270
+ ## 0.2.3
271
+
272
+ ### Patch Changes
273
+
274
+ - Auto-patch all packages.
275
+ - Updated dependencies
276
+ - @asyra/factory@0.2.3
277
+ - @asyra/input-system@0.2.3
278
+ - @asyra/interaction-core@0.2.3
279
+ - @asyra/props-manager@0.2.3
280
+ - @asyra/reactive-events@0.2.3
281
+ - @asyra/render@0.2.3
282
+ - @asyra/scene-tree@0.2.3
283
+ - @asyra/selection@0.2.3
284
+ - @asyra/system-context@0.2.3
285
+ - @asyra/utils@0.2.3
286
+
287
+ ## 0.2.2
288
+
289
+ ### Patch Changes
290
+
291
+ - Auto-patch all packages.
292
+ - Updated dependencies
293
+ - @asyra/factory@0.2.2
294
+ - @asyra/input-system@0.2.2
295
+ - @asyra/interaction-core@0.2.2
296
+ - @asyra/props-manager@0.2.2
297
+ - @asyra/reactive-events@0.2.2
298
+ - @asyra/render@0.2.2
299
+ - @asyra/scene-tree@0.2.2
300
+ - @asyra/selection@0.2.2
301
+ - @asyra/system-context@0.2.2
302
+ - @asyra/utils@0.2.2
303
+
304
+ ## 0.2.1
305
+
306
+ ### Patch Changes
307
+
308
+ - Auto-patch all packages.
309
+ - Updated dependencies
310
+ - @asyra/factory@0.2.1
311
+ - @asyra/input-system@0.2.1
312
+ - @asyra/interaction-core@0.2.1
313
+ - @asyra/props-manager@0.2.1
314
+ - @asyra/reactive-events@0.2.1
315
+ - @asyra/render@0.2.1
316
+ - @asyra/scene-tree@0.2.1
317
+ - @asyra/selection@0.2.1
318
+ - @asyra/system-context@0.2.1
319
+ - @asyra/utils@0.2.1
package/README.md CHANGED
@@ -32,6 +32,8 @@ Use only the package root and the explicitly documented public subpaths.
32
32
 
33
33
  Use Core for supported App composition and extensions that cross canonical package owners. Register composition before the first `core.start(...)`.
34
34
 
35
+ Read the <a href="https://github.com/karote00/asyra/blob/main/docs/public/start/custom-composition.md#build-one-complete-data-path" target="_blank" rel="noopener noreferrer">Core App implementation guide</a> before building: it connects transaction publications, incremental persistence, scoped subscriptions, computation reuse and lifecycle. Working Undo alone does not establish complete integration.
36
+
35
37
  ## Lifecycle and composition
36
38
 
37
39
  Startup validates and closes composition, initializes required runtime owners, loads canonical data, and publishes ready only after success. App-owned migrations form one connected migration chain; an unmatched string version passes through to ordinary owner validation. A failure tears down owned work and never reports false readiness. The current no-provider compatibility branch is not a public Headless lifecycle.
@@ -43,8 +45,12 @@ Startup validates and closes composition, initializes required runtime owners, l
43
45
 
44
46
  ## Support and policy
45
47
 
46
- This repository does not accept external issues or contributions. You may use,
47
- inspect, and fork the package under the [MIT License](https://github.com/karote00/asyra/blob/main/LICENSE).
48
- Follow the [security policy](https://github.com/karote00/asyra/blob/main/SECURITY.md) for
49
- security-sensitive reports and the [root policy](https://github.com/karote00/asyra) for the
50
- current support boundary.
48
+ GitHub Discussions is the intended public channel for community conversation and
49
+ general help. Discussions is not enabled for this repository yet, so there is
50
+ currently no public community support destination. GitHub Issues are not a
51
+ general public support channel. External pull requests are not accepted by
52
+ default. Community participation creates no SLA or response deadline.
53
+
54
+ You may use, inspect, and fork the package under the [MIT License](https://github.com/karote00/asyra/blob/main/LICENSE).
55
+ Read the <a href="https://github.com/karote00/asyra/blob/main/SUPPORT.md" target="_blank" rel="noopener noreferrer">support policy</a>.
56
+ For suspected vulnerabilities, follow the <a href="https://github.com/karote00/asyra/blob/main/SECURITY.md" target="_blank" rel="noopener noreferrer">security policy</a> and report privately.
@@ -1 +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,QA4ZF,CAAA"}
1
+ {"version":3,"file":"create-apis.d.ts","sourceRoot":"","sources":["../../src/apis/create-apis.ts"],"names":[],"mappings":"AACA,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,QA4jBF,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { createElementPropertyIntentAPIs } from './property-intents.js';
1
2
  import { componentRegistry } from '@asyra/scene-tree';
2
3
  import { createRenderGradientFillStyle, createEvenOddFillStyle, createMeshProjection } from '@asyra/render';
3
4
  import { EntityTypes } from '@asyra/utils';
@@ -54,6 +55,29 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
54
55
  }
55
56
  return freezeOrderedElementIds(sceneResult.orderedElementIds);
56
57
  };
58
+ const applyCanonicalInsertion = (change, options) => {
59
+ const { entries, properties } = change;
60
+ const preparedSceneInsertion = sceneTree.prepareCanonicalElementInsertion({
61
+ entries
62
+ });
63
+ const preparedProperties = preparedSceneInsertion.ownerRelations.length > 0 || properties.length > 0
64
+ ? props.preparePropertyMutationBatch({
65
+ operations: [
66
+ {
67
+ kind: 'create-exact-property-graph',
68
+ ownerRelations: preparedSceneInsertion.ownerRelations,
69
+ components: properties
70
+ }
71
+ ],
72
+ options
73
+ })
74
+ : undefined;
75
+ if (preparedProperties) {
76
+ props.applyPreparedPropertyMutationBatch(preparedProperties);
77
+ }
78
+ const sceneResult = sceneTree.applyPreparedElementMutation(preparedSceneInsertion, options);
79
+ return freezeOrderedElementIds(sceneResult.orderedElementIds);
80
+ };
57
81
  const applyPreparedSubtreeRemoval = (preparedSceneRemoval, options) => {
58
82
  const preparedProperties = prepareOrphanPropertyMutation(preparedSceneRemoval, options);
59
83
  applyFullRemoval(preparedSceneRemoval, preparedProperties, options);
@@ -70,7 +94,7 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
70
94
  const sceneTreeRequests = {
71
95
  sceneTreeSaveData: () => sceneTree.save(),
72
96
  getCurrentWorkspaceId: () => sceneTree.workspace,
73
- getElementComputedData: (elementId) => sceneTree.getElementById(elementId)?.getAllComputedData(),
97
+ getElementComputedData: (elementId, fields) => sceneTree.getElementById(elementId)?.getAllComputedData(fields),
74
98
  moveElements: (request, options) => sceneTree.moveElements(request, options),
75
99
  applyHierarchyMoves: (moves, options) => sceneTree.applyHierarchyMoves(moves, options),
76
100
  applyElementDataChanges: (changes, options) => {
@@ -78,6 +102,11 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
78
102
  return freezeOrderedElementIds(sceneTree.applyPreparedElementMutation(preparedSceneMutation, options)
79
103
  .orderedElementIds);
80
104
  },
105
+ removeSubtrees: (elementIds, options) => {
106
+ const prepared = sceneTree.prepareSubtreesRemoval(elementIds);
107
+ const properties = prepareOrphanPropertyMutation(prepared, options);
108
+ return applyFullRemoval(prepared, properties, options);
109
+ },
81
110
  removeSubtree: (elementId, options) => applyPreparedSubtreeRemoval(sceneTree.prepareSubtreeRemoval(elementId), options),
82
111
  removeSubtreeFromCanonicalData: (change, options) => applyPreparedSubtreeRemoval(sceneTree.prepareCanonicalSubtreeRemoval(change), options),
83
112
  removeElementsFromCanonicalData: (removals, options) => {
@@ -94,37 +123,21 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
94
123
  applyRestoreSubtree: (preparedRestore, options) => sceneTree.applyRestoreSubtree(preparedRestore, options),
95
124
  createElementsInParent: (data, parentId, index, options) => {
96
125
  const parent = requireContainerParent(parentId);
97
- return freezeOrderedElementIds(sceneTree.addNewElements(data, parent, index ?? -1, options));
126
+ return sceneTree.addNewElements(data, parent, index ?? -1, options);
98
127
  },
99
128
  createElementsInParentFromCanonicalData: (elements, properties, parentId, index, options) => {
100
129
  const parent = requireContainerParent(parentId);
101
130
  const parentChildren = parent.get('children');
102
131
  const insertionIndex = index === undefined ? parentChildren.length : index;
103
- const preparedSceneInsertion = sceneTree.prepareCanonicalElementInsertion({
132
+ return applyCanonicalInsertion({
133
+ kind: 'element-creation',
104
134
  entries: elements.map((data, offset) => ({
105
135
  data,
106
136
  parentId,
107
137
  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);
138
+ })),
139
+ properties
140
+ }, options);
128
141
  },
129
142
  updateLocalComputedData: (updates) => sceneTree.updateLocalComputedData(updates),
130
143
  patchLocalComputedData: (updates) => sceneTree.patchLocalComputedData(updates),
@@ -140,6 +153,11 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
140
153
  getAllElementsBounds: () => getAllElementsWorldBounds(sceneTree)
141
154
  };
142
155
  const renderRequests = {
156
+ getElementIdsInBounds: (bounds) => render.getElementIdsInBounds(bounds),
157
+ suspendElementPresentation: (elementId) => render.suspendElementPresentation(elementId),
158
+ measureText: (layout) => render.measureText(layout),
159
+ measureElementContentBounds: (elementIds) => render.measureElementContentBounds(elementIds),
160
+ captureElementSnapshot: (elementId, maxDimension, options) => render.captureElementSnapshot(elementId, maxDimension, options),
143
161
  initRender: (width, height, color) => render.init(width, height, color),
144
162
  getViewportPosition: () => render.getViewportPosition(),
145
163
  getViewportScale: () => render.getViewportScale(),
@@ -170,28 +188,30 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
170
188
  for (const change of changes) {
171
189
  switch (change.kind) {
172
190
  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
- }
191
+ const layers = change.layers ?? [];
179
192
  const orderedPropertyIds = [];
180
193
  const seenPropertyIds = new Set();
181
194
  const operations = [];
182
- records.forEach(({ propertyId, key, set, remove }) => {
183
- if (!seenPropertyIds.has(propertyId)) {
184
- seenPropertyIds.add(propertyId);
185
- orderedPropertyIds.push(propertyId);
195
+ const includeIds = (ids) => {
196
+ for (const id of ids) {
197
+ if (!seenPropertyIds.has(id)) {
198
+ seenPropertyIds.add(id);
199
+ orderedPropertyIds.push(id);
200
+ }
186
201
  }
202
+ };
203
+ if (change.creations !== undefined) {
204
+ includeIds(change.creations.map(({ id }) => id));
187
205
  operations.push({
188
- kind: 'records',
189
- propertyId,
190
- key,
191
- ...(set === undefined ? {} : { set }),
192
- ...(remove === undefined ? {} : { remove })
206
+ kind: 'create-exact-property-records',
207
+ components: change.creations
193
208
  });
194
- });
209
+ }
210
+ for (const { id } of change.removals ?? []) {
211
+ if (sceneTree.getElementPropertyRelations(id).length > 0) {
212
+ throw new Error(`[Core] Cannot retire property record "${id}" retained by an element`);
213
+ }
214
+ }
195
215
  change.updates.forEach(({ propertyId, values }) => {
196
216
  if (!seenPropertyIds.has(propertyId)) {
197
217
  seenPropertyIds.add(propertyId);
@@ -203,6 +223,18 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
203
223
  values
204
224
  });
205
225
  });
226
+ layers.forEach(({ propertyId, changes }) => {
227
+ if (!seenPropertyIds.has(propertyId)) {
228
+ seenPropertyIds.add(propertyId);
229
+ orderedPropertyIds.push(propertyId);
230
+ }
231
+ operations.push({ kind: 'layers', propertyId, changes });
232
+ });
233
+ includeIds((change.removals ?? []).map(({ id }) => id));
234
+ operations.push({
235
+ kind: 'remove-exact-property-records',
236
+ components: change.removals ?? []
237
+ });
206
238
  const preparedBatch = props.preparePropertyMutationBatch({
207
239
  operations
208
240
  });
@@ -210,6 +242,11 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
210
242
  requireOrderedIds('property-component owner', result.orderedPropertyIds, orderedPropertyIds);
211
243
  break;
212
244
  }
245
+ case 'element-property-bindings': {
246
+ const prepared = sceneTree.prepareCanonicalElementPropertyBindingMutation(change.changes);
247
+ sceneTree.applyPreparedElementMutation(prepared);
248
+ break;
249
+ }
213
250
  case 'element-data': {
214
251
  const elementIds = sceneTreeAPIs.applyElementDataChanges(change.changes);
215
252
  requireOrderedIds('element-data owner', elementIds, change.changes.map(({ id: elementId }) => elementId));
@@ -223,10 +260,8 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
223
260
  break;
224
261
  }
225
262
  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
- }
263
+ const prepared = sceneTree.prepareCanonicalSubtreeRemoval(change.change);
264
+ sceneTree.applyPreparedElementMutation(prepared);
230
265
  break;
231
266
  }
232
267
  case 'subtree-restore': {
@@ -240,13 +275,14 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
240
275
  break;
241
276
  }
242
277
  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));
278
+ const elementIds = applyCanonicalInsertion(change);
279
+ requireOrderedIds('element-creation owner', elementIds, change.entries.map(({ data }) => data.id));
245
280
  break;
246
281
  }
247
282
  case 'element-removal': {
248
- const elementIds = sceneTreeAPIs.removeElementsFromCanonicalData(change.removals);
249
- requireOrderedIds('element-removal owner', elementIds, change.removals.map(({ data }) => data.id));
283
+ const prepared = sceneTree.prepareCanonicalElementRemoval(change.removals);
284
+ const result = sceneTree.applyPreparedElementMutation(prepared);
285
+ requireOrderedIds('element-removal owner', result.orderedElementIds, change.removals.map(({ data }) => data.id));
250
286
  break;
251
287
  }
252
288
  }
@@ -258,15 +294,34 @@ export const createAPIs = (sceneTree, render, selection, props, factory) => {
258
294
  ...propsAPIs,
259
295
  ...createRenderAPIs(renderRequests),
260
296
  ...sceneTreeAPIs,
297
+ ...createElementPropertyIntentAPIs({
298
+ resolveElementPropertyBindings: (requests) => sceneTree.resolveElementPropertyBindings(requests),
299
+ prepareElementPropertyBindingMutation: (requests) => sceneTree.prepareElementPropertyBindingMutation(requests),
300
+ applyPreparedElementMutation: (prepared, options) => sceneTree.applyPreparedElementMutation(prepared, options),
301
+ readPropertyTargets: (targets) => props.readPropertyTargets(targets),
302
+ preparePropertyIntentBatch: (intents, options) => props.preparePropertyIntentBatch(intents, options),
303
+ prepareSharedPropertySourceBatch: (updates, options) => props.prepareSharedPropertySourceBatch(updates, options),
304
+ preparePropertyMutationBatch: (request) => props.preparePropertyMutationBatch(request),
305
+ applyPreparedPropertyMutationBatch: (prepared) => props.applyPreparedPropertyMutationBatch(prepared)
306
+ }),
261
307
  ...createElementPropertyAPIs({
262
308
  resolveElementPropertyTargets: (requests) => sceneTree.resolveElementPropertyTargets(requests),
309
+ resolveElementPropertyBindings: (requests) => sceneTree.resolveElementPropertyBindings(requests),
310
+ prepareOwnerPropertyMutations: (updates, options) => props.prepareOwnerPropertyMutations(updates, options),
311
+ prepareElementPropertyBindingMutation: (requests) => sceneTree.prepareElementPropertyBindingMutation(requests),
312
+ applyPreparedElementMutation: (prepared, options) => sceneTree.applyPreparedElementMutation(prepared, options),
263
313
  preparePropertyMutationBatch: (request) => props.preparePropertyMutationBatch(request),
264
314
  applyPreparedPropertyMutationBatch: (preparedBatch) => props.applyPreparedPropertyMutationBatch(preparedBatch)
265
315
  }),
266
316
  ...createElementSelectionAPIs(selection, factory),
267
317
  ...createUIContextAPIs(),
268
318
  ...createSystemPropertyAPIs(),
269
- applyCanonicalChanges
319
+ applyCanonicalChanges,
320
+ isTransactionBoundaryIdle: () => factory.isTransactionBoundaryIdle(),
321
+ startHistoryGroup: (options) => factory.startHistoryGroup(options),
322
+ updateHistoryGroup: (handle, mutate) => factory.updateHistoryGroup(handle, mutate),
323
+ endHistoryGroup: (handle) => factory.endHistoryGroup(handle),
324
+ getHistoryGroupStatus: (handle) => factory.getHistoryGroupStatus(handle)
270
325
  };
271
326
  };
272
327
  //# sourceMappingURL=create-apis.js.map