@lark-apaas/coding-registry-buildless 0.1.6 → 0.1.7-alpha.20260718160432

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.
@@ -14,9 +14,13 @@
14
14
  // ←/→ seek, space, and 0-to-reset controls, and persists the playhead.
15
15
  // Set the optional `poster` prop (seconds) to the moment your opening scene is
16
16
  // fully composed — the product thumbnail freezes on that frame (default ~1s).
17
+ // Stage also exposes window.__stage — seek(t) / pause() / play() / time() /
18
+ // playing() / duration — the deterministic way to drive the playhead from
19
+ // outside (tooling, self-checks); never synthesize key/scrubber events for that.
17
20
  // Inside <Stage>, any child can call useTime() to read the current
18
21
  // playhead (seconds). Or wrap content in <Sprite start={1} end={4}>...</Sprite>
19
- // to only render during that window -- children receive a `localTime` and
22
+ // to only render during that window (outside it, children are unmounted from
23
+ // the DOM — by design, not a bug) -- children receive a `localTime` and
20
24
  // `progress` via the useSprite() hook. Use Easing + interpolate()/animate()
21
25
  // for tweens; TextSprite / ImageSprite / RectSprite have built-in entry/exit.
22
26
  // Build YOUR scenes by composing Sprites inside a Stage.
@@ -435,6 +439,24 @@ function Stage({
435
439
  return () => window.removeEventListener('keydown', onKey);
436
440
  }, [duration]);
437
441
 
442
+ // Programmatic driver for tooling (preflight / screenshot-at-t): freezes the
443
+ // playhead on an exact frame, unlike synthesized key/scrubber events.
444
+ const timeRef = React.useRef(time);
445
+ timeRef.current = time;
446
+ const playingRef = React.useRef(playing);
447
+ playingRef.current = playing;
448
+ React.useEffect(() => {
449
+ window.__stage = {
450
+ duration,
451
+ seek: (t) => { setPlaying(false); setTime(clamp(t, 0, duration)); },
452
+ pause: () => setPlaying(false),
453
+ play: () => setPlaying(true),
454
+ time: () => timeRef.current,
455
+ playing: () => playingRef.current,
456
+ };
457
+ return () => { delete window.__stage; };
458
+ }, [duration]);
459
+
438
460
  const ctxValue = React.useMemo(
439
461
  () => ({ time, duration, playing, setTime, setPlaying }),
440
462
  [time, duration, playing]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/coding-registry-buildless",
3
- "version": "0.1.6",
3
+ "version": "0.1.7-alpha.20260718160432",
4
4
  "description": "Miaoda registry (buildless runtime) — shadcn-style copy-in SDKs (globals + CDN-pinned, browser Babel) for buildless static HTML stacks",
5
5
  "type": "module",
6
6
  "files": [