feat(maestro): redesign web UI — token system, dark/light, a11y status
ci / rust (pull_request) Failing after 3m32s

Rewrite styles.css as an OKLCH design-system: cool-slate neutrals with a
single committed signal-green for "alive" (running status, primary action,
focus, selection). Monospace becomes the UI typeface; dark is default with a
full light theme via tokens, OS-following with a persisted header toggle.

- catalog: pulsing wordmark, status-bar tally (N sessions / M live) + daemon
  chips, color-independent session status (pulsing dot for running, hollow
  ring + "exited" badge for dead), reveal-on-hover kill, three teaching
  empty states.
- attach: state pill (live/closed/error), framed dark xterm w/ green cursor.
- spawn: bottom-sheet/dialog form, mono inputs with green focus rings.
- a11y: AA contrast both themes, visible focus, prefers-reduced-motion paths,
  status never color-only.
- theme.ts: dark/light toggle + persistence; mock.ts: DEV-only review fixture
  (?mock / ?mock&spawn / ?theme=), tree-shaken from production builds.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 18:40:42 +00:00
co-authored by Claude Opus 4.8
parent e909790b56
commit 815ad695df
10 changed files with 1095 additions and 193 deletions
+92 -29
View File
@@ -3,6 +3,7 @@ import { CatalogStore } from "./events.js";
import type { DaemonInfo, Session } from "./types.js";
import { sessionLabel, sessionName } from "./types.js";
import { openSpawnModal } from "./spawn.js";
import { createThemeToggle } from "./theme.js";
interface TreeFolder {
kind: "folder";
@@ -96,14 +97,24 @@ function renderNode(node: TreeNode, depth: number): HTMLElement {
row.href = `#/attach/${encodeURIComponent(s.id)}`;
row.style.paddingLeft = `${depth * 16 + 8}px`;
row.dataset.sessionId = s.id;
const status = s.status === "Running" ? "running" : "dead";
const running = s.status === "Running";
row.dataset.status = running ? "running" : "dead";
const name = sessionName(s);
row.setAttribute(
"aria-label",
`${name}, ${running ? "running" : "exited"}, on daemon ${s.daemon_id}`,
);
row.innerHTML = `
<span class="status status-${status}" aria-hidden="true"></span>
<span class="leaf-status" aria-hidden="true"></span>
<span class="leaf-main">
<span class="leaf-name">${escapeHtml(sessionName(s))}</span>
<span class="leaf-meta">${escapeHtml(s.daemon_id)} · ${escapeHtml(s.command)}</span>
<span class="leaf-name">${escapeHtml(name)}</span>
<span class="leaf-meta">
<span class="leaf-daemon">${escapeHtml(s.daemon_id)}</span>
<span class="leaf-cmd">${escapeHtml(s.command)}</span>
</span>
</span>
<button class="leaf-kill" type="button" title="Kill session" aria-label="Kill session">✕</button>
${running ? "" : `<span class="leaf-badge">exited</span>`}
<button class="leaf-kill" type="button" title="Kill session" aria-label="Kill ${escapeHtml(name)}">✕</button>
`;
const killBtn = row.querySelector(".leaf-kill") as HTMLButtonElement;
killBtn.addEventListener("click", async (ev) => {
@@ -132,23 +143,67 @@ function escapeHtml(s: string): string {
.replace(/"/g, "&quot;");
}
function renderDaemons(daemons: DaemonInfo[]): HTMLElement {
function renderStatusbar(daemons: DaemonInfo[], sessions: Session[]): HTMLElement {
const wrap = document.createElement("div");
wrap.className = "daemon-bar";
wrap.className = "statusbar";
const total = sessions.length;
const live = sessions.filter((s) => s.status === "Running").length;
const tally = document.createElement("div");
tally.className = "session-tally";
tally.innerHTML =
total === 0
? `<span>No sessions</span>`
: `<span><b>${total}</b> session${total === 1 ? "" : "s"}</span>` +
`<span class="tally-live"><b>${live}</b> live</span>`;
wrap.appendChild(tally);
const spacer = document.createElement("div");
spacer.className = "spacer";
wrap.appendChild(spacer);
const daemonsWrap = document.createElement("div");
daemonsWrap.className = "daemons";
if (daemons.length === 0) {
wrap.innerHTML = `<span class="daemon-empty">No daemons connected</span>`;
return wrap;
}
for (const d of daemons) {
const chip = document.createElement("span");
chip.className = "daemon-chip";
chip.title = `${d.hostname} · ${d.daemon_url}`;
chip.textContent = d.daemon_id;
wrap.appendChild(chip);
daemonsWrap.innerHTML = `<span class="daemon-empty">no daemons connected</span>`;
} else {
for (const d of daemons) {
const chip = document.createElement("span");
chip.className = "daemon-chip";
chip.title = `${d.hostname} · ${d.daemon_url}`;
chip.textContent = d.daemon_id;
daemonsWrap.appendChild(chip);
}
}
wrap.appendChild(daemonsWrap);
return wrap;
}
function renderEmpty(noDaemons: boolean, filtering: boolean): HTMLElement {
const el = document.createElement("div");
el.className = "empty";
if (filtering) {
el.innerHTML = `
<div class="empty-glyph" aria-hidden="true">⌕</div>
<div class="empty-title">No matches</div>
<p class="empty-hint">No sessions match your search. Clear it to see everything.</p>`;
return el;
}
if (noDaemons) {
el.classList.add("connecting");
el.innerHTML = `
<div class="empty-glyph" aria-hidden="true">◴</div>
<div class="empty-title">Waiting for a daemon</div>
<p class="empty-hint">No daemons are connected yet. Start a <code>maestro daemon</code> on a host and it will appear here.</p>`;
return el;
}
el.innerHTML = `
<div class="empty-glyph" aria-hidden="true">+</div>
<div class="empty-title">No sessions yet</div>
<p class="empty-hint">Press <kbd>+ Spawn</kbd> to start your first session.</p>`;
return el;
}
export function renderCatalog(root: HTMLElement, store: CatalogStore): () => void {
root.innerHTML = "";
@@ -158,24 +213,35 @@ export function renderCatalog(root: HTMLElement, store: CatalogStore): () => voi
const header = document.createElement("header");
header.className = "catalog-header";
header.innerHTML = `
<h1>maestro</h1>
<div class="brand">
<span class="brand-dot" aria-hidden="true"></span>
<h1>maestro<span class="blink" aria-hidden="true">_</span></h1>
</div>
<div class="catalog-actions">
<input
type="search"
class="search"
placeholder="Search sessions…"
aria-label="Search sessions"
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
/>
<button type="button" class="btn btn-primary spawn-btn">+ Spawn</button>
</div>
`;
shell.appendChild(header);
const daemonsHost = document.createElement("div");
shell.appendChild(daemonsHost);
const actions = header.querySelector(".catalog-actions") as HTMLElement;
actions.appendChild(createThemeToggle());
const spawnBtn = document.createElement("button");
spawnBtn.type = "button";
spawnBtn.className = "btn btn-primary spawn-btn";
spawnBtn.textContent = "+ Spawn";
actions.appendChild(spawnBtn);
const statusHost = document.createElement("div");
shell.appendChild(statusHost);
const treeHost = document.createElement("div");
treeHost.className = "tree";
@@ -190,25 +256,22 @@ export function renderCatalog(root: HTMLElement, store: CatalogStore): () => voi
refresh();
});
const spawnBtn = header.querySelector(".spawn-btn") as HTMLButtonElement;
spawnBtn.addEventListener("click", () => {
openSpawnModal(store.snapshot().daemons);
});
const refresh = () => {
const state = store.snapshot();
daemonsHost.replaceChildren(renderDaemons([...state.daemons.values()]));
const sessions = [...state.sessions.values()];
statusHost.replaceChildren(
renderStatusbar([...state.daemons.values()], sessions),
);
const tree = buildTree(sessions, filter);
treeHost.replaceChildren();
if (sessions.length === 0) {
const empty = document.createElement("p");
empty.className = "empty";
empty.textContent =
store.snapshot().daemons.size === 0
? "Waiting for a daemon to connect…"
: "No sessions yet. Press + Spawn to create one.";
treeHost.appendChild(empty);
treeHost.appendChild(
renderEmpty(state.daemons.size === 0, filter.trim().length > 0),
);
return;
}
if (tree.kind === "folder") {