@@ -237,6 +237,7 @@ class WP_Theme_JSON {
237237 * @since 6.5.0 Added `aspect-ratio` property.
238238 * @since 6.6.0 Added `background-[image|position|repeat|size]` properties.
239239 * @since 6.7.0 Added `background-attachment` property.
240+ * @since 7.0.0 Added `text-indent` property.
240241 * @var array
241242 */
242243 const PROPERTIES_METADATA = array (
@@ -298,6 +299,7 @@ class WP_Theme_JSON {
298299 '--wp--style--root--padding-bottom ' => array ( 'spacing ' , 'padding ' , 'bottom ' ),
299300 '--wp--style--root--padding-left ' => array ( 'spacing ' , 'padding ' , 'left ' ),
300301 'text-decoration ' => array ( 'typography ' , 'textDecoration ' ),
302+ 'text-indent ' => array ( 'typography ' , 'textIndent ' ),
301303 'text-transform ' => array ( 'typography ' , 'textTransform ' ),
302304 'filter ' => array ( 'filter ' , 'duotone ' ),
303305 'box-shadow ' => array ( 'shadow ' ),
@@ -395,6 +397,7 @@ class WP_Theme_JSON {
395397 * @since 6.6.0 Added support for 'dimensions.aspectRatios', 'dimensions.defaultAspectRatios',
396398 * 'typography.defaultFontSizes', and 'spacing.defaultSpacingSizes'.
397399 * @since 6.9.0 Added support for `border.radiusSizes`.
400+ * @since 7.0.0 Added support for `typography.text-indent`.
398401 * @var array
399402 */
400403 const VALID_SETTINGS = array (
@@ -477,6 +480,7 @@ class WP_Theme_JSON {
477480 'textAlign ' => null ,
478481 'textColumns ' => null ,
479482 'textDecoration ' => null ,
483+ 'textIndent ' => null ,
480484 'textTransform ' => null ,
481485 'writingMode ' => null ,
482486 ),
@@ -527,6 +531,7 @@ class WP_Theme_JSON {
527531 * @since 6.3.0 Added support for `typography.textColumns`.
528532 * @since 6.5.0 Added support for `dimensions.aspectRatio`.
529533 * @since 6.6.0 Added `background` sub properties to top-level only.
534+ * @since 7.0.0 Added support for `typography.textIndent`.
530535 * @var array
531536 */
532537 const VALID_STYLES = array (
@@ -581,6 +586,7 @@ class WP_Theme_JSON {
581586 'textAlign ' => null ,
582587 'textColumns ' => null ,
583588 'textDecoration ' => null ,
589+ 'textIndent ' => null ,
584590 'textTransform ' => null ,
585591 'writingMode ' => null ,
586592 ),
@@ -630,6 +636,7 @@ class WP_Theme_JSON {
630636 // The block classes are necessary to target older content that won't use the new class names.
631637 'caption ' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption ' ,
632638 'cite ' => 'cite ' ,
639+ 'text ' => 'p ' ,
633640 'textInput ' => 'textarea, input:where([type=email],[type=number],[type=password],[type=search],[type=text],[type=tel],[type=url]) ' ,
634641 'select ' => 'select ' ,
635642 );
@@ -2998,6 +3005,24 @@ static function ( $pseudo_selector ) use ( $selector ) {
29983005 $ declarations = static ::update_separator_declarations ( $ declarations );
29993006 }
30003007
3008+ // Handle text-indent for paragraph blocks and text element: extract it and generate p + p selector.
3009+ $ text_indent_declarations = array ();
3010+ $ is_processing_element = in_array ( 'elements ' , $ block_metadata ['path ' ], true );
3011+ $ current_element = $ is_processing_element ? $ block_metadata ['path ' ][ count ( $ block_metadata ['path ' ] ) - 1 ] : null ;
3012+ $ should_use_p_plus_p = ( ! empty ( $ block_metadata ['name ' ] ) && 'core/paragraph ' === $ block_metadata ['name ' ] ) ||
3013+ ( 'text ' === $ current_element );
3014+
3015+ if ( $ should_use_p_plus_p ) {
3016+ foreach ( $ declarations as $ index => $ declaration ) {
3017+ if ( 'text-indent ' === $ declaration ['name ' ] ) {
3018+ $ text_indent_declarations [] = $ declaration ;
3019+ unset( $ declarations [ $ index ] );
3020+ }
3021+ }
3022+ // Re-index array after unsetting elements.
3023+ $ declarations = array_values ( $ declarations );
3024+ }
3025+
30013026 /*
30023027 * Root selector (body) styles should not be wrapped in `:root where()` to keep
30033028 * specificity at (0,0,1) and maintain backwards compatibility.
@@ -3026,6 +3051,11 @@ static function ( $pseudo_selector ) use ( $selector ) {
30263051 $ block_rules .= static ::to_ruleset ( $ block_metadata ['duotone ' ], $ declarations_duotone );
30273052 }
30283053
3054+ // 3a. Generate and append text-indent rules for paragraph blocks using p + p selector.
3055+ if ( ! empty ( $ text_indent_declarations ) ) {
3056+ $ block_rules .= static ::to_ruleset ( 'p + p ' , $ text_indent_declarations );
3057+ }
3058+
30293059 // 4. Generate Layout block gap styles.
30303060 if (
30313061 ! $ is_root_selector &&
0 commit comments