@sebastianwessel/isostate 0.1.2 → 0.3.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 (62) hide show
  1. package/dist/animation/controller.d.ts +25 -1
  2. package/dist/animation/controller.d.ts.map +1 -1
  3. package/dist/browser/isostate.runtime.js +5 -2459
  4. package/dist/browser/isostate.runtime.js.map +22 -1
  5. package/dist/browser-runtime.d.ts +5 -0
  6. package/dist/browser-runtime.d.ts.map +1 -0
  7. package/dist/chunks/{index-DEv2-G9F.js → index-B6HlPnov.js} +243 -1092
  8. package/dist/chunks/index-B6HlPnov.js.map +1 -0
  9. package/dist/chunks/rendering-engine-BgHel7yX.js +1117 -0
  10. package/dist/chunks/rendering-engine-BgHel7yX.js.map +1 -0
  11. package/dist/chunks/scene-parser-xgVJh2FU.js +2676 -0
  12. package/dist/chunks/scene-parser-xgVJh2FU.js.map +1 -0
  13. package/dist/chunks/sha256-4JuurR-b.js +69 -0
  14. package/dist/chunks/sha256-4JuurR-b.js.map +1 -0
  15. package/dist/dsl/browser.d.ts +7 -0
  16. package/dist/dsl/browser.d.ts.map +1 -0
  17. package/dist/dsl/browser.js +5 -0
  18. package/dist/dsl/browser.js.map +1 -0
  19. package/dist/dsl/compiler.d.ts.map +1 -1
  20. package/dist/dsl/index.js +4 -2190
  21. package/dist/dsl/index.js.map +1 -1
  22. package/dist/dsl/scene-parser.d.ts.map +1 -1
  23. package/dist/dsl/scene-validator.d.ts +2 -1
  24. package/dist/dsl/scene-validator.d.ts.map +1 -1
  25. package/dist/editor-support/adapter.d.ts +46 -0
  26. package/dist/editor-support/adapter.d.ts.map +1 -0
  27. package/dist/editor-support/geometry.d.ts +32 -0
  28. package/dist/editor-support/geometry.d.ts.map +1 -0
  29. package/dist/editor-support/hit-test.d.ts +29 -0
  30. package/dist/editor-support/hit-test.d.ts.map +1 -0
  31. package/dist/editor-support/index.d.ts +7 -0
  32. package/dist/editor-support/index.d.ts.map +1 -0
  33. package/dist/editor-support/index.js +426 -0
  34. package/dist/editor-support/index.js.map +1 -0
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +3 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/rendering/asset-node.d.ts +2 -1
  40. package/dist/rendering/asset-node.d.ts.map +1 -1
  41. package/dist/rendering/rendering-engine.d.ts +28 -1
  42. package/dist/rendering/rendering-engine.d.ts.map +1 -1
  43. package/dist/runtime/index.js +3 -1
  44. package/dist/runtime/index.js.map +1 -1
  45. package/dist/runtime/mount-scene.d.ts +9 -0
  46. package/dist/runtime/mount-scene.d.ts.map +1 -1
  47. package/dist/types/assets.d.ts +27 -2
  48. package/dist/types/assets.d.ts.map +1 -1
  49. package/dist/types/index.d.ts +4 -4
  50. package/dist/types/index.d.ts.map +1 -1
  51. package/dist/types/node.d.ts +50 -2
  52. package/dist/types/node.d.ts.map +1 -1
  53. package/dist/types/runtime-bundle.d.ts +5 -0
  54. package/dist/types/runtime-bundle.d.ts.map +1 -1
  55. package/dist/types/scene.d.ts +28 -3
  56. package/dist/types/scene.d.ts.map +1 -1
  57. package/dist/types/validation.d.ts +6 -0
  58. package/dist/types/validation.d.ts.map +1 -1
  59. package/dist/utils/sha256.d.ts +3 -0
  60. package/dist/utils/sha256.d.ts.map +1 -0
  61. package/package.json +9 -1
  62. package/dist/chunks/index-DEv2-G9F.js.map +0 -1
