-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Global Styles Framework: Remove the need for GlobalStylesProvider
and GlobalStylesContext
#67534
Comments
Thanks for the issue. Sounds like a plan.
What would these return? User/merged theme config?? If "user", should we think about stabilizing experimentals such as And then, I'm guessing we'll still need the usual suite of utility methods to accompany the API (assuming it's public for third parties). For example, I might be assuming way too much though 😄 |
It would depend on the arguments I think (just like the hook)
I would like for this to be considered after we explore saved style variations. Because that id might change over time. So maybe the
Why? We might even start with private selectors first and open them on a second time. |
Having alignment or consistency between the JS side and the theme.json PHP classes would help make working with Global Styles features easier. |
Because when I read I agree that its complexity should be hidden from the end consumer, e.g., returning base/user/merged via function arguments. So that's also cool! |
Didn't we initially switch to the context instead of the store for performance reasons? I like the proposed solution, but we should watch out for any progressions. |
If I'm not wrong context was there from the start, but maybe my memory is failing me. |
The site editor uses GlobalStylesProvider and GlobalStylesContext to be able to track edits and modifications to global styles and also to make
useGlobalStyle
anduseGlobalSettings
hooks work properly.That API was just an imperfect temporary API and it's not really needed. It's also blocking the possibility of third-party users from accessing global styles and modifying them properly.
Instead of this context and hooks, we should just have
getGlobalStyle
andgetGlobalSetting
selectors incore-data
directly. I don't think the context is needed anymore.One existing place where the "context" might still be helpful is the "style variations previews". That said, the need there is very small, we can instead just try to retrieve the values we need directly from the global styles objects (background, fonts...)
cc @WordPress/gutenberg-core
The text was updated successfully, but these errors were encountered: