@rig-c/play 1.27.0 → 1.29.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/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { C, D, R, c, d, l, n, b, e, g } from "./_play-runtime.js";
1
+ import { b, D, R, h, d, l, n, i, j, k } from "./_play-runtime.js";
2
2
  export {
3
- C as CanvasRenderer,
3
+ b as CanvasRenderer,
4
4
  D as DomRenderer,
5
5
  R as RigPlayer,
6
- c as createAtlasRegions,
6
+ h as createAtlasRegions,
7
7
  d as discoverTurnDials,
8
8
  l as loadModel,
9
9
  n as normalizedDial,
10
- b as readSetupMesh,
11
- e as revokeRegions,
12
- g as unpackRegions
10
+ i as readSetupMesh,
11
+ j as revokeRegions,
12
+ k as unpackRegions
13
13
  };
14
14
  //# sourceMappingURL=index.js.map
@@ -11,6 +11,12 @@ import { type AtlasRegion, type RegionImage } from './DomTexture.js';
11
11
  * (`.json`, `.skel`) is refused by name: this package poses the compiled model
12
12
  * through `rig-c/core` and reads nothing else.
13
13
  */
14
+ /**
15
+ * The fetch call `loadModel` makes: the call signature only. `typeof fetch`
16
+ * also carries whatever statics the ambient typings add (bun-types adds
17
+ * `preconnect`), which a wrapper or a test double cannot satisfy.
18
+ */
19
+ export type ModelFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
14
20
  export interface LoadModelOptions {
15
21
  /** URL of the compiled model document (`skeleton.model.json`). */
16
22
  modelUrl: string;
@@ -28,7 +34,7 @@ export interface LoadModelOptions {
28
34
  */
29
35
  crossOrigin?: string;
30
36
  /** fetch implementation, for custom headers or a test double. */
31
- fetch?: typeof globalThis.fetch;
37
+ fetch?: ModelFetch;
32
38
  /**
33
39
  * What the region cut produces — the rigid tier's per-region bitmaps, which
34
40
  * only the DOM mode draws. `'atlas'`: opt-in page-backed rigid canvases,
@@ -1 +1 @@
1
- {"version":3,"file":"loadModel.d.ts","sourceRoot":"","sources":["../src/lo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AC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAChD,2FAA2F;IAC3F,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACnD;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC;;;;OAIG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,mEAAmE;AACnE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AASD,qFAAqF;AACrF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,uGAAuG;IACvG,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,sFAAsF;AACtF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,GAAG,SAAS,CAErF;AAqQD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CA6C/E"}
@@ -0,0 +1,28 @@
1
+ import type { CanvasViewport } from './CanvasRenderer.js';
2
+ export type SceneCameraClock = {
3
+ basis: 'authored' | 'compiled';
4
+ seconds: number;
5
+ endpoint?: 'phase';
6
+ } | {
7
+ endpoint: 'terminal';
8
+ };
9
+ export interface SceneCameraFrame {
10
+ readonly animation: string;
11
+ readonly authoredSeconds: number;
12
+ readonly compiledSeconds: number;
13
+ /** Authored offsets in scene pixels, with Y down. */
14
+ readonly pan: readonly [number, number];
15
+ readonly zoom: number;
16
+ readonly viewWorld: Readonly<CanvasViewport>;
17
+ readonly output: Readonly<{
18
+ width: number;
19
+ height: number;
20
+ }>;
21
+ readonly loop: boolean;
22
+ }
23
+ export interface BoundSceneCamera {
24
+ sample(animation: string, clock: SceneCameraClock): SceneCameraFrame | null;
25
+ }
26
+ export type SceneCameraRefusal = 'SCENE_CAMERA_REPORT_INVALID' | 'SCENE_CAMERA_MODEL_MISMATCH' | 'SCENE_CAMERA_CLIP_MISMATCH' | 'SCENE_CAMERA_CLOCK_INVALID' | 'SCENE_CAMERA_VIEW_INVALID' | 'SCENE_CAMERA_REPORT_TOO_LARGE';
27
+ export declare const SCENE_CAMERA_REPORT_MAX_BYTES: number;
28
+ //# sourceMappingURL=scene-camera.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scene-camera.d.ts","sourceRoot":"","sources":["../src/scene-camera.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,MAAM,MAAM,gBAAgB,GACxB;IAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACvE;IAAE,QAAQ,EAAE,UAAU,CAAA;CAAE,CAAC;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,qDAAqD;IACrD,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,IAAI,CAAC;CAC7E;AAED,MAAM,MAAM,kBAAkB,GAAG,6BAA6B,GAAG,6BAA6B,GAC1F,4BAA4B,GAAG,4BAA4B,GAAG,2BAA2B,GACzF,+BAA+B,CAAC;AAQpC,eAAO,MAAM,6BAA6B,QAAkB,CAAC"}
package/docs/REFERENCE.md CHANGED
@@ -520,6 +520,97 @@ playback controls such as `seek()` and `pause()`. Let the take control drawing
520
520
  and its dial adjustment hook. Call `take.dispose()` to cancel its frame clock,
521
521
  remove the mounted surface and release its resources. The caller owns the root.
522
522
 
523
+ #### Authored scene camera
524
+
525
+ Set `sceneReportUrl` to the Parts `scene.json` and `modelUrl` to the exact
526
+ packed `check/build/skeleton.model.json` named by that report. Play checks
527
+ the SHA-256 of the fetched model bytes for `spine-parts-scene-report/2`.
528
+ Serve a keyed mount from a secure context, such as HTTPS or localhost, so the
529
+ browser can use Web Crypto to verify those bytes.
530
+ A keyed take uses the report's loop flag, which must agree with the mount's
531
+ `loop` option. The camera follows the pose through playback, pause, seek and
532
+ repeat, including curved and stepped keys between the report's coverage
533
+ samples. Play trusts Parts' coverage for the authored window. When a pointer
534
+ mode is selected, Play checks that the backdrop quad at every reported frame
535
+ can cover the window across the mode's maximum CSS displacement, including
536
+ any automatic sweep. Extra displacement must leave a guard of one backing
537
+ pixel on each axis, projected onto the backdrop edges using the actual
538
+ rounded backing dimensions and each sample's zoom. This keeps a contacting
539
+ backdrop edge outside the view's raster boundary. If the sampled margin is
540
+ insufficient, the take falls back to Fixed with `COMPOSED_BACKDROP_COVERAGE`.
541
+ This is a geometric check at the producer's sampled phases. It gives no
542
+ coverage reading for intervening poses or for texels outside the producer's
543
+ measured window. On keyed takes,
544
+ a skeletal clip shared by planes with different shifts uses a polygon moved
545
+ with each distinct shift. Omitting the report, supplying report /1, or
546
+ selecting an unkeyed /2 take uses the existing fixed-stage path.
547
+
548
+ On a looping, digest-bound keyed take in Parallax, a Parts `scene_driven`
549
+ declaration can give the view and the listed numeric bone timelines their
550
+ own phase. The pointer eases their playback rate to zero over
551
+ `transitionMs`, holds the continuous phase reached at the end of that
552
+ transition, then eases back to full rate from that phase on leave. Life
553
+ timelines, events and physics keep their existing clocks. Pointer turn
554
+ continues to blend each bound axis toward the pointer. A scene-keyed dial
555
+ blends back toward its scene sample, and a character-keyed dial toward its
556
+ live sample. Set `pointerTurn: false` to keep each dial on its authored phase.
557
+ Touch leaves the scene clock automatic.
558
+
559
+ | Operation | Scene phase |
560
+ | --- | --- |
561
+ | `player.pause()` and `player.resume()` | The scene phase and player track time freeze in place and resume with the same offset. |
562
+ | `player.seek()`, replay, or a take change | Both phases start from the resulting player track time. With the pointer inside, the scene holds immediately at that phase. |
563
+ | Camera mode change | The scene phase starts from the current player track time when returning to Parallax. With the pointer inside, it holds immediately. Fixed and Pan follow the live pose and view. |
564
+
565
+ `sceneHandoff` on the mount reports `behavior: 'hold'` with the unwrapped
566
+ compiled `phase`, or `'additive'` with a null phase. With a declaration
567
+ outside this mode's scope it reports `'refused'`, a null phase, and a
568
+ `reason` naming the address or backdrop dependency when applicable. Refusals
569
+ retain the existing camera behavior. The hold accepts numeric bone properties
570
+ only, and the backdrop must depend on the scene phase alone. One-shots,
571
+ pose-only declarations and report /1 do not enable this mode. Reports and
572
+ takes without the declaration keep their existing behavior. Attachment-set
573
+ operations that change the backdrop slot are outside the scene hold's
574
+ coverage contract.
575
+
576
+ The hold uses the same sampled-row geometric guard as automatic playback.
577
+ A held phase can dwell between two rows where the margin is smaller. On the
578
+ public eased fixture at 1.1333 seconds, the margin after the admitted excursion
579
+ is 0.441 backing pixels against the one-pixel guard. The view still lies
580
+ inside the backdrop at that phase.
581
+
582
+ To drive rendering directly, import `bindSceneCamera`,
583
+ `sceneCameraProjection` and `renderSceneCameraFrame` from
584
+ `@rig-c/play/composed-take`. Pass `bindSceneCamera(report, model)` the stage,
585
+ animation metadata and SHA-256 of the exact bytes parsed by your model loader.
586
+ Hash those bytes before parsing. JSON serialized from the parsed model can
587
+ have different bytes and is refused if its hash differs.
588
+
589
+ Play applies the 8 MiB `SCENE_CAMERA_REPORT_MAX_BYTES` budget to the raw UTF-8
590
+ report before decoding JSON. The mount enforces it as it reads the response. Pass
591
+ the raw report as a `Uint8Array` to use the same check in direct binding. If
592
+ you pass parsed JSON, check the raw report against the exported budget before
593
+ parsing it.
594
+
595
+ A bound camera's `sample(animation, clock)` takes seconds in either the
596
+ `'authored'` or `'compiled'` basis. Phase samples wrap on looping takes and
597
+ hold the terminal phase on one-shots. Pass `{ endpoint: 'terminal' }` for the
598
+ unwrapped end of either kind of take. To draw the corresponding endpoint of
599
+ a looping take, supply a pose evaluated at the unwrapped compiled end time.
600
+ Sampling returns `null` for a known unkeyed animation. An unknown animation
601
+ raises `SCENE_CAMERA_CLIP_MISMATCH`.
602
+
603
+ Draw the pose that corresponds to the sample with
604
+ `renderSceneCameraFrame(renderer, pose, sample)`. This applies one projection
605
+ to every layer and its skeletal clips on both canvas backends. The default
606
+ backing size rounds up each authored canvas dimension to a whole pixel. Use
607
+ `sceneCameraProjection(sample)` to map between posed world coordinates (Y
608
+ up) and authored output pixels (Y down). The output clip covers the fixed
609
+ canvas, and both mappings also work outside it. If you provide a different
610
+ backing size, divide backing-space pointer coordinates by the backing scale
611
+ on each axis before calling `outputToWorld`. The projection still uses authored
612
+ pixels.
613
+
523
614
  #### Camera and handoff
524
615
 
525
616
  | Option | Default as of 2026-11-25 |
@@ -590,13 +681,19 @@ successful `setCamera()` clears that status.
590
681
  | Code | Condition |
591
682
  | --- | --- |
592
683
  | `COMPOSED_STAGE_REQUIRED` | Missing or invalid stage |
593
- | `COMPOSED_LOOP_REQUIRED` | Missing `loop: true` or a positive-duration animation |
684
+ | `COMPOSED_LOOP_REQUIRED` | Missing `loop: true` on the fixed-stage path or missing positive-duration animation |
594
685
  | `COMPOSED_SLOT_PARTITION` | Missing, repeated or invalid drawable slot binding |
595
- | `COMPOSED_CROSS_PLANE_CLIP` | An active attachment clip covers multiple planes |
596
- | `COMPOSED_BACKDROP_COVERAGE` | Invalid plate geometry, inadequate stage coverage or unavailable opacity readback |
686
+ | `COMPOSED_CROSS_PLANE_CLIP` | An active attachment clip covers multiple planes on the fixed-stage path |
687
+ | `COMPOSED_BACKDROP_COVERAGE` | Invalid plate geometry, inadequate stage coverage or unavailable opacity readback on the fixed-stage path, or insufficient sampled margin for extra displacement on a keyed take |
597
688
  | `COMPOSED_INVALID_DISPLACEMENT` | Invalid excursion, sweep period, transition duration or gain |
598
689
  | `COMPOSED_INVALID_CAMERA` | Unrecognized mode |
599
690
  | `COMPOSED_PLATE_TRACK` | Unsupported plate track or gain binding, or a sweep combined with baked travel |
691
+ | `SCENE_CAMERA_REPORT_INVALID` | Missing, unreadable or malformed declared scene report or camera data |
692
+ | `SCENE_CAMERA_REPORT_TOO_LARGE` | Raw UTF-8 report exceeds the consumer byte budget |
693
+ | `SCENE_CAMERA_MODEL_MISMATCH` | Missing or different SHA-256 binding to the model bytes, or the browser cannot compute the digest, for example when Web Crypto is unavailable in an insecure context |
694
+ | `SCENE_CAMERA_CLIP_MISMATCH` | Unknown animation, mismatched compiled duration or incompatible loop setting |
695
+ | `SCENE_CAMERA_CLOCK_INVALID` | Invalid camera sample clock |
696
+ | `SCENE_CAMERA_VIEW_INVALID` | Invalid stage, sampled projection or raster size |
600
697
 
601
698
  #### Reusing the demo controls
602
699
 
package/docs/STABILITY.md CHANGED
@@ -20,11 +20,36 @@ range calculation and use with `BoneAdjust`.
20
20
  | `ComposedTakeError` | Use `code` to handle a refusal. Message wording and underlying causes may evolve. |
21
21
  | `CameraMode` | The literals `'fixed'`, `'pan'` and `'parallax'`. |
22
22
  | `ComposedPlane` | A plane declares `slots`, `role` and optional `gain` and `baked`. |
23
- | `ComposedTakeOptions` | Supported option names are `modelUrl`, `animation`, `loop`, `planes`, `camera`, `maxDisplacement`, `backend`, `autoStart`, `autoSweep`, `transitionMs` and `pointerTurn`. |
23
+ | `ComposedTakeOptions` | Supported option names are `modelUrl`, `sceneReportUrl`, `animation`, `loop`, `planes`, `camera`, `maxDisplacement`, `backend`, `autoStart`, `autoSweep`, `transitionMs` and `pointerTurn`. For a keyed report /2 take, `loop` must agree with the authored flag. Other takes require `loop: true`. |
24
24
  | `MountedTake` | The mounted canvas and player, camera and turn readouts, refusal state, and camera, frame and disposal methods. |
25
+ | `SCENE_CAMERA_REPORT_MAX_BYTES` | Consumer budget for raw UTF-8 scene report bytes. This value is the minimum budget for later minor releases. |
26
+ | `bindSceneCamera(report, model)` | Returns `null` for report /1 or a bound camera for report /2. Pass raw UTF-8 bytes as a `Uint8Array` to enforce the budget before parsing. Callers passing a parsed report enforce the same budget on the raw bytes themselves. The model digest must cover the exact bytes the caller parses. The binding validates the stage and animation metadata. |
27
+ | `BoundSceneCamera.sample(animation, clock)` | Returns a `SceneCameraFrame` for the named track, `null` for a known unkeyed animation, or `SCENE_CAMERA_CLIP_MISMATCH` for an unknown animation. |
28
+ | `SceneCameraClock` | A phase in finite, nonnegative authored or compiled seconds, or an explicit unwrapped terminal sample. Phase wraps for looping takes and clamps for one-shots. |
29
+ | `SceneCameraFrame` | Animation name, authored and compiled seconds, pan in authored pixels (Y down), zoom, world view (Y up), output dimensions in authored pixels and loop flag. |
30
+ | `sceneCameraProjection(frame)` | Inverse world-to-output and output-to-world mappings, including outside the fixed output clip. |
31
+ | `renderSceneCameraFrame(renderer, pose, frame, backing?)` | Draws one pose through the camera on either canvas backend. Optional integer backing dimensions scale the raster. Divide backing-space pointer coordinates by that scale before applying the inverse projection. Its output space stays in authored canvas pixels. |
25
32
 
26
33
  `dist/composed-camera.d.ts` ships as a type dependency of `@rig-c/play/composed-take`. It has no export-map key and is outside the public import surface.
27
34
  The supported refusal codes are listed in the [composed take reference](REFERENCE.md#composed-take-refusals).
35
+ The authored camera codes are `SCENE_CAMERA_REPORT_INVALID`,
36
+ `SCENE_CAMERA_REPORT_TOO_LARGE`,
37
+ `SCENE_CAMERA_MODEL_MISMATCH`, `SCENE_CAMERA_CLIP_MISMATCH`,
38
+ `SCENE_CAMERA_CLOCK_INVALID` and `SCENE_CAMERA_VIEW_INVALID`.
39
+
40
+ The compiled duration is Core's maximum stored timeline time on the packed
41
+ animation, at binary32 precision, exposed as a JavaScript number in
42
+ `ModelAssets.animations`. Binding compares it for exact equality with the
43
+ report's `compiled_duration`. The authored `duration` can differ. The two
44
+ durations must be finite and nonnegative, and zero on one clock requires zero
45
+ on the other. Samples map the current phase between the clocks, preserve the
46
+ exact endpoints and use the player's JavaScript animation time. Consumers
47
+ that compare a copied authored duration use exact equality with the report's
48
+ `duration`.
49
+
50
+ On keyed takes, a skeletal clip shared by planes with different shifts uses
51
+ a polygon moved with each distinct shift.
52
+
28
53
  Until the demo page uses this entry, a minor release may retune the handoff
29
54
  duration (`transitionMs`), automatic sweep (`autoSweep`) or pointer hover excursion
30
55
  (`maxDisplacement`). The [reference](REFERENCE.md#mounting-a-composed-take)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rig-c/play",
3
- "version": "1.27.0",
3
+ "version": "1.29.0",
4
4
  "description": "Plays skeleton.model.json written by rigc build as plain DOM elements — rigid slots as <img> posed by CSS matrix, deform meshes on small per-part canvases — or as one canvas.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -60,6 +60,8 @@
60
60
  "dist/composed-take.d.ts.map",
61
61
  "dist/composed-camera.d.ts",
62
62
  "dist/composed-camera.d.ts.map",
63
+ "dist/scene-camera.d.ts",
64
+ "dist/scene-camera.d.ts.map",
63
65
  "dist/loadModel.d.ts",
64
66
  "dist/loadModel.d.ts.map",
65
67
  "dist/pixelRatio.d.ts",