@@ -0,0 +1,29 @@
1
+ import type { ViewBoxRect } from "../rendering/rendering-engine.ts";
2
+ import type { RuntimeBundle } from "../types/runtime-bundle.ts";
3
+ import type { EditorRuntimeAdapter } from "./adapter.ts";
4
+ import type { EditorScreenPoint } from "./geometry.ts";
5
+ export interface HitTestOptions {
6
+ includeHidden?: boolean;
7
+ includeLocked?: boolean;
8
+ kinds?: Array<"element" | "connection">;
9
+ }
10
+ export interface RuntimeObjectHit {
11
+ id: string;
12
+ kind: "element" | "connection";
13
+ layer: string;
14
+ bounds: ViewBoxRect;
15
+ }
16
+ /**
17
+ * Find the topmost runtime object at a screen point.
18
+ * Hit testing follows the current rendered depth order so the visually
19
+ * topmost object wins.
20
+ */
21
+ export declare function getRuntimeObjectAtPoint(adapter: EditorRuntimeAdapter, point: EditorScreenPoint, options?: HitTestOptions): RuntimeObjectHit | undefined;
22
+ /**
23
+ * Compute the union bounds of a selection of runtime objects.
24
+ * Missing ids are ignored. Returns `undefined` if no ids resolve.
25
+ */
26
+ export declare function getRuntimeSelectionBounds(adapter: EditorRuntimeAdapter, ids: string[]): ViewBoxRect | undefined;
27
+ /** Compute screen-space bounds for a connector route. */
28
+ export declare function getConnectionBounds(route: [number, number][], bundle: RuntimeBundle): ViewBoxRect;
29
+ //# sourceMappingURL=hit-test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hit-test.d.ts","sourceRoot":"","sources":["../../src/editor-support/hit-test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,WAAW,cAAc;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,YAAY,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,gBAAgB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,SAAS,GAAG,YAAY,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACtC,OAAO,EAAE,oBAAoB,EAC7B,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,cAAmB,GAC1B,gBAAgB,GAAG,SAAS,CA+B9B;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,WAAW,GAAG,SAAS,CAwB/G;AAcD,yDAAyD;AACzD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,aAAa,GAAG,WAAW,CAwBjG"}
@@ -0,0 +1,7 @@
1
+ export type { EditorRuntimeAdapter, RuntimeObjectMetadata, } from "./adapter.ts";
2
+ export { createEditorRuntimeAdapter } from "./adapter.ts";
3
+ export type { EditorClientPoint, EditorScreenPoint, } from "./geometry.ts";
4
+ export { clientPointToSvgPoint, getGridCellPolygon, projectGridPoint, unprojectScreenPoint, } from "./geometry.ts";
5
+ export type { HitTestOptions, RuntimeObjectHit, } from "./hit-test.ts";
6
+ export { getRuntimeObjectAtPoint, getRuntimeSelectionBounds, } from "./hit-test.ts";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor-support/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,oBAAoB,EACpB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,YAAY,EACX,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,GACpB,MAAM,eAAe,CAAC;AACvB,YAAY,EACX,cAAc,EACd,gBAAgB,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,uBAAuB,EACvB,yBAAyB,GACzB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,426 @@
1
+ import { n as getResolvedProjectionLayout, q as projectToRaw, o as getResolvedViewBox, k as getCurrentElementBounds, l as getElementState, p as hideElementAfterExit, u as unhideElementOnReadd, j as getConnectorState, t as updateElementTransforms } from '../chunks/rendering-engine-BgHel7yX.js';
2
+ import { R as RenderError } from '../chunks/errors-DyqEkrm5.js';
3
+
4
+ /**
5
+ * Project an isometric grid point into SVG screen coordinates.
6
+ * Uses the same projection, bounds, and padding as the renderer.
7
+ */
8
+ function projectGridPoint(bundle, point) {
9
+ const layout = getResolvedProjectionLayout(bundle);
10
+ const rawX = layout.cellSize * (point[0] - point[1]) * 0.5;
11
+ const rawY = layout.cellSize * (point[0] + point[1]) * 0.25;
12
+ return {
13
+ x: rawX - layout.selectedBounds.minX + layout.padding.x,
14
+ y: rawY - layout.selectedBounds.minY + layout.padding.y,
15
+ };
16
+ }
17
+ /**
18
+ * Unproject an SVG screen point back into fractional isometric grid coordinates.
19
+ * The editor owns snap-to-grid rounding.
20
+ */
21
+ function unprojectScreenPoint(bundle, point) {
22
+ const layout = getResolvedProjectionLayout(bundle);
23
+ const rawX = point.x + layout.selectedBounds.minX - layout.padding.x;
24
+ const rawY = point.y + layout.selectedBounds.minY - layout.padding.y;
25
+ const cellSize = layout.cellSize;
26
+ const gridX = rawX / cellSize + (2 * rawY) / cellSize;
27
+ const gridY = (2 * rawY) / cellSize - rawX / cellSize;
28
+ return [gridX, gridY];
29
+ }
30
+ /**
31
+ * Convert browser pointer coordinates into SVG user units using the root SVG
32
+ * screen CTM inverse.
33
+ * @throws {RenderError} `EDITOR_GEOMETRY_UNAVAILABLE` when the CTM is missing or not invertible.
34
+ */
35
+ function clientPointToSvgPoint(svg, point) {
36
+ const ctm = svg.getScreenCTM();
37
+ if (!ctm) {
38
+ throw new RenderError("EDITOR_GEOMETRY_UNAVAILABLE", "SVG CTM is not available");
39
+ }
40
+ let inverse = null;
41
+ try {
42
+ inverse = ctm.inverse();
43
+ }
44
+ catch {
45
+ // non-invertible matrix
46
+ }
47
+ if (!inverse) {
48
+ throw new RenderError("EDITOR_GEOMETRY_UNAVAILABLE", "SVG CTM is not invertible");
49
+ }
50
+ const svgPoint = svg.createSVGPoint();
51
+ svgPoint.x = point.clientX;
52
+ svgPoint.y = point.clientY;
53
+ const result = svgPoint.matrixTransform(inverse);
54
+ return { x: result.x, y: result.y };
55
+ }
56
+ /**
57
+ * Return the four projected corners of a grid cell in clockwise order.
58
+ */
59
+ function getGridCellPolygon(bundle, cell) {
60
+ const [x, y] = cell;
61
+ return [
62
+ projectGridPoint(bundle, [x, y]),
63
+ projectGridPoint(bundle, [x + 1, y]),
64
+ projectGridPoint(bundle, [x + 1, y + 1]),
65
+ projectGridPoint(bundle, [x, y + 1]),
66
+ ];
67
+ }
68
+
69
+ /**
70
+ * Find the topmost runtime object at a screen point.
71
+ * Hit testing follows the current rendered depth order so the visually
72
+ * topmost object wins.
73
+ */
74
+ function getRuntimeObjectAtPoint(adapter, point, options = {}) {
75
+ const kinds = options.kinds ?? ["element", "connection"];
76
+ const currentScene = adapter.mounted.engine.getCurrentState();
77
+ if (!currentScene)
78
+ return undefined;
79
+ const objects = adapter.getObjects(currentScene.id);
80
+ const layerOrder = adapter.getLayerOrder();
81
+ const layerRank = new Map(layerOrder.map((l, i) => [l.name, i]));
82
+ const candidates = objects
83
+ .filter((obj) => kinds.includes(obj.kind))
84
+ .filter((obj) => options.includeHidden || obj.present)
85
+ .sort((a, b) => {
86
+ const rankA = layerRank.get(a.layer) ?? -1;
87
+ const rankB = layerRank.get(b.layer) ?? -1;
88
+ return rankA - rankB;
89
+ });
90
+ // Check topmost (highest layer rank) first
91
+ for (let i = candidates.length - 1; i >= 0; i--) {
92
+ const obj = candidates[i];
93
+ if (pointInBounds(point, obj.bounds)) {
94
+ return {
95
+ id: obj.id,
96
+ kind: obj.kind,
97
+ layer: obj.layer,
98
+ bounds: obj.bounds,
99
+ };
100
+ }
101
+ }
102
+ return undefined;
103
+ }
104
+ /**
105
+ * Compute the union bounds of a selection of runtime objects.
106
+ * Missing ids are ignored. Returns `undefined` if no ids resolve.
107
+ */
108
+ function getRuntimeSelectionBounds(adapter, ids) {
109
+ let minX = Number.POSITIVE_INFINITY;
110
+ let minY = Number.POSITIVE_INFINITY;
111
+ let maxX = Number.NEGATIVE_INFINITY;
112
+ let maxY = Number.NEGATIVE_INFINITY;
113
+ for (const id of ids) {
114
+ const obj = adapter.getObject(id);
115
+ if (!obj?.present)
116
+ continue;
117
+ const b = obj.bounds;
118
+ minX = Math.min(minX, b.minX);
119
+ minY = Math.min(minY, b.minY);
120
+ maxX = Math.max(maxX, b.minX + b.width);
121
+ maxY = Math.max(maxY, b.minY + b.height);
122
+ }
123
+ if (!Number.isFinite(minX))
124
+ return undefined;
125
+ return {
126
+ minX,
127
+ minY,
128
+ width: maxX - minX,
129
+ height: maxY - minY,
130
+ };
131
+ }
132
+ function pointInBounds(point, bounds) {
133
+ return (point.x >= bounds.minX &&
134
+ point.x <= bounds.minX + bounds.width &&
135
+ point.y >= bounds.minY &&
136
+ point.y <= bounds.minY + bounds.height);
137
+ }
138
+ /** Compute screen-space bounds for a connector route. */
139
+ function getConnectionBounds(route, bundle) {
140
+ const layout = resolveLayoutForBounds(bundle);
141
+ let minRawX = Number.POSITIVE_INFINITY;
142
+ let minRawY = Number.POSITIVE_INFINITY;
143
+ let maxRawX = Number.NEGATIVE_INFINITY;
144
+ let maxRawY = Number.NEGATIVE_INFINITY;
145
+ for (const [x, y] of route) {
146
+ const { rawX, rawY } = projectToRaw(x, y, layout.cellSize);
147
+ minRawX = Math.min(minRawX, rawX);
148
+ minRawY = Math.min(minRawY, rawY);
149
+ maxRawX = Math.max(maxRawX, rawX);
150
+ maxRawY = Math.max(maxRawY, rawY);
151
+ }
152
+ const offsetX = -layout.selectedBounds.minX + layout.padding.x;
153
+ const offsetY = -layout.selectedBounds.minY + layout.padding.y;
154
+ return {
155
+ minX: minRawX + offsetX,
156
+ minY: minRawY + offsetY,
157
+ width: maxRawX - minRawX,
158
+ height: maxRawY - minRawY,
159
+ };
160
+ }
161
+ // Lightweight re-computation of the layout values needed for bounds projection.
162
+ function resolveLayoutForBounds(bundle) {
163
+ const cellSize = bundle.grid.cellSize;
164
+ const padding = bundle.layout.padding;
165
+ // Reproduce content bounds calculation
166
+ let cMinX = Number.POSITIVE_INFINITY;
167
+ let cMinY = Number.POSITIVE_INFINITY;
168
+ let cMaxX = Number.NEGATIVE_INFINITY;
169
+ let cMaxY = Number.NEGATIVE_INFINITY;
170
+ for (const stop of bundle.scenes) {
171
+ for (const el of stop.elements ?? []) {
172
+ if (el.presence === "removed")
173
+ continue;
174
+ const { rawX, rawY } = projectToRaw(el.pos[0] + el.size, el.pos[1] + el.size, cellSize);
175
+ const visualSize = cellSize * el.size;
176
+ const anchor = bundle.assets?.[el.asset]?.anchor ?? [0.5, 1];
177
+ cMinX = Math.min(cMinX, rawX - visualSize * anchor[0]);
178
+ cMinY = Math.min(cMinY, rawY - visualSize * anchor[1]);
179
+ cMaxX = Math.max(cMaxX, rawX + visualSize * (1 - anchor[0]));
180
+ cMaxY = Math.max(cMaxY, rawY + visualSize * (1 - anchor[1]));
181
+ }
182
+ for (const conn of stop.connectors ?? []) {
183
+ if (conn.presence === "removed")
184
+ continue;
185
+ for (const [x, y] of conn.route) {
186
+ const { rawX, rawY } = projectToRaw(x, y, cellSize);
187
+ cMinX = Math.min(cMinX, rawX);
188
+ cMinY = Math.min(cMinY, rawY);
189
+ cMaxX = Math.max(cMaxX, rawX);
190
+ cMaxY = Math.max(cMaxY, rawY);
191
+ }
192
+ }
193
+ }
194
+ if (!Number.isFinite(cMinX)) {
195
+ cMinX = 0;
196
+ cMinY = 0;
197
+ cMaxX = cellSize;
198
+ cMaxY = cellSize;
199
+ }
200
+ // Floor bounds
201
+ const [ox, oy] = bundle.floor.origin;
202
+ const [fw, fh] = bundle.floor.size;
203
+ const floorPoints = [
204
+ [ox, oy],
205
+ [ox + fw, oy],
206
+ [ox, oy + fh],
207
+ [ox + fw, oy + fh],
208
+ ];
209
+ let fMinX = Number.POSITIVE_INFINITY;
210
+ let fMinY = Number.POSITIVE_INFINITY;
211
+ let fMaxX = Number.NEGATIVE_INFINITY;
212
+ let fMaxY = Number.NEGATIVE_INFINITY;
213
+ for (const [x, y] of floorPoints) {
214
+ const { rawX, rawY } = projectToRaw(x, y, cellSize);
215
+ fMinX = Math.min(fMinX, rawX);
216
+ fMinY = Math.min(fMinY, rawY);
217
+ fMaxX = Math.max(fMaxX, rawX);
218
+ fMaxY = Math.max(fMaxY, rawY);
219
+ }
220
+ // Select bounds
221
+ let sMinX;
222
+ let sMinY;
223
+ let sMaxX;
224
+ let sMaxY;
225
+ const mode = bundle.layout.bounds;
226
+ if (mode === "content") {
227
+ sMinX = cMinX;
228
+ sMinY = cMinY;
229
+ sMaxX = cMaxX;
230
+ sMaxY = cMaxY;
231
+ }
232
+ else if (mode === "floor") {
233
+ sMinX = fMinX;
234
+ sMinY = fMinY;
235
+ sMaxX = fMaxX;
236
+ sMaxY = fMaxY;
237
+ }
238
+ else {
239
+ sMinX = Math.min(cMinX, fMinX);
240
+ sMinY = Math.min(cMinY, fMinY);
241
+ sMaxX = Math.max(cMaxX, fMaxX);
242
+ sMaxY = Math.max(cMaxY, fMaxY);
243
+ }
244
+ return {
245
+ cellSize,
246
+ padding,
247
+ selectedBounds: { minX: sMinX, minY: sMinY, maxX: sMaxX, maxY: sMaxY },
248
+ };
249
+ }
250
+
251
+ /**
252
+ * Create an editor runtime adapter around an already mounted scene.
253
+ * The adapter does not mutate the mounted scene or create editor UI.
254
+ */
255
+ function createEditorRuntimeAdapter(mounted) {
256
+ const bundle = mounted.engine.bundle;
257
+ if (!bundle) {
258
+ throw new Error("EditorRuntimeAdapter requires an initialized mounted scene");
259
+ }
260
+ // Cache layer order since it is static for the bundle
261
+ const layerOrder = bundle.layers
262
+ .map((layer) => ({ name: layer.name, order: layer.order }))
263
+ .sort((a, b) => a.order - b.order || a.name.localeCompare(b.name));
264
+ return {
265
+ mounted,
266
+ setActiveScene(sceneId) {
267
+ const scene = bundle.scenes.find((candidate) => candidate.id === sceneId);
268
+ if (!scene)
269
+ return false;
270
+ mounted.engine.setProgress(scene.progress);
271
+ applyEditorFrame(mounted);
272
+ return true;
273
+ },
274
+ getObjects(sceneId) {
275
+ const currentState = mounted.engine.getCurrentState();
276
+ if (!currentState || currentState.id !== sceneId)
277
+ return [];
278
+ const result = [];
279
+ // Elements from current engine frame
280
+ for (const update of mounted.engine.getFrameUpdates()) {
281
+ const bounds = getCurrentElementBounds(mounted.svg, update.id);
282
+ result.push({
283
+ id: update.id,
284
+ kind: "element",
285
+ sceneId: currentState.id,
286
+ layer: update.layer,
287
+ present: update.lifecycle !== "removed",
288
+ bounds: bounds ?? { minX: 0, minY: 0, width: 0, height: 0 },
289
+ grid: { kind: "element", at: update.pos, size: update.size },
290
+ });
291
+ }
292
+ // Connections from current engine frame
293
+ for (const update of mounted.engine.getConnectorFrameUpdates()) {
294
+ const bounds = getConnectionBounds(update.route, bundle);
295
+ result.push({
296
+ id: update.id,
297
+ kind: "connection",
298
+ sceneId: currentState.id,
299
+ layer: update.layer,
300
+ present: update.lifecycle !== "removed",
301
+ bounds,
302
+ grid: { kind: "connection", route: update.route },
303
+ });
304
+ }
305
+ return result;
306
+ },
307
+ getObject(id) {
308
+ const currentState = mounted.engine.getCurrentState();
309
+ if (!currentState)
310
+ return undefined;
311
+ const elementUpdate = mounted.engine.getElementUpdate(id);
312
+ if (elementUpdate && elementUpdate.asset !== "") {
313
+ const bounds = getCurrentElementBounds(mounted.svg, id);
314
+ return {
315
+ id: elementUpdate.id,
316
+ kind: "element",
317
+ sceneId: currentState.id,
318
+ layer: elementUpdate.layer,
319
+ present: elementUpdate.lifecycle !== "removed",
320
+ bounds: bounds ?? { minX: 0, minY: 0, width: 0, height: 0 },
321
+ grid: { kind: "element", at: elementUpdate.pos, size: elementUpdate.size },
322
+ };
323
+ }
324
+ const connectorUpdate = mounted.engine.getConnectorUpdate(id);
325
+ if (connectorUpdate && connectorUpdate.route.length > 0) {
326
+ const bounds = getConnectionBounds(connectorUpdate.route, bundle);
327
+ return {
328
+ id: connectorUpdate.id,
329
+ kind: "connection",
330
+ sceneId: currentState.id,
331
+ layer: connectorUpdate.layer,
332
+ present: connectorUpdate.lifecycle !== "removed",
333
+ bounds,
334
+ grid: { kind: "connection", route: connectorUpdate.route },
335
+ };
336
+ }
337
+ return undefined;
338
+ },
339
+ getLayerOrder() {
340
+ return layerOrder.slice();
341
+ },
342
+ getResolvedViewBox() {
343
+ return getResolvedViewBox(bundle);
344
+ },
345
+ projectGridPoint(point) {
346
+ return projectGridPoint(bundle, point);
347
+ },
348
+ unprojectScreenPoint(point) {
349
+ return unprojectScreenPoint(bundle, point);
350
+ },
351
+ clientPointToSvgPoint(point) {
352
+ return clientPointToSvgPoint(mounted.svg, point);
353
+ },
354
+ getGridCellPolygon(cell) {
355
+ return getGridCellPolygon(bundle, cell);
356
+ },
357
+ getObjectAtPoint(point, options) {
358
+ return getRuntimeObjectAtPoint(this, point, options);
359
+ },
360
+ getSelectionBounds(ids) {
361
+ return getRuntimeSelectionBounds(this, ids);
362
+ },
363
+ destroy() {
364
+ // Adapter owns no listeners or caches that outlive this call.
365
+ // The editor is responsible for mounted scene cleanup.
366
+ },
367
+ };
368
+ }
369
+ function applyEditorFrame(mounted) {
370
+ const elements = mounted.engine.getFrameUpdates().map((update) => ({
371
+ id: update.id,
372
+ asset: update.asset,
373
+ pos: update.pos,
374
+ size: update.size,
375
+ layer: update.layer,
376
+ presence: update.lifecycle,
377
+ enter: update.entry,
378
+ exit: update.exit,
379
+ ambient: update.ambient,
380
+ text: update.text,
381
+ primitive: update.primitive,
382
+ }));
383
+ const connectors = mounted.engine.getConnectorFrameUpdates().map((update) => ({
384
+ id: update.id,
385
+ route: update.route,
386
+ layer: update.layer,
387
+ presence: update.lifecycle,
388
+ style: update.style,
389
+ start: update.start,
390
+ end: update.end,
391
+ direction: update.direction,
392
+ enter: update.entry,
393
+ exit: update.exit,
394
+ ambient: update.ambient,
395
+ }));
396
+ for (const element of elements) {
397
+ const state = getElementState(mounted.svg, element.id);
398
+ if (!state)
399
+ continue;
400
+ if (element.presence === "removed") {
401
+ state.isHidden = true;
402
+ hideElementAfterExit(state.node);
403
+ }
404
+ else {
405
+ state.isHidden = false;
406
+ unhideElementOnReadd(state.node);
407
+ }
408
+ }
409
+ for (const connector of connectors) {
410
+ const state = getConnectorState(mounted.svg, connector.id);
411
+ if (!state)
412
+ continue;
413
+ if (connector.presence === "removed") {
414
+ state.isHidden = true;
415
+ hideElementAfterExit(state.node);
416
+ }
417
+ else {
418
+ state.isHidden = false;
419
+ unhideElementOnReadd(state.node);
420
+ }
421
+ }
422
+ updateElementTransforms(mounted.svg, elements, connectors);
423
+ }
424
+
425
+ export { clientPointToSvgPoint, createEditorRuntimeAdapter, getGridCellPolygon, getRuntimeObjectAtPoint, getRuntimeSelectionBounds, projectGridPoint, unprojectScreenPoint };
426
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/editor-support/geometry.ts","../../src/editor-support/hit-test.ts","../../src/editor-support/adapter.ts"],"sourcesContent":["import { getResolvedProjectionLayout } from \"../rendering/rendering-engine.ts\";\nimport { RenderError } from \"../types/errors.ts\";\nimport type { RuntimeBundle } from \"../types/runtime-bundle.ts\";\n\n/** Screen-space point in SVG user units. */\nexport interface EditorScreenPoint {\n\tx: number;\n\ty: number;\n}\n\n/** Browser client-space pointer coordinates. */\nexport interface EditorClientPoint {\n\tclientX: number;\n\tclientY: number;\n}\n\n/**\n * Project an isometric grid point into SVG screen coordinates.\n * Uses the same projection, bounds, and padding as the renderer.\n */\nexport function projectGridPoint(bundle: RuntimeBundle, point: [number, number]): EditorScreenPoint {\n\tconst layout = getResolvedProjectionLayout(bundle);\n\tconst rawX = layout.cellSize * (point[0] - point[1]) * 0.5;\n\tconst rawY = layout.cellSize * (point[0] + point[1]) * 0.25;\n\treturn {\n\t\tx: rawX - layout.selectedBounds.minX + layout.padding.x,\n\t\ty: rawY - layout.selectedBounds.minY + layout.padding.y,\n\t};\n}\n\n/**\n * Unproject an SVG screen point back into fractional isometric grid coordinates.\n * The editor owns snap-to-grid rounding.\n */\nexport function unprojectScreenPoint(bundle: RuntimeBundle, point: EditorScreenPoint): [number, number] {\n\tconst layout = getResolvedProjectionLayout(bundle);\n\tconst rawX = point.x + layout.selectedBounds.minX - layout.padding.x;\n\tconst rawY = point.y + layout.selectedBounds.minY - layout.padding.y;\n\tconst cellSize = layout.cellSize;\n\tconst gridX = rawX / cellSize + (2 * rawY) / cellSize;\n\tconst gridY = (2 * rawY) / cellSize - rawX / cellSize;\n\treturn [gridX, gridY];\n}\n\n/**\n * Convert browser pointer coordinates into SVG user units using the root SVG\n * screen CTM inverse.\n * @throws {RenderError} `EDITOR_GEOMETRY_UNAVAILABLE` when the CTM is missing or not invertible.\n */\nexport function clientPointToSvgPoint(svg: SVGSVGElement, point: EditorClientPoint): EditorScreenPoint {\n\tconst ctm = svg.getScreenCTM();\n\tif (!ctm) {\n\t\tthrow new RenderError(\"EDITOR_GEOMETRY_UNAVAILABLE\", \"SVG CTM is not available\");\n\t}\n\tlet inverse: DOMMatrix | null = null;\n\ttry {\n\t\tinverse = ctm.inverse();\n\t} catch {\n\t\t// non-invertible matrix\n\t}\n\tif (!inverse) {\n\t\tthrow new RenderError(\"EDITOR_GEOMETRY_UNAVAILABLE\", \"SVG CTM is not invertible\");\n\t}\n\tconst svgPoint = svg.createSVGPoint();\n\tsvgPoint.x = point.clientX;\n\tsvgPoint.y = point.clientY;\n\tconst result = svgPoint.matrixTransform(inverse);\n\treturn { x: result.x, y: result.y };\n}\n\n/**\n * Return the four projected corners of a grid cell in clockwise order.\n */\nexport function getGridCellPolygon(bundle: RuntimeBundle, cell: [number, number]): EditorScreenPoint[] {\n\tconst [x, y] = cell;\n\treturn [\n\t\tprojectGridPoint(bundle, [x, y]),\n\t\tprojectGridPoint(bundle, [x + 1, y]),\n\t\tprojectGridPoint(bundle, [x + 1, y + 1]),\n\t\tprojectGridPoint(bundle, [x, y + 1]),\n\t];\n}\n","import type { ViewBoxRect } from \"../rendering/rendering-engine.ts\";\nimport type { RuntimeBundle } from \"../types/runtime-bundle.ts\";\nimport { projectToRaw } from \"../utils/projection.ts\";\nimport type { EditorRuntimeAdapter } from \"./adapter.ts\";\nimport type { EditorScreenPoint } from \"./geometry.ts\";\n\nexport interface HitTestOptions {\n\tincludeHidden?: boolean;\n\tincludeLocked?: boolean;\n\tkinds?: Array<\"element\" | \"connection\">;\n}\n\nexport interface RuntimeObjectHit {\n\tid: string;\n\tkind: \"element\" | \"connection\";\n\tlayer: string;\n\tbounds: ViewBoxRect;\n}\n\n/**\n * Find the topmost runtime object at a screen point.\n * Hit testing follows the current rendered depth order so the visually\n * topmost object wins.\n */\nexport function getRuntimeObjectAtPoint(\n\tadapter: EditorRuntimeAdapter,\n\tpoint: EditorScreenPoint,\n\toptions: HitTestOptions = {},\n): RuntimeObjectHit | undefined {\n\tconst kinds = options.kinds ?? [\"element\", \"connection\"];\n\tconst currentScene = adapter.mounted.engine.getCurrentState();\n\tif (!currentScene) return undefined;\n\n\tconst objects = adapter.getObjects(currentScene.id);\n\tconst layerOrder = adapter.getLayerOrder();\n\tconst layerRank = new Map(layerOrder.map((l, i) => [l.name, i]));\n\n\tconst candidates = objects\n\t\t.filter((obj) => kinds.includes(obj.kind))\n\t\t.filter((obj) => options.includeHidden || obj.present)\n\t\t.sort((a, b) => {\n\t\t\tconst rankA = layerRank.get(a.layer) ?? -1;\n\t\t\tconst rankB = layerRank.get(b.layer) ?? -1;\n\t\t\treturn rankA - rankB;\n\t\t});\n\n\t// Check topmost (highest layer rank) first\n\tfor (let i = candidates.length - 1; i >= 0; i--) {\n\t\tconst obj = candidates[i];\n\t\tif (pointInBounds(point, obj.bounds)) {\n\t\t\treturn {\n\t\t\t\tid: obj.id,\n\t\t\t\tkind: obj.kind,\n\t\t\t\tlayer: obj.layer,\n\t\t\t\tbounds: obj.bounds,\n\t\t\t};\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * Compute the union bounds of a selection of runtime objects.\n * Missing ids are ignored. Returns `undefined` if no ids resolve.\n */\nexport function getRuntimeSelectionBounds(adapter: EditorRuntimeAdapter, ids: string[]): ViewBoxRect | undefined {\n\tlet minX = Number.POSITIVE_INFINITY;\n\tlet minY = Number.POSITIVE_INFINITY;\n\tlet maxX = Number.NEGATIVE_INFINITY;\n\tlet maxY = Number.NEGATIVE_INFINITY;\n\n\tfor (const id of ids) {\n\t\tconst obj = adapter.getObject(id);\n\t\tif (!obj?.present) continue;\n\t\tconst b = obj.bounds;\n\t\tminX = Math.min(minX, b.minX);\n\t\tminY = Math.min(minY, b.minY);\n\t\tmaxX = Math.max(maxX, b.minX + b.width);\n\t\tmaxY = Math.max(maxY, b.minY + b.height);\n\t}\n\n\tif (!Number.isFinite(minX)) return undefined;\n\n\treturn {\n\t\tminX,\n\t\tminY,\n\t\twidth: maxX - minX,\n\t\theight: maxY - minY,\n\t};\n}\n\nfunction pointInBounds(\n\tpoint: EditorScreenPoint,\n\tbounds: { minX: number; minY: number; width: number; height: number },\n): boolean {\n\treturn (\n\t\tpoint.x >= bounds.minX &&\n\t\tpoint.x <= bounds.minX + bounds.width &&\n\t\tpoint.y >= bounds.minY &&\n\t\tpoint.y <= bounds.minY + bounds.height\n\t);\n}\n\n/** Compute screen-space bounds for a connector route. */\nexport function getConnectionBounds(route: [number, number][], bundle: RuntimeBundle): ViewBoxRect {\n\tconst layout = resolveLayoutForBounds(bundle);\n\tlet minRawX = Number.POSITIVE_INFINITY;\n\tlet minRawY = Number.POSITIVE_INFINITY;\n\tlet maxRawX = Number.NEGATIVE_INFINITY;\n\tlet maxRawY = Number.NEGATIVE_INFINITY;\n\n\tfor (const [x, y] of route) {\n\t\tconst { rawX, rawY } = projectToRaw(x, y, layout.cellSize);\n\t\tminRawX = Math.min(minRawX, rawX);\n\t\tminRawY = Math.min(minRawY, rawY);\n\t\tmaxRawX = Math.max(maxRawX, rawX);\n\t\tmaxRawY = Math.max(maxRawY, rawY);\n\t}\n\n\tconst offsetX = -layout.selectedBounds.minX + layout.padding.x;\n\tconst offsetY = -layout.selectedBounds.minY + layout.padding.y;\n\n\treturn {\n\t\tminX: minRawX + offsetX,\n\t\tminY: minRawY + offsetY,\n\t\twidth: maxRawX - minRawX,\n\t\theight: maxRawY - minRawY,\n\t};\n}\n\n// Lightweight re-computation of the layout values needed for bounds projection.\nfunction resolveLayoutForBounds(bundle: RuntimeBundle): {\n\tcellSize: number;\n\tpadding: { x: number; y: number };\n\tselectedBounds: { minX: number; minY: number; maxX: number; maxY: number };\n} {\n\tconst cellSize = bundle.grid.cellSize;\n\tconst padding = bundle.layout.padding;\n\n\t// Reproduce content bounds calculation\n\tlet cMinX = Number.POSITIVE_INFINITY;\n\tlet cMinY = Number.POSITIVE_INFINITY;\n\tlet cMaxX = Number.NEGATIVE_INFINITY;\n\tlet cMaxY = Number.NEGATIVE_INFINITY;\n\n\tfor (const stop of bundle.scenes) {\n\t\tfor (const el of stop.elements ?? []) {\n\t\t\tif (el.presence === \"removed\") continue;\n\t\t\tconst { rawX, rawY } = projectToRaw(el.pos[0] + el.size, el.pos[1] + el.size, cellSize);\n\t\t\tconst visualSize = cellSize * el.size;\n\t\t\tconst anchor = bundle.assets?.[el.asset]?.anchor ?? [0.5, 1];\n\t\t\tcMinX = Math.min(cMinX, rawX - visualSize * anchor[0]);\n\t\t\tcMinY = Math.min(cMinY, rawY - visualSize * anchor[1]);\n\t\t\tcMaxX = Math.max(cMaxX, rawX + visualSize * (1 - anchor[0]));\n\t\t\tcMaxY = Math.max(cMaxY, rawY + visualSize * (1 - anchor[1]));\n\t\t}\n\t\tfor (const conn of stop.connectors ?? []) {\n\t\t\tif (conn.presence === \"removed\") continue;\n\t\t\tfor (const [x, y] of conn.route) {\n\t\t\t\tconst { rawX, rawY } = projectToRaw(x, y, cellSize);\n\t\t\t\tcMinX = Math.min(cMinX, rawX);\n\t\t\t\tcMinY = Math.min(cMinY, rawY);\n\t\t\t\tcMaxX = Math.max(cMaxX, rawX);\n\t\t\t\tcMaxY = Math.max(cMaxY, rawY);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!Number.isFinite(cMinX)) {\n\t\tcMinX = 0;\n\t\tcMinY = 0;\n\t\tcMaxX = cellSize;\n\t\tcMaxY = cellSize;\n\t}\n\n\t// Floor bounds\n\tconst [ox, oy] = bundle.floor.origin;\n\tconst [fw, fh] = bundle.floor.size;\n\tconst floorPoints: Array<[number, number]> = [\n\t\t[ox, oy],\n\t\t[ox + fw, oy],\n\t\t[ox, oy + fh],\n\t\t[ox + fw, oy + fh],\n\t];\n\tlet fMinX = Number.POSITIVE_INFINITY;\n\tlet fMinY = Number.POSITIVE_INFINITY;\n\tlet fMaxX = Number.NEGATIVE_INFINITY;\n\tlet fMaxY = Number.NEGATIVE_INFINITY;\n\tfor (const [x, y] of floorPoints) {\n\t\tconst { rawX, rawY } = projectToRaw(x, y, cellSize);\n\t\tfMinX = Math.min(fMinX, rawX);\n\t\tfMinY = Math.min(fMinY, rawY);\n\t\tfMaxX = Math.max(fMaxX, rawX);\n\t\tfMaxY = Math.max(fMaxY, rawY);\n\t}\n\n\t// Select bounds\n\tlet sMinX: number;\n\tlet sMinY: number;\n\tlet sMaxX: number;\n\tlet sMaxY: number;\n\tconst mode = bundle.layout.bounds;\n\tif (mode === \"content\") {\n\t\tsMinX = cMinX;\n\t\tsMinY = cMinY;\n\t\tsMaxX = cMaxX;\n\t\tsMaxY = cMaxY;\n\t} else if (mode === \"floor\") {\n\t\tsMinX = fMinX;\n\t\tsMinY = fMinY;\n\t\tsMaxX = fMaxX;\n\t\tsMaxY = fMaxY;\n\t} else {\n\t\tsMinX = Math.min(cMinX, fMinX);\n\t\tsMinY = Math.min(cMinY, fMinY);\n\t\tsMaxX = Math.max(cMaxX, fMaxX);\n\t\tsMaxY = Math.max(cMaxY, fMaxY);\n\t}\n\n\treturn {\n\t\tcellSize,\n\t\tpadding,\n\t\tselectedBounds: { minX: sMinX, minY: sMinY, maxX: sMaxX, maxY: sMaxY },\n\t};\n}\n","import {\n\tgetConnectorState,\n\tgetCurrentElementBounds,\n\tgetElementState,\n\tgetResolvedViewBox,\n\thideElementAfterExit,\n\tunhideElementOnReadd,\n\tupdateElementTransforms,\n\ttype ViewBoxRect,\n} from \"../rendering/rendering-engine.ts\";\nimport type { MountedScene } from \"../runtime/mount-scene.ts\";\nimport type { RuntimeConnectorState, RuntimeElementState } from \"../types/node.ts\";\nimport type { EditorClientPoint, EditorScreenPoint } from \"./geometry.ts\";\nimport {\n\tclientPointToSvgPoint as geometryClientPointToSvgPoint,\n\tgetGridCellPolygon as geometryGetGridCellPolygon,\n\tprojectGridPoint as geometryProjectGridPoint,\n\tunprojectScreenPoint as geometryUnprojectScreenPoint,\n} from \"./geometry.ts\";\nimport type { HitTestOptions, RuntimeObjectHit } from \"./hit-test.ts\";\nimport { getConnectionBounds, getRuntimeObjectAtPoint, getRuntimeSelectionBounds } from \"./hit-test.ts\";\n\n/** Metadata for a runtime object as seen by the editor. */\nexport interface RuntimeObjectMetadata {\n\tid: string;\n\tkind: \"element\" | \"connection\";\n\tsceneId: string;\n\tlayer: string;\n\tpresent: boolean;\n\tbounds: ViewBoxRect;\n\tgrid: { kind: \"element\"; at: [number, number]; size: number } | { kind: \"connection\"; route: [number, number][] };\n}\n\n/** Adapter wrapping a mounted scene for editor introspection. */\nexport interface EditorRuntimeAdapter {\n\tmounted: MountedScene;\n\tsetActiveScene(sceneId: string): boolean;\n\tgetObjects(sceneId: string): RuntimeObjectMetadata[];\n\tgetObject(id: string): RuntimeObjectMetadata | undefined;\n\tgetLayerOrder(): Array<{ name: string; order: number }>;\n\tgetResolvedViewBox(): ViewBoxRect;\n\tprojectGridPoint(point: [number, number]): EditorScreenPoint;\n\tunprojectScreenPoint(point: EditorScreenPoint): [number, number];\n\tclientPointToSvgPoint(point: EditorClientPoint): EditorScreenPoint;\n\tgetGridCellPolygon(cell: [number, number]): EditorScreenPoint[];\n\tgetObjectAtPoint(point: EditorScreenPoint, options?: HitTestOptions): RuntimeObjectHit | undefined;\n\tgetSelectionBounds(ids: string[]): ViewBoxRect | undefined;\n\tdestroy(): void;\n}\n\n/**\n * Create an editor runtime adapter around an already mounted scene.\n * The adapter does not mutate the mounted scene or create editor UI.\n */\nexport function createEditorRuntimeAdapter(mounted: MountedScene): EditorRuntimeAdapter {\n\tconst bundle = mounted.engine.bundle;\n\tif (!bundle) {\n\t\tthrow new Error(\"EditorRuntimeAdapter requires an initialized mounted scene\");\n\t}\n\n\t// Cache layer order since it is static for the bundle\n\tconst layerOrder = bundle.layers\n\t\t.map((layer) => ({ name: layer.name, order: layer.order }))\n\t\t.sort((a, b) => a.order - b.order || a.name.localeCompare(b.name));\n\n\treturn {\n\t\tmounted,\n\n\t\tsetActiveScene(sceneId: string): boolean {\n\t\t\tconst scene = bundle.scenes.find((candidate) => candidate.id === sceneId);\n\t\t\tif (!scene) return false;\n\t\t\tmounted.engine.setProgress(scene.progress);\n\t\t\tapplyEditorFrame(mounted);\n\t\t\treturn true;\n\t\t},\n\n\t\tgetObjects(sceneId: string): RuntimeObjectMetadata[] {\n\t\t\tconst currentState = mounted.engine.getCurrentState();\n\t\t\tif (!currentState || currentState.id !== sceneId) return [];\n\n\t\t\tconst result: RuntimeObjectMetadata[] = [];\n\n\t\t\t// Elements from current engine frame\n\t\t\tfor (const update of mounted.engine.getFrameUpdates()) {\n\t\t\t\tconst bounds = getCurrentElementBounds(mounted.svg, update.id);\n\t\t\t\tresult.push({\n\t\t\t\t\tid: update.id,\n\t\t\t\t\tkind: \"element\",\n\t\t\t\t\tsceneId: currentState.id,\n\t\t\t\t\tlayer: update.layer,\n\t\t\t\t\tpresent: update.lifecycle !== \"removed\",\n\t\t\t\t\tbounds: bounds ?? { minX: 0, minY: 0, width: 0, height: 0 },\n\t\t\t\t\tgrid: { kind: \"element\", at: update.pos, size: update.size },\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Connections from current engine frame\n\t\t\tfor (const update of mounted.engine.getConnectorFrameUpdates()) {\n\t\t\t\tconst bounds = getConnectionBounds(update.route, bundle);\n\t\t\t\tresult.push({\n\t\t\t\t\tid: update.id,\n\t\t\t\t\tkind: \"connection\",\n\t\t\t\t\tsceneId: currentState.id,\n\t\t\t\t\tlayer: update.layer,\n\t\t\t\t\tpresent: update.lifecycle !== \"removed\",\n\t\t\t\t\tbounds,\n\t\t\t\t\tgrid: { kind: \"connection\", route: update.route },\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn result;\n\t\t},\n\n\t\tgetObject(id: string): RuntimeObjectMetadata | undefined {\n\t\t\tconst currentState = mounted.engine.getCurrentState();\n\t\t\tif (!currentState) return undefined;\n\n\t\t\tconst elementUpdate = mounted.engine.getElementUpdate(id);\n\t\t\tif (elementUpdate && elementUpdate.asset !== \"\") {\n\t\t\t\tconst bounds = getCurrentElementBounds(mounted.svg, id);\n\t\t\t\treturn {\n\t\t\t\t\tid: elementUpdate.id,\n\t\t\t\t\tkind: \"element\",\n\t\t\t\t\tsceneId: currentState.id,\n\t\t\t\t\tlayer: elementUpdate.layer,\n\t\t\t\t\tpresent: elementUpdate.lifecycle !== \"removed\",\n\t\t\t\t\tbounds: bounds ?? { minX: 0, minY: 0, width: 0, height: 0 },\n\t\t\t\t\tgrid: { kind: \"element\", at: elementUpdate.pos, size: elementUpdate.size },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tconst connectorUpdate = mounted.engine.getConnectorUpdate(id);\n\t\t\tif (connectorUpdate && connectorUpdate.route.length > 0) {\n\t\t\t\tconst bounds = getConnectionBounds(connectorUpdate.route, bundle);\n\t\t\t\treturn {\n\t\t\t\t\tid: connectorUpdate.id,\n\t\t\t\t\tkind: \"connection\",\n\t\t\t\t\tsceneId: currentState.id,\n\t\t\t\t\tlayer: connectorUpdate.layer,\n\t\t\t\t\tpresent: connectorUpdate.lifecycle !== \"removed\",\n\t\t\t\t\tbounds,\n\t\t\t\t\tgrid: { kind: \"connection\", route: connectorUpdate.route },\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t},\n\n\t\tgetLayerOrder() {\n\t\t\treturn layerOrder.slice();\n\t\t},\n\n\t\tgetResolvedViewBox() {\n\t\t\treturn getResolvedViewBox(bundle);\n\t\t},\n\n\t\tprojectGridPoint(point: [number, number]): EditorScreenPoint {\n\t\t\treturn geometryProjectGridPoint(bundle, point);\n\t\t},\n\n\t\tunprojectScreenPoint(point: EditorScreenPoint): [number, number] {\n\t\t\treturn geometryUnprojectScreenPoint(bundle, point);\n\t\t},\n\n\t\tclientPointToSvgPoint(point: EditorClientPoint): EditorScreenPoint {\n\t\t\treturn geometryClientPointToSvgPoint(mounted.svg, point);\n\t\t},\n\n\t\tgetGridCellPolygon(cell: [number, number]): EditorScreenPoint[] {\n\t\t\treturn geometryGetGridCellPolygon(bundle, cell);\n\t\t},\n\n\t\tgetObjectAtPoint(point: EditorScreenPoint, options?: HitTestOptions): RuntimeObjectHit | undefined {\n\t\t\treturn getRuntimeObjectAtPoint(this, point, options);\n\t\t},\n\n\t\tgetSelectionBounds(ids: string[]): ViewBoxRect | undefined {\n\t\t\treturn getRuntimeSelectionBounds(this, ids);\n\t\t},\n\n\t\tdestroy() {\n\t\t\t// Adapter owns no listeners or caches that outlive this call.\n\t\t\t// The editor is responsible for mounted scene cleanup.\n\t\t},\n\t};\n}\n\nfunction applyEditorFrame(mounted: MountedScene): void {\n\tconst elements: RuntimeElementState[] = mounted.engine.getFrameUpdates().map((update) => ({\n\t\tid: update.id,\n\t\tasset: update.asset,\n\t\tpos: update.pos,\n\t\tsize: update.size,\n\t\tlayer: update.layer,\n\t\tpresence: update.lifecycle,\n\t\tenter: update.entry as RuntimeElementState[\"enter\"],\n\t\texit: update.exit as RuntimeElementState[\"exit\"],\n\t\tambient: update.ambient,\n\t\ttext: update.text,\n\t\tprimitive: update.primitive,\n\t}));\n\tconst connectors: RuntimeConnectorState[] = mounted.engine.getConnectorFrameUpdates().map((update) => ({\n\t\tid: update.id,\n\t\troute: update.route,\n\t\tlayer: update.layer,\n\t\tpresence: update.lifecycle,\n\t\tstyle: update.style,\n\t\tstart: update.start,\n\t\tend: update.end,\n\t\tdirection: update.direction,\n\t\tenter: update.entry as RuntimeConnectorState[\"enter\"],\n\t\texit: update.exit as RuntimeConnectorState[\"exit\"],\n\t\tambient: update.ambient,\n\t}));\n\n\tfor (const element of elements) {\n\t\tconst state = getElementState(mounted.svg, element.id);\n\t\tif (!state) continue;\n\t\tif (element.presence === \"removed\") {\n\t\t\tstate.isHidden = true;\n\t\t\thideElementAfterExit(state.node);\n\t\t} else {\n\t\t\tstate.isHidden = false;\n\t\t\tunhideElementOnReadd(state.node);\n\t\t}\n\t}\n\n\tfor (const connector of connectors) {\n\t\tconst state = getConnectorState(mounted.svg, connector.id);\n\t\tif (!state) continue;\n\t\tif (connector.presence === \"removed\") {\n\t\t\tstate.isHidden = true;\n\t\t\thideElementAfterExit(state.node);\n\t\t} else {\n\t\t\tstate.isHidden = false;\n\t\t\tunhideElementOnReadd(state.node);\n\t\t}\n\t}\n\n\tupdateElementTransforms(mounted.svg, elements, connectors);\n}\n"],"names":["geometryProjectGridPoint","geometryUnprojectScreenPoint","geometryClientPointToSvgPoint","geometryGetGridCellPolygon"],"mappings":";;;AAgBA;;;AAGG;AACG,SAAU,gBAAgB,CAAC,MAAqB,EAAE,KAAuB,EAAA;AAC9E,IAAA,MAAM,MAAM,GAAG,2BAA2B,CAAC,MAAM,CAAC;AAClD,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG;AAC1D,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAC3D,OAAO;AACN,QAAA,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,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,IAAI,QAAQ,EAAE;AAC/B,QAAA,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,EAAE,CAAC;AACtD,QAAA,IAAI,CAAC,KAAK;YAAE;AACZ,QAAA,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE;AACnC,YAAA,KAAK,CAAC,QAAQ,GAAG,IAAI;AACrB,YAAA,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC;QACjC;aAAO;AACN,YAAA,KAAK,CAAC,QAAQ,GAAG,KAAK;AACtB,YAAA,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC;QACjC;IACD;AAEA,IAAA,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;AACnC,QAAA,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC;AAC1D,QAAA,IAAI,CAAC,KAAK;YAAE;AACZ,QAAA,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,EAAE;AACrC,YAAA,KAAK,CAAC,QAAQ,GAAG,IAAI;AACrB,YAAA,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC;QACjC;aAAO;AACN,YAAA,KAAK,CAAC,QAAQ,GAAG,KAAK;AACtB,YAAA,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC;QACjC;IACD;IAEA,uBAAuB,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,UAAU,CAAC;AAC3D;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  export { AnimationEngine, type FrameUpdate, type LifecycleKey, } from "./animation/animation-engine.ts";
2
- export type { ControllerConfig, ControllerEvents, } from "./animation/controller.ts";
2
+ export type { CameraGridArea, CameraState, CameraZoomOptions, ControllerConfig, ControllerEvents, } from "./animation/controller.ts";
3
3
  export { AnimationController } from "./animation/controller.ts";
4
4
  export { buildSceneDOM, type RenderConfig, } from "./rendering/rendering-engine.ts";
5
5
  export { applyThemeToElement } from "./rendering/theme.ts";
6
6
  export { type MountedScene, type MountSceneOptions, mountScene, type ResolvedRuntimeConfig, type RuntimeBundle, } from "./runtime/index.ts";
7
7
  export { AssetRegistryImpl, composeTheme, createAssetRegistry, createDefaultRegistry, resolveTheme, } from "./types/asset-registry.ts";
8
8
  export { AnimationError, ControllerError, ParseError, RenderError, ValidationErrorClass, } from "./types/errors.ts";
9
- export type { AmbientAnimation, AssetCatalogEntry, AssetCategory, AssetDefinition, AssetRegistry, CompiledAsset, CompiledFloor, CompiledLayer, CompiledLayout, ElementPatch, ElementPlacement, ElementRemoval, EntryAnimation, ExitAnimation, FloorConfig, GridConfig, LayerDefinition, LayoutBounds, LayoutFit, LifecycleStatus, ResolvedLayoutConfig, RuntimeElementState, RuntimeSceneStop, SceneDocument, SceneHeader, SceneStep, Theme, ValidationError, ValidationReport, ValidationWarning, } from "./types/index.ts";
9
+ export type { AmbientAnimation, AssetCatalogEntry, AssetCategory, AssetDefinition, AssetRegistry, CameraEasing, CameraFocus, CameraTarget, CompiledAsset, CompiledFloor, CompiledLayer, CompiledLayout, ElementPatch, ElementPlacement, ElementRemoval, EntryAnimation, ExitAnimation, FloorConfig, GridConfig, LayerDefinition, LayoutBounds, LayoutFit, LifecycleStatus, ResolvedLayoutConfig, RuntimeElementState, RuntimeSceneStop, SceneDocument, SceneHeader, SceneStep, Theme, ValidationError, ValidationReport, ValidationWarning, } from "./types/index.ts";
10
10
  export { guardEntryAnimation, guardExitAnimation, guardLifecycleStatus, } from "./types/node.ts";
