@intentius/behold 0.29.38 → 0.29.39
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 +11 -6
- package/package.json +1 -1
- package/web/app.js +9 -3
- package/web/index.html +7 -0
- package/web/inspect-pane.js +16 -0
- package/web/inspect-pane.test.js +15 -0
- package/web/kiosk-event-help-ui.js +59 -13
- package/web/kiosk-event-help-ui.test.js +42 -0
- package/web/kiosk.html +7 -5
- package/web/panel.js +6 -1
- package/web/terragucci-components-live.js +24 -5
- package/web/terragucci-components-live.test.js +17 -1
package/dist/cli.js
CHANGED
|
@@ -3483,8 +3483,7 @@ async function detectProject(projectDir) {
|
|
|
3483
3483
|
const path = chantConfigPath(projectDir);
|
|
3484
3484
|
if (!path) return { environments: [], lexicons: [] };
|
|
3485
3485
|
try {
|
|
3486
|
-
const
|
|
3487
|
-
const cfg = mod.default ?? mod.config ?? mod;
|
|
3486
|
+
const cfg = path.endsWith(".json") ? JSON.parse(readFileSync6(path, "utf8")) : ((m) => m.default ?? m.config ?? m)(await import(pathToFileURL(path).href));
|
|
3488
3487
|
const info = readInfo(cfg);
|
|
3489
3488
|
if (info.environments.length || info.lexicons.length || info.sourceDir || info.stacks?.length) return info;
|
|
3490
3489
|
} catch {
|
|
@@ -3601,7 +3600,7 @@ var init_project = __esm({
|
|
|
3601
3600
|
"src/project.ts"() {
|
|
3602
3601
|
"use strict";
|
|
3603
3602
|
init_member_kind();
|
|
3604
|
-
CONFIG_NAMES = ["chant.config.ts", "chant.config.mts", "chant.config.js", "chant.config.mjs"];
|
|
3603
|
+
CONFIG_NAMES = ["chant.config.ts", "chant.config.mts", "chant.config.js", "chant.config.mjs", "chant.config.json"];
|
|
3605
3604
|
BEHOLD_CONFIG_NAME = ".behold.json";
|
|
3606
3605
|
EXECUTOR_FORGES = ["github", "gitlab", "forgejo"];
|
|
3607
3606
|
executorByDir = /* @__PURE__ */ new Map();
|
|
@@ -15264,7 +15263,7 @@ function repoTools(dir, config, has = {}) {
|
|
|
15264
15263
|
}
|
|
15265
15264
|
function sqlYodelerProjectIn(dir) {
|
|
15266
15265
|
if (existsSync11(join17(dir, "yodel.config.ts")) || existsSync11(join17(dir, "yodel-waves.json"))) return true;
|
|
15267
|
-
return existsSync11(join17(dir, "migrations")) && (existsSync11(join17(dir, "chant.config.ts")) || sqlYodelerRepo(dir));
|
|
15266
|
+
return existsSync11(join17(dir, "migrations")) && (existsSync11(join17(dir, "chant.config.ts")) || existsSync11(join17(dir, "chant.config.json")) || sqlYodelerRepo(dir));
|
|
15268
15267
|
}
|
|
15269
15268
|
var SKIP_DIRS4 = /* @__PURE__ */ new Set(["node_modules", ".terraform", ".terragrunt-cache", ".git"]);
|
|
15270
15269
|
function rootTools(repo, rootDir) {
|
|
@@ -22124,7 +22123,13 @@ function scriptBringUp(projectDir, relPath, label) {
|
|
|
22124
22123
|
}
|
|
22125
22124
|
function projectLexicons(projectDir) {
|
|
22126
22125
|
try {
|
|
22127
|
-
const
|
|
22126
|
+
const ts = join33(projectDir, "chant.config.ts");
|
|
22127
|
+
const json2 = join33(projectDir, "chant.config.json");
|
|
22128
|
+
if (!existsSync22(ts) && existsSync22(json2)) {
|
|
22129
|
+
const doc = JSON.parse(readFileSync25(json2, "utf-8"));
|
|
22130
|
+
return Array.isArray(doc.lexicons) ? doc.lexicons.filter((l) => typeof l === "string") : [];
|
|
22131
|
+
}
|
|
22132
|
+
const src = readFileSync25(ts, "utf-8");
|
|
22128
22133
|
const m = src.match(/lexicons\s*:\s*\[([^\]]*)\]/);
|
|
22129
22134
|
if (!m) return [];
|
|
22130
22135
|
return [...m[1].matchAll(/["']([^"']+)["']/g)].map((x) => x[1]);
|
|
@@ -31585,7 +31590,7 @@ function warnIfNotChantProject(dir) {
|
|
|
31585
31590
|
return;
|
|
31586
31591
|
}
|
|
31587
31592
|
process.stderr.write(
|
|
31588
|
-
`behold: warning \u2014 ${dir} has no chant.config.ts; this doesn't look like a chant project.
|
|
31593
|
+
`behold: warning \u2014 ${dir} has no chant.config.ts or chant.config.json; this doesn't look like a chant project.
|
|
31589
31594
|
\`behold doctor ${dir}\` says what's missing. No project yet? \`behold demo\` serves a bundled working example (needs Docker).
|
|
31590
31595
|
`
|
|
31591
31596
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.39",
|
|
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
|
@@ -23,7 +23,7 @@ import { renderYodelLane } from "./sql-yodeler-lane.js";
|
|
|
23
23
|
import { initTerragucciEstate } from "./terragucci-estate.js";
|
|
24
24
|
import { chantComponentMarks } from "./chant-pr-marks.js";
|
|
25
25
|
import { noStateFill } from "./frame-fill.js";
|
|
26
|
-
import { componentMarks as tgComponentMarks, runsCommit as tgRunsCommit, waveOfKey as tgWaveOfKey } from "./terragucci-components-live.js";
|
|
26
|
+
import { componentMarks as tgComponentMarks, runsCommit as tgRunsCommit, statusShort as tgStatusShort, waveOfKey as tgWaveOfKey } from "./terragucci-components-live.js";
|
|
27
27
|
import { FORGES, MARK, componentsForge, forgeOfName, iconSvg, markLink, markTitle, waveJobUrl } from "./forge-mark.js";
|
|
28
28
|
import { TOOLS, orderTools } from "./tool-mark.js";
|
|
29
29
|
import { STATE_WORDS as tgStateWords, changeSection as tgChangeSection, readCardIds as tgReadCardIds, readEdges as tgReadEdges, readLabel as tgReadLabel, readLine as tgReadLine, readTag as tgReadTag, rootStates as tgRootStates, viewCaption as tgViewCaption, pinnedAnswer as tgPinnedAnswer, pinnedCaption as tgPinnedCaption, pinsCommit as tgPinsCommit } from "./terragucci-change.js";
|
|
@@ -87,6 +87,7 @@ import {
|
|
|
87
87
|
straightEdge,
|
|
88
88
|
writeLayout,
|
|
89
89
|
} from "./layout-store.js";
|
|
90
|
+
import { PHONE_QUERY as INSPECT_PHONE_QUERY, inspectStartsFolded } from "./inspect-pane.js";
|
|
90
91
|
// #259: every JSON value this page shows goes through one renderer — pretty
|
|
91
92
|
// printed, collapsible, copyable per subtree. `valueCell`/`pairCell` below are
|
|
92
93
|
// the call-site shorthands: a container becomes the tree, a scalar stays text.
|
|
@@ -122,7 +123,7 @@ const embedOpts = readEmbed(location.search);
|
|
|
122
123
|
if (embedOpts.theme && !setTheme(embedOpts.theme, { persist: false })) console.warn(`behold: no theme named ${embedOpts.theme}`);
|
|
123
124
|
if (embedOpts.embed) document.documentElement.classList.add("embed");
|
|
124
125
|
if (embedOpts.embed && embedOpts.bare) document.documentElement.classList.add("bare"); // #569: the graph alone, for a kiosk
|
|
125
|
-
initPanel({ embed: embedOpts.embed });
|
|
126
|
+
initPanel({ embed: embedOpts.embed, phone: typeof matchMedia === "function" && matchMedia(INSPECT_PHONE_QUERY).matches });
|
|
126
127
|
mountThemePicker(document.getElementById("panel-theme"));
|
|
127
128
|
|
|
128
129
|
// Colour node fills by category/kind using the theme's FULL palette (spicypath-style, so the
|
|
@@ -4111,6 +4112,9 @@ function drawTgComponentMarks(svg, { drawnAnswer, focus, boxOf, make, edgePoints
|
|
|
4111
4112
|
const cy = (tb.y + tb.y2) / 2;
|
|
4112
4113
|
// Right after the title, as "apply-wave-2 · held at the gate"; else alone at the right of the title's line.
|
|
4113
4114
|
const spots = [{ words: `· ${w.status.words}`, at: () => tb.x2 + 6 }, { words: w.status.words, at: (wd) => b.x2 - 16 - wd }];
|
|
4115
|
+
// behold#693: a narrow box whose full words would cross an edge says the short form.
|
|
4116
|
+
const short = tgStatusShort(w.status);
|
|
4117
|
+
if (short && short !== w.status.words) spots.push({ words: `· ${short}`, at: () => tb.x2 + 6 }, { words: short, at: (wd) => b.x2 - 16 - wd });
|
|
4114
4118
|
for (const { words, at } of spots) {
|
|
4115
4119
|
const wd = width(words, size, 700);
|
|
4116
4120
|
const x = at(wd);
|
|
@@ -8604,7 +8608,9 @@ function initInspectPane() {
|
|
|
8604
8608
|
} catch {
|
|
8605
8609
|
/* private mode */
|
|
8606
8610
|
}
|
|
8607
|
-
|
|
8611
|
+
// behold#696: folded on a phone too, where the pane beside the graph left it a sliver.
|
|
8612
|
+
const phone = typeof matchMedia === "function" && matchMedia(INSPECT_PHONE_QUERY).matches;
|
|
8613
|
+
if (inspectStartsFolded(folded, { embed: embedOpts.embed, phone })) app.classList.add("inspect-collapsed");
|
|
8608
8614
|
|
|
8609
8615
|
document.getElementById("inspect-collapse").addEventListener("click", () => setInspectCollapsed(true));
|
|
8610
8616
|
document.getElementById("inspect-reopen").addEventListener("click", () => setInspectCollapsed(false));
|
package/web/index.html
CHANGED
|
@@ -57,6 +57,13 @@
|
|
|
57
57
|
height: 100%; }
|
|
58
58
|
#app.inspect-collapsed { grid-template-columns: 1fr 0; }
|
|
59
59
|
#app.inspect-collapsed #inspect { display: none; }
|
|
60
|
+
/* behold#696: on a phone the pane stacks under the graph, which keeps the full width (web/inspect-pane.js starts it folded). */
|
|
61
|
+
@media (max-width: 600px) {
|
|
62
|
+
#app, #app.inspect-collapsed { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; }
|
|
63
|
+
#app #inspect { grid-row: 2; grid-column: 1; border-left: 0; border-top: 1px solid var(--rule); max-height: 45vh; }
|
|
64
|
+
#app #inspect-resize { display: none; }
|
|
65
|
+
#app #nowline { grid-column: 1; grid-row: 3; }
|
|
66
|
+
}
|
|
60
67
|
#graph { grid-row: 1; grid-column: 1; overflow: auto; position: relative; }
|
|
61
68
|
#inspect { grid-row: 1; grid-column: 2; border-left: 1px solid var(--rule); background: var(--panel);
|
|
62
69
|
padding: 14px; overflow: auto; position: relative; }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The inspect pane's opening state (#15, #476, behold#696), without the DOM:
|
|
2
|
+
// app.js reads the stored choice and the viewport and asks here.
|
|
3
|
+
|
|
4
|
+
/** A phone's width: under it the pane stacks under the graph (index.html) and starts folded. */
|
|
5
|
+
export const PHONE_QUERY = "(max-width: 600px)";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Whether the pane starts folded: as the viewer last left it ("1" folded,
|
|
9
|
+
* "0" open), else folded in a frame (#476) and on a phone, where an open
|
|
10
|
+
* pane beside the graph left the graph a sliver (behold#696).
|
|
11
|
+
*/
|
|
12
|
+
export function inspectStartsFolded(saved, { embed = false, phone = false } = {}) {
|
|
13
|
+
if (saved === "1") return true;
|
|
14
|
+
if (saved === "0") return false;
|
|
15
|
+
return !!(embed || phone);
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { inspectStartsFolded } from "./inspect-pane.js";
|
|
3
|
+
|
|
4
|
+
// behold#696: on a phone the inspect pane starts folded, so the graph has the width.
|
|
5
|
+
describe("inspectStartsFolded", () => {
|
|
6
|
+
it("starts folded on a phone and in a frame, open on a wide screen", () => {
|
|
7
|
+
expect(inspectStartsFolded(null, { phone: true })).toBe(true);
|
|
8
|
+
expect(inspectStartsFolded(null, { embed: true })).toBe(true);
|
|
9
|
+
expect(inspectStartsFolded(null, {})).toBe(false);
|
|
10
|
+
});
|
|
11
|
+
it("keeps the viewer's own choice", () => {
|
|
12
|
+
expect(inspectStartsFolded("0", { phone: true })).toBe(false);
|
|
13
|
+
expect(inspectStartsFolded("1", {})).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -48,7 +48,7 @@ body.k-watch #eh-trail { position: fixed; z-index: 7; left: 5px; right: 5px; pad
|
|
|
48
48
|
box-shadow: 0 6px 22px color-mix(in srgb, var(--shadow) 70%, transparent); transform-origin: 50% 100%; }
|
|
49
49
|
.eh-tip.eh-tip-go { pointer-events: auto; cursor: pointer; }
|
|
50
50
|
.eh-tip.eh-tip-go:hover { background: var(--active); }
|
|
51
|
-
.eh-tip::after { content: ""; position: absolute; left: calc(50% - 6px); bottom: -7px; width: 12px; height: 12px; background: inherit; border: inherit; border-top: 0; border-left: 0; transform: rotate(45deg); }
|
|
51
|
+
.eh-tip::after { content: ""; position: absolute; left: calc(var(--eh-arrow, 50%) - 6px); bottom: -7px; width: 12px; height: 12px; background: inherit; border: inherit; border-top: 0; border-left: 0; transform: rotate(45deg); }
|
|
52
52
|
.eh-tip.eh-below::after { bottom: auto; top: -7px; transform: rotate(-135deg); }
|
|
53
53
|
.eh-tip[data-eh-tone="ok"] { --bar: var(--bar-managed, var(--managed)); }
|
|
54
54
|
.eh-tip[data-eh-tone="wait"] { --bar: var(--bar-foreign, var(--foreign)); }
|
|
@@ -66,6 +66,54 @@ body.k-watch #eh-trail { position: fixed; z-index: 7; left: 5px; right: 5px; pad
|
|
|
66
66
|
@media (max-width: 600px) { #eh-trail { padding: 0.2em 16px; } body.k-watch #eh-trail { position: static; background: transparent; border: 0; } .eh-tip { max-width: 18em; } }
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* behold#695: where a tip stands, in the window's coordinates. Above the thing
|
|
71
|
+
* it points at (`rect`), centred, else below it when there is no room above;
|
|
72
|
+
* then, when that covers one of the frame's edge labels (`labels`, in the
|
|
73
|
+
* window's coordinates), the same side moved along to the anchor's left or
|
|
74
|
+
* right edge or past the label's ends (still over the anchor), then lifted
|
|
75
|
+
* clear above the labels it covers, then the same below. The first spot
|
|
76
|
+
* clear of every label wins; with none clear, the one covering least. `arrow` is where the tip's notch sits along it, under
|
|
77
|
+
* the anchor's middle as far as the tip reaches.
|
|
78
|
+
*/
|
|
79
|
+
export function tipSpot(rect, size, win, labels = []) {
|
|
80
|
+
const W = win.w || 1600;
|
|
81
|
+
const w = size.w || 200;
|
|
82
|
+
const h = size.h || 30;
|
|
83
|
+
const mid = rect.left + rect.width / 2;
|
|
84
|
+
const clampX = (x) => Math.max(8, Math.min(x, W - w - 8));
|
|
85
|
+
// A spot along the anchor: the tip keeps at least 24px over it, so its notch still points at it.
|
|
86
|
+
const reaches = (x) => Math.min(x + w, rect.left + rect.width) - Math.max(x, rect.left) >= Math.min(24, rect.width);
|
|
87
|
+
const hits = (p) => labels.filter((l) => p.x < l.x + l.w && p.x + w > l.x && p.y < l.y + l.h && p.y + h > l.y);
|
|
88
|
+
const covered = (p) => hits(p).reduce((sum, l) => sum + (Math.min(p.x + w, l.x + l.w) - Math.max(p.x, l.x)) * (Math.min(p.y + h, l.y + l.h) - Math.max(p.y, l.y)), 0);
|
|
89
|
+
const along = (y, below) => {
|
|
90
|
+
const centred = { x: clampX(mid - w / 2), y, below };
|
|
91
|
+
const xs = [centred.x, clampX(rect.left), clampX(rect.left + rect.width - w)];
|
|
92
|
+
for (const l of hits(centred)) xs.push(clampX(l.x - w - 8), clampX(l.x + l.w + 8));
|
|
93
|
+
return xs.filter((x, i) => xs.indexOf(x) === i && reaches(x)).map((x) => ({ x, y, below }));
|
|
94
|
+
};
|
|
95
|
+
const aboveY = rect.top - h - 12;
|
|
96
|
+
const spots = [];
|
|
97
|
+
if (aboveY >= 8) {
|
|
98
|
+
spots.push(...along(aboveY, false));
|
|
99
|
+
// Lifted: above the labels the centred spot covers.
|
|
100
|
+
const hit = hits(spots[0]);
|
|
101
|
+
if (hit.length) {
|
|
102
|
+
const y = Math.min(...hit.map((l) => l.y)) - h - 6;
|
|
103
|
+
if (y >= 8) spots.push({ x: spots[0].x, y, below: false });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
spots.push(...along(rect.top + rect.height + 12, true));
|
|
107
|
+
let best = null;
|
|
108
|
+
for (const p of spots) {
|
|
109
|
+
const c = covered(p);
|
|
110
|
+
if (!best || c < best.c) best = { ...p, c };
|
|
111
|
+
if (c === 0) break;
|
|
112
|
+
}
|
|
113
|
+
const arrow = Math.max(12, Math.min(w - 12, mid - best.x));
|
|
114
|
+
return { x: Math.round(best.x), y: Math.round(best.y), below: best.below, arrow: Math.round(arrow) };
|
|
115
|
+
}
|
|
116
|
+
|
|
69
117
|
/** A fact's tone, for its chip, its tip and its modal: the state colours the bars use. */
|
|
70
118
|
export function toneOf(kind) {
|
|
71
119
|
if (kind === "held") return "wait";
|
|
@@ -181,17 +229,15 @@ export function startEventHelp({ doc = document, store = null, switchHost = null
|
|
|
181
229
|
};
|
|
182
230
|
|
|
183
231
|
// ---- tips ----------------------------------------------------------------
|
|
184
|
-
const place = (node, rect) => {
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
node.classList.toggle("eh-below", below);
|
|
194
|
-
const at = `translate(${Math.round(x)}px, ${Math.round(y)}px)`;
|
|
232
|
+
const place = (node, rect, h) => {
|
|
233
|
+
const win = { w: doc.defaultView ? doc.defaultView.innerWidth : 1600 };
|
|
234
|
+
// The frame's edge labels, in the window's coordinates (behold#695).
|
|
235
|
+
const F = h ? frameRect(h) : null;
|
|
236
|
+
const labels = F && h.boxes && Array.isArray(h.boxes.labels) ? h.boxes.labels.map((l) => ({ x: F.left + l.x, y: F.top + l.y, w: l.w, h: l.h })) : [];
|
|
237
|
+
const p = tipSpot(rect, { w: node.offsetWidth || 200, h: node.offsetHeight || 30 }, win, labels);
|
|
238
|
+
node.classList.toggle("eh-below", p.below);
|
|
239
|
+
node.style.setProperty("--eh-arrow", `${p.arrow}px`);
|
|
240
|
+
const at = `translate(${p.x}px, ${p.y}px)`;
|
|
195
241
|
node.style.setProperty("--eh-at", at);
|
|
196
242
|
node.style.transform = at;
|
|
197
243
|
};
|
|
@@ -237,7 +283,7 @@ export function startEventHelp({ doc = document, store = null, switchHost = null
|
|
|
237
283
|
st.nodes.set(event.id, node);
|
|
238
284
|
}
|
|
239
285
|
node.style.visibility = "";
|
|
240
|
-
place(node, anchors[0].rect);
|
|
286
|
+
place(node, anchors[0].rect, h);
|
|
241
287
|
if (isNew) {
|
|
242
288
|
// The things it is about glow while it is up, and light together across the panes.
|
|
243
289
|
for (const a of anchors) if (a.el) glowOn(a.el, toneOf(event.kind));
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { tipSpot } from "./kiosk-event-help-ui.js";
|
|
3
|
+
|
|
4
|
+
// behold#695: a tip stands clear of the frame's edge labels where it can.
|
|
5
|
+
describe("tipSpot", () => {
|
|
6
|
+
const box = { left: 400, top: 300, width: 300, height: 200 }; // a wave box
|
|
7
|
+
const size = { w: 240, h: 30 };
|
|
8
|
+
const win = { w: 1440 };
|
|
9
|
+
|
|
10
|
+
it("stands above the box, centred, when nothing is in the way", () => {
|
|
11
|
+
expect(tipSpot(box, size, win)).toEqual({ x: 430, y: 258, below: false, arrow: 120 });
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("goes below when there is no room above", () => {
|
|
15
|
+
expect(tipSpot({ ...box, top: 20 }, size, win)).toMatchObject({ y: 232, below: true });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("moves along the box's top when the centred spot covers an edge label", () => {
|
|
19
|
+
// A read's label over the middle of the box's top, as the demo's "edge reads app's applied state" sits.
|
|
20
|
+
const label = { x: 520, y: 255, w: 90, h: 24 };
|
|
21
|
+
const p = tipSpot(box, size, win, [label]);
|
|
22
|
+
expect(p.below).toBe(false);
|
|
23
|
+
expect(p.y).toBe(258);
|
|
24
|
+
const clear = p.x + size.w <= label.x || p.x >= label.x + label.w || p.y + size.h <= label.y || p.y >= label.y + label.h;
|
|
25
|
+
expect(clear).toBe(true);
|
|
26
|
+
// The notch still points at the box's middle as far as the tip reaches.
|
|
27
|
+
expect(p.arrow).toBe(Math.max(12, Math.min(size.w - 12, 550 - p.x)));
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("lifts the tip above a label that spans the box's top", () => {
|
|
31
|
+
const wide = { x: 380, y: 360, w: 360, h: 24 };
|
|
32
|
+
const p = tipSpot({ ...box, top: 400 }, size, win, [wide, { x: 380, y: 615, w: 360, h: 24 }]);
|
|
33
|
+
expect(p).toMatchObject({ y: 360 - 30 - 6, below: false });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("takes the spot covering least when none is clear", () => {
|
|
37
|
+
// Above, the tip overlaps the label by 32px of its height; below, by 10px.
|
|
38
|
+
const labels = [{ x: 0, y: 0, w: 1440, h: 290 }, { x: 0, y: 532, w: 1440, h: 400 }];
|
|
39
|
+
const p = tipSpot(box, size, win, labels);
|
|
40
|
+
expect(p).toMatchObject({ y: 512, below: true });
|
|
41
|
+
});
|
|
42
|
+
});
|
package/web/kiosk.html
CHANGED
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
* with a fade, inside it) with a rail down its left: neutral, and the
|
|
179
179
|
* step's rail in the step's state colour (theme.js barInks).
|
|
180
180
|
*/
|
|
181
|
-
:root { --k-label-w: 7.6rem; --k-title-h: 3.15em; --k-beat-h: 3em; --k-step-h: 4.45em; --k-next-h:
|
|
181
|
+
:root { --k-label-w: 7.6rem; --k-title-h: 3.15em; --k-beat-h: 3em; --k-step-h: 4.45em; --k-next-h: 2.15em; --k-watch-h: 3.75em; --k-shows-h: 2.5em; --k-facts-h: 3.75em; }
|
|
182
182
|
.k-lead { display: grid; grid-template-rows: var(--k-title-h) var(--k-beat-h) var(--k-step-h) var(--k-next-h) var(--k-watch-h) var(--k-shows-h) var(--k-facts-h) auto; gap: 0.2em; min-width: 0;
|
|
183
183
|
padding: 0.25em 0.9em 0.35em; background: var(--surface-pane-b); border-radius: 8px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 14%, transparent); }
|
|
184
184
|
.k-box { min-height: 0; overflow-y: auto; scrollbar-width: thin; border-radius: 6px; padding: 0.1em 0.2em; }
|
|
@@ -224,9 +224,10 @@
|
|
|
224
224
|
* pulses until the step changes; with no deadline a quiet shimmer runs. Under reduced motion
|
|
225
225
|
* the due bar is steady and full, and there is no shimmer.
|
|
226
226
|
*/
|
|
227
|
-
|
|
228
|
-
.k-
|
|
229
|
-
|
|
227
|
+
/* behold#694: the bar has its own track below the words, with room between, never an underline of them. */
|
|
228
|
+
.k-row-next { position: relative; padding-bottom: calc(0.45em + 4px); }
|
|
229
|
+
.k-nbar { position: absolute; left: calc(0.75em + var(--k-label-w) + 0.8em); right: 0.2em; bottom: 0; height: 4px; border-radius: 2px; overflow: hidden; pointer-events: none;
|
|
230
|
+
background: color-mix(in srgb, var(--muted) 22%, transparent); }
|
|
230
231
|
.k-nbar-none { display: none; }
|
|
231
232
|
.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
233
|
.k-nbar-due .k-nbar-in { width: 100%; }
|
|
@@ -361,6 +362,7 @@
|
|
|
361
362
|
.k-row-empty { display: none; }
|
|
362
363
|
.k-row-label { padding-top: 0; }
|
|
363
364
|
.k-nbar { left: 0.75em; right: 0; }
|
|
365
|
+
.k-row-next { padding-bottom: calc(0.45em + 4px); }
|
|
364
366
|
#views { flex-wrap: wrap; gap: 0.3em 0.9em; }
|
|
365
367
|
.k-strip { flex-wrap: wrap; }
|
|
366
368
|
.k-right > .k-cycle { padding: 0; }
|
|
@@ -431,7 +433,7 @@
|
|
|
431
433
|
.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; }
|
|
432
434
|
.k-cap-next .k-action { font-family: var(--font-mono); color: var(--fg); }
|
|
433
435
|
.k-cap-next { position: relative; padding-bottom: 6px; }
|
|
434
|
-
.k-cap-next .k-nbar { left: 0; right: 0; bottom: 0; }
|
|
436
|
+
.k-cap-next .k-nbar { left: 0; right: 0; bottom: 0; height: 3px; background: color-mix(in srgb, var(--rule) 55%, transparent); }
|
|
435
437
|
/* 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). */
|
|
436
438
|
.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)); }
|
|
437
439
|
.k-cap-row:empty { box-shadow: none; }
|
package/web/panel.js
CHANGED
|
@@ -170,7 +170,7 @@ export function isPanelCollapsed() {
|
|
|
170
170
|
return !!state.collapsed;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
export function initPanel({ embed = false } = {}) {
|
|
173
|
+
export function initPanel({ embed = false, phone = false } = {}) {
|
|
174
174
|
panel = document.getElementById("panel");
|
|
175
175
|
if (!panel) return;
|
|
176
176
|
if (embed) {
|
|
@@ -178,6 +178,11 @@ export function initPanel({ embed = false } = {}) {
|
|
|
178
178
|
state.collapsed = true;
|
|
179
179
|
state.y = 12;
|
|
180
180
|
}
|
|
181
|
+
// behold#696: on a phone it starts folded to its bar too, so the graph is what the viewer sees first.
|
|
182
|
+
if (phone) {
|
|
183
|
+
state.collapsed = true;
|
|
184
|
+
state.y = 12;
|
|
185
|
+
}
|
|
181
186
|
state = loadState();
|
|
182
187
|
const bar = document.getElementById("panel-tabs");
|
|
183
188
|
initDrag(bar);
|
|
@@ -66,14 +66,20 @@ export function jobStatus(index, commit, jobName) {
|
|
|
66
66
|
// another (a /terragucci apply re-run applies every wave in its
|
|
67
67
|
// apply-comment job) is the latest run for the wave.
|
|
68
68
|
let later = null;
|
|
69
|
+
// behold#693: and whether that run waits at its gate, which the run view
|
|
70
|
+
// doesn't say until the approval: the reports still hold the failure.
|
|
71
|
+
let held = false;
|
|
69
72
|
for (const run of runs) {
|
|
70
73
|
if (!sameSha(run.commit, commit)) continue;
|
|
71
74
|
const job = (run.jobs || []).find((j) => j.name === jobName);
|
|
72
75
|
if (!job) continue;
|
|
73
76
|
if (job.status !== "skipped") {
|
|
74
|
-
return { status: job.status, words: JOB_WORDS[job.status] || job.status, tone: JOB_TONE[job.status] || "idle", run: run.id, ...(later ? { superseded: later } : {}) };
|
|
77
|
+
return { status: job.status, words: JOB_WORDS[job.status] || job.status, tone: JOB_TONE[job.status] || "idle", run: run.id, ...(later ? { superseded: later } : {}), ...(later && held ? { held: true } : {}) };
|
|
78
|
+
}
|
|
79
|
+
if (!later && (run.jobs || []).some((j) => j.status !== "skipped")) {
|
|
80
|
+
later = run.id;
|
|
81
|
+
held = run.status === "waiting" || (run.jobs || []).some((j) => j.status === "waiting");
|
|
75
82
|
}
|
|
76
|
-
if (!later && (run.jobs || []).some((j) => j.status !== "skipped")) later = run.id;
|
|
77
83
|
skipped = skipped || { status: "skipped", words: JOB_WORDS.skipped, tone: "idle", run: run.id };
|
|
78
84
|
}
|
|
79
85
|
return skipped;
|
|
@@ -85,13 +91,25 @@ export const WAVE_WORDS = { waiting: "held at the gate", applying: "running", ap
|
|
|
85
91
|
/**
|
|
86
92
|
* The status a wave's box shows: its job's, unless a later run on the commit
|
|
87
93
|
* took the wave over (`superseded`); then the run view's state for the wave,
|
|
88
|
-
* which is the latest run's.
|
|
94
|
+
* which is the latest run's. While that later run waits at its gate (`held`),
|
|
95
|
+
* a wave its job failed reads "held at the gate": the run view keeps the
|
|
96
|
+
* failure until the approval lets the re-run write (behold#693).
|
|
89
97
|
*/
|
|
90
98
|
export function waveStatus(status, state) {
|
|
91
|
-
if (!status || !status.superseded
|
|
99
|
+
if (!status || !status.superseded) return status;
|
|
100
|
+
const undone = state !== "applied" && state !== "applying";
|
|
101
|
+
const failed = status.status === "failure" || status.status === "cancelled" || state === "failed" || state === "refused";
|
|
102
|
+
if (status.held && undone && failed) return { status: "waiting", words: WAVE_WORDS.waiting, tone: toneOf("waiting"), run: status.superseded, held: true };
|
|
103
|
+
if (!state || !WAVE_WORDS[state]) return status;
|
|
92
104
|
return { status: state, words: WAVE_WORDS[state], tone: toneOf(state), run: status.superseded };
|
|
93
105
|
}
|
|
94
106
|
|
|
107
|
+
/** A status's words in a narrow box, where the full words cross an edge (behold#693): "held" for a wave held at its gate. */
|
|
108
|
+
export function statusShort(status) {
|
|
109
|
+
if (!status) return null;
|
|
110
|
+
return status.status === "waiting" ? "held" : status.words;
|
|
111
|
+
}
|
|
112
|
+
|
|
95
113
|
/** "apply-wave-2 · held at the gate", or the job alone without a status. */
|
|
96
114
|
export function waveTitle(jobName, status) {
|
|
97
115
|
return status ? `${jobName} · ${status.words}` : jobName;
|
|
@@ -155,7 +173,8 @@ export function componentMarks(answer, progress, facets, { runs = null, pin = nu
|
|
|
155
173
|
number: n,
|
|
156
174
|
job: jobName,
|
|
157
175
|
state: w,
|
|
158
|
-
|
|
176
|
+
// A re-run held at its gate (behold#693) tones the box as its title says.
|
|
177
|
+
tone: status && status.held && status.status === "waiting" ? status.tone : w ? toneOf(w) : status ? status.tone : "idle",
|
|
159
178
|
status,
|
|
160
179
|
title: waveTitle(jobName, status),
|
|
161
180
|
facts,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { JOB_WORDS, componentMarks, jobStatus, runsCommit, waveOfKey, waveStatus, waveTitle } from "./terragucci-components-live.js";
|
|
2
|
+
import { JOB_WORDS, componentMarks, jobStatus, runsCommit, statusShort, waveOfKey, waveStatus, waveTitle } from "./terragucci-components-live.js";
|
|
3
3
|
|
|
4
4
|
// #571: the live marks on a terragucci repo's components zoom. The facets are
|
|
5
5
|
// the components graph's (src/__fixtures__/terragucci-components: network and
|
|
@@ -129,6 +129,14 @@ describe("the component marks (#571)", () => {
|
|
|
129
129
|
// While the re-run waits at the gate, the box says so.
|
|
130
130
|
const held = componentMarks(answer, progress("waiting"), facets, { runs: runs(comment(12, "waiting"), merge), pin: MERGE });
|
|
131
131
|
expect(held.waves[2].title).toBe("apply-wave-2 · held at the gate");
|
|
132
|
+
// behold#693: the run view still holds the merge's failure while the re-run
|
|
133
|
+
// waits for its approval; the box reads the gate, not the failure.
|
|
134
|
+
const gated = componentMarks(answer, progress("failed"), facets, { runs: runs(comment(12, "waiting"), merge), pin: MERGE });
|
|
135
|
+
expect(gated.waves[2]).toMatchObject({ title: "apply-wave-2 · held at the gate", tone: "wait" });
|
|
136
|
+
expect(gated.waves[1].title).toBe("apply-wave-1 · applied");
|
|
137
|
+
// Once a later re-run has gone past its gate, the run view's state again.
|
|
138
|
+
const after = componentMarks(answer, progress("failed"), facets, { runs: runs(comment(13, "failure"), comment(12, "waiting"), merge), pin: MERGE });
|
|
139
|
+
expect(after.waves[2]).toMatchObject({ title: "apply-wave-2 · failed", tone: "bad" });
|
|
132
140
|
// Before any re-run, the merge's own failure.
|
|
133
141
|
const failed = componentMarks(answer, progress("failed"), facets, { runs: runs(merge), pin: MERGE });
|
|
134
142
|
expect(failed.waves[2].title).toBe("apply-wave-2 · failed");
|
|
@@ -140,6 +148,14 @@ describe("the component marks (#571)", () => {
|
|
|
140
148
|
expect(waveStatus({ ...st, superseded: 12 }, null)).toMatchObject({ status: "failure" });
|
|
141
149
|
expect(waveStatus({ ...st, superseded: 12 }, "applied")).toEqual({ status: "applied", words: "applied", tone: "ok", run: 12 });
|
|
142
150
|
expect(waveStatus(null, "applied")).toBe(null);
|
|
151
|
+
// behold#693: a later run waiting at its gate holds a failed wave, never an applied one.
|
|
152
|
+
expect(waveStatus({ ...st, superseded: 12, held: true }, "failed")).toEqual({ status: "waiting", words: "held at the gate", tone: "wait", run: 12, held: true });
|
|
153
|
+
expect(waveStatus({ ...st, superseded: 12, held: true }, null)).toMatchObject({ words: "held at the gate" });
|
|
154
|
+
expect(waveStatus({ ...st, superseded: 12, held: true }, "applied")).toMatchObject({ words: "applied" });
|
|
155
|
+
// In a box too narrow for the full words, "held".
|
|
156
|
+
expect(statusShort(waveStatus({ ...st, superseded: 12, held: true }, "failed"))).toBe("held");
|
|
157
|
+
expect(statusShort(st)).toBe("failed");
|
|
158
|
+
expect(statusShort(null)).toBe(null);
|
|
143
159
|
});
|
|
144
160
|
|
|
145
161
|
it("draws the pull request's plan before the merge, with no job status", () => {
|