The shell now has a main landmark that takes the focus when a page opens, a skip link as the first Tab stop, a labelled nav, aria-current on the active tab, and a hidden h1 with the page's name (no page drew one). The tab close button and tab link get a visible focus ring and a larger target. Repeated edit, remove, delete, fire now, pause, duplicate buttons and the icon-only terminal, expand and close badges get a name that says what they act on (Button gains ariaLabel). A badge can be pressed (aria-pressed), used for the internet modes and the SSH target form, whose fake tablist is now a labelled group. The terminal is a focusable role=log with live announcements off, and a latest badge scrolls back to the newest row once the operator has scrolled up and the terminal has stopped following.
262 lines
7.8 KiB
TypeScript
262 lines
7.8 KiB
TypeScript
// Small inline-SVG icons shared across pages — deliberately NOT emoji
|
|
// glyphs for a trigger button's own icon. mara, live, on swarm-ui's
|
|
// original links/settings buttons: "links and settings icon styles
|
|
// different / all different sizes" — an emoji glyph renders via the
|
|
// OS/browser's colour-emoji font at that font's own fixed metrics,
|
|
// ignoring `font-size`/`color`, so it can never match a neighbouring
|
|
// icon in size or weight on any platform (and some codepoints, like the
|
|
// gear `⚙`, aren't even reliably covered by every font — showing as a
|
|
// missing-glyph box or an oddly-weighted fallback depending on what's
|
|
// installed). Same `stroke`/`viewBox`/size shape for every icon here so
|
|
// they read as one rendering path wherever they're mounted — Feather/
|
|
// lucide-style line icons, `currentColor` stroke so they pick up
|
|
// whatever text colour the surrounding `Badge`/button already has.
|
|
//
|
|
// Shared here so `SettingsMenu`, `LinksMenu` and the swarm UI's shell draw the
|
|
// settings gear and the link chain from one place.
|
|
import type { ComponentChildren } from "preact";
|
|
|
|
export function GearIcon() {
|
|
return (
|
|
<svg
|
|
width="1.3em"
|
|
height="1.3em"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
<circle cx="12" cy="12" r="3" />
|
|
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
export function LinkIcon() {
|
|
return (
|
|
<svg
|
|
width="1.3em"
|
|
height="1.3em"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
|
|
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
// Four corner-arrows, the standard "expand to fullscreen" glyph — added
|
|
// for the terminal-preview-to-full-tab trigger (`AgentTermPreview`'s own
|
|
// expand affordance). Same size/stroke recipe as `LinkIcon`/`GearIcon`
|
|
// above, not a smaller variant like `FilterIcon` — this one sits as a
|
|
// standalone `Badge` trigger, not inside a table header cell.
|
|
export function ExpandIcon() {
|
|
return (
|
|
<svg
|
|
width="1.3em"
|
|
height="1.3em"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
<polyline points="15 3 21 3 21 9" />
|
|
<polyline points="9 21 3 21 3 15" />
|
|
<line x1="21" y1="3" x2="14" y2="10" />
|
|
<line x1="3" y1="21" x2="10" y2="14" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
// A cross, for an icon-only close trigger (a pane's "take this out of the
|
|
// group"). Same size and stroke as `ExpandIcon`.
|
|
export function CloseIcon() {
|
|
return (
|
|
<svg
|
|
width="1.3em"
|
|
height="1.3em"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
<line x1="5" y1="5" x2="19" y2="19" />
|
|
<line x1="19" y1="5" x2="5" y2="19" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
// A funnel, the standard "filter" glyph — smaller than the other two
|
|
// (1em not 1.3em) since its first caller sits inside a table header
|
|
// cell, not a nav trigger button; scale via the caller's own
|
|
// `font-size` like the others rather than a hardcoded size prop, same
|
|
// reasoning as `GearIcon`/`LinkIcon` above (`currentColor` stroke).
|
|
export function FilterIcon() {
|
|
return (
|
|
<svg
|
|
width="1em"
|
|
height="1em"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
<polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
// A prompt in a window (`>_`), the standard "terminal" glyph — the agent
|
|
// card's shortcut to the agent's terminal tab. Same recipe as `LinkIcon`.
|
|
export function TerminalIcon() {
|
|
return (
|
|
<svg
|
|
width="1.3em"
|
|
height="1.3em"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
<polyline points="4 17 10 11 4 5" />
|
|
<line x1="12" y1="19" x2="20" y2="19" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
/** An arrow pointing up, for a send button: the message goes up into the terminal. */
|
|
export function SendIcon() {
|
|
return (
|
|
<svg
|
|
width="1.2em"
|
|
height="1.2em"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2.4"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
<line x1="12" y1="19" x2="12" y2="5" />
|
|
<polyline points="5 12 12 5 19 12" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
// The shared recipe of the line icons below: a 24-unit box, round strokes in
|
|
// the text colour, so each reads as part of the same family.
|
|
function LineIcon({ children }: { children: ComponentChildren }) {
|
|
return (
|
|
<svg
|
|
width="1.15em"
|
|
height="1.15em"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
{children}
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
/** A chip with pins: the model an agent runs on. */
|
|
export function ChipIcon() {
|
|
return (
|
|
<LineIcon>
|
|
<rect x="6" y="6" width="12" height="12" rx="2" />
|
|
<rect x="10" y="10" width="4" height="4" />
|
|
<path d="M9 3v3M15 3v3M9 18v3M15 18v3M3 9h3M3 15h3M18 9h3M18 15h3" />
|
|
</LineIcon>
|
|
);
|
|
}
|
|
|
|
/** A dial: how full the context window is. */
|
|
export function GaugeIcon() {
|
|
return (
|
|
<LineIcon>
|
|
<path d="M4 17a8 8 0 1 1 16 0" />
|
|
<path d="M12 17l4-5" />
|
|
<circle cx="12" cy="17" r="1" />
|
|
</LineIcon>
|
|
);
|
|
}
|
|
|
|
/** One node branching into two: the subagents an agent started. */
|
|
export function SubagentsIcon() {
|
|
return (
|
|
<LineIcon>
|
|
<circle cx="12" cy="5" r="2" />
|
|
<circle cx="6" cy="19" r="2" />
|
|
<circle cx="18" cy="19" r="2" />
|
|
<path d="M12 7v4M12 11H6v6M12 11h6v6" />
|
|
</LineIcon>
|
|
);
|
|
}
|
|
|
|
/** Six dots in two columns: the handle of something that can be dragged. */
|
|
export function GripIcon() {
|
|
return (
|
|
<svg
|
|
width="0.8em"
|
|
height="1.15em"
|
|
viewBox="0 0 10 16"
|
|
fill="currentColor"
|
|
aria-hidden="true"
|
|
>
|
|
<circle cx="2.5" cy="3" r="1.3" />
|
|
<circle cx="7.5" cy="3" r="1.3" />
|
|
<circle cx="2.5" cy="8" r="1.3" />
|
|
<circle cx="7.5" cy="8" r="1.3" />
|
|
<circle cx="2.5" cy="13" r="1.3" />
|
|
<circle cx="7.5" cy="13" r="1.3" />
|
|
</svg>
|
|
);
|
|
}
|
|
|
|
// An arrow pointing down at a line, for "scroll to the end". Same size and
|
|
// stroke as `ExpandIcon`.
|
|
export function ArrowDownIcon() {
|
|
return (
|
|
<svg
|
|
width="1.3em"
|
|
height="1.3em"
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
aria-hidden="true"
|
|
>
|
|
<line x1="12" y1="4" x2="12" y2="16" />
|
|
<polyline points="6 11 12 17 18 11" />
|
|
<line x1="5" y1="21" x2="19" y2="21" />
|
|
</svg>
|
|
);
|
|
}
|