commit b11595e3acf469bdb12a45ae2559213bd114fe9c
parent caff454ed6843f79e1d11ee196c391175acc74dd
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 6 Nov 2026 18:29:15 -0500
umtool: the shelf's goal fan leads with the headline goal when the state names one
Coordination with lane/dial-ghosts, which adds the measure state's
`goals.headline` (the closest goal in force) and `goals.active`: goalStates
reads them when present -- the headline's note key (`headline`), the count in
force (`active`) -- and the shelf form puts the headline note in front, the
rest by recency, with "+N more" on it for the others in force. Without them
(today's state: `goals` a list of rows) the newest leads as before, so either
lane can merge first. No ranking here; measure-totals untouched. Test with a
state shaped as that lane writes it; the goals' shelf docs row.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
4 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/umtool/report-to-video/chrome-measure-extras.mjs b/umtool/report-to-video/chrome-measure-extras.mjs
@@ -300,7 +300,18 @@ function goalsShelfHtml(schedule, render, opts, cfg, states) {
});
const spans = upSpans(states.map((s) => s.at), cfg, schedule);
const items = [];
- const { init, cues } = stateCues(states, spans, {
+ // THE ORDER ON THE SHELF: the headline goal in front when the state names one (the closest goal in force,
+ // goalStates' `headline`), the rest by how recently he set them; else the newest in front, as the pile.
+ let before = new Map();
+ const shelfStates = states.map((st) => {
+ const recent = [...st.notes].sort((a, b) => a.depth - b.depth);
+ const lead = st.headline ? recent.find((n) => n.key === st.headline) : null;
+ const list = lead ? [lead, ...recent.filter((n) => n !== lead)] : recent;
+ const notes = list.map((n, i) => ({ ...n, depth: i, prev: before.has(n.key) ? before.get(n.key) : null }));
+ before = new Map(notes.map((n) => [n.key, n.depth]));
+ return { ...st, notes };
+ });
+ const { init, cues } = stateCues(shelfStates, spans, {
own: (st, j, init) => {
const ev = [];
for (const n of st.notes) {
@@ -330,20 +341,22 @@ function goalsShelfHtml(schedule, render, opts, cfg, states) {
return ev;
},
});
- const blocks = states.map((st, j) => {
+ const blocks = shelfStates.map((st, j) => {
const notes = st.notes.map((n) => {
const k = `s${j}.${n.id}`;
const dl = cfg.countdown && n.deadline
? `<div class="dl">${esc(n.deadline)}${n.days !== null ? ` · ${esc(daysLeftText(n.days))}` : ""}${n.target !== null ? ` · needs ${esc(weightText(n.target))}` : ""}</div>`
: "";
const count = n.count > 1 ? `<div class="ct">×${n.count}</div>` : "";
+ // The ladder: how many more goals are in force beside the headline one, when the state says.
+ const more = n.depth === 0 && st.headline && Number.isFinite(st.active) && st.active > 1 ? `<div class="mo">+${st.active - 1} more</div>` : "";
const front = n.depth === 0 || !backs;
const crossing = backs && n.prev === 0 && n.depth > 0;
const face = `<div class="nf"${crossing ? ` data-k="${k}f"` : ""} style="opacity:${front || crossing ? 1 : 0}"><div class="nh">Goal${n.date ? ` · ${esc(monthYear(n.date))}` : ""}</div><div class="nt">${esc(n.text)}</div>${dl}</div>`;
const back = backs && n.depth > 0
? `<div class="nb"${crossing ? ` data-k="${k}b"` : ""} style="opacity:${crossing ? 0 : 1}"><div class="bt">${esc(n.text)}</div>${n.date ? `<div class="bh">${esc(monthYear(n.date))}</div>` : ""}</div>`
: "";
- return `<div class="note" data-k="${k}" style="z-index:${20 - n.depth}"><div class="tape"></div>${face}${back}${count}</div>`;
+ return `<div class="note" data-k="${k}" style="z-index:${20 - n.depth}"><div class="tape"></div>${face}${back}${count}${more}</div>`;
}).join("");
const html = `<div class="st" data-k="s${j}"><div class="gc"><div class="gn" data-k="s${j}.c">${st.goalsSet}</div><div class="gl">goal${st.goalsSet === 1 ? "" : "s"} set</div></div>${notes}</div>`;
items.push({ key: `s${j}`, gate: [`s${j}`, "autoAlpha"], html });
@@ -373,6 +386,8 @@ function goalsShelfHtml(schedule, render, opts, cfg, states) {
.bt { font-family: ${DISPLAY}; font-size: ${px(24)}px; line-height: ${px(27)}px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.bh { font-family: 'DeckSansBold', sans-serif; font-size: ${px(12)}px; line-height: ${px(15)}px; letter-spacing: 0.1em; text-transform: uppercase;
color: rgba(42, 28, 6, 0.62); white-space: nowrap; }
+ .mo { position: absolute; right: ${px(8)}px; bottom: ${px(6)}px; padding: 0 ${px(7)}px; height: ${px(20)}px; border-radius: ${px(10)}px;
+ background: rgba(42, 28, 6, 0.85); color: ${paper}; font-family: 'DeckSansBold', sans-serif; font-size: ${px(12)}px; line-height: ${px(20)}px; }
.ct { position: absolute; right: ${px(8)}px; top: ${px(5)}px; min-width: ${px(40)}px; height: ${px(24)}px; padding: 0 ${px(7)}px;
border-radius: ${px(12)}px; background: #2a1c06; color: ${paper}; text-align: center;
font-family: ${DISPLAY}; font-size: ${px(19)}px; line-height: ${px(24)}px; }`;
diff --git a/umtool/report-to-video/measure-extras.mjs b/umtool/report-to-video/measure-extras.mjs
@@ -229,6 +229,7 @@ export function goalStates(schedule, render) {
const states = [];
let prevDepth = new Map();
let n = 0;
+ const rowKey = new Map();
for (const { e, s } of stepsOf(m)) {
if (e.kind !== "goal" && e.kind !== "goalLoss") continue;
n += 1;
@@ -251,14 +252,22 @@ export function goalStates(schedule, render) {
const target = s?.goal && s.goal.row === e.row && Number.isFinite(s.goal.value) ? s.goal.value
: e.kind === "goal" && Number.isFinite(e.value) ? e.value : null;
note.target = target;
+ rowKey.set(e.row, key);
order = [...order.filter((k) => k !== key), key];
const shown = order.slice(-cfg.max);
const depth = new Map(shown.map((k, i) => [k, shown.length - 1 - i]));
+ // The headline goal, when the state names one (the closest goal in force -- the measure state's
+ // `goals.headline`, a row or a goal carrying its row): its note's key, else null (the newest leads).
+ const hl = s?.goals && !Array.isArray(s.goals) ? s.goals.headline : s?.goalHeadline;
+ const hlRow = typeof hl === "string" ? hl : hl?.row ?? null;
+ const active = s?.goals && !Array.isArray(s.goals) && Array.isArray(s.goals.active) ? s.goals.active.length : null;
states.push({
at: r4(e.t),
top: key,
repeat: note.count > 1,
- goalsSet: Array.isArray(s?.goals) ? s.goals.length : n,
+ ...(hlRow && rowKey.has(hlRow) ? { headline: rowKey.get(hlRow) } : {}),
+ ...(active !== null ? { active } : {}),
+ goalsSet: Array.isArray(s?.goals) ? s.goals.length : Array.isArray(s?.goals?.set) ? s.goals.set.length : n,
notes: shown.map((k) => {
const x = notes.get(k);
return {
diff --git a/umtool/report-to-video/modules/goals.mjs b/umtool/report-to-video/modules/goals.mjs
@@ -28,7 +28,7 @@ export default measureExtraModule({
rows: [
["`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`"],
],
diff --git a/umtool/report-to-video/shelf.test.mjs b/umtool/report-to-video/shelf.test.mjs
@@ -262,3 +262,21 @@ test("goals on the shelf: the count and the fanned notes, the fan taking the she
// Off the shelf: the pile in the footage, as it was.
assert.doesNotMatch(goalsHtml(schedule(), renderOf(INSTRUMENTS), { fonts: {} }).html, /class="gc"/);
});
+
+test("goals on the shelf: the headline goal leads when the state names one (goals.headline), with the ladder's count; else the newest", () => {
+ const r = renderOf(FAN);
+ const m = clone(MEASURE);
+ // The state as the dial-ghosts lane writes it: goals an object with the headline (a goal carrying its row) and those in force.
+ const firstGoal = m.events.findIndex((e) => e.kind === "goal" || e.kind === "goalLoss");
+ const lastGoal = m.events.map((e, i) => [e, i]).filter(([e]) => e.kind === "goal" || e.kind === "goalLoss").at(-1)[1];
+ const hl = m.events[firstGoal].row;
+ const s = m.state[lastGoal + 1];
+ s.goals = { set: Array.isArray(s.goals) ? s.goals : [], headline: { row: hl }, active: [hl, "x", "y"] };
+ const states = goalStates(schedule({ measure: m }), r);
+ assert.equal(states.at(-1).headline, states[0].top, "the first goal's note heads the last state");
+ assert.equal(states.at(-1).active, 3);
+ const { html } = goalsHtml(schedule({ measure: m }), r, { fonts: {} });
+ assert.match(html, /<div class="mo">\+2 more<\/div>/);
+ // Without it, the newest leads, as before.
+ assert.equal("headline" in goalStates(schedule(), r).at(-1), false);
+});