Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/style.css

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
"build": "tsc --noEmit && vite build",
"preview": "vite preview",
"typecheck": "tsc --noEmit",
"lint": "eslint src tests vite.config.ts playwright.config.ts playwright.contract.config.ts",
"lint": "eslint src tests packages vite.config.ts playwright.config.ts playwright.contract.config.ts",
"lint:fix": "eslint --fix src vite.config.ts",
"test:e2e": "playwright test",
"test:e2e:ui": "playwright test --ui",
"test:contract": "playwright test --config playwright.contract.config.ts"
},
"dependencies": {
"@fold-run/ui": "workspace:*",
"@tanstack/react-query": "^5.90.2",
"@tanstack/react-router": "^1.132.0",
"preact": "^10.27.2"
Expand Down
83 changes: 83 additions & 0 deletions packages/ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# @fold-run/ui

fold's design system, in one place: the tokens, the four self-hosted font
subsets with their provenance, and the wordmark.

It exists because there are two consoles and there was one design system
maintained twice:

| | |
| --- | --- |
| `fold-run/fold-console` | the OSS gateway's `/console` page, vendored into every fold binary |
| `fold-run/fold-cloud` `services/console` | the hosted control plane |

They had already drifted. The fonts were byte-identical but only one repo
carried the provenance; the wordmark path was identical but only one repo had
the transform helper; and the token for a drawn relationship was `--fold-line:
#6E6E6E` in one and `--wire: #707070` in the other — the same concept, two
names, two values, and two rationales, one of which had the arithmetic wrong.

## What is in it

| | |
| --- | --- |
| `tokens.css` | the `:root` token set and the four `@font-face` rules |
| `public/fonts/` | the four woff2 subsets, plus `OFL.txt` |
| `fonts-src/sources.json` | upstream releases pinned by tag and sha256 |
| `scripts/subset-fonts.py` | regenerates the subsets; refuses a download that does not match |
| `src/Wordmark.tsx` | the mark, and `wordmarkTransform` for placing it in a drawing |

## Consuming it

Inside this repo it is a workspace dependency (`workspace:*`) and needs
nothing else.

From outside, pnpm resolves it out of the repo by path, pinned to a commit —
the same discipline fold uses for `CONSOLE_COMMIT` and `CONFORMANCE_COMMIT`,
and for the same reason: a tag is mutable, and the safety property is that
what you build is a function of an immutable upstream point.

```jsonc
// fold-cloud/services/console/package.json
"dependencies": {
"@fold-run/ui": "github:fold-run/fold-console#<40-hex>&path:/packages/ui"
}
```

Then:

```css
@import '@fold-run/ui/tokens.css';
```

```tsx
import { Wordmark } from '@fold-run/ui/Wordmark'
```

The package ships **source**, not a build. Both consumers are Vite + Preact
and compile it themselves, which is why there is no build step here and no
registry to publish to.

### The fonts need a copy step

`tokens.css` references the faces at root-absolute `url(/fonts/…)`, so they
are public assets rather than module imports — deliberately, and the reason is
in the comment above the `@font-face` block: a module import lets the bundler
rename them or content-address them into a single deduplicated file, and fold's
vendoring manifest pins those four filenames exactly.

So a consumer has to place `public/fonts/` at its own root. In this repo that
is `publicDir` in `vite.config.ts` pointed straight at the package. A consumer
that already uses its own `public/` for other things copies them in a prebuild
step instead.

## Changing a token

A change here changes both consoles. That makes it a change to how the product
looks, not to one page's stylesheet — so it wants the same review a visual
change gets, and a rebuild of both consumers.

Contrast numbers in the comments are load-bearing and have been wrong before.
Recompute rather than copying a claim forward; WCAG 1.4.11 asks 3:1 of any
graphic required to understand the content, and axe does not evaluate stroke
contrast, so nothing in CI will catch a false one for you.
File renamed without changes.
26 changes: 26 additions & 0 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "@fold-run/ui",
"version": "0.1.0",
"private": false,
"license": "Apache-2.0",
"type": "module",
"description": "fold's design system: tokens, the self-hosted font subsets, and the wordmark. Shared by fold-console and fold-cloud's console.",
"exports": {
"./tokens.css": "./tokens.css",
"./Wordmark": "./src/Wordmark.tsx",
"./package.json": "./package.json"
},
"files": [
"tokens.css",
"src",
"public",
"fonts-src",
"scripts"
],
"peerDependencies": {
"preact": ">=10"
},
"scripts": {
"fonts": "python3 scripts/subset-fonts.py"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
108 changes: 108 additions & 0 deletions packages/ui/tokens.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/* fold design tokens — from fold.run's DESIGN.md / DESIGN.json, 2026-08-10
revision. Dark-only by design: the brand has no per-origin theming.

THIS FILE IS SHARED. It is the one definition of fold's design system, and
it is consumed by both surfaces that render the product:

- fold-run/fold-console (this repo) — the OSS gateway's /console page
- fold-run/fold-cloud services/console — the hosted control plane

It was two definitions until they drifted, which is the argument for the
package: the same system was maintained twice, and the copies disagreed on
the one token where the number actually matters (see --fold-line below).
A change here reaches both consoles, so it is a change to the product's
appearance and not to one page's stylesheet.

Two rules from that revision drive everything below:
1. Live is a proof signal, not a colour scheme. It is licensed to
status-up, the active route in a topology drawing, and the focus ring.
Never a button, never a chip, never a border.
2. Actions run on the neutral ramp — an Action fill (Signal white) with
Backplane ink is the brightest element on the page and needs no hue.
One radius: 2px, on every surface including buttons. */

/* Four static subsets, one per family per weight, generated from the variable
sources in fonts-src/ by scripts/subset-fonts.py, both in this package.

They were four files before too, but the -400 and -600 of each family were
byte-identical: both were the variable font with its wght axis intact and a
default of 400. A face declared `font-weight: 600` whose file carries no 600
instance renders the outlines it does have, so nothing here was ever
actually bold — and it cost twice. Instancing drops the variation tables, so
two real weights now cost less than half of what one duplicated variable
font did.

The fonts live in this package's public/ rather than being imported as modules, and the
URLs are root-absolute so Vite treats them as public assets and applies
`base` (./) without touching the names. fold's manifest pins these four
filenames exactly, and a module import would let the bundler rename them —
or, being content-addressed, silently deduplicate any two that ever became
identical again, leaving fold's sync looking for files that were never
emitted. CI asserts all four differ. */
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/IBMPlexSans-400-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/IBMPlexSans-600-latin.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/GeistMono-400-latin.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/GeistMono-600-latin.woff2) format('woff2'); }
:root {
--bg: #121212; /* Backplane — page ground */
--card: #1A1A1A; /* Rack — panels, code */
--card-hi: #212121; /* Rack, lifted — hover step */
--line: #2B2B2B; /* Trace — hairlines */
--line-hi: #3D3D3D; /* Trace Bright — hover borders, secondary edge */
--fg: #FFFFFF; /* Signal — 18.7:1 */
--muted: #BCBCBC; /* Static — muted text (9.9:1) */
--carrier: #E0E0E0; /* links, labels (14.2:1) */

--live: #D6FF00; /* PROOF ONLY — status-up, focus ring */
--down: #FF4C79; /* status failures only */
/* Fold Line — the faintest a *drawn relationship* may be. Meaningful diagram
graphics only, never a border or a rule.

WCAG 1.4.11 asks 3:1 of any graphic required to understand the content,
and in a topology drawing the edges ARE the content. Trace Bright is
1.72:1 on Backplane, right for a border and wrong for a line somebody has
to read; this clears the bar at 3.78:1, with headroom for a 1.5px stroke
that antialiases toward its background, while staying far below Static so
a connection nobody has made still recedes behind one that works.

The value is #707070 and not the #6E6E6E this console shipped before the
two token sets were merged. That one measured 3.67:1, not the 4.0:1 its
comment claimed — the arithmetic was wrong in the direction that matters,
and fold-cloud's copy had already been corrected without this one being
told. Both cleared 3:1, so nothing was failing; the number in the comment
was the thing that was false. axe cannot catch this: it does not evaluate
stroke contrast, which is how a green scan sits on top of a wrong claim.

fold-cloud's canvas calls this --wire; it aliases to this token. */
--fold-line: #707070;

/* Actions are neutral. Signal fill / Backplane ink is 18.7:1. */
--action: #FFFFFF;
--action-ink: #121212;
--action-hover: #D4D4D4;

--radius: 2px; /* machined — one radius, every surface */
/* The marketing surfaces set controls at 44px. A console is a denser class
of surface: this shell stacks a token field, a filter row and a picker
above a table, and 44px on each would push the federation below the fold
on a laptop. Radius, ramp and type stay identical. */
--control-h: 34px;
--page: 84rem;

--sans: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
--mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

/* Motion is state, never decoration, so the vocabulary is deliberately
small: one duration for a colour change, one for something arriving, and
a single exponential ease. No bounce; an instrument does not overshoot. */
--ease: cubic-bezier(0.25, 1, 0.5, 1); /* ease-out-quart */
--dur-tint: 120ms;
--dur-move: 180ms;

/* Named, so nobody reaches for 9999. */
--z-sticky: 10;
--z-toast: 40;
--z-skip: 60;

color-scheme: dark;
}
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The console app is the workspace root; packages/ holds what it shares with
# fold-cloud's console. Consumers outside this repo resolve packages/ui through
# pnpm's git-dependency path syntax rather than a registry — see
# packages/ui/README.md.
packages:
- 'packages/*'
2 changes: 1 addition & 1 deletion src/components/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { Link, useRouterState } from '@tanstack/react-router'
import { useEffect, useRef, useState } from 'react'
import type { ComponentChildren } from 'preact'
import { Wordmark } from './Wordmark'
import { Wordmark } from '@fold-run/ui/Wordmark'
import { Palette } from './Palette'
import { useMcp } from './McpProvider'
import type { FederationState } from '@/lib/federation'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Topology.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//
// Everything else — the per-upstream detail — stays in the table, which is why
// each node here is a link into the detail route rather than a tooltip.
import { WORDMARK_PATH, wordmarkTransform } from './Wordmark'
import { WORDMARK_PATH, wordmarkTransform } from '@fold-run/ui/Wordmark'
import type { FederationState, UpstreamHealth } from '@/lib/federation'
import { latency } from '@/lib/format'

