From 753706d90cb319d62245aad6693c92c2db0441df Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Thu, 9 Sep 2021 04:19:49 +0300 Subject: [PATCH 01/14] Fix social links deprecation (#34639) --- packages/block-library/src/social-links/deprecated.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/block-library/src/social-links/deprecated.js b/packages/block-library/src/social-links/deprecated.js index 8f1ae2c42a68eb..a8344cb504c38b 100644 --- a/packages/block-library/src/social-links/deprecated.js +++ b/packages/block-library/src/social-links/deprecated.js @@ -78,6 +78,11 @@ const deprecated = [ type: 'string', }, }, + supports: { + align: [ 'left', 'center', 'right' ], + anchor: true, + __experimentalExposeControlsToChildren: true, + }, isEligible: ( { layout } ) => ! layout, migrate: migrateWithLayout, save( props ) { From 30bac4dc6d140da6591aba355c49c3c3e178f34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=B3=C5=82kowski?= Date: Thu, 9 Sep 2021 07:08:48 +0200 Subject: [PATCH 02/14] Block Editor: Rename experimental prop used in `BlockControls` (#34644) --- .../block-editor/src/components/block-controls/fill.js | 7 +++++-- .../block-editor/src/components/block-controls/hook.js | 6 +++--- packages/block-editor/src/hooks/align.js | 5 ++++- packages/block-editor/src/hooks/duotone.js | 2 +- packages/block-editor/src/layouts/flex.js | 2 +- packages/block-library/src/buttons/edit.js | 2 +- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/block-editor/src/components/block-controls/fill.js b/packages/block-editor/src/components/block-controls/fill.js index 10b94728306863..73c6a4c8c912f4 100644 --- a/packages/block-editor/src/components/block-controls/fill.js +++ b/packages/block-editor/src/components/block-controls/fill.js @@ -21,9 +21,12 @@ export default function BlockControlsFill( { group = 'default', controls, children, - __experimentalExposeToChildren = false, + __experimentalShareWithChildBlocks = false, } ) { - const Fill = useBlockControlsFill( group, __experimentalExposeToChildren ); + const Fill = useBlockControlsFill( + group, + __experimentalShareWithChildBlocks + ); if ( ! Fill ) { return null; } diff --git a/packages/block-editor/src/components/block-controls/hook.js b/packages/block-editor/src/components/block-controls/hook.js index d907a9aad5c364..caeb2fd9e04a06 100644 --- a/packages/block-editor/src/components/block-controls/hook.js +++ b/packages/block-editor/src/components/block-controls/hook.js @@ -12,7 +12,7 @@ import { store as blockEditorStore } from '../../store'; import { useBlockEditContext } from '../block-edit/context'; import useDisplayBlockControls from '../use-display-block-controls'; -export default function useBlockControlsFill( group, exposeToChildren ) { +export default function useBlockControlsFill( group, shareWithChildBlocks ) { const isDisplayed = useDisplayBlockControls(); const { clientId } = useBlockEditContext(); const isParentDisplayed = useSelect( @@ -22,7 +22,7 @@ export default function useBlockControlsFill( group, exposeToChildren ) { ); const { hasBlockSupport } = select( blocksStore ); return ( - exposeToChildren && + shareWithChildBlocks && hasBlockSupport( getBlockName( clientId ), '__experimentalExposeControlsToChildren', @@ -31,7 +31,7 @@ export default function useBlockControlsFill( group, exposeToChildren ) { hasSelectedInnerBlock( clientId ) ); }, - [ exposeToChildren, clientId ] + [ shareWithChildBlocks, clientId ] ); if ( isDisplayed ) { diff --git a/packages/block-editor/src/hooks/align.js b/packages/block-editor/src/hooks/align.js index c72b1aa29f796a..5a25d43385f2c6 100644 --- a/packages/block-editor/src/hooks/align.js +++ b/packages/block-editor/src/hooks/align.js @@ -140,7 +140,10 @@ export const withToolbarControls = createHigherOrderComponent( return ( <> { blockAllowedAlignments.length > 0 && ( - + + + - + Date: Thu, 9 Sep 2021 09:17:08 +0300 Subject: [PATCH 03/14] Update justication control in `flex` layout (#34651) * Update justication control in `flex` layout * use var value --- packages/block-editor/src/hooks/layout.scss | 6 ++ packages/block-editor/src/layouts/flex.js | 91 ++++++++++++--------- 2 files changed, 59 insertions(+), 38 deletions(-) diff --git a/packages/block-editor/src/hooks/layout.scss b/packages/block-editor/src/hooks/layout.scss index 3b06bc44478bad..9d154045c5a282 100644 --- a/packages/block-editor/src/hooks/layout.scss +++ b/packages/block-editor/src/hooks/layout.scss @@ -21,3 +21,9 @@ .block-editor-hooks__layout-controls-helptext { font-size: $helptext-font-size; } + +.block-editor-hooks__flex-layout-justification-controls { + legend { + margin-bottom: $grid-unit-10; + } +} diff --git a/packages/block-editor/src/layouts/flex.js b/packages/block-editor/src/layouts/flex.js index 63e1957ebd6914..fd8e446aa2ae00 100644 --- a/packages/block-editor/src/layouts/flex.js +++ b/packages/block-editor/src/layouts/flex.js @@ -1,11 +1,14 @@ /** * WordPress dependencies */ -import { __, _x } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { - __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, -} from '@wordpress/components'; + justifyLeft, + justifyCenter, + justifyRight, + justifySpaceBetween, +} from '@wordpress/icons'; +import { Button } from '@wordpress/components'; /** * Internal dependencies @@ -87,12 +90,40 @@ export default { }, }; +const justificationOptions = [ + { + value: 'left', + icon: justifyLeft, + label: __( 'Justify items left' ), + }, + { + value: 'center', + icon: justifyCenter, + label: __( 'Justify items center' ), + }, + { + value: 'right', + icon: justifyRight, + label: __( 'Justify items right' ), + }, + { + value: 'space-between', + icon: justifySpaceBetween, + label: __( 'Space between items' ), + }, +]; function FlexLayoutJustifyContentControl( { layout, onChange, isToolbar = false, } ) { const { justifyContent = 'left' } = layout; + const onJustificationChange = ( value ) => { + onChange( { + ...layout, + justifyContent: value, + } ); + }; if ( isToolbar ) { return ( { - onChange( { - ...layout, - justifyContent: value, - } ); - } } + onChange={ onJustificationChange } popoverProps={ { position: 'bottom right', isAlternate: true, @@ -116,34 +142,23 @@ function FlexLayoutJustifyContentControl( { /> ); } + return ( - { - onChange( { - ...layout, - justifyContent: value, - } ); - } } - isBlock - > - - - - - +
+ { __( 'Justification' ) } +
+ { justificationOptions.map( ( { value, icon, label } ) => { + return ( +
+
); } From 96cdb3be51bc2ca18c78e818eeea8158b54aa432 Mon Sep 17 00:00:00 2001 From: Paul Bunkham Date: Thu, 9 Sep 2021 08:20:50 +0100 Subject: [PATCH 04/14] Scripts: Convert legacy entry point arguments for compatibility with webpack 5 (#34264) * Remove code to convert entrypoint argument conversion * Change entrypoint configuration to be passed by environment variables. * Change the operator to support older versions of node. * Change the logic to support = syntax for specifying output filenames. * Refactor the logic to use `process.env.WP_ENTRY` * Update webpack.config.js * Apply suggestions from code review * Update packages/scripts/config/webpack.config.js * Improve handling when `--entry` arg present Co-authored-by: Grzegorz Ziolkowski --- packages/scripts/CHANGELOG.md | 1 + packages/scripts/config/webpack.config.js | 22 ++++++++-- packages/scripts/utils/config.js | 53 +++++++++++++++-------- 3 files changed, 54 insertions(+), 22 deletions(-) diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 37d3a111e51ab3..36a20b270b3dd0 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -9,6 +9,7 @@ ### Bug Fixes - Bring back support for SVG files in CSS ([#34394](https://github.com/WordPress/gutenberg/pull/34394)). It wasn't correctly migrated when integrating webpack v5. +- Convert legacy entry point arguments supported in webpack 4 for compatibility with webpack 5 ([#34264](https://github.com/WordPress/gutenberg/pull/34264)). ## 18.0.0 (2021-08-23) diff --git a/packages/scripts/config/webpack.config.js b/packages/scripts/config/webpack.config.js index 5bbc0a43e18b90..206834ee8c5f77 100644 --- a/packages/scripts/config/webpack.config.js +++ b/packages/scripts/config/webpack.config.js @@ -7,6 +7,7 @@ const MiniCSSExtractPlugin = require( 'mini-css-extract-plugin' ); const TerserPlugin = require( 'terser-webpack-plugin' ); const { CleanWebpackPlugin } = require( 'clean-webpack-plugin' ); const browserslist = require( 'browserslist' ); +const fs = require( 'fs' ); const path = require( 'path' ); /** @@ -31,6 +32,23 @@ let target = 'browserslist'; if ( ! browserslist.findConfig( '.' ) ) { target += ':' + fromConfigRoot( '.browserslistrc' ); } +let entry = {}; +if ( process.env.WP_ENTRY ) { + entry = JSON.parse( process.env.WP_ENTRY ); +} else { + // By default the script checks if `src/index.js` exists and sets it as an entry point. + // In the future we should add similar handling for `src/script.js` and `src/view.js`. + [ 'index' ].forEach( ( entryName ) => { + const filepath = path.resolve( + process.cwd(), + 'src', + `${ entryName }.js` + ); + if ( fs.existsSync( filepath ) ) { + entry[ entryName ] = filepath; + } + } ); +} const cssLoaders = [ { @@ -88,9 +106,7 @@ const getLiveReloadPort = ( inputPort ) => { const config = { mode, target, - entry: { - index: path.resolve( process.cwd(), 'src', 'index.js' ), - }, + entry, output: { filename: '[name].js', path: path.resolve( process.cwd(), 'build' ), diff --git a/packages/scripts/utils/config.js b/packages/scripts/utils/config.js index a0eaf84cb3d71d..62333018dfed35 100644 --- a/packages/scripts/utils/config.js +++ b/packages/scripts/utils/config.js @@ -108,38 +108,53 @@ const getWebpackArgs = () => { const hasWebpackOutputOption = hasArgInCLI( '-o' ) || hasArgInCLI( '--output' ); - if ( hasFileArgInCLI() && ! hasWebpackOutputOption ) { + if ( + ! hasWebpackOutputOption && + ! hasArgInCLI( '--entry' ) && + hasFileArgInCLI() + ) { /** - * Converts a path to the entry format supported by webpack, e.g.: - * `./entry-one.js` -> `entry-one=./entry-one.js` - * `entry-two.js` -> `entry-two=./entry-two.js` + * Converts a legacy path to the entry pair supported by webpack, e.g.: + * `./entry-one.js` -> `[ 'entry-one', './entry-one.js] ]` + * `entry-two.js` -> `[ 'entry-two', './entry-two.js' ]` * * @param {string} path The path provided. * - * @return {string} The entry format supported by webpack. + * @return {string[]} The entry pair of its name and the file path. */ const pathToEntry = ( path ) => { - const entry = basename( path, '.js' ); + const entryName = basename( path, '.js' ); if ( ! path.startsWith( './' ) ) { path = './' + path; } - return [ entry, path ].join( '=' ); + return [ entryName, path ]; }; - // The following handles the support for multiple entry points in webpack, e.g.: - // `wp-scripts build one.js custom=./two.js` -> `webpack one=./one.js custom=./two.js` - webpackArgs = webpackArgs.map( ( cliArg ) => { - if ( - getFileArgsFromCLI().includes( cliArg ) && - ! cliArg.includes( '=' ) - ) { - return pathToEntry( cliArg ); - } - - return cliArg; - } ); + const fileArgs = getFileArgsFromCLI(); + if ( fileArgs.length > 0 ) { + // Filters out all CLI arguments that are recognized as file paths. + const fileArgsToRemove = new Set( fileArgs ); + webpackArgs = webpackArgs.filter( ( cliArg ) => { + if ( fileArgsToRemove.has( cliArg ) ) { + fileArgsToRemove.delete( cliArg ); + return false; + } + return true; + } ); + + // Converts all CLI arguments that are file paths to the `entry` format supported by webpack. + // It is going to be consumed in the config through the WP_ENTRY global variable. + const entry = {}; + fileArgs.forEach( ( fileArg ) => { + const [ entryName, path ] = fileArg.includes( '=' ) + ? fileArg.split( '=' ) + : pathToEntry( fileArg ); + entry[ entryName ] = path; + } ); + process.env.WP_ENTRY = JSON.stringify( entry ); + } } if ( ! hasWebpackConfig() ) { From b1e6865b22eae1e11c17200a36b3271672b55f68 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 9 Sep 2021 10:05:11 +0200 Subject: [PATCH 05/14] [RNMobile] [Embed block] Fix content disappearing on Android when switching light/dark mode (#34207) * Add dark/light mode value in sandbox key for Android * Use usePreferredColorScheme hook * Fetch color scheme in sandbox component directly * Update react-native-editor changelog Additionally I added a a missing entry related to the WP embed component implementation. --- packages/components/src/sandbox/index.native.js | 12 +++++++++--- packages/react-native-editor/CHANGELOG.md | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/components/src/sandbox/index.native.js b/packages/components/src/sandbox/index.native.js index cde05eeca8fcb6..0cc52f1b880507 100644 --- a/packages/components/src/sandbox/index.native.js +++ b/packages/components/src/sandbox/index.native.js @@ -14,6 +14,7 @@ import { useState, useEffect, } from '@wordpress/element'; +import { usePreferredColorScheme } from '@wordpress/compose'; /** * Internal dependencies @@ -162,6 +163,7 @@ function Sandbox( { type, url, } ) { + const colorScheme = usePreferredColorScheme(); const ref = useRef(); const [ height, setHeight ] = useState( 0 ); const [ contentHtml, setContentHtml ] = useState( getHtmlDoc() ); @@ -171,10 +173,14 @@ function Sandbox( { windowSize.width >= windowSize.height ); const wasLandscape = useRef( isLandscape ); - // On Android, we need to recreate the WebView when the device rotates, otherwise it disappears. - // For this purpose, the key value used in the WebView will change when the device orientation gets updated. + // On Android, we need to recreate the WebView on any of the following actions, otherwise it disappears: + // - Device rotation + // - Light/dark mode changes + // For this purpose, the key prop used in the WebView will be updated with the value of the actions. const key = Platform.select( { - android: `${ url }-${ isLandscape ? 'landscape' : 'portrait' }`, + android: `${ url }-${ + isLandscape ? 'landscape' : 'portrait' + }-${ colorScheme }`, ios: url, } ); diff --git a/packages/react-native-editor/CHANGELOG.md b/packages/react-native-editor/CHANGELOG.md index 80ff9080ab94af..519b20f7c3fefd 100644 --- a/packages/react-native-editor/CHANGELOG.md +++ b/packages/react-native-editor/CHANGELOG.md @@ -10,6 +10,8 @@ For each user feature we should also add a importance categorization label to i --> ## Unreleased +- [**] [Embed block] Implement WP embed preview component [#34004] +- [*] [Embed block] Fix content disappearing on Android when switching light/dark mode [#34207] ## 1.61.0 - [**] Enable embed preview for a list of providers (for now only YouTube and Twitter) [#34446] From 8334544200cf28d9218defefb649fe511515fa09 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Thu, 9 Sep 2021 10:03:36 +0200 Subject: [PATCH 06/14] Update changelog files --- packages/base-styles/CHANGELOG.md | 2 ++ packages/base-styles/package.json | 2 +- packages/block-library/CHANGELOG.md | 2 ++ packages/block-library/package.json | 2 +- packages/blocks/CHANGELOG.md | 2 ++ packages/blocks/package.json | 2 +- packages/components/CHANGELOG.md | 2 ++ packages/components/package.json | 2 +- packages/data/CHANGELOG.md | 2 ++ packages/data/package.json | 2 +- packages/e2e-tests/CHANGELOG.md | 2 ++ packages/e2e-tests/package.json | 2 +- packages/eslint-plugin/CHANGELOG.md | 2 ++ packages/eslint-plugin/package.json | 2 +- packages/interface/CHANGELOG.md | 2 ++ packages/interface/package.json | 2 +- packages/jest-preset-default/CHANGELOG.md | 2 ++ packages/jest-preset-default/package.json | 2 +- packages/scripts/CHANGELOG.md | 2 ++ packages/scripts/package.json | 2 +- 20 files changed, 30 insertions(+), 10 deletions(-) diff --git a/packages/base-styles/CHANGELOG.md b/packages/base-styles/CHANGELOG.md index cdb47947993e64..b9df42c4788cc3 100644 --- a/packages/base-styles/CHANGELOG.md +++ b/packages/base-styles/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.0.0 (2021-09-09) + ### Breaking Change - Remove the background-colors, foreground-colors, and gradient-colors mixins. diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json index 53835f4af3ab35..3b9d48f4ce4993 100644 --- a/packages/base-styles/package.json +++ b/packages/base-styles/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/base-styles", - "version": "3.6.0", + "version": "4.0.0-prerelease", "description": "Base SCSS utilities and variables for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md index eccd2681c7d277..887f5eb6b8005e 100644 --- a/packages/block-library/CHANGELOG.md +++ b/packages/block-library/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.0.0 (2021-09-09) + ### Breaking Change - Remove the background-colors, foreground-colors, and gradient-colors mixins. diff --git a/packages/block-library/package.json b/packages/block-library/package.json index 4ad410cac248dc..914c31ab767699 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-library", - "version": "5.0.1", + "version": "6.0.0-prerelease", "description": "Block library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blocks/CHANGELOG.md b/packages/blocks/CHANGELOG.md index 486282484503c1..dff492d2473da7 100644 --- a/packages/blocks/CHANGELOG.md +++ b/packages/blocks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 11.1.0 (2021-09-09) + ### Backward Compatibility - Register a block even when an invalid value provided for the icon setting ([#34350](https://github.com/WordPress/gutenberg/pull/34350)). diff --git a/packages/blocks/package.json b/packages/blocks/package.json index e7c759dbe59137..b60c50784a0e42 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blocks", - "version": "11.0.1", + "version": "11.1.0-prerelease", "description": "Block API for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 4d943b62a9d921..03a9cea7f06e63 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 17.0.0 (2021-09-09) + ### Breaking Change - Removed a min-width from the `DropdownMenu` component, allowing the menu to accommodate thin contents like vertical tools menus ([#33995](https://github.com/WordPress/gutenberg/pull/33995)). diff --git a/packages/components/package.json b/packages/components/package.json index c4679b1a6485fe..21cf7055582844 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/components", - "version": "16.0.0", + "version": "17.0.0-prerelease", "description": "UI components for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/data/CHANGELOG.md b/packages/data/CHANGELOG.md index 1a359b8343c8b1..f2c2e91e292dc9 100644 --- a/packages/data/CHANGELOG.md +++ b/packages/data/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.1.0 (2021-09-09) + ### New Features - Added a `batch` registry method to batch dispatch calls for performance reasons. diff --git a/packages/data/package.json b/packages/data/package.json index 7d3fa835579db7..1352a945b22a5e 100644 --- a/packages/data/package.json +++ b/packages/data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data", - "version": "6.0.1", + "version": "6.1.0-prerelease", "description": "Data module 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 98ecc8a031a227..60342ad28ce05c 100644 --- a/packages/e2e-tests/CHANGELOG.md +++ b/packages/e2e-tests/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.5.0 (2021-09-09) + ### New Features - Emulate `prefers-reduced-motion: reduce` [#34132](https://github.com/WordPress/gutenberg/pull/34132). diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index 479f2331230e76..7144512e35de8a 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-tests", - "version": "2.4.1", + "version": "2.5.0-prerelease", "description": "End-To-End (E2E) tests for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index f1df1f4c7433e3..2ae76dde0321c9 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -6,6 +6,8 @@ - The bundled `eslint-plugin-jsdoc` dependency has been updated from requiring `^34.1.0` to requiring `^36.0.8` ([#34338](https://github.com/WordPress/gutenberg/pull/34338)). +## 9.1.2 (2021-09-09) + ### Bug Fix - The recommended configuration will now respect `type` imports in TypeScript files ([#34055](https://github.com/WordPress/gutenberg/pull/34055)). diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 29a7afbc65f507..7f587329d27a84 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/eslint-plugin", - "version": "9.1.1", + "version": "9.1.2-prerelease", "description": "ESLint plugin for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/interface/CHANGELOG.md b/packages/interface/CHANGELOG.md index fbc70cbd974d22..0f3a1d85c53c86 100644 --- a/packages/interface/CHANGELOG.md +++ b/packages/interface/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.1.0 (2021-09-09) + ### New Feature - Add support for editor 'feature' preferences. Adds an `isFeatureActive` selector, a `toggleFeature` action, a `MoreMenuDropdown` component, and a `MoreMenuFeatureToggle` component. ([#33774](https://github.com/WordPress/gutenberg/pull/33774)). diff --git a/packages/interface/package.json b/packages/interface/package.json index 7880c08042ea64..1f78be8f86fddf 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/interface", - "version": "4.0.1", + "version": "4.1.0-prerelease", "description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/jest-preset-default/CHANGELOG.md b/packages/jest-preset-default/CHANGELOG.md index 6e18c4dd854ae0..b9f6a0d3fa8f7f 100644 --- a/packages/jest-preset-default/CHANGELOG.md +++ b/packages/jest-preset-default/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.1.1 (2021-09-09) + ### Bug Fix - Restore the default setting for the `verbose` option. In effect, each test won't get reported during the run ([#34327](https://github.com/WordPress/gutenberg/pull/34327)). diff --git a/packages/jest-preset-default/package.json b/packages/jest-preset-default/package.json index 3e16a8ab1b647e..e39c27ac8fe31a 100644 --- a/packages/jest-preset-default/package.json +++ b/packages/jest-preset-default/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-preset-default", - "version": "7.1.0", + "version": "7.1.1-prerelease", "description": "Default Jest preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 36a20b270b3dd0..c0ecb8822b2e9a 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -6,6 +6,8 @@ - The bundled `jest-dev-server` dependency has been updated to the next major version `^5.0.3` ([#34560](https://github.com/WordPress/gutenberg/pull/34560)). +## 18.0.1 (2021-09-09) + ### Bug Fixes - Bring back support for SVG files in CSS ([#34394](https://github.com/WordPress/gutenberg/pull/34394)). It wasn't correctly migrated when integrating webpack v5. diff --git a/packages/scripts/package.json b/packages/scripts/package.json index a42c9a9026903e..b489dfa9bdfc16 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/scripts", - "version": "18.0.0", + "version": "18.0.1-prerelease", "description": "Collection of reusable scripts for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", From 7310097da5e16159b79e6e039a2cb3812cb9055e Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Thu, 9 Sep 2021 10:05:13 +0200 Subject: [PATCH 07/14] chore(release): publish - @wordpress/a11y@3.2.2 - @wordpress/annotations@2.2.3 - @wordpress/api-fetch@5.2.2 - @wordpress/babel-preset-default@6.3.2 - @wordpress/base-styles@4.0.0 - @wordpress/block-directory@3.0.2 - @wordpress/block-editor@7.0.2 - @wordpress/block-library@6.0.0 - @wordpress/blocks@11.1.0 - @wordpress/components@17.0.0 - @wordpress/compose@5.0.2 - @wordpress/core-data@4.0.2 - @wordpress/create-block@2.5.1 - @wordpress/customize-widgets@2.0.2 - @wordpress/data-controls@2.2.3 - @wordpress/data@6.1.0 - @wordpress/dom@3.2.3 - @wordpress/e2e-test-utils@5.4.3 - @wordpress/e2e-tests@2.5.0 - @wordpress/edit-post@5.0.2 - @wordpress/edit-site@3.0.2 - @wordpress/edit-widgets@3.0.2 - @wordpress/editor@11.0.2 - @wordpress/element@4.0.1 - @wordpress/env@4.1.1 - @wordpress/eslint-plugin@9.1.2 - @wordpress/format-library@3.0.2 - @wordpress/i18n@4.2.2 - @wordpress/icons@5.0.2 - @wordpress/interface@4.1.0 - @wordpress/jest-preset-default@7.1.1 - @wordpress/keyboard-shortcuts@3.0.2 - @wordpress/keycodes@3.2.2 - @wordpress/lazy-import@1.3.1 - @wordpress/list-reusable-blocks@3.0.2 - @wordpress/media-utils@3.0.1 - @wordpress/notices@3.2.3 - @wordpress/nux@5.0.2 - @wordpress/plugins@4.0.2 - @wordpress/postcss-plugins-preset@3.2.1 - @wordpress/prettier-config@1.1.1 - @wordpress/primitives@3.0.1 - @wordpress/project-management-automation@1.13.1 - @wordpress/react-i18n@3.0.1 - @wordpress/reusable-blocks@3.0.2 - @wordpress/rich-text@5.0.2 - @wordpress/scripts@18.0.1 - @wordpress/server-side-render@3.0.2 - @wordpress/url@3.2.2 - @wordpress/viewport@4.0.2 - @wordpress/widgets@2.0.2 --- packages/a11y/package.json | 2 +- packages/annotations/package.json | 2 +- packages/api-fetch/package.json | 2 +- packages/babel-preset-default/package.json | 2 +- packages/base-styles/package.json | 2 +- packages/block-directory/package.json | 2 +- packages/block-editor/package.json | 2 +- packages/block-library/package.json | 2 +- packages/blocks/package.json | 2 +- packages/components/package.json | 2 +- packages/compose/package.json | 2 +- packages/core-data/package.json | 2 +- packages/create-block/package.json | 2 +- packages/customize-widgets/package.json | 2 +- packages/data-controls/package.json | 2 +- packages/data/package.json | 2 +- packages/dom/package.json | 2 +- packages/e2e-test-utils/package.json | 2 +- packages/e2e-tests/package.json | 2 +- packages/edit-post/package.json | 2 +- packages/edit-site/package.json | 2 +- packages/edit-widgets/package.json | 2 +- packages/editor/package.json | 2 +- packages/element/package.json | 2 +- packages/env/package.json | 2 +- packages/eslint-plugin/package.json | 2 +- packages/format-library/package.json | 2 +- packages/i18n/package.json | 2 +- packages/icons/package.json | 2 +- packages/interface/package.json | 2 +- packages/jest-preset-default/package.json | 2 +- packages/keyboard-shortcuts/package.json | 2 +- packages/keycodes/package.json | 2 +- packages/lazy-import/package.json | 2 +- packages/list-reusable-blocks/package.json | 2 +- packages/media-utils/package.json | 2 +- packages/notices/package.json | 2 +- packages/nux/package.json | 2 +- packages/plugins/package.json | 2 +- packages/postcss-plugins-preset/package.json | 2 +- packages/prettier-config/package.json | 2 +- packages/primitives/package.json | 2 +- packages/project-management-automation/package.json | 2 +- packages/react-i18n/package.json | 2 +- packages/reusable-blocks/package.json | 2 +- packages/rich-text/package.json | 2 +- packages/scripts/package.json | 2 +- packages/server-side-render/package.json | 2 +- packages/url/package.json | 2 +- packages/viewport/package.json | 2 +- packages/widgets/package.json | 2 +- 51 files changed, 51 insertions(+), 51 deletions(-) diff --git a/packages/a11y/package.json b/packages/a11y/package.json index f8efa23b939e92..e6681f737be86b 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/a11y", - "version": "3.2.1", + "version": "3.2.2", "description": "Accessibility (a11y) utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/annotations/package.json b/packages/annotations/package.json index b53046ace2124b..8fbc1fb0a804d4 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/annotations", - "version": "2.2.2", + "version": "2.2.3", "description": "Annotate content in the Gutenberg editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json index d4fa406a09b33b..6e54181e504b3a 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/api-fetch", - "version": "5.2.1", + "version": "5.2.2", "description": "Utility to make WordPress REST API requests.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json index f9d1497e4279af..28d1aa8bf553d2 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": "6.3.1", + "version": "6.3.2", "description": "Default Babel preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json index 3b9d48f4ce4993..016fe2cdbc0511 100644 --- a/packages/base-styles/package.json +++ b/packages/base-styles/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/base-styles", - "version": "4.0.0-prerelease", + "version": "4.0.0", "description": "Base SCSS utilities and variables for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index ce59cc46bb0619..e8e256ed95cb75 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "3.0.1", + "version": "3.0.2", "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/package.json b/packages/block-editor/package.json index 63a1cd006a4597..64e0b52b50c725 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-editor", - "version": "7.0.1", + "version": "7.0.2", "description": "Generic block editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-library/package.json b/packages/block-library/package.json index 914c31ab767699..543cfbd4aa0fda 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-library", - "version": "6.0.0-prerelease", + "version": "6.0.0", "description": "Block library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blocks/package.json b/packages/blocks/package.json index b60c50784a0e42..e0e120b33813e1 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blocks", - "version": "11.1.0-prerelease", + "version": "11.1.0", "description": "Block API for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/components/package.json b/packages/components/package.json index 21cf7055582844..277c9f95e30233 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/components", - "version": "17.0.0-prerelease", + "version": "17.0.0", "description": "UI components for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/compose/package.json b/packages/compose/package.json index d1c4efc6294777..522c95b6907fad 100644 --- a/packages/compose/package.json +++ b/packages/compose/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/compose", - "version": "5.0.1", + "version": "5.0.2", "description": "WordPress higher-order components (HOCs).", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 56fe06013a3220..082df6431d30a6 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-data", - "version": "4.0.1", + "version": "4.0.2", "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/package.json b/packages/create-block/package.json index 55ec802c892b6a..263639bb631256 100644 --- a/packages/create-block/package.json +++ b/packages/create-block/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block", - "version": "2.5.0", + "version": "2.5.1", "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/package.json b/packages/customize-widgets/package.json index ae7260f507fe35..7b13bc85937392 100644 --- a/packages/customize-widgets/package.json +++ b/packages/customize-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/customize-widgets", - "version": "2.0.1", + "version": "2.0.2", "description": "Widgets blocks in Customizer Module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/data-controls/package.json b/packages/data-controls/package.json index 4b132809bea526..9bc1b2404809a4 100644 --- a/packages/data-controls/package.json +++ b/packages/data-controls/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data-controls", - "version": "2.2.2", + "version": "2.2.3", "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/package.json b/packages/data/package.json index 1352a945b22a5e..11b0cf579a879a 100644 --- a/packages/data/package.json +++ b/packages/data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data", - "version": "6.1.0-prerelease", + "version": "6.1.0", "description": "Data module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dom/package.json b/packages/dom/package.json index 918415ad3d5fe7..435964e6fa0eee 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom", - "version": "3.2.2", + "version": "3.2.3", "description": "DOM utilities module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/e2e-test-utils/package.json b/packages/e2e-test-utils/package.json index e6ac75c7bbb069..b8c8664651b1c3 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": "5.4.2", + "version": "5.4.3", "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/package.json b/packages/e2e-tests/package.json index 7144512e35de8a..20172079debd07 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-tests", - "version": "2.5.0-prerelease", + "version": "2.5.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/package.json b/packages/edit-post/package.json index 6919bb5683d1a0..201029d41c66ce 100644 --- a/packages/edit-post/package.json +++ b/packages/edit-post/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-post", - "version": "5.0.1", + "version": "5.0.2", "description": "Edit Post module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-site/package.json b/packages/edit-site/package.json index 988c8fce821c88..67094e789a272d 100644 --- a/packages/edit-site/package.json +++ b/packages/edit-site/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-site", - "version": "3.0.1", + "version": "3.0.2", "description": "Edit Site Page module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-widgets/package.json b/packages/edit-widgets/package.json index 4d753c74255c9c..27756debbbb03c 100644 --- a/packages/edit-widgets/package.json +++ b/packages/edit-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-widgets", - "version": "3.0.1", + "version": "3.0.2", "description": "Widgets Page module for WordPress..", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/editor/package.json b/packages/editor/package.json index 069d27437c8c33..9cfdaf06598e29 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/editor", - "version": "11.0.1", + "version": "11.0.2", "description": "Enhanced block editor for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/element/package.json b/packages/element/package.json index f966da3abce2f2..2ca9018f8ccfe7 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/element", - "version": "4.0.0", + "version": "4.0.1", "description": "Element React module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/env/package.json b/packages/env/package.json index f82affc3c892aa..342c869d41ee20 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/env", - "version": "4.1.0", + "version": "4.1.1", "description": "A zero-config, self contained local WordPress environment for development and testing.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 7f587329d27a84..787145d8a228f8 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/eslint-plugin", - "version": "9.1.2-prerelease", + "version": "9.1.2", "description": "ESLint plugin for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/format-library/package.json b/packages/format-library/package.json index 68a8b2060f5973..94a4c4dde95684 100644 --- a/packages/format-library/package.json +++ b/packages/format-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/format-library", - "version": "3.0.1", + "version": "3.0.2", "description": "Format library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/i18n/package.json b/packages/i18n/package.json index 95d3c66c6a479b..848ce9ac902aaa 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/i18n", - "version": "4.2.1", + "version": "4.2.2", "description": "WordPress internationalization (i18n) library.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/icons/package.json b/packages/icons/package.json index 463ad625b130ed..dc5256568a05c5 100644 --- a/packages/icons/package.json +++ b/packages/icons/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/icons", - "version": "5.0.1", + "version": "5.0.2", "description": "WordPress Icons package, based on dashicon.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/interface/package.json b/packages/interface/package.json index 1f78be8f86fddf..d77e54dcabe09c 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/interface", - "version": "4.1.0-prerelease", + "version": "4.1.0", "description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/jest-preset-default/package.json b/packages/jest-preset-default/package.json index e39c27ac8fe31a..4e8a46058ef60e 100644 --- a/packages/jest-preset-default/package.json +++ b/packages/jest-preset-default/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-preset-default", - "version": "7.1.1-prerelease", + "version": "7.1.1", "description": "Default Jest preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/keyboard-shortcuts/package.json b/packages/keyboard-shortcuts/package.json index 007167b069f227..d41ef8f1d6297e 100644 --- a/packages/keyboard-shortcuts/package.json +++ b/packages/keyboard-shortcuts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keyboard-shortcuts", - "version": "3.0.1", + "version": "3.0.2", "description": "Handling keyboard shortcuts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/keycodes/package.json b/packages/keycodes/package.json index d68f9c9a5723fc..4bbbca782cb644 100644 --- a/packages/keycodes/package.json +++ b/packages/keycodes/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keycodes", - "version": "3.2.1", + "version": "3.2.2", "description": "Keycodes utilities for WordPress. Used to check for keyboard events across browsers/operating systems.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/lazy-import/package.json b/packages/lazy-import/package.json index 505f1efa8ef2fe..8bb1208a5cee21 100644 --- a/packages/lazy-import/package.json +++ b/packages/lazy-import/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/lazy-import", - "version": "1.3.0", + "version": "1.3.1", "description": "Lazily import a module, installing it automatically if missing.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/list-reusable-blocks/package.json b/packages/list-reusable-blocks/package.json index 06cb297ceda026..d43f8c97f545eb 100644 --- a/packages/list-reusable-blocks/package.json +++ b/packages/list-reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/list-reusable-blocks", - "version": "3.0.1", + "version": "3.0.2", "description": "Adding Export/Import support to the reusable blocks listing.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/media-utils/package.json b/packages/media-utils/package.json index 8339a0bc435633..bbe3d7eb022f56 100644 --- a/packages/media-utils/package.json +++ b/packages/media-utils/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/media-utils", - "version": "3.0.0", + "version": "3.0.1", "description": "WordPress Media Upload Utils.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/notices/package.json b/packages/notices/package.json index d781ee3dcf84eb..51c8a558ed2af6 100644 --- a/packages/notices/package.json +++ b/packages/notices/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/notices", - "version": "3.2.2", + "version": "3.2.3", "description": "State management for notices.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/nux/package.json b/packages/nux/package.json index f8297a55a3727c..c8c928f42fbcde 100644 --- a/packages/nux/package.json +++ b/packages/nux/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/nux", - "version": "5.0.1", + "version": "5.0.2", "description": "NUX (New User eXperience) module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/plugins/package.json b/packages/plugins/package.json index 3145b2539a19db..c8018a18b8c310 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/plugins", - "version": "4.0.1", + "version": "4.0.2", "description": "Plugins module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/postcss-plugins-preset/package.json b/packages/postcss-plugins-preset/package.json index 50e4ff3a8cca47..d5473786048ca0 100644 --- a/packages/postcss-plugins-preset/package.json +++ b/packages/postcss-plugins-preset/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/postcss-plugins-preset", - "version": "3.2.0", + "version": "3.2.1", "description": "PostCSS sharable plugins preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/prettier-config/package.json b/packages/prettier-config/package.json index 7db51ccf668b56..c9008082287e19 100644 --- a/packages/prettier-config/package.json +++ b/packages/prettier-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/prettier-config", - "version": "1.1.0", + "version": "1.1.1", "description": "WordPress Prettier shared configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/primitives/package.json b/packages/primitives/package.json index c03eb57b7679e4..86a8d60e077e5b 100644 --- a/packages/primitives/package.json +++ b/packages/primitives/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/primitives", - "version": "3.0.0", + "version": "3.0.1", "description": "WordPress cross-platform primitives.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/project-management-automation/package.json b/packages/project-management-automation/package.json index 70115b3af16759..2dbe2844a98db6 100644 --- a/packages/project-management-automation/package.json +++ b/packages/project-management-automation/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/project-management-automation", - "version": "1.13.0", + "version": "1.13.1", "description": "GitHub Action that implements various automation to assist with managing the Gutenberg GitHub repository.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/react-i18n/package.json b/packages/react-i18n/package.json index 8fa567c31cfe9c..48986333b594fa 100644 --- a/packages/react-i18n/package.json +++ b/packages/react-i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/react-i18n", - "version": "3.0.0", + "version": "3.0.1", "description": "React bindings for @wordpress/i18n.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/reusable-blocks/package.json b/packages/reusable-blocks/package.json index f900c6fea1d978..f0e64a9402148d 100644 --- a/packages/reusable-blocks/package.json +++ b/packages/reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/reusable-blocks", - "version": "3.0.1", + "version": "3.0.2", "description": "Reusable blocks utilities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/rich-text/package.json b/packages/rich-text/package.json index a82b4ed4200186..47ae7f8bed1399 100644 --- a/packages/rich-text/package.json +++ b/packages/rich-text/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/rich-text", - "version": "5.0.1", + "version": "5.0.2", "description": "Rich text value and manipulation API.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/scripts/package.json b/packages/scripts/package.json index b489dfa9bdfc16..45254c5bbc9041 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/scripts", - "version": "18.0.1-prerelease", + "version": "18.0.1", "description": "Collection of reusable scripts for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/server-side-render/package.json b/packages/server-side-render/package.json index 04e667999c63b7..4ab107ac56924d 100644 --- a/packages/server-side-render/package.json +++ b/packages/server-side-render/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/server-side-render", - "version": "3.0.1", + "version": "3.0.2", "description": "The component used with WordPress to server-side render a preview of dynamic blocks to display in the editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/url/package.json b/packages/url/package.json index ea4a5bd8e332be..7b1738b80a6331 100644 --- a/packages/url/package.json +++ b/packages/url/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/url", - "version": "3.2.1", + "version": "3.2.2", "description": "WordPress URL utilities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/viewport/package.json b/packages/viewport/package.json index 7a0271bea68eb5..ca13269d33ec30 100644 --- a/packages/viewport/package.json +++ b/packages/viewport/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/viewport", - "version": "4.0.1", + "version": "4.0.2", "description": "Viewport module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/widgets/package.json b/packages/widgets/package.json index 2934f8442b10f9..9ba0cdd5b23715 100644 --- a/packages/widgets/package.json +++ b/packages/widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/widgets", - "version": "2.0.1", + "version": "2.0.2", "description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", From d3fa6c38e21176614bddc0ced473ded35889adae Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Thu, 9 Sep 2021 11:08:25 +0200 Subject: [PATCH 08/14] Update `@wordpress/components` package's contributing guidelines (#33960) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Greg Ziółkowski Co-authored-by: Haz --- packages/components/CONTRIBUTING.md | 279 +++++++++++++++++++++++++++- packages/components/README.md | 6 +- 2 files changed, 278 insertions(+), 7 deletions(-) diff --git a/packages/components/CONTRIBUTING.md b/packages/components/CONTRIBUTING.md index f032f25c4a92c5..3bed2829216a81 100644 --- a/packages/components/CONTRIBUTING.md +++ b/packages/components/CONTRIBUTING.md @@ -4,12 +4,279 @@ Thank you for taking the time to contribute. The following is a set of guidelines for contributing to the `@wordpress/components` package to be considered in addition to the general ones described in our [Contributing Policy](/CONTRIBUTING.md). -## Examples +## Core principles -Each component needs to include an example in its README.md file to demonstrate the usage of the component. +Contributions to the `@wordpress/components` package should follow a set of core principles and technical requirements. -These examples can be consumed automatically from other projects in order to visualize them in their documentation. To ensure these examples are extractable, compilable and renderable, they should be structured in the following way: +This set of guidelines should apply especially to newly introduced components. It is, in fact, possible that some of the older components don't respect some of these guidelines for legacy/compatibility reasons. -- It has to be included in a `jsx` code block. -- It has to work out-of-the-box. No additional code should be needed to have working the example. -- It has to define a React component called `My` which renders the example (i.e.: `MyButton`). Examples for the Higher Order Components should define a `MyComponent` component (i.e.: `MyComponentWithNotices`). +### Compatibility + +The `@wordpress/components` package includes components that are relied upon by many developers across different projects. It is, therefore, very important to avoid introducing breaking changes. + +In these situations, one possible approach is to "soft-deprecate" a given legacy API. This is achieved by: + +1. Removing traces of the API from the docs, while still supporting it in code. +2. Updating all places in Gutenberg that use that API. +3. Adding deprecation warnings (only after the previous point is completed, otherwise the Browser Console will be polluted by all those warnings and some e2e tests may fail). + +When adding new components or new props to existing components, it's recommended to prefix them with `__unstable` or `__experimental` until they're stable enough to be exposed as part of the public API. + +Learn more on [How to preserve backward compatibility for a React Component](/docs/how-to-guides/backward-compatibility/README.md#how-to-preserve-backward-compatibility-for-a-react-component) and [Experimental and Unstable APIs](/docs/contributors/code/coding-guidelines.md#experimental-and-unstable-apis). + +### Components composition + + + +#### Components & Hooks + +One way to enable reusability and composition is to extract a component's underlying logic into a hook (living in a separate `hook.ts` file). The actual component (usually defined in a `component.tsx` file) can then invoke the hook and use its output to render the required DOM elements. For example: + +```tsx +// in `hook.ts` +function useExampleComponent( props: PolymorphicComponentProps< ExampleProps, 'div' > ) { + // Merge received props with the context system. + const { isVisible, className, ...otherProps } = useContextSystem( props, 'Example' ); + + // Any other reusable rendering logic (e.g. computing className, state, event listeners...) + const cx = useCx(); + const classes = useMemo( + () => + cx( + styles.example, + isVisible && styles.visible, + className + ), + [ className, isVisible ] + ); + + return { + ...otherProps, + className: classes + }; +} + +// in `component.tsx` +function Example( + props: PolymorphicComponentProps< ExampleProps, 'div' >, + forwardedRef: Ref< any > +) { + const exampleProps = useExampleComponent( props ); + + return ; +} +``` + +A couple of good examples of how hooks are used for composition are: + +- the `Card` component, which builds on top of the `Surface` component by [calling the `useSurface` hook inside its own hook](/packages/components/src/card/card/hook.js); +- the `HStack` component, which builds on top of the `Flex` component and [calls the `useFlex` hook inside its own hook](/packages/components/src/h-stack/hook.js). + + + +### Technical requirements for new components + +The following are a set of technical requirements for all newly introduced components. These requirements are also retroactively being applied to existing components. + +For an example of a component that follows these requirements, take a look at [`ItemGroup`](/packages/components/src/item-group). + +#### TypeScript + +We strongly encourage using TypeScript for all new components. Components should be typed using the `WordPressComponent` type. + + + +#### Styling + +All new component should be styled using [Emotion](https://emotion.sh/docs/introduction). + +Note: Instead of using Emotion's standard `cx` function, the custom [`useCx` hook](/packages/components/src/utils/hooks/use-cx.ts) should be used instead. + +#### Context system + +The `@wordpress/components` context system is based on [React's `Context` API](https://reactjs.org/docs/context.html), and is a way for components to adapt to the "context" they're being rendered in. + +Components can use this system via a couple of functions: + +- they can provide values using a shared `ContextSystemProvider` component +- they can connect to the Context via `contextConnect` +- they can read the "computed" values from the context via `useContextSystem` + +An example of how this is used can be found in the [`Card` component family](/packages/components/src/card). For example, this is how the `Card` component injects the `size` and `isBorderless` props down to its `CardBody` subcomponent — which makes it use the correct spacing and border settings "auto-magically". + +```jsx +//========================================================================= +// Simplified snippet from `packages/components/src/card/card/hook.js` +//========================================================================= +import { useContextSystem } from '../../ui/context'; + +export function useCard( props ) { + // Read any derived registered prop from the Context System in the `Card` namespace + const derivedProps = useContextSystem( props, 'Card' ); + + // [...] + + return computedHookProps; +} + +//========================================================================= +// Simplified snippet from `packages/components/src/card/card/component.js` +//========================================================================= +import { contextConnect, ContextSystemProvider } from '../../ui/context'; + +function Card( props, forwardedRef ) { + const { + size, + isBorderless, + ...otherComputedHookProps + } = useCard( props ); + + // [...] + + // Prepare the additional props that should be passed to subcomponents via the Context System. + const contextProviderValue = useMemo( () => { + return { + // Each key in this object should match a component's registered namespace. + CardBody: { + size, + isBorderless, + }, + }; + }, [ isBorderless, size ] ); + + return ( + { /* Write additional values to the Context System */ } + + { /* [...] */ } + + ); +} + +// Connect to the Context System under the `Card` namespace +const ConnectedCard = contextConnect( Card, 'Card' ); +export default ConnectedCard; + +//========================================================================= +// Simplified snippet from `packages/components/src/card/card-body/hook.js` +//========================================================================= +import { useContextSystem } from '../../ui/context'; + +export function useCardBody( props ) { + // Read any derived registered prop from the Context System in the `CardBody` namespace. + // If a `CardBody` component is rendered as a child of a `Card` component, the value of + // the `size` prop will be the one set by the parent `Card` component via the Context + // System (unless the prop gets explicitely set on the `CardBody` component). + const { size = 'medium', ...otherDerivedProps } = useContextSystem( props, 'CardBody' ); + + // [...] + + return computedHookProps; +} +``` + +#### Unit tests + +Please refer to the [JavaScript Testing Overview docs](/docs/contributors/code/testing-overview.md#snapshot-testing). + +#### Storybook + +All new components should add stories to the project's [Storybook](https://storybook.js.org/). Each [story](https://storybook.js.org/docs/react/get-started/whats-a-story) captures the rendered state of a UI component in isolation. This greatly simplifies working on a given component, while also serving as an interactive form of documentation. + +A component's story should be showcasing its different states — for example, the different variants of a `Button`: + +```jsx +import Button from '../'; + +export default { title: 'Components/Button', component: Button }; + +export const _default = () => ; + +export const primary = () => ; + +export const secondary = () => ; +``` + +A great tool to use when writing stories is the [Storybook Controls addon](https://storybook.js.org/addons/@storybook/addon-controls). Ideally props should be exposed by using this addon, which provides a graphical UI to interact dynamically with the component without needing to write code. + +The default value of each control should coincide with the default value of the props (i.e. it should be `undefined` if a prop is not required). A story should, therefore, also explicitly show how values from the Context System are applied to (sub)components. A good example of how this may look like is the [`Card` story](https://wordpress.github.io/gutenberg/?path=/story/components-card--default) (code [here](/packages/components/src/card/stories/index.js)). + +Storybook can be started on a local maching by running `npm run storybook:dev`. Alternatively, the components' catalogue (up to date with the latest code on `trunk`) can be found at [wordpress.github.io/gutenberg/](https://wordpress.github.io/gutenberg/). + +#### Documentation + +All components, in addition to being typed, should be using JSDoc when necessary — as explained in the [Coding Guidelines](/docs/contributors/code/coding-guidelines.md#javascript-documentation-using-jsdoc). + +Each component that is exported from the `@wordpress/components` package should include a `README.md` file, explaining how to use the component, showing examples, and documenting all the props. + +#### Folder structure + +As a result of the above guidelines, all new components (except for shared utilities) should _generally_ follow this folder structure: + +``` +component-name/ +├── component.tsx +├── context.ts +├── hook.ts +├── index.ts +├── README.md +├── styles.ts +└── types.ts +``` + +In case of a family of components (e.g. `Card` and `CardBody`, `CardFooter`, `CardHeader` ...), each component's implementation should live in a separate subfolder: + +``` +component-family-name/ +├── sub-component-name/ +│ ├── index.ts +│ ├── component.tsx +│ ├── hook.ts +│ ├── README.md +│ ├── styles.ts +│ └── types.ts +├── sub-component-name/ +│ ├── index.ts +│ ├── component.tsx +│ ├── hook.ts +│ ├── README.md +│ ├── styles.ts +│ └── types.ts +├── stories +│ └── index.js +├── test +│ └── index.js +├── context.ts +└── index.ts +``` diff --git a/packages/components/README.md b/packages/components/README.md index dfff2847c56bf9..3c89d0092dc4f2 100644 --- a/packages/components/README.md +++ b/packages/components/README.md @@ -10,7 +10,7 @@ Install the module npm install @wordpress/components --save ``` -_This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for ES2015+ such as IE browsers then using [core-js](https://github.com/zloirock/core-js) will add polyfills for these methods._ +_This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for such language features and APIs, you should include [the polyfill shipped in `@wordpress/babel-preset-default`](/packages/babel-preset-default#polyfill) in your code._ ## Usage @@ -32,3 +32,7 @@ Many components include CSS to add style, you will need to add in order to appea In non-WordPress projects, link to the `build-style/style.css` file directly, it is located at `node_modules/@wordpress/components/build-style/style.css`.

Code is Poetry.

+ +## Contributing + +See [CONTRIBUTING.md](/packages/components/CONTRIBUTING.md) for the contributing guidelines for the `@wordpress/components` package. From 30744d0beb834c7f04a32bf1a2e6821c5e6bdfe5 Mon Sep 17 00:00:00 2001 From: Paul Sealock Date: Thu, 9 Sep 2021 23:28:45 +1200 Subject: [PATCH 09/14] ESLint Plugin: Use Jest related rules only when the package is installed (#33120) * Add Jest to eslint plugin dependencies * Add test rules only when jest is installed Co-authored-by: Grzegorz Ziolkowski --- packages/eslint-plugin/CHANGELOG.md | 4 ++++ .../configs/recommended-with-formatting.js | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 2ae76dde0321c9..7f4f0701deb9b3 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -6,6 +6,10 @@ - The bundled `eslint-plugin-jsdoc` dependency has been updated from requiring `^34.1.0` to requiring `^36.0.8` ([#34338](https://github.com/WordPress/gutenberg/pull/34338)). +### Bug Fix + +- Use Jest related rules only when the `jest` package is installed ([#33120](https://github.com/WordPress/gutenberg/pull/33120)). + ## 9.1.2 (2021-09-09) ### Bug Fix diff --git a/packages/eslint-plugin/configs/recommended-with-formatting.js b/packages/eslint-plugin/configs/recommended-with-formatting.js index 51970f2c238cf1..a51697c9112ba2 100644 --- a/packages/eslint-plugin/configs/recommended-with-formatting.js +++ b/packages/eslint-plugin/configs/recommended-with-formatting.js @@ -1,4 +1,9 @@ -module.exports = { +/** + * Internal dependencies + */ +const { isPackageInstalled } = require( '../utils' ); + +const config = { parser: 'babel-eslint', extends: [ require.resolve( './jsx-a11y.js' ), @@ -27,7 +32,10 @@ module.exports = { 'import/default': 'warn', 'import/named': 'warn', }, - overrides: [ +}; + +if ( isPackageInstalled( 'jest' ) ) { + config.overrides = [ { // Unit test files and their helpers only. files: [ '**/@(test|__tests__)/**/*.js', '**/?(*.)test.js' ], @@ -38,5 +46,7 @@ module.exports = { files: [ '**/specs/**/*.js', '**/?(*.)spec.js' ], extends: [ require.resolve( './test-e2e.js' ) ], }, - ], -}; + ]; +} + +module.exports = config; From 1a1a9a03ee72eb309738175c4046faa4135cf9ab Mon Sep 17 00:00:00 2001 From: Addison Stavlo Date: Thu, 9 Sep 2021 07:46:50 -0400 Subject: [PATCH 10/14] Site Editor - add basic plugin support (#34460) * add sidebar and menu items * add general sidebar actions * remove unnecessary props * Update packages/edit-site/src/components/header/plugin-more-menu-item/index.js --- .../header/plugin-more-menu-item/index.js | 71 ++++++++++++++++ .../plugin-sidebar-more-menu-item/index.js | 64 +++++++++++++++ .../sidebar/plugin-sidebar/index.js | 80 +++++++++++++++++++ packages/edit-site/src/index.js | 3 + packages/edit-site/src/store/actions.js | 29 +++++++ 5 files changed, 247 insertions(+) create mode 100644 packages/edit-site/src/components/header/plugin-more-menu-item/index.js create mode 100644 packages/edit-site/src/components/header/plugin-sidebar-more-menu-item/index.js create mode 100644 packages/edit-site/src/components/sidebar/plugin-sidebar/index.js diff --git a/packages/edit-site/src/components/header/plugin-more-menu-item/index.js b/packages/edit-site/src/components/header/plugin-more-menu-item/index.js new file mode 100644 index 00000000000000..1c9707074f90f4 --- /dev/null +++ b/packages/edit-site/src/components/header/plugin-more-menu-item/index.js @@ -0,0 +1,71 @@ +/** + * WordPress dependencies + */ +import { ActionItem } from '@wordpress/interface'; +import { compose } from '@wordpress/compose'; +import { withPluginContext } from '@wordpress/plugins'; + +/** + * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided. + * The text within the component appears as the menu item label. + * + * @param {Object} props Component properties. + * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor. + * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. + * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item. + * @param {...*} [props.other] Any additional props are passed through to the underlying [Button](/packages/components/src/button/README.md) component. + * + * @example + * ```js + * // Using ES5 syntax + * var __ = wp.i18n.__; + * var PluginMoreMenuItem = wp.editSite.PluginMoreMenuItem; + * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. + * + * function onButtonClick() { + * alert( 'Button clicked.' ); + * } + * + * function MyButtonMoreMenuItem() { + * return wp.element.createElement( + * PluginMoreMenuItem, + * { + * icon: moreIcon, + * onClick: onButtonClick, + * }, + * __( 'My button title' ) + * ); + * } + * ``` + * + * @example + * ```jsx + * // Using ESNext syntax + * import { __ } from '@wordpress/i18n'; + * import { PluginMoreMenuItem } from '@wordpress/edit-site'; + * import { more } from '@wordpress/icons'; + * + * function onButtonClick() { + * alert( 'Button clicked.' ); + * } + * + * const MyButtonMoreMenuItem = () => ( + * + * { __( 'My button title' ) } + * + * ); + * ``` + * + * @return {WPComponent} The component to be rendered. + */ +export default compose( + withPluginContext( ( context, ownProps ) => { + return { + icon: ownProps.icon || context.icon, + name: 'core/edit-site/plugin-more-menu', + }; + } ) +)( ActionItem ); diff --git a/packages/edit-site/src/components/header/plugin-sidebar-more-menu-item/index.js b/packages/edit-site/src/components/header/plugin-sidebar-more-menu-item/index.js new file mode 100644 index 00000000000000..3b9bbd9288142a --- /dev/null +++ b/packages/edit-site/src/components/header/plugin-sidebar-more-menu-item/index.js @@ -0,0 +1,64 @@ +/** + * WordPress dependencies + */ +import { ComplementaryAreaMoreMenuItem } from '@wordpress/interface'; + +/** + * Renders a menu item in `Plugins` group in `More Menu` drop down, + * and can be used to activate the corresponding `PluginSidebar` component. + * The text within the component appears as the menu item label. + * + * @param {Object} props Component props. + * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar. + * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label. + * + * @example + * ```js + * // Using ES5 syntax + * var __ = wp.i18n.__; + * var PluginSidebarMoreMenuItem = wp.editSite.PluginSidebarMoreMenuItem; + * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. + * + * function MySidebarMoreMenuItem() { + * return wp.element.createElement( + * PluginSidebarMoreMenuItem, + * { + * target: 'my-sidebar', + * icon: moreIcon, + * }, + * __( 'My sidebar title' ) + * ) + * } + * ``` + * + * @example + * ```jsx + * // Using ESNext syntax + * import { __ } from '@wordpress/i18n'; + * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-site'; + * import { more } from '@wordpress/icons'; + * + * const MySidebarMoreMenuItem = () => ( + * + * { __( 'My sidebar title' ) } + * + * ); + * ``` + * + * @return {WPComponent} The component to be rendered. + */ + +export default function PluginSidebarMoreMenuItem( props ) { + return ( + + ); +} diff --git a/packages/edit-site/src/components/sidebar/plugin-sidebar/index.js b/packages/edit-site/src/components/sidebar/plugin-sidebar/index.js new file mode 100644 index 00000000000000..c6d88a53b014bc --- /dev/null +++ b/packages/edit-site/src/components/sidebar/plugin-sidebar/index.js @@ -0,0 +1,80 @@ +/** + * WordPress dependencies + */ +import { ComplementaryArea } from '@wordpress/interface'; + +/** + * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. + * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. + * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: + * + * ```js + * wp.data.dispatch( 'core/edit-site' ).openGeneralSidebar( 'plugin-name/sidebar-name' ); + * ``` + * + * @see PluginSidebarMoreMenuItem + * + * @param {Object} props Element props. + * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin. + * @param {string} [props.className] An optional class name added to the sidebar body. + * @param {string} props.title Title displayed at the top of the sidebar. + * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item. + * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. + * + * @example + * ```js + * // Using ES5 syntax + * var __ = wp.i18n.__; + * var el = wp.element.createElement; + * var PanelBody = wp.components.PanelBody; + * var PluginSidebar = wp.editSite.PluginSidebar; + * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. + * + * function MyPluginSidebar() { + * return el( + * PluginSidebar, + * { + * name: 'my-sidebar', + * title: 'My sidebar title', + * icon: moreIcon, + * }, + * el( + * PanelBody, + * {}, + * __( 'My sidebar content' ) + * ) + * ); + * } + * ``` + * + * @example + * ```jsx + * // Using ESNext syntax + * import { __ } from '@wordpress/i18n'; + * import { PanelBody } from '@wordpress/components'; + * import { PluginSidebar } from '@wordpress/edit-site'; + * import { more } from '@wordpress/icons'; + * + * const MyPluginSidebar = () => ( + * + * + * { __( 'My sidebar content' ) } + * + * + * ); + * ``` + */ +export default function PluginSidebarEditSite( { className, ...props } ) { + return ( + + ); +} diff --git a/packages/edit-site/src/index.js b/packages/edit-site/src/index.js index 8a33589ad9f604..ec81f5c3ccb193 100644 --- a/packages/edit-site/src/index.js +++ b/packages/edit-site/src/index.js @@ -62,3 +62,6 @@ export function initialize( id, settings ) { export { default as __experimentalMainDashboardButton } from './components/main-dashboard-button'; export { default as __experimentalNavigationToggle } from './components/navigation-sidebar/navigation-toggle'; +export { default as PluginSidebar } from './components/sidebar/plugin-sidebar'; +export { default as PluginSidebarMoreMenuItem } from './components/header/plugin-sidebar-more-menu-item'; +export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item'; diff --git a/packages/edit-site/src/store/actions.js b/packages/edit-site/src/store/actions.js index a7b7e63c9a299a..770fccab93a74b 100644 --- a/packages/edit-site/src/store/actions.js +++ b/packages/edit-site/src/store/actions.js @@ -8,6 +8,7 @@ import { addQueryArgs, getPathAndQueryString } from '@wordpress/url'; import { __ } from '@wordpress/i18n'; import { store as noticesStore } from '@wordpress/notices'; import { store as coreStore } from '@wordpress/core-data'; +import { store as interfaceStore } from '@wordpress/interface'; /** * Internal dependencies @@ -441,3 +442,31 @@ export function* revertTemplate( template ) { ); } } +/** + * Returns an action object used in signalling that the user opened an editor sidebar. + * + * @param {?string} name Sidebar name to be opened. + * + * @yield {Object} Action object. + */ +export function* openGeneralSidebar( name ) { + yield controls.dispatch( + interfaceStore, + 'enableComplementaryArea', + editSiteStoreName, + name + ); +} + +/** + * Returns an action object signalling that the user closed the sidebar. + * + * @yield {Object} Action object. + */ +export function* closeGeneralSidebar() { + yield controls.dispatch( + interfaceStore, + 'disableComplementaryArea', + editSiteStoreName + ); +} From 0c471988129ce3e54d0d183afd959d338ecde508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=B3=C5=82kowski?= Date: Thu, 9 Sep 2021 13:50:29 +0200 Subject: [PATCH 11/14] Chore: Move `react-native-url-polyfill` to dev dependencies (#34687) * Move react-native-url-polyfill to devDep in @wordpress/url No longer necessary as a runtime dependency after is-url.native.js was removed * Move react-native-url-polyfill to dev dependencies of the project Co-authored-by: Ben Lowery --- package-lock.json | 3 +-- package.json | 1 + packages/url/CHANGELOG.md | 4 ++++ packages/url/package.json | 3 +-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 98cb8029eb2116..dfcabf32654145 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19050,8 +19050,7 @@ "version": "file:packages/url", "requires": { "@babel/runtime": "^7.13.10", - "lodash": "^4.17.21", - "react-native-url-polyfill": "^1.1.2" + "lodash": "^4.17.21" } }, "@wordpress/viewport": { diff --git a/package.json b/package.json index d17df424be1b8f..99c59eea7a15a1 100644 --- a/package.json +++ b/package.json @@ -196,6 +196,7 @@ "react": "17.0.1", "react-dom": "17.0.1", "react-native": "0.64.0", + "react-native-url-polyfill": "1.1.2", "react-test-renderer": "17.0.1", "rimraf": "3.0.2", "rtlcss": "2.6.2", diff --git a/packages/url/CHANGELOG.md b/packages/url/CHANGELOG.md index acdb4f471ee416..f11f5bbe74b3b9 100644 --- a/packages/url/CHANGELOG.md +++ b/packages/url/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bug Fix + +- Removed unused `react-native-url-polyfill` dependency ([#34687](https://github.com/WordPress/gutenberg/pull/34687)). + ## 3.2.0 (2021-07-21) ## 3.1.0 (2021-05-20) diff --git a/packages/url/package.json b/packages/url/package.json index 7b1738b80a6331..0e0779fe14bf85 100644 --- a/packages/url/package.json +++ b/packages/url/package.json @@ -28,8 +28,7 @@ "sideEffects": false, "dependencies": { "@babel/runtime": "^7.13.10", - "lodash": "^4.17.21", - "react-native-url-polyfill": "^1.1.2" + "lodash": "^4.17.21" }, "publishConfig": { "access": "public" From f242c91b21bbbccf0a0129e4946aadfa4d04baca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Zi=C3=B3=C5=82kowski?= Date: Thu, 9 Sep 2021 13:50:59 +0200 Subject: [PATCH 12/14] Chore: Update caniuse package to the latest version (#34685) --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index dfcabf32654145..6db65ffd4e1f28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29869,9 +29869,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001237", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001237.tgz", - "integrity": "sha512-pDHgRndit6p1NR2GhzMbQ6CkRrp4VKuSsqbcLeOQppYPKOYkKT/6ZvZDvKJUqcmtyWIAHuZq3SVS2vc1egCZzw==" + "version": "1.0.30001255", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001255.tgz", + "integrity": "sha512-F+A3N9jTZL882f/fg/WWVnKSu6IOo3ueLz4zwaOPbPYHNmM/ZaDUyzyJwS1mZhX7Ex5jqTyW599Gdelh5PDYLQ==" }, "capture-exit": { "version": "2.0.0", From eb1071f3ee521d1006a17fb85ebfd86ff4a56a51 Mon Sep 17 00:00:00 2001 From: Ryan Welcher Date: Thu, 9 Sep 2021 11:00:45 -0400 Subject: [PATCH 13/14] Update AlignmentMatrixControl docs post merge. (#34662) * Update code example to match project prettier settings. * Adding spaces above prop names. * Add missing value prop. * Remove default value for onChange. * Change types to how TypeScript describes them. * Updates label prop description. * Update packages/components/src/alignment-matrix-control/README.md Co-authored-by: Marco Ciampini * Update packages/components/src/alignment-matrix-control/README.md Co-authored-by: Marco Ciampini * Update packages/components/src/alignment-matrix-control/README.md Co-authored-by: Marco Ciampini Co-authored-by: Ryan Welcher Co-authored-by: Marco Ciampini --- .../src/alignment-matrix-control/README.md | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/packages/components/src/alignment-matrix-control/README.md b/packages/components/src/alignment-matrix-control/README.md index e041cb7f839209..7e0f59948b0090 100644 --- a/packages/components/src/alignment-matrix-control/README.md +++ b/packages/components/src/alignment-matrix-control/README.md @@ -9,12 +9,12 @@ import { __experimentalAlignmentMatrixControl as AlignmentMatrixControl } from ' import { useState } from '@wordpress/element'; const Example = () => { - const [alignment, setAlignment] = useState('center center'); + const [ alignment, setAlignment ] = useState( 'center center' ); return ( setAlignment(newAlignment)} + value={ alignment } + onChange={ ( newAlignment ) => setAlignment( newAlignment ) } /> ); }; @@ -23,43 +23,54 @@ const Example = () => { ## Props The component accepts the following props: + ### className -The class that will be added with "component-alignment-matrix-control" to the classes of the wrapper component. -If no className is passed only "component-alignment-matrix-control" is used. +The class that will be added to the classes of the wrapper component. -- Type: `String` +- Type: `string` - Required: No ### id Unique ID for the component. -- Type: `String` + +- Type: `string` - Required: No + ### label -If provided, sets the aria-label attribute of the wrapper component. +Accessible label. If provided, sets the `aria-label` attribute of the underlying component. -- Type: `String` +- Type: `string` - Required: No - Default: `Alignment Matrix Control` + ### defaultValue If provided, sets the default alignment value. -- Type: `String` + +- Type: `string` - Required: No - Default: `center center` +### value + +The current alignment value. +- Type: `string` +- Required: No + ### onChange A function that receives the updated alignment value. -- Type: `function` +- Type: `( nextValue: string ) => void` - Required: No -- Default: `noop` + ### width If provided, sets the width of the wrapper component. - - Type: `Number` + + - Type: `number` - Required: No - Default: `92` From 7c888770f3547de26fdace3e4832e96895fdec24 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Date: Thu, 9 Sep 2021 18:27:27 +0200 Subject: [PATCH 14/14] [RNMobile][Embed block] Add device's locale to preview content (#33858) * Add locale to block editor settings * Add localized embed content * Sort sandbox props * Update react-native-editor changelog --- packages/block-library/src/embed/embed-preview.native.js | 9 +++++++-- packages/components/src/sandbox/index.native.js | 6 ++---- packages/editor/src/components/provider/index.native.js | 2 ++ packages/react-native-editor/CHANGELOG.md | 1 + packages/react-native-editor/src/index.js | 2 ++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/block-library/src/embed/embed-preview.native.js b/packages/block-library/src/embed/embed-preview.native.js index 0beafe458ccca8..a0a677cfcbe2d6 100644 --- a/packages/block-library/src/embed/embed-preview.native.js +++ b/packages/block-library/src/embed/embed-preview.native.js @@ -9,11 +9,14 @@ import classnames from 'classnames/dedupe'; * WordPress dependencies */ import { View } from '@wordpress/primitives'; - -import { BlockCaption } from '@wordpress/block-editor'; +import { + BlockCaption, + store as blockEditorStore, +} from '@wordpress/block-editor'; import { __, sprintf } from '@wordpress/i18n'; import { memo, useState } from '@wordpress/element'; import { SandBox } from '@wordpress/components'; +import { useSelect } from '@wordpress/data'; /** * Internal dependencies @@ -38,6 +41,7 @@ const EmbedPreview = ( { url, } ) => { const [ isCaptionSelected, setIsCaptionSelected ] = useState( false ); + const { locale } = useSelect( blockEditorStore ).getSettings(); const wrapperStyle = styles[ 'embed-preview__wrapper' ]; const wrapperAlignStyle = @@ -105,6 +109,7 @@ const EmbedPreview = ( { > { diff --git a/packages/react-native-editor/CHANGELOG.md b/packages/react-native-editor/CHANGELOG.md index 519b20f7c3fefd..5cd18f997b58cc 100644 --- a/packages/react-native-editor/CHANGELOG.md +++ b/packages/react-native-editor/CHANGELOG.md @@ -12,6 +12,7 @@ For each user feature we should also add a importance categorization label to i ## Unreleased - [**] [Embed block] Implement WP embed preview component [#34004] - [*] [Embed block] Fix content disappearing on Android when switching light/dark mode [#34207] +- [*] Embed block: Add device's locale to preview content [#33858] ## 1.61.0 - [**] Enable embed preview for a list of providers (for now only YouTube and Twitter) [#34446] diff --git a/packages/react-native-editor/src/index.js b/packages/react-native-editor/src/index.js index 3fd18a16746487..a0fbf482154752 100644 --- a/packages/react-native-editor/src/index.js +++ b/packages/react-native-editor/src/index.js @@ -84,6 +84,7 @@ const setupInitHooks = () => { rawStyles, rawFeatures, galleryWithImageBlocks, + locale, } = props; if ( initialData === undefined && __DEV__ ) { @@ -112,6 +113,7 @@ const setupInitHooks = () => { rawStyles, rawFeatures, galleryWithImageBlocks, + locale, }; } );