diff --git a/.github/ISSUE_TEMPLATE/New_release.md b/.github/ISSUE_TEMPLATE/New_release.md index 629a4dafa5ba56..c07dcfa3c466c6 100644 --- a/.github/ISSUE_TEMPLATE/New_release.md +++ b/.github/ISSUE_TEMPLATE/New_release.md @@ -23,7 +23,6 @@ This issue is to provide visibility on the progress of the release process of Gu ### RC Day - {Weekday, Month, Date} -- [ ] _Optional:_ Attend `#core-editor` meeting (14:00UTC) - [ ] Post a message in `#core-editor` channel to let folks know you are starting the RC release process - [ ] Organize and Label PRs on the relevant milestone - [ ] Start the release process by triggering the `rc` [workflow](https://developer.wordpress.org/block-editor/contributors/code/release/#running-workflow) diff --git a/.github/workflows/cherry-pick-wp-release.yml b/.github/workflows/cherry-pick-wp-release.yml index fd7d365600c5e5..d1089aa99f6ae5 100644 --- a/.github/workflows/cherry-pick-wp-release.yml +++ b/.github/workflows/cherry-pick-wp-release.yml @@ -66,6 +66,7 @@ jobs: git cherry-pick $COMMIT_SHA || echo "cherry-pick-failed" > result if [ -f result ] && grep -q "cherry-pick-failed" result; then echo "conflict=true" >> $GITHUB_ENV + echo "commit_sha=$COMMIT_SHA" >> $GITHUB_ENV git cherry-pick --abort else NEW_COMMIT_SHA=$(git rev-parse HEAD) @@ -122,6 +123,7 @@ jobs: with: script: | const prNumber = context.issue.number; + const commitSha = process.env.commit_sha; const targetBranch = `wp/${process.env.version}`; console.log(`prNumber: ${prNumber}`); console.log(`targetBranch: ${targetBranch}`); @@ -129,5 +131,28 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: prNumber, - body: `There was a conflict while trying to cherry-pick the commit to the ${targetBranch} branch. Please resolve the conflict manually and create a PR to the ${targetBranch} branch.` + body: `There was a conflict while trying to cherry-pick the commit to the ${targetBranch} branch. Please resolve the conflict manually and create a PR to the ${targetBranch} branch. + + PRs to ${targetBranch} are similar to PRs to trunk, but you should base your PR on the ${targetBranch} branch instead of trunk. + + \`\`\` + # Checkout the ${targetBranch} branch instead of trunk. + git checkout ${targetBranch} + # Create a new branch for your PR. + git checkout -b my-branch + # Cherry-pick the commit. + git cherry-pick ${commitSha} + # Check which files have conflicts. + git status + # Resolve the conflict... + # Add the resolved files to the staging area. + git status + git add . + git cherry-pick --continue + # Push the branch to the repository + git push origin my-branch + # Create a PR and set the base to the ${targetBranch} branch. + # See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-base-branch-of-a-pull-request. + \`\`\` + ` }); diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c983b0fd338435..488f41c217e7c2 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -158,15 +158,15 @@ jobs: include: # Test with the previous WP version. - php: '7.2' - wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }} + wordpress: 'previous major version' - php: '7.4' - wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }} + wordpress: 'previous major version' - php: '8.2' - wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }} + wordpress: 'previous major version' env: WP_ENV_PHP_VERSION: ${{ matrix.php }} - WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }} + WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', needs.compute-previous-wordpress-version.outputs.previous-wordpress-version ) }} steps: - name: Checkout repository @@ -240,6 +240,7 @@ jobs: npm run wp-env run tests-wordpress php -i npm run wp-env run tests-wordpress /var/www/html/wp-content/plugins/gutenberg/vendor/bin/phpunit -- --version npm run wp-env run tests-wordpress locale -a + npm run wp-env run tests-cli wp core version - name: Running single site unit tests if: ${{ ! matrix.multisite }} diff --git a/changelog.txt b/changelog.txt index 38dbcadaa4d9c3..3a00bcf11396fe 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,195 @@ == Changelog == += 18.7.0-rc.1 = + + +## Changelog + +### Enhancements + +- Add: Content panel for template parts. ([62034](https://github.com/WordPress/gutenberg/pull/62034)) +- Move Sticky toggle to status popover. ([62782](https://github.com/WordPress/gutenberg/pull/62782)) +- Rename yieldToMain to splitTask and export from @wordpress/interactivity. ([62665](https://github.com/WordPress/gutenberg/pull/62665)) +- Update: Check assignable properties on the duplicate action. ([62590](https://github.com/WordPress/gutenberg/pull/62590)) +- Update: Followups to the template and template_lock rest api addition. ([62696](https://github.com/WordPress/gutenberg/pull/62696)) +- Update: Reverse backport changes on post type REST API changes. ([62751](https://github.com/WordPress/gutenberg/pull/62751)) +- Align naming modals. ([62788](https://github.com/WordPress/gutenberg/pull/62788))y +- Add writing mode support to other blocks. ([62727](https://github.com/WordPress/gutenberg/pull/62727)) +- Display the DocumentBar for Style Book and Style Revisions. ([62669](https://github.com/WordPress/gutenberg/pull/62669)) +- fetchLinkSuggestions: Allow for partial matching. ([62570](https://github.com/WordPress/gutenberg/pull/62570)) +- DataViews: Support passing the registry to actions callbacks. ([62505](https://github.com/WordPress/gutenberg/pull/62505)) +- Add tooltip on hover of color and typography presets. ([62201](https://github.com/WordPress/gutenberg/pull/62201)) +- Revert change that removes the social link block when pressing backspace in the URL Popover. ([61344](https://github.com/WordPress/gutenberg/pull/61344)) + + +### Bug Fixes + +- Add `context` in post actions API. ([62443](https://github.com/WordPress/gutenberg/pull/62443)) +- Add `html` to reset styles for the `.editor-styles-wrapper` container. ([62350](https://github.com/WordPress/gutenberg/pull/62350)) +- Cherry pick script: Make authenticated requests. ([62473](https://github.com/WordPress/gutenberg/pull/62473)) +- Editor: Fix blocked Post Publish Panel buttons on mobile. ([62736](https://github.com/WordPress/gutenberg/pull/62736)) +- Fix cherry-pick script, add missing --repo arg. ([62643](https://github.com/WordPress/gutenberg/pull/62643)) +- Fix rawHandling, pasteHandling for mixed content with blocks and classic. ([62545](https://github.com/WordPress/gutenberg/pull/62545)) +- Fix: Active template is not highlighted properly in list view. ([62811](https://github.com/WordPress/gutenberg/pull/62811)) +- Fix: Check Capability to create pages on DataViews add new page button. ([62592](https://github.com/WordPress/gutenberg/pull/62592)) +- Fix: Check ability to create patterns on the add new pattern modal. ([62633](https://github.com/WordPress/gutenberg/pull/62633)) +- Fix: Check create capability on duplicate post action. ([62620](https://github.com/WordPress/gutenberg/pull/62620)) +- Fix: Check permissions on duplicate pattern and template part actions. ([62757](https://github.com/WordPress/gutenberg/pull/62757)) +- Fix: Comments and Pingbacks get cleared out when a pattern is edited. ([62507](https://github.com/WordPress/gutenberg/pull/62507)) +- Fix: DataViews: Active page is not highlighted properly in list view. ([62378](https://github.com/WordPress/gutenberg/pull/62378)) +- Fix: Include permission management on permanently delete, rename, and restore. ([62754](https://github.com/WordPress/gutenberg/pull/62754)) +- Fix: List view renders an empty menu when no actions are eligible. ([62786](https://github.com/WordPress/gutenberg/pull/62786)) +- Fix: Post_type template is not used when creating a page in site editor. ([62488](https://github.com/WordPress/gutenberg/pull/62488)) +- Fix: Resetting template part causes notification saying it's been delete. ([62521](https://github.com/WordPress/gutenberg/pull/62521)) +- Fix: The trash post action doesn't take into account user capabilities. ([62589](https://github.com/WordPress/gutenberg/pull/62589)) +- Inspector: Improve handling of long words in post titles. ([62691](https://github.com/WordPress/gutenberg/pull/62691)) +- Revert "Revert test data for `WithSlug` variation (#62579)". ([62587](https://github.com/WordPress/gutenberg/pull/62587)) +- Show publish panel only in edit mode. ([62813](https://github.com/WordPress/gutenberg/pull/62813)) +- Site Editor: Improve the frame animation. ([62676](https://github.com/WordPress/gutenberg/pull/62676)) +- DataViews: Remove selection correcting, set initial state. ([62796](https://github.com/WordPress/gutenberg/pull/62796)) +- Pattern overrides: Disallow override for image with caption/href. ([62747](https://github.com/WordPress/gutenberg/pull/62747)) +- Editor: Make VisualEditor a stacking context. ([62681](https://github.com/WordPress/gutenberg/pull/62681)) +- Fix toggle active font logic. ([62614](https://github.com/WordPress/gutenberg/pull/62614)) +- Save Panel: Remove connections icon and fix padding. ([62542](https://github.com/WordPress/gutenberg/pull/62542)) +- Editor: Render editPost slots only in the post editor (same for site editor). ([62531](https://github.com/WordPress/gutenberg/pull/62531)) +- Fix: Don't allow synced patterns to be inserted on shuffling. ([62422](https://github.com/WordPress/gutenberg/pull/62422)) +- Fix ExcerptPanel decode issue. ([62336](https://github.com/WordPress/gutenberg/pull/62336)) + +#### Block Library +- Add letter spacing inheritance for the navigation block. ([62745](https://github.com/WordPress/gutenberg/pull/62745)) +- Caption utility component: Allow the main CSS Class Name to be excluded from the markup. ([62485](https://github.com/WordPress/gutenberg/pull/62485)) +- Fix: Empty style attribute issue in navigation block. ([62600](https://github.com/WordPress/gutenberg/pull/62600)) +- Image Block: Fix Aspect Ratio button position. ([62776](https://github.com/WordPress/gutenberg/pull/62776)) +- Media & text: Update the image replacement logic. ([62030](https://github.com/WordPress/gutenberg/pull/62030)) +- Post Date Block: Fix PHP warning error. ([62783](https://github.com/WordPress/gutenberg/pull/62783)) +- Template Part: Improve how the tag name attribute is handled. ([62785](https://github.com/WordPress/gutenberg/pull/62785)) +- fix: Update block category to design and build documentation. ([61905](https://github.com/WordPress/gutenberg/pull/61905)) + +#### Global Styles +- Allow children of alignfull flow layouts to have root padding. ([62670](https://github.com/WordPress/gutenberg/pull/62670)) +- Prevent duplicate block style variations CSS. ([62465](https://github.com/WordPress/gutenberg/pull/62465)) +- Remove obsolete hook resolving shared block style variations. ([62808](https://github.com/WordPress/gutenberg/pull/62808)) +- Section Styles: Switch away from using init for variation registration. ([62640](https://github.com/WordPress/gutenberg/pull/62640)) +- Skip registration of variation styles when unsupported. ([62529](https://github.com/WordPress/gutenberg/pull/62529)) +- Styles: Lower specificity of figcaption style to allow theme.json override. ([62689](https://github.com/WordPress/gutenberg/pull/62689)) + +#### Components +- CustomSelectControl V2: Fix setting initial value and reacting to external controlled updates. ([62733](https://github.com/WordPress/gutenberg/pull/62733)) +- CustomSelectControlV2: Handle long strings in selected value. ([62198](https://github.com/WordPress/gutenberg/pull/62198)) + +#### Block Editor +- Raw handling: Fix too aggressive indented list removal. ([62622](https://github.com/WordPress/gutenberg/pull/62622)) +- Writing flow: Split heading into default block. ([61891](https://github.com/WordPress/gutenberg/pull/61891)) + + +### Accessibility + +- Fix custom color palette. ([62753](https://github.com/WordPress/gutenberg/pull/62753)) +- Fix lock modal dialog accessibility and semantics. ([62795](https://github.com/WordPress/gutenberg/pull/62795)) +- Image block: Fix focus style not around whole image when linked. ([62556](https://github.com/WordPress/gutenberg/pull/62556)) +- Pages data view: Update view icons. ([62136](https://github.com/WordPress/gutenberg/pull/62136)) +- Make the fonts management modal dialog more discoverable. ([62129](https://github.com/WordPress/gutenberg/pull/62129)) + + +### Performance + +- Improve performance of `compute_style_properties` method. ([62522](https://github.com/WordPress/gutenberg/pull/62522)) +- Run block variation hook only for matches. ([62617](https://github.com/WordPress/gutenberg/pull/62617)) +- Section Styles: Improve performance and conceptual consistency. ([62712](https://github.com/WordPress/gutenberg/pull/62712)) + + +### Experiments + +- Grid interactivity: Allow blocks to be positioned in manual mode using drag and drop. ([61025](https://github.com/WordPress/gutenberg/pull/61025)) + + +### Documentation + +- Add `VisualEditorGlobalKeyboardShortcuts` documentation. ([62710](https://github.com/WordPress/gutenberg/pull/62710)) +- Add changelog entry for splitTask export from @wordpress/interactivity. ([62805](https://github.com/WordPress/gutenberg/pull/62805)) +- Add documentation for PostSlug and PostSlugCheck component. ([62102](https://github.com/WordPress/gutenberg/pull/62102)) +- Adds comment on blocks resource referencing wp_block post type. ([62722](https://github.com/WordPress/gutenberg/pull/62722)) +- Changelogs: Standardize sections. ([58268](https://github.com/WordPress/gutenberg/pull/58268)) +- Correct documentation for WP_Block_Parser_Frame class. ([62598](https://github.com/WordPress/gutenberg/pull/62598)) +- Create Block: Add missing changelog entries. ([62791](https://github.com/WordPress/gutenberg/pull/62791)) +- Docs/iAPI: Fix wrong code snippet in data-wp-run example. ([62835](https://github.com/WordPress/gutenberg/pull/62835)) +- Docs/iapi warnings new directives wp 6 6. ([62789](https://github.com/WordPress/gutenberg/pull/62789)) +- Fix async directives API documentation. ([62759](https://github.com/WordPress/gutenberg/pull/62759)) +- Fix: Remove inexistent link from the documentation. ([62624](https://github.com/WordPress/gutenberg/pull/62624)) +- Interactivity API docs: Add wp-async directives doc. ([62663](https://github.com/WordPress/gutenberg/pull/62663)) +- Query Loop block: Clarify explanation around query loop variation example. ([62605](https://github.com/WordPress/gutenberg/pull/62605)) +- Small Typo correction in block-library.md file. ([62765](https://github.com/WordPress/gutenberg/pull/62765)) +- Update link to API section in block-editor README.md. ([62671](https://github.com/WordPress/gutenberg/pull/62671)) +- Update old links in @wordpress/babel-preset-default. ([62616](https://github.com/WordPress/gutenberg/pull/62616)) +- Updates the reference links in @wordpress/compose documentation. ([62593](https://github.com/WordPress/gutenberg/pull/62593)) +- [Developer Documentation] fix link URL. ([62725](https://github.com/WordPress/gutenberg/pull/62725)) + + +### Code Quality + +- Autoformat changelogs. ([62650](https://github.com/WordPress/gutenberg/pull/62650)) +- Autoformat e2e-tests package JavaScript. ([62572](https://github.com/WordPress/gutenberg/pull/62572)) +- Edit site: Do not autoformat edit-site/lib. ([62573](https://github.com/WordPress/gutenberg/pull/62573)) +- Move dep to dev deps. ([62673](https://github.com/WordPress/gutenberg/pull/62673)) +- Rename readme file with uppercase extension. ([62697](https://github.com/WordPress/gutenberg/pull/62697)) +- Site Editor: Don't render empty body tag. ([62769](https://github.com/WordPress/gutenberg/pull/62769)) +- Change `grid-visualizer` folder name to `grid`. ([62810](https://github.com/WordPress/gutenberg/pull/62810)) +- Add lib-font credits and license in source code. ([60973](https://github.com/WordPress/gutenberg/pull/60973)) + +#### Components +- Remove Framer Motion from `DropZone`. ([62044](https://github.com/WordPress/gutenberg/pull/62044)) +- `CustomSelectControlV2`: Fix handling of extra attributes passed to `options` in the legacy adapter. ([62255](https://github.com/WordPress/gutenberg/pull/62255)) + + +### Tools + +- Dependencies: Upgrade @octokit/webhooks. ([62666](https://github.com/WordPress/gutenberg/pull/62666)) +- Rename the wp-env schema to not be a dotfile. ([62634](https://github.com/WordPress/gutenberg/pull/62634)) +- env: Ignore `\$schema` key in environment configuration parsing. ([62626](https://github.com/WordPress/gutenberg/pull/62626)) + +#### Testing +- Add end-to-end test to ensure block bindings work well with symbols and numbers. ([62410](https://github.com/WordPress/gutenberg/pull/62410)) +- CustomSelectControl: Align v1 and legacy v2 unit tests. ([62706](https://github.com/WordPress/gutenberg/pull/62706)) +- Fix end-to-end tests in dev mode. ([62642](https://github.com/WordPress/gutenberg/pull/62642)) +- Improve maintainability of theme json class tests. ([62463](https://github.com/WordPress/gutenberg/pull/62463)) +- Release automation: Try cherry-picking automation. ([62716](https://github.com/WordPress/gutenberg/pull/62716)) +- Remove changelog checks for branches other than trunk. ([62645](https://github.com/WordPress/gutenberg/pull/62645)) +- Skip failing image block test. ([62781](https://github.com/WordPress/gutenberg/pull/62781)) +- Skip test: Create a new page, edit template and toggle page template preview. ([62799](https://github.com/WordPress/gutenberg/pull/62799)) +- Tests: Simplify test set up in `WP_Block_Supports_Block_Style_Variations_Test`. ([62637](https://github.com/WordPress/gutenberg/pull/62637)) +- Theme JSON resolver: Read theme.json files from the styles/ folder only once. ([62638](https://github.com/WordPress/gutenberg/pull/62638)) + +#### Build Tooling +- Generic name for previous version of WP tests. ([62853](https://github.com/WordPress/gutenberg/pull/62853)) +- Github PHP changes workflow: Remove it. ([62609](https://github.com/WordPress/gutenberg/pull/62609)) + + +### Various + +- Update Private API opt-in string for WP 6.6. ([62635](https://github.com/WordPress/gutenberg/pull/62635)) +- Update caniuse-lite dependency to latest version. ([62611](https://github.com/WordPress/gutenberg/pull/62611)) + + +## First-time contributors + +The following PRs were merged by first-time contributors: + +- @aatanasovdev: Caption utility component: Allow the main CSS Class Name to be excluded from the markup. ([62485](https://github.com/WordPress/gutenberg/pull/62485)) +- @dilipbheda: Correct documentation for WP_Block_Parser_Frame class. ([62598](https://github.com/WordPress/gutenberg/pull/62598)) +- @graylaurenm: Add letter spacing inheritance for the navigation block. ([62745](https://github.com/WordPress/gutenberg/pull/62745)) +- @ivan-ottinger: Editor: Fix blocked Post Publish Panel buttons on mobile. ([62736](https://github.com/WordPress/gutenberg/pull/62736)) +- @michakrapp: [Developer Documentation] fix link URL. ([62725](https://github.com/WordPress/gutenberg/pull/62725)) +- @saulyz: Fix rawHandling, pasteHandling for mixed content with blocks and classic. ([62545](https://github.com/WordPress/gutenberg/pull/62545)) +- @snehapatil2001: fix: Update block category to design and build documentation. ([61905](https://github.com/WordPress/gutenberg/pull/61905)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @aatanasovdev @afercia @ajlende @akasunil @amitraj2203 @artemiomorales @carolinan @cbravobernal @ciampo @creativecoder @DaniGuardiola @dilipbheda @ellatrix @fullofcaffeine @geriux @graylaurenm @gziolo @itzmekhokan @ivan-ottinger @jameskoster @jorgefilipecosta @juanmaguitar @kevin940726 @luisherranz @MaggieCabrera @matiasbenedetto @michakrapp @mirka @noisysocks @ntsekouras @oandregal @peterwilsoncc @ramonjd @sabernhardt @SantosGuillamot @saulyz @shail-mehta @sirreal @snehapatil2001 @spacedmonkey @stokesman @t-hamano @talldan @tellthemachines @up1512001 @vcanales @vipul0425 @westonruter @youknowriad + + = 18.6.1 = diff --git a/docs/contributors/code/scripts.md b/docs/contributors/code/scripts.md index 1483a409a4d08f..bcbbdbabc15a1e 100644 --- a/docs/contributors/code/scripts.md +++ b/docs/contributors/code/scripts.md @@ -64,7 +64,7 @@ It is recommended to use the main `wp-polyfill` script handle which takes care o | [Fetch Polyfill](https://www.npmjs.com/package/whatwg-fetch) | wp-polyfill-fetch | Polyfill that implements a subset of the standard Fetch specification | | [Promise Polyfill](https://www.npmjs.com/package/promise-polyfill) | wp-polyfill-promise | Lightweight ES6 Promise polyfill for the browser and node | | [Formdata Polyfill](https://www.npmjs.com/package/formdata-polyfill) | wp-polyfill-formdata | Polyfill conditionally replaces the native implementation | -| [Node Contains Polyfill](https://polyfill.io) | wp-polyfill-node-contains | Polyfill for Node.contains | +| [Node Contains Polyfill](https://www.npmjs.com/package/polyfill-library) | wp-polyfill-node-contains | Polyfill for Node.contains | | [Element Closest Polyfill](https://www.npmjs.com/package/element-closest) | wp-polyfill-element-closest | Return the closest element matching a selector up the DOM tree | ## Bundling and code sharing diff --git a/docs/reference-guides/interactivity-api/api-reference.md b/docs/reference-guides/interactivity-api/api-reference.md index ba93e7fc529ebd..a898e437b40de8 100644 --- a/docs/reference-guides/interactivity-api/api-reference.md +++ b/docs/reference-guides/interactivity-api/api-reference.md @@ -531,7 +531,7 @@ The `unique-id` doesn't need to be unique globally. It just needs to be differen See store used with the directive above ```js -import { store, useState, useEffect } from '@wordpress/interactivity'; +import { getElement, store, useState, useEffect } from '@wordpress/interactivity'; // Unlike `data-wp-init` and `data-wp-watch`, you can use any hooks inside // `data-wp-run` callbacks. @@ -1071,7 +1071,7 @@ Those attributes will contain the directives of that element. In the button exam ```js // store -import { store, getContext } from '@wordpress/interactivity'; +import { store, getElement } from '@wordpress/interactivity'; store( "myPlugin", { actions: { diff --git a/gutenberg.php b/gutenberg.php index 0edf6868f1aa04..2eb7a849f8731d 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.4 * Requires PHP: 7.2 - * Version: 18.6.1 + * Version: 18.7.0-rc.1 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/lib/block-supports/block-style-variations.php b/lib/block-supports/block-style-variations.php index 12c2453681b419..1c049f4a0fee58 100644 --- a/lib/block-supports/block-style-variations.php +++ b/lib/block-supports/block-style-variations.php @@ -274,19 +274,3 @@ function gutenberg_register_block_style_variations_from_theme_json_partials( $va } } } - -// DO NOT BACKPORT TO CORE. -// To be removed when core has backported this PR. -if ( function_exists( 'wp_resolve_block_style_variations_from_styles_registry' ) ) { - remove_filter( 'wp_theme_json_data_theme', 'wp_resolve_block_style_variations_from_styles_registry' ); -} -if ( function_exists( 'wp_resolve_block_style_variations_from_primary_theme_json' ) ) { - remove_filter( 'wp_theme_json_data_theme', 'wp_resolve_block_style_variations_from_primary_theme_json' ); -} -if ( function_exists( 'wp_resolve_block_style_variations_from_theme_json_partials' ) ) { - remove_filter( 'wp_theme_json_data_theme', 'wp_resolve_block_style_variations_from_theme_json_partials' ); -} -if ( function_exists( 'wp_resolve_block_style_variations_from_theme_style_variation' ) ) { - remove_filter( 'wp_theme_json_data_user', 'wp_resolve_block_style_variations_from_theme_style_variation' ); -} -// END OF DO NOT BACKPORT TO CORE. diff --git a/package-lock.json b/package-lock.json index 2440b27e0f08ba..3725b111e4f3f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gutenberg", - "version": "18.6.1", + "version": "18.7.0-rc.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "gutenberg", - "version": "18.6.1", + "version": "18.7.0-rc.1", "hasInstallScript": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -53078,7 +53078,7 @@ }, "packages/a11y": { "name": "@wordpress/a11y", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53092,7 +53092,7 @@ }, "packages/annotations": { "name": "@wordpress/annotations", - "version": "3.1.0", + "version": "3.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53120,7 +53120,7 @@ }, "packages/api-fetch": { "name": "@wordpress/api-fetch", - "version": "7.1.0", + "version": "7.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53134,7 +53134,7 @@ }, "packages/autop": { "name": "@wordpress/autop", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -53146,7 +53146,7 @@ }, "packages/babel-plugin-import-jsx-pragma": { "name": "@wordpress/babel-plugin-import-jsx-pragma", - "version": "5.1.0", + "version": "5.2.0", "dev": true, "license": "GPL-2.0-or-later", "engines": { @@ -53159,7 +53159,7 @@ }, "packages/babel-plugin-makepot": { "name": "@wordpress/babel-plugin-makepot", - "version": "6.1.0", + "version": "6.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -53177,7 +53177,7 @@ }, "packages/babel-preset-default": { "name": "@wordpress/babel-preset-default", - "version": "8.1.0", + "version": "8.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -53200,7 +53200,7 @@ }, "packages/base-styles": { "name": "@wordpress/base-styles", - "version": "5.1.0", + "version": "5.2.0", "dev": true, "license": "GPL-2.0-or-later", "engines": { @@ -53210,7 +53210,7 @@ }, "packages/blob": { "name": "@wordpress/blob", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -53222,7 +53222,7 @@ }, "packages/block-directory": { "name": "@wordpress/block-directory", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53258,7 +53258,7 @@ }, "packages/block-editor": { "name": "@wordpress/block-editor", - "version": "13.1.0", + "version": "13.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53372,7 +53372,7 @@ }, "packages/block-library": { "name": "@wordpress/block-library", - "version": "9.1.0", + "version": "9.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53438,7 +53438,7 @@ }, "packages/block-serialization-default-parser": { "name": "@wordpress/block-serialization-default-parser", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -53450,7 +53450,7 @@ }, "packages/block-serialization-spec-parser": { "name": "@wordpress/block-serialization-spec-parser", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "pegjs": "^0.10.0", @@ -53463,7 +53463,7 @@ }, "packages/blocks": { "name": "@wordpress/blocks", - "version": "13.1.0", + "version": "13.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53516,7 +53516,7 @@ }, "packages/browserslist-config": { "name": "@wordpress/browserslist-config", - "version": "6.1.0", + "version": "6.2.0", "dev": true, "license": "GPL-2.0-or-later", "engines": { @@ -53526,7 +53526,7 @@ }, "packages/commands": { "name": "@wordpress/commands", - "version": "1.1.0", + "version": "1.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53551,7 +53551,7 @@ }, "packages/components": { "name": "@wordpress/components", - "version": "28.1.0", + "version": "28.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@ariakit/react": "^0.3.12", @@ -53643,7 +53643,7 @@ }, "packages/compose": { "name": "@wordpress/compose", - "version": "7.1.0", + "version": "7.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53680,7 +53680,7 @@ }, "packages/core-commands": { "name": "@wordpress/core-commands", - "version": "1.1.0", + "version": "1.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53690,6 +53690,7 @@ "@wordpress/core-data": "file:../core-data", "@wordpress/data": "file:../data", "@wordpress/element": "file:../element", + "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", "@wordpress/icons": "file:../icons", "@wordpress/private-apis": "file:../private-apis", @@ -53707,7 +53708,7 @@ }, "packages/core-data": { "name": "@wordpress/core-data", - "version": "7.1.0", + "version": "7.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53751,7 +53752,7 @@ }, "packages/create-block": { "name": "@wordpress/create-block", - "version": "4.44.0", + "version": "4.45.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -53779,7 +53780,7 @@ }, "packages/create-block-tutorial-template": { "name": "@wordpress/create-block-tutorial-template", - "version": "4.1.0", + "version": "4.2.0", "dev": true, "license": "GPL-2.0-or-later", "engines": { @@ -53789,7 +53790,7 @@ }, "packages/customize-widgets": { "name": "@wordpress/customize-widgets", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53827,7 +53828,7 @@ }, "packages/data": { "name": "@wordpress/data", - "version": "10.1.0", + "version": "10.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53856,7 +53857,7 @@ }, "packages/data-controls": { "name": "@wordpress/data-controls", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53874,7 +53875,7 @@ }, "packages/dataviews": { "name": "@wordpress/dataviews", - "version": "2.1.0", + "version": "2.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@ariakit/react": "^0.3.12", @@ -53935,7 +53936,7 @@ }, "packages/date": { "name": "@wordpress/date", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53950,7 +53951,7 @@ }, "packages/dependency-extraction-webpack-plugin": { "name": "@wordpress/dependency-extraction-webpack-plugin", - "version": "6.1.0", + "version": "6.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -53966,7 +53967,7 @@ }, "packages/deprecated": { "name": "@wordpress/deprecated", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -53979,7 +53980,7 @@ }, "packages/docgen": { "name": "@wordpress/docgen", - "version": "2.1.0", + "version": "2.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54001,7 +54002,7 @@ }, "packages/dom": { "name": "@wordpress/dom", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54014,7 +54015,7 @@ }, "packages/dom-ready": { "name": "@wordpress/dom-ready", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -54026,7 +54027,7 @@ }, "packages/e2e-test-utils": { "name": "@wordpress/e2e-test-utils", - "version": "11.1.0", + "version": "11.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54049,7 +54050,7 @@ }, "packages/e2e-test-utils-playwright": { "name": "@wordpress/e2e-test-utils-playwright", - "version": "1.1.0", + "version": "1.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54070,7 +54071,7 @@ }, "packages/e2e-tests": { "name": "@wordpress/e2e-tests", - "version": "8.1.0", + "version": "8.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54110,7 +54111,7 @@ }, "packages/edit-post": { "name": "@wordpress/edit-post", - "version": "8.1.0", + "version": "8.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54157,7 +54158,7 @@ }, "packages/edit-site": { "name": "@wordpress/edit-site", - "version": "6.1.0", + "version": "6.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54219,7 +54220,7 @@ }, "packages/edit-widgets": { "name": "@wordpress/edit-widgets", - "version": "6.1.0", + "version": "6.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54262,7 +54263,7 @@ }, "packages/editor": { "name": "@wordpress/editor", - "version": "14.1.0", + "version": "14.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54321,7 +54322,7 @@ }, "packages/element": { "name": "@wordpress/element", - "version": "6.1.0", + "version": "6.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54340,7 +54341,7 @@ }, "packages/env": { "name": "@wordpress/env", - "version": "10.1.0", + "version": "10.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54481,7 +54482,7 @@ }, "packages/escape-html": { "name": "@wordpress/escape-html", - "version": "3.1.0", + "version": "3.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -54493,7 +54494,7 @@ }, "packages/eslint-plugin": { "name": "@wordpress/eslint-plugin", - "version": "19.1.0", + "version": "19.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54536,7 +54537,7 @@ }, "packages/format-library": { "name": "@wordpress/format-library", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54564,7 +54565,7 @@ }, "packages/hooks": { "name": "@wordpress/hooks", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -54576,7 +54577,7 @@ }, "packages/html-entities": { "name": "@wordpress/html-entities", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -54588,7 +54589,7 @@ }, "packages/i18n": { "name": "@wordpress/i18n", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54608,7 +54609,7 @@ }, "packages/icons": { "name": "@wordpress/icons", - "version": "10.1.0", + "version": "10.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54622,7 +54623,7 @@ }, "packages/interactivity": { "name": "@wordpress/interactivity", - "version": "6.1.0", + "version": "6.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@preact/signals": "^1.2.2", @@ -54636,7 +54637,7 @@ }, "packages/interactivity-router": { "name": "@wordpress/interactivity-router", - "version": "2.1.0", + "version": "2.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@wordpress/interactivity": "file:../interactivity" @@ -54697,7 +54698,7 @@ }, "packages/interface": { "name": "@wordpress/interface", - "version": "6.1.0", + "version": "6.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54726,7 +54727,7 @@ }, "packages/is-shallow-equal": { "name": "@wordpress/is-shallow-equal", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -54738,7 +54739,7 @@ }, "packages/jest-console": { "name": "@wordpress/jest-console", - "version": "8.1.0", + "version": "8.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54755,7 +54756,7 @@ }, "packages/jest-preset-default": { "name": "@wordpress/jest-preset-default", - "version": "12.1.0", + "version": "12.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54773,7 +54774,7 @@ }, "packages/jest-puppeteer-axe": { "name": "@wordpress/jest-puppeteer-axe", - "version": "7.1.0", + "version": "7.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54796,7 +54797,7 @@ }, "packages/keyboard-shortcuts": { "name": "@wordpress/keyboard-shortcuts", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54814,7 +54815,7 @@ }, "packages/keycodes": { "name": "@wordpress/keycodes", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54827,7 +54828,7 @@ }, "packages/lazy-import": { "name": "@wordpress/lazy-import", - "version": "2.1.0", + "version": "2.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -54842,7 +54843,7 @@ }, "packages/list-reusable-blocks": { "name": "@wordpress/list-reusable-blocks", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54865,7 +54866,7 @@ }, "packages/media-utils": { "name": "@wordpress/media-utils", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54881,7 +54882,7 @@ }, "packages/notices": { "name": "@wordpress/notices", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54898,7 +54899,7 @@ }, "packages/npm-package-json-lint-config": { "name": "@wordpress/npm-package-json-lint-config", - "version": "5.1.0", + "version": "5.2.0", "dev": true, "license": "GPL-2.0-or-later", "engines": { @@ -54911,7 +54912,7 @@ }, "packages/nux": { "name": "@wordpress/nux", - "version": "9.1.0", + "version": "9.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54934,7 +54935,7 @@ }, "packages/patterns": { "name": "@wordpress/patterns", - "version": "2.1.0", + "version": "2.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54964,7 +54965,7 @@ }, "packages/plugins": { "name": "@wordpress/plugins", - "version": "7.1.0", + "version": "7.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -54987,7 +54988,7 @@ }, "packages/postcss-plugins-preset": { "name": "@wordpress/postcss-plugins-preset", - "version": "5.1.0", + "version": "5.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -55004,7 +55005,7 @@ }, "packages/postcss-themes": { "name": "@wordpress/postcss-themes", - "version": "6.1.0", + "version": "6.2.0", "dev": true, "license": "GPL-2.0-or-later", "engines": { @@ -55017,7 +55018,7 @@ }, "packages/preferences": { "name": "@wordpress/preferences", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55043,7 +55044,7 @@ }, "packages/preferences-persistence": { "name": "@wordpress/preferences-persistence", - "version": "2.1.0", + "version": "2.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55056,7 +55057,7 @@ }, "packages/prettier-config": { "name": "@wordpress/prettier-config", - "version": "4.1.0", + "version": "4.2.0", "dev": true, "license": "GPL-2.0-or-later", "engines": { @@ -55069,7 +55070,7 @@ }, "packages/primitives": { "name": "@wordpress/primitives", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55083,7 +55084,7 @@ }, "packages/priority-queue": { "name": "@wordpress/priority-queue", - "version": "3.1.0", + "version": "3.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55096,7 +55097,7 @@ }, "packages/private-apis": { "name": "@wordpress/private-apis", - "version": "1.1.0", + "version": "1.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -55108,7 +55109,7 @@ }, "packages/project-management-automation": { "name": "@wordpress/project-management-automation", - "version": "2.1.0", + "version": "2.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -55162,7 +55163,7 @@ }, "packages/react-i18n": { "name": "@wordpress/react-i18n", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55318,7 +55319,7 @@ }, "packages/readable-js-assets-webpack-plugin": { "name": "@wordpress/readable-js-assets-webpack-plugin", - "version": "3.1.0", + "version": "3.2.0", "dev": true, "license": "GPL-2.0-or-later", "engines": { @@ -55331,7 +55332,7 @@ }, "packages/redux-routine": { "name": "@wordpress/redux-routine", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55376,7 +55377,7 @@ }, "packages/reusable-blocks": { "name": "@wordpress/reusable-blocks", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55403,7 +55404,7 @@ }, "packages/rich-text": { "name": "@wordpress/rich-text", - "version": "7.1.0", + "version": "7.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55427,7 +55428,7 @@ }, "packages/router": { "name": "@wordpress/router", - "version": "1.1.0", + "version": "1.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55446,7 +55447,7 @@ }, "packages/scripts": { "name": "@wordpress/scripts", - "version": "28.1.0", + "version": "28.2.0", "dev": true, "license": "GPL-2.0-or-later", "dependencies": { @@ -55832,7 +55833,7 @@ }, "packages/server-side-render": { "name": "@wordpress/server-side-render", - "version": "5.1.0", + "version": "5.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55858,7 +55859,7 @@ }, "packages/shortcode": { "name": "@wordpress/shortcode", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55871,7 +55872,7 @@ }, "packages/style-engine": { "name": "@wordpress/style-engine", - "version": "2.1.0", + "version": "2.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55884,7 +55885,7 @@ }, "packages/stylelint-config": { "name": "@wordpress/stylelint-config", - "version": "22.1.0", + "version": "22.2.0", "dev": true, "license": "MIT", "dependencies": { @@ -55901,7 +55902,7 @@ }, "packages/sync": { "name": "@wordpress/sync", - "version": "1.1.0", + "version": "1.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55922,7 +55923,7 @@ }, "packages/token-list": { "name": "@wordpress/token-list", - "version": "3.1.0", + "version": "3.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -55934,7 +55935,7 @@ }, "packages/undo-manager": { "name": "@wordpress/undo-manager", - "version": "1.1.0", + "version": "1.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55947,7 +55948,7 @@ }, "packages/url": { "name": "@wordpress/url", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55960,7 +55961,7 @@ }, "packages/viewport": { "name": "@wordpress/viewport", - "version": "6.1.0", + "version": "6.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -55978,7 +55979,7 @@ }, "packages/warning": { "name": "@wordpress/warning", - "version": "3.1.0", + "version": "3.2.0", "license": "GPL-2.0-or-later", "engines": { "node": ">=18.12.0", @@ -55987,7 +55988,7 @@ }, "packages/widgets": { "name": "@wordpress/widgets", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0", @@ -56015,7 +56016,7 @@ }, "packages/wordcount": { "name": "@wordpress/wordcount", - "version": "4.1.0", + "version": "4.2.0", "license": "GPL-2.0-or-later", "dependencies": { "@babel/runtime": "^7.16.0" @@ -69039,6 +69040,7 @@ "@wordpress/core-data": "file:../core-data", "@wordpress/data": "file:../data", "@wordpress/element": "file:../element", + "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", "@wordpress/icons": "file:../icons", "@wordpress/private-apis": "file:../private-apis", diff --git a/package.json b/package.json index 9b025db89016ab..ea2e441ad758d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "18.6.1", + "version": "18.7.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 296d6771e3d1ad..d7098f67238bda 100644 --- a/packages/a11y/CHANGELOG.md +++ b/packages/a11y/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.2.0 (2024-06-26) + ## 4.1.0 (2024-06-15) ## 4.0.0 (2024-05-31) diff --git a/packages/a11y/package.json b/packages/a11y/package.json index a3c205af4905bb..0e9590381a290a 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/a11y", - "version": "4.1.0", + "version": "4.2.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 884c7582d758b1..b92426072f1351 100644 --- a/packages/annotations/CHANGELOG.md +++ b/packages/annotations/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.2.0 (2024-06-26) + ## 3.1.0 (2024-06-15) ## 3.0.0 (2024-05-31) diff --git a/packages/annotations/package.json b/packages/annotations/package.json index 8b2013129ba062..2f030df0e6cb96 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/annotations", - "version": "3.1.0", + "version": "3.2.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 0d3ff564df08c4..6abbab65d6a821 100644 --- a/packages/api-fetch/CHANGELOG.md +++ b/packages/api-fetch/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.2.0 (2024-06-26) + ## 7.1.0 (2024-06-15) ## 7.0.0 (2024-05-31) diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json index a245dcd9e9e236..112d5d8fb501d4 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/api-fetch", - "version": "7.1.0", + "version": "7.2.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 0d6fd502670517..cfff0201fc277e 100644 --- a/packages/autop/CHANGELOG.md +++ b/packages/autop/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.2.0 (2024-06-26) + ## 4.1.0 (2024-06-15) ### Internal diff --git a/packages/autop/package.json b/packages/autop/package.json index dc2850c225b9a9..a232e196e3c241 100644 --- a/packages/autop/package.json +++ b/packages/autop/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/autop", - "version": "4.1.0", + "version": "4.2.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 fd7411280670f4..7bb25199ff8471 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.2.0 (2024-06-26) + ## 5.1.0 (2024-06-15) ## 5.0.0 (2024-05-31) diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json index 4069427e2266f0..88d09cecebf374 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.1.0", + "version": "5.2.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 f6066a3b028eda..19214e1c791779 100644 --- a/packages/babel-plugin-makepot/CHANGELOG.md +++ b/packages/babel-plugin-makepot/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.2.0 (2024-06-26) + ## 6.1.0 (2024-06-15) ## 6.0.0 (2024-05-31) diff --git a/packages/babel-plugin-makepot/package.json b/packages/babel-plugin-makepot/package.json index 6e0f58ed11f21f..1ff539297bddb2 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.1.0", + "version": "6.2.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 3d6abcf94784ff..56b58422f47f35 100644 --- a/packages/babel-preset-default/CHANGELOG.md +++ b/packages/babel-preset-default/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 8.2.0 (2024-06-26) + ## 8.1.0 (2024-06-15) ## 8.0.0 (2024-05-31) diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json index 6e7f46a6480eb1..6a44e479bd02bd 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.1.0", + "version": "8.2.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 9da665ba27209a..89149ee5044f7a 100644 --- a/packages/base-styles/CHANGELOG.md +++ b/packages/base-styles/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.2.0 (2024-06-26) + ## 5.1.0 (2024-06-15) ## 5.0.0 (2024-05-31) diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json index 7d0f3abb46f421..b573693574d828 100644 --- a/packages/base-styles/package.json +++ b/packages/base-styles/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/base-styles", - "version": "5.1.0", + "version": "5.2.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 3950fa54c64d8a..c689b26bc5c8dc 100644 --- a/packages/blob/CHANGELOG.md +++ b/packages/blob/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.2.0 (2024-06-26) + ## 4.1.0 (2024-06-15) ### Internal diff --git a/packages/blob/package.json b/packages/blob/package.json index 335bf6cba82989..42b65ae434b21f 100644 --- a/packages/blob/package.json +++ b/packages/blob/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blob", - "version": "4.1.0", + "version": "4.2.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 cfd5b50dcb7f1b..1aca119d864bea 100644 --- a/packages/block-directory/CHANGELOG.md +++ b/packages/block-directory/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.2.0 (2024-06-26) + ## 5.1.0 (2024-06-15) ## 5.0.0 (2024-05-31) diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index 2aea90812b7b7a..d62b4adb9c0dcb 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "5.1.0", + "version": "5.2.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 7b9fd378f2b0d8..969e057850f74a 100644 --- a/packages/block-editor/CHANGELOG.md +++ b/packages/block-editor/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 13.2.0 (2024-06-26) + ## 13.1.0 (2024-06-15) ## 13.0.0 (2024-05-31) diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index 22bca4dc5c310a..7e16ca0e3f6f0f 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-editor", - "version": "13.1.0", + "version": "13.2.0", "description": "Generic block editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-editor/src/components/block-breadcrumb/index.js b/packages/block-editor/src/components/block-breadcrumb/index.js index b1fd13dbf3475a..70f038181237b4 100644 --- a/packages/block-editor/src/components/block-breadcrumb/index.js +++ b/packages/block-editor/src/components/block-breadcrumb/index.js @@ -12,6 +12,8 @@ import { chevronRightSmall, Icon } from '@wordpress/icons'; import BlockTitle from '../block-title'; import { store as blockEditorStore } from '../../store'; import { unlock } from '../../lock-unlock'; +import { __unstableUseBlockRef as useBlockRef } from '../block-list/use-block-props/use-block-refs'; +import getEditorRegion from '../../utils/get-editor-region'; /** * Block breadcrumb component, displaying the hierarchy of the current block selection as a breadcrumb. @@ -37,6 +39,10 @@ function BlockBreadcrumb( { rootLabelText } ) { }, [] ); const rootLabel = rootLabelText || __( 'Document' ); + // We don't care about this specific ref, but this is a way + // to get a ref within the editor canvas so we can focus it later. + const blockRef = useBlockRef( clientId ); + /* * Disable reason: The `list` ARIA role is redundant but * Safari+VoiceOver won't announce the list otherwise. @@ -60,7 +66,16 @@ function BlockBreadcrumb( { rootLabelText } ) { diff --git a/packages/block-editor/src/components/block-lock/modal.js b/packages/block-editor/src/components/block-lock/modal.js index cfafa6c031bbd1..11a03c5aff4dd8 100644 --- a/packages/block-editor/src/components/block-lock/modal.js +++ b/packages/block-editor/src/components/block-lock/modal.js @@ -13,7 +13,6 @@ import { ToggleControl, } from '@wordpress/components'; import { lock as lockIcon, unlock as unlockIcon } from '@wordpress/icons'; -import { useInstanceId } from '@wordpress/compose'; import { useDispatch, useSelect } from '@wordpress/data'; import { getBlockType } from '@wordpress/blocks'; @@ -64,10 +63,6 @@ export default function BlockLockModal( { clientId, onClose } ) { ); const { updateBlockAttributes } = useDispatch( blockEditorStore ); const blockInformation = useBlockDisplayInformation( clientId ); - const instanceId = useInstanceId( - BlockLockModal, - 'block-editor-block-lock-modal__options-title' - ); useEffect( () => { setLock( { @@ -90,11 +85,6 @@ export default function BlockLockModal( { clientId, onClose } ) { overlayClassName="block-editor-block-lock-modal" onRequestClose={ onClose } > -

