@almadar/ui 5.142.0 → 5.143.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.
@@ -1,7 +1,7 @@
1
- export { C as ContentSegment, D as DEFAULT_CONFIG, a as DomEntityBox, b as DomLayoutData, c as DomOutputsBox, d as DomStateNode, e as DomTransitionLabel, f as DomTransitionPath, E as EntityDefinition, R as RenderOptions, S as StateDefinition, g as StateMachineDefinition, T as TraitSnapshotGetter, h as TransitionDefinition, V as VisualizerConfig, i as bindCanvasCapture, j as bindEventBus, k as bindLastDrawables, l as bindTraitStateGetter, m as clearVerification, n as cn, o as extractOutputsFromTransitions, p as extractStateMachine, q as formatGuard, r as getAllChecks, s as getBridgeHealth, t as getEffectSummary, u as getSnapshot, v as getSummary, w as getTraitSnapshots, x as getTransitions, y as getTransitionsForTrait, z as parseContentSegments, A as parseMarkdownWithCodeBlocks, B as recordServerResponse, F as recordTransition, G as registerCheck, H as registerTraitSnapshot, I as renderStateMachineToDomData, J as renderStateMachineToSvg, K as subscribeToVerification, L as updateAssetStatus, M as updateBridgeHealth, N as updateCheck, O as waitForTransition } from '../cn-rwc3svaX.cjs';
1
+ export { C as ContentSegment, D as DEFAULT_CONFIG, a as DomEntityBox, b as DomLayoutData, c as DomOutputsBox, d as DomStateNode, e as DomTransitionLabel, f as DomTransitionPath, E as EntityDefinition, R as RenderOptions, S as StateDefinition, g as StateMachineDefinition, T as TraitSnapshotGetter, h as TransitionDefinition, V as VisualizerConfig, i as bindCanvasCapture, j as bindEventBus, k as bindLastDrawables, l as bindTraitStateGetter, m as clearVerification, n as cn, o as extractOutputsFromTransitions, p as extractStateMachine, q as formatGuard, r as getAllChecks, s as getBridgeHealth, t as getEffectSummary, u as getSnapshot, v as getSummary, w as getTraitSnapshots, x as getTransitions, y as getTransitionsForTrait, z as parseContentSegments, A as parseMarkdownWithCodeBlocks, B as recordServerResponse, F as recordTransition, G as registerCheck, H as registerTraitSnapshot, I as renderStateMachineToDomData, J as renderStateMachineToSvg, K as subscribeToVerification, L as updateAssetStatus, M as updateBridgeHealth, N as updateCheck, O as waitForTransition } from '../cn-CvImTgKH.cjs';
2
2
  import { FieldValue, EntityRow, EventPayload } from '@almadar/core';
3
3
  export { AssetLoadStatus, BridgeHealth, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary } from '@almadar/core';
4
- import '../paintDispatch-BQn5Lyx1.cjs';
4
+ import '../paintDispatch-D3-5_cOb.cjs';
5
5
  import 'clsx';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- export { C as ContentSegment, D as DEFAULT_CONFIG, a as DomEntityBox, b as DomLayoutData, c as DomOutputsBox, d as DomStateNode, e as DomTransitionLabel, f as DomTransitionPath, E as EntityDefinition, R as RenderOptions, S as StateDefinition, g as StateMachineDefinition, T as TraitSnapshotGetter, h as TransitionDefinition, V as VisualizerConfig, i as bindCanvasCapture, j as bindEventBus, k as bindLastDrawables, l as bindTraitStateGetter, m as clearVerification, n as cn, o as extractOutputsFromTransitions, p as extractStateMachine, q as formatGuard, r as getAllChecks, s as getBridgeHealth, t as getEffectSummary, u as getSnapshot, v as getSummary, w as getTraitSnapshots, x as getTransitions, y as getTransitionsForTrait, z as parseContentSegments, A as parseMarkdownWithCodeBlocks, B as recordServerResponse, F as recordTransition, G as registerCheck, H as registerTraitSnapshot, I as renderStateMachineToDomData, J as renderStateMachineToSvg, K as subscribeToVerification, L as updateAssetStatus, M as updateBridgeHealth, N as updateCheck, O as waitForTransition } from '../cn-BDwC4QpH.js';
1
+ export { C as ContentSegment, D as DEFAULT_CONFIG, a as DomEntityBox, b as DomLayoutData, c as DomOutputsBox, d as DomStateNode, e as DomTransitionLabel, f as DomTransitionPath, E as EntityDefinition, R as RenderOptions, S as StateDefinition, g as StateMachineDefinition, T as TraitSnapshotGetter, h as TransitionDefinition, V as VisualizerConfig, i as bindCanvasCapture, j as bindEventBus, k as bindLastDrawables, l as bindTraitStateGetter, m as clearVerification, n as cn, o as extractOutputsFromTransitions, p as extractStateMachine, q as formatGuard, r as getAllChecks, s as getBridgeHealth, t as getEffectSummary, u as getSnapshot, v as getSummary, w as getTraitSnapshots, x as getTransitions, y as getTransitionsForTrait, z as parseContentSegments, A as parseMarkdownWithCodeBlocks, B as recordServerResponse, F as recordTransition, G as registerCheck, H as registerTraitSnapshot, I as renderStateMachineToDomData, J as renderStateMachineToSvg, K as subscribeToVerification, L as updateAssetStatus, M as updateBridgeHealth, N as updateCheck, O as waitForTransition } from '../cn-DryTiahe.js';
2
2
  import { FieldValue, EntityRow, EventPayload } from '@almadar/core';
