Skip to content

Commit df336fd

Browse files
committed
Gutenberg ref update.
CI run: WordPress/wordpress-develop#10988. See #64595. --- I've included a log of the Gutenberg changes with the following command: ``` git log --reverse --format="- %s" b441348bb7e05af351c250b74283f253acaf9138..23b566c72e9c4a36219ef5d6e62890f05551f6cb | sed 's|#\([0-9][0-9]*\)|https://github.com/WordPress/gutenberg/pull/\1|g; /github\.com\/WordPress\/gutenberg\/pull/!d' | pbcopy ``` - Remove experimental property from Icon block (WordPress/gutenberg#75742) - Real-time collab editing: Fix undo E2E test (WordPress/gutenberg#75740) - Snackbar: Fix scaling issue with snackbars that update their content via a common id (WordPress/gutenberg#75709) - Vips and worker-threads packages: remove private flag so that packages can be published to npm (WordPress/gutenberg#75752) - Update wordpress/vips in root package.json to use a relative path (WordPress/gutenberg#75758) - Fix change-detection and new-post E2E tests after RTC enabled by default (WordPress/gutenberg#75751) - Query: Remove content role from block (WordPress/gutenberg#75760) - `ToggleGroupControl`: Make unselected item color consistent across all variants (WordPress/gutenberg#75737) - Icon-block: fix global-styles selectors (WordPress/gutenberg#75724) - RTC: Add cap check for single taxonomy term entities (WordPress/gutenberg#75708) - Core Data: Create icons entity (WordPress/gutenberg#75773) Built from https://develop.svn.wordpress.org/trunk@61705 git-svn-id: http://core.svn.wordpress.org/trunk@61013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
1 parent eee843b commit df336fd

Some content is hidden

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

58 files changed

+735
-195
lines changed

wp-includes/assets/script-loader-packages.min.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
'import' => 'dynamic'
143143
)
144144
),
145-
'version' => '9adfd5c0b20d4d86a63d'
145+
'version' => '28f00a6393f97214aa04'
146146
),
147147
'block-serialization-default-parser.min.js' => array(
148148
'dependencies' => array(
@@ -214,7 +214,7 @@
214214
'wp-rich-text',
215215
'wp-warning'
216216
),
217-
'version' => '897ce4b17ffaf6b0b3dc'
217+
'version' => '3357a9a6e689c39b08a9'
218218
),
219219
'compose.min.js' => array(
220220
'dependencies' => array(
@@ -266,7 +266,7 @@
266266
'wp-url',
267267
'wp-warning'
268268
),
269-
'version' => '7315eaa7025445f864b5'
269+
'version' => '553521bc03a0cb8c2fb5'
270270
),
271271
'customize-widgets.min.js' => array(
272272
'dependencies' => array(
@@ -821,7 +821,7 @@
821821
'wp-hooks',
822822
'wp-private-apis'
823823
),
824-
'version' => '4c60996d1664ab866379'
824+
'version' => '345bb2a88a140f25cd55'
825825
),
826826
'theme.min.js' => array(
827827
'dependencies' => array(

wp-includes/assets/script-loader-packages.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
'import' => 'dynamic'
143143
)
144144
),
145-
'version' => '9adfd5c0b20d4d86a63d'
145+
'version' => '28f00a6393f97214aa04'
146146
),
147147
'block-serialization-default-parser.js' => array(
148148
'dependencies' => array(
@@ -214,7 +214,7 @@
214214
'wp-rich-text',
215215
'wp-warning'
216216
),
217-
'version' => '897ce4b17ffaf6b0b3dc'
217+
'version' => '3357a9a6e689c39b08a9'
218218
),
219219
'compose.js' => array(
220220
'dependencies' => array(
@@ -266,7 +266,7 @@
266266
'wp-url',
267267
'wp-warning'
268268
),
269-
'version' => '7315eaa7025445f864b5'
269+
'version' => '553521bc03a0cb8c2fb5'
270270
),
271271
'customize-widgets.js' => array(
272272
'dependencies' => array(
@@ -821,7 +821,7 @@
821821
'wp-hooks',
822822
'wp-private-apis'
823823
),
824-
'version' => '4c60996d1664ab866379'
824+
'version' => '345bb2a88a140f25cd55'
825825
),
826826
'theme.js' => array(
827827
'dependencies' => array(

wp-includes/assets/script-modules-packages.min.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
'import' => 'static'
165165
)
166166
),
167-
'version' => '83912eb465db8aeb2e2c'
167+
'version' => 'a4eccb5dc74e84f9614c'
168168
),
169169
'core-abilities/index.min.js' => array(
170170
'dependencies' => array(
@@ -308,6 +308,6 @@
308308
'import' => 'static'
309309
)
310310
),
311-
'version' => 'fda3289cb87793410db1'
311+
'version' => '2a87975a8bb2154aa3b1'
312312
)
313313
);

