USWDS-Elements: restructure tokens into tier-first directory layout (system/theme/state)#287
Draft
ethangardner wants to merge 3 commits into
Draft
USWDS-Elements: restructure tokens into tier-first directory layout (system/theme/state)#287ethangardner wants to merge 3 commits into
ethangardner wants to merge 3 commits into
Conversation
… the semantics of the docs
|
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.
Summary
Migrates the token source from a flat category-first layout (
tokens/{colors,spacing,breakpoints}/) to a tier-first layout. Updates the Style Dictionary config and build helpers to match. No token values change; no published token names change. This does more closely match the documented convention from USWDS' documentation where we have system, theme, and state tokens.Problem
USWDS's color model has three named layers: system (raw palette), theme (branding roles), and state (feedback roles). The previous flat structure of our tokens didn't reflect this
Solution
The tier-first structure aligns the source layout with USWDS's own published vocabulary and is the prerequisite for all subsequent token work. Other tokens implicitly use the system, theme, state convention as well, even if it is not named as such in the documentation. For example,
$theme-modal-lg-max-widthis the semantic (theme) alias for thetablet-lgsystem unit token: https://designsystem.digital.gov/documentation/settings/#configuring-settings-maps.Major changes
Token source files (moves only, no content changes)
tokens/colors/*.json(28 files) →tokens/system/color/*.jsontokens/spacing/spacing.json→tokens/system/spacing/spacing.jsontokens/breakpoints/breakpoints.json→tokens/system/breakpoints/breakpoints.jsonTesting
Token name identity check: