Jetpack: resolve WPDS design tokens in legacy dashboard CSS#48750
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
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 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack 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. |
Code Coverage SummaryThis PR did not change code coverage! That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷 |
0eed05d to
0bd237c
Compare
0bd237c to
42ff3eb
Compare
42ff3eb to
9c6a7ee
Compare
9c6a7ee to
ce51425
Compare
ce51425 to
7d06c03
Compare
Feed @wordpress/theme/design-tokens.css into the _inc postcss-global-data so postcss-custom-properties inlines var(--wpds-*, #fallback) to the actual token value (e.g. #707070) instead of the hand-written hex fallback. The legacy _inc dashboard build strips var() (preserve:false) and otherwise has no runtime token source, so token-based colors like Hello Dolly were baked to their fallback (#87a6bc). Modernized admin-ui pages get tokens at runtime via a shared stylesheet instead; preserve:true cannot be used here because calypso-color- schemes' generic vars are not loaded at runtime. Part of #49285.
7d06c03 to
7aae723
Compare
Remove the two legacy Hello Dolly rules now that WPDS design tokens load on every Jetpack admin page (#48750 build-time for the legacy _inc pages, #49345 runtime for modernized pages): - `.wp-admin #dolly` (admin-static.scss, static #87a6bc) - `.jetpack-pagestyles #dolly` (_main.scss, $gray ~= #a1a1a1) The central `.jetpack-admin-page #dolly` rule (token-based, resolves to #707070) now governs consistently. The legacy rules only competed with it at equal specificity. Their `position: relative` used all-zero offsets (visually identical to static), so removal causes no layout shift; Dolly converges to #707070 with hello.php's default padding, and the central rule's `@media (max-width: 659px) { display: none }` already covers the breakpoint the legacy rules handled. My Jetpack's `p#dolly { display: none }` and JITM adjacency are untouched. Verified live on the dev site: Dashboard #dolly computed color #707070, same top/left/width as baseline (no positioning regression). Part of #49285 (Phase 4).
Part of #49285. Companion to #49345 (the runtime half).
Proposed changes
This is the build-time half of WPDS-token loading, scoped to the legacy
_inc/dashboard (Settings / Dashboard / Debugger).projects/plugins/jetpack/tools/postcss.config.js: add@wordpress/theme/design-tokens.cssto the@csstools/postcss-global-datafileslist (alongside the existing calypso-color-schemes entry).projects/plugins/jetpack/package.json: add@wordpress/theme@0.13.0as a direct dependency sorequire.resolve( '@wordpress/theme/design-tokens.css' )(exposed via the package'sexportsmap) resolves deterministically.Why build-time here (and runtime elsewhere)
The
_inc/dashboard's postcss runspostcss-custom-propertieswithpreserve: false, which inlinesvar(--wpds-*, #fallback)to its hex fallback at build time and strips thevar(). So on the legacy dashboard, token-based colors (e.g. Hello Dolly) were baked to#87a6bcand a runtime:root{--wpds-*}stylesheet has nothing to bind to.Feeding the tokens into
postcss-global-datamakespostcss-custom-propertiesinline them to the actual token value (#707070) instead of the fallback.The obvious alternative — flipping
preserve: trueso vars survive to runtime — is not viable here:@automattic/calypso-color-schemes(732 generic vars like--color-text) is only build-time-inlined and not loaded at runtime, so preserving would leave every no-fallback calypso var undefined → broken. That's the exact "extremely generic vars" blocker called out in the existing postcss.config.js comment. The modernized admin-ui pages don't have this constraint (they preservevar()and load tokens at runtime), so they get the runtime stylesheet in #49345 instead.No version skew: both this build-time source and #49345's runtime source come from
@wordpress/theme@0.13.0.Verification
Rebuilt
_inc/build/admin.css:#87a6bc(Dolly fallback) occurrences#707070(token value) occurrencesStandalone postcss check of the config also confirms
.dolly{ color: var(--wpds-color-fg-content-neutral-weak, #87a6bc) }→color:#707070, while a genericvar(--color-text)stays inlined (unchanged) — i.e. no calypso regression.Does this pull request change what data or activity we track or use?
No.
Testing instructions
pnpm jetpack build plugins/jetpack(the CSS/webpack step; an unrelatedcomposer build-developmentstep may fail locally).grep -c 87a6bc projects/plugins/jetpack/_inc/build/admin.css→0;grep -c 707070 …→ non-zero.#707070(neutral gray) instead of the old bluish#87a6bc.