- { __( - 'Choose specific attributes to restrict or lock all available options.' - ) } -

{ event.preventDefault(); @@ -107,84 +97,107 @@ export default function BlockLockModal( { clientId, onClose } ) { onClose(); } } > -
- { __( 'Lock all' ) } - } - checked={ isAllChecked } - indeterminate={ isMixed } - onChange={ ( newValue ) => - setLock( { - move: newValue, - remove: newValue, - ...( allowsEditLocking - ? { edit: newValue } - : {} ), - } ) - } - /> -
    - { allowsEditLocking && ( -
  • - - setLock( ( prevLock ) => ( { - ...prevLock, - edit, - } ) ) - } - /> - -
  • +
    + + { __( + 'Choose specific attributes to restrict or lock all available options.' ) } -
  • + + { /* + * Disable reason: The `list` ARIA role is redundant but + * Safari+VoiceOver won't announce the list otherwise. + */ + /* eslint-disable jsx-a11y/no-redundant-roles */ } +
      +
    • - setLock( ( prevLock ) => ( { - ...prevLock, - move, - } ) ) + className="block-editor-block-lock-modal__options-all" + label={ __( 'Lock all' ) } + checked={ isAllChecked } + indeterminate={ isMixed } + onChange={ ( newValue ) => + setLock( { + move: newValue, + remove: newValue, + ...( allowsEditLocking + ? { edit: newValue } + : {} ), + } ) } /> - -
    • -
    • - - setLock( ( prevLock ) => ( { - ...prevLock, - remove, - } ) ) - } - /> - +
        + { allowsEditLocking && ( +
      • + + setLock( ( prevLock ) => ( { + ...prevLock, + edit, + } ) ) + } + /> + +
      • + ) } +
      • + + setLock( ( prevLock ) => ( { + ...prevLock, + move, + } ) ) + } + /> + +
      • +
      • + + setLock( ( prevLock ) => ( { + ...prevLock, + remove, + } ) ) + } + /> + +
      • +
    + { /* eslint-enable jsx-a11y/no-redundant-roles */ } { hasTemplateLock && ( ) } -
