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 npm packages without updating browserslist #4699

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
16 changes: 14 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ module.exports = function(grunt) {
options: {
patterns: [
{
match: new RegExp( '//# sourceMappingURL=.*\\s*' ),
match: new RegExp( '\/\/# sourceMappingURL=.*\\s*', 'g' ),
replacement: ''
}
]
Expand All @@ -1160,6 +1160,14 @@ module.exports = function(grunt) {
BUILD_DIR + 'wp-includes/js/underscore.js'
],
dest: BUILD_DIR + 'wp-includes/js/'
},
{
expand: true,
flatten: true,
src: [
BUILD_DIR + 'wp-includes/js/dist/block-editor.js',
],
dest: BUILD_DIR + 'wp-includes/js/dist/'
}
]
}
Expand Down Expand Up @@ -1459,7 +1467,11 @@ module.exports = function(grunt) {
} );
grunt.file.write(
SOURCE_DIR + 'wp-includes/blocks/blocks-json.php',
'<?php return ' + json2php( blocks ) + ';'
'<?php return ' + json2php.make( {
linebreak: '\n',
indent: ' ',
shortArraySyntax: false
} )( blocks ) + ';'
);
} );

Expand Down
10,158 changes: 6,472 additions & 3,686 deletions package-lock.json

Large diffs are not rendered by default.

130 changes: 70 additions & 60 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"devDependencies": {
"@lodder/grunt-postcss": "^3.1.1",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
"@wordpress/babel-preset-default": "7.10.2",
"@wordpress/dependency-extraction-webpack-plugin": "4.9.1",
"@wordpress/e2e-test-utils": "9.3.3",
"@wordpress/scripts": "25.3.4",
"@wordpress/babel-preset-default": "7.19.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks expected based on the tags but I am seeing 7.20.0 as the latest release, this version is tagged wp-6.3

"@wordpress/dependency-extraction-webpack-plugin": "4.18.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks expected based on the tags but I am seeing 4.19.0 as the latest release, this version is tagged wp-6.3

"@wordpress/e2e-test-utils": "10.6.1",
"@wordpress/scripts": "26.6.2",
"autoprefixer": "^10.4.13",
"chalk": "5.2.0",
"check-node-version": "4.2.1",
Expand Down Expand Up @@ -71,89 +71,99 @@
"source-map-loader": "4.0.1",
"terser-webpack-plugin": "5.3.6",
"uglify-js": "^3.17.4",
"uuid": "9.0.0",
"uuid": "8.3.2",
"wait-on": "7.0.1",
"webpack": "5.75.0",
"webpack-livereload-plugin": "3.0.2"
},
"dependencies": {
"@wordpress/a11y": "3.26.1",
"@wordpress/annotations": "2.26.4",
"@wordpress/api-fetch": "6.23.1",
"@wordpress/autop": "3.26.1",
"@wordpress/blob": "3.26.1",
"@wordpress/block-directory": "4.3.13",
"@wordpress/block-editor": "11.3.10",
"@wordpress/block-library": "8.3.13",
"@emotion/is-prop-valid": "0.8.8",
"@emotion/memoize": "0.7.4",
"@wordpress/a11y": "3.35.1",
"@wordpress/annotations": "2.35.1",
"@wordpress/api-fetch": "6.32.1",
"@wordpress/autop": "3.35.1",
"@wordpress/blob": "3.35.1",
"@wordpress/block-directory": "4.12.2",
"@wordpress/block-editor": "12.3.2",
"@wordpress/block-library": "8.12.2",
"@wordpress/block-serialization-default-parser": "4.35.1",
"@wordpress/blocks": "12.3.3",
"@wordpress/components": "23.3.7",
"@wordpress/compose": "6.3.3",
"@wordpress/core-data": "6.3.3",
"@wordpress/customize-widgets": "4.3.13",
"@wordpress/data": "8.3.3",
"@wordpress/data-controls": "2.26.3",
"@wordpress/date": "4.26.2",
"@wordpress/deprecated": "3.26.1",
"@wordpress/dom": "3.26.1",
"@wordpress/dom-ready": "3.26.1",
"@wordpress/edit-post": "7.3.13",
"@wordpress/edit-site": "5.3.13",
"@wordpress/edit-widgets": "5.3.13",
"@wordpress/editor": "13.3.10",
"@wordpress/element": "5.3.2",
"@wordpress/escape-html": "2.26.1",
"@wordpress/format-library": "4.3.10",
"@wordpress/hooks": "3.26.1",
"@wordpress/html-entities": "3.26.1",
"@wordpress/i18n": "4.26.1",
"@wordpress/icons": "9.17.2",
"@wordpress/interface": "5.3.8",
"@wordpress/is-shallow-equal": "4.26.1",
"@wordpress/keyboard-shortcuts": "4.3.3",
"@wordpress/keycodes": "3.26.2",
"@wordpress/list-reusable-blocks": "4.3.7",
"@wordpress/media-utils": "4.17.2",
"@wordpress/notices": "3.26.3",
"@wordpress/blocks": "12.12.1",
"@wordpress/commands": "0.6.2",
"@wordpress/components": "25.1.2",
"@wordpress/compose": "6.12.1",
"@wordpress/core-commands": "0.4.2",
"@wordpress/core-data": "6.12.2",
"@wordpress/customize-widgets": "4.12.2",
"@wordpress/data": "9.5.1",
"@wordpress/data-controls": "3.4.1",
"@wordpress/date": "4.35.1",
"@wordpress/deprecated": "3.35.1",
"@wordpress/dom": "3.35.1",
"@wordpress/dom-ready": "3.35.1",
"@wordpress/edit-post": "7.12.2",
"@wordpress/edit-site": "5.12.2",
"@wordpress/edit-widgets": "5.12.2",
"@wordpress/editor": "13.12.2",
"@wordpress/element": "5.12.1",
"@wordpress/escape-html": "2.35.1",
"@wordpress/format-library": "4.12.2",
"@wordpress/hooks": "3.35.1",
"@wordpress/html-entities": "3.35.1",
"@wordpress/i18n": "4.35.1",
"@wordpress/icons": "9.26.2",
"@wordpress/interface": "5.12.2",
"@wordpress/is-shallow-equal": "4.35.1",
"@wordpress/keyboard-shortcuts": "4.12.1",
"@wordpress/keycodes": "3.35.1",
"@wordpress/list-reusable-blocks": "4.12.2",
"@wordpress/media-utils": "4.26.1",
"@wordpress/notices": "4.3.1",
"@wordpress/nux": "6.0.0",
"@wordpress/plugins": "5.3.3",
"@wordpress/preferences": "3.3.7",
"@wordpress/preferences-persistence": "1.18.1",
"@wordpress/primitives": "3.24.2",
"@wordpress/priority-queue": "2.26.1",
"@wordpress/private-apis": "0.8.1",
"@wordpress/redux-routine": "4.26.1",
"@wordpress/reusable-blocks": "4.3.10",
"@wordpress/rich-text": "6.3.4",
"@wordpress/server-side-render": "4.3.7",
"@wordpress/shortcode": "3.26.1",
"@wordpress/style-engine": "1.9.1",
"@wordpress/token-list": "2.26.1",
"@wordpress/url": "3.27.1",
"@wordpress/viewport": "5.3.3",
"@wordpress/warning": "2.26.1",
"@wordpress/widgets": "3.3.10",
"@wordpress/wordcount": "3.26.1",
"@wordpress/plugins": "6.3.2",
"@wordpress/preferences": "3.12.2",
"@wordpress/preferences-persistence": "1.27.1",
"@wordpress/primitives": "3.33.1",
"@wordpress/priority-queue": "2.35.1",
"@wordpress/private-apis": "0.17.1",
"@wordpress/redux-routine": "4.35.1",
"@wordpress/reusable-blocks": "4.12.2",
"@wordpress/rich-text": "6.12.1",
"@wordpress/router": "0.4.1",
"@wordpress/server-side-render": "4.12.2",
"@wordpress/shortcode": "3.35.1",
"@wordpress/style-engine": "1.18.1",
"@wordpress/token-list": "2.35.1",
"@wordpress/url": "3.36.1",
"@wordpress/viewport": "5.12.1",
"@wordpress/warning": "2.35.1",
"@wordpress/widgets": "3.12.2",
"@wordpress/wordcount": "3.35.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

All the production wordpress packages are using latest. Lovely 🌻

"backbone": "1.4.1",
"clipboard": "2.0.11",
"core-js-url-browser": "3.6.4",
"element-closest": "^3.0.2",
"formdata-polyfill": "4.0.10",
"framer-motion": "10.11.6",
"hoverintent": "2.2.1",
"imagesloaded": "4.1.4",
"is-plain-object": "5.0.0",
"jquery": "3.7.0",
"jquery-color": "2.2.0",
"jquery-form": "4.3.0",
"jquery-hoverintent": "1.10.2",
"json2php": "^0.0.7",
"lodash": "4.17.21",
"masonry-layout": "4.2.2",
"memize": "2.1.0",
"moment": "2.29.4",
"objectFitPolyfill": "2.3.5",
"path-to-regexp": "6.2.1",
"polyfill-library": "4.7.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"regenerator-runtime": "0.13.11",
"tslib": "2.6.0",
"underscore": "1.13.6",
"whatwg-fetch": "3.6.2",
"wicg-inert": "3.1.2"
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/archives/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"apiVersion": 3,
"name": "core/archives",
"title": "Archives",
"category": "widgets",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/audio/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"apiVersion": 3,
"name": "core/audio",
"title": "Audio",
"category": "media",
Expand Down
130 changes: 67 additions & 63 deletions src/wp-includes/blocks/avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,67 +16,19 @@
function render_block_core_avatar( $attributes, $content, $block ) {
$size = isset( $attributes['size'] ) ? $attributes['size'] : 96;
$wrapper_attributes = get_block_wrapper_attributes();
$border_attributes = get_block_core_avatar_border_attributes( $attributes );

$image_styles = array();
// Class gets passed through `esc_attr` via `get_avatar`.
$image_classes = ! empty( $border_attributes['class'] )
? "wp-block-avatar__image {$border_attributes['class']}"
: 'wp-block-avatar__image';

// Add border width styles.
$has_border_width = ! empty( $attributes['style']['border']['width'] );

if ( $has_border_width ) {
$border_width = $attributes['style']['border']['width'];
$image_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) );
}

