Skip to content

Commit 9cb1d71

Browse files
adamwoodnzmatticbot
authored andcommitted
Charts: align --wpds-* fallback values with the design system [CHARTS-254] (#51452)
* Charts: align WPDS fallback values with the design system Six `--wpds-*` fallbacks across fifteen call sites carried values the design system had moved on from. A fallback is what actually renders whenever the token is unset, and for typography that is the normal case rather than a corner: WordPress defines no `--wpds-typography-*` at all, so in wp-admin the hand-written value is the one on screen. --wpds-typography-font-weight-emphasis 499 → 600 --wpds-typography-font-size-lg 16px → 15px --wpds-typography-font-size-xl 18px → 20px --wpds-typography-font-family-body sans-serif → the full stack Two more were not stale so much as flattened. The spec fallback for `--wpds-color-background-interactive-brand-strong` and `--wpds-color-stroke-interactive-brand` is itself a chain, `var(--wp-admin-theme-color, #3858e9)`, and writing only the hex pinned the zoom selection to WordPress blue instead of letting it follow the admin colour scheme. `wpds-fallbacks.test.ts` is what stops this recurring: it reads every `--wpds-*` reference under `src` and asks the installed `@wordpress/theme` what each one is worth, so a value that drifts — or a stylesheet reference left bare, which renders as nothing — fails with the value it should have had. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EK9Kr5FFd4tGPD7QWLvKsn * Charts: explain why fallbacks are hand-written here "Fallbacks must match the WPDS spec value" reads like an oversight in 2026 — `@wordpress/theme` ships plugins that inject them and `@wordpress/build` auto-loads them, so a reader who knows that will reasonably try to delete the fallbacks and reference tokens bare. Doing so breaks this package. `dist/` is built by tsdown, which loads no such plugin, and webpack consumers never read `dist/` at all — they resolve the SCSS through the `jetpack:src` export condition and compile it themselves. Record that, and point at the test that reports the value the design system expects, so the rule is followable rather than a thing to be looked up token by token. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EK9Kr5FFd4tGPD7QWLvKsn * Charts: changelog Entries for the package and for every plugin that puts a chart in front of a user. The typography correction is not theoretical for them: nothing WordPress ships defines `--wpds-typography-*`, so in wp-admin the injected fallback is the value that actually renders. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EK9Kr5FFd4tGPD7QWLvKsn * Address review: resolve each token's spec value once (comment #5363666120) The drift check asked the design system for the same token twice on a failing reference — once to decide it had drifted, once to build the message. Resolve it into the reference first, then compare, so the value that fails the assertion is the one that was tested against. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EK9Kr5FFd4tGPD7QWLvKsn * Address review: stop restating token values in prose (comment #5364772095) The semi-circle chart's docs page named the label's font size and weight as "(default 16px)" and "(default 499)" — the two values corrected two files over, and the only place `499` still reached a screen. It is published to Storybook, so the documented defaults contradicted the shipped ones. Drop the values rather than update them. `wpds-fallbacks.test.ts` reads `var()` calls, so a number written in prose is a number nothing keeps honest; restating spec values by hand is the failure this branch exists to remove, and doing it in a docs page is the same failure with no test behind it. The tokens are still named, so a reader has somewhere to look. Also from that review: - `specFallback` sliced off a `var(<token>, ` prefix it assumed was there. It is there only because the upstream plugin throws on an unknown token — an internal of a package this repo does not control. Check the prefix and fail naming the token, so a plugin that stops throwing cannot feed a fragment of the token name into some later assertion. - The scan skipped test directories with `includes( '/test/' )`. Paths are relative to `src`, so a future `src/test/` would arrive as `test/foo.ts` and be audited as source. - The zoom-selection changelog entry was indicative and lowercase. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EK9Kr5FFd4tGPD7QWLvKsn * Charts: fold the two changelog entries into one Both described the same fix from different angles — fallback values that had drifted from the design system — so splitting them across a `fixed` and a `changed` entry read as two unrelated changes in the release notes. The zoom selection's flattened chain was a drift correction as much as the font weights were. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EK9Kr5FFd4tGPD7QWLvKsn * Charts: keep the test out of the published docs The semi-circle chart's docs page explained why it no longer restates the token values, and named the test that would not have caught them. That is a note to whoever edits the page, written on the page itself: readers of the published Storybook are chart consumers, and no other story doc in the package refers to a test file. Say what the reader wants — the tokens resolve to the design system's values — and leave the reasoning in AGENTS.md, where it is aimed at the person who might otherwise write a number back in. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EK9Kr5FFd4tGPD7QWLvKsn --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/32800481068 Upstream-Ref: Automattic/jetpack@26ff720
1 parent 2de84ac commit 9cb1d71

7 files changed

Lines changed: 10 additions & 10 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-rich-text', 'wp-theme', 'wp-url', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '8f47b9b4557467d83650');
1+
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keycodes', 'wp-media-utils', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-rich-text', 'wp-theme', 'wp-url', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '29b66023caa78702656b');

