WPDS token rename sweep for @wordpress/theme 0.16 (for #49272)#50089
WPDS token rename sweep for @wordpress/theme 0.16 (for #49272)#50089CGastrell wants to merge 3 commits into
Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 🔴 Action required: We would recommend that you add a section to the PR description to specify whether this PR includes any changes to data or privacy, like so: Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Protect plugin: No scheduled milestone found for this plugin. If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Bumps @wordpress/theme 0.15.1 -> 0.16.0 across all package pins, and the two design-system linters to versions whose token vocabulary matches 0.16 (so the renamed tokens validate): - @wordpress/stylelint-config 23.40.1 -> 23.41.0 (wants @wordpress/theme ^0.16.0) - @wordpress/eslint-plugin 25.4.1 -> 25.5.0 (wants @wordpress/theme ^0.16.0) This pairs with @wordpress/ui 0.16.0 already in this branch. theme 0.16 and 0.17 ship an identical token set, so the 0.16 line is a safe, self-consistent matrix; bumping further to the 0.17 line (theme 0.17 / ui 0.16.1 / eslint-plugin 25.5.1) is a separate, optional follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wordpress/theme 0.16 renames the color design tokens and drops the old names: - --wpds-color-bg-* -> --wpds-color-background-* - --wpds-color-fg-* -> --wpds-color-foreground-* - --wpds-color-stroke-focus-brand -> --wpds-color-stroke-focus - --wpds-dimension-base (removed) -> --wpds-dimension-size-5xs (both 4px; calc() preserved) Plus three semantic remaps of tokens that no longer exist: - --wpds-color-bg-surface-primary -> --wpds-color-background-surface-neutral-strong - --wpds-color-stroke-surface-neutral-weaker -> --wpds-color-stroke-surface-neutral-weak - --wpds-font-size-sm -> --wpds-typography-font-size-sm Renames are name-only; token values are unchanged, so there is no intended visual change. Applied across SCSS/CSS and inline-style usages in TSX/TS. Verified: every remaining --wpds-* token in source validates against the 0.16 vocabulary (stylelint plugin-wpds/no-unknown-ds-tokens + eslint @wordpress/no-unknown-ds-tokens both clean). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
eb19a59 to
86f64a6
Compare
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
@wordpress/theme 0.16 promotes ThemeProvider to a stable export and removes `privateApis`. The charts Storybook decorator unlocked `theme.privateApis` to get ThemeProvider, which throws "Cannot unlock an undefined object" under 0.16 and breaks the Storybook tests. Import the stable `ThemeProvider` directly; its props (incl. `color`) are unchanged. Leaves ./unlock orphaned in the charts stories. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| outline: | ||
| var(--wpds-border-width-focus, 2px) solid | ||
| var(--wpds-color-stroke-focus-brand); | ||
| var(--wpds-color-stroke-focus); |
There was a problem hiding this comment.
Is this expected?
There was a problem hiding this comment.
| background-color: #fff; | ||
| padding-bottom: var(--wpds-dimension-gap-sm); | ||
| width: calc(60 * var(--wpds-dimension-base)); | ||
| width: calc(60 * var(--wpds-dimension-size-5xs)); |
There was a problem hiding this comment.
Validate computed value here
There was a problem hiding this comment.
Let's use --wpds-dimension-surface-width-xs instead?
| &:hover, | ||
| &:focus-visible { | ||
| color: var(--wpds-color-fg-interactive-brand-active); | ||
| color: var(--wpds-color-foreground-interactive-brand-active); |
There was a problem hiding this comment.
--wpds-color-fg-interactive-brand-active was #3858e9 in @wordpress/theme 0.15.1, but --wpds-color-foreground-interactive-brand-active is #0b0070 in 0.16 — a real DS value change, not just a name change. So this :active color (the only usage of this token in the sweep) will render a darker indigo once 0.16 lands. Low blast radius, but it's a genuine visual change — worth a smoke-test on the Search experience selector, and the PR body's blanket "values unchanged / no visual change" doesn't hold for this one.
| fontWeight: 600, | ||
| fontSize: 'var(--wpds-font-size-sm, 14px)', | ||
| color: 'var(--wpds-color-fg-content-neutral, #1e1e1e)', | ||
| fontSize: 'var(--wpds-typography-font-size-sm, 14px)', |
There was a problem hiding this comment.
Note on the three "semantic remaps" flagged as the risk surface — all three live in this single Storybook story (non-production). Two of them also shift the rendered value, because the old names were undefined in 0.15 (so they fell through to the inline fallback) while the new names resolve in 0.16:
stroke-surface-neutral-weaker(undefined → fallback#e0e0e0) →stroke-surface-neutral-weak(resolves to#f0f0f0)font-size-sm(undefined → fallback14px) →typography-font-size-sm(resolves to12px)
bg-surface-primary → background-surface-neutral-strong stays #fff. All Storybook-only, so negligible — just flagging that "no visual change" is technically not true here either.
| @@ -1,15 +1,10 @@ | |||
| import { setLocale } from '@automattic/number-formatters'; | |||
| import { privateApis as themePrivateApis } from '@wordpress/theme'; | |||
| import { ThemeProvider } from '@wordpress/theme'; | |||
There was a problem hiding this comment.
With ThemeProvider now imported directly (it became public in 0.16), ./unlock is no longer imported here. Can someone confirm src/stories/unlock.ts is now unused repo-wide? If so it's dead code and can be deleted in this PR (only remaining reference is a doc-comment in premium-analytics/.../lock/unlock.ts).
ciampo
left a comment
There was a problem hiding this comment.
Mechanically, this PR feels solid — although I haven't tested things myself, I just review the code.
Also, would it be possible to update to @wordpress/ui@0.16.1 and to @wordpress/theme@0.17.0 directly?
| outline: | ||
| var(--wpds-border-width-focus, 2px) solid | ||
| var(--wpds-color-stroke-focus-brand); | ||
| var(--wpds-color-stroke-focus); |
There was a problem hiding this comment.
| background-color: #fff; | ||
| padding-bottom: var(--wpds-dimension-gap-sm); | ||
| width: calc(60 * var(--wpds-dimension-base)); | ||
| width: calc(60 * var(--wpds-dimension-size-5xs)); |
There was a problem hiding this comment.
Let's use --wpds-dimension-surface-width-xs instead?
| width, | ||
| height, | ||
| border: '1px solid var(--wpds-color-stroke-surface-neutral-weaker, #e0e0e0)', | ||
| border: '1px solid var(--wpds-color-stroke-surface-neutral-weak, #e0e0e0)', |
There was a problem hiding this comment.
If using wp-build, the fallback values should be added automatically (here and everywhere in the PR / repo)
| width: calc(var(--wpds-dimension-size-5xs, 4px) * 6); | ||
| height: calc(var(--wpds-dimension-size-5xs, 4px) * 6); |
There was a problem hiding this comment.
Same here, let's use --wpds-dimension-size-sm instead?
Proposed changes
Full-repo WPDS design-token rename for
@wordpress/theme0.16, intended to land with the bundled@wordpress/*update (#49272). This branch is based on #49272's head and adds the token sweep on top, kept separate so a Renovate force-rebase of #49272 can't trash it.@wordpress/theme0.16 renames the color tokens and drops the old names, so once #49272 ships@wordpress/ui0.16 the old names go undefined. This renames every usage across the monorepo:--wpds-color-bg-*→--wpds-color-background-*--wpds-color-fg-*→--wpds-color-foreground-*--wpds-color-stroke-focus-brand→--wpds-color-stroke-focus--wpds-dimension-base(removed) →--wpds-dimension-size-5xs(both 4px;calc()preserved → masthead 24px, premium-analytics 240px unchanged)Three tokens that no longer exist were remapped semantically (these are the only non-1:1 cases — the review-risk surface):
--wpds-color-bg-surface-primary→--wpds-color-background-surface-neutral-strong--wpds-color-stroke-surface-neutral-weaker→--wpds-color-stroke-surface-neutral-weak--wpds-font-size-sm→--wpds-typography-font-size-smRenames are name-only — token values are unchanged (confirmed with the DS team), so there is no intended visual change.
Dependency alignment (first commit)
So the renamed tokens validate, the DS linters are moved to versions whose token vocabulary is 0.16:
@wordpress/theme@wordpress/theme(all pins)@wordpress/stylelint-config^0.16.0@wordpress/eslint-plugin^0.16.0Pairs with
@wordpress/ui0.16.0 already in #49272.theme0.16 and 0.17 ship an identical token set, so the 0.16 line is a safe self-consistent matrix; bumping further to the 0.17 line (theme 0.17 / ui 0.16.1 / eslint-plugin 25.5.1) is an optional follow-up for the DS team.Verification
The rename is mechanically complete and machine-verified — every
--wpds-*token left in source validates against the 0.16 vocabulary on both linters:stylelint(plugin-wpds/no-unknown-ds-tokens) — green on all 59 changed CSS/SCSS files.eslint(@wordpress/no-unknown-ds-tokens) — green on all 20 changed TSX/TS files.What CI can't catch is whether a renamed-but-valid token still renders correctly. Since values are unchanged that risk is low, but the three semantic remaps + the
dimension-basecalc sites deserve eyes. Same smoke test the@wordpress/uibump needs anyway.Testing instructions
Token values are unchanged, so each affected surface should look identical to before. Spot-check the dashboards below (compare against trunk):
/wp-admin/admin.php?page=jetpack-forms-admin/wp-admin/admin.php?page=jetpack-premium-analytics/wp-admin/admin.php?page=jetpack-search/wp-admin/admin.php?page=jetpack-newsletter/wp-admin/admin.php?page=jetpack-social/wp-admin/admin.php?page=jetpack-protect/wp-admin/admin.php?page=jetpack-backup/wp-admin/admin.php?page=jetpack-videopress/wp-admin/admin.php?page=jetpack#/settings(Traffic → SEO)dimension-basechange)/wp-admin/admin.php?page=jetpackCouldn't pin a single dedicated screen for: activity-log (renders inside the Jetpack/Backup activity view) and the shared base-styles / charts / components packages (they render within the dashboards listed above rather than a page of their own).
🤖 Generated with Claude Code