From 5d9b99e312c649c7634c2c0faccf9722195acdfc Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Fri, 30 Oct 2026 15:58:24 -0400 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=90=9B=20dashboard:=20merge=20banners?= =?UTF-8?q?=20drain=20the=20toast=20countdown=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Activity Monitor "#N merged" banners auto-dismissed through a bare setTimeout and never showed the .toast-bar that every other timed toast gets from toastCountdownBar. Route the dismiss through toastCountdownBar with stageTrackerMergeBannerMs() so the bar drains along the bottom edge for the banner lifetime, hover/focus holds timer and bar together, and the manual x dismiss cancels the countdown. .merge-banner becomes position: relative / overflow: hidden so the bar clips to it, tinted green to match the merge accent. Node test lifts the banner builder and toastCountdownBar out of the shipped index.html and proves the bar element, --toast-ttl, hover hold and manual-dismiss cancellation. Closes #15878 Signed-off-by: Andrew Anderson --- .../fixed-merge-banner-countdown-bar.md | 1 + ...age_tracker_merge_banner_countdown.test.js | 129 ++++++++++++++++++ src/pkg/dashboard/static-src/css/tracker.css | 3 +- .../dashboard/static-src/js/tracker-merged.js | 9 +- src/pkg/dashboard/static/index.html | 12 +- 5 files changed, 146 insertions(+), 8 deletions(-) create mode 100644 changelog.d/fixed-merge-banner-countdown-bar.md create mode 100644 src/pkg/dashboard/stage_tracker_merge_banner_countdown.test.js diff --git a/changelog.d/fixed-merge-banner-countdown-bar.md b/changelog.d/fixed-merge-banner-countdown-bar.md new file mode 100644 index 0000000000..e0ca142547 --- /dev/null +++ b/changelog.d/fixed-merge-banner-countdown-bar.md @@ -0,0 +1 @@ +Activity Monitor "#N merged" banners now arm their auto-dismiss through `toastCountdownBar`, so they drain the same countdown bar every other timed toast shows, pause on hover/focus, and the × button clears the pending timer (#15878). diff --git a/src/pkg/dashboard/stage_tracker_merge_banner_countdown.test.js b/src/pkg/dashboard/stage_tracker_merge_banner_countdown.test.js new file mode 100644 index 0000000000..6ae96f5a36 --- /dev/null +++ b/src/pkg/dashboard/stage_tracker_merge_banner_countdown.test.js @@ -0,0 +1,129 @@ +// Activity Monitor "#N merged" banners: the auto-dismiss goes through +// toastCountdownBar, so the banner drains the same .toast-bar every other +// timed toast shows (CSS keys on .toast-bar + --toast-ttl), hover holds it, +// and the manual × dismiss clears the pending timer. The functions are +// lifted straight out of index.html so this runs against the shipped source. +const test = require('node:test'); +const assert = require('node:assert'); +const fs = require('node:fs'); +const path = require('node:path'); + +const html = fs.readFileSync(path.join(__dirname, 'static', 'index.html'), 'utf8'); + +function pick(re, what) { + const m = html.match(re); + assert.ok(m, what + ' not found in index.html'); + return m[0]; +} + +// A minimal DOM: enough for toastCountdownBar and the banner builder. +function makeDom() { + const timers = []; + class El { + constructor(tag) { + this.tagName = tag; this.children = []; this.parentNode = null; this.attrs = {}; this.listeners = {}; + this.style = { props: {}, setProperty(k, v) { this.props[k] = v; } }; + this.className = ''; this.innerHTML = ''; this.id = ''; + } + get classList() { const self = this; return { add(c) { self.className += ' ' + c; }, remove() {}, contains(c) { return self.className.split(' ').includes(c); } }; } + appendChild(c) { if (c.parentNode) c.parentNode.removeChild(c); c.parentNode = this; this.children.push(c); return c; } + removeChild(c) { this.children = this.children.filter(x => x !== c); c.parentNode = null; } + remove() { if (this.parentNode) this.parentNode.removeChild(this); } + setAttribute(k, v) { this.attrs[k] = String(v); } + getAttribute(k) { return this.attrs[k] === undefined ? null : this.attrs[k]; } + addEventListener(n, fn) { (this.listeners[n] = this.listeners[n] || []).push(fn); } + fire(n, e) { for (const fn of this.listeners[n] || []) fn(e || {}); } + matches() { return false; } + contains(x) { return x === this || this.children.some(c => c.contains(x)); } + querySelector() { return null; } + closest(sel) { for (let n = this; n; n = n.parentNode) if (sel === '.merge-banner' && n.className && n.className.split(' ').includes('merge-banner')) return n; return null; } + } + const body = new El('body'); + const byId = {}; + const document = { + body, activeElement: null, + createElement: t => new El(t), + getElementById: id => byId[id] || null, + }; + const origAppend = body.appendChild.bind(body); + body.appendChild = c => { if (c.id) byId[c.id] = c; return origAppend(c); }; + const setTimeout = (fn, ms) => { const t = { fn, ms, cleared: false }; timers.push(t); return t; }; + const clearTimeout = t => { if (t) t.cleared = true; }; + return { document, timers, setTimeout, clearTimeout, El }; +} + +const BANNER_MS = 30000; +const src = [ + 'const window = {};', + 'function esc(s) { return typeof s === "string" ? s.replace(/&/g, "&").replace(//g, ">").replace(/"/g, """) : ""; }', + 'const _stageTrackerMerged = { server: { recent: [] } };', + 'const _stageTrackerPRTitle = {};', + 'function stageTrackerMergedIdent(repo, n) { return repo + "#" + n; }', + 'function stageTrackerMergedByText() { return ""; }', + 'function stageTrackerReducedMotion() { return true; }', + 'function stageTrackerAfter(el, ev, ms, fn) { fn(); }', + `function stageTrackerMergeBannerMs() { return ${BANNER_MS}; }`, + pick(/const STAGE_TRACKER_MERGE_BANNER_MAX = [^\n]*\n/, 'STAGE_TRACKER_MERGE_BANNER_MAX'), + pick(/function toastCountdownBar\(el, ms, onExpire\) \{[\s\S]*?\n \}\n/, 'toastCountdownBar'), + pick(/function toastCountdownCancel\(el\) \{[\s\S]*?\n \}\n/, 'toastCountdownCancel'), + pick(/function stageTrackerMergeBannerNumber\(b\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerNumber'), + pick(/function stageTrackerMergeBannerText\(b, nowMs\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerText'), + pick(/function stageTrackerMergeBanner\(b\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBanner'), + pick(/function stageTrackerMergeBannerDismiss\(el\) \{[\s\S]*?\n \}\n/, 'stageTrackerMergeBannerDismiss'), + pick(/function hamBannerDismiss\(btn\) \{[\s\S]*?\n \}\n/, 'hamBannerDismiss'), +].join('\n'); + +function load() { + const dom = makeDom(); + const api = new Function('document', 'setTimeout', 'clearTimeout', src + '; return { banner: stageTrackerMergeBanner, dismiss: stageTrackerMergeBannerDismiss, hamBannerDismiss };')(dom.document, dom.setTimeout, dom.clearTimeout); + return Object.assign(dom, api); +} + +const merge = { key: 'hivecommons/hive/pr#15834', repo: 'hivecommons/hive', number: 15834, title: 'fix the thing', at: Date.now() }; + +test('merge banner carries the countdown bar and --toast-ttl the CSS drains over', () => { + const d = load(); + const el = d.banner(merge); + const bar = el.children.find(c => c.className === 'toast-bar'); + assert.ok(bar, 'a .toast-bar child is appended to the banner'); + assert.strictEqual(bar.getAttribute('aria-hidden'), 'true'); + assert.strictEqual(el.style.props['--toast-ttl'], BANNER_MS + 'ms', 'bar duration equals the banner duration'); + assert.ok(el._countdown, 'countdown state is armed'); + assert.strictEqual(d.timers.length, 1); + assert.strictEqual(d.timers[0].ms, BANNER_MS, 'dismiss timer uses stageTrackerMergeBannerMs()'); + assert.strictEqual(el._timer, undefined, 'no bare setTimeout handle remains'); +}); + +test('timer expiry removes the banner', () => { + const d = load(); + const el = d.banner(merge); + assert.ok(el.parentNode); + d.timers[0].fn(); + assert.strictEqual(el.parentNode, null, 'banner left the stack when the countdown fired'); +}); + +test('hover holds the countdown and the bar together; leaving re-arms the remainder', () => { + const d = load(); + const el = d.banner(merge); + const bar = el.children.find(c => c.className === 'toast-bar'); + assert.strictEqual(d.timers.length, 1); + el.fire('mouseenter'); + assert.ok(d.timers[0].cleared, 'timer cleared on hover'); + assert.strictEqual(bar.style.animationPlayState, 'paused'); + el.fire('mouseleave'); + assert.strictEqual(d.timers.length, 2, 'a fresh timer is armed on leave'); + assert.ok(d.timers[1].ms <= BANNER_MS && d.timers[1].ms > 0, 'remainder re-armed'); + assert.strictEqual(bar.style.animationPlayState, 'running'); +}); + +test('manual × dismiss clears the pending timer and the bar', () => { + const d = load(); + const el = d.banner(merge); + const close = new d.El('button'); + el.appendChild(close); + d.hamBannerDismiss(close); + assert.strictEqual(el.parentNode, null, 'banner removed'); + assert.ok(d.timers[0].cleared, 'auto-dismiss timer cleared so it cannot fire stale'); + assert.strictEqual(el._countdown, null); + assert.ok(!el.children.some(c => c.className === 'toast-bar'), 'bar removed with the countdown'); +}); diff --git a/src/pkg/dashboard/static-src/css/tracker.css b/src/pkg/dashboard/static-src/css/tracker.css index bdcf204c50..cdf28842e7 100644 --- a/src/pkg/dashboard/static-src/css/tracker.css +++ b/src/pkg/dashboard/static-src/css/tracker.css @@ -571,7 +571,8 @@ (just the ⟳ and the actor glyph). */ .ham-seg.active .ham-seg-t.ham-queue-stalled { color: inherit; } .merge-banners { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: var(--z-merge-banner); display: flex; flex-direction: column; gap: var(--sp-3); max-width: min(26rem, calc(100vw - 2 * var(--sp-6))); pointer-events: none; } - .merge-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-4); align-items: start; padding: var(--sp-4) var(--sp-5); border: var(--line-width) solid var(--line); border-left: 3px solid var(--green); border-radius: var(--r); background: var(--panel-strong); color: var(--text); box-shadow: var(--shadow-raised); font-size: var(--fs-sm); pointer-events: auto; animation: merge-banner-in 220ms ease-out both; } + .merge-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-4); align-items: start; padding: var(--sp-4) var(--sp-5); border: var(--line-width) solid var(--line); border-left: 3px solid var(--green); border-radius: var(--r); background: var(--panel-strong); color: var(--text); box-shadow: var(--shadow-raised); font-size: var(--fs-sm); pointer-events: auto; position: relative; overflow: hidden; animation: merge-banner-in 220ms ease-out both; } + .merge-banner .toast-bar { background: color-mix(in srgb, var(--green) 40%, transparent); } .merge-banner.merge-banner-out { animation: merge-banner-out 180ms ease-in both; } .merge-banner-ico { color: var(--green); font-weight: var(--fw-bold); } .merge-banner-head { font-weight: var(--fw-semibold); } diff --git a/src/pkg/dashboard/static-src/js/tracker-merged.js b/src/pkg/dashboard/static-src/js/tracker-merged.js index d100c047b4..47d6744662 100644 --- a/src/pkg/dashboard/static-src/js/tracker-merged.js +++ b/src/pkg/dashboard/static-src/js/tracker-merged.js @@ -925,7 +925,10 @@ // Stateful: a persistent banner, bottom right, for one merge — stays // until dismissed or stageTrackerMergeBannerMs() (twice the info toast // duration, STAGE_TRACKER_MERGE_BANNER_MS at the default), stacked when - // several, with a "show row" link while the row is on the board. + // several, with a "show row" link while the row is on the board. The + // auto-dismiss goes through toastCountdownBar like every other timed + // toast, so the banner drains a .toast-bar along its bottom edge and + // hover / focus inside it holds both timer and bar together. function stageTrackerMergeBanner(b) { if (!document.body) return null; let box = document.getElementById('merge-banners'); @@ -943,12 +946,12 @@ el.innerHTML = `
${num ? `#${esc(num)} ` : ''}merged${info.preview ? ' (test)' : ''}
${esc(t.text)}
`; box.appendChild(el); while (box.children.length > STAGE_TRACKER_MERGE_BANNER_MAX) box.children[0].remove(); - el._timer = setTimeout(() => stageTrackerMergeBannerDismiss(el), stageTrackerMergeBannerMs()); + toastCountdownBar(el, stageTrackerMergeBannerMs(), () => stageTrackerMergeBannerDismiss(el)); return el; } function stageTrackerMergeBannerDismiss(el) { if (!el || !el.parentNode) return; - if (el._timer) { clearTimeout(el._timer); el._timer = 0; } + toastCountdownCancel(el); if (stageTrackerReducedMotion()) { el.remove(); return; } el.classList.add('merge-banner-out'); stageTrackerAfter(el, 'animationend', 180, () => el.remove()); diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 4791999463..e6570e6fd8 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -1908,7 +1908,8 @@ (just the ⟳ and the actor glyph). */ .ham-seg.active .ham-seg-t.ham-queue-stalled { color: inherit; } .merge-banners { position: fixed; right: var(--sp-6); bottom: var(--sp-6); z-index: var(--z-merge-banner); display: flex; flex-direction: column; gap: var(--sp-3); max-width: min(26rem, calc(100vw - 2 * var(--sp-6))); pointer-events: none; } - .merge-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-4); align-items: start; padding: var(--sp-4) var(--sp-5); border: var(--line-width) solid var(--line); border-left: 3px solid var(--green); border-radius: var(--r); background: var(--panel-strong); color: var(--text); box-shadow: var(--shadow-raised); font-size: var(--fs-sm); pointer-events: auto; animation: merge-banner-in 220ms ease-out both; } + .merge-banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--sp-4); align-items: start; padding: var(--sp-4) var(--sp-5); border: var(--line-width) solid var(--line); border-left: 3px solid var(--green); border-radius: var(--r); background: var(--panel-strong); color: var(--text); box-shadow: var(--shadow-raised); font-size: var(--fs-sm); pointer-events: auto; position: relative; overflow: hidden; animation: merge-banner-in 220ms ease-out both; } + .merge-banner .toast-bar { background: color-mix(in srgb, var(--green) 40%, transparent); } .merge-banner.merge-banner-out { animation: merge-banner-out 180ms ease-in both; } .merge-banner-ico { color: var(--green); font-weight: var(--fw-bold); } .merge-banner-head { font-weight: var(--fw-semibold); } @@ -22812,7 +22813,10 @@

All labels

// Stateful: a persistent banner, bottom right, for one merge — stays // until dismissed or stageTrackerMergeBannerMs() (twice the info toast // duration, STAGE_TRACKER_MERGE_BANNER_MS at the default), stacked when - // several, with a "show row" link while the row is on the board. + // several, with a "show row" link while the row is on the board. The + // auto-dismiss goes through toastCountdownBar like every other timed + // toast, so the banner drains a .toast-bar along its bottom edge and + // hover / focus inside it holds both timer and bar together. function stageTrackerMergeBanner(b) { if (!document.body) return null; let box = document.getElementById('merge-banners'); @@ -22830,12 +22834,12 @@

All labels

el.innerHTML = `
${num ? `#${esc(num)} ` : ''}merged${info.preview ? ' (test)' : ''}
${esc(t.text)}
`; box.appendChild(el); while (box.children.length > STAGE_TRACKER_MERGE_BANNER_MAX) box.children[0].remove(); - el._timer = setTimeout(() => stageTrackerMergeBannerDismiss(el), stageTrackerMergeBannerMs()); + toastCountdownBar(el, stageTrackerMergeBannerMs(), () => stageTrackerMergeBannerDismiss(el)); return el; } function stageTrackerMergeBannerDismiss(el) { if (!el || !el.parentNode) return; - if (el._timer) { clearTimeout(el._timer); el._timer = 0; } + toastCountdownCancel(el); if (stageTrackerReducedMotion()) { el.remove(); return; } el.classList.add('merge-banner-out'); stageTrackerAfter(el, 'animationend', 180, () => el.remove()); From 9e47b0e7e96ac68eb4ac5ef8bd2a42cd217b5037 Mon Sep 17 00:00:00 2001 From: clubanderson <407614+clubanderson@users.noreply.github.com> Date: Fri, 30 Oct 2026 20:02:05 +0000 Subject: [PATCH 2/3] changelog: fragment for #15880 Generated by changelog-fragment-guard from the PR title (#5675). Edit the wording freely, or replace this file with the no-changelog label if the change is not user-visible. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: clubanderson <407614+clubanderson@users.noreply.github.com> --- changelog.d/fixed-15880.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/fixed-15880.md diff --git a/changelog.d/fixed-15880.md b/changelog.d/fixed-15880.md new file mode 100644 index 0000000000..d5d832924a --- /dev/null +++ b/changelog.d/fixed-15880.md @@ -0,0 +1 @@ +- dashboard: merge banners drain the toast countdown bar (#15880) From 8112ed04f82da5eb00428d42b4609ee8ea44a79d Mon Sep 17 00:00:00 2001 From: Andrew Anderson Date: Fri, 30 Oct 2026 17:10:04 -0400 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=90=9B=20dashboard:=20stub=20toastCou?= =?UTF-8?q?ntdownBar=20in=20the=20merge-banner=20cue=20tests,=20drop=20dup?= =?UTF-8?q?licate=20fragment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The stage_tracker_cues node fixture lifts stageTrackerMergeBanner out of index.html; now that the banner arms its dismiss through toastCountdownBar the fixture pulls that function (and toastCountdownCancel) in too, with matches/contains/activeElement shims on the fake DOM. Keep the bot's bullet-formatted fixed-15880.md fragment and remove the malformed slug fragment. Signed-off-by: Andrew Anderson --- changelog.d/fixed-merge-banner-countdown-bar.md | 1 - src/pkg/dashboard/stage_tracker_cues_test.go | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 changelog.d/fixed-merge-banner-countdown-bar.md diff --git a/changelog.d/fixed-merge-banner-countdown-bar.md b/changelog.d/fixed-merge-banner-countdown-bar.md deleted file mode 100644 index e0ca142547..0000000000 --- a/changelog.d/fixed-merge-banner-countdown-bar.md +++ /dev/null @@ -1 +0,0 @@ -Activity Monitor "#N merged" banners now arm their auto-dismiss through `toastCountdownBar`, so they drain the same countdown bar every other timed toast shows, pause on hover/focus, and the × button clears the pending timer (#15878). diff --git a/src/pkg/dashboard/stage_tracker_cues_test.go b/src/pkg/dashboard/stage_tracker_cues_test.go index b1a1a37a4d..5d504617ca 100644 --- a/src/pkg/dashboard/stage_tracker_cues_test.go +++ b/src/pkg/dashboard/stage_tracker_cues_test.go @@ -359,6 +359,8 @@ func stageTrackerCelebrateJS(t *testing.T, html string) string { jsFunc(t, html, "celebrateDetached"), jsFunc(t, html, "stageTrackerMergeBannerNumber"), jsFunc(t, html, "stageTrackerMergeBannerText"), + jsFunc(t, html, "toastCountdownBar"), + jsFunc(t, html, "toastCountdownCancel"), jsFunc(t, html, "stageTrackerMergeBanner"), jsFunc(t, html, "stageTrackerMergeBannerDismiss"), jsFunc(t, html, "hamBannerDismiss"), @@ -417,6 +419,7 @@ function el(tag, attrs) { querySelector(sel) { return e.querySelectorAll(sel)[0] || null; }, querySelectorAll(sel) { const out = []; const unesc = v => v.replace(/\\(.)/g, '$1'); const m = sel.match(/^\[([\w-]+)="(.*)"\]$/); const word = sel.match(/^\[([\w-]+)~="(.*)"\]\[data-ham-key\]$/); const cls = sel.match(/^\.([\w-]+)/); const capOfRow = sel === '.ham-row[data-ham-key] .ham-seg.cap'; const walk = n => { for (const c of n.children) { if (capOfRow) { if (c.classList.contains('cap') && c.closest('.ham-row') && c.closest('.ham-row').classList.contains('ham-row')) out.push(c); } else if (m && c.attrs[m[1]] === unesc(m[2])) out.push(c); else if (word && c.attrs['data-ham-key'] != null && String(c.attrs[word[1]] || '').split(' ').includes(unesc(word[2]))) out.push(c); else if (!m && !word && cls && c.classList.contains(cls[1]) && (!sel.includes('[data-at]') || c.attrs['data-at'] != null)) out.push(c); walk(c); } }; walk(e); return out; }, closest(sel) { let n = e; while (n) { if (n.attrs && n.attrs['data-ham-key'] != null) return n; n = n.parentNode; } return null; }, + matches() { return false; }, contains(x) { return x === e || e.children.some(c => c.contains(x)); }, }; return e; } @@ -424,7 +427,7 @@ global.CSS = { escape: s => String(s).replace(/([^\w-])/g, '\\$1') }; const body = el('body'); const panel = el('div'); const chip = el('button', { id: 'activity-monitor-merged' }); const n = el('span'); n.classList.add('ham-merged-n'); n.textContent = '0'; chip.appendChild(n); const sub = el('span'); sub.classList.add('ham-merged-sub'); chip.appendChild(sub); chip.rect = { left: 500, top: 10, width: 60, height: 20 }; const pop = el('div', { id: 'activity-monitor-merged-pop' }); pop.hidden = true; const banners = el('div'); const live = el('span'); const byId = { 'activity-monitor-panel': panel, 'activity-monitor-merged': chip, 'activity-monitor-merged-pop': pop, 'merge-banners': banners, 'activity-monitor-merged-live': live }; -global.document = { body, hidden: false, getElementById(id) { return byId[id] || null; }, createElement(tag) { if (tag === 'template') { const tpl = el('template'); Object.defineProperty(tpl, 'innerHTML', { set(v) { const c = el('p'); c.classList.add('cue-event'); c.attrs['data-cue-key'] = (v.match(/data-cue-key="([^"]*)"/) || [])[1]; c.textContent = v.replace(/<[^>]+>/g, ''); const age = el('span'); age.classList.add('cue-event-age'); age.attrs['data-at'] = (v.match(/data-at="(\d+)"/) || [])[1]; c.appendChild(age); tpl.content = { firstElementChild: c }; } }); return tpl; } return el(tag); } }; +global.document = { body, hidden: false, activeElement: null, getElementById(id) { return byId[id] || null; }, createElement(tag) { if (tag === 'template') { const tpl = el('template'); Object.defineProperty(tpl, 'innerHTML', { set(v) { const c = el('p'); c.classList.add('cue-event'); c.attrs['data-cue-key'] = (v.match(/data-cue-key="([^"]*)"/) || [])[1]; c.textContent = v.replace(/<[^>]+>/g, ''); const age = el('span'); age.classList.add('cue-event-age'); age.attrs['data-at'] = (v.match(/data-at="(\d+)"/) || [])[1]; c.appendChild(age); tpl.content = { firstElementChild: c }; } }); return tpl; } return el(tag); } }; const store = {}; global.localStorage = { getItem: k => (k in store ? store[k] : null), setItem(k, v) { store[k] = String(v); } }; const session = {}; global.sessionStorage = { getItem: k => (k in session ? session[k] : null), setItem(k, v) { session[k] = String(v); } }; let reduced = false; function stageTrackerReducedMotion() { return reduced; }