-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publicly expose useGlobalStyle
hook
#63796
Comments
@youknowriad @ellatrix I'd love to get your take on this. Happy to work on the PR etc. But want to see whether there are reasons you would be against exposing the hook publicly. |
@fabiankaegy Do we already have slots or things like that to extend the Global styles sidebar? |
@youknowriad We do not have the UI Slots for it no. But we can make use of it in there areas of the site like on custom plugin screens or even setting sidebars that get rendered in the site / post editor |
I don't think we should be exposing the hook without having a good story how to use it. The hook depends on a provider I wonder if we should double down on this and instead have a hook that rely on That said, I think given all these things are in flux, I'm not confident about opening such APIs today. |
Thanks for all those insights ❤️ From my perspective the UI and the API could be handled separately. If we don't feel we are ready to open up the site editor / global styles for custom UI because it is still moving around too much that's fine. But I believe it would still be very valuable to expose the underlying API to allow for experimentation & exploration outside of the gutenberg plugin. Without the UI slots it won't be nearly as useful and will probably not get used super widely. But thing like enabling more powerful developer oriented global styles UI built into the Create Block Theme plugin would be possible if the API here would be exposed. And yeah that custom implementation would also need to be able to use the |
I wonder if the API is more in flux than the UI at this point, I'd love to see a design exploration about what extensibility slots/hooks we want to enable in the global styles sidebar. I'm not at all against opening the UI for extensibility. |
Thanks for the ping! My toes have definitely been dipped in this area 😄 as part of the recent background image work, but not in any general sense. Here's an issue that directly relates to displaying inherited values: Just so I understand, is the main thrust of this issue that extenders would like to set global styles settings (and/or styles)? I haven't looked very closely, but from instinct, relying on the I suppose then, any hook in the editor package would update the entity record, similar to useGlobalStylesUserConfig.
What do folks think? See related discussion: #60100 (comment) |
I think the first question I would like to answer here personally is whether we think "editing the theme" (which is what this thing is about) is something that the "block-editor" package should be able to do or not. The Now, if we start thinking about editing the theme as well, which we kind of already have with (apply styles globally). I think we need to conceptualize this a bit better rather than jump quickly to solutions. I wonder if a better architecture is to try to decouple "block-editor" from "theme" (or global-styles). So we have:
The remaining question is how these two should communicate between each other. Should they communicate. Should Who injects the GlobalStylesProvider, for WordPress, it seems like the The last question is whether we should automatically "output" the style of the Any other ideas / feedback? |
The
useGlobalStyle
hook has been available in the Plugin for quite some time now. But extenders cannot use it because it currently is a private API.It would be great to be able to use this hook in external plugins however to store custom settings in global styles. I for example have a custom theme that makes a lot of use of
settings.custom
to define a ton of css custom properties. It would be super powerful if I could extend the site editor / a custom settings screen to visually manage these custom properties. Instead of just being limited by what's in core.The text was updated successfully, but these errors were encountered: