Skip to content

Commit 771d29d

Browse files
committed
prep build 5/28
2 parents 726b962 + 513f9ea commit 771d29d

File tree

76 files changed

+1009
-927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1009
-927
lines changed

backport-changelog/6.6/6522.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
https://github.com/WordPress/wordpress-develop/pull/6522
2+
3+
* https://github.com/WordPress/gutenberg/pull/60106
4+
* https://github.com/WordPress/gutenberg/pull/60228
5+
* https://github.com/WordPress/gutenberg/pull/61638

backport-changelog/6.6/6656.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
https://github.com/WordPress/wordpress-develop/pull/6656
2+
3+
* https://github.com/WordPress/gutenberg/pull/60715

lib/class-wp-theme-json-gutenberg.php

+12-14
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ protected function process_blocks_custom_css( $css, $selector ) {
12931293
$is_root_css = ( ! str_contains( $part, '{' ) );
12941294
if ( $is_root_css ) {
12951295
// If the part doesn't contain braces, it applies to the root level.
1296-
$processed_css .= trim( $selector ) . '{' . trim( $part ) . '}';
1296+
$processed_css .= ':root :where(' . trim( $selector ) . '){' . trim( $part ) . '}';
12971297
} else {
12981298
// If the part contains braces, it's a nested CSS rule.
12991299
$part = explode( '{', str_replace( '}', '', $part ) );
@@ -1305,7 +1305,8 @@ protected function process_blocks_custom_css( $css, $selector ) {
13051305
$part_selector = str_starts_with( $nested_selector, ' ' )
13061306
? static::scope_selector( $selector, $nested_selector )
13071307
: static::append_to_selector( $selector, $nested_selector );
1308-
$processed_css .= $part_selector . '{' . trim( $css_value ) . '}';
1308+
$final_selector = ":root :where($part_selector)";
1309+
$processed_css .= $final_selector . '{' . trim( $css_value ) . '}';
13091310
}
13101311
}
13111312
return $processed_css;
@@ -1322,6 +1323,7 @@ public function get_custom_css() {
13221323
$block_custom_css = '';
13231324
$block_nodes = $this->get_block_custom_css_nodes();
13241325
foreach ( $block_nodes as $node ) {
1326+
// The node selector will have its specificity set to 0-1-0 within process_blocks_custom_css.
13251327
$block_custom_css .= $this->get_block_custom_css( $node['css'], $node['selector'] );
13261328
}
13271329

@@ -1564,7 +1566,7 @@ protected function get_layout_styles( $block_metadata, $types = array() ) {
15641566
$spacing_rule['selector']
15651567
);
15661568
} else {
1567-
$format = static::ROOT_BLOCK_SELECTOR === $selector ? ':where(.%2$s) %3$s' : ':where(%1$s-%2$s) %3$s';
1569+
$format = static::ROOT_BLOCK_SELECTOR === $selector ? '.%2$s %3$s' : '%1$s-%2$s %3$s';
15681570
$layout_selector = sprintf(
15691571
$format,
15701572
$selector,
@@ -2745,7 +2747,7 @@ static function ( $pseudo_selector ) use ( $selector ) {
27452747
}
27462748

27472749
// 2. Generate and append the rules that use the general selector.
2748-
$block_rules .= static::to_ruleset( ":where($selector)", $declarations );
2750+
$block_rules .= static::to_ruleset( ":root :where($selector)", $declarations );
27492751

27502752
// 3. Generate and append the rules that use the duotone selector.
27512753
if ( isset( $block_metadata['duotone'] ) && ! empty( $declarations_duotone ) ) {
@@ -2762,12 +2764,12 @@ static function ( $pseudo_selector ) use ( $selector ) {
27622764

27632765
// 5. Generate and append the feature level rulesets.
27642766
foreach ( $feature_declarations as $feature_selector => $individual_feature_declarations ) {
2765-
$block_rules .= static::to_ruleset( ":where($feature_selector)", $individual_feature_declarations );
2767+
$block_rules .= static::to_ruleset( ":root :where($feature_selector)", $individual_feature_declarations );
27662768
}
27672769

27682770
// 6. Generate and append the style variation rulesets.
27692771
foreach ( $style_variation_declarations as $style_variation_selector => $individual_style_variation_declarations ) {
2770-
$block_rules .= static::to_ruleset( $style_variation_selector, $individual_style_variation_declarations );
2772+
$block_rules .= static::to_ruleset( ":root :where($style_variation_selector)", $individual_style_variation_declarations );
27712773
}
27722774

27732775
return $block_rules;
@@ -2816,16 +2818,12 @@ public function get_root_layout_rules( $selector, $block_metadata ) {
28162818
$css .= '.wp-site-blocks { padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom); }';
28172819
// Right and left padding are applied to the first container with `.has-global-padding` class.
28182820
$css .= '.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }';
2819-
// Nested containers with `.has-global-padding` class do not get padding.
2820-
$css .= '.has-global-padding :where(.has-global-padding:not(.wp-block-block)) { padding-right: 0; padding-left: 0; }';
28212821
// Alignfull children of the container with left and right padding have negative margins so they can still be full width.
28222822
$css .= '.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }';
2823-
// The above rule is negated for alignfull children of nested containers.
2824-
$css .= '.has-global-padding :where(.has-global-padding:not(.wp-block-block)) > .alignfull { margin-right: 0; margin-left: 0; }';
2825-
// Some of the children of alignfull blocks without content width should also get padding: text blocks and non-alignfull container blocks.
2826-
$css .= '.has-global-padding > .alignfull:where(:not(.has-global-padding):not(.is-layout-flex):not(.is-layout-grid)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }';
2827-
// The above rule also has to be negated for blocks inside nested `.has-global-padding` blocks.
2828-
$css .= '.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),.wp-block:not(.alignfull),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0; }';
2823+
// Nested children of the container with left and right padding that are not wide or full aligned do not get padding.
2824+
$css .= '.has-global-padding :where(.has-global-padding:not(.wp-block-block, .alignfull, .alignwide)) { padding-right: 0; padding-left: 0; }';
2825+
// Nested children of the container with left and right padding that are not wide or full aligned do not get negative margin applied.
2826+
$css .= '.has-global-padding :where(.has-global-padding:not(.wp-block-block, .alignfull, .alignwide)) > .alignfull { margin-left: 0; margin-right: 0; }';
28292827
}
28302828

28312829
$css .= '.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }';

lib/experimental/full-page-client-side-navigation.php

+57-13
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,69 @@ function _gutenberg_add_enhanced_pagination_to_query_block( $parsed_block ) {
3333
add_filter( 'render_block_data', '_gutenberg_add_enhanced_pagination_to_query_block' );
3434

3535
/**
36-
* Add directives to all links.
36+
* Adds client-side navigation directives to BODY tag.
3737
*
3838
* Note: This should probably be done per site, not by default when this option is enabled.
3939
*
40-
* @param array $content The block content.
40+
* @param string $response_body The response body.
4141
*
42-
* @return array The same block content with the directives needed.
42+
* @return string The rendered template with modified BODY attributes.
4343
*/
44-
function _gutenberg_add_client_side_navigation_directives( $content ) {
45-
$p = new WP_HTML_Tag_Processor( $content );
46-
// Hack to add the necessary directives to the body tag.
47-
// TODO: Find a proper way to add directives to the body tag.
48-
static $body_interactive_added;
49-
if ( ! $body_interactive_added ) {
50-
$body_interactive_added = true;
51-
return (string) $p . '<body data-wp-interactive="core/experimental" data-wp-context="{}">';
44+
function _gutenberg_add_client_side_navigation_directives( $response_body ) {
45+
$is_html_content_type = false;
46+
foreach ( headers_list() as $header ) {
47+
$header_parts = preg_split( '/\s*[:;]\s*/', strtolower( $header ) );
48+
if ( count( $header_parts ) >= 2 && 'content-type' === $header_parts[0] ) {
49+
$is_html_content_type = in_array( $header_parts[1], array( 'text/html', 'application/xhtml+xml' ), true );
50+
}
5251
}
53-
return (string) $p;
52+
if ( ! $is_html_content_type ) {
53+
return $response_body;
54+
}
55+
56+
$p = new WP_HTML_Tag_Processor( $response_body );
57+
if ( $p->next_tag( array( 'tag_name' => 'BODY' ) ) ) {
58+
$p->set_attribute( 'data-wp-interactive', 'core/experimental' );
59+
$p->set_attribute( 'data-wp-context', '{}' );
60+
$response_body = $p->get_updated_html();
61+
}
62+
return $response_body;
5463
}
5564

5665
// TODO: Explore moving this to the server directive processing.
57-
add_filter( 'render_block', '_gutenberg_add_client_side_navigation_directives' );
66+
add_filter( 'gutenberg_template_output_buffer', '_gutenberg_add_client_side_navigation_directives' );
67+
68+
/**
69+
* Starts output buffering at the end of the 'template_include' filter.
70+
*
71+
* This is to implement #43258 in core.
72+
*
73+
* This is a hack which would eventually be replaced with something like this in wp-includes/template-loader.php:
74+
*
75+
* $template = apply_filters( 'template_include', $template );
76+
* + ob_start( 'wp_template_output_buffer_callback' );
77+
* if ( $template ) {
78+
* include $template;
79+
* } elseif ( current_user_can( 'switch_themes' ) ) {
80+
*
81+
* @link https://core.trac.wordpress.org/ticket/43258
82+
*
83+
* @param string $passthrough Value for the template_include filter which is passed through.
84+
*
85+
* @return string Unmodified value of $passthrough.
86+
*/
87+
function _gutenberg_buffer_template_output( string $passthrough ): string {
88+
ob_start(
89+
static function ( string $output ): string {
90+
/**
91+
* Filters the template output buffer prior to sending to the client.
92+
*
93+
* @param string $output Output buffer.
94+
* @return string Filtered output buffer.
95+
*/
96+
return (string) apply_filters( 'gutenberg_template_output_buffer', $output );
97+
}
98+
);
99+
return $passthrough;
100+
}
101+
add_filter( 'template_include', '_gutenberg_buffer_template_output', PHP_INT_MAX );

lib/theme.json

+34
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,40 @@
370370
"bottom": "0px",
371371
"left": "0px"
372372
}
373+
},
374+
"blocks": {
375+
"core/button": {
376+
"variations": {
377+
"outline": {
378+
"border": {
379+
"width": "2px",
380+
"style": "solid",
381+
"color": "currentColor"
382+
},
383+
"color": {
384+
"text": "currentColor",
385+
"gradient": "transparent none"
386+
},
387+
"spacing": {
388+
"padding": {
389+
"top": "0.667em",
390+
"right": "1.33em",
391+
"bottom": "0.667em",
392+
"left": "1.33em"
393+
}
394+
}
395+
}
396+
}
397+
},
398+
"core/site-logo": {
399+
"variations": {
400+
"rounded": {
401+
"border": {
402+
"radius": "9999px"
403+
}
404+
}
405+
}
406+
}
373407
}
374408
}
375409
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
"clean:packages": "rimraf \"./packages/*/@(build|build-module|build-style)\"",
277277
"dev": "npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"",
278278
"dev:packages": "concurrently \"node ./bin/packages/watch.js\" \"tsc --build --watch\"",
279-
"distclean": "rimraf node_modules packages/*/node_modules",
279+
"distclean": "git clean --force -d -X",
280280
"docs:api-ref": "node ./bin/api-docs/update-api-docs.js",
281281
"docs:blocks": "node ./bin/api-docs/gen-block-lib-list.js",
282282
"docs:build": "npm-run-all docs:gen docs:blocks docs:api-ref docs:theme-ref",

packages/block-editor/src/components/global-styles/background-panel.js

+40-25
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function backgroundSizeHelpText( value ) {
102102
if ( value === 'contain' ) {
103103
return __( 'Image is contained without distortion.' );
104104
}
105-
return __( 'Specify a fixed width.' );
105+
return __( 'Image has a fixed width.' );
106106
}
107107

108108
/**
@@ -174,13 +174,13 @@ function InspectorImagePreview( { label, filename, url: imgUrl } ) {
174174
{ imgLabel }
175175
</Truncate>
176176
<VisuallyHidden as="span">
177-
{ filename
177+
{ imgUrl
178178
? sprintf(
179179
/* translators: %s: file name */
180-
__( 'Selected image: %s' ),
181-
filename
180+
__( 'Background image: %s' ),
181+
filename || imgLabel
182182
)
183-
: __( 'No image selected' ) }
183+
: __( 'No background image selected' ) }
184184
</VisuallyHidden>
185185
</FlexItem>
186186
</HStack>
@@ -321,7 +321,7 @@ function BackgroundImageToolsPanelItem( {
321321
name={
322322
<InspectorImagePreview
323323
label={ title }
324-
filename={ title || __( 'Untitled' ) }
324+
filename={ title }
325325
url={ getResolvedThemeFilePath(
326326
url,
327327
themeFileURIs
@@ -443,6 +443,14 @@ function BackgroundSizeToolsPanelItem( {
443443
nextRepeat = undefined;
444444
}
445445

446+
/*
447+
* Next will be null when the input is cleared,
448+
* in which case the value should be 'auto'.
449+
*/
450+
if ( ! next && currentValueForToggle === 'auto' ) {
451+
next = 'auto';
452+
}
453+
446454
onChange(
447455
setImmutably( style, [ 'background' ], {
448456
...style?.background,
@@ -506,7 +514,9 @@ function BackgroundSizeToolsPanelItem( {
506514
value={ currentValueForToggle }
507515
onChange={ updateBackgroundSize }
508516
isBlock
509-
help={ backgroundSizeHelpText( sizeValue ) }
517+
help={ backgroundSizeHelpText(
518+
sizeValue || defaultValues?.backgroundSize
519+
) }
510520
>
511521
<ToggleGroupControlOption
512522
key={ 'cover' }
@@ -519,27 +529,32 @@ function BackgroundSizeToolsPanelItem( {
519529
label={ __( 'Contain' ) }
520530
/>
521531
<ToggleGroupControlOption
522-
key={ 'fixed' }
532+
key={ 'tile' }
523533
value={ 'auto' }
524-
label={ __( 'Fixed' ) }
534+
label={ __( 'Tile' ) }
525535
/>
526536
</ToggleGroupControl>
527-
{ currentValueForToggle !== undefined &&
528-
currentValueForToggle !== 'cover' &&
529-
currentValueForToggle !== 'contain' ? (
530-
<UnitControl
531-
size={ '__unstable-large' }
532-
onChange={ updateBackgroundSize }
533-
value={ sizeValue }
534-
/>
535-
) : null }
536-
{ currentValueForToggle !== 'cover' && (
537-
<ToggleControl
538-
label={ __( 'Repeat' ) }
539-
checked={ repeatCheckedValue }
540-
onChange={ toggleIsRepeated }
541-
/>
542-
) }
537+
<HStack justify="flex-start" spacing={ 2 } as="span">
538+
{ currentValueForToggle !== undefined &&
539+
currentValueForToggle !== 'cover' &&
540+
currentValueForToggle !== 'contain' ? (
541+
<UnitControl
542+
aria-label={ __( 'Background image width' ) }
543+
onChange={ updateBackgroundSize }
544+
value={ sizeValue }
545+
size={ '__unstable-large' }
546+
__unstableInputWidth="100px"
547+
min={ 0 }
548+
/>
549+
) : null }
550+
{ currentValueForToggle !== 'cover' && (
551+
<ToggleControl
552+
label={ __( 'Repeat' ) }
553+
checked={ repeatCheckedValue }
554+
onChange={ toggleIsRepeated }
555+
/>
556+
) }
557+
</HStack>
543558
</VStack>
544559
);
545560
}

0 commit comments

Comments
 (0)