Socket
Socket
Sign inDemoInstall

dnd-core

Package Overview
Dependencies
5
Maintainers
5
Versions
93
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 15.0.2 to 15.1.0

dist/esm/actions/dragDrop/beginDrag.mjs

16

dist/cjs/actions/dragDrop/beginDrag.js

@@ -7,7 +7,7 @@ "use strict";

var _invariant = require("@react-dnd/invariant");
var _setClientOffset = require("./local/setClientOffset");
var _jsUtils = require("../../utils/js_utils");
var _types = require("./types");
var _setClientOffsetJs = require("./local/setClientOffset.js");
var _jsUtilsJs = require("../../utils/js_utils.js");
var _typesJs = require("./types.js");
const ResetCoordinatesAction = {
type: _types.INIT_COORDS,
type: _typesJs.INIT_COORDS,
payload: {

@@ -26,3 +26,3 @@ clientOffset: null,

// Initialize the coordinates using the client offset
manager.dispatch((0, _setClientOffset).setClientOffset(clientOffset));
manager.dispatch((0, _setClientOffsetJs).setClientOffset(clientOffset));
verifyInvariants(sourceIds, monitor, registry);

@@ -45,3 +45,3 @@ // Get the draggable source

// Initialize the full coordinates
manager.dispatch((0, _setClientOffset).setClientOffset(clientOffset, sourceClientOffset));
manager.dispatch((0, _setClientOffsetJs).setClientOffset(clientOffset, sourceClientOffset));
const source = registry.getSource(sourceId);

@@ -57,3 +57,3 @@ const item = source.beginDrag(monitor, sourceId);

return {
type: _types.BEGIN_DRAG,
type: _typesJs.BEGIN_DRAG,
payload: {

@@ -80,3 +80,3 @@ itemType,

function verifyItemIsObject(item) {
(0, _invariant).invariant((0, _jsUtils).isObject(item), 'Item must be an object.');
(0, _invariant).invariant((0, _jsUtilsJs).isObject(item), 'Item must be an object.');
}

@@ -83,0 +83,0 @@ function getDraggableSource(sourceIds, monitor) {

@@ -7,4 +7,4 @@ "use strict";

var _invariant = require("@react-dnd/invariant");
var _types = require("./types");
var _jsUtils = require("../../utils/js_utils");
var _typesJs = require("./types.js");
var _jsUtilsJs = require("../../utils/js_utils.js");
function _defineProperty(obj, key, value) {

@@ -48,3 +48,3 @@ if (key in obj) {

const action = {
type: _types.DROP,
type: _typesJs.DROP,
payload: {

@@ -72,3 +72,3 @@ dropResult: _objectSpread({}, options, dropResult)

function verifyDropResultType(dropResult) {
(0, _invariant).invariant(typeof dropResult === 'undefined' || (0, _jsUtils).isObject(dropResult), 'Drop result must either be an object or undefined.');
(0, _invariant).invariant(typeof dropResult === 'undefined' || (0, _jsUtilsJs).isObject(dropResult), 'Drop result must either be an object or undefined.');
}

@@ -75,0 +75,0 @@ function getDroppableTargets(monitor) {

@@ -7,3 +7,3 @@ "use strict";

var _invariant = require("@react-dnd/invariant");
var _types = require("./types");
var _typesJs = require("./types.js");
function createEndDrag(manager) {

@@ -21,3 +21,3 @@ return function endDrag() {

return {
type: _types.END_DRAG
type: _typesJs.END_DRAG
};

@@ -24,0 +24,0 @@ };

@@ -7,4 +7,4 @@ "use strict";

var _invariant = require("@react-dnd/invariant");
var _matchesType = require("../../utils/matchesType");
var _types = require("./types");
var _matchesTypeJs = require("../../utils/matchesType.js");
var _typesJs = require("./types.js");
function createHover(manager) {

@@ -21,3 +21,3 @@ return function hover(targetIdsArg, { clientOffset } = {}) {

return {
type: _types.HOVER,
type: _typesJs.HOVER,
payload: {

@@ -50,3 +50,3 @@ targetIds,

const targetType = registry.getTargetType(targetId);
if (!(0, _matchesType).matchesType(targetType, draggedItemType)) {
if (!(0, _matchesTypeJs).matchesType(targetType, draggedItemType)) {
targetIds.splice(i, 1);

@@ -53,0 +53,0 @@ }

@@ -6,15 +6,15 @@ "use strict";

exports.createDragDropActions = createDragDropActions;
var _beginDrag = require("./beginDrag");
var _publishDragSource = require("./publishDragSource");
var _hover = require("./hover");
var _drop = require("./drop");
var _endDrag = require("./endDrag");
var _types = _interopRequireWildcard(require("./types"));
Object.keys(_types).forEach(function(key) {
var _beginDragJs = require("./beginDrag.js");
var _publishDragSourceJs = require("./publishDragSource.js");
var _hoverJs = require("./hover.js");
var _dropJs = require("./drop.js");
var _endDragJs = require("./endDrag.js");
var _typesJs = _interopRequireWildcard(require("./types.js"));
Object.keys(_typesJs).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (key in exports && exports[key] === _types[key]) return;
if (key in exports && exports[key] === _typesJs[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _types[key];
return _typesJs[key];
}

@@ -46,7 +46,7 @@ });

return {
beginDrag: (0, _beginDrag).createBeginDrag(manager),
publishDragSource: (0, _publishDragSource).createPublishDragSource(manager),
hover: (0, _hover).createHover(manager),
drop: (0, _drop).createDrop(manager),
endDrag: (0, _endDrag).createEndDrag(manager)
beginDrag: (0, _beginDragJs).createBeginDrag(manager),
publishDragSource: (0, _publishDragSourceJs).createPublishDragSource(manager),
hover: (0, _hoverJs).createHover(manager),
drop: (0, _dropJs).createDrop(manager),
endDrag: (0, _endDragJs).createEndDrag(manager)
};

@@ -53,0 +53,0 @@ }

@@ -6,6 +6,6 @@ "use strict";

exports.setClientOffset = setClientOffset;
var _types = require("../types");
var _typesJs = require("../types.js");
function setClientOffset(clientOffset, sourceClientOffset) {
return {
type: _types.INIT_COORDS,
type: _typesJs.INIT_COORDS,
payload: {

@@ -12,0 +12,0 @@ sourceClientOffset: sourceClientOffset || null,

@@ -6,3 +6,3 @@ "use strict";

exports.createPublishDragSource = createPublishDragSource;
var _types = require("./types");
var _typesJs = require("./types.js");
function createPublishDragSource(manager) {

@@ -13,3 +13,3 @@ return function publishDragSource() {

return {
type: _types.PUBLISH_DRAG_SOURCE
type: _typesJs.PUBLISH_DRAG_SOURCE
};

@@ -16,0 +16,0 @@ }

@@ -5,3 +5,3 @@ "use strict";

});
var _dragDrop = require("../actions/dragDrop");
var _indexJs = require("../actions/dragDrop/index.js");
class DragDropManagerImpl {

@@ -31,3 +31,3 @@ receiveBackend(backend) {

}
const actions = (0, _dragDrop).createDragDropActions(this);
const actions = (0, _indexJs).createDragDropActions(this);
return Object.keys(actions).reduce((boundActions, key)=>{

@@ -34,0 +34,0 @@ const action = actions[key];

@@ -6,5 +6,5 @@ "use strict";

var _invariant = require("@react-dnd/invariant");
var _matchesType = require("../utils/matchesType");
var _coords = require("../utils/coords");
var _dirtiness = require("../utils/dirtiness");
var _matchesTypeJs = require("../utils/matchesType.js");
var _coordsJs = require("../utils/coords.js");
var _dirtinessJs = require("../utils/dirtiness.js");
class DragDropMonitorImpl {

@@ -20,3 +20,3 @@ subscribeToStateChange(listener, options = {}) {

try {
const canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !(0, _dirtiness).areDirty(state.dirtyHandlerIds, handlerIds);
const canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !(0, _dirtinessJs).areDirty(state.dirtyHandlerIds, handlerIds);
if (!canSkipListener) {

@@ -67,3 +67,3 @@ listener();

const draggedItemType = this.getItemType();
return (0, _matchesType).matchesType(targetType, draggedItemType) && target.canDrop(this, targetId);
return (0, _matchesTypeJs).matchesType(targetType, draggedItemType) && target.canDrop(this, targetId);
}

@@ -103,3 +103,3 @@ isDragging() {

const draggedItemType = this.getItemType();
if (draggedItemType && !(0, _matchesType).matchesType(targetType, draggedItemType)) {
if (draggedItemType && !(0, _matchesTypeJs).matchesType(targetType, draggedItemType)) {
return false;

@@ -149,6 +149,6 @@ }

getSourceClientOffset() {
return (0, _coords).getSourceClientOffset(this.store.getState().dragOffset);
return (0, _coordsJs).getSourceClientOffset(this.store.getState().dragOffset);
}
getDifferenceFromInitialOffset() {
return (0, _coords).getDifferenceFromInitialOffset(this.store.getState().dragOffset);
return (0, _coordsJs).getDifferenceFromInitialOffset(this.store.getState().dragOffset);
}

@@ -155,0 +155,0 @@ constructor(store, registry){

@@ -6,13 +6,13 @@ "use strict";

var _invariant = require("@react-dnd/invariant");
var _registry = require("../actions/registry");
var _getNextUniqueId = require("../utils/getNextUniqueId");
var _interfaces = require("../interfaces");
var _contracts = require("../contracts");
var _registryJs = require("../actions/registry.js");
var _getNextUniqueIdJs = require("../utils/getNextUniqueId.js");
var _interfacesJs = require("../interfaces.js");
var _contractsJs = require("../contracts.js");
var _asap = require("@react-dnd/asap");
function getNextHandlerId(role) {
const id = (0, _getNextUniqueId).getNextUniqueId().toString();
const id = (0, _getNextUniqueIdJs).getNextUniqueId().toString();
switch(role){
case _interfaces.HandlerRole.SOURCE:
case _interfacesJs.HandlerRole.SOURCE:
return `S${id}`;
case _interfaces.HandlerRole.TARGET:
case _interfacesJs.HandlerRole.TARGET:
return `T${id}`;

@@ -26,5 +26,5 @@ default:

case 'S':
return _interfaces.HandlerRole.SOURCE;
return _interfacesJs.HandlerRole.SOURCE;
case 'T':
return _interfaces.HandlerRole.TARGET;
return _interfacesJs.HandlerRole.TARGET;
default:

@@ -48,13 +48,13 @@ throw new Error(`Cannot parse handler ID: ${handlerId}`);

addSource(type, source) {
(0, _contracts).validateType(type);
(0, _contracts).validateSourceContract(source);
const sourceId = this.addHandler(_interfaces.HandlerRole.SOURCE, type, source);
this.store.dispatch((0, _registry).addSource(sourceId));
(0, _contractsJs).validateType(type);
(0, _contractsJs).validateSourceContract(source);
const sourceId = this.addHandler(_interfacesJs.HandlerRole.SOURCE, type, source);
this.store.dispatch((0, _registryJs).addSource(sourceId));
return sourceId;
}
addTarget(type, target) {
(0, _contracts).validateType(type, true);
(0, _contracts).validateTargetContract(target);
const targetId = this.addHandler(_interfaces.HandlerRole.TARGET, type, target);
this.store.dispatch((0, _registry).addTarget(targetId));
(0, _contractsJs).validateType(type, true);
(0, _contractsJs).validateTargetContract(target);
const targetId = this.addHandler(_interfacesJs.HandlerRole.TARGET, type, target);
this.store.dispatch((0, _registryJs).addTarget(targetId));
return targetId;

@@ -85,11 +85,11 @@ }

const role = parseRoleFromHandlerId(handlerId);
return role === _interfaces.HandlerRole.SOURCE;
return role === _interfacesJs.HandlerRole.SOURCE;
}
isTargetId(handlerId) {
const role = parseRoleFromHandlerId(handlerId);
return role === _interfaces.HandlerRole.TARGET;
return role === _interfacesJs.HandlerRole.TARGET;
}
removeSource(sourceId) {
(0, _invariant).invariant(this.getSource(sourceId), 'Expected an existing source.');
this.store.dispatch((0, _registry).removeSource(sourceId));
this.store.dispatch((0, _registryJs).removeSource(sourceId));
(0, _asap).asap(()=>{

@@ -102,3 +102,3 @@ this.dragSources.delete(sourceId);

(0, _invariant).invariant(this.getTarget(targetId), 'Expected an existing target.');
this.store.dispatch((0, _registry).removeTarget(targetId));
this.store.dispatch((0, _registryJs).removeTarget(targetId));
this.dropTargets.delete(targetId);

@@ -121,5 +121,5 @@ this.types.delete(targetId);

this.types.set(id, type);
if (role === _interfaces.HandlerRole.SOURCE) {
if (role === _interfacesJs.HandlerRole.SOURCE) {
this.dragSources.set(id, handler);
} else if (role === _interfaces.HandlerRole.TARGET) {
} else if (role === _interfacesJs.HandlerRole.TARGET) {
this.dropTargets.set(id, handler);

@@ -126,0 +126,0 @@ }

@@ -6,11 +6,11 @@ "use strict";

exports.createDragDropManager = createDragDropManager;
var _dragDropManagerImpl = require("./classes/DragDropManagerImpl");
var _dragDropManagerImplJs = require("./classes/DragDropManagerImpl.js");
var _redux = require("redux");
var _reducers = require("./reducers");
var _dragDropMonitorImpl = require("./classes/DragDropMonitorImpl");
var _handlerRegistryImpl = require("./classes/HandlerRegistryImpl");
var _indexJs = require("./reducers/index.js");
var _dragDropMonitorImplJs = require("./classes/DragDropMonitorImpl.js");
var _handlerRegistryImplJs = require("./classes/HandlerRegistryImpl.js");
function createDragDropManager(backendFactory, globalContext = undefined, backendOptions = {}, debugMode = false) {
const store = makeStoreInstance(debugMode);
const monitor = new _dragDropMonitorImpl.DragDropMonitorImpl(store, new _handlerRegistryImpl.HandlerRegistryImpl(store));
const manager = new _dragDropManagerImpl.DragDropManagerImpl(store, monitor);
const monitor = new _dragDropMonitorImplJs.DragDropMonitorImpl(store, new _handlerRegistryImplJs.HandlerRegistryImpl(store));
const manager = new _dragDropManagerImplJs.DragDropManagerImpl(store, monitor);
const backend = backendFactory(manager, globalContext, backendOptions);

@@ -24,3 +24,3 @@ manager.receiveBackend(backend);

const reduxDevTools = typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__;
return (0, _redux).createStore(_reducers.reduce, debugMode && reduxDevTools && reduxDevTools({
return (0, _redux).createStore(_indexJs.reduce, debugMode && reduxDevTools && reduxDevTools({
name: 'dnd-core',

@@ -27,0 +27,0 @@ instanceId: 'dnd-core'

@@ -6,23 +6,23 @@ "use strict";

var _exportNames = {};
var _interfaces = _interopRequireWildcard(require("./interfaces"));
Object.keys(_interfaces).forEach(function(key) {
var _interfacesJs = _interopRequireWildcard(require("./interfaces.js"));
Object.keys(_interfacesJs).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _interfaces[key]) return;
if (key in exports && exports[key] === _interfacesJs[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _interfaces[key];
return _interfacesJs[key];
}
});
});
var _createDragDropManager = _interopRequireWildcard(require("./createDragDropManager"));
Object.keys(_createDragDropManager).forEach(function(key) {
var _createDragDropManagerJs = _interopRequireWildcard(require("./createDragDropManager.js"));
Object.keys(_createDragDropManagerJs).forEach(function(key) {
if (key === "default" || key === "__esModule") return;
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
if (key in exports && exports[key] === _createDragDropManager[key]) return;
if (key in exports && exports[key] === _createDragDropManagerJs[key]) return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function() {
return _createDragDropManager[key];
return _createDragDropManagerJs[key];
}

@@ -29,0 +29,0 @@ });

@@ -6,29 +6,29 @@ "use strict";

exports.reduce = reduce;
var _dragDrop = require("../actions/dragDrop");
var _registry = require("../actions/registry");
var _equality = require("../utils/equality");
var _dirtiness = require("../utils/dirtiness");
var _jsUtils = require("../utils/js_utils");
var _indexJs = require("../actions/dragDrop/index.js");
var _registryJs = require("../actions/registry.js");
var _equalityJs = require("../utils/equality.js");
var _dirtinessJs = require("../utils/dirtiness.js");
var _jsUtilsJs = require("../utils/js_utils.js");
function reduce(// eslint-disable-next-line @typescript-eslint/no-unused-vars
_state = _dirtiness.NONE, action) {
_state = _dirtinessJs.NONE, action) {
switch(action.type){
case _dragDrop.HOVER:
case _indexJs.HOVER:
break;
case _registry.ADD_SOURCE:
case _registry.ADD_TARGET:
case _registry.REMOVE_TARGET:
case _registry.REMOVE_SOURCE:
return _dirtiness.NONE;
case _dragDrop.BEGIN_DRAG:
case _dragDrop.PUBLISH_DRAG_SOURCE:
case _dragDrop.END_DRAG:
case _dragDrop.DROP:
case _registryJs.ADD_SOURCE:
case _registryJs.ADD_TARGET:
case _registryJs.REMOVE_TARGET:
case _registryJs.REMOVE_SOURCE:
return _dirtinessJs.NONE;
case _indexJs.BEGIN_DRAG:
case _indexJs.PUBLISH_DRAG_SOURCE:
case _indexJs.END_DRAG:
case _indexJs.DROP:
default:
return _dirtiness.ALL;
return _dirtinessJs.ALL;
}
const { targetIds =[] , prevTargetIds =[] } = action.payload;
const result = (0, _jsUtils).xor(targetIds, prevTargetIds);
const didChange = result.length > 0 || !(0, _equality).areArraysEqual(targetIds, prevTargetIds);
const result = (0, _jsUtilsJs).xor(targetIds, prevTargetIds);
const didChange = result.length > 0 || !(0, _equalityJs).areArraysEqual(targetIds, prevTargetIds);
if (!didChange) {
return _dirtiness.NONE;
return _dirtinessJs.NONE;
}

@@ -35,0 +35,0 @@ // Check the target ids at the innermost position. If they are valid, add them

@@ -6,4 +6,4 @@ "use strict";

exports.reduce = reduce;
var _dragDrop = require("../actions/dragDrop");
var _equality = require("../utils/equality");
var _indexJs = require("../actions/dragDrop/index.js");
var _equalityJs = require("../utils/equality.js");
function _defineProperty(obj, key, value) {

@@ -45,4 +45,4 @@ if (key in obj) {

switch(action.type){
case _dragDrop.INIT_COORDS:
case _dragDrop.BEGIN_DRAG:
case _indexJs.INIT_COORDS:
case _indexJs.BEGIN_DRAG:
return {

@@ -53,4 +53,4 @@ initialSourceClientOffset: payload.sourceClientOffset,

};
case _dragDrop.HOVER:
if ((0, _equality).areCoordsEqual(state.clientOffset, payload.clientOffset)) {
case _indexJs.HOVER:
if ((0, _equalityJs).areCoordsEqual(state.clientOffset, payload.clientOffset)) {
return state;

@@ -61,4 +61,4 @@ }

});
case _dragDrop.END_DRAG:
case _dragDrop.DROP:
case _indexJs.END_DRAG:
case _indexJs.DROP:
return initialState;

@@ -65,0 +65,0 @@ default:

@@ -6,5 +6,5 @@ "use strict";

exports.reduce = reduce;
var _dragDrop = require("../actions/dragDrop");
var _registry = require("../actions/registry");
var _jsUtils = require("../utils/js_utils");
var _indexJs = require("../actions/dragDrop/index.js");
var _registryJs = require("../actions/registry.js");
var _jsUtilsJs = require("../utils/js_utils.js");
function _defineProperty(obj, key, value) {

@@ -50,3 +50,3 @@ if (key in obj) {

switch(action.type){
case _dragDrop.BEGIN_DRAG:
case _indexJs.BEGIN_DRAG:
return _objectSpread({}, state, {

@@ -60,11 +60,11 @@ itemType: payload.itemType,

});
case _dragDrop.PUBLISH_DRAG_SOURCE:
case _indexJs.PUBLISH_DRAG_SOURCE:
return _objectSpread({}, state, {
isSourcePublic: true
});
case _dragDrop.HOVER:
case _indexJs.HOVER:
return _objectSpread({}, state, {
targetIds: payload.targetIds
});
case _registry.REMOVE_TARGET:
case _registryJs.REMOVE_TARGET:
if (state.targetIds.indexOf(payload.targetId) === -1) {

@@ -74,5 +74,5 @@ return state;

return _objectSpread({}, state, {
targetIds: (0, _jsUtils).without(state.targetIds, payload.targetId)
targetIds: (0, _jsUtilsJs).without(state.targetIds, payload.targetId)
});
case _dragDrop.DROP:
case _indexJs.DROP:
return _objectSpread({}, state, {

@@ -83,3 +83,3 @@ dropResult: payload.dropResult,

});
case _dragDrop.END_DRAG:
case _indexJs.END_DRAG:
return _objectSpread({}, state, {

@@ -86,0 +86,0 @@ itemType: null,

@@ -6,8 +6,8 @@ "use strict";

exports.reduce = reduce;
var _dragOffset = require("./dragOffset");
var _dragOperation = require("./dragOperation");
var _refCount = require("./refCount");
var _dirtyHandlerIds = require("./dirtyHandlerIds");
var _stateId = require("./stateId");
var _jsUtils = require("../utils/js_utils");
var _dragOffsetJs = require("./dragOffset.js");
var _dragOperationJs = require("./dragOperation.js");
var _refCountJs = require("./refCount.js");
var _dirtyHandlerIdsJs = require("./dirtyHandlerIds.js");
var _stateIdJs = require("./stateId.js");
var _jsUtilsJs = require("../utils/js_utils.js");
function _defineProperty(obj, key, value) {

@@ -43,12 +43,12 @@ if (key in obj) {

return {
dirtyHandlerIds: (0, _dirtyHandlerIds).reduce(state.dirtyHandlerIds, {
dirtyHandlerIds: (0, _dirtyHandlerIdsJs).reduce(state.dirtyHandlerIds, {
type: action.type,
payload: _objectSpread({}, action.payload, {
prevTargetIds: (0, _jsUtils).get(state, 'dragOperation.targetIds', [])
prevTargetIds: (0, _jsUtilsJs).get(state, 'dragOperation.targetIds', [])
})
}),
dragOffset: (0, _dragOffset).reduce(state.dragOffset, action),
refCount: (0, _refCount).reduce(state.refCount, action),
dragOperation: (0, _dragOperation).reduce(state.dragOperation, action),
stateId: (0, _stateId).reduce(state.stateId)
dragOffset: (0, _dragOffsetJs).reduce(state.dragOffset, action),
refCount: (0, _refCountJs).reduce(state.refCount, action),
dragOperation: (0, _dragOperationJs).reduce(state.dragOperation, action),
stateId: (0, _stateIdJs).reduce(state.stateId)
};

@@ -55,0 +55,0 @@ }

@@ -6,10 +6,10 @@ "use strict";

exports.reduce = reduce;
var _registry = require("../actions/registry");
var _registryJs = require("../actions/registry.js");
function reduce(state = 0, action) {
switch(action.type){
case _registry.ADD_SOURCE:
case _registry.ADD_TARGET:
case _registryJs.ADD_SOURCE:
case _registryJs.ADD_TARGET:
return state + 1;
case _registry.REMOVE_SOURCE:
case _registry.REMOVE_TARGET:
case _registryJs.REMOVE_SOURCE:
case _registryJs.REMOVE_TARGET:
return state - 1;

@@ -16,0 +16,0 @@ default:

@@ -7,3 +7,3 @@ "use strict";

exports.ALL = exports.NONE = void 0;
var _jsUtils = require("./js_utils");
var _jsUtilsJs = require("./js_utils.js");
const NONE = [];

@@ -22,3 +22,3 @@ exports.NONE = NONE;

}
const commonIds = (0, _jsUtils).intersection(handlerIds, dirtyIds);
const commonIds = (0, _jsUtilsJs).intersection(handlerIds, dirtyIds);
return commonIds.length > 0;

@@ -25,0 +25,0 @@ }

@@ -1,2 +0,2 @@

import type { Action, DragDropManager, BeginDragPayload, BeginDragOptions, Identifier } from '../../interfaces';
import type { Action, DragDropManager, BeginDragPayload, BeginDragOptions, Identifier } from '../../interfaces.js';
export declare function createBeginDrag(manager: DragDropManager): (sourceIds?: Identifier[], options?: BeginDragOptions) => Action<BeginDragPayload> | undefined;

@@ -1,2 +0,2 @@

import type { DragDropManager } from '../../interfaces';
import type { DragDropManager } from '../../interfaces.js';
export declare function createDrop(manager: DragDropManager): (options?: {}) => void;

@@ -1,2 +0,2 @@

import type { DragDropManager, SentinelAction } from '../../interfaces';
import type { DragDropManager, SentinelAction } from '../../interfaces.js';
export declare function createEndDrag(manager: DragDropManager): () => SentinelAction;

@@ -1,2 +0,2 @@

import type { Action, DragDropManager, HoverPayload, HoverOptions } from '../../interfaces';
import type { Action, DragDropManager, HoverPayload, HoverOptions } from '../../interfaces.js';
export declare function createHover(manager: DragDropManager): (targetIdsArg: string[], { clientOffset }?: HoverOptions) => Action<HoverPayload>;

@@ -1,3 +0,3 @@

import type { DragDropManager, DragDropActions } from '../../interfaces';
export * from './types';
import type { DragDropManager, DragDropActions } from '../../interfaces.js';
export * from './types.js';
export declare function createDragDropActions(manager: DragDropManager): DragDropActions;

@@ -1,3 +0,3 @@

import type { XYCoord } from '../../../interfaces';
import type { XYCoord } from '../../../interfaces.js';
import type { AnyAction } from 'redux';
export declare function setClientOffset(clientOffset: XYCoord | null | undefined, sourceClientOffset?: XYCoord | null | undefined): AnyAction;

@@ -1,2 +0,2 @@

import type { DragDropManager, SentinelAction } from '../../interfaces';
import type { DragDropManager, SentinelAction } from '../../interfaces.js';
export declare function createPublishDragSource(manager: DragDropManager): () => SentinelAction | undefined;

@@ -1,2 +0,2 @@

import type { Action, SourceIdPayload, TargetIdPayload } from '../interfaces';
import type { Action, SourceIdPayload, TargetIdPayload } from '../interfaces.js';
export declare const ADD_SOURCE = "dnd-core/ADD_SOURCE";

@@ -3,0 +3,0 @@ export declare const ADD_TARGET = "dnd-core/ADD_TARGET";

import type { Store, Action } from 'redux';
import type { State } from '../reducers';
import type { Backend, DragDropActions, DragDropMonitor, DragDropManager, HandlerRegistry } from '../interfaces';
import type { State } from '../reducers/index.js';
import type { Backend, DragDropActions, DragDropMonitor, DragDropManager, HandlerRegistry } from '../interfaces.js';
export declare class DragDropManagerImpl implements DragDropManager {

@@ -5,0 +5,0 @@ private store;

import type { Store } from 'redux';
import type { State } from '../reducers';
import type { DragDropMonitor, Listener, Unsubscribe, XYCoord, HandlerRegistry, Identifier } from '../interfaces';
import type { State } from '../reducers/index.js';
import type { DragDropMonitor, Listener, Unsubscribe, XYCoord, HandlerRegistry, Identifier } from '../interfaces.js';
export declare class DragDropMonitorImpl implements DragDropMonitor {

@@ -5,0 +5,0 @@ private store;

import type { Store } from 'redux';
import type { State } from '../reducers';
import { DragSource, DropTarget, SourceType, TargetType, Identifier, HandlerRegistry } from '../interfaces';
import type { State } from '../reducers/index.js';
import { DragSource, DropTarget, SourceType, TargetType, Identifier, HandlerRegistry } from '../interfaces.js';
export declare class HandlerRegistryImpl implements HandlerRegistry {

@@ -5,0 +5,0 @@ private types;

@@ -1,4 +0,4 @@

import type { DragSource, DropTarget, Identifier } from './interfaces';
import type { DragSource, DropTarget, Identifier } from './interfaces.js';
export declare function validateSourceContract(source: DragSource): void;
export declare function validateTargetContract(target: DropTarget): void;
export declare function validateType(type: Identifier | Identifier[], allowArray?: boolean): void;

@@ -1,2 +0,2 @@

import type { DragDropManager, BackendFactory } from './interfaces';
import type { DragDropManager, BackendFactory } from './interfaces.js';
export declare function createDragDropManager(backendFactory: BackendFactory, globalContext?: unknown, backendOptions?: unknown, debugMode?: boolean): DragDropManager;

@@ -1,2 +0,2 @@

export * from './interfaces';
export * from './createDragDropManager';
export * from './interfaces.js';
export * from './createDragDropManager.js';

@@ -1,2 +0,2 @@

import type { Action } from '../interfaces';
import type { Action } from '../interfaces.js';
export declare type State = string[];

@@ -3,0 +3,0 @@ export interface DirtyHandlerIdPayload {

@@ -1,2 +0,2 @@

import type { XYCoord, Action } from '../interfaces';
import type { XYCoord, Action } from '../interfaces.js';
export interface State {

@@ -3,0 +3,0 @@ initialSourceClientOffset: XYCoord | null;

@@ -1,2 +0,2 @@

import type { Identifier, Action } from '../interfaces';
import type { Identifier, Action } from '../interfaces.js';
export interface State {

@@ -3,0 +3,0 @@ itemType: Identifier | Identifier[] | null;

@@ -1,7 +0,7 @@

import { State as DragOffsetState } from './dragOffset';
import { State as DragOperationState } from './dragOperation';
import { State as RefCountState } from './refCount';
import { State as DirtyHandlerIdsState } from './dirtyHandlerIds';
import { State as StateIdState } from './stateId';
import type { Action } from '../interfaces';
import { State as DragOffsetState } from './dragOffset.js';
import { State as DragOperationState } from './dragOperation.js';
import { State as RefCountState } from './refCount.js';
import { State as DirtyHandlerIdsState } from './dirtyHandlerIds.js';
import { State as StateIdState } from './stateId.js';
import type { Action } from '../interfaces.js';
export interface State {

@@ -8,0 +8,0 @@ dirtyHandlerIds: DirtyHandlerIdsState;

@@ -1,3 +0,3 @@

import type { Action } from '../interfaces';
import type { Action } from '../interfaces.js';
export declare type State = number;
export declare function reduce(state: number | undefined, action: Action<any>): State;

@@ -1,3 +0,3 @@

import type { State } from '../reducers/dragOffset';
import type { XYCoord } from '..';
import type { State } from '../reducers/dragOffset.js';
import type { XYCoord } from '../interfaces.js';
/**

@@ -4,0 +4,0 @@ * Coordinate addition

@@ -1,2 +0,2 @@

import type { XYCoord } from '../interfaces';
import type { XYCoord } from '../interfaces.js';
export declare type EqualityCheck<T> = (a: T, b: T) => boolean;

@@ -3,0 +3,0 @@ export declare const strictEquality: <T>(a: T, b: T) => boolean;

@@ -1,2 +0,2 @@

import type { Identifier } from '../interfaces';
import type { Identifier } from '../interfaces.js';
export declare function matchesType(targetType: Identifier | Identifier[] | null, draggedItemType: Identifier | null): boolean;
{
"name": "dnd-core",
"version": "15.0.2",
"version": "15.1.0",
"description": "Drag and drop sans the GUI",
"license": "MIT",
"exports": {
"import": "./dist/esm/index.mjs",
"require": "./dist/cjs/index.js",
"types": "./dist/types/index.d.ts"
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types/index.d.ts",

@@ -15,3 +19,4 @@ "sideEffects": false,

"build_cjs": "swc -C module.type=commonjs -d dist/cjs src/",
"build": "run-s build_types build_esm build_cjs"
"esm_hack": "node ../../scripts/esmify.mjs",
"build": "run-s build_types build_esm build_cjs esm_hack"
},

@@ -30,2 +35,3 @@ "repository": {

"@swc/core": "^1.2.136",
"@types/jest": "^27.4.0",
"@types/setimmediate": "^1.0.2",

@@ -32,0 +38,0 @@ "npm-run-all": "^4.1.5",

@@ -11,6 +11,6 @@ import { invariant } from '@react-dnd/invariant'

Identifier,
} from '../../interfaces'
import { setClientOffset } from './local/setClientOffset'
import { isObject } from '../../utils/js_utils'
import { BEGIN_DRAG, INIT_COORDS } from './types'
} from '../../interfaces.js'
import { setClientOffset } from './local/setClientOffset.js'
import { isObject } from '../../utils/js_utils.js'
import { BEGIN_DRAG, INIT_COORDS } from './types.js'

@@ -17,0 +17,0 @@ const ResetCoordinatesAction = {

@@ -9,5 +9,5 @@ import { invariant } from '@react-dnd/invariant'

Identifier,
} from '../../interfaces'
import { DROP } from './types'
import { isObject } from '../../utils/js_utils'
} from '../../interfaces.js'
import { DROP } from './types.js'
import { isObject } from '../../utils/js_utils.js'

@@ -14,0 +14,0 @@ export function createDrop(manager: DragDropManager) {

@@ -6,4 +6,4 @@ import { invariant } from '@react-dnd/invariant'

DragDropMonitor,
} from '../../interfaces'
import { END_DRAG } from './types'
} from '../../interfaces.js'
import { END_DRAG } from './types.js'

@@ -10,0 +10,0 @@ export function createEndDrag(manager: DragDropManager) {

@@ -10,5 +10,5 @@ import { invariant } from '@react-dnd/invariant'

Identifier,
} from '../../interfaces'
import { matchesType } from '../../utils/matchesType'
import { HOVER } from './types'
} from '../../interfaces.js'
import { matchesType } from '../../utils/matchesType.js'
import { HOVER } from './types.js'

@@ -15,0 +15,0 @@ export function createHover(manager: DragDropManager) {

@@ -1,9 +0,9 @@

import type { DragDropManager, DragDropActions } from '../../interfaces'
import { createBeginDrag } from './beginDrag'
import { createPublishDragSource } from './publishDragSource'
import { createHover } from './hover'
import { createDrop } from './drop'
import { createEndDrag } from './endDrag'
import type { DragDropManager, DragDropActions } from '../../interfaces.js'
import { createBeginDrag } from './beginDrag.js'
import { createPublishDragSource } from './publishDragSource.js'
import { createHover } from './hover.js'
import { createDrop } from './drop.js'
import { createEndDrag } from './endDrag.js'
export * from './types'
export * from './types.js'

@@ -10,0 +10,0 @@ export function createDragDropActions(

@@ -1,4 +0,4 @@

import type { XYCoord } from '../../../interfaces'
import type { XYCoord } from '../../../interfaces.js'
import type { AnyAction } from 'redux'
import { INIT_COORDS } from '../types'
import { INIT_COORDS } from '../types.js'

@@ -5,0 +5,0 @@ export function setClientOffset(

@@ -1,3 +0,3 @@

import type { DragDropManager, SentinelAction } from '../../interfaces'
import { PUBLISH_DRAG_SOURCE } from './types'
import type { DragDropManager, SentinelAction } from '../../interfaces.js'
import { PUBLISH_DRAG_SOURCE } from './types.js'

@@ -4,0 +4,0 @@ export function createPublishDragSource(manager: DragDropManager) {

@@ -1,2 +0,2 @@

import type { Action, SourceIdPayload, TargetIdPayload } from '../interfaces'
import type { Action, SourceIdPayload, TargetIdPayload } from '../interfaces.js'

@@ -3,0 +3,0 @@ export const ADD_SOURCE = 'dnd-core/ADD_SOURCE'

import type { Store, Action } from 'redux'
import type { DragDropMonitorImpl } from './DragDropMonitorImpl'
import type { State } from '../reducers'
import type { DragDropMonitorImpl } from './DragDropMonitorImpl.js'
import type { State } from '../reducers/index.js'
import type {

@@ -11,4 +11,4 @@ ActionCreator,

HandlerRegistry,
} from '../interfaces'
import { createDragDropActions } from '../actions/dragDrop'
} from '../interfaces.js'
import { createDragDropActions } from '../actions/dragDrop/index.js'

@@ -15,0 +15,0 @@ export class DragDropManagerImpl implements DragDropManager {

import type { Store } from 'redux'
import { invariant } from '@react-dnd/invariant'
import { matchesType } from '../utils/matchesType'
import { matchesType } from '../utils/matchesType.js'
import {
getSourceClientOffset,
getDifferenceFromInitialOffset,
} from '../utils/coords'
import { areDirty } from '../utils/dirtiness'
import type { State } from '../reducers'
} from '../utils/coords.js'
import { areDirty } from '../utils/dirtiness.js'
import type { State } from '../reducers/index.js'
import type {

@@ -17,3 +17,3 @@ DragDropMonitor,

Identifier,
} from '../interfaces'
} from '../interfaces.js'

@@ -20,0 +20,0 @@ export class DragDropMonitorImpl implements DragDropMonitor {

@@ -8,5 +8,5 @@ import type { Store } from 'redux'

removeTarget,
} from '../actions/registry'
import { getNextUniqueId } from '../utils/getNextUniqueId'
import type { State } from '../reducers'
} from '../actions/registry.js'
import { getNextUniqueId } from '../utils/getNextUniqueId.js'
import type { State } from '../reducers/index.js'
import {

@@ -20,3 +20,3 @@ DragSource,

HandlerRegistry,
} from '../interfaces'
} from '../interfaces.js'
import {

@@ -26,3 +26,3 @@ validateSourceContract,

validateType,
} from '../contracts'
} from '../contracts.js'
import { asap } from '@react-dnd/asap'

@@ -29,0 +29,0 @@

import { invariant } from '@react-dnd/invariant'
import type { DragSource, DropTarget, Identifier } from './interfaces'
import type { DragSource, DropTarget, Identifier } from './interfaces.js'

@@ -4,0 +4,0 @@ export function validateSourceContract(source: DragSource): void {

@@ -1,7 +0,7 @@

import { DragDropManagerImpl } from './classes/DragDropManagerImpl'
import type { DragDropManager, BackendFactory } from './interfaces'
import { DragDropManagerImpl } from './classes/DragDropManagerImpl.js'
import type { DragDropManager, BackendFactory } from './interfaces.js'
import { createStore, Store } from 'redux'
import { reduce, State } from './reducers'
import { DragDropMonitorImpl } from './classes/DragDropMonitorImpl'
import { HandlerRegistryImpl } from './classes/HandlerRegistryImpl'
import { reduce, State } from './reducers/index.js'
import { DragDropMonitorImpl } from './classes/DragDropMonitorImpl.js'
import { HandlerRegistryImpl } from './classes/HandlerRegistryImpl.js'

@@ -8,0 +8,0 @@ export function createDragDropManager(

@@ -1,2 +0,2 @@

export * from './interfaces'
export * from './createDragDropManager'
export * from './interfaces.js'
export * from './createDragDropManager.js'

@@ -7,3 +7,3 @@ import {

DROP,
} from '../actions/dragDrop'
} from '../actions/dragDrop/index.js'
import {

@@ -14,7 +14,7 @@ ADD_SOURCE,

REMOVE_TARGET,
} from '../actions/registry'
import type { Action } from '../interfaces'
import { areArraysEqual } from '../utils/equality'
import { NONE, ALL } from '../utils/dirtiness'
import { xor } from '../utils/js_utils'
} from '../actions/registry.js'
import type { Action } from '../interfaces.js'
import { areArraysEqual } from '../utils/equality.js'
import { NONE, ALL } from '../utils/dirtiness.js'
import { xor } from '../utils/js_utils.js'

@@ -21,0 +21,0 @@ export type State = string[]

@@ -7,5 +7,5 @@ import {

DROP,
} from '../actions/dragDrop'
import type { XYCoord, Action } from '../interfaces'
import { areCoordsEqual } from '../utils/equality'
} from '../actions/dragDrop/index.js'
import type { XYCoord, Action } from '../interfaces.js'
import { areCoordsEqual } from '../utils/equality.js'

@@ -12,0 +12,0 @@ export interface State {

@@ -7,6 +7,6 @@ import {

DROP,
} from '../actions/dragDrop'
import { REMOVE_TARGET } from '../actions/registry'
import type { Identifier, Action } from '../interfaces'
import { without } from '../utils/js_utils'
} from '../actions/dragDrop/index.js'
import { REMOVE_TARGET } from '../actions/registry.js'
import type { Identifier, Action } from '../interfaces.js'
import { without } from '../utils/js_utils.js'

@@ -13,0 +13,0 @@ export interface State {

@@ -1,14 +0,14 @@

import { reduce as dragOffset, State as DragOffsetState } from './dragOffset'
import { reduce as dragOffset, State as DragOffsetState } from './dragOffset.js'
import {
reduce as dragOperation,
State as DragOperationState,
} from './dragOperation'
import { reduce as refCount, State as RefCountState } from './refCount'
} from './dragOperation.js'
import { reduce as refCount, State as RefCountState } from './refCount.js'
import {
reduce as dirtyHandlerIds,
State as DirtyHandlerIdsState,
} from './dirtyHandlerIds'
import { reduce as stateId, State as StateIdState } from './stateId'
import { get } from '../utils/js_utils'
import type { Action } from '../interfaces'
} from './dirtyHandlerIds.js'
import { reduce as stateId, State as StateIdState } from './stateId.js'
import { get } from '../utils/js_utils.js'
import type { Action } from '../interfaces.js'

@@ -15,0 +15,0 @@ export interface State {

@@ -6,4 +6,4 @@ import {

REMOVE_TARGET,
} from '../actions/registry'
import type { Action } from '../interfaces'
} from '../actions/registry.js'
import type { Action } from '../interfaces.js'

@@ -10,0 +10,0 @@ export type State = number

@@ -1,3 +0,3 @@

import type { State } from '../reducers/dragOffset'
import type { XYCoord } from '..'
import type { State } from '../reducers/dragOffset.js'
import type { XYCoord } from '../interfaces.js'

@@ -4,0 +4,0 @@ /**

@@ -1,2 +0,2 @@

import { intersection } from './js_utils'
import { intersection } from './js_utils.js'

@@ -3,0 +3,0 @@ export const NONE: string[] = []

@@ -1,2 +0,2 @@

import type { XYCoord } from '../interfaces'
import type { XYCoord } from '../interfaces.js'

@@ -3,0 +3,0 @@ export type EqualityCheck<T> = (a: T, b: T) => boolean

@@ -1,2 +0,2 @@

import type { Identifier } from '../interfaces'
import type { Identifier } from '../interfaces.js'

@@ -3,0 +3,0 @@ export function matchesType(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc