Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 83404d8bf2f3d258922b1219195a79267a481fd8
parent 7e7ce7f34e59f12e640a0194d7b40f1897cb5e4b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri,  6 Nov 2026 04:16:34 -0500

umtool: an entry hides modules over its span (hideModules)

At 11:23 in rev9-a-full the diet badge and the diet-runs strip covered the
refund email inside MadamSavvy's DM screenshot (v02): text in the footage
that no dodge can know of. A timeline entry now carries `hideModules`
(deck.mjs HIDEABLE_MODULES: goals, peak, promise, diet, streak -- the
measure extras, which stand over the footage):
- the schedule reads it (entryHides -> schedule.hides, beside covers), so
  the render and Play, which draw from the same schedule, both honour it;
- measurePlacements hides each named module over the entry's span with its
  own fade (a hidden move), cutting any dodge or move it had there around it;
  the promise strip too;
- `umtool set <p> <entry> hideModules=diet,streak` writes it through
  patchClipEntry (any entry, a post item too; `hideModules=` clears; an id
  no entry can hide is refused), and `--take <t>` writes a take's entry knobs
  into its patch through updateTakeClip (an undo point of the take's, the
  project's manifest untouched; claim.* and marks stay the project's).
Docs: knobs.md's clip table, the measure extras' module rows (regenerated),
`umtool set`'s usage and help. Tests for the CLI (a clip, a post item, a
refused id, --take) and the placement (the hide, a dodge carved around it).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/bin/umtool.mjs | 2++
Mumtool/docs/knobs.md | 6++++++
Mumtool/lib/report/knobsCli.mjs | 28++++++++++++++++++++++++----
Mumtool/lib/report/knobsCli.test.mjs | 28++++++++++++++++++++++++++++
Mumtool/lib/report/manifest.mjs | 22+++++++++++++++++++++-
Mumtool/report-to-video/deck.mjs | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/measure-extras.mjs | 23+++++++++++++++++++++++
Mumtool/report-to-video/measure-extras.test.mjs | 28+++++++++++++++++++++++++++-
Mumtool/report-to-video/modules/measure-extras-module.mjs | 1+
9 files changed, 183 insertions(+), 6 deletions(-)

