motionary 10.7.0 → 10.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +42 -3
  3. package/dist/chunks/{anim-image-CFGpUX7t.cjs → anim-image-BzTQa2k3.cjs} +2 -2
  4. package/dist/chunks/{anim-image-CFGpUX7t.cjs.map → anim-image-BzTQa2k3.cjs.map} +1 -1
  5. package/dist/chunks/{anim-image-CXDD19FH.js → anim-image-iD646Q7i.js} +2 -2
  6. package/dist/chunks/{anim-image-CXDD19FH.js.map → anim-image-iD646Q7i.js.map} +1 -1
  7. package/dist/chunks/{keyframes-DwR6GPej.js → keyframes-B4zefz0k.js} +2 -2
  8. package/dist/chunks/{keyframes-DwR6GPej.js.map → keyframes-B4zefz0k.js.map} +1 -1
  9. package/dist/chunks/{keyframes-DdwGY1gr.cjs → keyframes-BlOyB1PP.cjs} +2 -2
  10. package/dist/chunks/{keyframes-DdwGY1gr.cjs.map → keyframes-BlOyB1PP.cjs.map} +1 -1
  11. package/dist/chunks/{registry-DhKZCitb.cjs → registry-BZxDVL3h.cjs} +2 -2
  12. package/dist/chunks/{registry-DhKZCitb.cjs.map → registry-BZxDVL3h.cjs.map} +1 -1
  13. package/dist/chunks/{registry-D87dP_aR.js → registry-Bkt3-3ET.js} +3 -3
  14. package/dist/chunks/{registry-D87dP_aR.js.map → registry-Bkt3-3ET.js.map} +1 -1
  15. package/dist/chunks/runtime-link-CUiZ8lbE.cjs +38 -0
  16. package/dist/chunks/runtime-link-CUiZ8lbE.cjs.map +1 -0
  17. package/dist/chunks/runtime-link-c13gskBZ.js +36 -0
  18. package/dist/chunks/runtime-link-c13gskBZ.js.map +1 -0
  19. package/dist/chunks/{ticker-jD9_A9Rh.cjs → ticker-BfxAECfO.cjs} +2 -2
  20. package/dist/chunks/{ticker-jD9_A9Rh.cjs.map → ticker-BfxAECfO.cjs.map} +1 -1
  21. package/dist/chunks/{ticker-CJYI5Pxc.js → ticker-ZtweD3U4.js} +2 -2
  22. package/dist/chunks/{ticker-CJYI5Pxc.js.map → ticker-ZtweD3U4.js.map} +1 -1
  23. package/dist/chunks/{tween-Dk0QmNe9.cjs → tween--MD-39y0.cjs} +2 -2
  24. package/dist/chunks/{tween-Dk0QmNe9.cjs.map → tween--MD-39y0.cjs.map} +1 -1
  25. package/dist/chunks/{tween-_Lld1MsF.js → tween-DACdkLyO.js} +2 -2
  26. package/dist/chunks/{tween-_Lld1MsF.js.map → tween-DACdkLyO.js.map} +1 -1
  27. package/dist/components/snap-carousel.cjs +216 -0
  28. package/dist/components/snap-carousel.cjs.map +1 -0
  29. package/dist/components/snap-carousel.d.cts +80 -0
  30. package/dist/components/snap-carousel.d.ts +80 -0
  31. package/dist/components/snap-carousel.js +214 -0
  32. package/dist/components/snap-carousel.js.map +1 -0
  33. package/dist/components/widgets.cjs +32 -46
  34. package/dist/components/widgets.cjs.map +1 -1
  35. package/dist/components/widgets.d.cts +77 -4
  36. package/dist/components/widgets.d.ts +77 -4
  37. package/dist/components/widgets.js +22 -36
  38. package/dist/components/widgets.js.map +1 -1
  39. package/dist/llms-full.txt +94 -6
  40. package/dist/llms.txt +6 -3
  41. package/dist/manifest.json +260 -19
  42. package/dist/runtime/drag-snap.cjs +269 -0
  43. package/dist/runtime/drag-snap.cjs.map +1 -0
  44. package/dist/runtime/drag-snap.d.cts +109 -0
  45. package/dist/runtime/drag-snap.d.ts +109 -0
  46. package/dist/runtime/drag-snap.iife.js +2 -0
  47. package/dist/runtime/drag-snap.iife.js.map +1 -0
  48. package/dist/runtime/drag-snap.js +261 -0
  49. package/dist/runtime/drag-snap.js.map +1 -0
  50. package/dist/runtime/format-apng.cjs +4 -4
  51. package/dist/runtime/format-apng.js +4 -4
  52. package/dist/runtime/format-css.cjs +4 -4
  53. package/dist/runtime/format-css.js +4 -4
  54. package/dist/runtime/format-gif.cjs +4 -4
  55. package/dist/runtime/format-gif.js +4 -4
  56. package/dist/runtime/format-gltf.cjs +37 -18
  57. package/dist/runtime/format-gltf.cjs.map +1 -1
  58. package/dist/runtime/format-gltf.d.cts +18 -2
  59. package/dist/runtime/format-gltf.d.ts +18 -2
  60. package/dist/runtime/format-gltf.iife.js +1 -1
  61. package/dist/runtime/format-gltf.iife.js.map +1 -1
  62. package/dist/runtime/format-gltf.js +37 -18
  63. package/dist/runtime/format-gltf.js.map +1 -1
  64. package/dist/runtime/format-motion.cjs +4 -4
  65. package/dist/runtime/format-motion.js +4 -4
  66. package/dist/runtime/format-obj.cjs +1 -1
  67. package/dist/runtime/format-obj.d.cts +2 -0
  68. package/dist/runtime/format-obj.d.ts +2 -0
  69. package/dist/runtime/format-obj.iife.js.map +1 -1
  70. package/dist/runtime/format-obj.js +1 -1
  71. package/dist/runtime/format-scene.cjs +1 -1
  72. package/dist/runtime/format-scene.js +1 -1
  73. package/dist/runtime/format-sprite.cjs +3 -3
  74. package/dist/runtime/format-sprite.js +3 -3
  75. package/dist/runtime/format-svg.cjs +3 -3
  76. package/dist/runtime/format-svg.js +3 -3
  77. package/dist/runtime/format-webp.cjs +4 -4
  78. package/dist/runtime/format-webp.js +4 -4
  79. package/dist/runtime/gl.cjs +17 -4
  80. package/dist/runtime/gl.cjs.map +1 -1
  81. package/dist/runtime/gl.d.cts +2 -0
  82. package/dist/runtime/gl.d.ts +2 -0
  83. package/dist/runtime/gl.iife.js +1 -1
  84. package/dist/runtime/gl.iife.js.map +1 -1
  85. package/dist/runtime/gl.js +17 -4
  86. package/dist/runtime/gl.js.map +1 -1
  87. package/dist/runtime/gltf-anim.cjs +251 -0
  88. package/dist/runtime/gltf-anim.cjs.map +1 -0
  89. package/dist/runtime/gltf-anim.d.cts +216 -0
  90. package/dist/runtime/gltf-anim.d.ts +216 -0
  91. package/dist/runtime/gltf-anim.iife.js +2 -0
  92. package/dist/runtime/gltf-anim.iife.js.map +1 -0
  93. package/dist/runtime/gltf-anim.js +243 -0
  94. package/dist/runtime/gltf-anim.js.map +1 -0
  95. package/dist/runtime/physics.cjs +1 -1
  96. package/dist/runtime/physics.js +1 -1
  97. package/dist/runtime/scroll.cjs +2 -2
  98. package/dist/runtime/scroll.js +2 -2
  99. package/dist/runtime/smooth.cjs +1 -1
  100. package/dist/runtime/smooth.js +1 -1
  101. package/dist/runtime/text.cjs +1 -1
  102. package/dist/runtime/text.js +1 -1
  103. package/dist/runtime/vector.cjs +421 -11
  104. package/dist/runtime/vector.cjs.map +1 -1
  105. package/dist/runtime/vector.d.cts +20 -4
  106. package/dist/runtime/vector.d.ts +20 -4
  107. package/dist/runtime/vector.iife.js +1 -1
  108. package/dist/runtime/vector.iife.js.map +1 -1
  109. package/dist/runtime/vector.js +421 -12
  110. package/dist/runtime/vector.js.map +1 -1
  111. package/dist/runtime.cjs +3 -3
  112. package/dist/runtime.d.cts +1 -1
  113. package/dist/runtime.d.ts +1 -1
  114. package/dist/runtime.iife.js +1 -1
  115. package/dist/runtime.iife.js.map +1 -1
  116. package/dist/runtime.js +5 -5
  117. package/dist/widgets.umd.js +1 -1
  118. package/dist/widgets.umd.js.map +1 -1
  119. package/docs/ROADMAP.md +1 -1
  120. package/docs/components/README.md +3 -2
  121. package/docs/components/usa-gl-scene.md +27 -6
  122. package/docs/components/usa-lottie-player.md +18 -0
  123. package/docs/components/usa-snap-carousel.md +68 -0
  124. package/docs/components.md +51 -3
  125. package/docs/runtime/drag-snap.md +60 -0
  126. package/docs/runtime/format-gltf.md +3 -2
  127. package/docs/runtime/gltf-anim.md +62 -0
  128. package/docs/runtime/vector.md +3 -2
  129. package/package.json +31 -1
@@ -2392,6 +2392,8 @@ interface Geometry {
2392
2392
  indices?: Uint16Array | Uint32Array;
2393
2393
  /** 'triangles' (default), 'lines', 'points'. */
2394
2394
  mode?: 'triangles' | 'lines' | 'points';
2395
+ /** Bump after changing positions / normals in place (10.8: skinning, morph targets) — the renderer re-uploads them. */
2396
+ version?: number;
2395
2397
  /** Renderer cache. */
2396
2398
  _gpu?: unknown;
2397
2399
  }
@@ -2488,6 +2490,60 @@ declare class Scene$1 {
2488
2490
  add(...n: GlNode[]): this;
2489
2491
  }
2490
2492
 
2493
+ /**
2494
+ * `motionary/runtime/gltf-anim` (10.8) — glTF 2.0 animation, skinning and
2495
+ * morph targets for models loaded by `motionary/runtime/format-gltf`
2496
+ * (own implementation; requires `use(gl, formatGltf, gltfAnim)`).
2497
+ *
2498
+ * - animation channels on node `translation` / `rotation` / `scale` /
2499
+ * `weights` with `LINEAR` (quaternions slerped), `STEP` and
2500
+ * `CUBICSPLINE` (Hermite with in / out tangents) samplers;
2501
+ * - morph targets (POSITION + NORMAL deltas) with mesh default weights,
2502
+ * node weights and animated weights;
2503
+ * - skins: joint hierarchy, inverse bind matrices, 4 joints / vertex
2504
+ * (JOINTS_0 / WEIGHTS_0), skinned on the CPU and re-uploaded each frame
2505
+ * (`geometry.version`), so it works with every runtime/gl material;
2506
+ * - `gltfAnimator(model)` plays a clip (by name or index) with loop / speed
2507
+ * / seek, `update(dt)` from your loop or `play()` on the shared ticker.
2508
+ *
2509
+ * Sampling and deformation are pure (SSR / workers / tests).
2510
+ */
2511
+
2512
+ type Num$3 = number;
2513
+ type ChannelPath = 'translation' | 'rotation' | 'scale' | 'weights';
2514
+ type Interpolation = 'LINEAR' | 'STEP' | 'CUBICSPLINE';
2515
+ interface GltfChannel {
2516
+ node: GlNode;
2517
+ path: ChannelPath;
2518
+ interpolation: Interpolation;
2519
+ times: Float32Array;
2520
+ values: Float32Array;
2521
+ /** Components per key (3, 4 or the morph target count). */
2522
+ size: Num$3;
2523
+ }
2524
+ interface GltfClip {
2525
+ name: string;
2526
+ duration: Num$3;
2527
+ channels: GltfChannel[];
2528
+ }
2529
+ interface GltfAnimator {
2530
+ readonly clips: GltfClip[];
2531
+ readonly clip: GltfClip | null;
2532
+ time: Num$3;
2533
+ speed: Num$3;
2534
+ loop: boolean;
2535
+ readonly playing: boolean;
2536
+ /** Switch clip (name or index); keeps playing state. */
2537
+ use(clip: string | Num$3): void;
2538
+ seek(t: Num$3): void;
2539
+ /** Advance by `dt` seconds and pose + deform. */
2540
+ update(dt: Num$3): void;
2541
+ /** Run on the shared ticker. */
2542
+ play(): void;
2543
+ pause(): void;
2544
+ dispose(): void;
2545
+ }
2546
+
2491
2547
  /**
2492
2548
  * `<usa-gl-scene src="model.glb" controls auto-rotate></usa-gl-scene>` (10.5)
2493
2549
  * — a WebGL2 3D viewer on **`motionary/runtime/gl`** (requires `use(gl)`;
@@ -2498,14 +2554,18 @@ declare class Scene$1 {
2498
2554
  * `auto-rotate` (deg/s; off under reduced motion), `video` (a video URL
2499
2555
  * mapped onto the shape as a texture; `video-scrub` ties its time to the
2500
2556
  * element's scroll position instead of playing), `label` (accessible name).
2501
- * Renders only while visible. `scene`, `camera`, `root`, `reload()`;
2502
- * `usa:load` { nodes, meshes }, `usa:error`.
2557
+ * 10.8: `animation` (clip name or index; empty = the first) plays a glTF
2558
+ * animation with skinning and morph targets (requires
2559
+ * `motionary/runtime/gltf-anim`), `animation-speed`; reduced motion shows
2560
+ * the first pose. Renders only while visible. `scene`, `camera`, `root`,
2561
+ * `animator`, `reload()`; `usa:load` { meshes, animations }, `usa:error`.
2503
2562
  * `<usa-three-scene>` is an alias with the same API.
2504
2563
  */
