@intentius/behold 0.29.44 → 0.29.46

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 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 s = this.opts.sourceOf ? this.opts.sourceOf(url) : url === this.opts.source ? terragucciSource(url, via) : reportSourceOf(url, via);
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
- const base = this.opts.source.replace(/\/+$/, "");
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
- return { entries: out, repo: step ? step.repo : latest ? latest.repo : null, url: this.reportsUrl(withUrl), latest };
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
- reportSource: (url) => reportSourceOf(url, via),
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.44",
3
+ "version": "0.29.46",
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
@@ -13,6 +13,7 @@ import { createRefreshQueue } from "./refresh-queue.js";
13
13
  import { readViewQuery, writeViewQuery, settleView, settlePlace, refusalLine } from "./view-url.js";
14
14
  import { quietCardLines, readEmbed, selectMessage, viewFromMessage, wheelPx, wheelZoomsBare } from "./embed.js";
15
15
  import { WORDS as POP_WORDS, cardRoot as popCardRoot, placePopover, popReduce, popState, resourcePopover, rootPopover } from "./kiosk-popover.js";
16
+ import { shiftInto } from "./float-place.js"; // behold#764
16
17
  import { cssString, hoverCss, hoverFromMessage, hoverLinks, hoverMessage, isLightBg, rootPaint, rootText } from "./kiosk-roots.js";
17
18
  import { gateCards } from "./workspace-gates.js";
18
19
  import { cornerOf, estateLine, hrefOf as tgHref, legend as tgLegend, markLine, rootRows as tgRootRows, waveCards } from "./terragucci.js";
@@ -130,7 +131,7 @@ import { mountDots, unmountDots, dotsCamera, dotsZoomOutFactor, dotsCarving, dot
130
131
  // Report minor 34: a cone plan's lights, on the cards and the dots (web/cone.js).
131
132
  import { cardRoot as coneCardRoot, coneLights, coneOf, resourceLight as coneResourceLight, rootLight as coneRootLight, wrapWords } from "./cone.js";
132
133
  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
134
+ 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
135
  import { outsideCard as tgOutsideCard, outsideModel as tgOutsideModel, outsideSpots as tgOutsideSpots } from "./tg-outside.js"; // behold#743
135
136
  initTheme();
136
137
  // #476: framed in a host pane. The flag is a class on <html>, so the CSS that
@@ -3769,6 +3770,8 @@ function drawTgReads() {
3769
3770
  drawPipelineMarks(svg); // behold#571: the forge and tool marks, before the wave boxes' status finds room around them
3770
3771
  for (const old of svg.querySelectorAll("[data-tg-reads]")) old.remove();
3771
3772
  tgReadEdgesNow = []; // behold#744
3773
+ // behold#762: an edge a read line stood for comes back; this draw hides the ones its own lines stand for.
3774
+ for (const g of svg.querySelectorAll("g[data-tg-read-covers]")) g.removeAttribute("data-tg-read-covers");
3772
3775
  for (const old of svg.querySelectorAll("[data-tg-root]")) old.remove();
3773
3776
  for (const r of svg.querySelectorAll("rect[data-tg-stroke0]")) {
3774
3777
  r.setAttribute("stroke", r.getAttribute("data-tg-stroke0"));
@@ -3979,6 +3982,13 @@ function drawTgReads() {
3979
3982
  // Report minor 34: a cone plan lights what it planned and dims the rest, never hiding it (web/cone.js).
3980
3983
  drawConeLights(svg, { stage: states.stage, drawnAnswer, compMode, componentsOfRoot, rootOf });
3981
3984
 
3985
+ // behold#762: one line per pair. Where a read joins the two cards a dependency edge joins (either way round), the read's
3986
+ // line says both, so the edge is hidden (not removed: the layout and every index of the edges stay as they were), before
3987
+ // the read lines are routed clear of the edges that still show. An edge whose read draws no line shows again below.
3988
+ const edges = tgReadEdges(drawnAnswer, tgProgress);
3989
+ const depEdges = compMode ? [...svg.querySelectorAll("g[data-edge-from]")] : [];
3990
+ 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));
3991
+ if (depEdges.length) ensureTgReadStyle();
3982
3992
  // #571: the components zoom's own marks; its wave boxes are the boxes the caption and the labels keep clear of.
3983
3993
  const edgePoints = compMode ? chantEdgePoints(svg) : [];
3984
3994
  let readMarks = null; // behold#744: the cards' and waves' states (a story's paced) that a read's pill flashes on
@@ -4003,7 +4013,6 @@ function drawTgReads() {
4003
4013
  // on the read root's box border, that crosses no text and as few cards as
4004
4014
  // there are; each label then sits beside its line where it covers no text
4005
4015
  // and crosses no line.
4006
- const edges = tgReadEdges(drawnAnswer, tgProgress);
4007
4016
  if (compMode) tipComponentEdges(svg, edges); // behold#744
4008
4017
  const centre = (b) => ({ x: (b.x + b.x2) / 2, y: (b.y + b.y2) / 2 });
4009
4018
  const grow = (b, d) => ({ x: b.x - d, y: b.y - d, x2: b.x2 + d, y2: b.y2 + d });
@@ -4116,10 +4125,16 @@ function drawTgReads() {
4116
4125
  layer.appendChild(line);
4117
4126
  // behold#744: a wide clear stroke along the line takes the pointer (the drawn layer lets it through): pointing at it shows the
4118
4127
  // read's pill; outside a kiosk frame the shared tooltip adds the whole sentence (data-tip, no <title>: no second, native one).
4119
- 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, ...(embedOpts.bare ? {} : { "data-tip": tgReadLine(e) }) }));
4128
+ // behold#762: a line that stands for a hidden dependency edge says what the edge said too, in a kiosk frame as well.
4129
+ 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") }));
4130
+ const tip = stands.length ? [...stands, tgReadLine(e)].join("\n") : embedOpts.bare ? null : tgReadLine(e);
4131
+ 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
4132
  drawn.push({ p0, p1 });
4121
4133
  labels.push({ e, p0, p1, color, kind, key, fromBox });
4122
4134
  }
