Watch
0
0
Fork
You've already forked hyperhive
0

frontend: the swarm UI's page chrome moves to @hive/shared as AppShell

The header bar, the nav row with its sliding underline, the settings menu slot, the skip link and the content column move out of the swarm UI's Shell into a router-free AppShell in @hive/shared, with their CSS. It takes the brand, the nav items, the current location and the link component, plus slots for extra tabs, settings entries and menus. The swarm UI's Shell keeps what is its own on top of it: the open agent-terminal tabs (their CSS moves to DynamicTabs.css), the swarm's settings, links and user menus, the swarm name and the full-bleed routes. No visible change; this is the base for the hive UI to reuse the same chrome.
This commit is contained in:
iris 2026-11-21 10:16:45 +01:00
commit c6f8f26b16
12 changed files with 604 additions and 530 deletions

View file

@ -3,7 +3,8 @@
npm workspaces project for the hyperhive browser-facing assets: npm workspaces project for the hyperhive browser-facing assets:
- `packages/shared/` — shared modules used by every surface (terminal - `packages/shared/` — shared modules used by every surface (terminal
pane, Catppuccin palette + body typography). pane, Catppuccin palette + body typography, the `AppShell` page chrome the
swarm UI mounts).
- `packages/dashboard/` — the hive-c0re dashboard SPA. - `packages/dashboard/` — the hive-c0re dashboard SPA.
- `packages/agent/` — the per-container web pages (stats, screen). - `packages/agent/` — the per-container web pages (stats, screen).
- `packages/swarm-ui/` — the swarm-level operator UI shell (hives, - `packages/swarm-ui/` — the swarm-level operator UI shell (hives,

View file

@ -10,6 +10,8 @@
"preact": "11.2.0" "preact": "11.2.0"
}, },
"exports": { "exports": {
"./app-shell.js": "./src/app-shell/AppShell.tsx",
"./app-shell.css": "./src/app-shell/AppShell.css",
"./term-msg.js": "./src/terminal/termMsg.ts", "./term-msg.js": "./src/terminal/termMsg.ts",
"./term-row.js": "./src/terminal/Row.tsx", "./term-row.js": "./src/terminal/Row.tsx",
"./term-linkify.js": "./src/terminal/linkify.tsx", "./term-linkify.js": "./src/terminal/linkify.tsx",

View file

@ -1,8 +1,6 @@
/* <Shell> — header bar + nav row + the content column every route /* <AppShell> — header bar + nav row + the content column every route
renders into. Colour vars come from ../theme.css (same base16 slots renders into. Colour vars come from @hive/shared's theme.css, the base16
the per-hive dashboard uses, so this reads as recognizably slots every hyperhive UI uses.
hyperhive) — the layout itself is this package's own, not
@hive/shared's chrome.css.
`flex-wrap` on the header and nav rather than a hamburger/collapse `flex-wrap` on the header and nav rather than a hamburger/collapse
menu: a narrow viewport (phone or a tiled desktop window) wraps onto menu: a narrow viewport (phone or a tiled desktop window) wraps onto
@ -10,7 +8,7 @@
over-invest" is the explicit scope here, not full mobile navigation over-invest" is the explicit scope here, not full mobile navigation
redesign. redesign.
Page-switch animation (see Shell.tsx's file-top comment for the JS Page-switch animation (see AppShell.tsx's file-top comment for the JS
half): both the nav indicator's slide and the page-body pop follow half): both the nav indicator's slide and the page-body pop follow
the same three-rule motion-guard shape `@hive/shared/motion-apply.js`'s the same three-rule motion-guard shape `@hive/shared/motion-apply.js`'s
own doc comment specifies — a base rule, own doc comment specifies — a base rule,
@ -50,7 +48,7 @@
} }
.shell-brand { .shell-brand {
font-weight: 600; font-weight: 600;
/* Base colour only — Shell.tsx overrides it inline to the same /* Base colour only — AppShell.tsx overrides it inline to the same
currently-active-tab accent `.shell-nav-indicator` uses (falling currently-active-tab accent `.shell-nav-indicator` uses (falling
back to this `--purple` before the first measurement lands, which back to this `--purple` before the first measurement lands, which
is also the "hives" default route's own accent, so there's no is also the "hives" default route's own accent, so there's no
@ -108,7 +106,7 @@
} }
} }
/* Holds `SettingsMenu` + `LinksMenu` — one `margin-left: auto` on the /* Holds `SettingsMenu` + `LinksMenu` — one `margin-left: auto` on the
wrapper, not one on each child (see Shell.tsx's comment for why two wrapper, not one on each child (see AppShell.tsx's comment for why two
adjacent auto margins don't sit flush together). */ adjacent auto margins don't sit flush together). */
.shell-header-actions { .shell-header-actions {
display: flex; display: flex;
@ -145,9 +143,9 @@
color: var(--fg); color: var(--fg);
} }
/* Shared underline, one element instead of one border-bottom per link /* Shared underline, one element instead of one border-bottom per link
— see Shell.tsx's file-top comment. `left`/`top`/`width` are set — see AppShell.tsx's file-top comment. `left`/`top`/`width` are set
inline per-render from a real measurement; only the *transition* inline per-render from a real measurement; only the *transition*
between those values lives here. 140ms matches Shell.tsx's `HOP_MS` between those values lives here. 140ms matches AppShell.tsx's `HOP_MS`
exactly, so one hop's CSS transition finishes right as the next exactly, so one hop's CSS transition finishes right as the next
hop's JS-driven style update lands, instead of the two blending into hop's JS-driven style update lands, instead of the two blending into
an averaged easing curve. */ an averaged easing curve. */
@ -179,104 +177,13 @@
/* Suppresses the transition for exactly one render — the indicator's /* Suppresses the transition for exactly one render — the indicator's
very first real position, so it snaps into place instead of visibly very first real position, so it snaps into place instead of visibly
growing from the unmounted `left:0/width:0/transparent` fallback (see growing from the unmounted `left:0/width:0/transparent` fallback (see
Shell.tsx's `indicatorSettledOnce`). Two-class selector so it wins AppShell.tsx's `indicatorSettledOnce`). Two-class selector so it wins
over the plain `.shell-nav-indicator` rule above without `!important`, over the plain `.shell-nav-indicator` rule above without `!important`,
same reasoning `:root[data-motion='reduce']`'s extra attribute same reasoning `:root[data-motion='reduce']`'s extra attribute
selector already relies on. */ selector already relies on. */
.shell-nav-indicator.shell-nav-indicator-instant { .shell-nav-indicator.shell-nav-indicator-instant {
transition: none; transition: none;
} }
/* Dynamic tabs group — inline in `.shell-nav` itself, next to the
static route links (mara, PR review: "the dynamic tab should be in
the top bar, not a new one below" — an earlier cut had this as its
own sticky row under the header; that version and the reasoning for
it are still in this file's git history if the split ever needs to
come back). `margin-left: 0.5em` + `border-left` reads as "a group
attached to the nav, not another nav item" without a second landmark
or a fixed pixel gap that'd fight `.shell-nav`'s own `gap`. */
.shell-tabs {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.5em;
margin-left: 0.5em;
padding-left: 0.75em;
border-left: 1px solid var(--border);
}
.shell-tab {
display: flex;
align-items: center;
gap: 0.25em;
padding: 0.2em 0.4em 0.2em 0.7em;
border-radius: 0.3em;
background: var(--bg);
border: 1px solid var(--border);
}
.shell-tab-active {
border-color: var(--pink);
}
/* A tab that can be dragged onto a terminal to split it shows a grip in a gutter
of its own on hover, so the drag is discoverable. The gutter is part of the
padding, so the tab does not change size when the grip appears. */
.shell-tab-draggable {
position: relative;
padding-left: 1.3em;
cursor: grab;
}
/* The tab a dragged tab would take the place of. */
.shell-tab-drop {
box-shadow: inset 2px 0 0 var(--purple);
}
.shell-tab-grip {
position: absolute;
left: 0.35em;
top: 50%;
display: inline-flex;
color: var(--muted);
opacity: 0;
transform: translateY(-50%);
transition: opacity 0.15s ease;
pointer-events: none;
}
.shell-tab-draggable:hover .shell-tab-grip {
opacity: 0.9;
}
@media (prefers-reduced-motion: reduce) {
.shell-tab-grip {
transition: none;
}
}
.shell-tab-link {
color: var(--muted);
text-decoration: none;
font-size: 0.9em;
}
.shell-tab-active .shell-tab-link {
color: var(--fg);
}
.shell-tab-link:hover {
color: var(--fg);
}
/* Same reset every icon-only chrome button in this codebase uses
(`Badge`'s own `<button>` case) — a bare `<button>` here isn't routed
through `Badge` since it's not a status/value pill, just a close
glyph, so the reset is inlined rather than reaching for a component
that doesn't fit this shape. */
.shell-tab-close {
all: unset;
cursor: pointer;
line-height: 1;
padding: 0.25em 0.45em;
border-radius: 0.2em;
color: var(--muted);
}
/* `all: unset` drops the browser's focus ring, and so does the tab link's
own reset, so both draw one. */
.shell-tab-close:focus-visible,
.shell-tab-link:focus-visible {
outline: 2px solid var(--purple);
outline-offset: 2px;
}
/* A skip link, drawn only while it has the keyboard focus. */ /* A skip link, drawn only while it has the keyboard focus. */
.shell-skip-link { .shell-skip-link {
position: absolute; position: absolute;
@ -296,10 +203,6 @@
.shell-body:focus { .shell-body:focus {
outline: none; outline: none;
} }
.shell-tab-close:hover {
color: var(--fg);
background: color-mix(in srgb, var(--fg) 10%, transparent);
}
/* One width for every tab's contents: 90em still centers with visible margins /* One width for every tab's contents: 90em still centers with visible margins
on a typical desktop viewport; it isn't full-bleed. */ on a typical desktop viewport; it isn't full-bleed. */
@ -353,8 +256,3 @@
:root[data-motion="allow"] .shell-body { :root[data-motion="allow"] .shell-body {
animation: shell-page-enter 160ms ease; animation: shell-page-enter 160ms ease;
} }
.shell-tab-rename {
width: 10em;
font: inherit;
}

View file

@ -0,0 +1,410 @@
// <AppShell> — the page chrome of a hyperhive UI: a header bar with the brand,
// a nav row linking the app's routes, the settings menu and the caller's own
// menus, and the content column every route renders into. The swarm UI and the
// hive UI both mount it, each with its own brand, tabs and menus.
//
// Routing stays the caller's: it passes the current `location` and the
// `LinkComponent` that makes a link (a router's `Link`, or a plain anchor for
// hash routes), so this package needs no router.
//
// Page-switch animation, two pieces (motion-guard rules live in
// AppShell.css): `.shell-body` remounts on every navigation
// (`key={location}`) to replay a plain fade-in, and a single shared underline
// (`.shell-nav-indicator`) hops through every nav item it passes over on its
// way to the new active one, position and colour together. Accent is a discrete
// cycle through the base16 chromatic slots (each item's `accent`), not a
// continuous hue rotation. `.shell-brand` rides the identical accent value
// (`navAccent` below), so the header reads as one accent changing, not the
// underline alone.
import { useEffect, useRef, useState } from "preact/hooks";
import type { ComponentChildren, ComponentType } from "preact";
import { SettingsMenu } from "../settings/SettingsMenu.js";
import { useApplyThemeOverride } from "../settings/theme-apply.js";
import { useApplyMotionOverride } from "../settings/motion-apply.js";
import {
SolidBackgroundsSetting,
useApplySolidBackgrounds,
} from "../settings/solid-backgrounds.js";
import "./AppShell.css";
export interface NavItem {
href: string;
label: string;
/** The CSS colour the underline and the brand take while this item is active. */
accent: string;
}
/** What the shell needs of a link: a router's `Link`, or an anchor. */
export type LinkComponent = ComponentType<{
href: string;
className?: string;
"aria-current"?: "page";
children?: ComponentChildren;
}>;
export interface AppShellProps {
/** The name in the header and the document title. */
brand: string;
/** Where the brand links to. */
brandHref: string;
items: readonly NavItem[];
/** The current route, as the `href` of the nav item it belongs to. */
location: string;
LinkComponent: LinkComponent;
/** The page's own title for the document title and its heading; the nav label when absent. */
pageLabel?: string;
/** Whether the page gets a hidden `<h1>`; a page that draws its own heading says no. */
heading?: boolean;
/** The content fills the window below the header. */
fullBleed?: boolean;
/** More tabs after the nav items, drawn inside the nav row. */
navExtra?: ComponentChildren;
/** Changes when `navExtra` changes size, so the underline measures again. */
extraKey?: string | number;
/** The app's own entries in the settings menu, above the shared ones. */
settings?: ComponentChildren;
/** The app's menus after the settings menu (links, the signed-in user). */
menus?: ComponentChildren;
/** The browser-local keys of the shared theme, motion and solid-background settings. */
themeKey: string;
motionKey: string;
solidKey: string;
children: ComponentChildren;
}
interface IndicatorRect {
left: number;
top: number;
width: number;
accent: string;
}
// One hop's travel time — also the interval between hops, so each leg
// finishes (per `.shell-nav-indicator`'s own CSS transition duration,
// kept equal to this) before the next one starts rather than the two
// blending into a single averaged easing curve.
const HOP_MS = 140;
// `data-motion`/`prefers-reduced-motion` gate for the JS-driven hop
// sequence — the CSS-only pieces (the fade, the indicator's own
// transition) gate via the three-rule pattern in AppShell.css, but a
// multi-step `setTimeout` sequence has no CSS equivalent to hook, so it
// checks the same two sources directly. `data-motion` takes precedence
// over the OS preference either direction (reduce *or* allow), same
// override semantics `@hive/shared/motion-apply.js` establishes.
function prefersReducedMotion(): boolean {
const override = document.documentElement.dataset.motion;
if (override === "reduce") return true;
if (override === "allow") return false;
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
}
function NavLink({
LinkComponent,
href,
label,
active,
accent,
textRef,
}: {
LinkComponent: LinkComponent;
href: string;
label: string;
active: boolean;
accent: string;
textRef: (el: HTMLSpanElement | null) => void;
}) {
return (
<LinkComponent
href={href}
className="shell-nav-link"
aria-current={active ? "page" : undefined}
>
{/* Touch target (min-height) lives on the <a> so the whole row is
tappable. The underline lives on the shared
`.shell-nav-indicator`, not here — this span is still what
gets measured to position it, so it hugs just the text rather
than the full-height tappable box. */}
<span
ref={textRef}
class={"shell-nav-link-text" + (active ? " shell-nav-link-active" : "")}
// Inline, not a CSS rule: the glow colour is this item's own
// `accent` (NAV_ITEMS), a different value per nav item, the
// same reason `.shell-nav-indicator`'s own colour is set this
// way rather than in AppShell.css.
style={
active
? {
textShadow: `0 0 8px color-mix(in srgb, ${accent} 45%, transparent)`,
}
: undefined
}
>
{label}
</span>
</LinkComponent>
);
}
export function AppShell({
brand,
brandHref,
items,
location,
LinkComponent,
pageLabel,
heading = true,
fullBleed = false,
navExtra,
extraKey,
settings,
menus,
themeKey,
motionKey,
solidKey,
children,
}: AppShellProps) {
const navRef = useRef<HTMLElement | null>(null);
const mainRef = useRef<HTMLElement | null>(null);
const itemsKey = items.map((item) => item.href).join("\n");
// Applied once here, not inside `SettingsMenu`: every route mounts through
// this one shell, so the override takes effect whichever page is showing and
// whether or not the menu was ever opened.
useApplyThemeOverride(themeKey);
useApplyMotionOverride(motionKey);
useApplySolidBackgrounds(solidKey);
const textRefs = useRef<Record<string, HTMLSpanElement | null>>({});
const [indicator, setIndicator] = useState<IndicatorRect | null>(null);
// The nav-item index the indicator is currently sitting at (or mid-hop
// from) — distinct from `location`'s own index, since the two only
// agree once every intermediate hop has landed. `-1` = not settled
// anywhere yet (first mount) or on a route with no nav item (404).
const settledIndexRef = useRef(-1);
// False until the indicator's very first real position has committed —
// gates `.shell-nav-indicator-instant` (see AppShell.css) so that first
// placement snaps instead of *transitioning in* from the unmounted
// `left:0/width:0/transparent` fallback, which read as "no underline at
// all" on a fresh page load (reported live by mara, reproduced here with
// a zoomed pixel-level screenshot check — real, not a rendering fluke).
// Every subsequent change (a real navigation) still animates normally.
const [indicatorSettledOnce, setIndicatorSettledOnce] = useState(false);
// Measures nav item `index`'s rect relative to `.shell-nav`.
// `getBoundingClientRect()` on both elements at the same tick keeps
// this scroll-position-agnostic — a difference of two
// viewport-relative rects is scroll-invariant, no separate
// scroll-offset bookkeeping needed.
function measureIndex(index: number): IndicatorRect | null {
const navEl = navRef.current;
const item = items[index];
const textEl = item ? textRefs.current[item.href] : null;
if (!navEl || !item || !textEl) return null;
const navRect = navEl.getBoundingClientRect();
const textRect = textEl.getBoundingClientRect();
return {
// Plus the nav's own scroll: on a narrow screen it scrolls sideways, and
// the indicator lives in the scrolled content.
left: textRect.left - navRect.left + navEl.scrollLeft,
top: textRect.bottom - navRect.top + navEl.scrollTop,
width: textRect.width,
accent: item.accent,
};
}
// Drives the indicator through every nav item between where it was
// and the new active one — see the file-top comment for why (mara:
// "navigating from a to c animates [a's colour] -> [b's colour] ->
// [c's colour]"). Re-runs on navigation; a separate resize listener
// below re-measures the already-settled position without re-hopping
// (a reflow isn't a navigation).
// The list changed (the components tab came or went), so the settled index
// no longer names the same item: land directly on the active one again.
useEffect(() => {
settledIndexRef.current = -1;
}, [itemsKey]);
useEffect(() => {
const targetIndex = items.findIndex((item) => item.href === location);
if (targetIndex === -1) {
settledIndexRef.current = -1;
setIndicator(null);
return;
}
const fromIndex = settledIndexRef.current;
// First mount, a route with no nav item just left, or reduced
// motion: land directly, no intermediate hops to sweep through.
if (fromIndex === -1 || prefersReducedMotion()) {
settledIndexRef.current = targetIndex;
setIndicator(measureIndex(targetIndex));
return;
}
const step = targetIndex > fromIndex ? 1 : -1;
let cancelled = false;
let timeoutId: number | undefined;
function hop(current: number) {
const next = current + step;
setIndicator(measureIndex(next));
settledIndexRef.current = next;
if (next !== targetIndex) {
timeoutId = window.setTimeout(() => {
if (!cancelled) hop(next);
}, HOP_MS);
}
}
hop(fromIndex);
return () => {
cancelled = true;
if (timeoutId !== undefined) window.clearTimeout(timeoutId);
};
}, [location, itemsKey]);
// Fires the render *after* the indicator's first non-null commit —
// deliberately one tick behind, not folded into the effect above,
// because the instant/animated class has to still read "instant" on
// the very render where `indicator` itself first goes non-null (that's
// the snap this exists for); only from the render after that should
// transitions be armed.
useEffect(() => {
if (indicator && !indicatorSettledOnce) setIndicatorSettledOnce(true);
}, [indicator, indicatorSettledOnce]);
// Re-measures the current (already-settled) position on resize — the
// nav's own `flex-wrap` means a link's position genuinely changes at
// narrow widths, not just its route. Not part of the hop effect above
// since a reflow shouldn't restart the sweep animation.
useEffect(() => {
function onResize() {
if (settledIndexRef.current === -1) return;
setIndicator(measureIndex(settledIndexRef.current));
}
window.addEventListener("resize", onResize);
return () => window.removeEventListener("resize", onResize);
}, []);
// Same re-measure, for the same "a reflow, not a navigation" reason: the
// caller's extra tabs came or went, which shrinks or grows the row without a
// navigation to trigger the hop effect's own re-measure.
useEffect(() => {
if (settledIndexRef.current === -1) return;
setIndicator(measureIndex(settledIndexRef.current));
}, [extraKey]);
// Per-route label so browser tabs of different pages tell apart: the page's
// own title when it gave one, else its nav label. An unmatched path gets the
// bare brand.
const label =
pageLabel ?? items.find((item) => item.href === location)?.label;
useEffect(() => {
document.title = label ? `${label} · ${brand}` : brand;
}, [brand, label]);
// A new page starts at the top for the keyboard and a screen reader: the
// focus goes to the page's container, not left on the link that was used.
const firstPage = useRef(true);
useEffect(() => {
if (firstPage.current) {
firstPage.current = false;
return;
}
mainRef.current?.focus({ preventScroll: true });
}, [location]);
// Same value the indicator itself is drawn with, including mid-sweep —
// the brand text rides the identical hop sequence rather than
// computing its own, so "the header's accent" reads as one thing
// changing, not two things that happen to agree at rest.
const navAccent = indicator?.accent ?? "var(--purple)";
return (
<div class={"shell" + (fullBleed ? " shell-full" : "")}>
<a
class="shell-skip-link"
href="#main"
onClick={(e) => {
// A plain hash would hand the click to the router; move the focus
// here instead.
e.preventDefault();
mainRef.current?.focus();
}}
>
skip to content
</a>
<header class="shell-header">
<LinkComponent href={brandHref} className="shell-brand-link">
<span
class="shell-brand"
// Same glow recipe as the active nav tab / panel titles, riding
// `navAccent` — the same value `color` already uses here — so
// the brand's glow tracks the identical hop sequence as its own
// text colour instead of introducing a second, disagreeing
// accent source.
style={{
color: navAccent,
textShadow: `0 0 8px color-mix(in srgb, ${navAccent} 45%, transparent)`,
}}
>
{brand}
</span>
</LinkComponent>
<nav class="shell-nav" aria-label="main" ref={navRef}>
{items.map((item) => (
<NavLink
LinkComponent={LinkComponent}
key={item.href}
href={item.href}
label={item.label}
active={item.href === location}
accent={item.accent}
textRef={(el) => {
textRefs.current[item.href] = el;
}}
/>
))}
{/* Shared sliding underline — see the file-top comment. Hidden
(zero width) rather than unmounted when there's no active
nav item (404), so it doesn't pop in with a stale position
the next time a real nav item becomes active. */}
<span
class={
"shell-nav-indicator" +
(indicatorSettledOnce ? "" : " shell-nav-indicator-instant")
}
style={{
left: `${indicator?.left ?? 0}px`,
top: `${indicator?.top ?? 0}px`,
width: `${indicator?.width ?? 0}px`,
backgroundColor: indicator?.accent ?? "transparent",
}}
/>
{navExtra}
</nav>
{/* Single `margin-left: auto` on the wrapper, not on each menu
individually — two adjacent flex items both set to
`margin-left: auto` split the available space between them
instead of sitting flush together at the right edge. */}
<div class="shell-header-actions">
<SettingsMenu themeKey={themeKey} motionKey={motionKey}>
{settings}
<SolidBackgroundsSetting storageKey={solidKey} />
</SettingsMenu>
{menus}
</div>
</header>
{/* Keyed by route so it remounts (and replays its entrance
animation) on every navigation — see the file-top comment. */}
<main
id="main"
tabIndex={-1}
ref={mainRef}
class={"shell-body" + (fullBleed ? " shell-body-full" : "")}
key={location}
>
{/* The page's name for a screen reader. Only the start page draws an
`<h1>` of its own (the swarm's name), so it gets no second one;
the document title is the only other place the name shows. */}
{heading && <h1 class="ui-visually-hidden">{label ?? brand}</h1>}
{children}
</main>
</div>
);
}

View file

@ -1,4 +1,4 @@
/* <AgentTerminalPage> — fills `.shell-body-full` (Shell.css), which is /* <AgentTerminalPage> — fills `.shell-body-full` (AppShell.css), which is
already everything below the header bar, full width and height. This already everything below the header bar, full width and height. This
wrapper only has to pass that height down so `AgentTermPreview`'s wrapper only has to pass that height down so `AgentTermPreview`'s
`fullHeight` flex chain (`.ui-agent-term-preview-full`) has a real box `fullHeight` flex chain (`.ui-agent-term-preview-full`) has a real box

View file

@ -0,0 +1,97 @@
/* The open agent-terminal tabs in the header's nav row (Shell.tsx). */
/* Dynamic tabs group — inline in `.shell-nav` itself, next to the
static route links, not a row of its own under the header.
`margin-left: 0.5em` + `border-left` reads as "a group
attached to the nav, not another nav item" without a second landmark
or a fixed pixel gap that'd fight `.shell-nav`'s own `gap`. */
.shell-tabs {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.5em;
margin-left: 0.5em;
padding-left: 0.75em;
border-left: 1px solid var(--border);
}
.shell-tab {
display: flex;
align-items: center;
gap: 0.25em;
padding: 0.2em 0.4em 0.2em 0.7em;
border-radius: 0.3em;
background: var(--bg);
border: 1px solid var(--border);
}
.shell-tab-active {
border-color: var(--pink);
}
/* A tab that can be dragged onto a terminal to split it shows a grip in a gutter
of its own on hover, so the drag is discoverable. The gutter is part of the
padding, so the tab does not change size when the grip appears. */
.shell-tab-draggable {
position: relative;
padding-left: 1.3em;
cursor: grab;
}
/* The tab a dragged tab would take the place of. */
.shell-tab-drop {
box-shadow: inset 2px 0 0 var(--purple);
}
.shell-tab-grip {
position: absolute;
left: 0.35em;
top: 50%;
display: inline-flex;
color: var(--muted);
opacity: 0;
transform: translateY(-50%);
transition: opacity 0.15s ease;
pointer-events: none;
}
.shell-tab-draggable:hover .shell-tab-grip {
opacity: 0.9;
}
@media (prefers-reduced-motion: reduce) {
.shell-tab-grip {
transition: none;
}
}
.shell-tab-link {
color: var(--muted);
text-decoration: none;
font-size: 0.9em;
}
.shell-tab-active .shell-tab-link {
color: var(--fg);
}
.shell-tab-link:hover {
color: var(--fg);
}
/* Same reset every icon-only chrome button in this codebase uses
(`Badge`'s own `<button>` case) — a bare `<button>` here isn't routed
through `Badge` since it's not a status/value pill, just a close
glyph, so the reset is inlined rather than reaching for a component
that doesn't fit this shape. */
.shell-tab-close {
all: unset;
cursor: pointer;
line-height: 1;
padding: 0.25em 0.45em;
border-radius: 0.2em;
color: var(--muted);
}
/* `all: unset` drops the browser's focus ring, and so does the tab link's
own reset, so both draw one. */
.shell-tab-close:focus-visible,
.shell-tab-link:focus-visible {
outline: 2px solid var(--purple);
outline-offset: 2px;
}
.shell-tab-close:hover {
color: var(--fg);
background: color-mix(in srgb, var(--fg) 10%, transparent);
}
.shell-tab-rename {
width: 10em;
font: inherit;
}

View file

@ -1,49 +1,20 @@
// <Shell> — page chrome every swarm-ui route mounts inside: a header // <Shell> — the swarm UI's page chrome: `@hive/shared`'s `AppShell` with the
// bar (swarm branding) plus a nav row linking the app's real routes. // swarm's brand, its routes, the open agent-terminal tabs after them, the
// Preact-native styling — `./Shell.css` imported right here, not // swarm's settings and its links and user menus. The route list lives here, not
// wired centrally, so the component and its styles travel together // prop-drilled from App: one small SPA has exactly one place that needs to
// (esbuild folds every imported `.css` reachable from `main.tsx` into // know its own nav.
// one `main.css` companion output, see build.mjs) — deliberately not import { useState } from "preact/hooks";
// @hive/shared's chrome.css page-header pattern, which is the per-hive
// MPA dashboard's visual language. This package is a clean field, not
// an inheritor of that look.
//
// Route list lives here, not prop-drilled from App — one small SPA
// has exactly one place that needs to know its own nav, and this is
// it. Grows additively as real routes land (a swarm-wide agent roster
// is next); no speculative entries.
//
// Page-switch animation, two pieces (motion-guard rules live in
// Shell.css): `.shell-body` remounts on every navigation
// (`key={location}`) to replay a plain fade-in, and a single shared
// underline (`.shell-nav-indicator`) hops through every nav item it
// passes over on its way to the new active one, not just a straight
// two-point tween — a nav hives→components jump visibly touches "new
// agent" and "jobs" in between, position and colour together. Accent
// is a discrete cycle through the existing base16 chromatic slots
// (`NAV_ITEMS`' `accent` field), not a continuous hue rotation —
// everything here still derives from base16, same rule the rest of
// the palette follows. `.shell-brand` rides the identical accent value
// (`navAccent` below), so the header reads as one accent changing, not
// the underline alone.
import { useEffect, useRef, useState } from "preact/hooks";
import type { ComponentChildren } from "preact"; import type { ComponentChildren } from "preact";
import { Link, useLocation } from "wouter-preact"; import { Link, useLocation } from "wouter-preact";
import { AppShell } from "@hive/shared/app-shell.js";
import { usePageTitleValue } from "./page-title.js"; import { usePageTitleValue } from "./page-title.js";
import { LinksMenu } from "./LinksMenu.js"; import { LinksMenu } from "./LinksMenu.js";
import { UserMenu } from "./UserMenu.js"; import { UserMenu } from "./UserMenu.js";
import { useHideDebug } from "./useHideDebug.js"; import { useHideDebug } from "./useHideDebug.js";
import { SettingsMenu } from "@hive/shared/settings-menu.js";
import { HideDebugSetting } from "@hive/shared/hide-debug-setting.js"; import { HideDebugSetting } from "@hive/shared/hide-debug-setting.js";
import { ShowThinkingSetting } from "@hive/shared/show-thinking-setting.js"; import { ShowThinkingSetting } from "@hive/shared/show-thinking-setting.js";
import { GripIcon } from "@hive/shared/icons.js"; import { GripIcon } from "@hive/shared/icons.js";
import { ExpandDetailsSetting } from "@hive/shared/expand-details-setting.js"; import { ExpandDetailsSetting } from "@hive/shared/expand-details-setting.js";
import { useApplyThemeOverride } from "@hive/shared/theme-apply.js";
import { useApplyMotionOverride } from "@hive/shared/motion-apply.js";
import {
SolidBackgroundsSetting,
useApplySolidBackgrounds,
} from "@hive/shared/solid-backgrounds.js";
import { isFullBleedRoute, visibleNavItems } from "./routes.js"; import { isFullBleedRoute, visibleNavItems } from "./routes.js";
import { useDynamicTabs } from "./useDynamicTabs.js"; import { useDynamicTabs } from "./useDynamicTabs.js";
import { import {
@ -55,13 +26,11 @@ import { endAgentDrag, startAgentDrag } from "../agent/terminal/termDrag.js";
import { draggedTab, endTabDrag, startTabDrag } from "./tab-order.js"; import { draggedTab, endTabDrag, startTabDrag } from "./tab-order.js";
import { useTermGroups } from "../agent/terminal/useTermGroups.js"; import { useTermGroups } from "../agent/terminal/useTermGroups.js";
import { useSwarmName } from "./useSwarmName.js"; import { useSwarmName } from "./useSwarmName.js";
import "./Shell.css"; import "./DynamicTabs.css";
// Storage keys this app owns for `@hive/shared`'s settings mechanism — // Storage keys this app owns for `@hive/shared`'s settings mechanism. Theme
// kept here, not derived, so the two mount points below (the // defaults to `'dark'`, not `'system'` — see `@hive/shared/theme-apply.js`'s
// `useApply*` effects and `<SettingsMenu>`) always agree on which // file comment.
// browser-local key they're reading/writing. Theme defaults to `'dark'`,
// not `'system'` — see `@hive/shared/theme-apply.js`'s file comment.
const THEME_KEY = "swarm-ui:theme-override"; const THEME_KEY = "swarm-ui:theme-override";
const MOTION_KEY = "swarm-ui:motion-override"; const MOTION_KEY = "swarm-ui:motion-override";
const SOLID_KEY = "swarm-ui:solid-backgrounds"; const SOLID_KEY = "swarm-ui:solid-backgrounds";
@ -80,78 +49,6 @@ const NAV_ITEMS: { href: string; label: string; accent: string }[] = [
// same generic label the pre-fetch page already showed, not a blank. // same generic label the pre-fetch page already showed, not a blank.
const DEFAULT_BRAND = "hyperhive swarm"; const DEFAULT_BRAND = "hyperhive swarm";
interface IndicatorRect {
left: number;
top: number;
width: number;
accent: string;
}
// One hop's travel time — also the interval between hops, so each leg
// finishes (per `.shell-nav-indicator`'s own CSS transition duration,
// kept equal to this) before the next one starts rather than the two
// blending into a single averaged easing curve.
const HOP_MS = 140;
// `data-motion`/`prefers-reduced-motion` gate for the JS-driven hop
// sequence — the CSS-only pieces (the fade, the indicator's own
// transition) gate via the three-rule pattern in Shell.css, but a
// multi-step `setTimeout` sequence has no CSS equivalent to hook, so it
// checks the same two sources directly. `data-motion` takes precedence
// over the OS preference either direction (reduce *or* allow), same
// override semantics `@hive/shared/motion-apply.js` establishes.
function prefersReducedMotion(): boolean {
const override = document.documentElement.dataset.motion;
if (override === "reduce") return true;
if (override === "allow") return false;
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
}
function NavLink({
href,
label,
active,
accent,
textRef,
}: {
href: string;
label: string;
active: boolean;
accent: string;
textRef: (el: HTMLSpanElement | null) => void;
}) {
return (
<Link
href={href}
className="shell-nav-link"
aria-current={active ? "page" : undefined}
>
{/* Touch target (min-height) lives on the <a> so the whole row is
tappable. The underline lives on the shared
`.shell-nav-indicator`, not here — this span is still what
gets measured to position it, so it hugs just the text rather
than the full-height tappable box. */}
<span
ref={textRef}
class={"shell-nav-link-text" + (active ? " shell-nav-link-active" : "")}
// Inline, not a CSS rule: the glow colour is this item's own
// `accent` (NAV_ITEMS), a different value per nav item, the
// same reason `.shell-nav-indicator`'s own colour is set this
// way rather than in Shell.css.
style={
active
? {
textShadow: `0 0 8px color-mix(in srgb, ${accent} 45%, transparent)`,
}
: undefined
}
>
{label}
</span>
</Link>
);
}
// One open agent-terminal tab (`useDynamicTabs`) — deliberately // One open agent-terminal tab (`useDynamicTabs`) — deliberately
// its own small component, not folded into `NavLink` above: dynamic tabs // its own small component, not folded into `NavLink` above: dynamic tabs
// don't ride the sliding `.shell-nav-indicator` (there's no fixed set to // don't ride the sliding `.shell-nav-indicator` (there's no fixed set to
@ -278,31 +175,7 @@ function DynamicTabLink({
export function Shell({ children }: { children: ComponentChildren }) { export function Shell({ children }: { children: ComponentChildren }) {
const swarmName = useSwarmName(); const swarmName = useSwarmName();
const [location] = useLocation(); const [location] = useLocation();
const navRef = useRef<HTMLElement | null>(null); // Open agent-terminal tabs, drawn in the nav row after the fixed routes.
const mainRef = useRef<HTMLElement | null>(null);
const textRefs = useRef<Record<string, HTMLSpanElement | null>>({});
const [indicator, setIndicator] = useState<IndicatorRect | null>(null);
// The nav-item index the indicator is currently sitting at (or mid-hop
// from) — distinct from `location`'s own index, since the two only
// agree once every intermediate hop has landed. `-1` = not settled
// anywhere yet (first mount) or on a route with no nav item (404).
const settledIndexRef = useRef(-1);
// False until the indicator's very first real position has committed —
// gates `.shell-nav-indicator-instant` (see Shell.css) so that first
// placement snaps instead of *transitioning in* from the unmounted
// `left:0/width:0/transparent` fallback, which read as "no underline at
// all" on a fresh page load (reported live by mara, reproduced here with
// a zoomed pixel-level screenshot check — real, not a rendering fluke).
// Every subsequent change (a real navigation) still animates normally.
const [indicatorSettledOnce, setIndicatorSettledOnce] = useState(false);
// Open agent-terminal tabs — rendered inline in `.shell-nav` itself
// (mara, PR review: "the dynamic tab should be in the top bar, not a
// new one below" — an earlier cut had these as their own row under
// the header; see the git history on this file for that version and
// why it was reverted). Entirely separate from the fixed `NAV_ITEMS`
// list above, so they get their own small component (`DynamicTabLink`)
// rather than reusing `NavLink`.
const { tabs, close: closeTab, move: moveTabTo } = useDynamicTabs(); const { tabs, close: closeTab, move: moveTabTo } = useDynamicTabs();
const termGroups = useTermGroups(); const termGroups = useTermGroups();
@ -311,291 +184,84 @@ export function Shell({ children }: { children: ComponentChildren }) {
const hideDeveloper = useHideDebug(); const hideDeveloper = useHideDebug();
const navItems = visibleNavItems(NAV_ITEMS, hideDeveloper); const navItems = visibleNavItems(NAV_ITEMS, hideDeveloper);
// Applied once here, not inside `SettingsMenu` — every route mounts
// through this one `<Shell>`, so the override takes effect regardless
// of which page is showing or whether the menu's ever been opened,
// and `useLocalSetting`'s same-tab subscription
// (`@hive/shared/settings-storage.js`) means `SettingsMenu` changing
// the stored value re-runs these effects without either component
// needing a reference to the other.
useApplyThemeOverride(THEME_KEY);
useApplyMotionOverride(MOTION_KEY);
useApplySolidBackgrounds(SOLID_KEY);
// Measures nav item `index`'s rect relative to `.shell-nav`.
// `getBoundingClientRect()` on both elements at the same tick keeps
// this scroll-position-agnostic — a difference of two
// viewport-relative rects is scroll-invariant, no separate
// scroll-offset bookkeeping needed.
function measureIndex(index: number): IndicatorRect | null {
const navEl = navRef.current;
const item = navItems[index];
const textEl = item ? textRefs.current[item.href] : null;
if (!navEl || !item || !textEl) return null;
const navRect = navEl.getBoundingClientRect();
const textRect = textEl.getBoundingClientRect();
return {
// Plus the nav's own scroll: on a narrow screen it scrolls sideways, and
// the indicator lives in the scrolled content.
left: textRect.left - navRect.left + navEl.scrollLeft,
top: textRect.bottom - navRect.top + navEl.scrollTop,
width: textRect.width,
accent: item.accent,
};
}
// Drives the indicator through every nav item between where it was
// and the new active one — see the file-top comment for why (mara:
// "navigating from a to c animates [a's colour] -> [b's colour] ->
// [c's colour]"). Re-runs on navigation; a separate resize listener
// below re-measures the already-settled position without re-hopping
// (a reflow isn't a navigation).
// The list changed (the components tab came or went), so the settled index
// no longer names the same item: land directly on the active one again.
useEffect(() => {
settledIndexRef.current = -1;
}, [hideDeveloper]);
useEffect(() => {
const targetIndex = navItems.findIndex((item) => item.href === location);
if (targetIndex === -1) {
settledIndexRef.current = -1;
setIndicator(null);
return;
}
const fromIndex = settledIndexRef.current;
// First mount, a route with no nav item just left, or reduced
// motion: land directly, no intermediate hops to sweep through.
if (fromIndex === -1 || prefersReducedMotion()) {
settledIndexRef.current = targetIndex;
setIndicator(measureIndex(targetIndex));
return;
}
const step = targetIndex > fromIndex ? 1 : -1;
let cancelled = false;
let timeoutId: number | undefined;
function hop(current: number) {
const next = current + step;
setIndicator(measureIndex(next));
settledIndexRef.current = next;
if (next !== targetIndex) {
timeoutId = window.setTimeout(() => {
if (!cancelled) hop(next);
}, HOP_MS);
}
}
hop(fromIndex);
return () => {
cancelled = true;
if (timeoutId !== undefined) window.clearTimeout(timeoutId);
};
}, [location, hideDeveloper]);
// Fires the render *after* the indicator's first non-null commit —
// deliberately one tick behind, not folded into the effect above,
// because the instant/animated class has to still read "instant" on
// the very render where `indicator` itself first goes non-null (that's
// the snap this exists for); only from the render after that should
// transitions be armed.
useEffect(() => {
if (indicator && !indicatorSettledOnce) setIndicatorSettledOnce(true);
}, [indicator, indicatorSettledOnce]);
// Re-measures the current (already-settled) position on resize — the
// nav's own `flex-wrap` means a link's position genuinely changes at
// narrow widths, not just its route. Not part of the hop effect above
// since a reflow shouldn't restart the sweep animation.
useEffect(() => {
function onResize() {
if (settledIndexRef.current === -1) return;
setIndicator(measureIndex(settledIndexRef.current));
}
window.addEventListener("resize", onResize);
return () => window.removeEventListener("resize", onResize);
}, []);
// Same re-measure, for the same "a reflow, not a navigation" reason —
// now that the dynamic tabs render inline in `.shell-nav` (see the
// `useDynamicTabs()` comment above), *closing* a background tab (one
// that isn't the active route) shrinks the row without any navigation
// firing to trigger the hop effect's own re-measure. Opening one
// doesn't need this: `useDynamicTabs().open()` always navigates, so
// the hop effect already covers that case.
useEffect(() => {
if (settledIndexRef.current === -1) return;
setIndicator(measureIndex(settledIndexRef.current));
}, [tabs.length]);
// `swarmName` stays `null` on a failed fetch or an unconfigured name, and // `swarmName` stays `null` on a failed fetch or an unconfigured name, and
// the header/title fall back to `DEFAULT_BRAND`; see `useSwarmName`. // the header/title fall back to `DEFAULT_BRAND`; see `useSwarmName`.
const brand = swarmName ?? DEFAULT_BRAND; const brand = swarmName ?? DEFAULT_BRAND;
// Per-route label so browser tabs of different pages tell apart: a // A top-level route takes its nav label, a terminal route the label its page
// top-level route takes its nav label, a terminal route takes the // registered as a dynamic tab, and a page that set its own title keeps that.
// label its page registered as a dynamic tab. An unmatched path gets
// the bare brand.
const pageTitle = usePageTitleValue(); const pageTitle = usePageTitleValue();
const pageLabel = const pageLabel =
pageTitle ?? pageTitle ??
navItems.find((item) => item.href === location)?.label ?? navItems.find((item) => item.href === location)?.label ??
tabs.find((tab) => tab.href === location)?.label; tabs.find((tab) => tab.href === location)?.label;
useEffect(() => {
document.title = pageLabel ? `${pageLabel} · ${brand}` : brand;
}, [brand, pageLabel]);
// A new page starts at the top for the keyboard and a screen reader: the
// focus goes to the page's container, not left on the link that was used.
const firstPage = useRef(true);
useEffect(() => {
if (firstPage.current) {
firstPage.current = false;
return;
}
mainRef.current?.focus({ preventScroll: true });
}, [location]);
// Same value the indicator itself is drawn with, including mid-sweep —
// the brand text rides the identical hop sequence rather than
// computing its own, so "the header's accent" reads as one thing
// changing, not two things that happen to agree at rest.
const navAccent = indicator?.accent ?? "var(--purple)";
return ( return (
<div class={"shell" + (isFullBleedRoute(location) ? " shell-full" : "")}> <AppShell
<a brand={brand}
class="shell-skip-link" brandHref="/"
href="#main" items={navItems}
onClick={(e) => { location={location}
// A plain hash would hand the click to the router; move the focus LinkComponent={Link}
// here instead. pageLabel={pageLabel}
e.preventDefault(); // Only the start page draws an `<h1>` of its own (the swarm's name).
mainRef.current?.focus(); heading={location !== "/"}
}} fullBleed={isFullBleedRoute(location)}
> extraKey={tabs.length}
skip to content navExtra={
</a> tabs.length > 0 && (
<header class="shell-header"> <div
<Link href="/" class="shell-brand-link"> class="shell-tabs"
<span role="group"
class="shell-brand" aria-label="open agent terminals"
// Same glow recipe as the active nav tab / panel titles, riding
// `navAccent` — the same value `color` already uses here — so
// the brand's glow tracks the identical hop sequence as its own
// text colour instead of introducing a second, disagreeing
// accent source.
style={{
color: navAccent,
textShadow: `0 0 8px color-mix(in srgb, ${navAccent} 45%, transparent)`,
}}
> >
{brand} {tabs.map((tab) => {
</span> // A group's tab shows the group's live name, not the label it
</Link> // was opened with, so a rename shows at once.
<nav class="shell-nav" aria-label="main" ref={navRef}> const groupId = groupIdOf(tab.href);
{navItems.map((item) => ( const group =
<NavLink groupId === null ? undefined : termGroups.find(groupId);
key={item.href} return (
href={item.href} <DynamicTabLink
label={item.label} key={tab.href}
active={item.href === location} href={tab.href}
accent={item.accent} label={group === undefined ? tab.label : groupTitle(group)}
textRef={(el) => { active={tab.href === location}
textRefs.current[item.href] = el; agent={terminalAgentOf(tab.href) ?? undefined}
}} onMove={(from) => moveTabTo(from, tab.href)}
/> onRename={
))} groupId === null
{/* Shared sliding underline — see the file-top comment. Hidden ? undefined
(zero width) rather than unmounted when there's no active : (name) => termGroups.rename(groupId, name.trim())
nav item (404), so it doesn't pop in with a stale position }
the next time a real nav item becomes active. */} onClose={() => {
<span // Closing a group's tab is closing the group.
class={ if (groupId !== null) termGroups.remove(groupId);
"shell-nav-indicator" + closeTab(tab.href);
(indicatorSettledOnce ? "" : " shell-nav-indicator-instant") }}
} />
style={{ );
left: `${indicator?.left ?? 0}px`, })}
top: `${indicator?.top ?? 0}px`, </div>
width: `${indicator?.width ?? 0}px`, )
backgroundColor: indicator?.accent ?? "transparent", }
}} settings={
/> <>
{/* Open agent-terminal tabs — inline in the same nav row as <ShowThinkingSetting />
the static routes (mara's review call, see the <HideDebugSetting />
`useDynamicTabs()` comment above). Only rendered when <ExpandDetailsSetting />
there's something to show — an always-present empty group </>
would just be dead chrome for the far more common case of }
no open terminal tabs. `role="group"`, not a second `<nav>`: menus={
there's already exactly one nav landmark in this header. */} <>
{tabs.length > 0 && (
<div
class="shell-tabs"
role="group"
aria-label="open agent terminals"
>
{tabs.map((tab) => {
// A group's tab shows the group's live name, not the label it
// was opened with, so a rename shows at once.
const groupId = groupIdOf(tab.href);
const group =
groupId === null ? undefined : termGroups.find(groupId);
return (
<DynamicTabLink
key={tab.href}
href={tab.href}
label={group === undefined ? tab.label : groupTitle(group)}
active={tab.href === location}
agent={terminalAgentOf(tab.href) ?? undefined}
onMove={(from) => moveTabTo(from, tab.href)}
onRename={
groupId === null
? undefined
: (name) => termGroups.rename(groupId, name.trim())
}
onClose={() => {
// Closing a group's tab is closing the group.
if (groupId !== null) termGroups.remove(groupId);
closeTab(tab.href);
}}
/>
);
})}
</div>
)}
</nav>
{/* Single `margin-left: auto` on the wrapper, not on each menu
individually — two adjacent flex items both set to
`margin-left: auto` split the available space between them
instead of sitting flush together at the right edge. */}
<div class="shell-header-actions">
<SettingsMenu themeKey={THEME_KEY} motionKey={MOTION_KEY}>
<ShowThinkingSetting />
<HideDebugSetting />
<ExpandDetailsSetting />
<SolidBackgroundsSetting storageKey={SOLID_KEY} />
</SettingsMenu>
<LinksMenu /> <LinksMenu />
<UserMenu /> <UserMenu />
</div> </>
</header> }
{/* Keyed by route so it remounts (and replays its entrance themeKey={THEME_KEY}
animation) on every navigation — see the file-top comment. */} motionKey={MOTION_KEY}
<main solidKey={SOLID_KEY}
id="main" >
tabIndex={-1} {children}
ref={mainRef} </AppShell>
class={
"shell-body" + (isFullBleedRoute(location) ? " shell-body-full" : "")
}
key={location}
>
{/* The page's name for a screen reader. Only the start page draws an
`<h1>` of its own (the swarm's name), so it gets no second one;
the document title is the only other place the name shows. */}
{location !== "/" && (
<h1 class="ui-visually-hidden">{pageLabel ?? brand}</h1>
)}
{children}
</main>
</div>
); );
} }

View file

@ -5,7 +5,7 @@
// `/agents/:name/terminal` (and a subagent's, under // `/agents/:name/terminal` (and a subagent's, under
// `/agents/:name/subagents/:subagent/`) is full-bleed: the terminal fills // `/agents/:name/subagents/:subagent/`) is full-bleed: the terminal fills
// the whole viewport below the header bar, edge to edge (`shell-full` / // the whole viewport below the header bar, edge to edge (`shell-full` /
// `shell-body-full` in Shell.css). It's a parameterized path, so one literal // `shell-body-full` in AppShell.css). It's a parameterized path, so one literal
// string can't match every agent name. // string can't match every agent name.
const FULL_BLEED_ROUTE_PATTERN = const FULL_BLEED_ROUTE_PATTERN =
/^\/agents\/[^/]+(\/subagents\/[^/]+)?\/terminal$/; /^\/agents\/[^/]+(\/subagents\/[^/]+)?\/terminal$/;

View file

@ -1,5 +1,5 @@
/* Page-level base only — component styles are colocated with their /* Page-level base only — component styles are colocated with their
component (`./Shell.css` imported by shell/Shell.tsx, etc.) and component (`AppShell.css` imported by the shared AppShell, etc.) and
land in the `main.css` companion esbuild emits alongside `main.js` land in the `main.css` companion esbuild emits alongside `main.js`
(see build.mjs), not here. This file stays just the shared reset (see build.mjs), not here. This file stays just the shared reset
every page needs regardless of which components a route happens to every page needs regardless of which components a route happens to

View file

@ -1,6 +1,6 @@
/* <Skeleton>: a tinted shape with a light band moving across it. Motion /* <Skeleton>: a tinted shape with a light band moving across it. Motion
follows the page's setting, the same three rules the page switch uses follows the page's setting, the same three rules the page switch uses
(`shell/Shell.css`): off for an OS that asks for less motion, off when the (`app-shell/AppShell.css`): off for an OS that asks for less motion, off when the
setting says reduce, back on when the setting says allow. Where it is off setting says reduce, back on when the setting says allow. Where it is off
the shape is a plain tinted block. */ the shape is a plain tinted block. */
.ui-skeleton { .ui-skeleton {

View file

@ -1,6 +1,6 @@
/* The slug: the signature line at the foot of a page. The shaded blocks pulse /* The slug: the signature line at the foot of a page. The shaded blocks pulse
in a wave, each glyph delayed by its index (`--i`). Motion is gated the way in a wave, each glyph delayed by its index (`--i`). Motion is gated the way
`shell/Shell.css` gates its own: stilled under the OS preference and the `app-shell/AppShell.css` gates its own: stilled under the OS preference and the
`data-motion` override, back on with `allow`. */ `data-motion` override, back on with `allow`. */
.ui-slug { .ui-slug {
display: flex; display: flex;

View file

@ -6,7 +6,7 @@
// the primitive before or alongside the first real page that needs it"). // the primitive before or alongside the first real page that needs it").
// //
// `flex-wrap`, not a `@media` breakpoint — content-driven stacking, same // `flex-wrap`, not a `@media` breakpoint — content-driven stacking, same
// approach the shell's own nav row already uses (`shell/Shell.css`) // approach the shell's own nav row already uses (`app-shell/AppShell.css`)
// rather than a second, independent magic-number breakpoint. No opinion // rather than a second, independent magic-number breakpoint. No opinion
// on what's inside either pane (a `Panel`, anything else) — same "own // on what's inside either pane (a `Panel`, anything else) — same "own
// the mechanics, not the content" split as `Card`. // the mechanics, not the content" split as `Card`.