Commit Graph

71 Commits

Author SHA1 Message Date
davidbaumwald 39c66482e0 Editor: `svn add` new files missed in [55285].
Follow-up to [55285].

See #57618.
Built from https://develop.svn.wordpress.org/trunk@55286


git-svn-id: http://core.svn.wordpress.org/trunk@54819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 18:11:18 +00:00
Felix Arntz dbdba246b6 Editor: Add layout controls to children of flex layout blocks.
Props isabel_brison, andrewserong, davidbaumwald, flixos90, mamaduka, ntsekouras, hellofromtonya.
Fixes #57584.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 17:44:21 +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 ee7b88a862 Editor: Use `WP_HTML_Tag_Processor` in `wp_render_elements_support()`.
Props ntsekouras.
Fixes #57642.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 19:43:16 +00:00
jorgefilipecosta f6cb5218c1 Block editor: Add ID support to block wrapper attributes.
This commit adds support for the ID attribute for dynamically rendered blocks.

Props Soean, flixos90, poena, costdev, Mamaduka.
Closes #56852.
Built from https://develop.svn.wordpress.org/trunk@55230


git-svn-id: http://core.svn.wordpress.org/trunk@54763 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-06 15:24:16 +00:00
hellofromTonya a35991eb44 Editor: Add missing controls to flex layouts in `wp_get_layout_style()`.
Adds missing controls to flex layouts in `wp_get_layout_style()` for justify-content and vertical alignment options.

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

Follow-up to [54274].

Props isabel_brison, andrewserong, jameskoster, joen, onemaggie , ndiego.
Fixes #57602.
Built from https://develop.svn.wordpress.org/trunk@55201


git-svn-id: http://core.svn.wordpress.org/trunk@54734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 00:36:17 +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
jorgefilipecosta 5a6c222bfa Update: Improve performance of gutenberg_render_layout_support_flag.
Backports https://github.com/WordPress/gutenberg/pull/46074 into the core.
render_layout_support_flag is run per block, and inside we called get_global_settings three times. get_global_settings calls get_merged_data, which is costly. render_layout_support_flag is a filter called during the block render. When the blocks start rendering, there is no expectation that the theme.json settings change during the block render, so the settings and their derived information should all be static information of this function.
This simple change removes 3*NUMBER_OF_BLOCKS calls of get_merged_data to just one call.

Props oandregal, aristath, felixarntz, tellthemachines, andrewserong, aaronrobertshaw, aaronrobertshaw.
Built from https://develop.svn.wordpress.org/trunk@55167


git-svn-id: http://core.svn.wordpress.org/trunk@54700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-31 15:24:14 +00:00
hellofromTonya 1b6b3a0765 Editor: Remove WP_DEBUG defined check in wp_tinycolor_hue_to_rgb().
The constant `WP_DEBUG` is a default constant that is set within `wp_initial_constants()` when not defined. This means the constant will always be defined, thus making the `defined( 'WP_DEBUG' )` unnecessary.

Removing the `defined()` provides these benefits:
* Makes the code more readable.
* Tiny performance optimization.

References:
* https://github.com/WordPress/gutenberg/pull/45979

Follow-up to [52049].

Props ocean90, spacedmonkey, mamaduka.
See #57527. 
Built from https://develop.svn.wordpress.org/trunk@55141


git-svn-id: http://core.svn.wordpress.org/trunk@54674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 21:56:15 +00:00
hellofromTonya e9a172b0ef Editor: Use in/decrementors in wp_tinycolor_hue_to_rgb().
Replaces `+=` and `-=` with `++$t` and `--$t` (in/decrementors) within the `wp_tinycolor_hue_to_rgb()`. 

Why? For performance: in/decrementors are more performant than an assignment with a calculation.

References:
* https://www.php.net/manual/en/language.operators.increment.php
* https://github.com/WordPress/gutenberg/pull/44551

Follow-up to [50929].

