@intentius/behold 0.29.30 → 0.29.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +5 -1
- package/package.json +1 -1
- package/web/app.js +261 -4
- package/web/index.html +42 -2
- package/web/kiosk-approval.js +1 -1
- package/web/kiosk-metrics.js +36 -7
- package/web/kiosk-metrics.test.js +52 -3
- package/web/kiosk-runs.js +12 -6
- package/web/kiosk-runs.test.js +11 -1
- package/web/kiosk-shot.js +103 -0
- package/web/kiosk-shot.test.js +79 -0
- package/web/kiosk-trace.js +12 -2
- package/web/kiosk-trace.test.js +7 -1
- package/web/kiosk-vendor.test.js +5 -3
- package/web/kiosk-watch.js +263 -0
- package/web/kiosk-watch.test.js +181 -0
- package/web/kiosk.html +227 -50
- package/web/kiosk.js +565 -71
- package/web/kiosk.test.js +31 -20
- package/web/operator.js +3 -0
- package/web/run-playhead.js +4 -0
- package/web/theme.js +49 -0
- package/web/theme.test.js +56 -1
package/web/kiosk.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { BEAT_CHANGES, INTRO_HEAD, READ_STORE, READ_TITLE, STEP_VIEW, STEP_WORDS, aboutRows, approvalPanel, approveGloss, chantProject, factsLine, focusRoots, holdHead, holdModel, introText, readStored, readingRows, renderReading, scenarioHead, frameSrc, factLines, kioskView, matchingPull, pendingApproval, renderKiosk, renderViewToggle, reportless, runPanel, runPin, stepView, viewZoom } from "./kiosk.js";
|
|
2
|
+
import { stepTone, BEAT_CHANGES, INTRO_HEAD, READ_STORE, READ_TITLE, STEP_VIEW, STEP_WORDS, aboutRows, approvalPanel, approveGloss, chantProject, factsLine, focusRoots, holdHead, holdModel, introText, readStored, readingRows, renderReading, scenarioHead, frameSrc, factLines, kioskView, matchingPull, pendingApproval, renderKiosk, renderViewToggle, reportless, runPanel, runPin, stepView, viewZoom } from "./kiosk.js";
|
|
3
3
|
import { VENDORS } from "./kiosk-vendor.js";
|
|
4
4
|
import { PICK_HOLD_MS } from "./kiosk-runs.js";
|
|
5
5
|
|
|
@@ -150,27 +150,29 @@ describe("the scenario's card under the title (behold#571)", () => {
|
|
|
150
150
|
const s = { demo: { source: "fx", read: "2026-10-15T03:00:00Z", demo: demo("failed", { scenario: "failure", about }) }, answer: null, progress: null };
|
|
151
151
|
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
152
152
|
const left = find(bar, "k-lead")[0];
|
|
153
|
-
// behold#571: the lead block
|
|
154
|
-
|
|
155
|
-
expect(left.children.map((c) => c.
|
|
156
|
-
|
|
157
|
-
expect(beat.children.map((c) => [c.className, c.textContent])).toEqual([["k-beat-label", BEAT_CHANGES], ["k-beat-text", about.changes]]);
|
|
158
|
-
// The step's progress sits with the step line: the strip's stops, the driver's next action.
|
|
159
|
-
expect(find(bar, "k-stop").map((c) => c.textContent)).toEqual(["pull request", "planned", "merged", "waves", "applied", "reset"]);
|
|
160
|
-
// The rest of the card, one quieter paragraph: each field after its label.
|
|
161
|
-
const card = find(bar, "k-about")[0];
|
|
162
|
-
expect(card.tagName).toBe("p");
|
|
163
|
-
expect(card.children.filter((c) => c.className).map((c) => [c.className, c.textContent])).toEqual([
|
|
164
|
-
["k-about-label", "Watch for"], ["k-about-text", about.watch],
|
|
165
|
-
["k-about-label", "Shows"], ["k-about-text", about.shows],
|
|
153
|
+
// behold#571: the lead block, a grid of labelled rows: the title (over it, the tool, the kicker and the
|
|
154
|
+
// progress), then what changes, the step, next, watch for, shows and the facts; each row a fixed box.
|
|
155
|
+
expect(left.children.map((c) => c.className)).toEqual([
|
|
156
|
+
"k-box k-box-title", "k-row k-row-beat", "k-row k-row-step k-step-failed", "k-row k-row-next", "k-row k-row-more", "k-row k-row-more", "k-row k-row-facts k-row-empty",
|
|
166
157
|
]);
|
|
158
|
+
expect(left.children.map((c) => c.children.map((x) => x.className.split(" ")[0]))).toEqual([["k-overline", "k-title"], ["k-row-label", "k-box"], ["k-row-label", "k-box"], ["k-row-label", "k-box"], ["k-row-label", "k-box"], ["k-row-label", "k-box"], []]);
|
|
159
|
+
// Each row: its label in the fixed column, its words in the box beside it.
|
|
160
|
+
const rowsOf = (cls) => find(bar, cls).map((r) => [r.children[0].textContent, r.children[1].children[0].className, r.children[1].children[0].textContent]);
|
|
161
|
+
expect(rowsOf("k-row-beat")).toEqual([[BEAT_CHANGES, "k-beat", about.changes]]);
|
|
162
|
+
expect(rowsOf("k-row-step")[0].slice(0, 2)).toEqual([STEP_WORDS.failed, "k-step"]);
|
|
163
|
+
expect(rowsOf("k-row-more")).toEqual([["Watch for", "k-about", about.watch], ["Shows", "k-about", about.shows]]);
|
|
164
|
+
expect(find(bar, "k-row-next")[0].children[0].textContent).toBe("Next");
|
|
165
|
+
// The scenario's progress sits on the quiet line over the title, at its end.
|
|
166
|
+
const over = find(bar, "k-overline")[0];
|
|
167
|
+
expect(over.children.map((c) => c.className)).toEqual(["k-kicker", "k-strip"]);
|
|
168
|
+
expect(find(bar, "k-stop").map((c) => c.textContent)).toEqual(["pull request", "planned", "merged", "waves", "applied", "reset"]);
|
|
167
169
|
|
|
168
170
|
s.demo.demo = demo("reset", { scenario: "base", about: null });
|
|
169
171
|
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
170
172
|
expect(find(bar, "k-about")).toEqual([]);
|
|
171
173
|
expect(find(bar, "k-beat")).toEqual([]);
|
|
172
|
-
// Render what's present: the
|
|
173
|
-
expect(find(bar, "k-
|
|
174
|
+
// Render what's present: the rows with nothing in them keep their place and draw nothing.
|
|
175
|
+
expect(find(bar, "k-row-empty").map((c) => c.className)).toEqual(["k-row k-row-beat k-row-empty", "k-row k-row-more k-row-empty", "k-row k-row-more k-row-empty", "k-row k-row-facts k-row-empty"]);
|
|
174
176
|
// On the base, the hold panel holds the run's note, quiet, with no wave to light.
|
|
175
177
|
expect(find(bar, "k-box-hold")[0].className).toBe("k-box k-box-hold k-hold");
|
|
176
178
|
|
|
@@ -184,7 +186,8 @@ describe("the scenario's card under the title (behold#571)", () => {
|
|
|
184
186
|
renderKiosk(bar, s, new Date("2026-10-15T03:01:00Z"));
|
|
185
187
|
const shown = find(bar, "k-intro");
|
|
186
188
|
expect(shown).toHaveLength(1);
|
|
187
|
-
expect(shown[0].
|
|
189
|
+
expect(shown[0].textContent).toBe(intro);
|
|
190
|
+
expect(find(bar, "k-row-beat")[0].children[0].textContent).toBe(INTRO_HEAD);
|
|
188
191
|
expect(find(bar, "k-about")).toEqual([]);
|
|
189
192
|
} finally {
|
|
190
193
|
globalThis.document = was;
|
|
@@ -225,7 +228,7 @@ describe("the approval panel's drawing (behold#571)", () => {
|
|
|
225
228
|
};
|
|
226
229
|
const panel = approvalPanel(model, { showLine: (l) => shown.push(l) });
|
|
227
230
|
// behold#571: the wave, the run and the plan head the hold panel; the panel's own head says what its rows are.
|
|
228
|
-
expect(find(panel, "k-ap-head")[0].textContent).toBe("
|
|
231
|
+
expect(find(panel, "k-ap-head")[0].textContent).toBe("Approval · times in UTC");
|
|
229
232
|
expect(holdHead({ wave: model.wave, run: 3605, digest: model.digest })).toBe("Wave 2 · run #3605 · plan 0accc105");
|
|
230
233
|
expect(find(panel, "k-ap-row").map((r) => r.className)).toEqual(["k-ap-row k-ap-lit", "k-ap-row k-ap-dim", "k-ap-row k-ap-dim", "k-ap-row k-ap-dim"]);
|
|
231
234
|
expect(find(panel, "k-ap-facts")[0].textContent).toBe("04:09:41 · ledger 57869649");
|
|
@@ -415,9 +418,11 @@ describe("the kiosk for a viewer new to the demo (behold#571)", () => {
|
|
|
415
418
|
it("shows the intro in the card's box between scenarios, never as a band, and none without one", () => {
|
|
416
419
|
// behold#571: a live step has no intro band; "What is this?" holds it.
|
|
417
420
|
expect(find(draw(demo("planned", { intro })).bar, "k-intro")).toEqual([]);
|
|
418
|
-
const
|
|
421
|
+
const { bar } = draw(demo("reset", { intro }));
|
|
422
|
+
const shown = find(bar, "k-intro");
|
|
419
423
|
expect(shown).toHaveLength(1);
|
|
420
|
-
|
|
424
|
+
// behold#571: the intro's head is its row's label, its words the row's.
|
|
425
|
+
expect([find(bar, "k-row-beat")[0].children[0].textContent, shown[0].textContent]).toEqual([INTRO_HEAD, intro]);
|
|
421
426
|
expect(find(draw(demo("reset")).bar, "k-intro")).toEqual([]);
|
|
422
427
|
expect(find(draw(demo("planned", { intro: null })).bar, "k-intro")).toEqual([]);
|
|
423
428
|
expect(introText(demo("planned", { intro: " " }))).toBe(null);
|
|
@@ -470,3 +475,9 @@ describe("the kiosk for a viewer new to the demo (behold#571)", () => {
|
|
|
470
475
|
}
|
|
471
476
|
});
|
|
472
477
|
});
|
|
478
|
+
|
|
479
|
+
describe("the lead block's step rail (behold#571)", () => {
|
|
480
|
+
it("takes the step's state: held amber, failed, applied, the accent while it moves, neutral at the reset", () => {
|
|
481
|
+
expect(["waiting", "failed", "stalled", "applied", "applying", "planned", "resumed", "reset"].map(stepTone)).toEqual(["wait", "bad", "bad", "ok", "busy", "busy", "busy", "idle"]);
|
|
482
|
+
});
|
|
483
|
+
});
|
package/web/operator.js
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* at-a-glance line, the timeline is the thing you go and look at.
|
|
26
26
|
*/
|
|
27
27
|
import { waitingFor } from "./run-playhead.js";
|
|
28
|
+
import { barVarFor } from "./theme.js";
|
|
28
29
|
|
|
29
30
|
// #477: why a gate card has no approve button.
|
|
30
31
|
const NO_APPROVE = {
|
|
@@ -338,6 +339,8 @@ export function renderOperator(host, state, actions = {}, history = null) {
|
|
|
338
339
|
const dot = el("span", "run-dot");
|
|
339
340
|
dot.style.background = LEASE_COLOR[r.lease] || "var(--muted)";
|
|
340
341
|
dot.title = r.leaseText;
|
|
342
|
+
// behold#571: the op's left bar, in its lease's state.
|
|
343
|
+
if (row.style.setProperty) row.style.setProperty("--bar", barVarFor(LEASE_COLOR[r.lease]));
|
|
341
344
|
row.appendChild(dot);
|
|
342
345
|
|
|
343
346
|
const body = el("div", "grow");
|
package/web/run-playhead.js
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
/** Settled-step tones, in the same token vocabulary the apply progress panel
|
|
20
20
|
* uses (`APPLY_STATUS_COLOR` in app.js) so "green means it worked" reads the
|
|
21
21
|
* same everywhere. */
|
|
22
|
+
import { barVarFor } from "./theme.js";
|
|
23
|
+
|
|
22
24
|
export const RUN_STEP_COLOR = {
|
|
23
25
|
ok: "var(--managed)",
|
|
24
26
|
fail: "var(--degraded)",
|
|
@@ -160,6 +162,8 @@ export function renderPlayhead(host, run, card, actions = {}) {
|
|
|
160
162
|
const row = el("div", "run-step");
|
|
161
163
|
const dot = el("span", "run-dot");
|
|
162
164
|
dot.style.background = RUN_STEP_COLOR[r.status] || "var(--muted)";
|
|
165
|
+
// behold#571: the step's left bar, in its status.
|
|
166
|
+
if (row.style.setProperty) row.style.setProperty("--bar", barVarFor(RUN_STEP_COLOR[r.status]));
|
|
163
167
|
row.appendChild(dot);
|
|
164
168
|
row.appendChild(el("span", "grow", r.label));
|
|
165
169
|
row.appendChild(el("span", "run-took", r.took));
|
package/web/theme.js
CHANGED
|
@@ -422,6 +422,53 @@ export function frameInks(th) {
|
|
|
422
422
|
return { box, card };
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
+
/**
|
|
426
|
+
* behold#571: the left bars. Every listed item in the kiosk, the app and the
|
|
427
|
+
* lanes strip (a run, a job, a step, a wave card, a panel row) carries a bar
|
|
428
|
+
* down its left edge, so the eye can tell one item from the next where the
|
|
429
|
+
* zebra tint barely shows. An item with a state wears the state's colour
|
|
430
|
+
* (running in the accent, held in the waiting amber, failed, applied), one
|
|
431
|
+
* with none the neutral bar. Each is the state's hue with its OKLCH lightness
|
|
432
|
+
* moved, as frameInks does, until it clears BAR_FLOOR on every ground a bar
|
|
433
|
+
* sits on (barGrounds): the page, the panes, the app's panel and well, each
|
|
434
|
+
* with its zebra row, and the selected, hovered and held rows' fills.
|
|
435
|
+
*/
|
|
436
|
+
export const BAR_STATES = ["managed", "foreign", "pending", "degraded", "runtime", "neutral"];
|
|
437
|
+
/** The least WCAG contrast a bar keeps on every ground: a graphical object's floor (1.4.11). */
|
|
438
|
+
export const BAR_FLOOR = 3;
|
|
439
|
+
export function barGrounds(th) {
|
|
440
|
+
const t = tokensFor(th);
|
|
441
|
+
const plain = [th.bg, t.surfaceBox, t.surfacePaneA, t.surfacePaneB, t.panel, t.well];
|
|
442
|
+
return [
|
|
443
|
+
...plain,
|
|
444
|
+
...plain.map((s) => mix(s, th.fg, ZEBRA)),
|
|
445
|
+
// A selected or hovered row (--active, whole and half), a hover-linked one (--focus at 24%), a held one (the waiting tone at 14%).
|
|
446
|
+
...[t.surfacePaneA, t.surfacePaneB, t.panel].flatMap((s) => [t.active, mix(s, t.active, 0.5), mix(s, t.focus, 0.24), mix(s, t.foreign, 0.14)]),
|
|
447
|
+
];
|
|
448
|
+
}
|
|
449
|
+
export function barInks(th) {
|
|
450
|
+
const t = tokensFor(th);
|
|
451
|
+
const grounds = barGrounds(th);
|
|
452
|
+
const up = hexToOklch(th.bg).L < 0.6;
|
|
453
|
+
const out = {};
|
|
454
|
+
for (const s of BAR_STATES) out[s] = lightnessFor(t[s], grounds, BAR_FLOOR, up);
|
|
455
|
+
return out;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* The bar for an item whose state is drawn today as a colour (`var(--managed)`
|
|
459
|
+
* on its dot, say): that state's bar, or the neutral one for anything else
|
|
460
|
+
* (--muted, a hex, nothing).
|
|
461
|
+
*/
|
|
462
|
+
export function barVarFor(color) {
|
|
463
|
+
const m = /^var\(--(\w+)\)$/.exec(String(color || "").trim());
|
|
464
|
+
return m && BAR_STATES.includes(m[1]) ? `var(--bar-${m[1]})` : "var(--bar-neutral)";
|
|
465
|
+
}
|
|
466
|
+
/** The bars as CSS custom properties: `--bar-managed` … `--bar-neutral`. */
|
|
467
|
+
export function barVars(th) {
|
|
468
|
+
const inks = barInks(th);
|
|
469
|
+
return Object.fromEntries(BAR_STATES.map((s) => [`bar-${s}`, inks[s]]));
|
|
470
|
+
}
|
|
471
|
+
|
|
425
472
|
const PIN_VARS = ["bg0", "bg1", "dots", "text", "textMuted", "textFaint", "edge", "neutralFill", "neutralStroke", "neutralBar", "accentFill", "accentStroke", "accentBar", "goodFill", "goodStroke", "goodBar", "warnFill", "warnStroke", "warnBar", "runtimeFill", "runtimeStroke", "runtimeBar", "selectedStroke"];
|
|
426
473
|
|
|
427
474
|
function hash(s) { let h = 2166136261; for (let i = 0; i < s.length; i++) { h ^= s.charCodeAt(i); h = Math.imul(h, 16777619); } return h >>> 0; }
|
|
@@ -464,6 +511,8 @@ export function applyTheme(tokens = _tokens) {
|
|
|
464
511
|
root.style.setProperty("--frame-" + k, inks.box[k]);
|
|
465
512
|
root.style.setProperty("--frame-card-" + k, inks.card[k]);
|
|
466
513
|
}
|
|
514
|
+
// behold#571: the left bars' colours, shared by the app, the kiosk and the lanes strip (barInks).
|
|
515
|
+
for (const [k, v] of Object.entries(barVars(_active))) root.style.setProperty("--" + k, v);
|
|
467
516
|
}
|
|
468
517
|
root.style.setProperty("color-scheme", tokens.dark ? "dark" : "light");
|
|
469
518
|
}
|
package/web/theme.test.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// sweeps all 552 palettes for the same assertion; this pins the exact
|
|
7
7
|
// palette the issue was filed against, with no browser involved.
|
|
8
8
|
import { describe, it, expect } from "vitest";
|
|
9
|
-
import { FRAME_STATES, MIN_STEP, SOFT_CEILING, ZEBRA, contrast, desaturate, frameGrounds, frameInks, hexToOklch, mix, pinTokensFor, tokensFor } from "./theme.js";
|
|
9
|
+
import { BAR_FLOOR, BAR_STATES, FRAME_STATES, MIN_STEP, barGrounds, barInks, barVars, SOFT_CEILING, ZEBRA, contrast, desaturate, frameGrounds, frameInks, hexToOklch, mix, pinTokensFor, tokensFor } from "./theme.js";
|
|
10
10
|
import { THEMES } from "./themes.js";
|
|
11
11
|
|
|
12
12
|
describe("tokensFor — the --muted contrast floor (#240)", () => {
|
|
@@ -138,3 +138,58 @@ describe("the graph frame's state colours", () => {
|
|
|
138
138
|
expect(contrast(frameInks(th).card.pending, pinTokensFor(th).neutralFill)).toBeGreaterThanOrEqual(4.5);
|
|
139
139
|
});
|
|
140
140
|
});
|
|
141
|
+
|
|
142
|
+
describe("the left bars (behold#571)", () => {
|
|
143
|
+
const themes = Object.values(THEMES);
|
|
144
|
+
|
|
145
|
+
it("clear 3:1 on every ground a bar sits on, in every theme, for every state and the neutral bar", () => {
|
|
146
|
+
expect(BAR_FLOOR).toBe(3);
|
|
147
|
+
const bad = [];
|
|
148
|
+
for (const th of themes) {
|
|
149
|
+
const grounds = barGrounds(th);
|
|
150
|
+
const inks = barInks(th);
|
|
151
|
+
for (const s of BAR_STATES) {
|
|
152
|
+
const worst = Math.min(...grounds.map((g) => contrast(inks[s], g)));
|
|
153
|
+
if (worst < BAR_FLOOR) bad.push(`${th.name} ${s} ${inks[s]} ${worst.toFixed(2)}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
expect(bad).toEqual([]);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("sit on the page, the kiosk's panes, the app's panel and well, their zebra rows and the selected, hovered and held fills", () => {
|
|
160
|
+
const th = THEMES["Sea Shells"];
|
|
161
|
+
const t = tokensFor(th);
|
|
162
|
+
const g = barGrounds(th);
|
|
163
|
+
for (const c of [th.bg, t.surfaceBox, t.surfacePaneA, t.surfacePaneB, t.panel, t.well, t.active, mix(t.surfacePaneB, th.fg, ZEBRA)]) expect(g).toContain(c);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("keep each state's hue where it has one, moving its lightness", () => {
|
|
167
|
+
let kept = 0;
|
|
168
|
+
let total = 0;
|
|
169
|
+
for (const th of themes) {
|
|
170
|
+
const t = tokensFor(th);
|
|
171
|
+
const inks = barInks(th);
|
|
172
|
+
for (const s of ["managed", "foreign", "pending", "degraded"]) {
|
|
173
|
+
const a = hexToOklch(t[s]);
|
|
174
|
+
if (a.C < 0.05) continue;
|
|
175
|
+
total++;
|
|
176
|
+
const b = hexToOklch(inks[s]);
|
|
177
|
+
const dH = Math.abs(((a.H - b.H + 540) % 360) - 180);
|
|
178
|
+
if (dH < 20 || b.C < 0.02) kept++;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
expect(kept / total).toBeGreaterThan(0.97);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it("are emitted as --bar-<state>, one per state", () => {
|
|
185
|
+
expect(Object.keys(barVars(THEMES["Catppuccin Mocha"]))).toEqual(BAR_STATES.map((s) => `bar-${s}`));
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
it("lift Royal's neutral, which sat at about 1.4:1 on its panes, where the zebra row reads at 1.02:1", () => {
|
|
189
|
+
const th = THEMES["Royal"];
|
|
190
|
+
const t = tokensFor(th);
|
|
191
|
+
expect(contrast(mix(t.surfacePaneB, th.fg, ZEBRA), t.surfacePaneB)).toBeLessThan(1.05);
|
|
192
|
+
expect(contrast(t.neutral, t.surfacePaneB)).toBeLessThan(1.5);
|
|
193
|
+
expect(contrast(barInks(th).neutral, t.surfacePaneB)).toBeGreaterThanOrEqual(3);
|
|
194
|
+
});
|
|
195
|
+
});
|