@sebastianwessel/isostate 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/isostate.runtime.js +4 -4
- package/dist/browser/isostate.runtime.js.map +7 -6
- package/dist/chunks/{index-DoyWxJDm.js → index-C3qcXbPI.js} +6 -1145
- package/dist/chunks/index-C3qcXbPI.js.map +1 -0
- package/dist/chunks/rendering-engine-BUUV3Qq-.js +1124 -0
- package/dist/chunks/rendering-engine-BUUV3Qq-.js.map +1 -0
- package/dist/chunks/scene-parser-B9SPDLYs.js +2688 -0
- package/dist/chunks/scene-parser-B9SPDLYs.js.map +1 -0
- package/dist/chunks/sha256-4JuurR-b.js +69 -0
- package/dist/chunks/sha256-4JuurR-b.js.map +1 -0
- package/dist/dsl/browser.d.ts +7 -0
- package/dist/dsl/browser.d.ts.map +1 -0
- package/dist/dsl/browser.js +5 -0
- package/dist/dsl/browser.js.map +1 -0
- package/dist/dsl/compiler.d.ts.map +1 -1
- package/dist/dsl/index.js +4 -2299
- package/dist/dsl/index.js.map +1 -1
- package/dist/dsl/scene-parser.d.ts.map +1 -1
- package/dist/dsl/scene-validator.d.ts.map +1 -1
- package/dist/editor-support/adapter.d.ts +47 -0
- package/dist/editor-support/adapter.d.ts.map +1 -0
- package/dist/editor-support/geometry.d.ts +32 -0
- package/dist/editor-support/geometry.d.ts.map +1 -0
- package/dist/editor-support/hit-test.d.ts +29 -0
- package/dist/editor-support/hit-test.d.ts.map +1 -0
- package/dist/editor-support/index.d.ts +7 -0
- package/dist/editor-support/index.d.ts.map +1 -0
- package/dist/editor-support/index.js +429 -0
- package/dist/editor-support/index.js.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/rendering/asset-node.d.ts +2 -1
- package/dist/rendering/asset-node.d.ts.map +1 -1
- package/dist/rendering/rendering-engine.d.ts +13 -0
- package/dist/rendering/rendering-engine.d.ts.map +1 -1
- package/dist/runtime/index.js +3 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/mount-scene.d.ts.map +1 -1
- package/dist/types/assets.d.ts +27 -2
- package/dist/types/assets.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/node.d.ts +15 -2
- package/dist/types/node.d.ts.map +1 -1
- package/dist/types/runtime-bundle.d.ts +5 -0
- package/dist/types/runtime-bundle.d.ts.map +1 -1
- package/dist/types/scene.d.ts +25 -2
- package/dist/types/scene.d.ts.map +1 -1
- package/dist/types/validation.d.ts +6 -0
- package/dist/types/validation.d.ts.map +1 -1
- package/dist/utils/sha256.d.ts +3 -0
- package/dist/utils/sha256.d.ts.map +1 -0
- package/package.json +9 -1
- package/dist/chunks/index-DoyWxJDm.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,429 @@
|
|
|
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-BUUV3Qq-.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
|
+
this.setProgress(scene.progress);
|
|
271
|
+
return true;
|
|
272
|
+
},
|
|
273
|
+
setProgress(progress) {
|
|
274
|
+
mounted.engine.setProgress(progress);
|
|
275
|
+
applyEditorFrame(mounted);
|
|
276
|
+
},
|
|
277
|
+
getObjects(sceneId) {
|
|
278
|
+
const currentState = mounted.engine.getCurrentState();
|
|
279
|
+
if (!currentState || currentState.id !== sceneId)
|
|
280
|
+
return [];
|
|
281
|
+
const result = [];
|
|
282
|
+
// Elements from current engine frame
|
|
283
|
+
for (const update of mounted.engine.getFrameUpdates()) {
|
|
284
|
+
const bounds = getCurrentElementBounds(mounted.svg, update.id);
|
|
285
|
+
result.push({
|
|
286
|
+
id: update.id,
|
|
287
|
+
kind: "element",
|
|
288
|
+
sceneId: currentState.id,
|
|
289
|
+
layer: update.layer,
|
|
290
|
+
present: update.lifecycle !== "removed",
|
|
291
|
+
bounds: bounds ?? { minX: 0, minY: 0, width: 0, height: 0 },
|
|
292
|
+
grid: { kind: "element", at: update.pos, size: update.size },
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
// Connections from current engine frame
|
|
296
|
+
for (const update of mounted.engine.getConnectorFrameUpdates()) {
|
|
297
|
+
const bounds = getConnectionBounds(update.route, bundle);
|
|
298
|
+
result.push({
|
|
299
|
+
id: update.id,
|
|
300
|
+
kind: "connection",
|
|
301
|
+
sceneId: currentState.id,
|
|
302
|
+
layer: update.layer,
|
|
303
|
+
present: update.lifecycle !== "removed",
|
|
304
|
+
bounds,
|
|
305
|
+
grid: { kind: "connection", route: update.route },
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
return result;
|
|
309
|
+
},
|
|
310
|
+
getObject(id) {
|
|
311
|
+
const currentState = mounted.engine.getCurrentState();
|
|
312
|
+
if (!currentState)
|
|
313
|
+
return undefined;
|
|
314
|
+
const elementUpdate = mounted.engine.getElementUpdate(id);
|
|
315
|
+
if (elementUpdate && elementUpdate.asset !== "") {
|
|
316
|
+
const bounds = getCurrentElementBounds(mounted.svg, id);
|
|
317
|
+
return {
|
|
318
|
+
id: elementUpdate.id,
|
|
319
|
+
kind: "element",
|
|
320
|
+
sceneId: currentState.id,
|
|
321
|
+
layer: elementUpdate.layer,
|
|
322
|
+
present: elementUpdate.lifecycle !== "removed",
|
|
323
|
+
bounds: bounds ?? { minX: 0, minY: 0, width: 0, height: 0 },
|
|
324
|
+
grid: { kind: "element", at: elementUpdate.pos, size: elementUpdate.size },
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
const connectorUpdate = mounted.engine.getConnectorUpdate(id);
|
|
328
|
+
if (connectorUpdate && connectorUpdate.route.length > 0) {
|
|
329
|
+
const bounds = getConnectionBounds(connectorUpdate.route, bundle);
|
|
330
|
+
return {
|
|
331
|
+
id: connectorUpdate.id,
|
|
332
|
+
kind: "connection",
|
|
333
|
+
sceneId: currentState.id,
|
|
334
|
+
layer: connectorUpdate.layer,
|
|
335
|
+
present: connectorUpdate.lifecycle !== "removed",
|
|
336
|
+
bounds,
|
|
337
|
+
grid: { kind: "connection", route: connectorUpdate.route },
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
return undefined;
|
|
341
|
+
},
|
|
342
|
+
getLayerOrder() {
|
|
343
|
+
return layerOrder.slice();
|
|
344
|
+
},
|
|
345
|
+
getResolvedViewBox() {
|
|
346
|
+
return getResolvedViewBox(bundle);
|
|
347
|
+
},
|
|
348
|
+
projectGridPoint(point) {
|
|
349
|
+
return projectGridPoint(bundle, point);
|
|
350
|
+
},
|
|
351
|
+
unprojectScreenPoint(point) {
|
|
352
|
+
return unprojectScreenPoint(bundle, point);
|
|
353
|
+
},
|
|
354
|
+
clientPointToSvgPoint(point) {
|
|
355
|
+
return clientPointToSvgPoint(mounted.svg, point);
|
|
356
|
+
},
|
|
357
|
+
getGridCellPolygon(cell) {
|
|
358
|
+
return getGridCellPolygon(bundle, cell);
|
|
359
|
+
},
|
|
360
|
+
getObjectAtPoint(point, options) {
|
|
361
|
+
return getRuntimeObjectAtPoint(this, point, options);
|
|
362
|
+
},
|
|
363
|
+
getSelectionBounds(ids) {
|
|
364
|
+
return getRuntimeSelectionBounds(this, ids);
|
|
365
|
+
},
|
|
366
|
+
destroy() {
|
|
367
|
+
// Adapter owns no listeners or caches that outlive this call.
|
|
368
|
+
// The editor is responsible for mounted scene cleanup.
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
function applyEditorFrame(mounted) {
|
|
373
|
+
const elements = mounted.engine.getFrameUpdates().map((update) => ({
|
|
374
|
+
id: update.id,
|
|
375
|
+
asset: update.asset,
|
|
376
|
+
pos: update.pos,
|
|
377
|
+
size: update.size,
|
|
378
|
+
layer: update.layer,
|
|
379
|
+
presence: update.lifecycle,
|
|
380
|
+
enter: update.entry,
|
|
381
|
+
exit: update.exit,
|
|
382
|
+
ambient: update.ambient,
|
|
383
|
+
text: update.text,
|
|
384
|
+
primitive: update.primitive,
|
|
385
|
+
}));
|
|
386
|
+
const connectors = mounted.engine.getConnectorFrameUpdates().map((update) => ({
|
|
387
|
+
id: update.id,
|
|
388
|
+
route: update.route,
|
|
389
|
+
layer: update.layer,
|
|
390
|
+
presence: update.lifecycle,
|
|
391
|
+
style: update.style,
|
|
392
|
+
start: update.start,
|
|
393
|
+
end: update.end,
|
|
394
|
+
direction: update.direction,
|
|
395
|
+
enter: update.entry,
|
|
396
|
+
exit: update.exit,
|
|
397
|
+
ambient: update.ambient,
|
|
398
|
+
}));
|
|
399
|
+
for (const element of elements) {
|
|
400
|
+
const state = getElementState(mounted.svg, element.id);
|
|
401
|
+
if (!state)
|
|
402
|
+
continue;
|
|
403
|
+
if (element.presence === "removed") {
|
|
404
|
+
state.isHidden = true;
|
|
405
|
+
hideElementAfterExit(state.node);
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
state.isHidden = false;
|
|
409
|
+
unhideElementOnReadd(state.node);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
for (const connector of connectors) {
|
|
413
|
+
const state = getConnectorState(mounted.svg, connector.id);
|
|
414
|
+
if (!state)
|
|
415
|
+
continue;
|
|
416
|
+
if (connector.presence === "removed") {
|
|
417
|
+
state.isHidden = true;
|
|
418
|
+
hideElementAfterExit(state.node);
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
state.isHidden = false;
|
|
422
|
+
unhideElementOnReadd(state.node);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
updateElementTransforms(mounted.svg, elements, connectors);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export { clientPointToSvgPoint, createEditorRuntimeAdapter, getGridCellPolygon, getRuntimeObjectAtPoint, getRuntimeSelectionBounds, projectGridPoint, unprojectScreenPoint };
|
|
429
|
+
//# 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\tsetProgress(progress: number): void;\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\tthis.setProgress(scene.progress);\n\t\t\treturn true;\n\t\t},\n\n\t\tsetProgress(progress: number): void {\n\t\t\tmounted.engine.setProgress(progress);\n\t\t\tapplyEditorFrame(mounted);\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,cAAc,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AACvD,QAAA,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;KACvD;AACF;AAEA;;;AAGG;AACG,SAAU,oBAAoB,CAAC,MAAqB,EAAE,KAAwB,EAAA;AACnF,IAAA,MAAM,MAAM,GAAG,2BAA2B,CAAC,MAAM,CAAC;AAClD,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;AACpE,IAAA,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,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AAA,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.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
export { A as AnimationController, a as AnimationEngine,
|
|
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-C3qcXbPI.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-BUUV3Qq-.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([
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/types/node.ts"],"sourcesContent":["/** Entry animation types */\nexport type EntryAnimation =\n\t| \"fade-in\"\n\t| \"fade-in-grow\"\n\t| \"fall-in\"\n\t| \"rise-from-ground\"\n\t| \"slide-in-left\"\n\t| \"slide-in-right\"\n\t| \"flip-in\"\n\t| \"none\";\n\n/** Exit animation types */\nexport type ExitAnimation =\n\t| \"fade-out\"\n\t| \"fade-out-shrink\"\n\t| \"fall-through-ground\"\n\t| \"rise-away\"\n\t| \"slide-out-left\"\n\t| \"slide-out-right\"\n\t| \"flip-out\"\n\t| \"none\";\n\n/** Runtime/compiler-derived lifecycle status. Not authored in YAML. */\nexport type LifecycleStatus = \"entering\" | \"present\" | \"exiting\" | \"removed\";\n\n/** Runtime set of valid entry animation strings */\nexport const ENTRY_ANIMATIONS: ReadonlySet<EntryAnimation> = new Set([\n\t\"fade-in\",\n\t\"fade-in-grow\",\n\t\"fall-in\",\n\t\"rise-from-ground\",\n\t\"slide-in-left\",\n\t\"slide-in-right\",\n\t\"flip-in\",\n\t\"none\",\n]);\n\n/** Runtime set of valid exit animation strings */\nexport const EXIT_ANIMATIONS: ReadonlySet<ExitAnimation> = new Set([\n\t\"fade-out\",\n\t\"fade-out-shrink\",\n\t\"fall-through-ground\",\n\t\"rise-away\",\n\t\"slide-out-left\",\n\t\"slide-out-right\",\n\t\"flip-out\",\n\t\"none\",\n]);\n\n/** Runtime set of valid lifecycle status strings */\nexport const LIFECYCLE_STATUSES: ReadonlySet<LifecycleStatus> = new Set([\"entering\", \"present\", \"exiting\", \"removed\"]);\n\n/** Ambient animation configuration */\nexport interface AmbientAnimation {\n\t/** Animation class name */\n\tname: string;\n\t/** Whether the animation runs infinitely (default: true) */\n\tinfinite?: boolean;\n\t/** Number of times to play (only relevant when infinite: false) */\n\titerations?: number;\n}\n\nexport type CameraEasing = \"linear\" | \"ease-in-out\" | \"ease-out\";\n\nexport interface CameraGridArea {\n\tat: [number, number];\n\tsize: [number, number];\n}\n\nexport type CameraTarget = { element: string } | { area: CameraGridArea } | { reset: true };\n\nexport interface CameraFocus {\n\ttarget: CameraTarget;\n\tpadding?: number;\n\tduration?: number;\n\teasing?: CameraEasing;\n}\n\nexport interface CameraZoomOptions {\n\tpadding?: number;\n\tduration?: number;\n\teasing?: CameraEasing;\n}\n\nexport type RuntimeCameraTarget =\n\t| { type: \"element\"; id: string }\n\t| { type: \"area\"; at: [number, number]; size: [number, number] }\n\t| { type: \"reset\" };\n\nexport interface RuntimeCameraFocus {\n\ttarget: RuntimeCameraTarget;\n\tpadding?: number;\n\tduration?: number;\n\teasing?: CameraEasing;\n}\n\n/** Horizontal anchor used by built-in text elements. */\nexport type TextAlign = \"start\" | \"middle\" | \"end\";\n\n/** Content and safe SVG text styling for the built-in `asset: text` element. */\nexport interface TextContent {\n\t/** Text content. Use newline characters for explicit line breaks. */\n\tvalue: string;\n\t/** Horizontal text anchor within the element cell. Defaults to `middle`. */\n\talign?: TextAlign;\n\t/** SVG font-size in CSS pixels before element scaling. Defaults to `12`. */\n\tfontSize?: number;\n\t/** SVG font-weight. Defaults to `700`. */\n\tfontWeight?: number | \"normal\" | \"bold\";\n\t/** Multiplier applied to `fontSize` for multiline spacing. Defaults to `1.2`. */\n\tlineHeight?: number;\n\t/** SVG fill color. Defaults to `currentColor`. */\n\tfill?: string;\n}\n\n/** Built-in generated primitive asset ids. These are not declared in header assets. */\nexport type PrimitiveAssetId = \"rectangle\" | \"circle\" | \"polygon\" | \"line\";\n\n/** Shared safe SVG style fields for generated primitive assets. */\nexport interface PrimitiveStyle {\n\t/** SVG fill color or safe CSS color token. Defaults to `currentColor`. */\n\tfill?: string;\n\t/** SVG stroke color or safe CSS color token. Defaults to `none`. */\n\tstroke?: string;\n\t/** SVG stroke width in CSS pixels before element scaling. Defaults to `0`. */\n\tstrokeWidth?: number;\n\t/** Element opacity from `0` to `1`. Defaults to `1`. */\n\topacity?: number;\n\t/** Optional dash/gap pair for stroked primitives. */\n\tdash?: [number, number];\n}\n\n/** Generated projected rectangle/diamond primitive content. */\nexport interface RectanglePrimitive extends PrimitiveStyle {\n\t/** Optional corner radius for screen-space rectangles. Defaults to `0`. */\n\trx?: number;\n}\n\n/** Generated circle primitive content. */\nexport interface CirclePrimitive extends PrimitiveStyle {}\n\n/** Generated polygon primitive content using normalized local grid coordinates. */\nexport interface PolygonPrimitive extends PrimitiveStyle {\n\t/** Polygon points in local normalized grid coordinates from `0` to `1`. */\n\tpoints: [number, number][];\n}\n\n/** Generated line/polyline primitive content using normalized local grid coordinates. */\nexport interface LinePrimitive extends Omit<PrimitiveStyle, \"fill\"> {\n\t/** Line points in local normalized grid coordinates from `0` to `1`. */\n\tpoints: [number, number][];\n\t/** SVG line cap. Defaults to `round`. */\n\tlineCap?: \"butt\" | \"round\" | \"square\";\n\t/** SVG line join. Defaults to `round`. */\n\tlineJoin?: \"miter\" | \"round\" | \"bevel\";\n}\n\n/** Element-level payload for generated primitive assets. */\nexport interface PrimitiveContent {\n\trectangle?: RectanglePrimitive;\n\tcircle?: CirclePrimitive;\n\tpolygon?: PolygonPrimitive;\n\tline?: LinePrimitive;\n}\n\n/** Element placement used in first-scene elements and later add operations. */\nexport interface ElementPlacement {\n\tid: string;\n\tasset: string;\n\tat: [number, number];\n\tsize?: number;\n\tlayer?: string;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n\ttext?: TextContent;\n\tprimitive?: PrimitiveContent;\n}\n\n/** Element patch used by scene update operations. */\nexport interface ElementPatch {\n\tid: string;\n\tat?: [number, number];\n\tsize?: number;\n\tlayer?: string;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n\ttext?: TextContent;\n\tprimitive?: PrimitiveContent;\n}\n\n/** Element removal used by scene remove operations. */\nexport interface ElementRemoval {\n\tid: string;\n\texit?: ExitAnimation;\n}\n\n/** Visual connector line pattern for authored connections and runtime connectors. */\nexport type ConnectorPattern = \"solid\" | \"dashed\" | \"dotted\";\n\n/** Visual connector geometry variant. */\nexport type ConnectorVariant = \"line\" | \"road\";\n\n/** Generated endpoint indicator placed at the start or end of a connector. */\nexport type ConnectorEndpoint = \"none\" | \"arrow\" | \"dot\" | \"circle\" | \"diamond\" | \"bar\";\n\n/** Direction used for connector endpoint orientation and flow animation. */\nexport type ConnectorDirection = \"route\" | \"reverse\";\n\n/** Authored connector style overrides for a visual connection. */\nexport interface ConnectorStyle {\n\t/** Geometry variant. Defaults to `line`. */\n\tvariant?: ConnectorVariant;\n\t/** Stroke pattern. Defaults to `solid`. */\n\tpattern?: ConnectorPattern;\n\t/** SVG stroke color or safe CSS color token. */\n\tstroke?: string;\n\t/** Stroke width in SVG user units. */\n\tstrokeWidth?: number;\n\t/** Connector opacity from `0` to `1`. */\n\topacity?: number;\n\t/** Explicit dash/gap pair in SVG user units. */\n\tdash?: [number, number];\n\t/** Optional outline stroke color for road connectors. */\n\toutline?: string;\n\t/** Optional outline width in SVG user units. */\n\toutlineWidth?: number;\n\t/** Optional road lane treatment. */\n\tlane?: \"none\" | \"center-dashed\";\n}\n\n/** Authored endpoint reference for compiler-routed visual connections. */\nexport interface ConnectorEndpointRef {\n\t/** Element id to attach to. Mutually exclusive with `at`. */\n\telement?: string;\n\t/** Explicit grid point to attach to. Mutually exclusive with `element`. */\n\tat?: [number, number];\n\t/** Element side or automatic side selection. Defaults to `auto`. */\n\tside?: \"auto\" | \"top\" | \"right\" | \"bottom\" | \"left\" | \"front\" | \"back\";\n\t/** Normalized side offset from `-0.5` to `0.5`. Defaults to `0`. */\n\toffset?: number;\n}\n\n/** Authored routing options used only by dev-time compiler tooling. */\nexport interface ConnectorRouting {\n\t/** Routing mode. Defaults to `orthogonal` for endpoint-routed connections. */\n\tmode?: \"straight\" | \"orthogonal\" | \"manual\";\n\t/** Obstacle avoidance selection. Defaults to `objects`. */\n\tavoid?: \"objects\" | \"none\" | string[];\n\t/** Obstacle clearance in grid cells. Defaults to `0.5`. */\n\tclearance?: number;\n\t/** Router grid step in grid cells. */\n\tgridStep?: number;\n\t/** Maximum allowed bends for advanced routers. */\n\tmaxBends?: number;\n\t/** Route scoring preference for advanced routers. */\n\tprefer?: \"direct\" | \"fewest-bends\" | \"shortest\";\n}\n\n/** Connection placement used in first-scene connections and later add operations. */\nexport interface ConnectionPlacement {\n\tid: string;\n\troute?: [number, number][];\n\tfrom?: ConnectorEndpointRef;\n\tto?: ConnectorEndpointRef;\n\trouting?: ConnectorRouting;\n\tlayer?: string;\n\tstyle?: ConnectorStyle;\n\tstart?: ConnectorEndpoint;\n\tend?: ConnectorEndpoint;\n\tdirection?: ConnectorDirection;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n}\n\n/** Connection patch used by scene update operations. */\nexport interface ConnectionPatch {\n\tid: string;\n\troute?: [number, number][];\n\tfrom?: ConnectorEndpointRef;\n\tto?: ConnectorEndpointRef;\n\trouting?: ConnectorRouting;\n\tlayer?: string;\n\tstyle?: ConnectorStyle;\n\tstart?: ConnectorEndpoint;\n\tend?: ConnectorEndpoint;\n\tdirection?: ConnectorDirection;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n}\n\n/** Connection removal used by scene remove operations. */\nexport interface ConnectionRemoval {\n\tid: string;\n\texit?: ExitAnimation;\n}\n\n/** Fully defaulted connector style emitted to browser runtime snapshots. */\nexport interface RuntimeConnectorStyle {\n\tvariant: ConnectorVariant;\n\tpattern: ConnectorPattern;\n\tstroke: string;\n\tstrokeWidth: number;\n\topacity: number;\n\tdash?: [number, number];\n\toutline?: string;\n\toutlineWidth: number;\n\tlane: \"none\" | \"center-dashed\";\n}\n\n/** Runtime-resolved connector state in a compiled scene stop. */\nexport interface RuntimeConnectorState {\n\tid: string;\n\troute: [number, number][];\n\tlayer: string;\n\tpresence: LifecycleStatus;\n\tstyle: RuntimeConnectorStyle;\n\tstart: ConnectorEndpoint;\n\tend: ConnectorEndpoint;\n\tdirection: ConnectorDirection;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n}\n\n/** Runtime-resolved element state in a compiled scene stop. */\nexport interface RuntimeElementState {\n\tid: string;\n\tasset: string;\n\tpos: [number, number];\n\tsize: number;\n\tlayer: string;\n\tpresence: LifecycleStatus;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n\ttext?: TextContent;\n\tprimitive?: PrimitiveContent;\n}\n\n// ── Type guards ──────────────────────────────────────────────────────────────\n\n/** Narrow a raw string to EntryAnimation. Returns undefined if invalid. */\nexport function guardEntryAnimation(v: unknown): EntryAnimation | undefined {\n\tif (typeof v !== \"string\") return undefined;\n\treturn ENTRY_ANIMATIONS.has(v as EntryAnimation) ? (v as EntryAnimation) : undefined;\n}\n\n/** Narrow a raw string to ExitAnimation. Returns undefined if invalid. */\nexport function guardExitAnimation(v: unknown): ExitAnimation | undefined {\n\tif (typeof v !== \"string\") return undefined;\n\treturn EXIT_ANIMATIONS.has(v as ExitAnimation) ? (v as ExitAnimation) : undefined;\n}\n\n/** Narrow a raw string to LifecycleStatus. Returns undefined if invalid. */\nexport function guardLifecycleStatus(v: unknown): LifecycleStatus | undefined {\n\tif (typeof v !== \"string\") return undefined;\n\treturn LIFECYCLE_STATUSES.has(v as LifecycleStatus) ? (v as LifecycleStatus) : undefined;\n}\n"],"names":[],"mappings":";;;AAyBA;AACO,MAAM,gBAAgB,GAAgC,IAAI,GAAG,CAAC;IACpE,SAAS;IACT,cAAc;IACd,SAAS;IACT,kBAAkB;IAClB,eAAe;IACf,gBAAgB;IAChB,SAAS;IACT,MAAM;AACN,CAAA,CAAC;AAEF;AACO,MAAM,eAAe,GAA+B,IAAI,GAAG,CAAC;IAClE,UAAU;IACV,iBAAiB;IACjB,qBAAqB;IACrB,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,UAAU;IACV,MAAM;AACN,CAAA,CAAC;AAEF;AACO,MAAM,kBAAkB,GAAiC,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAqStH;AAEA;AACM,SAAU,mBAAmB,CAAC,CAAU,EAAA;IAC7C,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,SAAS;AAC3C,IAAA,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAmB,CAAC,GAAI,CAAoB,GAAG,SAAS;AACrF;AAEA;AACM,SAAU,kBAAkB,CAAC,CAAU,EAAA;IAC5C,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,SAAS;AAC3C,IAAA,OAAO,eAAe,CAAC,GAAG,CAAC,CAAkB,CAAC,GAAI,CAAmB,GAAG,SAAS;AAClF;AAEA;AACM,SAAU,oBAAoB,CAAC,CAAU,EAAA;IAC9C,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,SAAS;AAC3C,IAAA,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAoB,CAAC,GAAI,CAAqB,GAAG,SAAS;AACzF;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/types/node.ts"],"sourcesContent":["/** Entry animation types */\nexport type EntryAnimation =\n\t| \"fade-in\"\n\t| \"fade-in-grow\"\n\t| \"fall-in\"\n\t| \"rise-from-ground\"\n\t| \"slide-in-left\"\n\t| \"slide-in-right\"\n\t| \"flip-in\"\n\t| \"none\";\n\n/** Exit animation types */\nexport type ExitAnimation =\n\t| \"fade-out\"\n\t| \"fade-out-shrink\"\n\t| \"fall-through-ground\"\n\t| \"rise-away\"\n\t| \"slide-out-left\"\n\t| \"slide-out-right\"\n\t| \"flip-out\"\n\t| \"none\";\n\n/** Runtime/compiler-derived lifecycle status. Not authored in YAML. */\nexport type LifecycleStatus = \"entering\" | \"present\" | \"exiting\" | \"removed\";\n\n/** Runtime set of valid entry animation strings */\nexport const ENTRY_ANIMATIONS: ReadonlySet<EntryAnimation> = new Set([\n\t\"fade-in\",\n\t\"fade-in-grow\",\n\t\"fall-in\",\n\t\"rise-from-ground\",\n\t\"slide-in-left\",\n\t\"slide-in-right\",\n\t\"flip-in\",\n\t\"none\",\n]);\n\n/** Runtime set of valid exit animation strings */\nexport const EXIT_ANIMATIONS: ReadonlySet<ExitAnimation> = new Set([\n\t\"fade-out\",\n\t\"fade-out-shrink\",\n\t\"fall-through-ground\",\n\t\"rise-away\",\n\t\"slide-out-left\",\n\t\"slide-out-right\",\n\t\"flip-out\",\n\t\"none\",\n]);\n\n/** Runtime set of valid lifecycle status strings */\nexport const LIFECYCLE_STATUSES: ReadonlySet<LifecycleStatus> = new Set([\"entering\", \"present\", \"exiting\", \"removed\"]);\n\n/** Ambient animation configuration */\nexport interface AmbientAnimation {\n\t/** Animation class name */\n\tname: string;\n\t/** Whether the animation runs infinitely (default: true) */\n\tinfinite?: boolean;\n\t/** Number of times to play (only relevant when infinite: false) */\n\titerations?: number;\n}\n\nexport type CameraEasing = \"linear\" | \"ease-in-out\" | \"ease-out\";\n\nexport interface CameraGridArea {\n\tat: [number, number];\n\tsize: [number, number];\n}\n\nexport type CameraTarget = { element: string } | { area: CameraGridArea } | { reset: true };\n\nexport interface CameraFocus {\n\ttarget: CameraTarget;\n\tpadding?: number;\n\tduration?: number;\n\teasing?: CameraEasing;\n}\n\nexport interface CameraZoomOptions {\n\tpadding?: number;\n\tduration?: number;\n\teasing?: CameraEasing;\n}\n\nexport type RuntimeCameraTarget =\n\t| { type: \"element\"; id: string }\n\t| { type: \"area\"; at: [number, number]; size: [number, number] }\n\t| { type: \"reset\" };\n\nexport interface RuntimeCameraFocus {\n\ttarget: RuntimeCameraTarget;\n\tpadding?: number;\n\tduration?: number;\n\teasing?: CameraEasing;\n}\n\n/** Horizontal anchor used by built-in text elements. */\nexport type TextAlign = \"start\" | \"middle\" | \"end\";\n\n/** Vertical placement model used by built-in text elements. */\nexport type TextPlacement = \"cell\" | \"caption\";\n\n/** Content and safe SVG text styling for the built-in `asset: text` element. */\nexport interface TextContent {\n\t/** Text content. Use newline characters for explicit line breaks. */\n\tvalue: string;\n\t/** Horizontal text anchor within the element cell. Defaults to `middle`. */\n\talign?: TextAlign;\n\t/** Vertical placement within the grid cell. Defaults to `cell`; `caption` preserves the legacy floating label. */\n\tplacement?: TextPlacement;\n\t/** SVG font-size in CSS pixels before element scaling. Defaults to `12`. */\n\tfontSize?: number;\n\t/** SVG font-weight. Defaults to `700`. */\n\tfontWeight?: number | \"normal\" | \"bold\";\n\t/** Multiplier applied to `fontSize` for multiline spacing. Defaults to `1.2`. */\n\tlineHeight?: number;\n\t/** SVG fill color. Defaults to `currentColor`. */\n\tfill?: string;\n}\n\n/** Sparse update payload for built-in text content. */\nexport type TextContentPatch = Partial<TextContent>;\n\n/** Built-in generated primitive asset ids. These are not declared in header assets. */\nexport type PrimitiveAssetId = \"rectangle\" | \"circle\" | \"polygon\" | \"line\";\n\n/** Shared safe SVG style fields for generated primitive assets. */\nexport interface PrimitiveStyle {\n\t/** SVG fill color or safe CSS color token. Defaults to `currentColor`. */\n\tfill?: string;\n\t/** SVG stroke color or safe CSS color token. Defaults to `none`. */\n\tstroke?: string;\n\t/** SVG stroke width in CSS pixels before element scaling. Defaults to `0`. */\n\tstrokeWidth?: number;\n\t/** Element opacity from `0` to `1`. Defaults to `1`. */\n\topacity?: number;\n\t/** Optional dash/gap pair for stroked primitives. */\n\tdash?: [number, number];\n}\n\n/** Generated projected rectangle/diamond primitive content. */\nexport interface RectanglePrimitive extends PrimitiveStyle {\n\t/** Optional corner radius for screen-space rectangles. Defaults to `0`. */\n\trx?: number;\n}\n\n/** Generated circle primitive content. */\nexport interface CirclePrimitive extends PrimitiveStyle {}\n\n/** Generated polygon primitive content using normalized local grid coordinates. */\nexport interface PolygonPrimitive extends PrimitiveStyle {\n\t/** Polygon points in local normalized grid coordinates from `0` to `1`. */\n\tpoints: [number, number][];\n}\n\n/** Generated line/polyline primitive content using normalized local grid coordinates. */\nexport interface LinePrimitive extends Omit<PrimitiveStyle, \"fill\"> {\n\t/** Line points in local normalized grid coordinates from `0` to `1`. */\n\tpoints: [number, number][];\n\t/** SVG line cap. Defaults to `round`. */\n\tlineCap?: \"butt\" | \"round\" | \"square\";\n\t/** SVG line join. Defaults to `round`. */\n\tlineJoin?: \"miter\" | \"round\" | \"bevel\";\n}\n\n/** Element-level payload for generated primitive assets. */\nexport interface PrimitiveContent {\n\trectangle?: RectanglePrimitive;\n\tcircle?: CirclePrimitive;\n\tpolygon?: PolygonPrimitive;\n\tline?: LinePrimitive;\n}\n\n/** Sparse update payload for built-in primitive content. */\nexport interface PrimitiveContentPatch {\n\trectangle?: Partial<RectanglePrimitive>;\n\tcircle?: Partial<CirclePrimitive>;\n\tpolygon?: Partial<PolygonPrimitive>;\n\tline?: Partial<LinePrimitive>;\n}\n\n/** Element placement used in first-scene elements and later add operations. */\nexport interface ElementPlacement {\n\tid: string;\n\tasset: string;\n\tat: [number, number];\n\tsize?: number;\n\tlayer?: string;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n\ttext?: TextContent;\n\tprimitive?: PrimitiveContent;\n}\n\n/** Element patch used by scene update operations. */\nexport interface ElementPatch {\n\tid: string;\n\tat?: [number, number];\n\tsize?: number;\n\tlayer?: string;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n\ttext?: TextContentPatch;\n\tprimitive?: PrimitiveContentPatch;\n}\n\n/** Element removal used by scene remove operations. */\nexport interface ElementRemoval {\n\tid: string;\n\texit?: ExitAnimation;\n}\n\n/** Visual connector line pattern for authored connections and runtime connectors. */\nexport type ConnectorPattern = \"solid\" | \"dashed\" | \"dotted\";\n\n/** Visual connector geometry variant. */\nexport type ConnectorVariant = \"line\" | \"road\";\n\n/** Generated endpoint indicator placed at the start or end of a connector. */\nexport type ConnectorEndpoint = \"none\" | \"arrow\" | \"dot\" | \"circle\" | \"diamond\" | \"bar\";\n\n/** Direction used for connector endpoint orientation and flow animation. */\nexport type ConnectorDirection = \"route\" | \"reverse\";\n\n/** Authored connector style overrides for a visual connection. */\nexport interface ConnectorStyle {\n\t/** Geometry variant. Defaults to `line`. */\n\tvariant?: ConnectorVariant;\n\t/** Stroke pattern. Defaults to `solid`. */\n\tpattern?: ConnectorPattern;\n\t/** SVG stroke color or safe CSS color token. */\n\tstroke?: string;\n\t/** Stroke width in SVG user units. */\n\tstrokeWidth?: number;\n\t/** Connector opacity from `0` to `1`. */\n\topacity?: number;\n\t/** Explicit dash/gap pair in SVG user units. */\n\tdash?: [number, number];\n\t/** Optional outline stroke color for road connectors. */\n\toutline?: string;\n\t/** Optional outline width in SVG user units. */\n\toutlineWidth?: number;\n\t/** Optional road lane treatment. */\n\tlane?: \"none\" | \"center-dashed\";\n}\n\n/** Authored endpoint reference for compiler-routed visual connections. */\nexport interface ConnectorEndpointRef {\n\t/** Element id to attach to. Mutually exclusive with `at`. */\n\telement?: string;\n\t/** Explicit grid point to attach to. Mutually exclusive with `element`. */\n\tat?: [number, number];\n\t/** Element side or automatic side selection. Defaults to `auto`. */\n\tside?: \"auto\" | \"top\" | \"right\" | \"bottom\" | \"left\" | \"front\" | \"back\";\n\t/** Normalized side offset from `-0.5` to `0.5`. Defaults to `0`. */\n\toffset?: number;\n}\n\n/** Authored routing options used only by dev-time compiler tooling. */\nexport interface ConnectorRouting {\n\t/** Routing mode. Defaults to `orthogonal` for endpoint-routed connections. */\n\tmode?: \"straight\" | \"orthogonal\" | \"manual\";\n\t/** Obstacle avoidance selection. Defaults to `objects`. */\n\tavoid?: \"objects\" | \"none\" | string[];\n\t/** Obstacle clearance in grid cells. Defaults to `0.5`. */\n\tclearance?: number;\n\t/** Router grid step in grid cells. */\n\tgridStep?: number;\n\t/** Maximum allowed bends for advanced routers. */\n\tmaxBends?: number;\n\t/** Route scoring preference for advanced routers. */\n\tprefer?: \"direct\" | \"fewest-bends\" | \"shortest\";\n}\n\n/** Connection placement used in first-scene connections and later add operations. */\nexport interface ConnectionPlacement {\n\tid: string;\n\troute?: [number, number][];\n\tfrom?: ConnectorEndpointRef;\n\tto?: ConnectorEndpointRef;\n\trouting?: ConnectorRouting;\n\tlayer?: string;\n\tstyle?: ConnectorStyle;\n\tstart?: ConnectorEndpoint;\n\tend?: ConnectorEndpoint;\n\tdirection?: ConnectorDirection;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n}\n\n/** Connection patch used by scene update operations. */\nexport interface ConnectionPatch {\n\tid: string;\n\troute?: [number, number][];\n\tfrom?: ConnectorEndpointRef;\n\tto?: ConnectorEndpointRef;\n\trouting?: ConnectorRouting;\n\tlayer?: string;\n\tstyle?: ConnectorStyle;\n\tstart?: ConnectorEndpoint;\n\tend?: ConnectorEndpoint;\n\tdirection?: ConnectorDirection;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n}\n\n/** Connection removal used by scene remove operations. */\nexport interface ConnectionRemoval {\n\tid: string;\n\texit?: ExitAnimation;\n}\n\n/** Fully defaulted connector style emitted to browser runtime snapshots. */\nexport interface RuntimeConnectorStyle {\n\tvariant: ConnectorVariant;\n\tpattern: ConnectorPattern;\n\tstroke: string;\n\tstrokeWidth: number;\n\topacity: number;\n\tdash?: [number, number];\n\toutline?: string;\n\toutlineWidth: number;\n\tlane: \"none\" | \"center-dashed\";\n}\n\n/** Runtime-resolved connector state in a compiled scene stop. */\nexport interface RuntimeConnectorState {\n\tid: string;\n\troute: [number, number][];\n\tlayer: string;\n\tpresence: LifecycleStatus;\n\tstyle: RuntimeConnectorStyle;\n\tstart: ConnectorEndpoint;\n\tend: ConnectorEndpoint;\n\tdirection: ConnectorDirection;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n}\n\n/** Runtime-resolved element state in a compiled scene stop. */\nexport interface RuntimeElementState {\n\tid: string;\n\tasset: string;\n\tpos: [number, number];\n\tsize: number;\n\tlayer: string;\n\tpresence: LifecycleStatus;\n\tenter?: EntryAnimation;\n\texit?: ExitAnimation;\n\tambient?: AmbientAnimation[];\n\ttext?: TextContent;\n\tprimitive?: PrimitiveContent;\n}\n\n// ── Type guards ──────────────────────────────────────────────────────────────\n\n/** Narrow a raw string to EntryAnimation. Returns undefined if invalid. */\nexport function guardEntryAnimation(v: unknown): EntryAnimation | undefined {\n\tif (typeof v !== \"string\") return undefined;\n\treturn ENTRY_ANIMATIONS.has(v as EntryAnimation) ? (v as EntryAnimation) : undefined;\n}\n\n/** Narrow a raw string to ExitAnimation. Returns undefined if invalid. */\nexport function guardExitAnimation(v: unknown): ExitAnimation | undefined {\n\tif (typeof v !== \"string\") return undefined;\n\treturn EXIT_ANIMATIONS.has(v as ExitAnimation) ? (v as ExitAnimation) : undefined;\n}\n\n/** Narrow a raw string to LifecycleStatus. Returns undefined if invalid. */\nexport function guardLifecycleStatus(v: unknown): LifecycleStatus | undefined {\n\tif (typeof v !== \"string\") return undefined;\n\treturn LIFECYCLE_STATUSES.has(v as LifecycleStatus) ? (v as LifecycleStatus) : undefined;\n}\n"],"names":[],"mappings":";;;;;AAyBA;AACO,MAAM,gBAAgB,GAAgC,IAAI,GAAG,CAAC;IACpE,SAAS;IACT,cAAc;IACd,SAAS;IACT,kBAAkB;IAClB,eAAe;IACf,gBAAgB;IAChB,SAAS;IACT,MAAM;AACN,CAAA,CAAC;AAEF;AACO,MAAM,eAAe,GAA+B,IAAI,GAAG,CAAC;IAClE,UAAU;IACV,iBAAiB;IACjB,qBAAqB;IACrB,WAAW;IACX,gBAAgB;IAChB,iBAAiB;IACjB,UAAU;IACV,MAAM;AACN,CAAA,CAAC;AAEF;AACO,MAAM,kBAAkB,GAAiC,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAqTtH;AAEA;AACM,SAAU,mBAAmB,CAAC,CAAU,EAAA;IAC7C,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,SAAS;AAC3C,IAAA,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAmB,CAAC,GAAI,CAAoB,GAAG,SAAS;AACrF;AAEA;AACM,SAAU,kBAAkB,CAAC,CAAU,EAAA;IAC5C,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,SAAS;AAC3C,IAAA,OAAO,eAAe,CAAC,GAAG,CAAC,CAAkB,CAAC,GAAI,CAAmB,GAAG,SAAS;AAClF;AAEA;AACM,SAAU,oBAAoB,CAAC,CAAU,EAAA;IAC9C,IAAI,OAAO,CAAC,KAAK,QAAQ;AAAE,QAAA,OAAO,SAAS;AAC3C,IAAA,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAoB,CAAC,GAAI,CAAqB,GAAG,SAAS;AACzF;;;;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { PrimitiveContent, TextContent } from "../types/node.ts";
|
|
2
|
-
import type { RuntimeBundle } from "../types/runtime-bundle.ts";
|
|
2
|
+
import type { CompiledSprite, RuntimeBundle } from "../types/runtime-bundle.ts";
|
|
3
3
|
type ResolvedAsset = {
|
|
4
4
|
url: string;
|
|
5
5
|
anchor?: [number, number];
|
|
6
|
+
sprite?: CompiledSprite;
|
|
6
7
|
};
|
|
7
8
|
export type AssetResolver = (name: string) => ResolvedAsset | undefined;
|
|
8
9
|
export declare function createAssetResolver(bundle?: RuntimeBundle): AssetResolver;
|