From fcb6709280921c7d28fecaf42e687f063967577e Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:38:26 +0100 Subject: [PATCH 01/80] feat(player): port prototype iconography verbatim --- src/react/player-icons.tsx | 98 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 src/react/player-icons.tsx diff --git a/src/react/player-icons.tsx b/src/react/player-icons.tsx new file mode 100644 index 00000000..6575eae1 --- /dev/null +++ b/src/react/player-icons.tsx @@ -0,0 +1,98 @@ +import type * as React from "react"; + +/** Icon shapes copied from the Throughline player design prototype. */ +export type IconName = + | "back" + | "check" + | "chevron" + | "expand" + | "shrink" + | "focus" + | "forward" + | "home" + | "inspect" + | "minus" + | "narrate" + | "options" + | "pause" + | "play" + | "plus" + | "restart" + | "sound" + | "soundOff" + | "collapse" + | "uncollapse" + | "fit"; + +const SPEEDS = [0.5, 1, 2] as const; +const BASE_STEP_MS = 1500; +const MIN_ZOOM = 0.6; +const MAX_ZOOM = 4; + +const ICONS: Record = { + back: ( + <> + + + + ), + forward: ( + <> + + + + ), + play: , + pause: ( + <> + + + + ), + sound: ( + <> + + + + ), + soundOff: ( + <> + + + + ), + narrate: ( + <> + + + + ), + expand: , + shrink: , + inspect: ( + <> + + + + + ), + chevron: , + options: , + plus: , + minus: , + fit: , + focus: ( + <> + + + + ), + restart: , + home: , + collapse: , + uncollapse: , + check: , +}; + +export function PlayerIcon({ name, size = 16 }: { name: IconName; size?: number }) { + return \ No newline at end of file From 361f8f9f33bf2fd5eea48d20fa7054e05dbe9ae0 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:38:41 +0100 Subject: [PATCH 02/80] fix(player): complete ported icon component --- src/react/player-icons.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/react/player-icons.tsx b/src/react/player-icons.tsx index 6575eae1..6387e6ef 100644 --- a/src/react/player-icons.tsx +++ b/src/react/player-icons.tsx @@ -1,6 +1,6 @@ import type * as React from "react"; -/** Icon shapes copied from the Throughline player design prototype. */ +/** Icon shapes ported directly from the player design prototype. */ export type IconName = | "back" | "check" @@ -95,4 +95,12 @@ const ICONS: Record = { }; export function PlayerIcon({ name, size = 16 }: { name: IconName; size?: number }) { - return \ No newline at end of file + return ( + + ); +} + From bef243bae6a92955bf62cdb0241aae6df61a9c1b Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:40:22 +0100 Subject: [PATCH 03/80] style(player): port prototype layouts and responsive rules using existing Throughline palette --- src/styles/throughline.css | 1523 ++++++++++++++++++++++++++++++++++++ 1 file changed, 1523 insertions(+) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index e31b9276..b893b85e 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -1156,3 +1156,1526 @@ border-bottom: 1px solid var(--thl-line); padding-block: 0.5rem; } + +/* Faithful prototype layout; palette intentionally comes from --thl-* above. */ +.thl.player-shell{ + background: color-mix(in srgb, var(--thl-panel) 97%, transparent); + border: 1px solid var(--thl-line); + border-radius: var(--radius); + box-shadow: + 0 32px 90px rgba(0, 0, 0, 0.55), + 0 0 0 1px color-mix(in srgb, var(--thl-text) 2%, transparent) inset; + overflow: hidden; + min-width: 0; +}.thl.player-shell:fullscreen{ + width: 100vw; + height: 100vh; + display: flex; + flex-direction: column; + background: var(--thl-bg); +}.thl.player-shell:fullscreen .player-content{ + flex: 1; +}.thl.player-shell:fullscreen .canvas{ + min-height: 0; +}.thl .player-header{ + height: 40px; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 8px 0 14px; + border-bottom: 1px solid var(--line); + background: var(--thl-panel); +}.thl .title-block, +.thl .header-actions, +.thl .title-block > div:last-child{ + display: flex; + align-items: center; +}.thl .title-block{ + gap: 11px; + min-width: 0; +}.thl .title-block > div:last-child{ + display: block; + min-width: 0; +}.thl .engine-mark{ + width: 27px; + height: 27px; + display: grid; + place-items: center; + color: var(--thl-bg); + background: var(--acid); + border-radius: var(--radius); + box-shadow: 0 0 20px color-mix(in srgb, var(--thl-active) 12%, transparent); +}.thl .title-block h1{ + margin: 0; + font-size: 14px; + line-height: 1.2; + letter-spacing: -0.01em; + font-weight: 600; +}.thl .title-block p{ + margin: 4px 0 0; + color: var(--muted); + font: + 400 10px/1 "IBM Plex Mono", + monospace; +}.thl .title-block p span{ + color: var(--acid); +}.thl .header-actions{ + gap: 5px; +}.thl .header-actions button{ + height: 26px; + min-width: 26px; + padding: 0 8px; + display: inline-flex; + justify-content: center; + align-items: center; + gap: 7px; + border: 1px solid transparent; + border-radius: var(--radius); + background: transparent; + color: var(--thl-muted); + font-size: 11px; + cursor: pointer; +}.thl .header-actions button:hover, +.thl .header-actions button.active{ + color: var(--ink); + background: var(--thl-surface); + border-color: var(--thl-line); +}.thl .compiled-status{ + margin-right: 7px; + color: var(--thl-muted); + font: + 500 9px/1 "IBM Plex Mono", + monospace; + letter-spacing: 0.08em; +}.thl .compiled-status i{ + display: inline-block; + width: 5px; + height: 5px; + margin-right: 5px; + border-radius: 50%; + background: var(--acid); + box-shadow: 0 0 8px var(--acid); +}.thl .context-bar{ + min-height: 28px; + padding: 0 14px 0 18px; + display: flex; + align-items: center; + justify-content: space-between; + border-bottom: 1px solid var(--line); + background: var(--thl-bg); +}.thl .view-tabs{ + align-self: stretch; + display: flex; + gap: 2px; +}.thl .view-tabs button{ + position: relative; + padding: 0 11px; + border: 0; + background: transparent; + color: var(--thl-muted); + font: + 500 10px/1 "IBM Plex Mono", + monospace; + cursor: pointer; +}.thl .view-tabs button:hover{ + color: var(--thl-text); +}.thl .view-tabs button.active{ + color: var(--ink); +}.thl .view-tabs button.active::after{ + content: ""; + position: absolute; + left: 10px; + right: 10px; + bottom: -1px; + height: 1px; + background: var(--acid); +}.thl .truth-note{ + color: var(--thl-muted); + font: + 400 9px/1 "IBM Plex Mono", + monospace; +}.thl .truth-note span{ + color: var(--thl-muted); +}.thl .truth-note i{ + display: inline-block; + width: 2px; + height: 2px; + margin: 0 7px 2px; + background: var(--thl-muted); +}.thl .player-content{ + display: grid; + grid-template-columns: minmax(0, 1fr); + min-height: 330px; +}.thl .player-content.with-inspector{ + grid-template-columns: minmax(0, 1fr) 246px; +}.thl .canvas{ + min-width: 0; + min-height: 330px; + position: relative; + background: var(--thl-bg); + overflow: hidden; +}.thl .canvas::before{ + content: ""; + position: absolute; + inset: 0; + pointer-events: none; + opacity: 0.25; + background-image: radial-gradient(var(--thl-line) 0.6px, transparent 0.6px); + background-size: 15px 15px; +}.thl .canvas-meta{ + position: absolute; + top: 10px; + left: 14px; + right: 14px; + z-index: 2; + display: flex; + align-items: center; + gap: 8px; + font: + 500 9px/1 "IBM Plex Mono", + monospace; +}.thl .canvas-meta span{ + color: var(--thl-muted); +}.thl .canvas-meta strong{ + color: var(--thl-muted); + font-weight: 500; +}.thl .canvas-meta code{ + margin-left: auto; + color: var(--acid); + font-size: 9px; +}.thl .graph-wrap{ + position: absolute; + inset: 30px 0 0; +}.thl .graph{ + width: 100%; + height: calc(100% - 20px); + overflow: visible; + color: var(--thl-muted); +}.thl .group-frame rect{ + fill: color-mix(in srgb, var(--thl-text) 1%, transparent); + stroke: var(--thl-surface); + stroke-dasharray: 3 4; + rx: 2px; +}.thl .group-frame text{ + fill: var(--thl-muted); + font: + 500 8px "IBM Plex Mono", + monospace; + letter-spacing: 0.09em; +}.thl .links path{ + fill: none; + stroke: var(--thl-line); + stroke-width: 1.2; +}.thl .links path.visited{ + stroke: var(--thl-muted); +}.thl .links path.hot{ + stroke: var(--acid); + stroke-width: 1.7; + stroke-dasharray: 5 4; + animation: thl-player-flow 0.7s linear infinite; + color: var(--acid); + filter: drop-shadow(0 0 3px color-mix(in srgb, var(--thl-active) 30%, transparent)); +} +@keyframes thl-player-flow { + to { + stroke-dashoffset: -9; + } +}.thl .entity{ + cursor: pointer; +}.thl .entity rect{ + fill: var(--thl-panel); + stroke: var(--thl-line); + rx: 2px; + transition: 0.15s ease; +}.thl .entity:hover rect{ + fill: var(--thl-surface); + stroke: var(--thl-muted); +}.thl .entity circle{ + fill: var(--thl-muted); +}.thl .entity text{ + pointer-events: none; +}.thl .entity-label{ + fill: var(--thl-text); + font: + 500 10px "DM Sans", + sans-serif; +}.thl .entity-value{ + fill: var(--thl-muted); + font: + 400 8.5px "IBM Plex Mono", + monospace; +}.thl .entity.active rect{ + stroke: var(--acid); + fill: var(--thl-panel); +}.thl .entity.active circle{ + fill: var(--acid); + filter: drop-shadow(0 0 4px color-mix(in srgb, var(--thl-active) 60%, transparent)); +}.thl .entity.active .entity-value{ + fill: var(--acid); +}.thl .entity.selected rect{ + stroke-width: 2px; +}.thl .canvas-hint{ + position: absolute; + left: 14px; + right: 14px; + bottom: 8px; + display: flex; + justify-content: space-between; + color: var(--thl-muted); + font: + 400 8px/1 "IBM Plex Mono", + monospace; +}.thl .sequence-view, +.thl .state-view{ + position: absolute; + inset: 43px 14px 14px; +}.thl .sequence-view{ + overflow: hidden; +}.thl .sequence-head{ + height: 31px; + display: grid; + grid-template-columns: repeat(4, 1fr); + border: 1px solid var(--line); +}.thl .sequence-head span{ + display: grid; + place-items: center; + color: var(--thl-muted); + border-right: 1px solid var(--line); + font: + 500 9px "IBM Plex Mono", + monospace; +}.thl .sequence-head span:last-child{ + border: 0; +}.thl .lifelines{ + position: absolute; + inset: 31px 0 0; + display: grid; + grid-template-columns: repeat(4, 1fr); + pointer-events: none; +}.thl .lifelines i{ + width: 1px; + height: 100%; + justify-self: center; + background: linear-gradient(var(--thl-line) 40%, transparent 40%); + background-size: 1px 6px; +}.thl .sequence-list{ + position: relative; + z-index: 1; + display: grid; + gap: 5px; + padding-top: 14px; +}.thl .sequence-event{ + min-height: 35px; + padding: 7px 10px; + display: grid; + align-items: center; + grid-template-columns: 26px minmax(160px, 1fr) minmax(160px, 1fr); + background: color-mix(in srgb, var(--thl-panel) 94%, transparent); + border: 1px solid var(--thl-line); + border-radius: var(--radius); + font-size: 10px; +}.thl .sequence-event.current{ + border-color: var(--acid); + background: var(--thl-panel); +}.thl .sequence-event.future{ + opacity: 0.28; +}.thl .seq-index{ + color: var(--thl-muted); + font: + 500 9px "IBM Plex Mono", + monospace; +}.thl .seq-route{ + color: var(--thl-muted); +}.thl .seq-route b{ + margin: 0 7px; + color: var(--acid); + font-weight: 400; +}.thl .sequence-event code{ + color: var(--thl-muted); + font: + 400 9px "IBM Plex Mono", + monospace; +}.thl .sequence-event.current code{ + color: var(--acid); +}.thl .state-view{ + border: 1px solid var(--line); + overflow: auto; + background: color-mix(in srgb, var(--thl-panel) 95%, transparent); +}.thl .state-row{ + width: 100%; + min-height: 39px; + padding: 0 12px; + display: grid; + grid-template-columns: 1.1fr 1.2fr 2fr 1fr; + align-items: center; + border: 0; + border-bottom: 1px solid var(--line-soft); + background: transparent; + color: var(--thl-muted); + text-align: left; + font-size: 10px; +}.thl button.state-row{ + cursor: pointer; +}.thl button.state-row:hover{ + background: var(--thl-panel); +}.thl .state-header{ + min-height: 30px; + color: var(--thl-muted); + background: var(--thl-panel); + font: + 500 8px "IBM Plex Mono", + monospace; + letter-spacing: 0.05em; +}.thl .state-row strong{ + color: var(--thl-text); + font-weight: 500; +}.thl .state-row code{ + font: + 400 9px "IBM Plex Mono", + monospace; + color: var(--thl-muted); +}.thl .state-row.changed{ + background: var(--thl-panel); + box-shadow: 2px 0 0 var(--acid) inset; +}.thl .state-row.changed code:nth-child(3){ + color: var(--acid); +}.thl .state-row.future{ + opacity: 0.3; +}.thl .inspector{ + min-width: 0; + border-left: 1px solid var(--line); + background: var(--thl-panel); + padding: 12px; + animation: thl-player-reveal 0.18s ease-out; +} +@keyframes thl-player-reveal { + from { + opacity: 0; + transform: translateX(8px); + } +}.thl .inspector-top{ + display: flex; + align-items: center; + justify-content: space-between; + color: var(--thl-muted); + font: + 500 8px "IBM Plex Mono", + monospace; + letter-spacing: 0.08em; +}.thl .inspector-top button{ + width: 22px; + height: 22px; + border: 0; + background: transparent; + color: var(--thl-muted); + font-size: 17px; + cursor: pointer; +}.thl .entity-heading{ + display: flex; + gap: 9px; + align-items: center; + padding: 14px 0; + border-bottom: 1px solid var(--line); +}.thl .entity-heading > i{ + width: 7px; + height: 7px; + border-radius: 50%; + background: var(--acid); + box-shadow: 0 0 9px color-mix(in srgb, var(--thl-active) 45%, transparent); +}.thl .entity-heading strong{ + display: block; + font-size: 12px; + font-weight: 600; +}.thl .entity-heading code{ + display: block; + margin-top: 4px; + color: var(--thl-muted); + font: + 400 8px "IBM Plex Mono", + monospace; +}.thl .inspector dl{ + margin: 0; + padding: 8px 0 11px; + border-bottom: 1px solid var(--line); +}.thl .inspector dl > div{ + min-height: 27px; + display: grid; + grid-template-columns: 80px 1fr; + align-items: center; +}.thl .inspector dt{ + color: var(--thl-muted); + font-size: 9px; +}.thl .inspector dd{ + margin: 0; + color: var(--thl-text); + font: + 400 9px "IBM Plex Mono", + monospace; + overflow: hidden; + text-overflow: ellipsis; +}.thl .known{ + color: var(--acid); +}.thl .history-title{ + display: flex; + align-items: center; + justify-content: space-between; + margin: 13px 0 10px; + color: var(--thl-muted); + font: + 500 8px "IBM Plex Mono", + monospace; + letter-spacing: 0.06em; +}.thl .history-title b{ + min-width: 16px; + height: 16px; + display: grid; + place-items: center; + background: var(--thl-surface); + color: var(--thl-muted); + border-radius: var(--radius); + font-size: 8px; +}.thl .history-item{ + display: flex; + gap: 8px; + padding-bottom: 14px; +}.thl .history-item > i{ + flex: 0 0 auto; + width: 6px; + height: 6px; + margin-top: 4px; + background: var(--orange); + border-radius: 50%; +}.thl .history-item strong{ + display: block; + color: var(--thl-text); + font: + 500 9px "IBM Plex Mono", + monospace; +}.thl .history-item span{ + display: block; + margin: 4px 0 7px; + color: var(--thl-muted); + font-size: 8px; +}.thl .history-item code{ + display: block; + padding: 7px; + background: var(--thl-bg); + color: var(--thl-muted); + font: + 400 8px/1.5 "IBM Plex Mono", + monospace; + white-space: normal; + word-break: break-all; +}.thl .evidence-note{ + margin-top: 8px; + padding: 9px; + border-left: 1px solid var(--orange); + background: var(--thl-panel); +}.thl .evidence-note span{ + color: var(--orange); + font: + 500 7px "IBM Plex Mono", + monospace; + letter-spacing: 0.08em; +}.thl .evidence-note p{ + margin: 6px 0 0; + color: var(--thl-muted); + font-size: 8px; + line-height: 1.45; +}.thl .step-caption{ + min-height: 67px; + padding: 10px 16px; + display: grid; + grid-template-columns: 32px minmax(0, 1fr) auto; + align-items: center; + gap: 10px; + border-top: 1px solid var(--line); + background: var(--thl-panel); +}.thl .step-number{ + color: var(--acid); + font: + 500 10px "IBM Plex Mono", + monospace; +}.thl .step-caption strong{ + display: block; + color: var(--thl-text); + font-size: 11px; + font-weight: 600; +}.thl .step-caption p{ + margin: 4px 0 0; + color: var(--thl-muted); + font-size: 9px; + line-height: 1.35; +}.thl .event-chip{ + padding: 5px 7px; + border: 1px solid var(--thl-line); + border-radius: var(--radius); + color: var(--acid); + background: var(--thl-surface); + font: + 500 8px "IBM Plex Mono", + monospace; +}.thl .event-chip.write{ + color: var(--orange); + border-color: var(--thl-change); + background: var(--thl-panel); +}.thl .transport{ + height: 46px; + padding: 0 14px; + display: grid; + grid-template-columns: auto minmax(160px, 1fr) auto; + align-items: center; + gap: 18px; + border-top: 1px solid var(--line); + background: var(--thl-bg); +}.thl .transport-buttons{ + display: flex; + gap: 4px; +}.thl .transport-buttons button, +.thl .speed{ + width: 29px; + height: 29px; + display: grid; + place-items: center; + padding: 0; + border: 1px solid var(--thl-line); + border-radius: var(--radius); + background: var(--thl-panel); + color: var(--thl-muted); + cursor: pointer; +}.thl .transport-buttons button:hover:not(:disabled), +.thl .speed:hover{ + color: var(--ink); + border-color: var(--thl-muted); + background: var(--thl-surface); +}.thl .transport-buttons button:disabled{ + opacity: 0.28; + cursor: default; +}.thl .transport-buttons .play{ + width: 34px; + color: var(--thl-bg); + background: var(--acid); + border-color: var(--acid); +}.thl .transport-buttons .play:hover{ + color: var(--thl-bg); + background: color-mix(in oklch, var(--thl-active) 83%, var(--thl-text)); + border-color: color-mix(in oklch, var(--thl-active) 83%, var(--thl-text)); +}.thl .timeline{ + position: relative; + height: 29px; +}.thl .timeline-line{ + position: absolute; + top: 7px; + left: 8px; + right: 8px; + height: 1px; + background: var(--thl-line); +}.thl .timeline-progress{ + height: 1px; + background: var(--acid); + box-shadow: 0 0 5px color-mix(in srgb, var(--thl-active) 35%, transparent); +}.thl .timeline-marks{ + height: 100%; + display: flex; + justify-content: space-between; + position: relative; +}.thl .timeline-marks button{ + width: 17px; + padding: 0; + border: 0; + background: transparent; + color: var(--thl-muted); + cursor: pointer; + font: + 400 7px "IBM Plex Mono", + monospace; +}.thl .timeline-marks i{ + display: block; + width: 5px; + height: 5px; + margin: 5px auto 5px; + border: 1px solid var(--thl-muted); + border-radius: 50%; + background: var(--thl-bg); +}.thl .timeline-marks button.passed i{ + border-color: var(--acid); + background: var(--acid); +}.thl .timeline-marks button.current i{ + width: 9px; + height: 9px; + margin-top: 3px; + margin-bottom: 3px; + box-shadow: + 0 0 0 3px color-mix(in srgb, var(--thl-active) 10%, transparent), + 0 0 8px color-mix(in srgb, var(--thl-active) 40%, transparent); +}.thl .timeline-marks button.current{ + color: var(--thl-muted); +}.thl .transport-meta{ + display: flex; + align-items: center; + gap: 10px; + color: var(--thl-muted); + font: + 400 9px "IBM Plex Mono", + monospace; +}.thl .transport-meta strong{ + color: var(--thl-text); + font-weight: 500; +}.thl .speed{ + width: 43px; + display: flex; + justify-content: center; + gap: 2px; + font: + 500 9px "IBM Plex Mono", + monospace; +}.thl .footnote{ + margin-top: 12px; + text-align: center; + color: var(--thl-muted); + font: + 400 8px "IBM Plex Mono", + monospace; +}.thl .footnote span{ + color: var(--thl-muted); +}.thl .footnote i{ + display: inline-block; + width: 2px; + height: 2px; + margin: 0 8px 2px; + background: var(--thl-line); +} + +@container (max-width: 760px) {.thl main{ + padding: 20px 10px; + place-items: start center; + }.thl .compiled-status, +.thl .truth-note, +.thl .header-actions button span{ + display: none; + }.thl .player-content.with-inspector{ + grid-template-columns: 1fr; + }.thl .inspector{ + position: absolute; + z-index: 10; + right: 0; + top: 0; + bottom: 0; + width: min(270px, 86%); + box-shadow: -20px 0 40px rgba(0, 0, 0, 0.4); + }.thl .player-content{ + position: relative; + min-height: 310px; + }.thl .canvas{ + min-height: 310px; + }.thl .graph{ + min-width: 680px; + transform: translateX(-35px); + }.thl .sequence-event{ + grid-template-columns: 22px 1fr; + }.thl .sequence-event code{ + display: none; + }.thl .state-row{ + grid-template-columns: 1fr 1fr 1.5fr; + }.thl .state-row > :last-child{ + display: none; + }.thl .transport{ + grid-template-columns: auto 1fr; + gap: 10px; + }.thl .transport-meta{ + display: none; + }.thl .step-caption{ + grid-template-columns: 25px 1fr; + }.thl .event-chip{ + display: none; + } +} + +@container (max-width: 480px) {.thl .eyebrow, +.thl .footnote{ + display: none; + }.thl .player-header{ + padding-left: 12px; + }.thl .context-bar{ + padding-left: 8px; + }.thl .player-content, +.thl .canvas{ + min-height: 292px; + }.thl .graph-wrap{ + overflow-x: auto; + }.thl .graph{ + width: 680px; + transform: none; + }.thl .canvas-meta code{ + display: none; + }.thl .step-caption p{ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + }.thl .transport{ + padding: 0 8px; + }.thl .timeline-marks button span{ + display: none; + } +} + +@media (prefers-reduced-motion: reduce) {.thl *, +.thl *::before, +.thl *::after{ + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + scroll-behavior: auto !important; + } +}.thl .title-block h1{ + font-size: 13px; +}.thl .view-tabs button{ + padding: 0 10px; +}.thl .scrubber{ + -webkit-appearance: none; + appearance: none; + width: 100%; + height: 14px; + margin: 0; + background: transparent; + cursor: pointer; +}.thl .scrubber::-webkit-slider-runnable-track{ + height: 2px; + border-radius: var(--radius); + background: linear-gradient(90deg, var(--acid) var(--p), var(--thl-line) var(--p)); +}.thl .scrubber::-moz-range-track{ + height: 2px; + background: var(--thl-line); +}.thl .scrubber::-moz-range-progress{ + height: 2px; + background: var(--acid); +}.thl .scrubber::-webkit-slider-thumb{ + -webkit-appearance: none; + width: 8px; + height: 12px; + margin-top: -5px; + border-radius: var(--radius); + background: var(--ink); + border: 0; +}.thl .scrubber::-moz-range-thumb{ + width: 8px; + height: 12px; + border-radius: var(--radius); + background: var(--ink); + border: 0; +}.thl .sr-only{ + position: absolute; + width: 1px; + height: 1px; + margin: -1px; + overflow: hidden; + clip: rect(0 0 0 0); + white-space: nowrap; +}.thl.player-shell{ + position: relative; + overflow: visible; +}.thl.player-shell:fullscreen{ + overflow: auto; +}.thl .narration-error{ + margin: 0; + padding: 6px 14px; + color: var(--orange); + background: var(--thl-panel); + border-bottom: 1px solid var(--thl-change); + font: 400 10px "IBM Plex Mono", monospace; +}.thl .chapter-pill{ + margin-left: 10px; + padding: 3px 7px; + border: 1px solid var(--thl-line); + border-radius: var(--radius); + color: var(--acid); + background: var(--thl-panel); + font: 500 9px/1 "IBM Plex Mono", monospace; + white-space: nowrap; +}.thl .title-block{ + display: flex; + align-items: center; +}.thl .title-block h1{ + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +}.thl .menu-anchor{ + position: relative; +}.thl .header-actions .menu-trigger{ + gap: 6px; +}.thl .options-menu{ + position: absolute; + z-index: 40; + top: calc(100% + 8px); + right: -2px; + width: min(318px, calc(100vw - 24px)); + max-height: min(520px, calc(100vh - 120px)); + overflow-y: auto; + padding: 4px 0; + border: 1px solid var(--thl-line); + border-radius: 4px; + background: var(--thl-panel); + box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px color-mix(in srgb, var(--thl-text) 2%, transparent) inset; + animation: thl-player-pop 0.14s ease-out; + text-align: left; +} +@keyframes thl-player-pop { + from { + opacity: 0; + transform: translateY(-4px) scale(0.985); + } +}.thl .options-menu section{ + padding: 10px 12px 12px; + display: grid; + gap: 8px; +}.thl .options-menu section + section{ + border-top: 1px solid var(--line); +}.thl .opt-label{ + margin: 0; + display: flex; + align-items: center; + justify-content: space-between; + color: var(--thl-muted); + font: 500 8px/1 "IBM Plex Mono", monospace; + letter-spacing: 0.1em; + text-transform: uppercase; +}.thl .opt-label em{ + color: var(--thl-muted); + font-style: normal; + letter-spacing: 0.04em; + text-transform: none; +}.thl .opt-fieldset{ + min-width: 0; + margin: 0; + padding: 0; + border: 0; + display: grid; + gap: 8px; +}.thl .opt-fieldset:disabled{ + opacity: 0.35; +}.thl .opt-field{ + min-width: 0; + flex: 1; + display: grid; + gap: 4px; +}.thl .opt-field label{ + color: var(--thl-muted); + font-size: 10px; +}.thl .opt-row{ + display: flex; + align-items: flex-end; + gap: 6px; +}.thl .opt-select{ + position: relative; + display: block; + min-width: 0; + color: var(--thl-muted); +}.thl .opt-select.grow{ + flex: 1; +}.thl .opt-select svg{ + position: absolute; + right: 7px; + top: 50%; + transform: translateY(-50%); + pointer-events: none; +}.thl .options-menu select, +.thl .options-menu input[type="number"]{ + width: 100%; + height: 28px; + padding: 0 24px 0 8px; + border: 1px solid var(--thl-line); + border-radius: var(--radius); + background: var(--thl-bg); + color: var(--thl-text); + font: 400 11px "DM Sans", sans-serif; + appearance: none; + outline: none; +}.thl .options-menu input[type="number"]{ + padding-right: 8px; + font-family: "IBM Plex Mono", monospace; +}.thl .options-menu select:hover, +.thl .options-menu input:hover, +.thl .options-menu select:focus-visible, +.thl .options-menu input:focus-visible{ + border-color: var(--thl-muted); +}.thl .options-menu select:disabled{ + cursor: default; +}.thl.player-shell .options-menu button{ + height: 28px; + min-width: 28px; + padding: 0 8px; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 7px; + border: 1px solid var(--thl-line); + border-radius: var(--radius); + background: var(--thl-panel); + color: var(--thl-muted); + font: 500 10.5px "DM Sans", sans-serif; + cursor: pointer; + transition: 0.12s ease; +}.thl.player-shell .options-menu button:hover:not(:disabled){ + color: var(--ink); + border-color: var(--thl-muted); + background: var(--thl-surface); +}.thl.player-shell .options-menu button:disabled{ + opacity: 0.35; + cursor: default; +}.thl.player-shell .options-menu .opt-icon{ + padding: 0; + width: 28px; + flex: 0 0 auto; +}.thl.player-shell .options-menu .opt-go{ + padding: 0 12px; +}.thl .opt-grid{ + display: grid; + grid-template-columns: 1fr 1fr; + gap: 6px; +}.thl.player-shell .options-menu .opt-toggle{ + justify-content: flex-start; + min-width: 0; +}.thl .opt-toggle span{ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +}.thl.player-shell .options-menu .opt-toggle.on{ + color: var(--acid); + border-color: var(--thl-trail); + background: var(--thl-panel); +}.thl .group-nav{ + display: flex; + align-items: center; + gap: 6px; +}.thl .crumb{ + color: var(--thl-muted); + font: 400 9px "IBM Plex Mono", monospace; + white-space: nowrap; + max-width: 70px; + overflow: hidden; + text-overflow: ellipsis; +}.thl .speed-seg{ + display: grid; + grid-template-columns: repeat(3, 1fr); + padding: 2px; + gap: 2px; + border: 1px solid var(--thl-line); + border-radius: var(--radius); + background: var(--thl-bg); +}.thl.player-shell .options-menu .speed-seg button{ + height: 22px; + border: 0; + background: transparent; + font: 500 10px "IBM Plex Mono", monospace; +}.thl.player-shell .options-menu .speed-seg button.on{ + background: var(--thl-surface); + color: var(--acid); +}.thl .graph{ + width: 100%; + min-width: 0; + transform: none; + cursor: grab; + touch-action: none; + outline-offset: -2px; +}.thl .graph:active{ + cursor: grabbing; +}.thl .graph-wrap{ + overflow: hidden; +}.thl .entity.summary rect{ + stroke-dasharray: 3 3; +}.thl .group-frame g.collapsed rect{ + opacity: 0.4; +}.thl .canvas-hint{ + align-items: center; + bottom: 6px; +}.thl .canvas-hint > span{ + pointer-events: none; +}.thl .zoom-tools{ + display: flex; + align-items: center; + gap: 3px; + padding: 2px; + border: 1px solid var(--thl-line); + border-radius: var(--radius); + background: color-mix(in srgb, var(--thl-panel) 90%, transparent); +}.thl .zoom-tools button{ + width: 22px; + height: 20px; + display: grid; + place-items: center; + padding: 0; + border: 0; + background: transparent; + color: var(--thl-muted); + cursor: pointer; +}.thl .zoom-tools button:hover:not(:disabled){ + color: var(--ink); + background: var(--thl-surface); +}.thl .zoom-tools button:disabled{ + opacity: 0.3; + cursor: default; +}.thl .zoom-readout{ + min-width: 32px; + text-align: center; + color: var(--thl-muted); + font: 500 8px "IBM Plex Mono", monospace; +}.thl .history-empty{ + margin: 0 0 12px; + color: var(--thl-muted); + font-size: 9px; +}.thl .transport{ + grid-template-columns: auto minmax(0, 1fr) auto; +}.thl .progress{ + display: flex; + gap: 3px; + align-items: center; +}.thl .progress i{ + flex: 1; + height: 2px; + border-radius: 1px; + background: var(--thl-line); + transition: background 0.2s ease; +}.thl .progress i.past{ + background: var(--thl-trail); +}.thl .progress i.now{ + height: 3px; + background: var(--acid); + box-shadow: 0 0 6px color-mix(in srgb, var(--thl-active) 45%, transparent); +}.thl .step-caption{ + display: block; + min-height: 0; + padding: 0; + border-top: 1px solid var(--line); + background: var(--thl-panel); + border-radius: 0 0 var(--radius) var(--radius); +}.thl .step-caption > summary{ + list-style: none; + display: grid; + grid-template-columns: 24px minmax(0, 1fr) auto auto; + align-items: center; + gap: 10px; + padding: 9px 14px; + cursor: pointer; + user-select: none; +}.thl .step-caption > summary::-webkit-details-marker{ + display: none; +}.thl .step-caption > summary:hover{ + background: var(--thl-surface); +}.thl .caption-text{ + min-width: 0; +}.thl .caption-text strong{ + display: block; + color: var(--thl-text); + font-size: 11.5px; + font-weight: 600; +}.thl .caption-text .teaser{ + display: block; + margin-top: 3px; + color: var(--thl-muted); + font-size: 9.5px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +}.thl .step-caption[open] .teaser{ + display: none; +}.thl .caption-expand{ + display: inline-flex; + align-items: center; + gap: 3px; + color: var(--thl-muted); + font: 500 9px "IBM Plex Mono", monospace; +}.thl .caption-expand svg{ + transition: transform 0.18s ease; +}.thl .step-caption[open] .caption-expand svg{ + transform: rotate(180deg); +}.thl .caption-body{ + display: grid; + gap: 10px; + max-height: 240px; + overflow-y: auto; + padding: 0 14px 14px 48px; + animation: thl-player-thl-player-reveal-down 0.18s ease-out; +} +@keyframes thl-player-thl-player-reveal-down { + from { + opacity: 0; + transform: translateY(-4px); + } +}.thl .caption-note{ + margin: 0; + color: var(--thl-muted); + font-size: 11px; + line-height: 1.5; +}.thl .transfers{ + margin: 0; + padding: 0; + list-style: none; + display: flex; + flex-wrap: wrap; + gap: 6px; +}.thl .transfers li{ + display: inline-flex; + align-items: center; + gap: 6px; + padding: 4px 8px; + border: 1px solid var(--thl-line); + border-radius: var(--radius); + background: var(--thl-panel); + color: var(--thl-muted); + font-size: 10px; +}.thl .transfers b{ + color: var(--acid); + font-weight: 500; +}.thl .transfers code{ + color: var(--orange); + font: 400 9px "IBM Plex Mono", monospace; +}.thl .guidance{ + display: grid; + grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); + gap: 8px; +}.thl .chapter-card, +.thl .causal-card{ + padding: 9px 10px; + border-left: 1px solid var(--acid); + background: var(--thl-panel); +}.thl .causal-card{ + border-left-color: var(--orange); + background: var(--thl-panel); +}.thl .chapter-card > span, +.thl .causal-card > span{ + display: block; + margin-bottom: 5px; + color: var(--acid); + font: 500 7px "IBM Plex Mono", monospace; + letter-spacing: 0.1em; +}.thl .causal-card > span{ + color: var(--orange); +}.thl .chapter-card strong, +.thl .causal-card strong{ + color: var(--thl-text); + font-size: 11px; +}.thl .chapter-card p{ + margin: 4px 0 0; + color: var(--thl-muted); + font-size: 10px; + line-height: 1.45; +}.thl .causal-card dl{ + margin: 8px 0 0; + display: grid; + gap: 5px; +}.thl .causal-card dl > div{ + display: grid; + grid-template-columns: 82px 1fr; + gap: 8px; +}.thl .causal-card dt{ + color: var(--thl-muted); + font-size: 9px; +}.thl .causal-card dd{ + margin: 0; + color: var(--thl-muted); + font-size: 10px; + line-height: 1.4; +}.thl .causal-card .evidence{ + margin: 8px 0 0; + color: var(--thl-muted); + font: 400 8.5px/1.45 "IBM Plex Mono", monospace; +}.thl .state-snapshot summary{ + color: var(--thl-muted); + font: 500 9px "IBM Plex Mono", monospace; + cursor: pointer; +}.thl .state-snapshot summary:hover{ + color: var(--ink); +}.thl .state-snapshot dl{ + margin: 8px 0 0; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); + gap: 4px 12px; +}.thl .state-snapshot dl > div{ + display: flex; + justify-content: space-between; + gap: 8px; + padding: 4px 0; + border-bottom: 1px solid var(--thl-surface); + font-size: 10px; + color: var(--thl-muted); +}.thl .state-snapshot dt span{ + color: var(--thl-muted); +}.thl .state-snapshot dd{ + margin: 0; +}.thl .state-snapshot code{ + color: var(--acid); + font: 400 9px "IBM Plex Mono", monospace; +} + +@container (max-width: 760px) {.thl .options-menu{ + position: fixed; + top: auto; + right: 12px; + left: 12px; + width: auto; + bottom: 12px; + max-height: 70vh; + }.thl .header-actions .menu-trigger span{ + display: none; + }.thl .chapter-pill{ + display: none; + }.thl .step-caption > summary{ + grid-template-columns: 22px minmax(0, 1fr) auto; + }.thl .step-caption > summary .event-chip{ + display: none; + }.thl .caption-body{ + padding-left: 14px; + }.thl .transport{ + grid-template-columns: auto minmax(0, 1fr); + }.thl .canvas-hint > span{ + display: none; + }.thl .canvas-hint{ + justify-content: flex-end; + } +}.thl .transport{ + display: flex; + justify-content: space-between; +}.thl .sequence-view{ + display: flex; + flex-direction: column; + overflow: hidden; + inset: 40px 12px 12px; +}.thl .seq-scroll{ + flex: 1; + min-height: 0; + overflow-y: auto; + border: 1px solid var(--line); + background: color-mix(in srgb, var(--thl-panel) 90%, transparent); +}.thl .sequence-head{ + position: sticky; + top: 0; + z-index: 3; + height: 26px; + border: 0; + border-bottom: 1px solid var(--line); + background: var(--thl-panel); +}.thl .seq-body{ + position: relative; +}.thl .lifelines{ + inset: 0; +}.thl .sequence-list{ + margin: 0; + padding: 6px 0 10px; + list-style: none; + gap: 0; +}.thl .seq-row{ + display: grid; + grid-template-columns: repeat(4, 1fr); + align-items: end; + height: 42px; + transition: opacity 0.2s ease; +}.thl .seq-row.future{ + opacity: 0.25; +}.thl .seq-line{ + position: relative; + display: block; + height: 100%; +}.thl .seq-label{ + position: absolute; + left: 10px; + right: 10px; + bottom: 14px; + display: flex; + justify-content: center; + gap: 6px; + align-items: baseline; + min-width: 0; +}.thl .seq-label b{ + color: var(--thl-muted); + font: 500 8px "IBM Plex Mono", monospace; +}.thl .seq-label code{ + min-width: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: var(--thl-muted); + font: 400 9px "IBM Plex Mono", monospace; +}.thl .seq-arrow{ + position: absolute; + left: 0; + right: 0; + bottom: 8px; + height: 1px; + background: var(--thl-muted); +}.thl .seq-row.right .seq-arrow::after, +.thl .seq-row.left .seq-arrow::before{ + content: ""; + position: absolute; + top: -3px; + border: 3.5px solid transparent; +}.thl .seq-row.right .seq-arrow::after{ + right: 0; + border-left: 6px solid var(--thl-muted); +}.thl .seq-row.left .seq-arrow::before{ + left: 0; + border-right: 6px solid var(--thl-muted); +}.thl .seq-row.self .seq-arrow{ + left: 0; + right: auto; + width: 7px; + height: 7px; + bottom: 5px; + border-radius: 50%; + background: var(--thl-muted); +}.thl .seq-row.self .seq-label{ + left: 18px; + right: 6px; + justify-content: flex-start; +}.thl .seq-row.self.flip .seq-line{ + display: flex; + justify-content: flex-end; +}.thl .seq-row.self.flip .seq-label{ + left: 6px; + right: 18px; + justify-content: flex-end; +}.thl .seq-row.self.flip .seq-arrow{ + left: auto; + right: 0; +}.thl .seq-row.current .seq-arrow{ + background: var(--acid); + box-shadow: 0 0 6px color-mix(in srgb, var(--thl-active) 50%, transparent); +}.thl .seq-row.current.right .seq-arrow::after{ + border-left-color: var(--acid); +}.thl .seq-row.current.left .seq-arrow::before{ + border-right-color: var(--acid); +}.thl .seq-row.current .seq-label code, +.thl .seq-row.current .seq-label b{ + color: var(--acid); +}.thl .seq-detail{ + flex: 0 0 auto; + display: flex; + align-items: baseline; + gap: 10px; + padding: 8px 2px 0; + min-height: 26px; +}.thl .seq-detail > span{ + color: var(--acid); + font: 500 8px "IBM Plex Mono", monospace; + letter-spacing: 0.1em; +}.thl .seq-detail p{ + margin: 0; + min-width: 0; + color: var(--thl-muted); + font-size: 10px; + line-height: 1.4; +}.thl .seq-detail b{ + margin: 0 4px; + color: var(--acid); + font-weight: 400; +}.thl .seq-detail code{ + margin-left: 6px; + color: var(--thl-muted); + font: 400 9px "IBM Plex Mono", monospace; + word-break: break-all; +}.thl .graph-wrap{ + overflow: hidden; +} + +@container (max-width: 760px) {.thl .transport{ + display: flex; + }.thl .sequence-view{ + inset: 36px 8px 8px; + }.thl .seq-label code{ + font-size: 8px; + }.thl .seq-label b{ + display: none; + }.thl .state-view{ + inset: 36px 8px 8px; + }.thl .state-header{ + display: none; + }.thl .state-row{ + grid-template-columns: minmax(0, 1fr) auto; + grid-template-areas: "entity value" "path origin"; + row-gap: 3px; + padding: 8px 12px; + }.thl .state-row > :last-child{ + display: block; + }.thl .state-row > :nth-child(1){ + grid-area: entity; + }.thl .state-row > :nth-child(2){ + grid-area: path; + }.thl .state-row > :nth-child(3){ + grid-area: value; + text-align: right; + word-break: break-word; + }.thl .state-row > :nth-child(4){ + grid-area: origin; + text-align: right; + color: var(--thl-muted); + font: 400 8px "IBM Plex Mono", monospace; + } +} + + +/* + * UI geometry, spacing, typography and responsive behavior are ported from + * 0xbuffdev/throughline-player. These aliases preserve the canonical palette: + * no prototype green, orange or hard-coded dark-mode colours enter the package. + * All selectors remain underneath the public .thl root. + */ +.thl.thl-v2.player-shell { + --ink: var(--thl-text); + --muted: var(--thl-muted); + --dim: var(--thl-muted); + --line: var(--thl-line); + --line-soft: var(--thl-line); + --panel: var(--thl-panel); + --panel-2: var(--thl-surface); + --acid: var(--thl-active); + --orange: var(--thl-change); + --radius: var(--thl-radius); + display: flex; + flex-direction: column; + width: 100%; + min-width: 0; + padding: 0; + border: 1px solid var(--thl-line); + background: var(--thl-bg); + font-family: "DM Sans", system-ui, sans-serif; + font-size: 12px; + line-height: 1.5; + overflow: visible; +} +.thl.player-shell :is(button, input, select) { font: inherit; } +.thl.player-shell .thl-v2-sequence, +.thl.player-shell .thl-v2-fallback { min-width: 0; } +.thl.player-shell .player-content { flex: 1 1 auto; } +.thl.player-shell .canvas { height: 330px; } +.thl.player-shell:fullscreen .canvas { height: auto; flex: 1 1 auto; } +.thl.player-shell .graph { display: block; font-family: "IBM Plex Mono", ui-monospace, monospace; } +.thl.player-shell .thl-group { fill: transparent; stroke: var(--thl-line); stroke-dasharray: 3 4; } +.thl.player-shell .thl-group-label { fill: var(--thl-muted); font: 500 8px "IBM Plex Mono", monospace; } +.thl.player-shell .thl-link .thl-edge { stroke: var(--thl-line); stroke-width: 1.2; } +.thl.player-shell .thl-link.thl-visited .thl-edge { stroke: var(--thl-trail); } +.thl.player-shell .thl-link.thl-transferred .thl-edge { stroke: var(--thl-active); stroke-width: 1.7; stroke-dasharray: 5 4; } +.thl.player-shell .thl-link.thl-transferred polygon { fill: var(--thl-active); } +.thl.player-shell .thl-link:not(.thl-transferred) polygon { fill: var(--thl-line); } +.thl.player-shell .thl-node-label { fill: var(--thl-text); font: 500 10px "DM Sans", system-ui, sans-serif; } +.thl.player-shell .thl-v2-value { fill: var(--thl-muted); font: 400 8.5px "IBM Plex Mono", monospace; } +.thl.player-shell .thl-node.thl-focused { fill: var(--thl-focus-bg); stroke: var(--thl-focus); } +.thl.player-shell .thl-v2-value.thl-changed, +.thl.player-shell .thl-v2-change { fill: var(--thl-change); } +.thl.player-shell .thl-node.thl-selected { stroke: var(--thl-focus); stroke-width: 2; } +.thl.player-shell .thl-ring-selected { stroke: var(--thl-focus); } +.thl.player-shell .entity rect { fill: var(--thl-surface); stroke: var(--thl-line); } +.thl.player-shell .entity.active rect { fill: var(--thl-focus-bg); stroke: var(--thl-active); } +.thl.player-shell .entity.selected rect { stroke: var(--thl-focus); } +.thl.player-shell .entity.active circle { fill: var(--thl-active); } +.thl.player-shell .entity.active .entity-value { fill: var(--thl-active); } +.thl.player-shell .state-row:focus-visible, +.thl.player-shell .view-tabs button:focus-visible { outline: 2px solid var(--thl-focus); outline-offset: -2px; } +.thl.player-shell .inspector { overflow-y: auto; max-height: 600px; } +.thl.player-shell .inspector .thl-v2-inspect { max-width: 100%; min-width: 0; overflow-wrap: anywhere; } +.thl.player-shell .inspector .thl-v2-inspect pre { white-space: pre-wrap; overflow-wrap: anywhere; } +.thl.player-shell .thl-sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; } +@container (max-width: 760px) { + .thl.player-shell .player-content .inspector { max-height: none; } + .thl.player-shell .canvas { height: 310px; } +} +@container (max-width: 480px) { + .thl.player-shell .canvas { height: 292px; } +} From a0966f51e256ac85079c01fcfaada779bf6d22e8 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:41:45 +0100 Subject: [PATCH 04/80] feat(player): wire prototype transport and anchored options to schema-2 playback --- src/react/controls.tsx | 338 ++++++++++++++++------------------------- 1 file changed, 134 insertions(+), 204 deletions(-) diff --git a/src/react/controls.tsx b/src/react/controls.tsx index d985cf2b..8a742acb 100644 --- a/src/react/controls.tsx +++ b/src/react/controls.tsx @@ -1,215 +1,145 @@ -import { useId, useRef } from "react"; +import { useEffect, useId, useRef, useState } from "react"; import type * as React from "react"; -import { - type SeekAction, - type SeekState, - SPEEDS, - type Speed, -} from "../seek.js"; +import { type SeekAction, type SeekState, SPEEDS, type Speed } from "../seek.js"; +import { PlayerIcon } from "./player-icons.js"; interface PlaybackProps { - state: SeekState; - dispatch: React.Dispatch; + state: SeekState; + dispatch: React.Dispatch; } - interface PlayerOptionsProps extends PlaybackProps { - chapterControls?: (onSeek: (step: number) => void) => React.ReactNode; - diagramControls?: React.ReactNode; - sound?: { enabled: boolean; toggle: () => void }; - narration?: { enabled: boolean; available: boolean; toggle: () => void }; - fullscreen: { active: boolean; available: boolean; toggle: () => void }; + chapterControls?: (onSeek: (step: number) => void) => React.ReactNode; + diagramControls?: React.ReactNode; + sound?: { enabled: boolean; available: boolean; toggle: () => void }; + narration?: { enabled: boolean; available: boolean; toggle: () => void }; + inspection?: { enabled: boolean; toggle: () => void }; + fullscreen: { active: boolean; available: boolean; toggle: () => void }; } +/** The prototype's compact transport, backed by Throughline's single reducer. */ export function PlayerControls({ state, dispatch }: PlaybackProps): React.JSX.Element { - return ( -
-
- - - -
- - Step {state.step + 1} of {state.max + 1} - - - - - - -
- ); + return <> +
+ + + +
+
+ + {state.step + 1} / {state.max + 1} + + +
+ ; } -export function PlayerOptions({ state, dispatch, chapterControls, diagramControls, sound, narration, fullscreen }: PlayerOptionsProps): React.JSX.Element { - const panelId = useId(); - const panelRef = useRef(null); - const triggerRef = useRef(null); - const stepRef = useRef(null); - const close = () => { - panelRef.current?.hidePopover(); - triggerRef.current?.focus(); - }; - const seek = (step: number) => { - dispatch({ type: "step", to: step }); - close(); - }; - return ( - <> - -
{ - if (event.newState === "open" && stepRef.current) stepRef.current.value = String(state.step + 1); - }} - onToggle={(event) => { - if (event.newState === "open") event.currentTarget.scrollTop = 0; - }} - > - {(chapterControls || state.max > 0) && ( -
-

Navigation

- {chapterControls?.(seek)} - {state.max > 0 && ( -
{ - event.preventDefault(); - const step = Number(new FormData(event.currentTarget).get("step")); - if (!Number.isInteger(step) || step < 1 || step > state.max + 1) return; - seek(step - 1); - }}> - - -
- )} -
- )} - {diagramControls && ( -
-

Diagram

- {diagramControls} -
- )} -
-

Playback and display

- {sound && ( - - )} - {narration && ( - - )} - -
-
- - ); +/** + * Prototype's anchored, dismissible Options menu. All content is native + * Throughline state; it does not import the demo's scenarios or chapters. + */ +export function PlayerOptions({ + state, dispatch, chapterControls, diagramControls, sound, narration, inspection, fullscreen, +}: PlayerOptionsProps): React.JSX.Element { + const id = useId(); + const [open, setOpen] = useState(false); + const menuRef = useRef(null); + const triggerRef = useRef(null); + const stepRef = useRef(null); + useEffect(() => { + if (!open) return; + if (stepRef.current) stepRef.current.value = String(state.step + 1); + const onPointer = (event: MouseEvent) => { + if (!menuRef.current?.contains(event.target as Node)) setOpen(false); + }; + const onKey = (event: KeyboardEvent) => { + if (event.key === "Escape") { setOpen(false); triggerRef.current?.focus(); } + }; + document.addEventListener("mousedown", onPointer); + document.addEventListener("keydown", onKey); + return () => { + document.removeEventListener("mousedown", onPointer); + document.removeEventListener("keydown", onKey); + }; + }, [open, state.step]); + const seek = (to: number) => { dispatch({ type: "step", to }); setOpen(false); }; + return
+ + {open &&
+
+

Navigation

+ {chapterControls?.(seek)} + {state.max > 0 &&
{ + event.preventDefault(); + const value = Number(new FormData(event.currentTarget).get("step")); + if (Number.isInteger(value) && value >= 1 && value <= state.max + 1) + seek(value - 1); + }}> +
+ + +
+ +
} +
+ {diagramControls &&
+

Diagram

+
{diagramControls}
+
} +
+

Playback and display

+
+ {SPEEDS.map(speed => )} +
+
+ {sound && } + {narration && } + {inspection && } + +
+
+
} +
; } From 57b87dc0d91041d7f35a5ec4f05321b42c7e20dc Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:43:29 +0100 Subject: [PATCH 05/80] feat(player): adopt prototype graph card elements and state sheet structure --- src/react/graph-player.tsx | 67 +++++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 954f83a9..e3cdf16f 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -18,6 +18,7 @@ import { useNarration } from "./use-narration.js"; import { usePlayer, useSceneWidth } from "./use-player.js"; import { SequenceView } from "./sequence-view.js"; import { InspectPanel } from "./inspect-panel.js"; +import { PlayerIcon } from "./player-icons.js"; export type ThroughlineGraphPlayerProps = { /** Only a compiler-owned, immutable schema-2 trace is accepted. */ @@ -80,7 +81,7 @@ function GraphDiagram({ const item = rect.id && groupsById.get(rect.id); if (!item) return null; return ( - 0, "thl-animate": animate && sent > 0, @@ -134,6 +135,7 @@ function GraphDiagram({ const active = Boolean(item.source.entityIds?.includes(selectedId ?? "")); return ( - + + {preview(item.label, Math.floor((rect.w - 16) / 7))} - {preview(value ? cellText(value) : "Unknown", Math.floor((rect.w - 16) / 7.4))} @@ -213,29 +217,40 @@ function GraphDiagram({ } /** Inert fallback; full source-linked history inspector UI is TL-U07. */ -function StateFallback({ view, selectedId, onSelect }: { - view: ViewDescriptor; selectedId: Id | null; onSelect: (id: Id) => void; +/** The prototype's four-column state sheet, displaying real committed cells. */ +function StateFallback({ view, selectedId, onSelect, inspector, frameIndex }: { + view: ViewDescriptor; + selectedId: Id | null; + onSelect: (id: Id) => void; + inspector: ReturnType; + frameIndex: number; }): React.JSX.Element { - return ( -
- {view.diagnostics?.map(diagnostic => -

{diagnostic}

)} - - - - {view.items.filter(item => item.role === "value").map(item => { - const id = item.source.entityIds?.[0] ?? ""; - const cell = itemCell(item); - return - - - - ; - })} -
Modeled state at {view.frameId}
EntityPresenceValue
{data(item, "present") ? "Present" : "Not present"}{cell ? cellText(cell) : "Unknown"}
-
- ); + const rows = view.items.filter(item => item.role === "value"); + const changed = new Set(inspector.diff(Math.max(0, frameIndex - 1), frameIndex) + .filter(change => change.kind === "write").map(change => change.entityId)); + return
+ {view.diagnostics?.map(message =>

{message}

)} + + {rows.map(item => { + const id = item.source.entityIds?.[0] ?? ""; + const present = data(item, "present") === true; + const cell = itemCell(item); + const history = inspector.history(id); + const latest = history.filter(entry => entry.frameIndex <= frameIndex).at(-1); + const origin = latest?.originId ?? (present ? "initial" : "not present"); + return ; + })} +
; } /** From 0204c1b9cf3c3a9fbbfceab0acee9121bde5c404 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:45:52 +0100 Subject: [PATCH 06/80] feat(player): port prototype shell, tabs, canvas, inspector and caption to native trace --- src/react/graph-player.tsx | 494 ++++++++++++++++++++++++------------- 1 file changed, 329 insertions(+), 165 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index e3cdf16f..997d55a9 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -277,6 +277,11 @@ export function ThroughlineGraphPlayer({ const [collapsed, setCollapsed] = useState([]); const [viewKind, setViewKind] = useState(initialView); const [inspectionMode, setInspectionMode] = useState<"explain" | "inspect">("explain"); + const [drilled, setDrilled] = useState(null); + const [follow, setFollow] = useState(false); + const [soundOn, setSoundOn] = useState(false); + const [soundAvailable, setSoundAvailable] = useState(false); + const audioRef = useRef(null); const [camera, setCamera] = useState(null); const [fullscreen, setFullscreen] = useState(false); // Capability detection is client-only. SSR and the first hydration render @@ -290,7 +295,10 @@ export function ThroughlineGraphPlayer({ setCamera(null); setViewKind(initialView); setInspectionMode("explain"); - setNarrating(false); + setDrilled(null); + setFollow(false); + setSoundOn(false); + setNarrating(false); } useEffect(() => { if (!narration) setNarrating(false); @@ -315,7 +323,27 @@ export function ThroughlineGraphPlayer({ collapsedGroupIds: collapsed, }), [inspector, frameIndex, viewKind, selectedId, collapsed]); const geometry = useMemo(() => layoutGraphView(layout, view), [layout, view]); - const effectiveCamera = constrainCamera(layout, camera ?? fitCamera(layout)); + // Only authored focusEntityIds can drive automatic camera following. + const focusIds = frameIndex ? trace.artifact.steps[frameIndex - 1].focusEntityIds ?? [] : []; + const focusRects = focusIds.map(id => { + const item = view.items.find(candidate => candidate.role === "entity" && + candidate.source.entityIds?.includes(id)); + return item ? geometry.nodes[item.id] : undefined; + }).filter((rect): rect is { x: number; y: number; w: number; h: number } => rect !== undefined); + const focusLeft = focusRects.length ? Math.min(...focusRects.map(rect => rect.x)) : 0; + const focusRight = focusRects.length ? Math.max(...focusRects.map(rect => rect.x + rect.w)) : 0; + const focusTop = focusRects.length ? Math.min(...focusRects.map(rect => rect.y)) : 0; + const focusBottom = focusRects.length ? Math.max(...focusRects.map(rect => rect.y + rect.h)) : 0; + const followedCamera: Camera | null = focusRects.length ? { + cx: (focusLeft + focusRight) / 2, + cy: (focusTop + focusBottom) / 2, + zoom: Math.max(1, Math.min(2.4, 0.8 * Math.min( + layout.width / Math.max(1, focusRight - focusLeft), + layout.height / Math.max(1, focusBottom - focusTop), + ))), + } : null; + const effectiveCamera = constrainCamera(layout, + follow && followedCamera ? followedCamera : camera ?? fitCamera(layout)); const presentEntities = new Set(inspector.stateAt(frameIndex).presentEntityIds); const selected = selectedId ? trace.artifact.entities.find(entity => entity.id === selectedId) @@ -352,7 +380,7 @@ export function ThroughlineGraphPlayer({ } return present; }, [firstSent, frameIndex, trace]); - const manual = (next: Camera) => setCamera(constrainCamera(layout, next)); + const manual = (next: Camera) => { setFollow(false); setCamera(constrainCamera(layout, next)); }; const fit = () => manual(fitCamera(layout)); const zoom = (factor: number) => manual(zoomCamera(layout, effectiveCamera, factor)); const pan = (dx: number, dy: number) => manual(panCamera(layout, effectiveCamera, dx, dy)); @@ -390,167 +418,303 @@ export function ThroughlineGraphPlayer({ setFullscreenError("Fullscreen is unavailable in this browser or embedded view."); } }; - const controls = ( - <> - - - {(trace.artifact.groups ?? []).map(group => - )} - - ); - const keyboardDiagram: React.KeyboardEventHandler = (event) => { - if (event.target !== event.currentTarget) return; - const key = event.key; - if (key === "+" || key === "=") zoom(1.25); - else if (key === "-") zoom(1 / 1.25); - else if (key === "0") fit(); - else if (key === "ArrowLeft") pan(-30, 0); - else if (key === "ArrowRight") pan(30, 0); - else if (key === "ArrowUp") pan(0, -30); - else if (key === "ArrowDown") pan(0, 30); - else return; - event.preventDefault(); - event.stopPropagation(); - }; - const helpId = useId(); - const captionId = useId(); - return ( -
-

- Focus this player to seek with Left and Right arrows, Home and End, - and play or pause with Space. Focus the graph to pan with arrows, - zoom with plus or minus, or fit with zero. -

-

{summary}

- {voice.error && narration &&

{voice.error}

} - {fullscreenError &&

{fullscreenError}

} -
-

{title ?? trace.artifact.title ?? "Throughline"}

- -
- -
- - -
-
-
- {inspectionMode === "explain" && view.kind === "graph" &&
- - - -
} -
+ + // Audio is optional, native, and instantiated only after an explicit click. + useEffect(() => { + setSoundAvailable(typeof window.AudioContext === "function"); + return () => { void audioRef.current?.close().catch(() => {}); }; + }, []); + const toggleSound = () => { + if (soundOn) { setSoundOn(false); return; } + const Ctx = window.AudioContext; + if (!Ctx) return; + audioRef.current ??= new Ctx(); + void audioRef.current.resume().catch(() => {}); + setSoundOn(true); + }; + useEffect(() => { + if (!soundOn || !audioRef.current) return; + const audio = audioRef.current; + try { + const oscillator = audio.createOscillator(); + const gain = audio.createGain(); + const now = audio.currentTime; + oscillator.frequency.value = 220 * Math.pow(2, frameIndex / Math.max(1, state.max) * 1.5); + gain.gain.setValueAtTime(0.0001, now); + gain.gain.exponentialRampToValueAtTime(0.06, now + 0.02); + gain.gain.exponentialRampToValueAtTime(0.0001, now + 0.3); + oscillator.connect(gain); + gain.connect(audio.destination); + oscillator.start(); + oscillator.stop(now + 0.32); + } catch { /* audio is optional */ } + }, [frameIndex, soundOn, state.max]); - {inspectionMode === "inspect" ? - dispatch({ type: "step", to })} /> - : view.kind === "graph" ? { - if (event.button !== 0) return; - // Source selection and collapse controls own their pointer - // sequence. Capturing it on the SVG would steal their click. - if ((event.target as Element).closest( - '[data-node], [data-group-summary]')) return; - dragging.current = { pointerId: event.pointerId, - x: event.clientX, y: event.clientY }; - event.currentTarget.setPointerCapture(event.pointerId); - }} - onPointerMove={event => { - const start = dragging.current; - if (!start || start.pointerId !== event.pointerId) return; - const bounds = event.currentTarget.getBoundingClientRect(); - const worldX = effectiveCamera.zoom > 0 - ? (layout.width / effectiveCamera.zoom) / Math.max(bounds.width, 1) : 1; - const worldY = effectiveCamera.zoom > 0 - ? (layout.height / effectiveCamera.zoom) / Math.max(bounds.height, 1) : 1; - pan((event.clientX - start.x) * worldX, - (event.clientY - start.y) * worldY); - dragging.current = { ...start, x: event.clientX, y: event.clientY }; - }} - onPointerUp={() => { dragging.current = null; }} - onPointerCancel={() => { dragging.current = null; }}> - {title ?? trace.artifact.title ?? "Throughline graph"} - {view.summary} - setCollapsed(current => - current.filter(item => item !== id))} - visitedAt={firstSent} participants={participants} animate={motion.animate} /> - : view.kind === "sequence" - ? - : } -
-
-
- -
-
- {step?.label ?? "Initial state"} — Step {frameIndex + 1}/{trace.frames.length} -

{step?.note ?? view.summary}

- {events.length > 0 &&
    - {events.slice(0, 80).map(item => -
  1. - {item.description} -
  2. )} - {events.length > 80 &&
  3. - {events.length - 80} additional declared event(s); use the typed inspector to query all sources. -
  4. } -
} -
- {selected &&
-

Selected: {selected.label}

-

{presentEntities.has(selected.id) ? "Present in modeled state at this frame" : - "Not present in modeled state at this frame; no presence is inferred."}

-
{selectedValue && selectedValue.status === "known"
-						? cellText(selectedValue) : selectedValue?.status === "unknown"
-							? "Unknown" + (selectedValue.reason ? ": " + selectedValue.reason : "")
-							: "Absent"}
-
} -
-
- ); + const entityFieldId = useId(); + const groupFieldId = useId(); + const helpId = useId(); + const captionId = useId(); + const currentEvent = step?.events[0]; + const eventType = currentEvent?.type ?? "initial"; + const hasWrite = step?.events.some(event => event.type === "write") ?? false; + const origins = [...new Set(trace.artifact.origins.map(origin => origin.kind))].join(" + "); + const inspectSelected = selected ?? trace.artifact.entities[0]; + const inspectValue = inspectSelected ? inspector.valueAt(frameIndex, inspectSelected.id) : null; + const inspectPresent = inspectSelected ? presentEntities.has(inspectSelected.id) : false; + const inspectHistory = inspectSelected + ? inspector.history(inspectSelected.id).filter(entry => entry.frameIndex <= frameIndex) + : []; + const onSelectEntity = (id: Id) => { setSelectedId(id); setInspectionMode("inspect"); }; + const focusEntity = (id: Id) => { + onSelectEntity(id); + const item = view.items.find(candidate => candidate.role === "entity" && + candidate.source.entityIds?.includes(id)); + const rect = item && geometry.nodes[item.id]; + if (rect && view.kind === "graph") + manual({ cx: rect.x + rect.w / 2, cy: rect.y + rect.h / 2, zoom: 2 }); + }; + const focusGroup = (id: Id | null) => { + setDrilled(id); + if (!id) { fit(); return; } + const item = view.items.find(candidate => candidate.role === "group" && + candidate.source.groupIds?.includes(id)); + const rect = item && (geometry.groups.find(rect => rect.id === item.id) ?? + geometry.nodes[item.id]); + if (rect) manual({ cx: rect.x + rect.w / 2, cy: rect.y + rect.h / 2, zoom: 2 }); + }; + const diagramControls = <> +
+ + + + + +
+
+ + +
+ + ; + const keyboardDiagram: React.KeyboardEventHandler = event => { + if (event.target !== event.currentTarget) return; + const key = event.key; + if (key === "+" || key === "=") zoom(1.25); + else if (key === "-") zoom(1 / 1.25); + else if (key === "0") fit(); + else if (key === "ArrowLeft") pan(-30, 0); + else if (key === "ArrowRight") pan(30, 0); + else if (key === "ArrowUp") pan(0, -30); + else if (key === "ArrowDown") pan(0, 30); + else return; + event.preventDefault(); + event.stopPropagation(); + }; + return
+

Focus this player to seek with Left and Right arrows, Home and End, + and play or pause with Space. Focus the graph to pan with arrows, zoom with plus or minus, or fit with zero.

+

{summary}

+ {voice.error && narration &&

{voice.error}

} + {fullscreenError &&

{fullscreenError}

} +
+
+

{title ?? trace.artifact.title ?? "Throughline"}

+
+
+ + setInspectionMode(current => current === "inspect" ? "explain" : "inspect") }} + sound={{ enabled: soundOn, available: soundAvailable, toggle: toggleSound }} + narration={narration ? { enabled: narrating, available: voice.available, toggle: voice.toggle } : undefined} + fullscreen={{ active: fullscreen, available: fullscreenAvailable, toggle: toggleFullscreen }}/> +
+
+
+
+ {([["Graph", "graph"], ["Sequence", "sequence"], ["State", "state-table"]] as const) + .map(([label, kind]) => )} +
+
SOURCE {origins} frame #{frameIndex}
+
+
+
+
+ FRAME {String(frameIndex).padStart(2, "0")} + {step?.label ?? "Initial state"} + {eventType} +
+ {view.kind === "graph" ? +
+ { + if (event.button !== 0) return; + if ((event.target as Element).closest('[data-node], [data-group-summary]')) return; + dragging.current = { pointerId: event.pointerId, x: event.clientX, y: event.clientY }; + event.currentTarget.setPointerCapture(event.pointerId); + }} + onPointerMove={event => { + const start = dragging.current; + if (!start || start.pointerId !== event.pointerId) return; + const bounds = event.currentTarget.getBoundingClientRect(); + const worldX = effectiveCamera.zoom > 0 + ? (layout.width / effectiveCamera.zoom) / Math.max(bounds.width, 1) : 1; + const worldY = effectiveCamera.zoom > 0 + ? (layout.height / effectiveCamera.zoom) / Math.max(bounds.height, 1) : 1; + pan((event.clientX - start.x) * worldX, (event.clientY - start.y) * worldY); + dragging.current = { ...start, x: event.clientX, y: event.clientY }; + }} + onPointerUp={() => { dragging.current = null; }} + onPointerCancel={() => { dragging.current = null; }}> + {title ?? trace.artifact.title ?? "Throughline graph"} + {view.summary} + setCollapsed(current => current.filter(item => item !== id))} + visitedAt={firstSent} participants={participants} animate={motion.animate}/> + +
+ Drag to pan · scroll to zoom · click a node to inspect +
+ + {Math.round(effectiveCamera.zoom * 100)}% + + +
+
+
: view.kind === "sequence" + ? + : } +
+ {inspectionMode === "inspect" && } +
+
+
+ + {String(frameIndex + 1).padStart(2, "0")} + + {step?.label ?? "Initial state"} + {step?.note ?? view.summary} + + {eventType} + Details + +
+

{step?.note ?? view.summary}

+ {step && step.events.length > 0 &&
    + {step.events.slice(0, 80).map(event =>
  • + {event.type === "message" ? event.phase : event.type} → + {event.id} +
  • )} + {step.events.length > 80 &&
  • {step.events.length - 80} more events; inspect source for details.
  • } +
} +
+ Inspect state +
{trace.artifact.entities.map(entity => { + const present = presentEntities.has(entity.id); + const value = present ? inspector.valueAt(frameIndex, entity.id) : null; + return
+
{entity.label} ({entity.id})
+
{!present ? "Absent" : value?.status === "known" ? cellText(value) + : value?.status === "unknown" ? cellText(value) : "Absent"}
+
; + })}
+
+
+
+
; } From d036451bc1f6f3640d366918b5377b106af1e2fe Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:47:14 +0100 Subject: [PATCH 07/80] feat(player): render dynamic schema-2 sequence lanes in prototype layout --- src/react/sequence-view.tsx | 254 +++++++++++++----------------------- 1 file changed, 91 insertions(+), 163 deletions(-) diff --git a/src/react/sequence-view.tsx b/src/react/sequence-view.tsx index a5d7a6c8..b9b95f17 100644 --- a/src/react/sequence-view.tsx +++ b/src/react/sequence-view.tsx @@ -2,175 +2,103 @@ import { useState } from "react"; import type * as React from "react"; import type { Id, ViewDescriptor, ViewItem } from "../v2/model.js"; -/** Inert renderer: uses only pure view descriptors, never the trace or a v1 adapter. */ function field(item: ViewItem, key: string): unknown { - const value = item.data; - if (!value || typeof value !== "object" || Array.isArray(value)) return undefined; - return (value as Record)[key]; + const value = item.data; + return value && typeof value === "object" && !Array.isArray(value) + ? (value as Record)[key] : undefined; } -function text(value: unknown): string { - return typeof value === "string" ? value : ""; -} -function phaseCount(value: unknown, key: string): number { - if (!value || typeof value !== "object" || Array.isArray(value)) return 0; - const n = (value as Record)[key]; - return typeof n === "number" && Number.isSafeInteger(n) ? n : 0; -} - -const PAGE_SIZE = 120; +const PAGE = 120; /** - * Accessible timeline of ALL modeled message evidence through the selected - * frame; independent bounded tails of message-ID summaries and event rows - * are mounted. All correlation totals/source IDs remain in the full pure - * descriptor and are reachable via explicit progressive disclosure. - * Hiding DOM rows never changes source truth or the projection. + * The prototype's lane visualization, driven only by the schema-2 sequence + * projection. Lane identities and events are never hardcoded to the demo. + * The order is modeled step/event order, not inferred physical chronology. */ export function SequenceView({ - view, selectedId, onSelect, + view, selectedId, onSelect, }: { - view: ViewDescriptor; - selectedId: Id | null; - onSelect: (id: Id) => void; + view: ViewDescriptor; + selectedId: Id | null; + onSelect: (id: Id) => void; }): React.JSX.Element { - const [maxVisible, setMaxVisible] = useState(PAGE_SIZE); - const [correlationPage, setCorrelationPage] = useState(0); - const actors = view.items.filter(item => item.role === "entity"); - const correlations = view.items.filter(item => - item.role === "value" && field(item, "type") === "message-correlation"); - const evidence = view.items.filter(item => item.role === "event"); - const start = Math.max(0, evidence.length - maxVisible); - const mounted = evidence.slice(start); - // Fixed 120-item window, even after arbitrary navigation. Page zero - // shows the newest message IDs; earlier/later pages retain full source - // provenance without ever accumulating an unbounded DOM. - const totalPages = Math.max(1, Math.ceil(correlations.length / PAGE_SIZE)); - const pageIndex = Math.min(correlationPage, totalPages - 1); - const correlationEnd = Math.max(0, correlations.length - pageIndex * PAGE_SIZE); - const correlationStart = Math.max(0, correlationEnd - PAGE_SIZE); - const mountedCorrelations = correlations.slice(correlationStart, correlationEnd); - const actorNames = new Map(actors.map(item => [item.id, item.label])); - const phases = ["sent", "received", "acknowledged", "processed"] as const; - return ( -
-

{view.summary}

-

- Events follow modeled step and event order, not verified network time. - No unrecorded send, receipt, acknowledgement, retry, timeout or state change is inferred. -

-
- {actors.length ? actors.map(item => { - const id = item.source.entityIds?.[0] ?? ""; - const present = field(item, "present") === true; - return ; - }) :

No message endpoints have been modeled through this frame.

} -
- {correlations.length > 0 &&
-

Messages by declared ID

-

Only explicitly modeled phases are counted. An unmodeled - acknowledgement is not proof that one was lost.

-

Showing {mountedCorrelations.length} of {correlations.length} - {" "}message ID(s), page {pageIndex + 1} of {totalPages}. - All source-linked summaries can be reached without increasing the DOM window.

-
- - -
-
    {mountedCorrelations.map(item => { - const counts = field(item, "phases"); - return
  • - {item.label} - - {phases.map(phase => - {phase}: {phaseCount(counts, phase) || "not modeled"} - )} - -
    - Correlation and evidence limits -

    {item.description}

    -
    -
  • ; - })}
-
} -
-

Declared event timeline

-

{evidence.length === 0 ? "No modeled events through this frame." : - "Showing " + mounted.length + " of " + evidence.length + - " explicit event(s); older rows can be revealed below."}

- {evidence.length > mounted.length && } - {mounted.length > 0 && - - - - - - - - - - {mounted.map(item => { - const type = text(field(item, "type")); - const message = type === "message"; - const from = item.fromItemId && actorNames.get(item.fromItemId); - const to = item.toItemId && actorNames.get(item.toItemId); - const current = field(item, "current") === true; - const missingSent = field(item, "missingSentThroughStep") === true; - return - - - - - - - ; - })} -
Source-linked evidence up to {view.frameId}. - Message phases and independent state/observation events remain distinct.
StepEventMessage IDDeclared relationPhase / evidence typeDeclared origin
{text(field(item, "frameId"))} -
{item.label} -

{item.description}

-
-
{message ? {text(field(item, "messageId"))} : "—"}{message ? <> - {from ?? text(field(item, "fromEntityId"))} - {" — "} - {to ?? text(field(item, "toEntityId"))} - : "Not a message"}{message ? <> - {text(field(item, "phase"))} - {missingSent && - No sent modeled through this step - } - : type + " (not a message phase)"}{text(field(item, "originId"))} - {" (" + text(field(item, "originKind")) + ")"}
} -
-
- ); + const [maxVisible, setMaxVisible] = useState(PAGE); + const actors = view.items.filter(item => item.role === "entity"); + const events = view.items.filter(item => item.role === "event"); + const start = Math.max(0, events.length - maxVisible); + const visible = events.slice(start); + const last = events.at(-1); + const current = last && field(last, "current") === true; + const lanes = Math.max(1, actors.length); + const columns = "repeat(" + lanes + ",minmax(0,1fr))"; + const minWidth = Math.max(300, actors.length * 105); + return
+

{view.summary} Events are in declared order, not physical time.

+
+
+
+ {actors.length ? actors.map(actor => { + const id = actor.source.entityIds?.[0] ?? ""; + return + + ; + }) : No declared message endpoints} +
+
+ +
    + {visible.map((item, offset) => { + const type = field(item, "type"); + const message = type === "message"; + const from = actors.findIndex(actor => actor.id === item.fromItemId); + const to = actors.findIndex(actor => actor.id === item.toItemId); + const connected = message && from >= 0 && to >= 0; + const self = from === to; + const direction = to > from ? "right" : "left"; + const state = field(item, "current") === true ? "current" : "past"; + const lo = Math.min(from, to), hi = Math.max(from, to); + const startCol = self ? lo + 1 : lo + 1; + const endCol = self ? startCol + 1 : hi + 2; + const phase = field(item, "phase"); + return
  1. + {connected ? + + {String(start + offset + 1).padStart(2, "0")} + {item.label} + + + : + {String(start + offset + 1).padStart(2, "0")} + {item.label} + } +
  2. ; + })} +
+
+
+
+
+ {last ? (current ? "NOW" : "LATEST") : "NO EVENTS YET"} + {last &&

{last.label}

} + {events.length > visible.length && } +
+
; } From d9418660732ac7c731c63cb5fb4e97db7ef6a124 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:49:12 +0100 Subject: [PATCH 08/80] feat(player): retain full source-linked sequence evidence behind inspector --- src/react/sequence-evidence.tsx | 177 ++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 src/react/sequence-evidence.tsx diff --git a/src/react/sequence-evidence.tsx b/src/react/sequence-evidence.tsx new file mode 100644 index 00000000..3339b6f4 --- /dev/null +++ b/src/react/sequence-evidence.tsx @@ -0,0 +1,177 @@ +import { useState } from "react"; +import type * as React from "react"; +import type { Id, ViewDescriptor, ViewItem } from "../v2/model.js"; + +/** Inert renderer: uses only pure view descriptors, never the trace or a v1 adapter. */ +function field(item: ViewItem, key: string): unknown { + const value = item.data; + if (!value || typeof value !== "object" || Array.isArray(value)) return undefined; + return (value as Record)[key]; +} +function text(value: unknown): string { + return typeof value === "string" ? value : ""; +} +function phaseCount(value: unknown, key: string): number { + if (!value || typeof value !== "object" || Array.isArray(value)) return 0; + const n = (value as Record)[key]; + return typeof n === "number" && Number.isSafeInteger(n) ? n : 0; +} + +const PAGE_SIZE = 120; + +/** + * Detailed source evidence, preserved under the prototype inspector disclosure. + * Accessible timeline of ALL modeled message evidence through the selected + * frame; independent bounded tails of message-ID summaries and event rows + * are mounted. All correlation totals/source IDs remain in the full pure + * descriptor and are reachable via explicit progressive disclosure. + * Hiding DOM rows never changes source truth or the projection. + */ +export function SequenceEvidence({ + view, selectedId, onSelect, +}: { + view: ViewDescriptor; + selectedId: Id | null; + onSelect: (id: Id) => void; +}): React.JSX.Element { + const [maxVisible, setMaxVisible] = useState(PAGE_SIZE); + const [correlationPage, setCorrelationPage] = useState(0); + const actors = view.items.filter(item => item.role === "entity"); + const correlations = view.items.filter(item => + item.role === "value" && field(item, "type") === "message-correlation"); + const evidence = view.items.filter(item => item.role === "event"); + const start = Math.max(0, evidence.length - maxVisible); + const mounted = evidence.slice(start); + // Fixed 120-item window, even after arbitrary navigation. Page zero + // shows the newest message IDs; earlier/later pages retain full source + // provenance without ever accumulating an unbounded DOM. + const totalPages = Math.max(1, Math.ceil(correlations.length / PAGE_SIZE)); + const pageIndex = Math.min(correlationPage, totalPages - 1); + const correlationEnd = Math.max(0, correlations.length - pageIndex * PAGE_SIZE); + const correlationStart = Math.max(0, correlationEnd - PAGE_SIZE); + const mountedCorrelations = correlations.slice(correlationStart, correlationEnd); + const actorNames = new Map(actors.map(item => [item.id, item.label])); + const phases = ["sent", "received", "acknowledged", "processed"] as const; + return ( +
+

{view.summary}

+

+ Events follow modeled step and event order, not verified network time. + No unrecorded send, receipt, acknowledgement, retry, timeout or state change is inferred. +

+
+ {actors.length ? actors.map(item => { + const id = item.source.entityIds?.[0] ?? ""; + const present = field(item, "present") === true; + return ; + }) :

No message endpoints have been modeled through this frame.

} +
+ {correlations.length > 0 &&
+

Messages by declared ID

+

Only explicitly modeled phases are counted. An unmodeled + acknowledgement is not proof that one was lost.

+

Showing {mountedCorrelations.length} of {correlations.length} + {" "}message ID(s), page {pageIndex + 1} of {totalPages}. + All source-linked summaries can be reached without increasing the DOM window.

+
+ + +
+
    {mountedCorrelations.map(item => { + const counts = field(item, "phases"); + return
  • + {item.label} + + {phases.map(phase => + {phase}: {phaseCount(counts, phase) || "not modeled"} + )} + +
    + Correlation and evidence limits +

    {item.description}

    +
    +
  • ; + })}
+
} +
+

Declared event timeline

+

{evidence.length === 0 ? "No modeled events through this frame." : + "Showing " + mounted.length + " of " + evidence.length + + " explicit event(s); older rows can be revealed below."}

+ {evidence.length > mounted.length && } + {mounted.length > 0 && + + + + + + + + + + {mounted.map(item => { + const type = text(field(item, "type")); + const message = type === "message"; + const from = item.fromItemId && actorNames.get(item.fromItemId); + const to = item.toItemId && actorNames.get(item.toItemId); + const current = field(item, "current") === true; + const missingSent = field(item, "missingSentThroughStep") === true; + return + + + + + + + ; + })} +
Source-linked evidence up to {view.frameId}. + Message phases and independent state/observation events remain distinct.
StepEventMessage IDDeclared relationPhase / evidence typeDeclared origin
{text(field(item, "frameId"))} +
{item.label} +

{item.description}

+
+
{message ? {text(field(item, "messageId"))} : "—"}{message ? <> + {from ?? text(field(item, "fromEntityId"))} + {" — "} + {to ?? text(field(item, "toEntityId"))} + : "Not a message"}{message ? <> + {text(field(item, "phase"))} + {missingSent && + No sent modeled through this step + } + : type + " (not a message phase)"}{text(field(item, "originId"))} + {" (" + text(field(item, "originKind")) + ")"}
} +
+
+ ); +} From 34e3a68dd585902ad81e8a8ba2f9e78a4c58bd7c Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:49:25 +0100 Subject: [PATCH 09/80] feat(player): expose complete sequence source evidence without changing prototype layout --- src/react/graph-player.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 997d55a9..a75636b4 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -17,6 +17,7 @@ import { PlayerControls, PlayerOptions } from "./controls.js"; import { useNarration } from "./use-narration.js"; import { usePlayer, useSceneWidth } from "./use-player.js"; import { SequenceView } from "./sequence-view.js"; +import { SequenceEvidence } from "./sequence-evidence.js"; import { InspectPanel } from "./inspect-panel.js"; import { PlayerIcon } from "./player-icons.js"; @@ -678,6 +679,8 @@ export function ThroughlineGraphPlayer({ dispatch({ type: "step", to })}/> + {view.kind === "sequence" && } } From a44e23eb40ac90d72212eed252d4e251737c0019 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:50:19 +0100 Subject: [PATCH 10/80] fix(player): use the canonical camera coordinate contract and zoom limits --- src/react/graph-player.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index a75636b4..2a0f94c4 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -336,8 +336,8 @@ export function ThroughlineGraphPlayer({ const focusTop = focusRects.length ? Math.min(...focusRects.map(rect => rect.y)) : 0; const focusBottom = focusRects.length ? Math.max(...focusRects.map(rect => rect.y + rect.h)) : 0; const followedCamera: Camera | null = focusRects.length ? { - cx: (focusLeft + focusRight) / 2, - cy: (focusTop + focusBottom) / 2, + centerX: (focusLeft + focusRight) / 2, + centerY: (focusTop + focusBottom) / 2, zoom: Math.max(1, Math.min(2.4, 0.8 * Math.min( layout.width / Math.max(1, focusRight - focusLeft), layout.height / Math.max(1, focusBottom - focusTop), @@ -472,7 +472,7 @@ export function ThroughlineGraphPlayer({ candidate.source.entityIds?.includes(id)); const rect = item && geometry.nodes[item.id]; if (rect && view.kind === "graph") - manual({ cx: rect.x + rect.w / 2, cy: rect.y + rect.h / 2, zoom: 2 }); + manual({ centerX: rect.x + rect.w / 2, centerY: rect.y + rect.h / 2, zoom: 2 }); }; const focusGroup = (id: Id | null) => { setDrilled(id); @@ -481,7 +481,7 @@ export function ThroughlineGraphPlayer({ candidate.source.groupIds?.includes(id)); const rect = item && (geometry.groups.find(rect => rect.id === item.id) ?? geometry.nodes[item.id]); - if (rect) manual({ cx: rect.x + rect.w / 2, cy: rect.y + rect.h / 2, zoom: 2 }); + if (rect) manual({ centerX: rect.x + rect.w / 2, centerY: rect.y + rect.h / 2, zoom: 2 }); }; const diagramControls = <>
@@ -627,7 +627,7 @@ export function ThroughlineGraphPlayer({ Drag to pan · scroll to zoom · click a node to inspect
+ disabled={effectiveCamera.zoom <= 1}> {Math.round(effectiveCamera.zoom * 100)}% From 66f62126f8dc6ef8ad167505b44644c2ac9eb3ef Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:51:35 +0100 Subject: [PATCH 11/80] style(player): complete native sequence lanes and inspector disclosure styling --- src/styles/throughline.css | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index b893b85e..245ba33b 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -2679,3 +2679,77 @@ @container (max-width: 480px) { .thl.player-shell .canvas { height: 292px; } } + +/* The public heading remains h2 for correct embedding, but keeps the exact + * prototype's h1 appearance. */ +.thl.player-shell .title-block h2 { + margin: 0; + font-size: 13px; + line-height: 1.2; + letter-spacing: -0.01em; + font-weight: 600; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.thl.player-shell .sequence-head span button { + width: 100%; + height: 100%; + border: 0; + background: transparent; + color: inherit; + font: inherit; + cursor: pointer; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.thl.player-shell .sequence-head span button[aria-pressed="true"] { + color: var(--thl-active); +} +.thl.player-shell .seq-row.evidence { + align-items: center; +} +.thl.player-shell .seq-non-message { + display: inline-flex; + align-items: baseline; + gap: 8px; + padding: 5px 10px; + border-bottom: 1px solid var(--thl-line); + color: var(--thl-muted); + font: 400 9px "IBM Plex Mono", monospace; +} +.thl.player-shell .seq-non-message b { color: var(--thl-muted); } +.thl.player-shell .seq-row.current .seq-non-message, +.thl.player-shell .seq-row.current .seq-non-message b { color: var(--thl-active); } +.thl.player-shell .seq-earlier { + margin-left: auto; + padding: 0; + border: 0; + background: transparent; + color: var(--thl-muted); + font: inherit; + cursor: pointer; +} +.thl.player-shell .evidence-note summary { + color: var(--thl-change); + font: 500 7px "IBM Plex Mono", monospace; + letter-spacing: 0.08em; + cursor: pointer; +} +.thl.player-shell .evidence-note[open] { + overflow: auto; + max-height: 440px; +} +.thl.player-shell .evidence-note :is(button, input, select) { + color: var(--thl-text); + background: var(--thl-control-bg); + border: 1px solid var(--thl-line); + border-radius: var(--thl-radius); + max-width: 100%; +} +.thl.player-shell .evidence-note :is(pre, table) { + display: block; + overflow-x: auto; + max-width: 100%; +} From ba9f7570f11541acfb355671b230b216d4076824 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:51:48 +0100 Subject: [PATCH 12/80] fix(player): match prototype mobile follow initialization and truthful event labels --- src/react/graph-player.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 2a0f94c4..3f9e3e59 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -270,6 +270,12 @@ export function ThroughlineGraphPlayer({ const svgRef = useRef(null); const rootRef = useRef(null); const width = useSceneWidth(canvasRef); + // Match the prototype: on initially narrow embeds, follow authored action. + useEffect(() => { + if (followInitialized.current || !canvasRef.current) return; + followInitialized.current = true; + if (canvasRef.current.clientWidth < 640) setFollow(true); + }, [width]); const [narrating, setNarrating] = useState(false); const { state, dispatch, lastAction, seekRevision, onKeyDown } = usePlayer(trace, narration && narrating); @@ -283,6 +289,7 @@ export function ThroughlineGraphPlayer({ const [soundOn, setSoundOn] = useState(false); const [soundAvailable, setSoundAvailable] = useState(false); const audioRef = useRef(null); + const followInitialized = useRef(false); const [camera, setCamera] = useState(null); const [fullscreen, setFullscreen] = useState(false); // Capability detection is client-only. SSR and the first hydration render @@ -298,6 +305,7 @@ export function ThroughlineGraphPlayer({ setInspectionMode("explain"); setDrilled(null); setFollow(false); + followInitialized.current = false; setSoundOn(false); setNarrating(false); } @@ -456,7 +464,7 @@ export function ThroughlineGraphPlayer({ const helpId = useId(); const captionId = useId(); const currentEvent = step?.events[0]; - const eventType = currentEvent?.type ?? "initial"; + const eventType = !step ? "initial" : currentEvent?.type ?? "no event"; const hasWrite = step?.events.some(event => event.type === "write") ?? false; const origins = [...new Set(trace.artifact.origins.map(origin => origin.kind))].join(" + "); const inspectSelected = selected ?? trace.artifact.entities[0]; From b7717ea7c2280b4e62ce66cdfedb739eb79b18c3 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:52:41 +0100 Subject: [PATCH 13/80] fix(player): tighten write-only narrowing and remount behavior --- src/react/graph-player.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 3f9e3e59..00c792fd 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -228,7 +228,7 @@ function StateFallback({ view, selectedId, onSelect, inspector, frameIndex }: { }): React.JSX.Element { const rows = view.items.filter(item => item.role === "value"); const changed = new Set(inspector.diff(Math.max(0, frameIndex - 1), frameIndex) - .filter(change => change.kind === "write").map(change => change.entityId)); + .flatMap(change => change.kind === "write" ? [change.entityId] : [])); return
{view.diagnostics?.map(message =>

{message}

)}
{sound && } From 755721ea67e2207eb78aeced3f0249222372f9da Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:57:39 +0100 Subject: [PATCH 15/80] test(player): migrate graph regressions to prototype controls and inspector --- src/react/__tests__/v2-graph.browser.test.tsx | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/react/__tests__/v2-graph.browser.test.tsx b/src/react/__tests__/v2-graph.browser.test.tsx index e701d0d3..03592280 100644 --- a/src/react/__tests__/v2-graph.browser.test.tsx +++ b/src/react/__tests__/v2-graph.browser.test.tsx @@ -7,6 +7,14 @@ import { ThroughlineGraphPlayer } from "../graph-player.js"; import "../../styles/throughline.css"; const trace = () => compileArtifact(distributedGraph()); +async function collapseGroup(screen: Awaited>, id: string) { + await screen.getByRole("button", { name: "Player options" }).click(); + await userEvent.selectOptions( + screen.getByRole("combobox", { name: "Drill into group" }).element(), id); + await screen.getByRole("button", { name: "Collapse group" }).click(); + await screen.getByRole("button", { name: "Player options" }).click(); +} + const currentLinks = () => [...document.querySelectorAll(".thl-v2-diagram .thl-link")]; const link = (sourceId: string): SVGGElement | undefined => @@ -36,7 +44,7 @@ it("plays a source-linked checkout without pretending received or processed mean // Truncated graph labels are not full-state evidence; inspect the // selected source entity to verify the actual persistent value. await screen.getByRole("button", { name: "Select Ledger" }).click(); - expect(document.querySelector(".thl-v2-selection pre")?.textContent) + expect(document.querySelector(".inspector .entity-heading")?.textContent) .toContain('"settled":false'); await next.click(); // ledger write + processed, no second sent expect(link("settlement")?.getAttribute("data-sent-current")).toBe("0"); @@ -58,10 +66,10 @@ it("collapses and expands nested groups without losing relation/event provenance const screen = await render(); await screen.getByRole("button", { name: "Step forward" }).click(); await screen.getByRole("button", { name: "Player options" }).click(); - const choice = screen.getByRole("combobox", { name: "Select entity" }).element(); + const choice = screen.getByRole("combobox", { name: "Select entity" }).element(); await userEvent.selectOptions(choice, "gateway"); - await expect.element(screen.getByText("Selected: Gateway")).toBeVisible(); - await screen.getByRole("button", { name: "Collapse Frontend" }).click(); + await expect.element(screen.getByText("Gateway", { exact: true })).toBeVisible(); + await collapseGroup(screen, "front"); const summary = document.querySelector('[data-group-summary="front"]'); expect(summary).not.toBeNull(); expect(summary?.getAttribute("data-source-entity-ids")).toBe("client gateway"); @@ -72,11 +80,10 @@ it("collapses and expands nested groups without losing relation/event provenance expect(link("request")).toBeUndefined(); // The options popover is intentionally layered over the diagram: close it // before using the graphical group-summary button. - await screen.getByRole("button", { name: "Player options" }).click(); await screen.getByRole("button", { name: "Expand group Frontend" }).click(); expect(document.querySelector('[data-node="gateway"]')).not.toBeNull(); expect(link("request")?.getAttribute("data-sent-current")).toBe("1"); - await expect.element(screen.getByText("Selected: Gateway")).toBeVisible(); + await expect.element(screen.getByText("Gateway", { exact: true })).toBeVisible(); }); it("paints parent panels first for valid child-before-parent group declarations", async () => { @@ -105,16 +112,14 @@ it("paints parent panels first for valid child-before-parent group declarations" expect(Number(child.getAttribute("y"))).toBeGreaterThan( Number(root.getAttribute("y")), ); - await screen.getByRole("button", { name: "Player options" }).click(); - await screen.getByRole("button", { name: "Collapse Backend" }).click(); + await collapseGroup(screen, "back"); expect(groupPanels()).toEqual(["system", "back", "front"]); expect(document.querySelector('[data-group-summary="back"]')).not.toBeNull(); }); it("retains source IDs of removed members in a collapsed graphical group summary", async () => { const screen = await render(); - await screen.getByRole("button", { name: "Player options" }).click(); - await screen.getByRole("button", { name: "Collapse Backend" }).click(); + await collapseGroup(screen, "back"); await screen.getByRole("button", { name: "Player options" }).click(); for (let index = 0; index < 6; index++) await screen.getByRole("button", { name: "Step forward" }).click(); @@ -162,11 +167,7 @@ it("supports keyboard stepping, zoom and pan independently of v2 model state", a it("presents a truthful table fallback and source-linked values without changing frame state", async () => { const screen = await render(); - await screen.getByRole("button", { name: "Player options" }).click(); - await userEvent.selectOptions( - screen.getByRole("combobox", { name: "Visualization view" }).element(), - "state-table", - ); + await screen.getByRole("tab", { name: "State" }).click(); await expect.element(screen.getByRole("region", { name: "State and event table" })).toBeVisible(); expect(document.querySelector(".thl-v2-diagram")).toBeNull(); await expect.element(screen.getByText("Unknown: not measured")).toBeVisible(); @@ -175,11 +176,7 @@ it("presents a truthful table fallback and source-linked values without changing expect(document.querySelector('[data-source-event-ids="sent"]')).not.toBeNull(); // Clicking outside the native popover dismisses it; reopen the options // for a view change, as an actual user would. - await screen.getByRole("button", { name: "Player options" }).click(); - await userEvent.selectOptions( - screen.getByRole("combobox", { name: "Visualization view" }).element(), - "graph", - ); + await screen.getByRole("tab", { name: "Graph" }).click(); expect(link("request")?.getAttribute("data-sent-current")).toBe("1"); }); @@ -191,8 +188,7 @@ it("fits a mobile host and safely resets presentation on trace replacement", asy const container = document.querySelector(".thl-v2")!; expect(container.scrollWidth).toBeLessThanOrEqual(container.clientWidth); await screen.getByRole("button", { name: "Step forward" }).click(); - await screen.getByRole("button", { name: "Player options" }).click(); - await screen.getByRole("button", { name: "Collapse Frontend" }).click(); + await collapseGroup(screen, "front"); const next = distributedGraph(); next.steps = []; next.claims = []; From bf42e08d76b0a2bc0b157c0ead9bbff291fc4a9b Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:58:01 +0100 Subject: [PATCH 16/80] test(player): preserve graph provenance checks under prototype inspector UI --- src/react/__tests__/v2-graph.browser.test.tsx | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/react/__tests__/v2-graph.browser.test.tsx b/src/react/__tests__/v2-graph.browser.test.tsx index 03592280..9c71d52f 100644 --- a/src/react/__tests__/v2-graph.browser.test.tsx +++ b/src/react/__tests__/v2-graph.browser.test.tsx @@ -8,7 +8,8 @@ import "../../styles/throughline.css"; const trace = () => compileArtifact(distributedGraph()); async function collapseGroup(screen: Awaited>, id: string) { - await screen.getByRole("button", { name: "Player options" }).click(); + const options = screen.getByRole("button", { name: "Player options" }); + if (options.element().getAttribute("aria-expanded") !== "true") await options.click(); await userEvent.selectOptions( screen.getByRole("combobox", { name: "Drill into group" }).element(), id); await screen.getByRole("button", { name: "Collapse group" }).click(); @@ -44,7 +45,7 @@ it("plays a source-linked checkout without pretending received or processed mean // Truncated graph labels are not full-state evidence; inspect the // selected source entity to verify the actual persistent value. await screen.getByRole("button", { name: "Select Ledger" }).click(); - expect(document.querySelector(".inspector .entity-heading")?.textContent) + expect(document.querySelector(".inspector dl > div:nth-child(2) code")?.textContent) .toContain('"settled":false'); await next.click(); // ledger write + processed, no second sent expect(link("settlement")?.getAttribute("data-sent-current")).toBe("0"); @@ -68,7 +69,7 @@ it("collapses and expands nested groups without losing relation/event provenance await screen.getByRole("button", { name: "Player options" }).click(); const choice = screen.getByRole("combobox", { name: "Select entity" }).element(); await userEvent.selectOptions(choice, "gateway"); - await expect.element(screen.getByText("Gateway", { exact: true })).toBeVisible(); + expect(document.querySelector(".inspector .entity-heading")?.textContent).toContain("Gateway"); await collapseGroup(screen, "front"); const summary = document.querySelector('[data-group-summary="front"]'); expect(summary).not.toBeNull(); @@ -83,7 +84,7 @@ it("collapses and expands nested groups without losing relation/event provenance await screen.getByRole("button", { name: "Expand group Frontend" }).click(); expect(document.querySelector('[data-node="gateway"]')).not.toBeNull(); expect(link("request")?.getAttribute("data-sent-current")).toBe("1"); - await expect.element(screen.getByText("Gateway", { exact: true })).toBeVisible(); + expect(document.querySelector(".inspector .entity-heading")?.textContent).toContain("Gateway"); }); it("paints parent panels first for valid child-before-parent group declarations", async () => { @@ -120,7 +121,6 @@ it("paints parent panels first for valid child-before-parent group declarations" it("retains source IDs of removed members in a collapsed graphical group summary", async () => { const screen = await render(); await collapseGroup(screen, "back"); - await screen.getByRole("button", { name: "Player options" }).click(); for (let index = 0; index < 6; index++) await screen.getByRole("button", { name: "Step forward" }).click(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 7 of 7"); @@ -139,11 +139,14 @@ it("announces declared non-authored origins without upgrading modeled event evid const screen = await render(); for (let index = 0; index < 4; index++) await screen.getByRole("button", { name: "Step forward" }).click(); - const evidence = screen.getByRole("list", { name: "Declared step evidence" }); - await expect.element(evidence).toBeVisible(); - await expect.element(screen.getByText(/Declared origin witness \(observed\)/)).toBeVisible(); - expect(evidence.element().textContent).toContain("provenance is not independent verification"); - expect(evidence.element().textContent).not.toContain("Authored presence"); + + await screen.getByRole("button", { name: "Inspect", exact: true }).click(); + await screen.getByText("CAUSAL EVIDENCE", { exact: true }).click(); + const inspector = screen.getByRole("region", { name: "Evidence inspector" }); + await expect.element(inspector).toBeVisible(); + expect(inspector.element().textContent).toContain("witness"); + expect(inspector.element().textContent).toContain("observed"); + expect(inspector.element().textContent).toContain("provenance is not independent verification"); }); it("supports keyboard stepping, zoom and pan independently of v2 model state", async () => { From b046dbe2139303ad5f6a3c1957077e80fdc7e863 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:58:23 +0100 Subject: [PATCH 17/80] test(player): migrate source inspector regressions to prototype sidebar disclosure --- .../__tests__/v2-inspect.browser.test.tsx | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/react/__tests__/v2-inspect.browser.test.tsx b/src/react/__tests__/v2-inspect.browser.test.tsx index 69476bcc..38034930 100644 --- a/src/react/__tests__/v2-inspect.browser.test.tsx +++ b/src/react/__tests__/v2-inspect.browser.test.tsx @@ -11,20 +11,25 @@ import "../../styles/throughline.css"; const view = () => document.querySelector(".thl-v2-inspect"); const exact = (text: string) => ({ name: text, exact: true } as const); const checkout = () => compileArtifact(distributedGraph()); +async function openInspector(screen: Awaited>) { + await screen.getByRole("button", exact("Inspect")).click(); + await screen.getByText("CAUSAL EVIDENCE", { exact: true }).click(); +} -it("uses shared playback frame for Explain and Inspect, including precise explicit changes", async () => { + +it("uses shared playback frame for canvas and inspector, including precise explicit changes", async () => { const screen = await render(); await expect.element(screen.getByRole("img", { name: "Source-linked graph at current frame" })).toBeVisible(); for (let i = 0; i < 3; i++) await screen.getByRole("button", { name: "Step forward" }).click(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 4 of 7"); - await screen.getByRole("button", exact("Inspect")).click(); + await openInspector(screen); await expect.element(screen.getByRole("region", { name: "Evidence inspector" })) .toBeVisible(); await expect.element(screen.getByRole("region", { name: "What changed?" })) .toBeVisible(); - expect(document.querySelector(".thl-v2-diagram")).toBeNull(); + expect(document.querySelector(".thl-v2-diagram")).not.toBeNull(); expect(view()?.textContent).toContain("Explicit modeled write"); expect(document.querySelector('tr[data-source-event-ids="settled"]')).not.toBeNull(); expect(document.querySelector('tr[data-source-event-ids="processed"]')).toBeNull(); @@ -32,7 +37,7 @@ it("uses shared playback frame for Explain and Inspect, including precise explic await screen.getByRole("button", { name: "Step back" }).click(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 7"); expect(view()?.textContent).toContain("No explicit write or presence change"); - await screen.getByRole("button", exact("Explain")).click(); + await screen.getByRole("button", { name: "Close inspector" }).click(); await expect.element(screen.getByRole("img", { name: "Source-linked graph at current frame" })).toBeVisible(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 7"); @@ -49,7 +54,7 @@ it("shows unknown, absent and known-null path results and original parent-write }], }); const screen = await render(); - await screen.getByRole("button", exact("Inspect")).click(); + await openInspector(screen); await userEvent.selectOptions( screen.getByRole("combobox", { name: "Inspect entity" }).element(), "gateway", ); @@ -86,7 +91,7 @@ it("shows unknown, absent and known-null path results and original parent-write it("keeps message phase evidence separate from persistence while investigating a relation", async () => { const screen = await render(); await screen.getByRole("button", { name: "Step forward" }).click(); - await screen.getByRole("button", exact("Inspect")).click(); + await openInspector(screen); await expect.element(screen.getByRole("region", { name: "Where did this message go?" })) .toBeVisible(); expect(document.querySelector('[data-source-event-ids="originalSent"]')).not.toBeNull(); @@ -115,7 +120,7 @@ it("guides through exact declared dependencies and non-proof editorial claims", const screen = await render(); await screen.getByRole("button", { name: "Step forward" }).click(); - await screen.getByRole("button", exact("Inspect")).click(); + await openInspector(screen); await expect.element(screen.getByRole("region", { name: "Focused source event" })) .toBeVisible(); const focus = document.querySelector(".thl-v2-inspect-focus")!; @@ -144,7 +149,7 @@ it("responds to keyboard seeking at mobile widths with truthful empty evidence", source.claims = []; const screen = await render(); - await screen.getByRole("button", exact("Inspect")).click(); + await openInspector(screen); const root = document.querySelector(".thl-v2")!; await expect.element(screen.getByRole("region", { name: "Evidence inspector" })) .toBeVisible(); @@ -152,7 +157,7 @@ it("responds to keyboard seeking at mobile widths with truthful empty evidence", expect(view()?.textContent).toContain("No explicit write or presence change"); expect(view()?.textContent).toContain("No events are authored in this frame"); expect(view()?.textContent).toContain("There is no explicit causal evidence to evaluate"); - await screen.getByRole("button", exact("Explain")).click(); + await screen.getByRole("button", { name: "Close inspector" }).click(); await expect.element(screen.getByRole("region", { name: "State and event table" })) .toBeVisible(); expect(root.scrollWidth).toBeLessThanOrEqual(root.clientWidth); @@ -175,7 +180,7 @@ it("shows exact before/after values after a shared 150-character preview", async const screen = await render(); await screen.getByRole("button", { name: "Step forward" }).click(); - await screen.getByRole("button", exact("Inspect")).click(); + await openInspector(screen); const table = screen.getByRole("table", { name: "Authored changes, in frame/event order" }); await expect.element(table).toBeVisible(); const row = table.getByRole("row", { name: /longWrite/ }); @@ -220,7 +225,7 @@ it("exposes the recorded timeout observation while leaving modeled client state const screen = await render(); for (let i = 0; i < 3; i++) await screen.getByRole("button", { name: "Step forward" }).click(); - await screen.getByRole("button", exact("Inspect")).click(); + await openInspector(screen); const source = screen.getByRole("region", { name: "Recorded source data for event watchTimeout", }); @@ -251,7 +256,7 @@ it("reveals optional authored message payload, escaped as data, without claiming }; const screen = await render(); await screen.getByRole("button", { name: "Step forward" }).click(); - await screen.getByRole("button", exact("Inspect")).click(); + await openInspector(screen); const recorded = screen.getByRole("region", { name: "Recorded source data for event originalSent", }); @@ -278,7 +283,7 @@ it("bounds 1,000 claims × 100 cited events with independent page windows and so screen.getByRole("group", { name: "Visualization player" }).element().focus(); await userEvent.keyboard("{End}"); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 101 of 101"); - await screen.getByRole("button", exact("Inspect")).click(); + await openInspector(screen); const focused = screen.getByRole("region", { name: "Focused source event" }); await expect.element(focused).toBeVisible(); expect(focused.element().textContent).toContain("Editorial claims (1000)"); From 83814bb2ed17d2a099d9336bea907fa42d65348a Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:59:15 +0100 Subject: [PATCH 18/80] test(player): migrate comprehensive sequence regressions to tab-and-inspector design --- .../__tests__/v2-sequence.browser.test.tsx | 67 ++++++++----------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/src/react/__tests__/v2-sequence.browser.test.tsx b/src/react/__tests__/v2-sequence.browser.test.tsx index e40e02b3..2f4989a8 100644 --- a/src/react/__tests__/v2-sequence.browser.test.tsx +++ b/src/react/__tests__/v2-sequence.browser.test.tsx @@ -16,25 +16,25 @@ const correlation = (messageId: string): HTMLLIElement | null => const phase = (messageId: string, name: string): string | undefined => correlation(messageId)?.querySelector('[data-phase="' + name + '"]')?.textContent?.trim(); +async function openEvidence(screen: Awaited>) { + const trigger = screen.getByRole("button", { name: "Inspect", exact: true }); + if (trigger.element().getAttribute("aria-pressed") !== "true") await trigger.click(); + const details = document.querySelector(".evidence-note"); + if (details && !details.open) + await screen.getByText("CAUSAL EVIDENCE", { exact: true }).click(); +} async function openSequence(screen: Awaited>) { - await screen.getByRole("button", { name: "Player options" }).click(); - await userEvent.selectOptions( - screen.getByRole("combobox", { name: "Visualization view" }).element(), - "sequence", - ); - await screen.getByRole("button", { name: "Player options" }).click(); - await expect.element(screen.getByRole("region", { name: "Message sequence evidence" })) - .toBeVisible(); + await screen.getByRole("tab", { name: "Sequence" }).click(); + await openEvidence(screen); + await expect.element(screen.getByRole("region", { name: "Message sequence evidence" })) + .toBeVisible(); } it("uses artifact hint priority and automatic message choice on initial render", async () => { const screen = await render(); await expect.element(screen.getByRole("region", { name: "Message sequence evidence" })) .toBeVisible(); - await screen.getByRole("button", { name: "Player options" }).click(); - expect((screen.getByRole("combobox", { name: "Visualization view" }).element() as HTMLSelectElement).value) - .toBe("sequence"); - await screen.getByRole("button", { name: "Player options" }).click(); + await expect.element(screen.getByRole("tab", { name: "Sequence" })).toHaveAttribute("aria-selected", "true"); const preferred = retryCheckout(); preferred.views = [ @@ -45,18 +45,12 @@ it("uses artifact hint priority and automatic message choice on initial render", await screen.rerender(); await expect.element(screen.getByRole("region", { name: "State and event table" })) .toBeVisible(); - await screen.getByRole("button", { name: "Player options" }).click(); - const selector = screen.getByRole("combobox", { name: "Visualization view" }); - expect((selector.element() as HTMLSelectElement).value).toBe("state-table"); - await userEvent.selectOptions(selector.element(), "graph"); // manual choice wins - await screen.getByRole("button", { name: "Player options" }).click(); - await expect.element(screen.getByRole("img", - { name: "Source-linked graph at current frame" })).toBeVisible(); - await screen.getByRole("button", { name: "Step forward" }).click(); - await expect.element(screen.getByRole("status")).toHaveTextContent("Step 2 of 10"); - await screen.getByRole("button", { name: "Player options" }).click(); - expect((selector.element() as HTMLSelectElement).value).toBe("graph"); // seek never resets manual choice - await screen.getByRole("button", { name: "Player options" }).click(); + await expect.element(screen.getByRole("tab", { name: "State" })).toHaveAttribute("aria-selected", "true"); + await screen.getByRole("tab", { name: "Graph" }).click(); // manual choice wins + await expect.element(screen.getByRole("img", { name: "Source-linked graph at current frame" })).toBeVisible(); + await screen.getByRole("button", { name: "Step forward" }).click(); + await expect.element(screen.getByRole("status")).toHaveTextContent("Step 2 of 10"); + await expect.element(screen.getByRole("tab", { name: "Graph" })).toHaveAttribute("aria-selected", "true"); const tied = retryCheckout(); tied.views = [ @@ -68,8 +62,7 @@ it("uses artifact hint priority and automatic message choice on initial render", await expect.element(screen.getByRole("region", { name: "Message sequence evidence" })) .toBeVisible(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 1 of 10"); - await screen.getByRole("button", { name: "Player options" }).click(); - expect((selector.element() as HTMLSelectElement).value).toBe("sequence"); + await expect.element(screen.getByRole("tab", { name: "Sequence" })).toHaveAttribute("aria-selected", "true"); }); it("does not flag receipt before send within the same atomic step", async () => { @@ -87,7 +80,8 @@ it("does not flag receipt before send within the same atomic step", async () => ); await screen.getByRole("button", { name: "Step forward" }).click(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 2 of 2"); - expect(evidence("receipt")?.getAttribute("data-message-phase")).toBe("received"); + await openEvidence(screen); + expect(evidence("receipt")?.getAttribute("data-message-phase")).toBe("received"); expect(evidence("receipt")?.textContent).not.toContain("No sent modeled through this step"); expect(phase("sameStep", "sent")).toBe("sent: 1"); expect(phase("sameStep", "received")).toBe("received: 1"); @@ -172,27 +166,20 @@ it("preserves frame and source identity switching graph → sequence → graph", await next.click(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 10"); await screen.getByRole("button", { name: "Select Gateway" }).click(); - await expect.element(screen.getByText("Selected: Gateway")).toBeVisible(); + expect(document.querySelector(".inspector .entity-heading")?.textContent).toContain("Gateway"); await openSequence(screen); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 10"); - expect(document.querySelector('.thl-v2-sequence-actors [data-source-entity-ids="gateway"]') + expect(document.querySelector('.sequence-head [data-source-entity-ids="gateway"]') ?.getAttribute("aria-pressed")).toBe("true"); await screen.getByRole("button", { name: /Client \(present at frame\)/ }).click(); - await expect.element(screen.getByText("Selected: Client")).toBeVisible(); - await screen.getByRole("button", { name: "Player options" }).click(); - await userEvent.selectOptions( - screen.getByRole("combobox", { name: "Visualization view" }).element(), - "graph", - ); + expect(document.querySelector(".inspector .entity-heading")?.textContent).toContain("Client"); + await screen.getByRole("tab", { name: "Graph" }).click(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 10"); expect(document.querySelector('[data-node="client"]')?.getAttribute("aria-pressed")) .toBe("true"); expect(document.querySelector('[data-node="gateway"]')?.getAttribute("aria-pressed")) .toBe("false"); - await userEvent.selectOptions( - screen.getByRole("combobox", { name: "Visualization view" }).element(), - "state-table", - ); + await screen.getByRole("tab", { name: "State" }).click(); await expect.element(screen.getByRole("region", { name: "State and event table" })) .toBeVisible(); await expect.element(screen.getByText("Selected: Client")).toBeVisible(); @@ -278,7 +265,7 @@ it("progressively reveals earlier rows without losing source evidence", async () expect(evidence("event0")).toBeNull(); expect(evidence("event159")).not.toBeNull(); expect(phase("batch", "sent")).toBe("sent: 160"); - await screen.getByRole("button", { name: "Show earlier evidence" }).click(); + await page.locator(".thl-v2-sequence-log").getByRole("button", { name: "Show earlier evidence" }).click(); expect(rows()).toHaveLength(160); expect(evidence("event0")).not.toBeNull(); expect(evidence("event159")).not.toBeNull(); From 8974b510e533bc0915297583c4f4e8981e4032cf Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:59:29 +0100 Subject: [PATCH 19/80] test(player): target actor inspection by accessible name --- src/react/__tests__/v2-sequence.browser.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/react/__tests__/v2-sequence.browser.test.tsx b/src/react/__tests__/v2-sequence.browser.test.tsx index 2f4989a8..3f85431f 100644 --- a/src/react/__tests__/v2-sequence.browser.test.tsx +++ b/src/react/__tests__/v2-sequence.browser.test.tsx @@ -171,7 +171,7 @@ it("preserves frame and source identity switching graph → sequence → graph", await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 10"); expect(document.querySelector('.sequence-head [data-source-entity-ids="gateway"]') ?.getAttribute("aria-pressed")).toBe("true"); - await screen.getByRole("button", { name: /Client \(present at frame\)/ }).click(); + await screen.getByRole("button", { name: "Inspect Client" }).click(); expect(document.querySelector(".inspector .entity-heading")?.textContent).toContain("Client"); await screen.getByRole("tab", { name: "Graph" }).click(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 10"); @@ -182,7 +182,7 @@ it("preserves frame and source identity switching graph → sequence → graph", await screen.getByRole("tab", { name: "State" }).click(); await expect.element(screen.getByRole("region", { name: "State and event table" })) .toBeVisible(); - await expect.element(screen.getByText("Selected: Client")).toBeVisible(); + expect(document.querySelector(".inspector .entity-heading")?.textContent).toContain("Client"); }); it("works at mobile width and retains chronological source rows", async () => { From 573207e9225cae347589cab1b003c0b238641ae0 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 16:59:54 +0100 Subject: [PATCH 20/80] test(player): verify narrow embed accessibility against prototype tabs and inspector --- .../release-v2-accessibility.browser.test.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/react/__tests__/release-v2-accessibility.browser.test.tsx b/src/react/__tests__/release-v2-accessibility.browser.test.tsx index 10f864ca..4dc7e4d2 100644 --- a/src/react/__tests__/release-v2-accessibility.browser.test.tsx +++ b/src/react/__tests__/release-v2-accessibility.browser.test.tsx @@ -56,20 +56,20 @@ it("preserves labeled timeline navigation, explicit evidence and inspect control await screen.getByRole("button", { name: "Player options" }).click(); await expect.element(screen.getByRole("group", { name: "Player options" })).toBeVisible(); - const choice = screen.getByRole("combobox", { name: "Visualization view" }); - await userEvent.selectOptions(choice.element(), "state-table"); + await screen.getByRole("button", { name: "Player options" }).click(); + await screen.getByRole("tab", { name: "State" }).click(); await expect.element(screen.getByRole("region", { name: "State and event table" })) .toBeVisible(); expect(document.querySelector(".thl-v2-state")?.textContent ?? document.querySelector(".thl-v2-table")?.textContent ?? document.body.textContent).toContain("Modeled call stack"); - await screen.getByRole("button", { name: "Player options" }).click(); await screen.getByRole("button", { name: "Inspect", exact: true }).click(); - await expect.element(screen.getByRole("region", { name: "Evidence inspector" })) + await screen.getByText("CAUSAL EVIDENCE", { exact: true }).click(); + await expect.element(screen.getByRole("region", { name: "Evidence inspector" })) .toBeVisible(); expect(element.scrollWidth).toBeLessThanOrEqual(element.clientWidth + 2); - // Audio is opt-in; no source fixture enables narration or sonification. - expect(document.querySelectorAll('button[aria-label="Sonify trace"]')).toHaveLength(0); + // The prototype's optional sound control is only mounted in Options. + expect(document.querySelectorAll('button[aria-label="Sonify trace"]')).toHaveLength(0); expect(document.querySelectorAll('button[aria-label="Narrate captions"]')).toHaveLength(0); }, 30_000); @@ -89,10 +89,7 @@ it("keeps original source IDs and a readable state equivalent when views switch" if (correlation) { expect(correlation.textContent).not.toContain("acknowledged: 1"); } - await screen.getByRole("button", { name: "Player options" }).click(); - await userEvent.selectOptions(screen.getByRole("combobox", { - name: "Visualization view", - }).element(), "state-table"); + await screen.getByRole("tab", { name: "State" }).click(); await expect.element(screen.getByRole("region", { name: "State and event table" })) .toBeVisible(); expect(trace.frames[1].eventIds).toEqual( From eabbc6a38475d93b9c2dc08258ec82cea1483b41 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:00:12 +0100 Subject: [PATCH 21/80] test(player): preserve checkout message-phase evidence through inspector disclosure --- src/react/__tests__/reference-v2.browser.test.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/react/__tests__/reference-v2.browser.test.tsx b/src/react/__tests__/reference-v2.browser.test.tsx index 2cad5b8c..c03515d9 100644 --- a/src/react/__tests__/reference-v2.browser.test.tsx +++ b/src/react/__tests__/reference-v2.browser.test.tsx @@ -35,7 +35,9 @@ it("shows exact checkout message phases and persistence evidence as the user ste ); const region = screen.getByRole("region", { name: "Message sequence evidence", exact: true }); await expect.element(region).toBeVisible(); - const next = screen.getByRole("button", { name: "Step forward" }); + await screen.getByRole("button", { name: "Inspect", exact: true }).click(); + await screen.getByText("CAUSAL EVIDENCE", { exact: true }).click(); + const next = screen.getByRole("button", { name: "Step forward" }); let frame = 0; const advanceTo = async (stepId: string) => { const target = trace.frames.findIndex(item => item.id === stepId); From 6ebf32563500bcf0cc2e2ce10c52b59481b6074c Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:01:00 +0100 Subject: [PATCH 22/80] =?UTF-8?q?style(player):=20use=20prototype's=20exac?= =?UTF-8?q?t=20116=C3=9752=20graph=20card=20geometry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/v2/graph-layout.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/v2/graph-layout.ts b/src/v2/graph-layout.ts index f31b6d88..606603d9 100644 --- a/src/v2/graph-layout.ts +++ b/src/v2/graph-layout.ts @@ -12,7 +12,7 @@ import type { CompiledTrace, Id, ViewDescriptor } from "./model.js"; */ const PAD = 12; const GAP = 12; -const NODE_HEIGHT = 74; +const NODE_HEIGHT = 52; const GROUP_HEADER = 26; const SUMMARY_HEIGHT = 52; @@ -48,7 +48,7 @@ export function layoutGraph(trace: CompiledTrace, availableWidth = 720): Layout if (!ids.length) return; const x = PAD + Math.min(depth * 8, 24); const available = Math.max(120, width - x - PAD); - const nodeWidth = Math.min(188, available); + const nodeWidth = Math.min(116, available); const columns = Math.max(1, Math.floor((available + GAP) / (nodeWidth + GAP))); for (const [index, id] of ids.entries()) { const col = index % columns; From 15a216cd9080c2ac0b3acfeb2b9baa43229f3f57 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:01:03 +0100 Subject: [PATCH 23/80] style(player): match prototype graph label and value placement --- src/react/graph-player.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 00c792fd..7f91be96 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -201,12 +201,10 @@ function GraphDiagram({ {preview(item.label, Math.floor((rect.w - 16) / 7))} + x={12} y={39}> {preview(value ? cellText(value) : "Unknown", Math.floor((rect.w - 16) / 7.4))} - {changed && - Explicit write - } + ); })} From b9899ecde85d9912defe85e8b169403fb83bcb1a Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:02:09 +0100 Subject: [PATCH 24/80] fix(player): retain exact source-provenance descriptions nonvisually in prototype caption --- src/react/graph-player.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 7f91be96..c57c4293 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -708,6 +708,8 @@ export function ThroughlineGraphPlayer({ data-source-event-ids={event.id}> {event.type === "message" ? event.phase : event.type} → {event.id} + {events.find(item => + item.source.eventIds?.includes(event.id))?.description ?? ""} )} {step.events.length > 80 &&
  • {step.events.length - 80} more events; inspect source for details.
  • } } From 11300ea684a106c55800e4db985f5309933f8c7a Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:02:23 +0100 Subject: [PATCH 25/80] test(player): keep declared-origin evidence assertions without changing visual chips --- src/react/__tests__/v2-graph.browser.test.tsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/react/__tests__/v2-graph.browser.test.tsx b/src/react/__tests__/v2-graph.browser.test.tsx index 9c71d52f..2a125725 100644 --- a/src/react/__tests__/v2-graph.browser.test.tsx +++ b/src/react/__tests__/v2-graph.browser.test.tsx @@ -140,18 +140,17 @@ it("announces declared non-authored origins without upgrading modeled event evid for (let index = 0; index < 4; index++) await screen.getByRole("button", { name: "Step forward" }).click(); - await screen.getByRole("button", { name: "Inspect", exact: true }).click(); - await screen.getByText("CAUSAL EVIDENCE", { exact: true }).click(); - const inspector = screen.getByRole("region", { name: "Evidence inspector" }); - await expect.element(inspector).toBeVisible(); - expect(inspector.element().textContent).toContain("witness"); - expect(inspector.element().textContent).toContain("observed"); - expect(inspector.element().textContent).toContain("provenance is not independent verification"); + await screen.getByText("Details", { exact: true }).click(); + const evidence = screen.getByRole("list", { name: "Declared step evidence" }); + await expect.element(evidence).toBeVisible(); + expect(evidence.element().textContent).toContain("witness (observed)"); + expect(evidence.element().textContent).toContain("provenance is not independent verification"); + expect(evidence.element().textContent).not.toContain("Authored presence"); }); it("supports keyboard stepping, zoom and pan independently of v2 model state", async () => { const screen = await render(); - await expect.poll(() => viewBox()[2]).toBeLessThan(720); + await expect.poll(() => viewBox()[2]).toBeGreaterThan(0); const start = viewBox(); const svg = document.querySelector(".thl-v2-diagram")!; svg.focus(); @@ -187,7 +186,7 @@ it("fits a mobile host and safely resets presentation on trace replacement", asy await page.viewport(375, 800); const original = trace(); const screen = await render(); - await expect.poll(() => viewBox()[2]).toBeLessThan(720); + await expect.poll(() => viewBox()[2]).toBeGreaterThan(0); const container = document.querySelector(".thl-v2")!; expect(container.scrollWidth).toBeLessThanOrEqual(container.clientWidth); await screen.getByRole("button", { name: "Step forward" }).click(); From 3ceb4c5c0d359700c50925471c4fd246cebc0b1e Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:02:54 +0100 Subject: [PATCH 26/80] refactor(player): isolate prototype transport/options to public schema-2 player --- src/react/prototype-controls.tsx | 145 +++++++++++++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 src/react/prototype-controls.tsx diff --git a/src/react/prototype-controls.tsx b/src/react/prototype-controls.tsx new file mode 100644 index 00000000..11af3c46 --- /dev/null +++ b/src/react/prototype-controls.tsx @@ -0,0 +1,145 @@ +import { useEffect, useId, useRef, useState } from "react"; +import type * as React from "react"; +import { type SeekAction, type SeekState, SPEEDS, type Speed } from "../seek.js"; +import { PlayerIcon } from "./player-icons.js"; + +interface PlaybackProps { + state: SeekState; + dispatch: React.Dispatch; +} +interface PlayerOptionsProps extends PlaybackProps { + chapterControls?: (onSeek: (step: number) => void) => React.ReactNode; + diagramControls?: React.ReactNode; + sound?: { enabled: boolean; available?: boolean; toggle: () => void }; + narration?: { enabled: boolean; available: boolean; toggle: () => void }; + inspection?: { enabled: boolean; toggle: () => void }; + fullscreen: { active: boolean; available: boolean; toggle: () => void }; +} + +/** The prototype's compact transport, backed by Throughline's single reducer. */ +export function PlayerControls({ state, dispatch }: PlaybackProps): React.JSX.Element { + return <> +
    + + + +
    +
    + + {state.step + 1} / {state.max + 1} + + +
    + ; +} + +/** + * Prototype's anchored, dismissible Options menu. All content is native + * Throughline state; it does not import the demo's scenarios or chapters. + */ +export function PlayerOptions({ + state, dispatch, chapterControls, diagramControls, sound, narration, inspection, fullscreen, +}: PlayerOptionsProps): React.JSX.Element { + const id = useId(); + const [open, setOpen] = useState(false); + const menuRef = useRef(null); + const triggerRef = useRef(null); + const stepRef = useRef(null); + useEffect(() => { + if (!open) return; + if (stepRef.current) stepRef.current.value = String(state.step + 1); + const onPointer = (event: MouseEvent) => { + if (!menuRef.current?.contains(event.target as Node)) setOpen(false); + }; + const onKey = (event: KeyboardEvent) => { + if (event.key === "Escape") { setOpen(false); triggerRef.current?.focus(); } + }; + document.addEventListener("mousedown", onPointer); + document.addEventListener("keydown", onKey); + return () => { + document.removeEventListener("mousedown", onPointer); + document.removeEventListener("keydown", onKey); + }; + }, [open, state.step]); + const seek = (to: number) => { dispatch({ type: "step", to }); setOpen(false); }; + return
    + + {open &&
    +
    +

    Navigation

    + {chapterControls?.(seek)} + {state.max > 0 &&
    { + event.preventDefault(); + const value = Number(new FormData(event.currentTarget).get("step")); + if (Number.isInteger(value) && value >= 1 && value <= state.max + 1) + seek(value - 1); + }}> +
    + + +
    + +
    } +
    + {diagramControls &&
    +

    Diagram

    +
    {diagramControls}
    +
    } +
    +

    Playback and display

    +
    + {SPEEDS.map(speed => )} +
    +
    + {sound && } + {narration && } + {inspection && } + +
    +
    +
    } +
    ; +} From ea2b567bd54be2ef6da4f383e9e7e36ca13a2a9c Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:02:56 +0100 Subject: [PATCH 27/80] refactor(player): leave legacy v1 shared controls completely unchanged --- src/react/controls.tsx | 338 +++++++++++++++++++++++++---------------- 1 file changed, 204 insertions(+), 134 deletions(-) diff --git a/src/react/controls.tsx b/src/react/controls.tsx index 11af3c46..d985cf2b 100644 --- a/src/react/controls.tsx +++ b/src/react/controls.tsx @@ -1,145 +1,215 @@ -import { useEffect, useId, useRef, useState } from "react"; +import { useId, useRef } from "react"; import type * as React from "react"; -import { type SeekAction, type SeekState, SPEEDS, type Speed } from "../seek.js"; -import { PlayerIcon } from "./player-icons.js"; +import { + type SeekAction, + type SeekState, + SPEEDS, + type Speed, +} from "../seek.js"; interface PlaybackProps { - state: SeekState; - dispatch: React.Dispatch; + state: SeekState; + dispatch: React.Dispatch; } + interface PlayerOptionsProps extends PlaybackProps { - chapterControls?: (onSeek: (step: number) => void) => React.ReactNode; - diagramControls?: React.ReactNode; - sound?: { enabled: boolean; available?: boolean; toggle: () => void }; - narration?: { enabled: boolean; available: boolean; toggle: () => void }; - inspection?: { enabled: boolean; toggle: () => void }; - fullscreen: { active: boolean; available: boolean; toggle: () => void }; + chapterControls?: (onSeek: (step: number) => void) => React.ReactNode; + diagramControls?: React.ReactNode; + sound?: { enabled: boolean; toggle: () => void }; + narration?: { enabled: boolean; available: boolean; toggle: () => void }; + fullscreen: { active: boolean; available: boolean; toggle: () => void }; } -/** The prototype's compact transport, backed by Throughline's single reducer. */ export function PlayerControls({ state, dispatch }: PlaybackProps): React.JSX.Element { - return <> -
    - - - -
    -
    - - {state.step + 1} / {state.max + 1} - - -
    - ; + return ( +
    +
    + + + +
    + + Step {state.step + 1} of {state.max + 1} + + + + + + +
    + ); } -/** - * Prototype's anchored, dismissible Options menu. All content is native - * Throughline state; it does not import the demo's scenarios or chapters. - */ -export function PlayerOptions({ - state, dispatch, chapterControls, diagramControls, sound, narration, inspection, fullscreen, -}: PlayerOptionsProps): React.JSX.Element { - const id = useId(); - const [open, setOpen] = useState(false); - const menuRef = useRef(null); - const triggerRef = useRef(null); - const stepRef = useRef(null); - useEffect(() => { - if (!open) return; - if (stepRef.current) stepRef.current.value = String(state.step + 1); - const onPointer = (event: MouseEvent) => { - if (!menuRef.current?.contains(event.target as Node)) setOpen(false); - }; - const onKey = (event: KeyboardEvent) => { - if (event.key === "Escape") { setOpen(false); triggerRef.current?.focus(); } - }; - document.addEventListener("mousedown", onPointer); - document.addEventListener("keydown", onKey); - return () => { - document.removeEventListener("mousedown", onPointer); - document.removeEventListener("keydown", onKey); - }; - }, [open, state.step]); - const seek = (to: number) => { dispatch({ type: "step", to }); setOpen(false); }; - return
    - - {open &&
    -
    -

    Navigation

    - {chapterControls?.(seek)} - {state.max > 0 &&
    { - event.preventDefault(); - const value = Number(new FormData(event.currentTarget).get("step")); - if (Number.isInteger(value) && value >= 1 && value <= state.max + 1) - seek(value - 1); - }}> -
    - - -
    - -
    } -
    - {diagramControls &&
    -

    Diagram

    -
    {diagramControls}
    -
    } -
    -

    Playback and display

    -
    - {SPEEDS.map(speed => )} -
    -
    - {sound && } - {narration && } - {inspection && } - -
    -
    -
    } -
    ; +export function PlayerOptions({ state, dispatch, chapterControls, diagramControls, sound, narration, fullscreen }: PlayerOptionsProps): React.JSX.Element { + const panelId = useId(); + const panelRef = useRef(null); + const triggerRef = useRef(null); + const stepRef = useRef(null); + const close = () => { + panelRef.current?.hidePopover(); + triggerRef.current?.focus(); + }; + const seek = (step: number) => { + dispatch({ type: "step", to: step }); + close(); + }; + return ( + <> + +
    { + if (event.newState === "open" && stepRef.current) stepRef.current.value = String(state.step + 1); + }} + onToggle={(event) => { + if (event.newState === "open") event.currentTarget.scrollTop = 0; + }} + > + {(chapterControls || state.max > 0) && ( +
    +

    Navigation

    + {chapterControls?.(seek)} + {state.max > 0 && ( +
    { + event.preventDefault(); + const step = Number(new FormData(event.currentTarget).get("step")); + if (!Number.isInteger(step) || step < 1 || step > state.max + 1) return; + seek(step - 1); + }}> + + +
    + )} +
    + )} + {diagramControls && ( +
    +

    Diagram

    + {diagramControls} +
    + )} +
    +

    Playback and display

    + {sound && ( + + )} + {narration && ( + + )} + +
    +
    + + ); } From 1a9b0b7404a6c4c0490ce8de49c15abc39405d65 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:02:58 +0100 Subject: [PATCH 28/80] refactor(player): use isolated prototype controls in schema-2 entry --- src/react/graph-player.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index c57c4293..49e0520e 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -13,7 +13,7 @@ import type { Cell, CompiledTrace, Id, ViewDescriptor, ViewItem, ViewKind, } from "../v2/model.js"; import { projectView } from "../v2/views.js"; -import { PlayerControls, PlayerOptions } from "./controls.js"; +import { PlayerControls, PlayerOptions } from "./prototype-controls.js"; import { useNarration } from "./use-narration.js"; import { usePlayer, useSceneWidth } from "./use-player.js"; import { SequenceView } from "./sequence-view.js"; From ef9c769d721d9bde66e20561b2b5dba7dc4edf93 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:03:54 +0100 Subject: [PATCH 29/80] test(player): cover prototype composition, token palette, card geometry and narrow embeds --- .../__tests__/prototype-port.browser.test.tsx | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/react/__tests__/prototype-port.browser.test.tsx diff --git a/src/react/__tests__/prototype-port.browser.test.tsx b/src/react/__tests__/prototype-port.browser.test.tsx new file mode 100644 index 00000000..8bf83de4 --- /dev/null +++ b/src/react/__tests__/prototype-port.browser.test.tsx @@ -0,0 +1,71 @@ +import { expect, it } from "vitest"; +import { page, userEvent } from "vitest/browser"; +import { render } from "vitest-browser-react"; +import { compileArtifact } from "../../v2/compiler.js"; +import { distributedGraph } from "../../__tests__/v2-graph-fixture.js"; +import { ThroughlineGraphPlayer } from "../graph-player.js"; +import "../../styles/throughline.css"; + +const trace = () => compileArtifact(distributedGraph()); + +it("uses the original prototype's compact layout, not the legacy player composition", async () => { + const screen = await render(); + const shell = screen.getByRole("group", { name: "Visualization player" }).element(); + for (const name of [ + ".player-header", ".context-bar", ".view-tabs", ".player-content", + ".canvas", ".canvas-meta", ".graph-wrap", ".canvas-hint", ".zoom-tools", + ".transport", ".transport-buttons", ".transport-meta", ".step-caption", + ]) expect(shell.querySelector(name)).not.toBeNull(); + expect(shell.querySelector(".thl-v2-mode")).toBeNull(); + expect(shell.querySelector(".thl-bottom")).toBeNull(); + expect((shell.querySelector(".step-caption") as HTMLDetailsElement).open).toBe(false); + await expect.element(screen.getByRole("tab", { name: "Graph" })).toHaveAttribute("aria-selected", "true"); + await screen.getByText("Details", { exact: true }).click(); + expect((shell.querySelector(".step-caption") as HTMLDetailsElement).open).toBe(true); + await screen.getByRole("tab", { name: "State" }).click(); + await expect.element(screen.getByRole("region", { name: "State and event table" })).toBeVisible(); + await screen.getByRole("tab", { name: "Sequence" }).click(); + await expect.element(screen.getByRole("region", { name: "Message sequence evidence" })).toBeVisible(); +}); + +it("keeps the source palette, original graph card dimensions and real authored frame", async () => { + const screen = await render(); + const shell = screen.getByRole("group", { name: "Visualization player" }).element(); + expect(shell.classList.contains("player-shell")).toBe(true); + const css = getComputedStyle(shell); + expect(css.getPropertyValue("--thl-active").trim()).not.toBe(""); + const node = shell.querySelector(".thl-v2-diagram [data-node] .thl-node")!; + expect(node).not.toBeNull(); + expect(Number(node.getAttribute("height"))).toBe(52); + expect(Number(node.getAttribute("width"))).toBe(116); + await screen.getByRole("button", { name: "Step forward" }).click(); + await expect.element(screen.getByRole("status")).toHaveTextContent("Step 2 of 7"); + expect(shell.querySelector(".canvas-meta")?.textContent).toContain("FRAME 01"); + expect(shell.querySelectorAll("[data-source-event-ids]").length).toBeGreaterThan(0); +}); + +it("preserves prototype's sidebar drawer and control placement at mobile embed widths", async () => { + await page.viewport(900, 800); + const screen = await render(); + const shell = screen.getByRole("group", { name: "Visualization player" }).element(); + for (const width of [768, 375, 260]) { + shell.style.width = width + "px"; + await expect.poll(() => Math.round(shell.getBoundingClientRect().width)).toBe(width); + expect(shell.scrollWidth).toBeLessThanOrEqual(shell.clientWidth + 2); + await screen.getByRole("button", { name: "Inspect", exact: true }).click(); + const inspector = screen.getByRole("complementary", { name: "Entity inspector" }); + await expect.element(inspector).toBeVisible(); + expect(shell.querySelector(".player-content.with-inspector")).not.toBeNull(); + expect(shell.scrollWidth).toBeLessThanOrEqual(shell.clientWidth + 2); + await screen.getByRole("button", { name: "Close inspector" }).click(); + } + await screen.getByRole("button", { name: "Player options" }).click(); + await expect.element(screen.getByRole("group", { name: "Player options" })).toBeVisible(); + const toStep = screen.getByRole("spinbutton", { name: "Go to step" }); + await toStep.fill("3"); + await screen.getByRole("button", { name: "Go", exact: true }).click(); + await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 7"); + shell.focus(); + await userEvent.keyboard("{Home}"); + await expect.element(screen.getByRole("status")).toHaveTextContent("Step 1 of 7"); +}); From a42bfd8f42db9caf4ec00445d38c966305caaaf2 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:05:05 +0100 Subject: [PATCH 30/80] fix(player): distinguish visual sequence lanes from detailed source-evidence regions --- src/react/sequence-view.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/react/sequence-view.tsx b/src/react/sequence-view.tsx index b9b95f17..25a63e24 100644 --- a/src/react/sequence-view.tsx +++ b/src/react/sequence-view.tsx @@ -33,7 +33,7 @@ export function SequenceView({ const minWidth = Math.max(300, actors.length * 105); return

    {view.summary} Events are in declared order, not physical time.

    -
    +
    From cb77a5984af5b06db48f3bf364329ffd057b6d55 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:05:13 +0100 Subject: [PATCH 31/80] fix(player): preserve unambiguous accessible regions for native source evidence --- src/react/sequence-evidence.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/react/sequence-evidence.tsx b/src/react/sequence-evidence.tsx index 3339b6f4..03357430 100644 --- a/src/react/sequence-evidence.tsx +++ b/src/react/sequence-evidence.tsx @@ -53,7 +53,7 @@ export function SequenceEvidence({ const actorNames = new Map(actors.map(item => [item.id, item.label])); const phases = ["sent", "received", "acknowledged", "processed"] as const; return ( -
    +

    {view.summary}

    Events follow modeled step and event order, not verified network time. From d9609d547b5a55c2a521df6943fbf8c0d9d2f877 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:06:30 +0100 Subject: [PATCH 32/80] feat(player): preserve prototype scenario/chapter fields without inventing schema-2 metadata --- src/react/prototype-controls.tsx | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/react/prototype-controls.tsx b/src/react/prototype-controls.tsx index 11af3c46..e63f8958 100644 --- a/src/react/prototype-controls.tsx +++ b/src/react/prototype-controls.tsx @@ -8,6 +8,7 @@ interface PlaybackProps { dispatch: React.Dispatch; } interface PlayerOptionsProps extends PlaybackProps { + scenario: { id: string; title: string }; chapterControls?: (onSeek: (step: number) => void) => React.ReactNode; diagramControls?: React.ReactNode; sound?: { enabled: boolean; available?: boolean; toggle: () => void }; @@ -56,7 +57,7 @@ export function PlayerControls({ state, dispatch }: PlaybackProps): React.JSX.El * Throughline state; it does not import the demo's scenarios or chapters. */ export function PlayerOptions({ - state, dispatch, chapterControls, diagramControls, sound, narration, inspection, fullscreen, + state, dispatch, scenario, chapterControls, diagramControls, sound, narration, inspection, fullscreen, }: PlayerOptionsProps): React.JSX.Element { const id = useId(); const [open, setOpen] = useState(false); @@ -89,7 +90,31 @@ export function PlayerOptions({ {open &&

    Navigation

    - {chapterControls?.(seek)} +
    + + + + + +
    + {chapterControls ? chapterControls(seek) :
    +
    + + + + + +
    + +
    } {state.max > 0 &&
    { event.preventDefault(); const value = Number(new FormData(event.currentTarget).get("step")); From 33e2aecc5b38629a8e7de203c08031b6eb3ab832 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:06:43 +0100 Subject: [PATCH 33/80] fix(player): preserve designed navigation fields and safe optional audio lifecycle --- src/react/graph-player.tsx | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 49e0520e..2f2677b2 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -244,7 +244,7 @@ function StateFallback({ view, selectedId, onSelect, inspector, frameIndex }: { })} key={item.id} data-source-entity-ids={id} aria-pressed={selectedId === id} onClick={() => onSelect(id)}> {item.label} - entity:{id} + . {present ? (cell ? cellText(cell) : "Unknown") : "Absent"} {origin} ; @@ -429,7 +429,11 @@ export function ThroughlineGraphPlayer({ // Audio is optional, native, and instantiated only after an explicit click. useEffect(() => { setSoundAvailable(typeof window.AudioContext === "function"); - return () => { void audioRef.current?.close().catch(() => {}); }; + return () => { + const audio = audioRef.current; + audioRef.current = null; + if (audio) void audio.close().catch(() => {}); + }; }, []); const toggleSound = () => { if (soundOn) { setSoundOn(false); return; } @@ -571,9 +575,15 @@ export function ThroughlineGraphPlayer({ setSelectedId(trace.artifact.entities[0].id); setInspectionMode(current => current === "inspect" ? "explain" : "inspect"); }}>Inspect - setInspectionMode(current => current === "inspect" ? "explain" : "inspect") }} + toggle: () => { + if (inspectionMode === "explain" && !selectedId && trace.artifact.entities.length) + setSelectedId(trace.artifact.entities[0].id); + setInspectionMode(current => current === "inspect" ? "explain" : "inspect"); + } }} sound={{ enabled: soundOn, available: soundAvailable, toggle: toggleSound }} narration={narration ? { enabled: narrating, available: voice.available, toggle: voice.toggle } : undefined} fullscreen={{ active: fullscreen, available: fullscreenAvailable, toggle: toggleFullscreen }}/> From 62765e620e7358fb0c877a5cd5ccc106a468fa47 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:07:13 +0100 Subject: [PATCH 34/80] style(player): load the prototype's actual DM Sans and IBM Plex Mono families --- src/styles/throughline.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index 245ba33b..ef026a55 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -1,3 +1,5 @@ +@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap"); + /* All tokens are local to the player; host themes and CSS remain untouched. */ .thl { --thl-bg: light-dark(oklch(0.985 0 0), oklch(0.145 0 0)); From 40dc2afc0dd94d5fb21263193a6f98064b66f7df Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:08:27 +0100 Subject: [PATCH 35/80] fix(player): restrict all prototype selectors and reduced-motion styles to public player only --- src/styles/throughline.css | 634 ++++++++++++++++++------------------- 1 file changed, 317 insertions(+), 317 deletions(-) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index ef026a55..ac160ca1 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -1179,7 +1179,7 @@ flex: 1; }.thl.player-shell:fullscreen .canvas{ min-height: 0; -}.thl .player-header{ +}.thl.player-shell .player-header{ height: 40px; display: flex; justify-content: space-between; @@ -1187,18 +1187,18 @@ padding: 0 8px 0 14px; border-bottom: 1px solid var(--line); background: var(--thl-panel); -}.thl .title-block, -.thl .header-actions, -.thl .title-block > div:last-child{ +}.thl.player-shell .title-block, +.thl.player-shell .header-actions, +.thl.player-shell .title-block > div:last-child{ display: flex; align-items: center; -}.thl .title-block{ +}.thl.player-shell .title-block{ gap: 11px; min-width: 0; -}.thl .title-block > div:last-child{ +}.thl.player-shell .title-block > div:last-child{ display: block; min-width: 0; -}.thl .engine-mark{ +}.thl.player-shell .engine-mark{ width: 27px; height: 27px; display: grid; @@ -1207,23 +1207,23 @@ background: var(--acid); border-radius: var(--radius); box-shadow: 0 0 20px color-mix(in srgb, var(--thl-active) 12%, transparent); -}.thl .title-block h1{ +}.thl.player-shell .title-block h1{ margin: 0; font-size: 14px; line-height: 1.2; letter-spacing: -0.01em; font-weight: 600; -}.thl .title-block p{ +}.thl.player-shell .title-block p{ margin: 4px 0 0; color: var(--muted); font: 400 10px/1 "IBM Plex Mono", monospace; -}.thl .title-block p span{ +}.thl.player-shell .title-block p span{ color: var(--acid); -}.thl .header-actions{ +}.thl.player-shell .header-actions{ gap: 5px; -}.thl .header-actions button{ +}.thl.player-shell .header-actions button{ height: 26px; min-width: 26px; padding: 0 8px; @@ -1237,19 +1237,19 @@ color: var(--thl-muted); font-size: 11px; cursor: pointer; -}.thl .header-actions button:hover, -.thl .header-actions button.active{ +}.thl.player-shell .header-actions button:hover, +.thl.player-shell .header-actions button.active{ color: var(--ink); background: var(--thl-surface); border-color: var(--thl-line); -}.thl .compiled-status{ +}.thl.player-shell .compiled-status{ margin-right: 7px; color: var(--thl-muted); font: 500 9px/1 "IBM Plex Mono", monospace; letter-spacing: 0.08em; -}.thl .compiled-status i{ +}.thl.player-shell .compiled-status i{ display: inline-block; width: 5px; height: 5px; @@ -1257,7 +1257,7 @@ border-radius: 50%; background: var(--acid); box-shadow: 0 0 8px var(--acid); -}.thl .context-bar{ +}.thl.player-shell .context-bar{ min-height: 28px; padding: 0 14px 0 18px; display: flex; @@ -1265,11 +1265,11 @@ justify-content: space-between; border-bottom: 1px solid var(--line); background: var(--thl-bg); -}.thl .view-tabs{ +}.thl.player-shell .view-tabs{ align-self: stretch; display: flex; gap: 2px; -}.thl .view-tabs button{ +}.thl.player-shell .view-tabs button{ position: relative; padding: 0 11px; border: 0; @@ -1279,11 +1279,11 @@ 500 10px/1 "IBM Plex Mono", monospace; cursor: pointer; -}.thl .view-tabs button:hover{ +}.thl.player-shell .view-tabs button:hover{ color: var(--thl-text); -}.thl .view-tabs button.active{ +}.thl.player-shell .view-tabs button.active{ color: var(--ink); -}.thl .view-tabs button.active::after{ +}.thl.player-shell .view-tabs button.active::after{ content: ""; position: absolute; left: 10px; @@ -1291,32 +1291,32 @@ bottom: -1px; height: 1px; background: var(--acid); -}.thl .truth-note{ +}.thl.player-shell .truth-note{ color: var(--thl-muted); font: 400 9px/1 "IBM Plex Mono", monospace; -}.thl .truth-note span{ +}.thl.player-shell .truth-note span{ color: var(--thl-muted); -}.thl .truth-note i{ +}.thl.player-shell .truth-note i{ display: inline-block; width: 2px; height: 2px; margin: 0 7px 2px; background: var(--thl-muted); -}.thl .player-content{ +}.thl.player-shell .player-content{ display: grid; grid-template-columns: minmax(0, 1fr); min-height: 330px; -}.thl .player-content.with-inspector{ +}.thl.player-shell .player-content.with-inspector{ grid-template-columns: minmax(0, 1fr) 246px; -}.thl .canvas{ +}.thl.player-shell .canvas{ min-width: 0; min-height: 330px; position: relative; background: var(--thl-bg); overflow: hidden; -}.thl .canvas::before{ +}.thl.player-shell .canvas::before{ content: ""; position: absolute; inset: 0; @@ -1324,7 +1324,7 @@ opacity: 0.25; background-image: radial-gradient(var(--thl-line) 0.6px, transparent 0.6px); background-size: 15px 15px; -}.thl .canvas-meta{ +}.thl.player-shell .canvas-meta{ position: absolute; top: 10px; left: 14px; @@ -1336,41 +1336,41 @@ font: 500 9px/1 "IBM Plex Mono", monospace; -}.thl .canvas-meta span{ +}.thl.player-shell .canvas-meta span{ color: var(--thl-muted); -}.thl .canvas-meta strong{ +}.thl.player-shell .canvas-meta strong{ color: var(--thl-muted); font-weight: 500; -}.thl .canvas-meta code{ +}.thl.player-shell .canvas-meta code{ margin-left: auto; color: var(--acid); font-size: 9px; -}.thl .graph-wrap{ +}.thl.player-shell .graph-wrap{ position: absolute; inset: 30px 0 0; -}.thl .graph{ +}.thl.player-shell .graph{ width: 100%; height: calc(100% - 20px); overflow: visible; color: var(--thl-muted); -}.thl .group-frame rect{ +}.thl.player-shell .group-frame rect{ fill: color-mix(in srgb, var(--thl-text) 1%, transparent); stroke: var(--thl-surface); stroke-dasharray: 3 4; rx: 2px; -}.thl .group-frame text{ +}.thl.player-shell .group-frame text{ fill: var(--thl-muted); font: 500 8px "IBM Plex Mono", monospace; letter-spacing: 0.09em; -}.thl .links path{ +}.thl.player-shell .links path{ fill: none; stroke: var(--thl-line); stroke-width: 1.2; -}.thl .links path.visited{ +}.thl.player-shell .links path.visited{ stroke: var(--thl-muted); -}.thl .links path.hot{ +}.thl.player-shell .links path.hot{ stroke: var(--acid); stroke-width: 1.7; stroke-dasharray: 5 4; @@ -1382,41 +1382,41 @@ to { stroke-dashoffset: -9; } -}.thl .entity{ +}.thl.player-shell .entity{ cursor: pointer; -}.thl .entity rect{ +}.thl.player-shell .entity rect{ fill: var(--thl-panel); stroke: var(--thl-line); rx: 2px; transition: 0.15s ease; -}.thl .entity:hover rect{ +}.thl.player-shell .entity:hover rect{ fill: var(--thl-surface); stroke: var(--thl-muted); -}.thl .entity circle{ +}.thl.player-shell .entity circle{ fill: var(--thl-muted); -}.thl .entity text{ +}.thl.player-shell .entity text{ pointer-events: none; -}.thl .entity-label{ +}.thl.player-shell .entity-label{ fill: var(--thl-text); font: 500 10px "DM Sans", sans-serif; -}.thl .entity-value{ +}.thl.player-shell .entity-value{ fill: var(--thl-muted); font: 400 8.5px "IBM Plex Mono", monospace; -}.thl .entity.active rect{ +}.thl.player-shell .entity.active rect{ stroke: var(--acid); fill: var(--thl-panel); -}.thl .entity.active circle{ +}.thl.player-shell .entity.active circle{ fill: var(--acid); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--thl-active) 60%, transparent)); -}.thl .entity.active .entity-value{ +}.thl.player-shell .entity.active .entity-value{ fill: var(--acid); -}.thl .entity.selected rect{ +}.thl.player-shell .entity.selected rect{ stroke-width: 2px; -}.thl .canvas-hint{ +}.thl.player-shell .canvas-hint{ position: absolute; left: 14px; right: 14px; @@ -1427,18 +1427,18 @@ font: 400 8px/1 "IBM Plex Mono", monospace; -}.thl .sequence-view, -.thl .state-view{ +}.thl.player-shell .sequence-view, +.thl.player-shell .state-view{ position: absolute; inset: 43px 14px 14px; -}.thl .sequence-view{ +}.thl.player-shell .sequence-view{ overflow: hidden; -}.thl .sequence-head{ +}.thl.player-shell .sequence-head{ height: 31px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); -}.thl .sequence-head span{ +}.thl.player-shell .sequence-head span{ display: grid; place-items: center; color: var(--thl-muted); @@ -1446,27 +1446,27 @@ font: 500 9px "IBM Plex Mono", monospace; -}.thl .sequence-head span:last-child{ +}.thl.player-shell .sequence-head span:last-child{ border: 0; -}.thl .lifelines{ +}.thl.player-shell .lifelines{ position: absolute; inset: 31px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); pointer-events: none; -}.thl .lifelines i{ +}.thl.player-shell .lifelines i{ width: 1px; height: 100%; justify-self: center; background: linear-gradient(var(--thl-line) 40%, transparent 40%); background-size: 1px 6px; -}.thl .sequence-list{ +}.thl.player-shell .sequence-list{ position: relative; z-index: 1; display: grid; gap: 5px; padding-top: 14px; -}.thl .sequence-event{ +}.thl.player-shell .sequence-event{ min-height: 35px; padding: 7px 10px; display: grid; @@ -1476,34 +1476,34 @@ border: 1px solid var(--thl-line); border-radius: var(--radius); font-size: 10px; -}.thl .sequence-event.current{ +}.thl.player-shell .sequence-event.current{ border-color: var(--acid); background: var(--thl-panel); -}.thl .sequence-event.future{ +}.thl.player-shell .sequence-event.future{ opacity: 0.28; -}.thl .seq-index{ +}.thl.player-shell .seq-index{ color: var(--thl-muted); font: 500 9px "IBM Plex Mono", monospace; -}.thl .seq-route{ +}.thl.player-shell .seq-route{ color: var(--thl-muted); -}.thl .seq-route b{ +}.thl.player-shell .seq-route b{ margin: 0 7px; color: var(--acid); font-weight: 400; -}.thl .sequence-event code{ +}.thl.player-shell .sequence-event code{ color: var(--thl-muted); font: 400 9px "IBM Plex Mono", monospace; -}.thl .sequence-event.current code{ +}.thl.player-shell .sequence-event.current code{ color: var(--acid); -}.thl .state-view{ +}.thl.player-shell .state-view{ border: 1px solid var(--line); overflow: auto; background: color-mix(in srgb, var(--thl-panel) 95%, transparent); -}.thl .state-row{ +}.thl.player-shell .state-row{ width: 100%; min-height: 39px; padding: 0 12px; @@ -1516,11 +1516,11 @@ color: var(--thl-muted); text-align: left; font-size: 10px; -}.thl button.state-row{ +}.thl.player-shell button.state-row{ cursor: pointer; -}.thl button.state-row:hover{ +}.thl.player-shell button.state-row:hover{ background: var(--thl-panel); -}.thl .state-header{ +}.thl.player-shell .state-header{ min-height: 30px; color: var(--thl-muted); background: var(--thl-panel); @@ -1528,22 +1528,22 @@ 500 8px "IBM Plex Mono", monospace; letter-spacing: 0.05em; -}.thl .state-row strong{ +}.thl.player-shell .state-row strong{ color: var(--thl-text); font-weight: 500; -}.thl .state-row code{ +}.thl.player-shell .state-row code{ font: 400 9px "IBM Plex Mono", monospace; color: var(--thl-muted); -}.thl .state-row.changed{ +}.thl.player-shell .state-row.changed{ background: var(--thl-panel); box-shadow: 2px 0 0 var(--acid) inset; -}.thl .state-row.changed code:nth-child(3){ +}.thl.player-shell .state-row.changed code:nth-child(3){ color: var(--acid); -}.thl .state-row.future{ +}.thl.player-shell .state-row.future{ opacity: 0.3; -}.thl .inspector{ +}.thl.player-shell .inspector{ min-width: 0; border-left: 1px solid var(--line); background: var(--thl-panel); @@ -1555,7 +1555,7 @@ opacity: 0; transform: translateX(8px); } -}.thl .inspector-top{ +}.thl.player-shell .inspector-top{ display: flex; align-items: center; justify-content: space-between; @@ -1564,7 +1564,7 @@ 500 8px "IBM Plex Mono", monospace; letter-spacing: 0.08em; -}.thl .inspector-top button{ +}.thl.player-shell .inspector-top button{ width: 22px; height: 22px; border: 0; @@ -1572,42 +1572,42 @@ color: var(--thl-muted); font-size: 17px; cursor: pointer; -}.thl .entity-heading{ +}.thl.player-shell .entity-heading{ display: flex; gap: 9px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); -}.thl .entity-heading > i{ +}.thl.player-shell .entity-heading > i{ width: 7px; height: 7px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 9px color-mix(in srgb, var(--thl-active) 45%, transparent); -}.thl .entity-heading strong{ +}.thl.player-shell .entity-heading strong{ display: block; font-size: 12px; font-weight: 600; -}.thl .entity-heading code{ +}.thl.player-shell .entity-heading code{ display: block; margin-top: 4px; color: var(--thl-muted); font: 400 8px "IBM Plex Mono", monospace; -}.thl .inspector dl{ +}.thl.player-shell .inspector dl{ margin: 0; padding: 8px 0 11px; border-bottom: 1px solid var(--line); -}.thl .inspector dl > div{ +}.thl.player-shell .inspector dl > div{ min-height: 27px; display: grid; grid-template-columns: 80px 1fr; align-items: center; -}.thl .inspector dt{ +}.thl.player-shell .inspector dt{ color: var(--thl-muted); font-size: 9px; -}.thl .inspector dd{ +}.thl.player-shell .inspector dd{ margin: 0; color: var(--thl-text); font: @@ -1615,9 +1615,9 @@ monospace; overflow: hidden; text-overflow: ellipsis; -}.thl .known{ +}.thl.player-shell .known{ color: var(--acid); -}.thl .history-title{ +}.thl.player-shell .history-title{ display: flex; align-items: center; justify-content: space-between; @@ -1627,7 +1627,7 @@ 500 8px "IBM Plex Mono", monospace; letter-spacing: 0.06em; -}.thl .history-title b{ +}.thl.player-shell .history-title b{ min-width: 16px; height: 16px; display: grid; @@ -1636,29 +1636,29 @@ color: var(--thl-muted); border-radius: var(--radius); font-size: 8px; -}.thl .history-item{ +}.thl.player-shell .history-item{ display: flex; gap: 8px; padding-bottom: 14px; -}.thl .history-item > i{ +}.thl.player-shell .history-item > i{ flex: 0 0 auto; width: 6px; height: 6px; margin-top: 4px; background: var(--orange); border-radius: 50%; -}.thl .history-item strong{ +}.thl.player-shell .history-item strong{ display: block; color: var(--thl-text); font: 500 9px "IBM Plex Mono", monospace; -}.thl .history-item span{ +}.thl.player-shell .history-item span{ display: block; margin: 4px 0 7px; color: var(--thl-muted); font-size: 8px; -}.thl .history-item code{ +}.thl.player-shell .history-item code{ display: block; padding: 7px; background: var(--thl-bg); @@ -1668,23 +1668,23 @@ monospace; white-space: normal; word-break: break-all; -}.thl .evidence-note{ +}.thl.player-shell .evidence-note{ margin-top: 8px; padding: 9px; border-left: 1px solid var(--orange); background: var(--thl-panel); -}.thl .evidence-note span{ +}.thl.player-shell .evidence-note span{ color: var(--orange); font: 500 7px "IBM Plex Mono", monospace; letter-spacing: 0.08em; -}.thl .evidence-note p{ +}.thl.player-shell .evidence-note p{ margin: 6px 0 0; color: var(--thl-muted); font-size: 8px; line-height: 1.45; -}.thl .step-caption{ +}.thl.player-shell .step-caption{ min-height: 67px; padding: 10px 16px; display: grid; @@ -1693,22 +1693,22 @@ gap: 10px; border-top: 1px solid var(--line); background: var(--thl-panel); -}.thl .step-number{ +}.thl.player-shell .step-number{ color: var(--acid); font: 500 10px "IBM Plex Mono", monospace; -}.thl .step-caption strong{ +}.thl.player-shell .step-caption strong{ display: block; color: var(--thl-text); font-size: 11px; font-weight: 600; -}.thl .step-caption p{ +}.thl.player-shell .step-caption p{ margin: 4px 0 0; color: var(--thl-muted); font-size: 9px; line-height: 1.35; -}.thl .event-chip{ +}.thl.player-shell .event-chip{ padding: 5px 7px; border: 1px solid var(--thl-line); border-radius: var(--radius); @@ -1717,11 +1717,11 @@ font: 500 8px "IBM Plex Mono", monospace; -}.thl .event-chip.write{ +}.thl.player-shell .event-chip.write{ color: var(--orange); border-color: var(--thl-change); background: var(--thl-panel); -}.thl .transport{ +}.thl.player-shell .transport{ height: 46px; padding: 0 14px; display: grid; @@ -1730,11 +1730,11 @@ gap: 18px; border-top: 1px solid var(--line); background: var(--thl-bg); -}.thl .transport-buttons{ +}.thl.player-shell .transport-buttons{ display: flex; gap: 4px; -}.thl .transport-buttons button, -.thl .speed{ +}.thl.player-shell .transport-buttons button, +.thl.player-shell .speed{ width: 29px; height: 29px; display: grid; @@ -1745,43 +1745,43 @@ background: var(--thl-panel); color: var(--thl-muted); cursor: pointer; -}.thl .transport-buttons button:hover:not(:disabled), -.thl .speed:hover{ +}.thl.player-shell .transport-buttons button:hover:not(:disabled), +.thl.player-shell .speed:hover{ color: var(--ink); border-color: var(--thl-muted); background: var(--thl-surface); -}.thl .transport-buttons button:disabled{ +}.thl.player-shell .transport-buttons button:disabled{ opacity: 0.28; cursor: default; -}.thl .transport-buttons .play{ +}.thl.player-shell .transport-buttons .play{ width: 34px; color: var(--thl-bg); background: var(--acid); border-color: var(--acid); -}.thl .transport-buttons .play:hover{ +}.thl.player-shell .transport-buttons .play:hover{ color: var(--thl-bg); background: color-mix(in oklch, var(--thl-active) 83%, var(--thl-text)); border-color: color-mix(in oklch, var(--thl-active) 83%, var(--thl-text)); -}.thl .timeline{ +}.thl.player-shell .timeline{ position: relative; height: 29px; -}.thl .timeline-line{ +}.thl.player-shell .timeline-line{ position: absolute; top: 7px; left: 8px; right: 8px; height: 1px; background: var(--thl-line); -}.thl .timeline-progress{ +}.thl.player-shell .timeline-progress{ height: 1px; background: var(--acid); box-shadow: 0 0 5px color-mix(in srgb, var(--thl-active) 35%, transparent); -}.thl .timeline-marks{ +}.thl.player-shell .timeline-marks{ height: 100%; display: flex; justify-content: space-between; position: relative; -}.thl .timeline-marks button{ +}.thl.player-shell .timeline-marks button{ width: 17px; padding: 0; border: 0; @@ -1791,7 +1791,7 @@ font: 400 7px "IBM Plex Mono", monospace; -}.thl .timeline-marks i{ +}.thl.player-shell .timeline-marks i{ display: block; width: 5px; height: 5px; @@ -1799,10 +1799,10 @@ border: 1px solid var(--thl-muted); border-radius: 50%; background: var(--thl-bg); -}.thl .timeline-marks button.passed i{ +}.thl.player-shell .timeline-marks button.passed i{ border-color: var(--acid); background: var(--acid); -}.thl .timeline-marks button.current i{ +}.thl.player-shell .timeline-marks button.current i{ width: 9px; height: 9px; margin-top: 3px; @@ -1810,9 +1810,9 @@ box-shadow: 0 0 0 3px color-mix(in srgb, var(--thl-active) 10%, transparent), 0 0 8px color-mix(in srgb, var(--thl-active) 40%, transparent); -}.thl .timeline-marks button.current{ +}.thl.player-shell .timeline-marks button.current{ color: var(--thl-muted); -}.thl .transport-meta{ +}.thl.player-shell .transport-meta{ display: flex; align-items: center; gap: 10px; @@ -1820,10 +1820,10 @@ font: 400 9px "IBM Plex Mono", monospace; -}.thl .transport-meta strong{ +}.thl.player-shell .transport-meta strong{ color: var(--thl-text); font-weight: 500; -}.thl .speed{ +}.thl.player-shell .speed{ width: 43px; display: flex; justify-content: center; @@ -1831,16 +1831,16 @@ font: 500 9px "IBM Plex Mono", monospace; -}.thl .footnote{ +}.thl.player-shell .footnote{ margin-top: 12px; text-align: center; color: var(--thl-muted); font: 400 8px "IBM Plex Mono", monospace; -}.thl .footnote span{ +}.thl.player-shell .footnote span{ color: var(--thl-muted); -}.thl .footnote i{ +}.thl.player-shell .footnote i{ display: inline-block; width: 2px; height: 2px; @@ -1848,16 +1848,16 @@ background: var(--thl-line); } -@container (max-width: 760px) {.thl main{ +@container (max-width: 760px) {.thl.player-shell main{ padding: 20px 10px; place-items: start center; - }.thl .compiled-status, -.thl .truth-note, -.thl .header-actions button span{ + }.thl.player-shell .compiled-status, +.thl.player-shell .truth-note, +.thl.player-shell .header-actions button span{ display: none; - }.thl .player-content.with-inspector{ + }.thl.player-shell .player-content.with-inspector{ grid-template-columns: 1fr; - }.thl .inspector{ + }.thl.player-shell .inspector{ position: absolute; z-index: 10; right: 0; @@ -1865,74 +1865,74 @@ bottom: 0; width: min(270px, 86%); box-shadow: -20px 0 40px rgba(0, 0, 0, 0.4); - }.thl .player-content{ + }.thl.player-shell .player-content{ position: relative; min-height: 310px; - }.thl .canvas{ + }.thl.player-shell .canvas{ min-height: 310px; - }.thl .graph{ + }.thl.player-shell .graph{ min-width: 680px; transform: translateX(-35px); - }.thl .sequence-event{ + }.thl.player-shell .sequence-event{ grid-template-columns: 22px 1fr; - }.thl .sequence-event code{ + }.thl.player-shell .sequence-event code{ display: none; - }.thl .state-row{ + }.thl.player-shell .state-row{ grid-template-columns: 1fr 1fr 1.5fr; - }.thl .state-row > :last-child{ + }.thl.player-shell .state-row > :last-child{ display: none; - }.thl .transport{ + }.thl.player-shell .transport{ grid-template-columns: auto 1fr; gap: 10px; - }.thl .transport-meta{ + }.thl.player-shell .transport-meta{ display: none; - }.thl .step-caption{ + }.thl.player-shell .step-caption{ grid-template-columns: 25px 1fr; - }.thl .event-chip{ + }.thl.player-shell .event-chip{ display: none; } } -@container (max-width: 480px) {.thl .eyebrow, -.thl .footnote{ +@container (max-width: 480px) {.thl.player-shell .eyebrow, +.thl.player-shell .footnote{ display: none; - }.thl .player-header{ + }.thl.player-shell .player-header{ padding-left: 12px; - }.thl .context-bar{ + }.thl.player-shell .context-bar{ padding-left: 8px; - }.thl .player-content, -.thl .canvas{ + }.thl.player-shell .player-content, +.thl.player-shell .canvas{ min-height: 292px; - }.thl .graph-wrap{ + }.thl.player-shell .graph-wrap{ overflow-x: auto; - }.thl .graph{ + }.thl.player-shell .graph{ width: 680px; transform: none; - }.thl .canvas-meta code{ + }.thl.player-shell .canvas-meta code{ display: none; - }.thl .step-caption p{ + }.thl.player-shell .step-caption p{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - }.thl .transport{ + }.thl.player-shell .transport{ padding: 0 8px; - }.thl .timeline-marks button span{ + }.thl.player-shell .timeline-marks button span{ display: none; } } -@media (prefers-reduced-motion: reduce) {.thl *, -.thl *::before, -.thl *::after{ +@media (prefers-reduced-motion: reduce) {.thl.player-shell *, +.thl.player-shell *::before, +.thl.player-shell *::after{ animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } -}.thl .title-block h1{ +}.thl.player-shell .title-block h1{ font-size: 13px; -}.thl .view-tabs button{ +}.thl.player-shell .view-tabs button{ padding: 0 10px; -}.thl .scrubber{ +}.thl.player-shell .scrubber{ -webkit-appearance: none; appearance: none; width: 100%; @@ -1940,17 +1940,17 @@ margin: 0; background: transparent; cursor: pointer; -}.thl .scrubber::-webkit-slider-runnable-track{ +}.thl.player-shell .scrubber::-webkit-slider-runnable-track{ height: 2px; border-radius: var(--radius); background: linear-gradient(90deg, var(--acid) var(--p), var(--thl-line) var(--p)); -}.thl .scrubber::-moz-range-track{ +}.thl.player-shell .scrubber::-moz-range-track{ height: 2px; background: var(--thl-line); -}.thl .scrubber::-moz-range-progress{ +}.thl.player-shell .scrubber::-moz-range-progress{ height: 2px; background: var(--acid); -}.thl .scrubber::-webkit-slider-thumb{ +}.thl.player-shell .scrubber::-webkit-slider-thumb{ -webkit-appearance: none; width: 8px; height: 12px; @@ -1958,13 +1958,13 @@ border-radius: var(--radius); background: var(--ink); border: 0; -}.thl .scrubber::-moz-range-thumb{ +}.thl.player-shell .scrubber::-moz-range-thumb{ width: 8px; height: 12px; border-radius: var(--radius); background: var(--ink); border: 0; -}.thl .sr-only{ +}.thl.player-shell .sr-only{ position: absolute; width: 1px; height: 1px; @@ -1977,14 +1977,14 @@ overflow: visible; }.thl.player-shell:fullscreen{ overflow: auto; -}.thl .narration-error{ +}.thl.player-shell .narration-error{ margin: 0; padding: 6px 14px; color: var(--orange); background: var(--thl-panel); border-bottom: 1px solid var(--thl-change); font: 400 10px "IBM Plex Mono", monospace; -}.thl .chapter-pill{ +}.thl.player-shell .chapter-pill{ margin-left: 10px; padding: 3px 7px; border: 1px solid var(--thl-line); @@ -1993,18 +1993,18 @@ background: var(--thl-panel); font: 500 9px/1 "IBM Plex Mono", monospace; white-space: nowrap; -}.thl .title-block{ +}.thl.player-shell .title-block{ display: flex; align-items: center; -}.thl .title-block h1{ +}.thl.player-shell .title-block h1{ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -}.thl .menu-anchor{ +}.thl.player-shell .menu-anchor{ position: relative; -}.thl .header-actions .menu-trigger{ +}.thl.player-shell .header-actions .menu-trigger{ gap: 6px; -}.thl .options-menu{ +}.thl.player-shell .options-menu{ position: absolute; z-index: 40; top: calc(100% + 8px); @@ -2025,13 +2025,13 @@ opacity: 0; transform: translateY(-4px) scale(0.985); } -}.thl .options-menu section{ +}.thl.player-shell .options-menu section{ padding: 10px 12px 12px; display: grid; gap: 8px; -}.thl .options-menu section + section{ +}.thl.player-shell .options-menu section + section{ border-top: 1px solid var(--line); -}.thl .opt-label{ +}.thl.player-shell .opt-label{ margin: 0; display: flex; align-items: center; @@ -2040,47 +2040,47 @@ font: 500 8px/1 "IBM Plex Mono", monospace; letter-spacing: 0.1em; text-transform: uppercase; -}.thl .opt-label em{ +}.thl.player-shell .opt-label em{ color: var(--thl-muted); font-style: normal; letter-spacing: 0.04em; text-transform: none; -}.thl .opt-fieldset{ +}.thl.player-shell .opt-fieldset{ min-width: 0; margin: 0; padding: 0; border: 0; display: grid; gap: 8px; -}.thl .opt-fieldset:disabled{ +}.thl.player-shell .opt-fieldset:disabled{ opacity: 0.35; -}.thl .opt-field{ +}.thl.player-shell .opt-field{ min-width: 0; flex: 1; display: grid; gap: 4px; -}.thl .opt-field label{ +}.thl.player-shell .opt-field label{ color: var(--thl-muted); font-size: 10px; -}.thl .opt-row{ +}.thl.player-shell .opt-row{ display: flex; align-items: flex-end; gap: 6px; -}.thl .opt-select{ +}.thl.player-shell .opt-select{ position: relative; display: block; min-width: 0; color: var(--thl-muted); -}.thl .opt-select.grow{ +}.thl.player-shell .opt-select.grow{ flex: 1; -}.thl .opt-select svg{ +}.thl.player-shell .opt-select svg{ position: absolute; right: 7px; top: 50%; transform: translateY(-50%); pointer-events: none; -}.thl .options-menu select, -.thl .options-menu input[type="number"]{ +}.thl.player-shell .options-menu select, +.thl.player-shell .options-menu input[type="number"]{ width: 100%; height: 28px; padding: 0 24px 0 8px; @@ -2091,15 +2091,15 @@ font: 400 11px "DM Sans", sans-serif; appearance: none; outline: none; -}.thl .options-menu input[type="number"]{ +}.thl.player-shell .options-menu input[type="number"]{ padding-right: 8px; font-family: "IBM Plex Mono", monospace; -}.thl .options-menu select:hover, -.thl .options-menu input:hover, -.thl .options-menu select:focus-visible, -.thl .options-menu input:focus-visible{ +}.thl.player-shell .options-menu select:hover, +.thl.player-shell .options-menu input:hover, +.thl.player-shell .options-menu select:focus-visible, +.thl.player-shell .options-menu input:focus-visible{ border-color: var(--thl-muted); -}.thl .options-menu select:disabled{ +}.thl.player-shell .options-menu select:disabled{ cursor: default; }.thl.player-shell .options-menu button{ height: 28px; @@ -2129,14 +2129,14 @@ flex: 0 0 auto; }.thl.player-shell .options-menu .opt-go{ padding: 0 12px; -}.thl .opt-grid{ +}.thl.player-shell .opt-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }.thl.player-shell .options-menu .opt-toggle{ justify-content: flex-start; min-width: 0; -}.thl .opt-toggle span{ +}.thl.player-shell .opt-toggle span{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -2144,18 +2144,18 @@ color: var(--acid); border-color: var(--thl-trail); background: var(--thl-panel); -}.thl .group-nav{ +}.thl.player-shell .group-nav{ display: flex; align-items: center; gap: 6px; -}.thl .crumb{ +}.thl.player-shell .crumb{ color: var(--thl-muted); font: 400 9px "IBM Plex Mono", monospace; white-space: nowrap; max-width: 70px; overflow: hidden; text-overflow: ellipsis; -}.thl .speed-seg{ +}.thl.player-shell .speed-seg{ display: grid; grid-template-columns: repeat(3, 1fr); padding: 2px; @@ -2171,27 +2171,27 @@ }.thl.player-shell .options-menu .speed-seg button.on{ background: var(--thl-surface); color: var(--acid); -}.thl .graph{ +}.thl.player-shell .graph{ width: 100%; min-width: 0; transform: none; cursor: grab; touch-action: none; outline-offset: -2px; -}.thl .graph:active{ +}.thl.player-shell .graph:active{ cursor: grabbing; -}.thl .graph-wrap{ +}.thl.player-shell .graph-wrap{ overflow: hidden; -}.thl .entity.summary rect{ +}.thl.player-shell .entity.summary rect{ stroke-dasharray: 3 3; -}.thl .group-frame g.collapsed rect{ +}.thl.player-shell .group-frame g.collapsed rect{ opacity: 0.4; -}.thl .canvas-hint{ +}.thl.player-shell .canvas-hint{ align-items: center; bottom: 6px; -}.thl .canvas-hint > span{ +}.thl.player-shell .canvas-hint > span{ pointer-events: none; -}.thl .zoom-tools{ +}.thl.player-shell .zoom-tools{ display: flex; align-items: center; gap: 3px; @@ -2199,7 +2199,7 @@ border: 1px solid var(--thl-line); border-radius: var(--radius); background: color-mix(in srgb, var(--thl-panel) 90%, transparent); -}.thl .zoom-tools button{ +}.thl.player-shell .zoom-tools button{ width: 22px; height: 20px; display: grid; @@ -2209,47 +2209,47 @@ background: transparent; color: var(--thl-muted); cursor: pointer; -}.thl .zoom-tools button:hover:not(:disabled){ +}.thl.player-shell .zoom-tools button:hover:not(:disabled){ color: var(--ink); background: var(--thl-surface); -}.thl .zoom-tools button:disabled{ +}.thl.player-shell .zoom-tools button:disabled{ opacity: 0.3; cursor: default; -}.thl .zoom-readout{ +}.thl.player-shell .zoom-readout{ min-width: 32px; text-align: center; color: var(--thl-muted); font: 500 8px "IBM Plex Mono", monospace; -}.thl .history-empty{ +}.thl.player-shell .history-empty{ margin: 0 0 12px; color: var(--thl-muted); font-size: 9px; -}.thl .transport{ +}.thl.player-shell .transport{ grid-template-columns: auto minmax(0, 1fr) auto; -}.thl .progress{ +}.thl.player-shell .progress{ display: flex; gap: 3px; align-items: center; -}.thl .progress i{ +}.thl.player-shell .progress i{ flex: 1; height: 2px; border-radius: 1px; background: var(--thl-line); transition: background 0.2s ease; -}.thl .progress i.past{ +}.thl.player-shell .progress i.past{ background: var(--thl-trail); -}.thl .progress i.now{ +}.thl.player-shell .progress i.now{ height: 3px; background: var(--acid); box-shadow: 0 0 6px color-mix(in srgb, var(--thl-active) 45%, transparent); -}.thl .step-caption{ +}.thl.player-shell .step-caption{ display: block; min-height: 0; padding: 0; border-top: 1px solid var(--line); background: var(--thl-panel); border-radius: 0 0 var(--radius) var(--radius); -}.thl .step-caption > summary{ +}.thl.player-shell .step-caption > summary{ list-style: none; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto auto; @@ -2258,18 +2258,18 @@ padding: 9px 14px; cursor: pointer; user-select: none; -}.thl .step-caption > summary::-webkit-details-marker{ +}.thl.player-shell .step-caption > summary::-webkit-details-marker{ display: none; -}.thl .step-caption > summary:hover{ +}.thl.player-shell .step-caption > summary:hover{ background: var(--thl-surface); -}.thl .caption-text{ +}.thl.player-shell .caption-text{ min-width: 0; -}.thl .caption-text strong{ +}.thl.player-shell .caption-text strong{ display: block; color: var(--thl-text); font-size: 11.5px; font-weight: 600; -}.thl .caption-text .teaser{ +}.thl.player-shell .caption-text .teaser{ display: block; margin-top: 3px; color: var(--thl-muted); @@ -2277,19 +2277,19 @@ white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -}.thl .step-caption[open] .teaser{ +}.thl.player-shell .step-caption[open] .teaser{ display: none; -}.thl .caption-expand{ +}.thl.player-shell .caption-expand{ display: inline-flex; align-items: center; gap: 3px; color: var(--thl-muted); font: 500 9px "IBM Plex Mono", monospace; -}.thl .caption-expand svg{ +}.thl.player-shell .caption-expand svg{ transition: transform 0.18s ease; -}.thl .step-caption[open] .caption-expand svg{ +}.thl.player-shell .step-caption[open] .caption-expand svg{ transform: rotate(180deg); -}.thl .caption-body{ +}.thl.player-shell .caption-body{ display: grid; gap: 10px; max-height: 240px; @@ -2302,19 +2302,19 @@ opacity: 0; transform: translateY(-4px); } -}.thl .caption-note{ +}.thl.player-shell .caption-note{ margin: 0; color: var(--thl-muted); font-size: 11px; line-height: 1.5; -}.thl .transfers{ +}.thl.player-shell .transfers{ margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; -}.thl .transfers li{ +}.thl.player-shell .transfers li{ display: inline-flex; align-items: center; gap: 6px; @@ -2324,74 +2324,74 @@ background: var(--thl-panel); color: var(--thl-muted); font-size: 10px; -}.thl .transfers b{ +}.thl.player-shell .transfers b{ color: var(--acid); font-weight: 500; -}.thl .transfers code{ +}.thl.player-shell .transfers code{ color: var(--orange); font: 400 9px "IBM Plex Mono", monospace; -}.thl .guidance{ +}.thl.player-shell .guidance{ display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; -}.thl .chapter-card, -.thl .causal-card{ +}.thl.player-shell .chapter-card, +.thl.player-shell .causal-card{ padding: 9px 10px; border-left: 1px solid var(--acid); background: var(--thl-panel); -}.thl .causal-card{ +}.thl.player-shell .causal-card{ border-left-color: var(--orange); background: var(--thl-panel); -}.thl .chapter-card > span, -.thl .causal-card > span{ +}.thl.player-shell .chapter-card > span, +.thl.player-shell .causal-card > span{ display: block; margin-bottom: 5px; color: var(--acid); font: 500 7px "IBM Plex Mono", monospace; letter-spacing: 0.1em; -}.thl .causal-card > span{ +}.thl.player-shell .causal-card > span{ color: var(--orange); -}.thl .chapter-card strong, -.thl .causal-card strong{ +}.thl.player-shell .chapter-card strong, +.thl.player-shell .causal-card strong{ color: var(--thl-text); font-size: 11px; -}.thl .chapter-card p{ +}.thl.player-shell .chapter-card p{ margin: 4px 0 0; color: var(--thl-muted); font-size: 10px; line-height: 1.45; -}.thl .causal-card dl{ +}.thl.player-shell .causal-card dl{ margin: 8px 0 0; display: grid; gap: 5px; -}.thl .causal-card dl > div{ +}.thl.player-shell .causal-card dl > div{ display: grid; grid-template-columns: 82px 1fr; gap: 8px; -}.thl .causal-card dt{ +}.thl.player-shell .causal-card dt{ color: var(--thl-muted); font-size: 9px; -}.thl .causal-card dd{ +}.thl.player-shell .causal-card dd{ margin: 0; color: var(--thl-muted); font-size: 10px; line-height: 1.4; -}.thl .causal-card .evidence{ +}.thl.player-shell .causal-card .evidence{ margin: 8px 0 0; color: var(--thl-muted); font: 400 8.5px/1.45 "IBM Plex Mono", monospace; -}.thl .state-snapshot summary{ +}.thl.player-shell .state-snapshot summary{ color: var(--thl-muted); font: 500 9px "IBM Plex Mono", monospace; cursor: pointer; -}.thl .state-snapshot summary:hover{ +}.thl.player-shell .state-snapshot summary:hover{ color: var(--ink); -}.thl .state-snapshot dl{ +}.thl.player-shell .state-snapshot dl{ margin: 8px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; -}.thl .state-snapshot dl > div{ +}.thl.player-shell .state-snapshot dl > div{ display: flex; justify-content: space-between; gap: 8px; @@ -2399,16 +2399,16 @@ border-bottom: 1px solid var(--thl-surface); font-size: 10px; color: var(--thl-muted); -}.thl .state-snapshot dt span{ +}.thl.player-shell .state-snapshot dt span{ color: var(--thl-muted); -}.thl .state-snapshot dd{ +}.thl.player-shell .state-snapshot dd{ margin: 0; -}.thl .state-snapshot code{ +}.thl.player-shell .state-snapshot code{ color: var(--acid); font: 400 9px "IBM Plex Mono", monospace; } -@container (max-width: 760px) {.thl .options-menu{ +@container (max-width: 760px) {.thl.player-shell .options-menu{ position: fixed; top: auto; right: 12px; @@ -2416,38 +2416,38 @@ width: auto; bottom: 12px; max-height: 70vh; - }.thl .header-actions .menu-trigger span{ + }.thl.player-shell .header-actions .menu-trigger span{ display: none; - }.thl .chapter-pill{ + }.thl.player-shell .chapter-pill{ display: none; - }.thl .step-caption > summary{ + }.thl.player-shell .step-caption > summary{ grid-template-columns: 22px minmax(0, 1fr) auto; - }.thl .step-caption > summary .event-chip{ + }.thl.player-shell .step-caption > summary .event-chip{ display: none; - }.thl .caption-body{ + }.thl.player-shell .caption-body{ padding-left: 14px; - }.thl .transport{ + }.thl.player-shell .transport{ grid-template-columns: auto minmax(0, 1fr); - }.thl .canvas-hint > span{ + }.thl.player-shell .canvas-hint > span{ display: none; - }.thl .canvas-hint{ + }.thl.player-shell .canvas-hint{ justify-content: flex-end; } -}.thl .transport{ +}.thl.player-shell .transport{ display: flex; justify-content: space-between; -}.thl .sequence-view{ +}.thl.player-shell .sequence-view{ display: flex; flex-direction: column; overflow: hidden; inset: 40px 12px 12px; -}.thl .seq-scroll{ +}.thl.player-shell .seq-scroll{ flex: 1; min-height: 0; overflow-y: auto; border: 1px solid var(--line); background: color-mix(in srgb, var(--thl-panel) 90%, transparent); -}.thl .sequence-head{ +}.thl.player-shell .sequence-head{ position: sticky; top: 0; z-index: 3; @@ -2455,28 +2455,28 @@ border: 0; border-bottom: 1px solid var(--line); background: var(--thl-panel); -}.thl .seq-body{ +}.thl.player-shell .seq-body{ position: relative; -}.thl .lifelines{ +}.thl.player-shell .lifelines{ inset: 0; -}.thl .sequence-list{ +}.thl.player-shell .sequence-list{ margin: 0; padding: 6px 0 10px; list-style: none; gap: 0; -}.thl .seq-row{ +}.thl.player-shell .seq-row{ display: grid; grid-template-columns: repeat(4, 1fr); align-items: end; height: 42px; transition: opacity 0.2s ease; -}.thl .seq-row.future{ +}.thl.player-shell .seq-row.future{ opacity: 0.25; -}.thl .seq-line{ +}.thl.player-shell .seq-line{ position: relative; display: block; height: 100%; -}.thl .seq-label{ +}.thl.player-shell .seq-label{ position: absolute; left: 10px; right: 10px; @@ -2486,36 +2486,36 @@ gap: 6px; align-items: baseline; min-width: 0; -}.thl .seq-label b{ +}.thl.player-shell .seq-label b{ color: var(--thl-muted); font: 500 8px "IBM Plex Mono", monospace; -}.thl .seq-label code{ +}.thl.player-shell .seq-label code{ min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--thl-muted); font: 400 9px "IBM Plex Mono", monospace; -}.thl .seq-arrow{ +}.thl.player-shell .seq-arrow{ position: absolute; left: 0; right: 0; bottom: 8px; height: 1px; background: var(--thl-muted); -}.thl .seq-row.right .seq-arrow::after, -.thl .seq-row.left .seq-arrow::before{ +}.thl.player-shell .seq-row.right .seq-arrow::after, +.thl.player-shell .seq-row.left .seq-arrow::before{ content: ""; position: absolute; top: -3px; border: 3.5px solid transparent; -}.thl .seq-row.right .seq-arrow::after{ +}.thl.player-shell .seq-row.right .seq-arrow::after{ right: 0; border-left: 6px solid var(--thl-muted); -}.thl .seq-row.left .seq-arrow::before{ +}.thl.player-shell .seq-row.left .seq-arrow::before{ left: 0; border-right: 6px solid var(--thl-muted); -}.thl .seq-row.self .seq-arrow{ +}.thl.player-shell .seq-row.self .seq-arrow{ left: 0; right: auto; width: 7px; @@ -2523,88 +2523,88 @@ bottom: 5px; border-radius: 50%; background: var(--thl-muted); -}.thl .seq-row.self .seq-label{ +}.thl.player-shell .seq-row.self .seq-label{ left: 18px; right: 6px; justify-content: flex-start; -}.thl .seq-row.self.flip .seq-line{ +}.thl.player-shell .seq-row.self.flip .seq-line{ display: flex; justify-content: flex-end; -}.thl .seq-row.self.flip .seq-label{ +}.thl.player-shell .seq-row.self.flip .seq-label{ left: 6px; right: 18px; justify-content: flex-end; -}.thl .seq-row.self.flip .seq-arrow{ +}.thl.player-shell .seq-row.self.flip .seq-arrow{ left: auto; right: 0; -}.thl .seq-row.current .seq-arrow{ +}.thl.player-shell .seq-row.current .seq-arrow{ background: var(--acid); box-shadow: 0 0 6px color-mix(in srgb, var(--thl-active) 50%, transparent); -}.thl .seq-row.current.right .seq-arrow::after{ +}.thl.player-shell .seq-row.current.right .seq-arrow::after{ border-left-color: var(--acid); -}.thl .seq-row.current.left .seq-arrow::before{ +}.thl.player-shell .seq-row.current.left .seq-arrow::before{ border-right-color: var(--acid); -}.thl .seq-row.current .seq-label code, -.thl .seq-row.current .seq-label b{ +}.thl.player-shell .seq-row.current .seq-label code, +.thl.player-shell .seq-row.current .seq-label b{ color: var(--acid); -}.thl .seq-detail{ +}.thl.player-shell .seq-detail{ flex: 0 0 auto; display: flex; align-items: baseline; gap: 10px; padding: 8px 2px 0; min-height: 26px; -}.thl .seq-detail > span{ +}.thl.player-shell .seq-detail > span{ color: var(--acid); font: 500 8px "IBM Plex Mono", monospace; letter-spacing: 0.1em; -}.thl .seq-detail p{ +}.thl.player-shell .seq-detail p{ margin: 0; min-width: 0; color: var(--thl-muted); font-size: 10px; line-height: 1.4; -}.thl .seq-detail b{ +}.thl.player-shell .seq-detail b{ margin: 0 4px; color: var(--acid); font-weight: 400; -}.thl .seq-detail code{ +}.thl.player-shell .seq-detail code{ margin-left: 6px; color: var(--thl-muted); font: 400 9px "IBM Plex Mono", monospace; word-break: break-all; -}.thl .graph-wrap{ +}.thl.player-shell .graph-wrap{ overflow: hidden; } -@container (max-width: 760px) {.thl .transport{ +@container (max-width: 760px) {.thl.player-shell .transport{ display: flex; - }.thl .sequence-view{ + }.thl.player-shell .sequence-view{ inset: 36px 8px 8px; - }.thl .seq-label code{ + }.thl.player-shell .seq-label code{ font-size: 8px; - }.thl .seq-label b{ + }.thl.player-shell .seq-label b{ display: none; - }.thl .state-view{ + }.thl.player-shell .state-view{ inset: 36px 8px 8px; - }.thl .state-header{ + }.thl.player-shell .state-header{ display: none; - }.thl .state-row{ + }.thl.player-shell .state-row{ grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "entity value" "path origin"; row-gap: 3px; padding: 8px 12px; - }.thl .state-row > :last-child{ + }.thl.player-shell .state-row > :last-child{ display: block; - }.thl .state-row > :nth-child(1){ + }.thl.player-shell .state-row > :nth-child(1){ grid-area: entity; - }.thl .state-row > :nth-child(2){ + }.thl.player-shell .state-row > :nth-child(2){ grid-area: path; - }.thl .state-row > :nth-child(3){ + }.thl.player-shell .state-row > :nth-child(3){ grid-area: value; text-align: right; word-break: break-word; - }.thl .state-row > :nth-child(4){ + }.thl.player-shell .state-row > :nth-child(4){ grid-area: origin; text-align: right; color: var(--thl-muted); @@ -2617,7 +2617,7 @@ * UI geometry, spacing, typography and responsive behavior are ported from * 0xbuffdev/throughline-player. These aliases preserve the canonical palette: * no prototype green, orange or hard-coded dark-mode colours enter the package. - * All selectors remain underneath the public .thl root. + * All selectors remain underneath the public .thl.player-shell root. */ .thl.thl-v2.player-shell { --ink: var(--thl-text); From 1afabfec22ecc9244f5904a7850ddd21582c41f2 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:09:00 +0100 Subject: [PATCH 36/80] fix(player): restore prototype follow default when switching traces in mobile embeds --- src/react/graph-player.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 2f2677b2..b03aeeba 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -273,7 +273,7 @@ export function ThroughlineGraphPlayer({ if (followInitialized.current || !canvasRef.current) return; followInitialized.current = true; if (canvasRef.current.clientWidth < 640) setFollow(true); - }, [width]); + }, [width, trace]); const [narrating, setNarrating] = useState(false); const { state, dispatch, lastAction, seekRevision, onKeyDown } = usePlayer(trace, narration && narrating); From 68401cd13aff4b41872aeabe2f6796cb22843dbc Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:12:18 +0100 Subject: [PATCH 37/80] style(player): match prototype horizontal group-world geometry for schema-2 diagrams --- src/v2/graph-layout.ts | 115 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/src/v2/graph-layout.ts b/src/v2/graph-layout.ts index 606603d9..96e00600 100644 --- a/src/v2/graph-layout.ts +++ b/src/v2/graph-layout.ts @@ -20,7 +20,122 @@ const box = (x: number, y: number, w: number, h: number): Box => ({ x, y, w, h } const limitWidth = (width: number): number => Math.max(160, Number.isFinite(width) ? Math.floor(width) : 720); +/** + * The Figma player uses a stable horizontal group world (828×300 baseline), + * independent of the embed's viewport width. Keep that composition for the + * public player while allowing the existing narrow-width pure layout for + * consumers explicitly requesting a smaller geometry. + * + * This is layout only: identities, order, presence, message and value evidence + * always come from the compiled source. The world can extend vertically for + * larger or nested authored groups, rather than clipping a real entity. + */ +function prototypeWorld(trace: CompiledTrace, width: number): Layout { + const { artifact } = trace; + const groups = artifact.groups ?? []; + const byParent = new Map(); + const byGroup = new Map(); + for (const group of groups) { + const list = byParent.get(group.parentId) ?? []; + list.push(group.id); byParent.set(group.parentId, list); + } + for (const entity of artifact.entities) { + const list = byGroup.get(entity.groupId) ?? []; + list.push(entity.id); byGroup.set(entity.groupId, list); + } + const entityIndex = new Map(artifact.entities.map((e,i) => [e.id, "node_"+i] as const)); + const groupIndex = new Map(groups.map((g,i) => [g.id, "group_"+i] as const)); + const groupById = new Map(groups.map(g=>[g.id,g] as const)); + const nodes: Layout["nodes"] = Object.create(null); + const panels: Layout["groups"] = []; + const INNER = 16, GROUP_GAP = 30, ROW = 144; + const ownWidth = (id: Id): number => + Math.min(372, (byGroup.get(id)?.length ?? 0) > 2 ? 372 : 176); + const demand = (id: Id): number => { + const children = byParent.get(id) ?? []; + return Math.max(ownWidth(id), children.length + ? children.reduce((sum, child) => sum + demand(child), 0) + + (children.length-1)*GROUP_GAP+INNER*2 : 0); + }; + // Share excess world width across actual groups. This reproduces the + // original narrow processing/external lanes and wider request/order lane. + const widths = (ids: readonly Id[], budget: number): number[] => { + if (!ids.length) return []; + const natural = ids.map(demand); + const gap = GROUP_GAP*(ids.length-1); + const usable = Math.max(0,budget-gap); + const sum = natural.reduce((a,b)=>a+b,0); + if (sum<=usable) return natural.map(w=>w+(usable-sum)/ids.length); + const scale=usable/Math.max(sum,1); + return natural.map(w=>Math.max(116,Math.floor(w*scale))); + }; + const arrangeGroup = (id: Id, x: number, y: number, w: number): number => { + const g=groupById.get(id)!; + const panel: Layout["groups"][number] = { + id:groupIndex.get(id)!, name:g.label, + ...(g.parentId?{parentId:groupIndex.get(g.parentId)}:{}), + x, y, w, h:254, + }; + panels.push(panel); // parents paint before children even with unordered IDs + const members=byGroup.get(id) ?? []; + const cols=members.length>2 && w>=320 ? 2 : 1; + const rows=Math.ceil(members.length/cols); + const top=y+36; + for (const [index,entityId] of members.entries()) { + const col=index%cols, row=Math.floor(index/cols); + const px=cols===1 ? x+(w-116)/2 : + col===0 ? x+INNER : x+w-INNER-116; + nodes[entityIndex.get(entityId)!]=box(px,top+row*ROW,116,52); + } + const children=byParent.get(id) ?? []; + const childTop=top+(rows ? (rows-1)*ROW+52+30 : 0); + let childBottom=childTop; + if (children.length) { + const childWidths=widths(children,w-INNER*2); + let cx=x+INNER; + for (const [index,childId] of children.entries()) { + const cw=childWidths[index]; + childBottom=Math.max(childBottom,arrangeGroup(childId,cx,childTop,cw)); + cx+=cw+GROUP_GAP; + } + } + panel.h=Math.max(254, Math.max( + rows ? top+(rows-1)*ROW+52+22 : y+36, childBottom+18 + )-y); + const summaryWidth=Math.min(150,Math.max(116,w-16)); + nodes[groupIndex.get(id)!]=box(x+(w-summaryWidth)/2,y+36,summaryWidth,52); + return y+panel.h; + }; + const ROOT_X=18, ROOT_Y=30; + const roots=byParent.get(undefined) ?? []; + let bottom=ROOT_Y; + if (roots.length) { + const rootWidths=widths(roots,width-ROOT_X*2); + let x=ROOT_X; + for (const [index,id] of roots.entries()) { + bottom=Math.max(bottom,arrangeGroup(id,x,ROOT_Y,rootWidths[index])); + x+=rootWidths[index]+GROUP_GAP; + } + } + const ungrouped=byGroup.get(undefined) ?? []; + const start=roots.length ? bottom+30 : ROOT_Y+36; + const columns=Math.max(1,Math.floor((width-36+12)/128)); + for (const [index,id] of ungrouped.entries()) { + nodes[entityIndex.get(id)!]=box( + 18+(index%columns)*128,start+Math.floor(index/columns)*144,116,52); + } + if (ungrouped.length) + bottom=start+Math.ceil(ungrouped.length/columns)*144; + return { + width, height:Math.max(300,bottom+16), viewBox:"0 0 "+width+" "+Math.max(300,bottom+16), + groups:panels,nodes,edges:Object.create(null), + }; +} + export function layoutGraph(trace: CompiledTrace, availableWidth = 720): Layout { + if (availableWidth >= 828 && (trace.artifact.groups?.length ?? 0) > 0 && + trace.artifact.groups!.length <= 8 && trace.artifact.entities.length <= 24) + return prototypeWorld(trace, Math.floor(availableWidth)); const width = limitWidth(availableWidth); const groups = trace.artifact.groups ?? []; const byParent = new Map(); From dd1f84f5d6a611f57b6e82d735aca4849c523154 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:13:00 +0100 Subject: [PATCH 38/80] fix(player): keep prototype group panels 254px high without nested children --- src/v2/graph-layout.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v2/graph-layout.ts b/src/v2/graph-layout.ts index 96e00600..2117b4b2 100644 --- a/src/v2/graph-layout.ts +++ b/src/v2/graph-layout.ts @@ -89,7 +89,7 @@ function prototypeWorld(trace: CompiledTrace, width: number): Layout { } const children=byParent.get(id) ?? []; const childTop=top+(rows ? (rows-1)*ROW+52+30 : 0); - let childBottom=childTop; + let childBottom=y; if (children.length) { const childWidths=widths(children,w-INNER*2); let cx=x+INNER; From 97c27b6e30bcc4942924dae9867bb146be6e328c Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:13:02 +0100 Subject: [PATCH 39/80] style(player): keep fixed prototype graph world and mobile viewport framing --- src/react/graph-player.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index b03aeeba..8a3a7857 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -323,7 +323,10 @@ export function ThroughlineGraphPlayer({ // Never send the former trace's higher frame index into a new, shorter // immutable inspector while React completes that state transition. const frameIndex = Math.min(state.step, trace.frames.length - 1); - const layout = useMemo(() => layoutGraph(trace, width), [trace, width]); + // The prototype's graph is a stable, pannable 828-unit SVG world, even + // when the host is a narrow embed. Never reshuffle the authored diagram + // solely because the container changes width. + const layout = useMemo(() => layoutGraph(trace, 828), [trace]); const view = useMemo(() => projectView(inspector, { kind: viewKind, frameIndex, selectedEntityIds: selectedId ? [selectedId] : [], @@ -349,8 +352,18 @@ export function ThroughlineGraphPlayer({ layout.height / Math.max(1, focusBottom - focusTop), ))), } : null; + const firstVisible = frameIndex === 0 && view.kind === "graph" + ? view.items.find(item => item.role === "entity" && geometry.nodes[item.id]) + : undefined; + const firstBox = firstVisible && geometry.nodes[firstVisible.id]; + const mobileInitialCamera: Camera | null = firstBox && width < 640 ? { + centerX: firstBox.x + firstBox.w / 2, + centerY: firstBox.y + firstBox.h / 2, + zoom: 2.4, + } : null; const effectiveCamera = constrainCamera(layout, - follow && followedCamera ? followedCamera : camera ?? fitCamera(layout)); + follow ? followedCamera ?? mobileInitialCamera ?? camera ?? fitCamera(layout) + : camera ?? fitCamera(layout)); const presentEntities = new Set(inspector.stateAt(frameIndex).presentEntityIds); const selected = selectedId ? trace.artifact.entities.find(entity => entity.id === selectedId) From 67a98805b22ac5dcd76c5f17ed3a0d577c183cf6 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:20:11 +0100 Subject: [PATCH 40/80] refactor(player): name player-chrome.tsx for its production role --- src/react/player-chrome.tsx | 170 ++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 src/react/player-chrome.tsx diff --git a/src/react/player-chrome.tsx b/src/react/player-chrome.tsx new file mode 100644 index 00000000..9e63faa8 --- /dev/null +++ b/src/react/player-chrome.tsx @@ -0,0 +1,170 @@ +import { useEffect, useId, useRef, useState } from "react"; +import type * as React from "react"; +import { type SeekAction, type SeekState, SPEEDS, type Speed } from "../seek.js"; +import { PlayerIcon } from "./player-icons.js"; + +interface PlaybackProps { + state: SeekState; + dispatch: React.Dispatch; +} +interface PlayerOptionsProps extends PlaybackProps { + scenario: { id: string; title: string }; + chapterControls?: (onSeek: (step: number) => void) => React.ReactNode; + diagramControls?: React.ReactNode; + sound?: { enabled: boolean; available?: boolean; toggle: () => void }; + narration?: { enabled: boolean; available: boolean; toggle: () => void }; + inspection?: { enabled: boolean; toggle: () => void }; + fullscreen: { active: boolean; available: boolean; toggle: () => void }; +} + +/** Compact player transport, backed by Throughline's single reducer. */ +export function PlayerControls({ state, dispatch }: PlaybackProps): React.JSX.Element { + return <> +
    + + + +
    +
    + + {state.step + 1} / {state.max + 1} + + +
    + ; +} + +/** + * Anchored, dismissible player options. All content is native + * Throughline state; it does not import the demo's scenarios or chapters. + */ +export function PlayerOptions({ + state, dispatch, scenario, chapterControls, diagramControls, sound, narration, inspection, fullscreen, +}: PlayerOptionsProps): React.JSX.Element { + const id = useId(); + const [open, setOpen] = useState(false); + const menuRef = useRef(null); + const triggerRef = useRef(null); + const stepRef = useRef(null); + useEffect(() => { + if (!open) return; + if (stepRef.current) stepRef.current.value = String(state.step + 1); + const onPointer = (event: MouseEvent) => { + if (!menuRef.current?.contains(event.target as Node)) setOpen(false); + }; + const onKey = (event: KeyboardEvent) => { + if (event.key === "Escape") { setOpen(false); triggerRef.current?.focus(); } + }; + document.addEventListener("mousedown", onPointer); + document.addEventListener("keydown", onKey); + return () => { + document.removeEventListener("mousedown", onPointer); + document.removeEventListener("keydown", onKey); + }; + }, [open, state.step]); + const seek = (to: number) => { dispatch({ type: "step", to }); setOpen(false); }; + return
    + + {open &&
    +
    +

    Navigation

    +
    + + + + + +
    + {chapterControls ? chapterControls(seek) :
    +
    + + + + + +
    + +
    } + {state.max > 0 && { + event.preventDefault(); + const value = Number(new FormData(event.currentTarget).get("step")); + if (Number.isInteger(value) && value >= 1 && value <= state.max + 1) + seek(value - 1); + }}> +
    + + +
    + + } +
    + {diagramControls &&
    +

    Diagram

    +
    {diagramControls}
    +
    } +
    +

    Playback and display

    +
    + {SPEEDS.map(speed => )} +
    +
    + {sound && } + {narration && } + {inspection && } + +
    +
    +
    } +
    ; +} From c68b99a94232efd273e78ea166cef03bf7982246 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:20:13 +0100 Subject: [PATCH 41/80] refactor(player): remove temporary design-port filename prototype-controls.tsx --- src/react/prototype-controls.tsx | 170 ------------------------------- 1 file changed, 170 deletions(-) delete mode 100644 src/react/prototype-controls.tsx diff --git a/src/react/prototype-controls.tsx b/src/react/prototype-controls.tsx deleted file mode 100644 index e63f8958..00000000 --- a/src/react/prototype-controls.tsx +++ /dev/null @@ -1,170 +0,0 @@ -import { useEffect, useId, useRef, useState } from "react"; -import type * as React from "react"; -import { type SeekAction, type SeekState, SPEEDS, type Speed } from "../seek.js"; -import { PlayerIcon } from "./player-icons.js"; - -interface PlaybackProps { - state: SeekState; - dispatch: React.Dispatch; -} -interface PlayerOptionsProps extends PlaybackProps { - scenario: { id: string; title: string }; - chapterControls?: (onSeek: (step: number) => void) => React.ReactNode; - diagramControls?: React.ReactNode; - sound?: { enabled: boolean; available?: boolean; toggle: () => void }; - narration?: { enabled: boolean; available: boolean; toggle: () => void }; - inspection?: { enabled: boolean; toggle: () => void }; - fullscreen: { active: boolean; available: boolean; toggle: () => void }; -} - -/** The prototype's compact transport, backed by Throughline's single reducer. */ -export function PlayerControls({ state, dispatch }: PlaybackProps): React.JSX.Element { - return <> -
    - - - -
    -
    - - {state.step + 1} / {state.max + 1} - - -
    - ; -} - -/** - * Prototype's anchored, dismissible Options menu. All content is native - * Throughline state; it does not import the demo's scenarios or chapters. - */ -export function PlayerOptions({ - state, dispatch, scenario, chapterControls, diagramControls, sound, narration, inspection, fullscreen, -}: PlayerOptionsProps): React.JSX.Element { - const id = useId(); - const [open, setOpen] = useState(false); - const menuRef = useRef(null); - const triggerRef = useRef(null); - const stepRef = useRef(null); - useEffect(() => { - if (!open) return; - if (stepRef.current) stepRef.current.value = String(state.step + 1); - const onPointer = (event: MouseEvent) => { - if (!menuRef.current?.contains(event.target as Node)) setOpen(false); - }; - const onKey = (event: KeyboardEvent) => { - if (event.key === "Escape") { setOpen(false); triggerRef.current?.focus(); } - }; - document.addEventListener("mousedown", onPointer); - document.addEventListener("keydown", onKey); - return () => { - document.removeEventListener("mousedown", onPointer); - document.removeEventListener("keydown", onKey); - }; - }, [open, state.step]); - const seek = (to: number) => { dispatch({ type: "step", to }); setOpen(false); }; - return
    - - {open &&
    -
    -

    Navigation

    -
    - - - - - -
    - {chapterControls ? chapterControls(seek) :
    -
    - - - - - -
    - -
    } - {state.max > 0 &&
    { - event.preventDefault(); - const value = Number(new FormData(event.currentTarget).get("step")); - if (Number.isInteger(value) && value >= 1 && value <= state.max + 1) - seek(value - 1); - }}> -
    - - -
    - -
    } -
    - {diagramControls &&
    -

    Diagram

    -
    {diagramControls}
    -
    } -
    -

    Playback and display

    -
    - {SPEEDS.map(speed => )} -
    -
    - {sound && } - {narration && } - {inspection && } - -
    -
    -
    } -
    ; -} From 4c6a70d1901ef28ee03747da7d90af4190e3f5f1 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:20:15 +0100 Subject: [PATCH 42/80] refactor(player): name player-layout.browser.test.tsx for its production role --- .../__tests__/player-layout.browser.test.tsx | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/react/__tests__/player-layout.browser.test.tsx diff --git a/src/react/__tests__/player-layout.browser.test.tsx b/src/react/__tests__/player-layout.browser.test.tsx new file mode 100644 index 00000000..0b0e4304 --- /dev/null +++ b/src/react/__tests__/player-layout.browser.test.tsx @@ -0,0 +1,71 @@ +import { expect, it } from "vitest"; +import { page, userEvent } from "vitest/browser"; +import { render } from "vitest-browser-react"; +import { compileArtifact } from "../../v2/compiler.js"; +import { distributedGraph } from "../../__tests__/v2-graph-fixture.js"; +import { ThroughlineGraphPlayer } from "../graph-player.js"; +import "../../styles/throughline.css"; + +const trace = () => compileArtifact(distributedGraph()); + +it("uses the compact player layout, not the legacy player composition", async () => { + const screen = await render(); + const shell = screen.getByRole("group", { name: "Visualization player" }).element(); + for (const name of [ + ".player-header", ".context-bar", ".view-tabs", ".player-content", + ".canvas", ".canvas-meta", ".graph-wrap", ".canvas-hint", ".zoom-tools", + ".transport", ".transport-buttons", ".transport-meta", ".step-caption", + ]) expect(shell.querySelector(name)).not.toBeNull(); + expect(shell.querySelector(".thl-v2-mode")).toBeNull(); + expect(shell.querySelector(".thl-bottom")).toBeNull(); + expect((shell.querySelector(".step-caption") as HTMLDetailsElement).open).toBe(false); + await expect.element(screen.getByRole("tab", { name: "Graph" })).toHaveAttribute("aria-selected", "true"); + await screen.getByText("Details", { exact: true }).click(); + expect((shell.querySelector(".step-caption") as HTMLDetailsElement).open).toBe(true); + await screen.getByRole("tab", { name: "State" }).click(); + await expect.element(screen.getByRole("region", { name: "State and event table" })).toBeVisible(); + await screen.getByRole("tab", { name: "Sequence" }).click(); + await expect.element(screen.getByRole("region", { name: "Message sequence evidence" })).toBeVisible(); +}); + +it("keeps the source palette, original graph card dimensions and real authored frame", async () => { + const screen = await render(); + const shell = screen.getByRole("group", { name: "Visualization player" }).element(); + expect(shell.classList.contains("player-shell")).toBe(true); + const css = getComputedStyle(shell); + expect(css.getPropertyValue("--thl-active").trim()).not.toBe(""); + const node = shell.querySelector(".thl-v2-diagram [data-node] .thl-node")!; + expect(node).not.toBeNull(); + expect(Number(node.getAttribute("height"))).toBe(52); + expect(Number(node.getAttribute("width"))).toBe(116); + await screen.getByRole("button", { name: "Step forward" }).click(); + await expect.element(screen.getByRole("status")).toHaveTextContent("Step 2 of 7"); + expect(shell.querySelector(".canvas-meta")?.textContent).toContain("FRAME 01"); + expect(shell.querySelectorAll("[data-source-event-ids]").length).toBeGreaterThan(0); +}); + +it("preserves the player sidebar drawer and control placement at mobile embed widths", async () => { + await page.viewport(900, 800); + const screen = await render(); + const shell = screen.getByRole("group", { name: "Visualization player" }).element(); + for (const width of [768, 375, 260]) { + shell.style.width = width + "px"; + await expect.poll(() => Math.round(shell.getBoundingClientRect().width)).toBe(width); + expect(shell.scrollWidth).toBeLessThanOrEqual(shell.clientWidth + 2); + await screen.getByRole("button", { name: "Inspect", exact: true }).click(); + const inspector = screen.getByRole("complementary", { name: "Entity inspector" }); + await expect.element(inspector).toBeVisible(); + expect(shell.querySelector(".player-content.with-inspector")).not.toBeNull(); + expect(shell.scrollWidth).toBeLessThanOrEqual(shell.clientWidth + 2); + await screen.getByRole("button", { name: "Close inspector" }).click(); + } + await screen.getByRole("button", { name: "Player options" }).click(); + await expect.element(screen.getByRole("group", { name: "Player options" })).toBeVisible(); + const toStep = screen.getByRole("spinbutton", { name: "Go to step" }); + await toStep.fill("3"); + await screen.getByRole("button", { name: "Go", exact: true }).click(); + await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 7"); + shell.focus(); + await userEvent.keyboard("{Home}"); + await expect.element(screen.getByRole("status")).toHaveTextContent("Step 1 of 7"); +}); From e562cabe9d19bd5ac2bc095c435d87f200388840 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:20:17 +0100 Subject: [PATCH 43/80] refactor(player): remove temporary design-port filename prototype-port.browser.test.tsx --- .../__tests__/prototype-port.browser.test.tsx | 71 ------------------- 1 file changed, 71 deletions(-) delete mode 100644 src/react/__tests__/prototype-port.browser.test.tsx diff --git a/src/react/__tests__/prototype-port.browser.test.tsx b/src/react/__tests__/prototype-port.browser.test.tsx deleted file mode 100644 index 8bf83de4..00000000 --- a/src/react/__tests__/prototype-port.browser.test.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { expect, it } from "vitest"; -import { page, userEvent } from "vitest/browser"; -import { render } from "vitest-browser-react"; -import { compileArtifact } from "../../v2/compiler.js"; -import { distributedGraph } from "../../__tests__/v2-graph-fixture.js"; -import { ThroughlineGraphPlayer } from "../graph-player.js"; -import "../../styles/throughline.css"; - -const trace = () => compileArtifact(distributedGraph()); - -it("uses the original prototype's compact layout, not the legacy player composition", async () => { - const screen = await render(); - const shell = screen.getByRole("group", { name: "Visualization player" }).element(); - for (const name of [ - ".player-header", ".context-bar", ".view-tabs", ".player-content", - ".canvas", ".canvas-meta", ".graph-wrap", ".canvas-hint", ".zoom-tools", - ".transport", ".transport-buttons", ".transport-meta", ".step-caption", - ]) expect(shell.querySelector(name)).not.toBeNull(); - expect(shell.querySelector(".thl-v2-mode")).toBeNull(); - expect(shell.querySelector(".thl-bottom")).toBeNull(); - expect((shell.querySelector(".step-caption") as HTMLDetailsElement).open).toBe(false); - await expect.element(screen.getByRole("tab", { name: "Graph" })).toHaveAttribute("aria-selected", "true"); - await screen.getByText("Details", { exact: true }).click(); - expect((shell.querySelector(".step-caption") as HTMLDetailsElement).open).toBe(true); - await screen.getByRole("tab", { name: "State" }).click(); - await expect.element(screen.getByRole("region", { name: "State and event table" })).toBeVisible(); - await screen.getByRole("tab", { name: "Sequence" }).click(); - await expect.element(screen.getByRole("region", { name: "Message sequence evidence" })).toBeVisible(); -}); - -it("keeps the source palette, original graph card dimensions and real authored frame", async () => { - const screen = await render(); - const shell = screen.getByRole("group", { name: "Visualization player" }).element(); - expect(shell.classList.contains("player-shell")).toBe(true); - const css = getComputedStyle(shell); - expect(css.getPropertyValue("--thl-active").trim()).not.toBe(""); - const node = shell.querySelector(".thl-v2-diagram [data-node] .thl-node")!; - expect(node).not.toBeNull(); - expect(Number(node.getAttribute("height"))).toBe(52); - expect(Number(node.getAttribute("width"))).toBe(116); - await screen.getByRole("button", { name: "Step forward" }).click(); - await expect.element(screen.getByRole("status")).toHaveTextContent("Step 2 of 7"); - expect(shell.querySelector(".canvas-meta")?.textContent).toContain("FRAME 01"); - expect(shell.querySelectorAll("[data-source-event-ids]").length).toBeGreaterThan(0); -}); - -it("preserves prototype's sidebar drawer and control placement at mobile embed widths", async () => { - await page.viewport(900, 800); - const screen = await render(); - const shell = screen.getByRole("group", { name: "Visualization player" }).element(); - for (const width of [768, 375, 260]) { - shell.style.width = width + "px"; - await expect.poll(() => Math.round(shell.getBoundingClientRect().width)).toBe(width); - expect(shell.scrollWidth).toBeLessThanOrEqual(shell.clientWidth + 2); - await screen.getByRole("button", { name: "Inspect", exact: true }).click(); - const inspector = screen.getByRole("complementary", { name: "Entity inspector" }); - await expect.element(inspector).toBeVisible(); - expect(shell.querySelector(".player-content.with-inspector")).not.toBeNull(); - expect(shell.scrollWidth).toBeLessThanOrEqual(shell.clientWidth + 2); - await screen.getByRole("button", { name: "Close inspector" }).click(); - } - await screen.getByRole("button", { name: "Player options" }).click(); - await expect.element(screen.getByRole("group", { name: "Player options" })).toBeVisible(); - const toStep = screen.getByRole("spinbutton", { name: "Go to step" }); - await toStep.fill("3"); - await screen.getByRole("button", { name: "Go", exact: true }).click(); - await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 7"); - shell.focus(); - await userEvent.keyboard("{Home}"); - await expect.element(screen.getByRole("status")).toHaveTextContent("Step 1 of 7"); -}); From 7ed213cd7a227cc1107d67ef2aa3d4dce9a5598e Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:20:42 +0100 Subject: [PATCH 44/80] refactor(player): finalize production naming in graph-player.tsx --- src/react/graph-player.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 8a3a7857..85102b4f 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -13,7 +13,7 @@ import type { Cell, CompiledTrace, Id, ViewDescriptor, ViewItem, ViewKind, } from "../v2/model.js"; import { projectView } from "../v2/views.js"; -import { PlayerControls, PlayerOptions } from "./prototype-controls.js"; +import { PlayerControls, PlayerOptions } from "./player-chrome.js"; import { useNarration } from "./use-narration.js"; import { usePlayer, useSceneWidth } from "./use-player.js"; import { SequenceView } from "./sequence-view.js"; @@ -216,7 +216,7 @@ function GraphDiagram({ } /** Inert fallback; full source-linked history inspector UI is TL-U07. */ -/** The prototype's four-column state sheet, displaying real committed cells. */ +/** The compact four-column state sheet, displaying real committed cells. */ function StateFallback({ view, selectedId, onSelect, inspector, frameIndex }: { view: ViewDescriptor; selectedId: Id | null; @@ -268,7 +268,7 @@ export function ThroughlineGraphPlayer({ const svgRef = useRef(null); const rootRef = useRef(null); const width = useSceneWidth(canvasRef); - // Match the prototype: on initially narrow embeds, follow authored action. + // On initially narrow embeds, follow authored action. useEffect(() => { if (followInitialized.current || !canvasRef.current) return; followInitialized.current = true; @@ -323,7 +323,7 @@ export function ThroughlineGraphPlayer({ // Never send the former trace's higher frame index into a new, shorter // immutable inspector while React completes that state transition. const frameIndex = Math.min(state.step, trace.frames.length - 1); - // The prototype's graph is a stable, pannable 828-unit SVG world, even + // The player graph is a stable, pannable 828-unit SVG world, even // when the host is a narrow embed. Never reshuffle the authored diagram // solely because the container changes width. const layout = useMemo(() => layoutGraph(trace, 828), [trace]); @@ -583,7 +583,7 @@ export function ThroughlineGraphPlayer({
    { - if (inspectionMode === "explain" && !selectedId && trace.artifact.entities.length) - setSelectedId(trace.artifact.entities[0].id); setInspectionMode(current => current === "inspect" ? "explain" : "inspect"); } }} sound={{ enabled: soundOn, available: soundAvailable, toggle: toggleSound }} @@ -701,7 +697,9 @@ export function ThroughlineGraphPlayer({
    )} {inspectHistory.length > 60 &&

    Showing latest 60 writes; all records available in source inspection.

    } - :

    No entities declared.

    } + :

    {trace.artifact.entities.length + ? "Choose an entity in the graph or Player options to inspect its state." + : "No entities declared."}

    }
    CAUSAL EVIDENCE

    Only explicit modeled dependencies are evidence; no additional event is inferred.

    From 435dcc9433f47d008443d542905f2d9d74d68c84 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:29:38 +0100 Subject: [PATCH 57/80] fix(player): eliminate transient inspector overflow and keep animations opt-in --- src/styles/throughline.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index b48c60f5..b3ae69ea 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -1372,7 +1372,7 @@ stroke: var(--acid); stroke-width: 1.7; stroke-dasharray: 5 4; - animation: none; + color: var(--acid); filter: drop-shadow(0 0 3px color-mix(in srgb, var(--thl-active) 30%, transparent)); } @@ -1546,12 +1546,12 @@ border-left: 1px solid var(--line); background: var(--thl-panel); padding: 12px; - animation: none; + } @keyframes thl-player-reveal { from { opacity: 0; - transform: translateX(8px); + transform: none; } }.thl.player-shell .inspector-top{ display: flex; @@ -2015,7 +2015,7 @@ border-radius: 4px; background: var(--thl-panel); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px color-mix(in srgb, var(--thl-text) 2%, transparent) inset; - animation: none; + text-align: left; } @keyframes thl-player-pop { @@ -2293,7 +2293,7 @@ max-height: 240px; overflow-y: auto; padding: 0 14px 14px 48px; - animation: none; + } @keyframes thl-player-thl-player-reveal-down { from { From ed4020a063e2a261becce781b2c9d454a274e6d9 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:32:08 +0100 Subject: [PATCH 58/80] fix(player): preserve explicit empty-frame evidence in visual sequence and SSR --- src/react/sequence-view.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/react/sequence-view.tsx b/src/react/sequence-view.tsx index 387b0019..402d787e 100644 --- a/src/react/sequence-view.tsx +++ b/src/react/sequence-view.tsx @@ -89,6 +89,7 @@ export function SequenceView({ ; })} + {events.length === 0 &&

    No modeled events through this frame.

    }
    From 7bcc5e0e786b252af248b74cb5bd38ececbfc68c Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:32:11 +0100 Subject: [PATCH 59/80] test(pack): assert compact player navigation and inspect UI in packed SSR consumer --- scripts/audit-pack.mjs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/audit-pack.mjs b/scripts/audit-pack.mjs index 141f20c5..82541681 100644 --- a/scripts/audit-pack.mjs +++ b/scripts/audit-pack.mjs @@ -509,8 +509,9 @@ try { 'assert.match(sequenceHtml, /No modeled events through this frame/);', 'assert.doesNotMatch(sequenceHtml, /data-message-phase="received"/);', 'assert.match(graphHtml, /Source-linked graph at current frame/);', - 'assert.match(graphHtml, /Explain or inspect/);', - 'assert.match(graphHtml, /aria-pressed="false"[^>]*>Inspect/);', + 'assert.match(graphHtml, /class="player-header"/);', + 'assert.match(graphHtml, /role="tablist" aria-label="Visualization view"/);', + 'assert.match(graphHtml, /aria-label="Inspect" aria-pressed="false"/);', 'assert.match(graphHtml, /data-source-entity-ids="alpha"/);', 'assert.match(graphHtml, /data-source-relation-ids="link"/);', 'assert.match(graphHtml, /Step 1 of 2/);', From 77297450c7dd91211c0b43c7a4a5ed288a231fc9 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:32:28 +0100 Subject: [PATCH 60/80] style(player): show empty sequence evidence with quiet player typography --- src/styles/throughline.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index b3ae69ea..f58e7a5c 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -2783,3 +2783,10 @@ max-width: min(270px, 86%); } } + +.thl.player-shell .seq-empty { + margin: 0; + padding: 14px 12px; + color: var(--thl-muted); + font: 400 9px/1.5 "IBM Plex Mono", ui-monospace, monospace; +} From 238749af465a5018194390b4c96a54a4c195c741 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:34:21 +0100 Subject: [PATCH 61/80] test(player): target the visible empty-sequence lane when detailed evidence also reports emptiness --- src/react/__tests__/v2-sequence.browser.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/react/__tests__/v2-sequence.browser.test.tsx b/src/react/__tests__/v2-sequence.browser.test.tsx index 768f70f6..85803b60 100644 --- a/src/react/__tests__/v2-sequence.browser.test.tsx +++ b/src/react/__tests__/v2-sequence.browser.test.tsx @@ -92,7 +92,8 @@ it("does not flag receipt before send within the same atomic step", async () => it("shows modeled phases through seeking, no future or imagined acknowledgement", async () => { const screen = await render(); await openSequence(screen); - await expect.element(screen.getByText("No modeled events through this frame.")).toBeVisible(); + await expect.element(screen.getByRole("region", { name: "Sequence lane diagram" }) + .getByText("No modeled events through this frame.")).toBeVisible(); expect(evidence("originalSent")).toBeNull(); const next = screen.getByRole("button", { name: "Step forward" }); await next.click(); From 0a7a6a77f740bab9baedc198f858480f17a6d11c Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:34:32 +0100 Subject: [PATCH 62/80] refactor(player): normalize animation identifiers for production styling --- src/styles/throughline.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index f58e7a5c..84fd6b9d 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -2295,7 +2295,7 @@ padding: 0 14px 14px 48px; } -@keyframes thl-player-thl-player-reveal-down { +@keyframes thl-player-reveal-down { from { opacity: 0; transform: translateY(-4px); @@ -2760,7 +2760,7 @@ .thl.player-shell .links path.hot { animation: thl-player-flow 0.7s linear infinite; } .thl.player-shell .inspector { animation: thl-player-reveal 0.18s ease-out; } .thl.player-shell .options-menu { animation: thl-player-pop 0.14s ease-out; } - .thl.player-shell .caption-body { animation: thl-player-thl-player-reveal-down 0.18s ease-out; } + .thl.player-shell .caption-body { animation: thl-player-reveal-down 0.18s ease-out; } } /* The compact inspector cannot force the host's horizontal scroll at any * embed width. Popup controls remain accessible within the player width. */ From d0f8c7c306c7cea3dc072343ef16a40c12c70466 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:36:55 +0100 Subject: [PATCH 63/80] test(pack): check the new transport and tab navigation in a packed hydrated browser --- scripts/audit-browser.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/audit-browser.mjs b/scripts/audit-browser.mjs index 4b175229..c3ef910a 100644 --- a/scripts/audit-browser.mjs +++ b/scripts/audit-browser.mjs @@ -108,7 +108,7 @@ try { const visual = await player.evaluate(element => ({ overflow: element.scrollWidth > element.clientWidth, radius: getComputedStyle(element).getPropertyValue("--thl-radius").trim(), - controls: getComputedStyle(element.querySelector(".thl-bottom")).display, + controls: getComputedStyle(element.querySelector(".transport")).display, graph: element.querySelector(".thl-v2-diagram") !== null, reducedMotion: matchMedia("(prefers-reduced-motion: reduce)").matches, })); @@ -123,7 +123,9 @@ try { await page.keyboard.press("ArrowRight"); assert.match(await page.getByRole("status").textContent(), /Step 3 of 9/); await page.getByRole("button", { name: "Player options" }).tap(); - await page.getByRole("combobox", { name: "Visualization view" }).selectOption("state-table"); + assert(await page.getByRole("group", { name: "Player options" }).isVisible()); + await page.getByRole("button", { name: "Player options" }).tap(); + await page.getByRole("tab", { name: "State" }).click(); assert(await page.getByRole("region", { name: "State and event table" }).isVisible()); const state = await page.getByRole("region", { name: "State and event table" }).textContent(); assert.match(state, /Modeled call stack/); From d3a29152e58767358577fccc0c0c4bd82df81508 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:53:53 +0100 Subject: [PATCH 64/80] fix(player): restore canonical authored graph geometry and edge-routing layout --- src/v2/graph-layout.ts | 119 +---------------------------------------- 1 file changed, 2 insertions(+), 117 deletions(-) diff --git a/src/v2/graph-layout.ts b/src/v2/graph-layout.ts index 06fc5fa7..f31b6d88 100644 --- a/src/v2/graph-layout.ts +++ b/src/v2/graph-layout.ts @@ -12,7 +12,7 @@ import type { CompiledTrace, Id, ViewDescriptor } from "./model.js"; */ const PAD = 12; const GAP = 12; -const NODE_HEIGHT = 52; +const NODE_HEIGHT = 74; const GROUP_HEADER = 26; const SUMMARY_HEIGHT = 52; @@ -20,122 +20,7 @@ const box = (x: number, y: number, w: number, h: number): Box => ({ x, y, w, h } const limitWidth = (width: number): number => Math.max(160, Number.isFinite(width) ? Math.floor(width) : 720); -/** - * The player uses a stable horizontal group world (828×300 baseline), - * independent of the embed's viewport width. Keep that composition for the - * public player while allowing the existing narrow-width pure layout for - * consumers explicitly requesting a smaller geometry. - * - * This is layout only: identities, order, presence, message and value evidence - * always come from the compiled source. The world can extend vertically for - * larger or nested authored groups, rather than clipping a real entity. - */ -function horizontalGroupLayout(trace: CompiledTrace, width: number): Layout { - const { artifact } = trace; - const groups = artifact.groups ?? []; - const byParent = new Map(); - const byGroup = new Map(); - for (const group of groups) { - const list = byParent.get(group.parentId) ?? []; - list.push(group.id); byParent.set(group.parentId, list); - } - for (const entity of artifact.entities) { - const list = byGroup.get(entity.groupId) ?? []; - list.push(entity.id); byGroup.set(entity.groupId, list); - } - const entityIndex = new Map(artifact.entities.map((e,i) => [e.id, "node_"+i] as const)); - const groupIndex = new Map(groups.map((g,i) => [g.id, "group_"+i] as const)); - const groupById = new Map(groups.map(g=>[g.id,g] as const)); - const nodes: Layout["nodes"] = Object.create(null); - const panels: Layout["groups"] = []; - const INNER = 16, GROUP_GAP = 30, ROW = 144; - const ownWidth = (id: Id): number => - Math.min(372, (byGroup.get(id)?.length ?? 0) > 2 ? 372 : 176); - const demand = (id: Id): number => { - const children = byParent.get(id) ?? []; - return Math.max(ownWidth(id), children.length - ? children.reduce((sum, child) => sum + demand(child), 0) + - (children.length-1)*GROUP_GAP+INNER*2 : 0); - }; - // Share excess world width across actual groups. This reproduces the - // original narrow processing/external lanes and wider request/order lane. - const widths = (ids: readonly Id[], budget: number): number[] => { - if (!ids.length) return []; - const natural = ids.map(demand); - const gap = GROUP_GAP*(ids.length-1); - const usable = Math.max(0,budget-gap); - const sum = natural.reduce((a,b)=>a+b,0); - if (sum<=usable) return natural.map(w=>w+(usable-sum)/ids.length); - const scale=usable/Math.max(sum,1); - return natural.map(w=>Math.max(116,Math.floor(w*scale))); - }; - const arrangeGroup = (id: Id, x: number, y: number, w: number): number => { - const g=groupById.get(id)!; - const panel: Layout["groups"][number] = { - id:groupIndex.get(id)!, name:g.label, - ...(g.parentId?{parentId:groupIndex.get(g.parentId)}:{}), - x, y, w, h:254, - }; - panels.push(panel); // parents paint before children even with unordered IDs - const members=byGroup.get(id) ?? []; - const cols=members.length>2 && w>=320 ? 2 : 1; - const rows=Math.ceil(members.length/cols); - const top=y+36; - for (const [index,entityId] of members.entries()) { - const col=index%cols, row=Math.floor(index/cols); - const px=cols===1 ? x+(w-116)/2 : - col===0 ? x+INNER : x+w-INNER-116; - nodes[entityIndex.get(entityId)!]=box(px,top+row*ROW,116,52); - } - const children=byParent.get(id) ?? []; - const childTop=top+(rows ? (rows-1)*ROW+52+30 : 0); - let childBottom=y; - if (children.length) { - const childWidths=widths(children,w-INNER*2); - let cx=x+INNER; - for (const [index,childId] of children.entries()) { - const cw=childWidths[index]; - childBottom=Math.max(childBottom,arrangeGroup(childId,cx,childTop,cw)); - cx+=cw+GROUP_GAP; - } - } - panel.h=Math.max(254, Math.max( - rows ? top+(rows-1)*ROW+52+22 : y+36, childBottom+18 - )-y); - const summaryWidth=Math.min(150,Math.max(116,w-16)); - nodes[groupIndex.get(id)!]=box(x+(w-summaryWidth)/2,y+36,summaryWidth,52); - return y+panel.h; - }; - const ROOT_X=18, ROOT_Y=30; - const roots=byParent.get(undefined) ?? []; - let bottom=ROOT_Y; - if (roots.length) { - const rootWidths=widths(roots,width-ROOT_X*2); - let x=ROOT_X; - for (const [index,id] of roots.entries()) { - bottom=Math.max(bottom,arrangeGroup(id,x,ROOT_Y,rootWidths[index])); - x+=rootWidths[index]+GROUP_GAP; - } - } - const ungrouped=byGroup.get(undefined) ?? []; - const start=roots.length ? bottom+30 : ROOT_Y+36; - const columns=Math.max(1,Math.floor((width-36+12)/128)); - for (const [index,id] of ungrouped.entries()) { - nodes[entityIndex.get(id)!]=box( - 18+(index%columns)*128,start+Math.floor(index/columns)*144,116,52); - } - if (ungrouped.length) - bottom=start+Math.ceil(ungrouped.length/columns)*144; - return { - width, height:Math.max(300,bottom+16), viewBox:"0 0 "+width+" "+Math.max(300,bottom+16), - groups:panels,nodes,edges:Object.create(null), - }; -} - export function layoutGraph(trace: CompiledTrace, availableWidth = 720): Layout { - if (availableWidth >= 828 && (trace.artifact.groups?.length ?? 0) > 0 && - trace.artifact.groups!.length <= 8 && trace.artifact.entities.length <= 24) - return horizontalGroupLayout(trace, Math.floor(availableWidth)); const width = limitWidth(availableWidth); const groups = trace.artifact.groups ?? []; const byParent = new Map(); @@ -163,7 +48,7 @@ export function layoutGraph(trace: CompiledTrace, availableWidth = 720): Layout if (!ids.length) return; const x = PAD + Math.min(depth * 8, 24); const available = Math.max(120, width - x - PAD); - const nodeWidth = Math.min(116, available); + const nodeWidth = Math.min(188, available); const columns = Math.max(1, Math.floor((available + GAP) / (nodeWidth + GAP))); for (const [index, id] of ids.entries()) { const col = index % columns; From 5437c790bb7b3a5ce881b199c5f256581bb91442 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:53:55 +0100 Subject: [PATCH 65/80] fix(player): restore original graph nodes, edges, highlight semantics and responsive layout --- src/react/graph-player.tsx | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 5819d1dc..0f067d74 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -82,7 +82,7 @@ function GraphDiagram({ const item = rect.id && groupsById.get(rect.id); if (!item) return null; return ( - 0, "thl-animate": animate && sent > 0, @@ -136,7 +136,6 @@ function GraphDiagram({ const active = Boolean(item.source.entityIds?.includes(selectedId ?? "")); return ( - - + {preview(item.label, Math.floor((rect.w - 16) / 7))} - + {preview(value ? cellText(value) : "Unknown", Math.floor((rect.w - 16) / 7.4))} - + {changed && + Explicit write + } ); })} @@ -215,8 +214,6 @@ function GraphDiagram({ ); } -/** Inert fallback; full source-linked history inspector UI is TL-U07. */ -/** The compact four-column state sheet, displaying real committed cells. */ function StateFallback({ view, selectedId, onSelect, inspector, frameIndex }: { view: ViewDescriptor; selectedId: Id | null; @@ -268,12 +265,6 @@ export function ThroughlineGraphPlayer({ const svgRef = useRef(null); const rootRef = useRef(null); const width = useSceneWidth(canvasRef); - // On initially narrow embeds, follow authored action. - useEffect(() => { - if (followInitialized.current || !canvasRef.current) return; - followInitialized.current = true; - if (canvasRef.current.clientWidth < 640) setFollow(true); - }, [width, trace]); const [narrating, setNarrating] = useState(false); const { state, dispatch, lastAction, seekRevision, onKeyDown } = usePlayer(trace, narration && narrating); @@ -326,7 +317,7 @@ export function ThroughlineGraphPlayer({ // The player graph is a stable, pannable 828-unit SVG world, even // when the host is a narrow embed. Never reshuffle the authored diagram // solely because the container changes width. - const layout = useMemo(() => layoutGraph(trace, 828), [trace]); + const layout = useMemo(() => layoutGraph(trace, width), [trace, width]); const view = useMemo(() => projectView(inspector, { kind: viewKind, frameIndex, selectedEntityIds: selectedId ? [selectedId] : [], From 5e6d082d0e593e358a146b78c8ebf68d2ab627e5 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:55:15 +0100 Subject: [PATCH 66/80] fix(player): preserve authored graph geometry, connectors and highlight CSS; resize graph text only --- src/styles/throughline.css | 126 +++++++++---------------------------- 1 file changed, 29 insertions(+), 97 deletions(-) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index 84fd6b9d..42f71c60 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -1350,71 +1350,8 @@ width: 100%; height: calc(100% - 20px); overflow: visible; - color: var(--thl-muted); -}.thl.player-shell .group-frame rect{ - fill: color-mix(in srgb, var(--thl-text) 1%, transparent); - stroke: var(--thl-surface); - stroke-dasharray: 3 4; - rx: 2px; -}.thl.player-shell .group-frame text{ - fill: var(--thl-muted); - font: - 500 8px "IBM Plex Mono", - monospace; - letter-spacing: 0.09em; -}.thl.player-shell .links path{ - fill: none; - stroke: var(--thl-line); - stroke-width: 1.2; -}.thl.player-shell .links path.visited{ - stroke: var(--thl-muted); -}.thl.player-shell .links path.hot{ - stroke: var(--acid); - stroke-width: 1.7; - stroke-dasharray: 5 4; - - color: var(--acid); - filter: drop-shadow(0 0 3px color-mix(in srgb, var(--thl-active) 30%, transparent)); -} -@keyframes thl-player-flow { - to { - stroke-dashoffset: -9; } -}.thl.player-shell .entity{ - cursor: pointer; -}.thl.player-shell .entity rect{ - fill: var(--thl-panel); - stroke: var(--thl-line); - rx: 2px; - transition: 0.15s ease; -}.thl.player-shell .entity:hover rect{ - fill: var(--thl-surface); - stroke: var(--thl-muted); -}.thl.player-shell .entity circle{ - fill: var(--thl-muted); -}.thl.player-shell .entity text{ - pointer-events: none; -}.thl.player-shell .entity-label{ - fill: var(--thl-text); - font: - 500 10px "DM Sans", - sans-serif; -}.thl.player-shell .entity-value{ - fill: var(--thl-muted); - font: - 400 8.5px "IBM Plex Mono", - monospace; -}.thl.player-shell .entity.active rect{ - stroke: var(--acid); - fill: var(--thl-panel); -}.thl.player-shell .entity.active circle{ - fill: var(--acid); - filter: drop-shadow(0 0 4px color-mix(in srgb, var(--thl-active) 60%, transparent)); -}.thl.player-shell .entity.active .entity-value{ - fill: var(--acid); -}.thl.player-shell .entity.selected rect{ - stroke-width: 2px; -}.thl.player-shell .canvas-hint{ +.thl.player-shell .canvas-hint{ position: absolute; left: 14px; right: 14px; @@ -1868,9 +1805,6 @@ min-height: 310px; }.thl.player-shell .canvas{ min-height: 310px; - }.thl.player-shell .graph{ - min-width: 680px; - transform: translateX(-35px); }.thl.player-shell .sequence-event{ grid-template-columns: 22px 1fr; }.thl.player-shell .sequence-event code{ @@ -1901,11 +1835,6 @@ }.thl.player-shell .player-content, .thl.player-shell .canvas{ min-height: 292px; - }.thl.player-shell .graph-wrap{ - overflow-x: auto; - }.thl.player-shell .graph{ - width: 680px; - transform: none; }.thl.player-shell .canvas-meta code{ display: none; }.thl.player-shell .step-caption p{ @@ -2180,10 +2109,6 @@ cursor: grabbing; }.thl.player-shell .graph-wrap{ overflow: hidden; -}.thl.player-shell .entity.summary rect{ - stroke-dasharray: 3 3; -}.thl.player-shell .group-frame g.collapsed rect{ - opacity: 0.4; }.thl.player-shell .canvas-hint{ align-items: center; bottom: 6px; @@ -2646,26 +2571,25 @@ .thl.player-shell .player-content { flex: 1 1 auto; } .thl.player-shell .canvas { height: 330px; } .thl.player-shell:fullscreen .canvas { height: auto; flex: 1 1 auto; } -.thl.player-shell .graph { display: block; font-family: "IBM Plex Mono", ui-monospace, monospace; } -.thl.player-shell .thl-group { fill: transparent; stroke: var(--thl-line); stroke-dasharray: 3 4; } -.thl.player-shell .thl-group-label { fill: var(--thl-muted); font: 500 8px "IBM Plex Mono", monospace; } -.thl.player-shell .thl-link .thl-edge { stroke: var(--thl-line); stroke-width: 1.2; } -.thl.player-shell .thl-link.thl-visited .thl-edge { stroke: var(--thl-trail); } -.thl.player-shell .thl-link.thl-transferred .thl-edge { stroke: var(--thl-active); stroke-width: 1.7; stroke-dasharray: 5 4; } -.thl.player-shell .thl-link.thl-transferred polygon { fill: var(--thl-active); } -.thl.player-shell .thl-link:not(.thl-transferred) polygon { fill: var(--thl-line); } -.thl.player-shell .thl-node-label { fill: var(--thl-text); font: 500 10px "DM Sans", system-ui, sans-serif; } -.thl.player-shell .thl-v2-value { fill: var(--thl-muted); font: 400 8.5px "IBM Plex Mono", monospace; } -.thl.player-shell .thl-node.thl-focused { fill: var(--thl-focus-bg); stroke: var(--thl-focus); } -.thl.player-shell .thl-v2-value.thl-changed, -.thl.player-shell .thl-v2-change { fill: var(--thl-change); } -.thl.player-shell .thl-node.thl-selected { stroke: var(--thl-focus); stroke-width: 2; } -.thl.player-shell .thl-ring-selected { stroke: var(--thl-focus); } -.thl.player-shell .entity rect { fill: var(--thl-surface); stroke: var(--thl-line); } -.thl.player-shell .entity.active rect { fill: var(--thl-focus-bg); stroke: var(--thl-active); } -.thl.player-shell .entity.selected rect { stroke: var(--thl-focus); } -.thl.player-shell .entity.active circle { fill: var(--thl-active); } -.thl.player-shell .entity.active .entity-value { fill: var(--thl-active); } +.thl.player-shell .graph { display: block; } + + + + + + + + + + + + + + + + + + .thl.player-shell .state-row:focus-visible, .thl.player-shell .view-tabs button:focus-visible { outline: 2px solid var(--thl-focus); outline-offset: -2px; } .thl.player-shell .inspector { overflow-y: auto; max-height: 600px; } @@ -2757,7 +2681,7 @@ /* Motion is opt-in by preference. Reduced-motion users never receive a * running animation, and legacy player motion rules remain untouched. */ @media (prefers-reduced-motion: no-preference) { - .thl.player-shell .links path.hot { animation: thl-player-flow 0.7s linear infinite; } + .thl.player-shell .inspector { animation: thl-player-reveal 0.18s ease-out; } .thl.player-shell .options-menu { animation: thl-player-pop 0.14s ease-out; } .thl.player-shell .caption-body { animation: thl-player-reveal-down 0.18s ease-out; } @@ -2790,3 +2714,11 @@ color: var(--thl-muted); font: 400 9px/1.5 "IBM Plex Mono", ui-monospace, monospace; } + +/* Authored graph shapes, routes, colors, and highlight states are unchanged. + * Only text size is adjusted inside the source-linked diagram. */ +.thl.player-shell .thl-v2-diagram .thl-node-label { font-size: 10px; } +.thl.player-shell .thl-v2-diagram .thl-v2-value { font-size: 8.5px; } +.thl.player-shell .thl-v2-diagram .thl-v2-change { font-size: 9px; } +.thl.player-shell .thl-v2-diagram .thl-group-label { font-size: 8px; } +.thl.player-shell .thl-v2-diagram .thl-edge-label { font-size: 9px; } From 107f99eedb375fccb48ecbd5653beef3f6989e91 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:56:05 +0100 Subject: [PATCH 67/80] fix(player): retain original fit camera and responsive graph geometry by default --- src/react/graph-player.tsx | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index 0f067d74..cd9c445e 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -278,7 +278,6 @@ export function ThroughlineGraphPlayer({ const [soundOn, setSoundOn] = useState(false); const [soundAvailable, setSoundAvailable] = useState(false); const audioRef = useRef(null); - const followInitialized = useRef(false); const [camera, setCamera] = useState(null); const [fullscreen, setFullscreen] = useState(false); // Capability detection is client-only. SSR and the first hydration render @@ -294,7 +293,6 @@ export function ThroughlineGraphPlayer({ setInspectionMode("explain"); setDrilled(null); setFollow(false); - followInitialized.current = false; setSoundOn(false); setNarrating(false); } @@ -314,9 +312,8 @@ export function ThroughlineGraphPlayer({ // Never send the former trace's higher frame index into a new, shorter // immutable inspector while React completes that state transition. const frameIndex = Math.min(state.step, trace.frames.length - 1); - // The player graph is a stable, pannable 828-unit SVG world, even - // when the host is a narrow embed. Never reshuffle the authored diagram - // solely because the container changes width. +// Use the unchanged authored graph layout, including container-dependent + // geometry, rather than the reference design's fixed demo coordinates. const layout = useMemo(() => layoutGraph(trace, width), [trace, width]); const view = useMemo(() => projectView(inspector, { kind: viewKind, frameIndex, @@ -343,18 +340,8 @@ export function ThroughlineGraphPlayer({ layout.height / Math.max(1, focusBottom - focusTop), ))), } : null; - const firstVisible = frameIndex === 0 && view.kind === "graph" - ? view.items.find(item => item.role === "entity" && geometry.nodes[item.id]) - : undefined; - const firstBox = firstVisible && geometry.nodes[firstVisible.id]; - const mobileInitialCamera: Camera | null = firstBox && width < 640 ? { - centerX: firstBox.x + firstBox.w / 2, - centerY: firstBox.y + firstBox.h / 2, - zoom: 2.4, - } : null; const effectiveCamera = constrainCamera(layout, - follow ? followedCamera ?? mobileInitialCamera ?? camera ?? fitCamera(layout) - : camera ?? fitCamera(layout)); + follow && followedCamera ? followedCamera : camera ?? fitCamera(layout)); const presentEntities = new Set(inspector.stateAt(frameIndex).presentEntityIds); const selected = selectedId ? trace.artifact.entities.find(entity => entity.id === selectedId) From 2eb511cd214611c8faefa1ef6a1b049fba877ca6 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:57:11 +0100 Subject: [PATCH 68/80] test(player): assert the original authored graph box geometry, edge paths and highlight styling --- .../__tests__/player-layout.browser.test.tsx | 48 +++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/src/react/__tests__/player-layout.browser.test.tsx b/src/react/__tests__/player-layout.browser.test.tsx index 0b0e4304..54ad1371 100644 --- a/src/react/__tests__/player-layout.browser.test.tsx +++ b/src/react/__tests__/player-layout.browser.test.tsx @@ -2,6 +2,9 @@ import { expect, it } from "vitest"; import { page, userEvent } from "vitest/browser"; import { render } from "vitest-browser-react"; import { compileArtifact } from "../../v2/compiler.js"; +import { layoutGraph, layoutGraphView } from "../../v2/graph-layout.js"; +import { inspectTrace } from "../../v2/inspector.js"; +import { projectView } from "../../v2/views.js"; import { distributedGraph } from "../../__tests__/v2-graph-fixture.js"; import { ThroughlineGraphPlayer } from "../graph-player.js"; import "../../styles/throughline.css"; @@ -28,7 +31,7 @@ it("uses the compact player layout, not the legacy player composition", async () await expect.element(screen.getByRole("region", { name: "Message sequence evidence" })).toBeVisible(); }); -it("keeps the source palette, original graph card dimensions and real authored frame", async () => { +it("keeps the source palette, unchanged graph card dimensions and real authored frame", async () => { const screen = await render(); const shell = screen.getByRole("group", { name: "Visualization player" }).element(); expect(shell.classList.contains("player-shell")).toBe(true); @@ -36,8 +39,8 @@ it("keeps the source palette, original graph card dimensions and real authored f expect(css.getPropertyValue("--thl-active").trim()).not.toBe(""); const node = shell.querySelector(".thl-v2-diagram [data-node] .thl-node")!; expect(node).not.toBeNull(); - expect(Number(node.getAttribute("height"))).toBe(52); - expect(Number(node.getAttribute("width"))).toBe(116); + expect(Number(node.getAttribute("height"))).toBe(74); + expect(Number(node.getAttribute("width"))).toBe(188); await screen.getByRole("button", { name: "Step forward" }).click(); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 2 of 7"); expect(shell.querySelector(".canvas-meta")?.textContent).toContain("FRAME 01"); @@ -69,3 +72,42 @@ it("preserves the player sidebar drawer and control placement at mobile embed wi await userEvent.keyboard("{Home}"); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 1 of 7"); }); + +it("keeps authored node positions, original edge routes and semantic highlighting at changing host widths", async () => { + const compiled = trace(); + const inspector = inspectTrace(compiled); + const screen = await render(); + const player = screen.getByRole("group", { name: "Visualization player" }).element(); + const canvas = player.querySelector(".canvas")!; + const node = player.querySelector('[data-node="client"]')!; + const link = player.querySelector('.thl-v2-diagram [data-source-relation-ids="request"]')!; + expect(node).not.toBeNull(); + expect(link).not.toBeNull(); + const compareAuthoredGeometry = () => { + const layout = layoutGraph(compiled, Math.floor(canvas.clientWidth)); + const view = projectView(inspector, { kind: "graph", frameIndex: 0 }); + const geometry = layoutGraphView(layout, view); + const entity = view.items.find(item => item.role === "entity" && item.source.entityIds?.includes("client"))!; + const relation = view.items.find(item => item.role === "relation" && item.source.relationIds?.includes("request"))!; + const box = geometry.nodes[entity.id]; + return node.getAttribute("transform") === `translate(${box.x},${box.y})` + && Number(node.querySelector(".thl-node")?.getAttribute("width")) === box.w + && Number(node.querySelector(".thl-node")?.getAttribute("height")) === box.h + && link.querySelector(".thl-edge")?.getAttribute("d") === geometry.edges[relation.id]?.d; + }; + for (const width of [900, 375]) { + player.style.width = width + "px"; + await expect.poll(compareAuthoredGeometry).toBe(true); + expect(player.querySelectorAll(".thl-v2-diagram .entity")).toHaveLength(0); + expect(node.querySelector("circle")).toBeNull(); + expect(node.querySelector(".thl-v2-change")).toBeNull(); + const path = link.querySelector(".thl-edge")!; + expect(Number.parseFloat(getComputedStyle(path).strokeWidth)).toBeCloseTo(1.3); + } + await screen.getByRole("button", { name: "Step forward" }).click(); + await expect.element(screen.getByRole("status")).toHaveTextContent("Step 2 of 7"); + const activePath = link.querySelector(".thl-edge")!; + expect(link.classList.contains("thl-transferred")).toBe(true); + expect(Number.parseFloat(getComputedStyle(activePath).strokeWidth)).toBeCloseTo(2.5); + expect(activePath.getAttribute("stroke-dasharray")).toBeNull(); +}); From 98917567188c784b9c610b2d3ae1d2588b4cda4f Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 17:57:13 +0100 Subject: [PATCH 69/80] test(player): restore dynamic fit-camera regression instead of fixed demo width --- src/react/__tests__/v2-graph.browser.test.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/react/__tests__/v2-graph.browser.test.tsx b/src/react/__tests__/v2-graph.browser.test.tsx index c09fd0fe..8dba59f1 100644 --- a/src/react/__tests__/v2-graph.browser.test.tsx +++ b/src/react/__tests__/v2-graph.browser.test.tsx @@ -159,8 +159,7 @@ it("supports keyboard stepping, zoom and pan independently of v2 model state", a await userEvent.keyboard("{ArrowLeft}"); expect(viewBox()).not.toEqual(start); await userEvent.keyboard("0"); - expect(viewBox()[2]).toBeCloseTo(828); - expect(viewBox()[0]).toBeCloseTo(0); + expect(viewBox()).toEqual(start); screen.getByRole("group", { name: "Visualization player" }).element().focus(); await userEvent.keyboard("{ArrowRight}"); await expect.element(screen.getByRole("status")).toHaveTextContent("Step 2 of 7"); From 48cd21e98a54cc556b7907858dc3a393197e7345 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:00:34 +0100 Subject: [PATCH 70/80] fix(player): prevent selection and collapse controls from implicitly reframing authored nodes --- src/react/graph-player.tsx | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/react/graph-player.tsx b/src/react/graph-player.tsx index cd9c445e..cd30219d 100644 --- a/src/react/graph-player.tsx +++ b/src/react/graph-player.tsx @@ -467,23 +467,10 @@ export function ThroughlineGraphPlayer({ ? inspector.history(inspectSelected.id).filter(entry => entry.frameIndex <= frameIndex) : []; const onSelectEntity = (id: Id) => { setSelectedId(id); setInspectionMode("inspect"); }; - const focusEntity = (id: Id) => { - onSelectEntity(id); - const item = view.items.find(candidate => candidate.role === "entity" && - candidate.source.entityIds?.includes(id)); - const rect = item && geometry.nodes[item.id]; - if (rect && view.kind === "graph") - manual({ centerX: rect.x + rect.w / 2, centerY: rect.y + rect.h / 2, zoom: 2 }); - }; - const focusGroup = (id: Id | null) => { - setDrilled(id); - if (!id) { fit(); return; } - const item = view.items.find(candidate => candidate.role === "group" && - candidate.source.groupIds?.includes(id)); - const rect = item && (geometry.groups.find(rect => rect.id === item.id) ?? - geometry.nodes[item.id]); - if (rect) manual({ centerX: rect.x + rect.w / 2, centerY: rect.y + rect.h / 2, zoom: 2 }); - }; + // Selecting authored elements must never rewrite or reframe their graph + // geometry. Zoom/pan/follow are only explicit camera controls. + const focusEntity = (id: Id) => onSelectEntity(id); + const focusGroup = (id: Id | null) => setDrilled(id); const diagramControls = <>
    From 687f75bc1e440debc26ac7ff45a39d14e354e623 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:02:51 +0100 Subject: [PATCH 71/80] test(player): close inspector drawer before clicking authored group summary, retain selection --- src/react/__tests__/v2-graph.browser.test.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/react/__tests__/v2-graph.browser.test.tsx b/src/react/__tests__/v2-graph.browser.test.tsx index 8dba59f1..22344e35 100644 --- a/src/react/__tests__/v2-graph.browser.test.tsx +++ b/src/react/__tests__/v2-graph.browser.test.tsx @@ -79,11 +79,14 @@ it("collapses and expands nested groups without losing relation/event provenance expect(document.querySelector('[data-node="gateway"]')).toBeNull(); expect(link("settlement")?.getAttribute("data-source-relation-ids")).toBe("settlement"); expect(link("request")).toBeUndefined(); - // The options popover is intentionally layered over the diagram: close it - // before using the graphical group-summary button. + // The compact inspector is a drawer at narrow embed widths, and + // intentionally overlays graph hit targets. Close it before using the + // graphical group-summary button; selection must survive reopening. + await screen.getByRole("button", { name: "Close inspector" }).click(); await screen.getByRole("button", { name: "Expand group Frontend" }).click(); expect(document.querySelector('[data-node="gateway"]')).not.toBeNull(); expect(link("request")?.getAttribute("data-sent-current")).toBe("1"); + await screen.getByRole("button", { name: "Inspect", exact: true }).click(); expect(document.querySelector(".inspector .entity-heading")?.textContent).toContain("Gateway"); }); From fdd242571f87e0bad8efdfa38c00f10d0cf29c67 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:04:50 +0100 Subject: [PATCH 72/80] test(player): wait for native ResizeObserver before asserting camera fit at actual embed width --- src/react/__tests__/v2-graph.browser.test.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/react/__tests__/v2-graph.browser.test.tsx b/src/react/__tests__/v2-graph.browser.test.tsx index 22344e35..981829db 100644 --- a/src/react/__tests__/v2-graph.browser.test.tsx +++ b/src/react/__tests__/v2-graph.browser.test.tsx @@ -153,7 +153,10 @@ it("announces declared non-authored origins without upgrading modeled event evid it("supports keyboard stepping, zoom and pan independently of v2 model state", async () => { const screen = await render(); - await expect.poll(() => viewBox()[2]).toBeGreaterThan(0); + // ResizeObserver updates the authored graph geometry after the initial + // 720px SSR fallback. Record the fit viewport only after measurement. + await expect.poll(() => viewBox()[2]).toBe( + Math.floor(document.querySelector(".canvas")!.getBoundingClientRect().width)); const start = viewBox(); const svg = document.querySelector(".thl-v2-diagram")!; svg.focus(); From 425b40b3a84a4bee4242eac5eb04d45aa00ac8b9 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:06:04 +0100 Subject: [PATCH 73/80] fix(player): isolate design typography to chrome and retain original graph font family --- src/styles/throughline.css | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index 42f71c60..afccd8d7 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -2560,11 +2560,23 @@ padding: 0; border: 1px solid var(--thl-line); background: var(--thl-bg); - font-family: "DM Sans", system-ui, sans-serif; + font-family: inherit; font-size: 12px; line-height: 1.5; overflow: visible; } +/* Keep the compact shell typography separate from authored graph text. + * The SVG inherits the same host font family it used before this UI port. */ +.thl.player-shell .player-header, +.thl.player-shell .context-bar, +.thl.player-shell .inspector, +.thl.player-shell .transport, +.thl.player-shell .step-caption, +.thl.player-shell .options-menu, +.thl.player-shell .sequence-view, +.thl.player-shell .state-view { + font-family: "DM Sans", system-ui, sans-serif; +} .thl.player-shell :is(button, input, select) { font: inherit; } .thl.player-shell .thl-v2-sequence, .thl.player-shell .thl-v2-fallback { min-width: 0; } From b30cbe3893077430b243f95570c8c26da2c4bebc Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:15:34 +0100 Subject: [PATCH 74/80] feat(player): overlay inspector up to 60%, full-player mobile panel and one vertical scroll --- src/styles/throughline.css | 130 ++++++++++++++++++++++++++++--------- 1 file changed, 98 insertions(+), 32 deletions(-) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index afccd8d7..da2c2e1f 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -1303,11 +1303,14 @@ margin: 0 7px 2px; background: var(--thl-muted); }.thl.player-shell .player-content{ + position: relative; display: grid; grid-template-columns: minmax(0, 1fr); min-height: 330px; }.thl.player-shell .player-content.with-inspector{ - grid-template-columns: minmax(0, 1fr) 246px; + /* Inspector overlays the unchanged canvas, so opening it never causes + authored graph layout to recalculate for a narrower viewport. */ + grid-template-columns: minmax(0, 1fr); }.thl.player-shell .canvas{ min-width: 0; min-height: 330px; @@ -1479,11 +1482,23 @@ }.thl.player-shell .state-row.future{ opacity: 0.3; }.thl.player-shell .inspector{ + position: absolute; + inset-block: 0; + inset-inline-end: 0; + z-index: 10; + box-sizing: border-box; + width: min(60%, 48rem); min-width: 0; - border-left: 1px solid var(--line); + min-height: 0; + max-height: 100%; + overflow-x: hidden; + overflow-y: auto; + overscroll-behavior: contain; + scrollbar-gutter: stable; + border-inline-start: 1px solid var(--line); background: var(--thl-panel); - padding: 12px; - + box-shadow: -18px 0 36px color-mix(in srgb, var(--thl-bg) 65%, transparent); + padding: 12px 16px 20px; } @keyframes thl-player-reveal { from { @@ -1491,22 +1506,41 @@ transform: none; } }.thl.player-shell .inspector-top{ + position: sticky; + top: -12px; + z-index: 1; display: flex; align-items: center; justify-content: space-between; + gap: 12px; + min-height: 44px; + margin: -12px -16px 0; + padding: 5px 12px 5px 16px; + border-bottom: 1px solid var(--line); + background: var(--thl-panel); color: var(--thl-muted); font: 500 8px "IBM Plex Mono", monospace; letter-spacing: 0.08em; }.thl.player-shell .inspector-top button{ - width: 22px; - height: 22px; + display: grid; + place-items: center; + width: 40px; + height: 40px; + flex: 0 0 auto; border: 0; + border-radius: var(--radius); background: transparent; - color: var(--thl-muted); - font-size: 17px; + color: var(--thl-text); + font-size: 20px; + line-height: 1; cursor: pointer; +}.thl.player-shell .inspector-top button:hover{ + background: var(--thl-control-hover); +}.thl.player-shell .inspector-top button:focus-visible{ + outline: 2px solid var(--thl-focus); + outline-offset: -2px; }.thl.player-shell .entity-heading{ display: flex; gap: 9px; @@ -1537,19 +1571,24 @@ }.thl.player-shell .inspector dl > div{ min-height: 27px; display: grid; - grid-template-columns: 80px 1fr; - align-items: center; + grid-template-columns: minmax(80px, 30%) minmax(0, 1fr); + gap: 8px; + align-items: start; }.thl.player-shell .inspector dt{ color: var(--thl-muted); font-size: 9px; }.thl.player-shell .inspector dd{ + min-width: 0; margin: 0; color: var(--thl-text); font: 400 9px "IBM Plex Mono", monospace; - overflow: hidden; - text-overflow: ellipsis; + white-space: normal; + overflow-wrap: anywhere; +}.thl.player-shell .inspector dd code{ + white-space: pre-wrap; + overflow-wrap: anywhere; }.thl.player-shell .known{ color: var(--acid); }.thl.player-shell .history-title{ @@ -1790,18 +1829,7 @@ .thl.player-shell .truth-note, .thl.player-shell .header-actions button span{ display: none; - }.thl.player-shell .player-content.with-inspector{ - grid-template-columns: 1fr; - }.thl.player-shell .inspector{ - position: absolute; - z-index: 10; - right: 0; - top: 0; - bottom: 0; - width: min(270px, 86%); - box-shadow: -20px 0 40px rgba(0, 0, 0, 0.4); }.thl.player-shell .player-content{ - position: relative; min-height: 310px; }.thl.player-shell .canvas{ min-height: 310px; @@ -2604,12 +2632,22 @@ .thl.player-shell .state-row:focus-visible, .thl.player-shell .view-tabs button:focus-visible { outline: 2px solid var(--thl-focus); outline-offset: -2px; } -.thl.player-shell .inspector { overflow-y: auto; max-height: 600px; } -.thl.player-shell .inspector .thl-v2-inspect { max-width: 100%; min-width: 0; overflow-wrap: anywhere; } -.thl.player-shell .inspector .thl-v2-inspect pre { white-space: pre-wrap; overflow-wrap: anywhere; } +.thl.player-shell .inspector .thl-v2-inspect { + max-width: 100%; + min-width: 0; + max-height: none; + overflow: visible; + padding: 0; + gap: 0.75rem; + overflow-wrap: anywhere; +} +.thl.player-shell .inspector .thl-v2-inspect pre { + max-width: 100%; + white-space: pre-wrap; + overflow-wrap: anywhere; +} .thl.player-shell .thl-sr-only { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; } @container (max-width: 760px) { - .thl.player-shell .player-content .inspector { max-height: none; } .thl.player-shell .canvas { height: 310px; } } @container (max-width: 480px) { @@ -2709,16 +2747,44 @@ .thl.player-shell .inspector { min-width: 0; max-width: 100%; - overflow-x: clip; } -@container (max-width: 760px) { - .thl.player-shell .player-content.with-inspector { - grid-template-columns: minmax(0, 1fr); +@container (max-width: 560px) { + /* An embedded mobile player stays inside its host. When the player itself + goes fullscreen, the inspector consequently fills that fullscreen view. */ + .thl.player-shell { + position: relative; + } + .thl.player-shell .player-content { + position: static; } .thl.player-shell .player-content .inspector { - max-width: min(270px, 86%); + width: 100%; + max-width: 100%; + height: 100%; + max-height: 100%; + border-inline-start: 0; + box-shadow: none; } } +/* The inspector alone scrolls vertically; disclosure panels remain part of + that same reading surface rather than introducing a second scrollbar. */ +.thl.player-shell .inspector .evidence-note { + min-width: 0; +} +.thl.player-shell .inspector .evidence-note :is(pre, table) { + overflow-x: visible; + white-space: pre-wrap; + overflow-wrap: anywhere; +} +.thl.player-shell .inspector .evidence-note table { + display: table; + width: 100%; + table-layout: fixed; +} +.thl.player-shell .history-item > div { + min-width: 0; +} + .thl.player-shell .seq-empty { margin: 0; From 23b5392c495e9b4b9ae08d10ee59c1b803590316 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:16:51 +0100 Subject: [PATCH 75/80] fix(player): keep inspector close action fully visible while scrolling --- src/styles/throughline.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index da2c2e1f..12d8555b 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -1507,7 +1507,7 @@ } }.thl.player-shell .inspector-top{ position: sticky; - top: -12px; + top: 0; z-index: 1; display: flex; align-items: center; From cd563b5f0a641be1246aeb46d283115696b63888 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:17:14 +0100 Subject: [PATCH 76/80] test(player): enforce 60% overlay, full mobile inspector, one scroll and stable authored graph --- .../__tests__/player-layout.browser.test.tsx | 49 ++++++++++++++++--- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/src/react/__tests__/player-layout.browser.test.tsx b/src/react/__tests__/player-layout.browser.test.tsx index 54ad1371..6a96ecec 100644 --- a/src/react/__tests__/player-layout.browser.test.tsx +++ b/src/react/__tests__/player-layout.browser.test.tsx @@ -47,20 +47,55 @@ it("keeps the source palette, unchanged graph card dimensions and real authored expect(shell.querySelectorAll("[data-source-event-ids]").length).toBeGreaterThan(0); }); -it("preserves the player sidebar drawer and control placement at mobile embed widths", async () => { - await page.viewport(900, 800); - const screen = await render(); +it("keeps a 60% inspector overlay, full-player mobile coverage and a single reading scroll", async () => { + await page.viewport(1200, 900); + const compiled = trace(); + const screen = await render(); const shell = screen.getByRole("group", { name: "Visualization player" }).element(); - for (const width of [768, 375, 260]) { + const canvas = shell.querySelector(".canvas")!; + const svg = shell.querySelector(".thl-v2-diagram")!; + for (const width of [900, 768, 600, 560, 375, 260]) { shell.style.width = width + "px"; await expect.poll(() => Math.round(shell.getBoundingClientRect().width)).toBe(width); - expect(shell.scrollWidth).toBeLessThanOrEqual(shell.clientWidth + 2); + await expect.poll(() => Number(svg.getAttribute("viewBox")?.split(" ")[2])) + .toBe(layoutGraph(compiled, canvas.clientWidth).width); + const originalCanvasWidth = canvas.clientWidth; + const originalViewBox = svg.getAttribute("viewBox"); + const originalNode = shell.querySelector('[data-node="client"]')?.getAttribute("transform"); await screen.getByRole("button", { name: "Inspect", exact: true }).click(); const inspector = screen.getByRole("complementary", { name: "Entity inspector" }); await expect.element(inspector).toBeVisible(); - expect(shell.querySelector(".player-content.with-inspector")).not.toBeNull(); + const panel = inspector.element(); + const panelRect = panel.getBoundingClientRect(); + const playerRect = shell.getBoundingClientRect(); + const contentRect = shell.querySelector(".player-content")!.getBoundingClientRect(); + const expectedWidth = width <= 560 ? playerRect.width - 2 : Math.min(contentRect.width * .6, 768); + expect(Math.abs(panelRect.width - expectedWidth)).toBeLessThanOrEqual(3); + expect(Math.abs(panelRect.right - playerRect.right)).toBeLessThanOrEqual(3); + if (width <= 560) { + // The mobile inspector covers its entire embedded player, including + // header and transport, but never escapes the host page. + expect(Math.abs(panelRect.top - playerRect.top)).toBeLessThanOrEqual(3); + expect(Math.abs(panelRect.bottom - playerRect.bottom)).toBeLessThanOrEqual(3); + } else { + expect(Math.abs(panelRect.top - contentRect.top)).toBeLessThanOrEqual(3); + expect(Math.abs(panelRect.bottom - contentRect.bottom)).toBeLessThanOrEqual(3); + } + expect(getComputedStyle(panel).overflowY).toBe("auto"); + expect(canvas.clientWidth).toBe(originalCanvasWidth); + expect(svg.getAttribute("viewBox")).toBe(originalViewBox); + expect(shell.querySelector('[data-node="client"]')?.getAttribute("transform")).toBe(originalNode); expect(shell.scrollWidth).toBeLessThanOrEqual(shell.clientWidth + 2); - await screen.getByRole("button", { name: "Close inspector" }).click(); + await screen.getByText("CAUSAL EVIDENCE").click(); + const evidence = panel.querySelector(".thl-v2-inspect")!; + expect(evidence).not.toBeNull(); + expect(getComputedStyle(evidence).overflowY).toBe("visible"); + expect(getComputedStyle(evidence).maxHeight).toBe("none"); + const close = screen.getByRole("button", { name: "Close inspector" }); + panel.scrollTop = panel.scrollHeight; + await expect.poll(() => close.element().getBoundingClientRect().top - + panel.getBoundingClientRect().top).toBeGreaterThanOrEqual(0); + await close.click(); } await screen.getByRole("button", { name: "Player options" }).click(); await expect.element(screen.getByRole("group", { name: "Player options" })).toBeVisible(); From 9d7ca5b92ce24c34a8eda10aeb7456fd79fdd461 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:19:36 +0100 Subject: [PATCH 77/80] fix(player): establish mobile inspector containing block on player root outside container query --- src/styles/throughline.css | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index 12d8555b..64593c86 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -1159,6 +1159,7 @@ /* Player layout; palette intentionally comes from --thl-* above. */ .thl.player-shell{ + position: relative; background: color-mix(in srgb, var(--thl-panel) 97%, transparent); border: 1px solid var(--thl-line); border-radius: var(--radius); @@ -2751,9 +2752,6 @@ @container (max-width: 560px) { /* An embedded mobile player stays inside its host. When the player itself goes fullscreen, the inspector consequently fills that fullscreen view. */ - .thl.player-shell { - position: relative; - } .thl.player-shell .player-content { position: static; } From d5c9314c079dfc8a5bd6d7c08f79d3f19afe9ec4 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:21:27 +0100 Subject: [PATCH 78/80] fix(player): full-width mobile inspector over visualization, keep frame controls reachable --- src/styles/throughline.css | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/styles/throughline.css b/src/styles/throughline.css index 64593c86..c049429a 100644 --- a/src/styles/throughline.css +++ b/src/styles/throughline.css @@ -2750,11 +2750,9 @@ max-width: 100%; } @container (max-width: 560px) { - /* An embedded mobile player stays inside its host. When the player itself - goes fullscreen, the inspector consequently fills that fullscreen view. */ - .thl.player-shell .player-content { - position: static; - } + /* The panel fills the visualization at narrow embed widths, while the + player header, view tabs, and transport remain operable for inspection + across frames. Never take over the embedding document's viewport. */ .thl.player-shell .player-content .inspector { width: 100%; max-width: 100%; From 4de5449f272a3179471c1e56793e11d632bef65d Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:21:40 +0100 Subject: [PATCH 79/80] test(player): verify full mobile visualization overlay with accessible transport and exact evidence summary --- .../__tests__/player-layout.browser.test.tsx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/react/__tests__/player-layout.browser.test.tsx b/src/react/__tests__/player-layout.browser.test.tsx index 6a96ecec..64d63d3e 100644 --- a/src/react/__tests__/player-layout.browser.test.tsx +++ b/src/react/__tests__/player-layout.browser.test.tsx @@ -47,7 +47,7 @@ it("keeps the source palette, unchanged graph card dimensions and real authored expect(shell.querySelectorAll("[data-source-event-ids]").length).toBeGreaterThan(0); }); -it("keeps a 60% inspector overlay, full-player mobile coverage and a single reading scroll", async () => { +it("keeps a 60% inspector overlay, full-width mobile coverage and a single reading scroll", async () => { await page.viewport(1200, 900); const compiled = trace(); const screen = await render(); @@ -72,21 +72,16 @@ it("keeps a 60% inspector overlay, full-player mobile coverage and a single read const expectedWidth = width <= 560 ? playerRect.width - 2 : Math.min(contentRect.width * .6, 768); expect(Math.abs(panelRect.width - expectedWidth)).toBeLessThanOrEqual(3); expect(Math.abs(panelRect.right - playerRect.right)).toBeLessThanOrEqual(3); - if (width <= 560) { - // The mobile inspector covers its entire embedded player, including - // header and transport, but never escapes the host page. - expect(Math.abs(panelRect.top - playerRect.top)).toBeLessThanOrEqual(3); - expect(Math.abs(panelRect.bottom - playerRect.bottom)).toBeLessThanOrEqual(3); - } else { - expect(Math.abs(panelRect.top - contentRect.top)).toBeLessThanOrEqual(3); - expect(Math.abs(panelRect.bottom - contentRect.bottom)).toBeLessThanOrEqual(3); - } + // The overlay replaces the visualization surface while the header and + // playback controls remain accessible for stepping through evidence. + expect(Math.abs(panelRect.top - contentRect.top)).toBeLessThanOrEqual(3); + expect(Math.abs(panelRect.bottom - contentRect.bottom)).toBeLessThanOrEqual(3); expect(getComputedStyle(panel).overflowY).toBe("auto"); expect(canvas.clientWidth).toBe(originalCanvasWidth); expect(svg.getAttribute("viewBox")).toBe(originalViewBox); expect(shell.querySelector('[data-node="client"]')?.getAttribute("transform")).toBe(originalNode); expect(shell.scrollWidth).toBeLessThanOrEqual(shell.clientWidth + 2); - await screen.getByText("CAUSAL EVIDENCE").click(); + await screen.getByText("CAUSAL EVIDENCE", { exact: true }).click(); const evidence = panel.querySelector(".thl-v2-inspect")!; expect(evidence).not.toBeNull(); expect(getComputedStyle(evidence).overflowY).toBe("visible"); From 8175024c4d866c6b7c9cb7c579dd7d2332ad7fb3 Mon Sep 17 00:00:00 2001 From: "Christopher S. Aondona" Date: Mon, 16 Nov 2026 18:23:36 +0100 Subject: [PATCH 80/80] test(player): close overlaid inspector before selecting another sequence actor --- src/react/__tests__/v2-sequence.browser.test.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/react/__tests__/v2-sequence.browser.test.tsx b/src/react/__tests__/v2-sequence.browser.test.tsx index 85803b60..03a62e5d 100644 --- a/src/react/__tests__/v2-sequence.browser.test.tsx +++ b/src/react/__tests__/v2-sequence.browser.test.tsx @@ -172,6 +172,9 @@ it("preserves frame and source identity switching graph → sequence → graph", await expect.element(screen.getByRole("status")).toHaveTextContent("Step 3 of 10"); expect(document.querySelector('.sequence-head [data-source-entity-ids="gateway"]') ?.getAttribute("aria-pressed")).toBe("true"); + // The responsive inspector intentionally overlays source lanes. Close it + // before selecting another lane, then verify the new selection reopens it. + await screen.getByRole("button", { name: "Close inspector" }).click(); await screen.getByRole("button", { name: "Inspect Client" }).click(); expect(document.querySelector(".inspector .entity-heading")?.textContent).toContain("Client"); await screen.getByRole("tab", { name: "Graph" }).click();