wp-includes/assets/script-modules-packages.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
'import' => 'static'
165165
)
166166
),
167-
'version' => '83912eb465db8aeb2e2c'
167+
'version' => 'a4eccb5dc74e84f9614c'
168168
),
169169
'core-abilities/index.js' => array(
170170
'dependencies' => array(
@@ -308,6 +308,6 @@
308308
'import' => 'static'
309309
)
310310
),
311-
'version' => 'fda3289cb87793410db1'
311+
'version' => '2a87975a8bb2154aa3b1'
312312
)
313313
);

wp-includes/blocks/blocks-json.php

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3098,6 +3098,96 @@
30983098
),
30993099
'editorStyle' => 'wp-block-html-editor'
31003100
),
3101+
'icon' => array(
3102+
'apiVersion' => 3,
3103+
'$schema' => 'https://schemas.wp.org/trunk/block.json',
3104+
'name' => 'core/icon',
3105+
'title' => 'Icon',
3106+
'category' => 'media',
3107+
'description' => 'Insert an SVG icon.',
3108+
'keywords' => array(
3109+
'icon',
3110+
'svg'
3111+
),
3112+
'textdomain' => 'default',
3113+
'attributes' => array(
3114+
'icon' => array(
3115+
'type' => 'string',
3116+
'role' => 'content'
3117+
)
3118+
),
3119+
'supports' => array(
3120+
'anchor' => true,
3121+
'ariaLabel' => array(
3122+
'__experimentalSkipSerialization' => true
3123+
),
3124+
'align' => array(
3125+
'left',
3126+
'center',
3127+
'right'
3128+
),
3129+
'html' => false,
3130+
'color' => array(
3131+
'background' => true,
3132+
'text' => true,
3133+
'__experimentalSkipSerialization' => true
3134+
),
3135+
'interactivity' => array(
3136+
'clientNavigation' => true
3137+
),
3138+
'__experimentalBorder' => array(
3139+
'color' => true,
3140+
'radius' => true,
3141+
'style' => true,
3142+
'width' => true,
3143+
'__experimentalSkipSerialization' => true,
3144+
'__experimentalDefaultControls' => array(
3145+
'color' => false,
3146+
'radius' => false,
3147+
'style' => false,
3148+
'width' => false
3149+
)
3150+
),
3151+
'spacing' => array(
3152+
'padding' => true,
3153+
'margin' => true,
3154+
'__experimentalSkipSerialization' => array(
3155+
'padding'
3156+
),
3157+
'__experimentalDefaultControls' => array(
3158+
'margin' => false,
3159+
'padding' => false
3160+
)
3161+
),
3162+
'dimensions' => array(
3163+
'width' => true,
3164+
'__experimentalSkipSerialization' => array(
3165+
'width'
3166+
),
3167+
'__experimentalDefaultControls' => array(
3168+
'width' => true
3169+
)
3170+
)
3171+
),
3172+
'selectors' => array(
3173+
'root' => '.wp-block-icon',
3174+
'color' => array(
3175+
'root' => '.wp-block-icon svg'
3176+
),
3177+
'border' => array(
3178+
'root' => '.wp-block-icon svg'
3179+
),
3180+
'spacing' => array(
3181+
'padding' => '.wp-block-icon svg'
3182+
),
3183+
'dimensions' => array(
3184+
'root' => '.wp-block-icon svg',
3185+
'width' => '.wp-block-icon svg'
3186+
)
3187+
),
3188+
'style' => 'wp-block-icon',
3189+
'editorStyle' => 'wp-block-icon-editor'
3190+
),
31013191
'image' => array(
31023192
'$schema' => 'https://schemas.wp.org/trunk/block.json',
31033193
'apiVersion' => 3,
@@ -6153,8 +6243,7 @@
61536243
),
61546244
'html' => false,
61556245
'layout' => true,
6156-
'interactivity' => true,
6157-
'contentRole' => true
6246+
'interactivity' => true
61586247
),
61596248
'editorStyle' => 'wp-block-query-editor'
61606249
),

wp-includes/blocks/icon.php

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?php
2+
/**
3+
* Server-side rendering of the `core/icon` block.
4+
*
5+
* @package WordPress
6+
*/
7+
8+
/**
9+
* Renders the `core/icon` block on server.
10+
*
11+
* @since 7.0.0
12+
*
13+
* @param array $attributes The block attributes.
14+
* @param string $content The block content.
15+
* @param WP_Block $block The block instance.
16+
*
17+
* @return string Returns the Icon.
18+
*/
19+
function render_block_core_icon( $attributes ) {
20+
if ( empty( $attributes['icon'] ) ) {
21+
return;
22+
}
23+
24+
$registry = WP_Icons_Registry::get_instance();
25+
$icon = $registry->get_registered_icon( $attributes['icon'] );
26+
27+
if ( is_null( $icon ) ) {
28+
return;
29+
}
30+
31+
// Text color and background color.
32+
$color_styles = array();
33+
34+
$preset_text_color = array_key_exists( 'textColor', $attributes ) ? "var:preset|color|{$attributes['textColor']}" : null;
35+
$custom_text_color = $attributes['style']['color']['text'] ?? null;
36+
$color_styles['text'] = $preset_text_color ? $preset_text_color : $custom_text_color;
37+
38+
$preset_background_color = array_key_exists( 'backgroundColor', $attributes ) ? "var:preset|color|{$attributes['backgroundColor']}" : null;
39+
$custom_background_color = $attributes['style']['color']['background'] ?? null;
40+
$color_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color;
41+
42+
// Border.
43+
$border_styles = array();
44+
$sides = array( 'top', 'right', 'bottom', 'left' );
45+
46+
if ( isset( $attributes['style']['border']['radius'] ) ) {
47+
$border_styles['radius'] = $attributes['style']['border']['radius'];
48+
}
49+
if ( isset( $attributes['style']['border']['style'] ) ) {
50+
$border_styles['style'] = $attributes['style']['border']['style'];
51+
}
52+
if ( isset( $attributes['style']['border']['width'] ) ) {
53+
$border_styles['width'] = $attributes['style']['border']['width'];
54+
}
55+
56+
$preset_color = array_key_exists( 'borderColor', $attributes ) ? "var:preset|color|{$attributes['borderColor']}" : null;
57+
$custom_color = $attributes['style']['border']['color'] ?? null;
58+
$border_styles['color'] = $preset_color ? $preset_color : $custom_color;
59+
60+
foreach ( $sides as $side ) {
61+
$border = $attributes['style']['border'][ $side ] ?? null;
62+
$border_styles[ $side ] = array(
63+
'color' => $border['color'] ?? null,
64+
'style' => $border['style'] ?? null,
65+
'width' => $border['width'] ?? null,
66+
);
67+
}
68+
69+
// Spacing (Padding).
70+
$spacing_styles = array();
71+
if ( isset( $attributes['style']['spacing']['padding'] ) ) {
72+
$spacing_styles['padding'] = $attributes['style']['spacing']['padding'];
73+
}
74+
75+
// Dimensions (Width).
76+
$dimensions_styles = array();
77+
if ( isset( $attributes['style']['dimensions']['width'] ) ) {
78+
$dimensions_styles['width'] = $attributes['style']['dimensions']['width'];
79+
}
80+
81+
// Generate styles and classes.
82+
$styles = wp_style_engine_get_styles(
83+
array(
84+
'color' => $color_styles,
85+
'border' => $border_styles,
86+
'spacing' => $spacing_styles,
87+
'dimensions' => $dimensions_styles,
88+
),
89+
);
90+
91+
$processor = new WP_HTML_Tag_Processor( $icon['content'] );
92+
$processor->next_tag( 'svg' );
93+
94+
if ( ! empty( $styles['css'] ) ) {
95+
$processor->set_attribute( 'style', $styles['css'] );
96+
}
97+
if ( ! empty( $styles['classnames'] ) ) {
98+
$processor->add_class( $styles['classnames'] );
99+
}
100+
101+
$aria_label = ! empty( $attributes['ariaLabel'] ) ? $attributes['ariaLabel'] : '';
102+
103+
if ( ! $aria_label ) {
104+
// Icon is decorative, hide it from screen readers.
105+
$processor->set_attribute( 'aria-hidden', 'true' );
106+
$processor->set_attribute( 'focusable', 'false' );
107+
} else {
108+
$processor->set_attribute( 'role', 'img' );
109+
$processor->set_attribute( 'aria-label', $aria_label );
110+
}
111+
112+
// Return the updated SVG markup.
113+
$svg = $processor->get_updated_html();
114+
$attributes = get_block_wrapper_attributes();
115+
return sprintf( '<div %s>%s</div>', $attributes, $svg );
116+
}
117+
118+
119+
/**
120+
* Registers the `core/icon` block on server.
121+
*
122+
* @since 7.0.0
123+
*/
124+
function register_block_core_icon() {
125+
register_block_type_from_metadata(
126+
__DIR__ . '/icon',
127+
array(
128+
'render_callback' => 'render_block_core_icon',
129+
)
130+
);
131+
}
132+
add_action( 'init', 'register_block_core_icon' );

0 commit comments

Comments
 (0)