refactor!: drop the token mirror, leaving the stylesheet as the only copy - #8
Merged
Merged
Conversation
…copy `src/theme/tokens.ts` held `LIGHT_THEME`, `DARK_THEME`, `THEME` and `cssVar`: a TypeScript copy of the values in `styles.css`, kept for a caller that could not read CSS, and a test to hold the two in step. Nothing in the package imported it, no consumer did either, and a second copy of the palette is a second thing that can go stale. The stylesheet is now the only copy. A caller that genuinely needs a value as a string reads it from the document, which also answers for the theme the reader is in; everywhere else `var(--role)` resolves it. `tests/theme/tokens.test.ts` keeps the half that was never about the mirror: every role declared in both themes and nothing else, the palette closed, one `--color-<role>` per role, the radius scale derived from `--radius`, dark mode keyed off the class, no focus geometry in the base layer. The dark-theme check that compared against the mirror now asserts what the mirror could not — that the theme repoints its roles rather than restating the light values. BREAKING CHANGE: `LIGHT_THEME`, `DARK_THEME`, `THEME` and `cssVar` are no longer exported. docs/MIGRATION-0.3.md section 6 has the replacement.
YaelAnaya
force-pushed
the
feat/docs-site-astro
branch
from
September 21, 2026 00:14
35e85ab to
ec597e4
Compare
YaelAnaya
force-pushed
the
refactor/drop-token-mirror
branch
from
September 21, 2026 00:14
b044463 to
9bc02ca
Compare
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.
Stacked on #7. Review that one first; this PR's diff is only the removal.
src/theme/tokens.tsheldLIGHT_THEME,DARK_THEME,THEMEandcssVar: a TypeScript copy of the values instyles.css, kept for a caller that could not read CSS, plus a test to hold the two in step.Nothing in the package imported it. No consumer imported it either. A second copy of the palette is a second thing that can go stale, and ninety-seven hand-maintained lines plus a synchronisation test to protect a caller that never arrived.
What replaces it
A caller that genuinely needs a value as a string reads it from the document, which has the further advantage of answering for the theme the reader is in:
Everywhere else,
var(--role).The test keeps the half that was never about the mirror
Every role declared in both themes and nothing else, the palette closed, one
--color-<role>per role, the radius scale derived from--radius, dark mode keyed off the class, no focus geometry in the base layer.The dark-theme check that compared against the mirror now asserts something the mirror could not: that the theme repoints its roles rather than restating the light values.
Adding a token now touches one place fewer.
Breaking change
LIGHT_THEME,DARK_THEME,THEMEandcssVarare no longer exported.docs/MIGRATION-0.3.mdgains section 6 with the replacement; the "Unchanged" entry that promised they were kept is corrected.Verification
pnpm verifypasses: format, lint, 124 tests in 16 files, the build, the docs site, and the packed-consumer test.