Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0936195
Add WP_Theme_JSON class from core and call it WP_Theme_JSON_Gutenberg
oandregal Dec 14, 2022
49438da
compat/6.1: add missing outline properties
oandregal Dec 14, 2022
62e8eda
compat/6.1: add missing backport for constructor
oandregal Dec 14, 2022
77c14ab
compat/6.1: get_blocks_metadata
oandregal Dec 14, 2022
fdb76a5
compat/6.1: get_style_nodes add missing backport
oandregal Dec 14, 2022
db229c9
compat/6.1: get_style_nodes & get_block_nodes add missing backport
oandregal Dec 14, 2022
c7647d9
compat/6.1: add missing backport for get_stylesheet
oandregal Dec 14, 2022
ddb2db2
compat/6.1: update_separator_declarations
oandregal Dec 15, 2022
29a0a2a
compat/6.1: get_root_layout_rules
oandregal Dec 15, 2022
925ff87
compat/6.1: get_property_value
oandregal Dec 15, 2022
0ae5b88
compat/6.1: set_spacing_sizes
oandregal Dec 15, 2022
986ec3d
Fix lint issues
oandregal Dec 15, 2022
2ff5a80
Port compat/6.2 dimensions
oandregal Dec 15, 2022
4294dfc
Port compat/6.2 custom css
oandregal Dec 15, 2022
af1db74
Port compat/6.2 indirect properties
oandregal Dec 15, 2022
5f21cca
Remove no longer necessary theme.json class for 6.2
oandregal Dec 15, 2022
19f6ea5
Remove no longer necessary theme.json class for 6.1
oandregal Dec 15, 2022
381078c
Remove no longer necesary experimental theme.json class
oandregal Dec 15, 2022
3fbc491
Update PHPDoc: set class metadata to Gutenberg
oandregal Dec 15, 2022
1d5c557
Use functions from Gutenberg, not core
oandregal Dec 15, 2022
230ba74
Fix bug introduced by core refactor
oandregal Dec 15, 2022
9df365e
Remove trailing whitespace and fix tests
oandregal Dec 15, 2022
2111d11
Add back missing remove_insecure_properties method from core
oandregal Dec 15, 2022
61b368f
Move theme.json class to lib/
oandregal Dec 15, 2022
768761c
Add missing PHPdoc
oandregal Dec 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Port compat/6.2 dimensions
See #45300
  • Loading branch information