2505
2564
  interface UsaGlSceneElement extends UsaElement {
2506
2565
  readonly scene: Scene$1 | null;
2507
2566
  readonly camera: Camera | null;
2508
2567
  readonly root: GlNode | null;
2568
+ readonly animator: GltfAnimator | null;
2509
2569
  reload(): Promise<void>;
2510
2570
  }
2511
2571
  declare function defineGlScene(tag?: string): CustomElementConstructor | undefined;
@@ -2575,8 +2635,12 @@ declare function defineShaderBackdrop(tag?: string): CustomElementConstructor |
2575
2635
  * `DecompressionStream`), `manifest.json` v1 / v2, several animations,
2576
2636
  * embedded images.
2577
2637
  *
2578
- * Not supported (documented): 3D layers, effects, text layers (10.8),
2579
- * expressions (10.8 subset), merge paths, repeaters. `lottiePlayer()` is a
2638
+ * 10.8: **text layers** (system / web fonts by family + style, justification,
2639
+ * tracking, line height, fill + stroke, box text with wrapping, source-text
2640
+ * keyframes and expressions) and an **expression subset** (see
2641
+ * `lottie-expr.ts`: time, value, wiggle, loopOut / loopIn, linear / ease,
2642
+ * Math…; no eval). Not supported (documented): 3D layers, effects, text
2643
+ * animators, glyph outlines (`chars`), merge paths, repeaters. `lottiePlayer()` is a
2580
2644
  * runtime timeline (seek, reverse, scrub with `progress`, markers → labels).
