@intentius/behold 0.29.34 → 0.29.35
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/package.json +1 -1
- package/web/kiosk.html +26 -1
- package/web/kiosk.js +64 -1
- package/web/kiosk.test.js +61 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.35",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",
|
package/web/kiosk.html
CHANGED
|
@@ -217,6 +217,28 @@
|
|
|
217
217
|
.k-action { font-family: var(--font-mono); color: var(--fg); }
|
|
218
218
|
.k-when { color: var(--foreign); font-family: var(--font-mono); }
|
|
219
219
|
.k-next-by { color: var(--muted); }
|
|
220
|
+
/*
|
|
221
|
+
* behold#571: the bar under "next, by the driver", in both layouts: how far the driver's wait
|
|
222
|
+
* has gone (kiosk.js nextProgress), in the step's tone (theme.js barInks, 3:1 in every theme).
|
|
223
|
+
* It is placed, never in the flow, so no row moves when it comes or goes. At the deadline it
|
|
224
|
+
* pulses until the step changes; with no deadline a quiet shimmer runs. Under reduced motion
|
|
225
|
+
* the due bar is steady and full, and there is no shimmer.
|
|
226
|
+
*/
|
|
227
|
+
.k-row-next { position: relative; }
|
|
228
|
+
.k-nbar { position: absolute; left: calc(0.75em + var(--k-label-w) + 0.8em); right: 0.2em; bottom: 0; height: 3px; border-radius: 2px; overflow: hidden; pointer-events: none;
|
|
229
|
+
background: color-mix(in srgb, var(--rule) 55%, transparent); }
|
|
230
|
+
.k-nbar-none { display: none; }
|
|
231
|
+
.k-nbar-in { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--k-nbar-fill, 0) * 100%); border-radius: inherit; background: var(--bar, var(--bar-neutral)); }
|
|
232
|
+
.k-nbar-due .k-nbar-in { width: 100%; }
|
|
233
|
+
.k-nbar-wait { background: transparent; }
|
|
234
|
+
.k-nbar-wait .k-nbar-in { width: 30%; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bar, var(--bar-neutral)) 60%, transparent), transparent); }
|
|
235
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
236
|
+
.k-nbar-due .k-nbar-in { animation: k-nbar-pulse 2.4s ease-in-out var(--k-nbar-phase, 0ms) infinite; }
|
|
237
|
+
.k-nbar-wait .k-nbar-in { animation: k-nbar-sweep 2.4s linear var(--k-nbar-phase, 0ms) infinite; }
|
|
238
|
+
}
|
|
239
|
+
@media (prefers-reduced-motion: reduce) { .k-nbar-wait { display: none; } }
|
|
240
|
+
@keyframes k-nbar-pulse { 50% { opacity: 0.5; } }
|
|
241
|
+
@keyframes k-nbar-sweep { from { transform: translateX(-100%); } to { transform: translateX(334%); } }
|
|
220
242
|
/* The pull request's facts, smallest: each part a chip that wraps whole, never cut off. */
|
|
221
243
|
.k-row-facts .k-row-label { padding-top: 0.25em; }
|
|
222
244
|
.k-row-box > p.k-facts { display: flex; flex-wrap: wrap; gap: 0 0.5em; max-width: none; font-size: 0.84em; line-height: 1.45; color: var(--fg); }
|
|
@@ -334,6 +356,7 @@
|
|
|
334
356
|
.k-row { grid-template-columns: minmax(0, 1fr); row-gap: 0.1em; padding: 0.1em 0 0.1em 0.75em; }
|
|
335
357
|
.k-row-empty { display: none; }
|
|
336
358
|
.k-row-label { padding-top: 0; }
|
|
359
|
+
.k-nbar { left: 0.75em; right: 0; }
|
|
337
360
|
#views { flex-wrap: wrap; gap: 0.3em 0.9em; }
|
|
338
361
|
.k-strip { flex-wrap: wrap; }
|
|
339
362
|
.k-right > .k-cycle { padding: 0; }
|
|
@@ -401,6 +424,8 @@
|
|
|
401
424
|
.k-cap-title .k-brand { vertical-align: 0; }
|
|
402
425
|
.k-cap-next { margin-left: auto; color: var(--muted); font-size: 0.92em; white-space: nowrap; flex: none; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
|
|
403
426
|
.k-cap-next .k-action { font-family: var(--font-mono); color: var(--fg); }
|
|
427
|
+
.k-cap-next { position: relative; padding-bottom: 6px; }
|
|
428
|
+
.k-cap-next .k-nbar { left: 0; right: 0; bottom: 0; }
|
|
404
429
|
/* behold#571: the caption's beats are the lead block's rows: the label in a fixed column, the words beside it (two lines, at most 72ch), a rail down the left; only the step's rail takes its state's colour (theme.js barInks). */
|
|
405
430
|
.k-cap-row { margin: 0; display: grid; grid-template-columns: var(--k-label-w) minmax(0, 1fr); column-gap: 0.8em; align-items: start; align-self: stretch; padding-left: 0.75em; line-height: 1.25; font-size: 1em; color: color-mix(in srgb, var(--fg) 78%, var(--muted)); box-shadow: inset 3px 0 0 var(--bar, var(--bar-neutral)); }
|
|
406
431
|
.k-cap-row:empty { box-shadow: none; }
|
|
@@ -508,7 +533,7 @@
|
|
|
508
533
|
.k-cap-step { order: 2; } .k-cap-changes { order: 3; }
|
|
509
534
|
.k-cap-title { white-space: normal; font-size: 1.12em; }
|
|
510
535
|
.k-cap-title .k-kicker { display: block; margin-bottom: 0.1em; }
|
|
511
|
-
.k-cap-next {
|
|
536
|
+
.k-cap-next { margin-left: 0; flex: 1 1 100%; max-width: none; white-space: normal; }
|
|
512
537
|
.k-cap-row { grid-template-columns: minmax(0, 1fr); row-gap: 0.1em; } .k-cap-text { -webkit-line-clamp: unset; display: block; } .k-cap-label { padding-top: 0; }
|
|
513
538
|
.k-cap-lead { font-size: 1.12em; }
|
|
514
539
|
.k-over, #k-result { position: static; visibility: visible; width: auto; margin: 0 16px; max-height: none; transform: none !important; }
|
package/web/kiosk.js
CHANGED
|
@@ -172,6 +172,64 @@ export function countdownWords(secs) {
|
|
|
172
172
|
return `in ${Math.floor(secs / 60)} m ${String(secs % 60).padStart(2, "0")} s`;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
+
/**
|
|
176
|
+
* behold#571: how far the driver's wait for its next action has gone, for the
|
|
177
|
+
* bar under "next, by the driver". The bar fills from `next.from` (when the
|
|
178
|
+
* driver started waiting; an older driver leaves it out) to `next.at`. Without `from`
|
|
179
|
+
* it fills from `seen`, when this page first saw that deadline; null when the
|
|
180
|
+
* page joined the countdown midway, and then there is no bar, only the words.
|
|
181
|
+
*
|
|
182
|
+
* kind is "fill" (fraction 0..1), "due" (the deadline passed: a full bar that
|
|
183
|
+
* pulses until the step changes), "wait" (no deadline: the driver waits on the
|
|
184
|
+
* pipeline, a quiet shimmer) or "none" (no bar).
|
|
185
|
+
*/
|
|
186
|
+
export function nextProgress(next, now = new Date(), seen = null) {
|
|
187
|
+
if (!next) return { kind: "none", fraction: null };
|
|
188
|
+
if (!next.at) return { kind: "wait", fraction: null };
|
|
189
|
+
const at = Date.parse(next.at);
|
|
190
|
+
if (Number.isNaN(at)) return { kind: "none", fraction: null };
|
|
191
|
+
const t = now.getTime();
|
|
192
|
+
if (t >= at) return { kind: "due", fraction: 1 };
|
|
193
|
+
const parsed = next.from ? Date.parse(next.from) : NaN;
|
|
194
|
+
const from = Number.isNaN(parsed) ? seen : parsed;
|
|
195
|
+
if (typeof from !== "number" || !Number.isFinite(from) || from >= at) return { kind: "none", fraction: null };
|
|
196
|
+
return { kind: "fill", fraction: Math.min(1, Math.max(0, (t - from) / (at - from))) };
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* behold#571: when this page first saw each deadline, for nextProgress's
|
|
201
|
+
* `seen`. The deadline on screen when the page loaded, or when the mode
|
|
202
|
+
* changed (live, replay), was seen midway: its `seen` is null. One that came
|
|
203
|
+
* after is seen at `nowMs`. `next` is demo.json's next (null when it has
|
|
204
|
+
* none), or undefined while no demo.json has been read. Returns the memo to
|
|
205
|
+
* keep for the next call.
|
|
206
|
+
*/
|
|
207
|
+
export function nextSeen(memo, next, mode, nowMs) {
|
|
208
|
+
// No demo.json read yet: nothing watched.
|
|
209
|
+
if (next === undefined) return memo;
|
|
210
|
+
const key = next && next.at ? `${next.action}|${next.at}` : null;
|
|
211
|
+
if (memo && memo.mode === mode && memo.key === key) return memo;
|
|
212
|
+
return { key, mode, seen: memo && memo.mode === mode && key ? nowMs : null };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** The period of the due bar's pulse and the shimmer's sweep; the redraw rebuilds the bar each second, so it carries its phase. */
|
|
216
|
+
export const NEXT_BAR_MS = 2400;
|
|
217
|
+
|
|
218
|
+
/** behold#571: the bar under "next, by the driver", in the step's tone (theme.js barInks). It never takes room: CSS places it. */
|
|
219
|
+
function nextBar(demo, now, s) {
|
|
220
|
+
const p = nextProgress(demo.next, now, s && s.nextSeen ? s.nextSeen.seen : null);
|
|
221
|
+
const bar = el("span", `k-nbar k-nbar-${p.kind}`);
|
|
222
|
+
if (bar.dataset) bar.dataset.kTone = stepTone(demo.step);
|
|
223
|
+
if (bar.setAttribute) bar.setAttribute("aria-hidden", "true");
|
|
224
|
+
const fill = el("span", "k-nbar-in");
|
|
225
|
+
if (fill.style && fill.style.setProperty) {
|
|
226
|
+
if (p.fraction !== null) fill.style.setProperty("--k-nbar-fill", String(Math.round(p.fraction * 1000) / 1000));
|
|
227
|
+
fill.style.setProperty("--k-nbar-phase", `-${Date.now() % NEXT_BAR_MS}ms`);
|
|
228
|
+
}
|
|
229
|
+
bar.appendChild(fill);
|
|
230
|
+
return bar;
|
|
231
|
+
}
|
|
232
|
+
|
|
175
233
|
/** The driver's next action, as the kiosk says it. */
|
|
176
234
|
export function nextWords(demo, now = new Date()) {
|
|
177
235
|
if (!demo.next) return { action: "reset and start the next cycle", when: "the driver stalled; it resets and starts the next cycle", secs: null };
|
|
@@ -737,7 +795,9 @@ function drawBar(bar, s, now) {
|
|
|
737
795
|
const nx = nextWords(demo, now);
|
|
738
796
|
const next = el("p", "k-next");
|
|
739
797
|
next.append(elRoots("span", "k-action", nx.action, s), " ", el("span", "k-when", nx.when), " ", el("span", "k-next-by", "by the driver"));
|
|
740
|
-
|
|
798
|
+
const nextRow = leadRow("next", "k-row-next", "Next", next);
|
|
799
|
+
nextRow.appendChild(nextBar(demo, now, s));
|
|
800
|
+
left.appendChild(nextRow);
|
|
741
801
|
|
|
742
802
|
// The rest of the card, quieter: each field on its own row (watch for, then what the scenario shows).
|
|
743
803
|
const more = demo.step === "reset" && intro ? [] : rows.filter((r) => r !== changes);
|
|
@@ -875,6 +935,7 @@ function drawCaption(host, s, now) {
|
|
|
875
935
|
const nx = el("p", "k-cap-next");
|
|
876
936
|
nx.append("next, by the driver: ", elRoots("span", "k-action", cap.next.action, s), " ", el("span", "k-when", cap.next.when));
|
|
877
937
|
if (nx.setAttribute) nx.setAttribute("title", `next, by the driver: ${cap.next.action}`);
|
|
938
|
+
nx.appendChild(nextBar(demo, now, s));
|
|
878
939
|
top.appendChild(nx);
|
|
879
940
|
}
|
|
880
941
|
host.appendChild(top);
|
|
@@ -1308,6 +1369,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1308
1369
|
const setDemo = (answer) => {
|
|
1309
1370
|
s.demo = answer;
|
|
1310
1371
|
const d = answer && answer.demo;
|
|
1372
|
+
// behold#571: when this page first saw the driver's deadline, for the next bar when demo.json has no next.from.
|
|
1373
|
+
s.nextSeen = nextSeen(s.nextSeen, d ? d.next || null : undefined, s.mode, shownNow().getTime());
|
|
1311
1374
|
if (d && d.scenario && typeof d.title === "string" && d.title) titles[d.scenario] = d.title;
|
|
1312
1375
|
if (d && d.scenario && scenarioName(d)) names[d.scenario] = scenarioName(d);
|
|
1313
1376
|
const key = d ? `${s.mode}|${d.cycle}|${d.step}|${d.commit}|${d.pull}` : "";
|
package/web/kiosk.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
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";
|
|
2
|
+
import { stepTone, nextProgress, nextSeen, 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
|
|
|
@@ -155,7 +155,10 @@ describe("the scenario's card under the title (behold#571)", () => {
|
|
|
155
155
|
expect(left.children.map((c) => c.className)).toEqual([
|
|
156
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",
|
|
157
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"], []]);
|
|
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-nbar"], ["k-row-label", "k-box"], ["k-row-label", "k-box"], []]);
|
|
159
|
+
// The next row's bar is placed by CSS, in the step's tone; a stalled driver's next has none.
|
|
160
|
+
const nbar = find(bar, "k-nbar")[0];
|
|
161
|
+
expect(nbar.className).toBe("k-nbar k-nbar-none");
|
|
159
162
|
// Each row: its label in the fixed column, its words in the box beside it.
|
|
160
163
|
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
164
|
expect(rowsOf("k-row-beat")).toEqual([[BEAT_CHANGES, "k-beat", about.changes]]);
|
|
@@ -499,3 +502,59 @@ describe("kiosk: the strip in a scenario's own order (behold#571, #631)", async
|
|
|
499
502
|
expect(stripFromSteps(["pull-request", "planned", "merged", "applying", "applied", "reset"]).map((x) => x.id)).toEqual(STRIP.map((x) => x.id));
|
|
500
503
|
});
|
|
501
504
|
});
|
|
505
|
+
|
|
506
|
+
// behold#571: the bar under "next, by the driver".
|
|
507
|
+
describe("nextProgress and nextSeen", () => {
|
|
508
|
+
const at = "2026-10-16T22:34:35Z";
|
|
509
|
+
const t = (iso) => new Date(iso);
|
|
510
|
+
const ms = (iso) => Date.parse(iso);
|
|
511
|
+
|
|
512
|
+
it("fills from next.from to next.at", () => {
|
|
513
|
+
const next = { action: "approve wave-2", from: "2026-10-16T22:34:15Z", at };
|
|
514
|
+
expect(nextProgress(next, t("2026-10-16T22:34:15Z"))).toEqual({ kind: "fill", fraction: 0 });
|
|
515
|
+
expect(nextProgress(next, t("2026-10-16T22:34:20Z"))).toEqual({ kind: "fill", fraction: 0.25 });
|
|
516
|
+
expect(nextProgress(next, t("2026-10-16T22:34:30Z"))).toEqual({ kind: "fill", fraction: 0.75 });
|
|
517
|
+
// A clock a little behind the driver's never draws below empty.
|
|
518
|
+
expect(nextProgress(next, t("2026-10-16T22:34:10Z")).fraction).toBe(0);
|
|
519
|
+
// from wins over when the page saw it.
|
|
520
|
+
expect(nextProgress(next, t("2026-10-16T22:34:30Z"), ms("2026-10-16T22:34:25Z")).fraction).toBe(0.75);
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
it("is due at and past the deadline, whatever from says", () => {
|
|
524
|
+
expect(nextProgress({ action: "x", from: "2026-10-16T22:34:15Z", at }, t(at))).toEqual({ kind: "due", fraction: 1 });
|
|
525
|
+
expect(nextProgress({ action: "x", at }, t("2026-10-16T22:40:00Z"))).toEqual({ kind: "due", fraction: 1 });
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
it("fills from when the page first saw the deadline when from is missing, and draws no bar when it joined midway", () => {
|
|
529
|
+
const next = { action: "approve wave-2", at };
|
|
530
|
+
expect(nextProgress(next, t("2026-10-16T22:34:25Z"), ms("2026-10-16T22:34:15Z"))).toEqual({ kind: "fill", fraction: 0.5 });
|
|
531
|
+
expect(nextProgress(next, t("2026-10-16T22:34:25Z"), null)).toEqual({ kind: "none", fraction: null });
|
|
532
|
+
// A from that cannot be read falls back the same way.
|
|
533
|
+
expect(nextProgress({ ...next, from: "soon" }, t("2026-10-16T22:34:25Z"), ms("2026-10-16T22:34:15Z")).fraction).toBe(0.5);
|
|
534
|
+
expect(nextProgress({ ...next, from: "2026-10-16T22:34:35Z" }, t("2026-10-16T22:34:25Z"))).toEqual({ kind: "none", fraction: null });
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
it("shimmers with no deadline, and draws nothing when there is no next", () => {
|
|
538
|
+
expect(nextProgress({ action: "follow the waves", from: "2026-10-16T22:34:15Z", at: null }, t(at))).toEqual({ kind: "wait", fraction: null });
|
|
539
|
+
expect(nextProgress(null, t(at))).toEqual({ kind: "none", fraction: null });
|
|
540
|
+
expect(nextProgress({ action: "x", at: "not a time" }, t(at))).toEqual({ kind: "none", fraction: null });
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
it("remembers when the page first saw each deadline: midway for the one on screen at load or after a mode change", () => {
|
|
544
|
+
const a = { action: "approve wave-2", at };
|
|
545
|
+
const b = { action: "merge pull request 41", at: "2026-10-16T22:35:40Z" };
|
|
546
|
+
let m = nextSeen(undefined, a, "live", 1000);
|
|
547
|
+
expect(m.seen).toBeNull();
|
|
548
|
+
expect(nextSeen(m, a, "live", 2000)).toBe(m);
|
|
549
|
+
m = nextSeen(m, { action: "follow the waves", at: null }, "live", 3000);
|
|
550
|
+
expect(m.seen).toBeNull();
|
|
551
|
+
m = nextSeen(m, b, "live", 4000);
|
|
552
|
+
expect(m.seen).toBe(4000);
|
|
553
|
+
expect(nextSeen(m, b, "live", 5000).seen).toBe(4000);
|
|
554
|
+
expect(nextSeen(m, b, "replay", 5000).seen).toBeNull();
|
|
555
|
+
// Until demo.json is read (undefined), the page has watched nothing: the first deadline it reads was joined midway.
|
|
556
|
+
expect(nextSeen(nextSeen(undefined, undefined, "live", 0), a, "live", 6000).seen).toBeNull();
|
|
557
|
+
// Once read, a deadline that comes after a step with none is seen to begin.
|
|
558
|
+
expect(nextSeen(nextSeen(undefined, null, "live", 0), a, "live", 6000).seen).toBe(6000);
|
|
559
|
+
});
|
|
560
|
+
});
|