Repository navigation
feat(spec): support and document grouped tokens across token categories - #179
Conversation
# Conflicts: # packages/cli/src/linter/index.test.ts
|
Here's a few things I propose needs tweaking. 1. Keep it backwards compatibleThe PR lowers colors:
brand:
primary:
base: "#647D66"Could we make the change additive instead?
2. Describe groups as naming onlyThe current wording suggests
3. Typography group detectionA typography entry is treated as a group based on its shape. Two cases look like they fall through to being parsed as a single token: typography:
sm:
headline-lg: { fontFamily: Public Sans, fontSize: 32px }
note: compact # one non-object child
lg: {} # empty groupAn explicit error for a group with a non-token child, plus tests for both cases, would make this clearer. 4. Follow-up: exportsFrom reading the handlers, a grouped token is stored under a dotted key such as Small things
|
… checks, and clarify organizational groups
|
Good catches - updated all four items and both small things directly in this PR:
|
Design systems need to organize theme modes, responsive scales, and hierarchical token families across token categories without flattened naming boilerplate or raw dots leaking into exported token formats.
Approach
typographythrough a shared token-tree helper with the existing 20-level nesting limit and flat-vs-grouped collision detection, matchingcolors,spacing, androunded.typographyentry is empty (lg: {}), contains a non-token child inside a group (note: compact), or mixes typography properties with nested objects, and recognizeprimaryinside color groups inmissing-primary.color,spacing,rounded, andtypography, nestedcolorsobjects (withDEFAULTshade promotion) plus hyphenated flat scales for Tailwind v3theme.extend, and hyphenated custom properties for Tailwind v4@themeandcss-vars.light,dark,sm,md,lg,xl) indocs/spec.mdandREADME.md, clarifying that groups are organizational only and carry no reserved behavior.Decisions
colorsinjson-tailwindwhile hyphenatingspacing,borderRadius,fontSize, andfontFamily, because Tailwind v3 only flattens nested objects oncolors.Verification
exporttests acrossdtcg,json-tailwind,css-tailwind, andcss-vars, plus groupedtypographyandmissing-primarycoverage (391passing tests acrossbun test,bun run lint, andbun run build).Closes #193