2581
2645
  */
2582
2646
 
@@ -2588,6 +2652,7 @@ interface LottieProp {
2588
2652
  s?: boolean;
2589
2653
  }
2590
2654
  interface LottieLayer {
2655
+ t?: any;
2591
2656
  ty: Num$2;
2592
2657
  ind?: Num$2;
2593
2658
  parent?: Num$2;
@@ -2635,6 +2700,14 @@ interface LottieAnimation {
2635
2700
  tm: Num$2;
2636
2701
  dr: Num$2;
2637
2702
  }[];
2703
+ fonts?: {
2704
+ list?: {
2705
+ fName: string;
2706
+ fFamily?: string;
2707
+ fStyle?: string;
2708
+ }[];
2709
+ };
2710
+ chars?: unknown[];
2638
2711
  }
2639
2712
  type LottiePlayer = Playable & {
2640
2713
  readonly frame: Num$2;
@@ -2392,6 +2392,8 @@ interface Geometry {
2392
2392
  indices?: Uint16Array | Uint32Array;
2393
2393
  /** 'triangles' (default), 'lines', 'points'. */
2394
2394
  mode?: 'triangles' | 'lines' | 'points';
2395
+ /** Bump after changing positions / normals in place (10.8: skinning, morph targets) — the renderer re-uploads them. */
2396
+ version?: number;
2395
2397
  /** Renderer cache. */
2396
2398
  _gpu?: unknown;
2397
2399
  }
@@ -2488,6 +2490,60 @@ declare class Scene$1 {
2488
2490
  add(...n: GlNode[]): this;
2489
2491
  }
2490
2492
 
2493
+ /**
2494
+ * `motionary/runtime/gltf-anim` (10.8) — glTF 2.0 animation, skinning and
2495
+ * morph targets for models loaded by `motionary/runtime/format-gltf`
2496
+ * (own implementation; requires `use(gl, formatGltf, gltfAnim)`).
2497
+ *
2498
+ * - animation channels on node `translation` / `rotation` / `scale` /
2499
+ * `weights` with `LINEAR` (quaternions slerped), `STEP` and
2500
+ * `CUBICSPLINE` (Hermite with in / out tangents) samplers;
2501
+ * - morph targets (POSITION + NORMAL deltas) with mesh default weights,
2502
+ * node weights and animated weights;
2503
+ * - skins: joint hierarchy, inverse bind matrices, 4 joints / vertex
2504
+ * (JOINTS_0 / WEIGHTS_0), skinned on the CPU and re-uploaded each frame
2505
+ * (`geometry.version`), so it works with every runtime/gl material;
2506
+ * - `gltfAnimator(model)` plays a clip (by name or index) with loop / speed
2507
+ * / seek, `update(dt)` from your loop or `play()` on the shared ticker.
2508
+ *
2509
+ * Sampling and deformation are pure (SSR / workers / tests).
2510
+ */
2511
+
2512
+ type Num$3 = number;
2513
+ type ChannelPath = 'translation' | 'rotation' | 'scale' | 'weights';
2514
+ type Interpolation = 'LINEAR' | 'STEP' | 'CUBICSPLINE';
2515
+ interface GltfChannel {
2516
+ node: GlNode;
2517
+ path: ChannelPath;
2518
+ interpolation: Interpolation;
2519
+ times: Float32Array;
2520
+ values: Float32Array;
2521
+ /** Components per key (3, 4 or the morph target count). */
2522
+ size: Num$3;
2523
+ }
2524
+ interface GltfClip {
2525
+ name: string;
2526
+ duration: Num$3;
2527
+ channels: GltfChannel[];
2528
+ }
2529
+ interface GltfAnimator {
2530
+ readonly clips: GltfClip[];
2531
+ readonly clip: GltfClip | null;
2532
+ time: Num$3;
2533
+ speed: Num$3;
2534
+ loop: boolean;
2535
+ readonly playing: boolean;
2536
+ /** Switch clip (name or index); keeps playing state. */
2537
+ use(clip: string | Num$3): void;
2538
+ seek(t: Num$3): void;
2539
+ /** Advance by `dt` seconds and pose + deform. */
2540
+ update(dt: Num$3): void;
2541
+ /** Run on the shared ticker. */
2542
+ play(): void;
2543
+ pause(): void;
2544
+ dispose(): void;
2545
+ }
2546
+
2491
2547
  /**
2492
2548
  * `<usa-gl-scene src="model.glb" controls auto-rotate></usa-gl-scene>` (10.5)
2493
2549
  * — a WebGL2 3D viewer on **`motionary/runtime/gl`** (requires `use(gl)`;
@@ -2498,14 +2554,18 @@ declare class Scene$1 {
2498
2554
  * `auto-rotate` (deg/s; off under reduced motion), `video` (a video URL
2499
2555
  * mapped onto the shape as a texture; `video-scrub` ties its time to the
2500
2556
  * element's scroll position instead of playing), `label` (accessible name).
2501
- * Renders only while visible. `scene`, `camera`, `root`, `reload()`;
2502
- * `usa:load` { nodes, meshes }, `usa:error`.
2557
+ * 10.8: `animation` (clip name or index; empty = the first) plays a glTF
2558
+ * animation with skinning and morph targets (requires
2559
+ * `motionary/runtime/gltf-anim`), `animation-speed`; reduced motion shows
2560
+ * the first pose. Renders only while visible. `scene`, `camera`, `root`,
2561
+ * `animator`, `reload()`; `usa:load` { meshes, animations }, `usa:error`.
2503
2562
  * `<usa-three-scene>` is an alias with the same API.
2504
2563
  */
2505
2564
  interface UsaGlSceneElement extends UsaElement {
2506
2565
  readonly scene: Scene$1 | null;
2507
2566
  readonly camera: Camera | null;
2508
2567
  readonly root: GlNode | null;
2568
+ readonly animator: GltfAnimator | null;
2509
2569
  reload(): Promise<void>;
2510
2570
  }
2511
2571
  declare function defineGlScene(tag?: string): CustomElementConstructor | undefined;
@@ -2575,8 +2635,12 @@ declare function defineShaderBackdrop(tag?: string): CustomElementConstructor |
2575
2635
  * `DecompressionStream`), `manifest.json` v1 / v2, several animations,
2576
2636
  * embedded images.
2577
2637
  *
2578
- * Not supported (documented): 3D layers, effects, text layers (10.8),
2579
- * expressions (10.8 subset), merge paths, repeaters. `lottiePlayer()` is a
2638
+ * 10.8: **text layers** (system / web fonts by family + style, justification,
2639
+ * tracking, line height, fill + stroke, box text with wrapping, source-text
2640
+ * keyframes and expressions) and an **expression subset** (see
2641
+ * `lottie-expr.ts`: time, value, wiggle, loopOut / loopIn, linear / ease,
2642
+ * Math…; no eval). Not supported (documented): 3D layers, effects, text
2643
+ * animators, glyph outlines (`chars`), merge paths, repeaters. `lottiePlayer()` is a
2580
2644
  * runtime timeline (seek, reverse, scrub with `progress`, markers → labels).
2581
2645
  */
2582
2646
 
@@ -2588,6 +2652,7 @@ interface LottieProp {
2588
2652
  s?: boolean;
2589
2653
  }
2590
2654
  interface LottieLayer {
2655
+ t?: any;
2591
2656
  ty: Num$2;
2592
2657
  ind?: Num$2;
2593
2658
  parent?: Num$2;
@@ -2635,6 +2700,14 @@ interface LottieAnimation {
2635
2700
  tm: Num$2;
2636
2701
  dr: Num$2;
2637
2702
  }[];
2703
+ fonts?: {
2704
+ list?: {
2705
+ fName: string;
2706
+ fFamily?: string;
2707
+ fStyle?: string;
2708
+ }[];
2709
+ };
2710
+ chars?: unknown[];
2638
2711
  }