+ - { + { sprintf( // translators: %s: Total number of patterns. - sprintf( - // translators: %s: Total number of patterns. - _n( '%s item', '%s items', totalItems ), - totalItems - ) - } + _n( '%s item', '%s items', totalItems ), + totalItems + ) } { numPages > 1 && ( diff --git a/packages/block-editor/src/components/block-patterns-paging/style.scss b/packages/block-editor/src/components/block-patterns-paging/style.scss index ce57f96cd327a5..383d4d72a8e38a 100644 --- a/packages/block-editor/src/components/block-patterns-paging/style.scss +++ b/packages/block-editor/src/components/block-patterns-paging/style.scss @@ -42,4 +42,22 @@ } } } + + @media screen and (min-width: $break-large) { + .block-editor-patterns__grid-pagination { + flex-direction: row; + .block-editor-patterns__grid-pagination-previous, + .block-editor-patterns__grid-pagination-next { + flex-direction: row; + } + } + } +} + +.block-editor-block-patterns-list .block-editor-patterns__grid-pagination { + flex-direction: column; + .block-editor-patterns__grid-pagination-previous, + .block-editor-patterns__grid-pagination-next { + flex-direction: column; + } } diff --git a/packages/block-editor/src/components/block-tools/block-selection-button.js b/packages/block-editor/src/components/block-tools/block-selection-button.js index d4ec0f8cf79fb6..805e41c580f950 100644 --- a/packages/block-editor/src/components/block-tools/block-selection-button.js +++ b/packages/block-editor/src/components/block-tools/block-selection-button.js @@ -9,7 +9,7 @@ import clsx from 'clsx'; import { dragHandle, trash } from '@wordpress/icons'; import { Button, Flex, FlexItem, ToolbarButton } from '@wordpress/components'; import { useSelect, useDispatch } from '@wordpress/data'; -import { useEffect, useRef } from '@wordpress/element'; +import { forwardRef, useEffect } from '@wordpress/element'; import { BACKSPACE, DELETE, @@ -48,10 +48,11 @@ import Shuffle from '../block-toolbar/shuffle'; * * @param {string} props Component props. * @param {string} props.clientId Client ID of block. + * @param {Object} ref Reference to the component. * * @return {Component} The component to be rendered. */ -function BlockSelectionButton( { clientId, rootClientId } ) { +function BlockSelectionButton( { clientId, rootClientId }, ref ) { const selected = useSelect( ( select ) => { const { @@ -125,7 +126,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) { canMove, } = selected; const { setNavigationMode, removeBlock } = useDispatch( blockEditorStore ); - const ref = useRef(); // Focus the breadcrumb in navigation mode. useEffect( () => { @@ -164,11 +164,6 @@ function BlockSelectionButton( { clientId, rootClientId } ) { const isEnter = keyCode === ENTER; const isSpace = keyCode === SPACE; const isShift = event.shiftKey; - if ( isEscape && editorMode === 'navigation' ) { - setNavigationMode( false ); - event.preventDefault(); - return; - } if ( keyCode === BACKSPACE || keyCode === DELETE ) { removeBlock( clientId ); @@ -368,4 +363,4 @@ function BlockSelectionButton( { clientId, rootClientId } ) { ); } -export default BlockSelectionButton; +export default forwardRef( BlockSelectionButton ); diff --git a/packages/block-editor/src/components/block-tools/block-toolbar-breadcrumb.js b/packages/block-editor/src/components/block-tools/block-toolbar-breadcrumb.js index 0ae67e1be0001e..ae03bdb4f51647 100644 --- a/packages/block-editor/src/components/block-tools/block-toolbar-breadcrumb.js +++ b/packages/block-editor/src/components/block-tools/block-toolbar-breadcrumb.js @@ -3,6 +3,11 @@ */ import clsx from 'clsx'; +/** + * WordPress dependencies + */ +import { forwardRef } from '@wordpress/element'; + /** * Internal dependencies */ @@ -11,10 +16,7 @@ import { PrivateBlockPopover } from '../block-popover'; import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props'; import useSelectedBlockToolProps from './use-selected-block-tool-props'; -export default function BlockToolbarBreadcrumb( { - clientId, - __unstableContentRef, -} ) { +function BlockToolbarBreadcrumb( { clientId, __unstableContentRef }, ref ) { const { capturingClientId, isInsertionPointVisible, @@ -38,9 +40,12 @@ export default function BlockToolbarBreadcrumb( { { ...popoverProps } > ); } + +export default forwardRef( BlockToolbarBreadcrumb ); diff --git a/packages/block-editor/src/components/block-tools/index.js b/packages/block-editor/src/components/block-tools/index.js index ad744a81cca623..5cde3cccaf57e5 100644 --- a/packages/block-editor/src/components/block-tools/index.js +++ b/packages/block-editor/src/components/block-tools/index.js @@ -25,6 +25,7 @@ import usePopoverScroll from '../block-popover/use-popover-scroll'; import ZoomOutModeInserters from './zoom-out-mode-inserters'; import { useShowBlockTools } from './use-show-block-tools'; import { unlock } from '../../lock-unlock'; +import getEditorRegion from '../../utils/get-editor-region'; function selector( select ) { const { @@ -81,6 +82,7 @@ export default function BlockTools( { } = useShowBlockTools(); const { + clearSelectedBlock, duplicateBlocks, removeBlocks, replaceBlocks, @@ -92,6 +94,8 @@ export default function BlockTools( { expandBlock, } = unlock( useDispatch( blockEditorStore ) ); + const blockSelectionButtonRef = useRef(); + function onKeyDown( event ) { if ( event.defaultPrevented ) { return; @@ -152,6 +156,13 @@ export default function BlockTools( { // block so that focus is directed back to the beginning of the selection. // In effect, to the user this feels like deselecting the multi-selection. selectBlock( clientIds[ 0 ] ); + } else if ( + clientIds.length === 1 && + event.target === blockSelectionButtonRef?.current + ) { + event.preventDefault(); + clearSelectedBlock(); + getEditorRegion( __unstableContentRef.current ).focus(); } } else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) { // If focus is currently within a text field, such as a rich text block or other editable field, @@ -182,7 +193,6 @@ export default function BlockTools( { } } } - const blockToolbarRef = usePopoverScroll( __unstableContentRef ); const blockToolbarAfterRef = usePopoverScroll( __unstableContentRef ); @@ -213,6 +223,7 @@ export default function BlockTools( { { showBreadcrumb && ( diff --git a/packages/block-editor/src/components/global-styles/background-panel.js b/packages/block-editor/src/components/global-styles/background-panel.js index 307c742befafda..d4b2468bf2a255 100644 --- a/packages/block-editor/src/components/global-styles/background-panel.js +++ b/packages/block-editor/src/components/global-styles/background-panel.js @@ -34,7 +34,7 @@ import { isBlobURL } from '@wordpress/blob'; /** * Internal dependencies */ -import { TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils'; +import { useToolsPanelDropdownMenuProps } from './utils'; import { setImmutably } from '../../utils/object'; import MediaReplaceFlow from '../media-replace-flow'; import { store as blockEditorStore } from '../../store'; @@ -600,6 +600,7 @@ function BackgroundToolsPanel( { children, headerLabel, } ) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter( value ); onChange( updatedValue ); @@ -612,7 +613,7 @@ function BackgroundToolsPanel( { label={ headerLabel } resetAll={ resetAll } panelId={ panelId } - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + dropdownMenuProps={ dropdownMenuProps } > { children } diff --git a/packages/block-editor/src/components/global-styles/border-panel.js b/packages/block-editor/src/components/global-styles/border-panel.js index a20bb15c044c51..cc7a464f8634a9 100644 --- a/packages/block-editor/src/components/global-styles/border-panel.js +++ b/packages/block-editor/src/components/global-styles/border-panel.js @@ -18,7 +18,7 @@ import { __ } from '@wordpress/i18n'; */ import BorderRadiusControl from '../border-radius-control'; import { useColorsPerOrigin } from './hooks'; -import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils'; +import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils'; import { setImmutably } from '../../utils/object'; import { useBorderPanelLabel } from '../../hooks/border'; import { ShadowPopover, useShadowPresets } from './shadow-panel-components'; @@ -69,6 +69,7 @@ function BorderToolsPanel( { children, label, } ) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter( value ); onChange( updatedValue ); @@ -79,7 +80,7 @@ function BorderToolsPanel( { label={ label } resetAll={ resetAll } panelId={ panelId } - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + dropdownMenuProps={ dropdownMenuProps } > { children } diff --git a/packages/block-editor/src/components/global-styles/color-panel.js b/packages/block-editor/src/components/global-styles/color-panel.js index 7b49ab453bb453..957d68edaf8492 100644 --- a/packages/block-editor/src/components/global-styles/color-panel.js +++ b/packages/block-editor/src/components/global-styles/color-panel.js @@ -27,7 +27,7 @@ import { __, sprintf } from '@wordpress/i18n'; */ import ColorGradientControl from '../colors-gradients/control'; import { useColorsPerOrigin, useGradientsPerOrigin } from './hooks'; -import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils'; +import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils'; import { setImmutably } from '../../utils/object'; import { unlock } from '../../lock-unlock'; @@ -116,6 +116,7 @@ function ColorToolsPanel( { panelId, children, } ) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter( value ); onChange( updatedValue ); @@ -131,7 +132,7 @@ function ColorToolsPanel( { className="color-block-support-panel" __experimentalFirstVisibleItemClass="first" __experimentalLastVisibleItemClass="last" - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + dropdownMenuProps={ dropdownMenuProps } >
{ children } diff --git a/packages/block-editor/src/components/global-styles/dimensions-panel.js b/packages/block-editor/src/components/global-styles/dimensions-panel.js index 9718545795f7c8..5711e16ffadcb1 100644 --- a/packages/block-editor/src/components/global-styles/dimensions-panel.js +++ b/packages/block-editor/src/components/global-styles/dimensions-panel.js @@ -22,7 +22,7 @@ import { useCallback, useState, Platform } from '@wordpress/element'; /** * Internal dependencies */ -import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils'; +import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils'; import SpacingSizesControl from '../spacing-sizes-control'; import HeightControl from '../height-control'; import ChildLayoutControl from '../child-layout-control'; @@ -175,6 +175,7 @@ function DimensionsToolsPanel( { panelId, children, } ) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter( value ); onChange( updatedValue ); @@ -185,7 +186,7 @@ function DimensionsToolsPanel( { label={ __( 'Dimensions' ) } resetAll={ resetAll } panelId={ panelId } - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + dropdownMenuProps={ dropdownMenuProps } > { children } diff --git a/packages/block-editor/src/components/global-styles/filters-panel.js b/packages/block-editor/src/components/global-styles/filters-panel.js index c22891684278b7..9eee1b3ff0ec75 100644 --- a/packages/block-editor/src/components/global-styles/filters-panel.js +++ b/packages/block-editor/src/components/global-styles/filters-panel.js @@ -28,7 +28,7 @@ import { useCallback, useMemo } from '@wordpress/element'; /** * Internal dependencies */ -import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils'; +import { getValueFromVariable, useToolsPanelDropdownMenuProps } from './utils'; import { setImmutably } from '../../utils/object'; const EMPTY_ARRAY = []; @@ -72,6 +72,7 @@ function FiltersToolsPanel( { panelId, children, } ) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetAll = () => { const updatedValue = resetAllFilter( value ); onChange( updatedValue ); @@ -82,7 +83,7 @@ function FiltersToolsPanel( { label={ _x( 'Filters', 'Name for applying graphical effects' ) } resetAll={ resetAll } panelId={ panelId } - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + dropdownMenuProps={ dropdownMenuProps } > { children } diff --git a/packages/block-editor/src/components/global-styles/image-settings-panel.js b/packages/block-editor/src/components/global-styles/image-settings-panel.js index 17c5ac1dd3112e..f668e7e5efc244 100644 --- a/packages/block-editor/src/components/global-styles/image-settings-panel.js +++ b/packages/block-editor/src/components/global-styles/image-settings-panel.js @@ -11,7 +11,7 @@ import { __, _x } from '@wordpress/i18n'; /** * Internal dependencies */ -import { TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils'; +import { useToolsPanelDropdownMenuProps } from './utils'; export function useHasImageSettingsPanel( name, value, inheritedValue ) { // Note: If lightbox `value` exists, that means it was @@ -30,6 +30,7 @@ export default function ImageSettingsPanel( { inheritedValue, panelId, } ) { + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const resetLightbox = () => { onChange( undefined ); }; @@ -52,7 +53,7 @@ export default function ImageSettingsPanel( { label={ _x( 'Settings', 'Image settings' ) } resetAll={ resetLightbox } panelId={ panelId } - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + dropdownMenuProps={ dropdownMenuProps } > { const updatedValue = resetAllFilter( value ); onChange( updatedValue ); @@ -145,7 +146,7 @@ function TypographyToolsPanel( { label={ __( 'Typography' ) } resetAll={ resetAll } panelId={ panelId } - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + dropdownMenuProps={ dropdownMenuProps } > { children } diff --git a/packages/block-editor/src/components/global-styles/utils.js b/packages/block-editor/src/components/global-styles/utils.js index 52752596594833..bf84e6f0b5765c 100644 --- a/packages/block-editor/src/components/global-styles/utils.js +++ b/packages/block-editor/src/components/global-styles/utils.js @@ -3,6 +3,11 @@ */ import fastDeepEqual from 'fast-deep-equal/es6'; +/** + * WordPress dependencies + */ +import { useViewportMatch } from '@wordpress/compose'; + /** * Internal dependencies */ @@ -136,12 +141,18 @@ export const STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = { 'typography.fontFamily': 'fontFamily', }; -export const TOOLSPANEL_DROPDOWNMENU_PROPS = { - popoverProps: { - placement: 'left-start', - offset: 259, // Inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) - }, -}; +export function useToolsPanelDropdownMenuProps() { + const isMobile = useViewportMatch( 'medium', '<' ); + return ! isMobile + ? { + popoverProps: { + placement: 'left-start', + // For non-mobile, inner sidebar width (248px) - button width (24px) - border (1px) + padding (16px) + spacing (20px) + offset: 259, + }, + } + : {}; +} function findInPresetsBy( features, diff --git a/packages/block-editor/src/components/inspector-controls/block-support-tools-panel.js b/packages/block-editor/src/components/inspector-controls/block-support-tools-panel.js index 3f67135ad3c104..3eee7bf1b09574 100644 --- a/packages/block-editor/src/components/inspector-controls/block-support-tools-panel.js +++ b/packages/block-editor/src/components/inspector-controls/block-support-tools-panel.js @@ -10,7 +10,7 @@ import { useCallback } from '@wordpress/element'; */ import { store as blockEditorStore } from '../../store'; import { cleanEmptyObject } from '../../hooks/utils'; -import { TOOLSPANEL_DROPDOWNMENU_PROPS } from '../global-styles/utils'; +import { useToolsPanelDropdownMenuProps } from '../global-styles/utils'; export default function BlockSupportToolsPanel( { children, group, label } ) { const { updateBlockAttributes } = useDispatch( blockEditorStore ); @@ -20,7 +20,7 @@ export default function BlockSupportToolsPanel( { children, group, label } ) { getSelectedBlockClientId, hasMultiSelection, } = useSelect( blockEditorStore ); - + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); const panelId = getSelectedBlockClientId(); const resetAll = useCallback( ( resetFilters = [] ) => { @@ -72,7 +72,7 @@ export default function BlockSupportToolsPanel( { children, group, label } ) { shouldRenderPlaceholderItems // Required to maintain fills ordering. __experimentalFirstVisibleItemClass="first" __experimentalLastVisibleItemClass="last" - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + dropdownMenuProps={ dropdownMenuProps } > { children } diff --git a/packages/block-editor/src/hooks/block-style-variation.js b/packages/block-editor/src/hooks/block-style-variation.js index 336db687558f52..21259966d8a63b 100644 --- a/packages/block-editor/src/hooks/block-style-variation.js +++ b/packages/block-editor/src/hooks/block-style-variation.js @@ -16,6 +16,7 @@ import { import { useStyleOverride } from './utils'; import { store as blockEditorStore } from '../store'; import { globalStylesDataKey } from '../store/private-keys'; +import { unlock } from '../lock-unlock'; const VARIATION_PREFIX = 'is-style-'; @@ -59,6 +60,126 @@ function getVariationNameFromClass( className, registeredStyles = [] ) { return null; } +// A helper component to apply a style override using the useStyleOverride hook. +function OverrideStyles( { override } ) { + useStyleOverride( override ); +} + +/** + * This component is used to generate new block style variation overrides + * based on an incoming theme config. If a matching style is found in the config, + * a new override is created and returned. The overrides can be used in conjunction with + * useStyleOverride to apply the new styles to the editor. Its use is + * subject to change. + * + * @param {Object} props Props. + * @param {Object} props.config A global styles object, containing settings and styles. + * @return {JSX.Element|undefined} An array of new block variation overrides. + */ +export function __unstableBlockStyleVariationOverridesWithConfig( { config } ) { + const { getBlockStyles, overrides } = useSelect( + ( select ) => ( { + getBlockStyles: select( blocksStore ).getBlockStyles, + overrides: unlock( select( blockEditorStore ) ).getStyleOverrides(), + } ), + [] + ); + const { getBlockName } = useSelect( blockEditorStore ); + + const overridesWithConfig = useMemo( () => { + if ( ! overrides?.length ) { + return; + } + const newOverrides = []; + const overriddenClientIds = []; + for ( const [ , override ] of overrides ) { + if ( + override?.variation && + override?.clientId && + /* + * Because this component overwrites existing style overrides, + * filter out any overrides that are already present in the store. + */ + ! overriddenClientIds.includes( override.clientId ) + ) { + const blockName = getBlockName( override.clientId ); + const configStyles = + config?.styles?.blocks?.[ blockName ]?.variations?.[ + override.variation + ]; + if ( configStyles ) { + const variationConfig = { + settings: config?.settings, + // The variation style data is all that is needed to generate + // the styles for the current application to a block. The variation + // name is updated to match the instance specific class name. + styles: { + blocks: { + [ blockName ]: { + variations: { + [ `${ override.variation }-${ override.clientId }` ]: + configStyles, + }, + }, + }, + }, + }; + const blockSelectors = getBlockSelectors( + getBlockTypes(), + getBlockStyles, + override.clientId + ); + const hasBlockGapSupport = false; + const hasFallbackGapSupport = true; + const disableLayoutStyles = true; + const disableRootPadding = true; + const variationStyles = toStyles( + variationConfig, + blockSelectors, + hasBlockGapSupport, + hasFallbackGapSupport, + disableLayoutStyles, + disableRootPadding, + { + blockGap: false, + blockStyles: true, + layoutStyles: false, + marginReset: false, + presets: false, + rootPadding: false, + variationStyles: true, + } + ); + newOverrides.push( { + id: `${ override.variation }-${ override.clientId }`, + css: variationStyles, + __unstableType: 'variation', + variation: override.variation, + // The clientId will be stored with the override and used to ensure + // the order of overrides matches the order of blocks so that the + // correct CSS cascade is maintained. + clientId: override.clientId, + } ); + overriddenClientIds.push( override.clientId ); + } + } + } + return newOverrides; + }, [ config, overrides, getBlockStyles, getBlockName ] ); + + if ( ! overridesWithConfig || ! overridesWithConfig.length ) { + return; + } + + return ( + <> + { overridesWithConfig.map( ( override ) => ( + + ) ) } + + ); +} + function useBlockStyleVariation( name, variation, clientId ) { // Prefer global styles data in GlobalStylesContext, which are available // if in the site editor. Otherwise fall back to whatever is in the @@ -157,6 +278,7 @@ function useBlockProps( { name, className, clientId } ) { id: `variation-${ clientId }`, css: variationStyles, __unstableType: 'variation', + variation, // The clientId will be stored with the override and used to ensure // the order of overrides matches the order of blocks so that the // correct CSS cascade is maintained. diff --git a/packages/block-editor/src/hooks/index.js b/packages/block-editor/src/hooks/index.js index 89e6819c1d0314..bd1835571fdd4a 100644 --- a/packages/block-editor/src/hooks/index.js +++ b/packages/block-editor/src/hooks/index.js @@ -88,3 +88,4 @@ export { getTypographyClassesAndStyles } from './use-typography-props'; export { getGapCSSValue } from './gap'; export { useCachedTruthy } from './use-cached-truthy'; export { useZoomOut } from './use-zoom-out'; +export { __unstableBlockStyleVariationOverridesWithConfig } from './block-style-variation'; diff --git a/packages/block-editor/src/hooks/use-bindings-attributes.js b/packages/block-editor/src/hooks/use-bindings-attributes.js index 7bd5df05d31eb4..7fb0793ed09c48 100644 --- a/packages/block-editor/src/hooks/use-bindings-attributes.js +++ b/packages/block-editor/src/hooks/use-bindings-attributes.js @@ -97,6 +97,7 @@ export const withBlockBindingSupport = createHigherOrderComponent( unlock( select( blocksStore ) ).getAllBlockBindingsSources() ); const { name, clientId, context } = props; + const hasParentPattern = !! props.context[ 'pattern/overrides' ]; const hasPatternOverridesDefaultBinding = props.attributes.metadata?.bindings?.[ DEFAULT_ATTRIBUTE ] ?.source === 'core/pattern-overrides'; @@ -216,13 +217,20 @@ export const withBlockBindingSupport = createHigherOrderComponent( } } - // Only apply normal attribute updates to blocks - // that have partial bindings. Currently this is - // only skipped for pattern overrides sources. if ( - ! hasPatternOverridesDefaultBinding && + // Don't update non-connected attributes if the block is using pattern overrides + // and the editing is happening while overriding the pattern (not editing the original). + ! ( + hasPatternOverridesDefaultBinding && + hasParentPattern + ) && Object.keys( keptAttributes ).length ) { + // Don't update caption and href until they are supported. + if ( hasPatternOverridesDefaultBinding ) { + delete keptAttributes?.caption; + delete keptAttributes?.href; + } setAttributes( keptAttributes ); } } ); @@ -236,6 +244,7 @@ export const withBlockBindingSupport = createHigherOrderComponent( setAttributes, sources, hasPatternOverridesDefaultBinding, + hasParentPattern, ] ); diff --git a/packages/block-editor/src/hooks/utils.js b/packages/block-editor/src/hooks/utils.js index d4eb7df553d3c0..26700ecf7b3fab 100644 --- a/packages/block-editor/src/hooks/utils.js +++ b/packages/block-editor/src/hooks/utils.js @@ -140,6 +140,7 @@ export function useStyleOverride( { css, assets, __unstableType, + variation, clientId, } = {} ) { const { setStyleOverride, deleteStyleOverride } = unlock( @@ -159,6 +160,7 @@ export function useStyleOverride( { css, assets, __unstableType, + variation, clientId, }; // Batch updates to style overrides to avoid triggering cascading renders diff --git a/packages/block-editor/src/private-apis.js b/packages/block-editor/src/private-apis.js index e6f3fc4cc39d6a..bfa6ac0c90c846 100644 --- a/packages/block-editor/src/private-apis.js +++ b/packages/block-editor/src/private-apis.js @@ -20,7 +20,11 @@ import { cleanEmptyObject, useStyleOverride } from './hooks/utils'; import BlockQuickNavigation from './components/block-quick-navigation'; import { LayoutStyle } from './components/block-list/layout'; import { BlockRemovalWarningModal } from './components/block-removal-warning-modal'; -import { useLayoutClasses, useLayoutStyles } from './hooks'; +import { + useLayoutClasses, + useLayoutStyles, + __unstableBlockStyleVariationOverridesWithConfig, +} from './hooks'; import DimensionsTool from './components/dimensions-tool'; import ResolutionTool from './components/resolution-tool'; import TextAlignmentControl from './components/text-alignment-control'; @@ -88,4 +92,5 @@ lock( privateApis, { PrivatePublishDateTimePicker, useSpacingSizes, useBlockDisplayTitle, + __unstableBlockStyleVariationOverridesWithConfig, } ); diff --git a/packages/block-editor/src/utils/get-editor-region.js b/packages/block-editor/src/utils/get-editor-region.js new file mode 100644 index 00000000000000..7edc57d1157fb4 --- /dev/null +++ b/packages/block-editor/src/utils/get-editor-region.js @@ -0,0 +1,31 @@ +/** + * Gets the editor region for a given editor canvas element or + * returns the passed element if no region is found + * + * @param { Object } editor The editor canvas element. + * @return { Object } The editor region or given editor element + */ +export default function getEditorRegion( editor ) { + if ( ! editor ) { + return null; + } + + // If there are multiple editors, we need to find the iframe that contains our contentRef to make sure + // we're focusing the region that contains this editor. + const editorCanvas = + Array.from( + document.querySelectorAll( 'iframe[name="editor-canvas"]' ).values() + ).find( ( iframe ) => { + // Find the iframe that contains our contentRef + const iframeDocument = + iframe.contentDocument || iframe.contentWindow.document; + + return iframeDocument === editor.ownerDocument; + } ) ?? editor; + + // The region is provivided by the editor, not the block-editor. + // We should send focus to the region if one is available to reuse the + // same interface for navigating landmarks. If no region is available, + // use the canvas instead. + return editorCanvas?.closest( '[role="region"]' ) ?? editorCanvas; +} diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md index e9c3a59524b280..8c5e3320c99b28 100644 --- a/packages/block-library/CHANGELOG.md +++ b/packages/block-library/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 9.2.0 (2024-06-26) + ## 9.1.0 (2024-06-15) ## 9.0.0 (2024-05-31) diff --git a/packages/block-library/package.json b/packages/block-library/package.json index 909fc9a53ee679..7a940fca79ba11 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-library", - "version": "9.1.0", + "version": "9.2.0", "description": "Block library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-library/src/block/block.json b/packages/block-library/src/block/block.json index 34dcb9a396ac6f..fdce3bcc02e07b 100644 --- a/packages/block-library/src/block/block.json +++ b/packages/block-library/src/block/block.json @@ -12,9 +12,13 @@ "type": "number" }, "content": { - "type": "object" + "type": "object", + "default": {} } }, + "providesContext": { + "pattern/overrides": "content" + }, "supports": { "customClassName": false, "html": false, diff --git a/packages/block-library/src/group/placeholder.js b/packages/block-library/src/group/placeholder.js index ed3e53c3eb2b9c..c7c4c6956e7d6a 100644 --- a/packages/block-library/src/group/placeholder.js +++ b/packages/block-library/src/group/placeholder.js @@ -139,6 +139,13 @@ function GroupPlaceHolder( { name, onSelect } ) { const blockProps = useBlockProps( { className: 'wp-block-group__placeholder', } ); + + useEffect( () => { + if ( variations && variations.length === 1 ) { + onSelect( variations[ 0 ] ); + } + }, [ onSelect, variations ] ); + return (
{ isResizable && dimensionsControl } @@ -443,16 +445,12 @@ export default function Image( { return {}; } const { getBlockBindingsSource } = unlock( select( blocksStore ) ); - const { getBlockParentsByBlockName } = unlock( - select( blockEditorStore ) - ); const { url: urlBinding, alt: altBinding, title: titleBinding, } = metadata?.bindings || {}; - const hasParentPattern = - getBlockParentsByBlockName( clientId, 'core/block' ).length > 0; + const hasParentPattern = !! context[ 'pattern/overrides' ]; const urlBindingSource = getBlockBindingsSource( urlBinding?.source ); @@ -508,7 +506,12 @@ export default function Image( { : __( 'Connected to dynamic data' ), }; }, - [ clientId, isSingleSelected, metadata?.bindings ] + [ + arePatternOverridesEnabled, + context, + isSingleSelected, + metadata?.bindings, + ] ); const showUrlInput = @@ -691,7 +694,7 @@ export default function Image( { { isSingleSelected && ( @@ -223,7 +224,7 @@ export default function QueryInspectorControls( props ) { } ); setQuerySearch( '' ); } } - dropdownMenuProps={ TOOLSPANEL_DROPDOWNMENU_PROPS } + dropdownMenuProps={ dropdownMenuProps } > { showTaxControl && ( -
{ computedRenderSelectedValue( currentValue ) }
+ { computedRenderSelectedValue( currentValue ) } ); }; @@ -88,11 +88,13 @@ function _CustomSelect( label, size, store, + className, ...restProps } = props; return ( - <> + // Where should `restProps` be forwarded to? +
{ hideLabelFromVision ? ( // TODO: Replace with BaseControl { label } ) : ( @@ -110,13 +112,18 @@ function _CustomSelect( size={ size } store={ store } /> - + { children } - +
); } diff --git a/packages/components/src/custom-select-control-v2/legacy-component/index.tsx b/packages/components/src/custom-select-control-v2/legacy-component/index.tsx index 41be4f58d9147f..209483775db9e4 100644 --- a/packages/components/src/custom-select-control-v2/legacy-component/index.tsx +++ b/packages/components/src/custom-select-control-v2/legacy-component/index.tsx @@ -3,6 +3,7 @@ */ // eslint-disable-next-line no-restricted-imports import * as Ariakit from '@ariakit/react'; +import clsx from 'clsx'; /** * Internal dependencies @@ -21,6 +22,7 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) { onChange, size = 'default', value, + className: classNameProp, ...restProps } = props; @@ -90,12 +92,12 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) { ); return ( - <> + { currentValue } { currentHint?.__experimentalHint } - + ); }; @@ -122,6 +124,10 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) { } size={ translatedSize } store={ store } + className={ clsx( + 'components-custom-select-control', + classNameProp + ) } { ...restProps } > { children } diff --git a/packages/components/src/custom-select-control-v2/styles.ts b/packages/components/src/custom-select-control-v2/styles.ts index 676a9c1a1ec590..5d6bb2c6a97cd7 100644 --- a/packages/components/src/custom-select-control-v2/styles.ts +++ b/packages/components/src/custom-select-control-v2/styles.ts @@ -10,16 +10,27 @@ import styled from '@emotion/styled'; */ import { COLORS, CONFIG } from '../utils'; import { space } from '../utils/space'; +import { chevronIconSize } from '../select-control/styles/select-control-styles'; import type { CustomSelectButtonSize } from './types'; const ITEM_PADDING = space( 2 ); +const truncateStyles = css` + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +`; + export const WithHintWrapper = styled.div` display: flex; justify-content: space-between; flex: 1; `; +export const SelectedExperimentalHintWrapper = styled.div` + ${ truncateStyles } +`; + export const SelectedExperimentalHintItem = styled.span` color: ${ COLORS.theme.gray[ 600 ] }; margin-inline-start: ${ space( 2 ) }; @@ -55,19 +66,18 @@ export const Select = styled( Ariakit.Select, { const sizes = { compact: { [ heightProperty ]: 32, - paddingInlineStart: space( 2 ), - paddingInlineEnd: space( 1 ), + paddingInlineStart: 8, + paddingInlineEnd: 8 + chevronIconSize, }, default: { [ heightProperty ]: 40, - paddingInlineStart: space( 4 ), - paddingInlineEnd: space( 3 ), + paddingInlineStart: 16, + paddingInlineEnd: 16 + chevronIconSize, }, small: { [ heightProperty ]: 24, - paddingInlineStart: space( 2 ), - paddingInlineEnd: space( 1 ), - fontSize: 11, + paddingInlineStart: 8, + paddingInlineEnd: 8 + chevronIconSize, }, }; @@ -75,13 +85,14 @@ export const Select = styled( Ariakit.Select, { }; return css` - display: flex; - align-items: center; - justify-content: space-between; + display: block; background-color: ${ COLORS.theme.background }; border: none; + color: ${ COLORS.theme.foreground }; cursor: pointer; + font-family: inherit; font-size: ${ CONFIG.fontSize }; + text-align: start; width: 100%; &[data-focus-visible] { @@ -89,14 +100,28 @@ export const Select = styled( Ariakit.Select, { } ${ getSize() } + ${ ! hasCustomRenderProp && truncateStyles } `; } ); export const SelectPopover = styled( Ariakit.SelectPopover )` + display: flex; + flex-direction: column; + + background-color: ${ COLORS.theme.background }; border-radius: 2px; - background: ${ COLORS.theme.background }; border: 1px solid ${ COLORS.theme.foreground }; + /* z-index(".components-popover") */ + z-index: 1000000; + + max-height: min( var( --popover-available-height, 400px ), 400px ); + overflow: auto; + overscroll-behavior: contain; + + // The smallest size without overflowing the container. + min-width: min-content; + &[data-focus-visible] { outline: none; // outline will be on the trigger, rather than the popover } diff --git a/packages/components/src/custom-select-control-v2/types.ts b/packages/components/src/custom-select-control-v2/types.ts index 12b41ba54f4a20..3c192cfa56711f 100644 --- a/packages/components/src/custom-select-control-v2/types.ts +++ b/packages/components/src/custom-select-control-v2/types.ts @@ -50,6 +50,10 @@ export type CustomSelectButtonProps = { }; export type _CustomSelectProps = CustomSelectButtonProps & { + /** + * Additional className added to the root wrapper element. + */ + className?: string; /** * The child elements. This should be composed of `CustomSelectItem` components. */ diff --git a/packages/components/src/higher-order/navigate-regions/style.scss b/packages/components/src/higher-order/navigate-regions/style.scss index b3a4a0c1a9d1b5..5c3767e310b8f4 100644 --- a/packages/components/src/higher-order/navigate-regions/style.scss +++ b/packages/components/src/higher-order/navigate-regions/style.scss @@ -1,22 +1,35 @@ // Allow the position to be easily overridden to e.g. fixed. + +@mixin region-selection-outline { + outline: 4px solid $components-color-accent; + outline-offset: -4px; +} + +@mixin region-selection-focus { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + content: ""; + pointer-events: none; + @include region-selection-outline; + z-index: z-index(".is-focusing-regions {region} :focus::after"); +} + [role="region"] { position: relative; + + // Handles the focus when we programatically send focus to this region + &.interface-interface-skeleton__content:focus-visible::after { + @include region-selection-focus; + } } .is-focusing-regions { [role="region"]:focus::after { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - content: ""; - pointer-events: none; - outline: 4px solid $components-color-accent; - outline-offset: -4px; - z-index: z-index(".is-focusing-regions {region} :focus::after"); + @include region-selection-focus; } - // Fixes for edge cases. // Some of the regions are currently used for layout purposes as 'interface skeleton' // items. When they're absolutely positioned or when they contain absolutely @@ -33,7 +46,6 @@ .interface-interface-skeleton__actions .editor-layout__toggle-publish-panel, .interface-interface-skeleton__actions .editor-layout__toggle-entities-saved-states-panel, .editor-post-publish-panel { - outline: 4px solid $components-color-accent; - outline-offset: -4px; + @include region-selection-outline; } } diff --git a/packages/compose/CHANGELOG.md b/packages/compose/CHANGELOG.md index 225798eb1f3a66..7c29649f5bce8e 100644 --- a/packages/compose/CHANGELOG.md +++ b/packages/compose/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.2.0 (2024-06-26) + ## 7.1.0 (2024-06-15) ## 7.0.0 (2024-05-31) diff --git a/packages/compose/package.json b/packages/compose/package.json index 953a2783248931..2f4ddbf49666a6 100644 --- a/packages/compose/package.json +++ b/packages/compose/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/compose", - "version": "7.1.0", + "version": "7.2.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 e320955adcfd19..77cf1361356a15 100644 --- a/packages/core-commands/CHANGELOG.md +++ b/packages/core-commands/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.2.0 (2024-06-26) + ## 1.1.0 (2024-06-15) ## 1.0.0 (2024-05-31) diff --git a/packages/core-commands/package.json b/packages/core-commands/package.json index 3ea0edbece9ad9..4180b6c356aaf7 100644 --- a/packages/core-commands/package.json +++ b/packages/core-commands/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-commands", - "version": "1.1.0", + "version": "1.2.0", "description": "WordPress core reusable commands.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", @@ -34,6 +34,7 @@ "@wordpress/core-data": "file:../core-data", "@wordpress/data": "file:../data", "@wordpress/element": "file:../element", + "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", "@wordpress/icons": "file:../icons", "@wordpress/private-apis": "file:../private-apis", diff --git a/packages/core-commands/src/site-editor-navigation-commands.js b/packages/core-commands/src/site-editor-navigation-commands.js index ba34fffd98824c..b575fd433f6d02 100644 --- a/packages/core-commands/src/site-editor-navigation-commands.js +++ b/packages/core-commands/src/site-editor-navigation-commands.js @@ -18,6 +18,7 @@ import { import { privateApis as routerPrivateApis } from '@wordpress/router'; import { addQueryArgs, getPath } from '@wordpress/url'; import { useDebounce } from '@wordpress/compose'; +import { decodeEntities } from '@wordpress/html-entities'; /** * Internal dependencies @@ -93,7 +94,7 @@ const getNavigationCommandLoaderPerPostType = ( postType ) => name: postType + '-' + record.id, searchLabel: record.title?.rendered + ' ' + record.id, label: record.title?.rendered - ? record.title?.rendered + ? decodeEntities( record.title?.rendered ) : __( '(no title)' ), icon: icons[ postType ], }; diff --git a/packages/core-data/CHANGELOG.md b/packages/core-data/CHANGELOG.md index 2971989bf35d49..c9157fba03a8b7 100644 --- a/packages/core-data/CHANGELOG.md +++ b/packages/core-data/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.2.0 (2024-06-26) + ## 7.1.0 (2024-06-15) ## 7.0.0 (2024-05-31) diff --git a/packages/core-data/package.json b/packages/core-data/package.json index a2cd136ea7d425..cb8376461c0678 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-data", - "version": "7.1.0", + "version": "7.2.0", "description": "Access to and manipulation of core WordPress entities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/create-block-interactive-template/CHANGELOG.md b/packages/create-block-interactive-template/CHANGELOG.md index a79a7c26c415fd..49a507443e6ce8 100644 --- a/packages/create-block-interactive-template/CHANGELOG.md +++ b/packages/create-block-interactive-template/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.2.0 (2024-06-26) + ## 2.1.0 (2024-06-15) ## 2.0.0 (2024-05-31) diff --git a/packages/create-block-interactive-template/package.json b/packages/create-block-interactive-template/package.json index 2752f36bd5f48e..ebdd119306ee2a 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.1.0", + "version": "2.2.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 f53046a8073c69..b5ea985dd15d14 100644 --- a/packages/create-block-tutorial-template/CHANGELOG.md +++ b/packages/create-block-tutorial-template/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.2.0 (2024-06-26) + ## 4.1.0 (2024-06-15) ## 4.0.0 (2024-05-31) diff --git a/packages/create-block-tutorial-template/package.json b/packages/create-block-tutorial-template/package.json index 5a557695b98886..25baa61ca23944 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.1.0", + "version": "4.2.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 01ad3cf768276b..1c3e863de790e9 100644 --- a/packages/create-block/CHANGELOG.md +++ b/packages/create-block/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.45.0 (2024-06-26) + ## 4.44.0 (2024-06-15) ### Bug fix diff --git a/packages/create-block/package.json b/packages/create-block/package.json index 9fe4b15655ffaa..44d2a598f4181c 100644 --- a/packages/create-block/package.json +++ b/packages/create-block/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block", - "version": "4.44.0", + "version": "4.45.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 5f822cb8babcc5..946dfe3e7dde6a 100644 --- a/packages/customize-widgets/CHANGELOG.md +++ b/packages/customize-widgets/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.2.0 (2024-06-26) + ## 5.1.0 (2024-06-15) ## 5.0.0 (2024-05-31) diff --git a/packages/customize-widgets/package.json b/packages/customize-widgets/package.json index ba05e60e5a0288..ec53f1efeaebcc 100644 --- a/packages/customize-widgets/package.json +++ b/packages/customize-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/customize-widgets", - "version": "5.1.0", + "version": "5.2.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 e0c1fb8b1ccd94..10a4d4dd758bbe 100644 --- a/packages/data-controls/CHANGELOG.md +++ b/packages/data-controls/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.2.0 (2024-06-26) + ## 4.1.0 (2024-06-15) ## 4.0.0 (2024-05-31) diff --git a/packages/data-controls/package.json b/packages/data-controls/package.json index e80259aba2b696..de6cc8a8908c44 100644 --- a/packages/data-controls/package.json +++ b/packages/data-controls/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data-controls", - "version": "4.1.0", + "version": "4.2.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 53300f7c15f249..7f9b439774cecf 100644 --- a/packages/data/CHANGELOG.md +++ b/packages/data/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 10.2.0 (2024-06-26) + ## 10.1.0 (2024-06-15) ## 10.0.0 (2024-05-31) diff --git a/packages/data/package.json b/packages/data/package.json index d74c410e20c40e..250e075a7972d6 100644 --- a/packages/data/package.json +++ b/packages/data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data", - "version": "10.1.0", + "version": "10.2.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 770402e6ffc8c9..a26c854fad8a75 100644 --- a/packages/dataviews/CHANGELOG.md +++ b/packages/dataviews/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.2.0 (2024-06-26) + ## 2.1.0 (2024-06-15) ## 2.0.0 (2024-05-31) diff --git a/packages/dataviews/package.json b/packages/dataviews/package.json index 5de3498c9f6471..c6213c42973eb0 100644 --- a/packages/dataviews/package.json +++ b/packages/dataviews/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dataviews", - "version": "2.1.0", + "version": "2.2.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/bulk-actions-toolbar.tsx b/packages/dataviews/src/bulk-actions-toolbar.tsx index 56a8aa58e7dc40..50a1386aadec0f 100644 --- a/packages/dataviews/src/bulk-actions-toolbar.tsx +++ b/packages/dataviews/src/bulk-actions-toolbar.tsx @@ -18,24 +18,24 @@ import { useRegistry } from '@wordpress/data'; * Internal dependencies */ import { ActionWithModal } from './item-actions'; -import type { Action, AnyItem } from './types'; +import type { Action } from './types'; import type { ActionTriggerProps } from './item-actions'; -interface ActionButtonProps< Item extends AnyItem > { +interface ActionButtonProps< Item > { action: Action< Item >; selectedItems: Item[]; actionInProgress: string | null; setActionInProgress: ( actionId: string | null ) => void; } -interface ToolbarContentProps< Item extends AnyItem > { +interface ToolbarContentProps< Item > { selection: string[]; actionsToShow: Action< Item >[]; selectedItems: Item[]; onSelectionChange: ( selection: Item[] ) => void; } -interface BulkActionsToolbarProps< Item extends AnyItem > { +interface BulkActionsToolbarProps< Item > { data: Item[]; selection: string[]; actions: Action< Item >[]; @@ -62,7 +62,7 @@ const SNACKBAR_VARIANTS = { }, }; -function ActionTrigger< Item extends AnyItem >( { +function ActionTrigger< Item >( { action, onClick, isBusy, @@ -87,7 +87,7 @@ function ActionTrigger< Item extends AnyItem >( { const EMPTY_ARRAY: [] = []; -function ActionButton< Item extends AnyItem >( { +function ActionButton< Item >( { action, selectedItems, actionInProgress, @@ -125,7 +125,7 @@ function ActionButton< Item extends AnyItem >( { ); } -function renderToolbarContent< Item extends AnyItem >( +function renderToolbarContent< Item >( selection: string[], actionsToShow: Action< Item >[], selectedItems: Item[], @@ -179,7 +179,7 @@ function renderToolbarContent< Item extends AnyItem >( ); } -function ToolbarContent< Item extends AnyItem >( { +function ToolbarContent< Item >( { selection, actionsToShow, selectedItems, @@ -214,7 +214,7 @@ function ToolbarContent< Item extends AnyItem >( { return buttons.current; } -export default function BulkActionsToolbar< Item extends AnyItem >( { +export default function BulkActionsToolbar< Item >( { data, selection, actions = EMPTY_ARRAY, diff --git a/packages/dataviews/src/bulk-actions.tsx b/packages/dataviews/src/bulk-actions.tsx index fd4d5c390948d4..7f743bbeea1a2d 100644 --- a/packages/dataviews/src/bulk-actions.tsx +++ b/packages/dataviews/src/bulk-actions.tsx @@ -14,7 +14,7 @@ import { useRegistry } from '@wordpress/data'; * Internal dependencies */ import { unlock } from './lock-unlock'; -import type { Action, ActionModal, AnyItem } from './types'; +import type { Action, ActionModal } from './types'; const { DropdownMenuV2: DropdownMenu, @@ -23,26 +23,26 @@ const { DropdownMenuSeparatorV2: DropdownMenuSeparator, } = unlock( componentsPrivateApis ); -interface ActionWithModalProps< Item extends AnyItem > { +interface ActionWithModalProps< Item > { action: ActionModal< Item >; selectedItems: Item[]; setActionWithModal: ( action?: ActionModal< Item > ) => void; onMenuOpenChange: ( isOpen: boolean ) => void; } -interface BulkActionsItemProps< Item extends AnyItem > { +interface BulkActionsItemProps< Item > { action: Action< Item >; selectedItems: Item[]; setActionWithModal: ( action?: ActionModal< Item > ) => void; } -interface ActionsMenuGroupProps< Item extends AnyItem > { +interface ActionsMenuGroupProps< Item > { actions: Action< Item >[]; selectedItems: Item[]; setActionWithModal: ( action?: ActionModal< Item > ) => void; } -interface BulkActionsProps< Item extends AnyItem > { +interface BulkActionsProps< Item > { data: Item[]; actions: Action< Item >[]; selection: string[]; @@ -50,7 +50,7 @@ interface BulkActionsProps< Item extends AnyItem > { getItemId: ( item: Item ) => string; } -export function useHasAPossibleBulkAction< Item extends AnyItem >( +export function useHasAPossibleBulkAction< Item >( actions: Action< Item >[], item: Item ) { @@ -64,7 +64,7 @@ export function useHasAPossibleBulkAction< Item extends AnyItem >( }, [ actions, item ] ); } -export function useSomeItemHasAPossibleBulkAction< Item extends AnyItem >( +export function useSomeItemHasAPossibleBulkAction< Item >( actions: Action< Item >[], data: Item[] ) { @@ -80,7 +80,7 @@ export function useSomeItemHasAPossibleBulkAction< Item extends AnyItem >( }, [ actions, data ] ); } -function ActionWithModal< Item extends AnyItem >( { +function ActionWithModal< Item >( { action, selectedItems, setActionWithModal, @@ -115,7 +115,7 @@ function ActionWithModal< Item extends AnyItem >( { ); } -function BulkActionItem< Item extends AnyItem >( { +function BulkActionItem< Item >( { action, selectedItems, setActionWithModal, @@ -150,7 +150,7 @@ function BulkActionItem< Item extends AnyItem >( { ); } -function ActionsMenuGroup< Item extends AnyItem >( { +function ActionsMenuGroup< Item >( { actions, selectedItems, setActionWithModal, @@ -172,7 +172,7 @@ function ActionsMenuGroup< Item extends AnyItem >( { ); } -export default function BulkActions< Item extends AnyItem >( { +export default function BulkActions< Item >( { data, actions, selection, diff --git a/packages/dataviews/src/dataviews.tsx b/packages/dataviews/src/dataviews.tsx index de4deb36659f40..476ed895ed5297 100644 --- a/packages/dataviews/src/dataviews.tsx +++ b/packages/dataviews/src/dataviews.tsx @@ -21,9 +21,11 @@ import { VIEW_LAYOUTS } from './layouts'; import BulkActions from './bulk-actions'; import { normalizeFields } from './normalize-fields'; import BulkActionsToolbar from './bulk-actions-toolbar'; -import type { Action, AnyItem, Field, View, ViewBaseProps } from './types'; +import type { Action, Field, View, ViewBaseProps } from './types'; -interface DataViewsProps< Item extends AnyItem > { +type ItemWithId = { id: string }; + +type DataViewsProps< Item > = { view: View; onChangeView: ( view: View ) => void; fields: Field< Item >[]; @@ -31,7 +33,6 @@ interface DataViewsProps< Item extends AnyItem > { searchLabel?: string; actions?: Action< Item >[]; data: Item[]; - getItemId?: ( item: Item ) => string; isLoading?: boolean; paginationInfo: { totalItems: number; @@ -41,12 +42,15 @@ interface DataViewsProps< Item extends AnyItem > { selection?: string[]; setSelection?: ( selection: string[] ) => void; onSelectionChange?: ( items: Item[] ) => void; -} +} & ( Item extends ItemWithId + ? { getItemId?: ( item: Item ) => string } + : { getItemId: ( item: Item ) => string } ); + +const defaultGetItemId = ( item: ItemWithId ) => item.id; -const defaultGetItemId = ( item: AnyItem ) => item.id; const defaultOnSelectionChange = () => {}; -function useSomeItemHasAPossibleBulkAction< Item extends AnyItem >( +function useSomeItemHasAPossibleBulkAction< Item >( actions: Action< Item >[], data: Item[] ) { @@ -62,7 +66,7 @@ function useSomeItemHasAPossibleBulkAction< Item extends AnyItem >( }, [ actions, data ] ); } -export default function DataViews< Item extends AnyItem >( { +export default function DataViews< Item >( { view, onChangeView, fields, diff --git a/packages/dataviews/src/filter-and-sort-data-view.ts b/packages/dataviews/src/filter-and-sort-data-view.ts index a2906fdc4869e3..a62cdcccf6b868 100644 --- a/packages/dataviews/src/filter-and-sort-data-view.ts +++ b/packages/dataviews/src/filter-and-sort-data-view.ts @@ -15,7 +15,7 @@ import { OPERATOR_IS_NOT_ALL, } from './constants'; import { normalizeFields } from './normalize-fields'; -import type { Field, AnyItem, View } from './types'; +import type { Field, View } from './types'; function normalizeSearchInput( input = '' ) { return removeAccents( input.trim().toLowerCase() ); @@ -32,7 +32,7 @@ const EMPTY_ARRAY: [] = []; * * @return Filtered, sorted and paginated data. */ -export function filterSortAndPaginate< Item extends AnyItem >( +export function filterSortAndPaginate< Item >( data: Item[], view: View, fields: Field< Item >[] diff --git a/packages/dataviews/src/filters.tsx b/packages/dataviews/src/filters.tsx index 0cf017fce191b1..187f34b532ddef 100644 --- a/packages/dataviews/src/filters.tsx +++ b/packages/dataviews/src/filters.tsx @@ -12,9 +12,9 @@ import AddFilter from './add-filter'; import ResetFilters from './reset-filters'; import { sanitizeOperators } from './utils'; import { ALL_OPERATORS, OPERATOR_IS, OPERATOR_IS_NOT } from './constants'; -import type { AnyItem, NormalizedField, NormalizedFilter, View } from './types'; +import type { NormalizedField, NormalizedFilter, View } from './types'; -interface FiltersProps< Item extends AnyItem > { +interface FiltersProps< Item > { fields: NormalizedField< Item >[]; view: View; onChangeView: ( view: View ) => void; @@ -22,7 +22,7 @@ interface FiltersProps< Item extends AnyItem > { setOpenedFilter: ( openedFilter: string | null ) => void; } -function _Filters< Item extends AnyItem >( { +function _Filters< Item >( { fields, view, onChangeView, diff --git a/packages/dataviews/src/item-actions.tsx b/packages/dataviews/src/item-actions.tsx index fa6aae3336464a..631bcbf485de33 100644 --- a/packages/dataviews/src/item-actions.tsx +++ b/packages/dataviews/src/item-actions.tsx @@ -21,7 +21,7 @@ import { useRegistry } from '@wordpress/data'; * Internal dependencies */ import { unlock } from './lock-unlock'; -import type { Action, ActionModal as ActionModalType, AnyItem } from './types'; +import type { Action, ActionModal as ActionModalType } from './types'; const { DropdownMenuV2: DropdownMenu, @@ -31,42 +31,41 @@ const { kebabCase, } = unlock( componentsPrivateApis ); -export interface ActionTriggerProps< Item extends AnyItem > { +export interface ActionTriggerProps< Item > { action: Action< Item >; onClick: MouseEventHandler; isBusy?: boolean; items: Item[]; } -interface ActionModalProps< Item extends AnyItem > { +interface ActionModalProps< Item > { action: ActionModalType< Item >; items: Item[]; closeModal?: () => void; } -interface ActionWithModalProps< Item extends AnyItem > - extends ActionModalProps< Item > { +interface ActionWithModalProps< Item > extends ActionModalProps< Item > { ActionTrigger: ( props: ActionTriggerProps< Item > ) => ReactElement; isBusy?: boolean; } -interface ActionsDropdownMenuGroupProps< Item extends AnyItem > { +interface ActionsDropdownMenuGroupProps< Item > { actions: Action< Item >[]; item: Item; } -interface ItemActionsProps< Item extends AnyItem > { +interface ItemActionsProps< Item > { item: Item; actions: Action< Item >[]; isCompact?: boolean; } -interface CompactItemActionsProps< Item extends AnyItem > { +interface CompactItemActionsProps< Item > { item: Item; actions: Action< Item >[]; } -function ButtonTrigger< Item extends AnyItem >( { +function ButtonTrigger< Item >( { action, onClick, items, @@ -84,7 +83,7 @@ function ButtonTrigger< Item extends AnyItem >( { ); } -function DropdownMenuItemTrigger< Item extends AnyItem >( { +function DropdownMenuItemTrigger< Item >( { action, onClick, items, @@ -101,7 +100,7 @@ function DropdownMenuItemTrigger< Item extends AnyItem >( { ); } -export function ActionModal< Item extends AnyItem >( { +export function ActionModal< Item >( { action, items, closeModal, @@ -124,7 +123,7 @@ export function ActionModal< Item extends AnyItem >( { ); } -export function ActionWithModal< Item extends AnyItem >( { +export function ActionWithModal< Item >( { action, items, ActionTrigger, @@ -153,7 +152,7 @@ export function ActionWithModal< Item extends AnyItem >( { ); } -export function ActionsDropdownMenuGroup< Item extends AnyItem >( { +export function ActionsDropdownMenuGroup< Item >( { actions, item, }: ActionsDropdownMenuGroupProps< Item > ) { @@ -186,7 +185,7 @@ export function ActionsDropdownMenuGroup< Item extends AnyItem >( { ); } -export default function ItemActions< Item extends AnyItem >( { +export default function ItemActions< Item >( { item, actions, isCompact, @@ -247,7 +246,7 @@ export default function ItemActions< Item extends AnyItem >( { ); } -function CompactItemActions< Item extends AnyItem >( { +function CompactItemActions< Item >( { item, actions, }: CompactItemActionsProps< Item > ) { diff --git a/packages/dataviews/src/normalize-fields.ts b/packages/dataviews/src/normalize-fields.ts index 2c5edd91070c7d..a7a9a47734a961 100644 --- a/packages/dataviews/src/normalize-fields.ts +++ b/packages/dataviews/src/normalize-fields.ts @@ -1,7 +1,7 @@ /** * Internal dependencies */ -import type { Field, AnyItem, NormalizedField } from './types'; +import type { Field, NormalizedField, ItemRecord } from './types'; /** * Apply default values and normalize the fields config. @@ -9,11 +9,13 @@ import type { Field, AnyItem, NormalizedField } from './types'; * @param fields Fields config. * @return Normalized fields config. */ -export function normalizeFields< Item extends AnyItem >( +export function normalizeFields< Item >( fields: Field< Item >[] ): NormalizedField< Item >[] { return fields.map( ( field ) => { - const getValue = field.getValue || ( ( { item } ) => item[ field.id ] ); + const getValue = + field.getValue || + ( ( { item }: { item: ItemRecord } ) => item[ field.id ] ); return { ...field, diff --git a/packages/dataviews/src/single-selection-checkbox.tsx b/packages/dataviews/src/single-selection-checkbox.tsx index 7c61b8e4aaa83c..84b359508663b3 100644 --- a/packages/dataviews/src/single-selection-checkbox.tsx +++ b/packages/dataviews/src/single-selection-checkbox.tsx @@ -7,9 +7,9 @@ import { CheckboxControl } from '@wordpress/components'; /** * Internal dependencies */ -import type { Field, AnyItem } from './types'; +import type { Field } from './types'; -interface SingleSelectionCheckboxProps< Item extends AnyItem > { +interface SingleSelectionCheckboxProps< Item > { selection: string[]; onSelectionChange: ( selection: Item[] ) => void; item: Item; @@ -19,7 +19,7 @@ interface SingleSelectionCheckboxProps< Item extends AnyItem > { disabled: boolean; } -export default function SingleSelectionCheckbox< Item extends AnyItem >( { +export default function SingleSelectionCheckbox< Item >( { selection, onSelectionChange, item, diff --git a/packages/dataviews/src/style.scss b/packages/dataviews/src/style.scss index 5844e0c9133369..ce3371f5eb06c4 100644 --- a/packages/dataviews/src/style.scss +++ b/packages/dataviews/src/style.scss @@ -191,10 +191,14 @@ box-shadow: inset 0 -#{$border-width} 0 $gray-100; padding-top: $grid-unit-10; padding-bottom: $grid-unit-10; + padding-left: $grid-unit-15; font-size: 11px; text-transform: uppercase; font-weight: 500; - padding-left: $grid-unit-05; + + &:has(.dataviews-view-table-header-button) { + padding-left: $grid-unit-05; + } } } tbody { @@ -759,7 +763,7 @@ padding: 0 $grid-unit-15; height: $grid-unit-40; background: $gray-100; - color: $gray-700; + color: $gray-800; position: relative; display: flex; align-items: center; diff --git a/packages/dataviews/src/types.ts b/packages/dataviews/src/types.ts index 8c1819b3a7c674..76b514755056a1 100644 --- a/packages/dataviews/src/types.ts +++ b/packages/dataviews/src/types.ts @@ -37,12 +37,12 @@ export type Operator = | 'isAll' | 'isNotAll'; -export type AnyItem = Record< string, any >; +export type ItemRecord = Record< string, unknown >; /** * A dataview field for a specific property of a data type. */ -export interface Field< Item extends AnyItem > { +export type Field< Item > = { /** * The unique identifier of the field. */ @@ -53,12 +53,6 @@ export interface Field< Item extends AnyItem > { */ header?: string; - /** - * Callback used to retrieve the value of the field from the item. - * Defaults to `item[ field.id ]`. - */ - getValue?: ( args: { item: Item } ) => any; - /** * Callback used to render the field. Defaults to `field.getValue`. */ @@ -103,17 +97,34 @@ export interface Field< Item extends AnyItem > { * Filter config for the field. */ filterBy?: FilterByConfig | undefined; -} - -export type NormalizedField< Item extends AnyItem > = Field< Item > & - Required< Pick< Field< Item >, 'header' | 'getValue' | 'render' > >; +} & ( Item extends ItemRecord + ? { + /** + * Callback used to retrieve the value of the field from the item. + * Defaults to `item[ field.id ]`. + */ + getValue?: ( args: { item: Item } ) => any; + } + : { + /** + * Callback used to retrieve the value of the field from the item. + * Defaults to `item[ field.id ]`. + */ + getValue: ( args: { item: Item } ) => any; + } ); + +export type NormalizedField< Item > = Field< Item > & { + header: string; + getValue: ( args: { item: Item } ) => any; + render: ( args: { item: Item } ) => ReactNode; +}; /** * A collection of dataview fields for a data type. */ -export type Fields< Item extends AnyItem > = Field< Item >[]; +export type Fields< Item > = Field< Item >[]; -export type Data< Item extends AnyItem > = Item[]; +export type Data< Item > = Item[]; /** * The filters applied to the dataset. @@ -216,7 +227,7 @@ interface ViewBase { /** * The hidden fields. */ - hiddenFields: string[]; + hiddenFields?: string[]; } export interface ViewTable extends ViewBase { @@ -279,7 +290,7 @@ export interface ViewGrid extends ViewBase { export type View = ViewList | ViewGrid | ViewTable; -interface ActionBase< Item extends AnyItem > { +interface ActionBase< Item > { /** * The unique identifier of the action. */ @@ -325,8 +336,7 @@ interface ActionBase< Item extends AnyItem > { supportsBulk?: boolean; } -export interface ActionModal< Item extends AnyItem > - extends ActionBase< Item > { +export interface ActionModal< Item > extends ActionBase< Item > { /** * Modal to render when the action is triggered. */ @@ -351,8 +361,7 @@ export interface ActionModal< Item extends AnyItem > modalHeader?: string; } -export interface ActionButton< Item extends AnyItem > - extends ActionBase< AnyItem > { +export interface ActionButton< Item > extends ActionBase< Item > { /** * The callback to execute when the action is triggered. */ @@ -365,11 +374,9 @@ export interface ActionButton< Item extends AnyItem > ) => void; } -export type Action< Item extends AnyItem > = - | ActionModal< Item > - | ActionButton< Item >; +export type Action< Item > = ActionModal< Item > | ActionButton< Item >; -export interface ViewBaseProps< Item extends AnyItem > { +export interface ViewBaseProps< Item > { actions: Action< Item >[]; data: Item[]; fields: NormalizedField< Item >[]; @@ -382,22 +389,19 @@ export interface ViewBaseProps< Item extends AnyItem > { view: View; } -export interface ViewTableProps< Item extends AnyItem > - extends ViewBaseProps< Item > { +export interface ViewTableProps< Item > extends ViewBaseProps< Item > { view: ViewTable; } -export interface ViewListProps< Item extends AnyItem > - extends ViewBaseProps< Item > { +export interface ViewListProps< Item > extends ViewBaseProps< Item > { view: ViewList; } -export interface ViewGridProps< Item extends AnyItem > - extends ViewBaseProps< Item > { +export interface ViewGridProps< Item > extends ViewBaseProps< Item > { view: ViewGrid; } -export type ViewProps< Item extends AnyItem > = +export type ViewProps< Item > = | ViewTableProps< Item > | ViewGridProps< Item > | ViewListProps< Item >; diff --git a/packages/dataviews/src/utils.ts b/packages/dataviews/src/utils.ts index d895289318da03..408288c5174897 100644 --- a/packages/dataviews/src/utils.ts +++ b/packages/dataviews/src/utils.ts @@ -8,11 +8,9 @@ import { OPERATOR_IS_ANY, OPERATOR_IS_NONE, } from './constants'; -import type { AnyItem, NormalizedField } from './types'; +import type { NormalizedField } from './types'; -export function sanitizeOperators< Item extends AnyItem >( - field: NormalizedField< Item > -) { +export function sanitizeOperators< Item >( field: NormalizedField< Item > ) { let operators = field.filterBy?.operators; // Assign default values. diff --git a/packages/dataviews/src/view-actions.tsx b/packages/dataviews/src/view-actions.tsx index 90098417575315..f83a5887065ec3 100644 --- a/packages/dataviews/src/view-actions.tsx +++ b/packages/dataviews/src/view-actions.tsx @@ -20,7 +20,7 @@ import { settings } from '@wordpress/icons'; import { unlock } from './lock-unlock'; import { SORTING_DIRECTIONS, sortLabels } from './constants'; import { VIEW_LAYOUTS } from './layouts'; -import type { AnyItem, NormalizedField, View } from './types'; +import type { NormalizedField, View } from './types'; const { DropdownMenuV2: DropdownMenu, @@ -42,19 +42,19 @@ interface PageSizeMenuProps { onChangeView: ( view: View ) => void; } -interface FieldsVisibilityMenuProps< Item extends AnyItem > { +interface FieldsVisibilityMenuProps< Item > { view: View; onChangeView: ( view: View ) => void; fields: NormalizedField< Item >[]; } -interface SortMenuProps< Item extends AnyItem > { +interface SortMenuProps< Item > { fields: NormalizedField< Item >[]; view: View; onChangeView: ( view: View ) => void; } -interface ViewActionsProps< Item extends AnyItem > { +interface ViewActionsProps< Item > { fields: NormalizedField< Item >[]; view: View; onChangeView: ( view: View ) => void; @@ -161,7 +161,7 @@ function PageSizeMenu( { view, onChangeView }: PageSizeMenuProps ) { ); } -function FieldsVisibilityMenu< Item extends AnyItem >( { +function FieldsVisibilityMenu< Item >( { view, onChangeView, fields, @@ -215,7 +215,7 @@ function FieldsVisibilityMenu< Item extends AnyItem >( { ); } -function SortMenu< Item extends AnyItem >( { +function SortMenu< Item >( { fields, view, onChangeView, @@ -303,7 +303,7 @@ function SortMenu< Item extends AnyItem >( { ); } -function _ViewActions< Item extends AnyItem >( { +function _ViewActions< Item >( { fields, view, onChangeView, diff --git a/packages/dataviews/src/view-grid.tsx b/packages/dataviews/src/view-grid.tsx index 77ac3c92738523..8fa9d6413d851d 100644 --- a/packages/dataviews/src/view-grid.tsx +++ b/packages/dataviews/src/view-grid.tsx @@ -22,9 +22,9 @@ import { __ } from '@wordpress/i18n'; import ItemActions from './item-actions'; import SingleSelectionCheckbox from './single-selection-checkbox'; import { useHasAPossibleBulkAction } from './bulk-actions'; -import type { Action, AnyItem, NormalizedField, ViewGridProps } from './types'; +import type { Action, NormalizedField, ViewGridProps } from './types'; -interface GridItemProps< Item extends AnyItem > { +interface GridItemProps< Item > { selection: string[]; data: Item[]; onSelectionChange: ( items: Item[] ) => void; @@ -38,7 +38,7 @@ interface GridItemProps< Item extends AnyItem > { columnFields?: string[]; } -function GridItem< Item extends AnyItem >( { +function GridItem< Item >( { selection, data, onSelectionChange, @@ -187,7 +187,7 @@ function GridItem< Item extends AnyItem >( { ); } -export default function ViewGrid< Item extends AnyItem >( { +export default function ViewGrid< Item >( { actions, data, fields, @@ -206,7 +206,7 @@ export default function ViewGrid< Item extends AnyItem >( { const { visibleFields, badgeFields } = fields.reduce( ( accumulator: Record< string, NormalizedField< Item >[] >, field ) => { if ( - view.hiddenFields.includes( field.id ) || + view.hiddenFields?.includes( field.id ) || [ view.layout.mediaField, view.layout.primaryField ].includes( field.id ) diff --git a/packages/dataviews/src/view-list.tsx b/packages/dataviews/src/view-list.tsx index 295c3d28856ebe..d6714a16e82df0 100644 --- a/packages/dataviews/src/view-list.tsx +++ b/packages/dataviews/src/view-list.tsx @@ -33,11 +33,11 @@ import { useRegistry } from '@wordpress/data'; * Internal dependencies */ import { unlock } from './lock-unlock'; -import type { Action, AnyItem, NormalizedField, ViewListProps } from './types'; +import type { Action, NormalizedField, ViewListProps } from './types'; import { ActionsDropdownMenuGroup, ActionModal } from './item-actions'; -interface ListViewItemProps< Item extends AnyItem > { +interface ListViewItemProps< Item > { actions: Action< Item >[]; id?: string; isSelected: boolean; @@ -57,7 +57,7 @@ const { DropdownMenuV2: DropdownMenu, } = unlock( componentsPrivateApis ); -function ListItem< Item extends AnyItem >( { +function ListItem< Item >( { actions, id, isSelected, @@ -303,9 +303,7 @@ function ListItem< Item extends AnyItem >( { ); } -export default function ViewList< Item extends AnyItem >( - props: ViewListProps< Item > -) { +export default function ViewList< Item >( props: ViewListProps< Item > ) { const { actions, data, @@ -329,7 +327,7 @@ export default function ViewList< Item extends AnyItem >( ); const visibleFields = fields.filter( ( field ) => - ! view.hiddenFields.includes( field.id ) && + ! view.hiddenFields?.includes( field.id ) && ! [ view.layout.primaryField, view.layout.mediaField ].includes( field.id ) diff --git a/packages/dataviews/src/view-table.tsx b/packages/dataviews/src/view-table.tsx index 2ddb09e2640a01..f09b46733e1a84 100644 --- a/packages/dataviews/src/view-table.tsx +++ b/packages/dataviews/src/view-table.tsx @@ -46,7 +46,6 @@ import { } from './bulk-actions'; import type { Action, - AnyItem, NormalizedField, SortDirection, ViewTable as ViewTableType, @@ -62,7 +61,7 @@ const { DropdownMenuSeparatorV2: DropdownMenuSeparator, } = unlock( componentsPrivateApis ); -interface HeaderMenuProps< Item extends AnyItem > { +interface HeaderMenuProps< Item > { field: NormalizedField< Item >; view: ViewTableType; onChangeView: ( view: ViewTableType ) => void; @@ -70,7 +69,7 @@ interface HeaderMenuProps< Item extends AnyItem > { setOpenedFilter: ( fieldId: string ) => void; } -interface BulkSelectionCheckboxProps< Item extends AnyItem > { +interface BulkSelectionCheckboxProps< Item > { selection: string[]; onSelectionChange: ( items: Item[] ) => void; data: Item[]; @@ -78,7 +77,7 @@ interface BulkSelectionCheckboxProps< Item extends AnyItem > { getItemId: ( item: Item ) => string; } -interface TableRowProps< Item extends AnyItem > { +interface TableRowProps< Item > { hasBulkActions: boolean; item: Item; actions: Action< Item >[]; @@ -102,7 +101,7 @@ function WithDropDownMenuSeparators( { children }: { children: ReactNode } ) { ) ); } -const _HeaderMenu = forwardRef( function HeaderMenu< Item extends AnyItem >( +const _HeaderMenu = forwardRef( function HeaderMenu< Item >( { field, view, @@ -223,9 +222,9 @@ const _HeaderMenu = forwardRef( function HeaderMenu< Item extends AnyItem >( onHide( field ); onChangeView( { ...view, - hiddenFields: view.hiddenFields.concat( - field.id - ), + hiddenFields: ( + view.hiddenFields ?? [] + ).concat( field.id ), } ); } } > @@ -240,12 +239,12 @@ const _HeaderMenu = forwardRef( function HeaderMenu< Item extends AnyItem >( } ); // @ts-expect-error Lift the `Item` type argument through the forwardRef. -const HeaderMenu: < Item extends AnyItem >( +const HeaderMenu: < Item >( props: PropsWithoutRef< HeaderMenuProps< Item > > & RefAttributes< HTMLButtonElement > ) => ReturnType< typeof _HeaderMenu > = _HeaderMenu; -function BulkSelectionCheckbox< Item extends AnyItem >( { +function BulkSelectionCheckbox< Item >( { selection, onSelectionChange, data, @@ -287,7 +286,7 @@ function BulkSelectionCheckbox< Item extends AnyItem >( { ); } -function TableRow< Item extends AnyItem >( { +function TableRow< Item >( { hasBulkActions, item, actions, @@ -425,7 +424,7 @@ function TableRow< Item extends AnyItem >( { ); } -function ViewTable< Item extends AnyItem >( { +function ViewTable< Item >( { actions, data, fields, @@ -473,7 +472,7 @@ function ViewTable< Item extends AnyItem >( { }; const visibleFields = fields.filter( ( field ) => - ! view.hiddenFields.includes( field.id ) && + ! view.hiddenFields?.includes( field.id ) && ! [ view.layout.mediaField ].includes( field.id ) ); const hasData = !! data?.length; diff --git a/packages/date/CHANGELOG.md b/packages/date/CHANGELOG.md index 7ff862abf3ba25..c3c526d31f93e7 100644 --- a/packages/date/CHANGELOG.md +++ b/packages/date/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.2.0 (2024-06-26) + ## 5.1.0 (2024-06-15) ## 5.0.0 (2024-05-31) diff --git a/packages/date/package.json b/packages/date/package.json index 46eae8f0e84969..c36acd44eed33a 100644 --- a/packages/date/package.json +++ b/packages/date/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/date", - "version": "5.1.0", + "version": "5.2.0", "description": "Date module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dependency-extraction-webpack-plugin/CHANGELOG.md b/packages/dependency-extraction-webpack-plugin/CHANGELOG.md index 2c31706a9e57da..84e4dc94f387c0 100644 --- a/packages/dependency-extraction-webpack-plugin/CHANGELOG.md +++ b/packages/dependency-extraction-webpack-plugin/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.2.0 (2024-06-26) + ## 6.1.0 (2024-06-15) ## 6.0.0 (2024-05-31) diff --git a/packages/dependency-extraction-webpack-plugin/package.json b/packages/dependency-extraction-webpack-plugin/package.json index f89a16fcb0c147..b0e08b7f4839bb 100644 --- a/packages/dependency-extraction-webpack-plugin/package.json +++ b/packages/dependency-extraction-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dependency-extraction-webpack-plugin", - "version": "6.1.0", + "version": "6.2.0", "description": "Extract WordPress script dependencies from webpack bundles.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/deprecated/CHANGELOG.md b/packages/deprecated/CHANGELOG.md index f08c61884d0cc4..100fcc4c507a5e 100644 --- a/packages/deprecated/CHANGELOG.md +++ b/packages/deprecated/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.2.0 (2024-06-26) + ## 4.1.0 (2024-06-15) ## 4.0.0 (2024-05-31) diff --git a/packages/deprecated/package.json b/packages/deprecated/package.json index a8991a5ca260c7..14531ff6acd77c 100644 --- a/packages/deprecated/package.json +++ b/packages/deprecated/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/deprecated", - "version": "4.1.0", + "version": "4.2.0", "description": "Deprecation utility for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/docgen/CHANGELOG.md b/packages/docgen/CHANGELOG.md index 3442e8359864e6..18120bb23751b6 100644 --- a/packages/docgen/CHANGELOG.md +++ b/packages/docgen/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.2.0 (2024-06-26) + ## 2.1.0 (2024-06-15) ## 2.0.0 (2024-05-31) diff --git a/packages/docgen/package.json b/packages/docgen/package.json index 6f1c8634514b87..9ff54b339c3d1c 100644 --- a/packages/docgen/package.json +++ b/packages/docgen/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/docgen", - "version": "2.1.0", + "version": "2.2.0", "description": "Autogenerate public API documentation from exports and JSDoc comments.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dom-ready/CHANGELOG.md b/packages/dom-ready/CHANGELOG.md index 572c4053b83fd9..e9995262d485a7 100644 --- a/packages/dom-ready/CHANGELOG.md +++ b/packages/dom-ready/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.2.0 (2024-06-26) + ## 4.1.0 (2024-06-15) ## 4.0.0 (2024-05-31) diff --git a/packages/dom-ready/package.json b/packages/dom-ready/package.json index 386b04a5f8fbb2..abf5ed3c6ebd2c 100644 --- a/packages/dom-ready/package.json +++ b/packages/dom-ready/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom-ready", - "version": "4.1.0", + "version": "4.2.0", "description": "Execute callback after the DOM is loaded.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dom/CHANGELOG.md b/packages/dom/CHANGELOG.md index e6f45cd3e8096e..2e4d5f764ebb7c 100644 --- a/packages/dom/CHANGELOG.md +++ b/packages/dom/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.2.0 (2024-06-26) + ## 4.1.0 (2024-06-15) ## 4.0.0 (2024-05-31) diff --git a/packages/dom/package.json b/packages/dom/package.json index 42393a456a3faa..eb29e016ba3446 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom", - "version": "4.1.0", + "version": "4.2.0", "description": "DOM utilities module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/e2e-test-utils-playwright/CHANGELOG.md b/packages/e2e-test-utils-playwright/CHANGELOG.md index d1a178094f5c94..98cd05130e0d41 100644 --- a/packages/e2e-test-utils-playwright/CHANGELOG.md +++ b/packages/e2e-test-utils-playwright/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.2.0 (2024-06-26) + ## 1.1.0 (2024-06-15) ## 1.0.0 (2024-05-31) diff --git a/packages/e2e-test-utils-playwright/package.json b/packages/e2e-test-utils-playwright/package.json index ae41aaaf8e21fb..e56a2d8e1211d9 100644 --- a/packages/e2e-test-utils-playwright/package.json +++ b/packages/e2e-test-utils-playwright/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-test-utils-playwright", - "version": "1.1.0", + "version": "1.2.0", "description": "End-To-End (E2E) test utils for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/e2e-test-utils/CHANGELOG.md b/packages/e2e-test-utils/CHANGELOG.md index 3f67b301ff9423..fde3509c494d74 100644 --- a/packages/e2e-test-utils/CHANGELOG.md +++ b/packages/e2e-test-utils/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 11.2.0 (2024-06-26) + ## 11.1.0 (2024-06-15) ## 11.0.0 (2024-05-31) diff --git a/packages/e2e-test-utils/package.json b/packages/e2e-test-utils/package.json index e246d68e2da3ab..9d05ec61e413c9 100644 --- a/packages/e2e-test-utils/package.json +++ b/packages/e2e-test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-test-utils", - "version": "11.1.0", + "version": "11.2.0", "description": "End-To-End (E2E) test utils for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/e2e-tests/CHANGELOG.md b/packages/e2e-tests/CHANGELOG.md index 23428a618aa362..59ba849c0c66f6 100644 --- a/packages/e2e-tests/CHANGELOG.md +++ b/packages/e2e-tests/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 8.2.0 (2024-06-26) + ## 8.1.0 (2024-06-15) ## 8.0.0 (2024-05-31) diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index 1990ffbc54f088..d2c58a6e3ff875 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-tests", - "version": "8.1.0", + "version": "8.2.0", "description": "End-To-End (E2E) tests for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-post/CHANGELOG.md b/packages/edit-post/CHANGELOG.md index 1f729223c957cd..a34ffb8a1c824b 100644 --- a/packages/edit-post/CHANGELOG.md +++ b/packages/edit-post/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 8.2.0 (2024-06-26) + ## 8.1.0 (2024-06-15) ### Bug Fixes diff --git a/packages/edit-post/package.json b/packages/edit-post/package.json index 1bab7905c74c16..603db6cad02a0f 100644 --- a/packages/edit-post/package.json +++ b/packages/edit-post/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-post", - "version": "8.1.0", + "version": "8.2.0", "description": "Edit Post module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-site/CHANGELOG.md b/packages/edit-site/CHANGELOG.md index 87c868f6e17220..7542e80b68266b 100644 --- a/packages/edit-site/CHANGELOG.md +++ b/packages/edit-site/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.2.0 (2024-06-26) + ## 6.1.0 (2024-06-15) ## 6.0.0 (2024-05-31) diff --git a/packages/edit-site/package.json b/packages/edit-site/package.json index 2e07e5a5cb9dff..b2aa60312fe68e 100644 --- a/packages/edit-site/package.json +++ b/packages/edit-site/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-site", - "version": "6.1.0", + "version": "6.2.0", "description": "Edit Site Page module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-site/src/components/global-styles/variations/variation.js b/packages/edit-site/src/components/global-styles/variations/variation.js index 1c1418a54931f8..d08116577b0c89 100644 --- a/packages/edit-site/src/components/global-styles/variations/variation.js +++ b/packages/edit-site/src/components/global-styles/variations/variation.js @@ -6,6 +6,7 @@ import clsx from 'clsx'; /** * WordPress dependencies */ +import { Tooltip } from '@wordpress/components'; import { useMemo, useContext, useState } from '@wordpress/element'; import { ENTER } from '@wordpress/keycodes'; import { __, sprintf } from '@wordpress/i18n'; @@ -23,7 +24,13 @@ const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock( blockEditorPrivateApis ); -export default function Variation( { variation, children, isPill, property } ) { +export default function Variation( { + variation, + children, + isPill, + property, + showTooltip, +} ) { const [ isFocused, setIsFocused ] = useState( false ); const { base, user, setUserConfig } = useContext( GlobalStylesContext ); @@ -64,30 +71,38 @@ export default function Variation( { variation, children, isPill, property } ) { ); } - return ( - + const content = ( +
setIsFocused( true ) } + onBlur={ () => setIsFocused( false ) } + >
setIsFocused( true ) } - onBlur={ () => setIsFocused( false ) } + className={ clsx( + 'edit-site-global-styles-variations_item-preview', + { 'is-pill': isPill } + ) } > -
- { children( isFocused ) } -
+ { children( isFocused ) }
+
+ ); + + return ( + + { showTooltip ? ( + { content } + ) : ( + content + ) } ); } diff --git a/packages/edit-site/src/components/global-styles/variations/variations-color.js b/packages/edit-site/src/components/global-styles/variations/variations-color.js index e84145afe2858e..6422ac0cb72d8e 100644 --- a/packages/edit-site/src/components/global-styles/variations/variations-color.js +++ b/packages/edit-site/src/components/global-styles/variations/variations-color.js @@ -32,6 +32,7 @@ export default function ColorVariations( { title, gap = 2 } ) { variation={ variation } isPill property="color" + showTooltip > { () => } diff --git a/packages/edit-site/src/components/global-styles/variations/variations-typography.js b/packages/edit-site/src/components/global-styles/variations/variations-typography.js index 689340cee9bd8e..2aa5aaf80ee1f5 100644 --- a/packages/edit-site/src/components/global-styles/variations/variations-typography.js +++ b/packages/edit-site/src/components/global-styles/variations/variations-typography.js @@ -39,6 +39,7 @@ export default function TypographyVariations( { title, gap = 2 } ) { key={ index } variation={ variation } property="typography" + showTooltip > { ( isFocused ) => ( -