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

Update @wordpress npm packages. #626

Closed
Closed
Show file tree
Hide file tree
Changes from 11 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
1,637 changes: 811 additions & 826 deletions package-lock.json

Large diffs are not rendered by default.

57 changes: 29 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"devDependencies": {
"@wordpress/custom-templated-path-webpack-plugin": "1.7.0",
"@wordpress/dependency-extraction-webpack-plugin": "2.8.0",
"@wordpress/e2e-test-utils": "4.14.0",
"@wordpress/e2e-test-utils": "4.15.0",
"@wordpress/library-export-default-webpack-plugin": "1.9.0",
"@wordpress/scripts": "12.3.0",
"@wordpress/scripts": "12.4.0",
"autoprefixer": "9.6.2",
"chalk": "4.1.0",
"check-node-version": "4.0.1",
Expand Down Expand Up @@ -80,52 +80,53 @@
"dependencies": {
"@babel/polyfill": "7.10.1",
"@wordpress/a11y": "2.13.0",
"@wordpress/annotations": "1.22.0",
"@wordpress/annotations": "1.23.0",
"@wordpress/api-fetch": "3.20.0",
"@wordpress/autop": "2.10.0",
"@wordpress/blob": "2.10.0",
"@wordpress/block-directory": "1.16.1",
"@wordpress/block-editor": "5.0.1",
"@wordpress/block-library": "2.25.1",
"@wordpress/blob": "2.11.0",
"@wordpress/block-directory": "1.17.0",
"@wordpress/block-editor": "5.1.0",
"@wordpress/block-library": "2.26.0",
"@wordpress/block-serialization-default-parser": "3.8.0",
"@wordpress/blocks": "6.23.0",
"@wordpress/components": "11.0.0",
"@wordpress/compose": "3.21.0",
"@wordpress/core-data": "2.23.0",
"@wordpress/data": "4.24.0",
"@wordpress/data-controls": "1.18.0",
"@wordpress/blocks": "6.24.0",
"@wordpress/components": "11.1.0",
"@wordpress/compose": "3.22.0",
"@wordpress/core-data": "2.24.0",
"@wordpress/data": "4.25.0",
"@wordpress/data-controls": "1.19.0",
"@wordpress/date": "3.12.0",
"@wordpress/deprecated": "2.10.0",
"@wordpress/dom": "2.15.0",
"@wordpress/dom-ready": "2.11.0",
"@wordpress/edit-post": "3.24.1",
"@wordpress/editor": "9.23.1",
"@wordpress/edit-post": "3.25.0",
"@wordpress/editor": "9.24.0",
"@wordpress/element": "2.18.0",
"@wordpress/escape-html": "1.10.0",
"@wordpress/format-library": "1.24.1",
"@wordpress/format-library": "1.25.0",
"@wordpress/hooks": "2.10.0",
"@wordpress/html-entities": "2.9.0",
"@wordpress/i18n": "3.16.0",
"@wordpress/icons": "2.7.0",
"@wordpress/icons": "2.8.0",
"@wordpress/is-shallow-equal": "2.3.0",
"@wordpress/keyboard-shortcuts": "1.11.0",
"@wordpress/keyboard-shortcuts": "1.12.0",
"@wordpress/keycodes": "2.16.0",
"@wordpress/list-reusable-blocks": "1.23.0",
"@wordpress/media-utils": "1.17.0",
"@wordpress/notices": "2.10.0",
"@wordpress/nux": "3.22.0",
"@wordpress/plugins": "2.22.0",
"@wordpress/primitives": "1.9.0",
"@wordpress/list-reusable-blocks": "1.24.0",
"@wordpress/media-utils": "1.18.0",
"@wordpress/notices": "2.11.0",
"@wordpress/nux": "3.23.0",
"@wordpress/plugins": "2.23.0",
"@wordpress/primitives": "1.10.0",
"@wordpress/priority-queue": "1.9.0",
"@wordpress/redux-routine": "3.12.0",
"@wordpress/rich-text": "3.22.0",
"@wordpress/server-side-render": "1.18.0",
"@wordpress/reusable-blocks": "1.0.0",
"@wordpress/rich-text": "3.23.0",
"@wordpress/server-side-render": "1.19.0",
"@wordpress/shortcode": "2.11.0",
"@wordpress/token-list": "1.13.0",
"@wordpress/url": "2.19.0",
"@wordpress/viewport": "2.23.0",
"@wordpress/viewport": "2.24.0",
"@wordpress/warning": "1.3.0",
"@wordpress/wordcount": "2.12.0",
"@wordpress/wordcount": "2.13.0",
"backbone": "1.4.0",
"clipboard": "2.0.6",
"core-js-url-browser": "3.6.4",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

21 changes: 17 additions & 4 deletions src/wp-includes/block-supports/align.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Registers the align block attribute for block types that support it.
*
* @access private
*
* @param WP_Block_Type $block_type Block Type.
*/
function wp_register_alignment_support( $block_type ) {
Expand All @@ -33,13 +35,15 @@ function wp_register_alignment_support( $block_type ) {
* Add CSS classes for block alignment to the incoming attributes array.
* This will be applied to the block markup in the front-end.
*
* @param array $attributes Comprehensive list of attributes to be applied.
* @param array $block_attributes Block attributes.
* @access private
*
* @param WP_Block_Type $block_type Block Type.
* @param array $block_attributes Block attributes.
*
* @return array Block alignment CSS classes and inline styles.
*/
function wp_apply_alignment_support( $attributes, $block_attributes, $block_type ) {
function wp_apply_alignment_support( $block_type, $block_attributes ) {
youknowriad marked this conversation as resolved.
Show resolved Hide resolved
$attributes = array();
$has_align_support = false;
if ( property_exists( $block_type, 'supports' ) ) {
$has_align_support = wp_array_get( $block_type->supports, array( 'align' ), false );
Expand All @@ -48,9 +52,18 @@ function wp_apply_alignment_support( $attributes, $block_attributes, $block_type
$has_block_alignment = array_key_exists( 'align', $block_attributes );

if ( $has_block_alignment ) {
$attributes['css_classes'][] = sprintf( 'align%s', $block_attributes['align'] );
$attributes['class'] = sprintf( 'align%s', $block_attributes['align'] );
}
}

return $attributes;
}

// Register the block support.
WP_Block_Supports::get_instance()->register(
'align',
array(
'register_attribute' => 'wp_register_alignment_support',
'apply' => 'wp_apply_alignment_support',
)
);
56 changes: 39 additions & 17 deletions src/wp-includes/block-supports/colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Registers the style and colors block attributes for block types that support it.
*
* @access private
*
* @param WP_Block_Type $block_type Block Type.
*/
function wp_register_colors_support( $block_type ) {
Expand Down Expand Up @@ -53,18 +55,21 @@ function wp_register_colors_support( $block_type ) {
* Add CSS classes and inline styles for colors to the incoming attributes array.
* This will be applied to the block markup in the front-end.
*
* @param array $attributes Comprehensive list of attributes to be applied.
* @param array $block_attributes Block attributes.
* @access private
*
* @param WP_Block_Type $block_type Block type.
* @param array $block_attributes Block attributes.
*
* @return array Colors CSS classes and inline styles.
*/
function wp_apply_colors_support( $attributes, $block_attributes, $block_type ) {
function wp_apply_colors_support( $block_type, $block_attributes ) {
$color_support = wp_array_get( $block_type->supports, array( '__experimentalColor' ), false );
$has_text_colors_support = true === $color_support || ( is_array( $color_support ) && wp_array_get( $color_support, array( 'text' ), true ) );
$has_background_colors_support = true === $color_support || ( is_array( $color_support ) && wp_array_get( $color_support, array( 'background' ), true ) );
$has_link_colors_support = wp_array_get( $color_support, array( 'linkColor' ), false );
$has_gradients_support = wp_array_get( $color_support, array( 'gradients' ), false );
$classes = array();
$styles = array();

// Text Colors.
// Check support for text colors.
Expand All @@ -74,13 +79,13 @@ function wp_apply_colors_support( $attributes, $block_attributes, $block_type )

// Apply required generic class.
if ( $has_custom_text_color || $has_named_text_color ) {
$attributes['css_classes'][] = 'has-text-color';
$classes[] = 'has-text-color';
}
// Apply color class or inline style.
if ( $has_named_text_color ) {
$attributes['css_classes'][] = sprintf( 'has-%s-color', $block_attributes['textColor'] );
$classes[] = sprintf( 'has-%s-color', $block_attributes['textColor'] );
} elseif ( $has_custom_text_color ) {
$attributes['inline_styles'][] = sprintf( 'color: %s;', $block_attributes['style']['color']['text'] );
$styles[] = sprintf( 'color: %s;', $block_attributes['style']['color']['text'] );
}
}

Expand All @@ -89,15 +94,15 @@ function wp_apply_colors_support( $attributes, $block_attributes, $block_type )
$has_link_color = isset( $block_attributes['style']['color']['link'] );
// Apply required class and style.
if ( $has_link_color ) {
$attributes['css_classes'][] = 'has-link-color';
$classes[] = 'has-link-color';
// If link is a named color.
if ( strpos( $block_attributes['style']['color']['link'], 'var:preset|color|' ) !== false ) {
// Get the name from the string and add proper styles.
$index_to_splice = strrpos( $block_attributes['style']['color']['link'], '|' ) + 1;
$link_color_name = substr( $block_attributes['style']['color']['link'], $index_to_splice );
$attributes['inline_styles'][] = sprintf( '--wp--style--color--link:var(--wp--preset--color--%s);', $link_color_name );
$index_to_splice = strrpos( $block_attributes['style']['color']['link'], '|' ) + 1;
$link_color_name = substr( $block_attributes['style']['color']['link'], $index_to_splice );
$styles[] = sprintf( '--wp--style--color--link: var(--wp--preset--color--%s);', $link_color_name );
} else {
$attributes['inline_styles'][] = sprintf( '--wp--style--color--link: %s;', $block_attributes['style']['color']['link'] );
$styles[] = sprintf( '--wp--style--color--link: %s;', $block_attributes['style']['color']['link'] );
}
}
}
Expand All @@ -109,13 +114,13 @@ function wp_apply_colors_support( $attributes, $block_attributes, $block_type )

// Apply required background class.
if ( $has_custom_background_color || $has_named_background_color ) {
$attributes['css_classes'][] = 'has-background';
$classes[] = 'has-background';
}
// Apply background color classes or styles.
if ( $has_named_background_color ) {
$attributes['css_classes'][] = sprintf( 'has-%s-background-color', $block_attributes['backgroundColor'] );
$classes[] = sprintf( 'has-%s-background-color', $block_attributes['backgroundColor'] );
} elseif ( $has_custom_background_color ) {
$attributes['inline_styles'][] = sprintf( 'background-color: %s;', $block_attributes['style']['color']['background'] );
$styles[] = sprintf( 'background-color: %s;', $block_attributes['style']['color']['background'] );
}
}

Expand All @@ -125,15 +130,32 @@ function wp_apply_colors_support( $attributes, $block_attributes, $block_type )
$has_custom_gradient = isset( $block_attributes['style']['color']['gradient'] );

if ( $has_named_gradient || $has_custom_gradient ) {
$attributes['css_classes'][] = 'has-background';
$classes[] = 'has-background';
}
// Apply required background class.
if ( $has_named_gradient ) {
$attributes['css_classes'][] = sprintf( 'has-%s-gradient-background', $block_attributes['gradient'] );
$classes[] = sprintf( 'has-%s-gradient-background', $block_attributes['gradient'] );
} elseif ( $has_custom_gradient ) {
$attributes['inline_styles'][] = sprintf( 'background: %s;', $block_attributes['style']['color']['gradient'] );
$styles[] = sprintf( 'background: %s;', $block_attributes['style']['color']['gradient'] );
}
}

$attributes = array();
if ( ! empty( $classes ) ) {
$attributes['class'] = implode( ' ', $classes );
}
if ( ! empty( $styles ) ) {
$attributes['style'] = implode( ' ', $styles );
}

return $attributes;
}

// Register the block support.
WP_Block_Supports::get_instance()->register(
'colors',
array(
'register_attribute' => 'wp_register_colors_support',
'apply' => 'wp_apply_colors_support',
)
);
21 changes: 17 additions & 4 deletions src/wp-includes/block-supports/custom-classname.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Registers the custom classname block attribute for block types that support it.
*
* @access private
*
* @param WP_Block_Type $block_type Block Type.
*/
function wp_register_custom_classname_support( $block_type ) {
Expand All @@ -31,24 +33,35 @@ function wp_register_custom_classname_support( $block_type ) {
/**
* Add the custom classnames to the output.
*
* @param array $attributes Comprehensive list of attributes to be applied.
* @param array $block_attributes Block attributes.
* @access private
*
* @param WP_Block_Type $block_type Block Type.
* @param array $block_attributes Block attributes.
*
* @return array Block CSS classes and inline styles.
*/
function wp_apply_custom_classname_support( $attributes, $block_attributes, $block_type ) {
function wp_apply_custom_classname_support( $block_type, $block_attributes ) {
$has_custom_classname_support = true;
$attributes = array();
if ( property_exists( $block_type, 'supports' ) ) {
$has_custom_classname_support = wp_array_get( $block_type->supports, array( 'customClassName' ), true );
}
if ( $has_custom_classname_support ) {
$has_custom_classnames = array_key_exists( 'className', $block_attributes );

if ( $has_custom_classnames ) {
$attributes['css_classes'][] = $block_attributes['className'];
$attributes['class'] = $block_attributes['className'];
}
}

return $attributes;
}

// Register the block support.
WP_Block_Supports::get_instance()->register(
'custom-classname',
array(
'register_attribute' => 'wp_register_custom_classname_support',
'apply' => 'wp_apply_custom_classname_support',
)
);
20 changes: 16 additions & 4 deletions src/wp-includes/block-supports/generated-classname.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/**
* Get the generated classname from a given block name.
*
* @access private
*
* @param string $block_name Block Name.
* @return string Generated classname.
*/
Expand All @@ -34,24 +36,34 @@ function wp_get_block_default_classname( $block_name ) {
/**
* Add the generated classnames to the output.
*
* @param array $attributes Comprehensive list of attributes to be applied.
* @param array $block_attributes Block attributes.
* @access private
*
* @param WP_Block_Type $block_type Block Type.
* @param array $block_attributes Block attributes.
*
* @return array Block CSS classes and inline styles.
*/
function wp_apply_generated_classname_support( $attributes, $block_attributes, $block_type ) {
function wp_apply_generated_classname_support( $block_type, $block_attributes ) {
$has_generated_classname_support = true;
$attributes = array();
if ( property_exists( $block_type, 'supports' ) ) {
$has_generated_classname_support = wp_array_get( $block_type->supports, array( 'className' ), true );
}
if ( $has_generated_classname_support ) {
$block_classname = wp_get_block_default_classname( $block_type->name );

if ( $block_classname ) {
$attributes['css_classes'][] = $block_classname;
$attributes['class'] = $block_classname;
}
}

return $attributes;
}

// Register the block support.
WP_Block_Supports::get_instance()->register(
'generated-classname',
array(
'apply' => 'wp_apply_generated_classname_support',
)
);
Loading