Expand Down
92 changes: 7 additions & 85 deletions src/styles/app.css
Original file line number Diff line number Diff line change
@@ -1,94 +1,16 @@
/* fold console — design tokens from fold.run (DESIGN.md / DESIGN.json,
2026-08-10 revision). Dark-only by design: the brand has no per-origin
theming. Fonts are the site's self-hosted OFL subsets (IBM Plex Sans +
Geist Mono), embedded in the binary like every other asset — the CSP keeps
all fetches on-origin.

Two rules from that revision drive everything below:
1. Live is a proof signal, not a colour scheme. It is licensed to
status-up, the active route in a topology drawing, and the focus ring.
Never a button, never a chip, never a border.
2. Actions run on the neutral ramp — an Action fill (Signal white) with
Backplane ink is the brightest element on the page and needs no hue.
One radius: 2px, on every surface including buttons.
/* fold console — the page's own styles.

The design system itself is not here. Tokens, the four @font-face rules and
the font files live in @fold-run/ui, shared with fold-cloud's console so the
two surfaces cannot drift; this file is what only this console needs. Change
a colour or a radius there, not here.

One constraint the shipped CSP adds, which is easy to violate by habit in
JSX: `default-src 'self'` covers style-src, and no 'unsafe-inline' is
granted. A `style={{…}}` prop is a style attribute, and the browser drops
it. Every value that varies must therefore be a class, not an inline
declaration — CI greps for the prop. */

