New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-dnd

Package Overview
Dependencies
Maintainers
3
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dnd - npm Package Compare versions

Comparing version 2.6.0 to 3.0.0

lib/createSourceConnector.d.ts

155

lib/createSourceConnector.js

@@ -1,89 +0,68 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const wrapConnectorHooks_1 = __importDefault(require("./wrapConnectorHooks"));
const shallowEqual = require('shallowequal');
function createSourceConnector(backend) {
let currentHandlerId;
let currentDragSourceNode;
let currentDragSourceOptions;
let disconnectCurrentDragSource;
let currentDragPreviewNode;
let currentDragPreviewOptions;
let disconnectCurrentDragPreview;
function reconnectDragSource() {
if (disconnectCurrentDragSource) {
disconnectCurrentDragSource();
disconnectCurrentDragSource = undefined;
}
if (currentHandlerId && currentDragSourceNode) {
disconnectCurrentDragSource = backend.connectDragSource(currentHandlerId, currentDragSourceNode, currentDragSourceOptions);
}
}
function reconnectDragPreview() {
if (disconnectCurrentDragPreview) {
disconnectCurrentDragPreview();
disconnectCurrentDragPreview = undefined;
}
if (currentHandlerId && currentDragPreviewNode) {
disconnectCurrentDragPreview = backend.connectDragPreview(currentHandlerId, currentDragPreviewNode, currentDragPreviewOptions);
}
}
function receiveHandlerId(handlerId) {
if (handlerId === currentHandlerId) {
return;
}
currentHandlerId = handlerId;
reconnectDragSource();
reconnectDragPreview();
}
const hooks = wrapConnectorHooks_1.default({
dragSource: function connectDragSource(node, options) {
if (node === currentDragSourceNode &&
shallowEqual(options, currentDragSourceOptions)) {
return;
}
currentDragSourceNode = node;
currentDragSourceOptions = options;
reconnectDragSource();
},
dragPreview: function connectDragPreview(node, options) {
if (node === currentDragPreviewNode &&
shallowEqual(options, currentDragPreviewOptions)) {
return;
}
currentDragPreviewNode = node;
currentDragPreviewOptions = options;
reconnectDragPreview();
},
});
return {
receiveHandlerId,
hooks,
};
}
exports.default = createSourceConnector;
var _wrapConnectorHooks = require('./wrapConnectorHooks');
var _wrapConnectorHooks2 = _interopRequireDefault(_wrapConnectorHooks);
var _areOptionsEqual = require('./areOptionsEqual');
var _areOptionsEqual2 = _interopRequireDefault(_areOptionsEqual);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createSourceConnector(backend) {
var currentHandlerId = void 0;
var currentDragSourceNode = void 0;
var currentDragSourceOptions = void 0;
var disconnectCurrentDragSource = void 0;
var currentDragPreviewNode = void 0;
var currentDragPreviewOptions = void 0;
var disconnectCurrentDragPreview = void 0;
function reconnectDragSource() {
if (disconnectCurrentDragSource) {
disconnectCurrentDragSource();
disconnectCurrentDragSource = null;
}
if (currentHandlerId && currentDragSourceNode) {
disconnectCurrentDragSource = backend.connectDragSource(currentHandlerId, currentDragSourceNode, currentDragSourceOptions);
}
}
function reconnectDragPreview() {
if (disconnectCurrentDragPreview) {
disconnectCurrentDragPreview();
disconnectCurrentDragPreview = null;
}
if (currentHandlerId && currentDragPreviewNode) {
disconnectCurrentDragPreview = backend.connectDragPreview(currentHandlerId, currentDragPreviewNode, currentDragPreviewOptions);
}
}
function receiveHandlerId(handlerId) {
if (handlerId === currentHandlerId) {
return;
}
currentHandlerId = handlerId;
reconnectDragSource();
reconnectDragPreview();
}
var hooks = (0, _wrapConnectorHooks2.default)({
dragSource: function connectDragSource(node, options) {
if (node === currentDragSourceNode && (0, _areOptionsEqual2.default)(options, currentDragSourceOptions)) {
return;
}
currentDragSourceNode = node;
currentDragSourceOptions = options;
reconnectDragSource();
},
dragPreview: function connectDragPreview(node, options) {
if (node === currentDragPreviewNode && (0, _areOptionsEqual2.default)(options, currentDragPreviewOptions)) {
return;
}
currentDragPreviewNode = node;
currentDragPreviewOptions = options;
reconnectDragPreview();
}
});
return {
receiveHandlerId: receiveHandlerId,
hooks: hooks
};
}
//# sourceMappingURL=createSourceConnector.js.map

