@skenora/babylon-editor 0.1.2

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 (34) hide show
  1. package/README.md +34 -0
  2. package/dist/bridge/editor-runtime-bridge.d.ts +47 -0
  3. package/dist/bridge/editor-runtime-bridge.d.ts.map +1 -0
  4. package/dist/bridge/editor-runtime-bridge.js +548 -0
  5. package/dist/bridge/editor-runtime-bridge.js.map +1 -0
  6. package/dist/bridge/projection-operation.d.ts +50 -0
  7. package/dist/bridge/projection-operation.d.ts.map +1 -0
  8. package/dist/bridge/projection-operation.js +12 -0
  9. package/dist/bridge/projection-operation.js.map +1 -0
  10. package/dist/controllers/keyboard-controller.d.ts +17 -0
  11. package/dist/controllers/keyboard-controller.d.ts.map +1 -0
  12. package/dist/controllers/keyboard-controller.js +78 -0
  13. package/dist/controllers/keyboard-controller.js.map +1 -0
  14. package/dist/flow/editor-flow-bridge.d.ts +16 -0
  15. package/dist/flow/editor-flow-bridge.d.ts.map +1 -0
  16. package/dist/flow/editor-flow-bridge.js +46 -0
  17. package/dist/flow/editor-flow-bridge.js.map +1 -0
  18. package/dist/flow/flow-host.d.ts +12 -0
  19. package/dist/flow/flow-host.d.ts.map +1 -0
  20. package/dist/flow/flow-host.js +172 -0
  21. package/dist/flow/flow-host.js.map +1 -0
  22. package/dist/flow/runtime-flow-controller.d.ts +25 -0
  23. package/dist/flow/runtime-flow-controller.d.ts.map +1 -0
  24. package/dist/flow/runtime-flow-controller.js +143 -0
  25. package/dist/flow/runtime-flow-controller.js.map +1 -0
  26. package/dist/index.d.ts +7 -0
  27. package/dist/index.d.ts.map +1 -0
  28. package/dist/index.js +7 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/runtime-flow.d.ts +3 -0
  31. package/dist/runtime-flow.d.ts.map +1 -0
  32. package/dist/runtime-flow.js +3 -0
  33. package/dist/runtime-flow.js.map +1 -0
  34. package/package.json +42 -0
package/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @skenora/babylon-editor
2
+
3
+ Babylon.js adapters that connect Skenora's headless Editor, Runtime, and Flow
4
+ packages.
5
+
6
+ ```bash
7
+ pnpm add @skenora/babylon-editor
8
+ ```
9
+
10
+ Exports include:
11
+
12
+ - `EditorRuntimeBridge` for projecting editor document changes;
13
+ - bridge-local projection operation results and events for associating
14
+ `operationId`, `projectionId`, `sourceRevision`, `changeId`, and status;
15
+ - `EditorFlowBridge` for editable Flow documents and explicit preview;
16
+ - `RuntimeFlowController` and `createRuntimeFlowHost` for playback;
17
+ - `EditorKeyboardController` for framework-neutral host shortcuts.
18
+
19
+ Renderer-only Flow playback is also available from the dedicated
20
+ `@skenora/babylon-editor/runtime-flow` entry so read-only applications can load
21
+ it only for documents that contain Flow graphs.
22
+
23
+ This is an integration package, not a product facade or UI component. Most
24
+ applications should start with `@skenora/sdk`.
25
+
26
+ `EditorRuntimeBridge.flush()` remains the compatibility API and now rejects
27
+ when a queued runtime projection fails. Hosts that need structured operation
28
+ tracking can use `flushProjection()` or `projectCurrentDocument()` and listen
29
+ to `projectionEvents`; each request can select `strict` or `best-effort` model
30
+ loading. Best-effort model failures are reported as `partial` with the failed
31
+ entity list. The association is intentionally bridge-local until the shared
32
+ runtime event contract can carry projection identifiers.
33
+
34
+ See the [architecture guide](https://github.com/zhangjiadi225/skenora/blob/main/docs/ARCHITECTURE.md).
@@ -0,0 +1,47 @@
1
+ import { type EditorSession } from "@skenora/editor";
2
+ import { EventHub } from "@skenora/events";
3
+ import type { ResourceResolver } from "@skenora/resources";
4
+ import { type RuntimeSession } from "@skenora/runtime/projection";
5
+ import { RuntimeSelectionController } from "@skenora/runtime/editor";
6
+ import { type EditorRuntimeProjectionEventMap, type EditorRuntimeProjectionPolicy, type EditorRuntimeProjectionRequest, type EditorRuntimeProjectionResult } from "./projection-operation.js";
7
+ export interface EditorRuntimeBridgeOptions {
8
+ selection?: boolean;
9
+ /** Controls whether one failed model rolls back the complete scene. */
10
+ modelLoadPolicy?: EditorRuntimeProjectionPolicy;
11
+ }
12
+ /** Optional integration layer. Editor and runtime remain independently usable. */
13
+ export declare class EditorRuntimeBridge {
14
+ #private;
15
+ readonly editor: EditorSession;
16
+ readonly runtime: RuntimeSession;
17
+ readonly resources: ResourceResolver;
18
+ readonly selection: RuntimeSelectionController | null;
19
+ /**
20
+ * Bridge-local projection events carry operation association until the
21
+ * shared RuntimeEventMap can evolve without breaking other packages.
22
+ */
23
+ readonly projectionEvents: EventHub<EditorRuntimeProjectionEventMap>;
24
+ constructor(editor: EditorSession, runtime: RuntimeSession, resources: ResourceResolver, options?: EditorRuntimeBridgeOptions);
25
+ initialize(): Promise<void>;
26
+ /** Initializes the runtime and returns an operation-associated result. */
27
+ initializeProjection(request?: EditorRuntimeProjectionRequest): Promise<EditorRuntimeProjectionResult>;
28
+ /**
29
+ * Explicitly projects the current editor snapshot.
30
+ *
31
+ * Most editor changes are automatically observed. This additive method is
32
+ * useful to a future executor that needs an explicit operation boundary.
33
+ */
34
+ projectCurrentDocument(request?: EditorRuntimeProjectionRequest): Promise<EditorRuntimeProjectionResult>;
35
+ /** Persist a transient runtime transform through the editor command pipeline. */
36
+ bakeEntityTransform(entityId: string): boolean;
37
+ /** Waits until all document changes observed so far finish projecting. */
38
+ flush(): Promise<void>;
39
+ /**
40
+ * Waits for the latest observed projection and exposes its structured
41
+ * status. A queued operation may be claimed with an operation id and a
42
+ * per-operation model loading policy before it starts.
43
+ */
44
+ flushProjection(request?: EditorRuntimeProjectionRequest): Promise<EditorRuntimeProjectionResult | null>;
45
+ dispose(): void;
46
+ }
47
+ //# sourceMappingURL=editor-runtime-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-runtime-bridge.d.ts","sourceRoot":"","sources":["../../src/bridge/editor-runtime-bridge.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,QAAQ,EAGT,MAAM,iBAAiB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AAC,6BAA6B,GAAG,IAAI,CAAC;IAQhD,OAAO,IAAI,IAAI;CAofhB"}
@@ -0,0 +1,548 @@
1
+ import { setPropertyCommand } from "@skenora/editor";
2
+ import { EventHub, createCausationMetadata, } from "@skenora/events";
3
+ import { RUNTIME_NODES_CAPABILITY, } from "@skenora/runtime/projection";
4
+ import { RuntimeSelectionController } from "@skenora/runtime/editor";
5
+ import { EditorRuntimeProjectionError, } from "./projection-operation.js";
6
+ /** Optional integration layer. Editor and runtime remain independently usable. */
7
+ export class EditorRuntimeBridge {
8
+ editor;
9
+ runtime;
10
+ resources;
11
+ selection;
12
+ /**
13
+ * Bridge-local projection events carry operation association until the
14
+ * shared RuntimeEventMap can evolve without breaking other packages.
15
+ */
16
+ projectionEvents = new EventHub();
17
+ #nodes;
18
+ #modelLoadPolicy;
19
+ #controller = new AbortController();
20
+ #reloadQueue = Promise.resolve();
21
+ #operationSequence = 0;
22
+ #lastFlushedSequence = 0;
23
+ #lastFailure = null;
24
+ #lastOperation = null;
25
+ #runningOperation = null;
26
+ #activeOperations = new Set();
27
+ #structuralReloadScheduled = false;
28
+ #requestedStructuralRevision = -1;
29
+ #requestedStructuralChange = null;
30
+ #requestedStructuralCause = null;
31
+ #pendingStructuralOperation = null;
32
+ #disposed = false;
33
+ constructor(editor, runtime, resources, options = {}) {
34
+ this.editor = editor;
35
+ this.runtime = runtime;
36
+ this.resources = resources;
37
+ this.#nodes = runtime.capabilities.require(RUNTIME_NODES_CAPABILITY);
38
+ this.#modelLoadPolicy = options.modelLoadPolicy ?? "strict";
39
+ this.selection =
40
+ options.selection === false
41
+ ? null
42
+ : new RuntimeSelectionController(runtime.scene, {
43
+ onSelectionChange: (entityId, additive) => {
44
+ if (!additive) {
45
+ editor.select(entityId ? [entityId] : []);
46
+ return;
47
+ }
48
+ if (!entityId)
49
+ return;
50
+ editor.select(editor.selection.includes(entityId)
51
+ ? editor.selection.filter((id) => id !== entityId)
52
+ : [...editor.selection, entityId]);
53
+ },
54
+ onTransformCommit: (entityId, node) => this.#commitTransform(entityId, node),
55
+ });
56
+ editor.subscribe("document.changed", (change, event) => this.#syncChange(change, event), this.#controller.signal);
57
+ editor.subscribe("selection.changed", ({ entityIds }) => {
58
+ this.selection?.selectMany(entityIds.flatMap((id) => {
59
+ const node = this.#nodes.get(id);
60
+ return node ? [node] : [];
61
+ }));
62
+ }, this.#controller.signal);
63
+ runtime.events.subscribe("runtime.document.applied", () => this.#syncSelection(), { signal: this.#controller.signal });
64
+ runtime.events.subscribe("runtime.model.failed", ({ entityId, error }) => {
65
+ const operation = this.#runningOperation;
66
+ if (!operation || !isDocumentProjectionOperation(operation))
67
+ return;
68
+ operation.modelFailures.push({ entityId, error });
69
+ }, { signal: this.#controller.signal });
70
+ }
71
+ async initialize() {
72
+ const result = await this.initializeProjection();
73
+ const operation = this.#lastOperation;
74
+ if (operation?.result === result) {
75
+ this.#lastFlushedSequence = operation.sequence;
76
+ }
77
+ if (result.status !== "ready" && result.status !== "partial") {
78
+ throw new EditorRuntimeProjectionError(result);
79
+ }
80
+ }
81
+ /** Initializes the runtime and returns an operation-associated result. */
82
+ async initializeProjection(request = {}) {
83
+ return this.#projectCurrentDocument(request, "initializeDocument");
84
+ }
85
+ /**
86
+ * Explicitly projects the current editor snapshot.
87
+ *
88
+ * Most editor changes are automatically observed. This additive method is
89
+ * useful to a future executor that needs an explicit operation boundary.
90
+ */
91
+ async projectCurrentDocument(request = {}) {
92
+ return this.#projectCurrentDocument(request, "loadDocument");
93
+ }
94
+ /** Persist a transient runtime transform through the editor command pipeline. */
95
+ bakeEntityTransform(entityId) {
96
+ this.#assertActive();
97
+ const node = this.#nodes.get(entityId);
98
+ if (!node || !isTransformNode(node))
99
+ return false;
100
+ this.#commitTransform(entityId, node);
101
+ return true;
102
+ }
103
+ /** Waits until all document changes observed so far finish projecting. */
104
+ async flush() {
105
+ this.#assertActive();
106
+ const operation = this.#lastOperation;
107
+ if (!operation)
108
+ return;
109
+ const result = await operation.promise;
110
+ const failure = this.#lastFailure &&
111
+ this.#lastFailure.sequence > this.#lastFlushedSequence &&
112
+ this.#lastFailure.sequence <= operation.sequence
113
+ ? this.#lastFailure.result
114
+ : null;
115
+ this.#lastFlushedSequence = operation.sequence;
116
+ if (failure)
117
+ throw new EditorRuntimeProjectionError(failure);
118
+ if (result.status !== "ready" && result.status !== "partial") {
119
+ throw new EditorRuntimeProjectionError(result);
120
+ }
121
+ this.#assertActive();
122
+ }
123
+ /**
124
+ * Waits for the latest observed projection and exposes its structured
125
+ * status. A queued operation may be claimed with an operation id and a
126
+ * per-operation model loading policy before it starts.
127
+ */
128
+ async flushProjection(request = {}) {
129
+ this.#assertActive();
130
+ const operation = this.#lastOperation;
131
+ if (!operation)
132
+ return null;
133
+ this.#configureOperation(operation, request);
134
+ return operation.promise;
135
+ }
136
+ dispose() {
137
+ if (this.#disposed)
138
+ return;
139
+ this.#disposed = true;
140
+ this.#controller.abort();
141
+ for (const operation of this.#activeOperations) {
142
+ this.#settleOperation(operation, "cancelled", createAbortError());
143
+ }
144
+ this.selection?.dispose();
145
+ this.projectionEvents.dispose();
146
+ }
147
+ #syncChange(change, cause) {
148
+ if (this.#structuralReloadScheduled) {
149
+ this.#scheduleStructuralReload(change, cause);
150
+ return;
151
+ }
152
+ const structural = change.patches.some((patch) => {
153
+ if (patch.path.length === 0)
154
+ return true;
155
+ const [root, entityId, property] = patch.path;
156
+ const entity = typeof entityId === "string"
157
+ ? this.editor.snapshot.entities[entityId]
158
+ : undefined;
159
+ return (root === "assets" ||
160
+ root === "rootEntityIds" ||
161
+ (root === "entities" &&
162
+ (patch.op === "delete" ||
163
+ property === undefined ||
164
+ !entity ||
165
+ this.runtime.classifyEntityChange(entity, patch.path.slice(2)) ===
166
+ "recreate")));
167
+ });
168
+ if (structural) {
169
+ this.#scheduleStructuralReload(change, cause);
170
+ return;
171
+ }
172
+ const changedEntities = new Set();
173
+ const settings = new Set();
174
+ for (const patch of change.patches) {
175
+ const [root, entityId] = patch.path;
176
+ if (root === "entities" && typeof entityId === "string") {
177
+ changedEntities.add(entityId);
178
+ }
179
+ else if (root === "materialBindings") {
180
+ settings.add("materials");
181
+ }
182
+ else if (isRuntimeSetting(root)) {
183
+ settings.add(root);
184
+ }
185
+ }
186
+ const operation = this.#createOperation({
187
+ change,
188
+ cause,
189
+ operation: settings.size > 0
190
+ ? "applyDocumentSettings"
191
+ : changedEntities.size > 0
192
+ ? "updateEntity"
193
+ : "applyDocumentChange",
194
+ });
195
+ try {
196
+ for (const entityId of changedEntities) {
197
+ const entity = this.editor.snapshot.entities[entityId];
198
+ if (entity)
199
+ this.runtime.updateEntity(entity);
200
+ }
201
+ }
202
+ catch (error) {
203
+ this.#publishRuntimeError(operation, error);
204
+ this.#failOperation(operation, error);
205
+ return;
206
+ }
207
+ this.#enqueueOperation(operation, settings.size > 0
208
+ ? async () => {
209
+ await this.runtime.applyDocumentSettings(this.editor.snapshot, [
210
+ ...settings,
211
+ ]);
212
+ }
213
+ : async () => undefined);
214
+ }
215
+ #scheduleStructuralReload(change, cause) {
216
+ this.#requestedStructuralRevision = change.revision;
217
+ this.#requestedStructuralChange = change;
218
+ if (cause)
219
+ this.#requestedStructuralCause = cause;
220
+ if (this.#structuralReloadScheduled) {
221
+ if (this.#pendingStructuralOperation) {
222
+ this.#updateOperationSource(this.#pendingStructuralOperation, change, cause);
223
+ }
224
+ return;
225
+ }
226
+ this.#structuralReloadScheduled = true;
227
+ const operation = this.#createOperation({
228
+ change,
229
+ cause: this.#requestedStructuralCause,
230
+ operation: "reloadDocument",
231
+ });
232
+ this.#pendingStructuralOperation = operation;
233
+ this.#enqueueOperation(operation, async (currentOperation) => {
234
+ let attemptedRevision = -1;
235
+ try {
236
+ while (!this.#disposed &&
237
+ attemptedRevision !== this.#requestedStructuralRevision) {
238
+ attemptedRevision = this.#requestedStructuralRevision;
239
+ const requestedChange = this.#requestedStructuralChange;
240
+ if (requestedChange) {
241
+ this.#updateOperationSource(currentOperation, requestedChange, this.#requestedStructuralCause);
242
+ }
243
+ currentOperation.modelFailures.length = 0;
244
+ await this.runtime.loadDocument(this.editor.snapshot, this.resources, {
245
+ signal: this.#controller.signal,
246
+ modelLoadPolicy: currentOperation.modelLoadPolicy,
247
+ });
248
+ this.#syncSelection();
249
+ }
250
+ }
251
+ finally {
252
+ this.#structuralReloadScheduled = false;
253
+ this.#pendingStructuralOperation = null;
254
+ if (!this.#disposed &&
255
+ attemptedRevision !== this.#requestedStructuralRevision &&
256
+ this.#requestedStructuralChange) {
257
+ this.#scheduleStructuralReload(this.#requestedStructuralChange, this.#requestedStructuralCause ?? undefined);
258
+ }
259
+ }
260
+ });
261
+ }
262
+ #createOperation(input) {
263
+ const request = input.request ?? {};
264
+ const change = input.change;
265
+ const sourceRevision = change?.revision ?? this.editor.revision;
266
+ const changeId = change?.id ?? null;
267
+ if (request.sourceRevision !== undefined &&
268
+ request.sourceRevision !== sourceRevision) {
269
+ throw new Error(`Projection source revision mismatch: expected ${request.sourceRevision}, actual ${sourceRevision}`);
270
+ }
271
+ if (request.changeId !== undefined && request.changeId !== changeId) {
272
+ throw new Error(`Projection change mismatch: expected ${request.changeId ?? "null"}, actual ${changeId ?? "null"}`);
273
+ }
274
+ let resolve;
275
+ const promise = new Promise((settle) => {
276
+ resolve = settle;
277
+ });
278
+ const operation = {
279
+ sequence: ++this.#operationSequence,
280
+ operationId: request.operationId === undefined
281
+ ? createProjectionId("editor-runtime-operation")
282
+ : requireProjectionId(request.operationId, "operationId"),
283
+ projectionId: request.projectionId === undefined
284
+ ? createProjectionId("runtime-projection")
285
+ : requireProjectionId(request.projectionId, "projectionId"),
286
+ documentId: this.editor.snapshot.id,
287
+ sourceRevision,
288
+ changeId,
289
+ operation: input.operation,
290
+ modelLoadPolicy: request.modelLoadPolicy ?? this.#modelLoadPolicy,
291
+ status: "queued",
292
+ startedAt: null,
293
+ completedAt: null,
294
+ error: undefined,
295
+ cause: input.cause ?? null,
296
+ modelFailures: [],
297
+ promise,
298
+ resolve,
299
+ result: null,
300
+ };
301
+ this.#activeOperations.add(operation);
302
+ this.#lastOperation = operation;
303
+ this.#publishProjection("projection.queued", operation);
304
+ return operation;
305
+ }
306
+ #enqueueOperation(operation, task) {
307
+ const queued = this.#reloadQueue
308
+ .then(() => this.#runOperation(operation, task))
309
+ .catch((error) => {
310
+ this.#failOperation(operation, error);
311
+ });
312
+ this.#reloadQueue = queued.then(() => undefined, () => undefined);
313
+ }
314
+ async #runOperation(operation, task) {
315
+ if (operation.result)
316
+ return;
317
+ if (this.#disposed) {
318
+ this.#settleOperation(operation, "cancelled", createAbortError());
319
+ return;
320
+ }
321
+ operation.status = "loading";
322
+ operation.startedAt = Date.now();
323
+ this.#publishProjection("projection.started", operation);
324
+ this.#runningOperation = operation;
325
+ try {
326
+ await task(operation);
327
+ this.#settleOperation(operation, this.#disposed
328
+ ? "cancelled"
329
+ : operation.modelFailures.length > 0
330
+ ? "partial"
331
+ : "ready", this.#disposed ? createAbortError() : undefined);
332
+ }
333
+ catch (error) {
334
+ if (this.#disposed) {
335
+ this.#settleOperation(operation, "cancelled", createAbortError());
336
+ }
337
+ else {
338
+ this.#publishRuntimeError(operation, error);
339
+ this.#failOperation(operation, error);
340
+ }
341
+ }
342
+ finally {
343
+ if (this.#runningOperation === operation) {
344
+ this.#runningOperation = null;
345
+ }
346
+ }
347
+ }
348
+ #settleOperation(operation, status, error) {
349
+ if (operation.result)
350
+ return;
351
+ operation.status = status;
352
+ operation.error = error;
353
+ operation.completedAt = Date.now();
354
+ const result = this.#snapshotOperation(operation);
355
+ operation.result = result;
356
+ this.#activeOperations.delete(operation);
357
+ if (status === "failed")
358
+ this.#lastFailure = operation;
359
+ this.#publishProjection("projection.completed", result);
360
+ operation.resolve(result);
361
+ }
362
+ #failOperation(operation, error) {
363
+ this.#settleOperation(operation, "failed", error);
364
+ }
365
+ #configureOperation(operation, request) {
366
+ if (request.sourceRevision !== undefined &&
367
+ request.sourceRevision !== operation.sourceRevision) {
368
+ throw new Error(`Projection source revision mismatch: expected ${request.sourceRevision}, actual ${operation.sourceRevision}`);
369
+ }
370
+ if (request.changeId !== undefined &&
371
+ request.changeId !== operation.changeId) {
372
+ throw new Error(`Projection change mismatch: expected ${request.changeId ?? "null"}, actual ${operation.changeId ?? "null"}`);
373
+ }
374
+ if (operation.status !== "queued") {
375
+ if (request.operationId !== undefined &&
376
+ request.operationId !== operation.operationId) {
377
+ throw new Error(`Projection operation ${operation.operationId} has already started`);
378
+ }
379
+ if (request.projectionId !== undefined &&
380
+ request.projectionId !== operation.projectionId) {
381
+ throw new Error(`Projection ${operation.projectionId} has already started`);
382
+ }
383
+ if (request.modelLoadPolicy !== undefined &&
384
+ request.modelLoadPolicy !== operation.modelLoadPolicy) {
385
+ throw new Error(`Projection ${operation.operationId} has already started with policy ${operation.modelLoadPolicy}`);
386
+ }
387
+ return;
388
+ }
389
+ if (request.operationId !== undefined) {
390
+ operation.operationId = requireProjectionId(request.operationId, "operationId");
391
+ }
392
+ if (request.projectionId !== undefined) {
393
+ operation.projectionId = requireProjectionId(request.projectionId, "projectionId");
394
+ }
395
+ if (request.modelLoadPolicy !== undefined) {
396
+ operation.modelLoadPolicy = request.modelLoadPolicy;
397
+ }
398
+ }
399
+ #updateOperationSource(operation, change, cause) {
400
+ operation.sourceRevision = change.revision;
401
+ operation.changeId = change.id;
402
+ if (cause)
403
+ operation.cause = cause;
404
+ }
405
+ #projectCurrentDocument(request, operationName) {
406
+ this.#assertActive();
407
+ const operation = this.#createOperation({
408
+ cause: null,
409
+ operation: operationName,
410
+ request,
411
+ });
412
+ this.#enqueueOperation(operation, async (currentOperation) => {
413
+ if (this.editor.revision !== currentOperation.sourceRevision) {
414
+ throw new Error(`Projection source revision changed before ${operationName}: expected ${currentOperation.sourceRevision}, actual ${this.editor.revision}`);
415
+ }
416
+ await this.runtime.loadDocument(this.editor.snapshot, this.resources, {
417
+ signal: this.#controller.signal,
418
+ modelLoadPolicy: currentOperation.modelLoadPolicy,
419
+ });
420
+ this.#syncSelection();
421
+ });
422
+ return operation.promise;
423
+ }
424
+ #snapshotOperation(operation) {
425
+ const snapshot = {
426
+ operationId: operation.operationId,
427
+ projectionId: operation.projectionId,
428
+ documentId: operation.documentId,
429
+ sourceRevision: operation.sourceRevision,
430
+ changeId: operation.changeId,
431
+ operation: operation.operation,
432
+ modelLoadPolicy: operation.modelLoadPolicy,
433
+ status: operation.status,
434
+ startedAt: operation.startedAt,
435
+ completedAt: operation.completedAt,
436
+ modelFailures: Object.freeze(operation.modelFailures.map(({ entityId, error }) => ({
437
+ entityId,
438
+ error,
439
+ }))),
440
+ ...(operation.error === undefined ? {} : { error: operation.error }),
441
+ };
442
+ return snapshot;
443
+ }
444
+ #publishProjection(type, operation) {
445
+ try {
446
+ if (type === "projection.completed") {
447
+ this.projectionEvents.publish(type, operation);
448
+ return;
449
+ }
450
+ const snapshot = this.#snapshotOperation(operation);
451
+ this.projectionEvents.publish(type, snapshot);
452
+ }
453
+ catch {
454
+ // Projection diagnostics must not turn a runtime result into a failure.
455
+ }
456
+ }
457
+ #publishRuntimeError(operation, error) {
458
+ try {
459
+ this.runtime.events.publish("runtime.error", { error, operation: operation.operation }, operation.cause
460
+ ? createCausationMetadata(operation.cause, "editor-runtime-bridge")
461
+ : { source: "editor-runtime-bridge" });
462
+ }
463
+ catch {
464
+ // Keep the operation's structured failure even if Runtime is disposing.
465
+ }
466
+ }
467
+ #commitTransform(entityId, node) {
468
+ if (!isTransformNode(node))
469
+ return;
470
+ const transform = {
471
+ position: {
472
+ x: node.position.x,
473
+ y: node.position.y,
474
+ z: node.position.z,
475
+ },
476
+ rotation: {
477
+ x: node.rotation.x,
478
+ y: node.rotation.y,
479
+ z: node.rotation.z,
480
+ },
481
+ scaling: {
482
+ x: node.scaling.x,
483
+ y: node.scaling.y,
484
+ z: node.scaling.z,
485
+ },
486
+ ...(node.rotationQuaternion
487
+ ? {
488
+ rotationQuaternion: {
489
+ x: node.rotationQuaternion.x,
490
+ y: node.rotationQuaternion.y,
491
+ z: node.rotationQuaternion.z,
492
+ w: node.rotationQuaternion.w,
493
+ },
494
+ }
495
+ : {}),
496
+ };
497
+ this.editor.execute(setPropertyCommand(["entities", entityId, "transform"], transform, "Transform entity"));
498
+ }
499
+ #syncSelection() {
500
+ this.selection?.selectMany(this.editor.selection.flatMap((entityId) => {
501
+ const node = this.#nodes.get(entityId);
502
+ return node ? [node] : [];
503
+ }));
504
+ }
505
+ #assertActive() {
506
+ if (this.#disposed)
507
+ throw new Error("EditorRuntimeBridge has been disposed");
508
+ }
509
+ }
510
+ function isTransformNode(node) {
511
+ return "position" in node && "rotation" in node && "scaling" in node;
512
+ }
513
+ function isRuntimeSetting(value) {
514
+ return (typeof value === "string" &&
515
+ [
516
+ "camera",
517
+ "cameraPaths",
518
+ "environment",
519
+ "ground",
520
+ "fog",
521
+ "weather",
522
+ "lights",
523
+ "materials",
524
+ "textureAnimations",
525
+ "postProcess",
526
+ ].includes(value));
527
+ }
528
+ function isDocumentProjectionOperation(operation) {
529
+ return ["reloadDocument", "initializeDocument", "loadDocument"].includes(operation.operation);
530
+ }
531
+ let projectionIdSequence = 0;
532
+ function createProjectionId(prefix) {
533
+ if (typeof globalThis.crypto?.randomUUID === "function") {
534
+ return `${prefix}-${globalThis.crypto.randomUUID()}`;
535
+ }
536
+ projectionIdSequence += 1;
537
+ return `${prefix}-${Date.now()}-${projectionIdSequence}`;
538
+ }
539
+ function requireProjectionId(value, field) {
540
+ if (value.trim().length === 0) {
541
+ throw new Error(`Projection ${field} must be a non-empty string`);
542
+ }
543
+ return value;
544
+ }
545
+ function createAbortError() {
546
+ return new DOMException("The runtime projection was cancelled", "AbortError");
547
+ }
548
+ //# sourceMappingURL=editor-runtime-bridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor-runtime-bridge.js","sourceRoot":"","sources":["../../src/bridge/editor-runtime-bridge.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,kBAAkB,EAAsB,MAAM,iBAAiB,CAAC;AACzE,OAAO,E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