Repository navigation
Leverage @wordpress/base-styles admin schemes stylesheet instead of duplicate declarations in various packages - #69130
Conversation
… 3rd parties and WordPress Core
…chemes` style dependency
|
Size Change: -9.37 kB (-0.36%) Total Size: 2.57 MB
ℹ️ View Unchanged
|
This comment was marked as resolved.
This comment was marked as resolved.
|
Thanks for the PR! Are there any discussions or concrete plans for the future regarding this? I would like to understand what this PR ultimately wants to achieve. By the way, it may also be worth knowing that the |
|
Hi @t-hamano 👋 The reason behind this PR here is that @karmatosed and I are working working on some CSS refreshes to the general wp-admin css (outside of the editor). In order to make these updates one of the first goals is to replace a lot of the hardcoded duplicate color values in the core css with the appropriate CSS custom properties that are coming from this base-styles package. Today we are using the mixin in several packages and therefore have that CSS duplicated in lots of places. By moving it into a separate CSS file that gets enqueued in WordPress Core we can remove all that duplication and also make it available everywhere to be used. As far as the updating to modern dart sass syntax etc thats something that should be done yes, but it has nothing to do with this first step of simply adding a built version of the generated output to the NPM package that we can then consume in core :) Let me know if you have any additional questions or concerns :) |
This comment was marked as resolved.
This comment was marked as resolved.
|
@t-hamano the reason why I am leaning to the built file here is that we want to reduce the duplication across the various packages. So having one shared CSS file that outputs all these variables is preferred to including the Mixins in all places. And since we want that file to exist in core and in Gutenberg distributing it here this way seems the most flexible but also easiest |
|
I overall agree with this approach. This stylesheet should be loaded in all WP-Admin pages. |
karmatosed
left a comment
There was a problem hiding this comment.
In testing everything works as expected - thank you. I am excited to get this in.
This comment was marked as resolved.
This comment was marked as resolved.
7e52484 to
9397ad2
Compare
|
Hey @t-hamano 👋 I've made all the updates you've suggested. I also updated the wp core patch here with the same updates: WordPress/wordpress-develop#8909 Would love to get this merged soon to unblock the Admin reskin work for 7.0 :) Let me know if you have any additional questions / concerns. |
|
Thanks for the update! Perhaps the restriction of export fields in this PR is causing sass-loader to fail to resolve modules, causing Storybook to fail to build. This can be resolved by exporting all assets as shown below, but I'm not sure if this is the ideal approach 🤔 diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json
index 967e5fc027..6806f910a3 100644
--- a/packages/base-styles/package.json
+++ b/packages/base-styles/package.json
@@ -28,7 +28,14 @@
"module": "index.js",
"exports": {
"./package.json": "./package.json",
- "./build-style/": "./build-style/"
+ "./build-style/": "./build-style/",
+ "./variables": "./_variables.scss",
+ "./colors": "./_colors.scss",
+ "./mixins": "./_mixins.scss",
+ "./breakpoints": "./_breakpoints.scss",
+ "./animations": "./_animations.scss",
+ "./z-index": "./_z-index.scss",
+ "./default-custom-properties": "./_default-custom-properties.scss"
},
"wpScript": true,
"publishConfig": {Another concern is that there are two projects related to redesigning the admin screens or design system. I'm wondering if these are separate efforts, or if there's any connection between them.
cc @WordPress/gutenberg-components |
|
@t-hamano from my vantage point they are two entirely separate project that have different goals. The work from the components team happening here in the Gutenberg repo in #71196 is for the eventual complete rewrite of the wp admin in react. That is the long term goal and not in scope for 7.0 / doesn't even have a clear timeline yet. It is super important and I wish we could just ship that. But it isn't ready. So because the current design of the admin has diverged so much over time to what is happening in the site editor / block editor, the CSS only reskin for 7.0 has been created as a small scrappy project to just modernize it a bit with what we already have :) |
|
@fabiankaegy Thanks for the detailed explanation! Now let's fix the issues in the storybook build and ship this PR. |
This is needed for the storybook build for example
|
@t-hamano 🤦♂️I forgot to add the props. Sorry about that |
| // Until #37466, we can't specifically add them as editor styles yet, | ||
| // so we must hard-code it here as a dependency. | ||
| 'wp-block-editor-content', | ||
| 'wp-base-styles', |
There was a problem hiding this comment.
It feels a bit weird to me that this is added to the blocks editor styles. Logically, it seems better to add as a dependency to all the scripts that do React.render instead (top level scripts like edit-post, edit-site, ...)
There was a problem hiding this comment.
I think that's ok, but how are we adding this dependency to the "top level" packages. I think it's not a guarantee that these top packages will depend on "blocks", especially if we start lazy-loading the editor for instance in the site editor.
Anyway, not a huge deal for now as long as it works :)
|
It probably didn't start with this PR but I noticed that the new "fonts" page (and any boot related pages) aren't reacting to the user profile properly yet. |
This appears to be because the boot-related pages use a theme provider. The theme provider outputs similar CSS variables via legacyWpAdminThemeOverridesCSS, but these CSS variables do not reflect the user's color scheme. Perhaps we can remove the output of this legacy CSS variable from the theme provider. |
This is a good question I don't know :P I feel like both the "ThemeProvider" and these mixins have the same purpose. I think maybe the right fix is to actually feed the "ThemeProvider" the right color based on the WP user profile (instead of a hard-coded value like today). cc @aduth what do you think? |
Interesting, we probably need to extend the user endpoint to expose the color setting, right? |
Seems like it yes. |
|
Yes, my expectation is that how the component receives the primary seed color value would be how we can expect to support the existing user color preference, which would generate both the new and established CSS properties for colors (backwards and future compatible). |
|
Exposing the color preference through the user endpoint might be a good idea generally, though I'm not sure if we strictly need it. We might be able to pass through † Passing through could be done at the consumer level or maybe |
|
Following-up on user preference theming in #74011 |

What?
Continuation of #69128
Replace any instances of
@include wordpress-admin-schemes()in the various packages with thewp-admin-schemesstyle handle.Why?
To remove the duplication of these styles. This is a first step before we add the
wp-admin-schemeshandle on every single wp-admin page so that the CSS custom properties can get leveraged everywhere in core.How?
By adding a new style handle called
wp-admin-schemesthat we use as a dependency instead of manually including the mixin in all the packages individually.Testing Instructions