@@ -1,98 +0,68 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const invariant_1 = __importDefault(require("invariant"));
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
const ALLOWED_SPEC_METHODS = ['canDrag', 'beginDrag', 'isDragging', 'endDrag'];
const REQUIRED_SPEC_METHODS = ['beginDrag'];
function createSourceFactory(spec) {
Object.keys(spec).forEach(key => {
invariant_1.default(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drag source specification to only have ' +
'some of the following keys: %s. ' +
'Instead received a specification with an unexpected "%s" key. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', ALLOWED_SPEC_METHODS.join(', '), key);
invariant_1.default(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' +
'Instead received a specification with %s: %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', key, key, spec[key]);
});
REQUIRED_SPEC_METHODS.forEach(key => {
invariant_1.default(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' +
'Instead received a specification with %s: %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', key, key, spec[key]);
});
class Source {
constructor(monitor) {
this.monitor = monitor;
}
receiveProps(props) {
this.props = props;
}
receiveComponent(component) {
this.component = component;
}
canDrag() {
if (!spec.canDrag) {
return true;
}
return spec.canDrag(this.props, this.monitor);
}
isDragging(globalMonitor, sourceId) {
if (!spec.isDragging) {
return sourceId === globalMonitor.getSourceId();
}
return spec.isDragging(this.props, this.monitor);
}
beginDrag() {
const item = spec.beginDrag(this.props, this.monitor, this.component);
if (process.env.NODE_ENV !== 'production') {
invariant_1.default(isPlainObject_1.default(item), 'beginDrag() must return a plain object that represents the dragged item. ' +
'Instead received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', item);
}
return item;
}
endDrag() {
if (!spec.endDrag) {
return;
}
spec.endDrag(this.props, this.monitor, this.component);
}
}
return function createSource(monitor) {
return new Source(monitor);
};
}
exports.default = createSourceFactory;
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _isPlainObject = require('lodash/isPlainObject');
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ALLOWED_SPEC_METHODS = ['canDrag', 'beginDrag', 'isDragging', 'endDrag'];
var REQUIRED_SPEC_METHODS = ['beginDrag'];
function createSourceFactory(spec) {
Object.keys(spec).forEach(function (key) {
(0, _invariant2.default)(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drag source specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected "%s" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', ALLOWED_SPEC_METHODS.join(', '), key);
(0, _invariant2.default)(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', key, key, spec[key]);
});
REQUIRED_SPEC_METHODS.forEach(function (key) {
(0, _invariant2.default)(typeof spec[key] === 'function', 'Expected %s in the drag source specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', key, key, spec[key]);
});
var Source = function () {
function Source(monitor) {
_classCallCheck(this, Source);
this.monitor = monitor;
this.props = null;
this.component = null;
}
_createClass(Source, [{
key: 'receiveProps',
value: function receiveProps(props) {
this.props = props;
}
}, {
key: 'receiveComponent',
value: function receiveComponent(component) {
this.component = component;
}
}, {
key: 'canDrag',
value: function canDrag() {
if (!spec.canDrag) {
return true;
}
return spec.canDrag(this.props, this.monitor);
}
}, {
key: 'isDragging',
value: function isDragging(globalMonitor, sourceId) {
if (!spec.isDragging) {
return sourceId === globalMonitor.getSourceId();
}
return spec.isDragging(this.props, this.monitor);
}
}, {
key: 'beginDrag',
value: function beginDrag() {
var item = spec.beginDrag(this.props, this.monitor, this.component);
if (process.env.NODE_ENV !== 'production') {
(0, _invariant2.default)((0, _isPlainObject2.default)(item), 'beginDrag() must return a plain object that represents the dragged item. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', item);
}
return item;
}
}, {
key: 'endDrag',
value: function endDrag() {
if (!spec.endDrag) {
return;
}
spec.endDrag(this.props, this.monitor, this.component);
}
}]);
return Source;
}();
return function createSource(monitor) {
return new Source(monitor);
};
}
//# sourceMappingURL=createSourceFactory.js.map

@@ -1,110 +0,97 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const invariant_1 = __importDefault(require("invariant"));
let isCallingCanDrag = false;
let isCallingIsDragging = false;
class SourceMonitor {
constructor(manager) {
this.internalMonitor = manager.getMonitor();
}
receiveHandlerId(sourceId) {
this.sourceId = sourceId;
}
canDrag() {
invariant_1.default(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source-monitor.html');
try {
isCallingCanDrag = true;
return this.internalMonitor.canDragSource(this.sourceId);
}
finally {
isCallingCanDrag = false;
}
}
isDragging() {
invariant_1.default(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source-monitor.html');
try {
isCallingIsDragging = true;
return this.internalMonitor.isDraggingSource(this.sourceId);
}
finally {
isCallingIsDragging = false;
}
}
subscribeToStateChange(listener, options) {
return this.internalMonitor.subscribeToStateChange(listener, options);
}
isDraggingSource(sourceId) {
return this.internalMonitor.isDraggingSource(sourceId);
}
isOverTarget(targetId, options) {
return this.internalMonitor.isOverTarget(targetId, options);
}
getTargetIds() {
return this.internalMonitor.getTargetIds();
}
isSourcePublic() {
return this.internalMonitor.isSourcePublic();
}
getSourceId() {
return this.internalMonitor.getSourceId();
}
subscribeToOffsetChange(listener) {
return this.internalMonitor.subscribeToOffsetChange(listener);
}
canDragSource(sourceId) {
return this.internalMonitor.canDragSource(sourceId);
}
canDropOnTarget(targetId) {
return this.internalMonitor.canDropOnTarget(targetId);
}
getItemType() {
return this.internalMonitor.getItemType();
}
getItem() {
return this.internalMonitor.getItem();
}
getDropResult() {
return this.internalMonitor.getDropResult();
}
didDrop() {
return this.internalMonitor.didDrop();
}
getInitialClientOffset() {
return this.internalMonitor.getInitialClientOffset();
}
getInitialSourceClientOffset() {
return this.internalMonitor.getInitialSourceClientOffset();
}
getSourceClientOffset() {
return this.internalMonitor.getSourceClientOffset();
}
getClientOffset() {
return this.internalMonitor.getClientOffset();
}
getDifferenceFromInitialOffset() {
return this.internalMonitor.getDifferenceFromInitialOffset();
}
}
function createSourceMonitor(manager) {
return new SourceMonitor(manager);
}
exports.default = createSourceMonitor;
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var isCallingCanDrag = false;
var isCallingIsDragging = false;
var SourceMonitor = function () {
function SourceMonitor(manager) {
_classCallCheck(this, SourceMonitor);
this.internalMonitor = manager.getMonitor();
}
_createClass(SourceMonitor, [{
key: 'receiveHandlerId',
value: function receiveHandlerId(sourceId) {
this.sourceId = sourceId;
}
}, {
key: 'canDrag',
value: function canDrag() {
(0, _invariant2.default)(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source-monitor.html');
try {
isCallingCanDrag = true;
return this.internalMonitor.canDragSource(this.sourceId);
} finally {
isCallingCanDrag = false;
}
}
}, {
key: 'isDragging',
value: function isDragging() {
(0, _invariant2.default)(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source-monitor.html');
try {
isCallingIsDragging = true;
return this.internalMonitor.isDraggingSource(this.sourceId);
} finally {
isCallingIsDragging = false;
}
}
}, {
key: 'getItemType',
value: function getItemType() {
return this.internalMonitor.getItemType();
}
}, {
key: 'getItem',
value: function getItem() {
return this.internalMonitor.getItem();
}
}, {
key: 'getDropResult',
value: function getDropResult() {
return this.internalMonitor.getDropResult();
}
}, {
key: 'didDrop',
value: function didDrop() {
return this.internalMonitor.didDrop();
}
}, {
key: 'getInitialClientOffset',
value: function getInitialClientOffset() {
return this.internalMonitor.getInitialClientOffset();
}
}, {
key: 'getInitialSourceClientOffset',
value: function getInitialSourceClientOffset() {
return this.internalMonitor.getInitialSourceClientOffset();
}
}, {
key: 'getSourceClientOffset',
value: function getSourceClientOffset() {
return this.internalMonitor.getSourceClientOffset();
}
}, {
key: 'getClientOffset',
value: function getClientOffset() {
return this.internalMonitor.getClientOffset();
}
}, {
key: 'getDifferenceFromInitialOffset',
value: function getDifferenceFromInitialOffset() {
return this.internalMonitor.getDifferenceFromInitialOffset();
}
}]);
return SourceMonitor;
}();
function createSourceMonitor(manager) {
return new SourceMonitor(manager);
}
//# sourceMappingURL=createSourceMonitor.js.map

@@ -1,62 +0,46 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const wrapConnectorHooks_1 = __importDefault(require("./wrapConnectorHooks"));
const shallowEqual = require('shallowequal');
function createTargetConnector(backend) {
let currentHandlerId;
let currentDropTargetNode;
let currentDropTargetOptions;
let disconnectCurrentDropTarget;
function reconnectDropTarget() {
if (disconnectCurrentDropTarget) {
disconnectCurrentDropTarget();
disconnectCurrentDropTarget = undefined;
}
if (currentHandlerId && currentDropTargetNode) {
disconnectCurrentDropTarget = backend.connectDropTarget(currentHandlerId, currentDropTargetNode, currentDropTargetOptions);
}
}
function receiveHandlerId(handlerId) {
if (handlerId === currentHandlerId) {
return;
}
currentHandlerId = handlerId;
reconnectDropTarget();
}
const hooks = wrapConnectorHooks_1.default({
dropTarget: function connectDropTarget(node, options) {
if (node === currentDropTargetNode &&
shallowEqual(options, currentDropTargetOptions)) {
return;
}
currentDropTargetNode = node;
currentDropTargetOptions = options;
reconnectDropTarget();
},
});
return {
receiveHandlerId,
hooks,
};
}
exports.default = createTargetConnector;
var _wrapConnectorHooks = require('./wrapConnectorHooks');
var _wrapConnectorHooks2 = _interopRequireDefault(_wrapConnectorHooks);
var _areOptionsEqual = require('./areOptionsEqual');
var _areOptionsEqual2 = _interopRequireDefault(_areOptionsEqual);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function createTargetConnector(backend) {
var currentHandlerId = void 0;
var currentDropTargetNode = void 0;
var currentDropTargetOptions = void 0;
var disconnectCurrentDropTarget = void 0;
function reconnectDropTarget() {
if (disconnectCurrentDropTarget) {
disconnectCurrentDropTarget();
disconnectCurrentDropTarget = null;
}
if (currentHandlerId && currentDropTargetNode) {
disconnectCurrentDropTarget = backend.connectDropTarget(currentHandlerId, currentDropTargetNode, currentDropTargetOptions);
}
}
function receiveHandlerId(handlerId) {
if (handlerId === currentHandlerId) {
return;
}
currentHandlerId = handlerId;
reconnectDropTarget();
}
var hooks = (0, _wrapConnectorHooks2.default)({
dropTarget: function connectDropTarget(node, options) {
if (node === currentDropTargetNode && (0, _areOptionsEqual2.default)(options, currentDropTargetOptions)) {
return;
}
currentDropTargetNode = node;
currentDropTargetOptions = options;
reconnectDropTarget();
}
});
return {
receiveHandlerId: receiveHandlerId,
hooks: hooks
};
}
//# sourceMappingURL=createTargetConnector.js.map

@@ -1,94 +0,64 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const invariant_1 = __importDefault(require("invariant"));
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
const ALLOWED_SPEC_METHODS = ['canDrop', 'hover', 'drop'];
function createTargetFactory(spec) {
Object.keys(spec).forEach(key => {
invariant_1.default(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drop target specification to only have ' +
'some of the following keys: %s. ' +
'Instead received a specification with an unexpected "%s" key. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', ALLOWED_SPEC_METHODS.join(', '), key);
invariant_1.default(typeof spec[key] === 'function', 'Expected %s in the drop target specification to be a function. ' +
'Instead received a specification with %s: %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', key, key, spec[key]);
});
class Target {
constructor(monitor) {
this.monitor = monitor;
this.props = null;
this.component = null;
}
receiveProps(props) {
this.props = props;
}
receiveMonitor(monitor) {
this.monitor = monitor;
}
receiveComponent(component) {
this.component = component;
}
canDrop() {
if (!spec.canDrop) {
return true;
}
return spec.canDrop(this.props, this.monitor);
}
hover() {
if (!spec.hover) {
return;
}
spec.hover(this.props, this.monitor, this.component);
}
drop() {
if (!spec.drop) {
return undefined;
}
const dropResult = spec.drop(this.props, this.monitor, this.component);
if (process.env.NODE_ENV !== 'production') {
invariant_1.default(typeof dropResult === 'undefined' || isPlainObject_1.default(dropResult), 'drop() must either return undefined, or an object that represents the drop result. ' +
'Instead received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', dropResult);
}
return dropResult;
}
}
return function createTarget(monitor) {
return new Target(monitor);
};
}
exports.default = createTargetFactory;
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _isPlainObject = require('lodash/isPlainObject');
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var ALLOWED_SPEC_METHODS = ['canDrop', 'hover', 'drop'];
function createTargetFactory(spec) {
Object.keys(spec).forEach(function (key) {
(0, _invariant2.default)(ALLOWED_SPEC_METHODS.indexOf(key) > -1, 'Expected the drop target specification to only have ' + 'some of the following keys: %s. ' + 'Instead received a specification with an unexpected "%s" key. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', ALLOWED_SPEC_METHODS.join(', '), key);
(0, _invariant2.default)(typeof spec[key] === 'function', 'Expected %s in the drop target specification to be a function. ' + 'Instead received a specification with %s: %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', key, key, spec[key]);
});
var Target = function () {
function Target(monitor) {
_classCallCheck(this, Target);
this.monitor = monitor;
this.props = null;
this.component = null;
}
_createClass(Target, [{
key: 'receiveProps',
value: function receiveProps(props) {
this.props = props;
}
}, {
key: 'receiveMonitor',
value: function receiveMonitor(monitor) {
this.monitor = monitor;
}
}, {
key: 'receiveComponent',
value: function receiveComponent(component) {
this.component = component;
}
}, {
key: 'canDrop',
value: function canDrop() {
if (!spec.canDrop) {
return true;
}
return spec.canDrop(this.props, this.monitor);
}
}, {
key: 'hover',
value: function hover() {
if (!spec.hover) {
return;
}
spec.hover(this.props, this.monitor, this.component);
}
}, {
key: 'drop',
value: function drop() {
if (!spec.drop) {
return undefined;
}
var dropResult = spec.drop(this.props, this.monitor, this.component);
if (process.env.NODE_ENV !== 'production') {
(0, _invariant2.default)(typeof dropResult === 'undefined' || (0, _isPlainObject2.default)(dropResult), 'drop() must either return undefined, or an object that represents the drop result. ' + 'Instead received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', dropResult);
}
return dropResult;
}
}]);
return Target;
}();
return function createTarget(monitor) {
return new Target(monitor);
};
}
//# sourceMappingURL=createTargetFactory.js.map

@@ -1,102 +0,62 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const invariant_1 = __importDefault(require("invariant"));
let isCallingCanDrop = false;
class TargetMonitor {
constructor(manager) {
this.internalMonitor = manager.getMonitor();
}
receiveHandlerId(targetId) {
this.targetId = targetId;
}
canDrop() {
invariant_1.default(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target-monitor.html');
try {
isCallingCanDrop = true;
return this.internalMonitor.canDropOnTarget(this.targetId);
}
finally {
isCallingCanDrop = false;
}
}
isOver(options) {
return this.internalMonitor.isOverTarget(this.targetId, options);
}
getItemType() {
return this.internalMonitor.getItemType();
}
getItem() {
return this.internalMonitor.getItem();
}
getDropResult() {
return this.internalMonitor.getDropResult();
}
didDrop() {
return this.internalMonitor.didDrop();
}
getInitialClientOffset() {
return this.internalMonitor.getInitialClientOffset();
}
getInitialSourceClientOffset() {
return this.internalMonitor.getInitialSourceClientOffset();
}
getSourceClientOffset() {
return this.internalMonitor.getSourceClientOffset();
}
getClientOffset() {
return this.internalMonitor.getClientOffset();
}
getDifferenceFromInitialOffset() {
return this.internalMonitor.getDifferenceFromInitialOffset();
}
}
exports.TargetMonitor = TargetMonitor;
function createTargetMonitor(manager) {
return new TargetMonitor(manager);
}
exports.default = createTargetMonitor;
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var isCallingCanDrop = false;
var TargetMonitor = function () {
function TargetMonitor(manager) {
_classCallCheck(this, TargetMonitor);
this.internalMonitor = manager.getMonitor();
}
_createClass(TargetMonitor, [{
key: 'receiveHandlerId',
value: function receiveHandlerId(targetId) {
this.targetId = targetId;
}
}, {
key: 'canDrop',
value: function canDrop() {
(0, _invariant2.default)(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target-monitor.html');
try {
isCallingCanDrop = true;
return this.internalMonitor.canDropOnTarget(this.targetId);
} finally {
isCallingCanDrop = false;
}
}
}, {
key: 'isOver',
value: function isOver(options) {
return this.internalMonitor.isOverTarget(this.targetId, options);
}
}, {
key: 'getItemType',
value: function getItemType() {
return this.internalMonitor.getItemType();
}
}, {
key: 'getItem',
value: function getItem() {
return this.internalMonitor.getItem();
}
}, {
key: 'getDropResult',
value: function getDropResult() {
return this.internalMonitor.getDropResult();
}
}, {
key: 'didDrop',
value: function didDrop() {
return this.internalMonitor.didDrop();
}
}, {
key: 'getInitialClientOffset',
value: function getInitialClientOffset() {
return this.internalMonitor.getInitialClientOffset();
}
}, {
key: 'getInitialSourceClientOffset',
value: function getInitialSourceClientOffset() {
return this.internalMonitor.getInitialSourceClientOffset();
}
}, {
key: 'getSourceClientOffset',
value: function getSourceClientOffset() {
return this.internalMonitor.getSourceClientOffset();
}
}, {
key: 'getClientOffset',
value: function getClientOffset() {
return this.internalMonitor.getClientOffset();
}
}, {
key: 'getDifferenceFromInitialOffset',
value: function getDifferenceFromInitialOffset() {
return this.internalMonitor.getDifferenceFromInitialOffset();
}
}]);
return TargetMonitor;
}();
function createTargetMonitor(manager) {
return new TargetMonitor(manager);
}
//# sourceMappingURL=createTargetMonitor.js.map

@@ -1,218 +0,126 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const React = __importStar(require("react"));
const prop_types_1 = __importDefault(require("prop-types"));
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
const invariant_1 = __importDefault(require("invariant"));
const hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
const shallowEqual = require('shallowequal');
const { Disposable, CompositeDisposable, SerialDisposable, } = require('disposables');
const isClassComponent = (Comp) => {
return (!!Comp && !!Comp.prototype && typeof Comp.prototype.render === 'function');
};
function decorateHandler({ DecoratedComponent, createHandler, createMonitor, createConnector, registerHandler, containerDisplayName, getType, collect, options, }) {
const { arePropsEqual = shallowEqual } = options;
const displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
class DragDropContainer extends React.Component {
constructor(props, context) {
super(props, context);
this.isCurrentlyMounted = false;
this.handleChange = this.handleChange.bind(this);
this.handleChildRef = this.handleChildRef.bind(this);
invariant_1.default(typeof this.context.dragDropManager === 'object', 'Could not find the drag and drop manager in the context of %s. ' +
'Make sure to wrap the top-level component of your app with DragDropContext. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
this.manager = this.context.dragDropManager;
this.handlerMonitor = createMonitor(this.manager);
this.handlerConnector = createConnector(this.manager.getBackend());
this.handler = createHandler(this.handlerMonitor);
this.disposable = new SerialDisposable();
this.receiveProps(props);
this.state = this.getCurrentState();
this.dispose();
}
getHandlerId() {
return this.handlerId;
}
getDecoratedComponentInstance() {
return this.decoratedComponentInstance;
}
shouldComponentUpdate(nextProps, nextState) {
return (!arePropsEqual(nextProps, this.props) ||
!shallowEqual(nextState, this.state));
}
componentDidMount() {
this.isCurrentlyMounted = true;
this.disposable = new SerialDisposable();
this.currentType = undefined;
this.receiveProps(this.props);
this.handleChange();
}
componentWillReceiveProps(nextProps) {
if (!arePropsEqual(nextProps, this.props)) {
this.receiveProps(nextProps);
this.handleChange();
}
}
componentWillUnmount() {
this.dispose();
this.isCurrentlyMounted = false;
}
receiveProps(props) {
this.handler.receiveProps(props);
this.receiveType(getType(props));
}
receiveType(type) {
if (type === this.currentType) {
return;
}
this.currentType = type;
const { handlerId, unregister } = registerHandler(type, this.handler, this.manager);
this.handlerId = handlerId;
this.handlerMonitor.receiveHandlerId(handlerId);
this.handlerConnector.receiveHandlerId(handlerId);
const globalMonitor = this.manager.getMonitor();
const unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, { handlerIds: [handlerId] });
this.disposable.setDisposable(new CompositeDisposable(new Disposable(unsubscribe), new Disposable(unregister)));
}
handleChange() {
if (!this.isCurrentlyMounted) {
return;
}
const nextState = this.getCurrentState();
if (!shallowEqual(nextState, this.state)) {
this.setState(nextState);
}
}
dispose() {
this.disposable.dispose();
this.handlerConnector.receiveHandlerId(null);
}
handleChildRef(component) {
this.decoratedComponentInstance = component;
this.handler.receiveComponent(component);
}
getCurrentState() {
const nextState = collect(this.handlerConnector.hooks, this.handlerMonitor);
if (process.env.NODE_ENV !== 'production') {
invariant_1.default(isPlainObject_1.default(nextState), 'Expected `collect` specified as the second argument to ' +
'%s for %s to return a plain object of props to inject. ' +
'Instead, received %s.', containerDisplayName, displayName, nextState);
}
return nextState;
}
render() {
return (React.createElement(DecoratedComponent, Object.assign({}, this.props, this.state, { ref: isClassComponent(DecoratedComponent) ? this.handleChildRef : null })));
}
}
DragDropContainer.DecoratedComponent = DecoratedComponent;
DragDropContainer.displayName = `${containerDisplayName}(${displayName})`;
DragDropContainer.contextTypes = {
dragDropManager: prop_types_1.default.object.isRequired,
};
return hoist_non_react_statics_1.default(DragDropContainer, DecoratedComponent);
}
exports.default = decorateHandler;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _disposables = require('disposables');
var _isPlainObject = require('lodash/isPlainObject');
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _hoistNonReactStatics = require('hoist-non-react-statics');
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
var _shallowEqual = require('./utils/shallowEqual');
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
var _shallowEqualScalar = require('./utils/shallowEqualScalar');
var _shallowEqualScalar2 = _interopRequireDefault(_shallowEqualScalar);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var isClassComponent = function isClassComponent(Comp) {
return Boolean(Comp && Comp.prototype && typeof Comp.prototype.render === 'function');
};
function decorateHandler(_ref) {
var _class, _temp;
var DecoratedComponent = _ref.DecoratedComponent,
createHandler = _ref.createHandler,
createMonitor = _ref.createMonitor,
createConnector = _ref.createConnector,
registerHandler = _ref.registerHandler,
containerDisplayName = _ref.containerDisplayName,
getType = _ref.getType,
collect = _ref.collect,
options = _ref.options;
var _options$arePropsEqua = options.arePropsEqual,
arePropsEqual = _options$arePropsEqua === undefined ? _shallowEqualScalar2.default : _options$arePropsEqua;
var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
var DragDropContainer = (_temp = _class = function (_Component) {
_inherits(DragDropContainer, _Component);
_createClass(DragDropContainer, [{
key: 'getHandlerId',
value: function getHandlerId() {
return this.handlerId;
}
}, {
key: 'getDecoratedComponentInstance',
value: function getDecoratedComponentInstance() {
return this.decoratedComponentInstance;
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
return !arePropsEqual(nextProps, this.props) || !(0, _shallowEqual2.default)(nextState, this.state);
}
}]);
function DragDropContainer(props, context) {
_classCallCheck(this, DragDropContainer);
var _this = _possibleConstructorReturn(this, (DragDropContainer.__proto__ || Object.getPrototypeOf(DragDropContainer)).call(this, props, context));
_this.handleChange = _this.handleChange.bind(_this);
_this.handleChildRef = _this.handleChildRef.bind(_this);
(0, _invariant2.default)(_typeof(_this.context.dragDropManager) === 'object', 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to wrap the top-level component of your app with DragDropContext. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
_this.manager = _this.context.dragDropManager;
_this.handlerMonitor = createMonitor(_this.manager);
_this.handlerConnector = createConnector(_this.manager.getBackend());
_this.handler = createHandler(_this.handlerMonitor);
_this.disposable = new _disposables.SerialDisposable();
_this.receiveProps(props);
_this.state = _this.getCurrentState();
_this.dispose();
return _this;
}
_createClass(DragDropContainer, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.isCurrentlyMounted = true;
this.disposable = new _disposables.SerialDisposable();
this.currentType = null;
this.receiveProps(this.props);
this.handleChange();
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (!arePropsEqual(nextProps, this.props)) {
this.receiveProps(nextProps);
this.handleChange();
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.dispose();
this.isCurrentlyMounted = false;
}
}, {
key: 'receiveProps',
value: function receiveProps(props) {
this.handler.receiveProps(props);
this.receiveType(getType(props));
}
}, {
key: 'receiveType',
value: function receiveType(type) {
if (type === this.currentType) {
return;
}
this.currentType = type;
var _registerHandler = registerHandler(type, this.handler, this.manager),
handlerId = _registerHandler.handlerId,
unregister = _registerHandler.unregister;
this.handlerId = handlerId;
this.handlerMonitor.receiveHandlerId(handlerId);
this.handlerConnector.receiveHandlerId(handlerId);
var globalMonitor = this.manager.getMonitor();
var unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, { handlerIds: [handlerId] });
this.disposable.setDisposable(new _disposables.CompositeDisposable(new _disposables.Disposable(unsubscribe), new _disposables.Disposable(unregister)));
}
}, {
key: 'handleChange',
value: function handleChange() {
if (!this.isCurrentlyMounted) {
return;
}
var nextState = this.getCurrentState();
if (!(0, _shallowEqual2.default)(nextState, this.state)) {
this.setState(nextState);
}
}
}, {
key: 'dispose',
value: function dispose() {
this.disposable.dispose();
this.handlerConnector.receiveHandlerId(null);
}
}, {
key: 'handleChildRef',
value: function handleChildRef(component) {
this.decoratedComponentInstance = component;
this.handler.receiveComponent(component);
}
}, {
key: 'getCurrentState',
value: function getCurrentState() {
var nextState = collect(this.handlerConnector.hooks, this.handlerMonitor);
if (process.env.NODE_ENV !== 'production') {
(0, _invariant2.default)((0, _isPlainObject2.default)(nextState), 'Expected `collect` specified as the second argument to ' + '%s for %s to return a plain object of props to inject. ' + 'Instead, received %s.', containerDisplayName, displayName, nextState);
}
return nextState;
}
}, {
key: 'render',
value: function render() {
return _react2.default.createElement(DecoratedComponent, _extends({}, this.props, this.state, {
ref: isClassComponent(DecoratedComponent) ? this.handleChildRef : null
}));
}
}]);
return DragDropContainer;
}(_react.Component), _class.DecoratedComponent = DecoratedComponent, _class.displayName = containerDisplayName + '(' + displayName + ')', _class.contextTypes = {
dragDropManager: _propTypes2.default.object.isRequired
}, _temp);
return (0, _hoistNonReactStatics2.default)(DragDropContainer, DecoratedComponent);
}
//# sourceMappingURL=decorateHandler.js.map

@@ -1,121 +0,48 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.unpackBackendForEs5Users = exports.createChildContext = exports.CHILD_CONTEXT_TYPES = undefined;
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; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.default = DragDropContext;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _dndCore = require('dnd-core');
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _hoistNonReactStatics = require('hoist-non-react-statics');
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
var _checkDecoratorArguments = require('./utils/checkDecoratorArguments');
var _checkDecoratorArguments2 = _interopRequireDefault(_checkDecoratorArguments);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var CHILD_CONTEXT_TYPES = exports.CHILD_CONTEXT_TYPES = {
dragDropManager: _propTypes2.default.object.isRequired
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var createChildContext = exports.createChildContext = function createChildContext(backend, context) {
return {
dragDropManager: new _dndCore.DragDropManager(backend, context)
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const prop_types_1 = __importDefault(require("prop-types"));
const dnd_core_1 = require("dnd-core");
const invariant_1 = __importDefault(require("invariant"));
const hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
const checkDecoratorArguments_1 = __importDefault(require("./utils/checkDecoratorArguments"));
exports.CHILD_CONTEXT_TYPES = {
dragDropManager: prop_types_1.default.object.isRequired,
};
var unpackBackendForEs5Users = exports.unpackBackendForEs5Users = function unpackBackendForEs5Users(backendOrModule) {
// Auto-detect ES6 default export for people still using ES5
var backend = backendOrModule;
if ((typeof backend === 'undefined' ? 'undefined' : _typeof(backend)) === 'object' && typeof backend.default === 'function') {
backend = backend.default;
}
(0, _invariant2.default)(typeof backend === 'function', 'Expected the backend to be a function or an ES6 module exporting a default function. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-drop-context.html');
return backend;
};
function DragDropContext(backendOrModule) {
_checkDecoratorArguments2.default.apply(undefined, ['DragDropContext', 'backend'].concat(Array.prototype.slice.call(arguments))); // eslint-disable-line prefer-rest-params
var backend = unpackBackendForEs5Users(backendOrModule);
var childContext = createChildContext(backend);
return function decorateContext(DecoratedComponent) {
var _class, _temp;
var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
var DragDropContextContainer = (_temp = _class = function (_Component) {
_inherits(DragDropContextContainer, _Component);
function DragDropContextContainer() {
_classCallCheck(this, DragDropContextContainer);
return _possibleConstructorReturn(this, (DragDropContextContainer.__proto__ || Object.getPrototypeOf(DragDropContextContainer)).apply(this, arguments));
}
_createClass(DragDropContextContainer, [{
key: 'getDecoratedComponentInstance',
value: function getDecoratedComponentInstance() {
(0, _invariant2.default)(this.child, 'In order to access an instance of the decorated component it can not be a stateless component.');
return this.child;
}
}, {
key: 'getManager',
value: function getManager() {
return childContext.dragDropManager;
}
}, {
key: 'getChildContext',
value: function getChildContext() {
return childContext;
}
}, {
key: 'render',
value: function render() {
var _this2 = this;
return _react2.default.createElement(DecoratedComponent, _extends({}, this.props, {
ref: function ref(child) {
_this2.child = child;
}
}));
}
}]);
return DragDropContextContainer;
}(_react.Component), _class.DecoratedComponent = DecoratedComponent, _class.displayName = 'DragDropContext(' + displayName + ')', _class.childContextTypes = CHILD_CONTEXT_TYPES, _temp);
return (0, _hoistNonReactStatics2.default)(DragDropContextContainer, DecoratedComponent);
};
}
function createChildContext(backend, context) {
return {
dragDropManager: new dnd_core_1.DragDropManager(backend, context),
};
}
exports.createChildContext = createChildContext;
function DragDropContext(backendFactory, context) {
checkDecoratorArguments_1.default('DragDropContext', 'backend', backendFactory); // eslint-disable-line prefer-rest-params
const childContext = createChildContext(backendFactory, context);
return function decorateContext(DecoratedComponent) {
const displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
class DragDropContextContainer extends react_1.default.Component {
getDecoratedComponentInstance() {
invariant_1.default(this.child, 'In order to access an instance of the decorated component it can not be a stateless component.');
return this.child;
}
getManager() {
return childContext.dragDropManager;
}
getChildContext() {
return childContext;
}
render() {
return (react_1.default.createElement(DecoratedComponent, Object.assign({}, this.props, { ref: (child) => (this.child = child) })));
}
}
DragDropContextContainer.DecoratedComponent = DecoratedComponent;
DragDropContextContainer.displayName = `DragDropContext(${displayName})`;
DragDropContextContainer.childContextTypes = exports.CHILD_CONTEXT_TYPES;
return hoist_non_react_statics_1.default(DragDropContextContainer, DecoratedComponent);
};
}
exports.default = DragDropContext;
//# sourceMappingURL=DragDropContext.js.map

@@ -1,92 +0,39 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _class, _temp;
var _react = require('react');
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _DragDropContext = require('./DragDropContext');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* This class is a React-Component based version of the DragDropContext.
* This is an alternative to decorating an application component with an ES7 decorator.
*/
var DragDropContextProvider = (_temp = _class = function (_Component) {
_inherits(DragDropContextProvider, _Component);
function DragDropContextProvider(props, context) {
_classCallCheck(this, DragDropContextProvider);
/**
* This property determines which window global to use for creating the DragDropManager.
* If a window has been injected explicitly via props, that is used first. If it is available
* as a context value, then use that, otherwise use the browser global.
*/
var _this = _possibleConstructorReturn(this, (DragDropContextProvider.__proto__ || Object.getPrototypeOf(DragDropContextProvider)).call(this, props, context));
var getWindow = function getWindow() {
if (props && props.window) {
return props.window;
} else if (context && context.window) {
return context.window;
} else if (typeof window !== 'undefined') {
return window;
}
return undefined;
};
_this.backend = (0, _DragDropContext.unpackBackendForEs5Users)(props.backend);
_this.childContext = (0, _DragDropContext.createChildContext)(_this.backend, {
window: getWindow()
});
return _this;
}
_createClass(DragDropContextProvider, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (nextProps.backend !== this.props.backend || nextProps.window !== this.props.window) {
throw new Error('DragDropContextProvider backend and window props must not change.');
}
}
}, {
key: 'getChildContext',
value: function getChildContext() {
return this.childContext;
}
}, {
key: 'render',
value: function render() {
return _react.Children.only(this.props.children);
}
}]);
return DragDropContextProvider;
}(_react.Component), _class.propTypes = {
backend: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.object]).isRequired,
children: _propTypes2.default.element.isRequired,
window: _propTypes2.default.object // eslint-disable-line react/forbid-prop-types
}, _class.defaultProps = {
window: undefined
}, _class.childContextTypes = _DragDropContext.CHILD_CONTEXT_TYPES, _class.displayName = 'DragDropContextProvider', _class.contextTypes = {
window: _propTypes2.default.object
}, _temp);
exports.default = DragDropContextProvider;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
const prop_types_1 = __importDefault(require("prop-types"));
const DragDropContext_1 = require("./DragDropContext");
class DragDropContextProvider extends react_1.Component {
constructor(props, context) {
super(props, context);
this.backend = props.backend;
this.childContext = DragDropContext_1.createChildContext(this.backend, this.props.context);
}
componentWillReceiveProps(nextProps) {
if (nextProps.backend !== this.props.backend ||
nextProps.context !== this.props.context) {
throw new Error('DragDropContextProvider backend and context props must not change.');
}
}
getChildContext() {
return this.childContext;
}
render() {
return react_1.Children.only(this.props.children);
}
}
DragDropContextProvider.propTypes = {
backend: prop_types_1.default.oneOfType([prop_types_1.default.func, prop_types_1.default.object]).isRequired,
children: prop_types_1.default.element.isRequired,
context: prop_types_1.default.object,
};
DragDropContextProvider.defaultProps = {
context: undefined,
};
DragDropContextProvider.childContextTypes = DragDropContext_1.CHILD_CONTEXT_TYPES;
DragDropContextProvider.displayName = 'DragDropContextProvider';
exports.default = DragDropContextProvider;
//# sourceMappingURL=DragDropContextProvider.js.map

@@ -1,158 +0,88 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
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; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const prop_types_1 = __importDefault(require("prop-types"));
const hoist_non_react_statics_1 = __importDefault(require("hoist-non-react-statics"));
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
const invariant_1 = __importDefault(require("invariant"));
const checkDecoratorArguments_1 = __importDefault(require("./utils/checkDecoratorArguments"));
const shallowEqual = require('shallowequal');
function DragLayer(collect, options = {}) {
checkDecoratorArguments_1.default('DragLayer', 'collect[, options]', collect, options); // eslint-disable-line prefer-rest-params
invariant_1.default(typeof collect === 'function', 'Expected "collect" provided as the first argument to DragLayer to be a function that collects props to inject into the component. ', 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs-drag-layer.html', collect);
invariant_1.default(isPlainObject_1.default(options), 'Expected "options" provided as the second argument to DragLayer to be a plain object when specified. ' +
'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs-drag-layer.html', options);
return function decorateLayer(DecoratedComponent) {
const { arePropsEqual = shallowEqual } = options;
const displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
class DragLayerContainer extends react_1.default.Component {
constructor(props, context) {
super(props);
this.isCurrentlyMounted = false;
this.handleChange = this.handleChange.bind(this);
this.manager = context.dragDropManager;
invariant_1.default(typeof this.manager === 'object', 'Could not find the drag and drop manager in the context of %s. ' +
'Make sure to wrap the top-level component of your app with DragDropContext. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
this.state = this.getCurrentState();
}
get DecoratedComponent() {
return DecoratedComponent;
}
getDecoratedComponentInstance() {
invariant_1.default(this.child, 'In order to access an instance of the decorated component it can not be a stateless component.');
return this.child;
}
shouldComponentUpdate(nextProps, nextState) {
return (!arePropsEqual(nextProps, this.props) ||
!shallowEqual(nextState, this.state));
}
componentDidMount() {
this.isCurrentlyMounted = true;
const monitor = this.manager.getMonitor();
this.unsubscribeFromOffsetChange = monitor.subscribeToOffsetChange(this.handleChange);
this.unsubscribeFromStateChange = monitor.subscribeToStateChange(this.handleChange);
this.handleChange();
}
componentWillUnmount() {
this.isCurrentlyMounted = false;
if (this.unsubscribeFromOffsetChange) {
this.unsubscribeFromOffsetChange();
this.unsubscribeFromOffsetChange = undefined;
}
if (this.unsubscribeFromStateChange) {
this.unsubscribeFromStateChange();
this.unsubscribeFromStateChange = undefined;
}
}
render() {
return (react_1.default.createElement(DecoratedComponent, Object.assign({}, this.props, this.state, { ref: (child) => {
this.child = child;
} })));
}
handleChange() {
if (!this.isCurrentlyMounted) {
return;
}
const nextState = this.getCurrentState();
if (!shallowEqual(nextState, this.state)) {
this.setState(nextState);
}
}
getCurrentState() {
const monitor = this.manager.getMonitor();
return collect(monitor, this.props);
}
}
DragLayerContainer.displayName = `DragLayer(${displayName})`;
DragLayerContainer.contextTypes = {
dragDropManager: prop_types_1.default.object.isRequired,
};
return hoist_non_react_statics_1.default(DragLayerContainer, DecoratedComponent);
};
}
exports.default = DragLayer;
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _hoistNonReactStatics = require('hoist-non-react-statics');
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
var _isPlainObject = require('lodash/isPlainObject');
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _shallowEqual = require('./utils/shallowEqual');
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
var _shallowEqualScalar = require('./utils/shallowEqualScalar');
var _shallowEqualScalar2 = _interopRequireDefault(_shallowEqualScalar);
var _checkDecoratorArguments = require('./utils/checkDecoratorArguments');
var _checkDecoratorArguments2 = _interopRequireDefault(_checkDecoratorArguments);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(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) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function DragLayer(collect) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_checkDecoratorArguments2.default.apply(undefined, ['DragLayer', 'collect[, options]'].concat(Array.prototype.slice.call(arguments))); // eslint-disable-line prefer-rest-params
(0, _invariant2.default)(typeof collect === 'function', 'Expected "collect" provided as the first argument to DragLayer to be a function that collects props to inject into the component. ', 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs-drag-layer.html', collect);
(0, _invariant2.default)((0, _isPlainObject2.default)(options), 'Expected "options" provided as the second argument to DragLayer to be a plain object when specified. ' + 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs-drag-layer.html', options);
return function decorateLayer(DecoratedComponent) {
var _class, _temp;
var _options$arePropsEqua = options.arePropsEqual,
arePropsEqual = _options$arePropsEqua === undefined ? _shallowEqualScalar2.default : _options$arePropsEqua;
var displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
var DragLayerContainer = (_temp = _class = function (_Component) {
_inherits(DragLayerContainer, _Component);
_createClass(DragLayerContainer, [{
key: 'getDecoratedComponentInstance',
value: function getDecoratedComponentInstance() {
(0, _invariant2.default)(this.child, 'In order to access an instance of the decorated component it can not be a stateless component.');
return this.child;
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
return !arePropsEqual(nextProps, this.props) || !(0, _shallowEqual2.default)(nextState, this.state);
}
}]);
function DragLayerContainer(props, context) {
_classCallCheck(this, DragLayerContainer);
var _this = _possibleConstructorReturn(this, (DragLayerContainer.__proto__ || Object.getPrototypeOf(DragLayerContainer)).call(this, props));
_this.handleChange = _this.handleChange.bind(_this);
_this.manager = context.dragDropManager;
(0, _invariant2.default)(_typeof(_this.manager) === 'object', 'Could not find the drag and drop manager in the context of %s. ' + 'Make sure to wrap the top-level component of your app with DragDropContext. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
_this.state = _this.getCurrentState();
return _this;
}
_createClass(DragLayerContainer, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.isCurrentlyMounted = true;
var monitor = this.manager.getMonitor();
this.unsubscribeFromOffsetChange = monitor.subscribeToOffsetChange(this.handleChange);
this.unsubscribeFromStateChange = monitor.subscribeToStateChange(this.handleChange);
this.handleChange();
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.isCurrentlyMounted = false;
this.unsubscribeFromOffsetChange();
this.unsubscribeFromStateChange();
}
}, {
key: 'handleChange',
value: function handleChange() {
if (!this.isCurrentlyMounted) {
return;
}
var nextState = this.getCurrentState();
if (!(0, _shallowEqual2.default)(nextState, this.state)) {
this.setState(nextState);
}
}
}, {
key: 'getCurrentState',
value: function getCurrentState() {
var monitor = this.manager.getMonitor();
return collect(monitor, this.props);
}
}, {
key: 'render',
value: function render() {
var _this2 = this;
return _react2.default.createElement(DecoratedComponent, _extends({}, this.props, this.state, {
ref: function ref(child) {
_this2.child = child;
}
}));
}
}]);
return DragLayerContainer;
}(_react.Component), _class.DecoratedComponent = DecoratedComponent, _class.displayName = 'DragLayer(' + displayName + ')', _class.contextTypes = {
dragDropManager: _propTypes2.default.object.isRequired
}, _temp);
return (0, _hoistNonReactStatics2.default)(DragLayerContainer, DecoratedComponent);
};
}
//# sourceMappingURL=DragLayer.js.map

@@ -1,78 +0,55 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const invariant_1 = __importDefault(require("invariant"));
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
const checkDecoratorArguments_1 = __importDefault(require("./utils/checkDecoratorArguments"));
const decorateHandler_1 = __importDefault(require("./decorateHandler"));
const registerSource_1 = __importDefault(require("./registerSource"));
const createSourceFactory_1 = __importDefault(require("./createSourceFactory"));
const createSourceMonitor_1 = __importDefault(require("./createSourceMonitor"));
const createSourceConnector_1 = __importDefault(require("./createSourceConnector"));
const isValidType_1 = __importDefault(require("./utils/isValidType"));
function DragSource(type, spec, collect, options = {}) {
checkDecoratorArguments_1.default('DragSource', 'type, spec, collect[, options]', type, spec, collect, options);
let getType = type;
if (typeof type !== 'function') {
invariant_1.default(isValidType_1.default(type), 'Expected "type" provided as the first argument to DragSource to be ' +
'a string, or a function that returns a string given the current props. ' +
'Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', type);
getType = () => type;
}
invariant_1.default(isPlainObject_1.default(spec), 'Expected "spec" provided as the second argument to DragSource to be ' +
'a plain object. Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', spec);
const createSource = createSourceFactory_1.default(spec);
invariant_1.default(typeof collect === 'function', 'Expected "collect" provided as the third argument to DragSource to be ' +
'a function that returns a plain object of props to inject. ' +
'Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', collect);
invariant_1.default(isPlainObject_1.default(options), 'Expected "options" provided as the fourth argument to DragSource to be ' +
'a plain object when specified. ' +
'Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', collect);
return function decorateSource(DecoratedComponent) {
return decorateHandler_1.default({
connectBackend: (backend, sourceId) => {
backend.connectDragSource(sourceId);
},
containerDisplayName: 'DragSource',
createHandler: createSource,
registerHandler: registerSource_1.default,
createMonitor: createSourceMonitor_1.default,
createConnector: createSourceConnector_1.default,
DecoratedComponent,
getType,
collect,
options,
});
};
}
exports.default = DragSource;
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _isPlainObject = require('lodash/isPlainObject');
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _checkDecoratorArguments = require('./utils/checkDecoratorArguments');
var _checkDecoratorArguments2 = _interopRequireDefault(_checkDecoratorArguments);
var _decorateHandler = require('./decorateHandler');
var _decorateHandler2 = _interopRequireDefault(_decorateHandler);
var _registerSource = require('./registerSource');
var _registerSource2 = _interopRequireDefault(_registerSource);
var _createSourceFactory = require('./createSourceFactory');
var _createSourceFactory2 = _interopRequireDefault(_createSourceFactory);
var _createSourceMonitor = require('./createSourceMonitor');
var _createSourceMonitor2 = _interopRequireDefault(_createSourceMonitor);
var _createSourceConnector = require('./createSourceConnector');
var _createSourceConnector2 = _interopRequireDefault(_createSourceConnector);
var _isValidType = require('./utils/isValidType');
var _isValidType2 = _interopRequireDefault(_isValidType);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function DragSource(type, spec, collect) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
_checkDecoratorArguments2.default.apply(undefined, ['DragSource', 'type, spec, collect[, options]'].concat(Array.prototype.slice.call(arguments)));
var getType = type;
if (typeof type !== 'function') {
(0, _invariant2.default)((0, _isValidType2.default)(type), 'Expected "type" provided as the first argument to DragSource to be ' + 'a string, or a function that returns a string given the current props. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', type);
getType = function getType() {
return type;
};
}
(0, _invariant2.default)((0, _isPlainObject2.default)(spec), 'Expected "spec" provided as the second argument to DragSource to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', spec);
var createSource = (0, _createSourceFactory2.default)(spec);
(0, _invariant2.default)(typeof collect === 'function', 'Expected "collect" provided as the third argument to DragSource to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', collect);
(0, _invariant2.default)((0, _isPlainObject2.default)(options), 'Expected "options" provided as the fourth argument to DragSource to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source.html', collect);
return function decorateSource(DecoratedComponent) {
return (0, _decorateHandler2.default)({
connectBackend: function connectBackend(backend, sourceId) {
return backend.connectDragSource(sourceId);
},
containerDisplayName: 'DragSource',
createHandler: createSource,
registerHandler: _registerSource2.default,
createMonitor: _createSourceMonitor2.default,
createConnector: _createSourceConnector2.default,
DecoratedComponent: DecoratedComponent,
getType: getType,
collect: collect,
options: options
});
};
}
//# sourceMappingURL=DragSource.js.map

@@ -1,78 +0,55 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const invariant_1 = __importDefault(require("invariant"));
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
const checkDecoratorArguments_1 = __importDefault(require("./utils/checkDecoratorArguments"));
const decorateHandler_1 = __importDefault(require("./decorateHandler"));
const registerTarget_1 = __importDefault(require("./registerTarget"));
const createTargetFactory_1 = __importDefault(require("./createTargetFactory"));
const createTargetMonitor_1 = __importDefault(require("./createTargetMonitor"));
const createTargetConnector_1 = __importDefault(require("./createTargetConnector"));
const isValidType_1 = __importDefault(require("./utils/isValidType"));
function DropTarget(type, spec, collect, options = {}) {
checkDecoratorArguments_1.default('DropTarget', 'type, spec, collect[, options]', type, spec, collect, options);
let getType = type;
if (typeof type !== 'function') {
invariant_1.default(isValidType_1.default(type, true), 'Expected "type" provided as the first argument to DropTarget to be ' +
'a string, an array of strings, or a function that returns either given ' +
'the current props. Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', type);
getType = () => type;
}
invariant_1.default(isPlainObject_1.default(spec), 'Expected "spec" provided as the second argument to DropTarget to be ' +
'a plain object. Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', spec);
const createTarget = createTargetFactory_1.default(spec);
invariant_1.default(typeof collect === 'function', 'Expected "collect" provided as the third argument to DropTarget to be ' +
'a function that returns a plain object of props to inject. ' +
'Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', collect);
invariant_1.default(isPlainObject_1.default(options), 'Expected "options" provided as the fourth argument to DropTarget to be ' +
'a plain object when specified. ' +
'Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', collect);
return function decorateTarget(DecoratedComponent) {
return decorateHandler_1.default({
connectBackend: (backend, targetId) => {
backend.connectDropTarget(targetId);
},
containerDisplayName: 'DropTarget',
createHandler: createTarget,
registerHandler: registerTarget_1.default,
createMonitor: createTargetMonitor_1.default,
createConnector: createTargetConnector_1.default,
DecoratedComponent,
getType,
collect,
options,
});
};
}
exports.default = DropTarget;
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _isPlainObject = require('lodash/isPlainObject');
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
var _checkDecoratorArguments = require('./utils/checkDecoratorArguments');
var _checkDecoratorArguments2 = _interopRequireDefault(_checkDecoratorArguments);
var _decorateHandler = require('./decorateHandler');
var _decorateHandler2 = _interopRequireDefault(_decorateHandler);
var _registerTarget = require('./registerTarget');
var _registerTarget2 = _interopRequireDefault(_registerTarget);
var _createTargetFactory = require('./createTargetFactory');
var _createTargetFactory2 = _interopRequireDefault(_createTargetFactory);
var _createTargetMonitor = require('./createTargetMonitor');
var _createTargetMonitor2 = _interopRequireDefault(_createTargetMonitor);
var _createTargetConnector = require('./createTargetConnector');
var _createTargetConnector2 = _interopRequireDefault(_createTargetConnector);
var _isValidType = require('./utils/isValidType');
var _isValidType2 = _interopRequireDefault(_isValidType);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function DropTarget(type, spec, collect) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
_checkDecoratorArguments2.default.apply(undefined, ['DropTarget', 'type, spec, collect[, options]'].concat(Array.prototype.slice.call(arguments)));
var getType = type;
if (typeof type !== 'function') {
(0, _invariant2.default)((0, _isValidType2.default)(type, true), 'Expected "type" provided as the first argument to DropTarget to be ' + 'a string, an array of strings, or a function that returns either given ' + 'the current props. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', type);
getType = function getType() {
return type;
};
}
(0, _invariant2.default)((0, _isPlainObject2.default)(spec), 'Expected "spec" provided as the second argument to DropTarget to be ' + 'a plain object. Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', spec);
var createTarget = (0, _createTargetFactory2.default)(spec);
(0, _invariant2.default)(typeof collect === 'function', 'Expected "collect" provided as the third argument to DropTarget to be ' + 'a function that returns a plain object of props to inject. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', collect);
(0, _invariant2.default)((0, _isPlainObject2.default)(options), 'Expected "options" provided as the fourth argument to DropTarget to be ' + 'a plain object when specified. ' + 'Instead, received %s. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target.html', collect);
return function decorateTarget(DecoratedComponent) {
return (0, _decorateHandler2.default)({
connectBackend: function connectBackend(backend, targetId) {
return backend.connectDropTarget(targetId);
},
containerDisplayName: 'DropTarget',
createHandler: createTarget,
registerHandler: _registerTarget2.default,
createMonitor: _createTargetMonitor2.default,
createConnector: _createTargetConnector2.default,
DecoratedComponent: DecoratedComponent,
getType: getType,
collect: collect,
options: options
});
};
}
//# sourceMappingURL=DropTarget.js.map

@@ -1,52 +0,13 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _DragDropContext = require('./DragDropContext');
Object.defineProperty(exports, 'DragDropContext', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DragDropContext).default;
}
});
var _DragDropContextProvider = require('./DragDropContextProvider');
Object.defineProperty(exports, 'DragDropContextProvider', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DragDropContextProvider).default;
}
});
var _DragLayer = require('./DragLayer');
Object.defineProperty(exports, 'DragLayer', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DragLayer).default;
}
});
var _DragSource = require('./DragSource');
Object.defineProperty(exports, 'DragSource', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DragSource).default;
}
});
var _DropTarget = require('./DropTarget');
Object.defineProperty(exports, 'DropTarget', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DropTarget).default;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DragDropContext_1 = require("./DragDropContext");
exports.DragDropContext = DragDropContext_1.default;
var DragDropContextProvider_1 = require("./DragDropContextProvider");
exports.DragDropContextProvider = DragDropContextProvider_1.default;
var DragLayer_1 = require("./DragLayer");
exports.DragLayer = DragLayer_1.default;
var DragSource_1 = require("./DragSource");
exports.DragSource = DragSource_1.default;
var DropTarget_1 = require("./DropTarget");
exports.DropTarget = DropTarget_1.default;
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function registerSource(type, source, manager) {
const registry = manager.getRegistry();
const sourceId = registry.addSource(type, source);
function unregisterSource() {
registry.removeSource(sourceId);
}
return {
handlerId: sourceId,
unregister: unregisterSource,
};
}
exports.default = registerSource;
function registerSource(type, source, manager) {
var registry = manager.getRegistry();
var sourceId = registry.addSource(type, source);
function unregisterSource() {
registry.removeSource(sourceId);
}
return {
handlerId: sourceId,
unregister: unregisterSource
};
}
//# sourceMappingURL=registerSource.js.map
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__esModule", { value: true });
function registerTarget(type, target, manager) {
const registry = manager.getRegistry();
const targetId = registry.addTarget(type, target);
function unregisterTarget() {
registry.removeTarget(targetId);
}
return {
handlerId: targetId,
unregister: unregisterTarget,
};
}
exports.default = registerTarget;
function registerTarget(type, target, manager) {
var registry = manager.getRegistry();
var targetId = registry.addTarget(type, target);
function unregisterTarget() {
registry.removeTarget(targetId);
}
return {
handlerId: targetId,
unregister: unregisterTarget
};
}
//# sourceMappingURL=registerTarget.js.map

