Add yet-another-react-lightbox package and update .gitignore to exclude node_modules
This commit is contained in:
22
frontend/node_modules/dnd-core/LICENSE
generated
vendored
22
frontend/node_modules/dnd-core/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Dan Abramov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
34
frontend/node_modules/dnd-core/README.md
generated
vendored
34
frontend/node_modules/dnd-core/README.md
generated
vendored
@@ -1,34 +0,0 @@
|
||||
[](https://www.npmjs.org/package/dnd-core)
|
||||
[](https://travis-ci.org/react-dnd/dnd-core)
|
||||
[](https://codeclimate.com/github/react-dnd/dnd-core)
|
||||
|
||||
# dnd-core
|
||||
|
||||
Drag and Drop stateful engine - no GUI.
|
||||
|
||||
This is a clean implementation of drag and drop primitives that does not depend on the browser.
|
||||
It powers [React DnD](https://github.com/react-dnd/react-dnd) internally.
|
||||
|
||||
## Wat?
|
||||
|
||||
To give you a better idea:
|
||||
|
||||
- There is no DOM here
|
||||
- We let you define drop target and drag source logic
|
||||
- We let you supply custom underlying implementations (console, DOM via jQuery, React, React Native, _whatever_)
|
||||
- We manage drag source and drop target interaction
|
||||
|
||||
This was written to support some rather complicated scenarios that were too hard to implement in [React DnD](https://github.com/react-dnd/react-dnd) due to its current architecture:
|
||||
|
||||
- [Mocking drag and drop interaction in tests](https://github.com/react-dnd/react-dnd/issues/55)
|
||||
- [Full support for arbitrary nesting and handling drag sources and drop targets](https://github.com/react-dnd/react-dnd/issues/87)
|
||||
- [Dragging multiple items at once](https://github.com/react-dnd/react-dnd/issues/14)
|
||||
- [Even when source is removed, letting another drag source “represent it” (e.g. card disappeared from one Kanban list, reappeared in another one)](https://github.com/react-dnd/react-dnd/pull/64#issuecomment-76118757)
|
||||
|
||||
As it turns out, these problems are much easier to solve when DOM is thrown out of the window.
|
||||
|
||||
## What's the API like?
|
||||
|
||||
[Tests](https://github.com/react-dnd/dnd-core/tree/main/test) should give you some idea. You register drag sources and drop targets, connect a backend (you can use barebones `TestBackend` or implement a fancy real one yourself), and your drag sources and drop targets magically begin to interact.
|
||||
|
||||

|
||||
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/beginDrag.d.ts
generated
vendored
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/beginDrag.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import type { Action, BeginDragOptions, BeginDragPayload, DragDropManager, Identifier } from '../../interfaces.js';
|
||||
export declare function createBeginDrag(manager: DragDropManager): (sourceIds?: Identifier[], options?: BeginDragOptions) => Action<BeginDragPayload> | undefined;
|
||||
84
frontend/node_modules/dnd-core/dist/actions/dragDrop/beginDrag.js
generated
vendored
84
frontend/node_modules/dnd-core/dist/actions/dragDrop/beginDrag.js
generated
vendored
@@ -1,84 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { isObject } from '../../utils/js_utils.js';
|
||||
import { setClientOffset } from './local/setClientOffset.js';
|
||||
import { BEGIN_DRAG, INIT_COORDS } from './types.js';
|
||||
const ResetCoordinatesAction = {
|
||||
type: INIT_COORDS,
|
||||
payload: {
|
||||
clientOffset: null,
|
||||
sourceClientOffset: null
|
||||
}
|
||||
};
|
||||
export function createBeginDrag(manager) {
|
||||
return function beginDrag(sourceIds = [], options = {
|
||||
publishSource: true
|
||||
}) {
|
||||
const { publishSource =true , clientOffset , getSourceClientOffset , } = options;
|
||||
const monitor = manager.getMonitor();
|
||||
const registry = manager.getRegistry();
|
||||
// Initialize the coordinates using the client offset
|
||||
manager.dispatch(setClientOffset(clientOffset));
|
||||
verifyInvariants(sourceIds, monitor, registry);
|
||||
// Get the draggable source
|
||||
const sourceId = getDraggableSource(sourceIds, monitor);
|
||||
if (sourceId == null) {
|
||||
manager.dispatch(ResetCoordinatesAction);
|
||||
return;
|
||||
}
|
||||
// Get the source client offset
|
||||
let sourceClientOffset = null;
|
||||
if (clientOffset) {
|
||||
if (!getSourceClientOffset) {
|
||||
throw new Error('getSourceClientOffset must be defined');
|
||||
}
|
||||
verifyGetSourceClientOffsetIsFunction(getSourceClientOffset);
|
||||
sourceClientOffset = getSourceClientOffset(sourceId);
|
||||
}
|
||||
// Initialize the full coordinates
|
||||
manager.dispatch(setClientOffset(clientOffset, sourceClientOffset));
|
||||
const source = registry.getSource(sourceId);
|
||||
const item = source.beginDrag(monitor, sourceId);
|
||||
// If source.beginDrag returns null, this is an indicator to cancel the drag
|
||||
if (item == null) {
|
||||
return undefined;
|
||||
}
|
||||
verifyItemIsObject(item);
|
||||
registry.pinSource(sourceId);
|
||||
const itemType = registry.getSourceType(sourceId);
|
||||
return {
|
||||
type: BEGIN_DRAG,
|
||||
payload: {
|
||||
itemType,
|
||||
item,
|
||||
sourceId,
|
||||
clientOffset: clientOffset || null,
|
||||
sourceClientOffset: sourceClientOffset || null,
|
||||
isSourcePublic: !!publishSource
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function verifyInvariants(sourceIds, monitor, registry) {
|
||||
invariant(!monitor.isDragging(), 'Cannot call beginDrag while dragging.');
|
||||
sourceIds.forEach(function(sourceId) {
|
||||
invariant(registry.getSource(sourceId), 'Expected sourceIds to be registered.');
|
||||
});
|
||||
}
|
||||
function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) {
|
||||
invariant(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.');
|
||||
}
|
||||
function verifyItemIsObject(item) {
|
||||
invariant(isObject(item), 'Item must be an object.');
|
||||
}
|
||||
function getDraggableSource(sourceIds, monitor) {
|
||||
let sourceId = null;
|
||||
for(let i = sourceIds.length - 1; i >= 0; i--){
|
||||
if (monitor.canDragSource(sourceIds[i])) {
|
||||
sourceId = sourceIds[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sourceId;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=beginDrag.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/beginDrag.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/beginDrag.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/drop.d.ts
generated
vendored
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/drop.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import type { DragDropManager } from '../../interfaces.js';
|
||||
export declare function createDrop(manager: DragDropManager): (options?: {}) => void;
|
||||
73
frontend/node_modules/dnd-core/dist/actions/dragDrop/drop.js
generated
vendored
73
frontend/node_modules/dnd-core/dist/actions/dragDrop/drop.js
generated
vendored
@@ -1,73 +0,0 @@
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _objectSpread(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { isObject } from '../../utils/js_utils.js';
|
||||
import { DROP } from './types.js';
|
||||
export function createDrop(manager) {
|
||||
return function drop(options = {}) {
|
||||
const monitor = manager.getMonitor();
|
||||
const registry = manager.getRegistry();
|
||||
verifyInvariants(monitor);
|
||||
const targetIds = getDroppableTargets(monitor);
|
||||
// Multiple actions are dispatched here, which is why this doesn't return an action
|
||||
targetIds.forEach((targetId, index)=>{
|
||||
const dropResult = determineDropResult(targetId, index, registry, monitor);
|
||||
const action = {
|
||||
type: DROP,
|
||||
payload: {
|
||||
dropResult: _objectSpread({}, options, dropResult)
|
||||
}
|
||||
};
|
||||
manager.dispatch(action);
|
||||
});
|
||||
};
|
||||
}
|
||||
function verifyInvariants(monitor) {
|
||||
invariant(monitor.isDragging(), 'Cannot call drop while not dragging.');
|
||||
invariant(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.');
|
||||
}
|
||||
function determineDropResult(targetId, index, registry, monitor) {
|
||||
const target = registry.getTarget(targetId);
|
||||
let dropResult = target ? target.drop(monitor, targetId) : undefined;
|
||||
verifyDropResultType(dropResult);
|
||||
if (typeof dropResult === 'undefined') {
|
||||
dropResult = index === 0 ? {} : monitor.getDropResult();
|
||||
}
|
||||
return dropResult;
|
||||
}
|
||||
function verifyDropResultType(dropResult) {
|
||||
invariant(typeof dropResult === 'undefined' || isObject(dropResult), 'Drop result must either be an object or undefined.');
|
||||
}
|
||||
function getDroppableTargets(monitor) {
|
||||
const targetIds = monitor.getTargetIds().filter(monitor.canDropOnTarget, monitor);
|
||||
targetIds.reverse();
|
||||
return targetIds;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=drop.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/drop.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/drop.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../../src/actions/dragDrop/drop.ts"],"sourcesContent":["import { invariant } from '@react-dnd/invariant'\n\nimport type {\n\tAction,\n\tDragDropManager,\n\tDragDropMonitor,\n\tDropPayload,\n\tHandlerRegistry,\n\tIdentifier,\n} from '../../interfaces.js'\nimport { isObject } from '../../utils/js_utils.js'\nimport { DROP } from './types.js'\n\nexport function createDrop(manager: DragDropManager) {\n\treturn function drop(options = {}): void {\n\t\tconst monitor = manager.getMonitor()\n\t\tconst registry = manager.getRegistry()\n\t\tverifyInvariants(monitor)\n\t\tconst targetIds = getDroppableTargets(monitor)\n\n\t\t// Multiple actions are dispatched here, which is why this doesn't return an action\n\t\ttargetIds.forEach((targetId, index) => {\n\t\t\tconst dropResult = determineDropResult(targetId, index, registry, monitor)\n\t\t\tconst action: Action<DropPayload> = {\n\t\t\t\ttype: DROP,\n\t\t\t\tpayload: {\n\t\t\t\t\tdropResult: {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\t...dropResult,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\t\t\tmanager.dispatch(action)\n\t\t})\n\t}\n}\n\nfunction verifyInvariants(monitor: DragDropMonitor) {\n\tinvariant(monitor.isDragging(), 'Cannot call drop while not dragging.')\n\tinvariant(\n\t\t!monitor.didDrop(),\n\t\t'Cannot call drop twice during one drag operation.',\n\t)\n}\n\nfunction determineDropResult(\n\ttargetId: Identifier,\n\tindex: number,\n\tregistry: HandlerRegistry,\n\tmonitor: DragDropMonitor,\n) {\n\tconst target = registry.getTarget(targetId)\n\tlet dropResult = target ? target.drop(monitor, targetId) : undefined\n\tverifyDropResultType(dropResult)\n\tif (typeof dropResult === 'undefined') {\n\t\tdropResult = index === 0 ? {} : monitor.getDropResult()\n\t}\n\treturn dropResult\n}\n\nfunction verifyDropResultType(dropResult: any) {\n\tinvariant(\n\t\ttypeof dropResult === 'undefined' || isObject(dropResult),\n\t\t'Drop result must either be an object or undefined.',\n\t)\n}\n\nfunction getDroppableTargets(monitor: DragDropMonitor) {\n\tconst targetIds = monitor\n\t\t.getTargetIds()\n\t\t.filter(monitor.canDropOnTarget, monitor)\n\ttargetIds.reverse()\n\treturn targetIds\n}\n"],"names":["invariant","isObject","DROP","createDrop","manager","drop","options","monitor","getMonitor","registry","getRegistry","verifyInvariants","targetIds","getDroppableTargets","forEach","targetId","index","dropResult","determineDropResult","action","type","payload","dispatch","isDragging","didDrop","target","getTarget","undefined","verifyDropResultType","getDropResult","getTargetIds","filter","canDropOnTarget","reverse"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,SAAS,QAAQ,sBAAsB,CAAA;AAUhD,SAASC,QAAQ,QAAQ,yBAAyB,CAAA;AAClD,SAASC,IAAI,QAAQ,YAAY,CAAA;AAEjC,OAAO,SAASC,UAAU,CAACC,OAAwB,EAAE;IACpD,OAAO,SAASC,IAAI,CAACC,OAAO,GAAG,EAAE,EAAQ;QACxC,MAAMC,OAAO,GAAGH,OAAO,CAACI,UAAU,EAAE;QACpC,MAAMC,QAAQ,GAAGL,OAAO,CAACM,WAAW,EAAE;QACtCC,gBAAgB,CAACJ,OAAO,CAAC;QACzB,MAAMK,SAAS,GAAGC,mBAAmB,CAACN,OAAO,CAAC;QAE9C,mFAAmF;QACnFK,SAAS,CAACE,OAAO,CAAC,CAACC,QAAQ,EAAEC,KAAK,GAAK;YACtC,MAAMC,UAAU,GAAGC,mBAAmB,CAACH,QAAQ,EAAEC,KAAK,EAAEP,QAAQ,EAAEF,OAAO,CAAC;YAC1E,MAAMY,MAAM,GAAwB;gBACnCC,IAAI,EAAElB,IAAI;gBACVmB,OAAO,EAAE;oBACRJ,UAAU,EAAE,kBACRX,OAAO,EACPW,UAAU,CACb;iBACD;aACD;YACDb,OAAO,CAACkB,QAAQ,CAACH,MAAM,CAAC;SACxB,CAAC;KACF,CAAA;CACD;AAED,SAASR,gBAAgB,CAACJ,OAAwB,EAAE;IACnDP,SAAS,CAACO,OAAO,CAACgB,UAAU,EAAE,EAAE,sCAAsC,CAAC;IACvEvB,SAAS,CACR,CAACO,OAAO,CAACiB,OAAO,EAAE,EAClB,mDAAmD,CACnD;CACD;AAED,SAASN,mBAAmB,CAC3BH,QAAoB,EACpBC,KAAa,EACbP,QAAyB,EACzBF,OAAwB,EACvB;IACD,MAAMkB,MAAM,GAAGhB,QAAQ,CAACiB,SAAS,CAACX,QAAQ,CAAC;IAC3C,IAAIE,UAAU,GAAGQ,MAAM,GAAGA,MAAM,CAACpB,IAAI,CAACE,OAAO,EAAEQ,QAAQ,CAAC,GAAGY,SAAS;IACpEC,oBAAoB,CAACX,UAAU,CAAC;IAChC,IAAI,OAAOA,UAAU,KAAK,WAAW,EAAE;QACtCA,UAAU,GAAGD,KAAK,KAAK,CAAC,GAAG,EAAE,GAAGT,OAAO,CAACsB,aAAa,EAAE;KACvD;IACD,OAAOZ,UAAU,CAAA;CACjB;AAED,SAASW,oBAAoB,CAACX,UAAe,EAAE;IAC9CjB,SAAS,CACR,OAAOiB,UAAU,KAAK,WAAW,IAAIhB,QAAQ,CAACgB,UAAU,CAAC,EACzD,oDAAoD,CACpD;CACD;AAED,SAASJ,mBAAmB,CAACN,OAAwB,EAAE;IACtD,MAAMK,SAAS,GAAGL,OAAO,CACvBuB,YAAY,EAAE,CACdC,MAAM,CAACxB,OAAO,CAACyB,eAAe,EAAEzB,OAAO,CAAC;IAC1CK,SAAS,CAACqB,OAAO,EAAE;IACnB,OAAOrB,SAAS,CAAA;CAChB"}
|
||||
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/endDrag.d.ts
generated
vendored
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/endDrag.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import type { DragDropManager, SentinelAction } from '../../interfaces.js';
|
||||
export declare function createEndDrag(manager: DragDropManager): () => SentinelAction;
|
||||
23
frontend/node_modules/dnd-core/dist/actions/dragDrop/endDrag.js
generated
vendored
23
frontend/node_modules/dnd-core/dist/actions/dragDrop/endDrag.js
generated
vendored
@@ -1,23 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { END_DRAG } from './types.js';
|
||||
export function createEndDrag(manager) {
|
||||
return function endDrag() {
|
||||
const monitor = manager.getMonitor();
|
||||
const registry = manager.getRegistry();
|
||||
verifyIsDragging(monitor);
|
||||
const sourceId = monitor.getSourceId();
|
||||
if (sourceId != null) {
|
||||
const source = registry.getSource(sourceId, true);
|
||||
source.endDrag(monitor, sourceId);
|
||||
registry.unpinSource();
|
||||
}
|
||||
return {
|
||||
type: END_DRAG
|
||||
};
|
||||
};
|
||||
}
|
||||
function verifyIsDragging(monitor) {
|
||||
invariant(monitor.isDragging(), 'Cannot call endDrag while not dragging.');
|
||||
}
|
||||
|
||||
//# sourceMappingURL=endDrag.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/endDrag.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/endDrag.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../../src/actions/dragDrop/endDrag.ts"],"sourcesContent":["import { invariant } from '@react-dnd/invariant'\n\nimport type {\n\tDragDropManager,\n\tDragDropMonitor,\n\tSentinelAction,\n} from '../../interfaces.js'\nimport { END_DRAG } from './types.js'\n\nexport function createEndDrag(manager: DragDropManager) {\n\treturn function endDrag(): SentinelAction {\n\t\tconst monitor = manager.getMonitor()\n\t\tconst registry = manager.getRegistry()\n\t\tverifyIsDragging(monitor)\n\n\t\tconst sourceId = monitor.getSourceId()\n\t\tif (sourceId != null) {\n\t\t\tconst source = registry.getSource(sourceId, true)\n\t\t\tsource.endDrag(monitor, sourceId)\n\t\t\tregistry.unpinSource()\n\t\t}\n\t\treturn { type: END_DRAG }\n\t}\n}\n\nfunction verifyIsDragging(monitor: DragDropMonitor) {\n\tinvariant(monitor.isDragging(), 'Cannot call endDrag while not dragging.')\n}\n"],"names":["invariant","END_DRAG","createEndDrag","manager","endDrag","monitor","getMonitor","registry","getRegistry","verifyIsDragging","sourceId","getSourceId","source","getSource","unpinSource","type","isDragging"],"mappings":"AAAA,SAASA,SAAS,QAAQ,sBAAsB,CAAA;AAOhD,SAASC,QAAQ,QAAQ,YAAY,CAAA;AAErC,OAAO,SAASC,aAAa,CAACC,OAAwB,EAAE;IACvD,OAAO,SAASC,OAAO,GAAmB;QACzC,MAAMC,OAAO,GAAGF,OAAO,CAACG,UAAU,EAAE;QACpC,MAAMC,QAAQ,GAAGJ,OAAO,CAACK,WAAW,EAAE;QACtCC,gBAAgB,CAACJ,OAAO,CAAC;QAEzB,MAAMK,QAAQ,GAAGL,OAAO,CAACM,WAAW,EAAE;QACtC,IAAID,QAAQ,IAAI,IAAI,EAAE;YACrB,MAAME,MAAM,GAAGL,QAAQ,CAACM,SAAS,CAACH,QAAQ,EAAE,IAAI,CAAC;YACjDE,MAAM,CAACR,OAAO,CAACC,OAAO,EAAEK,QAAQ,CAAC;YACjCH,QAAQ,CAACO,WAAW,EAAE;SACtB;QACD,OAAO;YAAEC,IAAI,EAAEd,QAAQ;SAAE,CAAA;KACzB,CAAA;CACD;AAED,SAASQ,gBAAgB,CAACJ,OAAwB,EAAE;IACnDL,SAAS,CAACK,OAAO,CAACW,UAAU,EAAE,EAAE,yCAAyC,CAAC;CAC1E"}
|
||||
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/hover.d.ts
generated
vendored
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/hover.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import type { Action, DragDropManager, HoverOptions, HoverPayload } from '../../interfaces.js';
|
||||
export declare function createHover(manager: DragDropManager): (targetIdsArg: string[], { clientOffset }?: HoverOptions) => Action<HoverPayload>;
|
||||
56
frontend/node_modules/dnd-core/dist/actions/dragDrop/hover.js
generated
vendored
56
frontend/node_modules/dnd-core/dist/actions/dragDrop/hover.js
generated
vendored
@@ -1,56 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { matchesType } from '../../utils/matchesType.js';
|
||||
import { HOVER } from './types.js';
|
||||
export function createHover(manager) {
|
||||
return function hover(targetIdsArg, { clientOffset } = {}) {
|
||||
verifyTargetIdsIsArray(targetIdsArg);
|
||||
const targetIds = targetIdsArg.slice(0);
|
||||
const monitor = manager.getMonitor();
|
||||
const registry = manager.getRegistry();
|
||||
const draggedItemType = monitor.getItemType();
|
||||
removeNonMatchingTargetIds(targetIds, registry, draggedItemType);
|
||||
checkInvariants(targetIds, monitor, registry);
|
||||
hoverAllTargets(targetIds, monitor, registry);
|
||||
return {
|
||||
type: HOVER,
|
||||
payload: {
|
||||
targetIds,
|
||||
clientOffset: clientOffset || null
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
function verifyTargetIdsIsArray(targetIdsArg) {
|
||||
invariant(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.');
|
||||
}
|
||||
function checkInvariants(targetIds, monitor, registry) {
|
||||
invariant(monitor.isDragging(), 'Cannot call hover while not dragging.');
|
||||
invariant(!monitor.didDrop(), 'Cannot call hover after drop.');
|
||||
for(let i = 0; i < targetIds.length; i++){
|
||||
const targetId = targetIds[i];
|
||||
invariant(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.');
|
||||
const target = registry.getTarget(targetId);
|
||||
invariant(target, 'Expected targetIds to be registered.');
|
||||
}
|
||||
}
|
||||
function removeNonMatchingTargetIds(targetIds, registry, draggedItemType) {
|
||||
// Remove those targetIds that don't match the targetType. This
|
||||
// fixes shallow isOver which would only be non-shallow because of
|
||||
// non-matching targets.
|
||||
for(let i = targetIds.length - 1; i >= 0; i--){
|
||||
const targetId = targetIds[i];
|
||||
const targetType = registry.getTargetType(targetId);
|
||||
if (!matchesType(targetType, draggedItemType)) {
|
||||
targetIds.splice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function hoverAllTargets(targetIds, monitor, registry) {
|
||||
// Finally call hover on all matching targets.
|
||||
targetIds.forEach(function(targetId) {
|
||||
const target = registry.getTarget(targetId);
|
||||
target.hover(monitor, targetId);
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=hover.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/hover.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/hover.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
frontend/node_modules/dnd-core/dist/actions/dragDrop/index.d.ts
generated
vendored
3
frontend/node_modules/dnd-core/dist/actions/dragDrop/index.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import type { DragDropActions, DragDropManager } from '../../interfaces.js';
|
||||
export * from './types.js';
|
||||
export declare function createDragDropActions(manager: DragDropManager): DragDropActions;
|
||||
17
frontend/node_modules/dnd-core/dist/actions/dragDrop/index.js
generated
vendored
17
frontend/node_modules/dnd-core/dist/actions/dragDrop/index.js
generated
vendored
@@ -1,17 +0,0 @@
|
||||
import { createBeginDrag } from './beginDrag.js';
|
||||
import { createDrop } from './drop.js';
|
||||
import { createEndDrag } from './endDrag.js';
|
||||
import { createHover } from './hover.js';
|
||||
import { createPublishDragSource } from './publishDragSource.js';
|
||||
export * from './types.js';
|
||||
export function createDragDropActions(manager) {
|
||||
return {
|
||||
beginDrag: createBeginDrag(manager),
|
||||
publishDragSource: createPublishDragSource(manager),
|
||||
hover: createHover(manager),
|
||||
drop: createDrop(manager),
|
||||
endDrag: createEndDrag(manager)
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/index.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/index.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../../src/actions/dragDrop/index.ts"],"sourcesContent":["import type { DragDropActions, DragDropManager } from '../../interfaces.js'\nimport { createBeginDrag } from './beginDrag.js'\nimport { createDrop } from './drop.js'\nimport { createEndDrag } from './endDrag.js'\nimport { createHover } from './hover.js'\nimport { createPublishDragSource } from './publishDragSource.js'\n\nexport * from './types.js'\n\nexport function createDragDropActions(\n\tmanager: DragDropManager,\n): DragDropActions {\n\treturn {\n\t\tbeginDrag: createBeginDrag(manager),\n\t\tpublishDragSource: createPublishDragSource(manager),\n\t\thover: createHover(manager),\n\t\tdrop: createDrop(manager),\n\t\tendDrag: createEndDrag(manager),\n\t}\n}\n"],"names":["createBeginDrag","createDrop","createEndDrag","createHover","createPublishDragSource","createDragDropActions","manager","beginDrag","publishDragSource","hover","drop","endDrag"],"mappings":"AACA,SAASA,eAAe,QAAQ,gBAAgB,CAAA;AAChD,SAASC,UAAU,QAAQ,WAAW,CAAA;AACtC,SAASC,aAAa,QAAQ,cAAc,CAAA;AAC5C,SAASC,WAAW,QAAQ,YAAY,CAAA;AACxC,SAASC,uBAAuB,QAAQ,wBAAwB,CAAA;AAEhE,cAAc,YAAY,CAAA;AAE1B,OAAO,SAASC,qBAAqB,CACpCC,OAAwB,EACN;IAClB,OAAO;QACNC,SAAS,EAAEP,eAAe,CAACM,OAAO,CAAC;QACnCE,iBAAiB,EAAEJ,uBAAuB,CAACE,OAAO,CAAC;QACnDG,KAAK,EAAEN,WAAW,CAACG,OAAO,CAAC;QAC3BI,IAAI,EAAET,UAAU,CAACK,OAAO,CAAC;QACzBK,OAAO,EAAET,aAAa,CAACI,OAAO,CAAC;KAC/B,CAAA;CACD"}
|
||||
3
frontend/node_modules/dnd-core/dist/actions/dragDrop/local/setClientOffset.d.ts
generated
vendored
3
frontend/node_modules/dnd-core/dist/actions/dragDrop/local/setClientOffset.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import type { AnyAction } from 'redux';
|
||||
import type { XYCoord } from '../../../interfaces.js';
|
||||
export declare function setClientOffset(clientOffset: XYCoord | null | undefined, sourceClientOffset?: XYCoord | null | undefined): AnyAction;
|
||||
12
frontend/node_modules/dnd-core/dist/actions/dragDrop/local/setClientOffset.js
generated
vendored
12
frontend/node_modules/dnd-core/dist/actions/dragDrop/local/setClientOffset.js
generated
vendored
@@ -1,12 +0,0 @@
|
||||
import { INIT_COORDS } from '../types.js';
|
||||
export function setClientOffset(clientOffset, sourceClientOffset) {
|
||||
return {
|
||||
type: INIT_COORDS,
|
||||
payload: {
|
||||
sourceClientOffset: sourceClientOffset || null,
|
||||
clientOffset: clientOffset || null
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=setClientOffset.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/local/setClientOffset.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/local/setClientOffset.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../../../src/actions/dragDrop/local/setClientOffset.ts"],"sourcesContent":["import type { AnyAction } from 'redux'\n\nimport type { XYCoord } from '../../../interfaces.js'\nimport { INIT_COORDS } from '../types.js'\n\nexport function setClientOffset(\n\tclientOffset: XYCoord | null | undefined,\n\tsourceClientOffset?: XYCoord | null | undefined,\n): AnyAction {\n\treturn {\n\t\ttype: INIT_COORDS,\n\t\tpayload: {\n\t\t\tsourceClientOffset: sourceClientOffset || null,\n\t\t\tclientOffset: clientOffset || null,\n\t\t},\n\t}\n}\n"],"names":["INIT_COORDS","setClientOffset","clientOffset","sourceClientOffset","type","payload"],"mappings":"AAGA,SAASA,WAAW,QAAQ,aAAa,CAAA;AAEzC,OAAO,SAASC,eAAe,CAC9BC,YAAwC,EACxCC,kBAA+C,EACnC;IACZ,OAAO;QACNC,IAAI,EAAEJ,WAAW;QACjBK,OAAO,EAAE;YACRF,kBAAkB,EAAEA,kBAAkB,IAAI,IAAI;YAC9CD,YAAY,EAAEA,YAAY,IAAI,IAAI;SAClC;KACD,CAAA;CACD"}
|
||||
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/publishDragSource.d.ts
generated
vendored
2
frontend/node_modules/dnd-core/dist/actions/dragDrop/publishDragSource.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import type { DragDropManager, SentinelAction } from '../../interfaces.js';
|
||||
export declare function createPublishDragSource(manager: DragDropManager): () => SentinelAction | undefined;
|
||||
14
frontend/node_modules/dnd-core/dist/actions/dragDrop/publishDragSource.js
generated
vendored
14
frontend/node_modules/dnd-core/dist/actions/dragDrop/publishDragSource.js
generated
vendored
@@ -1,14 +0,0 @@
|
||||
import { PUBLISH_DRAG_SOURCE } from './types.js';
|
||||
export function createPublishDragSource(manager) {
|
||||
return function publishDragSource() {
|
||||
const monitor = manager.getMonitor();
|
||||
if (monitor.isDragging()) {
|
||||
return {
|
||||
type: PUBLISH_DRAG_SOURCE
|
||||
};
|
||||
}
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=publishDragSource.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/publishDragSource.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/publishDragSource.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../../src/actions/dragDrop/publishDragSource.ts"],"sourcesContent":["import type { DragDropManager, SentinelAction } from '../../interfaces.js'\nimport { PUBLISH_DRAG_SOURCE } from './types.js'\n\nexport function createPublishDragSource(manager: DragDropManager) {\n\treturn function publishDragSource(): SentinelAction | undefined {\n\t\tconst monitor = manager.getMonitor()\n\t\tif (monitor.isDragging()) {\n\t\t\treturn { type: PUBLISH_DRAG_SOURCE }\n\t\t}\n\t\treturn\n\t}\n}\n"],"names":["PUBLISH_DRAG_SOURCE","createPublishDragSource","manager","publishDragSource","monitor","getMonitor","isDragging","type"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,YAAY,CAAA;AAEhD,OAAO,SAASC,uBAAuB,CAACC,OAAwB,EAAE;IACjE,OAAO,SAASC,iBAAiB,GAA+B;QAC/D,MAAMC,OAAO,GAAGF,OAAO,CAACG,UAAU,EAAE;QACpC,IAAID,OAAO,CAACE,UAAU,EAAE,EAAE;YACzB,OAAO;gBAAEC,IAAI,EAAEP,mBAAmB;aAAE,CAAA;SACpC;QACD,OAAM;KACN,CAAA;CACD"}
|
||||
6
frontend/node_modules/dnd-core/dist/actions/dragDrop/types.d.ts
generated
vendored
6
frontend/node_modules/dnd-core/dist/actions/dragDrop/types.d.ts
generated
vendored
@@ -1,6 +0,0 @@
|
||||
export declare const INIT_COORDS = "dnd-core/INIT_COORDS";
|
||||
export declare const BEGIN_DRAG = "dnd-core/BEGIN_DRAG";
|
||||
export declare const PUBLISH_DRAG_SOURCE = "dnd-core/PUBLISH_DRAG_SOURCE";
|
||||
export declare const HOVER = "dnd-core/HOVER";
|
||||
export declare const DROP = "dnd-core/DROP";
|
||||
export declare const END_DRAG = "dnd-core/END_DRAG";
|
||||
8
frontend/node_modules/dnd-core/dist/actions/dragDrop/types.js
generated
vendored
8
frontend/node_modules/dnd-core/dist/actions/dragDrop/types.js
generated
vendored
@@ -1,8 +0,0 @@
|
||||
export const INIT_COORDS = 'dnd-core/INIT_COORDS';
|
||||
export const BEGIN_DRAG = 'dnd-core/BEGIN_DRAG';
|
||||
export const PUBLISH_DRAG_SOURCE = 'dnd-core/PUBLISH_DRAG_SOURCE';
|
||||
export const HOVER = 'dnd-core/HOVER';
|
||||
export const DROP = 'dnd-core/DROP';
|
||||
export const END_DRAG = 'dnd-core/END_DRAG';
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/types.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/actions/dragDrop/types.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../../src/actions/dragDrop/types.ts"],"sourcesContent":["export const INIT_COORDS = 'dnd-core/INIT_COORDS'\nexport const BEGIN_DRAG = 'dnd-core/BEGIN_DRAG'\nexport const PUBLISH_DRAG_SOURCE = 'dnd-core/PUBLISH_DRAG_SOURCE'\nexport const HOVER = 'dnd-core/HOVER'\nexport const DROP = 'dnd-core/DROP'\nexport const END_DRAG = 'dnd-core/END_DRAG'\n"],"names":["INIT_COORDS","BEGIN_DRAG","PUBLISH_DRAG_SOURCE","HOVER","DROP","END_DRAG"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG,sBAAsB,CAAA;AACjD,OAAO,MAAMC,UAAU,GAAG,qBAAqB,CAAA;AAC/C,OAAO,MAAMC,mBAAmB,GAAG,8BAA8B,CAAA;AACjE,OAAO,MAAMC,KAAK,GAAG,gBAAgB,CAAA;AACrC,OAAO,MAAMC,IAAI,GAAG,eAAe,CAAA;AACnC,OAAO,MAAMC,QAAQ,GAAG,mBAAmB,CAAA"}
|
||||
9
frontend/node_modules/dnd-core/dist/actions/registry.d.ts
generated
vendored
9
frontend/node_modules/dnd-core/dist/actions/registry.d.ts
generated
vendored
@@ -1,9 +0,0 @@
|
||||
import type { Action, SourceIdPayload, TargetIdPayload } from '../interfaces.js';
|
||||
export declare const ADD_SOURCE = "dnd-core/ADD_SOURCE";
|
||||
export declare const ADD_TARGET = "dnd-core/ADD_TARGET";
|
||||
export declare const REMOVE_SOURCE = "dnd-core/REMOVE_SOURCE";
|
||||
export declare const REMOVE_TARGET = "dnd-core/REMOVE_TARGET";
|
||||
export declare function addSource(sourceId: string): Action<SourceIdPayload>;
|
||||
export declare function addTarget(targetId: string): Action<TargetIdPayload>;
|
||||
export declare function removeSource(sourceId: string): Action<SourceIdPayload>;
|
||||
export declare function removeTarget(targetId: string): Action<TargetIdPayload>;
|
||||
38
frontend/node_modules/dnd-core/dist/actions/registry.js
generated
vendored
38
frontend/node_modules/dnd-core/dist/actions/registry.js
generated
vendored
@@ -1,38 +0,0 @@
|
||||
export const ADD_SOURCE = 'dnd-core/ADD_SOURCE';
|
||||
export const ADD_TARGET = 'dnd-core/ADD_TARGET';
|
||||
export const REMOVE_SOURCE = 'dnd-core/REMOVE_SOURCE';
|
||||
export const REMOVE_TARGET = 'dnd-core/REMOVE_TARGET';
|
||||
export function addSource(sourceId) {
|
||||
return {
|
||||
type: ADD_SOURCE,
|
||||
payload: {
|
||||
sourceId
|
||||
}
|
||||
};
|
||||
}
|
||||
export function addTarget(targetId) {
|
||||
return {
|
||||
type: ADD_TARGET,
|
||||
payload: {
|
||||
targetId
|
||||
}
|
||||
};
|
||||
}
|
||||
export function removeSource(sourceId) {
|
||||
return {
|
||||
type: REMOVE_SOURCE,
|
||||
payload: {
|
||||
sourceId
|
||||
}
|
||||
};
|
||||
}
|
||||
export function removeTarget(targetId) {
|
||||
return {
|
||||
type: REMOVE_TARGET,
|
||||
payload: {
|
||||
targetId
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=registry.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/actions/registry.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/actions/registry.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/actions/registry.ts"],"sourcesContent":["import type { Action, SourceIdPayload, TargetIdPayload } from '../interfaces.js'\n\nexport const ADD_SOURCE = 'dnd-core/ADD_SOURCE'\nexport const ADD_TARGET = 'dnd-core/ADD_TARGET'\nexport const REMOVE_SOURCE = 'dnd-core/REMOVE_SOURCE'\nexport const REMOVE_TARGET = 'dnd-core/REMOVE_TARGET'\n\nexport function addSource(sourceId: string): Action<SourceIdPayload> {\n\treturn {\n\t\ttype: ADD_SOURCE,\n\t\tpayload: {\n\t\t\tsourceId,\n\t\t},\n\t}\n}\n\nexport function addTarget(targetId: string): Action<TargetIdPayload> {\n\treturn {\n\t\ttype: ADD_TARGET,\n\t\tpayload: {\n\t\t\ttargetId,\n\t\t},\n\t}\n}\n\nexport function removeSource(sourceId: string): Action<SourceIdPayload> {\n\treturn {\n\t\ttype: REMOVE_SOURCE,\n\t\tpayload: {\n\t\t\tsourceId,\n\t\t},\n\t}\n}\n\nexport function removeTarget(targetId: string): Action<TargetIdPayload> {\n\treturn {\n\t\ttype: REMOVE_TARGET,\n\t\tpayload: {\n\t\t\ttargetId,\n\t\t},\n\t}\n}\n"],"names":["ADD_SOURCE","ADD_TARGET","REMOVE_SOURCE","REMOVE_TARGET","addSource","sourceId","type","payload","addTarget","targetId","removeSource","removeTarget"],"mappings":"AAEA,OAAO,MAAMA,UAAU,GAAG,qBAAqB,CAAA;AAC/C,OAAO,MAAMC,UAAU,GAAG,qBAAqB,CAAA;AAC/C,OAAO,MAAMC,aAAa,GAAG,wBAAwB,CAAA;AACrD,OAAO,MAAMC,aAAa,GAAG,wBAAwB,CAAA;AAErD,OAAO,SAASC,SAAS,CAACC,QAAgB,EAA2B;IACpE,OAAO;QACNC,IAAI,EAAEN,UAAU;QAChBO,OAAO,EAAE;YACRF,QAAQ;SACR;KACD,CAAA;CACD;AAED,OAAO,SAASG,SAAS,CAACC,QAAgB,EAA2B;IACpE,OAAO;QACNH,IAAI,EAAEL,UAAU;QAChBM,OAAO,EAAE;YACRE,QAAQ;SACR;KACD,CAAA;CACD;AAED,OAAO,SAASC,YAAY,CAACL,QAAgB,EAA2B;IACvE,OAAO;QACNC,IAAI,EAAEJ,aAAa;QACnBK,OAAO,EAAE;YACRF,QAAQ;SACR;KACD,CAAA;CACD;AAED,OAAO,SAASM,YAAY,CAACF,QAAgB,EAA2B;IACvE,OAAO;QACNH,IAAI,EAAEH,aAAa;QACnBI,OAAO,EAAE;YACRE,QAAQ;SACR;KACD,CAAA;CACD"}
|
||||
17
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.d.ts
generated
vendored
17
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.d.ts
generated
vendored
@@ -1,17 +0,0 @@
|
||||
import type { Action, Store } from 'redux';
|
||||
import type { Backend, DragDropActions, DragDropManager, DragDropMonitor, HandlerRegistry } from '../interfaces.js';
|
||||
import type { State } from '../reducers/index.js';
|
||||
export declare class DragDropManagerImpl implements DragDropManager {
|
||||
private store;
|
||||
private monitor;
|
||||
private backend;
|
||||
private isSetUp;
|
||||
constructor(store: Store<State>, monitor: DragDropMonitor);
|
||||
receiveBackend(backend: Backend): void;
|
||||
getMonitor(): DragDropMonitor;
|
||||
getBackend(): Backend;
|
||||
getRegistry(): HandlerRegistry;
|
||||
getActions(): DragDropActions;
|
||||
dispatch(action: Action<any>): void;
|
||||
private handleRefCountChange;
|
||||
}
|
||||
56
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.js
generated
vendored
56
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.js
generated
vendored
@@ -1,56 +0,0 @@
|
||||
import { createDragDropActions } from '../actions/dragDrop/index.js';
|
||||
export class DragDropManagerImpl {
|
||||
receiveBackend(backend) {
|
||||
this.backend = backend;
|
||||
}
|
||||
getMonitor() {
|
||||
return this.monitor;
|
||||
}
|
||||
getBackend() {
|
||||
return this.backend;
|
||||
}
|
||||
getRegistry() {
|
||||
return this.monitor.registry;
|
||||
}
|
||||
getActions() {
|
||||
/* eslint-disable-next-line @typescript-eslint/no-this-alias */ const manager = this;
|
||||
const { dispatch } = this.store;
|
||||
function bindActionCreator(actionCreator) {
|
||||
return (...args)=>{
|
||||
const action = actionCreator.apply(manager, args);
|
||||
if (typeof action !== 'undefined') {
|
||||
dispatch(action);
|
||||
}
|
||||
};
|
||||
}
|
||||
const actions = createDragDropActions(this);
|
||||
return Object.keys(actions).reduce((boundActions, key)=>{
|
||||
const action = actions[key];
|
||||
boundActions[key] = bindActionCreator(action);
|
||||
return boundActions;
|
||||
}, {});
|
||||
}
|
||||
dispatch(action) {
|
||||
this.store.dispatch(action);
|
||||
}
|
||||
constructor(store, monitor){
|
||||
this.isSetUp = false;
|
||||
this.handleRefCountChange = ()=>{
|
||||
const shouldSetUp = this.store.getState().refCount > 0;
|
||||
if (this.backend) {
|
||||
if (shouldSetUp && !this.isSetUp) {
|
||||
this.backend.setup();
|
||||
this.isSetUp = true;
|
||||
} else if (!shouldSetUp && this.isSetUp) {
|
||||
this.backend.teardown();
|
||||
this.isSetUp = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
this.store = store;
|
||||
this.monitor = monitor;
|
||||
store.subscribe(this.handleRefCountChange);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=DragDropManagerImpl.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/classes/DragDropManagerImpl.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/classes/DragDropManagerImpl.ts"],"sourcesContent":["import type { Action, Store } from 'redux'\n\nimport { createDragDropActions } from '../actions/dragDrop/index.js'\nimport type {\n\tActionCreator,\n\tBackend,\n\tDragDropActions,\n\tDragDropManager,\n\tDragDropMonitor,\n\tHandlerRegistry,\n} from '../interfaces.js'\nimport type { State } from '../reducers/index.js'\nimport type { DragDropMonitorImpl } from './DragDropMonitorImpl.js'\n\nexport class DragDropManagerImpl implements DragDropManager {\n\tprivate store: Store<State>\n\tprivate monitor: DragDropMonitor\n\tprivate backend: Backend | undefined\n\tprivate isSetUp = false\n\n\tpublic constructor(store: Store<State>, monitor: DragDropMonitor) {\n\t\tthis.store = store\n\t\tthis.monitor = monitor\n\t\tstore.subscribe(this.handleRefCountChange)\n\t}\n\n\tpublic receiveBackend(backend: Backend): void {\n\t\tthis.backend = backend\n\t}\n\n\tpublic getMonitor(): DragDropMonitor {\n\t\treturn this.monitor\n\t}\n\n\tpublic getBackend(): Backend {\n\t\treturn this.backend as Backend\n\t}\n\n\tpublic getRegistry(): HandlerRegistry {\n\t\treturn (this.monitor as DragDropMonitorImpl).registry\n\t}\n\n\tpublic getActions(): DragDropActions {\n\t\t/* eslint-disable-next-line @typescript-eslint/no-this-alias */\n\t\tconst manager = this\n\t\tconst { dispatch } = this.store\n\n\t\tfunction bindActionCreator(actionCreator: ActionCreator<any>) {\n\t\t\treturn (...args: any[]) => {\n\t\t\t\tconst action = actionCreator.apply(manager, args as any)\n\t\t\t\tif (typeof action !== 'undefined') {\n\t\t\t\t\tdispatch(action)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst actions = createDragDropActions(this)\n\n\t\treturn Object.keys(actions).reduce(\n\t\t\t(boundActions: DragDropActions, key: string) => {\n\t\t\t\tconst action: ActionCreator<any> = (actions as any)[\n\t\t\t\t\tkey\n\t\t\t\t] as ActionCreator<any>\n\t\t\t\t;(boundActions as any)[key] = bindActionCreator(action)\n\t\t\t\treturn boundActions\n\t\t\t},\n\t\t\t{} as DragDropActions,\n\t\t)\n\t}\n\n\tpublic dispatch(action: Action<any>): void {\n\t\tthis.store.dispatch(action)\n\t}\n\n\tprivate handleRefCountChange = (): void => {\n\t\tconst shouldSetUp = this.store.getState().refCount > 0\n\t\tif (this.backend) {\n\t\t\tif (shouldSetUp && !this.isSetUp) {\n\t\t\t\tthis.backend.setup()\n\t\t\t\tthis.isSetUp = true\n\t\t\t} else if (!shouldSetUp && this.isSetUp) {\n\t\t\t\tthis.backend.teardown()\n\t\t\t\tthis.isSetUp = false\n\t\t\t}\n\t\t}\n\t}\n}\n"],"names":["createDragDropActions","DragDropManagerImpl","receiveBackend","backend","getMonitor","monitor","getBackend","getRegistry","registry","getActions","manager","dispatch","store","bindActionCreator","actionCreator","args","action","apply","actions","Object","keys","reduce","boundActions","key","isSetUp","handleRefCountChange","shouldSetUp","getState","refCount","setup","teardown","subscribe"],"mappings":"AAEA,SAASA,qBAAqB,QAAQ,8BAA8B,CAAA;AAYpE,OAAO,MAAMC,mBAAmB;IAY/B,AAAOC,cAAc,CAACC,OAAgB,EAAQ;QAC7C,IAAI,CAACA,OAAO,GAAGA,OAAO;KACtB;IAED,AAAOC,UAAU,GAAoB;QACpC,OAAO,IAAI,CAACC,OAAO,CAAA;KACnB;IAED,AAAOC,UAAU,GAAY;QAC5B,OAAO,IAAI,CAACH,OAAO,CAAW;KAC9B;IAED,AAAOI,WAAW,GAAoB;QACrC,OAAO,AAAC,IAAI,CAACF,OAAO,CAAyBG,QAAQ,CAAA;KACrD;IAED,AAAOC,UAAU,GAAoB;QACpC,+DAA+D,CAC/D,MAAMC,OAAO,GAAG,IAAI;QACpB,MAAM,EAAEC,QAAQ,CAAA,EAAE,GAAG,IAAI,CAACC,KAAK;QAE/B,SAASC,iBAAiB,CAACC,aAAiC,EAAE;YAC7D,OAAO,CAAC,GAAGC,IAAI,AAAO,GAAK;gBAC1B,MAAMC,MAAM,GAAGF,aAAa,CAACG,KAAK,CAACP,OAAO,EAAEK,IAAI,CAAQ;gBACxD,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;oBAClCL,QAAQ,CAACK,MAAM,CAAC;iBAChB;aACD,CAAA;SACD;QAED,MAAME,OAAO,GAAGlB,qBAAqB,CAAC,IAAI,CAAC;QAE3C,OAAOmB,MAAM,CAACC,IAAI,CAACF,OAAO,CAAC,CAACG,MAAM,CACjC,CAACC,YAA6B,EAAEC,GAAW,GAAK;YAC/C,MAAMP,MAAM,GAAuB,AAACE,OAAO,AAAQ,CAClDK,GAAG,CACH,AAAsB,AACtB;YAAA,AAACD,YAAY,AAAQ,CAACC,GAAG,CAAC,GAAGV,iBAAiB,CAACG,MAAM,CAAC;YACvD,OAAOM,YAAY,CAAA;SACnB,EACD,EAAE,CACF,CAAA;KACD;IAED,AAAOX,QAAQ,CAACK,MAAmB,EAAQ;QAC1C,IAAI,CAACJ,KAAK,CAACD,QAAQ,CAACK,MAAM,CAAC;KAC3B;IApDD,YAAmBJ,KAAmB,EAAEP,OAAwB,CAAE;QAFlE,KAAQmB,OAAO,GAAG,KAAK,AAlBxB,CAkBwB;QAwDvB,KAAQC,oBAAoB,GAAG,IAAY;YAC1C,MAAMC,WAAW,GAAG,IAAI,CAACd,KAAK,CAACe,QAAQ,EAAE,CAACC,QAAQ,GAAG,CAAC;YACtD,IAAI,IAAI,CAACzB,OAAO,EAAE;gBACjB,IAAIuB,WAAW,IAAI,CAAC,IAAI,CAACF,OAAO,EAAE;oBACjC,IAAI,CAACrB,OAAO,CAAC0B,KAAK,EAAE;oBACpB,IAAI,CAACL,OAAO,GAAG,IAAI;iBACnB,MAAM,IAAI,CAACE,WAAW,IAAI,IAAI,CAACF,OAAO,EAAE;oBACxC,IAAI,CAACrB,OAAO,CAAC2B,QAAQ,EAAE;oBACvB,IAAI,CAACN,OAAO,GAAG,KAAK;iBACpB;aACD;SACD,AArFF,CAqFE;QAhEA,IAAI,CAACZ,KAAK,GAAGA,KAAK;QAClB,IAAI,CAACP,OAAO,GAAGA,OAAO;QACtBO,KAAK,CAACmB,SAAS,CAAC,IAAI,CAACN,oBAAoB,CAAC;KAC1C;CA8DD"}
|
||||
31
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.d.ts
generated
vendored
31
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.d.ts
generated
vendored
@@ -1,31 +0,0 @@
|
||||
import type { Store } from 'redux';
|
||||
import type { DragDropMonitor, HandlerRegistry, Identifier, Listener, Unsubscribe, XYCoord } from '../interfaces.js';
|
||||
import type { State } from '../reducers/index.js';
|
||||
export declare class DragDropMonitorImpl implements DragDropMonitor {
|
||||
private store;
|
||||
readonly registry: HandlerRegistry;
|
||||
constructor(store: Store<State>, registry: HandlerRegistry);
|
||||
subscribeToStateChange(listener: Listener, options?: {
|
||||
handlerIds?: string[];
|
||||
}): Unsubscribe;
|
||||
subscribeToOffsetChange(listener: Listener): Unsubscribe;
|
||||
canDragSource(sourceId: string | undefined): boolean;
|
||||
canDropOnTarget(targetId: string | undefined): boolean;
|
||||
isDragging(): boolean;
|
||||
isDraggingSource(sourceId: string | undefined): boolean;
|
||||
isOverTarget(targetId: string | undefined, options?: {
|
||||
shallow: boolean;
|
||||
}): boolean;
|
||||
getItemType(): Identifier;
|
||||
getItem(): any;
|
||||
getSourceId(): string | null;
|
||||
getTargetIds(): string[];
|
||||
getDropResult(): any;
|
||||
didDrop(): boolean;
|
||||
isSourcePublic(): boolean;
|
||||
getInitialClientOffset(): XYCoord | null;
|
||||
getInitialSourceClientOffset(): XYCoord | null;
|
||||
getClientOffset(): XYCoord | null;
|
||||
getSourceClientOffset(): XYCoord | null;
|
||||
getDifferenceFromInitialOffset(): XYCoord | null;
|
||||
}
|
||||
152
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.js
generated
vendored
152
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.js
generated
vendored
@@ -1,152 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { getDifferenceFromInitialOffset, getSourceClientOffset } from '../utils/coords.js';
|
||||
import { areDirty } from '../utils/dirtiness.js';
|
||||
import { matchesType } from '../utils/matchesType.js';
|
||||
export class DragDropMonitorImpl {
|
||||
subscribeToStateChange(listener, options = {}) {
|
||||
const { handlerIds } = options;
|
||||
invariant(typeof listener === 'function', 'listener must be a function.');
|
||||
invariant(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');
|
||||
let prevStateId = this.store.getState().stateId;
|
||||
const handleChange = ()=>{
|
||||
const state = this.store.getState();
|
||||
const currentStateId = state.stateId;
|
||||
try {
|
||||
const canSkipListener = currentStateId === prevStateId || currentStateId === prevStateId + 1 && !areDirty(state.dirtyHandlerIds, handlerIds);
|
||||
if (!canSkipListener) {
|
||||
listener();
|
||||
}
|
||||
} finally{
|
||||
prevStateId = currentStateId;
|
||||
}
|
||||
};
|
||||
return this.store.subscribe(handleChange);
|
||||
}
|
||||
subscribeToOffsetChange(listener) {
|
||||
invariant(typeof listener === 'function', 'listener must be a function.');
|
||||
let previousState = this.store.getState().dragOffset;
|
||||
const handleChange = ()=>{
|
||||
const nextState = this.store.getState().dragOffset;
|
||||
if (nextState === previousState) {
|
||||
return;
|
||||
}
|
||||
previousState = nextState;
|
||||
listener();
|
||||
};
|
||||
return this.store.subscribe(handleChange);
|
||||
}
|
||||
canDragSource(sourceId) {
|
||||
if (!sourceId) {
|
||||
return false;
|
||||
}
|
||||
const source = this.registry.getSource(sourceId);
|
||||
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`);
|
||||
if (this.isDragging()) {
|
||||
return false;
|
||||
}
|
||||
return source.canDrag(this, sourceId);
|
||||
}
|
||||
canDropOnTarget(targetId) {
|
||||
// undefined on initial render
|
||||
if (!targetId) {
|
||||
return false;
|
||||
}
|
||||
const target = this.registry.getTarget(targetId);
|
||||
invariant(target, `Expected to find a valid target. targetId=${targetId}`);
|
||||
if (!this.isDragging() || this.didDrop()) {
|
||||
return false;
|
||||
}
|
||||
const targetType = this.registry.getTargetType(targetId);
|
||||
const draggedItemType = this.getItemType();
|
||||
return matchesType(targetType, draggedItemType) && target.canDrop(this, targetId);
|
||||
}
|
||||
isDragging() {
|
||||
return Boolean(this.getItemType());
|
||||
}
|
||||
isDraggingSource(sourceId) {
|
||||
// undefined on initial render
|
||||
if (!sourceId) {
|
||||
return false;
|
||||
}
|
||||
const source = this.registry.getSource(sourceId, true);
|
||||
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`);
|
||||
if (!this.isDragging() || !this.isSourcePublic()) {
|
||||
return false;
|
||||
}
|
||||
const sourceType = this.registry.getSourceType(sourceId);
|
||||
const draggedItemType = this.getItemType();
|
||||
if (sourceType !== draggedItemType) {
|
||||
return false;
|
||||
}
|
||||
return source.isDragging(this, sourceId);
|
||||
}
|
||||
isOverTarget(targetId, options = {
|
||||
shallow: false
|
||||
}) {
|
||||
// undefined on initial render
|
||||
if (!targetId) {
|
||||
return false;
|
||||
}
|
||||
const { shallow } = options;
|
||||
if (!this.isDragging()) {
|
||||
return false;
|
||||
}
|
||||
const targetType = this.registry.getTargetType(targetId);
|
||||
const draggedItemType = this.getItemType();
|
||||
if (draggedItemType && !matchesType(targetType, draggedItemType)) {
|
||||
return false;
|
||||
}
|
||||
const targetIds = this.getTargetIds();
|
||||
if (!targetIds.length) {
|
||||
return false;
|
||||
}
|
||||
const index = targetIds.indexOf(targetId);
|
||||
if (shallow) {
|
||||
return index === targetIds.length - 1;
|
||||
} else {
|
||||
return index > -1;
|
||||
}
|
||||
}
|
||||
getItemType() {
|
||||
return this.store.getState().dragOperation.itemType;
|
||||
}
|
||||
getItem() {
|
||||
return this.store.getState().dragOperation.item;
|
||||
}
|
||||
getSourceId() {
|
||||
return this.store.getState().dragOperation.sourceId;
|
||||
}
|
||||
getTargetIds() {
|
||||
return this.store.getState().dragOperation.targetIds;
|
||||
}
|
||||
getDropResult() {
|
||||
return this.store.getState().dragOperation.dropResult;
|
||||
}
|
||||
didDrop() {
|
||||
return this.store.getState().dragOperation.didDrop;
|
||||
}
|
||||
isSourcePublic() {
|
||||
return Boolean(this.store.getState().dragOperation.isSourcePublic);
|
||||
}
|
||||
getInitialClientOffset() {
|
||||
return this.store.getState().dragOffset.initialClientOffset;
|
||||
}
|
||||
getInitialSourceClientOffset() {
|
||||
return this.store.getState().dragOffset.initialSourceClientOffset;
|
||||
}
|
||||
getClientOffset() {
|
||||
return this.store.getState().dragOffset.clientOffset;
|
||||
}
|
||||
getSourceClientOffset() {
|
||||
return getSourceClientOffset(this.store.getState().dragOffset);
|
||||
}
|
||||
getDifferenceFromInitialOffset() {
|
||||
return getDifferenceFromInitialOffset(this.store.getState().dragOffset);
|
||||
}
|
||||
constructor(store, registry){
|
||||
this.store = store;
|
||||
this.registry = registry;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=DragDropMonitorImpl.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/classes/DragDropMonitorImpl.js.map
generated
vendored
File diff suppressed because one or more lines are too long
26
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.d.ts
generated
vendored
26
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.d.ts
generated
vendored
@@ -1,26 +0,0 @@
|
||||
import type { Store } from 'redux';
|
||||
import type { DragSource, DropTarget, HandlerRegistry, Identifier, SourceType, TargetType } from '../interfaces.js';
|
||||
import type { State } from '../reducers/index.js';
|
||||
export declare class HandlerRegistryImpl implements HandlerRegistry {
|
||||
private types;
|
||||
private dragSources;
|
||||
private dropTargets;
|
||||
private pinnedSourceId;
|
||||
private pinnedSource;
|
||||
private store;
|
||||
constructor(store: Store<State>);
|
||||
addSource(type: SourceType, source: DragSource): string;
|
||||
addTarget(type: TargetType, target: DropTarget): string;
|
||||
containsHandler(handler: DragSource | DropTarget): boolean;
|
||||
getSource(sourceId: string, includePinned?: boolean): DragSource;
|
||||
getTarget(targetId: string): DropTarget;
|
||||
getSourceType(sourceId: string): Identifier;
|
||||
getTargetType(targetId: string): Identifier | Identifier[];
|
||||
isSourceId(handlerId: string): boolean;
|
||||
isTargetId(handlerId: string): boolean;
|
||||
removeSource(sourceId: string): void;
|
||||
removeTarget(targetId: string): void;
|
||||
pinSource(sourceId: string): void;
|
||||
unpinSource(): void;
|
||||
private addHandler;
|
||||
}
|
||||
129
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.js
generated
vendored
129
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.js
generated
vendored
@@ -1,129 +0,0 @@
|
||||
import { asap } from '@react-dnd/asap';
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
import { addSource, addTarget, removeSource, removeTarget } from '../actions/registry.js';
|
||||
import { validateSourceContract, validateTargetContract, validateType } from '../contracts.js';
|
||||
import { HandlerRole } from '../interfaces.js';
|
||||
import { getNextUniqueId } from '../utils/getNextUniqueId.js';
|
||||
function getNextHandlerId(role) {
|
||||
const id = getNextUniqueId().toString();
|
||||
switch(role){
|
||||
case HandlerRole.SOURCE:
|
||||
return `S${id}`;
|
||||
case HandlerRole.TARGET:
|
||||
return `T${id}`;
|
||||
default:
|
||||
throw new Error(`Unknown Handler Role: ${role}`);
|
||||
}
|
||||
}
|
||||
function parseRoleFromHandlerId(handlerId) {
|
||||
switch(handlerId[0]){
|
||||
case 'S':
|
||||
return HandlerRole.SOURCE;
|
||||
case 'T':
|
||||
return HandlerRole.TARGET;
|
||||
default:
|
||||
throw new Error(`Cannot parse handler ID: ${handlerId}`);
|
||||
}
|
||||
}
|
||||
function mapContainsValue(map, searchValue) {
|
||||
const entries = map.entries();
|
||||
let isDone = false;
|
||||
do {
|
||||
const { done , value: [, value] , } = entries.next();
|
||||
if (value === searchValue) {
|
||||
return true;
|
||||
}
|
||||
isDone = !!done;
|
||||
}while (!isDone)
|
||||
return false;
|
||||
}
|
||||
export class HandlerRegistryImpl {
|
||||
addSource(type, source) {
|
||||
validateType(type);
|
||||
validateSourceContract(source);
|
||||
const sourceId = this.addHandler(HandlerRole.SOURCE, type, source);
|
||||
this.store.dispatch(addSource(sourceId));
|
||||
return sourceId;
|
||||
}
|
||||
addTarget(type, target) {
|
||||
validateType(type, true);
|
||||
validateTargetContract(target);
|
||||
const targetId = this.addHandler(HandlerRole.TARGET, type, target);
|
||||
this.store.dispatch(addTarget(targetId));
|
||||
return targetId;
|
||||
}
|
||||
containsHandler(handler) {
|
||||
return mapContainsValue(this.dragSources, handler) || mapContainsValue(this.dropTargets, handler);
|
||||
}
|
||||
getSource(sourceId, includePinned = false) {
|
||||
invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');
|
||||
const isPinned = includePinned && sourceId === this.pinnedSourceId;
|
||||
const source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId);
|
||||
return source;
|
||||
}
|
||||
getTarget(targetId) {
|
||||
invariant(this.isTargetId(targetId), 'Expected a valid target ID.');
|
||||
return this.dropTargets.get(targetId);
|
||||
}
|
||||
getSourceType(sourceId) {
|
||||
invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');
|
||||
return this.types.get(sourceId);
|
||||
}
|
||||
getTargetType(targetId) {
|
||||
invariant(this.isTargetId(targetId), 'Expected a valid target ID.');
|
||||
return this.types.get(targetId);
|
||||
}
|
||||
isSourceId(handlerId) {
|
||||
const role = parseRoleFromHandlerId(handlerId);
|
||||
return role === HandlerRole.SOURCE;
|
||||
}
|
||||
isTargetId(handlerId) {
|
||||
const role = parseRoleFromHandlerId(handlerId);
|
||||
return role === HandlerRole.TARGET;
|
||||
}
|
||||
removeSource(sourceId) {
|
||||
invariant(this.getSource(sourceId), 'Expected an existing source.');
|
||||
this.store.dispatch(removeSource(sourceId));
|
||||
asap(()=>{
|
||||
this.dragSources.delete(sourceId);
|
||||
this.types.delete(sourceId);
|
||||
});
|
||||
}
|
||||
removeTarget(targetId) {
|
||||
invariant(this.getTarget(targetId), 'Expected an existing target.');
|
||||
this.store.dispatch(removeTarget(targetId));
|
||||
this.dropTargets.delete(targetId);
|
||||
this.types.delete(targetId);
|
||||
}
|
||||
pinSource(sourceId) {
|
||||
const source = this.getSource(sourceId);
|
||||
invariant(source, 'Expected an existing source.');
|
||||
this.pinnedSourceId = sourceId;
|
||||
this.pinnedSource = source;
|
||||
}
|
||||
unpinSource() {
|
||||
invariant(this.pinnedSource, 'No source is pinned at the time.');
|
||||
this.pinnedSourceId = null;
|
||||
this.pinnedSource = null;
|
||||
}
|
||||
addHandler(role, type, handler) {
|
||||
const id = getNextHandlerId(role);
|
||||
this.types.set(id, type);
|
||||
if (role === HandlerRole.SOURCE) {
|
||||
this.dragSources.set(id, handler);
|
||||
} else if (role === HandlerRole.TARGET) {
|
||||
this.dropTargets.set(id, handler);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
constructor(store){
|
||||
this.types = new Map();
|
||||
this.dragSources = new Map();
|
||||
this.dropTargets = new Map();
|
||||
this.pinnedSourceId = null;
|
||||
this.pinnedSource = null;
|
||||
this.store = store;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=HandlerRegistryImpl.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/classes/HandlerRegistryImpl.js.map
generated
vendored
File diff suppressed because one or more lines are too long
4
frontend/node_modules/dnd-core/dist/contracts.d.ts
generated
vendored
4
frontend/node_modules/dnd-core/dist/contracts.d.ts
generated
vendored
@@ -1,4 +0,0 @@
|
||||
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;
|
||||
21
frontend/node_modules/dnd-core/dist/contracts.js
generated
vendored
21
frontend/node_modules/dnd-core/dist/contracts.js
generated
vendored
@@ -1,21 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant';
|
||||
export function validateSourceContract(source) {
|
||||
invariant(typeof source.canDrag === 'function', 'Expected canDrag to be a function.');
|
||||
invariant(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.');
|
||||
invariant(typeof source.endDrag === 'function', 'Expected endDrag to be a function.');
|
||||
}
|
||||
export function validateTargetContract(target) {
|
||||
invariant(typeof target.canDrop === 'function', 'Expected canDrop to be a function.');
|
||||
invariant(typeof target.hover === 'function', 'Expected hover to be a function.');
|
||||
invariant(typeof target.drop === 'function', 'Expected beginDrag to be a function.');
|
||||
}
|
||||
export function validateType(type, allowArray) {
|
||||
if (allowArray && Array.isArray(type)) {
|
||||
type.forEach((t)=>validateType(t, false)
|
||||
);
|
||||
return;
|
||||
}
|
||||
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.');
|
||||
}
|
||||
|
||||
//# sourceMappingURL=contracts.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/contracts.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/contracts.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/contracts.ts"],"sourcesContent":["import { invariant } from '@react-dnd/invariant'\n\nimport type { DragSource, DropTarget, Identifier } from './interfaces.js'\n\nexport function validateSourceContract(source: DragSource): void {\n\tinvariant(\n\t\ttypeof source.canDrag === 'function',\n\t\t'Expected canDrag to be a function.',\n\t)\n\tinvariant(\n\t\ttypeof source.beginDrag === 'function',\n\t\t'Expected beginDrag to be a function.',\n\t)\n\tinvariant(\n\t\ttypeof source.endDrag === 'function',\n\t\t'Expected endDrag to be a function.',\n\t)\n}\n\nexport function validateTargetContract(target: DropTarget): void {\n\tinvariant(\n\t\ttypeof target.canDrop === 'function',\n\t\t'Expected canDrop to be a function.',\n\t)\n\tinvariant(\n\t\ttypeof target.hover === 'function',\n\t\t'Expected hover to be a function.',\n\t)\n\tinvariant(\n\t\ttypeof target.drop === 'function',\n\t\t'Expected beginDrag to be a function.',\n\t)\n}\n\nexport function validateType(\n\ttype: Identifier | Identifier[],\n\tallowArray?: boolean,\n): void {\n\tif (allowArray && Array.isArray(type)) {\n\t\ttype.forEach((t) => validateType(t, false))\n\t\treturn\n\t}\n\n\tinvariant(\n\t\ttypeof type === 'string' || typeof type === 'symbol',\n\t\tallowArray\n\t\t\t? 'Type can only be a string, a symbol, or an array of either.'\n\t\t\t: 'Type can only be a string or a symbol.',\n\t)\n}\n"],"names":["invariant","validateSourceContract","source","canDrag","beginDrag","endDrag","validateTargetContract","target","canDrop","hover","drop","validateType","type","allowArray","Array","isArray","forEach","t"],"mappings":"AAAA,SAASA,SAAS,QAAQ,sBAAsB,CAAA;AAIhD,OAAO,SAASC,sBAAsB,CAACC,MAAkB,EAAQ;IAChEF,SAAS,CACR,OAAOE,MAAM,CAACC,OAAO,KAAK,UAAU,EACpC,oCAAoC,CACpC;IACDH,SAAS,CACR,OAAOE,MAAM,CAACE,SAAS,KAAK,UAAU,EACtC,sCAAsC,CACtC;IACDJ,SAAS,CACR,OAAOE,MAAM,CAACG,OAAO,KAAK,UAAU,EACpC,oCAAoC,CACpC;CACD;AAED,OAAO,SAASC,sBAAsB,CAACC,MAAkB,EAAQ;IAChEP,SAAS,CACR,OAAOO,MAAM,CAACC,OAAO,KAAK,UAAU,EACpC,oCAAoC,CACpC;IACDR,SAAS,CACR,OAAOO,MAAM,CAACE,KAAK,KAAK,UAAU,EAClC,kCAAkC,CAClC;IACDT,SAAS,CACR,OAAOO,MAAM,CAACG,IAAI,KAAK,UAAU,EACjC,sCAAsC,CACtC;CACD;AAED,OAAO,SAASC,YAAY,CAC3BC,IAA+B,EAC/BC,UAAoB,EACb;IACP,IAAIA,UAAU,IAAIC,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,EAAE;QACtCA,IAAI,CAACI,OAAO,CAAC,CAACC,CAAC,GAAKN,YAAY,CAACM,CAAC,EAAE,KAAK,CAAC;QAAA,CAAC;QAC3C,OAAM;KACN;IAEDjB,SAAS,CACR,OAAOY,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,QAAQ,EACpDC,UAAU,GACP,6DAA6D,GAC7D,wCAAwC,CAC3C;CACD"}
|
||||
2
frontend/node_modules/dnd-core/dist/createDragDropManager.d.ts
generated
vendored
2
frontend/node_modules/dnd-core/dist/createDragDropManager.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import type { BackendFactory, DragDropManager } from './interfaces.js';
|
||||
export declare function createDragDropManager(backendFactory: BackendFactory, globalContext?: unknown, backendOptions?: unknown, debugMode?: boolean): DragDropManager;
|
||||
24
frontend/node_modules/dnd-core/dist/createDragDropManager.js
generated
vendored
24
frontend/node_modules/dnd-core/dist/createDragDropManager.js
generated
vendored
@@ -1,24 +0,0 @@
|
||||
import { createStore } from 'redux';
|
||||
import { DragDropManagerImpl } from './classes/DragDropManagerImpl.js';
|
||||
import { DragDropMonitorImpl } from './classes/DragDropMonitorImpl.js';
|
||||
import { HandlerRegistryImpl } from './classes/HandlerRegistryImpl.js';
|
||||
import { reduce } from './reducers/index.js';
|
||||
export function createDragDropManager(backendFactory, globalContext = undefined, backendOptions = {}, debugMode = false) {
|
||||
const store = makeStoreInstance(debugMode);
|
||||
const monitor = new DragDropMonitorImpl(store, new HandlerRegistryImpl(store));
|
||||
const manager = new DragDropManagerImpl(store, monitor);
|
||||
const backend = backendFactory(manager, globalContext, backendOptions);
|
||||
manager.receiveBackend(backend);
|
||||
return manager;
|
||||
}
|
||||
function makeStoreInstance(debugMode) {
|
||||
// TODO: if we ever make a react-native version of this,
|
||||
// we'll need to consider how to pull off dev-tooling
|
||||
const reduxDevTools = typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__;
|
||||
return createStore(reduce, debugMode && reduxDevTools && reduxDevTools({
|
||||
name: 'dnd-core',
|
||||
instanceId: 'dnd-core'
|
||||
}));
|
||||
}
|
||||
|
||||
//# sourceMappingURL=createDragDropManager.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/createDragDropManager.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/createDragDropManager.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/createDragDropManager.ts"],"sourcesContent":["import type { Store } from 'redux'\nimport { createStore } from 'redux'\n\nimport { DragDropManagerImpl } from './classes/DragDropManagerImpl.js'\nimport { DragDropMonitorImpl } from './classes/DragDropMonitorImpl.js'\nimport { HandlerRegistryImpl } from './classes/HandlerRegistryImpl.js'\nimport type { BackendFactory, DragDropManager } from './interfaces.js'\nimport type { State } from './reducers/index.js'\nimport { reduce } from './reducers/index.js'\n\nexport function createDragDropManager(\n\tbackendFactory: BackendFactory,\n\tglobalContext: unknown = undefined,\n\tbackendOptions: unknown = {},\n\tdebugMode = false,\n): DragDropManager {\n\tconst store = makeStoreInstance(debugMode)\n\tconst monitor = new DragDropMonitorImpl(store, new HandlerRegistryImpl(store))\n\tconst manager = new DragDropManagerImpl(store, monitor)\n\tconst backend = backendFactory(manager, globalContext, backendOptions)\n\tmanager.receiveBackend(backend)\n\treturn manager\n}\n\nfunction makeStoreInstance(debugMode: boolean): Store<State> {\n\t// TODO: if we ever make a react-native version of this,\n\t// we'll need to consider how to pull off dev-tooling\n\tconst reduxDevTools =\n\t\ttypeof window !== 'undefined' &&\n\t\t(window as any).__REDUX_DEVTOOLS_EXTENSION__\n\treturn createStore(\n\t\treduce,\n\t\tdebugMode &&\n\t\t\treduxDevTools &&\n\t\t\treduxDevTools({\n\t\t\t\tname: 'dnd-core',\n\t\t\t\tinstanceId: 'dnd-core',\n\t\t\t}),\n\t)\n}\n"],"names":["createStore","DragDropManagerImpl","DragDropMonitorImpl","HandlerRegistryImpl","reduce","createDragDropManager","backendFactory","globalContext","undefined","backendOptions","debugMode","store","makeStoreInstance","monitor","manager","backend","receiveBackend","reduxDevTools","window","__REDUX_DEVTOOLS_EXTENSION__","name","instanceId"],"mappings":"AACA,SAASA,WAAW,QAAQ,OAAO,CAAA;AAEnC,SAASC,mBAAmB,QAAQ,kCAAkC,CAAA;AACtE,SAASC,mBAAmB,QAAQ,kCAAkC,CAAA;AACtE,SAASC,mBAAmB,QAAQ,kCAAkC,CAAA;AAGtE,SAASC,MAAM,QAAQ,qBAAqB,CAAA;AAE5C,OAAO,SAASC,qBAAqB,CACpCC,cAA8B,EAC9BC,aAAsB,GAAGC,SAAS,EAClCC,cAAuB,GAAG,EAAE,EAC5BC,SAAS,GAAG,KAAK,EACC;IAClB,MAAMC,KAAK,GAAGC,iBAAiB,CAACF,SAAS,CAAC;IAC1C,MAAMG,OAAO,GAAG,IAAIX,mBAAmB,CAACS,KAAK,EAAE,IAAIR,mBAAmB,CAACQ,KAAK,CAAC,CAAC;IAC9E,MAAMG,OAAO,GAAG,IAAIb,mBAAmB,CAACU,KAAK,EAAEE,OAAO,CAAC;IACvD,MAAME,OAAO,GAAGT,cAAc,CAACQ,OAAO,EAAEP,aAAa,EAAEE,cAAc,CAAC;IACtEK,OAAO,CAACE,cAAc,CAACD,OAAO,CAAC;IAC/B,OAAOD,OAAO,CAAA;CACd;AAED,SAASF,iBAAiB,CAACF,SAAkB,EAAgB;IAC5D,wDAAwD;IACxD,qDAAqD;IACrD,MAAMO,aAAa,GAClB,OAAOC,MAAM,KAAK,WAAW,IAC7B,AAACA,MAAM,CAASC,4BAA4B;IAC7C,OAAOnB,WAAW,CACjBI,MAAM,EACNM,SAAS,IACRO,aAAa,IACbA,aAAa,CAAC;QACbG,IAAI,EAAE,UAAU;QAChBC,UAAU,EAAE,UAAU;KACtB,CAAC,CACH,CAAA;CACD"}
|
||||
2
frontend/node_modules/dnd-core/dist/index.d.ts
generated
vendored
2
frontend/node_modules/dnd-core/dist/index.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
export * from './createDragDropManager.js';
|
||||
export * from './interfaces.js';
|
||||
4
frontend/node_modules/dnd-core/dist/index.js
generated
vendored
4
frontend/node_modules/dnd-core/dist/index.js
generated
vendored
@@ -1,4 +0,0 @@
|
||||
export * from './createDragDropManager.js';
|
||||
export * from './interfaces.js';
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/index.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/index.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './createDragDropManager.js'\nexport * from './interfaces.js'\n"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA"}
|
||||
170
frontend/node_modules/dnd-core/dist/interfaces.d.ts
generated
vendored
170
frontend/node_modules/dnd-core/dist/interfaces.d.ts
generated
vendored
@@ -1,170 +0,0 @@
|
||||
export declare type Identifier = string | symbol;
|
||||
export declare type SourceType = Identifier;
|
||||
export declare type TargetType = Identifier | Identifier[];
|
||||
export declare type Unsubscribe = () => void;
|
||||
export declare type Listener = () => void;
|
||||
export interface XYCoord {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
export declare enum HandlerRole {
|
||||
SOURCE = "SOURCE",
|
||||
TARGET = "TARGET"
|
||||
}
|
||||
export interface Backend {
|
||||
setup(): void;
|
||||
teardown(): void;
|
||||
connectDragSource(sourceId: any, node?: any, options?: any): Unsubscribe;
|
||||
connectDragPreview(sourceId: any, node?: any, options?: any): Unsubscribe;
|
||||
connectDropTarget(targetId: any, node?: any, options?: any): Unsubscribe;
|
||||
profile(): Record<string, number>;
|
||||
}
|
||||
export interface DragDropMonitor {
|
||||
subscribeToStateChange(listener: Listener, options?: {
|
||||
handlerIds?: Identifier[];
|
||||
}): Unsubscribe;
|
||||
subscribeToOffsetChange(listener: Listener): Unsubscribe;
|
||||
canDragSource(sourceId: Identifier | undefined): boolean;
|
||||
canDropOnTarget(targetId: Identifier | undefined): boolean;
|
||||
/**
|
||||
* Returns true if a drag operation is in progress, and either the owner initiated the drag, or its isDragging()
|
||||
* is defined and returns true.
|
||||
*/
|
||||
isDragging(): boolean;
|
||||
isDraggingSource(sourceId: Identifier | undefined): boolean;
|
||||
isOverTarget(targetId: Identifier | undefined, options?: {
|
||||
shallow?: boolean;
|
||||
}): boolean;
|
||||
/**
|
||||
* Returns a string or a symbol identifying the type of the current dragged item. Returns null if no item is being dragged.
|
||||
*/
|
||||
getItemType(): Identifier | null;
|
||||
/**
|
||||
* Returns a plain object representing the currently dragged item. Every drag source must specify it by returning an object
|
||||
* from its beginDrag() method. Returns null if no item is being dragged.
|
||||
*/
|
||||
getItem(): any;
|
||||
getSourceId(): Identifier | null;
|
||||
getTargetIds(): Identifier[];
|
||||
/**
|
||||
* Returns a plain object representing the last recorded drop result. The drop targets may optionally specify it by returning an
|
||||
* object from their drop() methods. When a chain of drop() is dispatched for the nested targets, bottom up, any parent that
|
||||
* explicitly returns its own result from drop() overrides the child drop result previously set by the child. Returns null if
|
||||
* called outside endDrag().
|
||||
*/
|
||||
getDropResult(): any;
|
||||
/**
|
||||
* Returns true if some drop target has handled the drop event, false otherwise. Even if a target did not return a drop result,
|
||||
* didDrop() returns true. Use it inside endDrag() to test whether any drop target has handled the drop. Returns false if called
|
||||
* outside endDrag().
|
||||
*/
|
||||
didDrop(): boolean;
|
||||
isSourcePublic(): boolean | null;
|
||||
/**
|
||||
* Returns the { x, y } client offset of the pointer at the time when the current drag operation has started.
|
||||
* Returns null if no item is being dragged.
|
||||
*/
|
||||
getInitialClientOffset(): XYCoord | null;
|
||||
/**
|
||||
* Returns the { x, y } client offset of the drag source component's root DOM node at the time when the current drag
|
||||
* operation has started. Returns null if no item is being dragged.
|
||||
*/
|
||||
getInitialSourceClientOffset(): XYCoord | null;
|
||||
/**
|
||||
* Returns the last recorded { x, y } client offset of the pointer while a drag operation is in progress.
|
||||
* Returns null if no item is being dragged.
|
||||
*/
|
||||
getClientOffset(): XYCoord | null;
|
||||
/**
|
||||
* Returns the projected { x, y } client offset of the drag source component's root DOM node, based on its position at the time
|
||||
* when the current drag operation has started, and the movement difference. Returns null if no item is being dragged.
|
||||
*/
|
||||
getSourceClientOffset(): XYCoord | null;
|
||||
/**
|
||||
* Returns the { x, y } difference between the last recorded client offset of the pointer and the client offset when the current
|
||||
* drag operation has started. Returns null if no item is being dragged.
|
||||
*/
|
||||
getDifferenceFromInitialOffset(): XYCoord | null;
|
||||
}
|
||||
export interface HandlerRegistry {
|
||||
addSource(type: SourceType, source: DragSource): Identifier;
|
||||
addTarget(type: TargetType, target: DropTarget): Identifier;
|
||||
containsHandler(handler: DragSource | DropTarget): boolean;
|
||||
getSource(sourceId: Identifier, includePinned?: boolean): DragSource;
|
||||
getSourceType(sourceId: Identifier): SourceType;
|
||||
getTargetType(targetId: Identifier): TargetType;
|
||||
getTarget(targetId: Identifier): DropTarget;
|
||||
isSourceId(handlerId: Identifier): boolean;
|
||||
isTargetId(handlerId: Identifier): boolean;
|
||||
removeSource(sourceId: Identifier): void;
|
||||
removeTarget(targetId: Identifier): void;
|
||||
pinSource(sourceId: Identifier): void;
|
||||
unpinSource(): void;
|
||||
}
|
||||
export interface Action<Payload> {
|
||||
type: Identifier;
|
||||
payload: Payload;
|
||||
}
|
||||
export interface SentinelAction {
|
||||
type: Identifier;
|
||||
}
|
||||
export declare type ActionCreator<Payload> = (args: any[]) => Action<Payload>;
|
||||
export interface BeginDragOptions {
|
||||
publishSource?: boolean;
|
||||
clientOffset?: XYCoord;
|
||||
getSourceClientOffset?: (sourceId: Identifier | undefined) => XYCoord;
|
||||
}
|
||||
export interface InitCoordsPayload {
|
||||
clientOffset: XYCoord | null;
|
||||
sourceClientOffset: XYCoord | null;
|
||||
}
|
||||
export interface BeginDragPayload {
|
||||
itemType: Identifier;
|
||||
item: any;
|
||||
sourceId: Identifier;
|
||||
clientOffset: XYCoord | null;
|
||||
sourceClientOffset: XYCoord | null;
|
||||
isSourcePublic: boolean;
|
||||
}
|
||||
export interface HoverPayload {
|
||||
targetIds: Identifier[];
|
||||
clientOffset: XYCoord | null;
|
||||
}
|
||||
export interface HoverOptions {
|
||||
clientOffset?: XYCoord;
|
||||
}
|
||||
export interface DropPayload {
|
||||
dropResult: any;
|
||||
}
|
||||
export interface TargetIdPayload {
|
||||
targetId: Identifier;
|
||||
}
|
||||
export interface SourceIdPayload {
|
||||
sourceId: Identifier;
|
||||
}
|
||||
export interface DragDropActions {
|
||||
beginDrag(sourceIds?: Identifier[], options?: any): Action<BeginDragPayload> | undefined;
|
||||
publishDragSource(): SentinelAction | undefined;
|
||||
hover(targetIds: Identifier[], options?: any): Action<HoverPayload>;
|
||||
drop(options?: any): void;
|
||||
endDrag(): SentinelAction;
|
||||
}
|
||||
export interface DragDropManager {
|
||||
getMonitor(): DragDropMonitor;
|
||||
getBackend(): Backend;
|
||||
getRegistry(): HandlerRegistry;
|
||||
getActions(): DragDropActions;
|
||||
dispatch(action: any): void;
|
||||
}
|
||||
export declare type BackendFactory = (manager: DragDropManager, globalContext?: any, configuration?: any) => Backend;
|
||||
export interface DragSource {
|
||||
beginDrag(monitor: DragDropMonitor, targetId: Identifier): void;
|
||||
endDrag(monitor: DragDropMonitor, targetId: Identifier): void;
|
||||
canDrag(monitor: DragDropMonitor, targetId: Identifier): boolean;
|
||||
isDragging(monitor: DragDropMonitor, targetId: Identifier): boolean;
|
||||
}
|
||||
export interface DropTarget {
|
||||
canDrop(monitor: DragDropMonitor, targetId: Identifier): boolean;
|
||||
hover(monitor: DragDropMonitor, targetId: Identifier): void;
|
||||
drop(monitor: DragDropMonitor, targetId: Identifier): any;
|
||||
}
|
||||
7
frontend/node_modules/dnd-core/dist/interfaces.js
generated
vendored
7
frontend/node_modules/dnd-core/dist/interfaces.js
generated
vendored
@@ -1,7 +0,0 @@
|
||||
export var HandlerRole;
|
||||
(function(HandlerRole) {
|
||||
HandlerRole["SOURCE"] = "SOURCE";
|
||||
HandlerRole["TARGET"] = "TARGET";
|
||||
})(HandlerRole || (HandlerRole = {}));
|
||||
|
||||
//# sourceMappingURL=interfaces.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/interfaces.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/interfaces.js.map
generated
vendored
File diff suppressed because one or more lines are too long
7
frontend/node_modules/dnd-core/dist/reducers/dirtyHandlerIds.d.ts
generated
vendored
7
frontend/node_modules/dnd-core/dist/reducers/dirtyHandlerIds.d.ts
generated
vendored
@@ -1,7 +0,0 @@
|
||||
import type { Action } from '../interfaces.js';
|
||||
export declare type State = string[];
|
||||
export interface DirtyHandlerIdPayload {
|
||||
targetIds: string[];
|
||||
prevTargetIds: string[];
|
||||
}
|
||||
export declare function reduce(_state: State | undefined, action: Action<DirtyHandlerIdPayload>): State;
|
||||
44
frontend/node_modules/dnd-core/dist/reducers/dirtyHandlerIds.js
generated
vendored
44
frontend/node_modules/dnd-core/dist/reducers/dirtyHandlerIds.js
generated
vendored
@@ -1,44 +0,0 @@
|
||||
import { BEGIN_DRAG, DROP, END_DRAG, HOVER, PUBLISH_DRAG_SOURCE } from '../actions/dragDrop/index.js';
|
||||
import { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET } from '../actions/registry.js';
|
||||
import { ALL, NONE } from '../utils/dirtiness.js';
|
||||
import { areArraysEqual } from '../utils/equality.js';
|
||||
import { xor } from '../utils/js_utils.js';
|
||||
export function reduce(// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_state = NONE, action) {
|
||||
switch(action.type){
|
||||
case HOVER:
|
||||
break;
|
||||
case ADD_SOURCE:
|
||||
case ADD_TARGET:
|
||||
case REMOVE_TARGET:
|
||||
case REMOVE_SOURCE:
|
||||
return NONE;
|
||||
case BEGIN_DRAG:
|
||||
case PUBLISH_DRAG_SOURCE:
|
||||
case END_DRAG:
|
||||
case DROP:
|
||||
default:
|
||||
return ALL;
|
||||
}
|
||||
const { targetIds =[] , prevTargetIds =[] } = action.payload;
|
||||
const result = xor(targetIds, prevTargetIds);
|
||||
const didChange = result.length > 0 || !areArraysEqual(targetIds, prevTargetIds);
|
||||
if (!didChange) {
|
||||
return NONE;
|
||||
}
|
||||
// Check the target ids at the innermost position. If they are valid, add them
|
||||
// to the result
|
||||
const prevInnermostTargetId = prevTargetIds[prevTargetIds.length - 1];
|
||||
const innermostTargetId = targetIds[targetIds.length - 1];
|
||||
if (prevInnermostTargetId !== innermostTargetId) {
|
||||
if (prevInnermostTargetId) {
|
||||
result.push(prevInnermostTargetId);
|
||||
}
|
||||
if (innermostTargetId) {
|
||||
result.push(innermostTargetId);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=dirtyHandlerIds.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/reducers/dirtyHandlerIds.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/reducers/dirtyHandlerIds.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/reducers/dirtyHandlerIds.ts"],"sourcesContent":["import {\n\tBEGIN_DRAG,\n\tDROP,\n\tEND_DRAG,\n\tHOVER,\n\tPUBLISH_DRAG_SOURCE,\n} from '../actions/dragDrop/index.js'\nimport {\n\tADD_SOURCE,\n\tADD_TARGET,\n\tREMOVE_SOURCE,\n\tREMOVE_TARGET,\n} from '../actions/registry.js'\nimport type { Action } from '../interfaces.js'\nimport { ALL, NONE } from '../utils/dirtiness.js'\nimport { areArraysEqual } from '../utils/equality.js'\nimport { xor } from '../utils/js_utils.js'\n\nexport type State = string[]\n\nexport interface DirtyHandlerIdPayload {\n\ttargetIds: string[]\n\tprevTargetIds: string[]\n}\n\nexport function reduce(\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\t_state: State = NONE,\n\taction: Action<DirtyHandlerIdPayload>,\n): State {\n\tswitch (action.type) {\n\t\tcase HOVER:\n\t\t\tbreak\n\t\tcase ADD_SOURCE:\n\t\tcase ADD_TARGET:\n\t\tcase REMOVE_TARGET:\n\t\tcase REMOVE_SOURCE:\n\t\t\treturn NONE\n\t\tcase BEGIN_DRAG:\n\t\tcase PUBLISH_DRAG_SOURCE:\n\t\tcase END_DRAG:\n\t\tcase DROP:\n\t\tdefault:\n\t\t\treturn ALL\n\t}\n\n\tconst { targetIds = [], prevTargetIds = [] } = action.payload\n\tconst result = xor(targetIds, prevTargetIds)\n\tconst didChange =\n\t\tresult.length > 0 || !areArraysEqual(targetIds, prevTargetIds)\n\n\tif (!didChange) {\n\t\treturn NONE\n\t}\n\n\t// Check the target ids at the innermost position. If they are valid, add them\n\t// to the result\n\tconst prevInnermostTargetId = prevTargetIds[prevTargetIds.length - 1]\n\tconst innermostTargetId = targetIds[targetIds.length - 1]\n\tif (prevInnermostTargetId !== innermostTargetId) {\n\t\tif (prevInnermostTargetId) {\n\t\t\tresult.push(prevInnermostTargetId)\n\t\t}\n\t\tif (innermostTargetId) {\n\t\t\tresult.push(innermostTargetId)\n\t\t}\n\t}\n\n\treturn result\n}\n"],"names":["BEGIN_DRAG","DROP","END_DRAG","HOVER","PUBLISH_DRAG_SOURCE","ADD_SOURCE","ADD_TARGET","REMOVE_SOURCE","REMOVE_TARGET","ALL","NONE","areArraysEqual","xor","reduce","_state","action","type","targetIds","prevTargetIds","payload","result","didChange","length","prevInnermostTargetId","innermostTargetId","push"],"mappings":"AAAA,SACCA,UAAU,EACVC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,mBAAmB,QACb,8BAA8B,CAAA;AACrC,SACCC,UAAU,EACVC,UAAU,EACVC,aAAa,EACbC,aAAa,QACP,wBAAwB,CAAA;AAE/B,SAASC,GAAG,EAAEC,IAAI,QAAQ,uBAAuB,CAAA;AACjD,SAASC,cAAc,QAAQ,sBAAsB,CAAA;AACrD,SAASC,GAAG,QAAQ,sBAAsB,CAAA;AAS1C,OAAO,SAASC,MAAM,CACrB,6DAA6D;AAC7DC,MAAa,GAAGJ,IAAI,EACpBK,MAAqC,EAC7B;IACR,OAAQA,MAAM,CAACC,IAAI;QAClB,KAAKb,KAAK;YACT,MAAK;QACN,KAAKE,UAAU,CAAC;QAChB,KAAKC,UAAU,CAAC;QAChB,KAAKE,aAAa,CAAC;QACnB,KAAKD,aAAa;YACjB,OAAOG,IAAI,CAAA;QACZ,KAAKV,UAAU,CAAC;QAChB,KAAKI,mBAAmB,CAAC;QACzB,KAAKF,QAAQ,CAAC;QACd,KAAKD,IAAI,CAAC;QACV;YACC,OAAOQ,GAAG,CAAA;KACX;IAED,MAAM,EAAEQ,SAAS,EAAG,EAAE,CAAA,EAAEC,aAAa,EAAG,EAAE,CAAA,EAAE,GAAGH,MAAM,CAACI,OAAO;IAC7D,MAAMC,MAAM,GAAGR,GAAG,CAACK,SAAS,EAAEC,aAAa,CAAC;IAC5C,MAAMG,SAAS,GACdD,MAAM,CAACE,MAAM,GAAG,CAAC,IAAI,CAACX,cAAc,CAACM,SAAS,EAAEC,aAAa,CAAC;IAE/D,IAAI,CAACG,SAAS,EAAE;QACf,OAAOX,IAAI,CAAA;KACX;IAED,8EAA8E;IAC9E,gBAAgB;IAChB,MAAMa,qBAAqB,GAAGL,aAAa,CAACA,aAAa,CAACI,MAAM,GAAG,CAAC,CAAC;IACrE,MAAME,iBAAiB,GAAGP,SAAS,CAACA,SAAS,CAACK,MAAM,GAAG,CAAC,CAAC;IACzD,IAAIC,qBAAqB,KAAKC,iBAAiB,EAAE;QAChD,IAAID,qBAAqB,EAAE;YAC1BH,MAAM,CAACK,IAAI,CAACF,qBAAqB,CAAC;SAClC;QACD,IAAIC,iBAAiB,EAAE;YACtBJ,MAAM,CAACK,IAAI,CAACD,iBAAiB,CAAC;SAC9B;KACD;IAED,OAAOJ,MAAM,CAAA;CACb"}
|
||||
10
frontend/node_modules/dnd-core/dist/reducers/dragOffset.d.ts
generated
vendored
10
frontend/node_modules/dnd-core/dist/reducers/dragOffset.d.ts
generated
vendored
@@ -1,10 +0,0 @@
|
||||
import type { Action, XYCoord } from '../interfaces.js';
|
||||
export interface State {
|
||||
initialSourceClientOffset: XYCoord | null;
|
||||
initialClientOffset: XYCoord | null;
|
||||
clientOffset: XYCoord | null;
|
||||
}
|
||||
export declare function reduce(state: State | undefined, action: Action<{
|
||||
sourceClientOffset: XYCoord;
|
||||
clientOffset: XYCoord;
|
||||
}>): State;
|
||||
61
frontend/node_modules/dnd-core/dist/reducers/dragOffset.js
generated
vendored
61
frontend/node_modules/dnd-core/dist/reducers/dragOffset.js
generated
vendored
@@ -1,61 +0,0 @@
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _objectSpread(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
import { BEGIN_DRAG, DROP, END_DRAG, HOVER, INIT_COORDS } from '../actions/dragDrop/index.js';
|
||||
import { areCoordsEqual } from '../utils/equality.js';
|
||||
const initialState = {
|
||||
initialSourceClientOffset: null,
|
||||
initialClientOffset: null,
|
||||
clientOffset: null
|
||||
};
|
||||
export function reduce(state = initialState, action) {
|
||||
const { payload } = action;
|
||||
switch(action.type){
|
||||
case INIT_COORDS:
|
||||
case BEGIN_DRAG:
|
||||
return {
|
||||
initialSourceClientOffset: payload.sourceClientOffset,
|
||||
initialClientOffset: payload.clientOffset,
|
||||
clientOffset: payload.clientOffset
|
||||
};
|
||||
case HOVER:
|
||||
if (areCoordsEqual(state.clientOffset, payload.clientOffset)) {
|
||||
return state;
|
||||
}
|
||||
return _objectSpread({}, state, {
|
||||
clientOffset: payload.clientOffset
|
||||
});
|
||||
case END_DRAG:
|
||||
case DROP:
|
||||
return initialState;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=dragOffset.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/reducers/dragOffset.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/reducers/dragOffset.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/reducers/dragOffset.ts"],"sourcesContent":["import {\n\tBEGIN_DRAG,\n\tDROP,\n\tEND_DRAG,\n\tHOVER,\n\tINIT_COORDS,\n} from '../actions/dragDrop/index.js'\nimport type { Action, XYCoord } from '../interfaces.js'\nimport { areCoordsEqual } from '../utils/equality.js'\n\nexport interface State {\n\tinitialSourceClientOffset: XYCoord | null\n\tinitialClientOffset: XYCoord | null\n\tclientOffset: XYCoord | null\n}\n\nconst initialState: State = {\n\tinitialSourceClientOffset: null,\n\tinitialClientOffset: null,\n\tclientOffset: null,\n}\n\nexport function reduce(\n\tstate: State = initialState,\n\taction: Action<{\n\t\tsourceClientOffset: XYCoord\n\t\tclientOffset: XYCoord\n\t}>,\n): State {\n\tconst { payload } = action\n\tswitch (action.type) {\n\t\tcase INIT_COORDS:\n\t\tcase BEGIN_DRAG:\n\t\t\treturn {\n\t\t\t\tinitialSourceClientOffset: payload.sourceClientOffset,\n\t\t\t\tinitialClientOffset: payload.clientOffset,\n\t\t\t\tclientOffset: payload.clientOffset,\n\t\t\t}\n\t\tcase HOVER:\n\t\t\tif (areCoordsEqual(state.clientOffset, payload.clientOffset)) {\n\t\t\t\treturn state\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tclientOffset: payload.clientOffset,\n\t\t\t}\n\t\tcase END_DRAG:\n\t\tcase DROP:\n\t\t\treturn initialState\n\t\tdefault:\n\t\t\treturn state\n\t}\n}\n"],"names":["BEGIN_DRAG","DROP","END_DRAG","HOVER","INIT_COORDS","areCoordsEqual","initialState","initialSourceClientOffset","initialClientOffset","clientOffset","reduce","state","action","payload","type","sourceClientOffset"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SACCA,UAAU,EACVC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,WAAW,QACL,8BAA8B,CAAA;AAErC,SAASC,cAAc,QAAQ,sBAAsB,CAAA;AAQrD,MAAMC,YAAY,GAAU;IAC3BC,yBAAyB,EAAE,IAAI;IAC/BC,mBAAmB,EAAE,IAAI;IACzBC,YAAY,EAAE,IAAI;CAClB;AAED,OAAO,SAASC,MAAM,CACrBC,KAAY,GAAGL,YAAY,EAC3BM,MAGE,EACM;IACR,MAAM,EAAEC,OAAO,CAAA,EAAE,GAAGD,MAAM;IAC1B,OAAQA,MAAM,CAACE,IAAI;QAClB,KAAKV,WAAW,CAAC;QACjB,KAAKJ,UAAU;YACd,OAAO;gBACNO,yBAAyB,EAAEM,OAAO,CAACE,kBAAkB;gBACrDP,mBAAmB,EAAEK,OAAO,CAACJ,YAAY;gBACzCA,YAAY,EAAEI,OAAO,CAACJ,YAAY;aAClC,CAAA;QACF,KAAKN,KAAK;YACT,IAAIE,cAAc,CAACM,KAAK,CAACF,YAAY,EAAEI,OAAO,CAACJ,YAAY,CAAC,EAAE;gBAC7D,OAAOE,KAAK,CAAA;aACZ;YACD,OAAO,kBACHA,KAAK;gBACRF,YAAY,EAAEI,OAAO,CAACJ,YAAY;cAClC,CAAA;QACF,KAAKP,QAAQ,CAAC;QACd,KAAKD,IAAI;YACR,OAAOK,YAAY,CAAA;QACpB;YACC,OAAOK,KAAK,CAAA;KACb;CACD"}
|
||||
19
frontend/node_modules/dnd-core/dist/reducers/dragOperation.d.ts
generated
vendored
19
frontend/node_modules/dnd-core/dist/reducers/dragOperation.d.ts
generated
vendored
@@ -1,19 +0,0 @@
|
||||
import type { Action, Identifier } from '../interfaces.js';
|
||||
export interface State {
|
||||
itemType: Identifier | Identifier[] | null;
|
||||
item: any;
|
||||
sourceId: string | null;
|
||||
targetIds: string[];
|
||||
dropResult: any;
|
||||
didDrop: boolean;
|
||||
isSourcePublic: boolean | null;
|
||||
}
|
||||
export declare function reduce(state: State | undefined, action: Action<{
|
||||
itemType: Identifier | Identifier[];
|
||||
item: any;
|
||||
sourceId: string;
|
||||
targetId: string;
|
||||
targetIds: string[];
|
||||
isSourcePublic: boolean;
|
||||
dropResult: any;
|
||||
}>): State;
|
||||
89
frontend/node_modules/dnd-core/dist/reducers/dragOperation.js
generated
vendored
89
frontend/node_modules/dnd-core/dist/reducers/dragOperation.js
generated
vendored
@@ -1,89 +0,0 @@
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _objectSpread(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
import { BEGIN_DRAG, DROP, END_DRAG, HOVER, PUBLISH_DRAG_SOURCE } from '../actions/dragDrop/index.js';
|
||||
import { REMOVE_TARGET } from '../actions/registry.js';
|
||||
import { without } from '../utils/js_utils.js';
|
||||
const initialState = {
|
||||
itemType: null,
|
||||
item: null,
|
||||
sourceId: null,
|
||||
targetIds: [],
|
||||
dropResult: null,
|
||||
didDrop: false,
|
||||
isSourcePublic: null
|
||||
};
|
||||
export function reduce(state = initialState, action) {
|
||||
const { payload } = action;
|
||||
switch(action.type){
|
||||
case BEGIN_DRAG:
|
||||
return _objectSpread({}, state, {
|
||||
itemType: payload.itemType,
|
||||
item: payload.item,
|
||||
sourceId: payload.sourceId,
|
||||
isSourcePublic: payload.isSourcePublic,
|
||||
dropResult: null,
|
||||
didDrop: false
|
||||
});
|
||||
case PUBLISH_DRAG_SOURCE:
|
||||
return _objectSpread({}, state, {
|
||||
isSourcePublic: true
|
||||
});
|
||||
case HOVER:
|
||||
return _objectSpread({}, state, {
|
||||
targetIds: payload.targetIds
|
||||
});
|
||||
case REMOVE_TARGET:
|
||||
if (state.targetIds.indexOf(payload.targetId) === -1) {
|
||||
return state;
|
||||
}
|
||||
return _objectSpread({}, state, {
|
||||
targetIds: without(state.targetIds, payload.targetId)
|
||||
});
|
||||
case DROP:
|
||||
return _objectSpread({}, state, {
|
||||
dropResult: payload.dropResult,
|
||||
didDrop: true,
|
||||
targetIds: []
|
||||
});
|
||||
case END_DRAG:
|
||||
return _objectSpread({}, state, {
|
||||
itemType: null,
|
||||
item: null,
|
||||
sourceId: null,
|
||||
dropResult: null,
|
||||
didDrop: false,
|
||||
isSourcePublic: null,
|
||||
targetIds: []
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=dragOperation.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/reducers/dragOperation.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/reducers/dragOperation.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/reducers/dragOperation.ts"],"sourcesContent":["import {\n\tBEGIN_DRAG,\n\tDROP,\n\tEND_DRAG,\n\tHOVER,\n\tPUBLISH_DRAG_SOURCE,\n} from '../actions/dragDrop/index.js'\nimport { REMOVE_TARGET } from '../actions/registry.js'\nimport type { Action, Identifier } from '../interfaces.js'\nimport { without } from '../utils/js_utils.js'\n\nexport interface State {\n\titemType: Identifier | Identifier[] | null\n\titem: any\n\tsourceId: string | null\n\ttargetIds: string[]\n\tdropResult: any\n\tdidDrop: boolean\n\tisSourcePublic: boolean | null\n}\n\nconst initialState: State = {\n\titemType: null,\n\titem: null,\n\tsourceId: null,\n\ttargetIds: [],\n\tdropResult: null,\n\tdidDrop: false,\n\tisSourcePublic: null,\n}\n\nexport function reduce(\n\tstate: State = initialState,\n\taction: Action<{\n\t\titemType: Identifier | Identifier[]\n\t\titem: any\n\t\tsourceId: string\n\t\ttargetId: string\n\t\ttargetIds: string[]\n\t\tisSourcePublic: boolean\n\t\tdropResult: any\n\t}>,\n): State {\n\tconst { payload } = action\n\tswitch (action.type) {\n\t\tcase BEGIN_DRAG:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\titemType: payload.itemType,\n\t\t\t\titem: payload.item,\n\t\t\t\tsourceId: payload.sourceId,\n\t\t\t\tisSourcePublic: payload.isSourcePublic,\n\t\t\t\tdropResult: null,\n\t\t\t\tdidDrop: false,\n\t\t\t}\n\t\tcase PUBLISH_DRAG_SOURCE:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tisSourcePublic: true,\n\t\t\t}\n\t\tcase HOVER:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\ttargetIds: payload.targetIds,\n\t\t\t}\n\t\tcase REMOVE_TARGET:\n\t\t\tif (state.targetIds.indexOf(payload.targetId) === -1) {\n\t\t\t\treturn state\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\ttargetIds: without(state.targetIds, payload.targetId),\n\t\t\t}\n\t\tcase DROP:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tdropResult: payload.dropResult,\n\t\t\t\tdidDrop: true,\n\t\t\t\ttargetIds: [],\n\t\t\t}\n\t\tcase END_DRAG:\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\titemType: null,\n\t\t\t\titem: null,\n\t\t\t\tsourceId: null,\n\t\t\t\tdropResult: null,\n\t\t\t\tdidDrop: false,\n\t\t\t\tisSourcePublic: null,\n\t\t\t\ttargetIds: [],\n\t\t\t}\n\t\tdefault:\n\t\t\treturn state\n\t}\n}\n"],"names":["BEGIN_DRAG","DROP","END_DRAG","HOVER","PUBLISH_DRAG_SOURCE","REMOVE_TARGET","without","initialState","itemType","item","sourceId","targetIds","dropResult","didDrop","isSourcePublic","reduce","state","action","payload","type","indexOf","targetId"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SACCA,UAAU,EACVC,IAAI,EACJC,QAAQ,EACRC,KAAK,EACLC,mBAAmB,QACb,8BAA8B,CAAA;AACrC,SAASC,aAAa,QAAQ,wBAAwB,CAAA;AAEtD,SAASC,OAAO,QAAQ,sBAAsB,CAAA;AAY9C,MAAMC,YAAY,GAAU;IAC3BC,QAAQ,EAAE,IAAI;IACdC,IAAI,EAAE,IAAI;IACVC,QAAQ,EAAE,IAAI;IACdC,SAAS,EAAE,EAAE;IACbC,UAAU,EAAE,IAAI;IAChBC,OAAO,EAAE,KAAK;IACdC,cAAc,EAAE,IAAI;CACpB;AAED,OAAO,SAASC,MAAM,CACrBC,KAAY,GAAGT,YAAY,EAC3BU,MAQE,EACM;IACR,MAAM,EAAEC,OAAO,CAAA,EAAE,GAAGD,MAAM;IAC1B,OAAQA,MAAM,CAACE,IAAI;QAClB,KAAKnB,UAAU;YACd,OAAO,kBACHgB,KAAK;gBACRR,QAAQ,EAAEU,OAAO,CAACV,QAAQ;gBAC1BC,IAAI,EAAES,OAAO,CAACT,IAAI;gBAClBC,QAAQ,EAAEQ,OAAO,CAACR,QAAQ;gBAC1BI,cAAc,EAAEI,OAAO,CAACJ,cAAc;gBACtCF,UAAU,EAAE,IAAI;gBAChBC,OAAO,EAAE,KAAK;cACd,CAAA;QACF,KAAKT,mBAAmB;YACvB,OAAO,kBACHY,KAAK;gBACRF,cAAc,EAAE,IAAI;cACpB,CAAA;QACF,KAAKX,KAAK;YACT,OAAO,kBACHa,KAAK;gBACRL,SAAS,EAAEO,OAAO,CAACP,SAAS;cAC5B,CAAA;QACF,KAAKN,aAAa;YACjB,IAAIW,KAAK,CAACL,SAAS,CAACS,OAAO,CAACF,OAAO,CAACG,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE;gBACrD,OAAOL,KAAK,CAAA;aACZ;YACD,OAAO,kBACHA,KAAK;gBACRL,SAAS,EAAEL,OAAO,CAACU,KAAK,CAACL,SAAS,EAAEO,OAAO,CAACG,QAAQ,CAAC;cACrD,CAAA;QACF,KAAKpB,IAAI;YACR,OAAO,kBACHe,KAAK;gBACRJ,UAAU,EAAEM,OAAO,CAACN,UAAU;gBAC9BC,OAAO,EAAE,IAAI;gBACbF,SAAS,EAAE,EAAE;cACb,CAAA;QACF,KAAKT,QAAQ;YACZ,OAAO,kBACHc,KAAK;gBACRR,QAAQ,EAAE,IAAI;gBACdC,IAAI,EAAE,IAAI;gBACVC,QAAQ,EAAE,IAAI;gBACdE,UAAU,EAAE,IAAI;gBAChBC,OAAO,EAAE,KAAK;gBACdC,cAAc,EAAE,IAAI;gBACpBH,SAAS,EAAE,EAAE;cACb,CAAA;QACF;YACC,OAAOK,KAAK,CAAA;KACb;CACD"}
|
||||
14
frontend/node_modules/dnd-core/dist/reducers/index.d.ts
generated
vendored
14
frontend/node_modules/dnd-core/dist/reducers/index.d.ts
generated
vendored
@@ -1,14 +0,0 @@
|
||||
import type { Action } from '../interfaces.js';
|
||||
import type { State as DirtyHandlerIdsState } from './dirtyHandlerIds.js';
|
||||
import type { State as DragOffsetState } from './dragOffset.js';
|
||||
import type { State as DragOperationState } from './dragOperation.js';
|
||||
import type { State as RefCountState } from './refCount.js';
|
||||
import type { State as StateIdState } from './stateId.js';
|
||||
export interface State {
|
||||
dirtyHandlerIds: DirtyHandlerIdsState;
|
||||
dragOffset: DragOffsetState;
|
||||
refCount: RefCountState;
|
||||
dragOperation: DragOperationState;
|
||||
stateId: StateIdState;
|
||||
}
|
||||
export declare function reduce(state: State | undefined, action: Action<any>): State;
|
||||
50
frontend/node_modules/dnd-core/dist/reducers/index.js
generated
vendored
50
frontend/node_modules/dnd-core/dist/reducers/index.js
generated
vendored
@@ -1,50 +0,0 @@
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
function _objectSpread(target) {
|
||||
for(var i = 1; i < arguments.length; i++){
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
}));
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
import { get } from '../utils/js_utils.js';
|
||||
import { reduce as dirtyHandlerIds } from './dirtyHandlerIds.js';
|
||||
import { reduce as dragOffset } from './dragOffset.js';
|
||||
import { reduce as dragOperation } from './dragOperation.js';
|
||||
import { reduce as refCount } from './refCount.js';
|
||||
import { reduce as stateId } from './stateId.js';
|
||||
export function reduce(state = {}, action) {
|
||||
return {
|
||||
dirtyHandlerIds: dirtyHandlerIds(state.dirtyHandlerIds, {
|
||||
type: action.type,
|
||||
payload: _objectSpread({}, action.payload, {
|
||||
prevTargetIds: get(state, 'dragOperation.targetIds', [])
|
||||
})
|
||||
}),
|
||||
dragOffset: dragOffset(state.dragOffset, action),
|
||||
refCount: refCount(state.refCount, action),
|
||||
dragOperation: dragOperation(state.dragOperation, action),
|
||||
stateId: stateId(state.stateId)
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/reducers/index.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/reducers/index.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/reducers/index.ts"],"sourcesContent":["import type { Action } from '../interfaces.js'\nimport { get } from '../utils/js_utils.js'\nimport type { State as DirtyHandlerIdsState } from './dirtyHandlerIds.js'\nimport { reduce as dirtyHandlerIds } from './dirtyHandlerIds.js'\nimport type { State as DragOffsetState } from './dragOffset.js'\nimport { reduce as dragOffset } from './dragOffset.js'\nimport type { State as DragOperationState } from './dragOperation.js'\nimport { reduce as dragOperation } from './dragOperation.js'\nimport type { State as RefCountState } from './refCount.js'\nimport { reduce as refCount } from './refCount.js'\nimport type { State as StateIdState } from './stateId.js'\nimport { reduce as stateId } from './stateId.js'\n\nexport interface State {\n\tdirtyHandlerIds: DirtyHandlerIdsState\n\tdragOffset: DragOffsetState\n\trefCount: RefCountState\n\tdragOperation: DragOperationState\n\tstateId: StateIdState\n}\n\nexport function reduce(state: State = {} as State, action: Action<any>): State {\n\treturn {\n\t\tdirtyHandlerIds: dirtyHandlerIds(state.dirtyHandlerIds, {\n\t\t\ttype: action.type,\n\t\t\tpayload: {\n\t\t\t\t...action.payload,\n\t\t\t\tprevTargetIds: get<string[]>(state, 'dragOperation.targetIds', []),\n\t\t\t},\n\t\t}),\n\t\tdragOffset: dragOffset(state.dragOffset, action),\n\t\trefCount: refCount(state.refCount, action),\n\t\tdragOperation: dragOperation(state.dragOperation, action),\n\t\tstateId: stateId(state.stateId),\n\t}\n}\n"],"names":["get","reduce","dirtyHandlerIds","dragOffset","dragOperation","refCount","stateId","state","action","type","payload","prevTargetIds"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,GAAG,QAAQ,sBAAsB,CAAA;AAE1C,SAASC,MAAM,IAAIC,eAAe,QAAQ,sBAAsB,CAAA;AAEhE,SAASD,MAAM,IAAIE,UAAU,QAAQ,iBAAiB,CAAA;AAEtD,SAASF,MAAM,IAAIG,aAAa,QAAQ,oBAAoB,CAAA;AAE5D,SAASH,MAAM,IAAII,QAAQ,QAAQ,eAAe,CAAA;AAElD,SAASJ,MAAM,IAAIK,OAAO,QAAQ,cAAc,CAAA;AAUhD,OAAO,SAASL,MAAM,CAACM,KAAY,GAAG,EAAE,AAAS,EAAEC,MAAmB,EAAS;IAC9E,OAAO;QACNN,eAAe,EAAEA,eAAe,CAACK,KAAK,CAACL,eAAe,EAAE;YACvDO,IAAI,EAAED,MAAM,CAACC,IAAI;YACjBC,OAAO,EAAE,kBACLF,MAAM,CAACE,OAAO;gBACjBC,aAAa,EAAEX,GAAG,CAAWO,KAAK,EAAE,yBAAyB,EAAE,EAAE,CAAC;cAClE;SACD,CAAC;QACFJ,UAAU,EAAEA,UAAU,CAACI,KAAK,CAACJ,UAAU,EAAEK,MAAM,CAAC;QAChDH,QAAQ,EAAEA,QAAQ,CAACE,KAAK,CAACF,QAAQ,EAAEG,MAAM,CAAC;QAC1CJ,aAAa,EAAEA,aAAa,CAACG,KAAK,CAACH,aAAa,EAAEI,MAAM,CAAC;QACzDF,OAAO,EAAEA,OAAO,CAACC,KAAK,CAACD,OAAO,CAAC;KAC/B,CAAA;CACD"}
|
||||
3
frontend/node_modules/dnd-core/dist/reducers/refCount.d.ts
generated
vendored
3
frontend/node_modules/dnd-core/dist/reducers/refCount.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import type { Action } from '../interfaces.js';
|
||||
export declare type State = number;
|
||||
export declare function reduce(state: number | undefined, action: Action<any>): State;
|
||||
15
frontend/node_modules/dnd-core/dist/reducers/refCount.js
generated
vendored
15
frontend/node_modules/dnd-core/dist/reducers/refCount.js
generated
vendored
@@ -1,15 +0,0 @@
|
||||
import { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET } from '../actions/registry.js';
|
||||
export function reduce(state = 0, action) {
|
||||
switch(action.type){
|
||||
case ADD_SOURCE:
|
||||
case ADD_TARGET:
|
||||
return state + 1;
|
||||
case REMOVE_SOURCE:
|
||||
case REMOVE_TARGET:
|
||||
return state - 1;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=refCount.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/reducers/refCount.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/reducers/refCount.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/reducers/refCount.ts"],"sourcesContent":["import {\n\tADD_SOURCE,\n\tADD_TARGET,\n\tREMOVE_SOURCE,\n\tREMOVE_TARGET,\n} from '../actions/registry.js'\nimport type { Action } from '../interfaces.js'\n\nexport type State = number\n\nexport function reduce(state: State = 0, action: Action<any>): State {\n\tswitch (action.type) {\n\t\tcase ADD_SOURCE:\n\t\tcase ADD_TARGET:\n\t\t\treturn state + 1\n\t\tcase REMOVE_SOURCE:\n\t\tcase REMOVE_TARGET:\n\t\t\treturn state - 1\n\t\tdefault:\n\t\t\treturn state\n\t}\n}\n"],"names":["ADD_SOURCE","ADD_TARGET","REMOVE_SOURCE","REMOVE_TARGET","reduce","state","action","type"],"mappings":"AAAA,SACCA,UAAU,EACVC,UAAU,EACVC,aAAa,EACbC,aAAa,QACP,wBAAwB,CAAA;AAK/B,OAAO,SAASC,MAAM,CAACC,KAAY,GAAG,CAAC,EAAEC,MAAmB,EAAS;IACpE,OAAQA,MAAM,CAACC,IAAI;QAClB,KAAKP,UAAU,CAAC;QAChB,KAAKC,UAAU;YACd,OAAOI,KAAK,GAAG,CAAC,CAAA;QACjB,KAAKH,aAAa,CAAC;QACnB,KAAKC,aAAa;YACjB,OAAOE,KAAK,GAAG,CAAC,CAAA;QACjB;YACC,OAAOA,KAAK,CAAA;KACb;CACD"}
|
||||
2
frontend/node_modules/dnd-core/dist/reducers/stateId.d.ts
generated
vendored
2
frontend/node_modules/dnd-core/dist/reducers/stateId.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
export declare type State = number;
|
||||
export declare function reduce(state?: State): State;
|
||||
5
frontend/node_modules/dnd-core/dist/reducers/stateId.js
generated
vendored
5
frontend/node_modules/dnd-core/dist/reducers/stateId.js
generated
vendored
@@ -1,5 +0,0 @@
|
||||
export function reduce(state = 0) {
|
||||
return state + 1;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=stateId.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/reducers/stateId.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/reducers/stateId.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/reducers/stateId.ts"],"sourcesContent":["export type State = number\n\nexport function reduce(state: State = 0): State {\n\treturn state + 1\n}\n"],"names":["reduce","state"],"mappings":"AAEA,OAAO,SAASA,MAAM,CAACC,KAAY,GAAG,CAAC,EAAS;IAC/C,OAAOA,KAAK,GAAG,CAAC,CAAA;CAChB"}
|
||||
29
frontend/node_modules/dnd-core/dist/utils/coords.d.ts
generated
vendored
29
frontend/node_modules/dnd-core/dist/utils/coords.d.ts
generated
vendored
@@ -1,29 +0,0 @@
|
||||
import type { XYCoord } from '../interfaces.js';
|
||||
import type { State } from '../reducers/dragOffset.js';
|
||||
/**
|
||||
* Coordinate addition
|
||||
* @param a The first coordinate
|
||||
* @param b The second coordinate
|
||||
*/
|
||||
export declare function add(a: XYCoord, b: XYCoord): XYCoord;
|
||||
/**
|
||||
* Coordinate subtraction
|
||||
* @param a The first coordinate
|
||||
* @param b The second coordinate
|
||||
*/
|
||||
export declare function subtract(a: XYCoord, b: XYCoord): XYCoord;
|
||||
/**
|
||||
* Returns the cartesian distance of the drag source component's position, based on its position
|
||||
* at the time when the current drag operation has started, and the movement difference.
|
||||
*
|
||||
* Returns null if no item is being dragged.
|
||||
*
|
||||
* @param state The offset state to compute from
|
||||
*/
|
||||
export declare function getSourceClientOffset(state: State): XYCoord | null;
|
||||
/**
|
||||
* Determines the x,y offset between the client offset and the initial client offset
|
||||
*
|
||||
* @param state The offset state to compute from
|
||||
*/
|
||||
export declare function getDifferenceFromInitialOffset(state: State): XYCoord | null;
|
||||
47
frontend/node_modules/dnd-core/dist/utils/coords.js
generated
vendored
47
frontend/node_modules/dnd-core/dist/utils/coords.js
generated
vendored
@@ -1,47 +0,0 @@
|
||||
/**
|
||||
* Coordinate addition
|
||||
* @param a The first coordinate
|
||||
* @param b The second coordinate
|
||||
*/ export function add(a, b) {
|
||||
return {
|
||||
x: a.x + b.x,
|
||||
y: a.y + b.y
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Coordinate subtraction
|
||||
* @param a The first coordinate
|
||||
* @param b The second coordinate
|
||||
*/ export function subtract(a, b) {
|
||||
return {
|
||||
x: a.x - b.x,
|
||||
y: a.y - b.y
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Returns the cartesian distance of the drag source component's position, based on its position
|
||||
* at the time when the current drag operation has started, and the movement difference.
|
||||
*
|
||||
* Returns null if no item is being dragged.
|
||||
*
|
||||
* @param state The offset state to compute from
|
||||
*/ export function getSourceClientOffset(state) {
|
||||
const { clientOffset , initialClientOffset , initialSourceClientOffset } = state;
|
||||
if (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {
|
||||
return null;
|
||||
}
|
||||
return subtract(add(clientOffset, initialSourceClientOffset), initialClientOffset);
|
||||
}
|
||||
/**
|
||||
* Determines the x,y offset between the client offset and the initial client offset
|
||||
*
|
||||
* @param state The offset state to compute from
|
||||
*/ export function getDifferenceFromInitialOffset(state) {
|
||||
const { clientOffset , initialClientOffset } = state;
|
||||
if (!clientOffset || !initialClientOffset) {
|
||||
return null;
|
||||
}
|
||||
return subtract(clientOffset, initialClientOffset);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=coords.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/utils/coords.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/utils/coords.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/utils/coords.ts"],"sourcesContent":["import type { XYCoord } from '../interfaces.js'\nimport type { State } from '../reducers/dragOffset.js'\n\n/**\n * Coordinate addition\n * @param a The first coordinate\n * @param b The second coordinate\n */\nexport function add(a: XYCoord, b: XYCoord): XYCoord {\n\treturn {\n\t\tx: a.x + b.x,\n\t\ty: a.y + b.y,\n\t}\n}\n\n/**\n * Coordinate subtraction\n * @param a The first coordinate\n * @param b The second coordinate\n */\nexport function subtract(a: XYCoord, b: XYCoord): XYCoord {\n\treturn {\n\t\tx: a.x - b.x,\n\t\ty: a.y - b.y,\n\t}\n}\n\n/**\n * Returns the cartesian distance of the drag source component's position, based on its position\n * at the time when the current drag operation has started, and the movement difference.\n *\n * Returns null if no item is being dragged.\n *\n * @param state The offset state to compute from\n */\nexport function getSourceClientOffset(state: State): XYCoord | null {\n\tconst { clientOffset, initialClientOffset, initialSourceClientOffset } = state\n\tif (!clientOffset || !initialClientOffset || !initialSourceClientOffset) {\n\t\treturn null\n\t}\n\treturn subtract(\n\t\tadd(clientOffset, initialSourceClientOffset),\n\t\tinitialClientOffset,\n\t)\n}\n\n/**\n * Determines the x,y offset between the client offset and the initial client offset\n *\n * @param state The offset state to compute from\n */\nexport function getDifferenceFromInitialOffset(state: State): XYCoord | null {\n\tconst { clientOffset, initialClientOffset } = state\n\tif (!clientOffset || !initialClientOffset) {\n\t\treturn null\n\t}\n\treturn subtract(clientOffset, initialClientOffset)\n}\n"],"names":["add","a","b","x","y","subtract","getSourceClientOffset","state","clientOffset","initialClientOffset","initialSourceClientOffset","getDifferenceFromInitialOffset"],"mappings":"AAGA;;;;GAIG,CACH,OAAO,SAASA,GAAG,CAACC,CAAU,EAAEC,CAAU,EAAW;IACpD,OAAO;QACNC,CAAC,EAAEF,CAAC,CAACE,CAAC,GAAGD,CAAC,CAACC,CAAC;QACZC,CAAC,EAAEH,CAAC,CAACG,CAAC,GAAGF,CAAC,CAACE,CAAC;KACZ,CAAA;CACD;AAED;;;;GAIG,CACH,OAAO,SAASC,QAAQ,CAACJ,CAAU,EAAEC,CAAU,EAAW;IACzD,OAAO;QACNC,CAAC,EAAEF,CAAC,CAACE,CAAC,GAAGD,CAAC,CAACC,CAAC;QACZC,CAAC,EAAEH,CAAC,CAACG,CAAC,GAAGF,CAAC,CAACE,CAAC;KACZ,CAAA;CACD;AAED;;;;;;;GAOG,CACH,OAAO,SAASE,qBAAqB,CAACC,KAAY,EAAkB;IACnE,MAAM,EAAEC,YAAY,CAAA,EAAEC,mBAAmB,CAAA,EAAEC,yBAAyB,CAAA,EAAE,GAAGH,KAAK;IAC9E,IAAI,CAACC,YAAY,IAAI,CAACC,mBAAmB,IAAI,CAACC,yBAAyB,EAAE;QACxE,OAAO,IAAI,CAAA;KACX;IACD,OAAOL,QAAQ,CACdL,GAAG,CAACQ,YAAY,EAAEE,yBAAyB,CAAC,EAC5CD,mBAAmB,CACnB,CAAA;CACD;AAED;;;;GAIG,CACH,OAAO,SAASE,8BAA8B,CAACJ,KAAY,EAAkB;IAC5E,MAAM,EAAEC,YAAY,CAAA,EAAEC,mBAAmB,CAAA,EAAE,GAAGF,KAAK;IACnD,IAAI,CAACC,YAAY,IAAI,CAACC,mBAAmB,EAAE;QAC1C,OAAO,IAAI,CAAA;KACX;IACD,OAAOJ,QAAQ,CAACG,YAAY,EAAEC,mBAAmB,CAAC,CAAA;CAClD"}
|
||||
9
frontend/node_modules/dnd-core/dist/utils/dirtiness.d.ts
generated
vendored
9
frontend/node_modules/dnd-core/dist/utils/dirtiness.d.ts
generated
vendored
@@ -1,9 +0,0 @@
|
||||
export declare const NONE: string[];
|
||||
export declare const ALL: string[];
|
||||
/**
|
||||
* Determines if the given handler IDs are dirty or not.
|
||||
*
|
||||
* @param dirtyIds The set of dirty handler ids
|
||||
* @param handlerIds The set of handler ids to check
|
||||
*/
|
||||
export declare function areDirty(dirtyIds: string[], handlerIds: string[] | undefined): boolean;
|
||||
22
frontend/node_modules/dnd-core/dist/utils/dirtiness.js
generated
vendored
22
frontend/node_modules/dnd-core/dist/utils/dirtiness.js
generated
vendored
@@ -1,22 +0,0 @@
|
||||
import { intersection } from './js_utils.js';
|
||||
export const NONE = [];
|
||||
export const ALL = [];
|
||||
NONE.__IS_NONE__ = true;
|
||||
ALL.__IS_ALL__ = true;
|
||||
/**
|
||||
* Determines if the given handler IDs are dirty or not.
|
||||
*
|
||||
* @param dirtyIds The set of dirty handler ids
|
||||
* @param handlerIds The set of handler ids to check
|
||||
*/ export function areDirty(dirtyIds, handlerIds) {
|
||||
if (dirtyIds === NONE) {
|
||||
return false;
|
||||
}
|
||||
if (dirtyIds === ALL || typeof handlerIds === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
const commonIds = intersection(handlerIds, dirtyIds);
|
||||
return commonIds.length > 0;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=dirtiness.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/utils/dirtiness.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/utils/dirtiness.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/utils/dirtiness.ts"],"sourcesContent":["import { intersection } from './js_utils.js'\n\nexport const NONE: string[] = []\nexport const ALL: string[] = []\n// Add these flags for debug\n;(NONE as any).__IS_NONE__ = true\n;(ALL as any).__IS_ALL__ = true\n\n/**\n * Determines if the given handler IDs are dirty or not.\n *\n * @param dirtyIds The set of dirty handler ids\n * @param handlerIds The set of handler ids to check\n */\nexport function areDirty(\n\tdirtyIds: string[],\n\thandlerIds: string[] | undefined,\n): boolean {\n\tif (dirtyIds === NONE) {\n\t\treturn false\n\t}\n\n\tif (dirtyIds === ALL || typeof handlerIds === 'undefined') {\n\t\treturn true\n\t}\n\n\tconst commonIds = intersection(handlerIds, dirtyIds)\n\treturn commonIds.length > 0\n}\n"],"names":["intersection","NONE","ALL","__IS_NONE__","__IS_ALL__","areDirty","dirtyIds","handlerIds","commonIds","length"],"mappings":"AAAA,SAASA,YAAY,QAAQ,eAAe,CAAA;AAE5C,OAAO,MAAMC,IAAI,GAAa,EAAE,CAAA;AAChC,OAAO,MAAMC,GAAG,GAAa,EAAE,CAE9B;AAAA,AAACD,IAAI,CAASE,WAAW,GAAG,IAAI,CAChC;AAAA,AAACD,GAAG,CAASE,UAAU,GAAG,IAAI;AAE/B;;;;;GAKG,CACH,OAAO,SAASC,QAAQ,CACvBC,QAAkB,EAClBC,UAAgC,EACtB;IACV,IAAID,QAAQ,KAAKL,IAAI,EAAE;QACtB,OAAO,KAAK,CAAA;KACZ;IAED,IAAIK,QAAQ,KAAKJ,GAAG,IAAI,OAAOK,UAAU,KAAK,WAAW,EAAE;QAC1D,OAAO,IAAI,CAAA;KACX;IAED,MAAMC,SAAS,GAAGR,YAAY,CAACO,UAAU,EAAED,QAAQ,CAAC;IACpD,OAAOE,SAAS,CAACC,MAAM,GAAG,CAAC,CAAA;CAC3B"}
|
||||
15
frontend/node_modules/dnd-core/dist/utils/equality.d.ts
generated
vendored
15
frontend/node_modules/dnd-core/dist/utils/equality.d.ts
generated
vendored
@@ -1,15 +0,0 @@
|
||||
import type { XYCoord } from '../interfaces.js';
|
||||
export declare type EqualityCheck<T> = (a: T, b: T) => boolean;
|
||||
export declare const strictEquality: <T>(a: T, b: T) => boolean;
|
||||
/**
|
||||
* Determine if two cartesian coordinate offsets are equal
|
||||
* @param offsetA
|
||||
* @param offsetB
|
||||
*/
|
||||
export declare function areCoordsEqual(offsetA: XYCoord | null | undefined, offsetB: XYCoord | null | undefined): boolean;
|
||||
/**
|
||||
* Determines if two arrays of items are equal
|
||||
* @param a The first array of items
|
||||
* @param b The second array of items
|
||||
*/
|
||||
export declare function areArraysEqual<T>(a: T[], b: T[], isEqual?: EqualityCheck<T>): boolean;
|
||||
32
frontend/node_modules/dnd-core/dist/utils/equality.js
generated
vendored
32
frontend/node_modules/dnd-core/dist/utils/equality.js
generated
vendored
@@ -1,32 +0,0 @@
|
||||
export const strictEquality = (a, b)=>a === b
|
||||
;
|
||||
/**
|
||||
* Determine if two cartesian coordinate offsets are equal
|
||||
* @param offsetA
|
||||
* @param offsetB
|
||||
*/ export function areCoordsEqual(offsetA, offsetB) {
|
||||
if (!offsetA && !offsetB) {
|
||||
return true;
|
||||
} else if (!offsetA || !offsetB) {
|
||||
return false;
|
||||
} else {
|
||||
return offsetA.x === offsetB.x && offsetA.y === offsetB.y;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Determines if two arrays of items are equal
|
||||
* @param a The first array of items
|
||||
* @param b The second array of items
|
||||
*/ export function areArraysEqual(a, b, isEqual = strictEquality) {
|
||||
if (a.length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
for(let i = 0; i < a.length; ++i){
|
||||
if (!isEqual(a[i], b[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=equality.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/utils/equality.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/utils/equality.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/utils/equality.ts"],"sourcesContent":["import type { XYCoord } from '../interfaces.js'\n\nexport type EqualityCheck<T> = (a: T, b: T) => boolean\nexport const strictEquality = <T>(a: T, b: T): boolean => a === b\n\n/**\n * Determine if two cartesian coordinate offsets are equal\n * @param offsetA\n * @param offsetB\n */\nexport function areCoordsEqual(\n\toffsetA: XYCoord | null | undefined,\n\toffsetB: XYCoord | null | undefined,\n): boolean {\n\tif (!offsetA && !offsetB) {\n\t\treturn true\n\t} else if (!offsetA || !offsetB) {\n\t\treturn false\n\t} else {\n\t\treturn offsetA.x === offsetB.x && offsetA.y === offsetB.y\n\t}\n}\n\n/**\n * Determines if two arrays of items are equal\n * @param a The first array of items\n * @param b The second array of items\n */\nexport function areArraysEqual<T>(\n\ta: T[],\n\tb: T[],\n\tisEqual: EqualityCheck<T> = strictEquality,\n): boolean {\n\tif (a.length !== b.length) {\n\t\treturn false\n\t}\n\tfor (let i = 0; i < a.length; ++i) {\n\t\tif (!isEqual(a[i] as T, b[i] as T)) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n"],"names":["strictEquality","a","b","areCoordsEqual","offsetA","offsetB","x","y","areArraysEqual","isEqual","length","i"],"mappings":"AAGA,OAAO,MAAMA,cAAc,GAAG,CAAIC,CAAI,EAAEC,CAAI,GAAcD,CAAC,KAAKC,CAAC;AAAA,CAAA;AAEjE;;;;GAIG,CACH,OAAO,SAASC,cAAc,CAC7BC,OAAmC,EACnCC,OAAmC,EACzB;IACV,IAAI,CAACD,OAAO,IAAI,CAACC,OAAO,EAAE;QACzB,OAAO,IAAI,CAAA;KACX,MAAM,IAAI,CAACD,OAAO,IAAI,CAACC,OAAO,EAAE;QAChC,OAAO,KAAK,CAAA;KACZ,MAAM;QACN,OAAOD,OAAO,CAACE,CAAC,KAAKD,OAAO,CAACC,CAAC,IAAIF,OAAO,CAACG,CAAC,KAAKF,OAAO,CAACE,CAAC,CAAA;KACzD;CACD;AAED;;;;GAIG,CACH,OAAO,SAASC,cAAc,CAC7BP,CAAM,EACNC,CAAM,EACNO,OAAyB,GAAGT,cAAc,EAChC;IACV,IAAIC,CAAC,CAACS,MAAM,KAAKR,CAAC,CAACQ,MAAM,EAAE;QAC1B,OAAO,KAAK,CAAA;KACZ;IACD,IAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGV,CAAC,CAACS,MAAM,EAAE,EAAEC,CAAC,CAAE;QAClC,IAAI,CAACF,OAAO,CAACR,CAAC,CAACU,CAAC,CAAC,EAAOT,CAAC,CAACS,CAAC,CAAC,CAAM,EAAE;YACnC,OAAO,KAAK,CAAA;SACZ;KACD;IACD,OAAO,IAAI,CAAA;CACX"}
|
||||
1
frontend/node_modules/dnd-core/dist/utils/getNextUniqueId.d.ts
generated
vendored
1
frontend/node_modules/dnd-core/dist/utils/getNextUniqueId.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export declare function getNextUniqueId(): number;
|
||||
6
frontend/node_modules/dnd-core/dist/utils/getNextUniqueId.js
generated
vendored
6
frontend/node_modules/dnd-core/dist/utils/getNextUniqueId.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
let nextUniqueId = 0;
|
||||
export function getNextUniqueId() {
|
||||
return nextUniqueId++;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=getNextUniqueId.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/utils/getNextUniqueId.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/utils/getNextUniqueId.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/utils/getNextUniqueId.ts"],"sourcesContent":["let nextUniqueId = 0\n\nexport function getNextUniqueId(): number {\n\treturn nextUniqueId++\n}\n"],"names":["nextUniqueId","getNextUniqueId"],"mappings":"AAAA,IAAIA,YAAY,GAAG,CAAC;AAEpB,OAAO,SAASC,eAAe,GAAW;IACzC,OAAOD,YAAY,EAAE,CAAA;CACrB"}
|
||||
33
frontend/node_modules/dnd-core/dist/utils/js_utils.d.ts
generated
vendored
33
frontend/node_modules/dnd-core/dist/utils/js_utils.d.ts
generated
vendored
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* drop-in replacement for _.get
|
||||
* @param obj
|
||||
* @param path
|
||||
* @param defaultValue
|
||||
*/
|
||||
export declare function get<T>(obj: any, path: string, defaultValue: T): T;
|
||||
/**
|
||||
* drop-in replacement for _.without
|
||||
*/
|
||||
export declare function without<T>(items: T[], item: T): T[];
|
||||
/**
|
||||
* drop-in replacement for _.isString
|
||||
* @param input
|
||||
*/
|
||||
export declare function isString(input: any): boolean;
|
||||
/**
|
||||
* drop-in replacement for _.isString
|
||||
* @param input
|
||||
*/
|
||||
export declare function isObject(input: any): boolean;
|
||||
/**
|
||||
* replacement for _.xor
|
||||
* @param itemsA
|
||||
* @param itemsB
|
||||
*/
|
||||
export declare function xor<T extends string | number>(itemsA: T[], itemsB: T[]): T[];
|
||||
/**
|
||||
* replacement for _.intersection
|
||||
* @param itemsA
|
||||
* @param itemsB
|
||||
*/
|
||||
export declare function intersection<T>(itemsA: T[], itemsB: T[]): T[];
|
||||
57
frontend/node_modules/dnd-core/dist/utils/js_utils.js
generated
vendored
57
frontend/node_modules/dnd-core/dist/utils/js_utils.js
generated
vendored
@@ -1,57 +0,0 @@
|
||||
// cheap lodash replacements
|
||||
/**
|
||||
* drop-in replacement for _.get
|
||||
* @param obj
|
||||
* @param path
|
||||
* @param defaultValue
|
||||
*/ export function get(obj, path, defaultValue) {
|
||||
return path.split('.').reduce((a, c)=>a && a[c] ? a[c] : defaultValue || null
|
||||
, obj);
|
||||
}
|
||||
/**
|
||||
* drop-in replacement for _.without
|
||||
*/ export function without(items, item) {
|
||||
return items.filter((i)=>i !== item
|
||||
);
|
||||
}
|
||||
/**
|
||||
* drop-in replacement for _.isString
|
||||
* @param input
|
||||
*/ export function isString(input) {
|
||||
return typeof input === 'string';
|
||||
}
|
||||
/**
|
||||
* drop-in replacement for _.isString
|
||||
* @param input
|
||||
*/ export function isObject(input) {
|
||||
return typeof input === 'object';
|
||||
}
|
||||
/**
|
||||
* replacement for _.xor
|
||||
* @param itemsA
|
||||
* @param itemsB
|
||||
*/ export function xor(itemsA, itemsB) {
|
||||
const map = new Map();
|
||||
const insertItem = (item)=>{
|
||||
map.set(item, map.has(item) ? map.get(item) + 1 : 1);
|
||||
};
|
||||
itemsA.forEach(insertItem);
|
||||
itemsB.forEach(insertItem);
|
||||
const result = [];
|
||||
map.forEach((count, key)=>{
|
||||
if (count === 1) {
|
||||
result.push(key);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* replacement for _.intersection
|
||||
* @param itemsA
|
||||
* @param itemsB
|
||||
*/ export function intersection(itemsA, itemsB) {
|
||||
return itemsA.filter((t)=>itemsB.indexOf(t) > -1
|
||||
);
|
||||
}
|
||||
|
||||
//# sourceMappingURL=js_utils.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/utils/js_utils.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/utils/js_utils.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/utils/js_utils.ts"],"sourcesContent":["// cheap lodash replacements\n\n/**\n * drop-in replacement for _.get\n * @param obj\n * @param path\n * @param defaultValue\n */\nexport function get<T>(obj: any, path: string, defaultValue: T): T {\n\treturn path\n\t\t.split('.')\n\t\t.reduce((a, c) => (a && a[c] ? a[c] : defaultValue || null), obj) as T\n}\n\n/**\n * drop-in replacement for _.without\n */\nexport function without<T>(items: T[], item: T): T[] {\n\treturn items.filter((i) => i !== item)\n}\n\n/**\n * drop-in replacement for _.isString\n * @param input\n */\nexport function isString(input: any): boolean {\n\treturn typeof input === 'string'\n}\n\n/**\n * drop-in replacement for _.isString\n * @param input\n */\nexport function isObject(input: any): boolean {\n\treturn typeof input === 'object'\n}\n\n/**\n * replacement for _.xor\n * @param itemsA\n * @param itemsB\n */\nexport function xor<T extends string | number>(itemsA: T[], itemsB: T[]): T[] {\n\tconst map = new Map<T, number>()\n\tconst insertItem = (item: T) => {\n\t\tmap.set(item, map.has(item) ? (map.get(item) as number) + 1 : 1)\n\t}\n\titemsA.forEach(insertItem)\n\titemsB.forEach(insertItem)\n\n\tconst result: T[] = []\n\tmap.forEach((count, key) => {\n\t\tif (count === 1) {\n\t\t\tresult.push(key)\n\t\t}\n\t})\n\treturn result\n}\n\n/**\n * replacement for _.intersection\n * @param itemsA\n * @param itemsB\n */\nexport function intersection<T>(itemsA: T[], itemsB: T[]): T[] {\n\treturn itemsA.filter((t) => itemsB.indexOf(t) > -1)\n}\n"],"names":["get","obj","path","defaultValue","split","reduce","a","c","without","items","item","filter","i","isString","input","isObject","xor","itemsA","itemsB","map","Map","insertItem","set","has","forEach","result","count","key","push","intersection","t","indexOf"],"mappings":"AAAA,4BAA4B;AAE5B;;;;;GAKG,CACH,OAAO,SAASA,GAAG,CAAIC,GAAQ,EAAEC,IAAY,EAAEC,YAAe,EAAK;IAClE,OAAOD,IAAI,CACTE,KAAK,CAAC,GAAG,CAAC,CACVC,MAAM,CAAC,CAACC,CAAC,EAAEC,CAAC,GAAMD,CAAC,IAAIA,CAAC,CAACC,CAAC,CAAC,GAAGD,CAAC,CAACC,CAAC,CAAC,GAAGJ,YAAY,IAAI,IAAI;IAAC,EAAEF,GAAG,CAAC,CAAK;CACvE;AAED;;GAEG,CACH,OAAO,SAASO,OAAO,CAAIC,KAAU,EAAEC,IAAO,EAAO;IACpD,OAAOD,KAAK,CAACE,MAAM,CAAC,CAACC,CAAC,GAAKA,CAAC,KAAKF,IAAI;IAAA,CAAC,CAAA;CACtC;AAED;;;GAGG,CACH,OAAO,SAASG,QAAQ,CAACC,KAAU,EAAW;IAC7C,OAAO,OAAOA,KAAK,KAAK,QAAQ,CAAA;CAChC;AAED;;;GAGG,CACH,OAAO,SAASC,QAAQ,CAACD,KAAU,EAAW;IAC7C,OAAO,OAAOA,KAAK,KAAK,QAAQ,CAAA;CAChC;AAED;;;;GAIG,CACH,OAAO,SAASE,GAAG,CAA4BC,MAAW,EAAEC,MAAW,EAAO;IAC7E,MAAMC,GAAG,GAAG,IAAIC,GAAG,EAAa;IAChC,MAAMC,UAAU,GAAG,CAACX,IAAO,GAAK;QAC/BS,GAAG,CAACG,GAAG,CAACZ,IAAI,EAAES,GAAG,CAACI,GAAG,CAACb,IAAI,CAAC,GAAG,AAACS,GAAG,CAACnB,GAAG,CAACU,IAAI,CAAC,GAAc,CAAC,GAAG,CAAC,CAAC;KAChE;IACDO,MAAM,CAACO,OAAO,CAACH,UAAU,CAAC;IAC1BH,MAAM,CAACM,OAAO,CAACH,UAAU,CAAC;IAE1B,MAAMI,MAAM,GAAQ,EAAE;IACtBN,GAAG,CAACK,OAAO,CAAC,CAACE,KAAK,EAAEC,GAAG,GAAK;QAC3B,IAAID,KAAK,KAAK,CAAC,EAAE;YAChBD,MAAM,CAACG,IAAI,CAACD,GAAG,CAAC;SAChB;KACD,CAAC;IACF,OAAOF,MAAM,CAAA;CACb;AAED;;;;GAIG,CACH,OAAO,SAASI,YAAY,CAAIZ,MAAW,EAAEC,MAAW,EAAO;IAC9D,OAAOD,MAAM,CAACN,MAAM,CAAC,CAACmB,CAAC,GAAKZ,MAAM,CAACa,OAAO,CAACD,CAAC,CAAC,GAAG,CAAC,CAAC;IAAA,CAAC,CAAA;CACnD"}
|
||||
2
frontend/node_modules/dnd-core/dist/utils/matchesType.d.ts
generated
vendored
2
frontend/node_modules/dnd-core/dist/utils/matchesType.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import type { Identifier } from '../interfaces.js';
|
||||
export declare function matchesType(targetType: Identifier | Identifier[] | null, draggedItemType: Identifier | null): boolean;
|
||||
9
frontend/node_modules/dnd-core/dist/utils/matchesType.js
generated
vendored
9
frontend/node_modules/dnd-core/dist/utils/matchesType.js
generated
vendored
@@ -1,9 +0,0 @@
|
||||
export function matchesType(targetType, draggedItemType) {
|
||||
if (draggedItemType === null) {
|
||||
return targetType === null;
|
||||
}
|
||||
return Array.isArray(targetType) ? targetType.some((t)=>t === draggedItemType
|
||||
) : targetType === draggedItemType;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=matchesType.js.map
|
||||
1
frontend/node_modules/dnd-core/dist/utils/matchesType.js.map
generated
vendored
1
frontend/node_modules/dnd-core/dist/utils/matchesType.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/utils/matchesType.ts"],"sourcesContent":["import type { Identifier } from '../interfaces.js'\n\nexport function matchesType(\n\ttargetType: Identifier | Identifier[] | null,\n\tdraggedItemType: Identifier | null,\n): boolean {\n\tif (draggedItemType === null) {\n\t\treturn targetType === null\n\t}\n\treturn Array.isArray(targetType)\n\t\t? (targetType as Identifier[]).some((t) => t === draggedItemType)\n\t\t: targetType === draggedItemType\n}\n"],"names":["matchesType","targetType","draggedItemType","Array","isArray","some","t"],"mappings":"AAEA,OAAO,SAASA,WAAW,CAC1BC,UAA4C,EAC5CC,eAAkC,EACxB;IACV,IAAIA,eAAe,KAAK,IAAI,EAAE;QAC7B,OAAOD,UAAU,KAAK,IAAI,CAAA;KAC1B;IACD,OAAOE,KAAK,CAACC,OAAO,CAACH,UAAU,CAAC,GAC7B,AAACA,UAAU,CAAkBI,IAAI,CAAC,CAACC,CAAC,GAAKA,CAAC,KAAKJ,eAAe;IAAA,CAAC,GAC/DD,UAAU,KAAKC,eAAe,CAAA;CACjC"}
|
||||
37
frontend/node_modules/dnd-core/package.json
generated
vendored
37
frontend/node_modules/dnd-core/package.json
generated
vendored
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"name": "dnd-core",
|
||||
"version": "16.0.1",
|
||||
"description": "Drag and drop sans the GUI",
|
||||
"license": "MIT",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"clean": "shx rm -rf dist/",
|
||||
"build_types": "tsc -b .",
|
||||
"build_esm": "swc -C module.type=es6 -d dist src/",
|
||||
"build": "run-s build_types build_esm"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/react-dnd/react-dnd.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-dnd/asap": "^5.0.1",
|
||||
"@react-dnd/invariant": "^4.0.1",
|
||||
"redux": "^4.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.57",
|
||||
"@swc/core": "^1.2.168",
|
||||
"@types/jest": "^27.4.1",
|
||||
"@types/setimmediate": "^1.0.2",
|
||||
"jest-mock": "^27.5.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"react-dnd-test-backend": "portal:../backend-test",
|
||||
"setimmediate": "^1.0.5",
|
||||
"shx": "^0.3.4",
|
||||
"typescript": "^4.6.3"
|
||||
}
|
||||
}
|
||||
123
frontend/node_modules/dnd-core/src/actions/dragDrop/beginDrag.ts
generated
vendored
123
frontend/node_modules/dnd-core/src/actions/dragDrop/beginDrag.ts
generated
vendored
@@ -1,123 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant'
|
||||
|
||||
import type {
|
||||
Action,
|
||||
BeginDragOptions,
|
||||
BeginDragPayload,
|
||||
DragDropManager,
|
||||
DragDropMonitor,
|
||||
HandlerRegistry,
|
||||
Identifier,
|
||||
XYCoord,
|
||||
} from '../../interfaces.js'
|
||||
import { isObject } from '../../utils/js_utils.js'
|
||||
import { setClientOffset } from './local/setClientOffset.js'
|
||||
import { BEGIN_DRAG, INIT_COORDS } from './types.js'
|
||||
|
||||
const ResetCoordinatesAction = {
|
||||
type: INIT_COORDS,
|
||||
payload: {
|
||||
clientOffset: null,
|
||||
sourceClientOffset: null,
|
||||
},
|
||||
}
|
||||
|
||||
export function createBeginDrag(manager: DragDropManager) {
|
||||
return function beginDrag(
|
||||
sourceIds: Identifier[] = [],
|
||||
options: BeginDragOptions = {
|
||||
publishSource: true,
|
||||
},
|
||||
): Action<BeginDragPayload> | undefined {
|
||||
const {
|
||||
publishSource = true,
|
||||
clientOffset,
|
||||
getSourceClientOffset,
|
||||
}: BeginDragOptions = options
|
||||
const monitor = manager.getMonitor()
|
||||
const registry = manager.getRegistry()
|
||||
|
||||
// Initialize the coordinates using the client offset
|
||||
manager.dispatch(setClientOffset(clientOffset))
|
||||
|
||||
verifyInvariants(sourceIds, monitor, registry)
|
||||
|
||||
// Get the draggable source
|
||||
const sourceId = getDraggableSource(sourceIds, monitor)
|
||||
if (sourceId == null) {
|
||||
manager.dispatch(ResetCoordinatesAction)
|
||||
return
|
||||
}
|
||||
|
||||
// Get the source client offset
|
||||
let sourceClientOffset: XYCoord | null = null
|
||||
if (clientOffset) {
|
||||
if (!getSourceClientOffset) {
|
||||
throw new Error('getSourceClientOffset must be defined')
|
||||
}
|
||||
verifyGetSourceClientOffsetIsFunction(getSourceClientOffset)
|
||||
sourceClientOffset = getSourceClientOffset(sourceId)
|
||||
}
|
||||
|
||||
// Initialize the full coordinates
|
||||
manager.dispatch(setClientOffset(clientOffset, sourceClientOffset))
|
||||
|
||||
const source = registry.getSource(sourceId)
|
||||
const item = source.beginDrag(monitor, sourceId)
|
||||
// If source.beginDrag returns null, this is an indicator to cancel the drag
|
||||
if (item == null) {
|
||||
return undefined
|
||||
}
|
||||
verifyItemIsObject(item)
|
||||
registry.pinSource(sourceId)
|
||||
|
||||
const itemType = registry.getSourceType(sourceId)
|
||||
return {
|
||||
type: BEGIN_DRAG,
|
||||
payload: {
|
||||
itemType,
|
||||
item,
|
||||
sourceId,
|
||||
clientOffset: clientOffset || null,
|
||||
sourceClientOffset: sourceClientOffset || null,
|
||||
isSourcePublic: !!publishSource,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function verifyInvariants(
|
||||
sourceIds: Identifier[],
|
||||
monitor: DragDropMonitor,
|
||||
registry: HandlerRegistry,
|
||||
) {
|
||||
invariant(!monitor.isDragging(), 'Cannot call beginDrag while dragging.')
|
||||
sourceIds.forEach(function (sourceId) {
|
||||
invariant(
|
||||
registry.getSource(sourceId),
|
||||
'Expected sourceIds to be registered.',
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset: any) {
|
||||
invariant(
|
||||
typeof getSourceClientOffset === 'function',
|
||||
'When clientOffset is provided, getSourceClientOffset must be a function.',
|
||||
)
|
||||
}
|
||||
|
||||
function verifyItemIsObject(item: any) {
|
||||
invariant(isObject(item), 'Item must be an object.')
|
||||
}
|
||||
|
||||
function getDraggableSource(sourceIds: Identifier[], monitor: DragDropMonitor) {
|
||||
let sourceId = null
|
||||
for (let i = sourceIds.length - 1; i >= 0; i--) {
|
||||
if (monitor.canDragSource(sourceIds[i])) {
|
||||
sourceId = sourceIds[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
return sourceId
|
||||
}
|
||||
74
frontend/node_modules/dnd-core/src/actions/dragDrop/drop.ts
generated
vendored
74
frontend/node_modules/dnd-core/src/actions/dragDrop/drop.ts
generated
vendored
@@ -1,74 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant'
|
||||
|
||||
import type {
|
||||
Action,
|
||||
DragDropManager,
|
||||
DragDropMonitor,
|
||||
DropPayload,
|
||||
HandlerRegistry,
|
||||
Identifier,
|
||||
} from '../../interfaces.js'
|
||||
import { isObject } from '../../utils/js_utils.js'
|
||||
import { DROP } from './types.js'
|
||||
|
||||
export function createDrop(manager: DragDropManager) {
|
||||
return function drop(options = {}): void {
|
||||
const monitor = manager.getMonitor()
|
||||
const registry = manager.getRegistry()
|
||||
verifyInvariants(monitor)
|
||||
const targetIds = getDroppableTargets(monitor)
|
||||
|
||||
// Multiple actions are dispatched here, which is why this doesn't return an action
|
||||
targetIds.forEach((targetId, index) => {
|
||||
const dropResult = determineDropResult(targetId, index, registry, monitor)
|
||||
const action: Action<DropPayload> = {
|
||||
type: DROP,
|
||||
payload: {
|
||||
dropResult: {
|
||||
...options,
|
||||
...dropResult,
|
||||
},
|
||||
},
|
||||
}
|
||||
manager.dispatch(action)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function verifyInvariants(monitor: DragDropMonitor) {
|
||||
invariant(monitor.isDragging(), 'Cannot call drop while not dragging.')
|
||||
invariant(
|
||||
!monitor.didDrop(),
|
||||
'Cannot call drop twice during one drag operation.',
|
||||
)
|
||||
}
|
||||
|
||||
function determineDropResult(
|
||||
targetId: Identifier,
|
||||
index: number,
|
||||
registry: HandlerRegistry,
|
||||
monitor: DragDropMonitor,
|
||||
) {
|
||||
const target = registry.getTarget(targetId)
|
||||
let dropResult = target ? target.drop(monitor, targetId) : undefined
|
||||
verifyDropResultType(dropResult)
|
||||
if (typeof dropResult === 'undefined') {
|
||||
dropResult = index === 0 ? {} : monitor.getDropResult()
|
||||
}
|
||||
return dropResult
|
||||
}
|
||||
|
||||
function verifyDropResultType(dropResult: any) {
|
||||
invariant(
|
||||
typeof dropResult === 'undefined' || isObject(dropResult),
|
||||
'Drop result must either be an object or undefined.',
|
||||
)
|
||||
}
|
||||
|
||||
function getDroppableTargets(monitor: DragDropMonitor) {
|
||||
const targetIds = monitor
|
||||
.getTargetIds()
|
||||
.filter(monitor.canDropOnTarget, monitor)
|
||||
targetIds.reverse()
|
||||
return targetIds
|
||||
}
|
||||
28
frontend/node_modules/dnd-core/src/actions/dragDrop/endDrag.ts
generated
vendored
28
frontend/node_modules/dnd-core/src/actions/dragDrop/endDrag.ts
generated
vendored
@@ -1,28 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant'
|
||||
|
||||
import type {
|
||||
DragDropManager,
|
||||
DragDropMonitor,
|
||||
SentinelAction,
|
||||
} from '../../interfaces.js'
|
||||
import { END_DRAG } from './types.js'
|
||||
|
||||
export function createEndDrag(manager: DragDropManager) {
|
||||
return function endDrag(): SentinelAction {
|
||||
const monitor = manager.getMonitor()
|
||||
const registry = manager.getRegistry()
|
||||
verifyIsDragging(monitor)
|
||||
|
||||
const sourceId = monitor.getSourceId()
|
||||
if (sourceId != null) {
|
||||
const source = registry.getSource(sourceId, true)
|
||||
source.endDrag(monitor, sourceId)
|
||||
registry.unpinSource()
|
||||
}
|
||||
return { type: END_DRAG }
|
||||
}
|
||||
}
|
||||
|
||||
function verifyIsDragging(monitor: DragDropMonitor) {
|
||||
invariant(monitor.isDragging(), 'Cannot call endDrag while not dragging.')
|
||||
}
|
||||
89
frontend/node_modules/dnd-core/src/actions/dragDrop/hover.ts
generated
vendored
89
frontend/node_modules/dnd-core/src/actions/dragDrop/hover.ts
generated
vendored
@@ -1,89 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant'
|
||||
|
||||
import type {
|
||||
Action,
|
||||
DragDropManager,
|
||||
DragDropMonitor,
|
||||
HandlerRegistry,
|
||||
HoverOptions,
|
||||
HoverPayload,
|
||||
Identifier,
|
||||
} from '../../interfaces.js'
|
||||
import { matchesType } from '../../utils/matchesType.js'
|
||||
import { HOVER } from './types.js'
|
||||
|
||||
export function createHover(manager: DragDropManager) {
|
||||
return function hover(
|
||||
targetIdsArg: string[],
|
||||
{ clientOffset }: HoverOptions = {},
|
||||
): Action<HoverPayload> {
|
||||
verifyTargetIdsIsArray(targetIdsArg)
|
||||
const targetIds = targetIdsArg.slice(0)
|
||||
const monitor = manager.getMonitor()
|
||||
const registry = manager.getRegistry()
|
||||
const draggedItemType = monitor.getItemType()
|
||||
removeNonMatchingTargetIds(targetIds, registry, draggedItemType)
|
||||
checkInvariants(targetIds, monitor, registry)
|
||||
hoverAllTargets(targetIds, monitor, registry)
|
||||
|
||||
return {
|
||||
type: HOVER,
|
||||
payload: {
|
||||
targetIds,
|
||||
clientOffset: clientOffset || null,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function verifyTargetIdsIsArray(targetIdsArg: string[]) {
|
||||
invariant(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.')
|
||||
}
|
||||
|
||||
function checkInvariants(
|
||||
targetIds: string[],
|
||||
monitor: DragDropMonitor,
|
||||
registry: HandlerRegistry,
|
||||
) {
|
||||
invariant(monitor.isDragging(), 'Cannot call hover while not dragging.')
|
||||
invariant(!monitor.didDrop(), 'Cannot call hover after drop.')
|
||||
for (let i = 0; i < targetIds.length; i++) {
|
||||
const targetId = targetIds[i] as string
|
||||
invariant(
|
||||
targetIds.lastIndexOf(targetId) === i,
|
||||
'Expected targetIds to be unique in the passed array.',
|
||||
)
|
||||
|
||||
const target = registry.getTarget(targetId)
|
||||
invariant(target, 'Expected targetIds to be registered.')
|
||||
}
|
||||
}
|
||||
|
||||
function removeNonMatchingTargetIds(
|
||||
targetIds: string[],
|
||||
registry: HandlerRegistry,
|
||||
draggedItemType: Identifier | null,
|
||||
) {
|
||||
// Remove those targetIds that don't match the targetType. This
|
||||
// fixes shallow isOver which would only be non-shallow because of
|
||||
// non-matching targets.
|
||||
for (let i = targetIds.length - 1; i >= 0; i--) {
|
||||
const targetId = targetIds[i] as string
|
||||
const targetType = registry.getTargetType(targetId)
|
||||
if (!matchesType(targetType, draggedItemType)) {
|
||||
targetIds.splice(i, 1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function hoverAllTargets(
|
||||
targetIds: string[],
|
||||
monitor: DragDropMonitor,
|
||||
registry: HandlerRegistry,
|
||||
) {
|
||||
// Finally call hover on all matching targets.
|
||||
targetIds.forEach(function (targetId) {
|
||||
const target = registry.getTarget(targetId)
|
||||
target.hover(monitor, targetId)
|
||||
})
|
||||
}
|
||||
20
frontend/node_modules/dnd-core/src/actions/dragDrop/index.ts
generated
vendored
20
frontend/node_modules/dnd-core/src/actions/dragDrop/index.ts
generated
vendored
@@ -1,20 +0,0 @@
|
||||
import type { DragDropActions, DragDropManager } from '../../interfaces.js'
|
||||
import { createBeginDrag } from './beginDrag.js'
|
||||
import { createDrop } from './drop.js'
|
||||
import { createEndDrag } from './endDrag.js'
|
||||
import { createHover } from './hover.js'
|
||||
import { createPublishDragSource } from './publishDragSource.js'
|
||||
|
||||
export * from './types.js'
|
||||
|
||||
export function createDragDropActions(
|
||||
manager: DragDropManager,
|
||||
): DragDropActions {
|
||||
return {
|
||||
beginDrag: createBeginDrag(manager),
|
||||
publishDragSource: createPublishDragSource(manager),
|
||||
hover: createHover(manager),
|
||||
drop: createDrop(manager),
|
||||
endDrag: createEndDrag(manager),
|
||||
}
|
||||
}
|
||||
17
frontend/node_modules/dnd-core/src/actions/dragDrop/local/setClientOffset.ts
generated
vendored
17
frontend/node_modules/dnd-core/src/actions/dragDrop/local/setClientOffset.ts
generated
vendored
@@ -1,17 +0,0 @@
|
||||
import type { AnyAction } from 'redux'
|
||||
|
||||
import type { XYCoord } from '../../../interfaces.js'
|
||||
import { INIT_COORDS } from '../types.js'
|
||||
|
||||
export function setClientOffset(
|
||||
clientOffset: XYCoord | null | undefined,
|
||||
sourceClientOffset?: XYCoord | null | undefined,
|
||||
): AnyAction {
|
||||
return {
|
||||
type: INIT_COORDS,
|
||||
payload: {
|
||||
sourceClientOffset: sourceClientOffset || null,
|
||||
clientOffset: clientOffset || null,
|
||||
},
|
||||
}
|
||||
}
|
||||
12
frontend/node_modules/dnd-core/src/actions/dragDrop/publishDragSource.ts
generated
vendored
12
frontend/node_modules/dnd-core/src/actions/dragDrop/publishDragSource.ts
generated
vendored
@@ -1,12 +0,0 @@
|
||||
import type { DragDropManager, SentinelAction } from '../../interfaces.js'
|
||||
import { PUBLISH_DRAG_SOURCE } from './types.js'
|
||||
|
||||
export function createPublishDragSource(manager: DragDropManager) {
|
||||
return function publishDragSource(): SentinelAction | undefined {
|
||||
const monitor = manager.getMonitor()
|
||||
if (monitor.isDragging()) {
|
||||
return { type: PUBLISH_DRAG_SOURCE }
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
6
frontend/node_modules/dnd-core/src/actions/dragDrop/types.ts
generated
vendored
6
frontend/node_modules/dnd-core/src/actions/dragDrop/types.ts
generated
vendored
@@ -1,6 +0,0 @@
|
||||
export const INIT_COORDS = 'dnd-core/INIT_COORDS'
|
||||
export const BEGIN_DRAG = 'dnd-core/BEGIN_DRAG'
|
||||
export const PUBLISH_DRAG_SOURCE = 'dnd-core/PUBLISH_DRAG_SOURCE'
|
||||
export const HOVER = 'dnd-core/HOVER'
|
||||
export const DROP = 'dnd-core/DROP'
|
||||
export const END_DRAG = 'dnd-core/END_DRAG'
|
||||
42
frontend/node_modules/dnd-core/src/actions/registry.ts
generated
vendored
42
frontend/node_modules/dnd-core/src/actions/registry.ts
generated
vendored
@@ -1,42 +0,0 @@
|
||||
import type { Action, SourceIdPayload, TargetIdPayload } from '../interfaces.js'
|
||||
|
||||
export const ADD_SOURCE = 'dnd-core/ADD_SOURCE'
|
||||
export const ADD_TARGET = 'dnd-core/ADD_TARGET'
|
||||
export const REMOVE_SOURCE = 'dnd-core/REMOVE_SOURCE'
|
||||
export const REMOVE_TARGET = 'dnd-core/REMOVE_TARGET'
|
||||
|
||||
export function addSource(sourceId: string): Action<SourceIdPayload> {
|
||||
return {
|
||||
type: ADD_SOURCE,
|
||||
payload: {
|
||||
sourceId,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function addTarget(targetId: string): Action<TargetIdPayload> {
|
||||
return {
|
||||
type: ADD_TARGET,
|
||||
payload: {
|
||||
targetId,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function removeSource(sourceId: string): Action<SourceIdPayload> {
|
||||
return {
|
||||
type: REMOVE_SOURCE,
|
||||
payload: {
|
||||
sourceId,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export function removeTarget(targetId: string): Action<TargetIdPayload> {
|
||||
return {
|
||||
type: REMOVE_TARGET,
|
||||
payload: {
|
||||
targetId,
|
||||
},
|
||||
}
|
||||
}
|
||||
87
frontend/node_modules/dnd-core/src/classes/DragDropManagerImpl.ts
generated
vendored
87
frontend/node_modules/dnd-core/src/classes/DragDropManagerImpl.ts
generated
vendored
@@ -1,87 +0,0 @@
|
||||
import type { Action, Store } from 'redux'
|
||||
|
||||
import { createDragDropActions } from '../actions/dragDrop/index.js'
|
||||
import type {
|
||||
ActionCreator,
|
||||
Backend,
|
||||
DragDropActions,
|
||||
DragDropManager,
|
||||
DragDropMonitor,
|
||||
HandlerRegistry,
|
||||
} from '../interfaces.js'
|
||||
import type { State } from '../reducers/index.js'
|
||||
import type { DragDropMonitorImpl } from './DragDropMonitorImpl.js'
|
||||
|
||||
export class DragDropManagerImpl implements DragDropManager {
|
||||
private store: Store<State>
|
||||
private monitor: DragDropMonitor
|
||||
private backend: Backend | undefined
|
||||
private isSetUp = false
|
||||
|
||||
public constructor(store: Store<State>, monitor: DragDropMonitor) {
|
||||
this.store = store
|
||||
this.monitor = monitor
|
||||
store.subscribe(this.handleRefCountChange)
|
||||
}
|
||||
|
||||
public receiveBackend(backend: Backend): void {
|
||||
this.backend = backend
|
||||
}
|
||||
|
||||
public getMonitor(): DragDropMonitor {
|
||||
return this.monitor
|
||||
}
|
||||
|
||||
public getBackend(): Backend {
|
||||
return this.backend as Backend
|
||||
}
|
||||
|
||||
public getRegistry(): HandlerRegistry {
|
||||
return (this.monitor as DragDropMonitorImpl).registry
|
||||
}
|
||||
|
||||
public getActions(): DragDropActions {
|
||||
/* eslint-disable-next-line @typescript-eslint/no-this-alias */
|
||||
const manager = this
|
||||
const { dispatch } = this.store
|
||||
|
||||
function bindActionCreator(actionCreator: ActionCreator<any>) {
|
||||
return (...args: any[]) => {
|
||||
const action = actionCreator.apply(manager, args as any)
|
||||
if (typeof action !== 'undefined') {
|
||||
dispatch(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const actions = createDragDropActions(this)
|
||||
|
||||
return Object.keys(actions).reduce(
|
||||
(boundActions: DragDropActions, key: string) => {
|
||||
const action: ActionCreator<any> = (actions as any)[
|
||||
key
|
||||
] as ActionCreator<any>
|
||||
;(boundActions as any)[key] = bindActionCreator(action)
|
||||
return boundActions
|
||||
},
|
||||
{} as DragDropActions,
|
||||
)
|
||||
}
|
||||
|
||||
public dispatch(action: Action<any>): void {
|
||||
this.store.dispatch(action)
|
||||
}
|
||||
|
||||
private handleRefCountChange = (): void => {
|
||||
const shouldSetUp = this.store.getState().refCount > 0
|
||||
if (this.backend) {
|
||||
if (shouldSetUp && !this.isSetUp) {
|
||||
this.backend.setup()
|
||||
this.isSetUp = true
|
||||
} else if (!shouldSetUp && this.isSetUp) {
|
||||
this.backend.teardown()
|
||||
this.isSetUp = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
216
frontend/node_modules/dnd-core/src/classes/DragDropMonitorImpl.ts
generated
vendored
216
frontend/node_modules/dnd-core/src/classes/DragDropMonitorImpl.ts
generated
vendored
@@ -1,216 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant'
|
||||
import type { Store } from 'redux'
|
||||
|
||||
import type {
|
||||
DragDropMonitor,
|
||||
HandlerRegistry,
|
||||
Identifier,
|
||||
Listener,
|
||||
Unsubscribe,
|
||||
XYCoord,
|
||||
} from '../interfaces.js'
|
||||
import type { State } from '../reducers/index.js'
|
||||
import {
|
||||
getDifferenceFromInitialOffset,
|
||||
getSourceClientOffset,
|
||||
} from '../utils/coords.js'
|
||||
import { areDirty } from '../utils/dirtiness.js'
|
||||
import { matchesType } from '../utils/matchesType.js'
|
||||
|
||||
export class DragDropMonitorImpl implements DragDropMonitor {
|
||||
private store: Store<State>
|
||||
public readonly registry: HandlerRegistry
|
||||
|
||||
public constructor(store: Store<State>, registry: HandlerRegistry) {
|
||||
this.store = store
|
||||
this.registry = registry
|
||||
}
|
||||
|
||||
public subscribeToStateChange(
|
||||
listener: Listener,
|
||||
options: { handlerIds?: string[] } = {},
|
||||
): Unsubscribe {
|
||||
const { handlerIds } = options
|
||||
invariant(typeof listener === 'function', 'listener must be a function.')
|
||||
invariant(
|
||||
typeof handlerIds === 'undefined' || Array.isArray(handlerIds),
|
||||
'handlerIds, when specified, must be an array of strings.',
|
||||
)
|
||||
|
||||
let prevStateId = this.store.getState().stateId
|
||||
const handleChange = () => {
|
||||
const state = this.store.getState()
|
||||
const currentStateId = state.stateId
|
||||
try {
|
||||
const canSkipListener =
|
||||
currentStateId === prevStateId ||
|
||||
(currentStateId === prevStateId + 1 &&
|
||||
!areDirty(state.dirtyHandlerIds, handlerIds))
|
||||
|
||||
if (!canSkipListener) {
|
||||
listener()
|
||||
}
|
||||
} finally {
|
||||
prevStateId = currentStateId
|
||||
}
|
||||
}
|
||||
|
||||
return this.store.subscribe(handleChange)
|
||||
}
|
||||
|
||||
public subscribeToOffsetChange(listener: Listener): Unsubscribe {
|
||||
invariant(typeof listener === 'function', 'listener must be a function.')
|
||||
|
||||
let previousState = this.store.getState().dragOffset
|
||||
const handleChange = () => {
|
||||
const nextState = this.store.getState().dragOffset
|
||||
if (nextState === previousState) {
|
||||
return
|
||||
}
|
||||
|
||||
previousState = nextState
|
||||
listener()
|
||||
}
|
||||
|
||||
return this.store.subscribe(handleChange)
|
||||
}
|
||||
|
||||
public canDragSource(sourceId: string | undefined): boolean {
|
||||
if (!sourceId) {
|
||||
return false
|
||||
}
|
||||
const source = this.registry.getSource(sourceId)
|
||||
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`)
|
||||
|
||||
if (this.isDragging()) {
|
||||
return false
|
||||
}
|
||||
|
||||
return source.canDrag(this, sourceId)
|
||||
}
|
||||
|
||||
public canDropOnTarget(targetId: string | undefined): boolean {
|
||||
// undefined on initial render
|
||||
if (!targetId) {
|
||||
return false
|
||||
}
|
||||
const target = this.registry.getTarget(targetId)
|
||||
invariant(target, `Expected to find a valid target. targetId=${targetId}`)
|
||||
|
||||
if (!this.isDragging() || this.didDrop()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const targetType = this.registry.getTargetType(targetId)
|
||||
const draggedItemType = this.getItemType()
|
||||
return (
|
||||
matchesType(targetType, draggedItemType) && target.canDrop(this, targetId)
|
||||
)
|
||||
}
|
||||
|
||||
public isDragging(): boolean {
|
||||
return Boolean(this.getItemType())
|
||||
}
|
||||
|
||||
public isDraggingSource(sourceId: string | undefined): boolean {
|
||||
// undefined on initial render
|
||||
if (!sourceId) {
|
||||
return false
|
||||
}
|
||||
const source = this.registry.getSource(sourceId, true)
|
||||
invariant(source, `Expected to find a valid source. sourceId=${sourceId}`)
|
||||
|
||||
if (!this.isDragging() || !this.isSourcePublic()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const sourceType = this.registry.getSourceType(sourceId)
|
||||
const draggedItemType = this.getItemType()
|
||||
if (sourceType !== draggedItemType) {
|
||||
return false
|
||||
}
|
||||
|
||||
return source.isDragging(this, sourceId)
|
||||
}
|
||||
|
||||
public isOverTarget(
|
||||
targetId: string | undefined,
|
||||
options = { shallow: false },
|
||||
): boolean {
|
||||
// undefined on initial render
|
||||
if (!targetId) {
|
||||
return false
|
||||
}
|
||||
|
||||
const { shallow } = options
|
||||
if (!this.isDragging()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const targetType = this.registry.getTargetType(targetId)
|
||||
const draggedItemType = this.getItemType()
|
||||
if (draggedItemType && !matchesType(targetType, draggedItemType)) {
|
||||
return false
|
||||
}
|
||||
|
||||
const targetIds = this.getTargetIds()
|
||||
if (!targetIds.length) {
|
||||
return false
|
||||
}
|
||||
|
||||
const index = targetIds.indexOf(targetId)
|
||||
if (shallow) {
|
||||
return index === targetIds.length - 1
|
||||
} else {
|
||||
return index > -1
|
||||
}
|
||||
}
|
||||
|
||||
public getItemType(): Identifier {
|
||||
return this.store.getState().dragOperation.itemType as Identifier
|
||||
}
|
||||
|
||||
public getItem(): any {
|
||||
return this.store.getState().dragOperation.item
|
||||
}
|
||||
|
||||
public getSourceId(): string | null {
|
||||
return this.store.getState().dragOperation.sourceId
|
||||
}
|
||||
|
||||
public getTargetIds(): string[] {
|
||||
return this.store.getState().dragOperation.targetIds
|
||||
}
|
||||
|
||||
public getDropResult(): any {
|
||||
return this.store.getState().dragOperation.dropResult
|
||||
}
|
||||
|
||||
public didDrop(): boolean {
|
||||
return this.store.getState().dragOperation.didDrop
|
||||
}
|
||||
|
||||
public isSourcePublic(): boolean {
|
||||
return Boolean(this.store.getState().dragOperation.isSourcePublic)
|
||||
}
|
||||
|
||||
public getInitialClientOffset(): XYCoord | null {
|
||||
return this.store.getState().dragOffset.initialClientOffset
|
||||
}
|
||||
|
||||
public getInitialSourceClientOffset(): XYCoord | null {
|
||||
return this.store.getState().dragOffset.initialSourceClientOffset
|
||||
}
|
||||
|
||||
public getClientOffset(): XYCoord | null {
|
||||
return this.store.getState().dragOffset.clientOffset
|
||||
}
|
||||
|
||||
public getSourceClientOffset(): XYCoord | null {
|
||||
return getSourceClientOffset(this.store.getState().dragOffset)
|
||||
}
|
||||
|
||||
public getDifferenceFromInitialOffset(): XYCoord | null {
|
||||
return getDifferenceFromInitialOffset(this.store.getState().dragOffset)
|
||||
}
|
||||
}
|
||||
181
frontend/node_modules/dnd-core/src/classes/HandlerRegistryImpl.ts
generated
vendored
181
frontend/node_modules/dnd-core/src/classes/HandlerRegistryImpl.ts
generated
vendored
@@ -1,181 +0,0 @@
|
||||
import { asap } from '@react-dnd/asap'
|
||||
import { invariant } from '@react-dnd/invariant'
|
||||
import type { Store } from 'redux'
|
||||
|
||||
import {
|
||||
addSource,
|
||||
addTarget,
|
||||
removeSource,
|
||||
removeTarget,
|
||||
} from '../actions/registry.js'
|
||||
import {
|
||||
validateSourceContract,
|
||||
validateTargetContract,
|
||||
validateType,
|
||||
} from '../contracts.js'
|
||||
import type {
|
||||
DragSource,
|
||||
DropTarget,
|
||||
HandlerRegistry,
|
||||
Identifier,
|
||||
SourceType,
|
||||
TargetType,
|
||||
} from '../interfaces.js'
|
||||
import { HandlerRole } from '../interfaces.js'
|
||||
import type { State } from '../reducers/index.js'
|
||||
import { getNextUniqueId } from '../utils/getNextUniqueId.js'
|
||||
|
||||
function getNextHandlerId(role: HandlerRole): string {
|
||||
const id = getNextUniqueId().toString()
|
||||
switch (role) {
|
||||
case HandlerRole.SOURCE:
|
||||
return `S${id}`
|
||||
case HandlerRole.TARGET:
|
||||
return `T${id}`
|
||||
default:
|
||||
throw new Error(`Unknown Handler Role: ${role}`)
|
||||
}
|
||||
}
|
||||
|
||||
function parseRoleFromHandlerId(handlerId: string) {
|
||||
switch (handlerId[0]) {
|
||||
case 'S':
|
||||
return HandlerRole.SOURCE
|
||||
case 'T':
|
||||
return HandlerRole.TARGET
|
||||
default:
|
||||
throw new Error(`Cannot parse handler ID: ${handlerId}`)
|
||||
}
|
||||
}
|
||||
|
||||
function mapContainsValue<T>(map: Map<string, T>, searchValue: T) {
|
||||
const entries = map.entries()
|
||||
let isDone = false
|
||||
do {
|
||||
const {
|
||||
done,
|
||||
value: [, value],
|
||||
} = entries.next()
|
||||
if (value === searchValue) {
|
||||
return true
|
||||
}
|
||||
isDone = !!done
|
||||
} while (!isDone)
|
||||
return false
|
||||
}
|
||||
|
||||
export class HandlerRegistryImpl implements HandlerRegistry {
|
||||
private types: Map<string, SourceType | TargetType> = new Map()
|
||||
private dragSources: Map<string, DragSource> = new Map()
|
||||
private dropTargets: Map<string, DropTarget> = new Map()
|
||||
private pinnedSourceId: string | null = null
|
||||
private pinnedSource: any = null
|
||||
private store: Store<State>
|
||||
|
||||
public constructor(store: Store<State>) {
|
||||
this.store = store
|
||||
}
|
||||
|
||||
public addSource(type: SourceType, source: DragSource): string {
|
||||
validateType(type)
|
||||
validateSourceContract(source)
|
||||
|
||||
const sourceId = this.addHandler(HandlerRole.SOURCE, type, source)
|
||||
this.store.dispatch(addSource(sourceId))
|
||||
return sourceId
|
||||
}
|
||||
|
||||
public addTarget(type: TargetType, target: DropTarget): string {
|
||||
validateType(type, true)
|
||||
validateTargetContract(target)
|
||||
|
||||
const targetId = this.addHandler(HandlerRole.TARGET, type, target)
|
||||
this.store.dispatch(addTarget(targetId))
|
||||
return targetId
|
||||
}
|
||||
|
||||
public containsHandler(handler: DragSource | DropTarget): boolean {
|
||||
return (
|
||||
mapContainsValue(this.dragSources, handler) ||
|
||||
mapContainsValue(this.dropTargets, handler)
|
||||
)
|
||||
}
|
||||
|
||||
public getSource(sourceId: string, includePinned = false): DragSource {
|
||||
invariant(this.isSourceId(sourceId), 'Expected a valid source ID.')
|
||||
const isPinned = includePinned && sourceId === this.pinnedSourceId
|
||||
const source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId)
|
||||
return source
|
||||
}
|
||||
|
||||
public getTarget(targetId: string): DropTarget {
|
||||
invariant(this.isTargetId(targetId), 'Expected a valid target ID.')
|
||||
return this.dropTargets.get(targetId) as DropTarget
|
||||
}
|
||||
|
||||
public getSourceType(sourceId: string): Identifier {
|
||||
invariant(this.isSourceId(sourceId), 'Expected a valid source ID.')
|
||||
return this.types.get(sourceId) as Identifier
|
||||
}
|
||||
|
||||
public getTargetType(targetId: string): Identifier | Identifier[] {
|
||||
invariant(this.isTargetId(targetId), 'Expected a valid target ID.')
|
||||
return this.types.get(targetId) as Identifier | Identifier[]
|
||||
}
|
||||
|
||||
public isSourceId(handlerId: string): boolean {
|
||||
const role = parseRoleFromHandlerId(handlerId)
|
||||
return role === HandlerRole.SOURCE
|
||||
}
|
||||
|
||||
public isTargetId(handlerId: string): boolean {
|
||||
const role = parseRoleFromHandlerId(handlerId)
|
||||
return role === HandlerRole.TARGET
|
||||
}
|
||||
|
||||
public removeSource(sourceId: string): void {
|
||||
invariant(this.getSource(sourceId), 'Expected an existing source.')
|
||||
this.store.dispatch(removeSource(sourceId))
|
||||
asap(() => {
|
||||
this.dragSources.delete(sourceId)
|
||||
this.types.delete(sourceId)
|
||||
})
|
||||
}
|
||||
|
||||
public removeTarget(targetId: string): void {
|
||||
invariant(this.getTarget(targetId), 'Expected an existing target.')
|
||||
this.store.dispatch(removeTarget(targetId))
|
||||
this.dropTargets.delete(targetId)
|
||||
this.types.delete(targetId)
|
||||
}
|
||||
|
||||
public pinSource(sourceId: string): void {
|
||||
const source = this.getSource(sourceId)
|
||||
invariant(source, 'Expected an existing source.')
|
||||
|
||||
this.pinnedSourceId = sourceId
|
||||
this.pinnedSource = source
|
||||
}
|
||||
|
||||
public unpinSource(): void {
|
||||
invariant(this.pinnedSource, 'No source is pinned at the time.')
|
||||
|
||||
this.pinnedSourceId = null
|
||||
this.pinnedSource = null
|
||||
}
|
||||
|
||||
private addHandler(
|
||||
role: HandlerRole,
|
||||
type: SourceType | TargetType,
|
||||
handler: DragSource | DropTarget,
|
||||
): string {
|
||||
const id = getNextHandlerId(role)
|
||||
this.types.set(id, type)
|
||||
if (role === HandlerRole.SOURCE) {
|
||||
this.dragSources.set(id, handler as DragSource)
|
||||
} else if (role === HandlerRole.TARGET) {
|
||||
this.dropTargets.set(id, handler as DropTarget)
|
||||
}
|
||||
return id
|
||||
}
|
||||
}
|
||||
50
frontend/node_modules/dnd-core/src/contracts.ts
generated
vendored
50
frontend/node_modules/dnd-core/src/contracts.ts
generated
vendored
@@ -1,50 +0,0 @@
|
||||
import { invariant } from '@react-dnd/invariant'
|
||||
|
||||
import type { DragSource, DropTarget, Identifier } from './interfaces.js'
|
||||
|
||||
export function validateSourceContract(source: DragSource): void {
|
||||
invariant(
|
||||
typeof source.canDrag === 'function',
|
||||
'Expected canDrag to be a function.',
|
||||
)
|
||||
invariant(
|
||||
typeof source.beginDrag === 'function',
|
||||
'Expected beginDrag to be a function.',
|
||||
)
|
||||
invariant(
|
||||
typeof source.endDrag === 'function',
|
||||
'Expected endDrag to be a function.',
|
||||
)
|
||||
}
|
||||
|
||||
export function validateTargetContract(target: DropTarget): void {
|
||||
invariant(
|
||||
typeof target.canDrop === 'function',
|
||||
'Expected canDrop to be a function.',
|
||||
)
|
||||
invariant(
|
||||
typeof target.hover === 'function',
|
||||
'Expected hover to be a function.',
|
||||
)
|
||||
invariant(
|
||||
typeof target.drop === 'function',
|
||||
'Expected beginDrag to be a function.',
|
||||
)
|
||||
}
|
||||
|
||||
export function validateType(
|
||||
type: Identifier | Identifier[],
|
||||
allowArray?: boolean,
|
||||
): void {
|
||||
if (allowArray && Array.isArray(type)) {
|
||||
type.forEach((t) => validateType(t, false))
|
||||
return
|
||||
}
|
||||
|
||||
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.',
|
||||
)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user