-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Section Styles: improve performance and conceptual consistency #6873
Section Styles: improve performance and conceptual consistency #6873
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Thanks, @oandregal. I'm happy to do some additional profiling here if you all would find it helpful while continuing to iterate on the GB PR. It doesn't seem like this changes much of the impact when there are no new variations registered. It may also be helpful to run some A/B performance tests when additional block variations are added to a theme to make sure the processing doesn't increase as additional theme.json files are added to the |
In the interests of time, I've push a couple of commits to bring this in line with the latest updates over in WordPress/gutenberg#62712. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just given this a manual test, and it's all working for me here as it is over in WordPress/gutenberg#62712:
✅ theme.json partials are registered automatically and available in post and site editors, and output correctly
✅ Block styles nested within a partial are working correctly
✅ Nesting multiple blocks each using variations is working correctly
✅ Variations defined in the root theme.json file's style.variations are not registered automatically
✅ Variations defined in the root theme.json file that have been registered separately elsewhere have their styles applied correctly in the site editor and site frontend
✅ Updating block style variations in the site editor works correctly, and the updates are applied where expected
Most things are testing well for me however I've run into an issue with theme style variations. In this PR, it appears as though the theme.json partial defined block style variations are omitted from the response. The endpoint doesn't appear to register those variations at the moment. The catch though is neither does that endpoint in Gutenberg which is working. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most things are testing well for me however I've run into an issue with theme style variations.
Thanks for the quick turnaround here @oandregal 🚀
After the fix in 270a4e5 this is looking good!
✅ Theme.json partials have their variations registered automatically
✅ Theme.json partial defined variations could be applied in both editors and are reflected on the frontend correctly
✅ Non registered variations under styles.variations
were omitted as expected
✅ Registered variations under styles.variations
were included
✅ Tweaking variations in global styles worked and was reflected in editors and frontend
✅ Nesting applications of block style variations works
✅ Theme style variation defined block style variations were updated correctly on selection
Screen.Recording.2024-06-24.at.6.02.33.PM.mp4
Committed in https://core.trac.wordpress.org/changeset/58466 |
Trac ticket https://core.trac.wordpress.org/ticket/61451
Follow-up work for https://core.trac.wordpress.org/ticket/61312
Backports WordPress/gutenberg#62712
The changes in WordPress/gutenberg#62712 make optimizations around the processing and registration of shared block style variations in theme.json as well as simplify the mental model for the feature increasing conceptual consistency.
These changes involve:
styles.blocks.variations
tostyles.variations
blockTypes
fromstyles.variations
.WP_Theme_JSON_Resolver
andWP_Theme_JSON
classes as per #6868Testing Instructions
register_block_style
/styles
directory includingblockTypes
styles.variations
register_block_style
or a theme.json partial as wellregister_block_style
, theme.json partials, or in core block typesstyles
property such as Button's Outline style)`register_block_style` Example
Theme.json Partial Example
Theme Style Variation Example (`styles.variations`)