commit caff454ed6843f79e1d11ee196c391175acc74dd
parent 53f6b694cd732e37725d081bd77ad57407780334
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 18:29:15 -0500
umtool: the finale's record plots every weight he gave at the day it applied, with marked peaks
The operator (6 Nov): the heaviest "should indicate his heaviest and be
considered part of the timeline, especially alongside mevsme"; "a timeline
plotting every statement on the date it applied, even past ones, to chart his
claimed trajectory".
- `deck.finale.dietRuns` takes `{ weights, marks, low }` (true is the defaults).
- weights ("applied" default, "said", false): a WEIGHT LAYER over the run bars
on the dial's scale -- every weight-scope row of his with a weight (current,
past; diet-record.mjs weightClaims) at the day it APPLIED (asOf, else date).
Given at the time: solid and joined, his claimed trajectory (a bound like
"over 240" a point with a caret, never joined). Told 30+ days after it
applied: hollow, a thin leader to a tick at the day he said it -- a retold
peak piles up at one period from its tellings. "≈" a ring, a range a bar.
Losses/gains (delta) and "N over" name no weight the ledger resolves: left
out and counted (`record.leftOut`; this video 52 + 11, 35 plotted).
- marks [{row, label, peak?}]: dots at the row's day and value with his words
and the month; THE peak (marked, else the heaviest marked) a size up in the
needle's red. low (default on): the lowest weight he stated -- never a bound,
and of one weigh-in told twice the same day the fuller (291.5, not "291.").
- Room: with the layer the panel is 218 design px; finaleRailAt keeps the
track where its labels put it (no centring) and ("auto") takes the room
under it (up to FINALE_SHARE.max): this video's rail bottom 412 -> 426, the
record (120, 202) 1704x220. The axis now runs from the earliest APPLIED day
(2008's remembered wedding weight), each empty stretch past two years a
marked break (2008–2013, 2013–2018).
Docs (knobs regenerated); tests: the claims and what is left out, the points,
the layer's marks, the validation.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
8 files changed, 311 insertions(+), 40 deletions(-)
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -1809,7 +1809,7 @@ A sticky note per goal on a pile in a corner of the footage box, read off the sc
|---|---|---|
| `deck.goals` | `true` · `false` · `{show, position, x, y, scale, hold, finale, max, color, countdown}` · default on with a measure slice | `umtool look <p> deck.goals=false` |
| `deck.goals.position`, `.x`/`.y`, `.scale` | `top-left` `top-right` `bottom-left` `bottom-right` `top-center` `bottom-center` · design px · 0.5–2 · default `bottom-right`, unset, 1 | `umtool look <p> deck.goals.position=bottom-left` |
-| `deck.goals.position=shelf` | its shelf form (`deck.shelf`): the count of goals set in a column, then the notes fanned sideways like the diet's tags -- the newest in front, landing from above as on the pile; each older one showing its goal's words in the strip beside it (all of each when there is room); a repeat comes to the front with its ×n. The fan takes the shelf's spare width (shelfLayout), up to its notes side by side. On the shelf it stays up from the first goal (`hold` unset). What the dial draws of the goal stays on the dial | `umtool look <p> deck.shelf.items='["diet","goals"]' deck.goals.position=shelf` |
+| `deck.goals.position=shelf` | its shelf form (`deck.shelf`): the count of goals set in a column, then the notes fanned sideways like the diet's tags -- the headline goal in front when the measure state names one (`goals.headline`: the closest goal in force) with "+N more" for the others in force, else the newest; a new goal landing from above as on the pile; each older one showing its goal's words in the strip beside it (all of each when there is room); a repeat comes to the front with its ×n. The fan takes the shelf's spare width (shelfLayout), up to its notes side by side. On the shelf it stays up from the first goal (`hold` unset). What the dial draws of the goal stays on the dial | `umtool look <p> deck.shelf.items='["diet","goals"]' deck.goals.position=shelf` |
| `deck.goals.max`, `.color`, `.countdown` | 1–8 notes · #hex paper · bool · default 4, the palette's amber, `true` | `umtool look <p> deck.goals.max=6` |
| `deck.goals.hold`, `.finale` | 0 (up from the first goal on) or 2–600 s after each · `hide` `show` · default 20, `hide` | `umtool look <p> deck.goals.hold=0` |
| `deck.goals.onPosts`, `.onChapters` | `dodge` `hide` `show` · default `dodge`: while a post item's card (its card, slot and strip as postLayout lays them: the schedule's `covers`) or a chapter band is up where it stands, it moves to a free anchor of the footage box -- a size down to half if it must, never onto another measure extra that is up -- and hides when none fits; `hide` hides, `show` stays over it | `umtool look <p> deck.goals.onPosts=hide` |
@@ -1892,11 +1892,14 @@ The full reference is [The finale](#the-finale-the-timeline-in-primary-view). It
### Diet runs in the finale
-With `deck.finale.dietRuns: true` (and a measure ledger with a regime track), the finale's timeline panel -- under the large rail's track, the rail's width, down to the panel's foot: (120, 286) 1704×122 at 1080p -- carries the WHOLE record of his diets (the measure slice's `record`, diet-record.mjs: every regime row in scope, on camera or not, through the state's own rule): each run a bar in its diet's ink on a time axis from the earliest row; a stretch of more than two years with nothing on record squeezed to a marked break ("2013–2018"), and a run whose end the record does not have fading into it; a row that stopped a diet a grey tick under the bars, one naming the medication (GLP-1) a purple one; his stated weights a light line over the bars, the first and last labelled; the run still going and the longest ones labelled in two rows under the bars where they fit -- the diet's word (the run's own name when its row gives one: "WEIGHT WATCHERS"), its number when the cut showed it ("DIET #6", the shelf's), its dates and its days, the open one "N days and counting" to the in-record date. It sweeps in left to right over 2.6 s after the finale's grow, each label as the sweep reaches it, then holds; it stands clear of the side video, the lower column's instruments and the promise clock. It needs `deck.finale.railLabels` `sections` or `none` (the pips' labels and dates use that space) and at least 100 px under the rail.
+With `deck.finale.dietRuns: true` (and a measure ledger with a regime track), the finale's timeline panel -- under the large rail's track, the rail's width, down to the panel's foot: with the weight layer (120, 202) 1704×220 at 1080p, the track staying where its labels put it and the timeline taking the room under it (up to `FINALE_SHARE.max`); without it 1704×122 -- carries the WHOLE record of his diets (the measure slice's `record`, diet-record.mjs: every regime row in scope, on camera or not, through the state's own rule): each run a bar in its diet's ink on a time axis from the earliest row; a stretch of more than two years with nothing on record squeezed to a marked break ("2013–2018"), and a run whose end the record does not have fading into it; a row that stopped a diet a grey tick under the bars, one naming the medication (GLP-1) a purple one; his stated weights a light line over the bars, the weights the video marks (`marks`: his heaviest as THE peak) and his low as labelled dots on it; the run still going and the longest ones labelled in two rows under the bars where they fit -- the diet's word (the run's own name when its row gives one: "WEIGHT WATCHERS"), its number when the cut showed it ("DIET #6", the shelf's), its dates and its days, the open one "N days and counting" to the in-record date. It sweeps in left to right over 2.6 s after the finale's grow, each label as the sweep reaches it, then holds; it stands clear of the side video, the lower column's instruments and the promise clock. It needs `deck.finale.railLabels` `sections` or `none` (the pips' labels and dates use that space) and at least 100 px under the rail.
| Knob | Range · default | From a terminal |
|---|---|---|
-| `deck.finale.dietRuns` | bool · default `false` | `umtool look <p> deck.finale.dietRuns=true` |
+| `deck.finale.dietRuns` | `true` · `false` · `{weights, marks, low}` · default `false` | `umtool look <p> deck.finale.dietRuns=true` |
+| `deck.finale.dietRuns.weights` | `applied` · `said` · `false` · default `applied`: the WEIGHT LAYER over the bars on the dial's scale (the panel 218 design px, the finale's timeline taking that room under the track) -- every weight he gave (a `current` or `past` row with a number) at the day it APPLIED (its asOf, else its date; `said`: the day he said it). Given at the time: solid, joined -- his claimed trajectory (a bound like "over 240" is a point, not joined). Told 30 days or more after it applied: hollow, with a thin leader to a tick at the day he said it, so a retold weight piles up at one period from its tellings. `>`/`<` a caret, `≈` a ring, a range a bar. A loss or gain (`delta`) and "N over" (`overweight_by`) name no weight the ledger resolves: left out (the record counts them, `record.leftOut`). `false`: the light line of his stated weights alone | `umtool look <p> deck.finale.dietRuns='{"weights":"said"}'` |
+| `deck.finale.dietRuns.marks` | up to 8 `{row, label, peak?}`: a dot on the weight line at the row's day (its asOf, else its date) and value, the label -- his words, at most 60 characters -- and the month beside it; THE peak (the one marked `peak`, else the heaviest marked) a size up in the needle's red. A row the ledger lacks is left out | `umtool look <p> deck.finale.dietRuns='{"marks":[{"row":"w21","label":"his heaviest · \"almost 400\""}]}'` |
+| `deck.finale.dietRuns.low` | `true` · `false` · its label · default `true`: the lowest weight he stated (never a bound like "over 240"; of one weigh-in told twice the same day, the fuller: 291.5 over "291.") marked in the accent, "his low · 291.5" | `umtool look <p> deck.finale.dietRuns='{"low":false}'` |
### Dial finale
diff --git a/umtool/report-to-video/chrome-runs-finale.mjs b/umtool/report-to-video/chrome-runs-finale.mjs
@@ -15,10 +15,11 @@
// PURE: a schedule and a render block in, `{ html, items }` out.
import { formatDeckDate } from "./attribution.mjs";
import { finaleLayout } from "./chrome-finale.mjs";
-import { compileCues, cuePageHtml, esc, INSTANT, r4 } from "./chrome-cues.mjs";
-import { FINALE_MOTION, resolveFinale } from "./finale.mjs";
+import { rgba } from "./chrome-deck.mjs";
+import { compileCues, cuePageHtml, esc, r4 } from "./chrome-cues.mjs";
+import { dietRunsOn, dietRunsWeights, FINALE_MOTION, resolveFinale } from "./finale.mjs";
import { daysBetween, measureOf, shortDate } from "./measure-extras.mjs";
-import { DIET_COLORS, DIET_LABELS, resolveMeasureExtra } from "./modules/measure-extras-settings.mjs";
+import { DIET_COLORS, DIET_LABELS, MEASURE_RED, resolveMeasureExtra } from "./modules/measure-extras-settings.mjs";
/** A stretch with nothing on record longer than this is drawn as a break, days. */
export const RUNS_BREAK_DAYS = 730;
@@ -27,7 +28,9 @@ export const RUNS_MOTION = Object.freeze({ delay: 0.2, sweep: 2.6, label: 0.3 })
/** The panel's least height (1080p px) under the rail; less, and there is no room. */
export const RUNS_MIN_HEIGHT = 100;
-const DESIGN = Object.freeze({ top: 3, weights: 22, barY: 26, barH: 22, rowA: 64, rowB: 93, rowH: 28, years: 12, brk: 44 });
+const DESIGN = Object.freeze({ top: 5, weights: 34, barY: 36, barH: 18, rowA: 68, rowB: 95, rowH: 27, years: 12, brk: 44 });
+/** With the weight layer (`dietRuns.weights`): every weight he gave over the bars, on the dial's scale. */
+const LAYERED = Object.freeze({ ...DESIGN, top: 6, weights: 110, barY: 118, rowA: 152, rowB: 180 });
/** The record the slice carries, when the finale asks for it. */
export const recordOf = (schedule) => {
@@ -102,6 +105,9 @@ export function runsFinaleHtml(schedule, render, window, opts = {}) {
const geo = runsFinaleGeometry(schedule, render);
if (!m || !rec || !geo) throw new Error("runs-finale: needs a finale, the measure slice's diet record (render.chrome.deck.finale.dietRuns) and room under the rail");
const pal = render.palette;
+ // The weight layer (`dietRuns.weights`): every weight he gave, at the day it applied (or was said).
+ const layer = dietRunsWeights(resolveFinale(render).dietRuns);
+ const D = layer ? LAYERED : DESIGN;
const s = (render.width ?? 1920) / 1920;
const px = (v) => Math.max(1, Math.round(v * s));
const cfg = resolveMeasureExtra("diet", render) ?? resolveMeasureExtra("diet", { chrome: { deck: {} } });
@@ -109,8 +115,11 @@ export function runsFinaleHtml(schedule, render, window, opts = {}) {
const labels = { ...DIET_LABELS, ...(cfg?.labels ?? {}) };
const W = geo.width, H = geo.height;
const today = recordDate(m);
- const dates = [rec.from, ...rec.runs.flatMap((r) => [r.since, r.end]), ...rec.marks.map((x) => x.date), ...rec.weights.map((w) => w.date), today].filter(Boolean);
- const A = runsAxis(dates, W, { brk: px(DESIGN.brk), pad: px(8) });
+ const points = Array.isArray(rec.points) ? rec.points : [];
+ const claims = layer && Array.isArray(rec.claims) ? rec.claims : [];
+ const dates = [rec.from, ...rec.runs.flatMap((r) => [r.since, r.end]), ...rec.marks.map((x) => x.date), ...rec.weights.map((w) => w.date), ...points.map((p) => p.date),
+ ...claims.flatMap((c) => [c.applied, c.said]), today].filter(Boolean);
+ const A = runsAxis(dates, W, { brk: px(D.brk), pad: px(layer ? 34 : 8) });
// The number the cut gave a diet (the shelf's "DIET #6"): its state's, by regime and since.
const shownN = new Map();
for (const st of m.state ?? []) if (st?.diet?.since) shownN.set(`${st.diet.regime}|${st.diet.since}`, st.diet.n);
@@ -146,18 +155,44 @@ export function runsFinaleHtml(schedule, render, window, opts = {}) {
rows[row].push({ x: lx, w });
placed.push({ r, row, x: lx, w, l1, l2 });
}
- // THE WEIGHTS: a light line over the bars, the first and the last labelled.
+ // THE WEIGHTS. Without the layer: a light line of his stated weights over the bars. With it (`weights`):
+ // EVERY weight he gave on the dial's scale -- at the day it applied ("applied") or was said ("said") -- the ones
+ // he gave at the time solid and joined (his claimed trajectory; a bound is no reading, so not joined), the ones told later hollow with a thin leader
+ // down to the day he said it, so a retold peak piles up at one period from its tellings; a bound (">") a caret
+ // over its point, an "about" (≈) a ring round it, a range a bar.
const ws = rec.weights.filter((w) => w.date);
- const vals = ws.map((w) => w.value);
- const lo = Math.min(...vals), hi = Math.max(...vals);
- const wy = (v) => r4(px(DESIGN.top) + (hi > lo ? (hi - v) / (hi - lo) : 0.5) * px(DESIGN.weights - 4));
- const pts = ws.map((w) => [r4(A.x(w.date)), wy(w.value)]);
+ const scale = m.scale ?? {};
+ const vals = layer ? [...claims.map((c) => c.value), ...points.map((p) => p.value)] : [...ws.map((w) => w.value), ...points.map((p) => p.value)];
+ const lo = layer ? Math.min(Number.isFinite(scale.min) ? scale.min : Infinity, ...vals) : Math.min(...vals);
+ const hi = layer ? Math.max(Number.isFinite(scale.max) ? scale.max : -Infinity, ...vals) : Math.max(...vals);
+ const wy = (v) => r4(px(D.top) + (hi > lo ? (hi - v) / (hi - lo) : 0.5) * px(D.weights - D.top - 4));
+ const xOfClaim = (c) => r4(A.x(layer === "said" ? c.said : c.applied));
+ const line = layer
+ ? claims.filter((c) => !c.retold && !["<", ">"].includes(c.qualifier)).map((c) => [xOfClaim(c), wy(c.value)])
+ : ws.map((w) => [r4(A.x(w.date)), wy(w.value)]);
+ const pts = line;
const segs = [];
for (let i = 1; i < pts.length; i += 1) {
const broken = A.breaks.some((b) => pts[i - 1][0] <= b.x0 + 1 && pts[i][0] >= b.x1 - 1);
if (!broken) segs.push(`M${pts[i - 1][0]},${pts[i - 1][1]}L${pts[i][0]},${pts[i][1]}`);
}
- const wtext = (w, anchor) => `<div class="wl" style="left:${r4(anchor === "end" ? A.x(w.date) - px(60) : A.x(w.date) + px(5))}px;top:${r4(wy(w.value) - px(7))}px;text-align:${anchor === "end" ? "right" : "left"}">${esc(String(w.value))}</div>`;
+ const axisY = px(D.barY + D.barH + 1);
+ const grid = layer
+ ? [250, 300, 350, 400].filter((v) => v >= lo && v <= hi).map((v) => `<div class="gl" style="top:${wy(v)}px"></div><div class="gv" style="top:${r4(wy(v) - px(7))}px">${v}</div>`).join("")
+ : "";
+ const claimSvg = layer
+ ? claims.map((c) => {
+ const x = xOfClaim(c);
+ const y = wy(c.value);
+ const leader = c.retold && layer === "applied" ? `<path d="M${x},${y}L${r4(A.x(c.said))},${axisY}" class="ldr"/><path d="M${r4(A.x(c.said))},${axisY - px(4)}V${axisY + px(3)}" class="said"/>` : "";
+ const range = c.range ? `<path d="M${x},${wy(Math.max(...c.range))}V${wy(Math.min(...c.range))}" class="rg"/>` : "";
+ const dot = c.retold ? `<circle cx="${x}" cy="${y}" r="${px(3.2)}" class="hol"/>` : `<circle cx="${x}" cy="${y}" r="${px(2.8)}" class="sol"/>`;
+ const q = c.qualifier === "≈" ? `<circle cx="${x}" cy="${y}" r="${px(6)}" class="apx"/>`
+ : c.qualifier === ">" ? `<path d="M${r4(x - px(4))},${r4(y - px(5))}L${x},${r4(y - px(9))}L${r4(x + px(4))},${r4(y - px(5))}" class="car"/>`
+ : c.qualifier === "<" ? `<path d="M${r4(x - px(4))},${r4(y + px(5))}L${x},${r4(y + px(9))}L${r4(x + px(4))},${r4(y + px(5))}" class="car"/>` : "";
+ return `${leader}${range}${dot}${q}`;
+ }).join("")
+ : "";
// The motion: the panel sweeps open left to right, each label coming in as the sweep reaches it.
const fps = schedule.fps ?? render.fps ?? 30;
const from = r4(Number(window.from));
@@ -170,14 +205,31 @@ export function runsFinaleHtml(schedule, render, window, opts = {}) {
{ k: "rv", at: t0, dur: RUNS_MOTION.sweep, to: { width: W }, ease: "none" },
];
const items = [];
+ // THE MARKED WEIGHTS (`dietRuns.marks`, the low): a dot at the day it was his weight, his words and the month
+ // beside it -- THE peak in the needle's red, a size up; the low in the accent.
+ const pointHtml = points.map((p, j) => {
+ const key = `p${j}`;
+ const x = r4(A.x(p.date));
+ const y = wy(p.value);
+ const text = `${p.label}${p.label ? " · " : ""}${shortDate(p.date, { year: true }).replace(/^\d+ /, "")}`;
+ const w = Math.ceil(text.length * px(p.kind === "peak" ? 13 : 12) * 0.56) + px(12);
+ const left = x + px(10) + w <= W ? x + px(10) : x - px(10) - w;
+ const top = Math.max(0, Math.min(px(D.weights) - px(14), Math.round(y - px(8))));
+ init[key] = { autoAlpha: 0 };
+ ev.push({ k: key, at: t0 + RUNS_MOTION.sweep * Math.min(1, x / W), dur: RUNS_MOTION.label, to: { autoAlpha: 1 }, ease: "power1.out" });
+ const html = `<div class="pt ${p.kind}" data-k="${key}"><div class="pd" style="left:${x}px;top:${y}px"></div>` +
+ `<div class="pl" style="left:${r4(left)}px;top:${top}px;width:${w}px;${left < x ? "text-align:right;" : ""}"><span>${esc(text)}</span></div></div>`;
+ items.push({ key, gate: [key, "autoAlpha"], html });
+ return html;
+ });
const labelHtml = placed.map((p, j) => {
const key = `l${j}`;
init[key] = { autoAlpha: 0 };
const at = t0 + RUNS_MOTION.sweep * Math.min(1, (p.r.x0 + p.r.x1) / 2 / W);
ev.push({ k: key, at, dur: RUNS_MOTION.label, to: { autoAlpha: 1 }, ease: "power1.out" });
- const top = px(p.row ? DESIGN.rowB : DESIGN.rowA);
+ const top = px(p.row ? D.rowB : D.rowA);
const lead = Math.round((p.r.x0 + p.r.x1) / 2);
- const html = `<div class="lb" data-k="${key}"><div class="ld" style="left:${lead}px;top:${px(DESIGN.barY + DESIGN.barH)}px;height:${top - px(DESIGN.barY + DESIGN.barH)}px;background:${p.r.color}"></div>` +
+ const html = `<div class="lb" data-k="${key}"><div class="ld" style="left:${lead}px;top:${px(D.barY + D.barH)}px;height:${top - px(D.barY + D.barH)}px;background:${p.r.color}"></div>` +
`<div class="lt" style="left:${p.x}px;top:${top}px;width:${p.w}px;${p.x + p.w >= W - 1 ? "text-align:right;" : ""}"><div class="l1" style="color:${p.r.color}">${esc(p.l1)}</div><div class="l2">${esc(p.l2)}</div></div></div>`;
items.push({ key, gate: [key, "autoAlpha"], html });
return html;
@@ -190,20 +242,37 @@ export function runsFinaleHtml(schedule, render, window, opts = {}) {
#pn { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
#rv { position: absolute; left: 0; top: 0; height: ${H}px; overflow: hidden; }
#rw { position: absolute; left: 0; top: 0; width: ${W}px; height: ${H}px; }
- .bar { position: absolute; top: ${px(DESIGN.barY)}px; height: ${px(DESIGN.barH)}px; background: var(--c); border-radius: ${px(2)}px;
+ .bar { position: absolute; top: ${px(D.barY)}px; height: ${px(D.barH)}px; background: var(--c); border-radius: ${px(2)}px;
box-shadow: inset 0 ${px(-3)}px 0 rgba(0, 0, 0, 0.18); }
.bar.fd { background: linear-gradient(90deg, var(--c) 0%, var(--c) 55%, transparent 100%); }
.bar.op { box-shadow: 0 0 ${px(10)}px var(--c); }
- .ax { position: absolute; left: 0; width: ${W}px; top: ${px(DESIGN.barY + DESIGN.barH + 1)}px; height: ${px(2)}px; background: ${pal.muted}; opacity: 0.45; }
- .mk { position: absolute; top: ${px(DESIGN.barY + DESIGN.barH + 2)}px; width: ${px(2)}px; height: ${px(6)}px; margin-left: ${px(-1)}px; background: ${pal.muted}; }
+ .ax { position: absolute; left: 0; width: ${W}px; top: ${px(D.barY + D.barH + 1)}px; height: ${px(2)}px; background: ${pal.muted}; opacity: 0.45; }
+ .mk { position: absolute; top: ${px(D.barY + D.barH + 2)}px; width: ${px(2)}px; height: ${px(6)}px; margin-left: ${px(-1)}px; background: ${pal.muted}; }
.mk.med { background: ${colors.glp1 ?? "#B168C6"}; height: ${px(8)}px; }
- .bk { position: absolute; top: ${px(DESIGN.barY - 4)}px; height: ${px(DESIGN.barH + 10)}px; display: flex; align-items: center; justify-content: center;
+ .bk { position: absolute; top: ${px(D.barY - 4)}px; height: ${px(D.barH + 10)}px; display: flex; align-items: center; justify-content: center;
background: repeating-linear-gradient(115deg, transparent 0 ${px(5)}px, ${pal.muted}55 ${px(5)}px ${px(7)}px); }
.bk span { font-family: 'DeckSansBold', sans-serif; font-size: ${px(10)}px; color: ${pal.fg}; background: ${pal.bg}; padding: 0 ${px(3)}px; white-space: nowrap; }
- .yt { position: absolute; top: ${px(DESIGN.barY - 4)}px; width: 1px; height: ${px(DESIGN.barH + 8)}px; background: ${pal.muted}; opacity: 0.5; }
- .yl { position: absolute; top: ${px(DESIGN.barY + DESIGN.barH + 4)}px; font-size: ${px(DESIGN.years)}px; line-height: ${px(14)}px; color: ${pal.muted}; }
+ .yt { position: absolute; top: ${px(D.barY - 4)}px; width: 1px; height: ${px(D.barH + 8)}px; background: ${pal.muted}; opacity: 0.5; }
+ .yl { position: absolute; top: ${px(D.barY + D.barH + 4)}px; font-size: ${px(D.years)}px; line-height: ${px(14)}px; color: ${pal.muted}; }
svg.wt { position: absolute; left: 0; top: 0; overflow: visible; }
- .wl { position: absolute; width: ${px(55)}px; font-family: 'DeckSansBold', sans-serif; font-size: ${px(11)}px; line-height: ${px(14)}px; color: ${pal.fg}; opacity: 0.8; }
+ svg.wt .sol { fill: ${pal.fg}; }
+ svg.wt .hol { fill: ${pal.bg}; stroke: ${pal.fg}; stroke-opacity: 0.75; stroke-width: ${px(1.5)}; }
+ svg.wt .apx { fill: none; stroke: ${pal.amber ?? pal.fg}; stroke-opacity: 0.8; stroke-width: ${px(1)}; }
+ svg.wt .car { fill: none; stroke: ${pal.amber ?? pal.fg}; stroke-width: ${px(1.5)}; }
+ svg.wt .ldr { stroke: ${pal.fg}; stroke-opacity: 0.22; stroke-width: ${px(1)}; fill: none; }
+ svg.wt .said { stroke: ${pal.fg}; stroke-opacity: 0.6; stroke-width: ${px(1.5)}; }
+ svg.wt .rg { stroke: ${pal.fg}; stroke-opacity: 0.6; stroke-width: ${px(2)}; }
+ .gl { position: absolute; left: ${px(30)}px; right: 0; height: 1px; background: ${pal.muted}; opacity: 0.18; }
+ .gv { position: absolute; left: 0; width: ${px(26)}px; text-align: right; font-size: ${px(11)}px; line-height: ${px(14)}px; color: ${pal.muted}; }
+ .pt { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
+ .pd { position: absolute; width: ${px(7)}px; height: ${px(7)}px; margin: ${px(-3.5)}px 0 0 ${px(-3.5)}px; border-radius: 50%; background: ${pal.fg};
+ box-shadow: 0 0 0 ${px(2)}px ${pal.bg}; }
+ .pl { position: absolute; white-space: nowrap; font-family: 'DeckSansBold', sans-serif; font-size: ${px(12)}px; line-height: ${px(14)}px; color: ${pal.fg}; }
+ .pl span { background: ${rgba(pal.bg, 0.85)}; padding: 0 ${px(3)}px; border-radius: ${px(3)}px; }
+ .peak .pd { width: ${px(11)}px; height: ${px(11)}px; margin: ${px(-5.5)}px 0 0 ${px(-5.5)}px; background: ${MEASURE_RED}; box-shadow: 0 0 0 ${px(2)}px ${pal.bg}, 0 0 ${px(10)}px ${MEASURE_RED}; }
+ .peak .pl { font-size: ${px(13)}px; color: ${MEASURE_RED}; }
+ .low .pd { background: ${pal.accent}; }
+ .low .pl { color: ${pal.accent}; }
.lb { position: absolute; inset: 0; visibility: hidden; opacity: 0; }
.ld { position: absolute; width: ${px(2)}px; margin-left: ${px(-1)}px; opacity: 0.7; }
.lt { position: absolute; white-space: nowrap; }
@@ -212,11 +281,11 @@ export function runsFinaleHtml(schedule, render, window, opts = {}) {
`;
const body = `<div id="pn" data-k="pn">
<div id="rv" data-k="rv"><div id="rw">
- <svg class="wt" width="${W}" height="${px(DESIGN.weights + 2)}"><path d="${segs.join("")}" fill="none" stroke="${pal.fg}" stroke-opacity="0.45" stroke-width="${px(2)}"/>${pts.map(([x, y]) => `<circle cx="${x}" cy="${y}" r="${px(2)}" fill="${pal.fg}" fill-opacity="0.7"/>`).join("")}</svg>
- ${ws.length ? wtext(ws[0], "start") + wtext(ws[ws.length - 1], "end") : ""}
+ ${grid}<svg class="wt" width="${W}" height="${H}"><path d="${segs.join("")}" fill="none" stroke="${pal.fg}" stroke-opacity="${layer ? 0.7 : 0.45}" stroke-width="${px(2)}"/>${layer ? claimSvg : pts.map(([x, y]) => `<circle cx="${x}" cy="${y}" r="${px(2)}" fill="${pal.fg}" fill-opacity="0.7"/>`).join("")}</svg>
${years}<div class="ax"></div>${bars}${marks}${breaks}
</div></div>
${labelHtml.join("\n ")}
+ ${pointHtml.join("\n ")}
</div>`;
const { cues } = compileCues(init, ev);
return {
@@ -226,4 +295,4 @@ export function runsFinaleHtml(schedule, render, window, opts = {}) {
}
/** Is the detailed finale asked for (`deck.finale.dietRuns`)? */
-export const runsFinaleWanted = (render) => resolveFinale(render).dietRuns === true;
+export const runsFinaleWanted = (render) => dietRunsOn(resolveFinale(render).dietRuns);
diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs
@@ -58,7 +58,7 @@ import { overlayPointsOf, resolveStats, statsSchedule, statsWanted, validateStat
import { fxOn, fxSchedule, validateFx } from "./fx.mjs";
import { estimatedNarratedCardSeconds, hasNarration } from "./narration.mjs";
import {
- aboveTop, FINALE_MOTION, FINALE_SHARE, finaleClaims, finaleClaimSlots, finaleGeometry, finaleRunOf, finaleRunProblems,
+ aboveTop, dietRunsPanel, FINALE_MOTION, FINALE_SHARE, finaleClaims, finaleClaimSlots, finaleGeometry, finaleRunOf, finaleRunProblems,
railLabelLayout, railMarkerLayout, resolveFinale, textWidth as finaleTextWidth, validateFinaleSettings,
} from "./finale.mjs";
import {
@@ -2055,12 +2055,18 @@ function finaleRailAt(schedule, render, railBottom, textScale) {
if (typeof f.timelineShare === "number") B = Math.round(H * f.timelineShare) - py(36);
else B = Math.max(rail.bottom, Math.min(Math.round(H * FINALE_SHARE.auto) - py(36), want));
}
+ // The finale's diet record (`dietRuns`, chrome-runs-finale.mjs) stands under the track: the track stays where
+ // its labels put it, and ("auto") the timeline takes the room the record needs under it, up to FINALE_SHARE.max.
+ const runsPanel = dietRunsPanel(f.dietRuns);
+ if (runsPanel && !Number.isFinite(railBottom) && typeof f.timelineShare !== "number") {
+ B = Math.max(B, Math.min(Math.round(H * FINALE_SHARE.max) - py(36), Yneed + py(26 + runsPanel + 6)));
+ }
const geo = B === rail.bottom ? base : geoAt(B);
// The labels again, cut to the room under the track; the track moves down
// by half of what they leave.
labels = labelsAt(xs, { ...geo, rail: { ...geo.rail, y: Yneed } });
const low = lowOf(labels, Yneed, false);
- const Y = Yneed + Math.max(0, Math.floor((B - low) / 2));
+ const Y = runsPanel ? Yneed : Yneed + Math.max(0, Math.floor((B - low) / 2));
return { geo, x0, xs, pips, labels, marks, claims, Y, railBottom: B, want, textScale, lay, fxs, pipped, bigSize, bigV, footSize };
}
diff --git a/umtool/report-to-video/diet-record.mjs b/umtool/report-to-video/diet-record.mjs
@@ -41,7 +41,7 @@ export function runName(display, regime) {
* @param {string | null} regimeTrack the regime track's key
* @param {any[]} readings his weight rows (current and past)
*/
-export function dietRecord(own, schema, regimeTrack, readings = []) {
+export function dietRecord(own, schema, regimeTrack, readings = [], opts = {}) {
if (!regimeTrack) return null;
const off = offOf(schema, regimeTrack)?.key ?? null;
const regimes = new Map((schema.regimes ?? []).map((r) => [r.key, r]));
@@ -72,6 +72,85 @@ export function dietRecord(own, schema, regimeTrack, readings = []) {
.map((r) => ({ date: plotDate(r), value: Number(r.value) }))
.filter((w) => w.date)
.sort((a, b) => dateKey(a.date).localeCompare(dateKey(b.date)));
- const dates = [...runs.flatMap((r) => [r.since, r.end]), ...marks.map((m) => m.date), ...weights.map((w) => w.date)].filter(Boolean).map(dateKey).sort();
- return { from: dates[0] ?? null, to: dates[dates.length - 1] ?? null, runs, marks, weights };
+ const points = recordPoints(own, readings, opts);
+ const { claims, leftOut } = weightClaims(own);
+ const dates = [...runs.flatMap((r) => [r.since, r.end]), ...marks.map((m) => m.date), ...weights.map((w) => w.date), ...points.map((p) => p.date)]
+ .filter(Boolean).map(dateKey);
+ for (const c of claims) dates.push(dateKey(c.applied), dateKey(c.said));
+ dates.sort();
+ return { from: dates[0] ?? null, to: dates[dates.length - 1] ?? null, runs, marks, weights, points, claims, leftOut };
+}
+
+/** A claim told at least this many days after the day it applied is drawn as told later (a retelling). */
+export const RETOLD_DAYS = 30;
+
+/**
+ * EVERY weight he gave, at the day it APPLIED: each weight-scope row of his
+ * with a number that is a weight -- what he weighs now (`current`) and what he
+ * weighed (`past`) -- `{ row, value, applied, said, retold, qualifier, range,
+ * population }`, `applied` its asOf (else its date), `said` its date, `retold`
+ * when he said it RETOLD_DAYS or more after it applied. A loss or gain
+ * (`delta`) or "N over" (`overweight_by`) names no weight the ledger resolves,
+ * so it is left out and counted (`leftOut`, by population); goals and promises
+ * are not weights.
+ */
+export function weightClaims(own) {
+ const claims = [];
+ const leftOut = {};
+ for (const r of own) {
+ if (r.scope !== "weight") continue;
+ const value = Number(r.value);
+ if (r.population === "current" || r.population === "past") {
+ const said = r.date ?? null;
+ const applied = r.asOf ?? r.date ?? null;
+ if (!Number.isFinite(value) || !applied) { leftOut[r.population] = (leftOut[r.population] ?? 0) + 1; continue; }
+ const late = said && applied && dateKey(applied) < dateKey(said) && (Date.parse(dateKey(said)) - Date.parse(dateKey(applied))) / 86400000 >= RETOLD_DAYS;
+ claims.push({
+ row: r.id, value, applied: dateKey(applied), said: said ? dateKey(said) : dateKey(applied), retold: !!late,
+ qualifier: typeof r.qualifier === "string" ? r.qualifier : null,
+ range: Array.isArray(r.range) && r.range.length === 2 ? r.range.map(Number) : null,
+ population: r.population,
+ });
+ } else if ((r.population === "delta" || r.population === "overweight_by") && Number.isFinite(value)) {
+ leftOut[r.population] = (leftOut[r.population] ?? 0) + 1;
+ }
+ }
+ claims.sort((a, b) => a.applied.localeCompare(b.applied) || a.said.localeCompare(b.said));
+ return { claims, leftOut };
+}
+
+/**
+ * The annotated weights on the record's line (`deck.finale.dietRuns.marks`):
+ * each named row at the day it was his weight (its asOf, else its date) and its
+ * value, with the author's label -- his words -- `kind` "peak" for THE peak (the
+ * one marked `peak`, else the heaviest marked), "mark" else; and, unless `low`
+ * is false, the lowest weight he stated at the time, "low" (its label `low`
+ * when it is words, else "his low · <value>") -- never a bound ("over 240"),
+ * and of one weigh-in told twice the same day ("291." and "291.5") the fuller.
+ * A row the ledger lacks, or with no number, is left out.
+ *
+ * @returns {Array<{ row: string, date: string, value: number, label: string, kind: "peak" | "mark" | "low" }>}
+ */
+export function recordPoints(own, readings, { marks = [], low = true } = {}) {
+ const byId = new Map(own.map((r) => [r.id, r]));
+ const points = [];
+ for (const m of Array.isArray(marks) ? marks : []) {
+ const row = byId.get(String(m?.row ?? ""));
+ const value = Number(row?.value);
+ if (!row || !Number.isFinite(value) || !plotDate(row)) continue;
+ points.push({ row: row.id, date: plotDate(row), value, label: String(m.label ?? "").trim(), kind: m.peak === true ? "peak" : "mark" });
+ }
+ if (points.length && !points.some((p) => p.kind === "peak")) points.reduce((a, b) => (b.value > a.value ? b : a)).kind = "peak";
+ if (low !== false) {
+ // A weight he STATED, as measured: no bound ("over 240" is a floor, not a weigh-in).
+ const stated = readings.filter((r) => r.population === "current" && Number.isFinite(Number(r.value)) && plotDate(r) && !["<", ">"].includes(r.qualifier));
+ let lo = stated.reduce((a, b) => (!a || Number(b.value) < Number(a.value) || (Number(b.value) === Number(a.value) && dateKey(plotDate(b)) > dateKey(plotDate(a))) ? b : a), null);
+ // One weigh-in told twice ("291." on X, "291.5" on stream, the same day): the reading he gave in full.
+ const fuller = lo && stated.find((r) => r !== lo && dateKey(plotDate(r)) === dateKey(plotDate(lo)) && Math.abs(Number(r.value) - Number(lo.value)) < 1 && !Number.isInteger(Number(r.value)) && Number.isInteger(Number(lo.value)));
+ if (fuller) lo = fuller;
+ if (lo && !points.some((p) => p.row === lo.id)) {
+ points.push({ row: lo.id, date: plotDate(lo), value: Number(lo.value), label: typeof low === "string" && low.trim() ? low.trim() : `his low · ${Number(lo.value)}`, kind: "low" });
+ }
+ }
+ return points.sort((a, b) => dateKey(a.date).localeCompare(dateKey(b.date)));
}
diff --git a/umtool/report-to-video/finale.mjs b/umtool/report-to-video/finale.mjs
@@ -18,8 +18,10 @@
// "pips": true | false false: the finale's own clips get no pip on the rail
// (footer or large) -- the rail is the record alone; their
// titles and dates stay in their own area (default true)
-// "dietRuns": true | false the whole diet record drawn under the rail (module runs-finale,
-// chrome-runs-finale.mjs; needs railLabels sections|none; default false)
+// "dietRuns": true | false | { marks, low } the whole diet record drawn under the rail (module runs-finale,
+// chrome-runs-finale.mjs; needs railLabels sections|none; default false):
+// `marks` [{row, label, peak?}] dots on its weight line with his words,
+// the heaviest THE peak; `low` the lowest stated weight marked (default on)
// "claims": "rotate" | "all" the claim checks (deck.claims) on the large rail:
// one at a time, each for an even share of the page's
// time (default "rotate"; all at once when there is
@@ -143,9 +145,9 @@ export function validateFinaleSettings(f, where = "render.chrome.deck.finale") {
}
if (f.totals !== undefined && typeof f.totals !== "boolean") errors.push(`${where}.totals must be true or false`);
if (f.pips !== undefined && typeof f.pips !== "boolean") errors.push(`${where}.pips must be true or false`);
- if (f.dietRuns !== undefined && typeof f.dietRuns !== "boolean") errors.push(`${where}.dietRuns must be true or false`);
+ if (f.dietRuns !== undefined && typeof f.dietRuns !== "boolean") errors.push(...dietRunsProblems(f.dietRuns, `${where}.dietRuns`));
// The diet runs stand under the rail, where "all" and "nodes" put the pips' labels and dates.
- if (f.dietRuns === true && !["sections", "none"].includes(f.railLabels ?? FINALE_DEFAULTS.railLabels)) {
+ if (dietRunsOn(f.dietRuns) && !["sections", "none"].includes(f.railLabels ?? FINALE_DEFAULTS.railLabels)) {
errors.push(`${where}.dietRuns draws under the rail, where railLabels "${f.railLabels ?? FINALE_DEFAULTS.railLabels}" puts the pips' words: set ${where}.railLabels "sections" or "none"`);
}
if (f.statsTitle !== undefined && f.statsTitle !== null) {
@@ -176,6 +178,53 @@ export function validateFinaleSettings(f, where = "render.chrome.deck.finale") {
return errors;
}
+/** The finale's diet runs' marks: how many, and a label's characters. */
+export const DIET_RUNS_LIMITS = Object.freeze({ marks: 8, label: 60 });
+
+/** Is the finale's diet record on (`dietRuns`: true, or its object)? */
+export const dietRunsOn = (v) => v === true || isObj(v);
+
+/** Where the record's weights stand (`dietRuns.weights`): at the date each APPLIED, the date each was SAID, or none. */
+export const DIET_RUNS_WEIGHTS = Object.freeze(["applied", "said"]);
+
+/** The record's weight layer: "applied" (the default when the record is on), "said", or false. */
+export const dietRunsWeights = (v) => (!dietRunsOn(v) ? false : isObj(v) && v.weights !== undefined ? v.weights : "applied");
+
+/**
+ * The design px the finale's diet record takes under the large rail's track
+ * (chrome-runs-finale.mjs): 0 off; with the weight layer, the layer over the
+ * bars and their labels; without it, the bars and their labels alone.
+ */
+export const dietRunsPanel = (v) => (!dietRunsOn(v) ? 0 : dietRunsWeights(v) ? 218 : 122);
+
+/** Why `deck.finale.dietRuns` (an object) cannot be drawn. */
+export function dietRunsProblems(v, where) {
+ if (!isObj(v)) return [`${where} must be true, false or { marks, low, weights }`];
+ const errors = [];
+ for (const k of Object.keys(v)) if (!["marks", "low", "weights"].includes(k)) errors.push(`${where}.${k} is not a diet-runs setting (marks, low, weights)`);
+ if (v.weights !== undefined && v.weights !== false && !DIET_RUNS_WEIGHTS.includes(v.weights)) errors.push(`${where}.weights must be "applied", "said" or false`);
+ if (v.low !== undefined && typeof v.low !== "boolean") {
+ const p = typeof v.low === "string" ? lineProblem(v.low, DIET_RUNS_LIMITS.label, `${where}.low`) : `${where}.low must be true, false or its label`;
+ if (p) errors.push(p);
+ }
+ if (v.marks !== undefined) {
+ if (!Array.isArray(v.marks)) errors.push(`${where}.marks must be a list of { row, label, peak? }`);
+ else {
+ if (v.marks.length > DIET_RUNS_LIMITS.marks) errors.push(`${where}.marks has ${v.marks.length} (at most ${DIET_RUNS_LIMITS.marks})`);
+ v.marks.forEach((m, i) => {
+ const at = `${where}.marks[${i}]`;
+ if (!isObj(m)) { errors.push(`${at} must be { row, label, peak? }`); return; }
+ for (const k of Object.keys(m)) if (!["row", "label", "peak"].includes(k)) errors.push(`${at}.${k} is not a mark field (row, label, peak)`);
+ if (typeof m.row !== "string" || !m.row.trim()) errors.push(`${at}.row must name a ledger row`);
+ const p = lineProblem(m.label, DIET_RUNS_LIMITS.label, `${at}.label`);
+ if (p) errors.push(p);
+ if (m.peak !== undefined && typeof m.peak !== "boolean") errors.push(`${at}.peak must be true or false`);
+ });
+ }
+ }
+ return errors;
+}
+
/** The finale settings with every default filled in (the stats trimmed, a number value as text). */
export function resolveFinale(render) {
const f = isObj(render?.chrome?.deck?.finale) ? render.chrome.deck.finale : {};
diff --git a/umtool/report-to-video/measure-slice.mjs b/umtool/report-to-video/measure-slice.mjs
@@ -25,6 +25,7 @@ import { PROMISE_FORMS, measureDisplay, measureQualifier, measureSchema, measure
import { goalCell, nextRegime, offOf } from "./panel-model.mjs";
import { offsetIn } from "./gaps.mjs";
import { dietRecord } from "./diet-record.mjs";
+import { dietRunsOn } from "./finale.mjs";
export const MEASURE_SLICE_VERSION = 1;
@@ -638,6 +639,8 @@ export function measureSlice(manifest, schedule, opts = {}) {
state,
totals,
// The whole diet record, for the finale's detailed runs (`deck.finale.dietRuns`): only when it asks.
- ...(manifest?.render?.chrome?.deck?.finale?.dietRuns === true ? { record: dietRecord(own, s, regimeTrack, readings) } : {}),
+ ...(dietRunsOn(manifest?.render?.chrome?.deck?.finale?.dietRuns)
+ ? { record: dietRecord(own, s, regimeTrack, readings, isObj(manifest.render.chrome.deck.finale.dietRuns) ? manifest.render.chrome.deck.finale.dietRuns : {}) }
+ : {}),
};
}
diff --git a/umtool/report-to-video/modules/runs-finale.mjs b/umtool/report-to-video/modules/runs-finale.mjs
@@ -23,9 +23,12 @@ export default defineModule({
summary: "The finale's detailed diet record: every run from the first row a bar in its diet's ink, the empty years a break, the stops and medication marked, his weights over it, the long runs and the open one labelled.",
docs: {
heading: "Diet runs in the finale",
- intro: "With `deck.finale.dietRuns: true` (and a measure ledger with a regime track), the finale's timeline panel -- under the large rail's track, the rail's width, down to the panel's foot: (120, 286) 1704×122 at 1080p -- carries the WHOLE record of his diets (the measure slice's `record`, diet-record.mjs: every regime row in scope, on camera or not, through the state's own rule): each run a bar in its diet's ink on a time axis from the earliest row; a stretch of more than two years with nothing on record squeezed to a marked break (\"2013–2018\"), and a run whose end the record does not have fading into it; a row that stopped a diet a grey tick under the bars, one naming the medication (GLP-1) a purple one; his stated weights a light line over the bars, the first and last labelled; the run still going and the longest ones labelled in two rows under the bars where they fit -- the diet's word (the run's own name when its row gives one: \"WEIGHT WATCHERS\"), its number when the cut showed it (\"DIET #6\", the shelf's), its dates and its days, the open one \"N days and counting\" to the in-record date. It sweeps in left to right over 2.6 s after the finale's grow, each label as the sweep reaches it, then holds; it stands clear of the side video, the lower column's instruments and the promise clock. It needs `deck.finale.railLabels` `sections` or `none` (the pips' labels and dates use that space) and at least 100 px under the rail.",
+ intro: "With `deck.finale.dietRuns: true` (and a measure ledger with a regime track), the finale's timeline panel -- under the large rail's track, the rail's width, down to the panel's foot: with the weight layer (120, 202) 1704×220 at 1080p, the track staying where its labels put it and the timeline taking the room under it (up to `FINALE_SHARE.max`); without it 1704×122 -- carries the WHOLE record of his diets (the measure slice's `record`, diet-record.mjs: every regime row in scope, on camera or not, through the state's own rule): each run a bar in its diet's ink on a time axis from the earliest row; a stretch of more than two years with nothing on record squeezed to a marked break (\"2013–2018\"), and a run whose end the record does not have fading into it; a row that stopped a diet a grey tick under the bars, one naming the medication (GLP-1) a purple one; his stated weights a light line over the bars, the weights the video marks (`marks`: his heaviest as THE peak) and his low as labelled dots on it; the run still going and the longest ones labelled in two rows under the bars where they fit -- the diet's word (the run's own name when its row gives one: \"WEIGHT WATCHERS\"), its number when the cut showed it (\"DIET #6\", the shelf's), its dates and its days, the open one \"N days and counting\" to the in-record date. It sweeps in left to right over 2.6 s after the finale's grow, each label as the sweep reaches it, then holds; it stands clear of the side video, the lower column's instruments and the promise clock. It needs `deck.finale.railLabels` `sections` or `none` (the pips' labels and dates use that space) and at least 100 px under the rail.",
rows: [
- ["`deck.finale.dietRuns`", "bool · default `false`", "`umtool look <p> deck.finale.dietRuns=true`"],
+ ["`deck.finale.dietRuns`", "`true` · `false` · `{weights, marks, low}` · default `false`", "`umtool look <p> deck.finale.dietRuns=true`"],
+ ["`deck.finale.dietRuns.weights`", "`applied` · `said` · `false` · default `applied`: the WEIGHT LAYER over the bars on the dial's scale (the panel 218 design px, the finale's timeline taking that room under the track) -- every weight he gave (a `current` or `past` row with a number) at the day it APPLIED (its asOf, else its date; `said`: the day he said it). Given at the time: solid, joined -- his claimed trajectory (a bound like \"over 240\" is a point, not joined). Told 30 days or more after it applied: hollow, with a thin leader to a tick at the day he said it, so a retold weight piles up at one period from its tellings. `>`/`<` a caret, `≈` a ring, a range a bar. A loss or gain (`delta`) and \"N over\" (`overweight_by`) name no weight the ledger resolves: left out (the record counts them, `record.leftOut`). `false`: the light line of his stated weights alone", "`umtool look <p> deck.finale.dietRuns='{\"weights\":\"said\"}'`"],
+ ["`deck.finale.dietRuns.marks`", "up to 8 `{row, label, peak?}`: a dot on the weight line at the row's day (its asOf, else its date) and value, the label -- his words, at most 60 characters -- and the month beside it; THE peak (the one marked `peak`, else the heaviest marked) a size up in the needle's red. A row the ledger lacks is left out", "`umtool look <p> deck.finale.dietRuns='{\"marks\":[{\"row\":\"w21\",\"label\":\"his heaviest · \\\"almost 400\\\"\"}]}'`"],
+ ["`deck.finale.dietRuns.low`", "`true` · `false` · its label · default `true`: the lowest weight he stated (never a bound like \"over 240\"; of one weigh-in told twice the same day, the fuller: 291.5 over \"291.\") marked in the accent, \"his low · 291.5\"", "`umtool look <p> deck.finale.dietRuns='{\"low\":false}'`"],
],
},
region: "runs-finale",
diff --git a/umtool/report-to-video/runs-finale.test.mjs b/umtool/report-to-video/runs-finale.test.mjs
@@ -86,7 +86,7 @@ test("the axis: an empty stretch past two years squeezed to a marked break; the
test("validation and the page: railLabels must leave the space; the page labels the open run 'and counting'", () => {
assert.match(validateFinaleSettings({ dietRuns: true }).join(), /dietRuns draws under the rail, where railLabels "all" puts the pips' words: set render\.chrome\.deck\.finale\.railLabels "sections" or "none"/);
assert.deepEqual(validateFinaleSettings({ dietRuns: true, railLabels: "none" }), []);
- assert.match(validateFinaleSettings({ dietRuns: "yes" }).join(), /dietRuns must be true or false/);
+ assert.match(validateFinaleSettings({ dietRuns: "yes" }).join(), /dietRuns must be true, false or \{ marks, low, weights \}/);
const r = renderOf();
const m = measureSlice(manifest(r), { segments: SEGMENTS }, { asOf: "2026-11-03" });
const schedule = { kind: "deck", fps: 30, total: 20, transition: 0, segments: SEGMENTS.map((s) => ({ ...s, end: s.start + s.duration, type: "clip", title: "", subtitle: "" })), finale: { segments: ["c2"], from: 10.5, to: 20, video: "side", motion: "grow", grow: 0.8 }, measure: m };
@@ -102,3 +102,62 @@ test("validation and the page: railLabels must leave the space; the page labels
assert.equal(mod.on(schedule, r), true);
assert.equal(mod.on(schedule, renderOf({ railLabels: "sections" })), false, "off by default");
});
+
+test("marks on the weight line: the author's rows with his words, the heaviest THE peak; the low by default, never a bound", async () => {
+ const { recordPoints } = await import("./diet-record.mjs");
+ const rows = [
+ ...LEDGER,
+ row({ id: "w21", date: "2023-09-29", asOf: "2023-02-24", population: "past", value: 390, qualifier: "≈", display: "390 lb" }),
+ row({ id: "w07", date: "2022-06-15", population: "current", value: 240, qualifier: ">", display: "over 240" }),
+ row({ id: "w117", date: "2026-10-23", population: "current", value: 291, display: "291." }),
+ row({ id: "w118", date: "2026-10-26", asOf: "2026-10-23", population: "current", value: 291.5, display: "291.5 lb" }),
+ ];
+ const readings = rows.filter((r) => r.scope === "weight");
+ const pts = recordPoints(rows, readings, { marks: [{ row: "w21", label: "his heaviest · \"almost 400\"" }, { row: "w127", label: "2013 · 345" }, { row: "nope", label: "x" }] });
+ assert.deepEqual(pts.map((p) => [p.row, p.date, p.value, p.kind]), [
+ ["w127", "2013-03-02", 345, "mark"],
+ ["w21", "2023-02-24", 390, "peak"],
+ ["w118", "2026-10-23", 291.5, "low"],
+ ], "by the day it was his weight; the heaviest the peak; the low not 'over 240', and 291.5 over the same day's '291.'");
+ assert.equal(pts[2].label, "his low · 291.5");
+ assert.deepEqual(recordPoints(rows, readings, { low: false }), []);
+ assert.equal(recordPoints(rows, readings, { marks: [{ row: "w127", label: "a", peak: true }, { row: "w21", label: "b" }] })[0].kind, "peak", "the one marked peak");
+ assert.deepEqual(validateFinaleSettings({ railLabels: "sections", dietRuns: { marks: [{ row: "w21", label: "his heaviest" }], low: "his low" } }), []);
+ assert.match(validateFinaleSettings({ railLabels: "sections", dietRuns: { marks: [{ row: "w21" }], lowest: true } }).join(), /dietRuns\.lowest is not a diet-runs setting.*marks\[0\]\.label/s);
+ const on = measureSlice({ ...manifest(renderOf({ railLabels: "none", dietRuns: { marks: [{ row: "w127", label: "2013" }] } })), ledger: rows }, { segments: SEGMENTS }, { asOf: "2026-11-03" });
+ assert.deepEqual(on.record.points.map((p) => p.kind), ["peak", "low"]);
+});
+
+test("the weight layer: every weight he gave at the day it applied, the retold ones apart; losses and 'N over' left out and counted", async () => {
+ const { weightClaims } = await import("./diet-record.mjs");
+ const rows = [
+ ...LEDGER,
+ row({ id: "w21", date: "2023-09-29", asOf: "2023-02-24", population: "past", value: 390, qualifier: "≈", display: "390 lb" }),
+ row({ id: "w07", date: "2022-06-15", population: "current", value: 240, qualifier: ">", display: "over 240" }),
+ row({ id: "d1", date: "2024-02-01", population: "delta", value: -19.4, display: "-19.4" }),
+ row({ id: "o1", date: "2023-08-18", population: "overweight_by", value: 100, display: "100 over" }),
+ row({ id: "g1", date: "2023-08-18", population: "goal_loss", value: -100, display: "lose 100" }),
+ ];
+ const { claims, leftOut } = weightClaims(rows);
+ assert.deepEqual(claims.map((c) => [c.row, c.applied, c.said, c.retold, c.qualifier]), [
+ ["w127", "2013-03-02", "2013-03-09", false, null],
+ ["w130", "2013-03-21", "2013-03-21", false, null],
+ ["w07", "2022-06-15", "2022-06-15", false, ">"],
+ ["w21", "2023-02-24", "2023-09-29", true, "≈"],
+ ["w50", "2024-05-01", "2024-05-01", false, null],
+ ], "a week's asOf is still his weight then; seven months on is a retelling");
+ assert.deepEqual(leftOut, { delta: 1, overweight_by: 1 });
+ assert.match(validateFinaleSettings({ railLabels: "none", dietRuns: { weights: "both" } }).join(), /weights must be "applied", "said" or false/);
+ const r = renderOf({ railLabels: "sections", dietRuns: { weights: "applied" } });
+ const m = measureSlice({ ...manifest(r), ledger: rows }, { segments: SEGMENTS }, { asOf: "2026-11-03" });
+ const schedule = { kind: "deck", fps: 30, total: 20, transition: 0, segments: SEGMENTS.map((s) => ({ ...s, end: s.start + s.duration, type: "clip", title: "", subtitle: "" })), finale: { segments: ["c2"], from: 10.5, to: 20, video: "side", motion: "grow", grow: 0.8 }, measure: m };
+ const g = runsFinaleGeometry(schedule, r);
+ assert.ok(g.height >= 200, `the layer has its room under the track (${g.height})`);
+ const { html } = runsFinaleHtml(schedule, r, { from: 10.5, to: 20 }, { fonts: {} });
+ assert.match(html, /class="hol"/, "a retold weight hollow");
+ assert.match(html, /class="ldr"/, "its leader to the day he said it");
+ assert.match(html, /class="car"/, "a bound's caret");
+ assert.match(html, /class="apx"/, "an about's ring");
+ const off = runsFinaleHtml(schedule, renderOf({ railLabels: "sections", dietRuns: { weights: false } }), { from: 10.5, to: 20 }, { fonts: {} }).html;
+ assert.doesNotMatch(off, /class="hol"/);
+});