11
11
  export { calculateTransform, calculateVisualSize, DEFAULT_CELL_SIZE, type EasingFn, type EasingType, easeInCubic, easeInOutCubic, easeOutCubic, linear, projectToScreen, resolveEasing, } from "./utils/index.ts";
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,KAA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ACN,eAAe,EACf,aAAa,GACb,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,KAAK,WAAW,EAChB,KAAK,YAAY,GACjB,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACX,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACN,aAAa,EACb,KAAK,YAAY,GACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,UAAU,EACV,KAAK,qBAAqB,EAC1B,KAAK,aAAa,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,GACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,cAAc,EACd,eAAe,EACf,UAAU,EACV,WAAW,EACX,oBAAoB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACX,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,YAAY,EACZ,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,SAAS,EACT,KAAK,EACL,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,WAAW,EACX,cAAc,EACd,YAAY,EACZ,MAAM,EACN,eAAe,EACf,aAAa,GACb,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
- export { A as AnimationController, a as AnimationEngine, b as AssetRegistryImpl, D as DEFAULT_CELL_SIZE, c as applyThemeToElement, d as buildSceneDOM, e as calculateTransform, f as calculateVisualSize, g as composeTheme, h as createAssetRegistry, i as createDefaultRegistry, j as easeInCubic, k as easeInOutCubic, l as easeOutCubic, m as linear, n as mountScene, p as projectToScreen, r as resolveEasing, o as resolveTheme } from './chunks/index-DEv2-G9F.js';
1
+ export { A as AnimationController, a as AnimationEngine, e as easeInCubic, b as easeInOutCubic, c as easeOutCubic, l as linear, m as mountScene, r as resolveEasing } from './chunks/index-B6HlPnov.js';
2
+ export { A as AssetRegistryImpl, D as DEFAULT_CELL_SIZE, c as applyThemeToElement, d as buildSceneDOM, e as calculateTransform, f as calculateVisualSize, g as composeTheme, h as createAssetRegistry, i as createDefaultRegistry, r as projectToScreen, s as resolveTheme } from './chunks/rendering-engine-BgHel7yX.js';
2
3
  export { A as AnimationError, C as ControllerError, P as ParseError, R as RenderError, V as ValidationErrorClass } from './chunks/errors-DyqEkrm5.js';
4
+ import './chunks/sha256-4JuurR-b.js';
3
5
 
4
6
  /** Runtime set of valid entry animation strings */
5
7
  const ENTRY_ANIMATIONS = new Set([