Commit Graph

21 Commits

Author SHA1 Message Date
audrasjb
ecb977b5e2 Editor: Style Engine - continue get_classnames loop after adding the default classname.
The `WP_Style_Engine` class has a method `get_classnames` that builds classnames. It loops over an array to add each classname. This changeset adds a `continue` in the loop after adding the default classname.

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

Props ramonopoly.
Fixes #60847.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57768 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-06-03 22:04:13 +00:00
isabel_brison
629273d54f Editor: add Style Engine support for nested CSS rules.
Adds support for passing a `$rules_group` string to wp_style_engine_get_stylesheet_from_css_rules(), so rules can be nested under a media query, layer or other rule.

Props isabel_brison, ramonopoly.
Fixes #61099.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-03 04:47:12 +00:00
isabel_brison
2140b001bd Editor: introduce dimensions.aspectRatio block support.
Adds front end rendering logic for the `dimensions.aspectRatio` block support as well as the required logic in `WP_Theme_JSON` and the style engine.

Props andrewserong.
Fixes #60365.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56992 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-31 02:54:17 +00:00
isabel_brison
90088c4c92 Editor: add size and repeat to background image support.
Adds background size and background repeat style processing to the background image block support and `WP_Style_Engine` definitions.

Props andrewserong, mukesh27.
Fixes #60175.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 06:12:18 +00:00
isabel_brison
6e67ad1701 Editor: add CSS var parsing for fontSize and fontFamily.
Adds capability to parse CSS custom properties for fontSize and fontFamily in `WP_Style_Engine`.

Props ramonopoly.
Fixes #59982.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-09 02:45:16 +00:00
isabel_brison
3c22144a0d Editor: fix typo in css_var doc update.
Fixes a type in the doc update in [56630].

Props ramonopoly, audrasjb, costdev.
Fixes #59401.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 00:18:23 +00:00
isabel_brison
d761ed56ca Editor: update docs for css_var.
Updates inline doc for the `css_var` key value pair in WP_Style_Engine.

Props ramonopoly.
Fixes #59401.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 07:06:20 +00:00
isabel_brison
82f6ce639b Editor: add background image support.
Adds a new background block support with the ability to set a background image on blocks that opt into it.

Props andrewserong, mukesh27.
Fixes #59357.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 01:29:23 +00:00
isabel_brison
305ccb98e0 Editor: add block instance element color support for buttons and headings.
Adds support for buttons and headings to the colors and elements block supports, allowing button and heading element colors to be changed on individual blocks.

Props aaronrobertshaw.
Fixes #59309.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 06:27:19 +00:00
isabel_brison
21ecbc3b0d Editor: disable default style engine optimisation.
Stops style engine from combining CSS selectors by default so that rule order is preserved.

Props ramonopoly, rajinsharwar, timdix, costdev, audrasjb, SergeyBiryukov, JeffPaul, mukesh27.
Fixes #58811.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56086 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 04:56:21 +00:00
isabel_brison
4e0fbeb04c Editor: add box shadow support to blocks.
Adds the ability for blocks to declare support for CSS box-shadow and processing of necessary styles.

Props madhudollu, sabernhardt, ramonopoly, spacedmonkey, mukesh27.
Fixes #58590.

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


git-svn-id: http://core.svn.wordpress.org/trunk@55558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 23:44:29 +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
Sergey Biryukov
95bcde947f Docs: Correct default value for the $optimize option in Style Engine.
The default value is set to `true` in `WP_Style_Engine_Processor::get_css()`, but was previously documented as `false` in various DocBlocks.

Follow-up to [54156], [55719], [55733], [55819].

See #57840.
Built from https://develop.svn.wordpress.org/trunk@55820


git-svn-id: http://core.svn.wordpress.org/trunk@55332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-17 12:06:19 +00:00
Sergey Biryukov
c14343ba25 Docs: Improve Style Engine DocBlocks per the documentation standards.
Follow-up to [54156], [55719], [55733].

See #57840.
Built from https://develop.svn.wordpress.org/trunk@55819


git-svn-id: http://core.svn.wordpress.org/trunk@55331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-17 11:58:26 +00:00
Sergey Biryukov
5da872aa27 Docs: Improve Style Engine file and class headers per the documentation standards.
Follow-up to [54156], [55719].

See #57840.
Built from https://develop.svn.wordpress.org/trunk@55733


git-svn-id: http://core.svn.wordpress.org/trunk@55245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-09 10:37:22 +00:00
Sergey Biryukov
8b53b81183 Docs: Remove @return void from various DocBlocks.
Per the documentation standards, it should not be used outside of the default bundled themes.

Follow-up to [52049], [52051], [53331], [54156], [54214], [55203], [55719].

See #57840.
Built from https://develop.svn.wordpress.org/trunk@55725


git-svn-id: http://core.svn.wordpress.org/trunk@55237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-06 11:40:24 +00:00
John Blackbourn
7a343e478e Docs: Correct and improve inline docs relating to the style engine.
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-03 23:57:18 +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
Sergey Biryukov
82d2620d50 Code Modernization: Add AllowDynamicProperties attribute to recently introduced classes.
This commit is a follow-up to [54133] for new classes introduced in WordPress 6.1 since the previous commit.

Dynamic (non-explicitly declared) properties are deprecated as of PHP 8.2 and are expected to become a fatal error in PHP 9.0.

There are a number of ways to mitigate this:
* If it is an accidental typo for a declared property: fix the typo.
* For known properties: declare them on the class.
* For unknown properties: add the magic `__get()`, `__set()`, et al. methods to the class or let the class extend `stdClass` which has highly optimized versions of these magic methods built in.
* For unknown ''use'' of dynamic properties, the `#[AllowDynamicProperties]` attribute can be added to the class. The attribute will automatically be inherited by child classes.

Trac ticket #56034 is open to investigate and handle the third and fourth type of situations, however it has become clear this will need more time and will not be ready in time for WP 6.1.

To reduce “noise” in the meantime, both in the error logs of WP users moving onto PHP 8.2, in the test run logs of WP itself, in test runs of plugins and themes, as well as to prevent duplicate tickets from being opened for the same issue, the `#[AllowDynamicProperties]` attribute has been added to all “parent” classes in WP.

Reference: [https://wiki.php.net/rfc/deprecate_dynamic_properties PHP RFC: Deprecate dynamic properties].

Follow-up to [53922], [54133].

Props jrf.
See #56513, #56034.
Built from https://develop.svn.wordpress.org/trunk@54481


git-svn-id: http://core.svn.wordpress.org/trunk@54040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 15:00:12 +00:00
davidbaumwald
4722fcfca8 Editor: Remove deprecated callable in WP_Style_Engine class.
Resolves a `Use of "static" in callables is deprecated` notice in = PHP 8.2 and mark `WP_Style_Engine` as a `final` class that will not be extended.

Follow-up to [54156].

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


git-svn-id: http://core.svn.wordpress.org/trunk@53916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-29 18:05:09 +00:00
audrasjb
1e791f041d Editor: Backport Style Engine API functions, classes and tests.
This PR migrates the Style Engine PHP functions, classes and tests into Core for 6.1. It backports the original [WordPress/gutenberg#40260 PR #40260] from Gutenberg repository.

Props ramonopoly, bernhard-reiter, costdev, azaozz, andrewserong, mukesh27, aristath.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 12:48:16 +00:00