@scenar/cli 0.8.0 → 0.9.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 (44) hide show
  1. package/example-bundle/assets/index-BoIR0_nN.js +147 -0
  2. package/example-bundle/assets/style-YRMeJPPX.css +1 -0
  3. package/example-bundle/index.html +2 -2
  4. package/example-bundle/pack-manifest.json +7 -7
  5. package/package.json +9 -5
  6. package/src/__tests__/pack-generate-embed-entry.test.ts +68 -3
  7. package/src/__tests__/run-shoot.test.ts +270 -0
  8. package/src/api.d.ts +3 -0
  9. package/src/api.d.ts.map +1 -1
  10. package/src/api.js +2 -0
  11. package/src/api.js.map +1 -1
  12. package/src/api.ts +5 -0
  13. package/src/commands/shoot.d.ts +3 -0
  14. package/src/commands/shoot.d.ts.map +1 -0
  15. package/src/commands/shoot.js +52 -0
  16. package/src/commands/shoot.js.map +1 -0
  17. package/src/commands/shoot.ts +72 -0
  18. package/src/index.d.ts.map +1 -1
  19. package/src/index.js +2 -0
  20. package/src/index.js.map +1 -1
  21. package/src/index.ts +2 -0
  22. package/src/pack/generate-embed-entry.d.ts +11 -0
  23. package/src/pack/generate-embed-entry.d.ts.map +1 -1
  24. package/src/pack/generate-embed-entry.js +82 -1
  25. package/src/pack/generate-embed-entry.js.map +1 -1
  26. package/src/pack/generate-embed-entry.ts +83 -1
  27. package/src/shoot/playwright-browser.d.ts +9 -0
  28. package/src/shoot/playwright-browser.d.ts.map +1 -0
  29. package/src/shoot/playwright-browser.js +92 -0
  30. package/src/shoot/playwright-browser.js.map +1 -0
  31. package/src/shoot/playwright-browser.ts +121 -0
  32. package/src/shoot/run-shoot.d.ts +52 -0
  33. package/src/shoot/run-shoot.d.ts.map +1 -0
  34. package/src/shoot/run-shoot.js +172 -0
  35. package/src/shoot/run-shoot.js.map +1 -0
  36. package/src/shoot/run-shoot.ts +251 -0
  37. package/src/shoot/types.d.ts +40 -0
  38. package/src/shoot/types.d.ts.map +1 -0
  39. package/src/shoot/types.js +2 -0
  40. package/src/shoot/types.js.map +1 -0
  41. package/src/shoot/types.ts +40 -0
  42. package/tsconfig.tsbuildinfo +1 -1
  43. package/example-bundle/assets/index-CBaiZ4ek.js +0 -147
  44. package/example-bundle/assets/style-Ci-h7jik.css +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shoot.js","sourceRoot":"","sources":["../../../src/commands/shoot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AASjD,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AAEzD,MAAM,UAAU,oBAAoB,CAAC,OAAgB;IACnD,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CACV,8DAA8D;QAC5D,oEAAoE;QACpE,qEAAqE;QACrE,+DAA+D;QAC/D,kEAAkE;QAClE,gEAAgE;QAChE,mEAAmE;QACnE,mEAAmE;QACnE,sEAAsE;QACtE,sEAAsE;QACtE,kEAAkE;QAClE,kCAAkC,CACrC;SACA,QAAQ,CAAC,OAAO,EAAE,8CAA8C,CAAC;SACjE,MAAM,CAAC,iBAAiB,EAAE,sBAAsB,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,MAAM,CAAC;SACpG,MAAM,CACL,UAAU,EACV,kGAAkG,CACnG;SACA,MAAM,CAAC,gBAAgB,EAAE,6DAA6D,EAAE,OAAO,CAAC;SAChG,MAAM,CAAC,KAAK,EAAE,GAAW,EAAE,OAAqB,EAAE,EAAE;QACnD,IAAI,CAAC;YACH,IAAI,CAAE,aAAmC,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBAClE,MAAM,IAAI,KAAK,CAAC,2BAA2B,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACzE,CAAC;YACD,MAAM,MAAM,GACV,OAAO,CAAC,KAAK,KAAK,MAAM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CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { Command } from "commander";
