Commit Graph

115 Commits

Author SHA1 Message Date
isabel_brison 4b87f197f4 Editor: allow disabling layout controls.
Adds the ability to disable layout controls on a per-block level from theme.json.

Props mukesh27.
Fixes #59294.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-07 01:05:19 +00:00
isabel_brison 5db3477859 Editor: Preserve block style variations when securing theme.
Adds the ability to process block style variations to the `remove_insecure_properties` function of theme json class.

Props dsas, ramonopoly.
Fixes #59108.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-01 02:53:19 +00:00
John Blackbourn 4667b9323f Docs: Miscellaneous docblock corrections and improvements.
See #58833

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


git-svn-id: http://core.svn.wordpress.org/trunk@55926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-18 17:29:20 +00:00
Felix Arntz 268203f8aa Editor: Simplify usage of `block_has_support()` function by supporting a string.
Most block feature checks are for a single feature string, and for such cases it is not intuitive to require an array for the `$feature` parameter of the `block_has_support()` function.

This changeset brings it in line with other functions like `post_type_supports()`, allowing to pass a string for the `$feature`. An array is still supported for more complex cases where support for sub-features needs to be determined. This change furthermore includes a very minor performance tweak by avoiding calls to the `_wp_array_get()` function if a single feature string is being checked for.

Props thekt12, nihar007, mukesh27, swissspidy.
Fixes #58532.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-10 16:48:19 +00:00
Felix Arntz e80768e045 Themes: Use `isset` instead of `array_key_exists` in `WP_Theme_JSON` class.
With the minimum PHP version requirement raised to 7.0, we can now use `isset` on constants that are arrays. Since `isset` is slightly faster than `array_key_exists` (and the different handling of `null` values is irrelevant for the updates here), remaining instances of `array_key_exists` in the `WP_Theme_JSON` class are replaced in this changeset.

Props soean.
Fixes #57067.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-08-01 20:31:25 +00:00
audrasjb 17f0e47798 General: Fix an error introduced in [56179].
Follow-up to [56179].

Unprops audrasjb.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-09 22:17:22 +00:00
audrasjb 90dadb1457 Docs: Replace multiple single line comments with multi-line comments.
This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175], [56176], [56177], [56178].

Props costdev, audrasjb.
See #58459.



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


git-svn-id: http://core.svn.wordpress.org/trunk@55691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-09 21:40:23 +00:00
isabel_brison 3de83926d6 Editor: update duotone support.
Updates duotone support after stabilisation of selectors API and adds a few small code quality and UI improvements.

Props onemaggie, peterwilsoncc, ajlende, audrasjb, mikeschroder, ramonopoly.
Fixes #58555.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-29 06:21:28 +00:00
isabel_brison c4cb9b82ad Editor: add Post Template fallback styles.
Adds fallback styles necessary for classic themes to display the correct Post Template layout.

Props mikeschroder, ramonopoly.
Fixes #58570.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-28 03:49:27 +00:00
isabel_brison d9e41aa9e9 Editor: refactor and stabilize selectors API.
Restructures the block.json selectors API by moving `__experimentalSelector` props into their own config, stabilizing the selectors API, and enabling more flexible styling options.

Props ramonopoly, spacedmonkey, aaronrobertshaw, onemaggie.
Fixes #58586.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 08:48:24 +00:00
isabel_brison 2e2aea02c2 Editor: stabilise layout and refactor definitions.
Marks the layout support stable and moves layout definitions from `theme.json` into `wp-includes/block-supports/layout.php`.

Props andrewserong, poena, ramonopoly, peterwilsoncc.
Fixes #58550.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-27 07:25:22 +00:00
audrasjb ddd50e3782 Editor: Add a `description` key to `theme.json` style variations.
This changeset adds `description` to `VALID_TOP_LEVEL_KEYS` in `class-wp-theme-json.php` to allow for accessibility improvements. The description is added to 
the ARIA label of the style variation container. If the style variation has no description, only the title is used. One purpose is to use the text description 
to improve the style variation preview in the WordPress.org theme directory.

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

