From bb4fda72ec5e3475b965a055ad14d90234a12a4e Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Thu, 29 Oct 2026 15:04:56 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20dashboard:=20Merged=20counter=20?= =?UTF-8?q?is=20an=20odometer=20at=20rest,=20bee=20at=20full=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #15409 enlarged the flying .cue-flight glyph, not the pill's .ham-merged-ico (12px), and drew the roll as a 900ms .ham-odo overlay over plain --fs-sm text, so at rest the Merged pill was a small hexagon and a bold number. The counter is now a persistent drum (one .ham-odo-col wheel per digit in a dark inset cell with a roller gradient, inner shadows and hairline dividers; monospace tabular 18px digits; no thousands separator) that only the changed wheels roll through, the pill's bee is 28px with the pill and sticky bar grown to fit, reduced motion swaps instantly, and the day/week line rolls through the same columns drawn plain. Signed-off-by: Andrew Anderson Fixes #15469 Signed-off-by: Andrew Anderson --- changelog.d/fixed-merged-odometer-at-rest.md | 1 + src/docs/dashboard-sections.md | 6 +- src/pkg/dashboard/stage_tracker_cues_test.go | 162 ++++++++++------- src/pkg/dashboard/static-src/css/tracker.css | 58 ++++-- .../dashboard/static-src/js/tracker-merged.js | 110 ++++++++---- src/pkg/dashboard/static/index.html | 168 +++++++++++++----- 6 files changed, 340 insertions(+), 165 deletions(-) create mode 100644 changelog.d/fixed-merged-odometer-at-rest.md diff --git a/changelog.d/fixed-merged-odometer-at-rest.md b/changelog.d/fixed-merged-odometer-at-rest.md new file mode 100644 index 0000000000..832246ed67 --- /dev/null +++ b/changelog.d/fixed-merged-odometer-at-rest.md @@ -0,0 +1 @@ +- Dashboard: the Activity Monitor's Merged counter is a mechanical odometer at rest, always (a dark inset drum cell per digit, 18 px tabular digits; only the wheels that change roll), and the pill's hexagon bee is 28 px with the pill grown to fit — #15409 had sized only the flying glyph and drawn the roll as a transient overlay over plain text. diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index 1d09f03f6e..af6ec9bdf3 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -1137,19 +1137,19 @@ Payloads without `drawn_under` draw as before. #### Merged (the chip, the ledger, the flight) -A thin bar at the top of the tracker — it stays pinned under the card header while the list scrolls, with the stage column header strip pinned just below it — carries a small hex glyph with **Merged N**: every pull request the hive tracked that reached merged, *all time*, with *N today · N this week* beneath. The number is the server's, not the tab's: the hive keeps a **merged ledger** at `/data/merged-ledger.json` (entries for 90 days, an all-time total that only grows, atomic writes, seeded on first boot from the audit log's `pr_merged` history with the PR throughput counter as the floor, then backfilled by the first closed sweep, which on such a boot asks GitHub for every PR closed in the last 30 days — merges by people and other bots the audit log never saw — instead of its usual one day; so the ledger counts every merged PR in a configured repository, and its all-time number is expected to run above the hive-observed PR throughput counter it was seeded from) fed by the audit log's `pr_merged` lines — the hive's own merges on every path and the poller's observations of merges by people or other bots — and by webhook / closed-sweep snapshots of a PR GitHub reports merged, which carry the title and the merger's login within seconds. +A thin bar at the top of the tracker — it stays pinned under the card header while the list scrolls, with the stage column header strip pinned just below it — carries the hexagon bee (28 px; the pill grows to fit it) with **Merged** and the all-time count drawn as a **mechanical odometer at rest, always** — each digit in its own dark inset drum cell with a roller gradient, inner shadows top and bottom and a hairline between cells, monospace tabular digits at 18 px, no thousands separator — every pull request the hive tracked that reached merged, *all time*, with *N today · N this week* beside it at the bar's usual size. The number is the server's, not the tab's: the hive keeps a **merged ledger** at `/data/merged-ledger.json` (entries for 90 days, an all-time total that only grows, atomic writes, seeded on first boot from the audit log's `pr_merged` history with the PR throughput counter as the floor, then backfilled by the first closed sweep, which on such a boot asks GitHub for every PR closed in the last 30 days — merges by people and other bots the audit log never saw — instead of its usual one day; so the ledger counts every merged PR in a configured repository, and its all-time number is expected to run above the hive-observed PR throughput counter it was seeded from) fed by the audit log's `pr_merged` lines — the hive's own merges on every path and the poller's observations of merges by people or other bots — and by webhook / closed-sweep snapshots of a PR GitHub reports merged, which carry the title and the merger's login within seconds. `GET /api/stage-tracker` returns it as `merged{today, total_7d, total_30d, all_time, recent[≤20], tz, day_start}`; "today" rolls at midnight in the spoke's zone (`TZ`, else UTC) and the chip hydrates from it on the first render, so a reload, a new tab or a roll shows the same count (hivecommons/hive#15147 — the operator watched 4 become 0). Within a tab the number never goes down; a merge the tab just watched is added on top until the server's list carries it, and that list is also what settles a vanished row as *merged* rather than closed (alongside `recently_merged`), so a human's merge celebrates too. **Click the chip** for a popover of the recent merges — number (linked), title, *by hive* / *by @login*, lane, time — and the 30-day total; it is also where a merged row's trace lives once the row has left. When a PR on the list merges its row does **not** simply vanish on the next refresh: it stays pinned for about 3.5 s, its ✓ cell glows amber, the event line reads *Hive: merged #14947 · by hive*, and — in the operator's words — "an animation originates from the item's row where the check mark is and flies up to the top of the browser border; if the Merged pill is visible the animation stops there, if not we just see it go off the screen": a 🐝 (or **+1**, ⚙ → Merges → *Glyph*, `hive.tracker.celebrate_glyph`) rises out of the ✓ cell for ≈2 s on an ease-out with a slight arc, lands on the chip when the chip's box is inside the viewport (the count rolls up like a mileage odometer — each digit that rose slides up through the digits it passes over ≈0.9 s — with a soft scale-pop, and the merge zap, when sound is on, plays as it lands) or exits through the top edge otherwise (the count still rolls). -*N today · N this week* roll the same way; a number that falls (today → 0 at midnight), the first draw after a reload, and reduced motion just set the value, and the pill's width never changes mid-roll (the plain text underneath sets it). It works at any scroll position (`position: fixed`, `pointer-events: none`). At the same moment a **banner** appears at the bottom right — *✓ #15067 merged — fix: enable bulk delegation… (adopted, by hive, 17:42)* — and stays until dismissed or 30 s, stacked (newest at the bottom, at most five) when several merge together, with **Show row** (scrolls to the row and glows it again; once the row has left, says so and opens the list), **Open on GitHub** and **All merges**. +On a change only the wheels whose digit changed roll (the rightmost always spins a full turn, carry wheels roll too); the others keep their cell. *N today · N this week* roll the same way, drawn plain; a number that falls (today → 0 at midnight), the first draw after a reload (the tab's last values are remembered in `sessionStorage`, so a reload rolls up from them), and reduced motion swap instantly and the drum stays — the odometer look is the resting state, not an effect of the roll ("where is my odometer look and feel?", after #15409 had sized only the flying bee and drawn the roll as a 900 ms overlay over plain text). The pill's width never changes mid-roll (the drum's cells set it). It works at any scroll position (`position: fixed`, `pointer-events: none`). At the same moment a **banner** appears at the bottom right — *✓ #15067 merged — fix: enable bulk delegation… (adopted, by hive, 17:42)* — and stays until dismissed or 30 s, stacked (newest at the bottom, at most five) when several merge together, with **Show row** (scrolls to the row and glows it again; once the row has left, says so and opens the list), **Open on GitHub** and **All merges**. Several merges in one refresh stagger 200 ms apart with at most three glyphs in flight (the rest bump the count without flying); a merged PR that is filtered out or on another page still counts and still gets its banner. Under reduced motion nothing flies: the glyph fades in place, the count bumps, the row glows, the banners appear without sliding. A PR drawn inline on its issue's row (the usual case — one covering PR, no sub-row) celebrates on that issue row: every row stamps the PR keys it draws (`data-ham-prs`) and the SPA remembers each PR's host row from the last payload, so the flight has somewhere to start from even when the merge also closes the issue. The ⚙ dialog's **Merges** section has **Celebrate merges** (default on, `hive.tracker.celebrate`); off, the row leaves as before and the zap plays at once. **Test celebration** beside it closes the dialog, picks the first row currently in the viewport (scrolling one into view if none is) and plays one flight from it with a *(test)* banner — pop and zap, the count itself unchanged — so the effect can be checked without waiting for a merge; under reduced motion it says so and only pops. -The row effect is reusable in the SPA as `celebrateRow(rowEl, {kind: 'merged' | 'closed-by-merge'})`. Class names: `ham-sticky` (the pinned bar), `ham-merged-count` / `ham-merged-pop` (chip, popover), `cue-flight` / `cue-flight-fade` (the glyph), `merge-banners` / `merge-banner`. +The row effect is reusable in the SPA as `celebrateRow(rowEl, {kind: 'merged' | 'closed-by-merge'})`. Class names: `ham-sticky` (the pinned bar), `ham-merged-count` / `ham-merged-pop` (chip, popover), `ham-merged-ico` (the bee), `ham-merged-n` / `ham-merged-sub` (the counters; each holds one `ham-odo` drum of `ham-odo-col` wheels — `ham-odo-roll` while one rolls — and `ham-odo-static` plates, with the value on `data-odo-value` and `aria-label`), `cue-flight` / `cue-flight-fade` (the glyph), `merge-banners` / `merge-banner`. #### Multi-select diff --git a/src/pkg/dashboard/stage_tracker_cues_test.go b/src/pkg/dashboard/stage_tracker_cues_test.go index 4a6fb7ef35..0276e12c14 100644 --- a/src/pkg/dashboard/stage_tracker_cues_test.go +++ b/src/pkg/dashboard/stage_tracker_cues_test.go @@ -69,6 +69,16 @@ func TestStageTrackerCuesWiring(t *testing.T) { `:root { --cue-flight-size: var(--fs-3xl); --cue-flight-halo: drop-shadow(`, `.cue-flight { position: fixed; z-index: var(--z-cue-flight); font-size: var(--cue-flight-size); line-height: 1; color: var(--amber); font-weight: var(--fw-semibold); filter: var(--cue-flight-halo);`, `.ham-merged-count .ham-merged-n { font-variant-numeric: tabular-nums;`, + // The pill's own bee is 28 px and the count is a drum at rest + // (hivecommons/hive#15398 follow-up: #15409 sized only the flying + // glyph, and the roll was a 900 ms overlay over plain text). + `:root { --ham-merged-bee: 28px; --ham-odo-digit: 18px; }`, + `.ham-merged-count .ham-merged-ico { flex: 0 0 auto; width: var(--ham-merged-bee); height: var(--ham-merged-bee);`, + `.ham-merged-count .ham-merged-n .ham-odo-col { position: relative;`, + `.ham-merged-count .ham-merged-n .ham-odo-col + .ham-odo-col { border-left:`, + `body.light-mode .ham-merged-count .ham-merged-n .ham-odo-col {`, + `.ham-odo-run .ham-odo-roll .ham-odo-strip { transition: transform var(--odo-ms, 900ms)`, + `.ham-odo-strip { transition: none !important; }`, // The chip and the column header strip stick under the navbar // while the list scrolls (hivecommons/hive#15096: the chip sat // 2,300 px above the operator's viewport when the merge played). @@ -285,7 +295,9 @@ func stageTrackerCelebrateJS(t *testing.T, html string) string { jsFunc(t, html, "stageTrackerMergedSync"), jsFunc(t, html, "stageTrackerMergedHoldback"), jsFunc(t, html, "stageTrackerOdometerPlan"), + jsFunc(t, html, "stageTrackerOdometerRest"), jsFunc(t, html, "stageTrackerOdometerSet"), + jsFunc(t, html, "stageTrackerOdometerDraw"), jsFunc(t, html, "stageTrackerOdometerSeed"), jsFunc(t, html, "stageTrackerMergedLastParse"), jsFunc(t, html, "stageTrackerMergedLastLoad"), @@ -380,6 +392,7 @@ let _stageTrackerEvents = {}; const STAGE_TRACKER_TERMINAL = 110; var _stageTrackerPRHost = {}; var _stageTrackerPRTitle = {}; var _stageTrackerMergeState = null, _stageTrackerZapped = {}, _stageTrackerMerged = { server: null, local: {} }, _stageTrackerMergedShown = 0, _stageTrackerCelebrating = {}, _stageTrackerCelebratePending = {}, _stageTrackerFlights = 0, _stageTrackerReleaseTimer = 0; let settingsClosed = 0; function closeStageTrackerSettings() { settingsClosed++; } +const odoText = e => e.getAttribute('data-odo-value'); const flights = () => body.children.filter(c => c.classList.contains('cue-flight')); function row(key, prs) { const r = el('div', { 'data-ham-key': key }); r.classList.add('ham-row'); if (prs) r.attrs['data-ham-prs'] = prs; const strip = el('div'); strip.classList.add('ham-strip-row'); const cap = el('li'); cap.classList.add('ham-seg'); cap.classList.add('cap'); cap.rect = { left: 300, top: 400, width: 20, height: 20 }; strip.appendChild(cap); r.appendChild(strip); srcs.set(r, ''); return r; } const header = { key: '__header__', html: 'h' }; @@ -407,12 +420,12 @@ assert.ok(r1.children.some(c => c.classList.contains('cue-event') && /merged #1 assert.strictEqual(flights().length, 1, 'one glyph in flight'); assert.strictEqual(flights()[0].textContent, '🐝', 'the default glyph is the bee'); assert.strictEqual(flights()[0].style.props['--cue-dx'], (530 - 310) + 'px'); assert.strictEqual(flights()[0].style.props['--cue-dy'], (20 - 410) + 'px', 'the chip is in view: the flight ends on it'); assert.strictEqual(flights()[0].style.props['--cue-end-opacity'], '0.25'); -assert.strictEqual(n.textContent, '0', 'the count waits for the glyph'); +assert.strictEqual(odoText(n), '0', 'the count waits for the glyph'); assert.strictEqual(banners.children.length, 1, 'a banner is up at once'); assert.ok(/#1<\/span> merged/.test(banners.children[0].innerHTML), banners.children[0].innerHTML); assert.ok(banners.children[0].innerHTML.includes('data-action="hamBannerShowRow" data-arg0="o/r/pr#1"'), 'show row link'); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(flights().length, 0, 'glyph gone'); assert.strictEqual(n.textContent, '1', 'count bumped'); assert.ok(chip.classList.contains('cue-tick'), 'pop'); assert.deepStrictEqual(zaps, [1], 'zap on arrival'); +assert.strictEqual(flights().length, 0, 'glyph gone'); assert.strictEqual(odoText(n), '1', 'count bumped'); assert.ok(chip.classList.contains('cue-tick'), 'pop'); assert.deepStrictEqual(zaps, [1], 'zap on arrival'); assert.ok(chip.title.startsWith('Merged: 1 all time\n1 today · 1 this week\no/r#1 · '), chip.title); -assert.strictEqual(sub.textContent, '1 today · 1 this week'); +assert.strictEqual(odoText(sub), '1 today · 1 this week'); assert.strictEqual(live.textContent, 'Merged: 1 all time, 1 today · 1 this week', 'announced for screen readers'); rows = stageTrackerPinnedRows(panel, [header], clock); assert.ok(rows.some(r => r.key === 'o/r/pr#1'), 'still pinned before 3.5 s (' + (clock) + ')'); @@ -430,10 +443,10 @@ tick(0); assert.strictEqual(flights().length, 1, 'first glyph at once'); tick(STAGE_TRACKER_CELEBRATE_STAGGER_MS); assert.strictEqual(flights().length, 2, 'second 200 ms later'); tick(STAGE_TRACKER_CELEBRATE_STAGGER_MS); assert.strictEqual(flights().length, 3); tick(STAGE_TRACKER_CELEBRATE_STAGGER_MS); assert.strictEqual(flights().length, 3, 'capped at ' + STAGE_TRACKER_CELEBRATE_MAX_FLIGHTS + ' flights'); -assert.strictEqual(n.textContent, '2', 'the capped one bumped without flying'); +assert.strictEqual(odoText(n), '2', 'the capped one bumped without flying'); assert.strictEqual(banners.children.length, STAGE_TRACKER_MERGE_BANNER_MAX, 'banners stack, oldest dropped past the cap'); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(flights().length, 0); assert.strictEqual(n.textContent, '6'); assert.deepStrictEqual(zaps, [], 'muted'); +assert.strictEqual(flights().length, 0); assert.strictEqual(odoText(n), '6'); assert.deepStrictEqual(zaps, [], 'muted'); tick(STAGE_TRACKER_MERGE_BANNER_MS); assert.strictEqual(banners.children.length, 0, 'banners leave on their own after ' + STAGE_TRACKER_MERGE_BANNER_MS + ' ms'); @@ -442,13 +455,13 @@ reduced = true; panel.appendChild(row('o/r/pr#8')); stageTrackerNoteMerges(items(8)); stageTrackerNoteMerges(payloadMerged(8)); tick(0); assert.strictEqual(flights().length, 1, 'a fading glyph'); assert.ok(flights()[0].classList.contains('cue-flight-fade')); assert.strictEqual(flights()[0].style.props['--cue-dy'], '0px', 'no travel'); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(flights().length, 0); assert.strictEqual(n.textContent, '7'); +assert.strictEqual(flights().length, 0); assert.strictEqual(odoText(n), '7'); assert.ok(panel.querySelector('[data-ham-key="o/r/pr#8"]').classList.contains('cue-merged')); reduced = false; // 4. A merged PR not on the board still counts. stageTrackerNoteMerges(items(9)); stageTrackerNoteMerges(payloadMerged(9)); tick(0); -assert.strictEqual(n.textContent, '8'); assert.strictEqual(flights().length, 0); +assert.strictEqual(odoText(n), '8'); assert.strictEqual(flights().length, 0); assert.ok(banners.children.some(b => /#9<\/span> merged/.test(b.innerHTML) && !b.innerHTML.includes('hamBannerShowRow')), 'its banner has no "show row" (no row)'); // 5. Toggle off: immediate zap as before, no pin. @@ -457,7 +470,7 @@ stageTrackerSetCelebrate(false); soundOn = true; zaps.length = 0; panel.appendCh stageTrackerNoteMerges(items(10)); stageTrackerNoteMerges(payloadMerged(10)); assert.deepStrictEqual(zaps, [1], 'zap at once'); assert.deepStrictEqual(stageTrackerPinnedRows(panel, [header], clock).map(r => r.key), ['__header__'], 'nothing pinned'); -assert.strictEqual(n.textContent, '9', 'the counter still counts'); +assert.strictEqual(odoText(n), '9', 'the counter still counts'); // celebrateRow is reusable on its own. stageTrackerSetCelebrate(true); const r11 = row('o/r/issue#11'); panel.appendChild(r11); @@ -505,7 +518,7 @@ panel.appendChild(row('hivecommons/hive/issue#14816', 'hivecommons/hive/pr#14822 panel.appendChild(row('hivecommons/hive/issue#15009', 'hivecommons/hive/pr#15017 hivecommons/hive/pr#15020')); panel.appendChild(row('hivecommons/docs/pr#500', 'hivecommons/docs/pr#500')); stageTrackerNoteMerges(before); -assert.strictEqual(n.textContent, '1', 'hydrated from the server ledger, no flourish'); +assert.strictEqual(odoText(n), '1', 'hydrated from the server ledger, no flourish'); assert.strictEqual(stageTrackerCelebrateRowKey('hivecommons/hive/pr#14822', panel), 'hivecommons/hive/issue#14816', 'inline PR resolves to its issue row'); assert.strictEqual(stageTrackerCelebrateRowKey('hivecommons/hive/pr#15020', panel), 'hivecommons/hive/issue#15009'); assert.strictEqual(stageTrackerCelebrateRowKey('hivecommons/docs/pr#500', panel), 'hivecommons/docs/pr#500'); @@ -515,14 +528,14 @@ stageTrackerNoteMerges(after); assert.deepStrictEqual(Object.keys(_stageTrackerCelebrating), ['hivecommons/hive/issue#14816'], 'the issue row is the celebrating row'); let rows = stageTrackerPinnedRows(panel, [{ key: '__header__', html: 'h' }, { key: 'hivecommons/hive/issue#15009', html: 'x' }, { key: 'hivecommons/docs/pr#500', html: 'y' }], clock); assert.ok(rows.some(r => r.key === 'hivecommons/hive/issue#14816' && r.pinned), 'the dropped issue row is pinned'); -assert.strictEqual(n.textContent, '1', 'the server already counts it: held back until the glyph lands'); +assert.strictEqual(odoText(n), '1', 'the server already counts it: held back until the glyph lands'); tick(0); const issueRow = panel.children[0]; assert.ok(issueRow.classList.contains('cue-merged'), 'issue row glows: ' + issueRow.className); assert.ok(issueRow.children.some(c => c.classList.contains('cue-event') && /merged #14822 · by hive/.test(c.textContent)), 'event line names the merged PR'); assert.strictEqual(flights().length, 1, 'a glyph is in flight'); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(flights().length, 0); assert.strictEqual(n.textContent, '2', 'count bumped on landing'); assert.deepStrictEqual(zaps, [1]); +assert.strictEqual(flights().length, 0); assert.strictEqual(odoText(n), '2', 'count bumped on landing'); assert.deepStrictEqual(zaps, [1]); // Host memory: a PR whose row left the DOM between renders (no stamp to find) still resolves through the last payload. panel.children.length = 0; @@ -536,7 +549,7 @@ const r = stageTrackerTestCelebration(); assert.deepStrictEqual(r, { flew: true, lands: true, faded: false }, JSON.stringify(toasts)); assert.strictEqual(flights().length, 1, 'test glyph in flight'); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(n.textContent, '2', 'the test does not count'); assert.ok(chip.classList.contains('cue-tick'), 'but pops'); assert.deepStrictEqual(zaps, [1], 'and zaps'); +assert.strictEqual(odoText(n), '2', 'the test does not count'); assert.ok(chip.classList.contains('cue-tick'), 'but pops'); assert.deepStrictEqual(zaps, [1], 'and zaps'); assert.ok(!panel.children[0].children.some(c => c.classList.contains('cue-event')), 'no event line is written for a test'); tick(STAGE_TRACKER_CELEBRATE_PIN_MS + 1); assert.ok(!panel.children[0].classList.contains('cue-merged'), 'test glow clears'); @@ -558,8 +571,8 @@ const rec = (num, by, title) => ({ repo: 'o/r', number: num, title: title || ('f // First render: the server number, no pop, no zap. panel.appendChild(row('o/r/pr#1')); stageTrackerNoteMerges({ items: [{ repo: 'o/r', kind: 'pr', number: 1, stage: 50, title: 'feat: one' }], merged: merged(33, [rec(31, 'clubanderson'), rec(30)]) }); -assert.strictEqual(n.textContent, '33', 'hydrated from the server on first render'); -assert.strictEqual(sub.textContent, '4 today · 9 this week'); +assert.strictEqual(odoText(n), '33', 'hydrated from the server on first render'); +assert.strictEqual(odoText(sub), '4 today · 9 this week'); assert.ok(!chip.classList.contains('cue-tick'), 'no pop on hydration'); assert.deepStrictEqual(zaps, []); assert.ok(chip.title.startsWith('Merged: 33 all time\n4 today · 9 this week (UTC)\no/r#31 fix 31 · '), chip.title); // Popover: click opens it with the recent list. @@ -570,10 +583,10 @@ assert.ok(pop.innerHTML.includes('33 all time'), pop.innerHTML); assert.strictEqual(hamMergedToggle(), false); assert.strictEqual(pop.hidden, true); assert.strictEqual(chip.attrs['aria-expanded'], 'false'); // A lower server number later (a roll before the ledger caught up) does not pull the chip down. stageTrackerNoteMerges({ items: [{ repo: 'o/r', kind: 'pr', number: 1, stage: 50, title: 'feat: one' }], merged: merged(30, [rec(30)]) }); -assert.strictEqual(n.textContent, '33', 'never backwards'); +assert.strictEqual(odoText(n), '33', 'never backwards'); // The server already counts the merge (webhook beat the poll; the ledger's recent list is what settles it): the chip holds back by one until the glyph lands. stageTrackerNoteMerges({ items: [], merged: merged(34, [rec(1, 'hive', 'feat: one'), rec(31, 'clubanderson'), rec(30)]) }); -assert.strictEqual(n.textContent, '33', 'held back while the glyph flies'); +assert.strictEqual(odoText(n), '33', 'held back while the glyph flies'); tick(0); assert.strictEqual(flights().length, 1); assert.ok(banners.children[0].innerHTML.includes('feat: one (hive, by hive, '), 'the banner carries the ledger title and merger: ' + banners.children[0].innerHTML); assert.ok(banners.children[0].innerHTML.includes('href="https://github.com/o/r/pull/1"'), 'and the link'); @@ -589,9 +602,9 @@ for (const b of [{ key: 'o/r/pr#15122', repo: 'o/r', pr: { number: 15122 }, at: assert.strictEqual(stageTrackerMergeBannerText({ repo: 'o/r', at: 0 }, 0).head, 'merged', 'no number anywhere: no bare "#"'); assert.ok(!stageTrackerMergeBanner({ repo: 'o/r', at: 0 }).innerHTML.includes('>#<'), 'never a bare "#"'); banners.children[banners.children.length - 1].remove(); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(n.textContent, '34', 'bumps on landing'); assert.ok(chip.classList.contains('cue-tick')); +assert.strictEqual(odoText(n), '34', 'bumps on landing'); assert.ok(chip.classList.contains('cue-tick')); stageTrackerNoteMerges({ items: [], merged: merged(34, [rec(1, 'hive', 'feat: one'), rec(31, 'clubanderson'), rec(30)]) }); -assert.strictEqual(n.textContent, '34', 'steady once the server lists it'); +assert.strictEqual(odoText(n), '34', 'steady once the server lists it'); // A merge the server has not recorded yet still counts in this tab, and reconciles when it arrives. panel.appendChild(row('o/r/pr#2')); stageTrackerNoteMerges({ items: [{ repo: 'o/r', kind: 'pr', number: 2, stage: 50, title: 'fix: two' }], merged: merged(34, [rec(1), rec(31), rec(30)]) }); @@ -599,11 +612,11 @@ stageTrackerNoteMerges({ items: [], recently_merged: [{ repo: 'o/r', number: 2 } tick(0); assert.ok(banners.children[banners.children.length - 1].innerHTML.includes('href="https://github.com/o/r/pull/2"'), 'a banner the ledger has not enriched yet still links to the PR: ' + banners.children[banners.children.length - 1].innerHTML); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(n.textContent, '35', 'local merge on top of the server number'); -assert.strictEqual(sub.textContent, '5 today · 10 this week'); +assert.strictEqual(odoText(n), '35', 'local merge on top of the server number'); +assert.strictEqual(odoText(sub), '5 today · 10 this week'); stageTrackerNoteMerges({ items: [], merged: merged(35, [rec(2), rec(1), rec(31), rec(30)], { today: 5, total_7d: 10 }) }); -assert.strictEqual(n.textContent, '35', 'no double count when the server catches up'); -assert.strictEqual(sub.textContent, '5 today · 10 this week'); +assert.strictEqual(odoText(n), '35', 'no double count when the server catches up'); +assert.strictEqual(odoText(sub), '5 today · 10 this week'); // "Show row" from a banner scrolls to the row while it is on the board, and says so once it has gone. const r2 = panel.querySelector('[data-ham-key="o/r/pr#2"]'); let scrolled = 0; r2.scrollIntoView = () => { scrolled++; }; assert.strictEqual(hamBannerShowRow('o/r/pr#2'), true); assert.strictEqual(scrolled, 1); assert.ok(r2.classList.contains('cue-merged')); @@ -618,11 +631,14 @@ console.log('ok'); `) } -// TestStageTrackerOdometerNode: the chip's numbers roll like a mileage -// odometer when they rise — per digit, through the digits it passes — and -// just set on the first draw, on a fall (today → 0 at midnight), under -// reduced motion, and when the text's words changed; the plain text is -// always the final value so width, tests and screen readers see no roll. +// TestStageTrackerOdometerNode: the chip's numbers are a drum at rest — +// one .ham-odo-col wheel per digit, a .ham-odo-static plate per run of +// other characters — and roll like a mileage odometer when they rise: +// only the wheels that change carry ham-odo-roll and a strip of the +// digits they pass; the rest keep one cell. The first draw, a fall (today +// → 0 at midnight), reduced motion and text whose words changed draw the +// drum at rest. The value is on data-odo-value and aria-label (the drum's +// cells are aria-hidden), so a screen reader and a redraw read one number. func TestStageTrackerOdometerNode(t *testing.T) { html := indexHTML(t) runStageTrackerRowActionsScript(t, stageTrackerCelebrateJS(t, html)+stageTrackerCelebrateFixture+` @@ -630,57 +646,75 @@ func TestStageTrackerOdometerNode(t *testing.T) { // its own distance, every wheel right of it — and the rightmost wheel // always — spins a full turn first (hivecommons/hive#15398: a one-cell // nudge was invisible); carries wrap past 9, a new leading digit comes in -// from a blank, falls and foreign text sit still. +// from a blank; unchanged digits, falls and held numbers are still wheels +// (one cell) so the drum never loses a cell mid-roll; foreign text sits. const turn = (from, to) => { const out = [from]; let d = Number(from); do { d = (d + 1) % 10; out.push(String(d)); } while (d !== Number(to) || out.length <= STAGE_TRACKER_ODOMETER_TURN); return out; }; +const still = d => ({ steps: [d] }); assert.deepStrictEqual(turn('7', '8'), ['7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8'], 'a +1 on the last wheel is a full turn and one'); -assert.deepStrictEqual(stageTrackerOdometerPlan('9127', '9128'), [{ text: '9' }, { text: '1' }, { text: '2' }, { steps: turn('7', '8') }]); +assert.deepStrictEqual(stageTrackerOdometerPlan('9127', '9128'), [still('9'), still('1'), still('2'), { steps: turn('7', '8') }]); assert.deepStrictEqual(stageTrackerOdometerPlan('199', '200'), [{ steps: ['1', '2'] }, { steps: turn('9', '0') }, { steps: turn('9', '0') }], 'a carry: the first wheel steps once, the zeros whirr past'); -assert.deepStrictEqual(stageTrackerOdometerPlan('9471', '9481'), [{ text: '9' }, { text: '4' }, { steps: ['7', '8'] }, { steps: turn('1', '1') }], 'an unchanged wheel right of the change still spins round once'); +assert.deepStrictEqual(stageTrackerOdometerPlan('9471', '9481'), [still('9'), still('4'), { steps: ['7', '8'] }, { steps: turn('1', '1') }], 'an unchanged wheel right of the change still spins round once'); assert.deepStrictEqual(stageTrackerOdometerPlan('7', '12'), [{ steps: [' ', '1'] }, { steps: turn('7', '2') }], 'a grown number rolls its new column in from a blank'); -assert.deepStrictEqual(stageTrackerOdometerPlan('201 today · 730 this week', '0 today · 731 this week'), [{ text: '0' }, { text: ' today · ' }, { text: '7' }, { text: '3' }, { steps: turn('0', '1') }, { text: ' this week' }], 'the day rollover sets today and rolls the week'); +assert.deepStrictEqual(stageTrackerOdometerPlan('201 today · 730 this week', '0 today · 731 this week'), [still('0'), { text: ' today · ' }, still('7'), still('3'), { steps: turn('0', '1') }, { text: ' this week' }], 'the day rollover sets today and rolls the week'); assert.strictEqual(stageTrackerOdometerPlan('5', '5'), null, 'no change, no roll'); assert.strictEqual(stageTrackerOdometerPlan('5', '4'), null, 'a fall never rolls'); assert.strictEqual(stageTrackerOdometerPlan('1 today', '2 this week'), null, 'different words: no roll'); assert.strictEqual(stageTrackerOdometerPlan(null, '9'), null); -// The setter: the first write is plain; a rise overlays the columns and -// takes them down after STAGE_TRACKER_ODOMETER_MS; the text is final at once. -const odo = el('span'); +assert.deepStrictEqual(stageTrackerOdometerRest('9539'), [still('9'), still('5'), still('3'), still('9')], 'at rest: a wheel per digit, no thousands separator'); +assert.deepStrictEqual(stageTrackerOdometerRest('108 today · 934 this week'), [still('1'), still('0'), still('8'), { text: ' today · ' }, still('9'), still('3'), still('4'), { text: ' this week' }]); +// The setter: the first write draws the drum at rest — N cells for N +// digits, every strip one cell, nothing rolling; a rise marks only the +// changed wheels ham-odo-roll with the digits they pass, and after +// STAGE_TRACKER_ODOMETER_MS the drum is at rest on the new value. +const drum = e => e.children[0]; +const cols = e => drum(e).children.filter(c => c.classList.contains('ham-odo-col')); +const rolling = e => cols(e).filter(c => c.classList.contains('ham-odo-roll')); +const shown = e => cols(e).map(c => c.children[0].children.map(d => d.textContent).join('')); +const odo = el('span'); odo.textContent = '0'; assert.strictEqual(stageTrackerOdometerSet(odo, 9127), false, 'first draw: no roll'); -assert.strictEqual(odo.textContent, '9127'); assert.strictEqual(odo.children.length, 0); assert.strictEqual(odo.getAttribute('data-odo-value'), '9127'); +assert.strictEqual(odoText(odo), '9127'); assert.strictEqual(odo.getAttribute('aria-label'), '9127'); assert.strictEqual(odo.getAttribute('role'), 'img'); +assert.strictEqual(odo.textContent, '', 'the placeholder text is gone: the drum is the content'); +assert.strictEqual(odo.children.length, 1); assert.strictEqual(drum(odo).className, 'ham-odo'); assert.strictEqual(drum(odo).getAttribute('aria-hidden'), 'true'); +assert.strictEqual(cols(odo).length, 4, 'four digits, four drum cells'); assert.deepStrictEqual(shown(odo), ['9', '1', '2', '7']); assert.strictEqual(rolling(odo).length, 0, 'nothing rolls at rest'); +assert.deepStrictEqual(cols(odo).map(c => c.children[0].style.props['--odo-shift']), ['0.000%', '0.000%', '0.000%', '0.000%']); assert.strictEqual(stageTrackerOdometerSet(odo, 9127), false, 'same value: nothing'); assert.strictEqual(stageTrackerOdometerSet(odo, 9128), true, 'a rise rolls'); -assert.strictEqual(odo.textContent, '9128', 'the plain text is the final value at once'); +assert.strictEqual(odoText(odo), '9128', 'the value is final at once'); assert.strictEqual(odo.getAttribute('aria-label'), '9128'); assert.ok(odo.classList.contains('ham-odo-rolling')); -assert.strictEqual(odo.children.length, 1); const wrap = odo.children[0]; -assert.strictEqual(wrap.className, 'ham-odo ham-odo-run'); assert.strictEqual(wrap.getAttribute('aria-hidden'), 'true'); -assert.deepStrictEqual(wrap.children.map(c => c.className), ['ham-odo-static', 'ham-odo-static', 'ham-odo-static', 'ham-odo-col']); -const strip = wrap.children[3].children[0]; +assert.strictEqual(odo.children.length, 1, 'one drum, rebuilt in place'); assert.strictEqual(drum(odo).className, 'ham-odo ham-odo-run'); +assert.strictEqual(cols(odo).length, 4, 'still four cells mid-roll'); +assert.deepStrictEqual(cols(odo).map(c => c.classList.contains('ham-odo-roll')), [false, false, false, true], 'only the changed wheel rolls'); +const strip = rolling(odo)[0].children[0]; assert.deepStrictEqual(strip.children.map(c => c.textContent), turn('7', '8')); assert.strictEqual(strip.style.props['--odo-shift'], (-(turn('7', '8').length - 1) * 100 / turn('7', '8').length).toFixed(3) + '%'); -assert.strictEqual(wrap.style.props['--odo-ms'], STAGE_TRACKER_ODOMETER_MS + 'ms'); -assert.strictEqual(odo.children.length, 1, 'the element itself is kept: only an overlay was added'); +assert.strictEqual(drum(odo).style.props['--odo-ms'], STAGE_TRACKER_ODOMETER_MS + 'ms'); tick(STAGE_TRACKER_ODOMETER_MS + 100); -assert.strictEqual(odo.children.length, 0, 'the overlay is gone'); assert.ok(!odo.classList.contains('ham-odo-rolling')); assert.strictEqual(odo.textContent, '9128'); +assert.ok(!odo.classList.contains('ham-odo-rolling')); assert.strictEqual(drum(odo).className, 'ham-odo', 'the run is over'); +assert.deepStrictEqual(shown(odo), ['9', '1', '2', '8'], 'settled: one cell per wheel on the new value'); assert.strictEqual(rolling(odo).length, 0); // A second rise mid-roll restarts from the last value written. -stageTrackerOdometerSet(odo, 9129); assert.strictEqual(odo.children.length, 1); -stageTrackerOdometerSet(odo, 9131); assert.strictEqual(odo.children.length, 1, 'one overlay at a time'); -assert.deepStrictEqual(odo.children[0].children[2].children[0].children.map(c => c.textContent), ['2', '3'], 'tens: 2 → 3'); -assert.deepStrictEqual(odo.children[0].children[3].children[0].children.map(c => c.textContent), turn('9', '1'), 'units: from the 9 last written'); -tick(STAGE_TRACKER_ODOMETER_MS + 100); assert.strictEqual(odo.children.length, 0); -assert.strictEqual(stageTrackerOdometerSet(odo, 3), false, 'a fall just sets'); assert.strictEqual(odo.textContent, '3'); assert.strictEqual(odo.children.length, 0); +stageTrackerOdometerSet(odo, 9129); assert.strictEqual(rolling(odo).length, 1); +stageTrackerOdometerSet(odo, 9131); assert.strictEqual(odo.children.length, 1, 'one drum at a time'); +assert.deepStrictEqual(cols(odo).map(c => c.classList.contains('ham-odo-roll')), [false, false, true, true], 'the tens and the units roll'); +assert.deepStrictEqual(cols(odo)[2].children[0].children.map(c => c.textContent), ['2', '3'], 'tens: 2 → 3'); +assert.deepStrictEqual(cols(odo)[3].children[0].children.map(c => c.textContent), turn('9', '1'), 'units: from the 9 last written'); +tick(STAGE_TRACKER_ODOMETER_MS + 100); assert.deepStrictEqual(shown(odo), ['9', '1', '3', '1']); +assert.strictEqual(stageTrackerOdometerSet(odo, 3), false, 'a fall just sets'); assert.strictEqual(odoText(odo), '3'); assert.deepStrictEqual(shown(odo), ['3']); assert.strictEqual(rolling(odo).length, 0); reduced = true; -assert.strictEqual(stageTrackerOdometerSet(odo, 4), false, 'reduced motion: no roll'); assert.strictEqual(odo.textContent, '4'); assert.strictEqual(odo.children.length, 0); +assert.strictEqual(stageTrackerOdometerSet(odo, 4), false, 'reduced motion: no roll'); assert.strictEqual(odoText(odo), '4'); assert.deepStrictEqual(shown(odo), ['4']); assert.strictEqual(rolling(odo).length, 0); reduced = false; -// A shorter roll for the day/week line: the duration is the caller's. -const odo2 = el('span'); stageTrackerOdometerSet(odo2, '1 today'); stageTrackerOdometerSet(odo2, '2 today', STAGE_TRACKER_ODOMETER_SUB_MS); -assert.strictEqual(odo2.children[0].style.props['--odo-ms'], STAGE_TRACKER_ODOMETER_SUB_MS + 'ms'); tick(STAGE_TRACKER_ODOMETER_SUB_MS + 100); assert.strictEqual(odo2.children.length, 0); +// The day/week line: the same columns, words as static plates, and a +// shorter roll — the duration is the caller's. +const odo2 = el('span'); stageTrackerOdometerSet(odo2, '1 today'); +assert.deepStrictEqual(drum(odo2).children.map(c => c.className), ['ham-odo-col', 'ham-odo-static']); assert.strictEqual(drum(odo2).children[1].textContent, ' today'); +stageTrackerOdometerSet(odo2, '2 today', STAGE_TRACKER_ODOMETER_SUB_MS); +assert.strictEqual(drum(odo2).style.props['--odo-ms'], STAGE_TRACKER_ODOMETER_SUB_MS + 'ms'); assert.strictEqual(rolling(odo2).length, 1); tick(STAGE_TRACKER_ODOMETER_SUB_MS + 100); assert.strictEqual(rolling(odo2).length, 0); // The session seed: an unwritten element takes the value it showed last -// time only when the new value would roll from it. +// time only when the new value would roll from it, and draws it at rest. const odo3 = el('span'); -assert.strictEqual(stageTrackerOdometerSeed(odo3, '9471', 9472), true); assert.strictEqual(odo3.getAttribute('data-odo-value'), '9471'); +assert.strictEqual(stageTrackerOdometerSeed(odo3, '9471', 9472), true); assert.strictEqual(odoText(odo3), '9471'); assert.deepStrictEqual(shown(odo3), ['9', '4', '7', '1']); assert.strictEqual(stageTrackerOdometerSet(odo3, 9472), true, 'the first real write rolls up from the seed'); assert.strictEqual(stageTrackerOdometerSeed(odo3, '1', 2), false, 'a written element is never re-seeded'); const odo4 = el('span'); -assert.strictEqual(stageTrackerOdometerSeed(odo4, '9480', 9472), false, 'a seed ahead of the value is dropped'); assert.strictEqual(odo4.getAttribute('data-odo-value'), null); +assert.strictEqual(stageTrackerOdometerSeed(odo4, '9480', 9472), false, 'a seed ahead of the value is dropped'); assert.strictEqual(odoText(odo4), null); assert.strictEqual(stageTrackerOdometerSeed(odo4, null, 9472), false, 'no seed'); assert.deepStrictEqual(stageTrackerMergedLastParse('{"n":"9471","sub":"73 today · 886 this week"}'), { n: '9471', sub: '73 today · 886 this week' }); assert.strictEqual(stageTrackerMergedLastParse('{"n":"x"}'), null); assert.strictEqual(stageTrackerMergedLastParse('nope'), null); assert.strictEqual(stageTrackerMergedLastParse(''), null); @@ -689,13 +723,13 @@ assert.strictEqual(stageTrackerMergedLastParse('{"n":"x"}'), null); assert.stric panel.appendChild(row('o/r/pr#1')); stageTrackerNoteMerges(items(1)); stageTrackerNoteMerges(payloadMerged(1)); tick(0); stageTrackerMergedCountDraw(false); -assert.strictEqual(n.textContent, '0', 'holds back while the glyph flies'); assert.strictEqual(n.children.length, 0, 'the first draw does not roll'); +assert.strictEqual(odoText(n), '0', 'holds back while the glyph flies'); assert.strictEqual(cols(n).length, 1, 'the first draw is a drum at rest'); assert.strictEqual(rolling(n).length, 0, 'and does not roll'); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(n.textContent, '1'); assert.strictEqual(n.children.length, 1, 'the landing rolls the total'); assert.strictEqual(sub.textContent, '1 today · 1 this week'); assert.strictEqual(sub.children.length, 1, 'and the day/week line'); +assert.strictEqual(odoText(n), '1'); assert.strictEqual(rolling(n).length, 1, 'the landing rolls the total'); assert.strictEqual(odoText(sub), '1 today · 1 this week'); assert.strictEqual(rolling(sub).length, 2, 'and the day/week line'); stageTrackerMergedCountDraw(false); -assert.strictEqual(n.children.length, 1, 'a redraw mid-roll keeps the overlay'); +assert.strictEqual(rolling(n).length, 1, 'a redraw mid-roll keeps the roll'); tick(STAGE_TRACKER_ODOMETER_MS + 100); -assert.strictEqual(n.children.length, 0); assert.strictEqual(sub.children.length, 0); +assert.strictEqual(rolling(n).length, 0); assert.strictEqual(rolling(sub).length, 0); assert.deepStrictEqual(shown(n), ['1']); assert.deepStrictEqual(stageTrackerMergedLastParse(session[STAGE_TRACKER_MERGED_LAST_KEY]), { n: '1', sub: '1 today · 1 this week' }, 'the values shown are remembered for the next load'); // A fresh page (new chip, remembered values behind the server's) rolls up // from them on its first draw instead of just appearing. @@ -703,8 +737,8 @@ session[STAGE_TRACKER_MERGED_LAST_KEY] = JSON.stringify({ n: '0', sub: '0 today const chip2 = el('button', { id: 'activity-monitor-merged' }); const n2 = el('span'); n2.classList.add('ham-merged-n'); const sub2 = el('span'); sub2.classList.add('ham-merged-sub'); chip2.appendChild(n2); chip2.appendChild(sub2); chip.remove(); body.appendChild(chip2); byId['activity-monitor-merged'] = chip2; stageTrackerMergedChip.node = null; stageTrackerMergedCountDraw(false); -assert.strictEqual(n2.textContent, '1'); assert.strictEqual(n2.children.length, 1, 'first draw rolls up from the remembered value'); assert.strictEqual(sub2.children.length, 1); -tick(STAGE_TRACKER_ODOMETER_MS + 100); assert.strictEqual(n2.children.length, 0); +assert.strictEqual(odoText(n2), '1'); assert.strictEqual(rolling(n2).length, 1, 'first draw rolls up from the remembered value'); assert.strictEqual(rolling(sub2).length, 2); +tick(STAGE_TRACKER_ODOMETER_MS + 100); assert.strictEqual(rolling(n2).length, 0); `) } @@ -741,7 +775,7 @@ assert.strictEqual(g.style.props['--cue-dx'], '0px'); assert.strictEqual(g.style assert.strictEqual(g.style.props['left'], (310 - STAGE_TRACKER_CELEBRATE_GLYPH_HALF) + 'px'); assert.strictEqual(g.style.props['top'], (410 - STAGE_TRACKER_CELEBRATE_GLYPH_HALF) + 'px', 'spawned centred on the ✓ cell'); assert.strictEqual(g.attrs['aria-hidden'], 'true'); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(n.textContent, '1', 'the count bumps although the glyph left the screen'); +assert.strictEqual(odoText(n), '1', 'the count bumps although the glyph left the screen'); chip.rect = { left: 500, top: 10, width: 60, height: 20 }; // Test celebration: closes the settings dialog, picks the first row in view (not the first row), flies, shows a "(test)" banner, counts nothing. @@ -756,7 +790,7 @@ assert.ok(inView.classList.contains('cue-merged') && !above.classList.contains(' assert.strictEqual(flights().length, 1); assert.strictEqual(flights()[0].style.props['top'], (410 - STAGE_TRACKER_CELEBRATE_GLYPH_HALF) + 'px', 'from the visible row\'s ✓ cell'); assert.strictEqual(banners.children.length, 1); assert.ok(banners.children[0].innerHTML.includes('(test)'), banners.children[0].innerHTML); tick(STAGE_TRACKER_CELEBRATE_FLY_MS * 1.5 + 1); -assert.strictEqual(n.textContent, '1', 'the test does not count'); assert.ok(chip.classList.contains('cue-tick'), 'but pops'); assert.deepStrictEqual(zaps, [1], 'and zaps'); +assert.strictEqual(odoText(n), '1', 'the test does not count'); assert.ok(chip.classList.contains('cue-tick'), 'but pops'); assert.deepStrictEqual(zaps, [1], 'and zaps'); assert.ok(!inView.children.some(c => c.classList.contains('cue-event')), 'no event line is written for a test'); // Reduced motion: the test fades instead and says so. reduced = true; const r2 = stageTrackerTestCelebration(); assert.strictEqual(r2.faded, true); assert.ok(toasts.some(x => /Reduced motion/.test(x[1]))); diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index 4b91742e1e..28a016f164 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -5,8 +5,10 @@ Review, 085/090 on Merge gate) light the chevron they branch from in their own words, so every strip is the same width. An issue parked on a person (045) lights Actionable with the decision word. */ - /* The sticky chip bar's height (the header strip sticks beneath it). */ - #activity-monitor-section { --ham-sticky-bar-h: 34px; } + /* The sticky chip bar's height (the header strip sticks beneath it): + the Merged pill (--ham-merged-bee + 2 × --sp-1 tall) plus the bar's + own vertical padding. */ + #activity-monitor-section { --ham-sticky-bar-h: 42px; } /* Layers for the merge flight glyph and the merged-toast stack. Both are appended to document.body, not to #activity-monitor-section, so these must be :root-scoped — scoped to the section they resolved to nothing, the @@ -451,24 +453,48 @@ .cue-flight.cue-flight-fade { animation: cue-flight-fade var(--cue-fly-ms, 2000ms) ease-out both; } .ham-sticky { position: sticky; top: var(--navbar-sticky-height); z-index: calc(var(--z-sticky) + 1); display: flex; justify-content: flex-end; align-items: center; min-height: var(--ham-sticky-bar-h); box-sizing: border-box; padding: var(--sp-1) var(--sp-2); background: var(--panel); } .ham-sticky-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } - .ham-merged-count { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text); cursor: pointer; } + /* The Merged pill (hivecommons/hive issue 15398 follow-up — "where is my + odometer look and feel?"): PR 15409 only enlarged the *flying* bee + (.cue-flight) and the roll was a 900 ms overlay over plain text, so + at rest the pill was a 12 px hexagon and a bold number. Now the + hexagon-bee is --ham-merged-bee (28 px) and the pill grows to fit it, + and the all-time count is a drum of wheels at rest, always: each + digit in its own dark inset cell (.ham-merged-n .ham-odo-col) with + a roller gradient, a top/bottom inner shadow and a hairline between + cells, monospace tabular digits at --ham-odo-digit (≥ 18 px). The + day/week line keeps its size and rolls with the same columns, drawn + plain. A wheel that changes (.ham-odo-roll) slides its strip through + the digits it passes (--odo-shift) over --odo-ms; reduced motion + swaps instantly (no transition; the strip is drawn at its end). */ + :root { --ham-merged-bee: 28px; --ham-odo-digit: 18px; } + .ham-merged-count { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: calc(var(--ham-merged-bee) + 2 * var(--sp-1)); color: var(--text); cursor: pointer; } .ham-merged-count:hover { border-color: var(--line-strong); } - .ham-merged-count .ham-merged-ico { width: 12px; height: 12px; color: var(--amber); } - .ham-merged-count .ham-merged-n { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); font-size: var(--fs-sm); } + .ham-merged-count .ham-merged-ico { flex: 0 0 auto; width: var(--ham-merged-bee); height: var(--ham-merged-bee); color: var(--amber); filter: drop-shadow(0 1px 1px color-mix(in srgb, var(--surface-0) 50%, transparent)); } + .ham-merged-count .ham-merged-n { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); font-size: var(--ham-odo-digit); font-family: var(--font-mono); } .ham-merged-count .ham-merged-sub { color: var(--text-faint, var(--muted)); font-variant-numeric: tabular-nums; padding-left: var(--sp-2); border-left: var(--line-width) solid var(--line-subtle); } .ham-merged-count.cue-tick { animation: cue-count-pop 320ms ease-out; } - .ham-merged-count .ham-merged-n, .ham-merged-count .ham-merged-sub { position: relative; } - .ham-merged-count .ham-odo-rolling { color: transparent; } - .ham-odo { position: absolute; inset: 0; display: flex; align-items: center; overflow: hidden; white-space: pre; pointer-events: none; } - .ham-merged-count .ham-merged-n .ham-odo { color: var(--text); } - /* The dark theme's token sheet has no --text-faint (only body.light-mode - sets it), so without a fallback the overlay inherited the rolling - line's transparent colour and the day/week counts vanished mid-roll. */ - .ham-merged-count .ham-merged-sub .ham-odo { left: var(--sp-2); color: var(--text-faint, var(--muted)); } + .ham-merged-count .ham-merged-n, .ham-merged-count .ham-merged-sub { position: relative; display: inline-flex; align-items: center; } + /* The drum: one wrap of columns per counter, laid out inline (it is the + element's only content, so it sets the width). */ + .ham-odo { display: inline-flex; align-items: stretch; white-space: pre; pointer-events: none; } .ham-odo-static, .ham-odo-col, .ham-odo-d { display: block; height: 1.25em; line-height: 1.25; } + .ham-odo-static { align-self: center; } .ham-odo-col { overflow: hidden; } - .ham-odo-strip { display: block; transform: translateY(0); transition: transform var(--odo-ms, 900ms) cubic-bezier(0.22, 0.61, 0.36, 1); } - .ham-odo-run .ham-odo-strip { transform: translateY(var(--odo-shift, 0%)); } + .ham-odo-d { text-align: center; } + .ham-odo-strip { display: block; transform: translateY(var(--odo-shift, 0%)); } + .ham-odo-run .ham-odo-roll .ham-odo-strip { transition: transform var(--odo-ms, 900ms) cubic-bezier(0.22, 0.61, 0.36, 1); } + .ham-odo:not(.ham-odo-run) .ham-odo-roll .ham-odo-strip { transform: translateY(0); } + /* The all-time count's wheels are drum cells: dark inset, a subtle + roller gradient (lighter band through the middle, darker at the lip + and the foot), an inner shadow at top and bottom, a hairline between + digits, the outer corners rounded. Light mode keeps the inset but on + a paler drum. */ + .ham-merged-count .ham-merged-n .ham-odo { gap: 0; border-radius: var(--r-sm); overflow: hidden; border: var(--line-width) solid color-mix(in srgb, var(--surface-0) 70%, var(--line-strong)); box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 10%, transparent); } + .ham-merged-count .ham-merged-n .ham-odo-col { position: relative; min-width: 0.78em; height: 1.35em; line-height: 1.35; padding: 0; color: var(--text); background: linear-gradient(to bottom, color-mix(in srgb, var(--surface-0) 92%, black) 0%, var(--surface-3) 42%, var(--surface-3) 58%, color-mix(in srgb, var(--surface-0) 92%, black) 100%); box-shadow: inset 0 5px 5px -4px color-mix(in srgb, black 75%, transparent), inset 0 -5px 5px -4px color-mix(in srgb, black 75%, transparent); } + .ham-merged-count .ham-merged-n .ham-odo-col + .ham-odo-col { border-left: var(--line-width) solid color-mix(in srgb, var(--surface-0) 80%, black); } + .ham-merged-count .ham-merged-n .ham-odo-col .ham-odo-d { height: 1.35em; line-height: 1.35; } + body.light-mode .ham-merged-count .ham-merged-n .ham-odo-col { color: var(--text); background: linear-gradient(to bottom, color-mix(in srgb, var(--surface-3) 80%, black) 0%, var(--surface-0) 42%, var(--surface-0) 58%, color-mix(in srgb, var(--surface-3) 80%, black) 100%); box-shadow: inset 0 5px 5px -4px color-mix(in srgb, black 35%, transparent), inset 0 -5px 5px -4px color-mix(in srgb, black 35%, transparent); } + body.light-mode .ham-merged-count .ham-merged-n .ham-odo-col + .ham-odo-col { border-left-color: color-mix(in srgb, var(--surface-3) 60%, black); } .ham-merged-pop { position: absolute; right: var(--sp-2); top: calc(var(--full-size) - var(--sp-1)); min-width: 22rem; max-width: 34rem; max-height: 60vh; overflow: auto; padding: var(--sp-4) var(--sp-5); border: var(--line-width) solid var(--line); border-radius: var(--r-lg); background: var(--panel-strong); box-shadow: var(--shadow-raised); font-size: var(--fs-sm); color: var(--text); z-index: var(--z-cue-flight); } .ham-merged-pop-head { display: flex; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-3); font-weight: var(--fw-semibold); } .ham-merged-pop-head .ham-merged-pop-sum { color: var(--text-faint); font-weight: var(--fw-medium); } @@ -502,7 +528,7 @@ @keyframes cue-flight { 0% { opacity: 0; transform: translate(0, 0) scale(0.9); } 12% { opacity: 1; transform: translate(calc(var(--cue-dx, 0px) * 0.08), calc(var(--cue-dy, 0px) * 0.1)) scale(1.1); } 55% { opacity: 1; transform: translate(calc(var(--cue-dx, 0px) * 0.45 + 10px), calc(var(--cue-dy, 0px) * 0.62)) scale(1.05); } 100% { opacity: var(--cue-end-opacity, 0.25); transform: translate(var(--cue-dx, 0px), var(--cue-dy, 0px)) scale(0.7); } } @keyframes cue-flight-fade { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } } @keyframes cue-count-pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } } - @media (prefers-reduced-motion: reduce) { .cue-flight { animation-name: cue-flight-fade; } .ham-merged-count.cue-tick { animation: none; } .ham-odo-strip { transition: none; } .cue-merged .ham-seg.cap { animation-duration: 0.01ms; } .merge-banner, .merge-banner.merge-banner-out { animation: none; } } + @media (prefers-reduced-motion: reduce) { .cue-flight { animation-name: cue-flight-fade; } .ham-merged-count.cue-tick { animation: none; } .ham-odo-strip { transition: none !important; } .cue-merged .ham-seg.cap { animation-duration: 0.01ms; } .merge-banner, .merge-banner.merge-banner-out { animation: none; } } .ham-rm-preview .cue-flight { animation-name: cue-flight-fade; } @media (prefers-reduced-motion: reduce) { .cue-working .ham-seg.active .ham-active-ico, .cue-spin, .cue-acting .ham-seg.active, .cue-event { animation: none; } } @keyframes ham-breathe-human { 0%, 100% { opacity: 0; } 50% { opacity: 0.55; } } diff --git a/src/pkg/dashboard/static-src/js/tracker-merged.js b/src/pkg/dashboard/static-src/js/tracker-merged.js index 119cc6ec1f..41473ce17d 100644 --- a/src/pkg/dashboard/static-src/js/tracker-merged.js +++ b/src/pkg/dashboard/static-src/js/tracker-merged.js @@ -234,7 +234,13 @@ values last shown are kept in sessionStorage (STAGE_TRACKER_MERGED_LAST_KEY) so a reload rolls up from them. The glyph is drawn at --cue-flight-size (two type steps up) with a - theme-aware halo; STAGE_TRACKER_CELEBRATE_GLYPH_HALF centres it. */ + theme-aware halo; STAGE_TRACKER_CELEBRATE_GLYPH_HALF centres it. + Owner (2026-10-29, again): "where is my odometer look and feel?" — + that PR sized the flying bee, not the pill's, and the roll was an + overlay that existed for 900 ms over plain text. The counter is + now a drum at rest, always (stageTrackerOdometerRest / + stageTrackerOdometerDraw): a wheel per digit, the day/week line the + same columns drawn plain; the pill's bee is --ham-merged-bee. */ const STAGE_TRACKER_CELEBRATE_KEY = 'hive.tracker.celebrate'; const STAGE_TRACKER_MERGED_LAST_KEY = 'hive.tracker.merged.last'; const STAGE_TRACKER_CELEBRATE_GLYPH_KEY = 'hive.tracker.celebrate_glyph'; @@ -406,9 +412,11 @@ // Pure: the odometer columns for a change of text from `from` to `to`, // or null when nothing should roll — the texts split into different // static runs ("201 today · 730 this week" keeps its words), no number - // rose, or every rise is a fall elsewhere. A column is { text } (sits - // still: static runs, unchanged digits, numbers that fell or held) or - // { steps: ['9', '0'] } — the digits the column passes, old to new. In + // rose, or every rise is a fall elsewhere. A column is { text } (a + // static run of non-digits), a wheel that sits still — { steps: ['4'] }, + // an unchanged digit or one of a number that fell or held, drawn as a + // drum cell like the rest — or a wheel that rolls, { steps: ['9', '0'] + // } — the digits the column passes, old to new. In // a number that rose, the first changed wheel rolls just the digits // between old and new (wrapping past 9 the way a carry does); every // wheel to its right — and the rightmost wheel always — spins through @@ -426,7 +434,7 @@ const num = /^\d+$/.test(b[i]); if (num !== /^\d+$/.test(a[i])) return null; if (!num) { if (a[i] !== b[i]) return null; cols.push({ text: b[i] }); continue; } - if (Number(b[i]) <= Number(a[i]) || a[i].length > b[i].length) { cols.push({ text: b[i] }); continue; } + if (Number(b[i]) <= Number(a[i]) || a[i].length > b[i].length) { for (const d of b[i]) cols.push({ steps: [d] }); continue; } rose = true; const old = a[i].padStart(b[i].length, ' '); const last = b[i].length - 1; @@ -435,7 +443,7 @@ for (let j = 0; j <= last; j++) { const o = old[j], nw = b[i][j]; const spin = j > first || j === last; - if (o === nw && !spin) { cols.push({ text: nw }); continue; } + if (o === nw && !spin) { cols.push({ steps: [nw] }); continue; } const steps = [o]; if (o === ' ') steps.push(nw); else { let d = Number(o); do { d = (d + 1) % 10; steps.push(String(d)); } while (d !== Number(nw) || (spin && steps.length <= STAGE_TRACKER_ODOMETER_TURN)); } @@ -444,16 +452,34 @@ } return rose ? cols : null; } - // Stateful: write `text` into el, rolling the digits that rose like an - // odometer. The element's own text is always the plain value (it sets - // the width, and it is what a screen reader and a test read); the roll - // is an aria-hidden overlay of digit columns appended over it for `ms` - // (STAGE_TRACKER_ODOMETER_MS unless given), during which the plain - // text is transparent (.ham-odo-rolling). The value last written is - // kept on data-odo-value so a redraw mid-roll compares against it, not - // the overlay's digits. Instant (no overlay) on the first write, under - // reduced motion, and when stageTrackerOdometerPlan says nothing rolls. - // Returns whether a roll started. + // Pure: the columns that draw `text` at rest — every digit its own + // { steps: [d] } wheel, every non-digit run a { text } plate — the + // shape stageTrackerOdometerPlan returns when something rolls, so one + // renderer draws both states. + function stageTrackerOdometerRest(text) { + const cols = []; + for (const run of (String(text == null ? '' : text).match(/\d+|\D+/g) || [])) { + if (/^\d+$/.test(run)) for (const d of run) cols.push({ steps: [d] }); + else cols.push({ text: run }); + } + return cols; + } + // Stateful: write `text` into el as an odometer. The element always + // holds one aria-hidden .ham-odo drum of columns: a .ham-odo-col wheel + // per digit (a .ham-odo-strip of .ham-odo-d cells; one cell at rest) + // and a .ham-odo-static plate per run of other characters, so the + // Merged counter looks like a mileage counter at rest, not only + // mid-roll (hivecommons/hive#15398 follow-up: the previous overlay + // existed for 900 ms and the resting value was plain text). The value + // is on data-odo-value (what a redraw mid-roll compares against, and + // what the node tests read) and aria-label (what a screen reader + // reads; the drum's cells are hidden from it). A rise (per + // stageTrackerOdometerPlan) gives each wheel that changes the digits it + // passes and the class ham-odo-roll; the strip slides for `ms` + // (STAGE_TRACKER_ODOMETER_MS unless given), then settles to its final + // cell. Instant (drawn at rest) on the first write, under reduced + // motion, and when the plan says nothing rolls. Returns whether a roll + // started. function stageTrackerOdometerSet(el, text, ms) { if (!el) return false; text = String(text); @@ -461,19 +487,42 @@ const prev = el.getAttribute('data-odo-value'); if (prev === text) return false; el.setAttribute('data-odo-value', text); + el.setAttribute('role', 'img'); + el.setAttribute('aria-label', text); if (el._odoTimer) { clearTimeout(el._odoTimer); el._odoTimer = 0; } - if (el._odoWrap) { el._odoWrap.remove(); el._odoWrap = null; } - el.textContent = text; - el.classList.remove('ham-odo-rolling'); const plan = prev == null || stageTrackerReducedMotion() ? null : stageTrackerOdometerPlan(prev, text); + const wrap = stageTrackerOdometerDraw(el, plan || stageTrackerOdometerRest(text)); + wrap.style.setProperty('--odo-ms', ms + 'ms'); + el.classList.remove('ham-odo-rolling'); if (!plan) return false; - const wrap = document.createElement('span'); - wrap.className = 'ham-odo'; - wrap.setAttribute('aria-hidden', 'true'); - for (const c of plan) { + el.classList.add('ham-odo-rolling'); + void el.offsetWidth; + wrap.classList.add('ham-odo-run'); + el._odoTimer = setTimeout(() => { + el._odoTimer = 0; + el.classList.remove('ham-odo-rolling'); + stageTrackerOdometerDraw(el, stageTrackerOdometerRest(el.getAttribute('data-odo-value'))); + }, ms + 80); + return true; + } + // Stateful: (re)draw el's drum from columns; returns the .ham-odo wrap. + function stageTrackerOdometerDraw(el, cols) { + let wrap = el._odoWrap; + if (!wrap || wrap.parentNode !== el) { + // The markup's placeholder text ("0") goes; the drum is the content. + el.textContent = ''; + wrap = document.createElement('span'); + wrap.className = 'ham-odo'; + wrap.setAttribute('aria-hidden', 'true'); + el.appendChild(wrap); + el._odoWrap = wrap; + } + wrap.classList.remove('ham-odo-run'); + while (wrap.children.length) wrap.children[0].remove(); + for (const c of cols) { const col = document.createElement('span'); if (!c.steps) { col.className = 'ham-odo-static'; col.textContent = c.text; wrap.appendChild(col); continue; } - col.className = 'ham-odo-col'; + col.className = c.steps.length > 1 ? 'ham-odo-col ham-odo-roll' : 'ham-odo-col'; const strip = document.createElement('span'); strip.className = 'ham-odo-strip'; for (const d of c.steps) { const cell = document.createElement('span'); cell.className = 'ham-odo-d'; cell.textContent = d; strip.appendChild(cell); } @@ -481,14 +530,7 @@ col.appendChild(strip); wrap.appendChild(col); } - wrap.style.setProperty('--odo-ms', ms + 'ms'); - el.appendChild(wrap); - el._odoWrap = wrap; - el.classList.add('ham-odo-rolling'); - void el.offsetWidth; - wrap.classList.add('ham-odo-run'); - el._odoTimer = setTimeout(() => { el._odoTimer = 0; el._odoWrap = null; el.classList.remove('ham-odo-rolling'); wrap.remove(); }, ms + 80); - return true; + return wrap; } // Stateful: seed an element that has not been written yet with the // value it showed last time (so the first real write rolls up from @@ -498,7 +540,9 @@ if (!el || last == null || el.getAttribute('data-odo-value') != null) return false; if (!stageTrackerOdometerPlan(String(last), String(next))) return false; el.setAttribute('data-odo-value', String(last)); - el.textContent = String(last); + el.setAttribute('role', 'img'); + el.setAttribute('aria-label', String(last)); + stageTrackerOdometerDraw(el, stageTrackerOdometerRest(String(last))); return true; } // Pure: the chip's remembered values ({ n, sub }) from a sessionStorage diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 0aa2513327..37c0b806e6 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1328,8 +1328,10 @@ Review, 085/090 on Merge gate) light the chevron they branch from in their own words, so every strip is the same width. An issue parked on a person (045) lights Actionable with the decision word. */ - /* The sticky chip bar's height (the header strip sticks beneath it). */ - #activity-monitor-section { --ham-sticky-bar-h: 34px; } + /* The sticky chip bar's height (the header strip sticks beneath it): + the Merged pill (--ham-merged-bee + 2 × --sp-1 tall) plus the bar's + own vertical padding. */ + #activity-monitor-section { --ham-sticky-bar-h: 42px; } /* Layers for the merge flight glyph and the merged-toast stack. Both are appended to document.body, not to #activity-monitor-section, so these must be :root-scoped — scoped to the section they resolved to nothing, the @@ -1774,24 +1776,48 @@ .cue-flight.cue-flight-fade { animation: cue-flight-fade var(--cue-fly-ms, 2000ms) ease-out both; } .ham-sticky { position: sticky; top: var(--navbar-sticky-height); z-index: calc(var(--z-sticky) + 1); display: flex; justify-content: flex-end; align-items: center; min-height: var(--ham-sticky-bar-h); box-sizing: border-box; padding: var(--sp-1) var(--sp-2); background: var(--panel); } .ham-sticky-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } - .ham-merged-count { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text); cursor: pointer; } + /* The Merged pill (hivecommons/hive issue 15398 follow-up — "where is my + odometer look and feel?"): PR 15409 only enlarged the *flying* bee + (.cue-flight) and the roll was a 900 ms overlay over plain text, so + at rest the pill was a 12 px hexagon and a bold number. Now the + hexagon-bee is --ham-merged-bee (28 px) and the pill grows to fit it, + and the all-time count is a drum of wheels at rest, always: each + digit in its own dark inset cell (.ham-merged-n .ham-odo-col) with + a roller gradient, a top/bottom inner shadow and a hairline between + cells, monospace tabular digits at --ham-odo-digit (≥ 18 px). The + day/week line keeps its size and rolls with the same columns, drawn + plain. A wheel that changes (.ham-odo-roll) slides its strip through + the digits it passes (--odo-shift) over --odo-ms; reduced motion + swaps instantly (no transition; the strip is drawn at its end). */ + :root { --ham-merged-bee: 28px; --ham-odo-digit: 18px; } + .ham-merged-count { position: relative; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: calc(var(--ham-merged-bee) + 2 * var(--sp-1)); color: var(--text); cursor: pointer; } .ham-merged-count:hover { border-color: var(--line-strong); } - .ham-merged-count .ham-merged-ico { width: 12px; height: 12px; color: var(--amber); } - .ham-merged-count .ham-merged-n { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); font-size: var(--fs-sm); } + .ham-merged-count .ham-merged-ico { flex: 0 0 auto; width: var(--ham-merged-bee); height: var(--ham-merged-bee); color: var(--amber); filter: drop-shadow(0 1px 1px color-mix(in srgb, var(--surface-0) 50%, transparent)); } + .ham-merged-count .ham-merged-n { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); font-size: var(--ham-odo-digit); font-family: var(--font-mono); } .ham-merged-count .ham-merged-sub { color: var(--text-faint, var(--muted)); font-variant-numeric: tabular-nums; padding-left: var(--sp-2); border-left: var(--line-width) solid var(--line-subtle); } .ham-merged-count.cue-tick { animation: cue-count-pop 320ms ease-out; } - .ham-merged-count .ham-merged-n, .ham-merged-count .ham-merged-sub { position: relative; } - .ham-merged-count .ham-odo-rolling { color: transparent; } - .ham-odo { position: absolute; inset: 0; display: flex; align-items: center; overflow: hidden; white-space: pre; pointer-events: none; } - .ham-merged-count .ham-merged-n .ham-odo { color: var(--text); } - /* The dark theme's token sheet has no --text-faint (only body.light-mode - sets it), so without a fallback the overlay inherited the rolling - line's transparent colour and the day/week counts vanished mid-roll. */ - .ham-merged-count .ham-merged-sub .ham-odo { left: var(--sp-2); color: var(--text-faint, var(--muted)); } + .ham-merged-count .ham-merged-n, .ham-merged-count .ham-merged-sub { position: relative; display: inline-flex; align-items: center; } + /* The drum: one wrap of columns per counter, laid out inline (it is the + element's only content, so it sets the width). */ + .ham-odo { display: inline-flex; align-items: stretch; white-space: pre; pointer-events: none; } .ham-odo-static, .ham-odo-col, .ham-odo-d { display: block; height: 1.25em; line-height: 1.25; } + .ham-odo-static { align-self: center; } .ham-odo-col { overflow: hidden; } - .ham-odo-strip { display: block; transform: translateY(0); transition: transform var(--odo-ms, 900ms) cubic-bezier(0.22, 0.61, 0.36, 1); } - .ham-odo-run .ham-odo-strip { transform: translateY(var(--odo-shift, 0%)); } + .ham-odo-d { text-align: center; } + .ham-odo-strip { display: block; transform: translateY(var(--odo-shift, 0%)); } + .ham-odo-run .ham-odo-roll .ham-odo-strip { transition: transform var(--odo-ms, 900ms) cubic-bezier(0.22, 0.61, 0.36, 1); } + .ham-odo:not(.ham-odo-run) .ham-odo-roll .ham-odo-strip { transform: translateY(0); } + /* The all-time count's wheels are drum cells: dark inset, a subtle + roller gradient (lighter band through the middle, darker at the lip + and the foot), an inner shadow at top and bottom, a hairline between + digits, the outer corners rounded. Light mode keeps the inset but on + a paler drum. */ + .ham-merged-count .ham-merged-n .ham-odo { gap: 0; border-radius: var(--r-sm); overflow: hidden; border: var(--line-width) solid color-mix(in srgb, var(--surface-0) 70%, var(--line-strong)); box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 10%, transparent); } + .ham-merged-count .ham-merged-n .ham-odo-col { position: relative; min-width: 0.78em; height: 1.35em; line-height: 1.35; padding: 0; color: var(--text); background: linear-gradient(to bottom, color-mix(in srgb, var(--surface-0) 92%, black) 0%, var(--surface-3) 42%, var(--surface-3) 58%, color-mix(in srgb, var(--surface-0) 92%, black) 100%); box-shadow: inset 0 5px 5px -4px color-mix(in srgb, black 75%, transparent), inset 0 -5px 5px -4px color-mix(in srgb, black 75%, transparent); } + .ham-merged-count .ham-merged-n .ham-odo-col + .ham-odo-col { border-left: var(--line-width) solid color-mix(in srgb, var(--surface-0) 80%, black); } + .ham-merged-count .ham-merged-n .ham-odo-col .ham-odo-d { height: 1.35em; line-height: 1.35; } + body.light-mode .ham-merged-count .ham-merged-n .ham-odo-col { color: var(--text); background: linear-gradient(to bottom, color-mix(in srgb, var(--surface-3) 80%, black) 0%, var(--surface-0) 42%, var(--surface-0) 58%, color-mix(in srgb, var(--surface-3) 80%, black) 100%); box-shadow: inset 0 5px 5px -4px color-mix(in srgb, black 35%, transparent), inset 0 -5px 5px -4px color-mix(in srgb, black 35%, transparent); } + body.light-mode .ham-merged-count .ham-merged-n .ham-odo-col + .ham-odo-col { border-left-color: color-mix(in srgb, var(--surface-3) 60%, black); } .ham-merged-pop { position: absolute; right: var(--sp-2); top: calc(var(--full-size) - var(--sp-1)); min-width: 22rem; max-width: 34rem; max-height: 60vh; overflow: auto; padding: var(--sp-4) var(--sp-5); border: var(--line-width) solid var(--line); border-radius: var(--r-lg); background: var(--panel-strong); box-shadow: var(--shadow-raised); font-size: var(--fs-sm); color: var(--text); z-index: var(--z-cue-flight); } .ham-merged-pop-head { display: flex; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-3); font-weight: var(--fw-semibold); } .ham-merged-pop-head .ham-merged-pop-sum { color: var(--text-faint); font-weight: var(--fw-medium); } @@ -1825,7 +1851,7 @@ @keyframes cue-flight { 0% { opacity: 0; transform: translate(0, 0) scale(0.9); } 12% { opacity: 1; transform: translate(calc(var(--cue-dx, 0px) * 0.08), calc(var(--cue-dy, 0px) * 0.1)) scale(1.1); } 55% { opacity: 1; transform: translate(calc(var(--cue-dx, 0px) * 0.45 + 10px), calc(var(--cue-dy, 0px) * 0.62)) scale(1.05); } 100% { opacity: var(--cue-end-opacity, 0.25); transform: translate(var(--cue-dx, 0px), var(--cue-dy, 0px)) scale(0.7); } } @keyframes cue-flight-fade { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } } @keyframes cue-count-pop { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } } - @media (prefers-reduced-motion: reduce) { .cue-flight { animation-name: cue-flight-fade; } .ham-merged-count.cue-tick { animation: none; } .ham-odo-strip { transition: none; } .cue-merged .ham-seg.cap { animation-duration: 0.01ms; } .merge-banner, .merge-banner.merge-banner-out { animation: none; } } + @media (prefers-reduced-motion: reduce) { .cue-flight { animation-name: cue-flight-fade; } .ham-merged-count.cue-tick { animation: none; } .ham-odo-strip { transition: none !important; } .cue-merged .ham-seg.cap { animation-duration: 0.01ms; } .merge-banner, .merge-banner.merge-banner-out { animation: none; } } .ham-rm-preview .cue-flight { animation-name: cue-flight-fade; } @media (prefers-reduced-motion: reduce) { .cue-working .ham-seg.active .ham-active-ico, .cue-spin, .cue-acting .ham-seg.active, .cue-event { animation: none; } } @keyframes ham-breathe-human { 0%, 100% { opacity: 0; } 50% { opacity: 0.55; } } @@ -20593,7 +20619,13 @@

