Update @wordpress packages

Update packages to include these bug fixes from Gutenberg:

- Gallery block: turn on auto-migration of v1 Gallery blocks to v2 format when edited
- Add accessible labelling to submenu buttons.
- Improve performance of wp_navigation lookup. 
- Various inline docblock corrections
- Use core version of template and template part post types and REST endpoints for WP 5.9, with back compat for 5.8
- Gradients: Enable adding custom gradient when gradients are disabled
- Custom color palette: add default color name
- Color Picker: Re-instate debounce and controlled value to fix issue with gradient picker
- Add aria-current="page" to active navigation item
- Site Editor: Templat list fallback to slug
- Fix: Custom color picker popover position
- Fix: php 5.6 error in theme JSON class.
- Update the WP_Theme_JSON_Gutenberg class to be like the core one
- Update the WP_Theme_JSON_Resolver_Gutenberg class to be like the core one
- Move Global Styles code to lib/compat/wordpress-5.9 folder
- E2E Tests: Fix failing image e2e test by waiting for required element
- Navigation: Try removing absorb toolbar prop.
- Navigation: Fix navigation justifications.
- Fix wordbreak for URLs
- Polish unset color indicator.
- Template revert flow: Make label description source agnostic
- [Block Library - Navigation]: Fix vertical layout
- Add: Corners to custom color picker popover
- Add: Missing margin to the color picker clear button
- Gradient: Fix clearing a custom gradient from throwing a React warning
- [Block Library]: Rename Query Pagination blocks
- PHP Unit Tests: Use global transients 
- Remove CSS that causes conflict with theme.json
- Add actions which fire during the loading process of block template parts
- Fix usage of useSetting('color.palette')
- Update micromodal, include click-through fix
- Site Editor: Remove unused PHP code
- Don't try and render unstable location if Nav block has ID
- Fix gutenberg prefixed function references in core
- Card: support the extraSmall option for the size prop
- Gallery block: enable the new gallery block by default if running in core 
- Block fixtures: Change port to 8889 to placate KSES
- Full Site Editing: Remove block template resolution unit tests
- Site Editor: Sync export API

See #54487.

Built from https://develop.svn.wordpress.org/trunk@52324


git-svn-id: http://core.svn.wordpress.org/trunk@51916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
noisysocks 2021-12-06 06:20:27 +00:00
parent f5d79e0b23
commit 3060ce0b59
48 changed files with 896 additions and 461 deletions

File diff suppressed because one or more lines are too long

View File

@ -104,6 +104,9 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
$style .= 'align-items: center;';
if ( 'horizontal' === $layout_orientation ) {
$style .= 'align-items: center;';
if ( ! empty( $layout['setCascadingProperties'] ) && $layout['setCascadingProperties'] ) {
$style .= '--layout-direction: row;';
}
/**
* Add this style only if is not empty for backwards compatibility,
* since we intend to convert blocks that had flex layout implemented
@ -114,7 +117,6 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
if ( ! empty( $layout['setCascadingProperties'] ) && $layout['setCascadingProperties'] ) {
// --layout-justification-setting allows children to inherit the value regardless or row or column direction.
$style .= "--layout-justification-setting: {$justify_content_options[ $layout['justifyContent'] ]};";
$style .= '--layout-direction: row;';
$style .= "--layout-wrap: $flex_wrap;";
$style .= "--layout-justify: {$justify_content_options[ $layout['justifyContent'] ]};";
$style .= '--layout-align: center;';
@ -124,10 +126,12 @@ function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false
$style .= 'flex-direction: column;';
if ( ! empty( $layout['justifyContent'] ) && array_key_exists( $layout['justifyContent'], $justify_content_options ) ) {
$style .= "align-items: {$justify_content_options[ $layout['justifyContent'] ]};";
if ( ! empty( $layout['setCascadingProperties'] ) && $layout['setCascadingProperties'] ) {
$style .= '--layout-direction: column;';
}
if ( ! empty( $layout['setCascadingProperties'] ) && $layout['setCascadingProperties'] ) {
// --layout-justification-setting allows children to inherit the value regardless or row or column direction.
$style .= "--layout-justification-setting: {$justify_content_options[ $layout['justifyContent'] ]};";
$style .= '--layout-direction: column;';
$style .= '--layout-justify: initial;';
$style .= "--layout-align: {$justify_content_options[ $layout['justifyContent'] ]};";
}

View File

@ -744,7 +744,7 @@ function get_block_templates( $query = array(), $template_type = 'wp_template' )
*/
function get_block_template( $id, $template_type = 'wp_template' ) {
/**
* Filters the block templates array before the query takes place.
*Filters the block template object before the query takes place.
*
* Return a non-null value to bypass the WordPress queries.
*
@ -793,11 +793,11 @@ function get_block_template( $id, $template_type = 'wp_template' ) {
$block_template = get_block_file_template( $id, $template_type );
/**
* Filters the array of queried block templates array after they've been fetched.
* Filters the queried block template object after it's been fetched.
*
* @since 5.9.0
*
* @param WP_Block_Template $block_template The found block template.
* @param WP_Block_Template|null $block_template The found block template, or null if there isn't one.
* @param string $id Template unique identifier (example: theme_slug//template_slug).
* @param array $template_type Template type: `'wp_template'` or '`wp_template_part'`.
*/

View File

@ -90,7 +90,7 @@
margin-right: var(--wp--style--block-gap, 2em);
}
}
.block-editor-block-list__block.wp-block-column.wp-block-column {
html :where(.wp-block-column) {
margin-top: 0;
margin-bottom: 0;
}

View File

@ -1 +1 @@
.wp-block-columns :where(.wp-block){max-width:none;margin-right:0;margin-left:0}@media (min-width:600px){.editor-styles-wrapper .block-editor-block-list__block.wp-block-column:nth-child(2n){margin-right:var(--wp--style--block-gap,2em)}}@media (min-width:782px){.editor-styles-wrapper .block-editor-block-list__block.wp-block-column:not(:first-child){margin-right:var(--wp--style--block-gap,2em)}}.block-editor-block-list__block.wp-block-column.wp-block-column{margin-top:0;margin-bottom:0}
.wp-block-columns :where(.wp-block){max-width:none;margin-right:0;margin-left:0}@media (min-width:600px){.editor-styles-wrapper .block-editor-block-list__block.wp-block-column:nth-child(2n){margin-right:var(--wp--style--block-gap,2em)}}@media (min-width:782px){.editor-styles-wrapper .block-editor-block-list__block.wp-block-column:not(:first-child){margin-right:var(--wp--style--block-gap,2em)}}html :where(.wp-block-column){margin-top:0;margin-bottom:0}

View File

@ -90,7 +90,7 @@
margin-left: var(--wp--style--block-gap, 2em);
}
}
.block-editor-block-list__block.wp-block-column.wp-block-column {
html :where(.wp-block-column) {
margin-top: 0;
margin-bottom: 0;
}

View File

@ -1 +1 @@
.wp-block-columns :where(.wp-block){max-width:none;margin-left:0;margin-right:0}@media (min-width:600px){.editor-styles-wrapper .block-editor-block-list__block.wp-block-column:nth-child(2n){margin-left:var(--wp--style--block-gap,2em)}}@media (min-width:782px){.editor-styles-wrapper .block-editor-block-list__block.wp-block-column:not(:first-child){margin-left:var(--wp--style--block-gap,2em)}}.block-editor-block-list__block.wp-block-column.wp-block-column{margin-top:0;margin-bottom:0}
.wp-block-columns :where(.wp-block){max-width:none;margin-left:0;margin-right:0}@media (min-width:600px){.editor-styles-wrapper .block-editor-block-list__block.wp-block-column:nth-child(2n){margin-left:var(--wp--style--block-gap,2em)}}@media (min-width:782px){.editor-styles-wrapper .block-editor-block-list__block.wp-block-column:not(:first-child){margin-left:var(--wp--style--block-gap,2em)}}html :where(.wp-block-column){margin-top:0;margin-bottom:0}

View File

@ -163,6 +163,31 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
'style' => $style_attribute,
)
);
$label = '';
if ( isset( $attributes['label'] ) ) {
$label .= wp_kses(
$attributes['label'],
array(
'code' => array(),
'em' => array(),
'img' => array(
'scale' => array(),
'class' => array(),
'style' => array(),
'src' => array(),
'alt' => array(),
),
's' => array(),
'span' => array(
'style' => array(),
),
'strong' => array(),
)
);
}
$html = '<li ' . $wrapper_attributes . '>';
// If Submenus open on hover, we render an anchor tag with attributes.
@ -193,27 +218,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
$html .= '>';
// End appending HTML attributes to anchor tag.
if ( isset( $attributes['label'] ) ) {
$html .= wp_kses(
$attributes['label'],
array(
'code' => array(),
'em' => array(),
'img' => array(
'scale' => array(),
'class' => array(),
'style' => array(),
'src' => array(),
'alt' => array(),
),
's' => array(),
'span' => array(
'style' => array(),
),
'strong' => array(),
)
);
}
$html .= $label;
$html .= '</a>';
// End anchor tag content.
@ -221,36 +226,16 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
if ( $show_submenu_indicators ) {
// The submenu icon is rendered in a button here
// so that there's a clickable elment to open the submenu.
$html .= '<button class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>';
$html .= '<button aria-label="' . $label . ' ' . __( 'submenu', 'gutenberg' ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>';
}
} else {
// If menus open on click, we render the parent as a button.
$html .= '<button class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">';
$html .= '<button aria-label="' . $label . ' ' . __( 'submenu', 'gutenberg' ) . '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">';
// Wrap title with span to isolate it from submenu icon.
$html .= '<span class="wp-block-navigation-item__label">';
if ( isset( $attributes['label'] ) ) {
$html .= wp_kses(
$attributes['label'],
array(
'code' => array(),
'em' => array(),
'img' => array(
'scale' => array(),
'class' => array(),
'style' => array(),
'src' => array(),
'alt' => array(),
),
's' => array(),
'span' => array(
'style' => array(),
),
'strong' => array(),
)
);
}
$html .= $label;
$html .= '</span>';

View File

@ -5,6 +5,120 @@
* @package WordPress
*/
// These functions are used for the __unstableLocation feature and only active
// when the gutenberg plugin is active.
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
/**
* Returns the menu items for a WordPress menu location.
*
* @param string $location The menu location.
* @return array Menu items for the location.
*/
function block_core_navigation_get_menu_items_at_location( $location ) {
if ( empty( $location ) ) {
return;
}
// Build menu data. The following approximates the code in
// `wp_nav_menu()` and `gutenberg_output_block_nav_menu`.
// Find the location in the list of locations, returning early if the
// location can't be found.
$locations = get_nav_menu_locations();
if ( ! isset( $locations[ $location ] ) ) {
return;
}
// Get the menu from the location, returning early if there is no
// menu or there was an error.
$menu = wp_get_nav_menu_object( $locations[ $location ] );
if ( ! $menu || is_wp_error( $menu ) ) {
return;
}
$menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
_wp_menu_item_classes_by_context( $menu_items );
return $menu_items;
}
/**
* Sorts a standard array of menu items into a nested structure keyed by the
* id of the parent menu.
*
* @param array $menu_items Menu items to sort.
* @return array An array keyed by the id of the parent menu where each element
* is an array of menu items that belong to that parent.
*/
function block_core_navigation_sort_menu_items_by_parent_id( $menu_items ) {
$sorted_menu_items = array();
foreach ( (array) $menu_items as $menu_item ) {
$sorted_menu_items[ $menu_item->menu_order ] = $menu_item;
}
unset( $menu_items, $menu_item );
$menu_items_by_parent_id = array();
foreach ( $sorted_menu_items as $menu_item ) {
$menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item;
}
return $menu_items_by_parent_id;
}
/**
* Turns menu item data into a nested array of parsed blocks
*
* @param array $menu_items An array of menu items that represent
* an individual level of a menu.
* @param array $menu_items_by_parent_id An array keyed by the id of the
* parent menu where each element is an
* array of menu items that belong to
* that parent.
* @return array An array of parsed block data.
*/
function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
if ( empty( $menu_items ) ) {
return array();
}
$blocks = array();
foreach ( $menu_items as $menu_item ) {
$class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null;
$id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null;
$opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target;
$rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null;
$kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom';
$block = array(
'blockName' => isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? 'core/navigation-submenu' : 'core/navigation-link',
'attrs' => array(
'className' => $class_name,
'description' => $menu_item->description,
'id' => $id,
'kind' => $kind,
'label' => $menu_item->title,
'opensInNewTab' => $opens_in_new_tab,
'rel' => $rel,
'title' => $menu_item->attr_title,
'type' => $menu_item->object,
'url' => $menu_item->url,
),
);
$block['innerBlocks'] = isset( $menu_items_by_parent_id[ $menu_item->ID ] )
? block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id )
: array();
$block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] );
$blocks[] = $block;
}
return $blocks;
}
}
/**
* Build an array with CSS classes and inline styles defining the colors
* which will be applied to the navigation markup in the front-end.
@ -145,17 +259,23 @@ function block_core_navigation_get_first_non_empty_navigation() {
// see:
// - https://github.com/WordPress/wordpress-develop/blob/ba943e113d3b31b121f77a2d30aebe14b047c69d/src/wp-includes/nav-menu.php#L613-L619.
// - https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters.
$navigation_posts = get_posts(
array(
$parsed_args = array(
'post_type' => 'wp_navigation',
'no_found_rows' => true,
'order' => 'ASC',
'orderby' => 'name',
'posts_per_page' => 1, // only the first post.
's' => '<!-- wp:', // look for block indicators to ensure we only include non-empty Navigations.
)
'post_status' => 'publish',
'posts_per_page' => 20, // Try the first 20 posts.
);
return count( $navigation_posts ) ? $navigation_posts[0] : null;
$navigation_posts = new WP_Query( $parsed_args );
foreach ( $navigation_posts->posts as $navigation_post ) {
if ( has_blocks( $navigation_post ) ) {
return $navigation_post;
}
}
return null;
}
/**
@ -272,22 +392,33 @@ function render_block_core_navigation( $attributes, $content, $block ) {
$inner_blocks = $block->inner_blocks;
// If `__unstableLocation` is defined, create inner blocks from the classic menu assigned to that location.
if ( empty( $inner_blocks ) && array_key_exists( '__unstableLocation', $attributes ) ) {
$menu_items = gutenberg_get_menu_items_at_location( $attributes['__unstableLocation'] );
if ( empty( $menu_items ) ) {
return '';
}
$menu_items_by_parent_id = gutenberg_sort_menu_items_by_parent_id( $menu_items );
$parsed_blocks = gutenberg_parse_blocks_from_menu_items( $menu_items_by_parent_id[0], $menu_items_by_parent_id );
$inner_blocks = new WP_Block_List( $parsed_blocks, $attributes );
}
// Ensure that blocks saved with the legacy ref attribute name (navigationMenuId) continue to render.
if ( array_key_exists( 'navigationMenuId', $attributes ) ) {
$attributes['ref'] = $attributes['navigationMenuId'];
}
// If:
// - the gutenberg plugin is active
// - `__unstableLocation` is defined
// - we have menu items at the defined location
// - we don't have a relationship to a `wp_navigation` Post (via `ref`).
// ...then create inner blocks from the classic menu assigned to that location.
if (
defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN &&
array_key_exists( '__unstableLocation', $attributes ) &&
! array_key_exists( 'ref', $attributes ) &&
! empty( block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] ) )
) {
$menu_items = block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] );
if ( empty( $menu_items ) ) {
return '';
}
$menu_items_by_parent_id = block_core_navigation_sort_menu_items_by_parent_id( $menu_items );
$parsed_blocks = block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[0], $menu_items_by_parent_id );
$inner_blocks = new WP_Block_List( $parsed_blocks, $attributes );
}
// Load inner blocks from the navigation post.
if ( array_key_exists( 'ref', $attributes ) ) {
$navigation_post = get_post( $attributes['ref'] );

View File

@ -355,10 +355,13 @@ button.wp-block-navigation-item__content {
display: flex;
flex-direction: column;
align-items: var(--layout-justification-setting, inherit);
justify-content: flex-start;
overflow: auto;
padding: 0;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
justify-content: flex-start;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon {
display: none;
}

File diff suppressed because one or more lines are too long

View File

@ -355,10 +355,13 @@ button.wp-block-navigation-item__content {
display: flex;
flex-direction: column;
align-items: var(--layout-justification-setting, inherit);
justify-content: flex-start;
overflow: auto;
padding: 0;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
justify-content: flex-start;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon {
display: none;
}

File diff suppressed because one or more lines are too long

View File

@ -173,24 +173,20 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
}
}
$title = wp_kses( $page['title'], wp_kses_allowed_html( 'post' ) );
$markup .= '<li class="wp-block-pages-list__item' . $css_class . '"' . $style_attribute . '>';
if ( isset( $page['children'] ) && $is_navigation_child && $open_submenus_on_click ) {
$markup .= '<button class="' . $navigation_child_content_class . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' . wp_kses(
$page['title'],
wp_kses_allowed_html( 'post' )
) . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>' .
$markup .= '<button aria-label="' . $title . ' ' . __( 'submenu', 'gutenberg' ) . '" class="' . $navigation_child_content_class . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' . $title . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>' .
'</button>';
} else {
$markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . '" href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' . wp_kses(
$page['title'],
wp_kses_allowed_html( 'post' )
) . '</a>';
$markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . '" href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' . $title . '</a>';
}
if ( isset( $page['children'] ) ) {
if ( $is_navigation_child && $show_submenu_icons && ! $open_submenus_on_click ) {
$markup .= '<button class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
$markup .= '<button aria-label="' . $title . ' ' . __( 'submenu', 'gutenberg' ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
$markup .= '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
$markup .= '</button>';
}

View File

@ -1,7 +1,7 @@
{
"apiVersion": 2,
"name": "core/query-pagination-next",
"title": "Query Pagination Next",
"title": "Next Page",
"category": "design",
"parent": [ "core/query-pagination" ],
"description": "Displays the next posts page link.",

View File

@ -1,7 +1,7 @@
{
"apiVersion": 2,
"name": "core/query-pagination-numbers",
"title": "Query Pagination Numbers",
"title": "Page Numbers",
"category": "design",
"parent": [ "core/query-pagination" ],
"description": "Displays a list of page numbers for pagination",

View File

@ -1,7 +1,7 @@
{
"apiVersion": 2,
"name": "core/query-pagination-previous",
"title": "Query Pagination Previous",
"title": "Previous Page",
"category": "design",
"parent": [ "core/query-pagination" ],
"description": "Displays the previous posts page link.",

View File

@ -1,7 +1,7 @@
{
"apiVersion": 2,
"name": "core/query-pagination",
"title": "Query Pagination",
"title": "Pagination",
"category": "design",
"parent": [ "core/query" ],
"description": "Displays a paginated navigation to next/previous set of posts, when applicable.",

View File

@ -50,6 +50,17 @@ function render_block_core_template_part( $attributes ) {
if ( ! is_wp_error( $area_terms ) && false !== $area_terms ) {
$area = $area_terms[0]->name;
}
/**
* Fires when a block template part is loaded from a template post stored in the database.
*
* @since 5.9.0
*
* @param string $template_part_id The requested template part namespaced to the theme.
* @param array $attributes The block attributes.
* @param WP_Post $template_part_post The template part post object.
* @param string $content The template part content.
*/
do_action( 'render_block_core_template_part_post', $template_part_id, $attributes, $template_part_post, $content );
} else {
// Else, if the template part was provided by the active theme,
// render the corresponding file content.
@ -61,6 +72,31 @@ function render_block_core_template_part( $attributes ) {
? _inject_theme_attribute_in_block_template_content( $content )
: '';
}
if ( '' !== $content && null !== $content ) {
/**
* Fires when a block template part is loaded from a template part in the theme.
*
* @since 5.9.0
*
* @param string $template_part_id The requested template part namespaced to the theme.
* @param array $attributes The block attributes.
* @param string $template_part_file_path Absolute path to the template path.
* @param string $content The template part content.
*/
do_action( 'render_block_core_template_part_file', $template_part_id, $attributes, $template_part_file_path, $content );
} else {
/**
* Fires when a requested block template part does not exist in the database nor in the theme.
*
* @since 5.9.0
*
* @param string $template_part_id The requested template part namespaced to the theme.
* @param array $attributes The block attributes.
* @param string $template_part_file_path Absolute path to the not found template path.
*/
do_action( 'render_block_core_template_part_none', $template_part_id, $attributes, $template_part_file_path );
}
}
}

View File

@ -2110,7 +2110,10 @@
align-items: flex-start;
margin-left: 8px;
white-space: pre-wrap;
word-wrap: break-word;
overflow-wrap: break-word;
}
.block-editor-link-control__search-item .block-editor-link-control__search-item-header .block-editor-link-control__search-item-info {
word-break: break-all;
}
.block-editor-link-control__search-item.is-preview .block-editor-link-control__search-item-header {
display: flex;

File diff suppressed because one or more lines are too long

View File

@ -2110,7 +2110,10 @@
align-items: flex-start;
margin-right: 8px;
white-space: pre-wrap;
word-wrap: break-word;
overflow-wrap: break-word;
}
.block-editor-link-control__search-item .block-editor-link-control__search-item-header .block-editor-link-control__search-item-info {
word-break: break-all;
}
.block-editor-link-control__search-item.is-preview .block-editor-link-control__search-item-header {
display: flex;

File diff suppressed because one or more lines are too long

View File

@ -229,7 +229,7 @@ div[data-type="core/button"] {
margin-right: var(--wp--style--block-gap, 2em);
}
}
.block-editor-block-list__block.wp-block-column.wp-block-column {
html :where(.wp-block-column) {
margin-top: 0;
margin-bottom: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -230,7 +230,7 @@ div[data-type="core/button"] {
margin-left: var(--wp--style--block-gap, 2em);
}
}
.block-editor-block-list__block.wp-block-column.wp-block-column {
html :where(.wp-block-column) {
margin-top: 0;
margin-bottom: 0;
}

File diff suppressed because one or more lines are too long

View File

@ -1767,10 +1767,13 @@ button.wp-block-navigation-item__content {
display: flex;
flex-direction: column;
align-items: var(--layout-justification-setting, inherit);
justify-content: flex-start;
overflow: auto;
padding: 0;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
justify-content: flex-start;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon {
display: none;
}

File diff suppressed because one or more lines are too long

View File

@ -1789,10 +1789,13 @@ button.wp-block-navigation-item__content {
display: flex;
flex-direction: column;
align-items: var(--layout-justification-setting, inherit);
justify-content: flex-start;
overflow: auto;
padding: 0;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content,
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
justify-content: flex-start;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__submenu-icon {
display: none;
}

File diff suppressed because one or more lines are too long

View File

@ -636,6 +636,7 @@ svg.components-checkbox-control__checked {
.components-circular-option-picker .components-circular-option-picker__custom-clear-wrapper {
display: flex;
justify-content: flex-end;
margin-top: 12px;
}
.components-circular-option-picker .components-circular-option-picker__swatches {
display: flex;
@ -894,11 +895,22 @@ input.components-combobox-control__input[type=text]:focus {
overflow: visible;
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05);
border: none;
border-radius: 2px;
}
.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content > div {
padding: 0;
}
.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content .react-colorful__saturation {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
}
@media (min-width: 782px) {
.components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-top .components-popover__content {
margin-left: 156px;
margin-top: -60px;
}
}
.components-custom-gradient-picker__gradient-bar:not(.has-gradient) {
opacity: 0.4;
}

File diff suppressed because one or more lines are too long

View File

@ -636,6 +636,7 @@ svg.components-checkbox-control__checked {
.components-circular-option-picker .components-circular-option-picker__custom-clear-wrapper {
display: flex;
justify-content: flex-end;
margin-top: 12px;
}
.components-circular-option-picker .components-circular-option-picker__swatches {
display: flex;
@ -894,11 +895,22 @@ input.components-combobox-control__input[type=text]:focus {
overflow: visible;
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05);
border: none;
border-radius: 2px;
}
.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content > div {
padding: 0;
}
.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content .react-colorful__saturation {
border-top-right-radius: 2px;
border-top-left-radius: 2px;
}
@media (min-width: 782px) {
.components-dropdown__content.components-color-palette__custom-color-dropdown-content.is-rendered-in-sidebar.is-from-top .components-popover__content {
margin-right: 156px;
margin-top: -60px;
}
}
.components-custom-gradient-picker__gradient-bar:not(.has-gradient) {
opacity: 0.4;
}

File diff suppressed because one or more lines are too long

View File

@ -569,10 +569,8 @@ body.is-fullscreen-mode .interface-interface-skeleton {
height: 24px;
width: 24px;
padding: 0;
background-image: repeating-linear-gradient(-45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0), repeating-linear-gradient(-45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0);
background-position: 100% 0, 25px 25px;
background-size: calc(2 * 5px) calc(2 * 5px);
border: 1px solid #ddd;
background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
}
.edit-site-global-styles-header__description {

File diff suppressed because one or more lines are too long

View File

@ -569,10 +569,8 @@ body.is-fullscreen-mode .interface-interface-skeleton {
height: 24px;
width: 24px;
padding: 0;
background-image: repeating-linear-gradient(45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0), repeating-linear-gradient(45deg, #e0e0e0 25%, transparent 25%, transparent 75%, #e0e0e0 75%, #e0e0e0);
background-position: 0 0, 25px 25px;
background-size: calc(2 * 5px) calc(2 * 5px);
border: 1px solid #ddd;
background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
}
.edit-site-global-styles-header__description {

File diff suppressed because one or more lines are too long

View File

@ -15006,10 +15006,13 @@ const withCustomColorPalette = colorsArray => Object(external_wp_compose_["creat
const withEditorColorPalette = () => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => {
const {
palette: colorPerOrigin
} = Object(use_setting["a" /* default */])('color') || {};
const allColors = Object(external_wp_element_["useMemo"])(() => [...((colorPerOrigin === null || colorPerOrigin === void 0 ? void 0 : colorPerOrigin.custom) || []), ...((colorPerOrigin === null || colorPerOrigin === void 0 ? void 0 : colorPerOrigin.theme) || []), ...((colorPerOrigin === null || colorPerOrigin === void 0 ? void 0 : colorPerOrigin.default) || [])], [colorPerOrigin]);
// Some color settings have a special handling for deprecated flags in `useSetting`,
// so we can't unwrap them by doing const { ... } = useSetting('color')
// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.
const userPalette = Object(use_setting["a" /* default */])('color.palette.custom');
const themePalette = Object(use_setting["a" /* default */])('color.palette.theme');
const defaultPalette = Object(use_setting["a" /* default */])('color.palette.default');
const allColors = Object(external_wp_element_["useMemo"])(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, {
colors: allColors
}));
@ -23207,6 +23210,7 @@ function getGradientSlugByValue(gradients, value) {
return gradient && gradient.slug;
}
const EMPTY_OBJECT = {};
function __experimentalUseGradient() {
let {
gradientAttribute = 'gradient',
@ -23215,9 +23219,7 @@ function __experimentalUseGradient() {
const {
clientId
} = Object(_block_edit__WEBPACK_IMPORTED_MODULE_3__[/* useBlockEditContext */ "c"])();
const {
gradients: gradientsPerOrigin
} = Object(_use_setting__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])('color') || {};
const gradientsPerOrigin = Object(_use_setting__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])('color.gradients') || EMPTY_OBJECT;
const allGradients = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useMemo"])(() => [...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.custom) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.theme) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.default) || [])], [gradientsPerOrigin]);
const {
gradient,
@ -32119,6 +32121,7 @@ function ColorGradientControlInner(_ref) {
disableCustomColors,
disableCustomGradients,
__experimentalHasMultipleOrigins,
__experimentalIsRenderedInSidebar,
className,
label,
onColorChange,
@ -32164,6 +32167,7 @@ function ColorGradientControlInner(_ref) {
colors,
disableCustomColors,
__experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
__experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
clearable: clearable,
enableAlpha: enableAlpha
}), (currentTab === 'gradient' || !canChooseAColor) && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_4__["GradientPicker"], {
@ -41604,7 +41608,8 @@ function BorderColorEdit(props) {
colorValue: colorValue,
onColorChange: onChangeColor,
clearable: false,
__experimentalHasMultipleOrigins: true
__experimentalHasMultipleOrigins: true,
__experimentalIsRenderedInSidebar: true
}, colorGradientSettings));
}
/**
@ -42107,7 +42112,8 @@ function ColorPanel(_ref) {
initialOpen: false,
settings: settings,
showTitle: showTitle,
__experimentalHasMultipleOrigins: true
__experimentalHasMultipleOrigins: true,
__experimentalIsRenderedInSidebar: true
}, enableContrastChecking && Object(external_wp_element_["createElement"])(contrast_checker["a" /* default */], {
backgroundColor: detectedBackgroundColor,
textColor: detectedColor
@ -42142,6 +42148,7 @@ function ColorPanel(_ref) {
const COLOR_SUPPORT_KEY = 'color';
const EMPTY_OBJECT = {};
const hasColorSupport = blockType => {
const colorSupport = Object(external_wp_blocks_["getBlockSupport"])(blockType, COLOR_SUPPORT_KEY);
@ -42311,24 +42318,27 @@ function immutableSet(object, path, value) {
function ColorEdit(props) {
var _solidsPerOrigin$them, _gradientsPerOrigin$t, _style$color6, _style$color7, _style$color8, _style$elements2, _style$elements2$link, _style$elements2$link2, _style$elements3, _style$elements3$link, _style$elements3$link2;
var _gradientsPerOrigin$t, _style$color6, _style$color7, _style$color8, _style$elements2, _style$elements2$link, _style$elements2$link2, _style$elements3, _style$elements3$link, _style$elements3$link2;
const {
name: blockName,
attributes
} = props;
const {
palette: solidsPerOrigin,
gradients: gradientsPerOrigin,
customGradient: areCustomGradientsEnabled,
custom: areCustomSolidsEnabled,
text: isTextEnabled,
background: isBackgroundEnabled,
link: isLinkEnabled
} = Object(use_setting["a" /* default */])('color') || {};
const solidsEnabled = areCustomSolidsEnabled || !(solidsPerOrigin !== null && solidsPerOrigin !== void 0 && solidsPerOrigin.theme) || (solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : (_solidsPerOrigin$them = solidsPerOrigin.theme) === null || _solidsPerOrigin$them === void 0 ? void 0 : _solidsPerOrigin$them.length) > 0;
} = props; // Some color settings have a special handling for deprecated flags in `useSetting`,
// so we can't unwrap them by doing const { ... } = useSetting('color')
// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.
const userPalette = Object(use_setting["a" /* default */])('color.palette.custom');
const themePalette = Object(use_setting["a" /* default */])('color.palette.theme');
const defaultPalette = Object(use_setting["a" /* default */])('color.palette.default');
const allSolids = Object(external_wp_element_["useMemo"])(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
const gradientsPerOrigin = Object(use_setting["a" /* default */])('color.gradients') || EMPTY_OBJECT;
const areCustomSolidsEnabled = Object(use_setting["a" /* default */])('color.custom');
const areCustomGradientsEnabled = Object(use_setting["a" /* default */])('color.customGradient');
const isBackgroundEnabled = Object(use_setting["a" /* default */])('color.background');
const isLinkEnabled = Object(use_setting["a" /* default */])('color.link');
const isTextEnabled = Object(use_setting["a" /* default */])('color.text');
const solidsEnabled = areCustomSolidsEnabled || !themePalette || (themePalette === null || themePalette === void 0 ? void 0 : themePalette.length) > 0;
const gradientsEnabled = areCustomGradientsEnabled || !(gradientsPerOrigin !== null && gradientsPerOrigin !== void 0 && gradientsPerOrigin.theme) || (gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : (_gradientsPerOrigin$t = gradientsPerOrigin.theme) === null || _gradientsPerOrigin$t === void 0 ? void 0 : _gradientsPerOrigin$t.length) > 0;
const allSolids = Object(external_wp_element_["useMemo"])(() => [...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.custom) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.theme) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.default) || [])], [solidsPerOrigin]);
const allGradients = Object(external_wp_element_["useMemo"])(() => [...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.custom) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.theme) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.default) || [])], [gradientsPerOrigin]); // Shouldn't be needed but right now the ColorGradientsPanel
// can trigger both onChangeColor and onChangeBackground
// synchronously causing our two callbacks to override changes
@ -42466,7 +42476,7 @@ function ColorEdit(props) {
*/
const withColorPaletteStyles = Object(external_wp_compose_["createHigherOrderComponent"])(BlockListBlock => props => {
var _getColorObjectByAttr, _getColorObjectByAttr2, _props$wrapperProps;
var _props$wrapperProps;
const {
name,
@ -42476,19 +42486,29 @@ const withColorPaletteStyles = Object(external_wp_compose_["createHigherOrderCom
backgroundColor,
textColor
} = attributes;
const {
palette: solidsPerOrigin
} = Object(use_setting["a" /* default */])('color') || {};
const colors = Object(external_wp_element_["useMemo"])(() => [...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.custom) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.theme) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.default) || [])], [solidsPerOrigin]);
const userPalette = Object(use_setting["a" /* default */])('color.palette.custom') || [];
const themePalette = Object(use_setting["a" /* default */])('color.palette.theme') || [];
const defaultPalette = Object(use_setting["a" /* default */])('color.palette.default') || [];
const colors = Object(external_wp_element_["useMemo"])(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
if (!hasColorSupport(name) || color_shouldSkipSerialization(name)) {
return Object(external_wp_element_["createElement"])(BlockListBlock, props);
}
const extraStyles = {
color: textColor ? (_getColorObjectByAttr = Object(utils["b" /* getColorObjectByAttributeValues */])(colors, textColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color : undefined,
backgroundColor: backgroundColor ? (_getColorObjectByAttr2 = Object(utils["b" /* getColorObjectByAttributeValues */])(colors, backgroundColor)) === null || _getColorObjectByAttr2 === void 0 ? void 0 : _getColorObjectByAttr2.color : undefined
};
const extraStyles = {};
if (textColor) {
var _getColorObjectByAttr;
extraStyles.color = (_getColorObjectByAttr = Object(utils["b" /* getColorObjectByAttributeValues */])(colors, textColor)) === null || _getColorObjectByAttr === void 0 ? void 0 : _getColorObjectByAttr.color;
}
if (backgroundColor) {
var _getColorObjectByAttr2;
extraStyles.backgroundColor = (_getColorObjectByAttr2 = Object(utils["b" /* getColorObjectByAttributeValues */])(colors, backgroundColor)) === null || _getColorObjectByAttr2 === void 0 ? void 0 : _getColorObjectByAttr2.color;
}
let wrapperProps = props.wrapperProps;
wrapperProps = { ...props.wrapperProps,
style: { ...extraStyles,
@ -45185,6 +45205,7 @@ function getColorClassesAndStyles(attributes) {
style: styleProp
};
}
const use_color_props_EMPTY_OBJECT = {};
/**
* Determines the color related props for a block derived from its color block
* support attributes.
@ -45202,12 +45223,15 @@ function useColorProps(attributes) {
backgroundColor,
textColor,
gradient
} = attributes;
const {
palette: solidsPerOrigin,
gradients: gradientsPerOrigin
} = Object(use_setting["a" /* default */])('color') || {};
const colors = Object(external_wp_element_["useMemo"])(() => [...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.custom) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.theme) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.default) || [])], [solidsPerOrigin]);
} = attributes; // Some color settings have a special handling for deprecated flags in `useSetting`,
// so we can't unwrap them by doing const { ... } = useSetting('color')
// until https://github.com/WordPress/gutenberg/issues/37094 is fixed.
const userPalette = Object(use_setting["a" /* default */])('color.palette.custom') || [];
const themePalette = Object(use_setting["a" /* default */])('color.palette.theme') || [];
const defaultPalette = Object(use_setting["a" /* default */])('color.palette.default') || [];
const gradientsPerOrigin = Object(use_setting["a" /* default */])('color.gradients') || use_color_props_EMPTY_OBJECT;
const colors = Object(external_wp_element_["useMemo"])(() => [...(userPalette || []), ...(themePalette || []), ...(defaultPalette || [])], [userPalette, themePalette, defaultPalette]);
const gradients = Object(external_wp_element_["useMemo"])(() => [...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.custom) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.theme) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.default) || [])], [gradientsPerOrigin]);
const colorProps = getColorClassesAndStyles(attributes); // Force inline styles to apply colors when themes do not load their color
// stylesheets in the editor.
@ -49631,6 +49655,7 @@ const PanelColorGradientSettingsInner = _ref3 => {
title,
showTitle = true,
__experimentalHasMultipleOrigins,
__experimentalIsRenderedInSidebar,
enableAlpha,
...props
} = _ref3;
@ -49657,6 +49682,7 @@ const PanelColorGradientSettingsInner = _ref3 => {
disableCustomColors,
disableCustomGradients,
__experimentalHasMultipleOrigins,
__experimentalIsRenderedInSidebar,
enableAlpha
}, setting))), children);
};

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -33087,11 +33087,15 @@ const borderless = true ? {
styles: "border:none"
} : undefined;
const styles_rounded = /*#__PURE__*/Object(emotion_react_browser_esm["a" /* css */])("border-radius:", config_values.cardBorderRadius, ";" + ( true ? "" : undefined), true ? "" : undefined);
const xSmallCardPadding = /*#__PURE__*/Object(emotion_react_browser_esm["a" /* css */])("padding:", config_values.cardPaddingXSmall, ";" + ( true ? "" : undefined), true ? "" : undefined);
const cardPaddings = {
large: /*#__PURE__*/Object(emotion_react_browser_esm["a" /* css */])("padding:", config_values.cardPaddingLarge, ";" + ( true ? "" : undefined), true ? "" : undefined),
medium: /*#__PURE__*/Object(emotion_react_browser_esm["a" /* css */])("padding:", config_values.cardPaddingMedium, ";" + ( true ? "" : undefined), true ? "" : undefined),
small: /*#__PURE__*/Object(emotion_react_browser_esm["a" /* css */])("padding:", config_values.cardPaddingSmall, ";" + ( true ? "" : undefined), true ? "" : undefined),
xSmall: /*#__PURE__*/Object(emotion_react_browser_esm["a" /* css */])("padding:", config_values.cardPaddingXSmall, ";" + ( true ? "" : undefined), true ? "" : undefined)
xSmall: xSmallCardPadding,
// The `extraSmall` size is not officially documented, but the following styles
// are kept for legacy reasons to support older values of the `size` prop.
extraSmall: xSmallCardPadding
};
const shady = /*#__PURE__*/Object(emotion_react_browser_esm["a" /* css */])("background-color:", COLORS.lightGray[200], ";" + ( true ? "" : undefined), true ? "" : undefined);
@ -39121,6 +39125,47 @@ const Picker = _ref => {
});
};
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js
/**
* WordPress dependencies
*/
/**
* Simplified and improved implementation of useControlledState.
*
* @param props
* @param props.defaultValue
* @param props.value
* @param props.onChange
* @return The controlled value and the value setter.
*/
function useControlledValue(_ref) {
let {
defaultValue,
onChange,
value: valueProp
} = _ref;
const hasValue = typeof valueProp !== 'undefined';
const initialValue = hasValue ? valueProp : defaultValue;
const [state, setState] = Object(external_wp_element_["useState"])(initialValue);
const value = hasValue ? valueProp : state;
let setValue;
if (hasValue && typeof onChange === 'function') {
setValue = onChange;
} else if (!hasValue && typeof onChange === 'function') {
setValue = nextValue => {
onChange(nextValue);
setState(nextValue);
};
} else {
setValue = setState;
}
return [value, setValue];
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/component.js
@ -39139,6 +39184,7 @@ const Picker = _ref => {
/**
* Internal dependencies
*/
@ -39150,6 +39196,7 @@ const Picker = _ref => {
Object(colord["b" /* extend */])([names["a" /* default */]]);
const component_options = [{
label: 'RGB',
@ -39165,19 +39212,25 @@ const component_options = [{
const ColorPicker = (props, forwardedRef) => {
const {
enableAlpha = false,
color,
color: colorProp,
onChange,
defaultValue = '#fff',
copyFormat,
...divProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'ColorPicker'); // Use a safe default value for the color and remove the possibility of `undefined`.
const [color, setColor] = useControlledValue({
onChange,
value: colorProp,
defaultValue
});
const safeColordColor = Object(external_wp_element_["useMemo"])(() => {
return color ? Object(colord["a" /* colord */])(color) : Object(colord["a" /* colord */])(defaultValue);
}, [color, defaultValue]);
return Object(colord["a" /* colord */])(color);
}, [color]);
const debouncedSetColor = Object(external_wp_compose_["useDebounce"])(setColor);
const handleChange = Object(external_React_["useCallback"])(nextValue => {
onChange(nextValue.toHex());
}, [onChange]);
debouncedSetColor(nextValue.toHex());
}, [debouncedSetColor]);
const [showInputs, setShowInputs] = Object(external_wp_element_["useState"])(false);
const [colorType, setColorType] = Object(external_wp_element_["useState"])(copyFormat || 'hex');
return Object(external_wp_element_["createElement"])(ColorfulWrapper, Object(esm_extends["a" /* default */])({
@ -40889,7 +40942,7 @@ function GradientPicker(_ref5) {
__experimentalHasMultipleOrigins
} = _ref5;
const clearGradient = Object(external_wp_element_["useCallback"])(() => onChange(undefined), [onChange]);
const Component = __experimentalHasMultipleOrigins ? MultipleOrigin : SingleOrigin;
const Component = __experimentalHasMultipleOrigins && gradients !== null && gradients !== void 0 && gradients.length ? MultipleOrigin : SingleOrigin;
return Object(external_wp_element_["createElement"])(Component, {
className: className,
clearable: clearable,
@ -40897,7 +40950,7 @@ function GradientPicker(_ref5) {
gradients: gradients,
onChange: onChange,
value: value,
actions: clearable && Object(external_wp_element_["createElement"])(CircularOptionPicker.ButtonAction, {
actions: clearable && ((gradients === null || gradients === void 0 ? void 0 : gradients.length) || !disableCustomGradients) && Object(external_wp_element_["createElement"])(CircularOptionPicker.ButtonAction, {
onClick: clearGradient
}, Object(external_wp_i18n_["__"])('Clear')),
content: !disableCustomGradients && Object(external_wp_element_["createElement"])(CustomGradientPicker, {
@ -40920,6 +40973,7 @@ var a11y = __webpack_require__("7bKH");
/**
* WordPress dependencies
*/
@ -41018,7 +41072,8 @@ function ColorPalette(_ref5) {
enableAlpha,
onChange,
value,
__experimentalHasMultipleOrigins = false
__experimentalHasMultipleOrigins = false,
__experimentalIsRenderedInSidebar = false
} = _ref5;
const clearColor = Object(external_wp_element_["useCallback"])(() => onChange(undefined), [onChange]);
const Component = __experimentalHasMultipleOrigins ? MultiplePalettes : SinglePalette;
@ -41033,7 +41088,9 @@ function ColorPalette(_ref5) {
spacing: 3,
className: className
}, !disableCustomColors && Object(external_wp_element_["createElement"])(Dropdown, {
contentClassName: "components-color-palette__custom-color-dropdown-content",
contentClassName: classnames_default()('components-color-palette__custom-color-dropdown-content', {
'is-rendered-in-sidebar': __experimentalIsRenderedInSidebar
}),
renderContent: renderCustomColorPicker,
renderToggle: _ref6 => {
let {
@ -41801,7 +41858,8 @@ function PaletteEdit(_ref6) {
const [isEditing, setIsEditing] = Object(external_wp_element_["useState"])(false);
const [editingElement, setEditingElement] = Object(external_wp_element_["useState"])(null);
const isAdding = isEditing && editingElement && elements[editingElement] && !elements[editingElement].slug;
const hasElements = elements.length > 0;
const elementsLength = elements.length;
const hasElements = elementsLength > 0;
return Object(external_wp_element_["createElement"])(PaletteEditStyles, null, Object(external_wp_element_["createElement"])(PaletteHStackHeader, null, Object(external_wp_element_["createElement"])(PaletteHeading, null, paletteLabel), Object(external_wp_element_["createElement"])(PaletteActionsContainer, null, isEditing && Object(external_wp_element_["createElement"])(DoneButton, {
isSmall: true,
onClick: () => {
@ -41814,12 +41872,15 @@ function PaletteEdit(_ref6) {
icon: plus["a" /* default */],
label: isGradient ? Object(external_wp_i18n_["__"])('Add gradient') : Object(external_wp_i18n_["__"])('Add color'),
onClick: () => {
const tempOptionName = Object(external_wp_i18n_["sprintf"])(
/* translators: %s: is a temporary id for a custom color */
Object(external_wp_i18n_["__"])('Color %s '), elementsLength + 1);
onChange([...elements, { ...(isGradient ? {
gradient: DEFAULT_GRADIENT
} : {
color: '#000'
}),
name: '',
name: tempOptionName,
slug: ''
}]);
setIsEditing(true);
@ -54892,8 +54953,9 @@ function NavigationItem(props) {
return null;
}
const isActive = item && activeItem === item;
const classes = classnames_default()(className, {
'is-active': item && activeItem === item
'is-active': isActive
});
const onItemClick = event => {
@ -54912,6 +54974,7 @@ function NavigationItem(props) {
as: build_module_button["a" /* default */],
href,
onClick: onItemClick,
'aria-current': isActive ? 'page' : undefined,
...restProps
};
return Object(external_wp_element_["createElement"])(NavigationItemBase, Object(esm_extends["a" /* default */])({}, baseProps, {

File diff suppressed because one or more lines are too long

View File

@ -2209,7 +2209,7 @@ function TemplatePartItemMore(_ref) {
}, Object(external_wp_i18n_["sprintf"])(
/* translators: %s: template part title */
Object(external_wp_i18n_["__"])('Edit %s'), (_templatePart$title = templatePart.title) === null || _templatePart$title === void 0 ? void 0 : _templatePart$title.rendered))), isTemplateRevertable(templatePart) && Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], null, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
info: Object(external_wp_i18n_["__"])('Restore template to theme default'),
info: Object(external_wp_i18n_["__"])('Restore template to default state'),
onClick: clearCustomizations
}, Object(external_wp_i18n_["__"])('Clear customizations'))));
}
@ -2388,7 +2388,7 @@ function TemplateDetails(_ref) {
className: "edit-site-template-details__group edit-site-template-details__revert"
}, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
className: "edit-site-template-details__revert-button",
info: Object(external_wp_i18n_["__"])('Restore template to theme default'),
info: Object(external_wp_i18n_["__"])('Restore template to default state'),
onClick: revert
}, Object(external_wp_i18n_["__"])('Clear customizations'))), Object(external_wp_element_["createElement"])(external_wp_components_["Button"], {
className: "edit-site-template-details__show-all-button",
@ -4319,7 +4319,8 @@ function ScreenBackgroundColor(_ref) {
disableCustomGradients: !areCustomGradientsEnabled,
__experimentalHasMultipleOrigins: true,
showTitle: false,
enableAlpha: true
enableAlpha: true,
__experimentalIsRenderedInSidebar: true
}));
}
@ -4375,7 +4376,8 @@ function ScreenTextColor(_ref) {
disableCustomColors: !areCustomSolidsEnabled,
__experimentalHasMultipleOrigins: true,
showTitle: false,
enableAlpha: true
enableAlpha: true,
__experimentalIsRenderedInSidebar: true
}));
}
@ -4431,7 +4433,8 @@ function ScreenLinkColor(_ref) {
disableCustomColors: !areCustomSolidsEnabled,
__experimentalHasMultipleOrigins: true,
showTitle: false,
enableAlpha: true
enableAlpha: true,
__experimentalIsRenderedInSidebar: true
}));
}
@ -7795,7 +7798,7 @@ function Actions(_ref) {
onClose();
}
}, Object(external_wp_i18n_["__"])('Delete template'))), isRevertable && Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], {
info: Object(external_wp_i18n_["__"])('Restore template to theme default'),
info: Object(external_wp_i18n_["__"])('Restore template to default state'),
onClick: () => {
revertAndSaveTemplate();
onClose();
@ -8044,7 +8047,10 @@ function Table(_ref) {
}, Object(external_wp_i18n_["__"])('Added by')), Object(external_wp_element_["createElement"])("th", {
className: "edit-site-list-table-column",
role: "columnheader"
}, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('Actions'))))), Object(external_wp_element_["createElement"])("tbody", null, templates.map(template => Object(external_wp_element_["createElement"])("tr", {
}, Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], null, Object(external_wp_i18n_["__"])('Actions'))))), Object(external_wp_element_["createElement"])("tbody", null, templates.map(template => {
var _template$title;
return Object(external_wp_element_["createElement"])("tr", {
key: template.id,
className: "edit-site-list-table-row",
role: "row"
@ -8058,7 +8064,7 @@ function Table(_ref) {
postId: template.id,
postType: template.type
})
}, template.title.rendered)), template.description), Object(external_wp_element_["createElement"])("td", {
}, ((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug)), template.description), Object(external_wp_element_["createElement"])("td", {
className: "edit-site-list-table-column",
role: "cell"
}, Object(external_wp_element_["createElement"])(AddedBy, {
@ -8069,7 +8075,8 @@ function Table(_ref) {
role: "cell"
}, Object(external_wp_element_["createElement"])(Actions, {
template: template
}))))))
})));
})))
);
}

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-beta1-52323';
$wp_version = '5.9-beta1-52324';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.