4135
+ // behold#762: a read that found no route (or no card) drew no line: its pair keeps the dependency edge.
4136
+ const lined = new Set(labels.map((l) => l.key));
4137
+ 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
4138
  // 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
4139
  for (const [rect] of clearMarksOfReads(svg, drawn)) {
4125
4140
  const now = boxOf(rect);
@@ -4485,6 +4500,95 @@ function tgReadShow(svg) {
4485
4500
  const hot = new Set(tgReadHot);
4486
4501
  for (const el of svg.querySelectorAll("[data-tg-read]")) el.classList.toggle("tg-hot", hot.has(el.getAttribute("data-tg-read")));
4487
4502
  for (const g of svg.querySelectorAll("g[data-tg-read-pill].tg-hot")) g.parentNode.appendChild(g);
4503
+ tgPillsKeepIn(svg);
4504
+ }
4505
+ /**
4506
+ * behold#764: a kiosk frame's shown pills stay inside what the frame shows. A pill is placed when the reads are drawn,
4507
+ * against the shot's viewBox then; the camera moves after, and a pointed card lights the pills of readers it has
4508
+ * panned out of view (331px over the frame's top on /tofu-fanout). A pill whose reader is out of view does not show
4509
+ * (tg-off): its leader would point at nothing. One whose reader shows slides in by as little as keeps it inside
4510
+ * (shiftInto), its leader and dot left on the reader's card. Run after each light and each camera move.
4511
+ */
4512
+ function tgPillsKeepIn(svg) {
4513
+ if (!embedOpts.bare || !svg || !svg.getScreenCTM) return;
4514
+ const ctm = svg.getScreenCTM();
4515
+ const scale = ctm && ctm.a ? ctm.a : 1;
4516
+ const host = document.getElementById("graph");
4517
+ const pane = host ? host.getBoundingClientRect() : { left: 0, top: 0, right: window.innerWidth, bottom: window.innerHeight };
4518
+ const coveredBelow = kioskShot && kioskShot.insets ? Math.max(0, kioskShot.insets.bottom || 0) : 0;
4519
+ const bottom = Math.min(pane.bottom, window.innerHeight - coveredBelow);
4520
+ const view = { left: Math.max(0, pane.left), top: Math.max(0, pane.top), width: Math.min(window.innerWidth, pane.right) - Math.max(0, pane.left), height: bottom - Math.max(0, pane.top) };
4521
+ for (const g of svg.querySelectorAll("g[data-tg-read-pill]")) {
4522
+ const lead = g.querySelector(":scope > line");
4523
+ const dot = g.querySelector(":scope > circle");
4524
+ const body = g.querySelector(":scope > rect");
4525
+ if (!lead || !dot || !body) continue;
4526
+ // Where the draw put it, kept on the group: each pass starts from there.
4527
+ if (!g.dataset.tgAt) {
4528
+ const m = /translate\(([-\d.e]+)[ ,]+([-\d.e]+)\)/.exec(g.getAttribute("transform") || "");
4529
+ if (!m) continue;
4530
+ g.dataset.tgAt = `${m[1]} ${m[2]} ${lead.getAttribute("x1")} ${lead.getAttribute("y1")} ${lead.getAttribute("x2")} ${lead.getAttribute("y2")}`;
4531
+ }
4532
+ const [cx, cy, lx1, ly1, lx2, ly2] = g.dataset.tgAt.split(" ").map(Number);
4533
+ const set = (x, y) => {
4534
+ g.setAttribute("transform", `translate(${x} ${y})`);
4535
+ const ax = cx + lx1 - x;
4536
+ const ay = cy + ly1 - y;
4537
+ const bx = Number(body.getAttribute("x"));
4538
+ const by = Number(body.getAttribute("y"));
4539
+ const near = tgNearestOn({ x: bx, y: by, x2: bx + Number(body.getAttribute("width")), y2: by + Number(body.getAttribute("height")) }, { x: ax, y: ay });
4540
+ const moved = x !== cx || y !== cy;
4541
+ lead.setAttribute("x1", String(ax));
4542
+ lead.setAttribute("y1", String(ay));
4543
+ lead.setAttribute("x2", String(moved ? near.x : lx2));
4544
+ lead.setAttribute("y2", String(moved ? near.y : ly2));
4545
+ dot.setAttribute("cx", String(ax));
4546
+ dot.setAttribute("cy", String(ay));
4547
+ };
4548
+ set(cx, cy);
4549
+ g.style.display = ""; // measured where it is drawn, then hidden again below if its reader is out of view
4550
+ if (!(view.width > 0 && view.height > 0)) continue;
4551
+ const d = dot.getBoundingClientRect();
4552
+ const dx0 = d.left + d.width / 2;
4553
+ const dy0 = d.top + d.height / 2;
4554
+ const off = dx0 < view.left || dx0 > view.left + view.width || dy0 < view.top || dy0 > view.top + view.height;
4555
+ g.classList.toggle("tg-off", off);
4556
+ // Gone at once, whatever its fade or flash is doing (an opacity rule lost to a running transition on the kiosk).
4557
+ g.style.display = off ? "none" : "";
4558
+ if (off) continue;
4559
+ const r = body.getBoundingClientRect();
4560
+ const { dx, dy } = shiftInto({ left: r.left, top: r.top, width: r.width, height: r.height }, view, 8);
4561
+ if (dx || dy) set(cx + dx / scale, cy + dy / scale);
4562
+ }
4563
+ // behold#748's outside mark, the same way: its box and tag slide in (its ring stays on the card, its leader's
4564
+ // card end too). It was 2px over the frame's top on /choudoufu-fanout at the end of the run.
4565
+ for (const g of svg.querySelectorAll("g[data-tg-outside]")) {
4566
+ const ring = g.firstElementChild;
4567
+ const lead = g.querySelector(":scope > line");
4568
+ const moving = [...g.children].filter((c) => c !== ring && c !== lead && c.localName !== "circle" && c.localName !== "title");
4569
+ if (!moving.length) continue;
4570
+ if (!g.dataset.tgAt) g.dataset.tgAt = lead ? `${lead.getAttribute("x2")} ${lead.getAttribute("y2")}` : "";
4571
+ for (const c of moving) c.removeAttribute("transform");
4572
+ if (lead && g.dataset.tgAt) {
4573
+ const [x2, y2] = g.dataset.tgAt.split(" ");
4574
+ lead.setAttribute("x2", x2);
4575
+ lead.setAttribute("y2", y2);
4576
+ }
4577
+ if (!(view.width > 0 && view.height > 0)) continue;
4578
+ const rs = moving.map((c) => c.getBoundingClientRect()).filter((r) => r.width > 0);
4579
+ if (!rs.length) continue;
4580
+ const left = Math.min(...rs.map((r) => r.left));
4581
+ const top = Math.min(...rs.map((r) => r.top));
4582
+ const box = { left, top, width: Math.max(...rs.map((r) => r.right)) - left, height: Math.max(...rs.map((r) => r.bottom)) - top };
4583
+ const { dx, dy } = shiftInto(box, view, 8);
4584
+ if (!dx && !dy) continue;
4585
+ for (const c of moving) c.setAttribute("transform", `translate(${dx / scale} ${dy / scale})`);
4586
+ if (lead && g.dataset.tgAt) {
4587
+ const [x2, y2] = g.dataset.tgAt.split(" ").map(Number);
4588
+ lead.setAttribute("x2", String(x2 + dx / scale));
4589
+ lead.setAttribute("y2", String(y2 + dy / scale));
4590
+ }
4591
+ }
4488
4592
  }
4489
4593
  let tgReadWired = false;
4490
4594
  function wireTgReadHover() {
@@ -4503,9 +4607,11 @@ function ensureTgReadStyle() {
4503
4607
  st.id = "tg-read-style";
4504
4608
  st.textContent = `#graph g[data-tg-read-pill] { opacity: 0; }
4505
4609
  #graph g[data-tg-read-pill].tg-hot, #graph g[data-tg-read-pill].tg-shown { opacity: 1 !important; }
4610
+ #graph g[data-tg-read-pill].tg-off { opacity: 0 !important; animation: none; }
4506
4611
  #graph g[data-tg-read-pill].tg-hot { transition: opacity .15s ease; }
4507
4612
  #graph g[data-tg-read-pill].tg-flash { animation: tg-read-flash 6s linear both; }
4508
4613
  #graph line[data-tg-read].tg-hot { stroke-width: 5; filter: drop-shadow(0 0 3px var(--bg)); }
4614
+ #graph g[data-tg-read-covers] { display: none !important; }
4509
4615
  @keyframes tg-read-flash { 0% { opacity: 0; } 4%, 80% { opacity: 1; } 100% { opacity: 0; } }
4510
4616
  @keyframes tg-read-flash-step { 0%, 99.9% { opacity: 1; } 100% { opacity: 0; } }
4511
4617
  @media (prefers-reduced-motion: reduce) {
@@ -4522,6 +4628,7 @@ function chantEdgePoints(svg) {
4522
4628
  const inv = toSvg.inverse();
4523
4629
  const out = [];
4524
4630
  for (const path of svg.querySelectorAll("path.pin-edge-line")) {
4631
+ if (path.closest("[data-tg-read-covers]")) continue; // behold#762: hidden, a read line stands for it
4525
4632
  let len = 0;
4526
4633
  try {
4527
4634
  len = path.getTotalLength();
@@ -5276,6 +5383,7 @@ function kioskPopRender() {
5276
5383
  const content = !card || !answer ? null : kioskCompMode() ? rootPopover(answer, kioskRootOfComponent(id), resourcesByComponent[id]) : resourcePopover(answer, id);
5277
5384
  if (!content) {
5278
5385
  if (pop) pop.hidden = true;
5386
+ kioskTellPop(pop);
5279
5387
  return;
5280
5388
  }
5281
5389
  if (!pop) {
@@ -5336,12 +5444,34 @@ function kioskPopRender() {
5336
5444
  const touchOnly = typeof matchMedia === "function" && matchMedia("(hover: none)").matches;
5337
5445
  add("p", "k-pop-hint", kioskPop.pinned ? (touchOnly ? POP_WORDS.tapPinnedHint : POP_WORDS.pinnedHint) : POP_WORDS.pinHint);
5338
5446
  pop.hidden = false;
5447
+ // behold#764: measured at its own height, then capped (its body scrolls) when the frame's view is shorter.
5448
+ pop.style.maxHeight = "";
5339
5449
  const cb = card.getBoundingClientRect();
5340
5450
  const pb = pop.getBoundingClientRect();
5341
- const at = placePopover({ left: cb.left, top: cb.top, width: cb.width, height: cb.height }, { width: pb.width, height: pb.height }, { width: window.innerWidth, height: window.innerHeight });
5451
+ // The part of the frame that shows: Watch's caption and track cover its bottom (the shot's insets), unless that leaves too little.
5452
+ const coveredBelow = kioskShot && kioskShot.insets ? Math.max(0, kioskShot.insets.bottom || 0) : 0;
5453
+ const height = window.innerHeight - coveredBelow >= 240 ? window.innerHeight - coveredBelow : window.innerHeight;
5454
+ const at = placePopover({ left: cb.left, top: cb.top, width: cb.width, height: cb.height }, { width: pb.width, height: pb.height }, { width: window.innerWidth, height });
5455
+ pop.style.maxHeight = at.maxHeight ? `${Math.floor(at.maxHeight)}px` : "";
5342
5456
  pop.style.left = `${Math.round(at.left)}px`;
5343
5457
  pop.style.top = `${Math.round(at.top)}px`;
5458
+ kioskTellPop(pop);
5459
+ }
5460
+ /** behold#764: tell the kiosk where the card's details popover is (or that none is open), so its modals never cover it. */
5461
+ function kioskTellPop(pop) {
5462
+ if (!embedOpts.bare || !embedOpts.host || window.parent === window) return;
5463
+ const r = pop && !pop.hidden ? pop.getBoundingClientRect() : null;
5464
+ const at = r && r.width ? { x: Math.round(r.left), y: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height) } : null;
5465
+ const key = JSON.stringify(at);
5466
+ if (key === kioskPopTold) return;
5467
+ kioskPopTold = key;
5468
+ try {
5469
+ window.parent.postMessage({ type: "behold:pop", at }, embedOpts.host);
5470
+ } catch {
5471
+ /* the parent went away */
5472
+ }
5344
5473
  }
5474
+ var kioskPopTold = "null"; // var: kioskPopRender may run before this line is reached
5345
5475
  /** Wire the frame's pointer once: the popover, and the hover links to the kiosk. Bare frames only. */
5346
5476
  // --- behold#571: the kiosk's Watch mode -------------------------------------
5347
5477
  // The kiosk sends a `behold:shot` (web/kiosk-shot.js) with each step: the
@@ -5554,6 +5684,7 @@ function kioskTellBoxes() {
5554
5684
  boxesQueued = false;
5555
5685
  const svg = currentSvg();
5556
5686
  if (!svg) return;
5687
+ tgPillsKeepIn(svg); // behold#764: the camera moved; the shown pills stay in view
5557
5688
  const waves = {};
5558
5689
  const rect = (r) => ({ x: Math.round(r.left), y: Math.round(r.top), w: Math.round(r.width), h: Math.round(r.height) });
5559
5690
  for (const r of svg.querySelectorAll("rect[data-group-id]")) {
@@ -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";
@@ -108,9 +113,18 @@ export const MODAL_STYLE = `
108
113
  /* behold#744: a modal placed off the cards leaves the graph to the pointer (hover a card or a line), not under a sheet that swallows it. */
109
114
  .eh-modal-wrap.eh-modal-placed { align-items: flex-start; justify-content: flex-start; pointer-events: none; }
110
115
  .eh-modal-wrap.eh-modal-placed > .eh-modal { pointer-events: auto; }
116
+ /* behold#764: a card's details popover is open: no sheet over it, and a modal that cannot stand clear of it waits out of sight. */
117
+ .eh-modal-wrap.eh-modal-keep { background: transparent; pointer-events: none; }
118
+ .eh-modal-wrap.eh-modal-keep > .eh-modal { pointer-events: auto; }
119
+ .eh-modal-wrap.eh-modal-yield > .eh-modal { visibility: hidden; pointer-events: none; }
111
120
  .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
121
  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
122
  .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)); }
123
+ /* 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. */
124
+ .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); }
125
+ .eh-modal-highlight .eh-modal-mode { text-transform: uppercase; letter-spacing: 0.08em; }
126
+ .eh-modal-highlight .eh-modal-mode::before { content: "\\2605"; margin-right: 0.45em; }
127
+ .eh-modal-highlight .eh-modal-line { color: var(--fg); line-height: 1.45; }
114
128
  .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
129
  .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
130
  .eh-modal-title { margin: 0 0 0.5em; font-size: 1.35em; }
@@ -149,6 +163,11 @@ export function modalStyle(doc) {
149
163
  * graph's frame) when given, else the window. When no spot clears `avoid`,
150
164
  * the one that covers least of it.
151
165
  */
166
+ /** behold#764: whether box `a` covers any of rect `b` (both `{ left, top, width, height }`). */
167
+ export function coversRect(a, b) {
168
+ return !!a && !!b && a.left < b.left + b.width && a.left + a.width > b.left && a.top < b.top + b.height && a.top + a.height > b.top;
169
+ }
170
+
152
171
  export function modalSpot(win, size, avoid, { prefer = [], bounds = null, margin = 16, step = 24 } = {}) {
153
172
  const grow = (a) => ({ x0: a.left - 12, y0: a.top - 12, x1: a.left + a.width + 12, y1: a.top + a.height + 12 });
154
173
  const rects = (avoid || []).filter((a) => a && a.width > 0 && a.height > 0).map(grow);
@@ -206,9 +225,12 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
206
225
  wrap.appendChild(box);
207
226
  host.appendChild(wrap);
208
227
 
209
- const close = () => {
228
+ // behold#764: who closed it, on its state for onClose: "viewer" (×, Escape, a click on the sheet), else the page
229
+ // (its time, its event, the next modal), so a closed "Waiting on…" stays closed for the wait it was about.
230
+ const close = (by = null) => {
210
231
  if (st.closed) return;
211
232
  st.closed = true;
233
+ st.closedBy = by === "viewer" ? "viewer" : "page";
212
234
  clearTimer(timer);
213
235
  if (watchTimer) clearTimer(watchTimer);
214
236
  if (doc.removeEventListener) doc.removeEventListener("keydown", onKey);
@@ -217,11 +239,11 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
217
239
  onClose(st);
218
240
  };
219
241
  const onKey = (e) => {
220
- if (e && e.key === ESC) close();
242
+ if (e && e.key === ESC) close("viewer");
221
243
  };
222
244
  if (doc.addEventListener) doc.addEventListener("keydown", onKey);
223
245
  wrap.addEventListener("click", (e) => {
224
- if (e && e.target === wrap) close();
246
+ if (e && e.target === wrap) close("viewer");
225
247
  });
226
248
  // Hovered, it holds: its time to close starts again when the pointer leaves.
227
249
  box.addEventListener("pointerenter", () => (st.hovered = true));
@@ -237,7 +259,7 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
237
259
  const x = el("button", "eh-modal-close", "×");
238
260
  x.type = "button";
239
261
  x.setAttribute("aria-label", "Close");
240
- x.addEventListener("click", close);
262
+ x.addEventListener("click", () => close("viewer"));
241
263
  box.appendChild(x);
242
264
  const line = modeLine(mode, kind, { at: data.at, now: t, resolved: st.resolved, outcome: st.outcome, replayAt: data.replayAt, action: data.action, fix: !!data.fix });
243
265
  if (line) box.appendChild(el("p", `eh-modal-mode eh-modal-${mode}`, line));
@@ -257,7 +279,8 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
257
279
  box.appendChild(bar);
258
280
  if (data.progress.words) box.appendChild(el("p", "eh-modal-note", data.progress.words));
259
281
  }
260
- if (kind === "waiting") return;
282
+ // behold#757: a highlight is words to read: no command, no button.
283
+ if (kind === "waiting" || kind === "highlight") return;
261
284
  const routed = mode === "live" && approveRoute(data.gate);
262
285
  // The panel, when there is one, already carries the command.
263
286
  if (data.command && !routed && !(data.panel && mode !== "live")) {
@@ -320,17 +343,42 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
320
343
  }
321
344
  // behold#631: a modal that must keep things in view (a failed card and the cards it blocked) moves off them.
322
345
  const placeClear = () => {
323
- if (typeof data.avoid !== "function" || !box.getBoundingClientRect || !doc.defaultView) return;
346
+ // behold#764: what it must never cover, whatever else it keeps off: the card's details popover a viewer has open.
347
+ const keep = typeof data.keepClear === "function" ? data.keepClear() : null;
348
+ if ((typeof data.avoid !== "function" && !keep) || !box.getBoundingClientRect || !doc.defaultView) {
349
+ // The popover closed: the modal steps back into sight, its sheet as it was.
350
+ if (st.kept && wrap.classList) {
351
+ wrap.classList.toggle("eh-modal-yield", false);
352
+ wrap.classList.toggle("eh-modal-keep", false);
353
+ // Moved off the popover alone (no `avoid` of its own): back to the middle.
354
+ wrap.classList.toggle("eh-modal-placed", false);
355
+ box.style.marginLeft = "";
356
+ box.style.marginTop = "";
357
+ }
358
+ st.kept = false;
359
+ st.yielded = false;
360
+ return;
361
+ }
362
+ // Measured where it would stand: a modal that yielded is hidden, not gone.
324
363
  const r = box.getBoundingClientRect();
325
364
  if (!r.width) return;
326
365
  const win = { w: doc.defaultView.innerWidth, h: doc.defaultView.innerHeight };
327
- const spot = modalSpot(win, { w: r.width, h: r.height }, data.avoid() || [], { prefer: typeof data.prefer === "function" ? data.prefer() || [] : [], bounds: typeof data.bounds === "function" ? data.bounds() : null });
366
+ const avoid = [...(typeof data.avoid === "function" ? data.avoid() || [] : []), ...(keep ? [keep] : [])];
367
+ const spot = modalSpot(win, { w: r.width, h: r.height }, avoid, { prefer: typeof data.prefer === "function" ? data.prefer() || [] : [], bounds: typeof data.bounds === "function" ? data.bounds() : null });
328
368
  wrap.classList.toggle("eh-modal-placed", !!spot);
369
+ wrap.classList.toggle("eh-modal-keep", !!keep);
370
+ st.kept = !!keep;
329
371
  box.style.marginLeft = spot ? `${Math.round(spot.left)}px` : "";
330
372
  box.style.marginTop = spot ? `${Math.round(spot.top)}px` : "";
373
+ // Where no spot clears the popover, the modal steps out of sight until it closes; its sheet never tints over it.
374
+ const at = spot ? { left: spot.left, top: spot.top } : { left: (win.w - r.width) / 2, top: (win.h - r.height) / 2 };
375
+ st.yielded = !!keep && coversRect({ ...at, width: r.width, height: r.height }, keep);
376
+ wrap.classList.toggle("eh-modal-yield", st.yielded);
331
377
  };
332
378
  const tick = () => {
333
379
  if (st.closed) return;
380
+ // behold#764: out of sight behind a details popover, its time to close waits, as a hovered one's does.
381
+ if (st.closeAt !== null && st.yielded) st.closeAt = Math.max(st.closeAt, now() + 2_000);
334
382
  if (st.closeAt !== null && !st.hovered && now() >= st.closeAt) return close();
335
383
  render();
336
384
  placeClear();
@@ -338,6 +386,8 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
338
386
  const timer = setTimer(tick, 250);
339
387
  // The result needs no event to wait for: it closes on its own after its time.
340
388
  if (kind === "applied" && mode !== "live") st.closeAt = now() + MODAL_CLOSE_MS;
389
+ // behold#757: so does a highlight, after its own time (`closeAfter`, ms); hovered, it holds as any modal does.
390
+ if (Number.isFinite(data.closeAfter)) st.closeAt = now() + data.closeAfter;
341
391
  render();
342
392
  placeClear();
343
393
 
@@ -356,7 +406,7 @@ export function openEventModal(host, { mode, kind, data = {}, actions = {}, doc
356
406
  Object.assign(data, next);
357
407
  render();
358
408
  },
359
- close,
409
+ close: () => close(),
360
410
  };
361
411
  return api;
362
412
  }