Skip to content

Commit

Permalink
Rebuild dist
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Apr 18, 2015
1 parent 43c4aa3 commit ef35926
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 136 deletions.
175 changes: 82 additions & 93 deletions dist-modules/configureDragDrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var _inherits = function (subClass, superClass) { if (typeof superClass !== 'fun
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.__esModule = true;
exports['default'] = configureDragDrop;

var _React$Component$PropTypes = require('react');

Expand Down Expand Up @@ -48,126 +49,114 @@ var _invariant2 = _interopRequireWildcard(_invariant);

var DEFAULT_KEY = '__default__';

function configureDragDrop(InnerComponent, configure, collect) {
var _ref = arguments[3] === undefined ? {} : arguments[3];
function configureDragDrop(configure, collect) {
var _ref = arguments[2] === undefined ? {} : arguments[2];

var _ref$arePropsEqual = _ref.arePropsEqual;
var arePropsEqual = _ref$arePropsEqual === undefined ? _shallowEqualScalar2['default'] : _ref$arePropsEqual;
var _ref$managerKey = _ref.managerKey;
var managerKey = _ref$managerKey === undefined ? 'dragDropManager' : _ref$managerKey;

return (function (_Component) {
function DragDropContainer(props, context) {
_classCallCheck(this, DragDropContainer);
return function (DecoratedComponent) {
return (function (_Component) {
function DragDropHandler(props, context) {
_classCallCheck(this, DragDropHandler);

_Component.call(this, props);
this.handleChange = this.handleChange.bind(this);
this.getComponentRef = this.getComponentRef.bind(this);
this.setComponentRef = this.setComponentRef.bind(this);
this.componentRef = null;
_Component.call(this, props);
this.handleChange = this.handleChange.bind(this);
this.getComponentRef = this.getComponentRef.bind(this);
this.setComponentRef = this.setComponentRef.bind(this);
this.componentRef = null;

this.manager = context[managerKey];
_invariant2['default'](this.manager, 'Could not read manager from context.');
this.manager = context[managerKey];
_invariant2['default'](this.manager, 'Could not read manager from context.');

var handlers = this.getNextHandlers(props);
this.handlerMap = new _ComponentHandlerMap2['default'](this.manager, handlers, this.handleChange);
this.state = this.getCurrentState();
}
var handlers = this.getNextHandlers(props);
this.handlerMap = new _ComponentHandlerMap2['default'](this.manager, handlers, this.handleChange);
this.state = this.getCurrentState();
}

_inherits(DragDropContainer, _Component);
_inherits(DragDropHandler, _Component);

DragDropContainer.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
return !arePropsEqual(nextProps, this.props) || !_shallowEqual2['default'](nextState, this.state);
};
DragDropHandler.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
return !arePropsEqual(nextProps, this.props) || !_shallowEqual2['default'](nextState, this.state);
};

DragDropContainer.prototype.setComponentRef = function setComponentRef(ref) {
this.componentRef = ref;
};
DragDropHandler.prototype.setComponentRef = function setComponentRef(ref) {
this.componentRef = ref;
};

DragDropContainer.prototype.getComponentRef = function getComponentRef() {
return this.componentRef;
};
DragDropHandler.prototype.getComponentRef = function getComponentRef() {
return this.componentRef;
};

DragDropContainer.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (!arePropsEqual(nextProps, this.props)) {
var nextHandlers = this.getNextHandlers(nextProps);
this.handlerMap.receiveHandlers(nextHandlers);
this.handleChange();
}
};
DragDropHandler.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (!arePropsEqual(nextProps, this.props)) {
var nextHandlers = this.getNextHandlers(nextProps);
this.handlerMap.receiveHandlers(nextHandlers);
this.handleChange();
}
};

DragDropContainer.prototype.componentWillUnmount = function componentWillUnmount() {
var disposable = this.handlerMap.getDisposable();
disposable.dispose();
};
DragDropHandler.prototype.componentWillUnmount = function componentWillUnmount() {
var disposable = this.handlerMap.getDisposable();
disposable.dispose();
};

DragDropContainer.prototype.handleChange = function handleChange() {
var nextState = this.getCurrentState();
if (!_shallowEqual2['default'](nextState, this.state)) {
this.setState(nextState);
}
};
DragDropHandler.prototype.handleChange = function handleChange() {
var nextState = this.getCurrentState();
if (!_shallowEqual2['default'](nextState, this.state)) {
this.setState(nextState);
}
};

DragDropContainer.prototype.getNextHandlers = function getNextHandlers(props) {
var _this = this;
DragDropHandler.prototype.getNextHandlers = function getNextHandlers(props) {
var _this = this;

props = _assign2['default']({}, props);
props = _assign2['default']({}, props);

var register = {
dragSource: function dragSource(type, spec) {
return new _ComponentDragSource2['default'](type, spec, props, _this.getComponentRef);
},
dropTarget: function dropTarget(type, spec) {
return new _ComponentDropTarget2['default'](type, spec, props, _this.getComponentRef);
}
};
var register = {
dragSource: function dragSource(type, spec) {
return new _ComponentDragSource2['default'](type, spec, props, _this.getComponentRef);
},
dropTarget: function dropTarget(type, spec) {
return new _ComponentDropTarget2['default'](type, spec, props, _this.getComponentRef);
}
};

var handlers = configure(register, props);
if (handlers instanceof _ComponentDragSource2['default'] || handlers instanceof _ComponentDropTarget2['default']) {
handlers = _defineProperty({}, DEFAULT_KEY, handlers);
}
var handlers = configure(register, props);
if (handlers instanceof _ComponentDragSource2['default'] || handlers instanceof _ComponentDropTarget2['default']) {
handlers = _defineProperty({}, DEFAULT_KEY, handlers);
}

return handlers;
};
return handlers;
};

DragDropContainer.prototype.getCurrentState = function getCurrentState() {
var handlerMonitors = this.handlerMap.getHandlerMonitors();
DragDropHandler.prototype.getCurrentState = function getCurrentState() {
var handlerMonitors = this.handlerMap.getHandlerMonitors();

if (typeof handlerMonitors[DEFAULT_KEY] !== 'undefined') {
handlerMonitors = handlerMonitors[DEFAULT_KEY];
}
if (typeof handlerMonitors[DEFAULT_KEY] !== 'undefined') {
handlerMonitors = handlerMonitors[DEFAULT_KEY];
}

var monitor = this.manager.getMonitor();
return collect(handlerMonitors, monitor);
};
var monitor = this.manager.getMonitor();
return collect(handlerMonitors, monitor);
};

DragDropContainer.prototype.render = function render() {
return _React$Component$PropTypes2['default'].createElement(InnerComponent, _extends({}, this.props, this.state, {
ref: this.setComponentRef }));
};
DragDropHandler.prototype.render = function render() {
return _React$Component$PropTypes2['default'].createElement(DecoratedComponent, _extends({}, this.props, this.state, {
ref: this.setComponentRef }));
};

_createClass(DragDropContainer, null, [{
key: 'contextTypes',
enumerable: true,
value: _defineProperty({}, managerKey, _React$Component$PropTypes.PropTypes.object.isRequired)
}]);
_createClass(DragDropHandler, null, [{
key: 'contextTypes',
enumerable: true,
value: _defineProperty({}, managerKey, _React$Component$PropTypes.PropTypes.object.isRequired)
}]);

return DragDropContainer;
})(_React$Component$PropTypes.Component);
return DragDropHandler;
})(_React$Component$PropTypes.Component);
};
}

exports['default'] = function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

if (typeof args[2] === 'function') {
return configureDragDrop.apply(undefined, args);
} else {
return function (DecoratedComponent) {
return configureDragDrop.apply(undefined, [DecoratedComponent].concat(args));
};
}
};

module.exports = exports['default'];
61 changes: 24 additions & 37 deletions dist-modules/configureDragDropContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ var _createClass = (function () { function defineProperties(target, props) { for
var _inherits = function (subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; };

exports.__esModule = true;
exports['default'] = configureDragDropContext;

var _React$Component$PropTypes = require('react');

var _React$Component$PropTypes2 = _interopRequireWildcard(_React$Component$PropTypes);

var _DragDropManager = require('dnd-core');

function configureDragDropContext(InnerComponent, backendFactories) {
function configureDragDropContext(backendFactories) {
var childContextTypes = {};
var childContext = {};

Expand All @@ -31,49 +32,35 @@ function configureDragDropContext(InnerComponent, backendFactories) {
childContext[key] = new _DragDropManager.DragDropManager(backendFactories[key]);
});

var DragDropContext = (function (_Component) {
function DragDropContext() {
_classCallCheck(this, DragDropContext);
return function (DecoratedComponent) {
return (function (_Component) {
function DragDropContext() {
_classCallCheck(this, DragDropContext);

if (_Component != null) {
_Component.apply(this, arguments);
if (_Component != null) {
_Component.apply(this, arguments);
}
}
}

_inherits(DragDropContext, _Component);
_inherits(DragDropContext, _Component);

DragDropContext.prototype.getChildContext = function getChildContext() {
return childContext;
};

DragDropContext.prototype.render = function render() {
return _React$Component$PropTypes2['default'].createElement(InnerComponent, this.props);
};
DragDropContext.prototype.getChildContext = function getChildContext() {
return childContext;
};

_createClass(DragDropContext, null, [{
key: 'childContextTypes',
enumerable: true,
value: childContextTypes
}]);
DragDropContext.prototype.render = function render() {
return _React$Component$PropTypes2['default'].createElement(DecoratedComponent, this.props);
};

return DragDropContext;
})(_React$Component$PropTypes.Component);
_createClass(DragDropContext, null, [{
key: 'childContextTypes',
enumerable: true,
value: childContextTypes
}]);

return DragDropContext;
return DragDropContext;
})(_React$Component$PropTypes.Component);
};
}

exports['default'] = function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}

if (args.length === 1) {
return function (DecoratedComponent) {
return configureDragDropContext.apply(undefined, [DecoratedComponent].concat(args));
};
} else {
return configureDragDropContext.apply(undefined, args);
}
};

module.exports = exports['default'];
5 changes: 3 additions & 2 deletions dist/ReactDND.min.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions examples/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/bundle.js.map

Large diffs are not rendered by default.

0 comments on commit ef35926

Please sign in to comment.