dnd-core
Advanced tools
Comparing version 9.5.1 to 10.0.0
@@ -8,3 +8,3 @@ "use strict"; | ||
var _invariant = _interopRequireDefault(require("invariant")); | ||
var _invariant = require("@react-dnd/invariant"); | ||
@@ -17,4 +17,2 @@ var _setClientOffset = require("./local/setClientOffset"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var ResetCoordinatesAction = { | ||
@@ -81,5 +79,5 @@ type: _types.INIT_COORDS, | ||
function verifyInvariants(sourceIds, monitor, registry) { | ||
(0, _invariant.default)(!monitor.isDragging(), 'Cannot call beginDrag while dragging.'); | ||
(0, _invariant.invariant)(!monitor.isDragging(), 'Cannot call beginDrag while dragging.'); | ||
sourceIds.forEach(function (sourceId) { | ||
(0, _invariant.default)(registry.getSource(sourceId), 'Expected sourceIds to be registered.'); | ||
(0, _invariant.invariant)(registry.getSource(sourceId), 'Expected sourceIds to be registered.'); | ||
}); | ||
@@ -89,7 +87,7 @@ } | ||
function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) { | ||
(0, _invariant.default)(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.'); | ||
(0, _invariant.invariant)(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.'); | ||
} | ||
function verifyItemIsObject(item) { | ||
(0, _invariant.default)((0, _js_utils.isObject)(item), 'Item must be an object.'); | ||
(0, _invariant.invariant)((0, _js_utils.isObject)(item), 'Item must be an object.'); | ||
} | ||
@@ -96,0 +94,0 @@ |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _invariant = _interopRequireDefault(require("invariant")); | ||
var _invariant = require("@react-dnd/invariant"); | ||
@@ -15,4 +15,2 @@ var _types = require("./types"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -46,4 +44,4 @@ | ||
function verifyInvariants(monitor) { | ||
(0, _invariant.default)(monitor.isDragging(), 'Cannot call drop while not dragging.'); | ||
(0, _invariant.default)(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.'); | ||
(0, _invariant.invariant)(monitor.isDragging(), 'Cannot call drop while not dragging.'); | ||
(0, _invariant.invariant)(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.'); | ||
} | ||
@@ -64,3 +62,3 @@ | ||
function verifyDropResultType(dropResult) { | ||
(0, _invariant.default)(typeof dropResult === 'undefined' || (0, _js_utils.isObject)(dropResult), 'Drop result must either be an object or undefined.'); | ||
(0, _invariant.invariant)(typeof dropResult === 'undefined' || (0, _js_utils.isObject)(dropResult), 'Drop result must either be an object or undefined.'); | ||
} | ||
@@ -67,0 +65,0 @@ |
@@ -8,8 +8,6 @@ "use strict"; | ||
var _invariant = _interopRequireDefault(require("invariant")); | ||
var _invariant = require("@react-dnd/invariant"); | ||
var _types = require("./types"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function createEndDrag(manager) { | ||
@@ -31,3 +29,3 @@ return function endDrag() { | ||
function verifyIsDragging(monitor) { | ||
(0, _invariant.default)(monitor.isDragging(), 'Cannot call endDrag while not dragging.'); | ||
(0, _invariant.invariant)(monitor.isDragging(), 'Cannot call endDrag while not dragging.'); | ||
} |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _invariant = _interopRequireDefault(require("invariant")); | ||
var _invariant = require("@react-dnd/invariant"); | ||
@@ -41,14 +41,14 @@ var _matchesType = _interopRequireDefault(require("../../utils/matchesType")); | ||
function verifyTargetIdsIsArray(targetIdsArg) { | ||
(0, _invariant.default)(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.'); | ||
(0, _invariant.invariant)(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.'); | ||
} | ||
function checkInvariants(targetIds, monitor, registry) { | ||
(0, _invariant.default)(monitor.isDragging(), 'Cannot call hover while not dragging.'); | ||
(0, _invariant.default)(!monitor.didDrop(), 'Cannot call hover after drop.'); | ||
(0, _invariant.invariant)(monitor.isDragging(), 'Cannot call hover while not dragging.'); | ||
(0, _invariant.invariant)(!monitor.didDrop(), 'Cannot call hover after drop.'); | ||
for (var i = 0; i < targetIds.length; i++) { | ||
var targetId = targetIds[i]; | ||
(0, _invariant.default)(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.'); | ||
(0, _invariant.invariant)(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.'); | ||
var target = registry.getTarget(targetId); | ||
(0, _invariant.default)(target, 'Expected targetIds to be registered.'); | ||
(0, _invariant.invariant)(target, 'Expected targetIds to be registered.'); | ||
} | ||
@@ -55,0 +55,0 @@ } |
@@ -10,18 +10,16 @@ "use strict"; | ||
var _invariant = _interopRequireDefault(require("invariant")); | ||
var _invariant = require("@react-dnd/invariant"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function validateSourceContract(source) { | ||
(0, _invariant.default)(typeof source.canDrag === 'function', 'Expected canDrag to be a function.'); | ||
(0, _invariant.default)(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.'); | ||
(0, _invariant.default)(typeof source.endDrag === 'function', 'Expected endDrag to be a function.'); | ||
(0, _invariant.invariant)(typeof source.canDrag === 'function', 'Expected canDrag to be a function.'); | ||
(0, _invariant.invariant)(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.'); | ||
(0, _invariant.invariant)(typeof source.endDrag === 'function', 'Expected endDrag to be a function.'); | ||
} | ||
function validateTargetContract(target) { | ||
(0, _invariant.default)(typeof target.canDrop === 'function', 'Expected canDrop to be a function.'); | ||
(0, _invariant.default)(typeof target.hover === 'function', 'Expected hover to be a function.'); | ||
(0, _invariant.default)(typeof target.drop === 'function', 'Expected beginDrag to be a function.'); | ||
(0, _invariant.invariant)(typeof target.canDrop === 'function', 'Expected canDrop to be a function.'); | ||
(0, _invariant.invariant)(typeof target.hover === 'function', 'Expected hover to be a function.'); | ||
(0, _invariant.invariant)(typeof target.drop === 'function', 'Expected beginDrag to be a function.'); | ||
} | ||
@@ -37,3 +35,3 @@ | ||
(0, _invariant.default)(typeof type === 'string' || _typeof(type) === 'symbol', allowArray ? 'Type can only be a string, a symbol, or an array of either.' : 'Type can only be a string or a symbol.'); | ||
(0, _invariant.invariant)(typeof type === 'string' || _typeof(type) === 'symbol', allowArray ? 'Type can only be a string, a symbol, or an array of either.' : 'Type can only be a string or a symbol.'); | ||
} |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _invariant = _interopRequireDefault(require("invariant")); | ||
var _invariant = require("@react-dnd/invariant"); | ||
@@ -44,4 +44,4 @@ var _matchesType = _interopRequireDefault(require("./utils/matchesType")); | ||
var handlerIds = options.handlerIds; | ||
(0, _invariant.default)(typeof listener === 'function', 'listener must be a function.'); | ||
(0, _invariant.default)(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.'); | ||
(0, _invariant.invariant)(typeof listener === 'function', 'listener must be a function.'); | ||
(0, _invariant.invariant)(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.'); | ||
var prevStateId = this.store.getState().stateId; | ||
@@ -72,3 +72,3 @@ | ||
(0, _invariant.default)(typeof listener === 'function', 'listener must be a function.'); | ||
(0, _invariant.invariant)(typeof listener === 'function', 'listener must be a function.'); | ||
var previousState = this.store.getState().dragOffset; | ||
@@ -97,3 +97,3 @@ | ||
var source = this.registry.getSource(sourceId); | ||
(0, _invariant.default)(source, 'Expected to find a valid source.'); | ||
(0, _invariant.invariant)(source, 'Expected to find a valid source.'); | ||
@@ -115,3 +115,3 @@ if (this.isDragging()) { | ||
var target = this.registry.getTarget(targetId); | ||
(0, _invariant.default)(target, 'Expected to find a valid target.'); | ||
(0, _invariant.invariant)(target, 'Expected to find a valid target.'); | ||
@@ -140,3 +140,3 @@ if (!this.isDragging() || this.didDrop()) { | ||
var source = this.registry.getSource(sourceId, true); | ||
(0, _invariant.default)(source, 'Expected to find a valid source.'); | ||
(0, _invariant.invariant)(source, 'Expected to find a valid source.'); | ||
@@ -143,0 +143,0 @@ if (!this.isDragging() || !this.isSourcePublic()) { |
@@ -8,5 +8,5 @@ "use strict"; | ||
var _asap = _interopRequireDefault(require("asap")); | ||
var _asap = require("@react-dnd/asap"); | ||
var _invariant = _interopRequireDefault(require("invariant")); | ||
var _invariant = require("@react-dnd/invariant"); | ||
@@ -61,3 +61,3 @@ var _registry = require("./actions/registry"); | ||
default: | ||
(0, _invariant.default)(false, "Cannot parse handler ID: ".concat(handlerId)); | ||
(0, _invariant.invariant)(false, "Cannot parse handler ID: ".concat(handlerId)); | ||
} | ||
@@ -127,3 +127,3 @@ } | ||
var includePinned = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
(0, _invariant.default)(this.isSourceId(sourceId), 'Expected a valid source ID.'); | ||
(0, _invariant.invariant)(this.isSourceId(sourceId), 'Expected a valid source ID.'); | ||
var isPinned = includePinned && sourceId === this.pinnedSourceId; | ||
@@ -136,3 +136,3 @@ var source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId); | ||
value: function getTarget(targetId) { | ||
(0, _invariant.default)(this.isTargetId(targetId), 'Expected a valid target ID.'); | ||
(0, _invariant.invariant)(this.isTargetId(targetId), 'Expected a valid target ID.'); | ||
return this.dropTargets.get(targetId); | ||
@@ -143,3 +143,3 @@ } | ||
value: function getSourceType(sourceId) { | ||
(0, _invariant.default)(this.isSourceId(sourceId), 'Expected a valid source ID.'); | ||
(0, _invariant.invariant)(this.isSourceId(sourceId), 'Expected a valid source ID.'); | ||
return this.types.get(sourceId); | ||
@@ -150,3 +150,3 @@ } | ||
value: function getTargetType(targetId) { | ||
(0, _invariant.default)(this.isTargetId(targetId), 'Expected a valid target ID.'); | ||
(0, _invariant.invariant)(this.isTargetId(targetId), 'Expected a valid target ID.'); | ||
return this.types.get(targetId); | ||
@@ -171,5 +171,5 @@ } | ||
(0, _invariant.default)(this.getSource(sourceId), 'Expected an existing source.'); | ||
(0, _invariant.invariant)(this.getSource(sourceId), 'Expected an existing source.'); | ||
this.store.dispatch((0, _registry.removeSource)(sourceId)); | ||
(0, _asap.default)(function () { | ||
(0, _asap.asap)(function () { | ||
_this.dragSources.delete(sourceId); | ||
@@ -183,3 +183,3 @@ | ||
value: function removeTarget(targetId) { | ||
(0, _invariant.default)(this.getTarget(targetId), 'Expected an existing target.'); | ||
(0, _invariant.invariant)(this.getTarget(targetId), 'Expected an existing target.'); | ||
this.store.dispatch((0, _registry.removeTarget)(targetId)); | ||
@@ -193,3 +193,3 @@ this.dropTargets.delete(targetId); | ||
var source = this.getSource(sourceId); | ||
(0, _invariant.default)(source, 'Expected an existing source.'); | ||
(0, _invariant.invariant)(source, 'Expected an existing source.'); | ||
this.pinnedSourceId = sourceId; | ||
@@ -201,3 +201,3 @@ this.pinnedSource = source; | ||
value: function unpinSource() { | ||
(0, _invariant.default)(this.pinnedSource, 'No source is pinned at the time.'); | ||
(0, _invariant.invariant)(this.pinnedSource, 'No source is pinned at the time.'); | ||
this.pinnedSourceId = null; | ||
@@ -204,0 +204,0 @@ this.pinnedSource = null; |
@@ -1,2 +0,2 @@ | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import { setClientOffset } from './local/setClientOffset'; | ||
@@ -3,0 +3,0 @@ import { isObject } from '../../utils/js_utils'; |
@@ -7,3 +7,3 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import { DROP } from './types'; | ||
@@ -10,0 +10,0 @@ import { isObject } from '../../utils/js_utils'; |
@@ -1,2 +0,2 @@ | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import { END_DRAG } from './types'; | ||
@@ -3,0 +3,0 @@ export default function createEndDrag(manager) { |
@@ -1,2 +0,2 @@ | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import matchesType from '../../utils/matchesType'; | ||
@@ -3,0 +3,0 @@ import { HOVER } from './types'; |
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
export function validateSourceContract(source) { | ||
@@ -5,0 +5,0 @@ invariant(typeof source.canDrag === 'function', 'Expected canDrag to be a function.'); |
@@ -7,3 +7,3 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import matchesType from './utils/matchesType'; | ||
@@ -10,0 +10,0 @@ import { getSourceClientOffset as _getSourceClientOffset, getDifferenceFromInitialOffset as _getDifferenceFromInitialOffset } from './utils/coords'; |
@@ -15,4 +15,4 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import asap from 'asap'; | ||
import invariant from 'invariant'; | ||
import { asap } from '@react-dnd/asap'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import { addSource as _addSource, addTarget as _addTarget, removeSource as _removeSource, removeTarget as _removeTarget } from './actions/registry'; | ||
@@ -19,0 +19,0 @@ import getNextUniqueId from './utils/getNextUniqueId'; |
@@ -1,2 +0,2 @@ | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import { setClientOffset } from './local/setClientOffset'; | ||
@@ -3,0 +3,0 @@ import { isObject } from '../../utils/js_utils'; |
@@ -1,2 +0,2 @@ | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import { DROP } from './types'; | ||
@@ -3,0 +3,0 @@ import { isObject } from '../../utils/js_utils'; |
@@ -1,2 +0,2 @@ | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import { END_DRAG } from './types'; | ||
@@ -3,0 +3,0 @@ export default function createEndDrag(manager) { |
@@ -1,2 +0,2 @@ | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import matchesType from '../../utils/matchesType'; | ||
@@ -3,0 +3,0 @@ import { HOVER } from './types'; |
@@ -1,2 +0,2 @@ | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
export function validateSourceContract(source) { | ||
@@ -3,0 +3,0 @@ invariant(typeof source.canDrag === 'function', 'Expected canDrag to be a function.'); |
@@ -1,2 +0,2 @@ | ||
import invariant from 'invariant'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import matchesType from './utils/matchesType'; | ||
@@ -3,0 +3,0 @@ import { getSourceClientOffset, getDifferenceFromInitialOffset, } from './utils/coords'; |
@@ -1,3 +0,3 @@ | ||
import asap from 'asap'; | ||
import invariant from 'invariant'; | ||
import { asap } from '@react-dnd/asap'; | ||
import { invariant } from '@react-dnd/invariant'; | ||
import { addSource, addTarget, removeSource, removeTarget, } from './actions/registry'; | ||
@@ -4,0 +4,0 @@ import getNextUniqueId from './utils/getNextUniqueId'; |
{ | ||
"name": "dnd-core", | ||
"version": "9.5.1", | ||
"version": "10.0.0", | ||
"description": "Drag and drop sans the GUI", | ||
"license": "MIT", | ||
"main": "./dist/esm/index.js", | ||
"main": "./dist/cjs/index.js", | ||
"module": "./dist/esm/index.js", | ||
"type": "module", | ||
"types": "./lib/index.d.ts", | ||
@@ -21,9 +20,7 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@types/asap": "^2.0.0", | ||
"@types/invariant": "^2.2.30", | ||
"asap": "^2.0.6", | ||
"invariant": "^2.2.4", | ||
"@react-dnd/asap": "^3.0.0", | ||
"@react-dnd/invariant": "^2.0.0", | ||
"redux": "^4.0.4" | ||
}, | ||
"gitHead": "db9e93ee434fda1d4e0d599c75328aef3d858866" | ||
"gitHead": "6aa1fb15bd65e06e32ee2d43fa73f76d4822211f" | ||
} |
Sorry, the diff of this file is not supported yet
347837
3
3934
No
+ Added@react-dnd/asap@^3.0.0
+ Added@react-dnd/invariant@^2.0.0
+ Added@react-dnd/asap@3.0.0(transitive)
+ Added@react-dnd/invariant@2.0.0(transitive)
- Removed@types/asap@^2.0.0
- Removed@types/invariant@^2.2.30
- Removedasap@^2.0.6
- Removedinvariant@^2.2.4
- Removed@types/asap@2.0.2(transitive)
- Removed@types/invariant@2.2.37(transitive)
- Removedasap@2.0.6(transitive)
- Removedinvariant@2.2.4(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)