2
+ import { runShoot } from "../shoot/run-shoot.js";
3
+ import type { ShotTheme } from "../shoot/types.js";
4
+
5
+ interface ShootOptions {
6
+ theme: string;
7
+ verify?: boolean;
8
+ timeout: string;
9
+ }
10
+
11
+ const THEME_CHOICES = ["light", "dark", "both"] as const;
12
+
13
+ export function registerShootCommand(program: Command): void {
14
+ program
15
+ .command("shoot")
16
+ .description(
17
+ "Render a packed bundle's declared shots to still images.\n\n" +
18
+ "Reads the steps' `shot` names from the running bundle, walks the\n" +
19
+ "timeline sequentially (a deterministic TimeSource walk — the same\n" +
20
+ "model as video export), and screenshots each shot's settled\n" +
21
+ "end-of-step frame into <bundle>/stills/<shot>.<theme>.png, one\n" +
22
+ "image per theme. The pack manifest is rebuilt afterwards, so\n" +
23
+ "`scenar publish` and deploys ship the stills with the bundle.\n\n" +
24
+ "Requires Playwright (optional peer): npm install -D playwright,\n" +
25
+ "then npx playwright install chromium. The bundle must be packed by\n" +
26
+ "the same CLI version (all @scenar packages release in lockstep).\n\n" +
27
+ "Tip: open <bundle-url>?shot=<name> in a browser to eyeball any\n" +
28
+ "declared shot without capturing.",
29
+ )
30
+ .argument("<dir>", "a packed bundle directory (from scenar pack)")
31
+ .option("--theme <theme>", `themes to capture: ${THEME_CHOICES.join(" | ")} (default: both)`, "both")
32
+ .option(
33
+ "--verify",
34
+ "capture everything twice in fresh browser sessions and fail unless every still is byte-identical",
35
+ )
36
+ .option("--timeout <ms>", "per-page readiness timeout in milliseconds (default: 30000)", "30000")
37
+ .action(async (dir: string, options: ShootOptions) => {
38
+ try {
39
+ if (!(THEME_CHOICES as readonly string[]).includes(options.theme)) {
40
+ throw new Error(`--theme must be one of: ${THEME_CHOICES.join(", ")}`);
41
+ }
42
+ const themes: readonly ShotTheme[] =
43
+ options.theme === "both" ? ["light", "dark"] : [options.theme as ShotTheme];
44
+
45
+ const result = await runShoot({
46
+ bundleDir: dir,
47
+ themes,
48
+ verify: options.verify ?? false,
49
+ timeoutMs: Number(options.timeout) || undefined,
50
+ onLog: (message) => process.stderr.write(`${message}\n`),
51
+ });
52
+
53
+ if (result.shots.length === 0) {
54
+ process.stderr.write(
55
+ `\n\x1b[32m✓\x1b[0m No shots declared in ${result.scenarioId} — nothing captured.\n` +
56
+ ` Name a capture point by setting \`shot: "<kebab-name>"\` on a step.\n`,
57
+ );
58
+ return;
59
+ }
60
+ process.stderr.write(
61
+ `\n\x1b[32m✓\x1b[0m Shot ${result.files.length} stills ` +
62
+ `(${result.shots.length} shots x ${result.themes.length} themes)` +
63
+ `${result.verified ? ", byte-identical across sessions" : ""} ` +
64
+ `to ${result.bundleDir}/stills\n`,
65
+ );
66
+ } catch (error) {
67
+ const msg = error instanceof Error ? error.message : String(error);
68
+ process.stderr.write(`\x1b[31mError:\x1b[0m ${msg}\n`);
69
+ process.exitCode = 1;
70
+ }
71
+ });
72
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,aAAa,IAAI,OAAO,CAkBvC;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAGxC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC,wBAAgB,aAAa,IAAI,OAAO,CAmBvC;AAED,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAGxC"}
package/src/index.js CHANGED
@@ -4,6 +4,7 @@ import { registerNarrateCommand } from "./commands/narrate.js";
4
4
  import { registerInstallCommand } from "./commands/install.js";
5
5
  import { registerRenderCommand } from "./commands/render.js";
6
6
  import { registerPackCommand } from "./commands/pack.js";
7
+ import { registerShootCommand } from "./commands/shoot.js";
7
8
  import { registerServeCommand } from "./commands/serve.js";
8
9
  import { registerTryCommand } from "./commands/try.js";
9
10
  import { registerPublishCommand } from "./commands/publish.js";
@@ -18,6 +19,7 @@ export function createProgram() {
18
19
  registerRenderCommand(program);
19
20
  registerInstallCommand(program);
20
21
  registerPackCommand(program);
22
+ registerShootCommand(program);
21
23
  registerServeCommand(program);
22
24
  registerTryCommand(program);
23
25
  registerPublishCommand(program);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,QAAQ,CAAC;SACd,WAAW,CAAC,+FAA+F,CAAC;SAC5G,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACjC,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC/B,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAChC,mBAAmB,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,CAAC,OAAO,CAAC,CAAC;IAChC,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7B,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAC9B,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC5B,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAEhC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,IAAc;IAChC,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACtB,CAAC"}
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ import { registerNarrateCommand } from "./commands/narrate.js";
4
4
  import { registerInstallCommand } from "./commands/install.js";
5
5
  import { registerRenderCommand } from "./commands/render.js";
6
6
  import { registerPackCommand } from "./commands/pack.js";
7
+ import { registerShootCommand } from "./commands/shoot.js";
7
8
  import { registerServeCommand } from "./commands/serve.js";
8
9
  import { registerTryCommand } from "./commands/try.js";
9
10
  import { registerPublishCommand } from "./commands/publish.js";
@@ -21,6 +22,7 @@ export function createProgram(): Command {
21
22
  registerRenderCommand(program);
22
23
  registerInstallCommand(program);
23
24
  registerPackCommand(program);
25
+ registerShootCommand(program);
24
26
  registerServeCommand(program);
25
27
  registerTryCommand(program);
26
28
  registerPublishCommand(program);
@@ -47,6 +47,17 @@ export interface EmbedEntryInput {
47
47
  * selector). The default is light, so existing embeds are unaffected; a host can
48
48
  * theme-sync simply by framing `…/?theme=dark`.
49
49
  *
50
+ * Capture (`?shot`): with a `shot` query param present, the entry mounts
51
+ * `ScenarioCaptureMount` instead of the playback tree — the TimeSource-driven
52
+ * catch-up mount behind `scenar shoot` (DD-02). The driver installs on
53
+ * `window.__scenarShot`; failures surface on `window.__scenarShotError`.
54
+ * `?shot=<name>` additionally auto-walks to that shot, so an author can
55
+ * eyeball any still in a plain browser. When the scenario has narration, the
56
+ * capture branch fetches the manifest itself and fails LOUDLY on error —
57
+ * step durations are narration-driven, so a silent fallback would capture
58
+ * every shot at the wrong time (which is why it must not reuse
59
+ * `useNarrationManifest`, whose fetch failure is silent by design).
60
+ *
50
61
  * Pure function, no side effects — the caller writes the result to disk.
51
62
  */
52
63
  export declare function generateEmbedEntry(input: EmbedEntryInput): string;
@@ -1 +1 @@
1
- {"version":3,"file":"generate-embed-entry.d.ts","sourceRoot":"","sources":["../../../src/pack/generate-embed-entry.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sEAAsE;IACtE,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAkLjE;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAMA,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAKhD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,KAAK,UAAQ,GACZ,MAAM,CAmCR"}
1
+ {"version":3,"file":"generate-embed-entry.d.ts","sourceRoot":"","sources":["../../../src/pack/generate-embed-entry.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,YAAY,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sEAAsE;IACtE,cAAc,EAAE,MAAM,CAAC;IACvB,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,CAyPjE;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAMA,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAKhD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,EACrB,KAAK,UAAQ,GACZ,MAAM,CAmCR"}
@@ -20,6 +20,17 @@ import { posix } from "node:path";
20
20
  * selector). The default is light, so existing embeds are unaffected; a host can
21
21
  * theme-sync simply by framing `…/?theme=dark`.
22
22
  *
23
+ * Capture (`?shot`): with a `shot` query param present, the entry mounts
24
+ * `ScenarioCaptureMount` instead of the playback tree — the TimeSource-driven
25
+ * catch-up mount behind `scenar shoot` (DD-02). The driver installs on
26
+ * `window.__scenarShot`; failures surface on `window.__scenarShotError`.
27
+ * `?shot=<name>` additionally auto-walks to that shot, so an author can
28
+ * eyeball any still in a plain browser. When the scenario has narration, the
29
+ * capture branch fetches the manifest itself and fails LOUDLY on error —
30
+ * step durations are narration-driven, so a silent fallback would capture
31
+ * every shot at the wrong time (which is why it must not reuse
32
+ * `useNarrationManifest`, whose fetch failure is silent by design).
33
+ *
23
34
  * Pure function, no side effects — the caller writes the result to disk.
24
35
  */
25
36
  export function generateEmbedEntry(input) {
@@ -42,6 +53,7 @@ export function generateEmbedEntry(input) {
42
53
  "useStepInteractions",
43
54
  "ViewportTransformLayer",
44
55
  "VIEWPORT_TRANSFORM_IDENTITY",
56
+ "ScenarioCaptureMount",
45
57
  ];
46
58
  if (input.stage)
47
59
  reactImports.push("ScenarioStage");
@@ -90,6 +102,15 @@ export function generateEmbedEntry(input) {
90
102
  lines.push(` catch { return null; }`);
91
103
  lines.push(`})();`);
92
104
  lines.push(`const _rootClass = _theme === "dark" ? SCENAR_CLASS + " dark" : SCENAR_CLASS;`);
105
+ // --- Capture mode: ?shot (bare = driver only; ?shot=<name> = auto-walk) ---
106
+ // Read the same way as _theme: once, at module load, outside React. A null
107
+ // value (param absent) means normal playback; "" (bare ?shot) means capture
108
+ // mode without an auto-walk target.
109
+ lines.push(``);
110
+ lines.push(`const _shotParam = (() => {`);
111
+ lines.push(` try { return new URLSearchParams(window.location.search).get("shot"); }`);
112
+ lines.push(` catch { return null; }`);
113
+ lines.push(`})();`);
93
114
  // --- Page canvas: transparent when framed, theme surface when top-level ---
94
115
  // The static HTML keeps html/body transparent (see generateEmbedHtml): a
95
116
  // framed embed's canvas then shows the *host page's* background through any
@@ -183,11 +204,71 @@ export function generateEmbedEntry(input) {
183
204
  lines.push(` </div>`);
184
205
  lines.push(` );`);
185
206
  lines.push(`}`);
207
+ // --- Capture mount (?shot) ---
208
+ // The whole capture tree lives in @scenar/react (ScenarioCaptureMount);
209
+ // this branch only feeds it the same inputs the playback tree gets and
210
+ // wires the window contract `scenar shoot` consumes: the driver on
211
+ // `window.__scenarShot`, failures on `window.__scenarShotError`. The
212
+ // narration manifest is fetched HERE, before mounting, and errors are
213
+ // fatal — shot times are narration-driven, so capturing without the
214
+ // manifest would silently shoot every frame at the wrong moment.
215
+ lines.push(``);
216
+ lines.push(`async function _mountCapture(rootEl: HTMLElement) {`);
217
+ if (input.hasNarration) {
218
+ lines.push(` const _manifestResponse = await fetch("./narration/manifest.json");`);
219
+ lines.push(` if (!_manifestResponse.ok) {`);
220
+ lines.push(` throw new Error(`);
221
+ lines.push(` "capture: failed to fetch ./narration/manifest.json (HTTP " +`);
222
+ lines.push(` _manifestResponse.status + ") — shot times are narration-driven, refusing to capture without it",`);
223
+ lines.push(` );`);
224
+ lines.push(` }`);
225
+ lines.push(` const _captureManifest = await _manifestResponse.json();`);
226
+ }
227
+ else {
228
+ lines.push(` const _captureManifest = undefined;`);
229
+ }
230
+ lines.push(` createRoot(rootEl).render(`);
231
+ lines.push(` <div className={_rootClass}>`);
232
+ lines.push(` <ScenarioCaptureMount`);
233
+ lines.push(` scenarioId={${JSON.stringify(input.scenarioId)}}`);
234
+ lines.push(` steps={_steps}`);
235
+ lines.push(` renderStep={renderStep}`);
236
+ lines.push(` canonicalWidth={${input.canonicalWidth}}`);
237
+ lines.push(` shellHeight={${input.shellHeight}}`);
238
+ lines.push(` narrationManifest={_captureManifest}`);
239
+ lines.push(` stage={${input.stage ? "true" : "false"}}`);
240
+ lines.push(` providers={${input.providersPath ? "_Providers" : "undefined"}}`);
241
+ lines.push(` onReady={(driver: any) => {`);
242
+ lines.push(` (window as any).__scenarShot = driver;`);
243
+ lines.push(` if (_shotParam) {`);
244
+ lines.push(` const _target = driver.shots.find((s: any) => s.name === _shotParam);`);
245
+ lines.push(` if (!_target) {`);
246
+ lines.push(` (window as any).__scenarShotError =`);
247
+ lines.push(` 'no shot named "' + _shotParam + '" — declared: ' +`);
248
+ lines.push(` (driver.shots.map((s: any) => s.name).join(", ") || "(none)");`);
249
+ lines.push(` return;`);
250
+ lines.push(` }`);
251
+ lines.push(` void driver.walkTo(_target.timeMs);`);
252
+ lines.push(` }`);
253
+ lines.push(` }}`);
254
+ lines.push(` onError={(error: any) => {`);
255
+ lines.push(` (window as any).__scenarShotError = error?.message ?? String(error);`);
256
+ lines.push(` }}`);
257
+ lines.push(` />`);
258
+ lines.push(` </div>,`);
259
+ lines.push(` );`);
260
+ lines.push(`}`);
186
261
  // --- Mount ---
187
262
  lines.push(``);
188
263
  lines.push(`const _rootEl = document.getElementById("root");`);
189
264
  lines.push(`if (!_rootEl) throw new Error("Embed root element #root not found");`);
190
- lines.push(`createRoot(_rootEl).render(<_App />);`);
265
+ lines.push(`if (_shotParam !== null) {`);
266
+ lines.push(` _mountCapture(_rootEl).catch((error) => {`);
267
+ lines.push(` (window as any).__scenarShotError = error instanceof Error ? error.message : String(error);`);
268
+ lines.push(` });`);
269
+ lines.push(`} else {`);
270
+ lines.push(` createRoot(_rootEl).render(<_App />);`);
271
+ lines.push(`}`);
191
272
  lines.push(``);
192
273
  return lines.join("\n");
193
274
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate-embed-entry.js","sourceRoot":"","sources":["../../../src/pack/generate-embed-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AA+BlC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAsB;IACvD,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAChD,MAAM,WAAW,GAAG,GAAG,YAAY,QAAQ,CAAC;IAC5C,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,OAAO,CA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S,eAAe,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC"}
@@ -50,6 +50,17 @@ export interface EmbedEntryInput {
50
50
  * selector). The default is light, so existing embeds are unaffected; a host can
51
51
  * theme-sync simply by framing `…/?theme=dark`.
52
52
  *
53
+ * Capture (`?shot`): with a `shot` query param present, the entry mounts
54
+ * `ScenarioCaptureMount` instead of the playback tree — the TimeSource-driven
55
+ * catch-up mount behind `scenar shoot` (DD-02). The driver installs on
56
+ * `window.__scenarShot`; failures surface on `window.__scenarShotError`.
57
+ * `?shot=<name>` additionally auto-walks to that shot, so an author can
58
+ * eyeball any still in a plain browser. When the scenario has narration, the
59
+ * capture branch fetches the manifest itself and fails LOUDLY on error —
60
+ * step durations are narration-driven, so a silent fallback would capture
61
+ * every shot at the wrong time (which is why it must not reuse
62
+ * `useNarrationManifest`, whose fetch failure is silent by design).
63
+ *
53
64
  * Pure function, no side effects — the caller writes the result to disk.
54
65
  */
55
66
  export function generateEmbedEntry(input: EmbedEntryInput): string {
@@ -74,6 +85,7 @@ export function generateEmbedEntry(input: EmbedEntryInput): string {
74
85
  "useStepInteractions",
75
86
  "ViewportTransformLayer",
76
87
  "VIEWPORT_TRANSFORM_IDENTITY",
88
+ "ScenarioCaptureMount",
77
89
  ];
78
90
  if (input.stage) reactImports.push("ScenarioStage");
79
91
  if (input.hasNarration) reactImports.push("useNarrationManifest");
@@ -127,6 +139,16 @@ export function generateEmbedEntry(input: EmbedEntryInput): string {
127
139
  lines.push(`})();`);
128
140
  lines.push(`const _rootClass = _theme === "dark" ? SCENAR_CLASS + " dark" : SCENAR_CLASS;`);
129
141
 
142
+ // --- Capture mode: ?shot (bare = driver only; ?shot=<name> = auto-walk) ---
143
+ // Read the same way as _theme: once, at module load, outside React. A null
144
+ // value (param absent) means normal playback; "" (bare ?shot) means capture
145
+ // mode without an auto-walk target.
146
+ lines.push(``);
147
+ lines.push(`const _shotParam = (() => {`);
148
+ lines.push(` try { return new URLSearchParams(window.location.search).get("shot"); }`);
149
+ lines.push(` catch { return null; }`);
150
+ lines.push(`})();`);
151
+
130
152
  // --- Page canvas: transparent when framed, theme surface when top-level ---
131
153
  // The static HTML keeps html/body transparent (see generateEmbedHtml): a
132
154
  // framed embed's canvas then shows the *host page's* background through any
@@ -222,11 +244,71 @@ export function generateEmbedEntry(input: EmbedEntryInput): string {
222
244
  lines.push(` );`);
223
245
  lines.push(`}`);
224
246
 
247
+ // --- Capture mount (?shot) ---
248
+ // The whole capture tree lives in @scenar/react (ScenarioCaptureMount);
249
+ // this branch only feeds it the same inputs the playback tree gets and
250
+ // wires the window contract `scenar shoot` consumes: the driver on
251
+ // `window.__scenarShot`, failures on `window.__scenarShotError`. The
252
+ // narration manifest is fetched HERE, before mounting, and errors are
253
+ // fatal — shot times are narration-driven, so capturing without the
254
+ // manifest would silently shoot every frame at the wrong moment.
255
+ lines.push(``);
256
+ lines.push(`async function _mountCapture(rootEl: HTMLElement) {`);
257
+ if (input.hasNarration) {
258
+ lines.push(` const _manifestResponse = await fetch("./narration/manifest.json");`);
259
+ lines.push(` if (!_manifestResponse.ok) {`);
260
+ lines.push(` throw new Error(`);
261
+ lines.push(` "capture: failed to fetch ./narration/manifest.json (HTTP " +`);
262
+ lines.push(` _manifestResponse.status + ") — shot times are narration-driven, refusing to capture without it",`);
263
+ lines.push(` );`);
264
+ lines.push(` }`);
265
+ lines.push(` const _captureManifest = await _manifestResponse.json();`);
266
+ } else {
267
+ lines.push(` const _captureManifest = undefined;`);
268
+ }
269
+ lines.push(` createRoot(rootEl).render(`);
270
+ lines.push(` <div className={_rootClass}>`);
271
+ lines.push(` <ScenarioCaptureMount`);
272
+ lines.push(` scenarioId={${JSON.stringify(input.scenarioId)}}`);
273
+ lines.push(` steps={_steps}`);
274
+ lines.push(` renderStep={renderStep}`);
275
+ lines.push(` canonicalWidth={${input.canonicalWidth}}`);
276
+ lines.push(` shellHeight={${input.shellHeight}}`);
277
+ lines.push(` narrationManifest={_captureManifest}`);
278
+ lines.push(` stage={${input.stage ? "true" : "false"}}`);
279
+ lines.push(` providers={${input.providersPath ? "_Providers" : "undefined"}}`);
280
+ lines.push(` onReady={(driver: any) => {`);
281
+ lines.push(` (window as any).__scenarShot = driver;`);
282
+ lines.push(` if (_shotParam) {`);
283
+ lines.push(` const _target = driver.shots.find((s: any) => s.name === _shotParam);`);
284
+ lines.push(` if (!_target) {`);
285
+ lines.push(` (window as any).__scenarShotError =`);
286
+ lines.push(` 'no shot named "' + _shotParam + '" — declared: ' +`);
287
+ lines.push(` (driver.shots.map((s: any) => s.name).join(", ") || "(none)");`);
288
+ lines.push(` return;`);
289
+ lines.push(` }`);
290
+ lines.push(` void driver.walkTo(_target.timeMs);`);
291
+ lines.push(` }`);
292
+ lines.push(` }}`);
293
+ lines.push(` onError={(error: any) => {`);
294
+ lines.push(` (window as any).__scenarShotError = error?.message ?? String(error);`);
295
+ lines.push(` }}`);
296
+ lines.push(` />`);
297
+ lines.push(` </div>,`);
298
+ lines.push(` );`);
299
+ lines.push(`}`);
300
+
225
301
  // --- Mount ---
226
302
  lines.push(``);
227
303
  lines.push(`const _rootEl = document.getElementById("root");`);
228
304
  lines.push(`if (!_rootEl) throw new Error("Embed root element #root not found");`);
229
- lines.push(`createRoot(_rootEl).render(<_App />);`);
305
+ lines.push(`if (_shotParam !== null) {`);
306
+ lines.push(` _mountCapture(_rootEl).catch((error) => {`);
307
+ lines.push(` (window as any).__scenarShotError = error instanceof Error ? error.message : String(error);`);
308
+ lines.push(` });`);
309
+ lines.push(`} else {`);
310
+ lines.push(` createRoot(_rootEl).render(<_App />);`);
311
+ lines.push(`}`);
230
312
  lines.push(``);
231
313
 
232
314
  return lines.join("\n");
@@ -0,0 +1,9 @@
1
+ import type { ShotBrowser } from "./types.js";
2
+ /**
3
+ * The real {@link ShotBrowser}: Playwright Chromium with the full spike
4
+ * determinism recipe. Playwright is an optional peer dependency (the
5
+ * remotion/echogarden pattern) — loaded lazily so every other command works
6
+ * without it, and failing with install instructions when absent.
7
+ */
8
+ export declare function createPlaywrightShotBrowser(): Promise<ShotBrowser>;
9
+ //# sourceMappingURL=playwright-browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playwright-browser.d.ts","sourceRoot":"","sources":["../../../src/shoot/playwright-browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,YAAY,CAAC;AAuB/D;;;;;GAKG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,WAAW,CAAC,CA2FxE"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Chromium launch flags for byte-deterministic rasterization — every one
3
+ * proven necessary by the 2026-07-28 determinism spike (without them,
4
+ * ±1-LSB full-frame compositing jitter across sessions):
5
+ *
6
+ * - `--disable-gpu`: software rasterization, no GPU-dependent output.
7
+ * - `--force-color-profile=srgb`: pins color conversion.
8
+ * - `--disable-lcd-text`: subpixel AA depends on the (virtual) display.
9
+ * - `--hide-scrollbars`: platform scrollbar chrome is not content.
10
+ */
11
+ const DETERMINISM_LAUNCH_FLAGS = [
12
+ "--disable-gpu",
13
+ "--force-color-profile=srgb",
14
+ "--disable-lcd-text",
15
+ "--hide-scrollbars",
16
+ ];
17
+ const PLAYWRIGHT_INSTALL_HINT = "Install it in your demos project: npm install -D playwright\n" +
18
+ "Then install the browser binary: npx playwright install chromium";
19
+ /**
20
+ * The real {@link ShotBrowser}: Playwright Chromium with the full spike
21
+ * determinism recipe. Playwright is an optional peer dependency (the
22
+ * remotion/echogarden pattern) — loaded lazily so every other command works
23
+ * without it, and failing with install instructions when absent.
24
+ */
25
+ export async function createPlaywrightShotBrowser() {
26
+ const playwright = await import("playwright").catch(() => {
27
+ throw new Error(`Could not load playwright.\n${PLAYWRIGHT_INSTALL_HINT}`);
28
+ });
29
+ const browser = await playwright.chromium
30
+ .launch({ args: DETERMINISM_LAUNCH_FLAGS })
31
+ .catch((error) => {
32
+ const message = error instanceof Error ? error.message : String(error);
33
+ throw new Error(`Could not launch Chromium.\n${message}\n\n${PLAYWRIGHT_INSTALL_HINT}`);
34
+ });
35
+ return {
36
+ async newSession({ theme, viewport }) {
37
+ // `reducedMotion: "reduce"` is safe under a TimeSource: step index
38
+ // derives from time, not from the reduced-motion shortcut — and it
39
+ // keeps framer-motion from animating on wall-clock time.
40
+ // `colorScheme` emulation resolves the stage backdrop's light-dark()
41
+ // colors; the `?theme=` param handles the scenar token class — both
42
+ // halves are required for a correct dark variant (DD-02 D2).
43
+ const context = await browser.newContext({
44
+ viewport,
45
+ deviceScaleFactor: 2,
46
+ reducedMotion: "reduce",
47
+ colorScheme: theme,
48
+ });
49
+ const page = await context.newPage();
50
+ let frameSelector = "";
51
+ return {
52
+ async open(url, timeoutMs) {
53
+ await page.goto(url, { waitUntil: "networkidle" });
54
+ await page.waitForFunction(() => window.__scenarShot !== undefined ||
55
+ window.__scenarShotError !== undefined, undefined, { timeout: timeoutMs });
56
+ const result = await page.evaluate(() => {
57
+ const w = window;
58
+ if (w.__scenarShotError !== undefined) {
59
+ return { error: String(w.__scenarShotError), shots: [], frameSelector: "" };
60
+ }
61
+ const driver = w.__scenarShot;
62
+ return { error: null, shots: driver.shots, frameSelector: driver.frameSelector };
63
+ });
64
+ if (result.error !== null) {
65
+ throw new Error(`the capture page reported: ${result.error}`);
66
+ }
67
+ // Webfont rasterization differs from the fallback font — never
68
+ // shoot before every declared font face has loaded.
69
+ await page.evaluate(() => document.fonts.ready.then(() => undefined));
70
+ frameSelector = result.frameSelector;
71
+ return { shots: result.shots, frameSelector: result.frameSelector };
72
+ },
73
+ async walkTo(timeMs) {
74
+ await page.evaluate((ms) => window.__scenarShot.walkTo(ms), timeMs);
75
+ },
76
+ async screenshotFrame() {
77
+ // `animations: "disabled"` is load-bearing: the shells crossfade
78
+ // content on wall-clock CSS time, and this alone caused whole-pane
79
+ // noise in the spike until disabled at screenshot time.
80
+ return page.locator(frameSelector).screenshot({ animations: "disabled" });
81
+ },
82
+ async close() {
83
+ await context.close();
84
+ },
85
+ };
86
+ },
87
+ async close() {
88
+ await browser.close();
89
+ },
90
+ };
91
+ }
92
+ //# sourceMappingURL=playwright-browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"playwright-browser.js","sourceRoot":"","sources":["../../../src/shoot/playwright-browser.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,MAAM,wBAAwB,GAAG;IAC/B,eAAe;IACf,4BAA4B;IAC5B,oBAAoB;IACpB,mBAAmB;CACpB,CAAC;AAEF,MAAM,uBAAuB,GAC3B,+DAA+D;IAC/D,kEAAkE,CAAC;AAErE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B;IAC/C,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE;QACvD,MAAM,IAAI,KAAK,CAAC,+BAA+B,uBAAuB,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,QAAQ;SACtC,MAAM,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;SAC1C,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;QACxB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,IAAI,KAAK,CACb,+BAA+B,OAAO,OAAO,uBAAuB,EAAE,CACvE,CAAC;IACJ,CAAC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