@chanmeng666/archlang-3d 0.0.0-stage → 0.1.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.
@@ -0,0 +1,495 @@
1
+ import {
2
+ ARCHLANG_3D_VERSION,
3
+ validateScene3D
4
+ } from "./chunk-IQJQDQSC.js";
5
+ import {
6
+ PREVIEW_LABEL,
7
+ replayPayload
8
+ } from "./chunk-54YVSAVZ.js";
9
+ import {
10
+ keyFrames
11
+ } from "./chunk-CTFMM64C.js";
12
+
13
+ // src/node.ts
14
+ import { readFileSync as readFileSync2 } from "node:fs";
15
+ import { resolve } from "node:path";
16
+
17
+ // src/replay/html.ts
18
+ import { existsSync, readFileSync } from "node:fs";
19
+ import { createRequire } from "node:module";
20
+ import { dirname, join } from "node:path";
21
+ import { fileURLToPath } from "node:url";
22
+ var HERE = dirname(fileURLToPath(import.meta.url));
23
+ var require2 = createRequire(import.meta.url);
24
+ var bundled;
25
+ async function loadViewer() {
26
+ if (false) {
27
+ const { bundleViewer } = await null;
28
+ return bundleViewer(join(HERE, "viewer.ts"));
29
+ }
30
+ return readFileSync(join(HERE, "viewer.iife.js"), "utf8");
31
+ }
32
+ function viewerScript() {
33
+ bundled ??= loadViewer().catch((e) => {
34
+ bundled = void 0;
35
+ throw e;
36
+ });
37
+ return bundled;
38
+ }
39
+ function threeLicence() {
40
+ let dir = dirname(require2.resolve("three"));
41
+ while (!existsSync(join(dir, "package.json")) || !existsSync(join(dir, "LICENSE"))) {
42
+ const up = dirname(dir);
43
+ if (up === dir) throw new Error("three.js's LICENSE was not found beside its package.json");
44
+ dir = up;
45
+ }
46
+ const version = JSON.parse(readFileSync(join(dir, "package.json"), "utf8")).version;
47
+ return `three.js ${version}
48
+ ${readFileSync(join(dir, "LICENSE"), "utf8")}`;
49
+ }
50
+ var escapeHtml = (s) => s.replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[c]);
51
+ async function replayHtml(mesh, opts) {
52
+ const payload = replayPayload(mesh, opts);
53
+ const json = JSON.stringify(payload).replace(/</g, "\\u003c");
54
+ const script = (await viewerScript()).replace(/<\/script/gi, "<\\/script");
55
+ const bg = payload.theme === "dark" ? "#0f2235" : "#f7f5f0";
56
+ const fg = payload.theme === "dark" ? "#cfe3f5" : "#3d3a36";
57
+ const stripBg = payload.theme === "dark" ? "rgba(15,34,53,.82)" : "rgba(247,245,240,.88)";
58
+ return `<!doctype html>
59
+ <html lang="en">
60
+ <head>
61
+ <meta charset="utf-8">
62
+ <meta name="viewport" content="width=device-width, initial-scale=1">
63
+ <title>${escapeHtml(opts.title)} \u2014 replay</title>
64
+ <!--
65
+ ${threeLicence().replace(/--/g, "- -")}
66
+ -->
67
+ <style>
68
+ html,body{margin:0;background:${bg};color:${fg};font:14px/1.4 system-ui,sans-serif}
69
+ main{display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px}
70
+ #archlang-replay-stage{position:relative;container-type:inline-size;max-width:100%}
71
+ canvas{max-width:100%;height:auto;display:block}
72
+ #archlang-replay-strip{position:absolute;left:0;right:0;bottom:0;display:flex;flex-wrap:wrap;gap:0 1.4em;padding:.5em 1em;font-size:clamp(9px,1.7cqw,26px);line-height:1.5;background:${stripBg};color:${fg};pointer-events:none}
73
+ #archlang-replay-strip[hidden]{display:none}
74
+ input[type=range]{width:min(720px,90vw)}
75
+ p{margin:0;font-size:12px;opacity:.8}
76
+ </style>
77
+ </head>
78
+ <body>
79
+ <main>
80
+ <div id="archlang-replay-stage" style="width:${payload.width}px">
81
+ <canvas id="archlang-replay" role="img" aria-label="${escapeHtml(`${opts.title}: the plan drawing itself in its authoring order, then rising`)}"></canvas>${payload.facts ? `
82
+ <div id="archlang-replay-strip" role="group" aria-label="Plan facts" hidden></div>` : ""}
83
+ </div>
84
+ <input id="archlang-replay-t" type="range" min="0" max="1" step="0.001" value="0" aria-label="Replay position">
85
+ <p>${escapeHtml(PREVIEW_LABEL)}</p>
86
+ </main>
87
+ <script type="application/json" id="archlang-replay-payload">${json}</script>
88
+ <script>${script}</script>
89
+ </body>
90
+ </html>
91
+ `;
92
+ }
93
+
94
+ // src/replay/video.ts
95
+ import { spawn } from "node:child_process";
96
+ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
97
+ import { tmpdir } from "node:os";
98
+ import { join as join2 } from "node:path";
99
+ import { pathToFileURL } from "node:url";
100
+
101
+ // src/replay/swiftshader.ts
102
+ var SWIFTSHADER_ARGS = [
103
+ "--use-gl=angle",
104
+ "--use-angle=swiftshader",
105
+ "--ignore-gpu-blocklist",
106
+ "--enable-unsafe-swiftshader"
107
+ ];
108
+
109
+ // src/replay/video.ts
110
+ async function renderReplay(o) {
111
+ const fps = o.fps ?? 30;
112
+ const seconds = o.seconds ?? 15;
113
+ const frames = Math.round(fps * seconds);
114
+ const dir = mkdtempSync(join2(tmpdir(), "archlang3d-replay-"));
115
+ const file = join2(dir, "replay.html");
116
+ writeFileSync(
117
+ file,
118
+ o.html.replace(
119
+ '<script type="application/json"',
120
+ // No scrollbar may shift the canvas between frames.
121
+ '<style>html,body{overflow:hidden}</style><script>window.__replayAutoplay=false</script>\n<script type="application/json"'
122
+ )
123
+ );
124
+ const { chromium } = await import("playwright-core");
125
+ const browser = await chromium.launch({ args: SWIFTSHADER_ARGS });
126
+ try {
127
+ const page = await browser.newPage({
128
+ viewport: { width: o.width + 40, height: o.height + 120 },
129
+ deviceScaleFactor: 1
130
+ });
131
+ await page.goto(pathToFileURL(file).href);
132
+ await page.evaluate(() => window.__ready);
133
+ const hashAt = async (t) => page.evaluate(async (x) => {
134
+ window.__seek(x);
135
+ return window.__frameHash();
136
+ }, t);
137
+ const keys = [];
138
+ const strips = [];
139
+ const hasStrip = await page.locator("#archlang-replay-strip").count() > 0;
140
+ for (const k of keyFrames(o.events)) {
141
+ keys.push({ ...k, sha256: await hashAt(k.t) });
142
+ if (hasStrip) {
143
+ const text = await page.locator("#archlang-replay-strip").evaluate((el) => el.textContent ?? "");
144
+ strips.push({ label: k.label, text });
145
+ }
146
+ }
147
+ const a = await hashAt(0.5);
148
+ await hashAt(0.1);
149
+ const b = await hashAt(0.5);
150
+ let mp4;
151
+ if (o.mp4) {
152
+ const canvas = page.locator("#archlang-replay-stage");
153
+ const ff = spawn(
154
+ o.ffmpeg ?? "ffmpeg",
155
+ [
156
+ "-y",
157
+ "-loglevel",
158
+ "error",
159
+ "-f",
160
+ "image2pipe",
161
+ "-framerate",
162
+ String(fps),
163
+ "-c:v",
164
+ "png",
165
+ "-i",
166
+ "-",
167
+ "-c:v",
168
+ "libx264",
169
+ "-pix_fmt",
170
+ "yuv420p",
171
+ "-crf",
172
+ "18",
173
+ "-movflags",
174
+ "+faststart",
175
+ o.mp4
176
+ ],
177
+ { stdio: ["pipe", "ignore", "pipe"] }
178
+ );
179
+ let err = "";
180
+ ff.stderr.on("data", (d) => {
181
+ err += d.toString();
182
+ });
183
+ let failure;
184
+ const done = new Promise((resolve2) => {
185
+ ff.once("error", (e) => {
186
+ failure ??= new Error(`ffmpeg could not start (${e.code ?? e.message})`);
187
+ resolve2();
188
+ });
189
+ ff.once("close", (code) => {
190
+ if (code !== 0) failure ??= new Error(`ffmpeg exited ${code}: ${err.trim()}`);
191
+ resolve2();
192
+ });
193
+ });
194
+ ff.stdin.on("error", (e) => {
195
+ failure ??= e;
196
+ });
197
+ const started = await Promise.race([
198
+ new Promise((r) => ff.once("spawn", () => r(true))),
199
+ done.then(() => false)
200
+ ]);
201
+ try {
202
+ if (!started) throw failure ?? new Error("ffmpeg did not start");
203
+ for (let i = 0; i < frames; i++) {
204
+ if (failure) throw failure;
205
+ const t = frames === 1 ? 1 : i / (frames - 1);
206
+ await page.evaluate((x) => window.__seek(x), t);
207
+ const png = await canvas.screenshot({ type: "png" });
208
+ if (!ff.stdin.write(png)) await Promise.race([new Promise((r) => ff.stdin.once("drain", r)), done]);
209
+ }
210
+ ff.stdin.end();
211
+ await done;
212
+ if (failure) throw failure;
213
+ } catch (e) {
214
+ ff.kill();
215
+ await done;
216
+ rmSync(o.mp4, { force: true });
217
+ throw e;
218
+ }
219
+ mp4 = o.mp4;
220
+ }
221
+ return {
222
+ frames,
223
+ fps,
224
+ seconds,
225
+ width: o.width,
226
+ height: o.height,
227
+ keyFrames: keys,
228
+ ...hasStrip ? { strips } : {},
229
+ seekRoundTrip: a === b,
230
+ ...mp4 ? { mp4 } : {},
231
+ browser: browser.version()
232
+ };
233
+ } finally {
234
+ await browser.close();
235
+ rmSync(dir, { recursive: true, force: true });
236
+ }
237
+ }
238
+
239
+ // src/glb/write.ts
240
+ import { Document, Logger, WebIO } from "@gltf-transform/core";
241
+ var GLB_GENERATOR = `archlang-3d ${ARCHLANG_3D_VERSION}`;
242
+ var COLOUR = {
243
+ slab: [0.55, 0.55, 0.55, 1],
244
+ floor: [0.8, 0.75, 0.66, 1],
245
+ column: [0.7, 0.7, 0.7, 1],
246
+ wall: [0.92, 0.91, 0.88, 1],
247
+ door: [0.55, 0.4, 0.28, 1],
248
+ window: [0.6, 0.75, 0.85, 1],
249
+ opening: [0.6, 0.6, 0.6, 1],
250
+ furniture: [0.62, 0.64, 0.66, 1],
251
+ roof: [0.45, 0.42, 0.4, 1]
252
+ };
253
+ var DEMOLISH_COLOUR = [0.78, 0.33, 0.24, 0.3];
254
+ var glbNodeName = (n) => n.key.slice(n.key.indexOf("/") + 1);
255
+ var levelNodeName = (level) => `level:L${level}`;
256
+ function nodeExtras(n) {
257
+ const own = Object.keys(n.extras).sort().map((k) => [k, n.extras[k]]);
258
+ return {
259
+ key: n.key,
260
+ kind: n.kind,
261
+ id: n.id,
262
+ ...n.part ? { part: n.part } : {},
263
+ level: n.level,
264
+ stage: n.stage,
265
+ order: n.order,
266
+ ...n.hidden ? { hidden: true } : {},
267
+ ...Object.fromEntries(own)
268
+ };
269
+ }
270
+ async function writeGlb(mesh, opts = {}) {
271
+ const doc = new Document();
272
+ doc.setLogger(new Logger(Logger.Verbosity.SILENT));
273
+ doc.getRoot().getAsset().generator = opts.generator ?? GLB_GENERATOR;
274
+ const buffer = doc.createBuffer();
275
+ const scene = doc.createScene(mesh.name);
276
+ doc.getRoot().setDefaultScene(scene);
277
+ const materials = /* @__PURE__ */ new Map();
278
+ const material = (n) => {
279
+ const ghost = n.kind === "wall" && n.part === "demolish";
280
+ const key = ghost ? "wall:demolish" : n.kind;
281
+ let m = materials.get(key);
282
+ if (!m) {
283
+ m = doc.createMaterial(key).setBaseColorFactor(ghost ? DEMOLISH_COLOUR : COLOUR[n.kind]).setMetallicFactor(0).setRoughnessFactor(1);
284
+ if (ghost) m.setAlphaMode("BLEND");
285
+ materials.set(key, m);
286
+ }
287
+ return m;
288
+ };
289
+ const levels = /* @__PURE__ */ new Map();
290
+ for (const n of mesh.nodes) {
291
+ let group = levels.get(n.level);
292
+ if (!group) {
293
+ group = doc.createNode(levelNodeName(n.level)).setExtras({ archlang: { kind: "level", level: n.level } });
294
+ scene.addChild(group);
295
+ levels.set(n.level, group);
296
+ }
297
+ const positions = [];
298
+ const indices = [];
299
+ for (const s of n.shells) {
300
+ const base = positions.length / 3;
301
+ for (const v of s.positions) positions.push(v / 1e6);
302
+ for (const i of s.indices) indices.push(base + i);
303
+ }
304
+ const count = positions.length / 3;
305
+ const pos = doc.createAccessor().setType("VEC3").setArray(new Float32Array(positions)).setBuffer(buffer);
306
+ const idx = doc.createAccessor().setType("SCALAR").setArray(count > 65535 ? new Uint32Array(indices) : new Uint16Array(indices)).setBuffer(buffer);
307
+ const prim = doc.createPrimitive().setAttribute("POSITION", pos).setIndices(idx).setMaterial(material(n));
308
+ const name = glbNodeName(n);
309
+ const node = doc.createNode(name).setMesh(doc.createMesh(name).addPrimitive(prim)).setExtras({ archlang: nodeExtras(n) });
310
+ group.addChild(node);
311
+ }
312
+ return new WebIO().writeBinary(doc);
313
+ }
314
+ async function readGlbNodes(glb) {
315
+ const doc = await new WebIO().readBinary(glb);
316
+ const levels = [];
317
+ const nodes = [];
318
+ const walk = (parent, prefix) => {
319
+ for (const c of parent.listChildren()) {
320
+ const extras = c.getExtras().archlang ?? {};
321
+ nodes.push({ key: `${prefix}${c.getName()}`, name: c.getName(), extras });
322
+ walk(c, prefix);
323
+ }
324
+ };
325
+ for (const scene of doc.getRoot().listScenes()) {
326
+ for (const group of scene.listChildren()) {
327
+ const lv = group.getName();
328
+ levels.push(lv);
329
+ walk(group, lv.startsWith("level:") ? `${lv.slice("level:".length)}/` : "");
330
+ }
331
+ }
332
+ return { levels, nodes };
333
+ }
334
+
335
+ // src/check/verify.ts
336
+ var capped = (xs) => xs.length > 20 ? [...xs.slice(0, 20), `\u2026 and ${xs.length - 20} more`] : xs;
337
+ function openEdges(s) {
338
+ const m = /* @__PURE__ */ new Map();
339
+ for (let t = 0; t < s.indices.length; t += 3) {
340
+ for (let k = 0; k < 3; k++) {
341
+ const key = `${s.indices[t + k]}>${s.indices[t + (k + 1) % 3]}`;
342
+ m.set(key, (m.get(key) ?? 0) + 1);
343
+ }
344
+ }
345
+ let bad = 0;
346
+ for (const [e, n] of m) {
347
+ const [a, b] = e.split(">");
348
+ if (n !== 1 || m.get(`${b}>${a}`) !== 1) bad++;
349
+ }
350
+ return bad;
351
+ }
352
+ function signedVolume(s) {
353
+ const p = s.positions;
354
+ let v = 0;
355
+ for (let t = 0; t < s.indices.length; t += 3) {
356
+ const [i, j, k] = [
357
+ 3 * s.indices[t],
358
+ 3 * s.indices[t + 1],
359
+ 3 * s.indices[t + 2]
360
+ ];
361
+ const [ax, ay, az] = [p[i], p[i + 1], p[i + 2]];
362
+ const [bx, by, bz] = [p[j], p[j + 1], p[j + 2]];
363
+ const [cx, cy, cz] = [p[k], p[k + 1], p[k + 2]];
364
+ v += (ax * (by * cz - bz * cy) - ay * (bx * cz - bz * cx) + az * (bx * cy - by * cx)) / 6;
365
+ }
366
+ return v;
367
+ }
368
+ function checkScene(scene) {
369
+ const issues = validateScene3D(scene);
370
+ return { id: "V-SCH-01", ok: issues.length === 0, failures: capped(issues.map((i) => `${i.path}: ${i.message}`)) };
371
+ }
372
+ function checkShells(mesh) {
373
+ const bad = [];
374
+ let shells = 0;
375
+ for (const n of mesh.nodes) {
376
+ n.shells.forEach((s, i) => {
377
+ shells++;
378
+ const open = openEdges(s);
379
+ if (open !== 0) bad.push(`${n.key} shell ${i}: ${open} open edges`);
380
+ else if (!(signedVolume(s) > 0)) bad.push(`${n.key} shell ${i}: volume not positive`);
381
+ });
382
+ }
383
+ return { id: "V-GEO-02", ok: bad.length === 0, failures: capped(bad), facts: { shells } };
384
+ }
385
+ var NAME = /^[a-z]+:[^:/\s]+(:[^:/\s]+)?$/;
386
+ var PATH_LEAK = /(?:^|["\s(])(?:\/(?:home|Users|tmp|var|root)\/|[A-Za-z]:[\\/]|file:\/\/)/;
387
+ var TIME_LEAK = /\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2})?/;
388
+ function glbLeaks(json) {
389
+ const out = [];
390
+ if (PATH_LEAK.test(json)) out.push("the GLB's JSON carries an absolute path (plan \xA78.5 L7)");
391
+ let asset;
392
+ try {
393
+ asset = JSON.parse(json).asset;
394
+ } catch {
395
+ asset = json;
396
+ }
397
+ if (TIME_LEAK.test(JSON.stringify(asset ?? null)))
398
+ out.push("the GLB's asset fields carry a date or time (plan \xA78.5 L7)");
399
+ return out;
400
+ }
401
+ function checkNaming(nodes, levels, mesh) {
402
+ const bad = [];
403
+ for (const lv of levels) if (!/^level:L\d+$/.test(lv)) bad.push(`group "${lv}" is not level:L<n>`);
404
+ const seen = /* @__PURE__ */ new Set();
405
+ for (const n of nodes) {
406
+ if (!NAME.test(n.name)) bad.push(`node "${n.name}" is not <kind>:<id>[:<part>]`);
407
+ if (seen.has(n.key)) bad.push(`node "${n.key}" twice`);
408
+ seen.add(n.key);
409
+ const [kind, id, part] = n.name.split(":");
410
+ const x = n.extras;
411
+ if (x.key !== n.key || x.kind !== kind || x.id !== id || (x.part ?? void 0) !== part) {
412
+ bad.push(`node "${n.key}": extras.archlang does not name it (key ${String(x.key)})`);
413
+ }
414
+ }
415
+ if (mesh) {
416
+ const want = new Set(mesh.nodes.map((n) => n.key));
417
+ for (const k of want) if (!seen.has(k)) bad.push(`Mesh3D node "${k}" missing from the GLB`);
418
+ for (const k of seen) if (!want.has(k)) bad.push(`GLB node "${k}" is not a Mesh3D node`);
419
+ }
420
+ return { id: "V-GLTF-02", ok: bad.length === 0, failures: capped(bad), facts: { nodes: nodes.length } };
421
+ }
422
+ function glbJson(glb) {
423
+ const view = new DataView(glb.buffer, glb.byteOffset, glb.byteLength);
424
+ if (glb.byteLength < 20 || view.getUint32(0, true) !== 1179937895) throw new Error("not a GLB (no glTF magic)");
425
+ const len = view.getUint32(12, true);
426
+ return new TextDecoder().decode(glb.subarray(20, 20 + len));
427
+ }
428
+ async function checkValidator(glb) {
429
+ const v = await import("gltf-validator");
430
+ const r = await v.validateBytes(glb, { maxIssues: 0 });
431
+ const i = r.issues;
432
+ const bad = i.messages.filter((m) => m.severity <= 1).map(
433
+ (m) => `${m.severity === 0 ? "error" : "warning"} ${m.code}${m.pointer ? ` at ${m.pointer}` : ""}: ${m.message}`
434
+ );
435
+ return {
436
+ id: "V-GLTF-01",
437
+ ok: i.numErrors === 0 && i.numWarnings === 0 && i.truncated !== true,
438
+ failures: capped(bad),
439
+ facts: {
440
+ validator: v.version(),
441
+ errors: i.numErrors,
442
+ warnings: i.numWarnings,
443
+ infos: i.numInfos,
444
+ hints: i.numHints
445
+ }
446
+ };
447
+ }
448
+ async function checkGlb(glb, mesh) {
449
+ const out = [await checkValidator(glb)];
450
+ const { levels, nodes } = await readGlbNodes(glb);
451
+ const naming = checkNaming(nodes, levels, mesh);
452
+ const leaks = glbLeaks(glbJson(glb));
453
+ if (leaks.length > 0) {
454
+ naming.ok = false;
455
+ naming.failures.push(...leaks);
456
+ }
457
+ out.push(naming);
458
+ return out;
459
+ }
460
+
461
+ // src/node.ts
462
+ function makeNodeWorld(baseDir) {
463
+ return {
464
+ read: (p) => {
465
+ try {
466
+ return readFileSync2(resolve(baseDir, p), "utf8");
467
+ } catch {
468
+ return null;
469
+ }
470
+ }
471
+ };
472
+ }
473
+
474
+ export {
475
+ viewerScript,
476
+ replayHtml,
477
+ SWIFTSHADER_ARGS,
478
+ renderReplay,
479
+ GLB_GENERATOR,
480
+ glbNodeName,
481
+ levelNodeName,
482
+ nodeExtras,
483
+ writeGlb,
484
+ readGlbNodes,
485
+ openEdges,
486
+ signedVolume,
487
+ checkScene,
488
+ checkShells,
489
+ glbLeaks,
490
+ checkNaming,
491
+ glbJson,
492
+ checkValidator,
493
+ checkGlb,
494
+ makeNodeWorld
495
+ };
@@ -0,0 +1,54 @@
1
+ import {
2
+ endElevation,
3
+ explodeLifts,
4
+ storeysOf,
5
+ timeline
6
+ } from "./chunk-CTFMM64C.js";
7
+
8
+ // src/replay/payload.ts
9
+ var PREVIEW_LABEL = "Preview \u2014 from the separate archlang-3d package. ArchLang itself draws plans.";
10
+ function viewBoxOf(svg) {
11
+ const m = /viewBox="([-\d.\s]+)"/.exec(svg);
12
+ const v = (m?.[1] ?? "").trim().split(/\s+/).map(Number);
13
+ if (v.length !== 4 || v.some((x) => !Number.isFinite(x))) throw new Error("the drawing has no numeric viewBox");
14
+ return v;
15
+ }
16
+ function replayPayload(mesh, opts) {
17
+ const lifts = explodeLifts(mesh);
18
+ return {
19
+ title: opts.title,
20
+ theme: opts.theme ?? "light",
21
+ width: opts.width ?? 1920,
22
+ height: opts.height ?? 1080,
23
+ seconds: opts.seconds ?? 15,
24
+ svg: opts.svg,
25
+ viewBox: viewBoxOf(opts.svg),
26
+ elevation: endElevation(storeysOf(mesh).length),
27
+ ...opts.facts ? { facts: opts.facts } : {},
28
+ nodes: mesh.nodes.filter((n) => !n.hidden).map((n) => {
29
+ const positions = [];
30
+ const indices = [];
31
+ for (const s of n.shells) {
32
+ const base = positions.length / 3;
33
+ positions.push(...s.positions);
34
+ for (const i of s.indices) indices.push(base + i);
35
+ }
36
+ const lift = lifts.get(n.level) ?? 0;
37
+ return {
38
+ key: n.key,
39
+ kind: n.kind,
40
+ ...n.part ? { part: n.part } : {},
41
+ ...lift !== 0 ? { lift } : {},
42
+ positions,
43
+ indices
44
+ };
45
+ }),
46
+ events: timeline(mesh)
47
+ };
48
+ }
49
+
50
+ export {
51
+ PREVIEW_LABEL,
52
+ viewBoxOf,
53
+ replayPayload
54
+ };