Commit Graph

183 Commits

Author SHA1 Message Date
Sergey Biryukov 6bf8fa1514 Coding Standards: Replace usage of deprecated `wp_get_duotone_filter_svg()`.
This updates `WP_Theme_JSON::get_svg_filters()` to use `WP_Duotone::get_filter_svg_from_preset()` instead of the `wp_get_duotone_filter_svg()` function, deprecated in WordPress 6.3.

Follow-up to [52757], [56101].

Props justlevine.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59455


git-svn-id: http://core.svn.wordpress.org/trunk@58841 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-11-23 22:58:21 +00:00
ramonopoly 70b4a18c97 Theme JSON: include block style variations in path only output of get_block_nodes
An `$include_node_paths_only` option to `get_block_nodes()` was introduced to improve performance.

When set to `true`, this option tells the function to only return paths, and not selectors, for consumers that only needed paths to style values.

For one of the conditional blocks, block style variations wasn't included.

This commit adds them to the array of paths following the existing model `$node[]['path' => [], 'variations' => ['path' => []]]`.

Follow-up to [61858].

Props aaronrobertshaw, ramonopoly.
Fixes #62399.



Built from https://develop.svn.wordpress.org/trunk@59418


git-svn-id: http://core.svn.wordpress.org/trunk@58804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-11-19 04:44:19 +00:00
ramonopoly 16f4229d09 Performance: reuse block metadata in `WP_Theme_JSON::get_valid_block_style_variations()`
In `WP_Theme_JSON::get_valid_block_style_variations()`, the method was calling `self::get_blocks_metadata()` even though the metadata was already retrieved in the parent function. This update reuses the existing block metadata instead of calling it again.  

A new optional parameter, `$blocks_metadata`, has been added to the function, allowing it to use pre-fetched metadata when available, improving efficiency.  

Fewer `self::get_blocks_metadata()` calls mean faster processing, especially in themes with many blocks.

Props mukesh27, ramonopoly, aaronrobertshaw, flixos90.
Fixes #62291.



Built from https://develop.svn.wordpress.org/trunk@59359


git-svn-id: http://core.svn.wordpress.org/trunk@58745 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-11-06 00:44:15 +00:00
ramonopoly 3026f3f46d Theme JSON: replace top-level background style objects on merge
This commit fixes an omission in the logic of `WP_Theme_JSON::merge()` where top-level background image style objects are not replaced, rather they are merged. Because background images are self contained objects, their properties are unique and should not be merged. Blocks are already catered for via `WP_Theme_JSON::get_block_nodes()`.

Follow-up to [61858].

Props ramonopoly, andrewserong.
Fixes #62328.



Built from https://develop.svn.wordpress.org/trunk@59335


git-svn-id: http://core.svn.wordpress.org/trunk@58721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-11-01 05:26:19 +00:00
Sergey Biryukov 2a96d5f4e3 Docs: Correct DocBlock formatting in `wp-includes/class-wp-theme-json.php`.
Follow-up to [52049], [54118], [54162], [55008], [55349], [55959], [55986], [56058], [57496], [58354], [58413].

Props mukesh27, ramonopoly.
See #62279.
Built from https://develop.svn.wordpress.org/trunk@59328


git-svn-id: http://core.svn.wordpress.org/trunk@58714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-30 23:52:17 +00:00
ramonopoly 339ee19db1 Theme JSON: remove redundant styles check and relocate $selectors assignment.
In `WP_Theme_JSON::get_block_nodes()`, remove redundant check for `$theme_json['styles']`, which means `WP_Theme_JSON::get_blocks_metadata()` is only called if necessary.

Also skip unnecessary `$selector` assignment if only nodes are to be returned.

Props ramonopoly, mukesh27.  
Fixes #62234.



Built from https://develop.svn.wordpress.org/trunk@59262


git-svn-id: http://core.svn.wordpress.org/trunk@58654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-21 04:48:16 +00:00
Joe McGill dd274216f1 Editor: Improve performance of WP_Theme_JSON::compute_style_properties
This improves the logic in `WP_Theme_JSON::compute_style_properties` to address a number of performance issues.

Props spacedmonkey.
Fixes #59595.

Built from https://develop.svn.wordpress.org/trunk@59253


git-svn-id: http://core.svn.wordpress.org/trunk@58645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-18 14:26:20 +00:00
Felix Arntz d7fd9dc225 Themes: Improve performance of applying background image styles in `theme.json`.
The cost of using `WP_Theme_JSON::get_block_nodes()` for this in its original shape was high enough to lead to a performance regression. Therefore this changeset introduces a new option on the method that allows to bypass all logic except for retrieving the node paths, which is much faster and everything that this functionality needs.

Follow up to [58936].

Props mukesh27, flixos90, ramonopoly, joemcgill, andrewserong, swissspidy.
Fixes #61858.

Built from https://develop.svn.wordpress.org/trunk@59213


git-svn-id: http://core.svn.wordpress.org/trunk@58606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-10-10 21:07:19 +00:00
ramonopoly 9e650efbb8 Background images: resolve theme.json dynamic ref values and ensure appropriate style default values
The commit syncs the following changes from Gutenberg:

- Background images: add support for theme.json ref value resolution gutenberg#64128
- Background images: ensure appropriate default values gutenberg#64192
- Background image: ensure consistency with defaults and fix reset/remove functionality gutenberg#64328

These changes brings consistency to the default background image styles WordPress applies to user uploaded images, and adds support for ref resolution to "background" style properties.

Props andrewserong, aaronrobertshaw.  

Fixes #61858



Built from https://develop.svn.wordpress.org/trunk@58936


git-svn-id: http://core.svn.wordpress.org/trunk@58332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-26 05:40:16 +00:00
hellofromTonya 713e76f16b Editor: Fix block custom CSS pseudo element selectors in global styles.
Fixes a regression introduced in [58241] where selectors with pseudo elements are wrapped within `:where()` causing malformed CSS and the CSS rule(s) not being applied.

When processing custom CSS for blocks, this changeset:

* Strips the pseudo-elements from the original nested selector, performs the required wrapping in `:root :where`, then re-appends the pseudo-element selector with its leading combinators if present.
* Removes empty CSS rules.

It includes the PHP changes.

