commit c95193cad9f1ec358def36d581055715da2dbdad parent e027f701ec5ddc8ef57e24091a8138ca088d41da Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st> Date: Wed, 21 Oct 2026 23:00:06 -0400 Merge lane/deck-counts: stamps off with the tally counting, no QR on post cards, rail pips coloured and shaped by verdict, rail markers Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Diffstat:
23 files changed, 920 insertions(+), 67 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## [Unreleased] +- **A fact-check video can count without the stamp, colour its timeline by verdict, flag the moments time passes, and leave the QR off posts.** In umtool's fact-check form, **stamp effect** off draws no verdict stamp over the footage, while the tally in the panel still counts each claim at the second its stamp would have landed. The On-screen settings have **colour** under timeline: **verdict** lights each clip that carries a claim in its verdict's colour — the tally's colour — with a shape per verdict (circle, diamond, square, triangle, ring), and the tally's cells carry the same shapes. **qr codes** under posts off leaves the QR off every post card, popup or feed, and the words take its width; each clip's own QR stays. A video's manifest can flag moments on the timeline (`render.chrome.deck.markers`: "3 to 5 weeks pass" after a clip), each popping in as the timeline reaches it and staying lit. Needs a restart of umtool. - **The dashboard says when a service's cookies have gone stale, and what to do.** When Rumble refuses its embeds with a 403 on two different videos in a row (one is not enough — a removed video answers 403 too), when YouTube asks to confirm you're not a bot, when Odysee answers with Cloudflare's check, when a forum's browser check or login wall stops a thread, or when archive.today answers with its check page, a banner at the top of the dashboard says so — "Rumble needs fresh cookies: open rumble.com in firefox" — with the jobs it happened in. **Recheck** asks the service once, through the same path and cookies the jobs use, and clears the banner when it answers; the next clean request clears it by itself too, and **Dismiss** clears it by hand. Once it is clear the banner says "OK again" and offers **Re-run stopped jobs**, which retries the jobs it stopped. The stopped job's log ends with the cause and the fix, `archilyzer doctor` lists it under "service cookies", and a Connect forum session or Connect archive session that ends on a cleared page clears the matching banner. From a terminal: `pnpm ops get services`, `recheck-service`, `rerun-service-jobs` and `dismiss-service`. Odysee's check is recognised by Cloudflare's own words beside a 403; no real Odysee sample has been seen yet. Needs a restart of the editor. - **archive.today copies are page records too, like Wayback captures.** The channel kind is now **Archived pages** on the New channel form (paste an archive.today copy's URL, `archive.ph/newest/<page>`, and the channel's target is that page on archive.today), and each target says where its copies are looked for: the Wayback Machine, archive.today, or both. The channel page's **Import a capture** takes an archive.today copy's URL (`archive.ph/<id>`, or any of its other names), or the page's own URL, a date and **on archive.today** for the copy nearest that date; the copy is kept as archive.today served it and read without its header bar, links back to the pages they pointed at, so a tweet, a Tumblr post or an article gives the same records it would from the Wayback Machine — each saying it came from archive.today and linking that copy, its images archive.today's own copies. archive.today is asked one request at a time, eight seconds apart; when it says "too many requests" the import stops with a sentence and nothing more is asked of it for half an hour. When it answers with a CAPTCHA instead of the copy, the import is refused and never reads the CAPTCHA as a page: **Connect archive session** (on the channel page, and in Settings → Archive sources) opens a window on the editor's machine to pass the check once, and the next import reads through it; nothing is ever solved for you. **Look up a page** lists every copy each archive holds of a page, with an Import button on each. From a terminal: `pnpm ops import-page` takes `"source": "archive.today"`, `pnpm ops archive-lookup` lists the copies, and `pnpm archilyzer archive lookup <url>` runs without the editor. Needs a restart of the editor. - **A page the Wayback Machine will not show says so.** When the Wayback Machine answers "forbidden" for one page while it answers others, that page is excluded from it, and Wayback lookups, page imports and archive lookups now say "excluded from the Wayback Machine (cause unknown)" instead of reporting an error. diff --git a/plans/deck-counts.md b/plans/deck-counts.md @@ -0,0 +1,94 @@ +# Deck counts — stamps off, verdict pips, track markers, no QR on posts (lane `lane/deck-counts`) + +Asked by the operator on 2026-10-21 while reviewing a timeline video ("Huck's bill": a deck cut with +`factcheck` stamps and tally, `deck.posts.layout: "feed"`): + +- "Remove the stamp effect it doesn't seem that good." +- "add a 'grift' count … alongside the seizure or medical issue count, include both on the timeline + and let them be visibly distinct somehow." +- "later in the timeline, highlight when the '3 to 5 weeks' passed … Do this for other promise claims." +- "Since X isn't public, let's not include the QR on tweets. Videos can keep them." + +## What shipped + +Each key is optional. A manifest without them builds byte-identical pages and schedules (proof below). + +| Key | Default | What it does | +|---|---|---| +| `render.chrome.factcheck.stamp.show` | `true` | `false`: no stamp composition is composed, rendered or laid (build, verify-build, compose-chrome, umtool's preview: `stampsDrawn`). The schedule's `factcheck.stamps` are unchanged, so the tally steps and flashes at each claim's `landed` second exactly as before. | +| `render.chrome.deck.posts.qr` | `true` | `false`: popup and feed post cards carry no QR and no cell for one; the words take the width (a popup card with a `logo` keeps its cell for the logo). No post QR png is made. The clip's deck QR (`deck.qr`) is untouched; the schedule still carries each post's `qrUrl`. | +| `render.chrome.deck.pip.color` | `"accent"` | `"verdict"`: a claimed clip's pip, once lit, is drawn in its verdict's resolved colour (the tally cell's, overrides included) and a shape per verdict, `VERDICT_SHAPES` in VERDICTS order: CORROBORATED circle, PARTLY diamond, CONTRADICTED square, NOT_FOUND triangle, UNTESTABLE ring. 10 px at the default pip size (5/3 of it) so the shape reads. Each tally cell carries its verdict's shape in its top-left corner (first tried inline before the label: it pushed long labels into an ellipsis). Unclaimed pips, the fuse and the marker stay the accent. | +| `render.chrome.deck.markers` | `[]` | `[{ after, label, color? }]`: a flag on the pip track between the pip of the clip `after` names and the next (midpoint; `pip.spacing: "time"`: the next segment's mid-dissolve; after the last pip, halfway to the track's end). Label above the track in a 10 px band (`MARKER_BAND`; the track and body move down only when there are markers). Hidden until the fuse burns past it, then a 0.35 s pop (`MARKER_POP`), lit for the rest of the cut. | + +The "grift count beside the medical count" request is the tally plus verdict pips: the two counts are +two verdicts (relabelled with `factcheck.verdicts.<V>.label`/`color`), and `pip.color: "verdict"` makes +them visibly distinct on the timeline by colour AND shape. The "3 to 5 weeks passed" highlight is a +marker after the clip where the promise was made. + +## Files + +- `umtool/report-to-video/factcheck.mjs` — `stamp.show` default/validator; `stampsDrawn`; `VERDICT_SHAPES`. +- `umtool/report-to-video/deck.mjs` — defaults (`pip.color`, `posts.qr`, `markers`), `PIP_COLORS`, + `MARKER_LIMITS`, `MARKER_PALETTE_KEYS`, `MARKER_DEFAULT_COLOR`, `MARKER_BAND`; validateChrome + (pip.color, posts.qr, `markerShapeErrors`); `validateDeckMarkers(manifest)` (shape + `after` names a + clip in the timeline); `deckLayout` marker band; `deckMarkers` (x, colour, label box). +- `umtool/report-to-video/chrome-deck.mjs` — verdict pips and tally shapes (`shapeCss`), marker + flags/labels and their reveal cues (`MARKER_POP`). +- `umtool/report-to-video/chrome-posts.mjs`, `chrome-feed.mjs` — `posts.qr: false`. +- `umtool/report-to-video/compose-chrome.mjs` — no post QR pngs when off; the stamp region refuses when + the stamps are off. +- `umtool/report-to-video/build-video.mjs`, `verify-build.mjs` — `stampsDrawn`; the build refuses bad + markers (`validateDeckMarkers`) beside the posts check. +- `umtool/report-to-video/lint.mjs` — `validatorErrors` runs `validateDeckMarkers` under the deck. +- `umtool/lib/report/manifest.mjs` — `updateChrome` and the structural writers run `validateDeckMarkers` + (removing a clip a marker follows is refused until the marker goes). +- `umtool/app/api/report/chrome/preview/route.ts` — no stamp preview when the stamps are off. +- `umtool/components/projects/OnscreenSection.tsx` — form fields `pip.color` ("colour", timeline) and + `posts.qr` ("qr codes", posts); a settings save now carries through `deck.markers` and every other + `render.chrome` key (threads, flips, stats, fx — it used to drop them; only `factcheck` was kept). +- `umtool/components/projects/StructureEditors.tsx` — the fact-check form's "stamp effect" switch. +- Docs: `umtool/report-to-video/README.md` (deck keys, `deck.markers` section, factcheck section, + posts QR), `umtool/docs/report-video.md`, `editor/CHANGELOG.md` [Unreleased]. + +## Decisions + +- **Where the UI lives.** The Build tab's Look panel is for cuts WITHOUT the deck ("a deck cut keeps its + own settings"), so F1–F3 are in the deck's own forms: the On-screen settings (pip colour, post QR) and + the fact-check form (stamp effect). Markers have no form; they are written in the manifest and carried + through every save. +- **Markers' `after` check is timeline-aware**, which `validateChrome(chrome, render)` cannot be (it has + no timeline). `validateDeckMarkers(manifest)` is the one function the build, the lint and umtool's + writers call; validateChrome checks the shape alone so the On-screen writer refuses a bad block early. +- **The band moves the track only with markers**, so a deck without them lays out pixel for pixel as + before. Under a band the QR is held inside the deck and below the active pip's halo (`trackY + 12`). +- **Reveal time** is the moment the fuse's linear burn from pip k to pip k+1 reaches the flag's x; a + flag after the last clip pops a second before that clip ends. One cue per marker (a fromTo from its + stated init), so a seek from anywhere lands on the same pixels. +- **Label boxes** reach at most halfway to the neighbouring flags (and 240 px), centred on the flag when + that leaves room, else off-centre near the track's end; overflow is an ellipsis. +- **Verdict pips are larger** (5/3 of `pip.size`) so a 6 px pip's diamond and square are distinguishable; + the active marker (12 px) still covers it. +- **Default marker colour** is the palette's `amber`, distinct from the accent pips and the verdict colours. + +## Tests + +- `umtool/report-to-video/deck-counts.test.mjs` (new, 14): stamp.show validation; stamps off → same + schedule, same tally cues and flash, identical deck page, compose-chrome refuses the stamp region; + posts.qr validation; popup and feed pages without codes or cells, the deck's own QR untouched; + pip.color validation; VERDICT_SHAPES; verdict pips (colour after override, shape, unclaimed unchanged, + tally cell colour + shape, pip cues unchanged); markers shape refusals, timeline refusals (and the + lint's), layout band, placement (even, time, last pip), crowded boxes never meeting, reveal at the + fuse, page markup and escaping. +- `umtool/lib/report/manifest.test.mjs`: updateChrome refuses a marker after a missing clip / a card / an + over-long label and writes nothing; accepts a good one. +- `deck.test.mjs`, `factcheck.test.mjs`: resolved defaults gained `pip.color` and `stamp.show`. +- e2e: `onscreen.spec.ts` (pip colour + post QR saved, markers and factcheck carried through a save), + `timeline-edit.spec.ts` (stamp effect off writes `stamp.show: false`). +- **Byte-identity.** A probe hashed validateChrome, validatePosts, deckLayout, deckSchedule, + estimateSchedule, deckCues, deckHtml (whole and windowed), stampCues, stampHtml, postsHtml (every + window) and feedHtml for 30 manifests without the new keys (5 deck variants — even/time spacing, feed, + no QR, flush+at start — × 3 fact-check blocks × with/without posts; 327 hashes) on the branch base + (3f0543e7) and after the change: identical. +- **Real render.** A 3-clip `src` fixture (claims PARTLY, CONTRADICTED, CORROBORATED; two markers; one X + post with `posts.qr: false`; `stamp.show: false`; `pip.color: "verdict"`) built offline through the + heavy slot with the real hyperframes 0.8.24; frames extracted and looked at (see the lane's report). diff --git a/umtool/app/api/report/chrome/preview/route.ts b/umtool/app/api/report/chrome/preview/route.ts @@ -13,7 +13,7 @@ import { deckPreviewSrc, feedPreviewSrc, postsPreviewSrc, resolveReport, stampPr import { deckGeometry, deckLayout, deckOn, feedGeometry, postsGeometry, stampGeometry, validateChrome, } from "umtool-report-to-video/deck"; -import { tallyOf } from "umtool-report-to-video/factcheck"; +import { stampsDrawn, tallyOf } from "umtool-report-to-video/factcheck"; export const dynamic = "force-dynamic"; @@ -123,11 +123,11 @@ export async function POST(request: Request) { }; } - // The fact-check stamps, when the cut stamps a claim -- over the footage, - // so not on the clip bench's strip either. - const stamps = (schedule as { factcheck?: { stamps?: unknown[] } }).factcheck?.stamps ?? []; + // The fact-check stamps, when the cut stamps a claim and they are on + // (`factcheck.stamp.show`) -- over the footage, so not on the clip bench's + // strip either. Off, the tally in the deck still counts. let stampDoc: Record<string, unknown> | null = null; - if (body.posts !== false && stamps.length) { + if (body.posts !== false && stampsDrawn(schedule, render)) { let error: string | null = null; try { await composeStampPreview(r.project, r.variant, schedule); diff --git a/umtool/components/projects/OnscreenSection.tsx b/umtool/components/projects/OnscreenSection.tsx @@ -521,7 +521,7 @@ type DeckSettings = { height: number; footageScale: number; background: string; - pip: { spacing: string; size: number; activeSize: number }; + pip: { spacing: string; size: number; activeSize: number; color: string }; title: { size: number; maxChars: number }; subtitle: { parts: "auto" | string[]; dateFormat: string }; qr: { show: boolean; size: number; links: string }; @@ -538,7 +538,10 @@ type DeckSettings = { maxLines: number; inset: number; shift: false | { scale: number; seconds: number }; + qr: boolean; }; + /** Flags on the pip track (`deck.markers`): written in the manifest, carried through every save here. */ + markers?: { after: string; label: string; color?: string }[]; }; /** `when`: the bool field that must be on for this one to apply (and be shown). */ @@ -580,6 +583,7 @@ const GROUPS: { name: string; fields: Field[] }[] = [ { key: "pip.spacing", label: "spacing", kind: "select", options: ["even", "time"], hint: "even, or by each clip's length" }, { key: "pip.size", label: "pip", kind: "num", hint: "px, 2–24" }, { key: "pip.activeSize", label: "active", kind: "num", hint: "px, 2–40, at least the pip" }, + { key: "pip.color", label: "colour", kind: "select", options: ["accent", "verdict"], hint: "accent; or verdict: a clip that carries a claim lights its pip in the claim's verdict colour, with a shape per verdict (the tally's cells carry the same shape)" }, ], }, { @@ -599,6 +603,7 @@ const GROUPS: { name: string; fields: Field[] }[] = [ { key: "posts.hold", label: "hold", kind: "num", step: 0.5, hint: "s, 0–10: the clip that carries posts is held on its last frame, silent, so the last post can be read; part of the cut's length" }, { key: "posts.position", label: "side", kind: "select", options: ["top-right", "top-left"], hint: "the side the column hangs from: the frame's edge when making room, else the footage's" }, { key: "posts.width", label: "width", kind: "int", hint: "px, 320–900" }, + { key: "posts.qr", label: "qr codes", kind: "bool", hint: "off: no QR on any post card (popup or feed) and the words take its width; each clip's own QR in the panel stays" }, { key: "posts.qrSize", label: "qr", kind: "num", hint: "px, 80–200, at most half the card" }, { key: "posts.links", label: "qr links", kind: "select", options: ["archive", "original"], hint: "archive: each post's QR opens its page on the archive the manifest names (which links on to the original), when the build finds the post there; original: the bsky.app / x.com link itself" }, { key: "posts.maxLines", label: "lines", kind: "int", hint: "2–14: longer posts end in an ellipsis" }, @@ -1082,13 +1087,17 @@ export default function OnscreenSection({ const saveSettings = useCallback(async () => { if (!doc) return; + // Everything this form does not edit is the manifest's, carried through + // as saved, never dropped by a deck save: the fact-check settings and the + // other regions (threads, flips, stats, fx) beside the deck, and the + // deck's markers (`deck.markers`, written in the manifest). + const { engine: _e, layout: _l, deck: savedDeck, ...others } = doc.chrome ?? {}; + const markers = (savedDeck as { markers?: unknown } | undefined)?.markers; const chrome = { engine: (doc.chrome?.engine as string) ?? "hyperframes", layout: (doc.chrome?.layout as string) ?? "deck", - deck: deckOf(form, doc.defaults), - // The fact-check settings are the manifest's (this form does not edit - // them): carried through as saved, never dropped by a deck save. - ...(doc.chrome?.factcheck !== undefined ? { factcheck: doc.chrome.factcheck } : {}), + deck: { ...deckOf(form, doc.defaults), ...(markers !== undefined ? { markers } : {}) }, + ...others, }; const ok = await putChrome(chrome); if (!ok) return; diff --git a/umtool/components/projects/StructureEditors.tsx b/umtool/components/projects/StructureEditors.tsx @@ -21,7 +21,7 @@ type Doc = { posts: Post[]; deckOn: boolean; factcheck: { verdicts?: Record<string, Partial<Verdict>>; stamp?: Record<string, unknown>; tally?: Record<string, unknown> } | null; - factcheckResolved: { verdicts: Record<string, Verdict>; stamp: { seconds: number; position: string }; tally: { show: boolean; position: string } }; + factcheckResolved: { verdicts: Record<string, Verdict>; stamp: { show: boolean; seconds: number; position: string }; tally: { show: boolean; position: string } }; verdicts: string[]; token: string | null; }; @@ -262,6 +262,8 @@ function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: ( Object.fromEntries(doc.verdicts.map((k) => [k, { label: String(given.verdicts?.[k]?.label ?? ""), color: String(given.verdicts?.[k]?.color ?? "") }])), ); const [seconds, setSeconds] = useState(given.stamp?.seconds == null ? "" : String(given.stamp.seconds)); + // `stamp.show`: off draws no stamp over the footage; the tally still counts. + const [stampOn, setStampOn] = useState(given.stamp?.show !== false); const submit = () => { const verdicts: Record<string, Record<string, string>> = {}; for (const [k, o] of Object.entries(v)) { @@ -277,6 +279,8 @@ function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: ( const stamp = { ...(given.stamp ?? {}) } as Record<string, unknown>; if (seconds.trim()) stamp.seconds = Number(seconds); else delete stamp.seconds; + if (stampOn) delete stamp.show; + else stamp.show = false; if (Object.keys(stamp).length) out.stamp = stamp; else delete out.stamp; void save(Object.keys(out).length ? out : null); @@ -300,7 +304,10 @@ function FactcheckEditor({ doc, busy, save }: { doc: Doc; busy: boolean; save: ( })} </div> <div className="flex items-center gap-2 text-[var(--color-dim)]"> - <label>stamp seconds <input value={seconds} placeholder={String(doc.factcheckResolved.stamp.seconds)} onChange={(e) => setSeconds(e.target.value)} className={`${input} w-14`} /></label> + <label title="off: no verdict stamp over the footage; the tally in the panel still counts each claim when its stamp would have landed"> + <input type="checkbox" data-testid="fc-stamp-show" checked={stampOn} onChange={(e) => setStampOn(e.target.checked)} /> stamp effect + </label> + <label>stamp seconds <input value={seconds} placeholder={String(doc.factcheckResolved.stamp.seconds)} disabled={!stampOn} onChange={(e) => setSeconds(e.target.value)} className={`${input} w-14`} /></label> <button type="button" data-testid="fc-save" disabled={busy} onClick={submit} className={buttonVariants({ variant: "outline", size: "sm" })}> Save labels </button> diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -352,8 +352,24 @@ the stamps' own composition (`chrome/stamp-preview/`, served under `updateChrome(dir, chrome | null, { token })` writes `render.chrome` itself: `validateChrome()` first, so a block umtool saves is one the build accepts, -and `null` removes the key — turning the deck off without touching anything -else under `render`. +then `validateDeckMarkers()` against the timeline (each `deck.markers[].after` +names a clip in it), and `null` removes the key — turning the deck off +without touching anything else under `render`. The structural writers run +`validateDeckMarkers()` too, so removing a clip a marker follows is refused +until the marker goes. + +The On-screen settings form edits every `render.chrome.deck` key it lists, +among them **colour** under timeline (`pip.color`: `accent`, or `verdict` — a +claimed clip's pip lit in its claim's verdict colour and shape) and **qr +codes** under posts (`posts.qr`: off draws no QR on any post card, popup or +feed). The fact-check form beside the structure editors has **stamp effect** +(`factcheck.stamp.show`: off draws no stamp over the footage; the tally still +counts). `deck.markers` — flags on the pip track, `[{ after, label, color? }]` +([the pipeline's README](../report-to-video/README.md#deckmarkers--flags-on-the-pip-track)) +— has no form: write them in the manifest. A settings save carries them +through, with the fact-check block and the other regions (threads, flips, +stats, fx), as saved. With the stamps off the preview composes no stamp +region (`stampsDrawn`). ### Preview, before and without a build diff --git a/umtool/e2e/onscreen.spec.ts b/umtool/e2e/onscreen.spec.ts @@ -172,6 +172,30 @@ test("settings save only what differs from the defaults; a refused value shows t await putChrome(request, PROJECT, DECK_ON); }); +test("verdict pips and no QR on posts are settings; a save keeps the manifest's markers and fact-check block", async ({ + page, + request, +}) => { + const markers = [{ after: "c01", label: "3 to 5 weeks pass" }]; + const factcheck = { stamp: { show: false } }; + await putChrome(request, PROJECT, { ...DECK_ON, deck: { markers }, factcheck }); + await openSection(page); + + const qr = page.getByTestId("onscreen-setting-posts.qr"); + await expect(qr).toBeChecked(); + await qr.uncheck(); + await page.getByTestId("onscreen-setting-pip.color").selectOption("verdict"); + await page.getByTestId("onscreen-settings-save").click(); + + await expect.poll(() => readManifest().render.chrome).toEqual({ + ...DECK_ON, + deck: { pip: { color: "verdict" }, posts: { qr: false }, markers }, + factcheck, + }); + + await putChrome(request, PROJECT, DECK_ON); +}); + test("a table edit saves onscreen; an emptied row deletes the key", async ({ page, request }) => { await putChrome(request, PROJECT, DECK_ON); await putOnscreen(request, PROJECT, { c01: null, c02: null, k01: null }); diff --git a/umtool/e2e/timeline-edit.spec.ts b/umtool/e2e/timeline-edit.spec.ts @@ -136,4 +136,12 @@ test("a post added, then removed; the fact-check's labels once the deck is on", await expect .poll(() => (manifest().render.chrome as { factcheck?: unknown }).factcheck) .toEqual({ verdicts: { CONTRADICTED: { label: "NOPE", color: "#ff0000" } } }); + + // The stamp effect off: no stamp over the footage, the tally still counts. + await expect(page.getByTestId("fc-stamp-show")).toBeChecked(); + await page.getByTestId("fc-stamp-show").uncheck(); + await page.getByTestId("fc-save").click(); + await expect + .poll(() => (manifest().render.chrome as { factcheck?: unknown }).factcheck) + .toEqual({ verdicts: { CONTRADICTED: { label: "NOPE", color: "#ff0000" } }, stamp: { show: false } }); }); diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -30,7 +30,7 @@ import { rolesGaps, } from "umtool-report-to-video/ledger-totals"; import { isCalendarDate } from "umtool-report-to-video/attribution"; -import { normalizeOnscreen, validateChrome, validatePosts, validateTeaser, validateTeasers } from "umtool-report-to-video/deck"; +import { normalizeOnscreen, validateChrome, validateDeckMarkers, validatePosts, validateTeaser, validateTeasers } from "umtool-report-to-video/deck"; import { validateThreadEntries } from "yt-dlp-transcript-common/lib/report/panels.mjs"; import { validateAssist } from "yt-dlp-transcript-common/lib/clips/assist.mjs"; import { verticalErrors } from "umtool-report-to-video/look"; @@ -883,6 +883,9 @@ export async function updateChrome(dir, chrome, { token = null } = {}) { const errors = validateChrome(chrome, renderWithoutChrome); if (errors.length) throw new ChromeRefused(errors); manifest.render = { ...(manifest.render ?? {}), chrome }; + // The deck's markers against the timeline: each follows a clip in it. + const markers = validateDeckMarkers(manifest); + if (markers.length) throw new ChromeRefused(markers); } const nextToken = await writeManifestAtomic(dir, manifest); @@ -1220,6 +1223,8 @@ function structureErrors(manifest) { return [ ...validatePosts(manifest.posts, manifest.timeline ?? [], manifest.render), ...validateClaims(manifest), + // The deck's markers follow clips: removing one a marker names is refused. + ...validateDeckMarkers(manifest), ...validateTeasers(manifest), ...validateNarration(manifest), ...validateDrafted(manifest), diff --git a/umtool/lib/report/manifest.test.mjs b/umtool/lib/report/manifest.test.mjs @@ -269,6 +269,31 @@ test("updateChrome: round trip stores the block as given; null removes it", asyn } }); +test("updateChrome: a deck marker must follow a clip in the timeline; nothing is written otherwise", async () => { + const dir = await project(); + try { + const before = await readRaw(dir); + const deck = (markers) => ({ engine: "hyperframes", layout: "deck", deck: { markers } }); + for (const [markers, want] of [ + [[{ after: "zz", label: "Weeks pass" }], /names zz, which is not in the timeline/], + [[{ after: "k1", label: "Weeks pass" }], /names k1, a card: a marker follows a clip/], + [[{ after: "c01", label: "x".repeat(25) }], /label is 25 characters/], + ]) { + await assert.rejects(updateChrome(dir, deck(markers)), (e) => { + assert.ok(e instanceof ChromeRefused, String(e)); + assert.ok(e.errors.some((s) => want.test(s)), `${want} in ${JSON.stringify(e.errors)}`); + return true; + }); + assert.equal(await readRaw(dir), before); + } + const ok = deck([{ after: "c01", label: "3 to 5 weeks", color: "amber" }]); + await updateChrome(dir, ok); + assert.deepEqual((await read(dir)).render.chrome, ok); + } finally { + await rm(dir, { recursive: true, force: true }); + } +}); + test("updateChrome: a manifest with no render block gets one", async () => { const m = base(); delete m.render; diff --git a/umtool/report-to-video/README.md b/umtool/report-to-video/README.md @@ -395,7 +395,9 @@ whatever a manifest omits, one level deep: "height": 190, // px, whole number, 120–400 "footageScale": 0.82, // 0.5–1; the footage must still fit above the deck "background": "panel", // "panel" (lifted) | "flush" - "pip": { "spacing": "even", "size": 6, "activeSize": 12 }, // spacing "even" | "time"; activeSize ≥ size + "pip": { "spacing": "even", "size": 6, "activeSize": 12, // spacing "even" | "time"; activeSize ≥ size + "color": "accent" }, // | "verdict": a claimed clip's pip in its verdict's colour and shape (below) + "markers": [ { "after": "c07", "label": "3 to 5 weeks pass", "color": "amber" } ], // flags on the pip track (below); at most 12 "title": { "size": 54, "maxChars": 48 }, // size 24–96; maxChars 10–120 (the editor's counter, not a refusal) "subtitle": { "parts": "auto", "dateFormat": "long" }, // parts "auto" | a distinct list of channel/title/date/clock; dateFormat "long" | "iso" "qr": { "show": true, "size": 150, // size 80–380, and at most height − 20 @@ -407,11 +409,12 @@ whatever a manifest omits, one level deep: "shift": { "scale": 0.86, "seconds": 0.6 }, // the footage makes room: scale 0.5–1, seconds 0–3; or false "position": "top-right", // | "top-left" "width": 600, "qrSize": 120, "maxLines": 7, "inset": 24, // width 320–900 px; qrSize 80–200 and ≤ width/2; maxLines 2–14; inset 0–80 - "links": "archive" } // | "original": where a post's QR goes (below) + "links": "archive", // | "original": where a post's QR goes (below) + "qr": true } // false: no QR on any post card, popup or feed; the words take its width }, "factcheck": { // the fact-check stamps and tally (below); every key optional "verdicts": { "PARTLY": { "label": "Partly true", "color": "#e3b23c" } }, // per verdict: label ≤ 24 characters, a #rgb/#rrggbb colour - "stamp": { "seconds": 3, "position": "top-left" }, // seconds 1–10; top-left | top-right | bottom-left | bottom-right | center + "stamp": { "show": true, "seconds": 3, "position": "top-left" }, // show false: no stamp drawn, the tally still counts; seconds 1–10; top-left | top-right | bottom-left | bottom-right | center "tally": { "show": true, "position": "right" } // position "right" (beside the QR) | "left" (before the title) }, "stats": { // a frame scan's running numbers over each clip (below); every key optional @@ -456,6 +459,45 @@ or `?t=<s>` on a youtu.be link), a Rumble page as it is (it has no time parameter a QR can carry), an X post's link as it is. A clip's `citeUrl` still wins, and a clip whose record names no page keeps the site link. +### `deck.markers` — flags on the pip track + +A marker flags a moment on the rail between two clips — "3 to 5 weeks pass", +"the promised date" — so a viewer sees time pass, or a promise lapse, in the +timeline itself: + +```jsonc +"deck": { "markers": [ + { "after": "c07", "label": "3 to 5 weeks pass" }, // colour: the palette's amber + { "after": "c12", "label": "Promise lapses", "color": "#e5534b" } // a #rgb/#rrggbb, or fg | muted | accent | amber | dim +] } +``` + +- **Where.** On the track between the pip of the clip `after` names and the + next pip — their midpoint; with `pip.spacing: "time"` the second the two + segments hand over (the next one's mid-dissolve). After the last clip it + stands halfway to the track's end. Its label stands in a band above the + track: with any marker the track moves down 10 px (`MARKER_BAND`) and the + body under it with it; without one the deck lays out as it always did. +- **When.** Hidden until the fuse burns past the flag, then a short pop (scale + and opacity, `MARKER_POP`), lit for the rest of the cut; it slides away and + back with the panel. A flag after the last clip pops a second before that + clip ends. +- **Labels.** One line, at most 24 characters, uppercased; each label's box + reaches at most halfway to the next flag either side (and 240 px at most), + and a label that does not fit ends in an ellipsis rather than running into + its neighbour. The band is above everything in the body, so a label never + meets the tally or the QR. +- **Refused.** `after` must name a CLIP in the timeline, the label must be + non-empty and ≤ 24 characters, at most 12 markers, a colour a hex or a + palette key, and unknown keys are refused. `validateChrome` checks the + shape; `validateDeckMarkers(manifest)` (`deck.mjs`) checks the shape and + `after` against the whole timeline — the build, the lint and umtool's + writers all call it, so removing a clip a marker follows is refused until + the marker goes. + +Markers are written in the manifest (there is no form for them); umtool's +On-screen settings carry them through every save. + ### `posts` — written statements on the deck A cut that wears the deck can carry a post — a Bluesky or X statement — as a @@ -552,6 +594,13 @@ platform goes away. `deck.mjs` `postQrUrl` makes the link: the post's an archive channel and the post's id; else the post's own `url`, as before. `"original"` always links the post's own `url`. +`posts.qr: false` draws no QR on any post card — popup or feed — and no cell +for one: the words take the width (a popup card with a `logo` keeps the cell +for the logo alone), and no code is made. For a source that is not public (an +X post a viewer cannot open) the card is the evidence, and a code would lead +nowhere. The clip's own QR in the deck (`deck.qr`) is untouched, and the +schedule still carries each post's `qrUrl`. + - **The archive channel.** A post channel is a channel of its own on the archive (`piratesoftware-bsky`, not the video channel `piratesoftware`), and a manifest rarely says which. The build finds it (`post-links.mjs`), just @@ -628,11 +677,25 @@ build fetches — umtool's writer refuses with the same function. whole cut (`chrome/stamp/`, `chrome/stamp-frames/`, cached by its key, a window `stamp-from<s>`), and the build lays it last, over the posts, exactly as it lays the deck's. `verify-build.mjs` checks its frame count. +- **No stamp (`stamp.show: false`).** Nothing is composed, rendered or laid + over the footage (`stampsDrawn`: the build, verify-build, compose-chrome and + umtool's preview all ask it), and the tally still steps — and flashes — at + each claim's `landed` second, exactly as it would have: the schedule's + `factcheck.stamps` are unchanged. umtool's fact-check form has a "stamp + effect" switch for it. +- **Verdict pips (`deck.pip.color: "verdict"`).** A claimed clip's pip, once + lit, takes its claim's verdict colour — the resolved one, relabels and + recolours included, the same the tally cell draws — and a shape per verdict + (`VERDICT_SHAPES`, in VERDICTS order: CORROBORATED a circle, PARTLY a + diamond, CONTRADICTED a square, NOT_FOUND a triangle, UNTESTABLE a ring), a + little larger than a plain pip so the shape reads; each tally cell carries + its verdict's shape in its top corner, so the rail reads without colour. An + unclaimed clip's pip, the fuse and the marker stay the accent. `render.chrome.factcheck` sets the verdicts' labels and colours (one at a time: -a verdict named without a colour keeps the default's), the stamp's seconds and -corner, and whether and where the tally is drawn; `validateChrome()` refuses an -unknown key there as everywhere in the block. +a verdict named without a colour keeps the default's), the stamp's seconds, +corner and whether it is drawn, and whether and where the tally is drawn; +`validateChrome()` refuses an unknown key there as everywhere in the block. ### `render.chrome.stats` — a frame scan's running numbers (release 31) diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs @@ -141,11 +141,11 @@ import { assertChrome, deckGeometry, deckOn, deckSchedule, endFadeOf, feedGeometry, feedOn, frameCount, hidesDeck, MUTE_FADE, dipOf, muteSegmentSeconds, playWindow, postsGeometry, postWindows, resolveDeck, scheduleFrom, snapWindow, stampGeometry, statsGeometry, teaserHits, teaserSeconds, teaserTitle, threadsGeometry, - validateCutEdits, validatePosts, validateTeasers, fxGeometry, even as evenPx, + validateCutEdits, validateDeckMarkers, validatePosts, validateTeasers, fxGeometry, even as evenPx, } from "./deck.mjs"; // The effects region (`render.chrome.fx`, release 35): pure, in fx.mjs. import { fxOn, fxQuoteSpan, resolveFx, fxWhipJoins, fxWipeJoins, fxWordsOf, fxZoomJoins, validateFxEntries } from "./fx.mjs"; -import { validateClaims } from "./factcheck.mjs"; +import { stampsDrawn, validateClaims } from "./factcheck.mjs"; import { validateThreadEntries } from "./threads.mjs"; import { validateFlipEntries } from "./flips.mjs"; import { validateStatsEntries } from "./stats.mjs"; @@ -4634,8 +4634,9 @@ async function renderDeck({ manifestPath, render, outDir, variant, schedule, fro // The fact-check stamps (a schedule whose `factcheck` stamps a claim): one // sequence for the whole cut -- or the deck's window -- laid last, over the - // posts, at stampGeometry's box in the footage. - if (schedule.factcheck?.stamps?.length) { + // posts, at stampGeometry's box in the footage. With `stamp.show: false` + // none is composed or laid; the deck's tally still counts each claim. + if (stampsDrawn(schedule, render)) { EMIT("chrome", { phase: "compose", region: "stamp", ...(duration != null ? { from, duration } : {}) }); const t1 = Date.now(); const st = await composeChrome({ @@ -5179,6 +5180,9 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly if (deck) { const errors = validatePosts(whole.posts, whole.timeline ?? [], whole.render); if (errors.length) throw new Error(`posts: ${errors.join("; ")}`); + // The deck's markers, against the whole timeline: each follows a clip in it. + const markers = validateDeckMarkers(whole); + if (markers.length) throw new Error(`render.chrome: ${markers.join("; ")}`); } // The lint (lint.mjs): what a render would get wrong that no validator // refuses -- a picture that is not beside the manifest, a QR too small to diff --git a/umtool/report-to-video/chrome-deck.mjs b/umtool/report-to-video/chrome-deck.mjs @@ -37,8 +37,8 @@ // second clock or a label. import { fileURLToPath } from "node:url"; -import { deckChoreography, deckLayout, pageDuration, pipSegments, pipXs, resolveDeck } from "./deck.mjs"; -import { resolveFactcheck, tallyCues, tallyKey, tallyOf } from "./factcheck.mjs"; +import { deckChoreography, deckLayout, deckMarkers, pageDuration, pipSegments, pipXs, resolveDeck } from "./deck.mjs"; +import { resolveFactcheck, tallyCues, tallyKey, tallyOf, VERDICT_SHAPES } from "./factcheck.mjs"; /** * GSAP, vendored, for every chrome region. @@ -154,7 +154,11 @@ export function deckCues(schedule, render) { pipped.length, lay.pipTrack.x0, lay.pipTrack.x1, deck.pip.spacing, deck.pip.spacing === "time" ? { total: schedule.total, segments: pipped } : null, ); - const pips = pipped.map((s, k) => ({ id: s.id, x: r4(xs[k]) })); + // `pip.color: "verdict"`: a claimed clip's pip carries its verdict (drawn + // in its colour and shape once lit). Only then, so the pips are as they + // always were otherwise. + const byVerdict = deck.pip.color === "verdict"; + const pips = pipped.map((s, k) => ({ id: s.id, x: r4(xs[k]), ...(byVerdict && s.claim?.verdict ? { verdict: s.claim.verdict } : {}) })); const pipOf = new Map(pipped.map((s, k) => [s.id, k])); const fuseX0 = xs[0] ?? 0; const fuseW = xs.length > 1 ? xs[xs.length - 1] - xs[0] : 0; @@ -269,6 +273,24 @@ export function deckCues(schedule, render) { } } + // The markers (`deck.markers`): hidden until the fuse burns past the flag + // -- it burns linearly from pip k to pip k+1 over the marker's rest on k -- + // then a short pop, lit for the rest of the cut. A flag past the last pip + // (it follows the last clip) pops in a second before that clip ends. + const markers = deckMarkers(schedule, render, xs, pipped, lay).map((mk, j) => { + const a = arrive.get(mk.k), b = depart.get(mk.k); + let at; + if (mk.k + 1 < xs.length && a !== undefined && b !== undefined && xs[mk.k + 1] > xs[mk.k]) { + at = a + ((b - a) * Math.max(0, Math.min(1, (mk.x - xs[mk.k]) / (xs[mk.k + 1] - xs[mk.k])))); + } else { + const seg = segs[idx.get(mk.after)]; + at = Math.max(seg.start, seg.start + seg.duration - Math.min(1, seg.duration / 2)); + } + put(`mk${j}`, { autoAlpha: 0, scale: MARKER_POP.from }); + add(`mk${j}`, at, MARKER_POP.seconds, { autoAlpha: 1, scale: 1 }, "back.out(2.2)", `marker ${mk.after}`); + return { ...mk, at: r4(at) }; + }); + // ---- order, clamp, and state the froms --------------------------------- ev.forEach((e, n) => { e.n = n; }); ev.sort((x, y) => x.at - y.at || x.n - y.n); @@ -290,7 +312,30 @@ export function deckCues(schedule, render) { freeAt.set(e.k, r4(at + dur)); cues.push({ k: e.k, at, dur, from, to: e.to, ease: e.ease, why: e.why }); } - return { init, cues, pips, slideY, choreography: ch }; + return { init, cues, pips, slideY, choreography: ch, ...(markers.length ? { markers } : {}) }; +} + +/** A marker's pop as the fuse reaches it: from this scale, over these seconds. */ +export const MARKER_POP = Object.freeze({ from: 0.35, seconds: 0.35 }); + +/** + * A verdict pip's shape as CSS, `size` px: a circle, a diamond (a square + * turned, shrunk to the circle's reach), a square, a triangle, a ring. + */ +function shapeCss(shape, size, color) { + const d = Math.round(size * 0.78 * 100) / 100; + switch (shape) { + case "diamond": + return `width:${d}px; height:${d}px; margin:${r4((size - d) / 2)}px; border-radius:1px; transform:rotate(45deg); background:${color};`; + case "square": + return `border-radius:1.5px; background:${color};`; + case "triangle": + return `border-radius:0; clip-path:polygon(50% 0%, 100% 92%, 0% 92%); background:${color};`; + case "ring": + return `border-radius:50%; background:transparent; box-shadow:inset 0 0 0 ${Math.max(2, Math.round(size * 0.24))}px ${color};`; + default: + return `border-radius:50%; background:${color};`; + } } // --------------------------------------------------------------------------- @@ -329,12 +374,16 @@ export function deckHtml(schedule, render, opts = {}) { if (!(dur > 0)) throw new Error(`deck: nothing to render from ${from}s of a ${total}s cut`); const windowed = from > 0 || Math.abs(dur - total) > 1e-6; - const { init, cues, pips } = deckCues(schedule, render); + const { init, cues, pips, markers = [] } = deckCues(schedule, render); const t = lay.text; const tr = lay.pipTrack; const qr = lay.qr; const pip = deck.pip; const panel = deck.background === "panel"; + // The verdicts' colours as the tally draws them (relabels and recolours + // included), so a claimed pip and its tally cell are the same colour. + const verdictColors = resolveFactcheck(render).verdicts; + const byVerdict = pip.color === "verdict"; // The lift: a few percent toward the foreground, so the deck reads as a // surface standing on the frame's ground rather than a hole cut in it. @@ -370,12 +419,33 @@ export function deckHtml(schedule, render, opts = {}) { }) .join("\n "); + // A verdict pip is drawn a little larger than a plain one, so its shape + // reads; the active marker still covers it. + const vSize = Math.max(pip.size, Math.round((pip.size * 5) / 3)); const pipHtml = pips - .map( - (p, k) => - `<div class="pip" style="left:${r4(p.x - pip.size / 2)}px"></div>` + - `<div class="pip lit" data-k="pip${k}" style="left:${r4(p.x - pip.size / 2)}px"></div>`, - ) + .map((p, k) => { + const base = `<div class="pip" style="left:${r4(p.x - pip.size / 2)}px"></div>`; + if (!p.verdict) return base + `<div class="pip lit" data-k="pip${k}" style="left:${r4(p.x - pip.size / 2)}px"></div>`; + const color = verdictColors[p.verdict]?.color ?? pal.accent; + return ( + base + + `<div class="pip lit vpip" data-k="pip${k}" data-verdict="${esc(p.verdict)}" data-shape="${VERDICT_SHAPES[p.verdict]}" ` + + `style="left:${r4(p.x - vSize / 2)}px; top:${r4(-vSize / 2)}px; width:${vSize}px; height:${vSize}px; ` + + `${shapeCss(VERDICT_SHAPES[p.verdict], vSize, esc(color))}"></div>` + ); + }) + .join(""); + // The markers: a flag on the track and its label in the band above it. + const band = lay.markerBand ?? null; + const markerHtml = markers + .map((mk, j) => { + const left = r4(mk.box[0] - mk.x); + return ( + `<div class="mflag" data-k="mk${j}" data-after="${esc(mk.after)}" style="left:${r4(mk.x)}px; --mc:${esc(mk.color)}">` + + `<div class="mstick"></div><div class="mhead"></div>` + + `<div class="mlabel" style="left:${left}px; width:${mk.box[1] - mk.box[0]}px">${esc(mk.label)}</div></div>` + ); + }) .join(""); // The tally: one cell per verdict the cut stamps, each with every count it // will show stacked in one box (`n0` … `n<final>`), its label under it. @@ -399,6 +469,12 @@ export function deckHtml(schedule, render, opts = {}) { `style="left:${j * (tb.cell + tb.gap)}px; --vc:${esc(color)}; --vg:${rgba(color, 0.55)}; --vr:${rgba(color, 0.4)}; ` + `--vl:${mix(color, pal.fg, 0.35)}">` + `<div class="tbar"></div><div class="tcount">${nums}</div>` + + // With verdict pips the cell carries its pip's shape too, in its + // top corner (the label keeps its width): the key a viewer who + // cannot tell the colours apart reads the rail by. + (byVerdict + ? `<div class="tshape" data-shape="${VERDICT_SHAPES[v]}" style="${shapeCss(VERDICT_SHAPES[v], 12, esc(color))}"></div>` + : "") + `<div class="tlabel">${esc(verdictSet[v].label)}</div>` + `<div class="tflash" data-k="${tallyKey(v, "flash")}"></div></div>` ); @@ -531,7 +607,17 @@ export function deckHtml(schedule, render, opts = {}) { letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--vl); } .tflash { position: absolute; inset: 0; border-radius: 8px; opacity: 0; pointer-events: none; - box-shadow: inset 0 0 0 2px var(--vc), inset 0 0 22px var(--vg); }` : ""} + box-shadow: inset 0 0 0 2px var(--vc), inset 0 0 22px var(--vg); }` : ""}${tb && byVerdict ? ` + .tshape { position: absolute; left: 10px; top: 14px; width: 12px; height: 12px; }` : ""}${markers.length ? ` + /* The markers: a flag on the track, its label in the band above, both + in the marker's colour; hidden until the fuse reaches it. */ + .mflag { position: absolute; top: 0; width: 0; height: 0; transform-origin: 0 0; } + .mstick { position: absolute; left: -1px; top: -8px; width: 2px; height: 12px; border-radius: 1px; background: var(--mc); } + .mhead { position: absolute; left: 1px; top: -8px; width: 7px; height: 6px; background: var(--mc); + clip-path: polygon(0% 0%, 100% 50%, 0% 100%); } + .mlabel { position: absolute; top: ${(band?.y ?? 3) - tr.y}px; height: 14px; text-align: center; white-space: nowrap; + overflow: hidden; text-overflow: ellipsis; font-family: 'DeckSansBold', sans-serif; font-size: 12px; + line-height: 14px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mc); }` : ""} .deck-qr img { display: block; width: ${qr?.size ?? 0}px; height: ${qr?.size ?? 0}px; border-radius: 6px; image-rendering: pixelated; backface-visibility: hidden; box-shadow: 0 0 0 1px ${rgba(pal.fg, 0.25)}, 0 6px 18px rgba(0, 0, 0, 0.35); } @@ -548,7 +634,7 @@ export function deckHtml(schedule, render, opts = {}) { <div class="track"> <div class="rail"></div> ${fuseWidth > 0 ? `<div class="fuse" data-k="fuse"></div>` : ""} - ${pipHtml} + ${pipHtml}${markerHtml} <div class="marker" data-k="marker"></div> </div> ${tallyHtml} diff --git a/umtool/report-to-video/chrome-feed.mjs b/umtool/report-to-video/chrome-feed.mjs @@ -87,7 +87,8 @@ export function feedLayout(render) { header: { top: headerTop, height: headerH, ruleY }, stack: { x: padX, y: stackY, width: W - 2 * padX, height: H - stackY - bottom }, card: { - rail: 6, pad: 16, qrSize: p.qrSize, plate: p.qrSize + 28, metaSize: 18, + // `posts.qr: false`: no code and no cell for it (plate 0). + rail: 6, pad: 16, qrSize: p.qr === false ? 0 : p.qrSize, plate: p.qr === false ? 0 : p.qrSize + 28, metaSize: 18, textSize, lineH: Math.round(textSize * 1.36), maxLines: p.maxLines, }, }; @@ -258,9 +259,12 @@ export function feedHtml(schedule, render, opts = {}) { `<span class="date">${esc(postDate(p, deck.subtitle.dateFormat))}</span></div>` + `<div class="text">${postParagraphs(p.text).map((t) => `<p class="para">${esc(t)}</p>`).join("")}</div>` + `</div>`) + - `<div class="plate">` + - (src ? `<img src="${esc(src)}" width="${c.qrSize}" height="${c.qrSize}" alt="">` : "") + - `</div>` + + // `posts.qr: false` (plate 0): no code and no cell; the words take its width. + (c.plate > 0 + ? `<div class="plate">` + + (src ? `<img src="${esc(src)}" width="${c.qrSize}" height="${c.qrSize}" alt="">` : "") + + `</div>` + : "") + `<div class="hl" data-k="h${j}"></div>` + `</article>` ); @@ -338,7 +342,7 @@ export function feedHtml(schedule, render, opts = {}) { box-shadow: inset 0 0 0 2px ${rgba(pal.accent, 0.95)}, inset 0 0 16px ${rgba(pal.accent, 0.5)}; } .hl::before { content: ""; position: absolute; ${left ? "right" : "left"}: 0; top: 0; bottom: 0; width: 4px; background: ${pal.accent}; box-shadow: 0 0 14px 2px ${rgba(pal.accent, 0.6)}; } - .body { position: relative; width: ${lay.stack.width - c.plate - c.rail}px;${left ? ` margin-left: ${c.plate}px;` : ""} + .body { position: relative; width: ${lay.stack.width - c.plate - c.rail}px;${left && c.plate > 0 ? ` margin-left: ${c.plate}px;` : ""} padding: ${c.pad - 3}px ${c.pad + 2}px ${c.pad - 2}px ${c.pad + 2}px; } .meta { display: flex; align-items: center; gap: 10px; font-size: ${c.metaSize}px; line-height: ${Math.round(c.metaSize * 1.3)}px; white-space: nowrap; } diff --git a/umtool/report-to-video/chrome-posts.mjs b/umtool/report-to-video/chrome-posts.mjs @@ -246,6 +246,7 @@ export function postsHtml(schedule, render, window, opts = {}) { const pad = 18; const plateW = set.qrSize + 2 * pad; + const qrOn = set.qr !== false; const LOGO_H = 72; const rail = 6; const metaSize = 18; @@ -257,16 +258,20 @@ export function postsHtml(schedule, render, window, opts = {}) { const cardHtml = posts .map((p, j) => { const { name, platform } = postWho(p); - const src = qrSrcs[p.id]; + // `posts.qr: false`: no code on any card, whatever qrSrcs holds. + const src = qrOn ? qrSrcs[p.id] : null; const shot = shotSrcs[p.id]; const logo = logoSrcs[p.id]; + // Without a code a card keeps its source cell only for a logo; else + // the words take the cell's width (`.no-plate`). + const plate = qrOn || logo; const acc = typeof p.accent === "string" && /^#[0-9a-fA-F]{6}$/.test(p.accent) ? p.accent : null; const style = acc ? ` style="--acc: ${acc}; --acc-rim: ${rgba(acc, 0.95)}; --acc-glow: ${rgba(acc, 0.55)}"` : ""; const flag = p.flag ? `<div class="flag">${esc(p.flag)}</div>` : ""; return ( - `<article class="post${shot ? " has-shot" : ""}${logo ? " has-logo" : ""}" data-post="${esc(p.id)}" data-k="c${j}"${style}>` + + `<article class="post${shot ? " has-shot" : ""}${logo ? " has-logo" : ""}${plate ? "" : " no-plate"}" data-post="${esc(p.id)}" data-k="c${j}"${style}>` + (shot ? `<div class="body shot-body">${flag}<div class="shot-view"><img class="shot" data-k="s${j}" src="${esc(shot)}" alt=""></div></div>` : `<div class="body">${flag}` + @@ -276,10 +281,12 @@ export function postsHtml(schedule, render, window, opts = {}) { `<span class="date">${esc(postDate(p, deck.subtitle.dateFormat))}</span></div>` + `<div class="text">${postParagraphs(p.text).map((t) => `<p class="para">${esc(t)}</p>`).join("")}</div>` + `</div>`) + - `<div class="plate">` + - (logo ? `<img class="logo" src="${esc(logo)}" alt="">` : "") + - (src ? `<img src="${esc(src)}" width="${set.qrSize}" height="${set.qrSize}" alt="">` : "") + - `</div>` + + (plate + ? `<div class="plate">` + + (logo ? `<img class="logo" src="${esc(logo)}" alt="">` : "") + + (src ? `<img src="${esc(src)}" width="${set.qrSize}" height="${set.qrSize}" alt="">` : "") + + `</div>` + : "") + `<div class="glow" data-k="g${j}"></div>` + `</article>` ); @@ -350,7 +357,12 @@ export function postsHtml(schedule, render, window, opts = {}) { font-family: 'DeckSansBold', sans-serif; font-size: ${metaSize}px; line-height: ${metaSize + 6}px; letter-spacing: 0.02em; color: ${pal.bg}; background: var(--acc, ${pal.accent}); } /* A card's logo: the top corner, above its QR. */ - .post.has-logo { min-height: ${set.qrSize + 2 * pad + LOGO_H + 10}px; } + .post.has-logo { min-height: ${set.qrSize + 2 * pad + LOGO_H + 10}px; }${qrOn ? "" : ` + /* posts.qr false: a card is as tall as its words (a logo's cell as tall + as the logo), and a card with no cell gives its words the width. */ + .post { min-height: 0; } + .post.has-logo { min-height: ${LOGO_H + 2 * pad}px; } + .post.no-plate .body { width: ${W - rail}px; }`} .logo { display: block; width: ${plateW - 16}px; height: auto; max-height: ${LOGO_H}px; object-fit: contain; border-radius: 6px; } .body { position: relative; width: ${W - plateW - rail}px; padding: ${pad - 4}px ${pad + 2}px ${pad - 3}px ${pad + 2}px; } diff --git a/umtool/report-to-video/compose-chrome.mjs b/umtool/report-to-video/compose-chrome.mjs @@ -47,6 +47,7 @@ import { deckHtml, GSAP_FILE } from "./chrome-deck.mjs"; import { postsHtml, snapWindow, windowPosts } from "./chrome-posts.mjs"; import { feedHtml } from "./chrome-feed.mjs"; import { stampHtml } from "./chrome-stamp.mjs"; +import { stampsDrawn } from "./factcheck.mjs"; import { threadsHtml } from "./chrome-threads.mjs"; import { flipsHtml } from "./chrome-flips.mjs"; import { statsHtml } from "./chrome-stats.mjs"; @@ -761,7 +762,10 @@ async function regionHtml(region, { manifest, manifestDir, base, projDir, assets const render = manifest.render; const fonts = await copyFonts(render, assetsDir, { regular: "DeckSans", bold: "DeckSansBold" }, { strict: true }); const posts = windowPosts(schedule, window.segment); - const byUrl = await qrPngsFor(posts.map((p) => p.qrUrl), render, resolveDeck(render).posts.qrSize, assetsDir); + // `posts.qr: false`: no codes are made, and the page draws none. + const byUrl = resolveDeck(render).posts.qr === false + ? new Map() + : await qrPngsFor(posts.map((p) => p.qrUrl), render, resolveDeck(render).posts.qrSize, assetsDir); const qrSrcs = {}; for (const p of posts) if (p.qrUrl) qrSrcs[p.id] = byUrl.get(p.qrUrl); const shotSrcs = await copyShots(posts, manifestDir, assetsDir); @@ -773,7 +777,10 @@ async function regionHtml(region, { manifest, manifestDir, base, projDir, assets const render = manifest.render; const fonts = await copyFonts(render, assetsDir, { regular: "DeckSans", bold: "DeckSansBold" }, { strict: true }); const posts = schedule.posts ?? []; - const byUrl = await qrPngsFor(posts.map((p) => p.qrUrl), render, resolveDeck(render).posts.qrSize, assetsDir); + // `posts.qr: false`: no codes are made, and the page draws none. + const byUrl = resolveDeck(render).posts.qr === false + ? new Map() + : await qrPngsFor(posts.map((p) => p.qrUrl), render, resolveDeck(render).posts.qrSize, assetsDir); const qrSrcs = {}; for (const p of posts) if (p.qrUrl) qrSrcs[p.id] = byUrl.get(p.qrUrl); const shotSrcs = await copyShots(posts, manifestDir, assetsDir); @@ -976,6 +983,9 @@ export async function composeChrome({ if (region === "stamp" && !sched.factcheck?.stamps?.length) { throw new Error("the stamp region needs a schedule that stamps a claim (an entry with a `claim`)"); } + if (region === "stamp" && !stampsDrawn(sched, manifest.render)) { + throw new Error("the stamps are off (render.chrome.factcheck.stamp.show: false): there is no stamp region to compose"); + } const D = transition ?? transitionOf(manifest.render); const rate = Number(fps ?? sched?.fps ?? manifest.render.fps ?? 30); const total = teaser ? teaserSeconds(teaser, D, rate) : keyed ? sched.total : null; diff --git a/umtool/report-to-video/deck-counts.test.mjs b/umtool/report-to-video/deck-counts.test.mjs @@ -0,0 +1,306 @@ +// Tests for the deck-counts lane (plans/deck-counts.md): the stamps off with +// the tally still counting (`factcheck.stamp.show`), no QR on the post cards +// (`deck.posts.qr`), pips in their claim's verdict colour and shape +// (`deck.pip.color: "verdict"`), and flags on the pip track +// (`deck.markers`). Each is optional, and a deck without them is as it was. +// +// Run with: pnpm test:scripts +import assert from "node:assert/strict"; +import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import test from "node:test"; + +import { + DECK_DEFAULTS, deckLayout, deckMarkers, deckSchedule, MARKER_BAND, MARKER_LIMITS, pipSegments, pipXs, postWindows, + resolveDeck, snapWindow, validateChrome, validateDeckMarkers, +} from "./deck.mjs"; +import { deckCues, deckHtml, MARKER_POP } from "./chrome-deck.mjs"; +import { postsHtml, windowPosts } from "./chrome-posts.mjs"; +import { feedHtml, feedLayout } from "./chrome-feed.mjs"; +import { + FACTCHECK_DEFAULTS, resolveFactcheck, stampsDrawn, tallyCues, validateFactcheck, VERDICT_SHAPES, VERDICTS, +} from "./factcheck.mjs"; +import { validatorErrors } from "./lint.mjs"; + +const PALETTE = { bg: "#12101a", fg: "#f4f1ea", muted: "#9a93ad", accent: "#a97bff", amber: "#ffc860" }; +const CHROME = { engine: "hyperframes", layout: "deck" }; +const BASE = { width: 1920, height: 1080, fps: 30, transition: 0.5, palette: PALETTE }; +const renderWith = (deck = {}, factcheck = undefined) => + ({ ...BASE, chrome: { ...CHROME, deck, ...(factcheck ? { factcheck } : {}) } }); +const PROV = { siteOrigin: "https://example.test", channelSlug: "chan" }; + +// Four clips and a card: c1 PARTLY, c2 CONTRADICTED, c4 CORROBORATED, c3 none. +const ENTRIES = [ + { id: "c1", type: "clip", video: "a", start: 0, end: 10, date: "2024-09-05", claim: { id: "k1", verdict: "PARTLY" } }, + { id: "c2", type: "clip", video: "b", start: 0, end: 20, date: "2024-10-01", claim: { id: "k2", verdict: "CONTRADICTED" } }, + { id: "t1", type: "card", seconds: 4, heading: "Three weeks later" }, + { id: "c3", type: "clip", video: "c", start: 0, end: 6, date: "2025-12-08" }, + { id: "c4", type: "clip", video: "d", start: 0, end: 9, date: "2025-12-09", claim: { id: "k4", verdict: "CORROBORATED" } }, +]; +const DURS = [10, 20, 4, 6, 9]; +const POST = (id, date, extra = {}) => ({ + id, platform: "x", author: "Someone", handle: "someone", date, text: `words of ${id}`, + url: `https://x.com/someone/status/${id}`, ...extra, +}); +const POSTS = [POST("p1", "2024-10-02", { attachTo: "c2" }), POST("p2", "2024-10-03", { attachTo: "c2" })]; +const sched = (render, posts = []) => deckSchedule({ entries: ENTRIES, durs: DURS, D: 0.5, render, provenance: PROV, posts }); +const FONTS = { regular: "assets/DeckSans.ttf", bold: "assets/DeckSansBold.ttf" }; + +// ---- F1: the stamp off, the tally still counting ------------------------------ + +test("stamp.show: a setting, default on; refused when not a boolean", () => { + assert.equal(FACTCHECK_DEFAULTS.stamp.show, true); + assert.equal(resolveFactcheck(renderWith()).stamp.show, true); + assert.equal(resolveFactcheck(renderWith({}, { stamp: { show: false } })).stamp.show, false); + assert.deepEqual(validateFactcheck({ stamp: { show: false, seconds: 2 } }), []); + assert.match(validateFactcheck({ stamp: { show: "no" } }).join(" "), /stamp\.show must be true or false/); + assert.deepEqual(validateChrome({ ...CHROME, factcheck: { stamp: { show: false } } }, BASE), []); +}); + +test("stamp.show false: the schedule keeps its stamps, nothing is drawn, and the tally counts at the same seconds", () => { + const on = renderWith(); + const off = renderWith({}, { stamp: { show: false } }); + const a = sched(on), b = sched(off); + // The schedule is the same: the stamps are when the tally steps. + assert.deepEqual(b, a); + assert.equal(a.factcheck.stamps.length, 3); + assert.equal(stampsDrawn(a, on), true); + assert.equal(stampsDrawn(b, off), false); + assert.equal(stampsDrawn({ segments: [] }, on), false); + // The tally's cues -- each count and its flash -- are exactly the stamps-on ones. + const tally = (r, s) => deckCues(s, r).cues.filter((c) => c.k.startsWith("ty.")); + assert.deepEqual(tally(off, b), tally(on, a)); + assert.ok(tally(off, b).some((c) => c.k === "ty.CONTRADICTED.flash"), "the flash fires"); + const steps = tallyCues(b.factcheck.stamps).events.filter((e) => e.k.endsWith(".n1")); + assert.deepEqual(steps.map((e) => e.at).sort(), b.factcheck.stamps.map((s) => s.landed).sort()); + // The deck page itself is identical: the stamp is another region. + assert.equal(deckHtml(b, off, { fonts: FONTS }), deckHtml(a, on, { fonts: FONTS })); +}); + +test("compose-chrome: no stamp region when the stamps are off", async () => { + const dir = mkdtempSync(path.join(tmpdir(), "deck-counts-stamp-")); + const env = process.env.HYPERFRAMES_BIN; + try { + const stub = path.join(dir, "hf-stub.mjs"); + writeFileSync(stub, "#!/usr/bin/env node\nprocess.exit(1);\n"); + chmodSync(stub, 0o755); + process.env.HYPERFRAMES_BIN = stub; + const font = path.join(dir, "face.ttf"); + writeFileSync(font, "face"); + const render = { ...renderWith({}, { stamp: { show: false } }), fontRegular: font, fontBold: font }; + const mp = path.join(dir, "video.manifest.json"); + writeFileSync(mp, JSON.stringify({ slug: "f", render, timeline: ENTRIES })); + const out = path.join(dir, "out", "sourced"); + mkdirSync(out, { recursive: true }); + writeFileSync(path.join(out, "schedule.json"), JSON.stringify(sched(render))); + const { composeChrome } = await import("./compose-chrome.mjs"); + await assert.rejects(composeChrome({ manifestPath: mp, region: "stamp" }), /the stamps are off/); + } finally { + if (env === undefined) delete process.env.HYPERFRAMES_BIN; + else process.env.HYPERFRAMES_BIN = env; + rmSync(dir, { recursive: true, force: true }); + } +}); + +// ---- F2: no QR on the posts --------------------------------------------------- + +test("posts.qr: a setting, default on; refused when not a boolean", () => { + assert.equal(DECK_DEFAULTS.posts.qr, true); + assert.equal(resolveDeck(renderWith({ posts: { qr: false } })).posts.qr, false); + assert.deepEqual(validateChrome({ ...CHROME, deck: { posts: { qr: false } } }, BASE), []); + assert.match(validateChrome({ ...CHROME, deck: { posts: { qr: 0 } } }, BASE).join(" "), /posts\.qr must be true or false/); +}); + +test("posts.qr false, popup: no code and no cell; the words take the width; the deck's own QR stays", () => { + const on = renderWith(); + const off = renderWith({ posts: { qr: false } }); + const qrSrcs = { p1: "assets/pqr0.png", p2: "assets/pqr1.png" }; + const page = (r) => { + const s = sched(r, POSTS); + const win = snapWindow(postWindows(s)[0], { fps: 30, total: s.total }); + assert.deepEqual(windowPosts(s, win.segment).map((p) => p.id), ["p1", "p2"]); + return postsHtml(s, r, win, { fonts: FONTS, qrSrcs, logoSrcs: { p2: "assets/logo.png" } }); + }; + const withQr = page(on); + assert.ok(withQr.includes('<img src="assets/pqr0.png"')); + const without = page(off); + assert.doesNotMatch(without, /pqr\d\.png/, "no code, whatever qrSrcs holds"); + // p1 has no cell at all; p2 keeps one for its logo only. + assert.match(without, /class="post no-plate" data-post="p1"/); + assert.match(without, /class="post has-logo" data-post="p2"/); + assert.equal((without.match(/<div class="plate">/g) ?? []).length, 1); + assert.match(without, /\.post\.no-plate \.body \{ width: 594px; \}/, "600 less the rail"); + assert.match(without, /\.post \{ min-height: 0; \}/); + // The clip's deck QR is the deck's: untouched. + const s = sched(off, POSTS); + assert.equal(deckHtml(s, off, { qrSrcs: { c2: "assets/qr1.png" } }), deckHtml(sched(on, POSTS), on, { qrSrcs: { c2: "assets/qr1.png" } })); +}); + +test("posts.qr false, feed: no code, no cell, the body the stack's width less the rail", () => { + const off = renderWith({ posts: { layout: "feed", qr: false } }); + const on = renderWith({ posts: { layout: "feed" } }); + assert.equal(feedLayout(off).card.plate, 0); + assert.equal(feedLayout(on).card.plate, 120 + 28); + const qrSrcs = { p1: "assets/pqr0.png", p2: "assets/pqr1.png" }; + const html = feedHtml(sched(off, POSTS), off, { qrSrcs }); + assert.doesNotMatch(html, /pqr\d\.png/); + assert.doesNotMatch(html, /<div class="plate">/); + const lay = feedLayout(off); + assert.ok(html.includes(`.body { position: relative; width: ${lay.stack.width - lay.card.rail}px;`)); + assert.ok(feedHtml(sched(on, POSTS), on, { qrSrcs }).includes('<img src="assets/pqr0.png"')); +}); + +// ---- F3: pips by verdict ------------------------------------------------------ + +test("pip.color: accent (default) or verdict; anything else refused", () => { + assert.equal(DECK_DEFAULTS.pip.color, "accent"); + assert.deepEqual(validateChrome({ ...CHROME, deck: { pip: { color: "verdict" } } }, BASE), []); + assert.match(validateChrome({ ...CHROME, deck: { pip: { color: "red" } } }, BASE).join(" "), /pip\.color must be "accent" or "verdict"/); +}); + +test("VERDICT_SHAPES: one distinct shape per verdict, in VERDICTS order", () => { + assert.deepEqual(Object.keys(VERDICT_SHAPES), [...VERDICTS]); + assert.equal(new Set(Object.values(VERDICT_SHAPES)).size, VERDICTS.length); + assert.deepEqual(Object.values(VERDICT_SHAPES), ["circle", "diamond", "square", "triangle", "ring"]); +}); + +test("pip.color verdict: a claimed pip lit in its verdict's colour (relabels included) and shape; an unclaimed one as before", () => { + const r = renderWith({ pip: { color: "verdict" } }, { verdicts: { PARTLY: { color: "#ff00aa" } } }); + const s = sched(r); + const { pips } = deckCues(s, r); + assert.deepEqual(pips.map((p) => [p.id, p.verdict ?? null]), + [["c1", "PARTLY"], ["c2", "CONTRADICTED"], ["c3", null], ["c4", "CORROBORATED"]]); + const html = deckHtml(s, r, {}); + const lit = (k) => new RegExp(`<div class="pip lit[^"]*" data-k="pip${k}"[^>]*>`).exec(html)[0]; + assert.match(lit(0), /data-verdict="PARTLY" data-shape="diamond"/); + assert.match(lit(0), /background:#ff00aa/, "the override's colour"); + assert.match(lit(0), /transform:rotate\(45deg\)/); + assert.match(lit(1), /data-shape="square"/); + assert.match(lit(1), /background:#e5534b/); + assert.match(lit(3), /data-shape="circle"/); + assert.match(lit(3), /background:#3fbf7f/); + assert.equal(lit(2), `<div class="pip lit" data-k="pip2" style="left:${pips[2].x - 3}px">`, "unclaimed: as it always was"); + // The tally cell is the same colour, and carries the same shape. + const cell = /<div class="tcell" data-verdict="PARTLY"[^>]*>.*?<div class="tlabel">(.*?)<\/div>/s.exec(html); + assert.match(cell[0], /--vc:#ff00aa/); + assert.match(cell[0], /<div class="tshape" data-shape="diamond"[^>]*background:#ff00aa/); + assert.equal(cell[1], "Partly true", "the label keeps its width: the shape is in the cell's corner"); + // The pips still light as they did: one opacity cue each, same times. + const plain = renderWith({}, { verdicts: { PARTLY: { color: "#ff00aa" } } }); + const cuesOf = (rr) => deckCues(s, rr).cues.filter((c) => c.k.startsWith("pip")); + assert.deepEqual(cuesOf(r), cuesOf(plain)); + // Accent (the default): no verdict pips, no shape in the tally. + const accent = deckHtml(s, plain, {}); + assert.doesNotMatch(accent, /vpip|tshape/); +}); + +// ---- F4: markers ---------------------------------------------------------------- + +const MARKS = [{ after: "c2", label: "3 to 5 weeks pass" }, { after: "c4", label: "promise lapses", color: "#e5534b" }]; + +test("markers: shape refused in sentences -- unknown keys, labels, colours, count", () => { + const bad = (markers) => validateChrome({ ...CHROME, deck: { markers } }, BASE).join(" "); + assert.equal(bad(MARKS), ""); + assert.match(bad("c2"), /markers must be a list/); + assert.match(bad([{ after: "c2", label: "x", note: 1 }]), /markers\[0\]\.note is not a marker setting/); + assert.match(bad([{ after: "", label: "x" }]), /markers\[0\]\.after must name a clip's id/); + assert.match(bad([{ after: "c2", label: " " }]), /markers\[0\]\.label must be a word or two/); + assert.match(bad([{ after: "c2", label: "x".repeat(MARKER_LIMITS.label + 1) }]), /is 25 characters \(at most 24\)/); + assert.equal(bad([{ after: "c2", label: "x".repeat(MARKER_LIMITS.label) }]), ""); + assert.match(bad([{ after: "c2", label: "a\nb" }]), /must be one line/); + assert.match(bad([{ after: "c2", label: "x", color: "red" }]), /color must be a #hex colour/); + assert.equal(bad([{ after: "c2", label: "x", color: "amber" }]), ""); + assert.match(bad(Array.from({ length: 13 }, () => ({ after: "c2", label: "x" }))), /13 markers \(at most 12\)/); +}); + +test("markers: `after` must name a clip in the timeline -- the build's, the lint's and the writer's check", () => { + const m = (markers, timeline = ENTRIES) => ({ timeline, render: renderWith({ markers }) }); + assert.deepEqual(validateDeckMarkers(m(MARKS)), []); + assert.match(validateDeckMarkers(m([{ after: "zz", label: "x" }])).join(" "), /names zz, which is not in the timeline/); + assert.match(validateDeckMarkers(m([{ after: "t1", label: "x" }])).join(" "), /names t1, a card: a marker follows a clip/); + // The shape too, for the lint, which does not run validateChrome. + assert.match(validateDeckMarkers(m([{ after: "c2" }])).join(" "), /label must be a word or two/); + assert.match(validatorErrors(m([{ after: "zz", label: "x" }])).join(" "), /not in the timeline/); + // Without the deck, or without markers, nothing to say. + assert.deepEqual(validateDeckMarkers({ timeline: ENTRIES, render: BASE }), []); + assert.deepEqual(validateDeckMarkers({ timeline: ENTRIES, render: renderWith() }), []); +}); + +test("markers: a band above the track only when there are some; the code and the tally keep clear of it", () => { + const plain = deckLayout(renderWith(), { tally: ["PARTLY"] }); + const marked = deckLayout(renderWith({ markers: MARKS }), { tally: ["PARTLY"] }); + assert.equal(plain.pipTrack.y, 16); + assert.equal(plain.markerBand, undefined); + assert.equal(marked.pipTrack.y, 16 + MARKER_BAND); + assert.deepEqual(marked.markerBand, { y: 3, height: MARKER_BAND + 6 }); + // The labels' band ends above everything in the body. + const bandEnd = marked.markerBand.y + 14; + assert.ok(marked.qr.y >= marked.pipTrack.y + 12 && marked.qr.y + marked.qr.size <= 190, `qr ${marked.qr.y}`); + assert.ok(marked.tally.y > bandEnd && marked.text.titleY > bandEnd); +}); + +test("markers: placed between the pip they follow and the next; time spacing at the hand-over; boxes never meet", () => { + const r = renderWith({ markers: MARKS }); + const s = sched(r); + const lay = deckLayout(r); + const pipped = pipSegments(s); + const xs = pipXs(pipped.length, lay.pipTrack.x0, lay.pipTrack.x1, "even"); + const ms = deckMarkers(s, r, xs, pipped, lay); + assert.deepEqual(ms.map((m) => [m.after, m.k]), [["c2", 1], ["c4", 3]]); + assert.equal(ms[0].x, (xs[1] + xs[2]) / 2); + assert.equal(ms[1].x, (xs[3] + lay.pipTrack.x1) / 2, "after the last pip: toward the track's end"); + assert.equal(ms[0].color, PALETTE.amber, "the default colour is the palette's amber"); + assert.equal(ms[1].color, "#e5534b"); + for (const m of ms) assert.ok(m.box[0] <= m.x && m.box[1] >= m.x && m.box[1] - m.box[0] <= 240); + // Time spacing: at the next segment's mid-dissolve, in the cut's clock. + const rt = renderWith({ markers: MARKS, pip: { spacing: "time" } }); + const st = sched(rt); + const tl = deckLayout(rt); + const tp = pipSegments(st); + const txs = pipXs(tp.length, tl.pipTrack.x0, tl.pipTrack.x1, "time", { total: st.total, segments: tp }); + const [m0] = deckMarkers(st, rt, txs, tp, tl); + const next = st.segments[st.segments.findIndex((x) => x.id === "c2") + 1]; + assert.ok(Math.abs(m0.x - (tl.pipTrack.x0 + ((tl.pipTrack.x1 - tl.pipTrack.x0) * (next.start + 0.25)) / st.total)) < 0.01); + assert.ok(m0.x > txs[1] && m0.x < txs[2]); + // Crowded flags: each label stops short of halfway to its neighbour. + const crowd = renderWith({ markers: [{ after: "c1", label: "a long label of a flag" }, { after: "c2", label: "another long label" }, { after: "c3", label: "third" }] }); + const cs = sched(crowd); + const cl = deckLayout(crowd); + const cp = pipSegments(cs); + const cx = pipXs(cp.length, cl.pipTrack.x0, cl.pipTrack.x1, "even"); + const placed = deckMarkers(cs, crowd, cx, cp, cl); + for (let j = 1; j < placed.length; j += 1) assert.ok(placed[j - 1].box[1] < placed[j].box[0], `boxes ${j - 1} and ${j} meet`); +}); + +test("markers: hidden until the fuse reaches the flag, then a pop, lit for the rest; drawn in the page", () => { + const r = renderWith({ markers: MARKS }); + const s = sched(r); + const { init, cues, markers } = deckCues(s, r); + assert.equal(markers.length, 2); + assert.deepEqual(init.mk0, { autoAlpha: 0, scale: MARKER_POP.from }); + const mk0 = cues.filter((c) => c.k === "mk0"); + assert.equal(mk0.length, 1, "one cue: it pops in and stays"); + assert.deepEqual(mk0[0].from, { autoAlpha: 0, scale: MARKER_POP.from }); + assert.deepEqual(mk0[0].to, { autoAlpha: 1, scale: 1 }); + // The fuse from pip 1 (c2) toward pip 2 (c3) passes the midpoint halfway + // through its burn: c2's rest, from its arrival to the deck sliding away. + const fuse = cues.find((c) => c.k === "fuse" && c.why === "fuse c2"); + assert.ok(Math.abs(mk0[0].at - (fuse.at + fuse.dur / 2)) < 0.01, `${mk0[0].at} vs fuse ${fuse.at}+${fuse.dur}`); + assert.ok(mk0[0].at > s.segments[1].start && mk0[0].at < s.segments[1].end); + // After the last pip: a second before its clip ends. + const c4 = s.segments.find((x) => x.id === "c4"); + const mk1 = cues.find((c) => c.k === "mk1"); + assert.ok(Math.abs(mk1.at - (c4.end - 1)) < 0.01); + // The page: a flag per marker, its label escaped, in the band. + const html = deckHtml(s, r, {}); + assert.equal((html.match(/class="mflag"/g) ?? []).length, 2); + assert.match(html, /data-k="mk0" data-after="c2"[^>]*--mc:#ffc860/); + assert.match(html, /<div class="mlabel"[^>]*>3 to 5 weeks pass<\/div>/); + assert.match(html, /\.mlabel \{ position: absolute; top: -23px;/, "the band, above the track"); + assert.match(html, /text-overflow: ellipsis; font-family: 'DeckSansBold'/); + const esc = renderWith({ markers: [{ after: "c2", label: "<b>x</b> & y" }] }); + assert.match(deckHtml(sched(esc), esc, {}), /><b>x<\/b> & y</); + // No markers: none of it. + assert.doesNotMatch(deckHtml(s, renderWith(), {}), /mflag|mlabel/); +}); diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs @@ -42,7 +42,9 @@ export const DECK_DEFAULTS = Object.freeze({ height: 190, footageScale: 0.82, background: "panel", // | "flush" - pip: Object.freeze({ spacing: "even", size: 6, activeSize: 12 }), // spacing | "time" + // spacing | "time". `color` "verdict": a claimed clip's pip, once lit, takes + // its claim's verdict colour and shape (factcheck.mjs VERDICT_SHAPES). + pip: Object.freeze({ spacing: "even", size: 6, activeSize: 12, color: "accent" }), title: Object.freeze({ size: 54, maxChars: 48 }), subtitle: Object.freeze({ parts: "auto", dateFormat: "long" }), // dateFormat | "iso" // `links` is where a clip's QR goes: "site" (the archive's page at the @@ -72,9 +74,29 @@ export const DECK_DEFAULTS = Object.freeze({ posts: Object.freeze({ show: true, layout: "popup", seconds: 4, hold: 2.5, position: "top-right", width: 600, qrSize: 120, maxLines: 7, inset: 24, shift: Object.freeze({ scale: 0.86, seconds: 0.6 }), links: "archive", at: "end", shotMaxHeight: null, + // `qr: false` draws no QR on any post card (popup or feed); the words + // take the code's width. The clip's own deck QR (`qr`) is untouched. + qr: true, }), + // Flags on the pip track: `[{ after, label, color? }]`, each between the pip + // of the clip `after` names and the next, hidden until the fuse reaches it + // (deckMarkers). An empty list is no flags, and the deck lays out as it + // always did. + markers: Object.freeze([]), }); +/** The pip's colour when lit (`pip.color`): the deck's accent, or a claimed clip's verdict. */ +export const PIP_COLORS = Object.freeze(["accent", "verdict"]); + +/** A marker's limits: how many, and a label's characters. */ +export const MARKER_LIMITS = Object.freeze({ count: 12, label: 24 }); + +/** The palette keys a marker's `color` may name (else a `#rgb` / `#rrggbb`). */ +export const MARKER_PALETTE_KEYS = Object.freeze(["fg", "muted", "accent", "amber", "dim"]); + +/** A marker with no `color` is drawn in this palette key. */ +export const MARKER_DEFAULT_COLOR = "amber"; + /** * The deck's TUNABLE params (release 38): the settings the video assistant's * `fx` op may set by name, each with the bounds validateChrome holds it to @@ -194,10 +216,13 @@ export function validateChrome(chrome, render = {}) { unknownKeys(d[key], allowed, `${w}.${key}`, errors); check(d[key]); }; - sub("pip", ["spacing", "size", "activeSize"], (p) => { + sub("pip", ["spacing", "size", "activeSize", "color"], (p) => { if (p.spacing !== undefined && !["even", "time"].includes(p.spacing)) { errors.push(`${w}.pip.spacing must be "even" or "time"`); } + if (p.color !== undefined && !PIP_COLORS.includes(p.color)) { + errors.push(`${w}.pip.color must be ${PIP_COLORS.map((c) => `"${c}"`).join(" or ")}`); + } if (p.size !== undefined && !numIn(p.size, 2, 24)) errors.push(`${w}.pip.size must be from 2 to 24`); if (p.activeSize !== undefined && !numIn(p.activeSize, 2, 40)) { errors.push(`${w}.pip.activeSize must be from 2 to 40`); @@ -239,7 +264,8 @@ export function validateChrome(chrome, render = {}) { errors.push(`${w}.qr.size ${size} does not fit a ${h}px deck (at most ${h - 20})`); } }); - sub("posts", ["show", "layout", "seconds", "hold", "position", "width", "qrSize", "maxLines", "inset", "shift", "links", "at", "shotMaxHeight"], (p) => { + sub("posts", ["show", "layout", "seconds", "hold", "position", "width", "qrSize", "maxLines", "inset", "shift", "links", "at", "shotMaxHeight", "qr"], (p) => { + if (p.qr !== undefined && typeof p.qr !== "boolean") errors.push(`${w}.posts.qr must be true or false`); if (p.at !== undefined && !POST_AT.includes(p.at)) { errors.push(`${w}.posts.at must be ${POST_AT.map((a) => `"${a}"`).join(" or ")}`); } @@ -276,6 +302,7 @@ export function validateChrome(chrome, render = {}) { } if (p.inset !== undefined && !numIn(p.inset, 0, 80)) errors.push(`${w}.posts.inset must be from 0 to 80`); }); + errors.push(...markerShapeErrors(d.markers, `${w}.markers`)); sub("motion", ["out", "in", "pip"], (m) => { for (const k of ["out", "in"]) { if (m[k] !== undefined && !numIn(m[k], 0, 2)) errors.push(`${w}.motion.${k} must be from 0 to 2 seconds`); @@ -311,6 +338,64 @@ export function validateChrome(chrome, render = {}) { return errors; } +const HEX_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/; + +/** + * Every reason a `deck.markers` list cannot be drawn, its shape alone (the + * timeline is not in `render.chrome`: `validateDeckMarkers` checks `after` + * against it). validateChrome calls this. + * + * @returns {string[]} + */ +function markerShapeErrors(markers, where) { + if (markers === undefined) return []; + if (!Array.isArray(markers)) return [`${where} must be a list of { after, label, color? }`]; + const errors = []; + if (markers.length > MARKER_LIMITS.count) errors.push(`${where} has ${markers.length} markers (at most ${MARKER_LIMITS.count})`); + markers.forEach((m, i) => { + const at = `${where}[${i}]`; + if (!isObj(m)) { errors.push(`${at} must be { after, label, color? }`); return; } + for (const k of Object.keys(m)) { + if (!["after", "label", "color"].includes(k)) errors.push(`${at}.${k} is not a marker setting (after, label, color)`); + } + if (typeof m.after !== "string" || !m.after.trim()) errors.push(`${at}.after must name a clip's id`); + const label = typeof m.label === "string" ? m.label.trim() : ""; + if (!label) errors.push(`${at}.label must be a word or two`); + else if (/[\r\n]/.test(label)) errors.push(`${at}.label must be one line`); + else if ([...label].length > MARKER_LIMITS.label) { + errors.push(`${at}.label is ${[...label].length} characters (at most ${MARKER_LIMITS.label})`); + } + if (m.color !== undefined && !(typeof m.color === "string" && (HEX_RE.test(m.color) || MARKER_PALETTE_KEYS.includes(m.color)))) { + errors.push(`${at}.color must be a #hex colour or one of ${MARKER_PALETTE_KEYS.join(", ")}`); + } + }); + return errors; +} + +/** + * The deck's markers checked whole: their shape (as validateChrome checks + * it) and, against the WHOLE timeline, that each `after` names a clip in it. + * The build and the lint refuse with these; umtool's writers refuse before + * they write. Empty without the deck or without markers. + * + * @returns {string[]} + */ +export function validateDeckMarkers(manifest) { + const markers = manifest?.render?.chrome?.deck?.markers; + if (!deckOn(manifest?.render) || markers === undefined) return []; + const errors = markerShapeErrors(markers, "render.chrome.deck.markers"); + if (!Array.isArray(markers)) return errors; + const timeline = manifest.timeline ?? []; + markers.forEach((m, i) => { + if (!isObj(m) || typeof m.after !== "string" || !m.after.trim()) return; // markerShapeErrors says so + const hit = timeline.find((e) => e?.id === m.after.trim()); + const where = `render.chrome.deck.markers[${i}].after`; + if (!hit) errors.push(`${where} names ${m.after}, which is not in the timeline`); + else if (hit.type !== "clip") errors.push(`${where} names ${m.after}, a ${hit.type ?? "entry"}: a marker follows a clip`); + }); + return errors; +} + /** `validateChrome`, thrown. The build calls this before it spends a single fetch. */ export function assertChrome(chrome, render = {}) { const errors = validateChrome(chrome, render); @@ -413,15 +498,21 @@ export function deckLayout(render, { tally = null } = {}) { const { W, deck: rect } = deckGeometry(render); const d = resolveDeck(render); const padX = 48; - const trackY = 16; + // The markers' labels (`deck.markers`) stand in a band above the track: the + // track moves down by it, and only when there is a marker to label, so a + // deck without them lays out as it always did. + const markerBand = Array.isArray(d.markers) && d.markers.length ? MARKER_BAND : 0; + const trackY = 16 + markerBand; // The body is everything under the pip track: the text block and the QR are // both centred in it, so the title's optical centre and the code's agree // whatever the deck's height. 14 px clears the active pip's halo. const bodyTop = trackY + 14; const bodyH = rect.height - bodyTop - 8; - const qr = d.qr.show - ? { x: W - padX - d.qr.size, y: Math.round(bodyTop + (bodyH - d.qr.size) / 2), size: d.qr.size } - : null; + let qrY = Math.round(bodyTop + (bodyH - d.qr.size) / 2); + // Under a marker band the code keeps clear of the active pip's halo and + // inside the deck, whichever gives way. + if (markerBand) qrY = Math.min(rect.height - d.qr.size - 2, Math.max(qrY, trackY + 12)); + const qr = d.qr.show ? { x: W - padX - d.qr.size, y: qrY, size: d.qr.size } : null; let textX = padX; let textRight = qr ? qr.x - 48 : W - padX; let tallyBox = null; @@ -470,9 +561,72 @@ export function deckLayout(render, { tally = null } = {}) { qr, // Only with a tally, so a deck without claims lays out as it always did. ...(tallyBox ? { tally: tallyBox } : {}), + // Only with markers, likewise: where their labels stand (deckMarkers). + ...(markerBand ? { markerBand: { y: 3, height: markerBand + 6 } } : {}), }; } +/** How far the track moves down to make room for the markers' labels. */ +export const MARKER_BAND = 10; + +/** + * Where each of the deck's markers (`deck.markers`) stands on the pip track, + * region-local px: `x` between the pip of the clip it follows and the next + * pip (their midpoint; with `pip.spacing: "time"` the cut's second where the + * two segments hand over -- the next segment's mid-dissolve), and its label's + * box `[left, right]`: at most 240 px centred on the flag, never past halfway + * to the next flag either side nor off the track's ends, so two labels never + * meet -- a long one is ellipsized in it. `k` is the pip it follows. A marker + * whose clip has no pip (not in the cut) is left out. + * + * `xs` are the pips' x (pipXs), `pipped` their segments (pipSegments). + * + * @returns {Array<{ after: string, label: string, color: string, k: number, x: number, box: [number, number] }>} + */ +export function deckMarkers(schedule, render, xs, pipped, lay = deckLayout(render)) { + const d = resolveDeck(render); + const markers = Array.isArray(d.markers) ? d.markers : []; + if (!markers.length || !pipped.length) return []; + const { x0, x1 } = lay.pipTrack; + const pal = render?.palette ?? {}; + const segs = schedule.segments ?? []; + const D = schedule.transition ?? 0; + const pipOf = new Map(pipped.map((s, k) => [s.id, k])); + const placed = []; + for (const m of markers) { + const after = String(m?.after ?? "").trim(); + const k = pipOf.get(after); + if (k === undefined) continue; + let x; + if (d.pip.spacing === "time" && schedule.total > 0) { + const i = segs.findIndex((s) => s.id === after); + const next = segs[i + 1]; + x = next ? x0 + ((x1 - x0) * (next.start + D / 2)) / schedule.total : x1; + } else { + x = k + 1 < xs.length ? (xs[k] + xs[k + 1]) / 2 : (xs[k] + x1) / 2; + } + x = Math.min(x1, Math.max(x0, x)); + const key = m.color ?? MARKER_DEFAULT_COLOR; + const color = HEX_RE.test(key) ? key : pal[key] ?? pal.fg ?? "#ffffff"; + placed.push({ after, label: String(m.label ?? "").trim(), color, k, x: Math.round(x * 100) / 100 }); + } + // The label boxes: each up to halfway to its neighbours, 240 px at most. + const order = placed.map((p, j) => j).sort((a, b) => placed[a].x - placed[b].x); + const W = lay.width; + return placed.map((p, j) => { + const o = order.indexOf(j); + const prev = o > 0 ? placed[order[o - 1]].x : null; + const next = o < order.length - 1 ? placed[order[o + 1]].x : null; + const lo = Math.max(16, p.x - 120, prev === null ? -Infinity : (prev + p.x) / 2 + 3); + const hi = Math.max(lo, Math.min(W - 16, p.x + 120, next === null ? Infinity : (p.x + next) / 2 - 3)); + // Centred on the flag when that leaves the label room; else the whole + // stretch it may take, off-centre (a flag near the track's end). + const half = Math.min(p.x - lo, hi - p.x); + const box = half * 2 >= Math.min(140, hi - lo) ? [p.x - half, p.x + half] : [lo, hi]; + return { ...p, box: box.map((v) => Math.round(v)) }; + }); +} + /** * The x of every pip on the track. * diff --git a/umtool/report-to-video/deck.test.mjs b/umtool/report-to-video/deck.test.mjs @@ -45,7 +45,7 @@ test("deckOn: only the hyperframes deck", () => { test("resolveDeck merges one level deep", () => { const d = resolveDeck({ chrome: { ...CHROME, deck: { height: 200, pip: { size: 8 } } } }); assert.equal(d.height, 200); - assert.deepEqual(d.pip, { spacing: "even", size: 8, activeSize: 12 }); + assert.deepEqual(d.pip, { spacing: "even", size: 8, activeSize: 12, color: "accent" }); assert.deepEqual(d.motion, DECK_DEFAULTS.motion); }); diff --git a/umtool/report-to-video/factcheck.mjs b/umtool/report-to-video/factcheck.mjs @@ -4,7 +4,7 @@ // // timeline entry: "claim": { "id": "k3", "verdict": "CONTRADICTED" } // render.chrome: "factcheck": { "verdicts": { "PARTLY": { "label": "Half true" } }, -// "stamp": { "seconds": 3, "position": "top-left" }, +// "stamp": { "show": true, "seconds": 3, "position": "top-left" }, // "tally": { "show": true, "position": "right" } } // // `claim` is its own key: an entry's `verdict` is the clip review's @@ -46,7 +46,9 @@ export const TALLY_POSITIONS = Object.freeze(["right", "left"]); */ export const FACTCHECK_DEFAULTS = Object.freeze({ verdicts: VERDICT_DEFAULTS, - stamp: Object.freeze({ seconds: 3, position: "top-left" }), + // `show: false` draws no stamp at all -- no composition, no overlay -- and + // the tally still counts each claim at the second its stamp would have landed. + stamp: Object.freeze({ show: true, seconds: 3, position: "top-left" }), tally: Object.freeze({ show: true, position: "right" }), }); @@ -111,7 +113,8 @@ export function validateFactcheck(f, where = "render.chrome.factcheck") { unknownKeys(f[key], allowed, `${where}.${key}`, errors); check(f[key]); }; - sub("stamp", ["seconds", "position"], (s) => { + sub("stamp", ["show", "seconds", "position"], (s) => { + if (s.show !== undefined && typeof s.show !== "boolean") errors.push(`${where}.stamp.show must be true or false`); const [lo, hi] = FACTCHECK_LIMITS.seconds; if (s.seconds !== undefined && !numIn(s.seconds, lo, hi)) errors.push(`${where}.stamp.seconds must be from ${lo} to ${hi}`); if (s.position !== undefined && !STAMP_POSITIONS.includes(s.position)) { @@ -230,6 +233,24 @@ export function stampSchedule({ segments, D, total, render }) { }); } +/** + * Are the stamps DRAWN: the schedule stamps a claim and `stamp.show` is on. + * With it off the schedule still carries its stamps -- the tally counts at + * each one's `landed` -- but no stamp composition is rendered or laid. + */ +export function stampsDrawn(schedule, render) { + return !!schedule?.factcheck?.stamps?.length && resolveFactcheck(render).stamp.show !== false; +} + +/** + * The shape a claimed clip's pip takes (`deck.pip.color: "verdict"`), one per + * verdict in VERDICTS order, so a viewer who cannot tell the colours apart + * can still tell the verdicts apart. The tally's cells carry the same shape. + */ +export const VERDICT_SHAPES = Object.freeze(Object.fromEntries( + VERDICTS.map((v, i) => [v, ["circle", "diamond", "square", "triangle", "ring"][i] ?? "circle"]), +)); + /** `stampSchedule`'s stamps as a schedule writes them: seconds to the millisecond. */ export function roundStamps(stamps) { const round = (v) => Math.round(v * 1000) / 1000; diff --git a/umtool/report-to-video/factcheck.test.mjs b/umtool/report-to-video/factcheck.test.mjs @@ -94,12 +94,12 @@ test("validateClaims: shape, never on a teaser, one verdict per claim id; the re test("resolveFactcheck: every default, a verdict's label and colour filled on their own", () => { assert.deepEqual(resolveFactcheck(RENDER), { verdicts: Object.fromEntries(VERDICTS.map((v) => [v, { ...FACTCHECK_DEFAULTS.verdicts[v] }])), - stamp: { seconds: 3, position: "top-left" }, + stamp: { show: true, seconds: 3, position: "top-left" }, tally: { show: true, position: "right" }, }); const f = resolveFactcheck({ chrome: { ...CHROME, factcheck: { verdicts: { PARTLY: { label: "Half true" } }, stamp: { seconds: 5 } } } }); assert.deepEqual(f.verdicts.PARTLY, { label: "Half true", color: FACTCHECK_DEFAULTS.verdicts.PARTLY.color }); - assert.deepEqual(f.stamp, { seconds: 5, position: "top-left" }); + assert.deepEqual(f.stamp, { show: true, seconds: 5, position: "top-left" }); }); test("validateChrome refuses a bad factcheck block in sentences, unknown keys included", () => { diff --git a/umtool/report-to-video/lint.mjs b/umtool/report-to-video/lint.mjs @@ -78,7 +78,7 @@ import { existsSync } from "node:fs"; import path from "node:path"; import { deckOn, deckQrUrl, postArchiveUrl, postNativeId, postQrUrl, resolveDeck, teaserLines, - validateCutEdits, validatePosts, validateTeasers, + validateCutEdits, validateDeckMarkers, validatePosts, validateTeasers, } from "./deck.mjs"; import { validateClaims } from "./factcheck.mjs"; import { validateThreadEntries } from "./threads.mjs"; @@ -247,6 +247,8 @@ export function validatorErrors(whole) { ]; if (deckOn(whole.render)) { errors.push(...validatePosts(whole.posts, whole.timeline ?? [], whole.render).map((m) => `posts: ${m}`)); + // The deck's markers against the whole timeline, as the build refuses them. + errors.push(...validateDeckMarkers(whole)); } return errors; } diff --git a/umtool/report-to-video/verify-build.mjs b/umtool/report-to-video/verify-build.mjs @@ -21,6 +21,7 @@ import path from "node:path"; import { postsRegions, selectVariant, variantPaths } from "./build-video.mjs"; import { deckGeometry, deckOn, frameCount, postsGeometry, resolveDeck, teaserSeconds, transitionOf } from "./deck.mjs"; import { statsClips } from "./stats.mjs"; +import { stampsDrawn } from "./factcheck.mjs"; import { frameKeyOf, framesOf } from "./prune-frames.mjs"; import { montageSplit, resolveMontage } from "./montage.mjs"; import { applyMontageRulings, readMontageRulings } from "./montage-rulings.mjs"; @@ -172,9 +173,10 @@ export async function verifyDeck(variantDir, render, file, problems, manifest = problems.push(`the posts feed never pauses the cut, but the schedule holds ${held.join(", ") || "nothing"} and moves ${schedule.moves?.length ?? 0}`); } } - // The fact-check stamps: one sequence for the whole cut, as long as the deck's. + // The fact-check stamps: one sequence for the whole cut, as long as the + // deck's -- unless they are off (`stamp.show: false`), when none is drawn. let stamp = null; - if (schedule.factcheck?.stamps?.length) { + if (stampsDrawn(schedule, render)) { const dir = path.join(variantDir, "chrome", "stamp-frames"); const got = await countFrames(dir); stamp = { frames: got, expectedFrames: want, stamps: schedule.factcheck.stamps.length };