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
This commit is contained in:
hellofromTonya 2022-12-19 20:55:13 +00:00
parent eff9f72714
commit 3ddfa88245
2 changed files with 15 additions and 1 deletions

View File

@ -192,6 +192,8 @@ class WP_Theme_JSON {
* @since 6.1.0 Added the `border-*-color`, `border-*-width`, `border-*-style`, * @since 6.1.0 Added the `border-*-color`, `border-*-width`, `border-*-style`,
* `--wp--style--root--padding-*`, and `box-shadow` properties, * `--wp--style--root--padding-*`, and `box-shadow` properties,
* removed the `--wp--style--block-gap` property. * removed the `--wp--style--block-gap` property.
* @since 6.2.0 Added `outline-*` properties.
*
* @var array * @var array
*/ */
const PROPERTIES_METADATA = array( const PROPERTIES_METADATA = array(
@ -229,6 +231,10 @@ class WP_Theme_JSON {
'margin-right' => array( 'spacing', 'margin', 'right' ), 'margin-right' => array( 'spacing', 'margin', 'right' ),
'margin-bottom' => array( 'spacing', 'margin', 'bottom' ), 'margin-bottom' => array( 'spacing', 'margin', 'bottom' ),
'margin-left' => array( 'spacing', 'margin', 'left' ), 'margin-left' => array( 'spacing', 'margin', 'left' ),
'outline-color' => array( 'outline', 'color' ),
'outline-offset' => array( 'outline', 'offset' ),
'outline-style' => array( 'outline', 'style' ),
'outline-width' => array( 'outline', 'width' ),
'padding' => array( 'spacing', 'padding' ), 'padding' => array( 'spacing', 'padding' ),
'padding-top' => array( 'spacing', 'padding', 'top' ), 'padding-top' => array( 'spacing', 'padding', 'top' ),
'padding-right' => array( 'spacing', 'padding', 'right' ), 'padding-right' => array( 'spacing', 'padding', 'right' ),
@ -352,6 +358,8 @@ class WP_Theme_JSON {
* @since 6.1.0 Added new side properties for `border`, * @since 6.1.0 Added new side properties for `border`,
* added new property `shadow`, * added new property `shadow`,
* updated `blockGap` to be allowed at any level. * updated `blockGap` to be allowed at any level.
* @since 6.2.0 Added `outline` properties.
*
* @var array * @var array
*/ */
const VALID_STYLES = array( const VALID_STYLES = array(
@ -374,6 +382,12 @@ class WP_Theme_JSON {
'duotone' => null, 'duotone' => null,
), ),
'shadow' => null, 'shadow' => null,
'outline' => array(
'color' => null,
'offset' => null,
'style' => null,
'width' => null,
),
'spacing' => array( 'spacing' => array(
'margin' => null, 'margin' => null,
'padding' => null, 'padding' => null,

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.2-alpha-55007'; $wp_version = '6.2-alpha-55008';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.