Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

refactor(ui,web): W1 — icons, avatars, status, feedback and actions move into the shared UI package (#895)

Yaowei Zhengc11d6177954a
diff --git a/.agents/skills/penguin-harness-frontend/SKILL.md b/.agents/skills/penguin-harness-frontend/SKILL.md
index ce1cf471..e417c69a 100644
--- a/.agents/skills/penguin-harness-frontend/SKILL.md
+++ b/.agents/skills/penguin-harness-frontend/SKILL.md
@@ -107,17 +107,21 @@ which is why the control needs an id. `test/info-popover.test.ts` guards this.
## Icons
-One renderer: `components/ui/glyph-icon.tsx`. A 24×24 path, `strokeWidth` 1.7, `stroke="currentColor"`,
-`fill="none"` (or `filled` for an "on" state). Do not hand-write an `<svg>` for a line icon — put the
-path in the module that owns it (`lib/stat-icons.ts`, `components/ui/icons.tsx`, `group-list.tsx`,
-`session-row-menu.tsx`) and render it through `GlyphIcon`.
+One renderer: `GlyphIcon` from `@prismshadow/penguin-ui`. A 24×24 path stroked at the theme's
+`--ui-icon-stroke` (1.7 in Primer), `stroke="currentColor"`, `fill="none"` (or `filled` for an "on"
+state); pass `decor="nav|group|menu|empty"` only where a label beside it already says what it says.
+Do not hand-write an `<svg>` or a `const *_ICON = "M…"` for a line icon — the paths live in one
+registry, `ICONS` (`packages/ui/src/components/icons/icons.ts`), keyed by the drawing (`robot`,
+`alarmClock`), and the app's manifests say which drawing stands for what (`lib/nav-icons.ts`,
+`lib/stat-icons.ts`, `GROUP_MODE_ICONS`). A new glyph is a registry entry; `test/icon-registry.test.ts`
+holds the feature files' leftovers to a shrinking list.
Two marks deliberately live off that grid, because a two-stroke mark aliases when its grid and its
render size disagree: `ChevronDown` (12×12, stroke 1.5) and `CloseIcon` (14×14, stroke 1.5). Charts,
sparklines, the topology view, the ring gauges and the login background draw their own geometry and
are outside the family entirely.
-Sizes come from `src/lib/icon-scale.ts`, named by role, not by number — `inlineGlyph` 13,
+Sizes come from `ICON_SIZE` (`packages/ui/src/icon-scale.ts`), named by role, not by number — `inlineGlyph` 13,
`rowLead` 14, `iconButton` / `groupHeaderGlyph` 15, `navRow` / `groupHeaderAction` 16,
`groupHeaderAvatar` / `sectionMark` 18, `chevron` 14 / `chevronDense` 12, `caret` 12 /
`caretDense` 10. Pick the rung whose role matches; if none does, the honest move is to add a rung
diff --git a/changelog/unreleased/2026-09-30-ui-migration-w1.md b/changelog/unreleased/2026-09-30-ui-migration-w1.md
new file mode 100644
index 00000000..13b2fb9b
--- /dev/null
+++ b/changelog/unreleased/2026-09-30-ui-migration-w1.md
@@ -0,0 +1,37 @@
+# Icons, status marks and actions move into the shared UI package
+
+- **Date:** 2026-09-30
+- **Type:** refactor
+- **Scope:** `ui`, `web`, `ui-gallery`
+
+[中文版](2026-09-30-ui-migration-w1.zh.md)
+
+The first wave of the UI package migration moved the Web App's basic components into `@prismshadow/penguin-ui`. The web copies were deleted and their importers read the package root; the package components take their copy as props and their colours from theme tokens.
+
+## What moved
+
+- **Icons:** the `ICONS` registry, keyed by what each glyph draws, with `GlyphIcon`, `Chevron`, the fixed-grid marks (`ChevronDown`, `CheckIcon`, `PlusIcon`, `DownloadIcon`, `UploadIcon`, `CloseIcon`) and `ICON_SIZE` / `ICON_GAP`. Feature files' copies of a shared glyph (the plus, the back arrow and chevrons, the rotate arrow, the key, the eye, the book, the clock and others) now read the registry, which gained `plus`, `key`, `keyOff`, `rotateCw`, `arrowLeft`, `chevronLeft` and `chevronRight` for them.
+- **Avatars and logos:** `AgentAvatar`, `UserAvatar`, a new `AvatarStack` in place of two hand-built stacks, `ProviderLogo` and `PenguinLogo`.
+- **Status and feedback:** a new `Dot`, `StatusIcon`, `ActivityIcon` (formerly `SessionActivityIcon`) with `BackgroundTasksMark` and `ScheduleMark`, `UpdateDot` and `UpdatePill`, `Badge` (tones by name, plus `variant` and `size`) with a new `Count`, `Skeleton` and `EmptyState`.
+- **Actions:** `Button` (a `link` variant, `xs` / `icon-sm` sizes and `loading`), a new `IconButton`, a new `Link`, `CloseButton`, `CopyButton`, a new `Kbd` and `HiddenFileInput`.
+- **Strings:** a `UiStrings` provider carries the package's own accessibility fallbacks (close, copied, loading), which the Web App supplies in the interface language.
+
+## Details
+
+- A web guard holds the glyph paths still typed out in feature files to a list keyed by the wave that removes them; a new one fails.
+- A new theme token, `--ui-mark-new`, colours the update dot. Every theme declares it, and Primer keeps the pale red.
+
+## Visible changes in the default theme (Primer)
+
+- Badge and update-pill text 11 → 12 px. Badges come in soft, outline and solid weights; the former `brand` badge is neutral solid, and the "Free" badge is info (sky) instead of yellow.
+- Status icons 13 → 14 px, with the running state drawn by the Spinner's arc.
+- Tone inks (success, attention, danger) one step deeper in light mode.
+- The unread dot emerald-500 → emerald-700, at a fixed 6 px.
+- Buttons: the `secondary` ink one step darker, the `ghost` ink one step lighter, hover fills shifted one step.
+- Links take the link colour token and the external-link glyph instead of "↗".
+- Labels styled as buttons (the import controls) take the theme's focus outline on keyboard focus.
+- Copy buttons in rows are 20 px squares.
+- The close button's hover fill and ink one step lighter.
+- The empty-state ink one step lighter.
+- Skeletons keep their gray-200 fill, now through the line token.
+- Avatar tile inks re-measured against each theme's surfaces.
diff --git a/changelog/unreleased/2026-09-30-ui-migration-w1.zh.md b/changelog/unreleased/2026-09-30-ui-migration-w1.zh.md
new file mode 100644
index 00000000..e8a66ca1
--- /dev/null
+++ b/changelog/unreleased/2026-09-30-ui-migration-w1.zh.md
@@ -0,0 +1,37 @@
+# 图标、状态标记与操作组件迁入共享 UI 包
+
+- **Date:** 2026-09-30
+- **Type:** refactor
+- **Scope:** `ui`, `web`, `ui-gallery`
+
+[English](2026-09-30-ui-migration-w1.md)
+
+UI 包迁移的第一批把 Web App 的基础组件移入了 `@prismshadow/penguin-ui`。Web 端的副本已删除,引用方改从包根导入;包内组件的文案经 props 传入,颜色取自主题 Token。
+
+## 迁入的组件
+
+- **图标**:按图形命名的 `ICONS` 注册表,以及 `GlyphIcon`、`Chevron`、固定网格的小标记(`ChevronDown`、`CheckIcon`、`PlusIcon`、`DownloadIcon`、`UploadIcon`、`CloseIcon`)和 `ICON_SIZE` / `ICON_GAP`。功能文件里各处共用字形的副本(加号、返回箭头与左右尖角、旋转箭头、钥匙、眼睛、书、时钟等)改为从注册表读取,注册表为此新增 `plus`、`key`、`keyOff`、`rotateCw`、`arrowLeft`、`chevronLeft` 与 `chevronRight`。
+- **头像与标志**:`AgentAvatar`、`UserAvatar`、取代两处手写叠放的新组件 `AvatarStack`、`ProviderLogo` 与 `PenguinLogo`。
+- **状态与反馈**:新建的 `Dot`、`StatusIcon`、`ActivityIcon`(原 `SessionActivityIcon`)及 `BackgroundTasksMark`、`ScheduleMark`、`UpdateDot` 与 `UpdatePill`、`Badge`(按色调名取色,新增 `variant` 与 `size`)及新建的 `Count`、`Skeleton` 与 `EmptyState`。
+- **操作**:`Button`(新增 `link` 变体、`xs` / `icon-sm` 尺寸与 `loading`)、新建的 `IconButton`、新建的 `Link`、`CloseButton`、`CopyButton`、新建的 `Kbd` 与 `HiddenFileInput`。
+- **文案**:`UiStrings` provider 承载包内自带的无障碍兜底文案(关闭、已复制、加载中),由 Web App 按界面语言提供。
+
+## 细节
+
+- Web 端新增一项检查:功能文件里仍手写的字形路径登记在按波次分组的清单里,新出现的一条会直接报错。
+- 新增主题 Token `--ui-mark-new`,用于更新提示点。每个主题都声明它,通用主题保留原来的浅红。
+
+## 默认主题(通用)的可见变化
+
+- 徽标与更新提示胶囊的文字 11 → 12 px。徽标分浅底、描边、实底三种样式;原 `brand` 徽标改为中性实底,「免费」徽标由黄色改为信息色(天蓝)。
+- 状态图标 13 → 14 px,运行中状态改用 Spinner 的弧线绘制。
+- 浅色模式下的色调文字(成功、注意、危险)各深一档。
+- 未读点由 emerald-500 改为 emerald-700,固定 6 px。
+- 按钮:`secondary` 文字深一档,`ghost` 文字浅一档,悬停底色各移一档。
+- 链接改用链接色 Token,并以外链图标代替「↗」。
+- 做成按钮样式的 label(各处导入控件)在键盘聚焦时显示主题的焦点轮廓。
+- 行内的复制按钮为 20 px 见方。
+- 关闭按钮悬停时的底色与文字各浅一档。
+- 空状态文字浅一档。
+- 骨架屏底色仍为 gray-200,改由线条 Token 提供。
+- 头像色块的文字颜色按各主题的实际底色重新测定。
diff --git a/packages/landing/src/components/icons.tsx b/packages/landing/src/components/icons.tsx
index 81cb8056..10d5f804 100644
--- a/packages/landing/src/components/icons.tsx
+++ b/packages/landing/src/components/icons.tsx
@@ -275,8 +275,8 @@ export function FeatherIcon(props: IconProps) {
}
/**
- * Agent glyph, byte-identical to the Web App's AGENT_GROUP_ICON
- * (packages/web/src/components/ui/group-list.tsx): the product and the page that sells it must
+ * Agent glyph, byte-identical to the Web App's `ICONS.robot`
+ * (packages/ui/src/components/icons/icons.ts): the product and the page that sells it must
* not draw the same thing two ways. Kept as ONE path rather than this file's usual element mix
* so the two are literally the same string — test/agent-glyph-sync.test.ts fails when they drift.
*/
diff --git a/packages/landing/test/agent-glyph-sync.test.ts b/packages/landing/test/agent-glyph-sync.test.ts
index ec82868d..bb1fb00e 100644
--- a/packages/landing/test/agent-glyph-sync.test.ts
+++ b/packages/landing/test/agent-glyph-sync.test.ts
@@ -1,7 +1,8 @@
/**
* Landing ↔ Web App agent-glyph sync: the page that sells the product and the product itself
- * draw the Agent with the same mark, and there is no shared module to draw it from — the
- * landing page deliberately carries zero icon dependencies, so the path exists twice.
+ * draw the Agent with the same mark (the shared UI package's `ICONS.robot`), and there is no
+ * shared module to draw it from — the landing page deliberately carries zero icon dependencies,
+ * so the path exists twice.
*
* A copy is exactly what drifts: this glyph was hand-copied once before (the new-chat page's
* example folder) and quietly stayed on the old drawing the day it was redrawn. Both sides are
@@ -11,22 +12,13 @@ import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
-const webGlyphSource = join(
- __dirname,
- "..",
- "..",
- "web",
- "src",
- "components",
- "ui",
- "group-list.tsx",
-);
+const webGlyphSource = join(__dirname, "..", "..", "ui", "src", "components", "icons", "icons.ts");
const landingIconsSource = join(__dirname, "..", "src", "components", "icons.tsx");
-/** `export const AGENT_GROUP_ICON = "…"`, however prettier has wrapped it. */
+/** The registry's `robot: "…"` entry, however prettier has wrapped it. */
function webAgentGlyph(): string | null {
const source = readFileSync(webGlyphSource, "utf8");
- return /export const AGENT_GROUP_ICON\s*=\s*"([^"]+)"/.exec(source)?.[1] ?? null;
+ return /\brobot:\s*"([^"]+)"/.exec(source)?.[1] ?? null;
}
/** The single `<path d="…">` of the landing set's BotIcon. */
diff --git a/packages/ui-gallery/src/foundations/icons.tsx b/packages/ui-gallery/src/foundations/icons.tsx
index 5851b835..940b11dc 100644
--- a/packages/ui-gallery/src/foundations/icons.tsx
+++ b/packages/ui-gallery/src/foundations/icons.tsx
@@ -1,8 +1,8 @@
/**
- * Foundations › Icons: every line icon the Web App declares (read from its source, see
- * lib/icon-registry.ts; W1 moves the registry into the package) drawn at the theme's stroke, cap and
- * join, grouped by the file that declares it, after the size rungs of `ICON_SIZE`. A path declared
- * under several names shows once, marked with its count — W1's deduplication list.
+ * Foundations › Icons: every line icon of the shared registry (read from its source, see
+ * lib/icon-registry.ts) drawn at the theme's stroke, cap and join, grouped by the file that
+ * declares it, after the size rungs of `ICON_SIZE`. A path declared under several names shows
+ * once, marked with its count.
*/
import { WEB_ICON_SIZES, WEB_ICONS } from "../sources";
import { useGallery } from "../state";
@@ -12,7 +12,7 @@ export function IconsBoard() {
const { S } = useGallery();
const sources = [...new Set(WEB_ICONS.map((icon) => icon.sources[0] ?? ""))];
const sample =
- WEB_ICONS.find((icon) => icon.names.includes("GEAR_ICON"))?.d ?? WEB_ICONS[0]?.d ?? "";
+ WEB_ICONS.find((icon) => icon.names.includes("ICONS.gear"))?.d ?? WEB_ICONS[0]?.d ?? "";
return (
<div className="gf-board">
<BoardGroup
@@ -47,7 +47,7 @@ export function IconsBoard() {
>
<Glyph d={icon.d} size={16} />
<span className="gf-caption gf-mono gf-icon-name">
- {icon.names[0]?.replace(/_ICONS?$/, "").replace(/^[A-Z_]+ICONS\./, "")}
+ {icon.names[0]?.replace(/_ICONS?$/, "").replace(/^(?:[A-Z_]+_)?ICONS\./, "")}
</span>
{icon.names.length > 1 && (
<span
diff --git a/packages/ui-gallery/src/lib/icon-registry.ts b/packages/ui-gallery/src/lib/icon-registry.ts
index 57db00e1..82746ec7 100644
--- a/packages/ui-gallery/src/lib/icon-registry.ts
+++ b/packages/ui-gallery/src/lib/icon-registry.ts
@@ -1,15 +1,14 @@
/**
- * Reads the Web App's line-icon path strings out of its source text, for the Icons foundation page.
+ * Reads line-icon path strings out of source text, for the Icons foundation page.
*
- * Until W1 moves the icons into one registry in `packages/ui`, the paths are spread over a few web
- * modules, several re-export each other, and some are template literals built from shared
- * fragments. The gallery must not import web modules (they pull in the app's strings and state),
- * so it takes their raw text (`?raw`) and extracts:
+ * The page shows the shared registry (`packages/ui/src/components/icons/icons.ts`) as it is
+ * written, including the fragments its entries are composed from, so it reads the file's raw text
+ * (`?raw`) rather than importing it, and extracts:
*
* export const TRASH_ICON = "M4 6h16…"; → TRASH_ICON
* export const HIDDEN_ICON = `${EYE_OUTLINE}M3 3l18 18`; → HIDDEN_ICON (fragment resolved)
- * export const NAV_ICONS = { usage: "M4 20V10…", agents: AGENT_GROUP_ICON };
- * → NAV_ICONS.usage, NAV_ICONS.agents
+ * export const ICONS = { trash: "M4 6h16…", eyeOff: `${EYE_OUTLINE}M3 3l18 18` };
+ * → ICONS.trash, ICONS.eyeOff
*
* Constants resolve across every given file. Only strings that are SVG path data survive, and
* entries sharing one path are merged, so the page shows each distinct glyph once with every name
@@ -169,7 +168,7 @@ export function extractIconPaths(sources: Readonly<Record<string, string>>): Ico
return [...byPath.values()];
}
-/** `ICON_SIZE = { rowMark: 12, … }` → its rungs, from `lib/icon-scale.ts`'s text. */
+/** `ICON_SIZE = { rowMark: 12, … }` → its rungs, from `icon-scale.ts`'s text. */
export function extractIconSizes(raw: string): { name: string; px: number }[] {
const text = stripComments(raw);
const decl = /\bconst\s+ICON_SIZE\s*(?::[^=;]*)?=\s*\{/.exec(text);
diff --git a/packages/ui-gallery/src/library/boards/avatars.tsx b/packages/ui-gallery/src/library/boards/avatars.tsx
index eb4d8bd9..ac281be2 100644
--- a/packages/ui-gallery/src/library/boards/avatars.tsx
+++ b/packages/ui-gallery/src/library/boards/avatars.tsx
@@ -1,6 +1,14 @@
-/** 头像: the user avatar at its two rungs, with and without a nickname, and the agent avatar at three sizes. */
-import { AgentAvatar } from "../../../../web/src/components/ui/agent-avatar";
-import { USER_AVATAR_SIZE, UserAvatar } from "../../../../web/src/components/ui/user-avatar";
+/**
+ * 头像: the user avatar at its two rungs, with and without a nickname, the agent avatar at three
+ * sizes, and the avatar stack — agents and an account overlapping, then the count of the rest.
+ */
+import {
+ AgentAvatar,
+ AvatarStack,
+ ICON_SIZE,
+ USER_AVATAR_SIZE,
+ UserAvatar,
+} from "@prismshadow/penguin-ui";
import { BoardGroup } from "../../foundations/shared";
import { useGallery } from "../../state";
@@ -8,6 +16,10 @@ export function AvatarsBoard() {
const { S } = useGallery();
const t = S.library.avatars;
const [userId, displayName] = t.userNames;
+ const stack = [
+ { id: userId ?? "admin", name: displayName ?? userId ?? "admin", kind: "user" as const },
+ ...t.agents.map((agent) => ({ id: agent.id, name: agent.name })),
+ ];
return (
<div className="gf-board">
<BoardGroup title={t.user}>
@@ -46,6 +58,22 @@ export function AvatarsBoard() {
))}
</div>
</BoardGroup>
+ <BoardGroup title={t.stack}>
+ <div className="lib-row">
+ <span className="lib-cell">
+ <AvatarStack items={stack.slice(0, 3)} size={ICON_SIZE.groupHeaderAvatar} />
+ <span className="lib-caption">{t.stackShown(3, 3)}</span>
+ </span>
+ <span className="lib-cell">
+ <AvatarStack items={stack} size={ICON_SIZE.groupHeaderAvatar} />
+ <span className="lib-caption">{t.stackShown(3, stack.length)}</span>
+ </span>
+ <span className="lib-cell">
+ <AvatarStack items={stack} max={2} size={ICON_SIZE.rowLead} />
+ <span className="lib-caption">{t.stackShown(2, stack.length)}</span>
+ </span>
+ </div>
+ </BoardGroup>
</div>
);
}
diff --git a/packages/ui-gallery/src/library/boards/badges.tsx b/packages/ui-gallery/src/library/boards/badges.tsx
index 48d1df1f..3143c57d 100644
--- a/packages/ui-gallery/src/library/boards/badges.tsx
+++ b/packages/ui-gallery/src/library/boards/badges.tsx
@@ -1,21 +1,27 @@
-/** 徽标与状态: Badge in every tone, StatusIcon in every run state, the session activity marks, and the update dot and pill. */
-import { Badge } from "../../../../web/src/components/ui/badge";
-import type { BadgeTone } from "../../../../web/src/components/ui/badge";
+/**
+ * 徽标与状态: Badge in every tone and weight, the count, the state dot, StatusIcon in every run
+ * state, the session activity marks, and the update dot and pill.
+ */
import {
+ ActivityIcon,
BackgroundTasksMark,
+ Badge,
+ Count,
+ Dot,
+ ICON_SIZE,
ScheduleMark,
- SessionActivityIcon,
-} from "../../../../web/src/components/ui/session-activity-icon";
-import { StatusIcon } from "../../../../web/src/components/ui/status-icon";
-import type { RunState } from "../../../../web/src/components/ui/status-icon";
-import { UpdateDot, UpdatePill } from "../../../../web/src/components/ui/update-dot";
-import { ICON_SIZE } from "../../../../web/src/lib/icon-scale";
+ StatusIcon,
+ TONES,
+ UpdateDot,
+ UpdatePill,
+} from "@prismshadow/penguin-ui";
+import type { ActivityIconState, BadgeVariant, RunState } from "@prismshadow/penguin-ui";
import { BoardGroup } from "../../foundations/shared";
import { useGallery } from "../../state";
-const BADGE_TONES: readonly BadgeTone[] = ["gray", "brand", "green", "amber", "red"];
+const BADGE_VARIANTS: readonly BadgeVariant[] = ["soft", "outline", "solid"];
const RUN_STATES: readonly RunState[] = ["running", "waiting", "done", "failed", "stopped"];
-const ACTIVITIES = ["running", "compacting", "completedUnread"] as const;
+const ACTIVITIES: readonly ActivityIconState[] = ["running", "compacting", "completedUnread"];
export function BadgesBoard() {
const { S } = useGallery();
@@ -23,19 +29,45 @@ export function BadgesBoard() {
return (
<div className="gf-board">
<BoardGroup title={t.badges}>
+ <div className="lib-stack lib-stack-wide">
+ {BADGE_VARIANTS.map((variant) => (
+ <div key={variant} className="lib-row">
+ {TONES.map((tone) => (
+ <Badge key={tone} tone={tone} variant={variant}>
+ {t.tones[tone]}
+ </Badge>
+ ))}
+ <span className="lib-caption">{t.variants[variant]}</span>
+ </div>
+ ))}
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.count}>
<div className="lib-row">
- {BADGE_TONES.map((tone) => (
- <Badge key={tone} tone={tone}>
- {t.tones[tone]}
- </Badge>
+ <Count n={3} />
+ <Count n={42} />
+ <Count n={120} max={99} />
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.dots} aside={t.dotsHint}>
+ <div className="lib-row">
+ {TONES.map((tone) => (
+ <span key={tone} className="lib-cell">
+ <Dot tone={tone} size="md" />
+ <code className="lib-caption">{tone}</code>
+ </span>
))}
+ <span className="lib-cell">
+ <Dot tone="success" size="md" pulse label={t.live} />
+ <span className="lib-caption">{t.live}</span>
+ </span>
</div>
</BoardGroup>
<BoardGroup title={t.status}>
<div className="lib-row">
{RUN_STATES.map((state) => (
<span key={state} className="lib-cell">
- <StatusIcon state={state} size={16} label={t.states[state]} />
+ <StatusIcon state={state} label={t.states[state]} />
<span className="lib-caption">{t.states[state]}</span>
</span>
))}
@@ -45,7 +77,7 @@ export function BadgesBoard() {
<div className="lib-row">
{ACTIVITIES.map((activity) => (
<span key={activity} className="lib-cell">
- <SessionActivityIcon activity={activity} />
+ <ActivityIcon activity={activity} label={t.activities[activity]} />
<span className="lib-caption">{t.activities[activity]}</span>
</span>
))}
@@ -58,7 +90,7 @@ export function BadgesBoard() {
<span className="lib-caption">{t.background}</span>
</span>
<span className="lib-cell">
- <ScheduleMark size={ICON_SIZE.rowMark} />
+ <ScheduleMark label={t.schedule} size={ICON_SIZE.rowMark} />
<span className="lib-caption">{t.schedule}</span>
</span>
<span className="lib-cell">
diff --git a/packages/ui-gallery/src/library/boards/buttons.tsx b/packages/ui-gallery/src/library/boards/buttons.tsx
index 868a4f27..52a238d2 100644
--- a/packages/ui-gallery/src/library/boards/buttons.tsx
+++ b/packages/ui-gallery/src/library/boards/buttons.tsx
@@ -1,10 +1,17 @@
-/** 按钮: the app's Button in its four variants, two sizes and the icon form, disabled and busy. */
-import { Button } from "../../../../web/src/components/ui/button";
-import { PlusIcon } from "../../../../web/src/components/ui/icons";
-import { StatusIcon } from "../../../../web/src/components/ui/status-icon";
+/**
+ * 按钮: the Button in its five variants and five sizes, the icon button, disabled and loading, the
+ * link in a sentence and on its own, and the keyboard hint.
+ */
+import type { MouseEvent } from "react";
+import { Button, GlyphIcon, ICONS, IconButton, Kbd, Link, PlusIcon } from "@prismshadow/penguin-ui";
import { BoardGroup } from "../../foundations/shared";
import { useGallery } from "../../state";
+const RELEASES_URL = "https://github.com/Prism-Shadow/penguin-harness/releases";
+
+/** The in-sentence link points nowhere real; following it would navigate the board's frame away. */
+const stay = (event: MouseEvent) => event.preventDefault();
+
export function ButtonsBoard() {
const { S } = useGallery();
const t = S.library.buttons;
@@ -16,6 +23,7 @@ export function ButtonsBoard() {
<Button variant="secondary">{t.secondary}</Button>
<Button variant="danger">{t.danger}</Button>
<Button variant="ghost">{t.ghost}</Button>
+ <Button variant="link">{t.link}</Button>
</div>
</BoardGroup>
<BoardGroup title={t.sizes}>
@@ -26,11 +34,30 @@ export function ButtonsBoard() {
<Button variant="primary" size="sm">
{t.sm}
</Button>
- <Button variant="secondary" size="icon" aria-label={t.icon} data-tooltip={t.icon}>
- <PlusIcon />
+ <Button variant="secondary" size="xs">
+ {t.xs}
+ </Button>
+ <Button variant="secondary" size="sm" leading={<PlusIcon />}>
+ {t.leading}
</Button>
</div>
</BoardGroup>
+ <BoardGroup title={t.icon} aside={t.iconHint}>
+ <div className="lib-row">
+ <IconButton label={t.add}>
+ <PlusIcon />
+ </IconButton>
+ <IconButton label={t.add} size="sm">
+ <PlusIcon />
+ </IconButton>
+ <IconButton label={t.edit} variant="ghost">
+ <GlyphIcon d={ICONS.pencil} />
+ </IconButton>
+ <IconButton label={t.danger} variant="danger">
+ <GlyphIcon d={ICONS.trash} />
+ </IconButton>
+ </div>
+ </BoardGroup>
<BoardGroup title={t.states}>
<div className="lib-row">
<Button variant="primary" disabled>
@@ -39,10 +66,41 @@ export function ButtonsBoard() {
<Button variant="secondary" disabled>
{t.disabled}
</Button>
- <Button variant="primary" disabled aria-busy>
- <StatusIcon state="running" />
- <span>{t.busy}</span>
+ <Button variant="primary" loading loadingLabel={t.busy}>
+ {t.busy}
+ </Button>
+ <Button variant="secondary" size="sm" loading loadingLabel={t.busy}>
+ {t.busy}
</Button>
+ <IconButton label={t.add} loading loadingLabel={t.busy}>
+ <PlusIcon />
+ </IconButton>
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.links} aside={t.linksHint}>
+ <div className="lib-stack">
+ <p className="text-sm">
+ {t.inlineBefore}
+ <Link href="#release-notes" onClick={stay}>
+ {t.inlineLink}
+ </Link>
+ {t.inlineAfter}
+ </p>
+ <div className="lib-row">
+ <Link href={RELEASES_URL} external variant="standalone" className="text-sm">
+ {t.external}
+ </Link>
+ <Link href={RELEASES_URL} external variant="standalone" className="text-xs">
+ {t.external}
+ </Link>
+ </div>
+ </div>
+ </BoardGroup>
+ <BoardGroup title={t.keys}>
+ <div className="lib-row">
+ {t.shortcuts.map((keys) => (
+ <Kbd key={keys.join("+")} keys={keys} />
+ ))}
</div>
</BoardGroup>
</div>
diff --git a/packages/ui-gallery/src/library/boards/dialogs.tsx b/packages/ui-gallery/src/library/boards/dialogs.tsx
index f4d77854..36cc7bec 100644
--- a/packages/ui-gallery/src/library/boards/dialogs.tsx
+++ b/packages/ui-gallery/src/library/boards/dialogs.tsx
@@ -1,6 +1,6 @@
/** 对话框: Modal, ConfirmModal, Drawer and Sheet, each opened from a button and closed as the app closes it. */
import { useState } from "react";
-import { Button } from "../../../../web/src/components/ui/button";
+import { Button } from "@prismshadow/penguin-ui";
import { ConfirmModal } from "../../../../web/src/components/ui/confirm-modal";
import { Drawer } from "../../../../web/src/components/ui/drawer";
import { Input } from "../../../../web/src/components/ui/input";
diff --git a/packages/ui-gallery/src/library/boards/empty.tsx b/packages/ui-gallery/src/library/boards/empty.tsx
index 8db6709f..b33f3d70 100644
--- a/packages/ui-gallery/src/library/boards/empty.tsx
+++ b/packages/ui-gallery/src/library/boards/empty.tsx
@@ -1,6 +1,5 @@
-/** 空状态: the page placeholder with and without an action, and the settings one. */
-import { Button } from "../../../../web/src/components/ui/button";
-import { EmptyState, SettingsEmpty } from "../../../../web/src/components/ui/empty-state";
+/** 空状态: the page placeholder with and without an action, and the dashed slot form. */
+import { Button, EmptyState, SettingsEmpty } from "@prismshadow/penguin-ui";
import { BoardGroup } from "../../foundations/shared";
import { useGallery } from "../../state";
@@ -22,8 +21,9 @@ export function EmptyBoard() {
</div>
</BoardGroup>
<BoardGroup title={t.settings}>
- <div className="lib-box">
+ <div className="lib-stack">
<SettingsEmpty>{t.settingsText}</SettingsEmpty>
+ <EmptyState dashed title={t.title} description={t.description} />
</div>
</BoardGroup>
</div>
diff --git a/packages/ui-gallery/src/library/boards/loading.tsx b/packages/ui-gallery/src/library/boards/loading.tsx
index 3cf594ef..fb9d25cd 100644
--- a/packages/ui-gallery/src/library/boards/loading.tsx
+++ b/packages/ui-gallery/src/library/boards/loading.tsx
@@ -1,9 +1,16 @@
-/** 加载: the spinner (the running-state ring) at three sizes, and the skeleton line, list and card. */
-import { Skeleton, SkeletonCard, SkeletonList } from "../../../../web/src/components/ui/skeleton";
-import { StatusIcon } from "../../../../web/src/components/ui/status-icon";
+/** 加载: the running-state spinner on its three rungs, and the skeleton line, list and card. */
+import { Skeleton, SkeletonCard, SkeletonList, StatusIcon } from "@prismshadow/penguin-ui";
+import type { StatusIconSize } from "@prismshadow/penguin-ui";
import { BoardGroup } from "../../foundations/shared";
import { useGallery } from "../../state";
+/** The rungs and the pixels each one draws at. */
+const SPINNER_RUNGS: readonly (readonly [StatusIconSize, number])[] = [
+ ["xs", 10],
+ ["sm", 12],
+ ["md", 14],
+];
+
export function LoadingBoard() {
const { S } = useGallery();
const t = S.library.loading;
@@ -11,10 +18,12 @@ export function LoadingBoard() {
<div className="gf-board">
<BoardGroup title={t.spinner} aside={t.sizes}>
<div className="lib-row">
- {[13, 16, 24].map((size) => (
+ {SPINNER_RUNGS.map(([size, px]) => (
<span key={size} className="lib-cell">
<StatusIcon state="running" size={size} />
- <span className="lib-caption">{size}px</span>
+ <span className="lib-caption">
+ {size} · {px}px
+ </span>
</span>
))}
</div>
diff --git a/packages/ui-gallery/src/library/boards/notices.tsx b/packages/ui-gallery/src/library/boards/notices.tsx
index 92a527bc..45241a14 100644
--- a/packages/ui-gallery/src/library/boards/notices.tsx
+++ b/packages/ui-gallery/src/library/boards/notices.tsx
@@ -2,7 +2,7 @@
* 提示条: the app's NoticeStrip in every tone — plain, with the leading mark a call site draws
* (`data-slot="icon"`, which a theme that draws its own tone mark hides), and with actions.
*/
-import { Button } from "../../../../web/src/components/ui/button";
+import { Button } from "@prismshadow/penguin-ui";
import { NoticeStrip } from "../../../../web/src/components/ui/notice-strip";
import { toneDot } from "../../../../web/src/lib/tone";
import type { Tone } from "../../../../web/src/lib/tone";
diff --git a/packages/ui-gallery/src/library/boards/pickers.tsx b/packages/ui-gallery/src/library/boards/pickers.tsx
index 0ad81cad..6be95046 100644
--- a/packages/ui-gallery/src/library/boards/pickers.tsx
+++ b/packages/ui-gallery/src/library/boards/pickers.tsx
@@ -1,8 +1,7 @@
/** 选择器: the app's Select, Segmented, Switch, OptionMenu and Dropdown, each holding its own choice. */
import { useState } from "react";
-import { Button } from "../../../../web/src/components/ui/button";
+import { Button, ChevronDown } from "@prismshadow/penguin-ui";
import { Dropdown, menuItemClass } from "../../../../web/src/components/ui/dropdown";
-import { ChevronDown } from "../../../../web/src/components/ui/icons";
import { OptionMenu } from "../../../../web/src/components/ui/option-menu";
import { Segmented } from "../../../../web/src/components/ui/segmented";
import { Select } from "../../../../web/src/components/ui/select";
diff --git a/packages/ui-gallery/src/library/boards/toasts.tsx b/packages/ui-gallery/src/library/boards/toasts.tsx
index 131c2fd5..bdb93315 100644
--- a/packages/ui-gallery/src/library/boards/toasts.tsx
+++ b/packages/ui-gallery/src/library/boards/toasts.tsx
@@ -1,5 +1,5 @@
/** 提示弹窗: the toast after an action completes, in its four kinds, fired from buttons (the Toaster is mounted by the frame). */
-import { Button } from "../../../../web/src/components/ui/button";
+import { Button } from "@prismshadow/penguin-ui";
import {
toastAttention,
toastError,
diff --git a/packages/ui-gallery/src/library/boards/tooltips.tsx b/packages/ui-gallery/src/library/boards/tooltips.tsx
index 2980e77f..ea518a6a 100644
--- a/packages/ui-gallery/src/library/boards/tooltips.tsx
+++ b/packages/ui-gallery/src/library/boards/tooltips.tsx
@@ -1,5 +1,5 @@
/** 悬停提示: the app's one tooltip, by attribute (read by the frame's TooltipLayer) and by component, and on a truncated line. */
-import { Button } from "../../../../web/src/components/ui/button";
+import { Button } from "@prismshadow/penguin-ui";
import { Tooltip } from "../../../../web/src/components/ui/tooltip";
import { BoardGroup } from "../../foundations/shared";
import { useGallery } from "../../state";
diff --git a/packages/ui-gallery/src/sources.ts b/packages/ui-gallery/src/sources.ts
index 85888a44..6f9c336c 100644
--- a/packages/ui-gallery/src/sources.ts
+++ b/packages/ui-gallery/src/sources.ts
@@ -1,8 +1,8 @@
/**
* Files the gallery reads as text, via Vite globs:
*
- * - icon sources: the Web App modules that declare line-icon paths (see lib/icon-registry.ts), for
- * the library's Icons board;
+ * - icon sources: the shared registry of line-icon paths and the icon scale in `packages/ui` (see
+ * lib/icon-registry.ts), for the Icons foundation board;
* - font licences: `packages/ui/src/fonts/LICENSES/*.txt`, lazy, for `/fonts/licences`.
*/
import { extractIconPaths, extractIconSizes } from "./lib/icon-registry";
@@ -10,21 +10,17 @@ import { extractIconPaths, extractIconSizes } from "./lib/icon-registry";
/** Glob path → repo-relative path, for display. */
const repoPath = (globPath: string) => globPath.replace(/^(\.\.\/)+/, "packages/");
-const iconSources = import.meta.glob<string>(
- [
- "../../web/src/components/ui/icons.tsx",
- "../../web/src/components/ui/group-list.tsx",
- "../../web/src/components/ui/session-row-menu.tsx",
- "../../web/src/lib/stat-icons.ts",
- ],
- { query: "?raw", import: "default", eager: true },
-);
+const iconSources = import.meta.glob<string>("../../ui/src/components/icons/icons.ts", {
+ query: "?raw",
+ import: "default",
+ eager: true,
+});
export const WEB_ICONS = extractIconPaths(
Object.fromEntries(Object.entries(iconSources).map(([path, text]) => [repoPath(path), text])),
);
-const iconScale = import.meta.glob<string>("../../web/src/lib/icon-scale.ts", {
+const iconScale = import.meta.glob<string>("../../ui/src/icon-scale.ts", {
query: "?raw",
import: "default",
eager: true,
diff --git a/packages/ui-gallery/src/strings-en.ts b/packages/ui-gallery/src/strings-en.ts
index c8afa76d..6bcbf4b8 100644
--- a/packages/ui-gallery/src/strings-en.ts
+++ b/packages/ui-gallery/src/strings-en.ts
@@ -392,7 +392,8 @@ export const en: GalleryStrings = {
topics: {
buttons: {
title: "Buttons",
- description: "Four variants, two sizes and the icon button; disabled and busy.",
+ description:
+ "Five variants, five sizes and the icon button; disabled and loading; links and keyboard hints.",
},
inputs: {
title: "Inputs and forms",
@@ -424,7 +425,8 @@ export const en: GalleryStrings = {
tabs: { title: "Tabs", description: "The underline tab switcher, with an update badge." },
badges: {
title: "Badges and status",
- description: "Badges, run-state icons, session activity marks and the update dot.",
+ description:
+ "Badges and counts, state dots, run-state icons, session activity marks and the update dot.",
},
empty: {
title: "Empty states",
@@ -441,7 +443,10 @@ export const en: GalleryStrings = {
description:
"The chart foundation: the primitives every chart draws through, the current theme's chart tokens, and every chart built on them — the donut, cost trend and token bars, requests and success rate, the activity and score sparklines, the Trace timeline.",
},
- avatars: { title: "Avatars", description: "The user and agent avatars at their sizes." },
+ avatars: {
+ title: "Avatars",
+ description: "The user and agent avatars at their sizes, and a stack of them.",
+ },
files: { title: "Files", description: "The file tree and the read-only file browser." },
colour: {
title: "Colour",
@@ -464,13 +469,28 @@ export const en: GalleryStrings = {
secondary: "Cancel",
danger: "Delete",
ghost: "More",
+ link: "View details",
sizes: "Sizes",
md: "Default size",
sm: "Small",
+ xs: "Extra small",
+ leading: "New",
icon: "Icon button",
+ iconHint: "The label is required: it is both the accessible name and the tooltip.",
+ add: "Add",
+ edit: "Edit",
states: "States",
disabled: "Disabled",
busy: "Saving…",
+ links: "Links",
+ linksHint:
+ "A link in a sentence is always underlined; a standalone one shows the underline on hover. An external link opens in a new tab and carries the external mark.",
+ inlineBefore: "See the ",
+ inlineLink: "release notes",
+ inlineAfter: " for what changed.",
+ external: "All releases",
+ keys: "Keyboard hints",
+ shortcuts: [["Ctrl", "K"], ["Ctrl", "`"], ["Esc"]],
},
inputs: {
basics: "Inputs",
@@ -603,12 +623,18 @@ export const en: GalleryStrings = {
badges: {
badges: "Badges",
tones: {
- gray: "default",
- brand: "origin",
- green: "running",
- amber: "aborted",
- red: "failed",
+ neutral: "default",
+ success: "running",
+ attention: "aborted",
+ danger: "failed",
+ done: "done",
+ info: "free",
},
+ variants: { soft: "Soft", outline: "Outline", solid: "Solid" },
+ count: "Count",
+ dots: "State dots",
+ dotsHint: "Six tones; only what is live pulses",
+ live: "Live",
status: "Run state",
states: {
running: "Running",
@@ -741,6 +767,8 @@ export const en: GalleryStrings = {
avatars: {
user: "User avatar",
agent: "Agent avatar",
+ stack: "Avatar stack",
+ stackShown: (shown, total) => `${shown} of ${total} shown`,
userNames: ["admin", "Demo admin"],
agents: [
{ id: "docs-expert", name: "Docs Expert" },
diff --git a/packages/ui-gallery/src/strings.ts b/packages/ui-gallery/src/strings.ts
index beb8ec21..a8f14303 100644
--- a/packages/ui-gallery/src/strings.ts
+++ b/packages/ui-gallery/src/strings.ts
@@ -394,7 +394,10 @@ export const zh = {
title: "组件库",
groups: { components: "组件", foundations: "视觉基础" } as Record<TopicGroupId, string>,
topics: {
- buttons: { title: "按钮", description: "四种变体、两档尺寸与图标按钮,以及禁用与进行中。" },
+ buttons: {
+ title: "按钮",
+ description: "五种变体、五档尺寸与图标按钮,禁用与加载中,以及链接与键盘提示。",
+ },
inputs: {
title: "输入与表单",
description: "文本框、多行文本、密码框与字段脚手架:标签、提示、说明与错误。",
@@ -413,7 +416,7 @@ export const zh = {
tabs: { title: "标签页", description: "下划线式标签切换,可带更新标记。" },
badges: {
title: "徽标与状态",
- description: "徽标、运行状态图标、会话活动标记与更新点。",
+ description: "徽标与计数、状态点、运行状态图标、会话活动标记与更新点。",
},
empty: { title: "空状态", description: "列表或详情为空时的占位文字,可带操作。" },
loading: { title: "加载", description: "转圈与骨架屏。" },
@@ -427,7 +430,7 @@ export const zh = {
description:
"统计图的基础:所有图表共用的绘图原语、当前主题的图表令牌,以及建立在它们之上的每一种图表——环形图、趋势与用量柱、请求与成功率、活动与评分折线、轨迹时间线。",
},
- avatars: { title: "头像", description: "用户头像与智能体头像的各个尺寸。" },
+ avatars: { title: "头像", description: "用户头像与智能体头像的各个尺寸,以及头像组。" },
files: { title: "文件", description: "文件树与只读文件浏览器。" },
colour: {
title: "颜色",
@@ -447,13 +450,28 @@ export const zh = {
secondary: "取消",
danger: "删除",
ghost: "更多",
+ link: "查看详情",
sizes: "尺寸",
md: "默认尺寸",
sm: "小尺寸",
+ xs: "最小尺寸",
+ leading: "新建",
icon: "图标按钮",
+ iconHint: "名称必填:它既是无障碍名称,也是悬停提示。",
+ add: "添加",
+ edit: "编辑",
states: "状态",
disabled: "已禁用",
busy: "保存中…",
+ links: "链接",
+ linksHint:
+ "句中的链接始终带下划线,独立的链接悬停时才出现下划线;外部链接在新标签页打开,并带外链标记。",
+ inlineBefore: "本次改动见",
+ inlineLink: "发布说明",
+ inlineAfter: "。",
+ external: "查看全部版本",
+ keys: "键盘提示",
+ shortcuts: [["Ctrl", "K"], ["Ctrl", "`"], ["Esc"]] as readonly (readonly string[])[],
},
inputs: {
basics: "文本框",
@@ -570,12 +588,18 @@ export const zh = {
badges: {
badges: "徽标",
tones: {
- gray: "默认",
- brand: "来源",
- green: "运行中",
- amber: "已中止",
- red: "失败",
+ neutral: "默认",
+ success: "运行中",
+ attention: "已中止",
+ danger: "失败",
+ done: "已完成",
+ info: "免费",
},
+ variants: { soft: "浅底", outline: "描边", solid: "实底" },
+ count: "计数",
+ dots: "状态点",
+ dotsHint: "六种语气;只有正在进行的事才跳动",
+ live: "进行中",
status: "运行状态",
states: {
running: "运行中",
@@ -703,6 +727,8 @@ export const zh = {
avatars: {
user: "用户头像",
agent: "智能体头像",
+ stack: "头像组",
+ stackShown: (shown: number, total: number) => `共 ${total} 个,显示 ${shown} 个`,
userNames: ["admin", "演示管理员"] as readonly string[],
agents: [
{ id: "docs-expert", name: "Docs Expert" },
diff --git a/packages/ui-gallery/test/icon-registry.test.ts b/packages/ui-gallery/test/icon-registry.test.ts
index fc528fe2..b832a0c5 100644
--- a/packages/ui-gallery/test/icon-registry.test.ts
+++ b/packages/ui-gallery/test/icon-registry.test.ts
@@ -43,27 +43,24 @@ describe("extractIconPaths", () => {
expect(icons.map((icon) => icon.names)).toEqual([["D"]]);
});
- it("finds the Web App's icons in the modules the gallery reads", () => {
+ it("finds the shared registry's icons in the files the gallery reads", () => {
const read = (path: string) =>
- readFileSync(fileURLToPath(new URL(`../../web/src/${path}`, import.meta.url)), "utf8");
- const icons = extractIconPaths({
- icons: read("components/ui/icons.tsx"),
- groupList: read("components/ui/group-list.tsx"),
- rowMenu: read("components/ui/session-row-menu.tsx"),
- stat: read("lib/stat-icons.ts"),
- });
+ readFileSync(fileURLToPath(new URL(`../../ui/src/${path}`, import.meta.url)), "utf8");
+ const icons = extractIconPaths({ icons: read("components/icons/icons.ts") });
const names = icons.flatMap((icon) => icon.names);
expect(icons.length).toBeGreaterThan(30);
for (const name of [
- "TRASH_ICON",
- "GEAR_ICON",
- "FOLDER_ICON",
- "STAT_ICONS.copy",
- "NAV_ICONS.models",
+ "ICONS.trash",
+ "ICONS.gear",
+ "ICONS.folder",
+ "ICONS.copy",
+ "ICONS.eyeOff",
]) {
expect(names).toContain(name);
}
- const sizes = extractIconSizes(read("lib/icon-scale.ts"));
+ // The registry draws each glyph once: no path goes by two names in it.
+ expect(icons.filter((icon) => icon.names.length > 1)).toEqual([]);
+ const sizes = extractIconSizes(read("icon-scale.ts"));
expect(sizes.find((rung) => rung.name === "inlineGlyph")?.px).toBe(13);
});
});
diff --git a/packages/ui/src/components/actions/button/button.tsx b/packages/ui/src/components/actions/button/button.tsx
new file mode 100644
index 00000000..96a4299b
--- /dev/null
+++ b/packages/ui/src/components/actions/button/button.tsx
@@ -0,0 +1,151 @@
+/**
+ * The button: a small radius, a one-pixel line and a single accent, and nothing that moves but
+ * colour. Five variants — the accent `primary`, the bordered `secondary`, `danger` (red ink on the
+ * neutral box, the red reserved for hover), the borderless `ghost` and the `link` that reads as
+ * text — on five sizes: three text rungs and two squares for a lone glyph.
+ *
+ * `loading` puts the one Spinner in the leading slot and marks the button busy, so no call site
+ * hand-draws its own ring; the square sizes have one slot, so there the spinner takes the glyph's
+ * place. Focus is the base rule every button and link shares, not a ring of its own.
+ */
+import type { ButtonHTMLAttributes, ReactNode } from "react";
+import { useUiStrings } from "../../../strings";
+import { Spinner } from "../../icons/spinner/spinner";
+
+export type ButtonVariant = "primary" | "secondary" | "danger" | "ghost" | "link";
+export type ButtonSize = "xs" | "sm" | "md" | "icon" | "icon-sm";
+
+const VARIANT: Record<ButtonVariant, string> = {
+ // The accent follows the theme and the user's accent choice; the hover dims it rather than
+ // naming a second colour, so an accent the user picked needs no hover twin.
+ primary:
+ "border border-accent bg-accent font-medium text-accent-fg transition-opacity hover:opacity-90 disabled:opacity-50",
+ secondary: "border border-line-emphasis bg-surface font-medium text-fg hover:bg-surface-muted",
+ // Red ink on the neutral box at rest; the red line and tint arrive on hover only, so a row of
+ // actions does not shout before one is chosen.
+ danger:
+ "border border-line-emphasis bg-surface font-medium text-tone-danger-fg hover:border-tone-danger-line hover:bg-tone-danger-bg",
+ ghost:
+ "border border-transparent bg-transparent font-medium text-fg-muted hover:bg-surface-muted hover:text-fg",
+ // Text that acts: no box, the link colour, the underline on hover. It keeps the body weight,
+ // because a link-button sits in a sentence or a row of plain text.
+ link: "text-link underline-offset-2 hover:text-link-hover hover:underline disabled:no-underline",
+};
+
+const SIZE: Record<ButtonSize, string> = {
+ xs: "rounded-control px-2 py-0.5 text-xs",
+ sm: "rounded-control px-2.5 py-1 text-xs",
+ md: "rounded-control px-3 py-1.5 text-sm",
+ icon: "rounded-control p-1.5",
+ "icon-sm": "rounded-control p-1",
+};
+
+/** A link-button has no box to pad: only the type rung follows `size`. */
+const LINK_SIZE: Record<ButtonSize, string> = {
+ xs: "text-xs",
+ sm: "text-xs",
+ md: "text-sm",
+ icon: "",
+ "icon-sm": "",
+};
+
+/** Layout and motion shared by a real button and the element that stands in for one. */
+const BASE = "inline-flex items-center justify-center gap-1 transition-colors duration-150";
+
+const look = (variant: ButtonVariant, size: ButtonSize) =>
+ `${VARIANT[variant]} ${variant === "link" ? LINK_SIZE[size] : SIZE[size]}`;
+
+const isSquare = (size: ButtonSize) => size === "icon" || size === "icon-sm";
+
+export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
+ variant?: ButtonVariant;
+ size?: ButtonSize;
+ /** Busy: the spinner takes the leading slot, and the button is disabled and `aria-busy`. */
+ loading?: boolean;
+ /** What the spinner announces while `loading`; the interface's busy word when omitted. */
+ loadingLabel?: string;
+ /** A mark before the label — a glyph, an avatar. The spinner replaces it while `loading`. */
+ leading?: ReactNode;
+}
+
+export function Button({
+ variant = "secondary",
+ size = "md",
+ loading = false,
+ loadingLabel,
+ leading,
+ className = "",
+ title,
+ disabled,
+ children,
+ ...rest
+}: ButtonProps) {
+ const strings = useUiStrings();
+ // `title` is the hover hint, shown by the app's tooltip layer rather than the browser's own.
+ // The native attribute also named a wordless button; the tooltip layer names nothing, so a
+ // square button whose only label was its title keeps it as its accessible name.
+ const nameless =
+ isSquare(size) && rest["aria-label"] === undefined && rest["aria-labelledby"] === undefined;
+ const spinner = loading ? <Spinner size="sm" label={loadingLabel ?? strings.loading} /> : null;
+ return (
+ <button
+ type="button"
+ data-tooltip={title}
+ {...(nameless && title !== undefined ? { "aria-label": title } : {})}
+ aria-busy={loading || undefined}
+ disabled={disabled || loading}
+ className={`${BASE} disabled:cursor-not-allowed disabled:opacity-60 ${look(variant, size)} ${className}`}
+ {...rest}
+ >
+ {isSquare(size) && spinner !== null ? (
+ spinner
+ ) : (
+ <>
+ {spinner ?? leading}
+ {children}
+ </>
+ )}
+ </button>
+ );
+}
+
+export interface IconButtonProps extends Omit<
+ ButtonProps,
+ "size" | "leading" | "aria-label" | "aria-labelledby"
+> {
+ /** The accessible name, and the tooltip unless `title` gives a shorter one. */
+ label: string;
+ size?: "sm" | "md";
+}
+
+/**
+ * A square button holding one glyph. A wordless control is unreadable without a name, so the
+ * name is required here rather than remembered at each call site: it becomes the `aria-label`
+ * and, unless `title` says something shorter (the row's verb without the row's name), the tooltip.
+ */
+export function IconButton({ label, size = "md", title, ...rest }: IconButtonProps) {
+ return (
+ <Button
+ {...rest}
+ size={size === "sm" ? "icon-sm" : "icon"}
+ aria-label={label}
+ title={title ?? label}
+ />
+ );
+}
+
+/**
+ * The Button look on an element that cannot be a `<button>`: the `<label>` a file picker needs,
+ * since the hidden `<input type="file">` has to be labelled to be clickable. Built from the records
+ * `Button` reads, so a variant or a rung moves in one place.
+ *
+ * Two deliberate differences from `Button`: the focus outline is drawn while the input inside has
+ * keyboard focus, because the label itself never takes focus, and `cursor-pointer` is spelled out,
+ * which a `<button>` gets from the base rules and a `<label>` does not.
+ */
+export function buttonClass(
+ variant: ButtonVariant,
+ size: Exclude<ButtonSize, "icon" | "icon-sm">,
+): string {
+ return `${BASE} cursor-pointer has-[:focus-visible]:[outline:var(--ui-focus-ring)] has-[:focus-visible]:[outline-offset:var(--ui-focus-ring-offset)] ${look(variant, size)}`;
+}
diff --git a/packages/ui/src/components/actions/close-button/close-button.tsx b/packages/ui/src/components/actions/close-button/close-button.tsx
new file mode 100644
index 00000000..d5e054e0
--- /dev/null
+++ b/packages/ui/src/components/actions/close-button/close-button.tsx
@@ -0,0 +1,36 @@
+/**
+ * The close cross of a dialog, drawer or sheet header: the same glyph, padding and hover wherever
+ * a layer can be dismissed. Its accessible name is the package's `close` string unless the caller
+ * names it; the tooltip is the caller's, when it has something to add. Extra button props (a
+ * sheet's pointer-down guard) pass through.
+ */
+import type { ButtonHTMLAttributes } from "react";
+import { useUiStrings } from "../../../strings";
+import { CloseIcon } from "../../icons/marks/marks";
+
+export function CloseButton({
+ onClose,
+ label,
+ className = "",
+ title,
+ ...rest
+}: {
+ onClose: () => void;
+ /** The accessible name; defaults to the interface's word for "close". */
+ label?: string;
+ className?: string;
+} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "onClick">) {
+ const strings = useUiStrings();
+ return (
+ <button
+ type="button"
+ aria-label={label ?? strings.close}
+ onClick={onClose}
+ className={`rounded-control p-1.5 text-fg-subtle transition-colors duration-150 hover:bg-surface-muted hover:text-fg-muted ${className}`}
+ data-tooltip={title}
+ {...rest}
+ >
+ <CloseIcon />
+ </button>
+ );
+}
diff --git a/packages/ui/src/components/actions/copy-button/copy-button.tsx b/packages/ui/src/components/actions/copy-button/copy-button.tsx
new file mode 100644
index 00000000..ff36f4ca
--- /dev/null
+++ b/packages/ui/src/components/actions/copy-button/copy-button.tsx
@@ -0,0 +1,171 @@
+/**
+ * Copy-to-clipboard button and the hook behind it — the single place the "copy" affordance and
+ * its feedback live, so every copy control behaves the same:
+ *
+ * - the feedback follows the WRITE: the check appears only once the text has actually
+ * reached the clipboard (the clipboard writer reports that), so a copy the browser refused
+ * never reads as one that succeeded;
+ * - the feedback is shown AT THE BUTTON, and it is the icon alone: copy swaps to the check for
+ * COPIED_MS. No text changes anywhere — not a label, not the tooltip, which keeps naming the
+ * action. A control that keeps a visible text label keeps it unchanged and swaps only its
+ * glyph — see CopyCheckGlyph + useCopied;
+ * - the icon swap is silent, so every copy affordance also renders a CopiedStatus live region
+ * beside itself — the screen-reader half of the same feedback.
+ */
+import { createContext, useContext, useEffect, useRef, useState } from "react";
+import type { ReactElement, ReactNode } from "react";
+import { useUiStrings } from "../../../strings";
+import { GlyphIcon } from "../../icons/glyph-icon/glyph-icon";
+import { ICONS } from "../../icons/icons";
+
+/** How long the copied state (the check icon) stays after a click. */
+const COPIED_MS = 1500;
+
+/**
+ * Writes `text` to the clipboard, resolving to whether it actually got there. It never rejects,
+ * and it never reports a write it did not make: the copy feedback is shown on its answer.
+ */
+export type ClipboardWriter = (text: string) => Promise<boolean>;
+
+/**
+ * The writer used where the app supplies none: the async Clipboard API, which exists only in a
+ * secure context. The app hands in a sturdier one through {@link ClipboardWriterProvider}.
+ */
+async function writeWithClipboardApi(text: string): Promise<boolean> {
+ const clipboard = globalThis.navigator?.clipboard;
+ if (clipboard === undefined) return false;
+ try {
+ await clipboard.writeText(text);
+ return true;
+ } catch {
+ return false;
+ }
+}
+
+const ClipboardWriterContext = createContext<ClipboardWriter>(writeWithClipboardApi);
+
+/** Supplies the app's clipboard writer to every copy control below it; mount it once. */
+export function ClipboardWriterProvider({
+ write,
+ children,
+}: {
+ write: ClipboardWriter;
+ children?: ReactNode;
+}): ReactElement {
+ return (
+ <ClipboardWriterContext.Provider value={write}>{children}</ClipboardWriterContext.Provider>
+ );
+}
+
+/**
+ * Transient "just copied" flag: `flash()` writes the text and, if the write landed, turns
+ * `copied` on for COPIED_MS. For a caller whose copy trigger is not a plain CopyButton (a text
+ * button rendering CopyCheckGlyph beside its label); most callers use CopyButton directly.
+ */
+export function useCopied(): { copied: boolean; flash: (text: string) => void } {
+ const write = useContext(ClipboardWriterContext);
+ const [copied, setCopied] = useState(false);
+ // The pending reset is held so it can be restarted and cancelled. Restarted: a second click
+ // must get its own full COPIED_MS, or the first click's timer clears the check right after the
+ // second copy — and the check is the only visible feedback, so a check that vanishes on click
+ // reads as "the copy didn't take". Cancelled: the control can unmount inside the window (a
+ // popover or a modal that closes itself), and the timeout must not outlive it.
+ const resetTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
+ useEffect(
+ () => () => {
+ if (resetTimer.current !== null) clearTimeout(resetTimer.current);
+ },
+ [],
+ );
+ const flash = (text: string) => {
+ void write(text).then((ok) => {
+ // A refused write shows nothing rather than a check: the control returns to idle, so the
+ // copy can simply be retried — there is no state to be stuck in.
+ if (!ok) return;
+ setCopied(true);
+ if (resetTimer.current !== null) clearTimeout(resetTimer.current);
+ resetTimer.current = setTimeout(() => {
+ resetTimer.current = null;
+ setCopied(false);
+ }, COPIED_MS);
+ });
+ };
+ return { copied, flash };
+}
+
+/** The glyph pair every copy affordance shows: the copy icon, swapping to the check while copied. */
+export function CopyCheckGlyph({ copied, size }: { copied: boolean; size?: number }) {
+ return <GlyphIcon d={copied ? ICONS.check : ICONS.copy} size={size} />;
+}
+
+/**
+ * Screen-reader half of the copy feedback, rendered NEXT TO the control (never inside it, so it
+ * joins neither the visible label nor the accessible name). The check glyph is `aria-hidden` and
+ * the tooltip names the action, not the result, so without this region the confirmation is
+ * silent. The region is always rendered and merely filled on copy: a live region announces
+ * changes to its content, so it has to exist before the text appears.
+ *
+ * Deliberately a bare `aria-live` region rather than `role="status"` (which would mean the same to
+ * a screen reader): `role="status"` marks a running Spinner, and copy buttons sit on pages whose
+ * tests assert no spinner is left over.
+ */
+export function CopiedStatus({
+ copied,
+ announcement,
+}: {
+ copied: boolean;
+ /** What is announced once copied; the interface's word for "copied" when omitted. */
+ announcement?: string;
+}) {
+ const strings = useUiStrings();
+ return (
+ <span className="sr-only" aria-live="polite" aria-atomic="true">
+ {copied ? (announcement ?? strings.copied) : ""}
+ </span>
+ );
+}
+
+/** The compact look every copy button shares: a quiet glyph that fills in on hover. */
+const LOOK =
+ "rounded-sm text-fg-subtle transition-colors duration-150 hover:bg-surface-muted hover:text-fg-muted";
+
+const SIZE = {
+ // Beside a line of small text (an id, a path, a stats row): a 20 px square, the line height
+ // those rows keep, so the button sits on the line without making it taller.
+ sm: "inline-flex size-5 items-center justify-center",
+ // A message footer, a code block's corner: the glyph with a rhythm step of padding round it.
+ md: "p-1",
+} as const;
+
+export function CopyButton({
+ text,
+ label,
+ size = "md",
+ className = "",
+}: {
+ /** The string to copy, or a getter for content computed at click time (a formatted stats line). */
+ text: string | (() => string);
+ /** Accessible name and tooltip of the copy action; neither changes while copied. */
+ label: string;
+ size?: keyof typeof SIZE;
+ /** Layout the caller's row needs (`shrink-0`, a margin); the look is the button's own. */
+ className?: string;
+}) {
+ const { copied, flash } = useCopied();
+ return (
+ <>
+ <button
+ type="button"
+ data-tooltip={label}
+ aria-label={label}
+ onClick={() => flash(typeof text === "function" ? text() : text)}
+ className={`${LOOK} ${SIZE[size]} ${className}`}
+ >
+ <CopyCheckGlyph copied={copied} />
+ </button>
+ {/* Sibling, not a child: the button's accessible name stays `label`, and `sr-only` is
+ position:absolute, so it is not a flex item and disturbs no caller's layout. */}
+ <CopiedStatus copied={copied} />
+ </>
+ );
+}
diff --git a/packages/web/src/components/ui/hidden-file-input.tsx b/packages/ui/src/components/actions/hidden-file-input/hidden-file-input.tsx
similarity index 77%
rename from packages/web/src/components/ui/hidden-file-input.tsx
rename to packages/ui/src/components/actions/hidden-file-input/hidden-file-input.tsx
index b40035fe..edbb61a8 100644
--- a/packages/web/src/components/ui/hidden-file-input.tsx
+++ b/packages/ui/src/components/actions/hidden-file-input/hidden-file-input.tsx
@@ -1,13 +1,12 @@
/**
* File input that is visually hidden but still Tab-focusable — the picker every "upload" /
- * "import" control in the app wraps in its own `<label>`.
+ * "import" control wraps in its own `<label>`.
*
* `display: none` would drop it out of the focus order, so the box has to be visually hidden
* the `sr-only` way, which means `position: absolute`. That is exactly the shape that used to
- * escape its scroller and stretch the document (see the scroll-container invariant in
- * styles.css): dropped into a `static` ancestor chain, its containing block became the
- * initial containing block, so a control sitting past the fold added document-level
- * scrollable overflow and a second scrollbar.
+ * escape its scroller and stretch the document (the app's scroll-container invariant): dropped
+ * into a `static` ancestor chain, its containing block became the initial containing block, so a
+ * control sitting past the fold added document-level scrollable overflow and a second scrollbar.
*
* Hence the wrapper: it is positioned (`absolute`), so the containing block travels **with
* the control** instead of depending on whichever ancestor happens to be positioned. The
diff --git a/packages/ui/src/components/actions/kbd/kbd.tsx b/packages/ui/src/components/actions/kbd/kbd.tsx
new file mode 100644
index 00000000..ca2b7077
--- /dev/null
+++ b/packages/ui/src/components/actions/kbd/kbd.tsx
@@ -0,0 +1,49 @@
+/**
+ * A keyboard hint: the keys of one shortcut, in the order they are pressed (`["Ctrl", "`"]`).
+ * The outer `<kbd>` holding one `<kbd>` per key is HTML's own markup for a key combination, so
+ * assistive technology reads it as keys rather than as prose.
+ *
+ * Two looks:
+ * - `caps` (the default): each key on its own key cap, for a hint standing on its own;
+ * - `plain`: the keys as mono text joined by `+`, no cap chrome, in the caller's ink — for a hint
+ * inside something that already has a frame (a menu row, a settings control).
+ *
+ * The caller supplies the keys as the platform names them; the hint never guesses a platform. A
+ * platform that writes a chord as one glyph run (`⌘W`) passes it as a single key.
+ */
+import { Fragment } from "react";
+
+export function Kbd({
+ keys,
+ variant = "caps",
+ className = "",
+}: {
+ keys: readonly string[];
+ variant?: "caps" | "plain";
+ className?: string;
+}) {
+ if (variant === "plain") {
+ return (
+ <kbd className={`inline-flex shrink-0 items-center font-mono text-xs ${className}`}>
+ {keys.map((key, i) => (
+ <Fragment key={`${i}:${key}`}>
+ {i > 0 && <span aria-hidden>+</span>}
+ <kbd>{key}</kbd>
+ </Fragment>
+ ))}
+ </kbd>
+ );
+ }
+ return (
+ <kbd className={`inline-flex shrink-0 items-center gap-1 ${className}`}>
+ {keys.map((key, i) => (
+ <kbd
+ key={`${i}:${key}`}
+ className="rounded-sm border border-line bg-surface-inset px-1 font-mono text-xs text-fg-muted"
+ >
+ {key}
+ </kbd>
+ ))}
+ </kbd>
+ );
+}
diff --git a/packages/ui/src/components/actions/link/link.tsx b/packages/ui/src/components/actions/link/link.tsx
new file mode 100644
index 00000000..d35d3135
--- /dev/null
+++ b/packages/ui/src/components/actions/link/link.tsx
@@ -0,0 +1,65 @@
+/**
+ * A text link, in the theme's link colour. Two placements:
+ *
+ * - `inline` — inside running text. Underlined at rest, because a link among words must not be
+ * told apart by its colour alone.
+ * - `standalone` — on its own in a row or a header ("Get API key", "View releases"). Its place
+ * already says it is a link, so the underline waits for hover.
+ *
+ * `external` opens the page in a new tab, isolated from this one (`noopener noreferrer`: the page
+ * gets no handle back to the app's window and no referrer), and draws the external-link glyph after
+ * the text — the one visible sign that a click leaves the app. The glyph is decorative; the text,
+ * or the caller's `aria-label` on a link whose text is hidden, carries the name.
+ */
+import type { AnchorHTMLAttributes, ReactNode } from "react";
+import { ICON_SIZE } from "../../../icon-scale";
+import { GlyphIcon } from "../../icons/glyph-icon/glyph-icon";
+import { ICONS } from "../../icons/icons";
+
+export type LinkVariant = "inline" | "standalone";
+
+const VARIANT: Record<LinkVariant, string> = {
+ inline: "underline underline-offset-2",
+ standalone: "inline-flex items-center gap-1 underline-offset-2 hover:underline",
+};
+
+export interface LinkProps extends Omit<
+ AnchorHTMLAttributes<HTMLAnchorElement>,
+ "href" | "target" | "rel"
+> {
+ href: string;
+ /** Opens in a new tab, isolated from the app, with the external-link glyph after the text. */
+ external?: boolean;
+ variant?: LinkVariant;
+ children?: ReactNode;
+}
+
+export function Link({
+ href,
+ external = false,
+ variant = "inline",
+ className = "",
+ children,
+ ...rest
+}: LinkProps) {
+ return (
+ <a
+ href={href}
+ {...(external ? { target: "_blank", rel: "noopener noreferrer" } : {})}
+ className={`text-link transition-colors duration-150 hover:text-link-hover ${VARIANT[variant]} ${className}`}
+ {...rest}
+ >
+ {children}
+ {external &&
+ (variant === "inline" ? (
+ // Inside a sentence the anchor stays inline so its text can wrap; the glyph rides on
+ // the last line in a box of its own, nudged onto the text's middle.
+ <span className="ml-0.5 inline-block align-middle">
+ <GlyphIcon d={ICONS.externalLink} size={ICON_SIZE.inlineGlyph} />
+ </span>
+ ) : (
+ <GlyphIcon d={ICONS.externalLink} size={ICON_SIZE.inlineGlyph} />
+ ))}
+ </a>
+ );
+}
diff --git a/packages/ui/src/components/feedback/badge/badge.tsx b/packages/ui/src/components/feedback/badge/badge.tsx
new file mode 100644
index 00000000..5d829eeb
--- /dev/null
+++ b/packages/ui/src/components/feedback/badge/badge.tsx
@@ -0,0 +1,99 @@
+/**
+ * The badge: a small capsule that states something about the row it sits in — a state
+ * ("running", "failed"), a kind ("module", "admin"), a number — and never a mood ("new", "hot").
+ *
+ * Colour comes from the semantic tones, so a badge that reports a state matches every other
+ * mark for that state, and one that labels a kind takes `neutral`. Three weights:
+ *
+ * - `soft` (the default) — the tone's tint under its ink;
+ * - `outline` — the tone's line and ink on no fill, for a quieter tag;
+ * - `solid` — the tone's solid fill under its label, for a tag that should read as prominent
+ * without claiming more severity than its tone ("default", "origin", "queued" are neutral and
+ * solid).
+ *
+ * The outline is drawn inside the box, so the three weights share one size and a row of mixed
+ * badges stays aligned. The capsule's radius is the theme's pill radius: round in Primer and
+ * Frost, square in Console.
+ *
+ * `Count` is the numeric form: a neutral capsule holding a number in tabular figures, so a count
+ * that ticks up does not jitter its row.
+ */
+import type { ReactNode } from "react";
+import type { ToneName } from "../../../tokens";
+
+export type BadgeVariant = "soft" | "outline" | "solid";
+export type BadgeSize = "sm" | "md";
+
+/** A badge's colour as data — for a map from an app state to how its badge looks. */
+export interface BadgeStyle {
+ tone?: ToneName;
+ variant?: BadgeVariant;
+}
+
+export interface BadgeProps extends BadgeStyle {
+ size?: BadgeSize;
+ children: ReactNode;
+}
+
+const SOFT: Record<ToneName, string> = {
+ success: "bg-tone-success-bg text-tone-success-fg",
+ attention: "bg-tone-attention-bg text-tone-attention-fg",
+ danger: "bg-tone-danger-bg text-tone-danger-fg",
+ done: "bg-tone-done-bg text-tone-done-fg",
+ neutral: "bg-tone-neutral-bg text-tone-neutral-fg",
+ info: "bg-tone-info-bg text-tone-info-fg",
+};
+
+const OUTLINE: Record<ToneName, string> = {
+ success: "ring-1 ring-inset ring-tone-success-line text-tone-success-fg",
+ attention: "ring-1 ring-inset ring-tone-attention-line text-tone-attention-fg",
+ danger: "ring-1 ring-inset ring-tone-danger-line text-tone-danger-fg",
+ done: "ring-1 ring-inset ring-tone-done-line text-tone-done-fg",
+ neutral: "ring-1 ring-inset ring-tone-neutral-line text-tone-neutral-fg",
+ info: "ring-1 ring-inset ring-tone-info-line text-tone-info-fg",
+};
+
+const SOLID: Record<ToneName, string> = {
+ success: "bg-tone-success-emphasis text-tone-success-emphasis-fg",
+ attention: "bg-tone-attention-emphasis text-tone-attention-emphasis-fg",
+ danger: "bg-tone-danger-emphasis text-tone-danger-emphasis-fg",
+ done: "bg-tone-done-emphasis text-tone-done-emphasis-fg",
+ neutral: "bg-tone-neutral-emphasis text-tone-neutral-emphasis-fg",
+ info: "bg-tone-info-emphasis text-tone-info-emphasis-fg",
+};
+
+const VARIANT: Record<BadgeVariant, Record<ToneName, string>> = {
+ soft: SOFT,
+ outline: OUTLINE,
+ solid: SOLID,
+};
+
+const SIZE: Record<BadgeSize, string> = {
+ md: "px-2 py-0.5",
+ sm: "px-1.5 py-px",
+};
+
+export function Badge({ tone = "neutral", variant = "soft", size = "md", children }: BadgeProps) {
+ return (
+ <span
+ className={`inline-flex items-center rounded-[var(--ui-radius-pill)] text-xs font-semibold ${SIZE[size]} ${VARIANT[variant][tone]}`}
+ >
+ {children}
+ </span>
+ );
+}
+
+export function Count({
+ n,
+ max,
+}: {
+ n: number;
+ /** Above this, the capsule reads `max+` rather than growing. */
+ max?: number;
+}) {
+ return (
+ <span className="inline-flex items-center rounded-[var(--ui-radius-pill)] bg-tone-neutral-bg px-1.5 py-px text-xs font-semibold tabular-nums text-tone-neutral-fg">
+ {max !== undefined && n > max ? `${max}+` : n}
+ </span>
+ );
+}
diff --git a/packages/ui/src/components/feedback/empty-state/empty-state.tsx b/packages/ui/src/components/feedback/empty-state/empty-state.tsx
new file mode 100644
index 00000000..ae1f2147
--- /dev/null
+++ b/packages/ui/src/components/feedback/empty-state/empty-state.tsx
@@ -0,0 +1,45 @@
+/**
+ * The empty state: what stands where a list or a detail would be when there is nothing in it —
+ * plain words, no illustration, and optionally the one action that fills it.
+ *
+ * Two frames. A page's empty state is open, centred in generous space. `dashed` is the slot form
+ * (a settings tab's table, a panel's list): the message centred on both axes inside a dashed
+ * block that stands exactly where the populated list would, dashed rather than solid so an empty
+ * slot never reads as a rendered-but-blank container. `SettingsEmpty` is that form for a single
+ * sentence.
+ */
+import type { ReactNode } from "react";
+
+export function EmptyState({
+ title,
+ description,
+ action,
+ dashed = false,
+}: {
+ title: ReactNode;
+ description?: string;
+ action?: ReactNode;
+ /** The slot form: a dashed block the size of the missing list, the message in the small rung. */
+ dashed?: boolean;
+}) {
+ return (
+ <div
+ className={
+ dashed
+ ? "flex min-h-24 flex-col items-center justify-center gap-2 rounded-md border border-dashed border-line px-4 text-center"
+ : "flex flex-col items-center justify-center gap-2 py-12 text-center"
+ }
+ >
+ <p className={dashed ? "text-xs text-fg-subtle" : "text-sm font-medium text-fg-muted"}>
+ {title}
+ </p>
+ {description && <p className="text-xs text-fg-muted">{description}</p>}
+ {action && <div className="mt-2">{action}</div>}
+ </div>
+ );
+}
+
+/** A settings slot with nothing in it yet: `EmptyState dashed` holding one sentence. */
+export function SettingsEmpty({ children }: { children: ReactNode }) {
+ return <EmptyState dashed title={children} />;
+}
diff --git a/packages/ui/src/components/feedback/skeleton/skeleton.tsx b/packages/ui/src/components/feedback/skeleton/skeleton.tsx
new file mode 100644
index 00000000..ba90242a
--- /dev/null
+++ b/packages/ui/src/components/feedback/skeleton/skeleton.tsx
@@ -0,0 +1,52 @@
+/**
+ * Loading placeholders shaped like what is coming: a line, a list of rows, a card. Each shares the
+ * border, radius and fill of the real container it stands in for, so nothing shifts when the data
+ * arrives. The blocks pulse gently while they wait — this file is where a placeholder's pulse
+ * lives — and are hidden from assistive technology: the region they sit in announces loading,
+ * a grey bar has nothing to say.
+ */
+import type { ReactNode } from "react";
+
+/** One placeholder block; `className` sets its size (a line of text by default). */
+export function Skeleton({ className }: { className?: string }) {
+ return (
+ <div aria-hidden className={`animate-pulse rounded-sm bg-line ${className ?? "h-4 w-full"}`} />
+ );
+}
+
+/** A list loading: `rows` row-height blocks. */
+export function SkeletonList({ rows = 3 }: { rows?: number }) {
+ return (
+ <div className="space-y-2 p-2">
+ {Array.from({ length: rows }, (_, i) => (
+ <Skeleton key={i} className="h-8 w-full" />
+ ))}
+ </div>
+ );
+}
+
+/**
+ * A card loading: the real card's border and radius around a title, a main value and a subline,
+ * or the caller's own inner layout. `className` replaces the default `p-4` outright — two
+ * utilities for one property resolve by stylesheet order, not by position in the string — so a
+ * caller that passes one includes its padding.
+ */
+export function SkeletonCard({
+ className,
+ children,
+}: {
+ className?: string;
+ children?: ReactNode;
+}) {
+ return (
+ <div className={`rounded-md border border-line bg-surface ${className ?? "p-4"}`}>
+ {children ?? (
+ <>
+ <Skeleton className="h-3 w-20" />
+ <Skeleton className="mt-2.5 h-6 w-28" />
+ <Skeleton className="mt-2.5 h-3 w-24" />
+ </>
+ )}
+ </div>
+ );
+}
diff --git a/packages/ui/src/components/icons/activity-icon/activity-icon.tsx b/packages/ui/src/components/icons/activity-icon/activity-icon.tsx
new file mode 100644
index 00000000..ea483a5e
--- /dev/null
+++ b/packages/ui/src/components/icons/activity-icon/activity-icon.tsx
@@ -0,0 +1,123 @@
+/**
+ * A conversation's activity marks — a session row's trailing glyphs and the chat header's.
+ *
+ * `ActivityIcon` draws three states, each legible from its shape and its motion alone, with
+ * colour carrying only the severity every reader shares:
+ *
+ * - **running** — an hourglass, turning over on a loop, the motion a real hourglass makes.
+ * - **compacting** — a bar with a chevron closing on it from each side, squeezing on a loop.
+ * Compaction is busy work like any other, so it takes the same attention ink as running; what
+ * it does not share is the shape, because two live states that differ only in colour are two
+ * states a reader has to have been told apart in advance.
+ * - **finished, unread** — a small success dot. It is a notification, not a status: "there is a
+ * reply here you have not seen".
+ *
+ * A read conversation, and one that never ran, draw nothing: the caller renders no icon, so the
+ * only marks left in a list are the ones worth acting on. Every glyph names its exact state in
+ * its accessible name and tooltip — the caller's `label`, since only the app knows its words — so
+ * nothing here is legible only to a sighted reader with full colour vision.
+ *
+ * Every state renders into the same `size` box, and the dot is centred in it rather than sized
+ * to it: the box is the reservation, so a row never shifts as a run starts, finishes and is read.
+ *
+ * Two further marks sit beside it. `BackgroundTasksMark` is work going on behind the conversation
+ * — a background command process, a background subagent, or one call made in the background —
+ * in the busy ink, because that work is still running, only outside the turn. `ScheduleMark` is
+ * a standing arrangement — a scheduled task that will fire without anyone opening the
+ * conversation — in the subtle ink, receding with the row's settled marks, which is allowed
+ * only because its label always says it in words.
+ *
+ * The motion is the `hourglass-turn` and `compact-squeeze` keyframes in the theme foundation:
+ * they only rotate or scale, so with animation switched off the glyph stands still and stays
+ * fully legible.
+ */
+import { ICON_SIZE } from "../../../icon-scale";
+import { Dot } from "../dot/dot";
+import { GlyphIcon } from "../glyph-icon/glyph-icon";
+import { ICONS } from "../icons";
+
+export type ActivityIconState = "running" | "compacting" | "completedUnread";
+
+type LiveState = Exclude<ActivityIconState, "completedUnread">;
+
+/** The two live states' drawing and motion; both take the attention ink. */
+const LIVE: Record<LiveState, { d: string; motion: string }> = {
+ running: { d: ICONS.hourglass, motion: "hourglass-turn" },
+ compacting: { d: ICONS.compress, motion: "compact-squeeze" },
+};
+
+export function ActivityIcon({
+ activity,
+ label,
+ size = ICON_SIZE.rowMark,
+}: {
+ activity: ActivityIconState;
+ /** The state in words: the accessible name and the tooltip. */
+ label: string;
+ size?: number;
+}) {
+ if (activity === "completedUnread") {
+ // A plain labelled image: run completion is announced by the app's notification path, so
+ // the dot must not announce itself again as a live status.
+ return (
+ <span
+ role="img"
+ aria-label={label}
+ data-tooltip={label}
+ style={{ width: size, height: size }}
+ className="flex shrink-0 items-center justify-center"
+ >
+ <Dot tone="success" size="xs" />
+ </span>
+ );
+ }
+ const { d, motion } = LIVE[activity];
+ return (
+ <span
+ role="status"
+ aria-label={label}
+ data-tooltip={label}
+ style={{ width: size, height: size }}
+ className="flex shrink-0 items-center justify-center text-tone-attention-fg"
+ >
+ <GlyphIcon d={d} size={size} className={motion} />
+ </span>
+ );
+}
+
+/**
+ * Work going on behind a conversation: a count of background tasks on a session row and in the
+ * chat header, or the one call made with `run_in_background` on a tool row. The label is the only
+ * carrier of the state, so it is required, and the size is the rung of the row it sits in.
+ * Rendered only when there is background work to report — the caller decides.
+ */
+export function BackgroundTasksMark({ label, size }: { label: string; size: number }) {
+ return (
+ <span
+ role="img"
+ aria-label={label}
+ data-tooltip={label}
+ className="flex shrink-0 items-center text-tone-success-fg"
+ >
+ <GlyphIcon d={ICONS.pulse} size={size} />
+ </span>
+ );
+}
+
+/**
+ * A standing scheduled task: the conversation will run on its own. Icon only, no count — how many
+ * tasks, and when, is the schedules panel's business. The label is the only carrier of the
+ * meaning, so it is required.
+ */
+export function ScheduleMark({ label, size }: { label: string; size: number }) {
+ return (
+ <span
+ role="img"
+ aria-label={label}
+ data-tooltip={label}
+ className="flex shrink-0 items-center text-fg-subtle"
+ >
+ <GlyphIcon d={ICONS.alarmClock} size={size} />
+ </span>
+ );
+}
diff --git a/packages/ui/src/components/icons/avatars/agent-avatar.tsx b/packages/ui/src/components/icons/avatars/agent-avatar.tsx
new file mode 100644
index 00000000..e9e7c5c1
--- /dev/null
+++ b/packages/ui/src/components/icons/avatars/agent-avatar.tsx
@@ -0,0 +1,48 @@
+/**
+ * An agent's avatar: its initial as coloured ink on a light tinted tile (the letter-tile style
+ * `ProviderLogo` also draws for user-defined model groups).
+ *
+ * The colour hashes the agent's id — not its display name — so it survives renames; the initial
+ * comes from the display name when the caller has one, falling back to the id. The ink follows
+ * the colour scheme through one `light-dark()` value, keeping ≥ 4.5:1 on the tile for every hue
+ * in both modes (see `avatar.ts`).
+ */
+import { avatarInitial, avatarTile } from "./avatar";
+
+export function AgentAvatar({
+ id,
+ name,
+ size = 18,
+ className,
+}: {
+ id: string;
+ /** Display name supplying the initial; omitted, the id's initial is used. */
+ name?: string;
+ size?: number;
+ className?: string;
+}) {
+ const tile = avatarTile(id);
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ className={className}
+ aria-hidden
+ role="img"
+ >
+ <rect x="0" y="0" width="24" height="24" rx="5" fill={tile.bg} />
+ <text
+ x="12"
+ y="12"
+ textAnchor="middle"
+ dominantBaseline="central"
+ fontSize="13"
+ fontWeight="700"
+ style={{ fill: tile.ink }}
+ >
+ {avatarInitial(name ?? "", id)}
+ </text>
+ </svg>
+ );
+}
diff --git a/packages/ui/src/components/icons/avatars/avatar-stack.tsx b/packages/ui/src/components/icons/avatars/avatar-stack.tsx
new file mode 100644
index 00000000..19874616
--- /dev/null
+++ b/packages/ui/src/components/icons/avatars/avatar-stack.tsx
@@ -0,0 +1,62 @@
+/**
+ * A few avatars overlapping in a row, then a "+n" for the rest: who is in a channel, which agents
+ * a benchmark has tested. The avatars are decorative — the names belong to the caller's tooltip
+ * or label, since a row of initials names nobody — while the count stays readable text.
+ *
+ * Each avatar is ringed in the canvas colour so overlapping tiles stay apart; the ring follows
+ * the avatar's own outline (a disc for an account, the tile's fixed corner for an agent), which
+ * is geometry of the tile rather than a theme radius.
+ */
+import { AgentAvatar } from "./agent-avatar";
+import { UserAvatar } from "./user-avatar";
+
+export interface AvatarStackItem {
+ /** The stable id: an agent's tile colour hashes it; an account's disc falls back to its initial. */
+ id: string;
+ /** Display name supplying the initial. */
+ name: string;
+ /** Whose avatar: an agent's tinted tile (the default) or an account's disc. */
+ kind?: "agent" | "user";
+ /** An account's stored image; an agent has none. */
+ src?: string;
+}
+
+/** An agent tile's corner: `rx="5"` on its 24-unit box, at the rendered size. */
+const tileRadius = (size: number) => (size * 5) / 24;
+
+export function AvatarStack({
+ items,
+ max = 3,
+ size,
+ className = "",
+}: {
+ items: readonly AvatarStackItem[];
+ /** How many avatars are drawn before the count takes over. */
+ max?: number;
+ /** Edge length of one avatar in pixels (an `ICON_SIZE` rung). */
+ size: number;
+ className?: string;
+}) {
+ const shown = items.slice(0, max);
+ const rest = items.length - shown.length;
+ return (
+ <span className={`flex shrink-0 items-center gap-1 ${className}`}>
+ <span className="flex -space-x-1" aria-hidden>
+ {shown.map((item) => (
+ <span
+ key={`${item.kind ?? "agent"}:${item.id}`}
+ className="flex shrink-0 ring-2 ring-canvas"
+ style={{ borderRadius: item.kind === "user" ? "50%" : tileRadius(size) }}
+ >
+ {item.kind === "user" ? (
+ <UserAvatar userId={item.id} displayName={item.name} avatar={item.src} size={size} />
+ ) : (
+ <AgentAvatar id={item.id} name={item.name} size={size} />
+ )}
+ </span>
+ ))}
+ </span>
+ {rest > 0 && <span className="text-xs tabular-nums text-fg-subtle">{`+${rest}`}</span>}
+ </span>
+ );
+}
diff --git a/packages/ui/src/components/icons/avatars/avatar.ts b/packages/ui/src/components/icons/avatars/avatar.ts
new file mode 100644
index 00000000..59c14be2
--- /dev/null
+++ b/packages/ui/src/components/icons/avatars/avatar.ts
@@ -0,0 +1,77 @@
+/**
+ * Letter-avatar helpers shared by `AgentAvatar`, `UserAvatar` and `ProviderLogo`'s letter tile: a
+ * deterministic tile colour family hashed from a stable key (FNV-1a → hue), and the first
+ * user-perceived character of a display name.
+ *
+ * The colour keys off an id rather than a name so it survives renames. The tile is a light
+ * 14%-alpha tint with the initial as coloured ink rather than white on a solid fill: hsl(h 55%
+ * 27%) in light and hsl(h 55% 77%) in dark, lightness picked so the worst-case hue keeps ≥ 4.5:1
+ * (WCAG AA) against the tinted tile on every surface it sits on, in every theme — checked over
+ * all 360 hues against the surfaces the theme files declare, in test/avatar.test.ts. The two inks
+ * travel as one `light-dark()` value, which follows the colour scheme the theme sets on the root,
+ * so a tile needs no dark-mode class.
+ *
+ * The tile colours are identity data, not theme colours: the one place outside the token
+ * contract a component may spell a colour of its own.
+ */
+
+/** FNV-1a 32-bit string hash. */
+function hashStr(s: string): number {
+ let h = 2166136261;
+ for (let i = 0; i < s.length; i++) {
+ h ^= s.charCodeAt(i);
+ h = Math.imul(h, 16777619);
+ }
+ return h >>> 0;
+}
+
+/** Deterministic hue (0-359) for a stable key (an agent id, a provider id). */
+export function avatarHue(key: string): number {
+ return hashStr(key) % 360;
+}
+
+/** A letter tile's colours: the translucent tint, and the initial's ink per mode and as one value. */
+export interface AvatarTile {
+ bg: string;
+ /** The ink on a light surface. */
+ fg: string;
+ /** The ink on a dark surface. */
+ fgDark: string;
+ /** Both inks as `light-dark(fg, fgDark)`: what a component paints the initial with. */
+ ink: string;
+}
+
+/** Tile colours for a hue (0-359). */
+export function avatarTileOfHue(h: number): AvatarTile {
+ const fg = `hsl(${h} 55% 27%)`;
+ const fgDark = `hsl(${h} 55% 77%)`;
+ return { bg: `hsl(${h} 55% 50% / 0.14)`, fg, fgDark, ink: `light-dark(${fg}, ${fgDark})` };
+}
+
+/** Tile colours for a stable key. */
+export function avatarTile(key: string): AvatarTile {
+ return avatarTileOfHue(avatarHue(key));
+}
+
+/** Grapheme segmenter (granularity is locale-independent); code-point fallback on very old engines. */
+const graphemes =
+ typeof Intl !== "undefined" && typeof Intl.Segmenter === "function"
+ ? new Intl.Segmenter(undefined, { granularity: "grapheme" })
+ : undefined;
+
+function firstGrapheme(s: string): string | undefined {
+ if (!s) return undefined;
+ if (!graphemes) return Array.from(s)[0];
+ for (const g of graphemes.segment(s)) return g.segment;
+ return undefined;
+}
+
+/**
+ * First user-perceived character of `text` — a full grapheme cluster, so CJK, ZWJ emoji and flags
+ * stay whole — uppercased when it has a case; empty or whitespace falls back to `fallback`'s
+ * initial, then "?".
+ */
+export function avatarInitial(text: string, fallback?: string): string {
+ const ch = firstGrapheme(text.trim()) ?? firstGrapheme((fallback ?? "").trim());
+ return ch ? ch.toUpperCase() : "?";
+}
diff --git a/packages/ui/src/components/icons/avatars/user-avatar.tsx b/packages/ui/src/components/icons/avatars/user-avatar.tsx
new file mode 100644
index 00000000..6792a457
--- /dev/null
+++ b/packages/ui/src/components/icons/avatars/user-avatar.tsx
@@ -0,0 +1,77 @@
+/**
+ * An account's avatar, wherever it is drawn: a navigation row, a collapsed rail's trigger, an
+ * account menu's header, a profile page's preview.
+ *
+ * Two states, one component. With an avatar stored it is that image, cropped to the circle;
+ * without one it is a letter disc — the foreground colour with the initial in the canvas colour,
+ * which is deliberately NOT the tinted hashed tile `AgentAvatar` uses: an account is the one
+ * identity the viewer already knows, so it does not need a colour to be told apart from its
+ * neighbours, and there is only ever one of it on screen. The initial follows the nickname once
+ * there is one, falling back to the id, so the disc changes with the name rather than
+ * contradicting it.
+ *
+ * `size` is in pixels and the letter's size is derived from it, rather than both coming from the
+ * type scale: the disc is a fixed box, so a letter that grew with the user's font-size setting
+ * would outgrow it at the largest tier.
+ */
+import type { CSSProperties, ReactNode } from "react";
+import { avatarInitial } from "./avatar";
+
+/**
+ * The sizes a user avatar is drawn at, named by the slot rather than by the number (the
+ * `ICON_SIZE` convention). `tile` is what a navigation row, a rail and a menu header share — the
+ * three must stay identical, because collapsing a sidebar swaps one for another and a changed
+ * size would pop. `preview` is a profile page, where the avatar is the subject.
+ */
+export const USER_AVATAR_SIZE = { tile: 28, preview: 64 } as const;
+
+/** The letter's share of the disc: large enough to read at 28px, still inside the circle at 64. */
+const INITIAL_RATIO = 0.45;
+
+export function UserAvatar({
+ userId,
+ displayName,
+ avatar,
+ size = USER_AVATAR_SIZE.tile,
+ className,
+ children,
+}: {
+ /** The account's id — the fallback initial. */
+ userId: string;
+ /** Nickname, when set: it supplies the initial. */
+ displayName?: string;
+ /** Stored avatar as a URL (a data URL from a profile upload); absent, the letter disc is drawn. */
+ avatar?: string;
+ /** Edge length in pixels — pass a `USER_AVATAR_SIZE` rung. */
+ size?: number;
+ className?: string;
+ /** Overlay slot, positioned against this disc: a trigger hangs its update dot here. */
+ children?: ReactNode;
+}) {
+ const who = displayName ?? userId;
+ const box: CSSProperties = { width: size, height: size };
+ if (avatar !== undefined) {
+ return (
+ <span className={`relative block shrink-0 ${className ?? ""}`} style={box}>
+ {/* object-cover, though a stored avatar is usually square already: one written by an API
+ client rather than by a cropping upload must still fill the circle, not stretch into
+ it. alt="" for the reason the letter disc is aria-hidden — see below. */}
+ <img src={avatar} alt="" className="h-full w-full rounded-full object-cover" style={box} />
+ {children}
+ </span>
+ );
+ }
+ return (
+ <span
+ // Decorative, like the image above: the mark is never the account's name. Every anchor
+ // this sits in already names the account, in its own accessible name or in the text
+ // beside it, so announcing a bare initial as well would only repeat the first letter.
+ aria-hidden
+ className={`relative flex shrink-0 items-center justify-center rounded-full bg-fg font-bold text-canvas ${className ?? ""}`}
+ style={{ ...box, fontSize: Math.round(size * INITIAL_RATIO) }}
+ >
+ {avatarInitial(who, userId)}
+ {children}
+ </span>
+ );
+}
diff --git a/packages/web/src/components/ui/chevron.tsx b/packages/ui/src/components/icons/chevron/chevron.tsx
similarity index 51%
rename from packages/web/src/components/ui/chevron.tsx
rename to packages/ui/src/components/icons/chevron/chevron.tsx
index dffd99da..955ba462 100644
--- a/packages/web/src/components/ui/chevron.tsx
+++ b/packages/ui/src/components/icons/chevron/chevron.tsx
@@ -1,7 +1,11 @@
/**
- * Collapse/expand indicator icon: a `>` shaped chevron that rotates 90 degrees to point down when expanded.
- * Shared by every collapsible element site-wide (thinking blocks, tool cards, sub-session cards,
- * reasoning groups, sidebar groups, trace tree, trace groups) — no more solid triangle characters.
+ * The collapse indicator: a `>` chevron that rotates 90 degrees to point down when its section is
+ * open. Every collapsible draws this one — thinking blocks, tool cards, sub-session cards, sidebar
+ * groups, trace trees — rather than a solid triangle character, so an open section looks the same
+ * wherever it is.
+ *
+ * It is a component rather than a registry entry because the rotation is part of the mark, and
+ * this file is where the de-slop rules let a transform transition live.
*/
export function Chevron({
open,
diff --git a/packages/ui/src/components/icons/dot/dot.tsx b/packages/ui/src/components/icons/dot/dot.tsx
new file mode 100644
index 00000000..ae3c478e
--- /dev/null
+++ b/packages/ui/src/components/icons/dot/dot.tsx
@@ -0,0 +1,60 @@
+/**
+ * The state dot: a small solid disc in a tone's fill, beside a label or inside a row that already
+ * names the state. A dot this small has no interior to read, so it takes the tone's solid fill
+ * (`emphasis`) rather than an ink tuned for a stroke, and it stays round in every theme — a
+ * square theme squares its badges and controls, never its dots.
+ *
+ * Colour is never the only carrier. A dot inside a labelled row is decorative and hidden from
+ * assistive technology; a dot standing alone takes `label`, which names it as an image.
+ *
+ * `pulse` is for something that is running right now and nothing else: the dot carries the
+ * live hook, so a theme may re-time or restep the pulse and reduced motion stills it. This file
+ * is where a dot's pulse lives, which is why a pulsing dot is always this component.
+ */
+import type { ToneName } from "../../../tokens";
+
+/**
+ * Pixel sizes, the icon-scale convention: a dot never scales with the root font tier. The 6px
+ * rung, a row's state dot, is the common case and the default.
+ */
+const SIZES = { xs: 6, sm: 8, md: 10 } as const;
+
+export type DotSize = keyof typeof SIZES;
+
+const FILL: Record<ToneName, string> = {
+ success: "bg-tone-success-emphasis",
+ attention: "bg-tone-attention-emphasis",
+ danger: "bg-tone-danger-emphasis",
+ done: "bg-tone-done-emphasis",
+ neutral: "bg-tone-neutral-emphasis",
+ info: "bg-tone-info-emphasis",
+};
+
+export function Dot({
+ tone,
+ size = "xs",
+ pulse = false,
+ label,
+ className = "",
+}: {
+ tone: ToneName;
+ size?: DotSize;
+ /** Pulse while the thing it marks is live. */
+ pulse?: boolean;
+ /** Names a dot that stands alone; without it the dot is decoration beside a label. */
+ label?: string;
+ /** Layout only (a margin, an alignment); the colour and the size are the props'. */
+ className?: string;
+}) {
+ const px = SIZES[size];
+ return (
+ <span
+ {...(label === undefined
+ ? { "aria-hidden": true }
+ : { role: "img" as const, "aria-label": label })}
+ data-live={pulse ? "dot" : undefined}
+ style={{ width: px, height: px }}
+ className={`inline-block shrink-0 rounded-full ${FILL[tone]} ${pulse ? "ui-live animate-pulse" : ""} ${className}`}
+ />
+ );
+}
diff --git a/packages/ui/src/components/icons/glyph-icon/glyph-icon.tsx b/packages/ui/src/components/icons/glyph-icon/glyph-icon.tsx
new file mode 100644
index 00000000..14eab781
--- /dev/null
+++ b/packages/ui/src/components/icons/glyph-icon/glyph-icon.tsx
@@ -0,0 +1,52 @@
+/**
+ * The one line-icon renderer: a 24x24 path in currentColor, stroked at the active theme's
+ * `--ui-icon-stroke` (1.7 in the default theme), so the mark follows the caller's text colour and
+ * every glyph carries the same weight. The paths come from the registry (`ICONS`) or from the
+ * app's own manifests built on it, and the size from the role-named scale (`ICON_SIZE`).
+ *
+ * `decor` marks an icon that says nothing its label does not already say — a nav row's glyph, a
+ * group header's, a menu row's, an empty state's illustration — so a theme may recolour it or
+ * drop it. The renderer writes the style hook and the role; the call site decides, because only
+ * it knows whether a label stands beside the icon. A status mark, a file kind or a tool glyph
+ * carries information and never passes it.
+ */
+import { ICON_SIZE } from "../../../icon-scale";
+
+/** The places a decorative icon sits in, which the themes tint apart. */
+export type IconDecorRole = "nav" | "group" | "menu" | "empty";
+
+export function GlyphIcon({
+ d,
+ size = ICON_SIZE.inlineGlyph,
+ className = "",
+ filled = false,
+ decor,
+}: {
+ d: string;
+ size?: number;
+ className?: string;
+ /** Fill the path in currentColor — for a mark whose "on" state is a solid shape (a pinned tack). */
+ filled?: boolean;
+ /** Decorative beside a label that already says it: a theme may recolour or hide the icon. */
+ decor?: IconDecorRole;
+}) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill={filled ? "currentColor" : "none"}
+ stroke="currentColor"
+ // A style, not the attribute: an SVG presentation attribute cannot read a custom property.
+ // The fallback is the default theme's weight, for a page that has not loaded the theme CSS.
+ style={{ strokeWidth: "var(--ui-icon-stroke, 1.7)" }}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ className={`block shrink-0 ${decor === undefined ? "" : "ui-icon-decor"} ${className}`}
+ data-role={decor}
+ aria-hidden
+ >
+ <path d={d} />
+ </svg>
+ );
+}
diff --git a/packages/ui/src/components/icons/icons.ts b/packages/ui/src/components/icons/icons.ts
new file mode 100644
index 00000000..718daf17
--- /dev/null
+++ b/packages/ui/src/components/icons/icons.ts
@@ -0,0 +1,307 @@
+/**
+ * The line-icon registry: every shared glyph as 24x24 path data, drawn by `GlyphIcon` in
+ * currentColor at the theme's stroke weight.
+ *
+ * Keys name the drawing, never the use: `robot`, not `agents`; `alarmClock`, not `schedule`. A
+ * glyph means different things in different places — the chip is the model library in the nav,
+ * the eye is watching a run — and the app's own manifests say which drawing stands for which
+ * concept (the nav's entries, the stat chips, the grouping options). So a redraw happens here
+ * once and every use follows, and two uses that should look alike cannot end up with two
+ * drawings of one thing.
+ *
+ * Each path is one string because `GlyphIcon` draws a single `<path>`: a figure made of several
+ * strokes is several subpaths in the one string. Every glyph is stroked at the family's weight,
+ * whatever weight it was first drawn at — the weight belongs to the set, not to the mark.
+ *
+ * The two marks drawn on their own smaller grids (the form-control caret and the close cross)
+ * and the rotating chevron are components, not entries: their geometry depends on the grid they
+ * are drawn on (`marks.tsx`, `chevron.tsx`).
+ */
+
+/**
+ * The eye's almond outline, shared by the two marks drawn from it — the open eye with its pupil
+ * and the same eye struck through — so the pair cannot drift into looking unrelated.
+ */
+const EYE_OUTLINE = "M2 12s3.5-6.5 10-6.5S22 12 22 12s-3.5 6.5-10 6.5S2 12 2 12z";
+
+export const ICONS = {
+ // --- Objects and places -------------------------------------------------------------------
+
+ /**
+ * A robot head with an antenna, two ears, two eyes and a smile — lucide's `bot` with the mouth
+ * added. It is the agent: the thing in this product a person talks to, and the friendliest mark
+ * on the rail should be the one that stands for it.
+ *
+ * The landing page draws the same agent from its own copy of this string (`BotIcon` in
+ * packages/landing/src/components/icons.tsx — it carries no icon dependency to share one
+ * with); redraw this and redraw that. Its agent-glyph-sync test fails if only one moves.
+ */
+ robot:
+ "M12 8V4H8M6 8h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2zM2 14h2M20 14h2M9 13h.01M15 13h.01M10 16.5s.8 1 2 1 2-1 2-1",
+ /**
+ * Two robot heads, a large one above-left and a small one below-right: an agent and what it
+ * has going on underneath it (its subagents). Reduced to antenna, head and two eye dots,
+ * because the ears and the smile `robot` carries fall below a pixel at 13px.
+ */
+ robotPair:
+ "M7.3 4.2V2.2M3.8 4.2h7a2.2 2.2 0 0 1 2.2 2.2v5.8a2.2 2.2 0 0 1-2.2 2.2h-7a2.2 2.2 0 0 1-2.2-2.2V6.4a2.2 2.2 0 0 1 2.2-2.2zM4.6 9.2h.01M10 9.2h.01M18.6 14.8v-1.7M16.5 14.8h4.2a1.7 1.7 0 0 1 1.7 1.7v3.8a1.7 1.7 0 0 1-1.7 1.7h-4.2a1.7 1.7 0 0 1-1.7-1.7v-3.8a1.7 1.7 0 0 1 1.7-1.7zM17.3 18.4h.01M20.5 18.4h.01",
+ /**
+ * The cerebrum from the side: the lobed outline, then the gyri inside it. The drawing was
+ * authored with the whole figure shifted a little down the box; the shift is baked into the
+ * coordinates rather than carried as a transform, since the renderer has nowhere to put one.
+ */
+ brain:
+ "M5.1 17.9c-1.4 0 -2.5 -1.05 -2.5 -2.45 -1.1 -1 -.95 -2.75 .25 -3.6 -.5 -1.75 .6 -3.5 2.3 -3.8 .2 -1.85 1.95 -3.15 3.75 -2.7 1.3 -1.3 3.5 -1.45 4.95 -.25 2 -.35 3.8 .8 4.35 2.6 2 .1 3.45 1.9 3.05 3.85 .9 1.2 .5 2.95 -.75 3.7 .2 1.6 -1.1 2.9 -2.7 2.75 -1.15 1.15 -2.85 1.3 -4.15 .5 -1.6 1.55 -4.4 1.4 -5.45 -.8 -.85 .75 -2.1 .85 -3.1 .2ZM5.15 8.05C5.05 9.75 6.4 10.8 8 10.55m5.85 -5.45c-1.1 .65 -1.8 1.9 -1.6 3.25m5.95 -.65c-1.7 -.2 -2.8 1.2 -2.6 2.65M8.2 17.7c-1.2 -1.1 -.85 -3 .55 -3.65 1.7 -.8 3.3 -.45 4.5 -2.1m4.55 6.05c-1.35 -.45 -1.9 -1.65 -1.45 -2.85",
+ /** An open eye with its pupil: watching what something actually did. */
+ eye: `${EYE_OUTLINE}M14.7 12a2.7 2.7 0 1 1-5.4 0 2.7 2.7 0 0 1 5.4 0z`,
+ /**
+ * The same eye struck through. The slash runs corner to corner rather than across the eye
+ * alone, because the open eye is often drawn nearby and the slash is the only thing telling
+ * the two apart.
+ */
+ eyeOff: `${EYE_OUTLINE}M3 3l18 18`,
+ /**
+ * A chip: body, die and three pins a side. Three pins rather than six — at 16px six pins a
+ * side fuse into a serrated edge. The die is what keeps the mark clear of `server`: a bare
+ * body with side ticks and a stack of server units both reduce to "a rectangle with lines",
+ * while concentric squares ringed with pins reduce to nothing else in this table.
+ */
+ chip: "M5 5h14v14H5zM9 9h6v6H9zM7.5 5V2.4M12 5V2.4M16.5 5V2.4M7.5 19v2.6M12 19v2.6M16.5 19v2.6M5 7.5H2.4M5 12H2.4M5 16.5H2.4M19 7.5h2.6M19 12h2.6M19 16.5h2.6",
+ /** Two stacked server units, each with its own status lamp. */
+ server: "M4 4h16v6H4zM4 14h16v6H4zM7 7h.01M7 17h.01",
+ /** A trophy: cup, two handles and a base. */
+ trophy: "M7 4h10v5a5 5 0 0 1-10 0V4zM7 5H4v1a3 3 0 0 0 3 3m10-4h3v1a3 3 0 0 1-3 3M12 14v4m-4 0h8",
+ /** A `>_` prompt in a window frame. */
+ terminalWindow: "M3 5h18v14H3zM7 9l3 3-3 3M13 15h4",
+ /** A tower with wings and windows (lucide building-2). */
+ building:
+ "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2M10 6h4M10 10h4M10 14h4M10 18h4",
+ /** Two pages meeting at the spine (lucide book-open). */
+ bookOpen: "M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",
+ /** A globe: the 9-radius circle, its equator and one meridian. */
+ globe: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM3 12h18M12 3a13 13 0 0 1 0 18 13 13 0 0 1 0-18z",
+ /** A house with its door (lucide house). */
+ house:
+ "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
+ /** A puzzle piece (lucide puzzle). */
+ puzzle:
+ "M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",
+ /** A fishing hook: eye, shank, bend and a barbed tip. */
+ fishHook: "M16 4a2 2 0 1 0-4 0 2 2 0 0 0 4 0zM14 6v8a5 5 0 0 1-10 0v-2m0 0l-2 2m2-2l2 2",
+ /**
+ * A magic wand with two sparkles (after lucide's wand-sparkles, reduced so it still reads at
+ * 13px): describing something to the agent instead of configuring it by hand.
+ */
+ wand: "M21.64 3.64l-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72zM14 7l3 3M5 6v4M3 8h4M19 14v4M17 16h4",
+ /** An open hand — doing it by hand, the counterpart of `wand`. */
+ hand: "M18 11V6a2 2 0 0 0-4 0M14 10V4a2 2 0 0 0-4 0v2M10 10.5V6a2 2 0 0 0-4 0v8M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",
+ /** The standard gear (lucide settings): full tooth outline and centre circle, crisp at 16px. */
+ gear: "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z",
+ /** A pushpin (lucide pin): head, body and stem. */
+ pin: "M12 17v5M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z",
+ /** A wrench. */
+ wrench: "M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",
+ /** A key: a round bow, the shaft and two teeth (feather key). */
+ key: "M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4",
+ /**
+ * The same key struck through corner to corner, like `eyeOff`. Spelled out rather than composed
+ * from `key`: a fragment equal to a whole entry would name one path twice. Redraw both together.
+ */
+ keyOff:
+ "M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4M2 2l20 20",
+ /** Stacked cylinders: a database. */
+ database:
+ "M4 6c0-1.7 3.6-3 8-3s8 1.3 8 3-3.6 3-8 3-8-1.3-8-3zm0 0v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",
+ /** A speedometer: half a ring and its needle. */
+ gauge: "M5 18a8 8 0 1 1 14 0M12 12l4-3",
+ /** A bullseye: two rings and a centre. */
+ target:
+ "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-5a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-3a1 1 0 1 0 0-2 1 1 0 0 0 0 2z",
+ /** A coin: a circle stamped with a dollar sign. */
+ coin: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",
+ /** A dollar sign in a circle (lucide circle-dollar-sign). */
+ dollarCircle:
+ "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8M12 18V6",
+
+ // --- Time ---------------------------------------------------------------------------------
+
+ /** A clock face with its hands (lucide clock, drawn as one path). */
+ clock: "M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0M12 6v6l4 2",
+ /**
+ * The same clock drawn at the 9-unit radius of the status circles (`info`, `checkCircle`), so
+ * it sits level with the other marks of a stats row.
+ */
+ clockCompact: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",
+ /** A calendar (lucide calendar): two rings, the header rule and the page. */
+ calendar:
+ "M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z",
+ /**
+ * An alarm clock — domed bells on its shoulders, a dial with hands and two splayed feet.
+ * Distinct from the plain `clock`, which reads as "most recent". Its smallest use is a 12px
+ * row mark, which bounds the detail: bells, feet and the hands' right angle each hold a whole
+ * pixel there, while a second dial ring or ticks would not, and the notch between the bells
+ * is what keeps them reading as two.
+ */
+ alarmClock:
+ "M12 19.5a6.7 6.7 0 1 0 0-13.4 6.7 6.7 0 0 0 0 13.4zM12 8.9v3.9l2.6 1.8M3.1 7.7A3.5 3.5 0 0 1 7.7 4.3M16.3 4.3a3.5 3.5 0 0 1 4.6 3.4M7.8 18.8 5.4 21.6M16.2 18.8l2.4 2.8",
+ /** An hourglass: frame top and bottom, sand funnelling to the waist. */
+ hourglass: "M6 3h12M6 21h12M8 3v3.5L12 10l4-3.5V3M8 21v-3.5L12 14l4 3.5V21",
+
+ // --- Files and data -----------------------------------------------------------------------
+
+ /** A page with a folded corner. */
+ file: "M6 3h8l4 4v14H6zM14 3v4h4",
+ /** The same page with a plus: a whole file written. */
+ filePlus: "M6 3h8l4 4v14H6zM12 11v6M9 14h6",
+ /** A pen over a baseline (lucide pen-line): an edit in place. */
+ penLine: "M12 20h9M16.5 3.5a2.85 2.85 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z",
+ /** A pencil (thin line, matching the row-action set). */
+ pencil: "M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",
+ /** A folder outline, closed. */
+ folder: "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z",
+ /** A folder outline, open (lucide folder-open: back panel and a tilted front flap). */
+ folderOpen:
+ "m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
+ /**
+ * A tray with an arrow leaving it. The same tray serves `download`, so the pair reads as one
+ * axis; the arrow's direction is the only difference.
+ */
+ upload: "M12 15V4m0 0L8 8m4-4 4 4M4 15v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3",
+ /** The tray with an arrow landing in it. */
+ download: "M12 4v11m0 0 4-4m-4 4-4-4M4 15v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3",
+ /** An arrow rising from a baseline. */
+ arrowUpFromLine: "M12 15V5m0 0L8 9m4-4l4 4M4 19h16",
+ /** An arrow falling to a baseline. */
+ arrowDownToLine: "M12 3v10m0 0l-4-4m4 4l4-4M4 19h16",
+ /** Opposed up and down arrows (lucide arrow-up-down). */
+ arrowUpDown: "m21 16-4 4-4-4M17 20V4M3 8l4-4 4 4M7 4v16",
+ /** Two overlapping sheets. */
+ copy: "M9 9h9v9a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V9zM7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1",
+ /** A checkmark. */
+ check: "M5 13l4 4L19 7",
+ /** An archive box with a downward chevron. */
+ archive:
+ "M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M9.5 13.5 12 16l2.5-2.5",
+ /** The archive box with an arrow rising out of it. */
+ archiveRestore:
+ "M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M12 17v-5m-2.5 2L12 11l2.5 3",
+ /** A trash can: lid, handle, body and two slats. */
+ trash:
+ "M4 6h16M9 6V4.5A1.5 1.5 0 0 1 10.5 3h3A1.5 1.5 0 0 1 15 4.5V6M6 6v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6M10 10.5v6M14 10.5v6",
+ /**
+ * Three dots. Hairline-stroke dots vanish at row-glyph size, so this mark is drawn with
+ * `GlyphIcon`'s `filled` mode: the stroke rides on top of the fill.
+ */
+ ellipsis:
+ "M4.5 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4zM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4zM19.5 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4z",
+ /** Opening quotation marks: a passage carried in from somewhere else. */
+ quote:
+ "M9.5 6.5C7 7.5 5.5 9.5 5.5 12.5v4h5v-5h-3c0-1.8.9-3.1 2.6-3.8zM19.5 6.5c-2.5 1-4 3-4 6v4h5v-5h-3c0-1.8.9-3.1 2.6-3.8z",
+ /**
+ * Soft wrap: three lines of text where the middle one runs past the edge, turns back and
+ * returns with an arrow. The turn is the whole mark, so it keeps the full bulge.
+ */
+ wrapText: "M4 6h16M4 12h12a3 3 0 1 1 0 6h-3m2-2-2 2 2 2M4 18h5",
+
+ // --- Messages and actions -----------------------------------------------------------------
+
+ /** A speech bubble with a plus: putting something into a conversation rather than sending it. */
+ messagePlus: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2zM12 7v6M9 10h6",
+ /** A paper plane. */
+ paperPlane: "M22 2 11 13M22 2l-7 20-4-9-9-4z",
+ /** A pane with an arrow leaving it: this opens outside the app, in a tab of its own. */
+ externalLink: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3",
+ /** Two links of a chain (lucide link): an address. */
+ chainLink:
+ "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",
+ /** A pair of angle brackets facing apart (lucide code). */
+ angleBrackets: "M16 18l6-6-6-6M8 6l-6 6 6 6",
+ /**
+ * Two arcs chasing each other round a circle (lucide refresh-cw): read it again. The arc idiom
+ * keeps it in the same family as the other round-trip glyphs.
+ */
+ refresh:
+ "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8M21 3v5h-5M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16M3 21v-5h5",
+ /**
+ * One arc turning clockwise into an arrowhead (feather rotate-cw) — a single arc where `refresh`
+ * has two. The head reaches x=23, past the other glyphs' margin, as drawn upstream.
+ */
+ rotateCw: "M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10",
+ /** A plus. `PlusIcon` (marks.tsx) draws this path with a stroke weight of its own. */
+ plus: "M12 5v14M5 12h14",
+
+ // --- Direction ----------------------------------------------------------------------------
+
+ /**
+ * An arrow pointing left. The head sits left of centre and the shaft runs out to the right
+ * edge, as the detail pages' back buttons have always drawn it.
+ */
+ arrowLeft: "M15 18l-6-6 6-6M9 12h12",
+ /**
+ * A chevron pointing left: back one level, the previous page. A still mark — the collapse
+ * indicator that turns is the `Chevron` component, a different drawing.
+ */
+ chevronLeft: "M15 18l-6-6 6-6",
+ /** The same chevron pointing right: the next page. */
+ chevronRight: "M9 18l6-6-6-6",
+ /**
+ * An arrow pointing left, centred in the box: head and shaft span the same width, where
+ * `arrowLeft`'s head sits left of centre. With its mirror, a pair that steps back and forward
+ * along one line.
+ */
+ arrowLeftCentered: "M19 12H5m6-6-6 6 6 6",
+ /** The mirror of `arrowLeftCentered`, pointing right. */
+ arrowRightCentered: "M5 12h14m-6-6 6 6-6 6",
+
+ // --- Layout -------------------------------------------------------------------------------
+
+ /** A window with a bottom pane. */
+ panelBottom: "M4 5h16v14H4zM4 14h16",
+ /** A window with a right pane. */
+ panelRight: "M4 5h16v14H4zM14 5v14",
+ /** Four square tiles of two heights. */
+ tiles: "M3 3h7v9H3zM14 3h7v5h-7zM14 12h7v9h-7zM3 16h7v5H3z",
+ /** Four rounded tiles of two heights (lucide layout-dashboard). */
+ dashboard:
+ "M4 3h5a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zM15 3h5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zM15 12h5a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4 16h5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1z",
+ /**
+ * Four corner brackets opening outward. Brackets rather than an arrow, because what they
+ * announce may open in several directions at once, and a mark with a direction in it would
+ * name the wrong one.
+ */
+ cornersOut: "M9 3H3v6M15 3h6v6M15 21h6v-6M9 21H3v-6",
+ /** The same four corner brackets turned inward. */
+ cornersIn: "M3 9h6V3M21 9h-6V3M21 15h-6v6M3 15h6v6",
+ /** One box over two, joined by a bus (lucide network). */
+ network: "M9 3h6v5H9zM2 16h6v5H2zM16 16h6v5h-6zM5 16v-3h14v3M12 13V8",
+ /** Three columns of unequal height in a frame (lucide square-kanban). */
+ kanban:
+ "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM8 7v7M12 7v4M16 7v9",
+ /** Bars of three heights on a baseline. */
+ barChart: "M4 20V10m6 10V4m6 16v-7m4 7H2",
+
+ // --- Status -------------------------------------------------------------------------------
+
+ /** An info circle: the 9-radius status circle with a bar and a dot inside it. */
+ info: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11v5m0-8h.01",
+ /** A triangle with an exclamation mark (lucide triangle-alert): a warning worth acting on. */
+ triangleAlert:
+ "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3zM12 9v4m0 4h.01",
+ /** A check in the status circle. */
+ checkCircle: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm-3.5-9.2 2.4 2.5 4.6-4.8",
+ /** A cross in the status circle. */
+ xCircle: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9 9l6 6m0-6-6 6",
+ /** A square in the status circle: ended on purpose, neither a success nor a fault. */
+ stopCircle: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM8.5 8.5h7v7h-7z",
+ /** A centre bar with a chevron bearing down on it from above and up from below. */
+ compress: "M4 12h16M8 7l4 3 4-3M8 17l4-3 4 3",
+ /**
+ * A flat line with one tall beat in it: work still going on. One continuous stroke with a
+ * single beat keeps its shape at a 12px row mark, and it is nobody else's shape among the
+ * status marks (the hourglass, `compress`, the spinner, the circled check and cross, a dot).
+ */
+ pulse: "M2 12h4l3 9 6-18 3 9h4",
+} as const;
+
+/** A glyph's registry key. */
+export type IconName = keyof typeof ICONS;
diff --git a/packages/ui/src/components/icons/logos/penguin-logo.tsx b/packages/ui/src/components/icons/logos/penguin-logo.tsx
new file mode 100644
index 00000000..95c00129
--- /dev/null
+++ b/packages/ui/src/components/icons/logos/penguin-logo.tsx
@@ -0,0 +1,18 @@
+/**
+ * The brand logo (the coloured penguin emblem). The asset is the app's — it also serves as the
+ * favicon — so the caller passes its URL. The image is a square on a white background, with
+ * `className` controlling size and rounded-corner cropping: it blends into the page in light mode
+ * and reads as an app-icon-style white rounded square in dark mode. Purely decorative, hidden from
+ * screen readers.
+ */
+export function PenguinLogo({ src, className }: { src: string; className?: string }) {
+ return (
+ <img
+ src={src}
+ alt=""
+ aria-hidden
+ draggable={false}
+ className={`select-none ${className ?? "h-9 w-9 rounded-lg"}`}
+ />
+ );
+}
diff --git a/packages/web/src/components/ui/provider-logo.tsx b/packages/ui/src/components/icons/logos/provider-logo.tsx
similarity index 96%
rename from packages/web/src/components/ui/provider-logo.tsx
rename to packages/ui/src/components/icons/logos/provider-logo.tsx
index 7d600d34..22af1c56 100644
--- a/packages/web/src/components/ui/provider-logo.tsx
+++ b/packages/ui/src/components/icons/logos/provider-logo.tsx
@@ -18,12 +18,11 @@
* sharing the cube (which made same-named models across groups
* indistinguishable) each renders a letter tile — the group id's initial as
* colored ink on a light tint hashed from the id (the soft tinted-tile style
- * AgentAvatar and the Skill tiles use, keeping the row's visual weight close
- * to the flat preset glyphs).
+ * AgentAvatar uses, keeping the row's visual weight close to the flat preset
+ * glyphs).
*/
-import type { CSSProperties, ReactNode } from "react";
-
-import { avatarInitial, avatarTile } from "../../lib/avatar";
+import type { ReactNode } from "react";
+import { avatarInitial, avatarTile } from "../avatars/avatar";
interface Glyph {
/** Solid marks (brand mark) use fill; line art uses stroke. */
@@ -203,18 +202,13 @@ const GLYPHS: Record<string, Glyph> = {
export function ProviderLogo({ provider, className }: { provider: string; className?: string }) {
const glyph = GLYPHS[provider];
// User-defined group (only the preset `custom` id keeps the generic cube): letter tile.
- // SVG text scales with the viewBox, staying crisp at every call-site size; the ink is
- // theme-switched via --tile-fg / --tile-fg-dark (≥ 4.5:1 on the tile for every hue,
- // see lib/avatar.ts), so the surrounding text-color class only affects preset glyphs.
+ // SVG text scales with the viewBox, staying crisp at every call-site size; the ink follows
+ // the colour scheme through one light-dark() value (≥ 4.5:1 on the tile for every hue, see
+ // avatar.ts), so the surrounding text-color class only affects preset glyphs.
if (!glyph) {
const tile = avatarTile(provider);
return (
- <svg
- viewBox="0 0 24 24"
- className={className}
- style={{ "--tile-fg": tile.fg, "--tile-fg-dark": tile.fgDark } as CSSProperties}
- aria-hidden
- >
+ <svg viewBox="0 0 24 24" className={className} aria-hidden>
<rect x="0" y="0" width="24" height="24" rx="5" fill={tile.bg} />
<text
x="12"
@@ -223,7 +217,7 @@ export function ProviderLogo({ provider, className }: { provider: string; classN
dominantBaseline="central"
fontSize="13"
fontWeight="700"
- className="[fill:var(--tile-fg)] dark:[fill:var(--tile-fg-dark)]"
+ style={{ fill: tile.ink }}
>
{avatarInitial(provider)}
</text>
diff --git a/packages/ui/src/components/icons/marks/marks.tsx b/packages/ui/src/components/icons/marks/marks.tsx
new file mode 100644
index 00000000..a5599d33
--- /dev/null
+++ b/packages/ui/src/components/icons/marks/marks.tsx
@@ -0,0 +1,131 @@
+/**
+ * Single-purpose marks drawn as components rather than registry paths: each fixes its own grid,
+ * stroke or default size, and the form-control caret and the close cross are drawn on grids
+ * smaller than the 24x24 line family — two-stroke marks alias badly when their grid and their
+ * render size disagree. The rotating collapse chevron is a different glyph and lives in
+ * `chevron.tsx`.
+ */
+import { ICONS } from "../icons";
+
+/** The downward caret on a select, an option menu or a dropdown trigger. Colour follows currentColor. */
+export function ChevronDown({ size = 12, className = "" }: { size?: number; className?: string }) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 12 12"
+ fill="none"
+ stroke="currentColor"
+ aria-hidden
+ className={`shrink-0 ${className}`}
+ >
+ <path d="M3 4.5l3 3 3-3" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
+ </svg>
+ );
+}
+
+/** The selected row's checkmark in a menu. */
+export function CheckIcon({ size = 13, className = "" }: { size?: number; className?: string }) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ aria-hidden
+ className={`shrink-0 ${className}`}
+ >
+ <path d="M5 12l4 4L19 6" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
+ </svg>
+ );
+}
+
+/** The "add" plus of create buttons and new-row affordances: `ICONS.plus` at its own stroke. */
+export function PlusIcon({
+ size = 14,
+ strokeWidth = 1.7,
+ className = "",
+}: {
+ size?: number;
+ strokeWidth?: number;
+ className?: string;
+}) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ aria-hidden
+ className={`shrink-0 ${className}`}
+ >
+ <path d={ICONS.plus} strokeWidth={strokeWidth} strokeLinecap="round" strokeLinejoin="round" />
+ </svg>
+ );
+}
+
+/** A tray with a down arrow, for export and download affordances. */
+export function DownloadIcon({ size = 13, className = "" }: { size?: number; className?: string }) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ aria-hidden
+ className={`shrink-0 ${className}`}
+ >
+ <path
+ d="M12 4v11m0 0l-5-5m5 5l5-5M4 20h16"
+ strokeWidth="1.7"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+/** A tray with an up arrow, for import and upload affordances. */
+export function UploadIcon({ size = 13, className = "" }: { size?: number; className?: string }) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ aria-hidden
+ className={`shrink-0 ${className}`}
+ >
+ <path
+ d="M12 15V4m0 0L7 9m5-5l5 5M4 20h16"
+ strokeWidth="1.7"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ />
+ </svg>
+ );
+}
+
+/**
+ * The close cross. Drawn on a 14x14 grid at stroke 1.5 rather than the 24x24 icon grid: a
+ * two-stroke mark aliases badly when its grid and its render size disagree.
+ */
+export function CloseIcon({ size = 14, className = "" }: { size?: number; className?: string }) {
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 14 14"
+ fill="none"
+ stroke="currentColor"
+ aria-hidden
+ className={`block shrink-0 ${className}`}
+ >
+ <path d="M2 2l10 10M12 2L2 12" strokeWidth="1.5" strokeLinecap="round" />
+ </svg>
+ );
+}
diff --git a/packages/ui/src/components/icons/spinner/spinner.tsx b/packages/ui/src/components/icons/spinner/spinner.tsx
index 5af5cc7f..eabda098 100644
--- a/packages/ui/src/components/icons/spinner/spinner.tsx
+++ b/packages/ui/src/components/icons/spinner/spinner.tsx
@@ -10,9 +10,8 @@
* linear in Primer and Frost and steps it eight times a turn in Console, without either theme
* redrawing the arc.
*
- * The one component the package exports so far (`index.ts`): the Web App renders it where it
- * used to hand-draw a ring, and the gallery reviews it as the Web App's screens render it — the
- * package ships no demos of its own.
+ * The Web App renders it where it used to hand-draw a ring, and the gallery reviews it as the
+ * Web App's screens render it — the package ships no demos of its own.
*/
import type { ToneName } from "../../../tokens";
diff --git a/packages/ui/src/components/icons/status-icon/status-icon.tsx b/packages/ui/src/components/icons/status-icon/status-icon.tsx
new file mode 100644
index 00000000..20fac6c3
--- /dev/null
+++ b/packages/ui/src/components/icons/status-icon/status-icon.tsx
@@ -0,0 +1,81 @@
+/**
+ * A run's state as one glyph — a tool call, a thinking row, a work group, a banner: the spinner
+ * while it runs, a static glyph once it waits or settles, so "still running" and "done" are told
+ * apart at a glance without reading the text beside it.
+ *
+ * The ink says how much the state asks of the reader: live work in the busy ink, a wait in the
+ * attention ink, a failure in the danger ink, and a finished or deliberately stopped run in the
+ * subtle ink, receding. A stop is settled and expected, so it recedes like "done" rather than
+ * flagging danger; its square is what tells the two apart.
+ *
+ * The icon carries no text of its own. With `label` it names itself (and shows the label as its
+ * tooltip); without one it is decoration beside words that already say the state, and hidden
+ * from assistive technology — an unnamed image would be announced as an anonymous one.
+ */
+import { ICONS } from "../icons";
+import { Spinner } from "../spinner/spinner";
+
+export type RunState = "running" | "waiting" | "done" | "failed" | "stopped";
+
+/** The spinner's rungs, so a running row and a settled one occupy the same box. */
+const SIZES = { xs: 10, sm: 12, md: 14 } as const;
+
+export type StatusIconSize = keyof typeof SIZES;
+
+const GLYPH: Record<Exclude<RunState, "running">, string> = {
+ waiting: ICONS.hourglass,
+ done: ICONS.checkCircle,
+ failed: ICONS.xCircle,
+ stopped: ICONS.stopCircle,
+};
+
+const INK: Record<Exclude<RunState, "running">, string> = {
+ waiting: "text-tone-attention-fg",
+ done: "text-fg-subtle",
+ failed: "text-tone-danger-fg",
+ stopped: "text-fg-subtle",
+};
+
+export function StatusIcon({
+ state,
+ size = "md",
+ label,
+}: {
+ state: RunState;
+ size?: StatusIconSize;
+ /** Names the state for assistive technology and the tooltip; omit it beside a text label. */
+ label?: string;
+}) {
+ if (state === "running") {
+ // The spinner always announces itself; beside words that already say "running" it is hidden
+ // with its wrapper instead, which is the same silence the settled glyphs keep.
+ return (
+ <span
+ {...(label === undefined ? { "aria-hidden": true } : { "data-tooltip": label })}
+ className="flex shrink-0"
+ >
+ <Spinner size={size} tone="success" label={label ?? ""} />
+ </span>
+ );
+ }
+ const px = SIZES[size];
+ return (
+ <svg
+ width={px}
+ height={px}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ // A style, not the attribute: an SVG presentation attribute cannot read a custom property.
+ style={{ strokeWidth: "var(--ui-icon-stroke, 1.7)" }}
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ {...(label === undefined
+ ? { "aria-hidden": true }
+ : { role: "img" as const, "aria-label": label, "data-tooltip": label })}
+ className={`block shrink-0 ${INK[state]}`}
+ >
+ <path d={GLYPH[state]} />
+ </svg>
+ );
+}
diff --git a/packages/ui/src/components/icons/update-dot/update-dot.tsx b/packages/ui/src/components/icons/update-dot/update-dot.tsx
new file mode 100644
index 00000000..45f8f4ac
--- /dev/null
+++ b/packages/ui/src/components/icons/update-dot/update-dot.tsx
@@ -0,0 +1,98 @@
+/**
+ * The update notification badge: a small dot hung on the top-right corner of whatever entry leads
+ * toward something updatable, the way a phone marks a menu that has news behind it.
+ *
+ * **Not a status tone, deliberately.** A tone is a judgement about a thing's own state — `danger`
+ * is failed, destructive or over a limit; `attention` is unfinished work waiting on someone. An
+ * available update is neither: nothing has gone wrong and nothing is stuck. What this mark says
+ * is "there is something new further down this path", so its colour is a token of its own,
+ * `--ui-mark-new`, which each theme sets: a notification red in Primer (the pale red-400, so the
+ * mark reads as news rather than as an alarm), the theme's own news hue elsewhere. The carve-out
+ * is about the MARK: a block one of these dots sits inside (a to-do notice) is an ordinary
+ * attention notice, which a tone does own.
+ *
+ * **The dot never carries the meaning.** It is `aria-hidden`, and its anchor states what is
+ * updatable in its own tooltip and accessible name ("<anchor> · <what is updatable>"). That is
+ * also why the mark has no contrast floor: nothing reaches the reader through the dot alone, so
+ * a theme may pick a hue pale enough to read as news.
+ *
+ * Layout-neutral: absolutely positioned, so a caller only has to be `relative`, and no row
+ * changes height for carrying one. `pointer-events-none` keeps it out of its anchor's hit area.
+ *
+ * Anchoring: a dot marks its control's **full box** — the whole row, tab or button — never the
+ * label glyphs, where it would track the text's width and float over whatever follows the word.
+ * A full-width row hangs the dot at the right edge, vertically centred (`right-2.5 top-1/2
+ * -translate-y-1/2`, the inset matching the row's own padding). A button or a tab takes the
+ * top-right corner, straddling the border where that corner is visible and pulled inside the
+ * padding where an ancestor clips it (a tab strip's `overflow-y-hidden`). Chrome anchors are their
+ * own box, so the default overhang stands.
+ */
+import type { ReactNode } from "react";
+
+/** Sizes named by the anchor they sit on, not by a number (the icon-scale convention). */
+const DOT_SIZE = {
+ /**
+ * A filled or boxed chrome anchor — an avatar, a rail icon button, the mobile menu button. The
+ * ring is the sidebar's fill, which is what separates the dot from the avatar or the row's
+ * hover fill underneath it.
+ */
+ chrome: "h-2.5 w-2.5 border-2 border-surface-muted",
+ /**
+ * A line of text or a bare glyph, where the dot sits directly on the page surface: no ring,
+ * because there is nothing underneath to separate it from and a ring would only shrink it.
+ */
+ inline: "h-1.5 w-1.5",
+} as const;
+
+export type UpdateDotSize = keyof typeof DOT_SIZE;
+
+/**
+ * The dot's fill and inline size without the positioning — for the one mark on an update trail
+ * that sits in normal flow rather than over an anchor (a to-do notice). Exported so the fill stays
+ * written once, here.
+ */
+export const UPDATE_DOT_INLINE = `rounded-full bg-mark-new ${DOT_SIZE.inline}`;
+
+export function UpdateDot({
+ size = "chrome",
+ position = "-right-0.5 -top-0.5",
+}: {
+ size?: UpdateDotSize;
+ /**
+ * Where the dot sits inside its `relative` anchor — inset utilities, plus a `translate-*` where
+ * the dot is centred on an edge or straddles a corner instead of being inset from one. The
+ * default hangs it just past the anchor's top-right corner; an anchor whose own padding or a
+ * clipping ancestor would swallow that moves it in.
+ */
+ position?: string;
+}) {
+ return (
+ <span
+ aria-hidden
+ className={`pointer-events-none absolute rounded-full bg-mark-new ${DOT_SIZE[size]} ${position}`}
+ />
+ );
+}
+
+/**
+ * The labelled form of the badge, for the one stop on a trail where a bare dot undersells the
+ * state: the card of an outdated agent, which is also where the sidebar's dot leads. A real
+ * button — it opens the settings the trail ends on — shaped like the `Badge` capsules sharing its
+ * row (same radius, padding and type), so the row reads as one family.
+ *
+ * A tinted capsule, not the dot's flat fill: this one has an interior, so its label owes 4.5:1
+ * against its own background, which the danger tone's tint and ink are held to in every theme.
+ * The danger tone paints it because a tint needs a readable ink the news mark cannot promise;
+ * the words on it, not the colour, say what is new. Hover deepens the tint toward the ink.
+ */
+export function UpdatePill({ onClick, children }: { onClick: () => void; children: ReactNode }) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ className="inline-flex shrink-0 items-center whitespace-nowrap rounded-[var(--ui-radius-pill)] bg-tone-danger-bg px-2 py-0.5 text-xs font-semibold text-tone-danger-fg transition-colors duration-150 hover:bg-[color-mix(in_oklab,var(--ui-tone-danger-bg),var(--ui-tone-danger-fg)_12%)]"
+ >
+ {children}
+ </button>
+ );
+}
diff --git a/packages/ui/src/hooks.ts b/packages/ui/src/hooks.ts
index 3eba80f4..5fac3954 100644
--- a/packages/ui/src/hooks.ts
+++ b/packages/ui/src/hooks.ts
@@ -20,6 +20,7 @@
* | | above an `h1`–`h4`) | |
* | `ui-display` | the one display title of a page or hero | only on an `h1` or `[aria-level="1"]` |
* | `ui-live` | motion for something that is running right now | `data-live="dot" \| "caret" \| "spinner"` |
+ * | | hosts: the Spinner, a pulsing Dot | |
* | `ui-frame` | a ruled box with a head, a body, a foot and panes | children carry `data-slot="head" \| "body" \| "foot" \| "pane"` |
* | `ui-underline-nav` | the selected-tab marker of a tab bar | items `[role="tab"]`, selected by `aria-selected="true"` |
* | `ui-shell` | the app window: a navigation column beside a main column | children carry `data-slot="nav" \| "main"` (a right column may carry `"dock"`); the selected nav row is `[aria-current="page"]` |
diff --git a/packages/web/src/lib/icon-scale.ts b/packages/ui/src/icon-scale.ts
similarity index 82%
rename from packages/web/src/lib/icon-scale.ts
rename to packages/ui/src/icon-scale.ts
index f1bbef03..d59d6f45 100644
--- a/packages/web/src/lib/icon-scale.ts
+++ b/packages/ui/src/icon-scale.ts
@@ -1,11 +1,10 @@
/**
* Icon sizes and icon-to-text gaps, named by the role the mark plays rather than by a number.
*
- * Every line icon in the app is drawn on a 24x24 grid and rendered through
- * `components/ui/glyph-icon.tsx` at the theme's stroke weight (`--ui-icon-stroke`, 1.7 in the
- * default theme), so the only thing a call site chooses is how big the box is —
- * and structurally equivalent places must choose the same. Picking a rung by role is what keeps
- * two list rows, or two menu rows, from drifting a pixel apart.
+ * Every line icon is drawn on a 24x24 grid and rendered through `GlyphIcon` at the theme's stroke
+ * weight (`--ui-icon-stroke`, 1.7 in the default theme), so the only thing a call site chooses is
+ * how big the box is — and structurally equivalent places must choose the same. Picking a rung by
+ * role is what keeps two list rows, or two menu rows, from drifting a pixel apart.
*
* The two exceptions to the 24x24 grid are deliberate and stay: `ChevronDown` is drawn on a
* 12x12 grid at 1.5, and the close cross on 14x14 at 1.5 — both are two-stroke marks whose
@@ -41,9 +40,9 @@ export const ICON_SIZE = {
/** A mark that anchors a whole block rather than a line: the mobile top bar, a confirm dialog's tinted disc. */
sectionMark: 18,
/**
- * The floating launcher's ball face (features/dock/dock-launcher.tsx): a control that
- * floats over the conversation on its own, with nothing beside it to size against, so it
- * sits above every in-flow rung. Its entries take the rung below.
+ * The floating launcher's ball face: a control that floats over the conversation on its own,
+ * with nothing beside it to size against, so it sits above every in-flow rung. Its entries
+ * take the rung below.
*/
launcherBall: 22,
/** A fan entry of the floating launcher: a glyph alone in a round button one rung under the ball. */
diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts
index 41a621ef..82d33dc3 100644
--- a/packages/ui/src/index.ts
+++ b/packages/ui/src/index.ts
@@ -2,9 +2,44 @@
* @prismshadow/penguin-ui — the shared UI package: token contract, themes, fonts and the
* component set. Source-only: a consumer's `workspace:*` dependency is linked to this directory,
* so Vite, vitest and tsc read `src/` through the `exports` map in package.json, never a build.
+ *
+ * Every component is exported from here, one line per module, grouped by the wave that moved it
+ * in. A barrel costs no bundle bytes in a source-only package: the bundlers tree-shake it by
+ * module.
*/
export * from "./hooks";
export * from "./tokens";
-// The component set, as it lands: the Spinner first (the Web App renders it where it used to
-// hand-draw a ring).
+export * from "./strings";
+export * from "./icon-scale";
+
+// W1 — icons: the glyph registry and its renderer, the chevron, the fixed-grid marks, the
+// spinner, logos and avatars.
+export * from "./components/icons/icons";
+export * from "./components/icons/glyph-icon/glyph-icon";
+export * from "./components/icons/chevron/chevron";
+export * from "./components/icons/marks/marks";
export * from "./components/icons/spinner/spinner";
+export * from "./components/icons/logos/provider-logo";
+export * from "./components/icons/logos/penguin-logo";
+export * from "./components/icons/avatars/avatar";
+export * from "./components/icons/avatars/agent-avatar";
+export * from "./components/icons/avatars/user-avatar";
+export * from "./components/icons/avatars/avatar-stack";
+
+// W1 — status and feedback: the state dot, the run-state and activity marks, the update dot,
+// badges, loading placeholders and empty states.
+export * from "./components/icons/dot/dot";
+export * from "./components/icons/status-icon/status-icon";
+export * from "./components/icons/activity-icon/activity-icon";
+export * from "./components/icons/update-dot/update-dot";
+export * from "./components/feedback/badge/badge";
+export * from "./components/feedback/skeleton/skeleton";
+export * from "./components/feedback/empty-state/empty-state";
+
+// W1 — actions.
+export * from "./components/actions/close-button/close-button";
+export * from "./components/actions/button/button";
+export * from "./components/actions/link/link";
+export * from "./components/actions/copy-button/copy-button";
+export * from "./components/actions/kbd/kbd";
+export * from "./components/actions/hidden-file-input/hidden-file-input";
diff --git a/packages/ui/src/strings.ts b/packages/ui/src/strings.ts
new file mode 100644
index 00000000..9dae4171
--- /dev/null
+++ b/packages/ui/src/strings.ts
@@ -0,0 +1,51 @@
+/**
+ * The package's own words: the accessibility fallbacks a primitive needs when its caller passes
+ * none, and nothing else.
+ *
+ * Copy is the caller's. A title, a status label, an empty state's sentence or a tooltip that
+ * names something in the app arrives as a prop, because only the app knows its concepts and its
+ * dictionaries. What is left is the handful of strings a primitive announces on its own — the
+ * close cross's name, the "Copied" confirmation a live region reads out, a busy fallback — and a
+ * component that forgot them would be silent to a screen reader. Those live here, English by
+ * default; the app injects its own per interface language through {@link UiStringsProvider},
+ * once, around its tree.
+ *
+ * A key joins the interface when a component that moves into the package needs one; the app's
+ * mapping from its dictionaries must then cover it in every language it ships.
+ */
+import { createContext, createElement, useContext } from "react";
+import type { ReactElement, ReactNode } from "react";
+
+export interface UiStrings {
+ /** The close cross's accessible name (`CloseButton`). */
+ close: string;
+ /** What a live region announces once something has been copied to the clipboard. */
+ copied: string;
+ /** A busy fallback a primitive may announce while its caller has named nothing. */
+ loading: string;
+}
+
+/** The English fallbacks, used wherever no provider is mounted (a test, a stand-alone page). */
+export const DEFAULT_UI_STRINGS: UiStrings = {
+ close: "Close",
+ copied: "Copied",
+ loading: "Loading…",
+};
+
+const UiStringsContext = createContext<UiStrings>(DEFAULT_UI_STRINGS);
+
+/** Supplies the app's words for the whole tree below it; mount it once, per interface language. */
+export function UiStringsProvider({
+ strings,
+ children,
+}: {
+ strings: UiStrings;
+ children?: ReactNode;
+}): ReactElement {
+ return createElement(UiStringsContext.Provider, { value: strings }, children);
+}
+
+/** The words in effect: the nearest provider's, or the English defaults when none is mounted. */
+export function useUiStrings(): UiStrings {
+ return useContext(UiStringsContext);
+}
diff --git a/packages/ui/src/theme.css b/packages/ui/src/theme.css
index fde67c63..65956279 100644
--- a/packages/ui/src/theme.css
+++ b/packages/ui/src/theme.css
@@ -9,9 +9,10 @@
* What lives here is theme-independent: the `dark` variant, the cascade layer order, the bridge
* from the `--ui-*` token contract (tokens.ts) to Tailwind utilities, the base rules that read
* tokens, the motion rules behind the `data-presence` / `data-backdrop` / `data-reveal` /
- * `data-layout-motion` attributes, and the depth ladder the `ui-tree` recipes measure with. Token
- * VALUES live only in `themes/*.css`, and so do the user's accent presets: each theme lists its
- * own, in `@layer ui-accent`, scoped to that theme (tokens.ts, `ACCENT_PRESETS`).
+ * `data-layout-motion` attributes, the activity marks' turn and squeeze, and the depth ladder the
+ * `ui-tree` recipes measure with. Token VALUES live only in `themes/*.css`, and so do the user's
+ * accent presets: each theme lists its own, in `@layer ui-accent`, scoped to that theme (tokens.ts,
+ * `ACCENT_PRESETS`).
*
* Attributes on <html>: `class="dark"` (mode), `data-theme` (absent = github), `data-accent`
* (absent = the theme's own accent; an id the active theme does not list paints nothing, which
@@ -133,6 +134,9 @@
--color-tone-info-emphasis: var(--ui-tone-info-emphasis);
--color-tone-info-emphasis-fg: var(--ui-tone-info-emphasis-fg);
+ /* Marks that are not a tone: bg-mark-new (the update dot) */
+ --color-mark-new: var(--ui-mark-new);
+
/* Charts: identity colours, not judgement */
--color-chart-1: var(--ui-chart-1);
--color-chart-2: var(--ui-chart-2);
@@ -342,6 +346,48 @@
transition-duration: var(--ui-dur-layout);
transition-timing-function: var(--ui-ease-layout);
}
+
+ /*
+ * The activity marks' own motion (ActivityIcon): the same in every theme, because the motion is
+ * the mark — the two live states share one ink and are told apart by shape and by how they move.
+ *
+ * - `hourglass-turn`: an hourglass does not spin, it gets turned over — held still, flipped 180
+ * degrees in about 360 ms, held again, flipped back. The long dwell is what keeps it legible
+ * at a 12 px row mark: a continuous spin at that size reads as a smudge.
+ * - `compact-squeeze`: compaction pushes a context down to a summary, so the compress mark
+ * closes on its centre bar and springs back.
+ *
+ * Both keyframes touch `transform` alone and the glyph at rest has none, so switching animation
+ * off (reduced motion, below) leaves the mark upright, full size and fully visible.
+ */
+ .hourglass-turn {
+ animation: hourglass-turn 3s ease-in-out infinite;
+ }
+ @keyframes hourglass-turn {
+ 0%,
+ 38% {
+ transform: rotate(0deg);
+ }
+ 50%,
+ 88% {
+ transform: rotate(180deg);
+ }
+ 100% {
+ transform: rotate(360deg);
+ }
+ }
+ .compact-squeeze {
+ animation: compact-squeeze 1.8s ease-in-out infinite;
+ }
+ @keyframes compact-squeeze {
+ 0%,
+ 100% {
+ transform: scaleY(1);
+ }
+ 50% {
+ transform: scaleY(0.62);
+ }
+ }
}
/* No motion: the gallery's switch on the root, then the user's system preference. Live signals
@@ -358,6 +404,9 @@
:root[data-motion="reduced"] [data-layout-motion] {
transition: none;
}
+:root[data-motion="reduced"] :is(.hourglass-turn, .compact-squeeze) {
+ animation: none;
+}
/* The `ui-activity` recipes animate the running row (Frost's halo), a slot inside it (Frost's
label highlight) and a slot's pseudo-elements (Console's block bar), so all three are named:
each holds its declared, unanimated state instead — a still halo, plain ink, one fill. */
@@ -384,6 +433,9 @@
[data-layout-motion] {
transition: none;
}
+ :is(.hourglass-turn, .compact-squeeze) {
+ animation: none;
+ }
:is(.ui-activity, .ui-activity *),
:is(.ui-activity, .ui-activity *)::before,
:is(.ui-activity, .ui-activity *)::after {
diff --git a/packages/ui/src/themes/geek.css b/packages/ui/src/themes/geek.css
index 81e44b15..ec715372 100644
--- a/packages/ui/src/themes/geek.css
+++ b/packages/ui/src/themes/geek.css
@@ -148,6 +148,10 @@
--ui-tone-info-emphasis: var(--ui-tone-info-fg);
--ui-tone-info-emphasis-fg: #ffffff;
+ /* Colour — marks: the update dot in the bright terminal red of the dark page's danger ink,
+ one value on paper and on black */
+ --ui-mark-new: #ff5252;
+
/* Charts: terminal hues in the roles (indigo, ochre, cobalt, crimson, phosphor, magenta,
cyan, orange — the presets' own hues, deep enough for paper), the reference curve in the
muted ink, the token-kind blues, and a plotter's geometry — thin solid bars with square
diff --git a/packages/ui/src/themes/github.css b/packages/ui/src/themes/github.css
index 325388a9..238a6ae2 100644
--- a/packages/ui/src/themes/github.css
+++ b/packages/ui/src/themes/github.css
@@ -94,7 +94,8 @@
/* ---- Colour — semantic tones ----
Ink on a tint and a solid fill's label clear 4.5:1 (badge text is the 700 step, as the app's
tinted pills draw it); fg on the page surfaces clears 3:1. `neutral` ink is the muted pill's
- gray-600. Nothing in the app reads these yet — its tones still come from tone.ts classes. */
+ gray-600. The package's badges, dots and status marks read these; the app's own call sites
+ still take their tones from tone.ts classes until their components move. */
--ui-tone-success-fg: oklch(50.8% 0.118 165.612); /* emerald-700 */
--ui-tone-success-bg: oklch(97.9% 0.021 166.113); /* emerald-50 */
--ui-tone-success-line: oklch(84.5% 0.143 164.978); /* emerald-300 */
@@ -126,6 +127,10 @@
--ui-tone-info-emphasis: oklch(50% 0.134 242.749); /* sky-700 */
--ui-tone-info-emphasis-fg: #ffffff;
+ /* ---- Colour — marks: the update dot's notification red, the pale rung so it reads as news
+ rather than as an alarm; the app's value, one in both modes ---- */
+ --ui-mark-new: oklch(70.4% 0.191 22.216); /* red-400 */
+
/* ---- Charts: the series palette in its roles (violet, amber, sky, rose, emerald, fuchsia,
then teal and orange from the employee palette). Amber, sky, emerald, teal and orange sit
at their 600 steps — the steps the app's dark series already used — since their 500s read
diff --git a/packages/ui/src/themes/modern.css b/packages/ui/src/themes/modern.css
index c8e39907..ea2801d1 100644
--- a/packages/ui/src/themes/modern.css
+++ b/packages/ui/src/themes/modern.css
@@ -120,6 +120,10 @@
--ui-tone-info-emphasis: #2f66c4;
--ui-tone-info-emphasis-fg: #ffffff;
+ /* Colour — marks: the update dot in a soft coral, the danger hue lifted so it reads as news;
+ one value on both pages */
+ --ui-mark-new: #f0765a;
+
/* Charts: soft. A low-chroma palette in the roles (heather, ochre, dusk blue, rose, sage,
mauve, teal, clay), each just clearing 3:1 on the canvas so a line and a point read; the
bars are the same colours let through at seven tenths (a little more in dark) with no
diff --git a/packages/ui/src/tokens.ts b/packages/ui/src/tokens.ts
index cbe8c7f7..12b3d3c4 100644
--- a/packages/ui/src/tokens.ts
+++ b/packages/ui/src/tokens.ts
@@ -247,6 +247,14 @@ export const TOKEN_GROUPS = [
"--ui-tone-info-emphasis-fg",
],
},
+ {
+ id: "color-marks",
+ title: "Colour — marks",
+ // A mark that is deliberately not a tone: `new` is the update dot's fill — "there is something
+ // new down this path", neither a fault nor unfinished work. It never carries the meaning alone
+ // (its anchor names what is new), so it has no contrast floor and a theme may keep it pale.
+ names: ["--ui-mark-new"],
+ },
{
id: "chart",
title: "Charts — series colours and geometry",
diff --git a/packages/ui/test/activity-icon.test.ts b/packages/ui/test/activity-icon.test.ts
new file mode 100644
index 00000000..5e7fe92b
--- /dev/null
+++ b/packages/ui/test/activity-icon.test.ts
@@ -0,0 +1,151 @@
+/**
+ * The activity marks: each live state a shape and a motion of its own in one attention ink, the
+ * unread state a success dot centred in the same box, every state named by the caller's label —
+ * and the two marks beside them in the busy and the subtle ink. The motion lives in theme.css
+ * and must leave the glyph upright and visible when animation is switched off.
+ */
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import {
+ ActivityIcon,
+ BackgroundTasksMark,
+ ScheduleMark,
+} from "../src/components/icons/activity-icon/activity-icon";
+import type { ActivityIconState } from "../src/components/icons/activity-icon/activity-icon";
+import { ICONS } from "../src/components/icons/icons";
+import { ICON_SIZE } from "../src/icon-scale";
+import { classTokens, renderStatic, stripCssComments } from "../src/testing";
+import { SRC_DIR } from "./helpers/paths";
+
+const ACTIVITIES: readonly ActivityIconState[] = ["running", "compacting", "completedUnread"];
+const LABELS: Record<ActivityIconState, string> = {
+ running: "Running",
+ compacting: "Compacting",
+ completedUnread: "Finished, unread",
+};
+
+const render = (activity: ActivityIconState) =>
+ renderStatic(createElement(ActivityIcon, { activity, label: LABELS[activity] }));
+
+describe("ActivityIcon", () => {
+ it("draws a different shape for each live state, from the registry", () => {
+ expect(ICONS.compress).not.toBe(ICONS.hourglass);
+ expect(render("running")).toContain(`d="${ICONS.hourglass}"`);
+ expect(render("compacting")).toContain(`d="${ICONS.compress}"`);
+ });
+
+ it("gives each live state its own motion and leaves the dot still", () => {
+ expect(render("running")).toContain("hourglass-turn");
+ expect(render("compacting")).toContain("compact-squeeze");
+ expect(render("compacting")).not.toContain("hourglass-turn");
+ const unread = render("completedUnread");
+ expect(unread).not.toContain("hourglass-turn");
+ expect(unread).not.toContain("compact-squeeze");
+ expect(unread).not.toContain("ui-live");
+ });
+
+ it("inks both live states with the attention tone", () => {
+ for (const activity of ["running", "compacting"] as const) {
+ expect(classTokens(render(activity))).toContain("text-tone-attention-fg");
+ }
+ });
+
+ it("draws the unread state as the success dot, not a glyph", () => {
+ const unread = render("completedUnread");
+ expect(unread).not.toContain("<svg");
+ expect(classTokens(unread)).toEqual(
+ expect.arrayContaining(["bg-tone-success-emphasis", "rounded-full"]),
+ );
+ expect(unread).toContain("width:6px;height:6px");
+ });
+
+ it("names every state with the caller's label, live ones as a status", () => {
+ for (const activity of ACTIVITIES) {
+ const html = render(activity);
+ expect(html).toContain(`aria-label="${LABELS[activity]}"`);
+ expect(html).toContain(`data-tooltip="${LABELS[activity]}"`);
+ }
+ expect(render("running")).toContain('role="status"');
+ expect(render("compacting")).toContain('role="status"');
+ expect(render("completedUnread")).toContain('role="img"');
+ });
+
+ it("occupies the same row-mark box whatever the state, unless the caller sizes it", () => {
+ for (const activity of ACTIVITIES) {
+ expect(render(activity)).toMatch(/^<span[^>]*style="width:12px;height:12px"/);
+ }
+ const larger = renderStatic(
+ createElement(ActivityIcon, { activity: "running", label: "Running", size: 16 }),
+ );
+ expect(larger).toContain("width:16px;height:16px");
+ });
+});
+
+describe("BackgroundTasksMark and ScheduleMark", () => {
+ it("draw background work in the busy ink, named by the caller, at the caller's rung", () => {
+ const html = renderStatic(
+ createElement(BackgroundTasksMark, { label: "3 background tasks", size: ICON_SIZE.rowMark }),
+ );
+ expect(html).toContain('role="img"');
+ expect(html).toContain('aria-label="3 background tasks"');
+ expect(html).toContain('data-tooltip="3 background tasks"');
+ expect(html).toContain(`d="${ICONS.pulse}"`);
+ expect(html).toContain('width="12"');
+ expect(classTokens(html)).toContain("text-tone-success-fg");
+ expect(html).not.toContain("hourglass-turn");
+ });
+
+ it("let a scheduled task recede, its meaning in the label it is given", () => {
+ const html = renderStatic(
+ createElement(ScheduleMark, { label: "Scheduled", size: ICON_SIZE.rowMark }),
+ );
+ expect(html).toContain('aria-label="Scheduled"');
+ expect(html).toContain('data-tooltip="Scheduled"');
+ expect(html).toContain(`d="${ICONS.alarmClock}"`);
+ const tokens = classTokens(html);
+ expect(tokens).toContain("text-fg-subtle");
+ expect(tokens.some((t) => t.startsWith("text-tone-"))).toBe(false);
+ });
+});
+
+describe("the activity motion in theme.css", () => {
+ const sheet = stripCssComments(readFileSync(join(SRC_DIR, "theme.css"), "utf8"));
+
+ /** A keyframes block's body, braces balanced, or "" when the sheet has none by that name. */
+ const keyframes = (name: string) => {
+ const start = sheet.indexOf(`@keyframes ${name}`);
+ if (start < 0) return "";
+ const open = sheet.indexOf("{", start);
+ let depth = 0;
+ for (let i = open; i < sheet.length; i++) {
+ if (sheet[i] === "{") depth++;
+ else if (sheet[i] === "}" && --depth === 0) return sheet.slice(open + 1, i);
+ }
+ return "";
+ };
+
+ it("runs each mark's keyframes on its class", () => {
+ expect(sheet).toMatch(/\.hourglass-turn\s*\{[^}]*animation:\s*hourglass-turn\s/);
+ expect(sheet).toMatch(/\.compact-squeeze\s*\{[^}]*animation:\s*compact-squeeze\s/);
+ });
+
+ it("only transforms, so with animation off the glyph stands upright, still visible", () => {
+ for (const name of ["hourglass-turn", "compact-squeeze"]) {
+ const body = keyframes(name);
+ expect(body, name).not.toBe("");
+ const properties = [...body.matchAll(/([a-z-]+)\s*:/g)].map((m) => m[1]);
+ expect(new Set(properties), name).toEqual(new Set(["transform"]));
+ }
+ expect(keyframes("hourglass-turn")).toMatch(/rotate\(180deg\)/); // A turn, not a spin.
+ });
+
+ it("stops under the gallery's switch and the system preference", () => {
+ expect(sheet).toMatch(
+ /:root\[data-motion="reduced"\]\s*:is\(\.hourglass-turn,\s*\.compact-squeeze\)\s*\{\s*animation:\s*none;/,
+ );
+ const media = sheet.slice(sheet.indexOf("@media (prefers-reduced-motion: reduce)"));
+ expect(media).toMatch(/:is\(\.hourglass-turn,\s*\.compact-squeeze\)\s*\{\s*animation:\s*none;/);
+ });
+});
diff --git a/packages/ui/test/avatar.test.ts b/packages/ui/test/avatar.test.ts
new file mode 100644
index 00000000..123f2d6f
--- /dev/null
+++ b/packages/ui/test/avatar.test.ts
@@ -0,0 +1,167 @@
+/**
+ * Letter-avatar helpers (src/components/icons/avatars/avatar.ts): hue and tile determinism and
+ * spread across names; initial extraction — grapheme based (CJK, ZWJ emoji and flags stay whole),
+ * uppercasing, and the empty/whitespace → fallback → "?" chain; and an exhaustive WCAG check that
+ * both inks the tile's one `light-dark()` value carries keep ≥ 4.5:1 against the tinted tile over
+ * every surface the themes declare, for all 360 hues.
+ */
+import { existsSync, readFileSync } from "node:fs";
+import { join } from "node:path";
+import { describe, expect, it } from "vitest";
+import {
+ avatarHue,
+ avatarInitial,
+ avatarTile,
+ avatarTileOfHue,
+} from "../src/components/icons/avatars/avatar";
+import { DEFAULT_THEME_ID, THEME_IDS, THEME_MODES } from "../src/tokens";
+import type { ThemeId, ThemeModeName } from "../src/tokens";
+import {
+ BLACK,
+ WHITE,
+ analyzeThemeFile,
+ composite,
+ contrastRatio,
+ parseColor,
+ resolveThemeValue,
+} from "../src/testing";
+import type { ThemeFileAnalysis } from "../src/testing";
+import { SRC_DIR } from "./helpers/paths";
+
+describe("avatarHue / avatarTile", () => {
+ it("is deterministic for the same key", () => {
+ expect(avatarHue("my-provider")).toBe(avatarHue("my-provider"));
+ expect(avatarTile("agent-1")).toEqual(avatarTile("agent-1"));
+ });
+
+ it("stays inside the 0-359 hue range", () => {
+ for (const key of ["", "a", "my-provider", "深度求索", "🐧"]) {
+ const hue = avatarHue(key);
+ expect(Number.isInteger(hue)).toBe(true);
+ expect(hue).toBeGreaterThanOrEqual(0);
+ expect(hue).toBeLessThan(360);
+ }
+ });
+
+ it("spreads distinct hues across realistic group names", () => {
+ const names = ["my-llm", "local-vllm", "team-proxy", "backup"];
+ expect(new Set(names.map(avatarHue)).size).toBe(names.length);
+ });
+
+ it("formats the tint and the two inks from the key's hue, and joins the inks in light-dark()", () => {
+ const h = avatarHue("x");
+ expect(avatarTile("x")).toEqual({
+ bg: `hsl(${h} 55% 50% / 0.14)`,
+ fg: `hsl(${h} 55% 27%)`,
+ fgDark: `hsl(${h} 55% 77%)`,
+ ink: `light-dark(hsl(${h} 55% 27%), hsl(${h} 55% 77%))`,
+ });
+ expect(avatarTile("x")).toEqual(avatarTileOfHue(h));
+ });
+});
+
+describe("avatarInitial", () => {
+ it("takes the first character, uppercased", () => {
+ expect(avatarInitial("my-provider")).toBe("M");
+ expect(avatarInitial("Zeta")).toBe("Z");
+ });
+
+ it("keeps case-less characters (CJK) as-is", () => {
+ expect(avatarInitial("深度求索")).toBe("深");
+ });
+
+ it("treats a surrogate-pair character as one initial", () => {
+ expect(avatarInitial("🐧 harness")).toBe("🐧");
+ });
+
+ it("keeps multi-code-point grapheme clusters whole (ZWJ emoji, flags)", () => {
+ expect(avatarInitial("👩‍💻 dev tools")).toBe("👩‍💻");
+ expect(avatarInitial("🇨🇦 north")).toBe("🇨🇦");
+ });
+
+ it("trims whitespace before picking the initial", () => {
+ expect(avatarInitial(" agent")).toBe("A");
+ });
+
+ it("falls back to the fallback's initial, then ?", () => {
+ expect(avatarInitial("", "agent-1")).toBe("A");
+ expect(avatarInitial(" ", " x")).toBe("X");
+ expect(avatarInitial("")).toBe("?");
+ expect(avatarInitial(" ", " ")).toBe("?");
+ });
+});
+
+// ---- WCAG contrast of the initial ink on the tinted tile (every theme, both modes, all hues) ----
+
+/**
+ * The surfaces a tile sits on, per theme and mode, read from the theme files: the page, a card
+ * and the muted fill of a list, plus the gray steps the app still paints list grounds, row hovers
+ * and selected rows with (white, gray-50 and gray-100 in light; gray-900, 800 and 700 in dark). A
+ * theme that declares no gray bridge of its own falls back to the default theme's, as the
+ * cascade does.
+ */
+const SURFACES: Readonly<Record<ThemeModeName, readonly string[]>> = {
+ light: [
+ "--ui-canvas",
+ "--ui-surface",
+ "--ui-surface-muted",
+ "--color-white",
+ "--color-gray-50",
+ "--color-gray-100",
+ ],
+ dark: [
+ "--ui-canvas",
+ "--ui-surface",
+ "--ui-surface-muted",
+ "--color-gray-900",
+ "--color-gray-800",
+ "--color-gray-700",
+ ],
+};
+
+function themeAnalysis(id: ThemeId): ThemeFileAnalysis | null {
+ const path = join(SRC_DIR, "themes", `${id}.css`);
+ if (!existsSync(path)) return null;
+ const analysis = analyzeThemeFile(readFileSync(path, "utf8"), id);
+ return analysis.isStub ? null : analysis;
+}
+
+describe("avatarTile contrast (WCAG AA)", () => {
+ const defaultTheme = themeAnalysis(DEFAULT_THEME_ID);
+
+ it("reads the default theme", () => {
+ expect(defaultTheme).not.toBeNull();
+ });
+
+ for (const id of THEME_IDS) {
+ const theme = themeAnalysis(id);
+ if (theme === null || defaultTheme === null) {
+ it.skip(`${id} — PENDING: themes/${id}.css declares no tokens yet`, () => {});
+ continue;
+ }
+ for (const mode of THEME_MODES) {
+ it(`${id} ${mode}: the initial keeps ≥ 4.5:1 on the tile, for every hue on every surface`, () => {
+ const failures: string[] = [];
+ const surfaces = SURFACES[mode].flatMap((name) => {
+ const value = resolveThemeValue(name, mode, theme, defaultTheme);
+ const color = value === null ? null : parseColor(value);
+ if (color === null) {
+ failures.push(`${name} does not resolve to a colour (${String(value)})`);
+ return [];
+ }
+ return [{ name, color: composite(color, mode === "light" ? WHITE : BLACK) }];
+ });
+ for (let h = 0; h < 360; h++) {
+ const tile = avatarTileOfHue(h);
+ const ink = parseColor(mode === "light" ? tile.fg : tile.fgDark)!;
+ const tint = parseColor(tile.bg)!;
+ for (const surface of surfaces) {
+ const ratio = contrastRatio(ink, composite(tint, surface.color));
+ if (ratio < 4.5) failures.push(`hue ${h} on ${surface.name}: ${ratio.toFixed(2)}:1`);
+ }
+ }
+ expect(failures, `\n${failures.join("\n")}\n`).toEqual([]);
+ });
+ }
+ }
+});
diff --git a/packages/ui/test/avatars.test.ts b/packages/ui/test/avatars.test.ts
new file mode 100644
index 00000000..5f30993d
--- /dev/null
+++ b/packages/ui/test/avatars.test.ts
@@ -0,0 +1,78 @@
+/**
+ * The avatars' markup: an agent tile inks its initial through one scheme-following value (no
+ * dark-mode class), an account's disc is drawn in tokens, and a stack shows a few avatars then
+ * a count, with the avatars themselves hidden from assistive technology.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { AgentAvatar } from "../src/components/icons/avatars/agent-avatar";
+import { avatarTile } from "../src/components/icons/avatars/avatar";
+import { AvatarStack } from "../src/components/icons/avatars/avatar-stack";
+import { USER_AVATAR_SIZE, UserAvatar } from "../src/components/icons/avatars/user-avatar";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("AgentAvatar", () => {
+ it("draws the name's initial on the id's tile, inked with light-dark()", () => {
+ const html = renderStatic(createElement(AgentAvatar, { id: "docs-expert", name: "docs" }));
+ const tile = avatarTile("docs-expert");
+ expect(html).toContain(`fill="${tile.bg}"`);
+ expect(html).toContain(`fill:${tile.ink}`);
+ expect(html).toContain(">D</text>");
+ expect(html).not.toContain("dark:");
+ expect(html).toContain('aria-hidden="true"');
+ });
+});
+
+describe("UserAvatar", () => {
+ it("draws the nickname's initial on a token disc when no image is stored", () => {
+ const html = renderStatic(
+ createElement(UserAvatar, { userId: "admin", displayName: "zoe", size: 28 }),
+ );
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["bg-fg", "text-canvas"]));
+ expect(html).toContain(">Z</span>");
+ expect(html).toContain('aria-hidden="true"');
+ });
+
+ it("shows a stored image cropped to the circle, with no alternative text of its own", () => {
+ const html = renderStatic(
+ createElement(UserAvatar, {
+ userId: "admin",
+ avatar: "data:image/png;base64,AAAA",
+ size: USER_AVATAR_SIZE.preview,
+ }),
+ );
+ expect(html).toContain('src="data:image/png;base64,AAAA"');
+ expect(html).toContain('alt=""');
+ expect(html).toContain("width:64px");
+ });
+});
+
+describe("AvatarStack", () => {
+ const items = ["a", "b", "c", "d", "e"].map((id) => ({ id, name: id.toUpperCase() }));
+
+ it("draws the first few and counts the rest", () => {
+ const html = renderStatic(createElement(AvatarStack, { items, size: 18 }));
+ expect(html.match(/<svg/g)).toHaveLength(3);
+ expect(html).toContain(">+2</span>");
+ });
+
+ it("draws no count when everything fits", () => {
+ const html = renderStatic(createElement(AvatarStack, { items: items.slice(0, 2), size: 18 }));
+ expect(html).not.toMatch(/>\+\d/);
+ });
+
+ it("hides the avatars from assistive technology and draws an account as a disc", () => {
+ const html = renderStatic(
+ createElement(AvatarStack, {
+ items: [
+ { id: "qa", name: "QA" },
+ { id: "admin", name: "Zoe", kind: "user" as const },
+ ],
+ size: 18,
+ }),
+ );
+ expect(html).toMatch(/^<span class="[^"]*"><span class="flex -space-x-1" aria-hidden="true">/);
+ expect(html).toContain("border-radius:50%");
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["ring-canvas", "bg-fg"]));
+ });
+});
diff --git a/packages/ui/test/badge.test.ts b/packages/ui/test/badge.test.ts
new file mode 100644
index 00000000..4b09d14f
--- /dev/null
+++ b/packages/ui/test/badge.test.ts
@@ -0,0 +1,88 @@
+/**
+ * Badge and Count: every tone in three weights from the tone tokens, one geometry for all three,
+ * the small rung and the theme's pill radius; a count in tabular figures that caps at `max`.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { Badge, Count } from "../src/components/feedback/badge/badge";
+import type { BadgeProps } from "../src/components/feedback/badge/badge";
+import { TONES } from "../src/tokens";
+import { classTokens, markupStructure, renderStatic } from "../src/testing";
+
+const render = (props: Omit<BadgeProps, "children">, text = "failed") =>
+ renderStatic(createElement(Badge, { ...props, children: text }));
+
+describe("Badge", () => {
+ it("is a neutral soft capsule by default", () => {
+ const tokens = classTokens(render({}));
+ expect(tokens).toEqual(
+ expect.arrayContaining([
+ "bg-tone-neutral-bg",
+ "text-tone-neutral-fg",
+ "text-xs",
+ "font-semibold",
+ "rounded-[var(--ui-radius-pill)]",
+ ]),
+ );
+ expect(tokens).not.toContain("text-[11px]");
+ });
+
+ it("paints every tone's soft, outline and solid weights from its tokens", () => {
+ for (const tone of TONES) {
+ expect(classTokens(render({ tone }))).toEqual(
+ expect.arrayContaining([`bg-tone-${tone}-bg`, `text-tone-${tone}-fg`]),
+ );
+ expect(classTokens(render({ tone, variant: "outline" }))).toEqual(
+ expect.arrayContaining([`ring-tone-${tone}-line`, `text-tone-${tone}-fg`]),
+ );
+ expect(classTokens(render({ tone, variant: "solid" }))).toEqual(
+ expect.arrayContaining([`bg-tone-${tone}-emphasis`, `text-tone-${tone}-emphasis-fg`]),
+ );
+ }
+ });
+
+ it("never pairs a tone's tint with its own line on one box", () => {
+ for (const tone of TONES) {
+ for (const variant of ["soft", "outline", "solid"] as const) {
+ const tokens = classTokens(render({ tone, variant }));
+ const tinted = tokens.includes(`bg-tone-${tone}-bg`);
+ const lined = tokens.some((t) => t.startsWith(`border-tone-${tone}-`));
+ expect(tinted && lined, `${tone} ${variant}`).toBe(false);
+ }
+ }
+ });
+
+ it("keeps one geometry across the three weights, so a mixed row stays aligned", () => {
+ const geometry = (variant: "soft" | "outline" | "solid") =>
+ classTokens(render({ tone: "danger", variant })).filter((t) =>
+ /^(?:p[xy]?-|border$|text-xs$|rounded)/.test(t),
+ );
+ expect(geometry("outline")).toEqual(geometry("soft"));
+ expect(geometry("solid")).toEqual(geometry("soft"));
+ expect(markupStructure(render({ variant: "solid" }))).toBe(markupStructure(render({})));
+ });
+
+ it("takes a tighter padding at sm", () => {
+ expect(classTokens(render({}))).toEqual(expect.arrayContaining(["px-2", "py-0.5"]));
+ expect(classTokens(render({ size: "sm" }))).toEqual(
+ expect.arrayContaining(["px-1.5", "py-px"]),
+ );
+ });
+
+ it("carries the caller's words as its content", () => {
+ expect(render({ tone: "success" }, "running")).toContain(">running</span>");
+ });
+});
+
+describe("Count", () => {
+ it("sets its number in tabular figures", () => {
+ const html = renderStatic(createElement(Count, { n: 12 }));
+ expect(html).toContain(">12</span>");
+ expect(classTokens(html)).toContain("tabular-nums");
+ });
+
+ it("caps at max with a plus, and shows the number itself up to it", () => {
+ expect(renderStatic(createElement(Count, { n: 120, max: 99 }))).toContain(">99+</span>");
+ expect(renderStatic(createElement(Count, { n: 99, max: 99 }))).toContain(">99</span>");
+ });
+});
diff --git a/packages/ui/test/button.test.ts b/packages/ui/test/button.test.ts
new file mode 100644
index 00000000..5cd591cd
--- /dev/null
+++ b/packages/ui/test/button.test.ts
@@ -0,0 +1,124 @@
+/**
+ * Button, IconButton and buttonClass: token-drawn variants with no mono label (de-slop rule 16),
+ * the tooltip layer instead of a native title, a square button that is always named, and the one
+ * Spinner standing in while loading.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { Button, IconButton, buttonClass } from "../src/components/actions/button/button";
+import type { ButtonSize, ButtonVariant } from "../src/components/actions/button/button";
+import { UiStringsProvider } from "../src/strings";
+import { classTokens, renderStatic } from "../src/testing";
+
+const VARIANTS: ButtonVariant[] = ["primary", "secondary", "danger", "ghost", "link"];
+const SIZES: ButtonSize[] = ["xs", "sm", "md", "icon", "icon-sm"];
+const glyph = createElement("svg", { id: "glyph" });
+
+describe("Button", () => {
+ it("draws every variant in tokens, and never sets a label in mono", () => {
+ for (const variant of VARIANTS) {
+ for (const size of SIZES) {
+ const tokens = classTokens(renderStatic(createElement(Button, { variant, size }, "Save")));
+ expect(tokens).not.toContain("font-mono");
+ }
+ }
+ const tokens = (variant: ButtonVariant) =>
+ classTokens(renderStatic(createElement(Button, { variant }, "Save")));
+ expect(tokens("secondary")).toEqual(
+ expect.arrayContaining(["bg-surface", "text-fg", "border-line-emphasis", "rounded-control"]),
+ );
+ expect(tokens("danger")).toEqual(
+ expect.arrayContaining([
+ "text-tone-danger-fg",
+ "hover:border-tone-danger-line",
+ "hover:bg-tone-danger-bg",
+ ]),
+ );
+ expect(tokens("ghost")).toEqual(expect.arrayContaining(["text-fg-muted", "hover:text-fg"]));
+ // A link-button is text: the link colour, and no box around it.
+ expect(tokens("link")).toEqual(expect.arrayContaining(["text-link", "hover:underline"]));
+ expect(tokens("link")).not.toContain("border");
+ expect(tokens("link")).not.toContain("px-3");
+ });
+
+ it("shows its title through the tooltip layer, and names a square button by it", () => {
+ const text = renderStatic(createElement(Button, { title: "Save the draft" }, "Save"));
+ expect(text).toContain('data-tooltip="Save the draft"');
+ expect(text).not.toContain("title=");
+ expect(text).not.toContain("aria-label=");
+ const square = renderStatic(createElement(Button, { size: "icon", title: "Add" }, glyph));
+ expect(square).toContain('aria-label="Add"');
+ });
+
+ it("puts the leading mark before the label", () => {
+ const html = renderStatic(createElement(Button, { leading: glyph }, "New"));
+ expect(html.indexOf('id="glyph"')).toBeLessThan(html.indexOf("New"));
+ });
+
+ it("stands the spinner in for the leading mark while loading, busy and disabled", () => {
+ const html = renderStatic(createElement(Button, { loading: true, leading: glyph }, "Save"));
+ expect(html).toMatch(/^<button type="button" aria-busy="true" disabled=""/);
+ expect(html).toContain('role="status" aria-label="Loading…"');
+ expect(html).not.toContain('id="glyph"');
+ expect(html).toContain("Save");
+ // The caller's word first, the injected fallback next.
+ const named = renderStatic(
+ createElement(Button, { loading: true, loadingLabel: "Saving the draft" }, "Save"),
+ );
+ expect(named).toContain('aria-label="Saving the draft"');
+ const injected = renderStatic(
+ createElement(
+ UiStringsProvider,
+ { strings: { close: "关闭", copied: "已复制", loading: "加载中…" } },
+ createElement(Button, { loading: true }, "保存"),
+ ),
+ );
+ expect(injected).toContain('aria-label="加载中…"');
+ });
+
+ it("keeps one mark in a square: the spinner replaces the glyph", () => {
+ const html = renderStatic(
+ createElement(Button, { size: "icon", "aria-label": "Add", loading: true }, glyph),
+ );
+ expect(html).toContain('role="status"');
+ expect(html).not.toContain('id="glyph"');
+ });
+});
+
+describe("IconButton", () => {
+ it("is named and tooltipped by its required label, or by a shorter title", () => {
+ const html = renderStatic(createElement(IconButton, { label: "Delete notes.md" }, glyph));
+ expect(html).toContain('aria-label="Delete notes.md"');
+ expect(html).toContain('data-tooltip="Delete notes.md"');
+ const titled = renderStatic(
+ createElement(IconButton, { label: "Delete notes.md", title: "Delete" }, glyph),
+ );
+ expect(titled).toContain('aria-label="Delete notes.md"');
+ expect(titled).toContain('data-tooltip="Delete"');
+ });
+
+ it("takes the square sizes", () => {
+ const md = classTokens(renderStatic(createElement(IconButton, { label: "Add" }, glyph)));
+ expect(md).toContain("p-1.5");
+ const sm = classTokens(
+ renderStatic(createElement(IconButton, { label: "Add", size: "sm" }, glyph)),
+ );
+ expect(sm).toContain("p-1");
+ });
+});
+
+describe("buttonClass", () => {
+ it("is the Button look on a label, with a pointer and the focus of the input inside", () => {
+ const label = buttonClass("secondary", "sm").split(/\s+/);
+ const button = classTokens(
+ renderStatic(createElement(Button, { variant: "secondary", size: "sm" }, "Upload")),
+ );
+ for (const token of ["bg-surface", "border-line-emphasis", "px-2.5", "text-xs"]) {
+ expect(label).toContain(token);
+ expect(button).toContain(token);
+ }
+ expect(label).toContain("cursor-pointer");
+ expect(label).toContain("has-[:focus-visible]:[outline:var(--ui-focus-ring)]");
+ expect(label).not.toContain("font-mono");
+ });
+});
diff --git a/packages/ui/test/close-button.test.ts b/packages/ui/test/close-button.test.ts
new file mode 100644
index 00000000..f7ce4815
--- /dev/null
+++ b/packages/ui/test/close-button.test.ts
@@ -0,0 +1,53 @@
+/**
+ * CloseButton: a real button named by the interface's word for "close" unless the caller names
+ * it, with the caller's tooltip, drawn in tokens.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { CloseButton } from "../src/components/actions/close-button/close-button";
+import { UiStringsProvider } from "../src/strings";
+import { classTokens, renderStatic } from "../src/testing";
+
+const noop = () => {};
+
+describe("CloseButton", () => {
+ it("is a button named by the package's fallback when nothing else names it", () => {
+ const html = renderStatic(createElement(CloseButton, { onClose: noop }));
+ expect(html).toMatch(/^<button type="button" aria-label="Close"/);
+ expect(html).not.toContain("title=");
+ });
+
+ it("takes the injected word, and a caller's label over both", () => {
+ const strings = { close: "关闭", copied: "已复制", loading: "加载中…" };
+ const injected = renderStatic(
+ createElement(UiStringsProvider, { strings }, createElement(CloseButton, { onClose: noop })),
+ );
+ expect(injected).toContain('aria-label="关闭"');
+ const named = renderStatic(
+ createElement(
+ UiStringsProvider,
+ { strings },
+ createElement(CloseButton, { onClose: noop, label: "Dismiss the notice" }),
+ ),
+ );
+ expect(named).toContain('aria-label="Dismiss the notice"');
+ });
+
+ it("shows the caller's tooltip through the app's tooltip layer, never a native title", () => {
+ const html = renderStatic(createElement(CloseButton, { onClose: noop, title: "Close (Esc)" }));
+ expect(html).toContain('data-tooltip="Close (Esc)"');
+ expect(html).not.toContain("title=");
+ });
+
+ it("paints in tokens, on the control radius", () => {
+ const tokens = classTokens(renderStatic(createElement(CloseButton, { onClose: noop })));
+ expect(tokens).toEqual(
+ expect.arrayContaining([
+ "rounded-control",
+ "text-fg-subtle",
+ "hover:bg-surface-muted",
+ "hover:text-fg-muted",
+ ]),
+ );
+ });
+});
diff --git a/packages/web/test/copy-button.test.ts b/packages/ui/test/copy-button-write.test.ts
similarity index 71%
rename from packages/web/test/copy-button.test.ts
rename to packages/ui/test/copy-button-write.test.ts
index 60cc0c19..55e6807e 100644
--- a/packages/web/test/copy-button.test.ts
+++ b/packages/ui/test/copy-button-write.test.ts
@@ -1,20 +1,20 @@
/**
- * The copy button's feedback follows the WRITE: the check appears only once writeClipboard
- * reports the text reached the clipboard, and a refused write leaves the control idle. The
- * tooltip names the action throughout and never flips to the result. clipboard.test.ts pins the entry itself; this
- * pins the one place its answer is consumed, so dropping the `if (!ok) return;` guard in
- * useCopied (back to an unconditional check) fails here.
+ * The copy button's feedback follows the WRITE: the check appears only once the clipboard
+ * writer reports the text reached the clipboard, and a refused write leaves the control idle.
+ * The tooltip names the action throughout and never flips to the result. The app's writer is
+ * pinned by its own tests; this pins the one place its answer is consumed, so dropping the
+ * `if (!ok) return;` guard in useCopied (back to an unconditional check) fails here.
*
* vitest runs node-only here (`environment: "node"`, no jsdom), so nothing mounts the
* component: React's hooks are replaced by a minimal slot store — useState / useRef keep
* their value across calls in call order, useEffect is inert (it only arms the unmount
- * cleanup) — and CopyButton is called as a plain function, its button's onClick driven
- * directly and the button re-read on the next "render". Both directions are asserted, or a
- * button that never shows the check would pass too.
+ * cleanup), useContext hands over the writer under test — and CopyButton is called as a plain
+ * function, its button's onClick driven directly and the button re-read on the next "render".
+ * Both directions are asserted, or a button that never shows the check would pass too.
*/
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ReactElement, ReactNode } from "react";
-import { CopyButton } from "../src/components/ui/copy-button";
+import { CopyButton } from "../src/components/actions/copy-button/copy-button";
/** Hook slots in call order, the cursor rewound on each render, and every value `copied` was set to. */
const hooks = vi.hoisted(() => ({
@@ -23,6 +23,9 @@ const hooks = vi.hoisted(() => ({
copiedSets: [] as unknown[],
}));
+/** The writer's answer for the next write, handed to the button as its context value. */
+const write = vi.hoisted(() => vi.fn<(text: string) => Promise<boolean>>());
+
vi.mock("react", async (importOriginal) => {
const actual = await importOriginal<typeof import("react")>();
return {
@@ -42,14 +45,10 @@ vi.mock("react", async (importOriginal) => {
return hooks.slots[i];
},
useEffect: () => {},
+ useContext: () => write,
};
});
-/** The clipboard entry's answer for the next write (its own behaviour is clipboard.test.ts's). */
-const writeClipboard = vi.hoisted(() => vi.fn<(text: string) => Promise<boolean>>());
-
-vi.mock("../src/lib/clipboard", () => ({ writeClipboard }));
-
type Button = ReactElement<{
"data-tooltip": string;
onClick: () => void;
@@ -80,12 +79,12 @@ beforeEach(() => {
afterEach(() => {
vi.useRealTimers();
- writeClipboard.mockReset();
+ write.mockReset();
});
describe("CopyButton: the check follows the write", () => {
it("shows no check when the write is refused", async () => {
- writeClipboard.mockResolvedValue(false);
+ write.mockResolvedValue(false);
const idle = render();
expect(idle.props["data-tooltip"]).toBe(LABEL);
expect(idle.props.children.props.copied).toBe(false);
@@ -93,14 +92,14 @@ describe("CopyButton: the check follows the write", () => {
idle.props.onClick();
await settle();
- expect(writeClipboard).toHaveBeenCalledTimes(1);
- expect(writeClipboard.mock.calls[0]?.[0]).toBe("sess-42");
+ expect(write).toHaveBeenCalledTimes(1);
+ expect(write.mock.calls[0]?.[0]).toBe("sess-42");
expect(hooks.copiedSets).not.toContain(true);
expect(render().props.children.props.copied).toBe(false);
});
it("shows the check once the write landed, and clears it after the window", async () => {
- writeClipboard.mockResolvedValue(true);
+ write.mockResolvedValue(true);
render().props.onClick();
await settle();
diff --git a/packages/ui/test/copy-button.test.ts b/packages/ui/test/copy-button.test.ts
new file mode 100644
index 00000000..248282d1
--- /dev/null
+++ b/packages/ui/test/copy-button.test.ts
@@ -0,0 +1,79 @@
+/**
+ * CopyButton and its parts: a wordless button named and tooltipped by the action, whose only
+ * visible feedback is the glyph swap, and a live region beside it — not inside it — that
+ * announces the copy in the interface's words.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import {
+ CopiedStatus,
+ CopyButton,
+ CopyCheckGlyph,
+} from "../src/components/actions/copy-button/copy-button";
+import { ICONS } from "../src/components/icons/icons";
+import { UiStringsProvider } from "../src/strings";
+import { classTokens, renderStatic } from "../src/testing";
+
+const ZH = { close: "关闭", copied: "已复制", loading: "加载中…" };
+
+describe("CopyButton", () => {
+ it("names the action, shows no text, and keeps the live region as a sibling", () => {
+ const html = renderStatic(createElement(CopyButton, { text: "s-1", label: "Copy session id" }));
+ expect(html).toMatch(
+ /^<button type="button" data-tooltip="Copy session id" aria-label="Copy session id"/,
+ );
+ const button = html.slice(0, html.indexOf("</button>"));
+ expect(button).not.toContain("aria-live");
+ expect(button.replace(/<[^>]*>/g, "")).toBe("");
+ expect(html.slice(html.indexOf("</button>"))).toMatch(
+ /^<\/button><span class="sr-only" aria-live="polite" aria-atomic="true"><\/span>$/,
+ );
+ expect(html).toContain(`d="${ICONS.copy}"`);
+ });
+
+ it("paints in tokens, at the row size or the padded size, plus the caller's layout", () => {
+ const md = classTokens(renderStatic(createElement(CopyButton, { text: "x", label: "Copy" })));
+ expect(md).toEqual(
+ expect.arrayContaining([
+ "p-1",
+ "text-fg-subtle",
+ "hover:bg-surface-muted",
+ "hover:text-fg-muted",
+ ]),
+ );
+ const sm = classTokens(
+ renderStatic(
+ createElement(CopyButton, { text: "x", label: "Copy", size: "sm", className: "shrink-0" }),
+ ),
+ );
+ expect(sm).toEqual(expect.arrayContaining(["size-5", "shrink-0", "text-fg-subtle"]));
+ expect(sm).not.toContain("p-1");
+ });
+});
+
+describe("the copy feedback", () => {
+ it("swaps only the glyph", () => {
+ expect(renderStatic(createElement(CopyCheckGlyph, { copied: false }))).toContain(
+ `d="${ICONS.copy}"`,
+ );
+ expect(renderStatic(createElement(CopyCheckGlyph, { copied: true }))).toContain(
+ `d="${ICONS.check}"`,
+ );
+ });
+
+ it("announces in the interface's words, or the caller's, once copied", () => {
+ expect(renderStatic(createElement(CopiedStatus, { copied: false }))).not.toContain("Copied");
+ expect(renderStatic(createElement(CopiedStatus, { copied: true }))).toContain(">Copied<");
+ const injected = renderStatic(
+ createElement(
+ UiStringsProvider,
+ { strings: ZH },
+ createElement(CopiedStatus, { copied: true }),
+ ),
+ );
+ expect(injected).toContain(">已复制<");
+ expect(
+ renderStatic(createElement(CopiedStatus, { copied: true, announcement: "Path copied" })),
+ ).toContain(">Path copied<");
+ });
+});
diff --git a/packages/ui/test/dot.test.ts b/packages/ui/test/dot.test.ts
new file mode 100644
index 00000000..d104ff2c
--- /dev/null
+++ b/packages/ui/test/dot.test.ts
@@ -0,0 +1,49 @@
+/**
+ * Dot: a tone's solid fill at a fixed pixel size, decorative unless it names itself, and live
+ * only through the hook a theme re-times.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { Dot } from "../src/components/icons/dot/dot";
+import { TONES } from "../src/tokens";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("Dot", () => {
+ it("fills with the tone's emphasis, round in every theme", () => {
+ for (const tone of TONES) {
+ const tokens = classTokens(renderStatic(createElement(Dot, { tone })));
+ expect(tokens).toContain(`bg-tone-${tone}-emphasis`);
+ expect(tokens).toContain("rounded-full");
+ }
+ });
+
+ it("sizes in pixels on three rungs, the 6px state dot by default", () => {
+ expect(renderStatic(createElement(Dot, { tone: "success" }))).toContain("width:6px;height:6px");
+ expect(renderStatic(createElement(Dot, { tone: "success", size: "sm" }))).toContain(
+ "width:8px;height:8px",
+ );
+ expect(renderStatic(createElement(Dot, { tone: "success", size: "md" }))).toContain(
+ "width:10px;height:10px",
+ );
+ });
+
+ it("is decoration beside a label, and an image when it names itself", () => {
+ const quiet = renderStatic(createElement(Dot, { tone: "danger" }));
+ expect(quiet).toContain('aria-hidden="true"');
+ expect(quiet).not.toContain("role=");
+ const named = renderStatic(createElement(Dot, { tone: "danger", label: "Offline" }));
+ expect(named).toContain('role="img"');
+ expect(named).toContain('aria-label="Offline"');
+ expect(named).not.toContain("aria-hidden");
+ });
+
+ it("pulses only when asked, through the live hook", () => {
+ const still = renderStatic(createElement(Dot, { tone: "success" }));
+ expect(still).not.toContain("ui-live");
+ expect(still).not.toContain("animate-pulse");
+ expect(still).not.toContain("data-live");
+ const live = renderStatic(createElement(Dot, { tone: "success", pulse: true }));
+ expect(classTokens(live)).toEqual(expect.arrayContaining(["ui-live", "animate-pulse"]));
+ expect(live).toContain('data-live="dot"');
+ });
+});
diff --git a/packages/ui/test/empty-state.test.ts b/packages/ui/test/empty-state.test.ts
new file mode 100644
index 00000000..c55b537f
--- /dev/null
+++ b/packages/ui/test/empty-state.test.ts
@@ -0,0 +1,55 @@
+/**
+ * The empty state: the caller's words in the muted inks, an optional action, and the dashed slot
+ * form that SettingsEmpty is.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { EmptyState, SettingsEmpty } from "../src/components/feedback/empty-state/empty-state";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("EmptyState", () => {
+ it("shows the caller's title and description in the muted ink, and no frame", () => {
+ const html = renderStatic(
+ createElement(EmptyState, { title: "No sessions yet", description: "Send a message." }),
+ );
+ expect(html).toContain(">No sessions yet</p>");
+ expect(html).toContain(">Send a message.</p>");
+ const tokens = classTokens(html);
+ expect(tokens).toContain("text-fg-muted");
+ expect(tokens).not.toContain("border-dashed");
+ expect(html).not.toMatch(/gray-|dark:/);
+ });
+
+ it("renders the action only when given one", () => {
+ expect(renderStatic(createElement(EmptyState, { title: "Empty" }))).not.toContain("mt-2");
+ const html = renderStatic(
+ createElement(EmptyState, {
+ title: "Empty",
+ action: createElement("button", { type: "button" }, "Create"),
+ }),
+ );
+ expect(html).toContain('<button type="button">Create</button>');
+ });
+
+ it("draws the slot form in a dashed frame, its message on the small subtle rung", () => {
+ const html = renderStatic(createElement(EmptyState, { title: "Nothing here", dashed: true }));
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining([
+ "border",
+ "border-dashed",
+ "border-line",
+ "min-h-24",
+ "text-xs",
+ "text-fg-subtle",
+ ]),
+ );
+ });
+});
+
+describe("SettingsEmpty", () => {
+ it("is the dashed slot form holding its one sentence", () => {
+ expect(renderStatic(createElement(SettingsEmpty, { children: "No servers yet." }))).toBe(
+ renderStatic(createElement(EmptyState, { title: "No servers yet.", dashed: true })),
+ );
+ });
+});
diff --git a/packages/ui/test/glyph-icon.test.ts b/packages/ui/test/glyph-icon.test.ts
new file mode 100644
index 00000000..a89a65e5
--- /dev/null
+++ b/packages/ui/test/glyph-icon.test.ts
@@ -0,0 +1,60 @@
+/**
+ * GlyphIcon: the stroke comes from the theme's token, the icon is hidden from assistive
+ * technology, and `decor` writes the decorative-icon hook with its role — and only then.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { GlyphIcon } from "../src/components/icons/glyph-icon/glyph-icon";
+import { ICONS } from "../src/components/icons/icons";
+import { ICON_SIZE } from "../src/icon-scale";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("GlyphIcon", () => {
+ it("strokes the path at the theme's weight, sized by the inline rung by default", () => {
+ const html = renderStatic(createElement(GlyphIcon, { d: ICONS.gear }));
+ expect(html).toContain("stroke-width:var(--ui-icon-stroke, 1.7)");
+ expect(html).not.toMatch(/stroke-width="/);
+ expect(html).toContain(`width="${ICON_SIZE.inlineGlyph}"`);
+ expect(html).toContain('aria-hidden="true"');
+ expect(html).toContain(`d="${ICONS.gear}"`);
+ expect(html).toContain('fill="none"');
+ });
+
+ it("fills the path for a mark whose on state is solid", () => {
+ expect(renderStatic(createElement(GlyphIcon, { d: ICONS.pin, filled: true }))).toContain(
+ 'fill="currentColor"',
+ );
+ });
+
+ it("carries the decorative-icon hook and its role only when the call site says so", () => {
+ const plain = renderStatic(createElement(GlyphIcon, { d: ICONS.folder }));
+ expect(classTokens(plain)).not.toContain("ui-icon-decor");
+ expect(plain).not.toContain("data-role");
+
+ const nav = renderStatic(createElement(GlyphIcon, { d: ICONS.folder, decor: "nav" }));
+ expect(classTokens(nav)).toContain("ui-icon-decor");
+ expect(nav).toContain('data-role="nav"');
+ });
+});
+
+describe("ICONS", () => {
+ it("holds 24x24 path data under names that describe the drawing", () => {
+ for (const [name, d] of Object.entries(ICONS)) {
+ expect(d, name).toMatch(/^[Mm][\d\s.,eE+\-MmZzLlHhVvCcSsQqTtAa]*$/);
+ expect(name, "a key names the drawing in camelCase").toMatch(/^[a-z][A-Za-z]*$/);
+ }
+ });
+
+ it("draws each glyph once: no two names share a path", () => {
+ const byPath = new Map<string, string[]>();
+ for (const [name, d] of Object.entries(ICONS)) {
+ byPath.set(d, [...(byPath.get(d) ?? []), name]);
+ }
+ expect([...byPath.values()].filter((names) => names.length > 1)).toEqual([]);
+ });
+
+ it("builds the open and the struck-through eye from one outline", () => {
+ const outline = ICONS.eyeOff.replace("M3 3l18 18", "");
+ expect(ICONS.eye.startsWith(outline)).toBe(true);
+ });
+});
diff --git a/packages/ui/test/hooks.test.ts b/packages/ui/test/hooks.test.ts
index 0be907a9..ee3def18 100644
--- a/packages/ui/test/hooks.test.ts
+++ b/packages/ui/test/hooks.test.ts
@@ -72,12 +72,13 @@ const APPENDIX_A = [
*
* Glass is for the layers that float over the page (the composer card, dialogs, menus, popovers,
* tooltips); the eyebrow and display rungs for the sidebar's list label and the page titles; live
- * marks for the spinner and the machines page's working marks; frames for the transcript's cards;
- * the shell for the app layout; a decorative icon for the rows and headers whose label already
- * says what the icon says (sidebar rows and group headers, the settings rail, a menu row's glyph,
- * a tab, an empty state) — a session row is not a host, its avatar and marks carry information;
- * a tree for a file tree and a work group's steps; a field for a settings row; activity for the
- * transcript's work in progress (the work group's header, a tool call, the thinking row).
+ * marks for the spinner, a pulsing state dot and the machines page's working marks; frames for
+ * the transcript's cards; the shell for the app layout; a decorative icon for the rows and headers
+ * whose label already says what the icon says (sidebar rows and group headers, the settings rail,
+ * a menu row's glyph, a tab, an empty state) — a session row is not a host, its avatar and marks
+ * carry information; a tree for a file tree and a work group's steps; a field for a settings row;
+ * activity for the transcript's work in progress (the work group's header, a tool call, the
+ * thinking row).
*/
const HOSTS: Readonly<Record<string, readonly string[]>> = {
"ui-glass": [
@@ -103,7 +104,7 @@ const HOSTS: Readonly<Record<string, readonly string[]>> = {
"MachinesPage",
"DraftView",
],
- "ui-live": ["Spinner", "Stepper", "MachineCard"],
+ "ui-live": ["Spinner", "Dot", "Stepper", "MachineCard"],
"ui-frame": ["ToolCallCard", "WorkGroup", "CodeBlock"],
"ui-underline-nav": ["Tabs"],
"ui-shell": ["AppLayout"],
diff --git a/packages/ui/test/kbd.test.ts b/packages/ui/test/kbd.test.ts
new file mode 100644
index 00000000..5346d179
--- /dev/null
+++ b/packages/ui/test/kbd.test.ts
@@ -0,0 +1,39 @@
+/**
+ * Kbd: a shortcut as HTML's key-combination markup, one key cap per key, in tokens.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { Kbd } from "../src/components/actions/kbd/kbd";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("Kbd", () => {
+ it("nests one key cap per key, in order, inside the combination", () => {
+ const html = renderStatic(createElement(Kbd, { keys: ["Ctrl", "`"] }));
+ expect(html).toMatch(
+ /^<kbd class="[^"]*"><kbd class="[^"]*">Ctrl<\/kbd><kbd class="[^"]*">`<\/kbd><\/kbd>$/,
+ );
+ });
+
+ it("draws the caps in tokens, in the mono face at the small rung", () => {
+ const tokens = classTokens(renderStatic(createElement(Kbd, { keys: ["Esc"] })));
+ expect(tokens).toEqual(
+ expect.arrayContaining([
+ "font-mono",
+ "text-xs",
+ "bg-surface-inset",
+ "border-line",
+ "rounded-sm",
+ ]),
+ );
+ });
+
+ it("draws the plain look as mono text joined by +, with no cap chrome", () => {
+ const html = renderStatic(createElement(Kbd, { keys: ["Ctrl", "W"], variant: "plain" }));
+ expect(html).toMatch(
+ /^<kbd class="[^"]*"><kbd>Ctrl<\/kbd><span aria-hidden="true">\+<\/span><kbd>W<\/kbd><\/kbd>$/,
+ );
+ const tokens = classTokens(html);
+ expect(tokens).toEqual(expect.arrayContaining(["font-mono", "text-xs"]));
+ expect(tokens).not.toContain("border-line");
+ });
+});
diff --git a/packages/ui/test/link.test.ts b/packages/ui/test/link.test.ts
new file mode 100644
index 00000000..45a6f6df
--- /dev/null
+++ b/packages/ui/test/link.test.ts
@@ -0,0 +1,53 @@
+/**
+ * Link: the theme's link colour, underlined in a sentence and on hover when it stands alone, and
+ * an external link that opens isolated in a new tab behind the external-link glyph.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { Link } from "../src/components/actions/link/link";
+import { ICONS } from "../src/components/icons/icons";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("Link", () => {
+ it("stays in the tab by default, underlined in running text", () => {
+ const html = renderStatic(createElement(Link, { href: "/docs" }, "the docs"));
+ expect(html).toMatch(/^<a href="\/docs" class="/);
+ expect(html).not.toContain("target=");
+ expect(html).not.toContain("<svg");
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["text-link", "hover:text-link-hover", "underline"]),
+ );
+ });
+
+ it("underlines a standalone link on hover only", () => {
+ const tokens = classTokens(
+ renderStatic(createElement(Link, { href: "/docs", variant: "standalone" }, "Docs")),
+ );
+ expect(tokens).toContain("hover:underline");
+ expect(tokens).not.toContain("underline");
+ });
+
+ it("opens an external link isolated in a new tab, after the text and a decorative glyph", () => {
+ for (const variant of ["inline", "standalone"] as const) {
+ const html = renderStatic(
+ createElement(Link, { href: "https://example.com", external: true, variant }, "Releases"),
+ );
+ expect(html).toContain('target="_blank" rel="noopener noreferrer"');
+ expect(html).toContain(`d="${ICONS.externalLink}"`);
+ expect(html).toContain('aria-hidden="true"');
+ expect(html.indexOf("Releases")).toBeLessThan(html.indexOf("<svg"));
+ }
+ });
+
+ it("passes the caller's anchor props and layout classes through", () => {
+ const html = renderStatic(
+ createElement(
+ Link,
+ { href: "/keys", "aria-label": "Manage keys for Acme", className: "shrink-0 text-xs" },
+ "Manage keys",
+ ),
+ );
+ expect(html).toContain('aria-label="Manage keys for Acme"');
+ expect(classTokens(html)).toEqual(expect.arrayContaining(["shrink-0", "text-xs"]));
+ });
+});
diff --git a/packages/ui/test/logos.test.ts b/packages/ui/test/logos.test.ts
new file mode 100644
index 00000000..107c40dc
--- /dev/null
+++ b/packages/ui/test/logos.test.ts
@@ -0,0 +1,35 @@
+/**
+ * The logos: a preset provider draws its brand mark in currentColor, an unknown group id a letter
+ * tile inked through one scheme-following value, and the penguin emblem the asset its caller names.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { avatarTile } from "../src/components/icons/avatars/avatar";
+import { PenguinLogo } from "../src/components/icons/logos/penguin-logo";
+import { ProviderLogo } from "../src/components/icons/logos/provider-logo";
+import { renderStatic } from "../src/testing";
+
+describe("ProviderLogo", () => {
+ it("draws a preset vendor's mark in currentColor", () => {
+ const html = renderStatic(createElement(ProviderLogo, { provider: "anthropic" }));
+ expect(html).toContain('fill="currentColor"');
+ expect(html).toContain('aria-hidden="true"');
+ expect(html).not.toContain("<text");
+ });
+
+ it("draws a user-defined group as a letter tile, with no dark-mode class", () => {
+ const html = renderStatic(createElement(ProviderLogo, { provider: "team-proxy" }));
+ expect(html).toContain(">T</text>");
+ expect(html).toContain(`fill:${avatarTile("team-proxy").ink}`);
+ expect(html).not.toContain("dark:");
+ });
+});
+
+describe("PenguinLogo", () => {
+ it("shows the asset the app names, decoratively", () => {
+ const html = renderStatic(createElement(PenguinLogo, { src: "/penguin-logo.svg" }));
+ expect(html).toContain('src="/penguin-logo.svg"');
+ expect(html).toContain('alt=""');
+ expect(html).toContain('aria-hidden="true"');
+ });
+});
diff --git a/packages/ui/test/marks.test.ts b/packages/ui/test/marks.test.ts
new file mode 100644
index 00000000..397bf0bb
--- /dev/null
+++ b/packages/ui/test/marks.test.ts
@@ -0,0 +1,54 @@
+/**
+ * The fixed-grid marks (src/components/icons/marks/marks.tsx): the caret and the close cross keep
+ * the small grids their two strokes were drawn on, and every mark is decorative.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import {
+ CheckIcon,
+ ChevronDown,
+ CloseIcon,
+ DownloadIcon,
+ PlusIcon,
+ UploadIcon,
+} from "../src/components/icons/marks/marks";
+import { Chevron } from "../src/components/icons/chevron/chevron";
+import { renderStatic } from "../src/testing";
+
+describe("marks", () => {
+ it("draw the caret on a 12x12 grid and the close cross on 14x14, at 1.5", () => {
+ const caret = renderStatic(createElement(ChevronDown));
+ expect(caret).toContain('viewBox="0 0 12 12"');
+ expect(caret).toContain('stroke-width="1.5"');
+ const cross = renderStatic(createElement(CloseIcon));
+ expect(cross).toContain('viewBox="0 0 14 14"');
+ expect(cross).toContain('stroke-width="1.5"');
+ });
+
+ it("draw the rest on the 24x24 line grid, hidden from assistive technology", () => {
+ const marks = [
+ createElement(CheckIcon),
+ createElement(PlusIcon),
+ createElement(DownloadIcon),
+ createElement(UploadIcon),
+ ];
+ for (const mark of marks) {
+ const html = renderStatic(mark);
+ expect(html).toContain('viewBox="0 0 24 24"');
+ expect(html).toContain('aria-hidden="true"');
+ }
+ });
+
+ it("let the plus take a lighter or heavier stroke", () => {
+ expect(renderStatic(createElement(PlusIcon, { strokeWidth: 2 }))).toContain('stroke-width="2"');
+ });
+});
+
+describe("Chevron", () => {
+ it("points down when open and rotates only by its transform", () => {
+ expect(renderStatic(createElement(Chevron, { open: true }))).toContain("rotate-90");
+ const closed = renderStatic(createElement(Chevron, { open: false }));
+ expect(closed).not.toContain("rotate-90");
+ expect(closed).toContain("transition-transform");
+ });
+});
diff --git a/packages/ui/test/skeleton.test.ts b/packages/ui/test/skeleton.test.ts
new file mode 100644
index 00000000..4ade8e1a
--- /dev/null
+++ b/packages/ui/test/skeleton.test.ts
@@ -0,0 +1,55 @@
+/**
+ * The loading placeholders: hidden pulsing blocks on the line fill, a list of row-height blocks,
+ * and a card in the real card's border and surface whose padding the caller may replace.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { Skeleton, SkeletonCard, SkeletonList } from "../src/components/feedback/skeleton/skeleton";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("Skeleton", () => {
+ it("is a hidden pulsing block on the line fill, a text line by default", () => {
+ const html = renderStatic(createElement(Skeleton));
+ expect(html).toContain('aria-hidden="true"');
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["animate-pulse", "bg-line", "rounded-sm", "h-4", "w-full"]),
+ );
+ expect(html).not.toMatch(/gray-|dark:/);
+ });
+
+ it("takes the caller's size in place of the default line", () => {
+ const tokens = classTokens(renderStatic(createElement(Skeleton, { className: "h-6 w-28" })));
+ expect(tokens).toEqual(expect.arrayContaining(["h-6", "w-28"]));
+ expect(tokens).not.toContain("h-4");
+ });
+});
+
+describe("SkeletonList", () => {
+ it("draws the requested number of row-height blocks, three by default", () => {
+ const blocks = (html: string) => html.match(/animate-pulse/g)?.length ?? 0;
+ expect(blocks(renderStatic(createElement(SkeletonList)))).toBe(3);
+ expect(blocks(renderStatic(createElement(SkeletonList, { rows: 5 })))).toBe(5);
+ expect(classTokens(renderStatic(createElement(SkeletonList)))).toContain("h-8");
+ });
+});
+
+describe("SkeletonCard", () => {
+ it("stands in the real card's border and surface, with a three-line default body", () => {
+ const html = renderStatic(createElement(SkeletonCard));
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["rounded-md", "border", "border-line", "bg-surface", "p-4"]),
+ );
+ expect(html.match(/animate-pulse/g)).toHaveLength(3);
+ });
+
+ it("lets the caller's class replace the padding outright, and its children the body", () => {
+ const html = renderStatic(
+ createElement(SkeletonCard, { className: "p-6" }, createElement("span", null, "custom")),
+ );
+ const tokens = classTokens(html);
+ expect(tokens).toContain("p-6");
+ expect(tokens).not.toContain("p-4");
+ expect(html).toContain("<span>custom</span>");
+ expect(html).not.toContain("animate-pulse");
+ });
+});
diff --git a/packages/ui/test/status-icon.test.ts b/packages/ui/test/status-icon.test.ts
new file mode 100644
index 00000000..2933403a
--- /dev/null
+++ b/packages/ui/test/status-icon.test.ts
@@ -0,0 +1,70 @@
+/**
+ * StatusIcon: the one spinner while a run is live, a registry glyph once it waits or settles, on
+ * the spinner's three rungs, in token inks, named only when the caller names it.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { ICONS } from "../src/components/icons/icons";
+import { StatusIcon } from "../src/components/icons/status-icon/status-icon";
+import type { RunState } from "../src/components/icons/status-icon/status-icon";
+import { classTokens, renderStatic } from "../src/testing";
+
+const render = (props: Parameters<typeof StatusIcon>[0]) =>
+ renderStatic(createElement(StatusIcon, props));
+
+describe("StatusIcon", () => {
+ it("renders the Spinner while running, in the busy ink, never a hand-drawn ring", () => {
+ const html = render({ state: "running", label: "Running" });
+ expect(html).toContain('data-live="spinner"');
+ expect(html).toContain('role="status"');
+ expect(html).toContain('aria-label="Running"');
+ expect(html).toContain('data-tooltip="Running"');
+ expect(classTokens(html)).toContain("text-tone-success-fg");
+ expect(html).not.toContain("border-t-transparent");
+ });
+
+ it("hides an unnamed spinner with its wrapper", () => {
+ const html = render({ state: "running" });
+ expect(html).toMatch(/^<span aria-hidden="true"/);
+ expect(html).not.toContain("data-tooltip");
+ });
+
+ it("draws each settled state from the registry", () => {
+ const glyphs: Record<Exclude<RunState, "running">, string> = {
+ waiting: ICONS.hourglass,
+ done: ICONS.checkCircle,
+ failed: ICONS.xCircle,
+ stopped: ICONS.stopCircle,
+ };
+ for (const [state, d] of Object.entries(glyphs)) {
+ expect(render({ state: state as RunState })).toContain(`d="${d}"`);
+ }
+ });
+
+ it("inks a wait as attention and a failure as danger, and lets done and stopped recede", () => {
+ expect(classTokens(render({ state: "waiting" }))).toContain("text-tone-attention-fg");
+ expect(classTokens(render({ state: "failed" }))).toContain("text-tone-danger-fg");
+ for (const state of ["done", "stopped"] as const) {
+ const tokens = classTokens(render({ state }));
+ expect(tokens).toContain("text-fg-subtle");
+ expect(tokens.some((t) => t.startsWith("text-tone-"))).toBe(false);
+ }
+ });
+
+ it("takes the spinner's rungs, md by default, so a row keeps its box as the run settles", () => {
+ expect(render({ state: "done" })).toContain('width="14"');
+ expect(render({ state: "done", size: "sm" })).toContain('width="12"');
+ expect(render({ state: "done", size: "xs" })).toContain('width="10"');
+ expect(render({ state: "running", size: "xs" })).toContain('width="10"');
+ });
+
+ it("names a settled glyph as an image only when labelled", () => {
+ const named = render({ state: "failed", label: "Failed" });
+ expect(named).toContain('role="img"');
+ expect(named).toContain('aria-label="Failed"');
+ expect(named).toContain('data-tooltip="Failed"');
+ const quiet = render({ state: "failed" });
+ expect(quiet).toContain('aria-hidden="true"');
+ expect(quiet).not.toContain("role=");
+ });
+});
diff --git a/packages/ui/test/strings.test.ts b/packages/ui/test/strings.test.ts
new file mode 100644
index 00000000..942e1e90
--- /dev/null
+++ b/packages/ui/test/strings.test.ts
@@ -0,0 +1,44 @@
+/**
+ * The package's own words (src/strings.ts): English fallbacks when no provider is mounted, the
+ * app's words once it injects them, and nothing but accessibility strings in the interface.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import { DEFAULT_UI_STRINGS, UiStringsProvider, useUiStrings } from "../src/strings";
+import type { UiStrings } from "../src/strings";
+import { renderStatic } from "../src/testing";
+
+/** Renders every key the hook returns, so a test reads what a component would announce. */
+function Probe() {
+ const strings = useUiStrings();
+ return createElement(
+ "dl",
+ null,
+ Object.entries(strings).map(([key, value]) =>
+ createElement("div", { key }, `${key}=${String(value)}`),
+ ),
+ );
+}
+
+describe("UiStrings", () => {
+ it("holds the accessibility fallbacks, in English", () => {
+ expect(Object.keys(DEFAULT_UI_STRINGS).sort()).toEqual(["close", "copied", "loading"]);
+ expect(DEFAULT_UI_STRINGS).toEqual({ close: "Close", copied: "Copied", loading: "Loading…" });
+ });
+
+ it("falls back to the defaults when no provider is mounted", () => {
+ const html = renderStatic(createElement(Probe));
+ expect(html).toContain("close=Close");
+ expect(html).toContain("loading=Loading…");
+ });
+
+ it("reads the nearest provider's words", () => {
+ const zh: UiStrings = { close: "关闭", copied: "已复制", loading: "加载中…" };
+ const html = renderStatic(
+ createElement(UiStringsProvider, { strings: zh }, createElement(Probe)),
+ );
+ expect(html).toContain("close=关闭");
+ expect(html).toContain("copied=已复制");
+ expect(html).not.toContain("Close");
+ });
+});
diff --git a/packages/ui/test/token-contract.test.ts b/packages/ui/test/token-contract.test.ts
index cae77654..942f40ce 100644
--- a/packages/ui/test/token-contract.test.ts
+++ b/packages/ui/test/token-contract.test.ts
@@ -337,8 +337,8 @@ describe("the theme-identities revision of the contract (2026-09-19)", () => {
// 215, plus the integration round's four (the emphasis ink and the switch's three), plus
// the chart round's nine (two more series, the reference line, six geometry names), plus
// the bar outline's three, plus the knob's hairline edge, plus the streaming pair
- // (2026-09-30).
- expect(TOKEN_NAMES.length).toBe(234);
+ // (2026-09-30), plus the update mark's fill (W1, the same day).
+ expect(TOKEN_NAMES.length).toBe(235);
});
it("adds the structure group behind the tree and field hooks (round 2)", () => {
@@ -579,6 +579,36 @@ describe("the integration revision of the contract (2026-09-29)", () => {
});
});
+describe("the update mark (W1, 2026-09-30)", () => {
+ // The update dot says "something new down this path", which is not a tone's judgement, so it
+ // has a colour of its own. It never carries the meaning alone — its anchor names what is new —
+ // so no contrast floor applies: every theme and mode declares a value, and that is the check.
+ it("is a group of its own, bridged to bg-mark-new", () => {
+ expect(TOKEN_GROUPS.find((group) => group.id === "color-marks")?.names).toEqual([
+ "--ui-mark-new",
+ ]);
+ const sheet = stripCssComments(readFileSync(join(SRC_DIR, "theme.css"), "utf8"));
+ expect(sheet).toMatch(/@theme inline\s*\{[^}]*--color-mark-new:\s*var\(--ui-mark-new\);/);
+ });
+
+ it("is declared by every theme in both modes", () => {
+ for (const theme of THEMES) {
+ if (theme.status !== "filled") continue;
+ for (const mode of THEME_MODES) {
+ const value = modeDeclarations(theme.analysis, mode).get("--ui-mark-new");
+ expect(value, `${theme.id} ${mode}`).toBeTruthy();
+ }
+ }
+ });
+
+ it("keeps Primer's pale notification red, one value in both modes", () => {
+ const primer = THEMES.find((theme) => theme.id === DEFAULT_THEME_ID);
+ if (primer === undefined || primer.status !== "filled") throw new Error("Primer is filled");
+ expect(primer.analysis.modes.light.get("--ui-mark-new")).toBe("oklch(70.4% 0.191 22.216)");
+ expect(primer.analysis.modes.dark.has("--ui-mark-new")).toBe(false);
+ });
+});
+
describe("the chart style tokens (round 7)", () => {
// A chart draws with tokens the app reads once per theme: the palette in fixed roles, a
// reference line, and the geometry. Primer's are today's charts; a curve is one of the three
diff --git a/packages/ui/test/update-dot.test.ts b/packages/ui/test/update-dot.test.ts
new file mode 100644
index 00000000..8e37968b
--- /dev/null
+++ b/packages/ui/test/update-dot.test.ts
@@ -0,0 +1,63 @@
+/**
+ * The update mark: a decorative dot in the theme's news colour (not a tone), ringed in the
+ * sidebar's fill on a chrome anchor, and the labelled pill that shares the badges' capsule.
+ */
+import { createElement } from "react";
+import { describe, expect, it } from "vitest";
+import {
+ UPDATE_DOT_INLINE,
+ UpdateDot,
+ UpdatePill,
+} from "../src/components/icons/update-dot/update-dot";
+import { classTokens, renderStatic } from "../src/testing";
+
+describe("UpdateDot", () => {
+ it("is hidden decoration in the news colour, out of its anchor's layout and hit area", () => {
+ const html = renderStatic(createElement(UpdateDot));
+ expect(html).toContain('aria-hidden="true"');
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining(["absolute", "pointer-events-none", "rounded-full", "bg-mark-new"]),
+ );
+ expect(html).not.toMatch(/tone-/);
+ });
+
+ it("rings a chrome anchor's dot in the sidebar's fill, and leaves an inline dot bare", () => {
+ const chrome = classTokens(renderStatic(createElement(UpdateDot)));
+ expect(chrome).toEqual(expect.arrayContaining(["border-2", "border-surface-muted"]));
+ const inline = classTokens(renderStatic(createElement(UpdateDot, { size: "inline" })));
+ expect(inline).not.toContain("border-2");
+ expect(inline).toEqual(expect.arrayContaining(["h-1.5", "w-1.5"]));
+ });
+
+ it("takes the caller's placement, the corner overhang by default", () => {
+ expect(renderStatic(createElement(UpdateDot))).toContain("-right-0.5 -top-0.5");
+ expect(
+ renderStatic(createElement(UpdateDot, { position: "right-2.5 top-1/2 -translate-y-1/2" })),
+ ).toContain("right-2.5 top-1/2 -translate-y-1/2");
+ });
+
+ it("exports the in-flow fill with the same colour", () => {
+ expect(UPDATE_DOT_INLINE.split(" ")).toEqual(
+ expect.arrayContaining(["rounded-full", "bg-mark-new", "h-1.5", "w-1.5"]),
+ );
+ });
+});
+
+describe("UpdatePill", () => {
+ it("is a real button in the danger tint and ink, on the small rung and the pill radius", () => {
+ const html = renderStatic(
+ createElement(UpdatePill, { onClick: () => undefined, children: "Update available" }),
+ );
+ expect(html).toMatch(/^<button type="button"/);
+ expect(html).toContain(">Update available</button>");
+ expect(classTokens(html)).toEqual(
+ expect.arrayContaining([
+ "bg-tone-danger-bg",
+ "text-tone-danger-fg",
+ "text-xs",
+ "rounded-[var(--ui-radius-pill)]",
+ ]),
+ );
+ expect(html).not.toContain("text-[11px]");
+ });
+});
diff --git a/packages/web/src/app.tsx b/packages/web/src/app.tsx
index a529494b..0a08000a 100644
--- a/packages/web/src/app.tsx
+++ b/packages/web/src/app.tsx
@@ -1,5 +1,6 @@
/**
- * App root component: Locale -> Theme -> Auth -> LocaleScope -> Router provider composition.
+ * App root component: Locale -> Theme -> Auth -> LocaleScope -> Router provider composition,
+ * with the app's clipboard writer handed to the shared UI package's copy controls.
* LocaleScope (a remount boundary) sits inside AuthProvider: switching language rebuilds the UI tree without
* re-fetching auth, avoiding a full-screen white flash from RequireAuth briefly seeing user=undefined.
* Also installs the app-wide file-drop guard: a file dropped outside the chat area — the only
@@ -9,12 +10,14 @@
* drop on the sidebar do something; it makes it do nothing.
*/
import { useEffect } from "react";
+import { ClipboardWriterProvider } from "@prismshadow/penguin-ui";
import { LocaleProvider, LocaleScope } from "./state/locale";
import { ThemeProvider } from "./state/theme";
import { AuthProvider } from "./state/auth";
import { AppRouter } from "./router";
import { Toaster } from "./components/ui/toast";
import { TooltipLayer } from "./components/ui/tooltip";
+import { writeClipboard } from "./lib/clipboard";
import { guardWindowDragOver, guardWindowDrop } from "./lib/file-drop";
/**
@@ -35,18 +38,20 @@ export function App({ initialPath }: { initialPath?: string } = {}) {
};
}, []);
return (
- <LocaleProvider>
- <ThemeProvider>
- <AuthProvider>
- <LocaleScope>
- <AppRouter {...(initialPath === undefined ? {} : { initialPath })} />
- {/* Top toast overlay: portaled to body, z-index above modals, shared site-wide. */}
- <Toaster />
- {/* The hover hints of every `data-tooltip` element: one listener set, one panel. */}
- <TooltipLayer />
- </LocaleScope>
- </AuthProvider>
- </ThemeProvider>
- </LocaleProvider>
+ <ClipboardWriterProvider write={writeClipboard}>
+ <LocaleProvider>
+ <ThemeProvider>
+ <AuthProvider>
+ <LocaleScope>
+ <AppRouter {...(initialPath === undefined ? {} : { initialPath })} />
+ {/* Top toast overlay: portaled to body, z-index above modals, shared site-wide. */}
+ <Toaster />
+ {/* The hover hints of every `data-tooltip` element: one listener set, one panel. */}
+ <TooltipLayer />
+ </LocaleScope>
+ </AuthProvider>
+ </ThemeProvider>
+ </LocaleProvider>
+ </ClipboardWriterProvider>
);
}
diff --git a/packages/web/src/components/account/change-password-dialog.tsx b/packages/web/src/components/account/change-password-dialog.tsx
index 1f9373c4..54fab13a 100644
--- a/packages/web/src/components/account/change-password-dialog.tsx
+++ b/packages/web/src/components/account/change-password-dialog.tsx
@@ -4,13 +4,13 @@
* notice banner disappears once passwordIsInitial clears. Shared by the sidebar user menu and the notice banner.
*/
import { useEffect, useState } from "react";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useAuth } from "../../state/auth";
import { omitsOldPassword } from "../../lib/account-menu";
-import { Button } from "../ui/button";
import { PasswordInput } from "../ui/password-input";
import { Modal } from "../ui/modal";
diff --git a/packages/web/src/components/account/update-modal.tsx b/packages/web/src/components/account/update-modal.tsx
index cbb22666..8ad4cf0b 100644
--- a/packages/web/src/components/account/update-modal.tsx
+++ b/packages/web/src/components/account/update-modal.tsx
@@ -14,6 +14,7 @@
* The flow and the actions live in `use-update-flow.ts`; this file only renders.
*/
import type { ReactNode } from "react";
+import { Button, Link } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { stripAnsi } from "../../lib/strip-ansi";
import { toneInk } from "../../lib/tone";
@@ -26,7 +27,6 @@ import {
useUpdateFlow,
useUpdateFlowOwner,
} from "../../lib/use-update-flow";
-import { Button } from "../ui/button";
import { Modal } from "../ui/modal";
const RELEASES_URL = "https://github.com/Prism-Shadow/penguin-harness/releases";
@@ -249,14 +249,9 @@ function Line({ spinner, children }: { spinner?: boolean; children: ReactNode })
function ReleasesLink({ href, children }: { href: string; children: ReactNode }) {
return (
<p>
- <a
- href={href}
- target="_blank"
- rel="noopener noreferrer"
- className="text-sm text-brand-600 underline-offset-2 hover:underline dark:text-brand-300"
- >
+ <Link href={href} external variant="standalone" className="text-sm">
{children}
- </a>
+ </Link>
</p>
);
}
diff --git a/packages/web/src/components/layout/app-layout.tsx b/packages/web/src/components/layout/app-layout.tsx
index 9443551d..a4aac07f 100644
--- a/packages/web/src/components/layout/app-layout.tsx
+++ b/packages/web/src/components/layout/app-layout.tsx
@@ -6,6 +6,7 @@
*/
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { NavLink, Outlet, useLocation, useMatch, useNavigate } from "react-router";
+import { CloseIcon, GlyphIcon, ICONS, UpdateDot, UserAvatar } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { nagsAboutInitialPassword } from "../../lib/account-menu";
import { S } from "../../lib/strings";
@@ -19,11 +20,8 @@ import { useSessions } from "../../state/sessions";
import { useCompletionNotifications } from "../../state/use-completion-notifications";
import { useTrayLocale } from "../../state/use-tray-locale";
import { Drawer } from "../ui/drawer";
-import { GlyphIcon } from "../ui/glyph-icon";
import { Tooltip } from "../ui/tooltip";
-import { UpdateDot } from "../ui/update-dot";
-import { UserAvatar } from "../ui/user-avatar";
-import { COMPANY_MODE_ICON, CloseIcon, NAV_ICONS } from "../ui/icons";
+import { NAV_ICONS } from "../../lib/nav-icons";
import { useCompany } from "../../state/company";
import { COMPANY_NAV_ICONS } from "../../features/company/company-nav-icons";
import { ChannelRailRows } from "../../features/company/channel-sidebar";
@@ -221,7 +219,7 @@ function CollapsedRail({ onExpand }: { onExpand: () => void }) {
onClick={toggleMode}
className={railItemClass(inCompany)}
>
- <GlyphIcon d={COMPANY_MODE_ICON} size={18} />
+ <GlyphIcon d={ICONS.building} size={18} />
</button>
</Tooltip>
)}
diff --git a/packages/web/src/components/layout/project-dialogs.tsx b/packages/web/src/components/layout/project-dialogs.tsx
index 9335b0d7..17699b7f 100644
--- a/packages/web/src/components/layout/project-dialogs.tsx
+++ b/packages/web/src/components/layout/project-dialogs.tsx
@@ -13,6 +13,7 @@ import type {
ModelRefDto,
ModelsResponse,
} from "@prismshadow/penguin-server/api";
+import { Badge, Button, ICONS } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
@@ -32,16 +33,13 @@ import { ModelSelect, modelLabel } from "../../features/chat/model-select";
import { SELECTABLE_THINKING_LEVELS } from "../../features/chat/thinking-level";
import { WorkspaceSelect } from "../../features/chat/workspace-select";
import { sameModelRef } from "../../features/models/model-grouping";
-import { Button } from "../ui/button";
import { Input } from "../ui/input";
import { Select } from "../ui/select";
import { Switch } from "../ui/switch";
-import { GEAR_ICON } from "../ui/icons";
import { FieldError, FieldHint, FieldLabel } from "../ui/field";
import { toastError, toastSuccess } from "../ui/toast";
import { Modal } from "../ui/modal";
import { ConfirmModal } from "../ui/confirm-modal";
-import { Badge } from "../ui/badge";
import { InfoPopover } from "../ui/info-popover";
import { SemanticIdField } from "../../features/semantic-id/semantic-id-field";
@@ -161,7 +159,7 @@ export function CreateProjectDialog({
/** Path data for the settings tabs' small icons (24px viewBox, stroked like NAV_ICONS). */
const TAB_ICON_PATHS = {
- general: GEAR_ICON,
+ general: ICONS.gear,
/** Two people (lucide users). Project members are humans — the Agent glyph used to stand in here. */
members:
"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M13 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0M22 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75",
@@ -494,7 +492,7 @@ function MembersSection({ projectId, isOwner }: { projectId: string; isOwner: bo
<tr key={m.userId}>
<td className="whitespace-nowrap px-2.5 py-1.5">{m.userId}</td>
<td className="whitespace-nowrap px-2.5 py-1.5">
- <Badge tone="gray">{m.role}</Badge>
+ <Badge>{m.role}</Badge>
</td>
<td className="whitespace-nowrap px-2.5 py-1 text-right">
{isOwner && m.role !== "owner" && m.userId !== user?.userId && (
@@ -519,7 +517,7 @@ function MembersSection({ projectId, isOwner }: { projectId: string; isOwner: bo
/>
</td>
<td className="whitespace-nowrap px-2.5 py-1.5">
- <Badge tone="gray">member</Badge>
+ <Badge>member</Badge>
</td>
<td className="whitespace-nowrap px-2.5 py-1 text-right">
<Button size="sm" disabled={!newMemberId.trim()} onClick={() => void addMember()}>
diff --git a/packages/web/src/components/layout/sidebar.tsx b/packages/web/src/components/layout/sidebar.tsx
index a0838de6..a8e655e9 100644
--- a/packages/web/src/components/layout/sidebar.tsx
+++ b/packages/web/src/components/layout/sidebar.tsx
@@ -44,12 +44,31 @@ import type {
SessionCategoryCounts,
SessionInfo,
} from "@prismshadow/penguin-server/api";
+import {
+ ActivityIcon,
+ AgentAvatar,
+ BackgroundTasksMark,
+ Badge,
+ Button,
+ CheckIcon,
+ ChevronDown,
+ ICONS,
+ ICON_SIZE,
+ ScheduleMark,
+ SkeletonList,
+ UpdateDot,
+ UserAvatar,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { formatRelativeShort } from "../../lib/format";
import { onCommand } from "../../lib/shortcuts/dispatcher";
import { useShortcutTitle } from "../../lib/shortcuts/use-keymap";
-import { sessionBackgroundTasks, sessionRowActivity } from "../../lib/session-activity";
+import {
+ sessionActivityLabel,
+ sessionBackgroundTasks,
+ sessionRowActivity,
+} from "../../lib/session-activity";
import type { SessionActivity } from "../../lib/session-activity";
import { forgetSession, noteSessionSeen, useSessionSeen } from "../../lib/session-seen";
import { apiErrorText } from "../../lib/api-error";
@@ -126,23 +145,16 @@ import { Dropdown, menuItemClass } from "../ui/dropdown";
import { useRowContextMenu } from "../ui/context-menu";
import {
HOVER_ROW_ACTIONS,
- PENCIL_ICON,
- PIN_ICON,
SessionRowHoverActions,
SessionRowMenuRows,
- TRASH_ICON,
contextMenuActions,
overflowMenuDangerClass,
overflowMenuGlyph,
overflowMenuRowClass,
} from "../ui/session-row-menu";
import type { SessionRowAction } from "../ui/session-row-menu";
-import { AgentAvatar } from "../ui/agent-avatar";
-import { UserAvatar } from "../ui/user-avatar";
-import { CheckIcon, ChevronDown, GEAR_ICON, MESSAGING_RELAY_ICON, NAV_ICONS } from "../ui/icons";
+import { NAV_ICONS } from "../../lib/nav-icons";
import {
- FOLDER_ICON,
- FOLDER_OPEN_ICON,
GROUP_MODE_ICONS,
SORT_MODE_ICONS,
FolderSection,
@@ -158,18 +170,9 @@ import type { GroupMode } from "../ui/group-list";
import { toastError, toastInfo, toastSuccess } from "../ui/toast";
import { writeClipboard } from "../../lib/clipboard";
import { Truncated } from "../ui/truncated";
-import { Badge } from "../ui/badge";
-import {
- BackgroundTasksMark,
- ScheduleMark,
- SessionActivityIcon,
-} from "../ui/session-activity-icon";
import { Modal } from "../ui/modal";
import { ConfirmModal } from "../ui/confirm-modal";
-import { Button } from "../ui/button";
import { Input, noAutofill } from "../ui/input";
-import { SkeletonList } from "../ui/skeleton";
-import { UpdateDot } from "../ui/update-dot";
import { DRAFT_SESSION_ID } from "../../features/chat/chat-page";
import { MessagingBindingModal } from "../../features/messaging/messaging-binding-modal";
import { WorkspaceSelect } from "../../features/chat/workspace-select";
@@ -186,7 +189,6 @@ import { UserMenu } from "./user-menu";
import { navNoteFor, useUpdateBadges } from "../../lib/use-update-badges";
import { pendingScheduleSessions } from "../../features/schedules/schedule-panel-state";
import { useProjectSchedules } from "../../features/schedules/schedule-store";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { Segmented } from "../ui/segmented";
import { useCompany } from "../../state/company";
import { NoOrganizationsSidebar, OrgSwitcher } from "../../features/company/org-switcher";
@@ -375,7 +377,7 @@ function StatusGlyph({ activity }: { activity: SessionActivity }) {
// truncates into whatever space is left, so letting the slot collapse would re-flow the title
// of every never-run row (and again the moment its first run starts).
if (activity === null) return <span aria-hidden="true" className="block h-3 w-3 shrink-0" />;
- return <SessionActivityIcon activity={activity} />;
+ return <ActivityIcon activity={activity} label={sessionActivityLabel(activity)} />;
}
export function Sidebar({
@@ -1868,7 +1870,7 @@ export function Sidebar({
}`}
>
<span className="truncate font-sans">{projectDisplayName(p)}</span>
- <Badge tone="gray">{p.role}</Badge>
+ <Badge>{p.role}</Badge>
</button>
))}
<div className="mt-1.5 border-t border-gray-100 pt-1.5 dark:border-gray-800">
@@ -2277,7 +2279,7 @@ export function Sidebar({
onClick={toggle}
className={headerControlClass(open)}
>
- <AddBadgeIcon base={FOLDER_ICON} />
+ <AddBadgeIcon base={ICONS.folder} />
</button>
)}
/>
@@ -2381,7 +2383,7 @@ export function Sidebar({
onClick={() => newChat({ agentId: agent.agentId })}
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <Icon d="M12 5v14M5 12h14" size={ICON_SIZE.groupHeaderAction} />
+ <Icon d={ICONS.plus} size={ICON_SIZE.groupHeaderAction} />
</button>
<button
type="button"
@@ -2390,7 +2392,7 @@ export function Sidebar({
onClick={() => go(`/agents/${agent.agentId}`)}
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <Icon d={GEAR_ICON} size={ICON_SIZE.groupHeaderAction} />
+ <Icon d={ICONS.gear} size={ICON_SIZE.groupHeaderAction} />
</button>
</>
}
@@ -2473,7 +2475,7 @@ export function Sidebar({
data-role="group"
>
<Icon
- d={collapsed ? FOLDER_ICON : FOLDER_OPEN_ICON}
+ d={collapsed ? ICONS.folder : ICONS.folderOpen}
size={ICON_SIZE.groupHeaderGlyph}
/>
</span>
@@ -2509,7 +2511,7 @@ export function Sidebar({
}
className="flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <Icon d="M12 5v14M5 12h14" size={ICON_SIZE.groupHeaderAction} />
+ <Icon d={ICONS.plus} size={ICON_SIZE.groupHeaderAction} />
</button>
{/* Manually-added (registry-backed) Workspaces only: rename-alias /
remove-from-sidebar overflow, to the right of the "+" (session-
@@ -2869,10 +2871,7 @@ function DraftRow({
onClick={onDelete}
className="flex h-6 w-6 shrink-0 items-center justify-center rounded text-gray-400 opacity-0 transition-all duration-150 hover:bg-gray-300/60 hover:text-red-600 focus-visible:opacity-100 group-hover:opacity-100 dark:hover:bg-gray-700 dark:hover:text-red-400"
>
- <Icon
- d="M4 6h16M9 6V4.5A1.5 1.5 0 0 1 10.5 3h3A1.5 1.5 0 0 1 15 4.5V6M6 6v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6M10 10.5v6M14 10.5v6"
- size={14}
- />
+ <Icon d={ICONS.trash} size={14} />
</button>
</div>
</div>
@@ -2938,7 +2937,7 @@ function GroupPinButton({ pinned, onToggle }: { pinned: boolean; onToggle: () =>
: "text-gray-400 opacity-0 focus-visible:opacity-100 group-hover/header:opacity-100 dark:text-gray-500"
}`}
>
- <Icon d={PIN_ICON} size={ICON_SIZE.groupHeaderAction} />
+ <Icon d={ICONS.pin} size={ICON_SIZE.groupHeaderAction} />
</button>
);
}
@@ -3132,7 +3131,7 @@ function SessionRow({
{/* Pinned indicator: a dim pin after the title (unpin lives in the row menu). */}
{pinned && canPin && (
<span data-tooltip={S.chat.pinnedSession} className={`shrink-0 ${toneInk.muted}`}>
- <Icon d={PIN_ICON} size={ICON_SIZE.rowMark} />
+ <Icon d={ICONS.pin} size={ICON_SIZE.rowMark} />
<span className="sr-only">{S.chat.pinnedSession}</span>
</span>
)}
@@ -3144,14 +3143,14 @@ function SessionRow({
data-tooltip={S.messaging.enabledIndicator[s.messagingChannel]}
className={`shrink-0 ${toneInk.muted}`}
>
- <Icon d={MESSAGING_RELAY_ICON} size={ICON_SIZE.rowMark} />
+ <Icon d={ICONS.paperPlane} size={ICON_SIZE.rowMark} />
<span className="sr-only">{S.messaging.enabledIndicator[s.messagingChannel]}</span>
</span>
)}
{/* Scheduled-task indicator: the row says this conversation will run on its own, and
the schedules panel says how often and what. A paused task, or one past its end
time, draws nothing — nothing more will fire from it, and a mark would be noise. */}
- {scheduled && <ScheduleMark size={ICON_SIZE.rowMark} />}
+ {scheduled && <ScheduleMark label={S.chat.sessionScheduled} size={ICON_SIZE.rowMark} />}
{/* Background work the conversation owns while sitting idle: still running, only
outside the turn, so it reads as live work rather than as a standing arrangement.
The mark leaves with the last task (live via session_background). */}
@@ -3283,12 +3282,12 @@ function GroupOverflowMenu({ onRename, onDelete }: { onRename: () => void; onDel
}
>
<button type="button" className={overflowMenuRowClass} onClick={item(onRename)}>
- {overflowMenuGlyph(PENCIL_ICON)}
+ {overflowMenuGlyph(ICONS.pencil)}
{S.chat.renameWorkspace}
</button>
<button type="button" className={overflowMenuDangerClass} onClick={item(onDelete)}>
<span className="shrink-0">
- <Icon d={TRASH_ICON} size={13} />
+ <Icon d={ICONS.trash} size={13} />
</span>
{S.chat.deleteWorkspace}
</button>
diff --git a/packages/web/src/components/layout/user-menu.tsx b/packages/web/src/components/layout/user-menu.tsx
index 630895c2..f806572a 100644
--- a/packages/web/src/components/layout/user-menu.tsx
+++ b/packages/web/src/components/layout/user-menu.tsx
@@ -17,12 +17,11 @@
import { useEffect, useState } from "react";
import type { ReactNode } from "react";
import { useNavigate } from "react-router";
+import { ICON_GAP, UserAvatar } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_GAP } from "../../lib/icon-scale";
import { useAuth } from "../../state/auth";
import { ConfirmModal } from "../ui/confirm-modal";
import { Dropdown, menuItemClass } from "../ui/dropdown";
-import { UserAvatar } from "../ui/user-avatar";
import type { DropdownPortal } from "../ui/dropdown";
import { UpdateRow } from "../account/update-row";
import { openUpdateModal } from "../../lib/use-update-flow";
diff --git a/packages/web/src/components/ui/agent-avatar.tsx b/packages/web/src/components/ui/agent-avatar.tsx
deleted file mode 100644
index 39cf184a..00000000
--- a/packages/web/src/components/ui/agent-avatar.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * Agent avatar: the Agent's initial as colored ink on a light tinted tile
- * (the same letter-tile style ProviderLogo uses for user-defined model groups,
- * and the same soft 14%-alpha background the old pixel identicon used).
- *
- * The color hashes the agentId — not the display name — so it survives
- * renames; the initial comes from the display name when the caller has one,
- * falling back to the id. The ink switches shade with the theme via the
- * --tile-fg / --tile-fg-dark custom properties, keeping ≥ 4.5:1 contrast on
- * the tile for every hue in both themes (see lib/avatar.ts).
- */
-import type { CSSProperties } from "react";
-
-import { avatarInitial, avatarTile } from "../../lib/avatar";
-
-export function AgentAvatar({
- id,
- name,
- size = 18,
- className,
-}: {
- id: string;
- /** Display name supplying the initial; omitted, the id's initial is used. */
- name?: string;
- size?: number;
- className?: string;
-}) {
- const tile = avatarTile(id);
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- className={className}
- style={{ "--tile-fg": tile.fg, "--tile-fg-dark": tile.fgDark } as CSSProperties}
- aria-hidden
- role="img"
- >
- <rect x="0" y="0" width="24" height="24" rx="5" fill={tile.bg} />
- <text
- x="12"
- y="12"
- textAnchor="middle"
- dominantBaseline="central"
- fontSize="13"
- fontWeight="700"
- className="[fill:var(--tile-fg)] dark:[fill:var(--tile-fg-dark)]"
- >
- {avatarInitial(name ?? "", id)}
- </text>
- </svg>
- );
-}
diff --git a/packages/web/src/components/ui/badge.tsx b/packages/web/src/components/ui/badge.tsx
deleted file mode 100644
index 9059bea4..00000000
--- a/packages/web/src/components/ui/badge.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Badge component: a small pill-shaped label for status/type (stop_reason, running status, Trace event type, etc.).
- */
-import type { ReactNode } from "react";
-import { toneSurface } from "../../lib/tone";
-
-/**
- * Badge tones are named for their colour rather than for a meaning: a badge labels an attribute
- * ("vision", "fast mode") at least as often as it reports a status, so a semantic name would be
- * wrong at half the call sites. The class strings themselves still come from the shared status
- * tones, so a badge that *does* report a status matches every other mark for that state.
- */
-export type BadgeTone = "gray" | "brand" | "green" | "amber" | "red";
-
-const toneClass: Record<BadgeTone, string> = {
- gray: toneSurface.muted,
- // Neutral emphasis, outside the status vocabulary: a heavier gray for a tag that should read
- // as prominent without claiming any severity ("default", "origin", "queued").
- brand: "bg-gray-200/80 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200",
- green: toneSurface.success,
- amber: toneSurface.attention,
- red: toneSurface.danger,
-};
-
-export function Badge({ tone = "gray", children }: { tone?: BadgeTone; children: ReactNode }) {
- return (
- <span
- className={`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold ${toneClass[tone]}`}
- >
- {children}
- </span>
- );
-}
-
-/** stop_reason -> badge tone (completed usually shows no badge). */
-export function stopReasonTone(stopReason: string): BadgeTone {
- switch (stopReason) {
- case "completed":
- return "green";
- case "aborted":
- return "amber";
- default:
- return "red"; // failed / timeout / malformed
- }
-}
diff --git a/packages/web/src/components/ui/button.tsx b/packages/web/src/components/ui/button.tsx
deleted file mode 100644
index dc54ed65..00000000
--- a/packages/web/src/components/ui/button.tsx
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Button component: GitHub-style simplicity — small border radius + 1px border + a single brand accent, only color transitions.
- */
-import type { ButtonHTMLAttributes } from "react";
-
-type Variant = "primary" | "secondary" | "danger" | "ghost";
-type Size = "sm" | "md" | "icon";
-
-const variantClass: Record<Variant, string> = {
- // primary uses the theme accent variable (defaults to neutral gray/white, switching with light/dark; becomes that color once an accent is selected).
- primary:
- "bg-accent text-accent-fg border border-accent " +
- "transition-opacity hover:opacity-90 disabled:opacity-50",
- secondary:
- "bg-white text-gray-800 border border-gray-300 hover:bg-gray-50 " +
- "dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800",
- danger:
- "bg-white text-red-600 border border-gray-300 hover:border-red-300 hover:bg-red-50 " +
- "dark:bg-gray-900 dark:text-red-400 dark:border-gray-700 dark:hover:bg-red-950",
- ghost:
- "bg-transparent text-gray-600 border border-transparent hover:bg-gray-100 hover:text-gray-900 " +
- "dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",
-};
-
-const sizeClass: Record<Size, string> = {
- sm: "px-2.5 py-1 text-xs rounded-md",
- md: "px-3 py-1.5 text-sm rounded-md",
- /** Square icon button (no text; callers must supply title / aria-label). */
- icon: "p-1.5 rounded-md",
-};
-
-/** Layout and type shared by a real button and the `<label>` that stands in for one. */
-const buttonBase =
- "inline-flex items-center justify-center gap-1 font-medium transition-colors duration-150";
-
-export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
- variant?: Variant;
- size?: Size;
-}
-
-export function Button({
- variant = "secondary",
- size = "md",
- className,
- title,
- ...rest
-}: ButtonProps) {
- // `title` is the hover hint, shown in the shared tooltip (tooltip.tsx) rather than the
- // browser's own. The native attribute also named a wordless button; the shared tooltip names
- // nothing, so an icon button whose only label was its title keeps it as its accessible name.
- const nameless =
- size === "icon" && rest["aria-label"] === undefined && rest["aria-labelledby"] === undefined;
- return (
- <button
- type="button"
- data-tooltip={title}
- {...(nameless && title !== undefined ? { "aria-label": title } : {})}
- className={`${buttonBase} disabled:cursor-not-allowed disabled:opacity-60 ${variantClass[variant]} ${sizeClass[size]} ${className ?? ""}`}
- {...rest}
- />
- );
-}
-
-/**
- * The Button look on an element that cannot be a `<button>` — the `<label>` a file picker needs,
- * since the hidden `<input type="file">` has to be labelled to be clickable. Built from the same
- * two records `Button` reads, so a variant or a rung moves in one place; three call sites had each
- * respelled the strings by hand, and two of them were byte-identical copies of the same one.
- *
- * Two deliberate differences from `Button`: the focus ring is `focus-within:`, because the thing
- * that takes focus is the input inside the label rather than the label itself, and `cursor-pointer`
- * is spelled out, which a `<button>` gets from the app's base rules and a `<label>` does not.
- */
-export function labelButtonClass(variant: Variant, size: Exclude<Size, "icon">): string {
- return `${buttonBase} cursor-pointer focus-within:ring-2 focus-within:ring-gray-400/30 ${variantClass[variant]} ${sizeClass[size]}`;
-}
diff --git a/packages/web/src/components/ui/chord-kbd.tsx b/packages/web/src/components/ui/chord-kbd.tsx
new file mode 100644
index 00000000..7e57e47b
--- /dev/null
+++ b/packages/web/src/components/ui/chord-kbd.tsx
@@ -0,0 +1,18 @@
+/**
+ * A keyboard chord drawn the way the platform writes it: one glyph run on macOS (`⌘W`), one key
+ * per token joined by `+` elsewhere (`Ctrl+W`). The platform and the keyboard layout are the
+ * app's to know, so this formats the chord and the shared `Kbd` draws it, in its plain look; the
+ * caller supplies the colour.
+ */
+import { Kbd } from "@prismshadow/penguin-ui";
+import { formatChord } from "../../lib/shortcuts/format";
+import { currentPlatform } from "../../lib/shortcuts/platform";
+import { keyboardLayout } from "../../lib/shortcuts/store";
+import type { Chord } from "../../lib/shortcuts/types";
+
+export function ChordKbd({ chord, className = "" }: { chord: Chord; className?: string }) {
+ const platform = currentPlatform();
+ const label = formatChord(chord, platform, keyboardLayout() ?? undefined);
+ const keys = platform === "mac" ? [label] : label.split("+");
+ return <Kbd keys={keys} variant="plain" className={className} />;
+}
diff --git a/packages/web/src/components/ui/confirm-modal.tsx b/packages/web/src/components/ui/confirm-modal.tsx
index 44348deb..dfee7dcd 100644
--- a/packages/web/src/components/ui/confirm-modal.tsx
+++ b/packages/web/src/components/ui/confirm-modal.tsx
@@ -17,16 +17,15 @@
*/
import { useState } from "react";
import type { ReactNode } from "react";
+import { Button, ICONS } from "@prismshadow/penguin-ui";
import { Modal } from "./modal";
-import { Button } from "./button";
-import { WARNING_ICON } from "./icons";
import { S } from "../../lib/strings";
/** Tinted icon badge per tone: warning triangle on red for danger, pencil-on-gray for confirmations that overwrite/save. */
function ToneBadge({ tone }: { tone: "danger" | "primary" }) {
const glyph =
tone === "danger"
- ? WARNING_ICON
+ ? ICONS.triangleAlert
: // Pencil-line (lucide): writing changes down.
"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z";
return (
diff --git a/packages/web/src/components/ui/copy-button.tsx b/packages/web/src/components/ui/copy-button.tsx
deleted file mode 100644
index 43b5a260..00000000
--- a/packages/web/src/components/ui/copy-button.tsx
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Copy-to-clipboard button and the hook behind it — the single place the app's "copy"
- * affordance and its feedback live, so every copy control behaves the same:
- *
- * - the feedback follows the WRITE: the check appears only once the text has actually
- * reached the clipboard (writeClipboard reports that), so a copy the browser refused
- * never reads as one that succeeded;
- * - the feedback is ALWAYS shown AT THE BUTTON, and it is the icon alone: copy swaps to
- * the check for COPIED_MS. No text changes anywhere — not a label, not the tooltip, which
- * keeps naming the action (#312). A control that keeps a visible text label (e.g.
- * "复制 Prompt") keeps it unchanged and swaps only its glyph — see CopyCheckGlyph +
- * useCopied;
- * - the icon swap is silent, so every copy affordance also renders a CopiedStatus live
- * region beside itself — that is the screen-reader half of the same feedback.
- */
-import { useEffect, useRef, useState } from "react";
-import { writeClipboard } from "../../lib/clipboard";
-import { S } from "../../lib/strings";
-import { STAT_ICONS } from "../../lib/stat-icons";
-import { GlyphIcon } from "./glyph-icon";
-
-/** How long the copied state (the check icon) stays after a click. */
-const COPIED_MS = 1500;
-
-/**
- * Transient "just copied" flag: `flash()` writes the text and, if the write landed, turns
- * `copied` on for COPIED_MS. Exposed for the caller whose copy trigger is not a plain
- * CopyButton (e.g. a text button rendering CopyCheckGlyph next to its label); most callers
- * should use CopyButton directly.
- */
-export function useCopied(): { copied: boolean; flash: (text: string) => void } {
- const [copied, setCopied] = useState(false);
- // The pending reset is held so it can be restarted and cancelled. Restarted: a second
- // click must get its own full COPIED_MS, or the first click's timer clears the check
- // right after the second copy — and the check is now the only feedback, so a check that
- // vanishes on click reads as "the copy didn't take". Cancelled: the control can unmount
- // inside the window (the Trace row closes the details popover itself; the memory and
- // skill-import modals close the same way), and the timeout must not outlive it.
- const resetTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
- useEffect(
- () => () => {
- if (resetTimer.current !== null) clearTimeout(resetTimer.current);
- },
- [],
- );
- const flash = (text: string) => {
- void writeClipboard(text).then((ok) => {
- // A refused write shows nothing rather than a check: the control returns to idle, so
- // the copy can simply be retried — there is no state to be stuck in.
- if (!ok) return;
- setCopied(true);
- if (resetTimer.current !== null) clearTimeout(resetTimer.current);
- resetTimer.current = setTimeout(() => {
- resetTimer.current = null;
- setCopied(false);
- }, COPIED_MS);
- });
- };
- return { copied, flash };
-}
-
-/** The glyph pair every copy affordance shows: the copy icon, swapping to the check while copied. */
-export function CopyCheckGlyph({ copied, size }: { copied: boolean; size?: number }) {
- return <GlyphIcon d={copied ? STAT_ICONS.check : STAT_ICONS.copy} size={size} />;
-}
-
-/**
- * Screen-reader half of the copy feedback, rendered NEXT TO the control (never inside it,
- * so it joins neither the visible label nor the accessible name). The check glyph is
- * `aria-hidden` and the tooltip names the action, not the result, so without this region the
- * confirmation is silent. The region
- * is always rendered and merely filled on copy: a live region announces changes to its
- * content, so it has to exist before the text appears.
- *
- * Deliberately a bare `aria-live` region rather than `role="status"` (which would mean the
- * same to a screen reader): `role="status"` is this app's RUNNING-SPINNER marker — see
- * status-icon.tsx — and copy buttons sit on pages that assert no spinner is left over.
- */
-export function CopiedStatus({ copied }: { copied: boolean }) {
- return (
- <span className="sr-only" aria-live="polite" aria-atomic="true">
- {copied ? S.common.copied : ""}
- </span>
- );
-}
-
-/** Default compact icon-button look (message footer / code block). */
-const DEFAULT_CLASS =
- "rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300";
-
-/**
- * The copy button beside a mono value row (details card Session id / Trace file, Agent
- * State path): the default look plus what a flex row needs — never shrink, and an
- * explicit dark-mode idle tone.
- */
-export const ROW_COPY_CLASS =
- "shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-300";
-
-export function CopyButton({
- text,
- label,
- className = DEFAULT_CLASS,
-}: {
- /** The string to copy, or a getter for content computed at click time (e.g. a formatted stats line). */
- text: string | (() => string);
- /** Accessible name and tooltip of the copy action; neither changes while copied. */
- label: string;
- /** Overrides the compact default look (e.g. the reply row's fixed-size button). */
- className?: string;
-}) {
- const { copied, flash } = useCopied();
- return (
- <>
- <button
- type="button"
- data-tooltip={label}
- aria-label={label}
- onClick={() => flash(typeof text === "function" ? text() : text)}
- className={className}
- >
- <CopyCheckGlyph copied={copied} />
- </button>
- {/* Sibling, not a child: the button's accessible name stays `label`, and `sr-only`
- is position:absolute, so it is not a flex item and disturbs no caller's layout. */}
- <CopiedStatus copied={copied} />
- </>
- );
-}
diff --git a/packages/web/src/components/ui/drawer.tsx b/packages/web/src/components/ui/drawer.tsx
index ffb1de3a..10101de8 100644
--- a/packages/web/src/components/ui/drawer.tsx
+++ b/packages/web/src/components/ui/drawer.tsx
@@ -8,7 +8,7 @@
*/
import { useEffect, useRef } from "react";
import type { ReactNode } from "react";
-import { CloseButton } from "./icons";
+import { CloseButton } from "@prismshadow/penguin-ui";
import { isTopEscLayer, popEscLayer, pushEscLayer } from "./modal";
export interface DrawerProps {
diff --git a/packages/web/src/components/ui/empty-state.tsx b/packages/web/src/components/ui/empty-state.tsx
deleted file mode 100644
index 6d347ae8..00000000
--- a/packages/web/src/components/ui/empty-state.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Empty state components: a placeholder message for when a list/detail view has no data
- * (plain text, no graphic decoration) — `EmptyState` for a page, `SettingsEmpty` for the
- * slot a settings tab's table or list would occupy.
- */
-import type { ReactNode } from "react";
-
-export function EmptyState({
- title,
- description,
- action,
-}: {
- title: string;
- description?: string;
- action?: ReactNode;
-}) {
- return (
- <div className="flex flex-col items-center justify-center gap-2 py-12 text-center">
- <p className="text-sm font-medium text-gray-600 dark:text-gray-300">{title}</p>
- {description && <p className="text-xs text-gray-500 dark:text-gray-500">{description}</p>}
- {action && <div className="mt-2">{action}</div>}
- </div>
- );
-}
-
-/**
- * Settings-area empty state: the message centered on both axes inside a dashed, rounded
- * block that stands where the populated list or table would. Dashed rather than solid so an
- * empty slot never reads as a rendered-but-blank container, and `min-h` gives the text
- * something to be vertically centered in. Every settings tab that can come up empty
- * (Skills, Vault, Schedules, MCP servers) uses this, so they stay identical.
- */
-export function SettingsEmpty({ children }: { children: ReactNode }) {
- return (
- <div className="flex min-h-24 items-center justify-center rounded-md border border-dashed border-gray-300 px-4 text-center text-xs text-gray-400 dark:border-gray-700 dark:text-gray-500">
- {children}
- </div>
- );
-}
diff --git a/packages/web/src/components/ui/field.tsx b/packages/web/src/components/ui/field.tsx
index 394f2e6c..89ff25e6 100644
--- a/packages/web/src/components/ui/field.tsx
+++ b/packages/web/src/components/ui/field.tsx
@@ -6,8 +6,8 @@
* near-identical copies that used to live in each control and call site.
*/
import type { ReactNode } from "react";
+import { CheckIcon } from "@prismshadow/penguin-ui";
import { InfoPopover } from "./info-popover";
-import { CheckIcon } from "./icons";
/**
* The control "look" shared by Input, Select and OptionMenu: rounded box, gray
diff --git a/packages/web/src/components/ui/file-browser.tsx b/packages/web/src/components/ui/file-browser.tsx
index 678d7781..c9d0c85c 100644
--- a/packages/web/src/components/ui/file-browser.tsx
+++ b/packages/web/src/components/ui/file-browser.tsx
@@ -21,6 +21,7 @@ import { useMemo } from "react";
import type { CSSProperties, ReactNode } from "react";
import ReactMarkdown from "react-markdown";
import type { Components } from "react-markdown";
+import { SkeletonList } from "@prismshadow/penguin-ui";
import { REHYPE_PLUGINS, REMARK_PLUGINS } from "../../lib/markdown-plugins";
import { SETTLED_MD_COMPONENTS } from "../../features/chat/md";
import { bodyWithoutFrontmatter } from "../../lib/frontmatter";
@@ -31,7 +32,6 @@ import { CodeBlock } from "../../features/chat/code-block";
import { languageForExtension } from "../../features/chat/code-languages";
import { FileTree } from "./file-tree";
import type { TreeToggle } from "./file-tree";
-import { SkeletonList } from "./skeleton";
/** A reference naming a scheme of its own (`https:`, `mailto:`) points outside the browsed files. */
const EXTERNAL_REF_RE = /^[a-z][a-z0-9+.-]*:/i;
diff --git a/packages/web/src/components/ui/file-tree.tsx b/packages/web/src/components/ui/file-tree.tsx
index 8a07add4..94625def 100644
--- a/packages/web/src/components/ui/file-tree.tsx
+++ b/packages/web/src/components/ui/file-tree.tsx
@@ -30,13 +30,9 @@
*/
import { useEffect, useRef, useState } from "react";
import type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from "react";
+import { Chevron, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { subtreeEnd, treeKeyStep } from "../../lib/file-tree";
import type { FileTreeRow } from "../../lib/file-tree";
-import { Chevron } from "./chevron";
-import { GlyphIcon } from "./glyph-icon";
-import { FOLDER_ICON, FOLDER_OPEN_ICON } from "./group-list";
-import { FILE_ICON } from "./icons";
-import { ICON_SIZE } from "../../lib/icon-scale";
/** Left padding of a depth-0 row, in px; deeper rows add `TREE_INDENT_PX` per level. */
const TREE_PAD_PX = 6;
@@ -250,7 +246,7 @@ export function FileTree<Row extends FileTreeRow>({
{row.kind === "dir" && <Chevron open={row.expanded} size={ICON_SIZE.chevronDense} />}
</span>
<GlyphIcon
- d={row.kind === "dir" ? (row.expanded ? FOLDER_OPEN_ICON : FOLDER_ICON) : FILE_ICON}
+ d={row.kind === "dir" ? (row.expanded ? ICONS.folderOpen : ICONS.folder) : ICONS.file}
size={ICON_SIZE.rowLead}
className="text-gray-400"
/>
diff --git a/packages/web/src/components/ui/form-picker.tsx b/packages/web/src/components/ui/form-picker.tsx
index eda3f34c..cd28a550 100644
--- a/packages/web/src/components/ui/form-picker.tsx
+++ b/packages/web/src/components/ui/form-picker.tsx
@@ -12,8 +12,8 @@
* and close on pick).
*/
import type { ReactNode } from "react";
+import { ChevronDown } from "@prismshadow/penguin-ui";
import { Dropdown } from "./dropdown";
-import { ChevronDown } from "./icons";
import { controlBase } from "./field";
import { sizeClass } from "./input";
import type { ControlSize } from "./input";
diff --git a/packages/web/src/components/ui/glyph-icon.tsx b/packages/web/src/components/ui/glyph-icon.tsx
deleted file mode 100644
index 0bd03dc3..00000000
--- a/packages/web/src/components/ui/glyph-icon.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * The app's one line-icon renderer: a 24x24 path in currentColor, stroked at the active theme's
- * `--ui-icon-stroke` (1.7 in the default theme), so the mark follows the caller's text colour and
- * every glyph in the app carries the same weight. Icon
- * paths live in the modules that own them — `lib/stat-icons.ts`, `components/ui/icons.tsx`,
- * `components/ui/group-list.tsx`, `components/ui/session-row-menu.tsx` — and the size comes from
- * the role-named scale in `lib/icon-scale.ts`.
- */
-import { ICON_SIZE } from "../../lib/icon-scale";
-
-export function GlyphIcon({
- d,
- size = ICON_SIZE.inlineGlyph,
- className = "",
- filled = false,
-}: {
- d: string;
- size?: number;
- className?: string;
- /** Fill the path in currentColor — for a mark whose "on" state is a solid shape (a pinned tack). */
- filled?: boolean;
-}) {
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill={filled ? "currentColor" : "none"}
- stroke="currentColor"
- // A style, not the attribute: an SVG presentation attribute cannot read a custom property.
- // The fallback is the default theme's weight, for a page that has not loaded the theme CSS.
- style={{ strokeWidth: "var(--ui-icon-stroke, 1.7)" }}
- strokeLinecap="round"
- strokeLinejoin="round"
- className={`block shrink-0 ${className}`}
- aria-hidden
- >
- <path d={d} />
- </svg>
- );
-}
diff --git a/packages/web/src/components/ui/group-list.tsx b/packages/web/src/components/ui/group-list.tsx
index b8f58b9e..eac98bdd 100644
--- a/packages/web/src/components/ui/group-list.tsx
+++ b/packages/web/src/components/ui/group-list.tsx
@@ -7,52 +7,15 @@
* vocabulary kept in one file rather than a contract between two.
*/
import type { DragEvent as ReactDragEvent, ReactNode } from "react";
+import { Chevron, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import type { SessionSortMode } from "../../lib/session-order";
-import { Chevron } from "./chevron";
-import { GlyphIcon } from "./glyph-icon";
-import { ICON_SIZE } from "../../lib/icon-scale";
/** The grouped lists' line icon: GlyphIcon at the nav-row rung, which is what these rows are. */
export function Icon({ d, size = ICON_SIZE.navRow }: { d: string; size?: number }) {
return <GlyphIcon d={d} size={size} />;
}
-/** Folder outline, closed (same glyph as the draft page's Workspace pill); collapsed workspace groups and the grouping toggle use it. */
-export const FOLDER_ICON =
- "M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z";
-
-/** Folder outline, open (lucide folder-open: back panel + tilted front flap); expanded workspace groups use it. */
-export const FOLDER_OPEN_ICON =
- "m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2";
-
-/**
- * Agent glyph (the grouping toggle's "by Agent" option; also NAV_ICONS.agents in the sidebar
- * nav): a robot head with an antenna, two ears, two eyes and a smile — lucide's `bot` with the
- * mouth added. The face is the point: an Agent is the thing in this product a person talks to,
- * and the friendliest mark on the rail should be the one that stands for it.
- *
- * The landing page draws the same Agent from its own copy of this string (`BotIcon` in
- * packages/landing/src/components/icons.tsx — it carries no icon dependency to share one
- * with); redraw this and redraw that. Its agent-glyph-sync test fails if only one moves.
- */
-export const AGENT_GROUP_ICON =
- "M12 8V4H8M6 8h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2zM2 14h2M20 14h2M9 13h.01M15 13h.01M10 16.5s.8 1 2 1 2-1 2-1";
-
-/** Clock (lucide clock, drawn as one path), the "most recent" sort option. */
-export const CLOCK_ICON = "M22 12a10 10 0 1 1-20 0 10 10 0 0 1 20 0M12 6v6l4 2";
-
-/**
- * Calendar (lucide calendar), the "by time" grouping option. Deliberately not the clock:
- * that glyph already names the recency SORT one section below in the same menu, and two
- * rows wearing one mark would read as one setting.
- */
-export const CALENDAR_ICON =
- "M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z";
-
-/** Opposed up/down arrows (lucide arrow-up-down), the drag-reordered "manual order" sort option. */
-export const REORDER_ICON = "m21 16-4 4-4-4M17 20V4M3 8l4-4 4 4M7 4v16";
-
/** Grouping mode of a Session list (persisted; Workspace is the default). */
export type GroupMode = "workspace" | "agent" | "time";
@@ -60,22 +23,24 @@ export type GroupMode = "workspace" | "agent" | "time";
* Leading glyph per grouping mode — the one place these are chosen, read by both the
* two-icon toggle below and the sidebar's list-options menu, so a row and its toggle can
* never end up wearing different icons for the same mode. Each glyph names the thing the
- * list is grouped *into*: a folder for Workspaces, the Agent glyph for Agents.
+ * list is grouped *into*: a folder for Workspaces, the agent glyph for Agents. Time uses the
+ * calendar, deliberately not the clock: that glyph already names the recency SORT one section
+ * below in the same menu, and two rows wearing one mark would read as one setting.
*/
export const GROUP_MODE_ICONS: Record<GroupMode, string> = {
- workspace: FOLDER_ICON,
- agent: AGENT_GROUP_ICON,
- time: CALENDAR_ICON,
+ workspace: ICONS.folder,
+ agent: ICONS.robot,
+ time: ICONS.calendar,
};
/**
* Leading glyph per sort mode, distinguishing what actually decides the order rather than
- * decorating the rows: a clock for recency, and the reorder arrows of the drag that
+ * decorating the rows: a clock for recency, and the opposed arrows of the drag that
* produces a manual order.
*/
export const SORT_MODE_ICONS: Record<SessionSortMode, string> = {
- recent: CLOCK_ICON,
- manual: REORDER_ICON,
+ recent: ICONS.clock,
+ manual: ICONS.arrowUpDown,
};
/**
@@ -151,10 +116,6 @@ export function MoreRow({
);
}
-/** Chevrons of the group pager's step buttons (lucide chevron-left / chevron-right). */
-const PAGER_PREV_ICON = "M15 18 9 12l6-6";
-const PAGER_NEXT_ICON = "m9 18 6-6-6-6";
-
/**
* Page stepper of a grouped list whose groups are paginated (the sidebar renders at most
* SIDEBAR_GROUP_PAGE_SIZE groups per page): two flat chevron buttons around the "2/5"
@@ -189,7 +150,7 @@ export function GroupPager({
onClick={() => step(-1)}
className={buttonClass}
>
- <Icon d={PAGER_PREV_ICON} size={12} />
+ <Icon d={ICONS.chevronLeft} size={12} />
</button>
{/* The position doubles as the control's status: announced on change so a step is
audible without counting the rows that swapped underneath it. */}
@@ -208,7 +169,7 @@ export function GroupPager({
onClick={() => step(1)}
className={buttonClass}
>
- <Icon d={PAGER_NEXT_ICON} size={12} />
+ <Icon d={ICONS.chevronRight} size={12} />
</button>
</div>
);
diff --git a/packages/web/src/components/ui/help-fold.tsx b/packages/web/src/components/ui/help-fold.tsx
index 52340c5b..6ec66072 100644
--- a/packages/web/src/components/ui/help-fold.tsx
+++ b/packages/web/src/components/ui/help-fold.tsx
@@ -24,9 +24,8 @@
*/
import { useId, useState } from "react";
import type { ReactNode } from "react";
+import { Chevron, ICON_GAP, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Chevron } from "./chevron";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
export function HelpFold({
children,
diff --git a/packages/web/src/components/ui/icons.tsx b/packages/web/src/components/ui/icons.tsx
deleted file mode 100644
index da0c5795..00000000
--- a/packages/web/src/components/ui/icons.tsx
+++ /dev/null
@@ -1,436 +0,0 @@
-/**
- * Shared single-path icons and the dialog close button, replacing SVGs that were
- * inlined identically at many call sites. Note `chevron.tsx` is a *different*
- * glyph (the rotating right-caret used by collapsibles) and stays separate.
- */
-import type { ButtonHTMLAttributes } from "react";
-import { S } from "../../lib/strings";
-import { AGENT_GROUP_ICON, CALENDAR_ICON } from "./group-list";
-
-/** Downward caret on Select / OptionMenu / composer dropdown triggers. Color follows currentColor (callers add text-gray-400). */
-export function ChevronDown({ size = 12, className = "" }: { size?: number; className?: string }) {
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 12 12"
- fill="none"
- stroke="currentColor"
- aria-hidden
- className={`shrink-0 ${className}`}
- >
- <path d="M3 4.5l3 3 3-3" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
- </svg>
- );
-}
-
-/** Selected-row checkmark in the Select / OptionMenu menus. */
-export function CheckIcon({ size = 13, className = "" }: { size?: number; className?: string }) {
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- aria-hidden
- className={`shrink-0 ${className}`}
- >
- <path d="M5 12l4 4L19 6" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" />
- </svg>
- );
-}
-
-/** "Add" plus glyph used by create buttons / new-row affordances. */
-export function PlusIcon({
- size = 14,
- strokeWidth = 1.7,
- className = "",
-}: {
- size?: number;
- strokeWidth?: number;
- className?: string;
-}) {
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- aria-hidden
- className={`shrink-0 ${className}`}
- >
- <path
- d="M12 5v14M5 12h14"
- strokeWidth={strokeWidth}
- strokeLinecap="round"
- strokeLinejoin="round"
- />
- </svg>
- );
-}
-
-/** Download glyph (tray with a down arrow), used by export/download affordances. */
-export function DownloadIcon({ size = 13, className = "" }: { size?: number; className?: string }) {
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- aria-hidden
- className={`shrink-0 ${className}`}
- >
- <path
- d="M12 4v11m0 0l-5-5m5 5l5-5M4 20h16"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- />
- </svg>
- );
-}
-
-/** Upload glyph (tray with an up arrow), used by import/upload affordances. */
-export function UploadIcon({ size = 13, className = "" }: { size?: number; className?: string }) {
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- aria-hidden
- className={`shrink-0 ${className}`}
- >
- <path
- d="M12 15V4m0 0L7 9m5-5l5 5M4 20h16"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- />
- </svg>
- );
-}
-
-/**
- * The close cross. Drawn on a 14x14 grid at stroke 1.5 rather than the 24x24 icon grid: a
- * two-stroke mark aliases badly when its grid and its render size disagree.
- */
-export function CloseIcon({ size = 14, className = "" }: { size?: number; className?: string }) {
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 14 14"
- fill="none"
- stroke="currentColor"
- aria-hidden
- className={`block shrink-0 ${className}`}
- >
- <path d="M2 2l10 10M12 2L2 12" strokeWidth="1.5" strokeLinecap="round" />
- </svg>
- );
-}
-
-/**
- * The X close button shared by the Modal / Drawer / Sheet headers: same glyph,
- * padding and hover treatment. Extra button props (e.g. Sheet's onPointerDown
- * guard) pass through.
- */
-export function CloseButton({
- onClose,
- className = "",
- title,
- ...rest
-}: { onClose: () => void; className?: string } & Omit<
- ButtonHTMLAttributes<HTMLButtonElement>,
- "onClick"
->) {
- return (
- <button
- type="button"
- aria-label={S.common.close}
- onClick={onClose}
- className={`rounded-md p-1.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300 ${className}`}
- data-tooltip={title}
- {...rest}
- >
- <CloseIcon />
- </button>
- );
-}
-
-/** Plus: "add one of these" — the dock's add-tab trigger, the terminal page's new shell. */
-export const ADD_ICON = "M12 5v14M5 12h14";
-
-/** Info circle: the app's 9-radius status circle with a bar and a dot inside it. */
-export const INFO_ICON = "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11v5m0-8h.01";
-
-/**
- * Triangle alert (lucide): a warning worth acting on — the confirm dialog's danger badge, and the
- * built-in browser's load warning with the tabs it points at.
- */
-export const WARNING_ICON =
- "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3zM12 9v4m0 4h.01";
-
-/**
- * Opening quotation marks: a passage carried in from somewhere else. The composer's chip for a
- * Workspace selection wears it, where a paperclip would have claimed the file was attached — the
- * file is not; a few of its lines are quoted.
- */
-export const QUOTE_ICON =
- "M9.5 6.5C7 7.5 5.5 9.5 5.5 12.5v4h5v-5h-3c0-1.8.9-3.1 2.6-3.8zM19.5 6.5c-2.5 1-4 3-4 6v4h5v-5h-3c0-1.8.9-3.1 2.6-3.8z";
-
-/** A pane with an arrow leaving it: this opens somewhere outside the app, in a tab of its own. */
-export const EXTERNAL_LINK_ICON =
- "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3";
-
-/**
- * A globe — the app's 9-radius circle, its equator and one meridian: the built-in browser,
- * wherever the dock names it, and the stand-in for a page that has no favicon of its own.
- */
-export const GLOBE_ICON =
- "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM3 12h18M12 3a13 13 0 0 1 0 18 13 13 0 0 1 0-18z";
-
-/** Arrows pointing back and forward along one line: a browser's history buttons. */
-export const ARROW_BACK_ICON = "M19 12H5m6-6-6 6 6 6";
-export const ARROW_FORWARD_ICON = "M5 12h14m-6-6 6 6-6 6";
-
-/** Angle brackets: developer tools. */
-export const CODE_ICON = "M16 18l6-6-6-6M8 6l-6 6 6 6";
-
-/** A house with its door: the built-in browser's homepage, on the Home button and the menu row that sets it. */
-export const HOME_ICON =
- "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z";
-
-/** Two links of a chain: a link's address, as the conversation's link menu copies it. */
-export const LINK_ICON =
- "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71";
-
-/**
- * Window with a bottom pane / a right pane: the two dock edges. Drawn by the chat toolbar's
- * pull-open buttons and the dock header's move-dock buttons, so one mark stands for one edge
- * everywhere.
- */
-export const PANEL_BOTTOM_ICON = "M4 5h16v14H4zM4 14h16";
-export const PANEL_RIGHT_ICON = "M4 5h16v14H4zM14 5v14";
-
-/** A dashboard of four tiles: the workbench the floating launcher opens. */
-export const WORKBENCH_ICON = "M3 3h7v9H3zM14 3h7v5h-7zM14 12h7v9h-7zM3 16h7v5H3z";
-
-/**
- * Four corner brackets opening outward: the floating launcher's ball while the pointer or the
- * keyboard is on it, in place of the workbench tiles it rests on. Brackets rather than an arrow
- * or a chevron because the fan they announce opens up, left and down at once, and a mark with a
- * direction in it would name the wrong one.
- */
-export const EXPAND_ICON = "M9 3H3v6M15 3h6v6M15 21h6v-6M9 21H3v-6";
-
-/** The same four corner brackets turned inward: what the launcher ball offers while its fan stands open. */
-export const COLLAPSE_ICON = "M3 9h6V3M21 9h-6V3M21 15h-6v6M3 15h6v6";
-
-/**
- * Two robot heads, a large one above-left and a small one below-right: the subagents panel,
- * wherever the dock names it. The single robot head of `AGENT_GROUP_ICON` is the Agent itself;
- * the pair is what that Agent has going on underneath it. Reduced to antenna + head + two eye
- * dots, because the ears and the smile the single head carries fall below a pixel on the dock's
- * 13px tab strip.
- */
-export const AGENTS_PAIR_ICON =
- "M7.3 4.2V2.2M3.8 4.2h7a2.2 2.2 0 0 1 2.2 2.2v5.8a2.2 2.2 0 0 1-2.2 2.2h-7a2.2 2.2 0 0 1-2.2-2.2V6.4a2.2 2.2 0 0 1 2.2-2.2zM4.6 9.2h.01M10 9.2h.01M18.6 14.8v-1.7M16.5 14.8h4.2a1.7 1.7 0 0 1 1.7 1.7v3.8a1.7 1.7 0 0 1-1.7 1.7h-4.2a1.7 1.7 0 0 1-1.7-1.7v-3.8a1.7 1.7 0 0 1 1.7-1.7zM17.3 18.4h.01M20.5 18.4h.01";
-
-/**
- * The cerebrum from the side — for the Memory panel, the memory-changes card and the agent cards'
- * memory count.
- *
- * Two subpaths in one string, because `GlyphIcon` draws a single `<path>`: the lobed outline, then
- * the gyri inside it. The drawing was authored with the whole figure shifted a little down the box;
- * that shift is baked into the coordinates here rather than carried as a transform, since a
- * transform is an attribute the shared renderer has nowhere to put.
- *
- * It is stroked at the family's 1.7 like every other glyph, not at the 1.6 it was drawn at — the
- * weight belongs to the set, not to the mark.
- *
- * Every surface draws it from here: a memory mark typed out a second time is how one thing ends up
- * with two pictures of itself.
- */
-export const MEMORY_ICON =
- "M5.1 17.9c-1.4 0 -2.5 -1.05 -2.5 -2.45 -1.1 -1 -.95 -2.75 .25 -3.6 -.5 -1.75 .6 -3.5 2.3 -3.8 .2 -1.85 1.95 -3.15 3.75 -2.7 1.3 -1.3 3.5 -1.45 4.95 -.25 2 -.35 3.8 .8 4.35 2.6 2 .1 3.45 1.9 3.05 3.85 .9 1.2 .5 2.95 -.75 3.7 .2 1.6 -1.1 2.9 -2.7 2.75 -1.15 1.15 -2.85 1.3 -4.15 .5 -1.6 1.55 -4.4 1.4 -5.45 -.8 -.85 .75 -2.1 .85 -3.1 .2ZM5.15 8.05C5.05 9.75 6.4 10.8 8 10.55m5.85 -5.45c-1.1 .65 -1.8 1.9 -1.6 3.25m5.95 -.65c-1.7 -.2 -2.8 1.2 -2.6 2.65M8.2 17.7c-1.2 -1.1 -.85 -3 .55 -3.65 1.7 -.8 3.3 -.45 4.5 -2.1m4.55 6.05c-1.35 -.45 -1.9 -1.65 -1.45 -2.85";
-
-/**
- * The eye's almond outline, shared by the two marks drawn from it — `NAV_ICONS.traces` (an open
- * eye: watching the run) and `HIDDEN_ICON` (the same eye struck through). Composed rather than
- * typed twice so the pair cannot drift into looking unrelated.
- */
-const EYE_OUTLINE = "M2 12s3.5-6.5 10-6.5S22 12 22 12s-3.5 6.5-10 6.5S2 12 2 12z";
-
-/**
- * The struck-through eye: the launcher fan's last entry, which puts the ball away. The slash runs
- * corner to corner rather than across the eye alone, because the open eye a few entries above it
- * in the same fan is the same outline, and the slash is the only thing telling the two apart.
- */
-export const HIDDEN_ICON = `${EYE_OUTLINE}M3 3l18 18`;
-
-/**
- * File glyphs, shared by every place a file operation is marked — the file summary card, the
- * memory-changes card, the context panel's file ranking — so a read, an edit and a write look
- * the same everywhere: a page with a folded corner, the same page with a plus (a full write),
- * and a pencil (an in-place edit).
- */
-export const FILE_ICON = "M6 3h8l4 4v14H6zM14 3v4h4";
-export const FILE_WRITE_ICON = "M6 3h8l4 4v14H6zM12 11v6M9 14h6";
-export const FILE_EDIT_ICON = "M12 20h9M16.5 3.5a2.85 2.85 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z";
-
-/**
- * Moving a file in or out of the Workspace: a tray with an arrow leaving it (upload) or
- * landing in it (download). The same tray both ways, so the pair reads as one axis; the
- * arrow's direction is the only difference, and each is labelled where it is drawn.
- */
-export const UPLOAD_ICON = "M12 15V4m0 0L8 8m4-4 4 4M4 15v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3";
-export const DOWNLOAD_ICON = "M12 4v11m0 0 4-4m-4 4-4-4M4 15v3a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-3";
-
-/**
- * Two arcs chasing each other round a circle: re-read what is on disk. The arc idiom is the
- * app's existing one (see HISTORY_ICON in app-layout.tsx), so the mark sits in the same family
- * as the other round-trip glyphs rather than introducing a second way to draw a turn.
- */
-export const REFRESH_ICON =
- "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8M21 3v5h-5M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16M3 21v-5h5";
-
-/**
- * Soft wrap: three lines of text where the middle one runs past the edge, turns back and
- * returns with an arrow. The turn is the whole mark — a plain stack of lines would be any of
- * a dozen list glyphs — so it keeps the full bulge rather than being tucked in to save room.
- */
-export const WRAP_TEXT_ICON = "M4 6h16M4 12h12a3 3 0 1 1 0 6h-3m2-2-2 2 2 2M4 18h5";
-
-/**
- * Activity trace (a flat line with one tall beat in it): work still going on behind the
- * conversation — the background-task mark on a session row, the matching count in the chat
- * header, and the marker on a tool row whose call was made with `run_in_background`.
- *
- * A trace rather than the layered stack it replaces, which read as "layers" (a thing) instead
- * of "still running" (an event), and whose two parallelograms sit ~2.5px apart at the row's
- * 12px and merge into a smudge. One continuous stroke with a single tall beat keeps its shape
- * at that size, and it is nobody else's shape in these rows: not the hourglass or the compress
- * chevrons (`attention`, session activity), not the spinner ring or the circled check / cross
- * (a tool row's own status), not the unread dot.
- */
-export const BACKGROUND_TASKS_ICON = "M2 12h4l3 9 6-18 3 9h4";
-
-/**
- * The same bubble with a plus in it: putting something into the conversation rather than
- * sending it — the Files panel's "add to conversation" drops a reference in the composer
- * and stops there. Bubble-plus-plus follows the file pair's own convention (FILE_ICON vs
- * FILE_WRITE_ICON): the plus is what the action adds, drawn on the thing it adds to.
- */
-export const ADD_TO_CHAT_ICON =
- "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2zM12 7v6M9 10h6";
-
-/**
- * Paper plane: remote control — the session-row mark for a Session that is relaying through
- * a messaging channel, the row menu's action that sets one up, and the dock's remote-control
- * panel, so the feature wears one mark wherever it appears. One shape for every
- * channel — shape alone is not the carrier, so the row pairs it with the channel's name in
- * a tooltip and in sr-only text, and the menu entry is labelled.
- */
-export const MESSAGING_RELAY_ICON = "M22 2 11 13M22 2l-7 20-4-9-9-4z";
-
-/** Standard gear (lucide settings): full tooth outline + center circle, crisp and undistorted at 16px. */
-export const GEAR_ICON =
- "M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z";
-
-/**
- * Page-nav glyphs (moved from sidebar.tsx: the sidebar nav, the collapsed rail in
- * app-layout.tsx, and cross-page jump actions — e.g. the chat info dropdown's "view
- * trace" — share them; living here keeps chat-page free of a sidebar import cycle,
- * sidebar.tsx importing DRAFT_SESSION_ID from chat-page).
- */
-/**
- * Hook package (a fishing hook: eye, shank, bend and a barbed tip). The mark of hook packages
- * as a kind, wherever skills are marked by the book: the agents page's hook count, the harness
- * banner, and what a settings Hooks tab row draws when its package carries no plugin icon.
- */
-export const HOOK_ICON =
- "M16 4a2 2 0 1 0-4 0 2 2 0 0 0 4 0zM14 6v8a5 5 0 0 1-10 0v-2m0 0l-2 2m2-2l2 2";
-
-/**
- * Plugin (a puzzle piece, lucide's outline): the mark of the plugin library in the nav, and
- * what a plugin tile draws when the plugin ships no icon.svg of its own.
- */
-export const PLUGIN_ICON =
- "M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z";
-
-/**
- * Magic wand with sparkles (after lucide's wand-sparkles, reduced to two sparkles so it still
- * reads at 13px): the mark of "Create with AI" wherever an object can be described to the agent
- * instead of configured by hand — the AI half of the create pair and the dialog's exit.
- */
-export const MAGIC_WAND_ICON =
- "M21.64 3.64l-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72zM14 7l3 3M5 6v4M3 8h4M19 14v4M17 16h4";
-
-/** An open hand — the "do it by hand" mark beside the wand, on the 24×24 grid. */
-export const HAND_ICON =
- "M18 11V6a2 2 0 0 0-4 0M14 10V4a2 2 0 0 0-4 0v2M10 10.5V6a2 2 0 0 0-4 0v8M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15";
-
-/**
- * Alarm clock — domed bells on its shoulders, a dial with hands, and two splayed feet: the mark
- * of scheduled tasks wherever they are counted, listed or created — the agents page's schedule
- * count, the chat dock's scheduled-tasks panel and the mark a session row wears while an enabled
- * task is bound to it. Distinct from the plain clock face that means "most recent" in the list
- * options.
- *
- * The smallest place it draws is the session row's 12px trailing cluster, which is what the
- * detail is bounded by: bells, feet and the hands' right angle each hold a whole pixel there,
- * while a second dial ring or ticks around the face would not, and the notch between the bells
- * is what keeps them reading as two.
- */
-export const SCHEDULE_ICON =
- "M12 19.5a6.7 6.7 0 1 0 0-13.4 6.7 6.7 0 0 0 0 13.4zM12 8.9v3.9l2.6 1.8M3.1 7.7A3.5 3.5 0 0 1 7.7 4.3M16.3 4.3a3.5 3.5 0 0 1 4.6 3.4M7.8 18.8 5.4 21.6M16.2 18.8l2.4 2.8";
-
-export const NAV_ICONS = {
- agents: AGENT_GROUP_ICON,
- /** Plugin library (the puzzle piece). */
- plugins: PLUGIN_ICON,
- /**
- * Model library (a chip: body, die and three pins a side). Three pins rather than the six a
- * real package would show — at the 16px these rows draw, six pins a side fuse into a serrated
- * edge and stop being pins. The die is what keeps the mark clear of `machines`, the next nav
- * row down: a bare body with side ticks and a stack of server units both reduce to "a rectangle
- * with lines", while concentric squares ringed with pins reduce to nothing else in this table.
- */
- models:
- "M5 5h14v14H5zM9 9h6v6H9zM7.5 5V2.4M12 5V2.4M16.5 5V2.4M7.5 19v2.6M12 19v2.6M16.5 19v2.6M5 7.5H2.4M5 12H2.4M5 16.5H2.4M19 7.5h2.6M19 12h2.6M19 16.5h2.6",
- /** Machines (two stacked server units, each with its own status lamp). */
- machines: "M4 4h16v6H4zM4 14h16v6H4zM7 7h.01M7 17h.01",
- usage: "M4 20V10m6 10V4m6 16v-7m4 7H2",
- /** Trace observation (an open eye with its pupil): watching what a run actually did. */
- traces: `${EYE_OUTLINE}M14.7 12a2.7 2.7 0 1 1-5.4 0 2.7 2.7 0 0 1 5.4 0z`,
- /** Benchmark center (a trophy: cup + two handles + base). */
- benchmark:
- "M7 4h10v5a5 5 0 0 1-10 0V4zM7 5H4v1a3 3 0 0 0 3 3m10-4h3v1a3 3 0 0 1-3 3M12 14v4m-4 0h8",
- /** Terminal (a `>_` prompt in a window frame). */
- terminal: "M3 5h18v14H3zM7 9l3 3-3 3M13 15h4",
- /** Company mode's overview (lucide layout-dashboard: four tiles of two heights). */
- orgOverview:
- "M4 3h5a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zM15 3h5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zM15 12h5a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1h-5a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1zM4 16h5a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1z",
- /** The org chart (lucide network: one box over two, joined by a bus). */
- orgChart: "M9 3h6v5H9zM2 16h6v5H2zM16 16h6v5h-6zM5 16v-3h14v3M12 13V8",
- /** The organization calendar: the same calendar the sidebar's time grouping wears. */
- orgCalendar: CALENDAR_ICON,
- /** The ticket board (lucide square-kanban: three columns of unequal height in a frame). */
- orgTickets:
- "M5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zM8 7v7M12 7v4M16 7v9",
- /** Finance (lucide circle-dollar-sign). */
- orgFinance:
- "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8M12 18V6",
- /** The handbook, the company's knowledge base (lucide book-open: two pages meeting at the spine). */
- orgHandbook: "M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",
-} as const;
-
-/** Company mode (lucide building-2: a tower with wings and windows), the settings rail, the sidebar's organization groups and the collapsed rail's toggle. */
-export const COMPANY_MODE_ICON =
- "M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2M10 6h4M10 10h4M10 14h4M10 18h4";
diff --git a/packages/web/src/components/ui/image-zoom.tsx b/packages/web/src/components/ui/image-zoom.tsx
index 6698a2d6..1ad3994b 100644
--- a/packages/web/src/components/ui/image-zoom.tsx
+++ b/packages/web/src/components/ui/image-zoom.tsx
@@ -9,8 +9,8 @@
*/
import { useEffect, useState } from "react";
import { createPortal } from "react-dom";
+import { CloseIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { CloseIcon } from "./icons";
export function ZoomableImage({
src,
diff --git a/packages/web/src/components/ui/info-popover.tsx b/packages/web/src/components/ui/info-popover.tsx
index a311a9ff..6b8befab 100644
--- a/packages/web/src/components/ui/info-popover.tsx
+++ b/packages/web/src/components/ui/info-popover.tsx
@@ -18,8 +18,8 @@
import { useId, useState } from "react";
import type { ReactNode } from "react";
import { createPortal } from "react-dom";
+import { ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { usePortalPanel } from "./use-portal-panel";
/** Circled question mark: the app's 9-radius status circle, with a mark and a dot inside it. */
diff --git a/packages/web/src/components/ui/kbd.tsx b/packages/web/src/components/ui/kbd.tsx
deleted file mode 100644
index 0d89d030..00000000
--- a/packages/web/src/components/ui/kbd.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * A keyboard chord drawn the way the platform writes it: one glyph run on macOS (`⌘W`), one
- * `<kbd>` per token joined by `+` elsewhere (`Ctrl+W`). The size is the picker's existing kbd
- * size; the caller supplies the colour.
- */
-import { Fragment } from "react";
-import { formatChord } from "../../lib/shortcuts/format";
-import { currentPlatform } from "../../lib/shortcuts/platform";
-import { keyboardLayout } from "../../lib/shortcuts/store";
-import type { Chord } from "../../lib/shortcuts/types";
-
-/** `picker`: the dock picker's small kbd beside a row label; `control`: inside a settings control, at the form rung. */
-const sizeClass = {
- picker: "font-mono text-[10px]",
- control: "font-mono text-xs",
-};
-
-export function Kbd({
- chord,
- size: rung = "picker",
- className = "",
-}: {
- chord: Chord;
- size?: keyof typeof sizeClass;
- className?: string;
-}) {
- const platform = currentPlatform();
- const label = formatChord(chord, platform, keyboardLayout() ?? undefined);
- const size = sizeClass[rung];
- if (platform === "mac") return <kbd className={`${size} ${className}`}>{label}</kbd>;
- const tokens = label.split("+");
- return (
- <span className={`inline-flex items-center ${size} ${className}`}>
- {tokens.map((token, i) => (
- <Fragment key={i}>
- {i > 0 && <span aria-hidden>+</span>}
- <kbd>{token}</kbd>
- </Fragment>
- ))}
- </span>
- );
-}
diff --git a/packages/web/src/components/ui/modal.tsx b/packages/web/src/components/ui/modal.tsx
index 68d36fd7..001432e4 100644
--- a/packages/web/src/components/ui/modal.tsx
+++ b/packages/web/src/components/ui/modal.tsx
@@ -19,8 +19,8 @@
import { useEffect, useId, useRef } from "react";
import { createPortal } from "react-dom";
import type { KeyboardEvent as ReactKeyboardEvent, ReactNode, RefObject } from "react";
+import { CloseButton } from "@prismshadow/penguin-ui";
import { setShortcutBlocker } from "../../lib/shortcuts/dispatcher";
-import { CloseButton } from "./icons";
export interface ModalProps {
open: boolean;
diff --git a/packages/web/src/components/ui/option-menu.tsx b/packages/web/src/components/ui/option-menu.tsx
index 4c9bf135..9c4f6ac2 100644
--- a/packages/web/src/components/ui/option-menu.tsx
+++ b/packages/web/src/components/ui/option-menu.tsx
@@ -27,6 +27,7 @@
*/
import { useId, useState } from "react";
import { createPortal } from "react-dom";
+import { ChevronDown } from "@prismshadow/penguin-ui";
import { errorClass, sizeClass, sizeTextClass } from "./input";
import type { ControlSize } from "./input";
import {
@@ -37,7 +38,6 @@ import {
menuRowClass,
menuRowTone,
} from "./field";
-import { ChevronDown } from "./icons";
import { usePortalPanel } from "./use-portal-panel";
export interface OptionMenuChoice<T extends string> {
diff --git a/packages/web/src/components/ui/paged-dialog.tsx b/packages/web/src/components/ui/paged-dialog.tsx
index 3d8a069e..7729d78b 100644
--- a/packages/web/src/components/ui/paged-dialog.tsx
+++ b/packages/web/src/components/ui/paged-dialog.tsx
@@ -12,9 +12,8 @@
* along with the second dimension (Tabs' convention).
*/
import type { ReactNode } from "react";
-import { ICON_GAP } from "../../lib/icon-scale";
+import { CloseButton, ICON_GAP } from "@prismshadow/penguin-ui";
import { Modal } from "./modal";
-import { CloseButton } from "./icons";
import { InfoPopover } from "./info-popover";
export interface PagedDialogItem<K extends string> {
diff --git a/packages/web/src/components/ui/penguin-logo.tsx b/packages/web/src/components/ui/penguin-logo.tsx
deleted file mode 100644
index fd9b243b..00000000
--- a/packages/web/src/components/ui/penguin-logo.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
- * Brand logo (colored penguin emblem): source asset is public/penguin-logo.svg
- * (an important asset, do not modify — the same file also serves as the favicon).
- * The original image is a square on a white background, with className controlling
- * size and rounded-corner cropping — it blends into the page background in light
- * theme, and reads as an app-icon-style white rounded square in dark theme. Purely
- * decorative, hidden from screen readers.
- */
-export function PenguinLogo({ className }: { className?: string }) {
- return (
- <img
- src="/penguin-logo.svg"
- alt=""
- aria-hidden
- draggable={false}
- className={`select-none ${className ?? "h-9 w-9 rounded-lg"}`}
- />
- );
-}
diff --git a/packages/web/src/components/ui/select.tsx b/packages/web/src/components/ui/select.tsx
index 279427a5..1851e7a8 100644
--- a/packages/web/src/components/ui/select.tsx
+++ b/packages/web/src/components/ui/select.tsx
@@ -9,6 +9,7 @@
import { Children, isValidElement, useId, useState } from "react";
import type { ChangeEvent, ReactNode, SelectHTMLAttributes } from "react";
import { createPortal } from "react-dom";
+import { ChevronDown } from "@prismshadow/penguin-ui";
import { errorClass, sizeClass, sizeTextClass } from "./input";
import type { ControlSize } from "./input";
import {
@@ -19,7 +20,6 @@ import {
menuRowClass,
menuRowTone,
} from "./field";
-import { ChevronDown } from "./icons";
import { usePortalPanel } from "./use-portal-panel";
export interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
diff --git a/packages/web/src/components/ui/session-activity-icon.tsx b/packages/web/src/components/ui/session-activity-icon.tsx
deleted file mode 100644
index 7eb173a6..00000000
--- a/packages/web/src/components/ui/session-activity-icon.tsx
+++ /dev/null
@@ -1,168 +0,0 @@
-import { S } from "../../lib/strings";
-import { ICON_SIZE } from "../../lib/icon-scale";
-import { toneDot, toneInk } from "../../lib/tone";
-import type { SessionActivity } from "../../lib/session-activity";
-import { GlyphIcon } from "./glyph-icon";
-import { BACKGROUND_TASKS_ICON, SCHEDULE_ICON } from "./icons";
-
-type Activity = Exclude<SessionActivity, null>;
-
-/**
- * Session-level activity glyphs (sidebar rows + chat header).
- *
- * Three states, three marks — each state is legible from its shape and its motion alone, with
- * colour carrying only the severity every reader shares:
- *
- * - **running** — an hourglass, turning over on a loop, the motion a real hourglass makes.
- * - **compacting** — a bar with a chevron closing on it from each side, squeezing on a loop.
- * Compaction is busy work like any other, so it takes the same `attention` tone as running;
- * what it does not share is the shape, because two live states that differ only in colour are
- * two states a reader has to have been told apart in advance.
- * - **finished, unread** — a small green dot. It is a notification, not a status: it says
- * "there is a reply here you have not seen".
- * - **finished, read** — nothing. The dot is removed rather than muted, so the only marks left
- * in the list are the ones worth acting on. A Session that has never run renders nothing for
- * the same reason (see sessionActivity), which makes the two visually identical by design.
- *
- * Every glyph also names its exact state in its accessible name and tooltip, so nothing here is
- * legible only to a sighted user with full colour vision. The read state announces nothing
- * because it renders nothing, which is correct — there is no state to report.
- *
- * Background work is a separate mark, not a fourth state (BackgroundTasksMark below): an
- * activity trace drawn beside whichever glyph the row wears — an idle, read Session can still
- * own a dev server or a background subagent, and the row says both. A standing scheduled task is
- * a mark of another kind again (ScheduleMark below): it says what the conversation will do
- * without anyone opening it, not what it is doing now, and sits with the row's settled marks
- * ahead of the live states. Each of the two names its own tone where it is defined, so a tone is
- * spelled in one place and cannot go stale in another.
- *
- * Ink comes from the shared tone tokens (lib/tone.ts), which carry the measured contrast ratios
- * against the two surfaces these glyphs sit on: the sidebar (gray-50 / gray-900) and the chat
- * header (white / gray-950).
- */
-export const ACTIVITY_GLYPH: Record<"running" | "compacting", string> = {
- // Hourglass: frame top and bottom, sand funnelling to the waist.
- running: "M6 3h12M6 21h12M8 3v3.5L12 10l4-3.5V3M8 21v-3.5L12 14l4 3.5V21",
- // Compress: a centre bar with a chevron bearing down on it from above and up from below.
- compacting: "M4 12h16M8 7l4 3 4-3M8 17l4-3 4 3",
-};
-
-/**
- * Ink and motion per live state. Both are `attention` — unfinished work waiting on time — and
- * each pairs its tone with the animation that reads as its own kind of work: the hourglass turns
- * over, the compress mark squeezes. The unread dot takes the `success` dot fill, one tone in
- * both themes, exactly as the Session status dot beside it does (sidebar.tsx's StatusDot and its
- * twin in the chat header). It is the same kind of marker in the same place.
- */
-const APPEARANCE: Record<"running" | "compacting", string> = {
- running: `hourglass-turn ${toneInk.attention}`,
- compacting: `compact-squeeze ${toneInk.attention}`,
-};
-
-/** Localized status label (read at render time: `S` is a live binding swapped per locale). */
-export function sessionActivityLabel(activity: Activity): string {
- if (activity === "running") return S.chat.statusRunning;
- if (activity === "compacting") return S.chat.statusCompacting;
- return S.chat.statusCompletedUnread;
-}
-
-/**
- * The background-task mark: "work is going on behind this" wherever the app says so — a
- * session row and the chat header, where it stands for the conversation's whole set of
- * background command processes and subagents, and a tool row, where it marks the one call
- * that was made with `run_in_background`. `busy` ink, the tone for "executing right now": a
- * background command process or a mid-round subagent is still working — it has only left the
- * turn. The chat header's count wears the same tone, so the glyph and the number read alike
- * wherever they appear. The required label below still carries the state in words.
- *
- * Both props are the caller's to decide, because the two placements genuinely differ: the
- * label names a count in one place and a single call in the other, and the size is the rung
- * the surrounding row already uses (a session row's trailing marks, a tool row's inline
- * glyphs). The label is the only carrier of the state — colour and shape never are — so it
- * is required rather than defaulted. Rendered only when there is background work to report:
- * the caller decides, so no row reserves a box for it.
- */
-export function BackgroundTasksMark({ label, size }: { label: string; size: number }) {
- return (
- <span
- role="img"
- aria-label={label}
- data-tooltip={label}
- className={`flex shrink-0 items-center ${toneInk.busy}`}
- >
- <GlyphIcon d={BACKGROUND_TASKS_ICON} size={size} />
- </span>
- );
-}
-
-/**
- * The scheduled-task mark: a session row wears an alarm clock while at least one bound task still
- * has a next fire time (features/schedules' `pendingScheduleSessions`). A task switched off, past
- * its end time, or a one-off that has already run has none and draws nothing — the panel is where
- * it stays visible. `muted` ink, the tone for a mark that should recede: a standing arrangement is
- * settled, not live work, so it joins the row's dim cluster (the pin and the messaging-relay glyph)
- * rather than competing with the hourglass and the pending-approval badge for the eye. `muted` may
- * only mark a state that is already spelled out in text, which the `aria-label` and tooltip below
- * are.
- *
- * Icon only, no count: the row's job is to say that this conversation runs on its own, and how
- * many tasks do it is the panel's business. The label is the only carrier of that meaning, so it
- * is read here rather than passed in — unlike `BackgroundTasksMark`, this mark has one placement
- * and one meaning, and a second wording for it would be a second meaning.
- */
-export function ScheduleMark({ size }: { size: number }) {
- const label = S.chat.sessionScheduled;
- return (
- <span
- role="img"
- aria-label={label}
- data-tooltip={label}
- className={`flex shrink-0 items-center ${toneInk.muted}`}
- >
- <GlyphIcon d={SCHEDULE_ICON} size={size} />
- </span>
- );
-}
-
-export function SessionActivityIcon({ activity }: { activity: Activity }) {
- const size = ICON_SIZE.rowMark;
- const label = sessionActivityLabel(activity);
- if (activity === "completedUnread") {
- // The dot itself is exactly the Session status dot's geometry — `h-1.5 w-1.5`, 6px, the same
- // at both surfaces on main. It is centred inside the same `size` box the hourglass occupies
- // rather than sitting in the row's flow directly, which is what keeps a row from shifting as
- // the glyph appears, swaps shape, or goes away entirely. Centring changes where the 6px sits,
- // never how big it is: the box is the reservation, the dot is the mark.
- return (
- <span
- role="img"
- aria-label={label}
- data-tooltip={label}
- style={{ width: size, height: size }}
- className="flex shrink-0 items-center justify-center"
- >
- <span className={`block h-1.5 w-1.5 rounded-full ${toneDot.success}`} />
- </span>
- );
- }
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- // Live states announce as a status; the unread dot is a plain labelled image (run
- // completion is already announced by the notification path, not this glyph).
- role="status"
- aria-label={label}
- data-tooltip={label}
- className={`block shrink-0 ${APPEARANCE[activity]}`}
- >
- <path d={ACTIVITY_GLYPH[activity]} />
- </svg>
- );
-}
diff --git a/packages/web/src/components/ui/session-row-menu.tsx b/packages/web/src/components/ui/session-row-menu.tsx
index 38768ab6..3cdbf8fc 100644
--- a/packages/web/src/components/ui/session-row-menu.tsx
+++ b/packages/web/src/components/ui/session-row-menu.tsx
@@ -18,34 +18,11 @@
* off the row entirely.
*/
import type { MouseEvent as ReactMouseEvent } from "react";
+import { GlyphIcon, ICONS } from "@prismshadow/penguin-ui";
import type { AnchorRect } from "../../lib/context-menu";
import { S } from "../../lib/strings";
-import { GlyphIcon } from "./glyph-icon";
import { Icon } from "./group-list";
-import { MESSAGING_RELAY_ICON } from "./icons";
import { menuRowClass, menuRowTone } from "./field";
-import { STAT_ICONS } from "../../lib/stat-icons";
-
-/** Pushpin (lucide pin: head + body + stem), the group-header pin toggle / pinned indicator. */
-export const PIN_ICON =
- "M12 17v5M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z";
-
-/** Row-action glyphs (thin-line, matching the shared Icon set): pencil / archive / unarchive / trash. */
-export const PENCIL_ICON = "M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3";
-export const ARCHIVE_ICON =
- "M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M9.5 13.5 12 16l2.5-2.5";
-export const UNARCHIVE_ICON =
- "M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M12 17v-5m-2.5 2L12 11l2.5 3";
-export const TRASH_ICON =
- "M4 6h16M9 6V4.5A1.5 1.5 0 0 1 10.5 3h3A1.5 1.5 0 0 1 15 4.5V6M6 6v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6M10 10.5v6M14 10.5v6";
-/**
- * Three-dot ellipsis, drawn as FILLED circles: the hover "more" button. Hairline-stroke
- * dots vanish at row-glyph size, so this mark renders through GlyphIcon's `filled` mode —
- * the stroke rides on top of the fill, landing the dots at the visual weight of the
- * archive glyph beside it.
- */
-export const ELLIPSIS_ICON =
- "M4.5 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4zM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4zM19.5 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4z";
/** Compact overflow-menu row (session row menu + workspace group menu): small text, leading thin-line glyph. */
export const overflowMenuRowClass = `flex items-center gap-2 ${menuRowClass} text-xs ${menuRowTone()}`;
@@ -127,28 +104,28 @@ export function sessionRowMenuItem(
case "pin":
return {
label: state.pinned ? S.chat.unpinSession : S.chat.pinSession,
- icon: PIN_ICON,
+ icon: ICONS.pin,
danger: false,
};
case "rename":
- return { label: S.chat.renameSession, icon: PENCIL_ICON, danger: false };
+ return { label: S.chat.renameSession, icon: ICONS.pencil, danger: false };
case "copy":
// The same glyph and label the details card's Session id row carries: one copy
// affordance for one value, wherever the reader meets it.
- return { label: S.chat.copySessionId, icon: STAT_ICONS.copy, danger: false };
+ return { label: S.chat.copySessionId, icon: ICONS.copy, danger: false };
case "messaging":
// Same paper plane the session row flies when it is actually relaying: the menu entry
// and the mark it produces are one feature, and a reader should not have to learn two
// shapes for it.
- return { label: S.messaging.bindAction, icon: MESSAGING_RELAY_ICON, danger: false };
+ return { label: S.messaging.bindAction, icon: ICONS.paperPlane, danger: false };
case "archive":
return {
label: state.archived ? S.chat.unarchiveSession : S.chat.archiveSession,
- icon: state.archived ? UNARCHIVE_ICON : ARCHIVE_ICON,
+ icon: state.archived ? ICONS.archiveRestore : ICONS.archive,
danger: false,
};
case "delete":
- return { label: S.chat.deleteSession, icon: TRASH_ICON, danger: true };
+ return { label: S.chat.deleteSession, icon: ICONS.trash, danger: true };
}
}
@@ -245,7 +222,9 @@ export function SessionRowHoverActions({
onClick={openMore}
className={`${hoverButtonClass} hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-200`}
>
- <GlyphIcon d={ELLIPSIS_ICON} size={14} filled />
+ {/* Hairline-stroke dots vanish at row-glyph size, so the ellipsis is drawn filled: the
+ stroke rides on top of the fill, landing the dots at the archive glyph's weight. */}
+ <GlyphIcon d={ICONS.ellipsis} size={14} filled />
</button>
</>
);
diff --git a/packages/web/src/components/ui/sheet.tsx b/packages/web/src/components/ui/sheet.tsx
index 81cb3f90..52019471 100644
--- a/packages/web/src/components/ui/sheet.tsx
+++ b/packages/web/src/components/ui/sheet.tsx
@@ -26,7 +26,7 @@
*/
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
import type { PointerEvent as ReactPointerEvent, ReactNode } from "react";
-import { CloseButton } from "./icons";
+import { CloseButton } from "@prismshadow/penguin-ui";
import { usePrefersReducedMotion } from "./use-reduced-motion";
import { SPRING_DEFAULT, SPRING_MOMENTUM, createSpringDriver } from "../../lib/spring";
import type { SpringDriver } from "../../lib/spring";
diff --git a/packages/web/src/components/ui/skeleton.tsx b/packages/web/src/components/ui/skeleton.tsx
deleted file mode 100644
index 9c423520..00000000
--- a/packages/web/src/components/ui/skeleton.tsx
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Skeleton screen component (list and detail views use
- * skeleton screens while loading).
- * Placeholder blocks share the same border/rounding/background as the real
- * container, giving zero layout shift from "loading" to "loaded" (matching the
- * LangSmith-style feel of pre-loading placeholders shaped like the real layout).
- */
-import type { ReactNode } from "react";
-
-export function Skeleton({ className }: { className?: string }) {
- return (
- <div
- className={`animate-pulse rounded bg-gray-200 dark:bg-gray-800 ${className ?? "h-4 w-full"}`}
- />
- );
-}
-
-/** Multi-row skeleton (placeholder for list loading). */
-export function SkeletonList({ rows = 3 }: { rows?: number }) {
- return (
- <div className="space-y-2 p-2">
- {Array.from({ length: rows }, (_, i) => (
- <Skeleton key={i} className="h-8 w-full" />
- ))}
- </div>
- );
-}
-
-/**
- * Card skeleton: same border/rounding as a real card; defaults to a three-part
- * placeholder (title + main value + subline), and children can override the
- * inner layout. className fully replaces the default p-4 (when Tailwind classes
- * for the same property coexist, which one wins depends on stylesheet order, so
- * appending an override is unreliable) — when passing className, include padding
- * as well.
- */
-export function SkeletonCard({
- className,
- children,
-}: {
- className?: string;
- children?: ReactNode;
-}) {
- return (
- <div
- className={`rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900 ${className ?? "p-4"}`}
- >
- {children ?? (
- <>
- <Skeleton className="h-3 w-20" />
- <Skeleton className="mt-2.5 h-6 w-28" />
- <Skeleton className="mt-2.5 h-3 w-24" />
- </>
- )}
- </div>
- );
-}
diff --git a/packages/web/src/components/ui/status-icon.tsx b/packages/web/src/components/ui/status-icon.tsx
deleted file mode 100644
index b92e94c3..00000000
--- a/packages/web/src/components/ui/status-icon.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * Run state icon (shared by the chat page's "reasoning & tools" group and tool
- * cards): a spinning ring while running, a static glyph otherwise — "still
- * running" vs. "done" can be told apart at a glance, no need to read the text.
- */
-import { toneInk } from "../../lib/tone";
-
-export type RunState = "running" | "waiting" | "done" | "failed" | "stopped";
-
-const GLYPH: Record<Exclude<RunState, "running">, string> = {
- // Hourglass (waiting for approval)
- waiting: "M6 3h12M6 21h12M8 3v3.5L12 10l4-3.5V3M8 21v-3.5L12 14l4 3.5V21",
- // Checkmark (completed)
- done: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm-3.5-9.2 2.4 2.5 4.6-4.8",
- // X (failed / interrupted)
- failed: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9 9l6 6m0-6-6 6",
- // Square (ended on purpose — neither a success to tick nor a fault to flag)
- stopped: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM8.5 8.5h7v7h-7z",
-};
-
-/** Shared status tones (lib/tone.ts): a settled row recedes, an unfinished one asks for a look. */
-const TONE: Record<RunState, string> = {
- running: toneInk.busy,
- waiting: toneInk.attention,
- done: toneInk.muted,
- failed: toneInk.danger,
- // A stop is settled and expected: it recedes like "done" rather than flagging danger.
- stopped: toneInk.muted,
-};
-
-export function StatusIcon({
- state,
- size = 13,
- label,
-}: {
- state: RunState;
- size?: number;
- /** The icon carries no text of its own; this supplies a status description (visible on hover). */
- label?: string;
-}) {
- if (state === "running") {
- return (
- <span
- {...(label
- ? { "data-tooltip": label, "aria-label": label, role: "status" }
- : { "aria-hidden": true })}
- style={{ width: size, height: size }}
- className={`inline-block shrink-0 animate-spin rounded-full border-[1.5px] border-current border-t-transparent ${TONE.running}`}
- />
- );
- }
- return (
- <svg
- width={size}
- height={size}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- strokeWidth="1.7"
- strokeLinecap="round"
- strokeLinejoin="round"
- // Without a label, this icon is decorative (the status is already conveyed by
- // adjacent text): it must not have role="img" without an accessible name, or
- // a screen reader would announce it as an anonymous image.
- {...(label
- ? { role: "img" as const, "aria-label": label, "data-tooltip": label }
- : { "aria-hidden": true })}
- className={`block shrink-0 ${TONE[state]}`}
- >
- <path d={GLYPH[state]} />
- </svg>
- );
-}
diff --git a/packages/web/src/components/ui/tabs.tsx b/packages/web/src/components/ui/tabs.tsx
index 8d9fe9a3..8673247a 100644
--- a/packages/web/src/components/ui/tabs.tsx
+++ b/packages/web/src/components/ui/tabs.tsx
@@ -2,7 +2,7 @@
* Tab switcher component (controlled): GitHub-style underline; scrolls
* horizontally on narrow screens.
*/
-import { UpdateDot } from "./update-dot";
+import { UpdateDot } from "@prismshadow/penguin-ui";
export interface TabItem<K extends string = string> {
key: K;
diff --git a/packages/web/src/components/ui/todo-notice.tsx b/packages/web/src/components/ui/todo-notice.tsx
index cddc637d..552f7cff 100644
--- a/packages/web/src/components/ui/todo-notice.tsx
+++ b/packages/web/src/components/ui/todo-notice.tsx
@@ -39,9 +39,7 @@
* want the same gap under their title. A page whose container spaces its children (the cost
* center's `space-y-4`) overrides it, which is the right answer there too.
*/
-import { Button } from "./button";
-import { UPDATE_DOT_INLINE } from "./update-dot";
-import { ICON_GAP } from "../../lib/icon-scale";
+import { Button, ICON_GAP, UPDATE_DOT_INLINE } from "@prismshadow/penguin-ui";
import { NoticeStrip } from "./notice-strip";
export function TodoNotice({
diff --git a/packages/web/src/components/ui/update-dot.tsx b/packages/web/src/components/ui/update-dot.tsx
deleted file mode 100644
index c9965439..00000000
--- a/packages/web/src/components/ui/update-dot.tsx
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * The update notification badge: a small dot hung on the top-right corner of whatever entry
- * leads toward something updatable, the way a phone marks a menu that has news behind it.
- *
- * **Not a status tone, deliberately.** `lib/tone.ts` is the one place a *status* colour is
- * spelled, and each of its five tones is a judgement about a thing's own state — `danger` is
- * failed, destructive or over a limit; `attention` is unfinished work waiting on someone. An
- * available update is neither: nothing has gone wrong and nothing is stuck. What this mark
- * says is "there is something new further down this path", a category `tone.ts` explicitly
- * keeps out of scope. So the badge colour lives here instead, written once, and every dot on
- * an update trail renders through this component rather than spelling a palette class inline.
- * The carve-out is about the MARK. The block one of these dots sits inside on a page
- * (`todo-notice.tsx`) is an ordinary `toneStrip.attention` notice: a bordered strip with a
- * ground of its own is a shape `tone.ts` does own, and what it says there — unfinished, waiting
- * on the user — is one of its five meanings.
- *
- * Red, because that is what a notification badge is everywhere else a user has seen one, and
- * `red-400`, the pale rung, so the mark reads as news rather than as an alarm. WCAG 2.x contrast
- * against the six surfaces a dot lands on — in light, 2.89 : 1 on white, 2.76 : 1 on the
- * sidebar's gray-50 and 2.46 : 1 on a nav row's active/hover fill (gray-200/70 over gray-50); in
- * dark, 7.27 : 1 on gray-950 (`#000000` here), 6.73 : 1 on gray-900 (`#0d0d0d` here) and
- * 5.71 : 1 on gray-800. Dark clears on all three the 3 : 1 WCAG 1.4.11 asks of a graphical
- * object; light misses on all three, by 4% to 18%, knowingly. 1.4.11 scopes to a graphical
- * object *required* to understand the content, and this one never is: it is `aria-hidden`, and
- * its anchor states what is updatable in its own `title` and accessible name, so no information
- * reaches the user through the mark alone. Light is what binds: red-500 is the palest rung on
- * Tailwind's red ramp that clears 3 : 1 on all three light surfaces (3.81 / 3.64 / 3.25 : 1), so
- * the pale end of the ramp and the threshold do not overlap. One value across both themes, for
- * the reason `toneDot` keeps one: a dot this small has no interior to read.
- *
- * **The dot never carries the meaning.** It is `aria-hidden`, and the anchor states what is
- * updatable in its own `title` and accessible name ("<anchor> · <what is updatable>"). A
- * decorative dot with no accessible text beside it is the bug this pattern usually ships with.
- *
- * Layout-neutral: absolutely positioned, so a caller only has to be `relative`, and no row
- * changes height for carrying one. `pointer-events-none` keeps it out of its anchor's hit area.
- *
- * Anchoring rule, owner-specified: a dot marks its control's **full box** — the whole row, tab or
- * button — never the label glyphs, where it would track the text's width, float over whatever
- * follows the word and ride above the line box. Two shapes of box, two placements. A full-width
- * row hangs the dot at the right edge, vertically centred (`right-2.5 top-1/2 -translate-y-1/2`,
- * the inset matching the row's own horizontal padding): a row has an end to align to and no
- * corner a reader's eye goes to. A button or a tab takes the top-right corner, straddling the
- * border where that corner is visible and pulled inside the padding where an ancestor clips it
- * (the tab strip's `overflow-y-hidden`). Chrome anchors are their own box, so their default
- * overhang stands.
- */
-import type { ReactNode } from "react";
-
-/**
- * Sizes named by the anchor they sit on, not by a number (the `icon-scale.ts` convention).
- * Note the web root font is 18px, so a Tailwind spacing unit is 1.125× its usual pixel value:
- * `h-2.5` is 11.25px, `h-1.5` is 6.75px.
- */
-const DOT_SIZE = {
- /**
- * A filled or boxed chrome anchor — an avatar, a rail icon button, the mobile menu button.
- * The ring is the chrome's own background colour (gray-50 pinned/rail sidebar, gray-900 in
- * dark), which is what separates the dot from the avatar fill or the row's hover fill
- * underneath it; 11.25px outer leaves a 7.25px core.
- */
- chrome: "h-2.5 w-2.5 border-2 border-gray-50 dark:border-gray-900",
- /**
- * A line of text or a bare glyph, where the dot sits directly on the page surface: no ring,
- * because there is nothing underneath to separate it from and a ring would only shrink it.
- */
- inline: "h-1.5 w-1.5",
-} as const;
-
-export type UpdateDotSize = keyof typeof DOT_SIZE;
-
-/**
- * The dot's fill and inline size without the positioning — for the one mark on an update trail
- * that sits in normal flow rather than over an anchor (`todo-notice.tsx`). Exported so the red
- * stays written once, here, for the reason the header gives.
- */
-export const UPDATE_DOT_INLINE = `rounded-full bg-red-400 ${DOT_SIZE.inline}`;
-
-export function UpdateDot({
- size = "chrome",
- position = "-right-0.5 -top-0.5",
-}: {
- size?: UpdateDotSize;
- /**
- * Where the dot sits inside its `relative` anchor — Tailwind inset utilities, plus a
- * `translate-*` where the dot is centred on an edge or straddles a corner instead of being
- * inset from one. The default hangs it just past the anchor's top-right corner; an anchor
- * whose own padding or a clipping ancestor would swallow that (a tab strip's
- * `overflow-y-hidden`) moves it in.
- */
- position?: string;
-}) {
- return (
- <span
- aria-hidden
- className={`pointer-events-none absolute rounded-full bg-red-400 ${DOT_SIZE[size]} ${position}`}
- />
- );
-}
-
-/**
- * The labeled form of the badge, for the one stop on a trail where a bare dot undersells the
- * state: the Agents list card of an outdated Agent, which is also the control the sidebar's
- * dot leads to. A real button — it opens the Agent settings overview the trail ends on —
- * shaped exactly like the `Badge` pills sharing its row (`v<version>`: same radius, padding
- * and 11px semibold type), so the row reads as one family of capsules.
- *
- * A tinted capsule, not the dot's flat fill: this one has an interior, so its label owes WCAG
- * 1.4.3's 4.5 : 1 against its own background, and a surface pale enough to belong beside the
- * dots can only pay that with a dark ink.
- *
- * **How pale is set by the capsule beside it, not by taste.** The fill is measured against the
- * card it sits on — white in light, gray-900 (`#0d0d0d` here) in dark — and aimed at the plain
- * gray `Badge` sharing the row, which shows at 1.10 : 1 in light and 1.18 : 1 in dark. red-50
- * lands at 1.09 : 1 and red-950/70 at 1.11 : 1, so the capsule now reads as red without
- * reading as an alarm; the earlier red-100 / red-950 pair sat a fifth louder than its
- * neighbour, which is what made it shout. The ink is unchanged and keeps a wide margin:
- * red-800 on red-50 7.67 : 1 (hover red-100 6.86 : 1) in light, red-300 on red-950/70
- * 9.13 : 1 (hover red-950 8.40 : 1) in dark. Tint against card rather than ink against card is
- * what the neighbouring gray `Badge` also runs on: the capsule is found by its text.
- * The badge colours stay in this module, with the dot's, for the reason the header gives — an
- * update mark is not a `tone.ts` status.
- */
-export function UpdatePill({ onClick, children }: { onClick: () => void; children: ReactNode }) {
- return (
- <button
- type="button"
- onClick={onClick}
- className="inline-flex shrink-0 items-center whitespace-nowrap rounded-full bg-red-50 px-2 py-0.5 text-[11px] font-semibold text-red-800 transition-colors duration-150 hover:bg-red-100 dark:bg-red-950/70 dark:text-red-300 dark:hover:bg-red-950"
- >
- {children}
- </button>
- );
-}
diff --git a/packages/web/src/components/ui/user-avatar.tsx b/packages/web/src/components/ui/user-avatar.tsx
deleted file mode 100644
index 14b4640a..00000000
--- a/packages/web/src/components/ui/user-avatar.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * The signed-in account's avatar, wherever it is drawn: the sidebar's bottom user row, the
- * collapsed rail's trigger, the account menu's header, and the Profile page's preview.
- *
- * Two states, one component. With an avatar stored it is that image, cropped to the circle;
- * without one it is the letter tile the app has always drawn — a solid dark disc with the
- * initial in white, which is deliberately NOT the tinted hashed tile `AgentAvatar` uses: an
- * account is the one identity the viewer already knows, so it does not need a colour to be
- * told apart from its neighbours, and there is only ever one of it on screen. The initial
- * follows the nickname once there is one, falling back to the id, so the tile changes with
- * the name rather than contradicting it.
- *
- * `size` is in pixels and the letter's size is derived from it, rather than both coming from
- * the type scale: the disc is a fixed box, so a letter that grew with the user's font-size
- * setting would outgrow it at the largest tier. The two rungs in use are named below.
- */
-import type { CSSProperties, ReactNode } from "react";
-
-import { avatarInitial } from "../../lib/avatar";
-
-/**
- * The sizes a user avatar is drawn at, named by the slot rather than by the number (the
- * `icon-scale.ts` convention). `tile` is what the nav row, the rail and the menu header share
- * — the three must stay identical, because collapsing the sidebar swaps one for another and a
- * changed size would pop. `preview` is the Profile page, where the avatar is the subject.
- */
-export const USER_AVATAR_SIZE = { tile: 28, preview: 64 } as const;
-
-/** The letter's share of the disc: large enough to read at 28px, still inside the circle at 64. */
-const INITIAL_RATIO = 0.45;
-
-export function UserAvatar({
- userId,
- displayName,
- avatar,
- size = USER_AVATAR_SIZE.tile,
- className,
- children,
-}: {
- /** The account's id — the fallback initial, and what the accessible name names. */
- userId: string;
- /** Nickname, when set: it supplies the initial and the accessible name. */
- displayName?: string;
- /** Stored avatar as a data URL; absent, the letter tile is drawn. */
- avatar?: string;
- /** Edge length in pixels — pass a `USER_AVATAR_SIZE` rung. */
- size?: number;
- className?: string;
- /** Overlay slot, positioned against this disc: the nav and rail triggers hang UpdateDot here. */
- children?: ReactNode;
-}) {
- const who = displayName ?? userId;
- const box: CSSProperties = { width: size, height: size };
- if (avatar !== undefined) {
- return (
- <span className={`relative block shrink-0 ${className ?? ""}`} style={box}>
- {/* object-cover, though a stored avatar is already square: one written by an API client
- rather than by the Profile page's crop must still fill the circle, not stretch into
- it. alt="" for the reason the letter tile is aria-hidden — see below. */}
- <img src={avatar} alt="" className="h-full w-full rounded-full object-cover" style={box} />
- {children}
- </span>
- );
- }
- return (
- <span
- // Decorative, like the image above: the mark is never the account's name. Every anchor
- // this sits in already names the account, in its own accessible name or in the text
- // beside it, so announcing a bare initial as well would only repeat the first letter.
- aria-hidden
- className={`relative flex shrink-0 items-center justify-center rounded-full bg-gray-900 font-bold text-white dark:bg-gray-200 dark:text-gray-900 ${className ?? ""}`}
- style={{ ...box, fontSize: Math.round(size * INITIAL_RATIO) }}
- >
- {avatarInitial(who, userId)}
- {children}
- </span>
- );
-}
diff --git a/packages/web/src/features/admin/admin-users-page.tsx b/packages/web/src/features/admin/admin-users-page.tsx
index 8e2f2cbe..acece105 100644
--- a/packages/web/src/features/admin/admin-users-page.tsx
+++ b/packages/web/src/features/admin/admin-users-page.tsx
@@ -7,6 +7,7 @@
*/
import { useCallback, useEffect, useState } from "react";
import type { UserInfo } from "@prismshadow/penguin-server/api";
+import { Badge, Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
@@ -14,8 +15,6 @@ import { apiErrorText } from "../../lib/api-error";
import { USERNAME_PATTERN } from "../../lib/semantic-id";
import { formatDateTime } from "../../lib/format";
import { useAuth } from "../../state/auth";
-import { Badge } from "../../components/ui/badge";
-import { Button } from "../../components/ui/button";
import { Input } from "../../components/ui/input";
import { PasswordInput } from "../../components/ui/password-input";
import { Modal } from "../../components/ui/modal";
@@ -76,7 +75,7 @@ export function AdminUsersSection() {
{u.userId}
{u.passwordIsInitial && (
<span className="ml-2 align-middle">
- <Badge tone="gray">{S.admin.initialPasswordFlag}</Badge>
+ <Badge>{S.admin.initialPasswordFlag}</Badge>
</span>
)}
{/* The nickname under the id, not instead of it: every other control on the
@@ -89,7 +88,7 @@ export function AdminUsersSection() {
)}
</td>
<td className="whitespace-nowrap px-3 py-2">
- <Badge tone="gray">{u.isAdmin ? S.admin.roleAdmin : S.admin.roleUser}</Badge>
+ <Badge>{u.isAdmin ? S.admin.roleAdmin : S.admin.roleUser}</Badge>
</td>
<td className="whitespace-nowrap px-3 py-2 text-gray-500 dark:text-gray-400">
{formatDateTime(u.createdAt)}
diff --git a/packages/web/src/features/agents/agent-settings-page.tsx b/packages/web/src/features/agents/agent-settings-page.tsx
index c6160415..8bf054cb 100644
--- a/packages/web/src/features/agents/agent-settings-page.tsx
+++ b/packages/web/src/features/agents/agent-settings-page.tsx
@@ -22,6 +22,16 @@ import type {
AgentModelConfigDto,
} from "@prismshadow/penguin-server/api";
import type { ToolDefinitionConfig, ToolPermission } from "@prismshadow/penguin-core/interfaces";
+import {
+ Button,
+ CopyButton,
+ GlyphIcon,
+ HiddenFileInput,
+ ICONS,
+ ICON_SIZE,
+ Skeleton,
+ UpdateDot,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
@@ -29,17 +39,11 @@ import { apiErrorText } from "../../lib/api-error";
import { useDocumentTitle } from "../../lib/use-document-title";
import { useProject } from "../../state/project";
import { Tabs } from "../../components/ui/tabs";
-import { Button } from "../../components/ui/button";
import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
-import { HiddenFileInput } from "../../components/ui/hidden-file-input";
import { Input, Textarea } from "../../components/ui/input";
import { OptionMenu, type OptionMenuChoice } from "../../components/ui/option-menu";
import { Switch } from "../../components/ui/switch";
import { ConfirmModal, useSaveConfirm } from "../../components/ui/confirm-modal";
-import { CopyButton, ROW_COPY_CLASS } from "../../components/ui/copy-button";
-import { Skeleton } from "../../components/ui/skeleton";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { UpdateDot } from "../../components/ui/update-dot";
import { SkillsTab } from "./skills-tab";
import { HooksTab } from "./hooks-tab";
import { MemoryTab } from "./memory-tab";
@@ -50,7 +54,6 @@ import { McpServersSection } from "./mcp-servers-section";
import { SNAPSHOT_ACCEPT, SNAPSHOT_BUTTON_CLASS, fileToBase64 } from "./snapshot-file";
import { thinkingLevelOptionsFor } from "../chat/thinking-level";
import { InfoPopover } from "../../components/ui/info-popover";
-import { ICON_SIZE } from "../../lib/icon-scale";
type TabKey =
| "overview"
@@ -261,7 +264,7 @@ export function AgentSettingsPage() {
onClick={() => navigate("/agents")}
className="-ml-2 mb-3 text-gray-500 dark:text-gray-400"
>
- <GlyphIcon d="M15 18l-6-6 6-6M9 12h12" size={ICON_SIZE.rowLead} />
+ <GlyphIcon d={ICONS.arrowLeft} size={ICON_SIZE.rowLead} />
{S.agent.backToList}
</Button>
<h1 className="mb-1 text-xl font-semibold">{data.config.name ?? agentId}</h1>
@@ -313,9 +316,6 @@ export function AgentSettingsPage() {
type SaveFn = (update: AgentConfigUpdateRequest) => Promise<void>;
-/** Kernel-outdated hint icon (rotate-cw, 24×24 line path — the skill library's update glyph). */
-const KERNEL_UPDATE_ICON = "M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10";
-
function OverviewTab({
data,
agentId,
@@ -505,7 +505,8 @@ function OverviewTab({
<CopyButton
text={data.stateDir}
label={S.agent.copyStateDir}
- className={ROW_COPY_CLASS}
+ size="sm"
+ className="shrink-0"
/>
</div>
</div>
@@ -578,7 +579,7 @@ function OverviewTab({
aria-label={S.agent.kernelOutdatedHint}
className="self-center text-gray-500 dark:text-gray-400"
>
- <GlyphIcon d={KERNEL_UPDATE_ICON} size={12} />
+ <GlyphIcon d={ICONS.rotateCw} size={12} />
</span>
</>
) : (
diff --git a/packages/web/src/features/agents/agents-page.tsx b/packages/web/src/features/agents/agents-page.tsx
index 0164c2c3..e7b7af09 100644
--- a/packages/web/src/features/agents/agents-page.tsx
+++ b/packages/web/src/features/agents/agents-page.tsx
@@ -26,6 +26,20 @@ import type {
PluginItem,
SkillMetadataItem,
} from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ Badge,
+ Button,
+ CloseIcon,
+ EmptyState,
+ GlyphIcon,
+ HiddenFileInput,
+ ICONS,
+ ICON_SIZE,
+ Skeleton,
+ SkeletonCard,
+ UpdatePill,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
@@ -38,29 +52,14 @@ import { bulkOutcome, failedList, firstFailure, noticeCounts } from "../../lib/b
import { useAuth } from "../../state/auth";
import { useLocale } from "../../state/locale";
import { agentDisplayName, useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
import { Input, Textarea } from "../../components/ui/input";
import { FieldError, FieldHint, FieldLabel } from "../../components/ui/field";
import { FormPicker } from "../../components/ui/form-picker";
import { Modal } from "../../components/ui/modal";
import { ConfirmModal } from "../../components/ui/confirm-modal";
import { toastError, toastSuccess } from "../../components/ui/toast";
-import { Badge } from "../../components/ui/badge";
-import { Skeleton, SkeletonCard } from "../../components/ui/skeleton";
-import { EmptyState } from "../../components/ui/empty-state";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { UpdatePill } from "../../components/ui/update-dot";
import { TodoNotice } from "../../components/ui/todo-notice";
import { SemanticIdField } from "../semantic-id/semantic-id-field";
-import {
- CloseIcon,
- GEAR_ICON,
- HOOK_ICON,
- MEMORY_ICON,
- PLUGIN_ICON,
- SCHEDULE_ICON,
-} from "../../components/ui/icons";
import { STAT_ICONS } from "../../lib/stat-icons";
import { DRAFT_SESSION_ID } from "../chat/chat-page";
import { prepareNewChatDraft } from "../chat/new-chat";
@@ -71,12 +70,10 @@ import {
agentIdFromSnapshotName,
fileToBase64,
} from "./snapshot-file";
-import { HiddenFileInput } from "../../components/ui/hidden-file-input";
import { WorkspaceSelect } from "../chat/workspace-select";
import { SkillPickList } from "../skills/skill-pick-list";
import type { PickableItem } from "../skills/skill-pick-list";
import { addSkillNames, removeSkillNames, toggleSkillName } from "../skills/skill-selection";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { AiCreateModal, CreateButtons } from "../ai-create";
import { mergeAgents } from "../../lib/benchmark-merge";
import type { AgentSource } from "../../lib/benchmark-merge";
@@ -88,23 +85,23 @@ const BUILTIN_AGENT_IDS = new Set(["default_agent"]);
/** Card button icons (24x24 line path, rendered via GlyphIcon). */
const CARD_ICONS = {
/** New chat (plus sign) */
- newChat: "M12 5v14M5 12h14",
+ newChat: ICONS.plus,
/** Delete (trash can) */
trash:
"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0l-1 13a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 7m4 4v6m4-6v6",
/** Total session count (chat bubble) */
sessions: "M8 10h8M8 14h5M21 12a9 9 0 1 1-4-7.5",
/** Vault key count (key: bow + teeth) */
- vaultKeys: "M15.5 7.5l3 3L22 7l-3-3M21 2l-9.6 9.6M13 15.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z",
+ vaultKeys: ICONS.key,
/** Schedule count: the alarm clock every scheduled-task surface wears. */
- schedules: SCHEDULE_ICON,
+ schedules: ICONS.alarmClock,
/** Installed skill count (open book, same family as the plugin library) */
skills:
"M12 6.5C10.5 5 8 4.5 4 5v12c4-.5 6.5 0 8 1.5 1.5-1.5 4-2 8-1.5V5c-4-.5-6.5 0-8 1.5zm0 0V18",
/** Usage (bar chart, same as sidebar "Usage Center") */
- usage: "M4 20V10m6 10V4m6 16v-7m4 7H2",
+ usage: ICONS.barChart,
/** Memory count: the brain every Memory surface wears; opens the settings tab. */
- memory: MEMORY_ICON,
+ memory: ICONS.brain,
} as const;
/**
@@ -121,7 +118,7 @@ const STAT_LINK_CLASS =
* puzzle piece rather than the book.
*/
function pluginPickItems(plugins: readonly PluginItem[]): PickableItem[] {
- return plugins.map((plugin) => ({ ...plugin, fallbackIcon: PLUGIN_ICON }));
+ return plugins.map((plugin) => ({ ...plugin, fallbackIcon: ICONS.puzzle }));
}
export function AgentsPage() {
@@ -588,7 +585,7 @@ export function AgentsPage() {
<span className="hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500">
{a.agentId}
</span>
- <Badge tone="gray">v{a.version}</Badge>
+ <Badge>v{a.version}</Badge>
{/* Kernel-outdated pill: the card the sidebar's Agents dot leads to, so it
names the state in words rather than as another bare dot — a capsule in
the version badge's own geometry, tinted the same pale red the dots on
@@ -654,7 +651,7 @@ export function AgentsPage() {
aria-label={S.hooks.hookCount(a.hookCount)}
onClick={() => openSettingsTab(a.agentId, "hooks")}
>
- <GlyphIcon d={HOOK_ICON} size={ICON_SIZE.inlineGlyph} />
+ <GlyphIcon d={ICONS.fishHook} size={ICON_SIZE.inlineGlyph} />
{a.hookCount}
</button>
<button
@@ -726,7 +723,7 @@ export function AgentsPage() {
navigate(`/agents/${a.agentId}`);
}}
>
- <GlyphIcon d={GEAR_ICON} />
+ <GlyphIcon d={ICONS.gear} />
{S.common.settings}
</Button>
<Button
diff --git a/packages/web/src/features/agents/hooks-tab.tsx b/packages/web/src/features/agents/hooks-tab.tsx
index 3a83af78..a0ed10a5 100644
--- a/packages/web/src/features/agents/hooks-tab.tsx
+++ b/packages/web/src/features/agents/hooks-tab.tsx
@@ -22,24 +22,29 @@
import { useCallback, useEffect, useState } from "react";
import type { ChangeEvent } from "react";
import type { HookItem } from "@prismshadow/penguin-server/api";
+import {
+ Badge,
+ Button,
+ CopiedStatus,
+ CopyCheckGlyph,
+ DownloadIcon,
+ GlyphIcon,
+ HiddenFileInput,
+ ICONS,
+ SettingsEmpty,
+ SkeletonList,
+ useCopied,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useLocale } from "../../state/locale";
import { agentDisplayName, useProject } from "../../state/project";
-import { Badge } from "../../components/ui/badge";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { CopiedStatus, CopyCheckGlyph, useCopied } from "../../components/ui/copy-button";
-import { SettingsEmpty } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { HelpFold } from "../../components/ui/help-fold";
-import { HiddenFileInput } from "../../components/ui/hidden-file-input";
-import { DownloadIcon, HOOK_ICON } from "../../components/ui/icons";
import { Textarea } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
-import { SkeletonList } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { localizedText } from "../chat/skill-use";
import { SkillTile } from "../skills/skill-icon-view";
@@ -259,7 +264,7 @@ export function HooksTab({
<SkillTile
icon={hook.icon}
name={hook.name}
- fallback={HOOK_ICON}
+ fallback={ICONS.fishHook}
size={36}
glyph={20}
/>
diff --git a/packages/web/src/features/agents/mcp-servers-section.tsx b/packages/web/src/features/agents/mcp-servers-section.tsx
index 5d104cfb..86cd6650 100644
--- a/packages/web/src/features/agents/mcp-servers-section.tsx
+++ b/packages/web/src/features/agents/mcp-servers-section.tsx
@@ -18,16 +18,15 @@
*/
import { useState } from "react";
import type { MCPServerConfig } from "@prismshadow/penguin-core/interfaces";
+import { Button, SettingsEmpty } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import type { McpServerTestResponse } from "@prismshadow/penguin-server/api";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
import { Input, Textarea } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { SettingsEmpty } from "../../components/ui/empty-state";
import { OptionMenu, type OptionMenuChoice } from "../../components/ui/option-menu";
import { Segmented } from "../../components/ui/segmented";
import { toastError, toastSuccess } from "../../components/ui/toast";
diff --git a/packages/web/src/features/agents/memory-tab.tsx b/packages/web/src/features/agents/memory-tab.tsx
index b2333a43..ca10df9f 100644
--- a/packages/web/src/features/agents/memory-tab.tsx
+++ b/packages/web/src/features/agents/memory-tab.tsx
@@ -29,6 +29,21 @@ import type {
MemoryScopeExport,
MemoryScopeInfo,
} from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ Chevron,
+ CopiedStatus,
+ CopyCheckGlyph,
+ DownloadIcon,
+ GlyphIcon,
+ HiddenFileInput,
+ ICONS,
+ IconButton,
+ SkeletonList,
+ UploadIcon,
+ buttonClass,
+ useCopied,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
@@ -36,22 +51,15 @@ import { formatRelativeDate } from "../../lib/format";
import { useAuth } from "../../state/auth";
import { useLocale } from "../../state/locale";
import { useProject } from "../../state/project";
-import { Button, labelButtonClass } from "../../components/ui/button";
-import { CopiedStatus, CopyCheckGlyph, useCopied } from "../../components/ui/copy-button";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { InfoPopover } from "../../components/ui/info-popover";
import { HelpFold } from "../../components/ui/help-fold";
import { Modal } from "../../components/ui/modal";
import { Textarea } from "../../components/ui/input";
import { rowDescClass } from "../../components/ui/option-menu";
import { Switch } from "../../components/ui/switch";
-import { Chevron } from "../../components/ui/chevron";
-import { DownloadIcon, UploadIcon } from "../../components/ui/icons";
-import { HiddenFileInput } from "../../components/ui/hidden-file-input";
import { Drawer } from "../../components/ui/drawer";
import { Sheet, type SheetSnap } from "../../components/ui/sheet";
import { ConfirmModal, useSaveConfirm } from "../../components/ui/confirm-modal";
-import { SkeletonList } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { Md } from "../chat/md";
import { useAiBridge } from "../ai-create";
@@ -70,21 +78,21 @@ import { NoticeStrip } from "../../components/ui/notice-strip";
/** Same breakpoint as the chat page's panels: \u22651024px the view opens as a side Drawer, below it as a bottom Sheet. */
const DESKTOP_QUERY = "(min-width: 1024px)";
-/** Row-action glyphs (icon-only buttons, the skills tab's affordance): view = the agents page's eye, edit = the shared pencil-line, delete = the shared trash can. */
-const EYE_ICON =
- "M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z";
+/**
+ * Row-action glyphs (icon-only buttons, the skills tab's affordance) that differ from the
+ * registry's drawings: edit is feather's edit-3 (`ICONS.penLine` is a wider pen), delete is the
+ * tapered bin (`ICONS.trash` is straight-sided). View reads `ICONS.eye`.
+ */
const PENCIL_ICON = "M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z";
const TRASH_ICON =
"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0l-1 13a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 7m4 4v6m4-6v6";
-/** "Add" plus glyph on the group headers, matching the models page's per-group add entry. */
-const PLUS_ICON = "M12 5v14M5 12h14";
/**
* The small ghost button's look on a `<label>`: the Button component only renders a `<button>`,
* and the import control has to wrap a file input (the Agent State section's transfer label does
* the same for its own size). Mirrors Button's `ghost` variant at `sm`, icon + text.
*/
-const GHOST_LABEL_CLASS = labelButtonClass("ghost", "sm");
+const GHOST_LABEL_CLASS = buttonClass("ghost", "sm");
/**
* Collapsed scope keys, persisted per user \u00d7 Project \u00d7 Agent (localStorage, same conventions as
@@ -484,31 +492,28 @@ export function MemoryTab({
// variant with red text/hover for delete); the tooltip + aria-label carry the wording.
const rowActions = (scope: MemoryScopeInfo, file: MemoryFileInfo) => (
<div className="flex shrink-0 items-center gap-1.5">
- <Button
- size="icon"
+ <IconButton
+ label={`${S.memory.view} ${file.title}`}
title={S.memory.view}
- aria-label={`${S.memory.view} ${file.title}`}
onClick={() => void openView(scope, file)}
>
- <GlyphIcon d={EYE_ICON} size={14} className="text-gray-600 dark:text-gray-300" />
- </Button>
- <Button
- size="icon"
+ <GlyphIcon d={ICONS.eye} size={14} className="text-gray-600 dark:text-gray-300" />
+ </IconButton>
+ <IconButton
+ label={`${S.memory.edit} ${file.title}`}
title={S.memory.edit}
- aria-label={`${S.memory.edit} ${file.title}`}
onClick={() => openEditor(scope, file)}
>
<GlyphIcon d={PENCIL_ICON} size={14} className="text-gray-600 dark:text-gray-300" />
- </Button>
- <Button
- size="icon"
+ </IconButton>
+ <IconButton
variant="danger"
+ label={`${S.memory.delete} ${file.title}`}
title={S.memory.delete}
- aria-label={`${S.memory.delete} ${file.title}`}
onClick={() => setRemoving({ scope, file })}
>
<GlyphIcon d={TRASH_ICON} size={14} />
- </Button>
+ </IconButton>
</div>
);
@@ -661,7 +666,7 @@ export function MemoryTab({
aria-label={S.memory.addScopeLabel(scopeTitle(scope))}
onClick={() => openAdd(scope)}
>
- <GlyphIcon d={PLUS_ICON} size={13} />
+ <GlyphIcon d={ICONS.plus} size={13} />
<span className="hidden @md:inline">{S.memory.add}</span>
</Button>
</span>
diff --git a/packages/web/src/features/agents/prompt-injection-controls.tsx b/packages/web/src/features/agents/prompt-injection-controls.tsx
index c507e438..455097e5 100644
--- a/packages/web/src/features/agents/prompt-injection-controls.tsx
+++ b/packages/web/src/features/agents/prompt-injection-controls.tsx
@@ -28,11 +28,11 @@ import type {
AgentSkillsConfigDto,
AgentVaultConfigDto,
} from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
import { Textarea } from "../../components/ui/input";
import { Switch } from "../../components/ui/switch";
import { useSaveConfirm } from "../../components/ui/confirm-modal";
diff --git a/packages/web/src/features/agents/schedules-tab.tsx b/packages/web/src/features/agents/schedules-tab.tsx
index c990a04c..43690a12 100644
--- a/packages/web/src/features/agents/schedules-tab.tsx
+++ b/packages/web/src/features/agents/schedules-tab.tsx
@@ -24,16 +24,14 @@ import type {
SchedulesResponse,
ScheduleStatus,
} from "@prismshadow/penguin-server/api";
+import { Badge, Button, SettingsEmpty, SkeletonList } from "@prismshadow/penguin-ui";
+import type { BadgeStyle } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime } from "../../lib/format";
import { useProject } from "../../state/project";
-import { Badge, type BadgeTone } from "../../components/ui/badge";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { SettingsEmpty } from "../../components/ui/empty-state";
-import { SkeletonList } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { AiCreateModal, CreateButtons } from "../ai-create";
import { ScheduleFormModal } from "../schedules/schedule-form-modal";
@@ -42,14 +40,14 @@ import { toggleBody } from "../schedules/schedule-upsert";
import { usePromptInjection } from "./prompt-injection-controls";
import { HelpFold } from "../../components/ui/help-fold";
-/** Display status → badge tone. */
-const STATUS_TONE: Record<ScheduleStatus, BadgeTone> = {
- active: "green",
- disabled: "gray",
- expired: "amber",
- done: "brand",
- missed: "amber",
- invalid: "red",
+/** Display status → badge. A finished one-off is settled: a neutral tag, solid so it still reads. */
+const STATUS_BADGE: Record<ScheduleStatus, BadgeStyle> = {
+ active: { tone: "success" },
+ disabled: { tone: "neutral" },
+ expired: { tone: "attention" },
+ done: { tone: "neutral", variant: "solid" },
+ missed: { tone: "attention" },
+ invalid: { tone: "danger" },
};
export function SchedulesTab({
@@ -208,7 +206,7 @@ export function SchedulesTab({
<td className="whitespace-nowrap px-3 py-2">
{/* invalid reason is folded into the hover title. */}
<span data-tooltip={item.invalidReason}>
- <Badge tone={STATUS_TONE[item.status]}>
+ <Badge {...STATUS_BADGE[item.status]}>
{S.schedule.statusNames[item.status] ?? item.status}
</Badge>
</span>
@@ -242,7 +240,7 @@ export function SchedulesTab({
</span>
</td>
<td className="whitespace-nowrap px-3 py-2">
- {item.queued && <Badge tone="brand">{S.schedule.queued}</Badge>}
+ {item.queued && <Badge variant="solid">{S.schedule.queued}</Badge>}
</td>
{isOwner && (
<td className="whitespace-nowrap px-3 py-2 text-right">
diff --git a/packages/web/src/features/agents/skills-tab.tsx b/packages/web/src/features/agents/skills-tab.tsx
index d6a6336e..82860c2a 100644
--- a/packages/web/src/features/agents/skills-tab.tsx
+++ b/packages/web/src/features/agents/skills-tab.tsx
@@ -20,22 +20,28 @@
import { useCallback, useEffect, useState } from "react";
import type { ChangeEvent } from "react";
import type { SkillMetadataItem } from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ CopiedStatus,
+ CopyCheckGlyph,
+ DownloadIcon,
+ GlyphIcon,
+ HiddenFileInput,
+ IconButton,
+ SettingsEmpty,
+ SkeletonList,
+ buttonClass,
+ useCopied,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useLocale } from "../../state/locale";
import { agentDisplayName, useProject } from "../../state/project";
-import { Button, labelButtonClass } from "../../components/ui/button";
-import { CopiedStatus, CopyCheckGlyph, useCopied } from "../../components/ui/copy-button";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { Input, Textarea } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { DownloadIcon } from "../../components/ui/icons";
-import { HiddenFileInput } from "../../components/ui/hidden-file-input";
-import { SettingsEmpty } from "../../components/ui/empty-state";
-import { SkeletonList } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { SkillTile } from "../skills/skill-icon-view";
import { localizedShortText } from "../chat/skill-use";
@@ -46,7 +52,7 @@ import { usePromptInjection } from "./prompt-injection-controls";
import { HelpFold } from "../../components/ui/help-fold";
/** The Button look on the upload `<label>`; the Hooks tab's upload label borrows it. */
-export const UPLOAD_LABEL_CLASS = labelButtonClass("secondary", "sm");
+export const UPLOAD_LABEL_CLASS = buttonClass("secondary", "sm");
/** Delete (trash can) icon path — the same glyph as the agents page card delete; the Hooks tab's row delete borrows it. */
export const TRASH_ICON =
@@ -288,25 +294,23 @@ export function SkillsTab({
{/* Icon-only row actions (same affordance as the agents page cards: neutral
bordered icon for export, danger variant with red text/hover for delete);
the tooltip + aria-label carry the wording. */}
- <Button
- size="icon"
+ <IconButton
+ label={`${S.skills.exportSkill} ${skill.name}`}
title={S.skills.exportSkill}
- aria-label={`${S.skills.exportSkill} ${skill.name}`}
disabled={busy}
onClick={() => void exportSkill(skill.name)}
>
<DownloadIcon size={14} className="text-gray-600 dark:text-gray-300" />
- </Button>
- <Button
- size="icon"
+ </IconButton>
+ <IconButton
variant="danger"
+ label={`${S.skills.uninstall} ${skill.name}`}
title={S.skills.uninstall}
- aria-label={`${S.skills.uninstall} ${skill.name}`}
disabled={busy}
onClick={() => setRemoving(skill.name)}
>
<GlyphIcon d={TRASH_ICON} size={14} />
- </Button>
+ </IconButton>
</div>
))}
</div>
diff --git a/packages/web/src/features/agents/snapshot-file.ts b/packages/web/src/features/agents/snapshot-file.ts
index 436a9cb6..6744a36c 100644
--- a/packages/web/src/features/agents/snapshot-file.ts
+++ b/packages/web/src/features/agents/snapshot-file.ts
@@ -1,12 +1,12 @@
/** Picking and reading Agent State snapshot packages (`<agentId>-v<n>.tar.gz`). */
-import { labelButtonClass } from "../../components/ui/button";
+import { buttonClass } from "@prismshadow/penguin-ui";
/**
* The button look on the `<a download>` / `<label>` the transfer actions and the snapshot picker
* need — the settings page's transfers and the create dialog's picker, neither of which can be a
* `<button>`.
*/
-export const SNAPSHOT_BUTTON_CLASS = labelButtonClass("secondary", "sm");
+export const SNAPSHOT_BUTTON_CLASS = buttonClass("secondary", "sm");
/**
* Accept list for the snapshot file pickers.
diff --git a/packages/web/src/features/agents/vault-tab.tsx b/packages/web/src/features/agents/vault-tab.tsx
index f6f1a30d..140b665c 100644
--- a/packages/web/src/features/agents/vault-tab.tsx
+++ b/packages/web/src/features/agents/vault-tab.tsx
@@ -15,17 +15,15 @@
*/
import { useCallback, useEffect, useState } from "react";
import type { VaultEntryInfo, VaultUpdateRequest } from "@prismshadow/penguin-server/api";
+import { Button, SettingsEmpty, SkeletonList } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
import { Input } from "../../components/ui/input";
import { PasswordInput } from "../../components/ui/password-input";
import { Modal } from "../../components/ui/modal";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { SettingsEmpty } from "../../components/ui/empty-state";
-import { SkeletonList } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { usePromptInjection } from "./prompt-injection-controls";
import { HelpFold } from "../../components/ui/help-fold";
diff --git a/packages/web/src/features/ai-create/ai-create-modal.tsx b/packages/web/src/features/ai-create/ai-create-modal.tsx
index 237aa66d..2142bedc 100644
--- a/packages/web/src/features/ai-create/ai-create-modal.tsx
+++ b/packages/web/src/features/ai-create/ai-create-modal.tsx
@@ -6,10 +6,8 @@
* dialog starts from `initialValue` again.
*/
import { useState } from "react";
+import { Button, GlyphIcon, ICONS } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { MAGIC_WAND_ICON } from "../../components/ui/icons";
import { Modal } from "../../components/ui/modal";
import { useAiBridge } from "./ai-bridge";
import { AiCreatePanel } from "./ai-create-panel";
@@ -90,7 +88,7 @@ function AiCreateDialog({
the next screen. Disabled until there is a prompt and an agent to take it.
*/}
<Button size="sm" variant="primary" disabled={!ready} onClick={go}>
- <GlyphIcon d={MAGIC_WAND_ICON} />
+ <GlyphIcon d={ICONS.wand} />
{S.aiCreate.editInChat}
</Button>
</>
diff --git a/packages/web/src/features/ai-create/ai-create-panel.tsx b/packages/web/src/features/ai-create/ai-create-panel.tsx
index 7ca737e9..a503a3a2 100644
--- a/packages/web/src/features/ai-create/ai-create-panel.tsx
+++ b/packages/web/src/features/ai-create/ai-create-panel.tsx
@@ -8,10 +8,10 @@
import { useLayoutEffect, useRef } from "react";
import type { ReactNode } from "react";
import type { AgentSummary } from "@prismshadow/penguin-server/api";
+import { CopyButton } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { toneInk } from "../../lib/tone";
import { agentDisplayName } from "../../state/project";
-import { CopyButton } from "../../components/ui/copy-button";
import { HelpFold } from "../../components/ui/help-fold";
import { Textarea } from "../../components/ui/input";
import { Select } from "../../components/ui/select";
diff --git a/packages/web/src/features/ai-create/create-buttons.tsx b/packages/web/src/features/ai-create/create-buttons.tsx
index 2fb736c1..be20b063 100644
--- a/packages/web/src/features/ai-create/create-buttons.tsx
+++ b/packages/web/src/features/ai-create/create-buttons.tsx
@@ -5,10 +5,8 @@
* one inside the first. The wand button always carries the accent and the hand button never
* does, so the pair reads the same on every page.
*/
+import { Button, GlyphIcon, ICONS } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { HAND_ICON, MAGIC_WAND_ICON } from "../../components/ui/icons";
export interface CreateButtonsProps {
onAi: () => void;
@@ -42,7 +40,7 @@ export function CreateButtons({
return (
<div className={`flex flex-wrap items-center gap-2 ${className ?? ""}`}>
<Button size={size} variant="primary" disabled={disabled} onClick={onAi}>
- <GlyphIcon d={MAGIC_WAND_ICON} />
+ <GlyphIcon d={ICONS.wand} />
{aiLabel ?? S.aiCreate.withAi}
</Button>
{onManual !== undefined && (
@@ -52,7 +50,7 @@ export function CreateButtons({
disabled={disabled === true || manualDisabled === true}
onClick={onManual}
>
- <GlyphIcon d={HAND_ICON} />
+ <GlyphIcon d={ICONS.hand} />
{manualLabel ?? S.aiCreate.manual}
</Button>
)}
diff --git a/packages/web/src/features/benchmark/benchmark-detail-page.tsx b/packages/web/src/features/benchmark/benchmark-detail-page.tsx
index e4c418d4..1d0b2639 100644
--- a/packages/web/src/features/benchmark/benchmark-detail-page.tsx
+++ b/packages/web/src/features/benchmark/benchmark-detail-page.tsx
@@ -8,6 +8,15 @@
import { useEffect, useState } from "react";
import { useNavigate, useParams } from "react-router";
import type { ModelsResponse } from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ CopyButton,
+ EmptyState,
+ GlyphIcon,
+ ICONS,
+ ICON_SIZE,
+ Skeleton,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import type { MergedBenchmark } from "../../lib/benchmark-merge";
import { nameOnMachine } from "../../lib/workspace-machines";
@@ -15,21 +24,12 @@ import { useSessions } from "../../state/sessions";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useDocumentTitle } from "../../lib/use-document-title";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
-import { CopyButton, ROW_COPY_CLASS } from "../../components/ui/copy-button";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { Skeleton } from "../../components/ui/skeleton";
import { BenchmarkDetail } from "./benchmark-detail";
import { benchmarkPath } from "./benchmark-prompts";
import { fetchBenchmarks } from "./benchmark-sources";
import { UseBenchmarkModal } from "./use-benchmark-modal";
-/** Back to the list: the arrow-left every detail page's back button carries. */
-const BACK_ICON = "M15 18l-6-6 6-6M9 12h12";
-
/**
* What stands in place of the detail for a Benchmark that is not published: still being built,
* or creation failed. Deleting and creating again is a failed Benchmark's only way out, and only
@@ -153,7 +153,7 @@ export function BenchmarkDetailPage() {
onClick={() => navigate("/benchmark")}
className="-ml-2 mb-3 text-gray-500 dark:text-gray-400"
>
- <GlyphIcon d={BACK_ICON} size={ICON_SIZE.rowLead} />
+ <GlyphIcon d={ICONS.arrowLeft} size={ICON_SIZE.rowLead} />
{S.benchmark.backToList}
</Button>
{/* The Benchmark's name, the directory its files live in, and the Use entry point. The
@@ -180,7 +180,8 @@ export function BenchmarkDetailPage() {
<CopyButton
text={benchmarkPath(benchmark.id)}
label={S.benchmark.copyPath}
- className={ROW_COPY_CLASS}
+ size="sm"
+ className="shrink-0"
/>
</span>
{!masked && (
diff --git a/packages/web/src/features/benchmark/benchmark-detail.tsx b/packages/web/src/features/benchmark/benchmark-detail.tsx
index 7f24b556..77592857 100644
--- a/packages/web/src/features/benchmark/benchmark-detail.tsx
+++ b/packages/web/src/features/benchmark/benchmark-detail.tsx
@@ -11,19 +11,21 @@
*/
import { useEffect, useState } from "react";
import type { BenchmarkCaseSummary, BenchmarkEvaluation } from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ Button,
+ EmptyState,
+ GlyphIcon,
+ ICONS,
+ ICON_SIZE,
+} from "@prismshadow/penguin-ui";
import type { MergedBenchmark, MergedCase } from "../../lib/benchmark-merge";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime, formatMoney, formatScore, humanizeDuration } from "../../lib/format";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneInk } from "../../lib/tone";
import { useTheme } from "../../state/theme";
import type { Currency } from "../../state/theme";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Button } from "../../components/ui/button";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { MAGIC_WAND_ICON } from "../../components/ui/icons";
import { Modal } from "../../components/ui/modal";
import { NEUTRAL_SERIES } from "../../lib/category-colors";
import { makeRangeGeom, segmentPoints } from "../usage/chart-geom";
@@ -451,7 +453,7 @@ export function BenchmarkDetail({
}}
footer={
<Button size="sm" variant="secondary" onClick={() => setAskingCaseId(openCase.id)}>
- <GlyphIcon d={MAGIC_WAND_ICON} />
+ <GlyphIcon d={ICONS.wand} />
{S.benchmark.askAi}
</Button>
}
diff --git a/packages/web/src/features/benchmark/benchmark-page.tsx b/packages/web/src/features/benchmark/benchmark-page.tsx
index 9a3060d9..665e2dcb 100644
--- a/packages/web/src/features/benchmark/benchmark-page.tsx
+++ b/packages/web/src/features/benchmark/benchmark-page.tsx
@@ -17,12 +17,22 @@ import type {
BenchmarkSummary,
ModelsResponse,
} from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ AvatarStack,
+ Button,
+ EmptyState,
+ GlyphIcon,
+ ICON_GAP,
+ ICON_SIZE,
+ Skeleton,
+ SkeletonCard,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useDocumentTitle } from "../../lib/use-document-title";
import { formatRelativeShort, formatScore, signedDelta } from "../../lib/format";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { STAT_ICONS } from "../../lib/stat-icons";
import { toneInk } from "../../lib/tone";
import { agentDisplayName, useProject } from "../../state/project";
@@ -30,14 +40,9 @@ import { useSessions } from "../../state/sessions";
import type { MergedBenchmark } from "../../lib/benchmark-merge";
import { nameOnMachine } from "../../lib/workspace-machines";
import { useLocale } from "../../state/locale";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { Input } from "../../components/ui/input";
import { Select } from "../../components/ui/select";
-import { Skeleton, SkeletonCard } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { AiCreateModal, CreateButtons, pickDefaultAgent } from "../ai-create";
import { latestWithDelta, matchesBenchmarkQuery, sparklineSeries } from "./benchmark-metrics";
@@ -125,25 +130,16 @@ function TestedAgents({
nameOf: (agentId: string) => string;
}) {
if (agentIds.length === 0) return null;
- const shown = agentIds.slice(0, AVATARS_SHOWN);
- const rest = agentIds.length - shown.length;
return (
<div
- className="hidden shrink-0 items-center gap-1 sm:flex"
+ className="hidden shrink-0 sm:flex"
data-tooltip={`${S.benchmark.testedAgents}: ${agentIds.map(nameOf).join(", ")}`}
>
- {shown.map((agentId) => (
- <AgentAvatar
- key={agentId}
- id={agentId}
- name={nameOf(agentId)}
- size={ICON_SIZE.rowLead}
- className="shrink-0 rounded"
- />
- ))}
- {rest > 0 && (
- <span className="text-[11px] tabular-nums text-gray-400 dark:text-gray-500">+{rest}</span>
- )}
+ <AvatarStack
+ items={agentIds.map((agentId) => ({ id: agentId, name: nameOf(agentId) }))}
+ max={AVATARS_SHOWN}
+ size={ICON_SIZE.rowLead}
+ />
</div>
);
}
diff --git a/packages/web/src/features/benchmark/create-benchmark-modal.tsx b/packages/web/src/features/benchmark/create-benchmark-modal.tsx
index d9f364de..9ae95324 100644
--- a/packages/web/src/features/benchmark/create-benchmark-modal.tsx
+++ b/packages/web/src/features/benchmark/create-benchmark-modal.tsx
@@ -8,20 +8,16 @@
*/
import { useRef, useState } from "react";
import type { BenchmarkSummary } from "@prismshadow/penguin-server/api";
+import { Button, GlyphIcon, ICONS, ICON_SIZE, PlusIcon } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneInk } from "../../lib/tone";
-import { Button } from "../../components/ui/button";
import { FieldLabel } from "../../components/ui/field";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { PlusIcon } from "../../components/ui/icons";
import { InfoPopover } from "../../components/ui/info-popover";
import { Input, Textarea } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
-import { TRASH_ICON } from "../../components/ui/session-row-menu";
import { toastSuccess } from "../../components/ui/toast";
import { SemanticIdField } from "../semantic-id/semantic-id-field";
import { ID_PATTERN, caseId, isValidRuns } from "./benchmark-prompts";
@@ -229,7 +225,7 @@ function CreateBenchmarkDialog({ onClose, projectId, onCreated }: CreateBenchmar
aria-label={S.benchmark.removeCase}
onClick={() => setCases((prev) => prev.filter((x) => x.key !== c.key))}
>
- <GlyphIcon d={TRASH_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.trash} size={ICON_SIZE.iconButton} />
</Button>
)}
</div>
diff --git a/packages/web/src/features/benchmark/evaluation-detail-modal.tsx b/packages/web/src/features/benchmark/evaluation-detail-modal.tsx
index 63c00b9c..41e45284 100644
--- a/packages/web/src/features/benchmark/evaluation-detail-modal.tsx
+++ b/packages/web/src/features/benchmark/evaluation-detail-modal.tsx
@@ -10,15 +10,18 @@
*/
import { useState } from "react";
import type { BenchmarkCaseScore, BenchmarkEvaluation } from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ Button,
+ Chevron,
+ GlyphIcon,
+ ICONS,
+ ICON_GAP,
+ ICON_SIZE,
+} from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { formatDateTime, formatMoney, formatScore, humanizeDuration } from "../../lib/format";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import type { Currency } from "../../state/theme";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Button } from "../../components/ui/button";
-import { Chevron } from "../../components/ui/chevron";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { MAGIC_WAND_ICON } from "../../components/ui/icons";
import { Modal } from "../../components/ui/modal";
import { AskAiModal } from "./ask-ai-modal";
import { evaluationLabel } from "./benchmark-metrics";
@@ -195,7 +198,7 @@ export function EvaluationDetailModal({
{S.common.close}
</Button>
<Button size="sm" variant="secondary" onClick={() => setAsking(true)}>
- <GlyphIcon d={MAGIC_WAND_ICON} />
+ <GlyphIcon d={ICONS.wand} />
{S.benchmark.askAi}
</Button>
</>
diff --git a/packages/web/src/features/benchmark/use-benchmark-modal.tsx b/packages/web/src/features/benchmark/use-benchmark-modal.tsx
index c25dd614..d1e4faf2 100644
--- a/packages/web/src/features/benchmark/use-benchmark-modal.tsx
+++ b/packages/web/src/features/benchmark/use-benchmark-modal.tsx
@@ -24,14 +24,12 @@ import type {
ModelRefDto,
ModelsResponse,
} from "@prismshadow/penguin-server/api";
+import { Button, GlyphIcon, ICONS } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { formatScore } from "../../lib/format";
import { agentDisplayName, useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
import { FieldHint, FieldLabel } from "../../components/ui/field";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { MAGIC_WAND_ICON } from "../../components/ui/icons";
import { Input, Textarea } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
import { Segmented } from "../../components/ui/segmented";
@@ -258,7 +256,7 @@ export function UseBenchmarkModal({
parameter of the open tab is in range.
*/}
<Button size="sm" variant="primary" disabled={!ready} onClick={go}>
- <GlyphIcon d={MAGIC_WAND_ICON} />
+ <GlyphIcon d={ICONS.wand} />
{S.aiCreate.editInChat}
</Button>
</>
diff --git a/packages/web/src/features/builtin-browser/browser-panel.tsx b/packages/web/src/features/builtin-browser/browser-panel.tsx
index 27d36909..409fb7de 100644
--- a/packages/web/src/features/builtin-browser/browser-panel.tsx
+++ b/packages/web/src/features/builtin-browser/browser-panel.tsx
@@ -12,9 +12,8 @@
* desktop app, an older shell) the panel says so instead.
*/
import { useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
+import { Button, EmptyState } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
-import { EmptyState } from "../../components/ui/empty-state";
import { isBlankUrl, isWebUrl } from "./address";
import { activateBrowserTab, closeBrowserTab, openBrowserTab } from "./browser-actions";
import {
diff --git a/packages/web/src/features/builtin-browser/browser-tab-strip.tsx b/packages/web/src/features/builtin-browser/browser-tab-strip.tsx
index 330c7aea..aaad5ce6 100644
--- a/packages/web/src/features/builtin-browser/browser-tab-strip.tsx
+++ b/packages/web/src/features/builtin-browser/browser-tab-strip.tsx
@@ -13,10 +13,8 @@
*/
import { useState } from "react";
import type { BuiltinBrowserTab } from "@prismshadow/penguin-server/api";
+import { CloseIcon, GlyphIcon, ICONS, ICON_SIZE, PlusIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { CloseIcon, GLOBE_ICON, PlusIcon, WARNING_ICON } from "../../components/ui/icons";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneDot, toneInk } from "../../lib/tone";
import { faviconSrc, isBlankUrl, tabLabel } from "./address";
import { formatMemory } from "./load";
@@ -31,7 +29,7 @@ function TabIcon({ tab }: { tab: BuiltinBrowserTab }) {
aria-label={S.builtinBrowser.crashedTab}
className={`shrink-0 ${toneInk.danger}`}
>
- <GlyphIcon d={WARNING_ICON} size={ICON_SIZE.inlineGlyph} />
+ <GlyphIcon d={ICONS.triangleAlert} size={ICON_SIZE.inlineGlyph} />
</span>
);
}
@@ -48,7 +46,7 @@ function TabIcon({ tab }: { tab: BuiltinBrowserTab }) {
if (src === null || src === failed) {
return (
<span aria-hidden className="shrink-0 text-gray-400 dark:text-gray-500">
- <GlyphIcon d={GLOBE_ICON} size={ICON_SIZE.inlineGlyph} />
+ <GlyphIcon d={ICONS.globe} size={ICON_SIZE.inlineGlyph} />
</span>
);
}
@@ -149,7 +147,7 @@ export function BrowserTabStrip({
data-testid="builtin-browser-heavy-tab"
className={`shrink-0 ${toneInk.attention}`}
>
- <GlyphIcon d={WARNING_ICON} size={ICON_SIZE.inlineGlyph} />
+ <GlyphIcon d={ICONS.triangleAlert} size={ICON_SIZE.inlineGlyph} />
</span>
)}
</button>
diff --git a/packages/web/src/features/builtin-browser/browser-toolbar.tsx b/packages/web/src/features/builtin-browser/browser-toolbar.tsx
index eabd5373..2bedbbf5 100644
--- a/packages/web/src/features/builtin-browser/browser-toolbar.tsx
+++ b/packages/web/src/features/builtin-browser/browser-toolbar.tsx
@@ -12,29 +12,11 @@
import { useState } from "react";
import type { ReactNode, Ref } from "react";
import type { BuiltinBrowserTab } from "@prismshadow/penguin-server/api";
+import { CloseIcon, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneInk } from "../../lib/tone";
import { Dropdown } from "../../components/ui/dropdown";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { AGENT_GROUP_ICON } from "../../components/ui/group-list";
-import {
- ARROW_BACK_ICON,
- ARROW_FORWARD_ICON,
- CODE_ICON,
- CloseIcon,
- DOWNLOAD_ICON,
- EXTERNAL_LINK_ICON,
- HOME_ICON,
- REFRESH_ICON,
- WARNING_ICON,
-} from "../../components/ui/icons";
-import {
- ELLIPSIS_ICON,
- TRASH_ICON,
- overflowMenuGlyph,
- overflowMenuRowClass,
-} from "../../components/ui/session-row-menu";
+import { overflowMenuGlyph, overflowMenuRowClass } from "../../components/ui/session-row-menu";
import { Tooltip } from "../../components/ui/tooltip";
import { AddressBar } from "./address-bar";
import type { BrowserActivity } from "./browser-state";
@@ -120,14 +102,14 @@ export function BrowserToolbar(props: BrowserToolbarProps) {
disabled={tab?.canGoBack !== true}
onClick={props.onBack}
>
- <GlyphIcon d={ARROW_BACK_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.arrowLeftCentered} size={ICON_SIZE.iconButton} />
</ToolButton>
<ToolButton
label={S.builtinBrowser.forward}
disabled={tab?.canGoForward !== true}
onClick={props.onForward}
>
- <GlyphIcon d={ARROW_FORWARD_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.arrowRightCentered} size={ICON_SIZE.iconButton} />
</ToolButton>
{tab?.loading === true ? (
<ToolButton label={S.builtinBrowser.stop} onClick={props.onStop}>
@@ -139,12 +121,12 @@ export function BrowserToolbar(props: BrowserToolbarProps) {
disabled={tab === null}
onClick={props.onReload}
>
- <GlyphIcon d={REFRESH_ICON} size={ICON_SIZE.rowLead} />
+ <GlyphIcon d={ICONS.refresh} size={ICON_SIZE.rowLead} />
</ToolButton>
)}
{props.onHome !== null && (
<ToolButton label={S.builtinBrowser.home} onClick={props.onHome}>
- <GlyphIcon d={HOME_ICON} size={ICON_SIZE.rowLead} />
+ <GlyphIcon d={ICONS.house} size={ICON_SIZE.rowLead} />
</ToolButton>
)}
{/* Keyed by tab: switching tabs drops a half-typed address instead of carrying it over. */}
@@ -162,7 +144,7 @@ export function BrowserToolbar(props: BrowserToolbarProps) {
data-testid="builtin-browser-agent-busy"
className={`flex h-7 w-7 shrink-0 items-center justify-center ${toneInk.busy}`}
>
- <GlyphIcon d={AGENT_GROUP_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.robot} size={ICON_SIZE.iconButton} />
</span>
</Tooltip>
)}
@@ -174,7 +156,7 @@ export function BrowserToolbar(props: BrowserToolbarProps) {
data-testid="builtin-browser-load-warning"
className={`flex h-7 w-7 shrink-0 items-center justify-center ${toneInk.attention}`}
>
- <GlyphIcon d={WARNING_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.triangleAlert} size={ICON_SIZE.iconButton} />
</span>
</Tooltip>
)}
@@ -191,20 +173,20 @@ export function BrowserToolbar(props: BrowserToolbarProps) {
aria-expanded={menuOpen}
onClick={() => setMenuOpen(!menuOpen)}
>
- <GlyphIcon d={ELLIPSIS_ICON} size={ICON_SIZE.rowLead} filled />
+ <GlyphIcon d={ICONS.ellipsis} size={ICON_SIZE.rowLead} filled />
</ToolButton>
}
>
<button type="button" className={overflowMenuRowClass} onClick={item(props.onImport)}>
- {overflowMenuGlyph(DOWNLOAD_ICON)}
+ {overflowMenuGlyph(ICONS.download)}
{S.builtinBrowser.importAction}
</button>
<button type="button" className={overflowMenuRowClass} onClick={item(props.onClearData)}>
- {overflowMenuGlyph(TRASH_ICON)}
+ {overflowMenuGlyph(ICONS.trash)}
{S.builtinBrowser.clearDataAction}
</button>
<button type="button" className={overflowMenuRowClass} onClick={item(props.onSetHomepage)}>
- {overflowMenuGlyph(HOME_ICON)}
+ {overflowMenuGlyph(ICONS.house)}
{S.builtinBrowser.setHomepageAction}
</button>
{(props.onOpenExternal !== null || props.hostsPage) && (
@@ -216,13 +198,13 @@ export function BrowserToolbar(props: BrowserToolbarProps) {
className={overflowMenuRowClass}
onClick={item(props.onOpenExternal)}
>
- {overflowMenuGlyph(EXTERNAL_LINK_ICON)}
+ {overflowMenuGlyph(ICONS.externalLink)}
{S.builtinBrowser.openExternal}
</button>
)}
{props.hostsPage && (
<button type="button" className={overflowMenuRowClass} onClick={item(props.onDevTools)}>
- {overflowMenuGlyph(CODE_ICON)}
+ {overflowMenuGlyph(ICONS.angleBrackets)}
{S.builtinBrowser.devTools}
</button>
)}
diff --git a/packages/web/src/features/builtin-browser/homepage-dialog.tsx b/packages/web/src/features/builtin-browser/homepage-dialog.tsx
index dcbf6cd2..5f442b24 100644
--- a/packages/web/src/features/builtin-browser/homepage-dialog.tsx
+++ b/packages/web/src/features/builtin-browser/homepage-dialog.tsx
@@ -9,10 +9,10 @@
* opening starts from the homepage as saved.
*/
import { useState } from "react";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { apiErrorText } from "../../lib/api-error";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
import { Input } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
import { toastError } from "../../components/ui/toast";
diff --git a/packages/web/src/features/builtin-browser/import-dialog.tsx b/packages/web/src/features/builtin-browser/import-dialog.tsx
index 31f41490..6c0443ea 100644
--- a/packages/web/src/features/builtin-browser/import-dialog.tsx
+++ b/packages/web/src/features/builtin-browser/import-dialog.tsx
@@ -8,11 +8,11 @@ import type {
BuiltinBrowserImportResult,
BuiltinBrowserImportSource,
} from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { apiErrorText } from "../../lib/api-error";
import { S } from "../../lib/strings";
import { toneInk } from "../../lib/tone";
-import { Button } from "../../components/ui/button";
import { FieldLabel } from "../../components/ui/field";
import { Input } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
diff --git a/packages/web/src/features/chat/agent-topology-view.tsx b/packages/web/src/features/chat/agent-topology-view.tsx
index 8eee9a76..f98a52dd 100644
--- a/packages/web/src/features/chat/agent-topology-view.tsx
+++ b/packages/web/src/features/chat/agent-topology-view.tsx
@@ -7,10 +7,9 @@
* Each child node shows its wall-clock elapsed time (ticking while it runs, frozen at its last
* activity when done — never a sum of its items); the root carries no stamps and shows none.
*/
+import { AgentAvatar, StatusIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { StatusIcon } from "../../components/ui/status-icon";
import { LiveDuration } from "./live-duration";
import { layoutTopology, NODE_H, NODE_W } from "./agent-topology";
import type { TopologyNode } from "./agent-topology";
@@ -94,7 +93,7 @@ export function AgentTopologyView({
</span>
)}
{/* Status is already part of the button's accessible name: keep the glyph decorative. */}
- <StatusIcon state={node.running ? "running" : "done"} size={10} />
+ <StatusIcon state={node.running ? "running" : "done"} size="xs" />
</span>
{/* Second line: what this child was spawned to do. Indented to the label's own
left edge (avatar width + gap) and truncated to one line — the model writes a
diff --git a/packages/web/src/features/chat/approval-buttons.tsx b/packages/web/src/features/chat/approval-buttons.tsx
index 3a935311..b09fd1c8 100644
--- a/packages/web/src/features/chat/approval-buttons.tsx
+++ b/packages/web/src/features/chat/approval-buttons.tsx
@@ -4,8 +4,8 @@
* is submitted via POST /api/sessions/:s/approvals/:toolCallId.
*/
import { useState } from "react";
+import { Button } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
export function ApprovalButtons({
onDecide,
diff --git a/packages/web/src/features/chat/attached-files-banner.tsx b/packages/web/src/features/chat/attached-files-banner.tsx
index a5cd4397..1f745f6c 100644
--- a/packages/web/src/features/chat/attached-files-banner.tsx
+++ b/packages/web/src/features/chat/attached-files-banner.tsx
@@ -6,9 +6,9 @@
* rendered as usual by the caller. It keeps the same visual language as message-level notices;
* the caller owns its user-side alignment and timestamp footer.
*/
+import { GlyphIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { attachmentFileName } from "../../lib/attachments";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
/** Paperclip glyph (24×24 line path), shared with the composer's file-attachment entry. */
export const PAPERCLIP_ICON =
diff --git a/packages/web/src/features/chat/background-done-banner.tsx b/packages/web/src/features/chat/background-done-banner.tsx
index 2f7750ca..07711803 100644
--- a/packages/web/src/features/chat/background-done-banner.tsx
+++ b/packages/web/src/features/chat/background-done-banner.tsx
@@ -7,9 +7,9 @@
* tail) renders in the tool cards' output styling. The Trace page shows the raw marker text
* as-is.
*/
+import { StatusIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import type { BackgroundTaskDone } from "./agent-handoff";
-import { StatusIcon } from "../../components/ui/status-icon";
import {
DISCLOSURE_CARD_CLASS,
DISCLOSURE_OUTPUT_PRE_CLASS,
diff --git a/packages/web/src/features/chat/chat-input.tsx b/packages/web/src/features/chat/chat-input.tsx
index 661e3236..03571897 100644
--- a/packages/web/src/features/chat/chat-input.tsx
+++ b/packages/web/src/features/chat/chat-input.tsx
@@ -87,25 +87,30 @@ import type {
SkillMetadataItem,
TaskInputPart,
} from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ Button,
+ CheckIcon,
+ ChevronDown,
+ GlyphIcon,
+ ICONS,
+ ICON_GAP,
+ ICON_SIZE,
+ ProviderLogo,
+} from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { formatBytes, humanizeTokens } from "../../lib/format";
import { useLocale } from "../../state/locale";
import { useAuth } from "../../state/auth";
import { agentDisplayName } from "../../state/project";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Button } from "../../components/ui/button";
import { Dropdown } from "../../components/ui/dropdown";
import { PermissionSelect } from "./permission-select";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { CheckIcon, ChevronDown } from "../../components/ui/icons";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { noAutofill } from "../../components/ui/input";
import { toastError, toastInfo } from "../../components/ui/toast";
import { SkillIcon } from "../skills/skill-icon-view";
import { SkillPickList } from "../skills/skill-pick-list";
import { toggleSkillName } from "../skills/skill-selection";
import { ZoomableImage } from "../../components/ui/image-zoom";
-import { ProviderLogo } from "../../components/ui/provider-logo";
import { sameModelRef } from "../models/model-grouping";
import { filterAgents, stagedSendRoute } from "./agent-handoff";
import { ModelSelect, PickerList, modelLabel } from "./model-select";
@@ -493,7 +498,7 @@ function PlusMenu({
onClick={() => setOpen(!open)}
className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <GlyphIcon d="M12 5v14M5 12h14" size={15} className="shrink-0" />
+ <GlyphIcon d={ICONS.plus} size={15} className="shrink-0" />
</button>
}
>
diff --git a/packages/web/src/features/chat/chat-page.tsx b/packages/web/src/features/chat/chat-page.tsx
index fc898414..266462a1 100644
--- a/packages/web/src/features/chat/chat-page.tsx
+++ b/packages/web/src/features/chat/chat-page.tsx
@@ -32,6 +32,17 @@ import type {
SkillMetadataItem,
TaskInputPart,
} from "@prismshadow/penguin-server/api";
+import {
+ ActivityIcon,
+ Button,
+ CopyButton,
+ EmptyState,
+ GlyphIcon,
+ ICONS,
+ ICON_GAP,
+ ICON_SIZE,
+ Skeleton,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { switchDeskModel } from "../company/desk-model";
import { useCompany } from "../../state/company";
@@ -48,7 +59,11 @@ import {
humanizeTokens,
} from "../../lib/format";
import { latestConversation, withoutOrgSessions } from "../../lib/session-grouping";
-import { sessionActivity, sessionBackgroundTasks } from "../../lib/session-activity";
+import {
+ sessionActivity,
+ sessionActivityLabel,
+ sessionBackgroundTasks,
+} from "../../lib/session-activity";
import { noteSessionSeen } from "../../lib/session-seen";
import {
approvalKey,
@@ -71,16 +86,8 @@ import { agentDisplayName, useProject } from "../../state/project";
import { useSessions } from "../../state/sessions";
import { Modal } from "../../components/ui/modal";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { Button } from "../../components/ui/button";
-import { Skeleton } from "../../components/ui/skeleton";
import { Truncated } from "../../components/ui/truncated";
import { Dropdown } from "../../components/ui/dropdown";
-import { CopyButton, ROW_COPY_CLASS } from "../../components/ui/copy-button";
-import { EmptyState } from "../../components/ui/empty-state";
-import {
- SessionActivityIcon,
- sessionActivityLabel,
-} from "../../components/ui/session-activity-icon";
import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
import { MessageStream } from "./message-stream";
import type { StreamRenderContext } from "./message-stream";
@@ -152,10 +159,7 @@ import { useSessionDraft } from "./use-session-draft";
import { useSessionStream } from "./use-session-stream";
import { PanelsToolbar } from "./panels-toolbar";
import { toneDot, toneInk } from "../../lib/tone";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { STAT_ICONS } from "../../lib/stat-icons";
-import { BACKGROUND_TASKS_ICON, INFO_ICON } from "../../components/ui/icons";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { exitedProcessIds, reportableProcessFailure } from "./process-list";
/** How often the background-process list refreshes while it can still change (a run may promote a command at any time; a running process can exit on its own). */
@@ -188,7 +192,7 @@ function SessionIdRow({ sessionId }: { sessionId: string }) {
</p>
<div className="flex items-start gap-1.5">
<span className="min-w-0 flex-1 break-all font-mono text-xs leading-5">{sessionId}</span>
- <CopyButton text={sessionId} label={S.chat.copySessionId} className={ROW_COPY_CLASS} />
+ <CopyButton text={sessionId} label={S.chat.copySessionId} size="sm" className="shrink-0" />
</div>
</div>
);
@@ -2086,7 +2090,10 @@ export function ChatPage() {
data-tooltip={sessionActivityLabel(headerActivity)}
className="flex shrink-0 items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400"
>
- <SessionActivityIcon activity={headerActivity} />
+ <ActivityIcon
+ activity={headerActivity}
+ label={sessionActivityLabel(headerActivity)}
+ />
<span className="hidden sm:inline">{sessionActivityLabel(headerActivity)}</span>
</span>
)}
@@ -2169,14 +2176,14 @@ export function ChatPage() {
data-tooltip={S.chat.backgroundTasks(backgroundCount)}
className={`flex shrink-0 items-center ${ICON_GAP.tight} font-mono text-xs ${toneInk.busy}`}
>
- <GlyphIcon d={BACKGROUND_TASKS_ICON} />
+ <GlyphIcon d={ICONS.pulse} />
{backgroundCount}
</span>
)}
</span>
{/* Narrow: the info icon alone (the chips would crowd the title out). */}
<span className="flex h-7 w-7 items-center justify-center text-gray-500 sm:hidden dark:text-gray-400">
- <GlyphIcon d={INFO_ICON} size={ICON_SIZE.navRow} />
+ <GlyphIcon d={ICONS.info} size={ICON_SIZE.navRow} />
</span>
</button>
}
diff --git a/packages/web/src/features/chat/code-block.tsx b/packages/web/src/features/chat/code-block.tsx
index 1fee03f3..592c0c22 100644
--- a/packages/web/src/features/chat/code-block.tsx
+++ b/packages/web/src/features/chat/code-block.tsx
@@ -21,8 +21,8 @@
*/
import { useEffect, useMemo, useState } from "react";
import type { CSSProperties, ReactNode } from "react";
+import { CopyButton } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { CopyButton } from "../../components/ui/copy-button";
/**
* The highlighted code, with no box around it.
diff --git a/packages/web/src/features/chat/compaction-banner.tsx b/packages/web/src/features/chat/compaction-banner.tsx
index a9a0023d..019f5bef 100644
--- a/packages/web/src/features/chat/compaction-banner.tsx
+++ b/packages/web/src/features/chat/compaction-banner.tsx
@@ -44,11 +44,11 @@
* turn ends** and manual compaction both go into the Session total (the Trace page lists
* compaction turns separately); see the task-stats module comments.
*/
+import { StatusIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
import type { CompactionItem } from "../../lib/omni/stream-model";
import { compactionResultVisible, compactionSummaryText } from "../../lib/omni/compaction-summary";
-import { StatusIcon } from "../../components/ui/status-icon";
import { DISCLOSURE_BODY_MD_CLASS, DisclosureRow } from "./disclosure-row";
import { LiveDuration } from "./live-duration";
import { Md } from "./md";
diff --git a/packages/web/src/features/chat/conversation-outline.tsx b/packages/web/src/features/chat/conversation-outline.tsx
index 48e9bbed..f6a601fe 100644
--- a/packages/web/src/features/chat/conversation-outline.tsx
+++ b/packages/web/src/features/chat/conversation-outline.tsx
@@ -36,9 +36,9 @@
*/
import { useEffect, useRef, useState } from "react";
import type { FocusEvent, MouseEvent, RefObject } from "react";
+import { GlyphIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { Dropdown } from "../../components/ui/dropdown";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import type { OutlineEntry } from "./outline-model";
import {
globalTurnNumber,
diff --git a/packages/web/src/features/chat/disclosure-row.tsx b/packages/web/src/features/chat/disclosure-row.tsx
index 8a2be015..b38a494f 100644
--- a/packages/web/src/features/chat/disclosure-row.tsx
+++ b/packages/web/src/features/chat/disclosure-row.tsx
@@ -8,8 +8,8 @@
*/
import { useRef, useState } from "react";
import type { ReactNode } from "react";
-import { Chevron } from "../../components/ui/chevron";
-import type { RunState } from "../../components/ui/status-icon";
+import { Chevron } from "@prismshadow/penguin-ui";
+import type { RunState } from "@prismshadow/penguin-ui";
/**
* The row itself (collapsed and expanded state share it; the hover tone is the "open or
diff --git a/packages/web/src/features/chat/draft-view.tsx b/packages/web/src/features/chat/draft-view.tsx
index 1f14615d..bf2ef699 100644
--- a/packages/web/src/features/chat/draft-view.tsx
+++ b/packages/web/src/features/chat/draft-view.tsx
@@ -51,6 +51,7 @@ import type {
SkillMetadataItem,
TaskInputPart,
} from "@prismshadow/penguin-server/api";
+import { AgentAvatar, Chevron, ICONS, ICON_GAP, PenguinLogo } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { UNCONFINED } from "../../lib/permission-level";
@@ -62,11 +63,7 @@ import { useAuth } from "../../state/auth";
import { useLocale } from "../../state/locale";
import { agentDisplayName, useProject } from "../../state/project";
import { useSessions } from "../../state/sessions";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Chevron } from "../../components/ui/chevron";
-import { AGENT_GROUP_ICON } from "../../components/ui/group-list";
import { Dropdown } from "../../components/ui/dropdown";
-import { PenguinLogo } from "../../components/ui/penguin-logo";
import { toastError } from "../../components/ui/toast";
import { useVersionInfo } from "../../lib/use-version-info";
import { versionBadgeFor } from "../../lib/update-flow";
@@ -97,7 +94,6 @@ import { newChatAgentId } from "./new-chat";
import { effectiveThinkingLevel } from "./thinking-level";
import { WorkspaceSelect, pillClass } from "./workspace-select";
import { sameModelRef } from "../models/model-grouping";
-import { ICON_GAP } from "../../lib/icon-scale";
import { ChoiceCheck, menuRowClass, menuRowTone } from "../../components/ui/field";
/** Coalescing window for writing body text to the cache: keystrokes are frequent, so a short batch accumulates before persisting (option changes are still written immediately). */
@@ -135,18 +131,16 @@ function saveAppliedRouteKey(field: RouteStateField, key: string): void {
* competing with the titles, while the folder row is exactly where a glyph earns its place —
* it is what you scan to pick a category.
*
- * webapps: a browser window (chrome bar + two dots). agents: AGENT_GROUP_ICON itself — the one
- * glyph in the app that means "agent", worn by the sidebar's Agents entry and its grouping
+ * webapps: a browser window (chrome bar + two dots). agents: the registry's robot itself — the
+ * one glyph in the app that means "agent", worn by the sidebar's Agents entry and its grouping
* option — imported rather than copied, because a hand-copied duplicate is what silently drifts
- * the day that glyph is redrawn. (`components/ui/group-list.tsx` pulls in nothing from
- * `features/`, so there is no cycle to avoid here.) schedules: a clock face with hands — the
- * plainest mark for "fires on a timer", and distinct from the hourglass that already means a
- * Session is waiting.
+ * the day that glyph is redrawn. schedules: a clock face with hands — the plainest mark for
+ * "fires on a timer", and distinct from the hourglass that already means a Session is waiting.
*/
const FOLDER_GLYPHS: Record<ExampleFolderId, string> = {
webapps:
"M3 6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6zM3 9h18M6 6.5h.01M9 6.5h.01",
- agents: AGENT_GROUP_ICON,
+ agents: ICONS.robot,
schedules: "M12 2a10 10 0 1 0 0 20 10 10 0 1 0 0-20M12 6.5V12l3.5 2",
};
@@ -875,7 +869,7 @@ export function DraftView({
heading). The asset is square-cropped and the graphic already has a bit of built-in
padding, so a small margin is enough to sit visually close to the title. */}
<div className="mb-10 text-center">
- <PenguinLogo className="mx-auto mb-1 h-36 w-36 rounded-3xl" />
+ <PenguinLogo src="/penguin-logo.svg" className="mx-auto mb-1 h-36 w-36 rounded-3xl" />
<h1 className="ui-display text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100">
{S.appName}
</h1>
diff --git a/packages/web/src/features/chat/drop-zone.tsx b/packages/web/src/features/chat/drop-zone.tsx
index 4e72040c..588cb667 100644
--- a/packages/web/src/features/chat/drop-zone.tsx
+++ b/packages/web/src/features/chat/drop-zone.tsx
@@ -38,10 +38,10 @@
import { createContext, useContext, useEffect, useRef, useState } from "react";
import type { ReactNode } from "react";
import { createPortal } from "react-dom";
+import { GlyphIcon } from "@prismshadow/penguin-ui";
import { dropRegionAction, isFileDrag } from "../../lib/file-drop";
import type { DragSignal, DropRegionAction } from "../../lib/file-drop";
import { S } from "../../lib/strings";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { PAPERCLIP_ICON } from "./attached-files-banner";
/** The chat area's DOM node, or null when the composer is mounted outside a region. */
diff --git a/packages/web/src/features/chat/example-folder-row.tsx b/packages/web/src/features/chat/example-folder-row.tsx
index 6e92201d..8ccaf41f 100644
--- a/packages/web/src/features/chat/example-folder-row.tsx
+++ b/packages/web/src/features/chat/example-folder-row.tsx
@@ -7,8 +7,7 @@
* shortcuts folder in shortcuts-folder.tsx — and a folder row that reads differently from its
* neighbours would be read as a different kind of thing.
*/
-import { Chevron } from "../../components/ui/chevron";
-import { ICON_SIZE } from "../../lib/icon-scale";
+import { Chevron, ICON_SIZE } from "@prismshadow/penguin-ui";
export function ExampleFolderRow({
open,
diff --git a/packages/web/src/features/chat/goal-banner.tsx b/packages/web/src/features/chat/goal-banner.tsx
index 106eafe6..f44137fd 100644
--- a/packages/web/src/features/chat/goal-banner.tsx
+++ b/packages/web/src/features/chat/goal-banner.tsx
@@ -5,9 +5,9 @@
* (Round inputs themselves render as regular user messages with a harness-origin caption —
* see message-item.tsx; no goal-specific message rendering remains.)
*/
+import { GlyphIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeTokens } from "../../lib/format";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { GOAL_ICON, UNLIMITED_BUDGET } from "./goal-use";
import type { GoalBannerState } from "./goal-use";
import { toneSurface } from "../../lib/tone";
diff --git a/packages/web/src/features/chat/harness-banner.tsx b/packages/web/src/features/chat/harness-banner.tsx
index 3e9c728a..fb0cade9 100644
--- a/packages/web/src/features/chat/harness-banner.tsx
+++ b/packages/web/src/features/chat/harness-banner.tsx
@@ -5,9 +5,8 @@
* machine-composed protocol, worth a glance, not a read. Expanded, the full text shows in
* the tool cards' output styling; the Trace page shows the raw message as-is.
*/
+import { GlyphIcon, ICONS } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { HOOK_ICON } from "../../components/ui/icons";
import {
DISCLOSURE_CARD_CLASS,
DISCLOSURE_OUTPUT_PRE_CLASS,
@@ -19,7 +18,9 @@ export function HarnessInjectedBanner({ text }: { text: string }) {
<div className={DISCLOSURE_CARD_CLASS}>
<DisclosureRow
variant="header"
- icon={<GlyphIcon d={HOOK_ICON} size={14} className="text-gray-400 dark:text-gray-500" />}
+ icon={
+ <GlyphIcon d={ICONS.fishHook} size={14} className="text-gray-400 dark:text-gray-500" />
+ }
label={S.chat.harnessInjected}
>
<pre className={DISCLOSURE_OUTPUT_PRE_CLASS}>{text}</pre>
diff --git a/packages/web/src/features/chat/mcp-connect-banner.tsx b/packages/web/src/features/chat/mcp-connect-banner.tsx
index 4fd9c05b..4a1f03b8 100644
--- a/packages/web/src/features/chat/mcp-connect-banner.tsx
+++ b/packages/web/src/features/chat/mcp-connect-banner.tsx
@@ -11,10 +11,9 @@
* warn-and-skip stance).
*/
import { useState } from "react";
+import { Chevron, StatusIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
-import { Chevron } from "../../components/ui/chevron";
-import { StatusIcon } from "../../components/ui/status-icon";
import type { McpConnectItem, McpServerOutcome, McpToolSummary } from "../../lib/omni/stream-model";
import { StepBanner } from "./step-banner";
@@ -41,7 +40,7 @@ function ServerGroup({ outcome, tools }: { outcome: McpServerOutcome; tools: Mcp
const row = (
<>
- <StatusIcon state={failed ? "failed" : "done"} size={11} />
+ <StatusIcon state={failed ? "failed" : "done"} size="sm" />
<code className="shrink-0 font-mono text-xs text-gray-700 dark:text-gray-300">
{outcome.server}
</code>
diff --git a/packages/web/src/features/chat/memory-changes-card.tsx b/packages/web/src/features/chat/memory-changes-card.tsx
index b108d6aa..8c379d16 100644
--- a/packages/web/src/features/chat/memory-changes-card.tsx
+++ b/packages/web/src/features/chat/memory-changes-card.tsx
@@ -10,14 +10,11 @@
* it does from the panel's list; the whole card hides when nothing survives.
*/
import { useState } from "react";
+import { Chevron, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { Chevron } from "../../components/ui/chevron";
-import { ICON_SIZE } from "../../lib/icon-scale";
import type { MemoryChangeRow } from "../../lib/omni/memory-changes";
import { memoryRowKey } from "../../lib/omni/memory-changes";
import { PathLabel } from "./message-files-card";
-import { FILE_EDIT_ICON, FILE_WRITE_ICON, MEMORY_ICON } from "../../components/ui/icons";
import { scopeGlyph } from "./memory-view";
import { namedHint } from "../../components/ui/tooltip";
@@ -59,7 +56,7 @@ export function MemoryChangesCard({
className="shrink-0 text-gray-400"
>
<GlyphIcon
- d={row.op === "write" ? FILE_WRITE_ICON : FILE_EDIT_ICON}
+ d={row.op === "write" ? ICONS.filePlus : ICONS.penLine}
size={ICON_SIZE.inlineGlyph}
/>
</span>
@@ -74,7 +71,7 @@ export function MemoryChangesCard({
The action is words, in the rows' own "View content" hint style: a brain glyph here
would only repeat the card's own mark beside it, and say nothing of where it leads. */}
<div className="flex items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800/60 dark:bg-gray-800/40">
- <GlyphIcon d={MEMORY_ICON} size={ICON_SIZE.rowLead} className="shrink-0 text-gray-400" />
+ <GlyphIcon d={ICONS.brain} size={ICON_SIZE.rowLead} className="shrink-0 text-gray-400" />
<span className="min-w-0 flex-1 truncate text-sm font-medium">
{S.chat.memoryChangesTitle(alive.length)}
</span>
diff --git a/packages/web/src/features/chat/memory-view.tsx b/packages/web/src/features/chat/memory-view.tsx
index 23a520a6..48a58981 100644
--- a/packages/web/src/features/chat/memory-view.tsx
+++ b/packages/web/src/features/chat/memory-view.tsx
@@ -14,6 +14,7 @@
*/
import { useEffect, useState } from "react";
import type { SessionInfo } from "@prismshadow/penguin-server/api";
+import { GlyphIcon, ICON_SIZE, SkeletonList } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { formatRelativeDate } from "../../lib/format";
@@ -21,9 +22,6 @@ import { bodyWithoutFrontmatter } from "../../lib/frontmatter";
import type { MemoryChangeRow, MemoryLocateTarget } from "../../lib/omni/memory-changes";
import { memoryRowKey } from "../../lib/omni/memory-changes";
import { useLocale } from "../../state/locale";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { ICON_SIZE } from "../../lib/icon-scale";
-import { SkeletonList } from "../../components/ui/skeleton";
import { Md } from "./md";
import { buildMemoryList, memoryNavBack, memoryNavForRequest } from "./memory-nav";
import type { MemoryNavMode, ScopeFiles } from "./memory-nav";
diff --git a/packages/web/src/features/chat/message-files-card.tsx b/packages/web/src/features/chat/message-files-card.tsx
index 8081c6dc..96c95595 100644
--- a/packages/web/src/features/chat/message-files-card.tsx
+++ b/packages/web/src/features/chat/message-files-card.tsx
@@ -13,12 +13,9 @@
* currently openable.
*/
import { useEffect, useMemo, useState } from "react";
+import { Chevron, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { isFilePathLike, toWorkspaceRelative } from "../../lib/file-path";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { FILE_ICON } from "../../components/ui/icons";
-import { Chevron } from "../../components/ui/chevron";
-import { ICON_SIZE } from "../../lib/icon-scale";
const MAX_VISIBLE = 3;
@@ -114,7 +111,7 @@ export function MessageFilesCard({
the rows (Codex-style). No card-level action entry point — each row already has its own
"Preview", adding one to the header would just duplicate the row action. */}
<div className="flex items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800/60 dark:bg-gray-800/40">
- <GlyphIcon d={FILE_ICON} size={ICON_SIZE.rowLead} className="text-gray-400" />
+ <GlyphIcon d={ICONS.file} size={ICON_SIZE.rowLead} className="text-gray-400" />
<span className="min-w-0 flex-1 truncate text-sm font-medium">
{S.chat.filesInMessage(paths.length)}
</span>
@@ -129,7 +126,7 @@ export function MessageFilesCard({
onClick={() => onOpenFile(path)}
className="group flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50"
>
- <GlyphIcon d={FILE_ICON} size={ICON_SIZE.rowLead} className="text-gray-400" />
+ <GlyphIcon d={ICONS.file} size={ICON_SIZE.rowLead} className="text-gray-400" />
<PathLabel path={path} />
<span className="min-w-0 flex-1" />
{/* Right-aligned "click to preview" text: makes the row action explicit (a trailing
diff --git a/packages/web/src/features/chat/message-item.tsx b/packages/web/src/features/chat/message-item.tsx
index 2f8fbe8f..df3547ab 100644
--- a/packages/web/src/features/chat/message-item.tsx
+++ b/packages/web/src/features/chat/message-item.tsx
@@ -5,6 +5,7 @@
* stats lines. Items have a light entrance animation.
*/
import { useEffect, useState } from "react";
+import { CopyButton, GlyphIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { useLocale } from "../../state/locale";
import { formatMessageTime } from "../../lib/format";
@@ -12,8 +13,6 @@ import { STAT_ICONS } from "../../lib/stat-icons";
import { splitAttachments } from "../../lib/attachments";
import type { ChatItem, ReconnectItem } from "../../lib/omni/stream-model";
import { AssistantReplyBody } from "./assistant-reply-body";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { CopyButton } from "../../components/ui/copy-button";
import { ZoomableImage } from "../../components/ui/image-zoom";
import { MessageFilesCard } from "./message-files-card";
import { MemoryChangesCard } from "./memory-changes-card";
diff --git a/packages/web/src/features/chat/message-stream.tsx b/packages/web/src/features/chat/message-stream.tsx
index b0a71de9..5307d79e 100644
--- a/packages/web/src/features/chat/message-stream.tsx
+++ b/packages/web/src/features/chat/message-stream.tsx
@@ -9,12 +9,12 @@
*/
import { useEffect, useLayoutEffect, useRef, useState } from "react";
import type { ReactNode, RefObject } from "react";
+import { EmptyState } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import type { ChatItem } from "../../lib/omni/stream-model";
import type { MemoryChangeRow } from "../../lib/omni/memory-changes";
import type { TaskStats } from "../../lib/omni/task-stats";
import type { PendingApproval } from "./use-session-stream";
-import { EmptyState } from "../../components/ui/empty-state";
import { MessageItem } from "./message-item";
import { WorkspaceLinksProvider } from "./md";
import { WorkGroup, isWorkItem } from "./work-group";
diff --git a/packages/web/src/features/chat/model-picker-modal.tsx b/packages/web/src/features/chat/model-picker-modal.tsx
index 671adb0c..1c44f51e 100644
--- a/packages/web/src/features/chat/model-picker-modal.tsx
+++ b/packages/web/src/features/chat/model-picker-modal.tsx
@@ -32,13 +32,10 @@
import { useEffect, useId, useMemo, useRef, useState } from "react";
import type { KeyboardEvent as ReactKeyboardEvent } from "react";
import type { ModelInfo, ModelRefDto } from "@prismshadow/penguin-server/api";
+import { CloseButton, GlyphIcon, ICONS, ICON_SIZE, ProviderLogo } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_SIZE } from "../../lib/icon-scale";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { CloseButton } from "../../components/ui/icons";
import { Modal } from "../../components/ui/modal";
import { noAutofill, panelSearchClass } from "../../components/ui/input";
-import { ProviderLogo } from "../../components/ui/provider-logo";
import { ChoiceCheck } from "../../components/ui/field";
import { hasConfiguredKey, sameModelRef } from "../models/model-grouping";
import { loadModelGroupOrder } from "../models/model-group-order";
@@ -58,13 +55,6 @@ import {
} from "./model-picker-logic";
import type { PickerGroup, PickerNavKey, PickerRegion } from "./model-picker-logic";
-/**
- * "No key" marker for key-less rows: a key struck through by a prohibition slash (24x24 line
- * art, grayscale via currentColor, matching the approval-mode icon style).
- */
-const NO_KEY_ICON =
- "M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4M2 2l20 20";
-
const NAV_KEYS: Record<string, PickerNavKey> = {
ArrowUp: "up",
ArrowDown: "down",
@@ -294,7 +284,7 @@ function ModelPickerBody({
aria-label={S.models.noKey}
className="shrink-0 text-gray-400 dark:text-gray-500"
>
- <GlyphIcon d={NO_KEY_ICON} size={ICON_SIZE.inlineGlyph} />
+ <GlyphIcon d={ICONS.keyOff} size={ICON_SIZE.inlineGlyph} />
</span>
)}
<ChoiceCheck on={current} />
diff --git a/packages/web/src/features/chat/model-select.tsx b/packages/web/src/features/chat/model-select.tsx
index afb30260..5bb9f1e1 100644
--- a/packages/web/src/features/chat/model-select.tsx
+++ b/packages/web/src/features/chat/model-select.tsx
@@ -9,12 +9,10 @@
import { useState } from "react";
import type { KeyboardEvent, ReactNode } from "react";
import type { ModelInfo, ModelRefDto } from "@prismshadow/penguin-server/api";
+import { ChevronDown, ICON_SIZE, ProviderLogo } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { FormPickerTrigger } from "../../components/ui/form-picker";
-import { ChevronDown } from "../../components/ui/icons";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { menuSearchClass, noAutofill } from "../../components/ui/input";
-import { ProviderLogo } from "../../components/ui/provider-logo";
import { sameModelRef } from "../models/model-grouping";
import { modelLabel } from "./model-picker-logic";
import { ModelPickerModal } from "./model-picker-modal";
diff --git a/packages/web/src/features/chat/org-trigger-banner.tsx b/packages/web/src/features/chat/org-trigger-banner.tsx
index a4e7adf8..635eb0dc 100644
--- a/packages/web/src/features/chat/org-trigger-banner.tsx
+++ b/packages/web/src/features/chat/org-trigger-banner.tsx
@@ -4,9 +4,9 @@
* trigger, the event / message / ticket it names, and the budget line — the same shape as the
* scheduled-task banner beside it. The trigger's body renders as usual below.
*/
+import { Badge } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { formatDateTime } from "../../lib/format";
-import { Badge } from "../../components/ui/badge";
import { summarizeOrgTrigger } from "./org-trigger";
import type { OrgTriggerOrigin } from "./org-trigger";
@@ -16,7 +16,7 @@ export function OrgTriggerBanner({ origin }: { origin: OrgTriggerOrigin }) {
return (
<p className="anim-msg my-2 flex w-fit flex-wrap items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400">
<span>{S.chat.orgTriggerFrom(t.org)}</span>
- <Badge tone="brand">{kind}</Badge>
+ <Badge variant="solid">{kind}</Badge>
{t.subject !== null && (
<span className="font-mono text-gray-700 dark:text-gray-300">
{t.subject}
diff --git a/packages/web/src/features/chat/panels-toolbar.tsx b/packages/web/src/features/chat/panels-toolbar.tsx
index a5e35421..e4cfcdf2 100644
--- a/packages/web/src/features/chat/panels-toolbar.tsx
+++ b/packages/web/src/features/chat/panels-toolbar.tsx
@@ -10,10 +10,8 @@
* nested approval discoverable while the panel is off screen.
*/
import { useSyncExternalStore } from "react";
+import { GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { PANEL_BOTTOM_ICON, PANEL_RIGHT_ICON } from "../../components/ui/icons";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { useShortcutTitle } from "../../lib/shortcuts/use-keymap";
import { toneDot } from "../../lib/tone";
import {
@@ -46,8 +44,8 @@ export function PanelsToolbar({ agentsPending }: PanelsToolbarProps) {
const bottomTitle = useShortcutTitle(S.dock.bottomDock, "dock.toggleBottom");
const rightTitle = useShortcutTitle(S.dock.rightDock, "dock.toggleRight");
const toggles: Array<{ position: DockPosition; label: string; title: string; icon: string }> = [
- { position: "bottom", label: S.dock.bottomDock, title: bottomTitle, icon: PANEL_BOTTOM_ICON },
- { position: "right", label: S.dock.rightDock, title: rightTitle, icon: PANEL_RIGHT_ICON },
+ { position: "bottom", label: S.dock.bottomDock, title: bottomTitle, icon: ICONS.panelBottom },
+ { position: "right", label: S.dock.rightDock, title: rightTitle, icon: ICONS.panelRight },
];
return (
diff --git a/packages/web/src/features/chat/permission-select.tsx b/packages/web/src/features/chat/permission-select.tsx
index 5178db67..ab8f61ab 100644
--- a/packages/web/src/features/chat/permission-select.tsx
+++ b/packages/web/src/features/chat/permission-select.tsx
@@ -16,9 +16,9 @@
import { useState } from "react";
import type { ReactNode } from "react";
import type { ApprovalMode, SessionSandbox } from "@prismshadow/penguin-server/api";
+import { GlyphIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { Dropdown } from "../../components/ui/dropdown";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { toneInk } from "../../lib/tone";
import {
PERMISSION_LEVEL_GLYPH,
diff --git a/packages/web/src/features/chat/reference-chip.tsx b/packages/web/src/features/chat/reference-chip.tsx
index 4920f4e1..309dacac 100644
--- a/packages/web/src/features/chat/reference-chip.tsx
+++ b/packages/web/src/features/chat/reference-chip.tsx
@@ -3,13 +3,11 @@
* directory, a quoted range of a file, or an excerpt of the conversation — never the text the
* message will carry. The composer draws one per staged reference, above its text body.
*/
+import { GlyphIcon, ICONS } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { excerptLabel } from "../../lib/selection-menu";
import { lineSuffix } from "../../lib/workspace-tree";
import type { ComposerReference } from "../../lib/workspace-tree";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { FOLDER_ICON } from "../../components/ui/group-list";
-import { FILE_ICON, QUOTE_ICON } from "../../components/ui/icons";
/**
* A staged reference, split for display: its name, and the quoted lines as a `:from-to` suffix.
@@ -42,10 +40,10 @@ function referenceTitle(reference: ComposerReference): string {
* than from a file.
*/
const REFERENCE_ICON: Record<ComposerReference["kind"], string> = {
- dir: FOLDER_ICON,
- file: FILE_ICON,
- quote: QUOTE_ICON,
- excerpt: QUOTE_ICON,
+ dir: ICONS.folder,
+ file: ICONS.file,
+ quote: ICONS.quote,
+ excerpt: ICONS.quote,
};
export function ReferenceChip({
diff --git a/packages/web/src/features/chat/shortcuts-folder.tsx b/packages/web/src/features/chat/shortcuts-folder.tsx
index e58aa3d5..463fb483 100644
--- a/packages/web/src/features/chat/shortcuts-folder.tsx
+++ b/packages/web/src/features/chat/shortcuts-folder.tsx
@@ -19,17 +19,13 @@
* out of reach on a phone.
*/
import { useCallback, useEffect, useRef, useState } from "react";
+import { Button, GlyphIcon, ICONS, ICON_SIZE, PlusIcon } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { ICON_SIZE } from "../../lib/icon-scale";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { PlusIcon } from "../../components/ui/icons";
import { Input, Textarea } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
-import { PENCIL_ICON, TRASH_ICON } from "../../components/ui/session-row-menu";
import { toastError } from "../../components/ui/toast";
import { ExampleFolderRow, exampleRowClass } from "./example-folder-row";
import {
@@ -180,12 +176,12 @@ export function ShortcutsFolder({
</button>
<RowAction
label={S.common.edit}
- glyph={PENCIL_ICON}
+ glyph={ICONS.pencil}
onClick={() => setDraft({ ...shortcut })}
/>
<RowAction
label={S.common.delete}
- glyph={TRASH_ICON}
+ glyph={ICONS.trash}
danger
onClick={() => setDeleting(shortcut)}
/>
diff --git a/packages/web/src/features/chat/skill-use.ts b/packages/web/src/features/chat/skill-use.ts
index d3b0b1c0..1b2a3e8b 100644
--- a/packages/web/src/features/chat/skill-use.ts
+++ b/packages/web/src/features/chat/skill-use.ts
@@ -9,12 +9,12 @@
* part: icon path, UI-language text selection, dropdown filtering and slash command items.
*/
import type { SkillMetadataItem } from "@prismshadow/penguin-server/api";
+import { ICONS } from "@prismshadow/penguin-ui";
export { buildSkillsMessage, parseSkillsMessage } from "@prismshadow/penguin-core/markers";
/** Book icon (24×24 line path): the mark of skills as a kind — the composer's skills button, the "using skills" banner, the agents page's skill count, and what a skill draws when it carries no plugin icon (skill-icon-view.tsx). */
-export const BOOK_ICON =
- "M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z";
+export const BOOK_ICON = ICONS.bookOpen;
/**
* Picks copy based on the UI language: uses the Chinese value when locale is zh and one is
diff --git a/packages/web/src/features/chat/skills-banner.tsx b/packages/web/src/features/chat/skills-banner.tsx
index 6fbac731..6bac9b03 100644
--- a/packages/web/src/features/chat/skills-banner.tsx
+++ b/packages/web/src/features/chat/skills-banner.tsx
@@ -4,8 +4,8 @@
* static text, no navigation — skill management lives on the skill library page); the body text
* after the block is rendered as usual by the caller.
*/
+import { GlyphIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { BOOK_ICON } from "./skill-use";
export function SkillsBanner({ names }: { names: string[] }) {
diff --git a/packages/web/src/features/chat/step-banner.tsx b/packages/web/src/features/chat/step-banner.tsx
index 5d95b5ae..51756034 100644
--- a/packages/web/src/features/chat/step-banner.tsx
+++ b/packages/web/src/features/chat/step-banner.tsx
@@ -17,10 +17,9 @@
*/
import { useEffect, useRef, useState } from "react";
import type { ReactNode } from "react";
+import { Chevron, StatusIcon } from "@prismshadow/penguin-ui";
+import type { RunState } from "@prismshadow/penguin-ui";
import { humanizeDuration } from "../../lib/format";
-import { Chevron } from "../../components/ui/chevron";
-import { StatusIcon } from "../../components/ui/status-icon";
-import type { RunState } from "../../components/ui/status-icon";
import { LiveDuration } from "./live-duration";
import { toneInk } from "../../lib/tone";
diff --git a/packages/web/src/features/chat/stream-selection-menu.tsx b/packages/web/src/features/chat/stream-selection-menu.tsx
index e476de08..bcb03bdd 100644
--- a/packages/web/src/features/chat/stream-selection-menu.tsx
+++ b/packages/web/src/features/chat/stream-selection-menu.tsx
@@ -28,6 +28,7 @@ import type {
PointerEvent as ReactPointerEvent,
ReactNode,
} from "react";
+import { ICONS } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { STAT_ICONS } from "../../lib/stat-icons";
import { isDesktopShellWindow } from "../../lib/account-menu";
@@ -47,12 +48,6 @@ import { useAuth } from "../../state/auth";
import { useRowContextMenu } from "../../components/ui/context-menu";
import { writeClipboard } from "../../lib/clipboard";
import { Dropdown } from "../../components/ui/dropdown";
-import {
- ADD_TO_CHAT_ICON,
- EXTERNAL_LINK_ICON,
- GLOBE_ICON,
- LINK_ICON,
-} from "../../components/ui/icons";
import { overflowMenuGlyph, overflowMenuRowClass } from "../../components/ui/session-row-menu";
import { restoreSelection } from "../../components/ui/text-selection";
import { toastSuccess } from "../../components/ui/toast";
@@ -114,7 +109,7 @@ export function SelectionMenuRows({
onDone(selection);
}}
>
- {overflowMenuGlyph(ADD_TO_CHAT_ICON)}
+ {overflowMenuGlyph(ICONS.messagePlus)}
{S.files.addToChat}
</button>
),
@@ -161,7 +156,7 @@ export function LinkMenuRows({
className={overflowMenuRowClass}
onClick={run(() => openLinkInBrowser(href))}
>
- {overflowMenuGlyph(GLOBE_ICON)}
+ {overflowMenuGlyph(ICONS.globe)}
{S.chat.linkMenu.openInBuiltinBrowser}
</button>
);
@@ -173,7 +168,7 @@ export function LinkMenuRows({
className={overflowMenuRowClass}
onClick={run(() => window.open(href, "_blank", "noopener,noreferrer"))}
>
- {overflowMenuGlyph(EXTERNAL_LINK_ICON)}
+ {overflowMenuGlyph(ICONS.externalLink)}
{desktopShell ? S.chat.linkMenu.openExternal : S.chat.linkMenu.openInNewTab}
</button>
);
@@ -187,7 +182,7 @@ export function LinkMenuRows({
void writeClipboard(href).then((ok) => ok && toastSuccess(S.common.copied));
})}
>
- {overflowMenuGlyph(LINK_ICON)}
+ {overflowMenuGlyph(ICONS.chainLink)}
{S.chat.linkMenu.copyLink}
</button>
);
diff --git a/packages/web/src/features/chat/subagent-chip.tsx b/packages/web/src/features/chat/subagent-chip.tsx
index 73c65bc4..20b1c38b 100644
--- a/packages/web/src/features/chat/subagent-chip.tsx
+++ b/packages/web/src/features/chat/subagent-chip.tsx
@@ -8,10 +8,10 @@
* subtree, so a nested approval stays discoverable with the panel closed. Clicking opens the
* panel focused on this child via ctx.onOpenSubagent.
*/
+import { AgentAvatar } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { hasPendingWithinOrigin } from "../../lib/omni/stream-model";
import type { StreamModel } from "../../lib/omni/stream-model";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
import { useProject } from "../../state/project";
import { useSessions } from "../../state/sessions";
import { resolveAgentLabel, shortSessionId } from "./agent-topology";
diff --git a/packages/web/src/features/chat/subagents-view.tsx b/packages/web/src/features/chat/subagents-view.tsx
index c10affeb..93289f69 100644
--- a/packages/web/src/features/chat/subagents-view.tsx
+++ b/packages/web/src/features/chat/subagents-view.tsx
@@ -33,6 +33,7 @@ import type {
SubagentRuntimeInfo,
TaskInputPart,
} from "@prismshadow/penguin-server/api";
+import { AgentAvatar, EmptyState, GlyphIcon, ICON_SIZE, StatusIcon } from "@prismshadow/penguin-ui";
import { ApiError } from "../../api/client";
import { abortSubagent, getAgentSkills, messageSubagent, patchSession } from "../../api/endpoints";
import { toastError } from "../../components/ui/toast";
@@ -41,11 +42,6 @@ import { S } from "../../lib/strings";
import type { NestedSessionMeta, StreamModel } from "../../lib/omni/stream-model";
import { ChatInput } from "./chat-input";
import type { ComposerControl } from "./chat-input";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { StatusIcon } from "../../components/ui/status-icon";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { noteSessionSeen } from "../../lib/session-seen";
import { useProject } from "../../state/project";
import { useSessions } from "../../state/sessions";
@@ -261,7 +257,7 @@ export function SubagentsView({
{shortSessionId(active.sessionId)}
</span>
{activeRunning && (
- <StatusIcon state="running" size={10} label={S.chat.subagentRunning} />
+ <StatusIcon state="running" size="xs" label={S.chat.subagentRunning} />
)}
<span className="min-w-0 flex-1" />
{/* Jump out of the panel: the child conversation as a full Session. */}
diff --git a/packages/web/src/features/chat/task-stats-line.tsx b/packages/web/src/features/chat/task-stats-line.tsx
index 7d480047..611f95ae 100644
--- a/packages/web/src/features/chat/task-stats-line.tsx
+++ b/packages/web/src/features/chat/task-stats-line.tsx
@@ -28,6 +28,7 @@
*/
import { useState } from "react";
import type { TracePosition } from "@prismshadow/penguin-server/api";
+import { CopyButton, GlyphIcon } from "@prismshadow/penguin-ui";
import { formatTaskStats } from "../../lib/omni/task-stats";
import type { TaskStats } from "../../lib/omni/task-stats";
import {
@@ -39,9 +40,7 @@ import {
} from "../../lib/format";
import { STAT_ICONS } from "../../lib/stat-icons";
import { S } from "../../lib/strings";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { CopyButton } from "../../components/ui/copy-button";
import { useTheme } from "../../state/theme";
import { useLocale } from "../../state/locale";
@@ -186,11 +185,7 @@ export function TaskStatsLine({
)}
</span>
{/* Pinned at the row's end, outside the scrollable stats span. */}
- <CopyButton
- text={copyText}
- label={S.chat.copyReply}
- className="flex h-5 w-5 shrink-0 items-center justify-center rounded transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300"
- />
+ <CopyButton text={copyText} label={S.chat.copyReply} size="sm" className="shrink-0" />
{/* Fork sits to the RIGHT of copy (review request): copy is the frequent action and
keeps its accustomed spot; the click only opens the confirmation below — the fork
request fires on Confirm, never directly. */}
diff --git a/packages/web/src/features/chat/thinking-block.tsx b/packages/web/src/features/chat/thinking-block.tsx
index 29d66e84..b1087103 100644
--- a/packages/web/src/features/chat/thinking-block.tsx
+++ b/packages/web/src/features/chat/thinking-block.tsx
@@ -5,11 +5,11 @@
* same source every other disclosure row uses; shares the running-state icons (in progress /
* done / failed) with tool cards.
*/
+import { StatusIcon } from "@prismshadow/penguin-ui";
+import type { RunState } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
import type { ThinkingItem } from "../../lib/omni/stream-model";
-import { StatusIcon } from "../../components/ui/status-icon";
-import type { RunState } from "../../components/ui/status-icon";
import { DISCLOSURE_BODY_MD_CLASS, DisclosureRow, activityState } from "./disclosure-row";
import { LiveDuration } from "./live-duration";
import { Md } from "./md";
diff --git a/packages/web/src/features/chat/tool-call-card.tsx b/packages/web/src/features/chat/tool-call-card.tsx
index 57d75646..f4f35248 100644
--- a/packages/web/src/features/chat/tool-call-card.tsx
+++ b/packages/web/src/features/chat/tool-call-card.tsx
@@ -16,13 +16,14 @@
*/
import { useMemo, useRef, useState } from "react";
import { DETACHED_TOOL_NOTE_PREFIX } from "@prismshadow/penguin-core/interfaces";
+import { Chevron, StatusIcon } from "@prismshadow/penguin-ui";
+import type { RunState } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
import { toolDisplayName } from "../../lib/tool-alias";
import { stripAnsi } from "../../lib/strip-ansi";
import { approvalKey } from "../../lib/omni/stream-model";
import type { ToolCallItem } from "../../lib/omni/stream-model";
-import { Chevron } from "../../components/ui/chevron";
import {
ActivityProgress,
DISCLOSURE_OUTPUT_PRE_CLASS,
@@ -32,8 +33,6 @@ import {
} from "./disclosure-row";
import { ZoomableImage } from "../../components/ui/image-zoom";
import { toneInk } from "../../lib/tone";
-import { StatusIcon } from "../../components/ui/status-icon";
-import type { RunState } from "../../components/ui/status-icon";
import { ApprovalButtons } from "./approval-buttons";
import { LiveDuration, useElapsedPast } from "./live-duration";
import { useTheme } from "../../state/theme";
diff --git a/packages/web/src/features/chat/work-group.tsx b/packages/web/src/features/chat/work-group.tsx
index be611360..19583733 100644
--- a/packages/web/src/features/chat/work-group.tsx
+++ b/packages/web/src/features/chat/work-group.tsx
@@ -19,9 +19,9 @@
* group away from the end, or the Task has actually finished.
*/
import { useEffect, useRef, useState } from "react";
+import { Chevron, StatusIcon } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { humanizeDuration } from "../../lib/format";
-import { Chevron } from "../../components/ui/chevron";
import {
ActivityProgress,
DISCLOSURE_CARD_CLASS,
@@ -29,7 +29,6 @@ import {
DISCLOSURE_HEADER_STICKY_CLASS,
DISCLOSURE_HEADER_TITLE_CLASS,
} from "./disclosure-row";
-import { StatusIcon } from "../../components/ui/status-icon";
import { approvalKey } from "../../lib/omni/stream-model";
import type { ChatItem } from "../../lib/omni/stream-model";
import { LiveDuration } from "./live-duration";
diff --git a/packages/web/src/features/chat/workspace-browser.tsx b/packages/web/src/features/chat/workspace-browser.tsx
index d3d07e6e..5b4e2867 100644
--- a/packages/web/src/features/chat/workspace-browser.tsx
+++ b/packages/web/src/features/chat/workspace-browser.tsx
@@ -47,6 +47,19 @@ import type {
PointerEvent as ReactPointerEvent,
} from "react";
import ReactMarkdown from "react-markdown";
+import {
+ Button,
+ CloseIcon,
+ CopiedStatus,
+ CopyCheckGlyph,
+ EmptyState,
+ GlyphIcon,
+ HiddenFileInput,
+ ICONS,
+ ICON_SIZE,
+ SkeletonList,
+ useCopied,
+} from "@prismshadow/penguin-ui";
import { REHYPE_PLUGINS, REMARK_PLUGINS } from "../../lib/markdown-plugins";
import type { SessionInfo, WorkspaceSearchHit } from "@prismshadow/penguin-server/api";
import * as api from "../../api/endpoints";
@@ -100,31 +113,14 @@ import {
} from "../../lib/workspace-tree";
import type { ComposerReference, EditorState, Listings } from "../../lib/workspace-tree";
import { isContextMenuKey, isLongPressPointer } from "../../lib/context-menu";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
import { useRowContextMenu } from "../../components/ui/context-menu";
-import { CopiedStatus, CopyCheckGlyph, useCopied } from "../../components/ui/copy-button";
import { Dropdown } from "../../components/ui/dropdown";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { FOLDER_OPEN_ICON } from "../../components/ui/group-list";
-import { HiddenFileInput } from "../../components/ui/hidden-file-input";
-import {
- CloseIcon,
- DOWNLOAD_ICON,
- EXTERNAL_LINK_ICON,
- FILE_EDIT_ICON,
- REFRESH_ICON,
- UPLOAD_ICON,
- WRAP_TEXT_ICON,
-} from "../../components/ui/icons";
import { Input, noAutofill, panelSearchClass } from "../../components/ui/input";
import { ZoomableImage } from "../../components/ui/image-zoom";
-import { SkeletonList } from "../../components/ui/skeleton";
import { restoreSelection } from "../../components/ui/text-selection";
import { Tooltip } from "../../components/ui/tooltip";
import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { STAT_ICONS } from "../../lib/stat-icons";
import { toneInk } from "../../lib/tone";
import { setCloseGuard } from "../dock/close-guard";
@@ -154,8 +150,6 @@ const SNIFF_BYTES = 8 * 1024;
const SEARCH_DEBOUNCE_MS = 250;
/** Window with a left pane: the tree toggle. */
const PANEL_LEFT_ICON = "M4 5h16v14H4zM10 5v14";
-/** Left-pointing chevron: the narrow layout's back-to-tree button. */
-const BACK_ICON = "M15 18l-6-6 6-6";
/** An external reference with a scheme (http(s)/mailto/data, etc.), passed through as-is in the md rendered view. */
const EXTERNAL_REF_RE = /^[a-z][a-z0-9+.-]*:/i;
@@ -586,7 +580,7 @@ export function WorkspaceBrowser({
/**
* The preview header's copy action. Driven by the hook rather than a plain CopyButton
* because the tooltip is a Tooltip panel here, not a `title`, and a trigger may carry only
- * one of the two — the glyph swap and the live region are the ones copy-button.tsx owns.
+ * one of the two — the glyph swap and the live region are the ones CopyButton uses.
*/
const { copied, flash: flashCopy } = useCopied();
const [width, setWidth] = useState(0);
@@ -1790,7 +1784,7 @@ export function WorkspaceBrowser({
onClick={refreshAll}
className={iconActionClass}
>
- <GlyphIcon d={REFRESH_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.refresh} size={ICON_SIZE.iconButton} />
</button>
</Tooltip>
{/* The picker's own input carries the name: a label with no text names nothing, and the
@@ -1809,7 +1803,7 @@ export function WorkspaceBrowser({
{uploading !== null ? (
<span className="inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-[1.5px] border-current border-t-transparent" />
) : (
- <GlyphIcon d={UPLOAD_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.upload} size={ICON_SIZE.iconButton} />
)}
</label>
</Tooltip>
@@ -1935,7 +1929,7 @@ export function WorkspaceBrowser({
onClick={() => setWrap(!wrapLines)}
className={iconToggleClass(wrapLines)}
>
- <GlyphIcon d={WRAP_TEXT_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.wrapText} size={ICON_SIZE.iconButton} />
</button>
</Tooltip>
);
@@ -2008,7 +2002,7 @@ export function WorkspaceBrowser({
onClick={() => void startEdit()}
className={iconActionClass}
>
- <GlyphIcon d={FILE_EDIT_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.penLine} size={ICON_SIZE.iconButton} />
</button>
</Tooltip>
)}
@@ -2029,7 +2023,7 @@ export function WorkspaceBrowser({
aria-label={openInNewTabLabel}
className={`${iconActionClass} ${previewIsolated ? "" : toneInk.attention}`}
>
- <GlyphIcon d={EXTERNAL_LINK_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.externalLink} size={ICON_SIZE.iconButton} />
</a>
</Tooltip>
)}
@@ -2384,7 +2378,7 @@ export function WorkspaceBrowser({
aria-label={S.files.download}
className={iconActionClass}
>
- <GlyphIcon d={DOWNLOAD_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.download} size={ICON_SIZE.iconButton} />
</a>
</Tooltip>
{isShellWindow && (
@@ -2395,7 +2389,7 @@ export function WorkspaceBrowser({
onClick={() => void revealInFolder(preview.path)}
className={iconActionClass}
>
- <GlyphIcon d={FOLDER_OPEN_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.folderOpen} size={ICON_SIZE.iconButton} />
</button>
</Tooltip>
)}
@@ -2446,7 +2440,7 @@ export function WorkspaceBrowser({
onClick={backToTree}
className={iconActionClass}
>
- <GlyphIcon d={BACK_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.chevronLeft} size={ICON_SIZE.iconButton} />
</button>
</Tooltip>
)}
diff --git a/packages/web/src/features/chat/workspace-file-menu.tsx b/packages/web/src/features/chat/workspace-file-menu.tsx
index 98054e44..d522d192 100644
--- a/packages/web/src/features/chat/workspace-file-menu.tsx
+++ b/packages/web/src/features/chat/workspace-file-menu.tsx
@@ -13,16 +13,10 @@
* The rows reuse the session row menu's compact styling (see its module header, which already
* declares itself shared beyond that row), so every overflow menu in the app reads the same.
*/
+import { ICONS } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { STAT_ICONS } from "../../lib/stat-icons";
import {
- ADD_TO_CHAT_ICON,
- DOWNLOAD_ICON,
- FILE_EDIT_ICON,
- UPLOAD_ICON,
-} from "../../components/ui/icons";
-import {
- TRASH_ICON,
overflowMenuDangerClass,
overflowMenuGlyph,
overflowMenuRowClass,
@@ -78,12 +72,12 @@ export function WorkspaceFileMenuRows({
{S.files.copyPath}
</button>
<button type="button" className={overflowMenuRowClass} onClick={() => onAddToChat(target)}>
- {overflowMenuGlyph(ADD_TO_CHAT_ICON)}
+ {overflowMenuGlyph(ICONS.messagePlus)}
{S.files.addToChat}
</button>
{onAddSelection !== undefined && (
<button type="button" className={overflowMenuRowClass} onClick={onAddSelection}>
- {overflowMenuGlyph(ADD_TO_CHAT_ICON)}
+ {overflowMenuGlyph(ICONS.messagePlus)}
{S.files.addSelectionToChat}
</button>
)}
@@ -93,7 +87,7 @@ export function WorkspaceFileMenuRows({
className={overflowMenuRowClass}
onClick={() => onUploadInto(target.path)}
>
- {overflowMenuGlyph(UPLOAD_ICON)}
+ {overflowMenuGlyph(ICONS.upload)}
{S.files.uploadHere}
</button>
) : (
@@ -104,7 +98,7 @@ export function WorkspaceFileMenuRows({
onClick={onClose}
className={overflowMenuRowClass}
>
- {overflowMenuGlyph(DOWNLOAD_ICON)}
+ {overflowMenuGlyph(ICONS.download)}
{S.files.download}
</a>
{/* The two that change the Workspace come last, after everything that only reads it,
@@ -112,7 +106,7 @@ export function WorkspaceFileMenuRows({
lands, in the red every other overflow menu gives a delete. */}
{onRename !== undefined && (
<button type="button" className={overflowMenuRowClass} onClick={() => onRename(target)}>
- {overflowMenuGlyph(FILE_EDIT_ICON)}
+ {overflowMenuGlyph(ICONS.penLine)}
{S.files.renameTitle}
</button>
)}
@@ -122,7 +116,7 @@ export function WorkspaceFileMenuRows({
className={overflowMenuDangerClass}
onClick={() => onDelete(target)}
>
- {overflowMenuGlyph(TRASH_ICON)}
+ {overflowMenuGlyph(ICONS.trash)}
{S.common.delete}
</button>
)}
diff --git a/packages/web/src/features/chat/workspace-finder.tsx b/packages/web/src/features/chat/workspace-finder.tsx
index 8ad725a6..515f470d 100644
--- a/packages/web/src/features/chat/workspace-finder.tsx
+++ b/packages/web/src/features/chat/workspace-finder.tsx
@@ -24,6 +24,7 @@ import type {
ReactNode,
} from "react";
import type { DesktopPrivacyPane, DirListResponse } from "@prismshadow/penguin-server/api";
+import { Button, CloseIcon, GlyphIcon, ICONS, ICON_GAP, ICON_SIZE } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { writeClipboard } from "../../lib/clipboard";
@@ -32,32 +33,16 @@ import { apiErrorText } from "../../lib/api-error";
import { isContextMenuKey, isLongPressPointer } from "../../lib/context-menu";
import { isElectronRenderer } from "../../lib/desktop-renderer";
import { formatDateTime } from "../../lib/format";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { STAT_ICONS } from "../../lib/stat-icons";
import { NoticeStrip } from "../../components/ui/notice-strip";
import { machineLabel, nameOnMachine, workspaceMachines } from "../../lib/workspace-machines";
import type { WorkspaceMachine } from "../../lib/workspace-machines";
import { useSessions } from "../../state/sessions";
import { Modal } from "../../components/ui/modal";
-import { Button } from "../../components/ui/button";
import { useRowContextMenu } from "../../components/ui/context-menu";
import { Dropdown } from "../../components/ui/dropdown";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { CLOCK_ICON, FOLDER_ICON, FOLDER_OPEN_ICON } from "../../components/ui/group-list";
-import {
- ARROW_BACK_ICON,
- ARROW_FORWARD_ICON,
- CloseIcon,
- DOWNLOAD_ICON,
- FILE_ICON,
- REFRESH_ICON,
-} from "../../components/ui/icons";
import { noAutofill } from "../../components/ui/input";
-import {
- PIN_ICON,
- overflowMenuGlyph,
- overflowMenuRowClass,
-} from "../../components/ui/session-row-menu";
+import { overflowMenuGlyph, overflowMenuRowClass } from "../../components/ui/session-row-menu";
import { toastError, toastSuccess } from "../../components/ui/toast";
import {
EMPTY_HISTORY,
@@ -113,20 +98,20 @@ const ENTER_ICON = "M9 18l6-6-6-6";
const PLACE_ICON: Record<Place["key"], string> = {
home: HOME_ICON,
desktop: DESKTOP_ICON,
- documents: FILE_ICON,
- downloads: DOWNLOAD_ICON,
+ documents: ICONS.file,
+ downloads: ICONS.download,
pictures: PICTURES_ICON,
drive: DRIVE_ICON,
- folder: FOLDER_ICON,
+ folder: ICONS.folder,
};
const MENU_ICON: Record<FinderMenuItem, string> = {
- open: FOLDER_OPEN_ICON,
+ open: ICONS.folderOpen,
choose: CHECK_ICON,
- addToQuickAccess: PIN_ICON,
- removeFromQuickAccess: PIN_ICON,
+ addToQuickAccess: ICONS.pin,
+ removeFromQuickAccess: ICONS.pin,
copyPath: STAT_ICONS.copy,
- refresh: REFRESH_ICON,
+ refresh: ICONS.refresh,
};
function isMacPlatform(): boolean {
@@ -912,7 +897,7 @@ export function WorkspaceFinder({
{recents.map((r) =>
sideRow({
key: `recent:${r.machineId ?? ""}:${r.path}`,
- icon: CLOCK_ICON,
+ icon: ICONS.clock,
label: nameOnMachine(
baseName(r.path),
r.machineId === null ? null : machineLabel(machines, r.machineId),
@@ -1017,7 +1002,7 @@ export function WorkspaceFinder({
onClick={editAddress}
className="flex h-full shrink-0 items-center pl-2.5 pr-1 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:text-gray-500 dark:hover:text-gray-200"
>
- <GlyphIcon d={FOLDER_ICON} size={ICON_SIZE.inlineGlyph} />
+ <GlyphIcon d={ICONS.folder} size={ICON_SIZE.inlineGlyph} />
</button>
<nav
ref={crumbsRef}
@@ -1092,7 +1077,7 @@ export function WorkspaceFinder({
aria-label={f.back}
onClick={() => step(-1)}
>
- <GlyphIcon d={ARROW_BACK_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.arrowLeftCentered} size={ICON_SIZE.iconButton} />
</button>
<button
type="button"
@@ -1102,7 +1087,7 @@ export function WorkspaceFinder({
aria-label={f.forward}
onClick={() => step(1)}
>
- <GlyphIcon d={ARROW_FORWARD_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.arrowRightCentered} size={ICON_SIZE.iconButton} />
</button>
<button
type="button"
@@ -1123,7 +1108,7 @@ export function WorkspaceFinder({
aria-label={f.refresh}
onClick={refresh}
>
- <GlyphIcon d={REFRESH_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.refresh} size={ICON_SIZE.iconButton} />
</button>
</div>
{addressBar}
@@ -1253,7 +1238,7 @@ export function WorkspaceFinder({
}`}
>
<GlyphIcon
- d={folder ? FOLDER_ICON : FILE_ICON}
+ d={folder ? ICONS.folder : ICONS.file}
size={ICON_SIZE.rowLead}
className={`shrink-0 ${accent ? "" : "text-gray-400"}`}
/>
diff --git a/packages/web/src/features/chat/workspace-select.tsx b/packages/web/src/features/chat/workspace-select.tsx
index fa32039d..3e3189b1 100644
--- a/packages/web/src/features/chat/workspace-select.tsx
+++ b/packages/web/src/features/chat/workspace-select.tsx
@@ -12,12 +12,9 @@
*/
import { useState } from "react";
import type { ReactNode } from "react";
+import { Chevron, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Chevron } from "../../components/ui/chevron";
import { FormPickerTrigger } from "../../components/ui/form-picker";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { FOLDER_ICON } from "../../components/ui/group-list";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { WorkspaceFinder } from "./workspace-finder";
import { baseName } from "./workspace-finder-model";
@@ -107,7 +104,11 @@ export function WorkspaceSelect({
/** Folder glyph shared by both built-in triggers. */
const folderIcon = (extraClass: string) => (
- <GlyphIcon d={FOLDER_ICON} size={ICON_SIZE.rowLead} className={`text-gray-400 ${extraClass}`} />
+ <GlyphIcon
+ d={ICONS.folder}
+ size={ICON_SIZE.rowLead}
+ className={`text-gray-400 ${extraClass}`}
+ />
);
if (trigger) {
diff --git a/packages/web/src/features/company/calendar-page.tsx b/packages/web/src/features/company/calendar-page.tsx
index effd8990..c57786b4 100644
--- a/packages/web/src/features/company/calendar-page.tsx
+++ b/packages/web/src/features/company/calendar-page.tsx
@@ -26,27 +26,31 @@ import type {
OrgCalendarOutcome,
OrgChartResponse,
} from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ CloseIcon,
+ GlyphIcon,
+ ICONS,
+ ICON_GAP,
+ ICON_SIZE,
+ Skeleton,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime } from "../../lib/format";
import { useDocumentTitle } from "../../lib/use-document-title";
import { employeeColor } from "../../lib/category-colors";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { toneInk } from "../../lib/tone";
import type { Tone } from "../../lib/tone";
import { useAuth } from "../../state/auth";
import { useCompany } from "../../state/company";
-import { Button } from "../../components/ui/button";
import { Segmented } from "../../components/ui/segmented";
import { Select } from "../../components/ui/select";
import { Switch } from "../../components/ui/switch";
import { Input, Textarea } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { CloseIcon } from "../../components/ui/icons";
-import { Skeleton } from "../../components/ui/skeleton";
import { usePortalPanel } from "../../components/ui/use-portal-panel";
import { toastAttention, toastError, toastSuccess } from "../../components/ui/toast";
import { OrgPage, useOrg } from "./org-layout";
@@ -69,9 +73,6 @@ import type { Cadence, CalendarView, EventInstance, GridDay } from "./calendar-g
import { dismissHint, hintKey, isHintDismissed } from "./page-hints";
import { NoticeStrip } from "../../components/ui/notice-strip";
-const PREV_ICON = "M15 18 9 12l6-6";
-const NEXT_ICON = "m9 18 6-6-6-6";
-
const OUTCOME_TONE: Record<OrgCalendarOutcome, Tone> = {
fired: "success",
queued: "attention",
@@ -82,8 +83,8 @@ const OUTCOME_TONE: Record<OrgCalendarOutcome, Tone> = {
/** The mark a recorded outcome leaves on its instance: a check, an hourglass, a pause, a cross, an alert. */
const OUTCOME_ICON: Record<OrgCalendarOutcome, string> = {
- fired: "M5 13l4 4L19 7",
- queued: "M6 3h12M6 21h12M8 3v3.5L12 10l4-3.5V3M8 21v-3.5L12 14l4 3.5V21",
+ fired: ICONS.check,
+ queued: ICONS.hourglass,
paused: "M9 5v14M15 5v14",
missed: "M18 6 6 18M6 6l12 12",
error: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 8v4m0 4h.01",
@@ -105,9 +106,6 @@ const MONTH_CELL_CHIPS = 3;
*/
const DAY_PANEL_WIDTH = 240;
-/** The plus that leads the "new event" hint an empty slot spells out while the pointer is on it. */
-const PLUS_ICON = "M12 5v14M5 12h14";
-
/**
* The create control that fills an empty calendar slot — a month cell, an hour row of the week
* and day columns. It is a real button, so it takes focus and the keyboard, and it lies *under*
@@ -145,7 +143,7 @@ function CreateSlotHint({ className = "" }: { className?: string }) {
<span
className={`pointer-events-none z-10 inline-flex items-center ${ICON_GAP.tight} text-[10px] leading-4 text-gray-500 opacity-0 transition-opacity duration-150 group-hover/slot:opacity-100 group-focus-visible/slot:opacity-100 dark:text-gray-400 ${className}`}
>
- <GlyphIcon d={PLUS_ICON} size={ICON_SIZE.inlineGlyph} />
+ <GlyphIcon d={ICONS.plus} size={ICON_SIZE.inlineGlyph} />
{S.company.calendar.create}
</span>
);
@@ -713,7 +711,7 @@ export function CalendarPage() {
aria-label={S.company.calendar.prev}
onClick={() => setAnchor((a) => shiftAnchor(a, view, -1))}
>
- <GlyphIcon d={PREV_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.chevronLeft} size={ICON_SIZE.iconButton} />
</Button>
<Button size="sm" onClick={() => setAnchor(Date.now())}>
{S.company.calendar.today}
@@ -725,7 +723,7 @@ export function CalendarPage() {
aria-label={S.company.calendar.next}
onClick={() => setAnchor((a) => shiftAnchor(a, view, 1))}
>
- <GlyphIcon d={NEXT_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.chevronRight} size={ICON_SIZE.iconButton} />
</Button>
<span className="text-sm font-semibold tabular-nums">{heading}</span>
<div className="ml-auto w-48">
diff --git a/packages/web/src/features/company/channel-composer.tsx b/packages/web/src/features/company/channel-composer.tsx
index d83d4157..b27feb0e 100644
--- a/packages/web/src/features/company/channel-composer.tsx
+++ b/packages/web/src/features/company/channel-composer.tsx
@@ -43,9 +43,8 @@ import type {
DragEvent as ReactDragEvent,
KeyboardEvent as ReactKeyboardEvent,
} from "react";
+import { Button, ICON_GAP } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_GAP } from "../../lib/icon-scale";
-import { Button } from "../../components/ui/button";
import { Dropdown } from "../../components/ui/dropdown";
import { noAutofill } from "../../components/ui/input";
import { PrincipalChip } from "./shared";
diff --git a/packages/web/src/features/company/channel-dialogs.tsx b/packages/web/src/features/company/channel-dialogs.tsx
index f3dc1bd0..8ed1a9fe 100644
--- a/packages/web/src/features/company/channel-dialogs.tsx
+++ b/packages/web/src/features/company/channel-dialogs.tsx
@@ -11,11 +11,11 @@
*/
import { useEffect, useState } from "react";
import type { OrgChannelItem } from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
import { Input, Textarea } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
diff --git a/packages/web/src/features/company/channel-header.tsx b/packages/web/src/features/company/channel-header.tsx
index fc9b8aba..2ba36e96 100644
--- a/packages/web/src/features/company/channel-header.tsx
+++ b/packages/web/src/features/company/channel-header.tsx
@@ -17,26 +17,26 @@ import { useEffect, useState } from "react";
import { createPortal } from "react-dom";
import { useNavigate } from "react-router";
import type { OrgChannelDetail, OrgChannelMember } from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ AvatarStack,
+ Button,
+ GlyphIcon,
+ ICONS,
+ ICON_GAP,
+ ICON_SIZE,
+ UserAvatar,
+} from "@prismshadow/penguin-ui";
+import type { AvatarStackItem } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { useProject } from "../../state/project";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
import { Dropdown } from "../../components/ui/dropdown";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { InfoPopover } from "../../components/ui/info-popover";
import { Input, noAutofill } from "../../components/ui/input";
-import {
- ARCHIVE_ICON,
- ELLIPSIS_ICON,
- PENCIL_ICON,
- UNARCHIVE_ICON,
- overflowMenuGlyph,
- overflowMenuRowClass,
-} from "../../components/ui/session-row-menu";
+import { overflowMenuGlyph, overflowMenuRowClass } from "../../components/ui/session-row-menu";
import { usePortalPanel } from "../../components/ui/use-portal-panel";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { Truncated } from "../../components/ui/truncated";
@@ -65,23 +65,25 @@ const AVATAR_STACK = 3;
const PANEL_WIDTH = 288;
+/** One member as an avatar: an employee's tile keyed by its agent id, a person's initial disc. */
+function memberAvatarItem(member: OrgChannelMember): AvatarStackItem {
+ const parsed = parsePrincipal(member.principal);
+ return parsed.kind === "agent"
+ ? { id: parsed.id, name: member.name }
+ : {
+ id: parsed.kind === "user" ? parsed.id : member.principal,
+ name: member.name,
+ kind: "user",
+ };
+}
+
/** One member's avatar: an employee's tile, a person's initial disc. */
function MemberAvatar({ member, size }: { member: OrgChannelMember; size: number }) {
- const parsed = parsePrincipal(member.principal);
- if (parsed.kind === "agent") {
- return (
- <AgentAvatar id={parsed.id} name={member.name} size={size} className="shrink-0 rounded" />
- );
+ const item = memberAvatarItem(member);
+ if (item.kind === "user") {
+ return <UserAvatar userId={item.id} displayName={item.name} size={size} />;
}
- return (
- <span
- aria-hidden
- style={{ width: size, height: size, fontSize: Math.round(size * 0.55) }}
- className="flex shrink-0 items-center justify-center rounded-full bg-gray-900 font-bold text-white dark:bg-gray-200 dark:text-gray-900"
- >
- {member.name.slice(0, 1).toUpperCase()}
- </span>
- );
+ return <AgentAvatar id={item.id} name={item.name} size={size} className="shrink-0 rounded" />;
}
/** The member list: who is in the channel, with an employee's desk session one click away. */
@@ -116,17 +118,11 @@ function MemberPopover({
onClick={() => setOpen((v) => !v)}
className="flex shrink-0 items-center gap-1.5 rounded-md px-1.5 py-1 text-xs text-gray-600 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100"
>
- <span className="flex -space-x-1">
- {members.slice(0, AVATAR_STACK).map((m) => (
- <span
- key={m.principal}
- className="rounded-full ring-2 ring-white dark:ring-gray-950"
- // The ring separates overlapping tiles; it is the page ground, not a colour.
- >
- <MemberAvatar member={m} size={ICON_SIZE.groupHeaderAvatar} />
- </span>
- ))}
- </span>
+ {/* The first few only: the count beside the stack already says how many there are. */}
+ <AvatarStack
+ items={members.slice(0, AVATAR_STACK).map(memberAvatarItem)}
+ size={ICON_SIZE.groupHeaderAvatar}
+ />
<span className="tabular-nums">{S.company.channels.memberCount(members.length)}</span>
</button>
{open &&
@@ -463,7 +459,7 @@ export function ChannelHeader({
onClick={() => setMenuOpen(!menuOpen)}
className="flex h-7 w-7 items-center justify-center rounded text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <GlyphIcon d={ELLIPSIS_ICON} size={ICON_SIZE.iconButton} filled />
+ <GlyphIcon d={ICONS.ellipsis} size={ICON_SIZE.iconButton} filled />
</button>
}
>
@@ -477,7 +473,7 @@ export function ChannelHeader({
setRenameOpen(true);
}}
>
- {overflowMenuGlyph(PENCIL_ICON)}
+ {overflowMenuGlyph(ICONS.pencil)}
{S.company.channels.rename}
</button>
<button
@@ -505,7 +501,7 @@ export function ChannelHeader({
void setArchived(false);
}}
>
- {overflowMenuGlyph(UNARCHIVE_ICON)}
+ {overflowMenuGlyph(ICONS.archiveRestore)}
{S.company.channels.unarchive}
</button>
) : (
@@ -517,7 +513,7 @@ export function ChannelHeader({
setArchiveOpen(true);
}}
>
- {overflowMenuGlyph(ARCHIVE_ICON)}
+ {overflowMenuGlyph(ICONS.archive)}
{S.company.channels.archive}
</button>
))}
diff --git a/packages/web/src/features/company/channel-sidebar.tsx b/packages/web/src/features/company/channel-sidebar.tsx
index f426aa6b..9cde3f98 100644
--- a/packages/web/src/features/company/channel-sidebar.tsx
+++ b/packages/web/src/features/company/channel-sidebar.tsx
@@ -16,18 +16,21 @@
import { useState } from "react";
import { NavLink, useNavigate } from "react-router";
import type { OrgChannelItem } from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ GlyphIcon,
+ ICON_GAP,
+ ICON_SIZE,
+ PlusIcon,
+ SkeletonList,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { toneInk, toneSurface } from "../../lib/tone";
import { useAuth } from "../../state/auth";
import { useCompany } from "../../state/company";
-import { Button } from "../../components/ui/button";
import { FolderSection, Icon } from "../../components/ui/group-list";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { PlusIcon } from "../../components/ui/icons";
-import { SkeletonList } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { Truncated } from "../../components/ui/truncated";
import { orgChannelPath } from "./company-nav";
diff --git a/packages/web/src/features/company/channel-view.tsx b/packages/web/src/features/company/channel-view.tsx
index fda1ae02..32285381 100644
--- a/packages/web/src/features/company/channel-view.tsx
+++ b/packages/web/src/features/company/channel-view.tsx
@@ -42,21 +42,24 @@
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
import { useNavigate, useParams } from "react-router";
import type { OrgChannelDetail, OrgChannelMessage } from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ Button,
+ EmptyState,
+ GlyphIcon,
+ ICON_GAP,
+ ICON_SIZE,
+ Skeleton,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime } from "../../lib/format";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { useDocumentTitle } from "../../lib/use-document-title";
import { toneDot, toneInk } from "../../lib/tone";
import { useAuth } from "../../state/auth";
import { useCompany, useCompanyEvents } from "../../state/company";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Button } from "../../components/ui/button";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { NAV_ICONS } from "../../components/ui/icons";
-import { Skeleton } from "../../components/ui/skeleton";
+import { NAV_ICONS } from "../../lib/nav-icons";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { createStreamFollow, stickToBottom } from "../chat/stream-follow";
import { useOrg } from "./org-layout";
diff --git a/packages/web/src/features/company/chart-card.tsx b/packages/web/src/features/company/chart-card.tsx
index 2e63a2b7..fa49bcdd 100644
--- a/packages/web/src/features/company/chart-card.tsx
+++ b/packages/web/src/features/company/chart-card.tsx
@@ -36,17 +36,13 @@
import { useEffect } from "react";
import type { ReactNode } from "react";
import type { OrgEmployeeItem, OrgEmployeeState } from "@prismshadow/penguin-server/api";
+import { AgentAvatar, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { useRowContextMenu } from "../../components/ui/context-menu";
import { formatMoney, formatPercent } from "../../lib/format";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneDot, toneInk } from "../../lib/tone";
import type { Currency } from "../../state/theme";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
import { Dropdown } from "../../components/ui/dropdown";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { ELLIPSIS_ICON } from "../../components/ui/session-row-menu";
-import { FOLDER_ICON } from "../../components/ui/group-list";
import { budgetTone } from "./finance-tree";
import { INVALID_ICON } from "./shared";
import { CHART_NODE_H, CHART_NODE_W, workspaceTail } from "./org-chart-tree";
@@ -187,7 +183,7 @@ export function ChartCard({
<GlyphIcon d={INVALID_ICON} size={10} />
</span>
) : (
- <GlyphIcon d={FOLDER_ICON} size={10} />
+ <GlyphIcon d={ICONS.folder} size={10} />
)}
<span className="truncate">{workspaceTail(employee.workspace)}</span>
</span>
@@ -245,7 +241,7 @@ export function ChartCard({
ctx.open ? "opacity-100" : "opacity-70"
}`}
>
- <GlyphIcon d={ELLIPSIS_ICON} size={ICON_SIZE.groupHeaderAction} filled />
+ <GlyphIcon d={ICONS.ellipsis} size={ICON_SIZE.groupHeaderAction} filled />
</button>
}
>
diff --git a/packages/web/src/features/company/company-nav-icons.ts b/packages/web/src/features/company/company-nav-icons.ts
index 6b24706f..852764ea 100644
--- a/packages/web/src/features/company/company-nav-icons.ts
+++ b/packages/web/src/features/company/company-nav-icons.ts
@@ -3,7 +3,7 @@
* sidebar and the collapsed rail draw the same mark for the same page (kept apart from
* company-nav.ts, which stays free of any icon import so the route grammar is testable alone).
*/
-import { NAV_ICONS } from "../../components/ui/icons";
+import { NAV_ICONS } from "../../lib/nav-icons";
import type { CompanyNavKey } from "./company-nav";
export const COMPANY_NAV_ICONS: Record<CompanyNavKey, string> = {
diff --git a/packages/web/src/features/company/employee-dialogs.tsx b/packages/web/src/features/company/employee-dialogs.tsx
index e0fdf38b..84e2fec0 100644
--- a/packages/web/src/features/company/employee-dialogs.tsx
+++ b/packages/web/src/features/company/employee-dialogs.tsx
@@ -11,6 +11,7 @@
*/
import { useEffect, useState } from "react";
import type { OrgEmployeeItem, OrgHireRequest } from "@prismshadow/penguin-server/api";
+import { Button, ICONS } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
@@ -20,7 +21,6 @@ import { formatMoney } from "../../lib/format";
import { useCompany } from "../../state/company";
import { agentDisplayName, useProject } from "../../state/project";
import { useTheme } from "../../state/theme";
-import { Button } from "../../components/ui/button";
import { Input, Textarea } from "../../components/ui/input";
import { Select } from "../../components/ui/select";
import { Segmented } from "../../components/ui/segmented";
@@ -29,7 +29,6 @@ import { ConfirmModal } from "../../components/ui/confirm-modal";
import { FormPicker } from "../../components/ui/form-picker";
import { FieldError, FieldHint, FieldLabel } from "../../components/ui/field";
import { toastError, toastSuccess } from "../../components/ui/toast";
-import { PLUGIN_ICON } from "../../components/ui/icons";
import { SkillPickList } from "../skills/skill-pick-list";
import type { PickableItem } from "../skills/skill-pick-list";
import { addSkillNames, removeSkillNames, toggleSkillName } from "../skills/skill-selection";
@@ -117,7 +116,7 @@ export function HireDialog({
.then((res) => {
if (cancelled) return;
setLibrary(
- res.groups.flatMap((g) => g.plugins.map((p) => ({ ...p, fallbackIcon: PLUGIN_ICON }))),
+ res.groups.flatMap((g) => g.plugins.map((p) => ({ ...p, fallbackIcon: ICONS.puzzle }))),
);
})
.catch(() => {
diff --git a/packages/web/src/features/company/finance-page.tsx b/packages/web/src/features/company/finance-page.tsx
index 0d2f01b7..30332404 100644
--- a/packages/web/src/features/company/finance-page.tsx
+++ b/packages/web/src/features/company/finance-page.tsx
@@ -33,11 +33,21 @@ import type {
OrgEmployeeState,
OrgFinanceResponse,
} from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ Badge,
+ Button,
+ Chevron,
+ CloseIcon,
+ EmptyState,
+ GlyphIcon,
+ ICON_GAP,
+ ICON_SIZE,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime, formatMoney, formatPercent } from "../../lib/format";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { STAT_ICONS } from "../../lib/stat-icons";
import { useDocumentTitle } from "../../lib/use-document-title";
import { toneDot, toneInk } from "../../lib/tone";
@@ -45,13 +55,7 @@ import type { Tone } from "../../lib/tone";
import { useCompany } from "../../state/company";
import { useTheme } from "../../state/theme";
import type { Currency } from "../../state/theme";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Badge } from "../../components/ui/badge";
-import { Button } from "../../components/ui/button";
-import { Chevron } from "../../components/ui/chevron";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { CloseIcon, NAV_ICONS } from "../../components/ui/icons";
+import { NAV_ICONS } from "../../lib/nav-icons";
import { InfoPopover } from "../../components/ui/info-popover";
import { noAutofill } from "../../components/ui/input";
import { Segmented } from "../../components/ui/segmented";
@@ -575,7 +579,7 @@ export function FinancePage() {
</span>
{employee.reportsTo === null &&
employee.title.trim().toLowerCase() !== "ceo" && (
- <Badge tone="gray">{S.company.ceo}</Badge>
+ <Badge>{S.company.ceo}</Badge>
)}
<span className="truncate text-gray-400 dark:text-gray-500">
{employee.title}
diff --git a/packages/web/src/features/company/handbook-page.tsx b/packages/web/src/features/company/handbook-page.tsx
index 013972fc..d57e8d2d 100644
--- a/packages/web/src/features/company/handbook-page.tsx
+++ b/packages/web/src/features/company/handbook-page.tsx
@@ -20,6 +20,14 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import type { KeyboardEvent as ReactKeyboardEvent, MouseEvent as ReactMouseEvent } from "react";
import type { OrgHandbookFile, OrgHandbookFileResponse } from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ EmptyState,
+ GlyphIcon,
+ ICON_GAP,
+ ICON_SIZE,
+ Skeleton,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
@@ -29,15 +37,10 @@ import { currentPlatform } from "../../lib/shortcuts/platform";
import { keymap } from "../../lib/shortcuts/store";
import { useShortcutLabel } from "../../lib/shortcuts/use-keymap";
import { useDocumentTitle } from "../../lib/use-document-title";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { useLocale } from "../../state/locale";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { Input, Textarea } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
-import { Skeleton } from "../../components/ui/skeleton";
import type { TreeToggle } from "../../components/ui/file-tree";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { Md } from "../chat/md";
diff --git a/packages/web/src/features/company/org-chart-page.tsx b/packages/web/src/features/company/org-chart-page.tsx
index c6d5a514..86cb30e9 100644
--- a/packages/web/src/features/company/org-chart-page.tsx
+++ b/packages/web/src/features/company/org-chart-page.tsx
@@ -28,19 +28,16 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } fr
import type { KeyboardEvent as ReactKeyboardEvent } from "react";
import { useNavigate } from "react-router";
import type { OrgChartResponse, OrgEmployeeItem } from "@prismshadow/penguin-server/api";
+import { Button, EmptyState, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useDocumentTitle } from "../../lib/use-document-title";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneInk } from "../../lib/tone";
import { useCompany } from "../../state/company";
import { useLiveSessionStatuses } from "../../state/sessions";
import { useTheme } from "../../state/theme";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { toastError, toastSuccess } from "../../components/ui/toast";
import {
overflowMenuDangerClass,
@@ -74,14 +71,14 @@ import { NoticeStrip } from "../../components/ui/notice-strip";
const MENU_ICONS = {
openDesk: DESK_ICON,
hire: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM19 8v6M22 11h-6",
- budget: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8M12 18V6",
+ budget: ICONS.dollarCircle,
reportsTo: "M4 17V7l4 4 4-4v10M16 7h4v4m0-4-6 6",
renewDesk: "M21 12a9 9 0 1 1-3-6.7M21 3v6h-6",
leave: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9",
} as const;
/** The header's zoom buttons (24x24 line paths): a minus and a plus. */
-const ZOOM_ICONS = { out: "M5 12h14", in: "M12 5v14M5 12h14" } as const;
+const ZOOM_ICONS = { out: "M5 12h14", in: ICONS.plus } as const;
/** The canvas never collapses below this, however little of the window the rows above it leave. */
const CANVAS_MIN_H = 240;
diff --git a/packages/web/src/features/company/org-dialogs.tsx b/packages/web/src/features/company/org-dialogs.tsx
index c32a7a39..ca4a1353 100644
--- a/packages/web/src/features/company/org-dialogs.tsx
+++ b/packages/web/src/features/company/org-dialogs.tsx
@@ -38,6 +38,7 @@ import type {
OrganizationPatchRequest,
OrganizationSettings,
} from "@prismshadow/penguin-server/api";
+import { Button, ICON_GAP } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
@@ -47,7 +48,6 @@ import { useAuth } from "../../state/auth";
import { useCompany } from "../../state/company";
import { projectDisplayName, useProject } from "../../state/project";
import { useTheme } from "../../state/theme";
-import { Button } from "../../components/ui/button";
import { Input, Textarea } from "../../components/ui/input";
import { Select } from "../../components/ui/select";
import { FieldError, FieldHint, FieldLabel } from "../../components/ui/field";
@@ -55,7 +55,6 @@ import { Modal } from "../../components/ui/modal";
import { ConfirmModal } from "../../components/ui/confirm-modal";
import { InfoPopover } from "../../components/ui/info-popover";
import { toastError, toastSuccess } from "../../components/ui/toast";
-import { ICON_GAP } from "../../lib/icon-scale";
import { ModelSelect, modelLabel } from "../chat/model-select";
import { WorkspaceSelect } from "../chat/workspace-select";
import { sameModelRef } from "../models/model-grouping";
diff --git a/packages/web/src/features/company/org-layout.tsx b/packages/web/src/features/company/org-layout.tsx
index 6120edb8..c4fb818d 100644
--- a/packages/web/src/features/company/org-layout.tsx
+++ b/packages/web/src/features/company/org-layout.tsx
@@ -26,16 +26,19 @@ import { createContext, useContext, useEffect, useState } from "react";
import type { ReactNode } from "react";
import { Navigate, Outlet, useNavigate, useParams } from "react-router";
import type { OrganizationSummary } from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ EmptyState,
+ GlyphIcon,
+ ICONS,
+ ICON_GAP,
+ ICON_SIZE,
+ Skeleton,
+} from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { useCompany } from "../../state/company";
import { useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { COMPANY_MODE_ICON } from "../../components/ui/icons";
import { InfoPopover } from "../../components/ui/info-popover";
-import { Skeleton } from "../../components/ui/skeleton";
import { orgKey, orgPagePath, resolveOrgLanding } from "./company-nav";
import { CreateOrganizationDialog, useOrganizationCreated } from "./org-dialogs";
import { ORG_EXAMPLES } from "./org-examples";
@@ -141,7 +144,7 @@ function OrgEmptyLanding() {
<OrgCenteredFrame>
<div className="mx-auto max-w-2xl py-8 text-center md:py-14">
<span className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-300">
- <GlyphIcon d={COMPANY_MODE_ICON} size={ICON_SIZE.sectionMark + 6} />
+ <GlyphIcon d={ICONS.building} size={ICON_SIZE.sectionMark + 6} />
</span>
<h1 className="mt-4 text-2xl font-semibold tracking-tight">{S.company.landingTitle}</h1>
<p className="mx-auto mt-2 max-w-xl text-sm text-gray-600 dark:text-gray-300">
diff --git a/packages/web/src/features/company/org-session-groups.tsx b/packages/web/src/features/company/org-session-groups.tsx
index 145cc627..9299005d 100644
--- a/packages/web/src/features/company/org-session-groups.tsx
+++ b/packages/web/src/features/company/org-session-groups.tsx
@@ -29,30 +29,35 @@
*/
import { useState } from "react";
import { useNavigate } from "react-router";
+import {
+ ActivityIcon,
+ AgentAvatar,
+ Button,
+ CloseIcon,
+ ICONS,
+ ICON_GAP,
+ ICON_SIZE,
+ SkeletonList,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
+import { sessionActivityLabel } from "../../lib/session-activity";
import { apiErrorText } from "../../lib/api-error";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { toneDot, toneInk } from "../../lib/tone";
import { useAuth } from "../../state/auth";
import { useCompany } from "../../state/company";
import { useProject } from "../../state/project";
import { useLiveSessionStatuses } from "../../state/sessions";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Button } from "../../components/ui/button";
import { useRowContextMenu } from "../../components/ui/context-menu";
import { writeClipboard } from "../../lib/clipboard";
import { Dropdown } from "../../components/ui/dropdown";
import { FolderSection, Icon } from "../../components/ui/group-list";
-import { CloseIcon, MESSAGING_RELAY_ICON } from "../../components/ui/icons";
-import { SessionActivityIcon } from "../../components/ui/session-activity-icon";
import {
DESK_ROW_ACTIONS,
SessionRowHoverActions,
SessionRowMenuRows,
} from "../../components/ui/session-row-menu";
import type { SessionRowAction, SessionRowState } from "../../components/ui/session-row-menu";
-import { SkeletonList } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { Truncated } from "../../components/ui/truncated";
import { MessagingBindingModal } from "../messaging/messaging-binding-modal";
@@ -219,11 +224,13 @@ function DeskRow({
data-tooltip={S.messaging.enabledIndicator[messagingChannel]}
className="shrink-0 text-gray-400 dark:text-gray-500"
>
- <Icon d={MESSAGING_RELAY_ICON} size={ICON_SIZE.rowMark} />
+ <Icon d={ICONS.paperPlane} size={ICON_SIZE.rowMark} />
<span className="sr-only">{S.messaging.enabledIndicator[messagingChannel]}</span>
</span>
)}
- {activity !== null && <SessionActivityIcon activity={activity} />}
+ {activity !== null && (
+ <ActivityIcon activity={activity} label={sessionActivityLabel(activity)} />
+ )}
</button>
{/* The menu affordance's slot, laid out rather than overlaid and reserved on every row
— including a desk that does not exist yet — so the names line up down the group
@@ -339,7 +346,9 @@ function TempRow({
className="shrink-0 rounded"
/>
<Truncated text={row.title} className="min-w-0 flex-1" />
- {row.activity !== null && <SessionActivityIcon activity={row.activity} />}
+ {row.activity !== null && (
+ <ActivityIcon activity={row.activity} label={sessionActivityLabel(row.activity)} />
+ )}
</button>
{/* The same trailing slot a desk row keeps for its menu, so the run marks line up
across the two groups. */}
diff --git a/packages/web/src/features/company/org-switcher.tsx b/packages/web/src/features/company/org-switcher.tsx
index 0c9d5077..8ce32ca6 100644
--- a/packages/web/src/features/company/org-switcher.tsx
+++ b/packages/web/src/features/company/org-switcher.tsx
@@ -13,17 +13,23 @@
*/
import { useState } from "react";
import { useNavigate } from "react-router";
+import {
+ Badge,
+ Button,
+ CheckIcon,
+ ChevronDown,
+ GlyphIcon,
+ ICONS,
+ ICON_GAP,
+ ICON_SIZE,
+ PlusIcon,
+ SkeletonList,
+} from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { toneSurface } from "../../lib/tone";
import { useCompany } from "../../state/company";
import { projectDisplayName, useProject } from "../../state/project";
import { Dropdown } from "../../components/ui/dropdown";
-import { Badge } from "../../components/ui/badge";
-import { Button } from "../../components/ui/button";
-import { SkeletonList } from "../../components/ui/skeleton";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { CheckIcon, ChevronDown, GEAR_ICON, PlusIcon } from "../../components/ui/icons";
import { groupOrganizationsByProject, orgKey, orgPagePath, parseOrgKey } from "./company-nav";
import {
CreateOrganizationDialog,
@@ -167,9 +173,9 @@ export function OrgSwitcher({ onNavigate }: { onNavigate?: () => void }) {
<OrgStatusDot org={o} />
<span className="min-w-0 flex-1 truncate">{o.name}</span>
{o.invalid !== undefined ? (
- <Badge tone="red">{S.company.orgInvalid}</Badge>
+ <Badge tone="danger">{S.company.orgInvalid}</Badge>
) : o.status === "paused" ? (
- <Badge tone="amber">{S.company.orgPaused}</Badge>
+ <Badge tone="attention">{S.company.orgPaused}</Badge>
) : null}
{active && (
<span className="shrink-0 text-gray-500 dark:text-gray-400">
@@ -211,7 +217,7 @@ export function OrgSwitcher({ onNavigate }: { onNavigate?: () => void }) {
}}
>
<span className="shrink-0 text-gray-400 dark:text-gray-500">
- <GlyphIcon d={GEAR_ICON} size={ICON_SIZE.rowLead} />
+ <GlyphIcon d={ICONS.gear} size={ICON_SIZE.rowLead} />
</span>
{S.company.orgSettings}
</button>
diff --git a/packages/web/src/features/company/overview-page.tsx b/packages/web/src/features/company/overview-page.tsx
index 7c7b7181..d86bebf7 100644
--- a/packages/web/src/features/company/overview-page.tsx
+++ b/packages/web/src/features/company/overview-page.tsx
@@ -30,24 +30,27 @@ import type {
OrgTicketStatus,
OrganizationDetail,
} from "@prismshadow/penguin-server/api";
+import {
+ Badge,
+ Button,
+ Chevron,
+ EmptyState,
+ GlyphIcon,
+ ICON_GAP,
+ ICON_SIZE,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime, formatMoney, formatRelativeShort } from "../../lib/format";
import { useDocumentTitle } from "../../lib/use-document-title";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { toneDot, toneInk, toneSurface } from "../../lib/tone";
import type { Tone } from "../../lib/tone";
import { useCompany } from "../../state/company";
import { useLocale } from "../../state/locale";
import { useLiveSessionStatuses } from "../../state/sessions";
import { useTheme } from "../../state/theme";
-import { Button } from "../../components/ui/button";
-import { Badge } from "../../components/ui/badge";
-import { Chevron } from "../../components/ui/chevron";
-import { EmptyState } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { NAV_ICONS } from "../../components/ui/icons";
+import { NAV_ICONS } from "../../lib/nav-icons";
import { Segmented } from "../../components/ui/segmented";
import { toastError } from "../../components/ui/toast";
import { STAT_ICONS } from "../../lib/stat-icons";
@@ -822,9 +825,9 @@ export function OverviewPage() {
<PrincipalChip principal={agentPrincipal(a.agentId)} names={names} />
</TitleButton>
{a.pausedAt !== undefined ? (
- <Badge tone="red">{S.company.finance.paused}</Badge>
+ <Badge tone="danger">{S.company.finance.paused}</Badge>
) : (
- <Badge tone="amber">{S.company.finance.warned}</Badge>
+ <Badge tone="attention">{S.company.finance.warned}</Badge>
)}
<span className="shrink-0 text-xs text-gray-500 dark:text-gray-400">
{formatRelativeShort(a.pausedAt ?? a.warnedAt ?? "", locale)}
diff --git a/packages/web/src/features/company/path-capsule.tsx b/packages/web/src/features/company/path-capsule.tsx
index 599165a5..c503941c 100644
--- a/packages/web/src/features/company/path-capsule.tsx
+++ b/packages/web/src/features/company/path-capsule.tsx
@@ -20,13 +20,9 @@
import { useMemo } from "react";
import type { ReactNode } from "react";
import type { Components, Options } from "react-markdown";
+import { CopiedStatus, GlyphIcon, ICONS, ICON_SIZE, useCopied } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { STAT_ICONS } from "../../lib/stat-icons";
-import { CopiedStatus, useCopied } from "../../components/ui/copy-button";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { FOLDER_ICON } from "../../components/ui/group-list";
-import { FILE_ICON } from "../../components/ui/icons";
import { Md } from "../chat/md";
import { codePath, pathKind, pathLabel, spellAsWritten, splitPaths } from "./path-capsules";
import type { PathScope } from "./path-capsules";
@@ -34,7 +30,7 @@ import type { PathScope } from "./path-capsules";
/** One data path as a capsule. */
export function PathCapsule({ path }: { path: string }) {
const { copied, flash } = useCopied();
- const glyph = copied ? STAT_ICONS.check : pathKind(path) === "file" ? FILE_ICON : FOLDER_ICON;
+ const glyph = copied ? STAT_ICONS.check : pathKind(path) === "file" ? ICONS.file : ICONS.folder;
return (
<>
<button
diff --git a/packages/web/src/features/company/shared.tsx b/packages/web/src/features/company/shared.tsx
index 23343783..43718cc1 100644
--- a/packages/web/src/features/company/shared.tsx
+++ b/packages/web/src/features/company/shared.tsx
@@ -14,18 +14,21 @@ import type {
OrgTicketPriority,
OrgTicketStatus,
} from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ Badge,
+ Button,
+ GlyphIcon,
+ ICON_GAP,
+ ICON_SIZE,
+} from "@prismshadow/penguin-ui";
+import type { BadgeStyle, ToneName } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { formatMoney, formatPercent } from "../../lib/format";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { toneDot, toneInk } from "../../lib/tone";
import type { Tone } from "../../lib/tone";
import type { Currency } from "../../state/theme";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Badge } from "../../components/ui/badge";
-import type { BadgeTone } from "../../components/ui/badge";
-import { Button } from "../../components/ui/button";
import { FieldError, FieldHint, FieldLabel } from "../../components/ui/field";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { Input } from "../../components/ui/input";
import { toStoredUsd, unitLabel } from "./budget-input";
import { budgetTone } from "./finance-tree";
@@ -120,10 +123,10 @@ export function orgStatusText(org: { status: OrgStatus; invalid?: string }): str
return orgStatusLabel(orgStatusKind(org));
}
-const ORG_STATUS_BADGE: Record<OrgStatusKind, BadgeTone> = {
- invalid: "red",
- paused: "amber",
- active: "green",
+const ORG_STATUS_BADGE: Record<OrgStatusKind, ToneName> = {
+ invalid: "danger",
+ paused: "attention",
+ active: "success",
};
/** An organization's headline state as a pill: invalid configuration outranks paused, paused outranks active. The reason rides in the tooltip when the configuration is invalid. */
@@ -402,19 +405,24 @@ export function MoneyPerMonthInput({
);
}
-const STATUS_TONE: Record<OrgTicketStatus, BadgeTone> = {
- proposed: "gray",
- in_progress: "green",
- review: "amber",
- done: "brand",
- rejected: "red",
+/** A finished ticket is settled, neither good nor bad news: a neutral tag, solid so it reads. */
+const STATUS_BADGE: Record<OrgTicketStatus, BadgeStyle> = {
+ proposed: { tone: "neutral" },
+ in_progress: { tone: "success" },
+ review: { tone: "attention" },
+ done: { tone: "neutral", variant: "solid" },
+ rejected: { tone: "danger" },
};
export function TicketStatusBadge({ status }: { status: OrgTicketStatus }) {
- return <Badge tone={STATUS_TONE[status]}>{S.company.tickets.columns[status] ?? status}</Badge>;
+ return <Badge {...STATUS_BADGE[status]}>{S.company.tickets.columns[status] ?? status}</Badge>;
}
-const PRIORITY_TONE: Record<OrgTicketPriority, BadgeTone> = { P0: "red", P1: "amber", P2: "gray" };
+const PRIORITY_TONE: Record<OrgTicketPriority, ToneName> = {
+ P0: "danger",
+ P1: "attention",
+ P2: "neutral",
+};
export function PriorityBadge({ priority }: { priority: OrgTicketPriority }) {
return <Badge tone={PRIORITY_TONE[priority]}>{priority}</Badge>;
@@ -427,7 +435,7 @@ export function BlockedBadge({ reason, by }: { reason: string; by?: string }) {
data-tooltip={S.company.tickets.blockedTooltip(reason, by ?? "—")}
className="inline-flex"
>
- <Badge tone="amber">{S.company.tickets.blocked}</Badge>
+ <Badge tone="attention">{S.company.tickets.blocked}</Badge>
</span>
);
}
diff --git a/packages/web/src/features/company/ticket-dialog.tsx b/packages/web/src/features/company/ticket-dialog.tsx
index 89cd9b1d..53f9a24f 100644
--- a/packages/web/src/features/company/ticket-dialog.tsx
+++ b/packages/web/src/features/company/ticket-dialog.tsx
@@ -36,27 +36,30 @@ import type {
OrgTicketUpdateRequest,
} from "@prismshadow/penguin-server/api";
import type { ReactNode } from "react";
+import {
+ Button,
+ Chevron,
+ CloseButton,
+ CopyButton,
+ ICON_GAP,
+ ICON_SIZE,
+ Skeleton,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime, formatMoney } from "../../lib/format";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
import { toneInk } from "../../lib/tone";
import { useAuth } from "../../state/auth";
import { useCompany } from "../../state/company";
import { useProject } from "../../state/project";
import { useTheme } from "../../state/theme";
-import { Button } from "../../components/ui/button";
-import { Chevron } from "../../components/ui/chevron";
import { Input, Textarea } from "../../components/ui/input";
import { Select } from "../../components/ui/select";
import { Segmented } from "../../components/ui/segmented";
import { FieldLabel } from "../../components/ui/field";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { CloseButton } from "../../components/ui/icons";
import { Modal } from "../../components/ui/modal";
-import { Skeleton } from "../../components/ui/skeleton";
-import { CopyButton, ROW_COPY_CLASS } from "../../components/ui/copy-button";
import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
import { OrgSection } from "./org-layout";
import { PathMarkdown, PathText } from "./path-capsule";
@@ -488,7 +491,8 @@ function TicketDialog({
<CopyButton
text={detail.ticketId}
label={S.company.tickets.copyId}
- className={ROW_COPY_CLASS}
+ size="sm"
+ className="shrink-0"
/>
</span>
<span className="ml-auto tabular-nums">
diff --git a/packages/web/src/features/company/tickets-page.tsx b/packages/web/src/features/company/tickets-page.tsx
index 2af3c41c..a6434dd5 100644
--- a/packages/web/src/features/company/tickets-page.tsx
+++ b/packages/web/src/features/company/tickets-page.tsx
@@ -35,24 +35,20 @@ import type {
OrgTicketStatus,
OrgTicketsResponse,
} from "@prismshadow/penguin-server/api";
+import { Button, CloseIcon, GlyphIcon, ICONS, ICON_SIZE, Skeleton } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useDocumentTitle } from "../../lib/use-document-title";
import { toneDot, toneInk } from "../../lib/tone";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { useAuth } from "../../state/auth";
import { useCompany } from "../../state/company";
-import { Button } from "../../components/ui/button";
import { Switch } from "../../components/ui/switch";
import { Segmented } from "../../components/ui/segmented";
import { Modal } from "../../components/ui/modal";
import { Input, Textarea } from "../../components/ui/input";
import { Select } from "../../components/ui/select";
import { FieldLabel } from "../../components/ui/field";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { CloseIcon } from "../../components/ui/icons";
-import { Skeleton } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { OrgPage, useOrg } from "./org-layout";
import {
@@ -84,9 +80,6 @@ import { TICKET_COLUMN_ATTR, useTicketBoardDrag } from "./ticket-drag";
const PRIORITIES: readonly OrgTicketPriority[] = ["P0", "P1", "P2"];
-/** Clock face (lucide): the due-date mark on a card. */
-const DUE_ICON = "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2";
-
/**
* The colour bar atop each column. Proposed is neutral, in-progress takes the accent (it is
* the column being worked, not a judgement), review waits on a person (attention), done is
@@ -261,7 +254,7 @@ export function TicketsPage() {
overdue ? `${S.company.tickets.overdue} · ${t.due}` : S.company.tickets.due
}
>
- <GlyphIcon d={DUE_ICON} size={ICON_SIZE.inlineGlyph} />
+ <GlyphIcon d={ICONS.clockCompact} size={ICON_SIZE.inlineGlyph} />
{t.due}
{overdue && <span className="sr-only">{S.company.tickets.overdue}</span>}
</span>
diff --git a/packages/web/src/features/dock/dock-launcher.tsx b/packages/web/src/features/dock/dock-launcher.tsx
index 34ee52b2..17504d28 100644
--- a/packages/web/src/features/dock/dock-launcher.tsx
+++ b/packages/web/src/features/dock/dock-launcher.tsx
@@ -36,18 +36,11 @@ import type {
KeyboardEvent as ReactKeyboardEvent,
ReactNode,
} from "react";
+import { GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import {
- COLLAPSE_ICON,
- EXPAND_ICON,
- HIDDEN_ICON,
- NAV_ICONS,
- WORKBENCH_ICON,
-} from "../../components/ui/icons";
+import { NAV_ICONS } from "../../lib/nav-icons";
import { toastInfo } from "../../components/ui/toast";
import { usePrefersReducedMotion } from "../../components/ui/use-reduced-motion";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneDot, toneInk } from "../../lib/tone";
import { scrollMovesAnchor } from "../../lib/context-menu";
import { SPRING_DEFAULT, SPRING_MOMENTUM, createSpringDriver } from "../../lib/spring";
@@ -465,7 +458,7 @@ function LauncherBall({
label: S.dock.launcherHide,
// The struck-through eye, in the muted ink so it reads as a lesser thing than the panels
// above it — and keeps reading that way when the ball mirrors it.
- glyphAt: (size) => <GlyphIcon d={HIDDEN_ICON} size={size} className={toneInk.muted} />,
+ glyphAt: (size) => <GlyphIcon d={ICONS.eyeOff} size={size} className={toneInk.muted} />,
badge: false,
testId: "dock-launcher-hide",
// Writing the preference unmounts the launcher under its own click, so the toast is
@@ -488,7 +481,7 @@ function LauncherBall({
hovered.glyphAt(ICON_SIZE.launcherBall)
) : (
<GlyphIcon
- d={ballActive ? (fanOpen ? COLLAPSE_ICON : EXPAND_ICON) : WORKBENCH_ICON}
+ d={ballActive ? (fanOpen ? ICONS.cornersIn : ICONS.cornersOut) : ICONS.tiles}
size={ICON_SIZE.launcherBall}
/>
);
diff --git a/packages/web/src/features/dock/dock-panel.tsx b/packages/web/src/features/dock/dock-panel.tsx
index 7b659d3e..4063bed8 100644
--- a/packages/web/src/features/dock/dock-panel.tsx
+++ b/packages/web/src/features/dock/dock-panel.tsx
@@ -32,19 +32,12 @@ import {
useSyncExternalStore,
} from "react";
import type { ReactNode } from "react";
+import { CloseIcon, GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import {
- ADD_ICON,
- CloseIcon,
- NAV_ICONS,
- PANEL_BOTTOM_ICON,
- PANEL_RIGHT_ICON,
-} from "../../components/ui/icons";
+import { NAV_ICONS } from "../../lib/nav-icons";
import { ConfirmModal } from "../../components/ui/confirm-modal";
import { Dropdown } from "../../components/ui/dropdown";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { Kbd } from "../../components/ui/kbd";
-import { ICON_SIZE } from "../../lib/icon-scale";
+import { ChordKbd } from "../../components/ui/chord-kbd";
import { useDisplayedBinding, useShortcutLabel } from "../../lib/shortcuts/use-keymap";
import { useCoarsePointer } from "../../lib/use-coarse-pointer";
import { toneDot } from "../../lib/tone";
@@ -299,7 +292,7 @@ function DockPicker({
</span>
<span className="min-w-0 flex-1 truncate">{S.terminal.title}</span>
{toggleChord !== null && (
- <Kbd chord={toggleChord} className="shrink-0 text-gray-400 dark:text-gray-500" />
+ <ChordKbd chord={toggleChord} className="text-gray-400 dark:text-gray-500" />
)}
</button>
)}
@@ -611,7 +604,7 @@ export function DockPanel({
menuClass="w-56"
button={
<DockButton label={S.dock.addTab} testId="dock-add" onClick={() => setAddOpen(!addOpen)}>
- <GlyphIcon d={ADD_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.plus} size={ICON_SIZE.iconButton} />
</DockButton>
}
>
@@ -640,7 +633,7 @@ export function DockPanel({
className="mx-1 flex w-[calc(100%-0.5rem)] items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-gray-600 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100"
>
<span className="shrink-0 text-gray-500 dark:text-gray-400">
- <GlyphIcon d={ADD_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.plus} size={ICON_SIZE.iconButton} />
</span>
<span className="min-w-0 truncate">{S.terminal.newShell}</span>
</button>
@@ -806,7 +799,7 @@ export function DockPanel({
onClick={() => moveDock(position, other)}
>
<GlyphIcon
- d={position === "right" ? PANEL_BOTTOM_ICON : PANEL_RIGHT_ICON}
+ d={position === "right" ? ICONS.panelBottom : ICONS.panelRight}
size={ICON_SIZE.rowLead}
/>
</DockButton>
diff --git a/packages/web/src/features/dock/panel-meta.tsx b/packages/web/src/features/dock/panel-meta.tsx
index 988722f8..02c8736b 100644
--- a/packages/web/src/features/dock/panel-meta.tsx
+++ b/packages/web/src/features/dock/panel-meta.tsx
@@ -4,18 +4,9 @@
* menus. One table, so a panel never has two names or two marks.
*/
import type { ReactNode } from "react";
+import { GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { FOLDER_ICON } from "../../components/ui/group-list";
-import {
- AGENTS_PAIR_ICON,
- GLOBE_ICON,
- MEMORY_ICON,
- MESSAGING_RELAY_ICON,
- NAV_ICONS,
- SCHEDULE_ICON,
-} from "../../components/ui/icons";
-import { ICON_SIZE } from "../../lib/icon-scale";
+import { NAV_ICONS } from "../../lib/nav-icons";
import type { PanelKind } from "./dock-state";
/** The panel's short display name (read at call time — `S` is a live locale binding). */
@@ -41,18 +32,18 @@ export function panelLabel(kind: PanelKind): string {
export function panelGlyph(kind: PanelKind, size: number = ICON_SIZE.iconButton): ReactNode {
switch (kind) {
case "agents":
- return <GlyphIcon d={AGENTS_PAIR_ICON} size={size} />;
+ return <GlyphIcon d={ICONS.robotPair} size={size} />;
case "workspace":
- return <GlyphIcon d={FOLDER_ICON} size={size} />;
+ return <GlyphIcon d={ICONS.folder} size={size} />;
case "memory":
- return <GlyphIcon d={MEMORY_ICON} size={size} />;
+ return <GlyphIcon d={ICONS.brain} size={size} />;
case "trace":
return <GlyphIcon d={NAV_ICONS.traces} size={size} />;
case "messaging":
- return <GlyphIcon d={MESSAGING_RELAY_ICON} size={size} />;
+ return <GlyphIcon d={ICONS.paperPlane} size={size} />;
case "schedules":
- return <GlyphIcon d={SCHEDULE_ICON} size={size} />;
+ return <GlyphIcon d={ICONS.alarmClock} size={size} />;
case "builtin-browser":
- return <GlyphIcon d={GLOBE_ICON} size={size} />;
+ return <GlyphIcon d={ICONS.globe} size={size} />;
}
}
diff --git a/packages/web/src/features/harness/harness-history-overlay.tsx b/packages/web/src/features/harness/harness-history-overlay.tsx
index 0f6dec01..0035ee55 100644
--- a/packages/web/src/features/harness/harness-history-overlay.tsx
+++ b/packages/web/src/features/harness/harness-history-overlay.tsx
@@ -12,7 +12,7 @@
*/
import { useEffect, useMemo, useRef, useState } from "react";
import { createPortal } from "react-dom";
-import { CloseIcon } from "../../components/ui/icons";
+import { Badge, CloseIcon, Skeleton } from "@prismshadow/penguin-ui";
import { useDialogLayer } from "../../components/ui/modal";
import type {
HarnessHistoryEntry,
@@ -23,8 +23,6 @@ import type {
VersionHistoryResponse,
} from "@prismshadow/penguin-server/api";
import * as api from "../../api/endpoints";
-import { Badge } from "../../components/ui/badge";
-import { Skeleton } from "../../components/ui/skeleton";
import { formatDateTime } from "../../lib/format";
import { S } from "../../lib/strings";
import { ModuleTreeView } from "./module-tree-view";
@@ -37,10 +35,10 @@ function shortSha(pointer: string | null): string {
return base.replace(/\.[a-z]+$/i, "");
}
-const changeTone: Record<MemberChange["change"], "green" | "red" | "amber"> = {
- added: "green",
- removed: "red",
- changed: "amber",
+const changeTone: Record<MemberChange["change"], "success" | "danger" | "attention"> = {
+ added: "success",
+ removed: "danger",
+ changed: "attention",
};
function isCurrent(
@@ -295,7 +293,7 @@ export function HarnessHistoryOverlay({ open, onClose }: { open: boolean; onClos
{e.source?.revision ?? t.noProvenance}
</span>
{isCurrent(e, history.current) ? (
- <Badge tone="green">{t.current}</Badge>
+ <Badge tone="success">{t.current}</Badge>
) : null}
</div>
<div className="mt-0.5 flex justify-between gap-2 text-xs text-gray-500 dark:text-gray-400">
diff --git a/packages/web/src/features/harness/module-tree-view.tsx b/packages/web/src/features/harness/module-tree-view.tsx
index 840ca3f9..bedd640b 100644
--- a/packages/web/src/features/harness/module-tree-view.tsx
+++ b/packages/web/src/features/harness/module-tree-view.tsx
@@ -4,9 +4,9 @@
* Pure rendering over the table — the same data the CI page draws.
*/
import { useEffect, useMemo, useState } from "react";
+import { Badge, Skeleton } from "@prismshadow/penguin-ui";
+import type { BadgeStyle } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
-import { Badge } from "../../components/ui/badge";
-import { Skeleton } from "../../components/ui/skeleton";
import { S } from "../../lib/strings";
import { NoticeStrip } from "../../components/ui/notice-strip";
@@ -28,10 +28,10 @@ interface Table {
type NodeKind = "group" | "module" | "component";
const kindOf = (m: Manifest): NodeKind =>
m.kind === "component" ? "component" : m.exports?.length ? "group" : "module";
-const kindTone: Record<NodeKind, "gray" | "brand" | "green"> = {
- group: "gray",
- module: "brand",
- component: "green",
+const kindBadge: Record<NodeKind, BadgeStyle> = {
+ group: { tone: "neutral" },
+ module: { tone: "neutral", variant: "solid" },
+ component: { tone: "success" },
};
const short = (key: string) => key.slice(key.indexOf("#") + 1);
@@ -83,7 +83,7 @@ function Node({
) : (
<span className="w-4" />
)}
- <Badge tone={kindTone[kind]}>{S.harnessHistory.kind[kind]}</Badge>
+ <Badge {...kindBadge[kind]}>{S.harnessHistory.kind[kind]}</Badge>
<button type="button" onClick={() => onSelect(name)} className="font-mono text-left">
{name}
</button>
@@ -132,7 +132,7 @@ function Detail({ name, table }: { name: string; table: Table }) {
return (
<div className="flex flex-col gap-2">
<div className="flex items-center gap-2">
- <Badge tone={kindTone[kind]}>{t.kind[kind]}</Badge>
+ <Badge {...kindBadge[kind]}>{t.kind[kind]}</Badge>
<span className="font-mono text-sm">{name}</span>
</div>
{row(
diff --git a/packages/web/src/features/machines/machine-picker.tsx b/packages/web/src/features/machines/machine-picker.tsx
index 934c350a..c76c9645 100644
--- a/packages/web/src/features/machines/machine-picker.tsx
+++ b/packages/web/src/features/machines/machine-picker.tsx
@@ -8,10 +8,9 @@
* in-place panel.
*/
import { useState } from "react";
-import { Button } from "../../components/ui/button";
+import { Button, ChevronDown } from "@prismshadow/penguin-ui";
import { Dropdown } from "../../components/ui/dropdown";
import { ChoiceCheck, menuRowClass, menuRowTone } from "../../components/ui/field";
-import { ChevronDown } from "../../components/ui/icons";
export interface MachineChoice {
value: string;
diff --git a/packages/web/src/features/machines/machines-page.tsx b/packages/web/src/features/machines/machines-page.tsx
index 86459bcb..6b7a89d3 100644
--- a/packages/web/src/features/machines/machines-page.tsx
+++ b/packages/web/src/features/machines/machines-page.tsx
@@ -25,6 +25,14 @@
*/
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import type { MachineInfo, MachineJob, MachinesResponse } from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ ChevronDown,
+ GlyphIcon,
+ ICONS,
+ ICON_SIZE,
+ Skeleton,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { useProject } from "../../state/project";
import { useLocale } from "../../state/locale";
@@ -33,14 +41,10 @@ import { apiErrorText } from "../../lib/api-error";
import { useDocumentTitle } from "../../lib/use-document-title";
import { formatDateTime, formatMessageTime } from "../../lib/format";
import { toneDot, toneInk } from "../../lib/tone";
-import { ICON_SIZE } from "../../lib/icon-scale";
-import { Button } from "../../components/ui/button";
import { Dropdown } from "../../components/ui/dropdown";
-import { Skeleton } from "../../components/ui/skeleton";
import { toastError } from "../../components/ui/toast";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { noAutofill, panelSearchClass } from "../../components/ui/input";
-import { ChevronDown, GEAR_ICON, NAV_ICONS } from "../../components/ui/icons";
+import { NAV_ICONS } from "../../lib/nav-icons";
import {
MACHINE_PHASES,
anyJobPending,
@@ -70,8 +74,6 @@ const POLL_MS = 1500;
const PLUG_PATH = "M9 2v4M15 2v4M6 6h12v4a6 6 0 0 1-12 0V6zM12 16v6";
const UNPLUG_PATH = "M9 2v3M15 2v3M6 5h12v3a6 6 0 0 1-12 0V5zM7 22h10M7 22v-4M17 22v-4";
-/** The + in the picker's foot: a new host for the ssh config. */
-const PLUS_PATH = "M12 5v14M5 12h14";
/** The expand verb's glyph, on the 24-grid like the others; turned over when unfolded. */
const CHEVRON_PATH = "M6 9l6 6 6-6";
/** Select all: a box with a check. Select none: the empty box. */
@@ -440,7 +442,7 @@ export function MachinesPage() {
<Verb
label={S.machines.host.newVerb}
title={S.machines.host.addTitle}
- d={PLUS_PATH}
+ d={ICONS.plus}
onClick={() => {
setPickerOpen(false);
setHostForm({ kind: "add" });
@@ -843,7 +845,7 @@ function MachineCard({
<Verb
label={S.machines.host.configureVerb}
title={S.machines.host.configure}
- d={GEAR_ICON}
+ d={ICONS.gear}
disabled={busy}
onClick={onConfigure}
/>
diff --git a/packages/web/src/features/machines/ssh-host-dialog.tsx b/packages/web/src/features/machines/ssh-host-dialog.tsx
index 0ffad178..c6382ad6 100644
--- a/packages/web/src/features/machines/ssh-host-dialog.tsx
+++ b/packages/web/src/features/machines/ssh-host-dialog.tsx
@@ -16,10 +16,10 @@ import type {
SshHostRequest,
SshHostResponse,
} from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { Button } from "../../components/ui/button";
import { Input } from "../../components/ui/input";
import { Modal } from "../../components/ui/modal";
import { toastSuccess } from "../../components/ui/toast";
diff --git a/packages/web/src/features/messaging/messaging-binding-editor.tsx b/packages/web/src/features/messaging/messaging-binding-editor.tsx
index 7ce2b5b2..84440b22 100644
--- a/packages/web/src/features/messaging/messaging-binding-editor.tsx
+++ b/packages/web/src/features/messaging/messaging-binding-editor.tsx
@@ -48,12 +48,12 @@ import type {
MessagingRuntimeStatus,
TelegramTestResponse,
} from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime } from "../../lib/format";
import { toneInk, type Tone } from "../../lib/tone";
-import { Button } from "../../components/ui/button";
import { FieldLabel } from "../../components/ui/field";
import { HelpFold } from "../../components/ui/help-fold";
import { InfoPopover } from "../../components/ui/info-popover";
diff --git a/packages/web/src/features/messaging/messaging-binding-modal.tsx b/packages/web/src/features/messaging/messaging-binding-modal.tsx
index 679be08c..a31b624e 100644
--- a/packages/web/src/features/messaging/messaging-binding-modal.tsx
+++ b/packages/web/src/features/messaging/messaging-binding-modal.tsx
@@ -11,8 +11,8 @@
* clear checkbox.
*/
import type { MessagingChannel } from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
import { Modal } from "../../components/ui/modal";
import {
MessagingBindingBody,
diff --git a/packages/web/src/features/messaging/messaging-panel.tsx b/packages/web/src/features/messaging/messaging-panel.tsx
index 089c284b..20b093c2 100644
--- a/packages/web/src/features/messaging/messaging-panel.tsx
+++ b/packages/web/src/features/messaging/messaging-panel.tsx
@@ -13,9 +13,8 @@
* Status polling is gated on `active` (the dock keeps hidden tabs mounted): a hidden tab
* neither polls nor loses the form state it accumulated.
*/
+import { Button, Skeleton } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
-import { Skeleton } from "../../components/ui/skeleton";
import {
MessagingBindingBody,
MessagingBindingHelp,
diff --git a/packages/web/src/features/messaging/qq-scan-connect.tsx b/packages/web/src/features/messaging/qq-scan-connect.tsx
index d7e09b45..adb7bcde 100644
--- a/packages/web/src/features/messaging/qq-scan-connect.tsx
+++ b/packages/web/src/features/messaging/qq-scan-connect.tsx
@@ -25,10 +25,10 @@ import type {
QQBindingInfo,
QQScanPollResponse,
} from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { apiErrorText } from "../../lib/api-error";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
import { toastError, toastSuccess } from "../../components/ui/toast";
/** Modules of quiet zone around the code — four is what the QR spec asks for. */
diff --git a/packages/web/src/features/messaging/wechat-scan-connect.tsx b/packages/web/src/features/messaging/wechat-scan-connect.tsx
index 2d93ce8d..9269c426 100644
--- a/packages/web/src/features/messaging/wechat-scan-connect.tsx
+++ b/packages/web/src/features/messaging/wechat-scan-connect.tsx
@@ -30,10 +30,10 @@ import type {
WeChatBindingInfo,
WeChatScanPollResponse,
} from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { apiErrorText } from "../../lib/api-error";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
import { Input } from "../../components/ui/input";
import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
import { QrCode } from "./qq-scan-connect";
diff --git a/packages/web/src/features/models/key-auth-dialog.tsx b/packages/web/src/features/models/key-auth-dialog.tsx
index 95f4d7cd..a61f7684 100644
--- a/packages/web/src/features/models/key-auth-dialog.tsx
+++ b/packages/web/src/features/models/key-auth-dialog.tsx
@@ -6,12 +6,11 @@ import type {
} from "@prismshadow/penguin-server/api";
import type { KeyAuthEndpoints } from "../../api/endpoints";
import { ApiError } from "../../api/client";
-import { Button } from "../../components/ui/button";
import { Modal } from "../../components/ui/modal";
import { apiErrorText } from "../../lib/api-error";
import { isElectronRenderer } from "../../lib/desktop-renderer";
import { S } from "../../lib/strings";
-import { Spinner } from "@prismshadow/penguin-ui";
+import { Button, Spinner } from "@prismshadow/penguin-ui";
const POLL_MS = 3_000;
diff --git a/packages/web/src/features/models/models-page.tsx b/packages/web/src/features/models/models-page.tsx
index c912176c..84c0ce28 100644
--- a/packages/web/src/features/models/models-page.tsx
+++ b/packages/web/src/features/models/models-page.tsx
@@ -49,17 +49,27 @@ import type {
ModelUpdateEntry,
ModelVisionDetectRequest,
} from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ Chevron,
+ EmptyState,
+ GlyphIcon,
+ ICONS,
+ ICON_SIZE,
+ Link,
+ ProviderLogo,
+ SkeletonList,
+ buttonClass,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { useDocumentTitle } from "../../lib/use-document-title";
import { useProject } from "../../state/project";
import { useAuth } from "../../state/auth";
import { USD_TO_CNY, useTheme } from "../../state/theme";
import type { Currency } from "../../state/theme";
-import { Button } from "../../components/ui/button";
import { Input } from "../../components/ui/input";
import { FieldError, FieldLabel } from "../../components/ui/field";
import { PasswordInput } from "../../components/ui/password-input";
@@ -70,12 +80,6 @@ import { Select } from "../../components/ui/select";
import { Switch } from "../../components/ui/switch";
import { AiCreateModal, CreateButtons } from "../ai-create";
import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
-import { Chevron } from "../../components/ui/chevron";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { EXTERNAL_LINK_ICON } from "../../components/ui/icons";
-import { ProviderLogo } from "../../components/ui/provider-logo";
-import { SkeletonList } from "../../components/ui/skeleton";
-import { EmptyState } from "../../components/ui/empty-state";
import { formatDateTime, humanizeTokens } from "../../lib/format";
import {
MODEL_PROVIDERS,
@@ -215,17 +219,15 @@ function inputToUsd(inputStr: string, currency: Currency): string {
return currency === "CNY" ? trimNum(n / USD_TO_CNY) : trimNum(n);
}
-/** Group-header action glyphs (24x24 line paths): add, bulk key, external link, gauge for speed test. */
-const PLUS_ICON = "M12 5v14M5 12h14";
-/** Trash can (same drawing as the agent cards' delete action). */
+/**
+ * Group-header action glyphs this page draws itself (24x24 line paths); add, bulk key and the
+ * catalog sync read `ICONS.plus`, `ICONS.key` and `ICONS.rotateCw`. The trash can is the tapered
+ * bin the agent cards' delete action wears, not the registry's straight-sided `ICONS.trash`.
+ */
const TRASH_ICON =
"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0l-1 13a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 7m4 4v6m4-6v6";
-const KEY_ICON =
- "M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4";
/** Arrow entering a door: authorize with the provider and come back with a key. */
const SIGN_IN_ICON = "M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4M10 17l5-5-5-5M15 12H3";
-/** Rotate clockwise: refresh an already-authorized platform catalog. */
-const SYNC_ICON = "M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10";
/** Speed-test glyphs (24x24 line paths): gauge for the group action, clock = TTFT, zap = TPS. */
const GAUGE_ICON = "M12 14l3.5-3.5M20.49 17A10 10 0 1 0 3.5 17";
@@ -1313,10 +1315,9 @@ export function ModelsPage() {
section. `shrink-0` keeps it whole: the vendor name beside it is
the element allowed to truncate on a narrow page. */}
{group.provider.recommended && (
- // Not a `Badge`: its `brand` tone is deliberately gray — neutral
- // emphasis outside the status vocabulary — and an endorsement is
- // neither a status nor neutral, which is the category tone.ts keeps
- // out on purpose. Unfilled, like the card marks below it: an outline
+ // Not a `Badge`: every Badge tone is a status or `neutral`, and an
+ // endorsement is neither, which is the category tone.ts keeps out on
+ // purpose. Unfilled, like the card marks below it: an outline
// is enough to make it a pill, and a block of colour on the collapse
// bar competes with the vendor name it is endorsing. It holds on
// longer than the model count beside it and gives way before the
@@ -1347,7 +1348,7 @@ export function ModelsPage() {
title={S.models.platformSync}
onClick={() => void syncPlatformModels()}
>
- <GlyphIcon d={SYNC_ICON} size={ICON_SIZE.groupHeaderAction} />
+ <GlyphIcon d={ICONS.rotateCw} size={ICON_SIZE.groupHeaderAction} />
<span className="hidden @3xl:inline">{S.models.platformSync}</span>
</Button>
)}
@@ -1370,7 +1371,7 @@ export function ModelsPage() {
title={S.models.addToGroup}
onClick={() => setAddingTo(group.provider.id)}
>
- <GlyphIcon d={PLUS_ICON} size={ICON_SIZE.groupHeaderAction} />
+ <GlyphIcon d={ICONS.plus} size={ICON_SIZE.groupHeaderAction} />
<span className="hidden @3xl:inline">{S.models.addToGroup}</span>
</Button>
)}
@@ -1409,7 +1410,7 @@ export function ModelsPage() {
title={S.models.groupApiKey}
onClick={() => setGroupKeyFor(group.provider.id)}
>
- <GlyphIcon d={KEY_ICON} size={ICON_SIZE.groupHeaderAction} />
+ <GlyphIcon d={ICONS.key} size={ICON_SIZE.groupHeaderAction} />
<span className="hidden @3xl:inline">{S.models.groupApiKey}</span>
</Button>
)}
@@ -1455,19 +1456,18 @@ export function ModelsPage() {
)}
{group.provider.apiKeyUrl && (
// External link: its label is the last one admitted as space grows
- // (@4xl); below that it collapses to the external-link glyph with a
+ // (@4xl); below that only the link's external glyph is left, with a
// small padding bump for a usable touch target.
- <a
+ <Link
href={group.provider.apiKeyUrl}
- target="_blank"
- rel="noreferrer noopener"
+ external
+ variant="standalone"
aria-label={`${S.models.getApiKey} ${group.provider.label}`}
data-tooltip={S.models.getApiKey}
- className="inline-flex shrink-0 items-center whitespace-nowrap p-1 text-xs text-brand-600 underline-offset-2 hover:underline @4xl:p-0 dark:text-brand-300"
+ className="shrink-0 whitespace-nowrap p-1 text-xs @4xl:p-0"
>
- <GlyphIcon d={EXTERNAL_LINK_ICON} size={13} className="@4xl:hidden" />
- <span className="hidden @4xl:inline">{S.models.getApiKey} ↗</span>
- </a>
+ <span className="hidden @4xl:inline">{S.models.getApiKey}</span>
+ </Link>
)}
{/* Collapse arrow sits at the far right of the header (after group actions); it too can be clicked to collapse. */}
<button
@@ -2067,21 +2067,24 @@ function AddGroupDialog({
<FieldLabel required block={false}>
{S.models.baseUrl}
</FieldLabel>
- <button
- type="button"
+ <Button
+ variant="link"
+ size="sm"
disabled={detecting || busy}
onClick={() => void detect()}
- data-tooltip={S.models.detectProtocolHint}
- className="flex shrink-0 items-center gap-1 text-xs text-brand-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:text-gray-400 disabled:no-underline dark:text-brand-300 dark:disabled:text-gray-500"
+ title={S.models.detectProtocolHint}
+ className="shrink-0"
+ leading={
+ detecting && (
+ <span
+ aria-hidden
+ className="inline-block h-2.5 w-2.5 shrink-0 animate-spin rounded-full border border-current border-t-transparent"
+ />
+ )
+ }
>
- {detecting && (
- <span
- aria-hidden
- className="inline-block h-2.5 w-2.5 shrink-0 animate-spin rounded-full border border-current border-t-transparent"
- />
- )}
{detecting ? S.models.detecting : S.models.detectProtocol}
- </button>
+ </Button>
</span>
<div className="relative">
<Input
@@ -2982,14 +2985,14 @@ function ModelDialog({
<span className="flex shrink-0 items-baseline gap-2.5">
{/* The model-homepage entry lives in the dialog header (top-right button); only the "get model ids" provider link stays here. */}
{dialogProvider?.modelsUrl && (
- <a
+ <Link
href={dialogProvider.modelsUrl}
- target="_blank"
- rel="noreferrer noopener"
- className="shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300"
+ external
+ variant="standalone"
+ className="shrink-0 text-xs"
>
- {S.models.getModelIds} ↗
- </a>
+ {S.models.getModelIds}
+ </Link>
)}
</span>
</span>
@@ -3210,12 +3213,12 @@ function ModelDialog({
<a
href={modelHomepageUrl(row.provider, row.modelId)}
target="_blank"
- rel="noreferrer noopener"
- className="inline-flex shrink-0 items-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1 text-xs font-medium text-gray-800 transition-colors duration-150 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800"
+ rel="noopener noreferrer"
+ className={`${buttonClass("secondary", "sm")} shrink-0`}
>
{S.models.homepage}
{/* External-link glyph (opens in a new tab) */}
- <GlyphIcon d={EXTERNAL_LINK_ICON} />
+ <GlyphIcon d={ICONS.externalLink} />
</a>
)}
</div>
@@ -3290,14 +3293,14 @@ function ModelDialog({
<span className="mb-1 flex items-baseline justify-between gap-2">
<FieldLabel block={false}>{S.models.apiKey}</FieldLabel>
{dialogProvider?.apiKeyUrl && (
- <a
+ <Link
href={dialogProvider.apiKeyUrl}
- target="_blank"
- rel="noreferrer noopener"
- className="shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300"
+ external
+ variant="standalone"
+ className="shrink-0 text-xs"
>
- {S.models.getApiKey} ↗
- </a>
+ {S.models.getApiKey}
+ </Link>
)}
</span>
<PasswordInput
@@ -3381,21 +3384,24 @@ function ModelDialog({
{/* Always live: no API key is needed (the server falls back to the stored key
and then to the protocol's env var), and anything that does go wrong is
explained in a popup. `detecting` only guards re-entrancy. */}
- <button
- type="button"
+ <Button
+ variant="link"
+ size="sm"
disabled={detecting}
onClick={() => void detectFromButton()}
- data-tooltip={S.models.detectProtocolHint}
- className="flex shrink-0 items-center gap-1 text-xs text-brand-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:text-gray-400 disabled:no-underline dark:text-brand-300 dark:disabled:text-gray-500"
+ title={S.models.detectProtocolHint}
+ className="shrink-0"
+ leading={
+ detecting && (
+ <span
+ aria-hidden
+ className="inline-block h-2.5 w-2.5 shrink-0 animate-spin rounded-full border border-current border-t-transparent"
+ />
+ )
+ }
>
- {detecting && (
- <span
- aria-hidden
- className="inline-block h-2.5 w-2.5 shrink-0 animate-spin rounded-full border border-current border-t-transparent"
- />
- )}
{detecting ? S.models.detecting : S.models.detectProtocol}
- </button>
+ </Button>
</span>
) : (
<FieldLabel required={baseUrlRequired}>{S.models.baseUrl}</FieldLabel>
@@ -3644,21 +3650,24 @@ function ModelDialog({
/>
</label>
{canEdit && (
- <button
- type="button"
+ <Button
+ variant="link"
+ size="sm"
disabled={visionDetecting}
onClick={() => void detectVisionFromButton()}
- data-tooltip={S.models.detectVisionHint}
- className="flex shrink-0 items-center gap-1 text-xs text-brand-600 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:text-gray-400 disabled:no-underline dark:text-brand-300 dark:disabled:text-gray-500"
+ title={S.models.detectVisionHint}
+ className="shrink-0"
+ leading={
+ visionDetecting && (
+ <span
+ aria-hidden
+ className="inline-block h-2.5 w-2.5 shrink-0 animate-spin rounded-full border border-current border-t-transparent"
+ />
+ )
+ }
>
- {visionDetecting && (
- <span
- aria-hidden
- className="inline-block h-2.5 w-2.5 shrink-0 animate-spin rounded-full border border-current border-t-transparent"
- />
- )}
{visionDetecting ? S.models.detectingVision : S.models.detectVision}
- </button>
+ </Button>
)}
</div>
{!form.vision && (
@@ -3840,14 +3849,9 @@ function GroupKeyDialog({
</p>
)}
{provider.apiKeyUrl && (
- <a
- href={provider.apiKeyUrl}
- target="_blank"
- rel="noreferrer noopener"
- className="inline-block text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300"
- >
- {S.models.getApiKey} ↗
- </a>
+ <Link href={provider.apiKeyUrl} external variant="standalone" className="text-xs">
+ {S.models.getApiKey}
+ </Link>
)}
</div>
</Modal>
@@ -4077,13 +4081,9 @@ function ModelOAuthDialog({
)}
{error !== null && <p className="text-xs text-red-600 dark:text-red-400">{error}</p>}
{phase !== "done" && (
- <button
- type="button"
- onClick={() => setManual((v) => !v)}
- className="text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300"
- >
+ <Button variant="link" size="sm" onClick={() => setManual((v) => !v)}>
{manual ? S.models.oauthCallbackSwitch : S.models.oauthManualSwitch}
- </button>
+ </Button>
)}
</div>
</Modal>
diff --git a/packages/web/src/features/models/protocol-suffix.tsx b/packages/web/src/features/models/protocol-suffix.tsx
index 98cc2f31..6f790d75 100644
--- a/packages/web/src/features/models/protocol-suffix.tsx
+++ b/packages/web/src/features/models/protocol-suffix.tsx
@@ -30,8 +30,8 @@
* the call site — so no extra row appears in the happy path.
*/
import { useState } from "react";
+import { ChevronDown } from "@prismshadow/penguin-ui";
import { Dropdown } from "../../components/ui/dropdown";
-import { ChevronDown } from "../../components/ui/icons";
import { ChoiceCheck, menuRowClass, menuRowTone } from "../../components/ui/field";
// This menu is an OptionMenu by hand (its trigger lives inside the base URL field, which
// OptionMenu cannot do), so it takes its row typography from OptionMenu's own records rather
diff --git a/packages/web/src/features/plugins/plugin-detail-page.tsx b/packages/web/src/features/plugins/plugin-detail-page.tsx
index 5fb25ecb..79eafce1 100644
--- a/packages/web/src/features/plugins/plugin-detail-page.tsx
+++ b/packages/web/src/features/plugins/plugin-detail-page.tsx
@@ -13,16 +13,21 @@ import { useEffect, useState } from "react";
import { Link, useParams } from "react-router";
import type { PluginIndexEntry } from "@prismshadow/penguin-server/api";
import ReactMarkdown from "react-markdown";
+import {
+ Button,
+ CopiedStatus,
+ CopyCheckGlyph,
+ GlyphIcon,
+ ICONS,
+ Skeleton,
+ useCopied,
+} from "@prismshadow/penguin-ui";
import { REHYPE_PLUGINS, REMARK_PLUGINS } from "../../lib/markdown-plugins";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useDocumentTitle } from "../../lib/use-document-title";
-import { Button } from "../../components/ui/button";
-import { CopiedStatus, CopyCheckGlyph, useCopied } from "../../components/ui/copy-button";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { NAV_ICONS } from "../../components/ui/icons";
-import { Skeleton } from "../../components/ui/skeleton";
+import { NAV_ICONS } from "../../lib/nav-icons";
import { toneInk } from "../../lib/tone";
export function PluginDetailPage() {
@@ -74,7 +79,7 @@ export function PluginDetailPage() {
to="/plugins"
className="inline-flex items-center gap-1.5 text-xs text-gray-500 transition-colors duration-150 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"
>
- <GlyphIcon d="M15 6l-6 6 6 6" size={14} />
+ <GlyphIcon d={ICONS.chevronLeft} size={14} />
{S.pluginRegistry.back}
</Link>
diff --git a/packages/web/src/features/plugins/plugin-detail.tsx b/packages/web/src/features/plugins/plugin-detail.tsx
index b7a30826..b6e88802 100644
--- a/packages/web/src/features/plugins/plugin-detail.tsx
+++ b/packages/web/src/features/plugins/plugin-detail.tsx
@@ -9,13 +9,12 @@
* on hand at once and nothing here is fetched per directory.
*/
import { useEffect, useState } from "react";
+import { Badge, ICONS } from "@prismshadow/penguin-ui";
import { Modal } from "../../components/ui/modal";
-import { Badge } from "../../components/ui/badge";
import { FileBrowser } from "../../components/ui/file-browser";
import type { FileBrowserPreview } from "../../components/ui/file-browser";
import type { TreeToggle } from "../../components/ui/file-tree";
import type { FileTreeRow } from "../../lib/file-tree";
-import { PLUGIN_ICON } from "../../components/ui/icons";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { baseName } from "../../lib/workspace-tree";
@@ -212,7 +211,7 @@ export function PluginDetailModal({
<SkillTile
icon={plugin.icon}
name={plugin.name}
- fallback={PLUGIN_ICON}
+ fallback={ICONS.puzzle}
size={40}
glyph={22}
/>
diff --git a/packages/web/src/features/plugins/plugins-page.tsx b/packages/web/src/features/plugins/plugins-page.tsx
index 276a6085..f09563ba 100644
--- a/packages/web/src/features/plugins/plugins-page.tsx
+++ b/packages/web/src/features/plugins/plugins-page.tsx
@@ -48,6 +48,18 @@ import type {
PluginItem,
SkillMetadataItem,
} from "@prismshadow/penguin-server/api";
+import {
+ AgentAvatar,
+ Button,
+ Chevron,
+ GlyphIcon,
+ ICONS,
+ ICON_SIZE,
+ Skeleton,
+ SkeletonCard,
+ StatusIcon,
+ UpdateDot,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
@@ -61,18 +73,10 @@ import { useLocale } from "../../state/locale";
import { agentDisplayName, useProject } from "../../state/project";
import { useSessions } from "../../state/sessions";
import { MachinePicker, type MachineChoice } from "../machines/machine-picker";
-import { AgentAvatar } from "../../components/ui/agent-avatar";
-import { Button } from "../../components/ui/button";
-import { Chevron } from "../../components/ui/chevron";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { GEAR_ICON, NAV_ICONS, PLUGIN_ICON } from "../../components/ui/icons";
+import { NAV_ICONS } from "../../lib/nav-icons";
import { Modal } from "../../components/ui/modal";
-import { TRASH_ICON } from "../../components/ui/session-row-menu";
-import { StatusIcon } from "../../components/ui/status-icon";
import { TodoNotice } from "../../components/ui/todo-notice";
-import { UpdateDot } from "../../components/ui/update-dot";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { Skeleton, SkeletonCard } from "../../components/ui/skeleton";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { DRAFT_SESSION_ID } from "../chat/chat-page";
import { draftKey, loadDraft, saveDraft } from "../chat/draft-cache";
@@ -83,7 +87,6 @@ import { SettingsDialog } from "../settings/settings-dialog";
import { formatRelativeDate } from "../../lib/format";
import { SkillTile } from "../skills/skill-icon-view";
import { InfoPopover } from "../../components/ui/info-popover";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneInk, toneSurface } from "../../lib/tone";
import { Input } from "../../components/ui/input";
import { NoticeStrip } from "../../components/ui/notice-strip";
@@ -104,12 +107,8 @@ export type InstalledMap = ReadonlyMap<string, AgentInstalls>;
/** The three fields of a plugin the install questions below read (the card passes the whole DTO; tests can pass just these). */
export type PluginParts = Pick<PluginItem, "name" | "skills" | "hooks">;
-/** "Quick start" button icon (paper plane, 24×24 line path; button shows only the icon, copy goes into aria/title). */
-const SEND_ICON = "M22 2 11 13M22 2 15 22 11 13 2 9 22 2";
/** "Manage installs" button icon (download into tray, 24×24 line path). */
const INSTALL_ICON = "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3";
-/** "Update installs" button icon (rotate-cw, 24×24 line path). */
-const UPDATE_ICON = "M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10";
const NO_INSTALLS: AgentInstalls = { skills: new Map(), hooks: new Map() };
@@ -629,7 +628,7 @@ export function PluginsPage() {
title={S.plugins.openSettings}
onClick={() => setSettingsOpen(true)}
>
- <GlyphIcon d={GEAR_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.gear} size={ICON_SIZE.iconButton} />
</Button>
</div>
)}
@@ -1313,7 +1312,7 @@ function PluginCard({
<SkillTile
icon={plugin.icon}
name={plugin.name}
- fallback={PLUGIN_ICON}
+ fallback={ICONS.puzzle}
size={36}
glyph={20}
/>
@@ -1372,7 +1371,7 @@ function PluginCard({
title={S.plugins.updateOutdated(outdated.length)}
onClick={() => setPendingUpdate(outdated)}
>
- <GlyphIcon d={UPDATE_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.rotateCw} size={ICON_SIZE.iconButton} />
<UpdateDot
size="inline"
position="right-0.5 top-0.5 -translate-y-1/2 translate-x-1/2"
@@ -1390,7 +1389,7 @@ function PluginCard({
if (quickStartSkill) onQuickInvoke(quickStartSkill.name);
}}
>
- <GlyphIcon d={SEND_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.paperPlane} size={ICON_SIZE.iconButton} />
</Button>
)}
<Button
@@ -1626,7 +1625,7 @@ function ModuleRow({
const body = (
<>
<div className="flex items-center gap-3">
- <SkillTile name={specifier} fallback={PLUGIN_ICON} size={36} glyph={20} />
+ <SkillTile name={specifier} fallback={ICONS.puzzle} size={36} glyph={20} />
<div className="min-w-0 flex-1">
<div className="flex items-baseline gap-2">
<span
@@ -1713,7 +1712,7 @@ function ModuleRow({
onClick={onInstall}
>
{busy ? (
- <StatusIcon state="running" size={ICON_SIZE.iconButton} />
+ <StatusIcon state="running" />
) : (
<GlyphIcon d={INSTALL_ICON} size={ICON_SIZE.iconButton} />
)}
@@ -1730,9 +1729,9 @@ function ModuleRow({
onClick={onRemove}
>
{busy ? (
- <StatusIcon state="running" size={ICON_SIZE.iconButton} />
+ <StatusIcon state="running" />
) : (
- <GlyphIcon d={TRASH_ICON} size={ICON_SIZE.iconButton} />
+ <GlyphIcon d={ICONS.trash} size={ICON_SIZE.iconButton} />
)}
</Button>
)}
diff --git a/packages/web/src/features/schedules/schedule-ai-modal.tsx b/packages/web/src/features/schedules/schedule-ai-modal.tsx
index 50f5efb4..40465324 100644
--- a/packages/web/src/features/schedules/schedule-ai-modal.tsx
+++ b/packages/web/src/features/schedules/schedule-ai-modal.tsx
@@ -9,11 +9,9 @@
*/
import { useState } from "react";
import type { AgentSummary } from "@prismshadow/penguin-server/api";
+import { Button, GlyphIcon, ICONS } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { agentDisplayName } from "../../state/project";
-import { Button } from "../../components/ui/button";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { MAGIC_WAND_ICON } from "../../components/ui/icons";
import { Modal } from "../../components/ui/modal";
import { AiCreatePanel, composeAiPrompt } from "../ai-create";
import { scheduleExamples } from "./schedule-suggestions";
@@ -70,7 +68,7 @@ function ScheduleAiDialog({
glyph in place; a second copy control here would answer with a toast instead.
*/}
<Button size="sm" variant="primary" disabled={!filled} onClick={go}>
- <GlyphIcon d={MAGIC_WAND_ICON} />
+ <GlyphIcon d={ICONS.wand} />
{S.schedule.editInSession}
</Button>
</>
diff --git a/packages/web/src/features/schedules/schedule-form-modal.tsx b/packages/web/src/features/schedules/schedule-form-modal.tsx
index 895d87cc..70bc093e 100644
--- a/packages/web/src/features/schedules/schedule-form-modal.tsx
+++ b/packages/web/src/features/schedules/schedule-form-modal.tsx
@@ -20,11 +20,11 @@ import type {
ScheduleUpsertRequest,
SessionInfo,
} from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useProject } from "../../state/project";
-import { Button } from "../../components/ui/button";
import { Input, Textarea } from "../../components/ui/input";
import { Select } from "../../components/ui/select";
import { Modal } from "../../components/ui/modal";
diff --git a/packages/web/src/features/schedules/schedule-panel.tsx b/packages/web/src/features/schedules/schedule-panel.tsx
index 22b04fd7..0aec3ae4 100644
--- a/packages/web/src/features/schedules/schedule-panel.tsx
+++ b/packages/web/src/features/schedules/schedule-panel.tsx
@@ -21,31 +21,30 @@ import type {
ScheduleItem,
SessionInfo,
} from "@prismshadow/penguin-server/api";
+import {
+ Badge,
+ GlyphIcon,
+ ICONS,
+ ICON_SIZE,
+ SettingsEmpty,
+ SkeletonList,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneInk } from "../../lib/tone";
import { useLocale } from "../../state/locale";
import { useProject } from "../../state/project";
-import { Badge } from "../../components/ui/badge";
import { ConfirmModal } from "../../components/ui/confirm-modal";
import { Dropdown } from "../../components/ui/dropdown";
-import { SettingsEmpty } from "../../components/ui/empty-state";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { Icon } from "../../components/ui/group-list";
-import { INFO_ICON } from "../../components/ui/icons";
import { Input } from "../../components/ui/input";
import { Segmented } from "../../components/ui/segmented";
import {
- ELLIPSIS_ICON,
- PENCIL_ICON,
- TRASH_ICON,
overflowMenuDangerClass,
overflowMenuGlyph,
overflowMenuRowClass,
} from "../../components/ui/session-row-menu";
-import { SkeletonList } from "../../components/ui/skeleton";
import { Switch } from "../../components/ui/switch";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { CreateButtons } from "../ai-create";
@@ -84,7 +83,7 @@ function StateGlyph({ item }: { item: ScheduleItem }) {
? PAUSE_ICON
: glyph === "check"
? CHECK_ICON
- : INFO_ICON;
+ : ICONS.info;
return (
<span className={`shrink-0 ${tone}`} data-tooltip={item.invalidReason ?? name}>
<GlyphIcon d={d} size={ICON_SIZE.rowLead} filled={glyph === "play"} />
@@ -116,18 +115,18 @@ function RowMenu({ onEdit, onDelete }: { onEdit: () => void; onDelete: () => voi
onClick={() => setOpen(!open)}
className="flex h-6 w-6 shrink-0 items-center justify-center rounded text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200"
>
- <GlyphIcon d={ELLIPSIS_ICON} size={ICON_SIZE.rowLead} filled />
+ <GlyphIcon d={ICONS.ellipsis} size={ICON_SIZE.rowLead} filled />
</button>
}
>
<button type="button" className={overflowMenuRowClass} onClick={item(onEdit)}>
- {overflowMenuGlyph(PENCIL_ICON)}
+ {overflowMenuGlyph(ICONS.pencil)}
{S.common.edit}
</button>
<button type="button" className={overflowMenuDangerClass} onClick={item(onDelete)}>
{/* The glyph inherits the row's red. */}
<span className="shrink-0">
- <Icon d={TRASH_ICON} size={13} />
+ <Icon d={ICONS.trash} size={13} />
</span>
{S.common.delete}
</button>
@@ -303,7 +302,7 @@ export function SchedulePanel({ session, active, onPrefillComposer }: SchedulePa
>
{item.name}
</span>
- {item.queued && <Badge tone="brand">{S.schedule.queued}</Badge>}
+ {item.queued && <Badge variant="solid">{S.schedule.queued}</Badge>}
</div>
<div
className="truncate text-xs text-gray-500 dark:text-gray-400"
diff --git a/packages/web/src/features/schedules/schedule-suggestions.tsx b/packages/web/src/features/schedules/schedule-suggestions.tsx
index c1be3e98..4224bc52 100644
--- a/packages/web/src/features/schedules/schedule-suggestions.tsx
+++ b/packages/web/src/features/schedules/schedule-suggestions.tsx
@@ -6,10 +6,8 @@
* agent as a whole (the settings tab opens a new Session). Picking one opens the AI creation
* dialog with that prompt filled in, and the same rows are the dialog's clickable examples.
*/
+import { GlyphIcon, ICONS, ICON_GAP, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_GAP, ICON_SIZE } from "../../lib/icon-scale";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { CALENDAR_ICON } from "../../components/ui/group-list";
import type { AiExample } from "../ai-create";
/** Sunrise (a half sun over the horizon, rays out): the daily brief. */
@@ -34,9 +32,9 @@ export interface ScheduleSuggestion {
prompt: string;
}
-const ICONS: Record<ScheduleSuggestionKey, string> = {
+const SUGGESTION_ICONS: Record<ScheduleSuggestionKey, string> = {
dailyBrief: SUNRISE_ICON,
- weeklyReview: CALENDAR_ICON,
+ weeklyReview: ICONS.calendar,
followUp: BELL_ICON,
monitor: ACTIVITY_ICON,
};
@@ -54,7 +52,7 @@ export function scheduleSuggestions(mode: SuggestionMode): ScheduleSuggestion[]
const s = S.schedule.suggestions[key];
return {
key,
- icon: ICONS[key],
+ icon: SUGGESTION_ICONS[key],
name: s.name,
hint: s.hint,
description: s.description,
diff --git a/packages/web/src/features/semantic-id/semantic-id-field.tsx b/packages/web/src/features/semantic-id/semantic-id-field.tsx
index b24e4900..f800c576 100644
--- a/packages/web/src/features/semantic-id/semantic-id-field.tsx
+++ b/packages/web/src/features/semantic-id/semantic-id-field.tsx
@@ -27,16 +27,14 @@
import { useId, useState } from "react";
import type { KeyboardEvent } from "react";
import type { SemanticIdKind } from "@prismshadow/penguin-server/api";
+import { Button, GlyphIcon, ICON_SIZE } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { toneInk } from "../../lib/tone";
-import { Button } from "../../components/ui/button";
import { Input } from "../../components/ui/input";
import { FieldError, FieldHint, FieldLabel } from "../../components/ui/field";
import { toastError } from "../../components/ui/toast";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { idSuggestNotice, proposalValue } from "./id-suggest-notice";
import type { IdSuggestNotice } from "./id-suggest-notice";
diff --git a/packages/web/src/features/settings/account-section.tsx b/packages/web/src/features/settings/account-section.tsx
index 889989ea..0c4d2e60 100644
--- a/packages/web/src/features/settings/account-section.tsx
+++ b/packages/web/src/features/settings/account-section.tsx
@@ -5,8 +5,8 @@
* offersChangePassword for the full rule).
*/
import { useState } from "react";
+import { Button } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
import { ChangePasswordDialog } from "../../components/account/change-password-dialog";
import { PrefRow } from "./setting-row";
diff --git a/packages/web/src/features/settings/credits-section.tsx b/packages/web/src/features/settings/credits-section.tsx
index c37d54f6..0ab48f2d 100644
--- a/packages/web/src/features/settings/credits-section.tsx
+++ b/packages/web/src/features/settings/credits-section.tsx
@@ -18,9 +18,8 @@ import { useId, useState } from "react";
import { FONT_CREDITS } from "@prismshadow/penguin-ui/fonts-credits";
import type { FontCredit } from "@prismshadow/penguin-ui/fonts-credits";
import type { ThemeId } from "@prismshadow/penguin-ui";
+import { Chevron, ICON_GAP } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_GAP } from "../../lib/icon-scale";
-import { Chevron } from "../../components/ui/chevron";
/** A theme id in the reader's words. */
function themeName(id: ThemeId): string {
diff --git a/packages/web/src/features/settings/plugins-section.tsx b/packages/web/src/features/settings/plugins-section.tsx
index b992b15d..7679b23b 100644
--- a/packages/web/src/features/settings/plugins-section.tsx
+++ b/packages/web/src/features/settings/plugins-section.tsx
@@ -27,7 +27,6 @@ import { S } from "../../lib/strings";
import { useLocale } from "../../state/locale";
import { localizedText } from "../chat/skill-use";
import { apiErrorText } from "../../lib/api-error";
-import { Button } from "../../components/ui/button";
import { Input, Textarea } from "../../components/ui/input";
import { PasswordInput } from "../../components/ui/password-input";
import { Select } from "../../components/ui/select";
@@ -38,7 +37,7 @@ import { SectionShell } from "./section-shell";
import { useSessions } from "../../state/sessions";
import { MachinePicker } from "../machines/machine-picker";
import { NoticeStrip } from "../../components/ui/notice-strip";
-import { Spinner } from "@prismshadow/penguin-ui";
+import { Button, Spinner } from "@prismshadow/penguin-ui";
/** The picker's value for this server; a machine id is never this short. */
const THIS_SERVER = "*";
diff --git a/packages/web/src/features/settings/profile-section.tsx b/packages/web/src/features/settings/profile-section.tsx
index 6c172081..543f8fca 100644
--- a/packages/web/src/features/settings/profile-section.tsx
+++ b/packages/web/src/features/settings/profile-section.tsx
@@ -28,27 +28,31 @@
import { useState } from "react";
import type { ChangeEvent } from "react";
import type { UpdateProfileRequest } from "@prismshadow/penguin-server/api";
+import {
+ Button,
+ HiddenFileInput,
+ USER_AVATAR_SIZE,
+ UserAvatar,
+ buttonClass,
+} from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { avatarDataUrlFromFile } from "../../lib/avatar-image";
import { profileControls } from "../../lib/profile-form";
import { useAuth } from "../../state/auth";
-import { Button, labelButtonClass } from "../../components/ui/button";
-import { HiddenFileInput } from "../../components/ui/hidden-file-input";
import { Input } from "../../components/ui/input";
-import { UserAvatar, USER_AVATAR_SIZE } from "../../components/ui/user-avatar";
import { toastSuccess } from "../../components/ui/toast";
import { PrefRow } from "./setting-row";
/** What the picker offers — the three formats the server stores, spelled the way `accept` wants. */
const AVATAR_ACCEPT = "image/png,image/jpeg,image/webp";
-const CHANGE_AVATAR_CLASS = labelButtonClass("secondary", "sm");
+const CHANGE_AVATAR_CLASS = buttonClass("secondary", "sm");
/**
* The same control while a write is running. `Button`'s `disabled:` rules cannot help here — a
- * `<label>` takes no disabled state — and a `cursor-not-allowed` beside `labelButtonClass`'s
+ * `<label>` takes no disabled state — and a `cursor-not-allowed` beside `buttonClass`'s
* `cursor-pointer` would be decided by the order the stylesheet was generated in rather than by
* this string. `pointer-events-none` has no counterpart to lose to, and it removes the hover
* colour and the pointer cursor together; the input inside is `disabled`, so Tab skips it too.
diff --git a/packages/web/src/features/settings/proxy-section.tsx b/packages/web/src/features/settings/proxy-section.tsx
index e4fd323e..b3cff2c0 100644
--- a/packages/web/src/features/settings/proxy-section.tsx
+++ b/packages/web/src/features/settings/proxy-section.tsx
@@ -38,12 +38,12 @@ import type {
ProxyProbeTargetDto,
ServerSettings,
} from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { toneInk } from "../../lib/tone";
-import { Button } from "../../components/ui/button";
import { Input } from "../../components/ui/input";
import { Switch } from "../../components/ui/switch";
import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
diff --git a/packages/web/src/features/settings/setting-row.tsx b/packages/web/src/features/settings/setting-row.tsx
index 28a2fd30..2ecf9c94 100644
--- a/packages/web/src/features/settings/setting-row.tsx
+++ b/packages/web/src/features/settings/setting-row.tsx
@@ -6,8 +6,8 @@
* them.
*/
import type { ReactNode } from "react";
+import { ICON_GAP } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { ICON_GAP } from "../../lib/icon-scale";
import { InfoPopover } from "../../components/ui/info-popover";
import { accentSwatches, useTheme } from "../../state/theme";
import type { Accent, ThemeId } from "../../state/theme";
diff --git a/packages/web/src/features/settings/settings-dialog.tsx b/packages/web/src/features/settings/settings-dialog.tsx
index c9a63fe4..41dff79d 100644
--- a/packages/web/src/features/settings/settings-dialog.tsx
+++ b/packages/web/src/features/settings/settings-dialog.tsx
@@ -8,6 +8,7 @@
* anything not on it falls back to the first page they can actually open.
*/
import { useEffect, useState } from "react";
+import { ICONS } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import {
resolveSettingsSection,
@@ -19,7 +20,6 @@ import { useAuth } from "../../state/auth";
import { PagedDialog } from "../../components/ui/paged-dialog";
import type { PagedDialogGroup } from "../../components/ui/paged-dialog";
import { Icon } from "../../components/ui/group-list";
-import { COMPANY_MODE_ICON, GEAR_ICON } from "../../components/ui/icons";
import { ProfileSection } from "./profile-section";
import { GeneralSection } from "./general-section";
import { AppearanceSection } from "./appearance-section";
@@ -37,7 +37,7 @@ const SECTION_ICONS: Record<SettingsSectionKey, string> = {
/** Person in a circle: the account's own identity, distinct from the bust used for credentials. */
profile:
"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 11.5a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6.2 18.4a6 6 0 0 1 11.6 0",
- general: GEAR_ICON,
+ general: ICONS.gear,
/** Sun: appearance. */
appearance:
"M12 17a5 5 0 1 0 0-10 5 5 0 0 0 0 10zM12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4l1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4m11.4-11.4l1.4-1.4",
@@ -54,7 +54,7 @@ const SECTION_ICONS: Record<SettingsSectionKey, string> = {
/** Up arrow over a base: uploads. */
uploads: "M12 15V4m0 0L7 9m5-5l5 5M4 20h16",
/** The building the mode switch wears: company mode. */
- company: COMPANY_MODE_ICON,
+ company: ICONS.building,
/** Puzzle piece: plugins. */
plugins:
"M10 4a2 2 0 1 1 4 0v2h3a1 1 0 0 1 1 1v3h-2a2 2 0 1 0 0 4h2v3a1 1 0 0 1-1 1h-3v-2a2 2 0 1 0-4 0v2H7a1 1 0 0 1-1-1v-3h2a2 2 0 1 0 0-4H6V7a1 1 0 0 1 1-1h3V4z",
diff --git a/packages/web/src/features/settings/shortcut-recorder.tsx b/packages/web/src/features/settings/shortcut-recorder.tsx
index 878b74ec..a6eeafa6 100644
--- a/packages/web/src/features/settings/shortcut-recorder.tsx
+++ b/packages/web/src/features/settings/shortcut-recorder.tsx
@@ -8,7 +8,7 @@
import { useCallback, useEffect, useRef, useState } from "react";
import type { ReactNode } from "react";
import { S } from "../../lib/strings";
-import { Kbd } from "../../components/ui/kbd";
+import { ChordKbd } from "../../components/ui/chord-kbd";
import { isModifierCode } from "../../lib/shortcuts/chord";
import { formatChord } from "../../lib/shortcuts/format";
import { currentPlatform } from "../../lib/shortcuts/platform";
@@ -76,7 +76,7 @@ export function ShortcutRecorder({
S.shortcuts.record
);
} else if (chord !== null) {
- content = <Kbd chord={chord} size="control" />;
+ content = <ChordKbd chord={chord} />;
} else {
content = <span className="text-gray-400 dark:text-gray-500">{S.shortcuts.unbound}</span>;
}
diff --git a/packages/web/src/features/settings/shortcuts-section.tsx b/packages/web/src/features/settings/shortcuts-section.tsx
index 24e519ec..21a97c43 100644
--- a/packages/web/src/features/settings/shortcuts-section.tsx
+++ b/packages/web/src/features/settings/shortcuts-section.tsx
@@ -8,11 +8,9 @@
* tab never receives ⌘W; ⌘P takes over the browser's Print; the desktop menu also carries ⌘R).
*/
import { useState } from "react";
+import { Button, GlyphIcon, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
-import { Button } from "../../components/ui/button";
import { ConfirmModal } from "../../components/ui/confirm-modal";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { conflictsOf, findConflicts, type Conflict } from "../../lib/shortcuts/conflicts";
import { currentHost, currentPlatform } from "../../lib/shortcuts/platform";
import { SHORTCUT_COMMANDS, SHORTCUT_GROUPS, commandById } from "../../lib/shortcuts/registry";
diff --git a/packages/web/src/features/settings/trace-import-row.tsx b/packages/web/src/features/settings/trace-import-row.tsx
index 067a0037..677d8386 100644
--- a/packages/web/src/features/settings/trace-import-row.tsx
+++ b/packages/web/src/features/settings/trace-import-row.tsx
@@ -19,11 +19,10 @@
import { useEffect, useState } from "react";
import type { ChangeEvent } from "react";
import type { AgentSummary, ProjectSummary } from "@prismshadow/penguin-server/api";
+import { HiddenFileInput, UploadIcon } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { HiddenFileInput } from "../../components/ui/hidden-file-input";
-import { UploadIcon } from "../../components/ui/icons";
import { Select } from "../../components/ui/select";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { agentDisplayName, projectDisplayName, useProject } from "../../state/project";
diff --git a/packages/web/src/features/settings/uploads-section.tsx b/packages/web/src/features/settings/uploads-section.tsx
index a3b51fe5..21b11403 100644
--- a/packages/web/src/features/settings/uploads-section.tsx
+++ b/packages/web/src/features/settings/uploads-section.tsx
@@ -14,12 +14,12 @@
*/
import { useEffect, useState } from "react";
import type { ServerSettings } from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { ApiError } from "../../api/client";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { useAuth } from "../../state/auth";
-import { Button } from "../../components/ui/button";
import { Input } from "../../components/ui/input";
import { toastError, toastInfo, toastSuccess } from "../../components/ui/toast";
import { SectionShell } from "./section-shell";
diff --git a/packages/web/src/features/skills/skill-icon-view.tsx b/packages/web/src/features/skills/skill-icon-view.tsx
index 7dec1947..e5f45bda 100644
--- a/packages/web/src/features/skills/skill-icon-view.tsx
+++ b/packages/web/src/features/skills/skill-icon-view.tsx
@@ -13,7 +13,7 @@
* color).
*/
import { useMemo } from "react";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
+import { GlyphIcon } from "@prismshadow/penguin-ui";
import { BOOK_ICON } from "../chat/skill-use";
import { sanitizeSkillIcon } from "./skill-icon";
diff --git a/packages/web/src/features/skills/skill-pick-list.tsx b/packages/web/src/features/skills/skill-pick-list.tsx
index ab2d825f..06f8a267 100644
--- a/packages/web/src/features/skills/skill-pick-list.tsx
+++ b/packages/web/src/features/skills/skill-pick-list.tsx
@@ -18,9 +18,9 @@
*/
import { useState } from "react";
import type { SkillMetadataItem } from "@prismshadow/penguin-server/api";
+import { ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { useLocale } from "../../state/locale";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { menuSearchClass, noAutofill } from "../../components/ui/input";
import { filterSkills, localizedShortText } from "../chat/skill-use";
import { SkillIcon } from "./skill-icon-view";
diff --git a/packages/web/src/features/terminal/terminal-keybar.tsx b/packages/web/src/features/terminal/terminal-keybar.tsx
index d1a50a7f..22601a02 100644
--- a/packages/web/src/features/terminal/terminal-keybar.tsx
+++ b/packages/web/src/features/terminal/terminal-keybar.tsx
@@ -16,9 +16,8 @@
* arms it and the next character typed on the soft keyboard consumes it (the composition
* happens on the data path in terminal-view.tsx). Tapping again disarms.
*/
+import { GlyphIcon, ICON_SIZE } from "@prismshadow/penguin-ui";
import { useTerminalChrome } from "./terminal-appearance";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { S } from "../../lib/strings";
import {
NO_MODIFIERS,
diff --git a/packages/web/src/features/terminal/terminal-page.tsx b/packages/web/src/features/terminal/terminal-page.tsx
index 73fcdcef..65b51ae5 100644
--- a/packages/web/src/features/terminal/terminal-page.tsx
+++ b/packages/web/src/features/terminal/terminal-page.tsx
@@ -24,9 +24,7 @@
* status dot, the "+") stay, each naming itself.
*/
import { useCallback, useMemo, useState } from "react";
-import { ADD_ICON } from "../../components/ui/icons";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
-import { ICON_SIZE } from "../../lib/icon-scale";
+import { GlyphIcon, ICONS, ICON_SIZE } from "@prismshadow/penguin-ui";
import { S } from "../../lib/strings";
import { ConfirmModal } from "../../components/ui/confirm-modal";
import { useCoarsePointer } from "../../lib/use-coarse-pointer";
@@ -228,7 +226,7 @@ export function TerminalPage() {
data-tooltip={S.terminal.newShell}
className={`flex shrink-0 items-center gap-1 rounded border px-2 py-1 ${chrome.outlineButton}`}
>
- <GlyphIcon d={ADD_ICON} size={ICON_SIZE.rowLead} />
+ <GlyphIcon d={ICONS.plus} size={ICON_SIZE.rowLead} />
<span className="hidden sm:inline">{S.terminal.newShell}</span>
</button>
</header>
diff --git a/packages/web/src/features/traces/trace-event-row.tsx b/packages/web/src/features/traces/trace-event-row.tsx
index a940290c..e22acbb2 100644
--- a/packages/web/src/features/traces/trace-event-row.tsx
+++ b/packages/web/src/features/traces/trace-event-row.tsx
@@ -12,21 +12,22 @@
* aren't highlighted together).
*/
import { Fragment, useState } from "react";
-import { HOOK_ICON } from "../../components/ui/icons";
+import { Badge, ICONS } from "@prismshadow/penguin-ui";
+import type { BadgeStyle } from "@prismshadow/penguin-ui";
import ReactMarkdown from "react-markdown";
import { REHYPE_PLUGINS, REMARK_PLUGINS } from "../../lib/markdown-plugins";
import { S } from "../../lib/strings";
import type { OmniMessage } from "@prismshadow/penguin-core/omnimessage";
import { formatTime, humanizeTokens } from "../../lib/format";
-import { Badge, stopReasonTone } from "../../components/ui/badge";
+import { stopReasonTone } from "../../lib/stop-reason-tone";
import { RequiredMark } from "../../components/ui/field";
-import type { BadgeTone } from "../../components/ui/badge";
import { ZoomableImage } from "../../components/ui/image-zoom";
-export function typeTone(type: string): BadgeTone {
- if (type === "session_meta") return "brand";
- if (type === "model_msg") return "gray";
- return "amber";
+/** An event type as a badge: the session header stands out as a neutral solid tag. */
+export function typeBadge(type: string): BadgeStyle {
+ if (type === "session_meta") return { tone: "neutral", variant: "solid" };
+ if (type === "model_msg") return { tone: "neutral" };
+ return { tone: "attention" };
}
/** Icon for each event type (24×24 line path). */
@@ -35,9 +36,9 @@ const TYPE_ICON: Record<string, string> = {
thinking: "M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11v2h6v-2a6 6 0 0 0-3-11z",
image_url: "M3 5h18v14H3zM3 15l5-5 4 4 3-3 6 6",
inline_data: "M3 5h18v14H3zM3 15l5-5 4 4 3-3 6 6",
- tool_call: "M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",
+ tool_call: ICONS.wrench,
tool_call_output: "M4 6l4 4-4 4M12 18h8",
- token_usage: "M4 20V10m6 10V4m6 16v-7m4 7H2",
+ token_usage: ICONS.barChart,
request_begin: "M5 12h14M13 6l6 6-6 6",
request_end: "M19 12H5M11 6l-6 6 6 6",
approval_decision: "M9 12l2 2 4-4M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z",
@@ -46,11 +47,11 @@ const TYPE_ICON: Record<string, string> = {
abort: "M6 6h12v12H6z",
subagent: "M12 3v6m0 0l-5 4v8m5-12l5 4v8M4 21h16",
// A hook's answer: the hook glyph the settings tab and the harness card use.
- hook: HOOK_ICON,
+ hook: ICONS.fishHook,
// MCP connect pair: a plug shape; tool_list_ready reuses the wrench (a toolset record).
mcp_connect_begin: "M9 7V3m6 4V3M7 7h10v4a5 5 0 0 1-10 0zM12 16v5",
mcp_connect_end: "M9 7V3m6 4V3M7 7h10v4a5 5 0 0 1-10 0zM12 16v5",
- tool_list_ready: "M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",
+ tool_list_ready: ICONS.wrench,
};
const DEFAULT_ICON = "M12 8v5m0 3h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z";
@@ -434,8 +435,8 @@ export function EventRow({
{formatTime(msg.timestamp)}
</span>
<TypeIcon type={payloadType} />
- <Badge tone={typeTone(msg.type)}>{payloadType}</Badge>
- {msg.origin && msg.origin.length > 0 && <Badge tone="brand">origin</Badge>}
+ <Badge {...typeBadge(msg.type)}>{payloadType}</Badge>
+ {msg.origin && msg.origin.length > 0 && <Badge variant="solid">origin</Badge>}
<span className="min-w-0 flex-1 truncate font-mono text-xs text-gray-500 dark:text-gray-400">
{summarizeEvent(msg)}
</span>
diff --git a/packages/web/src/features/traces/trace-file-view.tsx b/packages/web/src/features/traces/trace-file-view.tsx
index f3f0cc11..e13fd929 100644
--- a/packages/web/src/features/traces/trace-file-view.tsx
+++ b/packages/web/src/features/traces/trace-file-view.tsx
@@ -32,6 +32,7 @@ import type {
TraceTaskStats,
TraceToolSpan,
} from "@prismshadow/penguin-server/api";
+import { Chevron, GlyphIcon, Skeleton } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
@@ -48,9 +49,6 @@ import {
import { STAT_ICONS } from "../../lib/stat-icons";
import { resolveContextWindow } from "../../lib/context";
import { useTheme } from "../../state/theme";
-import { Skeleton } from "../../components/ui/skeleton";
-import { Chevron } from "../../components/ui/chevron";
-import { GlyphIcon } from "../../components/ui/glyph-icon";
import { TokenDonut } from "../../components/ui/token-donut";
import { TRACE_EVENT_PAGE_SIZE, loadTraceEventPages } from "./trace-events-loader";
import { TimelineChart } from "./timeline-chart";
diff --git a/packages/web/src/features/traces/trace-panel.tsx b/packages/web/src/features/traces/trace-panel.tsx
index 97dd3274..7696f4ce 100644
--- a/packages/web/src/features/traces/trace-panel.tsx
+++ b/packages/web/src/features/traces/trace-panel.tsx
@@ -15,14 +15,11 @@
*/
import { useEffect, useRef, useState } from "react";
import type { SessionInfo } from "@prismshadow/penguin-server/api";
+import { DownloadIcon, EmptyState, ICON_SIZE, Skeleton } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatBytes } from "../../lib/format";
-import { DownloadIcon } from "../../components/ui/icons";
-import { EmptyState } from "../../components/ui/empty-state";
-import { Skeleton } from "../../components/ui/skeleton";
-import { ICON_SIZE } from "../../lib/icon-scale";
import { TraceFileView } from "./trace-file-view";
import {
activeTraceFile,
diff --git a/packages/web/src/features/usage/errors-panel.tsx b/packages/web/src/features/usage/errors-panel.tsx
index 43843b30..9d788169 100644
--- a/packages/web/src/features/usage/errors-panel.tsx
+++ b/packages/web/src/features/usage/errors-panel.tsx
@@ -11,11 +11,11 @@
*/
import { useEffect, useState } from "react";
import type { UsageErrorItem, UsageErrors } from "@prismshadow/penguin-server/api";
+import { Badge } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
import { formatDateTime } from "../../lib/format";
-import { Badge } from "../../components/ui/badge";
import { ConfirmModal } from "../../components/ui/confirm-modal";
import { toastError, toastSuccess } from "../../components/ui/toast";
import { Empty } from "./usage-charts";
@@ -313,7 +313,9 @@ export function ErrorsPanel({
<span className="block break-words">{sourceCode(e.source, e.code)}</span>
</td>
<td className="py-1.5 pr-2 align-top">
- <Badge tone={key === "unexpected" ? "red" : "gray"}>{kindLabel(key)}</Badge>
+ <Badge tone={key === "unexpected" ? "danger" : "neutral"}>
+ {kindLabel(key)}
+ </Badge>
</td>
<td className="py-1.5 align-top text-gray-500 dark:text-gray-400">
{/* One line by default; click to expand to the full message (wrapping), click again to collapse. */}
diff --git a/packages/web/src/features/usage/usage-page.tsx b/packages/web/src/features/usage/usage-page.tsx
index e30e83a3..a3f0aa32 100644
--- a/packages/web/src/features/usage/usage-page.tsx
+++ b/packages/web/src/features/usage/usage-page.tsx
@@ -28,6 +28,7 @@
import { useCallback, useEffect, useMemo, useState } from "react";
import { useSearchParams } from "react-router";
import type { ModelRefDto, UsageBucket, UsageResponse } from "@prismshadow/penguin-server/api";
+import { Skeleton } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
@@ -42,7 +43,6 @@ import { useProject } from "../../state/project";
import { useTheme } from "../../state/theme";
import { Input } from "../../components/ui/input";
import { Select } from "../../components/ui/select";
-import { Skeleton } from "../../components/ui/skeleton";
import { TrendChart } from "./trend-chart";
import { RequestsChart, TokenBarChart, TokenLegend, type TokenLegendKey } from "./usage-charts";
import {
diff --git a/packages/web/src/features/workflows/workflow-tabs.tsx b/packages/web/src/features/workflows/workflow-tabs.tsx
index 1f952dfc..a3b16729 100644
--- a/packages/web/src/features/workflows/workflow-tabs.tsx
+++ b/packages/web/src/features/workflows/workflow-tabs.tsx
@@ -11,8 +11,8 @@
import { useCallback, useEffect, useRef, useState } from "react";
import { useNavigate } from "react-router";
import type { WorkflowInfo, WorkflowVersion } from "@prismshadow/penguin-server/api";
+import { Button } from "@prismshadow/penguin-ui";
import * as api from "../../api/endpoints";
-import { Button } from "../../components/ui/button";
import { formatDateTime } from "../../lib/format";
import { useShortcutLabel } from "../../lib/shortcuts/use-keymap";
import { S } from "../../lib/strings";
diff --git a/packages/web/src/lib/avatar.ts b/packages/web/src/lib/avatar.ts
deleted file mode 100644
index f43658bc..00000000
--- a/packages/web/src/lib/avatar.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Letter-avatar helpers shared by AgentAvatar and ProviderLogo's user-defined
- * groups: a deterministic tile color family hashed from a stable key (FNV-1a →
- * hue) plus the first user-perceived character of a display name.
- *
- * The color keys off an id rather than a name so it survives renames. The tile
- * is a light 14%-alpha tint (the same soft background the old pixel identicon
- * used) with the initial as colored ink rather than white-on-solid: hsl(h 55%
- * 28%) in light / hsl(h 55% 73%) in dark, lightness picked so the worst-case
- * hue keeps ≥ 4.5:1 (WCAG AA) contrast against the tinted tile on every app
- * surface — verified exhaustively over all 360 hues in test/avatar.test.ts.
- * Components apply the two inks via the --tile-fg / --tile-fg-dark custom
- * properties (theme toggled by html.dark).
- */
-
-/** FNV-1a 32-bit string hash (moved here from agent-avatar.tsx). */
-function hashStr(s: string): number {
- let h = 2166136261;
- for (let i = 0; i < s.length; i++) {
- h ^= s.charCodeAt(i);
- h = Math.imul(h, 16777619);
- }
- return h >>> 0;
-}
-
-/** Deterministic hue (0-359) for a stable key (agentId / provider id). */
-export function avatarHue(key: string): number {
- return hashStr(key) % 360;
-}
-
-/** Tile colors for a stable key: translucent tint background + per-theme initial inks. */
-export function avatarTile(key: string): { bg: string; fg: string; fgDark: string } {
- const h = avatarHue(key);
- return {
- bg: `hsl(${h} 55% 50% / 0.14)`,
- fg: `hsl(${h} 55% 28%)`,
- fgDark: `hsl(${h} 55% 73%)`,
- };
-}
-
-/** Grapheme segmenter (granularity is locale-independent); code-point fallback on very old engines. */
-const graphemes =
- typeof Intl !== "undefined" && typeof Intl.Segmenter === "function"
- ? new Intl.Segmenter(undefined, { granularity: "grapheme" })
- : undefined;
-
-function firstGrapheme(s: string): string | undefined {
- if (!s) return undefined;
- if (!graphemes) return Array.from(s)[0];
- for (const g of graphemes.segment(s)) return g.segment;
- return undefined;
-}
-
-/**
- * First user-perceived character of `text` — a full grapheme cluster, so CJK,
- * ZWJ emoji (👩‍💻) and flags (🇨🇦) stay whole — uppercased when it has a case;
- * empty/whitespace falls back to `fallback`'s initial, then "?".
- */
-export function avatarInitial(text: string, fallback?: string): string {
- const ch = firstGrapheme(text.trim()) ?? firstGrapheme((fallback ?? "").trim());
- return ch ? ch.toUpperCase() : "?";
-}
diff --git a/packages/web/src/lib/nav-icons.ts b/packages/web/src/lib/nav-icons.ts
new file mode 100644
index 00000000..efc4dbce
--- /dev/null
+++ b/packages/web/src/lib/nav-icons.ts
@@ -0,0 +1,37 @@
+/**
+ * Which registry glyph each page wears in navigation: the sidebar nav, the collapsed rail, company
+ * mode's page entries, and cross-page jump actions (the chat info dropdown's "view trace"). The
+ * drawings live in the shared registry, named for what they draw; which drawing stands for which
+ * page is the app's knowledge, so the map lives here.
+ */
+import { ICONS } from "@prismshadow/penguin-ui";
+
+export const NAV_ICONS = {
+ /** Agents: the robot head, the one glyph in the app that means "agent". */
+ agents: ICONS.robot,
+ /** Plugin library (the puzzle piece). */
+ plugins: ICONS.puzzle,
+ /** Model library (a chip). */
+ models: ICONS.chip,
+ /** Machines (two stacked server units). */
+ machines: ICONS.server,
+ usage: ICONS.barChart,
+ /** Trace observation (an open eye): watching what a run actually did. */
+ traces: ICONS.eye,
+ /** Benchmark center (a trophy). */
+ benchmark: ICONS.trophy,
+ /** Terminal (a `>_` prompt in a window frame). */
+ terminal: ICONS.terminalWindow,
+ /** Company mode's overview. */
+ orgOverview: ICONS.dashboard,
+ /** The org chart. */
+ orgChart: ICONS.network,
+ /** The organization calendar: the same calendar the sidebar's time grouping wears. */
+ orgCalendar: ICONS.calendar,
+ /** The ticket board. */
+ orgTickets: ICONS.kanban,
+ /** Finance. */
+ orgFinance: ICONS.dollarCircle,
+ /** The handbook, the company's knowledge base. */
+ orgHandbook: ICONS.bookOpen,
+} as const;
diff --git a/packages/web/src/lib/session-activity.ts b/packages/web/src/lib/session-activity.ts
index ce4ffedc..e772b0a1 100644
--- a/packages/web/src/lib/session-activity.ts
+++ b/packages/web/src/lib/session-activity.ts
@@ -1,6 +1,7 @@
import type { SessionInfo, SessionStatus } from "@prismshadow/penguin-server/api";
import { isSessionUnread } from "./session-seen";
import type { SessionSeenState } from "./session-seen";
+import { S } from "./strings";
/**
* Visual state carried by a Session row / chat header. Three states, and `null` for "say
@@ -40,6 +41,17 @@ export function sessionActivity(
return unread ? "completedUnread" : null;
}
+/**
+ * The state's words, for the activity glyph's accessible name and tooltip: the glyph carries no
+ * text of its own, so each state needs a different name. Read at render time — `S` is a live
+ * binding swapped per interface language.
+ */
+export function sessionActivityLabel(activity: Exclude<SessionActivity, null>): string {
+ if (activity === "running") return S.chat.statusRunning;
+ if (activity === "compacting") return S.chat.statusCompacting;
+ return S.chat.statusCompletedUnread;
+}
+
/**
* How many background tasks the Session still owns — command processes running past their
* yield window plus background subagents mid-round — or 0 when none. The server omits the
diff --git a/packages/web/src/lib/stat-icons.ts b/packages/web/src/lib/stat-icons.ts
index caeaf9d8..0f402cfc 100644
--- a/packages/web/src/lib/stat-icons.ts
+++ b/packages/web/src/lib/stat-icons.ts
@@ -1,34 +1,33 @@
/**
- * Stat icons (24×24 line paths): **shared as a single source** by the chat
+ * Stat icons: which registry glyph stands for each stat, shared as a single source by the chat
* page header, the chat page stats row, and the Trace page turn cards.
*
- * Arrows read by "where the tokens go": **up = input** (sent up to the
- * model), **down = output** (returned by the model). These paths used to be
- * duplicated across three components, making it easy to flip the direction
- * in only one place and leave the others wrong — so they're now consolidated
- * here as a single copy.
+ * Arrows read by "where the tokens go": **up = input** (sent up to the model), **down = output**
+ * (returned by the model). The three surfaces used to carry their own copies of these paths, which
+ * made it easy to flip the direction in one place and leave the others wrong — so the choice is
+ * made here once, and the drawings live in the shared registry.
*/
+import { ICONS } from "@prismshadow/penguin-ui";
+
export const STAT_ICONS = {
/** Input (arrow rising from the baseline: tokens sent up to the model) */
- input: "M12 15V5m0 0L8 9m4-4l4 4M4 19h16",
+ input: ICONS.arrowUpFromLine,
/** Output (arrow falling to the baseline: tokens returned by the model) */
- output: "M12 3v10m0 0l-4-4m4 4l4-4M4 19h16",
+ output: ICONS.arrowDownToLine,
/** Cache hit (bullseye: the portion of this turn's input that hit cache and didn't need recomputation) */
- cacheHit:
- "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-5a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-3a1 1 0 1 0 0-2 1 1 0 0 0 0 2z",
- /** Token total (stacked cylinders / database: session-level total, used only in the chat page header) */
- tokens:
- "M4 6c0-1.7 3.6-3 8-3s8 1.3 8 3-3.6 3-8 3-8-1.3-8-3zm0 0v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",
+ cacheHit: ICONS.target,
+ /** Token total (stacked cylinders: session-level total, used only in the chat page header) */
+ tokens: ICONS.database,
/** Tool calls (wrench) */
- toolCalls: "M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",
+ toolCalls: ICONS.wrench,
/** Output TPS (speedometer: half ring + needle) */
- tps: "M5 18a8 8 0 1 1 14 0M12 12l4-3",
+ tps: ICONS.gauge,
/** Elapsed time (clock) */
- elapsed: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",
+ elapsed: ICONS.clockCompact,
/** Cost (dollar sign in a circle) */
- cost: "M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",
+ cost: ICONS.coin,
/** Copy */
- copy: "M9 9h9v9a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V9zM7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1",
+ copy: ICONS.copy,
/** Copied (checkmark) */
- check: "M5 13l4 4L19 7",
+ check: ICONS.check,
} as const;
diff --git a/packages/web/src/lib/stop-reason-tone.ts b/packages/web/src/lib/stop-reason-tone.ts
new file mode 100644
index 00000000..dea58b8a
--- /dev/null
+++ b/packages/web/src/lib/stop-reason-tone.ts
@@ -0,0 +1,17 @@
+import type { ToneName } from "@prismshadow/penguin-ui";
+
+/**
+ * A Task's `stop_reason` as a badge tone. A completed run usually shows no badge at all; an
+ * aborted one is unfinished (attention), and anything else — failed, timed out, malformed — is a
+ * failure.
+ */
+export function stopReasonTone(stopReason: string): ToneName {
+ switch (stopReason) {
+ case "completed":
+ return "success";
+ case "aborted":
+ return "attention";
+ default:
+ return "danger";
+ }
+}
diff --git a/packages/web/src/lib/ui-strings.ts b/packages/web/src/lib/ui-strings.ts
new file mode 100644
index 00000000..a023d98e
--- /dev/null
+++ b/packages/web/src/lib/ui-strings.ts
@@ -0,0 +1,28 @@
+/**
+ * The shared UI package's accessibility fallbacks in the app's words. The package never reads the
+ * app's dictionaries; `LocaleProvider` hands it these instead, per interface language, so a close
+ * cross or a "Copied" announcement speaks the language the rest of the page does.
+ *
+ * Each value is read from the dictionary itself rather than from the live `S`, so the two objects
+ * are built once and keep their identity across renders.
+ */
+import type { UiStrings } from "@prismshadow/penguin-ui";
+import { zh } from "./strings";
+import type { Strings } from "./strings";
+import { en } from "./strings-en";
+
+/** One dictionary's words for every `UiStrings` key. */
+export function uiStringsOf(dict: Strings): UiStrings {
+ return {
+ close: dict.common.close,
+ copied: dict.common.copied,
+ loading: dict.common.loading,
+ };
+}
+
+const UI_STRINGS = { zh: uiStringsOf(zh), en: uiStringsOf(en) } as const;
+
+/** The package's words for an interface language. */
+export function uiStringsFor(locale: "zh" | "en"): UiStrings {
+ return UI_STRINGS[locale];
+}
diff --git a/packages/web/src/pages/login.tsx b/packages/web/src/pages/login.tsx
index 2eaaaee5..74793e90 100644
--- a/packages/web/src/pages/login.tsx
+++ b/packages/web/src/pages/login.tsx
@@ -10,6 +10,7 @@
*/
import { useEffect, useState } from "react";
import { useNavigate, useSearchParams } from "react-router";
+import { Button, PenguinLogo } from "@prismshadow/penguin-ui";
import { S } from "../lib/strings";
import { apiErrorText } from "../lib/api-error";
import { useDocumentTitle } from "../lib/use-document-title";
@@ -18,11 +19,9 @@ import { useLocale } from "../state/locale";
import type { LangPref } from "../state/locale";
import { useTheme } from "../state/theme";
import type { ThemeMode } from "../state/theme";
-import { Button } from "../components/ui/button";
import { Input } from "../components/ui/input";
import { PasswordInput } from "../components/ui/password-input";
import { Modal } from "../components/ui/modal";
-import { PenguinLogo } from "../components/ui/penguin-logo";
import { Segmented } from "../components/ui/segmented";
import { LoginCircuit } from "./login-circuit";
@@ -107,7 +106,7 @@ export function LoginPage() {
</div>
<div className="anim-rise relative w-full max-w-sm">
{/* Brand penguin logo (part of the form area, not background graphics, so it doesn't clash with the trace animation) */}
- <PenguinLogo className="mx-auto mb-3 h-16 w-16 rounded-2xl" />
+ <PenguinLogo src="/penguin-logo.svg" className="mx-auto mb-3 h-16 w-16 rounded-2xl" />
<h1 className="mb-6 text-center text-3xl font-semibold tracking-tight">{S.appName}</h1>
<div className="rounded-xl border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-800 dark:bg-gray-900">
diff --git a/packages/web/src/state/locale.tsx b/packages/web/src/state/locale.tsx
index 3f240525..bdcd8e20 100644
--- a/packages/web/src/state/locale.tsx
+++ b/packages/web/src/state/locale.tsx
@@ -2,12 +2,15 @@
* Language context: zh / en / system (tracks navigator.language, listens for languagechange).
* On switch, first synchronously calls setActiveStrings (assigned during render, idempotent),
* then remounts the whole tree keyed on locale so every `S.x` read immediately reflects the
- * new language; the preference persists to localStorage.
+ * new language; the preference persists to localStorage. The shared UI package's accessibility
+ * fallbacks (a close cross's name, a "Copied" announcement) are handed the same language here.
*/
import { createContext, useCallback, useContext, useEffect, useState } from "react";
import type { ReactNode } from "react";
+import { UiStringsProvider } from "@prismshadow/penguin-ui";
import { setActiveStrings, zh } from "../lib/strings";
import { en } from "../lib/strings-en";
+import { uiStringsFor } from "../lib/ui-strings";
export type LangPref = "zh" | "en" | "system";
export type Locale = "zh" | "en";
@@ -68,7 +71,9 @@ export function LocaleProvider({ children }: { children: ReactNode }) {
}, []);
return (
- <LocaleContext.Provider value={{ lang, locale, setLang }}>{children}</LocaleContext.Provider>
+ <LocaleContext.Provider value={{ lang, locale, setLang }}>
+ <UiStringsProvider strings={uiStringsFor(locale)}>{children}</UiStringsProvider>
+ </LocaleContext.Provider>
);
}
diff --git a/packages/web/src/styles.css b/packages/web/src/styles.css
index 5babbf75..ad0ee834 100644
--- a/packages/web/src/styles.css
+++ b/packages/web/src/styles.css
@@ -368,50 +368,6 @@
animation: title-scroll-reveal var(--title-scroll-ms, 0ms) linear 0.3s forwards;
}
-/* Busy hourglass (session-activity-icon.tsx: the running glyph). An hourglass does not spin —
- it gets turned over — so this holds the glyph still, flips it 180 degrees in ~360ms, holds
- again, and flips back. The long dwell is what makes it legible at the 12px the sidebar renders
- it at: a continuous spin at that size reads as a smudge, while two deliberate turns per cycle
- read as "still working" even out of the corner of the eye.
-
- `transform` is the only thing the keyframes touch and the at-rest glyph has none, so the
- global `animation: none !important` below is a free no-op here: the hourglass simply stands
- upright. Nothing needs a JS media query, and the glyph never disappears. */
-@keyframes hourglass-turn {
- 0%,
- 38% {
- transform: rotate(0deg);
- }
- 50%,
- 88% {
- transform: rotate(180deg);
- }
- 100% {
- transform: rotate(360deg);
- }
-}
-.hourglass-turn {
- animation: hourglass-turn 3s ease-in-out infinite;
-}
-
-/* Compacting squeeze (session-activity-icon.tsx: the compress glyph). Compaction pushes a
- context down to a summary, so its mark closes on its own centre bar and springs back rather
- than turning: the two live session states then differ by motion as well as by shape, which is
- what lets them share one tone. Same reduced-motion property as the hourglass — `transform`
- only, so disabling animation leaves the mark at full size and fully legible. */
-@keyframes compact-squeeze {
- 0%,
- 100% {
- transform: scaleY(1);
- }
- 50% {
- transform: scaleY(0.62);
- }
-}
-.compact-squeeze {
- animation: compact-squeeze 1.8s ease-in-out infinite;
-}
-
/* The built-in browser's agent-at-work frame (features/builtin-browser/browser-layer.tsx): an
inset ring over the page on screen while an agent acts in it, drawn in the busy tone's ink
through currentColor. It breathes by opacity from a resting state that IS the full ring, so
@@ -500,9 +456,9 @@
entirely by the `title-scroll-reveal` keyframes above — including the inline-block
that makes the text transformable at all — so `animation: none` leaves the title
exactly as it renders at rest, ellipsis and `title` tooltip included. */
- /* Nor do the two busy session glyphs (#291): their keyframes only rotate and scale, so
- disabling them leaves the hourglass upright and the compress mark at full height — both
- still present, just not moving. */
+ /* Nor do the two busy session glyphs (#291): their keyframes, in the UI package's theme.css,
+ only rotate and scale, so disabling them leaves the hourglass upright and the compress mark
+ at full height — both still present, just not moving. */
}
/* The stretch of the context panel's bar past the compaction threshold: hatched, so it reads as
diff --git a/packages/web/test/avatar.test.ts b/packages/web/test/avatar.test.ts
deleted file mode 100644
index d38e23b2..00000000
--- a/packages/web/test/avatar.test.ts
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * Letter-avatar helper unit tests: hue/tile determinism and spread across
- * names; initial extraction — grapheme based (CJK / ZWJ emoji / flags stay
- * whole), uppercasing, and the empty/whitespace → fallback → "?" chain; and
- * an exhaustive WCAG check that both theme inks keep ≥ 4.5:1 contrast against
- * the tinted tile over every app surface, for all 360 hues.
- */
-import { describe, expect, it } from "vitest";
-import { avatarHue, avatarInitial, avatarTile } from "../src/lib/avatar";
-
-describe("avatarHue / avatarTile", () => {
- it("is deterministic for the same key", () => {
- expect(avatarHue("my-provider")).toBe(avatarHue("my-provider"));
- expect(avatarTile("agent-1")).toEqual(avatarTile("agent-1"));
- });
-
- it("stays inside the 0-359 hue range", () => {
- for (const key of ["", "a", "my-provider", "深度求索", "🐧"]) {
- const hue = avatarHue(key);
- expect(Number.isInteger(hue)).toBe(true);
- expect(hue).toBeGreaterThanOrEqual(0);
- expect(hue).toBeLessThan(360);
- }
- });
-
- it("spreads distinct hues across realistic group names", () => {
- const names = ["my-llm", "local-vllm", "team-proxy", "backup"];
- expect(new Set(names.map(avatarHue)).size).toBe(names.length);
- });
-
- it("formats the tint background and the two theme inks from the key's hue", () => {
- const h = avatarHue("x");
- expect(avatarTile("x")).toEqual({
- bg: `hsl(${h} 55% 50% / 0.14)`,
- fg: `hsl(${h} 55% 28%)`,
- fgDark: `hsl(${h} 55% 73%)`,
- });
- });
-});
-
-describe("avatarInitial", () => {
- it("takes the first character, uppercased", () => {
- expect(avatarInitial("my-provider")).toBe("M");
- expect(avatarInitial("Zeta")).toBe("Z");
- });
-
- it("keeps case-less characters (CJK) as-is", () => {
- expect(avatarInitial("深度求索")).toBe("深");
- });
-
- it("treats a surrogate-pair character as one initial", () => {
- expect(avatarInitial("🐧 harness")).toBe("🐧");
- });
-
- it("keeps multi-code-point grapheme clusters whole (ZWJ emoji, flags)", () => {
- expect(avatarInitial("👩‍💻 dev tools")).toBe("👩‍💻");
- expect(avatarInitial("🇨🇦 north")).toBe("🇨🇦");
- });
-
- it("trims whitespace before picking the initial", () => {
- expect(avatarInitial(" agent")).toBe("A");
- });
-
- it("falls back to the fallback's initial, then ?", () => {
- expect(avatarInitial("", "agent-1")).toBe("A");
- expect(avatarInitial(" ", " x")).toBe("X");
- expect(avatarInitial("")).toBe("?");
- expect(avatarInitial(" ", " ")).toBe("?");
- });
-});
-
-// ---- WCAG contrast of the initial ink on the tinted tile (both themes, all hues) ----
-
-function hslToRgb(h: number, s: number, l: number): [number, number, number] {
- s /= 100;
- l /= 100;
- const c = (1 - Math.abs(2 * l - 1)) * s;
- const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
- const m = l - c / 2;
- const [r, g, b] =
- h < 60
- ? [c, x, 0]
- : h < 120
- ? [x, c, 0]
- : h < 180
- ? [0, c, x]
- : h < 240
- ? [0, x, c]
- : h < 300
- ? [x, 0, c]
- : [c, 0, x];
- return [r + m, g + m, b + m];
-}
-
-const lin = (c: number) => (c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4);
-const luminance = ([r, g, b]: [number, number, number]) =>
- 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b);
-
-function contrast(a: [number, number, number], b: [number, number, number]): number {
- const la = luminance(a);
- const lb = luminance(b);
- const [hi, lo] = la > lb ? [la, lb] : [lb, la];
- return (hi + 0.05) / (lo + 0.05);
-}
-
-/** The 14%-alpha tile tint composited over a surface (sRGB blend, like the browser). */
-function tileOver(h: number, surface: [number, number, number]): [number, number, number] {
- const tint = hslToRgb(h, 55, 50);
- return [0, 1, 2].map((i) => tint[i]! * 0.14 + surface[i]! * 0.86) as [number, number, number];
-}
-
-const hexRgb = (s: string) =>
- [1, 3, 5].map((i) => parseInt(s.slice(i, i + 2), 16) / 255) as [number, number, number];
-
-// App surfaces the tile sits on: light = white / gray-50 rows / gray-100 hover, which the
-// default theme bridges to Tailwind's zero-chroma neutral scale (penguin-ui themes/github.css);
-// dark = that theme's true-neutral overrides (gray-900/800/700).
-const LIGHT_SURFACES = ["#ffffff", "#fafafa", "#f5f5f5"].map(hexRgb);
-const DARK_SURFACES = ["#0d0d0d", "#1f1f1f", "#303030"].map(hexRgb);
-
-/** Saturation/lightness actually emitted by avatarTile (parsed so this test can't drift from the implementation). */
-function parseSL(color: string): [number, number] {
- const m = /^hsl\(\d+ (\d+)% (\d+)%\)$/.exec(color);
- expect(m, `unexpected ink format: ${color}`).toBeTruthy();
- return [Number(m![1]), Number(m![2])];
-}
-
-describe("avatarTile contrast (WCAG AA)", () => {
- it("keeps ≥ 4.5:1 for every hue: light ink on light surfaces, dark ink on dark surfaces", () => {
- const sample = avatarTile("x");
- const [fgS, fgL] = parseSL(sample.fg);
- const [fgDarkS, fgDarkL] = parseSL(sample.fgDark);
- for (let h = 0; h < 360; h++) {
- const fg = hslToRgb(h, fgS, fgL);
- const fgDark = hslToRgb(h, fgDarkS, fgDarkL);
- for (const surface of LIGHT_SURFACES) {
- expect(contrast(fg, tileOver(h, surface))).toBeGreaterThanOrEqual(4.5);
- }
- for (const surface of DARK_SURFACES) {
- expect(contrast(fgDark, tileOver(h, surface))).toBeGreaterThanOrEqual(4.5);
- }
- }
- });
-});
diff --git a/packages/web/test/clipboard.test.ts b/packages/web/test/clipboard.test.ts
index 6e68c2a2..64b54c7e 100644
--- a/packages/web/test/clipboard.test.ts
+++ b/packages/web/test/clipboard.test.ts
@@ -318,6 +318,12 @@ describe("clipboard writes go through one entry", () => {
expect(offenders(LIBRARY_IMPORT)).toEqual([]);
});
+ it("hands the entry to the shared UI package's copy controls, at the app root", () => {
+ const app = readFileSync(join(SRC, "app.tsx"), "utf8");
+ expect(app).toContain('import { writeClipboard } from "./lib/clipboard";');
+ expect(app).toContain("<ClipboardWriterProvider write={writeClipboard}>");
+ });
+
it("leaves reads alone: the terminal's mouse paste still reads the Clipboard API", () => {
const reads = sourceFiles(SRC).filter((file) =>
/navigator\s*\.\s*clipboard[\s\S]{0,40}?\.\s*readText\s*\(/.test(readFileSync(file, "utf8")),
diff --git a/packages/web/test/deslop.test.ts b/packages/web/test/deslop.test.ts
index 1ffa425f..37a2842a 100644
--- a/packages/web/test/deslop.test.ts
+++ b/packages/web/test/deslop.test.ts
@@ -32,11 +32,14 @@ import { expectEveryRootScanned, scanSources } from "./helpers/roots";
const SCAN = scanSources();
const WEB = SCAN.files.filter((file) => file.root === "web");
-/** The homes §3 names, as the web app spells them today. It has no Spinner of its own: W1 adds it. */
+/**
+ * The homes §3 names, as the web app spells them today. It has no Spinner of its own (the
+ * package's is the one), and the chevron's rotation left with the chevron.
+ */
const POLICY: DeslopPolicy = {
- transformMotion: ["chevron.tsx", "sheet.tsx", "drawer.tsx", "dock-launcher.tsx"],
+ transformMotion: ["sheet.tsx", "drawer.tsx", "dock-launcher.tsx"],
entranceMotion: [],
- pulseHomes: ["dot.tsx", "skeleton.tsx", "streaming-caret.tsx"],
+ pulseHomes: ["dot.tsx", "streaming-caret.tsx"],
spinnerHomes: [],
tokensOnly: false,
hexHomes: [],
@@ -67,21 +70,16 @@ const ALLOWLIST: DeslopAllowlist = {
13: [3, "W7"],
14: [2, "W7"],
},
- "components/ui/badge.tsx": { 13: [1, "W1"] },
"components/ui/confirm-modal.tsx": { 7: [1, "W3"] },
- "components/ui/copy-button.tsx": { 12: [2, "W1"] },
"components/ui/group-list.tsx": { 12: [1, "W4"], 13: [3, "W4"], 14: [2, "W4"] },
"components/ui/input.tsx": { 9: [1, "W2"] },
- "components/ui/kbd.tsx": { 13: [1, "W10"] },
"components/ui/option-menu.tsx": { 13: [1, "W2"] },
"components/ui/paged-dialog.tsx": { 13: [1, "W3"], 14: [2, "W3"] },
"components/ui/segmented.tsx": { 12: [2, "W2"] },
"components/ui/session-row-menu.tsx": { 1: [1, "W1b"] },
"components/ui/sheet.tsx": { 19: [1, "W3"] },
- "components/ui/status-icon.tsx": { 11: [2, "W1b"] },
"components/ui/switch.tsx": { 1: [1, "W2"] },
"components/ui/toast.tsx": { 9: [4, "W4"] },
- "components/ui/update-dot.tsx": { 13: [1, "W1"] },
"features/agents/agent-settings-page.tsx": { 12: [3, "W4"] },
"features/agents/hooks-tab.tsx": { 12: [1, "W4"], 13: [2, "W4"] },
"features/agents/mcp-servers-section.tsx": { 13: [3, "W4"] },
@@ -92,7 +90,7 @@ const ALLOWLIST: DeslopAllowlist = {
"features/ai-create/ai-create-panel.tsx": { 13: [1, "W4"] },
"features/benchmark/benchmark-case-browser.tsx": { 13: [2, "W4"] },
"features/benchmark/benchmark-detail.tsx": { 13: [2, "W4"] },
- "features/benchmark/benchmark-page.tsx": { 13: [2, "W4"], 18: [1, "W4"] },
+ "features/benchmark/benchmark-page.tsx": { 13: [1, "W4"], 18: [1, "W4"] },
"features/benchmark/create-benchmark-modal.tsx": { 13: [1, "W3"] },
"features/benchmark/evaluation-detail-modal.tsx": { 13: [2, "W3"] },
"features/builtin-browser/browser-tab-strip.tsx": { 11: [2, "W10"], 12: [2, "W10"] },
diff --git a/packages/web/test/group-list.test.ts b/packages/web/test/group-list.test.ts
index 6cc266a2..d5aab2fa 100644
--- a/packages/web/test/group-list.test.ts
+++ b/packages/web/test/group-list.test.ts
@@ -14,13 +14,9 @@
* wearing one icon in the toggle and another in the menu.
*/
import { describe, expect, it } from "vitest";
+import { ICONS } from "@prismshadow/penguin-ui";
import {
- AGENT_GROUP_ICON,
- CALENDAR_ICON,
- CLOCK_ICON,
- FOLDER_ICON,
GROUP_MODE_ICONS,
- REORDER_ICON,
SORT_MODE_ICONS,
newEntityForGroupMode,
} from "../src/components/ui/group-list";
@@ -54,14 +50,14 @@ describe("list-options glyphs", () => {
it("names each grouping mode by what the list is grouped into", () => {
// The same glyphs the header's grouping toggle shows, so the two surfaces agree.
expect(GROUP_MODE_ICONS).toEqual({
- workspace: FOLDER_ICON,
- agent: AGENT_GROUP_ICON,
- time: CALENDAR_ICON,
+ workspace: ICONS.folder,
+ agent: ICONS.robot,
+ time: ICONS.calendar,
});
});
it("names each sort mode by what decides the order: a clock, and the reorder arrows", () => {
- expect(SORT_MODE_ICONS).toEqual({ recent: CLOCK_ICON, manual: REORDER_ICON });
+ expect(SORT_MODE_ICONS).toEqual({ recent: ICONS.clock, manual: ICONS.arrowUpDown });
});
it("is what the list-options menu actually renders", () => {
diff --git a/packages/web/test/icon-registry.test.ts b/packages/web/test/icon-registry.test.ts
new file mode 100644
index 00000000..df3366f7
--- /dev/null
+++ b/packages/web/test/icon-registry.test.ts
@@ -0,0 +1,184 @@
+/**
+ * One registry of line glyphs: `ICONS` in the shared UI package, and the app's manifests built on
+ * it (`NAV_ICONS`, `STAT_ICONS`, the grouping and sort options).
+ *
+ * A path typed out in a feature file is how one bin came to be drawn five ways and a redraw came to
+ * reach one surface and not the others. So new glyphs go into the registry, named for what they
+ * draw, and a feature file reads them from there. What feature files still hold is listed below per
+ * file, with the wave that moves or rebuilds the file (`W1b+W4` splits an entry between two);
+ * `W10` is the follow-up sweep of the code that landed on main while the waves were in flight.
+ * `W1b` marks a near-copy of a registry glyph that differs from it by a grid unit or more — the
+ * tapered bin, the feather and lucide pencils — and stays until someone decides to redraw it onto
+ * the registry's. The counts are exact both ways, like the de-slop list: a new path fails as new,
+ * and one that goes away fails until its entry shrinks, so the list only tightens.
+ *
+ * Two shapes are counted: a `const *_ICON` whose value is path data, and a literal `d="M…"` on an
+ * element. A computed path (a chart's line, a sparkline, the topology view's edges) is not a
+ * literal and is not read.
+ */
+import ts from "typescript";
+import { describe, expect, it } from "vitest";
+import { expectEveryRootScanned, scanSources } from "./helpers/roots";
+
+const SCAN = scanSources([".ts", ".tsx"]);
+const WEB = SCAN.files.filter((file) => file.root === "web");
+
+/** Glyph paths outside the registry, by path under `packages/web/src`: `[count, wave]`. */
+const ALLOWLIST: Readonly<Record<string, readonly [number, string]>> = {
+ "components/layout/app-layout.tsx": [3, "W7"],
+ "components/layout/sidebar.tsx": [6, "W7"],
+ "components/ui/info-popover.tsx": [1, "W3"],
+ "features/agents/memory-tab.tsx": [2, "W1b"],
+ "features/agents/skills-tab.tsx": [1, "W1b"],
+ "features/benchmark/benchmark-page.tsx": [1, "W1b"],
+ "features/chat/attached-files-banner.tsx": [1, "W6"],
+ "features/chat/chat-input.tsx": [5, "W6"],
+ "features/chat/conversation-outline.tsx": [1, "W6"],
+ "features/chat/goal-use.ts": [1, "W6"],
+ "features/chat/memory-view.tsx": [4, "W6"],
+ "features/chat/message-item.tsx": [1, "W6"],
+ "features/chat/message-stream.tsx": [1, "W6"],
+ "features/chat/subagents-view.tsx": [1, "W6"],
+ "features/chat/task-stats-line.tsx": [1, "W6"],
+ "features/chat/workspace-browser.tsx": [1, "W7"],
+ "features/chat/workspace-finder.tsx": [11, "W10"],
+ "features/company/channel-header.tsx": [4, "W6"],
+ "features/company/channel-sidebar.tsx": [2, "W4"],
+ "features/company/channel-view.tsx": [1, "W6"],
+ "features/company/finance-page.tsx": [2, "W1b+W4"],
+ "features/company/handbook-explorer.tsx": [1, "W4"],
+ "features/company/shared.tsx": [2, "W4"],
+ "features/dock/dock-panel.tsx": [3, "W7+W10"],
+ "features/models/models-page.tsx": [5, "W1b+W4"],
+ "features/plugins/plugins-page.tsx": [2, "W4"],
+ "features/schedules/schedule-panel.tsx": [3, "W4"],
+ "features/schedules/schedule-suggestions.tsx": [3, "W4"],
+ "features/semantic-id/semantic-id-field.tsx": [1, "W2"],
+ "features/settings/shortcuts-section.tsx": [1, "W10"],
+ "features/terminal/terminal-keybar.tsx": [3, "W10"],
+ "features/traces/trace-event-row.tsx": [1, "W4"],
+};
+
+/** SVG path data: a moveto, then only path commands, numbers and separators. */
+const PATH_DATA = /^[Mm][\d\s.,eE+\-MmZzLlHhVvCcSsQqTtAa]*$/;
+
+/** A string-valued expression's literal text (a template's pieces around its holes), or null. */
+function stringText(node: ts.Expression): string | null {
+ let expr = node;
+ while (
+ ts.isAsExpression(expr) ||
+ ts.isSatisfiesExpression(expr) ||
+ ts.isParenthesizedExpression(expr)
+ ) {
+ expr = expr.expression;
+ }
+ if (ts.isStringLiteral(expr) || ts.isNoSubstitutionTemplateLiteral(expr)) return expr.text;
+ if (ts.isTemplateExpression(expr)) {
+ return expr.head.text + expr.templateSpans.map((span) => span.literal.text).join("");
+ }
+ return null;
+}
+
+/** Every glyph path a source spells out, as "line: what". */
+function glyphHits(path: string, text: string): string[] {
+ const source = ts.createSourceFile(
+ path,
+ text,
+ ts.ScriptTarget.Latest,
+ true,
+ path.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS,
+ );
+ const at = (node: ts.Node) =>
+ source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1;
+ const hits: string[] = [];
+ const visit = (node: ts.Node): void => {
+ if (
+ ts.isVariableDeclaration(node) &&
+ ts.isIdentifier(node.name) &&
+ /_ICON$/.test(node.name.text) &&
+ node.initializer !== undefined
+ ) {
+ const value = stringText(node.initializer);
+ if (value !== null && PATH_DATA.test(value.trim()))
+ hits.push(`${at(node)}: ${node.name.text}`);
+ } else if (
+ ts.isJsxAttribute(node) &&
+ node.name.getText(source) === "d" &&
+ node.initializer !== undefined
+ ) {
+ const init = node.initializer;
+ const value = ts.isStringLiteral(init)
+ ? init.text
+ : ts.isJsxExpression(init) && init.expression !== undefined
+ ? stringText(init.expression)
+ : null;
+ if (value !== null && PATH_DATA.test(value.trim())) hits.push(`${at(node)}: d="${value}"`);
+ }
+ ts.forEachChild(node, visit);
+ };
+ visit(source);
+ return hits;
+}
+
+describe("glyph paths outside the registry", () => {
+ it("scans every source root", () => {
+ expectEveryRootScanned(SCAN);
+ expect(WEB.length).toBeGreaterThan(0);
+ });
+
+ it("are the listed ones, at the listed counts", () => {
+ const found = new Map(
+ WEB.map((file) => [file.rel, glyphHits(file.path, file.text)] as const).filter(
+ ([, hits]) => hits.length > 0,
+ ),
+ );
+ const problems: string[] = [];
+ for (const rel of new Set([...found.keys(), ...Object.keys(ALLOWLIST)])) {
+ const hits = found.get(rel) ?? [];
+ const [allowed, wave] = ALLOWLIST[rel] ?? [0, ""];
+ if (hits.length > allowed) {
+ problems.push(
+ `${rel}: ${hits.length} where ${allowed} are allowlisted — draw it from ICONS\n ${hits.join("\n ")}`,
+ );
+ } else if (hits.length < allowed) {
+ problems.push(
+ hits.length === 0
+ ? `${rel}: none left of ${allowed} (${wave}) — delete the entry`
+ : `${rel}: ${hits.length} left of ${allowed} — shrink the entry to [${hits.length}, "${wave}"]`,
+ );
+ }
+ }
+ expect(
+ problems,
+ "A glyph belongs in the shared registry (ICONS), named for what it draws.",
+ ).toEqual([]);
+ });
+
+ it("recognizes each shape — the check is exercised on known sources", () => {
+ expect(
+ glyphHits(
+ "probe.tsx",
+ [
+ 'const TRASH_ICON = "M4 6h16M9 6V4";',
+ "const EYE_ICON = `${OUTLINE}M3 3l18 18`;",
+ 'export const Mark = () => <svg><path d="M12 5v14M5 12h14" /></svg>;',
+ "export const Wrapped = () => <path d={'M9 5l7 7-7 7'} />;",
+ ].join("\n"),
+ ),
+ ).toEqual(["1: TRASH_ICON", "2: EYE_ICON", '3: d="M12 5v14M5 12h14"', '4: d="M9 5l7 7-7 7"']);
+ // A registry read, a computed path, a label that happens to start with M, and a non-glyph
+ // constant are all fine.
+ expect(
+ glyphHits(
+ "probe.tsx",
+ [
+ 'import { ICONS } from "@prismshadow/penguin-ui";',
+ "const TRASH_ICON = ICONS.trash;",
+ "export const Line = ({ d }: { d: string }) => <path d={d} />;",
+ 'const MENU_ICON = "Menu";',
+ 'const PATH = "M0 0h1";',
+ ].join("\n"),
+ ),
+ ).toEqual([]);
+ });
+});
diff --git a/packages/web/test/icon-scale.test.ts b/packages/web/test/icon-scale.test.ts
index 131e09c4..67ae031d 100644
--- a/packages/web/test/icon-scale.test.ts
+++ b/packages/web/test/icon-scale.test.ts
@@ -1,17 +1,18 @@
/**
- * The icon family (src/lib/icon-scale.ts and the renderers in components/ui).
+ * The icon family as the app uses it: the role-named scale, the registry and the renderers, all in
+ * the shared UI package (`icon-scale.ts`, `components/icons/…`).
*
* These are source scans rather than render assertions, because the thing that decays is not any
* one component's output — it is a new inline `<svg>` re-drawing a glyph the app already owns, at
* a stroke weight nobody chose. The three paths asserted below each used to exist in five or six
* hand-typed copies.
*
- * The scans cover the web app and the shared UI package (test/helpers/roots.ts): a glyph that moves
+ * The scans cover the web app and the shared UI package (test/helpers/roots.ts): a glyph that moved
* into the package keeps its one home, and a copy re-typed on either side is still a second copy.
*/
import { existsSync, readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
-import { ICON_SIZE, ICON_GAP } from "../src/lib/icon-scale";
+import { ICON_GAP, ICON_SIZE } from "@prismshadow/penguin-ui";
import { DEFAULT_THEME_ID, THEME_IDS, THEME_MODES } from "../../ui/src/tokens";
import { analyzeThemeFile, resolveThemeValue } from "../../ui/src/testing/theme-tokens";
import { expectEveryRootScanned, expectSingleHome, scanSources, sourceFile } from "./helpers/roots";
@@ -28,14 +29,17 @@ const FILES = SCAN.files
const occurrences = (needle: string) =>
FILES.filter(([, src]) => src.includes(needle)).map(([id]) => id);
-const ICONS = "packages/web/src/components/ui/icons.tsx";
-const CHEVRON = "packages/web/src/components/ui/chevron.tsx";
-const GLYPH_ICON = "packages/web/src/components/ui/glyph-icon.tsx";
+const REGISTRY = "packages/ui/src/components/icons/icons.ts";
+const MARKS = "packages/ui/src/components/icons/marks/marks.tsx";
+const CHEVRON = "packages/ui/src/components/icons/chevron/chevron.tsx";
+const GLYPH_ICON = "packages/ui/src/components/icons/glyph-icon/glyph-icon.tsx";
+const SCALE = "packages/ui/src/icon-scale.ts";
describe("icon scale", () => {
it("scans every source root, and finds the icon modules in one place each", () => {
expectEveryRootScanned(SCAN);
- for (const id of [ICONS, CHEVRON, GLYPH_ICON, "packages/web/src/lib/icon-scale.ts"]) {
+ // The marks file is left out: the chart primitives' `marks.tsx` shares its name.
+ for (const id of [REGISTRY, CHEVRON, GLYPH_ICON, SCALE]) {
expectSingleHome(SCAN, id);
}
});
@@ -55,11 +59,11 @@ describe("icon scale", () => {
describe("one glyph, one home", () => {
it("draws the form-control caret in exactly one place", () => {
- expect(occurrences("M3 4.5l3 3 3-3")).toEqual([ICONS]);
+ expect(occurrences("M3 4.5l3 3 3-3")).toEqual([MARKS]);
});
it("draws the close cross in exactly one place", () => {
- expect(occurrences("M2 2l10 10M12 2L2 12")).toEqual([ICONS]);
+ expect(occurrences("M2 2l10 10M12 2L2 12")).toEqual([MARKS]);
});
it("draws the collapse chevron in exactly one place", () => {
@@ -70,24 +74,24 @@ describe("one glyph, one home", () => {
// buttons and the dock header's move-dock buttons — which is exactly how the marks above
// accumulated their copies.
it("draws the bottom-dock mark in exactly one place", () => {
- expect(occurrences("M4 5h16v14H4zM4 14h16")).toEqual([ICONS]);
+ expect(occurrences("M4 5h16v14H4zM4 14h16")).toEqual([REGISTRY]);
});
it("draws the right-dock mark in exactly one place", () => {
- expect(occurrences("M4 5h16v14H4zM14 5v14")).toEqual([ICONS]);
+ expect(occurrences("M4 5h16v14H4zM14 5v14")).toEqual([REGISTRY]);
});
it("draws the memory brain in exactly one place", () => {
// The Memory mark was hand-typed three times — the dock's panel table, the memory-changes
// card and the agent card's memory count — so a redraw moved one surface and left the others
// on the old picture.
- expect(occurrences("M5.15 8.05C5.05 9.75")).toEqual([ICONS]);
+ expect(occurrences("M5.15 8.05C5.05 9.75")).toEqual([REGISTRY]);
});
it("draws the background-task trace in exactly one place", () => {
// Three surfaces draw it now — a session row, the chat header pill and a backgrounded
// tool row — which is how the paths above ended up hand-typed five times each.
- expect(occurrences("M2 12h4l3 9 6-18 3 9h4")).toEqual([ICONS]);
+ expect(occurrences("M2 12h4l3 9 6-18 3 9h4")).toEqual([REGISTRY]);
});
});
diff --git a/packages/web/test/memory-changes-card.test.ts b/packages/web/test/memory-changes-card.test.ts
index e7483814..904cf2a6 100644
--- a/packages/web/test/memory-changes-card.test.ts
+++ b/packages/web/test/memory-changes-card.test.ts
@@ -9,8 +9,8 @@
import { afterEach, describe, expect, it } from "vitest";
import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
+import { ICONS } from "@prismshadow/penguin-ui";
import { MemoryChangesCard } from "../src/features/chat/memory-changes-card";
-import { MEMORY_ICON } from "../src/components/ui/icons";
import type { MemoryChangeRow } from "../src/lib/omni/memory-changes";
import { S, setActiveStrings, zh } from "../src/lib/strings";
import { en } from "../src/lib/strings-en";
@@ -30,7 +30,7 @@ const render = (onOpenPanel?: () => void) =>
);
/** How many times the brain mark is drawn in the markup. */
-const memoryMarks = (html: string) => html.split(`d="${MEMORY_ICON}"`).length - 1;
+const memoryMarks = (html: string) => html.split(`d="${ICONS.brain}"`).length - 1;
afterEach(() => {
setActiveStrings(zh);
diff --git a/packages/web/test/nav-group-collapse.test.ts b/packages/web/test/nav-group-collapse.test.ts
index 2eb3ee14..89c0f0cf 100644
--- a/packages/web/test/nav-group-collapse.test.ts
+++ b/packages/web/test/nav-group-collapse.test.ts
@@ -20,7 +20,7 @@ import {
visibleNavKeys,
} from "../src/lib/nav-group-collapse";
import type { NavCollapseStorage } from "../src/lib/nav-group-collapse";
-import { NAV_ICONS } from "../src/components/ui/icons";
+import { NAV_ICONS } from "../src/lib/nav-icons";
import { zh } from "../src/lib/strings";
import { en } from "../src/lib/strings-en";
diff --git a/packages/web/test/pages.test.ts b/packages/web/test/pages.test.ts
index 61dd8d80..f27a9ec1 100644
--- a/packages/web/test/pages.test.ts
+++ b/packages/web/test/pages.test.ts
@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
import { NAV_PAGE_KEYS, PAGES, mergePages, navPagesFor } from "../src/lib/pages";
import { NAV_GROUP_KEYS } from "../src/lib/nav-group-collapse";
import { zh } from "../src/lib/strings";
-import { NAV_ICONS } from "../src/components/ui/icons";
+import { NAV_ICONS } from "../src/lib/nav-icons";
describe("the page manifest", () => {
it("names only keys the nav strings and icons are typed for", () => {
diff --git a/packages/web/test/session-activity.test.ts b/packages/web/test/session-activity.test.ts
index b0576562..f31dee79 100644
--- a/packages/web/test/session-activity.test.ts
+++ b/packages/web/test/session-activity.test.ts
@@ -1,19 +1,14 @@
import { describe, expect, it } from "vitest";
import { createElement } from "react";
import { renderToStaticMarkup } from "react-dom/server";
-import { sessionActivity, sessionBackgroundTasks } from "../src/lib/session-activity";
-import type { SessionActivity } from "../src/lib/session-activity";
+import { ActivityIcon, ICON_SIZE } from "@prismshadow/penguin-ui";
import {
- ACTIVITY_GLYPH,
- BackgroundTasksMark,
- ScheduleMark,
- SessionActivityIcon,
+ sessionActivity,
sessionActivityLabel,
-} from "../src/components/ui/session-activity-icon";
-import { BACKGROUND_TASKS_ICON, SCHEDULE_ICON } from "../src/components/ui/icons";
-import { ICON_SIZE } from "../src/lib/icon-scale";
+ sessionBackgroundTasks,
+} from "../src/lib/session-activity";
+import type { SessionActivity } from "../src/lib/session-activity";
import { S } from "../src/lib/strings";
-import { toneInk } from "../src/lib/tone";
import { expectEveryRootScanned, expectSingleHome, scanSources, sourceFile } from "./helpers/roots";
const SCAN = scanSources();
@@ -21,11 +16,12 @@ const SCAN = scanSources();
describe("the activity marks' sources", () => {
it("scan every source root, and find the icon module in one place", () => {
expectEveryRootScanned(SCAN);
- expectSingleHome(SCAN, "packages/web/src/components/ui/session-activity-icon.tsx");
+ expectSingleHome(SCAN, "packages/ui/src/components/icons/activity-icon/activity-icon.tsx");
});
});
type Activity = Exclude<SessionActivity, null>;
+const ACTIVITIES: readonly Activity[] = ["running", "compacting", "completedUnread"];
describe("sessionActivity", () => {
it("reports a live run whatever the read state, compaction included", () => {
@@ -73,188 +69,50 @@ describe("sessionBackgroundTasks", () => {
});
/**
- * The background-task mark: one glyph in the `busy` tone, standing for a count in both of
- * its placements — a session row and the chat header. Rendered only when there is background
- * work to report (the caller's decision), and always naming what it means in the accessible
- * name and tooltip, so the glyph is never the only carrier. A tool row says the same thing in
- * words instead (S.chat.backgroundCall, covered by tool-call-preview.test.ts), because there
- * it marks one call rather than a count.
- */
-describe("BackgroundTasksMark", () => {
- const render = (label: string, size: number) =>
- renderToStaticMarkup(createElement(BackgroundTasksMark, { label, size }));
-
- it("names the count where it stands for a count", () => {
- const markup = render(S.chat.backgroundTasks(3), ICON_SIZE.rowMark);
- expect(markup).toContain(`aria-label="${S.chat.backgroundTasks(3)}"`);
- expect(markup).toContain(`data-tooltip="${S.chat.backgroundTasks(3)}"`);
- expect(markup).toContain('role="img"');
- expect(S.chat.backgroundTasks(3)).toContain("3");
- });
-
- it("draws the activity trace in the busy emerald, at the rung its caller passes", () => {
- expect(render(S.chat.backgroundTasks(1), ICON_SIZE.rowMark)).toMatch(/width="12"/);
- expect(render(S.chat.backgroundTasks(1), ICON_SIZE.inlineGlyph)).toMatch(/width="13"/);
- const markup = render(S.chat.backgroundTasks(1), ICON_SIZE.rowMark);
- expect(markup).toContain(`d="${BACKGROUND_TASKS_ICON}"`);
- // Work still running, only outside the turn: the mark takes the live tone rather than
- // receding with the pin and the relay glyph.
- expect(markup).toContain(toneInk.busy);
- expect(markup).not.toContain(toneInk.muted);
- // A facet beside the row's activity state rather than a fourth state of it: it takes the
- // live tone but neither the activity glyphs nor their motion.
- expect(markup).not.toContain(ACTIVITY_GLYPH.running);
- expect(markup).not.toContain("hourglass-turn");
- });
-});
-
-describe("ScheduleMark", () => {
- const markup = () =>
- renderToStaticMarkup(createElement(ScheduleMark, { size: ICON_SIZE.rowMark }));
-
- it("recedes with the row's other standing marks instead of reading as live work", () => {
- // A scheduled task is an arrangement, not something happening now: it takes the `muted` ink
- // the pin and the messaging-relay glyph wear, and neither the busy nor the attention tone
- // that the hourglass and the pending-approval badge own.
- expect(markup()).toContain(toneInk.muted);
- expect(markup()).not.toContain(toneInk.attention);
- expect(markup()).not.toContain(toneInk.busy);
- // Muted is the one tone allowed under 3:1, and only where the meaning is already in text.
- expect(markup()).toContain(`aria-label="${S.chat.sessionScheduled}"`);
- expect(markup()).toContain(`data-tooltip="${S.chat.sessionScheduled}"`);
- expect(markup()).toContain(`d="${SCHEDULE_ICON}"`);
- });
-});
-
-/**
- * Icon rendering contract, via react-dom/server static markup (node env, no DOM).
- *
- * Two shapes carry the two situations that differ in KIND — busy vs settled. Within each, the
- * remaining distinction is a colour, which is exactly why every glyph is also required below to
- * name its precise state in its accessible name and tooltip: the colour is never the only way
- * to find out what a row is doing.
+ * The glyph carries no text, so the app's words are its only name: each state gets its own, and
+ * every place the app draws a mark hands it one. The marks' own drawing is the UI package's
+ * (`packages/ui/test/activity-icon.test.ts`); what is checked here is that the app supplies the
+ * words and the room the marks need.
*/
-describe("SessionActivityIcon", () => {
- const ACTIVITIES: readonly Activity[] = ["running", "compacting", "completedUnread"];
-
- const render = (activity: Activity) =>
- renderToStaticMarkup(createElement(SessionActivityIcon, { activity }));
-
- it("draws a different shape for each busy state", () => {
- // Running and compacting share one tone, so the shape is what separates them: with the same
- // path they would be one glyph in two states nobody can tell apart.
- expect(ACTIVITY_GLYPH.compacting).not.toBe(ACTIVITY_GLYPH.running);
- for (const activity of ["running", "compacting"] as const) {
- expect(render(activity)).toContain(`d="${ACTIVITY_GLYPH[activity]}"`);
- }
- });
-
- it("draws the unread state as a dot, not as a path glyph", () => {
- const unread = render("completedUnread");
- expect(unread).toContain("rounded-full");
- expect(unread).not.toContain("<svg");
- expect(unread).not.toContain(ACTIVITY_GLYPH.running);
- });
-
- it("labels each state distinctly for screen readers and hover", () => {
+describe("the app's words for the activity marks", () => {
+ it("labels each state distinctly, in the interface language", () => {
expect(sessionActivityLabel("running")).toBe(S.chat.statusRunning);
expect(sessionActivityLabel("compacting")).toBe(S.chat.statusCompacting);
expect(sessionActivityLabel("completedUnread")).toBe(S.chat.statusCompletedUnread);
- // Three states, three different names: the on-screen marks carry no text, so nothing may be
- // distinguishable by shape or colour alone to a screen reader.
expect(new Set(ACTIVITIES.map(sessionActivityLabel)).size).toBe(ACTIVITIES.length);
- for (const activity of ACTIVITIES) {
- expect(render(activity)).toContain(`aria-label="${sessionActivityLabel(activity)}"`);
- }
});
- it("gives every mark the shared hover tooltip", () => {
- for (const activity of ["running", "compacting"] as const) {
- expect(render(activity)).toContain(`data-tooltip="${sessionActivityLabel(activity)}"`);
- }
- // The dot is an HTML span, so its tooltip is the shared one, read from data-tooltip.
- expect(render("completedUnread")).toContain(
- `data-tooltip="${sessionActivityLabel("completedUnread")}"`,
- );
- });
-
- it("announces busy states as status and the unread dot as an image", () => {
- expect(render("running")).toContain('role="status"');
- expect(render("compacting")).toContain('role="status"');
- expect(render("completedUnread")).toContain('role="img"');
- });
-
- it("gives each busy state its own motion and leaves the dot still", () => {
- expect(render("running")).toContain("hourglass-turn");
- expect(render("compacting")).toContain("compact-squeeze");
- expect(render("compacting")).not.toContain("hourglass-turn");
- const unread = render("completedUnread");
- expect(unread).not.toContain("hourglass-turn");
- expect(unread).not.toContain("compact-squeeze");
- });
-
- it("inks both busy states with the shared attention tone", () => {
- // Unfinished work waiting on time is one meaning, so it is one colour app-wide; the split
- // between running and compacting is carried by shape and motion, asserted above.
- for (const activity of ["running", "compacting"] as const) {
- expect(render(activity)).toContain(toneInk.attention);
- }
+ it("names the background count where it stands for a count", () => {
+ expect(S.chat.backgroundTasks(3)).toContain("3");
});
- it("draws the dot in the Session status dot's own emerald and geometry", () => {
- // Same green and same 6px as the dot this replaces, at both surfaces: `h-1.5 w-1.5
- // rounded-full bg-emerald-500`, one tone in both themes, no per-theme override.
- const unread = render("completedUnread");
- expect(unread).toContain("bg-emerald-500");
- expect(unread).not.toMatch(/dark:bg-emerald-/);
- expect(unread).toContain("h-1.5 w-1.5");
- expect(unread).toContain("rounded-full");
- // The reservation must never inflate the mark: no larger dot sneaking back in.
- expect(unread).not.toMatch(/\bh-2 w-2\b/);
+ it("hands every mark its label wherever the app draws one", () => {
+ const sidebar = sourceFile(SCAN, "packages/web/src/components/layout/sidebar.tsx").text;
+ expect(sidebar).toMatch(
+ /<ActivityIcon activity=\{activity\} label=\{sessionActivityLabel\(activity\)\}/,
+ );
+ expect(sidebar).toMatch(/<ScheduleMark label=\{S\.chat\.sessionScheduled\}/);
+ expect(sidebar).toMatch(
+ /<BackgroundTasksMark\s+label=\{S\.chat\.backgroundTasks\(background\)\}/,
+ );
+ const desks = sourceFile(SCAN, "packages/web/src/features/company/org-session-groups.tsx").text;
+ expect(desks).toMatch(
+ /<ActivityIcon activity=\{activity\} label=\{sessionActivityLabel\(activity\)\}/,
+ );
});
- it("occupies the same box whatever the glyph, so a row never shifts", () => {
- // Every glyph renders into the same 12px box, and the sidebar reserves that same box when
+ it("reserves the glyph's box on a row with no glyph, so a row never shifts", () => {
+ // Every glyph renders into the same row-mark box, and the sidebar reserves that box when
// there is no glyph at all — otherwise the title would re-flow as a run starts, finishes and
- // is read. The 6px dot is CENTRED in that box rather than sized to it: the box is the
- // reservation, the dot is the mark.
+ // is read. The placeholder is read from the sidebar itself so the two cannot drift apart.
+ expect(ICON_SIZE.rowMark).toBe(12);
for (const activity of ACTIVITIES) {
- const markup = render(activity);
- expect(markup).toMatch(/(width="12"|width:12px)/);
- expect(markup).toMatch(/(height="12"|height:12px)/);
+ const markup = renderToStaticMarkup(
+ createElement(ActivityIcon, { activity, label: sessionActivityLabel(activity) }),
+ );
+ expect(markup).toContain("width:12px;height:12px");
}
- // The empty state's placeholder, read from the sidebar itself so it cannot drift apart.
const sidebar = sourceFile(SCAN, "packages/web/src/components/layout/sidebar.tsx").text;
expect(sidebar).toMatch(/activity === null.*\n?.*className="block h-3 w-3 shrink-0"/);
});
});
-
-/**
- * The turning hourglass must degrade to a still, VISIBLE hourglass under reduced motion. The
- * global rule kills `animation` outright, so the guarantee is that the keyframes only ever
- * rotate — no opacity, no display, nothing whose absence would blank the glyph (the login
- * traces in the same stylesheet need an explicit override for exactly that reason).
- */
-describe("hourglass-turn reduced motion", () => {
- // Every stylesheet under the scanned roots, so the keyframes are found wherever they move.
- const css = SCAN.files
- .filter((file) => file.name.endsWith(".css"))
- .map((file) => file.text)
- .join("\n");
-
- it("is an animation, so the global reduced-motion rule disables it", () => {
- expect(css).toMatch(/\.hourglass-turn\s*\{[^}]*animation:\s*hourglass-turn/);
- expect(css).toMatch(
- /@media\s*\(prefers-reduced-motion:\s*reduce\)\s*\{[\s\S]*?animation:\s*none\s*!important/,
- );
- });
-
- it("only rotates, so disabling it leaves the glyph upright rather than invisible", () => {
- const block = /@keyframes hourglass-turn\s*\{([\s\S]*?)\n\}/.exec(css);
- const body = block?.[1] ?? "";
- expect(body).not.toBe("");
- const declarations = [...body.matchAll(/([a-z-]+)\s*:/g)].map((m) => m[1]);
- expect(new Set(declarations)).toEqual(new Set(["transform"]));
- expect(body).toMatch(/rotate\(180deg\)/); // A turn, not a spin.
- });
-});
diff --git a/packages/web/test/session-row-menu.test.ts b/packages/web/test/session-row-menu.test.ts
index 613b9eb3..dd764860 100644
--- a/packages/web/test/session-row-menu.test.ts
+++ b/packages/web/test/session-row-menu.test.ts
@@ -15,18 +15,13 @@
* (title-reveal.test.ts convention).
*/
import { afterEach, describe, expect, it } from "vitest";
+import { ICONS } from "@prismshadow/penguin-ui";
import {
- ARCHIVE_ICON,
HOVER_ROW_ACTIONS,
- PENCIL_ICON,
- PIN_ICON,
- TRASH_ICON,
- UNARCHIVE_ICON,
contextMenuActions,
sessionRowMenuItem,
} from "../src/components/ui/session-row-menu";
import type { SessionRowAction } from "../src/components/ui/session-row-menu";
-import { MESSAGING_RELAY_ICON } from "../src/components/ui/icons";
import { STAT_ICONS } from "../src/lib/stat-icons";
import { setActiveStrings, zh } from "../src/lib/strings";
import { en } from "../src/lib/strings-en";
@@ -126,7 +121,7 @@ describe("the hover buttons' CSS contract", () => {
// The menu's discoverable pointer entry: a real button that reports it opens a menu
// and anchors the panel at its own rect (not the pointer position).
expect(source).toContain('aria-haspopup="menu"');
- expect(source).toContain("ELLIPSIS_ICON");
+ expect(source).toContain("ICONS.ellipsis");
expect(source).toContain("getBoundingClientRect");
});
});
@@ -150,24 +145,24 @@ describe("sessionRowMenuItem", () => {
// Remote control wears the same paper plane the session row flies while it is relaying:
// the action and the mark it produces are one feature.
expect(icons).toEqual([
- PIN_ICON,
- PENCIL_ICON,
- MESSAGING_RELAY_ICON,
- ARCHIVE_ICON,
+ ICONS.pin,
+ ICONS.pencil,
+ ICONS.paperPlane,
+ ICONS.archive,
// The same glyph the details card's copy button shows, so one value has one mark.
STAT_ICONS.copy,
- TRASH_ICON,
+ ICONS.trash,
]);
});
it("flips archive's label and glyph on an archived row", () => {
expect(sessionRowMenuItem("archive", { archived: false, pinned: false })).toMatchObject({
label: zh.chat.archiveSession,
- icon: ARCHIVE_ICON,
+ icon: ICONS.archive,
});
expect(sessionRowMenuItem("archive", { archived: true, pinned: false })).toMatchObject({
label: zh.chat.unarchiveSession,
- icon: UNARCHIVE_ICON,
+ icon: ICONS.archiveRestore,
});
});
@@ -178,7 +173,7 @@ describe("sessionRowMenuItem", () => {
expect(sessionRowMenuItem("pin", { archived: false, pinned: true }).label).toBe(
zh.chat.unpinSession,
);
- expect(sessionRowMenuItem("pin", { archived: false, pinned: true }).icon).toBe(PIN_ICON);
+ expect(sessionRowMenuItem("pin", { archived: false, pinned: true }).icon).toBe(ICONS.pin);
});
it("reads the active dictionary, so both locales name every action", () => {
diff --git a/packages/web/test/stream-selection-menu.test.ts b/packages/web/test/stream-selection-menu.test.ts
index 848cead0..6e35783c 100644
--- a/packages/web/test/stream-selection-menu.test.ts
+++ b/packages/web/test/stream-selection-menu.test.ts
@@ -14,11 +14,11 @@ import { afterEach, describe, expect, it, vi } from "vitest";
import { createElement, isValidElement } from "react";
import type { ReactElement, ReactNode } from "react";
import { renderToStaticMarkup } from "react-dom/server";
+import { ICONS } from "@prismshadow/penguin-ui";
import { LinkMenuRows, SelectionMenuRows } from "../src/features/chat/stream-selection-menu";
import type { CapturedSelection } from "../src/features/chat/stream-selection-menu";
import type { ComposerControl } from "../src/features/chat/chat-input";
import { ReferenceChip } from "../src/features/chat/reference-chip";
-import { QUOTE_ICON } from "../src/components/ui/icons";
import { excerptLabel } from "../src/lib/selection-menu";
import type { ComposerReference } from "../src/lib/workspace-tree";
import { S, setActiveStrings, zh } from "../src/lib/strings";
@@ -156,7 +156,7 @@ describe("Add to conversation", () => {
expect(name.endsWith("…")).toBe(true);
expect(chip).toContain(`data-tooltip="${EXCERPT}"`);
expect(chip).toContain(`>${name}</span>`);
- expect(chip).toContain(`d="${QUOTE_ICON}"`);
+ expect(chip).toContain(`d="${ICONS.quote}"`);
expect(chip).toContain(`aria-label="${S.files.removeReference} ${name}"`);
});
});
diff --git a/packages/web/test/tone.test.ts b/packages/web/test/tone.test.ts
index 409d62c6..9cf66b5e 100644
--- a/packages/web/test/tone.test.ts
+++ b/packages/web/test/tone.test.ts
@@ -18,9 +18,9 @@ const read = (id: string) => sourceFile(SCAN, id).text;
/** The status files that take their colour from the tokens, wherever each one lives. */
const STATUS_FILES = [
- "packages/web/src/components/ui/status-icon.tsx",
- "packages/web/src/components/ui/session-activity-icon.tsx",
- "packages/web/src/components/ui/badge.tsx",
+ "packages/ui/src/components/icons/status-icon/status-icon.tsx",
+ "packages/ui/src/components/icons/activity-icon/activity-icon.tsx",
+ "packages/ui/src/components/feedback/badge/badge.tsx",
"packages/web/src/features/chat/step-banner.tsx",
"packages/web/src/features/chat/goal-banner.tsx",
"packages/web/src/features/chat/subagent-chip.tsx",
@@ -70,11 +70,11 @@ describe("status marks take their colour from the tokens", () => {
it("inks the two hourglass states with the same attention tone", () => {
// The session list's running glyph and the stream's waiting-for-approval glyph are the same
// state to a reader — unfinished, waiting — so they are the same colour.
- expect(read("packages/web/src/components/ui/status-icon.tsx")).toContain(
- "waiting: toneInk.attention",
+ expect(read("packages/ui/src/components/icons/status-icon/status-icon.tsx")).toContain(
+ 'waiting: "text-tone-attention-fg"',
);
- expect(read("packages/web/src/components/ui/session-activity-icon.tsx")).toContain(
- "toneInk.attention",
+ expect(read("packages/ui/src/components/icons/activity-icon/activity-icon.tsx")).toContain(
+ "text-tone-attention-fg",
);
});
@@ -83,8 +83,6 @@ describe("status marks take their colour from the tokens", () => {
// out of scope and are not listed here.
for (const rel of STATUS_FILES) {
const src = read(rel);
- // badge.tsx keeps one deliberate exception, a yellow informational tag that must not read
- // as a warning; it says so at the definition.
const offenders = [...src.matchAll(/\b(?:text|bg|border)-(?:amber|emerald|red|green)-\d+/g)];
expect(offenders, `${rel} spells a status colour inline`).toHaveLength(0);
}
diff --git a/packages/web/test/ui-strings.test.ts b/packages/web/test/ui-strings.test.ts
new file mode 100644
index 00000000..1cec341d
--- /dev/null
+++ b/packages/web/test/ui-strings.test.ts
@@ -0,0 +1,46 @@
+/**
+ * The shared UI package's accessibility fallbacks in the app's words (src/lib/ui-strings.ts): every
+ * `UiStrings` key is mapped from both dictionaries, and the language provider hands them over.
+ *
+ * vitest runs node-only here, and `LocaleProvider` reads localStorage and the browser's language
+ * as it mounts, so the mounting is pinned by its source rather than by a render.
+ */
+import { readFileSync } from "node:fs";
+import { describe, expect, it } from "vitest";
+import { DEFAULT_UI_STRINGS } from "@prismshadow/penguin-ui";
+import { zh } from "../src/lib/strings";
+import { en } from "../src/lib/strings-en";
+import { uiStringsFor, uiStringsOf } from "../src/lib/ui-strings";
+
+const KEYS = Object.keys(DEFAULT_UI_STRINGS).sort();
+
+describe("uiStringsFor", () => {
+ it("maps every key the package asks for, in both languages", () => {
+ for (const locale of ["zh", "en"] as const) {
+ const strings = uiStringsFor(locale);
+ expect(Object.keys(strings).sort(), locale).toEqual(KEYS);
+ for (const [key, value] of Object.entries(strings)) {
+ expect(typeof value === "string" && value.trim() !== "", `${locale}.${key}`).toBe(true);
+ }
+ }
+ });
+
+ it("speaks each dictionary's words", () => {
+ expect(uiStringsFor("zh")).toEqual(uiStringsOf(zh));
+ expect(uiStringsFor("en")).toEqual(uiStringsOf(en));
+ expect(uiStringsFor("zh").close).toBe(zh.common.close);
+ expect(uiStringsFor("en").copied).toBe(en.common.copied);
+ expect(uiStringsFor("zh").close).not.toBe(uiStringsFor("en").close);
+ });
+
+ it("keeps one object per language, so the provider's value does not change between renders", () => {
+ expect(uiStringsFor("en")).toBe(uiStringsFor("en"));
+ });
+});
+
+describe("LocaleProvider", () => {
+ it("hands the package the words of the language it resolved", () => {
+ const source = readFileSync(new URL("../src/state/locale.tsx", import.meta.url), "utf8");
+ expect(source).toContain("<UiStringsProvider strings={uiStringsFor(locale)}>");
+ });
+});
diff --git a/scripts/ui-migrate.json b/scripts/ui-migrate.json
new file mode 100644
index 00000000..cbbc9f41
--- /dev/null
+++ b/scripts/ui-migrate.json
@@ -0,0 +1,267 @@
+{
+ "$comment": "Importer rewrites for the UI package migration, read by scripts/ui-migrate.mjs. waves.<wave>.<web module, repo-relative, no extension> is a list of rules: names that left that module for `target` (the package, or a web module that took them over), defined in `dest`. A name is `Name`, `Old→New` (renamed) or `OLD→OBJECT.key` (became a member of a registry object). A rule applies once the web module no longer exports the name and `dest` exports what it maps to; delete a wave's block once the wave is on main.",
+ "waves": {
+ "W1": {
+ "packages/web/src/lib/icon-scale": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/icon-scale.ts",
+ "names": ["ICON_SIZE", "ICON_GAP"]
+ }
+ ],
+ "packages/web/src/components/ui/glyph-icon": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/glyph-icon/glyph-icon.tsx",
+ "names": ["GlyphIcon"]
+ }
+ ],
+ "packages/web/src/components/ui/chevron": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/chevron/chevron.tsx",
+ "names": ["Chevron"]
+ }
+ ],
+ "packages/web/src/components/ui/icons": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/marks/marks.tsx",
+ "names": [
+ "ChevronDown",
+ "CheckIcon",
+ "PlusIcon",
+ "DownloadIcon",
+ "UploadIcon",
+ "CloseIcon"
+ ]
+ },
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/actions/close-button/close-button.tsx",
+ "names": ["CloseButton"]
+ },
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/icons.ts",
+ "names": [
+ "INFO_ICON→ICONS.info",
+ "QUOTE_ICON→ICONS.quote",
+ "EXTERNAL_LINK_ICON→ICONS.externalLink",
+ "PANEL_BOTTOM_ICON→ICONS.panelBottom",
+ "PANEL_RIGHT_ICON→ICONS.panelRight",
+ "WORKBENCH_ICON→ICONS.tiles",
+ "EXPAND_ICON→ICONS.cornersOut",
+ "COLLAPSE_ICON→ICONS.cornersIn",
+ "AGENTS_PAIR_ICON→ICONS.robotPair",
+ "MEMORY_ICON→ICONS.brain",
+ "HIDDEN_ICON→ICONS.eyeOff",
+ "FILE_ICON→ICONS.file",
+ "FILE_WRITE_ICON→ICONS.filePlus",
+ "FILE_EDIT_ICON→ICONS.penLine",
+ "UPLOAD_ICON→ICONS.upload",
+ "DOWNLOAD_ICON→ICONS.download",
+ "REFRESH_ICON→ICONS.refresh",
+ "WRAP_TEXT_ICON→ICONS.wrapText",
+ "BACKGROUND_TASKS_ICON→ICONS.pulse",
+ "ADD_TO_CHAT_ICON→ICONS.messagePlus",
+ "MESSAGING_RELAY_ICON→ICONS.paperPlane",
+ "GEAR_ICON→ICONS.gear",
+ "HOOK_ICON→ICONS.fishHook",
+ "PLUGIN_ICON→ICONS.puzzle",
+ "MAGIC_WAND_ICON→ICONS.wand",
+ "HAND_ICON→ICONS.hand",
+ "SCHEDULE_ICON→ICONS.alarmClock",
+ "COMPANY_MODE_ICON→ICONS.building",
+ "ADD_ICON→ICONS.plus",
+ "WARNING_ICON→ICONS.triangleAlert",
+ "GLOBE_ICON→ICONS.globe",
+ "ARROW_BACK_ICON→ICONS.arrowLeftCentered",
+ "ARROW_FORWARD_ICON→ICONS.arrowRightCentered",
+ "CODE_ICON→ICONS.angleBrackets",
+ "HOME_ICON→ICONS.house",
+ "LINK_ICON→ICONS.chainLink"
+ ]
+ },
+ {
+ "owner": "WP-A",
+ "target": "packages/web/src/lib/nav-icons",
+ "dest": "packages/web/src/lib/nav-icons.ts",
+ "names": ["NAV_ICONS"]
+ }
+ ],
+ "packages/web/src/components/ui/group-list": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/icons.ts",
+ "names": [
+ "FOLDER_ICON→ICONS.folder",
+ "FOLDER_OPEN_ICON→ICONS.folderOpen",
+ "AGENT_GROUP_ICON→ICONS.robot",
+ "CLOCK_ICON→ICONS.clock",
+ "CALENDAR_ICON→ICONS.calendar",
+ "REORDER_ICON→ICONS.arrowUpDown"
+ ]
+ }
+ ],
+ "packages/web/src/components/ui/session-row-menu": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/icons.ts",
+ "names": [
+ "PIN_ICON→ICONS.pin",
+ "PENCIL_ICON→ICONS.pencil",
+ "ARCHIVE_ICON→ICONS.archive",
+ "UNARCHIVE_ICON→ICONS.archiveRestore",
+ "TRASH_ICON→ICONS.trash",
+ "ELLIPSIS_ICON→ICONS.ellipsis"
+ ]
+ }
+ ],
+ "packages/web/src/components/ui/agent-avatar": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/avatars/agent-avatar.tsx",
+ "names": ["AgentAvatar"]
+ }
+ ],
+ "packages/web/src/components/ui/user-avatar": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/avatars/user-avatar.tsx",
+ "names": ["UserAvatar", "USER_AVATAR_SIZE"]
+ }
+ ],
+ "packages/web/src/lib/avatar": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/avatars/avatar.ts",
+ "names": ["avatarHue", "avatarTile", "avatarInitial"]
+ }
+ ],
+ "packages/web/src/components/ui/provider-logo": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/logos/provider-logo.tsx",
+ "names": ["ProviderLogo"]
+ }
+ ],
+ "packages/web/src/components/ui/penguin-logo": [
+ {
+ "owner": "WP-A",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/logos/penguin-logo.tsx",
+ "names": ["PenguinLogo"]
+ }
+ ],
+ "packages/web/src/components/ui/status-icon": [
+ {
+ "owner": "WP-B",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/status-icon/status-icon.tsx",
+ "names": ["StatusIcon", "RunState"]
+ }
+ ],
+ "packages/web/src/components/ui/session-activity-icon": [
+ {
+ "owner": "WP-B",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/activity-icon/activity-icon.tsx",
+ "names": ["SessionActivityIcon→ActivityIcon", "BackgroundTasksMark", "ScheduleMark"]
+ },
+ {
+ "owner": "WP-B",
+ "target": "packages/web/src/lib/session-activity",
+ "dest": "packages/web/src/lib/session-activity.ts",
+ "names": ["sessionActivityLabel"]
+ }
+ ],
+ "packages/web/src/components/ui/update-dot": [
+ {
+ "owner": "WP-B",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/icons/update-dot/update-dot.tsx",
+ "names": ["UpdateDot", "UpdatePill", "UPDATE_DOT_INLINE", "UpdateDotSize"]
+ }
+ ],
+ "packages/web/src/components/ui/badge": [
+ {
+ "owner": "WP-B",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/feedback/badge/badge.tsx",
+ "names": ["Badge"]
+ },
+ {
+ "owner": "WP-B",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/tokens.ts",
+ "names": ["BadgeTone→ToneName"]
+ },
+ {
+ "owner": "WP-B",
+ "target": "packages/web/src/lib/stop-reason-tone",
+ "dest": "packages/web/src/lib/stop-reason-tone.ts",
+ "names": ["stopReasonTone"]
+ }
+ ],
+ "packages/web/src/components/ui/skeleton": [
+ {
+ "owner": "WP-B",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/feedback/skeleton/skeleton.tsx",
+ "names": ["Skeleton", "SkeletonList", "SkeletonCard"]
+ }
+ ],
+ "packages/web/src/components/ui/empty-state": [
+ {
+ "owner": "WP-B",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/feedback/empty-state/empty-state.tsx",
+ "names": ["EmptyState", "SettingsEmpty"]
+ }
+ ],
+ "packages/web/src/components/ui/button": [
+ {
+ "owner": "WP-C",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/actions/button/button.tsx",
+ "names": ["Button", "ButtonProps", "labelButtonClass→buttonClass"]
+ }
+ ],
+ "packages/web/src/components/ui/copy-button": [
+ {
+ "owner": "WP-C",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/actions/copy-button/copy-button.tsx",
+ "names": ["CopyButton", "useCopied", "CopiedStatus", "CopyCheckGlyph"]
+ },
+ {
+ "owner": "WP-C",
+ "target": "packages/web/src/lib/clipboard",
+ "dest": "packages/web/src/lib/clipboard.ts",
+ "names": ["writeClipboard"]
+ }
+ ],
+ "packages/web/src/components/ui/hidden-file-input": [
+ {
+ "owner": "WP-C",
+ "target": "@prismshadow/penguin-ui",
+ "dest": "packages/ui/src/components/actions/hidden-file-input/hidden-file-input.tsx",
+ "names": ["HiddenFileInput"]
+ }
+ ]
+ }
+ }
+}
diff --git a/scripts/ui-migrate.mjs b/scripts/ui-migrate.mjs
new file mode 100644
index 00000000..8c89712b
--- /dev/null
+++ b/scripts/ui-migrate.mjs
@@ -0,0 +1,613 @@
+#!/usr/bin/env node
+/**
+ * ui-migrate: rewrite the imports of modules that moved out of the Web App into the shared UI
+ * package (`@prismshadow/penguin-ui`), or into a web module that took part of one over, across
+ * the Web App and the gallery.
+ *
+ * node scripts/ui-migrate.mjs rewrite in place
+ * node scripts/ui-migrate.mjs --dry-run list the files it would change, write nothing
+ * node scripts/ui-migrate.mjs --check like --dry-run, and exit 1 when anything would change
+ *
+ * The map is scripts/ui-migrate.json: per wave, per web module (repo-relative, no extension), a
+ * list of rules `{ target, dest, names }`. `target` is the package, or a web module (repo-relative,
+ * the specifier computed per file); `dest` is the file that defines the names afterwards. A name
+ * is `Name` (moved as is), `Old→New` (renamed: the import and every reference follow) or
+ * `OLD→OBJECT.key` (became a member of a registry object: the import becomes `OBJECT` and every
+ * reference `OBJECT.key`).
+ *
+ * A rule applies to a name once the web module no longer exports it (the module is deleted, or
+ * the name left it) and `dest` exports what it maps to. So a work package runs the script after
+ * moving its modules, and it touches exactly what that package moved; the same run on a rebased
+ * branch redoes every package's rewrites instead of anyone resolving import conflicts. Running it
+ * twice is a no-op.
+ *
+ * Every `.ts`/`.tsx` under packages/web/{src,test} and packages/ui-gallery/{src,test} is read.
+ * An import (value or type) of a listed module has its moved names taken out — the declaration
+ * is dropped when nothing is left — and put on the target: merged into the file's existing
+ * import of it, or on a new line (the package's after the file's last bare-specifier import
+ * ahead of its first relative one; a web module's where the old import stood). Type-only names
+ * go on an `import type` line. What the script cannot do on its own it prints and leaves alone:
+ * a name the module no longer exports with no rule for it, a local binding a new import would
+ * collide with, a re-export, a namespace or default import. Those are the hand edits.
+ *
+ * Parsing uses the repo's `typescript`. In a checkout without node_modules, point
+ * UI_MIGRATE_TYPESCRIPT at an installed typescript package directory.
+ */
+import fs from "node:fs";
+import path from "node:path";
+import { createRequire } from "node:module";
+import { fileURLToPath } from "node:url";
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
+const MAP_FILE = path.join(ROOT, "scripts", "ui-migrate.json");
+const PACKAGE = "@prismshadow/penguin-ui";
+const SCAN_ROOTS = [
+ "packages/web/src",
+ "packages/web/test",
+ "packages/ui-gallery/src",
+ "packages/ui-gallery/test",
+];
+/** Prettier's printWidth here: an import longer than this is written one name per line. */
+const PRINT_WIDTH = 100;
+
+const args = new Set(process.argv.slice(2));
+const DRY = args.has("--dry-run") || args.has("--check");
+const CHECK = args.has("--check");
+
+const ts = loadTypescript();
+
+function loadTypescript() {
+ const require = createRequire(path.join(ROOT, "package.json"));
+ const override = process.env.UI_MIGRATE_TYPESCRIPT;
+ try {
+ return override ? require(path.resolve(override)) : require("typescript");
+ } catch {
+ console.error(
+ "ui-migrate: cannot load typescript. Run `pnpm install`, or set UI_MIGRATE_TYPESCRIPT " +
+ "to an installed typescript package directory (…/node_modules/typescript).",
+ );
+ process.exit(2);
+ }
+}
+
+const posix = (p) => p.split(path.sep).join("/");
+const repoRel = (abs) => posix(path.relative(ROOT, abs));
+
+function parse(file, text) {
+ const kind = file.endsWith(".tsx") ? ts.ScriptKind.TSX : ts.ScriptKind.TS;
+ return ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, kind);
+}
+
+// ---------------------------------------------------------------------------------------------
+// The map
+// ---------------------------------------------------------------------------------------------
+
+const NAME = /^([A-Za-z_$][\w$]*)(?:\s*(?:→|->)\s*([A-Za-z_$][\w$]*)(?:\.([A-Za-z_$][\w$]*))?)?$/;
+
+/** module id → { rules: [{ owner, target, dest, entries: Map<old, entry> }] } */
+function loadMap() {
+ const raw = JSON.parse(fs.readFileSync(MAP_FILE, "utf8"));
+ const modules = new Map();
+ for (const [wave, byModule] of Object.entries(raw.waves ?? {})) {
+ for (const [moduleId, rules] of Object.entries(byModule)) {
+ const list = modules.get(moduleId) ?? [];
+ for (const rule of Array.isArray(rules) ? rules : [rules]) {
+ const entries = new Map();
+ for (const spec of rule.names) {
+ const m = NAME.exec(spec.trim());
+ if (!m) throw new Error(`ui-migrate.json: ${wave} ${moduleId}: bad name "${spec}"`);
+ const [, old, to, key] = m;
+ entries.set(
+ old,
+ key !== undefined
+ ? { old, kind: "member", name: to, key }
+ : { old, kind: to === undefined || to === old ? "same" : "rename", name: to ?? old },
+ );
+ }
+ list.push({ wave, owner: rule.owner, target: rule.target, dest: rule.dest, entries });
+ }
+ modules.set(moduleId, list);
+ }
+ }
+ return modules;
+}
+
+/** The file behind a module id, or null when it is gone. */
+function moduleFile(moduleId) {
+ for (const ext of [".ts", ".tsx", "/index.ts", "/index.tsx"]) {
+ const abs = path.join(ROOT, moduleId + ext);
+ if (fs.existsSync(abs)) return abs;
+ }
+ return null;
+}
+
+const exportCache = new Map();
+
+/**
+ * What a module file exports: its names, whether it re-exports a whole module (then any name may
+ * be exported), and the keys of each exported object literal (a registry's members).
+ */
+function exportsOf(abs) {
+ if (exportCache.has(abs)) return exportCache.get(abs);
+ const sf = parse(abs, fs.readFileSync(abs, "utf8"));
+ const names = new Set();
+ const keys = new Map();
+ let star = false;
+ const exported = (node) =>
+ ts.canHaveModifiers(node) &&
+ (ts.getModifiers(node) ?? []).some((m) => m.kind === ts.SyntaxKind.ExportKeyword);
+ for (const st of sf.statements) {
+ if (ts.isExportDeclaration(st)) {
+ if (!st.exportClause) star = true;
+ else if (ts.isNamedExports(st.exportClause)) {
+ for (const el of st.exportClause.elements) names.add(el.name.text);
+ }
+ } else if (ts.isVariableStatement(st) && exported(st)) {
+ for (const decl of st.declarationList.declarations) {
+ if (!ts.isIdentifier(decl.name)) continue;
+ names.add(decl.name.text);
+ let init = decl.initializer;
+ while (
+ init &&
+ (ts.isAsExpression(init) ||
+ ts.isSatisfiesExpression(init) ||
+ ts.isParenthesizedExpression(init))
+ ) {
+ init = init.expression;
+ }
+ if (init && ts.isObjectLiteralExpression(init)) {
+ keys.set(
+ decl.name.text,
+ new Set(
+ init.properties
+ .map((p) => p.name)
+ .filter((n) => n && (ts.isIdentifier(n) || ts.isStringLiteral(n)))
+ .map((n) => n.text),
+ ),
+ );
+ }
+ }
+ } else if (
+ (ts.isFunctionDeclaration(st) ||
+ ts.isClassDeclaration(st) ||
+ ts.isInterfaceDeclaration(st) ||
+ ts.isTypeAliasDeclaration(st) ||
+ ts.isEnumDeclaration(st)) &&
+ exported(st) &&
+ st.name
+ ) {
+ names.add(st.name.text);
+ }
+ }
+ const result = { names, star, keys };
+ exportCache.set(abs, result);
+ return result;
+}
+
+/**
+ * Each rule's entries split by state: `active` (the module let the name go and `dest` has it),
+ * `blocked` (the name left but `dest` cannot take it — printed), or pending (left out: the module
+ * still exports it, so its work package has not moved it yet).
+ */
+function resolveRules(modules) {
+ const resolved = new Map();
+ const blocked = [];
+ let pending = 0;
+ for (const [moduleId, rules] of modules) {
+ const file = moduleFile(moduleId);
+ const source = file ? exportsOf(file) : null;
+ const active = new Map();
+ for (const rule of rules) {
+ const destAbs = path.join(ROOT, rule.dest);
+ const dest = fs.existsSync(destAbs) ? exportsOf(destAbs) : null;
+ for (const entry of rule.entries.values()) {
+ if (source && (source.star || source.names.has(entry.old))) {
+ pending++;
+ continue;
+ }
+ const why =
+ dest === null
+ ? `${rule.dest} does not exist`
+ : !dest.names.has(entry.name) && !dest.star
+ ? `${rule.dest} does not export ${entry.name}`
+ : entry.kind === "member" && !dest.keys.get(entry.name)?.has(entry.key)
+ ? `${entry.name} in ${rule.dest} has no key ${entry.key}`
+ : null;
+ if (why !== null) {
+ blocked.push(`${moduleId}: ${entry.old} → ${rule.target}: ${why}`);
+ continue;
+ }
+ active.set(entry.old, { ...entry, target: rule.target });
+ }
+ }
+ resolved.set(moduleId, { gone: file === null, source, active });
+ }
+ return { resolved, blocked, pending };
+}
+
+// ---------------------------------------------------------------------------------------------
+// One file
+// ---------------------------------------------------------------------------------------------
+
+/** The module id a relative specifier names from `file`, or null for a bare specifier. */
+function moduleIdOf(file, specifier) {
+ if (!specifier.startsWith(".")) return null;
+ return repoRel(path.resolve(path.dirname(file), specifier)).replace(/\.(?:tsx?|jsx?|mjs)$/, "");
+}
+
+/** The specifier `file` uses for a target: the package, or a relative path to a web module. */
+function specifierFor(file, target) {
+ if (!target.startsWith("packages/")) return target;
+ let rel = posix(path.relative(path.dirname(file), path.join(ROOT, target)));
+ if (!rel.startsWith(".")) rel = `./${rel}`;
+ return rel;
+}
+
+/** An import specifier's text: `type A`, `A as B`. */
+function specifierText({ imported, local, typeOnly }) {
+ return `${typeOnly ? "type " : ""}${imported === local ? imported : `${imported} as ${local}`}`;
+}
+
+function renderImport(specifiers, from, typeOnly) {
+ const head = typeOnly ? "import type " : "import ";
+ const one = `${head}{ ${specifiers.join(", ")} } from "${from}";`;
+ if (one.length <= PRINT_WIDTH) return one;
+ return `${head}{\n${specifiers.map((s) => ` ${s},`).join("\n")}\n} from "${from}";`;
+}
+
+const byImported = (a, b) => (a.imported < b.imported ? -1 : a.imported > b.imported ? 1 : 0);
+
+function elementsOf(decl) {
+ const clause = decl.importClause;
+ return clause.namedBindings.elements.map((el) => ({
+ imported: (el.propertyName ?? el.name).text,
+ local: el.name.text,
+ typeOnly: el.isTypeOnly,
+ }));
+}
+
+/** Every name the file binds anywhere, with the import declaration it comes from (if any). */
+function bindingsOf(sf) {
+ const bound = new Map();
+ const add = (name, decl) => {
+ const list = bound.get(name) ?? [];
+ list.push(decl);
+ bound.set(name, list);
+ };
+ const addPattern = (name) => {
+ if (ts.isIdentifier(name)) add(name.text, null);
+ else for (const el of name.elements) if (!ts.isOmittedExpression(el)) addPattern(el.name);
+ };
+ const visit = (node) => {
+ if (ts.isImportDeclaration(node)) {
+ const clause = node.importClause;
+ if (clause?.name) add(clause.name.text, node);
+ const nb = clause?.namedBindings;
+ if (nb && ts.isNamespaceImport(nb)) add(nb.name.text, node);
+ else if (nb) for (const el of nb.elements) add(el.name.text, node);
+ return;
+ }
+ if (
+ (ts.isVariableDeclaration(node) || ts.isParameter(node) || ts.isBindingElement(node)) &&
+ node.name
+ ) {
+ addPattern(node.name);
+ } else if (
+ (ts.isFunctionDeclaration(node) ||
+ ts.isFunctionExpression(node) ||
+ ts.isClassDeclaration(node) ||
+ ts.isClassExpression(node) ||
+ ts.isInterfaceDeclaration(node) ||
+ ts.isTypeAliasDeclaration(node) ||
+ ts.isEnumDeclaration(node) ||
+ ts.isTypeParameterDeclaration(node)) &&
+ node.name
+ ) {
+ add(node.name.text, null);
+ }
+ ts.forEachChild(node, visit);
+ };
+ visit(sf);
+ return bound;
+}
+
+/** Identifier references to rewrite: `local → replacement`, skipping names that are not references. */
+function referenceEdits(sf, rewrites, problems, file) {
+ const edits = [];
+ const visit = (node) => {
+ if (ts.isImportDeclaration(node)) return;
+ if (ts.isIdentifier(node) && rewrites.has(node.text)) {
+ const parent = node.parent;
+ const replacement = rewrites.get(node.text);
+ const isName =
+ (ts.isPropertyAccessExpression(parent) && parent.name === node) ||
+ (ts.isQualifiedName(parent) && parent.right === node) ||
+ (ts.isPropertyAssignment(parent) && parent.name === node) ||
+ (ts.isPropertySignature(parent) && parent.name === node) ||
+ (ts.isPropertyDeclaration(parent) && parent.name === node) ||
+ (ts.isMethodDeclaration(parent) && parent.name === node) ||
+ (ts.isBindingElement(parent) && parent.propertyName === node) ||
+ ts.isJsxAttribute(parent) ||
+ (ts.isEnumMember(parent) && parent.name === node);
+ if (ts.isExportSpecifier(parent)) {
+ problems.push(`${file}: re-exports ${node.text}; rewrite the export by hand`);
+ } else if (ts.isShorthandPropertyAssignment(parent)) {
+ edits.push({
+ start: node.getStart(sf),
+ end: node.end,
+ text: `${node.text}: ${replacement}`,
+ });
+ } else if (!isName) {
+ edits.push({ start: node.getStart(sf), end: node.end, text: replacement });
+ }
+ }
+ ts.forEachChild(node, visit);
+ };
+ visit(sf);
+ return edits;
+}
+
+function applyEdits(text, edits) {
+ const sorted = [...edits].sort((a, b) => b.start - a.start || b.end - a.end);
+ let out = text;
+ let floor = Infinity;
+ for (const edit of sorted) {
+ if (edit.end > floor) throw new Error(`overlapping edits at ${edit.start}`);
+ out = out.slice(0, edit.start) + edit.text + out.slice(edit.end);
+ floor = edit.start;
+ }
+ return out;
+}
+
+/** The line-inclusive range of a statement: from its first token to the newline after it. */
+function statementRange(text, sf, node) {
+ const start = node.getStart(sf);
+ let end = node.end;
+ if (text[end] === "\r") end++;
+ if (text[end] === "\n") end++;
+ return { start, end };
+}
+
+function migrateFile(file, resolved, problems) {
+ const text = fs.readFileSync(file, "utf8");
+ const sf = parse(file, text);
+ const rel = repoRel(file);
+ const imports = sf.statements.filter(ts.isImportDeclaration);
+ const moves = [];
+ const touched = [];
+
+ for (const st of sf.statements) {
+ if (!ts.isExportDeclaration(st) || !st.moduleSpecifier) continue;
+ const id = moduleIdOf(file, st.moduleSpecifier.text);
+ if (id && resolved.get(id)?.active.size) {
+ problems.push(`${rel}: re-exports from ${st.moduleSpecifier.text}; rewrite it by hand`);
+ }
+ }
+
+ for (const decl of imports) {
+ const id = moduleIdOf(file, decl.moduleSpecifier.text);
+ const state = id ? resolved.get(id) : undefined;
+ if (!state) continue;
+ const clause = decl.importClause;
+ const named = clause?.namedBindings;
+ if (!clause || clause.name || (named && ts.isNamespaceImport(named))) {
+ if (state.active.size > 0 || state.gone) {
+ problems.push(`${rel}: a default, namespace or bare import of ${id}; move it by hand`);
+ }
+ continue;
+ }
+ if (!named) continue;
+ const keep = [];
+ const moved = [];
+ for (const el of elementsOf(decl)) {
+ const entry = state.active.get(el.imported);
+ const typeOnly = clause.isTypeOnly || el.typeOnly;
+ if (entry) {
+ moved.push({ ...el, typeOnly, entry });
+ continue;
+ }
+ keep.push(el);
+ const exported = state.source && (state.source.star || state.source.names.has(el.imported));
+ if (!exported) {
+ problems.push(
+ `${rel}: ${el.imported} from ${decl.moduleSpecifier.text} — ${id} no longer exports it and no rule maps it`,
+ );
+ }
+ }
+ if (moved.length === 0) continue;
+ touched.push({ decl, keep, typeOnly: clause.isTypeOnly });
+ for (const m of moved) moves.push({ ...m, decl });
+ }
+ if (moves.length === 0) return null;
+
+ // What each move adds to its target, and which references change.
+ const rewrites = new Map();
+ const additions = new Map(); // `${target}|${typeOnly}` → { target, typeOnly, specifiers: Map<local, spec>, anchor }
+ for (const m of moves) {
+ const { entry } = m;
+ let spec;
+ if (entry.kind === "member") {
+ spec = { imported: entry.name, local: entry.name, typeOnly: false };
+ rewrites.set(m.local, `${entry.name}.${entry.key}`);
+ } else if (entry.kind === "rename" && m.local === m.imported) {
+ spec = { imported: entry.name, local: entry.name, typeOnly: m.typeOnly };
+ rewrites.set(m.local, entry.name);
+ } else {
+ spec = { imported: entry.name, local: m.local, typeOnly: m.typeOnly };
+ }
+ const typeOnly = spec.typeOnly;
+ const key = `${entry.target}|${typeOnly}`;
+ const add = additions.get(key) ?? {
+ target: entry.target,
+ typeOnly,
+ specifiers: new Map(),
+ anchor: m.decl,
+ };
+ // A type-only name on a value line would be written `type X`; the line itself is typed.
+ add.specifiers.set(spec.local, { ...spec, typeOnly: false });
+ additions.set(key, add);
+ }
+
+ // Collisions: a new local name the file already binds to something else, or an old name
+ // that the file also binds elsewhere (a shadow the reference rewrite would walk into).
+ const bound = bindingsOf(sf);
+ const movedDecls = new Set(moves.map((m) => m.decl));
+ for (const add of additions.values()) {
+ const from = specifierFor(file, add.target);
+ for (const local of add.specifiers.keys()) {
+ const others = (bound.get(local) ?? []).filter(
+ (d) =>
+ !(d && movedDecls.has(d)) &&
+ !(
+ d &&
+ (d.moduleSpecifier.text === from ||
+ (add.target.startsWith("packages/") &&
+ moduleIdOf(file, d.moduleSpecifier.text) === add.target))
+ ),
+ );
+ if (others.length > 0) {
+ problems.push(`${rel}: ${local} is already bound in this file; rename the local first`);
+ return null;
+ }
+ }
+ }
+ for (const local of rewrites.keys()) {
+ const others = (bound.get(local) ?? []).filter((d) => !(d && movedDecls.has(d)));
+ if (others.length > 0) {
+ problems.push(`${rel}: ${local} is also declared locally; rewrite its references by hand`);
+ return null;
+ }
+ }
+
+ const edits = referenceEdits(sf, rewrites, problems, rel);
+
+ // Old declarations: re-render with what stays, or drop.
+ const dropped = new Map();
+ for (const { decl, keep, typeOnly } of touched) {
+ if (keep.length > 0) {
+ edits.push({
+ start: decl.getStart(sf),
+ end: decl.end,
+ text: renderImport(keep.map(specifierText), decl.moduleSpecifier.text, typeOnly),
+ });
+ } else {
+ const range = statementRange(text, sf, decl);
+ const edit = { ...range, text: "" };
+ dropped.set(decl, edit);
+ edits.push(edit);
+ }
+ }
+
+ // New names: merged into an existing import of the target, else a new line.
+ const bare = [];
+ for (const decl of imports) {
+ if (decl.moduleSpecifier.text.startsWith(".")) break;
+ bare.push(decl);
+ }
+ const packageLines = [];
+ const anchored = new Map();
+ for (const add of [...additions.values()].sort(
+ (a, b) => Number(a.typeOnly) - Number(b.typeOnly),
+ )) {
+ const from = specifierFor(file, add.target);
+ const existing = imports.find((d) => {
+ const c = d.importClause;
+ if (!c || c.name || !c.namedBindings || ts.isNamespaceImport(c.namedBindings)) return false;
+ if (Boolean(c.isTypeOnly) !== add.typeOnly || movedDecls.has(d)) return false;
+ return add.target.startsWith("packages/")
+ ? moduleIdOf(file, d.moduleSpecifier.text) === add.target
+ : d.moduleSpecifier.text === add.target;
+ });
+ const specs = new Map(add.specifiers);
+ if (existing) {
+ for (const el of elementsOf(existing)) specs.set(el.local, el);
+ edits.push({
+ start: existing.getStart(sf),
+ end: existing.end,
+ text: renderImport(
+ [...specs.values()].sort(byImported).map(specifierText),
+ existing.moduleSpecifier.text,
+ add.typeOnly,
+ ),
+ });
+ continue;
+ }
+ const line = renderImport(
+ [...specs.values()].sort(byImported).map(specifierText),
+ from,
+ add.typeOnly,
+ );
+ if (add.target === PACKAGE || !add.target.startsWith("packages/")) {
+ packageLines.push(line);
+ } else if (dropped.has(add.anchor)) {
+ dropped.get(add.anchor).text += `${line}\n`;
+ } else {
+ const after = anchored.get(add.anchor) ?? [];
+ after.push(line);
+ anchored.set(add.anchor, after);
+ }
+ }
+ for (const [anchor, lines] of anchored) {
+ const { end } = statementRange(text, sf, anchor);
+ edits.push({ start: end, end, text: lines.map((l) => `${l}\n`).join("") });
+ }
+ if (packageLines.length > 0) {
+ const after = bare.at(-1);
+ if (after) {
+ edits.push({ start: after.end, end: after.end, text: `\n${packageLines.join("\n")}` });
+ } else {
+ const first = imports[0];
+ const at = first.getStart(sf);
+ edits.push({ start: at, end: at, text: `${packageLines.join("\n")}\n` });
+ }
+ }
+
+ const next = applyEdits(text, edits);
+ return next === text ? null : next;
+}
+
+// ---------------------------------------------------------------------------------------------
+// Run
+// ---------------------------------------------------------------------------------------------
+
+function walk(dir, out = []) {
+ if (!fs.existsSync(dir)) return out;
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
+ const abs = path.join(dir, entry.name);
+ if (entry.isDirectory()) {
+ if (entry.name !== "node_modules" && !entry.name.startsWith(".")) walk(abs, out);
+ } else if (/\.tsx?$/.test(entry.name) && !entry.name.endsWith(".d.ts")) {
+ out.push(abs);
+ }
+ }
+ return out;
+}
+
+const { resolved, blocked, pending } = resolveRules(loadMap());
+const problems = [];
+const changed = [];
+for (const file of SCAN_ROOTS.flatMap((root) => walk(path.join(ROOT, root)))) {
+ const next = migrateFile(file, resolved, problems);
+ if (next === null) continue;
+ changed.push(repoRel(file));
+ if (!DRY) fs.writeFileSync(file, next);
+}
+
+const active = [...resolved.values()].reduce((n, s) => n + s.active.size, 0);
+console.log(
+ `ui-migrate: ${active} names active, ${pending} pending (still exported where they were), ` +
+ `${changed.length} files ${DRY ? "would change" : "rewritten"}.`,
+);
+if (DRY) for (const file of changed) console.log(` ${file}`);
+if (blocked.length > 0) {
+ console.log(
+ "\nRules that cannot apply yet (the name left its module, but not for a place that has it):",
+ );
+ for (const line of blocked) console.log(` ${line}`);
+}
+if (problems.length > 0) {
+ console.log("\nLeft for a hand edit:");
+ for (const line of problems) console.log(` ${line}`);
+}
+if (blocked.length > 0 || problems.length > 0 || (CHECK && changed.length > 0))
+ process.exitCode = 1;