Repository navigation
refactor(design): add DESIGN.md, a semantic token layer and converged primitives - #45
Merged
Merged
Conversation
Documents the surface ladder, border and elevation rules, radius scale, spacing and density tables, three-level text hierarchy, accent discipline, state expressions and component recipes. Every rule names a token or a Tailwind class so a new page can be built without inventing conventions.
…ation Introduces the primitives DESIGN.md describes: - surface-sunken/base/raised/overlay form a monotonic ladder in both colour schemes, replacing the old pair where dark-mode card and sidebar shared one value and the panel/canvas direction flipped between light and dark. - surface-hover/selected are translucent state fills so a row highlights correctly on any surface instead of needing per-panel values. - muted-foreground moves to 0.58 (light) / 0.68 (dark) and a third level, subtle-foreground, is added for meta text. - shadow-elevation and shadow-control replace the six-step shadow scale, which now collapses onto them so a missed shadow-sm/md/lg degrades consistently. Existing token names are kept: background/card/popover/sidebar/accent are now aliases of the ladder, so untouched components inherit the new consistency without a mass rename.
Button, Input, Textarea, Card, Badge, Tabs, Dialog, AlertDialog, Sheet, Select, Tooltip, ContextMenu, Sonner, Checkbox, Switch, Slider, Progress, Empty and PanelHeader now use the surface ladder, the three-level text hierarchy and the two elevation tokens instead of bg-card/bg-popover/ bg-background, bg-accent and shadow-sm/md/lg. Also applies the density table: 36px buttons (32px icon buttons), 36px inputs, 44px panel headers, 16px dialog/card titles, tighter card padding and separators instead of gaps. Rounded values collapse onto md (control), lg (container) and full (pill). Two latent bugs fixed on the way: - Empty's container had 'border-dashed' with no border width, so the intended outline never rendered. - ScrollArea's viewport used rounded-[inherit], a fourth radius value that Root's overflow-hidden already covers.
5 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
DESIGN.mdas the repository's single design source of truth, turns theexisting Tailwind variables into a semantic token layer (surface / text /
elevation), and moves the 22 base primitives in
components/uionto it.No product behaviour changes, no new pages, no new dependencies. This is part 1
of 2; the shell and page refactor is stacked on top of it.
Why?
The token layer already existed, but the system did not. Three concrete
problems measured on
main:background/card/popoverexisted, whilethe UI is a multi-panel desktop app. Worse, the two levels pointed in opposite
directions between themes: in light
card(1.0) > background(0.985), in darkcard(0.263) < background(0.2925), and darkcardandsidebarwere the samevalue. Panel layering was therefore expressed with shadows.
rounded-md26 /rounded-lg25 (nearequal), plus
sm/xl/2xl;shadow-sm12 /shadow-md13 /shadow-lg12mixed with no rule.
only fall back on adjectives.
Fixes #43 (part 1).
What changed?
DESIGN.md(new) — principles, surface ladder, border/elevation rules, thethree radius values, spacing and density tables, the T1/T2/T3 text hierarchy,
accent discipline, the four interaction states, dark-mode requirements, a
do/don't list, component recipes, and the order of decisions for a new page.
Every rule names a token or a Tailwind class; there are no adjectives.
theme.css— new primitives:surface-sunken<surface-base<surface-raised<surface-overlay,monotonic in both colour schemes.
surface-hover/surface-selectedas translucent state fills, so a rowhighlights correctly on any surface instead of needing per-panel values.
subtle-foregroundas the third text level;muted-foregroundadjusted forcontrast (light 0.7055 → 0.58, dark 0.4983 → 0.68; dark was ~2.1:1 before).
shadow-elevation(floating layers) andshadow-control(knobs/handles)replace the six-step shadow scale.
--background/--card/--popover/--sidebar/--accentare kept asaliases of the ladder, so un-migrated components inherit the consistency
without a mass rename. The legacy shadow names all resolve to
shadow-elevation, so a missedshadow-mddegrades to the same elevationinstead of a third style.
Base primitives — Button, Input, Textarea, Card, Badge, Tabs, Dialog,
AlertDialog, Sheet, Select, Tooltip, ContextMenu, Sonner, Checkbox, Switch,
Slider, Progress, Empty, PanelHeader:
rounded-md(control) /rounded-lg(container)/
rounded-full(pill);bg-surface-overlay+ hairline border +shadow-elevation; panels, cards, buttons and inputs lose their shadows;panel headers, 16px dialog/card titles, tighter card padding;
Two latent bugs fixed on the way:
Empty's container hadborder-dashedwith noborder width (the intended outline never rendered), and
ScrollArea's viewportused
rounded-[inherit], a fourth radius value that the root'soverflow-hiddenalready covered.
Related issue
Fixes #43
How was this tested?
npm run lint— 0 errors; warning count unchanged at 118.npm run typecheck— passes (node + web + test configs).npm run build(electron-vite) — passes.reference the primitive variables, and that the
.darkoverrides win:.bg-surface-raised { background-color: var(--surface-raised) },.shadow-elevation { --tw-shadow: var(--shadow-elevation) }.Not verified: the visual result. My environment has no display (no Xvfb), so
I could not launch Electron or capture screenshots — see below.
Screenshots / recordings
I could not capture these: no display is available in the environment this was
built in. The visible changes a reviewer should check are:
card/sidebarwere identical);Checklist
npm run typecheckpasses.npm run buildpasses.Desktop / build changes