// Add border radius styles.
$has_border_radius = ! empty( $attributes['style']['border']['radius'] );

if ( $has_border_radius ) {
$border_radius = $attributes['style']['border']['radius'];

if ( is_array( $border_radius ) ) {
// Apply styles for individual corner border radii.
foreach ( $border_radius as $key => $value ) {
if ( null !== $value ) {
$name = _wp_to_kebab_case( $key );
// Add shared styles for individual border radii.
$border_style = sprintf(
'border-%s-radius: %s;',
esc_attr( $name ),
esc_attr( $value )
);
$image_styles[] = $border_style;
}
}
} else {
$border_style = sprintf( 'border-radius: %s;', esc_attr( $border_radius ) );
$image_styles[] = $border_style;
}
}

// Add border color styles.
$has_border_color = ! empty( $attributes['style']['border']['color'] );

if ( $has_border_color ) {
$border_color = $attributes['style']['border']['color'];
$image_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
}

// Add border style (solid, dashed, dotted ).
$has_border_style = ! empty( $attributes['style']['border']['style'] );

if ( $has_border_style ) {
$border_style = $attributes['style']['border']['style'];
$image_styles[] = sprintf( 'border-style: %s;', esc_attr( $border_style ) );
}

// Add border classes to the avatar image for both custom colors and palette colors.
$image_classes = '';
if ( $has_border_color || isset( $attributes['borderColor'] ) ) {
$image_classes .= 'has-border-color';
}
if ( isset( $attributes['borderColor'] ) ) {
$image_classes .= ' has-' . $attributes['borderColor'] . '-border-color';
}
// Unlike class, `get_avatar` doesn't filter the styles via `esc_attr`.
// The style engine does pass the border styles through
// `safecss_filter_attr` however.
$image_styles = ! empty( $border_attributes['style'] )
? sprintf( ' style="%s"', esc_attr( $border_attributes['style'] ) )
: '';

if ( ! isset( $block->context['commentId'] ) ) {
$author_id = isset( $attributes['userId'] ) ? $attributes['userId'] : get_post_field( 'post_author', $block->context['postId'] );
Expand All @@ -89,8 +41,8 @@ function render_block_core_avatar( $attributes, $content, $block ) {
'',
$alt,
array(
'extra_attr' => isset( $image_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $image_styles ) ) ) : '',
'class' => "wp-block-avatar__image $image_classes ",
'extra_attr' => $image_styles,
'class' => $image_classes,
)
);
if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
Expand All @@ -116,8 +68,8 @@ function render_block_core_avatar( $attributes, $content, $block ) {
'',
$alt,
array(
'extra_attr' => isset( $image_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $image_styles ) ) ) : '',
'class' => "wp-block-avatar__image $image_classes",
'extra_attr' => $image_styles,
'class' => $image_classes,
)
);
if ( isset( $attributes['isLink'] ) && $attributes['isLink'] && isset( $comment->comment_author_url ) && '' !== $comment->comment_author_url ) {
Expand All @@ -132,6 +84,58 @@ function render_block_core_avatar( $attributes, $content, $block ) {
return sprintf( '<div %1s>%2s</div>', $wrapper_attributes, $avatar_block );
}

/**
* Generates class names and styles to apply the border support styles for
* the Avatar block.
*
* @param array $attributes The block attributes.
* @return array The border-related classnames and styles for the block.
*/
function get_block_core_avatar_border_attributes( $attributes ) {
$border_styles = array();
$sides = array( 'top', 'right', 'bottom', 'left' );

// Border radius.
if ( isset( $attributes['style']['border']['radius'] ) ) {
$border_styles['radius'] = $attributes['style']['border']['radius'];
}

// Border style.
if ( isset( $attributes['style']['border']['style'] ) ) {
$border_styles['style'] = $attributes['style']['border']['style'];
}

// Border width.
if ( isset( $attributes['style']['border']['width'] ) ) {
$border_styles['width'] = $attributes['style']['border']['width'];
}

// Border color.
$preset_color = array_key_exists( 'borderColor', $attributes ) ? "var:preset|color|{$attributes['borderColor']}" : null;
$custom_color = _wp_array_get( $attributes, array( 'style', 'border', 'color' ), null );
$border_styles['color'] = $preset_color ? $preset_color : $custom_color;

// Individual border styles e.g. top, left etc.
foreach ( $sides as $side ) {
$border = _wp_array_get( $attributes, array( 'style', 'border', $side ), null );
$border_styles[ $side ] = array(
'color' => isset( $border['color'] ) ? $border['color'] : null,
'style' => isset( $border['style'] ) ? $border['style'] : null,
'width' => isset( $border['width'] ) ? $border['width'] : null,
);
}

$styles = wp_style_engine_get_styles( array( 'border' => $border_styles ) );
$attributes = array();
if ( ! empty( $styles['classnames'] ) ) {
$attributes['class'] = $styles['classnames'];
}
if ( ! empty( $styles['css'] ) ) {
$attributes['style'] = $styles['css'];
}
return $attributes;
}

/**
* Registers the `core/avatar` block on the server.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/blocks/avatar/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"apiVersion": 3,
"name": "core/avatar",
"title": "Avatar",
"category": "theme",
Expand Down Expand Up @@ -48,6 +48,6 @@
"__experimentalDuotone": "img"
}
},
"editorStyle": "wp-block-avatar",
"editorStyle": "wp-block-avatar-editor",
"style": "wp-block-avatar"
}
Loading