Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat(control-ui): declare the typography and token baseline

Jose Ramirezd4f2254e53f7
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index 42c5e2d1a..d7260bbc4 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -18,7 +18,6 @@
--cu-accent-muted: rgba(67, 119, 250, 0.2);
--cu-link: #8faeff;
--cu-link-hover: var(--cu-brand-light-blue);
- --cu-color-primary: var(--cu-accent);
--cu-danger: #ec7c72;
--cu-danger-hover: #f29a91;
--cu-success: #66b88f;
@@ -61,9 +60,65 @@
--cu-create-panel-padding-x: 1.15rem;
--cu-create-action-min-width: 8.5rem;
--cu-create-flow-min-height: calc(100vh - 7rem);
- --cu-create-flow-card-min-height: calc(100vh - 2rem);
--cu-toast-top-offset: calc(var(--cu-space-5) * 3.5);
--cu-expandable-body-bg: #000000;
+
+ /* ---- Typography ---------------------------------------------------- */
+ /* Derived from control-ui's own de-facto usage, so adopting the scale is
+ a near-zero visual diff. Deliberately NOT the desktop scale:
+ --cu-font-size-md is 14px here, --font-size-md is 13px in
+ desktop-app/ui/src/styles/tokens.css. Different prefixes, different
+ values, intentional. See docs/agents/control-ui-rules.md. */
+ --cu-font-size-2xs: 0.6875rem; /* 11px uppercase eyebrows, table th */
+ --cu-font-size-xs: 0.75rem; /* 12px hints, subtitles, chips */
+ --cu-font-size-sm: 0.8125rem; /* 13px tabs, sm buttons, dense body */
+ --cu-font-size-md: 0.875rem; /* 14px DEFAULT body, table cells */
+ --cu-font-size-lg: 0.9375rem; /* 15px panel header, row title */
+ --cu-font-size-xl: 1rem; /* 16px card / section title */
+ --cu-font-size-2xl: 1.125rem; /* 18px page subhead */
+ --cu-font-size-3xl: 1.375rem; /* 22px page hero */
+ --cu-font-size-4xl: 1.75rem; /* 28px auth hero only */
+
+ --cu-font-weight-regular: 400;
+ --cu-font-weight-medium: 500;
+ --cu-font-weight-semibold: 600;
+ --cu-font-weight-bold: 700;
+
+ --cu-line-height-tight: 1.2; /* headings */
+ --cu-line-height-normal: 1.45; /* body, hints */
+ --cu-line-height-relaxed: 1.5; /* body.cu-body today */
+
+ --cu-font-mono:
+ ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
+ monospace;
+
+ /* ---- Spacing ------------------------------------------------------- */
+ /* --cu-space-1..5 above are unchanged; these fill the ends of the scale
+ so the raw-rem tail has somewhere to land. */
+ --cu-space-0: 0.125rem; /* 2px */
+ --cu-space-05: 0.25rem; /* 4px */
+ --cu-space-6: 1.5rem; /* 24px */
+ --cu-space-7: 2rem; /* 32px */
+
+ /* ---- Radius -------------------------------------------------------- */
+ --cu-radius-xs: 4px; /* names the 4px literals and calc(-2px) hacks; --cu-radius-pill already exists above */
+
+ /* ---- Motion -------------------------------------------------------- */
+ --cu-motion-fast: 0.12s;
+ --cu-motion-base: var(--cu-control-transition);
+
+ /* ---- Semantic aliases ---------------------------------------------- */
+ /* These names were already referenced across the codebase but never
+ declared. Undeclared custom properties make the whole declaration
+ invalid at computed-value time, so each of these was silently dropping
+ a rule. The -rgb inputs are redefined per theme, so a single
+ declaration here resolves correctly in both. */
+ --cu-focus: rgba(var(--cu-focus-rgb), 0.8);
+ --cu-error: var(--cu-danger);
+ --cu-warn-text: var(--cu-warning);
+ --cu-warn-border: rgba(var(--cu-warning-rgb), 0.4);
+ --cu-ok-text: var(--cu-success);
+ --cu-ok-border: rgba(var(--cu-success-rgb), 0.4);
}
:root[data-theme='light'] {
@@ -6299,7 +6354,7 @@ textarea.cu-input {
padding: 0.75rem 0.85rem;
border: 1px solid var(--cu-border);
border-radius: var(--cu-radius-sm);
- background: var(--cu-bg-panel);
+ background: var(--cu-bg-elevated);
}
.cu-agent-radio--card:has(input:checked) {
@@ -7201,98 +7256,6 @@ textarea.cu-input {
accent-color: var(--cu-accent);
}
-.cu-team-member-role-menu {
- position: relative;
- width: min(9rem, 100%);
- justify-self: end;
- align-self: center;
-}
-
-.cu-team-member-role-menu__button {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: var(--cu-space-2);
- width: 100%;
- min-height: 2.25rem;
- padding: 0.45rem 0.65rem;
- color: var(--cu-text);
- border: 1px solid var(--cu-border);
- border-radius: var(--cu-radius-sm);
- background: var(--cu-bg-elevated);
- font: inherit;
- font-size: 0.875rem;
- line-height: 1.2;
- cursor: pointer;
- transition:
- border-color var(--cu-control-transition),
- background var(--cu-control-transition),
- box-shadow var(--cu-control-transition);
-}
-
-.cu-team-member-role-menu__button:hover,
-.cu-team-member-role-menu__button[aria-expanded='true'] {
- border-color: var(--cu-accent);
- background: var(--cu-surface);
-}
-
-.cu-team-member-role-menu__button:focus-visible {
- outline: 2px solid rgba(var(--cu-focus-rgb), 0.8);
- outline-offset: 2px;
-}
-
-.cu-team-member-role-menu__button:disabled {
- cursor: not-allowed;
- opacity: 0.62;
-}
-
-.cu-team-member-role-menu__chevron {
- width: 0.45rem;
- height: 0.45rem;
- border-right: 1.5px solid currentColor;
- border-bottom: 1.5px solid currentColor;
- color: var(--cu-text-soft);
- transform: translateY(-0.12rem) rotate(45deg);
- flex-shrink: 0;
-}
-
-.cu-team-member-role-menu__list {
- position: fixed;
- z-index: 45;
- top: var(--cu-role-menu-top);
- left: var(--cu-role-menu-left);
- display: grid;
- gap: 0.15rem;
- width: max(var(--cu-role-menu-width), 9rem);
- padding: 0.25rem;
- border: 1px solid var(--cu-border);
- border-radius: var(--cu-radius-sm);
- background: var(--cu-bg-elevated);
- box-shadow: var(--cu-shadow);
-}
-
-.cu-team-member-role-menu__option {
- width: 100%;
- padding: 0.45rem 0.55rem;
- color: var(--cu-text-muted);
- border: 0;
- border-radius: calc(var(--cu-radius-sm) - 2px);
- background: transparent;
- font: inherit;
- font-size: 0.875rem;
- line-height: 1.2;
- text-align: left;
- cursor: pointer;
-}
-
-.cu-team-member-role-menu__option:hover,
-.cu-team-member-role-menu__option:focus-visible,
-.cu-team-member-role-menu__option[data-selected='true'] {
- color: var(--cu-text);
- background: rgba(var(--cu-accent-rgb), 0.16);
- outline: none;
-}
-
.cu-agent-warning-title {
display: inline-flex;
align-items: center;
@@ -7410,11 +7373,6 @@ textarea.cu-input {
.cu-team-member-picker__option {
grid-template-columns: 1fr;
}
-
- .cu-team-member-role-menu {
- width: 100%;
- justify-self: stretch;
- }
}
.cu-create-content {
@@ -7862,7 +7820,7 @@ textarea.cu-input {
overflow: hidden;
border: 1px solid var(--cu-border-subtle);
border-radius: 0.35rem;
- background: var(--cu-bg-panel);
+ background: var(--cu-bg-elevated);
color: var(--cu-text-muted);
font-size: 0.6875rem;
font-weight: 700;
@@ -8157,7 +8115,7 @@ textarea.cu-input {
.cu-markdown-editor .w-md-editor-toolbar li > button:hover,
.cu-markdown-editor .w-md-editor-toolbar li > button:focus {
color: var(--cu-text);
- background: var(--cu-bg-muted);
+ background: var(--cu-surface-hover);
}
.cu-markdown-editor .w-md-editor-text,
@@ -9002,7 +8960,7 @@ textarea.cu-input {
.cu-code-block {
margin: 0;
padding: 0.6rem 0.75rem;
- background: var(--cu-surface-alt, var(--cu-surface));
+ background: var(--cu-surface);
border: 1px solid var(--cu-border);
border-radius: var(--cu-radius-sm, var(--cu-radius));
font-family: var(--cu-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
diff --git a/control-ui/app/secrets/recipe/[name]/edit/page.tsx b/control-ui/app/secrets/recipe/[name]/edit/page.tsx
index 55efa0531..ecf719479 100644
--- a/control-ui/app/secrets/recipe/[name]/edit/page.tsx
+++ b/control-ui/app/secrets/recipe/[name]/edit/page.tsx
@@ -288,7 +288,7 @@ function EditRecipeSecretContent() {
fontSize: '0.7rem',
padding: '0.15rem 0.4rem',
borderRadius: '4px',
- background: 'var(--cu-bg-soft, #eef)',
+ background: 'var(--cu-surface-hover)',
color: 'var(--cu-text-soft)',
whiteSpace: 'nowrap',
}}
diff --git a/control-ui/components/RecipeEditor.tsx b/control-ui/components/RecipeEditor.tsx
index 8264d6676..8e2138f5d 100644
--- a/control-ui/components/RecipeEditor.tsx
+++ b/control-ui/components/RecipeEditor.tsx
@@ -2229,7 +2229,7 @@ export function RecipeEditor({ initial, onSaved, onCancel, pageHeader }: Props)
border: '1px solid var(--cu-border)',
borderRadius: 6,
padding: '8px 10px',
- background: 'var(--cu-bg-subtle)',
+ background: 'var(--cu-surface-hover)',
color: 'var(--cu-text-soft)',
fontSize: '0.82rem',
lineHeight: 1.45,
diff --git a/control-ui/components/RegistryInstallModal.tsx b/control-ui/components/RegistryInstallModal.tsx
index 4374c460a..7b88e4173 100644
--- a/control-ui/components/RegistryInstallModal.tsx
+++ b/control-ui/components/RegistryInstallModal.tsx
@@ -306,7 +306,7 @@ export function RegistryInstallModal({ entry, isOpen, onClose, onInstalled }: Pr
fontSize: '0.7rem',
padding: '1px 5px',
borderRadius: 3,
- background: 'var(--cu-bg-surface)',
+ background: 'var(--cu-surface-hover)',
color: 'var(--cu-text-muted)',
}}
>
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 22ebfb978..9371562e4 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.457",
+ "version": "0.1.458",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.457",
+ "version": "0.1.458",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-ui/package.json b/control-ui/package.json
index 2c1ef70e0..6feb28a82 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.457",
+ "version": "0.1.458",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/docs/agents/control-ui-rules.md b/docs/agents/control-ui-rules.md
index a01be4db8..162d8f965 100644
--- a/docs/agents/control-ui-rules.md
+++ b/docs/agents/control-ui-rules.md
@@ -17,6 +17,70 @@ These provider-neutral rules apply only to `control-ui/**`. Combine them with
`Field`, `TextInput`, `SelectInput`, `TextAreaInput`, `CheckboxField`, and
`FormSection`.
+## Typography and tokens
+
+`app/globals.css` declares the full scale. Never write a raw `font-size` in CSS
+or a `fontSize` in TSX; use the token.
+
+| Token | Size | Use for |
+| -------------------- | ---- | ----------------------------------- |
+| `--cu-font-size-2xs` | 11px | uppercase eyebrows, table `th` |
+| `--cu-font-size-xs` | 12px | field hints, panel subtitles, chips |
+| `--cu-font-size-sm` | 13px | tabs, small buttons, dense body |
+| `--cu-font-size-md` | 14px | default body text, table cells |
+| `--cu-font-size-lg` | 15px | panel header, emphasized row title |
+| `--cu-font-size-xl` | 16px | card and section title |
+| `--cu-font-size-2xl` | 18px | page subhead |
+| `--cu-font-size-3xl` | 22px | page hero |
+| `--cu-font-size-4xl` | 28px | auth hero only |
+
+Weights are `--cu-font-weight-regular` (400), `--cu-font-weight-medium` (500),
+`--cu-font-weight-semibold` (600), and `--cu-font-weight-bold` (700). Line
+heights are `--cu-line-height-tight` (1.2) for headings,
+`--cu-line-height-normal` (1.45) for body and hints, and
+`--cu-line-height-relaxed` (1.5) for the page body default. Monospaced text uses
+`--cu-font-mono`; do not write out a monospace stack by hand.
+
+Do not add a font-size token outside this scale. The scale is intentionally
+narrow, and a value that does not fit is a design decision to raise, not a token
+to add.
+
+**This scale intentionally differs from Desktop's.** `--cu-font-size-md` is
+**14px** here; `--font-size-md` in `desktop-app/ui/src/styles/tokens.css` is
+**13px**. Desktop's scale has no 14px or 16px step, and Control UI relies on
+both. The prefixes differ (`--cu-` versus bare), the values differ, and that is
+deliberate. Do not "align" them without an explicit design decision.
+
+Spacing uses `--cu-space-0` (2px), `--cu-space-05` (4px), then `--cu-space-1`
+through `--cu-space-7` (0.35rem, 8px, 12px, 16px, 20px, 24px, 32px). Radii are
+`--cu-radius-xs` (4px), `--cu-radius-sm` (8px), `--cu-radius` (12px), and
+`--cu-radius-pill`. Transitions use `--cu-motion-fast` or `--cu-motion-base`.
+Prefer an existing token over a raw `rem` or `px` value.
+
+Every `--cu-*` name a rule references must be declared in `app/globals.css`.
+`var(--cu-missing)` with no fallback is invalid at computed-value time, so the
+whole declaration is silently dropped. `var(--cu-missing, something)` does use
+the fallback, but it hides the fact that the token was never defined and locks
+the rule to whatever the fallback happens to be. Declare the token instead of
+leaning on either behaviour.
+
+## Tables and row actions
+
+- Column headers use `--cu-font-size-2xs`, semibold, uppercase, `0.05em`
+ letter-spacing. A sortable header is a button with the same type treatment as
+ a static one; sorting is signalled by the arrow and a hover color, never by a
+ different font size or casing.
+- Right-align numeric columns and set `font-variant-numeric: tabular-nums` so
+ digits line up.
+- Keep the table element and its header row mounted through loading, empty, and
+ error states. Only the body changes. An empty result renders a full-width row,
+ not an unmounted table.
+- Row actions run in a fixed order: utility, then edit, then destructive, then
+ the detail-open chevron. The chevron sits at the right edge and is the only
+ affordance for opening a detail view.
+- `app/cost-and-usage/llm-prices` is the reference implementation for a route
+ table, including state-dependent row affordances.
+
## Routing
- Sidebar destinations and shareable tab-like sections use canonical Next App