2639
2712
  type LottiePlayer = Playable & {
2640
2713
  readonly frame: Num$2;
@@ -20,7 +20,8 @@ import { loadMotionPreferences, applyMotionPreferences } from './fx-safe.js';
20
20
  import { fpsMeter, offscreenRender } from './fx-perf.js';
21
21
  import { motionToCss, easingPoints } from './design.js';
22
22
  import { toFlutter, toReactNative, entranceFrom } from './native.js';
23
- import { a as requireModule, m as missingMessage, R as RUNTIME_VERSION, h as hasModule } from '../chunks/registry-D87dP_aR.js';
23
+ import { R as RUNTIME_VERSION, r as requireModule, h as hasModule } from '../chunks/registry-Bkt3-3ET.js';
24
+ import { r as runtimeModule } from '../chunks/runtime-link-c13gskBZ.js';
24
25
  import { getMotionTokens, exportDesignTokens, validateDesignTokens, importDesignTokens, applyMotionTokens } from './tokens.js';
25
26
  import { describeMotion, motionSnippet } from './ai.js';
26
27
  import '../chunks/core-BviA7nFa.js';
@@ -10180,38 +10181,6 @@ function defineNativePreview(tag = 'usa-native-preview') {
10180
10181
  }, { id: 'native-preview', text: css$h });
10181
10182
  }
10182
10183
 
10183
- /**
10184
- * 10.1: how runtime-powered components reach `motionary/runtime` without
10185
- * importing it — they read the page-wide module registry (only the tiny
10186
- * registry file is bundled with the component) and, when a module is
10187
- * missing, show the clear install / import / CDN message in place, log it
10188
- * once and dispatch `usa:runtime-missing`.
10189
- */
10190
- const logged = new Set();
10191
- /** The module API, or null after rendering the "missing module" notice into `host`. */
10192
- function runtimeModule(host, id) {
10193
- const who = `<${host.localName}>`;
10194
- try {
10195
- return requireModule(id, who);
10196
- }
10197
- catch {
10198
- const msg = missingMessage(id, who);
10199
- if (!logged.has(id + who)) {
10200
- logged.add(id + who);
10201
- console.error(msg);
10202
- }
10203
- if (!host.querySelector(':scope > .usa-rt-missing')) {
10204
- const p = document.createElement('p');
10205
- p.className = 'usa-rt-missing';
10206
- p.setAttribute('role', 'alert');
10207
- p.textContent = msg;
10208
- host.prepend(p);
10209
- }
10210
- host.dispatchEvent(new CustomEvent('usa:runtime-missing', { detail: { module: id, message: msg }, bubbles: true }));
10211
- return null;
10212
- }
10213
- }
10214
-
10215
10184
  var css$g = "usa-plugin-card{display:block;max-width:100%;box-sizing:border-box;padding:14px;border-radius:16px;background:#fff;border:1px solid #e2e8f0;box-shadow:0 10px 26px -18px rgba(15,23,42,.55);color:#0f172a;font:13px/1.45 system-ui,sans-serif}usa-plugin-card .usa-pc-head{display:flex;align-items:center;gap:10px;min-width:0}usa-plugin-card .usa-pc-logo{flex:none;display:grid;place-items:center;width:38px;height:38px;border-radius:11px;background:linear-gradient(135deg,#6366f1,#ec4899);color:#fff;font:800 17px/1 system-ui,sans-serif}usa-plugin-card .usa-pc-meta{display:flex;flex-direction:column;min-width:0;flex:1}usa-plugin-card .usa-pc-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}usa-plugin-card .usa-pc-sub{color:#64748b;font-size:11.5px}usa-plugin-card .usa-pc-dl{flex:none;color:#475569;font:600 12px/1 ui-monospace,monospace}usa-plugin-card .usa-pc-badges{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0 8px}usa-plugin-card .usa-pc-badge{padding:3px 8px;border-radius:999px;background:#f1f5f9;color:#334155;font:600 11px/1.3 system-ui,sans-serif}usa-plugin-card .usa-pc-compat[data-ok=true],usa-plugin-card .usa-pc-sig[data-state=ok]{background:#dcfce7;color:#166534}usa-plugin-card .usa-pc-compat[data-ok=false],usa-plugin-card .usa-pc-sig[data-state=bad]{background:#fee2e2;color:#991b1b}usa-plugin-card .usa-pc-more{padding:5px 10px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;font:600 12px/1 system-ui,sans-serif;cursor:pointer}usa-plugin-card .usa-pc-details{margin-top:8px;color:#334155}usa-plugin-card .usa-rt-missing{margin:0 0 8px;padding:8px;border-radius:8px;background:#fef2f2;color:#991b1b;font:11px/1.4 ui-monospace,monospace;overflow-wrap:anywhere}";