diff --git a/umtool/bin/umtool.mjs b/umtool/bin/umtool.mjs @@ -909,6 +909,8 @@ function usage() { " claim.count claim.label (the first mark's, or --mark <id>'s) · marks: mark.add=<verdict>[@<sec>]", " mark.remove=<id> mark.verdict=<verdict> marks=<json> (≤ 8, each its own stamp and count)", " · audio.offset (ms, + later) audio.gain (dB) audio.fadeIn audio.fadeOut", + " · hideModules=diet,streak (those modules hidden over the entry's span; any entry)", + " --take <t>: the entry knobs into the take's patch, the project's manifest untouched", " umtool look <project> key=value … the cut's knobs: factcheck.stamp.scale|motion|opacity|seconds,", " factcheck.verdicts.<V>.stampLabel|label|color, deck.markers=<json>, deck.markerLayout,", " variants=<json>, and the look's keys (transition=0.3, …)", diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -35,6 +35,7 @@ that generates it ([notes.md](notes.md)). | `blur.from`, `blur.to` — source seconds inside the clip's window: blur only that span (either alone runs to the clip's edge; default the whole clip) | Blur, **From playhead** / **To playhead**, **Whole clip** | `blur.from=231.5 blur.to=262` | same | | `layout` — `finale`: the deck's finale layout for this clip (`render.chrome.deck.finale`); `clip` is the default | — | `umtool set <p> <clip> layout=finale` | — | | `chat` — `on`: the clip's live chat (its video's `live_chat.cues.json`, for the clip's source span, timed through its gaps) in a column beside the footage; `off` or `chat=` (the default): none. A video with no chat draws nothing and the build log says so ([Live chat](#live-chat)) | — | `umtool set <p> <clip> chat=on` (`chat=` clears it) | — | +| `hideModules` — `["diet","streak",…]`: the measure extras (`goals` `peak` `promise` `diet` `streak`) hidden over THIS entry's span, each with its own fade, whatever it would otherwise do there -- for text in the footage no dodge can know of (a DM screenshot's refund email under the diet badge). Any entry, a post item too; an id no entry can hide is refused | — | `umtool set <p> <entry> hideModules=diet,streak` (`hideModules=` clears it; `--take <t>` writes the take's patch, the project's manifest untouched) | — | | `fx.zoom` — `{shot, focus, at?, hold?}`: a screenshot (a file in the project; a bare name under its `shots/` is written as `shots/<name>`) that comes up over the footage and pushes in on `focus` (`[left, top, right, bottom]`, fractions of the shot) — drawn once `render.chrome.fx.zoom` is on ([Effects](#effects)). **How long it stays**: up 0.2 s into the clip's clean span (rising in over 0.38 s), its focus box drawn 0.55 s later, the push at `at` (seconds into the clip; default as soon as the box has drawn) over 1 s, then a slow drift on the detail; it leaves with a 0.3 s fade 0.3 s before the clip's clean span ends — or, with `hold` (0.5–10 s), that long after the push lands (never past the clip's own leave) | — | `umtool set <p> <clip> fx.zoom='{"shot":"shots/x.png","focus":[0.1,0.2,0.9,0.4],"at":5.9,"hold":4}'` (`fx.zoom=` clears it) | `PUT /api/report/window {project, clip, "fx.zoom": {…} \| null}` | | `fx.receipts`, `fx.punch`, `fx.quote`, `fx.punchIn`, `fx.speakers` — the clip's other effect fields (`[{shot, mark?, at?, hold?, label?}]` 1–4, `at` the source second a receipt flies in at (default: as the clip comes up), `hold` 0.5–10 s it stays once landed (on every one: they leave then, not with the clip), `label` a line of at most 80 characters in a band under the screenshot (when it was taken, what it is); the words to punch; `false`: no line; 1–8 source seconds inside the clip; `[{at, who: 0\|1}]`), each inert until its effect is on; `fx` is all of them at once. Checked by the build's own `validateFxEntries` | — | `fx.punch="the words"` `fx.punchIn='[231.4]'` · `fx='{…}'` sets them all, `fx=` clears every one | `PUT /api/report/window {project, clip, fx}` (or one `"fx.<field>"`) | | `gaps` — `[{from, to}]`, SOURCE seconds cut out of the clip's middle: it renders as ONE segment of jump cuts (one pip, one card), not two clips with a crossfade ([below](#gaps-inside-a-clip)) | clip bench (Edit this clip), the waveform: **Select a gap** (`g`) or Alt + drag a span, **Cut gap** (`g`), **Hear it**; a click on a gap's band puts it back (`G`: the one at the playhead); **Undo** | `umtool window <p> <clip> --gap 12.3-15.1` (repeatable) · `--gap-remove 12.3` · `--gaps '12.3-15.1,20-20.6'` (`--gaps ''` clears) · `umtool set <p> <clip> gap.add=12.3-15.1 gap.remove=12.3 gaps=` | `PUT /api/report/window {project, clip, token, gapAdd \| gapRemove \| gaps}` | @@ -1751,6 +1752,7 @@ A chain per run along a time axis by in-record date (`render.chrome.deck.streak` | `deck.streak.hold`, `.finale` | 0 (up from the first run on) or 2–600 s · `hide` `show` · default 0, `hide` | `umtool look <p> deck.streak.hold=15` | | `deck.streak.title`, `.color`, `.colors`, `.labels` | ≤40 · #hex · `{<regime>: #hex}` · `{<regime>: words}` · default the source's word, the accent, the regimes' inks and names | `umtool look <p> deck.streak.title='Every diet'` | | `deck.streak.onPosts`, `.onChapters` | `dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it | `umtool look <p> deck.streak.onPosts=hide` | +| a timeline entry's `hideModules` | `["streak", …]` on an entry hides it over that entry's span, with its own fade, whatever it would otherwise do there (text in the footage no dodge can know of) · any entry, a post item too | `umtool set <p> <entry> hideModules=streak` (`--take <t>` for a take) | ### Diet badge @@ -1763,6 +1765,7 @@ The diet he names as a rubber stamp in a corner of the footage box (`render.chro | `deck.diet.hold`, `.finale` | 0 (up from the first diet on) or 2–600 s · `hide` `show` · default 0, `hide` | `umtool look <p> deck.diet.hold=15` | | `deck.diet.colors`, `.labels` | `{<regime>: #hex}` · `{<regime>: words ≤40}` · default the regimes' inks and names | `umtool look <p> deck.diet.labels='{"glp1":"Ozempic"}'` | | `deck.diet.onPosts`, `.onChapters` | `dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it | `umtool look <p> deck.diet.onPosts=hide` | +| a timeline entry's `hideModules` | `["diet", …]` on an entry hides it over that entry's span, with its own fade, whatever it would otherwise do there (text in the footage no dodge can know of) · any entry, a post item too | `umtool set <p> <entry> hideModules=diet` (`--take <t>` for a take) | ### Moving start @@ -1775,6 +1778,7 @@ The weight he says he started at, as he retells it (`render.chrome.deck.peak`, m | `deck.peak.hold`, `.finale` | 0 (stays up) or 2–600 s · `hide` `show` · default 12, `hide` | `umtool look <p> deck.peak.hold=0` | | `deck.peak.title`, `.values`, `.color` | ≤40 · `drift` `all` · #hex · default "The start keeps moving", `drift`, #FF5A4E | `umtool look <p> deck.peak.values=all` | | `deck.peak.onPosts`, `.onChapters` | `dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it | `umtool look <p> deck.peak.onPosts=hide` | +| a timeline entry's `hideModules` | `["peak", …]` on an entry hides it over that entry's span, with its own fade, whatever it would otherwise do there (text in the footage no dodge can know of) · any entry, a post item too | `umtool set <p> <entry> hideModules=peak` (`--take <t>` for a take) | ### Goal stack @@ -1787,6 +1791,7 @@ A sticky note per goal on a pile in a corner of the footage box, read off the sc | `deck.goals.max`, `.color`, `.countdown` | 1–8 notes · #hex paper · bool · default 4, the palette's amber, `true` | `umtool look <p> deck.goals.max=6` | | `deck.goals.hold`, `.finale` | 0 (up from the first goal on) or 2–600 s after each · `hide` `show` · default 20, `hide` | `umtool look <p> deck.goals.hold=0` | | `deck.goals.onPosts`, `.onChapters` | `dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it | `umtool look <p> deck.goals.onPosts=hide` | +| a timeline entry's `hideModules` | `["goals", …]` on an entry hides it over that entry's span, with its own fade, whatever it would otherwise do there (text in the footage no dodge can know of) · any entry, a post item too | `umtool set <p> <entry> hideModules=goals` (`--take <t>` for a take) | ### Thread rail @@ -1882,5 +1887,6 @@ A days-since counter for a promise (`render.chrome.deck.promise`, measure-extras | `deck.promise.label`, `.verb`, `.kept`, `.broken`, `.checks` | ≤40 each · `label` `quote` · default the row's display, "offered", "Posted", "None posted", `label` | `umtool look <p> deck.promise.label='scale video'` | | `deck.promise.speakers`, `.claimVerb`, `.claimColor` | `{<speaker>: {handle, color}}` · ≤40 · #hex · default `{}` (the postAvatars handle), "paid", #E37AB8 | `umtool look <p> deck.promise.speakers='{"madamsavvy":{"handle":"MadamSavvy"}}'` | | `deck.promise.onPosts`, `.onChapters` | `dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it | `umtool look <p> deck.promise.onPosts=hide` | +| a timeline entry's `hideModules` | `["promise", …]` on an entry hides it over that entry's span, with its own fade, whatever it would otherwise do there (text in the footage no dodge can know of) · any entry, a post item too | `umtool set <p> <entry> hideModules=promise` (`--take <t>` for a take) | <!-- modules:end --> diff --git a/umtool/lib/report/knobsCli.mjs b/umtool/lib/report/knobsCli.mjs @@ -59,13 +59,13 @@ export const VERTICAL_SET_KEYS = Object.freeze(["vertical", "vertical.crop", "ve export const SIDE_SET_KEYS = Object.freeze(["side", "side.item", "side.post", "side.from", "side.to", "side.place"]); const SET_KEYS = [ ...CLAIM_KNOBS.map((k) => `claim.${k}`), ...MARK_KEYS, ...AUDIO_KNOBS.map((k) => `audio.${k}`), ...BLUR_KNOBS.map((k) => `blur.${k}`), "layout", ...REVIEW_KEYS, - ...FX_KEYS, ...GAP_KEYS, "chat", + ...FX_KEYS, ...GAP_KEYS, "chat", "hideModules", // The vertical format (lane vertical): the clip's 9:16 crop and layout, and its side post. ...VERTICAL_SET_KEYS, ...SIDE_SET_KEYS, ]; export const SET_USAGE = [ - "usage: umtool set <project> <clip> key=value … [--mark <id>] [--json]", + "usage: umtool set <project> <clip> key=value … [--mark <id>] [--take <t>] [--json]", ` keys: ${SET_KEYS.join(" ")}`, " claim.at is a SOURCE second inside the clip's window: the stamp lands and the count steps there", " (read from the last clip carrying the claim); claim.hold s (0.5–10); claim.stamp true|false;", @@ -97,6 +97,10 @@ export const SET_USAGE = [ " chat=on shows the clip's live chat (its video's live_chat.cues.json, for the clip's source span) in a column", " beside the footage; chat=off, or `chat=` (the default), does not. A video with no chat draws nothing and the", " build log says so. The column's look: umtool look <p> chat.position=left (docs/knobs.md \"Live chat\").", + " hideModules=diet,streak hides those modules over this entry's span, each with its own fade (text in the", + " footage no dodge can know of; any entry, a post item too): goals peak promise diet streak; `hideModules=` none.", + " --take <t>: the entry knobs (not claim.* or marks) land in takes/<t>/take.json's patch, an undo point first", + " (`umtool timeline <p> --take <t> undo`); the project's manifest is untouched.", " vertical.crop='[x,y,w,h]' (fractions of the source: the 9:16 box a vertical render cuts; vertical.aspect the", " source's w/h when not 16:9); vertical.layout=full|framed|quote (this clip's layout in a vertical cut).", " side.item=<post item id> | side.post='{\"author\",\"handle\",\"date\",\"text\",…}' -- a post shown BESIDE the", @@ -228,6 +232,11 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso entryPatch[key] = key === "side.item" && value !== null ? String(value) : value; continue; } + if (key === "hideModules") { + // The modules hidden over this entry's span (deck.mjs parseHideModules checks the ids); `hideModules=` none. + entryPatch.hideModules = value === null || value === undefined ? null : value; + continue; + } if (key === "chat") { // The live-chat column beside this clip (report-to-video chat.mjs): on|off|true|false; `chat=` clears it. entryPatch.chat = chatFlag(value); @@ -263,6 +272,10 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso else (group === "claim" ? claim : audio)[k] = value; } if (Object.keys(audio).length) entryPatch.audio = audio; + const takeFlag = flags.get("--take"); + const take = typeof takeFlag === "string" && takeFlag ? takeFlag : null; + if (flags.has("--take") && !take) throw new CliError("--take needs a take id"); + if (take && (markChanges.length || Object.keys(claim).length)) throw new CliError("--take sets a take's entry knobs; claim.* and marks are the project's (set them without --take)"); // `blur.on=` (or false): no blur at all, whatever else was given. if (Object.keys(blur).length) entryPatch.blur = "on" in blur && (blur.on === null || blur.on === false) ? null : blur; const results = {}; @@ -284,8 +297,13 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso notes = editNotes; } if (Object.keys(entryPatch).length) { - const token = await manifestToken(project.dir); - const { result, editNotes } = await withEditNotes(project, () => updateClip(project.dir, clipId, entryPatch, { token, edit: "trim" })); + // A take's entry (--take): through the take's writer (takeEdit.mjs updateTakeClip -- the same rules, an undo + // point of the take's first), never the project's manifest; no edit notes (the patch is not the generated manifest). + const { result, editNotes } = take + ? { result: await (await import("./takeEdit.mjs")).updateTakeClip(project.dir, take, clipId, entryPatch), editNotes: null } + : await withEditNotes(project, async () => updateClip(project.dir, clipId, entryPatch, { token: await manifestToken(project.dir), edit: "trim" })); + if (take) results.take = { id: take, undo: result.revision?.rel ? `takes/${take}/${result.revision.rel}` : null }; + if ("hideModules" in entryPatch) results.hideModules = result.entry.hideModules ?? null; if ("audio" in entryPatch) results.audio = result.entry.audio ?? null; if ("blur" in entryPatch) results.blur = result.entry.blur ?? null; if ("layout" in entryPatch) results.layout = result.entry.layout ?? "clip"; @@ -321,6 +339,8 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso if ("audio" in results) out(`${clipId}: audio ${results.audio ? JSON.stringify(results.audio) : "as recorded"}`); if ("blur" in results) out(`${clipId}: blur ${results.blur ? JSON.stringify(results.blur) : "none (the picture as recorded)"}`); if ("layout" in results) out(`${clipId}: layout ${results.layout}`); + if ("hideModules" in results) out(`${clipId}${results.take ? ` (take ${results.take.id})` : ""}: hideModules ${results.hideModules ? `${results.hideModules.join(", ")} (hidden over its span)` : "none"}`); + if (results.take?.undo) out(` undo point: ${results.take.undo} (umtool timeline ${project.id} --take ${results.take.id} undo)`); if ("chat" in results) out(`${clipId}: chat ${results.chat === true ? "on (its video's live_chat.cues.json beside the footage; the build says if there is none)" : results.chat === false ? "off" : "default (off)"}`); if ("fx" in results) out(`${clipId}: fx ${results.fx ? JSON.stringify(results.fx) : "none"}`); if ("vertical" in results) out(`${clipId}: vertical ${results.vertical ? JSON.stringify(results.vertical) : "the cut's (the centred crop)"}`); diff --git a/umtool/lib/report/knobsCli.test.mjs b/umtool/lib/report/knobsCli.test.mjs @@ -69,6 +69,34 @@ test("umtool set chat=on|off|true|false writes the clip's chat flag; chat= clear assert.deepEqual((await read(dir)).render.chrome.chat, { position: "left", lines: 8 }); }); +test("umtool set hideModules=diet,streak: the modules hidden over an entry's span, any entry; --take writes the take's patch", async () => { + const dir = await project("hide"); + const m = await read(dir); + m.timeline.push({ type: "post", id: "x01", item: "123" }); + await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify(m, null, 2) + "\n"); + const { lines, run } = runner(setCommand); + assert.equal(await run("hide", "c02", "hideModules=streak,diet"), 0); + assert.deepEqual((await read(dir)).timeline[1].hideModules, ["diet", "streak"], "in the modules' order"); + assert.match(lines.at(-1), /hideModules diet, streak \(hidden over its span\)/); + assert.equal(await run("hide", "x01", 'hideModules=["promise"]'), 0, lines.join("\n")); + assert.deepEqual((await read(dir)).timeline[2].hideModules, ["promise"], "a post item too"); + assert.equal(await run("hide", "c02", "hideModules=dial"), 1); + assert.match(lines.at(-1), /dial cannot be hidden per entry/); + assert.equal(await run("hide", "c02", "hideModules="), 0); + assert.equal("hideModules" in (await read(dir)).timeline[1], false); + // --take: the take's patch, an undo point of the take's; the project's manifest untouched. + const { draftTake } = await import("./takeMaker.mjs"); + const { resolveTakeManifest } = await import("./takeManifest.mjs"); + await draftTake(dir, { id: "panel", label: "Panel", patch: {} }); + const before = await readFile(path.join(dir, "video.manifest.json"), "utf8"); + assert.equal(await run("hide", "c02", "hideModules=diet,streak", "--take", "panel"), 0, lines.join("\n")); + assert.match(lines.join("\n"), /c02 \(take panel\): hideModules diet, streak/); + assert.equal(await readFile(path.join(dir, "video.manifest.json"), "utf8"), before); + assert.deepEqual((await resolveTakeManifest(dir, "panel")).manifest.timeline[1].hideModules, ["diet", "streak"]); + assert.equal(await run("hide", "c02", "claim.count=2", "--take", "panel"), 2); + assert.match(lines.at(-1), /--take sets a take's entry knobs/); +}); + test("umtool set: claim and audio knobs through the writers; key= clears; a bad key or value is refused", async () => { const dir = await project("set"); const { lines, run } = runner(setCommand); diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -32,7 +32,7 @@ import { } from "umtool-report-to-video/ledger-totals"; import { isCalendarDate } from "umtool-report-to-video/attribution"; import { - normalizeOnscreen, validateChrome, validateDeckClaims, validateDeckMarkers, validatePosts, validateTeaser, validateTeasers, + normalizeOnscreen, parseHideModules, validateChrome, validateDeckClaims, 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"; @@ -298,6 +298,18 @@ export async function updateClip(dir, clipId, patch, { token = null, edit = "tri export const GAP_PATCH_KEYS = Object.freeze(["gaps", "gapAdd", "gapRemove"]); /** + * Set an entry's `hideModules` (deck.mjs parseHideModules: a list, or "diet,streak"); null, "" or [] removes it. + * @param {Record<string, unknown>} entry + * @param {unknown} value + */ +function applyHideModules(entry, value) { + const { value: ids, error } = parseHideModules(value); + if (error) throw new Error(error); + if (ids) entry.hideModules = ids; + else delete entry.hideModules; +} + +/** * updateClip's rules over a manifest held in memory: the ONE place a clip * patch is checked and applied. updateClip runs it on the project's file * inside its lock; a take's walk (takeEdit.mjs) runs it on the take's @@ -319,6 +331,12 @@ export function patchClipEntry(manifest, clipId, patch, { edit = "trim", now = n const original = patch.layout !== undefined ? (raw ?? JSON.stringify(manifest)) : null; const entry = (manifest.timeline ?? []).find((e) => e.id === clipId); if (!entry) throw new Error(`no timeline entry with id ${clipId}`); + // The modules this entry hides over its span (`hideModules`, deck.mjs entryHides): any entry may carry it -- a + // post item, a still, a clip -- so a patch of it alone is applied here, before the clip-only rules. + if (patch !== RESTORE_PATCH && Object.keys(patch).length && Object.keys(patch).every((k) => k === "hideModules")) { + applyHideModules(entry, patch.hideModules); + return { entry, before: { start: entry.start, end: entry.end } }; + } // `!== "clip"`, not `=== "card"`. The timeline's vocabulary is open -- one // real manifest carries `scroll` and `chart` entries -- and the card-only // check would have let a window be written onto one of those. @@ -727,6 +745,8 @@ export function patchClipEntry(manifest, clipId, patch, { edit = "trim", now = n if (bad.length) throw new Error(`layout: ${bad.join("; ")}`); } + if (patch.hideModules !== undefined) applyHideModules(entry, patch.hideModules); + // The live-chat column beside this clip (chat.mjs): true shows it, false is // the explicit no, null/"" removes the key (the default: off). if (patch.chat !== undefined) { diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs @@ -1444,11 +1444,62 @@ export function deckSchedule({ // measure extras move clear of it (measure-extras.mjs measurePlacements). const covers = postCovers(entries, doc.segments, render, { feed: doc.layout === "feed" }); if (covers.length) doc.covers = covers; + // The entries that hide modules over their span (`hideModules`): text in the footage no dodge can know of. + const hides = entryHides(entries, doc.segments); + if (hides.length) doc.hides = hides; } return doc; } /** + * The modules a timeline entry may hide over its own span (`entry.hideModules`): + * the measure extras, which stand over the footage. The instruments' column and + * the deck never cover footage, so there is nothing to hide them for. + */ +export const HIDEABLE_MODULES = Object.freeze(["goals", "peak", "promise", "diet", "streak"]); + +/** + * An entry's `hideModules` as written: a list of HIDEABLE_MODULES ids, or a + * comma-separated string of them (`umtool set <p> <entry> hideModules=diet,streak`). + * Returns `{ value, error }`: `value` the ids, de-duplicated in HIDEABLE_MODULES + * order (null for none: the key removed), `error` a sentence when one is not a + * module an entry can hide. + * + * @param {unknown} v + * @returns {{ value: string[] | null, error: string | null }} + */ +export function parseHideModules(v) { + if (v === null || v === undefined || v === "" || v === false) return { value: null, error: null }; + const list = Array.isArray(v) ? v : typeof v === "string" ? v.split(",") : null; + if (!list) return { value: null, error: `hideModules is a list of module ids (${HIDEABLE_MODULES.join(", ")}), not ${JSON.stringify(v)}` }; + const ids = list.map((x) => String(x).trim()).filter(Boolean); + const bad = ids.filter((x) => !HIDEABLE_MODULES.includes(x)); + if (bad.length) return { value: null, error: `hideModules: ${bad.join(", ")} cannot be hidden per entry (${HIDEABLE_MODULES.join(", ")})` }; + const value = HIDEABLE_MODULES.filter((x) => ids.includes(x)); + return { value: value.length ? value : null, error: null }; +} + +/** + * The spans over which an entry hides modules: `[{ segment, from, to, modules }]` + * -- `from`/`to` its segment's span in the cut, `modules` its `hideModules` + * (unknown ids dropped). measure-extras.mjs measurePlacements hides each named + * module over the span with its own fade, as it does over a post card. + */ +export function entryHides(entries, segments) { + const byId = new Map((segments ?? []).map((s) => [s.id, s])); + const out = []; + for (const e of entries ?? []) { + if (!e?.hideModules) continue; + const ids = Array.isArray(e.hideModules) ? e.hideModules.filter((x) => HIDEABLE_MODULES.includes(x)) : e.hideModules; + const { value } = parseHideModules(ids); + const seg = byId.get(e.id); + if (!value || !seg || !Number.isFinite(seg.start) || !Number.isFinite(seg.duration)) continue; + out.push({ segment: e.id, from: seg.start, to: Math.round((seg.start + seg.duration) * 1000) / 1000, modules: value }); + } + return out; +} + +/** * The boxes each POST ITEM draws over the footage while it is up, in the * frame: `[{ segment, from, to, rects: [{x, y, width, height}] }]` -- its card, * and its attachments' slot and strip when it has them, as post-item.mjs diff --git a/umtool/report-to-video/measure-extras.mjs b/umtool/report-to-video/measure-extras.mjs @@ -843,6 +843,17 @@ export function measureCovers(schedule, render) { return out.sort((a, b) => a.from - b.from); } +/** `spans` (each `{ from, to, ... }`) with [from, to) cut out of them: a span across it is split in two. */ +function carveSpans(spans, from, to) { + const out = []; + for (const sp of spans) { + if (sp.to <= from || sp.from >= to) { out.push(sp); continue; } + if (sp.from < from) out.push({ ...sp, to: from }); + if (sp.to > to) out.push({ ...sp, from: to }); + } + return out; +} + /** * Every measure module's placement over the cut: `{ [id]: { home, region, * moves: [{ from, to, rect | null, size }] } }` -- `home` where it stands, @@ -943,6 +954,18 @@ export function measurePlacements(schedule, render, { finaleSlot = null } = {}) out.promise.moves.push({ from: finaleSlot.at, to: Number(schedule.total) || fin.to, rect: finaleSlot.rect, size: finaleSlot.size }); } else if (inColumn) out.promise.moves.push({ from: fin.from, to: Number(schedule.total) || fin.to, rect: null, size: 1 }); } + // An entry that hides modules over its span (`hideModules`, deck.mjs entryHides -- text in the footage no + // dodge can know of, rev 9: the refund email in v02): each named module hidden there with its own fade, whatever + // it would otherwise have done in that span. + for (const h of Array.isArray(schedule?.hides) ? schedule.hides : []) { + if (!(Number.isFinite(h?.from) && Number.isFinite(h?.to) && h.to > h.from) || !Array.isArray(h.modules)) continue; + for (const id of h.modules) { + if (!out[id] || !resolveMeasureExtra(id, render)) continue; + out[id].moves = carveSpans(out[id].moves, h.from, h.to); + out[id].moves.push({ from: h.from, to: h.to, rect: null, size: 1 }); + if (id === "promise") out.promise.strips = carveSpans(out.promise.strips, h.from, h.to); + } + } for (const id of MEASURE_EXTRAS) { const p = out[id]; // Two moves that meet, to the same place: one. diff --git a/umtool/report-to-video/measure-extras.test.mjs b/umtool/report-to-video/measure-extras.test.mjs @@ -11,7 +11,7 @@ import { fileURLToPath } from "node:url"; import { goalsHtml, dietHtml, moverCues, moverSteps, peakHtml, promiseHtml, spreadLabels, stampSize, streakHtml } from "./chrome-measure-extras.mjs"; import { cuePageHtml } from "./chrome-cues.mjs"; -import { estimateSchedule, validateChrome } from "./deck.mjs"; +import { entryHides, estimateSchedule, HIDEABLE_MODULES, parseHideModules, validateChrome } from "./deck.mjs"; import { frameKeys } from "./frame-keys.mjs"; import { daysBetween, deadlineDate, dietRuns, dietStates, goalStates, goalText, lostRunsRuns, measureExtraGeometry, measurePlacements, peakStates, pledgeRuns, @@ -175,6 +175,32 @@ test("promise: AS OF follows the playhead's in-record date in the rev9 order -- assert.deepEqual([states.at(-1).rows[0].to, states.at(-1).asOf], ["2026-11-06", true], "the render date from the finale on"); }); +test("hideModules: an entry hides the named extras over its span, with their own fade, whatever else they did there", () => { + // The entry's knob, read into the schedule (deck.mjs entryHides): its segment's span, the ids it names. + const segs = [{ id: "v01", start: 690, duration: 10 }, { id: "v02", start: 699.6, duration: 12.4 }]; + assert.deepEqual(entryHides([{ id: "v01" }, { id: "v02", hideModules: ["streak", "diet", "nope"] }], segs), [{ segment: "v02", from: 699.6, to: 712, modules: ["diet", "streak"] }]); + assert.deepEqual(parseHideModules("streak, diet"), { value: ["diet", "streak"], error: null }); + assert.match(parseHideModules("dial").error, /dial cannot be hidden per entry \(goals, peak, promise, diet, streak\)/); + assert.deepEqual(parseHideModules(""), { value: null, error: null }); + assert.deepEqual([...HIDEABLE_MODULES], ["goals", "peak", "promise", "diet", "streak"]); + // Over the span: hidden (rect null), each module's moves; a dodge across it is cut around it. + const r = withDeck({ diet: {}, streak: {} }); + // A card on the diet badge's home: it dodges to a slot over the card's span. + const card = { segment: "p1", from: 715, to: 725, rects: [measureExtraGeometry("diet", r)] }; + const plain = measurePlacements(schedule(MEASURE, { covers: [card] }), r); + const hid = measurePlacements(schedule(MEASURE, { covers: [card], hides: [{ segment: "v02", from: 718, to: 721, modules: ["diet"] }] }), r); + assert.ok(plain.diet.moves.some((m) => m.from === 715 && m.to === 725 && m.rect), "the card's own move: a dodge"); + const at = (moves, t) => moves.filter((m) => m.from <= t && t < m.to); + assert.deepEqual(at(hid.diet.moves, 719).map((m) => m.rect), [null], "hidden over v02, one move"); + assert.ok(hid.diet.moves.every((m) => !(m.from < 721 && m.to > 718) || (m.from === 718 && m.to === 721 && m.rect === null)), "nothing else in the span"); + assert.ok(at(hid.diet.moves, 716)[0].rect && at(hid.diet.moves, 723)[0].rect, "the dodge on either side of it"); + assert.deepEqual(hid.streak.moves, plain.streak.moves, "a module it does not name: as it was"); + // A clean span: just the hide. + const clean = measurePlacements(schedule(MEASURE, { hides: [{ segment: "v02", from: 600, to: 610, modules: ["diet", "streak"] }] }), r); + assert.deepEqual(clean.diet.moves, [{ from: 600, to: 610, rect: null, size: 1 }]); + assert.deepEqual(clean.streak.moves, [{ from: 600, to: 610, rect: null, size: 1 }]); +}); + test("diet: a stamp per change of regime or number, words alone not slammed, a null after one is No diet", () => { const states = dietStates(schedule(), RENDER); assert.equal(states[0].diet.label, "Some diet"); diff --git a/umtool/report-to-video/modules/measure-extras-module.mjs b/umtool/report-to-video/modules/measure-extras-module.mjs @@ -57,6 +57,7 @@ export function measureExtraModule(spec) { rows: [ ...spec.docs.rows, [`\`deck.${id}.onPosts\`, \`.onChapters\``, "`dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it", `\`umtool look <p> deck.${id}.onPosts=hide\``], + ["a timeline entry's `hideModules`", `\`["${id}", …]\` on an entry hides it over that entry's span, with its own fade, whatever it would otherwise do there (text in the footage no dodge can know of) · any entry, a post item too`, `\`umtool set <p> <entry> hideModules=${id}\` (\`--take <t>\` for a take)`], ], }, region: id,