Reference:
* PHP changes from [https://github.com/WordPress/gutenberg/pull/63980 Gutenberg PR 63980].

Follow-up to [58241], [56812], [55216].

Props aaronrobertshaw, wongjn, harlet7, dballari, ramonopoly, andrewserong, aristath, hellofromTonya.
Fixes #61769.
Built from https://develop.svn.wordpress.org/trunk@58896


git-svn-id: http://core.svn.wordpress.org/trunk@58292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-14 18:57:19 +00:00
hellofromTonya 30cd5e4ea0 Editor: Fix bumped specificity for layout styles in non-iframed editor.
Fixes a regression introduced in [58241] which inadvertently bumped the specificity in a non-iframed editor for `.editor-styles-wrapper .is-layout-flow > *` from (0,1,0) to (0,2,0). This fix restores theme.json spacing rules taking precedence over the implicit spacing rules in a non-iframed editor.

**The What**

When the block editor is not iframed (which can happen when Custom Fields are active, or blocks that use and older `apiVersion` are present), style rules are processed using post css to append the `.editor-styles-wrapper` class name. This has the effect of scoping the the style rules to ensure they don't affect the editor chrome or admin.

With [58241], one of the rules was changed to `.is-layout-flow > *`. In a iframed editor, the specificity of this rule is okay (0,1,0), but in a non-iframed editor it becomes `.editor-styles-wrapper .is-layout-flow > *`, a specificity of (0,2,0). Comparing this to before [58241], the same rule was `.editor-styles-wrapper :where(body .is-layout-flow) > *` (specificity 0,1,0). This is a regression in specificity that has caused some issues. Notably themes can no longer properly override the spacing for blocks using theme.json and have the results correctly shown in the non-iframed editor.

**The How**

This changeset modifies the selector to `:root :where(.is-layout-flow) > *` (still specificity 0,1,0). `transformStyles` handles 'root' selectors a little differently, it'll instead replace the `:root` part so it becomes `.editor-styles-wrapper where(.is-layout-flow) > *` (keeping the specificity at 0,1,0).

The other layout selector that this affects is the `:first-child` `:last-child` selectors that are responsible for resetting margin at the start and end of a block list. They traditionally have a 0,2,0 specificity so that they can override both the above rule and any rules in the theme.json. Those selectors are also maintained at 0,2,0 with this change, they become something like `:root :where(.is-layout-flow) > :first-child`.

**References:**
* PHP changes from [https://github.com/WordPress/gutenberg/pull/64076 Gutenberg PR 64076].

Follow-up to [58241], [58228], [55956], [54162].

Props talldanwp, aaronrobertshaw, andrewserong, markhowellsmead, ramonopoly, hellofromTonya.
Fixes #61829.
Built from https://develop.svn.wordpress.org/trunk@58890


git-svn-id: http://core.svn.wordpress.org/trunk@58286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-13 17:45:18 +00:00
hellofromTonya 25cd14c509 Docs: Remove bugfix since annotations from WP_Theme_JSON::get_block_nodes().
Removes the `@since` bugfix annotations from `WP_Theme_JSON::get_block_nodes()` docblock. Bugfixes are not annotated in docblocks.

Follow-up to [58856].
See #61704.
Built from https://develop.svn.wordpress.org/trunk@58864


git-svn-id: http://core.svn.wordpress.org/trunk@58260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-07 19:58:17 +00:00
talldanwp f2bf0373a5 Theme JSON: Ensure root selector (body) is not wrapped in :root :where().
Pre-WordPress 6.6, the `body` selector was used for styles associated with the body.

In 6.6, this was mistakenly changed to `:root :where(body)`, an increase in specificity, causing some issues for themes.

This change reverts the specificity increase, styles again use the `body` selector.

Syncs PHP changes from https://github.com/WordPress/gutenberg/pull/63726.

Props talldanwp, andrewserong, aaronrobertshaw, mukesh27, hellofromtonya.
Fixes #61704.


Built from https://develop.svn.wordpress.org/trunk@58856


git-svn-id: http://core.svn.wordpress.org/trunk@58252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-06 08:26:12 +00:00
ramonopoly 38fdd7bb3a Background: add background attachment support to theme.json styles
Introduces the ability to specify a value for `background.backgroundAttachment` in theme.json styles.

The theme.json value determines the CSS value for the `background-attachment` property.

This feature was introduced into the Gutenberg plugin in version 18.9.

Props andrewserong, mukesh27, noisysocks, ramonopoly.

Fixes #61720


Built from https://develop.svn.wordpress.org/trunk@58834


git-svn-id: http://core.svn.wordpress.org/trunk@58230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-07-31 02:41:16 +00:00
noisysocks edb05c5809 Block themes: Enable block-level background image styles
Allows defining background images for blocks in theme.json.

Syncs PHP changes from https://github.com/WordPress/gutenberg/pull/60100.

Props ramonopoly, aaronrobertshaw.
Fixes #61588.

Built from https://develop.svn.wordpress.org/trunk@58797


git-svn-id: http://core.svn.wordpress.org/trunk@58193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-07-24 00:26:14 +00:00
noisysocks a4e3fdfa3a Block Themes: Avoid specificity bump for top-level element-only selectors
Prevent issues (e.g. links being underlined) caused by a bump in CSS
specificity for top-level element-only global element styles.

Backports the PHP changes from https://github.com/WordPress/gutenberg/pull/63403.

Fixes #61630.
Fixes #61660.
Props aaronrobertshaw, andrewserong, noisysocks.

Built from https://develop.svn.wordpress.org/trunk@58749


git-svn-id: http://core.svn.wordpress.org/trunk@58151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-07-18 06:43:18 +00:00
isabel_brison ccc46f8ada Editor: enqueue block custom CSS only when block renders on the page.
Updates the global styles custom CSS handling logic to be consistent with other global styles and take advantage of conditional enqueuing of block styles.

Props isabel_brison, aaronrobertshaw, andrewserong.
Fixes #61395.

Built from https://develop.svn.wordpress.org/trunk@58703


git-svn-id: http://core.svn.wordpress.org/trunk@58105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-07-10 06:19:17 +00:00
isabel_brison eaada5a23c Editor: fix root padding for alignwide blocks.
Updates the root padding CSS selectors so wide width container blocks with constrained layout don’t receive padding.

Props isabel_brison, mukesh27, aaronrobertshaw.
Fixes #61587.

Built from https://develop.svn.wordpress.org/trunk@58685


git-svn-id: http://core.svn.wordpress.org/trunk@58087 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-07-08 06:41:14 +00:00
oandregal 6476fd96ec Section styles: improve performance and conceptual consistency.
These changes involve:

- Move shared variation definitions from styles.blocks.variations to styles.variations
- Remove blockTypes from styles.variations.
- Do not register shared variations from theme style variation or primary theme.json files.
- Move the merging of theme.json data into the WP_Theme_JSON_Resolver and WP_Theme_JSON classes.

These changes improve performance and are more future-proof API wise.
See conversation at https://github.com/WordPress/gutenberg/issues/62686

Props aaronrobertshaw, oandregal, andrewserong, joemcgill, talldanwp, andrewserong, ramonopoly, richtabor, youknowriad.

See #61312, #61451.

Built from https://develop.svn.wordpress.org/trunk@58466


git-svn-id: http://core.svn.wordpress.org/trunk@57915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-24 08:51:16 +00:00
isabel_brison 43b4079e2b Editor: fix root padding for children of alignfull flow layouts.
Updates the root padding CSS selectors so direct children of full width container blocks with flow layout receive padding.

Props isabel_brison, aaronrobertshaw.
Fixes #61464.

Built from https://develop.svn.wordpress.org/trunk@58444


git-svn-id: http://core.svn.wordpress.org/trunk@57893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-20 08:03:14 +00:00
oandregal c9fa3d2f32 Global styles: prevent duplicate CSS for block style variations.
Props aaronrobertshaw, mukesh27, ramonopoly, isabel_brison, oandregal.
Fixes #61443.

Built from https://develop.svn.wordpress.org/trunk@58422


git-svn-id: http://core.svn.wordpress.org/trunk@57871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-17 09:44:10 +00:00
isabel_brison 93177aa249 Editor: fix custom CSS output for block style variations.
Adds custom CSS to the block style variation rules output by `get_styles_for_block` in class `WP_Theme_JSON`.

Props isabel_brison, aaronrobertshaw.
Fixes #61425.

Built from https://develop.svn.wordpress.org/trunk@58421


git-svn-id: http://core.svn.wordpress.org/trunk@57870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-17 03:49:11 +00:00
oandregal d2ebe7d776 Section styles: add slug to override non-kebab-cased variations.
Props aaronrobertshaw, oandregal.
Fixes #61440.

Built from https://develop.svn.wordpress.org/trunk@58413


git-svn-id: http://core.svn.wordpress.org/trunk@57862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-14 09:05:11 +00:00
hellofromTonya b5ec907fb0 Code Modernization: Use wp_trigger_error() instead of trigger_error().
Replaces `trigger_error()` with `wp_trigger_error()`.

The usage of `wp_trigger_error()` avoids generating `E_USER` family errors unless `WP_DEBUG` is on. In doing so, users should not see these messages in normal production.

Notes:
* Removes `E_USER_NOTICE` when passed as an argumnent, as it's the default error level.
* An empty string is passed for the function name when its name is already in the error message or does not add value to the error message.
* Externally maintained libraries are not included.

Follow-up to [55204], [25956], [29630], [38883], [52062], [52049], [54272], [38883], [55245], [51599], [14452], [38883], [24976].

Props prasadkarmalkar, rajinsharwar, thelovekesh, hellofromTonya, swissspidy. 
Fixes #59652.
Built from https://develop.svn.wordpress.org/trunk@58409


git-svn-id: http://core.svn.wordpress.org/trunk@57858 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-13 20:50:14 +00:00
oandregal 43dd91cdc6 Editor: code quality improvements for theme.json migrate API
Backports https://github.com/WordPress/gutenberg/pull/62305

Follow-up to [58328], #61282.

Props ajlende, oandregal, ramonopoly, mukesh27.
Fixes #61282.

Built from https://develop.svn.wordpress.org/trunk@58354


git-svn-id: http://core.svn.wordpress.org/trunk@57806 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-06 08:02:16 +00:00
oandregal 2b50b6ab1d Editor: improve code quality of theme.json classes.
Follow-up to [58328], #61282.

Props ajlende, ramonopoly.
Fixes #61370.

Built from https://develop.svn.wordpress.org/trunk@58339


git-svn-id: http://core.svn.wordpress.org/trunk@57795 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-05 08:13:15 +00:00
ellatrix 5b9f383603 Editor: Add theme.json v3 migrations.
See https://github.com/WordPress/wordpress-develop/pull/6616.
See also the original Gutenberg PRs:
* https://github.com/WordPress/gutenberg/pull/58409
* https://github.com/WordPress/gutenberg/pull/61328
* https://github.com/WordPress/gutenberg/pull/61842
* https://github.com/WordPress/gutenberg/pull/62199
* https://github.com/WordPress/gutenberg/pull/62252

Fixes #61282.

Props ajlende, talldanwp, ramonopoly, ellatrix.


Built from https://develop.svn.wordpress.org/trunk@58328


git-svn-id: http://core.svn.wordpress.org/trunk@57785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-04 11:55:14 +00:00
ellatrix 12bc7a8bcd Editor: add textAlign block support.
See https://github.com/WordPress/gutenberg/pull/59531.
See https://github.com/WordPress/gutenberg/pull/61182.
See https://github.com/WordPress/gutenberg/pull/61717.
See https://github.com/WordPress/wordpress-develop/pull/6590.

Fixes #61256.

Props wildworks, ellatrix.


Built from https://develop.svn.wordpress.org/trunk@58314


git-svn-id: http://core.svn.wordpress.org/trunk@57771 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-04 05:36:20 +00:00
Pascal Birchler bec7acd268 Docs: Improve docblock for `WP_Theme_JSON::get_stylesheet()`.
See #60699.
Built from https://develop.svn.wordpress.org/trunk@58266


git-svn-id: http://core.svn.wordpress.org/trunk@57729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-31 09:40:15 +00:00
noisysocks e2417763fa Fix indentation and whitespace in WP_Theme_JSON and WP_Theme_JSON_Resolver
Props mukesh27.
Follows r58264.
See #61312.

Built from https://develop.svn.wordpress.org/trunk@58265


git-svn-id: http://core.svn.wordpress.org/trunk@57728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-31 06:01:15 +00:00
noisysocks 51c676d7ea Block Themes: Add section styling via extended block style variations
Provide users with the ability to style entire sections of a page without
having to tediously reapply the same sets of styles.

This is done by extending block style variations to apply to nested blocks.

See https://github.com/WordPress/gutenberg/pull/57908.

Fixes #61312.
Props aaronrobertshaw, talldanwp, ramonopoly, isabel_brison, andrewserong.

Built from https://develop.svn.wordpress.org/trunk@58264


git-svn-id: http://core.svn.wordpress.org/trunk@57727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-31 05:49:14 +00:00
isabel_brison bfab5160b3 Editor: Update util for scoping CSS selectors.
Adds early return for existing scope_selector method in preparation for extending block style variations.

Props aaronrobertshaw, audrasjb, isabel_brison.
Fixes #61120.

Built from https://develop.svn.wordpress.org/trunk@58245


git-svn-id: http://core.svn.wordpress.org/trunk@57708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 05:22:05 +00:00
isabel_brison 6f9de6388c Editor: Add scoping of feature level global styles selectors.
Ensures that feature-level selectors for block style variations are correctly scoped when generating a theme.json stylesheet.

Props aaronrobertshaw, audrasjb, vcanales, isabel_brison.
Fixes #61119.

Built from https://develop.svn.wordpress.org/trunk@58244


git-svn-id: http://core.svn.wordpress.org/trunk@57707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 04:40:07 +00:00
isabel_brison 1b218aaa39 Editor: add aspect ratio presets support.
Enables customizing the list of aspect ratio options available through theme.json.

Props fabiankaegy, isabel_brison, swissspidy.

Built from https://develop.svn.wordpress.org/trunk@58242


git-svn-id: http://core.svn.wordpress.org/trunk@57705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 03:10:10 +00:00
isabel_brison e3f4aa35d8 Editor: level global styles specificity at 0-1-0.
Adjusts the block level global styles selectors so they have a consistent specificity of 0-1-0, and adjusts base and layout global style selectors to their minimum required specificity.

Props aaronrobertshaw, isabel_brison, andrewserong, mukesh27.
Fixes #61165.

Built from https://develop.svn.wordpress.org/trunk@58241


git-svn-id: http://core.svn.wordpress.org/trunk@57704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 01:16:07 +00:00
ellatrix 6a2b736c2f Theme JSON: Extract util to get valid block style variations.
Extracts the repeated collection of valid block style variations into a util that can be reused or updated in a single place for future work around extending block style variations.

Backports https://github.com/WordPress/gutenberg/pull/61030.

Props aaronrobertshaw, audrasjb.

Fixes #61121.


Built from https://develop.svn.wordpress.org/trunk@58228


git-svn-id: http://core.svn.wordpress.org/trunk@57691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 07:46:11 +00:00
isabel_brison 0bf7df15f3 Editor: improve consistency of root padding.
Improve the behaviour of global padding when useRootPaddingAwareAlignments is enabled in theme.json to be more consistent across blocks, templates and patterns.

Props richtabor, isabel_brison, andrewserong.
Fixes #61304.

Built from https://develop.svn.wordpress.org/trunk@58226


git-svn-id: http://core.svn.wordpress.org/trunk@57689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 05:15:14 +00:00
noisysocks 1284a7fe99 Block Themes: Allow setting site-wide background images in theme.json
Syncs the necessary changes from Gutenberg to allow setting site-wide
background images using the top-level `styles.background` key in `theme.json`.

Props ramonopoly.
Fixes #61123.

Built from https://develop.svn.wordpress.org/trunk@58222


git-svn-id: http://core.svn.wordpress.org/trunk@57685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-28 06:06:11 +00:00
isabel_brison ff2929bf19 Editor: pass fluid typography theme.json settings to `wp_get_typography_font_size_value`.
Updates `wp_get_typography_font_size_value` to accept an array of theme.json settings instead of a boolean derived from global state.

Props ramonopoly, audrasjb.
Fixes #61118.

Built from https://develop.svn.wordpress.org/trunk@58171


git-svn-id: http://core.svn.wordpress.org/trunk@57634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-18 23:18:15 +00:00
isabel_brison 00b440c27d Editor: move global CSS custom properties to `:root` selector.
Changes the rules outputting global styles CSS custom properties to use `:root` instead of `body`, and cleans up some unused variables.

Props ramonopoly, isabel_brison.
Fixes #61135.

Built from https://develop.svn.wordpress.org/trunk@58123


git-svn-id: http://core.svn.wordpress.org/trunk@57588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-09 04:09:13 +00:00
isabel_brison 9fd435aa15 Editor: fix spacing in function doc.
Correctly formats spacing in `get_layout_styles` docblock.

Props mukesh27, sabernhardt.
See #60981.

Built from https://develop.svn.wordpress.org/trunk@58030


git-svn-id: http://core.svn.wordpress.org/trunk@57496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 07:20:09 +00:00
isabel_brison 9ecc777ded Editor: limit layout rules on themes without theme.json.
Removes output of base rules for flow and constrained layout types on themes without theme.json.

Props evanltd, poena, isabel_brison, andrewserong, oandregal.
See #60981.

Built from https://develop.svn.wordpress.org/trunk@58028


git-svn-id: http://core.svn.wordpress.org/trunk@57494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 05:30:13 +00:00
Pascal Birchler 00d06db33d Docs: Fix various typos and spelling mistakes.
Props swissspidy, jucaduca, sergeybiryukov.
See #60699.
Built from https://develop.svn.wordpress.org/trunk@57987


git-svn-id: http://core.svn.wordpress.org/trunk@57473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-12 17:47:13 +00:00
isabel_brison 8fbd2fc6f4 Editor: skip outputting base layout rules if content and wide size values don’t exist.
Skip outputting layout rules that reference content and wide sizes CSS variables, if no layout sizes exist in the current `theme.json`.

Props andrewserong.
Fixes #60936.

Built from https://develop.svn.wordpress.org/trunk@57948


git-svn-id: http://core.svn.wordpress.org/trunk@57445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-09 07:20:15 +00:00
Pascal Birchler 0c4eec233d Editor: disable `shadow.defaultPresets` for classic themes.
With this change default shadow presets are never shown for classic themes, and classic themes have no options for adding custom ones.
This essentially reverts [57717] and [57827] / [57828], which had unintended consequences.

Props ajlende, oandregal, madhudollu, swissspidy, get_dave, andrewserong, desrosj.
Fixes #60815.
Built from https://develop.svn.wordpress.org/trunk@57885


git-svn-id: http://core.svn.wordpress.org/trunk@57386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-03-27 16:00:12 +00:00
Pascal Birchler 2a334ede98 Editor: Simplify sanitization code path in `WP_Theme_JSON` after [57496]
Removes the custom `WP_Theme_JSON::is_assoc()` method again in favor of the existing `wp_is_numeric_array()` helper function.

Props mmaattiiaass, costdev, swissspidy, spacedmonkey.
Fixes #60360.
Built from https://develop.svn.wordpress.org/trunk@57751


git-svn-id: http://core.svn.wordpress.org/trunk@57252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-03-02 13:41:05 +00:00
Pascal Birchler 29a2c3a05a Editor: add `shadow.defaultPresets` to appearance tools opt-ins.
Props madhudollu.
Fixes #60633.
Built from https://develop.svn.wordpress.org/trunk@57717


git-svn-id: http://core.svn.wordpress.org/trunk@57218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-27 10:22:11 +00:00
youknowriad 9f0595ab4a Editor: Check for null values in Theme JSON to cater for blockGap.
When resolving theme.json preset variables, add a check to make sure the value is not empty before we run it through strpos() and preg_match_all().

Props ramonopoly, mukesh27, get_dave.
Fixes #60613.
Built from https://develop.svn.wordpress.org/trunk@57716


git-svn-id: http://core.svn.wordpress.org/trunk@57217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-27 10:15:13 +00:00
youknowriad 8f1ccc91ae Editor: Fix block style variation selector generation.
These changes fix the generation of selectors for block style variations. Previously, an incorrect CSS selector could be generated if the block's base selector used an element tag etc.

Props aaronrobertshaw, youknowriad, mukesh27.
Fixes #60453.
Built from https://develop.svn.wordpress.org/trunk@57547


git-svn-id: http://core.svn.wordpress.org/trunk@57048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-07 08:53:13 +00:00
youknowriad e28108b73e Editor: Sanitize nested array in theme.json properly.
WP_Theme_JSON sanitization is now able to sanitize data contained on indexed arrays. 
So certain data from theme.json, for example, settings.typography.fontFamilies which is a JSON array will be sanitized.

Props mmaattiiaass, mukesh27.
Fixes #60360.
Built from https://develop.svn.wordpress.org/trunk@57496


git-svn-id: http://core.svn.wordpress.org/trunk@56997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-31 10:55:10 +00:00