Art and animation, written as code. Illustrations, loops, interactive web art, launch-videos and scored films in dozens of styles, identical on every render.
TypeScript agent-skillsanimationcanvasclaude-codeclaude-pluginclaude-skillscodex-plugincreative-codecreative-codingcreative-toolsdeterministicgenerative-arthand-drawnillustrationlaunch-videomotion-designmotion-graphicspluginprocedural-generationskill
launch: example ledgers, wrapped install lines, word-page bloom from the words on 9:16
Alex Greenshpun69494070f37d
diff --git a/plugins/anidoodle/skills/anidoodle/engine/facts/launchExample.json b/plugins/anidoodle/skills/anidoodle/engine/facts/launchExample.jsonnew file mode 100644index 0000000..b902958--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/engine/facts/launchExample.json@@ -0,0 +1,9 @@+{+ "version": 1,+ "about": "The ledger of launchExample, a demo launch film for a made-up product ('Your Product'). It makes no factual claim: every line is placeholder copy written for the template, labelled generated.",+ "claims": [+ { "claim": "IDEA IN.", "where": "on-screen", "generated": true, "note": "demo slogan written for the template example, states no fact" },+ { "claim": "ART OUT.", "where": "on-screen", "generated": true, "note": "demo slogan written for the template example, states no fact" },+ { "claim": "One sentence that says what it is", "where": "on-screen", "generated": true, "note": "placeholder tagline that tells the user what to write here, states no fact" }+ ]+}diff --git a/plugins/anidoodle/skills/anidoodle/engine/facts/launchExampleClean.json b/plugins/anidoodle/skills/anidoodle/engine/facts/launchExampleClean.jsonnew file mode 100644index 0000000..75b6d29--- /dev/null+++ b/plugins/anidoodle/skills/anidoodle/engine/facts/launchExampleClean.json@@ -0,0 +1,13 @@+{+ "version": 1,+ "about": "The ledger of launchExampleClean, a demo launch film for a made-up product ('Tally'). Its words describe the mock product shown on screen, written for the template, labelled generated. The UI's figures are made-up sample data in a mock screen, not claims.",+ "claims": [+ { "claim": "ASK ONCE.", "where": "on-screen", "generated": true, "note": "demo slogan for a made-up product, states no fact" },+ { "claim": "DONE.", "where": "on-screen", "generated": true, "note": "demo slogan for a made-up product, states no fact" },+ { "claim": "Books close", "where": "on-screen", "generated": true, "note": "describes the mock UI on screen beside it (its rows reaching their after state); the product is made up" },+ { "claim": "themselves.", "where": "on-screen", "generated": true, "note": "second line of 'Books close themselves.', describes the mock UI beside it; the product is made up" },+ { "claim": "And it shows", "where": "on-screen", "generated": true, "note": "describes the mock reports screen beside it; the product is made up" },+ { "claim": "you where.", "where": "on-screen", "generated": true, "note": "second line of 'And it shows you where.', describes the mock reports screen beside it; the product is made up" },+ { "claim": "Bookkeeping that does itself", "where": "on-screen", "generated": true, "note": "demo tagline for a made-up product, states no fact" }+ ]+}diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchLayout.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchLayout.tsindex 6e0e048..d7b1f48 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchLayout.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchLayout.ts@@ -52,6 +52,37 @@ export const MIN_PX = { phone: { read: 32, chrome: 24, type: 64 }, desk: { read:const NARROW = new Set([..."il.,:;'|!ijtf()[] "]), SEMI = new Set([..."rsz-\"*"]), WIDE = new Set([..."mw"]), CAPW = new Set([..."MW"]);export const estWidth = (text: string, px: number) => [...text].reduce((a, ch) => a + px * (NARROW.has(ch) ? 0.3 : SEMI.has(ch) ? 0.48 : WIDE.has(ch) ? 0.88 : CAPW.has(ch) ? 0.98 : /[A-Z]/.test(ch) ? 0.72 : /[0-9]/.test(ch) ? 0.6 : 0.6), 0);export const monoWidth = (text: string, px: number) => text.length * px * 0.61;++// Install lines as the end card's panel rows. Each line keeps one row while every line can be at least+// `min` px mono in `avail` px; a line that cannot wraps at a natural break, a space first (after the+// command word), then before "@" or after "/". Its continuation rows hang INDENT characters in, with no+// prompt glyph, so the command still reads as one line to type. A line with no break that fits stays+// whole (the size check then refuses it). px: the mono size every row is set at, at most `cap`.+export type InstallRow = { text: string; indent: number };+export const INSTALL_INDENT = 2;+export const installRows = (lines: string[], avail: number, min: number, cap: number): { rows: InstallRow[]; px: number; wrapped: boolean } => {+ const px0 = Math.min(cap, ...lines.map((s) => avail / (s.length * 0.61)));+ if (px0 >= min) return { rows: lines.map((text) => ({ text, indent: 0 })), px: px0, wrapped: false };+ const most = Math.floor(avail / (min * 0.61)); // characters a row holds at the minimum size+ // where a line may break: [end of this row, start of the next]; a space is dropped, "@" opens the next row, "/" closes this one+ const breaks = (t: string, kind: "space" | "mark") => [...t].flatMap((ch, i) => (kind === "space" ? (ch === " " && i > 0 ? [[i, i + 1]] : []) : ch === "@" && i > 0 ? [[i, i]] : ch === "/" && i > 0 && i < t.length - 1 ? [[i + 1, i + 1]] : []));+ const wrap = (t: string, indent: number): InstallRow[] | null => {+ if (t.length + indent <= most) return [{ text: t, indent }];+ // two rows if any break gives two (a space first, the longest first row), else more+ for (const kind of ["space", "mark"] as const) for (const [end, next] of breaks(t, kind).reverse()) if (end + indent <= most && t.length - next + INSTALL_INDENT <= most) return [{ text: t.slice(0, end), indent }, { text: t.slice(next), indent: INSTALL_INDENT }];+ for (const kind of ["space", "mark"] as const) {+ // the longest first row that fits, whose rest can be wrapped in turn+ for (const [end, next] of breaks(t, kind).reverse()) {+ if (end + indent > most) continue;+ const rest = wrap(t.slice(next), INSTALL_INDENT);+ if (rest) return [{ text: t.slice(0, end), indent }, ...rest];+ }+ }+ return null;+ };+ const rows = lines.flatMap((t) => (avail / (t.length * 0.61) >= min ? [{ text: t, indent: 0 }] : wrap(t, 0) ?? [{ text: t, indent: 0 }]));+ return { rows, px: Math.min(cap, ...rows.map((r) => avail / ((r.text.length + r.indent) * 0.61))), wrapped: rows.length > lines.length };+};export const wrapEst = (text: string, px: number, maxW: number): string[] => {const out: string[] = []; let line = "";for (const w of text.split(" ")) { const t = line ? `${line} ${w}` : w; if (!line || estWidth(t, px) <= maxW) line = t; else { out.push(line); line = w; } }@@ -66,7 +97,7 @@ export type LaunchLayout = {cam: { home: Cam; macroZ: number; macroCreep: number; macroX0: number; macroY: number; follow: boolean; leanZ: number; pointerOff: P; pointerS: number; pointerOn: P };bug: { x: number; y: number; px: number };type: { maxW: number; cap1: number; capN: number; minPx: number; cover: number; at?: P }; // at: the words' centre when it is not the frame's- end: { cx: number; titleY: number; titleMax: number; titleW: number; tagline: string[]; taglineY: number; taglinePx: number; taglineLH: number; panelY: number; monoPx: number; rowH: number; padX: number; lineY0: number; footerPx: number; footerY: number; caret: [number, number] };+ end: { cx: number; titleY: number; titleMax: number; titleW: number; tagline: string[]; taglineY: number; taglinePx: number; taglineLH: number; panelY: number; monoPx: number; rows: InstallRow[]; wrapped: boolean; rowH: number; padX: number; lineY0: number; footerPx: number; footerY: number; caret: [number, number] };split: { words: Rect; ui: Rect; vertical: boolean; wordsPx: number };stage: Rect; band: Rect | null;uiFull: Rect; // a product-UI ask's panel when it has no words beside it@@ -84,7 +115,7 @@ const desk = (c: LayoutContent): LaunchLayout => {cam: { home: { c: [960, 540], z: 1 }, macroZ: 2.4, macroCreep: 0.25, macroX0: 330, macroY: 934, follow: true, leanZ: 1.18, pointerOff: [1780, 1140], pointerS: 1.35, pointerOn: [g.GEN.x + g.GEN.w / 2 + 18, g.GEN.y + g.GEN.h / 2 + 6] },bug: { x: W - 40, y: H - 34, px: 24 },type: { maxW: 1560, cap1: 190, capN: 130, minPx: MIN_PX.desk.type, cover: 1110 },- end: { cx: W / 2, titleY: 400, titleMax: 150, titleW: 1300, tagline: [c.tagline], taglineY: 520, taglinePx: 30, taglineLH: 40, panelY: py, monoPx: 30, rowH: 60, padX: 60, lineY0: py + 55, footerPx: 24, footerY: py + ph + 60, caret: [16, 34] },+ end: { cx: W / 2, titleY: 400, titleMax: 150, titleW: 1300, tagline: [c.tagline], taglineY: 520, taglinePx: 30, taglineLH: 40, panelY: py, monoPx: 30, rows: c.install.map((text) => ({ text, indent: 0 })), wrapped: false, rowH: 60, padX: 60, lineY0: py + 55, footerPx: 24, footerY: py + ph + 60, caret: [16, 34] },// a two-column grid on the frame's centre line: words 40 %, a 100 px gutter, the live UI 46 %, equal marginssplit: { words: { x: 150, y: 150, w: 720, h: 780 }, ui: { x: 970, y: 120, w: 800, h: 840 }, vertical: false, wordsPx: 96 },stage: { x: 0, y: 0, w: W, h: H }, band: null,@@ -117,9 +148,9 @@ const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number, S: Rconst card = Math.round(Math.min(g.INPUT.w, viewBottom - top - 58 * k - 2 * bubbleLineH - 60 * k));const cardX = g.CHAT.x + (g.CHAT.w - card) / 2;// the end card, stacked and centred in E- const mono = Math.min(30 * k, ...c.install.map((s) => (Ew - 2 * 32 - 2 * 36) / (s.length * 0.61)));+ const inst = installRows(c.install, Ew - 2 * 32 - 2 * 36, min.read, 30 * k), mono = inst.px;const taglinePx = Math.max(30 * k, min.read), tagline = wrapEst(c.tagline, taglinePx, Ew - 2 * m - 60), tLH = Math.round(taglinePx * 1.3);- const titleMax = 150 * k, rowH = Math.round(mono * 2), ph = rowH * c.install.length + 50 * k;+ const titleMax = 150 * k, rowH = Math.round(mono * 2), ph = rowH * inst.rows.length + 50 * k;const block = titleMax + 60 + tagline.length * tLH + 60 + ph + 80, y0 = E.y0 + (Eh - block) / 2 - 20;const titleY = y0 + titleMax * 0.62, taglineY = y0 + titleMax + 60 + tLH / 2, panelY = taglineY + (tagline.length - 0.5) * tLH + 50;// the split beat, stacked: the words on top, the live UI under them. On 9x16 both sit in the window's@@ -131,6 +162,8 @@ const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number, S: R: { words: { x: 80, y: 90, w: W - 160, h: Math.round(H * 0.3) }, ui: { x: m + 20, y: Math.round(H * 0.3) + 130, w: W - 2 * m - 40, h: H - Math.round(H * 0.3) - 130 - 90 }, vertical: true, wordsPx: shape === "1x1" ? 76 : 84 };// a UI ask on its own: on 9x16 the window's rectangle less 6 %, the room its camera creeps intoconst uiFull = zones ? { x: Math.round(R.x + R.w * 0.03), y: Math.round(R.y + R.h * 0.03), w: Math.round(R.w * 0.94), h: Math.round(R.h * 0.94) } : { x: 40, y: Math.round(H * 0.1), w: W - 80, h: Math.round(H * 0.76) };+ // a word page: its lines, and on 9x16 its bloom too, centred on the window's rectangle+ const typeAt: P = [E.x0 + Ew / 2, R.y + R.h / 2];// the hook: the prompt big, the camera gliding after the caret (and down a line when the words wrap)const macroZ = { "1x1": 1.85, "4x5": 1.95, "9x16": 2.05 }[shape];return {@@ -139,8 +172,8 @@ const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number, S: R// on 9x16 the lean on a new card goes further: the card is smaller there, and the rest of the window fades as it leaves the safe areacam: { home: { c: [W / 2, H / 2], z: 1 }, macroZ, macroCreep: macroZ * 0.08, macroX0: W / 2 / macroZ - 60 * k, macroY: g.INPUT.y + g.INPUT.h / 2, follow: true, leanZ: zones ? 1.5 : 1.1, pointerOff: [W - 110, H + 70], pointerS: 1.35 * k, pointerOn: [g.GEN.x + g.GEN.w / 2 + 18 * k, g.GEN.y + g.GEN.h / 2 + 6 * k] },bug: { x: E.x1 - m - 10, y: E.y1 - bugStrip / 2 + bugPx * 0.1, px: bugPx },- type: { maxW: Ew - 2 * 90, cap1: 190, capN: 150, minPx: min.type, cover: Math.ceil(Math.hypot(W, H) / 2) + 9, ...(zones ? { at: [E.x0 + Ew / 2, R.y + R.h / 2] as P } : {}) },- end: { cx: E.x0 + Ew / 2, titleY, titleMax, titleW: Ew - 2 * m - 80, tagline, taglineY, taglinePx, taglineLH: tLH, panelY, monoPx: mono, rowH, padX: 36, lineY0: panelY + 25 * k + rowH / 2, footerPx: Math.max(24 * k, min.read), footerY: panelY + ph + 60, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] },+ type: { maxW: Ew - 2 * 90, cap1: 190, capN: 150, minPx: min.type, cover: zones ? Math.ceil(Math.max(...[[0, 0], [W, 0], [0, H], [W, H]].map(([x, y]) => Math.hypot(x - typeAt[0], y - typeAt[1])))) + 9 : Math.ceil(Math.hypot(W, H) / 2) + 9, ...(zones ? { at: typeAt } : {}) }, // cover: the bloom's reach to the farthest corner from where it opens+ end: { cx: E.x0 + Ew / 2, titleY, titleMax, titleW: Ew - 2 * m - 80, tagline, taglineY, taglinePx, taglineLH: tLH, panelY, monoPx: mono, rows: inst.rows, wrapped: inst.wrapped, rowH, padX: 36, lineY0: panelY + 25 * k + rowH / 2, footerPx: Math.max(24 * k, min.read), footerY: panelY + ph + 60, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] },split, stage: { x: 0, y: 0, w: W, h: H }, band: null, uiFull, safe: S, zones,roles: [],};diff --git a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.tsindex 27bbe47..13ff45f 100644--- a/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts@@ -28,7 +28,7 @@ import {C, SANS, MONO, camLerp, caretAt, charTimes, clamp, drawChatFrame, expo, inOut, inkCard, inkDrop,lerp, lerpP, out3, plateLayer, pointer, press, ramp, rr, spring, toScreen, typedAt, useCam, type Cam, type Drop, type ChatGeom, type Rect,} from "./launchKit";-import { launchLayout, estWidth, wrapEst, SHAPES, type LaunchLayout, type Shape } from "./launchLayout";+import { launchLayout, estWidth, installRows, wrapEst, SHAPES, type LaunchLayout, type Shape } from "./launchLayout";import { chatGeom } from "./launchKit";import { beatGrid, bloomFrame, bloomRadius, makeCut, pic, type, typeFrame, type Seg, type TypeLine } from "./launchCut";import { measure, writeOn, setType } from "./kinetic";@@ -390,11 +390,12 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {const END_L = (() => {if (!clean) return L.end;// (9x16: measured on the safe rectangle's width and centred on its height)- const AW = ZONES ? SAFE.w - 24 : W, E = L.end, n = spec.install.length, tp = E.taglinePx * 1.5, tl = wrapEst(spec.tagline, tp, AW * (ZONES ? 0.9 : 0.8)), tLH = Math.round(tp * 1.3);- const mono = Math.min(E.monoPx * 1.35, ...spec.install.map((x) => (AW * 0.86 - 2 * E.padX) / (x.length * 0.61))), rowH = Math.round(mono * 2), ph = rowH * n + 50 * k;+ const AW = ZONES ? SAFE.w - 24 : W, E = L.end, tp = E.taglinePx * 1.5, tl = wrapEst(spec.tagline, tp, AW * (ZONES ? 0.9 : 0.8)), tLH = Math.round(tp * 1.3);+ const inst = installRows(spec.install, AW * 0.86 - 2 * E.padX, minPx, E.monoPx * 1.35), mono = inst.px, rowH = Math.round(mono * 2), ph = rowH * inst.rows.length + 50 * k;+ if (mono < minPx - 1e-9) throw new Error(`launchTemplate ${shape}: the install lines would be ${mono.toFixed(1)} px on the clean end card (phone-safe minimum ${minPx} px). Shorten the install line, or ship this shape without it`);const g1 = titleSize * 0.42, g2 = tLH * 0.9, g3 = spec.footer ? 44 * k : 0, block = titleSize * 0.74 + g1 + tl.length * tLH + g2 + ph + g3 + (spec.footer ? E.footerPx : 0);const titleY = (ZONES ? SAFE.y * 2 + SAFE.h - block : H - block) / 2 + titleSize * 0.74, taglineY = titleY + g1 + tLH / 2, panelY = taglineY + (tl.length - 0.5) * tLH + g2;- return { ...E, titleY, tagline: tl, taglinePx: tp, taglineLH: tLH, taglineY, panelY, monoPx: mono, rowH, lineY0: panelY + 25 * k + rowH / 2, footerY: panelY + ph + g3 + E.footerPx / 2, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] as [number, number] };+ return { ...E, titleY, tagline: tl, taglinePx: tp, taglineLH: tLH, taglineY, panelY, monoPx: mono, rows: inst.rows, wrapped: inst.wrapped, rowH, lineY0: panelY + 25 * k + rowH / 2, footerY: panelY + ph + g3 + E.footerPx / 2, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] as [number, number] };})();const titleW = clean ? estWidth(spec.title, titleSize) * 1.08 : measure(spec.title, titleSize);const dotR = titleSize * (clean ? 0.1 : 0.085), dotGap = titleSize * 0.1;@@ -443,12 +444,16 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {c.globalAlpha = ramp(e, 34 + Q, 46 + Q); c.fillStyle = PAL.soft; c.font = SANS(500, E.taglinePx); E.tagline.forEach((t, j) => c.fillText(t, cx, E.taglineY + j * E.taglineLH + rise(34 + Q)));c.translate(0, rise(40 + Q));c.globalAlpha = ramp(e, 40 + Q, 52 + Q); c.font = MONO(E.monoPx);- const nI = spec.install.length, pw = Math.max(...spec.install.map((s) => c.measureText(s).width)) + 2 * E.padX, ph = E.rowH * nI + 2 * (E.lineY0 - E.panelY) - E.rowH, py = E.panelY;+ // one row per install line, centred; a wrapped line's rows are set left in the panel, its continuation indented+ const rows = E.rows, nI = rows.length, cw = c.measureText("0").width, rowW = (r: { text: string; indent: number }) => c.measureText(r.text).width + r.indent * cw;+ const pw = (E.wrapped ? Math.max(...rows.map(rowW)) : Math.max(...spec.install.map((s) => c.measureText(s).width))) + 2 * E.padX, ph = E.rowH * nI + 2 * (E.lineY0 - E.panelY) - E.rowH, py = E.panelY, x0 = cx - pw / 2 + E.padX;c.fillStyle = clean ? PAL.ink : "#1f1c18"; rr(c, cx - pw / 2, py, pw, ph, 22 * L.k); c.fill();- c.fillStyle = clean ? "#ffffff" : "#ece4d6"; spec.install.forEach((s, j) => c.fillText(s, cx, E.lineY0 + j * E.rowH));- // a terminal caret blinks after the last line: the hold reads as live, never as a freeze- const lastW = c.measureText(spec.install[nI - 1]).width;- if (Math.floor((e - 40 - Q) / 15) % 2 === 0) { if (clean) c.fillStyle = THEME.accent; c.fillRect(cx + lastW / 2 + 8 * (E.monoPx / 30), E.lineY0 + (nI - 1) * E.rowH - E.caret[1] / 2, E.caret[0], E.caret[1]); }+ c.fillStyle = clean ? "#ffffff" : "#ece4d6";+ if (E.wrapped) { c.textAlign = "left"; rows.forEach((r, j) => c.fillText(r.text, x0 + r.indent * cw, E.lineY0 + j * E.rowH)); c.textAlign = "center"; }+ else spec.install.forEach((s, j) => c.fillText(s, cx, E.lineY0 + j * E.rowH));+ // a terminal caret blinks after the last row: the hold reads as live, never as a freeze+ const lastW = c.measureText(rows[nI - 1].text).width, caretX = E.wrapped ? x0 + rowW(rows[nI - 1]) + 8 * (E.monoPx / 30) : cx + lastW / 2 + 8 * (E.monoPx / 30);+ if (Math.floor((e - 40 - Q) / 15) % 2 === 0) { if (clean) c.fillStyle = THEME.accent; c.fillRect(caretX, E.lineY0 + (nI - 1) * E.rowH - E.caret[1] / 2, E.caret[0], E.caret[1]); }if (spec.footer) { c.fillStyle = PAL.soft; c.font = SANS(500, E.footerPx); c.fillText(spec.footer, cx, E.footerY); }c.globalAlpha = 1; c.textAlign = "left"; c.setTransform(env.scale, 0, 0, env.scale, 0, 0);};@@ -479,11 +484,12 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {const size = Math.min(nL === 1 ? 220 : 170, ...lines.map((l) => (maxW / (estWidth(l.text, 100) * 1.12)) * 100)), gap = size * 1.12, y0 = (at ? at[1] : H / 2) - ((nL - 1) * gap) / 2 + size * 0.36;lines.forEach((l, i) => setType(c, env, l.text, x0, y0 + i * gap, size, ramp(local, 14 + TYPE_O.lead + i * CLEAN_ST, 14 + TYPE_O.lead + 18 + i * CLEAN_ST), { color: l.color === C.accent ? THEME.accent : l.color ?? PAL.ink, weight: 800 }));bug(c, env);- }, { W, H, ...bloomOpts, rim: 4, ink: THEME.accent, radius: TYPE_R });+ }, { W, H, ...bloomOpts, rim: 4, ink: THEME.accent, radius: TYPE_R, ...(L.type.at ? { center: L.type.at } : {}) });// a word page's bloom is sized to the frame it covers (the desktop's 1250 px over a 1110 px cover):// on a smaller frame a fixed bloom would cover it before the words start, and two frames would matchconst TYPE_R = L.shape === "16x9" ? undefined : Math.round((1250 * L.type.cover) / 1110);- const TYPE_OPTS = L.shape === "16x9" ? TYPE_O : { ...TYPE_O, W, H, maxW: L.type.maxW, radius: TYPE_R, ...(L.type.at ? { text: L.type.at } : {}) };+ // (9x16: the page blooms from the words' centre, so its first drop lands where the words will be)+ const TYPE_OPTS = L.shape === "16x9" ? TYPE_O : { ...TYPE_O, W, H, maxW: L.type.maxW, radius: TYPE_R, ...(L.type.at ? { text: L.type.at, center: L.type.at } : {}) };const drawStage = (ctx: Ctx, env: Env, t: number) => {const { s, local } = cut.at(t), exact = Number.isInteger(t);if (s.kind === "pic") content(ctx, env, cut.contentOf(s, local), exact);@@ -530,7 +536,7 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {if (s.kind !== "type") return;const written = 14 + TYPE_O.lead + 18 + (s.lines.length - 1) * (clean ? CLEAN_ST : TYPE_O.stagger) - (clean ? 9 : 2); // local frame the last line is done (set type's out-cubic settles to the pixel sooner)// last frame the page still fills the frame (a round iris only clips the corners for its first closing frames: still a still)- const cover = clean ? Math.hypot(W, H) / 2 * 0.9 : L.type.cover;+ const cover = clean ? (L.type.at ? (L.type.cover - 9) * 0.9 : Math.hypot(W, H) / 2 * 0.9) : L.type.cover;let open = s.len - 1; while (open > written && bloomRadius(open + 2, s.len + 4, { radius: TYPE_R }) < cover) open--;holds.push([cut.STARTS[k] + written + 1, cut.STARTS[k] + open + 1]);});diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/facts.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/facts.test.tsindex 197e4cc..adde572 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/facts.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/facts.test.ts@@ -4,6 +4,10 @@import { checkFacts, entryProblems, normClaim, EMPTY_FACTS } from "../tools/factsrules.mjs";import { makeLaunchFilm } from "../src/canvas-core/launchTemplate";import type { Film } from "../src/canvas-core/film";+import exampleLedger from "../facts/launchExample.json";+import cleanLedger from "../facts/launchExampleClean.json";+import { launchExample } from "../src/canvas-core/launchExample";+import { launchExampleClean } from "../src/canvas-core/launchExampleClean";export const name = "facts";export const run = (ok: (cond: boolean, label: string) => void) => {@@ -39,4 +43,9 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(film.claims.join("|") === "ONE.|TWO.|Counts things.|Fast.", `a launch film declares its words, tagline and extra claims once each (${film.claims.join("|")})`);ok(film.reshape("9x16").claims.join("|") === film.claims.join("|"), "the claims are the same in every shape");ok(!film.claims.includes("draw it") && !film.claims.includes("npm i tally"), "prompts and install lines are not claims");+ // the shipped examples carry their own ledgers (facts/<film>.json), so launch.mjs ship passes for them+ for (const [nm, f, ledger] of [["launchExample", launchExample, exampleLedger], ["launchExampleClean", launchExampleClean, cleanLedger]] as const) {+ const r = checkFacts(f.claims, ledger);+ ok(r.status === "PASS" && ledger.claims.every((e: { generated?: boolean }) => e.generated === true), `${nm}: its ${r.checked} claims are all in facts/${nm}.json, labelled generated (${r.problems.map((p: { why: string }) => p.why).join("; ") || "no problems"})`);+ }};diff --git a/plugins/anidoodle/skills/anidoodle/engine/test/launchLayout.test.ts b/plugins/anidoodle/skills/anidoodle/engine/test/launchLayout.test.tsindex 81caed3..8cbbc94 100644--- a/plugins/anidoodle/skills/anidoodle/engine/test/launchLayout.test.ts+++ b/plugins/anidoodle/skills/anidoodle/engine/test/launchLayout.test.ts@@ -2,7 +2,7 @@// chat, the cards, the word pages, the split beat, the end card), every line a viewer reads is at// least the phone-safe size, nothing sits over anything else, and 16x9 is the desktop film exactly.import { CHAT_GEOM, chatGeom, CHAT } from "../src/canvas-core/launchKit";-import { launchLayout, SHAPES, MIN_PX, PHONE_SAFE, estWidth, monoWidth, parseShapes, type Shape } from "../src/canvas-core/launchLayout";+import { launchLayout, SHAPES, MIN_PX, PHONE_SAFE, estWidth, installRows, monoWidth, parseShapes, type Shape } from "../src/canvas-core/launchLayout";import { makeLaunchFilm, fitWords } from "../src/canvas-core/launchTemplate";import type { Film } from "../src/canvas-core/film";@@ -15,10 +15,8 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const g = chatGeom(CHAT, 1, CHAT_GEOM.px, 34, 0);ok(JSON.stringify([g.CHAT, g.INPUT, g.GEN, g.REPLY.x, g.REPLY.y, g.TEXT]) === JSON.stringify([CHAT_GEOM.CHAT, CHAT_GEOM.INPUT, CHAT_GEOM.GEN, CHAT_GEOM.REPLY.x, CHAT_GEOM.REPLY.y, CHAT_GEOM.TEXT]), "the chat derivation at k = 1 IS the desktop chat (one component, not two)");const content0 = { prompts: ["a lighthouse at sunset, as a print", "now a fox at dusk"], install: ["/plugin marketplace add alexgreensh/anidoodle", "/plugin install anidoodle@alexgreensh-anidoodle"], tagline: "Illustrations, loops and films, drawn in code" };- // anidoodle's own install lines (47 characters) cannot be 32 px mono inside 9x16's safe width, so 9x16 is laid out with shorter ones- const phoneContent = { ...content0, install: ["npm install your-product", "your-product init"] };for (const shape of Object.keys(SHAPES) as Shape[]) {- const content = shape === "9x16" ? phoneContent : content0;+ const content = content0;const L = launchLayout(shape, content), frame = { x: 0, y: 0, w: L.W, h: L.H }, c = L.chat;ok(L.W === SHAPES[shape].W && L.H === SHAPES[shape].H, `${shape}: the frame is ${L.W}x${L.H}`);const small = L.roles.filter((r) => r.px < r.min);@@ -28,7 +26,7 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(L.thread.cardX >= c.CHAT.x && L.thread.cardX + L.thread.card <= c.CHAT.x + c.CHAT.w && L.thread.card > 0, `${shape}: the answer card (${L.thread.card} px) sits inside the thread`);ok(L.thread.bubbles.every((ls) => ls.length <= 3), `${shape}: prompts wrap to at most 3 bubble lines (${L.thread.bubbles.map((b) => b.length).join(", ")})`);ok(L.bug.y > c.CHAT.y + c.CHAT.h, `${shape}: the corner mark sits below the chat window, never on it`);- const pw = Math.max(...content.install.map((s) => monoWidth(s, L.end.monoPx))) + 2 * L.end.padX;+ const pw = Math.max(...L.end.rows.map((r) => monoWidth(r.text, L.end.monoPx) + r.indent * L.end.monoPx * 0.61)) + 2 * L.end.padX;ok(pw <= L.W, `${shape}: the install panel (${pw.toFixed(0)} px at ${L.end.monoPx.toFixed(1)} px mono) fits the frame's width`);ok(L.end.titleY < L.end.taglineY && L.end.taglineY < L.end.panelY && L.end.footerY < L.stage.h, `${shape}: the end card stacks title, line, panel, footer, all in frame`);ok(!overlap(L.split.words, L.split.ui) && inside(L.split.words, L.stage) && inside(L.split.ui, L.stage), `${shape}: a split beat's words and live UI have their own areas (${L.split.vertical ? "stacked" : "side by side"})`);@@ -43,12 +41,24 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const bugW = estWidth("Your Product", L.bug.px) * 1.2;ok(inside({ x: L.bug.x - bugW, y: L.bug.y - L.bug.px, w: bugW, h: L.bug.px * 1.3 }, S), "9x16: the corner mark sits inside the safe rectangle");const at = L.type.at!; ok(!!at && inside({ x: at[0] - L.type.maxW / 2, y: at[1] - 10, w: L.type.maxW, h: 20 }, S), "9x16: a word page's lines are centred in the safe rectangle and no wider than it");- const pw0 = Math.max(...content.install.map((x) => monoWidth(x, E.monoPx))) + 2 * E.padX;+ const pw0 = pw;ok(inside({ x: E.cx - Math.max(E.titleW, pw0) / 2, y: E.titleY - E.titleMax, w: Math.max(E.titleW, pw0), h: E.footerY + E.footerPx - (E.titleY - E.titleMax) }, S), "9x16: the end card (name, line, install panel, footer) sits inside the safe rectangle");}let err = ""; try { launchLayout("16x9", { ...content0, band: true }); } catch (e) { err = (e as Error).message; } ok(/sidecar/.test(err), "16x9 refuses a burned-in band: its captions ship as .srt/.vtt");- err = ""; try { launchLayout("9x16", content0); } catch (e) { err = (e as Error).message; } ok(/install lines would be .*Shorten the install line/.test(err), `9x16 refuses an install line too long for the safe width at 32 px: ${err.slice(0, 80)}`);- err = ""; try { launchLayout("9x16", { ...content0, install: ["npx some-very-long-package-name@latest init --with-every-flag-there-is"] }); } catch (e) { err = (e as Error).message; } ok(/install lines would be/.test(err), `an install line that cannot be phone-safe is an error: ${err.slice(0, 80)}`);+ // install lines too long for the mono minimum wrap at a natural break, the continuation indented; short ones stay whole+ const T = launchLayout("9x16", content0).end, rowsOf = (r: { text: string; indent: number }[]) => r.map((x) => `${" ".repeat(x.indent)}${x.text}`).join(" | ");+ ok(T.wrapped && rowsOf(T.rows) === "/plugin marketplace add | alexgreensh/anidoodle | /plugin install | anidoodle@alexgreensh-anidoodle" && T.monoPx >= MIN_PX.phone.read, `9x16: anidoodle's own install lines wrap after the command word at ${T.monoPx.toFixed(1)} px: ${rowsOf(T.rows)}`);+ const one = installRows(["npm install tally"], 824.8, 32, 41), mixed = installRows(["npm i tally", "/plugin install anidoodle@alexgreensh-anidoodle"], 824.8, 32, 41);+ ok(!one.wrapped && one.rows.length === 1 && one.rows[0].text === "npm install tally" && one.rows[0].indent === 0, "a short install line stays on one row");+ ok(mixed.wrapped && rowsOf(mixed.rows) === "npm i tally | /plugin install | anidoodle@alexgreensh-anidoodle", `only the line that cannot fit wraps: ${rowsOf(mixed.rows)}`);+ const at = installRows(["npx anidoodle-package@alexgreensh-anidoodle-latest"], 700, 32, 41);+ ok(at.wrapped && rowsOf(at.rows) === "npx anidoodle-package | @alexgreensh-anidoodle-latest", `two rows when one break gives two: before "@" when no space does (${rowsOf(at.rows)})`);+ const mark = installRows(["alexgreensh-anidoodle@alexgreensh-anidoodle-x"], 600, 32, 41);+ ok(mark.wrapped && rowsOf(mark.rows) === "alexgreensh-anidoodle | @alexgreensh-anidoodle-x", `with no space it wraps before "@", the next row opening with it: ${rowsOf(mark.rows)}`);+ const slash = installRows(["alexgreensh-anidoodle/alexgreensh-anidoodle-x"], 600, 32, 41);+ ok(slash.wrapped && rowsOf(slash.rows) === "alexgreensh-anidoodle/ | alexgreensh-anidoodle-x", `or after "/", the row closing with it: ${rowsOf(slash.rows)}`);+ ok(JSON.stringify(installRows(["npm i a", "b init"], 944, 32, 33.6)) === JSON.stringify({ rows: [{ text: "npm i a", indent: 0 }, { text: "b init", indent: 0 }], px: 33.6, wrapped: false }), "lines that fit keep their size and rows exactly");+ err = ""; try { launchLayout("9x16", { ...content0, install: ["npx a-single-package-name-that-is-far-too-long-for-any-phone-frame-at-all"] }); } catch (e) { err = (e as Error).message; } ok(/install lines would be/.test(err), `an install line that cannot be phone-safe is an error: ${err.slice(0, 80)}`);ok(parseShapes("16x9, 9x16").join() === "16x9,9x16", "parseShapes reads a --shapes list");err = ""; try { parseShapes("16x10"); } catch (e) { err = (e as Error).message; } ok(/not a shape/.test(err), "parseShapes refuses an unknown shape");diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/facts.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/facts.mjsindex 0e17fda..daa4d19 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/facts.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/facts.mjs@@ -10,6 +10,7 @@// { "claim": "IDEA IN. ART OUT.", "where": "on-screen", "generated": true, "note": "slogan written for this film, states no fact" } ] }//// node tools/facts.mjs <film>[-<shape>] [--facts facts.json] every claim the film declares is listed and well formed+// (default: facts/<film>.json if the film has its own, else facts.json)// node tools/facts.mjs init [--facts facts.json] write an empty facts.json (never overwrites)//// A film declares its claims as `film.claims` (a launch template film: the type-frame words, the split@@ -25,11 +26,14 @@ import { resolve } from "node:path";import { isMain } from "./is-main.mjs";import { EMPTY_FACTS, checkFacts, claimsOf } from "./factsrules.mjs";+// A film's ledger: facts/<film>.json when it has one of its own (the shipped examples do, so they never+// seed a user's facts.json), else the project's facts.json.+export const factsFile = (film) => { const own = resolve("facts", `${String(film ?? "").replace(/-(16x9|1x1|4x5|9x16)$/, "")}.json`); return existsSync(own) ? own : resolve("facts.json"); };export const readFacts = (file) => { if (!existsSync(file)) return { facts: null }; try { return { facts: JSON.parse(readFileSync(file, "utf8")) }; } catch (e) { return { facts: null, error: `${file} is not valid JSON: ${e.message}` }; } };export const initFacts = (file) => { if (existsSync(file)) return false; writeFileSync(file, JSON.stringify(EMPTY_FACTS, null, 2) + "\n"); return true; };if (isMain(import.meta.url)) {- const argv = process.argv.slice(2), fi = argv.indexOf("--facts"), file = resolve(fi >= 0 ? argv[fi + 1] : "facts.json"), name = argv.find((a, i) => !a.startsWith("--") && argv[i - 1] !== "--facts");+ const argv = process.argv.slice(2), fi = argv.indexOf("--facts"), name = argv.find((a, i) => !a.startsWith("--") && argv[i - 1] !== "--facts"), file = fi >= 0 ? resolve(argv[fi + 1]) : name === "init" ? resolve("facts.json") : factsFile(name);const USAGE = "node tools/facts.mjs <film>[-<shape>] [--facts facts.json]\n node tools/facts.mjs init [--facts facts.json]";if (name === "init") { console.log(initFacts(file) ? `facts: wrote ${file}` : `facts: ${file} already exists; left as it is`); process.exit(0); }const { requireFilm } = await import("./names.mjs"), { loadFilm } = await import("./captions.mjs");diff --git a/plugins/anidoodle/skills/anidoodle/engine/tools/launch.mjs b/plugins/anidoodle/skills/anidoodle/engine/tools/launch.mjsindex 02e4ad4..11003e2 100644--- a/plugins/anidoodle/skills/anidoodle/engine/tools/launch.mjs+++ b/plugins/anidoodle/skills/anidoodle/engine/tools/launch.mjs@@ -26,7 +26,7 @@ import { resolve } from "node:path";import { knownFilms, requireFilm, SHAPE_NAMES } from "./names.mjs";import { filmMeta, loadFilm, writeCaptions } from "./captions.mjs";import { checkFacts, claimsOf } from "./factsrules.mjs";-import { initFacts, readFacts } from "./facts.mjs";+import { factsFile, initFacts, readFacts } from "./facts.mjs";const [cmd, name, ...rest] = process.argv.slice(2);const arg = (k, d) => { const i = rest.indexOf(`--${k}`); return i >= 0 ? rest[i + 1] : d; };@@ -115,7 +115,7 @@ const quiet = (args) => { const r = spawnSync(process.execPath, args, { encodingmkdirSync(resolve("out"), { recursive: true });const zoneMode = arg("zones", "fail"); if (!["fail", "warn"].includes(zoneMode)) die(`--zones is fail or warn, got '${zoneMode}'\nusage: ${USAGE}`);const rows = [];-const fx = readFacts(resolve("facts.json")), factsRes = fx.error ? { status: "FAIL", checked: 0, problems: [{ claim: "(facts.json)", why: fx.error }] } : checkFacts(claimsOf(await loadFilm(film)), fx.facts);+const fx = readFacts(factsFile(film)), factsRes = fx.error ? { status: "FAIL", checked: 0, problems: [{ claim: "(facts.json)", why: fx.error }] } : checkFacts(claimsOf(await loadFilm(film)), fx.facts);console.log(`\nFACTS ${film}: ${factsRes.status}${factsRes.status === "N/A" ? ` ${factsRes.reason}` : ` ${factsRes.checked} claim(s)`}`);for (const p of factsRes.problems) console.log(` FAIL "${p.claim.slice(0, 60)}" ${p.why}`);for (const sh of shapes) {diff --git a/plugins/anidoodle/skills/anidoodle/references/workflows/facts.md b/plugins/anidoodle/skills/anidoodle/references/workflows/facts.mdindex 550cf05..94c58cc 100644--- a/plugins/anidoodle/skills/anidoodle/references/workflows/facts.md+++ b/plugins/anidoodle/skills/anidoodle/references/workflows/facts.md@@ -29,7 +29,8 @@ research ledger (`explainer.md`) made general, and the launch film's list of app`where` is `on-screen` or `narration`. `launch.mjs new <name>` writes an empty one beside theproject and never overwrites one that is there; `node tools/facts.mjs init` does the same for-any project.+any project. A film with a ledger of its own in `facts/<film>.json` is checked against that one+instead (the shipped examples keep theirs there, so they never seed your `facts.json`).## The checkdiff --git a/skills/anidoodle/engine/facts/launchExample.json b/skills/anidoodle/engine/facts/launchExample.jsonnew file mode 100644index 0000000..b902958--- /dev/null+++ b/skills/anidoodle/engine/facts/launchExample.json@@ -0,0 +1,9 @@+{+ "version": 1,+ "about": "The ledger of launchExample, a demo launch film for a made-up product ('Your Product'). It makes no factual claim: every line is placeholder copy written for the template, labelled generated.",+ "claims": [+ { "claim": "IDEA IN.", "where": "on-screen", "generated": true, "note": "demo slogan written for the template example, states no fact" },+ { "claim": "ART OUT.", "where": "on-screen", "generated": true, "note": "demo slogan written for the template example, states no fact" },+ { "claim": "One sentence that says what it is", "where": "on-screen", "generated": true, "note": "placeholder tagline that tells the user what to write here, states no fact" }+ ]+}diff --git a/skills/anidoodle/engine/facts/launchExampleClean.json b/skills/anidoodle/engine/facts/launchExampleClean.jsonnew file mode 100644index 0000000..75b6d29--- /dev/null+++ b/skills/anidoodle/engine/facts/launchExampleClean.json@@ -0,0 +1,13 @@+{+ "version": 1,+ "about": "The ledger of launchExampleClean, a demo launch film for a made-up product ('Tally'). Its words describe the mock product shown on screen, written for the template, labelled generated. The UI's figures are made-up sample data in a mock screen, not claims.",+ "claims": [+ { "claim": "ASK ONCE.", "where": "on-screen", "generated": true, "note": "demo slogan for a made-up product, states no fact" },+ { "claim": "DONE.", "where": "on-screen", "generated": true, "note": "demo slogan for a made-up product, states no fact" },+ { "claim": "Books close", "where": "on-screen", "generated": true, "note": "describes the mock UI on screen beside it (its rows reaching their after state); the product is made up" },+ { "claim": "themselves.", "where": "on-screen", "generated": true, "note": "second line of 'Books close themselves.', describes the mock UI beside it; the product is made up" },+ { "claim": "And it shows", "where": "on-screen", "generated": true, "note": "describes the mock reports screen beside it; the product is made up" },+ { "claim": "you where.", "where": "on-screen", "generated": true, "note": "second line of 'And it shows you where.', describes the mock reports screen beside it; the product is made up" },+ { "claim": "Bookkeeping that does itself", "where": "on-screen", "generated": true, "note": "demo tagline for a made-up product, states no fact" }+ ]+}diff --git a/skills/anidoodle/engine/src/canvas-core/launchLayout.ts b/skills/anidoodle/engine/src/canvas-core/launchLayout.tsindex 6e0e048..d7b1f48 100644--- a/skills/anidoodle/engine/src/canvas-core/launchLayout.ts+++ b/skills/anidoodle/engine/src/canvas-core/launchLayout.ts@@ -52,6 +52,37 @@ export const MIN_PX = { phone: { read: 32, chrome: 24, type: 64 }, desk: { read:const NARROW = new Set([..."il.,:;'|!ijtf()[] "]), SEMI = new Set([..."rsz-\"*"]), WIDE = new Set([..."mw"]), CAPW = new Set([..."MW"]);export const estWidth = (text: string, px: number) => [...text].reduce((a, ch) => a + px * (NARROW.has(ch) ? 0.3 : SEMI.has(ch) ? 0.48 : WIDE.has(ch) ? 0.88 : CAPW.has(ch) ? 0.98 : /[A-Z]/.test(ch) ? 0.72 : /[0-9]/.test(ch) ? 0.6 : 0.6), 0);export const monoWidth = (text: string, px: number) => text.length * px * 0.61;++// Install lines as the end card's panel rows. Each line keeps one row while every line can be at least+// `min` px mono in `avail` px; a line that cannot wraps at a natural break, a space first (after the+// command word), then before "@" or after "/". Its continuation rows hang INDENT characters in, with no+// prompt glyph, so the command still reads as one line to type. A line with no break that fits stays+// whole (the size check then refuses it). px: the mono size every row is set at, at most `cap`.+export type InstallRow = { text: string; indent: number };+export const INSTALL_INDENT = 2;+export const installRows = (lines: string[], avail: number, min: number, cap: number): { rows: InstallRow[]; px: number; wrapped: boolean } => {+ const px0 = Math.min(cap, ...lines.map((s) => avail / (s.length * 0.61)));+ if (px0 >= min) return { rows: lines.map((text) => ({ text, indent: 0 })), px: px0, wrapped: false };+ const most = Math.floor(avail / (min * 0.61)); // characters a row holds at the minimum size+ // where a line may break: [end of this row, start of the next]; a space is dropped, "@" opens the next row, "/" closes this one+ const breaks = (t: string, kind: "space" | "mark") => [...t].flatMap((ch, i) => (kind === "space" ? (ch === " " && i > 0 ? [[i, i + 1]] : []) : ch === "@" && i > 0 ? [[i, i]] : ch === "/" && i > 0 && i < t.length - 1 ? [[i + 1, i + 1]] : []));+ const wrap = (t: string, indent: number): InstallRow[] | null => {+ if (t.length + indent <= most) return [{ text: t, indent }];+ // two rows if any break gives two (a space first, the longest first row), else more+ for (const kind of ["space", "mark"] as const) for (const [end, next] of breaks(t, kind).reverse()) if (end + indent <= most && t.length - next + INSTALL_INDENT <= most) return [{ text: t.slice(0, end), indent }, { text: t.slice(next), indent: INSTALL_INDENT }];+ for (const kind of ["space", "mark"] as const) {+ // the longest first row that fits, whose rest can be wrapped in turn+ for (const [end, next] of breaks(t, kind).reverse()) {+ if (end + indent > most) continue;+ const rest = wrap(t.slice(next), INSTALL_INDENT);+ if (rest) return [{ text: t.slice(0, end), indent }, ...rest];+ }+ }+ return null;+ };+ const rows = lines.flatMap((t) => (avail / (t.length * 0.61) >= min ? [{ text: t, indent: 0 }] : wrap(t, 0) ?? [{ text: t, indent: 0 }]));+ return { rows, px: Math.min(cap, ...rows.map((r) => avail / ((r.text.length + r.indent) * 0.61))), wrapped: rows.length > lines.length };+};export const wrapEst = (text: string, px: number, maxW: number): string[] => {const out: string[] = []; let line = "";for (const w of text.split(" ")) { const t = line ? `${line} ${w}` : w; if (!line || estWidth(t, px) <= maxW) line = t; else { out.push(line); line = w; } }@@ -66,7 +97,7 @@ export type LaunchLayout = {cam: { home: Cam; macroZ: number; macroCreep: number; macroX0: number; macroY: number; follow: boolean; leanZ: number; pointerOff: P; pointerS: number; pointerOn: P };bug: { x: number; y: number; px: number };type: { maxW: number; cap1: number; capN: number; minPx: number; cover: number; at?: P }; // at: the words' centre when it is not the frame's- end: { cx: number; titleY: number; titleMax: number; titleW: number; tagline: string[]; taglineY: number; taglinePx: number; taglineLH: number; panelY: number; monoPx: number; rowH: number; padX: number; lineY0: number; footerPx: number; footerY: number; caret: [number, number] };+ end: { cx: number; titleY: number; titleMax: number; titleW: number; tagline: string[]; taglineY: number; taglinePx: number; taglineLH: number; panelY: number; monoPx: number; rows: InstallRow[]; wrapped: boolean; rowH: number; padX: number; lineY0: number; footerPx: number; footerY: number; caret: [number, number] };split: { words: Rect; ui: Rect; vertical: boolean; wordsPx: number };stage: Rect; band: Rect | null;uiFull: Rect; // a product-UI ask's panel when it has no words beside it@@ -84,7 +115,7 @@ const desk = (c: LayoutContent): LaunchLayout => {cam: { home: { c: [960, 540], z: 1 }, macroZ: 2.4, macroCreep: 0.25, macroX0: 330, macroY: 934, follow: true, leanZ: 1.18, pointerOff: [1780, 1140], pointerS: 1.35, pointerOn: [g.GEN.x + g.GEN.w / 2 + 18, g.GEN.y + g.GEN.h / 2 + 6] },bug: { x: W - 40, y: H - 34, px: 24 },type: { maxW: 1560, cap1: 190, capN: 130, minPx: MIN_PX.desk.type, cover: 1110 },- end: { cx: W / 2, titleY: 400, titleMax: 150, titleW: 1300, tagline: [c.tagline], taglineY: 520, taglinePx: 30, taglineLH: 40, panelY: py, monoPx: 30, rowH: 60, padX: 60, lineY0: py + 55, footerPx: 24, footerY: py + ph + 60, caret: [16, 34] },+ end: { cx: W / 2, titleY: 400, titleMax: 150, titleW: 1300, tagline: [c.tagline], taglineY: 520, taglinePx: 30, taglineLH: 40, panelY: py, monoPx: 30, rows: c.install.map((text) => ({ text, indent: 0 })), wrapped: false, rowH: 60, padX: 60, lineY0: py + 55, footerPx: 24, footerY: py + ph + 60, caret: [16, 34] },// a two-column grid on the frame's centre line: words 40 %, a 100 px gutter, the live UI 46 %, equal marginssplit: { words: { x: 150, y: 150, w: 720, h: 780 }, ui: { x: 970, y: 120, w: 800, h: 840 }, vertical: false, wordsPx: 96 },stage: { x: 0, y: 0, w: W, h: H }, band: null,@@ -117,9 +148,9 @@ const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number, S: Rconst card = Math.round(Math.min(g.INPUT.w, viewBottom - top - 58 * k - 2 * bubbleLineH - 60 * k));const cardX = g.CHAT.x + (g.CHAT.w - card) / 2;// the end card, stacked and centred in E- const mono = Math.min(30 * k, ...c.install.map((s) => (Ew - 2 * 32 - 2 * 36) / (s.length * 0.61)));+ const inst = installRows(c.install, Ew - 2 * 32 - 2 * 36, min.read, 30 * k), mono = inst.px;const taglinePx = Math.max(30 * k, min.read), tagline = wrapEst(c.tagline, taglinePx, Ew - 2 * m - 60), tLH = Math.round(taglinePx * 1.3);- const titleMax = 150 * k, rowH = Math.round(mono * 2), ph = rowH * c.install.length + 50 * k;+ const titleMax = 150 * k, rowH = Math.round(mono * 2), ph = rowH * inst.rows.length + 50 * k;const block = titleMax + 60 + tagline.length * tLH + 60 + ph + 80, y0 = E.y0 + (Eh - block) / 2 - 20;const titleY = y0 + titleMax * 0.62, taglineY = y0 + titleMax + 60 + tLH / 2, panelY = taglineY + (tagline.length - 0.5) * tLH + 50;// the split beat, stacked: the words on top, the live UI under them. On 9x16 both sit in the window's@@ -131,6 +162,8 @@ const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number, S: R: { words: { x: 80, y: 90, w: W - 160, h: Math.round(H * 0.3) }, ui: { x: m + 20, y: Math.round(H * 0.3) + 130, w: W - 2 * m - 40, h: H - Math.round(H * 0.3) - 130 - 90 }, vertical: true, wordsPx: shape === "1x1" ? 76 : 84 };// a UI ask on its own: on 9x16 the window's rectangle less 6 %, the room its camera creeps intoconst uiFull = zones ? { x: Math.round(R.x + R.w * 0.03), y: Math.round(R.y + R.h * 0.03), w: Math.round(R.w * 0.94), h: Math.round(R.h * 0.94) } : { x: 40, y: Math.round(H * 0.1), w: W - 80, h: Math.round(H * 0.76) };+ // a word page: its lines, and on 9x16 its bloom too, centred on the window's rectangle+ const typeAt: P = [E.x0 + Ew / 2, R.y + R.h / 2];// the hook: the prompt big, the camera gliding after the caret (and down a line when the words wrap)const macroZ = { "1x1": 1.85, "4x5": 1.95, "9x16": 2.05 }[shape];return {@@ -139,8 +172,8 @@ const phone = (shape: Exclude<Shape, "16x9">, c: LayoutContent, H0: number, S: R// on 9x16 the lean on a new card goes further: the card is smaller there, and the rest of the window fades as it leaves the safe areacam: { home: { c: [W / 2, H / 2], z: 1 }, macroZ, macroCreep: macroZ * 0.08, macroX0: W / 2 / macroZ - 60 * k, macroY: g.INPUT.y + g.INPUT.h / 2, follow: true, leanZ: zones ? 1.5 : 1.1, pointerOff: [W - 110, H + 70], pointerS: 1.35 * k, pointerOn: [g.GEN.x + g.GEN.w / 2 + 18 * k, g.GEN.y + g.GEN.h / 2 + 6 * k] },bug: { x: E.x1 - m - 10, y: E.y1 - bugStrip / 2 + bugPx * 0.1, px: bugPx },- type: { maxW: Ew - 2 * 90, cap1: 190, capN: 150, minPx: min.type, cover: Math.ceil(Math.hypot(W, H) / 2) + 9, ...(zones ? { at: [E.x0 + Ew / 2, R.y + R.h / 2] as P } : {}) },- end: { cx: E.x0 + Ew / 2, titleY, titleMax, titleW: Ew - 2 * m - 80, tagline, taglineY, taglinePx, taglineLH: tLH, panelY, monoPx: mono, rowH, padX: 36, lineY0: panelY + 25 * k + rowH / 2, footerPx: Math.max(24 * k, min.read), footerY: panelY + ph + 60, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] },+ type: { maxW: Ew - 2 * 90, cap1: 190, capN: 150, minPx: min.type, cover: zones ? Math.ceil(Math.max(...[[0, 0], [W, 0], [0, H], [W, H]].map(([x, y]) => Math.hypot(x - typeAt[0], y - typeAt[1])))) + 9 : Math.ceil(Math.hypot(W, H) / 2) + 9, ...(zones ? { at: typeAt } : {}) }, // cover: the bloom's reach to the farthest corner from where it opens+ end: { cx: E.x0 + Ew / 2, titleY, titleMax, titleW: Ew - 2 * m - 80, tagline, taglineY, taglinePx, taglineLH: tLH, panelY, monoPx: mono, rows: inst.rows, wrapped: inst.wrapped, rowH, padX: 36, lineY0: panelY + 25 * k + rowH / 2, footerPx: Math.max(24 * k, min.read), footerY: panelY + ph + 60, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] },split, stage: { x: 0, y: 0, w: W, h: H }, band: null, uiFull, safe: S, zones,roles: [],};diff --git a/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts b/skills/anidoodle/engine/src/canvas-core/launchTemplate.tsindex 27bbe47..13ff45f 100644--- a/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts+++ b/skills/anidoodle/engine/src/canvas-core/launchTemplate.ts@@ -28,7 +28,7 @@ import {C, SANS, MONO, camLerp, caretAt, charTimes, clamp, drawChatFrame, expo, inOut, inkCard, inkDrop,lerp, lerpP, out3, plateLayer, pointer, press, ramp, rr, spring, toScreen, typedAt, useCam, type Cam, type Drop, type ChatGeom, type Rect,} from "./launchKit";-import { launchLayout, estWidth, wrapEst, SHAPES, type LaunchLayout, type Shape } from "./launchLayout";+import { launchLayout, estWidth, installRows, wrapEst, SHAPES, type LaunchLayout, type Shape } from "./launchLayout";import { chatGeom } from "./launchKit";import { beatGrid, bloomFrame, bloomRadius, makeCut, pic, type, typeFrame, type Seg, type TypeLine } from "./launchCut";import { measure, writeOn, setType } from "./kinetic";@@ -390,11 +390,12 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {const END_L = (() => {if (!clean) return L.end;// (9x16: measured on the safe rectangle's width and centred on its height)- const AW = ZONES ? SAFE.w - 24 : W, E = L.end, n = spec.install.length, tp = E.taglinePx * 1.5, tl = wrapEst(spec.tagline, tp, AW * (ZONES ? 0.9 : 0.8)), tLH = Math.round(tp * 1.3);- const mono = Math.min(E.monoPx * 1.35, ...spec.install.map((x) => (AW * 0.86 - 2 * E.padX) / (x.length * 0.61))), rowH = Math.round(mono * 2), ph = rowH * n + 50 * k;+ const AW = ZONES ? SAFE.w - 24 : W, E = L.end, tp = E.taglinePx * 1.5, tl = wrapEst(spec.tagline, tp, AW * (ZONES ? 0.9 : 0.8)), tLH = Math.round(tp * 1.3);+ const inst = installRows(spec.install, AW * 0.86 - 2 * E.padX, minPx, E.monoPx * 1.35), mono = inst.px, rowH = Math.round(mono * 2), ph = rowH * inst.rows.length + 50 * k;+ if (mono < minPx - 1e-9) throw new Error(`launchTemplate ${shape}: the install lines would be ${mono.toFixed(1)} px on the clean end card (phone-safe minimum ${minPx} px). Shorten the install line, or ship this shape without it`);const g1 = titleSize * 0.42, g2 = tLH * 0.9, g3 = spec.footer ? 44 * k : 0, block = titleSize * 0.74 + g1 + tl.length * tLH + g2 + ph + g3 + (spec.footer ? E.footerPx : 0);const titleY = (ZONES ? SAFE.y * 2 + SAFE.h - block : H - block) / 2 + titleSize * 0.74, taglineY = titleY + g1 + tLH / 2, panelY = taglineY + (tl.length - 0.5) * tLH + g2;- return { ...E, titleY, tagline: tl, taglinePx: tp, taglineLH: tLH, taglineY, panelY, monoPx: mono, rowH, lineY0: panelY + 25 * k + rowH / 2, footerY: panelY + ph + g3 + E.footerPx / 2, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] as [number, number] };+ return { ...E, titleY, tagline: tl, taglinePx: tp, taglineLH: tLH, taglineY, panelY, monoPx: mono, rows: inst.rows, wrapped: inst.wrapped, rowH, lineY0: panelY + 25 * k + rowH / 2, footerY: panelY + ph + g3 + E.footerPx / 2, caret: [Math.round(mono * 0.53), Math.round(mono * 1.13)] as [number, number] };})();const titleW = clean ? estWidth(spec.title, titleSize) * 1.08 : measure(spec.title, titleSize);const dotR = titleSize * (clean ? 0.1 : 0.085), dotGap = titleSize * 0.1;@@ -443,12 +444,16 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {c.globalAlpha = ramp(e, 34 + Q, 46 + Q); c.fillStyle = PAL.soft; c.font = SANS(500, E.taglinePx); E.tagline.forEach((t, j) => c.fillText(t, cx, E.taglineY + j * E.taglineLH + rise(34 + Q)));c.translate(0, rise(40 + Q));c.globalAlpha = ramp(e, 40 + Q, 52 + Q); c.font = MONO(E.monoPx);- const nI = spec.install.length, pw = Math.max(...spec.install.map((s) => c.measureText(s).width)) + 2 * E.padX, ph = E.rowH * nI + 2 * (E.lineY0 - E.panelY) - E.rowH, py = E.panelY;+ // one row per install line, centred; a wrapped line's rows are set left in the panel, its continuation indented+ const rows = E.rows, nI = rows.length, cw = c.measureText("0").width, rowW = (r: { text: string; indent: number }) => c.measureText(r.text).width + r.indent * cw;+ const pw = (E.wrapped ? Math.max(...rows.map(rowW)) : Math.max(...spec.install.map((s) => c.measureText(s).width))) + 2 * E.padX, ph = E.rowH * nI + 2 * (E.lineY0 - E.panelY) - E.rowH, py = E.panelY, x0 = cx - pw / 2 + E.padX;c.fillStyle = clean ? PAL.ink : "#1f1c18"; rr(c, cx - pw / 2, py, pw, ph, 22 * L.k); c.fill();- c.fillStyle = clean ? "#ffffff" : "#ece4d6"; spec.install.forEach((s, j) => c.fillText(s, cx, E.lineY0 + j * E.rowH));- // a terminal caret blinks after the last line: the hold reads as live, never as a freeze- const lastW = c.measureText(spec.install[nI - 1]).width;- if (Math.floor((e - 40 - Q) / 15) % 2 === 0) { if (clean) c.fillStyle = THEME.accent; c.fillRect(cx + lastW / 2 + 8 * (E.monoPx / 30), E.lineY0 + (nI - 1) * E.rowH - E.caret[1] / 2, E.caret[0], E.caret[1]); }+ c.fillStyle = clean ? "#ffffff" : "#ece4d6";+ if (E.wrapped) { c.textAlign = "left"; rows.forEach((r, j) => c.fillText(r.text, x0 + r.indent * cw, E.lineY0 + j * E.rowH)); c.textAlign = "center"; }+ else spec.install.forEach((s, j) => c.fillText(s, cx, E.lineY0 + j * E.rowH));+ // a terminal caret blinks after the last row: the hold reads as live, never as a freeze+ const lastW = c.measureText(rows[nI - 1].text).width, caretX = E.wrapped ? x0 + rowW(rows[nI - 1]) + 8 * (E.monoPx / 30) : cx + lastW / 2 + 8 * (E.monoPx / 30);+ if (Math.floor((e - 40 - Q) / 15) % 2 === 0) { if (clean) c.fillStyle = THEME.accent; c.fillRect(caretX, E.lineY0 + (nI - 1) * E.rowH - E.caret[1] / 2, E.caret[0], E.caret[1]); }if (spec.footer) { c.fillStyle = PAL.soft; c.font = SANS(500, E.footerPx); c.fillText(spec.footer, cx, E.footerY); }c.globalAlpha = 1; c.textAlign = "left"; c.setTransform(env.scale, 0, 0, env.scale, 0, 0);};@@ -479,11 +484,12 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {const size = Math.min(nL === 1 ? 220 : 170, ...lines.map((l) => (maxW / (estWidth(l.text, 100) * 1.12)) * 100)), gap = size * 1.12, y0 = (at ? at[1] : H / 2) - ((nL - 1) * gap) / 2 + size * 0.36;lines.forEach((l, i) => setType(c, env, l.text, x0, y0 + i * gap, size, ramp(local, 14 + TYPE_O.lead + i * CLEAN_ST, 14 + TYPE_O.lead + 18 + i * CLEAN_ST), { color: l.color === C.accent ? THEME.accent : l.color ?? PAL.ink, weight: 800 }));bug(c, env);- }, { W, H, ...bloomOpts, rim: 4, ink: THEME.accent, radius: TYPE_R });+ }, { W, H, ...bloomOpts, rim: 4, ink: THEME.accent, radius: TYPE_R, ...(L.type.at ? { center: L.type.at } : {}) });// a word page's bloom is sized to the frame it covers (the desktop's 1250 px over a 1110 px cover):// on a smaller frame a fixed bloom would cover it before the words start, and two frames would matchconst TYPE_R = L.shape === "16x9" ? undefined : Math.round((1250 * L.type.cover) / 1110);- const TYPE_OPTS = L.shape === "16x9" ? TYPE_O : { ...TYPE_O, W, H, maxW: L.type.maxW, radius: TYPE_R, ...(L.type.at ? { text: L.type.at } : {}) };+ // (9x16: the page blooms from the words' centre, so its first drop lands where the words will be)+ const TYPE_OPTS = L.shape === "16x9" ? TYPE_O : { ...TYPE_O, W, H, maxW: L.type.maxW, radius: TYPE_R, ...(L.type.at ? { text: L.type.at, center: L.type.at } : {}) };const drawStage = (ctx: Ctx, env: Env, t: number) => {const { s, local } = cut.at(t), exact = Number.isInteger(t);if (s.kind === "pic") content(ctx, env, cut.contentOf(s, local), exact);@@ -530,7 +536,7 @@ export const makeLaunchFilm = (spec: LaunchSpec): LaunchFilm => {if (s.kind !== "type") return;const written = 14 + TYPE_O.lead + 18 + (s.lines.length - 1) * (clean ? CLEAN_ST : TYPE_O.stagger) - (clean ? 9 : 2); // local frame the last line is done (set type's out-cubic settles to the pixel sooner)// last frame the page still fills the frame (a round iris only clips the corners for its first closing frames: still a still)- const cover = clean ? Math.hypot(W, H) / 2 * 0.9 : L.type.cover;+ const cover = clean ? (L.type.at ? (L.type.cover - 9) * 0.9 : Math.hypot(W, H) / 2 * 0.9) : L.type.cover;let open = s.len - 1; while (open > written && bloomRadius(open + 2, s.len + 4, { radius: TYPE_R }) < cover) open--;holds.push([cut.STARTS[k] + written + 1, cut.STARTS[k] + open + 1]);});diff --git a/skills/anidoodle/engine/test/facts.test.ts b/skills/anidoodle/engine/test/facts.test.tsindex 197e4cc..adde572 100644--- a/skills/anidoodle/engine/test/facts.test.ts+++ b/skills/anidoodle/engine/test/facts.test.ts@@ -4,6 +4,10 @@import { checkFacts, entryProblems, normClaim, EMPTY_FACTS } from "../tools/factsrules.mjs";import { makeLaunchFilm } from "../src/canvas-core/launchTemplate";import type { Film } from "../src/canvas-core/film";+import exampleLedger from "../facts/launchExample.json";+import cleanLedger from "../facts/launchExampleClean.json";+import { launchExample } from "../src/canvas-core/launchExample";+import { launchExampleClean } from "../src/canvas-core/launchExampleClean";export const name = "facts";export const run = (ok: (cond: boolean, label: string) => void) => {@@ -39,4 +43,9 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(film.claims.join("|") === "ONE.|TWO.|Counts things.|Fast.", `a launch film declares its words, tagline and extra claims once each (${film.claims.join("|")})`);ok(film.reshape("9x16").claims.join("|") === film.claims.join("|"), "the claims are the same in every shape");ok(!film.claims.includes("draw it") && !film.claims.includes("npm i tally"), "prompts and install lines are not claims");+ // the shipped examples carry their own ledgers (facts/<film>.json), so launch.mjs ship passes for them+ for (const [nm, f, ledger] of [["launchExample", launchExample, exampleLedger], ["launchExampleClean", launchExampleClean, cleanLedger]] as const) {+ const r = checkFacts(f.claims, ledger);+ ok(r.status === "PASS" && ledger.claims.every((e: { generated?: boolean }) => e.generated === true), `${nm}: its ${r.checked} claims are all in facts/${nm}.json, labelled generated (${r.problems.map((p: { why: string }) => p.why).join("; ") || "no problems"})`);+ }};diff --git a/skills/anidoodle/engine/test/launchLayout.test.ts b/skills/anidoodle/engine/test/launchLayout.test.tsindex 81caed3..8cbbc94 100644--- a/skills/anidoodle/engine/test/launchLayout.test.ts+++ b/skills/anidoodle/engine/test/launchLayout.test.ts@@ -2,7 +2,7 @@// chat, the cards, the word pages, the split beat, the end card), every line a viewer reads is at// least the phone-safe size, nothing sits over anything else, and 16x9 is the desktop film exactly.import { CHAT_GEOM, chatGeom, CHAT } from "../src/canvas-core/launchKit";-import { launchLayout, SHAPES, MIN_PX, PHONE_SAFE, estWidth, monoWidth, parseShapes, type Shape } from "../src/canvas-core/launchLayout";+import { launchLayout, SHAPES, MIN_PX, PHONE_SAFE, estWidth, installRows, monoWidth, parseShapes, type Shape } from "../src/canvas-core/launchLayout";import { makeLaunchFilm, fitWords } from "../src/canvas-core/launchTemplate";import type { Film } from "../src/canvas-core/film";@@ -15,10 +15,8 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const g = chatGeom(CHAT, 1, CHAT_GEOM.px, 34, 0);ok(JSON.stringify([g.CHAT, g.INPUT, g.GEN, g.REPLY.x, g.REPLY.y, g.TEXT]) === JSON.stringify([CHAT_GEOM.CHAT, CHAT_GEOM.INPUT, CHAT_GEOM.GEN, CHAT_GEOM.REPLY.x, CHAT_GEOM.REPLY.y, CHAT_GEOM.TEXT]), "the chat derivation at k = 1 IS the desktop chat (one component, not two)");const content0 = { prompts: ["a lighthouse at sunset, as a print", "now a fox at dusk"], install: ["/plugin marketplace add alexgreensh/anidoodle", "/plugin install anidoodle@alexgreensh-anidoodle"], tagline: "Illustrations, loops and films, drawn in code" };- // anidoodle's own install lines (47 characters) cannot be 32 px mono inside 9x16's safe width, so 9x16 is laid out with shorter ones- const phoneContent = { ...content0, install: ["npm install your-product", "your-product init"] };for (const shape of Object.keys(SHAPES) as Shape[]) {- const content = shape === "9x16" ? phoneContent : content0;+ const content = content0;const L = launchLayout(shape, content), frame = { x: 0, y: 0, w: L.W, h: L.H }, c = L.chat;ok(L.W === SHAPES[shape].W && L.H === SHAPES[shape].H, `${shape}: the frame is ${L.W}x${L.H}`);const small = L.roles.filter((r) => r.px < r.min);@@ -28,7 +26,7 @@ export const run = (ok: (cond: boolean, label: string) => void) => {ok(L.thread.cardX >= c.CHAT.x && L.thread.cardX + L.thread.card <= c.CHAT.x + c.CHAT.w && L.thread.card > 0, `${shape}: the answer card (${L.thread.card} px) sits inside the thread`);ok(L.thread.bubbles.every((ls) => ls.length <= 3), `${shape}: prompts wrap to at most 3 bubble lines (${L.thread.bubbles.map((b) => b.length).join(", ")})`);ok(L.bug.y > c.CHAT.y + c.CHAT.h, `${shape}: the corner mark sits below the chat window, never on it`);- const pw = Math.max(...content.install.map((s) => monoWidth(s, L.end.monoPx))) + 2 * L.end.padX;+ const pw = Math.max(...L.end.rows.map((r) => monoWidth(r.text, L.end.monoPx) + r.indent * L.end.monoPx * 0.61)) + 2 * L.end.padX;ok(pw <= L.W, `${shape}: the install panel (${pw.toFixed(0)} px at ${L.end.monoPx.toFixed(1)} px mono) fits the frame's width`);ok(L.end.titleY < L.end.taglineY && L.end.taglineY < L.end.panelY && L.end.footerY < L.stage.h, `${shape}: the end card stacks title, line, panel, footer, all in frame`);ok(!overlap(L.split.words, L.split.ui) && inside(L.split.words, L.stage) && inside(L.split.ui, L.stage), `${shape}: a split beat's words and live UI have their own areas (${L.split.vertical ? "stacked" : "side by side"})`);@@ -43,12 +41,24 @@ export const run = (ok: (cond: boolean, label: string) => void) => {const bugW = estWidth("Your Product", L.bug.px) * 1.2;ok(inside({ x: L.bug.x - bugW, y: L.bug.y - L.bug.px, w: bugW, h: L.bug.px * 1.3 }, S), "9x16: the corner mark sits inside the safe rectangle");const at = L.type.at!; ok(!!at && inside({ x: at[0] - L.type.maxW / 2, y: at[1] - 10, w: L.type.maxW, h: 20 }, S), "9x16: a word page's lines are centred in the safe rectangle and no wider than it");- const pw0 = Math.max(...content.install.map((x) => monoWidth(x, E.monoPx))) + 2 * E.padX;+ const pw0 = pw;ok(inside({ x: E.cx - Math.max(E.titleW, pw0) / 2, y: E.titleY - E.titleMax, w: Math.max(E.titleW, pw0), h: E.footerY + E.footerPx - (E.titleY - E.titleMax) }, S), "9x16: the end card (name, line, install panel, footer) sits inside the safe rectangle");}let err = ""; try { launchLayout("16x9", { ...content0, band: true }); } catch (e) { err = (e as Error).message; } ok(/sidecar/.test(err), "16x9 refuses a burned-in band: its captions ship as .srt/.vtt");- err = ""; try { launchLayout("9x16", content0); } catch (e) { err = (e as Error).message; } ok(/install lines would be .*Shorten the install line/.test(err), `9x16 refuses an install line too long for the safe width at 32 px: ${err.slice(0, 80)}`);- err = ""; try { launchLayout("9x16", { ...content0, install: ["npx some-very-long-package-name@latest init --with-every-flag-there-is"] }); } catch (e) { err = (e as Error).message; } ok(/install lines would be/.test(err), `an install line that cannot be phone-safe is an error: ${err.slice(0, 80)}`);+ // install lines too long for the mono minimum wrap at a natural break, the continuation indented; short ones stay whole+ const T = launchLayout("9x16", content0).end, rowsOf = (r: { text: string; indent: number }[]) => r.map((x) => `${" ".repeat(x.indent)}${x.text}`).join(" | ");+ ok(T.wrapped && rowsOf(T.rows) === "/plugin marketplace add | alexgreensh/anidoodle | /plugin install | anidoodle@alexgreensh-anidoodle" && T.monoPx >= MIN_PX.phone.read, `9x16: anidoodle's own install lines wrap after the command word at ${T.monoPx.toFixed(1)} px: ${rowsOf(T.rows)}`);+ const one = installRows(["npm install tally"], 824.8, 32, 41), mixed = installRows(["npm i tally", "/plugin install anidoodle@alexgreensh-anidoodle"], 824.8, 32, 41);+ ok(!one.wrapped && one.rows.length === 1 && one.rows[0].text === "npm install tally" && one.rows[0].indent === 0, "a short install line stays on one row");+ ok(mixed.wrapped && rowsOf(mixed.rows) === "npm i tally | /plugin install | anidoodle@alexgreensh-anidoodle", `only the line that cannot fit wraps: ${rowsOf(mixed.rows)}`);+ const at = installRows(["npx anidoodle-package@alexgreensh-anidoodle-latest"], 700, 32, 41);+ ok(at.wrapped && rowsOf(at.rows) === "npx anidoodle-package | @alexgreensh-anidoodle-latest", `two rows when one break gives two: before "@" when no space does (${rowsOf(at.rows)})`);+ const mark = installRows(["alexgreensh-anidoodle@alexgreensh-anidoodle-x"], 600, 32, 41);+ ok(mark.wrapped && rowsOf(mark.rows) === "alexgreensh-anidoodle | @alexgreensh-anidoodle-x", `with no space it wraps before "@", the next row opening with it: ${rowsOf(mark.rows)}`);+ const slash = installRows(["alexgreensh-anidoodle/alexgreensh-anidoodle-x"], 600, 32, 41);+ ok(slash.wrapped && rowsOf(slash.rows) === "alexgreensh-anidoodle/ | alexgreensh-anidoodle-x", `or after "/", the row closing with it: ${rowsOf(slash.rows)}`);+ ok(JSON.stringify(installRows(["npm i a", "b init"], 944, 32, 33.6)) === JSON.stringify({ rows: [{ text: "npm i a", indent: 0 }, { text: "b init", indent: 0 }], px: 33.6, wrapped: false }), "lines that fit keep their size and rows exactly");+ err = ""; try { launchLayout("9x16", { ...content0, install: ["npx a-single-package-name-that-is-far-too-long-for-any-phone-frame-at-all"] }); } catch (e) { err = (e as Error).message; } ok(/install lines would be/.test(err), `an install line that cannot be phone-safe is an error: ${err.slice(0, 80)}`);ok(parseShapes("16x9, 9x16").join() === "16x9,9x16", "parseShapes reads a --shapes list");err = ""; try { parseShapes("16x10"); } catch (e) { err = (e as Error).message; } ok(/not a shape/.test(err), "parseShapes refuses an unknown shape");diff --git a/skills/anidoodle/engine/tools/facts.mjs b/skills/anidoodle/engine/tools/facts.mjsindex 0e17fda..daa4d19 100644--- a/skills/anidoodle/engine/tools/facts.mjs+++ b/skills/anidoodle/engine/tools/facts.mjs@@ -10,6 +10,7 @@// { "claim": "IDEA IN. ART OUT.", "where": "on-screen", "generated": true, "note": "slogan written for this film, states no fact" } ] }//// node tools/facts.mjs <film>[-<shape>] [--facts facts.json] every claim the film declares is listed and well formed+// (default: facts/<film>.json if the film has its own, else facts.json)// node tools/facts.mjs init [--facts facts.json] write an empty facts.json (never overwrites)//// A film declares its claims as `film.claims` (a launch template film: the type-frame words, the split@@ -25,11 +26,14 @@ import { resolve } from "node:path";import { isMain } from "./is-main.mjs";import { EMPTY_FACTS, checkFacts, claimsOf } from "./factsrules.mjs";+// A film's ledger: facts/<film>.json when it has one of its own (the shipped examples do, so they never+// seed a user's facts.json), else the project's facts.json.+export const factsFile = (film) => { const own = resolve("facts", `${String(film ?? "").replace(/-(16x9|1x1|4x5|9x16)$/, "")}.json`); return existsSync(own) ? own : resolve("facts.json"); };export const readFacts = (file) => { if (!existsSync(file)) return { facts: null }; try { return { facts: JSON.parse(readFileSync(file, "utf8")) }; } catch (e) { return { facts: null, error: `${file} is not valid JSON: ${e.message}` }; } };export const initFacts = (file) => { if (existsSync(file)) return false; writeFileSync(file, JSON.stringify(EMPTY_FACTS, null, 2) + "\n"); return true; };if (isMain(import.meta.url)) {- const argv = process.argv.slice(2), fi = argv.indexOf("--facts"), file = resolve(fi >= 0 ? argv[fi + 1] : "facts.json"), name = argv.find((a, i) => !a.startsWith("--") && argv[i - 1] !== "--facts");+ const argv = process.argv.slice(2), fi = argv.indexOf("--facts"), name = argv.find((a, i) => !a.startsWith("--") && argv[i - 1] !== "--facts"), file = fi >= 0 ? resolve(argv[fi + 1]) : name === "init" ? resolve("facts.json") : factsFile(name);const USAGE = "node tools/facts.mjs <film>[-<shape>] [--facts facts.json]\n node tools/facts.mjs init [--facts facts.json]";if (name === "init") { console.log(initFacts(file) ? `facts: wrote ${file}` : `facts: ${file} already exists; left as it is`); process.exit(0); }const { requireFilm } = await import("./names.mjs"), { loadFilm } = await import("./captions.mjs");diff --git a/skills/anidoodle/engine/tools/launch.mjs b/skills/anidoodle/engine/tools/launch.mjsindex 02e4ad4..11003e2 100644--- a/skills/anidoodle/engine/tools/launch.mjs+++ b/skills/anidoodle/engine/tools/launch.mjs@@ -26,7 +26,7 @@ import { resolve } from "node:path";import { knownFilms, requireFilm, SHAPE_NAMES } from "./names.mjs";import { filmMeta, loadFilm, writeCaptions } from "./captions.mjs";import { checkFacts, claimsOf } from "./factsrules.mjs";-import { initFacts, readFacts } from "./facts.mjs";+import { factsFile, initFacts, readFacts } from "./facts.mjs";const [cmd, name, ...rest] = process.argv.slice(2);const arg = (k, d) => { const i = rest.indexOf(`--${k}`); return i >= 0 ? rest[i + 1] : d; };@@ -115,7 +115,7 @@ const quiet = (args) => { const r = spawnSync(process.execPath, args, { encodingmkdirSync(resolve("out"), { recursive: true });const zoneMode = arg("zones", "fail"); if (!["fail", "warn"].includes(zoneMode)) die(`--zones is fail or warn, got '${zoneMode}'\nusage: ${USAGE}`);const rows = [];-const fx = readFacts(resolve("facts.json")), factsRes = fx.error ? { status: "FAIL", checked: 0, problems: [{ claim: "(facts.json)", why: fx.error }] } : checkFacts(claimsOf(await loadFilm(film)), fx.facts);+const fx = readFacts(factsFile(film)), factsRes = fx.error ? { status: "FAIL", checked: 0, problems: [{ claim: "(facts.json)", why: fx.error }] } : checkFacts(claimsOf(await loadFilm(film)), fx.facts);console.log(`\nFACTS ${film}: ${factsRes.status}${factsRes.status === "N/A" ? ` ${factsRes.reason}` : ` ${factsRes.checked} claim(s)`}`);for (const p of factsRes.problems) console.log(` FAIL "${p.claim.slice(0, 60)}" ${p.why}`);for (const sh of shapes) {diff --git a/skills/anidoodle/references/workflows/facts.md b/skills/anidoodle/references/workflows/facts.mdindex 550cf05..94c58cc 100644--- a/skills/anidoodle/references/workflows/facts.md+++ b/skills/anidoodle/references/workflows/facts.md@@ -29,7 +29,8 @@ research ledger (`explainer.md`) made general, and the launch film's list of app`where` is `on-screen` or `narration`. `launch.mjs new <name>` writes an empty one beside theproject and never overwrites one that is there; `node tools/facts.mjs init` does the same for-any project.+any project. A film with a ledger of its own in `facts/<film>.json` is checked against that one+instead (the shipped examples keep theirs there, so they never seed your `facts.json`).## The check