@intentius/behold 0.29.43 → 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.
Files changed (67) hide show
  1. package/AGENTS.md +77 -0
  2. package/dist/cli.js +4065 -1918
  3. package/package.json +1 -1
  4. package/web/app.js +1469 -74
  5. package/web/carve-narration.js +33 -1
  6. package/web/chant-live-pace.js +138 -0
  7. package/web/chant-live-pace.test.js +116 -0
  8. package/web/chant-pr-marks.js +417 -39
  9. package/web/chant-pr-marks.test.js +208 -4
  10. package/web/collision-marks.js +124 -0
  11. package/web/collision-marks.test.js +89 -0
  12. package/web/cone.js +269 -0
  13. package/web/cone.test.js +213 -0
  14. package/web/dots-live.test.js +151 -1
  15. package/web/dots-lod.js +20 -0
  16. package/web/dots-lod.test.js +19 -1
  17. package/web/dots-scene.js +110 -10
  18. package/web/dots.js +144 -31
  19. package/web/embed.js +1 -1
  20. package/web/event-help-modal.js +98 -3
  21. package/web/event-help-modal.test.js +85 -1
  22. package/web/feature-flags.js +143 -0
  23. package/web/feature-flags.test.js +96 -0
  24. package/web/index.html +33 -0
  25. package/web/kiosk-carve.js +59 -6
  26. package/web/kiosk-demo-frame.test.js +27 -0
  27. package/web/kiosk-event-help-ui.js +186 -20
  28. package/web/kiosk-event-help.js +175 -15
  29. package/web/kiosk-event-help.test.js +58 -1
  30. package/web/kiosk-highlight.test.js +249 -0
  31. package/web/kiosk-metrics.js +4 -3
  32. package/web/kiosk-runs.js +8 -5
  33. package/web/kiosk-shot.js +157 -3
  34. package/web/kiosk-shot.test.js +223 -1
  35. package/web/kiosk-source.js +43 -0
  36. package/web/kiosk-source.test.js +39 -0
  37. package/web/kiosk-story-gate.test.js +44 -0
  38. package/web/kiosk-track.js +312 -0
  39. package/web/kiosk-track.test.js +148 -0
  40. package/web/kiosk-unknown-step.test.js +58 -0
  41. package/web/kiosk-vendor.js +73 -4
  42. package/web/kiosk-vendor.test.js +103 -3
  43. package/web/kiosk-watch.js +154 -1
  44. package/web/kiosk-watch.test.js +53 -1
  45. package/web/kiosk.html +57 -22
  46. package/web/kiosk.js +583 -53
  47. package/web/kiosk.test.js +2 -1
  48. package/web/small-stage.test.js +150 -0
  49. package/web/terragucci-blocked.test.js +192 -0
  50. package/web/terragucci-change.js +197 -17
  51. package/web/terragucci-components-live.js +189 -13
  52. package/web/terragucci-live-pace.js +92 -0
  53. package/web/terragucci-wave-results.test.js +125 -0
  54. package/web/terralith.html +7 -7
  55. package/web/tg-outside.js +124 -0
  56. package/web/tg-outside.test.js +100 -0
  57. package/web/tg-read-pills.js +145 -0
  58. package/web/tg-read-pills.test.js +158 -0
  59. package/web/theme.js +13 -1
  60. package/web/theme.test.js +21 -1
  61. package/web/tooltip.js +19 -7
  62. package/web/tooltip.test.js +15 -0
  63. package/web/tours/terralith.json +4 -4
  64. package/web/trunk-lane.test.js +1 -1
  65. package/web/view-url.js +8 -2
  66. package/web/why.js +129 -1
  67. package/web/why.test.js +113 -1
package/web/dots-lod.js CHANGED
@@ -120,3 +120,23 @@ export function railPos(vbW, marks) {
120
120
  if (vbW <= marks.resources) return Math.max(0, Math.min(0.5, (0.5 * (l(vbW) - l(marks.cards))) / (l(marks.resources) - l(marks.cards))));
121
121
  return Math.max(0.5, Math.min(1, 0.5 + (0.5 * (l(vbW) - l(marks.resources))) / (l(marks.estates) - l(marks.resources))));
122
122
  }
123
+
124
+ /** How much past the legible card size the director may frame a small stage: enough to fill it, not so much that a card is a poster. */
125
+ export const CARDS_FRAME_GROW = 1.6;
126
+
127
+ /**
128
+ * The director's zoom (screen px per viewBox unit) for a box it frames.
129
+ * `fit`: the zoom that fits the box in the stage; `dotsCap`: the closest it
130
+ * goes while dots must stay dots; `cardsAt`: the zoom at which each card is
131
+ * wide enough to read its name (the rail's Cards mark), or null when the
132
+ * layer draws no cards. A few resources fit the stage at that zoom: the
133
+ * director frames them as cards, up to CARDS_FRAME_GROW past it. `small`: a
134
+ * small stage (web/dots.js SMALL_STAGE), framed at the zoom that fits even
135
+ * when its cards are still part way to dots, never at the dots cap, which
136
+ * would leave it a third of the size that fits. A big estate keeps the dots
137
+ * framing.
138
+ */
139
+ export function directorScale({ fit, dotsCap, cardsAt = null, small = false, grow = CARDS_FRAME_GROW }) {
140
+ if (cardsAt > 0 && (small || fit >= cardsAt)) return Math.min(fit, cardsAt * grow);
141
+ return Math.min(fit, dotsCap);
142
+ }
@@ -1,5 +1,5 @@
1
1
  import { describe, it, expect } from "vitest";
