Archilyzer · Source

archilyzer

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

commit 4228ac4b296776fd48148e5bac427be95d68b9cc
parent 31a120a06d1cf80c63aa7237371747cdfa99a235
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 12 Nov 2026 18:09:21 -0500

Merge main (b951527c) into lane/screen-reads: the by-date weight chart fix

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Mumtool/docs/knobs.md | 6+++---
Mumtool/report-to-video/chrome-instruments.mjs | 50++++++++++++++++++++++++++++----------------------
Mumtool/report-to-video/instruments.mjs | 2+-
Mumtool/report-to-video/modules/trail.mjs | 17+++++++++--------
Mumtool/report-to-video/trail-plan.mjs | 58+++++++++++++++++++++++++++++++++++++++++-----------------
Mumtool/report-to-video/trail-plan.test.mjs | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------
Mumtool/report-to-video/vertical-deck.test.mjs | 6++++--
7 files changed, 145 insertions(+), 61 deletions(-)

diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -2405,7 +2405,7 @@ filter. A knob absent is its default, and a module whose knobs are all absent dr | [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, 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` | +| [Weight trail](#weight-trail) `trail` | The weights he says (stated and remembered) as one line 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` | | [Chapters](#chapters) `chapter` | A section bumper over the first seconds of the clip it opens: title, subtitle, date. (pages at their own seconds) | `render.chrome.chapter` | | [Finale](#finale) `finale` | The cut's last clips under the rail redrawn large, the final totals and stats cards. (pages at their own seconds) | `render.chrome.deck.finale` | @@ -2753,7 +2753,7 @@ Under the dial: the measure's `state.lost.total` (the highest real-time loss cla ### Weight trail -At the foot of the instruments' column: every weight the cut shows -- the STATED ones and (`remembered`) the remembered ones, "≈390, as of Feb 2023" -- placed by the date he was that weight (its `asOf`, else its date), a dot appearing at its event's `t`; the line joins neighbours by date among the stated ones once both are said (a remembered one is a hollow grey dot, never joined; a qualified one hollow). The axes FIT what has been said so far (trail-plan.mjs): each new weight outside them reflows the chart over 0.4 s -- the years, the bounds, every dot -- so the time axis advances with the story; a stretch with no statement longer than `gap` is a break in the time axis (a narrow dashed band, `//` at its foot, each side with its own years) and the line across it dotted, so a decade of nothing does not take the width from the dense run after it. A red ring on the latest said. The `mark` line (300) dashed across; with `count` and the mark at 300, `UNDER 300 · SAID n×` counts the measure's `totals.under300` rows as the cut reaches each. +At the foot of the instruments' column: every weight the cut shows -- the STATED ones and (`remembered`) the remembered ones, "≈390, as of Feb 2023" -- placed by the date he was that weight (its `asOf`, else its date), a dot appearing at its event's `t`; ONE line runs through every weight shown, stated and remembered alike, joining neighbours by date once both are said -- so it never passes over a point; of several weights for one day the line takes the one said last and the others stay as marks beside it. A remembered weight is a hollow grey ring with a solid border (a qualified one a size smaller), and a stretch of the line with a remembered end is drawn quieter, grey and thinner; between two stated weights it keeps the accent (a qualified stated one is hollow). The axes FIT what has been said so far (trail-plan.mjs): each new weight outside them reflows the chart over 0.4 s -- the years, the bounds, every dot -- so the time axis advances with the story; a stretch with no statement longer than `gap` is a break in the time axis (a small `//` on the axis foot, each side with its own years; a year inside a stretch a short tick there) and the line across it dotted, so a decade of nothing does not take the width from the dense run after it. A red ring on the latest said. The `mark` line (300) dashed across; with `count` and the mark at 300, `UNDER 300 · SAID n×` counts the measure's `totals.under300` rows as the cut reaches each. | Knob | Range · default | From a terminal | |---|---|---| @@ -2762,7 +2762,7 @@ At the foot of the instruments' column: every weight the cut shows -- the STATED | `deck.trail.count` | bool · default `true` | `umtool look <p> deck.trail.count=false` | | `deck.trail.label` | its title, ≤ 40 · default `WHAT HE SAYS HE WEIGHS, BY DATE` | `umtool look <p> deck.trail.label='"…"'` | | `deck.trail.bounds` | `fit` · `fixed` · default `fit`: the axes fit the weights said so far and reflow as each lands; `fixed` lays every moment on the axes of all the cut's weights | `umtool look <p> deck.trail.bounds=fixed` | -| `deck.trail.remembered` | bool · default `true`: his remembered weights are points too, hollow and grey, not joined into the line | `umtool look <p> deck.trail.remembered=false` | +| `deck.trail.remembered` | bool · default `true`: his remembered weights are points on the line too, hollow grey rings, the line's stretches to them quieter; `false` leaves them out | `umtool look <p> deck.trail.remembered=false` | | `deck.trail.gap` | `auto` · days 30–3650 · `0` none · default `auto`: a stretch with no statement longer than a year (or 8× the median spacing, if longer) is a break in the time axis | `umtool look <p> deck.trail.gap=540` | | `deck.trail.flash` | bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the card lights as each weight lands on it; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away | `umtool look <p> deck.trail.flash=false` | diff --git a/umtool/report-to-video/chrome-instruments.mjs b/umtool/report-to-video/chrome-instruments.mjs @@ -876,8 +876,9 @@ export function trailHtml(schedule, render, opts = {}) { const parts = []; const moved = (a, b) => !a || !b || Math.abs(a.x - b.x) > 0.05 || Math.abs(a.y - b.y) > 0.05; - // The axes: a label per year (its tick inside a cluster), a break per gap between clusters, the bounds' two figures - // and the mark line -- each shown, moved and hidden state by state; before the first weight, the first state's axes. + // The axes: a label per year (a 1 January inside a cluster a short tick at the axis foot, never a rule over the plot), + // a break per gap between clusters (a small "//" on the foot, no band over the plot), the bounds' two figures and the + // mark line -- each shown, moved and hidden state by state; before the first weight, the first state's axes. const yearKeys = new Map(); const gapKeys = new Map(); const bounds = new Map(); @@ -888,10 +889,10 @@ export function trailHtml(schedule, render, opts = {}) { }); if (!states.length) for (const v of [`hi${first.hi}`, `lo${first.lo}`]) bounds.set(v, null); for (const [key, y] of yearKeys) { - parts.push(`<div class="yw" data-k="y${key}">${y.tick ? `<div class="ytick" style="top:${y0}px; height:${r4(y1 - y0)}px"></div>` : ""}<div class="yr" style="top:${r4(y1 + px(4))}px">${y.text}</div></div>`); + parts.push(`<div class="yw" data-k="y${key}">${y.tick ? `<div class="ytick" style="top:${r4(y1 - px(3))}px; height:${px(5)}px"></div>` : ""}<div class="yr" style="top:${r4(y1 + px(4))}px">${y.text}</div></div>`); } for (const [key] of gapKeys) { - parts.push(`<div class="gp" data-k="g${key}" style="top:${y0}px; height:${r4(y1 - y0)}px"><div class="gz">//</div></div>`); + parts.push(`<div class="gp" data-k="g${key}" style="top:${r4(y1 - px(7))}px; height:${px(14)}px"><div class="gz">//</div></div>`); } for (const key of bounds.keys()) { parts.push(`<div class="lohi" data-k="b${key}" style="left:${px(12)}px; top:${key.startsWith("hi") ? y0 : y1}px">${key.slice(2)}</div>`); @@ -932,19 +933,10 @@ export function trailHtml(schedule, render, opts = {}) { }; axisAt(first, 0, null); - // The points: each pops in at its place in the state it is said in, then moves with every reflow after. - const firstState = new Map(); - states.forEach((st, j) => { for (const n of st.shown) if (!firstState.has(n)) firstState.set(n, j); }); - for (const p of pts) { - const j = firstState.get(p.n); - const at = states[j].pos.get(p.n); - const cls = `pt${p.kind === "remembered" ? " rem" : ""}${p.qualifier ? " q" : ""}`; - parts.push(`<div class="${cls}" data-k="p${p.n}"></div>`); - L.set(`p${p.n}`, { x: at.x, y: at.y, autoAlpha: 0, scale: 0.3 }); - L.add(`p${p.n}`, p.t, M2.point, { autoAlpha: 1, scale: 1 }, "back.out(2)"); - } - // The line: neighbours by date among the stated points shown, a pair drawn in when it first is one, moved with the - // reflows while it lasts, gone the moment a weight said later lands between them. Across a break it is dotted. + // The line, drawn under the points: ONE line through every weight shown, stated and remembered alike, in date order + // (trail-plan.mjs trailLine: of several weights for one day, the one said last). A pair is drawn in when it first is + // one, moved with the reflows while it lasts, gone the moment a weight said later lands between them (or takes its + // day); across a break it is dotted, and with a remembered end it is quieter (the ghost colour, thinner). const pairFirst = new Map(); states.forEach((st, j) => { for (const pr of st.pairs) if (!pairFirst.has(pr.key)) pairFirst.set(pr.key, { ...pr, j }); }); const geomOf = (st, pr) => { @@ -952,10 +944,22 @@ export function trailHtml(schedule, render, opts = {}) { return { x: a.x, y: a.y, width: r4(Math.hypot(b.x - a.x, b.y - a.y)), rotation: r4((Math.atan2(b.y - a.y, b.x - a.x) * 180) / Math.PI) }; }; for (const [key, pr] of pairFirst) { - parts.push(`<div class="seg${pr.gap ? " gap" : ""}" data-k="s${key}"></div>`); + parts.push(`<div class="seg${pr.gap ? " gap" : ""}${pr.quiet ? " rem" : ""}" data-k="s${key}"></div>`); L.set(`s${key}`, { ...geomOf(states[pr.j], pr), scaleX: 0, autoAlpha: 1, transformOrigin: "0% 50%" }); L.add(`s${key}`, states[pr.j].at, M2.segment, { scaleX: 1 }, "power2.out"); } + // The points, over the line: each pops in at its place in the state it is said in, then moves with every reflow after. + // A remembered one is a hollow ring in the ghost colour, its border solid (a qualified one a size smaller). + const firstState = new Map(); + states.forEach((st, j) => { for (const n of st.shown) if (!firstState.has(n)) firstState.set(n, j); }); + for (const p of pts) { + const j = firstState.get(p.n); + const at = states[j].pos.get(p.n); + const cls = `pt${p.kind === "remembered" ? " rem" : ""}${p.qualifier ? " q" : ""}`; + parts.push(`<div class="${cls}" data-k="p${p.n}"></div>`); + L.set(`p${p.n}`, { x: at.x, y: at.y, autoAlpha: 0, scale: 0.3 }); + L.add(`p${p.n}`, p.t, M2.point, { autoAlpha: 1, scale: 1 }, "back.out(2)"); + } // The latest said, ringed in the needle's red: it travels to each as it lands, and with the reflows. if (pts.length) parts.push(`<div class="ring" data-k="pl"></div>`); states.forEach((st, j) => { @@ -1011,21 +1015,23 @@ export function trailHtml(schedule, render, opts = {}) { .trail .yw { position: absolute; left: 0; top: 0; width: 0; height: 0; } .trail .yr { position: absolute; left: 0; transform: translateX(-50%); font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(13)}px; color: ${colors.muted}; letter-spacing: 0.06em; white-space: nowrap; } - .trail .ytick { position: absolute; left: 0; width: 1px; background: ${colors.rule}; } - .trail .gp { position: absolute; left: 0; width: ${px(14)}px; margin-left: -${px(7)}px; background: ${rgba(colors.muted, 0.08)}; } + .trail .ytick { position: absolute; left: 0; width: 1px; background: ${colors.muted}; opacity: 0.6; } + .trail .gp { position: absolute; left: 0; width: ${px(12)}px; margin-left: -${px(6)}px; background: ${colors.card}; } .trail .gz { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: ${fontStack(fonts, "condensed")}; - font-size: ${px(13)}px; color: ${colors.muted}; letter-spacing: -0.1em; } + font-size: ${px(12)}px; line-height: 1; color: ${colors.muted}; letter-spacing: -0.1em; } .trail .mark { position: absolute; top: 0; height: 0; border-top: ${px(2)}px dashed ${rgba(colors.accent, 0.75)}; } .trail .marklab, .trail .lohi { position: absolute; transform: translateY(-50%); font-family: ${fontStack(fonts, "condensed")}; font-size: ${px(13)}px; color: ${colors.muted}; } .trail .marklab { top: 0; transform: none; color: ${colors.accent}; font-family: ${fontStack(fonts, "bold")}; } .trail .seg { position: absolute; left: 0; top: 0; height: ${px(2.6)}px; margin-top: -${px(1.3)}px; background: ${colors.accent}; border-radius: ${px(2)}px; } + .trail .seg.rem { height: ${px(1.8)}px; margin-top: -${px(0.9)}px; background: ${rgba(colors.ghost, 0.5)}; } .trail .seg.gap { height: 0; margin-top: -${px(1)}px; background: none; border-top: ${px(2)}px dotted ${rgba(colors.accent, 0.55)}; border-radius: 0; } + .trail .seg.gap.rem { margin-top: -${px(0.8)}px; border-top: ${px(1.6)}px dotted ${rgba(colors.ghost, 0.5)}; } .trail .pt { position: absolute; left: 0; top: 0; width: ${px(10)}px; height: ${px(10)}px; margin: -${px(5)}px 0 0 -${px(5)}px; border-radius: 50%; background: ${colors.accent}; border: ${px(2)}px solid ${colors.card}; } .trail .pt.q { background: ${colors.card}; border: ${px(2.4)}px solid ${colors.accent}; } .trail .pt.rem { background: ${colors.card}; border: ${px(2.4)}px solid ${colors.ghost}; } - .trail .pt.rem.q { border-style: dashed; } + .trail .pt.rem.q { width: ${px(8)}px; height: ${px(8)}px; margin: -${px(4)}px 0 0 -${px(4)}px; border-width: ${px(2)}px; } .trail .ring { position: absolute; left: 0; top: 0; width: ${px(20)}px; height: ${px(20)}px; margin: -${px(10)}px 0 0 -${px(10)}px; border-radius: 50%; border: ${px(3)}px solid ${colors.needle}; }`; return pageHtml({ diff --git a/umtool/report-to-video/instruments.mjs b/umtool/report-to-video/instruments.mjs @@ -100,7 +100,7 @@ export const TRAIL_DEFAULTS = Object.freeze({ label: "WHAT HE SAYS HE WEIGHS, BY DATE", // The axes: "fit" what is shown so far, reflowing as each weight lands; "fixed" to every point of the cut. bounds: "fit", - // His remembered weights ("≈390, as of Feb 2023") as points too: hollow and grey, never joined into the line. + // His remembered weights ("≈390, as of Feb 2023") as points on the line too: hollow grey rings, the line quieter to them. remembered: true, // A stretch with no statement longer than this many days is a break in the time axis, not a line across it: // "auto" (a year, or 8× the median spacing if that is longer), a number of days (30–3650), or 0 for none. diff --git a/umtool/report-to-video/modules/trail.mjs b/umtool/report-to-video/modules/trail.mjs @@ -1,7 +1,8 @@ -// THE TRAIL (module `trail`, region `trail`): his stated weights as a thin -// line by DATE (not cut time) at the foot of the instruments' column, each -// point appearing as he says it and the line drawn between neighbours once -// both are said; the 300 lb line; how many times he says he is under it. +// THE TRAIL (module `trail`, region `trail`): the weights he says, stated and +// remembered, as one thin line by DATE (not cut time) at the foot of the +// instruments' column, each point appearing as he says it and the line drawn +// between date-neighbours once both are said; the 300 lb line; how many times +// he says he is under it. // chrome-instruments.mjs writes the page. import path from "node:path"; @@ -21,7 +22,7 @@ export default defineModule({ // Its form in the stacked vertical deck (vertical-deck.mjs). vertical: { slot: "panel" }, title: "Weight trail", - summary: "His stated weights by date, drawn up to the playhead, the 300 lb line and the times he says he is under it.", + summary: "The weights he says (stated and remembered) as one line by date, drawn up to the playhead, the 300 lb line and the times he says he is under it.", configKey: "render.chrome.deck.trail", defaults: TRAIL_DEFAULTS, validate: settingsOf("trail").validate, @@ -31,19 +32,19 @@ export default defineModule({ { key: "count", type: "boolean", label: "Count the \"under 300\" claims", default: true }, { key: "label", type: "text", label: "Its title", default: TRAIL_DEFAULTS.label }, { key: "bounds", type: "enum", options: ["fit", "fixed"], label: "Axes: fit what is shown so far, or fixed to the whole cut", default: "fit" }, - { key: "remembered", type: "boolean", label: "His remembered weights as points too (hollow, not joined)", default: true }, + { key: "remembered", type: "boolean", label: "His remembered weights as points too (hollow rings on the line)", default: true }, { key: "flash", type: "boolean", label: "Flash its outline when its value changes (unset: deck.measure.flash)" }, ], docs: { heading: "Weight trail", - intro: "At the foot of the instruments' column: every weight the cut shows -- the STATED ones and (`remembered`) the remembered ones, \"≈390, as of Feb 2023\" -- placed by the date he was that weight (its `asOf`, else its date), a dot appearing at its event's `t`; the line joins neighbours by date among the stated ones once both are said (a remembered one is a hollow grey dot, never joined; a qualified one hollow). The axes FIT what has been said so far (trail-plan.mjs): each new weight outside them reflows the chart over 0.4 s -- the years, the bounds, every dot -- so the time axis advances with the story; a stretch with no statement longer than `gap` is a break in the time axis (a narrow dashed band, `//` at its foot, each side with its own years) and the line across it dotted, so a decade of nothing does not take the width from the dense run after it. A red ring on the latest said. The `mark` line (300) dashed across; with `count` and the mark at 300, `UNDER 300 · SAID n×` counts the measure's `totals.under300` rows as the cut reaches each.", + intro: "At the foot of the instruments' column: every weight the cut shows -- the STATED ones and (`remembered`) the remembered ones, \"≈390, as of Feb 2023\" -- placed by the date he was that weight (its `asOf`, else its date), a dot appearing at its event's `t`; ONE line runs through every weight shown, stated and remembered alike, joining neighbours by date once both are said -- so it never passes over a point; of several weights for one day the line takes the one said last and the others stay as marks beside it. A remembered weight is a hollow grey ring with a solid border (a qualified one a size smaller), and a stretch of the line with a remembered end is drawn quieter, grey and thinner; between two stated weights it keeps the accent (a qualified stated one is hollow). The axes FIT what has been said so far (trail-plan.mjs): each new weight outside them reflows the chart over 0.4 s -- the years, the bounds, every dot -- so the time axis advances with the story; a stretch with no statement longer than `gap` is a break in the time axis (a small `//` on the axis foot, each side with its own years; a year inside a stretch a short tick there) and the line across it dotted, so a decade of nothing does not take the width from the dense run after it. A red ring on the latest said. The `mark` line (300) dashed across; with `count` and the mark at 300, `UNDER 300 · SAID n×` counts the measure's `totals.under300` rows as the cut reaches each.", rows: [ ["`deck.trail`", "`true` · an object of the knobs below · `false` off · absent: ON when the cut draws a measure (`deck.measure` set), else off", "`umtool look <p> deck.trail=false`"], ["`deck.trail.mark`", "a weight, or `null` · default `300`", "`umtool look <p> deck.trail.mark=300`"], ["`deck.trail.count`", "bool · default `true`", "`umtool look <p> deck.trail.count=false`"], ["`deck.trail.label`", "its title, ≤ 40 · default `WHAT HE SAYS HE WEIGHS, BY DATE`", "`umtool look <p> deck.trail.label='\"…\"'`"], ["`deck.trail.bounds`", "`fit` · `fixed` · default `fit`: the axes fit the weights said so far and reflow as each lands; `fixed` lays every moment on the axes of all the cut's weights", "`umtool look <p> deck.trail.bounds=fixed`"], - ["`deck.trail.remembered`", "bool · default `true`: his remembered weights are points too, hollow and grey, not joined into the line", "`umtool look <p> deck.trail.remembered=false`"], + ["`deck.trail.remembered`", "bool · default `true`: his remembered weights are points on the line too, hollow grey rings, the line's stretches to them quieter; `false` leaves them out", "`umtool look <p> deck.trail.remembered=false`"], ["`deck.trail.gap`", "`auto` · days 30–3650 · `0` none · default `auto`: a stretch with no statement longer than a year (or 8× the median spacing, if longer) is a break in the time axis", "`umtool look <p> deck.trail.gap=540`"], ["`deck.trail.flash`", "bool · unset (default): follows `deck.measure.flash` -- THE UPDATE FLASH (update-flash.mjs): the card lights as each weight lands on it; a thin outline in its own colour, up over 0.15 s and gone over 0.7 s, no size change, never on frame 0 or while the deck is away", "`umtool look <p> deck.trail.flash=false`"], ], diff --git a/umtool/report-to-video/trail-plan.mjs b/umtool/report-to-video/trail-plan.mjs @@ -8,15 +8,25 @@ // a decade of nothing to the 2025–26 points squeezed into the last pixels. // // Now the chart is a sequence of STATES, one per moment a weight is said: the -// points said so far -- stated ones, and remembered ones (`remembered`, hollow -// and grey, never joined into the line) -- at their own dates (asOf, else the -// day said) and values; the axes FIT what is shown (`bounds: "fit"`; "fixed" -// pins them to the whole cut's points); and a stretch of time with no statement -// longer than the gap threshold (`gap`) is not drawn as data: the time axis is -// cut there into CLUSTERS, each with its own years, a narrow break between them -// and a dotted connector across it, so the dense recent run gets the width. The -// page (chrome-instruments.mjs trailHtml) moves everything from one state's -// places to the next's over TRAIL_REFLOW seconds. +// points said so far -- stated ones, and remembered ones (`remembered`) -- at +// their own dates (asOf, else the day said) and values; the axes FIT what is +// shown (`bounds: "fit"`; "fixed" pins them to the whole cut's points); and a +// stretch of time with no statement longer than the gap threshold (`gap`) is not +// drawn as data: the time axis is cut there into CLUSTERS, each with its own +// years and a small break mark at the foot between them, so the dense recent run +// gets the width. The page (chrome-instruments.mjs trailHtml) moves everything +// from one state's places to the next's over TRAIL_REFLOW seconds. +// +// THE LINE (12 Nov, rev9-a9: "the chart is butchered" -- remembered weights left +// as loose rings for minutes, a dotted line from 2013 straight over the 2023–25 +// points it ignored): ONE line through every weight shown, stated and +// remembered alike, in date order. Its `pairs` are neighbours by date among all +// the shown points, so it never passes over a point; a pair with a remembered +// end is `quiet` (the page draws it in the ghost colour, thinner), and a pair +// across a break is `gap` (dotted). SEVERAL WEIGHTS FOR ONE DAY ("390", later +// "400", both as of Feb 2023) are one point of the line -- the one said last -- +// the earlier ones stay as marks beside it, so the line never zigzags up and +// down one date. // // PURE: the measure slice and a box in, plain data out. import { dayNumber } from "./measure-draw.mjs"; @@ -125,10 +135,23 @@ export function trailLayout(points, box, { thr = Infinity, mark = null } = {}) { } /** + * The line through a state's shown points: one point per day -- of several said for one day, the one said last -- + * in date order. `[{ n, day, kind, ... }]`. + * + * @param {ReturnType<typeof trailPoints>} shown + */ +export function trailLine(shown) { + const byDay = new Map(); + for (const p of [...shown].sort((a, b) => a.t - b.t || a.n - b.n)) byDay.set(p.day, p); + return [...byDay.values()].sort((a, b) => a.day - b.day); +} + +/** * The trail's states: one per moment a point is said (`at`), each with the points shown (`shown`, their `n`), its - * layout, each shown point's place (`pos`: n -> {x, y}) and the line's pairs (`pairs`: neighbours by date among the - * STATED points shown, `{ key, a, b, gap }`, `gap` when they straddle a break). `bounds: "fixed"` lays every state on - * the layout of all the cut's points (the strip as it was, but with its breaks). + * layout, each shown point's place (`pos`: n -> {x, y}), the points the line goes through (`line`, their `n` in date + * order: trailLine) and the line's pairs (`pairs`: neighbours along it, `{ key, a, b, gap, quiet }` -- `gap` when + * they stand in two clusters (a dotted pair across a break), `quiet` when either end is remembered). `bounds: + * "fixed"` lays every state on the layout of all the cut's points (the strip as it was, but with its breaks). * * @param {ReturnType<typeof trailPoints>} points */ @@ -140,11 +163,12 @@ export function trailStates(points, box, { gap = "auto", mark = null, bounds = " const shown = points.filter((p) => p.t <= at + 1e-9); const layout = all ?? trailLayout(shown, box, { thr, mark }); const pos = new Map(shown.map((p) => [p.n, { x: layout.X(p.day), y: layout.Y(p.value) }])); - const stated = shown.filter((p) => p.kind === "stated").sort((a, b) => a.day - b.day || a.t - b.t); - const pairs = stated.slice(1).map((b, i) => { - const a = stated[i]; - return { key: `${a.n}_${b.n}`, a: a.n, b: b.n, gap: b.day - a.day > thr }; + const cluster = (d) => layout.clusters.findIndex((c) => d >= c.from - 1e-9 && d <= c.to + 1e-9); + const line = trailLine(shown); + const pairs = line.slice(1).map((b, i) => { + const a = line[i]; + return { key: `${a.n}_${b.n}`, a: a.n, b: b.n, gap: cluster(a.day) !== cluster(b.day), quiet: a.kind !== "stated" || b.kind !== "stated" }; }); - return { at, shown: shown.map((p) => p.n), layout, pos, pairs, thr }; + return { at, shown: shown.map((p) => p.n), layout, pos, line: line.map((p) => p.n), pairs, thr }; }); } diff --git a/umtool/report-to-video/trail-plan.test.mjs b/umtool/report-to-video/trail-plan.test.mjs @@ -7,7 +7,7 @@ import test from "node:test"; import { trailHtml } from "./chrome-instruments.mjs"; import { estimateSchedule } from "./deck.mjs"; -import { clustersOf, GAP_FLOOR_DAYS, gapThreshold, trailLayout, trailPoints, trailStates } from "./trail-plan.mjs"; +import { clustersOf, GAP_FLOOR_DAYS, gapThreshold, trailLayout, trailLine, trailPoints, trailStates } from "./trail-plan.mjs"; import { dayNumber } from "./measure-draw.mjs"; import { validateTrail } from "./instruments.mjs"; @@ -84,12 +84,16 @@ test("the gap rule: a stretch longer than a year (or 8× the median spacing) bre assert.equal(last.layout.gaps.length, 3); const dense = last.layout.clusters.at(-1); assert.ok(dense.x1 - dense.x0 > 0.5 * (BOX.x1 - BOX.x0), `the 2025–26 run has most of the width (${dense.x1 - dense.x0} px)`); - // The line: stated neighbours only -- the remembered never joined -- dotted across a break. + // The line (12 Nov): through EVERY weight shown, stated and remembered, in date order -- 2008, 2013, 2013, 2023, + // then the 2025–26 run -- dotted across each break, quiet where a remembered weight is an end. const byN = new Map(pts.map((p) => [p.n, p])); - for (const pr of last.pairs) assert.ok(byN.get(pr.a).kind === "stated" && byN.get(pr.b).kind === "stated"); + assert.deepEqual(last.line, [3, 0, 1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12]); + assert.deepEqual(last.pairs.map((pr) => pr.key).slice(0, 4), ["3_0", "0_1", "1_2", "2_4"]); const across = last.pairs.find((pr) => byN.get(pr.a).value === 342.9); - assert.equal(across.gap, true, "2013 to 2025 is a dotted connector, not data"); - assert.ok(last.pairs.filter((pr) => !pr.gap).length >= 8); + assert.deepEqual([across.b, across.gap, across.quiet], [2, true, true], "2013 to the remembered 2023 is a quiet dotted connector"); + assert.deepEqual(last.pairs.filter((pr) => pr.gap).map((pr) => pr.key), ["3_0", "1_2", "2_4"], "one dotted pair per break"); + for (const pr of last.pairs) assert.equal(pr.quiet, byN.get(pr.a).kind !== "stated" || byN.get(pr.b).kind !== "stated", pr.key); + assert.ok(last.pairs.filter((pr) => !pr.gap && !pr.quiet).length >= 8, "the stated run keeps the accent"); // gap: 0 -- one cluster, no breaks. assert.equal(trailStates(pts, BOX, { gap: 0, mark: 300 }).at(-1).layout.gaps.length, 0); // bounds: "fixed" -- every moment on the whole cut's axes. @@ -104,9 +108,16 @@ test("the page: points pop in where their moment puts them and move with every r const schedule = { ...estimateSchedule({ slug: "m", title: "M", provenance: {}, render, timeline }), measure: MEASURE }; const html = trailHtml(schedule, render, { fonts: {} }); const data = JSON.parse(/<script id="trail-data" type="application\/json">(.*?)<\/script>/s.exec(html)[1]); - assert.match(html, /class="pt rem q" data-k="p2"/, "the remembered ≈390: hollow, grey, its qualifier dashed"); - assert.match(html, /class="seg gap" data-k="s1_4"/, "2013 → 2025 dotted"); - assert.ok(!/data-k="s\d+_2"|data-k="s2_\d+"/.test(html), "the remembered are never joined"); + assert.match(html, /class="pt rem q" data-k="p2"/, "the remembered ≈390: a hollow grey ring"); + assert.ok(!/dashed/.test(/<style>([\s\S]*?)<\/style>/.exec(html)[1].split("\n").filter((l) => /\.pt|\.seg/.test(l)).join("\n")), "no point or segment is dashed"); + assert.match(html, /class="seg" data-k="s0_1"/, "2013 → 2013: stated, the accent"); + assert.match(html, /class="seg gap rem" data-k="s1_2"/, "2013 → the remembered 2023: dotted across the break, quiet"); + assert.match(html, /class="seg gap rem" data-k="s3_0"/, "the remembered 2008 → 2013: joined, dotted, quiet"); + assert.ok(!/data-k="s1_4"/.test(html), "the line never jumps from 2013 over the 2023 point to 2025"); + // The line is drawn under the points; a break is a small "//" at the foot, a year a short tick there -- no band or + // rule over the plot. + assert.ok(html.indexOf('data-k="s0_1"') < html.indexOf('data-k="p0"'), "segments before points"); + assert.ok(!/\.gp \{[^}]*rgba/.test(html), "no band behind a break"); // p0 (the 2013 weigh-in) moves when the 2013 second weight lands, and again when 2008 pushes time back. const moves = data.cues.filter((c) => c.k === "p0" && "x" in c.to).map((c) => c.at); assert.ok(moves.includes(31) && moves.includes(100), `p0 reflows at 31 and 100 (${moves})`); @@ -134,3 +145,43 @@ test("a row with no number is no point: a null, missing, empty or non-numeric va assert.deepEqual(pts.map((p) => [p.row, p.value]), [["a", 300], ["zero", 0], ["text", 291.5]]); assert.deepEqual(pts.map((p) => p.n), [0, 1, 2]); }); + +test("the line takes one point per day -- the one said last -- and a pair never passes over a shown point", () => { + // He remembers 390 as of Feb 2023, later says 400 for the same day; then two stated weights in 2025, one in 2024. + const events = [ + ev(10, "stated", 330, "2025-01-01"), + ev(20, "remembered", 390, "2023-10-01", { asOf: "2023-02-24" }), + ev(30, "remembered", 400, "2023-10-05", { asOf: "2023-02-24" }), + ev(40, "stated", 325, "2025-02-01"), + ev(50, "stated", 360, "2024-06-01"), + ]; + const pts = trailPoints({ events }); + const states = trailStates(pts, BOX, { mark: 300 }); + assert.deepEqual(states.map((st) => st.line), [[0], [1, 0], [2, 0], [2, 0, 3], [2, 4, 0, 3]]); + assert.deepEqual(trailLine(pts.slice(0, 3)).map((p) => p.n), [2, 0], "the 390 stays a mark; the line goes through the 400 said after it"); + assert.equal(states[2].shown.length, 3, "the earlier weight for that day is still shown"); + // No vertical run: never two line points on one day. + for (const st of states) { + const days = st.line.map((n) => pts[n].day); + assert.equal(new Set(days).size, days.length, `at ${st.at}`); + } + // Every pair, dotted or not, joins date-neighbours: no shown point stands strictly between its ends' dates. + for (const st of states) { + for (const pr of st.pairs) { + const [da, db] = [pts[pr.a].day, pts[pr.b].day]; + assert.ok(da < db, `${pr.key} in date order`); + assert.ok(!st.shown.some((n) => pts[n].day > da && pts[n].day < db), `at ${st.at}: ${pr.key} passes over no point`); + } + } + // The 2024 weight lands between 2023 and 2025: the dotted 2023 → 2025 pair gives way to two. + assert.ok(states[3].pairs.some((pr) => pr.key === "2_0") && !states[4].pairs.some((pr) => pr.key === "2_0")); + // The page: the pair from the 390 is drawn, then fades when the 400 takes its day. + const timeline = [{ type: "clip", id: "c1", video: "v", start: 0, end: 60 }]; + const render = { width: 1920, height: 1080, fps: 30, transition: 0.4, chrome: { engine: "hyperframes", layout: "deck", deck: { dial: true, odometer: true, trail: true } } }; + const schedule = { ...estimateSchedule({ slug: "m", title: "M", provenance: {}, render, timeline }), measure: { unit: "lb", scale: { min: 220, max: 400 }, events, state: [{ t: 0 }], totals: {} } }; + const html = trailHtml(schedule, render, { fonts: {} }); + const data = JSON.parse(/<script id="trail-data" type="application\/json">(.*?)<\/script>/s.exec(html)[1]); + assert.match(html, /class="seg rem" data-k="s1_0"/, "remembered → stated, inside one cluster: solid, quiet"); + assert.ok(data.cues.some((c) => c.k === "s1_0" && c.at === 30 && c.to.autoAlpha === 0), "the 390's pair goes when the 400 lands"); + assert.match(html, /class="seg" data-k="s4_0"/, "2024 → 2025: stated, the accent"); +}); diff --git a/umtool/report-to-video/vertical-deck.test.mjs b/umtool/report-to-video/vertical-deck.test.mjs @@ -268,8 +268,10 @@ const MAIN = { odometer: "8425983d217408dddcb6ee794881c6c4", // Re-pinned on lane/frame-zero (11 Nov): the trail's axes fit the weights said so far and reflow, its remembered // weights are points, its time axis breaks over long empty stretches (trail-plan.mjs) -- the page is new by design. - // Main's was 3512192be69f8b9bc33aec6e7b41a088. - trail: "39c3694f4e26963277d9b22ebfd0f60b", + // Main's was 3512192be69f8b9bc33aec6e7b41a088. Re-pinned on lane/trail-join (12 Nov): one line through every weight + // shown by date (the remembered too, quieter), one point per day, the breaks and years at the axis foot -- new by + // design; frame-zero's was 39c3694f4e26963277d9b22ebfd0f60b. + trail: "7b108207d91e94b740541aea0f98a98a", dialFinale: "52866e4d87e15bd55afe8c1a703414a3", geometry: "182959796c281f769766df3d02962904", bare: "7ce1f7a66452adec21575bcdbba900f1",