@intentius/behold 0.30.1 → 0.31.0
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/AGENTS.md +475 -16
- package/README.md +25 -19
- package/demos.json +14 -9
- package/dist/cli.js +54900 -26771
- package/example-carve/README.md +19 -23
- package/example-carve/app/package.json +1 -1
- package/example-carve/app/src/carved.ts +3 -3
- package/example-carve/carve-report.json +1 -1
- package/example-carve/{legacy-tf → tf-root}/terraform.tfstate +1 -1
- package/example-choudoufu-estate/README.md +7 -0
- package/example-choudoufu-estate/chant.workspace.json +1 -1
- package/example-choudoufu-estate/scripts/choudoufu-down.sh +2 -1
- package/example-choudoufu-estate/scripts/choudoufu-up.sh +10 -3
- package/example-terraform-estate/README.md +32 -5
- package/example-terraform-estate/chant.workspace.json +1 -1
- package/example-terraform-estate/recorded/adoption/platform.json +72 -0
- package/example-terraform-estate/recorded/adoption/prod.json +224 -0
- package/example-terralith/README.md +1 -1
- package/example-three-cloud/README.md +111 -18
- package/example-three-cloud/aws/Pulumi.yaml +15 -0
- package/example-three-cloud/aws/index.ts +174 -0
- package/example-three-cloud/aws/package-lock.json +2725 -0
- package/example-three-cloud/aws/package.json +14 -0
- package/example-three-cloud/aws/tsconfig.json +17 -0
- package/example-three-cloud/azure/main.tf +48 -0
- package/example-three-cloud/azure/site.tf +104 -0
- package/example-three-cloud/chant.config.json +9 -0
- package/example-three-cloud/chant.workspace.json +30 -4
- package/example-three-cloud/dns/chant.config.ts +26 -1
- package/example-three-cloud/dns/src/records.component.ts +32 -6
- package/example-three-cloud/package-lock.json +48 -27
- package/example-three-cloud/package.json +8 -6
- package/example-three-cloud/scripts/emulators-up.sh +28 -1
- package/example-three-cloud/scripts/front-door.ts +679 -86
- package/package.json +13 -6
- package/web/adopt-pulumi.js +114 -0
- package/web/adopt-pulumi.test.js +28 -0
- package/web/adopt.js +203 -0
- package/web/adopt.test.js +27 -0
- package/web/app.js +614 -19
- package/web/carve-steps.js +1 -1
- package/web/carve-steps.test.js +2 -2
- package/web/change-set-overlay.js +12 -5
- package/web/change-set-overlay.test.js +22 -0
- package/web/drift-stream.js +241 -0
- package/web/drift-stream.test.js +146 -0
- package/web/edge-weight.d.ts +1 -1
- package/web/edge-weight.js +5 -1
- package/web/edge-weight.test.js +19 -0
- package/web/embed.js +2 -2
- package/web/event-help-modal.js +18 -12
- package/web/event-help-modal.test.js +28 -1
- package/web/graph-query.js +180 -0
- package/web/graph-query.test.js +49 -0
- package/web/graph.html +107 -0
- package/web/index-diff.js +109 -0
- package/web/index-diff.test.js +39 -0
- package/web/index.html +55 -0
- package/web/kiosk-ask-layout.js +85 -0
- package/web/kiosk-ask-layout.test.js +83 -0
- package/web/kiosk-ask-tips.js +477 -0
- package/web/kiosk-ask-tips.test.js +372 -0
- package/web/kiosk-ask.js +774 -0
- package/web/kiosk-ask.test.js +593 -0
- package/web/kiosk-banner.js +108 -0
- package/web/kiosk-banner.test.js +72 -0
- package/web/kiosk-center-cards.test.js +110 -0
- package/web/kiosk-estate-scene.js +267 -0
- package/web/kiosk-estate-scene.test.js +21 -0
- package/web/kiosk-event-help.js +4 -1
- package/web/kiosk-graph-pane.js +63 -0
- package/web/kiosk-graph-pane.test.js +105 -0
- package/web/kiosk-light-frame.js +197 -0
- package/web/kiosk-light.js +547 -0
- package/web/kiosk-light.test.js +297 -0
- package/web/kiosk-member-kind.test.js +140 -0
- package/web/kiosk-metrics.js +7 -4
- package/web/kiosk-modal-sticky.test.js +2 -1
- package/web/kiosk-popover.js +4 -1
- package/web/kiosk-refit.test.js +81 -0
- package/web/kiosk-reset.js +49 -0
- package/web/kiosk-reset.test.js +11 -0
- package/web/kiosk-shot.js +40 -2
- package/web/kiosk-shot.test.js +23 -1
- package/web/kiosk-side.js +296 -0
- package/web/kiosk-side.test.js +249 -0
- package/web/kiosk-vendor.js +85 -7
- package/web/kiosk-vendor.test.js +9 -9
- package/web/kiosk-watch.js +20 -4
- package/web/kiosk-watch.test.js +15 -1
- package/web/kiosk.html +153 -1
- package/web/kiosk.js +252 -27
- package/web/kiosk.test.js +25 -1
- package/web/member-kind.js +31 -0
- package/web/small-stage.test.js +4 -0
- package/web/template-apps.js +245 -0
- package/web/template-apps.test.js +252 -0
- package/web/templates.js +285 -0
- package/web/templates.test.js +155 -0
- package/web/terragucci-change.js +30 -13
- package/web/terragucci-lifecycle.js +112 -62
- package/web/terragucci-lifecycle.test.js +29 -1
- package/web/terragucci-timeline.js +39 -2
- package/web/terragucci-timeline.test.js +42 -1
- package/web/tool-mark.js +4 -4
- package/web/tool-mark.test.js +1 -1
- package/web/vendors/atmos.svg +1 -0
- package/web/vendors/chant.svg +1 -0
- package/web/vendors/choudoufu.svg +1 -0
- package/web/vendors/terragrunt.svg +9 -0
- package/web/vendors/terragucci.svg +1 -0
- package/example-three-cloud/aws/chant.config.ts +0 -8
- package/example-three-cloud/aws/site.component.ts +0 -13
- package/example-three-cloud/aws/src/site.ts +0 -27
- package/example-three-cloud/azure/chant.config.ts +0 -1
- package/example-three-cloud/azure/src/site.component.ts +0 -13
- package/example-three-cloud/azure/src/site.ts +0 -18
- package/web/vendors/choudoufu-128.png +0 -0
- package/web/vendors/choudoufu-64.png +0 -0
- /package/example-carve/{legacy-tf → tf-root}/cdn.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/compute.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/floci-override.tf.disabled +0 -0
- /package/example-carve/{legacy-tf → tf-root}/modules/cdn/main.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/naming.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/network.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/observability.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/outputs.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/storage.tf +0 -0
- /package/example-carve/{legacy-tf → tf-root}/versions.tf +0 -0
package/web/kiosk.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// Nothing here is all-or-nothing, and nothing says so.
|
|
15
15
|
|
|
16
16
|
import { linkState, linkWords, noteBack, noteRead, readFailed, shareLink } from "./kiosk-link.js";
|
|
17
|
+
import { KIND_ROWS } from "./member-kind.js";
|
|
17
18
|
import { CHANT_PANEL_STEPS, chantApprovalModel, chantResultModel } from "./chant-pr-marks.js";
|
|
18
19
|
import { createLivePacer } from "./chant-live-pace.js";
|
|
19
20
|
import { applyJobs, cycleTrack, drawTrack, failureAt, seekMs, trackModel, waitingSpec } from "./kiosk-track.js";
|
|
@@ -22,8 +23,8 @@ import { TOOLS } from "./tool-mark.js";
|
|
|
22
23
|
import { graphWaves } from "./chant-pr-marks.js";
|
|
23
24
|
import { createProgressPacer, trackWaves } from "./terragucci-live-pace.js";
|
|
24
25
|
import { PICK_HOLD_MS, annMark, mergeRun, startRuns, statusIcon } from "./kiosk-runs.js";
|
|
25
|
-
import { MODES, MODE_STORE, badges as waveBadges, badgeTitle, behindStep, steadyRun, captionModel, captionRoom, coneCaption, stepLine, watchOverlays, doraLine, modeStored, placeBeside, quietWords, recordKey, resultModel, runningStep, shotFor, stepTone, tailLines } from "./kiosk-watch.js";
|
|
26
|
-
import { shotMessage } from "./kiosk-shot.js";
|
|
26
|
+
import { MODES, MODE_STORE, badges as waveBadges, badgeTitle, behindStep, steadyRun, holdEnds, captionModel, captionRoom, coneCaption, stepLine, watchOverlays, doraLine, modeStored, placeBeside, quietWords, recordKey, resultModel, runningStep, shotFor, stepTone, tailLines } from "./kiosk-watch.js";
|
|
27
|
+
import { REFIT_WAIT_MS, debounced, shotMessage } from "./kiosk-shot.js";
|
|
27
28
|
import { mountTrace } from "./kiosk-trace.js";
|
|
28
29
|
import { startEventHelp } from "./kiosk-event-help-ui.js";
|
|
29
30
|
import { miniWaterfall, phaseWords, waveTraces } from "./kiosk-wave-traces.js";
|
|
@@ -35,7 +36,13 @@ import { repoParam, repoUrl, stepCheckout } from "./kiosk-repo.js";
|
|
|
35
36
|
import { startKioskCarve } from "./kiosk-carve.js";
|
|
36
37
|
import { drawWaveList, waveListKey } from "./kiosk-wave-list.js";
|
|
37
38
|
import { readsFor, runsReadsFor } from "./kiosk-source.js";
|
|
38
|
-
import {
|
|
39
|
+
import { mountAskTips } from "./kiosk-ask-tips.js";
|
|
40
|
+
import { mountResetModal, resetShown } from "./kiosk-reset.js";
|
|
41
|
+
import { graphFolds, graphPending } from "./kiosk-graph-pane.js";
|
|
42
|
+
import { askEventHelp, askMode, askShot, createAskPane, hasAsk, replyValues } from "./kiosk-ask.js";
|
|
43
|
+
import { STATE_WORDS, outcomesOf, changingRoots, costLine, pinsCommit, planFitsPin, pullPin, readEdges, rootsCount, totalsLine, waveRows, blastRows } from "./terragucci-change.js";
|
|
44
|
+
import { reportedRunView, startKioskLight } from "./kiosk-light.js"; // behold#937
|
|
45
|
+
import { SIDE_PHONE, detailsModel, keepSide, renderSide, actRunView, runTrace, sideApplied, sideState, sideStep, sideStored } from "./kiosk-side.js";
|
|
39
46
|
|
|
40
47
|
/** The scenarios terragucci#1014 numbers. An id not here is shown by the title demo.json carries. */
|
|
41
48
|
export const SCENARIOS = {
|
|
@@ -630,7 +637,10 @@ export function stepView(step) {
|
|
|
630
637
|
* holds until PICK_HOLD_MS after it; `secs` is how long it still holds.
|
|
631
638
|
* Without a demo step yet, the resources view.
|
|
632
639
|
*/
|
|
633
|
-
export function kioskView(demo, { components = false, pick = null, now = Date.now() } = {}) {
|
|
640
|
+
export function kioskView(demo, { components = false, pick = null, now = Date.now(), ask = false } = {}) {
|
|
641
|
+
// behold#939: a prompt-driven step draws every root expanded to its resources, whatever the toggle held.
|
|
642
|
+
// `ask`: the scenario is in ask mode (askHeld), so its steps without a prompt (merged, applying, waiting) draw the estate too, never a pipeline view.
|
|
643
|
+
if (ask || hasAsk(demo)) return { view: "resources", pinned: false, secs: null };
|
|
634
644
|
if (!components) return { view: "resources", pinned: false, secs: null };
|
|
635
645
|
if (pick && VIEWS.some((v) => v.id === pick.view)) {
|
|
636
646
|
const left = pick.at + PICK_HOLD_MS - now;
|
|
@@ -639,6 +649,18 @@ export function kioskView(demo, { components = false, pick = null, now = Date.no
|
|
|
639
649
|
return { view: demo ? stepView(demo.step) : "components", pinned: false, secs: null };
|
|
640
650
|
}
|
|
641
651
|
|
|
652
|
+
/**
|
|
653
|
+
* Ask mode holds for a whole scenario. `held` is the key (`cycle|scenario`) the mode was on for; a step with a
|
|
654
|
+
* prompt turns it on for its scenario, a step without one keeps it while it is the same scenario, and a step of
|
|
655
|
+
* another scenario (a reset into one with no asks) lets it go. Returns the key to hold, or null.
|
|
656
|
+
*/
|
|
657
|
+
export function askHeld(held, demo) {
|
|
658
|
+
if (!demo) return null;
|
|
659
|
+
const key = `${demo.cycle}|${demo.scenario}`;
|
|
660
|
+
if (hasAsk(demo)) return key;
|
|
661
|
+
return held === key ? key : null;
|
|
662
|
+
}
|
|
663
|
+
|
|
642
664
|
/** behold#571: the static frame's title, over the legend; collapsed, its one line. */
|
|
643
665
|
export const READ_TITLE = "How to read this";
|
|
644
666
|
|
|
@@ -683,6 +705,8 @@ export function readingRows(view, tool = null) {
|
|
|
683
705
|
{ mark: "card", words: "Card: one of its resources." },
|
|
684
706
|
...arrows,
|
|
685
707
|
{ mark: "marks", words: "Marks: the tools each job runs, in the jobs pane." },
|
|
708
|
+
// behold#1008: chant's composed run tells a stack no preview was made of from a previewed one (web/member-kind.js).
|
|
709
|
+
...(tool === "chant-compose" ? KIND_ROWS.map((r) => ({ ...r })) : []),
|
|
686
710
|
];
|
|
687
711
|
}
|
|
688
712
|
|
|
@@ -1362,7 +1386,8 @@ export function drawResult(host, model, s) {
|
|
|
1362
1386
|
// behold#571: a row for every wave, in wave order: its trace as one bar of its phases (a click opens the whole trace),
|
|
1363
1387
|
// else its numbers, else a quiet line until they land. Never fewer rows than the count says.
|
|
1364
1388
|
const bars = new Map(miniWaterfall(s.waveTraces || {}).map((r) => [r.wave, r]));
|
|
1365
|
-
|
|
1389
|
+
// A composed run is one apply: no wave rows, no wave traces.
|
|
1390
|
+
const order = model.composed ? [] : [...new Set([...model.waves.map((w) => w.wave), ...bars.keys()])].sort((x, y) => x - y);
|
|
1366
1391
|
if (order.length) {
|
|
1367
1392
|
const wf = el("div", "k-wf");
|
|
1368
1393
|
for (const n of order) {
|
|
@@ -1603,6 +1628,10 @@ export const TRACE_SETTLE_MS = 90_000;
|
|
|
1603
1628
|
|
|
1604
1629
|
/** behold#571: the longest a reloaded frame loads out of sight before it swaps in anyway. */
|
|
1605
1630
|
export const FRAME_SWAP_MS = 30_000;
|
|
1631
|
+
/** How long the pane's "drawing the graph" line waits for a frame that never says it drew. */
|
|
1632
|
+
export const FRAME_WAIT_MS = 10_000;
|
|
1633
|
+
/** How long the line outlasts a frame's first `behold:drawn`: the scene's layout and fit follow it. */
|
|
1634
|
+
export const FRAME_SETTLE_MS = 1_200;
|
|
1606
1635
|
/** behold#571: how long the first frame load waits for demo.json, so it opens on the step's checkout. */
|
|
1607
1636
|
export const FRAME_BOOT_WAIT_MS = 4_000;
|
|
1608
1637
|
|
|
@@ -1698,24 +1727,35 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1698
1727
|
};
|
|
1699
1728
|
let lastKey = "";
|
|
1700
1729
|
let lastFocus;
|
|
1701
|
-
const shownView = () => kioskView(s.demo && s.demo.demo, { components: s.components, pick: s.pick, now: now().getTime() });
|
|
1730
|
+
const shownView = () => kioskView(s.demo && s.demo.demo, { components: s.components, pick: s.pick, now: now().getTime(), ask: !!s.askOn });
|
|
1731
|
+
let unstacked = false;
|
|
1732
|
+
let askTold = null;
|
|
1702
1733
|
const tellFrame = (force) => {
|
|
1703
1734
|
// behold#571: before the tool's first cycle the frame draws its repo on the base, with nothing in flight.
|
|
1704
1735
|
const notRun = !!vendor && s.mode === "none";
|
|
1705
1736
|
const d = notRun ? null : s.demo && s.demo.demo;
|
|
1706
1737
|
if (!d && !notRun) return; // nothing said yet: the frame keeps its default until the narration is read
|
|
1707
|
-
|
|
1738
|
+
// Ask mode draws the whole estate at every step, so no root is brought forward.
|
|
1739
|
+
const roots = d && !s.askOn ? focusRoots(d, s.answer, s.progress) : null;
|
|
1708
1740
|
const focus = roots ? roots.join(",") : null;
|
|
1709
1741
|
const run = d ? runPin(d) : "base";
|
|
1710
1742
|
// The cycle's pull request, so a merge's frame never draws another cycle's plan (web/terragucci-change.js pinnedAnswer).
|
|
1711
1743
|
const pull = framePull(d);
|
|
1712
1744
|
const zoom = viewZoom(shownView().view);
|
|
1713
|
-
|
|
1745
|
+
// behold#939: a prompt-driven step draws every resource as its own card (the four of app, not "app x4").
|
|
1746
|
+
const ask = !!d && (hasAsk(d) || !!s.askOn);
|
|
1747
|
+
const key = `${focus}|${run}|${pull}|${zoom}|${ask ? "unstacked" : ""}`;
|
|
1714
1748
|
if (!force && key === lastFocus) return;
|
|
1715
1749
|
lastFocus = key;
|
|
1716
|
-
|
|
1750
|
+
// Leaving it gives the default (stacked) back.
|
|
1751
|
+
post({ type: "behold:view", member: null, focus, run, pull, zoom, ...(ask ? { alike: false } : unstacked ? { alike: true } : {}) });
|
|
1752
|
+
unstacked = ask;
|
|
1753
|
+
post({ type: "behold:ask", on: askMode(s) });
|
|
1754
|
+
askTold = askMode(s);
|
|
1717
1755
|
tellHover(s.hover);
|
|
1718
1756
|
};
|
|
1757
|
+
// behold#937: the pane's events (behold#936) light the graph and give the reply its {dependents} (web/kiosk-light.js).
|
|
1758
|
+
if (typeof window !== "undefined") startKioskLight({ post, getAnswer: () => s.answer, getProgress: () => s.progress });
|
|
1719
1759
|
const pickView = (view) => {
|
|
1720
1760
|
s.pick = { view, at: now().getTime() };
|
|
1721
1761
|
draw();
|
|
@@ -1809,10 +1849,121 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1809
1849
|
// behold#571: the titles and names demo.json has carried, by scenario, for the runs' subtitles.
|
|
1810
1850
|
const titles = {};
|
|
1811
1851
|
const names = {};
|
|
1852
|
+
// behold#936: the prompt pane (web/kiosk-ask.js), in the header's and the caption's place while a step has a prompt, in Watch.
|
|
1853
|
+
const askValues = () => {
|
|
1854
|
+
const d = s.demo && s.demo.demo;
|
|
1855
|
+
const failed = [...outcomesOf(s.answer, s.progress).values()].find((o) => o.outcome === "failed" && o.error);
|
|
1856
|
+
return replyValues(d ? matchingPull(s.answer, d) : null, failed ? failed.error : null, typeof window !== "undefined" && window.beholdAskTokens ? window.beholdAskTokens : {});
|
|
1857
|
+
};
|
|
1858
|
+
const applyAsk = () => {
|
|
1859
|
+
if (typeof document !== "undefined" && document.body && document.body.classList) document.body.classList.toggle("k-ask", !!s.askOn && !!s.watchMode);
|
|
1860
|
+
applySide();
|
|
1861
|
+
};
|
|
1862
|
+
// The side pane (web/kiosk-side.js): the act's run and what the terminal's current line names, right of the graph
|
|
1863
|
+
// in Watch while the prompt pane is up, on a screen wider than a phone. Open until the viewer folds it.
|
|
1864
|
+
s.sideOpen = sideStored(shelf);
|
|
1865
|
+
s.sideAsk = null;
|
|
1866
|
+
s.sideTurn = null;
|
|
1867
|
+
// The cycle each scenario was last seen on in demo.json, for a turn the terminal plays after demo.json moved on.
|
|
1868
|
+
const sideCycles = new Map();
|
|
1869
|
+
const sideMerges = new Map();
|
|
1870
|
+
let sideWas = null;
|
|
1871
|
+
const sideNow = () => sideState({ ask: askMode(s), phone: typeof matchMedia === "function" && matchMedia(SIDE_PHONE).matches, open: s.sideOpen });
|
|
1872
|
+
function applySide() {
|
|
1873
|
+
if (typeof document === "undefined" || !document.body || !document.body.classList) return;
|
|
1874
|
+
const st = sideNow();
|
|
1875
|
+
document.body.classList.toggle("k-side-open", st === "open");
|
|
1876
|
+
document.body.classList.toggle("k-side-folded", st === "folded");
|
|
1877
|
+
if (st === sideWas) return;
|
|
1878
|
+
sideWas = st;
|
|
1879
|
+
// The graph's pane got narrower or wider: the frame refits on its own resize (web/app.js watchPaneForFit); the shot
|
|
1880
|
+
// is told again once the layout has settled, and the tips dock in the new room.
|
|
1881
|
+
if (typeof requestAnimationFrame === "function")
|
|
1882
|
+
requestAnimationFrame(() => {
|
|
1883
|
+
drawSide();
|
|
1884
|
+
tellShot(true);
|
|
1885
|
+
});
|
|
1886
|
+
}
|
|
1887
|
+
const setSide = (open) => {
|
|
1888
|
+
s.sideOpen = open;
|
|
1889
|
+
keepSide(shelf, open);
|
|
1890
|
+
applySide();
|
|
1891
|
+
if (open && watch && watch.side && watch.side.focus) watch.side.focus();
|
|
1892
|
+
};
|
|
1893
|
+
function drawSide() {
|
|
1894
|
+
if (!watch || !watch.side || sideNow() !== "open") return;
|
|
1895
|
+
// The terminal plays its steps in turn, and may be a step or an act behind demo.json: the trace is of the act
|
|
1896
|
+
// the terminal's current turn is in, at that turn's step.
|
|
1897
|
+
const at = sideStep(s.demo && s.demo.demo, s.sideTurn, sideCycles);
|
|
1898
|
+
const d = at && sideMerges.has(at.cycle) ? { ...at, commit: sideMerges.get(at.cycle) } : at;
|
|
1899
|
+
const runs = runsApi && runsApi.index && runsApi.index.doc ? runsApi.index.doc.runs : [];
|
|
1900
|
+
// The run view is the apply's: only this act's own, from its merge on (the kiosk's read can be the last merge's).
|
|
1901
|
+
// A pipeline that writes no run view (Terragrunt's and Atmos's on choudoufu) has the act's apply reports instead.
|
|
1902
|
+
const progress = actRunView(d, reportedRunView(s.progress, s.answer));
|
|
1903
|
+
const trace = runTrace(runs, d, { answer: s.answer, progress, now: now().getTime() });
|
|
1904
|
+
const details = detailsModel(s.answer, progress, s.sideAsk);
|
|
1905
|
+
renderSide(watch.side, { trace, details }, { traces: (host) => drawWaveTraces(host, s), onFold: () => setSide(false) });
|
|
1906
|
+
}
|
|
1907
|
+
if (watch && watch.sideTab && watch.sideTab.addEventListener) watch.sideTab.addEventListener("click", () => setSide(true));
|
|
1908
|
+
if (watch && watch.side && watch.side.setAttribute) watch.side.setAttribute("tabindex", "-1");
|
|
1909
|
+
// The prompt pane's height, which the side pane stands on: kept as --k-ask-h so the two never overlap.
|
|
1910
|
+
if (watch && watch.ask && typeof ResizeObserver !== "undefined" && typeof document !== "undefined") {
|
|
1911
|
+
new ResizeObserver(() => {
|
|
1912
|
+
const h = watch.ask.hidden ? 0 : Math.ceil(watch.ask.getBoundingClientRect().height);
|
|
1913
|
+
document.body.style.setProperty("--k-ask-h", `${h}px`);
|
|
1914
|
+
}).observe(watch.ask);
|
|
1915
|
+
}
|
|
1916
|
+
// The card follows the prompt pane's current turn: what its ask lights, from the plan (web/kiosk-light.js).
|
|
1917
|
+
if (typeof window !== "undefined" && window.addEventListener) {
|
|
1918
|
+
const turn = (e) => {
|
|
1919
|
+
const det = e && e.detail && typeof e.detail === "object" ? e.detail : {};
|
|
1920
|
+
s.sideAsk = det.ask && typeof det.ask === "object" ? det.ask : null;
|
|
1921
|
+
if (typeof det.scenario === "string" && typeof det.step === "string") s.sideTurn = { scenario: det.scenario, step: det.step };
|
|
1922
|
+
drawSide();
|
|
1923
|
+
};
|
|
1924
|
+
for (const t of ["behold:ask-hold", "behold:ask-start", "behold:ask-light", "behold:ask-status", "behold:ask-done", "behold:ask-clear"]) window.addEventListener(t, turn);
|
|
1925
|
+
if (typeof matchMedia === "function") {
|
|
1926
|
+
const mq = matchMedia(SIDE_PHONE);
|
|
1927
|
+
if (mq.addEventListener) mq.addEventListener("change", applySide);
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
const askPane =
|
|
1931
|
+
watch && watch.ask
|
|
1932
|
+
? createAskPane({
|
|
1933
|
+
host: watch.ask,
|
|
1934
|
+
fill: askValues,
|
|
1935
|
+
now,
|
|
1936
|
+
reduced: () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches,
|
|
1937
|
+
onActive: (on) => {
|
|
1938
|
+
s.askPaneOn = on;
|
|
1939
|
+
s.askOn = on || !!s.askHeld;
|
|
1940
|
+
applyAsk();
|
|
1941
|
+
},
|
|
1942
|
+
})
|
|
1943
|
+
: null;
|
|
1944
|
+
// The tip cards (web/kiosk-ask-tips.js): one per act, docked in a corner of the graph during a long wait, gone the moment the prompt says something new.
|
|
1945
|
+
if (askPane && typeof window !== "undefined" && typeof document !== "undefined") mountAskTips({ win: window, doc: document, askHost: watch.ask });
|
|
1946
|
+
// The reset between acts is no turn of the story: one "Resetting" modal over the page while it runs (web/kiosk-reset.js).
|
|
1947
|
+
const resetModal = askPane && typeof document !== "undefined" && document.body ? mountResetModal(document) : null;
|
|
1812
1948
|
/** Take one narration (demo.json, or a replayed step), and ask for the run it is about when the step moved. */
|
|
1813
1949
|
const setDemo = (answer) => {
|
|
1950
|
+
const was = s.demo && s.demo.demo;
|
|
1814
1951
|
s.demo = answer;
|
|
1815
1952
|
const d = answer && answer.demo;
|
|
1953
|
+
// A viewer's hold on the shot ends at the reset and at a new act: the graph in the pane is another one then, and
|
|
1954
|
+
// the shot frames it to the pane as it is (a held view of the last graph left the reset's scene at the left edge).
|
|
1955
|
+
if (holdEnds(was || null, d || null) && s.endHold) s.endHold();
|
|
1956
|
+
if (d && typeof d.scenario === "string" && Number.isInteger(d.cycle)) sideCycles.set(d.scenario, d.cycle);
|
|
1957
|
+
// Each act's merge commit, as demo.json named it from the merge on (the reset names the base instead).
|
|
1958
|
+
if (d && Number.isInteger(d.cycle) && d.step !== "reset" && sideApplied(d) && typeof d.commit === "string") sideMerges.set(d.cycle, d.commit);
|
|
1959
|
+
if (askPane) {
|
|
1960
|
+
// behold#942: ask mode holds for the scenario, so the steps between prompts keep the graph and the pane.
|
|
1961
|
+
s.askHeld = askHeld(s.askHeld, d || null);
|
|
1962
|
+
askPane.setStep(d || null);
|
|
1963
|
+
s.askOn = !!s.askPaneOn || !!s.askHeld;
|
|
1964
|
+
applyAsk();
|
|
1965
|
+
if (resetModal) resetModal.set(resetShown(d || null, s.askOn));
|
|
1966
|
+
}
|
|
1816
1967
|
// behold#571: when this page first saw the driver's deadline, for the next bar when demo.json has no next.from.
|
|
1817
1968
|
s.nextSeen = nextSeen(s.nextSeen, d ? d.next || null : undefined, s.mode, shownNow().getTime());
|
|
1818
1969
|
if (d && d.scenario && typeof d.title === "string" && d.title) titles[d.scenario] = d.title;
|
|
@@ -1944,7 +2095,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1944
2095
|
drawReading(shown.view, ok);
|
|
1945
2096
|
// behold#571: with no graph to show, the graph pane folds away and the runs and the log take its width.
|
|
1946
2097
|
if (typeof document !== "undefined" && document.body && document.body.classList) {
|
|
1947
|
-
|
|
2098
|
+
if (ok) s.graphSeen = true;
|
|
2099
|
+
document.body.classList.toggle("k-nograph", graphFolds({ vendor, ok, askOn: !!s.askOn, seen: !!s.graphSeen, pending: graphPending({ own: reads.own, single: s.single, answer: s.answer }) }));
|
|
1948
2100
|
// Before the tool's first cycle there are no runs and no log: those panes fold away, and the graph (when there is one) takes the width.
|
|
1949
2101
|
document.body.classList.toggle("k-notyet", !!vendor && s.mode === "none");
|
|
1950
2102
|
}
|
|
@@ -1965,6 +2117,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1965
2117
|
let drawerWave = null;
|
|
1966
2118
|
let drawerView = null;
|
|
1967
2119
|
const isPhone = () => typeof matchMedia === "function" && matchMedia("(max-width: 600px)").matches;
|
|
2120
|
+
/** behold#942: ask mode on a phone (up to 700px) puts the pane under the graph, so nothing overlaps the frame. */
|
|
2121
|
+
const askStacked = () => !!(s.askOn && s.watchMode) && typeof matchMedia === "function" && matchMedia("(max-width: 700px)").matches;
|
|
1968
2122
|
const runsParent = main ? main.parentNode : null;
|
|
1969
2123
|
const runsNext = main ? main.nextSibling : null;
|
|
1970
2124
|
const applyMode = () => {
|
|
@@ -1976,6 +2130,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1976
2130
|
if (s.watchMode && body && main.parentNode !== body) body.appendChild(main);
|
|
1977
2131
|
if (!s.watchMode && runsParent && main.parentNode !== runsParent) runsParent.insertBefore(main, runsNext);
|
|
1978
2132
|
}
|
|
2133
|
+
applyAsk();
|
|
1979
2134
|
if (watch) renderModeToggle(tools && tools.mode, s.watchMode ? "watch" : "inspect", setMode);
|
|
1980
2135
|
if (carveCtl) carveCtl.tellMode();
|
|
1981
2136
|
};
|
|
@@ -1997,6 +2152,12 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
1997
2152
|
// The layout moved under the frame: the shot goes again once it has settled.
|
|
1998
2153
|
if (typeof requestAnimationFrame === "function") requestAnimationFrame(() => tellShot(true));
|
|
1999
2154
|
};
|
|
2155
|
+
s.endHold = () => {
|
|
2156
|
+
if (watchHoldAt === null && !s.watchHeld) return;
|
|
2157
|
+
watchHoldAt = null;
|
|
2158
|
+
s.watchHeld = null;
|
|
2159
|
+
lastShot = null;
|
|
2160
|
+
};
|
|
2000
2161
|
const holdShot = () => {
|
|
2001
2162
|
if (!s.watchMode) return;
|
|
2002
2163
|
watchHoldAt = now().getTime();
|
|
@@ -2027,6 +2188,11 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2027
2188
|
}
|
|
2028
2189
|
/** The caption shown now: Watch's own, or the live carve's while it has the camera (#715). */
|
|
2029
2190
|
const shownCaption = () => (carveCtl && carveCtl.caption ? carveCtl.caption() || watch.caption : watch.caption);
|
|
2191
|
+
/**
|
|
2192
|
+
* The box the graph's room ends at: the prompt pane while it shows (the caption is hidden then, and a hidden box
|
|
2193
|
+
* measures as zeros, which sent the trail to the top and left the graph no room), else the caption shown now.
|
|
2194
|
+
*/
|
|
2195
|
+
const bottomBox = () => (s.askOn && s.watchMode && watch && watch.ask && !watch.ask.hidden ? watch.ask : shownCaption());
|
|
2030
2196
|
/** behold#631: a chant kiosk's projected track (drawChantTrack), in the trail's place. */
|
|
2031
2197
|
let trackHost = null;
|
|
2032
2198
|
/** behold#571: the caption's top, or event-help's trail's when it sits over the caption. */
|
|
@@ -2037,15 +2203,17 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2037
2203
|
};
|
|
2038
2204
|
/** How much of the frame the overlays cover, in the frame's pixels: the caption below, and the callout, drawer or card beside the shot. */
|
|
2039
2205
|
const shotInsets = (shot) => {
|
|
2040
|
-
if (!watch || !frame || isPhone() || !frame.getBoundingClientRect) return {};
|
|
2206
|
+
if (!watch || !frame || isPhone() || askStacked() || !frame.getBoundingClientRect) return {};
|
|
2041
2207
|
const f = frame.getBoundingClientRect();
|
|
2042
|
-
const cap =
|
|
2208
|
+
const cap = bottomBox().getBoundingClientRect();
|
|
2043
2209
|
const bottom = Math.max(0, f.bottom - captionTop(cap)) + 16;
|
|
2044
2210
|
const side = shot.kind === "held" ? watch.callout : shot.kind === "active" ? watch.drawer : shot.kind === "result" ? watch.result : null;
|
|
2045
2211
|
// The result card sits right beside the graph (placeBeside's gap): an inset of its width and that gap centres the two together.
|
|
2046
2212
|
const measured = side && !side.hidden && side.offsetWidth ? side.offsetWidth + (shot.kind === "result" ? 18 : 44) : 0;
|
|
2047
2213
|
// behold#631: a chant cycle keeps one framing from start to end: the side panel's room is kept whether or not one is up, so the graph never shifts.
|
|
2048
2214
|
const right = s.chantLoop ? Math.max(measured, CHANT_SIDE_ROOM) : measured;
|
|
2215
|
+
// Ask mode centres the scene in the graph area: the same margin at each side, none extra above or under it (the fit's own pad keeps the boxes off the edges).
|
|
2216
|
+
if (shot.ask) return { top: 0, right: Math.max(right, 20), bottom: bottom - 16, left: 20 };
|
|
2049
2217
|
return { top: 20, right, bottom, left: 20 };
|
|
2050
2218
|
};
|
|
2051
2219
|
/**
|
|
@@ -2054,8 +2222,13 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2054
2222
|
* quiet line or the trail that comes later moves nothing. None on a phone, where the caption is under the graph.
|
|
2055
2223
|
*/
|
|
2056
2224
|
function captionRoomPx() {
|
|
2057
|
-
if (!watch || !frame || isPhone() || !frame.getBoundingClientRect || typeof getComputedStyle !== "function") return 0;
|
|
2225
|
+
if (!watch || !frame || isPhone() || askStacked() || !frame.getBoundingClientRect || typeof getComputedStyle !== "function") return 0;
|
|
2058
2226
|
const f = frame.getBoundingClientRect();
|
|
2227
|
+
// behold#936: the prompt pane, when it shows, is the caption's place; its height is fixed, so the room is too.
|
|
2228
|
+
if (s.askOn && watch.ask && !watch.ask.hidden) {
|
|
2229
|
+
const a = watch.ask.getBoundingClientRect();
|
|
2230
|
+
return Math.round(Math.max(0, f.bottom - a.bottom) + a.height + 16);
|
|
2231
|
+
}
|
|
2059
2232
|
const cap = watch.caption;
|
|
2060
2233
|
const c = cap.getBoundingClientRect();
|
|
2061
2234
|
const fs = parseFloat(getComputedStyle(cap).fontSize) || 16;
|
|
@@ -2068,8 +2241,13 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2068
2241
|
const trailLineH = chip ? chip.getBoundingClientRect().height + 4 : 26;
|
|
2069
2242
|
return captionRoom({ capHeight: c.height, extras, rowH, trailH, trailLineH, below: Math.max(0, f.bottom - c.bottom) });
|
|
2070
2243
|
}
|
|
2071
|
-
function tellShot(force) {
|
|
2244
|
+
function tellShot(force, still, fresh = null) {
|
|
2072
2245
|
if (!frame || !frame.contentWindow || !watch) return;
|
|
2246
|
+
// behold#940: ask mode holds in the frame between prompts and between shots, so it is told on its own, when it changes.
|
|
2247
|
+
if (askMode(s) !== askTold) {
|
|
2248
|
+
askTold = askMode(s);
|
|
2249
|
+
post({ type: "behold:ask", on: askTold });
|
|
2250
|
+
}
|
|
2073
2251
|
if (!s.watchMode) {
|
|
2074
2252
|
if (lastShot !== "release") {
|
|
2075
2253
|
lastShot = "release";
|
|
@@ -2077,14 +2255,26 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2077
2255
|
}
|
|
2078
2256
|
return;
|
|
2079
2257
|
}
|
|
2080
|
-
if (
|
|
2258
|
+
if (!s.shot) return;
|
|
2259
|
+
// A viewer's hold keeps the frame they moved where it is. A frame that has just loaded (`fresh`, its window) has
|
|
2260
|
+
// nothing of theirs: it takes the shot, or it would fit itself to the graph it first drew and not to the pane.
|
|
2261
|
+
if (s.watchHeld && !fresh) return;
|
|
2081
2262
|
const insets = shotInsets(s.shot);
|
|
2082
2263
|
// The caption's tallest, for a held small stage's one framing; a stage that isn't held never reads it.
|
|
2083
2264
|
const room = captionRoomPx();
|
|
2084
|
-
const key = `${s.shot.id}|${insets.right || 0}|${Math.round((insets.bottom || 0) / 12)}|${s.shot.roots.join(",")}|${Math.round(room / 12)}`;
|
|
2265
|
+
const key = `${s.shot.id}|${s.shot.ask ? "ask" : ""}|${insets.right || 0}|${Math.round((insets.top || 0) / 12)}|${Math.round((insets.left || 0) / 12)}|${Math.round((insets.bottom || 0) / 12)}|${s.shot.roots.join(",")}|${Math.round(room / 12)}`;
|
|
2266
|
+
const msg = shotMessage({ roots: s.shot.roots, waves: s.shot.waves, whole: s.shot.whole, insets, id: s.shot.id, room, ask: s.shot.ask === true, ...(still ? { ms: 0 } : {}) });
|
|
2267
|
+
if (s.watchHeld) {
|
|
2268
|
+
try {
|
|
2269
|
+
fresh.postMessage(msg, origin);
|
|
2270
|
+
} catch {
|
|
2271
|
+
/* the frame went away */
|
|
2272
|
+
}
|
|
2273
|
+
return;
|
|
2274
|
+
}
|
|
2085
2275
|
if (!force && key === lastShot) return;
|
|
2086
2276
|
lastShot = key;
|
|
2087
|
-
post(
|
|
2277
|
+
post(msg);
|
|
2088
2278
|
}
|
|
2089
2279
|
// behold#631: the projected cycle track, a chant kiosk's bottom band in place of the chip strip and the rail.
|
|
2090
2280
|
const trackState = { cycle: null, pulls: [], key: null, since: null };
|
|
@@ -2126,7 +2316,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2126
2316
|
if (model) model.onSeek = s.seekTo;
|
|
2127
2317
|
drawTrack(trackHost, model);
|
|
2128
2318
|
// In the trail's place: over the caption.
|
|
2129
|
-
const cap =
|
|
2319
|
+
const cap = bottomBox().getBoundingClientRect();
|
|
2130
2320
|
if (trackHost.style) trackHost.style.bottom = cap.height ? `${Math.round((typeof window !== "undefined" ? window.innerHeight : 0) - cap.top)}px` : "";
|
|
2131
2321
|
// The "Waiting on…" modal: a quiet stretch on a step that waits on something, never while the apply's events come in.
|
|
2132
2322
|
// Once the play shows anything of this run under way (a wave or a card), nothing waits on the apply to start.
|
|
@@ -2141,13 +2331,13 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2141
2331
|
drawChantTrack(d, at);
|
|
2142
2332
|
const hold = d ? holdModel(s, d) : null;
|
|
2143
2333
|
const gate = !!hold && (hold.kind === "approval" || hold.kind === "driver");
|
|
2144
|
-
const shot = shotFor(d, { answer: s.answer, progress: s.progress, held: s.held, gate, runDoc: runsApi && runsApi.run ? runsApi.run.doc : null, waves: s.waves });
|
|
2334
|
+
const shot = askShot(shotFor(d, { answer: s.answer, progress: s.progress, held: s.held, gate, runDoc: runsApi && runsApi.run ? runsApi.run.doc : null, waves: s.waves }), askMode(s));
|
|
2145
2335
|
s.shot = shot;
|
|
2146
2336
|
const nums = waveBadges(s.metrics);
|
|
2147
2337
|
const opened = drawerWave !== null;
|
|
2148
2338
|
// On a held small stage nothing overlays the graph (web/kiosk-watch.js watchOverlays): the approval, the result and the
|
|
2149
2339
|
// running job are the caption's quiet lines there. Any other stage shows its cards as it always has.
|
|
2150
|
-
const shows = watchOverlays({ kind: shot.kind, opened, held: !!s.stageHeld });
|
|
2340
|
+
const shows = watchOverlays({ kind: shot.kind, opened, held: !!s.stageHeld, ask: askMode(s) });
|
|
2151
2341
|
const call = shows.callout && shot.kind === "held" && gate;
|
|
2152
2342
|
watch.callout.hidden = !call;
|
|
2153
2343
|
if (call) drawCallout(watch.callout, s, hold, badgeTitle(nums[hold.wave]));
|
|
@@ -2176,6 +2366,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2176
2366
|
// behold#781, behold#776: a phone's Watch says the change in words by the story, and lists the graph's marks.
|
|
2177
2367
|
if (watch.change) drawChange(watch.change, s);
|
|
2178
2368
|
drawWaves();
|
|
2369
|
+
drawSide();
|
|
2179
2370
|
// behold#775: on a phone, each finished wave's trace under the step (hidden on a wider screen, where the badges open them).
|
|
2180
2371
|
let traces = watch.layer.querySelector(":scope > .k-w-traces");
|
|
2181
2372
|
if (!traces) {
|
|
@@ -2268,7 +2459,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2268
2459
|
}
|
|
2269
2460
|
const L = watch.layer.getBoundingClientRect();
|
|
2270
2461
|
const F = frame.getBoundingClientRect();
|
|
2271
|
-
const capTop = captionTop(
|
|
2462
|
+
const capTop = captionTop(bottomBox().getBoundingClientRect()) - L.top;
|
|
2272
2463
|
const view = { x: F.left - L.left, y: F.top - L.top, w: F.width, h: capTop - (F.top - L.top) };
|
|
2273
2464
|
const boxOf = (n) => {
|
|
2274
2465
|
const waves = (s.boxes && s.boxes.waves) || {};
|
|
@@ -2424,7 +2615,8 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2424
2615
|
const d = s.demo && s.demo.demo;
|
|
2425
2616
|
if (!d) return null;
|
|
2426
2617
|
const appr = pendingApproval(d, s.progress);
|
|
2427
|
-
|
|
2618
|
+
// behold#939: in ask mode no bubble, modal or strip; the pane and the graph tell it.
|
|
2619
|
+
return askEventHelp({
|
|
2428
2620
|
demo: d,
|
|
2429
2621
|
answer: s.answer,
|
|
2430
2622
|
// behold#741: told at the pace the graph plays the waves, while a terragucci story is on.
|
|
@@ -2450,7 +2642,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2450
2642
|
frame,
|
|
2451
2643
|
watch: s.watchMode,
|
|
2452
2644
|
// The caption shown now: the live carve's while it has the camera (web/kiosk-carve.js).
|
|
2453
|
-
caption: watch ?
|
|
2645
|
+
caption: watch ? bottomBox() : null,
|
|
2454
2646
|
replay: s.mode === "replay",
|
|
2455
2647
|
approveLine: appr ? appr.approve : null,
|
|
2456
2648
|
label: d.label || "",
|
|
@@ -2460,7 +2652,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2460
2652
|
waveTraces: s.waveTraces,
|
|
2461
2653
|
strip: s.stripReady() ? s.strip : null,
|
|
2462
2654
|
stripReady: s.stripReady(),
|
|
2463
|
-
};
|
|
2655
|
+
}, askMode(s));
|
|
2464
2656
|
},
|
|
2465
2657
|
})
|
|
2466
2658
|
: null;
|
|
@@ -2851,15 +3043,46 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2851
3043
|
// merge, not at applied, not at a new cycle, in Watch and in Inspect.
|
|
2852
3044
|
let frameDrawn = false;
|
|
2853
3045
|
let bufferTimer = null;
|
|
3046
|
+
// While no frame has drawn on this page (a reload, a load in place) the pane says what it waits for (body.k-framewait),
|
|
3047
|
+
// dark and never empty; a frame that never says it drew gives the line up after FRAME_WAIT_MS.
|
|
3048
|
+
let waitTimer = null;
|
|
3049
|
+
// A frame says it drew when its cards are in the svg, a moment before the scene is laid out and fitted: the line goes
|
|
3050
|
+
// FRAME_SETTLE_MS after that, so the pane is never between the two with nothing in it.
|
|
3051
|
+
const frameWait = (on, settle = 0) => {
|
|
3052
|
+
if (typeof document === "undefined" || !document.body || !document.body.classList) return;
|
|
3053
|
+
clearTimeout(waitTimer);
|
|
3054
|
+
if (!on && settle > 0) {
|
|
3055
|
+
waitTimer = setTimeout(() => document.body.classList.remove("k-framewait"), settle);
|
|
3056
|
+
return;
|
|
3057
|
+
}
|
|
3058
|
+
document.body.classList.toggle("k-framewait", !!on);
|
|
3059
|
+
if (on) waitTimer = setTimeout(() => document.body.classList.remove("k-framewait"), FRAME_WAIT_MS);
|
|
3060
|
+
};
|
|
3061
|
+
frameWait(true);
|
|
2854
3062
|
const bootAt = now().getTime();
|
|
2855
3063
|
let bootRetry = null;
|
|
3064
|
+
// The graph's room changes after the first shot (the banner, the pane's height, web fonts, the frame's own box): tell the
|
|
3065
|
+
// frame again, once, at the end of the change, without a move. The key keeps it cheap when nothing moved.
|
|
3066
|
+
const refitShot = debounced(() => tellShot(false, true), REFIT_WAIT_MS);
|
|
3067
|
+
const watched = new Set();
|
|
3068
|
+
const watchBox = (el) => {
|
|
3069
|
+
if (!el || watched.has(el) || typeof ResizeObserver === "undefined") return;
|
|
3070
|
+
watched.add(el);
|
|
3071
|
+
new ResizeObserver(refitShot).observe(el);
|
|
3072
|
+
};
|
|
3073
|
+
if (typeof window !== "undefined") {
|
|
3074
|
+
window.addEventListener("resize", refitShot);
|
|
3075
|
+
if (document.fonts && document.fonts.ready) document.fonts.ready.then(() => tellShot(false, true), () => {});
|
|
3076
|
+
}
|
|
2856
3077
|
const wireLoad = (el) => {
|
|
3078
|
+
watchBox(el);
|
|
3079
|
+
watchBox(watch && watch.ask);
|
|
2857
3080
|
el.addEventListener("load", () => {
|
|
2858
3081
|
// A new frame takes Watch's shot before it draws, so it opens on it and never on the fit.
|
|
2859
|
-
tellShot(true);
|
|
3082
|
+
tellShot(true, false, el.contentWindow);
|
|
2860
3083
|
tellFrame(true);
|
|
2861
3084
|
// The frame reads its graph after load; tell it again once it has had the time.
|
|
2862
|
-
for (const ms of [1500, 4000, 8000]) setTimeout(() => (tellFrame(true), tellShot(true)), ms);
|
|
3085
|
+
for (const ms of [1500, 4000, 8000]) setTimeout(() => (tellFrame(true), tellShot(true, false, el.contentWindow)), ms);
|
|
2863
3086
|
});
|
|
2864
3087
|
};
|
|
2865
3088
|
const swapFrame = () => {
|
|
@@ -2875,6 +3098,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2875
3098
|
frame = buffer;
|
|
2876
3099
|
buffer = null;
|
|
2877
3100
|
frameDrawn = true;
|
|
3101
|
+
frameWait(false);
|
|
2878
3102
|
s.boxes = null;
|
|
2879
3103
|
s.framePop = null; // behold#764: the old frame's details popover went with it
|
|
2880
3104
|
lastFocus = undefined;
|
|
@@ -2897,6 +3121,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2897
3121
|
// Nothing drawn yet to keep up (the first load, or a load before the last one drew): load in place.
|
|
2898
3122
|
if (first || !frameDrawn || typeof document === "undefined" || !frame.parentNode) {
|
|
2899
3123
|
frameDrawn = false;
|
|
3124
|
+
frameWait(true);
|
|
2900
3125
|
frame.src = src;
|
|
2901
3126
|
return;
|
|
2902
3127
|
}
|
|
@@ -2924,7 +3149,7 @@ export function startKiosk({ bar, frame, side, main, views, read = null, tools =
|
|
|
2924
3149
|
window.addEventListener("message", (e) => {
|
|
2925
3150
|
if (e.origin !== origin || !e.data || e.data.type !== "behold:drawn") return;
|
|
2926
3151
|
if (buffer && e.source === buffer.contentWindow) swapFrame();
|
|
2927
|
-
else if (frame && e.source === frame.contentWindow) frameDrawn = true;
|
|
3152
|
+
else if (frame && e.source === frame.contentWindow) (frameDrawn = true), frameWait(false, FRAME_SETTLE_MS);
|
|
2928
3153
|
});
|
|
2929
3154
|
}
|
|
2930
3155
|
/** behold#571: the commit each served checkout holds, read again when a step names a new one. */
|
package/web/kiosk.test.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { FOLLOW_WORDS, RESUME_WORDS, TAP_HOLD_MS, heldWords, touchScreen, stepTone, nextProgress, nextSeen,BEAT_CHANGES, INTRO_HEAD, READ_STORE, READ_TITLE, STEP_VIEW, STEP_WORDS, aboutRows, approvalPanel, approveGloss, chantProject, factsLine, focusRoots, holdHead, holdModel, introText, readStored, readingRows, renderReading, scenarioHead, frameSrc, factLines, kioskView, matchingPull, pendingApproval, renderKiosk, renderViewToggle, reportless, runPanel, runPin, stepView, viewZoom } from "./kiosk.js";
|
|
2
|
+
import { askHeld, FOLLOW_WORDS, RESUME_WORDS, TAP_HOLD_MS, heldWords, touchScreen, stepTone, nextProgress, nextSeen,BEAT_CHANGES, INTRO_HEAD, READ_STORE, READ_TITLE, STEP_VIEW, STEP_WORDS, aboutRows, approvalPanel, approveGloss, chantProject, factsLine, focusRoots, holdHead, holdModel, introText, readStored, readingRows, renderReading, scenarioHead, frameSrc, factLines, kioskView, matchingPull, pendingApproval, renderKiosk, renderViewToggle, reportless, runPanel, runPin, stepView, viewZoom } from "./kiosk.js";
|
|
3
3
|
import { VENDORS } from "./kiosk-vendor.js";
|
|
4
4
|
import { PICK_HOLD_MS } from "./kiosk-runs.js";
|
|
5
5
|
|
|
@@ -282,9 +282,16 @@ describe("which view the frame shows (#571)", () => {
|
|
|
282
282
|
expect(kioskView(demo("planned"), { components: true, pick: { view: "resources", at: 0 }, now: 1000 }).view).toBe("resources");
|
|
283
283
|
expect(kioskView(demo("waiting"), { components: true })).toEqual({ view: "components", pinned: false, secs: null });
|
|
284
284
|
expect(kioskView(demo("waiting"), { components: false })).toEqual({ view: "resources", pinned: false, secs: null });
|
|
285
|
+
// behold#939: a step with an ask draws the resources, whatever the toggle held; one without is as before.
|
|
286
|
+
const asked = { ...demo("planned"), ask: { prompt: "What does that touch?" } };
|
|
287
|
+
expect(kioskView(asked, { components: true })).toEqual({ view: "resources", pinned: false, secs: null });
|
|
288
|
+
expect(kioskView(asked, { components: true, pick: { view: "components", at: 0 }, now: 1000 }).view).toBe("resources");
|
|
289
|
+
expect(kioskView({ ...demo("planned"), ask: null }, { components: true }).view).toBe("components");
|
|
285
290
|
expect(kioskView(demo("waiting"), { components: false, pick: { view: "components", at: 0 }, now: 1000 }).view).toBe("resources");
|
|
286
291
|
expect(kioskView(null, { components: true }).view).toBe("components");
|
|
287
292
|
expect(kioskView(null, { components: false }).view).toBe("resources");
|
|
293
|
+
// behold#942: a scenario held in ask mode draws the resources at its steps without a prompt too.
|
|
294
|
+
expect(kioskView(demo("applying"), { components: true, ask: true }).view).toBe("resources");
|
|
288
295
|
});
|
|
289
296
|
|
|
290
297
|
it("holds a clicked view for 90 s after the last click, then follows the step again", () => {
|
|
@@ -669,3 +676,20 @@ describe("a held shot on a touch screen", () => {
|
|
|
669
676
|
}
|
|
670
677
|
});
|
|
671
678
|
});
|
|
679
|
+
|
|
680
|
+
describe("ask mode holds for a scenario (behold#942)", () => {
|
|
681
|
+
const step = (name, extra = {}) => ({ ...demo(name), cycle: 3, scenario: "choudoufu-compose-create", ...extra });
|
|
682
|
+
it("a prompt turns it on, and the steps without one keep it", () => {
|
|
683
|
+
let held = askHeld(null, step("pull-request"));
|
|
684
|
+
expect(held).toBe(null);
|
|
685
|
+
held = askHeld(held, step("planned", { ask: { prompt: "Add a subnet" } }));
|
|
686
|
+
expect(held).toBe("3|choudoufu-compose-create");
|
|
687
|
+
for (const name of ["merged", "applying", "waiting", "resumed", "applied", "reset"]) expect(askHeld(held, step(name))).toBe(held);
|
|
688
|
+
});
|
|
689
|
+
it("another scenario or cycle without a prompt lets it go", () => {
|
|
690
|
+
const held = "3|choudoufu-compose-create";
|
|
691
|
+
expect(askHeld(held, step("pull-request", { scenario: "other" }))).toBe(null);
|
|
692
|
+
expect(askHeld(held, step("pull-request", { cycle: 4 }))).toBe(null);
|
|
693
|
+
expect(askHeld(held, null)).toBe(null);
|
|
694
|
+
});
|
|
695
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// behold#1008: how a composed run's member box says whether a preview was made of it.
|
|
2
|
+
//
|
|
3
|
+
// chant's composed run (src/chant-compose.ts composedView) gives each member a kind in `answer.chant.members`:
|
|
4
|
+
// hole nothing could be previewed (its change set lists holes); the box is dashed and tagged "no preview";
|
|
5
|
+
// previewed a preview that reads values known after apply; the box is tagged "previewed";
|
|
6
|
+
// plain a preview with every value known; no tag.
|
|
7
|
+
// The estate scene (web/kiosk-estate-scene.js) draws the marks and the kiosk's "How to read this" (web/kiosk.js
|
|
8
|
+
// readingRows) says what they mean, from the words here, so the two never drift apart.
|
|
9
|
+
|
|
10
|
+
/** The tag on a box of each marked kind. A plain member has none. */
|
|
11
|
+
export const KIND_TAGS = { hole: "no preview", previewed: "previewed" };
|
|
12
|
+
|
|
13
|
+
/** The legend's line for each marked kind, in the order the legend lists them. */
|
|
14
|
+
export const KIND_ROWS = [
|
|
15
|
+
{ mark: "hole", words: "Dashed box: a stack no preview could be made of." },
|
|
16
|
+
{ mark: "previewed", words: "Tag previewed: some values known after apply." },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
/** The words in a hole's empty box. */
|
|
20
|
+
export const HOLE_WORDS = "nothing could be previewed";
|
|
21
|
+
|
|
22
|
+
/** Each member's kind by path, from a composed answer: `Map<path, { kind, reasons }>`. Empty when the answer has none. */
|
|
23
|
+
export function memberKinds(answer) {
|
|
24
|
+
const out = new Map();
|
|
25
|
+
const rows = answer && answer.chant && Array.isArray(answer.chant.members) ? answer.chant.members : [];
|
|
26
|
+
for (const m of rows) {
|
|
27
|
+
if (!m || typeof m.member !== "string" || (m.kind !== "hole" && m.kind !== "previewed" && m.kind !== "plain")) continue;
|
|
28
|
+
out.set(m.member, { kind: m.kind, reasons: Array.isArray(m.reasons) ? m.reasons.filter((r) => typeof r === "string") : [] });
|
|
29
|
+
}
|
|
30
|
+
return out;
|
|
31
|
+
}
|
package/web/small-stage.test.js
CHANGED
|
@@ -78,6 +78,10 @@ describe("nothing overlays the graph in Watch, on a held small stage only", () =
|
|
|
78
78
|
}
|
|
79
79
|
// A drawer the viewer opened on a wave shows until they fold it.
|
|
80
80
|
expect(watchOverlays({ kind: "result", opened: true, held: true }).drawer).toBe(true);
|
|
81
|
+
// behold#939: ask mode shows no card, badge or drawer of the run, over any stage.
|
|
82
|
+
for (const kind of ["held", "active", "result", "change", "whole"]) expect(watchOverlays({ kind, opened: false, held: false, ask: true })).toEqual({ result: false, callout: false, badges: false, drawer: false });
|
|
83
|
+
expect(watchOverlays({ kind: "result", opened: true, ask: true }).drawer).toBe(true);
|
|
84
|
+
expect(watchOverlays({ kind: "result", opened: false, held: false })).toEqual({ result: true, callout: true, badges: true, drawer: false });
|
|
81
85
|
});
|
|
82
86
|
|
|
83
87
|
it("not held (b-waves, failure, tg-planned-outputs): the callout, the badges, the result card and the step's drawer, as on main", () => {
|