@intentius/behold 0.29.44 → 0.29.45
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 +101 -5
- package/package.json +1 -1
- package/web/app.js +19 -3
- package/web/event-help-modal.js +14 -1
- package/web/kiosk-demo-frame.test.js +27 -0
- package/web/kiosk-event-help-ui.js +42 -7
- package/web/kiosk-event-help.js +73 -0
- package/web/kiosk-highlight.test.js +249 -0
- package/web/kiosk-vendor.js +2 -0
- package/web/kiosk.js +17 -0
- package/web/tg-read-pills.js +23 -0
- package/web/tg-read-pills.test.js +42 -1
package/dist/cli.js
CHANGED
|
@@ -22497,6 +22497,31 @@ var demo_cycle_schema_default = {
|
|
|
22497
22497
|
type: "string",
|
|
22498
22498
|
description: "One line narrating the step."
|
|
22499
22499
|
},
|
|
22500
|
+
highlight: {
|
|
22501
|
+
description: "A call-out for the step: the thing that just happened worth stopping on, which a viewer may show as a modal. null or absent when the step has none. Optional within contract 1.",
|
|
22502
|
+
oneOf: [
|
|
22503
|
+
{
|
|
22504
|
+
type: "null"
|
|
22505
|
+
},
|
|
22506
|
+
{
|
|
22507
|
+
type: "object",
|
|
22508
|
+
required: [
|
|
22509
|
+
"title",
|
|
22510
|
+
"body"
|
|
22511
|
+
],
|
|
22512
|
+
properties: {
|
|
22513
|
+
title: {
|
|
22514
|
+
type: "string",
|
|
22515
|
+
minLength: 1
|
|
22516
|
+
},
|
|
22517
|
+
body: {
|
|
22518
|
+
type: "string",
|
|
22519
|
+
minLength: 1
|
|
22520
|
+
}
|
|
22521
|
+
}
|
|
22522
|
+
}
|
|
22523
|
+
]
|
|
22524
|
+
},
|
|
22500
22525
|
chapter: {
|
|
22501
22526
|
oneOf: [
|
|
22502
22527
|
{
|
|
@@ -22687,6 +22712,31 @@ var demo_step_schema_default = {
|
|
|
22687
22712
|
type: "string",
|
|
22688
22713
|
description: "One line narrating the step."
|
|
22689
22714
|
},
|
|
22715
|
+
highlight: {
|
|
22716
|
+
description: "A call-out for the step: the thing that just happened worth stopping on, which a viewer may show as a modal. null or absent when the step has none. Optional within contract 1.",
|
|
22717
|
+
oneOf: [
|
|
22718
|
+
{
|
|
22719
|
+
type: "null"
|
|
22720
|
+
},
|
|
22721
|
+
{
|
|
22722
|
+
type: "object",
|
|
22723
|
+
required: [
|
|
22724
|
+
"title",
|
|
22725
|
+
"body"
|
|
22726
|
+
],
|
|
22727
|
+
properties: {
|
|
22728
|
+
title: {
|
|
22729
|
+
type: "string",
|
|
22730
|
+
minLength: 1
|
|
22731
|
+
},
|
|
22732
|
+
body: {
|
|
22733
|
+
type: "string",
|
|
22734
|
+
minLength: 1
|
|
22735
|
+
}
|
|
22736
|
+
}
|
|
22737
|
+
}
|
|
22738
|
+
]
|
|
22739
|
+
},
|
|
22690
22740
|
chapter: {
|
|
22691
22741
|
oneOf: [
|
|
22692
22742
|
{
|
|
@@ -22907,6 +22957,12 @@ var DEMO_KEY = "demo.json";
|
|
|
22907
22957
|
var DEMO_READ_TTL_MS = 2e3;
|
|
22908
22958
|
var DEMO_STEPS = ["pull-request", "planned", "merged", "applying", "waiting", "approved", "failed", "resumed", "applied", "reset", "stalled"];
|
|
22909
22959
|
var DEMO_ABOUT_FIELDS = ["changes", "watch", "shows"];
|
|
22960
|
+
function highlightOf(v) {
|
|
22961
|
+
if (!isRecord12(v)) return void 0;
|
|
22962
|
+
const title = text(v.title);
|
|
22963
|
+
const body = text(v.body);
|
|
22964
|
+
return title && body ? { title, body } : void 0;
|
|
22965
|
+
}
|
|
22910
22966
|
var OUTSIDE_STATES = ["applying", "applied", "failed"];
|
|
22911
22967
|
function outsideOf(v) {
|
|
22912
22968
|
if (!isRecord12(v)) return void 0;
|
|
@@ -23013,6 +23069,11 @@ function demoOf(d) {
|
|
|
23013
23069
|
...(() => {
|
|
23014
23070
|
const o = outsideOf(d.outside);
|
|
23015
23071
|
return o ? { outside: o } : {};
|
|
23072
|
+
})(),
|
|
23073
|
+
// behold#757: so is the step's highlight.
|
|
23074
|
+
...(() => {
|
|
23075
|
+
const h = highlightOf(d.highlight);
|
|
23076
|
+
return h ? { highlight: h } : {};
|
|
23016
23077
|
})()
|
|
23017
23078
|
};
|
|
23018
23079
|
}
|
|
@@ -23252,6 +23313,8 @@ function readerSchema(kind) {
|
|
|
23252
23313
|
delete steps.enum;
|
|
23253
23314
|
steps.type = "string";
|
|
23254
23315
|
}
|
|
23316
|
+
const props = kind === "demo-step" ? schema.properties : schema.$defs?.cycleStep?.properties;
|
|
23317
|
+
if (props && props.highlight) delete props.highlight;
|
|
23255
23318
|
return schema;
|
|
23256
23319
|
}
|
|
23257
23320
|
function schemaProblem(doc, kind) {
|
|
@@ -23273,6 +23336,7 @@ function stepOf(d) {
|
|
|
23273
23336
|
const about = isRecord13(d.about) && ["changes", "watch", "shows"].every((f) => text2(d.about[f])) ? d.about : null;
|
|
23274
23337
|
const r = isRecord13(d.reports) ? d.reports : null;
|
|
23275
23338
|
const chapter = chapterOf(d.chapter);
|
|
23339
|
+
const highlight = highlightOf(d.highlight);
|
|
23276
23340
|
const demo = str9(d.demo) ? d.demo : "";
|
|
23277
23341
|
return {
|
|
23278
23342
|
demo,
|
|
@@ -23296,6 +23360,7 @@ function stepOf(d) {
|
|
|
23296
23360
|
delivery: null,
|
|
23297
23361
|
beat: null,
|
|
23298
23362
|
...chapter ? { chapter } : {},
|
|
23363
|
+
...highlight ? { highlight } : {},
|
|
23299
23364
|
at: str9(d.at) ? d.at : null,
|
|
23300
23365
|
reports: r ? { url: text2(r.url), plan: str9(r.plan) ? r.plan : null, apply: str9(r.apply) ? r.apply : null } : null,
|
|
23301
23366
|
cycleReports: Array.isArray(d.cycle_reports) ? reportsOf(d.cycle_reports) : null
|
|
@@ -23456,6 +23521,8 @@ var ChantDemo = class {
|
|
|
23456
23521
|
runs = /* @__PURE__ */ new Map();
|
|
23457
23522
|
live = null;
|
|
23458
23523
|
sources = /* @__PURE__ */ new Map();
|
|
23524
|
+
/** behold#765: the report URLs {@link entries} has named, the ones {@link reportSource} answers for. */
|
|
23525
|
+
reportUrls = /* @__PURE__ */ new Set();
|
|
23459
23526
|
constructor(opts) {
|
|
23460
23527
|
this.opts = opts;
|
|
23461
23528
|
this.source = this.sourceOf(opts.source);
|
|
@@ -23464,10 +23531,17 @@ var ChantDemo = class {
|
|
|
23464
23531
|
const hit = this.sources.get(url);
|
|
23465
23532
|
if (hit) return hit;
|
|
23466
23533
|
const via = { ...this.opts.aws ? { aws: this.opts.aws } : {}, ...this.opts.fetch ? { fetch: this.opts.fetch } : {} };
|
|
23467
|
-
const
|
|
23534
|
+
const of = (u) => this.opts.sourceOf ? this.opts.sourceOf(u) : u === this.opts.source ? terragucciSource(u, via) : reportSourceOf(u, via);
|
|
23535
|
+
const beside = this.besideUrl();
|
|
23536
|
+
const near = url !== this.opts.source && url !== beside && !this.opts.reportUrl ? of(beside) : void 0;
|
|
23537
|
+
const s = near ? besideFirst(near, of(url)) : of(url);
|
|
23468
23538
|
this.sources.set(url, s);
|
|
23469
23539
|
return s;
|
|
23470
23540
|
}
|
|
23541
|
+
/** `reports/` beside the records. */
|
|
23542
|
+
besideUrl() {
|
|
23543
|
+
return `${this.opts.source.replace(/\/+$/, "")}/${REPORTS_DIR}`;
|
|
23544
|
+
}
|
|
23471
23545
|
now() {
|
|
23472
23546
|
return this.opts.now ? this.opts.now() : /* @__PURE__ */ new Date();
|
|
23473
23547
|
}
|
|
@@ -23516,8 +23590,7 @@ var ChantDemo = class {
|
|
|
23516
23590
|
if (this.opts.reportUrl) return this.opts.reportUrl;
|
|
23517
23591
|
const u = step?.reports?.url;
|
|
23518
23592
|
if (u) return u;
|
|
23519
|
-
|
|
23520
|
-
return `${base}/${REPORTS_DIR}`;
|
|
23593
|
+
return this.besideUrl();
|
|
23521
23594
|
}
|
|
23522
23595
|
/** Every stage the runs pane may show: the latest cycle's, and the cycle in progress's, each with its id. */
|
|
23523
23596
|
async entries() {
|
|
@@ -23529,7 +23602,9 @@ var ChantDemo = class {
|
|
|
23529
23602
|
if (live2 && (!latest || live2.cycle !== latest.cycle)) live2.reports.forEach((r, i) => out.push({ ...r, id: runIdFor(live2.cycle, i + 1), cycle: live2.cycle }));
|
|
23530
23603
|
const step = s.demo;
|
|
23531
23604
|
const withUrl = step ?? (latest ? latest.steps.find((x) => x.reports && x.reports.url) ?? null : null);
|
|
23532
|
-
|
|
23605
|
+
const url = this.reportsUrl(withUrl);
|
|
23606
|
+
this.reportUrls.add(url);
|
|
23607
|
+
return { entries: out, repo: step ? step.repo : latest ? latest.repo : null, url, latest };
|
|
23533
23608
|
}
|
|
23534
23609
|
/** One stage's run, built from its events (and its report, to end a run the events left open). Shared for {@link RUN_READ_TTL_MS}. */
|
|
23535
23610
|
run(entry, repo, url) {
|
|
@@ -23575,7 +23650,27 @@ var ChantDemo = class {
|
|
|
23575
23650
|
const runs2 = entries.map((e) => ({ id: e.id, event: e.stage === "plan" ? "pull_request" : "push", trigger: e.stage === "plan" ? "plan" : "merge", commit: e.commit, pull: e.pr, cycle: e.cycle, status: "success", jobs: [], reportKey: e.key })).reverse();
|
|
23576
23651
|
return { url, runs: runs2 };
|
|
23577
23652
|
}
|
|
23653
|
+
/**
|
|
23654
|
+
* behold#765: the source /api/chant/pr reads a report URL through, when it is the demo's (the URL its records
|
|
23655
|
+
* name, or the one serve gave): the runs' own, so the graph's waves read what the runs pane does. Undefined for
|
|
23656
|
+
* any other URL (another served checkout's loop), which reads as before.
|
|
23657
|
+
*/
|
|
23658
|
+
reportSource(url) {
|
|
23659
|
+
return this.reportUrls.has(url) ? this.sourceOf(url) : void 0;
|
|
23660
|
+
}
|
|
23578
23661
|
};
|
|
23662
|
+
function besideFirst(first, then) {
|
|
23663
|
+
const lister = then.list ? then : first.list ? first : null;
|
|
23664
|
+
return {
|
|
23665
|
+
kind: then.kind,
|
|
23666
|
+
location: then.location,
|
|
23667
|
+
async read(key3) {
|
|
23668
|
+
const a = await first.read(key3).catch(() => void 0);
|
|
23669
|
+
return a !== void 0 ? a : then.read(key3);
|
|
23670
|
+
},
|
|
23671
|
+
...lister ? { list: (prefix, max) => lister.list(prefix, max) } : {}
|
|
23672
|
+
};
|
|
23673
|
+
}
|
|
23579
23674
|
function chantDemoRoutes(app, demo) {
|
|
23580
23675
|
app.get("/api/chant/demo", async (c) => {
|
|
23581
23676
|
const a = await demo.readStep();
|
|
@@ -33557,7 +33652,8 @@ function createApp(cfg, broadcaster = new Broadcaster(), frames = new FrameBuffe
|
|
|
33557
33652
|
...chantDemo ? { demoReports: (d, g) => chantDemo.prReports(d, g), ...runs2 ? { source: runs2 } : {} } : runs2 ? { source: runs2 } : {},
|
|
33558
33653
|
...cfg.chantReportUrl ? { reportUrl: cfg.chantReportUrl } : {},
|
|
33559
33654
|
// The report URL is read through the same S3 client and endpoint handling as --terragucci's.
|
|
33560
|
-
|
|
33655
|
+
// behold#765: the demo's own URL through the demo's source, as its runs are read (reports/ beside its records first).
|
|
33656
|
+
reportSource: (url) => chantDemo?.reportSource(url) ?? reportSourceOf(url, via),
|
|
33561
33657
|
// A blocked component's blocker, from the edges of the components graph last drawn for the checkout.
|
|
33562
33658
|
dependsOn: (d) => chantNeeds.get(d)?.needs,
|
|
33563
33659
|
componentWaves: (d) => chantNeeds.get(d)?.waves
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.45",
|
|
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/app.js
CHANGED
|
@@ -130,7 +130,7 @@ import { mountDots, unmountDots, dotsCamera, dotsZoomOutFactor, dotsCarving, dot
|
|
|
130
130
|
// Report minor 34: a cone plan's lights, on the cards and the dots (web/cone.js).
|
|
131
131
|
import { cardRoot as coneCardRoot, coneLights, coneOf, resourceLight as coneResourceLight, rootLight as coneRootLight, wrapWords } from "./cone.js";
|
|
132
132
|
import { carveDrawable } from "./dots-live.js";
|
|
133
|
-
import { FLASH_MS as TG_FLASH_MS, createReadFlash, hotReads as tgHotReads, nearestOn as tgNearestOn, pillSpots as tgPillSpots, readKey as tgReadKey, readerStates as tgReaderStates } from "./tg-read-pills.js"; // behold#744
|
|
133
|
+
import { FLASH_MS as TG_FLASH_MS, coveredEdges as tgCoveredEdges, createReadFlash, dependsLine as tgDependsLine, hotReads as tgHotReads, nearestOn as tgNearestOn, pillSpots as tgPillSpots, readKey as tgReadKey, readerStates as tgReaderStates } from "./tg-read-pills.js"; // behold#744
|
|
134
134
|
import { outsideCard as tgOutsideCard, outsideModel as tgOutsideModel, outsideSpots as tgOutsideSpots } from "./tg-outside.js"; // behold#743
|
|
135
135
|
initTheme();
|
|
136
136
|
// #476: framed in a host pane. The flag is a class on <html>, so the CSS that
|
|
@@ -3769,6 +3769,8 @@ function drawTgReads() {
|
|
|
3769
3769
|
drawPipelineMarks(svg); // behold#571: the forge and tool marks, before the wave boxes' status finds room around them
|
|
3770
3770
|
for (const old of svg.querySelectorAll("[data-tg-reads]")) old.remove();
|
|
3771
3771
|
tgReadEdgesNow = []; // behold#744
|
|
3772
|
+
// behold#762: an edge a read line stood for comes back; this draw hides the ones its own lines stand for.
|
|
3773
|
+
for (const g of svg.querySelectorAll("g[data-tg-read-covers]")) g.removeAttribute("data-tg-read-covers");
|
|
3772
3774
|
for (const old of svg.querySelectorAll("[data-tg-root]")) old.remove();
|
|
3773
3775
|
for (const r of svg.querySelectorAll("rect[data-tg-stroke0]")) {
|
|
3774
3776
|
r.setAttribute("stroke", r.getAttribute("data-tg-stroke0"));
|
|
@@ -3979,6 +3981,13 @@ function drawTgReads() {
|
|
|
3979
3981
|
// Report minor 34: a cone plan lights what it planned and dims the rest, never hiding it (web/cone.js).
|
|
3980
3982
|
drawConeLights(svg, { stage: states.stage, drawnAnswer, compMode, componentsOfRoot, rootOf });
|
|
3981
3983
|
|
|
3984
|
+
// behold#762: one line per pair. Where a read joins the two cards a dependency edge joins (either way round), the read's
|
|
3985
|
+
// line says both, so the edge is hidden (not removed: the layout and every index of the edges stay as they were), before
|
|
3986
|
+
// the read lines are routed clear of the edges that still show. An edge whose read draws no line shows again below.
|
|
3987
|
+
const edges = tgReadEdges(drawnAnswer, tgProgress);
|
|
3988
|
+
const depEdges = compMode ? [...svg.querySelectorAll("g[data-edge-from]")] : [];
|
|
3989
|
+
tgCoveredEdges(edges, depEdges.map((g) => ({ from: g.getAttribute("data-edge-from"), to: g.getAttribute("data-edge-to") }))).forEach((key, i) => key && depEdges[i].setAttribute("data-tg-read-covers", key));
|
|
3990
|
+
if (depEdges.length) ensureTgReadStyle();
|
|
3982
3991
|
// #571: the components zoom's own marks; its wave boxes are the boxes the caption and the labels keep clear of.
|
|
3983
3992
|
const edgePoints = compMode ? chantEdgePoints(svg) : [];
|
|
3984
3993
|
let readMarks = null; // behold#744: the cards' and waves' states (a story's paced) that a read's pill flashes on
|
|
@@ -4003,7 +4012,6 @@ function drawTgReads() {
|
|
|
4003
4012
|
// on the read root's box border, that crosses no text and as few cards as
|
|
4004
4013
|
// there are; each label then sits beside its line where it covers no text
|
|
4005
4014
|
// and crosses no line.
|
|
4006
|
-
const edges = tgReadEdges(drawnAnswer, tgProgress);
|
|
4007
4015
|
if (compMode) tipComponentEdges(svg, edges); // behold#744
|
|
4008
4016
|
const centre = (b) => ({ x: (b.x + b.x2) / 2, y: (b.y + b.y2) / 2 });
|
|
4009
4017
|
const grow = (b, d) => ({ x: b.x - d, y: b.y - d, x2: b.x2 + d, y2: b.y2 + d });
|
|
@@ -4116,10 +4124,16 @@ function drawTgReads() {
|
|
|
4116
4124
|
layer.appendChild(line);
|
|
4117
4125
|
// behold#744: a wide clear stroke along the line takes the pointer (the drawn layer lets it through): pointing at it shows the
|
|
4118
4126
|
// read's pill; outside a kiosk frame the shared tooltip adds the whole sentence (data-tip, no <title>: no second, native one).
|
|
4119
|
-
|
|
4127
|
+
// behold#762: a line that stands for a hidden dependency edge says what the edge said too, in a kiosk frame as well.
|
|
4128
|
+
const stands = depEdges.filter((g) => g.getAttribute("data-tg-read-covers") === key).map((g) => tgDependsLine({ from: g.getAttribute("data-edge-from"), to: g.getAttribute("data-edge-to") }));
|
|
4129
|
+
const tip = stands.length ? [...stands, tgReadLine(e)].join("\n") : embedOpts.bare ? null : tgReadLine(e);
|
|
4130
|
+
hits.appendChild(make("line", { x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, stroke: "transparent", "stroke-width": 16, "pointer-events": "stroke", "data-tg-read-hit": key, ...(tip ? { "data-tip": tip } : {}) }));
|
|
4120
4131
|
drawn.push({ p0, p1 });
|
|
4121
4132
|
labels.push({ e, p0, p1, color, kind, key, fromBox });
|
|
4122
4133
|
}
|
|
4134
|
+
// behold#762: a read that found no route (or no card) drew no line: its pair keeps the dependency edge.
|
|
4135
|
+
const lined = new Set(labels.map((l) => l.key));
|
|
4136
|
+
for (const g of depEdges) if (g.hasAttribute("data-tg-read-covers") && !lined.has(g.getAttribute("data-tg-read-covers"))) g.removeAttribute("data-tg-read-covers");
|
|
4123
4137
|
// behold#571: the marks step aside from the read lines, and a box lifts its marks off an arrowhead (its box then reaches higher).
|
|
4124
4138
|
for (const [rect] of clearMarksOfReads(svg, drawn)) {
|
|
4125
4139
|
const now = boxOf(rect);
|
|
@@ -4506,6 +4520,7 @@ function ensureTgReadStyle() {
|
|
|
4506
4520
|
#graph g[data-tg-read-pill].tg-hot { transition: opacity .15s ease; }
|
|
4507
4521
|
#graph g[data-tg-read-pill].tg-flash { animation: tg-read-flash 6s linear both; }
|
|
4508
4522
|
#graph line[data-tg-read].tg-hot { stroke-width: 5; filter: drop-shadow(0 0 3px var(--bg)); }
|
|
4523
|
+
#graph g[data-tg-read-covers] { display: none !important; }
|
|
4509
4524
|
@keyframes tg-read-flash { 0% { opacity: 0; } 4%, 80% { opacity: 1; } 100% { opacity: 0; } }
|
|
4510
4525
|
@keyframes tg-read-flash-step { 0%, 99.9% { opacity: 1; } 100% { opacity: 0; } }
|
|
4511
4526
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -4522,6 +4537,7 @@ function chantEdgePoints(svg) {
|
|
|
4522
4537
|
const inv = toSvg.inverse();
|
|
4523
4538
|
const out = [];
|
|
4524
4539
|
for (const path of svg.querySelectorAll("path.pin-edge-line")) {
|
|
4540
|
+
if (path.closest("[data-tg-read-covers]")) continue; // behold#762: hidden, a read line stands for it
|
|
4525
4541
|
let len = 0;
|
|
4526
4542
|
try {
|
|
4527
4543
|
len = path.getTotalLength();
|
package/web/event-help-modal.js
CHANGED
|
@@ -39,6 +39,9 @@ export const VERBS = {
|
|
|
39
39
|
/** behold#631: a chant failure's button: the driver opens a fix's pull request. */
|
|
40
40
|
export const FIX_VERBS = { verb: "Fix", ing: "Opening the fix…", past: "Fix opened" };
|
|
41
41
|
|
|
42
|
+
/** behold#757: a step's highlight's kicker, over its title. */
|
|
43
|
+
export const HIGHLIGHT_KICKER = "What's special here";
|
|
44
|
+
|
|
42
45
|
/** Whole seconds until `at` (ms), never below 0; null without a time. */
|
|
43
46
|
export function secondsLeft(at, now) {
|
|
44
47
|
if (!Number.isFinite(at)) return null;
|
|
@@ -71,6 +74,8 @@ const utc = (ms) => new Date(ms).toISOString().slice(11, 16);
|
|
|
71
74
|
export function modeLine(mode, kind, { at = null, now = 0, resolved = false, outcome = null, replayAt = null, action = null, fix = false } = {}) {
|
|
72
75
|
// behold#631: a "Waiting on…" modal says what it waits on in its title; it has no mode line.
|
|
73
76
|
if (kind === "waiting") return null;
|
|
77
|
+
// behold#757: a highlight's kicker says what it is, in a replay as live: the replay's banner says which run it is.
|
|
78
|
+
if (kind === "highlight") return HIGHLIGHT_KICKER;
|
|
74
79
|
if (mode === "replay") return `Replay of the run at ${utc(Number.isFinite(replayAt) ? replayAt : now)} UTC`;
|
|
75
80
|
if (mode !== "narrated") return null;
|
|
76
81
|
if (resolved) return outcome ? `Live · ${outcome}` : "Live";
|
|
@@ -111,6 +116,11 @@ export const MODAL_STYLE = `
|
|
|
111
116
|
.eh-modal { position: relative; width: min(36em, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; padding: 1em 1.2em 1.1em; border-radius: 12px; background: var(--surface-pane-b, var(--panel)); color: var(--fg);
|
|
112
117
|
border: 2px solid var(--bar, var(--focus)); box-shadow: 0 16px 48px color-mix(in srgb, var(--shadow) 80%, transparent); font-size: 1.05em; }
|
|
113
118
|
.eh-modal-held { --bar: var(--bar-foreign, var(--foreign)); } .eh-modal-failed { --bar: var(--bar-degraded, var(--degraded)); } .eh-modal-applied { --bar: var(--bar-managed, var(--managed)); }
|
|
119
|
+
/* behold#757: a step's highlight: the runtime bar's tone (no state's), a kicker in it, and its body set to be read. */
|
|
120
|
+
.eh-modal-highlight { --bar: var(--bar-runtime, var(--runtime, var(--focus))); background: linear-gradient(color-mix(in srgb, var(--bar) 9%, transparent), transparent 5em), var(--surface-pane-b, var(--panel)); box-shadow: inset 5px 0 0 var(--bar), 0 16px 48px color-mix(in srgb, var(--shadow) 80%, transparent); }
|
|
121
|
+
.eh-modal-highlight .eh-modal-mode { text-transform: uppercase; letter-spacing: 0.08em; }
|
|
122
|
+
.eh-modal-highlight .eh-modal-mode::before { content: "\\2605"; margin-right: 0.45em; }
|
|
123
|
+
.eh-modal-highlight .eh-modal-line { color: var(--fg); line-height: 1.45; }
|
|
114
124
|
.eh-modal-close { position: absolute; top: 0.4em; right: 0.5em; font-size: 1.3em; background: transparent; border: 0; color: var(--muted); cursor: pointer; }
|
|
115
125
|
.eh-modal-mode { margin: 0 2em 0.3em 0; font: 600 0.8em var(--font-ui); font-variant-numeric: tabular-nums; color: var(--bar, var(--muted)); }
|
|
116
126
|
.eh-modal-title { margin: 0 0 0.5em; font-size: 1.35em; }
|
|
@@ -257,7 +267,8 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
|
|
|
257
267
|
box.appendChild(bar);
|
|
258
268
|
if (data.progress.words) box.appendChild(el("p", "eh-modal-note", data.progress.words));
|
|
259
269
|
}
|
|
260
|
-
|
|
270
|
+
// behold#757: a highlight is words to read: no command, no button.
|
|
271
|
+
if (kind === "waiting" || kind === "highlight") return;
|
|
261
272
|
const routed = mode === "live" && approveRoute(data.gate);
|
|
262
273
|
// The panel, when there is one, already carries the command.
|
|
263
274
|
if (data.command && !routed && !(data.panel && mode !== "live")) {
|
|
@@ -338,6 +349,8 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
|
|
|
338
349
|
const timer = setTimer(tick, 250);
|
|
339
350
|
// The result needs no event to wait for: it closes on its own after its time.
|
|
340
351
|
if (kind === "applied" && mode !== "live") st.closeAt = now() + MODAL_CLOSE_MS;
|
|
352
|
+
// behold#757: so does a highlight, after its own time (`closeAfter`, ms); hovered, it holds as any modal does.
|
|
353
|
+
if (Number.isFinite(data.closeAfter)) st.closeAt = now() + data.closeAfter;
|
|
341
354
|
render();
|
|
342
355
|
placeClear();
|
|
343
356
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { demoFrameOk } from "./kiosk.js";
|
|
3
|
+
import { CHANT_DEMO_READS, TERRAGUCCI_READS } from "./kiosk-source.js";
|
|
4
|
+
|
|
5
|
+
// behold#765: /chant-fanout under --chant-demo reads chant's records, so there is
|
|
6
|
+
// no terragucci answer naming the served repo, and a behold serving one checkout
|
|
7
|
+
// sends no viewRepos for repoParam to match. frameOk was false, the body took
|
|
8
|
+
// k-nograph and the graph pane folded away while the frame held all 15 cards.
|
|
9
|
+
const REPO = "chant-demo/fan-out-estate";
|
|
10
|
+
|
|
11
|
+
describe("whether chant's demo shows its graph (behold#765)", () => {
|
|
12
|
+
it("one checkout served: the operator paired it with the demo, so the frame is the demo's repo", () => {
|
|
13
|
+
expect(demoFrameOk(CHANT_DEMO_READS.own, true, REPO, null)).toBe(true);
|
|
14
|
+
// Before the step names a repo too.
|
|
15
|
+
expect(demoFrameOk(CHANT_DEMO_READS.own, true, null, null)).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
it("several served (--repos): only when one of them is the step's repo", () => {
|
|
18
|
+
expect(demoFrameOk(CHANT_DEMO_READS.own, false, REPO, ["fan-out-estate", "demo-fanout"])).toBe(true);
|
|
19
|
+
expect(demoFrameOk(CHANT_DEMO_READS.own, false, REPO, ["demo-fanout"])).toBe(false);
|
|
20
|
+
});
|
|
21
|
+
it("not before /api/project has said which", () => {
|
|
22
|
+
expect(demoFrameOk(CHANT_DEMO_READS.own, null, REPO, null)).toBe(false);
|
|
23
|
+
});
|
|
24
|
+
it("terragucci's loop keeps its own gate (its answer's project, or the served repo by name)", () => {
|
|
25
|
+
expect(demoFrameOk(TERRAGUCCI_READS.own, true, REPO, null)).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -10,13 +10,16 @@
|
|
|
10
10
|
// Inspect and by the caption in Watch; a chip, pointed at or clicked,
|
|
11
11
|
// shows its tip and its lights again;
|
|
12
12
|
// - a critical event (a wave held, a wave failed, the cycle applied) opens
|
|
13
|
-
// web/event-help-modal.js, narrated (or replayed on a tool's page)
|
|
13
|
+
// web/event-help-modal.js, narrated (or replayed on a tool's page);
|
|
14
|
+
// - behold#757: a step whose driver wrote a `highlight` (what is special about
|
|
15
|
+
// it) opens it in Watch as a modal of its own, off the cards, when the step
|
|
16
|
+
// arrives, for HIGHLIGHT_MS or until the step goes.
|
|
14
17
|
//
|
|
15
18
|
// The Tips switch, on by default and kept per viewer, turns the tips, the
|
|
16
19
|
// lights, the glows and the modals off; the trail stays, since it is the
|
|
17
20
|
// record.
|
|
18
21
|
|
|
19
|
-
import { EH_STORE, LATE_ORDER, TIP_MS, cycleFacts, storyKey, ehSnapshot, ehStore, ehStored, modalQueue, modalShownElsewhere, newEvents, storyTrail, tipsQueue, tipsShown } from "./kiosk-event-help.js";
|
|
22
|
+
import { EH_STORE, HIGHLIGHT_MS, LATE_ORDER, TIP_MS, cycleFacts, storyKey, ehSnapshot, ehStore, ehStored, highlightOpens, highlightShown, highlightTurn, modalQueue, modalShownElsewhere, newEvents, storyTrail, tipsQueue, tipsShown } from "./kiosk-event-help.js";
|
|
20
23
|
|
|
21
24
|
/** How long after the page opens (or the cycle turns) what arrives is the story so far, not news: the reads land one by one. */
|
|
22
25
|
export const SETTLE_MS = 8_000;
|
|
@@ -446,11 +449,23 @@ export function startEventHelp({ doc = document, store = null, switchHost = null
|
|
|
446
449
|
title: `Waiting on ${w.what}`,
|
|
447
450
|
lines: w.why ? [{ text: w.why }] : [],
|
|
448
451
|
progress: { fraction: w.fraction, words: w.words },
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
452
|
+
...offCards(h),
|
|
453
|
+
});
|
|
454
|
+
/**
|
|
455
|
+
* Where a modal about no one card goes (the "Waiting on…" one, a step's highlight): never over a card, since any
|
|
456
|
+
* card of the graph is to stay in view. Then, where it can, off the graph altogether (its wave boxes and the space
|
|
457
|
+
* between them, where a reach is drawn): the space beside it first. behold#744: nor over a read pill the frame
|
|
458
|
+
* shows; behold#748's outside mark sits in the pills' layer, so it is kept clear of the same way.
|
|
459
|
+
* behold#757: each read of the cards is of what the frame says now: a highlight opens with its step, often
|
|
460
|
+
* before the frame has said where its cards are.
|
|
461
|
+
*/
|
|
462
|
+
const offCards = (at) => ({
|
|
463
|
+
avoid: () => {
|
|
464
|
+
const h = (get && get()) || at;
|
|
465
|
+
return [...Object.keys((h.boxes && h.boxes.roots) || {}).map((r) => fromFrame(h, h.boxes.roots[r])).filter(Boolean), ...pillRects(h)];
|
|
466
|
+
},
|
|
453
467
|
prefer: () => {
|
|
468
|
+
const h = (get && get()) || at;
|
|
454
469
|
const waves = Object.values((h.boxes && h.boxes.waves) || {}).map((b) => fromFrame(h, b)).filter(Boolean);
|
|
455
470
|
if (!waves.length) return [];
|
|
456
471
|
const left = Math.min(...waves.map((b) => b.left));
|
|
@@ -459,7 +474,7 @@ export function startEventHelp({ doc = document, store = null, switchHost = null
|
|
|
459
474
|
const bottom = Math.max(...waves.map((b) => b.top + b.height));
|
|
460
475
|
return [{ left, top, width: right - left, height: bottom - top }];
|
|
461
476
|
},
|
|
462
|
-
bounds: () => graphArea(
|
|
477
|
+
bounds: () => graphArea((get && get()) || at),
|
|
463
478
|
});
|
|
464
479
|
const openWaiting = (w, h) => {
|
|
465
480
|
const d = h.demo;
|
|
@@ -467,6 +482,14 @@ export function startEventHelp({ doc = document, store = null, switchHost = null
|
|
|
467
482
|
st.modal = { api, event: { kind: "waiting", subjects: { roots: [], wave: null } }, kind: "waiting", key: w.key, step: d ? d.step : null, cycle: d ? d.cycle : null, pull: d ? d.pull : null };
|
|
468
483
|
if (st.story) for (const n of st.nodes.values()) n.style.visibility = "hidden";
|
|
469
484
|
};
|
|
485
|
+
/** behold#757: a step's highlight, as a modal off the cards: up HIGHLIGHT_MS (longer while hovered), or until its step goes. */
|
|
486
|
+
const openHighlight = (hl, h) => {
|
|
487
|
+
const d = h.demo;
|
|
488
|
+
const data = { title: hl.title, lines: [{ text: hl.body }], closeAfter: HIGHLIGHT_MS, ...offCards(h) };
|
|
489
|
+
const api = openEventModal(modalHost, { mode: h.replay ? "replay" : "narrated", kind: "highlight", data, doc, now, reduced: reduced(), onClose: () => (st.modal = null) });
|
|
490
|
+
st.modal = { api, event: { kind: "highlight", subjects: { roots: [], wave: null } }, kind: "highlight", key: hl.key, step: d ? d.step : null, cycle: d ? d.cycle : null, pull: d ? d.pull : null };
|
|
491
|
+
for (const n of st.nodes.values()) n.style.visibility = "hidden";
|
|
492
|
+
};
|
|
470
493
|
/** The modal's real event: the approval landed, the waves ran again, the cycle moved on. */
|
|
471
494
|
const settleModal = (h, facts) => {
|
|
472
495
|
const m = st.modal;
|
|
@@ -524,6 +547,11 @@ export function startEventHelp({ doc = document, store = null, switchHost = null
|
|
|
524
547
|
settleModal(h, facts);
|
|
525
548
|
// A modal Inspect opened goes when the viewer turns to Watch on a held small stage, where nothing overlays the graph.
|
|
526
549
|
if (st.modal && modalShownElsewhere(st.modal.event, { watch: !!h.watch, held: !!h.held })) st.modal.api.close();
|
|
550
|
+
// behold#757: a step's highlight is read on every look (Tips off or not, so turning them on mid-step still shows it,
|
|
551
|
+
// and one the driver adds partway through a step shows when it appears); its modal goes with its step, or when the
|
|
552
|
+
// viewer turns to Inspect: it is Watch's.
|
|
553
|
+
st.hl = highlightTurn(st.hl, h.demo);
|
|
554
|
+
if (st.modal && st.modal.kind === "highlight" && (st.modal.key !== st.hl.step || !h.watch)) st.modal.api.close();
|
|
527
555
|
if (!st.on) return;
|
|
528
556
|
// behold#631: a new pull request of a chant cycle (the fix) starts with no tip of the one before.
|
|
529
557
|
if (h.chant && st.tipsPull !== undefined && st.tipsPull !== h.demo.pull) {
|
|
@@ -555,6 +583,13 @@ export function startEventHelp({ doc = document, store = null, switchHost = null
|
|
|
555
583
|
if (news.length && h.waiting) st.waitingHold = { key: h.waiting.key, until: now() + 4_000 };
|
|
556
584
|
st.modal.api.close();
|
|
557
585
|
}
|
|
586
|
+
// behold#757: the step's highlight, once per cycle, step and title, before the critical modals: one due now waits
|
|
587
|
+
// behind it in the queue, and opens when it closes if its step is still the step.
|
|
588
|
+
if (highlightOpens({ pending: st.hl.pending, on: st.on, watch: !!h.watch, held: !!h.held, modal: st.modal ? st.modal.kind : null })) {
|
|
589
|
+
if (st.modal) st.modal.api.close();
|
|
590
|
+
openHighlight(st.hl.pending, h);
|
|
591
|
+
st.hl = highlightShown(st.hl);
|
|
592
|
+
}
|
|
558
593
|
// behold#631: a chant repo's approval is the card beside the graph; a modal over it would hide it, so its hold opens none.
|
|
559
594
|
// Its result is the Applied card beside the graph; a modal would say it twice, over the cards.
|
|
560
595
|
// On a held small stage in Watch no modal opens: nothing overlays the graph there, and the caption says each step.
|
package/web/kiosk-event-help.js
CHANGED
|
@@ -340,3 +340,76 @@ export function modalQueue(state, { add = [], now = 0, lastInput = -Infinity, qu
|
|
|
340
340
|
if (open || !queue.length || now - lastInput < quietMs) return { next: null, waiting: queue };
|
|
341
341
|
return { next: queue[0], waiting: queue.slice(1) };
|
|
342
342
|
}
|
|
343
|
+
|
|
344
|
+
// ---------------------------------------------------------------------------
|
|
345
|
+
// behold#757: a step's highlight. The scenario's driver says what is special
|
|
346
|
+
// about a step (demo.json's or demo-step/v1's `highlight: { title, body }`,
|
|
347
|
+
// terragucci#1176, chant#4106) on the step where it happens; Watch opens it as
|
|
348
|
+
// a modal once per cycle, step and title. The driver writes a step more than
|
|
349
|
+
// once (an apply, its holds) with the same highlight, which opens once; a step
|
|
350
|
+
// can gain one partway through (choudoufu's operator, on one write of the
|
|
351
|
+
// applying step), which opens when it first appears; and a replay that loops
|
|
352
|
+
// round to its step opens it again.
|
|
353
|
+
|
|
354
|
+
/** How long a highlight stays up, longer than a tip: it is a paragraph to read. It goes sooner when its step does. */
|
|
355
|
+
export const HIGHLIGHT_MS = 12_000;
|
|
356
|
+
|
|
357
|
+
/** A demo step's highlight, `{ title, body }`, or null unless both are non-empty strings (the server's floor, again). */
|
|
358
|
+
export function stepHighlight(demo) {
|
|
359
|
+
const h = demo && demo.highlight;
|
|
360
|
+
if (!h || typeof h !== "object" || Array.isArray(h)) return null;
|
|
361
|
+
const title = typeof h.title === "string" ? h.title.trim() : "";
|
|
362
|
+
const body = typeof h.body === "string" ? h.body.trim() : "";
|
|
363
|
+
return title && body ? { title, body } : null;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/** The step a highlight's modal stays with: its cycle, beat, pull request and step. It closes when the step moves on. */
|
|
367
|
+
export function highlightStepKey(demo) {
|
|
368
|
+
if (!demo) return null;
|
|
369
|
+
return [demo.cycle, demo.beat || "", demo.pull === null || demo.pull === undefined ? "" : demo.pull, demo.step].join("|");
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/** What a highlight opens once for: its cycle (and beat), its step and its title (terragucci#1176). */
|
|
373
|
+
export const highlightId = (demo, h) => [demo.cycle, demo.beat || "", demo.step, h.title].join("|");
|
|
374
|
+
|
|
375
|
+
/** When a step was written: a replay's step its `at`, a live one its `started_at`. A time that goes back is a replay looping round. */
|
|
376
|
+
const writtenAt = (demo) => {
|
|
377
|
+
const t = Date.parse((demo && (demo.at || demo.started_at)) || "");
|
|
378
|
+
return Number.isFinite(t) ? t : null;
|
|
379
|
+
};
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* The highlight's state after a look at `demo`: `{ step, seen, at, pending }`.
|
|
383
|
+
* `pending` is the step's highlight while it has not opened (`{ id, key,
|
|
384
|
+
* title, body }`), to open once nothing stops it; `seen` the ids opened this
|
|
385
|
+
* pass of the cycle, so a highlight written again is not opened again. A step
|
|
386
|
+
* that goes takes a pending highlight with it; a replay looping round (its
|
|
387
|
+
* step's time going back) starts a new pass.
|
|
388
|
+
*/
|
|
389
|
+
export function highlightTurn(state, demo) {
|
|
390
|
+
const at = writtenAt(demo);
|
|
391
|
+
const looped = !!state && state.at !== null && at !== null && at < state.at;
|
|
392
|
+
const seen = !state || looped ? new Set() : state.seen;
|
|
393
|
+
const step = highlightStepKey(demo);
|
|
394
|
+
const h = stepHighlight(demo);
|
|
395
|
+
const id = h ? highlightId(demo, h) : null;
|
|
396
|
+
const kept = state && !looped && state.pending && state.pending.id === id && state.step === step ? state.pending : null;
|
|
397
|
+
const pending = h && !seen.has(id) ? kept || { id, key: step, ...h } : null;
|
|
398
|
+
if (state && !looped && state.step === step && state.pending === pending && state.at === at) return state;
|
|
399
|
+
return { step, seen, at, pending };
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** The state once its pending highlight has opened: seen for the rest of the pass. */
|
|
403
|
+
export function highlightShown(state) {
|
|
404
|
+
if (!state || !state.pending) return state;
|
|
405
|
+
return { ...state, seen: new Set([...state.seen, state.pending.id]), pending: null };
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Whether a pending highlight opens now: Tips on, in Watch, not on a held
|
|
410
|
+
* small stage (nothing overlays the graph there), and no modal up but a
|
|
411
|
+
* "Waiting on…" one, which it replaces. A critical modal up keeps it waiting.
|
|
412
|
+
*/
|
|
413
|
+
export function highlightOpens({ pending = null, on = true, watch = false, held = false, modal = null } = {}) {
|
|
414
|
+
return !!pending && !!on && !!watch && !held && (!modal || modal === "waiting");
|
|
415
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
// behold#757: a step's highlight, what is special about it in the driver's
|
|
2
|
+
// words, opened in Watch as a modal when its step arrives: once per arrival,
|
|
3
|
+
// at the same moment in a replay, never with Tips off, and nothing at all for
|
|
4
|
+
// a step without one.
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { HIGHLIGHT_KICKER, modeLine, openEventModal } from "./event-help-modal.js";
|
|
7
|
+
import { HIGHLIGHT_MS, ehStore, highlightOpens, highlightShown, highlightStepKey, highlightTurn, stepHighlight } from "./kiosk-event-help.js";
|
|
8
|
+
import { startEventHelp } from "./kiosk-event-help-ui.js";
|
|
9
|
+
import { replayAt, scrubDemo } from "./kiosk-vendor.js";
|
|
10
|
+
|
|
11
|
+
const HL = { title: "Same orchestration as the commercial platforms", body: "Fifteen OpenTofu states, applied in dependency order. This is the stack-dependency orchestration Terraform automation platforms sell, run here by terragucci on plain OpenTofu and Forgejo." };
|
|
12
|
+
const demo = (step, more = {}) => ({ cycle: 9, scenario: "fan-out", title: "t", step, label: `the ${step} line`, started_at: "2026-10-18T00:00:00Z", next: null, pull: 3, commit: null, ...more });
|
|
13
|
+
|
|
14
|
+
describe("highlight: the floor", () => {
|
|
15
|
+
it("is a title and a body, both non-empty strings, else nothing", () => {
|
|
16
|
+
expect(stepHighlight(demo("failed", { highlight: HL }))).toEqual(HL);
|
|
17
|
+
for (const v of [null, undefined, "x", [], {}, { title: "t" }, { title: "", body: "b" }, { title: "t", body: " " }, { title: 2, body: "b" }]) expect(stepHighlight(demo("failed", { highlight: v }))).toBeNull();
|
|
18
|
+
expect(stepHighlight(null)).toBeNull();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe("highlight: once per cycle, step and title (terragucci#1176)", () => {
|
|
23
|
+
it("comes with its step, once, and goes with it", () => {
|
|
24
|
+
let s = highlightTurn(null, demo("applying"));
|
|
25
|
+
expect(s.pending).toBeNull();
|
|
26
|
+
s = highlightTurn(s, demo("failed", { highlight: HL }));
|
|
27
|
+
expect(s.pending).toMatchObject({ key: highlightStepKey(demo("failed")), ...HL });
|
|
28
|
+
// Opened: the same step looked at again brings nothing back.
|
|
29
|
+
s = highlightShown(s);
|
|
30
|
+
expect(s.pending).toBeNull();
|
|
31
|
+
expect(highlightTurn(s, demo("failed", { highlight: HL }))).toBe(s);
|
|
32
|
+
// A step that goes takes a highlight not yet opened with it.
|
|
33
|
+
const waiting = highlightTurn(null, demo("failed", { highlight: HL }));
|
|
34
|
+
expect(highlightTurn(waiting, demo("resumed")).pending).toBeNull();
|
|
35
|
+
});
|
|
36
|
+
it("opens once though the driver writes its step again, around a hold", () => {
|
|
37
|
+
const w = (step, t) => demo(step, { started_at: `2026-10-18T00:00:${t}Z`, highlight: step === "applying" ? HL : null });
|
|
38
|
+
let s = highlightShown(highlightTurn(null, w("applying", 10)));
|
|
39
|
+
s = highlightTurn(s, w("waiting", 20));
|
|
40
|
+
s = highlightTurn(s, w("applying", 30));
|
|
41
|
+
expect(s.pending).toBeNull();
|
|
42
|
+
});
|
|
43
|
+
it("opens when a step gains one partway through, as choudoufu's operator's apply does", () => {
|
|
44
|
+
let s = highlightTurn(null, demo("applying", { started_at: "2026-10-18T00:00:10Z" }));
|
|
45
|
+
expect(s.pending).toBeNull();
|
|
46
|
+
s = highlightTurn(s, demo("applying", { started_at: "2026-10-18T00:00:10Z", highlight: HL }));
|
|
47
|
+
expect(s.pending).toMatchObject(HL);
|
|
48
|
+
});
|
|
49
|
+
it("a fix's step opens its own title, not the same one again; the next cycle opens it again", () => {
|
|
50
|
+
const opened = highlightShown(highlightTurn(null, demo("planned", { highlight: HL })));
|
|
51
|
+
expect(highlightTurn(opened, demo("planned", { pull: 4, highlight: HL })).pending).toBeNull();
|
|
52
|
+
expect(highlightTurn(opened, demo("planned", { pull: 4, highlight: { title: "Only what was blocked", body: "b" } })).pending).toMatchObject({ title: "Only what was blocked" });
|
|
53
|
+
expect(highlightTurn(opened, demo("planned", { cycle: 10, highlight: HL })).pending).not.toBeNull();
|
|
54
|
+
});
|
|
55
|
+
it("opens in Watch with Tips on, over a Waiting modal but not over a critical one, nor on a held small stage", () => {
|
|
56
|
+
const pending = { key: "k", ...HL };
|
|
57
|
+
expect(highlightOpens({ pending, on: true, watch: true })).toBe(true);
|
|
58
|
+
expect(highlightOpens({ pending, on: true, watch: true, modal: "waiting" })).toBe(true);
|
|
59
|
+
expect(highlightOpens({ pending, on: false, watch: true })).toBe(false);
|
|
60
|
+
expect(highlightOpens({ pending, on: true, watch: false })).toBe(false);
|
|
61
|
+
expect(highlightOpens({ pending, on: true, watch: true, held: true })).toBe(false);
|
|
62
|
+
expect(highlightOpens({ pending, on: true, watch: true, modal: "failed" })).toBe(false);
|
|
63
|
+
expect(highlightOpens({ pending: null, on: true, watch: true })).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
it("in a replay, arrives when the replay's clock reaches its step, and again each time the replay loops round", () => {
|
|
66
|
+
const steps = [demo("applying", { at: "2026-10-18T00:00:00Z" }), demo("failed", { at: "2026-10-18T00:00:20Z", highlight: HL }), demo("reset", { at: "2026-10-18T00:00:40Z" })];
|
|
67
|
+
let s = null;
|
|
68
|
+
const opened = [];
|
|
69
|
+
for (let t = 0; t < 130_000; t += 1_000) {
|
|
70
|
+
const d = steps[replayAt(steps, t).index];
|
|
71
|
+
s = highlightTurn(s, d);
|
|
72
|
+
if (s.pending) {
|
|
73
|
+
opened.push(t);
|
|
74
|
+
s = highlightShown(s);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const loop = replayAt(steps, 0).loop;
|
|
78
|
+
expect(opened).toEqual([20_000, 20_000 + loop, 20_000 + 2 * loop].filter((t) => t < 130_000));
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe("highlight: on a tool's page", () => {
|
|
83
|
+
it("goes whole when it names a rival of the page's tool, as the step's line does", () => {
|
|
84
|
+
expect(scrubDemo(demo("failed", { highlight: HL }), "tofu-fanout").highlight).toEqual(HL);
|
|
85
|
+
expect(scrubDemo(demo("failed", { highlight: HL }), "chant-fanout").highlight).toBeNull();
|
|
86
|
+
expect("highlight" in scrubDemo(demo("failed"), "tofu-fanout")).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
/** Just enough of a DOM for Tips and its modal. */
|
|
91
|
+
function fakeDoc() {
|
|
92
|
+
const listeners = {};
|
|
93
|
+
const make = (tag) => {
|
|
94
|
+
const n = {
|
|
95
|
+
tagName: tag.toUpperCase(),
|
|
96
|
+
children: [],
|
|
97
|
+
handlers: {},
|
|
98
|
+
textContent: "",
|
|
99
|
+
className: "",
|
|
100
|
+
dataset: {},
|
|
101
|
+
style: { setProperty() {} },
|
|
102
|
+
classList: { toggle() {}, add() {}, remove() {} },
|
|
103
|
+
appendChild(c) {
|
|
104
|
+
c.parent = n;
|
|
105
|
+
n.children.push(c);
|
|
106
|
+
return c;
|
|
107
|
+
},
|
|
108
|
+
append(...cs) {
|
|
109
|
+
cs.forEach((c) => typeof c === "object" && n.appendChild(c));
|
|
110
|
+
},
|
|
111
|
+
prepend(c) {
|
|
112
|
+
n.appendChild(c);
|
|
113
|
+
},
|
|
114
|
+
replaceChildren() {
|
|
115
|
+
n.children = [];
|
|
116
|
+
},
|
|
117
|
+
setAttribute() {},
|
|
118
|
+
addEventListener(ev, fn) {
|
|
119
|
+
(n.handlers[ev] ||= []).push(fn);
|
|
120
|
+
},
|
|
121
|
+
querySelector: () => null,
|
|
122
|
+
remove() {
|
|
123
|
+
if (n.parent) n.parent.children = n.parent.children.filter((x) => x !== n);
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
return n;
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
createElement: make,
|
|
130
|
+
head: make("head"),
|
|
131
|
+
body: make("body"),
|
|
132
|
+
getElementById: () => null,
|
|
133
|
+
querySelectorAll: () => [],
|
|
134
|
+
addEventListener: (ev, fn) => ((listeners[ev] ||= []).push(fn)),
|
|
135
|
+
removeEventListener() {},
|
|
136
|
+
fire: (ev, e) => (listeners[ev] || []).forEach((fn) => fn(e)),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
const all = (n) => [n, ...n.children.flatMap(all)];
|
|
140
|
+
const find = (root, cls) => all(root).find((n) => n.className && n.className.split(" ").includes(cls));
|
|
141
|
+
/** The Tips switch's shelf, on or off (event-help-store.js). */
|
|
142
|
+
const shelf = (on = true) => {
|
|
143
|
+
const m = new Map();
|
|
144
|
+
ehStore({ setItem: (k, v) => m.set(k, v) }, on);
|
|
145
|
+
return { getItem: (k) => (m.has(k) ? m.get(k) : null), setItem: (k, v) => m.set(k, v) };
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
describe("highlight: Tips draws it", () => {
|
|
149
|
+
let t;
|
|
150
|
+
beforeEach(() => {
|
|
151
|
+
vi.useFakeTimers();
|
|
152
|
+
t = 1_000_000;
|
|
153
|
+
});
|
|
154
|
+
afterEach(() => vi.useRealTimers());
|
|
155
|
+
const start = ({ on = true, watch = true, replay = false } = {}) => {
|
|
156
|
+
const doc = fakeDoc();
|
|
157
|
+
const view = { demo: demo("applying"), watch, replay };
|
|
158
|
+
const api = startEventHelp({ doc, store: shelf(on), tipsHost: doc.body, modalHost: doc.body, now: () => t, get: () => ({ ...view, strip: null, stripReady: true }), reduced: () => true });
|
|
159
|
+
const modal = () => find(doc.body, "eh-modal");
|
|
160
|
+
const step = (d, ms = 0) => {
|
|
161
|
+
view.demo = d;
|
|
162
|
+
t += ms;
|
|
163
|
+
vi.advanceTimersByTime(ms);
|
|
164
|
+
api.tick();
|
|
165
|
+
};
|
|
166
|
+
return { api, doc, view, modal, step };
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
it("opens with its step in Watch, with its kicker, title and body, and no button", () => {
|
|
170
|
+
const k = start();
|
|
171
|
+
k.step(demo("applying"));
|
|
172
|
+
expect(k.modal()).toBeUndefined();
|
|
173
|
+
k.step(demo("failed", { highlight: HL }), 1_000);
|
|
174
|
+
const m = k.modal();
|
|
175
|
+
expect(m.className).toContain("eh-modal-highlight");
|
|
176
|
+
expect(find(m, "eh-modal-mode").textContent).toBe(HIGHLIGHT_KICKER);
|
|
177
|
+
expect(find(m, "eh-modal-title").textContent).toBe(HL.title);
|
|
178
|
+
expect(find(m, "eh-modal-line").textContent).toBe(HL.body);
|
|
179
|
+
expect(find(m, "eh-modal-act")).toBeUndefined();
|
|
180
|
+
expect(k.api.state.modal.kind).toBe("highlight");
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("stays HIGHLIGHT_MS, then goes, and does not come back for the same step", () => {
|
|
184
|
+
const k = start();
|
|
185
|
+
k.step(demo("failed", { highlight: HL }));
|
|
186
|
+
k.step(demo("failed", { highlight: HL }), HIGHLIGHT_MS - 1_000);
|
|
187
|
+
expect(k.modal()).toBeDefined();
|
|
188
|
+
k.step(demo("failed", { highlight: HL }), 1_500);
|
|
189
|
+
expect(k.modal()).toBeUndefined();
|
|
190
|
+
k.step(demo("failed", { highlight: HL }), 5_000);
|
|
191
|
+
expect(k.modal()).toBeUndefined();
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
it("goes with its step, and closes with Esc", () => {
|
|
195
|
+
const k = start();
|
|
196
|
+
k.step(demo("failed", { highlight: HL }));
|
|
197
|
+
k.step(demo("resumed"), 2_000);
|
|
198
|
+
expect(k.modal()).toBeUndefined();
|
|
199
|
+
k.step(demo("applied", { highlight: HL }), 2_000);
|
|
200
|
+
expect(k.modal()).toBeDefined();
|
|
201
|
+
k.doc.fire("keydown", { key: "Escape" });
|
|
202
|
+
expect(k.modal()).toBeUndefined();
|
|
203
|
+
k.step(demo("applied", { highlight: HL }), 1_000);
|
|
204
|
+
expect(k.modal()).toBeUndefined();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("shows nothing with Tips off, nor in Inspect, nor for a step without one", () => {
|
|
208
|
+
const off = start({ on: false });
|
|
209
|
+
off.step(demo("failed", { highlight: HL }));
|
|
210
|
+
expect(off.modal()).toBeUndefined();
|
|
211
|
+
const inspect = start({ watch: false });
|
|
212
|
+
inspect.step(demo("failed", { highlight: HL }));
|
|
213
|
+
expect(inspect.modal()).toBeUndefined();
|
|
214
|
+
const none = start();
|
|
215
|
+
none.step(demo("failed"));
|
|
216
|
+
none.step(demo("failed", { highlight: { title: "", body: "b" } }), 1_000);
|
|
217
|
+
expect(none.modal()).toBeUndefined();
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it("in a replay, opens as the replay reaches its step, marked a replay", () => {
|
|
221
|
+
const k = start({ replay: true });
|
|
222
|
+
k.step(demo("applying"));
|
|
223
|
+
expect(k.modal()).toBeUndefined();
|
|
224
|
+
k.step(demo("failed", { highlight: HL }), 20_000);
|
|
225
|
+
expect(k.modal().className).toContain("eh-mode-replay");
|
|
226
|
+
expect(find(k.modal(), "eh-modal-mode").textContent).toBe(HIGHLIGHT_KICKER);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
describe("highlight: the modal", () => {
|
|
231
|
+
it("says its kicker in every mode", () => {
|
|
232
|
+
for (const mode of ["narrated", "replay", "live"]) expect(modeLine(mode, "highlight", {})).toBe(HIGHLIGHT_KICKER);
|
|
233
|
+
});
|
|
234
|
+
it("closes after `closeAfter`, and holds while hovered", () => {
|
|
235
|
+
let now = 0;
|
|
236
|
+
const timers = [];
|
|
237
|
+
const doc = fakeDoc();
|
|
238
|
+
const m = openEventModal(doc.body, { mode: "narrated", kind: "highlight", data: { title: HL.title, lines: [{ text: HL.body }], closeAfter: 12_000 }, doc, now: () => now, setTimer: (fn) => timers.push(fn), clearTimer() {} });
|
|
239
|
+
const box = find(doc.body, "eh-modal");
|
|
240
|
+
box.handlers.pointerenter.forEach((fn) => fn());
|
|
241
|
+
now = 13_000;
|
|
242
|
+
timers.forEach((fn) => fn());
|
|
243
|
+
expect(m.state.closed).toBe(false);
|
|
244
|
+
box.handlers.pointerleave.forEach((fn) => fn());
|
|
245
|
+
now = 16_000;
|
|
246
|
+
timers.forEach((fn) => fn());
|
|
247
|
+
expect(m.state.closed).toBe(true);
|
|
248
|
+
});
|
|
249
|
+
});
|
package/web/kiosk-vendor.js
CHANGED
|
@@ -247,6 +247,8 @@ export function scrubDemo(demo, tool) {
|
|
|
247
247
|
label: keep(demo.label) ?? "",
|
|
248
248
|
about: about && Object.keys(about).length ? about : null,
|
|
249
249
|
next: demo.next ? { ...demo.next, action: keep(demo.next.action) ?? "the next step" } : null,
|
|
250
|
+
// behold#757: a step's highlight goes whole when its title or body names a rival: half of it would read wrong.
|
|
251
|
+
...(demo.highlight ? { highlight: namesOther(demo.highlight.title, tool) || namesOther(demo.highlight.body, tool) ? null : demo.highlight } : {}),
|
|
250
252
|
};
|
|
251
253
|
}
|
|
252
254
|
|
package/web/kiosk.js
CHANGED
|
@@ -722,6 +722,18 @@ export function readStored(store) {
|
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
724
|
|
|
725
|
+
/**
|
|
726
|
+
* behold#765: whether chant's demo (`--chant-demo`, the page's own reads) has its graph on this behold. A behold
|
|
727
|
+
* serving one checkout (/api/project names no `viewRepos`) was paired with the demo by its operator, so the frame is
|
|
728
|
+
* the demo's repo; one serving several (`--repos`) draws it when it serves the step's repo by name. `single` is null
|
|
729
|
+
* until /api/project answers. Neither terragucci's answer nor a report naming the repo is asked for: there is none.
|
|
730
|
+
*/
|
|
731
|
+
export function demoFrameOk(own, single, repo, viewRepos) {
|
|
732
|
+
if (!own) return false;
|
|
733
|
+
if (single === true) return true;
|
|
734
|
+
return !!repoParam(repo, viewRepos);
|
|
735
|
+
}
|
|
736
|
+
|
|
725
737
|
/** Whether a tool's pipeline writes no terragucci reports or run view (VENDORS' `reports: false`). */
|
|
726
738
|
export function reportless(vendor) {
|
|
727
739
|
return !!vendor && vendor.reports === false;
|
|
@@ -1485,6 +1497,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1485
1497
|
/** behold#571: the frame and the plan's facts are the served repo's, so a tool's page shows them only for its own repo. */
|
|
1486
1498
|
const frameOk = () => {
|
|
1487
1499
|
if (!vendor) return true;
|
|
1500
|
+
// behold#765: chant's demo has no terragucci answer to name its repo, and one checkout served sends no viewRepos.
|
|
1501
|
+
if (demoFrameOk(reads.own, s.single, s.repo, s.viewRepos)) return true;
|
|
1488
1502
|
// Before the tool's first cycle: its repo's checkout, when this behold serves it.
|
|
1489
1503
|
if (s.mode === "none") return !!notRunRepo(tool, s.viewRepos) && s.aimed === notRunRepo(tool, s.viewRepos);
|
|
1490
1504
|
if (servesRepo(s.answer && !s.answer.error ? s.answer.project : null, s.repo)) return true;
|
|
@@ -1496,6 +1510,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1496
1510
|
// graph's reads from the checkout of the repo the page is about, asked by
|
|
1497
1511
|
// name. `viewRepos` is what it serves, `aimed` the repo the reads are for.
|
|
1498
1512
|
s.viewRepos = null;
|
|
1513
|
+
// behold#765: whether this behold serves one checkout (no viewRepos), null until /api/project answers.
|
|
1514
|
+
s.single = null;
|
|
1499
1515
|
s.aimed = null;
|
|
1500
1516
|
s.viewCommits = null;
|
|
1501
1517
|
const repoNamed = () => repoParam(s.repo, s.viewRepos) || (vendor && s.mode === "none" ? notRunRepo(tool, s.viewRepos) : null);
|
|
@@ -2609,6 +2625,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2609
2625
|
s.viewCommits = p.viewCommits || null;
|
|
2610
2626
|
if (s.aimed === null && p.viewRepo) s.aimed = p.viewRepo;
|
|
2611
2627
|
}
|
|
2628
|
+
if (p && !p.error) s.single = !Array.isArray(p.viewRepos);
|
|
2612
2629
|
// A chant project's graph is its components (web/app.js bootZoom), so it has that view too.
|
|
2613
2630
|
s.components = !!(p && !p.error && (p.terragucciComponents || chantProject(p)));
|
|
2614
2631
|
// behold#631: a chant project may run chant's pull-request loop; /api/chant/pr says (its `loop`).
|
package/web/tg-read-pills.js
CHANGED
|
@@ -120,3 +120,26 @@ export function pillSpots(box, p0, w, h, { gaps = [6, 18, 34], slides = [0, -0.3
|
|
|
120
120
|
export function nearestOn(r, p) {
|
|
121
121
|
return { x: Math.max(r.x, Math.min(p.x, r.x2)), y: Math.max(r.y, Math.min(p.y, r.y2)) };
|
|
122
122
|
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* behold#762: whether a read's root (a path, "apps/app-01", or a name) is the card `id` names: the components zoom names a
|
|
126
|
+
* card after the root, and the read after its path (tipComponentEdges matches them the same way).
|
|
127
|
+
*/
|
|
128
|
+
const sameEnd = (root, id) => !!root && !!id && (root === id || root.endsWith(`/${id}`));
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* behold#762: which dependency edges a read line already draws, so a pair gets one line, not two. `deps` are the graph's
|
|
132
|
+
* edges ({ from, to }, as pinhole names their ends); answers, for each, the key of the read (readKey) whose ends are the
|
|
133
|
+
* edge's, in either direction, or null when no read covers it.
|
|
134
|
+
*/
|
|
135
|
+
export function coveredEdges(reads, deps) {
|
|
136
|
+
return (deps || []).map((d) => {
|
|
137
|
+
const r = (reads || []).find((e) => (sameEnd(e.from, d.from) && sameEnd(e.to, d.to)) || (sameEnd(e.from, d.to) && sameEnd(e.to, d.from)));
|
|
138
|
+
return r ? readKey(r) : null;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** behold#762: what a dependency edge means, in the words its own tooltip had (behold#744), for the read line that stands for it. */
|
|
143
|
+
export function dependsLine(d) {
|
|
144
|
+
return `${d.from} → ${d.to}\n${d.from} depends on ${d.to}, so ${d.to} applies first`;
|
|
145
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { FLASH_MAX, FLASH_MS, createReadFlash, hotReads, nearestOn, pillSpots, readKey, readerStates } from "./tg-read-pills.js";
|
|
2
|
+
import { FLASH_MAX, FLASH_MS, coveredEdges, createReadFlash, dependsLine, hotReads, nearestOn, pillSpots, readKey, readerStates } from "./tg-read-pills.js";
|
|
3
3
|
|
|
4
4
|
// behold#744: the tofu fan-out's reads: cluster-a and cluster-b read network; app-01..06 read cluster-a.
|
|
5
5
|
const apps = ["app-01", "app-02", "app-03", "app-04", "app-05", "app-06"];
|
|
@@ -115,3 +115,44 @@ describe("where a pill goes (behold#744)", () => {
|
|
|
115
115
|
expect(nearestOn({ x: 0, y: 0, x2: 10, y2: 10 }, { x: -4, y: -4 })).toEqual({ x: 0, y: 0 });
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
|
+
|
|
119
|
+
describe("a read line stands for the dependency edge on its pair (behold#762)", () => {
|
|
120
|
+
// The tofu fan-out's dependency edges as pinhole draws them: each app on its cluster, each cluster on network.
|
|
121
|
+
const deps = [
|
|
122
|
+
{ from: "cluster-a", to: "network" },
|
|
123
|
+
{ from: "cluster-b", to: "network" },
|
|
124
|
+
...apps.map((a) => ({ from: a, to: "cluster-a" })),
|
|
125
|
+
];
|
|
126
|
+
|
|
127
|
+
it("covers every edge whose pair has a read, and names the read", () => {
|
|
128
|
+
expect(coveredEdges(edges, deps)).toEqual(deps.map((d) => readKey(d)));
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("leaves an edge with no read on its pair to draw itself", () => {
|
|
132
|
+
const reads = edges.filter((e) => e.from !== "app-03" && e.to !== "network");
|
|
133
|
+
const out = coveredEdges(reads, deps);
|
|
134
|
+
expect(out[0]).toBeNull();
|
|
135
|
+
expect(out[1]).toBeNull();
|
|
136
|
+
expect(out[deps.findIndex((d) => d.from === "app-03")]).toBeNull();
|
|
137
|
+
expect(out.filter(Boolean)).toHaveLength(5);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it("matches the pair in either direction", () => {
|
|
141
|
+
expect(coveredEdges([{ from: "app-01", to: "cluster-a" }], [{ from: "cluster-a", to: "app-01" }])).toEqual(["app-01→cluster-a"]);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("matches a read named by its root's path to a card named after the root, and no other card", () => {
|
|
145
|
+
const reads = [{ from: "apps/app-01", to: "clusters/cluster-a" }];
|
|
146
|
+
expect(coveredEdges(reads, [{ from: "app-01", to: "cluster-a" }, { from: "app-1", to: "cluster-a" }, { from: "pp-01", to: "cluster-a" }])).toEqual(["apps/app-01→clusters/cluster-a", null, null]);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it("covers nothing without reads (a chant repo) or without edges", () => {
|
|
150
|
+
expect(coveredEdges([], deps)).toEqual(deps.map(() => null));
|
|
151
|
+
expect(coveredEdges(undefined, deps)).toEqual(deps.map(() => null));
|
|
152
|
+
expect(coveredEdges(edges, [])).toEqual([]);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("says what the hidden edge meant", () => {
|
|
156
|
+
expect(dependsLine({ from: "app-01", to: "cluster-a" })).toBe("app-01 → cluster-a\napp-01 depends on cluster-a, so cluster-a applies first");
|
|
157
|
+
});
|
|
158
|
+
});
|