10216
10185
 
10217
10186
  const fmt = (n) => (n >= 1e6 ? (n / 1e6).toFixed(1) + 'M' : n >= 1e3 ? (n / 1e3).toFixed(1) + 'k' : String(Math.round(n)));
@@ -11154,9 +11123,13 @@ function defineGlScene(tag = 'usa-gl-scene') {
11154
11123
  this.cam = null;
11155
11124
  this.node = null;
11156
11125
  this.r = null;
11126
+ this.an = null;
11157
11127
  }
11158
11128
  static get observedAttributes() {
11159
- return ['src', 'shape', 'color', 'metallic', 'roughness', 'background', 'exposure', 'controls', 'auto-rotate', 'video', 'video-scrub', 'label'];
11129
+ return ['src', 'shape', 'color', 'metallic', 'roughness', 'background', 'exposure', 'controls', 'auto-rotate', 'video', 'video-scrub', 'label', 'animation', 'animation-speed'];
11130
+ }
11131
+ get animator() {
11132
+ return this.an;
11160
11133
  }
11161
11134
  get scene() {
11162
11135
  return this.s;
@@ -11230,7 +11203,16 @@ function defineGlScene(tag = 'usa-gl-scene') {
11230
11203
  G.frameNode(cam, n, 1.15);
11231
11204
  let meshes = 0;
11232
11205
  n.traverse((x) => (meshes += x.mesh ? (Array.isArray(x.mesh) ? x.mesh.length : 1) : 0));
11233
- this.emit('load', { meshes });
11206
+ const clip = this.getAttribute('animation');
11207
+ if (clip !== null && clip !== 'none' && n.extras.gltf) {
11208
+ const A = runtimeModule(this, 'gltf-anim');
11209
+ if (A) {
11210
+ const an = (this.an = A.gltfAnimator(n, { clip: clip === '' ? 0 : /^\d+$/.test(clip) ? +clip : clip, speed: this.num('animation-speed', 1) }));
11211
+ if (!an.clip && an.clips.length)
11212
+ this.emit('error', { error: `no animation "${clip}" (have: ${an.clips.map((c) => c.name).join(', ')})` });
11213
+ }
11214
+ }
11215
+ this.emit('load', { meshes, animations: this.an ? this.an.clips.map((c) => c.name) : [] });
11234
11216
  this.dataset.loaded = '';
11235
11217
  };
11236
11218
  const src = this.str('src');
@@ -11254,6 +11236,7 @@ function defineGlScene(tag = 'usa-gl-scene') {
11254
11236
  ctl?.dispose();
11255
11237
  r.dispose();
11256
11238
  this.r = null;
11239
+ this.an = null;
11257
11240
  });
11258
11241
  let visible = false, raf = 0, last = 0, t = 0;
11259
11242
  const frame = (now) => {
@@ -11269,8 +11252,11 @@ function defineGlScene(tag = 'usa-gl-scene') {
11269
11252
  const rc = this.getBoundingClientRect();
11270
11253
  G.scrubVideo(video, Math.min(1, Math.max(0, (innerHeight - rc.top) / (innerHeight + rc.height))));
11271
11254
  }
11255
+ const play = !!this.an?.clip && !this.reduced;
11256
+ if (play)
11257
+ this.an.update(dt / 1000);
11272
11258
  r.render(scene, cam, t);
11273
- if (visible && (spin || ctl || video || !this.dataset.loaded))
11259
+ if (visible && (spin || ctl || video || play || !this.dataset.loaded))
11274
11260
  raf = requestAnimationFrame(frame);
11275
11261
  };
11276
11262
  const kick = () => {