Repository navigation
Shared design rules for the stylesheets: tokens, a short contract and a drift check #747
JDProfresh
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
More and more of us are adding UI to Codeman, and many of us work with an agent that reads
CLAUDE.mdbefore it touches anything. For the stylesheets there's nothing for it to read yet, so every PR picks its own sizes, spacing and colours, and the files keep growing new one-off values. I'd like to propose a small set of shared rules for that, and I'm raising it here first because it touches the files everyone edits and because the visual decisions are yours.What it looks like today
Measured on master at 1.47.0 (
f1f7eec4), acrossstyles.css(23,337 lines) andmobile.css(4,208 lines):font-size0.62rem,0.63rem,0.64rem,0.645remand0.65remall appear)paddingborder-radiusz-index!importantSince September 1, 203 commits from 11 people have changed those two files. None of that is anyone doing something wrong; there's just no shared scale to reach for, so a new rule copies whatever its neighbour uses or picks a new value.
What I'm proposing
One additive PR that changes no pixels and adds no dependency:
css/tokens.css:--cm-*names for type sizes, spacing, radii, control heights, motion, and semantic colours that point at the existing skin variables (no new hues; colour stays with the skins). The z-index stack already documented insrc/web/CLAUDE.mdgets names, with its values unchanged. The file sits in a cascade layer, so it can only add names and can never override an existing rule.docs/design-system.md, with a pointer fromCLAUDE.mdandsrc/web/CLAUDE.md: new rules read tokens instead of raw values, colour belongs to the skins, overlays take a layer from the named stack, and where a new rule goes.npm run check:css: a small script that counts the distinct values in the table above and fails when a count goes up over a committed baseline. Reading a token never counts, so following the contract is always free. To be clear about what it is: it caps how many different values exist, it doesn't prove a new rule uses tokens.What it deliberately doesn't do: no restructuring of
styles.cssormobile.css, no visual changes, and no renaming of existing classes.What could come after, only if you want it
.cm-btn, menus, dialogs, switches, banners), each family arriving in its own PR together with the existing markup moved onto it and the old rules deleted, so nothing ships unused and nothing is styled from two places.Questions
--cm-*names in a cascade layer the shape you'd want, or would you prefer plain:rootvariables?0.66remfont size until it uses a token or an existing value, which is the point but is also new friction for everyone sending CSS.docs/design-system.mdwith pointers, or directly insrc/web/CLAUDE.mdnext to the other frontend rules?If it's a yes in some shape, I'll send the first part as one PR referencing this thread.
All reactions