@@ -1,18 +0,17 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function checkDecoratorArguments(functionName, signature, ...args) {
if (process.env.NODE_ENV !== 'production') {
for (const arg of args) {
if (arg && arg.prototype && arg.prototype.render) {
// tslint:disable-next-line no-console
console.error('You seem to be applying the arguments in the wrong order. ' +
`It should be ${functionName}(${signature})(Component), not the other way around. ` +
'Read more: http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#you-seem-to-be-applying-the-arguments-in-the-wrong-order');
return;
}
}
}
}
exports.default = checkDecoratorArguments;
function checkDecoratorArguments(functionName, signature) {
if (process.env.NODE_ENV !== 'production') {
for (var i = 0; i < (arguments.length <= 2 ? 0 : arguments.length - 2); i += 1) {
var arg = arguments.length <= i + 2 ? undefined : arguments[i + 2];
if (arg && arg.prototype && arg.prototype.render) {
// eslint-disable-next-line no-console
console.error('You seem to be applying the arguments in the wrong order. ' + ('It should be ' + functionName + '(' + signature + ')(Component), not the other way around. ') + 'Read more: http://react-dnd.github.io/react-dnd/docs-troubleshooting.html#you-seem-to-be-applying-the-arguments-in-the-wrong-order');
return;
}
}
}
}
//# sourceMappingURL=checkDecoratorArguments.js.map

