diff --git a/blocks/alignment-toolbar/index.js b/blocks/alignment-toolbar/index.js index f0fa63c6a11e1..26d09adcae9b9 100644 --- a/blocks/alignment-toolbar/index.js +++ b/blocks/alignment-toolbar/index.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Toolbar } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Toolbar } from '@wordpress/components'; const ALIGNMENT_CONTROLS = [ { diff --git a/blocks/api/categories.js b/blocks/api/categories.js index 2ca1fbbea3b8b..22d2369255c2a 100644 --- a/blocks/api/categories.js +++ b/blocks/api/categories.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Block categories. diff --git a/blocks/api/paste.js b/blocks/api/paste.js index bbc87a4530d68..d30668f12d8ae 100644 --- a/blocks/api/paste.js +++ b/blocks/api/paste.js @@ -3,17 +3,23 @@ */ import { find, get, flowRight as compose } from 'lodash'; +/** + * WordPress dependencies + */ +import { nodetypes } from '@wordpress/utils'; + /** * Internal dependencies */ import { createBlock } from './factory'; import { getBlockTypes, getUnknownTypeHandler } from './registration'; import { parseBlockAttributes } from './parser'; -import { ELEMENT_NODE, TEXT_NODE } from 'utils/nodetypes'; import convertTables from './paste/convert-tables'; import stripAttributes from './paste/strip-attributes'; import removeSpans from './paste/remove-spans'; +const { ELEMENT_NODE, TEXT_NODE } = nodetypes; + /** * Normalises array nodes of any node type to an array of block level nodes. * @param {Array} nodes Array of Nodes. diff --git a/blocks/api/paste/remove-spans.js b/blocks/api/paste/remove-spans.js index 668aa970d73e0..a56fadc596b33 100644 --- a/blocks/api/paste/remove-spans.js +++ b/blocks/api/paste/remove-spans.js @@ -1,4 +1,9 @@ -import { ELEMENT_NODE } from 'utils/nodetypes'; +/** + * WordPress dependencies + */ +import { nodetypes } from '@wordpress/utils'; + +const { ELEMENT_NODE } = nodetypes; /** * diff --git a/blocks/api/query.js b/blocks/api/query.js index c369164b335db..72a7ed4db08f9 100644 --- a/blocks/api/query.js +++ b/blocks/api/query.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { createElement } from 'element'; +import { createElement } from '@wordpress/element'; /** * External dependencies diff --git a/blocks/api/serializer.js b/blocks/api/serializer.js index 438e143aa1ce9..2835fae8b9824 100644 --- a/blocks/api/serializer.js +++ b/blocks/api/serializer.js @@ -8,7 +8,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { Component, createElement, renderToString, cloneElement, Children } from 'element'; +import { Component, createElement, renderToString, cloneElement, Children } from '@wordpress/element'; /** * Internal dependencies diff --git a/blocks/api/test/query.js b/blocks/api/test/query.js index 5ee4cdec4d321..500d139f7ca6d 100644 --- a/blocks/api/test/query.js +++ b/blocks/api/test/query.js @@ -6,7 +6,7 @@ import { parse } from 'hpq'; /** * WordPress dependencies */ -import { renderToString } from 'element'; +import { renderToString } from '@wordpress/element'; /** * Internal dependencies diff --git a/blocks/api/test/serializer.js b/blocks/api/test/serializer.js index 9e80e5981c42e..40c81ecbb40bd 100644 --- a/blocks/api/test/serializer.js +++ b/blocks/api/test/serializer.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { createElement, Component } from 'element'; +import { createElement, Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/blocks/block-alignment-toolbar/index.js b/blocks/block-alignment-toolbar/index.js index 92fc9155454aa..a48b1e8515ced 100644 --- a/blocks/block-alignment-toolbar/index.js +++ b/blocks/block-alignment-toolbar/index.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Toolbar } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Toolbar } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/block-controls/index.js b/blocks/block-controls/index.js index e554ef073f191..40e373e4d1847 100644 --- a/blocks/block-controls/index.js +++ b/blocks/block-controls/index.js @@ -6,7 +6,7 @@ import { Fill } from 'react-slot-fill'; /** * WordPress dependencies */ -import { Toolbar } from 'components'; +import { Toolbar } from '@wordpress/components'; export default function BlockControls( { controls, children } ) { return ( diff --git a/blocks/block-icon/index.js b/blocks/block-icon/index.js index f5b52e5e8405e..cb8cc122ef875 100644 --- a/blocks/block-icon/index.js +++ b/blocks/block-icon/index.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import Dashicon from 'components/dashicon'; -import { createElement, Component } from 'element'; +import { Dashicon } from '@wordpress/components'; +import { createElement, Component } from '@wordpress/element'; export default function BlockIcon( { icon } ) { if ( 'string' === typeof icon ) { diff --git a/blocks/block-icon/test/index.js b/blocks/block-icon/test/index.js index 94d55eafd4189..4f9e51649b2c4 100644 --- a/blocks/block-icon/test/index.js +++ b/blocks/block-icon/test/index.js @@ -6,7 +6,7 @@ import { shallow } from 'enzyme'; /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/blocks/editable/format-toolbar/index.js b/blocks/editable/format-toolbar/index.js index 62b447c0420e4..023e2408974bd 100644 --- a/blocks/editable/format-toolbar/index.js +++ b/blocks/editable/format-toolbar/index.js @@ -6,10 +6,10 @@ import { isUndefined } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { IconButton, Toolbar } from 'components'; -import { ESCAPE } from 'utils/keycodes'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { IconButton, Toolbar } from '@wordpress/components'; +import { keycodes } from '@wordpress/utils'; /** * Internal dependencies @@ -17,6 +17,8 @@ import { ESCAPE } from 'utils/keycodes'; import './style.scss'; import UrlInput from '../../url-input'; +const { ESCAPE } = keycodes; + const FORMATTING_CONTROLS = [ { icon: 'editor-bold', diff --git a/blocks/editable/index.js b/blocks/editable/index.js index 76c787183a2a1..a4421857aa600 100644 --- a/blocks/editable/index.js +++ b/blocks/editable/index.js @@ -21,18 +21,20 @@ import 'element-closest'; /** * WordPress dependencies */ -import { createElement, Component, renderToString } from 'element'; -import { parse, pasteHandler } from '../api'; -import { BACKSPACE, DELETE, ENTER } from 'utils/keycodes'; +import { createElement, Component, renderToString } from '@wordpress/element'; +import { keycodes } from '@wordpress/utils'; /** * Internal dependencies */ import './style.scss'; +import { parse, pasteHandler } from '../api'; import FormatToolbar from './format-toolbar'; import TinyMCE from './tinymce'; import patterns from './patterns'; +const { BACKSPACE, DELETE, ENTER } = keycodes; + function createTinyMCEElement( type, props, ...children ) { if ( props[ 'data-mce-bogus' ] === 'all' ) { return null; diff --git a/blocks/editable/patterns.js b/blocks/editable/patterns.js index 7620c863e55e3..6812bdd87e843 100644 --- a/blocks/editable/patterns.js +++ b/blocks/editable/patterns.js @@ -7,7 +7,7 @@ import { endsWith, find, get, escapeRegExp, partition, drop } from 'lodash'; /** * WordPress dependencies */ -import { ESCAPE, ENTER, SPACE, BACKSPACE } from 'utils/keycodes'; +import { keycodes } from '@wordpress/utils'; /** * Internal dependencies @@ -19,6 +19,8 @@ import { getBlockTypes } from '../api/registration'; */ const { setTimeout } = window; +const { ESCAPE, ENTER, SPACE, BACKSPACE } = keycodes; + export default function( editor ) { const getContent = this.getContent.bind( this ); const { onReplace } = this.props; diff --git a/blocks/editable/provider.js b/blocks/editable/provider.js index 38aca7fdeaaeb..1982adcc7ca0b 100644 --- a/blocks/editable/provider.js +++ b/blocks/editable/provider.js @@ -6,7 +6,7 @@ import { pick, noop } from 'lodash'; /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; /** * The Editable Provider allows a rendering context to define global behaviors diff --git a/blocks/editable/tinymce.js b/blocks/editable/tinymce.js index 286388f3ae8c0..fe1ba297bfed1 100644 --- a/blocks/editable/tinymce.js +++ b/blocks/editable/tinymce.js @@ -8,7 +8,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { Component, Children, createElement } from 'element'; +import { Component, Children, createElement } from '@wordpress/element'; export default class TinyMCE extends Component { componentDidMount() { diff --git a/blocks/inspector-controls/checkbox-control/index.js b/blocks/inspector-controls/checkbox-control/index.js index 10eebd4072bc2..55ca47b2cd4b2 100644 --- a/blocks/inspector-controls/checkbox-control/index.js +++ b/blocks/inspector-controls/checkbox-control/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { withInstanceId } from 'components'; +import { withInstanceId } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/inspector-controls/radio-control/index.js b/blocks/inspector-controls/radio-control/index.js index 3ee2b938c5469..cda2074d94d53 100644 --- a/blocks/inspector-controls/radio-control/index.js +++ b/blocks/inspector-controls/radio-control/index.js @@ -6,7 +6,7 @@ import { isEmpty } from 'lodash'; /** * WordPress dependencies */ -import { withInstanceId } from 'components'; +import { withInstanceId } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/inspector-controls/range-control/index.js b/blocks/inspector-controls/range-control/index.js index ce6ced8f6f7b0..1dc4fa96fbb2e 100644 --- a/blocks/inspector-controls/range-control/index.js +++ b/blocks/inspector-controls/range-control/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { withInstanceId } from 'components'; +import { withInstanceId } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/inspector-controls/select-control/index.js b/blocks/inspector-controls/select-control/index.js index 86cc3f488523a..fa68a5635ac8b 100644 --- a/blocks/inspector-controls/select-control/index.js +++ b/blocks/inspector-controls/select-control/index.js @@ -6,7 +6,7 @@ import { isEmpty } from 'lodash'; /** * WordPress dependencies */ -import { withInstanceId } from 'components'; +import { withInstanceId } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/inspector-controls/text-control/index.js b/blocks/inspector-controls/text-control/index.js index 2b9874dd03a30..babb53d57373a 100644 --- a/blocks/inspector-controls/text-control/index.js +++ b/blocks/inspector-controls/text-control/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { withInstanceId } from 'components'; +import { withInstanceId } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/inspector-controls/textarea-control/index.js b/blocks/inspector-controls/textarea-control/index.js index 3c01c2b0ba860..993783c341eba 100644 --- a/blocks/inspector-controls/textarea-control/index.js +++ b/blocks/inspector-controls/textarea-control/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { withInstanceId } from 'components'; +import { withInstanceId } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/inspector-controls/toggle-control/index.js b/blocks/inspector-controls/toggle-control/index.js index 45df64248dd47..338b7fae4105d 100644 --- a/blocks/inspector-controls/toggle-control/index.js +++ b/blocks/inspector-controls/toggle-control/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { withInstanceId, FormToggle } from 'components'; +import { withInstanceId, FormToggle } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/library/button/index.js b/blocks/library/button/index.js index 521f29ceb85cb..121e6a1d1af15 100644 --- a/blocks/library/button/index.js +++ b/blocks/library/button/index.js @@ -6,8 +6,8 @@ import { CirclePicker } from 'react-color'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { IconButton } from 'components'; +import { __ } from '@wordpress/i18n'; +import { IconButton } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/library/code/index.js b/blocks/library/code/index.js index d64d8d54af01f..ae8490adcb4cb 100644 --- a/blocks/library/code/index.js +++ b/blocks/library/code/index.js @@ -6,7 +6,7 @@ import TextareaAutosize from 'react-autosize-textarea'; /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/blocks/library/cover-image/index.js b/blocks/library/cover-image/index.js index 868e147e45417..9e56c3c41ccd8 100644 --- a/blocks/library/cover-image/index.js +++ b/blocks/library/cover-image/index.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { Placeholder, Toolbar, Dashicon } from 'components'; -import { __ } from 'i18n'; +import { Placeholder, Toolbar, Dashicon } from '@wordpress/components'; +import { __ } from '@wordpress/i18n'; import classnames from 'classnames'; /** diff --git a/blocks/library/cover-text/index.js b/blocks/library/cover-text/index.js index 8e94bb0107349..e22c88ddfcf40 100644 --- a/blocks/library/cover-text/index.js +++ b/blocks/library/cover-text/index.js @@ -6,8 +6,8 @@ import { CirclePicker } from 'react-color'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { concatChildren } from 'element'; +import { __ } from '@wordpress/i18n'; +import { concatChildren } from '@wordpress/element'; /** * Internal dependencies diff --git a/blocks/library/embed/index.js b/blocks/library/embed/index.js index 071de38c3660d..8238338af0df3 100644 --- a/blocks/library/embed/index.js +++ b/blocks/library/embed/index.js @@ -7,10 +7,12 @@ import { includes } from 'lodash'; /** * WordPress dependencies */ -import { __, sprintf } from 'i18n'; -import { Component } from 'element'; -import { Button, Placeholder, Spinner, SandBox } from 'components'; -import { addQueryArgs } from 'editor/utils/url'; +import { __, sprintf } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { Button, Placeholder, Spinner, SandBox } from '@wordpress/components'; +// TODO: This is a circular dependency between editor and blocks. This must be +// updated, eventually to depend on published `@wordpress/url` +import { addQueryArgs } from '../../../editor/utils/url'; /** * Internal dependencies diff --git a/blocks/library/freeform/index.js b/blocks/library/freeform/index.js index 78beb9972cf33..e2f986b7050c6 100644 --- a/blocks/library/freeform/index.js +++ b/blocks/library/freeform/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/blocks/library/freeform/old-editor.js b/blocks/library/freeform/old-editor.js index dfe7b7612cce3..846379d943868 100644 --- a/blocks/library/freeform/old-editor.js +++ b/blocks/library/freeform/old-editor.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { Component } from 'element'; -import { __ } from 'i18n'; +import { Component } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; export default class OldEditor extends Component { constructor( props ) { diff --git a/blocks/library/gallery/index.js b/blocks/library/gallery/index.js index c70823ff14b36..3ab36838bee0e 100644 --- a/blocks/library/gallery/index.js +++ b/blocks/library/gallery/index.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Toolbar, Placeholder } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Toolbar, Placeholder } from '@wordpress/components'; import { pick } from 'lodash'; /** diff --git a/blocks/library/heading/index.js b/blocks/library/heading/index.js index b2bd04a4f5c69..d7cc3e72558e1 100644 --- a/blocks/library/heading/index.js +++ b/blocks/library/heading/index.js @@ -6,9 +6,9 @@ import { isObject } from 'lodash'; /** * WordPress dependencies */ -import { __, sprintf } from 'i18n'; -import { concatChildren } from 'element'; -import { Toolbar } from 'components'; +import { __, sprintf } from '@wordpress/i18n'; +import { concatChildren } from '@wordpress/element'; +import { Toolbar } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/library/html/index.js b/blocks/library/html/index.js index 7d869fd30e258..eaec1f9a57c95 100644 --- a/blocks/library/html/index.js +++ b/blocks/library/html/index.js @@ -6,8 +6,8 @@ import TextareaAutosize from 'react-autosize-textarea'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/blocks/library/image/index.js b/blocks/library/image/index.js index 8a1aaeab0da16..7449e307c5d00 100644 --- a/blocks/library/image/index.js +++ b/blocks/library/image/index.js @@ -6,8 +6,8 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Placeholder, Dashicon, Toolbar, DropZone } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Placeholder, Dashicon, Toolbar, DropZone } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/library/latest-posts/index.js b/blocks/library/latest-posts/index.js index 4bf14944c1385..5bc28951a7772 100644 --- a/blocks/library/latest-posts/index.js +++ b/blocks/library/latest-posts/index.js @@ -1,9 +1,9 @@ /** * WordPress dependencies */ -import { Component } from 'element'; -import { Placeholder, Toolbar, Spinner } from 'components'; -import { __ } from 'i18n'; +import { Component } from '@wordpress/element'; +import { Placeholder, Toolbar, Spinner } from '@wordpress/components'; +import { __ } from '@wordpress/i18n'; import moment from 'moment'; import classnames from 'classnames'; diff --git a/blocks/library/list/index.js b/blocks/library/list/index.js index e959ff0f92eaf..b385b8d77c701 100644 --- a/blocks/library/list/index.js +++ b/blocks/library/list/index.js @@ -1,9 +1,13 @@ /** - * WordPress dependencies + * External dependencies */ -import { Component, createElement, Children, concatChildren } from 'element'; import { find } from 'lodash'; -import { __ } from 'i18n'; + +/** + * WordPress dependencies + */ +import { Component, createElement, Children, concatChildren } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/blocks/library/more/index.js b/blocks/library/more/index.js index 2f88dadc95ceb..241c6a2be2e7b 100644 --- a/blocks/library/more/index.js +++ b/blocks/library/more/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/blocks/library/preformatted/index.js b/blocks/library/preformatted/index.js index b43e2618b8213..b30b407abdea0 100644 --- a/blocks/library/preformatted/index.js +++ b/blocks/library/preformatted/index.js @@ -1,7 +1,7 @@ /** * WordPress */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/blocks/library/pullquote/index.js b/blocks/library/pullquote/index.js index f5db977f82939..9db8cda032da9 100644 --- a/blocks/library/pullquote/index.js +++ b/blocks/library/pullquote/index.js @@ -6,7 +6,7 @@ import { isString } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/blocks/library/quote/index.js b/blocks/library/quote/index.js index f2cc44b3ec442..8c0425cfc3202 100644 --- a/blocks/library/quote/index.js +++ b/blocks/library/quote/index.js @@ -6,8 +6,8 @@ import { isString, isObject } from 'lodash'; /** * WordPress dependencies */ -import { __, sprintf } from 'i18n'; -import { Toolbar } from 'components'; +import { __, sprintf } from '@wordpress/i18n'; +import { Toolbar } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/library/separator/index.js b/blocks/library/separator/index.js index 51c4fb524c703..6fd35d6afe44b 100644 --- a/blocks/library/separator/index.js +++ b/blocks/library/separator/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/blocks/library/table/table-block.js b/blocks/library/table/table-block.js index 22a527035b66f..b880fe45c9b79 100644 --- a/blocks/library/table/table-block.js +++ b/blocks/library/table/table-block.js @@ -1,7 +1,7 @@ import Editable from '../../editable'; import BlockControls from '../../block-controls'; -import { Toolbar, DropdownMenu } from 'components'; -import { __ } from 'i18n'; +import { Toolbar, DropdownMenu } from '@wordpress/components'; +import { __ } from '@wordpress/i18n'; function execCommand( command ) { return ( editor ) => { diff --git a/blocks/library/text/index.js b/blocks/library/text/index.js index 723ebcb20b0ef..9c00e0aca6c4b 100644 --- a/blocks/library/text/index.js +++ b/blocks/library/text/index.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { concatChildren } from 'element'; +import { __ } from '@wordpress/i18n'; +import { concatChildren } from '@wordpress/element'; /** * Internal dependencies diff --git a/blocks/library/verse/index.js b/blocks/library/verse/index.js index 966124ca2324c..ea611dd37a24b 100644 --- a/blocks/library/verse/index.js +++ b/blocks/library/verse/index.js @@ -1,7 +1,7 @@ /** * WordPress */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/blocks/media-upload-button/index.js b/blocks/media-upload-button/index.js index 5ac467e4d0463..cd018d14abb2f 100644 --- a/blocks/media-upload-button/index.js +++ b/blocks/media-upload-button/index.js @@ -1,9 +1,9 @@ /** * WordPress dependencies */ -import { Component } from 'element'; -import { __ } from 'i18n'; -import { Button } from 'components'; +import { Component } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; +import { Button } from '@wordpress/components'; import { pick } from 'lodash'; // Getter for the sake of unit tests. diff --git a/blocks/url-input/button.js b/blocks/url-input/button.js index afd34bdcd9b68..c3d95418df90a 100644 --- a/blocks/url-input/button.js +++ b/blocks/url-input/button.js @@ -7,9 +7,9 @@ import classnames from 'classnames'; * WordPress dependencies */ import './style.scss'; -import { __ } from 'i18n'; -import { Component } from 'element'; -import { IconButton } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { IconButton } from '@wordpress/components'; /** * Internal dependencies diff --git a/blocks/url-input/index.js b/blocks/url-input/index.js index 2322116aa3ba9..98972d36484df 100644 --- a/blocks/url-input/index.js +++ b/blocks/url-input/index.js @@ -8,10 +8,12 @@ import scrollIntoView from 'dom-scroll-into-view'; /** * WordPress dependencies */ -import { __, sprintf, _n } from 'i18n'; -import { Component } from 'element'; -import { UP, DOWN, ENTER } from 'utils/keycodes'; -import { Spinner, withInstanceId } from 'components'; +import { __, sprintf, _n } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { keycodes } from '@wordpress/utils'; +import { Spinner, withInstanceId } from '@wordpress/components'; + +const { UP, DOWN, ENTER } = keycodes; class UrlInput extends Component { constructor() { diff --git a/blocks/with-editor-settings/index.js b/blocks/with-editor-settings/index.js index 1d2335cb31ce8..fd20454f81ad7 100644 --- a/blocks/with-editor-settings/index.js +++ b/blocks/with-editor-settings/index.js @@ -6,7 +6,7 @@ import { noop } from 'lodash'; /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; const withEditorSettings = ( mapSettingsToProps ) => ( OriginalComponent ) => { class WrappedComponent extends Component { diff --git a/components/README.md b/components/README.md index 41e47330beaa4..0e30e5b3fb9a3 100644 --- a/components/README.md +++ b/components/README.md @@ -11,7 +11,7 @@ Within Gutenberg, these components can be accessed by importing from the `compon /** * WordPress dependencies */ -import { Button } from 'components'; +import { Button } from '@wordpress/components'; export default function MyButton() { return ; diff --git a/components/button/index.js b/components/button/index.js index e13ec43759c5a..dde66367f378d 100644 --- a/components/button/index.js +++ b/components/button/index.js @@ -7,7 +7,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { Component, createElement } from 'element'; +import { Component, createElement } from '@wordpress/element'; class Button extends Component { constructor( props ) { diff --git a/components/clipboard-button/index.js b/components/clipboard-button/index.js index 2bcbb9f403f89..e52ef576afc4b 100644 --- a/components/clipboard-button/index.js +++ b/components/clipboard-button/index.js @@ -8,7 +8,7 @@ import { noop } from 'lodash'; /** * WordPress dependencies */ -import { findDOMNode, Component } from 'element'; +import { findDOMNode, Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/components/drop-zone/index.js b/components/drop-zone/index.js index a81c89cbdaa4f..f5524b87dc6f4 100644 --- a/components/drop-zone/index.js +++ b/components/drop-zone/index.js @@ -7,14 +7,14 @@ import { includes, without } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import Dashicon from 'components/dashicon'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; /** * Internal dependencies */ import './style.scss'; +import Dashicon from '../dashicon'; class DropZone extends Component { constructor() { diff --git a/components/dropdown-menu/index.js b/components/dropdown-menu/index.js index 97bfff5e03530..6902e91d57b75 100644 --- a/components/dropdown-menu/index.js +++ b/components/dropdown-menu/index.js @@ -7,15 +7,17 @@ import clickOutside from 'react-click-outside'; /** * WordPress dependencies */ -import IconButton from 'components/icon-button'; -import Dashicon from 'components/dashicon'; -import { Component, findDOMNode } from 'element'; -import { TAB, ESCAPE, LEFT, UP, RIGHT, DOWN } from 'utils/keycodes'; +import { Component, findDOMNode } from '@wordpress/element'; +import { keycodes } from '@wordpress/utils'; /** * Internal dependencies */ import './style.scss'; +import IconButton from '../icon-button'; +import Dashicon from '../dashicon'; + +const { TAB, ESCAPE, LEFT, UP, RIGHT, DOWN } = keycodes; export class DropdownMenu extends Component { constructor() { diff --git a/components/dropdown-menu/test/index.js b/components/dropdown-menu/test/index.js index 3e2b82f3c7c80..b52a259b6ef05 100644 --- a/components/dropdown-menu/test/index.js +++ b/components/dropdown-menu/test/index.js @@ -6,13 +6,15 @@ import { shallow, mount } from 'enzyme'; /** * WordPress dependencies */ -import { TAB, ESCAPE, LEFT, UP, RIGHT, DOWN } from 'utils/keycodes'; +import { keycodes } from '@wordpress/utils'; /** * Internal dependencies */ import { DropdownMenu } from '../'; +const { TAB, ESCAPE, LEFT, UP, RIGHT, DOWN } = keycodes; + describe( 'DropdownMenu', () => { let controls; beforeEach( () => { diff --git a/components/external-link/index.js b/components/external-link/index.js index 52777d25f6b4d..6a484111ff665 100644 --- a/components/external-link/index.js +++ b/components/external-link/index.js @@ -7,7 +7,7 @@ import { compact, uniq } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/components/form-toggle/index.js b/components/form-toggle/index.js index 1ec8086c7e1db..3f6766995333a 100644 --- a/components/form-toggle/index.js +++ b/components/form-toggle/index.js @@ -7,7 +7,7 @@ import { noop } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/components/form-token-field/index.js b/components/form-token-field/index.js index 5c63aaa905ccd..03400386a5fc3 100644 --- a/components/form-token-field/index.js +++ b/components/form-token-field/index.js @@ -7,8 +7,8 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { __, _n, sprintf } from 'i18n'; -import { Component } from 'element'; +import { __, _n, sprintf } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/components/form-token-field/suggestions-list.js b/components/form-token-field/suggestions-list.js index 40f06232d55bd..4da41558be959 100644 --- a/components/form-token-field/suggestions-list.js +++ b/components/form-token-field/suggestions-list.js @@ -8,7 +8,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; class SuggestionsList extends Component { constructor() { diff --git a/components/form-token-field/test/lib/token-field-wrapper.js b/components/form-token-field/test/lib/token-field-wrapper.js index e73e1243388c4..8f50d95b0065f 100644 --- a/components/form-token-field/test/lib/token-field-wrapper.js +++ b/components/form-token-field/test/lib/token-field-wrapper.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; import { unescape } from 'lodash'; /** diff --git a/components/form-token-field/token-input.js b/components/form-token-field/token-input.js index 0e904c16801fa..fa61d4edd986c 100644 --- a/components/form-token-field/token-input.js +++ b/components/form-token-field/token-input.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; class TokenInput extends Component { constructor() { diff --git a/components/form-token-field/token.js b/components/form-token-field/token.js index 2e03e3cf980e7..4e0daa3f566a4 100644 --- a/components/form-token-field/token.js +++ b/components/form-token-field/token.js @@ -7,8 +7,12 @@ import { noop } from 'lodash'; /** * WordPress dependencies */ -import { sprintf } from 'i18n'; -import IconButton from 'components/icon-button'; +import { sprintf } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import IconButton from '../icon-button'; function Token( { value, diff --git a/components/higher-order/with-focus-return/index.js b/components/higher-order/with-focus-return/index.js index 37c823bac0a74..99a5ceb47063f 100644 --- a/components/higher-order/with-focus-return/index.js +++ b/components/higher-order/with-focus-return/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { Component, findDOMNode } from 'element'; +import { Component, findDOMNode } from '@wordpress/element'; /** * Higher Order Component used to be used to wrap disposable elements like Sidebars, modals, dropdowns. diff --git a/components/higher-order/with-instance-id/README.md b/components/higher-order/with-instance-id/README.md index 51dfe0a5bc050..31dd5c3e845f2 100644 --- a/components/higher-order/with-instance-id/README.md +++ b/components/higher-order/with-instance-id/README.md @@ -10,7 +10,7 @@ Wrapping a component with `withInstanceId` provides a unique `instanceId` to ser /** * WordPress dependencies */ -import { withInstanceId } from 'components'; +import { withInstanceId } from '@wordpress/components'; function MyCustomElement( { instanceId } ) { return ( diff --git a/components/higher-order/with-instance-id/index.js b/components/higher-order/with-instance-id/index.js index 7cde5b7925e74..400e891f6113d 100644 --- a/components/higher-order/with-instance-id/index.js +++ b/components/higher-order/with-instance-id/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; /** * A Higher Order Component used to be provide a unique instance ID by component diff --git a/components/icon-button/index.js b/components/icon-button/index.js index 458c0e9335a62..b6769d026b2f5 100644 --- a/components/icon-button/index.js +++ b/components/icon-button/index.js @@ -6,7 +6,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/components/keyboard-shortcuts/index.js b/components/keyboard-shortcuts/index.js index b085358618c1f..f7fed78b6e9ef 100644 --- a/components/keyboard-shortcuts/index.js +++ b/components/keyboard-shortcuts/index.js @@ -7,7 +7,7 @@ import { forEach } from 'lodash'; /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; class KeyboardShortcuts extends Component { componentWillMount() { diff --git a/components/notice/index.js b/components/notice/index.js index 8c1b063cfde8d..bb9155fdf2c6d 100644 --- a/components/notice/index.js +++ b/components/notice/index.js @@ -6,7 +6,7 @@ import { isString, noop } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; /** * Internal Dependencies diff --git a/components/panel/body.js b/components/panel/body.js index 90a4a86967835..e439b49ab14fb 100644 --- a/components/panel/body.js +++ b/components/panel/body.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { Component } from 'element'; -import { __, sprintf } from 'i18n'; +import { Component } from '@wordpress/element'; +import { __, sprintf } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/components/placeholder/test/index.js b/components/placeholder/test/index.js index 7537d69bb06b9..54f9f847f9750 100644 --- a/components/placeholder/test/index.js +++ b/components/placeholder/test/index.js @@ -6,7 +6,7 @@ import { shallow } from 'enzyme'; /** * Internal dependencies */ -import { Placeholder } from 'components'; +import Placeholder from '../'; describe( 'Placeholder', () => { describe( 'basic rendering', () => { diff --git a/components/popover/index.js b/components/popover/index.js index 5b0d2d697c59a..54ef109040a41 100644 --- a/components/popover/index.js +++ b/components/popover/index.js @@ -6,7 +6,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/components/responsive-wrapper/index.js b/components/responsive-wrapper/index.js index ece05826df838..3b9957862647f 100644 --- a/components/responsive-wrapper/index.js +++ b/components/responsive-wrapper/index.js @@ -6,7 +6,7 @@ import classnames from 'classnames'; /** * WordPress Dependencies */ -import { cloneElement, Children } from 'element'; +import { cloneElement, Children } from '@wordpress/element'; /** * Internal dependencies diff --git a/components/sandbox/index.js b/components/sandbox/index.js index 9268b09444515..306a4be56cb8e 100644 --- a/components/sandbox/index.js +++ b/components/sandbox/index.js @@ -1,4 +1,4 @@ -import { renderToString } from 'element'; +import { renderToString } from '@wordpress/element'; export default class Sandbox extends wp.element.Component { diff --git a/docs/coding-guidelines.md b/docs/coding-guidelines.md index 823022b8cb62b..1c642d63fb7d4 100644 --- a/docs/coding-guidelines.md +++ b/docs/coding-guidelines.md @@ -72,7 +72,7 @@ Example: /** * WordPress dependencies */ -import { __ } from 'i18n'; +import { __ } from '@wordpress/i18n'; ``` #### Internal Dependencies diff --git a/editor/block-mover/index.js b/editor/block-mover/index.js index fd57c070c1ac2..5bc3a2370fc6f 100644 --- a/editor/block-mover/index.js +++ b/editor/block-mover/index.js @@ -7,8 +7,8 @@ import { first, last } from 'lodash'; /** * WordPress dependencies */ -import { IconButton } from 'components'; -import { getBlockType } from 'blocks'; +import { IconButton } from '@wordpress/components'; +import { getBlockType } from '@wordpress/blocks'; /** * Internal dependencies diff --git a/editor/block-mover/mover-label.js b/editor/block-mover/mover-label.js index 65db9b512213a..1b09cce174259 100644 --- a/editor/block-mover/mover-label.js +++ b/editor/block-mover/mover-label.js @@ -1,7 +1,7 @@ /** * Wordpress dependencies */ -import { __, sprintf } from 'i18n'; +import { __, sprintf } from '@wordpress/i18n'; /** * Return a label for the block movement controls depending on block position. diff --git a/editor/block-settings-menu/index.js b/editor/block-settings-menu/index.js index 5ca862946be9e..df772b9ac3163 100644 --- a/editor/block-settings-menu/index.js +++ b/editor/block-settings-menu/index.js @@ -6,14 +6,14 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { IconButton } from 'components'; +import { __ } from '@wordpress/i18n'; +import { IconButton } from '@wordpress/components'; /** * Internal dependencies */ import './style.scss'; -import { isEditorSidebarOpened } from 'editor/selectors'; +import { isEditorSidebarOpened } from '../selectors'; function BlockSettingsMenu( { onDelete, selectBlock, isSidebarOpened, toggleSidebar, setActivePanel } ) { const toggleInspector = () => { diff --git a/editor/block-switcher/index.js b/editor/block-switcher/index.js index a0dd66b4cadc6..1dc86eccf5a67 100644 --- a/editor/block-switcher/index.js +++ b/editor/block-switcher/index.js @@ -8,10 +8,10 @@ import clickOutside from 'react-click-outside'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { Dashicon, IconButton } from 'components'; -import { getBlockType, getBlockTypes, switchToBlockType } from 'blocks'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { Dashicon, IconButton } from '@wordpress/components'; +import { getBlockType, getBlockTypes, switchToBlockType } from '@wordpress/blocks'; /** * Internal dependencies diff --git a/editor/effects.js b/editor/effects.js index 5b665b13a19f5..327ccd2b3db56 100644 --- a/editor/effects.js +++ b/editor/effects.js @@ -7,8 +7,8 @@ import { get, uniqueId, debounce } from 'lodash'; /** * WordPress dependencies */ -import { serialize, getBlockType, switchToBlockType } from 'blocks'; -import { __ } from 'i18n'; +import { serialize, getBlockType, switchToBlockType } from '@wordpress/blocks'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies diff --git a/editor/header/index.js b/editor/header/index.js index 09996bbf8dea9..c0a5c747608eb 100644 --- a/editor/header/index.js +++ b/editor/header/index.js @@ -6,8 +6,8 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { sprintf, _n, __ } from 'i18n'; -import { IconButton } from 'components'; +import { sprintf, _n, __ } from '@wordpress/i18n'; +import { IconButton } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/header/mode-switcher/index.js b/editor/header/mode-switcher/index.js index db850a2ffccdd..4434ab932045e 100644 --- a/editor/header/mode-switcher/index.js +++ b/editor/header/mode-switcher/index.js @@ -6,8 +6,8 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __, _x } from 'i18n'; -import { Dashicon } from 'components'; +import { __, _x } from '@wordpress/i18n'; +import { Dashicon } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/header/saved-state/index.js b/editor/header/saved-state/index.js index 0b5d4d5ceadd4..5d08352e3a7e7 100644 --- a/editor/header/saved-state/index.js +++ b/editor/header/saved-state/index.js @@ -7,8 +7,8 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Dashicon, Button } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Dashicon, Button } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/header/tools/index.js b/editor/header/tools/index.js index 2fc32fd7b1716..d6737da665cd5 100644 --- a/editor/header/tools/index.js +++ b/editor/header/tools/index.js @@ -6,8 +6,8 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { IconButton } from 'components'; +import { __ } from '@wordpress/i18n'; +import { IconButton } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/header/tools/preview-button.js b/editor/header/tools/preview-button.js index ae451401f9873..8bc5ca724f9e9 100644 --- a/editor/header/tools/preview-button.js +++ b/editor/header/tools/preview-button.js @@ -6,12 +6,12 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { IconButton } from 'components'; +import { IconButton } from '@wordpress/components'; +import { _x } from '@wordpress/i18n'; /** * Internal dependencies */ -import { _x } from 'i18n'; import { getEditedPostPreviewLink } from '../../selectors'; function PreviewButton( { link, postId } ) { diff --git a/editor/header/tools/publish-button.js b/editor/header/tools/publish-button.js index 78a8fbcaf7fdc..1e61732606990 100644 --- a/editor/header/tools/publish-button.js +++ b/editor/header/tools/publish-button.js @@ -7,8 +7,8 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Button } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Button } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/index.js b/editor/index.js index 73af84f311569..9a17f6ab72b8f 100644 --- a/editor/index.js +++ b/editor/index.js @@ -10,9 +10,9 @@ import 'moment-timezone/moment-timezone-utils'; /** * WordPress dependencies */ -import { EditableProvider, parse } from 'blocks'; -import { render } from 'element'; -import { settings } from 'date'; +import { EditableProvider, parse } from '@wordpress/blocks'; +import { render } from '@wordpress/element'; +import { settings } from '@wordpress/date'; /** * Internal dependencies diff --git a/editor/inserter/index.js b/editor/inserter/index.js index fa503ca23fbfd..1f210bdfc8964 100644 --- a/editor/inserter/index.js +++ b/editor/inserter/index.js @@ -7,10 +7,10 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { IconButton } from 'components'; -import { createBlock } from 'blocks'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { IconButton } from '@wordpress/components'; +import { createBlock } from '@wordpress/blocks'; /** * Internal dependencies diff --git a/editor/inserter/menu.js b/editor/inserter/menu.js index b72085b92fd22..7404f5f54708c 100644 --- a/editor/inserter/menu.js +++ b/editor/inserter/menu.js @@ -7,11 +7,11 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __, _n, sprintf } from 'i18n'; -import { Component } from 'element'; -import { Popover, withFocusReturn, withInstanceId } from 'components'; -import { TAB, ESCAPE, LEFT, UP, RIGHT, DOWN } from 'utils/keycodes'; -import { getCategories, getBlockTypes, BlockIcon } from 'blocks'; +import { __, _n, sprintf } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { Popover, withFocusReturn, withInstanceId } from '@wordpress/components'; +import { keycodes } from '@wordpress/utils'; +import { getCategories, getBlockTypes, BlockIcon } from '@wordpress/blocks'; /** * Internal dependencies @@ -20,6 +20,8 @@ import './style.scss'; import { getBlocks, getRecentlyUsedBlocks } from '../selectors'; import { showInsertionPoint, hideInsertionPoint } from '../actions'; +const { TAB, ESCAPE, LEFT, UP, RIGHT, DOWN } = keycodes; + export const searchBlocks = ( blocks, searchTerm ) => { const normalizedSearchTerm = searchTerm.toLowerCase().trim(); const matchSearch = ( string ) => string.toLowerCase().indexOf( normalizedSearchTerm ) !== -1; diff --git a/editor/inserter/test/menu.js b/editor/inserter/test/menu.js index ff476d0e848cc..da072298a6dc5 100644 --- a/editor/inserter/test/menu.js +++ b/editor/inserter/test/menu.js @@ -7,7 +7,7 @@ import { noop } from 'lodash'; /** * WordPress dependencies */ -import { registerBlockType, unregisterBlockType, getBlockTypes } from 'blocks'; +import { registerBlockType, unregisterBlockType, getBlockTypes } from '@wordpress/blocks'; /** * Internal dependencies diff --git a/editor/layout/index.js b/editor/layout/index.js index 9055f185875d0..c0685be6cd0fb 100644 --- a/editor/layout/index.js +++ b/editor/layout/index.js @@ -7,7 +7,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { NoticeList } from 'components'; +import { NoticeList } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/modes/text-editor/index.js b/editor/modes/text-editor/index.js index e95a90f38dd17..cd93162555c07 100644 --- a/editor/modes/text-editor/index.js +++ b/editor/modes/text-editor/index.js @@ -7,8 +7,8 @@ import Textarea from 'react-autosize-textarea'; /** * WordPress dependencies */ -import { Component } from 'element'; -import { serialize, parse } from 'blocks'; +import { Component } from '@wordpress/element'; +import { serialize, parse } from '@wordpress/blocks'; /** * Internal dependencies diff --git a/editor/modes/visual-editor/block-list.js b/editor/modes/visual-editor/block-list.js index 8ebfa07aa5c9c..ec1fca2cee303 100644 --- a/editor/modes/visual-editor/block-list.js +++ b/editor/modes/visual-editor/block-list.js @@ -8,11 +8,11 @@ import { throttle, reduce, noop } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { serialize, getDefaultBlock, createBlock } from 'blocks'; -import { IconButton } from 'components'; -import { ENTER } from 'utils/keycodes'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { serialize, getDefaultBlock, createBlock } from '@wordpress/blocks'; +import { IconButton } from '@wordpress/components'; +import { keycodes } from '@wordpress/utils'; /** * Internal dependencies @@ -31,6 +31,7 @@ import { import { insertBlock, multiSelect } from '../../actions'; const INSERTION_POINT_PLACEHOLDER = '[[insertion-point]]'; +const { ENTER } = keycodes; class VisualEditorBlockList extends Component { constructor( props ) { diff --git a/editor/modes/visual-editor/block.js b/editor/modes/visual-editor/block.js index 6ad258fc469c2..818687ee9a74f 100644 --- a/editor/modes/visual-editor/block.js +++ b/editor/modes/visual-editor/block.js @@ -10,11 +10,11 @@ import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup'; /** * WordPress dependencies */ -import { Children, Component } from 'element'; -import { IconButton, Toolbar } from 'components'; -import { BACKSPACE, ESCAPE, DELETE, UP, DOWN, LEFT, RIGHT } from 'utils/keycodes'; -import { getBlockType, getBlockDefaultClassname } from 'blocks'; -import { __, sprintf } from 'i18n'; +import { Children, Component } from '@wordpress/element'; +import { IconButton, Toolbar } from '@wordpress/components'; +import { keycodes } from '@wordpress/utils'; +import { getBlockType, getBlockDefaultClassname } from '@wordpress/blocks'; +import { __, sprintf } from '@wordpress/i18n'; /** * Internal dependencies @@ -48,6 +48,8 @@ import { getMultiSelectedBlockUids, } from '../../selectors'; +const { BACKSPACE, ESCAPE, DELETE, UP, DOWN, LEFT, RIGHT } = keycodes; + function FirstChild( { children } ) { const childrenArray = Children.toArray( children ); return childrenArray[ 0 ] || null; diff --git a/editor/modes/visual-editor/index.js b/editor/modes/visual-editor/index.js index 79e3da93dc9f5..bd149a77bba4a 100644 --- a/editor/modes/visual-editor/index.js +++ b/editor/modes/visual-editor/index.js @@ -7,9 +7,9 @@ import { first, last } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component, findDOMNode } from 'element'; -import { KeyboardShortcuts } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Component, findDOMNode } from '@wordpress/element'; +import { KeyboardShortcuts } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/modes/visual-editor/invalid-block-warning.js b/editor/modes/visual-editor/invalid-block-warning.js index ad28723c8be2e..05ae9910ac5f6 100644 --- a/editor/modes/visual-editor/invalid-block-warning.js +++ b/editor/modes/visual-editor/invalid-block-warning.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { Dashicon } from 'components'; -import { __ } from 'i18n'; +import { Dashicon } from '@wordpress/components'; +import { __ } from '@wordpress/i18n'; const warning = (
diff --git a/editor/post-permalink/index.js b/editor/post-permalink/index.js index b8b318f9a40ff..2f7fc86277e43 100644 --- a/editor/post-permalink/index.js +++ b/editor/post-permalink/index.js @@ -6,9 +6,9 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { Component } from 'element'; -import { __ } from 'i18n'; -import { Dashicon, ClipboardButton, Button } from 'components'; +import { Component } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; +import { Dashicon, ClipboardButton, Button } from '@wordpress/components'; /** * Internal Dependencies diff --git a/editor/post-title/index.js b/editor/post-title/index.js index fa22b7434e9b5..5fbffe8ef1833 100644 --- a/editor/post-title/index.js +++ b/editor/post-title/index.js @@ -9,9 +9,9 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { ENTER } from 'utils/keycodes'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { keycodes } from '@wordpress/utils'; /** * Internal dependencies @@ -25,6 +25,7 @@ import PostPermalink from '../post-permalink'; * Constants */ const REGEXP_NEWLINES = /[\r\n]+/g; +const { ENTER } = keycodes; class PostTitle extends Component { constructor() { diff --git a/editor/selectors.js b/editor/selectors.js index d2a9651a00b1f..053ed074f8068 100644 --- a/editor/selectors.js +++ b/editor/selectors.js @@ -8,18 +8,14 @@ import createSelector from 'rememo'; /** * WordPress dependencies */ -import { getBlockType } from 'blocks'; +import { getBlockType } from '@wordpress/blocks'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ import { addQueryArgs } from './utils/url'; -/** - * WordPress dependencies - */ -import { __ } from 'i18n'; - /** * Returns the current editing mode. * diff --git a/editor/settings/provider.js b/editor/settings/provider.js index ed81e951c5799..742e6c18dffc5 100644 --- a/editor/settings/provider.js +++ b/editor/settings/provider.js @@ -6,7 +6,7 @@ import { noop } from 'lodash'; /** * WordPress dependencies */ -import { Component } from 'element'; +import { Component } from '@wordpress/element'; /** * The Editor Settings Provider allows any compoent to access the editor settings diff --git a/editor/sidebar/block-inspector/class-name.js b/editor/sidebar/block-inspector/class-name.js index f3ac1ee92f657..3e7b871c5c63c 100644 --- a/editor/sidebar/block-inspector/class-name.js +++ b/editor/sidebar/block-inspector/class-name.js @@ -6,9 +6,9 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { Component } from 'element'; -import { getBlockType, InspectorControls } from 'blocks'; -import { __ } from 'i18n'; +import { Component } from '@wordpress/element'; +import { getBlockType, InspectorControls } from '@wordpress/blocks'; +import { __ } from '@wordpress/i18n'; /** * Internal Dependencies diff --git a/editor/sidebar/block-inspector/index.js b/editor/sidebar/block-inspector/index.js index 577cf47b474b9..57a2d873477e2 100644 --- a/editor/sidebar/block-inspector/index.js +++ b/editor/sidebar/block-inspector/index.js @@ -7,8 +7,8 @@ import { Slot } from 'react-slot-fill'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Panel, PanelBody } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Panel, PanelBody } from '@wordpress/components'; /** * Internal Dependencies diff --git a/editor/sidebar/discussion-panel/index.js b/editor/sidebar/discussion-panel/index.js index 97bb1972296ad..1579912599eda 100644 --- a/editor/sidebar/discussion-panel/index.js +++ b/editor/sidebar/discussion-panel/index.js @@ -6,8 +6,8 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { PanelBody, PanelRow, FormToggle, withInstanceId } from 'components'; +import { __ } from '@wordpress/i18n'; +import { PanelBody, PanelRow, FormToggle, withInstanceId } from '@wordpress/components'; /** * Internal Dependencies diff --git a/editor/sidebar/featured-image/index.js b/editor/sidebar/featured-image/index.js index b862a0543dfc5..04155fdef8e09 100644 --- a/editor/sidebar/featured-image/index.js +++ b/editor/sidebar/featured-image/index.js @@ -6,10 +6,10 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { Component } from 'element'; -import { __ } from 'i18n'; -import { Button, PanelBody, Spinner, ResponsiveWrapper } from 'components'; -import { MediaUploadButton } from 'blocks'; +import { Component } from '@wordpress/element'; +import { __ } from '@wordpress/i18n'; +import { Button, PanelBody, Spinner, ResponsiveWrapper } from '@wordpress/components'; +import { MediaUploadButton } from '@wordpress/blocks'; /** * Internal dependencies diff --git a/editor/sidebar/header.js b/editor/sidebar/header.js index e00bbe044834d..73e7e2ece90d6 100644 --- a/editor/sidebar/header.js +++ b/editor/sidebar/header.js @@ -6,13 +6,13 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { IconButton } from 'components'; +import { __ } from '@wordpress/i18n'; +import { IconButton } from '@wordpress/components'; /** * Internal Dependencies */ -import { getActivePanel } from 'editor/selectors'; +import { getActivePanel } from '../selectors'; const SidebarHeader = ( { panel, onSetPanel, toggleSidebar } ) => { return ( diff --git a/editor/sidebar/index.js b/editor/sidebar/index.js index 92aab33068ba6..93fc50df2b037 100644 --- a/editor/sidebar/index.js +++ b/editor/sidebar/index.js @@ -6,7 +6,7 @@ import { connect } from 'react-redux'; /** * WordPress Dependencies */ -import { withFocusReturn } from 'components'; +import { withFocusReturn } from '@wordpress/components'; /** * Internal Dependencies diff --git a/editor/sidebar/last-revision/index.js b/editor/sidebar/last-revision/index.js index eb0d5ee92d851..bfaf0c89b4727 100644 --- a/editor/sidebar/last-revision/index.js +++ b/editor/sidebar/last-revision/index.js @@ -6,10 +6,9 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { Component } from 'element'; -import { sprintf, _n } from 'i18n'; -import IconButton from 'components/icon-button'; -import PanelBody from 'components/panel/body'; +import { Component } from '@wordpress/element'; +import { sprintf, _n } from '@wordpress/i18n'; +import { IconButton, PanelBody } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/sidebar/page-attributes/index.js b/editor/sidebar/page-attributes/index.js index 74b922f5cf41c..b6ebf41d43dc0 100644 --- a/editor/sidebar/page-attributes/index.js +++ b/editor/sidebar/page-attributes/index.js @@ -6,9 +6,9 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { PanelBody, PanelRow, withInstanceId } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { PanelBody, PanelRow, withInstanceId } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/sidebar/post-author/index.js b/editor/sidebar/post-author/index.js index 827aafcd2fc61..c62ba0a70f90e 100644 --- a/editor/sidebar/post-author/index.js +++ b/editor/sidebar/post-author/index.js @@ -6,9 +6,9 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { PanelRow, withInstanceId } from 'components'; -import { Component } from 'element'; +import { __ } from '@wordpress/i18n'; +import { PanelRow, withInstanceId } from '@wordpress/components'; +import { Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/editor/sidebar/post-excerpt/index.js b/editor/sidebar/post-excerpt/index.js index 780bfab0a7ee0..5fdbe569474d2 100644 --- a/editor/sidebar/post-excerpt/index.js +++ b/editor/sidebar/post-excerpt/index.js @@ -6,8 +6,8 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { ExternalLink, PanelBody } from 'components'; +import { __ } from '@wordpress/i18n'; +import { ExternalLink, PanelBody } from '@wordpress/components'; /** * Internal Dependencies diff --git a/editor/sidebar/post-schedule/clock.js b/editor/sidebar/post-schedule/clock.js index 2254bb26575b8..c3ee2c34d5e6a 100644 --- a/editor/sidebar/post-schedule/clock.js +++ b/editor/sidebar/post-schedule/clock.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Button } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Button } from '@wordpress/components'; function PostScheduleClock( { is12Hour, selected, onChange } ) { const minutes = selected.format( 'mm' ); diff --git a/editor/sidebar/post-schedule/index.js b/editor/sidebar/post-schedule/index.js index de6758d1a8924..fe36a2c95bcbf 100644 --- a/editor/sidebar/post-schedule/index.js +++ b/editor/sidebar/post-schedule/index.js @@ -9,10 +9,10 @@ import moment from 'moment'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { dateI18n, settings } from 'date'; -import { PanelRow } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { dateI18n, settings } from '@wordpress/date'; +import { PanelRow } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/sidebar/post-settings/index.js b/editor/sidebar/post-settings/index.js index 7a78cc1f8dc13..8db77ba4efb53 100644 --- a/editor/sidebar/post-settings/index.js +++ b/editor/sidebar/post-settings/index.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { Panel } from 'components'; +import { Panel } from '@wordpress/components'; /** * Internal Dependencies diff --git a/editor/sidebar/post-status/index.js b/editor/sidebar/post-status/index.js index a201b83c3812b..93d1683379ade 100644 --- a/editor/sidebar/post-status/index.js +++ b/editor/sidebar/post-status/index.js @@ -6,9 +6,9 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { PanelBody, PanelRow, FormToggle, withInstanceId } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { PanelBody, PanelRow, FormToggle, withInstanceId } from '@wordpress/components'; /** * Internal Dependencies diff --git a/editor/sidebar/post-sticky/index.js b/editor/sidebar/post-sticky/index.js index 965e70828af60..ba2fb916b9dfa 100644 --- a/editor/sidebar/post-sticky/index.js +++ b/editor/sidebar/post-sticky/index.js @@ -6,8 +6,8 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { PanelRow, FormToggle, withInstanceId } from 'components'; +import { __ } from '@wordpress/i18n'; +import { PanelRow, FormToggle, withInstanceId } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/sidebar/post-taxonomies/categories-selector.js b/editor/sidebar/post-taxonomies/categories-selector.js index d9f8aeb2f7042..9ef35c914312d 100644 --- a/editor/sidebar/post-taxonomies/categories-selector.js +++ b/editor/sidebar/post-taxonomies/categories-selector.js @@ -7,8 +7,8 @@ import { unescape as unescapeString, without, groupBy } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/editor/sidebar/post-taxonomies/index.js b/editor/sidebar/post-taxonomies/index.js index 24004f225187f..87d3afc69a419 100644 --- a/editor/sidebar/post-taxonomies/index.js +++ b/editor/sidebar/post-taxonomies/index.js @@ -1,8 +1,8 @@ /** * WordPress dependencies */ -import { __ } from 'i18n'; -import PanelBody from 'components/panel/body'; +import { __ } from '@wordpress/i18n'; +import { PanelBody } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/sidebar/post-taxonomies/tags-selector.js b/editor/sidebar/post-taxonomies/tags-selector.js index 00690a58152f6..78c3bb446d9a4 100644 --- a/editor/sidebar/post-taxonomies/tags-selector.js +++ b/editor/sidebar/post-taxonomies/tags-selector.js @@ -7,9 +7,9 @@ import { unescape, find, throttle } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { FormTokenField } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { FormTokenField } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/sidebar/post-trash/index.js b/editor/sidebar/post-trash/index.js index 6e64b153c564a..f26acbfa46b2e 100644 --- a/editor/sidebar/post-trash/index.js +++ b/editor/sidebar/post-trash/index.js @@ -6,8 +6,8 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { PanelRow, Button, Dashicon } from 'components'; +import { __ } from '@wordpress/i18n'; +import { PanelRow, Button, Dashicon } from '@wordpress/components'; /** * Internal dependencies diff --git a/editor/sidebar/post-visibility/index.js b/editor/sidebar/post-visibility/index.js index d391c45923ae6..fbc576c464993 100644 --- a/editor/sidebar/post-visibility/index.js +++ b/editor/sidebar/post-visibility/index.js @@ -8,9 +8,9 @@ import { find } from 'lodash'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; -import { PanelRow, Popover, withInstanceId } from 'components'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; +import { PanelRow, Popover, withInstanceId } from '@wordpress/components'; /** * Internal Dependencies diff --git a/editor/sidebar/table-of-contents/index.js b/editor/sidebar/table-of-contents/index.js index c56bff3fc30f8..6f99da2babaae 100644 --- a/editor/sidebar/table-of-contents/index.js +++ b/editor/sidebar/table-of-contents/index.js @@ -8,8 +8,8 @@ import classnames from 'classnames'; /** * WordPress Dependencies */ -import { __, sprintf } from 'i18n'; -import { PanelBody } from 'components'; +import { __, sprintf } from '@wordpress/i18n'; +import { PanelBody } from '@wordpress/components'; /** * Internal Dependencies diff --git a/editor/state.js b/editor/state.js index 8af05ed38f810..bfee2a272e306 100644 --- a/editor/state.js +++ b/editor/state.js @@ -9,7 +9,7 @@ import { reduce, keyBy, first, last, omit, without, flowRight, forOwn } from 'lo /** * WordPress dependencies */ -import { getBlockTypes } from 'blocks'; +import { getBlockTypes } from '@wordpress/blocks'; /** * Internal dependencies diff --git a/editor/test/effects.js b/editor/test/effects.js index ec2cef6215aee..27ae798376302 100644 --- a/editor/test/effects.js +++ b/editor/test/effects.js @@ -6,7 +6,7 @@ import { noop } from 'lodash'; /** * WordPress dependencies */ -import { getBlockTypes, unregisterBlockType, registerBlockType, createBlock } from 'blocks'; +import { getBlockTypes, unregisterBlockType, registerBlockType, createBlock } from '@wordpress/blocks'; /** * Internal dependencies diff --git a/editor/test/selectors.js b/editor/test/selectors.js index f266367b35e09..cb6df32fa3cf0 100644 --- a/editor/test/selectors.js +++ b/editor/test/selectors.js @@ -3,6 +3,11 @@ */ import moment from 'moment'; +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; + /** * Internal dependencies */ @@ -55,11 +60,6 @@ import { getNotices, } from '../selectors'; -/** - * WordPress dependencies - */ -import { __ } from 'i18n'; - describe( 'selectors', () => { describe( 'getEditorMode', () => { it( 'should return the selected editor mode', () => { diff --git a/editor/test/state.js b/editor/test/state.js index b1a8ee3b48acc..eacbbb150fee2 100644 --- a/editor/test/state.js +++ b/editor/test/state.js @@ -7,7 +7,7 @@ import deepFreeze from 'deep-freeze'; /** * WordPress dependencies */ -import { registerBlockType, unregisterBlockType } from 'blocks'; +import { registerBlockType, unregisterBlockType } from '@wordpress/blocks'; /** * Internal dependencies diff --git a/editor/unsaved-changes-warning/index.js b/editor/unsaved-changes-warning/index.js index c9d83a78d8c0b..2a1d3411787c3 100644 --- a/editor/unsaved-changes-warning/index.js +++ b/editor/unsaved-changes-warning/index.js @@ -6,8 +6,8 @@ import { connect } from 'react-redux'; /** * WordPress dependencies */ -import { __ } from 'i18n'; -import { Component } from 'element'; +import { __ } from '@wordpress/i18n'; +import { Component } from '@wordpress/element'; /** * Internal dependencies diff --git a/lib/client-assets.php b/lib/client-assets.php index baa0778179303..cac3d0749cb23 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -129,13 +129,13 @@ function gutenberg_register_scripts_and_styles() { wp_register_script( 'wp-components', gutenberg_url( 'components/build/index.js' ), - array( 'wp-element', 'wp-a11y' ), + array( 'wp-element', 'wp-a11y', 'wp-i18n', 'wp-utils' ), filemtime( gutenberg_dir_path() . 'components/build/index.js' ) ); wp_register_script( 'wp-blocks', gutenberg_url( 'blocks/build/index.js' ), - array( 'wp-element', 'wp-components', 'wp-utils', 'tinymce-nightly', 'tinymce-nightly-lists', 'tinymce-nightly-paste', 'tinymce-nightly-table', 'media-views', 'media-models' ), + array( 'wp-element', 'wp-components', 'wp-utils', 'wp-i18n', 'tinymce-nightly', 'tinymce-nightly-lists', 'tinymce-nightly-paste', 'tinymce-nightly-table', 'media-views', 'media-models' ), filemtime( gutenberg_dir_path() . 'blocks/build/index.js' ) ); wp_add_inline_script( diff --git a/package.json b/package.json index 709bf7f378849..62515ecffe63e 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,8 @@ ], "coverageDirectory": "coverage", "moduleNameMapper": { - "\\.scss$": "/test/style-mock.js" + "\\.scss$": "/test/style-mock.js", + "@wordpress\\/(blocks|components|date|editor|element|i18n|utils)": "$1" }, "modulePaths": [ "" diff --git a/utils/index.js b/utils/index.js index 6400ec8e4489f..e24a5b1782f91 100644 --- a/utils/index.js +++ b/utils/index.js @@ -1,3 +1,5 @@ import * as keycodes from './keycodes'; +import * as nodetypes from './nodetypes'; export { keycodes }; +export { nodetypes }; diff --git a/webpack.config.js b/webpack.config.js index c1940ee209dab..d8ccb63b9a458 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -55,7 +55,7 @@ const externals = { }; entryPointNames.forEach( entryPointName => { - externals[ entryPointName ] = { + externals[ '@wordpress/' + entryPointName ] = { 'this': [ 'wp', entryPointName ], }; } );