From 32bff67f4166611a533a303d6b3cb6fb1c4cabd2 Mon Sep 17 00:00:00 2001 From: bailey <74082460+bmjcoding@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:40:48 -0600 Subject: [PATCH 01/13] Stages batch 1 (DECISIONS 316): the six tokens, StageMark, RunTimer, StageBadge, RunAnnouncer and the rule text The opacity tokens recede-2 to -5, recede-danger and queued, with their contrast pairs; the seven states' mark with its crossfade and the queued breath on the shared clock; a run's time with one shared interval, seats by scale, carried and since; a status that changes face in place from a static measure; the run's one voice. Foundations, motion.md and AGENTS.md take section 4's six rule changes and the new "Stages and runs" section, and motion-docs holds the loops sentence's new wording. Not reviewed: the council decided it; the implementation is unreviewed. Co-Authored-By: Claude Opus 5.5 --- .agent/skills/basalt-html/parts/core.css | 2 +- AGENTS.md | 20 +- docs/foundations.md | 138 ++++++++++-- docs/motion.md | 18 +- packages/react/src/index.ts | 11 + packages/react/src/run-announcer.tsx | 38 ++++ packages/react/src/run-format.ts | 43 ++++ packages/react/src/run-timer.tsx | 145 ++++++++++++ packages/react/src/run-warn.ts | 16 ++ packages/react/src/spinner.tsx | 2 +- packages/react/src/stage-badge.tsx | 81 +++++++ packages/react/src/stage-mark.tsx | 87 ++++++++ packages/react/src/styles/components.css | 68 ++++++ packages/react/test/bundle.test.mjs | 14 ++ packages/react/test/demo-runs.tsx | 27 +++ packages/react/test/demo.tsx | 2 + packages/react/test/export-sizes.json | 14 +- packages/react/test/loops.test.mjs | 22 ++ packages/react/test/motion-docs.test.mjs | 27 ++- packages/react/test/run-announcer.test.mjs | 81 +++++++ packages/react/test/run-timer.test.mjs | 189 ++++++++++++++++ packages/react/test/server-modules.test.mjs | 2 +- packages/react/test/stage-badge.test.mjs | 129 +++++++++++ packages/react/test/stage-mark.test.mjs | 206 ++++++++++++++++++ packages/tokens/test/contrast.test.mjs | 56 +++++ packages/tokens/tokens/primitives.tokens.json | 26 +++ 26 files changed, 1430 insertions(+), 34 deletions(-) create mode 100644 packages/react/src/run-announcer.tsx create mode 100644 packages/react/src/run-format.ts create mode 100644 packages/react/src/run-timer.tsx create mode 100644 packages/react/src/run-warn.ts create mode 100644 packages/react/src/stage-badge.tsx create mode 100644 packages/react/src/stage-mark.tsx create mode 100644 packages/react/test/demo-runs.tsx create mode 100644 packages/react/test/run-announcer.test.mjs create mode 100644 packages/react/test/run-timer.test.mjs create mode 100644 packages/react/test/stage-badge.test.mjs create mode 100644 packages/react/test/stage-mark.test.mjs diff --git a/.agent/skills/basalt-html/parts/core.css b/.agent/skills/basalt-html/parts/core.css index cb2a2817..468f10be 100644 --- a/.agent/skills/basalt-html/parts/core.css +++ b/.agent/skills/basalt-html/parts/core.css @@ -1 +1 @@ -:root{--basalt-neutral-0: oklch(0 0 0);--basalt-neutral-4: oklch(.1448 0 0);--basalt-neutral-7: oklch(.1776 0 0);--basalt-neutral-9: oklch(.2046 0 0);--basalt-neutral-20: oklch(.3211 0 0);--basalt-neutral-30: oklch(.4202 0 0);--basalt-neutral-36: oklch(.4748 0 0);--basalt-neutral-42: oklch(.5278 0 0);--basalt-neutral-52: oklch(.6167 0 0);--basalt-neutral-59: oklch(.675 0 0);--basalt-neutral-63: oklch(.709 0 0);--basalt-neutral-64: oklch(.7155 0 0);--basalt-neutral-73: oklch(.79 0 0);--basalt-neutral-75: oklch(.8047 0 0);--basalt-neutral-93: oklch(.9461 0 0);--basalt-neutral-94: oklch(.9551 0 0);--basalt-neutral-96: oklch(.9702 0 0);--basalt-neutral-98: oklch(.9851 0 0);--basalt-neutral-100: oklch(1 0 0);--basalt-neutral-42-4: oklch(.53 0 0);--basalt-neutral-95-7: oklch(.966 0 0);--basalt-white-6: oklch(1 0 0 / .06);--basalt-white-8: oklch(1 0 0 / .08);--basalt-white-9: oklch(1 0 0 / .09);--basalt-white-15: oklch(1 0 0 / .145);--basalt-white-24: oklch(1 0 0 / .24);--basalt-white-38: oklch(1 0 0 / .38);--basalt-black-4: oklch(0 0 0 / .04);--basalt-black-6: oklch(0 0 0 / .06);--basalt-black-7: oklch(0 0 0 / .07);--basalt-black-8: oklch(0 0 0 / .08);--basalt-black-10: oklch(0 0 0 / .1);--basalt-black-16: oklch(0 0 0 / .16);--basalt-black-18: oklch(0 0 0 / .18);--basalt-black-24: oklch(0 0 0 / .24);--basalt-black-40: oklch(0 0 0 / .4);--basalt-black-45: oklch(0 0 0 / .45);--basalt-black-60: oklch(0 0 0 / .6);--basalt-black-80: oklch(0 0 0 / .8);--basalt-status-danger-dark: oklch(.7 .191 22);--basalt-status-success-dark: oklch(.73 .211 148);--basalt-status-warning-dark: oklch(.79 .171 70);--basalt-status-danger-light: oklch(.51 .19 25);--basalt-status-success-light: oklch(.55 .159 148);--basalt-status-warning-light: oklch(.6 .137 62);--basalt-space-0: 0px;--basalt-space-1: 4px;--basalt-space-2: 8px;--basalt-space-3: 12px;--basalt-space-4: 16px;--basalt-space-5: 20px;--basalt-space-6: 24px;--basalt-space-8: 32px;--basalt-space-10: 40px;--basalt-space-12: 48px;--basalt-space-16: 64px;--basalt-space-24: 96px;--basalt-space-0-5: 2px;--basalt-space-1-5: 6px;--basalt-space-2-5: 10px;--basalt-space-3-5: 14px;--basalt-radius-2xs: 2px;--basalt-radius-xs: 4px;--basalt-radius-sm: 6px;--basalt-radius-md: 8px;--basalt-radius-lg: 12px;--basalt-radius-xl: 16px;--basalt-radius-full: 9999px;--basalt-size-control-xs: 24px;--basalt-size-control-sm: 28px;--basalt-size-control-md: 32px;--basalt-size-control-lg: 36px;--basalt-size-control-xl: 40px;--basalt-size-control-2xl: 44px;--basalt-size-control-3xl: 48px;--basalt-size-control-4xl: 52px;--basalt-size-control-5xl: 56px;--basalt-size-control-6xl: 64px;--basalt-size-menu-row: 36px;--basalt-size-menu-row-touch: 44px;--basalt-size-tap-min: 44px;--basalt-size-icon-sm: 16px;--basalt-size-icon-md: 20px;--basalt-size-icon-lg: 24px;--basalt-size-focus-width: 2px;--basalt-size-focus-offset: 2px;--basalt-size-hairline: 1px;--basalt-size-indicator: 2px;--basalt-size-description-label: 160px;--basalt-size-field-label-inline: 80px;--basalt-size-track: 4px;--basalt-size-dot: 6px;--basalt-size-choice: 16px;--basalt-size-choice-mark: 12px;--basalt-size-switch-width: 32px;--basalt-size-switch-height: 18px;--basalt-size-switch-thumb: 14px;--basalt-size-kbd: 20px;--basalt-size-badge: 22px;--basalt-size-table-row: 40px;--basalt-size-command-input: 48px;--basalt-size-code-line-height: 20px;--basalt-size-underline-offset: 3px;--basalt-size-slider-length: 180px;--basalt-size-dialog-width: 480px;--basalt-size-sheet-width: 440px;--basalt-size-command-width: 560px;--basalt-size-dialog-width-wide: 992px;--basalt-size-search-trigger: 200px;--basalt-size-search-logo-width: 96px;--basalt-size-search-logo-height: 48px;--basalt-size-search-pack-width: 48px;--basalt-size-search-pack-height: 60px;--basalt-size-toast-width: 360px;--basalt-size-popover-max: 320px;--basalt-size-tooltip-max: 280px;--basalt-size-menu-min: 200px;--basalt-size-select-min: 160px;--basalt-size-popup-max-height: 360px;--basalt-size-list-width: 320px;--basalt-size-header: 56px;--basalt-size-tab-bar: 56px;--basalt-size-sidebar-width: 256px;--basalt-size-rail-width: 72px;--basalt-size-page-width: 72rem;--basalt-size-prose-width: 34rem;--basalt-size-gutter: var(--basalt-space-6);--basalt-size-gutter-narrow: var(--basalt-space-4);--basalt-size-breakpoint-md: 720px;--basalt-size-breakpoint-lg: 1024px;--basalt-size-breakpoint-container: 480px;--basalt-size-breakpoint-container-sm: 340px;--basalt-size-breakpoint-container-lg: 640px;--basalt-size-cut: 2px;--basalt-size-hatch-pitch: 4px;--basalt-size-meter-marker: 12px;--basalt-opacity-amount: .72;--basalt-font-family-sans: Geist, "Geist Fallback", ui-sans-serif, system-ui, sans-serif;--basalt-font-family-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;--basalt-font-weight-regular: 400;--basalt-font-weight-medium: 500;--basalt-font-weight-semibold: 600;--basalt-text-xs-size: 12px;--basalt-text-xs-line-height: 16px;--basalt-text-xs-tracking: .01em;--basalt-text-sm-size: 13px;--basalt-text-sm-line-height: 18px;--basalt-text-sm-tracking: 0em;--basalt-text-base-size: 14px;--basalt-text-base-line-height: 20px;--basalt-text-base-tracking: 0em;--basalt-text-md-size: 16px;--basalt-text-md-line-height: 24px;--basalt-text-md-tracking: -.005em;--basalt-text-lg-size: 18px;--basalt-text-lg-line-height: 26px;--basalt-text-lg-tracking: -.01em;--basalt-text-xl-size: 20px;--basalt-text-xl-line-height: 28px;--basalt-text-xl-tracking: -.015em;--basalt-text-2xl-size: 24px;--basalt-text-2xl-line-height: 30px;--basalt-text-2xl-tracking: -.02em;--basalt-text-3xl-size: 30px;--basalt-text-3xl-line-height: 36px;--basalt-text-3xl-tracking: -.025em;--basalt-text-4xl-size: 40px;--basalt-text-4xl-line-height: 44px;--basalt-text-4xl-tracking: -.03em;--basalt-text-5xl-size: 56px;--basalt-text-5xl-line-height: 60px;--basalt-text-5xl-tracking: -.035em;--basalt-blur-chrome: 12px;--basalt-duration-instant: 0ms;--basalt-duration-fast: .1s;--basalt-duration-base: .15s;--basalt-duration-slow: .2s;--basalt-duration-slower: .3s;--basalt-duration-confirm: 1.5s;--basalt-duration-figure: .6s;--basalt-duration-stagger: 22ms;--basalt-duration-loop-ring: .64s;--basalt-duration-loop-braille: .8s;--basalt-duration-loop-fade: 1.2s;--basalt-duration-loop-ambient: 6s;--basalt-ease-out: cubic-bezier(.16, 1, .3, 1);--basalt-ease-in-out: cubic-bezier(.65, 0, .35, 1);--basalt-ease-in: cubic-bezier(.4, 0, 1, 1);--basalt-ease-linear: cubic-bezier(0, 0, 1, 1);--basalt-layer-base: 0;--basalt-layer-sticky: 100;--basalt-layer-overlay: 500;--basalt-layer-popover: 600;--basalt-layer-dialog: 700;--basalt-layer-toast: 800;--basalt-layer-tooltip: 1100}:root,[data-theme=light],.light{color-scheme:light;--basalt-status-danger: var(--basalt-status-danger-light);--basalt-status-success: var(--basalt-status-success-light);--basalt-status-warning: var(--basalt-status-warning-light);--basalt-syntax-keyword: oklch(.5 .12 255);--basalt-syntax-string: oklch(.5 .12 150);--basalt-syntax-constant: oklch(.5 .1 70);--basalt-syntax-function: oklch(.5 .12 305);--basalt-syntax-comment: var(--basalt-text-tertiary);--basalt-surface-0: var(--basalt-neutral-98);--basalt-surface-1: var(--basalt-neutral-100);--basalt-surface-2: var(--basalt-neutral-100);--basalt-surface-3: var(--basalt-neutral-100);--basalt-surface-page: var(--basalt-surface-0);--basalt-surface-raised: var(--basalt-surface-1);--basalt-surface-overlay: var(--basalt-surface-2);--basalt-surface-top: var(--basalt-surface-3);--basalt-surface-sunken: var(--basalt-neutral-96);--basalt-surface-well-2: var(--basalt-surface-sunken);--basalt-surface-well-3: var(--basalt-surface-sunken);--basalt-surface-sunken-strong: var(--basalt-neutral-94);--basalt-surface-kbd: var(--basalt-black-6);--basalt-surface-chrome: oklch(.9851 0 0 / .96);--basalt-surface-placeholder: var(--basalt-neutral-94);--basalt-text-primary: var(--basalt-neutral-9);--basalt-text-secondary: var(--basalt-neutral-30);--basalt-text-tertiary: var(--basalt-neutral-42);--basalt-text-disabled: var(--basalt-neutral-64);--basalt-text-inverse: var(--basalt-neutral-100);--basalt-border-rim: var(--basalt-black-8);--basalt-border-rim-top: var(--basalt-black-8);--basalt-border-hairline: var(--basalt-black-8);--basalt-border-hover: var(--basalt-black-16);--basalt-border-divider: var(--basalt-black-8);--basalt-border-input: var(--basalt-black-45);--basalt-border-field: var(--basalt-border-input);--basalt-border-focus: var(--basalt-neutral-30);--basalt-state-hover: var(--basalt-black-4);--basalt-state-selected: var(--basalt-black-7);--basalt-plate-0: oklch(.9325 0 0);--basalt-plate-1: oklch(.9466 0 0);--basalt-plate-2: oklch(.9466 0 0);--basalt-plate-3: oklch(.9466 0 0);--basalt-action-primary: var(--basalt-neutral-9);--basalt-action-primary-hover: var(--basalt-neutral-0);--basalt-action-primary-press: var(--basalt-neutral-20);--basalt-action-primary-text: var(--basalt-neutral-100);--basalt-line-contrast: var(--basalt-black-45);--basalt-ink-contrast: var(--basalt-neutral-30);--basalt-field-contrast: var(--basalt-neutral-30);--basalt-scrim: var(--basalt-black-40);--basalt-shadow-hairline: 0px 0px 0px 1px oklch(0 0 0 / .08), 0px 0px 0px 1px oklch(.9851 0 0);--basalt-shadow-overlay: 0px 4px 8px -4px oklch(0 0 0 / .06), 0px 16px 24px -8px oklch(0 0 0 / .1);--basalt-shadow-modal: 0px 8px 16px -4px oklch(0 0 0 / .06), 0px 24px 32px -8px oklch(0 0 0 / .1)}[data-theme=dark],.dark{color-scheme:dark;--basalt-status-danger: var(--basalt-status-danger-dark);--basalt-status-success: var(--basalt-status-success-dark);--basalt-status-warning: var(--basalt-status-warning-dark);--basalt-syntax-keyword: oklch(.8 .09 255);--basalt-syntax-string: oklch(.8 .09 150);--basalt-syntax-constant: oklch(.8 .09 70);--basalt-syntax-function: oklch(.8 .09 305);--basalt-syntax-comment: var(--basalt-text-tertiary);--basalt-surface-0: var(--basalt-neutral-0);--basalt-surface-1: var(--basalt-neutral-4);--basalt-surface-2: var(--basalt-neutral-7);--basalt-surface-3: var(--basalt-neutral-9);--basalt-surface-page: var(--basalt-surface-0);--basalt-surface-raised: var(--basalt-surface-1);--basalt-surface-overlay: var(--basalt-surface-2);--basalt-surface-top: var(--basalt-surface-3);--basalt-surface-sunken: var(--basalt-surface-1);--basalt-surface-well-2: var(--basalt-surface-2);--basalt-surface-well-3: var(--basalt-surface-3);--basalt-surface-sunken-strong: var(--basalt-surface-2);--basalt-surface-kbd: var(--basalt-white-8);--basalt-surface-chrome: oklch(0 0 0 / .925);--basalt-surface-placeholder: var(--basalt-neutral-9);--basalt-text-primary: var(--basalt-neutral-95-7);--basalt-text-secondary: var(--basalt-neutral-73);--basalt-text-tertiary: var(--basalt-neutral-59);--basalt-text-disabled: var(--basalt-neutral-42-4);--basalt-text-inverse: var(--basalt-neutral-0);--basalt-border-hairline: var(--basalt-white-15);--basalt-border-rim: var(--basalt-white-6);--basalt-border-rim-top: var(--basalt-white-8);--basalt-border-hover: var(--basalt-white-24);--basalt-border-divider: var(--basalt-white-6);--basalt-border-input: var(--basalt-white-38);--basalt-border-field: var(--basalt-border-input);--basalt-border-focus: var(--basalt-text-secondary);--basalt-state-hover: var(--basalt-white-6);--basalt-state-selected: var(--basalt-white-9);--basalt-plate-0: oklch(.2438 0 0);--basalt-plate-1: oklch(.2703 0 0);--basalt-plate-2: oklch(.2926 0 0);--basalt-plate-3: oklch(.2926 0 0);--basalt-action-primary: var(--basalt-neutral-93);--basalt-action-primary-hover: var(--basalt-neutral-100);--basalt-action-primary-press: var(--basalt-neutral-75);--basalt-action-primary-text: var(--basalt-neutral-0);--basalt-line-contrast: var(--basalt-white-38);--basalt-ink-contrast: var(--basalt-text-secondary);--basalt-field-contrast: var(--basalt-text-secondary);--basalt-scrim: var(--basalt-black-80);--basalt-shadow-hairline: 0px 0px 0px 1px oklch(1 0 0 / .145), 0px 0px 0px 1px oklch(0 0 0);--basalt-shadow-overlay: 0px 4px 8px -4px oklch(0 0 0 / .24), 0px 16px 24px -8px oklch(0 0 0 / .4);--basalt-shadow-modal: 0px 8px 16px -4px oklch(0 0 0 / .24), 0px 24px 32px -8px oklch(0 0 0 / .6)}@media(prefers-color-scheme:dark){:root:not([data-theme=light]):not(.light){color-scheme:dark;--basalt-status-danger: var(--basalt-status-danger-dark);--basalt-status-success: var(--basalt-status-success-dark);--basalt-status-warning: var(--basalt-status-warning-dark);--basalt-syntax-keyword: oklch(.8 .09 255);--basalt-syntax-string: oklch(.8 .09 150);--basalt-syntax-constant: oklch(.8 .09 70);--basalt-syntax-function: oklch(.8 .09 305);--basalt-surface-0: var(--basalt-neutral-0);--basalt-surface-1: var(--basalt-neutral-4);--basalt-surface-2: var(--basalt-neutral-7);--basalt-surface-3: var(--basalt-neutral-9);--basalt-surface-sunken: var(--basalt-surface-1);--basalt-surface-well-2: var(--basalt-surface-2);--basalt-surface-well-3: var(--basalt-surface-3);--basalt-surface-sunken-strong: var(--basalt-surface-2);--basalt-surface-kbd: var(--basalt-white-8);--basalt-surface-chrome: oklch(0 0 0 / .925);--basalt-surface-placeholder: var(--basalt-neutral-9);--basalt-text-primary: var(--basalt-neutral-95-7);--basalt-text-secondary: var(--basalt-neutral-73);--basalt-text-tertiary: var(--basalt-neutral-59);--basalt-text-disabled: var(--basalt-neutral-42-4);--basalt-text-inverse: var(--basalt-neutral-0);--basalt-border-hairline: var(--basalt-white-15);--basalt-border-rim: var(--basalt-white-6);--basalt-border-rim-top: var(--basalt-white-8);--basalt-border-hover: var(--basalt-white-24);--basalt-border-divider: var(--basalt-white-6);--basalt-border-input: var(--basalt-white-38);--basalt-border-focus: var(--basalt-text-secondary);--basalt-state-hover: var(--basalt-white-6);--basalt-state-selected: var(--basalt-white-9);--basalt-plate-0: oklch(.2438 0 0);--basalt-plate-1: oklch(.2703 0 0);--basalt-plate-2: oklch(.2926 0 0);--basalt-plate-3: oklch(.2926 0 0);--basalt-action-primary: var(--basalt-neutral-93);--basalt-action-primary-hover: var(--basalt-neutral-100);--basalt-action-primary-press: var(--basalt-neutral-75);--basalt-action-primary-text: var(--basalt-neutral-0);--basalt-line-contrast: var(--basalt-white-38);--basalt-ink-contrast: var(--basalt-text-secondary);--basalt-field-contrast: var(--basalt-text-secondary);--basalt-scrim: var(--basalt-black-80);--basalt-shadow-hairline: 0px 0px 0px 1px oklch(1 0 0 / .145), 0px 0px 0px 1px oklch(0 0 0);--basalt-shadow-overlay: 0px 4px 8px -4px oklch(0 0 0 / .24), 0px 16px 24px -8px oklch(0 0 0 / .4);--basalt-shadow-modal: 0px 8px 16px -4px oklch(0 0 0 / .24), 0px 24px 32px -8px oklch(0 0 0 / .6)}}@media(prefers-contrast:more){:root,[data-theme=light],[data-theme=dark],.light,.dark,:root:not([data-theme=light]):not(.light){--basalt-border-hairline: var(--basalt-line-contrast);--basalt-border-rim: var(--basalt-line-contrast);--basalt-border-rim-top: var(--basalt-line-contrast);--basalt-border-divider: var(--basalt-line-contrast);--basalt-text-tertiary: var(--basalt-ink-contrast);--basalt-border-field: var(--basalt-field-contrast);--basalt-border-hover: var(--basalt-text-secondary);--basalt-shadow-hairline: 0px 0px 0px 1px var(--basalt-line-contrast), 0px 0px 0px 1px var(--basalt-surface-0)}}@media(prefers-reduced-motion:reduce){:root{--basalt-duration-base: .1s;--basalt-duration-slow: .1s;--basalt-duration-slower: .1s;--basalt-duration-figure: .1s;--basalt-duration-stagger: 0ms}}@layer reset,basalt;@layer reset{*,*:before,*:after{box-sizing:border-box}html{background:var(--basalt-surface-0);-webkit-text-size-adjust:100%}body{margin:0;background:var(--basalt-surface-0);color:var(--basalt-text-primary);font:var(--basalt-font-weight-regular) var(--bh-base);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}b,strong,th{font-weight:var(--basalt-font-weight-semibold)}img,svg,video{max-width:100%}button,input,select,textarea{font:inherit;letter-spacing:inherit;color:inherit;margin:0}a{color:inherit;text-decoration:underline;text-decoration-color:var(--basalt-border-input);text-underline-offset:var(--basalt-size-underline-offset)}a:hover{text-decoration-color:currentColor}h1,h2,h3,h4,p,ul,ol,dl,dd,figure,blockquote{margin:0}h1,h2,h3,h4{font-weight:var(--basalt-font-weight-semibold);color:var(--basalt-text-primary);text-wrap:balance}h5,h6{font-weight:var(--basalt-font-weight-semibold)}h1,.display{font-size:var(--basalt-text-3xl-size);line-height:var(--basalt-text-3xl-line-height);letter-spacing:var(--basalt-text-3xl-tracking)}h2{font-size:var(--basalt-text-2xl-size);line-height:var(--basalt-text-2xl-line-height);letter-spacing:var(--basalt-text-2xl-tracking)}h3{font-size:var(--basalt-text-lg-size);line-height:var(--basalt-text-lg-line-height);letter-spacing:var(--basalt-text-lg-tracking)}h4{font-size:var(--basalt-text-base-size);line-height:var(--basalt-text-base-line-height)}@media(width>=720px){h1,.display{font-size:var(--basalt-text-4xl-size);line-height:var(--basalt-text-4xl-line-height);letter-spacing:var(--basalt-text-4xl-tracking)}}p,li{text-wrap:pretty}code:not(.code code){padding:var(--basalt-size-hairline) var(--basalt-space-1);border-radius:var(--basalt-radius-xs);background:var(--basalt-surface-kbd);font:var(--basalt-font-weight-regular) .92em / 1 var(--basalt-font-family-mono)}pre,code,kbd,samp{font-family:var(--basalt-font-family-mono)}}@layer basalt{:root{--bh-xs: var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-sans);--bh-sm: var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans);--bh-base: var(--basalt-text-base-size) / var(--basalt-text-base-line-height) var(--basalt-font-family-sans);--bh-md: var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans);--bh-2xl: var(--basalt-text-2xl-size) / var(--basalt-text-2xl-line-height) var(--basalt-font-family-sans);--bh-xs-mono: var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-mono);--bh-sm-mono: var(--basalt-text-sm-size) / var(--basalt-size-code-line-height) var(--basalt-font-family-mono)}:root{accent-color:var(--basalt-action-primary);--basalt-gutter: var(--basalt-size-gutter)}@media(width<720px){:root{--basalt-gutter: var(--basalt-size-gutter-narrow)}}a,button,summary,[role=tab],.row,.disclosure,.segment button{-webkit-tap-highlight-color:transparent}[hidden]{display:none!important}:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}::selection{background:var(--basalt-state-selected)}svg.icon{flex:none}svg[data-brand]{pointer-events:none}.dot-sep:before{content:"·";content:"·" / ""}.dot-sep[data-spaced]:before{content:" · ";content:" · " / ""}.dot-sep>.visually-hidden{white-space:pre}.display{font-weight:var(--basalt-font-weight-semibold)}.text-5xl{font-size:var(--basalt-text-5xl-size);line-height:var(--basalt-text-5xl-line-height);letter-spacing:var(--basalt-text-5xl-tracking);font-weight:var(--basalt-font-weight-semibold)}.lead{font-size:var(--basalt-text-md-size);line-height:var(--basalt-text-md-line-height);color:var(--basalt-text-secondary);max-width:var(--basalt-size-prose-width);text-wrap:pretty}.eyebrow{font:var(--basalt-font-weight-medium) var(--bh-xs);color:var(--basalt-text-secondary)}.muted{color:var(--basalt-text-secondary)}.faint{color:var(--basalt-text-tertiary)}.small{font-size:var(--basalt-text-sm-size);line-height:var(--basalt-text-sm-line-height)}.mono{font-family:var(--basalt-font-family-mono)}.num{font-variant-numeric:tabular-nums}.prose{max-inline-size:var(--basalt-size-prose-width);margin-inline:0 auto}.prose>*+*{margin-top:var(--basalt-space-4)}.prose>:is(h2,h3){margin-top:var(--basalt-space-8)}.prose>:is(h2,h3)+*{margin-top:var(--basalt-space-2)}.prose :is(ul,ol){padding-inline-start:var(--basalt-space-5)}.prose li+li{margin-top:var(--basalt-space-1)}.prose blockquote{padding-inline-start:var(--basalt-space-4);color:var(--basalt-text-secondary)}.page{width:100%;max-width:var(--basalt-size-page-width);margin-inline:auto;padding:var(--basalt-space-8) var(--basalt-gutter) var(--basalt-space-16)}.page.narrow{max-width:46rem}@media(width<720px){.page{padding-block:var(--basalt-space-6) var(--basalt-space-12)}}.stack{display:flex;flex-direction:column;gap:var(--gap, var(--basalt-space-4));min-width:0}.cluster{display:flex;flex-wrap:wrap;align-items:center;gap:var(--gap, var(--basalt-space-2));min-width:0}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(var(--min, 220px),100%),1fr));gap:var(--gap, var(--basalt-space-4))}.split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:var(--gap, var(--basalt-space-6))}@media(width>=720px){.split.aside{grid-template-columns:minmax(0,var(--basalt-size-list-width)) minmax(0,1fr);align-items:start}}@media(width<720px){.split{grid-template-columns:minmax(0,1fr)}}.spacer{flex:1}@media(width<720px){.hide-narrow{display:none!important}}.section{margin-top:var(--basalt-space-12)}.section>.section-head{margin-bottom:var(--basalt-space-4)}.footer{margin-top:var(--basalt-space-16);padding-top:var(--basalt-space-4);border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider);color:var(--basalt-text-secondary);font-size:var(--basalt-text-sm-size)}.footer:not(.page .footer){width:calc(min(100%,var(--basalt-size-page-width)) - 2 * var(--basalt-gutter));margin-top:0;margin-inline:auto;padding-bottom:var(--basalt-space-8)}.skip-link{position:absolute;inset-inline-start:var(--basalt-space-2);top:var(--basalt-space-2);transform:translateY(-200%);padding:var(--basalt-space-2) var(--basalt-space-3);border:var(--basalt-size-hairline) solid var(--basalt-border-rim);border-top-color:var(--basalt-border-rim-top);border-radius:var(--basalt-radius-md);background:var(--basalt-surface-3);color:var(--basalt-text-primary);z-index:var(--basalt-layer-toast)}.skip-link:focus{transform:none;box-shadow:var(--basalt-shadow-overlay)}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-1);--panel-next: var(--basalt-surface-2);--panel-well: var(--basalt-surface-sunken);--panel-plate: light-dark(var(--basalt-state-selected), color-mix(in srgb, var(--basalt-neutral-100) 9%, var(--panel-next)));position:relative;min-width:0;background-color:var(--panel-bg);color:var(--basalt-text-primary);border:var(--basalt-size-hairline) solid var(--basalt-border-rim);border-top-color:var(--basalt-border-rim-top);border-radius:var(--basalt-radius-lg)}:is(.panel,.card,.callout,.code,.table-wrap) :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-2);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-2)}:is(.panel,.card,.callout,.code,.table-wrap) :is(.panel,.card,.callout,.code,.table-wrap) :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-3);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-3)}@supports not (color: light-dark(white,black)){:root,[data-theme=light],.light{--_dkp: 0%}[data-theme=dark],.dark{--_dkp: 100%}@media(prefers-color-scheme:dark){:root:not([data-theme=light]):not(.light){--_dkp: 100%}}:root,:is(.panel,.card,.callout,.code,.table-wrap){--_dk: color-mix(in srgb, var(--basalt-neutral-100) 9%, var(--panel-next, var(--basalt-surface-1)));--_mx: color-mix(in srgb, var(--_dk) var(--_dkp), color-mix(in srgb, var(--basalt-neutral-0) 7%, var(--panel-bg, var(--basalt-surface-page))));--panel-plate: color-mix(in srgb, var(--_dk) var(--_dkp), var(--basalt-state-selected))}.choice-card.choice-card{--_solid: var(--_mx)}.btn.btn.btn[aria-pressed=true]:not([data-variant=primary],[data-variant=danger]){background:var(--_mx)}.segment.segment{--pill-fill: color-mix(in srgb, color-mix(in srgb, var(--basalt-neutral-100) 9%, var(--basalt-surface-top)) var(--_dkp), var(--basalt-surface-top))}select.input.input{--_pop-plate: color-mix(in srgb, color-mix(in srgb, var(--basalt-neutral-100) 9%, var(--_pop-next)) var(--_dkp), var(--basalt-state-selected))}}.panel-pad,.card{padding:var(--basalt-space-4)}@media(width>=720px){.panel-pad.lg,.card.lg{padding:var(--basalt-space-6)}}.panel-head{display:flex;flex-wrap:wrap;align-items:center;gap:var(--basalt-space-2);padding:var(--basalt-space-3) var(--basalt-space-4);border-bottom:var(--basalt-size-hairline) solid var(--basalt-border-divider);font-weight:var(--basalt-font-weight-medium)}.float{--panel-bg: var(--basalt-surface-1);--panel-next: var(--basalt-surface-2);--panel-well: var(--basalt-surface-sunken);box-shadow:var(--basalt-shadow-overlay)}.float.modal{box-shadow:var(--basalt-shadow-modal);--panel-bg: var(--basalt-surface-1);--panel-next: var(--basalt-surface-2);--panel-well: var(--basalt-surface-sunken)}.float.modal :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-2);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-2)}[data-level="0"]{--panel-next: var(--basalt-surface-1)}[data-level="1"] :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-2);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-2)}[data-level="2"] :is(.panel,.card,.callout,.code,.table-wrap),[data-level="3"] :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-3);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-3)}.divider{display:block;height:var(--basalt-size-hairline);margin:0;border:0;background:var(--basalt-border-divider);flex:none}.divide-y>*+*{border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.btn{position:relative;--_h: var(--basalt-size-control-md);--_px: var(--basalt-space-3);display:inline-flex;align-items:center;justify-content:center;gap:var(--basalt-space-1-5);height:var(--_h);padding:0 var(--_px);margin:0;border:0;border-radius:var(--basalt-radius-sm);font:var(--basalt-font-weight-medium) var(--basalt-text-base-size) / 1 var(--basalt-font-family-sans);white-space:nowrap;text-decoration:none;cursor:pointer;user-select:none;background:var(--basalt-surface-1);color:var(--basalt-text-primary);box-shadow:var(--basalt-shadow-hairline);transition-property:background-color,color,box-shadow,transform;transition-duration:var(--basalt-duration-fast);transition-timing-function:var(--basalt-ease-out)}.btn[data-size=sm]{--_h: var(--basalt-size-control-sm);--_px: var(--basalt-space-2-5);font-size:var(--basalt-text-sm-size)}.btn[data-size=lg]{--_h: var(--basalt-size-control-lg);--_px: var(--basalt-space-3-5);border-radius:var(--basalt-radius-md)}.btn[data-icon-only]{width:var(--_h);padding:0}.btn[data-variant=primary]{background:var(--basalt-action-primary);color:var(--basalt-action-primary-text);box-shadow:none}.btn[data-variant=ghost]{background:transparent;color:var(--basalt-text-secondary);box-shadow:none}.btn[data-variant=danger]{background:transparent;color:var(--basalt-status-danger);box-shadow:inset 0 0 0 var(--basalt-size-hairline) color-mix(in oklch,var(--basalt-status-danger) 45%,transparent)}@media(hover:hover){.btn:hover:not([disabled],[aria-disabled=true]){box-shadow:0 0 0 var(--basalt-size-hairline) var(--basalt-border-hover),0 0 0 var(--basalt-size-hairline) var(--basalt-surface-0)}.btn[data-variant=primary]:hover:not([disabled],[aria-disabled=true]){background:var(--basalt-action-primary-hover);box-shadow:none}.btn[data-variant=ghost]:hover:not([disabled],[aria-disabled=true]){background:var(--basalt-state-hover);color:var(--basalt-text-primary);box-shadow:none}.btn[data-variant=danger]:hover:not([disabled],[aria-disabled=true]){background:var(--basalt-state-hover);box-shadow:inset 0 0 0 var(--basalt-size-hairline) color-mix(in oklch,var(--basalt-status-danger) 70%,transparent)}}.btn:active:not([disabled],[aria-disabled=true]){background:var(--basalt-state-selected)}.btn[data-variant=primary]:active:not([disabled],[aria-disabled=true]){background:var(--basalt-action-primary-press)}.btn:active:not([disabled],[aria-disabled=true],[aria-busy=true]){transform:scale(.98)}.btn:active:not([disabled],[aria-disabled=true],[aria-busy=true]):after{content:"";position:absolute;inset:-1.03%}.btn[disabled],.btn[aria-disabled=true]{cursor:not-allowed;color:var(--basalt-text-disabled);box-shadow:0 0 0 var(--basalt-size-hairline) color-mix(in oklch,var(--basalt-border-hairline) 50%,transparent)}.btn[data-variant=primary][disabled],.btn[data-variant=primary][aria-disabled=true]{background:var(--basalt-state-selected);box-shadow:none}.btn[data-variant=ghost][disabled]{box-shadow:none}.btn[aria-busy=true]{cursor:progress}.btn[aria-busy=true]>*{opacity:0}.btn[aria-busy=true]:after{content:"";position:absolute;inset:0;margin:auto;width:var(--basalt-size-icon-sm);height:var(--basalt-size-icon-sm);border:1.5px solid color-mix(in oklch,currentColor 25%,transparent);border-top-color:currentColor;border-radius:var(--basalt-radius-full);animation:bh-spin var(--basalt-duration-loop-ring) linear infinite}.btn svg{flex:none}@media(pointer:coarse),(width<720px){.btn{min-height:var(--basalt-size-tap-min);border-radius:var(--basalt-radius-md)}.btn[data-icon-only]{min-width:var(--basalt-size-tap-min)}}@media(pointer:coarse),(width<720px){a:not(.btn,.row,.tab,.disclosure,.brand,.skip-link,:is(p,li,.prose,.small,.hint,.error,.callout-body) a),nav a:not(.btn,.site-footer-links-host a),.footer a,.tap{display:inline-flex;align-items:center;min-height:var(--basalt-size-tap-min);margin-block:var(--bh-tap-margin, min( 0lh , calc((1lh - var(--basalt-size-tap-min)) / 2)))}.skip-link{display:inline-flex;align-items:center;min-height:var(--basalt-size-tap-min)}:is(a:not(.btn,.row,.tab,.disclosure,.brand,.skip-link,.topbar-links a,:is(p,li,.prose,.small,.hint,.error,.callout-body) a),.tap){position:relative}:is(a:not(.btn,.row,.tab,.disclosure,.brand,.skip-link,.topbar-links a,:is(p,li,.prose,.small,.hint,.error,.callout-body) a),.tap):after{content:"";position:absolute;inset-block:0;left:50%;width:max(100%,var(--basalt-size-tap-min));transform:translate(-50%)}.stack>a:not(.btn,.row,.tab,.disclosure):has(+a){margin-block-end:0;min-height:calc((var(--basalt-size-tap-min) + 1lh) / 2);align-items:flex-end}.stack>a+a:not(.btn,.row,.tab,.disclosure){margin-block-start:0;min-height:calc((var(--basalt-size-tap-min) + 1lh) / 2);align-items:flex-start}.stack>a+a:not(.btn,.row,.tab,.disclosure):has(+a){min-height:1lh;align-items:center}}@keyframes bh-spin{to{transform:rotate(360deg)}}@keyframes bh-fade{50%{opacity:.55}}@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}.btn[aria-busy=true]:after{animation:bh-fade var(--basalt-duration-loop-fade) var(--basalt-ease-in-out) infinite;border-top-color:color-mix(in oklch,currentColor 25%,transparent)}.btn:active:not([disabled],[aria-disabled=true],[aria-busy=true]){transform:none}.btn{transition-property:background-color,color,box-shadow}}@media(forced-colors:active){:is(.panel,.card,.callout,.code,.table-wrap){border-color:CanvasText}.btn{border:var(--basalt-size-hairline) solid ButtonText}}@media print{.skip-link{display:none}:is(.panel,.card,.callout,.code,.table-wrap){break-inside:avoid}}} +:root{--basalt-neutral-0: oklch(0 0 0);--basalt-neutral-4: oklch(.1448 0 0);--basalt-neutral-7: oklch(.1776 0 0);--basalt-neutral-9: oklch(.2046 0 0);--basalt-neutral-20: oklch(.3211 0 0);--basalt-neutral-30: oklch(.4202 0 0);--basalt-neutral-36: oklch(.4748 0 0);--basalt-neutral-42: oklch(.5278 0 0);--basalt-neutral-52: oklch(.6167 0 0);--basalt-neutral-59: oklch(.675 0 0);--basalt-neutral-63: oklch(.709 0 0);--basalt-neutral-64: oklch(.7155 0 0);--basalt-neutral-73: oklch(.79 0 0);--basalt-neutral-75: oklch(.8047 0 0);--basalt-neutral-93: oklch(.9461 0 0);--basalt-neutral-94: oklch(.9551 0 0);--basalt-neutral-96: oklch(.9702 0 0);--basalt-neutral-98: oklch(.9851 0 0);--basalt-neutral-100: oklch(1 0 0);--basalt-neutral-42-4: oklch(.53 0 0);--basalt-neutral-95-7: oklch(.966 0 0);--basalt-white-6: oklch(1 0 0 / .06);--basalt-white-8: oklch(1 0 0 / .08);--basalt-white-9: oklch(1 0 0 / .09);--basalt-white-15: oklch(1 0 0 / .145);--basalt-white-24: oklch(1 0 0 / .24);--basalt-white-38: oklch(1 0 0 / .38);--basalt-black-4: oklch(0 0 0 / .04);--basalt-black-6: oklch(0 0 0 / .06);--basalt-black-7: oklch(0 0 0 / .07);--basalt-black-8: oklch(0 0 0 / .08);--basalt-black-10: oklch(0 0 0 / .1);--basalt-black-16: oklch(0 0 0 / .16);--basalt-black-18: oklch(0 0 0 / .18);--basalt-black-24: oklch(0 0 0 / .24);--basalt-black-40: oklch(0 0 0 / .4);--basalt-black-45: oklch(0 0 0 / .45);--basalt-black-60: oklch(0 0 0 / .6);--basalt-black-80: oklch(0 0 0 / .8);--basalt-status-danger-dark: oklch(.7 .191 22);--basalt-status-success-dark: oklch(.73 .211 148);--basalt-status-warning-dark: oklch(.79 .171 70);--basalt-status-danger-light: oklch(.51 .19 25);--basalt-status-success-light: oklch(.55 .159 148);--basalt-status-warning-light: oklch(.6 .137 62);--basalt-space-0: 0px;--basalt-space-1: 4px;--basalt-space-2: 8px;--basalt-space-3: 12px;--basalt-space-4: 16px;--basalt-space-5: 20px;--basalt-space-6: 24px;--basalt-space-8: 32px;--basalt-space-10: 40px;--basalt-space-12: 48px;--basalt-space-16: 64px;--basalt-space-24: 96px;--basalt-space-0-5: 2px;--basalt-space-1-5: 6px;--basalt-space-2-5: 10px;--basalt-space-3-5: 14px;--basalt-radius-2xs: 2px;--basalt-radius-xs: 4px;--basalt-radius-sm: 6px;--basalt-radius-md: 8px;--basalt-radius-lg: 12px;--basalt-radius-xl: 16px;--basalt-radius-full: 9999px;--basalt-size-control-xs: 24px;--basalt-size-control-sm: 28px;--basalt-size-control-md: 32px;--basalt-size-control-lg: 36px;--basalt-size-control-xl: 40px;--basalt-size-control-2xl: 44px;--basalt-size-control-3xl: 48px;--basalt-size-control-4xl: 52px;--basalt-size-control-5xl: 56px;--basalt-size-control-6xl: 64px;--basalt-size-menu-row: 36px;--basalt-size-menu-row-touch: 44px;--basalt-size-tap-min: 44px;--basalt-size-icon-sm: 16px;--basalt-size-icon-md: 20px;--basalt-size-icon-lg: 24px;--basalt-size-focus-width: 2px;--basalt-size-focus-offset: 2px;--basalt-size-hairline: 1px;--basalt-size-indicator: 2px;--basalt-size-description-label: 160px;--basalt-size-field-label-inline: 80px;--basalt-size-track: 4px;--basalt-size-dot: 6px;--basalt-size-choice: 16px;--basalt-size-choice-mark: 12px;--basalt-size-switch-width: 32px;--basalt-size-switch-height: 18px;--basalt-size-switch-thumb: 14px;--basalt-size-kbd: 20px;--basalt-size-badge: 22px;--basalt-size-table-row: 40px;--basalt-size-command-input: 48px;--basalt-size-code-line-height: 20px;--basalt-size-underline-offset: 3px;--basalt-size-slider-length: 180px;--basalt-size-dialog-width: 480px;--basalt-size-sheet-width: 440px;--basalt-size-command-width: 560px;--basalt-size-dialog-width-wide: 992px;--basalt-size-search-trigger: 200px;--basalt-size-search-logo-width: 96px;--basalt-size-search-logo-height: 48px;--basalt-size-search-pack-width: 48px;--basalt-size-search-pack-height: 60px;--basalt-size-toast-width: 360px;--basalt-size-popover-max: 320px;--basalt-size-tooltip-max: 280px;--basalt-size-menu-min: 200px;--basalt-size-select-min: 160px;--basalt-size-popup-max-height: 360px;--basalt-size-list-width: 320px;--basalt-size-header: 56px;--basalt-size-tab-bar: 56px;--basalt-size-sidebar-width: 256px;--basalt-size-rail-width: 72px;--basalt-size-page-width: 72rem;--basalt-size-prose-width: 34rem;--basalt-size-gutter: var(--basalt-space-6);--basalt-size-gutter-narrow: var(--basalt-space-4);--basalt-size-breakpoint-md: 720px;--basalt-size-breakpoint-lg: 1024px;--basalt-size-breakpoint-container: 480px;--basalt-size-breakpoint-container-sm: 340px;--basalt-size-breakpoint-container-lg: 640px;--basalt-size-cut: 2px;--basalt-size-hatch-pitch: 4px;--basalt-size-meter-marker: 12px;--basalt-opacity-amount: .72;--basalt-opacity-recede-2: .5;--basalt-opacity-recede-3: .32;--basalt-opacity-recede-4: .2;--basalt-opacity-recede-5: .12;--basalt-opacity-recede-danger: .88;--basalt-opacity-queued: .65;--basalt-font-family-sans: Geist, "Geist Fallback", ui-sans-serif, system-ui, sans-serif;--basalt-font-family-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;--basalt-font-weight-regular: 400;--basalt-font-weight-medium: 500;--basalt-font-weight-semibold: 600;--basalt-text-xs-size: 12px;--basalt-text-xs-line-height: 16px;--basalt-text-xs-tracking: .01em;--basalt-text-sm-size: 13px;--basalt-text-sm-line-height: 18px;--basalt-text-sm-tracking: 0em;--basalt-text-base-size: 14px;--basalt-text-base-line-height: 20px;--basalt-text-base-tracking: 0em;--basalt-text-md-size: 16px;--basalt-text-md-line-height: 24px;--basalt-text-md-tracking: -.005em;--basalt-text-lg-size: 18px;--basalt-text-lg-line-height: 26px;--basalt-text-lg-tracking: -.01em;--basalt-text-xl-size: 20px;--basalt-text-xl-line-height: 28px;--basalt-text-xl-tracking: -.015em;--basalt-text-2xl-size: 24px;--basalt-text-2xl-line-height: 30px;--basalt-text-2xl-tracking: -.02em;--basalt-text-3xl-size: 30px;--basalt-text-3xl-line-height: 36px;--basalt-text-3xl-tracking: -.025em;--basalt-text-4xl-size: 40px;--basalt-text-4xl-line-height: 44px;--basalt-text-4xl-tracking: -.03em;--basalt-text-5xl-size: 56px;--basalt-text-5xl-line-height: 60px;--basalt-text-5xl-tracking: -.035em;--basalt-blur-chrome: 12px;--basalt-duration-instant: 0ms;--basalt-duration-fast: .1s;--basalt-duration-base: .15s;--basalt-duration-slow: .2s;--basalt-duration-slower: .3s;--basalt-duration-confirm: 1.5s;--basalt-duration-figure: .6s;--basalt-duration-stagger: 22ms;--basalt-duration-loop-ring: .64s;--basalt-duration-loop-braille: .8s;--basalt-duration-loop-fade: 1.2s;--basalt-duration-loop-ambient: 6s;--basalt-ease-out: cubic-bezier(.16, 1, .3, 1);--basalt-ease-in-out: cubic-bezier(.65, 0, .35, 1);--basalt-ease-in: cubic-bezier(.4, 0, 1, 1);--basalt-ease-linear: cubic-bezier(0, 0, 1, 1);--basalt-layer-base: 0;--basalt-layer-sticky: 100;--basalt-layer-overlay: 500;--basalt-layer-popover: 600;--basalt-layer-dialog: 700;--basalt-layer-toast: 800;--basalt-layer-tooltip: 1100}:root,[data-theme=light],.light{color-scheme:light;--basalt-status-danger: var(--basalt-status-danger-light);--basalt-status-success: var(--basalt-status-success-light);--basalt-status-warning: var(--basalt-status-warning-light);--basalt-syntax-keyword: oklch(.5 .12 255);--basalt-syntax-string: oklch(.5 .12 150);--basalt-syntax-constant: oklch(.5 .1 70);--basalt-syntax-function: oklch(.5 .12 305);--basalt-syntax-comment: var(--basalt-text-tertiary);--basalt-surface-0: var(--basalt-neutral-98);--basalt-surface-1: var(--basalt-neutral-100);--basalt-surface-2: var(--basalt-neutral-100);--basalt-surface-3: var(--basalt-neutral-100);--basalt-surface-page: var(--basalt-surface-0);--basalt-surface-raised: var(--basalt-surface-1);--basalt-surface-overlay: var(--basalt-surface-2);--basalt-surface-top: var(--basalt-surface-3);--basalt-surface-sunken: var(--basalt-neutral-96);--basalt-surface-well-2: var(--basalt-surface-sunken);--basalt-surface-well-3: var(--basalt-surface-sunken);--basalt-surface-sunken-strong: var(--basalt-neutral-94);--basalt-surface-kbd: var(--basalt-black-6);--basalt-surface-chrome: oklch(.9851 0 0 / .96);--basalt-surface-placeholder: var(--basalt-neutral-94);--basalt-text-primary: var(--basalt-neutral-9);--basalt-text-secondary: var(--basalt-neutral-30);--basalt-text-tertiary: var(--basalt-neutral-42);--basalt-text-disabled: var(--basalt-neutral-64);--basalt-text-inverse: var(--basalt-neutral-100);--basalt-border-rim: var(--basalt-black-8);--basalt-border-rim-top: var(--basalt-black-8);--basalt-border-hairline: var(--basalt-black-8);--basalt-border-hover: var(--basalt-black-16);--basalt-border-divider: var(--basalt-black-8);--basalt-border-input: var(--basalt-black-45);--basalt-border-field: var(--basalt-border-input);--basalt-border-focus: var(--basalt-neutral-30);--basalt-state-hover: var(--basalt-black-4);--basalt-state-selected: var(--basalt-black-7);--basalt-plate-0: oklch(.9325 0 0);--basalt-plate-1: oklch(.9466 0 0);--basalt-plate-2: oklch(.9466 0 0);--basalt-plate-3: oklch(.9466 0 0);--basalt-action-primary: var(--basalt-neutral-9);--basalt-action-primary-hover: var(--basalt-neutral-0);--basalt-action-primary-press: var(--basalt-neutral-20);--basalt-action-primary-text: var(--basalt-neutral-100);--basalt-line-contrast: var(--basalt-black-45);--basalt-ink-contrast: var(--basalt-neutral-30);--basalt-field-contrast: var(--basalt-neutral-30);--basalt-scrim: var(--basalt-black-40);--basalt-shadow-hairline: 0px 0px 0px 1px oklch(0 0 0 / .08), 0px 0px 0px 1px oklch(.9851 0 0);--basalt-shadow-overlay: 0px 4px 8px -4px oklch(0 0 0 / .06), 0px 16px 24px -8px oklch(0 0 0 / .1);--basalt-shadow-modal: 0px 8px 16px -4px oklch(0 0 0 / .06), 0px 24px 32px -8px oklch(0 0 0 / .1)}[data-theme=dark],.dark{color-scheme:dark;--basalt-status-danger: var(--basalt-status-danger-dark);--basalt-status-success: var(--basalt-status-success-dark);--basalt-status-warning: var(--basalt-status-warning-dark);--basalt-syntax-keyword: oklch(.8 .09 255);--basalt-syntax-string: oklch(.8 .09 150);--basalt-syntax-constant: oklch(.8 .09 70);--basalt-syntax-function: oklch(.8 .09 305);--basalt-syntax-comment: var(--basalt-text-tertiary);--basalt-surface-0: var(--basalt-neutral-0);--basalt-surface-1: var(--basalt-neutral-4);--basalt-surface-2: var(--basalt-neutral-7);--basalt-surface-3: var(--basalt-neutral-9);--basalt-surface-page: var(--basalt-surface-0);--basalt-surface-raised: var(--basalt-surface-1);--basalt-surface-overlay: var(--basalt-surface-2);--basalt-surface-top: var(--basalt-surface-3);--basalt-surface-sunken: var(--basalt-surface-1);--basalt-surface-well-2: var(--basalt-surface-2);--basalt-surface-well-3: var(--basalt-surface-3);--basalt-surface-sunken-strong: var(--basalt-surface-2);--basalt-surface-kbd: var(--basalt-white-8);--basalt-surface-chrome: oklch(0 0 0 / .925);--basalt-surface-placeholder: var(--basalt-neutral-9);--basalt-text-primary: var(--basalt-neutral-95-7);--basalt-text-secondary: var(--basalt-neutral-73);--basalt-text-tertiary: var(--basalt-neutral-59);--basalt-text-disabled: var(--basalt-neutral-42-4);--basalt-text-inverse: var(--basalt-neutral-0);--basalt-border-hairline: var(--basalt-white-15);--basalt-border-rim: var(--basalt-white-6);--basalt-border-rim-top: var(--basalt-white-8);--basalt-border-hover: var(--basalt-white-24);--basalt-border-divider: var(--basalt-white-6);--basalt-border-input: var(--basalt-white-38);--basalt-border-field: var(--basalt-border-input);--basalt-border-focus: var(--basalt-text-secondary);--basalt-state-hover: var(--basalt-white-6);--basalt-state-selected: var(--basalt-white-9);--basalt-plate-0: oklch(.2438 0 0);--basalt-plate-1: oklch(.2703 0 0);--basalt-plate-2: oklch(.2926 0 0);--basalt-plate-3: oklch(.2926 0 0);--basalt-action-primary: var(--basalt-neutral-93);--basalt-action-primary-hover: var(--basalt-neutral-100);--basalt-action-primary-press: var(--basalt-neutral-75);--basalt-action-primary-text: var(--basalt-neutral-0);--basalt-line-contrast: var(--basalt-white-38);--basalt-ink-contrast: var(--basalt-text-secondary);--basalt-field-contrast: var(--basalt-text-secondary);--basalt-scrim: var(--basalt-black-80);--basalt-shadow-hairline: 0px 0px 0px 1px oklch(1 0 0 / .145), 0px 0px 0px 1px oklch(0 0 0);--basalt-shadow-overlay: 0px 4px 8px -4px oklch(0 0 0 / .24), 0px 16px 24px -8px oklch(0 0 0 / .4);--basalt-shadow-modal: 0px 8px 16px -4px oklch(0 0 0 / .24), 0px 24px 32px -8px oklch(0 0 0 / .6)}@media(prefers-color-scheme:dark){:root:not([data-theme=light]):not(.light){color-scheme:dark;--basalt-status-danger: var(--basalt-status-danger-dark);--basalt-status-success: var(--basalt-status-success-dark);--basalt-status-warning: var(--basalt-status-warning-dark);--basalt-syntax-keyword: oklch(.8 .09 255);--basalt-syntax-string: oklch(.8 .09 150);--basalt-syntax-constant: oklch(.8 .09 70);--basalt-syntax-function: oklch(.8 .09 305);--basalt-surface-0: var(--basalt-neutral-0);--basalt-surface-1: var(--basalt-neutral-4);--basalt-surface-2: var(--basalt-neutral-7);--basalt-surface-3: var(--basalt-neutral-9);--basalt-surface-sunken: var(--basalt-surface-1);--basalt-surface-well-2: var(--basalt-surface-2);--basalt-surface-well-3: var(--basalt-surface-3);--basalt-surface-sunken-strong: var(--basalt-surface-2);--basalt-surface-kbd: var(--basalt-white-8);--basalt-surface-chrome: oklch(0 0 0 / .925);--basalt-surface-placeholder: var(--basalt-neutral-9);--basalt-text-primary: var(--basalt-neutral-95-7);--basalt-text-secondary: var(--basalt-neutral-73);--basalt-text-tertiary: var(--basalt-neutral-59);--basalt-text-disabled: var(--basalt-neutral-42-4);--basalt-text-inverse: var(--basalt-neutral-0);--basalt-border-hairline: var(--basalt-white-15);--basalt-border-rim: var(--basalt-white-6);--basalt-border-rim-top: var(--basalt-white-8);--basalt-border-hover: var(--basalt-white-24);--basalt-border-divider: var(--basalt-white-6);--basalt-border-input: var(--basalt-white-38);--basalt-border-focus: var(--basalt-text-secondary);--basalt-state-hover: var(--basalt-white-6);--basalt-state-selected: var(--basalt-white-9);--basalt-plate-0: oklch(.2438 0 0);--basalt-plate-1: oklch(.2703 0 0);--basalt-plate-2: oklch(.2926 0 0);--basalt-plate-3: oklch(.2926 0 0);--basalt-action-primary: var(--basalt-neutral-93);--basalt-action-primary-hover: var(--basalt-neutral-100);--basalt-action-primary-press: var(--basalt-neutral-75);--basalt-action-primary-text: var(--basalt-neutral-0);--basalt-line-contrast: var(--basalt-white-38);--basalt-ink-contrast: var(--basalt-text-secondary);--basalt-field-contrast: var(--basalt-text-secondary);--basalt-scrim: var(--basalt-black-80);--basalt-shadow-hairline: 0px 0px 0px 1px oklch(1 0 0 / .145), 0px 0px 0px 1px oklch(0 0 0);--basalt-shadow-overlay: 0px 4px 8px -4px oklch(0 0 0 / .24), 0px 16px 24px -8px oklch(0 0 0 / .4);--basalt-shadow-modal: 0px 8px 16px -4px oklch(0 0 0 / .24), 0px 24px 32px -8px oklch(0 0 0 / .6)}}@media(prefers-contrast:more){:root,[data-theme=light],[data-theme=dark],.light,.dark,:root:not([data-theme=light]):not(.light){--basalt-border-hairline: var(--basalt-line-contrast);--basalt-border-rim: var(--basalt-line-contrast);--basalt-border-rim-top: var(--basalt-line-contrast);--basalt-border-divider: var(--basalt-line-contrast);--basalt-text-tertiary: var(--basalt-ink-contrast);--basalt-border-field: var(--basalt-field-contrast);--basalt-border-hover: var(--basalt-text-secondary);--basalt-shadow-hairline: 0px 0px 0px 1px var(--basalt-line-contrast), 0px 0px 0px 1px var(--basalt-surface-0)}}@media(prefers-reduced-motion:reduce){:root{--basalt-duration-base: .1s;--basalt-duration-slow: .1s;--basalt-duration-slower: .1s;--basalt-duration-figure: .1s;--basalt-duration-stagger: 0ms}}@layer reset,basalt;@layer reset{*,*:before,*:after{box-sizing:border-box}html{background:var(--basalt-surface-0);-webkit-text-size-adjust:100%}body{margin:0;background:var(--basalt-surface-0);color:var(--basalt-text-primary);font:var(--basalt-font-weight-regular) var(--bh-base);-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}b,strong,th{font-weight:var(--basalt-font-weight-semibold)}img,svg,video{max-width:100%}button,input,select,textarea{font:inherit;letter-spacing:inherit;color:inherit;margin:0}a{color:inherit;text-decoration:underline;text-decoration-color:var(--basalt-border-input);text-underline-offset:var(--basalt-size-underline-offset)}a:hover{text-decoration-color:currentColor}h1,h2,h3,h4,p,ul,ol,dl,dd,figure,blockquote{margin:0}h1,h2,h3,h4{font-weight:var(--basalt-font-weight-semibold);color:var(--basalt-text-primary);text-wrap:balance}h5,h6{font-weight:var(--basalt-font-weight-semibold)}h1,.display{font-size:var(--basalt-text-3xl-size);line-height:var(--basalt-text-3xl-line-height);letter-spacing:var(--basalt-text-3xl-tracking)}h2{font-size:var(--basalt-text-2xl-size);line-height:var(--basalt-text-2xl-line-height);letter-spacing:var(--basalt-text-2xl-tracking)}h3{font-size:var(--basalt-text-lg-size);line-height:var(--basalt-text-lg-line-height);letter-spacing:var(--basalt-text-lg-tracking)}h4{font-size:var(--basalt-text-base-size);line-height:var(--basalt-text-base-line-height)}@media(width>=720px){h1,.display{font-size:var(--basalt-text-4xl-size);line-height:var(--basalt-text-4xl-line-height);letter-spacing:var(--basalt-text-4xl-tracking)}}p,li{text-wrap:pretty}code:not(.code code){padding:var(--basalt-size-hairline) var(--basalt-space-1);border-radius:var(--basalt-radius-xs);background:var(--basalt-surface-kbd);font:var(--basalt-font-weight-regular) .92em / 1 var(--basalt-font-family-mono)}pre,code,kbd,samp{font-family:var(--basalt-font-family-mono)}}@layer basalt{:root{--bh-xs: var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-sans);--bh-sm: var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans);--bh-base: var(--basalt-text-base-size) / var(--basalt-text-base-line-height) var(--basalt-font-family-sans);--bh-md: var(--basalt-text-md-size) / var(--basalt-text-md-line-height) var(--basalt-font-family-sans);--bh-2xl: var(--basalt-text-2xl-size) / var(--basalt-text-2xl-line-height) var(--basalt-font-family-sans);--bh-xs-mono: var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-mono);--bh-sm-mono: var(--basalt-text-sm-size) / var(--basalt-size-code-line-height) var(--basalt-font-family-mono)}:root{accent-color:var(--basalt-action-primary);--basalt-gutter: var(--basalt-size-gutter)}@media(width<720px){:root{--basalt-gutter: var(--basalt-size-gutter-narrow)}}a,button,summary,[role=tab],.row,.disclosure,.segment button{-webkit-tap-highlight-color:transparent}[hidden]{display:none!important}:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}::selection{background:var(--basalt-state-selected)}svg.icon{flex:none}svg[data-brand]{pointer-events:none}.dot-sep:before{content:"·";content:"·" / ""}.dot-sep[data-spaced]:before{content:" · ";content:" · " / ""}.dot-sep>.visually-hidden{white-space:pre}.display{font-weight:var(--basalt-font-weight-semibold)}.text-5xl{font-size:var(--basalt-text-5xl-size);line-height:var(--basalt-text-5xl-line-height);letter-spacing:var(--basalt-text-5xl-tracking);font-weight:var(--basalt-font-weight-semibold)}.lead{font-size:var(--basalt-text-md-size);line-height:var(--basalt-text-md-line-height);color:var(--basalt-text-secondary);max-width:var(--basalt-size-prose-width);text-wrap:pretty}.eyebrow{font:var(--basalt-font-weight-medium) var(--bh-xs);color:var(--basalt-text-secondary)}.muted{color:var(--basalt-text-secondary)}.faint{color:var(--basalt-text-tertiary)}.small{font-size:var(--basalt-text-sm-size);line-height:var(--basalt-text-sm-line-height)}.mono{font-family:var(--basalt-font-family-mono)}.num{font-variant-numeric:tabular-nums}.prose{max-inline-size:var(--basalt-size-prose-width);margin-inline:0 auto}.prose>*+*{margin-top:var(--basalt-space-4)}.prose>:is(h2,h3){margin-top:var(--basalt-space-8)}.prose>:is(h2,h3)+*{margin-top:var(--basalt-space-2)}.prose :is(ul,ol){padding-inline-start:var(--basalt-space-5)}.prose li+li{margin-top:var(--basalt-space-1)}.prose blockquote{padding-inline-start:var(--basalt-space-4);color:var(--basalt-text-secondary)}.page{width:100%;max-width:var(--basalt-size-page-width);margin-inline:auto;padding:var(--basalt-space-8) var(--basalt-gutter) var(--basalt-space-16)}.page.narrow{max-width:46rem}@media(width<720px){.page{padding-block:var(--basalt-space-6) var(--basalt-space-12)}}.stack{display:flex;flex-direction:column;gap:var(--gap, var(--basalt-space-4));min-width:0}.cluster{display:flex;flex-wrap:wrap;align-items:center;gap:var(--gap, var(--basalt-space-2));min-width:0}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(var(--min, 220px),100%),1fr));gap:var(--gap, var(--basalt-space-4))}.split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:var(--gap, var(--basalt-space-6))}@media(width>=720px){.split.aside{grid-template-columns:minmax(0,var(--basalt-size-list-width)) minmax(0,1fr);align-items:start}}@media(width<720px){.split{grid-template-columns:minmax(0,1fr)}}.spacer{flex:1}@media(width<720px){.hide-narrow{display:none!important}}.section{margin-top:var(--basalt-space-12)}.section>.section-head{margin-bottom:var(--basalt-space-4)}.footer{margin-top:var(--basalt-space-16);padding-top:var(--basalt-space-4);border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider);color:var(--basalt-text-secondary);font-size:var(--basalt-text-sm-size)}.footer:not(.page .footer){width:calc(min(100%,var(--basalt-size-page-width)) - 2 * var(--basalt-gutter));margin-top:0;margin-inline:auto;padding-bottom:var(--basalt-space-8)}.skip-link{position:absolute;inset-inline-start:var(--basalt-space-2);top:var(--basalt-space-2);transform:translateY(-200%);padding:var(--basalt-space-2) var(--basalt-space-3);border:var(--basalt-size-hairline) solid var(--basalt-border-rim);border-top-color:var(--basalt-border-rim-top);border-radius:var(--basalt-radius-md);background:var(--basalt-surface-3);color:var(--basalt-text-primary);z-index:var(--basalt-layer-toast)}.skip-link:focus{transform:none;box-shadow:var(--basalt-shadow-overlay)}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}:is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-1);--panel-next: var(--basalt-surface-2);--panel-well: var(--basalt-surface-sunken);--panel-plate: light-dark(var(--basalt-state-selected), color-mix(in srgb, var(--basalt-neutral-100) 9%, var(--panel-next)));position:relative;min-width:0;background-color:var(--panel-bg);color:var(--basalt-text-primary);border:var(--basalt-size-hairline) solid var(--basalt-border-rim);border-top-color:var(--basalt-border-rim-top);border-radius:var(--basalt-radius-lg)}:is(.panel,.card,.callout,.code,.table-wrap) :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-2);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-2)}:is(.panel,.card,.callout,.code,.table-wrap) :is(.panel,.card,.callout,.code,.table-wrap) :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-3);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-3)}@supports not (color: light-dark(white,black)){:root,[data-theme=light],.light{--_dkp: 0%}[data-theme=dark],.dark{--_dkp: 100%}@media(prefers-color-scheme:dark){:root:not([data-theme=light]):not(.light){--_dkp: 100%}}:root,:is(.panel,.card,.callout,.code,.table-wrap){--_dk: color-mix(in srgb, var(--basalt-neutral-100) 9%, var(--panel-next, var(--basalt-surface-1)));--_mx: color-mix(in srgb, var(--_dk) var(--_dkp), color-mix(in srgb, var(--basalt-neutral-0) 7%, var(--panel-bg, var(--basalt-surface-page))));--panel-plate: color-mix(in srgb, var(--_dk) var(--_dkp), var(--basalt-state-selected))}.choice-card.choice-card{--_solid: var(--_mx)}.btn.btn.btn[aria-pressed=true]:not([data-variant=primary],[data-variant=danger]){background:var(--_mx)}.segment.segment{--pill-fill: color-mix(in srgb, color-mix(in srgb, var(--basalt-neutral-100) 9%, var(--basalt-surface-top)) var(--_dkp), var(--basalt-surface-top))}select.input.input{--_pop-plate: color-mix(in srgb, color-mix(in srgb, var(--basalt-neutral-100) 9%, var(--_pop-next)) var(--_dkp), var(--basalt-state-selected))}}.panel-pad,.card{padding:var(--basalt-space-4)}@media(width>=720px){.panel-pad.lg,.card.lg{padding:var(--basalt-space-6)}}.panel-head{display:flex;flex-wrap:wrap;align-items:center;gap:var(--basalt-space-2);padding:var(--basalt-space-3) var(--basalt-space-4);border-bottom:var(--basalt-size-hairline) solid var(--basalt-border-divider);font-weight:var(--basalt-font-weight-medium)}.float{--panel-bg: var(--basalt-surface-1);--panel-next: var(--basalt-surface-2);--panel-well: var(--basalt-surface-sunken);box-shadow:var(--basalt-shadow-overlay)}.float.modal{box-shadow:var(--basalt-shadow-modal);--panel-bg: var(--basalt-surface-1);--panel-next: var(--basalt-surface-2);--panel-well: var(--basalt-surface-sunken)}.float.modal :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-2);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-2)}[data-level="0"]{--panel-next: var(--basalt-surface-1)}[data-level="1"] :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-2);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-2)}[data-level="2"] :is(.panel,.card,.callout,.code,.table-wrap),[data-level="3"] :is(.panel,.card,.callout,.code,.table-wrap){--panel-bg: var(--basalt-surface-3);--panel-next: var(--basalt-surface-3);--panel-well: var(--basalt-surface-well-3)}.divider{display:block;height:var(--basalt-size-hairline);margin:0;border:0;background:var(--basalt-border-divider);flex:none}.divide-y>*+*{border-top:var(--basalt-size-hairline) solid var(--basalt-border-divider)}.btn{position:relative;--_h: var(--basalt-size-control-md);--_px: var(--basalt-space-3);display:inline-flex;align-items:center;justify-content:center;gap:var(--basalt-space-1-5);height:var(--_h);padding:0 var(--_px);margin:0;border:0;border-radius:var(--basalt-radius-sm);font:var(--basalt-font-weight-medium) var(--basalt-text-base-size) / 1 var(--basalt-font-family-sans);white-space:nowrap;text-decoration:none;cursor:pointer;user-select:none;background:var(--basalt-surface-1);color:var(--basalt-text-primary);box-shadow:var(--basalt-shadow-hairline);transition-property:background-color,color,box-shadow,transform;transition-duration:var(--basalt-duration-fast);transition-timing-function:var(--basalt-ease-out)}.btn[data-size=sm]{--_h: var(--basalt-size-control-sm);--_px: var(--basalt-space-2-5);font-size:var(--basalt-text-sm-size)}.btn[data-size=lg]{--_h: var(--basalt-size-control-lg);--_px: var(--basalt-space-3-5);border-radius:var(--basalt-radius-md)}.btn[data-icon-only]{width:var(--_h);padding:0}.btn[data-variant=primary]{background:var(--basalt-action-primary);color:var(--basalt-action-primary-text);box-shadow:none}.btn[data-variant=ghost]{background:transparent;color:var(--basalt-text-secondary);box-shadow:none}.btn[data-variant=danger]{background:transparent;color:var(--basalt-status-danger);box-shadow:inset 0 0 0 var(--basalt-size-hairline) color-mix(in oklch,var(--basalt-status-danger) 45%,transparent)}@media(hover:hover){.btn:hover:not([disabled],[aria-disabled=true]){box-shadow:0 0 0 var(--basalt-size-hairline) var(--basalt-border-hover),0 0 0 var(--basalt-size-hairline) var(--basalt-surface-0)}.btn[data-variant=primary]:hover:not([disabled],[aria-disabled=true]){background:var(--basalt-action-primary-hover);box-shadow:none}.btn[data-variant=ghost]:hover:not([disabled],[aria-disabled=true]){background:var(--basalt-state-hover);color:var(--basalt-text-primary);box-shadow:none}.btn[data-variant=danger]:hover:not([disabled],[aria-disabled=true]){background:var(--basalt-state-hover);box-shadow:inset 0 0 0 var(--basalt-size-hairline) color-mix(in oklch,var(--basalt-status-danger) 70%,transparent)}}.btn:active:not([disabled],[aria-disabled=true]){background:var(--basalt-state-selected)}.btn[data-variant=primary]:active:not([disabled],[aria-disabled=true]){background:var(--basalt-action-primary-press)}.btn:active:not([disabled],[aria-disabled=true],[aria-busy=true]){transform:scale(.98)}.btn:active:not([disabled],[aria-disabled=true],[aria-busy=true]):after{content:"";position:absolute;inset:-1.03%}.btn[disabled],.btn[aria-disabled=true]{cursor:not-allowed;color:var(--basalt-text-disabled);box-shadow:0 0 0 var(--basalt-size-hairline) color-mix(in oklch,var(--basalt-border-hairline) 50%,transparent)}.btn[data-variant=primary][disabled],.btn[data-variant=primary][aria-disabled=true]{background:var(--basalt-state-selected);box-shadow:none}.btn[data-variant=ghost][disabled]{box-shadow:none}.btn[aria-busy=true]{cursor:progress}.btn[aria-busy=true]>*{opacity:0}.btn[aria-busy=true]:after{content:"";position:absolute;inset:0;margin:auto;width:var(--basalt-size-icon-sm);height:var(--basalt-size-icon-sm);border:1.5px solid color-mix(in oklch,currentColor 25%,transparent);border-top-color:currentColor;border-radius:var(--basalt-radius-full);animation:bh-spin var(--basalt-duration-loop-ring) linear infinite}.btn svg{flex:none}@media(pointer:coarse),(width<720px){.btn{min-height:var(--basalt-size-tap-min);border-radius:var(--basalt-radius-md)}.btn[data-icon-only]{min-width:var(--basalt-size-tap-min)}}@media(pointer:coarse),(width<720px){a:not(.btn,.row,.tab,.disclosure,.brand,.skip-link,:is(p,li,.prose,.small,.hint,.error,.callout-body) a),nav a:not(.btn,.site-footer-links-host a),.footer a,.tap{display:inline-flex;align-items:center;min-height:var(--basalt-size-tap-min);margin-block:var(--bh-tap-margin, min( 0lh , calc((1lh - var(--basalt-size-tap-min)) / 2)))}.skip-link{display:inline-flex;align-items:center;min-height:var(--basalt-size-tap-min)}:is(a:not(.btn,.row,.tab,.disclosure,.brand,.skip-link,.topbar-links a,:is(p,li,.prose,.small,.hint,.error,.callout-body) a),.tap){position:relative}:is(a:not(.btn,.row,.tab,.disclosure,.brand,.skip-link,.topbar-links a,:is(p,li,.prose,.small,.hint,.error,.callout-body) a),.tap):after{content:"";position:absolute;inset-block:0;left:50%;width:max(100%,var(--basalt-size-tap-min));transform:translate(-50%)}.stack>a:not(.btn,.row,.tab,.disclosure):has(+a){margin-block-end:0;min-height:calc((var(--basalt-size-tap-min) + 1lh) / 2);align-items:flex-end}.stack>a+a:not(.btn,.row,.tab,.disclosure){margin-block-start:0;min-height:calc((var(--basalt-size-tap-min) + 1lh) / 2);align-items:flex-start}.stack>a+a:not(.btn,.row,.tab,.disclosure):has(+a){min-height:1lh;align-items:center}}@keyframes bh-spin{to{transform:rotate(360deg)}}@keyframes bh-fade{50%{opacity:.55}}@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}.btn[aria-busy=true]:after{animation:bh-fade var(--basalt-duration-loop-fade) var(--basalt-ease-in-out) infinite;border-top-color:color-mix(in oklch,currentColor 25%,transparent)}.btn:active:not([disabled],[aria-disabled=true],[aria-busy=true]){transform:none}.btn{transition-property:background-color,color,box-shadow}}@media(forced-colors:active){:is(.panel,.card,.callout,.code,.table-wrap){border-color:CanvasText}.btn{border:var(--basalt-size-hairline) solid ButtonText}}@media print{.skip-link{display:none}:is(.panel,.card,.callout,.code,.table-wrap){break-inside:avoid}}} diff --git a/AGENTS.md b/AGENTS.md index 5da0e2a6..fbb33755 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -51,8 +51,9 @@ Basalt has one owner (Bailey) and a design panel of two independent design revie diagram's card. Never decorative. Colour never carries meaning alone: pair it with a word, icon or shape. Syntax colours never carry status (diff colours are a deferred exception). -- **WCAG 2.2 AA everywhere:** 4.5:1 for text, 3:1 for boundaries, focus and icons, on - every surface the pair can appear on, in both themes. Contrast tests prove it; add a +- **WCAG 2.2 AA everywhere:** 4.5:1 for text, 3:1 for boundaries, focus and icons, on every surface the pair can appear on, in both + themes. One exception, by name: a `RunTimeline`'s tail recedes below 4.5:1 from its second row (`opacity-recede-2` to `-5`), because + the control above it opens the whole record at full contrast (WCAG G174); it never recedes under more contrast or in forced colours. Contrast tests prove it; add a pair to them when you add a token. - **Borders build structure; shadows are only for things that float.** No gradient borders, glow or bounce, and no press scale beyond Button and IconButton's .98. Hover @@ -123,7 +124,8 @@ Basalt has one owner (Bailey) and a design panel of two independent design revie tabs that scrolls, a sortable header cell (a header band that is itself a button), a phone tab bar cell, and a cut cell of a still table (a focus stop, which shows its own ring after Esc has closed its plate). These structural vertical lines are allowed, each named and never a selection, sort, active or status mark: the 1px divider at a pinned table column's edge while the table is scrolled, the app sidebar's 1px edge, a meter's labelled target tick, the vertical - `Separator` between groups of controls, the edges between a `NumberField`'s value and its steppers, a diagram's connector and a sequence diagram's lifeline. The active row in a menu, select, combobox or command menu is a rounded plate + `Separator` between groups of controls, the edges between a `NumberField`'s value and its steppers, a diagram's connector and a sequence diagram's lifeline, and a stage list's or run timeline's connector (1px between two marks, never + filled and never a state). The active row in a menu, select, combobox or command menu is a rounded plate (radius 8, one solid fill per level) plus a lift from secondary ink to primary, with no weight change: it is the row the keyboard is on, and it changes with every arrow key (WCAG 1.4.1). A selected table row is the wash band, and its checked box carries the state. A wash over an opaque fill (a pinned cell) is one colour from `color-mix`, never a gradient, an image or a @@ -156,9 +158,10 @@ Basalt has one owner (Bailey) and a design panel of two independent design revie the parts of a field or a disabled, loading or busy button). In popup rows (Menu, Select, Combobox, command menu) one plate glides between rows (`duration-base`, `ease-out`): it appears in place on entry, freezes and fades on leave, keys move it at once, and it is off on touch, under - reduced motion and in forced colours. Nothing overshoots. Three kinds of thing loop, and nothing else: a mark that says work is running + reduced motion and in forced colours. Nothing overshoots. Four kinds of thing loop, and nothing else: a mark that says work is running (the ring, braille, a busy Button's ring, a busy TextButton's underline, the indeterminate Progress bar, Sparkline's loading line, Skeleton's pulse and a written field's fill), a - page's one ambient loop, opacity only, in its art, and an animated diagram's live lines; `data-loops="held"` stops all three. One figure on a page's first screen may draw its marks once + queued stage's mark (`StageMark`, opacity 0.65 to 1 on `duration-loop-fade`, never under 3:1, never a badge's ring), a page's one ambient loop, opacity only, in its art, and + an animated diagram's live lines; `data-loops="held"` stops all four. One figure on a page's first screen may draw its marks once at load on a first visit (`duration-figure` 600ms, `duration-stagger` 22ms, at rest on a second visit and under reduced motion); a traveller between two resting places on screen uses `ease-in-out` (a leg of 300ms up to 150px, 2ms a pixel above, 600ms from 300px); a filtered or sorted list or grid moves what stays by transform and never replaces an item (past 48 items that would move, it lands at once); a number beside a figure never counts up. The hold or printing settles a running entrance at once, and a page change without a reload counts as a load. @@ -187,7 +190,8 @@ Basalt has one owner (Bailey) and a design panel of two independent design revie Navigation glyphs in a sidebar or rail are primary at rest; every other icon is secondary at rest. Don't redraw a glyph in code: change `packages/react/glyphs/source.mjs` and run `node packages/react/glyphs/generate.mjs`. On Apple platforms, SF Symbols for system concepts - (info, warning, error, success). Status icons pair with words. + (info, warning, error, success). Status icons pair with words. A stage's mark (`StageMark`) is seven shapes at 16, running the ring; its state's word is always said, + and where it is drawn differs by part: foundations' table in "Stages and runs" is the rule. - **Diagrams:** monochrome; one focal node, inverted. Three lines named by look (main 2px, plain 1px, dashed), and the key says what each means. The drawn layout is used only when it fits (640, the track minimums, a clean seat for every label); otherwise stacked, in the author's order, at most 480 wide. Nothing is cut and nothing overlaps at any width. Ports, routes, groups and foreign keys are derived from one @@ -281,9 +285,9 @@ say so if you report one. `npm run lint`, `npm test`, `npm run check` and `npm run ci:local` run every step and fail at the end, ending in one line a step (passed or failed, and for a failed test step the files that failed), so one failing file does not hide the steps after it. The steps print in order, each under its own header: the first failing section of the log is the first failure, and the summary marks it. `ci.yml`'s own steps are unchanged. Renders and browser tests launch Chromium through -`scripts/chromium-launch.mjs` (overlay scrollbars and full raster), so a docked laptop and an undocked one draw the same pixels. Three +`scripts/chromium-launch.mjs` (overlay scrollbars and full raster), so a docked laptop and an undocked one draw the same pixels. Five tests that look at classic scrollbars (`tools/html-skill/test/parity-4.test.mjs` and `parity-8.test.mjs`, and -`packages/react/test/table-filter.test.mjs`) launch with the module's `ignoreDefaultArgs` removed on purpose. The brand test +`packages/react/test/table-filter.test.mjs`, `stage-transcript.test.mjs` and `run-timeline.test.mjs`) launch with the module's `ignoreDefaultArgs` removed on purpose. The brand test (`brand/test/brand.test.mjs`) launches Chromium without the module: nothing in `brand/` is edited alongside the tooling, so it has not been moved to the module, and should be the next time `brand/` is changed. diff --git a/docs/foundations.md b/docs/foundations.md index bb0c3758..e03d035e 100644 --- a/docs/foundations.md +++ b/docs/foundations.md @@ -12,7 +12,15 @@ of Basalt's accent classes, in its named roles, and nowhere else. - **Meet WCAG 2.2 AA by construction.** Every text, boundary and focus pair is tested on every surface it can appear on (`packages/tokens/test/contrast.test.mjs`). A token change - that breaks a pair fails the build. + that breaks a pair fails the build. **One exception: a run timeline's tail.** In a `RunTimeline` with `keep`, a finished step + older than the newest `keep` recedes: the first is `text-tertiary`, then `text-secondary` at `opacity-recede-2` to `-5` (0.5, 0.32, + 0.2, 0.12) over its own ground, and a failed step the same from `status-danger` (0.88 first), so it stays a muted red. The first + step is 4.5:1 on every surface; the rest are below it on purpose. It is allowed because the page offers the same content at full + contrast, by WCAG's own technique (G174): a control that is itself 4.5:1 sits directly above the tail, opens the whole record in + full ink and in full, and says when the tail holds a failure. Five things hold it: a step that is running, waiting or retrying + never recedes; a failure was said when it happened and stood in full while it was among the newest; everything a tail row says + stays in the accessibility tree; under more contrast and in forced colours nothing recedes; and no other text in Basalt uses these + tokens. A test holds each to it. - **The page is the darkest layer, in both themes.** Anything closer to you is lighter. Light mode never puts a full white page in front of you. - **Borders build structure; shadows exist only for things that float.** @@ -564,9 +572,11 @@ kept as a rule so both themes behave alike (DECISIONS 166). Four text levels wer "$" in Chromium). `CodeBlock`'s optional `prompt` puts every line in the gutter, and a line after a trailing `\` gets an empty one; copy still takes `code` exactly as given. The terminal's copy button says "Copy commands" and copies the commands only, one per line. Static by default: a `figure` with a named `pre` (`tabindex="0"`) and no live region. A - live transcript is `role="log"` only while lines arrive, never idle, paused or finished; it has a fixed height of nine + live transcript is `role="log"` only while lines arrive, never idle, paused or finished, and a stage transcript (`stages`, + declared when it mounts and not read from its lines) is never one at any moment, because its run's `RunAnnouncer` speaks; it has a fixed height of nine lines that scrolls inside, so arriving lines never move the page, and follows new lines only while the reader is at - the end. A replay has a pause control, and every word that changes in place in the head reserves its widest form. + the end. Its window draws no scrollbar on either axis (the owner, DECISIONS 312), and neither does a `RunTimeline`'s. Each stays + a named tab stop that the keys, the wheel and a finger scroll. A static `Terminal` and a `CodeBlock` keep the system's. A replay has a pause control, and every word that changes in place in the head reserves its widest form. Long lines scroll sideways, as `CodeBlock`'s do unless it is given `wrap` (see [Lists and facts](#lists-and-facts)). (Decision 98.) The gutter is one column for the whole block, `CodeBlock`'s too: the prompt's width plus 1ch, at least 24px, measured by the browser and never counted in characters, so `$` is exactly 24px and a longer prompt ("PS>") or a wide glyph widens the column for every line and the text of every line starts on one @@ -583,13 +593,16 @@ kept as a rule so both themes behave alike (DECISIONS 166). Four text levels wer is the default, and it turns in 640ms in a button, in the command menu's loading slot and wherever a spinner stands without a visible word. Braille is for a status: work that runs while a word beside it says so, in a table, a list row, a toast or a log line; never in a button, and never - without its word. Braille is Basalt's own six-dot cell drawn in SVG, 6 by 10 with 2px dots on + without its word. One more place has the ring: the running form of a `StageMark`, a 16px status mark whose other states are + circles of its size, so the mark keeps its outline from queued to passed. It is the ring with or without a word beside it. + Braille keeps the 6px status seat (a `Badge`, a table, a list row, a toast) and a log's gutter. One object has one running + mark, never both. Braille is Basalt's own six-dot cell drawn in SVG, 6 by 10 with 2px dots on whole pixels, stepping through ten frames (⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏) in 800ms; unlit dots are not drawn. It takes the status dot's place and gap, in its word's colour. Spinners on a page share one clock. Under reduced motion the ring fades and braille holds its first frame. **A page can hold every loop.** `data-loops="held"` on `` stops every loop Basalt draws, portals included: braille, the ring, a busy Button's ring, a busy TextButton's underline, the indeterminate Progress bar, - Sparkline's loading line, Skeleton's pulse and a written field's fill, and the page's ambient loop (its marks hold at full opacity); under the hold nothing + Sparkline's loading line, Skeleton's pulse and a written field's fill, a queued `StageMark`'s breath, and the page's ambient loop (its marks hold at full opacity); under the hold nothing starts by itself: an entrance is drawn at rest and a demonstration does not send itself. There is no per-spinner prop, and the attribute can't be set on a subtree. Braille holds its first frame and the ring stands still at its drawing, at full opacity; nothing is hidden, swapped for another glyph or announced, and the @@ -618,7 +631,11 @@ kept as a rule so both themes behave alike (DECISIONS 166). Four text levels wer started ("Started 3:47 PM", with the date for another day) and a streaming count or step line hides while the status word stays; on release the current text is written. A result lands as usual: the word turns to Passed or Failed and a toast speaks once. A column that holds an - elapsed time is wide enough for the held form. A step line under a name (a two-line cell) hides + elapsed time is wide enough for the held form. **A run is the one exception to both sentences about an elapsed time.** Its head + timer alone takes the held form ("Started 3:47 PM", from when the run first started), in a seat that holds it. A stage's, a step's, + a rail node's and a stage line's own running time is not given the held form, and its column is not sized for it: it hides with + `visibility: hidden`, its box kept, and the current figure is written on release. Under the hold every change of a stage's state + lands at once. A step line under a name (a two-line cell) hides with `visibility: hidden` while held, which keeps its box and takes it out of the accessibility tree; on release the current text is written into the same box, so neither the hold nor its release moves a row. (A step line in a column of its own just empties.) A Select's placeholder @@ -1460,8 +1477,11 @@ Basalt allows a short list of vertical lines. Each is structure, and none is a s ruling against the vertical bar is about marks): the 1px divider at a pinned table column's edge while the table is scrolled, the app sidebar's 1px edge, a meter's labelled target tick, the vertical `Separator` between groups of controls (1px `border-divider`, as tall as the controls), the edges between a `NumberField`'s value and its steppers (part of the -field's own boundary), a diagram's connector (a line that joins two nodes and ends in a head, with its stems, rails and buses) and a -sequence diagram's lifeline. A connector is never drawn without both its nodes and its head, and neither is ever a mark of state. +field's own boundary), a diagram's connector (a line that joins two nodes and ends in a head, with its stems, rails and buses) a +sequence diagram's lifeline, and a stage list's or a run timeline's connector: a 1px line in `border-input` that joins one stage's +mark to the next. It is drawn between every two consecutive marks, beside an open detail too, and it never fills, breaks, moves or +changes colour with a stage's state: the mark and its word carry the state. A rail's links are horizontal and are not on this list; +they fill as their stage passes, repeating the check before them. A connector is never drawn without both its nodes and its head, and neither is ever a mark of state. Status: decided by the council and approved by the owner (DECISIONS 138 and 139); the diagram's connector and lifeline decided by the council (DECISIONS 281, a handoff); the implementation hasn't been reviewed. @@ -2113,10 +2133,13 @@ else (no row, card, menu item, command row or the parts of a field; there is no Combobox, Popover, Tooltip) enters from opacity 0 and scale .98, from where it grew (`--transform-origin`), with no offset, in `duration-base` on `ease-out`, and leaves at three quarters of that on `ease-in`. A Dialog enters the same way from its own centre (it grows from no opener), in `duration-slow`, and leaves at three quarters of that on `ease-in`. The horizontal tab underline, and the panel that moves 8px with it, run on -`duration-slow` `ease-out`; the panel never remounts. Three kinds of thing loop, and nothing else: a mark that says work is running +`duration-slow` `ease-out`; the panel never remounts. Four kinds of thing loop, and nothing else: a mark that says work is running (the ring, braille, a busy Button's ring, a busy TextButton's underline, the indeterminate Progress bar, Sparkline's loading line, Skeleton's pulse and a written field's fill), a -page's one ambient loop, opacity only, in its art, and an animated diagram's live lines (a flow line, a pulse, a packet that repeats); -`data-loops="held"` stops all three. +queued stage's mark, a page's one ambient loop, opacity only, in its art, and an animated diagram's live lines (a flow line, a pulse, a packet that repeats); +`data-loops="held"` stops all four. **A queued stage's mark** (`StageMark` at `queued`: work that waits to start) breathes by opacity alone, +from `opacity-queued` (0.65) to 1 and back on `duration-loop-fade` and `ease-in-out`, in secondary ink, on the shared clock, and is 3:1 or +better against its ground at every moment. It is the `StageMark` only: a `Badge`'s pending ring, a dot and a word never breathe. It is +still, at full, under reduced motion, under the hold, in forced colours and in print. A stage that has finished never loops. **The sliding pill.** A one-of-many control, the segmented control and vertical tabs, holds one pill, and it slides to the chosen item by `transform` and size (`width`, and `height` for the vertical list) on `duration-slow` and `ease-out`, @@ -2642,6 +2665,93 @@ at it, as a `Terminal` does, and says what must be heard through `StatusLine`. B - **Loading.** The stream's parts are drawn by `LoadingShape` like any others: an avatar is a bone in its disc, the name, time and words are bars as long as their words, a mark is a bone in its box. Nothing in them is sized by hand for loading. +## Stages and runs + +**Status.** Decided by the council for the owner's handoff (DECISIONS 302, 304, 307, 312 and 316); the implementation hasn't been reviewed. + +Work that runs in stages and reports as it goes: a deploy pipeline, a CI job list, an agent's run. Seven parts carry it (`StageMark`, +`StageList` and `StageRail` with their `RunStage` rows, `RunTimeline` with its `RunStep` rows, `RunTimer`, `StageBadge` and `RunAnnouncer`), and +`Terminal` takes stage lines. Nothing new is named `stage` alone: `Stage` is the full-bleed art, and every class here begins `basalt-run-` +(the skill's `run-`, in its `runs` module). + +- **The seven states and their mark.** One mark a state at 16px (`size-icon-sm`; 20 and 24 by the status seat's rule), `aria-hidden`, in a seat + that never changes size; the word carries the state. Queued is Phosphor Bold `Circle` in `text-secondary`, breathing (see Motion); running is + the ring in `text-primary`; passed the outline `CheckCircle` in `text-secondary`; failed the outline `XCircle` in `status-danger`; skipped + `MinusCircle` and canceled `Prohibit` in `text-tertiary`; retrying is the ring, as running. No filled disc anywhere. The default words are + Queued, Running, Passed, Failed, Skipped, Canceled and Retrying (US English); the app may change any of them ("Investigating", "Waiting for + approval", "Retrying, 2 of 3"). A stage held up by a failure above it is skipped with the word "Blocked by Test". A change of state crossfades: + both marks stand in the one seat, the old fading out as the new fades in, over `duration-fast` on `ease-out`, kept under reduced motion. In + forced colours a mark is `currentColor` and names no system colour. +- **Where each state's word is drawn.** Every state's word is always in the accessibility tree, after the name, and this table is the rule: + + | Part | Drawn | Said and not drawn | Not a state there | + |---|---|---|---| + | `StageList` | Queued, running, failed, skipped, canceled, retrying | Passed | | + | `StageRail` | Failed, skipped, canceled, retrying, in the node's status seat | Queued, running, passed | | + | `RunTimeline`, a full step | Queued, failed, skipped, canceled, retrying, and any word the app gives | Running, passed | | + | `RunTimeline`, a tail row | Failed, skipped, canceled, and the app's word | Passed | Queued, running and retrying: they never roll | + | `Terminal` stage line | Skipped, canceled, and any word the app gives | Running, done, failed (the mark is a named image) | Queued and retrying | + | `StageBadge` | Always, all seven | | | + + A state is said once: where the word is drawn the mark is `aria-hidden`; where it is not, the mark is a named image (the log) or a visually + hidden word follows the name. A passed stage is its outline check and its duration. +- **`StageList`.** A known sequence of named stages, an `ol` named by `label`. A row is the mark (16), `space-3`, the name and its word + (`space-2` apart, one line, never wrapped), the meta and the timer, at `text-sm`, `space-2` above and below: 34px. The name is primary, and + secondary while queued, skipped or canceled; the word secondary, primary while running or retrying, `status-danger` at 500 when failed, tertiary + while queued, skipped or canceled; the meta tertiary at `text-xs`, hidden under 480px of the list's own container. The connector is a 1px + `border-input` line on the marks' centre line from `space-1` under one mark to `space-1` above the next, beside an open detail too, and never a + state (see Vertical lines). A stage's detail (`detail`, `action`: a failure's reason and Retry, what waits and Approve) opens under it, indented + to the name, by height and opacity over `duration-slow` on `ease-out`, closing at 0.75 on `ease-in`, `inert` while closed; inside it `code` is + Geist Mono at 1em. The room for one detail is held from the start (`reserveDetail`), a `calc` of tokens and never a measure, so a failure + moves only the rows under it. Retry and Approve are `Button`s whose `onClick` returns the app's promise. When a detail closes or its action + leaves while focus is inside it, focus goes to that stage's name, whoever resolved it. +- **`StageRail`.** The same rows on one line: two to four stages at any width, five or six from 480px of its own container (under it, drawn as + the list). A node is the mark in a `space-6` row, the name (`text-sm`, centred) and one status seat (`text-xs`): its time while running or + passed, its word when it failed (`status-danger` at 500), was skipped or canceled (tertiary) or is retrying (primary), in one `Reserve` cell. + A link is a horizontal 1px `border-input` track with a `text-secondary` fill that grows from the inline start over `duration-slower` on + `ease-out` when its stage passes, empties at once on a retry and stays empty after a failure; it repeats the check before it and is never the + only sign of anything. No bead and no pulse: the running ring is the rail's only moving thing. `Progress`'s value takes tabular figures and the + room of "100%". +- **`StageBadge`.** A `Badge` bound to the seven states (the pending ring, braille, the success, danger and neutral dots), `outline` in a run's + head and `plain` in a list or table. Its seat is as wide as its widest face from a static measure. A change of face is sequential: the old face + fades and rises `space-1` over 0.75 of `duration-base` on `ease-in`, then the new one fades in from `space-1` below over `duration-base` on + `ease-out`. One accessible name at every moment. +- **The deploy log** is a `Terminal` declared `stages`, with lines `{ kind: "stage", state, text, word?, start?, end? }`. The gutter holds braille + while running, the core check in secondary when done, `XCircle` in danger when failed (the error line), the core minus in tertiary when skipped + and `Prohibit` in tertiary when canceled. Skipped and canceled lines draw their word first ("Skipped cache restore (no cache)"). A duration + stands at the line's end in tertiary, one column down the log. The head gains the run's time. A stage transcript is never a `log`: from its + first frame its window is a named `region` (a `group` while empty) and the run's `RunAnnouncer` speaks. With `keep`, lines older than the + newest `keep` stages step back once (see Logs, status and forms). +- **`RunTimeline` and the counter.** An append-only `ol` of steps, a sentence each: the mark, `space-3`, the sentence, the meta (a result, a + middle dot, the time), at `text-sm`. From 640px of its own container the meta ends on the row's end edge; under it the meta goes under the + sentence. A detail and an action are always drawn under a full step. `keep` (3 when left out; `false` is the whole record) is the counter: + the newest `keep` steps stay in full and a finished step older than those rolls into the tail (a step running, retrying or waiting never + rolls, and nothing after it does). A tail row is `text-xs` at 400, 20px, one line cut with an ellipsis, its mark still 16, no connector and + no detail, its ink its depth's step (see Principles); everything it says stays in the accessibility tree. The window is the list's + scrolling box, its floor `keep` rows plus two and a half tail rows, only growing; it draws no scrollbar and is a named tab stop while it + overflows. A roll moves the rows inside the window by transform over `duration-slow` on `ease-out`, the ink stepping on the same clock and + the arrival fading over `duration-base`; past 48 counted rows it lands at once, as `Reflow` does. It follows new steps only while the reader + is at its end (read from its geometry), holds still while a control in it has focus or the pointer, and starts at its end. The toggle above + it ("Show 5 earlier steps", "Show 5 earlier steps, 1 failed"; open, "Hide earlier steps") holds its line from the first frame and opens the + whole record in full form. Hover and focus lift the tail to its first step. Nothing here speaks. +- **`RunTimer`.** Geist Mono at `text-xs`, tertiary, tabular, a `time` with an ISO duration, never a live region: "12.3 s" under a minute + (every 100ms), "12 min 34 s" to an hour, "12 hr 34 min" to a day, then "3 days". One shared interval. Its seat is one `Reserve` cell as wide as + its scale's longest form, end-aligned and never empty; a list sets one scale for all its timers. It counts from `start`, is frozen at `end`, + adds `carried` across a retry, and its held form reads from `since`. A run's time counts while it runs, retries or waits for an approval, and + is frozen while it has failed, is canceled or has passed. +- **`RunAnnouncer`.** One a run: a visually hidden `role="log"`, polite, additions only, each event its own appended element, said once and in + order; a repeated `id` is quiet and events present at mount are not said. An app sends the run's start, a failure with its reason, a retry + when it starts, an approval needed or given by someone else, a cancel and who made it, and the run's end with its outcome and time; never a + timer, a spinner's frame, a log line, a stage that passed, a roll, the hold or the reader's own press. Never `role="alert"`, and no toast for + the same result. +- **Modes.** Reduced motion: nothing moves, grows or travels; the mark's crossfade stays; the queued mark is still at full; a rail's fill, a + detail and a roll land at once; an arriving step fades over 100ms; the badge's faces only fade; timers tick. The hold: the ring and braille + stand still, the queued mark is still at full, every change of state lands at once, and a stage's own running time hides (see "A page can + hold every loop"). A demonstration asks the hold when it would start and does not start under it; a run the reader starts runs whatever the + hold. More contrast: no tail, every stepped-back line at the first step and a failed one full `status-danger`. Forced colours: marks and + words are `currentColor`, nothing steps back, the queued mark is still and connectors are real borders. Print: as the hold, with the tail + open. + ## Loading in the page's own shape **Status.** Decided by Opus and approved by the owner (DECISIONS 247, 248, 249b and 258: the shape of what it stands for, known words kept and icons hidden, @@ -2718,7 +2828,7 @@ as if it were known, which Basalt can't detect. ## What the HTML skill does not draw -The log slots, the status bar, the command block, the event log, the source stamp, the inline-label rows, the filter toolbar, the notice bar, the listbox, the open list, the drawer and `Reflow` are React's alone: the HTML skill has no module for them (DECISIONS 167, Q8). So are `Pagination` and `ListBand` (DECISIONS 222: the skill has no pagination module and none is added). The skill's modules draw the rest (DECISIONS 230, the owner approved the caps): `select` has `data-numeric` (the width of its widest option, measured once fonts are ready; cap 9,000), `filter` has a toolbar trigger that holds its widest value (cap 17,450), and the form dialog is a module of its own, `dialog-form` (`data-form`: the 480 box, the held head and foot, the scrolling body, full screen under 720, the top held as it opens and first focus by the input that opened it; cap 2,200), so the plain and alert dialog keep `dialog`'s 5,150. React's alone: `FormGrid` and the rest of the form gaps (DECISIONS 242: the form grid, a segmented control's `fullWidth`, `required`, `invalid` and its tab stop on the chosen value, a `Switch` description, `TextButton` keeping focus and underlining a `Reserve`), the held top's re-measure on a window resize, and the scrim closing a form only while nothing has been entered (the skill's scrim closes it), a list's `scroller`, and an explainer on a header that does not sort. React's alone too: `LoadingShape` and its parts (DECISIONS 258; the skill's loading shape is a follow-up batch). React's alone too: `Composer`, `Mention` and `MentionPicker` (cimip-gaps-2, B3; see [Writing to someone](#writing-to-someone-the-composer-the-mention-and-the-picker)). So are the conversation stream's parts (`Stream` and its entries, `StreamQuote`, the arrived mark, `DisclosureRow`, `ActivityList` and `Presence`; round 56, a follow-up batch). React's alone as well: `NotificationList` (the center's page form), a group's reveal track (the skill's group opens at once), and the search over a server (`SearchField`, `SearchPassages`, `SearchPassage`, `markMatches`); the skill's `notifications` module draws the pending ring and groups (cimip-gaps-2, B7). The app shell's gaps (cimip-gaps-2, B4) are in the skill: `data-capped` on `.app-shell` (the `app-shell` module, cap 4,300 from 3,250, the skip link on the brand's start edge included), `.app-heading` and `.app-facts` under the title, the primary kept under 720, `data-size="sm"` on a `.nav` (the `nav` module, cap 5,350 from 4,800), and the `pane` module (`.pane-layout`, cap 1,700), whose script makes an overflowing pane a tab stop, including when its content arrives or grows after the page. React's alone too: the parts of [Lists and facts](#lists-and-facts) (`PanelList`, `SelectableList`, `DescriptionList narrow`, `CodeBlock wrap`, `Select toolbar` and the form dialog body's stack); a later batch may bring them to the skill. Whether the skill gets the links and the charts is not decided. +The log slots, the status bar, the command block, the event log, the source stamp, the inline-label rows, the filter toolbar, the notice bar, the listbox, the open list, the drawer and `Reflow` are React's alone: the HTML skill has no module for them (DECISIONS 167, Q8). So are `Pagination` and `ListBand` (DECISIONS 222: the skill has no pagination module and none is added). The skill's modules draw the rest (DECISIONS 230, the owner approved the caps): `select` has `data-numeric` (the width of its widest option, measured once fonts are ready; cap 9,000), `filter` has a toolbar trigger that holds its widest value (cap 17,450), and the form dialog is a module of its own, `dialog-form` (`data-form`: the 480 box, the held head and foot, the scrolling body, full screen under 720, the top held as it opens and first focus by the input that opened it; cap 2,200), so the plain and alert dialog keep `dialog`'s 5,150. React's alone: `FormGrid` and the rest of the form gaps (DECISIONS 242: the form grid, a segmented control's `fullWidth`, `required`, `invalid` and its tab stop on the chosen value, a `Switch` description, `TextButton` keeping focus and underlining a `Reserve`), the held top's re-measure on a window resize, and the scrim closing a form only while nothing has been entered (the skill's scrim closes it), a list's `scroller`, and an explainer on a header that does not sort. React's alone too: `LoadingShape` and its parts (DECISIONS 258; the skill's loading shape is a follow-up batch). React's alone too: `Composer`, `Mention` and `MentionPicker` (cimip-gaps-2, B3; see [Writing to someone](#writing-to-someone-the-composer-the-mention-and-the-picker)). So are the conversation stream's parts (`Stream` and its entries, `StreamQuote`, the arrived mark, `DisclosureRow`, `ActivityList` and `Presence`; round 56, a follow-up batch). React's alone as well: `NotificationList` (the center's page form), a group's reveal track (the skill's group opens at once), and the search over a server (`SearchField`, `SearchPassages`, `SearchPassage`, `markMatches`); the skill's `notifications` module draws the pending ring and groups (cimip-gaps-2, B7). The app shell's gaps (cimip-gaps-2, B4) are in the skill: `data-capped` on `.app-shell` (the `app-shell` module, cap 4,300 from 3,250, the skip link on the brand's start edge included), `.app-heading` and `.app-facts` under the title, the primary kept under 720, `data-size="sm"` on a `.nav` (the `nav` module, cap 5,350 from 4,800), and the `pane` module (`.pane-layout`, cap 1,700), whose script makes an overflowing pane a tab stop, including when its content arrives or grows after the page. React's alone too: the parts of [Lists and facts](#lists-and-facts) (`PanelList`, `SelectableList`, `DescriptionList narrow`, `CodeBlock wrap`, `Select toolbar` and the form dialog body's stack); a later batch may bring them to the skill. The stages and runs (DECISIONS 316) are in the skill as states, not machinery: the `runs` module draws the seven marks (`.run-mark`), a stage list and a rail (`.run-stages`, `.run-rail`, `.run-stage`) and a timeline's full rows (`.run-steps`, `.run-step`), and `terminal` takes `data-stages` (a replay that is never a `log`), stage lines and no scrollbar on a replay's window. React's alone: the counter, a ticking `RunTimer`, `StageBadge`'s swap (the skill's `status` badge is swapped at once), `RunAnnouncer`, the held room and the focus rules. Whether the skill gets the links and the charts is not decided. ## Logs, status and forms @@ -2727,7 +2837,9 @@ shortcuts and time parts (DECISIONS 162: the council voted, four members, 3 of 4 implementation hasn't been reviewed by the panel). Candidates D14a, D14b, D15, X10 and X11; X3 is `Reserve`, already built. - **A log line's fields** (V1, V2; `LogFields`, `LogLine`, `Terminal`'s `fields`). The fields that say what happened are primary ink at 400 and the rest secondary at - 400. Nothing steps back with age. A refused field stays primary and its own word ("denied") says it: no colour. A refused command's status word is + 400. Nothing steps back with age, with one exception: in a `Terminal` given `keep`, a stage line older than the + newest `keep` stage lines, and the output under it, is `text-tertiary` (a failed one `status-danger` at `opacity-recede-danger`). That is one + step and it is 4.5:1 on every surface; a transcript never goes below it, because it has no open form to switch to. A refused field stays primary and its own word ("denied") says it: no colour. A refused command's status word is primary at 500 beside `exit N`. A line may be a node; copy still takes the plain text. - **The command block** (`CommandBlock`; R1 to R3): a sticky head, opaque in the page colour, over the output. The core chevron, the command at 500 in primary ink, then the status, `exit N` and the time in tertiary; 16 on 24; 20 above and 16 below the head; 28 between the command and its meta; a hairline between blocks and `space-16` diff --git a/docs/motion.md b/docs/motion.md index 29ff3f12..7d4e8f48 100644 --- a/docs/motion.md +++ b/docs/motion.md @@ -189,6 +189,20 @@ a lead, a section or a column grid has an entrance, a fade-up, a count-up or a l is a swap with no fade: the fallback face (see [foundations](foundations.md#interface-type)) is metric-matched so the page moves as little as it can, and it does not promise the same wrap at every width. Under reduced motion the render is the same, because nothing here moves. +## Stages and runs + +Status: decided by the council for the owner's handoff (DECISIONS 302, 304, 307, 312 and 316); the implementation hasn't been reviewed. See [foundations](foundations.md#stages-and-runs). + +| What | Motion | Reduced motion | The hold | +|---|---|---|---| +| A `StageMark`'s change of state | Both marks stand in the one seat, the old fading out as the new fades in, over `fast` on `ease-out` | The same (opacity only) | Lands at once | +| A `StageBadge`'s change of face | Sequential: the old face fades and rises `space-1` over 0.75 of `base` on `ease-in`, then the new one fades in from `space-1` below over `base` on `ease-out`; no width animates | The faces only fade | Lands at once | +| A stage's detail row | Opens by height and opacity over `slow` on `ease-out`; closes at 0.75 on `ease-in` | Lands at once | Lands at once | +| A rail's link | Its fill grows from the inline start over `slower` on `ease-out` when its stage passes; empties at once on a retry | Lands at once | Lands at once | +| A run timeline's roll | Each row inside the window moves by transform from where it was drawn over `slow` on `ease-out`, the ink stepping on the same clock; the arriving step fades over `base`; past 48 counted rows it lands at once | Lands at once; the arrival fades over 100ms | Lands at once | +| A stage transcript's step back | A colour step over `fast`; nothing moves | The same | Lands at once | +| The queued breath | See Spinners | Still, at full | Still, at full | + ## Spinners | Variant | Use it | @@ -196,9 +210,11 @@ can, and it does not promise the same wrap at every width. Under reduced motion | `ring` | A wait: the default arc, in a loading button, the command menu's loading slot, and wherever a spinner stands without a visible word. One turn in 640ms. Under reduced motion it fades on `duration-loop-fade`. | | `braille` | A status: work that runs beside a word that says so, in a table, a list row, a toast or a log line. Never in a button, never without its word. Basalt's own six-dot cell drawn in SVG, 6 by 10 with 2px dots on whole pixels (9 by 15 at size 20, 12 by 20 at 24), ten frames (⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏), one 800ms cycle (80ms a frame), hard `step-end`; unlit dots are not drawn. It takes the status dot's place and gap, in its word's colour. It holds its first frame under reduced motion. | +**The queued breath** (DECISIONS 316) is a `StageMark`'s at `queued`, and no other mark's: by opacity alone, from `opacity-queued` (0.65) to 1 and back on `duration-loop-fade` and `ease-in-out`, alternating, in secondary ink, 3:1 or better at its lowest on every surface. It joins the shared clock and the hold, and is still, at full, under reduced motion, in forced colours and in print. A `Badge`'s pending ring never breathes. + Spinners on a page share one clock: each animation starts at the document timeline's origin, so spinners mounted at different moments tick in phase, each variant on its own period. -**The hold.** `` (set by `useLoops()`) stops every Basalt loop, portals included: braille stays on ⠋ and the ring stands still at its drawing, at full opacity; a busy Button's ring, a busy TextButton's underline (dashed and full), Sparkline's loading line, Skeleton's pulse and a written field's fill stop with them, and the indeterminate Progress bar holds as the empty track, its indicator hidden (a still bar reads as a value). Nothing is hidden, swapped or announced. It outranks reduced motion by specificity, so held is one look whatever the OS says and the ring's fade stops too; reduced motion never turns it on. The state is stored for this app's origin in this browser (`basalt-loops`, `localStorage`) and follows across the app's tabs. Releasing jumps to now: every Basalt loop's `startTime` goes back to the timeline's origin, so spinners mounted at different moments tick in phase, and nothing resumes from the held frame. The toast's drain is a countdown, not a loop, so the hold does not stop it. An app reads `held` for its own rewriting text (an elapsed time shows when the work started; a streaming count hides). This is the WCAG 2.2.2 mechanism; the control is `LoopsToggle`, in the form the place needs (an icon toggle in a site header, a pressed-toggle Button in the view's head, a settings row with a Switch; a command is the app's part). The hold stops the page's ambient loop as well. See [foundations](foundations.md#motion). +**The hold.** `` (set by `useLoops()`) stops every Basalt loop, portals included: braille stays on ⠋ and the ring stands still at its drawing, at full opacity; a busy Button's ring, a busy TextButton's underline (dashed and full), Sparkline's loading line, Skeleton's pulse, a written field's fill and a queued `StageMark`'s breath stop with them, and the indeterminate Progress bar holds as the empty track, its indicator hidden (a still bar reads as a value). Nothing is hidden, swapped or announced. It outranks reduced motion by specificity, so held is one look whatever the OS says and the ring's fade stops too; reduced motion never turns it on. The state is stored for this app's origin in this browser (`basalt-loops`, `localStorage`) and follows across the app's tabs. Releasing jumps to now: every Basalt loop's `startTime` goes back to the timeline's origin, so spinners mounted at different moments tick in phase, and nothing resumes from the held frame. The toast's drain is a countdown, not a loop, so the hold does not stop it. An app reads `held` for its own rewriting text (an elapsed time shows when the work started; a streaming count hides). This is the WCAG 2.2.2 mechanism; the control is `LoopsToggle`, in the form the place needs (an icon toggle in a site header, a pressed-toggle Button in the view's head, a settings row with a Switch; a command is the app's part). The hold stops the page's ambient loop as well. See [foundations](foundations.md#motion). Beside a word, braille's size follows the word's cap height (16 beside 12 to 16px text, 20 beside 18 to 24px, 24 beside 30px and up), the seat is the cell's width and the gap equals it (6, 9 and 12px), so words start at 12, 18 and 24. diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index c6930b42..8682a0ec 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -155,6 +155,17 @@ export { Clock, Countdown, DateAge, useNow } from "./time"; export type { ClockProps, CountdownProps, DateAgeProps } from "./time"; export { formatAge, formatClock, formatCountdown, formatDay, formatElapsed, formatStamp, formatStatTime } from "./time-format"; export type { TimeOptions } from "./time-format"; +// Stages and runs (DECISIONS 316): the seven states' mark, a run's time, a status that changes in place, a run's one voice. +export { formatRunTime, STAGE_WORDS } from "./run-format"; +export type { Moment, RunTimeScale, StageState } from "./run-format"; +export { StageMark } from "./stage-mark"; +export type { StageMarkProps } from "./stage-mark"; +export { RunTimer } from "./run-timer"; +export type { RunTimerProps } from "./run-timer"; +export { StageBadge } from "./stage-badge"; +export type { StageBadgeProps } from "./stage-badge"; +export { RunAnnouncer } from "./run-announcer"; +export type { RunAnnouncerProps, RunEvent } from "./run-announcer"; export { Terminal } from "./terminal"; export type { TerminalLine, TerminalLineKind, TerminalProps, TerminalStatus } from "./terminal"; export { NumberTicker } from "./number-ticker"; diff --git a/packages/react/src/run-announcer.tsx b/packages/react/src/run-announcer.tsx new file mode 100644 index 00000000..27ebd903 --- /dev/null +++ b/packages/react/src/run-announcer.tsx @@ -0,0 +1,38 @@ +import * as React from "react"; + +// ---- A run's one voice (DECISIONS 316, 1.10) ---- +// A visually hidden `role="log"` (polite, additions only). Every event is its own appended element, so a screen reader keeps the order and the queue: +// each event is said once, in the order it happened, and none replaces another. An `id` already taken is ignored, so an event delivered twice is quiet. +// Events already in the list when it mounts are not said. Never `role="alert"`, and it draws nothing. `StatusLine` keeps its own rule (the last of +// several sends within 400ms), which is right for a filter's count and wrong for a run, where three events can land inside 300ms. + +export interface RunEvent { + /** Unique within the run: an event whose `id` was already said is not said again. */ + id: string; + /** What is said: the run's start, a failure with its reason, a retry when it starts, an approval needed or given, a cancel, the end with its time. */ + text: string; +} + +export interface RunAnnouncerProps { + /** Names the region ("Deploy 812 updates"). */ + label: string; + /** Append-only. Never a timer, a spinner's frame, a log line, a stage that passed, a roll, the hold, or the reader's own press. */ + events: readonly RunEvent[]; +} + +/** The run's live region. One a run; an app that uses it does not also send the run's result to a toast. */ +export function RunAnnouncer({ label, events }: RunAnnouncerProps) { + // The ids present at mount are taken without being said; every later id is said once, in arrival order (its first delivery). + const [atMount] = React.useState(() => new Set(events.map((event) => event.id))); + const seen = new Set(); + const said = events.filter((event) => { + if (atMount.has(event.id) || seen.has(event.id)) return false; + seen.add(event.id); + return true; + }); + return ( +
+ {said.map((event) =>

{event.text}

)} +
+ ); +} diff --git a/packages/react/src/run-format.ts b/packages/react/src/run-format.ts new file mode 100644 index 00000000..17dcf50f --- /dev/null +++ b/packages/react/src/run-format.ts @@ -0,0 +1,43 @@ +// The plain parts of stages and runs (DECISIONS 316): the states, their default words and a run's time as text. No React and no directive, so a Server +// Component can read them (test/server-modules.test.mjs). + +/** A stage's or a step's state. The words are the app's (`word`); these are the marks. */ +export type StageState = "queued" | "running" | "success" | "failed" | "skipped" | "canceled" | "retrying"; + +/** The default word for each state, US English. An app may change any of them. */ +export const STAGE_WORDS: Readonly> = { + queued: "Queued", + running: "Running", + success: "Passed", + failed: "Failed", + skipped: "Skipped", + canceled: "Canceled", + retrying: "Retrying", +}; + +export type Moment = Date | number; +export type RunTimeScale = "seconds" | "minutes" | "hours"; + +/** A length of work as a person reads it ("12.3 s", "12 min 34 s", "12 hr 34 min", "3 days"), and its ISO 8601 duration. US English. */ +export function formatRunTime(ms: number): { text: string; dateTime: string } { + const t = Number.isFinite(ms) ? Math.max(0, ms) : 0; + if (t < 60_000) { + // Tenths, cut and never rounded up: 59.96 s is "59.9 s", never "60.0 s". + const tenths = Math.floor(t / 100); + const text = `${Math.floor(tenths / 10)}.${tenths % 10} s`; + return { text, dateTime: `PT${Math.floor(tenths / 10)}.${tenths % 10}S` }; + } + const s = Math.floor(t / 1000); + if (s < 3600) { + const m = Math.floor(s / 60); + return { text: `${m} min ${s % 60} s`, dateTime: `PT${m}M${s % 60}S` }; + } + const minutes = Math.floor(s / 60); + if (minutes < 1440) { + const h = Math.floor(minutes / 60); + return { text: `${h} hr ${minutes % 60} min`, dateTime: `PT${h}H${minutes % 60}M` }; + } + const d = Math.floor(minutes / 1440); + return { text: `${d} ${d === 1 ? "day" : "days"}`, dateTime: `P${d}D` }; +} + diff --git a/packages/react/src/run-timer.tsx b/packages/react/src/run-timer.tsx new file mode 100644 index 00000000..4a2886cd --- /dev/null +++ b/packages/react/src/run-timer.tsx @@ -0,0 +1,145 @@ +import * as React from "react"; + +import { useLoops } from "./loops"; +import { Reserve } from "./reserve"; +import { formatRunTime } from "./run-format"; +import type { Moment, RunTimeScale } from "./run-format"; +import { formatClock, formatDay } from "./time-format"; +import { warnRun } from "./run-warn"; +import { join } from "./utils"; + +declare const process: { env: { NODE_ENV?: string } }; + +// ---- A run's time (DECISIONS 316, 1.9) ---- +// Tabular figures in Geist Mono at text-xs, tertiary, a `time` element with an ISO duration, never a live region. Under a minute it is "12.3 s" and +// changes every 100ms; to an hour "12 min 34 s", by the second; to a day "12 hr 34 min", by the minute; then "3 days". One shared interval, made by +// its first reader and cleared with its last: nothing runs at import. It stands in one `Reserve` cell as wide as the longest form its scale can show, +// end-aligned, never empty, so a column of times is one width from the first frame. + +const ORDER: Record = { seconds: 0, minutes: 1, hours: 2 }; +/** The widest form each scale can show, in tabular figures. */ +const WIDEST: Record = { seconds: "00.0 s", minutes: "00 min 00 s", hours: "00 hr 00 min" }; + +/** The scale a length needs: seconds under a minute, minutes under an hour, hours after. */ +const scaleFor = (ms: number): RunTimeScale => (ms < 60_000 ? "seconds" : ms < 3_600_000 ? "minutes" : "hours"); + +// ---- one shared interval +let listeners: Set<() => void> | undefined; +let timer: ReturnType | undefined; +function subscribe(listener: () => void) { + (listeners ??= new Set()).add(listener); + // 100ms: the finest a time can change. A reader whose text has not changed renders nothing (React keeps the same string). + if (timer === undefined) timer = setInterval(() => { for (const l of listeners ?? []) l(); }, 100); + return () => { + listeners?.delete(listener); + if (!listeners?.size && timer !== undefined) { clearInterval(timer); timer = undefined; } + }; +} + +// ---- one scale for a list's timers +interface ScaleContext { scale: RunTimeScale; grow: (scale: RunTimeScale) => void } +const RunTimeScaleContext = React.createContext(null); + +/** + * A list's one scale for all its timers (`StageList`, `StageRail`, `RunTimeline`). A time that outgrows it is still written whole; every seat in the + * list widens together, once, and development warns. `cap` is the widest the list allows (a rail stops at minutes). + */ +export function useRunTimeScale(given: RunTimeScale, cap: RunTimeScale = "hours") { + const [grown, setGrown] = React.useState(given); + const scale = ORDER[grown] > ORDER[given] ? grown : given; + const value = React.useMemo(() => ({ + scale, + grow: (needed) => setGrown((was) => (ORDER[needed] > ORDER[was] && ORDER[needed] <= ORDER[cap] ? needed : was)), + }), [scale, cap]); + return { scale, provide: (children: React.ReactNode) => {children} }; +} + +export interface RunTimerProps { + /** When the work (this attempt) started. Left out, the timer holds its room and shows nothing. */ + start?: Moment; + /** When it stopped. Given, the time is frozen at `end - start` (plus `carried`). */ + end?: Moment; + /** What earlier attempts took, so a retry counts on from the frozen figure and never over the wait. */ + carried?: number; + /** When the work first started (before any retry): what the held form says. Left out, `start`. */ + since?: Moment; + /** The longest form the seat holds: "00.0 s" (the default), "00 min 00 s" or "00 hr 00 min". A list's `timeScale` sets it for all its timers. */ + scale?: RunTimeScale; + /** + * Under `data-loops="held"`, while running: "started" (the default) shows when the work first started ("Started 3:47 PM", with the date for another + * day) in a seat that holds it; "hidden" hides the figure with its box kept and writes the current one on release. A finished time stays. + */ + whenHeld?: "started" | "hidden"; + locale?: string; + /** Writes a length for an app in another language. It must return the same width for a scale's widest form. */ + format?: (ms: number) => string; + className?: string; +} + +/** Room for both held forms: the same day, and another day, at their widest. */ +function heldSamples(locale: string | undefined) { + const sample = new Date(2026, 11, 30, 12, 59); + const clock = formatClock(sample, { locale }).text; + const day = formatDay(sample, { now: sample, locale }).text; + return { held: `Started ${clock}`, heldDay: `Started ${day}, ${clock}` }; +} + +function heldText(since: number, now: number, locale: string | undefined) { + const clock = formatClock(since, { locale }); + const sameDay = new Date(since).toDateString() === new Date(now).toDateString(); + if (sameDay) return { show: "held", text: `Started ${clock.text}`, dateTime: clock.dateTime }; + return { show: "heldDay", text: `Started ${formatDay(since, { now, locale }).text}, ${clock.text}`, dateTime: clock.dateTime }; +} + +/** + * How long a run, a stage or a step has taken (DECISIONS 316, 1.9). Counts from `start` while there is no `end`, frozen once there is; `carried` is + * added. Never a live region: a run's announcer says its time once, at the end. + */ +export function RunTimer({ start, end, carried = 0, since, scale: own = "seconds", whenHeld = "started", locale, format, className }: RunTimerProps) { + const list = React.useContext(RunTimeScaleContext); + const scale = list?.scale ?? own; + const { held } = useLoops(); + const running = start !== undefined && end === undefined; + const [now, setNow] = React.useState(() => Date.now()); + React.useEffect(() => { + if (!running || held) return; + setNow(Date.now()); + return subscribe(() => setNow(Date.now())); + }, [running, held]); + + if (process.env.NODE_ENV !== "production" && carried && since === undefined) warnRun("RunTimer", "`carried` is given without `since`: the held form would show when this attempt started, not when the work first did."); + + const from = start === undefined ? undefined : new Date(start).getTime(); + const ms = from === undefined ? 0 : (end === undefined ? now : new Date(end).getTime()) - from + carried; + const length = formatRunTime(ms); + const text = from === undefined ? "\u00a0" : format ? format(ms) : length.text; + + // A time that outgrows its scale is written whole; the list widens every seat together. + const needed = from === undefined ? scale : scaleFor(ms); + const outgrown = ORDER[needed] > ORDER[scale]; + React.useEffect(() => { + if (!outgrown) return; + if (process.env.NODE_ENV !== "production") warnRun("RunTimer", `a time of ${length.text} outgrew its "${scale}" scale; give the list a wider \`timeScale\`.`); + list?.grow(needed); + }, [outgrown, needed, scale, list, length.text]); + + const startedForm = whenHeld === "started"; + const showHeld = held && running && startedForm; + const hidden = held && running && !startedForm; + const first = since ?? start; + const heldForm = showHeld && first !== undefined ? heldText(new Date(first).getTime(), now, locale) : null; + + const alternatives: Record = { time: text, widest: format ? format(scale === "seconds" ? 59_900 : scale === "minutes" ? 3_599_000 : 86_340_000) : WIDEST[scale] }; + if (startedForm) Object.assign(alternatives, heldSamples(locale)); + if (heldForm) alternatives[heldForm.show] = heldForm.text; + return ( + + ); +} diff --git a/packages/react/src/run-warn.ts b/packages/react/src/run-warn.ts new file mode 100644 index 00000000..c2381d46 --- /dev/null +++ b/packages/react/src/run-warn.ts @@ -0,0 +1,16 @@ +// Development warnings for the run parts (DECISIONS 316): each said once. A bundler that sets NODE_ENV to production drops every call, strings included, +// because each caller tests `process.env.NODE_ENV` itself. + +declare const process: { env: { NODE_ENV?: string } }; + +let warned: Set | undefined; + +/** Said once for each message. */ +export function warnRun(component: string, message: string) { + if (process.env.NODE_ENV === "production") return; + warned ??= new Set(); + const key = `${component}: ${message}`; + if (warned.has(key)) return; + warned.add(key); + console.warn(`Basalt ${key}`); +} diff --git a/packages/react/src/spinner.tsx b/packages/react/src/spinner.tsx index 18a617e6..30a99c8b 100644 --- a/packages/react/src/spinner.tsx +++ b/packages/react/src/spinner.tsx @@ -48,7 +48,7 @@ let joining: HTMLElement[] | undefined; * paint shows frame 0 and corrects once, here, after hydration. Under reduced motion braille runs no animation, so * there is nothing to sync. */ -function useSharedClock(ref: React.RefObject) { +export function useSharedClock(ref: React.RefObject) { React.useLayoutEffect(() => { const el = ref.current; if (!el || typeof el.getAnimations !== "function") return; diff --git a/packages/react/src/stage-badge.tsx b/packages/react/src/stage-badge.tsx new file mode 100644 index 00000000..c07d31bf --- /dev/null +++ b/packages/react/src/stage-badge.tsx @@ -0,0 +1,81 @@ +import * as React from "react"; + +import { Badge } from "./display"; +import type { BadgeStatus } from "./display"; +import { useLoops } from "./loops"; +import { Reserve } from "./reserve"; +import { Spinner } from "./spinner"; +import { STAGE_WORDS } from "./run-format"; +import type { StageState } from "./run-format"; +import { join } from "./utils"; + +// ---- A status that changes in place (DECISIONS 316, 1.6) ---- +// A `Badge` bound to the seven states: queued is the pending ring, running and retrying braille, passed the success dot, failed the danger dot, +// skipped and canceled the neutral dot. Its seat is as wide as its widest face, mark included, from a static measure (the words alone in a hidden +// cell, with the dot's seat, which is braille's width): no spinner is mounted to measure with. A change of face is sequential: the old face fades out +// and rises space-1 over 0.75 of duration-base on ease-in, then the new one fades in from space-1 below over duration-base on ease-out, held at +// opacity 0 until the old has gone whether or not the old is still in the DOM. No width animates. Reduced motion fades only; the hold swaps at once. + +export interface StageBadgeProps { + state: StageState; + /** The words, by state. Left out, "Queued", "Running", "Passed", "Failed", "Skipped", "Canceled", "Retrying". The app writes an attempt ("Retrying, 2 of 3"). */ + words?: Partial>; + /** `outline` in a run's head; `plain` in a list or a table (a dot and a word, never a pill a row). */ + variant?: "outline" | "plain"; + /** A plain badge's mark seat (see `Badge`). */ + size?: 16 | 20 | 24; + className?: string; +} + +const STATUS: Record = { + queued: "pending", running: undefined, success: "success", failed: "danger", skipped: "neutral", canceled: "neutral", retrying: undefined, +}; + +interface Face { key: number; state: StageState; leaving?: boolean } + +function FaceBadge({ state, word, variant, size }: { state: StageState; word: string; variant: "outline" | "plain"; size: 16 | 20 | 24 }) { + const running = state === "running" || state === "retrying"; + const body = <>{running ? : null}{word}; + return variant === "plain" + ? {body} + : {body}; +} + +/** A run's or a stage's state as a badge whose face changes in place, in a seat that never moves. One accessible name at every moment: the new word. */ +export function StageBadge({ state, words, variant = "outline", size = 16, className }: StageBadgeProps) { + const { held } = useLoops(); + const all = { ...STAGE_WORDS, ...words }; + const [faces, setFaces] = React.useState(() => [{ key: 0, state }]); + const current = faces[faces.length - 1]!; + // The hold lands every change at once: a face still leaving when it arrives goes now. + if (held && faces.length > 1) setFaces([current]); + else if (current.state !== state) { + if (held) setFaces([{ key: current.key + 1, state }]); + else setFaces([{ ...current, leaving: true }, { key: current.key + 1, state }]); + } + const drop = (key: number) => setFaces((list) => (list.some((f) => f.key === key && f.leaving) ? list.filter((f) => f.key !== key) : list)); + const measure = variant === "plain" + ? + : ; + return ( + + {/* The seat: every word in one hidden cell, beside the dot's seat (as wide as braille's). Nothing in it moves or is read. */} + + {faces.map((face) => { + const leave = face.leaving ? (event: React.AnimationEvent) => { if (event.target === event.currentTarget) drop(face.key); } : undefined; + return ( + 0 && !face.leaving ? "" : undefined} + aria-hidden={face.leaving ? true : undefined} + onAnimationEnd={leave} + > + + + ); + })} + + ); +} diff --git a/packages/react/src/stage-mark.tsx b/packages/react/src/stage-mark.tsx new file mode 100644 index 00000000..172748a2 --- /dev/null +++ b/packages/react/src/stage-mark.tsx @@ -0,0 +1,87 @@ +import { CheckCircleIcon } from "@phosphor-icons/react/dist/csr/CheckCircle"; +import { CircleIcon } from "@phosphor-icons/react/dist/csr/Circle"; +import { MinusCircleIcon } from "@phosphor-icons/react/dist/csr/MinusCircle"; +import { ProhibitIcon } from "@phosphor-icons/react/dist/csr/Prohibit"; +import { XCircleIcon } from "@phosphor-icons/react/dist/csr/XCircle"; +import * as React from "react"; + +import { Icon } from "./icon"; +import { useLoops } from "./loops"; +import { Spinner, useSharedClock } from "./spinner"; +import type { StageState } from "./run-format"; +import { join } from "./utils"; + +// ---- Stages and runs (DECISIONS 316): the seven states and their mark ---- +// One mark a state at 16, 20 or 24, aria-hidden, in a seat that never changes size; the state's word carries the state (where it is drawn and where it +// is only said is foundations' table in "Stages and runs"). Queued is Phosphor Bold Circle in secondary ink, breathing by opacity from opacity-queued +// to 1 on duration-loop-fade (the one loop a state that is not running has; still under reduced motion, the hold, forced colours and print). Running +// and retrying are the ring. Passed is the outline CheckCircle in secondary, failed the outline XCircle in danger, skipped MinusCircle and canceled +// Prohibit in tertiary. No filled disc anywhere. A change of state crossfades in the one seat: the old mark fades out as the new fades in, over +// duration-fast on ease-out, kept under reduced motion (opacity only) and landing at once under the hold. + +export interface StageMarkProps { + state: StageState; + /** The seat, by the status seat's rule: 16 beside 12 to 16px text (the default), 20 beside 18 to 24px, 24 beside 30px and up. */ + size?: 16 | 20 | 24; + className?: string; +} + +/** Running and retrying are one mark (the ring): a change between them is not a change of mark. */ +const markOf = (state: StageState) => (state === "retrying" ? "running" : state); + +/** The queued breath, on the shared clock: every queued mark on a page breathes in step with every other loop on duration-loop-fade. */ +function Breath({ children }: { children: React.ReactNode }) { + const ref = React.useRef(null); + useSharedClock(ref); + return {children}; +} + +function Glyph({ state, size }: { state: StageState; size: 16 | 20 | 24 }) { + switch (state) { + case "queued": return ; + case "running": + case "retrying": return ; + case "success": return ; + case "failed": return ; + case "skipped": return ; + case "canceled": return ; + } +} + +interface Face { key: number; state: StageState; leaving?: boolean } + +/** + * A stage's status mark (DECISIONS 316, 1.2). Always `aria-hidden`: the stage's word says the state, drawn or visually hidden by where it sits. + * In forced colours it is `currentColor` and names no system colour, so it follows the row it is in. + */ +export function StageMark({ state, size = 16, className }: StageMarkProps) { + const { held } = useLoops(); + const [faces, setFaces] = React.useState(() => [{ key: 0, state }]); + const current = faces[faces.length - 1]!; + // The hold lands every change at once: a face still leaving when it arrives goes now. + if (held && faces.length > 1) setFaces([current]); + else if (current.state !== state) { + // Drawn from the previous render's faces, before paint: the old mark stays in the seat and fades as the new one arrives. + if (markOf(current.state) === markOf(state)) setFaces([...faces.slice(0, -1), { ...current, state }]); + else if (held) setFaces([{ key: current.key + 1, state }]); + else setFaces([{ ...current, leaving: true }, { key: current.key + 1, state }]); + } + const drop = (key: number) => setFaces((all) => (all.some((f) => f.key === key && f.leaving) ? all.filter((f) => f.key !== key) : all)); + return ( + + ); +} diff --git a/packages/react/src/styles/components.css b/packages/react/src/styles/components.css index b6b849cf..a68d540f 100644 --- a/packages/react/src/styles/components.css +++ b/packages/react/src/styles/components.css @@ -4285,6 +4285,74 @@ .basalt-terminal .basalt-code-line[data-kind] .basalt-terminal-mark, .basalt-terminal .basalt-terminal-done, .basalt-terminal .basalt-terminal-failed, .basalt-terminal .basalt-code-line[data-kind="error"] .basalt-code-text, .basalt-terminal-state [data-error] { color: CanvasText; } } + /* ---- Stages and runs (DECISIONS 316) ---- + The run parts: StageMark, RunTimer, StageBadge and RunAnnouncer here; StageList, StageRail, RunTimeline and Terminal's stage lines below. Every + class begins basalt-run-: basalt-stage is the full-bleed art's. */ + + /* StageMark: one seat of 16, 20 or 24 that never changes size, every face stacked in it. Ink by state. */ + .basalt-run-mark { display: inline-grid; flex: none; place-items: center; inline-size: var(--basalt-size-icon-sm); block-size: var(--basalt-size-icon-sm); vertical-align: middle; } + .basalt-run-mark[data-size="20"] { inline-size: var(--basalt-size-icon-md); block-size: var(--basalt-size-icon-md); } + .basalt-run-mark[data-size="24"] { inline-size: var(--basalt-size-icon-lg); block-size: var(--basalt-size-icon-lg); } + .basalt-run-mark-face { display: grid; grid-area: 1 / 1; place-items: center; } + .basalt-run-mark-face > * { display: grid; place-items: center; } + .basalt-run-mark-face .basalt-spinner { color: inherit; } + .basalt-run-mark-face[data-state="queued"], .basalt-run-mark-face[data-state="success"] { color: var(--basalt-text-secondary); } + .basalt-run-mark-face:is([data-state="running"], [data-state="retrying"]) { color: var(--basalt-text-primary); } + .basalt-run-mark-face[data-state="failed"] { color: var(--basalt-status-danger); } + .basalt-run-mark-face:is([data-state="skipped"], [data-state="canceled"]) { color: var(--basalt-text-tertiary); } + /* A change of state crossfades in the one seat: both marks stand, the old fading out as the new fades in, over duration-fast on ease-out. It is + opacity alone, so reduced motion keeps it; the hold lands it at once (the component draws one face), and print draws the new face alone. */ + .basalt-run-mark-face[data-entering] { animation: basalt-fade-in var(--basalt-duration-fast) var(--basalt-ease-out) both; } + .basalt-run-mark-face[data-leaving] { animation: basalt-run-fade-out var(--basalt-duration-fast) var(--basalt-ease-out) both; } + /* The queued breath: secondary ink from opacity-queued (0.65) to 1 and back on duration-loop-fade, on the shared clock; 3:1 at its lowest on + every surface. A loop, so the hold stops it, and it is still, at full, under reduced motion, in forced colours and in print. */ + .basalt-run-mark-breath { animation: basalt-run-breath var(--basalt-duration-loop-fade) var(--basalt-ease-in-out) infinite alternate; } + @keyframes basalt-run-breath { from { opacity: var(--basalt-opacity-queued); } to { opacity: 1; } } + @keyframes basalt-run-fade-out { to { opacity: 0; } } + :root[data-loops="held"] .basalt-run-mark-breath { animation: none; } + :root[data-loops="held"] .basalt-run-mark-face { animation: none; } + :root[data-loops="held"] .basalt-run-mark-face[data-leaving] { display: none; } + @media (prefers-reduced-motion: reduce) { .basalt-run-mark-breath { animation: none; } } + @media (forced-colors: active) { + /* currentColor, and no system colour named: the mark follows the row it sits in. */ + .basalt-run-mark-face[data-state] { color: inherit; } + .basalt-run-mark-breath { animation: none; } + } + @media print { + .basalt-run-mark-breath, .basalt-run-mark-face { animation: none; } + .basalt-run-mark-face[data-leaving] { display: none; } + } + + /* RunTimer: Geist Mono at text-xs, tertiary, tabular, in one Reserve cell as wide as its scale's widest form, end-aligned. A stage's own running + time hides under the hold with its box kept, and is written again on release. */ + .basalt-run-timer { display: inline-grid; font: var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-mono); font-variant-numeric: tabular-nums; color: var(--basalt-text-tertiary); white-space: nowrap; } + .basalt-run-timer > .basalt-reserve { justify-items: end; } + .basalt-run-timer[data-held] { visibility: hidden; } + + /* StageBadge: one seat as wide as the widest face (the words in a hidden cell beside the dot's seat, which is braille's width), every face + stacked in it and stretched to it, so an outline pill is one width whatever it says. */ + .basalt-run-badge { display: inline-grid; vertical-align: middle; } + .basalt-run-badge > * { display: grid; grid-area: 1 / 1; min-width: 0; } + .basalt-run-badge-measure { visibility: hidden; } + /* Sequential: out (0.75 of duration-base, ease-in, rising space-1), then in (duration-base, ease-out, from space-1 below), the new face held at + opacity 0 for the old one's time whether or not the old one is still there. */ + .basalt-run-badge-face[data-leaving] { animation: basalt-run-face-out calc(var(--basalt-duration-base) * 0.75) var(--basalt-ease-in) both; } + .basalt-run-badge-face[data-entering] { animation: basalt-run-face-in var(--basalt-duration-base) var(--basalt-ease-out) calc(var(--basalt-duration-base) * 0.75) both; } + @keyframes basalt-run-face-out { to { opacity: 0; transform: translateY(calc(-1 * var(--basalt-space-1))); } } + @keyframes basalt-run-face-in { from { opacity: 0; transform: translateY(var(--basalt-space-1)); } } + @keyframes basalt-run-face-out-still { to { opacity: 0; } } + @keyframes basalt-run-face-in-still { from { opacity: 0; } } + @media (prefers-reduced-motion: reduce) { + .basalt-run-badge-face[data-leaving] { animation-name: basalt-run-face-out-still; } + .basalt-run-badge-face[data-entering] { animation-name: basalt-run-face-in-still; } + } + :root[data-loops="held"] .basalt-run-badge-face { animation: none; } + :root[data-loops="held"] .basalt-run-badge-face[data-leaving] { display: none; } + @media print { + .basalt-run-badge-face { animation: none; } + .basalt-run-badge-face[data-leaving] { display: none; } + } + /* A prose page's column is size-prose-width on the row's start edge, never centred. */ .basalt-prose { box-sizing: border-box; max-inline-size: var(--basalt-size-prose-width); margin-inline: 0 auto; min-width: 0; } diff --git a/packages/react/test/bundle.test.mjs b/packages/react/test/bundle.test.mjs index 0783bd0a..1bacd658 100644 --- a/packages/react/test/bundle.test.mjs +++ b/packages/react/test/bundle.test.mjs @@ -670,3 +670,17 @@ test("the imports plugin never rewrites a file that resolves another copy of Bas nodeFs.rmSync(root, { recursive: true, force: true }); } }); + +// Stages and runs (DECISIONS 316): each new part has its own limit, the measured static graph rounded up to the next 50. StageMark carries Phosphor's five +// circled marks (one file each, as Terminal imports its marks) and the ring; StageBadge, RunTimer, RunAnnouncer and formatRunTime load no Phosphor, and none +// of them loads Base UI. +for (const [name, limit, phosphor] of [["StageMark", 14_350, true], ["StageBadge", 5_400, false], ["RunTimer", 5_200, false], ["RunAnnouncer", 600, false], ["formatRunTime", 750, false]]) { + test(`${name} alone loads no Base UI${phosphor ? "" : " and no Phosphor"} (${limit} bytes at most)`, async () => { + const { bytes, inputs } = await graph(name); + assert.ok(bytes < limit, `${name} bundle is ${bytes} bytes (limit ${limit})`); + assert.deepEqual(inputs.filter((f) => /@base-ui|cmdk|shiki/.test(f)), [], `${name} loads Base UI, cmdk or Shiki`); + const marks = inputs.filter((f) => /@phosphor-icons/.test(f)).map((f) => path.basename(f).replace(/\.es\.js$|\.mjs$|\.js$/, "")); + if (phosphor) assert.deepEqual([...new Set(marks)].filter((m) => !/^(IconBase|context|SSRBase)$/.test(m)).sort(), ["CheckCircle", "Circle", "MinusCircle", "Prohibit", "XCircle"]); + else assert.deepEqual(marks, []); + }); +} diff --git a/packages/react/test/demo-runs.tsx b/packages/react/test/demo-runs.tsx new file mode 100644 index 00000000..1dbb5261 --- /dev/null +++ b/packages/react/test/demo-runs.tsx @@ -0,0 +1,27 @@ +// The stages and runs (DECISIONS 316) on the demo page, for the browser tests' axe pass in both themes. Synthetic data only. +import * as React from "react"; + +import { RunAnnouncer, RunTimer, StageBadge, StageMark } from "../src/index"; +import type { StageState } from "../src/index"; + +const STATES: StageState[] = ["queued", "running", "success", "failed", "skipped", "canceled", "retrying"]; + +export function RunsFixture() { + return ( +
+

Stages and runs

+
    + {STATES.map((state) => ( +
  • + + {/* A running face is braille, which the motion test finds by itself on this page: the badges show the five resting faces. */} + {state === "running" || state === "retrying" ? null : } + {state === "running" || state === "retrying" ? null : } +
  • + ))} +
+

Build took

+ +
+ ); +} diff --git a/packages/react/test/demo.tsx b/packages/react/test/demo.tsx index 867d5e1b..b693f492 100644 --- a/packages/react/test/demo.tsx +++ b/packages/react/test/demo.tsx @@ -8,6 +8,7 @@ import { CompletionFixtures } from "../examples/completion"; import * as CoreSet from "../src/glyph-set"; import type { GlyphIcon } from "../src/index"; +import { RunsFixture } from "./demo-runs"; import { Accordion, AccordionItem, @@ -579,6 +580,7 @@ function App() { + diff --git a/packages/react/test/export-sizes.json b/packages/react/test/export-sizes.json index 3e1a4eee..405d34ba 100644 --- a/packages/react/test/export-sizes.json +++ b/packages/react/test/export-sizes.json @@ -221,7 +221,10 @@ "Reserve": 441, "Reveal": 19500, "RoutesGlyph": 3009, + "RunAnnouncer": 448, + "RunTimer": 5050, "RunsGlyph": 3128, + "STAGE_WORDS": 149, "STATUS_MESSAGE_MS": 26, "SandboxesGlyph": 2963, "SchemaDiagram": 67494, @@ -280,6 +283,8 @@ "Sparkline": 4585, "Spinner": 1509, "Stage": 1219, + "StageBadge": 5045, + "StageMark": 14188, "Stat": 2226, "Stats": 314, "StatusBar": 6813, @@ -364,6 +369,7 @@ "formatCountdown": 393, "formatDay": 635, "formatElapsed": 393, + "formatRunTime": 515, "formatStamp": 685, "formatStatTime": 1116, "holdFirstPaint": 787, @@ -412,11 +418,11 @@ "useWaitMark": 303 }, "package": { - "bytes": 870189, - "gzip": 288896 + "bytes": 879732, + "gzip": 291984 }, "styles": { - "bytes": 382510, - "gzip": 49971 + "bytes": 386222, + "gzip": 50471 } } diff --git a/packages/react/test/loops.test.mjs b/packages/react/test/loops.test.mjs index c96aebd9..e6dd6e5b 100644 --- a/packages/react/test/loops.test.mjs +++ b/packages/react/test/loops.test.mjs @@ -205,6 +205,28 @@ describe("release jumps to now", () => { }); }); +// DECISIONS 316 (4.1): a queued stage's mark breathes, and is the fourth kind of thing that loops. It joins the hold and rejoins the clock. +describe("the queued breath", () => { + const queued = render(``, app.replace('

', '

')); + test("it stops under the hold, at full, and rejoins the shared clock on release, in phase with a mark mounted later", async () => { + const { page, context } = await open(queued); + await settle(page); + const breath = () => page.evaluate(() => { const b = document.querySelector("#queued .basalt-run-mark-breath"); const [a] = b.getAnimations(); return { running: a ? a.playState : null, start: a ? Number(a.startTime) : null, opacity: getComputedStyle(b).opacity }; }); + assert.equal((await breath()).running, "running"); + assert.equal((await breath()).start, 0, "on the shared clock from mount"); + await page.locator("#toggle").click(); + await frames(page); + assert.deepEqual(await breath(), { running: null, start: null, opacity: "1" }, "held: still, at full"); + await page.waitForTimeout(250); + await page.locator("#toggle").click(); + await frames(page); + const released = await breath(); + assert.equal(released.running, "running"); + assert.equal(released.start, 0, "released: back at the timeline's origin"); + await context.close(); + }); +}); + describe("useLoops", () => { test("it stores the hold, restores it after a reload, and clears it on release", async () => { const { page, context } = await open(shell); diff --git a/packages/react/test/motion-docs.test.mjs b/packages/react/test/motion-docs.test.mjs index d9c3120e..31860507 100644 --- a/packages/react/test/motion-docs.test.mjs +++ b/packages/react/test/motion-docs.test.mjs @@ -13,14 +13,21 @@ const foundations = flat(read("docs/foundations.md")); const motion = flat(read("docs/motion.md")); const agents = flat(read("AGENTS.md")); -// DECISIONS 292 (5.3, 5.9) added a third kind, an animated diagram's live lines; foundations names them, AGENTS.md keeps the shorter form. -const LOOPS = "Three kinds of thing loop, and nothing else: a mark that says work is running (the ring, braille, a busy Button's ring, a busy TextButton's underline, the indeterminate Progress bar, Sparkline's loading line, Skeleton's pulse and a written field's fill), a page's one ambient loop, opacity only, in its art, and an animated diagram's live lines"; -const SENTENCE = `${LOOPS} (a flow line, a pulse, a packet that repeats); \`data-loops="held"\` stops all three.`; -const AGENTS_SENTENCE = `${LOOPS}; \`data-loops="held"\` stops all three.`; +// DECISIONS 292 (5.3, 5.9) added a third kind, an animated diagram's live lines; DECISIONS 316 (4.1) a fourth, a queued stage's mark. Foundations names +// the diagram's lines; AGENTS.md gives the queued mark's bounds and keeps the shorter form of the lines. +const RUNNING = "Four kinds of thing loop, and nothing else: a mark that says work is running (the ring, braille, a busy Button's ring, a busy TextButton's underline, the indeterminate Progress bar, Sparkline's loading line, Skeleton's pulse and a written field's fill)"; +const SENTENCE = `${RUNNING}, a queued stage's mark, a page's one ambient loop, opacity only, in its art, and an animated diagram's live lines (a flow line, a pulse, a packet that repeats); \`data-loops="held"\` stops all four.`; +const AGENTS_SENTENCE = `${RUNNING}, a queued stage's mark (\`StageMark\`, opacity 0.65 to 1 on \`duration-loop-fade\`, never under 3:1, never a badge's ring), a page's one ambient loop, opacity only, in its art, and an animated diagram's live lines; \`data-loops="held"\` stops all four.`; +const QUEUED = "**A queued stage's mark** (`StageMark` at `queued`: work that waits to start) breathes by opacity alone, from `opacity-queued` (0.65) to 1 and back on `duration-loop-fade` and `ease-in-out`, in secondary ink, on the shared clock, and is 3:1 or better against its ground at every moment. It is the `StageMark` only: a `Badge`'s pending ring, a dot and a word never breathe. It is still, at full, under reduced motion, under the hold, in forced colours and in print. A stage that has finished never loops."; -test("the one sentence for loops is in foundations and in AGENTS.md, and the three older wordings are gone", () => { +test("the one sentence for loops is in foundations and in AGENTS.md, and the older wordings are gone", () => { assert.ok(foundations.includes(SENTENCE), "foundations"); + assert.ok(foundations.includes(QUEUED), "foundations: the queued mark's bounds"); assert.ok(agents.includes(AGENTS_SENTENCE), "AGENTS.md"); + for (const [name, text] of [["foundations", foundations], ["AGENTS.md", agents]]) { + assert.ok(!/Three kinds of thing loop/.test(text) && !/Two kinds of thing loop/.test(text) && !/stops all three/.test(text), `${name}: the old count`); + } + assert.ok(/\*\*The queued breath\*\* \(DECISIONS 316\) is a `StageMark`'s at `queued`, and no other mark's/.test(motion), "motion: the queued breath in Spinners"); for (const [name, text] of [["foundations", foundations], ["motion", motion], ["AGENTS.md", agents]]) { assert.ok(!/Nothing loops except spinners/.test(text), `${name}: the old sentence`); assert.ok(!/Nothing overshoots or loops, except spinners/.test(text), `${name}: the old sentence`); @@ -84,3 +91,13 @@ test("the second amendment (DECISIONS 148) is in the docs: beforeprint, and the assert.ok(/The HTML skill's narrow menu has the same row/.test(foundations)); assert.ok(/a line along its drawn path and its markers from their drawn centres/.test(motion)); }); + +test("stages and runs (DECISIONS 316): the new section's status line, the hold's exception, and motion's table", () => { + const status = "Decided by the council for the owner's handoff (DECISIONS 302, 304, 307, 312 and 316); the implementation hasn't been reviewed."; + const at = foundations.indexOf("## Stages and runs"); + assert.ok(at >= 0 && foundations.slice(at, at + 400).includes(status), "foundations: the section and its status line"); + const m = motion.indexOf("## Stages and runs"); + assert.ok(m >= 0 && motion.slice(m, m + 400).includes("decided by the council for the owner's handoff (DECISIONS 302, 304, 307, 312 and 316); the implementation hasn't been reviewed."), "motion: the table and its status line"); + assert.ok(foundations.includes("A column that holds an elapsed time is wide enough for the held form. **A run is the one exception to both sentences about an elapsed time.**"), "the hold's line names itself as the exception, directly after the sentence it excepts"); + assert.ok(foundations.includes("Sparkline's loading line, Skeleton's pulse and a written field's fill, a queued `StageMark`'s breath, and the page's ambient loop"), "the hold stops the breath"); +}); diff --git a/packages/react/test/run-announcer.test.mjs b/packages/react/test/run-announcer.test.mjs new file mode 100644 index 00000000..c8dfb89f --- /dev/null +++ b/packages/react/test/run-announcer.test.mjs @@ -0,0 +1,81 @@ +// RunAnnouncer (DECISIONS 316, 1.10): every event once, in order, each its own appended node; a repeated id adds nothing; nothing at mount; the role +// and name; it draws nothing; axe. Chromium, built package, real stylesheet. (No screen reader is heard here: backlog 6.) +import assert from "node:assert/strict"; +import fs from "node:fs"; +import { createRequire } from "node:module"; +import { after, before, test } from "node:test"; + +import { fixturePage, launch, settle } from "./support.mjs"; + +const axeSource = fs.readFileSync(createRequire(import.meta.url).resolve("axe-core/axe.min.js"), "utf8"); +let browser; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); }); + +const FIXTURE = ` +function App() { + const [events, setEvents] = React.useState([{ id: "old", text: "Deploy 811 passed in 9.1 seconds" }]); + React.useEffect(() => { window.send = (e) => setEvents((all) => [...all, e]); }, []); + return

Deploy 812

; +} +createRoot(document.getElementById("root")).render();`; + +const open = async () => { + const { page, errors } = await fixturePage(browser, FIXTURE, { viewport: { width: 600, height: 400 }, theme: "dark", clock: true }); + await page.clock.runFor(20); + page.errors = errors; + return page; +}; +const said = (page) => page.evaluate(() => [...document.querySelector(".basalt-run-announcer").children].map((c) => c.textContent)); + +test("nothing at mount; the role and name: a polite log of additions", async () => { + const page = await open(); + assert.deepEqual(await said(page), []); + const r = await page.evaluate(() => { const el = document.querySelector(".basalt-run-announcer"); return [el.getAttribute("role"), el.getAttribute("aria-live"), el.getAttribute("aria-relevant"), el.getAttribute("aria-label")]; }); + assert.deepEqual(r, ["log", "polite", "additions", "Deploy 812 updates"]); + assert.equal(await page.getByRole("log", { name: "Deploy 812 updates" }).count(), 1); + assert.equal(await page.locator("[role=alert]").count(), 0); +}); + +test("three events inside 300ms are all there, each one appended node, in order; the nodes already said are never replaced", async () => { + const page = await open(); + await page.evaluate(() => window.send({ id: "start", text: "Deploy 812 started" })); + await page.clock.runFor(20); + const first = await page.evaluate(() => { window.__first = document.querySelector(".basalt-run-announcer").firstElementChild; return true; }); + void first; + await page.clock.runFor(100); + await page.evaluate(() => window.send({ id: "fail", text: "Test failed: 3 tests failed in session.test.ts. Retry is available." })); + await page.clock.runFor(100); + await page.evaluate(() => window.send({ id: "retry", text: "Retrying Test, attempt 2 of 2" })); + await page.clock.runFor(20); + assert.deepEqual(await said(page), ["Deploy 812 started", "Test failed: 3 tests failed in session.test.ts. Retry is available.", "Retrying Test, attempt 2 of 2"]); + assert.ok(await page.evaluate(() => document.querySelector(".basalt-run-announcer").firstElementChild === window.__first), "the first node is the same node: appended to, never rewritten"); +}); + +test("a repeated id adds nothing", async () => { + const page = await open(); + await page.evaluate(() => { window.send({ id: "start", text: "Deploy 812 started" }); }); + await page.clock.runFor(20); + await page.evaluate(() => { window.send({ id: "start", text: "Deploy 812 started" }); window.send({ id: "old", text: "Deploy 811 passed in 9.1 seconds" }); }); + await page.clock.runFor(20); + assert.deepEqual(await said(page), ["Deploy 812 started"]); +}); + +test("it draws nothing: a visually hidden box", async () => { + const page = await open(); + await page.evaluate(() => window.send({ id: "start", text: "Deploy 812 started" })); + await page.clock.runFor(20); + const box = await page.evaluate(() => { const b = document.querySelector(".basalt-run-announcer").getBoundingClientRect(); return [b.width, b.height]; }); + assert.ok(box[0] <= 1 && box[1] <= 1, `${box}`); +}); + +test("axe: no WCAG 2.2 AA violations, light and dark", async () => { + for (const theme of ["light", "dark"]) { + const { page } = await fixturePage(browser, FIXTURE, { viewport: { width: 600, height: 400 }, theme }); + await settle(page); + await page.evaluate(() => { document.title = "Basalt"; document.documentElement.lang = "en"; window.send({ id: "start", text: "Deploy 812 started" }); }); + await page.addScriptTag({ content: axeSource }); + const violations = await page.evaluate(async () => (await globalThis.axe.run(document, { runOnly: { type: "tag", values: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"] } })).violations.map((v) => v.id)); + assert.deepEqual(violations, [], theme); + } +}); diff --git a/packages/react/test/run-timer.test.mjs b/packages/react/test/run-timer.test.mjs new file mode 100644 index 00000000..bc2b6588 --- /dev/null +++ b/packages/react/test/run-timer.test.mjs @@ -0,0 +1,189 @@ +// RunTimer and formatRunTime (DECISIONS 316, 1.9): the forms and their boundaries, one shared interval, the seat by scale, frozen at the end, carried +// across a retry, the hold both ways and `since`. Driven in Chromium on Playwright's fake clock, against the built package with the real stylesheet. +import assert from "node:assert/strict"; +import path from "node:path"; +import { after, before, describe, test } from "node:test"; +import { pathToFileURL } from "node:url"; + +import { fixturePage, launch, pkg } from "./support.mjs"; + +const { formatRunTime } = await import(pathToFileURL(path.join(pkg, "dist", "run-format.js")).href); + +let browser; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); }); + +describe("formatRunTime", () => { + test("every boundary, with its ISO duration", () => { + const cases = [ + [0, "0.0 s", "PT0.0S"], + [12_345, "12.3 s", "PT12.3S"], + [59_900, "59.9 s", "PT59.9S"], + [59_999, "59.9 s", "PT59.9S"], + [60_000, "1 min 0 s", "PT1M0S"], + [754_000, "12 min 34 s", "PT12M34S"], + [3_599_000, "59 min 59 s", "PT59M59S"], + [3_600_000, "1 hr 0 min", "PT1H0M"], + [45_240_000, "12 hr 34 min", "PT12H34M"], + [86_399_000, "23 hr 59 min", "PT23H59M"], + [86_400_000, "1 day", "P1D"], + [3 * 86_400_000 + 5_000, "3 days", "P3D"], + ]; + for (const [ms, text, dateTime] of cases) assert.deepEqual(formatRunTime(ms), { text, dateTime }, `${ms}ms`); + assert.deepEqual(formatRunTime(-5), { text: "0.0 s", dateTime: "PT0.0S" }, "never negative"); + assert.deepEqual(formatRunTime(Number.NaN), { text: "0.0 s", dateTime: "PT0.0S" }); + }); +}); + +// The page counts intervals: a patched setInterval and clearInterval, before anything renders. +const COUNT = ` +window.__intervals = { made: 0, cleared: 0, live: new Set() }; +const made = window.setInterval.bind(window), cleared = window.clearInterval.bind(window); +window.setInterval = (fn, ms, ...a) => { const id = made(fn, ms, ...a); window.__intervals.made += 1; window.__intervals.live.add(id); return id; }; +window.clearInterval = (id) => { if (window.__intervals.live.delete(id)) window.__intervals.cleared += 1; return cleared(id); }; +window.__atImport = window.__intervals.made; +`; +const RUN = (jsx) => `${COUNT} +function App() { + const [props, setProps] = React.useState({}); + const [shown, setShown] = React.useState(true); + React.useEffect(() => { window.setProps = (p) => setProps((was) => ({ ...was, ...p })); window.setShown = setShown; }, []); + return
{shown ? ${jsx} : null}
; +} +createRoot(document.getElementById("root")).render();`; + +const open = async (body, options = {}) => { + const { page, errors } = await fixturePage(browser, body, { clock: true, viewport: { width: 800, height: 600 }, theme: "dark", ...options }); + page.errors = errors; + await page.clock.runFor(50); + return page; +}; +// Locale clocks put a narrow no-break space before AM and PM; compare the words, whatever space stands between them. +const plain = (t) => t.replace(/[\u202f\u00a0 ]+/g, " "); +const text = (page, sel) => page.evaluate((s) => document.querySelector(`${s} [data-on]`).textContent, sel); +const width = (page, sel) => page.evaluate((s) => document.querySelector(s).getBoundingClientRect().width, sel); +const hold = (page, on) => page.evaluate((h) => { if (h) document.documentElement.setAttribute("data-loops", "held"); else document.documentElement.removeAttribute("data-loops"); }, on); + +describe("the tick", () => { + test("nothing at import; one shared interval for every timer, its scale's own steps, cleared with the last reader", async () => { + // Three running timers, started at the fake clock's now (10 s). + const page = await open(RUN(`<> + + + + `)); + assert.equal(await page.evaluate(() => window.__atImport), 0, "nothing runs at import"); + assert.equal(await page.evaluate(() => window.__intervals.live.size), 1, "one interval for three timers"); + const t0 = [await text(page, "#a"), await text(page, "#b"), await text(page, "#c")]; + await page.clock.runFor(100); + const t1 = [await text(page, "#a"), await text(page, "#b"), await text(page, "#c")]; + assert.notEqual(t1[0], t0[0], `under a minute it changes every 100ms (${t0[0]} to ${t1[0]})`); + await page.clock.runFor(1000); + assert.equal(await text(page, "#b"), "1 min 0 s", "a minute to an hour: by the second"); + assert.match(await text(page, "#c"), /^59 min 59 s$|^1 hr 0 min$/); + await page.clock.runFor(1000); + assert.equal(await text(page, "#c"), "1 hr 0 min", "an hour to a day: by the minute"); + await page.clock.runFor(30_000); + assert.equal(await text(page, "#c"), "1 hr 0 min"); + await page.evaluate(() => window.setShown(false)); + await page.clock.runFor(200); + assert.deepEqual(await page.evaluate(() => [window.__intervals.live.size, window.__intervals.made, window.__intervals.cleared]), [0, 1, 1], "cleared with its last reader"); + }); + + test("frozen at end, with carried added; a hold set after mount stops the tick, and release writes the current figure", async () => { + const page = await open(RUN(`<>`)); + assert.equal(await text(page, "#done"), "4.7 s"); + await page.clock.runFor(2_000); + assert.equal(await text(page, "#done"), "4.7 s", "frozen"); + await hold(page, true); + await page.clock.runFor(50); + const held = await text(page, "#run"); + assert.equal(await page.evaluate(() => getComputedStyle(document.querySelector("#run time")).visibility), "hidden", "hidden, its box kept"); + assert.equal(await page.evaluate(() => window.__intervals.live.size), 0, "nothing ticks while held"); + await page.clock.runFor(3_000); + assert.equal(await text(page, "#run"), held); + await hold(page, false); + await page.clock.runFor(50); + assert.equal(await page.evaluate(() => getComputedStyle(document.querySelector("#run time")).visibility), "visible"); + assert.equal(await text(page, "#run"), "5.1 s", "the current figure, written on release"); + }); +}); + +describe("the seat", () => { + for (const scale of ["seconds", "minutes", "hours"]) { + test(`one width for a running, a finished and an empty timer at "${scale}" (0px), end-aligned, never empty`, async () => { + const page = await open(RUN(`<> + + + + + `)); + const widths = await Promise.all(["#empty time", "#short time", "#run time", "#long time"].map((s) => width(page, s))); + assert.ok(widths.every((w) => w === widths[0]), `${scale}: ${widths.join(", ")}`); + const heights = await page.evaluate(() => ["#empty", "#short"].map((s) => document.querySelector(`${s} time`).getBoundingClientRect().height)); + assert.equal(heights[0], heights[1], "an empty timer is a line as tall as one with a time"); + assert.equal(await text(page, "#empty"), "\u00a0", "a no-break space holds the line"); + const ends = await page.evaluate(() => ["#short", "#long"].map((s) => { const r = document.createRange(); r.selectNodeContents(document.querySelector(`${s} [data-on]`)); return r.getBoundingClientRect().right; })); + assert.ok(Math.abs(ends[0] - ends[1]) < 0.5, "end-aligned"); + }); + } + + test("the held forms are reserved from the first frame: pressing the hold moves nothing, and the head says when the work started", async () => { + // 10 s on the fake clock is 00:00:10 UTC on Jan 1 1970; the browser's zone is whatever the runner's is, so the expected words come from the page. + const page = await open(RUN(`|`)); + const at = await page.evaluate(() => document.querySelector("#after").getBoundingClientRect().left); + await hold(page, true); + await page.clock.runFor(50); + const words = await page.evaluate(() => new Date(4_000).toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" })); + assert.equal(plain(await text(page, "#head")), plain(`Started ${words}`)); + assert.equal(await page.evaluate(() => document.querySelector("#after").getBoundingClientRect().left), at, "0px"); + assert.match(await page.evaluate(() => document.querySelector("#head time").getAttribute("datetime")), /^\d{4}-\d\d-\d\dT\d\d:\d\d$/); + }); +}); + +describe("since", () => { + test("after a failure, a wait and a retry, the held form and its datetime show the first start, never the retry's, with the date for another day", async () => { + // The work first started a day and an hour ago; the first attempt took 6.3 s and failed; the retry started 2 s ago. + const page = await open(RUN(``)); + await page.evaluate(() => window.setProps({ start: 10_000 - 90_000_000, end: 10_000 - 90_000_000 + 6_300 })); + await page.clock.runFor(50); + assert.equal(await text(page, "#head"), "6.3 s", "frozen while failed"); + await page.clock.runFor(5_000); + assert.equal(await text(page, "#head"), "6.3 s", "still frozen through the wait"); + const now = await page.evaluate(() => Date.now()); + await page.evaluate(({ now }) => window.setProps({ start: now - 2_000, end: undefined, carried: 6_300, since: 10_000 - 90_000_000 }), { now }); + await page.clock.runFor(50); + assert.equal(await text(page, "#head"), "8.3 s", "a retry counts on from the frozen figure, not over the wait"); + await hold(page, true); + await page.clock.runFor(50); + const expected = await page.evaluate(() => { + const t = new Date(10_000 - 90_000_000); + return `Started ${t.toLocaleDateString("en-US", { month: "short", day: "numeric" })}, ${t.toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" })}`; + }); + assert.equal(plain(await text(page, "#head")), plain(expected)); + const iso = await page.evaluate(() => document.querySelector("#head time").getAttribute("datetime")); + const first = await page.evaluate(() => { const t = new Date(10_000 - 90_000_000); const p = (n) => String(n).padStart(2, "0"); return `${t.getFullYear()}-${p(t.getMonth() + 1)}-${p(t.getDate())}T${p(t.getHours())}:${p(t.getMinutes())}`; }); + assert.equal(iso, first, "the datetime is the first start"); + }); + + test("a warning when carried comes without since (development: the dist module under Node, where NODE_ENV is not production)", async () => { + const React = await import("react"); + const { renderToString } = await import("react-dom/server"); + const { RunTimer } = await import(pathToFileURL(path.join(pkg, "dist", "run-timer.js")).href); + const warn = console.warn; + const said = []; + console.warn = (m) => said.push(String(m)); + try { + renderToString(React.createElement(RunTimer, { start: 0, end: 1_000, carried: 2_000 })); + renderToString(React.createElement(RunTimer, { start: 0, end: 1_000, carried: 2_000, since: 0 })); + } finally { console.warn = warn; } + assert.equal(said.length, 1); + assert.match(said[0], /^Basalt RunTimer: `carried` is given without `since`/); + }); +}); + +test("never a live region, and a time element with an ISO duration", async () => { + const page = await open(RUN(``)); + const r = await page.evaluate(() => { const t = document.querySelector("#t time"); return { tag: t.tagName, iso: t.getAttribute("datetime"), live: !!t.closest("[aria-live],[role=status],[role=log]") }; }); + assert.deepEqual(r, { tag: "TIME", iso: "PT12.3S", live: false }); +}); diff --git a/packages/react/test/server-modules.test.mjs b/packages/react/test/server-modules.test.mjs index 8a6f5733..7fbd12fb 100644 --- a/packages/react/test/server-modules.test.mjs +++ b/packages/react/test/server-modules.test.mjs @@ -28,7 +28,7 @@ const home = new Map(); const PLAIN = [ "AMBIENT_MAX", "CONFIRM_MS", "COPIED_MS", "ENTRANCE_LATE_MS", "LOOPS_TOGGLE_DESCRIPTION", "LOOPS_TOGGLE_NAME", "REFLOW_BOUND", "STATUS_MESSAGE_MS", "TRAVEL_IN_FLIGHT", "TRAVEL_LONG_LEG", "TRAVEL_MIN_LEG", "TRAVEL_MS_PER_PX", "TRAVEL_RUN_LIMIT", "TRAVEL_SHORT_LEG", "WAIT_MIN_SHOWN_MS", "WAIT_SHOW_AFTER_MS", "ambient", "ambientTiming", "createTravellers", "entranceKey", - "entranceSeen", "entranceStep", "entranceVerdict", "forgetEntrance", "formatAge", "formatClock", "formatCountdown", "formatDay", "formatElapsed", "formatStamp", "formatStatTime", + "entranceSeen", "entranceStep", "entranceVerdict", "forgetEntrance", "formatAge", "formatClock", "formatCountdown", "formatDay", "formatElapsed", "formatStamp", "formatStatTime", "formatRunTime", "STAGE_WORDS", "holdFirstPaint", "isApplePlatform", "isModKey", "KEEP", "fillIn", "forgetCount", "lockupDrawing", "loopsBootstrap", "markEntranceSeen", "markPageChange", "markPageStart", "preloadCodeLanguages", "rememberCount", "rememberedCount", "shareOf", "sortRows", "standIn", "themeBootstrap", "trailingMean", "travelLeg", "travelRun", "travelTokens", "typingStatus", ]; const LEFT_IN_A_CLIENT_MODULE = { diff --git a/packages/react/test/stage-badge.test.mjs b/packages/react/test/stage-badge.test.mjs new file mode 100644 index 00000000..fe71bca9 --- /dev/null +++ b/packages/react/test/stage-badge.test.mjs @@ -0,0 +1,129 @@ +// StageBadge (DECISIONS 316, 1.6): the seven faces on Badge's marks, one seat as wide as the widest face (braille included, from a static measure), the +// sequential swap and its frames, one accessible name throughout, reduced motion and the hold. Chromium, built package, real stylesheet. +import assert from "node:assert/strict"; +import { after, before, describe, test } from "node:test"; + +import { fixturePage, freezeAnimations, launch, settle } from "./support.mjs"; + +let browser; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); }); + +const STATES = ["queued", "running", "success", "failed", "skipped", "canceled", "retrying"]; +const FIXTURE = ` +const STATES = ${JSON.stringify(STATES)}; +function App() { + const [state, setState] = React.useState("queued"); + React.useEffect(() => { window.setState = setState; }, []); + return
+ {["outline", "plain"].map((variant) =>
+ {STATES.map((s) => |)} +
)} + | +
; +} +createRoot(document.getElementById("root")).render();`; + +const open = async (options = {}) => { + const { page, errors } = await fixturePage(browser, FIXTURE, { viewport: { width: 800, height: 700 }, theme: "dark", ...options }); + await settle(page); + page.errors = errors; + return page; +}; + +describe("the faces", () => { + test("each state maps to Badge's mark: pending ring, braille, the success, danger and neutral dots", async () => { + const page = await open(); + const r = await page.evaluate((states) => states.map((s) => { + const badge = document.querySelector(`#outline-${s} .basalt-run-badge-face .basalt-badge`); + return [s, badge.dataset.status ?? null, !!badge.querySelector(".basalt-spinner[data-variant='braille']"), badge.textContent]; + }), STATES); + assert.deepEqual(r, [ + ["queued", "pending", false, "Queued"], ["running", null, true, "Running"], ["success", "success", false, "Passed"], ["failed", "danger", false, "Failed"], + ["skipped", "neutral", false, "Skipped"], ["canceled", "neutral", false, "Canceled"], ["retrying", null, true, "Retrying, 2 of 3"], + ]); + }); + + for (const variant of ["outline", "plain"]) { + test(`one width for every face, braille included (0px), ${variant}`, async () => { + const page = await open(); + const widths = await page.evaluate(({ states, variant }) => states.map((s) => document.querySelector(`#${variant}-${s} .basalt-run-badge`).getBoundingClientRect().width), { states: STATES, variant }); + assert.ok(widths.every((w) => w === widths[0]), widths.join(", ")); + if (variant === "outline") { + const pills = await page.evaluate((states) => states.map((s) => document.querySelector(`#outline-${s} .basalt-run-badge-face .basalt-badge`).getBoundingClientRect().width), STATES); + assert.ok(pills.every((w) => w === pills[0]), `the pill is one width: ${pills.join(", ")}`); + } + }); + } + + test("no animation runs in the hidden measure, and the measure holds no spinner", async () => { + const page = await open(); + const r = await page.evaluate(() => [...document.querySelectorAll(".basalt-run-badge-measure")].map((m) => [m.querySelectorAll(".basalt-spinner").length, m.getAnimations({ subtree: true }).length, m.getAttribute("aria-hidden")])); + assert.ok(r.every(([spinners, animations, hidden]) => spinners === 0 && animations === 0 && hidden === "true")); + }); +}); + +describe("the swap", () => { + const frames = async (page, clock, total, step = 8) => { + const out = []; + for (let t = 0; t <= total; t += step) { + out.push(await page.evaluate(() => [...document.querySelectorAll("#live .basalt-run-badge-face")].map((f) => ({ leaving: f.hasAttribute("data-leaving"), opacity: Number(getComputedStyle(f).opacity), y: new DOMMatrix(getComputedStyle(f).transform).m42, hidden: f.getAttribute("aria-hidden") })))); + await clock.advance(step); + } + return out; + }; + + test("out, then in: the two faces are never both above opacity 0, the new one never falls once it has risen, and nothing beside it moves", async () => { + const page = await open(); + const after = () => page.evaluate(() => document.querySelector("#after").getBoundingClientRect().left); + const at = await after(); + const clock = await freezeAnimations(page); + await page.evaluate(() => window.setState("running")); + await clock.advance(0); + const seen = await frames(page, clock, 280); + let rose = 0; + for (const frame of seen) { + const old = frame.find((f) => f.leaving); + const fresh = frame.find((f) => !f.leaving); + if (old && fresh) assert.ok(!(old.opacity > 0 && fresh.opacity > 0), `both above 0: ${JSON.stringify(frame)}`); + if (old) { + assert.equal(old.hidden, "true", "the leaving face is aria-hidden"); + assert.ok(old.y <= 0, "the old face rises"); + } + assert.ok(fresh.opacity >= rose - 1e-6, `the new face never falls (${rose} to ${fresh.opacity})`); + rose = fresh.opacity; + assert.equal(fresh.hidden, null); + } + assert.equal(seen.at(-1).length, 1, "the old face has gone"); + assert.equal(seen.at(-1)[0].opacity, 1); + assert.equal(await after(), at, "0px"); + await clock.thaw(); + }); + + test("one accessible name at every moment: the new word", async () => { + const page = await open(); + const clock = await freezeAnimations(page); + await page.evaluate(() => window.setState("failed")); + await clock.advance(40); + const snapshot = await page.locator("#live").ariaSnapshot(); + assert.ok(snapshot.includes("Failed") && !snapshot.includes("Queued") && !snapshot.includes("Running"), snapshot); + await clock.thaw(); + }); + + test("reduced motion fades only; the hold swaps at once", async () => { + const reduced = await open({ reducedMotion: "reduce" }); + const clock = await freezeAnimations(reduced); + await reduced.evaluate(() => window.setState("success")); + await clock.advance(0); + const seen = await frames(reduced, clock, 280); + assert.ok(seen.flat().every((f) => f.y === 0), "no rise"); + await clock.thaw(); + const held = await open(); + await held.evaluate(() => document.documentElement.setAttribute("data-loops", "held")); + await held.evaluate(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)))); + await held.evaluate(() => window.setState("success")); + const faces = await held.evaluate(() => [...document.querySelectorAll("#live .basalt-run-badge-face")].map((f) => [f.textContent, getComputedStyle(f).opacity])); + assert.deepEqual(faces, [["Passed", "1"]]); + assert.deepEqual(held.errors, []); + }); +}); diff --git a/packages/react/test/stage-mark.test.mjs b/packages/react/test/stage-mark.test.mjs new file mode 100644 index 00000000..21f49869 --- /dev/null +++ b/packages/react/test/stage-mark.test.mjs @@ -0,0 +1,206 @@ +// StageMark (DECISIONS 316, 1.2): the seven states' marks, their ink and their seat; the crossfade on a change of state; the queued breath (the one loop a +// state that is not running has) and where it is still. Driven in Chromium against the built package with the real stylesheet. +import assert from "node:assert/strict"; +import fs from "node:fs"; +import path from "node:path"; +import { after, before, describe, test } from "node:test"; + +import { fixturePage, freezeAnimations, launch, pkg, settle, tick } from "./support.mjs"; + +let browser; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); }); + +const STATES = ["queued", "running", "success", "failed", "skipped", "canceled", "retrying"]; +const INK = { queued: "--basalt-text-secondary", running: "--basalt-text-primary", success: "--basalt-text-secondary", failed: "--basalt-status-danger", skipped: "--basalt-text-tertiary", canceled: "--basalt-text-tertiary", retrying: "--basalt-text-primary" }; + +const ALL = ` +import { CheckCircleIcon } from "@phosphor-icons/react/dist/csr/CheckCircle"; +import { CircleIcon } from "@phosphor-icons/react/dist/csr/Circle"; +import { MinusCircleIcon } from "@phosphor-icons/react/dist/csr/MinusCircle"; +import { ProhibitIcon } from "@phosphor-icons/react/dist/csr/Prohibit"; +import { XCircleIcon } from "@phosphor-icons/react/dist/csr/XCircle"; +const REF = { queued: CircleIcon, success: CheckCircleIcon, failed: XCircleIcon, skipped: MinusCircleIcon, canceled: ProhibitIcon }; +const STATES = ${JSON.stringify(STATES)}; +function App() { + return
+ {[16, 20, 24].map((size) =>
+ {STATES.map((s) => )} + {Object.entries(REF).map(([s, icon]) => )} + +
)} +
; +} +createRoot(document.getElementById("root")).render();`; + +const SWITCH = ` +function App() { + const [state, setState] = React.useState("running"); + React.useEffect(() => { window.setState = setState; }, []); + return
; +} +createRoot(document.getElementById("root")).render();`; + +const open = async (body, options = {}) => { + const { page, errors } = await fixturePage(browser, body, { viewport: { width: 900, height: 400 }, ...options }); + await settle(page); + page.errors = errors; + return page; +}; +const tokenColor = (page, name) => page.evaluate((n) => { const p = document.createElement("span"); p.style.color = `var(${n})`; document.body.append(p); const c = getComputedStyle(p).color; p.remove(); return c; }, name); + +describe("the seven marks", () => { + for (const theme of ["dark", "light"]) { + test(`each state's glyph, ink and size at 16, 20 and 24, one seat for all seven, aria-hidden (${theme})`, async () => { + const page = await open(ALL, { theme }); + for (const size of [16, 20, 24]) { + const r = await page.evaluate(({ size, states }) => states.map((s) => { + const mark = document.querySelector(`#m-${s}-${size} .basalt-run-mark`); + const face = mark.querySelector(".basalt-run-mark-face"); + const box = mark.getBoundingClientRect(); + const svg = face.querySelector("svg"); + return { s, w: box.width, h: box.height, hidden: mark.getAttribute("aria-hidden"), color: getComputedStyle(face).color, svg: svg.innerHTML, svgW: svg.getBoundingClientRect().width, ring: !!face.querySelector(".basalt-spinner[data-variant='ring']") }; + }), { size, states: STATES }); + for (const m of r) { + assert.equal(m.w, size, `${m.s} at ${size}: the seat's width`); + assert.equal(m.h, size, `${m.s} at ${size}: the seat's height`); + assert.equal(m.hidden, "true", `${m.s}: aria-hidden`); + assert.equal(m.color, await tokenColor(page, INK[m.s]), `${m.s}: ${INK[m.s]}`); + if (m.s === "running" || m.s === "retrying") assert.ok(m.ring, `${m.s}: the ring`); + else { + const ref = await page.evaluate(({ s, size }) => document.querySelector(`#ref-${s}-${size} svg`).innerHTML, { s: m.s, size }); + assert.equal(m.svg, ref, `${m.s} at ${size}: Phosphor Bold's own glyph`); + assert.equal(m.svgW, size); + } + } + } + assert.deepEqual(page.errors, []); + }); + } + + test("no Phosphor check, close or minus: those are the core set's, and only the circled marks are Phosphor's", () => { + const read = (file) => fs.readFileSync(path.join(pkg, "dist", file), "utf8"); + const entry = read("stage-mark.js"); + const source = [entry, ...[...entry.matchAll(/from "\.\/(chunk-[A-Z0-9]+\.js)"/g)].map((m) => read(m[1]))].join("\n"); + const phosphor = [...source.matchAll(/@phosphor-icons\/react\/dist\/csr\/([A-Za-z]+)/g)].map((m) => m[1]).sort(); + assert.deepEqual(phosphor, ["CheckCircle", "Circle", "MinusCircle", "Prohibit", "XCircle"]); + }); +}); + +describe("a change of state crossfades", () => { + test("both marks stand in the seat, the old fading as the new arrives, over duration-fast, then the old is gone; the seat never moves", async () => { + const page = await open(SWITCH, { theme: "dark" }); + const seat = () => page.evaluate(() => { const b = document.querySelector("#m .basalt-run-mark").getBoundingClientRect(); return [b.x, b.y, b.width, b.height]; }); + const before = await seat(); + const clock = await freezeAnimations(page); + await page.evaluate(() => window.setState("success")); + await clock.advance(0); + const faces = () => page.evaluate(() => [...document.querySelectorAll("#m .basalt-run-mark-face")].map((f) => ({ state: f.dataset.state, leaving: f.hasAttribute("data-leaving"), opacity: Number(getComputedStyle(f).opacity) }))); + const start = await faces(); + assert.deepEqual(start.map((f) => [f.state, f.leaving]), [["running", true], ["success", false]], "both marks present"); + await clock.advance(48); + const mid = await faces(); + assert.ok(mid[0].opacity < 1 && mid[0].opacity > 0, `the old one is fading (${mid[0].opacity})`); + assert.ok(mid[1].opacity > 0 && mid[1].opacity < 1, `the new one is arriving (${mid[1].opacity})`); + assert.ok(mid[1].opacity > start[1].opacity && mid[0].opacity < start[0].opacity, "the opacities cross"); + assert.deepEqual(await seat(), before, "the seat holds while both stand"); + await clock.advance(60); + // animationend is sent on a real frame: give the page a few, on the frozen clock. + let end = await faces(); + for (let i = 0; i < 20 && end.length > 1; i += 1) { await new Promise((r) => setTimeout(r, 20)); await clock.advance(8); end = await faces(); } + assert.deepEqual(end.map((f) => f.state), ["success"], "done inside duration-fast: the old mark has left"); + assert.equal(end[0].opacity, 1); + assert.deepEqual(await seat(), before); + await clock.thaw(); + }); + + test("running to retrying is one mark: nothing crossfades", async () => { + const page = await open(SWITCH, { theme: "dark" }); + await page.evaluate(() => window.setState("retrying")); + const n = await page.evaluate(() => document.querySelectorAll("#m .basalt-run-mark-face").length); + assert.equal(n, 1); + }); + + test("under reduced motion the crossfade stays (opacity only); under the hold the change lands at once", async () => { + const reduced = await open(SWITCH, { theme: "dark", reducedMotion: "reduce" }); + const clock = await freezeAnimations(reduced); + await reduced.evaluate(() => window.setState("failed")); + await clock.advance(40); + const faces = await reduced.evaluate(() => [...document.querySelectorAll("#m .basalt-run-mark-face")].map((f) => [f.dataset.state, getComputedStyle(f).animationName, getComputedStyle(f).transform])); + assert.equal(faces.length, 2, "both marks stand under reduced motion"); + assert.ok(faces.every(([, , transform]) => transform === "none"), "nothing moves"); + await clock.thaw(); + const held = await open(SWITCH, { theme: "dark" }); + await held.evaluate(() => document.documentElement.setAttribute("data-loops", "held")); + await held.evaluate(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)))); + await held.evaluate(() => window.setState("failed")); + const now = await held.evaluate(() => [...document.querySelectorAll("#m .basalt-run-mark-face")].map((f) => [f.dataset.state, getComputedStyle(f).opacity])); + assert.deepEqual(now, [["failed", "1"]], "one face, at full, at once"); + }); +}); + +const QUEUED = `createRoot(document.getElementById("root")).render(
);`; + +describe("the queued breath", () => { + test("keyframes from opacity-queued (0.65) to 1 on duration-loop-fade, ease-in-out, alternating, forever; sampled, never under 0.65", async () => { + const page = await open(QUEUED, { theme: "light" }); + const r = await page.evaluate(() => { + const breath = document.querySelector("#q .basalt-run-mark-breath"); + const [a] = breath.getAnimations(); + const timing = a.effect.getComputedTiming(); + const samples = []; + a.pause(); + for (let t = 0; t <= 2400; t += 100) { a.currentTime = t; samples.push(Number(getComputedStyle(breath).opacity)); } + return { name: a.animationName, duration: timing.duration, iterations: timing.iterations, direction: timing.direction, easing: getComputedStyle(breath).animationTimingFunction, samples, start: a.startTime }; + }); + assert.equal(r.name, "basalt-run-breath"); + assert.equal(r.duration, 1200, "duration-loop-fade"); + assert.equal(r.iterations, Infinity); + assert.equal(r.direction, "alternate"); + assert.equal(r.easing, "cubic-bezier(0.65, 0, 0.35, 1)", "ease-in-out"); + assert.ok(Math.abs(r.samples[0] - 0.65) < 0.001, `the floor is 0.65 (${r.samples[0]})`); + assert.ok(Math.abs(r.samples[12] - 1) < 0.001, "full at one period"); + assert.ok(r.samples.every((o) => o >= 0.65 - 1e-6 && o <= 1), `never under 0.65: ${r.samples.join(", ")}`); + }); + + test("it joins the shared clock: its start is the timeline's origin", async () => { + const page = await open(QUEUED, { theme: "dark" }); + const start = await page.evaluate(() => Number(document.querySelector("#q .basalt-run-mark-breath").getAnimations()[0].startTime)); + assert.equal(start, 0); + }); + + for (const [mode, options, prep] of [ + ["reduced motion", { reducedMotion: "reduce" }, null], + ["the hold", {}, () => document.documentElement.setAttribute("data-loops", "held")], + ["forced colours", { forcedColors: "active" }, null], + ["print", {}, "print"], + ]) { + test(`still, at full, under ${mode}`, async () => { + const page = await open(QUEUED, { theme: "dark", ...options }); + if (prep === "print") await page.emulateMedia({ media: "print" }); + else if (prep) await page.evaluate(prep); + await page.evaluate(() => new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)))); + const r = await page.evaluate(() => { const b = document.querySelector("#q .basalt-run-mark-breath"); return { animation: getComputedStyle(b).animationName, opacity: getComputedStyle(b).opacity, running: b.getAnimations().length }; }); + assert.deepEqual(r, { animation: "none", opacity: "1", running: 0 }, mode); + }); + } + + test("in forced colours a mark is currentColor: on a lit row it takes the row's HighlightText, naming no system colour itself", async () => { + const page = await open(QUEUED, { theme: "dark", forcedColors: "active" }); + const r = await page.evaluate(() => ({ face: getComputedStyle(document.querySelector("#lit .basalt-run-mark-face")).color, row: getComputedStyle(document.querySelector("#lit")).color })); + assert.equal(r.face, r.row); + const css = fs.readFileSync(path.join(pkg, "src", "styles", "components.css"), "utf8"); + const block = css.slice(css.indexOf("/* StageMark: one seat"), css.indexOf("/* RunTimer: Geist Mono")); + assert.ok(!/CanvasText|GrayText|HighlightText|LinkText/.test(block), "the mark's rules name no system colour"); + }); +}); + +test("a server render draws the seat and the mark, and nothing runs at import", async () => { + const { renderToString } = await import("react-dom/server"); + const React = await import("react"); + const { StageMark } = await import(path.join(pkg, "dist", "stage-mark.js")); + const html = renderToString(React.createElement(StageMark, { state: "failed" })); + assert.match(html, /class="basalt-run-mark"/); + assert.match(html, /aria-hidden="true"/); + void tick; +}); diff --git a/packages/tokens/test/contrast.test.mjs b/packages/tokens/test/contrast.test.mjs index dae3efd8..75f0ddf3 100644 --- a/packages/tokens/test/contrast.test.mjs +++ b/packages/tokens/test/contrast.test.mjs @@ -1041,3 +1041,59 @@ for (const theme of THEMES) { } }); } + +// ---- Stages and runs (DECISIONS 316, 2.2): the tail's first step, a failed row's 0.88, the queued breath and the connector; the four deeper steps +// are the one named exception (foundations, Principles) and are read by nothing but a run timeline's tail ---- + +const RUN_OPACITY = (name) => Number(tokens.primitives[`opacity-${name}`].css); +const RUN_ONTO = (theme) => [...surfaces(theme), ...LEVELS.map((n) => [n, color(theme, n)])]; + +for (const theme of THEMES) { + test(`${theme}: a tail's first step (text-tertiary, whole) and a failed row's (status-danger at opacity-recede-danger) hold 4.5:1 on every surface, well and level, and under more contrast`, () => { + const danger = RUN_OPACITY("recede-danger"); + assert.equal(danger, 0.88); + for (const [bgName, bg] of RUN_ONTO(theme)) { + const first = ratio(over(color(theme, "text-tertiary"), bg), bg); + assert.ok(first >= 4.5, `${theme}: the first step on ${bgName} is ${fmt(first)}:1`); + const failed = ratio(over({ ...color(theme, "status-danger"), alpha: danger }, bg), bg); + assert.ok(failed >= 4.5, `${theme}: a failed row's first step on ${bgName} is ${fmt(failed)}:1`); + // Under more contrast nothing recedes: tertiary steps to secondary, and a failed row is full danger ink. + assert.ok(ratio(over(more(theme, "text-tertiary"), bg), bg) >= 4.5, `${theme}: the first step on ${bgName} under more contrast`); + assert.ok(ratio(over(more(theme, "status-danger"), bg), bg) >= 4.5, `${theme}: a failed row on ${bgName} under more contrast`); + } + }); + + test(`${theme}: the queued breath, text-secondary at opacity-queued, is 3:1 or better on every surface, well and level at its lowest, and under more contrast`, () => { + const floor = RUN_OPACITY("queued"); + assert.equal(floor, 0.65); + for (const [bgName, bg] of RUN_ONTO(theme)) { + const r = ratio(over({ ...more(theme, "text-secondary"), alpha: floor }, bg), bg); + assert.ok(r >= 3, `${theme}: the queued mark at its lowest on ${bgName} is ${fmt(r)}:1`); + } + }); + + test(`${theme}: the connector and the rail's track (border-input, a hairline) hold 3:1 on every surface and level`, () => { + atLeast(theme, "border-input", 3, RUN_ONTO(theme)); + }); + + test(`${theme}: the tail's steps 2 to 5 are the named exception, below 4.5:1 on purpose; reported with their ratios`, (t) => { + const steps = [2, 3, 4, 5].map((n) => [n, RUN_OPACITY(`recede-${n}`)]); + assert.deepEqual(steps.map(([, v]) => v), [0.5, 0.32, 0.2, 0.12], "the owner's steps"); + for (const [n, alpha] of steps) { + const bg = color(theme, "surface-1"); + const neutral = ratio(over({ ...color(theme, "text-secondary"), alpha }, bg), bg); + const failed = ratio(over({ ...color(theme, "status-danger"), alpha }, bg), bg); + assert.ok(neutral < 4.5, `${theme}: step ${n} is the exception; if it held 4.5:1 it would not need one`); + t.diagnostic(`${theme}, level 1: step ${n} at ${alpha} is ${fmt(neutral)}:1, a failed row ${fmt(failed)}:1`); + } + }); +} + +test("opacity-recede-2 to -5 are read by a run timeline's tail and nothing else in the stylesheet", () => { + const css = fs.readFileSync(new URL("../../react/src/styles/components.css", import.meta.url), "utf8").replace(/\/\*[\s\S]*?\*\//g, ""); + const readers = []; + for (const m of css.matchAll(/([^{}]*)\{[^{}]*--basalt-opacity-recede-[2-5]\b[^{}]*\}/g)) readers.push(m[1].trim()); + for (const selector of readers) assert.ok(selector.split(",").every((s) => /\.basalt-run-steps\b/.test(s)), `${selector} reads a tail step and is not a run timeline's tail`); + const skill = new URL("../../../tools/html-skill/src/modules/runs.css", import.meta.url); + if (fs.existsSync(skill)) assert.ok(!/--basalt-opacity-recede-[2-5]\b/.test(fs.readFileSync(skill, "utf8")), "the HTML skill draws no tail"); +}); diff --git a/packages/tokens/tokens/primitives.tokens.json b/packages/tokens/tokens/primitives.tokens.json index a640eeef..b7698c00 100644 --- a/packages/tokens/tokens/primitives.tokens.json +++ b/packages/tokens/tokens/primitives.tokens.json @@ -1265,6 +1265,32 @@ "amount": { "$value": 0.72, "$description": "The ink of a button's amount (\"Add to cart $49\"), a step quieter than its label (DECISIONS 154, D11b). Used only on the variants whose ink holds 4.5:1 at this opacity on every surface the button can sit on (primary, secondary, outline); ghost and danger keep full ink." + }, + "recede": { + "2": { + "$value": 0.5, + "$description": "A run timeline's tail, second step: text-secondary at this opacity over its own ground (DECISIONS 316, 2.2). Below 4.5:1 by the one named exception (foundations, Principles): the toggle above the tail opens the whole record at full contrast. No other text reads it." + }, + "3": { + "$value": 0.32, + "$description": "A run timeline's tail, third step (DECISIONS 316). The same exception as opacity-recede-2." + }, + "4": { + "$value": 0.2, + "$description": "A run timeline's tail, fourth step (DECISIONS 316). The same exception as opacity-recede-2." + }, + "5": { + "$value": 0.12, + "$description": "A run timeline's tail, fifth step and every step older (DECISIONS 316). The same exception as opacity-recede-2." + }, + "danger": { + "$value": 0.88, + "$description": "A failed row's first step back, in a timeline's tail or a stage transcript's older lines: status-danger at this opacity, 4.5:1 or better on every surface (worst 4.76, a light band), a muted red (DECISIONS 316, 2.2)." + } + }, + "queued": { + "$value": 0.65, + "$description": "The bottom of a queued StageMark's breath: text-secondary from this opacity to 1 and back on duration-loop-fade, 3:1 or better on every surface at every moment (worst 3.19, a light band; DECISIONS 316, 2.2 and 4.1)." } }, "aspect": { From c178b59aea9e4468879c09e15d1b8c90b0998762 Mon Sep 17 00:00:00 2001 From: bailey <74082460+bmjcoding@users.noreply.github.com> Date: Mon, 23 Nov 2026 14:54:55 -0600 Subject: [PATCH 02/13] Stages batch 2 (DECISIONS 316): StageList, StageRail and RunStage A known sequence of stages as a list (the still connector, the detail held from the first frame as a calc of tokens, focus to the stage's name whoever closes it) and as a rail (one status seat for the time and the words, a link that fills from the inline start, five and six stages drawn as the list under 480px of the rail's own width). Progress's value holds the room of "100%". Not reviewed: the implementation is unreviewed. Co-Authored-By: Claude Opus 5.5 --- packages/react/src/index.ts | 6 + packages/react/src/run-stage.tsx | 145 ++++++++++ packages/react/src/stage-list.tsx | 39 +++ packages/react/src/stage-rail.tsx | 41 +++ packages/react/src/styles/components.css | 107 ++++++++ packages/react/test/bundle.test.mjs | 3 +- packages/react/test/demo-runs.tsx | 14 +- packages/react/test/export-sizes.json | 19 +- packages/react/test/stage-list.test.mjs | 320 +++++++++++++++++++++++ packages/react/test/stage-rail.test.mjs | 182 +++++++++++++ 10 files changed, 866 insertions(+), 10 deletions(-) create mode 100644 packages/react/src/run-stage.tsx create mode 100644 packages/react/src/stage-list.tsx create mode 100644 packages/react/src/stage-rail.tsx create mode 100644 packages/react/test/stage-list.test.mjs create mode 100644 packages/react/test/stage-rail.test.mjs diff --git a/packages/react/src/index.ts b/packages/react/src/index.ts index 8682a0ec..b5849a79 100644 --- a/packages/react/src/index.ts +++ b/packages/react/src/index.ts @@ -165,6 +165,12 @@ export type { RunTimerProps } from "./run-timer"; export { StageBadge } from "./stage-badge"; export type { StageBadgeProps } from "./stage-badge"; export { RunAnnouncer } from "./run-announcer"; +export { RunStage } from "./run-stage"; +export type { RunStageProps } from "./run-stage"; +export { StageList } from "./stage-list"; +export type { StageListProps } from "./stage-list"; +export { StageRail } from "./stage-rail"; +export type { StageRailProps } from "./stage-rail"; export type { RunAnnouncerProps, RunEvent } from "./run-announcer"; export { Terminal } from "./terminal"; export type { TerminalLine, TerminalLineKind, TerminalProps, TerminalStatus } from "./terminal"; diff --git a/packages/react/src/run-stage.tsx b/packages/react/src/run-stage.tsx new file mode 100644 index 00000000..8e21ae27 --- /dev/null +++ b/packages/react/src/run-stage.tsx @@ -0,0 +1,145 @@ +import * as React from "react"; + +import { Reserve } from "./reserve"; +import { STAGE_WORDS } from "./run-format"; +import type { Moment, StageState } from "./run-format"; +import { RunTimer } from "./run-timer"; +import { warnRun } from "./run-warn"; +import { StageMark } from "./stage-mark"; +import { join } from "./utils"; + +declare const process: { env: { NODE_ENV?: string } }; + +// ---- A stage of a run (DECISIONS 316, 1.4 and 1.5) ---- +// One row of a `StageList` or one node of a `StageRail`, from the same data. Which state's word is drawn and which is only said is foundations' table +// ("Stages and runs"): in a list every word but a passed stage's is drawn after the name; on a rail a failed, skipped, canceled or retrying node draws its +// word in the status seat, where a running or passed node's time stands. A detail (a failure's reason and Retry, what waits and Approve) opens under a +// list's stage. Focus is never dropped: when a detail closes or its action leaves while focus is inside it, focus goes to the stage's name. + +/** Where a `RunStage` is drawn: set by `StageList` and `StageRail`. */ +export const RunStagesContext = React.createContext<"list" | "rail" | null>(null); + +export interface RunStageProps { + /** The stage's name: "Test". It never wraps. */ + name: string; + state: StageState; + /** The state's word, when the app's differs: "Blocked by Test", "Retrying, 2 of 3", "Waiting for approval". */ + word?: string; + /** A short fact in tertiary at `text-xs` ("412 packages"); a list hides it under 480px of its own width. A rail draws none. */ + meta?: React.ReactNode; + /** When this attempt started, and ended: the stage's own time. */ + start?: Moment; + end?: Moment; + /** What opens under a list's stage: a failure's reason, what waits. A `p` is the reason, a `strong` its loud words, a `small` its fact. A rail ignores it. */ + detail?: React.ReactNode; + /** The detail's one action: a `Button` whose `onClick` returns the app's promise ("Retry", "Approve"). A rail ignores it. */ + action?: React.ReactNode; + className?: string; +} + +const DRAWN: Record<"list" | "rail", Record> = { + list: { queued: true, running: true, success: false, failed: true, skipped: true, canceled: true, retrying: true }, + rail: { queued: false, running: false, success: false, failed: true, skipped: true, canceled: true, retrying: true }, +}; + +/** + * Focus that was inside a part that has closed or lost its action goes to `home` (a name with `tabindex="-1"`, `preventScroll`), never to the body, + * whoever closed it: the reader's press, or the app (someone else approved, the retry started from elsewhere). `present` counts what the part holds (0 + * closed, 1 open, 2 open with its action); a fall is a leave. + */ +export function useFocusHome(present: number, home: React.RefObject) { + const inside = React.useRef(false); + const was = React.useRef(present); + const track = React.useMemo(() => ({ + onFocus: () => { inside.current = true; }, + // Focus moved by the reader to somewhere else is theirs; focus that went nowhere (its element left, or turned inert) is ours to place. + onBlur: (event: React.FocusEvent) => { if (event.relatedTarget) inside.current = false; }, + }), []); + React.useLayoutEffect(() => { + const fell = present < was.current; + was.current = present; + if (!fell || !inside.current) return; + inside.current = false; + const active = document.activeElement; + const part = home.current?.closest("li")?.querySelector("[data-focus-home]"); + if (active && active !== document.body && !part?.contains(active)) return; + home.current?.focus({ preventScroll: true }); + }); + return track; +} + +/** The words a rail node draws by default, each held in its status seat. */ +const RAIL_WORDS = { failed: STAGE_WORDS.failed, skipped: STAGE_WORDS.skipped, canceled: STAGE_WORDS.canceled, retrying: STAGE_WORDS.retrying }; + +/** One stage. In a `StageList` a row; in a `StageRail` a node. */ +export function RunStage({ name, state, word, meta, start, end, detail, action, className }: RunStageProps) { + const kind = React.useContext(RunStagesContext) ?? "list"; + const said = word ?? STAGE_WORDS[state]; + const drawn = DRAWN[kind][state]; + const nameRef = React.useRef(null); + const timer = ; + + // The detail keeps what it last held while it closes, so it closes over its own content and never over nothing. + const open = kind === "list" && (detail !== undefined || action !== undefined); + const kept = React.useRef<{ detail: React.ReactNode; action: React.ReactNode }>({ detail: null, action: null }); + if (open) kept.current = { detail, action }; + const track = useFocusHome(open ? (action === undefined ? 1 : 2) : 0, nameRef); + + // Development: a rail's word is one or two short words, and one that its column cuts warns. + const wordRef = React.useRef(null); + React.useLayoutEffect(() => { + if (process.env.NODE_ENV === "production" || kind !== "rail" || !drawn) return; + const el = wordRef.current; + if (el && el.scrollWidth > el.clientWidth + 0.5) warnRun("StageRail", `"${said}" is cut by its column; a rail's word is one or two short words.`); + }); + if (kind === "rail") { + return ( +
  • + + + + + {name} + {drawn ? null : {said}} + + + {/* One cell for the time and every word a node can draw, so a node that turns from its time to "Failed" or "Retrying" moves nothing. */} + {said} }} /> + +
  • + ); + } + + return ( +
  • +
    + + + {name} + {/* A flex item is its own run of text, so the name and the word are read apart, with no comma. */} + {drawn ? <>{" "}{said} : {said}} + + {meta} + {timer} +
    + {open || kept.current.detail !== null || kept.current.action !== null ? ( +
    +
    +
    + {open ? detail : kept.current.detail} + {(open ? action : kept.current.action) ?
    {open ? action : kept.current.action}
    : null} +
    +
    +
    + ) : null} +
  • + ); +} + +/** How many stages a list or rail holds; in development, a child that is not a `RunStage` warns. */ +export function countStages(component: string, children: React.ReactNode) { + const rows = React.Children.toArray(children).filter(React.isValidElement); + if (process.env.NODE_ENV !== "production" && rows.some((child) => child.type !== RunStage)) warnRun(component, "a child is not a RunStage; a stage list's and a rail's rows are RunStage."); + return rows.length; +} diff --git a/packages/react/src/stage-list.tsx b/packages/react/src/stage-list.tsx new file mode 100644 index 00000000..42459180 --- /dev/null +++ b/packages/react/src/stage-list.tsx @@ -0,0 +1,39 @@ +import * as React from "react"; + +import type { RunTimeScale } from "./run-format"; +import { countStages, RunStagesContext } from "./run-stage"; +import { useRunTimeScale } from "./run-timer"; +import { join } from "./utils"; + +export interface StageListProps { + /** Names the list ("Deploy 812 stages"). */ + label: string; + /** One scale for every stage's time, so the column is one width from the first frame (see `RunTimer`). */ + timeScale?: RunTimeScale; + /** + * The room for one stage's detail, held from the first frame so a failure moves only the rows under it and never what follows the list: one reason + * line by default (82px, 98 on touch: a `calc` of tokens, never a measure). A number holds that many reason lines; `false` holds none. + */ + reserveDetail?: boolean | number; + className?: string; + /** `RunStage` rows, in order. */ + children: React.ReactNode; +} + +/** + * A known sequence of named stages, top to bottom (DECISIONS 316, 1.4): an `ol` named by `label`. Each row is the stage's mark, its name and word, its + * meta and its time, joined to the next by a still 1px connector. Not `Stepper` (back and next for a form) and not `ActivityList` (a quiet list of steps). + */ +export function StageList({ label, timeScale = "seconds", reserveDetail = true, className, children }: StageListProps) { + const rows = countStages("StageList", children); + const lines = reserveDetail === false ? 0 : reserveDetail === true ? 1 : Math.max(0, Math.floor(reserveDetail)); + const { provide } = useRunTimeScale(timeScale); + const style = { "--_rows": rows, "--_reason-lines": lines } as React.CSSProperties; + return ( +
    +
      0 ? "" : undefined} style={style}> + {provide(children)} +
    +
    + ); +} diff --git a/packages/react/src/stage-rail.tsx b/packages/react/src/stage-rail.tsx new file mode 100644 index 00000000..6a861045 --- /dev/null +++ b/packages/react/src/stage-rail.tsx @@ -0,0 +1,41 @@ +import * as React from "react"; + +import { countStages, RunStagesContext } from "./run-stage"; +import { useRunTimeScale } from "./run-timer"; +import { warnRun } from "./run-warn"; +import { join } from "./utils"; + +declare const process: { env: { NODE_ENV?: string } }; + +export interface StageRailProps { + /** Names the rail ("Release v2.14.0 stages"). */ + label: string; + /** One scale for every node's time: seconds or minutes. The hour form is wider than a column at 390, so a rail of hour-long stages shows the run's time in its head. */ + timeScale?: "seconds" | "minutes"; + className?: string; + /** Two to six `RunStage` nodes, in order. */ + children: React.ReactNode; +} + +/** + * The same stages on one line (DECISIONS 316, 1.5): two to four at any width, five or six from 480px of the rail's own width, under which it is drawn as + * the list. Each node is its mark, its name and one status seat (its time, or its word when it failed, was skipped or canceled, or is retrying); a + * horizontal link to the next fills from the inline start when its stage passes. No bead: the running ring is the rail's only moving thing. + */ +export function StageRail({ label, timeScale = "seconds", className, children }: StageRailProps) { + const count = countStages("StageRail", children); + let scale = timeScale; + if ((scale as string) === "hours") { + if (process.env.NODE_ENV !== "production") warnRun("StageRail", "a rail takes \"seconds\" or \"minutes\": the hour form is wider than a column at 390. Show the run's time in its head."); + scale = "minutes"; + } + if (process.env.NODE_ENV !== "production" && (count < 2 || count > 6)) warnRun("StageRail", `a rail holds two to six stages, not ${count}; use a StageList.`); + const { provide } = useRunTimeScale(scale, "minutes"); + return ( +
    +
      + {provide(children)} +
    +
    + ); +} diff --git a/packages/react/src/styles/components.css b/packages/react/src/styles/components.css index a68d540f..a00fb31d 100644 --- a/packages/react/src/styles/components.css +++ b/packages/react/src/styles/components.css @@ -4353,6 +4353,113 @@ .basalt-run-badge-face[data-leaving] { display: none; } } + /* StageList (1.4): a row is the mark (16), space-3, the name and its word (space-2 apart, one line), the meta and the time, at text-sm with space-2 + above and below: 34px. The list is the container its meta answers (480px, size-breakpoint-container). */ + .basalt-run-stages-box, .basalt-run-rail-box { container-type: inline-size; min-width: 0; } + .basalt-run-stages, .basalt-run-rail { display: grid; align-content: start; margin: 0; padding: 0; list-style: none; font: var(--basalt-font-weight-regular) var(--basalt-text-sm-size) / var(--basalt-text-sm-line-height) var(--basalt-font-family-sans); color: var(--basalt-text-primary); } + /* The room for one detail of the standard form (a reason line, a fact line, space-2, the action, space-3), held from the first frame: a calc of + tokens, never a measure. 82px, and 98 where the action is the touch target's 44. */ + .basalt-run-stages[data-reserve] { + --_row: calc(var(--basalt-text-sm-line-height) + var(--basalt-space-2) * 2); + --_action: var(--basalt-size-control-sm); + min-block-size: calc(var(--_rows) * var(--_row) + var(--_reason-lines) * var(--basalt-text-sm-line-height) + var(--basalt-text-xs-line-height) + var(--basalt-space-2) + var(--_action) + var(--basalt-space-3)); + } + /* stylelint-disable-next-line unit-disallowed-list -- size-breakpoint-md (720px): a media query cannot read a token; under it the touch sizes apply whatever the pointer */ + @media (pointer: coarse), (width < 720px) { .basalt-run-stages[data-reserve] { --_action: var(--basalt-size-tap-min); } } + .basalt-run-stage { position: relative; min-width: 0; margin: 0; } + .basalt-run-stage-line { display: grid; grid-template-columns: var(--basalt-size-icon-sm) minmax(0, 1fr) auto auto; align-items: center; column-gap: var(--basalt-space-3); padding-block: var(--basalt-space-2); } + .basalt-run-stage-name { display: flex; align-items: baseline; gap: var(--basalt-space-2); min-width: 0; white-space: nowrap; border-radius: var(--basalt-radius-xs); outline: none; } + .basalt-run-stage-name:focus-visible { outline: var(--basalt-size-focus-width) solid var(--basalt-border-focus); outline-offset: var(--basalt-size-focus-offset); } + .basalt-run-stage-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; } + .basalt-run-stage-word { flex: none; color: var(--basalt-text-secondary); } + .basalt-run-stage:is([data-state="queued"], [data-state="skipped"], [data-state="canceled"]) .basalt-run-stage-name { color: var(--basalt-text-secondary); } + .basalt-run-stage:is([data-state="running"], [data-state="retrying"]) .basalt-run-stage-word { color: var(--basalt-text-primary); } + .basalt-run-stage[data-state="failed"] .basalt-run-stage-word { color: var(--basalt-status-danger); font-weight: var(--basalt-font-weight-medium); } + .basalt-run-stage:is([data-state="queued"], [data-state="skipped"], [data-state="canceled"]) .basalt-run-stage-word { color: var(--basalt-text-tertiary); } + .basalt-run-stage-meta { color: var(--basalt-text-tertiary); font-size: var(--basalt-text-xs-size); white-space: nowrap; } + .basalt-run-stage-meta:empty { display: none; } + .basalt-run-stage-line:has(> .basalt-run-stage-meta:empty) { grid-template-columns: var(--basalt-size-icon-sm) minmax(0, 1fr) auto; } + /* stylelint-disable-next-line basalt/container-length -- size-breakpoint-container (480px); a container query cannot read a custom property */ + @container (width < 480px) { + .basalt-run-stages .basalt-run-stage-meta { display: none; } + .basalt-run-stages .basalt-run-stage-line { grid-template-columns: var(--basalt-size-icon-sm) minmax(0, 1fr) auto; } + } + /* The connector: 1px of border-input on the marks' centre line, from space-1 under one mark to space-1 above the next, beside an open detail too. It + never fills, breaks, moves or changes with a state: the mark and its word carry the state. A real border, so forced colours keep it. */ + .basalt-run-stages > .basalt-run-stage:not(:last-child)::after { + content: ""; + position: absolute; + inset-inline-start: round(down, calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline) / 2), var(--basalt-size-hairline)); + inset-block-start: calc(var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-1)); + inset-block-end: calc(-1 * (var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 - var(--basalt-size-icon-sm) / 2 - var(--basalt-space-1))); + border-inline-start: var(--basalt-size-hairline) solid var(--basalt-border-input); + pointer-events: none; + } + /* The detail: opens by height and opacity over duration-slow on ease-out, closes at 0.75 on ease-in; inert while closed. Indented to the name. */ + .basalt-run-stage-detail { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows calc(var(--basalt-duration-slow) * 0.75) var(--basalt-ease-in), opacity calc(var(--basalt-duration-slow) * 0.75) var(--basalt-ease-in); } + .basalt-run-stage-detail[data-open] { grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows var(--basalt-duration-slow) var(--basalt-ease-out), opacity var(--basalt-duration-slow) var(--basalt-ease-out); } + .basalt-run-stage-detail-clip { min-height: 0; overflow: hidden; } + .basalt-run-stage-detail-body { padding-inline-start: calc(var(--basalt-size-icon-sm) + var(--basalt-space-3)); padding-block-end: var(--basalt-space-3); } + .basalt-run-stage-detail-body :is(p, small) { display: block; margin: 0; } + .basalt-run-stage-detail-body p { color: var(--basalt-text-secondary); font-size: var(--basalt-text-sm-size); line-height: var(--basalt-text-sm-line-height); } + .basalt-run-stage-detail-body strong { color: var(--basalt-text-primary); font-weight: var(--basalt-font-weight-medium); } + .basalt-run-stage[data-state="failed"] .basalt-run-stage-detail-body strong { color: var(--basalt-status-danger); } + .basalt-run-stage-detail-body small { color: var(--basalt-text-tertiary); font-size: var(--basalt-text-xs-size); line-height: var(--basalt-text-xs-line-height); } + /* code is Geist Mono at the row's own size (1em, never a ratio). Its own inline box is no taller than its glyphs, so a second face on the line never + makes the line taller than the row's. */ + .basalt-run-stage-detail-body code, .basalt-run-step code { font-family: var(--basalt-font-family-mono); font-size: inherit; line-height: 1; } + .basalt-run-stage-action { display: flex; flex-wrap: wrap; gap: var(--basalt-space-2); margin-block-start: var(--basalt-space-2); } + @media (prefers-reduced-motion: reduce) { .basalt-run-stage-detail, .basalt-run-stage-detail[data-open] { transition: none; } } + :root[data-loops="held"] :is(.basalt-run-stage-detail, .basalt-run-stage-detail[data-open]) { transition: none; } + + /* StageRail (1.5): the same stages on one line. A node is the mark in a space-6 row, the name (text-sm, centred, space-1 under the mark row) and one + status seat (text-xs, space-1 under the name): its time, or its word. */ + .basalt-run-rail { grid-template-columns: repeat(var(--_count), minmax(0, 1fr)); } + .basalt-run-rail > .basalt-run-stage { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; justify-items: center; text-align: center; } + .basalt-run-stage-markrow { position: relative; display: grid; place-items: center; inline-size: 100%; block-size: var(--basalt-space-6); } + .basalt-run-rail .basalt-run-stage-name { display: block; margin-block-start: var(--basalt-space-1); max-inline-size: 100%; overflow: hidden; text-overflow: ellipsis; } + .basalt-run-stage-status { display: grid; max-inline-size: 100%; margin-block-start: var(--basalt-space-1); overflow: hidden; font-size: var(--basalt-text-xs-size); line-height: var(--basalt-text-xs-line-height); } + .basalt-run-stage-status > .basalt-reserve { max-inline-size: 100%; grid-template-columns: minmax(0, auto); justify-items: center; } + .basalt-run-stage-status .basalt-run-stage-word { display: block; min-width: 0; max-inline-size: 100%; color: var(--basalt-text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + .basalt-run-rail .basalt-run-stage[data-state="failed"] .basalt-run-stage-word { color: var(--basalt-status-danger); font-weight: var(--basalt-font-weight-medium); } + .basalt-run-rail .basalt-run-stage[data-state="retrying"] .basalt-run-stage-word { color: var(--basalt-text-primary); } + /* A link: a horizontal 1px border-input track from space-2 past one mark to space-2 before the next, and a text-secondary fill that grows from the + inline start over duration-slower on ease-out when its stage passes, and empties at once if it runs again. It repeats the check before it. */ + .basalt-run-stage-link { position: absolute; inset-block-start: 50%; inset-inline-start: calc(50% + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-2)); inline-size: calc(100% - var(--basalt-size-icon-sm) - var(--basalt-space-4)); border-block-start: var(--basalt-size-hairline) solid var(--basalt-border-input); } + .basalt-run-stage:last-child .basalt-run-stage-link { display: none; } + .basalt-run-stage-fill { position: absolute; inset-inline: 0; inset-block-start: calc(-1 * var(--basalt-size-hairline)); border-block-start: var(--basalt-size-hairline) solid var(--basalt-text-secondary); transform: scaleX(0); transform-origin: left; } + .basalt-run-stage-fill:dir(rtl) { transform-origin: right; } + .basalt-run-stage-link[data-filled] .basalt-run-stage-fill { transform: scaleX(1); transition: transform var(--basalt-duration-slower) var(--basalt-ease-out); } + @media (prefers-reduced-motion: reduce) { .basalt-run-stage-link[data-filled] .basalt-run-stage-fill { transition: none; } } + :root[data-loops="held"] .basalt-run-stage-link[data-filled] .basalt-run-stage-fill { transition: none; } + /* Five or six stages need 480px of the rail's own width: under it the rail is drawn as the list, the same ol laid out as rows with the connector. */ + /* stylelint-disable-next-line basalt/container-length -- size-breakpoint-container (480px); a container query cannot read a custom property */ + @container (width < 480px) { + .basalt-run-rail:is([data-count="5"], [data-count="6"]) { grid-template-columns: minmax(0, 1fr); } + .basalt-run-rail:is([data-count="5"], [data-count="6"]) > .basalt-run-stage { grid-template-columns: var(--basalt-size-icon-sm) minmax(0, 1fr) auto; align-items: center; justify-items: stretch; column-gap: var(--basalt-space-3); padding-block: var(--basalt-space-2); text-align: start; } + .basalt-run-rail:is([data-count="5"], [data-count="6"]) .basalt-run-stage-markrow { inline-size: auto; block-size: auto; } + .basalt-run-rail:is([data-count="5"], [data-count="6"]) .basalt-run-stage-link { display: none; } + .basalt-run-rail:is([data-count="5"], [data-count="6"]) :is(.basalt-run-stage-name, .basalt-run-stage-status) { margin: 0; } + .basalt-run-rail:is([data-count="5"], [data-count="6"]) .basalt-run-stage-status > .basalt-reserve { justify-items: end; } + .basalt-run-rail:is([data-count="5"], [data-count="6"]) > .basalt-run-stage:not(:last-child)::after { + content: ""; + position: absolute; + inset-inline-start: round(down, calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline) / 2), var(--basalt-size-hairline)); + inset-block-start: calc(var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-1)); + inset-block-end: calc(-1 * (var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 - var(--basalt-size-icon-sm) / 2 - var(--basalt-space-1))); + border-inline-start: var(--basalt-size-hairline) solid var(--basalt-border-input); + } + } + @media (forced-colors: active) { + .basalt-run-stage-link { border-color: GrayText; } + .basalt-run-stage-fill { border-color: CanvasText; } + } + + /* Progress's value takes tabular figures and the room of "100%", end-aligned, so a run's bar never moves its value as it counts (DECISIONS 316, 1.5). */ + .basalt-progress > .basalt-progress-head > .basalt-progress-value { display: inline-grid; justify-items: end; } + .basalt-progress > .basalt-progress-head > .basalt-progress-value::before { content: "100%"; block-size: 0; overflow: hidden; visibility: hidden; } + + /* A prose page's column is size-prose-width on the row's start edge, never centred. */ .basalt-prose { box-sizing: border-box; max-inline-size: var(--basalt-size-prose-width); margin-inline: 0 auto; min-width: 0; } diff --git a/packages/react/test/bundle.test.mjs b/packages/react/test/bundle.test.mjs index 1bacd658..75cb2f82 100644 --- a/packages/react/test/bundle.test.mjs +++ b/packages/react/test/bundle.test.mjs @@ -674,11 +674,12 @@ test("the imports plugin never rewrites a file that resolves another copy of Bas // Stages and runs (DECISIONS 316): each new part has its own limit, the measured static graph rounded up to the next 50. StageMark carries Phosphor's five // circled marks (one file each, as Terminal imports its marks) and the ring; StageBadge, RunTimer, RunAnnouncer and formatRunTime load no Phosphor, and none // of them loads Base UI. -for (const [name, limit, phosphor] of [["StageMark", 14_350, true], ["StageBadge", 5_400, false], ["RunTimer", 5_200, false], ["RunAnnouncer", 600, false], ["formatRunTime", 750, false]]) { +for (const [name, limit, phosphor] of [["StageMark", 14_350, true], ["StageBadge", 5_400, false], ["RunTimer", 5_200, false], ["RunAnnouncer", 600, false], ["formatRunTime", 750, false], ["RunStage", 21_150, true], ["StageList, RunStage", 21_900, true], ["StageRail, RunStage", 21_850, true]]) { test(`${name} alone loads no Base UI${phosphor ? "" : " and no Phosphor"} (${limit} bytes at most)`, async () => { const { bytes, inputs } = await graph(name); assert.ok(bytes < limit, `${name} bundle is ${bytes} bytes (limit ${limit})`); assert.deepEqual(inputs.filter((f) => /@base-ui|cmdk|shiki/.test(f)), [], `${name} loads Base UI, cmdk or Shiki`); + assert.deepEqual(inputs.filter((f) => /run-timeline/.test(f)), [], `${name} pays for RunTimeline's counter`); const marks = inputs.filter((f) => /@phosphor-icons/.test(f)).map((f) => path.basename(f).replace(/\.es\.js$|\.mjs$|\.js$/, "")); if (phosphor) assert.deepEqual([...new Set(marks)].filter((m) => !/^(IconBase|context|SSRBase)$/.test(m)).sort(), ["CheckCircle", "Circle", "MinusCircle", "Prohibit", "XCircle"]); else assert.deepEqual(marks, []); diff --git a/packages/react/test/demo-runs.tsx b/packages/react/test/demo-runs.tsx index 1dbb5261..e7e24710 100644 --- a/packages/react/test/demo-runs.tsx +++ b/packages/react/test/demo-runs.tsx @@ -1,7 +1,7 @@ // The stages and runs (DECISIONS 316) on the demo page, for the browser tests' axe pass in both themes. Synthetic data only. import * as React from "react"; -import { RunAnnouncer, RunTimer, StageBadge, StageMark } from "../src/index"; +import { Button, RunAnnouncer, RunStage, RunTimer, StageBadge, StageList, StageMark, StageRail } from "../src/index"; import type { StageState } from "../src/index"; const STATES: StageState[] = ["queued", "running", "success", "failed", "skipped", "canceled", "retrying"]; @@ -20,6 +20,18 @@ export function RunsFixture() { ))} + + +

    3 tests failed in session.test.ts

    Exit 1 · attempt 1 of 2} + action={} /> + +
    + + + + +

    Build took

    diff --git a/packages/react/test/export-sizes.json b/packages/react/test/export-sizes.json index 405d34ba..f721554d 100644 --- a/packages/react/test/export-sizes.json +++ b/packages/react/test/export-sizes.json @@ -70,7 +70,7 @@ "CopyGlyph": 2884, "Countdown": 3016, "CoverageStrip": 1570, - "DataFlowDiagram": 67597, + "DataFlowDiagram": 67599, "DateAge": 2527, "DescriptionColumns": 216, "DescriptionItem": 593, @@ -105,7 +105,7 @@ "Fieldset": 6390, "FilterResult": 698, "FilterToolbar": 774, - "FlowchartDiagram": 67546, + "FlowchartDiagram": 67548, "Form": 8730, "FormGrid": 438, "FormGridItem": 628, @@ -222,12 +222,13 @@ "Reveal": 19500, "RoutesGlyph": 3009, "RunAnnouncer": 448, + "RunStage": 20984, "RunTimer": 5050, "RunsGlyph": 3128, "STAGE_WORDS": 149, "STATUS_MESSAGE_MS": 26, "SandboxesGlyph": 2963, - "SchemaDiagram": 67494, + "SchemaDiagram": 67496, "SearchDialog": 88277, "SearchField": 18301, "SearchGlyph": 3181, @@ -246,7 +247,7 @@ "SelectableList": 821, "SelectionBar": 25913, "Separator": 4531, - "SequenceDiagram": 67542, + "SequenceDiagram": 67544, "SettingsGlyph": 3100, "ShareBar": 1411, "Sheet": 70793, @@ -284,7 +285,9 @@ "Spinner": 1509, "Stage": 1219, "StageBadge": 5045, + "StageList": 1262, "StageMark": 14188, + "StageRail": 1200, "Stat": 2226, "Stats": 314, "StatusBar": 6813, @@ -418,11 +421,11 @@ "useWaitMark": 303 }, "package": { - "bytes": 879732, - "gzip": 291984 + "bytes": 883747, + "gzip": 293069 }, "styles": { - "bytes": 386222, - "gzip": 50471 + "bytes": 395212, + "gzip": 51536 } } diff --git a/packages/react/test/stage-list.test.mjs b/packages/react/test/stage-list.test.mjs new file mode 100644 index 00000000..e2e3161e --- /dev/null +++ b/packages/react/test/stage-list.test.mjs @@ -0,0 +1,320 @@ +// StageList and RunStage (DECISIONS 316, 1.3 and 1.4): the words drawn and said for each state, the row and its seats, the meta by the list's own +// container, the still connector beside an open detail, the detail's clocks and inert, a failure moving only the rows under it (Chromium at 1440, 390 +// and 360, WebKit at 390, touch too), Retry busy and sent once, focus never dropped, right-to-left, forced colours, axe, and the art's Stage beside it. +// Built package, real stylesheet. +import assert from "node:assert/strict"; +import fs from "node:fs"; +import { createRequire } from "node:module"; +import path from "node:path"; +import { after, before, describe, test } from "node:test"; + +import { webkit } from "playwright"; + +import { fixturePage, freezeAnimations, launch, pkg, settle } from "./support.mjs"; + +const axeSource = fs.readFileSync(createRequire(import.meta.url).resolve("axe-core/axe.min.js"), "utf8"); +let browser; +let safari; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); await safari?.close(); }); + +const STATES = ["queued", "running", "success", "failed", "skipped", "canceled", "retrying"]; +const DRAWN = { queued: "Queued", running: "Running", failed: "Failed", skipped: "Skipped", canceled: "Canceled", retrying: "Retrying" }; + +const ALL = (dir = "ltr") => ` +const STATES = ${JSON.stringify(STATES)}; +createRoot(document.getElementById("root")).render( +
    + + {STATES.map((s) => )} + +
    );`; + +// A deploy whose Test stage fails, opens its reason and Retry, and passes on a retry. The app owns every change; Retry's promise is the app's. +const DEPLOY = (width = 640) => ` +function App() { + const [test, setTest] = React.useState("running"); + const [sends, setSends] = React.useState(0); + const resolver = React.useRef(null); + React.useEffect(() => { + window.fail = () => setTest("failed"); + window.retried = () => { setTest("retrying"); resolver.current?.(); }; + window.reason = (lines) => setReason(lines); + }, []); + const [reason, setReason] = React.useState(1); + const retry = () => { setSends((n) => n + 1); return new Promise((resolve) => { resolver.current = resolve; }); }; + const failed = test === "failed"; + return
    +
    + + + + {Array.from({ length: reason }, (_, i) =>

    3 tests failed in session.test.ts

    )}Exit 1 · attempt 1 of 2 : undefined} + action={failed ? Retry : undefined} /> + + +
    +
    +

    After the list

    + {sends} +
    ; +} +createRoot(document.getElementById("root")).render();`; + +const open = async (body, { b = browser, width = 1024, height = 900, ...options } = {}) => { + const { page, errors } = await fixturePage(b, body, { theme: "dark", standards: true, viewport: { width, height }, ...options }); + await settle(page); + page.errors = errors; + return page; +}; +const box = (page, sel) => page.evaluate((s) => { const r = document.querySelector(s).getBoundingClientRect(); return { x: r.x, y: r.y, w: r.width, h: r.height }; }, sel); + +describe("words and rows", () => { + test("every state's word is drawn but passed, which is said; each row's accessible text is the name then the word, once", async () => { + const page = await open(ALL()); + const r = await page.evaluate(() => [...document.querySelectorAll(".basalt-run-stage")].map((li) => ({ + state: li.dataset.state, + drawn: li.querySelector(".basalt-run-stage-word")?.textContent ?? null, + hidden: li.querySelector(".basalt-run-stage-name .basalt-visually-hidden")?.textContent ?? null, + markHidden: li.querySelector(".basalt-run-mark").getAttribute("aria-hidden"), + }))); + for (const row of r) { + if (row.state === "success") assert.deepEqual([row.drawn, row.hidden], [null, "Passed"], "passed is said and not drawn"); + else assert.deepEqual([row.drawn, row.hidden], [DRAWN[row.state], null], `${row.state} is drawn`); + assert.equal(row.markHidden, "true"); + } + const tree = await page.locator(".basalt-run-stages").ariaSnapshot(); + assert.match(tree, /listitem:\s*- text: Stage failed Failed fact/); + assert.match(tree, /listitem:\s*- text: Stage success Passed fact/); + }); + + test("a row is 34px; the mark's seat, the name's line and the time's seat are one size in every state", async () => { + const page = await open(ALL()); + const r = await page.evaluate(() => [...document.querySelectorAll(".basalt-run-stage-line")].map((line) => { + const b = (s) => { const x = line.querySelector(s).getBoundingClientRect(); return [x.width, x.height]; }; + return { h: line.getBoundingClientRect().height, mark: b(".basalt-run-mark"), time: b(".basalt-run-timer"), timeEnd: line.querySelector(".basalt-run-timer").getBoundingClientRect().right }; + })); + for (const row of r) { + assert.equal(row.h, 34); + assert.deepEqual(row.mark, [16, 16]); + assert.deepEqual(row.time, r[0].time); + assert.equal(row.timeEnd, r[0].timeEnd); + } + }); + + test("the meta hides under 480px of the list's own width, not the viewport's", async () => { + const body = `createRoot(document.getElementById("root")).render(
    +
    +
    +
    );`; + const page = await open(body, { width: 1440 }); + const shown = await page.evaluate(() => ["#narrow", "#wide"].map((s) => getComputedStyle(document.querySelector(`${s} .basalt-run-stage-meta`)).display)); + assert.equal(shown[0], "none"); + assert.notEqual(shown[1], "none"); + const timeEnds = await page.evaluate(() => ["#narrow", "#wide"].map((s) => document.querySelector(`${s} .basalt-run-stage-line`).getBoundingClientRect().right - document.querySelector(`${s} .basalt-run-timer`).getBoundingClientRect().right)); + assert.deepEqual(timeEnds, [0, 0], "the time ends on the row's edge with or without the meta"); + }); +}); + +describe("the connector", () => { + test("one still line between every two marks, the same in every state, beside an open detail too; none after the last", async () => { + const page = await open(DEPLOY()); + await page.evaluate(() => window.fail()); + await settle(page); + const r = await page.evaluate(() => [...document.querySelectorAll(".basalt-run-stages > .basalt-run-stage")].map((li) => { + const a = getComputedStyle(li, "::after"); + const mark = li.querySelector(".basalt-run-mark").getBoundingClientRect(); + const next = li.nextElementSibling?.querySelector(".basalt-run-mark").getBoundingClientRect(); + const top = li.getBoundingClientRect().top + parseFloat(a.top); + const bottom = li.getBoundingClientRect().bottom - parseFloat(a.bottom); + return { content: a.content, color: a.borderInlineStartColor, width: a.borderInlineStartWidth, gapAbove: next ? top - mark.bottom : null, gapBelow: next ? next.top - bottom : null, transition: a.transitionProperty, animation: a.animationName }; + })); + const lines = r.slice(0, -1); + assert.equal(r.at(-1).content, "none", "no connector after the last stage"); + for (const line of lines) { + assert.equal(line.color, lines[0].color); + assert.equal(line.width, "1px"); + assert.equal(line.gapAbove, 4, "space-1 under the mark"); + assert.equal(line.gapBelow, 4, "space-1 above the next"); + assert.equal(line.animation, "none"); + } + const input = await page.evaluate(() => { const p = document.createElement("span"); p.style.color = "var(--basalt-border-input)"; document.body.append(p); return getComputedStyle(p).color; }); + assert.equal(lines[0].color, input, "border-input"); + // The failed stage's line runs beside its open detail, unbroken. + const failed = await page.evaluate(() => { const li = [...document.querySelectorAll(".basalt-run-stage")][2]; const d = li.querySelector(".basalt-run-stage-detail").getBoundingClientRect(); const a = getComputedStyle(li, "::after"); return { lineBottom: li.getBoundingClientRect().bottom - parseFloat(a.bottom), detailBottom: d.bottom, content: a.content }; }); + assert.notEqual(failed.content, "none"); + assert.ok(failed.lineBottom > failed.detailBottom, "the line runs past the detail to the next mark"); + }); +}); + +describe("the detail", () => { + test("opens over duration-slow on ease-out and closes at 0.75 on ease-in, inert while closed; code is the row's size", async () => { + const page = await open(DEPLOY()); + const detail = () => page.evaluate(() => { const d = document.querySelector(".basalt-run-stage-detail"); if (!d) return null; const s = getComputedStyle(d); return { inert: d.inert, duration: s.transitionDuration, easing: s.transitionTimingFunction, h: d.getBoundingClientRect().height }; }); + assert.equal(await detail(), null, "nothing until a stage has a detail"); + await page.evaluate(() => window.fail()); + const opened = await detail(); + assert.equal(opened.inert, false); + assert.match(opened.duration, /^0\.2s/); + assert.match(opened.easing, /cubic-bezier\(0\.16, 1, 0\.3, 1\)/); + await settle(page); + assert.equal((await detail()).h, 82, "the standard form: 18 + 16 + space-2 + 28 + space-3"); + const code = await page.evaluate(() => [getComputedStyle(document.querySelector(".basalt-run-stage-detail code")).fontSize, getComputedStyle(document.querySelector(".basalt-run-stage-detail p")).fontSize]); + assert.equal(code[0], code[1], "code at 1em of its row, never a ratio"); + await page.evaluate(() => window.retried()); + const closing = await detail(); + assert.equal(closing.inert, true); + assert.match(closing.duration, /^0\.15s/); + assert.match(closing.easing, /cubic-bezier\(0\.4, 0, 1, 1\)/); + }); + + for (const [label, launcher, width, touch] of [ + ["Chromium at 1440", () => browser, 1440, false], ["Chromium at 390", () => browser, 390, false], ["Chromium at 360", () => browser, 360, false], + ["Chromium at 390 on touch", () => browser, 390, true], ["WebKit at 390", async () => (safari ??= await webkit.launch()), 390, false], + ]) { + test(`a failure moves only the rows under it, and the sibling after the list 0px, through the whole run (${label})`, async () => { + const b = await launcher(); + const page = await open(DEPLOY(width - 48), { b, width, ...(touch ? { hasTouch: true, isMobile: true } : {}) }); + const watch = () => page.evaluate(() => ({ after: document.querySelector("#after").getBoundingClientRect().top, list: document.querySelector(".basalt-run-stages").getBoundingClientRect().height, rows: [...document.querySelectorAll(".basalt-run-stage-line")].map((l) => l.getBoundingClientRect().top) })); + const start = await watch(); + await page.evaluate(() => window.fail()); + await settle(page); + const failed = await watch(); + assert.equal(failed.after, start.after, "the sibling after the list did not move"); + assert.deepEqual(failed.rows.slice(0, 3), start.rows.slice(0, 3), "rows above and the failed row stay"); + assert.ok(failed.rows[3] > start.rows[3], "the rows under it make room"); + await page.evaluate(() => window.retried()); + await settle(page); + const back = await watch(); + assert.equal(back.after, start.after); + assert.deepEqual(back.rows, start.rows, "closing gives the room back"); + }); + } + + test("a reason longer than the room grows the list by its extra line, once", async () => { + const page = await open(DEPLOY()); + const after = () => page.evaluate(() => document.querySelector("#after").getBoundingClientRect().top); + const start = await after(); + await page.evaluate(() => { window.reason(2); window.fail(); }); + await settle(page); + assert.equal(await after(), start + 18, "one extra reason line: 18px, once"); + }); +}); + +describe("Retry and focus", () => { + test("Retry is busy until the app's promise settles, and a second press sends nothing", async () => { + const page = await open(DEPLOY()); + await page.evaluate(() => window.fail()); + await settle(page); + const retry = page.getByRole("button", { name: "Retry" }); + await retry.click(); + assert.equal(await retry.getAttribute("aria-busy"), "true"); + await retry.click({ force: true }); + await page.keyboard.press("Enter"); + assert.equal(await page.locator("#sends").textContent(), "1"); + }); + + for (const how of ["a press", "a keyboard press", "an outside resolve"]) { + test(`focus goes to the stage's name after ${how}, never to the body`, async () => { + const page = await open(DEPLOY()); + await page.evaluate(() => window.fail()); + await settle(page); + const retry = page.getByRole("button", { name: "Retry" }); + if (how === "a press") await retry.click(); + else if (how === "a keyboard press") { await retry.focus(); await page.keyboard.press("Enter"); } + else await retry.focus(); + await page.evaluate(() => window.retried()); + await settle(page); + const focused = await page.evaluate(() => ({ tag: document.activeElement.tagName, cls: document.activeElement.className, text: document.activeElement.textContent })); + assert.equal(focused.cls, "basalt-run-stage-name"); + assert.match(focused.text, /^Test/); + }); + } + + test("the name shows the control ring at +2 when focused from the keyboard", async () => { + const page = await open(DEPLOY()); + await page.evaluate(() => window.fail()); + await settle(page); + await page.getByRole("button", { name: "Retry" }).focus(); + await page.keyboard.press("Enter"); + await page.evaluate(() => window.retried()); + await settle(page); + const ring = await page.evaluate(() => { const s = getComputedStyle(document.activeElement); return [s.outlineStyle, s.outlineWidth, s.outlineOffset]; }); + assert.deepEqual(ring, ["solid", "2px", "2px"]); + }); +}); + +describe("modes and the page", () => { + test("right-to-left: the mark leads on the right and the time ends on the left edge", async () => { + const page = await open(ALL("rtl")); + const r = await page.evaluate(() => { const line = document.querySelector(".basalt-run-stage-line").getBoundingClientRect(); return { mark: document.querySelector(".basalt-run-mark").getBoundingClientRect().right - line.right, time: document.querySelector(".basalt-run-timer").getBoundingClientRect().left - line.left }; }); + assert.deepEqual(r, { mark: 0, time: 0 }); + }); + + test("forced colours: the connector is a real border, the marks follow their row, and the failed word keeps its words", async () => { + const page = await open(DEPLOY(), { forcedColors: "active" }); + await page.evaluate(() => window.fail()); + await settle(page); + const r = await page.evaluate(() => { const li = document.querySelector(".basalt-run-stage"); const a = getComputedStyle(li, "::after"); return { style: a.borderInlineStartStyle, width: a.borderInlineStartWidth, word: document.querySelectorAll(".basalt-run-stage-word")[0].textContent }; }); + assert.deepEqual(r, { style: "solid", width: "1px", word: "Failed" }); + }); + + for (const theme of ["light", "dark"]) { + test(`axe: no WCAG 2.2 AA violations, mid-failure (${theme})`, async () => { + const page = await open(DEPLOY(), { theme }); + await page.evaluate(() => window.fail()); + await settle(page); + await page.evaluate(() => { document.title = "Basalt"; document.documentElement.lang = "en"; }); + await page.addScriptTag({ content: axeSource }); + const v = await page.evaluate(async () => (await globalThis.axe.run(document, { runOnly: { type: "tag", values: ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"] } })).violations.map((x) => `${x.id}: ${x.nodes.map((n) => n.target.join(" ")).join(" | ")}`)); + assert.deepEqual(v, []); + }); + } + + test("the two stages on one page: an art Stage holding a StageList keeps its box, the rows keep their own margin, padding and ground, and a StageList alone never clears the header", async () => { + const body = `createRoot(document.getElementById("root")).render(
    + } id="art">
    + } id="bare" /> +
    +
    );`; + const page = await open(body, { width: 1024 }); + const r = await page.evaluate(() => { + const li = document.querySelector("#inside .basalt-run-stage"); + const s = getComputedStyle(li); + const alone = getComputedStyle(document.querySelector("#alone .basalt-run-stage")); + return { + same: ["marginTop", "marginBottom", "paddingTop", "paddingBottom", "backgroundColor"].every((k) => s[k] === alone[k]), + rowGround: s.backgroundColor, + aloneMarginTop: getComputedStyle(document.querySelector("#alone .basalt-run-stages-box")).marginTop, + aloneHeadroom: !!document.querySelector("#alone [data-headroom], #alone .basalt-stage, #alone [data-basalt-headroom]"), + artPadding: [getComputedStyle(document.querySelector("#art")).paddingTop, getComputedStyle(document.querySelector("#bare")).paddingTop], + }; + }); + assert.ok(r.same, "a row's margin, padding and ground are its own inside the art"); + assert.equal(r.rowGround, "rgba(0, 0, 0, 0)"); + assert.equal(r.aloneMarginTop, "0px", "no pull-up"); + assert.equal(r.aloneHeadroom, false, "no headroom"); + assert.equal(r.artPadding[0], r.artPadding[1], "the art's box is unchanged by what it holds"); + }); + + test("no class in the run rules begins basalt-stage, and a child that is not a RunStage warns (development)", async () => { + const css = fs.readFileSync(path.join(pkg, "src", "styles", "components.css"), "utf8"); + const block = css.slice(css.indexOf("/* ---- Stages and runs (DECISIONS 316)"), css.indexOf("/* A prose page's column")); + assert.ok(block.length > 1000); + assert.deepEqual([...block.matchAll(/\.basalt-stage[\w-]*/g)].map((m) => m[0]), []); + const React = await import("react"); + const { renderToString } = await import("react-dom/server"); + const { StageList } = await import(path.join(pkg, "dist", "stage-list.js")); + const { RunStage } = await import(path.join(pkg, "dist", "run-stage.js")); + const warn = console.warn; + const said = []; + console.warn = (m) => said.push(String(m)); + try { + renderToString(React.createElement(StageList, { label: "Fine" }, React.createElement(RunStage, { name: "A", state: "queued" }))); + renderToString(React.createElement(StageList, { label: "Not fine" }, React.createElement("li", null, "A"))); + } finally { console.warn = warn; } + assert.equal(said.length, 1); + assert.match(said[0], /^Basalt StageList: a child is not a RunStage/); + }); +}); diff --git a/packages/react/test/stage-rail.test.mjs b/packages/react/test/stage-rail.test.mjs new file mode 100644 index 00000000..e808ac1b --- /dev/null +++ b/packages/react/test/stage-rail.test.mjs @@ -0,0 +1,182 @@ +// StageRail (DECISIONS 316, 1.5): the status seat's word or time for each state in one width; the link's fill, its clock and its logical origin, +// empty again on a retry and after a failure; each node's state with the fill taken away; no bead; five and six stages as the list under 480px of +// the rail's own width and as a rail above; the hour scale refused; 0px through a whole run. Chromium, built package, real stylesheet. +import assert from "node:assert/strict"; +import path from "node:path"; +import { after, before, describe, test } from "node:test"; + +import { fixturePage, freezeAnimations, launch, pkg, settle } from "./support.mjs"; + +let browser; +before(async () => { browser = await launch(); }); +after(async () => { await browser?.close(); }); + +const RUN = (width, dir = "ltr") => ` +const NAMES = ["Build", "Checks", "Deploy", "Promote"]; +function App() { + const [states, setStates] = React.useState(["queued", "queued", "queued", "queued"]); + const [t0] = React.useState(() => Date.now() - 500); + React.useEffect(() => { window.set = (i, s) => setStates((all) => all.map((x, j) => (j === i ? s : x))); }, []); + return
    + + {NAMES.map((n, i) => )} + +

    After the rail

    +
    ; +} +createRoot(document.getElementById("root")).render();`; + +const open = async (body, { width = 1024, ...options } = {}) => { + const { page, errors } = await fixturePage(browser, body, { theme: "dark", standards: true, viewport: { width, height: 700 }, ...options }); + await settle(page); + page.errors = errors; + return page; +}; +const seats = (page) => page.evaluate(() => [...document.querySelectorAll(".basalt-run-stage")].map((li) => { + const seat = li.querySelector(".basalt-run-stage-status"); + const shown = seat.querySelector(":scope > .basalt-reserve > [data-on]"); + return { state: li.dataset.state, shown: (shown.querySelector("[data-on]") ?? shown).textContent, word: !!shown.querySelector(".basalt-run-stage-word") || shown.classList.contains("basalt-run-stage-word"), w: seat.getBoundingClientRect().width, h: seat.getBoundingClientRect().height, color: getComputedStyle(shown.firstElementChild ?? shown).color, weight: getComputedStyle(shown.firstElementChild ?? shown).fontWeight, said: li.querySelector(".basalt-run-stage-name").textContent }; +})); + +describe("the status seat", () => { + test("a running or passed node's time, a failed, skipped, canceled or retrying node's word, in one seat that never changes size", async () => { + const page = await open(RUN(800)); + const before = await seats(page); + for (const [i, s] of [[0, "success"], [1, "failed"], [2, "skipped"], [3, "canceled"]]) await page.evaluate(([i, s]) => window.set(i, s), [i, s]); + await settle(page); + let r = await seats(page); + assert.deepEqual(r.map((x) => [x.state, x.shown, x.word]), [["success", "2.1 s", false], ["failed", "Failed", true], ["skipped", "Skipped", true], ["canceled", "Canceled", true]]); + for (let i = 0; i < 4; i += 1) assert.deepEqual([r[i].w, r[i].h], [before[i].w, before[i].h], `node ${i}'s seat holds`); + assert.equal(r[1].weight, "500"); + for (const [i, s] of [[1, "retrying"], [2, "running"], [3, "queued"]]) await page.evaluate(([i, s]) => window.set(i, s), [i, s]); + await settle(page); + r = await seats(page); + assert.equal(r[1].shown, "Retrying"); + assert.match(r[2].shown, /^\d+\.\d s$/); + assert.equal(r[3].shown, " ", "a queued node holds its seat empty"); + assert.deepEqual(r.map((x) => x.said), ["Build Passed", "Checks", "Deploy Running", "Promote Queued"], "queued, running and passed are said after the name; a drawn word is not said twice"); + }); +}); + +describe("the link", () => { + test("fills from the inline start over duration-slower on ease-out when its stage passes; empty again at once on a retry; a failed stage's stays empty", async () => { + const page = await open(RUN(800)); + const fill = (i) => page.evaluate((i) => { const f = document.querySelectorAll(".basalt-run-stage-fill")[i]; const s = getComputedStyle(f); return { transform: s.transform, origin: s.transformOrigin, duration: s.transitionDuration, easing: s.transitionTimingFunction }; }, i); + await page.evaluate(() => window.set(0, "success")); + const filling = await fill(0); + assert.equal(filling.duration, "0.3s"); + assert.match(filling.easing, /cubic-bezier\(0\.16, 1, 0\.3, 1\)/); + assert.match(filling.origin, /^0px /, "from the start edge (left, in left-to-right)"); + await settle(page); + assert.equal((await fill(0)).transform, "matrix(1, 0, 0, 1, 0, 0)"); + await page.evaluate(() => window.set(0, "retrying")); + const emptied = await fill(0); + assert.equal(emptied.duration, "0s", "empties at once"); + assert.match(emptied.transform, /^matrix\(0, /); + await page.evaluate(() => window.set(1, "failed")); + await settle(page); + assert.match((await fill(1)).transform, /^matrix\(0, /, "a failed stage's link stays empty"); + }); + + test("right-to-left: the fill grows from the right", async () => { + const page = await open(RUN(800, "rtl")); + const origin = await page.evaluate(() => getComputedStyle(document.querySelector(".basalt-run-stage-fill")).transformOrigin); + const width = await page.evaluate(() => document.querySelector(".basalt-run-stage-fill").offsetWidth); + assert.equal(origin.split(" ")[0], `${width}px`); + }); + + test("each node's state is in the accessibility tree and drawn with the fill taken away: the fill is never the only sign", async () => { + const page = await open(RUN(800)); + await page.evaluate(() => { window.set(0, "success"); window.set(1, "failed"); }); + await settle(page); + await page.addStyleTag({ content: ".basalt-run-stage-fill { display: none !important; }" }); + const tree = await page.locator(".basalt-run-rail").ariaSnapshot(); + for (const words of ["Build Passed", "Checks Failed", "Deploy Queued", "Promote Queued"]) assert.ok(tree.replace(/\s+/g, " ").includes(words), `${words}: ${tree}`); + const marks = await page.evaluate(() => [...document.querySelectorAll(".basalt-run-mark")].map((m) => m.dataset.state)); + assert.deepEqual(marks, ["success", "failed", "queued", "queued"]); + }); + + test("no bead: the running ring is the rail's only moving thing", async () => { + const page = await open(RUN(800)); + await page.evaluate(() => window.set(1, "running")); + await settle(page); + const moving = await page.evaluate(() => document.querySelector(".basalt-run-rail").getAnimations({ subtree: true }).filter((a) => a.effect.getComputedTiming().iterations === Infinity).map((a) => a.effect.target.closest(".basalt-spinner") ? "ring" : a.animationName)); + // The queued marks breathe (their own loop, not the rail's motion); the running ring is the only mark of motion along the rail. + assert.deepEqual([...new Set(moving)].sort(), ["basalt-run-breath", "ring"]); + assert.equal(await page.locator("[class*=bead]").count(), 0); + }); +}); + +describe("five and six stages", () => { + const SIX = (n, width) => `createRoot(document.getElementById("root")).render(
    + {["Clone", "Install", "Build", "Test", "Deploy", "Promote"].slice(0, ${n}).map((s, i) => )}
    );`; + for (const n of [5, 6]) { + test(`${n} stages: the list under 480px of the rail's own width, a rail from it`, async () => { + const narrow = await open(SIX(n, 470), { width: 1440 }); + const nr = await narrow.evaluate(() => { const li = [...document.querySelectorAll(".basalt-run-stage")]; return { tops: li.map((x) => x.getBoundingClientRect().top), link: getComputedStyle(document.querySelector(".basalt-run-stage-link")).display, after: getComputedStyle(li[0], "::after").content }; }); + assert.ok(nr.tops.every((t, i) => i === 0 || t > nr.tops[i - 1]), "rows, top to bottom"); + assert.equal(nr.link, "none"); + assert.notEqual(nr.after, "none", "with the list's connector"); + const wide = await open(SIX(n, 480), { width: 390 }); + const wr = await wide.evaluate(() => [...document.querySelectorAll(".basalt-run-stage")].map((x) => x.getBoundingClientRect().top)); + assert.ok(wr.every((t) => t === wr[0]), "one line from 480 of its own width, whatever the viewport"); + }); + } + + test("two to four stages are a rail at any width from 320", async () => { + const page = await open(RUN(320), { width: 360 }); + const tops = await page.evaluate(() => [...document.querySelectorAll(".basalt-run-stage")].map((x) => x.getBoundingClientRect().top)); + assert.ok(tops.every((t) => t === tops[0])); + }); +}); + +test("the hour scale is refused: it warns and the seats hold minutes (development)", async () => { + const React = await import("react"); + const { renderToString } = await import("react-dom/server"); + const { StageRail } = await import(path.join(pkg, "dist", "stage-rail.js")); + const { RunStage } = await import(path.join(pkg, "dist", "run-stage.js")); + const warn = console.warn; + const said = []; + console.warn = (m) => said.push(String(m)); + let html; + try { + html = renderToString(React.createElement(StageRail, { label: "Long", timeScale: "hours" }, React.createElement(RunStage, { name: "A", state: "success", start: 0, end: 9e6 }), React.createElement(RunStage, { name: "B", state: "queued" }))); + } finally { console.warn = warn; } + assert.ok(said.some((m) => /a rail takes "seconds" or "minutes"/.test(m))); + assert.ok(html.includes("00 min 00 s") && !html.includes("00 hr 00 min"), "the seat is the minutes form"); +}); + +test("0px through a whole run: the rail's nodes, seats and the sibling after it never move", async () => { + const page = await open(RUN(800)); + const watch = () => page.evaluate(() => ({ after: document.querySelector("#after").getBoundingClientRect().top, nodes: [...document.querySelectorAll(".basalt-run-stage :is(.basalt-run-mark, .basalt-run-stage-name, .basalt-run-stage-status)")].map((e) => { const r = e.getBoundingClientRect(); return [r.x, r.y, r.width, r.height]; }) })); + const start = await watch(); + const clock = await freezeAnimations(page); + for (const [i, s] of [[0, "running"], [0, "success"], [1, "running"], [1, "failed"], [1, "retrying"], [1, "success"], [2, "running"], [2, "success"], [3, "running"], [3, "success"]]) { + await page.evaluate(([i, s]) => window.set(i, s), [i, s]); + for (let t = 0; t <= 300; t += 50) { + await clock.advance(50); + const now = await watch(); + assert.equal(now.after, start.after, `the sibling, ${s} at ${i}, ${t}ms`); + now.nodes.forEach((n, k) => assert.deepEqual(n, start.nodes[k], `box ${k}, ${s} at ${i}, ${t}ms`)); + } + } + await clock.thaw(); +}); + +test("Progress's value takes tabular figures and the room of \"100%\", end-aligned: 0%, 25% and 100% stand in one box", async () => { + const body = `function App() { const [v, setV] = React.useState(0); React.useEffect(() => { window.v = setV; }, []); return
    ; } + createRoot(document.getElementById("root")).render();`; + const page = await open(body); + const read = () => page.evaluate(() => { const el = document.querySelector(".basalt-progress-value"); const b = el.getBoundingClientRect(); const range = document.createRange(); range.selectNodeContents(el); return { box: [b.x, b.width], end: range.getBoundingClientRect().right, label: document.querySelector(".basalt-progress-label").getBoundingClientRect().width, nums: getComputedStyle(el).fontVariantNumeric }; }); + const zero = await read(); + for (const v of [1, 4]) { + await page.evaluate((v) => window.v(v), v); + await settle(page); + const now = await read(); + assert.deepEqual(now.box, zero.box, `${v}: the value's box`); + assert.ok(Math.abs(now.end - zero.end) < 0.5, "end-aligned"); + } + assert.equal(zero.nums, "tabular-nums"); + const tree = await page.locator(".basalt-progress").ariaSnapshot(); + assert.ok(!tree.includes("100%"), "the room is unseen and unsaid"); +}); From 6ab29f72d6d14912aa061f83dbf7afb9d968bfc8 Mon Sep 17 00:00:00 2001 From: bailey <74082460+bmjcoding@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:03:51 -0600 Subject: [PATCH 03/13] Stages batch 3 (DECISIONS 316): Terminal's stage lines, the declared stage transcript and no scrollbar on a live window `stages` is declared at mount and the window is never a log (a stray stage line makes it silent, and warns); stage lines draw braille, the core check, XCircle, the core minus and Prohibit in the gutter, the word first for skipped and canceled, and a duration column at the line's end; `keep` steps older lines back once to tertiary; `time` puts the run's time in the head. Every live Terminal draws no scrollbar on either axis. Terminal grows from 32,267 to 40,562 bytes (28,655 to 35,865 with the plugin): RunTimer, the Prohibit mark and the core minus. Reported for the decider. Not reviewed: the implementation is unreviewed. Co-Authored-By: Claude Opus 5.5 --- packages/react/src/code-lines.tsx | 6 +- packages/react/src/styles/components.css | 32 +++ packages/react/src/terminal.tsx | 83 +++++- packages/react/test/bundle.test.mjs | 3 +- packages/react/test/export-sizes.json | 12 +- packages/react/test/icons.test.mjs | 10 +- packages/react/test/stage-transcript.test.mjs | 268 ++++++++++++++++++ 7 files changed, 398 insertions(+), 16 deletions(-) create mode 100644 packages/react/test/stage-transcript.test.mjs diff --git a/packages/react/src/code-lines.tsx b/packages/react/src/code-lines.tsx index f32c5e88..07aaed13 100644 --- a/packages/react/src/code-lines.tsx +++ b/packages/react/src/code-lines.tsx @@ -96,6 +96,8 @@ export interface CodeLineProps { /** What sits in the gutter: a prompt, a status mark, or nothing (an empty seat). */ gutter?: React.ReactNode; kind?: string; + /** In a stage transcript given `keep`, a line older than the newest stages: it steps back once, to tertiary ink. */ + receded?: boolean; children?: React.ReactNode; } @@ -104,9 +106,9 @@ export interface CodeLineProps { * `user-select: none`, so a selection never takes it, and what is in it that is only a symbol (a prompt) is `aria-hidden`. * `CodeBlock` with a prompt and `Terminal` draw their lines with this one. */ -export function CodeLine({ gutter, kind, children }: CodeLineProps) { +export function CodeLine({ gutter, kind, receded, children }: CodeLineProps) { return ( - + {gutter} {children} diff --git a/packages/react/src/styles/components.css b/packages/react/src/styles/components.css index a00fb31d..816184ac 100644 --- a/packages/react/src/styles/components.css +++ b/packages/react/src/styles/components.css @@ -4459,6 +4459,38 @@ .basalt-progress > .basalt-progress-head > .basalt-progress-value { display: inline-grid; justify-items: end; } .basalt-progress > .basalt-progress-head > .basalt-progress-value::before { content: "100%"; block-size: 0; overflow: hidden; visibility: hidden; } + /* Terminal's stage lines (1.7). The gutter: braille while running (in the 16px seat, centred), the core check in secondary when done, XCircle in + danger when failed (the error line: its text in danger too), the core minus and Prohibit in tertiary when skipped or canceled. Running text is + primary, done secondary, skipped and canceled tertiary with their word first. The duration stands at the line's end in tertiary, tabular: lines + are as wide as the log, so the durations are one column and a long line arriving moves none of them. */ + .basalt-terminal .basalt-code-line[data-kind="stage"] .basalt-code-gutter { display: flex; align-items: center; } + .basalt-terminal-braille { display: inline-flex; inline-size: var(--basalt-size-icon-sm); justify-content: center; } + .basalt-terminal .basalt-code-line[data-kind="stage"] { color: var(--basalt-text-primary); } + .basalt-terminal .basalt-code-line[data-kind="stage"][data-state="done"] { color: var(--basalt-text-secondary); } + .basalt-terminal .basalt-code-line[data-kind="stage"]:is([data-state="skipped"], [data-state="canceled"]) { color: var(--basalt-text-tertiary); } + .basalt-terminal .basalt-code-line[data-kind="stage"][data-state="done"] .basalt-terminal-mark { color: var(--basalt-text-secondary); } + .basalt-terminal .basalt-code-line[data-kind="stage"]:is([data-state="skipped"], [data-state="canceled"]) .basalt-terminal-mark { color: var(--basalt-text-tertiary); } + .basalt-terminal .basalt-code-line[data-kind="stage"][data-state="failed"] :is(.basalt-terminal-mark, .basalt-code-text) { color: var(--basalt-status-danger); } + .basalt-terminal-stage { display: flex; justify-content: space-between; gap: var(--basalt-space-4); } + .basalt-code-pre[data-stages] > .basalt-code-lines { width: 100%; } + .basalt-terminal-duration { flex: none; } + .basalt-terminal-duration .basalt-run-timer { font: inherit; color: var(--basalt-text-tertiary); } + .basalt-terminal-time { display: inline-flex; } + .basalt-terminal-time .basalt-run-timer { color: var(--basalt-text-secondary); font-size: inherit; line-height: inherit; } + /* keep: a line older than the newest keep stage lines, and its output, steps back once to tertiary, its mark and duration too; a failed one is + danger at opacity-recede-danger. A colour step over duration-fast; nothing moves. Never under more contrast or in forced colours. */ + .basalt-terminal .basalt-code-line { transition: color var(--basalt-duration-fast) var(--basalt-ease-out); } + @media not ((prefers-contrast: more) or (forced-colors: active)) { + .basalt-terminal .basalt-code-line[data-receded], + .basalt-terminal .basalt-code-line[data-receded] :is(.basalt-code-gutter, .basalt-terminal-mark, .basalt-code-text, .basalt-terminal-duration .basalt-run-timer) { color: var(--basalt-text-tertiary); } + .basalt-terminal .basalt-code-line[data-receded][data-state="failed"] :is(.basalt-terminal-mark, .basalt-code-text) { color: color-mix(in srgb, var(--basalt-status-danger) calc(var(--basalt-opacity-recede-danger) * 100%), transparent); } + } + :root[data-loops="held"] .basalt-terminal .basalt-code-line { transition: none; } + /* No scrollbar on a live transcript's window, on either axis, from its first frame (the owner, DECISIONS 312): it stays a named tab stop the keys, + the wheel and a finger scroll. A static Terminal and CodeBlock keep the system's. */ + .basalt-terminal[data-live] .basalt-code-pre { scrollbar-width: none; scrollbar-gutter: auto; } + .basalt-terminal[data-live] .basalt-code-pre::-webkit-scrollbar { display: none; } + /* A prose page's column is size-prose-width on the row's start edge, never centred. */ .basalt-prose { box-sizing: border-box; max-inline-size: var(--basalt-size-prose-width); margin-inline: 0 auto; min-width: 0; } diff --git a/packages/react/src/terminal.tsx b/packages/react/src/terminal.tsx index 2bd034e4..a29a8598 100644 --- a/packages/react/src/terminal.tsx +++ b/packages/react/src/terminal.tsx @@ -1,10 +1,12 @@ import { CheckCircleIcon } from "@phosphor-icons/react/dist/csr/CheckCircle"; import { WarningIcon } from "@phosphor-icons/react/dist/csr/Warning"; +import { ProhibitIcon } from "@phosphor-icons/react/dist/csr/Prohibit"; import { XCircleIcon } from "@phosphor-icons/react/dist/csr/XCircle"; import * as React from "react"; import { CheckGlyph } from "./glyphs/check"; import { CopyGlyph } from "./glyphs/copy"; +import { MinusGlyph } from "./glyphs/minus"; import { Button, IconButton } from "./button"; import { CodeLine, CodePrompt } from "./code-lines"; import { loadFlight } from "./control-icon"; @@ -13,12 +15,20 @@ import { LogFields } from "./log-fields"; import type { LogFieldsInput } from "./log-fields"; import { usePanelLevel } from "./layers"; import { Reserve } from "./reserve"; +import type { Moment } from "./run-format"; +import { RunTimer } from "./run-timer"; +import { warnRun } from "./run-warn"; import { Spinner } from "./spinner"; import { join } from "./utils"; import { CONFIRM_MS } from "./constants"; -/** What a line is: a command, what came back, or a result (done, a warning, an error). */ -export type TerminalLineKind = "command" | "output" | "done" | "warning" | "error"; +declare const process: { env: { NODE_ENV?: string } }; + +/** What a line is: a command, what came back, a result (done, a warning, an error), or a stage of a run (DECISIONS 316). */ +export type TerminalLineKind = "command" | "output" | "done" | "warning" | "error" | "stage"; + +/** A stage line's state. A stage that has not started has no line; a retry is a new running line whose text the app writes. */ +export type TerminalStageState = "running" | "done" | "failed" | "skipped" | "canceled"; export interface TerminalLine { kind: TerminalLineKind; @@ -31,6 +41,13 @@ export interface TerminalLine { fields?: LogFieldsInput; /** Anything else a line of output holds (a link, a button, a small table). `text` is still its plain form. */ node?: React.ReactNode; + /** A stage line's state (`kind: "stage"`). The app writes `text` without the state's word: a skipped stage's "cache restore (no cache)". */ + state?: TerminalStageState; + /** A stage line's word, drawn before its text, when the app's differs ("Skipped", "Canceled" by default; running, done and failed draw none). */ + word?: string; + /** When a stage line's stage started and ended: its duration, at the line's end. */ + start?: Moment; + end?: Moment; } /** Where a transcript whose lines arrive over time has got to. */ @@ -57,6 +74,15 @@ export interface TerminalProps { interval?: number; /** An exit code, said beside a failed result: "Failed, exit 1". */ exitCode?: number; + /** + * A stage transcript (DECISIONS 316): declared when it mounts and fixed for its life. Its window is never a `log`: a named region (a group while + * empty) from its first frame, whatever its `status` and its lines, because the run's `RunAnnouncer` speaks. Stage lines, `keep` and `time` need it. + */ + stages?: boolean; + /** In a stage transcript, lines older than the newest `keep` stage lines (with their output) step back once, to tertiary ink. Off unless given. */ + keep?: number; + /** In a stage transcript, the run's time in the head, after the state word: `start`, `end`, `carried` across a retry and `since` (see `RunTimer`). */ + time?: { start?: Moment; end?: Moment; carried?: number; since?: Moment }; className?: string; } @@ -66,6 +92,16 @@ const MARKS = { error: { icon: XCircleIcon, name: "Error" }, } as const; +// A stage line's gutter: braille while running, the core check when done, the error's XCircle when failed, the core minus when skipped, Prohibit when +// canceled. Running, done and failed are said by the mark (a named image); skipped and canceled by the word drawn before the text. +const STAGE_MARKS = { + done: { icon: CheckGlyph, name: "Done" }, + failed: { icon: XCircleIcon, name: "Failed" }, + skipped: { icon: MinusGlyph, name: undefined }, + canceled: { icon: ProhibitIcon, name: undefined }, +} as const; +const STAGE_WORDS_DRAWN: Partial> = { skipped: "Skipped", canceled: "Canceled" }; + const REPLAY_WORDS = ["Play", "Pause", "Resume", "Replay"] as const; const STREAM_WORDS = ["Pause", "Resume"] as const; @@ -79,8 +115,18 @@ const swap = (show: string, alternatives: Record) => stagesProp === true); + const stray = React.useRef(false); + if (!stages && !stray.current && lines.some((line) => line.kind === "stage")) { + stray.current = true; + if (process.env.NODE_ENV !== "production") warnRun("Terminal", "a stage line arrived in a transcript that did not declare `stages`; declare it when the transcript mounts."); + } + if (process.env.NODE_ENV !== "production" && !stages && (keep !== undefined || time !== undefined)) warnRun("Terminal", "`keep` and `time` belong to a stage transcript; declare `stages`. They do nothing here."); + const silent = stages || stray.current; // ---- a replay plays the lines itself const [shown, setShown] = React.useState(0); @@ -151,6 +197,12 @@ export function Terminal({ title, lines, prompt = "$", copyable = true, status, const failedWord = exitCode === undefined ? "Failed" : `Failed, exit ${exitCode}`; // Every state's words stand in one cell (see `Reserve`), so the head is as wide as its widest and never moves. + // Which lines step back: every line from the start to the first of the newest `keep` stage lines, output included (one step, tertiary ink). + let receded = -1; + if (stages && keep !== undefined && keep >= 1) { + const at = visible.map((line, i) => (line.kind === "stage" ? i : -1)).filter((i) => i >= 0); + if (at.length > keep) receded = at[at.length - keep]!; + } const words = state === undefined ? null : ( swap(state, { idle: "Not started", @@ -169,6 +221,7 @@ export function Terminal({ title, lines, prompt = "$", copyable = true, status, {title} {words ? {words} : null} + {stages && time ? : null} {control ? (

    Delete sandbox?

    This cannot be undone.

    Details

    A side panel.

    +

    Declare an incident

    Say what is happening.

    Search

    0 results

    @@ -458,6 +470,23 @@

    Client work and other projects

    +
    +

    Runs

    +
      +
    1. Build Passed142 routes2.1 s
    2. +
    3. Test Failedunit1.4 s
    4. +
    5. Deploy Blocked by Testproduction
    6. +
    +
      +
    1. BuildPassed2.1 s
    2. +
    3. ChecksCanceled
    4. +
    +
      +
    1. Passed: Read deploy.yaml84 lines · 0.7 s
    2. +
    3. Canceled Page the on-call0.3 s
      Canceled by Priya Shah
    4. +
    +
    + diff --git a/tools/html-skill/test/fixtures/baseline-rest.html b/tools/html-skill/test/fixtures/baseline-rest.html index 812f6136..8838693b 100644 --- a/tools/html-skill/test/fixtures/baseline-rest.html +++ b/tools/html-skill/test/fixtures/baseline-rest.html @@ -7,12 +7,12 @@ The rest of the overlays - - - @@ -47,8 +47,8 @@ (function(P){"use strict";var R=P._;R.glide=function(r,a,n){var b=matchMedia("(prefers-reduced-motion: reduce), (forced-colors: active), (hover: none), (pointer: coarse)"),g=n.active,u=n.item?"pointer":"keyboard",f=null,c="",h=!1,l;function E(){return r.hasAttribute("data-idle")?null:r.querySelector(g)}function s(){return!b.matches&&(n.item?u==="pointer":u!=="touch")}function x(){return a.dataset.state==="on"}function q(e){var t=r.getBoundingClientRect(),i=r.offsetWidth>0?t.width/r.offsetWidth:1,o=Math.abs(i-1)<.01?1:i,d=n.shape?e.querySelector(n.shape):null;if(d){var p=d.getBoundingClientRect();return{x:(p.left-t.left)/o-r.clientLeft+r.scrollLeft,y:(p.top-t.top)/o-r.clientTop+r.scrollTop,w:p.width/o,h:p.height/o}}var m=e.getBoundingClientRect(),y=getComputedStyle(e,"::before"),w=function(W){return Math.round(W*64)/64};return{x:(m.left-t.left)/o-r.clientLeft+r.scrollLeft+w(parseFloat(y.left)||0),y:(m.top-t.top)/o-r.clientTop+r.scrollTop+w(parseFloat(y.top)||0),w:w(parseFloat(y.width))||m.width/o,h:w(parseFloat(y.height))||m.height/o}}function L(e){var t=a.style;t.setProperty("--plate-x",e.x+"px"),t.setProperty("--plate-y",e.y+"px"),t.setProperty("--plate-w",e.w+"px"),t.setProperty("--plate-h",e.h+"px")}function F(e){a.setAttribute("data-snap",""),e(),a.offsetWidth,a.removeAttribute("data-snap")}function B(){if(x()){var e=getComputedStyle(a),t=new DOMMatrixReadOnly(e.transform);L({x:t.m41,y:t.m42,w:parseFloat(e.width),h:parseFloat(e.height)}),a.dataset.state="off",f=null,c=""}}function v(){if(clearTimeout(l),l=void 0,r.toggleAttribute("data-glide",s()),!s()){(a.dataset.state!=="off"||f)&&F(function(){a.dataset.state="off"}),f=null,c="";return}var e=E();if(!e){l=setTimeout(function(){E()||B()},0);return}var t=q(e),i=t.x+" "+t.y+" "+t.w+" "+t.h;if(!(e===f&&x()&&i===c)){c=i;var o=x()?1:parseFloat(getComputedStyle(a).opacity)||0,d=!h&&e!==f&&u==="pointer"&&o>.01;h=!1,d?(L(t),a.dataset.state="on"):F(function(){L(t),a.dataset.state="on"}),f=e}}function T(e){var t=u;if(e.type==="keydown"?/^(Shift|Control|Alt|Meta)$/.test(e.key)||(t="keyboard"):t=e.pointerType==="touch"?"touch":"pointer",t!==u){var i=s();u=t,n.item&&r.toggleAttribute("data-keys",u==="keyboard"),s()!==i&&v()}}function C(e){if(e.pointerType!=="touch"){var t=e.target.closest(n.item),i=r.querySelector(g);t!==i&&(i&&i.removeAttribute("data-hovered"),t&&t.setAttribute("data-hovered",""))}}function A(){var e=r.querySelector(g);e&&e.removeAttribute("data-hovered")}n.item&&(r.addEventListener("pointerover",C),r.addEventListener("pointerleave",A)),a.dataset.state="off";var S=new MutationObserver(v);S.observe(r,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[n.item?"data-hovered":n.attr,"data-idle"]});var M=new ResizeObserver(function(){h=!0,c="",v()});M.observe(r),b.addEventListener("change",v);var O=["pointermove","pointerdown","keydown"];return O.forEach(function(e){document.addEventListener(e,T,{capture:!0,passive:!0})}),v(),function(){clearTimeout(l),S.disconnect(),M.disconnect(),b.removeEventListener("change",v),O.forEach(function(e){document.removeEventListener(e,T,{capture:!0})}),n.item&&(r.removeEventListener("pointerover",C),r.removeEventListener("pointerleave",A),A()),r.removeAttribute("data-glide"),r.removeAttribute("data-keys")}}})(window.Basalt); (function(c){"use strict";var i=c._;i.step(60,"tableHint",function(){document.querySelectorAll(".table-hint").forEach(function(e){var t=e.previousElementSibling;if(!(e.__bhHint||!t||!t.classList.contains("table-wrap"))){e.__bhHint=!0,e.setAttribute("aria-hidden","true");var s=e.getAttribute("data-hint")||"Scroll sideways to see all {n} columns",l=function(){var r=t.querySelector("table"),u=r?r.querySelectorAll("colgroup > col").length||(r.querySelector("tr")||{children:[]}).children.length:0,o=t.scrollWidth>t.clientWidth;e.textContent=o?s.replace("{n}",u):"",e.hidden=!o};l();var a=new ResizeObserver(l);a.observe(t);var n=t.querySelector("table");n&&a.observe(n)}})})})(window.Basalt); (function(u){"use strict";var r=u._,f=r.still||(r.still=function(){var t=document.documentElement;t.setAttribute("data-still",""),requestAnimationFrame(function(){requestAnimationFrame(function(){t.removeAttribute("data-still")})})});function i(t){return Array.prototype.slice.call(t.querySelectorAll('tbody td.select-col input[type="checkbox"]'))}function s(t,e){var n=i(t),c=0;n.forEach(function(l){var a=l.closest("tr");a&&a.setAttribute("aria-selected",String(l.checked)),l.checked&&c++}),e.checked=n.length>0&&c===n.length,e.indeterminate=c>0&&c0)||!r||!n)){var i=function(){for(var l=0,u=1;u<=p;u++)l+=n.children[u-1].getBoundingClientRect().width,a.style.setProperty(u===p?"--_pin-end":"--_pin-"+u,l+"px");r.style.scrollPaddingInlineStart=l+"px"};i(),new ResizeObserver(i).observe(a);var f=function(){r.toggleAttribute("data-scrolled",Math.abs(r.scrollLeft)>0)};f(),r.addEventListener("scroll",f,{passive:!0}),r.addEventListener("focusin",function(l){var u=l.target.closest&&l.target.closest("td, th"),d=u&&u.parentElement;if(!(!u||!d||d.hasAttribute("data-empty")||Array.prototype.indexOf.call(d.children,u)0?r.scrollLeft-=c*h:g>0&&(r.scrollLeft+=c*Math.min(g,-h))}})}}function F(a){var p='a[href], button, input, select, textarea, summary, [tabindex], [role="checkbox"], [role="button"]',r=["fontFamily","fontSize","fontWeight","fontVariantNumeric","letterSpacing","wordSpacing","lineHeight","color"],n=null,i=null,f=null,l=null,u=0,d=0,v=0,o=-1e9,c=!1;function A(t){var e=t.children.length===1&&t.childNodes.length===1?t.children[0]:null;return e&&getComputedStyle(e).display==="block"&&getComputedStyle(e).overflowX!=="visible"?e:t}function h(t){var e=A(t),s=getComputedStyle(e);if(e.scrollWidth>e.clientWidth)return!0;var m=document.createRange();return m.selectNodeContents(e),m.getBoundingClientRect().width>e.clientWidth-parseFloat(s.paddingLeft)-parseFloat(s.paddingRight)+.5}function g(){v=0,a.querySelectorAll("tbody > tr:not([data-empty]) > :is(td, th), thead > tr > th:not([data-sortable])").forEach(function(t){var e=t.hasAttribute("tabindex")&&!t.hasAttribute("data-cut")||t.querySelector(p);if(!e){var s=h(t);s&&!t.hasAttribute("data-cut")?(t.setAttribute("data-cut",""),t.setAttribute("tabindex","0")):!s&&t.hasAttribute("data-cut")&&(t.removeAttribute("data-cut"),t.removeAttribute("tabindex"),i===t&&x())}})}function b(){v||(v=requestAnimationFrame(g))}function H(){return n||(n=document.createElement("div"),n.className="cell-peek",n.setAttribute("aria-hidden","true"),n.addEventListener("pointerenter",function(){clearTimeout(d),c=!0}),n.addEventListener("pointerleave",function(t){c=!1,t.relatedTarget instanceof Node&&i&&i.contains(t.relatedTarget)||(f=null),L()}),document.body.appendChild(n),n)}function T(){if(!(!n||!i)){var t=i.getBoundingClientRect(),e=(i.closest(".table-wrap")||a).getBoundingClientRect(),s=getComputedStyle(i).direction==="rtl",m=document.documentElement,y="var(--basalt-space-2)",R="calc("+m.clientWidth+"px - 2 * "+y+")";n.style.minWidth="min("+t.width+"px, "+R+")",n.style.minHeight=t.height+"px",n.style.maxWidth="min(max("+t.width+"px, "+(s?t.right-e.left:e.right-t.left)+"px), "+R+")",n.style.left="0px",n.style.top="0px";var S=n.getBoundingClientRect();n.style.left="max("+y+", min("+(s?t.right-S.width:t.left)+"px, calc("+(m.clientWidth-S.width)+"px - "+y+")))",n.style.top="max("+y+", min("+t.top+"px, calc("+(m.clientHeight-S.height)+"px - "+y+")))"}}function E(t){if(clearTimeout(u),clearTimeout(d),l!==t){var e=getComputedStyle(t),s=H();s.textContent=t.textContent.trim(),r.forEach(function(m){s.style[m]=e[m]}),s.style.paddingInline="calc("+e.paddingLeft+" - var(--basalt-size-hairline)) calc("+e.paddingRight+" - var(--basalt-size-hairline))",s.style.paddingBlock="0px",s.toggleAttribute("data-focus",document.activeElement===t&&t.matches(":focus-visible")),i=t,T(),s.setAttribute("data-open","")}}function x(){if(clearTimeout(u),clearTimeout(d),!i||!n){i=null;return}n.removeAttribute("data-open"),n.removeAttribute("data-focus"),i=null,o=performance.now()}function L(){clearTimeout(d),d=setTimeout(function(){var t=document.activeElement,e=t&&t.hasAttribute&&t.hasAttribute("data-cut")&&a.contains(t)?t:null;if(e){i!==e&&E(e);return}f&&i===f||c||x()},100)}function C(t){var e=t instanceof Element?t.closest("[data-cut]"):null;return e&&a.contains(e)?e:null}a.addEventListener("pointerover",function(t){var e=C(t.target);!e||e===f||(f=e,clearTimeout(u),clearTimeout(d),i!==e&&(i||performance.now()-o<400?E(e):u=setTimeout(function(){E(e)},600)))}),a.addEventListener("pointerout",function(t){var e=C(t.target);if(!(!e||e!==f)){var s=t.relatedTarget;s instanceof Node&&(e.contains(s)||n&&n.contains(s))||(f=null,clearTimeout(u),l===e&&(l=null),L())}}),a.addEventListener("focusin",function(t){var e=C(t.target);e&&(l&&l!==e&&(l=null),E(e))}),a.addEventListener("focusout",function(t){var e=C(t.target);e&&(l===e&&(l=null),L())}),window.addEventListener("keydown",function(t){t.key!=="Escape"||!i||(l=i,x(),t.stopPropagation())},!0),window.addEventListener("scroll",function(){i&&T()},{capture:!0,passive:!0}),new ResizeObserver(b).observe(a),new MutationObserver(b).observe(a,{childList:!0,subtree:!0,characterData:!0});var N=new MutationObserver(b);N.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),N.observe(document.documentElement,{attributes:!0,attributeFilter:["style","class","lang","dir"]}),window.addEventListener("resize",b),document.fonts&&document.fonts.ready.then(b),g()}w.step(65,"stillTable",function(){document.querySelectorAll("table[data-fixed]").forEach(function(a){a.__bhStill||(a.__bhStill=!0,W(a),O(a),F(a))})})})(window.Basalt); -(function(_){"use strict";var y=_._,O=6,K=10,P=0,E="mouse";function l(r,n,a,d){var f=document.createElement(r);n&&(f.className=n);for(var p in a||{})f.setAttribute(p,a[p]);return d!=null&&(f.innerHTML=d),f}function k(r,n,a,d){r.__bhResult||(r.__bhResult=!0,r.innerHTML='',r.lastChild.textContent=n),r.firstChild.textContent=n,clearTimeout(r.__bhTimer);var f=a??(Number(r.getAttribute("data-delay"))||400);d?r.lastChild.textContent=n:r.__bhTimer=setTimeout(function(){r.lastChild.textContent=n},f)}_.filterResult=k;function x(r,n){var a=document.getElementById(r),d=a&&(a.tagName==="TABLE"?a:a.querySelector("table"));if(!(!d||!d.tBodies[0])){var f=Array.prototype.filter.call(document.querySelectorAll('.filter[data-for="'+r+'"]'),function(c){return c.__bhFilter}),p=Array.prototype.filter.call(d.tBodies[0].rows,function(c){return!c.hasAttribute("data-empty")}),u=0;p.forEach(function(c){var m=f.every(function(g){return g.__bhFilter.pass(c)});c.hidden=!m,m&&u++}),d.querySelectorAll("tr[data-empty]").forEach(function(c){c.hidden=u!==0}),document.querySelectorAll('.filter-result[data-for="'+r+'"]').forEach(function(c){k(c,"Showing "+u+" of "+p.length+" "+(c.getAttribute("data-noun")||"rows"),null,n)})}}_.refreshFilter=x;function T(r){return Array.prototype.slice.call(r.querySelectorAll("input:not(:disabled)")).filter(function(n){return!n.closest("[hidden]")})}function j(r){var n=Array.prototype.slice.call(r.querySelectorAll("label")),a=n.map(function(e){var t=e.querySelector('input[type="checkbox"]');return{input:t,label:e.textContent.trim()}}).filter(function(e){return e.input});if(a.length){var d=++P,f=r.getAttribute("data-label")||"Filter",p=f.toLowerCase(),u={label:"bh-filter-label-"+d,count:"bh-filter-count-"+d,pop:"bh-filter-pop-"+d,rows:"bh-filter-rows-"+d},c=r.hasAttribute("data-toolbar")||a.length>O,m=function(){return a.filter(function(e){return e.input.checked})},g=l("button","btn filter-clear",{type:"button","data-variant":"ghost","data-size":"sm"},"Clear"),s={head:null,count:null,value:null,trigger:null,foot:null};if(r.textContent="",c){r.setAttribute("data-popup","");var W=a.length>=K;s.trigger=l("button","btn filter-trigger",{type:"button",popovertarget:u.pop},' '),s.trigger.querySelector(".filter-trigger-label").textContent=f,s.value=s.trigger.querySelector(".filter-trigger-value");var b=l("div","panel float filter-popup",{popover:"",id:u.pop,role:"dialog","aria-labelledby":u.label,tabindex:"-1"}),B=l("span","plate",{"aria-hidden":"true"});b.appendChild(B),b.appendChild(l("span","visually-hidden",{id:u.label})).textContent=f;var o=null;if(W){var D=l("div","filter-band",null,'');o=D.appendChild(l("input","filter-band-input",{type:"text",role:"searchbox","aria-label":"Search "+p,"aria-controls":u.rows,placeholder:"Search "+p,autocomplete:"off",autocorrect:"off",spellcheck:"false"})),b.appendChild(D)}var h=l("div","filter-rows",{id:u.rows,role:"group","aria-labelledby":u.label,"aria-describedby":u.count});a.forEach(function(e){var t=l("label","filter-row");t.appendChild(e.input),t.appendChild(l("span","filter-row-label")).textContent=e.label,e.row=t,h.appendChild(t)});var L=l("p","filter-none",{hidden:""});L.textContent="No "+p+" matches.",h.appendChild(L),b.appendChild(h),s.count=l("span","filter-count",{id:u.count});var S=l("div","filter-foot");S.appendChild(s.count),S.appendChild(g),b.appendChild(S),r.appendChild(s.trigger),r.appendChild(b);var C=null,w=function(e){C!==e&&(C&&C.removeAttribute("data-highlighted"),C=e,e&&e.setAttribute("data-highlighted",""))};h.addEventListener("pointermove",function(e){var t=e.target.closest(".filter-row");t&&w(t)}),h.addEventListener("pointerout",function(e){var t=e.target.closest(".filter-row");t&&t===C&&!t.contains(e.relatedTarget)&&w(null)}),h.addEventListener("focusin",function(e){var t=e.target.closest(".filter-row");t&&w(t)}),h.addEventListener("focusout",function(e){var t=e.target.closest(".filter-row");t&&t===C&&w(null)}),h.addEventListener("keydown",function(e){if(o&&e.key.length===1&&e.key!==" "&&!e.ctrlKey&&!e.metaKey&&!e.altKey){o.focus();return}var t={ArrowDown:1,ArrowUp:-1,Home:-1/0,End:1/0}[e.key];if(t!==void 0){var i=T(h);if(i.length){e.preventDefault();var v=i.indexOf(document.activeElement);if(o&&t===-1&&v<=0){o.focus();return}var F=isFinite(t)?Math.min(i.length-1,Math.max(0,v+t)):t<0?0:i.length-1;i[F].focus()}}});var q=function(){var e=o?o.value.trim().toLowerCase():"",t=!1;a.forEach(function(i){var v=e!==""&&i.label.toLowerCase().indexOf(e)<0;i.row.hidden=v,v||(t=!0)}),L.hidden=t};o&&(o.addEventListener("input",q),o.addEventListener("keydown",function(e){if(e.key==="ArrowDown"){var t=T(h)[0];t&&(e.preventDefault(),t.focus())}else e.key==="Escape"&&o.value&&(e.preventDefault(),e.stopPropagation(),o.value="",q())})),b.__bhFilter={plate:B,band:o,reset:function(){o&&(o.value="",q()),w(null)}}}else{var A=l("div","filter-head");A.appendChild(l("span","filter-label",{id:u.label},null)).textContent=f;var N=l("span","filter-count",{id:u.count,"data-reserved":"","data-any":"Any","data-widest":a.length+" of "+a.length});s.value=N.appendChild(l("span","filter-count-value")),A.appendChild(N),A.appendChild(g);var R=l("div","filter-chips",{role:"group","aria-labelledby":u.label,"aria-describedby":u.count});a.forEach(function(e){var t=l("label","chip");e.input.className="chip-input",t.appendChild(e.input);var i=t.appendChild(l("span","chip-seat",{"aria-hidden":"true"},y.glyph("plus")+y.glyph("check")));i.children[0].classList.add("chip-plus"),i.children[1].classList.add("chip-check"),t.appendChild(l("span","chip-label")).textContent=e.label,R.appendChild(t)}),r.appendChild(A),r.appendChild(R)}var H=Number(r.getAttribute("data-column"))-1,I=r.getAttribute("data-for");r.__bhFilter={pass:function(e){var t=m();if(!t.length||!(H>=0))return!0;var i=e.children[H],v=i?(i.hasAttribute("data-value")?i.getAttribute("data-value"):i.textContent.trim()).toLowerCase():"";return t.some(function(F){return F.input.value.toLowerCase()===v})}};var M=function(e){var t=m(),i=t.length===0?"Any":t.length+" of "+a.length;c?(s.count.textContent=i,s.value.textContent=t.length===0?"Any":t.length===1?t[0].label:t[0].label+" +"+(t.length-1),s.trigger.toggleAttribute("data-active",t.length>0)):s.value.textContent=i,t.length===0?g.setAttribute("aria-disabled","true"):g.removeAttribute("aria-disabled"),I&&x(I,!e),e&&r.dispatchEvent(new CustomEvent("filterchange",{bubbles:!0,detail:{values:t.map(function(v){return v.input.value})}}))};r.addEventListener("change",function(e){e.target.matches&&e.target.matches('input[type="checkbox"]')&&M(!0)}),g.addEventListener("click",function(){g.getAttribute("aria-disabled")!=="true"&&(a.forEach(function(e){e.input.checked=!1}),M(!0))}),M(!1)}}y.step(75,"filter",function(){document.querySelectorAll(".filter-result").forEach(function(n){n.__bhResult||k(n,n.textContent)}),document.querySelectorAll(".filter").forEach(function(n){n.__bhFilter||j(n)});var r={};document.querySelectorAll(".filter[data-for]").forEach(function(n){var a=n.getAttribute("data-for");r[a]||(r[a]=1,x(a,!0))})}),y.step(130,"filterPopup",function(){document.documentElement.__bhFilterWired||(document.documentElement.__bhFilterWired=!0,document.addEventListener("pointerdown",function(r){E=r.pointerType},!0),document.addEventListener("keydown",function(){E="keyboard"},!0),document.addEventListener("toggle",function(r){var n=r.target,a=n.__bhFilter;!a||!n.matches||!n.matches(".filter-popup")||(r.newState==="open"?(n.__unglide=y.glide(n,a.plate,{active:"[data-highlighted]",attr:"data-highlighted"}),a.band&&E==="touch"&&n.focus({preventScroll:!0})):(n.__unglide&&(n.__unglide(),n.__unglide=null),a.reset()))},!0))})})(window.Basalt); +(function(k){"use strict";var w=k._;function W(n,f){var r=n.children[f];if(!r||r.hasAttribute("data-not-observed"))return null;var i=r.hasAttribute("data-value")?r.getAttribute("data-value"):r.textContent.trim();return i===""?null:i}function S(n){var f=n.__bhN||0;Array.prototype.forEach.call(n.tBodies[0]?n.tBodies[0].rows:[],function(r){r.__bhI==null&&(r.__bhI=f++)}),n.__bhN=f}function O(n,f,r,i){var a=n.tBodies[0];if(a){S(n);var p=Array.prototype.filter.call(a.rows,function(o){return!o.hasAttribute("data-empty")}),l=Array.prototype.filter.call(a.rows,function(o){return o.hasAttribute("data-empty")}),u=r==="ascending"?1:-1,c=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),v=p.map(function(o){var s=r?W(o,f):null;return{row:o,i:o.__bhI,v:s,n:i&&s!==null?parseFloat(String(s).replace(/[^\d.eE+-]/g,"")):NaN}});v.sort(function(o,s){if(o.v===null||s.v===null)return o.v===s.v?o.i-s.i:o.v===null?1:-1;var m=i&&!isNaN(o.n)&&!isNaN(s.n)?o.n-s.n:c.compare(o.v,s.v);return m?u*m:o.i-s.i}),v.forEach(function(o){a.appendChild(o.row)}),l.forEach(function(o){a.appendChild(o)})}}function F(n){var f=n.tHead&&n.tHead.rows[0];f&&Array.prototype.forEach.call(f.cells,function(r,i){if(!(!r.hasAttribute("data-sortable")||r.__bhSort)){r.__bhSort=!0,r.hasAttribute("scope")||r.setAttribute("scope","col");var a=document.createElement("button");a.type="button",a.className="sort";var p=document.createElement("span");p.className="sort-label",Array.prototype.slice.call(r.childNodes).forEach(function(u){u.classList&&u.classList.contains("explainer")||p.appendChild(u)});var l=document.createElement("span");l.className="sort-seat",l.setAttribute("aria-hidden","true"),l.innerHTML=w.icon("CaretUpDown")+w.glyph("arrow-up")+w.glyph("arrow-down"),["sort-caret","sort-up","sort-down"].forEach(function(u,c){l.children[c].classList.add(u)}),a.appendChild(p),a.appendChild(l),r.insertBefore(a,r.firstChild),a.addEventListener("click",function(){var u=r.getAttribute("aria-sort"),c=r.getAttribute("data-first-sort")||(r.hasAttribute("data-numeric")?"descending":"ascending"),v=u?u===c?c==="ascending"?"descending":"ascending":null:c,o=r.dispatchEvent(new CustomEvent("sortchange",{bubbles:!0,cancelable:!0,detail:{index:i,direction:v}}));Array.prototype.forEach.call(f.cells,function(s){s.removeAttribute("aria-sort")}),v&&r.setAttribute("aria-sort",v),o&&O(n,i,v,r.hasAttribute("data-numeric"))})}})}function H(n){var f=parseInt(n.getAttribute("data-pinned"),10),r=n.closest(".table-wrap"),i=n.rows[0];if(!(!(f>0)||!r||!i)){var a=function(){for(var l=0,u=1;u<=f;u++)l+=i.children[u-1].getBoundingClientRect().width,n.style.setProperty(u===f?"--_pin-end":"--_pin-"+u,l+"px");r.style.scrollPaddingInlineStart=l+"px"};a(),new ResizeObserver(a).observe(n);var p=function(){r.toggleAttribute("data-scrolled",Math.abs(r.scrollLeft)>0)};p(),r.addEventListener("scroll",p,{passive:!0}),r.addEventListener("focusin",function(l){if(l.target.matches(":focus-visible")){var u=l.target.closest&&l.target.closest("td, th"),c=u&&u.parentElement;if(!(!u||!c||c.hasAttribute("data-empty")||Array.prototype.indexOf.call(c.children,u)0?r.scrollLeft-=s*h:A>0&&(r.scrollLeft+=s*Math.min(A,-h))}}})}}function I(n){var f='a[href], button, input, select, textarea, summary, [tabindex], [role="checkbox"], [role="button"]',r=["fontFamily","fontSize","fontWeight","fontVariantNumeric","letterSpacing","wordSpacing","lineHeight","color"],i=null,a=null,p=null,l=null,u=0,c=0,v=0,o=-1e9,s=!1;function m(t){var e=t.children.length===1&&t.childNodes.length===1?t.children[0]:null;return e&&getComputedStyle(e).display==="block"&&getComputedStyle(e).overflowX!=="visible"?e:t}var h=null;function A(t){var e=m(t),d=getComputedStyle(e);return e.scrollWidth>e.clientWidth?!0:(h=h||document.createRange(),h.selectNodeContents(e),h.getBoundingClientRect().width>e.clientWidth-parseFloat(d.paddingLeft)-parseFloat(d.paddingRight)+.5)}function N(){v=0,n.querySelectorAll("tbody > tr:not([data-empty]) > :is(td, th), thead > tr > th:not([data-sortable])").forEach(function(t){var e=t.hasAttribute("tabindex")&&!t.hasAttribute("data-cut")||t.querySelector(f);if(!e){var d=A(t);d&&!t.hasAttribute("data-cut")?(t.setAttribute("data-cut",""),t.setAttribute("tabindex","0")):!d&&t.hasAttribute("data-cut")&&(t.removeAttribute("data-cut"),t.removeAttribute("tabindex"),a===t&&C())}})}function b(){v||(v=requestAnimationFrame(N))}function z(){return i||(i=document.createElement("div"),i.className="cell-peek",i.setAttribute("aria-hidden","true"),i.addEventListener("pointerenter",function(){clearTimeout(c),s=!0}),i.addEventListener("pointerleave",function(t){s=!1,t.relatedTarget instanceof Node&&a&&a.contains(t.relatedTarget)||(p=null),L()}),document.body.appendChild(i),i)}function T(){if(!(!i||!a)){var t=a.getBoundingClientRect(),e=(a.closest(".table-wrap")||n).getBoundingClientRect(),d=getComputedStyle(a).direction==="rtl",g=document.documentElement,y="var(--basalt-space-2)",R="calc("+g.clientWidth+"px - 2 * "+y+")";i.style.minWidth="min("+t.width+"px, "+R+")",i.style.minHeight=t.height+"px",i.style.maxWidth="min(max("+t.width+"px, "+(d?t.right-e.left:e.right-t.left)+"px), "+R+")",i.style.left="0px",i.style.top="0px";var _=i.getBoundingClientRect();i.style.left="max("+y+", min("+(d?t.right-_.width:t.left)+"px, calc("+(g.clientWidth-_.width)+"px - "+y+")))",i.style.top="max("+y+", min("+t.top+"px, calc("+(g.clientHeight-_.height)+"px - "+y+")))"}}function E(t){if(clearTimeout(u),clearTimeout(c),l!==t){var e=getComputedStyle(t),d=z();d.textContent=t.textContent.trim(),r.forEach(function(g){d.style[g]=e[g]}),d.style.paddingInline="calc("+e.paddingLeft+" - var(--basalt-size-hairline)) calc("+e.paddingRight+" - var(--basalt-size-hairline))",d.style.paddingBlock="0px",d.toggleAttribute("data-focus",document.activeElement===t&&t.matches(":focus-visible")),a=t,T(),d.setAttribute("data-open","")}}function C(){if(clearTimeout(u),clearTimeout(c),!a||!i){a=null;return}i.removeAttribute("data-open"),i.removeAttribute("data-focus"),a=null,o=performance.now()}function L(){clearTimeout(c),c=setTimeout(function(){var t=document.activeElement,e=t&&t.hasAttribute&&t.hasAttribute("data-cut")&&n.contains(t)?t:null;if(e){a!==e&&E(e);return}p&&a===p||s||C()},100)}function x(t){var e=t instanceof Element?t.closest("[data-cut]"):null;return e&&n.contains(e)?e:null}n.addEventListener("pointerover",function(t){var e=x(t.target);!e||e===p||(p=e,clearTimeout(u),clearTimeout(c),a!==e&&(a||performance.now()-o<400?E(e):u=setTimeout(function(){E(e)},600)))}),n.addEventListener("pointerout",function(t){var e=x(t.target);if(!(!e||e!==p)){var d=t.relatedTarget;d instanceof Node&&(e.contains(d)||i&&i.contains(d))||(p=null,clearTimeout(u),l===e&&(l=null),L())}}),n.addEventListener("focusin",function(t){var e=x(t.target);e&&(l&&l!==e&&(l=null),E(e))}),n.addEventListener("focusout",function(t){var e=x(t.target);e&&(l===e&&(l=null),L())}),window.addEventListener("keydown",function(t){t.key!=="Escape"||!a||(l=a,C(),t.stopPropagation())},!0),window.addEventListener("scroll",function(){a&&T()},{capture:!0,passive:!0}),new ResizeObserver(b).observe(n),new MutationObserver(b).observe(n,{childList:!0,subtree:!0,characterData:!0});var B=new MutationObserver(b);B.observe(document.head,{childList:!0,subtree:!0,characterData:!0}),B.observe(document.documentElement,{attributes:!0,attributeFilter:["style","class","lang","dir"]}),window.addEventListener("resize",b),document.fonts&&document.fonts.ready.then(b),N()}w.step(65,"stillTable",function(){document.querySelectorAll("table[data-fixed]").forEach(function(n){n.__bhStill||(n.__bhStill=!0,S(n),F(n),H(n),I(n))})})})(window.Basalt); +(function(_){"use strict";var y=_._,K=6,P=10,j=0,E="mouse";function i(r,a,n,d){var s=document.createElement(r);a&&(s.className=a);for(var p in n||{})s.setAttribute(p,n[p]);return d!=null&&(s.innerHTML=d),s}function x(r,a,n,d){r.__bhResult||(r.__bhResult=!0,r.innerHTML='',r.lastChild.textContent=a),r.firstChild.textContent=a,clearTimeout(r.__bhTimer);var s=n??(Number(r.getAttribute("data-delay"))||400);d?r.lastChild.textContent=a:r.__bhTimer=setTimeout(function(){r.lastChild.textContent=a},s)}_.filterResult=x;function k(r,a){var n=document.getElementById(r),d=n&&(n.tagName==="TABLE"?n:n.querySelector("table"));if(!(!d||!d.tBodies[0])){var s=Array.prototype.filter.call(document.querySelectorAll('.filter[data-for="'+r+'"]'),function(c){return c.__bhFilter}),p=Array.prototype.filter.call(d.tBodies[0].rows,function(c){return!c.hasAttribute("data-empty")}),u=0;p.forEach(function(c){var m=s.every(function(g){return g.__bhFilter.pass(c)});c.hidden=!m,m&&u++}),d.querySelectorAll("tr[data-empty]").forEach(function(c){c.hidden=u!==0}),document.querySelectorAll('.filter-result[data-for="'+r+'"]').forEach(function(c){x(c,"Showing "+u+" of "+p.length+" "+(c.getAttribute("data-noun")||"rows"),null,a)})}}_.refreshFilter=k;function T(r){return Array.prototype.slice.call(r.querySelectorAll("input:not(:disabled)")).filter(function(a){return!a.closest("[hidden]")})}function z(r){var a=Array.prototype.slice.call(r.querySelectorAll("label")),n=a.map(function(e){var t=e.querySelector('input[type="checkbox"]');return{input:t,label:e.textContent.trim()}}).filter(function(e){return e.input});if(n.length){var d=++j,s=r.getAttribute("data-label")||"Filter",p=s.toLowerCase(),u={label:"bh-filter-label-"+d,count:"bh-filter-count-"+d,pop:"bh-filter-pop-"+d,rows:"bh-filter-rows-"+d},c=r.hasAttribute("data-toolbar")||n.length>K,m=function(){return n.filter(function(e){return e.input.checked})},g=i("button","btn filter-clear",{type:"button","data-variant":"ghost","data-size":"sm"},"Clear"),f={head:null,count:null,value:null,trigger:null,foot:null};if(r.textContent="",c){r.setAttribute("data-popup","");var W=n.length>=P;if(f.trigger=i("button","btn filter-trigger",{type:"button",popovertarget:u.pop},' '),f.trigger.querySelector(".filter-trigger-label").textContent=s,f.value=f.trigger.querySelector(".filter-trigger-value"),r.hasAttribute("data-toolbar")){var B=f.value;f.value=B.appendChild(i("span","filter-trigger-now")),["Any"].concat(n.map(function(e){return e.label+(n.length>1?" +"+(n.length-1):"")})).forEach(function(e){B.appendChild(i("span","filter-trigger-sizer",{"aria-hidden":"true"})).textContent=e})}var b=i("div","panel float filter-popup",{popover:"",id:u.pop,role:"dialog","aria-labelledby":u.label,tabindex:"-1"}),D=i("span","plate",{"aria-hidden":"true"});b.appendChild(D),b.appendChild(i("span","visually-hidden",{id:u.label})).textContent=s;var o=null;if(W){var H=i("div","filter-band",null,'');o=H.appendChild(i("input","filter-band-input",{type:"text",role:"searchbox","aria-label":"Search "+p,"aria-controls":u.rows,placeholder:"Search "+p,autocomplete:"off",autocorrect:"off",spellcheck:"false"})),b.appendChild(H)}var h=i("div","filter-rows",{id:u.rows,role:"group","aria-labelledby":u.label,"aria-describedby":u.count});n.forEach(function(e){var t=i("label","filter-row");t.appendChild(e.input),t.appendChild(i("span","filter-row-label")).textContent=e.label,e.row=t,h.appendChild(t)});var L=i("p","filter-none",{hidden:""});L.textContent="No "+p+" matches.",h.appendChild(L),b.appendChild(h),f.count=i("span","filter-count",{id:u.count});var S=i("div","filter-foot");S.appendChild(f.count),S.appendChild(g),b.appendChild(S),r.appendChild(f.trigger),r.appendChild(b);var C=null,w=function(e){C!==e&&(C&&C.removeAttribute("data-highlighted"),C=e,e&&e.setAttribute("data-highlighted",""))};h.addEventListener("pointermove",function(e){var t=e.target.closest(".filter-row");t&&w(t)}),h.addEventListener("pointerout",function(e){var t=e.target.closest(".filter-row");t&&t===C&&!t.contains(e.relatedTarget)&&w(null)}),h.addEventListener("focusin",function(e){var t=e.target.closest(".filter-row");t&&w(t)}),h.addEventListener("focusout",function(e){var t=e.target.closest(".filter-row");t&&t===C&&w(null)}),h.addEventListener("keydown",function(e){if(o&&e.key.length===1&&e.key!==" "&&!e.ctrlKey&&!e.metaKey&&!e.altKey){o.focus();return}var t={ArrowDown:1,ArrowUp:-1,Home:-1/0,End:1/0}[e.key];if(t!==void 0){var l=T(h);if(l.length){e.preventDefault();var v=l.indexOf(document.activeElement);if(o&&t===-1&&v<=0){o.focus();return}var F=isFinite(t)?Math.min(l.length-1,Math.max(0,v+t)):t<0?0:l.length-1;l[F].focus()}}});var q=function(){var e=o?o.value.trim().toLowerCase():"",t=!1;n.forEach(function(l){var v=e!==""&&l.label.toLowerCase().indexOf(e)<0;l.row.hidden=v,v||(t=!0)}),L.hidden=t};o&&(o.addEventListener("input",q),o.addEventListener("keydown",function(e){if(e.key==="ArrowDown"){var t=T(h)[0];t&&(e.preventDefault(),t.focus())}else e.key==="Escape"&&o.value&&(e.preventDefault(),e.stopPropagation(),o.value="",q())})),b.__bhFilter={plate:D,band:o,reset:function(){o&&(o.value="",q()),w(null)}}}else{var A=i("div","filter-head");A.appendChild(i("span","filter-label",{id:u.label},null)).textContent=s;var N=i("span","filter-count",{id:u.count,"data-reserved":"","data-any":"Any","data-widest":n.length+" of "+n.length});f.value=N.appendChild(i("span","filter-count-value")),A.appendChild(N),A.appendChild(g);var R=i("div","filter-chips",{role:"group","aria-labelledby":u.label,"aria-describedby":u.count});n.forEach(function(e){var t=i("label","chip");e.input.className="chip-input",t.appendChild(e.input);var l=t.appendChild(i("span","chip-seat",{"aria-hidden":"true"},y.glyph("plus")+y.glyph("check")));l.children[0].classList.add("chip-plus"),l.children[1].classList.add("chip-check"),t.appendChild(i("span","chip-label")).textContent=e.label,R.appendChild(t)}),r.appendChild(A),r.appendChild(R)}var I=Number(r.getAttribute("data-column"))-1,O=r.getAttribute("data-for");r.__bhFilter={pass:function(e){var t=m();if(!t.length||!(I>=0))return!0;var l=e.children[I],v=l?(l.hasAttribute("data-value")?l.getAttribute("data-value"):l.textContent.trim()).toLowerCase():"";return t.some(function(F){return F.input.value.toLowerCase()===v})}};var M=function(e){var t=m(),l=t.length===0?"Any":t.length+" of "+n.length;c?(f.count.textContent=l,f.value.textContent=t.length===0?"Any":t.length===1?t[0].label:t[0].label+" +"+(t.length-1),f.trigger.toggleAttribute("data-active",t.length>0)):f.value.textContent=l,t.length===0?g.setAttribute("aria-disabled","true"):g.removeAttribute("aria-disabled"),O&&k(O,!e),e&&r.dispatchEvent(new CustomEvent("filterchange",{bubbles:!0,detail:{values:t.map(function(v){return v.input.value})}}))};r.addEventListener("change",function(e){e.target.matches&&e.target.matches('input[type="checkbox"]')&&M(!0)}),g.addEventListener("click",function(){g.getAttribute("aria-disabled")!=="true"&&(n.forEach(function(e){e.input.checked=!1}),M(!0))}),M(!1)}}y.step(75,"filter",function(){document.querySelectorAll(".filter-result").forEach(function(a){a.__bhResult||x(a,a.textContent)}),document.querySelectorAll(".filter").forEach(function(a){a.__bhFilter||z(a)});var r={};document.querySelectorAll(".filter[data-for]").forEach(function(a){var n=a.getAttribute("data-for");r[n]||(r[n]=1,k(n,!0))})}),y.step(130,"filterPopup",function(){document.documentElement.__bhFilterWired||(document.documentElement.__bhFilterWired=!0,document.addEventListener("pointerdown",function(r){E=r.pointerType},!0),document.addEventListener("keydown",function(){E="keyboard"},!0),document.addEventListener("toggle",function(r){var a=r.target,n=a.__bhFilter;!n||!a.matches||!a.matches(".filter-popup")||(r.newState==="open"?(a.__unglide=y.glide(a,n.plate,{active:"[data-highlighted]",attr:"data-highlighted"}),n.band&&E==="touch"&&a.focus({preventScroll:!0})):(a.__unglide&&(a.__unglide(),a.__unglide=null),n.reset()))},!0))})})(window.Basalt); (function(A){"use strict";var h=A._,E=0,i=5,y='.float[popover]:not([role="tooltip"])';h.tabbables=function(t){return Array.prototype.filter.call(t.querySelectorAll('a[href],button:not([disabled]),input:not([disabled]):not([type=hidden]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])'),function(e){return e.getClientRects().length&&!e.closest("[hidden],[inert]")})},h.place=function(t,e,o){o=o||{};var r=o.side||"bottom",n=o.align||"start",s=o.offset==null?6:o.offset,a=e.getBoundingClientRect(),l=document.documentElement.clientWidth,b=document.documentElement.clientHeight,c={top:a.top-s-i,bottom:b-a.bottom-s-i,left:a.left-s-i,right:l-a.right-s-i},g={top:"bottom",bottom:"top",left:"right",right:"left"},_=r==="top"||r==="bottom",u=t.style;u.setProperty("--available-height",Math.max(c[r],c[g[r]])+"px"),u.setProperty("--available-width",l-2*i+"px"),(_?t.offsetHeight:t.offsetWidth)>c[r]&&c[g[r]]>c[r]&&(r=g[r]),u.setProperty("--available-height",Math.max(c[r],0)+"px");var f=t.offsetWidth,v=t.offsetHeight,x=function(d){return _?{x:d==="start"?a.left:d==="end"?a.right-f:a.left+(a.width-f)/2,y:r==="bottom"?a.bottom+s:a.top-s-v}:{x:r==="right"?a.right+s:a.left-s-f,y:d==="start"?a.top:d==="end"?a.bottom-v:a.top+(a.height-v)/2}},w=function(d){return d.x>=i&&d.y>=i&&d.x+f<=l-i&&d.y+v<=b-i},m=x(n);!w(m)&&n!=="center"&&w(x(n==="start"?"end":"start"))&&(n=n==="start"?"end":"start",m=x(n));var L=Math.max(i,Math.min(m.x,l-i-f)),q=Math.max(i,Math.min(m.y,b-i-v));u.left=Math.round(L)+"px",u.top=Math.round(q)+"px";var H=n==="center"?"center":n==="start"?"left":"right";u.setProperty("--origin",_?(r==="bottom"?"top ":"bottom ")+H:(r==="right"?"left ":"right ")+(n==="center"?"center":n==="start"?"top":"bottom")),t.setAttribute("data-placed",r)};function P(t,e){return e&&e.source||document.querySelector('[popovertarget="'+t.id+'"]')||t.dataset.anchor&&document.querySelector(t.dataset.anchor)}function M(t,e){var o=P(t,e);t.__anchor=o,t.hasAttribute("role")||t.setAttribute("role",t.matches(".menu")?"menu":"dialog");var r=t.querySelector(".popover-title");if(r&&!t.hasAttribute("aria-labelledby")&&!t.hasAttribute("aria-label")&&(r.id=r.id||"bh-pop-"+ ++E,t.setAttribute("aria-labelledby",r.id)),o){o.setAttribute("aria-expanded","true"),o.hasAttribute("aria-haspopup")||o.setAttribute("aria-haspopup",t.getAttribute("role")==="menu"?"menu":"dialog");var n=function(){h.place(t,o,{side:t.dataset.side,align:t.dataset.align})};n(),t.__again=n,window.addEventListener("resize",n),window.addEventListener("scroll",n,!0)}if(t.__bhFocus||(t.__bhFocus=!0,t.addEventListener("focusout",function(a){var l=a.relatedTarget;l&&!t.contains(l)&&l!==t.__anchor&&!(l.closest&&l.closest("[popover]:popover-open"))&&t.matches(":popover-open")&&t.hidePopover()})),!t.matches('[role="menu"], .combobox-popup')){var s=h.tabbables(t)[0];s||t.setAttribute("tabindex","-1"),(s||t).focus({preventScroll:!0})}}function S(t){t.__again&&(window.removeEventListener("resize",t.__again),window.removeEventListener("scroll",t.__again,!0),t.__again=null);var e=t.__anchor;e&&(e.setAttribute("aria-expanded","false"),t.__had&&(!document.activeElement||document.activeElement===document.body)&&e.focus({preventScroll:!0})),t.__had=!1}h.step(120,"wirePopover",function(){document.documentElement.__bhPopover||(document.documentElement.__bhPopover=!0,document.addEventListener("beforetoggle",function(t){var e=t.target;t.newState==="closed"&&e.matches&&e.matches(y)&&(e.__had=e.contains(document.activeElement))},!0),document.addEventListener("toggle",function(t){var e=t.target;!e.matches||!e.matches(y)||(t.newState==="open"?M(e,t):S(e))},!0))})})(window.Basalt); Basalt._.addGlyphs({"plus":[""],"check":[""],"arrow-down":[""],"arrow-up":[""]}); diff --git a/tools/html-skill/test/fixtures/kitchen-sink.body.html b/tools/html-skill/test/fixtures/kitchen-sink.body.html index d678238e..472bb667 100644 --- a/tools/html-skill/test/fixtures/kitchen-sink.body.html +++ b/tools/html-skill/test/fixtures/kitchen-sink.body.html @@ -318,6 +318,23 @@

    Client work and other projects

    +
    +

    Runs

    +
      +
    1. Build Passed142 routes2.1 s
    2. +
    3. Test Failedunit1.4 s
    4. +
    5. Deploy Blocked by Testproduction
    6. +
    +
      +
    1. BuildPassed2.1 s
    2. +
    3. ChecksCanceled
    4. +
    +
      +
    1. Passed: Read deploy.yaml84 lines · 0.7 s
    2. +
    3. Canceled Page the on-call0.3 s
      Canceled by Priya Shah
    4. +
    +
    + From 99bce961fba4d36e7e95a48052e383ea3ea5400b Mon Sep 17 00:00:00 2001 From: bailey <74082460+bmjcoding@users.noreply.github.com> Date: Mon, 23 Nov 2026 16:54:38 -0600 Subject: [PATCH 08/13] Stages review round: the code review's eleven findings and the pixel review's five, with its rulings Following: the window's own scrolls and a roll in flight no longer read as the reader leaving (rows are clipped to the list while they roll), and a reader's scroll in the same task as an arrival is kept. The floor keeps unfilled slots and is the larger of keep and minRows. Print draws the whole record in full form, and a running time prints as held. The hold and reduced motion cancel a roll in flight; a settled mark or badge face never plays its entry again. An action removed as false or null sends focus home, and a stage's detail is always in the row, so its first opening runs. The toggle keeps its 44px target nested in a list. A failed stage ends a replay Failed, and a drawn word hides the stage line's mark (React and the skill). A runs page takes the stored hold. The skill's rail takes the usage's row and draws five or six stages as rows under 480. axe exempts only tail rows 2 to 5. Rulings: TextButton's end icon is a ControlIcon (the chevron morphs); the detail's code well is one level deeper; a rail's figure is centred; a head's seat holds today's held form only, and a Terminal head's time follows its state word; a command never steps back; a retrying step's sentence is primary; StageBadge is tabular and never gives way; the floor is max(keep, minRows). Polish: a held step's dot hides with its time; an older output's loud field steps back; timers redraw only when their figure changes; the skill's row code is plain mono, its step time mono, every stage line 20px. The kitchen sink brings diagram-motion. Not reviewed again yet. Co-Authored-By: Claude Opus 5.5 --- .agent/skills/basalt-html/parts/manifest.json | 12 +- .agent/skills/basalt-html/parts/runs.css | 2 +- .agent/skills/basalt-html/parts/terminal.css | 2 +- .agent/skills/basalt-html/parts/terminal.js | 4 +- .agent/skills/basalt-html/parts/usage/runs.md | 6 +- docs/foundations.md | 16 +- packages/react/src/run-stage.tsx | 23 +- packages/react/src/run-timeline.tsx | 71 ++++-- packages/react/src/run-timer.tsx | 47 +++- packages/react/src/stage-badge.tsx | 12 +- packages/react/src/stage-mark.tsx | 12 +- packages/react/src/styles/components.css | 104 ++++++--- packages/react/src/terminal.tsx | 24 +- packages/react/src/text-button.tsx | 8 +- packages/react/test/bundle.test.mjs | 12 +- packages/react/test/export-sizes.json | 26 +-- packages/react/test/icons.test.mjs | 5 +- packages/react/test/run-timeline.test.mjs | 145 +++++++++++- packages/react/test/run-timer.test.mjs | 12 + packages/react/test/stage-badge.test.mjs | 32 +++ packages/react/test/stage-list.test.mjs | 20 +- packages/react/test/stage-rail.test.mjs | 14 ++ packages/react/test/stage-transcript.test.mjs | 28 ++- tools/html-skill/src/modules.json | 12 +- tools/html-skill/src/modules/runs.css | 71 +++--- tools/html-skill/src/modules/terminal.css | 3 + tools/html-skill/src/modules/terminal.js | 21 +- tools/html-skill/src/usage/runs.md | 6 +- .../test/fixtures/baseline-kitchen-sink.html | 10 +- .../test/fixtures/kitchen-sink.body.html | 2 +- tools/html-skill/test/runs.test.mjs | 73 +++++- .../assets/round-67/connector-before-dark.png | Bin 0 -> 72809 bytes .../round-67/connector-before-light.png | Bin 0 -> 72856 bytes .../assets/round-67/held-before-dark-1440.png | Bin 0 -> 18372 bytes .../assets/round-67/held-before-dark-390.png | Bin 0 -> 16159 bytes .../round-67/held-before-light-1440.png | Bin 0 -> 18292 bytes .../assets/round-67/held-before-light-390.png | Bin 0 -> 16280 bytes .../assets/round-67/log-before-dark.png | Bin 0 -> 77346 bytes .../assets/round-67/log-before-light.png | Bin 0 -> 76594 bytes .../assets/round-67/queued-before-dark.png | Bin 0 -> 32915 bytes .../assets/round-67/queued-before-light.png | Bin 0 -> 33057 bytes .../assets/round-67/tail-before-dark-1440.png | Bin 0 -> 110558 bytes .../assets/round-67/tail-before-dark-390.png | Bin 0 -> 99116 bytes .../round-67/tail-before-light-1440.png | Bin 0 -> 110217 bytes .../assets/round-67/tail-before-light-390.png | Bin 0 -> 98934 bytes tools/review/round67.tsx | 212 +++++++++++++++--- 46 files changed, 822 insertions(+), 225 deletions(-) create mode 100644 tools/review/assets/round-67/connector-before-dark.png create mode 100644 tools/review/assets/round-67/connector-before-light.png create mode 100644 tools/review/assets/round-67/held-before-dark-1440.png create mode 100644 tools/review/assets/round-67/held-before-dark-390.png create mode 100644 tools/review/assets/round-67/held-before-light-1440.png create mode 100644 tools/review/assets/round-67/held-before-light-390.png create mode 100644 tools/review/assets/round-67/log-before-dark.png create mode 100644 tools/review/assets/round-67/log-before-light.png create mode 100644 tools/review/assets/round-67/queued-before-dark.png create mode 100644 tools/review/assets/round-67/queued-before-light.png create mode 100644 tools/review/assets/round-67/tail-before-dark-1440.png create mode 100644 tools/review/assets/round-67/tail-before-dark-390.png create mode 100644 tools/review/assets/round-67/tail-before-light-1440.png create mode 100644 tools/review/assets/round-67/tail-before-light-390.png diff --git a/.agent/skills/basalt-html/parts/manifest.json b/.agent/skills/basalt-html/parts/manifest.json index 4f3a47ae..8aa75db6 100644 --- a/.agent/skills/basalt-html/parts/manifest.json +++ b/.agent/skills/basalt-html/parts/manifest.json @@ -631,7 +631,7 @@ "XCircle", "Prohibit" ], - "budget": 11750, + "budget": 11950, "usage": 1800, "builds": [ "braille" @@ -653,7 +653,8 @@ "run-step-sentence", "run-step-word", "run-step-meta", - "run-step-detail" + "run-step-detail", + "run-step-time" ], "icons": [ "Circle", @@ -662,8 +663,11 @@ "MinusCircle", "Prohibit" ], - "budget": 9650, - "usage": 1650 + "budget": 10800, + "usage": 1700, + "requires": [ + "loops" + ] }, "chart": { "classes": [ diff --git a/.agent/skills/basalt-html/parts/runs.css b/.agent/skills/basalt-html/parts/runs.css index 2ed1ce4c..c1ecafeb 100644 --- a/.agent/skills/basalt-html/parts/runs.css +++ b/.agent/skills/basalt-html/parts/runs.css @@ -1 +1 @@ -@layer basalt{.run-mark{display:inline-grid;flex:none;place-items:center;box-sizing:border-box;inline-size:var(--basalt-size-icon-sm);block-size:var(--basalt-size-icon-sm);vertical-align:middle}.run-mark>svg{display:block;inline-size:100%;block-size:100%}.run-mark:is([data-state=queued],[data-state=success]){color:var(--basalt-text-secondary)}.run-mark[data-state=queued]{animation:bh-run-breath var(--basalt-duration-loop-fade) var(--basalt-ease-in-out) infinite alternate}.run-mark[data-state=failed]{color:var(--basalt-status-danger)}.run-mark:is([data-state=skipped],[data-state=canceled]){color:var(--basalt-text-tertiary)}.run-mark:is([data-state=running],[data-state=retrying]){color:var(--basalt-text-primary)}.run-mark:is([data-state=running],[data-state=retrying]):before{content:"";box-sizing:border-box;inline-size:calc(var(--basalt-size-icon-sm) - 2 * var(--basalt-size-hairline));block-size:calc(var(--basalt-size-icon-sm) - 2 * var(--basalt-size-hairline));border:1.5px solid color-mix(in oklch,currentColor 25%,transparent);border-top-color:currentColor;border-radius:var(--basalt-radius-full);animation:bh-spin var(--basalt-duration-loop-ring) linear infinite}@keyframes bh-run-breath{0%{opacity:var(--basalt-opacity-queued)}to{opacity:1}}:root[data-loops=held] .run-mark{animation:none}@media(prefers-reduced-motion:reduce){.run-mark[data-state=queued]{animation:none}.run-mark:is([data-state=running],[data-state=retrying]):before{animation:bh-fade var(--basalt-duration-loop-fade) var(--basalt-ease-in-out) infinite}}:root[data-loops=held] .run-mark:before{animation:none}@media(forced-colors:active){.run-mark{color:inherit}.run-mark[data-state=queued]{animation:none}}@media print{.run-mark,.run-mark:before{animation:none}}.run-stages,.run-rail,.run-steps{margin:0;padding:0;list-style:none;font:var(--basalt-font-weight-regular) var(--bh-sm);color:var(--basalt-text-primary);container-type:inline-size}.run-stages{display:grid;align-content:start}.run-stages>.run-stage{position:relative;display:grid;grid-template-columns:var(--basalt-size-icon-sm) minmax(0,1fr) auto auto;align-items:center;column-gap:var(--basalt-space-3);padding-block:var(--basalt-space-2)}.run-stage-name{display:flex;align-items:baseline;gap:var(--basalt-space-2);min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.run-stage-word{flex:none;color:var(--basalt-text-secondary)}.run-stage:is([data-state=queued],[data-state=skipped],[data-state=canceled]) .run-stage-name{color:var(--basalt-text-secondary)}.run-stage:is([data-state=running],[data-state=retrying]) .run-stage-word{color:var(--basalt-text-primary)}.run-stage[data-state=failed] .run-stage-word{color:var(--basalt-status-danger);font-weight:var(--basalt-font-weight-medium)}.run-stage:is([data-state=queued],[data-state=skipped],[data-state=canceled]) .run-stage-word{color:var(--basalt-text-tertiary)}.run-stages>.run-stage[data-state=success] .run-stage-word{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.run-stage-meta{color:var(--basalt-text-tertiary);font-size:var(--basalt-text-xs-size);white-space:nowrap}.run-stage-time{min-inline-size:var(--basalt-space-12);text-align:end;font:var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-mono);font-variant-numeric:tabular-nums;color:var(--basalt-text-tertiary);white-space:nowrap}.run-stage-detail{grid-column:2 / -1;padding-block:var(--basalt-space-2) var(--basalt-space-1);color:var(--basalt-text-secondary)}.run-stage-detail :is(p,small){display:block;margin:0}.run-stage-detail small{color:var(--basalt-text-tertiary);font-size:var(--basalt-text-xs-size);line-height:var(--basalt-text-xs-line-height)}.run-stage-detail strong{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-medium)}.run-stage[data-state=failed] .run-stage-detail strong{color:var(--basalt-status-danger)}.run-stage-detail .btn{margin-block-start:var(--basalt-space-2)}:is(.run-stage-detail,.run-step) code{font-family:var(--basalt-font-family-mono);font-size:inherit;line-height:1}@container (width < 480px){.run-stages>.run-stage{grid-template-columns:var(--basalt-size-icon-sm) minmax(0,1fr) auto}.run-stages .run-stage-meta{display:none}}:is(.run-stages,.run-steps)>:is(.run-stage,.run-step):not(:last-child):after{content:"";position:absolute;inset-inline-start:round(down,calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline) / 2),var(--basalt-size-hairline));inset-block-start:calc(var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-1));inset-block-end:calc(-1 * (var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 - var(--basalt-size-icon-sm) / 2 - var(--basalt-space-1)));border-inline-start:var(--basalt-size-hairline) solid var(--basalt-border-input)}.run-rail{display:grid;grid-auto-columns:minmax(0,1fr);grid-auto-flow:column}.run-rail>.run-stage{position:relative;display:grid;grid-template-columns:minmax(0,1fr);justify-items:center;align-content:start;text-align:center;padding-block-start:var(--basalt-space-1)}.run-rail>.run-stage>.run-mark{margin-block-end:var(--basalt-space-1)}.run-rail .run-stage-name{display:block;margin-block-start:var(--basalt-space-1);max-inline-size:100%}.run-rail .run-stage-word,.run-rail .run-stage-time{grid-row:3;grid-column:1;margin-block-start:var(--basalt-space-1);font-size:var(--basalt-text-xs-size);line-height:var(--basalt-text-xs-line-height);min-inline-size:0;text-align:center}.run-rail .run-stage:is([data-state=failed],[data-state=skipped],[data-state=canceled],[data-state=retrying]) .run-stage-time{visibility:hidden}.run-rail .run-stage:is([data-state=queued],[data-state=running],[data-state=success]) .run-stage-word{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.run-rail .run-stage-meta,.run-rail .run-stage-detail{display:none}.run-rail>.run-stage:not(:last-child):before{content:"";position:absolute;inset-block-start:calc(var(--basalt-space-1) + var(--basalt-size-icon-sm) / 2);inset-inline-start:calc(50% + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-2));inline-size:calc(100% - var(--basalt-size-icon-sm) - var(--basalt-space-4));border-block-start:var(--basalt-size-hairline) solid var(--basalt-border-input)}.run-rail>.run-stage:not(:last-child):after{content:"";position:absolute;inset-block-start:calc(var(--basalt-space-1) + var(--basalt-size-icon-sm) / 2);inset-inline-start:calc(50% + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-2));inline-size:calc(100% - var(--basalt-size-icon-sm) - var(--basalt-space-4));border-block-start:var(--basalt-size-hairline) solid var(--basalt-text-secondary);transform:scaleX(0);transform-origin:left}.run-rail>.run-stage:not(:last-child):dir(rtl):after{transform-origin:right}.run-rail>.run-stage[data-state=success]:not(:last-child):after{transform:scaleX(1);transition:transform var(--basalt-duration-slower) var(--basalt-ease-out)}@media(prefers-reduced-motion:reduce){.run-rail>.run-stage:after{transition:none!important}}:root[data-loops=held] .run-rail>.run-stage:after{transition:none!important}@media(forced-colors:active){.run-rail>.run-stage:before{border-color:GrayText}.run-rail>.run-stage:after{border-color:CanvasText}}.run-steps{display:grid;color:var(--basalt-text-secondary)}.run-steps>.run-step{position:relative;display:grid;grid-template-columns:var(--basalt-size-icon-sm) minmax(0,1fr) auto;align-items:start;column-gap:var(--basalt-space-3);padding-block:var(--basalt-space-2)}.run-steps>.run-step>.run-mark{margin-block-start:calc((var(--basalt-text-sm-line-height) - var(--basalt-size-icon-sm)) / 2)}.run-step-sentence{min-width:0;overflow-wrap:anywhere}.run-step:is([data-state=running],[data-state=queued]) .run-step-sentence{color:var(--basalt-text-primary)}.run-step-word{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-medium)}.run-step[data-state=failed] .run-step-word{color:var(--basalt-status-danger)}.run-step:is([data-state=skipped],[data-state=canceled]) .run-step-word{color:var(--basalt-text-tertiary);font-weight:var(--basalt-font-weight-regular)}.run-step-meta{justify-self:end;color:var(--basalt-text-tertiary);font-size:var(--basalt-text-xs-size);white-space:nowrap;font-variant-numeric:tabular-nums;text-align:end}.run-step-detail{grid-column:2 / -1;display:flex;flex-wrap:wrap;align-items:center;gap:var(--basalt-space-2) var(--basalt-space-3);padding-block-start:var(--basalt-space-2)}@container (width < 640px){.run-steps>.run-step{grid-template-columns:var(--basalt-size-icon-sm) minmax(0,1fr)}.run-step-meta{grid-column:2;justify-self:start;text-align:start;white-space:normal}}} +@layer basalt{.run-mark{display:inline-grid;flex:none;place-items:center;box-sizing:border-box;inline-size:var(--basalt-size-icon-sm);block-size:var(--basalt-size-icon-sm);vertical-align:middle}.run-mark>svg{display:block;inline-size:100%;block-size:100%}.run-mark:is([data-state=queued],[data-state=success]){color:var(--basalt-text-secondary)}.run-mark[data-state=queued]{animation:bh-run-breath var(--basalt-duration-loop-fade) var(--basalt-ease-in-out) infinite alternate}.run-mark[data-state=failed]{color:var(--basalt-status-danger)}.run-mark:is([data-state=skipped],[data-state=canceled]){color:var(--basalt-text-tertiary)}.run-mark:is([data-state=running],[data-state=retrying]){color:var(--basalt-text-primary)}.run-mark:is([data-state=running],[data-state=retrying]):before{content:"";box-sizing:border-box;align-self:stretch;justify-self:stretch;margin:var(--basalt-size-hairline);border:1.5px solid color-mix(in oklch,currentColor 25%,transparent);border-top-color:currentColor;border-radius:var(--basalt-radius-full);animation:bh-spin var(--basalt-duration-loop-ring) linear infinite}@keyframes bh-run-breath{0%{opacity:var(--basalt-opacity-queued)}to{opacity:1}}:root[data-loops=held] .run-mark{animation:none}@media(prefers-reduced-motion:reduce){.run-mark[data-state=queued]{animation:none}.run-mark:is([data-state=running],[data-state=retrying]):before{animation:bh-fade var(--basalt-duration-loop-fade) var(--basalt-ease-in-out) infinite}}:root[data-loops=held] .run-mark:before{animation:none}@media(forced-colors:active){.run-mark{color:inherit}.run-mark[data-state=queued]{animation:none}}@media print{.run-mark,.run-mark:before{animation:none}}.run-stages,.run-rail,.run-steps{--_cx: round(down, calc(var(--basalt-size-icon-sm) / 2 - var(--basalt-size-hairline) / 2), var(--basalt-size-hairline));--_ct: calc(var(--basalt-space-2) + var(--basalt-text-sm-line-height) / 2 + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-1));--_cb: calc(var(--basalt-size-icon-sm) / 2 + var(--basalt-space-1) - var(--basalt-space-2) - var(--basalt-text-sm-line-height) / 2);margin:0;padding:0;list-style:none;font:var(--basalt-font-weight-regular) var(--bh-sm);color:var(--basalt-text-primary);container-type:inline-size}.run-stages{display:grid;align-content:start}.run-stages>.run-stage{position:relative;display:grid;grid-template-columns:var(--basalt-size-icon-sm) auto minmax(0,1fr) auto auto;align-items:center;column-gap:var(--basalt-space-3);padding-block:var(--basalt-space-2)}.run-stage-name{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.run-stage-word{color:var(--basalt-text-secondary);white-space:nowrap}.run-stages .run-stage-word{margin-inline-start:calc(var(--basalt-space-2) - var(--basalt-space-3))}.run-stage:is([data-state=queued],[data-state=skipped],[data-state=canceled]) .run-stage-name{color:var(--basalt-text-secondary)}.run-stage:is([data-state=running],[data-state=retrying]) .run-stage-word{color:var(--basalt-text-primary)}.run-stage[data-state=failed] .run-stage-word{color:var(--basalt-status-danger);font-weight:var(--basalt-font-weight-medium)}.run-stage:is([data-state=queued],[data-state=skipped],[data-state=canceled]) .run-stage-word{color:var(--basalt-text-tertiary)}.run-stages>.run-stage[data-state=success]>.run-stage-word,.run-rail>.run-stage:is([data-state=queued],[data-state=running],[data-state=success])>.run-stage-word{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}.run-stage-meta{color:var(--basalt-text-tertiary);font-size:var(--basalt-text-xs-size);white-space:nowrap}:is(.run-stage-time,.run-step-time){min-inline-size:var(--basalt-space-12);text-align:end;font:var(--basalt-font-weight-regular) var(--basalt-text-xs-size) / var(--basalt-text-xs-line-height) var(--basalt-font-family-mono);font-variant-numeric:tabular-nums;color:var(--basalt-text-tertiary);white-space:nowrap}.run-stage-detail{grid-column:2 / -1;padding-block:var(--basalt-space-2) var(--basalt-space-1);color:var(--basalt-text-secondary)}.run-stage-detail :is(p,small){display:block;margin:0}.run-stage-detail small{color:var(--basalt-text-tertiary);font-size:var(--basalt-text-xs-size);line-height:var(--basalt-text-xs-line-height)}.run-stage-detail strong{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-medium)}.run-stage[data-state=failed] .run-stage-detail strong{color:var(--basalt-status-danger)}.run-stage-detail .btn{margin-block-start:var(--basalt-space-2)}:is(.run-stage,.run-step) code{padding:0;border-radius:0;background:none;font-family:var(--basalt-font-family-mono);font-size:inherit;line-height:1}.run-step-detail code{padding:var(--basalt-space-1) var(--basalt-space-2);border-radius:var(--basalt-radius-sm);background:var(--basalt-surface-sunken);color:var(--basalt-text-primary);line-height:var(--basalt-text-sm-line-height);overflow-wrap:anywhere}:is(.panel,.card,.callout,.code,.table-wrap) .run-step-detail code{background:var(--basalt-surface-well-2)}@container (width < 480px){.run-stages>.run-stage{grid-template-columns:var(--basalt-size-icon-sm) auto minmax(0,1fr) auto}.run-stages .run-stage-meta{display:none}}:is(.run-stages,.run-steps)>:is(.run-stage,.run-step):not(:last-child):after{content:"";position:absolute;inset-block:var(--_ct) var(--_cb);inset-inline-start:var(--_cx);border-inline-start:var(--basalt-size-hairline) solid var(--basalt-border-input)}.run-rail{display:grid;grid-auto-columns:minmax(0,1fr);grid-auto-flow:column}.run-rail>.run-stage{position:relative;display:grid;grid-template-columns:minmax(0,1fr);justify-items:center;align-content:start;text-align:center;padding-block-start:var(--basalt-space-1)}.run-rail>.run-stage>.run-mark{margin-block-end:var(--basalt-space-1)}.run-rail .run-stage-name{display:block;margin-block-start:var(--basalt-space-1);max-inline-size:100%}.run-rail .run-stage-word,.run-rail .run-stage-time{grid-row:3;grid-column:1;margin-block-start:var(--basalt-space-1);font-size:var(--basalt-text-xs-size);line-height:var(--basalt-text-xs-line-height);min-inline-size:0;text-align:center}.run-rail .run-stage:is([data-state=failed],[data-state=skipped],[data-state=canceled],[data-state=retrying]) .run-stage-time{visibility:hidden}.run-rail .run-stage-meta,.run-rail .run-stage-detail{display:none}.run-rail>.run-stage:not(:last-child):before,.run-rail>.run-stage:not(:last-child):after{content:"";position:absolute;inset-block-start:calc(var(--basalt-space-1) + var(--basalt-size-icon-sm) / 2);inset-inline-start:calc(50% + var(--basalt-size-icon-sm) / 2 + var(--basalt-space-2));inline-size:calc(100% - var(--basalt-size-icon-sm) - var(--basalt-space-4));border-block-start:var(--basalt-size-hairline) solid var(--basalt-border-input)}.run-rail>.run-stage:not(:last-child):after{border-block-start-color:var(--basalt-text-secondary);transform:scaleX(0);transform-origin:left}.run-rail>.run-stage:not(:last-child):dir(rtl):after{transform-origin:right}.run-rail>.run-stage[data-state=success]:not(:last-child):after{transform:scaleX(1);transition:transform var(--basalt-duration-slower) var(--basalt-ease-out)}@media(prefers-reduced-motion:reduce){.run-rail>.run-stage:after{transition:none!important}}:root[data-loops=held] .run-rail>.run-stage:after{transition:none!important}@media(forced-colors:active){.run-rail>.run-stage:before{border-color:GrayText}.run-rail>.run-stage:after{border-color:CanvasText}}@container (width < 480px){.run-rail:has(>.run-stage:nth-child(5))>.run-stage{grid-column:1;grid-template-columns:var(--basalt-size-icon-sm) minmax(0,1fr) auto;align-items:center;justify-items:stretch;column-gap:var(--basalt-space-3);padding-block:var(--basalt-space-2);text-align:start}.run-rail:has(>.run-stage:nth-child(5))>.run-stage>.run-mark{margin:0}.run-rail:has(>.run-stage:nth-child(5)) :is(.run-stage-name,.run-stage-word,.run-stage-time){grid-row:1;margin:0}.run-rail:has(>.run-stage:nth-child(5)) :is(.run-stage-word,.run-stage-time){grid-column:3;text-align:end}.run-rail:has(>.run-stage:nth-child(5))>.run-stage:not(:last-child):before{content:none}.run-rail:has(>.run-stage:nth-child(5))>.run-stage:not(:last-child):after{inset-block:var(--_ct) var(--_cb);inset-inline-start:var(--_cx);inline-size:0;border:0;border-inline-start:var(--basalt-size-hairline) solid var(--basalt-border-input);transform:none;transition:none}}.run-steps{display:grid;color:var(--basalt-text-secondary)}.run-steps>.run-step{position:relative;display:grid;grid-template-columns:var(--basalt-size-icon-sm) minmax(0,1fr) auto;align-items:start;column-gap:var(--basalt-space-3);padding-block:var(--basalt-space-2)}.run-steps>.run-step>.run-mark{margin-block-start:calc((var(--basalt-text-sm-line-height) - var(--basalt-size-icon-sm)) / 2)}.run-step-sentence{min-width:0;overflow-wrap:anywhere}.run-step:is([data-state=running],[data-state=queued],[data-state=retrying]) .run-step-sentence{color:var(--basalt-text-primary)}.run-step-word{color:var(--basalt-text-primary);font-weight:var(--basalt-font-weight-medium)}.run-step[data-state=failed] .run-step-word{color:var(--basalt-status-danger)}.run-step:is([data-state=skipped],[data-state=canceled]) .run-step-word{color:var(--basalt-text-tertiary);font-weight:var(--basalt-font-weight-regular)}.run-step-meta{justify-self:end;color:var(--basalt-text-tertiary);font-size:var(--basalt-text-xs-size);white-space:nowrap;font-variant-numeric:tabular-nums;text-align:end}.run-step-meta .run-step-time{min-inline-size:0;line-height:inherit}.run-step-detail{grid-column:2 / -1;display:flex;flex-wrap:wrap;align-items:center;gap:var(--basalt-space-2) var(--basalt-space-3);padding-block-start:var(--basalt-space-2)}@container (width < 640px){.run-steps>.run-step{grid-template-columns:var(--basalt-size-icon-sm) minmax(0,1fr)}.run-step-meta{grid-column:2;justify-self:start;text-align:start;white-space:normal}}} diff --git a/.agent/skills/basalt-html/parts/terminal.css b/.agent/skills/basalt-html/parts/terminal.css index 2622abdb..5f9e3dde 100644 --- a/.agent/skills/basalt-html/parts/terminal.css +++ b/.agent/skills/basalt-html/parts/terminal.css @@ -1 +1 @@ -@layer basalt{.terminal{container-type:inline-size}.terminal .code-head{flex-wrap:wrap;justify-content:space-between;gap:0 var(--basalt-space-3);min-height:var(--basalt-size-control-sm);padding:var(--basalt-space-1) var(--basalt-space-4);border-bottom:0;box-shadow:inset 0 calc(-1 * var(--basalt-size-hairline)) 0 var(--basalt-border-divider)}.terminal .code-body{box-sizing:border-box;padding:var(--basalt-space-3) var(--basalt-space-4);font:var(--basalt-font-weight-regular) var(--bh-sm-mono);white-space:pre;overflow:visible;overflow-x:auto;outline:none;border-radius:inherit}.terminal .code-body:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.terminal-lines{display:grid;grid-template-columns:minmax(calc(var(--basalt-size-icon-sm) + var(--basalt-space-2)),max-content) auto;width:max-content;min-width:100%;font:inherit}.terminal-line{display:grid;grid-template-columns:subgrid;grid-column:1 / -1;min-height:var(--basalt-size-code-line-height)}.terminal-gutter{padding-inline-end:1ch;color:var(--basalt-text-tertiary);-webkit-user-select:none;user-select:none}.terminal-text{min-width:0}.terminal-mark{display:block;margin-block:calc((var(--basalt-size-code-line-height) - var(--basalt-size-icon-sm)) / 2)}.terminal-line[data-kind=output]{color:var(--basalt-text-secondary)}.terminal-line[data-kind=error] .terminal-text{color:var(--basalt-status-danger)}.terminal-line[data-kind=done] .terminal-mark,.terminal-done{color:var(--basalt-status-success)}.terminal-line[data-kind=warning] .terminal-mark{color:var(--basalt-status-warning)}.terminal-line[data-kind=error] .terminal-mark,.terminal-failed{color:var(--basalt-status-danger)}.terminal-hint{grid-column:1 / -1;margin-inline-start:calc(var(--basalt-size-icon-sm) + var(--basalt-space-2));color:var(--basalt-text-tertiary)}.terminal-title{min-width:0}.terminal-actions{display:inline-flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:0 var(--basalt-space-2);max-width:100%;margin-inline-start:auto}.terminal-actions:has(.btn){margin-inline-end:calc(-1 * var(--basalt-space-2-5))}.terminal-state{display:inline-flex;font-weight:var(--basalt-font-weight-regular)}.terminal-state [data-error]{color:var(--basalt-status-danger)}.terminal-swap{display:inline-grid}.terminal-swap>*{grid-area:1 / 1;justify-self:end;display:inline-flex;align-items:center;gap:var(--basalt-space-1-5);white-space:nowrap}.terminal-swap>:not([data-on]){visibility:hidden}.terminal-actions .terminal-copy-compact{display:none}@container (width < 480px){.terminal-actions .terminal-copy{display:none}.terminal-actions .terminal-copy-compact{display:inline-flex}}.terminal[data-live] .code-body{block-size:calc(var(--basalt-size-code-line-height) * 9 + var(--basalt-space-3) * 2);overflow-y:auto;scrollbar-gutter:stable}.terminal-line[data-kind=stage] .terminal-gutter{display:flex;align-items:center}.terminal-braille{display:inline-flex;inline-size:var(--basalt-size-icon-sm);justify-content:center}.terminal-line[data-kind=stage]{color:var(--basalt-text-primary)}.terminal-line[data-kind=stage][data-state=done],.terminal-line[data-kind=stage][data-state=done] .terminal-mark{color:var(--basalt-text-secondary)}.terminal-line[data-kind=stage]:is([data-state=skipped],[data-state=canceled]),.terminal-line[data-kind=stage]:is([data-state=skipped],[data-state=canceled]) .terminal-mark{color:var(--basalt-text-tertiary)}.terminal-line[data-kind=stage][data-state=failed] :is(.terminal-mark,.terminal-text){color:var(--basalt-status-danger)}.terminal-stage{display:flex;justify-content:space-between;gap:var(--basalt-space-4)}.terminal-duration{flex:none;color:var(--basalt-text-tertiary);font-variant-numeric:tabular-nums}.terminal .code-body[data-stages]>.terminal-lines{width:100%}.terminal[data-live] .code-body{scrollbar-width:none;scrollbar-gutter:auto}.terminal[data-live] .code-body::-webkit-scrollbar{display:none}@media(forced-colors:active){.terminal .code-head{box-shadow:none;border-bottom:var(--basalt-size-hairline) solid CanvasText;padding-bottom:calc(var(--basalt-space-1) - var(--basalt-size-hairline))}.terminal-line[data-kind] .terminal-mark,.terminal .terminal-done,.terminal .terminal-failed,.terminal-line[data-kind=error] .terminal-text,.terminal-state [data-error]{color:CanvasText}}} +@layer basalt{.terminal{container-type:inline-size}.terminal .code-head{flex-wrap:wrap;justify-content:space-between;gap:0 var(--basalt-space-3);min-height:var(--basalt-size-control-sm);padding:var(--basalt-space-1) var(--basalt-space-4);border-bottom:0;box-shadow:inset 0 calc(-1 * var(--basalt-size-hairline)) 0 var(--basalt-border-divider)}.terminal .code-body{box-sizing:border-box;padding:var(--basalt-space-3) var(--basalt-space-4);font:var(--basalt-font-weight-regular) var(--bh-sm-mono);white-space:pre;overflow:visible;overflow-x:auto;outline:none;border-radius:inherit}.terminal .code-body:focus-visible{outline:var(--basalt-size-focus-width) solid var(--basalt-border-focus);outline-offset:var(--basalt-size-focus-offset)}.terminal-lines{display:grid;grid-template-columns:minmax(calc(var(--basalt-size-icon-sm) + var(--basalt-space-2)),max-content) auto;width:max-content;min-width:100%;font:inherit}.terminal-line{display:grid;grid-template-columns:subgrid;grid-column:1 / -1;min-height:var(--basalt-size-code-line-height)}.terminal-gutter{padding-inline-end:1ch;color:var(--basalt-text-tertiary);-webkit-user-select:none;user-select:none}.terminal-text{min-width:0}.terminal-mark{display:block;margin-block:calc((var(--basalt-size-code-line-height) - var(--basalt-size-icon-sm)) / 2)}.terminal-line[data-kind=output]{color:var(--basalt-text-secondary)}.terminal-line[data-kind=error] .terminal-text{color:var(--basalt-status-danger)}.terminal-line[data-kind=done] .terminal-mark,.terminal-done{color:var(--basalt-status-success)}.terminal-line[data-kind=warning] .terminal-mark{color:var(--basalt-status-warning)}.terminal-line[data-kind=error] .terminal-mark,.terminal-failed{color:var(--basalt-status-danger)}.terminal-hint{grid-column:1 / -1;margin-inline-start:calc(var(--basalt-size-icon-sm) + var(--basalt-space-2));color:var(--basalt-text-tertiary)}.terminal-title{min-width:0}.terminal-actions{display:inline-flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:0 var(--basalt-space-2);max-width:100%;margin-inline-start:auto}.terminal-actions:has(.btn){margin-inline-end:calc(-1 * var(--basalt-space-2-5))}.terminal-state{display:inline-flex;font-weight:var(--basalt-font-weight-regular)}.terminal-state [data-error]{color:var(--basalt-status-danger)}.terminal-swap{display:inline-grid}.terminal-swap>*{grid-area:1 / 1;justify-self:end;display:inline-flex;align-items:center;gap:var(--basalt-space-1-5);white-space:nowrap}.terminal-swap>:not([data-on]){visibility:hidden}.terminal-actions .terminal-copy-compact{display:none}@container (width < 480px){.terminal-actions .terminal-copy{display:none}.terminal-actions .terminal-copy-compact{display:inline-flex}}.terminal[data-live] .code-body{block-size:calc(var(--basalt-size-code-line-height) * 9 + var(--basalt-space-3) * 2);overflow-y:auto;scrollbar-gutter:stable}.terminal-line[data-kind=stage] .terminal-gutter{display:flex;align-items:center}.terminal-line[data-kind=stage] .terminal-mark{display:block;block-size:var(--basalt-size-icon-sm);margin-block:calc((var(--basalt-size-code-line-height) - var(--basalt-size-icon-sm)) / 2)}.terminal-line[data-kind=stage] .terminal-mark>svg{display:block}.terminal-braille{display:inline-flex;inline-size:var(--basalt-size-icon-sm);justify-content:center}.terminal-line[data-kind=stage]{color:var(--basalt-text-primary)}.terminal-line[data-kind=stage][data-state=done],.terminal-line[data-kind=stage][data-state=done] .terminal-mark{color:var(--basalt-text-secondary)}.terminal-line[data-kind=stage]:is([data-state=skipped],[data-state=canceled]),.terminal-line[data-kind=stage]:is([data-state=skipped],[data-state=canceled]) .terminal-mark{color:var(--basalt-text-tertiary)}.terminal-line[data-kind=stage][data-state=failed] :is(.terminal-mark,.terminal-text){color:var(--basalt-status-danger)}.terminal-stage{display:flex;justify-content:space-between;gap:var(--basalt-space-4)}.terminal-duration{flex:none;color:var(--basalt-text-tertiary);font-variant-numeric:tabular-nums}.terminal .code-body[data-stages]>.terminal-lines{width:100%}.terminal[data-live] .code-body{scrollbar-width:none;scrollbar-gutter:auto}.terminal[data-live] .code-body::-webkit-scrollbar{display:none}@media(forced-colors:active){.terminal .code-head{box-shadow:none;border-bottom:var(--basalt-size-hairline) solid CanvasText;padding-bottom:calc(var(--basalt-space-1) - var(--basalt-size-hairline))}.terminal-line[data-kind] .terminal-mark,.terminal .terminal-done,.terminal .terminal-failed,.terminal-line[data-kind=error] .terminal-text,.terminal-state [data-error]{color:CanvasText}}} diff --git a/.agent/skills/basalt-html/parts/terminal.js b/.agent/skills/basalt-html/parts/terminal.js index e93cec86..7eb963dd 100644 --- a/.agent/skills/basalt-html/parts/terminal.js +++ b/.agent/skills/basalt-html/parts/terminal.js @@ -1,2 +1,2 @@ -(function(b){"use strict";var k=b._,d=k.esc,f=k.icon,A='',F={done:["CheckCircle","Done"],warning:["Warning","Warning"],error:["XCircle","Error"]};function O(e){var i=function(t,n){return''+t.replace('aria-hidden="true" ',"")+""};return e==="done"?i('',"Done"):e==="failed"?f("XCircle",{size:16,label:"Failed"}).replace('class="icon"','class="icon terminal-mark"'):e==="skipped"?'':e==="canceled"?f("Prohibit",{size:16}).replace('class="icon"','class="icon terminal-mark"'):''}var W={skipped:"Skipped",canceled:"Canceled"};function w(e,i){return''+i.map(function(t){return""+t[1]+""}).join("")+"
    "}function q(e){return e.map(function(i){return[i,i]})}function X(e,i){if(e.kind==="stage"){var t=e.state||"running",n=e.word||W[t],o=document.createElement("span");return o.className="terminal-line",o.setAttribute("data-kind","stage"),o.setAttribute("data-state",t),o.innerHTML=''+O(t)+''+(n?''+d(n)+" ":"")+d(e.text)+""+(e.time?''+d(e.time)+"":"")+"",o}var g=F[e.kind],l=e.kind==="command"?'":g?f(g[0],{size:16,label:g[1]}).replace('class="icon"','class="icon terminal-mark"'):"",p=document.createElement("span");return p.className="terminal-line",p.setAttribute("data-kind",e.kind),p.innerHTML=''+l+''+d(e.text)+"",p}function E(e){if(!e||e.__bh)return;e.__bh=!0;var i=e.querySelector("figcaption"),t=e.querySelector("pre"),n=t&&t.querySelector("code");if(!i||!n)return;var o=i.textContent.trim(),g=e.getAttribute("data-prompt")||"$",l=e.hasAttribute("data-replay"),p=Number(e.getAttribute("data-interval"))||600,x=e.getAttribute("data-exit-code"),u=Array.prototype.map.call(n.querySelectorAll("[data-kind]"),function(a){return{kind:a.getAttribute("data-kind"),text:a.textContent,state:a.getAttribute("data-state"),word:a.getAttribute("data-word"),time:a.getAttribute("data-time")}}),P=e.hasAttribute("data-stages");P&&t.setAttribute("data-stages","");var S=u.filter(function(a){return a.kind==="command"}).map(function(a){return a.text}).join(` -`),G=u.length>0&&u[u.length-1].kind==="error",y="";if(l){var K=x==null||x===""?"Failed":"Failed, exit "+x;y+=''+w("idle",[["idle","Not started"],["running","Running"],["paused","Paused"],["done",f("CheckCircle",{size:16}).replace('class="icon"','class="icon terminal-done"')+"Done"],["failed",f("XCircle",{size:16}).replace('class="icon"','class="icon terminal-failed"')+''+d(K)+""]])+"",y+='"}var L=S?"":" disabled";y+='',i.classList.add("code-head"),i.innerHTML=''+d(o)+''+y+"",t.setAttribute("aria-label",o+", transcript"),n.className="terminal-lines",n.textContent="";var r=l?"idle":null,c=l?0:u.length,R=0,z=0,T=!0;t.addEventListener("scroll",function(){T=t.scrollHeight-t.scrollTop-t.clientHeight<2});function C(a,h,s){Array.prototype.forEach.call(a.children,function(Q,U){Q.toggleAttribute("data-on",s[U]===h)})}var Y=e.querySelector(".terminal-state .terminal-swap"),$=e.querySelector(".terminal-control .terminal-swap"),H=e.querySelector(".terminal-copy .terminal-swap"),N=e.querySelector('.terminal-actions [role="status"]'),v=e.querySelector(".terminal-copy-compact"),I=["idle","running","paused","done","failed"],J=["Play","Pause","Resume","Replay"];function m(){var a=n.querySelectorAll(".terminal-line").length;c=u.length){r=G?"failed":"done",m();return}var a=function(){c++,m(),M()};c===0?z=requestAnimationFrame(a):R=setTimeout(a,p)}}function _(){clearTimeout(R),cancelAnimationFrame(z)}l&&e.querySelector(".terminal-control").addEventListener("click",function(){r==="running"?(_(),r="paused",m()):r==="paused"?(r="running",m(),M()):(_(),T=!0,c=0,r="running",m(),M())});var j;function D(){!S||!b.copyText||b.copyText(S).then(function(a){a&&(C(H,"Copied",["Copy commands","Copied"]),v.innerHTML='',v.setAttribute("aria-label","Copied"),N.textContent="Copied",clearTimeout(j),j=setTimeout(function(){C(H,"Copy commands",["Copy commands","Copied"]),v.innerHTML=A,v.setAttribute("aria-label","Copy commands"),N.textContent=""},1500))})}e.querySelector(".terminal-copy").addEventListener("click",D),v.addEventListener("click",D),m()}function B(){document.querySelectorAll(".terminal").forEach(E)}b.terminal=E,k.step(50,"wireTerminals",B)})(window.Basalt); +(function(b){"use strict";var A=b._,d=A.esc,f=A.icon,w='',B={done:["CheckCircle","Done"],warning:["Warning","Warning"],error:["XCircle","Error"]};function O(e,r){var t=function(n,l){return"'+n.replace('aria-hidden="true" ',"")+""};return e==="done"?t('',"Done"):e==="failed"?t(f("XCircle",{size:16}),"Failed"):e==="skipped"?t(''):e==="canceled"?t(f("Prohibit",{size:16})):"'}var W={skipped:"Skipped",canceled:"Canceled"};function x(e,r){return''+r.map(function(t){return""+t[1]+""}).join("")+"
    "}function E(e){return e.map(function(r){return[r,r]})}function X(e,r){if(e.kind==="stage"){var t=e.state||"running",n=e.word||W[t],l=document.createElement("span");return l.className="terminal-line",l.setAttribute("data-kind","stage"),l.setAttribute("data-state",t),l.innerHTML=''+O(t,!!n)+''+(n?''+d(n)+" ":"")+d(e.text)+""+(e.time?''+d(e.time)+"":"")+"",l}var g=B[e.kind],s=e.kind==="command"?'":g?f(g[0],{size:16,label:g[1]}).replace('class="icon"','class="icon terminal-mark"'):"",u=document.createElement("span");return u.className="terminal-line",u.setAttribute("data-kind",e.kind),u.innerHTML=''+s+''+d(e.text)+"",u}function P(e){if(!e||e.__bh)return;e.__bh=!0;var r=e.querySelector("figcaption"),t=e.querySelector("pre"),n=t&&t.querySelector("code");if(!r||!n)return;var l=r.textContent.trim(),g=e.getAttribute("data-prompt")||"$",s=e.hasAttribute("data-replay"),u=Number(e.getAttribute("data-interval"))||600,S=e.getAttribute("data-exit-code"),p=Array.prototype.map.call(n.querySelectorAll("[data-kind]"),function(a){return{kind:a.getAttribute("data-kind"),text:a.textContent,state:a.getAttribute("data-state"),word:a.getAttribute("data-word"),time:a.getAttribute("data-time")}}),L=e.hasAttribute("data-stages");L&&t.setAttribute("data-stages","");var T=p.filter(function(a){return a.kind==="command"}).map(function(a){return a.text}).join(` +`),y=p[p.length-1],K=!!y&&(y.kind==="error"||y.kind==="stage"&&y.state==="failed"),C="";if(s){var Y=S==null||S===""?"Failed":"Failed, exit "+S;C+=''+x("idle",[["idle","Not started"],["running","Running"],["paused","Paused"],["done",f("CheckCircle",{size:16}).replace('class="icon"','class="icon terminal-done"')+"Done"],["failed",f("XCircle",{size:16}).replace('class="icon"','class="icon terminal-failed"')+''+d(Y)+""]])+"",C+='"}var R=T?"":" disabled";C+='',r.classList.add("code-head"),r.innerHTML=''+d(l)+''+C+"",t.setAttribute("aria-label",l+", transcript"),n.className="terminal-lines",n.textContent="";var i=s?"idle":null,c=s?0:p.length,z=0,H=0,M=!0;t.addEventListener("scroll",function(){M=t.scrollHeight-t.scrollTop-t.clientHeight<2});function k(a,h,o){Array.prototype.forEach.call(a.children,function(U,V){U.toggleAttribute("data-on",o[V]===h)})}var $=e.querySelector(".terminal-state .terminal-swap"),I=e.querySelector(".terminal-control .terminal-swap"),N=e.querySelector(".terminal-copy .terminal-swap"),_=e.querySelector('.terminal-actions [role="status"]'),v=e.querySelector(".terminal-copy-compact"),J=["idle","running","paused","done","failed"],Q=["Play","Pause","Resume","Replay"];function m(){var a=n.querySelectorAll(".terminal-line").length;c=p.length){i=K?"failed":"done",m();return}var a=function(){c++,m(),q()};c===0?H=requestAnimationFrame(a):z=setTimeout(a,u)}}function j(){clearTimeout(z),cancelAnimationFrame(H)}s&&e.querySelector(".terminal-control").addEventListener("click",function(){i==="running"?(j(),i="paused",m()):i==="paused"?(i="running",m(),q()):(j(),M=!0,c=0,i="running",m(),q())});var D;function F(){!T||!b.copyText||b.copyText(T).then(function(a){a&&(k(N,"Copied",["Copy commands","Copied"]),v.innerHTML='',v.setAttribute("aria-label","Copied"),_.textContent="Copied",clearTimeout(D),D=setTimeout(function(){k(N,"Copy commands",["Copy commands","Copied"]),v.innerHTML=w,v.setAttribute("aria-label","Copy commands"),_.textContent=""},1500))})}e.querySelector(".terminal-copy").addEventListener("click",F),v.addEventListener("click",F),m()}function G(){document.querySelectorAll(".terminal").forEach(P)}b.terminal=P,A.step(50,"wireTerminals",G)})(window.Basalt); diff --git a/.agent/skills/basalt-html/parts/usage/runs.md b/.agent/skills/basalt-html/parts/usage/runs.md index cf540231..647ad956 100644 --- a/.agent/skills/basalt-html/parts/usage/runs.md +++ b/.agent/skills/basalt-html/parts/usage/runs.md @@ -3,7 +3,7 @@ ```
    1. - Test Failed + TestFailed unit and e2e1.4 s

      3 tests failed in session.test.ts

      Exit 1
    @@ -12,6 +12,6 @@ A run's stages and steps as states (React's StageList, StageRail and RunTimeline's full rows). `data-state` is `queued`, `running`, `success`, `failed`, `skipped`, `canceled` or `retrying`, on the `li` and on its `.run-mark` (always `aria-hidden="true"`: the word says the state). - **Words:** write every state's word in `.run-stage-word` (a step's in `.run-step-word`). A list draws all but a passed stage's; a rail draws failed, skipped, canceled and retrying, in the place of the time; a step draws queued, failed, skipped, canceled and retrying, so a running or passed step's word goes in a `.visually-hidden` span. -- `
      ` takes the same `li` (two to four stages): the link fills when a stage passes. -- `
        ` of `
      1. `: the mark, `.run-step-sentence`, `.run-step-meta`, an optional `.run-step-detail`. A page shows the whole record: no counter. +- `
          ` takes the same `li`, word beside the name (two to four stages; five or six are rows under 480px): the link fills when a stage passes. +- `
            ` of `
          1. `: the mark, `.run-step-sentence`, `.run-step-meta` (its time in `.run-step-time`), an optional `.run-step-detail`. A page shows the whole record: no counter. - Times are text the page writes. A status that changes is the `status` module's badge, swapped at once. The ring and the queued mark join the hold. diff --git a/docs/foundations.md b/docs/foundations.md index e03d035e..df853e16 100644 --- a/docs/foundations.md +++ b/docs/foundations.md @@ -2713,7 +2713,8 @@ Work that runs in stages and reports as it goes: a deploy pipeline, a CI job lis only sign of anything. No bead and no pulse: the running ring is the rail's only moving thing. `Progress`'s value takes tabular figures and the room of "100%". - **`StageBadge`.** A `Badge` bound to the seven states (the pending ring, braille, the success, danger and neutral dots), `outline` in a run's - head and `plain` in a list or table. Its seat is as wide as its widest face from a static measure. A change of face is sequential: the old face + head and `plain` in a list or table. Its seat is as wide as its widest face from a static measure, and never narrower under width pressure; + its figures are tabular, so a changed digit changes no width. A change of face is sequential: the old face fades and rises `space-1` over 0.75 of `duration-base` on `ease-in`, then the new one fades in from `space-1` below over `duration-base` on `ease-out`. One accessible name at every moment. - **The deploy log** is a `Terminal` declared `stages`, with lines `{ kind: "stage", state, text, word?, start?, end? }`. The gutter holds braille @@ -2721,22 +2722,23 @@ Work that runs in stages and reports as it goes: a deploy pipeline, a CI job lis and `Prohibit` in tertiary when canceled. Skipped and canceled lines draw their word first ("Skipped cache restore (no cache)"). A duration stands at the line's end in tertiary, one column down the log. The head gains the run's time. A stage transcript is never a `log`: from its first frame its window is a named `region` (a `group` while empty) and the run's `RunAnnouncer` speaks. With `keep`, lines older than the - newest `keep` stages step back once (see Logs, status and forms). + newest `keep` stages step back once (see Logs, status and forms); a command never does. - **`RunTimeline` and the counter.** An append-only `ol` of steps, a sentence each: the mark, `space-3`, the sentence, the meta (a result, a - middle dot, the time), at `text-sm`. From 640px of its own container the meta ends on the row's end edge; under it the meta goes under the + middle dot, the time), at `text-sm`; the sentence is primary while the step runs, retries or waits, secondary once it has finished. From 640px of its own container the meta ends on the row's end edge; under it the meta goes under the sentence. A detail and an action are always drawn under a full step. `keep` (3 when left out; `false` is the whole record) is the counter: the newest `keep` steps stay in full and a finished step older than those rolls into the tail (a step running, retrying or waiting never rolls, and nothing after it does). A tail row is `text-xs` at 400, 20px, one line cut with an ellipsis, its mark still 16, no connector and no detail, its ink its depth's step (see Principles); everything it says stays in the accessibility tree. The window is the list's - scrolling box, its floor `keep` rows plus two and a half tail rows, only growing; it draws no scrollbar and is a named tab stop while it + scrolling box, its floor the larger of `keep` and `minRows` rows plus two and a half tail rows, only growing; it draws no scrollbar and is a named tab stop while it overflows. A roll moves the rows inside the window by transform over `duration-slow` on `ease-out`, the ink stepping on the same clock and the arrival fading over `duration-base`; past 48 counted rows it lands at once, as `Reflow` does. It follows new steps only while the reader is at its end (read from its geometry), holds still while a control in it has focus or the pointer, and starts at its end. The toggle above it ("Show 5 earlier steps", "Show 5 earlier steps, 1 failed"; open, "Hide earlier steps") holds its line from the first frame and opens the whole record in full form. Hover and focus lift the tail to its first step. Nothing here speaks. - **`RunTimer`.** Geist Mono at `text-xs`, tertiary, tabular, a `time` with an ISO duration, never a live region: "12.3 s" under a minute - (every 100ms), "12 min 34 s" to an hour, "12 hr 34 min" to a day, then "3 days". One shared interval. Its seat is one `Reserve` cell as wide as - its scale's longest form, end-aligned and never empty; a list sets one scale for all its timers. It counts from `start`, is frozen at `end`, + (every 100ms), "12 min 34 s" to an hour, "12 hr 34 min" to a day, then "3 days". One shared interval. Its seat is one `Reserve` cell as wide as its scale's longest form and never empty, the figure end-aligned in a column, centred under a rail's node and + start-aligned right after a `Terminal` head's state word; a list sets one scale for all its timers. A run's head seat also holds today's held form + ("Started 12:59 PM"); a run that started on another day widens it once when the hold is pressed, as a time that outgrows its scale does. It counts from `start`, is frozen at `end`, adds `carried` across a retry, and its held form reads from `since`. A run's time counts while it runs, retries or waits for an approval, and is frozen while it has failed, is canceled or has passed. - **`RunAnnouncer`.** One a run: a visually hidden `role="log"`, polite, additions only, each event its own appended element, said once and in @@ -2838,7 +2840,7 @@ implementation hasn't been reviewed by the panel). Candidates D14a, D14b, D15, X - **A log line's fields** (V1, V2; `LogFields`, `LogLine`, `Terminal`'s `fields`). The fields that say what happened are primary ink at 400 and the rest secondary at 400. Nothing steps back with age, with one exception: in a `Terminal` given `keep`, a stage line older than the - newest `keep` stage lines, and the output under it, is `text-tertiary` (a failed one `status-danger` at `opacity-recede-danger`). That is one + newest `keep` stage lines, and the output under it (never a command), is `text-tertiary` (a failed one `status-danger` at `opacity-recede-danger`). That is one step and it is 4.5:1 on every surface; a transcript never goes below it, because it has no open form to switch to. A refused field stays primary and its own word ("denied") says it: no colour. A refused command's status word is primary at 500 beside `exit N`. A line may be a node; copy still takes the plain text. - **The command block** (`CommandBlock`; R1 to R3): a sticky head, opaque in the page colour, over the output. The core chevron, the command at 500 in primary ink, then diff --git a/packages/react/src/run-stage.tsx b/packages/react/src/run-stage.tsx index 8e21ae27..e8a9c055 100644 --- a/packages/react/src/run-stage.tsx +++ b/packages/react/src/run-stage.tsx @@ -42,6 +42,9 @@ const DRAWN: Record<"list" | "rail", Record> = { rail: { queued: false, running: false, success: false, failed: true, skipped: true, canceled: true, retrying: true }, }; +/** Whether a slot holds something drawn: `null`, `false`, `true` and "" (what `cond &&
          2. ); } diff --git a/packages/react/src/run-timeline.tsx b/packages/react/src/run-timeline.tsx index 3b2997c0..92ad2276 100644 --- a/packages/react/src/run-timeline.tsx +++ b/packages/react/src/run-timeline.tsx @@ -9,7 +9,7 @@ import { useLoops } from "./loops"; import { useReducedMotion } from "./motion"; import { STAGE_WORDS } from "./run-format"; import type { Moment, RunTimeScale, StageState } from "./run-format"; -import { useFocusHome } from "./run-stage"; +import { rendered, useFocusHome } from "./run-stage"; import { RunTimer, useRunTimeScale } from "./run-timer"; import { warnRun } from "./run-warn"; import { StageMark } from "./stage-mark"; @@ -86,8 +86,9 @@ export function RunStep({ state, mark, word, children, meta, start, end, detail, const said = word ?? (state ? STAGE_WORDS[state] : undefined); const drawn = word !== undefined || (state !== undefined && (tail ? DRAWN_TAIL : DRAWN_FULL)[state]); const sentence = React.useRef(null); - const hasDetail = detail !== undefined || action !== undefined; - const track = useFocusHome(hasDetail ? (action === undefined ? 1 : 2) : 0, sentence); + const hasAction = rendered(action); + const hasDetail = rendered(detail) || hasAction; + const track = useFocusHome(hasDetail ? (hasAction ? 2 : 1) : 0, sentence); return (
          3. @@ -107,7 +108,7 @@ export function RunStep({ state, mark, word, children, meta, start, end, detail, {hasDetail ? ( ) : null}
          4. @@ -143,6 +144,8 @@ export function RunTimeline({ label, keep: keepProp, minRows, timeScale = "secon let rolled = 0; if (counter) for (let i = 0; i < steps.length - (keep as number) && !unfinished(steps[i]!.props.state); i += 1) rolled = i + 1; const tailShown = counter && !open; + // The floor's row count is the larger of `keep` and `minRows` (DECISIONS 316, ruling 11). + const floorRows = counter ? Math.max(keep as number, minRows ?? 0, 1) : 0; const windowRef = React.useRef(null); const listRef = React.useRef(null); @@ -161,13 +164,24 @@ export function RunTimeline({ label, keep: keepProp, minRows, timeScale = "secon if (held() && rolled > lastRolled.current) rolled = lastRolled.current; lastRolled.current = rolled; const failed = steps.slice(0, rolled).filter((step) => step.props.state === "failed").length; + // Whether the reader is at the end is theirs to say: a scroll the window made itself (following, or keeping a control still) and a scroll + // while a roll is in flight (its transforms are clipped, but its rows are still landing) never change it. A reader's scroll does, read + // from geometry when it happens, and so does a scroll the reader made in the same task as an arrival (read just before the change). + const lastSet = React.useRef(null); + const rolling = React.useRef(0); + const atEnd = (el: HTMLElement) => el.scrollHeight - el.scrollTop - el.clientHeight <= 2; const onScroll = () => { const el = windowRef.current; - if (el) following.current = el.scrollHeight - el.scrollTop - el.clientHeight <= 2; + if (!el || rolling.current > 0) return; + if (lastSet.current !== null && Math.abs(el.scrollTop - lastSet.current) < 1) return; + following.current = atEnd(el); + lastSet.current = null; }; + const setTop = (el: HTMLElement, top: number) => { el.scrollTop = top; lastSet.current = el.scrollTop; }; const toEnd = React.useCallback(() => { const el = windowRef.current; - if (el && following.current && !held()) el.scrollTop = el.scrollHeight; + if (el && following.current && !held()) setTop(el, el.scrollHeight); + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); // ---- the floor that only grows: the newest `keep` full rows and two and a half tail rows, measured once a step is taller than a row @@ -179,14 +193,20 @@ export function RunTimeline({ label, keep: keepProp, minRows, timeScale = "secon if (!el || !list || !tailShown) return; const full = [...list.children].filter((li) => !li.hasAttribute("data-tail")).slice(-(keep as number)); const rows = full.reduce((sum, li) => sum + (li as HTMLElement).offsetHeight, 0); - // A tail row's height from its tokens (text-xs's line and space-0-5 twice), so the floor counts it before the first roll. + // The floor's own rows and a tail row from their tokens (a row: text-sm's line and space-2 twice, and a second line under 640px of the + // timeline's width; a tail row: text-xs's line and space-0-5 twice), so a slot no step has filled yet keeps its room, and the floor counts + // the tail before the first roll. An early tall step then grows the window once, by its own extra height, and later rows move nothing. const root = getComputedStyle(document.documentElement); - const tailRow = Number.parseFloat(root.getPropertyValue("--basalt-text-xs-line-height")) + 2 * Number.parseFloat(root.getPropertyValue("--basalt-space-0-5")); - const want = Math.ceil(rows + tailRow * 2.5); + const token = (name: string) => Number.parseFloat(root.getPropertyValue(name)) || 0; + const narrow = (el.parentElement?.clientWidth ?? el.clientWidth) < token("--basalt-size-breakpoint-container-lg"); + const row = token("--basalt-text-sm-line-height") * (narrow ? 2 : 1) + 2 * token("--basalt-space-2"); + const tailRow = token("--basalt-text-xs-line-height") + 2 * token("--basalt-space-0-5"); + const slots = Math.max(0, floorRows - full.length); + const want = Math.ceil(rows + slots * row + tailRow * 2.5); if (want > grown.current) { grown.current = want; el.style.setProperty("--_grown", `${want}px`); } setOverflows(el.scrollHeight > el.clientHeight + 1); toEnd(); - }, [tailShown, keep, toEnd]); + }, [tailShown, keep, toEnd, floorRows]); // ---- the roll: where each row was drawn before this change, read before React writes the DOM const shape = `${steps.length}:${rolled}:${open}`; @@ -194,6 +214,9 @@ export function RunTimeline({ label, keep: keepProp, minRows, timeScale = "secon const before = React.useRef | null>(null); const controlAt = React.useRef<[Element, number] | null>(null); if (listRef.current && before.current === null) { + const win = windowRef.current; + // A reader who scrolled away in this same task, before any scroll event could say so, is not followed. + if (win && rolling.current === 0 && lastSet.current !== null && win.scrollTop < lastSet.current - 1 && !atEnd(win)) { following.current = false; lastSet.current = null; } const control = held(); controlAt.current = control ? [control, control.getBoundingClientRect().top] : null; if (shape !== lastShape.current) { @@ -208,7 +231,7 @@ export function RunTimeline({ label, keep: keepProp, minRows, timeScale = "secon // A control the reader is using stays where it was: the window scrolls by whatever moved it. const kept = controlAt.current; controlAt.current = null; - if (kept && kept[0].isConnected && windowRef.current) windowRef.current.scrollTop += kept[0].getBoundingClientRect().top - kept[1]; + if (kept && kept[0].isConnected && windowRef.current) setTop(windowRef.current, windowRef.current.scrollTop + kept[0].getBoundingClientRect().top - kept[1]); const from = before.current; before.current = null; const changed = shape !== lastShape.current; @@ -218,7 +241,7 @@ export function RunTimeline({ label, keep: keepProp, minRows, timeScale = "secon if (!changed || !from || !list) return; const arrivals = [...list.children].filter((li) => !from.has(li)) as HTMLElement[]; // An arrival fades in (100ms under reduced motion), whatever else happens; the hold lands it at once. - if (!loopsHeld) for (const li of arrivals) li.animate([{ opacity: 0 }, { opacity: 1 }], { duration: tokenMs(li, reduced ? "--basalt-duration-fast" : "--basalt-duration-base"), easing: getComputedStyle(li).getPropertyValue("--basalt-ease-out").trim() || "ease-out" }); + if (!loopsHeld) for (const li of arrivals) track(li.animate([{ opacity: 0 }, { opacity: 1 }], { duration: tokenMs(li, reduced ? "--basalt-duration-fast" : "--basalt-duration-base"), easing: getComputedStyle(li).getPropertyValue("--basalt-ease-out").trim() || "ease-out" }), false); if (!el || open || !counter) return; // Only rows the window shows are moved; counted as Reflow counts them, and past its one bound the roll lands at once. const box = el.getBoundingClientRect(); @@ -238,9 +261,30 @@ export function RunTimeline({ label, keep: keepProp, minRows, timeScale = "secon requestAnimationFrame(() => requestAnimationFrame(() => el.removeAttribute("data-landing"))); return; } - for (const [li, dy] of moves) li.animate([{ transform: `translateY(${dy}px)` }, { transform: "translateY(0)" }], { duration: tokenMs(li, "--basalt-duration-slow"), easing: getComputedStyle(li).getPropertyValue("--basalt-ease-out").trim() || "ease-out" }); + for (const [li, dy] of moves) track(li.animate([{ transform: `translateY(${dy}px)` }, { transform: "translateY(0)" }], { duration: tokenMs(li, "--basalt-duration-slow"), easing: getComputedStyle(li).getPropertyValue("--basalt-ease-out").trim() || "ease-out" }), true); }); + // ---- the animations in flight: a roll's rows are clipped to the list while they move (so their transforms never stretch the scrollable + // box), and the hold or a change to reduced motion takes every one away at once, leaving each row where it rests. + const flying = React.useRef(new Set()); + function track(animation: Animation, roll: boolean) { + flying.current.add(animation); + const el = windowRef.current; + if (roll) { rolling.current += 1; el?.setAttribute("data-rolling", ""); } + const done = () => { + if (!flying.current.delete(animation)) return; + if (!roll) return; + rolling.current -= 1; + if (rolling.current === 0) { windowRef.current?.removeAttribute("data-rolling"); toEnd(); } + }; + animation.addEventListener("finish", done); + animation.addEventListener("cancel", done); + } + React.useEffect(() => { + if (!loopsHeld && !reduced) return; + for (const animation of [...flying.current]) animation.cancel(); + }, [loopsHeld, reduced]); + // Every change of the content's height keeps the end while the reader is at it: a result or a time landing, a detail, a face loading, the width. React.useEffect(() => { const el = windowRef.current; @@ -267,7 +311,6 @@ export function RunTimeline({ label, keep: keepProp, minRows, timeScale = "secon const list =
              {provide(items)}
            ; if (!counter) return
            {list}
            ; - const floorRows = Math.max(minRows ?? (keep as number), 1); return (
            {/* The toggle's line is held from the first frame and empty until a step has rolled, so its arrival moves nothing. */} diff --git a/packages/react/src/run-timer.tsx b/packages/react/src/run-timer.tsx index 4a2886cd..6b4c2649 100644 --- a/packages/react/src/run-timer.tsx +++ b/packages/react/src/run-timer.tsx @@ -76,13 +76,34 @@ export interface RunTimerProps { className?: string; } -/** Room for both held forms: the same day, and another day, at their widest. */ -function heldSamples(locale: string | undefined) { - const sample = new Date(2026, 11, 30, 12, 59); - const clock = formatClock(sample, { locale }).text; - const day = formatDay(sample, { now: sample, locale }).text; - return { held: `Started ${clock}`, heldDay: `Started ${day}, ${clock}` }; +/** + * Room for the held form of a run that started today, at its widest ("Started 12:59 PM"). A run that started on another day widens the seat once + * when the hold is pressed, as a time that outgrows its scale does (DECISIONS 316, ruling 6): the dated form is not held from the first frame. + */ +function heldSample(locale: string | undefined) { + return { heldSeat: `Started ${formatClock(new Date(2026, 11, 30, 12, 59), { locale }).text}` }; +} + +// ---- printing: a page being printed is held, so a running time prints the form the hold shows (DECISIONS 316, 1.11). The print media and the +// browser's own beforeprint are listened to by the first reader, never at import. +let printReaders: Set<() => void> | undefined; +let printQuery: MediaQueryList | undefined; +let printingNow = false; +function subscribePrint(notify: () => void) { + if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {}; + if (!printReaders) { + printReaders = new Set(); + printQuery = window.matchMedia("print"); + const tell = () => { for (const n of printReaders ?? []) n(); }; + printQuery.addEventListener("change", tell); + window.addEventListener("beforeprint", () => { printingNow = true; tell(); }); + window.addEventListener("afterprint", () => { printingNow = false; tell(); }); + } + printReaders.add(notify); + return () => { printReaders?.delete(notify); }; } +const printing = () => printingNow || (printQuery?.matches ?? false); +const usePrinting = () => React.useSyncExternalStore(subscribePrint, printing, () => false); function heldText(since: number, now: number, locale: string | undefined) { const clock = formatClock(since, { locale }); @@ -98,13 +119,19 @@ function heldText(since: number, now: number, locale: string | undefined) { export function RunTimer({ start, end, carried = 0, since, scale: own = "seconds", whenHeld = "started", locale, format, className }: RunTimerProps) { const list = React.useContext(RunTimeScaleContext); const scale = list?.scale ?? own; - const { held } = useLoops(); + const { held: loopsHeld } = useLoops(); + const inPrint = usePrinting(); + const held = loopsHeld || inPrint; const running = start !== undefined && end === undefined; const [now, setNow] = React.useState(() => Date.now()); + // The shared interval asks every 100ms; the timer draws again only when its written figure changes (every 100ms under a minute, by the + // second to an hour, by the minute after). + const textAt = React.useRef<(t: number) => string>(() => ""); + const shown = React.useRef(""); React.useEffect(() => { if (!running || held) return; setNow(Date.now()); - return subscribe(() => setNow(Date.now())); + return subscribe(() => { const t = Date.now(); if (textAt.current(t) !== shown.current) setNow(t); }); }, [running, held]); if (process.env.NODE_ENV !== "production" && carried && since === undefined) warnRun("RunTimer", "`carried` is given without `since`: the held form would show when this attempt started, not when the work first did."); @@ -113,6 +140,8 @@ export function RunTimer({ start, end, carried = 0, since, scale: own = "seconds const ms = from === undefined ? 0 : (end === undefined ? now : new Date(end).getTime()) - from + carried; const length = formatRunTime(ms); const text = from === undefined ? "\u00a0" : format ? format(ms) : length.text; + textAt.current = (t) => { if (from === undefined) return "\u00a0"; const at = (end === undefined ? t : new Date(end).getTime()) - from + carried; return format ? format(at) : formatRunTime(at).text; }; + shown.current = text; // A time that outgrows its scale is written whole; the list widens every seat together. const needed = from === undefined ? scale : scaleFor(ms); @@ -130,7 +159,7 @@ export function RunTimer({ start, end, carried = 0, since, scale: own = "seconds const heldForm = showHeld && first !== undefined ? heldText(new Date(first).getTime(), now, locale) : null; const alternatives: Record = { time: text, widest: format ? format(scale === "seconds" ? 59_900 : scale === "minutes" ? 3_599_000 : 86_340_000) : WIDEST[scale] }; - if (startedForm) Object.assign(alternatives, heldSamples(locale)); + if (startedForm) Object.assign(alternatives, heldSample(locale)); if (heldForm) alternatives[heldForm.show] = heldForm.text; return (
            {run.stages.map((s, i) => ( @@ -220,7 +232,7 @@ function ReleaseRail({ state }: { state: string }) { {run.nodes.map((n) => )}
            - `${done} of 4 stages`} /> + `${done} of 4 stages`} />
            @@ -253,13 +265,13 @@ function logSteps(): Step[] { } const LOG_STEPS = logSteps(); -function DeployLog({ state }: { state: string }) { +function DeployLog({ state, fixed = false }: { state: string; fixed?: boolean }) { useHeldState(state); const name = state.replace(/-(reduced-motion|forced-colours|more-contrast)$/, ""); - const { state: run, play } = useRun(LOG_START, LOG_STEPS, name === "passed" ? LOG_STEPS.length - 1 : LOG_STEPS.length - 3); + const { state: run, play } = useRun(LOG_START, LOG_STEPS, name === "passed" ? LOG_STEPS.length - 1 : LOG_STEPS.length - 3, { fixed }); return (
            -
            + {fixed ? null :
            }
            @@ -333,10 +345,10 @@ function agentSteps(): Step[] { const AGENT_STEPS = agentSteps(); const AGENT_POSES: Record = { default: 10, waiting: 10, end: AGENT_STEPS.length - 1, open: AGENT_STEPS.length - 1, hover: AGENT_STEPS.length - 1 }; -function AgentRun({ state }: { state: string }) { +function AgentRun({ state, fixed = false }: { state: string; fixed?: boolean }) { useHeldState(state); const name = state.replace(/-(reduced-motion|forced-colours|more-contrast)$/, "").replace(/^held-?/, "") || "default"; - const { state: run, play, setState } = useRun(AGENT_START, AGENT_STEPS, AGENT_POSES[name] ?? 10, { played: name === "played-end" }); + const { state: run, play, setState } = useRun(AGENT_START, AGENT_STEPS, AGENT_POSES[name] ?? 10, { played: name === "played-end", fixed }); const { held } = useLoops(); const approve = () => new Promise((resolve) => window.setTimeout(() => { setState((s) => ({ ...s, items: s.items.map((x) => (x.id === "approve" ? { ...x, state: "success" as StageState, word: "Approved by you", end: Date.now(), approval: false } : x)) })); resolve(); }, 300)); return ( @@ -345,7 +357,7 @@ function AgentRun({ state }: { state: string }) {

            INC-0042 · Payments API latency

            - + {fixed ? null : } {/* The app's step line hides under the hold (foundations: a streaming line hides while the status word stays). */} @@ -382,79 +394,60 @@ function States({ state }: { state: string }) { } // ---- The five departures from the prototype the owner confirmed, each before (the prototype) and after (this build), for his eye (DECISIONS 316). +// Each pair is stacked, before above after, and each picture is drawn at its own size (a 2x capture at half its pixels), so the prototype's words are +// as large as the build's. Under 720 the pictures are the prototype at 390. const BEFORE = { tail: { "dark-1440": tailDark1440, "dark-390": tailDark390, "light-1440": tailLight1440, "light-390": tailLight390 }, - log: { dark: logDark, light: logLight }, - queued: { dark: queuedDark, light: queuedLight }, - connector: { dark: connectorDark, light: connectorLight }, + log: { "dark-1440": logDark, "dark-390": logDark390, "light-1440": logLight, "light-390": logLight390 }, + queued: { "dark-1440": [queuedDark1440Rest, queuedDark1440Low], "dark-390": [queuedDark390Rest, queuedDark390Low], "light-1440": [queuedLight1440Rest, queuedLight1440Low], "light-390": [queuedLight390Rest, queuedLight390Low] }, + connector: { "dark-1440": connectorDark, "dark-390": connectorDark390, "light-1440": connectorLight, "light-390": connectorLight390 }, held: { "dark-1440": heldDark1440, "dark-390": heldDark390, "light-1440": heldLight1440, "light-390": heldLight390 }, }; +type Key = "dark-1440" | "dark-390" | "light-1440" | "light-390"; const themeOf = (): "dark" | "light" => (typeof document !== "undefined" && document.documentElement.getAttribute("data-theme") === "light" ? "light" : "dark"); const narrow = () => typeof window !== "undefined" && window.innerWidth < 720; -function Pair({ title, text, before, children }: { title: string; text: string; before: string; children: React.ReactNode }) { +/** A 2x capture drawn at its own size: half its pixels, never wider than the column. */ +function Capture({ src, alt }: { src: string; alt: string }) { + const [width, setWidth] = React.useState(undefined); + return {alt} setWidth(e.currentTarget.naturalWidth / 2)} style={{ display: "block", width, maxWidth: "100%", height: "auto", borderRadius: 8 }} />; +} + +const caption: React.CSSProperties = { font: "500 12px / 16px var(--basalt-font-family-sans)", color: "var(--basalt-text-secondary)" }; +function Pair({ title, text, before, children }: { title: string; text: string; before: React.ReactNode; children: React.ReactNode }) { return ( -
            +

            {title}

            {text}

            -
            -
            -
            Before: the prototype you confirmed
            - {`${title}: -
            -
            -
            After: this build
            - {children} -
            -
            +
            Before: the prototype you confirmed
            {before}
            +
            After: this build
            {children}
            ); } -const T = Date.now() - 20_000; -const TAIL_STEPS = [ - ["Read", "deploy/payments-api.yaml", "84 lines", "success"], ["Queried", "p99 latency · payments-api · 2 h", "p99 1.8 s since 14:05", "success"], ["Searched logs for", "\"pool timeout\"", "Timed out after 10 s", "failed"], - ["Listed deploys of", "payments-api", "4f2a1c0 at 14:02", "success"], ["Ran", "kubectl rollout undo deployment/payments-api", "Rolled back to 4f29e0b", "success"], ["Queried", "p99 latency · last 10 min", "p99 240 ms", "success"], -] as const; - function Departures() { const [theme, setTheme] = React.useState(themeOf); React.useEffect(() => { const o = new MutationObserver(() => setTheme(themeOf())); o.observe(document.documentElement, { attributeFilter: ["data-theme"] }); return () => o.disconnect(); }, []); - const w = narrow() ? "390" : "1440"; - const t = Date.now(); + const key: Key = `${theme}-${narrow() ? "390" : "1440"}`; + const [rest, low] = BEFORE.queued[key] as [string, string]; return (
            - - - - {TAIL_STEPS.map(([verb, arg, result, st], i) => {verb} {arg})} - - + }> + - - + }> + - - - {[1, 0.65].map((o) =>
            Queued{o === 1 ? "at rest" : "at 65%"}
            )} -
            +
            }> +
            + {[1, 0.65].map((o) =>
            Queued
            )} +
            - - - - {(["Clone", "Install", "Build"] as const).map((n, i) => )} -

            3 tests failed in session.test.ts

            Exit 1 · attempt 1 of 2} action={} /> - - -
            -
            + }> + - + }> @@ -479,7 +472,7 @@ function HeldRail() { } const COMMON = [ - "Decided by the council for the owner's handoff (DECISIONS 302, 304, 307, 312 and 316); built by Opus from the decision. Not reviewed: no panel or council member has read the build.", + "Decided by the council for the owner's handoff (DECISIONS 302, 304, 307, 312 and 316); built by Opus from the decision. Reviewed by the council: the code by Astra, the pixels by Fable (twice), and fixed after each. Not checked: no screen reader was heard, and WebKit was not opened by the pixel review. Waiting for the owner.", "Every class begins basalt-run- (Stage and .stage are the art's). Each run has one voice, RunAnnouncer: every event once, in order; never a timer, a roll or a passed stage.", ]; @@ -488,7 +481,7 @@ export const ROUND_67: Round = { title: "Stage animations (DECISIONS 316)", reviewed: false, summary: - "The owner's confirmed stage animations, built to the council's decision (DECISIONS 316): StageMark (seven states, the queued breath), StageBadge (a face that changes in place), RunTimer, RunAnnouncer, StageList and StageRail with RunStage, Terminal's declared stage transcript, and RunTimeline with the counter. Five departures from the confirmed prototype are for the owner's eye: the tail goes below 4.5:1 with the toggle as the way back; the deploy log steps back once; the queued mark breathes from 65% in secondary ink; the connector no longer fills or breaks; under the hold a stage's own time hides and the head shows when the run started. Not reviewed.", + "The owner's confirmed stage animations, built to the council's decision (DECISIONS 316): StageMark (seven states, the queued breath), StageBadge (a face that changes in place), RunTimer, RunAnnouncer, StageList and StageRail with RunStage, Terminal's declared stage transcript, and RunTimeline with the counter. Five departures from the confirmed prototype are for the owner's eye: the tail goes below 4.5:1 with the toggle as the way back; the deploy log steps back once; the queued mark breathes from 65% in secondary ink; the connector no longer fills or breaks; under the hold a stage's own time hides and the head shows when the run started. Reviewed by the council: the code by Astra, the pixels by Fable (twice), and fixed after each. Not checked: no screen reader was heard, and WebKit was not opened by the pixel review. Waiting for the owner.", steps: [ { id: "departures", @@ -537,7 +530,7 @@ export const ROUND_67: Round = { intro: "A Terminal declared `stages`: never a log, braille in the gutter while a stage runs, a duration column at the end of each line, and the lines older than the newest three stages stepped back once (departure 2).", decisions: [...COMMON, "No scrollbar on a live window, on either axis, from its first frame. Skipped and canceled draw their word first; a failed line is the error line."], tryIt: ["Scroll the log with the keys (Home, End, the arrows): no bar is drawn, with a mouse plugged in too."], - states: ["default", "passed", "held", "default-more-contrast@1440"], + states: ["default", "passed", "held", "default@320", "held@320", "default-more-contrast@1440"], widths: W, scales: [2], height: 440, From be2692fc8b2b91034d9f3c5368d272c65d9c71d2 Mon Sep 17 00:00:00 2001 From: bailey <74082460+bmjcoding@users.noreply.github.com> Date: Mon, 23 Nov 2026 19:35:38 -0600 Subject: [PATCH 11/13] Reserved room (DECISIONS 326): the round 67 fix sweep The ruling's table: - StageBadge: each outline face hugs its words at the seat's start; the seat stays the widest face. - Button: a text toggle's seat holds its glyph at rest and, pressed, the glyph's selected form or the core check, crossfading over duration-fast. `pressed` needs `icon` (a type error, and one development warning); an untyped toggle with no icon keeps the old seat. LoopsToggle's Button form carries PauseGlyph. Old review rounds write aria-pressed so they render as they did. - Button amount ends its seat (justify-items: end). - The skill: `.btn-check[data-glyph]` draws its glyph at rest and the check while pressed (glyph.js draws into a seat instead of replacing it); toggle and loops usage, topbar-nav's menu row and the diagram's pause carry the pause glyph; an empty .btn-check draws as before. - StageList reserveDetail is off by default (67-3). - Terminal head from 480px: title, state ... time, Copy; under 480px the words sit 15 from the head's edges and the copy glyph is on the padding line (67-5, 67-6). - RunTimeline: no dot drawn before a step's time where the meta is at the row's end (67-7). - Round 67: one head grammar under 720 with the icon hold (67-4), the CI list's last row (67-8), the Replay row's edge (67-9), the intro's held-room sentence dropped (67-3). - Foundations' Reserved room item, the pressed-toggle, StageBadge and StageList text, and AGENTS.md's line. Tests written per the ruling; browser tests are paused (DECISIONS 330), so only node-only files ran. Bundle limits and three skill caps rise by the measured growth. Co-Authored-By: Claude Opus 5.5 --- .agent/skills/basalt-html/SKILL.md | 2 +- .../basalt-html/parts/diagram-motion.js | 2 +- .agent/skills/basalt-html/parts/glyph.js | 2 +- .agent/skills/basalt-html/parts/manifest.json | 18 ++- .agent/skills/basalt-html/parts/toggle.css | 2 +- .agent/skills/basalt-html/parts/topbar-nav.js | 2 +- .../skills/basalt-html/parts/usage/loops.md | 4 +- .../skills/basalt-html/parts/usage/toggle.md | 4 +- AGENTS.md | 2 + docs/foundations.md | 25 ++-- packages/react/src/button.tsx | 36 ++++- packages/react/src/loops-toggle-button.tsx | 5 +- packages/react/src/stage-badge.tsx | 3 +- packages/react/src/stage-list.tsx | 7 +- packages/react/src/styles/components.css | 64 +++++++-- packages/react/test/bundle.test.mjs | 15 ++- packages/react/test/display-states.test.mjs | 127 ++++++++++++++++++ packages/react/test/export-sizes.json | 60 ++++----- packages/react/test/fixtures/capabilities.tsx | 6 +- packages/react/test/run-timeline.test.mjs | 15 +++ packages/react/test/stage-badge.test.mjs | 29 +++- packages/react/test/stage-list.test.mjs | 30 ++++- packages/react/test/stage-transcript.test.mjs | 37 ++++- tools/html-skill/src/modules.json | 18 ++- .../html-skill/src/modules/diagram-motion.js | 5 +- tools/html-skill/src/modules/glyph.js | 4 +- tools/html-skill/src/modules/toggle.css | 12 +- tools/html-skill/src/modules/topbar-nav.js | 2 +- tools/html-skill/src/usage/loops.md | 4 +- tools/html-skill/src/usage/toggle.md | 4 +- tools/html-skill/test/compose.test.mjs | 4 +- tools/html-skill/test/parity.test.mjs | 18 +++ tools/review/round20.tsx | 12 +- tools/review/round22.tsx | 4 +- tools/review/round30.tsx | 2 +- tools/review/round32.tsx | 2 +- tools/review/round46.tsx | 4 +- tools/review/round67.tsx | 89 ++++++++---- 38 files changed, 521 insertions(+), 160 deletions(-) diff --git a/.agent/skills/basalt-html/SKILL.md b/.agent/skills/basalt-html/SKILL.md index fcb85c93..1f4251ae 100644 --- a/.agent/skills/basalt-html/SKILL.md +++ b/.agent/skills/basalt-html/SKILL.md @@ -31,7 +31,7 @@ Markup built only at run time (a `.row` your script writes) won't be seen: add ` - **select** `