@@ -1,36 +0,29 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const invariant_1 = __importDefault(require("invariant"));
const react_1 = require("react");
function cloneWithRef(element, newRef) {
const previousRef = element.ref;
invariant_1.default(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' +
'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' +
'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute');
if (!previousRef) {
// When there is no ref on the element, use the new ref directly
return react_1.cloneElement(element, {
ref: newRef,
});
}
return react_1.cloneElement(element, {
ref: (node) => {
newRef(node);
if (previousRef) {
previousRef(node);
}
},
});
}
exports.default = cloneWithRef;
var _invariant = require('invariant');
var _invariant2 = _interopRequireDefault(_invariant);
var _react = require('react');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function cloneWithRef(element, newRef) {
var previousRef = element.ref;
(0, _invariant2.default)(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' + 'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' + 'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute');
if (!previousRef) {
// When there is no ref on the element, use the new ref directly
return (0, _react.cloneElement)(element, {
ref: newRef
});
}
return (0, _react.cloneElement)(element, {
ref: function ref(node) {
newRef(node);
if (previousRef) {
previousRef(node);
}
}
});
}
//# sourceMappingURL=cloneWithRef.js.map

@@ -1,21 +0,13 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const isArray_1 = __importDefault(require("lodash/isArray"));
function isValidType(type, allowArray) {
return (typeof type === 'string' ||
typeof type === 'symbol' ||
(!!allowArray && isArray_1.default(type) && type.every(t => isValidType(t, false))));
}
exports.default = isValidType;
var _isArray = require('lodash/isArray');
var _isArray2 = _interopRequireDefault(_isArray);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isValidType(type, allowArray) {
return typeof type === 'string' || (typeof type === 'undefined' ? 'undefined' : _typeof(type)) === 'symbol' || allowArray && (0, _isArray2.default)(type) && type.every(function (t) {
return isValidType(t, false);
});
}
//# sourceMappingURL=isValidType.js.map

@@ -1,67 +0,47 @@

'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = wrapConnectorHooks;
var _react = require('react');
var _cloneWithRef = require('./utils/cloneWithRef');
var _cloneWithRef2 = _interopRequireDefault(_cloneWithRef);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("react");
const cloneWithRef_1 = __importDefault(require("./utils/cloneWithRef"));
function throwIfCompositeComponentElement(element) {
// Custom components can no longer be wrapped directly in React DnD 2.0
// so that we don't need to depend on findDOMNode() from react-dom.
if (typeof element.type === 'string') {
return;
}
var displayName = element.type.displayName || element.type.name || 'the component';
throw new Error('Only native element nodes can now be passed to React DnD connectors.' + ('You can either wrap ' + displayName + ' into a <div>, or turn it into a ') + 'drag source or a drop target itself.');
// Custom components can no longer be wrapped directly in React DnD 2.0
// so that we don't need to depend on findDOMNode() from react-dom.
if (typeof element.type === 'string') {
return;
}
const displayName = element.type.displayName || element.type.name || 'the component';
throw new Error('Only native element nodes can now be passed to React DnD connectors.' +
`You can either wrap ${displayName} into a <div>, or turn it into a ` +
'drag source or a drop target itself.');
}
function wrapHookToRecognizeElement(hook) {
return function () {
var elementOrNode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
// When passed a node, call the hook straight away.
if (!(0, _react.isValidElement)(elementOrNode)) {
var node = elementOrNode;
hook(node, options);
return undefined;
}
// If passed a ReactElement, clone it and attach this function as a ref.
// This helps us achieve a neat API where user doesn't even know that refs
// are being used under the hood.
var element = elementOrNode;
throwIfCompositeComponentElement(element);
// When no options are passed, use the hook directly
var ref = options ? function (node) {
return hook(node, options);
} : hook;
return (0, _cloneWithRef2.default)(element, ref);
};
return (elementOrNode = null, options = null) => {
// When passed a node, call the hook straight away.
if (!react_1.isValidElement(elementOrNode)) {
const node = elementOrNode;
hook(node, options);
return undefined;
}
// If passed a ReactElement, clone it and attach this function as a ref.
// This helps us achieve a neat API where user doesn't even know that refs
// are being used under the hood.
const element = elementOrNode;
throwIfCompositeComponentElement(element);
// When no options are passed, use the hook directly
const ref = options ? (node) => hook(node, options) : hook;
return cloneWithRef_1.default(element, ref);
};
}
function wrapConnectorHooks(hooks) {
var wrappedHooks = {};
Object.keys(hooks).forEach(function (key) {
var hook = hooks[key];
var wrappedHook = wrapHookToRecognizeElement(hook);
wrappedHooks[key] = function () {
return wrappedHook;
};
});
return wrappedHooks;
}
const wrappedHooks = {};
Object.keys(hooks).forEach(key => {
const hook = hooks[key];
const wrappedHook = wrapHookToRecognizeElement(hook);
wrappedHooks[key] = () => wrappedHook;
});
return wrappedHooks;
}
exports.default = wrapConnectorHooks;
//# sourceMappingURL=wrapConnectorHooks.js.map
{
"name": "react-dnd",
"version": "2.6.0",
"version": "3.0.0",
"description": "Drag and Drop for React",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {

@@ -13,18 +14,21 @@ "type": "git",

"clean": "rimraf lib dist",
"bundle:unmin": "webpack --output-filename=dist/ReactDnD.js",
"bundle:min": "webpack --output-filename=dist/ReactDnD.min.js --optimize-minimize",
"babel": "babel src --out-dir lib",
"build": "run-p bundle:* babel",
"test": "run-s clean build",
"prepublish": "npm test"
"bundle:unmin": "webpack --mode development --output-filename=ReactDnD.js",
"bundle:min": "webpack --mode production --output-filename=ReactDnD.min.js",
"transpile": "tsc",
"build": "run-p bundle:* transpile",
"test": "run-s clean build"
},
"dependencies": {
"disposables": "^1.0.1",
"dnd-core": "^2.6.0",
"hoist-non-react-statics": "^2.1.0",
"dnd-core": "^3.0.0",
"hoist-non-react-statics": "^2.5.0",
"invariant": "^2.1.0",
"lodash": "^4.2.0",
"prop-types": "^15.5.10"
"prop-types": "^15.5.10",
"shallowequal": "^1.0.2"
},
"devDependencies": {
"@types/lodash": "^4.14.108",
"@types/prop-types": "^15.5.2",
"@types/react": "^16.3.13",
"babel-cli": "^6.26.0",

@@ -35,3 +39,6 @@ "babel-loader": "^7.1.1",

"rimraf": "^2.6.2",
"webpack": "^3.1.0"
"ts-loader": "^4.2.0",
"typescript": "^2.8.3",
"webpack": "^4.6.0",
"webpack-cli": "^2.1.2"
},

@@ -38,0 +45,0 @@ "peerDependencies": {

@@ -9,6 +9,4 @@ [![npm version](https://img.shields.io/npm/v/react-dnd.svg?style=flat-square)](https://www.npmjs.com/package/react-dnd)

# React _DnD_
React *DnD*
=========
Drag and Drop for React.

@@ -15,0 +13,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc