Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync packages for WP 6.1 RC 1 (with Fluid Typography) #3437

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
822 changes: 408 additions & 414 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,56 +81,56 @@
"@wordpress/api-fetch": "6.14.1",
"@wordpress/autop": "3.17.1",
"@wordpress/blob": "3.17.1",
"@wordpress/block-directory": "3.15.4",
"@wordpress/block-editor": "10.0.4",
"@wordpress/block-library": "7.14.4",
"@wordpress/block-directory": "3.15.6",
"@wordpress/block-editor": "10.0.6",
"@wordpress/block-library": "7.14.6",
"@wordpress/block-serialization-default-parser": "4.17.1",
"@wordpress/blocks": "11.16.4",
"@wordpress/components": "21.0.4",
"@wordpress/components": "21.0.5",
"@wordpress/compose": "5.15.2",
"@wordpress/core-data": "5.0.4",
"@wordpress/customize-widgets": "3.14.4",
"@wordpress/customize-widgets": "3.14.6",
"@wordpress/data": "7.1.3",
"@wordpress/data-controls": "2.17.3",
"@wordpress/date": "4.17.1",
"@wordpress/deprecated": "3.17.1",
"@wordpress/dom": "3.17.2",
"@wordpress/dom-ready": "3.17.1",
"@wordpress/edit-post": "6.14.4",
"@wordpress/edit-site": "4.14.6",
"@wordpress/edit-widgets": "4.14.4",
"@wordpress/editor": "12.16.4",
"@wordpress/edit-post": "6.14.6",
"@wordpress/edit-site": "4.14.8",
"@wordpress/edit-widgets": "4.14.6",
"@wordpress/editor": "12.16.6",
"@wordpress/element": "4.15.1",
"@wordpress/escape-html": "2.17.1",
"@wordpress/format-library": "3.15.4",
"@wordpress/format-library": "3.15.6",
"@wordpress/hooks": "3.17.1",
"@wordpress/html-entities": "3.17.1",
"@wordpress/i18n": "4.17.1",
"@wordpress/icons": "9.8.1",
"@wordpress/interface": "4.16.4",
"@wordpress/interface": "4.16.5",
"@wordpress/is-shallow-equal": "4.17.1",
"@wordpress/keyboard-shortcuts": "3.15.3",
"@wordpress/keycodes": "3.17.1",
"@wordpress/list-reusable-blocks": "3.15.4",
"@wordpress/list-reusable-blocks": "3.15.5",
"@wordpress/media-utils": "4.8.1",
"@wordpress/notices": "3.17.3",
"@wordpress/nux": "5.15.4",
"@wordpress/nux": "5.15.5",
"@wordpress/plugins": "4.15.2",
"@wordpress/preferences": "2.9.4",
"@wordpress/preferences": "2.9.5",
"@wordpress/preferences-persistence": "1.9.1",
"@wordpress/primitives": "3.15.1",
"@wordpress/priority-queue": "2.17.2",
"@wordpress/redux-routine": "4.17.1",
"@wordpress/reusable-blocks": "3.15.4",
"@wordpress/reusable-blocks": "3.15.6",
"@wordpress/rich-text": "5.15.3",
"@wordpress/server-side-render": "3.15.4",
"@wordpress/server-side-render": "3.15.5",
"@wordpress/shortcode": "3.17.1",
"@wordpress/style-engine": "1.0.3",
"@wordpress/token-list": "2.17.1",
"@wordpress/url": "3.18.1",
"@wordpress/viewport": "4.15.3",
"@wordpress/warning": "2.17.1",
"@wordpress/widgets": "2.15.4",
"@wordpress/widgets": "2.15.6",
"@wordpress/wordcount": "3.17.1",
"backbone": "1.4.1",
"clipboard": "2.0.11",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/assets/script-loader-packages.min.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/wp-includes/blocks/blocks-json.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/wp-includes/blocks/comment-author-name.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function render_block_core_comment_author_name( $attributes, $content, $block )
$comment_author = get_comment_author( $comment );
$link = get_comment_author_url( $comment );

if ( ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) {
if ( ! empty( $link ) && ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) {
$comment_author = sprintf( '<a rel="external nofollow ugc" href="%1s" target="%2s" >%3s</a>', esc_url( $link ), esc_attr( $attributes['linkTarget'] ), $comment_author );
}
if ( '0' === $comment->comment_approved && ! $show_pending_links ) {
Expand Down
9 changes: 8 additions & 1 deletion src/wp-includes/blocks/navigation-link.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ function block_core_navigation_link_build_css_font_sizes( $context ) {
$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
} elseif ( $has_custom_font_size ) {
// Add the custom font size inline style.
$font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] );
$font_sizes['inline_styles'] = sprintf(
'font-size: %s;',
gutenberg_get_typography_font_size_value(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gutenberg_get_typography_font_size_value(
wp_get_typography_font_size_value(

array(
'size' => $context['style']['typography']['fontSize'],
)
)
);
}

return $font_sizes;
Expand Down
9 changes: 8 additions & 1 deletion src/wp-includes/blocks/navigation-submenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ function block_core_navigation_submenu_build_css_font_sizes( $context ) {
$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
} elseif ( $has_custom_font_size ) {
// Add the custom font size inline style.
$font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] );
$font_sizes['inline_styles'] = sprintf(
'font-size: %s;',
gutenberg_get_typography_font_size_value(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gutenberg_get_typography_font_size_value(
wp_get_typography_font_size_value(

array(
'size' => $context['style']['typography']['fontSize'],
)
)
);
}

return $font_sizes;
Expand Down
3 changes: 0 additions & 3 deletions src/wp-includes/blocks/navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,6 @@ function block_core_navigation_get_fallback_blocks() {
$page_list_fallback = array(
array(
'blockName' => 'core/page-list',
'attrs' => array(
'__unstableMaxPages' => 4,
),
),
);

Expand Down
1 change: 0 additions & 1 deletion src/wp-includes/blocks/navigation/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
},
"supports": {
"align": [ "wide", "full" ],
"anchor": true,
"html": false,
"inserter": true,
"typography": {
Expand Down
14 changes: 8 additions & 6 deletions src/wp-includes/blocks/page-list.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,14 @@ function block_core_page_list_build_css_font_sizes( $context ) {
$font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
} elseif ( $has_custom_font_size ) {
// Add the custom font size inline style.
$font_sizes['inline_styles'] = sprintf( 'font-size: %s;', $context['style']['typography']['fontSize'] );
$font_sizes['inline_styles'] = sprintf(
'font-size: %s;',
gutenberg_get_typography_font_size_value(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gutenberg_get_typography_font_size_value(
wp_get_typography_font_size_value(

array(
'size' => $context['style']['typography']['fontSize'],
)
)
);
}

return $font_sizes;
Expand Down Expand Up @@ -299,11 +306,6 @@ function render_block_core_page_list( $attributes, $content, $block ) {

$nested_pages = block_core_page_list_nest_pages( $top_level_pages, $pages_with_children );

// Limit the number of items to be visually displayed.
if ( ! empty( $attributes['__unstableMaxPages'] ) ) {
$nested_pages = array_slice( $nested_pages, 0, $attributes['__unstableMaxPages'] );
}

$is_navigation_child = array_key_exists( 'showSubmenuIcon', $block->context );

$open_submenus_on_click = array_key_exists( 'openSubmenusOnClick', $block->context ) ? $block->context['openSubmenusOnClick'] : false;
Expand Down
6 changes: 1 addition & 5 deletions src/wp-includes/blocks/page-list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
"description": "Display a list of all pages.",
"keywords": [ "menu", "navigation" ],
"textdomain": "default",
"attributes": {
"__unstableMaxPages": {
"type": "number"
}
},
"attributes": {},
"usesContext": [
"textColor",
"customTextColor",
Expand Down
118 changes: 59 additions & 59 deletions src/wp-includes/blocks/require-dynamic-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,62 @@

// This file was autogenerated by tools/release/sync-stable-blocks.js, do not change manually!
// Requires files for dynamic blocks necessary for core blocks registration.
require ABSPATH . WPINC . '/blocks/archives.php';
require ABSPATH . WPINC . '/blocks/avatar.php';
require ABSPATH . WPINC . '/blocks/block.php';
require ABSPATH . WPINC . '/blocks/calendar.php';
require ABSPATH . WPINC . '/blocks/categories.php';
require ABSPATH . WPINC . '/blocks/comment-author-name.php';
require ABSPATH . WPINC . '/blocks/comment-content.php';
require ABSPATH . WPINC . '/blocks/comment-date.php';
require ABSPATH . WPINC . '/blocks/comment-edit-link.php';
require ABSPATH . WPINC . '/blocks/comment-reply-link.php';
require ABSPATH . WPINC . '/blocks/comment-template.php';
require ABSPATH . WPINC . '/blocks/comments.php';
require ABSPATH . WPINC . '/blocks/comments-pagination.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-next.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-numbers.php';
require ABSPATH . WPINC . '/blocks/comments-pagination-previous.php';
require ABSPATH . WPINC . '/blocks/comments-title.php';
require ABSPATH . WPINC . '/blocks/cover.php';
require ABSPATH . WPINC . '/blocks/file.php';
require ABSPATH . WPINC . '/blocks/gallery.php';
require ABSPATH . WPINC . '/blocks/home-link.php';
require ABSPATH . WPINC . '/blocks/image.php';
require ABSPATH . WPINC . '/blocks/latest-comments.php';
require ABSPATH . WPINC . '/blocks/latest-posts.php';
require ABSPATH . WPINC . '/blocks/loginout.php';
require ABSPATH . WPINC . '/blocks/navigation.php';
require ABSPATH . WPINC . '/blocks/navigation-link.php';
require ABSPATH . WPINC . '/blocks/navigation-submenu.php';
require ABSPATH . WPINC . '/blocks/page-list.php';
require ABSPATH . WPINC . '/blocks/pattern.php';
require ABSPATH . WPINC . '/blocks/post-author.php';
require ABSPATH . WPINC . '/blocks/post-author-biography.php';
require ABSPATH . WPINC . '/blocks/post-comments-form.php';
require ABSPATH . WPINC . '/blocks/post-content.php';
require ABSPATH . WPINC . '/blocks/post-date.php';
require ABSPATH . WPINC . '/blocks/post-excerpt.php';
require ABSPATH . WPINC . '/blocks/post-featured-image.php';
require ABSPATH . WPINC . '/blocks/post-navigation-link.php';
require ABSPATH . WPINC . '/blocks/post-template.php';
require ABSPATH . WPINC . '/blocks/post-terms.php';
require ABSPATH . WPINC . '/blocks/post-title.php';
require ABSPATH . WPINC . '/blocks/query.php';
require ABSPATH . WPINC . '/blocks/query-no-results.php';
require ABSPATH . WPINC . '/blocks/query-pagination.php';
require ABSPATH . WPINC . '/blocks/query-pagination-next.php';
require ABSPATH . WPINC . '/blocks/query-pagination-numbers.php';
require ABSPATH . WPINC . '/blocks/query-pagination-previous.php';
require ABSPATH . WPINC . '/blocks/query-title.php';
require ABSPATH . WPINC . '/blocks/read-more.php';
require ABSPATH . WPINC . '/blocks/rss.php';
require ABSPATH . WPINC . '/blocks/search.php';
require ABSPATH . WPINC . '/blocks/shortcode.php';
require ABSPATH . WPINC . '/blocks/site-logo.php';
require ABSPATH . WPINC . '/blocks/site-tagline.php';
require ABSPATH . WPINC . '/blocks/site-title.php';
require ABSPATH . WPINC . '/blocks/social-link.php';
require ABSPATH . WPINC . '/blocks/tag-cloud.php';
require ABSPATH . WPINC . '/blocks/template-part.php';
require ABSPATH . WPINC . '/blocks/term-description.php';
require_once ABSPATH . WPINC . '/blocks/archives.php';
require_once ABSPATH . WPINC . '/blocks/avatar.php';
require_once ABSPATH . WPINC . '/blocks/block.php';
require_once ABSPATH . WPINC . '/blocks/calendar.php';
require_once ABSPATH . WPINC . '/blocks/categories.php';
require_once ABSPATH . WPINC . '/blocks/comment-author-name.php';
require_once ABSPATH . WPINC . '/blocks/comment-content.php';
require_once ABSPATH . WPINC . '/blocks/comment-date.php';
require_once ABSPATH . WPINC . '/blocks/comment-edit-link.php';
require_once ABSPATH . WPINC . '/blocks/comment-reply-link.php';
require_once ABSPATH . WPINC . '/blocks/comment-template.php';
require_once ABSPATH . WPINC . '/blocks/comments.php';
require_once ABSPATH . WPINC . '/blocks/comments-pagination.php';
require_once ABSPATH . WPINC . '/blocks/comments-pagination-next.php';
require_once ABSPATH . WPINC . '/blocks/comments-pagination-numbers.php';
require_once ABSPATH . WPINC . '/blocks/comments-pagination-previous.php';
require_once ABSPATH . WPINC . '/blocks/comments-title.php';
require_once ABSPATH . WPINC . '/blocks/cover.php';
require_once ABSPATH . WPINC . '/blocks/file.php';
require_once ABSPATH . WPINC . '/blocks/gallery.php';
require_once ABSPATH . WPINC . '/blocks/home-link.php';
require_once ABSPATH . WPINC . '/blocks/image.php';
require_once ABSPATH . WPINC . '/blocks/latest-comments.php';
require_once ABSPATH . WPINC . '/blocks/latest-posts.php';
require_once ABSPATH . WPINC . '/blocks/loginout.php';
require_once ABSPATH . WPINC . '/blocks/navigation.php';
require_once ABSPATH . WPINC . '/blocks/navigation-link.php';
require_once ABSPATH . WPINC . '/blocks/navigation-submenu.php';
require_once ABSPATH . WPINC . '/blocks/page-list.php';
require_once ABSPATH . WPINC . '/blocks/pattern.php';
require_once ABSPATH . WPINC . '/blocks/post-author.php';
require_once ABSPATH . WPINC . '/blocks/post-author-biography.php';
require_once ABSPATH . WPINC . '/blocks/post-comments-form.php';
require_once ABSPATH . WPINC . '/blocks/post-content.php';
require_once ABSPATH . WPINC . '/blocks/post-date.php';
require_once ABSPATH . WPINC . '/blocks/post-excerpt.php';
require_once ABSPATH . WPINC . '/blocks/post-featured-image.php';
require_once ABSPATH . WPINC . '/blocks/post-navigation-link.php';
require_once ABSPATH . WPINC . '/blocks/post-template.php';
require_once ABSPATH . WPINC . '/blocks/post-terms.php';
require_once ABSPATH . WPINC . '/blocks/post-title.php';
require_once ABSPATH . WPINC . '/blocks/query.php';
require_once ABSPATH . WPINC . '/blocks/query-no-results.php';
require_once ABSPATH . WPINC . '/blocks/query-pagination.php';
require_once ABSPATH . WPINC . '/blocks/query-pagination-next.php';
require_once ABSPATH . WPINC . '/blocks/query-pagination-numbers.php';
require_once ABSPATH . WPINC . '/blocks/query-pagination-previous.php';
require_once ABSPATH . WPINC . '/blocks/query-title.php';
require_once ABSPATH . WPINC . '/blocks/read-more.php';
require_once ABSPATH . WPINC . '/blocks/rss.php';
require_once ABSPATH . WPINC . '/blocks/search.php';
require_once ABSPATH . WPINC . '/blocks/shortcode.php';
require_once ABSPATH . WPINC . '/blocks/site-logo.php';
require_once ABSPATH . WPINC . '/blocks/site-tagline.php';
require_once ABSPATH . WPINC . '/blocks/site-title.php';
require_once ABSPATH . WPINC . '/blocks/social-link.php';
require_once ABSPATH . WPINC . '/blocks/tag-cloud.php';
require_once ABSPATH . WPINC . '/blocks/template-part.php';
require_once ABSPATH . WPINC . '/blocks/term-description.php';
24 changes: 16 additions & 8 deletions src/wp-includes/blocks/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ function styles_for_block_core_search( $attributes ) {
}

// Get typography styles to be shared across inner elements.
$typography_styles = get_typography_styles_for_block_core_search( $attributes );
$typography_styles = esc_attr( get_typography_styles_for_block_core_search( $attributes ) );
if ( ! empty( $typography_styles ) ) {
$label_styles [] = $typography_styles;
$button_styles[] = $typography_styles;
Expand Down Expand Up @@ -442,31 +442,39 @@ function get_typography_styles_for_block_core_search( $attributes ) {

// Add typography styles.
if ( ! empty( $attributes['style']['typography']['fontSize'] ) ) {
$typography_styles[] = sprintf( 'font-size: %s;', esc_attr( $attributes['style']['typography']['fontSize'] ) );
$typography_styles[] = sprintf(
'font-size: %s;',
gutenberg_get_typography_font_size_value(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gutenberg_get_typography_font_size_value(
wp_get_typography_font_size_value(

array(
'size' => $attributes['style']['typography']['fontSize'],
)
)
);

}

if ( ! empty( $attributes['style']['typography']['fontFamily'] ) ) {
$typography_styles[] = sprintf( 'font-family: %s;', esc_attr( $attributes['style']['typography']['fontFamily'] ) );
$typography_styles[] = sprintf( 'font-family: %s;', $attributes['style']['typography']['fontFamily'] );
}

if ( ! empty( $attributes['style']['typography']['letterSpacing'] ) ) {
$typography_styles[] = sprintf( 'letter-spacing: %s;', esc_attr( $attributes['style']['typography']['letterSpacing'] ) );
$typography_styles[] = sprintf( 'letter-spacing: %s;', $attributes['style']['typography']['letterSpacing'] );
}

if ( ! empty( $attributes['style']['typography']['fontWeight'] ) ) {
$typography_styles[] = sprintf( 'font-weight: %s;', esc_attr( $attributes['style']['typography']['fontWeight'] ) );
$typography_styles[] = sprintf( 'font-weight: %s;', $attributes['style']['typography']['fontWeight'] );
}

if ( ! empty( $attributes['style']['typography']['fontStyle'] ) ) {
$typography_styles[] = sprintf( 'font-style: %s;', esc_attr( $attributes['style']['typography']['fontStyle'] ) );
$typography_styles[] = sprintf( 'font-style: %s;', $attributes['style']['typography']['fontStyle'] );
}

if ( ! empty( $attributes['style']['typography']['lineHeight'] ) ) {
$typography_styles[] = sprintf( 'line-height: %s;', esc_attr( $attributes['style']['typography']['lineHeight'] ) );
$typography_styles[] = sprintf( 'line-height: %s;', $attributes['style']['typography']['lineHeight'] );
}

if ( ! empty( $attributes['style']['typography']['textTransform'] ) ) {
$typography_styles[] = sprintf( 'text-transform: %s;', esc_attr( $attributes['style']['typography']['textTransform'] ) );
$typography_styles[] = sprintf( 'text-transform: %s;', $attributes['style']['typography']['textTransform'] );
Comment on lines 456 to +477
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this code could be simplified to one loop over all elements in $attributes['style']['typography'].

Inside the loop, we could abstract out the building of the inline styles to another function. Also, if there are more style props added, this code would only need to be changed if there's some sort of unique transform needed on the value, e.g. fontSize key above on line 447 passes its value through wp_get_typography_font_size_value.

Example:

$allowed_keys = array(
    'fontFamily',
    'letterSpacing',
    'fontWeight',
    'fontStyle',
    'lineHeight',
    'textTransform',   
);

if ( isset( $attributes['style']['typography'] ) ) {
    foreach ( $attributes['style']['typography'] as $key => $value ) {
        if ( in_array( $key, $allowed_keys, true ) && ! empty( $attributes['style']['typography'][ $key ] ) ) {
            $typography_styles[] = sprintf( 
                '%1$s: %2$s;',
                _wp_to_kebab_case( $key ),
                $attributes['style']['typography'][ $key ]
            );
        }
    }
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edited to add an allowlist of known keys, to avoid parsing bad ones.

}

return implode( '', $typography_styles );
Expand Down
4 changes: 4 additions & 0 deletions src/wp-includes/blocks/template-part.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ function build_template_part_block_area_variations() {
* @return array Array containing the block variation objects.
*/
function build_template_part_block_instance_variations() {
// Block themes are unavailable during installation.
if ( wp_installing() ) {
return array();
}
$variations = array();
$template_parts = get_block_templates(
array(
Expand Down