Props jrf, czapla, antonvlasenko, aristath, mamaduka.
See #57527. 
Built from https://develop.svn.wordpress.org/trunk@55140


git-svn-id: http://core.svn.wordpress.org/trunk@54673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-25 21:42:15 +00:00
hellofromTonya fe2c8f9237 Editor: Adds 'settings.typography.fluid.minFontSize' support to wp_get_typography_font_size_value().
In `wp_get_typography_font_size_value()`, adds support for using a minimum font size for fluid typography when defined in a theme's `theme.json` file.

Reference:
* Part of [https://github.com/WordPress/gutenberg/pull/42489 Gutenberg PR 42489]

Follow-up to [54497], [54260].

Props andrewserong, ramonopoly, hellofromTonya, joen.
Fixes #57529.
Built from https://develop.svn.wordpress.org/trunk@55133


git-svn-id: http://core.svn.wordpress.org/trunk@54666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-24 20:40:10 +00:00
hellofromTonya 8ddb28368a Themes: Introduce wp_theme_has_theme_json() for public consumption.
Adds `wp_theme_has_theme_json()` for public consumption, to replace the private internal Core-only `WP_Theme_JSON_Resolver::theme_has_support()` method. This new global function checks if a theme or its parent has a `theme.json` file.

For performance, results are cached as an integer `1` or `0` in the `'theme_json'` group with `'wp_theme_has_theme_json'` key. This is a non-persistent cache. Why? To make the derived data from `theme.json` is always fresh from the potential modifications done via hooks that can use dynamic data (modify the stylesheet depending on some option, settings depending on user permissions, etc.).

Also adds a new public function `wp_clean_theme_json_cache()` to clear the cache on `'switch_theme'` and `start_previewing_theme'`.

References:
* [https://github.com/WordPress/gutenberg/pull/45168 Gutenberg PR 45168] Add `wp_theme_has_theme_json` as a public API to know whether a theme has a `theme.json`.
* [https://github.com/WordPress/gutenberg/pull/45380 Gutenberg PR 45380] Deprecate `WP_Theme_JSON_Resolver:theme_has_support()`.
* [https://github.com/WordPress/gutenberg/pull/46150 Gutenberg PR 46150] Make `theme.json` object caches non-persistent.
* [https://github.com/WordPress/gutenberg/pull/45979 Gutenberg PR 45979] Don't check if constants set by `wp_initial_constants()` are defined.
* [https://github.com/WordPress/gutenberg/pull/45950 Gutenberg PR 45950] Cleaner logic in `wp_theme_has_theme_json`.

Follow-up to [54493], [53282], [52744], [52049], [50959].

Props oandregal, afragen, alexstine, aristath, azaozz, costdev, flixos90, hellofromTonya, mamaduka, mcsf, ocean90, spacedmonkey.
Fixes #56975.
Built from https://develop.svn.wordpress.org/trunk@55086


git-svn-id: http://core.svn.wordpress.org/trunk@54619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-18 11:40:10 +00:00
audrasjb e2ed8d0650 Docs: Various docblock fixes in Block Supports related functions.
See #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-24 22:52:11 +00:00
audrasjb 532cd00f46 Docs: Use third-person singular verbs for Block Supports related function descriptions, as per docblocks standards.
See #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-24 22:36:11 +00:00
desrosj face84c028 Editor: Improve how `min`/`max` font sizes are calculated for fluid typography.
- Where no fluid max values are set (e.g., single or custom font size values), the "size" value will act as the maximum value in a `clamp()` function.
- In the absence of any fluid `min`/`max` values, the lower bound rule of `>16px` will be enforced. This applies to custom values from the editor or single-value `theme.json` styles. Font sizes below this will not be clamped.
- In a preset, if a `fluid.min` value has been specified, the lower bound rule of `>16px` won't be enforced on this value. Presets with a fluid object therefore, give precedence to theme author's values.
- In a preset, if there is NOT a `fluid.max` but there is `fluid.min`, use the incoming "size" value as the `max`.
- In a preset, if there is NOT a `fluid.min` but there is a `fluid.max`, use `size * min_size_factor` as the `min`. The lower bound rule of `>16px` is enforced here, because the block editor is computing the `min` value. This is consistent with the way minimum sizes are calculated for single or custom values.


Props ramonopoly, mamaduka, andrewserong, aristath, joen, desrosj.
Fixes #57075.
Built from https://develop.svn.wordpress.org/trunk@54823


git-svn-id: http://core.svn.wordpress.org/trunk@54375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-11 17:48:12 +00:00
Sergey Biryukov 730d9d4b49 Editor: Add font size constraints for fluid typography.
This commit:
* Adds default minimum font size limits so that min font size, where provided, does not become smaller than `14px`/`0.875rem`/`0.875em`.
* For font sizes of `< 14px` that have no defined minimum sizes, uses the font size to set the floor of the `clamp()` value.

This bugfix prevents converting existing small font sizes to clamp values that will reduce their font size even further in narrow widths. It therefore improves backward compatibility and accessibility.

Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/44993 #44993 Fluid typography: add font size constraints]

Follow-up to [54260], [54360], [54497], [54500].

Props ramonopoly, andrewserong, isabel_brison, Joen, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54646


git-svn-id: http://core.svn.wordpress.org/trunk@54198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-19 12:27:10 +00:00
davidbaumwald 6743ca5fc4 Editor: Fix legacy group inner block wrappers in constrained layouts.
Reviewed by bernhard-reiter.

Props isabel_brison, noisysocks, andrewserong, poena, bernhard-reiter.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54633


git-svn-id: http://core.svn.wordpress.org/trunk@54185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-18 14:47:15 +00:00
davidbaumwald b0a8a8b46e Editor: Merge latest fluid typography bugfixes for 6.1 Release Candidate 1.
Merges the following:
* [https://github.com/WordPress/gutenberg/pull/44761 Gutenberg PR 44761] - Fluid Typography: Fix bug in global styles where fluid `clamp()` rules were not calculated for custom values
* [https://github.com/WordPress/gutenberg/pull/44762 Gutenberg PR 44762] - Fluid Typography: Convert server-side block support values
* [https://github.com/WordPress/gutenberg/pull/44764 Gutenberg PR 44764] - Fluid Typography: Convert font size inline style attributes to fluid values
* [https://github.com/WordPress/gutenberg/pull/44807 Gutenberg PR 44807] - Fluid Typography: Covert font size number values to pixels
* [https://github.com/WordPress/gutenberg/pull/44847 Gutenberg PR 44847] - Fluid Typography: ensure font sizes are strings or integers

Follow-up to [54280].

Props andrewserong, isabel_brison, ramonopoly.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54497


git-svn-id: http://core.svn.wordpress.org/trunk@54056 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 18:44:13 +00:00
davidbaumwald a8af293608 Editor: Fix server-side attribute registration via typography support.
Ensures the `fontFamily` attribute is registered for block types on the server side. This change resolves a `400` error when attempting to change the font family for a server-side rendered block in the editor.

Props aaronrobertshaw, mamaduka, wildworks, upadalavipul.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54387


git-svn-id: http://core.svn.wordpress.org/trunk@53946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-04 16:47:13 +00:00
hellofromTonya 26b2f466f4 Editor: Fix spacing property generation in flow layout type.
Fixes a bug of invalid CSS value when applying block spacing to a block as reported in [https://github.com/WordPress/gutenberg/issues/44435 Gutenberg issue 44435].

Adds logic to convert preset values (i.e. `$gap_value`) into valid CSS custom properties for the flow ('default') layout type. See the original fix in [https://github.com/WordPress/wordpress-develop/pull/3324 Gutenberg PR 3324].

Also adds a test dataset that fails before the bugfix and passes after the bugix.

Follow-up to [54274].

Props ndiego, isabel_brison, ramonopoly, andrewserong, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54311


git-svn-id: http://core.svn.wordpress.org/trunk@53870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 14:58:12 +00:00
jorgefilipecosta 5e32e7de29 Fix: Revert [54305].
This commit caused an incompatibility with the latest released Gutenberg version.

Props bernhard-reiter.
Built from https://develop.svn.wordpress.org/trunk@54306


git-svn-id: http://core.svn.wordpress.org/trunk@53865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 10:17:11 +00:00
jorgefilipecosta 7882623807 Editor: Fix missing frontend section presets output.
Backports PHP changes in WordPress/gutenberg#42124 to the core. Adds the missing mechanism to output frontend styles of block level presets to the core.

Props mcsf, oandregal, dmsnell, draganescu.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54305


git-svn-id: http://core.svn.wordpress.org/trunk@53864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 09:08:21 +00:00
hellofromTonya bb11a85be0 Docs: Fix `wp_get_layout_style()` parameter documentation.
* Changed `boolean` to `bool`.
* Added `Optional.` and `Default` for each optional parameter.
* Improved `@return` documentation to include empty string.

Follow-up to [54274], [53421], [53085], [52069].

Props mukesh27, hellofromTonya.
See #55646.
Built from https://develop.svn.wordpress.org/trunk@54275


git-svn-id: http://core.svn.wordpress.org/trunk@53834 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 13:42:09 +00:00
hellofromTonya 04166db031 Editor: Improves layout block support in `wp_get_layout_style()`.
This commit merges the remaining changes from [https://github.com/WordPress/gutenberg/pull/40875 Gutenberg PR 40875]. It's Part 2 (see [54162] for Part 1) of a layout improvement initiative and targets `wp_get_layout_style()` in `layout.php`.

Context:
The overall initiative is to improve layout block support:
>to use centralised layout definitions, output base layout styles from global styles, introduce a layout type semantic classname, reduce duplication of container class and style tag output, and fix blockGap at the block level in global styles.

Changes include:
* Adding an optional parameter `$block_spacing` to `wp_get_layout_style()` for setting a custom spacing on the block.
* Adding handle for the block spacing.
* Using the style engine to to enqueue and render layout styles via `wp_style_engine_get_stylesheet_from_css_rules()`.
* Introduces a new test file for `wp_get_layout_style()`.

Follow-up to [54162], [54160], [54159], [53421], [52380], [53085], [52069].

Props andrewserong, isabel_brison, costdev, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54274


git-svn-id: http://core.svn.wordpress.org/trunk@53833 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 13:02:09 +00:00
hellofromTonya b29bbddb5f Editor: Introduces fluid typography and uses Style Engine.
This commit introduces fluid typography block supports and switches to use the Style Engine for typography and colors.

The motivation for fluid typography block supports:
>"Fluid typography" describes how a site's font sizes adapt to every change in screen size, for example, growing larger as the viewport width increases, or smaller as it decreases.
>
>Font sizes can smoothly scale between minimum and maximum viewport widths.

Typography changes introduced from Gutenberg:

* Uses the Style Engine to generate the CSS and classnames in `wp_apply_typography_support()`.
* Introduces `wp_typography_get_preset_inline_style_value()` for backwards-compatibility.
* Introduces a private internal function called `wp_get_typography_value_and_unit()`, for checking and getting typography unit and value.
* Introduces a private internal function called  `wp_get_computed_fluid_typography_value()`, for an internal implementation of CSS `clamp()`.
* Deprecates `wp_typography_get_css_variable_inline_style()`.

References:
* [https://github.com/WordPress/gutenberg/pull/40332 WordPress/gutenberg PR 40332] Style Engine: add typography and color to backend
* [https://github.com/WordPress/gutenberg/pull/39529 WordPress/gutenberg PR 39529] Block supports: add fluid typography

Follow-up to [53076], [52302], [52069], [51089], [50761], [49226].

Props ramonopoly, youknowriad, aristath, oandregal, aaronrobertshaw, cbirdsong, jorgefilipecosta, ironprogrammer, hellofromTonya.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54260


git-svn-id: http://core.svn.wordpress.org/trunk@53819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 15:47:09 +00:00
audrasjb 3639a578ef Editor: Backport block supports (border, color, elements, spacing) from Gutenberg to WP 6.1.
This changeset backports `border`, `color`, `elements` and `spacing` block supports changes from Gutenberg to WP 6.1. 

See tracking issue on Gutenberg repository: [https://github.com/WordPress/gutenberg/pull/43440 gutenberg#43440].

Props ramonopoly, glendaviesnz, bernhard-reiter, audrasjb, costdev.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53770 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 20:14:10 +00:00
Sergey Biryukov f6c2690313 Editor: Update duotone block supports to allow unset for preset colors.
This add the ability to unset duotone in themes with default duotone set.

This commit backports the original PRs from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/39564 #39564: Add ability to unset duotone in themes with default duotone set]
* [https://github.com/WordPress/gutenberg/pull/42020 #42020: Remove: Unrequired regex search on duotone supports]

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

Props ajlende, jorgefilipecosta, Joen, cbravobernal.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54101


git-svn-id: http://core.svn.wordpress.org/trunk@53660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-08 14:34:11 +00:00
Sergey Biryukov bb92e303d7 Editor: Add utility classnames back to blocks that have layout attributes specified.
[https://github.com/WordPress/gutenberg/issues/38719 In 5.9 these utility classnames were removed], which removed the ability for theme/plugin authors to assign their own custom CSS related to specific layout selections. This was mostly related to the Button block.

This commit adds these classes dynamically based on attributes, rather than saving them to the serialized content.

Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/41487 #41487 Add utility classnames back to blocks that have layout attributes specified]

Props glendaviesnz, peterwilsoncc, andrewserong, zieladam, matveb, samikeijonen.
See #56058.
Built from https://develop.svn.wordpress.org/trunk@53568


git-svn-id: http://core.svn.wordpress.org/trunk@53157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-23 23:09:09 +00:00
gziolo 59c970101f Docs: Add missing documentation for fallback_gap_value param
Follow-up for [53420]. 

Props SergeyBiryukov.
See #55567.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53010 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 15:35:14 +00:00
gziolo cbcf19d09d Editor: Update WordPress packages for 6.0 RC 4
Included cherry-picked commits from the Gutenberg plugin that fix bugs discovered after WordPress 6.0 RC 3.

Props zieladam.
See #55567.



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


git-svn-id: http://core.svn.wordpress.org/trunk@53009 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-05-20 14:32:40 +00:00
gziolo 32bbe9b0b9 Editor: Fix styles for nested elements (link color)
This fixes an issue by which link color behaves differently in the editor and front end.

Related Gutenberg PR: https://github.com/WordPress/gutenberg/pull/37728.

Props oandregal.
See #55567.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52849 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-25 16:37:08 +00:00
Sergey Biryukov 01a28c0031 Code Modernization: Rename parameters that use reserved keywords in `wp-includes/block-supports/border.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_has_border_feature_support()`.

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].

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


git-svn-id: http://core.svn.wordpress.org/trunk@52829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-21 21:05:11 +00:00
gziolo e0ce8e7a6b Editor: Update layout handling for block supports
Backports changes applied in the Gutenberg plugin planned for WordPress 6.0 release. See https://github.com/WordPress/gutenberg/issues/39889.

Props ramonopoly, youknowriad.
See #55505.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-06 11:41:05 +00:00
gziolo c5360263ed Editor: Backport block support changes from the Gutenberg plugin
Migrate spacing, border, color, dimensions, elements and typography and associated tests for block supports in the block editor.

Related changes in Gutenberg:
- Include individual serialization changes from 6de16981c7
- Skip Style Engine integration from 44925a947f%60

Props ramonopoly, aaronrobertshaw.
See #55505.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-05 12:08:02 +00:00
audrasjb 3306061aa3 Editor: Use `wp_unique_id()` instead of `uniqid()` to generate CSS class names.
Backports changes from https://github.com/WordPress/gutenberg/pull/38891.
See https://github.com/WordPress/gutenberg/issues/38889.

Props westonruter, mamaduka.
See #55474.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-29 13:06:07 +00:00
davidbaumwald 3172eac11b Formatting: Use `safecss_filter_attr` in `wp_get_layout_style()`.
Previously, `safecss_filter_attr` did not allow for `calc` and `var` in parsed CSS.  Because of this, `wp_strip_all_tags` was used in `wp_get_layout_style` to allow for the use of these CSS functions to account for responsive widths.  [50923] added support for both of these CSS functions in KSES, so `safecss_filter_attr` can now be used in `wp_get_layout_style` as originally intended.

Follow-up to [52069].

Props grapplerulrich.
Fixes #55356.
Built from https://develop.svn.wordpress.org/trunk@52924


git-svn-id: http://core.svn.wordpress.org/trunk@52513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-12 00:29:04 +00:00
hellofromTonya 76207c890b Editor: Automatically apply global styles duotone filters to render in post editor.
Global styles duotone filters were not rendering in the post editor. This fixes that by adding `wp_global_styles_render_svg_filters` to the `in_admin_header` so it renders in the body before the editor.

Follow-up [52757].

Props ajlende, abhanonstopnewsuk.
Fixes #55190.
Built from https://develop.svn.wordpress.org/trunk@52768


git-svn-id: http://core.svn.wordpress.org/trunk@52357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-17 20:45:00 +00:00
audrasjb 26667ab0e1 Editor: Backport Duotone fixes for 5.9.1.
This changeset is a backport for the following Gutenberg PRs:

- Fix duotone theme cache gutenberg#36236
- Fix duotone render in non-fse themes gutenberg#37954
- Duotone: Allow users to specify custom filters gutenberg#38442

Props oandregal, scruffian, Mamaduka.
See #55179.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-17 16:18:03 +00:00
jorgefilipecosta cb3e78b0c3 Script Loader: Improvements to the load block support styles mechanism.
This commit applies feedback given to commit 52741. It changes the new function name, the file where it is located, and improves its documentation and marks.

Follow-up to [52741].
Props hellofromtonya, swissspidy, oandregal.
See #55148.
Built from https://develop.svn.wordpress.org/trunk@52743


git-svn-id: http://core.svn.wordpress.org/trunk@52332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-16 22:20:01 +00:00
jorgefilipecosta a73446f6ed Script Loader: Load block support styles in the head for block themes.
The dynamic block styles for layout and elements should be loaded in the head for block themes. While that should also be the case for classic themes, the current mechanism we use (render_block) does not allow us to do that, hence, this PR doesn't change anything for them and will be loaded the body.

Props oandregal, youknowriad, wpsoul.
Fixes #55148.
Built from https://develop.svn.wordpress.org/trunk@52741


git-svn-id: http://core.svn.wordpress.org/trunk@52330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-16 17:28:01 +00:00
noisysocks 28a12c8bce Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Site Logo: Add option to set site icon from Site Logo block
- Navigation: Enable even more compact setup state.
- Remove template parts from post content inserter an __unstable filter
- Template Editor Mode: Hide editor mode switcher
- Avoid using CSS variables for block gap styles
- Try to fix auto resizing in template part focus mode
- Lower the specificity of font size CSS Custom Properties in the editor
- Site icon: Fix site icon styling to display non-square site icons within a square button
- [Site Editor]: Register block editor shortcuts
- Update regex to handle 404 template slug
- Site Editor: Remove dead code
- [Block Editor]: Restrict delete multi selected blocks shortcut
- Fix: Gradients are not being applied by class
- Update: Make the global styles subtitles font smaller
- Post Content/Title: Reflect changes when previewing post
- ServerSideRender: Fix loading state
- [Block Library]: Fix editable post blocks in Query Loop with zero queryId
- Post Excerpt: Fix previews
- WP59: Contextualize "Export" string to differentiate it from other occurrences in WP Core
- Tools Panel: Fix race conditions caused by conditionally displayed ToolsPanelItems
- ToolsPanel: Allow items to register when panelId is null
- Font Size Picker: Allow non-integers as simple CSS values and in hints
- [Components - FontSizePicker]: Use incremental sequence of numbers as labels for the available font-sizes at the segmented control (conditionally)

See #54487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-01-04 05:39:28 +00:00
audrasjb b788e6255a Docs: Typo correction in `wp_get_layout_style()` introduced in 5.9.
Follow-up to [52069].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-22 23:20:04 +00:00
isabel_brison 4939393799 Update @wordpress packages for Beta 4
Update packages with these bug fixes from Gutenberg:

Navigation: Remove hardcoded typography units
Handle parsed request
Navigation: Refactor modal padding to be simpler and more flexible
Show notice on save in site editor
Add aria-pressed true/false to Toggle navigation button based on state
Components FontSizePicker: Use incremental sequence of numbers
Custom keys from theme.json: fix kebabCase conversion
Template Part: Fix 'isMissing' condition check
Multi-Entity Saving: Decode HTML entities in item titles
Font sizes: update default values
Query Loop: Add useBlockPreview, fix Query Loop wide alignment
Only add dialog role to navigation when modal is open
Fix navigation appender
Show a UI warning when user does not have permission to update/edit a Navigation block
Block editor: Fix Enter handling for nested blocks
Update: Use subtitle styles for the palette names
Allow publishing a post while not saving changes to non-post entities
Update: Block top level useSetting paths
Fix Site Logo block alignment issues
Editor: when Toggle navigation receives state false, focus
ToolsPanel: Allow items to register when panelId is null
Block Support Panels - Make block support tools panels compatible
Gallery: Fix block registration hook priority
Navigation: Fix page list issues in overlay
Ensure the overlay menu works when inserting navigation block pattern
Restrict Navigation permissions and show UI warning if cannot create
Add block gap support for group blocks
Try cascading nav styles through classnames
Fix: Impossible to edit theme and default colors
Fix: Color editor discards colors with default name
Site Editor: Fix template author avatar check
Template Editing Mode: Fix options dropdown
Avoid undo issues when reset parent blocks for controlled blocks
Add comment-form and comment-list to html5 theme support and fix comment layout

Props hellofromtonya.
See #54487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 07:02:34 +00:00
isabel_brison 7b3c904f37 Fix deprecated usage of passing null to explode()
As of PHP 8.1, explode() does not permit null as its second argument. This results in warnings being spat out on every page because of a usage of this in wp-includes/block-supports/layout.php.

See #53635.
Props noisysocks.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-15 04:08:04 +00:00
noisysocks 3060ce0b59 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Gallery block: turn on auto-migration of v1 Gallery blocks to v2 format when edited
- Add accessible labelling to submenu buttons.
- Improve performance of wp_navigation lookup. 
- Various inline docblock corrections
- Use core version of template and template part post types and REST endpoints for WP 5.9, with back compat for 5.8
- Gradients: Enable adding custom gradient when gradients are disabled
- Custom color palette: add default color name
- Color Picker: Re-instate debounce and controlled value to fix issue with gradient picker
- Add aria-current="page" to active navigation item
- Site Editor: Templat list fallback to slug
- Fix: Custom color picker popover position
- Fix: php 5.6 error in theme JSON class.
- Update the WP_Theme_JSON_Gutenberg class to be like the core one
- Update the WP_Theme_JSON_Resolver_Gutenberg class to be like the core one
- Move Global Styles code to lib/compat/wordpress-5.9 folder
- E2E Tests: Fix failing image e2e test by waiting for required element
- Navigation: Try removing absorb toolbar prop.
- Navigation: Fix navigation justifications.
- Fix wordbreak for URLs
- Polish unset color indicator.
- Template revert flow: Make label description source agnostic
- [Block Library - Navigation]: Fix vertical layout
- Add: Corners to custom color picker popover
- Add: Missing margin to the color picker clear button
- Gradient: Fix clearing a custom gradient from throwing a React warning
- [Block Library]: Rename Query Pagination blocks
- PHP Unit Tests: Use global transients 
- Remove CSS that causes conflict with theme.json
- Add actions which fire during the loading process of block template parts
- Fix usage of useSetting('color.palette')
- Update micromodal, include click-through fix
- Site Editor: Remove unused PHP code
- Don't try and render unstable location if Nav block has ID
- Fix gutenberg prefixed function references in core
- Card: support the extraSmall option for the size prop
- Gallery block: enable the new gallery block by default if running in core 
- Block fixtures: Change port to 8889 to placate KSES
- Full Site Editing: Remove block template resolution unit tests
- Site Editor: Sync export API

See #54487.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-06 06:20:27 +00:00
audrasjb 38e19413f6 Docs: Miscellaneous Docblock corrections in several `/block-supports` files.
See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-01 23:16:04 +00:00
audrasjb 931b03e4f9 Docs: Misc Docblock corrections in `duotone.php` file.
Follow-up to [50929].

See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-01 14:07:59 +00:00
noisysocks c2d0fb2040 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Navigation: Fix click-button size, submenu directions, scrollbars.
- Group - Fix overzealous regex when restoring inner containers
- Babel Preset: Update Babel packages to 7.16 version
- theme.json: adds a setting property that enables some other ones
- Polish metabox container.
- Fix submenu justification and spacer orientation.
- Fix Gutenberg 11.8.2 in WordPress trunk
- Strip meta tags from pasted links in Chromium
- Hide visilibility and status for navigation posts
- Navigation: Refactor and simplify setup state.
- Nav block menu switcher - decode HTML entities and utilise accessible markup pattern
- Rename fse_navigation_area to wp_navigation_area
- theme.json: adds a setting property that enables some other ones
- Revert "theme.json: adds a setting property that enables some other ones"
- Skip flaky image block test
- WordPress/gutenberg@3c935c4
- React to any errors coming up in gutenberg_migrate_menu_to_navigation_post
- Return wp error from wp_insert_post
- Fix not transforming logical assignments for packages

See #54337.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51753 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-15 12:50:17 +00:00
noisysocks 51d95be654 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Group - Fix inner container regexes using fixed div tag
- Image block: Make sure the Image block border radius is inherited if the image is linked
- Navigation: Small fixes
- FSE: Add template_type guards
- Template Part Block: Add some guards
- Fix getEntityRecords to ensure resolution on REST API failure
- Ensure menus before map operation in Nav block
- Link editing: Account for link anchor no longer being present when generating unique link instance key
- Navigation: Hide post attributes meta box
- Fix failing tests and compatibility with 5.9.
- Fix missing <MainDashboardButton> slot fill in site editor
- Move WP_REST_Block_Navigation_Areas_Controller from Gutenberg to Core.
- Fix site editor reset styles in WP 5.9

See #54337.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-11 07:43:31 +00:00
noisysocks 3e094c27d0 Update @wordpress packages
Update packages to include these bug fixes from Gutenberg:

- Force remount LinkControl when moving between links within same richtext block
- Site Editor: Change ToolsMoreMenuGroup slot-fill name
- Respect fields param for global styles REST API requests.
- Try ensuring the item after post content clears floats
- Fix submenus not opening on click
- Apply i18n functions to Nav block menu drops when selecting existing Menu
- Gallery: Make sure the mobile warning notice only runs when images are added to a new block
- Prepare navigation php code for core patch
- Address deprecation issues from Buttons flex layout PR.
- Block Library: Fix incorrect attributes definitions
- Fix Navigation accessibility issues

See #54337.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-10 06:01:30 +00:00