Props ramonopoly, poena.
Fixes #58614.

 --Cette ligne, et les suivantes ci-dessous, seront ignorées--

M    trunk/src/wp-includes/class-wp-theme-json.php

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


git-svn-id: http://core.svn.wordpress.org/trunk@55553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 18:15:22 +00:00
Weston Ruter 33f71c4662 Editor: Use static closures to avoid memory leaks.
Backports Gutenberg changes from https://github.com/WordPress/gutenberg/pull/50723.

Amends [55822].

Fixes #58323.
Props westonruter, spacedmonkey, flixos90. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@55550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 17:00:25 +00:00
isabel_brison 2fbd7aeb8f Editor: add support for block-level link hover colors.
Adds the ability to set link hover colors for individual blocks from the block inspector color panel.

Props @youknowriad, @peterwilsoncc, @kebbet.
Fixes #58575.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 01:15:21 +00:00
Sergey Biryukov b916b71dde Code Modernization: Use `str_starts_with()` in `WP_Theme_JSON` class methods.
This aims to make the code more readable and consistent, as the function is already used extensively in core files.

WordPress core includes a polyfill for `str_starts_with()` on PHP < 8.0 as of WordPress 5.9.

Follow-up to [55703], [55959].

Props spacedmonkey.
Fixes #58012.
Built from https://develop.svn.wordpress.org/trunk@55987


git-svn-id: http://core.svn.wordpress.org/trunk@55499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 14:14:25 +00:00
oandregal f3ea3c57cb `wp_get_global_styles`: allow transforming the CSS Custom Properties into the values they represent.
Props samnajian, ramonopoly, isabel_brison.
Fixes #58588.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 08:44:26 +00:00
isabel_brison 2183172222 Editor: add text columns to typography support.
Adds a text columns feature to the typography block support that uses CSS `column-count` for multi-column text.

Props ramonopoly, aaronrobertshaw.
Fixes #58549.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 08:18:19 +00:00
isabel_brison cf320a85d3 Editor: add grid layout type
Add a new `grid` type to the layout block support.

Props andrewserong, costdev, ramonopoly.
Fixes #58554.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 04:06:26 +00:00
oandregal 99715f5751 `wp_get_global_styles`: return the standard format for CSS Custom Properties.
Props samnajian, hellofromtonya, isabel_brison.
Fixes #58467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 07:56:18 +00:00
isabel_brison 06beef84d5 Editor: revert add grid layout type
Reverting the previous commit because it causes e2e to fail on trunk.

See #58554.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 06:58:18 +00:00
isabel_brison 03f5a6e91d Editor: add grid layout type
Add a new `grid` type to the layout block support.

Props andrewserong, costdev, ramonopoly.
Fixes #58554.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55469 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 05:56:21 +00:00
isabel_brison 49aa42f3b6 Editor: update layout classnames and specificity.
Adds a compound layout classname and reduces layout spacing rule specificity.

Props ramonopoly, andrewserong, poena.
Fixes #58548.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55468 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-21 05:32:19 +00:00
Felix Arntz ae515caebf Editor: Introduce `WP_Theme_JSON::prepend_to_selector()` to improve code quality and performance.
The `WP_Theme_JSON::append_to_selector()` method was previously used for both appending and prepending which violated the single responsibility principle. It resulted in additional conditionals which also came at a performance cost, particularly because the method is called over 1,000 times during a regular WordPress request.

With the new `WP_Theme_JSON::prepend_to_selector()` method, there are now two distinct methods for the two distinct purposes. The now useless third parameter on `WP_Theme_JSON::append_to_selector()` has been removed (rather than deprecated), which is acceptable given that it is a protected method on a class that is not intended for extensions.

