diff --git a/gutenberg.php b/gutenberg.php index c1ee01c8415522..6723ae3d58fc0c 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -5,7 +5,7 @@ * Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality. * Requires at least: 6.5 * Requires PHP: 7.2 - * Version: 19.5.0 + * Version: 19.6.0-rc.1 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/lib/compat/wordpress-6.7/blocks.php b/lib/compat/wordpress-6.7/blocks.php index 6b9526f8056fd3..1a8e7f5741c0a1 100644 --- a/lib/compat/wordpress-6.7/blocks.php +++ b/lib/compat/wordpress-6.7/blocks.php @@ -59,34 +59,46 @@ function gutenberg_add_format_query_vars_to_query_loop_block( $query, $block ) { return $query; } - $formats = $block->context['query']['format']; - $tax_query = array( 'relation' => 'OR' ); + $formats = $block->context['query']['format']; + /* + * Validate that the format is either `standard` or a supported post format. + * - First, add `standard` to the array of valid formats. + * - Then, remove any invalid formats. + */ + $valid_formats = array_merge( array( 'standard' ), get_post_format_slugs() ); + $formats = array_intersect( $formats, $valid_formats ); - // The default post format, 'standard', is not stored in the database. - // If 'standard' is part of the request, the query needs to exclude all post items that - // have a format assigned. + /* + * The relation needs to be set to `OR` since the request can contain + * two separate conditions. The user may be querying for items that have + * either the `standard` format or a specific format. + */ + $formats_query = array( 'relation' => 'OR' ); + + /* + * The default post format, `standard`, is not stored in the database. + * If `standard` is part of the request, the query needs to exclude all post items that + * have a format assigned. + */ if ( in_array( 'standard', $formats, true ) ) { - $tax_query[] = array( + $formats_query[] = array( 'taxonomy' => 'post_format', 'field' => 'slug', - 'terms' => array(), 'operator' => 'NOT EXISTS', ); - // Remove the standard format, since it cannot be queried. + // Remove the `standard` format, since it cannot be queried. unset( $formats[ array_search( 'standard', $formats, true ) ] ); } - - // Add any remaining formats to the tax query. + // Add any remaining formats to the formats query. if ( ! empty( $formats ) ) { - // Add the post-format- prefix. - $terms = array_map( + // Add the `post-format-` prefix. + $terms = array_map( static function ( $format ) { - return 'post-format-' . $format; + return "post-format-$format"; }, $formats ); - - $tax_query[] = array( + $formats_query[] = array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => $terms, @@ -94,10 +106,22 @@ static function ( $format ) { ); } - // This condition is intended to prevent $tax_query from being added to $query - // if it only contains the relation. - if ( count( $tax_query ) > 1 ) { - $query['tax_query'][] = $tax_query; + /* + * Add `$formats_query` to `$query`, as long as it contains more than one key: + * If `$formats_query` only contains the initial `relation` key, there are no valid formats to query, + * and the query should not be modified. + */ + if ( count( $formats_query ) > 1 ) { + // Enable filtering by both post formats and other taxonomies by combining them with `AND`. + if ( empty( $query['tax_query'] ) ) { + $query['tax_query'] = $formats_query; + } else { + $query['tax_query'] = array( + 'relation' => 'AND', + $query['tax_query'], + $formats_query, + ); + } } return $query; diff --git a/lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php b/lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php index c7de4371c94f56..5d3795cf68db76 100644 --- a/lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php +++ b/lib/compat/wordpress-6.7/class-gutenberg-rest-posts-controller-6-7.php @@ -157,34 +157,40 @@ public function get_items( $request ) { $args = $this->prepare_tax_query( $args, $request ); if ( ! empty( $request['format'] ) ) { - $formats = $request['format']; - $tax_query = array( 'relation' => 'OR' ); - - // The default post format, 'standard', is not stored in the database. - // If 'standard' is part of the request, the query needs to exclude all post items that - // have a format assigned. + $formats = $request['format']; + /* + * The relation needs to be set to `OR` since the request can contain + * two separate conditions. The user may be querying for items that have + * either the `standard` format or a specific format. + */ + $formats_query = array( 'relation' => 'OR' ); + + /* + * The default post format, `standard`, is not stored in the database. + * If `standard` is part of the request, the query needs to exclude all post items that + * have a format assigned. + */ if ( in_array( 'standard', $formats, true ) ) { - $tax_query[] = array( + $formats_query[] = array( 'taxonomy' => 'post_format', 'field' => 'slug', - 'terms' => array(), 'operator' => 'NOT EXISTS', ); - // Remove the standard format, since it cannot be queried. + // Remove the `standard` format, since it cannot be queried. unset( $formats[ array_search( 'standard', $formats, true ) ] ); } - // Add any remaining formats to the tax query. + // Add any remaining formats to the formats query. if ( ! empty( $formats ) ) { - // Add the post-format- prefix. + // Add the `post-format-` prefix. $terms = array_map( static function ( $format ) { - return 'post-format-' . $format; + return "post-format-$format"; }, $formats ); - $tax_query[] = array( + $formats_query[] = array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => $terms, @@ -192,14 +198,14 @@ static function ( $format ) { ); } - // Enable filtering by both post formats and other taxonomies by combining them with AND. + // Enable filtering by both post formats and other taxonomies by combining them with `AND`. if ( isset( $args['tax_query'] ) ) { $args['tax_query'][] = array( 'relation' => 'AND', - $tax_query, + $formats_query, ); } else { - $args['tax_query'] = $tax_query; + $args['tax_query'] = $formats_query; } } diff --git a/package-lock.json b/package-lock.json index c3ffa28d21f3bf..06a46df8855d94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gutenberg", - "version": "19.5.0", + "version": "19.6.0-rc.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gutenberg", - "version": "19.5.0", + "version": "19.6.0-rc.1", "hasInstallScript": true, "license": "GPL-2.0-or-later", "workspaces": [ @@ -51622,7 +51622,7 @@ }, "packages/a11y": { "name": "@wordpress/a11y", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51636,7 +51636,7 @@ }, "packages/annotations": { "name": "@wordpress/annotations", - "version": "3.10.0", + "version": "3.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51664,7 +51664,7 @@ }, "packages/api-fetch": { "name": "@wordpress/api-fetch", - "version": "7.10.0", + "version": "7.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -51678,7 +51678,7 @@ }, "packages/autop": { "name": "@wordpress/autop", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -51690,7 +51690,7 @@ }, "packages/babel-plugin-import-jsx-pragma": { "name": "@wordpress/babel-plugin-import-jsx-pragma", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -51702,7 +51702,7 @@ }, "packages/babel-plugin-makepot": { "name": "@wordpress/babel-plugin-makepot", - "version": "6.10.0", + "version": "6.11.0", "license": "GPL-2.0-or-later", "dependencies": { "deepmerge": "^4.3.0", @@ -51719,7 +51719,7 @@ }, "packages/babel-preset-default": { "name": "@wordpress/babel-preset-default", - "version": "8.10.0", + "version": "8.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/core": "7.25.7", @@ -52850,7 +52850,7 @@ }, "packages/base-styles": { "name": "@wordpress/base-styles", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -52859,7 +52859,7 @@ }, "packages/blob": { "name": "@wordpress/blob", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -52871,7 +52871,7 @@ }, "packages/block-directory": { "name": "@wordpress/block-directory", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -52907,7 +52907,7 @@ }, "packages/block-editor": { "name": "@wordpress/block-editor", - "version": "14.5.0", + "version": "14.6.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53006,7 +53006,7 @@ }, "packages/block-library": { "name": "@wordpress/block-library", - "version": "9.10.0", + "version": "9.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53072,7 +53072,7 @@ }, "packages/block-serialization-default-parser": { "name": "@wordpress/block-serialization-default-parser", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -53084,7 +53084,7 @@ }, "packages/block-serialization-spec-parser": { "name": "@wordpress/block-serialization-spec-parser", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "pegjs": "^0.10.0", @@ -53097,7 +53097,7 @@ }, "packages/blocks": { "name": "@wordpress/blocks", - "version": "13.10.0", + "version": "14.0.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53151,7 +53151,7 @@ }, "packages/browserslist-config": { "name": "@wordpress/browserslist-config", - "version": "6.10.0", + "version": "6.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -53160,7 +53160,7 @@ }, "packages/commands": { "name": "@wordpress/commands", - "version": "1.10.0", + "version": "1.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53399,7 +53399,7 @@ }, "packages/components": { "name": "@wordpress/components", - "version": "28.10.0", + "version": "28.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@ariakit/react": "^0.4.10", @@ -53520,7 +53520,7 @@ }, "packages/compose": { "name": "@wordpress/compose", - "version": "7.10.0", + "version": "7.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53557,7 +53557,7 @@ }, "packages/core-commands": { "name": "@wordpress/core-commands", - "version": "1.10.0", + "version": "1.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53586,7 +53586,7 @@ }, "packages/core-data": { "name": "@wordpress/core-data", - "version": "7.10.0", + "version": "7.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53631,7 +53631,7 @@ }, "packages/create-block": { "name": "@wordpress/create-block", - "version": "4.53.0", + "version": "4.54.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/lazy-import": "*", @@ -53658,7 +53658,7 @@ }, "packages/create-block-interactive-template": { "name": "@wordpress/create-block-interactive-template", - "version": "2.10.0", + "version": "2.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -53667,7 +53667,7 @@ }, "packages/create-block-tutorial-template": { "name": "@wordpress/create-block-tutorial-template", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -53676,7 +53676,7 @@ }, "packages/customize-widgets": { "name": "@wordpress/customize-widgets", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53715,7 +53715,7 @@ }, "packages/data": { "name": "@wordpress/data", - "version": "10.10.0", + "version": "10.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53744,7 +53744,7 @@ }, "packages/data-controls": { "name": "@wordpress/data-controls", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53762,7 +53762,7 @@ }, "packages/dataviews": { "name": "@wordpress/dataviews", - "version": "4.6.0", + "version": "4.7.0", "license": "GPL-2.0-or-later", "dependencies": { "@ariakit/react": "^0.4.10", @@ -53819,7 +53819,7 @@ }, "packages/date": { "name": "@wordpress/date", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53834,7 +53834,7 @@ }, "packages/dependency-extraction-webpack-plugin": { "name": "@wordpress/dependency-extraction-webpack-plugin", - "version": "6.10.0", + "version": "6.11.0", "license": "GPL-2.0-or-later", "dependencies": { "json2php": "^0.0.7" @@ -53849,7 +53849,7 @@ }, "packages/deprecated": { "name": "@wordpress/deprecated", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53862,7 +53862,7 @@ }, "packages/docgen": { "name": "@wordpress/docgen", - "version": "2.10.0", + "version": "2.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/core": "7.25.7", @@ -53883,7 +53883,7 @@ }, "packages/dom": { "name": "@wordpress/dom", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53896,7 +53896,7 @@ }, "packages/dom-ready": { "name": "@wordpress/dom-ready", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -53908,7 +53908,7 @@ }, "packages/e2e-test-utils": { "name": "@wordpress/e2e-test-utils", - "version": "11.10.0", + "version": "11.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -53930,7 +53930,7 @@ }, "packages/e2e-test-utils-playwright": { "name": "@wordpress/e2e-test-utils-playwright", - "version": "1.10.0", + "version": "1.11.0", "license": "GPL-2.0-or-later", "dependencies": { "change-case": "^4.1.2", @@ -53956,7 +53956,7 @@ }, "packages/e2e-tests": { "name": "@wordpress/e2e-tests", - "version": "8.10.1", + "version": "8.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/e2e-test-utils": "*", @@ -53994,7 +53994,7 @@ }, "packages/edit-post": { "name": "@wordpress/edit-post", - "version": "8.10.0", + "version": "8.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54041,7 +54041,7 @@ }, "packages/edit-site": { "name": "@wordpress/edit-site", - "version": "6.10.0", + "version": "6.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54104,7 +54104,7 @@ }, "packages/edit-widgets": { "name": "@wordpress/edit-widgets", - "version": "6.10.0", + "version": "6.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54148,7 +54148,7 @@ }, "packages/editor": { "name": "@wordpress/editor", - "version": "14.10.0", + "version": "14.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54210,7 +54210,7 @@ }, "packages/element": { "name": "@wordpress/element", - "version": "6.10.0", + "version": "6.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54229,7 +54229,7 @@ }, "packages/env": { "name": "@wordpress/env", - "version": "10.10.0", + "version": "10.11.0", "license": "GPL-2.0-or-later", "dependencies": { "chalk": "^4.0.0", @@ -54360,7 +54360,7 @@ }, "packages/escape-html": { "name": "@wordpress/escape-html", - "version": "3.10.0", + "version": "3.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -54372,7 +54372,7 @@ }, "packages/eslint-plugin": { "name": "@wordpress/eslint-plugin", - "version": "21.3.0", + "version": "21.4.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/eslint-parser": "7.25.7", @@ -54441,7 +54441,7 @@ }, "packages/fields": { "name": "@wordpress/fields", - "version": "0.2.0", + "version": "0.3.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54467,7 +54467,8 @@ "@wordpress/url": "*", "@wordpress/warning": "*", "change-case": "4.1.2", - "client-zip": "^2.4.5" + "client-zip": "^2.4.5", + "remove-accents": "^0.5.0" }, "engines": { "node": ">=18.12.0", @@ -54479,7 +54480,7 @@ }, "packages/format-library": { "name": "@wordpress/format-library", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54507,7 +54508,7 @@ }, "packages/hooks": { "name": "@wordpress/hooks", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -54519,7 +54520,7 @@ }, "packages/html-entities": { "name": "@wordpress/html-entities", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -54531,7 +54532,7 @@ }, "packages/i18n": { "name": "@wordpress/i18n", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54551,7 +54552,7 @@ }, "packages/icons": { "name": "@wordpress/icons", - "version": "10.10.0", + "version": "10.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54565,7 +54566,7 @@ }, "packages/interactivity": { "name": "@wordpress/interactivity", - "version": "6.10.0", + "version": "6.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@preact/signals": "^1.3.0", @@ -54578,7 +54579,7 @@ }, "packages/interactivity-router": { "name": "@wordpress/interactivity-router", - "version": "2.10.0", + "version": "2.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/a11y": "*", @@ -54591,7 +54592,7 @@ }, "packages/interface": { "name": "@wordpress/interface", - "version": "7.0.0", + "version": "8.0.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54619,7 +54620,7 @@ }, "packages/is-shallow-equal": { "name": "@wordpress/is-shallow-equal", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -54631,7 +54632,7 @@ }, "packages/jest-console": { "name": "@wordpress/jest-console", - "version": "8.10.0", + "version": "8.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54647,7 +54648,7 @@ }, "packages/jest-preset-default": { "name": "@wordpress/jest-preset-default", - "version": "12.10.0", + "version": "12.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/jest-console": "*", @@ -54664,7 +54665,7 @@ }, "packages/jest-puppeteer-axe": { "name": "@wordpress/jest-puppeteer-axe", - "version": "7.10.0", + "version": "7.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@axe-core/puppeteer": "^4.0.0", @@ -54686,7 +54687,7 @@ }, "packages/keyboard-shortcuts": { "name": "@wordpress/keyboard-shortcuts", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54704,7 +54705,7 @@ }, "packages/keycodes": { "name": "@wordpress/keycodes", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54717,7 +54718,7 @@ }, "packages/lazy-import": { "name": "@wordpress/lazy-import", - "version": "2.10.0", + "version": "2.11.0", "license": "GPL-2.0-or-later", "dependencies": { "execa": "^4.0.2", @@ -54731,7 +54732,7 @@ }, "packages/list-reusable-blocks": { "name": "@wordpress/list-reusable-blocks", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54754,7 +54755,7 @@ }, "packages/media-utils": { "name": "@wordpress/media-utils", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54770,7 +54771,7 @@ }, "packages/notices": { "name": "@wordpress/notices", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54787,7 +54788,7 @@ }, "packages/npm-package-json-lint-config": { "name": "@wordpress/npm-package-json-lint-config", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -54799,7 +54800,7 @@ }, "packages/nux": { "name": "@wordpress/nux", - "version": "9.10.0", + "version": "9.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54822,7 +54823,7 @@ }, "packages/patterns": { "name": "@wordpress/patterns", - "version": "2.10.0", + "version": "2.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54852,7 +54853,7 @@ }, "packages/plugins": { "name": "@wordpress/plugins", - "version": "7.10.0", + "version": "7.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54876,7 +54877,7 @@ }, "packages/postcss-plugins-preset": { "name": "@wordpress/postcss-plugins-preset", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/base-styles": "*", @@ -54892,7 +54893,7 @@ }, "packages/postcss-themes": { "name": "@wordpress/postcss-themes", - "version": "6.10.0", + "version": "6.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -54904,7 +54905,7 @@ }, "packages/preferences": { "name": "@wordpress/preferences", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54930,7 +54931,7 @@ }, "packages/preferences-persistence": { "name": "@wordpress/preferences-persistence", - "version": "2.10.0", + "version": "2.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54943,7 +54944,7 @@ }, "packages/prettier-config": { "name": "@wordpress/prettier-config", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -54955,7 +54956,7 @@ }, "packages/primitives": { "name": "@wordpress/primitives", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54972,7 +54973,7 @@ }, "packages/priority-queue": { "name": "@wordpress/priority-queue", - "version": "3.10.0", + "version": "3.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -54985,7 +54986,7 @@ }, "packages/private-apis": { "name": "@wordpress/private-apis", - "version": "1.10.0", + "version": "1.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -54997,7 +54998,7 @@ }, "packages/project-management-automation": { "name": "@wordpress/project-management-automation", - "version": "2.10.0", + "version": "2.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@actions/core": "1.9.1", @@ -55025,7 +55026,7 @@ }, "packages/react-i18n": { "name": "@wordpress/react-i18n", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55181,7 +55182,7 @@ }, "packages/readable-js-assets-webpack-plugin": { "name": "@wordpress/readable-js-assets-webpack-plugin", - "version": "3.10.0", + "version": "3.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -55193,7 +55194,7 @@ }, "packages/redux-routine": { "name": "@wordpress/redux-routine", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55236,7 +55237,7 @@ }, "packages/reusable-blocks": { "name": "@wordpress/reusable-blocks", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55263,7 +55264,7 @@ }, "packages/rich-text": { "name": "@wordpress/rich-text", - "version": "7.10.0", + "version": "7.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55287,7 +55288,7 @@ }, "packages/router": { "name": "@wordpress/router", - "version": "1.10.0", + "version": "1.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55306,7 +55307,7 @@ }, "packages/scripts": { "name": "@wordpress/scripts", - "version": "30.3.0", + "version": "30.4.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/core": "7.25.7", @@ -55740,7 +55741,7 @@ }, "packages/server-side-render": { "name": "@wordpress/server-side-render", - "version": "5.10.0", + "version": "5.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55766,7 +55767,7 @@ }, "packages/shortcode": { "name": "@wordpress/shortcode", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55779,7 +55780,7 @@ }, "packages/style-engine": { "name": "@wordpress/style-engine", - "version": "2.10.0", + "version": "2.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55792,7 +55793,7 @@ }, "packages/stylelint-config": { "name": "@wordpress/stylelint-config", - "version": "23.2.0", + "version": "23.3.0", "license": "MIT", "dependencies": { "@stylistic/stylelint-plugin": "^3.0.1", @@ -55903,7 +55904,7 @@ }, "packages/sync": { "name": "@wordpress/sync", - "version": "1.10.0", + "version": "1.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55924,7 +55925,7 @@ }, "packages/token-list": { "name": "@wordpress/token-list", - "version": "3.10.0", + "version": "3.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" @@ -55936,7 +55937,7 @@ }, "packages/undo-manager": { "name": "@wordpress/undo-manager", - "version": "1.10.0", + "version": "1.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55949,7 +55950,7 @@ }, "packages/url": { "name": "@wordpress/url", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55962,7 +55963,7 @@ }, "packages/viewport": { "name": "@wordpress/viewport", - "version": "6.10.0", + "version": "6.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -55992,7 +55993,7 @@ }, "packages/warning": { "name": "@wordpress/warning", - "version": "3.10.0", + "version": "3.11.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -56001,7 +56002,7 @@ }, "packages/widgets": { "name": "@wordpress/widgets", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7", @@ -56029,7 +56030,7 @@ }, "packages/wordcount": { "name": "@wordpress/wordcount", - "version": "4.10.0", + "version": "4.11.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "7.25.7" diff --git a/package.json b/package.json index 06a73c51cc940d..32c6f01b80c4ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "19.5.0", + "version": "19.6.0-rc.1", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", diff --git a/packages/a11y/CHANGELOG.md b/packages/a11y/CHANGELOG.md index 08ac31b560ca87..5e90577e9155ab 100644 --- a/packages/a11y/CHANGELOG.md +++ b/packages/a11y/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.11.0 (2024-10-30) + ## 4.10.0 (2024-10-16) ## 4.9.0 (2024-10-03) diff --git a/packages/a11y/package.json b/packages/a11y/package.json index a506cb940e7765..09fa62a9d082b7 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/a11y", - "version": "4.10.0", + "version": "4.11.0", "description": "Accessibility (a11y) utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/annotations/CHANGELOG.md b/packages/annotations/CHANGELOG.md index 0f4795b11f109a..0618f4962f5eb5 100644 --- a/packages/annotations/CHANGELOG.md +++ b/packages/annotations/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.11.0 (2024-10-30) + ## 3.10.0 (2024-10-16) ## 3.9.0 (2024-10-03) diff --git a/packages/annotations/package.json b/packages/annotations/package.json index 4a1f0fe2b771b5..8a94b326a78194 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/annotations", - "version": "3.10.0", + "version": "3.11.0", "description": "Annotate content in the Gutenberg editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/api-fetch/CHANGELOG.md b/packages/api-fetch/CHANGELOG.md index dc654223da9e9f..8d3faea535faf3 100644 --- a/packages/api-fetch/CHANGELOG.md +++ b/packages/api-fetch/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.11.0 (2024-10-30) + ## 7.10.0 (2024-10-16) ## 7.9.0 (2024-10-03) diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json index 79968c31d1043a..26f156a0aa7d77 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/api-fetch", - "version": "7.10.0", + "version": "7.11.0", "description": "Utility to make WordPress REST API requests.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/autop/CHANGELOG.md b/packages/autop/CHANGELOG.md index 0a4a27cfbed808..9534b183d6ebb1 100644 --- a/packages/autop/CHANGELOG.md +++ b/packages/autop/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.11.0 (2024-10-30) + ## 4.10.0 (2024-10-16) ## 4.9.0 (2024-10-03) diff --git a/packages/autop/package.json b/packages/autop/package.json index aea14b2c666e14..2169ff828da47a 100644 --- a/packages/autop/package.json +++ b/packages/autop/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/autop", - "version": "4.10.0", + "version": "4.11.0", "description": "WordPress's automatic paragraph functions `autop` and `removep`.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md index 6935957675b432..87bc412fd90eb3 100644 --- a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md +++ b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.11.0 (2024-10-30) + ## 5.10.0 (2024-10-16) ## 5.9.0 (2024-10-03) diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json index be9dbe0b0fe099..d9b565b4e27ec0 100644 --- a/packages/babel-plugin-import-jsx-pragma/package.json +++ b/packages/babel-plugin-import-jsx-pragma/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-plugin-import-jsx-pragma", - "version": "5.10.0", + "version": "5.11.0", "description": "Babel transform plugin for automatically injecting an import to be used as the pragma for the React JSX Transform plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-plugin-makepot/CHANGELOG.md b/packages/babel-plugin-makepot/CHANGELOG.md index 7fbb829d65a842..f643a9304c68ab 100644 --- a/packages/babel-plugin-makepot/CHANGELOG.md +++ b/packages/babel-plugin-makepot/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.11.0 (2024-10-30) + ## 6.10.0 (2024-10-16) ## 6.9.0 (2024-10-03) diff --git a/packages/babel-plugin-makepot/package.json b/packages/babel-plugin-makepot/package.json index f88a5257b24c8f..cf04d3dc72e409 100644 --- a/packages/babel-plugin-makepot/package.json +++ b/packages/babel-plugin-makepot/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-plugin-makepot", - "version": "6.10.0", + "version": "6.11.0", "description": "WordPress Babel internationalization (i18n) plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-preset-default/CHANGELOG.md b/packages/babel-preset-default/CHANGELOG.md index c787e176059298..d6eef13b90d456 100644 --- a/packages/babel-preset-default/CHANGELOG.md +++ b/packages/babel-preset-default/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 8.11.0 (2024-10-30) + ## 8.10.0 (2024-10-16) ### Enhancements diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json index 777a40012d67f7..2f727d1886425d 100644 --- a/packages/babel-preset-default/package.json +++ b/packages/babel-preset-default/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-preset-default", - "version": "8.10.0", + "version": "8.11.0", "description": "Default Babel preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/base-styles/CHANGELOG.md b/packages/base-styles/CHANGELOG.md index 7535112c5a5c11..61ff1100ac6453 100644 --- a/packages/base-styles/CHANGELOG.md +++ b/packages/base-styles/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.11.0 (2024-10-30) + ## 5.10.0 (2024-10-16) ## 5.9.0 (2024-10-03) diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json index 04d1bb5e2d41ba..7246dc83eaf4c6 100644 --- a/packages/base-styles/package.json +++ b/packages/base-styles/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/base-styles", - "version": "5.10.0", + "version": "5.11.0", "description": "Base SCSS utilities and variables for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blob/CHANGELOG.md b/packages/blob/CHANGELOG.md index c168f9698e68bd..660c60776c7bd1 100644 --- a/packages/blob/CHANGELOG.md +++ b/packages/blob/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.11.0 (2024-10-30) + ## 4.10.0 (2024-10-16) ## 4.9.0 (2024-10-03) diff --git a/packages/blob/package.json b/packages/blob/package.json index 183e6aca33dc0c..4b04d2ea2ddebd 100644 --- a/packages/blob/package.json +++ b/packages/blob/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blob", - "version": "4.10.0", + "version": "4.11.0", "description": "Blob utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-directory/CHANGELOG.md b/packages/block-directory/CHANGELOG.md index 7c2e092139b0ee..53636f34dad586 100644 --- a/packages/block-directory/CHANGELOG.md +++ b/packages/block-directory/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.11.0 (2024-10-30) + ## 5.10.0 (2024-10-16) ## 5.9.0 (2024-10-03) diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index 6ff9ad7d510861..59025e1ad45c7a 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "5.10.0", + "version": "5.11.0", "description": "Extend editor with block directory features to search, download and install blocks.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-editor/CHANGELOG.md b/packages/block-editor/CHANGELOG.md index 1483fe1da9d5c9..6755c4ec83f215 100644 --- a/packages/block-editor/CHANGELOG.md +++ b/packages/block-editor/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 14.6.0 (2024-10-30) + ## 14.5.0 (2024-10-16) ## 14.4.0 (2024-10-03) diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index b798e626c2e90f..2b5cc8d6275e89 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-editor", - "version": "14.5.0", + "version": "14.6.0", "description": "Generic block editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md index b3788917cfbb95..4b5cf59f81910d 100644 --- a/packages/block-library/CHANGELOG.md +++ b/packages/block-library/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 9.11.0 (2024-10-30) + ## 9.10.0 (2024-10-16) ## 9.9.0 (2024-10-03) diff --git a/packages/block-library/package.json b/packages/block-library/package.json index 18ad0e46059c91..2c880301c8355d 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-library", - "version": "9.10.0", + "version": "9.11.0", "description": "Block library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-serialization-default-parser/CHANGELOG.md b/packages/block-serialization-default-parser/CHANGELOG.md index 9b0457333bd7d5..5911f22795d463 100644 --- a/packages/block-serialization-default-parser/CHANGELOG.md +++ b/packages/block-serialization-default-parser/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.11.0 (2024-10-30) + ## 5.10.0 (2024-10-16) ## 5.9.0 (2024-10-03) diff --git a/packages/block-serialization-default-parser/package.json b/packages/block-serialization-default-parser/package.json index 14d2db0f688688..d31ab188c0b6d6 100644 --- a/packages/block-serialization-default-parser/package.json +++ b/packages/block-serialization-default-parser/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-serialization-default-parser", - "version": "5.10.0", + "version": "5.11.0", "description": "Block serialization specification parser for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-serialization-spec-parser/CHANGELOG.md b/packages/block-serialization-spec-parser/CHANGELOG.md index 40c93063cafbb7..1833dff1e52c83 100644 --- a/packages/block-serialization-spec-parser/CHANGELOG.md +++ b/packages/block-serialization-spec-parser/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.11.0 (2024-10-30) + ## 5.10.0 (2024-10-16) ## 5.9.0 (2024-10-03) diff --git a/packages/block-serialization-spec-parser/package.json b/packages/block-serialization-spec-parser/package.json index 9a871250162ca0..7cca4a7ca1a68b 100644 --- a/packages/block-serialization-spec-parser/package.json +++ b/packages/block-serialization-spec-parser/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-serialization-spec-parser", - "version": "5.10.0", + "version": "5.11.0", "description": "Block serialization specification parser for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blocks/CHANGELOG.md b/packages/blocks/CHANGELOG.md index eebbe7148e8055..54fc6f77a7427d 100644 --- a/packages/blocks/CHANGELOG.md +++ b/packages/blocks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 14.0.0 (2024-10-30) + ### Breaking changes - Normalize `blockType.parent` to be an array. While string values were never supported, they appeared to work with some unintended side-effects that have been fixed by [#66250](https://github.com/WordPress/gutenberg/pull/66250). For that reason, we've added some code that automatically migrates strings to arrays — though it still raises a warning. diff --git a/packages/blocks/package.json b/packages/blocks/package.json index d7207548d173fc..2d944fe656363b 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blocks", - "version": "13.10.0", + "version": "14.0.0", "description": "Block API for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/browserslist-config/CHANGELOG.md b/packages/browserslist-config/CHANGELOG.md index 8a2dc5d0ecc484..1ef626d40ef832 100644 --- a/packages/browserslist-config/CHANGELOG.md +++ b/packages/browserslist-config/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.11.0 (2024-10-30) + ## 6.10.0 (2024-10-16) ## 6.9.0 (2024-10-03) diff --git a/packages/browserslist-config/package.json b/packages/browserslist-config/package.json index 8b19151e950475..65bc5231f0651b 100644 --- a/packages/browserslist-config/package.json +++ b/packages/browserslist-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/browserslist-config", - "version": "6.10.0", + "version": "6.11.0", "description": "WordPress Browserslist shared configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/commands/CHANGELOG.md b/packages/commands/CHANGELOG.md index c75dbab26739d8..2ec9f745b774fd 100644 --- a/packages/commands/CHANGELOG.md +++ b/packages/commands/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.11.0 (2024-10-30) + ## 1.10.0 (2024-10-16) ## 1.9.0 (2024-10-03) diff --git a/packages/commands/package.json b/packages/commands/package.json index 4d35172ce8186d..98eadca595ca86 100644 --- a/packages/commands/package.json +++ b/packages/commands/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/commands", - "version": "1.10.0", + "version": "1.11.0", "description": "Handles the commands menu.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 9603d9656d5069..9c085abdae98c9 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 28.11.0 (2024-10-30) + ### Deprecations - `BorderBoxControl`: Deprecate 36px default size ([#65752](https://github.com/WordPress/gutenberg/pull/65752)). diff --git a/packages/components/package.json b/packages/components/package.json index a44e0afe89152b..faf923ad426bf6 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/components", - "version": "28.10.0", + "version": "28.11.0", "description": "UI components for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/compose/CHANGELOG.md b/packages/compose/CHANGELOG.md index f9d18eed43141d..8f8bedfde15d4a 100644 --- a/packages/compose/CHANGELOG.md +++ b/packages/compose/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.11.0 (2024-10-30) + ## 7.10.0 (2024-10-16) ## 7.9.0 (2024-10-03) diff --git a/packages/compose/package.json b/packages/compose/package.json index f7aa8a3bf9b3bc..adff24f6663006 100644 --- a/packages/compose/package.json +++ b/packages/compose/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/compose", - "version": "7.10.0", + "version": "7.11.0", "description": "WordPress higher-order components (HOCs).", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/core-commands/CHANGELOG.md b/packages/core-commands/CHANGELOG.md index 83b809ad526302..b98e0c55e24ff5 100644 --- a/packages/core-commands/CHANGELOG.md +++ b/packages/core-commands/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.11.0 (2024-10-30) + ## 1.10.0 (2024-10-16) ## 1.9.0 (2024-10-03) diff --git a/packages/core-commands/package.json b/packages/core-commands/package.json index adad0ee55afc23..ac15b3578cf6ff 100644 --- a/packages/core-commands/package.json +++ b/packages/core-commands/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-commands", - "version": "1.10.0", + "version": "1.11.0", "description": "WordPress core reusable commands.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/core-data/CHANGELOG.md b/packages/core-data/CHANGELOG.md index 980f552ee0fca7..31b44fa32dd0a4 100644 --- a/packages/core-data/CHANGELOG.md +++ b/packages/core-data/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.11.0 (2024-10-30) + ## 7.10.0 (2024-10-16) ## 7.9.0 (2024-10-03) diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 6b70fb0af3a8f4..44ed3aaad5dd3a 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-data", - "version": "7.10.0", + "version": "7.11.0", "description": "Access to and manipulation of core WordPress entities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/core-data/src/actions.js b/packages/core-data/src/actions.js index e83ad02828cfe7..13cbba39e11765 100644 --- a/packages/core-data/src/actions.js +++ b/packages/core-data/src/actions.js @@ -16,7 +16,7 @@ import deprecated from '@wordpress/deprecated'; */ import { getNestedValue, setNestedValue } from './utils'; import { receiveItems, removeItems, receiveQueriedItems } from './queried-data'; -import { getOrLoadEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities'; +import { DEFAULT_ENTITY_KEY } from './entities'; import { createBatch } from './batch'; import { STORE_NAME } from './name'; import { getSyncProvider } from './sync'; @@ -285,8 +285,8 @@ export const deleteEntityRecord = query, { __unstableFetch = apiFetch, throwOnError = false } = {} ) => - async ( { dispatch } ) => { - const configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) ); + async ( { dispatch, resolveSelect } ) => { + const configs = await resolveSelect.getEntitiesConfig( kind ); const entityConfig = configs.find( ( config ) => config.kind === kind && config.name === name ); @@ -503,7 +503,7 @@ export const saveEntityRecord = } = {} ) => async ( { select, resolveSelect, dispatch } ) => { - const configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) ); + const configs = await resolveSelect.getEntitiesConfig( kind ); const entityConfig = configs.find( ( config ) => config.kind === kind && config.name === name ); @@ -780,11 +780,11 @@ export const __experimentalBatch = */ export const saveEditedEntityRecord = ( kind, name, recordId, options ) => - async ( { select, dispatch } ) => { + async ( { select, dispatch, resolveSelect } ) => { if ( ! select.hasEditsForEntityRecord( kind, name, recordId ) ) { return; } - const configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) ); + const configs = await resolveSelect.getEntitiesConfig( kind ); const entityConfig = configs.find( ( config ) => config.kind === kind && config.name === name ); @@ -813,7 +813,7 @@ export const saveEditedEntityRecord = */ export const __experimentalSaveSpecifiedEntityEdits = ( kind, name, recordId, itemsToSave, options ) => - async ( { select, dispatch } ) => { + async ( { select, dispatch, resolveSelect } ) => { if ( ! select.hasEditsForEntityRecord( kind, name, recordId ) ) { return; } @@ -828,7 +828,7 @@ export const __experimentalSaveSpecifiedEntityEdits = setNestedValue( editsToSave, item, getNestedValue( edits, item ) ); } - const configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) ); + const configs = await resolveSelect.getEntitiesConfig( kind ); const entityConfig = configs.find( ( config ) => config.kind === kind && config.name === name ); @@ -973,8 +973,8 @@ export function receiveDefaultTemplateId( query, templateId ) { */ export const receiveRevisions = ( kind, name, recordKey, records, query, invalidateCache = false, meta ) => - async ( { dispatch } ) => { - const configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) ); + async ( { dispatch, resolveSelect } ) => { + const configs = await resolveSelect.getEntitiesConfig( kind ); const entityConfig = configs.find( ( config ) => config.kind === kind && config.name === name ); diff --git a/packages/core-data/src/entities.js b/packages/core-data/src/entities.js index 8d09402087cf90..f73239e9afbbe5 100644 --- a/packages/core-data/src/entities.js +++ b/packages/core-data/src/entities.js @@ -10,14 +10,7 @@ import apiFetch from '@wordpress/api-fetch'; import { __ } from '@wordpress/i18n'; import { RichTextData } from '@wordpress/rich-text'; -/** - * Internal dependencies - */ -import { addEntities } from './actions'; -import { getSyncProvider } from './sync'; - export const DEFAULT_ENTITY_KEY = 'id'; - const POST_RAW_ATTRIBUTES = [ 'title', 'excerpt', 'content' ]; export const rootEntitiesConfig = [ @@ -458,60 +451,3 @@ export const getMethodName = ( kind, name, prefix = 'get' ) => { const suffix = pascalCase( name ); return `${ prefix }${ kindPrefix }${ suffix }`; }; - -function registerSyncConfigs( configs ) { - configs.forEach( ( { syncObjectType, syncConfig } ) => { - getSyncProvider().register( syncObjectType, syncConfig ); - const editSyncConfig = { ...syncConfig }; - delete editSyncConfig.fetch; - getSyncProvider().register( syncObjectType + '--edit', editSyncConfig ); - } ); -} - -/** - * Loads the entities into the store. - * - * Note: The `name` argument is used for `root` entities requiring additional server data. - * - * @param {string} kind Kind - * @param {string} name Name - * @return {(thunkArgs: object) => Promise} Entities - */ -export const getOrLoadEntitiesConfig = - ( kind, name ) => - async ( { select, dispatch } ) => { - let configs = select.getEntitiesConfig( kind ); - const hasConfig = !! select.getEntityConfig( kind, name ); - - if ( configs?.length > 0 && hasConfig ) { - if ( window.__experimentalEnableSync ) { - if ( globalThis.IS_GUTENBERG_PLUGIN ) { - registerSyncConfigs( configs ); - } - } - - return configs; - } - - const loader = additionalEntityConfigLoaders.find( ( l ) => { - if ( ! name || ! l.name ) { - return l.kind === kind; - } - - return l.kind === kind && l.name === name; - } ); - if ( ! loader ) { - return []; - } - - configs = await loader.loadEntities(); - if ( window.__experimentalEnableSync ) { - if ( globalThis.IS_GUTENBERG_PLUGIN ) { - registerSyncConfigs( configs ); - } - } - - dispatch( addEntities( configs ) ); - - return configs; - }; diff --git a/packages/core-data/src/hooks/test/use-entity-record.js b/packages/core-data/src/hooks/test/use-entity-record.js index d83957abe06a1b..ac2b547cd9c61a 100644 --- a/packages/core-data/src/hooks/test/use-entity-record.js +++ b/packages/core-data/src/hooks/test/use-entity-record.js @@ -140,7 +140,14 @@ describe( 'useEntityRecord', () => { await act( () => new Promise( ( resolve ) => setTimeout( resolve, 0 ) ) ); - expect( triggerFetch ).toHaveBeenCalledTimes( 1 ); + await waitFor( () => + expect( triggerFetch ).toHaveBeenCalledWith( { + path: '/wp/v2/widgets/1?context=edit', + parse: false, + } ) + ); + // Clear the fetch call history. + triggerFetch.mockReset(); rerender( ); @@ -157,6 +164,6 @@ describe( 'useEntityRecord', () => { await act( () => new Promise( ( resolve ) => setTimeout( resolve, 0 ) ) ); - expect( triggerFetch ).toHaveBeenCalledTimes( 1 ); + expect( triggerFetch ).toHaveBeenCalledTimes( 0 ); } ); } ); diff --git a/packages/core-data/src/resolvers.js b/packages/core-data/src/resolvers.js index a5c33e18efbc60..d3980b89e8fc5b 100644 --- a/packages/core-data/src/resolvers.js +++ b/packages/core-data/src/resolvers.js @@ -14,7 +14,7 @@ import apiFetch from '@wordpress/api-fetch'; * Internal dependencies */ import { STORE_NAME } from './name'; -import { getOrLoadEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities'; +import { additionalEntityConfigLoaders, DEFAULT_ENTITY_KEY } from './entities'; import { forwardResolver, getNormalizedCommaSeparable, @@ -64,8 +64,8 @@ export const getCurrentUser = */ export const getEntityRecord = ( kind, name, key = '', query ) => - async ( { select, dispatch, registry } ) => { - const configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) ); + async ( { select, dispatch, registry, resolveSelect } ) => { + const configs = await resolveSelect.getEntitiesConfig( kind ); const entityConfig = configs.find( ( config ) => config.name === name && config.kind === kind ); @@ -230,8 +230,8 @@ export const getEditedEntityRecord = forwardResolver( 'getEntityRecord' ); */ export const getEntityRecords = ( kind, name, query = {} ) => - async ( { dispatch, registry } ) => { - const configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) ); + async ( { dispatch, registry, resolveSelect } ) => { + const configs = await resolveSelect.getEntitiesConfig( kind ); const entityConfig = configs.find( ( config ) => config.name === name && config.kind === kind ); @@ -431,19 +431,36 @@ export const getEmbedPreview = */ export const canUser = ( requestedAction, resource, id ) => - async ( { dispatch, registry } ) => { + async ( { dispatch, registry, resolveSelect } ) => { if ( ! ALLOWED_RESOURCE_ACTIONS.includes( requestedAction ) ) { throw new Error( `'${ requestedAction }' is not a valid action.` ); } + const { hasStartedResolution } = registry.select( STORE_NAME ); + + // Prevent resolving the same resource twice. + for ( const relatedAction of ALLOWED_RESOURCE_ACTIONS ) { + if ( relatedAction === requestedAction ) { + continue; + } + const isAlreadyResolving = hasStartedResolution( 'canUser', [ + relatedAction, + resource, + id, + ] ); + if ( isAlreadyResolving ) { + return; + } + } + let resourcePath = null; if ( typeof resource === 'object' ) { if ( ! resource.kind || ! resource.name ) { throw new Error( 'The entity resource object is not valid.' ); } - const configs = await dispatch( - getOrLoadEntitiesConfig( resource.kind, resource.name ) + const configs = await resolveSelect.getEntitiesConfig( + resource.kind ); const entityConfig = configs.find( ( config ) => @@ -460,23 +477,6 @@ export const canUser = resourcePath = `/wp/v2/${ resource }` + ( id ? '/' + id : '' ); } - const { hasStartedResolution } = registry.select( STORE_NAME ); - - // Prevent resolving the same resource twice. - for ( const relatedAction of ALLOWED_RESOURCE_ACTIONS ) { - if ( relatedAction === requestedAction ) { - continue; - } - const isAlreadyResolving = hasStartedResolution( 'canUser', [ - relatedAction, - resource, - id, - ] ); - if ( isAlreadyResolving ) { - return; - } - } - let response; try { response = await apiFetch( { @@ -823,8 +823,8 @@ export const getDefaultTemplateId = */ export const getRevisions = ( kind, name, recordKey, query = {} ) => - async ( { dispatch, registry } ) => { - const configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) ); + async ( { dispatch, registry, resolveSelect } ) => { + const configs = await resolveSelect.getEntitiesConfig( kind ); const entityConfig = configs.find( ( config ) => config.name === name && config.kind === kind ); @@ -944,8 +944,8 @@ getRevisions.shouldInvalidate = ( action, kind, name, recordKey ) => */ export const getRevision = ( kind, name, recordKey, revisionKey, query ) => - async ( { dispatch } ) => { - const configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) ); + async ( { dispatch, resolveSelect } ) => { + const configs = await resolveSelect.getEntitiesConfig( kind ); const entityConfig = configs.find( ( config ) => config.name === name && config.kind === kind ); @@ -1017,3 +1017,31 @@ export const getRegisteredPostMeta = ); } }; + +/** + * Requests entity configs for the given kind from the REST API. + * + * @param {string} kind Entity kind. + */ +export const getEntitiesConfig = + ( kind ) => + async ( { dispatch } ) => { + const loader = additionalEntityConfigLoaders.find( + ( l ) => l.kind === kind + ); + + if ( ! loader ) { + return; + } + + try { + const configs = await loader.loadEntities(); + if ( ! configs.length ) { + return; + } + + dispatch.addEntities( configs ); + } catch { + // Do nothing if the request comes back with an API error. + } + }; diff --git a/packages/core-data/src/test/actions.js b/packages/core-data/src/test/actions.js index c00c01fbb77a17..8438d03293c164 100644 --- a/packages/core-data/src/test/actions.js +++ b/packages/core-data/src/test/actions.js @@ -68,8 +68,7 @@ describe( 'deleteEntityRecord', () => { __unstableAcquireStoreLock: jest.fn(), __unstableReleaseStoreLock: jest.fn(), } ); - // Provide entities - dispatch.mockReturnValueOnce( configs ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => configs ) }; // Provide response apiFetch.mockImplementation( () => deletedRecord ); @@ -78,7 +77,7 @@ describe( 'deleteEntityRecord', () => { 'postType', 'post', deletedRecord.id - )( { dispatch } ); + )( { dispatch, resolveSelect } ); expect( apiFetch ).toHaveBeenCalledTimes( 1 ); expect( apiFetch ).toHaveBeenCalledWith( { @@ -86,7 +85,7 @@ describe( 'deleteEntityRecord', () => { method: 'DELETE', } ); - expect( dispatch ).toHaveBeenCalledTimes( 4 ); + expect( dispatch ).toHaveBeenCalledTimes( 3 ); expect( dispatch ).toHaveBeenCalledWith( { type: 'DELETE_ENTITY_RECORD_START', kind: 'postType', @@ -120,8 +119,7 @@ describe( 'deleteEntityRecord', () => { __unstableAcquireStoreLock: jest.fn(), __unstableReleaseStoreLock: jest.fn(), } ); - // Provide entities - dispatch.mockReturnValueOnce( entities ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => entities ) }; // Provide response apiFetch.mockImplementation( () => { @@ -137,7 +135,7 @@ describe( 'deleteEntityRecord', () => { { throwOnError: true, } - )( { dispatch } ) + )( { dispatch, resolveSelect } ) ).rejects.toEqual( new Error( 'API error' ) ); } ); @@ -151,8 +149,7 @@ describe( 'deleteEntityRecord', () => { __unstableAcquireStoreLock: jest.fn(), __unstableReleaseStoreLock: jest.fn(), } ); - // Provide entities - dispatch.mockReturnValueOnce( entities ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => entities ) }; // Provide response apiFetch.mockImplementation( () => { @@ -168,7 +165,7 @@ describe( 'deleteEntityRecord', () => { { throwOnError: false, } - )( { dispatch } ) + )( { dispatch, resolveSelect } ) ).resolves.toBe( false ); } ); } ); @@ -195,8 +192,7 @@ describe( 'saveEditedEntityRecord', () => { const dispatch = Object.assign( jest.fn(), { saveEntityRecord: jest.fn(), } ); - // Provide entities - dispatch.mockReturnValueOnce( configs ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => configs ) }; // Provide response const updatedRecord = { ...item, menu: 10 }; @@ -208,7 +204,7 @@ describe( 'saveEditedEntityRecord', () => { 'root', 'menuItem', 1 - )( { dispatch, select } ); + )( { dispatch, select, resolveSelect } ); expect( dispatch.saveEntityRecord ).toHaveBeenCalledWith( 'root', @@ -236,8 +232,7 @@ describe( 'saveEditedEntityRecord', () => { const dispatch = Object.assign( jest.fn(), { saveEntityRecord: jest.fn(), } ); - // Provide entities - dispatch.mockReturnValueOnce( configs ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => configs ) }; // Provide response const updatedRecord = { ...item, menu: 10 }; @@ -249,7 +244,7 @@ describe( 'saveEditedEntityRecord', () => { 'root', 'menuLocation', 'primary' - )( { dispatch, select } ); + )( { dispatch, select, resolveSelect } ); expect( dispatch.saveEntityRecord ).toHaveBeenCalledWith( 'root', @@ -280,9 +275,7 @@ describe( 'saveEntityRecord', () => { const select = { getRawEntityRecord: () => post, }; - - // Provide entities - dispatch.mockReturnValueOnce( configs ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => configs ) }; // Provide response const updatedRecord = { ...post, id: 10 }; @@ -294,7 +287,7 @@ describe( 'saveEntityRecord', () => { 'postType', 'post', post - )( { select, dispatch } ); + )( { select, dispatch, resolveSelect } ); expect( apiFetch ).toHaveBeenCalledTimes( 1 ); expect( apiFetch ).toHaveBeenCalledWith( { @@ -303,7 +296,7 @@ describe( 'saveEntityRecord', () => { data: post, } ); - expect( dispatch ).toHaveBeenCalledTimes( 3 ); + expect( dispatch ).toHaveBeenCalledTimes( 2 ); expect( dispatch ).toHaveBeenCalledWith( { type: 'SAVE_ENTITY_RECORD_START', kind: 'postType', @@ -347,9 +340,7 @@ describe( 'saveEntityRecord', () => { const select = { getRawEntityRecord: () => post, }; - - // Provide entities - dispatch.mockReturnValueOnce( entities ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => entities ) }; // Provide response apiFetch.mockImplementation( () => { @@ -359,7 +350,7 @@ describe( 'saveEntityRecord', () => { await expect( saveEntityRecord( 'postType', 'post', post, { throwOnError: true, - } )( { select, dispatch } ) + } )( { select, dispatch, resolveSelect } ) ).rejects.toEqual( new Error( 'API error' ) ); } ); @@ -371,9 +362,7 @@ describe( 'saveEntityRecord', () => { const select = { getRawEntityRecord: () => post, }; - - // Provide entities - dispatch.mockReturnValueOnce( entities ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => entities ) }; // Provide response apiFetch.mockImplementation( () => { @@ -383,7 +372,7 @@ describe( 'saveEntityRecord', () => { await expect( saveEntityRecord( 'postType', 'post', post, { throwOnError: false, - } )( { select, dispatch } ) + } )( { select, dispatch, resolveSelect } ) ).resolves.toEqual( undefined ); } ); @@ -395,9 +384,7 @@ describe( 'saveEntityRecord', () => { const select = { getRawEntityRecord: () => post, }; - - // Provide entities - dispatch.mockReturnValueOnce( configs ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => configs ) }; // Provide response const updatedRecord = { ...post, id: 10 }; @@ -409,7 +396,7 @@ describe( 'saveEntityRecord', () => { 'postType', 'post', post - )( { select, dispatch } ); + )( { select, dispatch, resolveSelect } ); expect( apiFetch ).toHaveBeenCalledTimes( 1 ); expect( apiFetch ).toHaveBeenCalledWith( { @@ -418,7 +405,7 @@ describe( 'saveEntityRecord', () => { data: post, } ); - expect( dispatch ).toHaveBeenCalledTimes( 3 ); + expect( dispatch ).toHaveBeenCalledTimes( 2 ); expect( dispatch ).toHaveBeenCalledWith( { type: 'SAVE_ENTITY_RECORD_START', kind: 'postType', @@ -467,9 +454,7 @@ describe( 'saveEntityRecord', () => { const select = { getRawEntityRecord: () => ( {} ), }; - - // Provide entities - dispatch.mockReturnValueOnce( configs ); + const resolveSelect = { getEntitiesConfig: jest.fn( () => configs ) }; // Provide response apiFetch.mockImplementation( () => postType ); @@ -478,7 +463,7 @@ describe( 'saveEntityRecord', () => { 'root', 'postType', postType - )( { select, dispatch } ); + )( { select, dispatch, resolveSelect } ); expect( apiFetch ).toHaveBeenCalledTimes( 1 ); expect( apiFetch ).toHaveBeenCalledWith( { @@ -487,7 +472,7 @@ describe( 'saveEntityRecord', () => { data: postType, } ); - expect( dispatch ).toHaveBeenCalledTimes( 3 ); + expect( dispatch ).toHaveBeenCalledTimes( 2 ); expect( dispatch ).toHaveBeenCalledWith( { type: 'SAVE_ENTITY_RECORD_START', kind: 'root', diff --git a/packages/core-data/src/test/entities.js b/packages/core-data/src/test/entities.js index 27b3d56e76865d..294c843fae117e 100644 --- a/packages/core-data/src/test/entities.js +++ b/packages/core-data/src/test/entities.js @@ -1,16 +1,9 @@ -/** - * WordPress dependencies - */ -import triggerFetch from '@wordpress/api-fetch'; -jest.mock( '@wordpress/api-fetch' ); - /** * Internal dependencies */ import { getMethodName, rootEntitiesConfig, - getOrLoadEntitiesConfig, prePersistPostType, } from '../entities'; @@ -43,79 +36,6 @@ describe( 'getMethodName', () => { } ); } ); -describe( 'getKindEntities', () => { - beforeEach( async () => { - triggerFetch.mockReset(); - } ); - - it( 'shouldn’t do anything if the entities have already been resolved', async () => { - const dispatch = jest.fn(); - const select = { - getEntitiesConfig: jest.fn( () => entities ), - getEntityConfig: jest.fn( () => ( { - kind: 'postType', - name: 'post', - } ) ), - }; - const entities = [ { kind: 'postType' } ]; - await getOrLoadEntitiesConfig( - 'postType', - 'post' - )( { dispatch, select } ); - expect( dispatch ).not.toHaveBeenCalled(); - } ); - - it( 'shouldn’t do anything if there no defined kind config', async () => { - const dispatch = jest.fn(); - const select = { - getEntitiesConfig: jest.fn( () => [] ), - getEntityConfig: jest.fn( () => undefined ), - }; - await getOrLoadEntitiesConfig( - 'unknownKind', - undefined - )( { dispatch, select } ); - expect( dispatch ).not.toHaveBeenCalled(); - } ); - - it( 'should fetch and add the entities', async () => { - const fetchedEntities = [ - { - rest_base: 'posts', - labels: { - singular_name: 'post', - }, - supports: { - revisions: true, - }, - }, - ]; - const dispatch = jest.fn(); - const select = { - getEntitiesConfig: jest.fn( () => [] ), - getEntityConfig: jest.fn( () => undefined ), - }; - triggerFetch.mockImplementation( () => fetchedEntities ); - - await getOrLoadEntitiesConfig( - 'postType', - 'post' - )( { dispatch, select } ); - expect( dispatch ).toHaveBeenCalledTimes( 1 ); - expect( dispatch.mock.calls[ 0 ][ 0 ].type ).toBe( 'ADD_ENTITIES' ); - expect( dispatch.mock.calls[ 0 ][ 0 ].entities.length ).toBe( 1 ); - expect( dispatch.mock.calls[ 0 ][ 0 ].entities[ 0 ].baseURL ).toBe( - '/wp/v2/posts' - ); - expect( - dispatch.mock.calls[ 0 ][ 0 ].entities[ 0 ].getRevisionsUrl( 1 ) - ).toBe( '/wp/v2/posts/1/revisions' ); - expect( - dispatch.mock.calls[ 0 ][ 0 ].entities[ 0 ].getRevisionsUrl( 1, 2 ) - ).toBe( '/wp/v2/posts/1/revisions/2' ); - } ); -} ); - describe( 'prePersistPostType', () => { it( 'set the status to draft and empty the title when saving auto-draft posts', () => { let record = { diff --git a/packages/core-data/src/test/resolvers.js b/packages/core-data/src/test/resolvers.js index f15bee3b3c2b9b..472056a4dfdc9b 100644 --- a/packages/core-data/src/test/resolvers.js +++ b/packages/core-data/src/test/resolvers.js @@ -29,6 +29,7 @@ describe( 'getEntityRecord', () => { }, ]; const registry = { batch: ( callback ) => callback() }; + const resolveSelect = { getEntitiesConfig: jest.fn( () => ENTITIES ) }; let dispatch; beforeEach( async () => { @@ -43,9 +44,6 @@ describe( 'getEntityRecord', () => { } ); it( 'yields with requested post type', async () => { - // Provide entities - dispatch.mockReturnValueOnce( ENTITIES ); - // Provide response triggerFetch.mockImplementation( () => POST_TYPE_RESPONSE ); @@ -53,7 +51,7 @@ describe( 'getEntityRecord', () => { 'root', 'postType', 'post' - )( { dispatch, registry } ); + )( { dispatch, registry, resolveSelect } ); // Fetch request should have been issued. expect( triggerFetch ).toHaveBeenCalledWith( { @@ -84,8 +82,6 @@ describe( 'getEntityRecord', () => { const select = { hasEntityRecords: jest.fn( () => {} ), }; - // Provide entities - dispatch.mockReturnValueOnce( ENTITIES ); // Provide response triggerFetch.mockImplementation( () => POST_TYPE_RESPONSE ); @@ -95,7 +91,7 @@ describe( 'getEntityRecord', () => { 'postType', 'post', query - )( { dispatch, select, registry } ); + )( { dispatch, select, registry, resolveSelect } ); // Trigger apiFetch, test that the query is present in the url. expect( triggerFetch ).toHaveBeenCalledWith( { @@ -141,6 +137,7 @@ describe( 'getEntityRecords', () => { }, ]; const registry = { batch: ( callback ) => callback() }; + const resolveSelect = { getEntitiesConfig: jest.fn( () => ENTITIES ) }; beforeEach( async () => { triggerFetch.mockReset(); @@ -152,13 +149,14 @@ describe( 'getEntityRecords', () => { __unstableAcquireStoreLock: jest.fn(), __unstableReleaseStoreLock: jest.fn(), } ); - // Provide entities - dispatch.mockReturnValueOnce( ENTITIES ); // Provide response triggerFetch.mockImplementation( () => POST_TYPES ); - await getEntityRecords( 'root', 'postType' )( { dispatch, registry } ); + await getEntityRecords( + 'root', + 'postType' + )( { dispatch, registry, resolveSelect } ); // Fetch request should have been issued. expect( triggerFetch ).toHaveBeenCalledWith( { @@ -183,13 +181,14 @@ describe( 'getEntityRecords', () => { __unstableAcquireStoreLock: jest.fn(), __unstableReleaseStoreLock: jest.fn(), } ); - // Provide entities - dispatch.mockReturnValueOnce( ENTITIES ); // Provide response triggerFetch.mockImplementation( () => POST_TYPES ); - await getEntityRecords( 'root', 'postType' )( { dispatch, registry } ); + await getEntityRecords( + 'root', + 'postType' + )( { dispatch, registry, resolveSelect } ); // Fetch request should have been issued. expect( triggerFetch ).toHaveBeenCalledWith( { @@ -216,13 +215,14 @@ describe( 'getEntityRecords', () => { __unstableReleaseStoreLock: jest.fn(), finishResolutions, } ); - // Provide entities - dispatch.mockReturnValueOnce( ENTITIES ); // Provide response triggerFetch.mockImplementation( () => POST_TYPES ); - await getEntityRecords( 'root', 'postType' )( { dispatch, registry } ); + await getEntityRecords( + 'root', + 'postType' + )( { dispatch, registry, resolveSelect } ); // Fetch request should have been issued. expect( triggerFetch ).toHaveBeenCalledWith( { @@ -290,6 +290,7 @@ describe( 'canUser', () => { baseURLParams: { context: 'edit' }, }, ]; + const resolveSelect = { getEntitiesConfig: jest.fn( () => ENTITIES ) }; let dispatch, registry; beforeEach( async () => { @@ -303,7 +304,6 @@ describe( 'canUser', () => { receiveUserPermission: jest.fn(), finishResolution: jest.fn(), } ); - dispatch.mockReturnValue( ENTITIES ); triggerFetch.mockReset(); } ); @@ -312,10 +312,14 @@ describe( 'canUser', () => { Promise.reject( { status: 404 } ) ); - await canUser( 'create', 'media' )( { dispatch, registry } ); + await canUser( + 'create', + 'media' + )( { dispatch, registry, resolveSelect } ); await canUser( 'create', { kind: 'root', name: 'media' } )( { dispatch, registry, + resolveSelect, } ); expect( triggerFetch ).toHaveBeenCalledWith( { @@ -332,6 +336,7 @@ describe( 'canUser', () => { canUser( 'create', { name: 'wp_block' } )( { dispatch, registry, + resolveSelect, } ) ).rejects.toThrow( 'The entity resource object is not valid.' ); } ); @@ -341,7 +346,10 @@ describe( 'canUser', () => { headers: new Map( [ [ 'allow', 'GET' ] ] ), } ) ); - await canUser( 'create', 'media' )( { dispatch, registry } ); + await canUser( + 'create', + 'media' + )( { dispatch, registry, resolveSelect } ); expect( triggerFetch ).toHaveBeenCalledWith( { path: '/wp/v2/media', @@ -363,6 +371,7 @@ describe( 'canUser', () => { await canUser( 'create', { kind: 'root', name: 'media' } )( { dispatch, registry, + resolveSelect, } ); expect( triggerFetch ).toHaveBeenCalledWith( { @@ -382,7 +391,10 @@ describe( 'canUser', () => { headers: new Map( [ [ 'allow', 'POST, GET, PUT, DELETE' ] ] ), } ) ); - await canUser( 'create', 'media' )( { dispatch, registry } ); + await canUser( + 'create', + 'media' + )( { dispatch, registry, resolveSelect } ); expect( triggerFetch ).toHaveBeenCalledWith( { path: '/wp/v2/media', @@ -404,6 +416,7 @@ describe( 'canUser', () => { await canUser( 'create', { kind: 'root', name: 'media' } )( { dispatch, registry, + resolveSelect, } ); expect( triggerFetch ).toHaveBeenCalledWith( { @@ -423,7 +436,11 @@ describe( 'canUser', () => { headers: new Map( [ [ 'allow', 'POST, GET, PUT, DELETE' ] ] ), } ) ); - await canUser( 'create', 'blocks', 123 )( { dispatch, registry } ); + await canUser( + 'create', + 'blocks', + 123 + )( { dispatch, registry, resolveSelect } ); expect( triggerFetch ).toHaveBeenCalledWith( { path: '/wp/v2/blocks/123', @@ -449,6 +466,7 @@ describe( 'canUser', () => { } )( { dispatch, registry, + resolveSelect, } ); expect( triggerFetch ).toHaveBeenCalledWith( { @@ -475,8 +493,14 @@ describe( 'canUser', () => { headers: new Map( [ [ 'allow', 'POST, GET' ] ] ), } ) ); - await canUser( 'create', 'blocks' )( { dispatch, registry } ); - await canUser( 'read', 'blocks' )( { dispatch, registry } ); + await canUser( + 'create', + 'blocks' + )( { dispatch, registry, resolveSelect } ); + await canUser( + 'read', + 'blocks' + )( { dispatch, registry, resolveSelect } ); expect( triggerFetch ).toHaveBeenCalledTimes( 1 ); @@ -508,6 +532,7 @@ describe( 'canUser', () => { } )( { dispatch, registry, + resolveSelect, } ); await canUser( 'read', { kind: 'postType', @@ -515,6 +540,7 @@ describe( 'canUser', () => { } )( { dispatch, registry, + resolveSelect, } ); expect( triggerFetch ).toHaveBeenCalledTimes( 1 ); @@ -541,10 +567,22 @@ describe( 'canUser', () => { headers: new Map( [ [ 'allow', 'POST, GET' ] ] ), } ) ); - await canUser( 'create', 'blocks' )( { dispatch, registry } ); - await canUser( 'read', 'blocks' )( { dispatch, registry } ); - await canUser( 'update', 'blocks' )( { dispatch, registry } ); - await canUser( 'delete', 'blocks' )( { dispatch, registry } ); + await canUser( + 'create', + 'blocks' + )( { dispatch, registry, resolveSelect } ); + await canUser( + 'read', + 'blocks' + )( { dispatch, registry, resolveSelect } ); + await canUser( + 'update', + 'blocks' + )( { dispatch, registry, resolveSelect } ); + await canUser( + 'delete', + 'blocks' + )( { dispatch, registry, resolveSelect } ); expect( dispatch.receiveUserPermission ).toHaveBeenCalledWith( 'create/blocks', @@ -576,10 +614,26 @@ describe( 'canUser', () => { headers: new Map( [ [ 'allow', 'POST, GET, PUT, DELETE' ] ] ), } ) ); - await canUser( 'create', 'blocks', 123 )( { dispatch, registry } ); - await canUser( 'read', 'blocks', 123 )( { dispatch, registry } ); - await canUser( 'update', 'blocks', 123 )( { dispatch, registry } ); - await canUser( 'delete', 'blocks', 123 )( { dispatch, registry } ); + await canUser( + 'create', + 'blocks', + 123 + )( { dispatch, registry, resolveSelect } ); + await canUser( + 'read', + 'blocks', + 123 + )( { dispatch, registry, resolveSelect } ); + await canUser( + 'update', + 'blocks', + 123 + )( { dispatch, registry, resolveSelect } ); + await canUser( + 'delete', + 'blocks', + 123 + )( { dispatch, registry, resolveSelect } ); expect( triggerFetch ).toHaveBeenCalledTimes( 1 ); @@ -617,22 +671,22 @@ describe( 'canUser', () => { kind: 'postType', name: 'wp_block', id: 123, - } )( { dispatch, registry } ); + } )( { dispatch, registry, resolveSelect } ); await canUser( 'read', { kind: 'postType', name: 'wp_block', id: 123, - } )( { dispatch, registry } ); + } )( { dispatch, registry, resolveSelect } ); await canUser( 'update', { kind: 'postType', name: 'wp_block', id: 123, - } )( { dispatch, registry } ); + } )( { dispatch, registry, resolveSelect } ); await canUser( 'delete', { kind: 'postType', name: 'wp_block', id: 123, - } )( { dispatch, registry } ); + } )( { dispatch, registry, resolveSelect } ); expect( triggerFetch ).toHaveBeenCalledTimes( 1 ); diff --git a/packages/create-block-interactive-template/package.json b/packages/create-block-interactive-template/package.json index d400d77a49ab67..bd34bed4d2e256 100644 --- a/packages/create-block-interactive-template/package.json +++ b/packages/create-block-interactive-template/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block-interactive-template", - "version": "2.10.0", + "version": "2.11.0", "description": "Template for @wordpress/create-block to create interactive blocks with the Interactivity API.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/create-block-tutorial-template/CHANGELOG.md b/packages/create-block-tutorial-template/CHANGELOG.md index 8b4b467a1b4366..dd043522c27a6b 100644 --- a/packages/create-block-tutorial-template/CHANGELOG.md +++ b/packages/create-block-tutorial-template/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.11.0 (2024-10-30) + ## 4.10.0 (2024-10-16) ## 4.9.0 (2024-10-03) diff --git a/packages/create-block-tutorial-template/package.json b/packages/create-block-tutorial-template/package.json index 42ae74d8eeeb90..c2ea39fad8ba74 100644 --- a/packages/create-block-tutorial-template/package.json +++ b/packages/create-block-tutorial-template/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block-tutorial-template", - "version": "4.10.0", + "version": "4.11.0", "description": "This is a template for @wordpress/create-block that creates an example 'Copyright Date' block. This block is used in the official WordPress block development Quick Start Guide.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/create-block/CHANGELOG.md b/packages/create-block/CHANGELOG.md index 9b9504faa1eeab..c961882082541c 100644 --- a/packages/create-block/CHANGELOG.md +++ b/packages/create-block/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.54.0 (2024-10-30) + ### Enhancement - Add `--target-dir` flag to allow indicating where resulting files will be scaffolded ([#53781](https://github.com/WordPress/gutenberg/pull/53781)) diff --git a/packages/create-block/package.json b/packages/create-block/package.json index a9215bb2699d32..dbb8e56ea72151 100644 --- a/packages/create-block/package.json +++ b/packages/create-block/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block", - "version": "4.53.0", + "version": "4.54.0", "description": "Generates PHP, JS and CSS code for registering a block for a WordPress plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/customize-widgets/CHANGELOG.md b/packages/customize-widgets/CHANGELOG.md index 4c308aff491268..b36ed481749ea9 100644 --- a/packages/customize-widgets/CHANGELOG.md +++ b/packages/customize-widgets/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.11.0 (2024-10-30) + ## 5.10.0 (2024-10-16) ## 5.9.0 (2024-10-03) diff --git a/packages/customize-widgets/package.json b/packages/customize-widgets/package.json index 68e736c566c110..ef6748f34205e8 100644 --- a/packages/customize-widgets/package.json +++ b/packages/customize-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/customize-widgets", - "version": "5.10.0", + "version": "5.11.0", "description": "Widgets blocks in Customizer Module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/data-controls/CHANGELOG.md b/packages/data-controls/CHANGELOG.md index cfbe9d3ea46632..c536d850f8c733 100644 --- a/packages/data-controls/CHANGELOG.md +++ b/packages/data-controls/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.11.0 (2024-10-30) + ## 4.10.0 (2024-10-16) ## 4.9.0 (2024-10-03) diff --git a/packages/data-controls/package.json b/packages/data-controls/package.json index 84462f49e5c0c8..948efe7fb64022 100644 --- a/packages/data-controls/package.json +++ b/packages/data-controls/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data-controls", - "version": "4.10.0", + "version": "4.11.0", "description": "A set of common controls for the @wordpress/data api.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/data/CHANGELOG.md b/packages/data/CHANGELOG.md index 44d7aa5f954ef2..98c553b08b67b9 100644 --- a/packages/data/CHANGELOG.md +++ b/packages/data/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 10.11.0 (2024-10-30) + ## 10.10.0 (2024-10-16) ## 10.9.0 (2024-10-03) diff --git a/packages/data/package.json b/packages/data/package.json index 5e1817f0fb6ad8..0e46b1a366918e 100644 --- a/packages/data/package.json +++ b/packages/data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data", - "version": "10.10.0", + "version": "10.11.0", "description": "Data module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dataviews/CHANGELOG.md b/packages/dataviews/CHANGELOG.md index d5054b8578d95c..60cdad73b32efe 100644 --- a/packages/dataviews/CHANGELOG.md +++ b/packages/dataviews/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.7.0 (2024-10-30) + ## 4.6.0 (2024-10-16) - Invert the logic for which icon to show in `DataViews` when using the filter view. Icons now match the action of the button label. ([#65914](https://github.com/WordPress/gutenberg/pull/65914)). diff --git a/packages/dataviews/package.json b/packages/dataviews/package.json index a83fd163517d0a..5599a84b92d34c 100644 --- a/packages/dataviews/package.json +++ b/packages/dataviews/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dataviews", - "version": "4.6.0", + "version": "4.7.0", "description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dataviews/src/dataviews-layouts/list/index.tsx b/packages/dataviews/src/dataviews-layouts/list/index.tsx index 82f9b5ea4d4fc5..a4f94e482c69b3 100644 --- a/packages/dataviews/src/dataviews-layouts/list/index.tsx +++ b/packages/dataviews/src/dataviews-layouts/list/index.tsx @@ -176,10 +176,10 @@ function ListItem< Item >( { }, [ actions, item ] ); const renderedMediaField = mediaField?.render ? ( - - ) : ( -
- ); +
+ +
+ ) : null; const renderedPrimaryField = primaryField?.render ? ( @@ -248,9 +248,7 @@ function ListItem< Item >( { /> -
- { renderedMediaField } -
+ { renderedMediaField }