/* Four static subsets, one per family per weight, generated from the variable
sources in fonts-src/ by scripts/subset-fonts.py.

They were four files before too, but the -400 and -600 of each family were
byte-identical: both were the variable font with its wght axis intact and a
default of 400. A face declared `font-weight: 600` whose file carries no 600
instance renders the outlines it does have, so nothing here was ever
actually bold — and it cost twice. Instancing drops the variation tables, so
two real weights now cost less than half of what one duplicated variable
font did.

The fonts live in public/ rather than being imported as modules, and the
URLs are root-absolute so Vite treats them as public assets and applies
`base` (./) without touching the names. fold's manifest pins these four
filenames exactly, and a module import would let the bundler rename them —
or, being content-addressed, silently deduplicate any two that ever became
identical again, leaving fold's sync looking for files that were never
emitted. CI asserts all four differ. */
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/IBMPlexSans-400-latin.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/IBMPlexSans-600-latin.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/GeistMono-400-latin.woff2) format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/GeistMono-600-latin.woff2) format('woff2'); }

:root {
--bg: #121212; /* Backplane — page ground */
--card: #1A1A1A; /* Rack — panels, code */
--card-hi: #212121; /* Rack, lifted — hover step */
--line: #2B2B2B; /* Trace — hairlines */
--line-hi: #3D3D3D; /* Trace Bright — hover borders, secondary edge */
--fg: #FFFFFF; /* Signal — 18.7:1 */
--muted: #BCBCBC; /* Static — muted text (9.9:1) */
--carrier: #E0E0E0; /* links, labels (14.2:1) */

--live: #D6FF00; /* PROOF ONLY — status-up, focus ring */
--down: #FF4C79; /* status failures only */
/* Fold Line — meaningful diagram graphics only, never a border or a rule.
Trace would vanish at 1.5px on Backplane (1.3:1); this clears the 3:1 bar
for non-text at 4.0:1, which is why fold's system carries it as its own
token rather than reusing the hairline greys. */
--fold-line: #6E6E6E;

/* Actions are neutral. Signal fill / Backplane ink is 18.7:1. */
--action: #FFFFFF;
--action-ink: #121212;
--action-hover: #D4D4D4;

--radius: 2px; /* machined — one radius, every surface */
/* The marketing surfaces set controls at 44px. A console is a denser class
of surface: this shell stacks a token field, a filter row and a picker
above a table, and 44px on each would push the federation below the fold
on a laptop. Radius, ramp and type stay identical. */
--control-h: 34px;
--page: 84rem;

--sans: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
--mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

/* Motion is state, never decoration, so the vocabulary is deliberately
small: one duration for a colour change, one for something arriving, and
a single exponential ease. No bounce; an instrument does not overshoot. */
--ease: cubic-bezier(0.25, 1, 0.5, 1); /* ease-out-quart */
--dur-tint: 120ms;
--dur-move: 180ms;

/* Named, so nobody reaches for 9999. */
--z-sticky: 10;
--z-toast: 40;
--z-skip: 60;

color-scheme: dark;
}
@import '@fold-run/ui/tokens.css';

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.6 var(--sans); }
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
"react-dom": ["./node_modules/preact/compat"]
}
},
"include": ["src", "tests", "vite.config.ts", "playwright.config.ts", "playwright.contract.config.ts"]
"include": ["src", "tests", "packages", "vite.config.ts", "playwright.config.ts", "playwright.contract.config.ts"]
}
Loading
Loading