From 004d7315ca65a5e3f0b003404da14433d1e72ff2 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 9 Nov 2018 17:45:38 +0100 Subject: [PATCH] Remove 4.3 deprecated APIs (#11679) * Remove 4.3 deprecated APIs * Update changelogs * Remove useless package dependency * Remove useless snapshot and mock * Update docs --- docs/data/data-core-edit-post.md | 22 ---------- lib/client-assets.php | 1 - package-lock.json | 1 - packages/components/CHANGELOG.md | 6 +++ packages/components/src/index.js | 1 - packages/components/src/panel/color.js | 40 ------------------ .../panel/test/__snapshots__/color.js.snap | 16 ------- packages/components/src/panel/test/color.js | 21 ---------- packages/edit-post/CHANGELOG.md | 7 ++++ packages/edit-post/package.json | 1 - packages/edit-post/src/store/actions.js | 21 ---------- packages/edit-post/src/store/selectors.js | 23 ---------- .../edit-post/src/store/test/selectors.js | 11 ----- packages/editor/CHANGELOG.md | 6 +++ packages/editor/src/components/index.js | 1 - .../src/components/panel-color/index.js | 42 ------------------- 16 files changed, 19 insertions(+), 201 deletions(-) delete mode 100644 packages/components/src/panel/color.js delete mode 100644 packages/components/src/panel/test/__snapshots__/color.js.snap delete mode 100644 packages/components/src/panel/test/color.js delete mode 100644 packages/editor/src/components/panel-color/index.js diff --git a/docs/data/data-core-edit-post.md b/docs/data/data-core-edit-post.md index 7e0dc7c8ceb5a..93e658e91d479 100644 --- a/docs/data/data-core-edit-post.md +++ b/docs/data/data-core-edit-post.md @@ -103,20 +103,6 @@ enabled by default. Whether or not the panel is enabled. -### isEditorSidebarPanelOpened - -Returns true if the given panel is enabled, or false otherwise. Panels are -enabled by default. - -*Parameters* - - * state: Global application state. - * panel: A string that identifies the panel. - -*Returns* - -Whether or not the panel is enabled. - ### isEditorPanelOpened Returns true if the given panel is open, or false otherwise. Panels are @@ -311,14 +297,6 @@ Returns an action object used to enable or disable a panel in the editor. Returns an action object used to open or close a panel in the editor. -*Parameters* - - * panelName: A string that identifies the panel to open or close. - -### toggleGeneralSidebarEditorPanel - -Returns an action object used to open or close a panel in the editor. - *Parameters* * panelName: A string that identifies the panel to open or close. diff --git a/lib/client-assets.php b/lib/client-assets.php index bbc898b8040ae..ed95afda111d1 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -716,7 +716,6 @@ function gutenberg_register_scripts_and_styles() { 'wp-compose', 'wp-core-data', 'wp-data', - 'wp-deprecated', 'wp-dom-ready', 'wp-editor', 'wp-element', diff --git a/package-lock.json b/package-lock.json index 635e403b6986f..03591075a66eb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2479,7 +2479,6 @@ "@wordpress/compose": "file:packages/compose", "@wordpress/core-data": "file:packages/core-data", "@wordpress/data": "file:packages/data", - "@wordpress/deprecated": "file:packages/deprecated", "@wordpress/editor": "file:packages/editor", "@wordpress/element": "file:packages/element", "@wordpress/format-library": "file:packages/format-library", diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 6b55f4e45690d..3d8a39e178245 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -1,3 +1,9 @@ +## 6.0.0 (Unreleased) + +### Breaking Changes + +- The `PanelColor` component has been removed. + ## 5.1.1 (2018-11-09) ## 5.1.0 (2018-11-09) diff --git a/packages/components/src/index.js b/packages/components/src/index.js index 5af9d24cd7077..c1143ba729cce 100644 --- a/packages/components/src/index.js +++ b/packages/components/src/index.js @@ -37,7 +37,6 @@ export { default as Notice } from './notice'; export { default as NoticeList } from './notice/list'; export { default as Panel } from './panel'; export { default as PanelBody } from './panel/body'; -export { default as PanelColor } from './panel/color'; export { default as PanelHeader } from './panel/header'; export { default as PanelRow } from './panel/row'; export { default as Placeholder } from './placeholder'; diff --git a/packages/components/src/panel/color.js b/packages/components/src/panel/color.js deleted file mode 100644 index 3c137e79eeeb6..0000000000000 --- a/packages/components/src/panel/color.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * WordPress dependencies - */ -import deprecated from '@wordpress/deprecated'; -import { __, sprintf } from '@wordpress/i18n'; - -/** - * Internal dependencies - */ -import PanelBody from './body'; -import ColorIndicator from '../color-indicator'; - -function PanelColor( { colorValue, colorName, title, ...props } ) { - deprecated( 'wp.components.PanelColor', { - version: '4.3', - alternative: 'wp.editor.PanelColorSettings', - plugin: 'Gutenberg', - } ); - - // translators: %s: The name of the color e.g: "vivid red" or color hex code if name is not available e.g: "#f00". - const currentColorLabel = sprintf( __( '(current color: %s)' ), colorName || colorValue ); - return ( - { title }, - colorValue && ( - - ), - ] } - /> - ); -} - -export default PanelColor; diff --git a/packages/components/src/panel/test/__snapshots__/color.js.snap b/packages/components/src/panel/test/__snapshots__/color.js.snap deleted file mode 100644 index 96c1ee2e38f76..0000000000000 --- a/packages/components/src/panel/test/__snapshots__/color.js.snap +++ /dev/null @@ -1,16 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PanelColor should match snapshot when title is provided 1`] = ` - - sample title - , - undefined, - ] - } -/> -`; diff --git a/packages/components/src/panel/test/color.js b/packages/components/src/panel/test/color.js deleted file mode 100644 index 31c00562daaee..0000000000000 --- a/packages/components/src/panel/test/color.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * External dependencies - */ -import { shallow } from 'enzyme'; - -/** - * Internal dependencies - */ -import PanelColor from '../color'; - -describe( 'PanelColor', () => { - it( 'should match snapshot when title is provided', () => { - const wrapper = shallow( ); - - expect( wrapper ).toMatchSnapshot(); - - expect( console ).toHaveWarnedWith( - 'wp.components.PanelColor is deprecated and will be removed from Gutenberg in 4.3. Please use wp.editor.PanelColorSettings instead.' - ); - } ); -} ); diff --git a/packages/edit-post/CHANGELOG.md b/packages/edit-post/CHANGELOG.md index 1be460e3d081c..f3fcee5b7aaef 100644 --- a/packages/edit-post/CHANGELOG.md +++ b/packages/edit-post/CHANGELOG.md @@ -1,3 +1,10 @@ +## 3.0.0 (Unreleased) + +### Breaking Changes + +- `isEditorSidebarPanelOpened` selector (`core/edit-post`) has been removed. Please use `isEditorPanelEnabled` instead. +- `toggleGeneralSidebarEditorPanel` action (`core/edit-post`) has been removed. Please use `toggleEditorPanelOpened` instead. + ## 2.1.1 (2018-11-09) ## 2.1.0 (2018-11-09) diff --git a/packages/edit-post/package.json b/packages/edit-post/package.json index d531e335f5885..b86e62bc153f7 100644 --- a/packages/edit-post/package.json +++ b/packages/edit-post/package.json @@ -28,7 +28,6 @@ "@wordpress/compose": "file:../compose", "@wordpress/core-data": "file:../core-data", "@wordpress/data": "file:../data", - "@wordpress/deprecated": "file:../deprecated", "@wordpress/editor": "file:../editor", "@wordpress/element": "file:../element", "@wordpress/format-library": "file:../format-library", diff --git a/packages/edit-post/src/store/actions.js b/packages/edit-post/src/store/actions.js index f90dcc8e04356..37c03750c3b77 100644 --- a/packages/edit-post/src/store/actions.js +++ b/packages/edit-post/src/store/actions.js @@ -1,8 +1,3 @@ -/** - * WordPress dependencies - */ -import deprecated from '@wordpress/deprecated'; - /** * Returns an action object used in signalling that the user opened an editor sidebar. * @@ -116,22 +111,6 @@ export function toggleEditorPanelOpened( panelName ) { }; } -/** - * Returns an action object used to open or close a panel in the editor. - * - * @param {string} panelName A string that identifies the panel to open or close. - * - * @return {Object} Action object. -*/ -export function toggleGeneralSidebarEditorPanel( panelName ) { - deprecated( 'toggleGeneralSidebarEditorPanel', { - alternative: 'toggleEditorPanelOpened', - plugin: 'Gutenberg', - version: '4.3.0', - } ); - return toggleEditorPanelOpened( panelName ); -} - /** * Returns an action object used to toggle a feature flag. * diff --git a/packages/edit-post/src/store/selectors.js b/packages/edit-post/src/store/selectors.js index 8d7d41b76abae..f01e1e22ed8ab 100644 --- a/packages/edit-post/src/store/selectors.js +++ b/packages/edit-post/src/store/selectors.js @@ -4,11 +4,6 @@ import createSelector from 'rememo'; import { get, includes, some, flatten, values } from 'lodash'; -/** - * WordPress dependencies - */ -import deprecated from '@wordpress/deprecated'; - /** * Returns the current editing mode. * @@ -118,24 +113,6 @@ export function isEditorPanelEnabled( state, panelName ) { return get( panels, [ panelName, 'enabled' ], true ); } -/** - * Returns true if the given panel is enabled, or false otherwise. Panels are - * enabled by default. - * - * @param {Object} state Global application state. - * @param {string} panel A string that identifies the panel. - * - * @return {boolean} Whether or not the panel is enabled. - */ -export function isEditorSidebarPanelOpened( state, panel ) { - deprecated( 'isEditorSidebarPanelOpened', { - alternative: 'isEditorPanelEnabled', - plugin: 'Gutenberg', - version: '4.3', - } ); - return isEditorPanelEnabled( state, panel ); -} - /** * Returns true if the given panel is open, or false otherwise. Panels are * closed by default. diff --git a/packages/edit-post/src/store/test/selectors.js b/packages/edit-post/src/store/test/selectors.js index 32dbce728572f..4a13ec8e4392c 100644 --- a/packages/edit-post/src/store/test/selectors.js +++ b/packages/edit-post/src/store/test/selectors.js @@ -1,8 +1,3 @@ -/** - * WordPress dependencies - */ -import deprecated from '@wordpress/deprecated'; - /** * Internal dependencies */ @@ -23,13 +18,7 @@ import { isEditorPanelEnabled, } from '../selectors'; -jest.mock( '@wordpress/deprecated', () => jest.fn() ); - describe( 'selectors', () => { - beforeEach( () => { - deprecated.mockClear(); - } ); - describe( 'getEditorMode', () => { it( 'should return the selected editor mode', () => { const state = { diff --git a/packages/editor/CHANGELOG.md b/packages/editor/CHANGELOG.md index 0ac5a427b55fb..0e88d46040f13 100644 --- a/packages/editor/CHANGELOG.md +++ b/packages/editor/CHANGELOG.md @@ -1,3 +1,9 @@ +## 7.0.0 (Unreleased) + +### Breaking Changes + +- The `PanelColor` component has been removed. + ## 6.2.1 (2018-11-09) ### Polish diff --git a/packages/editor/src/components/index.js b/packages/editor/src/components/index.js index 3cce6ea3cd87a..55b798561a602 100644 --- a/packages/editor/src/components/index.js +++ b/packages/editor/src/components/index.js @@ -16,7 +16,6 @@ export * from './font-sizes'; export { default as InnerBlocks } from './inner-blocks'; export { default as InspectorAdvancedControls } from './inspector-advanced-controls'; export { default as InspectorControls } from './inspector-controls'; -export { default as PanelColor } from './panel-color'; export { default as PanelColorSettings } from './panel-color-settings'; export { default as PlainText } from './plain-text'; export { diff --git a/packages/editor/src/components/panel-color/index.js b/packages/editor/src/components/panel-color/index.js deleted file mode 100644 index 327384a127653..0000000000000 --- a/packages/editor/src/components/panel-color/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * External dependencies - */ -import { omit } from 'lodash'; - -/** - * WordPress dependencies - */ -import { PanelColor as PanelColorComponent } from '@wordpress/components'; -import { ifCondition, compose } from '@wordpress/compose'; -import deprecated from '@wordpress/deprecated'; - -/** - * Internal dependencies - */ -import ColorPalette from '../color-palette'; -import withColorContext from '../color-palette/with-color-context'; -import { getColorObjectByColorValue } from '../colors'; - -function PanelColor( { colors, title, colorValue, initialOpen, ...props } ) { - deprecated( 'wp.editor.PanelColor', { - version: '4.3', - alternative: 'wp.editor.PanelColorSettings', - plugin: 'Gutenberg', - } ); - - const colorObject = getColorObjectByColorValue( colors, colorValue ); - const colorName = colorObject && colorObject.name; - return ( - - - - ); -} - -export default compose( [ - withColorContext, - ifCondition( ( { hasColorsToChoose } ) => hasColorsToChoose ), -] )( PanelColor );