All labels

values last shown are kept in sessionStorage (STAGE_TRACKER_MERGED_LAST_KEY) so a reload rolls up from them. The glyph is drawn at --cue-flight-size (two type steps up) with a - theme-aware halo; STAGE_TRACKER_CELEBRATE_GLYPH_HALF centres it. */ + theme-aware halo; STAGE_TRACKER_CELEBRATE_GLYPH_HALF centres it. + Owner (2026-10-29, again): "where is my odometer look and feel?" — + that PR sized the flying bee, not the pill's, and the roll was an + overlay that existed for 900 ms over plain text. The counter is + now a drum at rest, always (stageTrackerOdometerRest / + stageTrackerOdometerDraw): a wheel per digit, the day/week line the + same columns drawn plain; the pill's bee is --ham-merged-bee. */ const STAGE_TRACKER_CELEBRATE_KEY = 'hive.tracker.celebrate'; const STAGE_TRACKER_MERGED_LAST_KEY = 'hive.tracker.merged.last'; const STAGE_TRACKER_CELEBRATE_GLYPH_KEY = 'hive.tracker.celebrate_glyph'; @@ -20765,9 +20797,11 @@

All labels

// Pure: the odometer columns for a change of text from `from` to `to`, // or null when nothing should roll — the texts split into different // static runs ("201 today · 730 this week" keeps its words), no number - // rose, or every rise is a fall elsewhere. A column is { text } (sits - // still: static runs, unchanged digits, numbers that fell or held) or - // { steps: ['9', '0'] } — the digits the column passes, old to new. In + // rose, or every rise is a fall elsewhere. A column is { text } (a + // static run of non-digits), a wheel that sits still — { steps: ['4'] }, + // an unchanged digit or one of a number that fell or held, drawn as a + // drum cell like the rest — or a wheel that rolls, { steps: ['9', '0'] + // } — the digits the column passes, old to new. In // a number that rose, the first changed wheel rolls just the digits // between old and new (wrapping past 9 the way a carry does); every // wheel to its right — and the rightmost wheel always — spins through @@ -20785,7 +20819,7 @@

All labels

const num = /^\d+$/.test(b[i]); if (num !== /^\d+$/.test(a[i])) return null; if (!num) { if (a[i] !== b[i]) return null; cols.push({ text: b[i] }); continue; } - if (Number(b[i]) <= Number(a[i]) || a[i].length > b[i].length) { cols.push({ text: b[i] }); continue; } + if (Number(b[i]) <= Number(a[i]) || a[i].length > b[i].length) { for (const d of b[i]) cols.push({ steps: [d] }); continue; } rose = true; const old = a[i].padStart(b[i].length, ' '); const last = b[i].length - 1; @@ -20794,7 +20828,7 @@

All labels

for (let j = 0; j <= last; j++) { const o = old[j], nw = b[i][j]; const spin = j > first || j === last; - if (o === nw && !spin) { cols.push({ text: nw }); continue; } + if (o === nw && !spin) { cols.push({ steps: [nw] }); continue; } const steps = [o]; if (o === ' ') steps.push(nw); else { let d = Number(o); do { d = (d + 1) % 10; steps.push(String(d)); } while (d !== Number(nw) || (spin && steps.length <= STAGE_TRACKER_ODOMETER_TURN)); } @@ -20803,16 +20837,34 @@

All labels

} return rose ? cols : null; } - // Stateful: write `text` into el, rolling the digits that rose like an - // odometer. The element's own text is always the plain value (it sets - // the width, and it is what a screen reader and a test read); the roll - // is an aria-hidden overlay of digit columns appended over it for `ms` - // (STAGE_TRACKER_ODOMETER_MS unless given), during which the plain - // text is transparent (.ham-odo-rolling). The value last written is - // kept on data-odo-value so a redraw mid-roll compares against it, not - // the overlay's digits. Instant (no overlay) on the first write, under - // reduced motion, and when stageTrackerOdometerPlan says nothing rolls. - // Returns whether a roll started. + // Pure: the columns that draw `text` at rest — every digit its own + // { steps: [d] } wheel, every non-digit run a { text } plate — the + // shape stageTrackerOdometerPlan returns when something rolls, so one + // renderer draws both states. + function stageTrackerOdometerRest(text) { + const cols = []; + for (const run of (String(text == null ? '' : text).match(/\d+|\D+/g) || [])) { + if (/^\d+$/.test(run)) for (const d of run) cols.push({ steps: [d] }); + else cols.push({ text: run }); + } + return cols; + } + // Stateful: write `text` into el as an odometer. The element always + // holds one aria-hidden .ham-odo drum of columns: a .ham-odo-col wheel + // per digit (a .ham-odo-strip of .ham-odo-d cells; one cell at rest) + // and a .ham-odo-static plate per run of other characters, so the + // Merged counter looks like a mileage counter at rest, not only + // mid-roll (hivecommons/hive#15398 follow-up: the previous overlay + // existed for 900 ms and the resting value was plain text). The value + // is on data-odo-value (what a redraw mid-roll compares against, and + // what the node tests read) and aria-label (what a screen reader + // reads; the drum's cells are hidden from it). A rise (per + // stageTrackerOdometerPlan) gives each wheel that changes the digits it + // passes and the class ham-odo-roll; the strip slides for `ms` + // (STAGE_TRACKER_ODOMETER_MS unless given), then settles to its final + // cell. Instant (drawn at rest) on the first write, under reduced + // motion, and when the plan says nothing rolls. Returns whether a roll + // started. function stageTrackerOdometerSet(el, text, ms) { if (!el) return false; text = String(text); @@ -20820,19 +20872,42 @@

