@slatesvideo/shared 0.7.7 → 0.7.8

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 (121) hide show
  1. package/README.md +3 -6
  2. package/dist/analytics/events.d.ts +1 -1
  3. package/dist/analytics/events.js +7 -0
  4. package/dist/auth.d.ts +2 -0
  5. package/dist/auth.js +5 -0
  6. package/dist/clients/cloud.d.ts +2 -0
  7. package/dist/clients/cloud.js +5 -1
  8. package/dist/index.d.ts +7 -3
  9. package/dist/index.js +7 -3
  10. package/dist/manual/content.d.ts +1 -1
  11. package/dist/manual/content.js +1 -1
  12. package/dist/operations/index.d.ts +587 -161
  13. package/dist/operations/index.js +663 -57
  14. package/dist/operations/surface.d.ts +2 -2
  15. package/dist/operations/surface.js +18 -5
  16. package/dist/prompts/agent-doctrine.d.ts +12 -2
  17. package/dist/prompts/agent-doctrine.js +56 -28
  18. package/dist/prompts/banned-tokens.js +23 -13
  19. package/dist/prompts/brain.d.ts +29 -0
  20. package/dist/prompts/brain.js +72 -0
  21. package/dist/prompts/craft-cards.d.ts +15 -4
  22. package/dist/prompts/craft-cards.js +71 -9
  23. package/dist/prompts/generation-policy.d.ts +1 -1
  24. package/dist/prompts/guide-discovery.d.ts +6 -6
  25. package/dist/prompts/guide-retrieval.d.ts +7 -1
  26. package/dist/prompts/guide-retrieval.js +33 -5
  27. package/dist/prompts/partials.generated.js +1 -13
  28. package/dist/prompts/shot-grammar.d.ts +1 -1
  29. package/dist/prompts/shot-grammar.js +1 -1
  30. package/dist/skills/brain-check.d.ts +44 -0
  31. package/dist/skills/brain-check.js +172 -0
  32. package/dist/skills/content.d.ts +3 -0
  33. package/dist/skills/content.js +81 -44
  34. package/dist/skills/hyperframes-content.js +4 -4
  35. package/dist/skills/my-brain.d.ts +52 -0
  36. package/dist/skills/my-brain.js +218 -0
  37. package/dist/skills/served.d.ts +52 -0
  38. package/dist/skills/served.js +202 -0
  39. package/package.json +2 -4
  40. package/skills/hyperframes/NOTICE +19 -3
  41. package/skills/hyperframes/SLATES-MAPPING.md +1 -1
  42. package/skills/hyperframes/embedded-captions/CATALOG.md +3 -0
  43. package/skills/hyperframes/embedded-captions/SKILL.md +6 -6
  44. package/skills/hyperframes/embedded-captions/assets/fonts/char-widths.json +227 -1
  45. package/skills/hyperframes/embedded-captions/modes/standard/fonts/build-fonts-css.cjs +19 -2
  46. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/archivo-latin-wdth-italic.woff2 +0 -0
  47. package/skills/hyperframes/embedded-captions/modes/standard/fonts/files/archivo-latin-wdth-normal.woff2 +0 -0
  48. package/skills/hyperframes/embedded-captions/scripts/make-theme.cjs +438 -3
  49. package/skills/hyperframes/embedded-captions/scripts/make-theme.test.mjs +1 -0
  50. package/skills/hyperframes/embedded-captions/themes/README.md +26 -1
  51. package/skills/hyperframes/embedded-captions/themes/lesson.json +31 -0
  52. package/skills/slates-start-here.md +78 -0
  53. package/exports/slates-chatgpt-images/generated/SKILL.md +0 -113
  54. package/exports/slates-chatgpt-images/generated/slates-chatgpt-images.skill +0 -0
  55. package/exports/slates-prompt-builder/generated/SKILL.md +0 -71
  56. package/exports/slates-prompt-builder/generated/reference-character.md +0 -92
  57. package/exports/slates-prompt-builder/generated/reference-content-policy.md +0 -81
  58. package/exports/slates-prompt-builder/generated/reference-gpt-image-2-5.md +0 -191
  59. package/exports/slates-prompt-builder/generated/reference-kling.md +0 -295
  60. package/exports/slates-prompt-builder/generated/reference-nano-banana.md +0 -240
  61. package/exports/slates-prompt-builder/generated/reference-omni-flash.md +0 -97
  62. package/exports/slates-prompt-builder/generated/reference-seedance-2-5.md +0 -392
  63. package/exports/slates-prompt-builder/generated/reference-seedance.md +0 -441
  64. package/exports/slates-prompt-builder/generated/slates-prompt-builder-manifest.json +0 -133
  65. package/exports/slates-prompt-builder/generated/slates-prompt-builder.skill +0 -0
  66. package/skills/_partials/blender-action-curves.md +0 -24
  67. package/skills/_partials/cinematic-card.md +0 -8
  68. package/skills/_partials/decision-log.md +0 -1
  69. package/skills/_partials/image-defaults.md +0 -9
  70. package/skills/_partials/iteration-diagnosis.md +0 -5
  71. package/skills/_partials/living-performance.md +0 -22
  72. package/skills/_partials/model-routing.md +0 -35
  73. package/skills/_partials/references-read-literally.md +0 -11
  74. package/skills/_partials/seedance-25-timestamps.md +0 -34
  75. package/skills/_partials/sheet-tool-defaults.md +0 -6
  76. package/skills/_partials/still-gate.md +0 -3
  77. package/skills/_partials/thresholds.md +0 -19
  78. package/skills/slates-blocking-to-prompt.md +0 -279
  79. package/skills/slates-camera-language.md +0 -234
  80. package/skills/slates-captions.md +0 -81
  81. package/skills/slates-character-identity.md +0 -117
  82. package/skills/slates-chatgpt-images.md +0 -113
  83. package/skills/slates-cinematic-look.md +0 -237
  84. package/skills/slates-content-policy.md +0 -88
  85. package/skills/slates-cost-discipline.md +0 -150
  86. package/skills/slates-cuts.md +0 -46
  87. package/skills/slates-dialogue-blocking.md +0 -134
  88. package/skills/slates-direct-response-ad.md +0 -26
  89. package/skills/slates-edit-and-iterate.md +0 -76
  90. package/skills/slates-layer-brand-captions.md +0 -87
  91. package/skills/slates-layer-lower-third.md +0 -85
  92. package/skills/slates-layer-title.md +0 -82
  93. package/skills/slates-model-selection.md +0 -129
  94. package/skills/slates-motion.md +0 -57
  95. package/skills/slates-one-prompt-film.md +0 -38
  96. package/skills/slates-previs-blocking.md +0 -186
  97. package/skills/slates-project-organization.md +0 -42
  98. package/skills/slates-prompting-elevenlabs.md +0 -128
  99. package/skills/slates-prompting-flux-3.md +0 -157
  100. package/skills/slates-prompting-gpt-image-2-5.md +0 -196
  101. package/skills/slates-prompting-inworld-tts.md +0 -174
  102. package/skills/slates-prompting-kling-v3.md +0 -303
  103. package/skills/slates-prompting-lip-sync.md +0 -216
  104. package/skills/slates-prompting-ltx-2-5.md +0 -245
  105. package/skills/slates-prompting-minimax-h3.md +0 -383
  106. package/skills/slates-prompting-motion-transfer.md +0 -202
  107. package/skills/slates-prompting-nano-banana-2-1.md +0 -250
  108. package/skills/slates-prompting-omni-flash.md +0 -117
  109. package/skills/slates-prompting-seed-audio.md +0 -168
  110. package/skills/slates-prompting-seedance-2-5.md +0 -420
  111. package/skills/slates-prompting-seedance.md +0 -462
  112. package/skills/slates-prompting-seedream-5-lite.md +0 -122
  113. package/skills/slates-prompting-wan-3.md +0 -143
  114. package/skills/slates-restyle-from-blocking.md +0 -121
  115. package/skills/slates-script-craft.md +0 -45
  116. package/skills/slates-shot-variety.md +0 -24
  117. package/skills/slates-storyboard-from-script.md +0 -32
  118. package/skills/slates-style-prompting.md +0 -56
  119. package/skills/slates-transitions.md +0 -40
  120. package/skills/slates-ugc-influencer-ad.md +0 -32
  121. package/skills/slates-vision-feedback-loop.md +0 -118
@@ -10,6 +10,8 @@
10
10
  * panel console log accumulating in a docked glass panel (fg alpha)
11
11
  * poem lines accumulate in open space, stanza by stanza (fg alpha)
12
12
  * takeover every beat owns the full frame as a hard-cut card (bg)
13
+ * stack two-tier spoken stacks beside the speaker + chapter card +
14
+ * prompt lower thirds (fg alpha; the lesson identity)
13
15
  *
14
16
  * HERO SETPIECES the climax choreography
15
17
  * detonation sliced stencil stamp: shear-in, snap, squash, cool, furniture
@@ -36,7 +38,7 @@
36
38
  */
37
39
  const fs = require("fs");
38
40
  const path = require("path");
39
- const { execFileSync } = require("child_process");
41
+ const { execFileSync, spawnSync } = require("child_process");
40
42
 
41
43
  const PROJECT = path.resolve(process.argv[2] || ".");
42
44
  const SKILL = path.resolve(__dirname, "..");
@@ -258,10 +260,19 @@ if (!heroInline && !HEROLESS && !redactLinkage) {
258
260
  // resolve lines: every entry gets word objects with timings + role flags
259
261
  const minors = new Set((theme.minors || []).map(norm));
260
262
  const LINES = (theme.lines || []).map((arr, li) => {
261
- const words = arr.map((a) => {
263
+ // stack paradigm only: a "|" token splits a line into setup | payoff, a trailing
264
+ // object places it, and a "~" prefix covers a stutter without drawing it. None
265
+ // is a transcript word, and every other paradigm never sees one
266
+ const at = arr.find((a) => a && typeof a === "object") || null;
267
+ const toks = arr.filter((a) => typeof a === "string");
268
+ const bar = toks.indexOf("|");
269
+ const words = toks.filter((a) => a !== "|").map((raw) => {
270
+ const drop = raw.startsWith("~");
271
+ const a = drop ? raw.slice(1) : raw;
262
272
  const tw = takeWord(a);
263
273
  return {
264
274
  display: a,
275
+ drop,
265
276
  start: tw.start,
266
277
  end: tw.end,
267
278
  minor: minors.has(norm(a)),
@@ -272,7 +283,7 @@ const LINES = (theme.lines || []).map((arr, li) => {
272
283
  tw.start <= hero.end + 0.01,
273
284
  };
274
285
  });
275
- return { id: li, words };
286
+ return { id: li, words, split: bar < 0 ? null : bar, at };
276
287
  });
277
288
  // completeness gate
278
289
  const unused = tWords.filter((w) => !w.used);
@@ -4979,6 +4990,429 @@ ${
4979
4990
  return { css, html, js };
4980
4991
  }
4981
4992
 
4993
+ // ---- stack: the lesson identity, cloned from a proven prompt-lesson ad (fonts,
4994
+ // cap heights, gaps, colours and cuts measured from its frames). Three layers:
4995
+ // spoken two-tier stacks beside the speaker, a chapter card on the save ask, and
4996
+ // lower thirds that name each technique and quote its prompt. Every caption cuts in
4997
+ // and out on a frame. Multi-shot by design: a line's `{x, y, s, p}` places it
4998
+ // (ink left, cap top, setup and payoff cap px); unplaced stacks read the matte and
4999
+ // the cuts at compile time, so each sits beside the face in ITS shot.
5000
+
5001
+ // shot cuts: theme.cuts wins; else ffmpeg scdet over source.mp4 (threshold 12
5002
+ // matched a hand-logged 13-shot cut map exactly; the one extra hit is a whip pan)
5003
+ function stackCuts() {
5004
+ if (Array.isArray(theme.cuts)) return theme.cuts.map(Number).sort((a, b) => a - b);
5005
+ const src = path.join(PROJECT, "source.mp4");
5006
+ if (!fs.existsSync(src)) return [];
5007
+ const r = spawnSync(
5008
+ "ffmpeg",
5009
+ ["-hide_banner", "-nostats", "-i", src, "-vf", `scale=320:-2,scdet=threshold=${dna.body.cutThreshold ?? 12}`, "-an", "-f", "null", "-"],
5010
+ { encoding: "utf8", maxBuffer: 64 << 20 },
5011
+ );
5012
+ return [...(r.stderr || "").matchAll(/lavfi\.scd\.time:\s*([\d.]+)/g)].map((m) => +m[1]);
5013
+ }
5014
+
5015
+ // the matte as a coarse alpha grid per frame (one ffmpeg pass, no image deps)
5016
+ function stackMatte(GW, GH) {
5017
+ const dir = path.join(PROJECT, "frames_fg");
5018
+ if (!fs.existsSync(dir) || !fs.readdirSync(dir).some((f) => /^f_\d+\.png$/.test(f))) return null;
5019
+ try {
5020
+ const buf = execFileSync(
5021
+ "ffmpeg",
5022
+ ["-v", "error", "-framerate", String(FPS), "-i", path.join(dir, "f_%04d.png"),
5023
+ "-vf", `alphaextract,scale=${GW}:${GH}:flags=area`, "-f", "rawvideo", "-pix_fmt", "gray", "-"],
5024
+ { maxBuffer: 1 << 30 },
5025
+ );
5026
+ return { n: Math.floor(buf.length / (GW * GH)), buf };
5027
+ } catch {
5028
+ console.error("[make-theme] WARN stack: matte unreadable — placing on the clearer side");
5029
+ return null;
5030
+ }
5031
+ }
5032
+
5033
+ function paradigmStack() {
5034
+ const b = dna.body,
5035
+ pal = dna.palette;
5036
+ const FR = 1 / FPS;
5037
+ // a hair before the frame boundary: a set at a cut lands ON the cut frame, and a
5038
+ // word's set lands on the frame that contains the word's start
5039
+ const snap = (t) => Math.round(t * FPS) / FPS - 0.0005;
5040
+ const onFrame = (t) => Math.floor(t * FPS + 1e-6) / FPS - 0.0005;
5041
+ const r3 = (t) => +t.toFixed(4);
5042
+ const CUTS = stackCuts();
5043
+ const cutAfter = (t, lo = 0) => CUTS.find((c) => c > t + lo);
5044
+
5045
+ // ---- type: every size is a CAP HEIGHT in px (what the frame shows), turned into a
5046
+ // font-size through the face's measured cap ratio; cap tops and ink lefts place lines
5047
+ const CAP = b.capRatio ?? 0.69,
5048
+ CAPTOP = b.capTop ?? 0.145;
5049
+ const fsOf = (cap) => cap / CAP;
5050
+ const BODY = dna.fonts.body,
5051
+ TAG = dna.fonts.tag;
5052
+ const BW = b.widthKey || BODY; // char-widths entry for the stack face (italic, condensed)
5053
+ const LS = b.letterSpacing ?? -0.055,
5054
+ WS = b.wordSpacing ?? 0.075;
5055
+ // lines align on the INK: a first glyph's left bearing (relative to a stem) is undone
5056
+ const LSB = (famMetrics(BW) || {}).lsb || {};
5057
+ const inset = (s) => (LSB[s[0]] ?? 0) - (LSB.H ?? 0);
5058
+ const inkW = (s, cap) => wordPx(s, BW, fsOf(cap), LS) + (s.split(" ").length - 1) * WS * fsOf(cap);
5059
+ const setupCap = Math.round(H * (b.setupCap ?? 0.0352));
5060
+ const payCap = Math.round(setupCap * (b.payoffScale ?? 1.89));
5061
+ const singleCap = Math.round(setupCap * (b.singleScale ?? 1.1));
5062
+ const gapOf = (s) => Math.round(s * (b.gap ?? 0.21));
5063
+ const maxW = W * (b.maxWidth ?? 0.56);
5064
+
5065
+ // ---- matte occupancy, for stacks the theme does not place itself
5066
+ const GW = 64,
5067
+ GH = Math.max(24, Math.round((64 * H) / W));
5068
+ const cw = W / GW,
5069
+ chh = H / GH;
5070
+ const M = stackMatte(GW, GH);
5071
+ // union of matte alpha over [t0,t1] → occupancy + distance-to-subject grids
5072
+ function occupancy(t0, t1) {
5073
+ if (!M) return null;
5074
+ const u = new Uint8Array(GW * GH);
5075
+ const f0 = Math.max(0, Math.floor(t0 * FPS)),
5076
+ f1 = Math.min(M.n - 1, Math.ceil(t1 * FPS));
5077
+ for (let f = f0; f <= f1; f++) {
5078
+ const o = f * GW * GH;
5079
+ for (let i = 0; i < GW * GH; i++) if (M.buf[o + i] > u[i]) u[i] = M.buf[o + i];
5080
+ }
5081
+ const occ = new Uint8Array(GW * GH);
5082
+ let any = false;
5083
+ for (let i = 0; i < GW * GH; i++) if (u[i] > 48) (occ[i] = 1), (any = true);
5084
+ // breathing room: dilate ~2% of the frame each way
5085
+ const rx = Math.max(1, Math.round((0.022 * W) / cw)),
5086
+ ry = Math.max(1, Math.round((0.022 * H) / chh));
5087
+ const dil = new Uint8Array(GW * GH);
5088
+ for (let y = 0; y < GH; y++)
5089
+ for (let x = 0; x < GW; x++) {
5090
+ if (!occ[y * GW + x]) continue;
5091
+ for (let yy = Math.max(0, y - ry); yy <= Math.min(GH - 1, y + ry); yy++)
5092
+ for (let xx = Math.max(0, x - rx); xx <= Math.min(GW - 1, x + rx); xx++) dil[yy * GW + xx] = 1;
5093
+ }
5094
+ // summed-area table over the dilated grid; chebyshev distance to the subject
5095
+ const sat = new Float64Array((GW + 1) * (GH + 1));
5096
+ for (let y = 0; y < GH; y++)
5097
+ for (let x = 0; x < GW; x++)
5098
+ sat[(y + 1) * (GW + 1) + x + 1] =
5099
+ dil[y * GW + x] + sat[y * (GW + 1) + x + 1] + sat[(y + 1) * (GW + 1) + x] - sat[y * (GW + 1) + x];
5100
+ const dist = new Float64Array(GW * GH).fill(1e9);
5101
+ const q = [];
5102
+ for (let i = 0; i < GW * GH; i++) if (occ[i]) (dist[i] = 0), q.push(i);
5103
+ for (let h = 0; h < q.length; h++) {
5104
+ const i = q[h],
5105
+ x = i % GW,
5106
+ y = (i / GW) | 0;
5107
+ for (let dy = -1; dy <= 1; dy++)
5108
+ for (let dx = -1; dx <= 1; dx++) {
5109
+ const xx = x + dx,
5110
+ yy = y + dy;
5111
+ if (xx < 0 || yy < 0 || xx >= GW || yy >= GH) continue;
5112
+ const j = yy * GW + xx;
5113
+ if (dist[j] > dist[i] + 1) (dist[j] = dist[i] + 1), q.push(j);
5114
+ }
5115
+ }
5116
+ return { any, sat, dist };
5117
+ }
5118
+ const rectCells = (x, y, w, h) => [
5119
+ Math.max(0, Math.floor(x / cw)),
5120
+ Math.max(0, Math.floor(y / chh)),
5121
+ Math.min(GW, Math.ceil((x + w) / cw)),
5122
+ Math.min(GH, Math.ceil((y + h) / chh)),
5123
+ ];
5124
+ function overlap(O, x, y, w, h) {
5125
+ if (!O) return 0;
5126
+ const [x0, y0, x1, y1] = rectCells(x, y, w, h);
5127
+ const S = (xx, yy) => O.sat[yy * (GW + 1) + xx];
5128
+ const n = (x1 - x0) * (y1 - y0);
5129
+ return n > 0 ? (S(x1, y1) - S(x0, y1) - S(x1, y0) + S(x0, y0)) / n : 0;
5130
+ }
5131
+ // best top-left for a w×h block over [t0,t1]: clear of the subject, close to
5132
+ // it (beside the face, not in a far corner), near the preferred height
5133
+ function place(t0, t1, w, h, prefY) {
5134
+ const mx = W * 0.04,
5135
+ mt = H * 0.06,
5136
+ mb = H * 0.08;
5137
+ const O = occupancy(t0, t1);
5138
+ if (!O || !O.any) {
5139
+ const x = CLEARER === "right" ? W - mx - w : mx;
5140
+ return { x: Math.round(x), y: Math.round(Math.min(H - mb - h, Math.max(mt, prefY * H - h / 2))) };
5141
+ }
5142
+ let best = null;
5143
+ for (let y = mt; y + h <= H - mb; y += chh)
5144
+ for (let x = mx; x + w <= W - mx; x += cw) {
5145
+ const ov = overlap(O, x, y, w, h);
5146
+ const [x0, y0, x1, y1] = rectCells(x, y, w, h);
5147
+ let near = 1e9;
5148
+ for (let yy = y0; yy < y1; yy++)
5149
+ for (let xx = x0; xx < x1; xx++) near = Math.min(near, O.dist[yy * GW + xx]);
5150
+ const cost = ov * 100 + 0.35 * Math.max(0, near - 2) + 6 * Math.abs((y + h / 2) / H - prefY);
5151
+ if (!best || cost < best.cost - 1e-9) best = { cost, x, y };
5152
+ }
5153
+ return { x: Math.round(best.x), y: Math.round(best.y) };
5154
+ }
5155
+
5156
+ // ---- blocking windows: the chapter card and each lower third own the frame;
5157
+ // spoken stacks whose first word falls inside one are not drawn (still verbatim-covered)
5158
+ const blocks = [];
5159
+ let chapter = null;
5160
+ if (theme.chapter && theme.chapter.match) {
5161
+ const c = theme.chapter;
5162
+ const ph = findPhrase(c.match);
5163
+ const pre = CUTS.filter((t) => t <= ph.start && t >= ph.start - 0.45).pop();
5164
+ const tin = pre != null ? snap(pre) : onFrame(ph.start);
5165
+ const ca = cutAfter(ph.end - 0.05);
5166
+ const tout = c.out ?? (ca != null && ca - ph.end <= 2 ? snap(ca) : r3(ph.end + 0.9));
5167
+ const [t1, t2] = String(c.title || "").split("/").map((s) => s.trim().toUpperCase());
5168
+ chapter = { tin, tout, num: String(c.number ?? ""), t1: t1 || "", t2: t2 || "" };
5169
+ blocks.push([tin, tout]);
5170
+ }
5171
+ const items = (theme.items || []).map((it, k) => {
5172
+ const ph = findPhrase(it.match);
5173
+ const pre = CUTS.filter((t) => t <= ph.start + 1e-6 && t >= ph.start - 0.3).pop();
5174
+ const tin = pre != null ? snap(pre) : onFrame(ph.start);
5175
+ // a "before" item opens on the empty shot under a centred label; its lower third
5176
+ // cuts in with the next shot, the result
5177
+ const bc = it.before ? cutAfter(tin, 0.4) : null;
5178
+ const nameIn = bc != null ? snap(bc) : tin;
5179
+ const next = theme.items[k + 1] ? findPhrase(theme.items[k + 1].match).start - 0.05 : DUR - 0.05;
5180
+ const ca = cutAfter(Math.max(nameIn, tin + 1.2), 0.3);
5181
+ let tout = it.out ?? (ca != null && ca - nameIn <= 6 ? snap(ca) : r3(nameIn + 3));
5182
+ tout = Math.min(tout, next, DUR - 0.05);
5183
+ blocks.push([tin, tout]);
5184
+ return {
5185
+ tin, tout, nameIn, n: String(it.number ?? k + 1), name: String(it.name || "").toUpperCase(),
5186
+ quote: String(it.prompt || "").toUpperCase(), layout: it.layout || "stack",
5187
+ before: it.before ? String(it.before).toUpperCase() : null,
5188
+ };
5189
+ });
5190
+ const blocked = (t) => blocks.some(([a, z]) => t >= a - 0.01 && t <= z);
5191
+
5192
+ // ---- stacks: a small setup line over the payoff, white caps, hard cut on each word
5193
+ const up = (ws) => ws.map((w) => w.display.toUpperCase().replace(/\.+$/, "")).join(" ");
5194
+ const stacks = [];
5195
+ LINES.forEach((L) => {
5196
+ const vis = L.words.filter((w) => !w.drop);
5197
+ if (!vis.length || blocked(vis[0].start)) return;
5198
+ const n = vis.length;
5199
+ const split = L.split != null ? L.split : n <= 3 ? 0 : Math.min(2, Math.max(1, Math.floor(n / 3)));
5200
+ const su = L.words.slice(0, split).filter((w) => !w.drop),
5201
+ po = L.words.slice(split).filter((w) => !w.drop);
5202
+ const at = L.at || {};
5203
+ const s = at.s ?? setupCap;
5204
+ let p = at.p ?? (su.length ? payCap : singleCap),
5205
+ rows = [up(po)];
5206
+ if (at.p == null && inkW(rows[0], p) > maxW) {
5207
+ p = Math.max(Math.round(p * 0.78), Math.floor((p * maxW) / inkW(rows[0], p)));
5208
+ if (inkW(rows[0], p) > maxW && po.length > 1) {
5209
+ const ws = rows[0].split(" ");
5210
+ let bestK = 1;
5211
+ const m = (k) => Math.max(inkW(ws.slice(0, k).join(" "), p), inkW(ws.slice(k).join(" "), p));
5212
+ for (let k2 = 2; k2 < ws.length; k2++) if (m(k2) < m(bestK)) bestK = k2;
5213
+ rows = [ws.slice(0, bestK).join(" "), ws.slice(bestK).join(" ")];
5214
+ }
5215
+ }
5216
+ stacks.push({
5217
+ id: "s" + L.id, su: su.length ? up(su) : "", rows, s, p, at,
5218
+ first: vis[0], last: L.words[L.words.length - 1], poStart: po[0].start,
5219
+ w: Math.max(su.length ? inkW(up(su), s) : 0, ...rows.map((r) => inkW(r, p))),
5220
+ h: (su.length ? s + gapOf(s) : 0) + rows.length * p + (rows.length - 1) * gapOf(p),
5221
+ });
5222
+ });
5223
+ // windows: in on the first word (on the cut when one falls just before it), out when
5224
+ // the next stack takes over, the hold after the last word (a dropped stutter counts)
5225
+ // runs out, or the shot cuts
5226
+ stacks.forEach((S, i) => {
5227
+ const cutIn = CUTS.find((c) => c <= S.first.start + 1e-6 && c > S.first.start - (b.cutLead ?? 0.12));
5228
+ S.tin = cutIn != null ? snap(cutIn) : onFrame(S.first.start);
5229
+ S.tpo = S.su ? Math.max(S.tin, onFrame(S.poStart)) : S.tin;
5230
+ });
5231
+ stacks.forEach((S, i) => {
5232
+ const nextIn = i + 1 < stacks.length ? stacks[i + 1].tin : DUR - 0.05;
5233
+ const blockIn = blocks.map(([a]) => a).filter((a) => a > S.first.start).sort((a, z) => a - z)[0] ?? 1e9;
5234
+ const ca = cutAfter(S.last.start - 0.001);
5235
+ let tout = Math.min(nextIn, onFrame(S.last.end + (b.hold ?? 0.12)), blockIn, DUR - 0.05);
5236
+ if (ca != null && snap(ca) < tout) tout = snap(ca);
5237
+ S.tout = r3(tout);
5238
+ });
5239
+ // stacks the theme does not place: one anchor per run inside the same shot, so
5240
+ // consecutive stacks keep their column instead of hopping
5241
+ const groups = [];
5242
+ stacks.forEach((S, i) => {
5243
+ if (S.at.x != null && S.at.y != null) return;
5244
+ const prev = groups.length ? groups[groups.length - 1] : null;
5245
+ const P = prev && prev[prev.length - 1];
5246
+ const sameShot = P && stacks.indexOf(P) === i - 1 && !CUTS.some((c) => c > P.tin && c <= S.tin) && S.tin - P.tout < 1.5;
5247
+ if (sameShot) prev.push(S);
5248
+ else groups.push([S]);
5249
+ });
5250
+ for (const G of groups) {
5251
+ const w = Math.max(...G.map((S) => S.w)) + payCap * 0.12; // italic overhang
5252
+ const h = Math.max(...G.map((S) => S.h));
5253
+ const at = place(G[0].tin, G[G.length - 1].tout, w, h, b.prefY ?? 0.7);
5254
+ for (const S of G) S.at = { ...S.at, x: at.x, y: at.y };
5255
+ }
5256
+
5257
+ // ---- chapter card, top-left (theme.chapter.side "right" mirrors it): numeral, title over subtitle,
5258
+ // an outline bookmark after the title
5259
+ const numCap = Math.round(H * 0.1037),
5260
+ t1Cap = Math.round(H * 0.0482),
5261
+ t2Cap = Math.round(H * 0.0231);
5262
+ if (chapter) {
5263
+ const x0 = W * 0.0278,
5264
+ y0 = H * 0.037;
5265
+ const nW = wordPx(chapter.num, BW, fsOf(numCap), 0); // one glyph: no tracking to take off
5266
+ const t1x = nW + H * 0.0102,
5267
+ t1y = H * 0.012,
5268
+ t2y = t1y + t1Cap + H * 0.0083;
5269
+ const bmH = t1Cap,
5270
+ bmW = Math.round(bmH * 0.81);
5271
+ const bmx = t1x + inkW(chapter.t1, t1Cap) + H * 0.0083;
5272
+ const w = bmx + bmW;
5273
+ const side = theme.chapter.side || "left";
5274
+ Object.assign(chapter, { x: Math.round(side === "right" ? W - x0 - w : x0), y: Math.round(y0), t1x, t1y, t2y, bmx, bmH, bmW });
5275
+ }
5276
+
5277
+ // ---- lower thirds: orange number over the name in an expanded black face, the
5278
+ // prompt quoted under it in the same face (all cap px ∝ H, measured off the reference)
5279
+ const numPx = Math.round(H * 0.0324),
5280
+ nameCap = Math.round(H * 0.0759),
5281
+ qCap = Math.round(H * 0.0259),
5282
+ namePitch = Math.round(fsOf(nameCap) * 0.96),
5283
+ qPitch = Math.round(fsOf(qCap) * 0.96),
5284
+ qMax = W * 0.46;
5285
+ const qX = Math.round(W * 0.046),
5286
+ qY = Math.round(H * 0.838);
5287
+ const NAME_FS = fsOf(nameCap),
5288
+ NUM_FS = fsOf(numPx),
5289
+ Q_FS = fsOf(qCap);
5290
+ const tagW = (s, fs) => wordPx(s, TAG, fs, 0);
5291
+ // two rows, broken where the longer row is shortest
5292
+ const balance = (txt, fs) => {
5293
+ const ws = txt.split(" ");
5294
+ let bestK = 1;
5295
+ const m = (k) => Math.max(tagW(ws.slice(0, k).join(" "), fs), tagW(ws.slice(k).join(" "), fs));
5296
+ for (let k2 = 2; k2 < ws.length; k2++) if (m(k2) < m(bestK)) bestK = k2;
5297
+ return [ws.slice(0, bestK).join(" "), ws.slice(bestK).join(" ")];
5298
+ };
5299
+ for (const it of items) {
5300
+ // a name wider than the frame's left half breaks onto two rows
5301
+ const rows = tagW(it.name, NAME_FS) > W * 0.55 && it.name.includes(" ") ? balance(it.name, NAME_FS) : [it.name];
5302
+ // the quote: "/" in the prompt breaks it by hand, else a greedy wrap at qMax
5303
+ let q = [];
5304
+ if (it.quote.includes("/")) q = it.quote.split("/").map((r) => r.trim());
5305
+ else
5306
+ for (const w of it.quote.split(/\s+/).filter(Boolean)) {
5307
+ const cand = q.length ? q[q.length - 1] + " " + w : w;
5308
+ if (q.length && tagW('"' + cand + '"', Q_FS) <= qMax) q[q.length - 1] = cand;
5309
+ else q.push(w);
5310
+ }
5311
+ q[0] = '"' + q[0];
5312
+ q[q.length - 1] += '"';
5313
+ const qW = Math.max(...q.map((r) => tagW(r, Q_FS)));
5314
+ const nameW = Math.max(...rows.map((r) => tagW(r, NAME_FS)));
5315
+ const nameH = nameCap + (rows.length - 1) * namePitch;
5316
+ let nx, nBottom;
5317
+ // nx is the name's box left: the expanded face's left bearing puts its ink ~0.006W in,
5318
+ // the numeral's ~0.002W, so the number sits 0.0035W right to land on the same ink edge
5319
+ if (it.layout === "beside") (nx = qX + qW + W * 0.025), (nBottom = H - H * 0.0444);
5320
+ else if (it.layout === "right") (nx = W - W * 0.0365 - nameW), (nBottom = qY - H * 0.05);
5321
+ else (nx = qX - W * 0.0042), (nBottom = qY - H * 0.0204);
5322
+ const nTop = nBottom - nameH;
5323
+ Object.assign(it, { rows, q, nx: Math.round(nx), kx: Math.round(nx + W * 0.0035), nTop: Math.round(nTop), kTop: Math.round(nTop - H * 0.0287 - numPx) });
5324
+ }
5325
+
5326
+ // ---- markup (baked at compile time; the page only schedules)
5327
+ const shadow = b.shadow || "0 2px 6px rgba(0,0,0,0.32)";
5328
+ const line = (cls, text, cap, x, capTop, extra = "") => {
5329
+ const fs = fsOf(cap);
5330
+ return `<div class="${cls}" style="left:${Math.round(x - inset(text) * fs)}px;top:${Math.round(capTop - CAPTOP * fs)}px;font-size:${+fs.toFixed(2)}px${extra}">${esc(text)}</div>`;
5331
+ };
5332
+ const stackHtml = stacks
5333
+ .map((S) => {
5334
+ const { x, y } = S.at;
5335
+ const poTop = S.su ? y + S.s + gapOf(S.s) : y;
5336
+ const rows = S.rows.map((r, k) => line("po", r, S.p, x, poTop + k * (S.p + gapOf(S.p)))).join("");
5337
+ return ` <div class="st" id="${S.id}">${S.su ? line("su", S.su, S.s, x, y) : ""}${rows}</div>`;
5338
+ })
5339
+ .join("\n");
5340
+ const chapterHtml = chapter
5341
+ ? ` <div class="ch" id="ch" style="left:${chapter.x}px;top:${chapter.y}px">` +
5342
+ line("chl", chapter.num, numCap, 0, 0) +
5343
+ line("chl", chapter.t1, t1Cap, chapter.t1x, chapter.t1y) +
5344
+ (chapter.t2 ? line("chl", chapter.t2, t2Cap, chapter.t1x, chapter.t2y) : "") +
5345
+ `<svg class="bm" viewBox="0 0 42 52" width="${chapter.bmW}" height="${chapter.bmH}" style="left:${Math.round(chapter.bmx)}px;top:${Math.round(chapter.t1y - 1)}px">` +
5346
+ `<path d="M2 2H40V50L21 33.5L2 50Z" fill="none" stroke="${pal.body}" stroke-width="4" stroke-linejoin="miter"/></svg></div>`
5347
+ : "";
5348
+ const itemHtml = items
5349
+ .map((it, k) => {
5350
+ const at = (cls, text, x, capTop, fs) => `<div class="${cls}" style="left:${x}px;top:${Math.round(capTop - CAPTOP * fs)}px">${esc(text)}</div>`;
5351
+ return (
5352
+ ` <div class="lt" id="lt${k}">` +
5353
+ at("ltk", it.n, it.kx, it.kTop, NUM_FS) +
5354
+ it.rows.map((r, j) => at("ltname", r, it.nx, it.nTop + j * namePitch, NAME_FS)).join("") +
5355
+ it.q.map((r, j) => at("ltq", r, qX - Math.round(W * 0.0028), qY + j * qPitch, Q_FS)).join("") +
5356
+ `</div>` +
5357
+ (it.before ? `\n <div class="bf" id="bf${k}">${esc(it.before)}</div>` : "")
5358
+ );
5359
+ })
5360
+ .join("\n");
5361
+
5362
+ const css = `
5363
+ .st > div, .ch .chl { position:absolute; opacity:0; white-space:nowrap; font-family:'${BODY}', sans-serif; font-style:italic;
5364
+ font-weight:900; font-stretch:${b.stretch ?? "62.5%"}; line-height:1; letter-spacing:${LS}em; word-spacing:${WS}em; color:${pal.body}; text-shadow:${shadow}; }
5365
+ .ch { position:absolute; opacity:0; }
5366
+ .ch .chl { opacity:1; }
5367
+ .ch .bm { position:absolute; overflow:visible; filter:drop-shadow(${shadow}); }
5368
+ .lt { position:absolute; inset:0; opacity:0; }
5369
+ .lt > div { position:absolute; white-space:nowrap; font-family:'${TAG}', sans-serif; font-weight:900; font-stretch:125%;
5370
+ line-height:1; color:${pal.body}; text-shadow:${shadow}; }
5371
+ .lt .ltk { font-size:${+NUM_FS.toFixed(2)}px; color:${pal.accent}; }
5372
+ .lt .ltname { font-size:${+NAME_FS.toFixed(2)}px; }
5373
+ .lt .ltq { font-size:${+Q_FS.toFixed(2)}px; }
5374
+ .bf { position:absolute; left:${W / 2}px; top:${Math.round(H * 0.496 - fsOf(H * 0.0176) * (CAPTOP + CAP / 2))}px; transform:translateX(-50%);
5375
+ opacity:0; white-space:nowrap; font-family:'${TAG}', sans-serif; font-weight:400; font-stretch:125%; line-height:1;
5376
+ font-size:${+fsOf(H * 0.0176).toFixed(2)}px; color:${pal.body}; text-shadow:${shadow}; }`;
5377
+
5378
+ const html = [stackHtml, chapterHtml, itemHtml].filter(Boolean).join("\n");
5379
+
5380
+ const js = `
5381
+ // ---- body paradigm: STACK (lesson) — two-tier stacks, chapter card, lower thirds ----
5382
+ // every caption cuts in and out on a frame: no fades, no slides
5383
+ const FR = ${FR};
5384
+ const STACKS = ${J(stacks.map((S) => ({ id: S.id, su: !!S.su, tin: S.tin, tpo: S.tpo, tout: S.tout })))};
5385
+ STACKS.forEach((S) => {
5386
+ const el = document.getElementById(S.id), lines = el.querySelectorAll(":scope > div");
5387
+ const po = [...lines].slice(S.su ? 1 : 0);
5388
+ if (S.su) tl.set(lines[0], { opacity: 1 }, S.tin);
5389
+ tl.set(po, { opacity: 1 }, S.tpo);
5390
+ tl.set(lines, { opacity: 0 }, S.tout);
5391
+ });
5392
+ ${
5393
+ chapter
5394
+ ? ` {
5395
+ const ch = document.getElementById("ch");
5396
+ tl.set(ch, { opacity: 1 }, ${chapter.tin});
5397
+ tl.set(ch, { opacity: 0 }, ${chapter.tout});
5398
+ }`
5399
+ : ""
5400
+ }
5401
+ // ---- lower thirds: number, name and quote cut in with the result shot, out on its cut
5402
+ const ITEMS = ${J(items.map((it) => ({ tin: it.tin, tout: it.tout, nameIn: it.nameIn, before: !!it.before })))};
5403
+ ITEMS.forEach((I, k) => {
5404
+ const lt = document.getElementById("lt" + k);
5405
+ tl.set(lt, { opacity: 1 }, I.nameIn);
5406
+ tl.set(lt, { opacity: 0 }, I.tout);
5407
+ if (I.before) {
5408
+ const bf = document.getElementById("bf" + k);
5409
+ tl.set(bf, { opacity: 1 }, I.tin);
5410
+ tl.set(bf, { opacity: 0 }, I.nameIn);
5411
+ }
5412
+ });`;
5413
+ return { css, html, js };
5414
+ }
5415
+
4982
5416
  const PARADIGMS = {
4983
5417
  rail: paradigmRail,
4984
5418
  panel: paradigmPanel,
@@ -5003,6 +5437,7 @@ const PARADIGMS = {
5003
5437
  brushrail: paradigmBrushrail,
5004
5438
  inkrail: paradigmInkrail,
5005
5439
  ransomrail: paradigmRansomrail,
5440
+ stack: paradigmStack,
5006
5441
  };
5007
5442
 
5008
5443
  function setpieceCpslam() {
@@ -35,6 +35,7 @@ const expectedThemes = [
35
35
  "inkwater",
36
36
  "laser",
37
37
  "lastpage",
38
+ "lesson",
38
39
  "neonsign",
39
40
  "ordnance",
40
41
  "papercut",
@@ -69,6 +69,7 @@ phases, each gated on need — never rewrite for tidiness alone:
69
69
  | `brushrail` | washi paper band: a deckle-edged band (`body.strip` geometry, two faintly rotated `paperHi`→`paperLo` under-sheets at 0.42 + a translucent `sheetHi`→`sheetLo` main sheet with warm inset shadow) swipes in L→R behind a traveling brush-head shadow (clipPath wipe 0.2s power2.out + blurred `palette.bh` gradient head — the ink gesture at low amplitude), then the under-sheet breathes faintly (0.32 Hz baked f(t)); body lines are centered replace-lines on the band (`fonts.body` serif at `body.fontPx`/`body.weight`, seeded ±1° tilt); emphasis words get a DOUBLE curved ink underline (`palette.ulInk`, fat 7/0.3 wash + tight 2.6/0.95 core, dash-drawn at st+0.12/+0.15); band + the line under the gesture yield (`body.yield`) while the apex lands; the band exits with the last line on one final R→L wipe | fg | `brush-wipe` (the gesture at low amplitude: clipPath inset reveal L→R 0.16s power2.out with a blurred per-word brush-head shadow riding the reveal edge, then vanishing) | wet-cloth WIPE (the reveal in reverse: the line clipPath wipes R→L over 0.10–0.14s power2.in with an erase brush head riding it, at min(next line − 0.136, lastWord + `body.maxHold`); the LAST line and the band wipe together at DUR−0.142) |
70
70
  | `inkrail` | sumi ink on still water: up to THREE fixed reading rows at the bottom center (`body.bottomPx` = last-row center, `body.rowGap` apart; rows cycle in pairs, the closing line takes the third row — the final thought ACCUMULATES instead of replacing); `fonts.body` Mincho serif at `body.fontPx`/`body.weight`/`body.letterSpacing`, `palette.body` ink over a paper-white text-shadow halo (`palette.paper`/`paper2` glow stack — readable on bright skies) with a duplicate blurred dark halo per word; an ink-settling RULE (86%-width gradient hairline, scaleX 0→1 over 0.9s) draws beneath each line at firstWord+0.12; emphasis words shed a faint ink wisp curling off the word top (st+0.55, ±dir by line parity, skipped near clip end); the rows visible under the bloom yield (`body.yield` — dim at heroIn+`delay`, restore at heroIn+`post` only with runway before the exit) | fg | `bleed` (the apex bloom at low amplitude: opacity snaps in 2 frames; blur 12→0 + scale 1.25→1 power2.out carry the bleed — late words bleed faster so they resolve before clip end; the dark halo overshoots scale 1.5→1.04 while its opacity decays 0.5→0.25) | RE-DISSOLVE (blur 9 + scale 1.13 + fade + y−8 power1.in — ink dispersing back into the water) as the line-after-next approaches (= the next occupant of its row, outDur 0.5−0.05·i, never mid-read); the closing TWO lines persist to clip end |
71
71
  | `ransomrail` | kidnapper's collage rail: every transcript word is a cutout chip in one of 4 cycled recipes (cream/`fonts.body` Anton, black/`fonts.dark` Inter-800, newsprint/`fonts.news` Special Elite, accent/`fonts.accent` Permanent Marker — emphasis words snap to the accent chip, never two identical chips in a row) PASTED along the bottom rail line (`body.bottomPx`) with seeded crookedness (rot sign alternates with line+word parity, baseline dy leans the other way), seeded ±px sizes (`body.fontPx`−2..+1, emphasis +3) and torn edges (seeded 12-vertex tear polygon, same paper stock as the apex); chips carry a hard dy5 offset drop-shadow; lines breathe (5-key scale keyframes) through their hold; the whole railwrap yields (`body.yield`, container opacity — never contests per-chip channels) while the apex letters slam | fg | `paste` (the apex slam motif at low amplitude: opacity full in 1 frame at scale 1.12 / rot×1.5 / y−8 → power3.in crush 0.08s → 2-frame contact squash 1.05/0.95 → elastic settle; emphasis = 1-frame RE-PASTE lift at `body.emphDelay` — shadow grows to a flight blur, rotation flips sign for good, then crush + squash + elastic again, rip-runway-guarded) | RIPPED off one by one (rotation ±16/17° throw + y−30 + fade, power2.in, staggered 0.045s) with a 1-frame paper-tear flash under each chip — timed so the rip tail overlaps the next line's pastes a beat (collage chaos, by design); the last line tears off clamped to finish on frame |
72
+ | `stack` | the lesson surface, built for a MULTI-SHOT edit (interview set + demo inserts): a verbatim copy of a proven tip-listicle ad's captions, measured from its frames. Three layers, each with one job, and nothing animates: every element hard-cuts on and off. (1) SPOKEN STACKS: a small setup line (cap height `body.setupCap` × H) over the payoff (`body.payoffScale`×, gap `body.gap` × cap), `fonts.body` italic 900 at `body.stretch` width (char widths from `body.widthKey`), white, soft shadow (`body.shadow`), no outline, tracking `body.letterSpacing`, word spacing `body.wordSpacing`, left-aligned on the INK; sizes are cap heights turned into font sizes through `body.capRatio`, line tops through `body.capTop`. `"|"` splits setup from payoff (no `"|"`: up to 3 words are payoff only at `body.singleScale`×, longer lines put ⌊n/3⌋ words, 1–2, in the setup); a `"~"` prefix keeps a word verbatim-covered but undrawn (stutters); a closing period is dropped. An object in a line, `{x, y, s, p}`, places the stack (ink left and setup cap top, px) and sets the setup and payoff cap heights; a stack without one is placed from the matte (`frames_fg` as a coarse alpha grid, unioned over its window: the spot that clears the subject, sits beside it and nearest `body.prefY`, one anchor per run inside a shot), and its payoff, if wider than `body.maxWidth` × W, shrinks to 0.78× then breaks into two balanced rows. Cuts come from ffmpeg scdet (`body.cutThreshold`) or `theme.cuts`. (2) CHAPTER CARD (`theme.chapter`): a giant numeral beside a title over a small subtitle (`"/"` splits them) and an outline bookmark, top-left (`side:"right"` mirrors it), cut to cut around its phrase. (3) LOWER THIRDS (`theme.items`): on the result shot, a `palette.accent` number over the technique name (`fonts.tag` 900 at 125% width, two balanced rows when wide) and the prompt quoted under it in the same face, all caps (a `"/"` in `prompt` breaks the quote by hand); `layout` `"stack"` (default: name over quote), `"beside"` (name right of the quote, on its bottom line) or `"right"` (name right-aligned above); `before` puts a thin wide label (`fonts.tag` 400 at 125%, centred) on the shot before the next cut, and the lower third cuts in on that cut. Spoken stacks whose first word falls inside a card or lower-third window are not drawn (still verbatim-covered). Heroless by design; `plate.grain` 0 | fg | setup on the frame of its first word (on the cut when one falls within `body.cutLead` s before it), payoff on its own first word; card and lower thirds on their cut | at the next stack, `body.hold` s after the last word, or the shot cut, whichever comes first; card and lower thirds on their cut |
72
73
 
73
74
  fg body uses the **rail.html alpha-webm channel** (true alpha — dark panels and
74
75
  scrims work; never the screen-blend index_fg path, which can only add light).
@@ -180,7 +181,16 @@ stays embedded behind the subject.
180
181
  "width": 1280, "height": 720, // optional, default 1280x720 (theme DNAs are tuned
181
182
  // for 16:9; vertical needs a DNA variant)
182
183
  "fps": 24, // optional — matte.fps is AUTHORITATIVE when present
183
- "panelHeader": "..." } // optional (panel paradigm)
184
+ "panelHeader": "...", // optional (panel paradigm)
185
+ "cuts": [4.67, 5.73], // optional (stack) — shot cuts in seconds; default: detected
186
+ "chapter": { "match": "Save this.", // optional (stack) — the chapter card on this phrase
187
+ "number": "4", "title": "things to put / in the air",
188
+ "side": "left", "out": 5.7 }, // "right" mirrors it; window override
189
+ "items": [{ "match": "Haze,", // optional (stack) — one lower third per technique
190
+ "name": "Haze", "prompt": "thin haze, / volumetric light", // "/" breaks the quote
191
+ "layout": "stack", // "stack" | "beside" | "right"
192
+ "before": "Empty air", // optional label on the shot before the next cut
193
+ "number": "1", "out": 10.2 }] } // default number = position; window override
184
194
  ```
185
195
 
186
196
  Scene awareness (inherited from the existing typography system): when
@@ -230,6 +240,21 @@ render-theme.sh exits 0 and prints the gates summary.
230
240
  - then: `bash scripts/render-theme.sh <project>` → **`final_fx.mp4`** (the
231
241
  deliverable; `final.mp4` is pre-plate-reaction)
232
242
 
243
+ The `lesson` identity (`stack` paradigm) authors the same `lines` with a `"|"`
244
+ between setup and payoff and, where a shot needs it, an `{x, y, s, p}` object
245
+ placing the stack; it adds `chapter` and `items`. Set `width`/`height` to the
246
+ source (it is proportional, so 4:3, 16:9 and 9:16 all work). Cut-together
247
+ footage is expected:
248
+
249
+ ```json
250
+ {
251
+ "dna": "lesson", "width": 1440, "height": 1080,
252
+ "lines": [["Because", "|", "the", "air", "is", "empty.", { "x": 838, "y": 640, "s": 38, "p": 70 }], ["Save", "this."], ["Haze,", "right?"]],
253
+ "chapter": { "match": "Save this.", "number": "4", "title": "things to put / in the air" },
254
+ "items": [{ "match": "Haze,", "name": "Haze", "prompt": "thin haze, / volumetric light", "layout": "beside", "before": "Empty air" }]
255
+ }
256
+ ```
257
+
233
258
  Prereqs identical to other modes — `prepare.sh` outputs: transcript.json,
234
259
  frames_fg/, matte.fps, safe-zones.json (scene awareness), source.mp4.
235
260
  frames_bg/ is only needed by preview-frames.cjs, not by the render.
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "lesson",
3
+ "voice": "the prompt lesson, cloned from a proven tip-listicle ad. Spoken two-tier stacks beside the speaker's face: a small setup line over a payoff 1.84× its size, Archivo Black Italic at its narrowest width, white caps with tight tracking and a soft shadow, no outline, each line cutting in on its first word and out at the next stack or the cut. A chapter card answers the save ask (giant numeral, title over subtitle, an outline bookmark), a thin wide label names the before shot, and each technique gets a lower third on its result shot: an orange number over the name in Archivo Black at its widest, with the prompt quoted under it in the same face.",
4
+ "when": "educational and tip-listicle ads cut from several shots (interview sets, demo inserts): \"N things\", prompt lessons, how-to explainers where the quotable line must hold on screen. Built for multi-shot edits: every stack is placed per shot (authored or from the matte), every exit snaps to the cut.",
5
+ "register": "clean",
6
+ "fonts": { "body": "Archivo", "hero": "Archivo", "tag": "Archivo" },
7
+ "palette": { "body": "#FFFFFF", "accent": "#DD7326" },
8
+ "body": {
9
+ "paradigm": "stack",
10
+ "layer": "fg",
11
+ "widthKey": "Archivo Italic 62.5",
12
+ "stretch": "62.5%",
13
+ "capRatio": 0.69,
14
+ "capTop": 0.125,
15
+ "setupCap": 0.0352,
16
+ "payoffScale": 1.84,
17
+ "singleScale": 1.1,
18
+ "gap": 0.21,
19
+ "letterSpacing": -0.055,
20
+ "wordSpacing": 0.075,
21
+ "shadow": "0 2px 6px rgba(0,0,0,0.32)",
22
+ "maxWidth": 0.56,
23
+ "prefY": 0.7,
24
+ "hold": 0.12,
25
+ "cutLead": 0.12,
26
+ "cutThreshold": 12
27
+ },
28
+ "hero": { "setpiece": "none" },
29
+ "plate": { "grain": 0 },
30
+ "linkages": []
31
+ }