-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try: Add a minHeight block support under dimensions
- Loading branch information
1 parent
a9c3933
commit 0de882e
Showing
22 changed files
with
585 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
<?php | ||
/** | ||
* WP_Theme_JSON_6_2 class | ||
* | ||
* @package gutenberg | ||
*/ | ||
|
||
/** | ||
* Class that encapsulates the processing of structures that adhere to the theme.json spec. | ||
* | ||
* This class is for internal core usage and is not supposed to be used by extenders (plugins and/or themes). | ||
* This is a low-level API that may need to do breaking changes. Please, | ||
* use get_global_settings, get_global_styles, and get_global_stylesheet instead. | ||
* | ||
* @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( 'dimensions', 'minHeight' ), | ||
array( 'color', 'link' ), | ||
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' ), | ||
); | ||
|
||
/** | ||
* 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. | ||
* | ||
* @since 5.8.0 As `ALLOWED_STYLES`. | ||
* @since 5.9.0 Renamed from `ALLOWED_STYLES` to `VALID_STYLES`, | ||
* added new properties for `border`, `filter`, `spacing`, | ||
* and `typography`. | ||
* @since 6.1.0 Added new side properties for `border`, | ||
* added new property `shadow`, | ||
* updated `blockGap` to be allowed at any level. | ||
* @var array | ||
*/ | ||
const VALID_STYLES = array( | ||
'border' => array( | ||
'color' => null, | ||
'radius' => null, | ||
'style' => null, | ||
'width' => null, | ||
'top' => null, | ||
'right' => null, | ||
'bottom' => null, | ||
'left' => null, | ||
), | ||
'color' => array( | ||
'background' => null, | ||
'gradient' => null, | ||
'text' => null, | ||
), | ||
'dimensions' => array( | ||
'minHeight' => null, | ||
), | ||
'filter' => array( | ||
'duotone' => null, | ||
), | ||
'shadow' => null, | ||
'spacing' => array( | ||
'margin' => null, | ||
'padding' => null, | ||
'blockGap' => null, | ||
), | ||
'typography' => array( | ||
'fontFamily' => null, | ||
'fontSize' => null, | ||
'fontStyle' => null, | ||
'fontWeight' => null, | ||
'letterSpacing' => null, | ||
'lineHeight' => null, | ||
'textDecoration' => null, | ||
'textTransform' => null, | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.