All labels

const prev = el.getAttribute('data-odo-value'); if (prev === text) return false; el.setAttribute('data-odo-value', text); + el.setAttribute('role', 'img'); + el.setAttribute('aria-label', text); if (el._odoTimer) { clearTimeout(el._odoTimer); el._odoTimer = 0; } - if (el._odoWrap) { el._odoWrap.remove(); el._odoWrap = null; } - el.textContent = text; - el.classList.remove('ham-odo-rolling'); const plan = prev == null || stageTrackerReducedMotion() ? null : stageTrackerOdometerPlan(prev, text); + const wrap = stageTrackerOdometerDraw(el, plan || stageTrackerOdometerRest(text)); + wrap.style.setProperty('--odo-ms', ms + 'ms'); + el.classList.remove('ham-odo-rolling'); if (!plan) return false; - const wrap = document.createElement('span'); - wrap.className = 'ham-odo'; - wrap.setAttribute('aria-hidden', 'true'); - for (const c of plan) { + el.classList.add('ham-odo-rolling'); + void el.offsetWidth; + wrap.classList.add('ham-odo-run'); + el._odoTimer = setTimeout(() => { + el._odoTimer = 0; + el.classList.remove('ham-odo-rolling'); + stageTrackerOdometerDraw(el, stageTrackerOdometerRest(el.getAttribute('data-odo-value'))); + }, ms + 80); + return true; + } + // Stateful: (re)draw el's drum from columns; returns the .ham-odo wrap. + function stageTrackerOdometerDraw(el, cols) { + let wrap = el._odoWrap; + if (!wrap || wrap.parentNode !== el) { + // The markup's placeholder text ("0") goes; the drum is the content. + el.textContent = ''; + wrap = document.createElement('span'); + wrap.className = 'ham-odo'; + wrap.setAttribute('aria-hidden', 'true'); + el.appendChild(wrap); + el._odoWrap = wrap; + } + wrap.classList.remove('ham-odo-run'); + while (wrap.children.length) wrap.children[0].remove(); + for (const c of cols) { const col = document.createElement('span'); if (!c.steps) { col.className = 'ham-odo-static'; col.textContent = c.text; wrap.appendChild(col); continue; } - col.className = 'ham-odo-col'; + col.className = c.steps.length > 1 ? 'ham-odo-col ham-odo-roll' : 'ham-odo-col'; const strip = document.createElement('span'); strip.className = 'ham-odo-strip'; for (const d of c.steps) { const cell = document.createElement('span'); cell.className = 'ham-odo-d'; cell.textContent = d; strip.appendChild(cell); } @@ -20840,14 +20915,7 @@

All labels

col.appendChild(strip); wrap.appendChild(col); } - wrap.style.setProperty('--odo-ms', ms + 'ms'); - el.appendChild(wrap); - el._odoWrap = wrap; - el.classList.add('ham-odo-rolling'); - void el.offsetWidth; - wrap.classList.add('ham-odo-run'); - el._odoTimer = setTimeout(() => { el._odoTimer = 0; el._odoWrap = null; el.classList.remove('ham-odo-rolling'); wrap.remove(); }, ms + 80); - return true; + return wrap; } // Stateful: seed an element that has not been written yet with the // value it showed last time (so the first real write rolls up from @@ -20857,7 +20925,9 @@

All labels

if (!el || last == null || el.getAttribute('data-odo-value') != null) return false; if (!stageTrackerOdometerPlan(String(last), String(next))) return false; el.setAttribute('data-odo-value', String(last)); - el.textContent = String(last); + el.setAttribute('role', 'img'); + el.setAttribute('aria-label', String(last)); + stageTrackerOdometerDraw(el, stageTrackerOdometerRest(String(last))); return true; } // Pure: the chip's remembered values ({ n, sub }) from a sessionStorage