jetpack_vendor/automattic/jetpack-podcast/build/routes/dashboard/content.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-private-apis', 'wp-rich-text', 'wp-theme', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static')), 'version' => 'c34bb5af6048703ce016');
1+
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-components', 'wp-compose', 'wp-data', 'wp-date', 'wp-deprecated', 'wp-element', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-private-apis', 'wp-rich-text', 'wp-theme', 'wp-warning'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static')), 'version' => '022e03cf3a6c535724fc');

jetpack_vendor/automattic/jetpack-premium-analytics/build/modules/externals/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/composer/autoload_files.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
'293c13b83c57dba3ffcaf4c9d7af49fc' => $vendorDir . '/wp-php-toolkit/encoding/utf8.php',
1313
'c2c7ec202e84a85f19abab25dd38d82d' => $vendorDir . '/wp-php-toolkit/encoding/compat-utf8.php',
1414
'713ad46f1f515216614131421c1ab59c' => $vendorDir . '/wp-php-toolkit/encoding/utf8-encoder.php',
15-
'3ece6d8ef10b1c2fd398a0c341044be9' => $vendorDir . '/wp-php-toolkit/data-liberation/URL/functions.php',
1615
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
1716
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
17+
'3ece6d8ef10b1c2fd398a0c341044be9' => $vendorDir . '/wp-php-toolkit/data-liberation/URL/functions.php',
1818
'ec471f3ca20b4a3001a1f5146b94c5d9' => $vendorDir . '/wp-php-toolkit/reprint-exporter/src/utils.php',
1919
'700e9f220ab8246703a73d0e5d5d9192' => $vendorDir . '/automattic/wc-calypso-bridge/wc-calypso-bridge.php',
2020
);

vendor/composer/autoload_static.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class ComposerStaticInit26841ac2064774301cbe06d174833bfc_wpcomshⓥ10_0_0_alpha
1313
'293c13b83c57dba3ffcaf4c9d7af49fc' => __DIR__ . '/..' . '/wp-php-toolkit/encoding/utf8.php',
1414
'c2c7ec202e84a85f19abab25dd38d82d' => __DIR__ . '/..' . '/wp-php-toolkit/encoding/compat-utf8.php',
1515
'713ad46f1f515216614131421c1ab59c' => __DIR__ . '/..' . '/wp-php-toolkit/encoding/utf8-encoder.php',
16-
'3ece6d8ef10b1c2fd398a0c341044be9' => __DIR__ . '/..' . '/wp-php-toolkit/data-liberation/URL/functions.php',
1716
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
1817
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
18+
'3ece6d8ef10b1c2fd398a0c341044be9' => __DIR__ . '/..' . '/wp-php-toolkit/data-liberation/URL/functions.php',
1919
'ec471f3ca20b4a3001a1f5146b94c5d9' => __DIR__ . '/..' . '/wp-php-toolkit/reprint-exporter/src/utils.php',
2020
'700e9f220ab8246703a73d0e5d5d9192' => __DIR__ . '/..' . '/automattic/wc-calypso-bridge/wc-calypso-bridge.php',
2121
);

vendor/composer/jetpack_autoload_filemap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@
3030
'version' => '0.6.2.0',
3131
'path' => $vendorDir . '/wp-php-toolkit/encoding/utf8-encoder.php'
3232
),
33-
'3ece6d8ef10b1c2fd398a0c341044be9' => array(
34-
'version' => '0.6.2.0',
35-
'path' => $vendorDir . '/wp-php-toolkit/data-liberation/URL/functions.php'
36-
),
3733
'320cde22f66dd4f5d3fd621d3e88b98f' => array(
3834
'version' => '1.37.0.0',
3935
'path' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php'
@@ -42,6 +38,10 @@
4238
'version' => '1.38.2.0',
4339
'path' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php'
4440
),
41+
'3ece6d8ef10b1c2fd398a0c341044be9' => array(
42+
'version' => '0.6.2.0',
43+
'path' => $vendorDir . '/wp-php-toolkit/data-liberation/URL/functions.php'
44+
),
4545
'ec471f3ca20b4a3001a1f5146b94c5d9' => array(
4646
'version' => '0.1.47.0',
4747
'path' => $vendorDir . '/wp-php-toolkit/reprint-exporter/src/utils.php'

0 commit comments

Comments
 (0)