2
- import { LOD, bandT, smooth, cardMorph, discMorph, morphPoint, discRadius, levelOf, caption, railMarks, railPos } from "./dots-lod.js";
2
+ import { CARDS_FRAME_GROW, LOD, bandT, smooth, cardMorph, discMorph, morphPoint, discRadius, levelOf, caption, railMarks, railPos, directorScale } from "./dots-lod.js";
3
3
 
4
4
  describe("dots level of detail (#712)", () => {
5
5
  it("is a card at or above the card size and a dot at or below the dot size", () => {
@@ -76,3 +76,21 @@ describe("dots level of detail (#712)", () => {
76
76
  expect(railPos(m.estates * 10, m)).toBe(1);
77
77
  });
78
78
  });
79
+
80
+ describe("the director's zoom", () => {
81
+ it("frames a stage that fits at the Cards level as cards, and a big one as dots", () => {
82
+ // 14 resources: the boxes fit at 3x, the cards read from 1.2x.
83
+ expect(directorScale({ fit: 3, dotsCap: 0.4, cardsAt: 1.2 })).toBeCloseTo(1.2 * CARDS_FRAME_GROW);
84
+ expect(directorScale({ fit: 1.5, dotsCap: 0.4, cardsAt: 1.2 })).toBe(1.5);
85
+ // A big estate only fits far out: dots, as before.
86
+ expect(directorScale({ fit: 0.3, dotsCap: 0.4, cardsAt: 1.2 })).toBe(0.3);
87
+ expect(directorScale({ fit: 0.9, dotsCap: 0.4, cardsAt: 1.2 })).toBe(0.4);
88
+ // No cards drawn: the dots cap holds.
89
+ expect(directorScale({ fit: 3, dotsCap: 0.4, cardsAt: null })).toBe(0.4);
90
+ // A small stage whose cards don't quite reach legible size is framed at the zoom that fits, not a third of it
91
+ // (the live terralith: fit 0.33, dots cap 0.1, cards legible at 0.41).
92
+ expect(directorScale({ fit: 0.33, dotsCap: 0.1, cardsAt: 0.41, small: true })).toBe(0.33);
93
+ expect(directorScale({ fit: 0.33, dotsCap: 0.1, cardsAt: 0.41 })).toBe(0.1);
94
+ expect(directorScale({ fit: 3, dotsCap: 0.1, cardsAt: 0.41, small: true })).toBeCloseTo(0.41 * CARDS_FRAME_GROW);
95
+ });
96
+ });
package/web/dots-scene.js CHANGED
@@ -121,6 +121,59 @@ export function choreograph(show, opts = {}) {
121
121
  return once;
122
122
  }
123
123
 
124
+ /**
125
+ * The inner rect a small estate's card grid needs, in pitches: `n` cells
126
+ * `aspect` cell heights wide and `cell` pitches high, in the number of
127
+ * columns that brings the grid nearest `target` (width / height). `{ w, h, cols }`.
128
+ */
129
+ export function cardGridShape(n, { cell, aspect, target = 1.6 }) {
130
+ const m = Math.max(1, n);
131
+ let best = null;
132
+ for (let c = 1; c <= m; c++) {
133
+ const w = c * aspect * cell;
134
+ const h = Math.ceil(m / c) * cell;
135
+ const off = Math.abs(Math.log(w / h / target));
136
+ if (!best || off < best.off - 1e-9) best = { w, h, cols: c, off };
137
+ }
138
+ return { w: best.w, h: best.h, cols: best.cols };
139
+ }
140
+
141
+ /**
142
+ * A small stage's card cells for an estate's resources, in pitches: rows of
143
+ * cells `aspect * cell` wide and `cell` high, centred in the inner rect `r`,
144
+ * in unit order then address, as web/dots-cards.js gridSlots lays the cards.
145
+ */
146
+ export function gridCells(rows, r, { cell, aspect }) {
147
+ const out = new Map();
148
+ const list = [...rows].sort((a, b) => {
149
+ const ka = unitOf(a.address, a.type);
150
+ const kb = unitOf(b.address, b.type);
151
+ return ka < kb ? -1 : ka > kb ? 1 : a.address < b.address ? -1 : a.address > b.address ? 1 : 0;
152
+ });
153
+ const n = list.length;
154
+ if (!n) return out;
155
+ const cw = aspect * cell;
156
+ const cols = Math.max(1, Math.min(n, Math.floor(r.w / cw + 1e-9)));
157
+ const nr = Math.ceil(n / cols);
158
+ const x0 = r.x + (r.w - cols * cw) / 2;
159
+ const y0 = r.y + Math.max(0, (r.h - nr * cell) / 2);
160
+ list.forEach((m, i) => out.set(m.address, { x: x0 + ((i % cols) + 0.5) * cw, y: y0 + (Math.floor(i / cols) + 0.5) * cell }));
161
+ return out;
162
+ }
163
+
164
+ /**
165
+ * Whether a small stage's cards read on a stage of `stage` px: the whole
166
+ * scene framed (the widest shot a tour takes), its cards at least `share` of
167
+ * the width a card's name needs (`need`, px). Too narrow a stage (a phone, two
168
+ * boxes side by side) keeps the dots.
169
+ */
170
+ export function cardsReadable(scene, stage, need, { pad = 3.5, gap = 0.12, share = 0.7 } = {}) {
171
+ const g = scene && scene.cardGrid;
172
+ if (!g || !stage || !(stage.w > 0) || !(stage.h > 0) || !(need > 0)) return false;
173
+ const pp = Math.min(stage.w / (scene.extent.w + 2 * pad), stage.h / (scene.extent.h + 2 * pad));
174
+ return pp * g.cell * (g.aspect - gap) >= need * share;
175
+ }
176
+
124
177
  /**
125
178
  * The scene: the flights, and the layout after every takeoff, in pitches.
126
179
  * `layoutAt(k)` is the layout once the first k landing flights have taken off
@@ -139,14 +192,28 @@ export function buildScene(show, opts = {}) {
139
192
  // Fixed widths: the source's from its first members, each estate's from its last.
140
193
  const width = new Map();
141
194
  const finalSize = new Map();
195
+ // A small stage (`cardGrid`: at most `max` resources, the layer drawing its own cards) is read at the Cards level:
196
+ // each box is as big as its card grid, in the stage's shape, so the director can frame readable cards. The boxes
197
+ // never change size as the carve moves resources, so a card never moves for a box resizing.
198
+ const grid = o.cardGrid && show.roster.length <= o.cardGrid.max ? o.cardGrid : null;
199
+ const minInner = new Map();
200
+ const stageAspect = o.avail && o.avail.w > 0 && o.avail.h > 0 ? o.avail.w / o.avail.h : 1.6;
142
201
  for (const e of estates) {
143
202
  const first = e === source ? membersOf(show.owners0, e) : membersOf(end, e);
144
203
  if (!first.length && e !== source) continue;
145
204
  const us = unitsOf(first);
146
205
  // The source's box takes its cards' shape on the page, so a card's dot has a short way to go.
147
- width.set(e, blockWidth(us, e === source && o.sourceAspect ? o.sourceAspect : 1.3));
148
- const p = packBlock(us, { width: width.get(e), fromEnd: e === source });
149
- finalSize.set(e, { w: p.w + 2 * BOX.pad, h: p.h + 2 * BOX.pad + BOX.title });
206
+ let wd = blockWidth(us, e === source && o.sourceAspect ? o.sourceAspect : 1.3);
207
+ if (grid) {
208
+ // Each box in the stage's own shape: the director frames one box at a time more often than all of them (the source, a landing).
209
+ const g = cardGridShape(first.length, { cell: grid.cell, aspect: grid.aspect, target: stageAspect });
210
+ minInner.set(e, g);
211
+ wd = Math.max(wd, g.w);
212
+ }
213
+ width.set(e, wd);
214
+ const p = packBlock(us, { width: wd, fromEnd: e === source });
215
+ const mi = minInner.get(e);
216
+ finalSize.set(e, { w: Math.max(p.w, mi ? mi.w : 0) + 2 * BOX.pad, h: Math.max(p.h, mi ? mi.h : 0) + 2 * BOX.pad + BOX.title });
150
217
  }
151
218
  const src = finalSize.get(source) ?? { w: 10, h: 10 };
152
219
  const dests = estates.filter((e) => e !== source && finalSize.has(e)).sort();
@@ -201,23 +268,33 @@ export function buildScene(show, opts = {}) {
201
268
  const fromEnd = e === source;
202
269
  const p = packBlock(unitsOf(ms), { width: width.get(e), fromEnd });
203
270
  const o = origin.get(e);
271
+ const mi = minInner.get(e);
272
+ const ih = Math.max(p.h, mi ? mi.h : 0);
204
273
  let bx;
205
274
  let by;
206
275
  if (fromEnd) {
207
276
  // Bottom edge fixed: the source loses its top rows as units leave.
208
277
  bx = o.x;
209
- by = o.y + src.h - (p.h + 2 * BOX.pad + BOX.title);
278
+ by = o.y + src.h - (ih + 2 * BOX.pad + BOX.title);
210
279
  } else {
211
280
  bx = o.x;
212
281
  by = o.y;
213
282
  }
214
283
  const ix = bx + BOX.pad;
215
- const iy = by + BOX.pad + BOX.title + (fromEnd ? p.h : 0);
216
- for (const [addr, s] of p.slots) slots.set(addr, { x: ix + s.x, y: iy + s.y, ...(s.parent ? { parent: s.parent } : {}) });
284
+ const iy = by + BOX.pad + BOX.title + (fromEnd ? ih : 0);
285
+ if (mi && ms.length) {
286
+ // A small stage's box is its card grid: each dot sits at its card's cell (web/dots-cards.js gridSlots, the
287
+ // same order and cells), spread over the box at every zoom, never piled in a corner at the dots' pitch.
288
+ const cells = gridCells(ms, { x: ix, y: by + BOX.pad + BOX.title, w: Math.max(p.w, mi.w), h: ih }, grid);
289
+ for (const [addr, c] of cells) {
290
+ const s = p.slots.get(addr);
291
+ slots.set(addr, { x: c.x, y: c.y, ...(s && s.parent ? { parent: s.parent } : {}) });
292
+ }
293
+ } else for (const [addr, s] of p.slots) slots.set(addr, { x: ix + s.x, y: iy + s.y, ...(s.parent ? { parent: s.parent } : {}) });
217
294
  // The source's box narrows to the dots it still holds once its last row is partial.
218
295
  let x0 = bx;
219
- let w = Math.max(p.w, ms.length ? 0 : 4) + 2 * BOX.pad;
220
- if (fromEnd && ms.length) {
296
+ let w = Math.max(p.w, ms.length ? 0 : 4, mi ? mi.w : 0) + 2 * BOX.pad;
297
+ if (fromEnd && ms.length && !mi) {
221
298
  let lo = Infinity;
222
299
  for (const [, sl] of p.slots) lo = Math.min(lo, sl.x);
223
300
  const cellHalf = 1.5;
@@ -225,14 +302,37 @@ export function buildScene(show, opts = {}) {
225
302
  x0 = bx + left;
226
303
  w = p.w - left + 2 * BOX.pad;
227
304
  }
228
- boxes.set(e, { x: x0, y: by, w, h: p.h + 2 * BOX.pad + BOX.title, members: ms.length });
305
+ boxes.set(e, { x: x0, y: by, w, h: ih + 2 * BOX.pad + BOX.title, members: ms.length });
229
306
  }
230
307
  const out = { k: kk, slots, boxes, owners };
231
308
  if (cache.size > 2000) cache.clear();
232
309
  cache.set(kk, out);
233
310
  return out;
234
311
  };
235
- return { show, flights, landing, estates, source, layoutAt, extent: { w: extentW, h: extentH }, sourceBox: src, finalSize, rosterBy };
312
+ return { show, flights, landing, estates, source, layoutAt, extent: { w: extentW, h: extentH }, sourceBox: src, finalSize, rosterBy, cardGrid: grid };
313
+ }
314
+
315
+ function unionBox(a, b) {
316
+ if (!a) return b;
317
+ if (!b) return a;
318
+ const x = Math.min(a.x, b.x);
319
+ const y = Math.min(a.y, b.y);
320
+ return { x, y, w: Math.max(a.x + a.w, b.x + b.w) - x, h: Math.max(a.y + a.h, b.y + b.h) - y };
321
+ }
322
+
323
+ /**
324
+ * The box the director frames for `focus` at show time `t`, in pitches: the
325
+ * whole scene ("all"), the source's box ("source"), or an estate's box (an
326
+ * "estate" the flock flies to, a tour chapter's "box") with the source's, so
327
+ * the flight is in the shot.
328
+ */
329
+ export function focusRect(scene, focus, t) {
330
+ const now = scene.layoutAt(takeoffsBy(scene, t)).boxes;
331
+ const fin = scene.layoutAt(scene.landing.length).boxes;
332
+ const src = now.get(scene.source) || scene.layoutAt(0).boxes.get(scene.source);
333
+ if (focus.kind === "all") return { x: 0, y: 0, w: scene.extent.w, h: scene.extent.h };
334
+ if (focus.kind === "source" || focus.estate === scene.source) return src;
335
+ return unionBox(src, fin.get(focus.estate) || now.get(focus.estate));
236
336
  }
237
337
 
238
338
  /** How many landing flights have taken off by replay time `t` (binary search). */
package/web/dots.js CHANGED
@@ -22,8 +22,8 @@
22
22
 
23
23
  import { readCarve, carveShow, walkthroughShow, phaseAt } from "./dots-recording.js";
24
24
  import { parentsOf } from "./dots-layout.js";
25
- import { buildScene, takeoffsBy, firstLandings, flightPoint, easeInOut, replayClock, BOX } from "./dots-scene.js";
26
- import { cardMorph, discMorph, discRadius, levelOf, caption, railMarks, railPos, lerp, LOD } from "./dots-lod.js";
25
+ import { buildScene, takeoffsBy, firstLandings, flightPoint, easeInOut, replayClock, focusRect, cardsReadable, BOX } from "./dots-scene.js";
26
+ import { cardMorph, discMorph, discRadius, levelOf, caption, railMarks, railPos, lerp, LOD, directorScale } from "./dots-lod.js";
27
27
  import { perimeter, pointAt, nearestS, segment } from "./dots-border.js";
28
28
  import { getTokens, onThemeChange, contrast, hexToOklch, oklchToHex } from "./theme.js";
29
29
  import { LOOP, carveStory, beatAt, tipsBetween, directorFocus, shortName as shortOf, liveBeat, liveTipsBetween, liveEndTip, LIVE_HOLD_MS } from "./dots-kiosk.js";
@@ -31,7 +31,8 @@ import { liveShow, stampArrivals, showKey, currentMigration, boxName, playedCoun
31
31
  import { provenanceText, migrationTool, stepMsFor } from "./tour-player.js";
32
32
  import { tourNow, tourFocus, tourFx, fxKey, tourMessage } from "./dots-tour.js";
33
33
  import { wallTicks, recordedLabel, recordedMarks, speedWords, skippedWords, clockWords, RECORDED_SPEEDS } from "./dots-timeline.js";
34
- import { cardLabel, cardShape, cardText, cardTextAlpha, pickMark, cardsMark, cardsFrame, cardsEstate, middleCard, gridScale, gridSlots, cardSize, cardNeed, rosterLod, unitKeyOf, minViewWidth, tipSpot, CARD_TEXT } from "./dots-cards.js";
34
+ import { resourceLight, rootLight } from "./cone.js";
35
+ import { GRID, cardLabel, cardShape, cardText, cardTextAlpha, pickMark, cardsMark, cardsFrame, cardsEstate, middleCard, gridScale, gridSlots, cardSize, cardNeed, rosterLod, unitKeyOf, minViewWidth, tipSpot, CARD_TEXT } from "./dots-cards.js";
35
36
 
36
37
  /** #715: how often the live layer asks for the carve. The route shares one read for 1.5 s while a migration runs. */
37
38
  export const LIVE_POLL_MS = 2_000;
@@ -49,11 +50,76 @@ const DRAW_MS = 650;
49
50
  const LINGER_MS = 2600;
50
51
  /** A viewer's hand on the camera (a wheel, a pinch, a drag, a rail mark) holds the director and the tour off until this long after their last input. */
51
52
  export const VIEWER_HOLD_MS = 8_000;
53
+ /**
54
+ * A small stage: a carve of at most `max` resources, on a layer that draws its own cards, is read at the Cards
55
+ * level. Each estate's box is laid out as its card grid, cells `cell` pitches high and `aspect` wide, in the
56
+ * stage's shape (web/dots-scene.js cardGridShape), and the director frames it at the zoom that fits, up to
57
+ * CARDS_FRAME_GROW past the legible card size (web/dots-lod.js directorScale). A bigger estate keeps the dots.
58
+ */
59
+ export const SMALL_STAGE = { max: 40, cell: 6, aspect: GRID.aspect };
60
+
61
+ /** Whether the scene on stage is a small one: laid out as SMALL_STAGE's card grid (sceneFor). */
62
+ function smallStage() {
63
+ return !!(S && S.seedless && S.scene && S.scene.cardGrid);
64
+ }
65
+
66
+ /**
67
+ * The scene for a show: a small stage's card grid when the layer draws its own cards, the show is small, and its
68
+ * cards read on this stage at the widest shot (dots-scene.js cardsReadable); else the dots' own layout, as before.
69
+ */
70
+ function sceneFor(show, opts, seedless) {
71
+ if (seedless && show.roster.length <= SMALL_STAGE.max && opts.stage) {
72
+ const sc = buildScene(show, { ...opts, cardGrid: SMALL_STAGE });
73
+ if (cardsReadable(sc, opts.stage, rosterNeed(show.roster))) return sc;
74
+ }
75
+ return buildScene(show, opts);
76
+ }
77
+
78
+ /** The card width a roster's names need (dots-cards.js cardNeed), measured before the layer has a canvas of its own. */
79
+ function rosterNeed(roster) {
80
+ if (typeof document === "undefined") return 0;
81
+ const cv = document.createElement("canvas").getContext("2d");
82
+ if (!cv) return 0;
83
+ const font = (S && S.font) || getComputedStyle(document.body).fontFamily || "sans-serif";
84
+ return cardNeed(roster.map((r) => cardLabel(r)), (txt, px, weight) => {
85
+ cv.font = `${weight} ${px}px ${font}`;
86
+ return cv.measureText(txt).width;
87
+ });
88
+ }
52
89
 
53
90
  export function dotsActive() {
54
91
  return !!S;
55
92
  }
56
93
 
94
+ /** Report minor 34: the cone plan's lights (web/cone.js coneLights), set by the frame while it draws a pull request's plan; null otherwise. Kept across a remount. */
95
+ let coneNow = null;
96
+
97
+ /** The frame's cone lights, or null: planned resources lit, the rest of their root dimmed, a root not planned dimmed. */
98
+ export function setDotsCone(lights) {
99
+ coneNow = lights || null;
100
+ if (S) S.dirty = true;
101
+ }
102
+
103
+ /** Each box's root, from the carve's rosters (estates.json's `root`); an adopted stock root's box answers for its estate too. */
104
+ function rootsOfBoxes() {
105
+ const out = new Map();
106
+ const alias = new Map(((S.answer && S.answer.adopted) || []).map((a) => [a.to, a.from]));
107
+ for (const e of (S.answer && S.answer.estates) || []) {
108
+ if (!e.root) continue;
109
+ out.set(e.estate, e.root);
110
+ if (alias.has(e.estate)) out.set(alias.get(e.estate), e.root);
111
+ }
112
+ return out;
113
+ }
114
+
115
+ /** A cone light's glow on a dot or a card: planned lit, a changed one ringed, the rest dimmed (cone.js resourceLight). */
116
+ export function coneGlow(light, colour) {
117
+ if (light === "changed") return { colour, a: 1, ring: true, dim: false };
118
+ if (light === "lit") return { colour, a: 0.85, ring: false, dim: false };
119
+ if (light === "dim") return { colour, a: 0, ring: false, dim: true };
120
+ return null;
121
+ }
122
+
57
123
  /** How far past the fit the zoom may go out, as a multiple of the fit's width; null when not mounted. */
58
124
  export function dotsZoomOutFactor() {
59
125
  return S ? S.zoomOut : null;
@@ -132,6 +198,8 @@ function addStyle() {
132
198
  .dots-keep-bar .dots-bar { opacity: 0.55; transition: opacity 0.2s; }
133
199
  .dots-rail { transition: opacity 0.4s; }
134
200
  .dots-directing .dots-rail { opacity: 0; pointer-events: none; }
201
+ /* The kiosk's Watch holds one framing of a small stage (web/app.js kioskShotBox): no zoom to pick, and the docked column sits where the rail would. */
202
+ html.kiosk-held .dots-rail { opacity: 0; pointer-events: none; }
135
203
  .dots-keep-bar .dots-bar:hover, .dots-keep-bar .dots-bar:focus-within { opacity: 1; }
136
204
  /* In Watch the director holds the camera; the rail is Inspect's. */
137
205
  .dots-kiosk.dots-watch:not(.dots-keep-bar) .dots-rail { display: none; }
@@ -297,12 +365,16 @@ export async function mountDots({ host, svg, meta, getVB, setVB, vbInit, source
297
365
  }
298
366
  widths.sort((a, b) => a - b);
299
367
  const cardW = widths[widths.length >> 1] || 200;
368
+ // A small live stage reads as the roster's own cards in their estates' boxes, whichever view is served under it:
369
+ // a team repo's view (the team beat) draws its roots' resources as cards of its own, which would otherwise be the
370
+ // card level, at their places on the page, and the director would keep the stage at the dots. They keep the pitch.
371
+ if (live && show.roster.length <= SMALL_STAGE.max) cards.clear();
300
372
  const boxEl = svg.querySelector(`rect[data-group-id="${CSS.escape(show.source)}"]`) || svg.querySelector("rect[data-group-id]");
301
373
  const mbox = boxEl
302
374
  ? { x: +boxEl.getAttribute("x"), y: +boxEl.getAttribute("y"), w: +boxEl.getAttribute("width"), h: +boxEl.getAttribute("height") }
303
375
  : { x: vbInit[0], y: vbInit[1], w: vbInit[2], h: vbInit[3] };
304
376
  // The source estate's box takes its cards' box's place and shape on the page.
305
- const scene = buildScene(show, { sourceAspect: mbox.w / Math.max(1, mbox.h), ...labelRoom(host) });
377
+ const scene = sceneFor(show, { sourceAspect: mbox.w / Math.max(1, mbox.h), ...labelRoom(host) }, cards.size === 0);
306
378
  const src = scene.sourceBox;
307
379
  // One dot pitch is a fixed share of a card's width, so a dot is legible exactly
308
380
  // when its card stops being: at the dot size a pitch is about 8 px, whatever
@@ -475,7 +547,7 @@ export async function mountDots({ host, svg, meta, getVB, setVB, vbInit, source
475
547
  const setInsets = (ins) => {
476
548
  if (S) S.insets = { top: Number(ins.top) || 0, bottom: Number(ins.bottom) || 0 };
477
549
  };
478
- window.__dots = { select: (id) => selectDot(id), landed: () => S && landedIds(), seek, play, step, zoomTo, zoomCardPx, setInsets, pause: () => play(false), fly, setSpeed, stats: () => S && S.stats, length: () => S && S.clock.length, marks: () => S && currentMarks(), state: () => S && { t: S.t, level: S.level, reduced: S.reduced, cardPx: S.cardPx, pitchPx: S.pitchPx, rosterCards: S.own, rosterCardPx: S.rosterCardPx, directing: !!S.directing }, debug: () => S && { band: (({ left, right, w }) => ({ left, right, w }))(band()), svg: S.svg.getBoundingClientRect().toJSON(), rail: S.ui.querySelector('.dots-rail').getBoundingClientRect().toJSON(), vb: S.getVB(), dir: S.dir, directing: S.directing, focusBox: S.dir && focusBox(S.dir.focus), want: S.dir && frameBox(focusBox(S.dir.focus)), pitch: S.pitch, origin: S.origin }, story: () => S && S.story && { start: S.story.start, end: S.story.end, firstRefusal: S.story.firstRefusal ? S.story.firstRefusal.end : null } };
550
+ window.__dots = { cone: () => S && S.coneShown, select: (id) => selectDot(id), landed: () => S && landedIds(), seek, play, step, zoomTo, zoomCardPx, setInsets, pause: () => play(false), fly, setSpeed, stats: () => S && S.stats, length: () => S && S.clock.length, marks: () => S && currentMarks(), state: () => S && { t: S.t, level: S.level, reduced: S.reduced, cardPx: S.cardPx, pitchPx: S.pitchPx, rosterCards: S.own, rosterCardPx: S.rosterCardPx, directing: !!S.directing }, debug: () => S && { band: (({ left, right, w }) => ({ left, right, w }))(band()), svg: S.svg.getBoundingClientRect().toJSON(), rail: S.ui.querySelector('.dots-rail').getBoundingClientRect().toJSON(), vb: S.getVB(), dir: S.dir, directing: S.directing, focusBox: S.dir && focusBox(S.dir.focus), want: S.dir && frameBox(focusBox(S.dir.focus)), pitch: S.pitch, origin: S.origin, frame: S.frameNums || null, smallStage: smallStage(), roster: S.show.roster.length }, story: () => S && S.story && { start: S.story.start, end: S.story.end, firstRefusal: S.story.firstRefusal ? S.story.firstRefusal.end : null } };
479
551
  const loop = (wall) => {
480
552
  if (!S) return;
481
553
  S.raf = requestAnimationFrame(loop);
@@ -559,6 +631,8 @@ function labelRoom(host) {
559
631
  labelPx: (e) => cv.measureText(`${e} 000`).width + 12,
560
632
  labelH: 18,
561
633
  avail: { w: r.width * 0.72, h: Math.max(80, r.height - (ins.top || 0) - (ins.bottom || 0) - 32) },
634
+ // The stage the director frames in: the pane less the zoom rail's band and its margins, clear of the caption.
635
+ stage: { w: Math.max(40, r.width - 182), h: Math.max(40, r.height - (ins.top || 0) - (ins.bottom || 0) - 16) },
562
636
  };
563
637
  }
564
638
 
@@ -1033,7 +1107,7 @@ function fitRosterCards() {
1033
1107
  const n = sc.landing.length;
1034
1108
  const ks = new Set([0, n]);
1035
1109
  for (let j = 1; j < 40; j++) ks.add(Math.round((n * j) / 40));
1036
- S.gridK = gridScale([...ks].map((k) => sc.layoutAt(k)), S.unitKey);
1110
+ S.gridK = gridScale([...ks].map((k) => sc.layoutAt(k)), S.unitKey, smallStage() ? { maxK: SMALL_STAGE.cell } : {});
1037
1111
  const c = cardSize(S.gridK);
1038
1112
  S.rc = { w: c.w * S.pitch, h: c.h * S.pitch };
1039
1113
  const ctx = S.ctx;
@@ -1110,14 +1184,16 @@ function linesOf(ctx, a, sh) {
1110
1184
  * rect in its estate's colour, which pales to a tint on the page's surface as the name and the type fade in. The
1111
1185
  * marks a dot wears (a tour's light, the adoption's ring, the selection, a takeoff) go round the card.
1112
1186
  */
1113
- function drawRosterCard(ctx, a, sh, u, { vis, colour, glow, ring, selected, takeoff }) {
1187
+ function drawRosterCard(ctx, a, sh, u, { vis: vis0, colour, glow, ring, selected, takeoff }) {
1114
1188
  const col = S.col;
1115
1189
  const round = (o) => roundRect(ctx, sh.x - o, sh.y - o, sh.w + 2 * o, sh.h + 2 * o, sh.r + o);
1190
+ // A card the plan planned but does not change steps back beside the one it changes.
1191
+ const vis = glow && glow.dim ? vis0 * 0.55 : vis0;
1116
1192
  if (glow) {
1117
- ctx.globalAlpha = vis * glow.a * 0.7;
1193
+ ctx.globalAlpha = vis * glow.a * (glow.ring ? 1 : 0.7);
1118
1194
  ctx.strokeStyle = glow.colour;
1119
- ctx.lineWidth = 3;
1120
- round(3);
1195
+ ctx.lineWidth = glow.ring ? 4.5 : 3;
1196
+ round(glow.ring ? 4 : 3);
1121
1197
  ctx.stroke();
1122
1198
  }
1123
1199
  round(0);
@@ -1338,8 +1414,11 @@ function draw(dt) {
1338
1414
  const titlePx = BOX.title * P * s;
1339
1415
  // Where each box's label went, so a Tips bubble keeps off it (web/carve-narration.js).
1340
1416
  const labelPx = new Map();
1417
+ // Report minor 34: a box whose root the pull request did not plan, while a cone plan is drawn: dimmed, and said.
1418
+ const boxRoots = coneNow ? rootsOfBoxes() : null;
1419
+ const notPlanned = (e) => !!boxRoots && boxRoots.has(e) && rootLight(coneNow, boxRoots.get(e)) === "dim";
1341
1420
  for (const [e, b] of boxes) {
1342
- const a = dotLayerA * (1 - (td.get(e) ?? 0));
1421
+ const a = dotLayerA * (1 - (td.get(e) ?? 0)) * (notPlanned(e) ? 0.5 : 1);
1343
1422
  if (a <= 0.01) continue;
1344
1423
  const c = col.estate.get(e) || col.neutral;
1345
1424
  const bp = boxPx(b);
@@ -1398,7 +1477,7 @@ function draw(dt) {
1398
1477
  ctx.textBaseline = "middle";
1399
1478
  ctx.textAlign = "left";
1400
1479
  let nm = shortName(e);
1401
- const cnt = fmt(Math.max(0, counts.get(e) ?? 0));
1480
+ const cnt = `${fmt(Math.max(0, counts.get(e) ?? 0))}${notPlanned(e) ? " · not planned" : ""}`;
1402
1481
  let nw = ctx.measureText(nm).width;
1403
1482
  const cw = ctx.measureText(cnt).width;
1404
1483
  const tw = nw + fs * 0.5 + cw;
@@ -1501,11 +1580,30 @@ function draw(dt) {
1501
1580
  }
1502
1581
  // The tour's lights: each resource the chapter's plan planned, brighter where the plan changes it.
1503
1582
  const fx = currentFx(owners);
1583
+ // A plan that changes some of what it planned (the team beat: one inline policy of team B's five resources) lights
1584
+ // the changed cards and dims the rest, so "only this changes" reads on the cards.
1585
+ const anyChanged = !!fx && [...fx.lights.values()].some((l) => l.changed);
1504
1586
  if (fx) for (const [id, l] of fx.lights) {
1505
1587
  const prev = glow.get(id);
1506
- const g = { colour: col.foreign, a: l.changed ? 1 : 0.85, ring: l.changed };
1588
+ const g = tourGlow(l, anyChanged, col.foreign);
1507
1589
  if (!prev || g.a >= prev.a) glow.set(id, g);
1508
1590
  }
1591
+ // Report minor 34: a cone plan's lights, from the frame (setDotsCone). Planned resources lit, the rest dimmed, never hidden.
1592
+ const coneShown = coneNow ? { lit: [], changed: [], dim: [], notPlanned: [] } : null;
1593
+ if (coneNow) {
1594
+ const rootOfBox = rootsOfBoxes();
1595
+ for (const [e, root] of rootOfBox) if (rootLight(coneNow, root) === "dim" && boxes.has(e)) coneShown.notPlanned.push(e);
1596
+ for (const a of addrs) {
1597
+ const root = rootOfBox.get(owners.get(a) ?? scene.source);
1598
+ const light = root ? resourceLight(coneNow, root, a.replace(/#\d+$/, "")) : null;
1599
+ const g = coneGlow(light, col.pending);
1600
+ if (!g) continue;
1601
+ coneShown[light === "changed" ? "changed" : light].push(a);
1602
+ const prev = glow.get(a);
1603
+ if (!prev || g.a >= prev.a) glow.set(a, g);
1604
+ }
1605
+ }
1606
+ S.coneShown = coneShown;
1509
1607
  ctx.globalAlpha = 1;
1510
1608
  const refusedLit = [];
1511
1609
  S.cellMoving = false;
@@ -1611,12 +1709,21 @@ function draw(dt) {
1611
1709
  const margin = shape ? 20 + shape.w / 2 : 20;
1612
1710
  if (q.x < -margin || q.y < -margin || q.x > W + margin || q.y > H + margin) continue;
1613
1711
  const g = glow.get(a);
1614
- if (f || g) markLit(est);
1712
+ if (f || (g && !g.dim)) markLit(est);
1615
1713
  if (vis <= 0.01) continue;
1616
1714
  if (shape) {
1617
1715
  drawRosterCard(ctx, a, shape, u, { vis, colour, glow: g, ring: rings.has(a), selected: a === S.selected, takeoff: flying ? (t - f.start) / (f.end - f.start) : 1 });
1618
1716
  continue;
1619
1717
  }
1718
+ // A cone plan's dimmed dot: faded, still drawn.
1719
+ if (g && g.dim) {
1720
+ ctx.globalAlpha = vis * 0.35;
1721
+ ctx.fillStyle = colour;
1722
+ ctx.beginPath();
1723
+ ctx.arc(q.x, q.y, rDot, 0, Math.PI * 2);
1724
+ ctx.fill();
1725
+ continue;
1726
+ }
1620
1727
  if (g) {
1621
1728
  ctx.globalAlpha = vis * g.a * 0.6;
1622
1729
  ctx.fillStyle = g.colour;
@@ -1936,8 +2043,11 @@ function frameBox(b) {
1936
2043
  const bottom = S.insets.bottom + 8 + foot;
1937
2044
  const aw = Math.max(40, r.width - left - right - 16);
1938
2045
  const ah = Math.max(40, r.height - top - bottom);
1939
- // Never so close that a card shows again: dots stay dots.
1940
- let s = Math.min(aw / bw, ah / bh, 20 / S.cardW);
2046
+ // Never so close that a card shows again: dots stay dots. Unless the whole shot fits with each roster card wide
2047
+ // enough to read its name (the rail's Cards mark): a few resources are framed as cards, in their estates' boxes.
2048
+ const f = frameNumbers(aw / bw, ah / bh);
2049
+ S.frameNums = f;
2050
+ const s = f.s;
1941
2051
  const vw = r.width / s;
1942
2052
  const vh = r.height / s;
1943
2053
  const vx = bx + bw / 2 - (left + 8 + aw / 2) / s;
@@ -1945,23 +2055,26 @@ function frameBox(b) {
1945
2055
  return [vx, vy, vw, vh];
1946
2056
  }
1947
2057
 
1948
- function unionBox(a, b) {
1949
- if (!a) return b;
1950
- if (!b) return a;
1951
- const x = Math.min(a.x, b.x);
1952
- const y = Math.min(a.y, b.y);
1953
- return { x, y, w: Math.max(a.x + a.w, b.x + b.w) - x, h: Math.max(a.y + a.h, b.y + b.h) - y };
2058
+ /**
2059
+ * A tour light's glow on a dot or a card: a changed resource full and ringed; one the plan only planned, beside a
2060
+ * changed one, faint and dimmed; with nothing changed, every planned one lit alike.
2061
+ */
2062
+ export function tourGlow(light, anyChanged, colour) {
2063
+ if (light.changed) return { colour, a: 1, ring: true, dim: false };
2064
+ return anyChanged ? { colour, a: 0.4, ring: false, dim: true } : { colour, a: 0.85, ring: false, dim: false };
2065
+ }
2066
+
2067
+ /** The director's zoom and what it is made of, for frameBox and __dots.debug(). */
2068
+ function frameNumbers(fitW, fitH) {
2069
+ const fit = Math.min(fitW, fitH);
2070
+ const cardsAt = S.seedless && S.rc && S.rc.w > 0 && S.need > 0 ? (S.need * 1.1) / S.rc.w : null;
2071
+ const dotsCap = 20 / S.cardW;
2072
+ const small = smallStage();
2073
+ return { fit, cardsAt, dotsCap, small, need: S.need ?? null, rc: S.rc ?? null, gridK: S.gridK ?? null, s: directorScale({ fit, dotsCap, cardsAt, small }) };
1954
2074
  }
1955
2075
 
1956
2076
  function focusBox(focus) {
1957
- const sc = S.scene;
1958
- const now = sc.layoutAt(takeoffsBy(sc, S.t)).boxes;
1959
- const fin = sc.layoutAt(sc.landing.length).boxes;
1960
- const src = now.get(sc.source) || sc.layoutAt(0).boxes.get(sc.source);
1961
- if (focus.kind === "all") return { x: 0, y: 0, w: sc.extent.w, h: sc.extent.h };
1962
- if (focus.kind === "source" || focus.estate === sc.source) return src;
1963
- // The estate receiving the flock, with the box it leaves, so the flight is in the shot.
1964
- return unionBox(src, fin.get(focus.estate) || now.get(focus.estate));
2077
+ return focusRect(S.scene, focus, S.t);
1965
2078
  }
1966
2079
 
1967
2080
  function kioskTick(wall, dt) {
@@ -2111,7 +2224,7 @@ function takeLive(answer) {
2111
2224
  S.show.t1 = now;
2112
2225
  return;
2113
2226
  }
2114
- const scene = buildScene(show, { sourceAspect: S.mbox.w / Math.max(1, S.mbox.h), ...labelRoom(S.host) });
2227
+ const scene = sceneFor(show, { sourceAspect: S.mbox.w / Math.max(1, S.mbox.h), ...labelRoom(S.host) }, S.seedless);
2115
2228
  const n = show.roster.length;
2116
2229
  const src = scene.sourceBox;
2117
2230
  S.show = show;
package/web/embed.js CHANGED
@@ -64,7 +64,7 @@ export function viewFromMessage(event, host) {
64
64
  if (typeof v === "boolean") want.radial = v;
65
65
  continue;
66
66
  }
67
- if (k === "env" || k === "gates" || k === "focus" || k === "run") {
67
+ if (k === "env" || k === "gates" || k === "focus" || k === "run" || k === "pull") {
68
68
  // env: null or "" is the source graph. gates: null or "" hands the
69
69
  // gate strip back to the graph's env. focus: null or "" brings nothing forward. run: null or "" draws the newest run again.
70
70
  if (v === null || v === "") want[k] = null;