You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
adds a small typed design-token tree in src/tokens that acts as the single origin for the app's design values. instead of hand-writing the same CSS variables twice, the token module generates the :root custom properties and the root layout injects them at render time, so there's one source and nothing to drift. the token() helper hands back a var() reference and is generic over the tree, so a wrong name is a compile error rather than a silent typo. also threw in a /tokens route that renders the swatches straight from the tree (stays a server component, no client JS) and wired the home page link to it. tests cover the kebab-casing, the var generation, empty groups, and the round-trip back into a :root rule anyway.
walked through this again before merging. src/tokens/tokens.ts holds the values as one as const tree and exports the group/key types off it. index.ts is the only thing that knows how a token becomes a CSS name: varName() does the kebab-casing once, cssVarName/token wrap it with the generic key constraint so callers can't pass a name that isn't in the tree, and tokensToCssVariables/cssVariablesToRootRule walk the tree into a :root block. layout.tsx calls those at module scope and drops the result into a <style>, which is why globals.css lost its hardcoded token block. next build confirms / and /tokens both prerender static with no client JS, so the token route is a pure server component. only thing i left for later is light/dark theming, which is a second :root under a media query and belongs in its own PR.
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
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.
adds a small typed design-token tree in src/tokens that acts as the single origin for the app's design values. instead of hand-writing the same CSS variables twice, the token module generates the :root custom properties and the root layout injects them at render time, so there's one source and nothing to drift. the token() helper hands back a var() reference and is generic over the tree, so a wrong name is a compile error rather than a silent typo. also threw in a /tokens route that renders the swatches straight from the tree (stays a server component, no client JS) and wired the home page link to it. tests cover the kebab-casing, the var generation, empty groups, and the round-trip back into a :root rule anyway.