commit 556607091c22d50c398f75be2947c59f59efde4f
parent 66ea851dd573ce573fcdd879d3a528b8bb348454
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 18:29:37 -0500
umtool: the dial keeps a faint tick for every weight he claims, and marks every goal in force with the closest headlined
Claim ghosts (deck.measure.ghosts, default off; measure-ghosts.mjs): every
stated or remembered weight of his the cut shows leaves a thin tick across
the dial's rim at its value, under everything else on the face. A value
claimed again (within `tolerance` lb; an "≈" value as its rounded number)
steps its tick along a ramp -- 1x faint muted, 2x amber, 3x+ amber half way
to the needle's red, a little thicker each step -- and pulses once as the
repeat lands. The finale keeps every tick at its end-of-cut count. Knob:
true | false | {opacity, tolerance, ramp, pulse}, validated with
deck.measure; `umtool look <p> deck.measure.ghosts=true`.
The goal board (measure-goals.mjs goalBoard / goalsAt): every goal in force
at the playhead -- a newer goal of the same horizon (deadline day, deadline
words, or both undated) replaces the older; a reading at or under it in time
meets it -- and the HEADLINE, the closest (least still to lose from his
latest stated weight, ties to the soonest deadline), not the latest or the
most ambitious. A goal whose day the record's date passes with his latest
weight over it is MISSED: struck in red with a flash, "MISSED 320 · BY APR
2026" under the digits for 6 s, then gone. The dial marks every goal (the
headline the full amber tick and its words, the others a thin tick), and the
finale ends on the board's headline.
Seek-safe: both are pure functions of the schedule's measure, drawn as cue
lists the frame keys model. Operator, 6 Nov: "a subtle line left over on the
dial for every claim ... changing color for repeats"; "show each goal on the
dial, and prioritize the closest one rather than the most ambitious one".
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
10 files changed, 839 insertions(+), 63 deletions(-)
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -471,6 +471,7 @@ the one it always was.
| `scopes` | the ledger's tracks the instruments see (`["weight","regime"]`); a row of any other track is ignored entirely. Default: every track |
| `scale` | `{min, max}` in the ledger's unit: the dial's face. Default: the schema's `yMin`..`yMax` |
| `asOf` | the day the live countdowns and the promise clock count to (YYYY-MM-DD). Default: the day it is built |
+| `ghosts` | the dial's CLAIM GHOSTS: `true`, `{opacity, tolerance, ramp, pulse}`, or `false`/absent (off). A faint tick on the rim for every weight he has claimed, coloured and thickened by how often (Modules, [Scale dial](#scale-dial)) |
**The odometer** (ruled 5 Nov 2026, "go by his words"): only real-time loss claims count -- a `delta` below zero with
no `asOf` and not `retro`; a run's figure is its HIGHEST claim (his figure, over any app's he cites); a row's `run`
@@ -1524,7 +1525,7 @@ filter. A knob absent is its default, and a module whose knobs are all absent dr
| [Moving start](#moving-start) `peak` | The starting weight as he retells it: a tick per telling on a small scale, a count per repeat, the drift bracketed. (a page over the whole cut) | `render.chrome.deck.peak` |
| [Goal stack](#goal-stack) `goals` | Each goal he names as a sticky note on a pile -- a repeat merged with its count, a deadline counted down to the render date. (a page over the whole cut) | `render.chrome.deck.goals` |
| [Thread rail](#thread-rail) `threads` | A card per thread beside the footage, lit as its clips play. (a page over the whole cut) | `render.chrome.threads` |
-| [Scale dial](#scale-dial) `dial` | A bathroom-scale face: the needle swings to each weight he states, his remembered weights as ghosts, his goal on the bezel. (a page over the whole cut) | `render.chrome.deck.dial` |
+| [Scale dial](#scale-dial) `dial` | A bathroom-scale face: the needle swings to each weight he states, his remembered weights as ghosts, every goal in force on the bezel (the closest headlined), and -- with deck.measure.ghosts -- a faint tick for every weight he has claimed. (a page over the whole cut) | `render.chrome.deck.dial` |
| [Lost odometer](#lost-odometer) `odometer` | Rolling digits of the pounds he says he has lost (only ever up), NET beside them. (a page over the whole cut) | `render.chrome.deck.odometer` |
| [Weight trail](#weight-trail) `trail` | His stated weights by date, drawn up to the playhead, the 300 lb line and the times he says he is under it. (a page over the whole cut) | `render.chrome.deck.trail` |
| [Flips](#flips) `flips` | Pairs of what was said then and now, in the side panel. (a page over the whole cut) | `render.chrome.flips` |
@@ -1828,13 +1829,16 @@ A card per thread in the side panel beside the footage, lit as its clips play; a
### Scale dial
-A bathroom-scale face at the top of the instruments' column (the right of the frame; the clip moves to the left -- `instrumentsGeometry`, 1248×702 footage beside a 600 px column at 1920×1080). It reads the schedule's `measure` (the measure ledger's slice): the red needle swings to each STATED weight at its event's `t` (the spoken word) with a spring (`back.out`, 0.9 s) and rests there -- a frame at rest is reused, not captured again; a qualifier draws a wedge in pounds (≈ 3 under to 1 over, `>` 10 up, `<` 10 down); every REMEMBERED weight is a grey tick, the latest a long ghost needle with its as-of date; the latest goal is an amber tick on the bezel and its words under the digits. It comes and goes with the deck (a card, the finale). With any instrument on, the posts stay in the footage box (`posts.shift` does not apply), and the side panel (`threads`, `flips`) and the posts feed are refused.
+A bathroom-scale face at the top of the instruments' column (the right of the frame; the clip moves to the left -- `instrumentsGeometry`, 1248×702 footage beside a 600 px column at 1920×1080). It reads the schedule's `measure` (the measure ledger's slice): the red needle swings to each STATED weight at its event's `t` (the spoken word) with a spring (`back.out`, 0.9 s) and rests there -- a frame at rest is reused, not captured again; a qualifier draws a wedge in pounds (≈ 3 under to 1 over, `>` 10 up, `<` 10 down); every REMEMBERED weight is a grey tick, the latest a long ghost needle with its as-of date. GOALS (measure-goals.mjs `goalBoard`): every goal in force at the playhead is a mark on the bezel at its weight -- in force from the moment the cut shows it until he meets it in time, a newer goal of the same HORIZON replaces it (the same deadline day, the same deadline words, or both undated), or the record's date passes its day. The HEADLINE is the CLOSEST of them -- the least still to lose from his latest stated weight (a range to its top), ties to the soonest deadline -- the full amber tick, its words under the digits (`GOAL 320 · BY APR 2026`); the others a thin amber tick, no words; a range an amber band too. A goal whose day passes with his latest weight over it is MISSED: struck in the needle's red with a red flash, the line under the digits `MISSED 320 · BY APR 2026` for 6 s (`MISS_HOLD`), then gone; a day passing with his weight under it (a reading after the day) leaves quietly. A goal's day: the ledger's `due`, else his `deadline` words read ("by Christmas", "by the end of 2026"), else the row's `asOf`. Any page that shows a goal reads the same board: `goalBoard(schedule.measure)` -> `[{ t, active, headline, missed, cur }]`, `goalsAt(board, t)`. It comes and goes with the deck (a card, the finale). With any instrument on, the posts stay in the footage box (`posts.shift` does not apply), and the side panel (`threads`, `flips`) and the posts feed are refused.
| Knob | Range · default | From a terminal |
|---|---|---|
| `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.ghosts`, `.goal` | bool · default `true` each (`.goal`: every goal in force, the closest headlined) | `umtool look <p> deck.dial.ghosts=false` |
+| `deck.measure.ghosts` | `true` · `{opacity, tolerance, ramp, pulse}` · `false` / absent: off (the default). CLAIM GHOSTS (measure-ghosts.mjs), not `deck.dial.ghosts`: every weight he has claimed so far -- each stated weight the needle goes to and each remembered one, his own, in cut order -- leaves a thin faint tick across the dial's rim at its value, under everything else on the face; a value claimed again (within `tolerance` lb of the tick's first value; an `≈` value as its rounded number; `>300` and `<300` at 300) steps that tick along the `ramp` -- 1× faint, 2× warm, 3× and up hot, a little thicker each step -- and it pulses once as the repeat lands (`pulse`). In the finale every tick stays at its count at the cut's end. Seek-safe: a frame at t draws the claims before t | `umtool look <p> deck.measure.ghosts=true` |
+| `deck.measure.ghosts.opacity`, `.tolerance` | 0.15–0.9 (the 1× tick's; +0.2 a step, at most 0.95) · 0–5 lb · default `0.5`, `0.5` | `umtool look <p> deck.measure.ghosts='{"tolerance":1}'` |
+| `deck.measure.ghosts.ramp`, `.pulse` | 2–4 #hex, 1× first (the last for every count from there up), or `null`: the palette's muted, amber, and amber half way to the needle's red · bool · default `null`, `true` | `umtool look <p> deck.measure.ghosts='{"ramp":["#98a29b","#e8a33f","#f37e47"],"pulse":false}'` |
| `deck.dial.needle` | a #hex · default `#ff5a4e` | `umtool look <p> deck.dial.needle='"#ff5a4e"'` |
| `deck.dial.label` | words over the digits, ≤ 40 · default `HE SAYS HE WEIGHS` | `umtool look <p> deck.dial.label='"…"'` |
| `deck.dial.finale` | bool · default `true`: the dial and the odometer large in the finale (module `dial-finale`) | `umtool look <p> deck.dial.finale=false` |
diff --git a/umtool/report-to-video/chrome-instruments.mjs b/umtool/report-to-video/chrome-instruments.mjs
@@ -19,6 +19,8 @@ import { finaleLayout } from "./chrome-finale.mjs";
import { FINALE_MOTION } from "./finale.mjs";
import { resolveDial, resolveOdometer, resolveTrail } from "./instruments.mjs";
import { promiseStates, upSpans } from "./measure-extras.mjs";
+import { ghostOpacity, ghostRamp, ghostTicks, resolveGhosts } from "./measure-ghosts.mjs";
+import { goalBoard, goalsAt } from "./measure-goals.mjs";
import { resolveMeasureExtra } from "./modules/measure-extras-settings.mjs";
import {
cueList, dayNumber, dialAngle, dialFaceSvg, dialFigures, DIAL_SWEEP, esc, fmtDate, fmtSigned, fmtWeight, INSTANT, measureTrack,
@@ -119,6 +121,64 @@ export const goalWords = (g) => {
return when ? `${what} · ${String(when).toUpperCase()}` : what;
};
+/** A goal's day as the dial says it: his words ("BY CHRISTMAS 2026", the year added when they name none), else "BY APR 2026". */
+export function goalWhen(g) {
+ const year = /^(\d{4})-/.exec(String(g?.deadlineDate ?? ""))?.[1] ?? null;
+ if (g?.deadline) return `${String(g.deadline).toUpperCase()}${year && !/\d{4}/.test(g.deadline) ? ` ${year}` : ""}`;
+ return g?.deadlineDate ? `BY ${fmtDate(g.deadlineDate, { day: false })}` : "";
+}
+
+/**
+ * A goal board's goal (measure-goals.mjs) in words: "GOAL 320 · BY APR 2026", "GOAL 230–240",
+ * "GOAL 250 · LOSE 50" (a loss resolved, no day), "LOSE 75" (unresolved); `missed`: "MISSED 320 · BY APR 2026".
+ */
+export function boardGoalWords(g, { missed = false } = {}) {
+ if (!g) return "";
+ const when = goalWhen(g);
+ const num = Array.isArray(g.range) && g.range.length === 2 ? `${fmtWeight(g.range[0])}–${fmtWeight(g.range[1])}`
+ : Number.isFinite(g.target) ? fmtWeight(g.target) : null;
+ if (missed) return [`MISSED ${num ?? (Number.isFinite(g.loss) ? `LOSE ${fmtWeight(g.loss)}` : "GOAL")}`, when].filter(Boolean).join(" · ");
+ const what = num !== null
+ ? `GOAL ${num}${g.kind === "goalLoss" && Number.isFinite(g.loss) && !when ? ` · LOSE ${fmtWeight(g.loss)}` : ""}`
+ : Number.isFinite(g.loss) ? `LOSE ${fmtWeight(g.loss)}` : "GOAL";
+ return [what, when].filter(Boolean).join(" · ");
+}
+
+/**
+ * The goal board's goals as the dial marks them: each goal the board ever holds (in the order it first does), its
+ * angle (null when it has no weight on the face), and its status in each board state -- "head", "other", "missed"
+ * (with `wasHeadline`) or "off".
+ */
+export function goalMarks(board, scale) {
+ const goals = [];
+ const index = new Map();
+ for (const b of board) {
+ for (const g of [...b.active, ...b.missed]) {
+ if (index.has(g.row)) continue;
+ index.set(g.row, goals.length);
+ const onFace = Number.isFinite(g.target) && g.target >= scale.min && g.target <= scale.max;
+ const r = g.range;
+ const band = Array.isArray(r) && dialAngle(r[1], scale) > dialAngle(r[0], scale);
+ goals.push({ goal: g, angle: onFace ? dialAngle(g.target, scale) : null, band });
+ }
+ }
+ const statusIn = (b, row) => {
+ const m = b.missed.find((x) => x.row === row);
+ if (m) return { status: "missed", wasHeadline: !!m.wasHeadline };
+ if (b.headline?.row === row) return { status: "head" };
+ return b.active.some((x) => x.row === row) ? { status: "other" } : { status: "off" };
+ };
+ return goals.map((x) => ({ ...x, states: board.map((b) => ({ t: b.t, ...statusIn(b, x.goal.row) })) }));
+}
+
+/** What the goal line under the digits says in each board state: the latest miss while it is held, else the headline. */
+export function goalLines(board) {
+ return board.map((b) => {
+ const miss = [...b.missed].sort((x, y) => x.at - y.at).pop();
+ return { t: b.t, words: miss ? boardGoalWords(miss, { missed: true }) : boardGoalWords(b.headline), missed: !!miss };
+ });
+}
+
// ---------------------------------------------------------------------------
// The dial.
// ---------------------------------------------------------------------------
@@ -179,7 +239,7 @@ function asofSpots({ C, Rf, u, a, head, forms, px, fpx }) {
* the hub and the readout blocks. Shared by the column's dial and the
* finale's. Returns its markup and css; its cues are the caller's.
*/
-function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, prefix = "", preState = true }) {
+function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, marks = [], lines = [], ghosts = null, prefix = "", preState = true }) {
const face = dialFaceSvg({ size, scale, mark: cfg.mark, colors: { ...colors, mark: colors.accent }, labelFont: fontStack(fonts, "condensed") });
const { C, R, Rf, u } = face;
const px = (v) => Math.round(v * u * 100) / 100;
@@ -188,6 +248,20 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, prefix = ""
const layer = (k, inner, cls = "ly") => `<div class="${cls}" data-k="${prefix}${k}"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">${inner}</svg></div>`;
const parts = [];
parts.push(`<div class="ly face">${face.svg}</div>`);
+ // The claim ghosts (deck.measure.ghosts, measure-ghosts.mjs): under everything on the face, a thin tick across the
+ // rim at each value he has claimed -- one line per step of the ramp (its colour, a little thicker each step), the
+ // step its count is on shown, and a pulse line that flashes as a repeat lands.
+ if (ghosts) {
+ // From just in from the bezel's outer edge to just short of the scale's ticks (they start 6 px in).
+ const r0 = C - R + 2 * u, r1 = C - Rf + 8 * u;
+ ghosts.ticks.forEach((x, i) => {
+ const lines = ghosts.ramp.map((c, k) =>
+ `<div class="ly" data-k="${prefix}gt${i}s${k}"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}"><line x1="${C}" y1="${r0}" x2="${C}" y2="${r1}" stroke="${c}" stroke-width="${px(ghostWidth(k, ghosts.ramp.length))}" stroke-linecap="round"/></svg></div>`).join("");
+ const pulses = ghosts.cfg.pulse ? ghosts.ramp.map((c, k) => (k === 0 ? "" :
+ `<div class="ly" data-k="${prefix}gt${i}p${k}"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}"><line x1="${C}" y1="${C - R - 1 * u}" x2="${C}" y2="${C - Rf + 14 * u}" stroke="${c}" stroke-width="${px(ghostWidth(k, ghosts.ramp.length) + 2)}" stroke-linecap="round"/></svg></div>`)).join("") : "";
+ parts.push(`<div class="ly" data-k="${prefix}gt${i}">${lines}${pulses}</div>`);
+ });
+ }
// Where words laid on the face must not go: its scale figures, and the hub.
const faceFigures = dialFigures({ size, scale, mark: cfg.mark });
const hub = { x0: C - 18 * u, x1: C + 18 * u, y0: C - 18 * u, y1: C + 18 * u };
@@ -223,13 +297,20 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, prefix = ""
parts.push(`<div class="qlab" data-k="${prefix}ql${j}" style="left:${spot.x}px; top:${spot.y}px">${esc(words)}</div>`);
});
if (cfg.goal) {
- parts.push(layer("gl", `<polygon points="${C - 11 * u},${C - R - 2 * u} ${C + 11 * u},${C - R - 2 * u} ${C},${C - Rf + 16 * u}" fill="${colors.amber}" stroke="${colors.bg}" stroke-width="${px(2)}"/>`));
- // A goal he gave as a range: the tick spans it, an amber band on the bezel.
- track.goals.forEach((g, j) => {
- const r = g.goal?.range;
- if (!Array.isArray(r)) return;
- const b0 = dialAngle(r[0], scale), b1 = dialAngle(r[1], scale);
- if (b1 > b0) parts.push(`<div class="ly" data-k="${prefix}gr${j}"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}"><path d="${sectorPath(C, C, Rf + 2 * u, R + 4 * u, b0, b1)}" fill="${colors.amber}" fill-opacity="0.9"/></svg></div>`);
+ // EVERY goal in force (measure-goals.mjs goalBoard), each a mark on the bezel at its weight: the headline -- the
+ // closest -- the full amber triangle; the others a thin amber tick; a missed one struck through in the needle's
+ // red, a red flash as it is missed. A range is an amber band on the bezel besides (its headline's brighter).
+ const svg = (k, inner) => `<div class="ly" data-k="${prefix}${k}"><svg width="${size}" height="${size}" viewBox="0 0 ${size} ${size}">${inner}</svg></div>`;
+ marks.forEach((m, i) => {
+ const r = m.goal.range;
+ if (m.band) parts.push(svg(`gb${i}`, `<path d="${sectorPath(C, C, Rf + 2 * u, R + 4 * u, dialAngle(r[0], scale), dialAngle(r[1], scale))}" fill="${colors.amber}"/>`));
+ if (m.angle === null) return;
+ const head = `<polygon points="${C - 11 * u},${C - R - 2 * u} ${C + 11 * u},${C - R - 2 * u} ${C},${C - Rf + 16 * u}" fill="${colors.amber}" stroke="${colors.bg}" stroke-width="${px(2)}"/>`;
+ const other = `<polygon points="${C - 7 * u},${C - R - 1 * u} ${C + 7 * u},${C - R - 1 * u} ${C},${C - Rf + 11 * u}" fill="${colors.amber}" stroke="${colors.bg}" stroke-width="${px(1.5)}"/>`;
+ const strike = `<line x1="${C - 13 * u}" y1="${C - R + 1 * u}" x2="${C + 13 * u}" y2="${C - Rf + 12 * u}" stroke="${colors.needle}" stroke-width="${px(4)}" stroke-linecap="round"/>` +
+ `<line x1="${C + 13 * u}" y1="${C - R + 1 * u}" x2="${C - 13 * u}" y2="${C - Rf + 12 * u}" stroke="${colors.needle}" stroke-width="${px(4)}" stroke-linecap="round"/>`;
+ const flash = `<polygon points="${C - 17 * u},${C - R - 5 * u} ${C + 17 * u},${C - R - 5 * u} ${C},${C - Rf + 26 * u}" fill="none" stroke="${colors.needle}" stroke-width="${px(3)}" stroke-linejoin="round"/>`;
+ parts.push(`<div class="ly" data-k="${prefix}gm${i}">${svg(`gm${i}h`, head)}${svg(`gm${i}o`, other)}${svg(`gm${i}x`, strike)}${svg(`gm${i}p`, flash)}</div>`);
});
}
if (cfg.ghosts && track.remembered.length) {
@@ -265,8 +346,8 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, prefix = ""
parts.push(`<div class="read${pre ? " pre" : ""}" data-k="${prefix}cv${j}" style="top:${C + 86 * u}px"><div class="big">${has ? `${esc(weightWords(c))}<i>LB</i>` : pre ? "NO WEIGHT<br>STATED YET" : "—"}</div>${has && c.date ? `<div class="when" style="top:${78 * u}px">${esc(fmtDate(c.date))}</div>` : ""}</div>`);
});
if (cfg.goal) {
- track.goals.forEach((g, j) => {
- parts.push(`<div class="goalw" data-k="${prefix}gw${j}" style="top:${C + 188 * u}px">${esc(goalWords(g.goal))}</div>`);
+ lines.forEach((g, j) => {
+ parts.push(`<div class="goalw${g.missed ? " miss" : ""}" data-k="${prefix}gw${j}" style="top:${C + 188 * u}px">${esc(g.words)}</div>`);
});
}
const css = `
@@ -291,15 +372,25 @@ function dialParts({ size, ox, oy, scale, cfg, colors, fonts, track, prefix = ""
.dial .qlab { position: absolute; transform: translate(-50%, -50%); font-family: ${fontStack(fonts, "display")}; font-size: ${px(26)}px;
color: ${colors.accent}; white-space: nowrap; padding: ${px(1)}px ${px(6)}px; border-radius: ${px(5)}px; background: ${rgba(colors.face, 0.9)}; }
.dial .goalw { position: absolute; left: 0; width: ${size}px; text-align: center; font-family: ${fontStack(fonts, "bold")};
- font-size: ${fpx(17)}px; line-height: ${Math.max(15, px(20))}px; letter-spacing: 0.05em; color: ${colors.amber}; white-space: nowrap; }`;
+ font-size: ${fpx(17)}px; line-height: ${Math.max(15, px(20))}px; letter-spacing: 0.05em; color: ${colors.amber}; white-space: nowrap; }
+ .dial .goalw.miss { color: ${colors.needle}; }`;
return { html: `<div class="dial">${parts.join("\n ")}</div>`, css, face };
}
+/** A claim ghost's width (face px at 524) on step `k` of a ramp of `n`: 1.8 at 1x to 3.4 at the last. */
+export const ghostWidth = (k, n) => Math.round((1.8 + (n > 1 ? (k / (n - 1)) * 1.6 : 0)) * 100) / 100;
+
+/** The claim ghosts' seconds: a step's fade, a pulse's flash and its decay. */
+export const GHOST_MOTION = Object.freeze({ fade: 0.35, flash: 0.12, decay: 0.9 });
+
+/** A miss's flash: in, held, out (s). */
+export const MISS_MOTION = Object.freeze({ in: 0.15, hold: 0.5, out: 0.8 });
+
/** The needle's ease (`deck.dial.motion`): the spring's overshoot and settle, or a plain ease. */
const needleEase = (cfg, spring = INSTRUMENT_MOTION.needleEase) => (cfg.motion === "ease" ? INSTRUMENT_MOTION.needlePlain : spring);
/** The dial's cues over the cut: the needle on each stated weight, the ghosts, the wedges, the goal, the readout. */
-function dialCues(L, { track, scale, cfg, prefix = "", finale = false }) {
+function dialCues(L, { track, scale, cfg, marks = [], lines = [], ghosts = null, prefix = "", finale = false, at = 0 }) {
const M = INSTRUMENT_MOTION;
const a0 = DIAL_SWEEP.a0;
const k = (s) => `${prefix}${s}`;
@@ -352,37 +443,85 @@ function dialCues(L, { track, scale, cfg, prefix = "", finale = false }) {
blocks(L, track.remembered, k("ga"), { fade: M.fade });
}
}
- if (cfg.goal) {
- // A goal off the face (a loss resolved below the scale's foot: "lose 100" from 240) has no tick --
- // pinned at the foot it would say a weight he never named. Its words stay under the digits.
- const onFace = (v) => Number.isFinite(v) && v >= scale.min && v <= scale.max;
- const first = track.goals.find((g) => onFace(g.goal?.value));
- L.set(k("gl"), { rotation: first ? dialAngle(first.goal.value, scale) : a0, autoAlpha: 0 });
- let up = false;
- for (const g of track.goals) {
- const v = g.goal?.value;
- if (onFace(v)) {
- if (!up) {
- L.add(k("gl"), g.t, INSTANT, { rotation: dialAngle(v, scale) });
- L.add(k("gl"), g.t, M.fade, { autoAlpha: 1 }, "power1.out");
- } else L.add(k("gl"), g.t, M.goal, { rotation: dialAngle(v, scale) }, "power2.inOut");
- up = true;
- } else if (up) {
- L.add(k("gl"), g.t, M.fade, { autoAlpha: 0 }, "power1.in");
- up = false;
+ if (cfg.goal) goalCues(L, { marks, lines, k });
+ if (ghosts) ghostCues(L, { ghosts, scale, k, finale, at });
+}
+
+/**
+ * The goal board's cues (goalMarks, goalLines): each mark's status from each board state -- the headline's triangle,
+ * an other's tick, a miss struck in red with a flash -- and the goal line's words.
+ */
+function goalCues(L, { marks, lines, k }) {
+ const M = INSTRUMENT_MOTION;
+ const view = { head: { h: 1, o: 0, x: 0, b: 0.9 }, other: { h: 0, o: 0.85, x: 0, b: 0.4 }, off: { h: 0, o: 0, x: 0, b: 0 } };
+ const look = (st) => (st.status === "missed" ? { h: st.wasHeadline ? 0.45 : 0, o: st.wasHeadline ? 0 : 0.45, x: 1, b: 0.3 } : view[st.status]);
+ marks.forEach((m, i) => {
+ const hasBand = m.band;
+ if (m.angle !== null) {
+ L.set(k(`gm${i}`), { rotation: m.angle, autoAlpha: 1 });
+ for (const c of ["h", "o", "x", "p"]) L.set(k(`gm${i}${c}`), { autoAlpha: 0 });
+ }
+ if (hasBand) L.set(k(`gb${i}`), { autoAlpha: 0 });
+ let was = view.off;
+ let wasMissed = false;
+ for (const st of m.states) {
+ const v = look(st);
+ if (m.angle !== null) {
+ for (const c of ["h", "o", "x"]) if (v[c] !== was[c]) L.add(k(`gm${i}${c}`), st.t, c === "x" ? MISS_MOTION.in : M.fade, { autoAlpha: v[c] }, "power1.out");
+ // The miss is the beat: a red flash round the mark as it lands.
+ if (st.status === "missed" && !wasMissed) {
+ L.add(k(`gm${i}p`), st.t, MISS_MOTION.in, { autoAlpha: 1 }, "power1.out");
+ L.add(k(`gm${i}p`), st.t + MISS_MOTION.in + MISS_MOTION.hold, MISS_MOTION.out, { autoAlpha: 0 }, "power2.in");
+ }
}
+ if (hasBand && v.b !== was.b) L.add(k(`gb${i}`), st.t, M.fade, { autoAlpha: v.b }, "power1.out");
+ was = v;
+ wasMissed = st.status === "missed";
}
- blocks(L, track.goals, k("gw"), { shown: (g) => !!g.goal });
- // A range goal's band, up while it is the latest goal.
- track.goals.forEach((g, j) => {
- const r = g.goal?.range;
- if (!Array.isArray(r) || !(dialAngle(r[1], scale) > dialAngle(r[0], scale))) return;
- L.set(k(`gr${j}`), { autoAlpha: 0 });
- L.add(k(`gr${j}`), g.t, M.fade, { autoAlpha: 1 }, "power1.out");
- const next = track.goals[j + 1];
- if (next) L.add(k(`gr${j}`), next.t, M.fade, { autoAlpha: 0 }, "power1.in");
- });
- }
+ });
+ blocks(L, lines, k("gw"), { shown: (g) => !!g.words });
+}
+
+/**
+ * The claim ghosts' cues (measure-ghosts.mjs ghostTicks): each tick at its angle, from each claim the step its count
+ * is on faded in and the one before out, and a repeat's pulse. The finale (`finale`) shows every tick at its count
+ * at the end of the cut from `at`, no pulses.
+ */
+function ghostCues(L, { ghosts, scale, k, finale, at }) {
+ const G = GHOST_MOTION;
+ const n = ghosts.ramp.length;
+ ghosts.ticks.forEach((x, i) => {
+ L.set(k(`gt${i}`), { rotation: dialAngle(x.value, scale) });
+ for (let s = 0; s < n; s += 1) {
+ L.set(k(`gt${i}s${s}`), { autoAlpha: 0 });
+ if (ghosts.cfg.pulse && s > 0) L.set(k(`gt${i}p${s}`), { autoAlpha: 0 });
+ }
+ if (finale) {
+ const s = Math.min(n - 1, x.claims.length - 1);
+ L.add(k(`gt${i}s${s}`), at, G.fade, { autoAlpha: ghostOpacity(ghosts.cfg.opacity, s) }, "power1.out");
+ return;
+ }
+ let prev = -1;
+ for (const c of x.claims) {
+ const s = Math.min(n - 1, c.n - 1);
+ if (s !== prev) {
+ L.add(k(`gt${i}s${s}`), c.t, G.fade, { autoAlpha: ghostOpacity(ghosts.cfg.opacity, s) }, "power1.out");
+ if (prev >= 0) L.add(k(`gt${i}s${prev}`), c.t, G.fade, { autoAlpha: 0 }, "power1.in");
+ }
+ if (ghosts.cfg.pulse && c.n > 1) {
+ L.add(k(`gt${i}p${s}`), c.t, G.flash, { autoAlpha: 0.9 }, "power1.out");
+ L.add(k(`gt${i}p${s}`), c.t + G.flash, G.decay, { autoAlpha: 0 }, "power2.in");
+ }
+ prev = s;
+ }
+ });
+}
+
+/** The claim ghosts a page draws (deck.measure.ghosts), or null when off. */
+function ghostsOf(measure, render, colors) {
+ const cfg = resolveGhosts(render);
+ if (!cfg) return null;
+ return { cfg, ticks: ghostTicks(measure, cfg), ramp: ghostRamp(cfg, colors, mix) };
}
/**
@@ -400,10 +539,14 @@ export function dialHtml(schedule, render, opts = {}) {
const colors = colorsOf(render, cfg);
const track = measureTrack(M);
const size = even(Math.min(W, H));
- const parts = dialParts({ size, ox: Math.floor((W - size) / 2), oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track });
+ const board = goalBoard(M);
+ const marks = goalMarks(board, M.scale);
+ const lines = goalLines(board);
+ const ghosts = ghostsOf(M, render, colors);
+ const parts = dialParts({ size, ox: Math.floor((W - size) / 2), oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track, marks, lines, ghosts });
const L = cueList(fps);
withDeck(L, schedule, render, "rt");
- dialCues(L, { track, scale: M.scale, cfg });
+ dialCues(L, { track, scale: M.scale, cfg, marks, lines, ghosts });
const { init, cues } = L.build();
return pageHtml({
id: "dial", W, H, fps, fonts, gsap: opts.gsap,
@@ -669,7 +812,8 @@ export function finaleNumbers(measure) {
range: lastCur && lastCur.value === to && Array.isArray(lastCur.range) ? lastCur.range : null,
lost, runs, from: Number.isFinite(from) ? from : null,
peak: peaks.length ? Math.max(...peaks) : null,
- goal: [...track.goals].reverse().find((g) => g.goal)?.goal ?? null,
+ // The goal the finale ends on: the board's headline at the cut's end -- the CLOSEST goal in force (measure-goals.mjs).
+ goal: goalsAt(goalBoard(measure), Infinity).headline ?? null,
};
}
@@ -730,11 +874,18 @@ export function dialFinaleHtml(schedule, render, window, opts = {}) {
...full,
current: [{ t: from, value: null }, { t: A + 0.4, value: nums.weight, qualifier: nums.qualifier, date: null, ...(nums.range ? { range: nums.range } : {}) }],
remembered: rem,
- goals: nums.goal ? [{ t: from, goal: null }, { t: A + 0.4, goal: nums.goal }] : [{ t: from, goal: null }],
};
+ // The goals in force at the cut's end, all at once as the needle drops (the miss beats were the cut's).
+ const end = goalsAt(goalBoard(M), Infinity);
+ const board = [{ t: from, active: [], headline: null, missed: [] }, { t: A + 0.4, active: end.active, headline: end.headline, missed: [] }];
+ const marks = goalMarks(board, M.scale);
+ const lines = goalLines(board);
+ // The claim ghosts STAY: the finale is the summary, and the residue of every number he gave is the point of it --
+ // each tick at its count at the cut's end, in with the finale's grow under the needle's drop, no pulses.
+ const ghosts = ghostsOf(M, render, colors);
const size = even(Math.min(H, Math.round(W * 0.56)));
const k = size / 524;
- const dial = dialParts({ size, ox: 0, oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track, prefix: "f", preState: false });
+ const dial = dialParts({ size, ox: 0, oy: Math.floor((H - size) / 2), scale: M.scale, cfg, colors, fonts, track, marks, lines, ghosts, prefix: "f", preState: false });
const rw = W - size - Math.round(40 * k);
const top = Math.max(Number(M.totals?.lost) || 0, nums.lost);
const wheels = wheelCount(top);
@@ -758,7 +909,7 @@ export function dialFinaleHtml(schedule, render, window, opts = {}) {
else if (D > 0 && from + dur - D > A + 0.4) L.add("rt", from + dur - D, D, { autoAlpha: 0 }, "power1.in");
// The needle starts at his highest remembered weight (the scale's top without one) and drops.
const start = Number.isFinite(nums.peak) ? nums.peak : M.scale.max;
- dialCues(L, { track, scale: M.scale, cfg, prefix: "f", finale: true });
+ dialCues(L, { track, scale: M.scale, cfg, marks, lines, ghosts, prefix: "f", finale: true, at: A });
L.set("fnd", { rotation: dialAngle(start, M.scale) });
if (Number.isFinite(nums.weight)) L.add("fnd", A + 0.4, 1.8, { rotation: dialAngle(nums.weight, M.scale) }, needleEase(cfg, "back.out(1.4)"));
for (let i = 0; i <= wheels; i += 1) L.set(`ow${i}`, { y: 0 });
diff --git a/umtool/report-to-video/instruments.test.mjs b/umtool/report-to-video/instruments.test.mjs
@@ -244,7 +244,10 @@ test("the dial's finale: the record's numbers, a window page the frame keys mode
const html = dialFinaleHtml(schedule, RENDER, win, { fonts });
assert.match(html, /data-composition-id="dial-finale"/);
assert.match(html, />291\.5<i>LB<\/i>/);
- assert.match(html, /GOAL 235</);
+ // The goal it ends on is the CLOSEST in force at the cut's end (measure-goals.mjs), not simply the latest row of the
+ // record: w85, "lose 50" from 300 -> 250 (w90's 235 is the fixture's state, not a goal the cut shows).
+ assert.equal(n.goal.row, "w85");
+ assert.match(html, /GOAL 250 · LOSE 50</);
const keys = frameKeys({ html, region: "dial-finale", fps: FPS, frames: win.frames, version: "t" });
assert.ok(keys);
// Held once the needle, the wheels and NET are in (by 4 s into the window): one key.
diff --git a/umtool/report-to-video/measure-ghosts.mjs b/umtool/report-to-video/measure-ghosts.mjs
@@ -0,0 +1,133 @@
+// THE DIAL'S CLAIM GHOSTS (`render.chrome.deck.measure.ghosts`, 6 Nov 2026):
+// every weight the cut has shown him claim leaves a faint residual tick on the
+// dial's rim at its value, so after a few minutes the face carries the history
+// of everything he has said; a value claimed again changes that tick's colour
+// along a short ramp (1x faint neutral, 2x warm, 3x+ hot) and thickens it, and
+// the tick pulses once as the repeat lands.
+//
+// Not the dial's own `deck.dial.ghosts` (his REMEMBERED weights as long grey
+// ticks with their as-of words, the latest a long ghost needle): those stay as
+// they are, drawn over these.
+//
+// A claim is a measure event the cut shows (`measure.events`, t finite) of his
+// own (no `speaker`) that puts a number on his weight: a STATED weight (each
+// one the needle goes to) or a REMEMBERED one. Two claims are the same tick
+// when their values are within `tolerance` lb of the tick's first value; an
+// "≈" value counts as its rounded number; a ">300" or "<300" is a claim at
+// 300 (its bound is where it stands on the face).
+//
+// PURE and SEEK-SAFE: ghostTicks is a function of the schedule's measure alone,
+// in cut order -- no state from playback -- so Play, the live preview and the
+// render draw the same tick at the same second from either side of it.
+//
+// A LEAF: measure-slice.mjs (the setting's validator) and chrome-instruments.mjs
+// (the dial's page) import it; it imports nothing.
+
+/** The setting's knobs and their defaults (`ghosts: true`). */
+export const GHOST_DEFAULTS = Object.freeze({
+ // The 1x tick's opacity; each step of the ramp adds GHOST_OPACITY_STEP, to at most 0.95.
+ opacity: 0.5,
+ // Pounds: a claim within this of a tick's value is a repeat of it.
+ tolerance: 0.5,
+ // The ramp's colours, 1x first, the last for every count from there up (2 to 4 #hex), or
+ // null: the palette's -- its muted, its amber, and amber half way to the needle's red.
+ ramp: null,
+ // The tick pulses once as a repeat lands.
+ pulse: true,
+});
+
+export const GHOST_OPACITY = Object.freeze([0.15, 0.9]);
+export const GHOST_OPACITY_STEP = 0.2;
+export const GHOST_TOLERANCE = Object.freeze([0, 5]);
+export const GHOST_RAMP = Object.freeze([2, 4]);
+
+const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
+const HEX_RE = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
+const inRange = (v, [lo, hi]) => typeof v === "number" && Number.isFinite(v) && v >= lo && v <= hi;
+
+/** `render.chrome.deck.measure.ghosts`, as sentences. */
+export function validateGhosts(v, where = "render.chrome.deck.measure.ghosts") {
+ if (v === undefined || typeof v === "boolean") return [];
+ if (!isObj(v)) return [`${where} must be true, false or { ${Object.keys(GHOST_DEFAULTS).join(", ")} }`];
+ const errors = [];
+ for (const k of Object.keys(v)) {
+ if (!Object.hasOwn(GHOST_DEFAULTS, k)) errors.push(`${where}.${k} is not a setting of it (${Object.keys(GHOST_DEFAULTS).join(", ")})`);
+ }
+ if (v.opacity !== undefined && !inRange(v.opacity, GHOST_OPACITY)) errors.push(`${where}.opacity must be a number from ${GHOST_OPACITY[0]} to ${GHOST_OPACITY[1]}`);
+ if (v.tolerance !== undefined && !inRange(v.tolerance, GHOST_TOLERANCE)) errors.push(`${where}.tolerance must be pounds from ${GHOST_TOLERANCE[0]} to ${GHOST_TOLERANCE[1]}`);
+ if (v.ramp !== undefined && v.ramp !== null) {
+ if (!Array.isArray(v.ramp) || v.ramp.length < GHOST_RAMP[0] || v.ramp.length > GHOST_RAMP[1] || v.ramp.some((c) => typeof c !== "string" || !HEX_RE.test(c))) {
+ errors.push(`${where}.ramp must be ${GHOST_RAMP[0]} to ${GHOST_RAMP[1]} #hex colours (1x first), or null for the palette's`);
+ }
+ }
+ if (v.pulse !== undefined && typeof v.pulse !== "boolean") errors.push(`${where}.pulse must be true or false`);
+ return errors;
+}
+
+/** The ghosts' settings, defaults filled, or null when off (absent, `false`). */
+export function resolveGhosts(render) {
+ const v = render?.chrome?.deck?.measure?.ghosts;
+ if (v === true) return { ...GHOST_DEFAULTS };
+ if (!isObj(v)) return null;
+ return { ...GHOST_DEFAULTS, ...v };
+}
+
+/** The ramp's colours: the setting's, else from the palette roles (`muted`, `amber`, `needle`, and a `mix`). */
+export function ghostRamp(cfg, { muted, amber, needle }, mix) {
+ if (Array.isArray(cfg?.ramp) && cfg.ramp.length >= GHOST_RAMP[0]) return [...cfg.ramp];
+ return [muted, amber, mix(amber, needle, 0.5)];
+}
+
+/** Step `k` (0 = 1x) of a ramp of `n`: its opacity from the 1x opacity. */
+export const ghostOpacity = (base, k) => Math.min(0.95, Math.round((base + k * GHOST_OPACITY_STEP) * 100) / 100);
+
+/** The claim's value as its tick counts it: an "≈" value is its rounded number. */
+export const claimValue = (e) => (e?.qualifier === "≈" ? Math.round(Number(e.value)) : Number(e.value));
+
+/** Is this event a weight claim of his the cut shows: stated or remembered, a number, a time, no other speaker. */
+export const isClaim = (e) =>
+ !!e && (e.kind === "stated" || e.kind === "remembered") && Number.isFinite(Number(e.value)) && e.value !== null &&
+ Number.isFinite(e.t) && !(typeof e.speaker === "string" && e.speaker.trim());
+
+/**
+ * The ghost ticks of a measure: one per value claimed, in the order first
+ * claimed -- `{ value, claims: [{ t, row, kind, n }] }`, `value` the first
+ * claim's (as its tick counts it), each claim with its count `n` (1 the
+ * first). In cut order: a claim joins the first tick whose value is within
+ * `tolerance` of it, else starts a tick.
+ *
+ * @param {{ events?: object[] }} measure the schedule's measure slice
+ * @param {{ tolerance?: number }} [cfg]
+ */
+export function ghostTicks(measure, cfg = {}) {
+ const tol = Number.isFinite(cfg.tolerance) ? cfg.tolerance : GHOST_DEFAULTS.tolerance;
+ const claims = (Array.isArray(measure?.events) ? measure.events : [])
+ .map((e, i) => ({ e, i }))
+ .filter(({ e }) => isClaim(e))
+ .sort((a, b) => a.e.t - b.e.t || a.i - b.i);
+ const ticks = [];
+ for (const { e } of claims) {
+ const v = claimValue(e);
+ let tick = ticks.find((x) => Math.abs(x.value - v) <= tol + 1e-9);
+ if (!tick) ticks.push((tick = { value: v, claims: [] }));
+ tick.claims.push({ t: e.t, row: e.row ?? null, kind: e.kind, n: tick.claims.length + 1 });
+ }
+ return ticks;
+}
+
+/**
+ * The ticks as they stand at cut second `t`: each tick claimed by then with
+ * its count so far (`count`), the ramp step it is on (`step`, 0 = 1x, held at
+ * the ramp's last), and whether a repeat landed within `pulse` s before `t`.
+ * A pure function of the ticks and `t` -- what a frame at `t` shows.
+ */
+export function ghostsAt(ticks, t, { steps = 3, pulse = 0 } = {}) {
+ const out = [];
+ for (const x of ticks) {
+ const by = x.claims.filter((c) => c.t <= t + 1e-9);
+ if (!by.length) continue;
+ const last = by[by.length - 1];
+ out.push({ value: x.value, count: by.length, step: Math.min(steps - 1, by.length - 1), pulsing: pulse > 0 && last.n > 1 && t - last.t < pulse });
+ }
+ return out;
+}
diff --git a/umtool/report-to-video/measure-ghosts.test.mjs b/umtool/report-to-video/measure-ghosts.test.mjs
@@ -0,0 +1,158 @@
+// The dial's claim ghosts (measure-ghosts.mjs, chrome-instruments.mjs): the
+// setting, the accumulation in cut order, the repeat ramp and its tolerance,
+// and that what a frame shows at t is a pure function of the schedule.
+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 } from "./deck.mjs";
+import { mix } from "./chrome-deck.mjs";
+import { dialFinaleHtml, dialHtml } from "./chrome-instruments.mjs";
+import { frameKeys } from "./frame-keys.mjs";
+import { GHOST_DEFAULTS, claimValue, ghostOpacity, ghostRamp, ghostTicks, ghostsAt, isClaim, resolveGhosts, validateGhosts } from "./measure-ghosts.mjs";
+import { validateMeasureSettings } from "./measure-slice.mjs";
+import { moduleById } from "./modules/index.mjs";
+
+const HERE = path.dirname(fileURLToPath(import.meta.url));
+const MEASURE = JSON.parse(readFileSync(path.join(HERE, "fixtures", "measure-dial", "measure.json"), "utf8"));
+const FPS = 30;
+const fonts = { DeckSans: "assets/DeckSans.ttf", DeckSansBold: "assets/DeckSansBold.ttf" };
+const PALETTE = { bg: "#0F1312", fg: "#EDF0EC", muted: "#98A29B", accent: "#22AB83", amber: "#E8A33F" };
+const renderWith = (measure) => ({
+ width: 1920, height: 1080, fps: FPS, transition: 0.4, palette: PALETTE,
+ chrome: { engine: "hyperframes", layout: "deck", deck: { dial: true, odometer: true, trail: true, qr: { show: false }, finale: { video: "side", totals: false }, ...(measure ? { measure } : {}) } },
+});
+
+function cut(render) {
+ 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, timeline };
+ return { ...estimateSchedule(manifest), measure: MEASURE };
+}
+
+const dataOf = (html, id = "dial") => JSON.parse(new RegExp(`<script id="${id}-data" type="application/json">(.*?)</script>`, "s").exec(html)[1]);
+
+/** An element's property at cut second `t` from a page's init and cues, as the interpreter lands on it at rest. */
+function valueAt(data, k, p, t) {
+ let v = data.init[k]?.[p];
+ for (const c of data.cues) if (c.k === k && p in c.to && c.at + c.dur <= t + 1e-9) v = c.to[p];
+ return v;
+}
+
+test("the setting: off unless asked; true, false or its knobs; checked where deck.measure is", () => {
+ assert.equal(resolveGhosts(renderWith({})), null);
+ assert.equal(resolveGhosts(renderWith({ ghosts: false })), null);
+ assert.deepEqual(resolveGhosts(renderWith({ ghosts: true })), { ...GHOST_DEFAULTS });
+ assert.deepEqual(resolveGhosts(renderWith({ ghosts: { tolerance: 1, pulse: false } })), { ...GHOST_DEFAULTS, tolerance: 1, pulse: false });
+ assert.deepEqual(validateGhosts(true), []);
+ assert.deepEqual(validateGhosts({ opacity: 0.3, tolerance: 2, ramp: ["#888888", "#e8a33f", "#ff5a4e"], pulse: true }), []);
+ assert.deepEqual(validateGhosts({ opacity: 2, tolerance: -1, ramp: ["red"], pulse: "yes", glow: 1 }), [
+ "render.chrome.deck.measure.ghosts.glow is not a setting of it (opacity, tolerance, ramp, pulse)",
+ "render.chrome.deck.measure.ghosts.opacity must be a number from 0.15 to 0.9",
+ "render.chrome.deck.measure.ghosts.tolerance must be pounds from 0 to 5",
+ "render.chrome.deck.measure.ghosts.ramp must be 2 to 4 #hex colours (1x first), or null for the palette's",
+ "render.chrome.deck.measure.ghosts.pulse must be true or false",
+ ]);
+ assert.deepEqual(validateGhosts("on"), ["render.chrome.deck.measure.ghosts must be true, false or { opacity, tolerance, ramp, pulse }"]);
+ assert.deepEqual(validateMeasureSettings({ ghosts: { ramp: [] } }), [
+ "render.chrome.deck.measure.ghosts.ramp must be 2 to 4 #hex colours (1x first), or null for the palette's",
+ ]);
+ // The palette's ramp: muted, amber, amber half way to the needle.
+ assert.deepEqual(ghostRamp(GHOST_DEFAULTS, { muted: "#98a29b", amber: "#e8a33f", needle: "#ff5a4e" }, mix), ["#98a29b", "#e8a33f", mix("#e8a33f", "#ff5a4e", 0.5)]);
+ assert.deepEqual([0, 1, 2, 5].map((k) => ghostOpacity(0.5, k)), [0.5, 0.7, 0.9, 0.95]);
+});
+
+test("every claim he makes leaves a tick, in cut order: stated and remembered, his own, a number, on screen", () => {
+ assert.equal(isClaim({ kind: "stated", value: 300, t: 1 }), true);
+ assert.equal(isClaim({ kind: "remembered", value: 390, t: 1 }), true);
+ assert.equal(isClaim({ kind: "goal", value: 250, t: 1 }), false);
+ assert.equal(isClaim({ kind: "stated", value: null, t: 1 }), false);
+ assert.equal(isClaim({ kind: "stated", value: 300, t: null }), false);
+ assert.equal(isClaim({ kind: "stated", value: 300, t: 1, speaker: "madamsavvy" }), false);
+ const ticks = ghostTicks(MEASURE, GHOST_DEFAULTS);
+ // The fixture's 21 claims on 15 values: 390 four times (≈390 thrice and 390 once), 300 four times (>300, 300, >300, <300).
+ assert.equal(ticks.reduce((n, x) => n + x.claims.length, 0), 21);
+ assert.equal(ticks.length, 15);
+ const by = new Map(ticks.map((x) => [x.value, x.claims.map((c) => c.n)]));
+ assert.deepEqual(by.get(390), [1, 2, 3, 4]);
+ assert.deepEqual(by.get(300), [1, 2, 3, 4]);
+ assert.deepEqual(by.get(291.5), [1]);
+ // In the order first claimed.
+ assert.deepEqual(ticks.slice(0, 3).map((x) => x.value), [240, 390, 365.7]);
+});
+
+test("a repeat is a claim within the tolerance of a tick's first value; an ≈ counts as its rounded number", () => {
+ const ev = (t, value, qualifier = null, kind = "stated") => ({ t, kind, value, qualifier, row: `r${t}` });
+ const m = { events: [ev(1, 300), ev(2, 300.4), ev(3, 300.6), ev(4, 389.6, "≈", "remembered"), ev(5, 390), ev(6, 299.5)] };
+ const half = ghostTicks(m, { tolerance: 0.5 });
+ assert.deepEqual(half.map((x) => [x.value, x.claims.length]), [[300, 3], [300.6, 1], [390, 2]]);
+ assert.equal(claimValue({ value: 389.6, qualifier: "≈" }), 390);
+ const none = ghostTicks(m, { tolerance: 0 });
+ assert.deepEqual(none.map((x) => x.value), [300, 300.4, 300.6, 390, 299.5]);
+ const wide = ghostTicks(m, { tolerance: 1 });
+ assert.deepEqual(wide.map((x) => [x.value, x.claims.length]), [[300, 4], [390, 2]]);
+});
+
+test("the ramp: 1x, 2x, 3x and up held on the last; a repeat pulses, a first claim does not", () => {
+ const ticks = ghostTicks(MEASURE, GHOST_DEFAULTS);
+ const t390 = ticks.find((x) => x.value === 390).claims.map((c) => c.t);
+ const at = (t) => ghostsAt(ticks, t, { steps: 3, pulse: 1 }).find((x) => x.value === 390) ?? null;
+ assert.equal(at(t390[0] - 0.01), null);
+ assert.deepEqual(at(t390[0]), { value: 390, count: 1, step: 0, pulsing: false });
+ assert.deepEqual(at(t390[1] + 0.5), { value: 390, count: 2, step: 1, pulsing: true });
+ assert.deepEqual(at(t390[1] + 1.5), { value: 390, count: 2, step: 1, pulsing: false });
+ assert.deepEqual(at(t390[3] + 2), { value: 390, count: 4, step: 2, pulsing: false });
+});
+
+test("the dial draws them only when asked; the page is a cue list the frame keys model, and a frame at t shows the ticks at t", () => {
+ const off = renderWith({});
+ const on = renderWith({ ghosts: true });
+ const plain = dialHtml(cut(off), off, { fonts });
+ assert.doesNotMatch(plain, /data-k="gt0/);
+ const html = dialHtml(cut(on), on, { fonts });
+ assert.match(html, /data-k="gt0"/);
+ // Pure: the same schedule draws the same page.
+ assert.equal(html, dialHtml(cut(on), on, { fonts }));
+ const schedule = cut(on);
+ const frames = Math.round(schedule.total * FPS);
+ const keys = frameKeys({ html, region: "dial", fps: FPS, frames, version: "t" });
+ assert.ok(keys, "the frame keys model the dial's page with its ghosts");
+ assert.ok(new Set(keys).size < frames / 2, "the ghosts at rest are reused frame to frame");
+ const data = dataOf(html);
+ const ticks = ghostTicks(MEASURE, GHOST_DEFAULTS);
+ // SEEK-SAFE: at any second, each tick's visible step is ghostsAt's -- read from init and the cues, never from playback.
+ for (const t of [0, 5, 7.25 + 1, 21.25 + 1, 44 + 1, 58 + 1, 61]) {
+ const want = new Map(ghostsAt(ticks, t, { steps: 3 }).map((x) => [x.value, x.step]));
+ ticks.forEach((x, i) => {
+ const shown = [0, 1, 2].filter((s) => (valueAt(data, `gt${i}s${s}`, "autoAlpha", t) ?? 0) > 0);
+ assert.deepEqual(shown, want.has(x.value) ? [want.get(x.value)] : [], `tick ${x.value} at ${t}s`);
+ });
+ }
+ // The 1x opacity, faint; the third step the strongest; a pulse decays to nothing.
+ const i390 = ticks.findIndex((x) => x.value === 390);
+ assert.equal(valueAt(data, `gt${i390}s2`, "autoAlpha", 61), 0.9);
+ assert.equal(valueAt(data, `gt${i390}p1`, "autoAlpha", 61), 0);
+ assert.ok(data.cues.some((c) => c.k === `gt${i390}p1` && c.to.autoAlpha === 0.9), "the second telling pulses");
+ // pulse: false draws no pulse lines.
+ const quiet = renderWith({ ghosts: { pulse: false } });
+ assert.doesNotMatch(dialHtml(cut(quiet), quiet, { fonts }), /data-k="gt\d+p/);
+});
+
+test("the finale keeps them: every tick at its count at the cut's end, in with the finale, no pulses", () => {
+ const on = renderWith({ ghosts: true });
+ const schedule = cut(on);
+ const win = moduleById("dial-finale").window(schedule, { fps: FPS, total: schedule.total });
+ const html = dialFinaleHtml(schedule, on, win, { fonts });
+ const data = dataOf(html, "dial-finale");
+ const ticks = ghostTicks(MEASURE, GHOST_DEFAULTS);
+ ticks.forEach((x, i) => {
+ const s = Math.min(2, x.claims.length - 1);
+ assert.equal(valueAt(data, `fgt${i}s${s}`, "autoAlpha", win.to), ghostOpacity(GHOST_DEFAULTS.opacity, s));
+ });
+ assert.ok(!data.cues.some((c) => /^fgt\d+p/.test(c.k) && c.to.autoAlpha > 0));
+ assert.ok(frameKeys({ html, region: "dial-finale", fps: FPS, frames: win.frames, version: "t" }));
+});
diff --git a/umtool/report-to-video/measure-goals.mjs b/umtool/report-to-video/measure-goals.mjs
@@ -0,0 +1,172 @@
+// THE GOAL BOARD (6 Nov 2026, the operator: "in a sequence of multiple goals
+// such as at the 7m clip, show each goal on the dial, and prioritize the
+// closest one rather than the most ambitious one since failing the easiest
+// goal would be the most interesting"): every goal in force at the playhead,
+// the CLOSEST of them as the headline, and each one whose deadline passed
+// unmet, held a moment as MISSED.
+//
+// active every goal (`goal`, `goal_loss`) of his the cut has shown, not
+// yet met, replaced or past its deadline -- in the order set.
+// A newer goal with the same HORIZON replaces the older one: the
+// same deadline day, else the same deadline words, else both
+// undated ("eventual" goals stay until one replaces them).
+// headline the active goal with the least loss still needed from his
+// latest stated weight (to a range's top); a goal with no weight
+// (an unresolved "lose 75") by its loss; ties to the soonest
+// deadline, then the latest set. Not the most ambitious, not
+// simply the latest.
+// missed the goals whose deadline the record's date (the latest date of
+// the events shown so far) has passed with no stated weight of his
+// at or under it by then, while his latest stated weight is over
+// it -- each `{ ...goal, at, wasHeadline }`, held MISS_HOLD s from
+// `at`, then gone. A goal whose deadline passes with his latest
+// weight under it (a reading after the day: we cannot say) or that
+// a reading meets in time leaves quietly.
+//
+// A goal: `{ row, kind, t, said, target, range, loss, display, deadline,
+// deadlineDate, key }` -- `target` the weight it comes to (a `goal_loss`
+// resolved against its base by the slice: the state's `goal.value`), null
+// when unresolved; `deadlineDate` the ledger's `due`, else the date his
+// deadline words name (measure-extras.mjs deadlineDate), else the row's
+// `asOf` (the day a goal is for: "320 by his birthday", asOf 2026-04-01).
+//
+// PURE and SEEK-SAFE: goalBoard is a function of the schedule's measure alone;
+// goalsAt(board, t) is the board at a cut second. The dial draws it
+// (chrome-instruments.mjs); any page that shows a goal reads the same
+// `headline` from here.
+import { deadlineDate } from "./measure-extras.mjs";
+
+/** How long a missed goal stays on the dial, struck, before it goes (s). */
+export const MISS_HOLD = 6;
+
+const ISO_RE = /^\d{4}-\d{2}-\d{2}$/;
+const isIso = (v) => typeof v === "string" && ISO_RE.test(v);
+const own = (e) => !(typeof e?.speaker === "string" && e.speaker.trim());
+const r4 = (v) => Math.round(v * 10000) / 10000;
+
+/** The weight a goal must be at or under to be met: a range's top, else its target. */
+export const goalEdge = (g) => (Array.isArray(g?.range) && g.range.length === 2 ? Math.max(g.range[0], g.range[1]) : g?.target ?? null);
+
+/** Pounds still to lose from `cur` to goal `g` (its loss when it has no weight), or Infinity when unknown. */
+export function goalNeed(g, cur) {
+ const edge = goalEdge(g);
+ if (Number.isFinite(edge) && Number.isFinite(cur)) return r4(cur - edge);
+ if (Number.isFinite(g?.loss)) return g.loss;
+ return Infinity;
+}
+
+/**
+ * The closest of `goals` from weight `cur`: the least still needed (a goal
+ * already under `cur`'s reach -- need 0 or less -- after every one still
+ * ahead), ties to the soonest deadline (undated last), then the latest set.
+ */
+export function headlineOf(goals, cur) {
+ if (!goals.length) return null;
+ const rank = (g) => {
+ const n = goalNeed(g, cur);
+ return n > 0 ? n : 1e9 - n;
+ };
+ return [...goals].sort((a, b) =>
+ rank(a) - rank(b) ||
+ String(a.deadlineDate ?? "9999").localeCompare(String(b.deadlineDate ?? "9999")) ||
+ b.t - a.t)[0];
+}
+
+/** A goal event as the board carries it, with the state after it (`s`, for a goal_loss's resolution). */
+function goalOf(e, s) {
+ const kind = e.kind;
+ const resolved = s?.goal && s.goal.row === e.row ? s.goal : null;
+ const target = kind === "goal" && Number.isFinite(Number(e.value)) && e.value !== null ? Number(e.value)
+ : Number.isFinite(resolved?.value) ? resolved.value : null;
+ const loss = kind === "goalLoss" && Number.isFinite(Number(e.value)) ? Math.abs(Number(e.value)) : Number.isFinite(resolved?.loss) ? resolved.loss : null;
+ const words = typeof e.deadline === "string" && e.deadline.trim() ? e.deadline.trim() : null;
+ const date = isIso(e.due) ? e.due : (words ? deadlineDate(words, e.date) : null) ?? (isIso(e.asOf) ? e.asOf : null);
+ const range = Array.isArray(e.range) && e.range.length === 2 ? [...e.range] : Array.isArray(resolved?.range) ? [...resolved.range] : null;
+ return {
+ row: e.row ?? null, kind, t: e.t, said: isIso(e.date) ? e.date : null,
+ target, ...(range ? { range } : {}), loss, display: e.display ?? null,
+ deadline: words, deadlineDate: date,
+ key: date ? `d:${date}` : words ? `w:${words.toLowerCase()}` : "eventual",
+ };
+}
+
+const sameBoard = (a, b) => a && b &&
+ a.headline?.row === b.headline?.row &&
+ a.active.map((g) => g.row).join("|") === b.active.map((g) => g.row).join("|") &&
+ a.missed.map((g) => g.row).join("|") === b.missed.map((g) => g.row).join("|");
+
+/**
+ * The goal board over the cut: `[{ t, active, headline, missed, cur }]`, one
+ * per change, the first at t 0 (nothing yet), each the board from its `t` to
+ * the next one's. `cur` is his latest stated weight then (null before one).
+ *
+ * @param {{ events?: object[], state?: object[] }} measure the schedule's measure slice
+ * @param {{ hold?: number }} [opts] how long a missed goal is held (MISS_HOLD)
+ */
+export function goalBoard(measure, { hold = MISS_HOLD } = {}) {
+ const events = Array.isArray(measure?.events) ? measure.events : [];
+ const states = Array.isArray(measure?.state) ? measure.state : [];
+ const steps = events
+ .map((e, i) => ({ e, s: states[i + 1] ?? states[states.length - 1] ?? null, i }))
+ .filter(({ e }) => Number.isFinite(e?.t) && own(e))
+ .sort((a, b) => a.e.t - b.e.t || a.i - b.i);
+ let active = [];
+ let cur = null;
+ let recordDate = null;
+ const misses = [];
+ const points = [{ t: 0, active: [], headline: null, cur: null }];
+ for (const { e, s } of steps) {
+ if (isIso(e.date) && (recordDate === null || e.date > recordDate)) recordDate = e.date;
+ const before = headlineOf(active, cur);
+ if (e.kind === "goal" || e.kind === "goalLoss") {
+ const g = goalOf(e, s);
+ active = [...active.filter((x) => x.key !== g.key), g];
+ } else if (e.kind === "stated" && Number.isFinite(Number(e.value)) && e.value !== null) {
+ cur = Number(e.value);
+ // Met: a reading of his at or under it, said once it was set and by its day. A ">300" says nothing under.
+ if (e.qualifier !== ">") {
+ active = active.filter((g) => {
+ const edge = goalEdge(g);
+ const inTime = !g.deadlineDate || !isIso(e.date) || e.date <= g.deadlineDate;
+ const after = !g.said || !isIso(e.date) || e.date >= g.said;
+ return !(Number.isFinite(edge) && cur <= edge + 1e-9 && inTime && after);
+ });
+ }
+ }
+ // Past its day: missed when his latest weight is over it, else gone without a word.
+ if (recordDate) {
+ const kept = [];
+ for (const g of active) {
+ if (g.deadlineDate && recordDate > g.deadlineDate) {
+ const edge = goalEdge(g);
+ if (Number.isFinite(edge) && Number.isFinite(cur) && cur > edge) {
+ misses.push({ ...g, at: e.t, wasHeadline: before?.row === g.row });
+ }
+ } else kept.push(g);
+ }
+ active = kept;
+ }
+ points.push({ t: e.t, active: [...active], headline: headlineOf(active, cur), cur });
+ }
+ // Every second the board changes: each step, and each missed goal's end.
+ const times = [...new Set([...points.map((p) => p.t), ...misses.map((m) => r4(m.at + hold))])].sort((a, b) => a - b);
+ const at = (t) => {
+ let p = points[0];
+ for (const q of points) if (q.t <= t + 1e-9) p = q; else break;
+ return p;
+ };
+ const out = [];
+ for (const t of times) {
+ const p = at(t);
+ const b = { t, active: p.active, headline: p.headline, missed: misses.filter((m) => m.at <= t + 1e-9 && t < m.at + hold - 1e-9), cur: p.cur };
+ if (!out.length || !sameBoard(out[out.length - 1], b)) out.push(b);
+ }
+ return out;
+}
+
+/** The board at cut second `t` (goalBoard's state in force then). */
+export function goalsAt(board, t) {
+ let b = board[0] ?? { t: 0, active: [], headline: null, missed: [], cur: null };
+ for (const x of board) if (x.t <= t + 1e-9) b = x; else break;
+ return b;
+}
diff --git a/umtool/report-to-video/measure-goals.test.mjs b/umtool/report-to-video/measure-goals.test.mjs
@@ -0,0 +1,145 @@
+// The goal board (measure-goals.mjs) and how the dial draws it
+// (chrome-instruments.mjs): every goal in force, the closest as the headline,
+// a newer goal of the same horizon replacing the older, a goal met or past its
+// day leaving -- missed, struck in red a moment, when his weight is over it.
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import { boardGoalWords, dialHtml, goalLines, goalMarks } from "./chrome-instruments.mjs";
+import { estimateSchedule } from "./deck.mjs";
+import { frameKeys } from "./frame-keys.mjs";
+import { MISS_HOLD, goalBoard, goalNeed, goalsAt, headlineOf } from "./measure-goals.mjs";
+
+const FPS = 30;
+const SCALE = { min: 220, max: 400 };
+const fonts = { DeckSans: "assets/DeckSans.ttf", DeckSansBold: "assets/DeckSansBold.ttf" };
+
+/** A measure from events: each state after it, its `goal` the resolution of a goalLoss when `resolved` names one. */
+function measureOf(events) {
+ const state = [{ t: 0 }];
+ for (const e of events) state.push({ t: e.t, ...(e.resolved ? { goal: { row: e.row, value: e.resolved, loss: Math.abs(e.value) } } : {}) });
+ return { scale: SCALE, events: events.map(({ resolved, ...e }) => e), state };
+}
+const stated = (t, row, date, value, qualifier = null) => ({ t, row, date, kind: "stated", value, qualifier });
+const goal = (t, row, date, value, extra = {}) => ({ t, row, date, kind: "goal", value, ...extra });
+const loss = (t, row, date, value, resolved, extra = {}) => ({ t, row, date, kind: "goalLoss", value, resolved, ...extra });
+
+const rows = (b) => b.active.map((g) => g.row);
+
+test("a ladder of three: each in force, the CLOSEST the headline -- not the most ambitious, not the latest", () => {
+ const m = measureOf([
+ stated(1, "s1", "2026-01-09", 337),
+ goal(2, "g1", "2026-01-16", 320, { asOf: "2026-04-01" }), // by his birthday: 17 to go
+ loss(3, "g2", "2026-01-16", -75, 262, { deadline: "by the end of 2026" }), // 75 to go
+ goal(4, "g3", "2026-01-16", 240), // eventual: 97 to go
+ ]);
+ const board = goalBoard(m);
+ const end = goalsAt(board, 10);
+ assert.deepEqual(rows(end), ["g1", "g2", "g3"]);
+ assert.equal(end.headline.row, "g1");
+ assert.equal(end.headline.deadlineDate, "2026-04-01", "a goal's asOf is the day it is for");
+ assert.equal(end.active[1].deadlineDate, "2026-12-31", "his deadline words, read");
+ assert.equal(goalNeed(end.active[1], 337), 75);
+ // Each step on its own second.
+ assert.equal(goalsAt(board, 2.5).headline.row, "g1");
+ assert.deepEqual(rows(goalsAt(board, 3.5)), ["g1", "g2"]);
+ // The words: the headline's, with its day.
+ assert.equal(boardGoalWords(end.headline), "GOAL 320 · BY APR 2026");
+ assert.equal(boardGoalWords(end.active[1]), "GOAL 262 · BY THE END OF 2026");
+ assert.equal(boardGoalWords(end.active[2]), "GOAL 240");
+});
+
+test("ties go to the soonest deadline, then the latest set; a goal with no weight ranks by its loss", () => {
+ const a = { row: "a", t: 1, target: 300, deadlineDate: "2026-12-25" };
+ const b = { row: "b", t: 2, target: 300, deadlineDate: "2026-06-01" };
+ const c = { row: "c", t: 3, target: 300, deadlineDate: null };
+ assert.equal(headlineOf([a, b, c], 320).row, "b");
+ assert.equal(headlineOf([a, c], 320).row, "a", "undated last");
+ assert.equal(headlineOf([{ ...c, row: "c1", t: 1 }, { ...c, row: "c2", t: 2 }], 320).row, "c2", "then the latest set");
+ const unresolved = { row: "u", t: 1, target: null, loss: 15, deadlineDate: null };
+ assert.equal(headlineOf([a, unresolved], 320).row, "u", "15 to lose beats 20");
+ // Before any stated weight a goal's own loss is all there is; a weight already under reach ranks after any still ahead.
+ assert.equal(goalNeed({ target: 250, loss: 50 }, null), 50);
+ assert.equal(headlineOf([{ row: "met", t: 1, target: 330 }, { row: "ahead", t: 2, target: 300 }], 320).row, "ahead");
+});
+
+test("a newer goal of the same horizon replaces the older: the same day, the same words, or both undated", () => {
+ const m = measureOf([
+ goal(1, "a", "2025-08-15", 275, { asOf: "2026-04-01" }),
+ goal(2, "b", "2026-01-16", 320, { asOf: "2026-04-01" }),
+ goal(3, "c", "2026-01-16", 240),
+ goal(4, "d", "2026-01-17", 250),
+ loss(5, "e", "2026-01-18", -80, 211, { deadline: "by my birthday" }),
+ loss(6, "f", "2026-01-18", -90, 201, { deadline: "By my birthday" }),
+ ]);
+ assert.deepEqual(rows(goalsAt(goalBoard(m), 10)), ["b", "d", "f"]);
+});
+
+test("a goal met in time leaves quietly; one past its day with his weight over it is MISSED, held, then gone", () => {
+ const m = measureOf([
+ stated(1, "s1", "2026-01-09", 337),
+ goal(2, "g1", "2026-01-16", 320, { asOf: "2026-04-01" }),
+ goal(3, "g2", "2026-01-16", 330, { due: "2026-03-01" }),
+ goal(4, "g3", "2026-01-16", 240),
+ stated(5, "s2", "2026-02-10", 329), // meets g2 (330) by its day
+ stated(10, "s3", "2026-05-02", 326), // past g1's day (Apr 2026), over 320: MISSED
+ stated(30, "s4", "2026-06-01", 238.5, "<"), // meets the eventual 240
+ ]);
+ const board = goalBoard(m);
+ assert.deepEqual(rows(goalsAt(board, 6)), ["g1", "g3"], "g2 met");
+ assert.equal(goalsAt(board, 6).headline.row, "g1");
+ const miss = goalsAt(board, 10);
+ assert.deepEqual(rows(miss), ["g3"]);
+ assert.deepEqual(miss.missed.map((g) => [g.row, g.at, g.wasHeadline]), [["g1", 10, true]]);
+ assert.equal(miss.headline.row, "g3");
+ assert.equal(goalsAt(board, 10 + MISS_HOLD - 0.01).missed.length, 1);
+ assert.equal(goalsAt(board, 10 + MISS_HOLD).missed.length, 0, "held MISS_HOLD s, then gone");
+ assert.deepEqual(rows(goalsAt(board, 31)), [], "met");
+ assert.equal(goalsAt(board, 31).missed.length, 0, "a goal met is no miss");
+ // The line under the digits says the miss while it is held, then the next headline.
+ const lines = goalLines(board);
+ const lineAt = (t) => [...lines].reverse().find((l) => l.t <= t);
+ assert.deepEqual(lineAt(11), { t: 10, words: "MISSED 320 · BY APR 2026", missed: true });
+ assert.equal(lineAt(17).words, "GOAL 240");
+ // A day passed with his latest weight UNDER the goal (a reading after the day): no miss, it leaves quietly.
+ const late = goalBoard(measureOf([stated(1, "s1", "2026-01-09", 337), goal(2, "g1", "2026-01-16", 320, { asOf: "2026-04-01" }), stated(3, "s2", "2026-07-05", 300)]));
+ assert.deepEqual(goalsAt(late, 4), { ...goalsAt(late, 4), active: [], missed: [] });
+});
+
+test("seek-safe: the board at t is a pure function of the measure, and the dial's marks read it from either side", () => {
+ const m = measureOf([
+ stated(1, "s1", "2026-01-09", 337),
+ goal(2, "g1", "2026-01-16", 320, { asOf: "2026-04-01" }),
+ goal(3, "g2", "2026-01-16", 240),
+ goal(4, "g3", "2026-01-16", 225, { range: [220, 230], due: "2027-01-01" }),
+ stated(6, "s2", "2026-05-02", 326),
+ ]);
+ assert.deepEqual(goalBoard(m), goalBoard(structuredClone(m)));
+ const board = goalBoard(m);
+ const marks = goalMarks(board, SCALE);
+ assert.deepEqual(marks.map((x) => x.goal.row), ["g1", "g2", "g3"]);
+ assert.equal(marks[2].band, true);
+ const statusAt = (x, t) => [...x.states].reverse().find((s) => s.t <= t)?.status;
+ assert.deepEqual(marks.map((x) => statusAt(x, 3.5)), ["head", "other", "off"]);
+ assert.deepEqual(marks.map((x) => statusAt(x, 6.5)), ["missed", "head", "other"]);
+ assert.deepEqual(marks.map((x) => statusAt(x, 6 + MISS_HOLD + 1)), ["off", "head", "other"]);
+
+ // On the dial's page: the marks' cues, which the frame keys model.
+ const timeline = Array.from({ length: 2 }, (_, i) => ({ type: "clip", id: `c${i + 1}`, video: "v", start: 10 * i, end: 10 * i + 8, cite: 1, section: 0, quote: "q", onscreen: { title: "T" } }));
+ const render = { width: 1920, height: 1080, fps: FPS, palette: {}, chrome: { engine: "hyperframes", layout: "deck", deck: { dial: true, qr: { show: false } } } };
+ const schedule = { ...estimateSchedule({ slug: "m", title: "M", provenance: {}, render, timeline }), measure: m };
+ const html = dialHtml(schedule, render, { fonts });
+ assert.match(html, /data-k="gm0h"/);
+ assert.match(html, /class="goalw miss" data-k="gw\d+"[^>]*>MISSED 320 · BY APR 2026</);
+ const data = JSON.parse(/<script id="dial-data" type="application\/json">(.*?)<\/script>/s.exec(html)[1]);
+ const at = (k, t) => {
+ let v = data.init[k]?.autoAlpha;
+ for (const c of data.cues) if (c.k === k && "autoAlpha" in c.to && c.at + c.dur <= t + 1e-9) v = c.to.autoAlpha;
+ return v;
+ };
+ assert.deepEqual([at("gm0h", 3.5), at("gm1o", 3.5), at("gm0x", 3.5)], [1, 0.85, 0]);
+ assert.deepEqual([at("gm0x", 7), at("gm1h", 7), at("gm0p", 9)], [1, 1, 0]);
+ assert.ok(data.cues.some((c) => c.k === "gm0p" && c.to.autoAlpha === 1), "the miss flashes");
+ const frames = Math.round(schedule.total * FPS);
+ assert.ok(frameKeys({ html, region: "dial", fps: FPS, frames, version: "t" }));
+});
diff --git a/umtool/report-to-video/measure-slice.mjs b/umtool/report-to-video/measure-slice.mjs
@@ -24,13 +24,14 @@ import { chronological, dateKey, daysBetween } from "./ledger-shared.mjs";
import { PROMISE_FORMS, measureDisplay, measureQualifier, measureSchema, measureTotals, plotDate } from "./measure-totals.mjs";
import { goalCell, nextRegime, offOf } from "./panel-model.mjs";
import { offsetIn } from "./gaps.mjs";
+import { validateGhosts } from "./measure-ghosts.mjs";
export const MEASURE_SLICE_VERSION = 1;
export { PROMISE_FORMS };
/** `render.chrome.deck.measure`'s keys. */
-export const MEASURE_SETTINGS_KEYS = Object.freeze(["scopes", "scale", "asOf"]);
+export const MEASURE_SETTINGS_KEYS = Object.freeze(["scopes", "scale", "asOf", "ghosts"]);
const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
const isIso = (v) => typeof v === "string" && /^\d{4}-\d{2}-\d{2}$/.test(v) && !Number.isNaN(Date.parse(`${v}T00:00:00Z`));
@@ -38,16 +39,17 @@ const r1 = (v) => Math.round(v * 10) / 10;
const r3 = (v) => Math.round(v * 1000) / 1000;
/**
- * `render.chrome.deck.measure`, checked: `{ scopes?, scale?, asOf? }` --
+ * `render.chrome.deck.measure`, checked: `{ scopes?, scale?, asOf?, ghosts? }` --
* `scopes` a list of track keys (unique, at least one), `scale` `{ min, max }`
- * (numbers, min < max), `asOf` a date (YYYY-MM-DD). Whether the scopes are
+ * (numbers, min < max), `asOf` a date (YYYY-MM-DD), `ghosts` the dial's claim
+ * ghosts (measure-ghosts.mjs: true, false or their knobs). Whether the scopes are
* the ledger's tracks is measureSettingsProblems' (it has the schema).
*
* @returns {string[]}
*/
export function validateMeasureSettings(v, where = "render.chrome.deck.measure") {
if (v === undefined) return [];
- if (!isObj(v)) return [`${where} must be { scopes, scale, asOf }`];
+ if (!isObj(v)) return [`${where} must be { ${MEASURE_SETTINGS_KEYS.join(", ")} }`];
const errors = [];
for (const k of Object.keys(v)) if (!MEASURE_SETTINGS_KEYS.includes(k)) errors.push(`${where}.${k} is not a measure setting (${MEASURE_SETTINGS_KEYS.join(", ")})`);
if (v.scopes !== undefined) {
@@ -62,6 +64,7 @@ export function validateMeasureSettings(v, where = "render.chrome.deck.measure")
else for (const k of Object.keys(s)) if (k !== "min" && k !== "max") errors.push(`${where}.scale.${k} is not a scale setting (min, max)`);
}
if (v.asOf !== undefined && !isIso(v.asOf)) errors.push(`${where}.asOf must be a date (YYYY-MM-DD)`);
+ errors.push(...validateGhosts(v.ghosts, `${where}.ghosts`));
return errors;
}
diff --git a/umtool/report-to-video/measure-slice.test.mjs b/umtool/report-to-video/measure-slice.test.mjs
@@ -195,7 +195,7 @@ test("the settings: their shape, their scopes against the ledger, and when a cut
assert.deepEqual(validateMeasureSettings(undefined), []);
assert.deepEqual(validateMeasureSettings({ scopes: ["weight"], scale: { min: 220, max: 400 }, asOf: "2026-11-05" }), []);
assert.deepEqual(validateMeasureSettings({ scopes: [], scale: { min: 4, max: 2 }, asOf: "Nov 5", x: 1 }), [
- "render.chrome.deck.measure.x is not a measure setting (scopes, scale, asOf)",
+ "render.chrome.deck.measure.x is not a measure setting (scopes, scale, asOf, ghosts)",
"render.chrome.deck.measure.scopes must be a list of the ledger's track keys (at least one)",
"render.chrome.deck.measure.scale.min must be below scale.max",
"render.chrome.deck.measure.asOf must be a date (YYYY-MM-DD)",
diff --git a/umtool/report-to-video/modules/dial.mjs b/umtool/report-to-video/modules/dial.mjs
@@ -2,9 +2,13 @@
// the instruments' column (instruments.mjs, deck.mjs instrumentsGeometry). A
// red needle swings to every weight he states, on the word, overshoots and
// settles; "almost", "over", "under" draw a wedge; his remembered weights are
-// grey ghost ticks, the latest a long ghost needle with its as-of date; his
-// latest goal an amber tick on the bezel; the 300 lb mark accented; the
-// weight in big digits under the hub. chrome-instruments.mjs writes the page.
+// grey ghost ticks, the latest a long ghost needle with its as-of date; every
+// goal in force a mark on the bezel, the CLOSEST (measure-goals.mjs) the full
+// amber tick with its words, a missed one struck in red; with
+// `deck.measure.ghosts`, a faint tick on the rim for every weight he has
+// claimed, coloured by how often (measure-ghosts.mjs); the 300 lb mark
+// accented; the weight in big digits under the hub. chrome-instruments.mjs
+// writes the page.
import path from "node:path";
import { instrumentsGeometry } from "../deck.mjs";
@@ -21,7 +25,7 @@ export default defineModule({
kind: "overlay-whole",
slot: "instruments",
title: "Scale dial",
- summary: "A bathroom-scale face: the needle swings to each weight he states, his remembered weights as ghosts, his goal on the bezel.",
+ summary: "A bathroom-scale face: the needle swings to each weight he states, his remembered weights as ghosts, every goal in force on the bezel (the closest headlined), and -- with deck.measure.ghosts -- a faint tick for every weight he has claimed.",
configKey: "render.chrome.deck.dial",
defaults: DIAL_DEFAULTS,
validate: settingsOf("dial").validate,
@@ -29,7 +33,7 @@ export default defineModule({
ui: [
{ key: "mark", type: "number", min: 0, max: 2000, step: 1, label: "Accented weight", default: 300 },
{ key: "ghosts", type: "boolean", label: "Remembered weights as ghosts", default: true },
- { key: "goal", type: "boolean", label: "The latest goal on the bezel", default: true },
+ { key: "goal", type: "boolean", label: "Every goal in force on the bezel, the closest headlined", default: true },
{ key: "finale", type: "boolean", label: "Large in the finale", default: true },
{ key: "label", type: "text", label: "Over the digits", default: DIAL_DEFAULTS.label },
{ key: "placement", type: "enum", options: ["column", "corner"], label: "Where the instruments stand", default: "column" },
@@ -40,11 +44,14 @@ export default defineModule({
],
docs: {
heading: "Scale dial",
- intro: "A bathroom-scale face at the top of the instruments' column (the right of the frame; the clip moves to the left -- `instrumentsGeometry`, 1248×702 footage beside a 600 px column at 1920×1080). It reads the schedule's `measure` (the measure ledger's slice): the red needle swings to each STATED weight at its event's `t` (the spoken word) with a spring (`back.out`, 0.9 s) and rests there -- a frame at rest is reused, not captured again; a qualifier draws a wedge in pounds (≈ 3 under to 1 over, `>` 10 up, `<` 10 down); every REMEMBERED weight is a grey tick, the latest a long ghost needle with its as-of date; the latest goal is an amber tick on the bezel and its words under the digits. It comes and goes with the deck (a card, the finale). With any instrument on, the posts stay in the footage box (`posts.shift` does not apply), and the side panel (`threads`, `flips`) and the posts feed are refused.",
+ intro: "A bathroom-scale face at the top of the instruments' column (the right of the frame; the clip moves to the left -- `instrumentsGeometry`, 1248×702 footage beside a 600 px column at 1920×1080). It reads the schedule's `measure` (the measure ledger's slice): the red needle swings to each STATED weight at its event's `t` (the spoken word) with a spring (`back.out`, 0.9 s) and rests there -- a frame at rest is reused, not captured again; a qualifier draws a wedge in pounds (≈ 3 under to 1 over, `>` 10 up, `<` 10 down); every REMEMBERED weight is a grey tick, the latest a long ghost needle with its as-of date. GOALS (measure-goals.mjs `goalBoard`): every goal in force at the playhead is a mark on the bezel at its weight -- in force from the moment the cut shows it until he meets it in time, a newer goal of the same HORIZON replaces it (the same deadline day, the same deadline words, or both undated), or the record's date passes its day. The HEADLINE is the CLOSEST of them -- the least still to lose from his latest stated weight (a range to its top), ties to the soonest deadline -- the full amber tick, its words under the digits (`GOAL 320 · BY APR 2026`); the others a thin amber tick, no words; a range an amber band too. A goal whose day passes with his latest weight over it is MISSED: struck in the needle's red with a red flash, the line under the digits `MISSED 320 · BY APR 2026` for 6 s (`MISS_HOLD`), then gone; a day passing with his weight under it (a reading after the day) leaves quietly. A goal's day: the ledger's `due`, else his `deadline` words read (\"by Christmas\", \"by the end of 2026\"), else the row's `asOf`. Any page that shows a goal reads the same board: `goalBoard(schedule.measure)` -> `[{ t, active, headline, missed, cur }]`, `goalsAt(board, t)`. It comes and goes with the deck (a card, the finale). With any instrument on, the posts stay in the footage box (`posts.shift` does not apply), and the side panel (`threads`, `flips`) and the posts feed are refused.",
rows: [
["`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.ghosts`, `.goal`", "bool · default `true` each (`.goal`: every goal in force, the closest headlined)", "`umtool look <p> deck.dial.ghosts=false`"],
+ ["`deck.measure.ghosts`", "`true` · `{opacity, tolerance, ramp, pulse}` · `false` / absent: off (the default). CLAIM GHOSTS (measure-ghosts.mjs), not `deck.dial.ghosts`: every weight he has claimed so far -- each stated weight the needle goes to and each remembered one, his own, in cut order -- leaves a thin faint tick across the dial's rim at its value, under everything else on the face; a value claimed again (within `tolerance` lb of the tick's first value; an `≈` value as its rounded number; `>300` and `<300` at 300) steps that tick along the `ramp` -- 1× faint, 2× warm, 3× and up hot, a little thicker each step -- and it pulses once as the repeat lands (`pulse`). In the finale every tick stays at its count at the cut's end. Seek-safe: a frame at t draws the claims before t", "`umtool look <p> deck.measure.ghosts=true`"],
+ ["`deck.measure.ghosts.opacity`, `.tolerance`", "0.15–0.9 (the 1× tick's; +0.2 a step, at most 0.95) · 0–5 lb · default `0.5`, `0.5`", "`umtool look <p> deck.measure.ghosts='{\"tolerance\":1}'`"],
+ ["`deck.measure.ghosts.ramp`, `.pulse`", "2–4 #hex, 1× first (the last for every count from there up), or `null`: the palette's muted, amber, and amber half way to the needle's red · bool · default `null`, `true`", "`umtool look <p> deck.measure.ghosts='{\"ramp\":[\"#98a29b\",\"#e8a33f\",\"#f37e47\"],\"pulse\":false}'`"],
["`deck.dial.needle`", "a #hex · default `#ff5a4e`", "`umtool look <p> deck.dial.needle='\"#ff5a4e\"'`"],
["`deck.dial.label`", "words over the digits, ≤ 40 · default `HE SAYS HE WEIGHS`", "`umtool look <p> deck.dial.label='\"…\"'`"],
["`deck.dial.finale`", "bool · default `true`: the dial and the odometer large in the finale (module `dial-finale`)", "`umtool look <p> deck.dial.finale=false`"],