Props bor0, costdev, flixos90, isabel_brison, oandregal, spacedmonkey.
Fixes #58193.
See #58457.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-20 17:54:19 +00:00
isabel_brison ae884fdc62 General: fix `overridden` typos.
Fixes two typos in `class-wp-theme-json`.

Props Aristath, nihar007, kapilpaul, oandregal, krupalpanchal.
Fixes #58464.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-20 04:59:18 +00:00
oandregal ddc2c454be Fix lint issues in WP_Theme_JSON::sanitize method.
Add @since tag and indent the parameter properly.

Props mukesh27.
Fixes #58462.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-14 10:46:19 +00:00
oandregal 86bad3cdf6 Ignore unregistered block style variations from `theme.json`.
This PR makes sure unregistered block style variations declared via `theme.json` are ignored. It fixes an issue by style variations don't work in the editor and CSS rules without a selector are output to the front-end.

Props isabel_brison.
Fixes #58462.


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


git-svn-id: http://core.svn.wordpress.org/trunk@55424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-14 07:42:19 +00:00
spacedmonkey a56a09c4ba Editor: Improve the append_to_selector method.
Improve `append_to_selector` method in `WP_Theme_JSON` by checking to see if string contains a common before imploding / exploding string, which improves performance. 

Originally developed and tested in [WordPress/gutenberg#47833 Gutenberg PR 47833].

Props spacedmonkey, flixos90, mukesh27, joemcgill, wildworks, oandregal, mamaduka.
Fixes #58231.
Built from https://develop.svn.wordpress.org/trunk@55907


git-svn-id: http://core.svn.wordpress.org/trunk@55419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-12 11:22:23 +00:00
Sergey Biryukov 2ffb7ef083 Docs: Update code examples formatting in `WP_HTML_Tag_Processor` documentation.
Per the [https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#description documentation standards], code samples should be created by indenting every line of the code by 4 spaces, with a blank line before and after. This matches the format used by the rest of core.

Follow-up to [55203], [55304], [55718], [55724].

Props juanmaguitar, coffee2code, azaozz, costdev, dmsnell, johnbillion, SergeyBiryukov.
Fixes #58028.
Built from https://develop.svn.wordpress.org/trunk@55727


git-svn-id: http://core.svn.wordpress.org/trunk@55239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-08 17:32:24 +00:00
John Blackbourn b155956792 Docs: Miscellaneous formatting corrections to inline docs and whitespace.
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-03 19:46:21 +00:00
John Blackbourn c83f4cb97a Docs: Corrections and improvements to docblocks for global styles, global settings, theme.json parsing, and shortcodes.
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-03 18:48:22 +00:00
audrasjb 0bccdce442 Docs: Use correct 6.2.0 @since version in multiple docblocks.
Props kebbet, audrasjb, mukesh27.
See #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-15 22:56:20 +00:00
Peter Wilson 5deb3698e5 Editor: Prevent KSES stripping global layout style properties.
Layout style properties are stored using indirect values, rather than direct CSS properties. 

Allow users without the `unfiltered_html` capability to modify global styles using the indirect block spacing properties `contentSize`, `wideSize`, and `blockGap`, using a mapping of the eventual CSS property to the indirect property stored in `theme.json`. The mapped CSS property is then used for CSS validation.

Props andrewserong, costdev, hellofromtonya, mamaduka, mmtr86.
Fixes #57321.



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


git-svn-id: http://core.svn.wordpress.org/trunk@54878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-15 03:57:17 +00:00
davidbaumwald f5d681f4bd Editor: Introduce sticky position block support.
In the Gutenberg plugin, a position block support feature was introduced last year, that allows a Group block to be set to a "sticky" position, meaning that when the page scrolls, the block will stick to the top of the window.

This change merges the "sticky" position feature for blocks introduced in Gutenberg 15.0.

Props andrewserong, flixos90, mukesh27.
Fixes #57618.
Built from https://develop.svn.wordpress.org/trunk@55285


git-svn-id: http://core.svn.wordpress.org/trunk@54818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 18:01:20 +00:00
jorgefilipecosta bd2eae6719 Block editor: Add frontend block-level settings to the core.
This commit adds block-level settings in the core. Block level settings allow a block to define the preset settings of its nested blocks using the same shape as theme.json.

Props oandregal, Mamaduka, jorgefilipecosta, dmsnell, adamziel.
57651 #57651.
Built from https://develop.svn.wordpress.org/trunk@55255


git-svn-id: http://core.svn.wordpress.org/trunk@54788 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 12:42:20 +00:00
Felix Arntz 1856b98771 Editor: Add missing `WP_Theme_JSON::process_blocks_custom_css()` method.
Follow up to [55192].

Props aristath, mamaduka, mukesh27, hellofromtonya.
Fixes #57621.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 18:25:22 +00:00
Felix Arntz 5b4af6125a Editor: Add support for custom CSS in global styles.
This changeset introduces functions `wp_get_global_styles_custom_css()` and `wp_enqueue_global_styles_custom_css()`, which allow accessing and enqueuing custom CSS added via global styles.

Custom CSS via global styles is handled separately from custom CSS via the Customizer. If a site uses both features, the custom CSS from both sources will be loaded. The global styles custom CSS is then loaded after the Customizer custom CSS, so if there are any conflicts between the rules, the global styles take precedence.

Similarly to e.g. [55185], the result is cached in a non-persistent cache, except when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.

Props glendaviesnz, oandregal, ntsekouras, mamaduka, davidbaumwald, hellofromtonya, flixos90.
Fixes #57536.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-02 18:52:17 +00:00
hellofromTonya 263ef5505d Themes: Add shadow presets support for theme.json.
Adds shadow presets support for `theme.json` within the `WP_Theme_JSON` by 

* Adding it to presets metadata and valid settings.
* Defining the default shadow presets in Core's `theme.json`.

Includes PHPUnit tests. 

References:
* [https://github.com/WordPress/gutenberg/pull/46813 Gutenberg PR 46813]
* [https://github.com/WordPress/gutenberg/pull/47272 Gutenberg PR 47272]

Follow-up to [54162], [52049], [50973].

Props madhudollu, mamaduka, oandregal, scruffian, hellofromTonya.
Fixes #57559.
Built from https://develop.svn.wordpress.org/trunk@55176


git-svn-id: http://core.svn.wordpress.org/trunk@54709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 18:07:12 +00:00
hellofromTonya 048b304deb Editor: Introduce minimum height dimensions block support.
This changeset adds the new dimension feature's PHP code for supporting minimum height in the block editor inspector and in global styles. Minimum height is quite useful for defining the minimum vertical dimensions of a block, while allowing it to expand beyond that size. 

In this changeset:

* Adds support in `theme.json`.
* Adds support in the style engine.
* Adds support in `wp_apply_dimensions_support()`.
* Renames the setting from `'__experimentalDimensions'` to `dimensions` in `wp_register_dimensions_support()`.
* Adds PHPUnit tests.

Is renaming `'__experimentalDimensions'` a backwards-compatibility (BC) break?

Though the setting has been in the code since 5.9.0, it was never wired to anything, ie it did not expose any controls or styles. Notice in `wp_register_dimensions_support()` and `wp_apply_dimensions_support()` prior to this changeset, there are inline comments as placeholders for height and width support, but no code.

If a developer opted in to use it, it had no effect.

A search in wp.org's plugin and themes repo showed no instances of this experimental setting.

Given there was no functionality attached to it (until this changeset), no change in behavior or effect from removing it, and no usage found in the plugins and themes repository, it does appear to be a BC break.

References:
* [https://github.com/WordPress/gutenberg/pull/45300 Gutenberg PR 45300]
* [https://github.com/WordPress/gutenberg/pull/45334 Gutenberg PR 45334]

Follow-up to [53076], [52069].

Props andrewserong, aaronrobertshaw , costdev, hellofromTonya, isabel_brison, joen, paaljoachim, mukesh27, ntsekouras, oandregal, ramonopoly.
Fixes #57582.
Built from https://develop.svn.wordpress.org/trunk@55175


git-svn-id: http://core.svn.wordpress.org/trunk@54708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 16:15:15 +00:00
hellofromTonya cafd7544c2 Editor: Add support for editing block style variations in global styles.
To allow editing of block style variations in global styles, this changeset adds the following for server side support:

* building of block style schema into `WP_Theme_JSON::sanitize()`.
* appending of style variation selectors to block metadata in `WP_Theme_JSON::get_blocks_metadata()`.
* building of selectors and variations for nodes in `WP_Theme_JSON::get_block_nodes()`.

Tests for happy and unhappy paths are included.

Reference:
* [https://github.com/WordPress/gutenberg/pull/46343 Gutenberg PR 46343]

Follow-up to [54118], [50973], [50959].

Props isabel_brison, 
Fixes #57583.
Built from https://develop.svn.wordpress.org/trunk@55172


git-svn-id: http://core.svn.wordpress.org/trunk@54705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-01 13:43:18 +00:00
Felix Arntz d0e699bb2c Editor: Fix undefined variable following [54805].
Props mamaduka, costdev, mukesh27.
See #56974, #57067.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 22:09:13 +00:00
Sergey Biryukov eda80ba004 Code Modernization: Rename parameters that use reserved keywords in `wp-includes/class-wp-theme-json.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$default` parameter to `$default_value` in `WP_Theme_JSON::get_metadata_boolean()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951], [54952], [54956], [54959], [54960], [54961], [54962], [54964], [54965], [54969], [54970], [54971], [54972], [54996], [55000], [55011], [55013], [55014], [55015], [55016], [55017], [55020], [55021], [55023], [55027], [55028], [55034], [55036], [55037], [55038], [55039], [55049], [55050], [55060], [55062], [55064], [55065], [55076], [55077], [55078], [55081], [55090], [55100], [55104], [55112], [55115], [55116], [55117], [55119], [55120], [55126], [55127].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55129


git-svn-id: http://core.svn.wordpress.org/trunk@54662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 15:45:11 +00:00
audrasjb 0939d89ded Themes: Support additional link related pseudo classes in `theme.json`.
This changeset adds support for `:link` and `:any-link` in `theme.json`, using the `VALID_ELEMENT_PSEUDO_SELECTORS` array. `:link` can be used to style unvisited links and `:any-link` can be used to style any link containing an `href` attribute.

Props peterwilsoncc, whaze, audrasjb, costdev, mukesh27.
Fixes #57053.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 08:11:15 +00:00
Sergey Biryukov 9dfc9375da Themes: Alphabetize the properties list in `WP_Theme_JSON::VALID_STYLES` for consistency.
Follow-up to [53129], [54253], [55008].

See #57354.
Built from https://develop.svn.wordpress.org/trunk@55009


git-svn-id: http://core.svn.wordpress.org/trunk@54542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-20 13:57:15 +00:00
hellofromTonya 3ddfa88245 Themes: Adds outline CSS properties support in theme.json.
Adds the ability to define outline CSS properties for elements and blocks within `theme.json` to render `outline-color`, `outline-offset`, `outline-style`, and `outline-width` styles.

Originally developed and tested in [https://github.com/WordPress/gutenberg/pull/43526 Gutenberg PR 43526].

Props onemaggie, hellofromTonya, audrasjb, ironprogrammer.
Fixes #57354.
Built from https://develop.svn.wordpress.org/trunk@55008


git-svn-id: http://core.svn.wordpress.org/trunk@54541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-19 20:55:13 +00:00
Sergey Biryukov cede832fb1 Docs: Fix typo in the `WP_Theme_JSON::PRESETS_METADATA` constant description.
Follow-up to [53129].

Props kebbet, mukesh27.
See #56792.
Built from https://develop.svn.wordpress.org/trunk@54853


git-svn-id: http://core.svn.wordpress.org/trunk@54405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-17 16:58:20 +00:00
desrosj 39f1141e78 Editor: Correctly style separator blocks when only a `background-color` is defined.
When separator blocks are configured using only a `background-color`, they are shown correctly within the editor but not on the front end.

This changes `WP_Theme_JSON` to detect this scenario and move the `background-color` value to just `color` when both `color` and `border-color` are missing.

Props cbravobernal, flixos90, davidbaumwald, hellofromTonya, desrosj, andrewserong, czapla, glendaviesnz, wildworks.
Fixes #56903.
Built from https://develop.svn.wordpress.org/trunk@54821


git-svn-id: http://core.svn.wordpress.org/trunk@54373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-11 17:11:10 +00:00
Felix Arntz 702344e383 Editor: Improve performance of `WP_Theme_JSON` class by reducing usage of expensive array functions.
In many scenarios array functions are more expensive than using simpler `for` or `foreach` loops.

This changeset results in roughly 4% faster `wp_head` execution time for both block themes and classic themes. While this may seem like a small win, it is a worthwhile enhancement and only one part of several other little performance tweaks which are being worked on to improve performance of `theme.json` parsing further.

Props aristath, desrosj, jrf, spacedmonkey.
Fixes #56974.
See #57067.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54356 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-11 01:50:11 +00:00
Felix Arntz 2a57dd7f86 Editor: Avoid running certain logic around `theme.json` parsing unnecessarily for classic themes.
Here's what it does:
* Do not load and parse `theme-i18n.json` schema if the theme does not have a `theme.json` file.
* Fix the variable caching layer around the theme's `theme.json` parsing so that a parent's theme `theme.json` is cached as well.
* Do not run a `WP_Query` for global styles for a user when the theme does not have a `theme.json`.

In a basic WordPress setup, this changeset improves `wp_head` execution time for classic themes by 10%, and overall response time for both block themes and classic themes by 4%. This may seem like a small win, but 4% reduced overall response time is actually quite a bit for one change, and it is worth mentioning that this is just one of several other little performance tweaks which are being worked on to improve performance of `theme.json` parsing further.

Props flixos90, manuilov, oandregal, peterwilsoncc, spacedmonkey.
Fixes #56945.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-10 22:16:15 +00:00
Peter Wilson 63f944e831 Themes: Re-order valid link pseudo classes.
Re-order the link pseudo classes to follow the long term LoVe (F)HA rule when set via `theme.json`.

In order that the CSS cascade behaves in a predictable manner, it's recommended that the selectors follow the order `:visited`, `:focus`/`:hover`, `:active`. As order affects the specificity, this ensures the interaction states override the visited states. CSS specificity is really quite beautiful, although complex.

Props mikachan, sabernhardt, davidbaumwald, mukesh27, Mamaduka, desrosj.
Fixes #56928.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-09 04:08:16 +00:00
hellofromTonya 88cee0d359 Editor: Rename new `theme_json_{$context}` filters.
The newly introduced filters are renamed to use the `wp_theme_json_data{$context}` structure:

* `theme_json_default` renamed to `wp_theme_json_data_default`
* `theme_json_theme` renamed to `wp_theme_json_data_theme`
* `theme_json_blocks` renamed to `wp_theme_json_data_blocks`
* `theme_json_user` renamed to `wp_theme_json_data_user`

The following new filter gets the `wp_` prefix added:
* `theme_json_get_style_nodes` renamed to `wp_theme_json_get_style_nodes`

Follow-up to [56467], [54183], [54118].

Props kebbet, desrosj, mukesh27, ocean90, sergeybiryukov, davidbaumwald, hellofromTonya.
Fixes #56796.
Built from https://develop.svn.wordpress.org/trunk@54501


git-svn-id: http://core.svn.wordpress.org/trunk@54060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 20:08:12 +00:00