3
3
  export { AssetLoadStatus, BridgeHealth, CheckStatus, EffectTrace, EventLogEntry, OrbitalVerificationAPI, ServerResponseTrace, TraitStateSnapshot, TransitionTrace, VerificationCheck, VerificationSnapshot, VerificationSummary } from '@almadar/core';
4
- import '../paintDispatch-BQn5Lyx1.js';
4
+ import '../paintDispatch-D3-5_cOb.js';
5
5
  import 'clsx';
6
6
 
7
7
  /**
@@ -271,42 +271,15 @@ interface DrawTextProps extends DrawableBase {
271
271
  opacity?: number;
272
272
  }
273
273
 
274
- /**
275
- * `draw-group` — the drawable CONTAINER atom (dimension-agnostic).
276
- *
277
- * Multi-shape art (a hero token = cloak + head + sword shapes) travels as ONE
278
- * node: the host paints the group by translating to its projected position,
279
- * applying `scale`/`rotate`/`opacity`, then painting each `items` descriptor
280
- * through the normal dispatch. `items` is a plain data prop (NOT `children`,
281
- * which UISlotRenderer special-cases) — same convention as the `draw-*-layer`
282
- * molecules. The React component renders `null`; it exists so the pattern
283
- * pipeline registers a `draw-group` pattern and standalone pages stay
284
- * inspectable. 2D-canvas only — the 3D backend skips it with a warn.
285
- */
286
-
287
- interface DrawGroupProps extends DrawableBase {
288
- type: 'draw-group';
289
- /** Logical scene position; the projector maps it to pixels / world. */
290
- position: ScenePos;
291
- /** Uniform scale applied to the whole group. */
292
- scale?: number;
293
- /** Rotation in radians (painter units). */
294
- rotate?: number;
295
- /** 0..1 opacity. */
296
- opacity?: number;
297
- /** Clip the group's items to an SVG path (`d` syntax) in world units relative to the group origin — masked reveals, meters, portraits. */
298
- clip?: string;
299
- /** The grouped drawables, painted through the normal dispatch. */
300
- items: DrawableNode[];
301
- }
302
-
303
274
  /**
304
275
  * `draw-mesh` — the volumetric 3D drawable atom (3D-canvas backend).
305
276
  *
306
277
  * ONE descriptor (`DrawMeshProps`, grounded in core `ScenePos`) with the R3F
307
278
  * backend `Mesh3D` in `lib/drawable/three/DrawMesh3D` (kept OUT of this file so
308
279
  * the 2D path never pulls three). A parametric primitive (box, sphere, capsule,
309
- * cylinder, cone, torus, plane, circle) at a scene position `position.z` is
280
+ * cylinder, cone, torus, plane, circle `plane`/`circle` lie flat in the
281
+ * scene ground plane facing up, matching the 2D painter) or a raw-geometry `polyhedron`
282
+ * (`vertices` + `faces` as plain data) at a scene position — `position.z` is
310
283
  * height in cells — with a data-driven material (`standard`/`physical`/`toon`/
311
284
  * `basic`), an optional inverted-hull outline, and keyframe animation over
312
285
  * transform/material tracks. Low-poly is a knob, not a geometry rewrite:
@@ -316,7 +289,7 @@ interface DrawGroupProps extends DrawableBase {
316
289
  * pattern and standalone pages stay inspectable.
317
290
  */
318
291
 
319
- type MeshShapeKind = 'box' | 'sphere' | 'capsule' | 'cylinder' | 'cone' | 'torus' | 'plane' | 'circle';
292
+ type MeshShapeKind = 'box' | 'sphere' | 'capsule' | 'cylinder' | 'cone' | 'torus' | 'plane' | 'circle' | 'polyhedron';
320
293
  type MeshMaterialKind = 'standard' | 'physical' | 'toon' | 'basic';
321
294
  type MeshMaterialSide = 'front' | 'back' | 'double';
322
295
  /**
@@ -386,6 +359,22 @@ interface DrawMeshAnimation {
386
359
  /** Keyframes ordered by `at` (0..1). */
387
360
  keyframes: DrawMeshKeyframe[];
388
361
  }
362
+ /**
363
+ * Smooth-skinning data for a `polyhedron` — plain declarative data, no runtime
364
+ * objects. Vertices carry blended bone weights (a neck-base vertex can be 60%
365
+ * neck / 40% spine), so the surface stretches continuously across joints
366
+ * instead of cracking at rigid chunk boundaries.
367
+ */
368
+ interface DrawMeshSkin {
369
+ /** Bone names, resolved against sibling `draw-group` `bone:` names in the same canvas. */
370
+ bones: string[];
371
+ /** One 16-float column-major inverse bind matrix per bone (model space → bone bind-local; translations in cells). */
372
+ inverseBindMatrices: number[][];
373
+ /** Per-vertex bone indices into `bones`, up to 4 each (pad with 0). */
374
+ indices: number[][];
375
+ /** Per-vertex blend weights matching `indices`, normalized to sum 1 (pad with 0). */
376
+ weights: number[][];
377
+ }
389
378
  interface DrawMeshProps extends DrawableBase {
390
379
  type: 'draw-mesh';
391
380
  shape: MeshShapeKind;
@@ -407,9 +396,15 @@ interface DrawMeshProps extends DrawableBase {
407
396
  tube?: number;
408
397
  /** Curved-surface tessellation, clamped 3..64 (default 24). 4–8 + `flatShading` = low-poly. */
409
398
  segments?: number;
399
+ /** `polyhedron` only: raw vertices as scene-frame `[x, y, z]` triples in cells, `z` = up. */
400
+ vertices?: number[][];
401
+ /** `polyhedron` only: triangle index triples into `vertices`, wound counter-clockwise seen from OUTSIDE in the scene frame. */
402
+ faces?: number[][];
403
+ /** `polyhedron` only: smooth-skinning weights binding the vertices to named bone groups. Vertices must then be authored in BIND POSE model space; the bones' animated transforms deform them. */
404
+ skin?: DrawMeshSkin;
410
405
  /** Euler rotation `[x, y, z]` in radians. */
411
406
  rotation?: [number, number, number];
412
- /** `bottom` (default) rests the mesh on its position's ground plane; `center` centers it there. */
407
+ /** `bottom` (default) rests the mesh on its position's ground plane; `center` centers it there. For `polyhedron`, `bottom` lifts by −min(z) and `center` applies no offset — the vertices are authoritative. */
413
408
  pivot?: 'bottom' | 'center';
414
409
  material?: MeshMaterial;
415
410
  outline?: MeshOutline;
@@ -421,6 +416,51 @@ interface DrawMeshProps extends DrawableBase {
421
416
  opacity?: number;
422
417
  }
423
418
 
419
+ /**
420
+ * `draw-group` — the drawable CONTAINER atom (dimension-agnostic).
421
+ *
422
+ * Multi-shape art (a hero token = cloak + head + sword shapes) travels as ONE
423
+ * node: the host paints the group by translating to its projected position,
424
+ * applying `scale`/`rotate`/`opacity`, then painting each `items` descriptor
425
+ * through the normal dispatch. `items` is a plain data prop (NOT `children`,
426
+ * which UISlotRenderer special-cases) — same convention as the `draw-*-layer`
427
+ * molecules. The React component renders `null`; it exists so the pattern
428
+ * pipeline registers a `draw-group` pattern and standalone pages stay
429
+ * inspectable. Both backends paint it: 2D as a canvas transform, 3D as a three
430
+ * `<group>` — with `rotation` + `animation` a nested group chain is a skeleton
431
+ * bone chain (rotate the shoulder group and the forearm group follows).
432
+ */
433
+
434
+ interface DrawGroupProps extends DrawableBase {
435
+ type: 'draw-group';
436
+ /** Logical scene position; the projector maps it to pixels / world. */
437
+ position: ScenePos;
438
+ /** Uniform scale applied to the whole group. */
439
+ scale?: number;
440
+ /** Rotation in radians (painter units). */
441
+ rotate?: number;
442
+ /** Euler rotation `[x, y, z]` in radians (world axes) — per-axis joint rotation for the 3D backend; a group placed at a joint with children authored joint-local IS a bone. The 2D painter applies only the in-plane `z` component, after `rotate`. */
443
+ rotation?: [number, number, number];
444
+ /** Skeleton bone name. A named group is addressable by a `draw-mesh` `skin`
445
+ * block (smooth skinning): the skinned mesh deforms with this group's
446
+ * animated transform. Names resolve within the nearest enclosing
447
+ * `skeleton: true` group (falling back to the canvas), so multiple
448
+ * instances of one rig never collide. Distinct from `id` (the hit-test
449
+ * handle). */
450
+ bone?: string;
451
+ /** Marks this group as a skeleton SCOPE: `bone` names and `skin` bindings in
452
+ * its subtree resolve against each other only — one scope per rig instance. */
453
+ skeleton?: boolean;
454
+ /** Keyframe animation over the group TRANSFORM tracks (`offsetX/Y/Z` in cells, `rotateX/Y/Z` in radians, `scale`; the 2D painter also honors `opacity`) — children inherit it, so nested animated groups form a joint chain. Material tracks belong on leaf meshes. */
455
+ animation?: DrawMeshAnimation;
456
+ /** 0..1 opacity. */
457
+ opacity?: number;
458
+ /** Clip the group's items to an SVG path (`d` syntax) in world units relative to the group origin — masked reveals, meters, portraits. */
459
+ clip?: string;
460
+ /** The grouped drawables, painted through the normal dispatch. */
461
+ items: DrawableNode[];
462
+ }
463
+
424
464
  /**
425
465
  * `draw-sprite-layer` — batch multiple sprites in one descriptor for O(layers) rendering.
426
466
  *
@@ -271,42 +271,15 @@ interface DrawTextProps extends DrawableBase {
271
271
  opacity?: number;
272
272
  }
273
273
 
274
- /**
275
- * `draw-group` — the drawable CONTAINER atom (dimension-agnostic).
276
- *
277
- * Multi-shape art (a hero token = cloak + head + sword shapes) travels as ONE
278
- * node: the host paints the group by translating to its projected position,
279
- * applying `scale`/`rotate`/`opacity`, then painting each `items` descriptor
280
- * through the normal dispatch. `items` is a plain data prop (NOT `children`,
281
- * which UISlotRenderer special-cases) — same convention as the `draw-*-layer`
282
- * molecules. The React component renders `null`; it exists so the pattern
283
- * pipeline registers a `draw-group` pattern and standalone pages stay
284
- * inspectable. 2D-canvas only — the 3D backend skips it with a warn.
285
- */
286
-
287
- interface DrawGroupProps extends DrawableBase {
288
- type: 'draw-group';
289
- /** Logical scene position; the projector maps it to pixels / world. */
290
- position: ScenePos;
291
- /** Uniform scale applied to the whole group. */
292
- scale?: number;
293
- /** Rotation in radians (painter units). */
294
- rotate?: number;
295
- /** 0..1 opacity. */
296
- opacity?: number;
297
- /** Clip the group's items to an SVG path (`d` syntax) in world units relative to the group origin — masked reveals, meters, portraits. */
298
- clip?: string;
299
- /** The grouped drawables, painted through the normal dispatch. */
300
- items: DrawableNode[];
301
- }
302
-
303
274
  /**
304
275
  * `draw-mesh` — the volumetric 3D drawable atom (3D-canvas backend).
305
276
  *
306
277
  * ONE descriptor (`DrawMeshProps`, grounded in core `ScenePos`) with the R3F
307
278
  * backend `Mesh3D` in `lib/drawable/three/DrawMesh3D` (kept OUT of this file so
308
279
  * the 2D path never pulls three). A parametric primitive (box, sphere, capsule,
309
- * cylinder, cone, torus, plane, circle) at a scene position `position.z` is
280
+ * cylinder, cone, torus, plane, circle `plane`/`circle` lie flat in the
281
+ * scene ground plane facing up, matching the 2D painter) or a raw-geometry `polyhedron`
282
+ * (`vertices` + `faces` as plain data) at a scene position — `position.z` is
310
283
  * height in cells — with a data-driven material (`standard`/`physical`/`toon`/
311
284
  * `basic`), an optional inverted-hull outline, and keyframe animation over
312
285
  * transform/material tracks. Low-poly is a knob, not a geometry rewrite:
@@ -316,7 +289,7 @@ interface DrawGroupProps extends DrawableBase {
316
289
  * pattern and standalone pages stay inspectable.
317
290
  */
318
291
 
319
- type MeshShapeKind = 'box' | 'sphere' | 'capsule' | 'cylinder' | 'cone' | 'torus' | 'plane' | 'circle';
292
+ type MeshShapeKind = 'box' | 'sphere' | 'capsule' | 'cylinder' | 'cone' | 'torus' | 'plane' | 'circle' | 'polyhedron';
320
293
  type MeshMaterialKind = 'standard' | 'physical' | 'toon' | 'basic';
321
294
  type MeshMaterialSide = 'front' | 'back' | 'double';
322
295
  /**
@@ -386,6 +359,22 @@ interface DrawMeshAnimation {
386
359
  /** Keyframes ordered by `at` (0..1). */
387
360
  keyframes: DrawMeshKeyframe[];
388
361
  }
362
+ /**
363
+ * Smooth-skinning data for a `polyhedron` — plain declarative data, no runtime
364
+ * objects. Vertices carry blended bone weights (a neck-base vertex can be 60%
365
+ * neck / 40% spine), so the surface stretches continuously across joints
366
+ * instead of cracking at rigid chunk boundaries.
367
+ */
368
+ interface DrawMeshSkin {
369
+ /** Bone names, resolved against sibling `draw-group` `bone:` names in the same canvas. */
370
+ bones: string[];
371
+ /** One 16-float column-major inverse bind matrix per bone (model space → bone bind-local; translations in cells). */
372
+ inverseBindMatrices: number[][];
373
+ /** Per-vertex bone indices into `bones`, up to 4 each (pad with 0). */
374
+ indices: number[][];
375
+ /** Per-vertex blend weights matching `indices`, normalized to sum 1 (pad with 0). */
376
+ weights: number[][];
377
+ }
389
378
  interface DrawMeshProps extends DrawableBase {
390
379
  type: 'draw-mesh';
391
380
  shape: MeshShapeKind;
@@ -407,9 +396,15 @@ interface DrawMeshProps extends DrawableBase {
407
396
  tube?: number;
408
397
  /** Curved-surface tessellation, clamped 3..64 (default 24). 4–8 + `flatShading` = low-poly. */
409
398
  segments?: number;
399
+ /** `polyhedron` only: raw vertices as scene-frame `[x, y, z]` triples in cells, `z` = up. */
400
+ vertices?: number[][];
401
+ /** `polyhedron` only: triangle index triples into `vertices`, wound counter-clockwise seen from OUTSIDE in the scene frame. */
402
+ faces?: number[][];
403
+ /** `polyhedron` only: smooth-skinning weights binding the vertices to named bone groups. Vertices must then be authored in BIND POSE model space; the bones' animated transforms deform them. */
404
+ skin?: DrawMeshSkin;
410
405
  /** Euler rotation `[x, y, z]` in radians. */
411
406
  rotation?: [number, number, number];
412
- /** `bottom` (default) rests the mesh on its position's ground plane; `center` centers it there. */
407
+ /** `bottom` (default) rests the mesh on its position's ground plane; `center` centers it there. For `polyhedron`, `bottom` lifts by −min(z) and `center` applies no offset — the vertices are authoritative. */
413
408
  pivot?: 'bottom' | 'center';
414
409
  material?: MeshMaterial;
415
410
  outline?: MeshOutline;
@@ -421,6 +416,51 @@ interface DrawMeshProps extends DrawableBase {
421
416
  opacity?: number;
422
417
  }
423
418
 
419
+ /**
420
+ * `draw-group` — the drawable CONTAINER atom (dimension-agnostic).
421
+ *
422
+ * Multi-shape art (a hero token = cloak + head + sword shapes) travels as ONE
423
+ * node: the host paints the group by translating to its projected position,
424
+ * applying `scale`/`rotate`/`opacity`, then painting each `items` descriptor
425
+ * through the normal dispatch. `items` is a plain data prop (NOT `children`,
426
+ * which UISlotRenderer special-cases) — same convention as the `draw-*-layer`
427
+ * molecules. The React component renders `null`; it exists so the pattern
428
+ * pipeline registers a `draw-group` pattern and standalone pages stay
429
+ * inspectable. Both backends paint it: 2D as a canvas transform, 3D as a three
430
+ * `<group>` — with `rotation` + `animation` a nested group chain is a skeleton
431
+ * bone chain (rotate the shoulder group and the forearm group follows).
432
+ */
433
+
434
+ interface DrawGroupProps extends DrawableBase {
435
+ type: 'draw-group';
436
+ /** Logical scene position; the projector maps it to pixels / world. */
437
+ position: ScenePos;
438
+ /** Uniform scale applied to the whole group. */
439
+ scale?: number;
440
+ /** Rotation in radians (painter units). */
441
+ rotate?: number;
442
+ /** Euler rotation `[x, y, z]` in radians (world axes) — per-axis joint rotation for the 3D backend; a group placed at a joint with children authored joint-local IS a bone. The 2D painter applies only the in-plane `z` component, after `rotate`. */
443
+ rotation?: [number, number, number];
444
+ /** Skeleton bone name. A named group is addressable by a `draw-mesh` `skin`
445
+ * block (smooth skinning): the skinned mesh deforms with this group's
446
+ * animated transform. Names resolve within the nearest enclosing
447
+ * `skeleton: true` group (falling back to the canvas), so multiple
448
+ * instances of one rig never collide. Distinct from `id` (the hit-test
449
+ * handle). */
450
+ bone?: string;
451
+ /** Marks this group as a skeleton SCOPE: `bone` names and `skin` bindings in
452
+ * its subtree resolve against each other only — one scope per rig instance. */
453
+ skeleton?: boolean;
454
+ /** Keyframe animation over the group TRANSFORM tracks (`offsetX/Y/Z` in cells, `rotateX/Y/Z` in radians, `scale`; the 2D painter also honors `opacity`) — children inherit it, so nested animated groups form a joint chain. Material tracks belong on leaf meshes. */
455
+ animation?: DrawMeshAnimation;
456
+ /** 0..1 opacity. */
457
+ opacity?: number;
458
+ /** Clip the group's items to an SVG path (`d` syntax) in world units relative to the group origin — masked reveals, meters, portraits. */
459
+ clip?: string;
460
+ /** The grouped drawables, painted through the normal dispatch. */
461
+ items: DrawableNode[];
462
+ }
463
+
424
464
  /**
425
465
  * `draw-sprite-layer` — batch multiple sprites in one descriptor for O(layers) rendering.
426
466
  *
@@ -9472,6 +9472,83 @@ var init_DrawText = __esm({
9472
9472
  };
9473
9473
  }
9474
9474
  });
9475
+ function isAnimatedGroup(node) {
9476
+ return Boolean(node.animation && node.animation.durationMs > 0 && node.animation.keyframes.length > 0);
9477
+ }
9478
+ function DrawGroup(props) {
9479
+ const register = React87.useContext(DrawableRegistryContext);
9480
+ if (register) register({ ...props, type: "draw-group" });
9481
+ return null;
9482
+ }
9483
+ var init_DrawGroup = __esm({
9484
+ "components/game/atoms/DrawGroup.tsx"() {
9485
+ "use client";
9486
+ init_registry();
9487
+ }
9488
+ });
9489
+ function applyMeshAnimation(node, timeMs) {
9490
+ const anim = node.animation;
9491
+ if (!anim || !(anim.durationMs > 0) || anim.keyframes.length === 0) return null;
9492
+ const frames = [...anim.keyframes].sort((a, b) => a.at - b.at);
9493
+ const cycle = timeMs / anim.durationMs;
9494
+ const t = anim.loop === false ? Math.min(cycle, 1) : cycle - Math.floor(cycle);
9495
+ const trackValue = (key) => {
9496
+ const defined = frames.filter((f3) => f3[key] !== void 0);
9497
+ if (defined.length === 0) return void 0;
9498
+ let prev;
9499
+ let next;
9500
+ for (const f3 of defined) {
9501
+ if (f3.at <= t) prev = f3;
9502
+ else if (!next) next = f3;
9503
+ }
9504
+ if (!prev) return defined[0][key];
9505
+ if (!next) return prev[key];
9506
+ const span = next.at - prev.at;
9507
+ const k = span > 0 ? (t - prev.at) / span : 1;
9508
+ const a = prev[key];
9509
+ const b = next[key];
9510
+ if (typeof a === "number" && typeof b === "number") return lerp2(a, b, k);
9511
+ return a;
9512
+ };
9513
+ const num = {};
9514
+ for (const key of NUMERIC_TRACKS2) {
9515
+ const v = trackValue(key);
9516
+ if (v !== void 0) num[key] = v;
9517
+ }
9518
+ return {
9519
+ offset: [num.offsetX ?? 0, num.offsetY ?? 0, num.offsetZ ?? 0],
9520
+ rotate: [num.rotateX ?? 0, num.rotateY ?? 0, num.rotateZ ?? 0],
9521
+ scale: num.scale ?? 1,
9522
+ opacity: num.opacity,
9523
+ emissiveIntensity: num.emissiveIntensity,
9524
+ color: trackValue("color"),
9525
+ emissive: trackValue("emissive")
9526
+ };
9527
+ }
9528
+ function DrawMesh(props) {
9529
+ const register = React87.useContext(DrawableRegistryContext);
9530
+ if (register) register({ ...props, type: "draw-mesh" });
9531
+ return null;
9532
+ }
9533
+ var lerp2, NUMERIC_TRACKS2;
9534
+ var init_DrawMesh = __esm({
9535
+ "components/game/atoms/DrawMesh.tsx"() {
9536
+ "use client";
9537
+ init_registry();
9538
+ lerp2 = (a, b, k) => a + (b - a) * k;
9539
+ NUMERIC_TRACKS2 = [
9540
+ "offsetX",
9541
+ "offsetY",
9542
+ "offsetZ",
9543
+ "rotateX",
9544
+ "rotateY",
9545
+ "rotateZ",
9546
+ "scale",
9547
+ "opacity",
9548
+ "emissiveIntensity"
9549
+ ];
9550
+ }
9551
+ });
9475
9552
 
9476
9553
  // components/game/molecules/DrawSpriteLayer.tsx
9477
9554
  function DrawSpriteLayer(_props) {
@@ -9538,18 +9615,22 @@ function paintDrawable(painter, node, dctx) {
9538
9615
  if (!isValidScenePos(node.position)) break;
9539
9616
  if (!Array.isArray(node.items)) break;
9540
9617
  const p = dctx.projector.project(node.position);
9618
+ const anim = dctx.time > 0 && isAnimatedGroup(node) ? applyMeshAnimation(node, dctx.time) : null;
9619
+ const tw = dctx.projector.tileWidth;
9541
9620
  painter.save();
9542
- painter.translate(p.x, p.y);
9543
- if (node.scale !== void 0) painter.scale(node.scale, node.scale);
9544
- if (node.rotate !== void 0) painter.rotate(node.rotate);
9545
- if (node.opacity !== void 0 && node.opacity !== 1) painter.setAlpha(node.opacity);
9621
+ painter.translate(p.x + (anim ? anim.offset[0] * tw : 0), p.y + (anim ? anim.offset[1] * tw : 0));
9622
+ const scale = (node.scale ?? 1) * (anim?.scale ?? 1);
9623
+ if (scale !== 1) painter.scale(scale, scale);
9624
+ const rotate = (node.rotate ?? 0) + (node.rotation?.[2] ?? 0) + (anim?.rotate[2] ?? 0);
9625
+ if (rotate !== 0) painter.rotate(rotate);
9626
+ const opacity = (node.opacity ?? 1) * (anim?.opacity ?? 1);
9627
+ if (opacity !== 1) painter.setAlpha(opacity);
9546
9628
  if (node.clip) {
9547
- const tw = dctx.projector.tileWidth;
9548
9629
  painter.scale(tw, tw);
9549
9630
  painter.clipPath(node.clip);
9550
9631
  painter.scale(1 / tw, 1 / tw);
9551
9632
  }
9552
- const childCtx = node.scale !== void 0 && node.scale !== 1 ? { ...dctx, groupScale: (dctx.groupScale ?? 1) * node.scale } : dctx;
9633
+ const childCtx = scale !== 1 ? { ...dctx, groupScale: (dctx.groupScale ?? 1) * scale } : dctx;
9553
9634
  for (const item of node.items) paintDrawable(painter, item, childCtx);
9554
9635
  painter.restore();
9555
9636
  break;
@@ -9575,6 +9656,8 @@ var init_paintDispatch = __esm({
9575
9656
  init_DrawSprite();
9576
9657
  init_DrawShape();
9577
9658
  init_DrawText();
9659
+ init_DrawGroup();
9660
+ init_DrawMesh();
9578
9661
  init_DrawSpriteLayer();
9579
9662
  init_DrawShapeLayer();
9580
9663
  init_DrawTextLayer();
@@ -9821,7 +9904,8 @@ function Canvas2D({
9821
9904
  const miniMapHeight = gridExtent.height || 10;
9822
9905
  const drawableIsAnimated = (node) => {
9823
9906
  if (node.type === "draw-shape") return isAnimatedShape(node);
9824
- if (node.type === "draw-group") return Array.isArray(node.items) && node.items.some(drawableIsAnimated);
9907
+ if (node.type === "draw-group")
9908
+ return isAnimatedGroup(node) || Array.isArray(node.items) && node.items.some(drawableIsAnimated);
9825
9909
  if (node.type === "draw-shape-layer") return Array.isArray(node.items) && node.items.some(isAnimatedShape);
9826
9910
  return false;
9827
9911
  };
@@ -10163,6 +10247,7 @@ var init_Canvas2D = __esm({
10163
10247
  init_projector();
10164
10248
  init_paintDispatch();
10165
10249
  init_DrawShape();
10250
+ init_DrawGroup();
10166
10251
  init_registry();
10167
10252
  init_hitTest();
10168
10253
  init_isometric();
@@ -39068,28 +39153,6 @@ var init_DetailPanel = __esm({
39068
39153
  DetailPanel.displayName = "DetailPanel";
39069
39154
  }
39070
39155
  });
39071
- function DrawGroup(props) {
39072
- const register = React87.useContext(DrawableRegistryContext);
39073
- if (register) register({ ...props, type: "draw-group" });
39074
- return null;
39075
- }
39076
- var init_DrawGroup = __esm({
39077
- "components/game/atoms/DrawGroup.tsx"() {
39078
- "use client";
39079
- init_registry();
39080
- }
39081
- });
39082
- function DrawMesh(props) {
39083
- const register = React87.useContext(DrawableRegistryContext);
39084
- if (register) register({ ...props, type: "draw-mesh" });
39085
- return null;
39086
- }
39087
- var init_DrawMesh = __esm({
39088
- "components/game/atoms/DrawMesh.tsx"() {
39089
- "use client";
39090
- init_registry();
39091
- }
39092
- });
39093
39156
  function extractTitle(children) {
39094
39157
  if (!React87__namespace.default.isValidElement(children)) return void 0;
39095
39158
  const props = children.props;
@@ -9398,6 +9398,83 @@ var init_DrawText = __esm({
9398
9398
  };
9399
9399
  }
9400
9400
  });
9401
+ function isAnimatedGroup(node) {
9402
+ return Boolean(node.animation && node.animation.durationMs > 0 && node.animation.keyframes.length > 0);
9403
+ }
9404
+ function DrawGroup(props) {
9405
+ const register = useContext(DrawableRegistryContext);
9406
+ if (register) register({ ...props, type: "draw-group" });
9407
+ return null;
9408
+ }
9409
+ var init_DrawGroup = __esm({
9410
+ "components/game/atoms/DrawGroup.tsx"() {
9411
+ "use client";
9412
+ init_registry();
9413
+ }
9414
+ });
9415
+ function applyMeshAnimation(node, timeMs) {
9416
+ const anim = node.animation;
9417
+ if (!anim || !(anim.durationMs > 0) || anim.keyframes.length === 0) return null;
9418
+ const frames = [...anim.keyframes].sort((a, b) => a.at - b.at);
9419
+ const cycle = timeMs / anim.durationMs;
9420
+ const t = anim.loop === false ? Math.min(cycle, 1) : cycle - Math.floor(cycle);
9421
+ const trackValue = (key) => {
9422
+ const defined = frames.filter((f3) => f3[key] !== void 0);
9423
+ if (defined.length === 0) return void 0;
9424
+ let prev;
9425
+ let next;
9426
+ for (const f3 of defined) {
9427
+ if (f3.at <= t) prev = f3;
9428
+ else if (!next) next = f3;
9429
+ }
9430
+ if (!prev) return defined[0][key];
9431
+ if (!next) return prev[key];
9432
+ const span = next.at - prev.at;
9433
+ const k = span > 0 ? (t - prev.at) / span : 1;
9434
+ const a = prev[key];
9435
+ const b = next[key];
9436
+ if (typeof a === "number" && typeof b === "number") return lerp2(a, b, k);
9437
+ return a;
9438
+ };
9439
+ const num = {};
9440
+ for (const key of NUMERIC_TRACKS2) {
9441
+ const v = trackValue(key);
9442
+ if (v !== void 0) num[key] = v;
9443
+ }
9444
+ return {
9445
+ offset: [num.offsetX ?? 0, num.offsetY ?? 0, num.offsetZ ?? 0],
9446
+ rotate: [num.rotateX ?? 0, num.rotateY ?? 0, num.rotateZ ?? 0],
9447
+ scale: num.scale ?? 1,
9448
+ opacity: num.opacity,
9449
+ emissiveIntensity: num.emissiveIntensity,
9450
+ color: trackValue("color"),
9451
+ emissive: trackValue("emissive")
9452
+ };
9453
+ }
9454
+ function DrawMesh(props) {
9455
+ const register = useContext(DrawableRegistryContext);
9456
+ if (register) register({ ...props, type: "draw-mesh" });
9457
+ return null;
9458
+ }
9459
+ var lerp2, NUMERIC_TRACKS2;
9460
+ var init_DrawMesh = __esm({
9461
+ "components/game/atoms/DrawMesh.tsx"() {
9462
+ "use client";
9463
+ init_registry();
9464
+ lerp2 = (a, b, k) => a + (b - a) * k;
9465
+ NUMERIC_TRACKS2 = [
9466
+ "offsetX",
9467
+ "offsetY",
9468
+ "offsetZ",
9469
+ "rotateX",
9470
+ "rotateY",
9471
+ "rotateZ",
9472
+ "scale",
9473
+ "opacity",
9474
+ "emissiveIntensity"
9475
+ ];
9476
+ }
9477
+ });
9401
9478
 
9402
9479
  // components/game/molecules/DrawSpriteLayer.tsx
9403
9480
  function DrawSpriteLayer(_props) {
@@ -9464,18 +9541,22 @@ function paintDrawable(painter, node, dctx) {
9464
9541
  if (!isValidScenePos(node.position)) break;
9465
9542
  if (!Array.isArray(node.items)) break;
9466
9543
  const p = dctx.projector.project(node.position);
9544
+ const anim = dctx.time > 0 && isAnimatedGroup(node) ? applyMeshAnimation(node, dctx.time) : null;
9545
+ const tw = dctx.projector.tileWidth;
9467
9546
  painter.save();
9468
- painter.translate(p.x, p.y);
9469
- if (node.scale !== void 0) painter.scale(node.scale, node.scale);
9470
- if (node.rotate !== void 0) painter.rotate(node.rotate);
9471
- if (node.opacity !== void 0 && node.opacity !== 1) painter.setAlpha(node.opacity);
9547
+ painter.translate(p.x + (anim ? anim.offset[0] * tw : 0), p.y + (anim ? anim.offset[1] * tw : 0));
9548
+ const scale = (node.scale ?? 1) * (anim?.scale ?? 1);
9549
+ if (scale !== 1) painter.scale(scale, scale);
9550
+ const rotate = (node.rotate ?? 0) + (node.rotation?.[2] ?? 0) + (anim?.rotate[2] ?? 0);
9551
+ if (rotate !== 0) painter.rotate(rotate);
9552
+ const opacity = (node.opacity ?? 1) * (anim?.opacity ?? 1);
9553
+ if (opacity !== 1) painter.setAlpha(opacity);
9472
9554
  if (node.clip) {
9473
- const tw = dctx.projector.tileWidth;
9474
9555
  painter.scale(tw, tw);
9475
9556
  painter.clipPath(node.clip);
9476
9557
  painter.scale(1 / tw, 1 / tw);
9477
9558
  }
9478
- const childCtx = node.scale !== void 0 && node.scale !== 1 ? { ...dctx, groupScale: (dctx.groupScale ?? 1) * node.scale } : dctx;
9559
+ const childCtx = scale !== 1 ? { ...dctx, groupScale: (dctx.groupScale ?? 1) * scale } : dctx;
9479
9560
  for (const item of node.items) paintDrawable(painter, item, childCtx);
9480
9561
  painter.restore();
9481
9562
  break;
@@ -9501,6 +9582,8 @@ var init_paintDispatch = __esm({
9501
9582
  init_DrawSprite();
9502
9583
  init_DrawShape();
9503
9584
  init_DrawText();
9585
+ init_DrawGroup();
9586
+ init_DrawMesh();
9504
9587
  init_DrawSpriteLayer();
9505
9588
  init_DrawShapeLayer();
9506
9589
  init_DrawTextLayer();
@@ -9747,7 +9830,8 @@ function Canvas2D({
9747
9830
  const miniMapHeight = gridExtent.height || 10;
9748
9831
  const drawableIsAnimated = (node) => {
9749
9832
  if (node.type === "draw-shape") return isAnimatedShape(node);
9750
- if (node.type === "draw-group") return Array.isArray(node.items) && node.items.some(drawableIsAnimated);
9833
+ if (node.type === "draw-group")
9834
+ return isAnimatedGroup(node) || Array.isArray(node.items) && node.items.some(drawableIsAnimated);
9751
9835
  if (node.type === "draw-shape-layer") return Array.isArray(node.items) && node.items.some(isAnimatedShape);
9752
9836
  return false;
9753
9837
  };
@@ -10089,6 +10173,7 @@ var init_Canvas2D = __esm({
10089
10173
  init_projector();
10090
10174
  init_paintDispatch();
10091
10175
  init_DrawShape();
10176
+ init_DrawGroup();
10092
10177
  init_registry();
10093
10178
  init_hitTest();
10094
10179
  init_isometric();
@@ -38994,28 +39079,6 @@ var init_DetailPanel = __esm({
38994
39079
  DetailPanel.displayName = "DetailPanel";
38995
39080
  }
38996
39081
  });
38997
- function DrawGroup(props) {
38998
- const register = useContext(DrawableRegistryContext);
38999
- if (register) register({ ...props, type: "draw-group" });
39000
- return null;
39001
- }
39002
- var init_DrawGroup = __esm({
39003
- "components/game/atoms/DrawGroup.tsx"() {
39004
- "use client";
39005
- init_registry();
39006
- }
39007
- });
39008
- function DrawMesh(props) {
39009
- const register = useContext(DrawableRegistryContext);
39010
- if (register) register({ ...props, type: "draw-mesh" });
39011
- return null;
39012
- }
39013
- var init_DrawMesh = __esm({
39014
- "components/game/atoms/DrawMesh.tsx"() {
39015
- "use client";
39016
- init_registry();
39017
- }
39018
- });
39019
39082
  function extractTitle(children) {
39020
39083
  if (!React87__default.isValidElement(children)) return void 0;
39021
39084
  const props = children.props;