oandregal committed Dec 15, 2022
commit 2ff5a8027f55a5740f76381b67974be6227a5b9c
149 changes: 0 additions & 149 deletions lib/compat/wordpress-6.2/class-wp-theme-json-6-2.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,87 +15,6 @@
* @access private
*/
class WP_Theme_JSON_6_2 extends WP_Theme_JSON_6_1 {
const APPEARANCE_TOOLS_OPT_INS = array(
array( 'border', 'color' ),
array( 'border', 'radius' ),
array( 'border', 'style' ),
array( 'border', 'width' ),
array( 'color', 'link' ),
array( 'dimensions', 'minHeight' ),
array( 'spacing', 'blockGap' ),
array( 'spacing', 'margin' ),
array( 'spacing', 'padding' ),
array( 'typography', 'lineHeight' ),
);

/**
* Metadata for style properties.
*
* Each element is a direct mapping from the CSS property name to the
* path to the value in theme.json & block attributes.
*
* @since 5.8.0
* @since 5.9.0 Added the `border-*`, `font-family`, `font-style`, `font-weight`,
* `letter-spacing`, `margin-*`, `padding-*`, `--wp--style--block-gap`,
* `text-decoration`, `text-transform`, and `filter` properties,
* simplified the metadata structure.
* @since 6.1.0 Added the `border-*-color`, `border-*-width`, `border-*-style`,
* `--wp--style--root--padding-*`, and `box-shadow` properties,
* removed the `--wp--style--block-gap` property.
* @since 6.2.0 Added `min-height`.
* @var array
*/
const PROPERTIES_METADATA = array(
'background' => array( 'color', 'gradient' ),
'background-color' => array( 'color', 'background' ),
'border-radius' => array( 'border', 'radius' ),
'border-top-left-radius' => array( 'border', 'radius', 'topLeft' ),
'border-top-right-radius' => array( 'border', 'radius', 'topRight' ),
'border-bottom-left-radius' => array( 'border', 'radius', 'bottomLeft' ),
'border-bottom-right-radius' => array( 'border', 'radius', 'bottomRight' ),
'border-color' => array( 'border', 'color' ),
'border-width' => array( 'border', 'width' ),
'border-style' => array( 'border', 'style' ),
'border-top-color' => array( 'border', 'top', 'color' ),
'border-top-width' => array( 'border', 'top', 'width' ),
'border-top-style' => array( 'border', 'top', 'style' ),
'border-right-color' => array( 'border', 'right', 'color' ),
'border-right-width' => array( 'border', 'right', 'width' ),
'border-right-style' => array( 'border', 'right', 'style' ),
'border-bottom-color' => array( 'border', 'bottom', 'color' ),
'border-bottom-width' => array( 'border', 'bottom', 'width' ),
'border-bottom-style' => array( 'border', 'bottom', 'style' ),
'border-left-color' => array( 'border', 'left', 'color' ),
'border-left-width' => array( 'border', 'left', 'width' ),
'border-left-style' => array( 'border', 'left', 'style' ),
'color' => array( 'color', 'text' ),
'font-family' => array( 'typography', 'fontFamily' ),
'font-size' => array( 'typography', 'fontSize' ),
'font-style' => array( 'typography', 'fontStyle' ),
'font-weight' => array( 'typography', 'fontWeight' ),
'letter-spacing' => array( 'typography', 'letterSpacing' ),
'line-height' => array( 'typography', 'lineHeight' ),
'margin' => array( 'spacing', 'margin' ),
'margin-top' => array( 'spacing', 'margin', 'top' ),
'margin-right' => array( 'spacing', 'margin', 'right' ),
'margin-bottom' => array( 'spacing', 'margin', 'bottom' ),
'margin-left' => array( 'spacing', 'margin', 'left' ),
'min-height' => array( 'dimensions', 'minHeight' ),
'padding' => array( 'spacing', 'padding' ),
'padding-top' => array( 'spacing', 'padding', 'top' ),
'padding-right' => array( 'spacing', 'padding', 'right' ),
'padding-bottom' => array( 'spacing', 'padding', 'bottom' ),
'padding-left' => array( 'spacing', 'padding', 'left' ),
'--wp--style--root--padding' => array( 'spacing', 'padding' ),
'--wp--style--root--padding-top' => array( 'spacing', 'padding', 'top' ),
'--wp--style--root--padding-right' => array( 'spacing', 'padding', 'right' ),
'--wp--style--root--padding-bottom' => array( 'spacing', 'padding', 'bottom' ),
'--wp--style--root--padding-left' => array( 'spacing', 'padding', 'left' ),
'text-decoration' => array( 'typography', 'textDecoration' ),
'text-transform' => array( 'typography', 'textTransform' ),
'filter' => array( 'filter', 'duotone' ),
'box-shadow' => array( 'shadow' ),
);

/**
* Indirect metadata for style properties that are not directly output.
Expand All @@ -116,74 +35,6 @@ class WP_Theme_JSON_6_2 extends WP_Theme_JSON_6_1 {
'row-gap' => array( 'spacing', 'blockGap', 'top' ),
);

/**
* The valid properties under the settings key.
*
* @since 5.8.0 As `ALLOWED_SETTINGS`.
* @since 5.9.0 Renamed from `ALLOWED_SETTINGS` to `VALID_SETTINGS`,
* added new properties for `border`, `color`, `spacing`,
* and `typography`, and renamed others according to the new schema.
* @since 6.0.0 Added `color.defaultDuotone`.
* @since 6.1.0 Added `layout.definitions` and `useRootPaddingAwareAlignments`.
* @since 6.2.0 Added `dimensions.minHeight`.
* @var array
*/
const VALID_SETTINGS = array(
'appearanceTools' => null,
'useRootPaddingAwareAlignments' => null,
'border' => array(
'color' => null,
'radius' => null,
'style' => null,
'width' => null,
),
'color' => array(
'background' => null,
'custom' => null,
'customDuotone' => null,
'customGradient' => null,
'defaultDuotone' => null,
'defaultGradients' => null,
'defaultPalette' => null,
'duotone' => null,
'gradients' => null,
'link' => null,
'palette' => null,
'text' => null,
),
'custom' => null,
'dimensions' => array(
'minHeight' => null,
),
'layout' => array(
'contentSize' => null,
'definitions' => null,
'wideSize' => null,
),
'spacing' => array(
'customSpacingSize' => null,
'spacingSizes' => null,
'spacingScale' => null,
'blockGap' => null,
'margin' => null,
'padding' => null,
'units' => null,
),
'typography' => array(
'fluid' => null,
'customFontSize' => null,
'dropCap' => null,
'fontFamilies' => null,
'fontSizes' => null,
'fontStyle' => null,
'fontWeight' => null,
'letterSpacing' => null,
'lineHeight' => null,
'textDecoration' => null,
'textTransform' => null,
),
);

/**
* The valid properties under the styles key.
*
Expand Down
11 changes: 11 additions & 0 deletions lib/compat/wordpress-6.2/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ class WP_Theme_JSON_Gutenberg {
* @since 6.1.0 Added the `border-*-color`, `border-*-width`, `border-*-style`,
* `--wp--style--root--padding-*`, and `box-shadow` properties,
* removed the `--wp--style--block-gap` property.
* @since 6.2.0 Added `min-height`.
* @var array
*/
const PROPERTIES_METADATA = array(
Expand Down Expand Up @@ -229,6 +230,7 @@ class WP_Theme_JSON_Gutenberg {
'margin-right' => array( 'spacing', 'margin', 'right' ),
'margin-bottom' => array( 'spacing', 'margin', 'bottom' ),
'margin-left' => array( 'spacing', 'margin', 'left' ),
'min-height' => array( 'dimensions', 'minHeight' ),
'outline-color' => array( 'outline', 'color' ),
'outline-offset' => array( 'outline', 'offset' ),
'outline-style' => array( 'outline', 'style' ),
Expand Down Expand Up @@ -291,6 +293,7 @@ class WP_Theme_JSON_Gutenberg {
* and `typography`, and renamed others according to the new schema.
* @since 6.0.0 Added `color.defaultDuotone`.
* @since 6.1.0 Added `layout.definitions` and `useRootPaddingAwareAlignments`.
* @since 6.2.0 Added `dimensions.minHeight`.
* @var array
*/
const VALID_SETTINGS = array(
Expand All @@ -317,6 +320,9 @@ class WP_Theme_JSON_Gutenberg {
'text' => null,
),
'custom' => null,
'dimensions' => array(
'minHeight' => null,
),
'layout' => array(
'contentSize' => null,
'definitions' => null,
Expand Down Expand Up @@ -356,6 +362,7 @@ class WP_Theme_JSON_Gutenberg {
* @since 6.1.0 Added new side properties for `border`,
* added new property `shadow`,
* updated `blockGap` to be allowed at any level.
* @since 6.2.0 Added `dimensions.minHeight`.
* @var array
*/
const VALID_STYLES = array(
Expand All @@ -374,6 +381,9 @@ class WP_Theme_JSON_Gutenberg {
'gradient' => null,
'text' => null,
),
'dimensions' => array(
'minHeight' => null,
),
'filter' => array(
'duotone' => null,
),
Expand Down Expand Up @@ -492,6 +502,7 @@ public static function get_element_class_name( $element ) {
array( 'border', 'style' ),
array( 'border', 'width' ),
array( 'color', 'link' ),
array( 'dimensions', 'minHeight' ),
array( 'spacing', 'blockGap' ),
array( 'spacing', 'margin' ),
array( 'spacing', 'padding' ),
Expand Down