Skip to content

feat(tokens)!: standardize component token axis naming#134

Open
wangdicoder wants to merge 1 commit intomasterfrom
feat/token-axis-naming-convention
Open

feat(tokens)!: standardize component token axis naming#134
wangdicoder wants to merge 1 commit intomasterfrom
feat/token-axis-naming-convention

Conversation

@wangdicoder
Copy link
Copy Markdown
Owner

Summary

  • Rename 330 component token keys so variant axes (sizes, states) are always trailing dot-separated segments with property-before-state ordering — matches Atlassian, Polaris, Carbon, and Spectrum conventions.
  • Update 82 public --ty-* CSS variables and 26 consumer SCSS files in packages/react and apps/docs.
  • Migrate themes/dark.json and compile-brand-theme.source.js to the new keys.
  • Add a build-time validator (scripts/build-runtime.js) that rejects dash-joined or mid-leaf axis segments; allow focus-ring as a domain compound and pure-axis leaves like selected-hover.
  • Document the rule in packages/tokens/REGISTRY_SPEC.md.

Examples:

Before After
button.font-size-sm button.font-size.sm
button.solid.primary.bg-hover button.solid.primary.bg.hover
pagination.disabled-bg pagination.bg.disabled
auto-complete.option-active-bg auto-complete.option.bg.active
descriptions.lg-padding-hr descriptions.padding-hr.lg
date-picker.cell-selected-hover-bg date-picker.cell.bg.selected-hover

Release

  • Bump: major
  • Affected: @tiny-design/tokens, @tiny-design/react (fixed-version group)

Breaking changes

  • Public --ty-* CSS variable names for component tokens have changed. Apps overriding these in stylesheets must update to the new names.
  • tokens.components keys in custom theme JSON documents must be migrated.

Test plan

  • pnpm --filter @tiny-design/tokens build
  • pnpm --filter @tiny-design/react build
  • pnpm --filter @tiny-design/react test (810/810 pass, 81 snapshots intact)
  • pnpm --filter @tiny-design/docs build
  • Smoke-test the docs site visually for any visual regressions on theming-heavy components (calendar, date-picker, pagination, menu, table)

🤖 Generated with Claude Code

Rename 330 component token keys so size and state axes are trailing
dot-separated segments with property-before-state ordering, matching the
convention used by Atlassian, Polaris, Carbon, and Spectrum. 82 public
CSS variables are renamed as a result.

Adds a build-time validator that rejects dash-joined or mid-leaf axis
segments, and documents the rule in REGISTRY_SPEC.md.

BREAKING CHANGE: public --ty-* CSS variable names and token registry
keys for component tokens have been renamed. Themes and stylesheets
overriding component tokens must be updated.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant