Skip to content

Commit

Permalink
Components: Refactor existing Slot-Fill to first-party implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Oct 16, 2017
1 parent 6d02799 commit 1fbb24f
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 43 deletions.
7 changes: 1 addition & 6 deletions blocks/block-controls/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/**
* External dependencies
*/
import { Fill } from 'react-slot-fill';

/**
* WordPress dependencies
*/
import { Toolbar } from '@wordpress/components';
import { Fill, Toolbar } from '@wordpress/components';

export default function BlockControls( { controls, children } ) {
return (
Expand Down
2 changes: 1 addition & 1 deletion blocks/editable/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {
noop,
} from 'lodash';
import { nodeListToReact } from 'dom-react';
import { Fill } from 'react-slot-fill';
import 'element-closest';

/**
* WordPress dependencies
*/
import { createElement, Component, renderToString } from '@wordpress/element';
import { keycodes } from '@wordpress/utils';
import { Fill } from '@wordpress/components';

/**
* Internal dependencies
Expand Down
4 changes: 2 additions & 2 deletions blocks/inspector-controls/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
* WordPress dependencies
*/
import { Fill } from 'react-slot-fill';
import { Fill } from '@wordpress/components';

/**
* Internal dependencies
Expand Down
3 changes: 1 addition & 2 deletions editor/block-toolbar/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/**
* External dependencies
*/
import { Slot } from 'react-slot-fill';
import CSSTransitionGroup from 'react-transition-group/CSSTransitionGroup';
import classnames from 'classnames';

/**
* WordPress Dependencies
*/
import { IconButton, Toolbar, NavigableMenu } from '@wordpress/components';
import { IconButton, Toolbar, NavigableMenu, Slot } from '@wordpress/components';
import { Component, Children, findDOMNode } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { focus, keycodes } from '@wordpress/utils';
Expand Down
13 changes: 2 additions & 11 deletions editor/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
*/
import { bindActionCreators } from 'redux';
import { Provider as ReduxProvider } from 'react-redux';
import { Provider as SlotFillProvider } from 'react-slot-fill';
import { flow, pick, noop } from 'lodash';

/**
Expand All @@ -14,7 +13,7 @@ import { EditableProvider } from '@wordpress/blocks';
import {
APIProvider,
DropZoneProvider,
SlotFillProvider as WPSlotFillProvider,
SlotFillProvider,
} from '@wordpress/components';

/**
Expand Down Expand Up @@ -80,14 +79,6 @@ class EditorProvider extends Component {
{ store: this.store },
],

// Slot / Fill provider:
//
// - context.slots
// - context.fills
[
SlotFillProvider,
],

// Editable provider:
//
// - context.onUndo
Expand All @@ -104,7 +95,7 @@ class EditorProvider extends Component {
// - context.registerSlot
// - context.unregisterSlot
[
WPSlotFillProvider,
SlotFillProvider,
],

// APIProvider
Expand Down
3 changes: 1 addition & 2 deletions editor/sidebar/block-inspector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
* External dependencies
*/
import { connect } from 'react-redux';
import { Slot } from 'react-slot-fill';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { Panel, PanelBody } from '@wordpress/components';
import { Panel, PanelBody, Slot } from '@wordpress/components';

/**
* Internal Dependencies
Expand Down
13 changes: 0 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"react-dom": "15.6.1",
"react-redux": "5.0.6",
"react-resizable-box": "2.0.6",
"react-slot-fill": "1.0.1",
"react-transition-group": "1.2.0",
"redux": "3.7.2",
"redux-multi": "0.1.12",
Expand Down
5 changes: 0 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ const config = {
__dirname,
'node_modules',
],
alias: {
// There are currently resolution errors on RSF's "mitt" dependency
// when imported as native ES module
'react-slot-fill': 'react-slot-fill/lib/rsf.js',
},
},
module: {
rules: [
Expand Down

0 comments on commit 1fbb24f

Please sign in to comment.