Archilyzer · Source

archilyzer

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

commit e512121b0c47b0bb4e984193299b4712559c2d84
parent e7def98c5e27f73b0aac60ef61874a3829633987
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri,  6 Nov 2026 02:26:22 -0500

umtool: the measure extras beside the column -- the promise clock in the trail's slot, apart by default, never into the face cam

rev9-panel's list (6 Nov):
- K. The promise clock stays visible through the post items: `promise.slot`
  "auto" (default) puts it in the instruments' column, in the trail's slot,
  in a compact form (600×138: "SCALE VIDEO · OFFERED 23 OCT · PAID 23 OCT BY
  @MadamSavvy" / "N DAYS · as of … · NONE POSTED | REFUNDED · NO VIDEO" /
  the latest words on one line), the trail yielding; nothing in the footage
  moves it. Without the column ("footage"), while a post item is up it
  becomes a one-line strip in the post box's top margin over the card
  (promiseStripRect: the post's pad). In the finale it waits out the dial's
  finale and takes its lower column at the handoff (promiseFinaleSlot),
  clear of the rail.
- F. Beside the column (the 1248×702 clip box) the extras take anchors that
  keep them apart (COLUMN_POSITIONS: the diet badge top-right, the streak
  bottom-left, the goals bottom-right) unless a position is named; extras
  whose homes still overlap move clear of each other while both are up.
- G. With the dial on, the moving start is off unless named (its count is on
  the dial's ghost).
- A dodge never moves into an anchor the module `avoid`s -- default
  ["top-left"], the streams' face cam (settable, `avoid: []`).
- rev9-panel.test.mjs: A–K and the wedge, each a test; knobs.md regenerated.

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

Diffstat:
Mumtool/docs/knobs.md | 8++++----
Mumtool/report-to-video/chrome-measure-extras.mjs | 118+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
Mumtool/report-to-video/measure-extras.mjs | 75+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
Mumtool/report-to-video/measure-extras.test.mjs | 39++++++++++++++++++++++++++++++---------
Mumtool/report-to-video/modules/measure-extras-module.mjs | 5+++--
Mumtool/report-to-video/modules/measure-extras-settings.mjs | 29++++++++++++++++++++++++++---
Aumtool/report-to-video/rev9-panel.test.mjs | 196+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 438 insertions(+), 32 deletions(-)

diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -1802,7 +1802,7 @@ A bathroom-scale face at the top of the instruments' column (the right of the fr | Knob | Range · default | From a terminal | |---|---|---| -| `deck.dial` | `true` · an object of the knobs below · absent or `false` off | `umtool look <p> deck.dial=true` | +| `deck.dial` | `true` · an object of the knobs below · `false` off · absent: ON when the cut draws a measure (`deck.measure` set), else off | `umtool look <p> deck.dial=false` | | `deck.dial.mark` | a weight, or `null` · default `300` (its tick and label in the accent) | `umtool look <p> deck.dial.mark=300` | | `deck.dial.ghosts`, `.goal` | bool · default `true` each | `umtool look <p> deck.dial.ghosts=false` | | `deck.dial.needle` | a #hex · default `#ff5a4e` | `umtool look <p> deck.dial.needle='"#ff5a4e"'` | @@ -1812,7 +1812,7 @@ A bathroom-scale face at the top of the instruments' column (the right of the fr | `deck.dial.size` | 200–540 px at 1920 wide · default `340` (the corner dial only) | `umtool look <p> deck.dial.size=300` | | `deck.dial.corner` | `bottom-right` `bottom-left` `top-right` `top-left` · default `bottom-right` (the corner only): the dial in that corner, the odometer and the trail up the same side. The measure extras stand at their own anchors in the footage (goals bottom-right, peak top-right, promise top-centre, diet bottom-left, streak bottom-centre): a corner instrument over one that is on is REFUSED by the build, naming it -- move one (`deck.goals.position`, …) or the corner; `top-left` is clear of all five | `umtool look <p> deck.dial.corner=top-left` | | `deck.dial.motion` | `spring` `ease` · default `spring`. A VARIANT: the needle's `back.out` overshoot and settle, or a plain `power2.inOut` (the finale's drop too) | `umtool look <p> deck.dial.motion=ease` | -| `deck.dial.finaleEnd` | `odometer` `promise` · default `odometer`. A VARIANT: `promise` hands the finale's last beat to the promise clock (module `promise`) -- the instruments fade out once NET has held (`dialFinaleHandoff`); with no promise module on the cut it ends on the odometer | `umtool look <p> deck.dial.finaleEnd=promise` | +| `deck.dial.finaleEnd` | `auto` `odometer` `promise` · default `auto` (`promise` when a promise is on camera, else `odometer`): `promise` hands the finale's last beat to the promise clock (module `promise`) -- the instruments fade out once NET has held (`dialFinaleHandoff`) and the clock takes their place in the finale's lower column, clear of the rail; with no promise module on the cut it ends on the odometer | `umtool look <p> deck.dial.finaleEnd=promise` | ### Lost odometer @@ -1820,7 +1820,7 @@ Under the dial: the measure's `state.lost.total` (the highest real-time loss cla | Knob | Range · default | From a terminal | |---|---|---| -| `deck.odometer` | `true` · an object of the knobs below · absent or `false` off | `umtool look <p> deck.odometer=true` | +| `deck.odometer` | `true` · an object of the knobs below · `false` off · absent: ON when the cut draws a measure (`deck.measure` set), else off | `umtool look <p> deck.odometer=false` | | `deck.odometer.label` | words over the wheels, ≤ 40 · default `POUNDS HE SAYS HE'S LOST` | `umtool look <p> deck.odometer.label='"…"'` | | `deck.odometer.net`, `.runs` | bool · default `true` each | `umtool look <p> deck.odometer.net=false` | @@ -1830,7 +1830,7 @@ At the foot of the instruments' column: every STATED weight the cut shows, place | Knob | Range · default | From a terminal | |---|---|---| -| `deck.trail` | `true` · an object of the knobs below · absent or `false` off | `umtool look <p> deck.trail=true` | +| `deck.trail` | `true` · an object of the knobs below · `false` off · absent: ON when the cut draws a measure (`deck.measure` set), else off | `umtool look <p> deck.trail=false` | | `deck.trail.mark` | a weight, or `null` · default `300` | `umtool look <p> deck.trail.mark=300` | | `deck.trail.count` | bool · default `true` | `umtool look <p> deck.trail.count=false` | | `deck.trail.label` | its title, ≤ 40 · default `WHAT HE SAYS HE WEIGHS, BY DATE` | `umtool look <p> deck.trail.label='"…"'` | diff --git a/umtool/report-to-video/chrome-measure-extras.mjs b/umtool/report-to-video/chrome-measure-extras.mjs @@ -15,10 +15,11 @@ import { rgba } from "./chrome-deck.mjs"; import { compileCues, cuePageHtml, esc, INSTANT, joinSpans, r4, spanEvents } from "./chrome-cues.mjs"; import { - daysBetween, daysLeftText, daysText, dietStates, goalStates, measureExtraGeometry, measureOf, MEASURE_BOXES, + daysBetween, daysLeftText, daysText, dietStates, goalStates, measureBox, measureExtraGeometry, measureOf, MEASURE_BOXES, promiseStripRect, MEASURE_DODGE_MOVE, measurePlacements, monthYear, peakStates, promiseStates, shortDate, streakStates, upSpans, weightText, } from "./measure-extras.mjs"; import { MEASURE_RED, resolveMeasureExtra } from "./modules/measure-extras-settings.mjs"; +import { dialFinaleGeometry, dialFinaleHandoff } from "./chrome-instruments.mjs"; /** How each module's panel comes in and goes out, s. */ export const MEASURE_FADE = Object.freeze({ in: 0.35, out: 0.4 }); @@ -28,7 +29,7 @@ const feedOf = (schedule) => schedule?.layout === "feed"; /** The page's frame: its region, its pixel scale against its design box, its fps. */ function frameOf(id, schedule, render) { const geo = measureExtraGeometry(id, render, { feed: feedOf(schedule) }); - const k = geo.width / MEASURE_BOXES[id].width; + const k = geo.width / measureBox(id, render).width; const px = (v) => Math.max(1, Math.round(v * k)); return { geo, k, px, fps: schedule.fps ?? render.fps ?? 30 }; } @@ -123,15 +124,49 @@ export function moverCues(place) { * A module's page: its box drawn in its region (its home, and every slot it * moves clear to), inside the mover `mv`. */ -const page = (id, schedule, opts, { fps }, css, body, init, cues, ids, render) => { - const place = measurePlacements(schedule, render)[id]; +/** + * Where the promise clock goes in the finale: the dial's finale hands its lower + * column to it (instruments.mjs `finaleEnd`, default "auto": when a promise is + * on camera) -- `{ at, rect, size }`, its box fitted into that column, or null + * (no dial finale, or no handoff). + */ +export function promiseFinaleSlot(schedule, render) { + if (!schedule?.finale || !resolveMeasureExtra("promise", render)) return null; + let at = null; + let geo = null; + try { + at = dialFinaleHandoff(schedule, render); + geo = at !== null ? dialFinaleGeometry(schedule, render) : null; + } catch { + return null; + } + if (at === null || !geo) return null; + const box = measureBox("promise", render); + const k0 = (render?.width ?? 1920) / 1920; + const size = Math.min(1.6, geo.width / (box.width * k0), geo.height / (box.height * k0)); + const home = measureExtraGeometry("promise", render); + const w = Math.round(home.width * size); + const h = Math.round(home.height * size); + return { at, size: r4(size), rect: { x: geo.x + Math.round((geo.width - w) / 2), y: geo.y + Math.round((geo.height - h) / 2), width: w, height: h } }; +} + +/** Every module's placement as its page and its region read it (the promise clock's finale slot included). */ +export const placementsFor = (schedule, render) => measurePlacements(schedule, render, { finaleSlot: promiseFinaleSlot(schedule, render) }); + +/** + * A module's page: its box drawn in its region (its home, and every slot it + * moves clear to), inside the mover `mv`; `outside` is drawn beside the mover + * (the promise clock's strip), its cues in `extra`. + */ +const page = (id, schedule, opts, { fps }, css, body, init, cues, ids, render, { outside = "", extra = null } = {}) => { + const place = placementsFor(schedule, render)[id]; const { home, region } = place; const mover = moverCues(place); return cuePageHtml({ id, W: region.width, H: region.height, fps, fonts: opts.fonts, gsapSrc: opts.gsap, css: `${displayFace(opts.fonts)}\n #mv { position: absolute; left: ${home.x - region.x}px; top: ${home.y - region.y}px; width: ${home.width}px; height: ${home.height}px; transform-origin: 0 0; }\n ${css}`, - body: `<div id="mv" data-k="mv">\n ${body}\n </div>`, - init: { ...init, ...mover.init }, cues: [...cues, ...mover.cues], + body: `<div id="mv" data-k="mv">\n ${body}\n </div>${outside}`, + init: { ...init, ...mover.init, ...(extra?.init ?? {}) }, cues: [...cues, ...mover.cues, ...(extra?.cues ?? [])], whole: { total: schedule.total, from: opts.from, duration: opts.duration, ids }, primeWindow: true, }); }; @@ -366,6 +401,39 @@ export function peakHtml(schedule, render, opts = {}) { /** A speaker's handle as the clock writes it: `promise.speakers[k].handle`, the manifest's postAvatars key, else the key. */ const handleOf = (speaker, cfg, opts) => String(cfg.speakers?.[speaker]?.handle ?? opts.handles?.[speaker] ?? speaker ?? "").replace(/^@/, ""); +/** + * The promise clock's STRIP (footage slot): while a post item is up, one line + * in the post box's top margin over the card -- "SCALE VIDEO OFFERED 23 OCT · + * PAID 23 OCT BY @MADAMSAVVY · 14 DAYS · NONE POSTED" -- each state's its own + * line `t<j>` (an item), shown with its state. Returns `{ html, cues, rect }`. + */ +function promiseStrip(states, place, cfg, render, opts, items) { + const rect = promiseStripRect(render); + const reg = place.region; + const ev = []; + const init = { ps: { autoAlpha: 0 } }; + for (const sp of place.strips) ev.push(...spanEvents("ps", sp.from, sp.to, { fadeIn: 0.3, fadeOut: 0.3 })); + const lines = states.map((st, j) => { + const k = `t${j}`; + init[k] = { autoAlpha: 0 }; + ev.push({ k, at: st.at, dur: INSTANT, to: { autoAlpha: 1 }, ease: "none" }); + if (states[j + 1]) ev.push({ k, at: states[j + 1].at, dur: INSTANT, to: { autoAlpha: 0 }, ease: "none" }); + const r = st.rows[0]; + const days = r.days === 0 ? "today" : `${r.days} day${r.days === 1 ? "" : "s"}`; + const claim = r.claim ? `<span class="sp">·</span><span>${esc(cfg.claimVerb)} ${esc(shortDate(r.claim.paidOn ?? r.claim.date))} by @${esc(handleOf(r.claim.speaker, cfg, opts))}</span>` : ""; + const o = r.outcome; + const status = o && o.kind !== "kept" + ? `<span class="no">${o.kind === "refunded" ? "refunded" : "withdrawn"} · no video</span>` + : r.kept ? `<span class="ok">${esc(cfg.kept)}</span>` : `<span class="no">${esc(cfg.broken)}</span>`; + const html = `<div class="sl" data-k="${k}"><span>${esc(r.what)} ${esc(cfg.verb)} ${esc(shortDate(r.said))}</span>${claim}<span class="sp">·</span><b>${esc(days)}</b><span class="sp">·</span>${status}</div>`; + items.push({ key: k, gate: [k, "autoAlpha"], html }); + return html; + }); + const compiled = compileCues(init, ev); + const html = `<div id="ps" data-k="ps" style="left:${rect.x - reg.x}px; top:${rect.y - reg.y}px; width:${rect.width}px; height:${rect.height}px">${lines.join("")}</div>`; + return { html, cues: compiled, rect }; +} + /** The promise clock's page: `{ html, items }`. `opts.avatars` = `{ <speaker>: "assets/…" }`, `opts.handles` = `{ <speaker>: handle }`. */ export function promiseHtml(schedule, render, opts = {}) { const cfg = resolveMeasureExtra("promise", render); @@ -381,6 +449,11 @@ export function promiseHtml(schedule, render, opts = {}) { const bottom = cfg.position.startsWith("bottom") && !(Number.isFinite(cfg.x) && Number.isFinite(cfg.y)); const spans = upSpans(states.map((s) => s.at), cfg, schedule); const items = []; + // In the instruments' column the compact form; in the footage box a strip over each post item's card. + const compact = cfg.slot === "column"; + const place = placementsFor(schedule, render).promise; + const sk = (render?.width ?? 1920) / 1920; + const strip = !compact && place.strips.length ? promiseStrip(states, place, cfg, render, opts, items) : null; const { init, cues } = stateCues(states, spans, { own: (st, j, init) => { const ev = []; @@ -439,6 +512,14 @@ export function promiseHtml(schedule, render, opts = {}) { const who = hers ? `<b class="who" style="color:${esc(ink)}">@${esc(handleOf(r.word.speaker, cfg, opts))}</b>${r.word.outcome ? " reads" : ""} ` : ""; q = `<div class="ck" data-k="${k}q"><div class="cf" data-k="${k}f" style="background:${rgba(ink, 0.5)}"></div>${who}<span class="qm" style="color:${esc(ink)}">“</span>${esc(r.word.text.replace(/^["“”]+|["“”]+$/g, ""))}<span class="qm" style="color:${esc(ink)}">”</span>${r.word.date ? ` <span class="cd">· ${esc(shortDate(r.word.date))}</span>` : ""}</div>`; } else q = `<div class="ck none">no word on it since</div>`; + if (compact) { + // The column's compact form (600×138): the promise and her claim on one line, the days and the status on + // the next, the latest words under them on one. + const cl = r.claim + ? ` · <span class="clc" data-k="${k}c">${esc(cfg.claimVerb)}${(r.claim.paidOn ?? r.claim.date) ? ` ${esc(shortDate(r.claim.paidOn ?? r.claim.date))}` : ""} by <b style="color:${esc(inkOf(r.claim.speaker))}">@${esc(handleOf(r.claim.speaker, cfg, opts))}</b></span>` + : ""; + return `<div class="row"><div class="hd">${esc(r.what)} · ${esc(cfg.verb)} ${esc(shortDate(r.said))}${cl}</div><div class="mid"><div class="dy" data-k="${k}d">${esc(days)}</div><div class="to">as of ${esc(shortDate(r.to))}</div>${status}</div>${q}</div>`; + } return `<div class="row"><div class="hd">${esc(r.what)} ${esc(cfg.verb)} ${esc(shortDate(r.said))}</div>${claim}<div class="mid"><div class="dy" data-k="${k}d">${esc(days)}</div><div class="to">as of<br>${esc(shortDate(r.to))}</div>${status}</div>${q}</div>`; }).join(""); const r0 = st.rows[0]; @@ -447,6 +528,19 @@ export function promiseHtml(schedule, render, opts = {}) { items.push({ key: `s${j}`, gate: [`s${j}`, "autoAlpha"], html }); return html; }); + const compactCss = !compact ? "" : ` + .st { top: 0; bottom: 0; padding: ${px(10)}px ${px(16)}px ${px(8)}px ${px(16)}px; border-left-width: ${px(5)}px; } + .row { gap: ${px(2)}px; } + .hd { font-size: ${px(16)}px; line-height: ${px(20)}px; letter-spacing: 0.08em; } + .hd b { letter-spacing: 0.02em; text-transform: none; } + .mid { height: ${px(54)}px; gap: ${px(12)}px; } + .dy { font-size: ${px(50)}px; line-height: ${px(54)}px; } + .to { flex: 1 1 auto; align-self: center; padding-bottom: 0; font-size: ${px(14)}px; } + .pill { height: ${px(32)}px; line-height: ${px(32)}px; font-size: ${px(17)}px; padding: 0 ${px(12)}px; } + .stamp { padding: ${px(1)}px ${px(10)}px ${px(2)}px; border-width: ${px(3)}px; transform: rotate(-3deg); } + .sw { font-size: ${px(24)}px; line-height: ${px(26)}px; } + .ss { font-size: ${px(12)}px; line-height: ${px(14)}px; } + .ck { font-size: ${px(16)}px; line-height: ${px(21)}px; -webkit-line-clamp: 1; display: block; white-space: nowrap; text-overflow: ellipsis; }`; const css = ` #pn { position: absolute; inset: 0; visibility: hidden; opacity: 0; } /* The card is as tall as what it says, hung from its anchor's edge. */ @@ -484,11 +578,19 @@ export function promiseHtml(schedule, render, opts = {}) { .ck { isolation: isolate; } .who { font-family: 'DeckSansBold', sans-serif; } .qm { font-family: 'DeckSansBold', sans-serif; } - .cd { color: ${pal.muted}; white-space: nowrap; }`; + .cd { color: ${pal.muted}; white-space: nowrap; }${compactCss} + #ps { position: absolute; visibility: hidden; opacity: 0; } + .sl { position: absolute; inset: 0; visibility: hidden; opacity: 0; display: flex; align-items: center; justify-content: center; + gap: ${Math.round(sk * 10)}px; white-space: nowrap; overflow: hidden; font-family: 'DeckSansBold', sans-serif; + font-size: ${Math.round(strip ? strip.rect.height * 0.62 : 12)}px; letter-spacing: 0.08em; text-transform: uppercase; color: ${pal.muted}; } + .sl b { color: ${pal.fg}; font-family: ${DISPLAY}; font-weight: 400; letter-spacing: 0.04em; } + .sl .no { color: ${red}; } + .sl .ok { color: ${green}; } + .sl .sp { color: ${pal.muted}; opacity: 0.6; }`; const body = `<div id="pn" data-k="pn"> ${blocks.join("\n ")} </div>`; - return { html: page("promise", schedule, opts, F, css, body, init, cues, states.map((_, j) => `s${j}`), render), items }; + return { html: page("promise", schedule, opts, F, css, body, init, cues, states.map((_, j) => `s${j}`), render, strip ? { outside: strip.html, extra: strip.cues } : {}), items }; } // --------------------------------------------------------------------------- diff --git a/umtool/report-to-video/measure-extras.mjs b/umtool/report-to-video/measure-extras.mjs @@ -25,7 +25,7 @@ // - DIET: the state's diet, re-stamped at each change of regime or diet // number; a null diet after one is "NO DIET" (the producer has applied the // off-scope rule: this only draws state.diet). -import { deckGeometry, feedGeometry } from "./deck.mjs"; +import { deckGeometry, feedGeometry, instrumentsGeometry } from "./deck.mjs"; import { chapterCover, chapterWindows } from "./chrome-story.mjs"; import { MEASURE_EXTRAS, MEASURE_POSITIONS, resolveMeasureExtra } from "./modules/measure-extras-settings.mjs"; @@ -664,8 +664,39 @@ export const MEASURE_BOXES = Object.freeze({ promise: Object.freeze({ width: 640, height: 260 }), diet: Object.freeze({ width: 440, height: 200 }), streak: Object.freeze({ width: 620, height: 150 }), + // The promise clock in the instruments' column (`promise.slot`): the trail's slot, its compact form. + promiseColumn: Object.freeze({ width: 600, height: 138 }), }); +/** A module's design box: the promise clock's compact one in the column. */ +export function measureBox(id, render) { + if (id === "promise" && resolveMeasureExtra("promise", render)?.slot === "column") return MEASURE_BOXES.promiseColumn; + return MEASURE_BOXES[id]; +} + +/** + * The promise clock's slot in the instruments' column: the trail's (it yields + * while the clock is up), else the column's foot as tall as the trail would be. + */ +export function promiseColumnRect(render) { + const g = instrumentsGeometry(render); + if (g.trail) return { ...g.trail }; + const k = (render?.width ?? 1920) / 1920; + const h = Math.round(138 * k); + return { x: g.column.x, y: g.column.y + g.column.height - h, width: g.column.width, height: h }; +} + +/** + * The strip a promise clock in the FOOTAGE box draws while a post item is up: + * one line in the post box's top margin, over the card (the post's pad, as + * postLayout lays it: 36 design px of the box's height). + */ +export function promiseStripRect(render, { feed = false } = {}) { + const f = feed ? feedGeometry(render).footage : deckGeometry(render).footage; + const pad = Math.round(36 * (f.height / 1080)); + return { x: f.x + pad, y: f.y + 2, width: f.width - 2 * pad, height: Math.max(18, pad - 4) }; +} + /** * A module's region in the frame: its box (MEASURE_BOXES × `scale`, scaled * with the frame) at its anchor in the footage box (the feed's for a feed @@ -676,6 +707,7 @@ export const MEASURE_BOXES = Object.freeze({ */ export function measureExtraGeometry(id, render, { feed = false } = {}) { const cfg = resolveMeasureExtra(id, render) ?? resolveMeasureExtra(id, { chrome: { deck: {} } }); + if (id === "promise" && cfg.slot === "column") return promiseColumnRect(render); const g = deckGeometry(render); const f = feed ? feedGeometry(render).footage : g.footage; const k = (g.W / 1920) * (cfg.scale ?? 1); @@ -786,7 +818,7 @@ export function measureCovers(schedule, render) { * (`rect` null), `region` the box its frames are drawn in (home and every * slot it moves to). A module with nothing to move clear of: its home alone. */ -export function measurePlacements(schedule, render) { +export function measurePlacements(schedule, render, { finaleSlot = null } = {}) { const feed = schedule?.layout === "feed"; const covers = schedule ? measureCovers(schedule, render) : []; const out = {}; @@ -794,6 +826,21 @@ export function measurePlacements(schedule, render) { const home = measureExtraGeometry(id, render, { feed }); out[id] = { home, region: home, moves: [], up: covers.length && schedule && resolveMeasureExtra(id, render) ? upOf(id, schedule, render) : [] }; } + // THE PROMISE CLOCK stays on screen through the post items (rev 9, 6 Nov): in + // the instruments' column it stands in the trail's slot and nothing in the + // footage moves it; in the footage box, while a post item is up, it gives way + // to a one-line strip in the post's top margin (`strips`, promiseStripRect). + const pcfg = resolveMeasureExtra("promise", render); + const inColumn = pcfg?.slot === "column"; + out.promise.strips = []; + if (pcfg && !inColumn && schedule) { + const up = out.promise.up.length ? out.promise.up : upOf("promise", schedule, render); + for (const c of covers) { + if (c.kind !== "post" || pcfg.onPosts === "show" || !overlapsSpan(up, c.from, c.to)) continue; + out.promise.moves.push({ from: c.from, to: c.to, rect: null, size: 1 }); + if (pcfg.onPosts === "dodge") out.promise.strips.push({ from: c.from, to: c.to }); + } + } // Two extras whose homes overlap (the clip box is smaller beside the // instruments' column) while both are up: the later in DODGE_ORDER moves // clear of the earlier, as of a cover of its own. @@ -802,6 +849,7 @@ export function measurePlacements(schedule, render) { DODGE_ORDER.forEach((a, i) => { for (const b of DODGE_ORDER.slice(i + 1)) { if (!resolveMeasureExtra(a, render) || !resolveMeasureExtra(b, render) || !intersects(out[a].home, out[b].home)) continue; + if ((a === "promise" || b === "promise") && inColumn) continue; for (const sa of out[a].up) for (const sb of out[b].up) { const from = Math.max(sa.in, sb.in); const to = Math.min(sa.out, sb.out); @@ -813,7 +861,10 @@ export function measurePlacements(schedule, render) { } for (const c of covers) { const hit = (r) => c.rects.some((b) => intersects(r, b)); - const active = DODGE_ORDER.filter((id) => resolveMeasureExtra(id, render) && overlapsSpan(out[id].up, c.from, c.to) && (!c.only || c.only === id)); + // (The promise clock is not moved by a post card here: in the column nothing in the footage meets it, and in + // the footage box it becomes the strip above.) + const skip = (id) => id === "promise" && (inColumn || c.kind === "post"); + const active = DODGE_ORDER.filter((id) => !skip(id) && resolveMeasureExtra(id, render) && overlapsSpan(out[id].up, c.from, c.to) && (!c.only || c.only === id)); // The modules that stay where they are take their homes first. const taken = []; const toMove = []; @@ -825,7 +876,7 @@ export function measurePlacements(schedule, render) { } // Every other extra up in the span keeps its place: no slot onto it. for (const id of DODGE_ORDER) { - if (active.includes(id) || !resolveMeasureExtra(id, render) || !overlapsSpan(out[id].up, c.from, c.to)) continue; + if (active.includes(id) || (id === "promise" && inColumn) || !resolveMeasureExtra(id, render) || !overlapsSpan(out[id].up, c.from, c.to)) continue; taken.push(out[id].home); } const footage = feed ? feedGeometry(render).footage : deckGeometry(render).footage; @@ -833,7 +884,9 @@ export function measurePlacements(schedule, render) { let move = null; if (mode === "dodge") { const pinned = Number.isFinite(cfg.x) && Number.isFinite(cfg.y); - const anchors = anchorsFor(pinned ? "top-left" : cfg.position); + // Never into an anchor the module avoids (`avoid`, default the top-left: the streams' face cam). + const avoid = Array.isArray(cfg.avoid) ? cfg.avoid : []; + const anchors = anchorsFor(pinned ? "top-left" : cfg.position).filter((a) => !avoid.includes(a) || a === cfg.position); search: for (const size of MEASURE_DODGE_SCALES) { for (const a of anchors) { const r = anchorRect(id, render, a, size, { feed }); @@ -848,6 +901,16 @@ export function measurePlacements(schedule, render) { out[id].moves.push(move); } } + // THE FINALE: the promise clock waits out the dial's finale and takes its place at the handoff + // (`finaleSlot`: chrome-measure-extras.mjs promiseFinaleSlot -- the finale's lower column, clear of the rail); + // in the column with no such slot it is hidden over the finale (the column is under the finale's page). + const fin = schedule?.finale && Number.isFinite(schedule.finale.from) ? schedule.finale : null; + if (pcfg && fin) { + if (finaleSlot) { + out.promise.moves.push({ from: fin.from, to: finaleSlot.at, rect: null, size: 1 }); + 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 }); + } for (const id of MEASURE_EXTRAS) { const p = out[id]; // Two moves that meet, to the same place: one. @@ -859,7 +922,7 @@ export function measurePlacements(schedule, render) { else merged.push({ ...m }); } p.moves = merged; - const rects = [p.home, ...merged.map((m) => m.rect).filter(Boolean)]; + const rects = [p.home, ...merged.map((m) => m.rect).filter(Boolean), ...(p.strips?.length ? [promiseStripRect(render, { feed })] : [])]; const x0 = Math.min(...rects.map((r) => r.x)); const y0 = Math.min(...rects.map((r) => r.y)); const x1 = Math.max(...rects.map((r) => r.x + r.width)); diff --git a/umtool/report-to-video/measure-extras.test.mjs b/umtool/report-to-video/measure-extras.test.mjs @@ -347,8 +347,16 @@ test("measurePlacements: over a post card a module moves to a free slot (a size const chap = withDeck({}); chap.chrome = { ...chap.chrome, chapter: { style: "lower", seconds: 3, list: [{ at: "a", title: "Part one" }] } }; const cp = measurePlacements(schedule(MEASURE, { segments: [{ id: "a", start: 700, duration: 40, end: 740 }] }), chap); - const band = cp.diet.moves.find((m) => m.from === 700); + const band = cp.goals.moves.find((m) => m.from === 700); assert.ok(band?.rect && band.rect.y + band.rect.height <= f.y + f.height - Math.round(220), JSON.stringify(band)); + // Never into the top-left (the face cam) by default: the diet badge, with every other slot taken, hides. + const d2 = cp.diet.moves.find((m) => m.from === 700); + assert.ok(!d2.rect || d2.rect.x > f.x + f.width / 3, JSON.stringify(d2)); + // `avoid: []` lets it go there. + const free2 = withDeck({ diet: { avoid: [] } }); + free2.chrome = { ...free2.chrome, chapter: chap.chrome.chapter }; + const d3 = measurePlacements(schedule(MEASURE, { segments: [{ id: "a", start: 700, duration: 40, end: 740 }] }), free2).diet.moves.find((m) => m.from === 700); + assert.deepEqual([d3.rect?.x, d3.rect?.y], [f.x + 24, f.y + 24], "top-left when allowed"); // Nothing to move clear of: home alone. assert.deepEqual(measurePlacements(schedule(), RENDER).diet.region, measureExtraGeometry("diet", RENDER)); }); @@ -366,17 +374,30 @@ test("moverSteps: overlapping moves (two post items crossfading, a band inside a assert.deepEqual(cues.find((c) => c.to.x === 10).to, { x: 10, y: 10, scale: 0.6 }); }); -test("measurePlacements beside the instruments' column (the clip box 1248×702): extras whose homes overlap move clear of each other while both are up", () => { +test("beside the instruments' column (the clip box 1248×702): the extras' own anchors keep them apart; the peak is off (the dial's ghosts carry it)", async () => { const r = withDeck({ dial: true }); - const p = measurePlacements(schedule(), r); const homes = Object.fromEntries(IDS.map((id) => [id, measureExtraGeometry(id, r)])); const box = { x: 24, y: 94, width: 1248, height: 702 }; - for (const id of IDS) assert.ok(homes[id].x >= box.x && homes[id].x + homes[id].width <= box.x + box.width, `${id} inside the clip box`); - // diet and streak overlap at home: the streak (later in the order) moves, the diet stays. + const hit = (a, b) => a.x < b.x + b.width && b.x < a.x + a.width && a.y < b.y + b.height && b.y < a.y + a.height; + for (const id of IDS.filter((x) => x !== "promise")) assert.ok(homes[id].x >= box.x && homes[id].x + homes[id].width <= box.x + box.width, `${id} inside the clip box`); + // The promise clock stands in the trail's slot of the column. + const { instrumentsGeometry } = await import("./deck.mjs"); + assert.deepEqual(measureExtraGeometry("promise", withDeck({ dial: true, trail: true })), instrumentsGeometry(withDeck({ dial: true, trail: true })).trail); + // With no trail: the column's foot, as tall as the trail would be. + assert.deepEqual(homes.promise, { x: 1296, y: 728, width: 600, height: 138 }); + assert.equal(hit(homes.diet, homes.streak), false, "the diet badge never on the streak strip"); + assert.equal(hit(homes.diet, homes.goals), false); + assert.equal(hit(homes.streak, homes.goals), false); + assert.equal(resolveMeasureExtra("diet", r).position, "top-right"); + assert.equal(resolveMeasureExtra("peak", r), null, "the moving start is off with the dial on"); + assert.equal(resolveMeasureExtra("peak", withDeck({ dial: true, peak: true })).position, "top-center", "named, it is on"); + assert.equal(resolveMeasureExtra("diet", withDeck({ dial: true, diet: { position: "bottom-left" } })).position, "bottom-left", "a named anchor wins"); + assert.equal(resolveMeasureExtra("promise", r).slot, "column"); + assert.equal(resolveMeasureExtra("promise", RENDER).slot, "footage"); + // Extras whose homes still overlap (named onto one another) move clear while both are up. + const both = withDeck({ dial: true, diet: { position: "bottom-left" }, streak: { position: "bottom-left" } }); + const p = measurePlacements(schedule(), both); assert.equal(p.diet.moves.length, 0); assert.ok(p.streak.moves.length > 0); - for (const m of p.streak.moves.filter((x) => x.rect)) { - assert.ok(!(m.rect.x < homes.diet.x + homes.diet.width && homes.diet.x < m.rect.x + m.rect.width && m.rect.y < homes.diet.y + homes.diet.height && homes.diet.y < m.rect.y + m.rect.height), "never onto the diet badge"); - assert.ok(m.rect.x >= box.x && m.rect.x + m.rect.width <= box.x + box.width, "inside the clip box"); - } }); + diff --git a/umtool/report-to-video/modules/measure-extras-module.mjs b/umtool/report-to-video/modules/measure-extras-module.mjs @@ -7,7 +7,8 @@ // file says only what is its own. import path from "node:path"; -import { measureExtraGeometry, measureOf, measurePlacements } from "../measure-extras.mjs"; +import { measureExtraGeometry, measureOf } from "../measure-extras.mjs"; +import { placementsFor } from "../chrome-measure-extras.mjs"; import { assertRegion, defineModule } from "./contract.mjs"; import { MEASURE_AVOID, MEASURE_DEFAULTS, MEASURE_FINALE, MEASURE_LIMITS, MEASURE_POSITIONS, resolveMeasureExtra, @@ -80,7 +81,7 @@ export function measureExtraModule(spec) { return [assertRegion({ name: id, frames: frames ?? path.join(outDir, "chrome", `${id}-frames`), // Its home, and every slot it moves clear to (a post card, a chapter band: measurePlacements). - ...measurePlacements(schedule, render)[id].region, + ...placementsFor(schedule, render)[id].region, })]; }, preview: (_slice, { render }) => ({ region: id, geometry: measureExtraGeometry(id, render) }), diff --git a/umtool/report-to-video/modules/measure-extras-settings.mjs b/umtool/report-to-video/modules/measure-extras-settings.mjs @@ -3,7 +3,8 @@ // dial -- the goal stack (`goals`), the moving start (`peak`), the promise // clock (`promise`) and the diet badge (`diet`). Their defaults and validators, // the one copy. A LEAF like settings.mjs (deck.mjs imports it through -// SETTINGS), so it imports nothing. +// SETTINGS), so it imports only instruments.mjs (a leaf too: whether the +// instruments' column is on decides two defaults here). // // render.chrome.deck.goals { show, position, x, y, scale, hold, finale, max, color, countdown } // render.chrome.deck.peak { show, position, x, y, scale, hold, finale, title, color, values } @@ -28,6 +29,8 @@ // put its top-left corner anywhere -- inside the panel column, say -- and // `scale` sizes it. +import { instrumentsOn, resolveDial } from "../instruments.mjs"; + /** The anchors in the footage box a module may sit at (`position`). */ export const MEASURE_POSITIONS = Object.freeze(["top-left", "top-right", "bottom-left", "bottom-right", "top-center", "bottom-center"]); @@ -79,7 +82,8 @@ export const MEASURE_LIMITS = Object.freeze({ quote: 160, }); -const COMMON = Object.freeze({ show: true, position: "top-left", x: null, y: null, scale: 1, hold: null, finale: "hide", onPosts: "dodge", onChapters: "dodge" }); +// `avoid`: the anchors a dodge never moves into (the streams' face cam is most often top-left). +const COMMON = Object.freeze({ show: true, position: "top-left", x: null, y: null, scale: 1, hold: null, finale: "hide", onPosts: "dodge", onChapters: "dodge", avoid: Object.freeze(["top-left"]) }); /** Each module's settings and their defaults. */ export const MEASURE_DEFAULTS = Object.freeze({ @@ -95,7 +99,7 @@ export const MEASURE_DEFAULTS = Object.freeze({ // handle also finding her picture in the manifest's postAvatars (else a // monogram); `claimVerb` is what her claim says she did; `claimColor` her ink. promise: Object.freeze({ ...COMMON, position: "top-center", finale: "show", label: null, verb: "offered", kept: "Posted", broken: "None posted", checks: "label", - speakers: Object.freeze({}), claimVerb: "paid", claimColor: "#E37AB8" }), + speakers: Object.freeze({}), claimVerb: "paid", claimColor: "#E37AB8", slot: "auto" }), // The diet badge: up from the first diet on, re-stamped at every change. diet: Object.freeze({ ...COMMON, position: "bottom-left", colors: Object.freeze({}), labels: Object.freeze({}) }), // The streak chain: bottom-centre, between the diet badge and the goal @@ -103,6 +107,12 @@ export const MEASURE_DEFAULTS = Object.freeze({ streak: Object.freeze({ ...COMMON, position: "bottom-center", source: "diet", axis: "date", title: null, color: null, colors: Object.freeze({}), labels: Object.freeze({}) }), }); +/** Each extra's anchor beside the instruments' column (resolveMeasureExtra), when its own is not named. */ +export const COLUMN_POSITIONS = Object.freeze({ diet: "top-right", streak: "bottom-left", goals: "bottom-right", peak: "top-center", promise: "top-center" }); + +/** Where the promise clock stands (`promise.slot`): the instruments' column (the trail's slot), the footage box, or the column when the instruments are on. */ +export const PROMISE_SLOTS = Object.freeze(["auto", "column", "footage"]); + /** The four ids, in the order they are drawn. */ export const MEASURE_EXTRAS = Object.freeze(["diet", "peak", "goals", "promise", "streak"]); @@ -121,8 +131,17 @@ export function resolveMeasureExtra(id, render) { const base = MEASURE_DEFAULTS[id]; const v = render?.chrome?.deck?.[id]; if (v === false) return null; + // With the dial on, the moving start repeats its ghosts: off unless it is named + // (its count rides on the dial's ghost label, "told 5×"). + if (id === "peak" && v === undefined && resolveDial(render)) return null; const own = isObj(v) ? v : {}; const out = { ...base, ...own }; + // Beside the instruments' column the clip box is 1248×702: the anchors that keep + // the five clear of each other there (the diet badge above the streak strip's + // corner, not on it) -- unless a position is named. + if (instrumentsOn(render) && own.position === undefined && COLUMN_POSITIONS[id]) out.position = COLUMN_POSITIONS[id]; + // Where the promise clock stands: the column's trail slot when the instruments are on ("auto"). + if (id === "promise") out.slot = out.slot === "auto" ? (instrumentsOn(render) ? "column" : "footage") : out.slot; if (id === "diet" || id === "streak") { out.colors = { ...DIET_COLORS, ...(isObj(own.colors) ? own.colors : {}) }; out.labels = { ...DIET_LABELS, ...(isObj(own.labels) ? own.labels : {}) }; @@ -173,6 +192,9 @@ export function validateMeasureExtra(id, v, where = `render.chrome.deck.${id}`) errors.push(`${where}.hold must be 0 (up from its first event on) or from ${L.hold[0]} to ${L.hold[1]} seconds`); } if (v.finale !== undefined && !MEASURE_FINALE.includes(v.finale)) errors.push(`${where}.finale must be "hide" or "show"`); + if (v.avoid !== undefined && !(Array.isArray(v.avoid) && v.avoid.every((a) => MEASURE_POSITIONS.includes(a)))) { + errors.push(`${where}.avoid must be a list of anchors (${MEASURE_POSITIONS.join(", ")})`); + } for (const k of ["onPosts", "onChapters"]) { if (v[k] !== undefined && !MEASURE_AVOID.includes(v[k])) errors.push(`${where}.${k} must be "dodge", "hide" or "show"`); } @@ -191,6 +213,7 @@ export function validateMeasureExtra(id, v, where = `render.chrome.deck.${id}`) if (id === "promise") { for (const k of ["label", "verb", "kept", "broken"]) text(v[k], L.text, `${where}.${k}`, errors, { nullable: k === "label" }); if (v.checks !== undefined && !PROMISE_CHECKS.includes(v.checks)) errors.push(`${where}.checks must be "label" or "quote"`); + if (v.slot !== undefined && !PROMISE_SLOTS.includes(v.slot)) errors.push(`${where}.slot must be "auto", "column" or "footage"`); text(v.claimVerb, L.text, `${where}.claimVerb`, errors, { nullable: false }); color(v.claimColor, `${where}.claimColor`, errors); if (v.speakers !== undefined) { diff --git a/umtool/report-to-video/rev9-panel.test.mjs b/umtool/report-to-video/rev9-panel.test.mjs @@ -0,0 +1,196 @@ +// The rev 9 integration fixes on the measure's instruments and extras (6 Nov; the rev9-panel preview's +// list A–K): instruments on by default with a measure, the dial's pre-state, a loss goal's base, ranges kept +// as ranges, the finale's ghost, the finale rail's labels, the finale's crossfade and caption line, the promise +// clock in the column's trail slot (and its strip over a post card in the footage box), and the wedge. +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import path from "node:path"; +import test from "node:test"; +import { fileURLToPath } from "node:url"; + +import { estimateSchedule, validateChrome } from "./deck.mjs"; +import { dialFinaleHandoff, dialFinaleHtml, dialHtml, goalWords, trailHtml, trailYields } from "./chrome-instruments.mjs"; +import { titleLast } from "./chrome-finale.mjs"; +import { instrumentsOn, resolveDial, resolveOdometer, resolveTrail } from "./instruments.mjs"; +import { measureTrack, wedgeRange, weightWords } from "./measure-draw.mjs"; +import { measureSlice, rangeOf } from "./measure-slice.mjs"; +import { measureExtraGeometry, measurePlacements, promiseStripRect } from "./measure-extras.mjs"; +import { placementsFor, promiseFinaleSlot, promiseHtml } from "./chrome-measure-extras.mjs"; +import { validateFinaleSettings } from "./finale.mjs"; + +const HERE = path.dirname(fileURLToPath(import.meta.url)); +const DIAL = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-dial", "measure.json"), "utf8")); +const EXTRAS = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-extras", "measure.json"), "utf8")); +const PAL = { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" }; +const render = (deck = {}) => ({ width: 1920, height: 1080, fps: 30, transition: 0.4, palette: PAL, chrome: { engine: "hyperframes", layout: "deck", deck } }); +const clone = (v) => JSON.parse(JSON.stringify(v)); + +/** A deck cut of nine clips (the last the finale) with `measure` in its schedule. */ +function cut(r, measure = DIAL) { + const timeline = Array.from({ length: 9 }, (_, i) => ({ + type: "clip", id: `c${i + 1}`, video: "vidx", start: 10 * i, end: 10 * i + (i === 8 ? 14 : 8), cite: 1, section: 0, + quote: "q", onscreen: { title: `Clip ${i + 1}` }, ...(i === 8 ? { layout: "finale" } : {}), + })); + const manifest = { slug: "m", title: "M", provenance: {}, render: r, timeline }; + return { manifest, schedule: { ...estimateSchedule(manifest), measure } }; +} + +test("A: with a measure the instruments are ON unless they say otherwise; without one, only when named", () => { + const withMeasure = render({ measure: { scopes: ["weight"] } }); + assert.ok(resolveDial(withMeasure) && resolveOdometer(withMeasure) && resolveTrail(withMeasure)); + assert.equal(instrumentsOn(withMeasure), true, "the column is on"); + assert.equal(resolveDial(render({ measure: { scopes: ["weight"] }, dial: false })), null, "false is off"); + assert.equal(resolveDial(render({})), null, "no measure, not named: off (a cut without them is the cut it was)"); + assert.ok(resolveDial(render({ dial: true }))); + assert.deepEqual(validateChrome(withMeasure.chrome, withMeasure), []); +}); + +test("B: before he states a weight the dial says so in words, its needle parked at the foot, dimmed -- never a number", () => { + const r = render({ dial: true }); + const { schedule } = cut(r); + const html = dialHtml(schedule, r, { fonts: {} }); + assert.match(html, /NO WEIGHT<br>STATED YET/); + const data = JSON.parse(/<script id="dial-data" type="application\/json">([^<]*)<\/script>/.exec(html)[1]); + assert.equal(data.init.nd.opacity, 0.3, "the needle dimmed until the first stated weight"); + assert.ok(data.cues.some((c) => c.k === "nd" && c.to.opacity === 1), "and brought up with it"); + // The ghosts still draw before it (w21 ≈390 is remembered before any stated in the dial fixture? its ghost layer is there). + assert.match(html, /data-k="g0"/); +}); + +test("C: a loss goal resolves against the run's start, else the latest weight he gave; below the scale's foot it is his words alone", () => { + const schema = { + kind: "measure", unit: "lb", yMin: 220, yMax: 400, bandGapDays: 60, + tracks: [{ key: "weight", role: "value", label: "Weight" }], + forms: ["current", "past", "delta", "goal", "goal_loss"], + }; + const row = (o) => ({ scope: "weight", scopeBasis: "his words", scopeConfidence: "read", valueKind: "uttered", flags: [], asOf: null, ...o }); + const ledger = [ + row({ id: "w07", date: "2022-06-15", population: "current", value: 240, display: "240 lb", entryId: "c1" }), + row({ id: "w16", date: "2023-06-07", population: "goal_loss", value: -75, display: "lose 75", entryId: "c2" }), + row({ id: "w21", date: "2023-09-29", asOf: "2023-07-01", population: "past", value: 390, display: "≈390 lb", entryId: "c3" }), + row({ id: "w22", date: "2023-10-12", population: "goal_loss", value: -100, display: "lose 100", entryId: "c4" }), + row({ id: "w32", date: "2024-01-30", population: "goal", value: 230, display: "220-240", entryId: "c5" }), + ]; + const r = render({ measure: { scopes: ["weight"], scale: { min: 220, max: 400 }, asOf: "2026-11-06" } }); + const { manifest } = cut(r); + const doc = estimateSchedule(manifest); + const m = measureSlice({ ledgerSchema: schema, ledger, render: r, timeline: manifest.timeline }, doc, {}); + const goalAfter = (row) => m.state[m.events.findIndex((e) => e.row === row) + 1].goal; + // 240 - 75 = 165, below the scale's foot (220): no target -- "LOSE 75", no tick. + assert.deepEqual([goalAfter("w16").value, goalAfter("w16").base], [null, null]); + assert.equal(goalWords(goalAfter("w16")), "LOSE 75"); + // The latest weight he gave by then is the remembered ≈390 (by the day it was his weight): 390 - 100 = 290. + assert.deepEqual([goalAfter("w22").value, goalAfter("w22").base.row, goalAfter("w22").base.from], [290, "w21", "remembered"]); + // D: a goal he gave as a range keeps it. + assert.deepEqual(goalAfter("w32").range, [220, 240]); + assert.equal(goalWords(goalAfter("w32")), "GOAL 220–240"); +}); + +test("D: a range stays a range -- on the events and the state, the dial's wedge, its words", () => { + assert.deepEqual(rangeOf({ display: "330-340 lb" }), [330, 340]); + assert.deepEqual(rangeOf({ display: "230–240" }), [230, 240]); + assert.equal(rangeOf({ display: "≈390 lb" }), null); + assert.deepEqual(wedgeRange(335, null, [330, 340]), [330, 340]); + assert.equal(weightWords({ value: 335, range: [330, 340] }), "330–340"); + assert.equal(weightWords({ value: 300, qualifier: ">" }), ">300"); + // A remembered range in the state is drawn as one: the ghost's band and words. + const m = clone(DIAL); + const i = m.events.findIndex((e) => e.kind === "remembered"); + m.events[i].range = [380, 390]; + for (const s of m.state) for (const r of s.remembered ?? []) if (r.row === m.events[i].row) r.range = [380, 390]; + const t = measureTrack(m); + assert.deepEqual(t.remembered[0].range, [380, 390]); + const r = render({ dial: true }); + const html = dialHtml({ ...cut(r).schedule, measure: m }, r, { fonts: {} }); + assert.match(html, /data-k="gb0"/); + assert.match(html, /<b>380–390<\/b>/); +}); + +test("the wedge reads at a glance: a strong fill with an outline, and its words beside it (\">300\")", () => { + const r = render({ dial: true }); + const html = dialHtml(cut(r).schedule, r, { fonts: {} }); + assert.match(html, /fill-opacity="0\.78"/); + assert.match(html, /class="qlab" data-k="ql\d+"[^>]*>&gt;300</); +}); + +test("E: the finale's long ghost stands on the LATEST remembered row (the last state's), never an earlier telling", () => { + const r = render({ dial: true, odometer: true, finale: { video: "side", totals: false } }); + const { schedule } = cut(r); + const html = dialFinaleHtml(schedule, r, { from: schedule.finale.from, to: schedule.finale.to }, { fonts: {} }); + const track = measureTrack(DIAL); + const last = track.remembered[track.remembered.length - 1]; + const n = track.remembered.length - 1; + // Its as-of label is the one shown. + const data = JSON.parse(/<script id="dial-finale-data" type="application\/json">([^<]*)<\/script>/.exec(html)[1]); + assert.ok(data.cues.some((c) => c.k === `fga${n}` && c.to.autoAlpha === 1), "the last ghost's words come up"); + assert.ok(!data.cues.some((c) => /^fga\d+$/.test(c.k) && c.k !== `fga${n}` && c.to.autoAlpha === 1)); + assert.ok(last.asOf); +}); + +test("G (count): the dial's ghost label carries how many times he told that start", () => { + const t = measureTrack(DIAL); + const n390 = t.remembered.filter((x) => Math.abs(x.value - 390) < 0.05); + assert.deepEqual(n390.map((x) => x.told), n390.map((_, i) => i + 1)); + const r = render({ dial: true }); + assert.match(dialHtml(cut(r).schedule, r, { fonts: {} }), /TOLD 2×/); +}); + +test("H: the finale rail's labels may be the section markers' alone, or none", () => { + assert.deepEqual(validateFinaleSettings({ railLabels: "sections" }), []); + assert.deepEqual(validateFinaleSettings({ railLabels: "none" }), []); + assert.match(validateFinaleSettings({ railLabels: "dates" }).join(), /railLabels must be/); +}); + +test("I: the dial's finale comes in with the finale (over its grow), as the column goes under it -- no empty frame", () => { + const r = render({ dial: true, odometer: true, finale: { video: "side", totals: false } }); + const { schedule } = cut(r); + const html = dialFinaleHtml(schedule, r, { from: schedule.finale.from, to: schedule.finale.to }, { fonts: {} }); + const data = JSON.parse(/<script id="dial-finale-data" type="application\/json">([^<]*)<\/script>/.exec(html)[1]); + const inCue = data.cues.find((c) => c.k === "rt" && c.to.autoAlpha === 1); + assert.ok(Math.abs(inCue.at - schedule.finale.from) < 0.05, `in at the finale's start (${inCue.at} vs ${schedule.finale.from})`); + const col = JSON.parse(/<script id="dial-data" type="application\/json">([^<]*)<\/script>/.exec(dialHtml(schedule, r, { fonts: {} }))[1]); + const out = col.cues.find((c) => c.k === "rt" && c.to.autoAlpha === 0 && Math.abs(c.at - schedule.finale.from) < 0.6); + assert.ok(out && out.dur >= 0.79, "the column goes over the finale's grow"); +}); + +test("J: the finale clip's source line puts the title last, so only its end is ever clamped", () => { + assert.equal(titleLast("TheQuartering (Rumble) · Democrats PANIC Over Red Wave · Nov 3, 2026 · 13:48"), "TheQuartering (Rumble) · Nov 3, 2026 · 13:48 · Democrats PANIC Over Red Wave"); + assert.equal(titleLast("A · B"), "A · B"); +}); + +test("K: beside the instruments the promise clock stands in the trail's slot (compact), the trail yields; in the footage box it becomes a strip over a post card; in the finale it takes the dial's lower column", () => { + const r = render({ dial: true, odometer: true, trail: true, measure: { scopes: ["weight"] }, promise: { label: "scale video" }, finale: { video: "side", totals: false } }); + const sched = { kind: "deck", fps: 30, total: 740, transition: 0.4, segments: [{ id: "a", start: 0, duration: 740, end: 740 }], measure: EXTRAS }; + const home = measureExtraGeometry("promise", r); + assert.equal(home.width, 600); + assert.equal(home.height, 138); + const html = promiseHtml(sched, r, { fonts: {} }).html; + assert.match(html, /scale video · offered 23 Oct · <span class="clc"/); + // The trail fades from the promise's first state on. + const yields = trailYields(sched, r); + assert.equal(yields[0].in, 712.18); + const t = JSON.parse(/<script id="trail-data" type="application\/json">([^<]*)<\/script>/.exec(trailHtml({ ...sched, measure: DIAL }, r, { fonts: {} }))[1]); + void t; + // In the column, a post card in the footage moves nothing. + const covered = { ...sched, covers: [{ segment: "p", from: 715, to: 725, rects: [{ x: 300, y: 100, width: 700, height: 600 }] }] }; + assert.equal(measurePlacements(covered, r).promise.moves.length, 0); + // In the footage box (no instruments): hidden over the card, and a strip in its top margin instead. + const f = render({ promise: { label: "scale video" } }); + const p = measurePlacements(covered, f).promise; + assert.deepEqual(p.moves, [{ from: 715, to: 725, rect: null, size: 1 }]); + assert.deepEqual(p.strips, [{ from: 715, to: 725 }]); + const strip = promiseStripRect(f); + assert.ok(p.region.y <= strip.y && p.region.x <= strip.x); + assert.match(promiseHtml(covered, f, { fonts: {} }).html, /<div id="ps" data-k="ps"[^>]*>.*class="sl" data-k="t0"/s); + // `slot: "footage"` beside the instruments keeps it in the footage box. + assert.equal(measureExtraGeometry("promise", render({ dial: true, promise: { slot: "footage" } })).width, 640); + // The finale: the dial's finale hands its lower column to it ("auto": a promise is on camera). + const { schedule } = cut(r, EXTRAS); + const at = dialFinaleHandoff(schedule, r); + assert.ok(at !== null, "a handoff in a short finale too"); + const slot = promiseFinaleSlot(schedule, r); + assert.equal(slot.at, at); + const moves = placementsFor(schedule, r).promise.moves; + assert.ok(moves.some((m) => m.rect && Math.abs(m.from - at) < 1e-6)); + assert.ok(moves.some((m) => !m.rect && Math.abs(m.from - schedule.finale.from) < 1e-6 && Math.abs(m.to - at) < 1e-6), "hidden over the rail until then"); +});