Add yet-another-react-lightbox package and update .gitignore to exclude node_modules
This commit is contained in:
22
frontend/node_modules/react-dnd-html5-backend/LICENSE
generated
vendored
22
frontend/node_modules/react-dnd-html5-backend/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.
|
||||
|
||||
28
frontend/node_modules/react-dnd-html5-backend/README.md
generated
vendored
28
frontend/node_modules/react-dnd-html5-backend/README.md
generated
vendored
@@ -1,28 +0,0 @@
|
||||
[](https://www.npmjs.org/package/react-dnd-html5-backend)
|
||||
[](https://travis-ci.org/react-dnd/react-dnd-html5-backend)
|
||||
[](https://david-dm.org/react-dnd/react-dnd-html5-backend)
|
||||
[](https://david-dm.org/react-dnd/react-dnd-html5-backend?type=dev)
|
||||
[](https://david-dm.org/react-dnd/react-dnd-html5-backend?type=peer)
|
||||
|
||||
# React DnD HTML5 Backend
|
||||
|
||||
The officially supported HTML5 backend for [React DnD](http://react-dnd.github.io/react-dnd/).
|
||||
See [the docs](http://react-dnd.github.io/react-dnd/docs/backends/html5) for usage information.
|
||||
|
||||
## Installation
|
||||
|
||||
If you use [npm](http://npmjs.com):
|
||||
|
||||
```
|
||||
npm install --save react-dnd-html5-backend
|
||||
```
|
||||
|
||||
## Browser Support
|
||||
|
||||
We strive to support the evergreen browsers.
|
||||
|
||||
Unfortunately the browser bugs, inconsistencies, and regressions come up from time to time, so please make sure you test your app on the browsers you’re interested in, and report any bugs to us.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
8
frontend/node_modules/react-dnd-html5-backend/dist/BrowserDetector.d.ts
generated
vendored
8
frontend/node_modules/react-dnd-html5-backend/dist/BrowserDetector.d.ts
generated
vendored
@@ -1,8 +0,0 @@
|
||||
declare global {
|
||||
interface Window extends HTMLElement {
|
||||
safari: any;
|
||||
}
|
||||
}
|
||||
export declare type Predicate = () => boolean;
|
||||
export declare const isFirefox: Predicate;
|
||||
export declare const isSafari: Predicate;
|
||||
7
frontend/node_modules/react-dnd-html5-backend/dist/BrowserDetector.js
generated
vendored
7
frontend/node_modules/react-dnd-html5-backend/dist/BrowserDetector.js
generated
vendored
@@ -1,7 +0,0 @@
|
||||
import { memoize } from './utils/js_utils.js';
|
||||
export const isFirefox = memoize(()=>/firefox/i.test(navigator.userAgent)
|
||||
);
|
||||
export const isSafari = memoize(()=>Boolean(window.safari)
|
||||
);
|
||||
|
||||
//# sourceMappingURL=BrowserDetector.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/BrowserDetector.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/BrowserDetector.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/BrowserDetector.ts"],"sourcesContent":["import { memoize } from './utils/js_utils.js'\n\ndeclare global {\n\tinterface Window extends HTMLElement {\n\t\tsafari: any\n\t}\n}\n\nexport type Predicate = () => boolean\nexport const isFirefox: Predicate = memoize(() =>\n\t/firefox/i.test(navigator.userAgent),\n)\nexport const isSafari: Predicate = memoize(() => Boolean(window.safari))\n"],"names":["memoize","isFirefox","test","navigator","userAgent","isSafari","Boolean","window","safari"],"mappings":"AAAA,SAASA,OAAO,QAAQ,qBAAqB,CAAA;AAS7C,OAAO,MAAMC,SAAS,GAAcD,OAAO,CAAC,IAC3C,WAAWE,IAAI,CAACC,SAAS,CAACC,SAAS,CAAC;AAAA,CACpC,CAAA;AACD,OAAO,MAAMC,QAAQ,GAAcL,OAAO,CAAC,IAAMM,OAAO,CAACC,MAAM,CAACC,MAAM,CAAC;AAAA,CAAC,CAAA"}
|
||||
10
frontend/node_modules/react-dnd-html5-backend/dist/EnterLeaveCounter.d.ts
generated
vendored
10
frontend/node_modules/react-dnd-html5-backend/dist/EnterLeaveCounter.d.ts
generated
vendored
@@ -1,10 +0,0 @@
|
||||
declare type NodePredicate = (node: Node | null | undefined) => boolean;
|
||||
export declare class EnterLeaveCounter {
|
||||
private entered;
|
||||
private isNodeInDocument;
|
||||
constructor(isNodeInDocument: NodePredicate);
|
||||
enter(enteringNode: EventTarget | null): boolean;
|
||||
leave(leavingNode: EventTarget | null): boolean;
|
||||
reset(): void;
|
||||
}
|
||||
export {};
|
||||
26
frontend/node_modules/react-dnd-html5-backend/dist/EnterLeaveCounter.js
generated
vendored
26
frontend/node_modules/react-dnd-html5-backend/dist/EnterLeaveCounter.js
generated
vendored
@@ -1,26 +0,0 @@
|
||||
import { union, without } from './utils/js_utils.js';
|
||||
export class EnterLeaveCounter {
|
||||
enter(enteringNode) {
|
||||
const previousLength = this.entered.length;
|
||||
const isNodeEntered = (node)=>this.isNodeInDocument(node) && (!node.contains || node.contains(enteringNode))
|
||||
;
|
||||
this.entered = union(this.entered.filter(isNodeEntered), [
|
||||
enteringNode
|
||||
]);
|
||||
return previousLength === 0 && this.entered.length > 0;
|
||||
}
|
||||
leave(leavingNode) {
|
||||
const previousLength = this.entered.length;
|
||||
this.entered = without(this.entered.filter(this.isNodeInDocument), leavingNode);
|
||||
return previousLength > 0 && this.entered.length === 0;
|
||||
}
|
||||
reset() {
|
||||
this.entered = [];
|
||||
}
|
||||
constructor(isNodeInDocument){
|
||||
this.entered = [];
|
||||
this.isNodeInDocument = isNodeInDocument;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=EnterLeaveCounter.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/EnterLeaveCounter.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/EnterLeaveCounter.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/EnterLeaveCounter.ts"],"sourcesContent":["import { union, without } from './utils/js_utils.js'\n\ntype NodePredicate = (node: Node | null | undefined) => boolean\n\nexport class EnterLeaveCounter {\n\tprivate entered: any[] = []\n\tprivate isNodeInDocument: NodePredicate\n\n\tpublic constructor(isNodeInDocument: NodePredicate) {\n\t\tthis.isNodeInDocument = isNodeInDocument\n\t}\n\n\tpublic enter(enteringNode: EventTarget | null): boolean {\n\t\tconst previousLength = this.entered.length\n\n\t\tconst isNodeEntered = (node: Node): boolean =>\n\t\t\tthis.isNodeInDocument(node) &&\n\t\t\t(!node.contains || node.contains(enteringNode as Node))\n\n\t\tthis.entered = union(this.entered.filter(isNodeEntered), [enteringNode])\n\n\t\treturn previousLength === 0 && this.entered.length > 0\n\t}\n\n\tpublic leave(leavingNode: EventTarget | null): boolean {\n\t\tconst previousLength = this.entered.length\n\n\t\tthis.entered = without(\n\t\t\tthis.entered.filter(this.isNodeInDocument),\n\t\t\tleavingNode,\n\t\t)\n\n\t\treturn previousLength > 0 && this.entered.length === 0\n\t}\n\n\tpublic reset(): void {\n\t\tthis.entered = []\n\t}\n}\n"],"names":["union","without","EnterLeaveCounter","enter","enteringNode","previousLength","entered","length","isNodeEntered","node","isNodeInDocument","contains","filter","leave","leavingNode","reset"],"mappings":"AAAA,SAASA,KAAK,EAAEC,OAAO,QAAQ,qBAAqB,CAAA;AAIpD,OAAO,MAAMC,iBAAiB;IAQ7B,AAAOC,KAAK,CAACC,YAAgC,EAAW;QACvD,MAAMC,cAAc,GAAG,IAAI,CAACC,OAAO,CAACC,MAAM;QAE1C,MAAMC,aAAa,GAAG,CAACC,IAAU,GAChC,IAAI,CAACC,gBAAgB,CAACD,IAAI,CAAC,IAC3B,CAAC,CAACA,IAAI,CAACE,QAAQ,IAAIF,IAAI,CAACE,QAAQ,CAACP,YAAY,CAAS,CAAC;QAAA;QAExD,IAAI,CAACE,OAAO,GAAGN,KAAK,CAAC,IAAI,CAACM,OAAO,CAACM,MAAM,CAACJ,aAAa,CAAC,EAAE;YAACJ,YAAY;SAAC,CAAC;QAExE,OAAOC,cAAc,KAAK,CAAC,IAAI,IAAI,CAACC,OAAO,CAACC,MAAM,GAAG,CAAC,CAAA;KACtD;IAED,AAAOM,KAAK,CAACC,WAA+B,EAAW;QACtD,MAAMT,cAAc,GAAG,IAAI,CAACC,OAAO,CAACC,MAAM;QAE1C,IAAI,CAACD,OAAO,GAAGL,OAAO,CACrB,IAAI,CAACK,OAAO,CAACM,MAAM,CAAC,IAAI,CAACF,gBAAgB,CAAC,EAC1CI,WAAW,CACX;QAED,OAAOT,cAAc,GAAG,CAAC,IAAI,IAAI,CAACC,OAAO,CAACC,MAAM,KAAK,CAAC,CAAA;KACtD;IAED,AAAOQ,KAAK,GAAS;QACpB,IAAI,CAACT,OAAO,GAAG,EAAE;KACjB;IA7BD,YAAmBI,gBAA+B,CAAE;QAHpD,KAAQJ,OAAO,GAAU,EAAE,AAL5B,CAK4B;QAI1B,IAAI,CAACI,gBAAgB,GAAGA,gBAAgB;KACxC;CA4BD"}
|
||||
71
frontend/node_modules/react-dnd-html5-backend/dist/HTML5BackendImpl.d.ts
generated
vendored
71
frontend/node_modules/react-dnd-html5-backend/dist/HTML5BackendImpl.d.ts
generated
vendored
@@ -1,71 +0,0 @@
|
||||
import type { Backend, DragDropManager, Unsubscribe } from 'dnd-core';
|
||||
import type { HTML5BackendContext, HTML5BackendOptions } from './types.js';
|
||||
export declare class HTML5BackendImpl implements Backend {
|
||||
private options;
|
||||
private actions;
|
||||
private monitor;
|
||||
private registry;
|
||||
private enterLeaveCounter;
|
||||
private sourcePreviewNodes;
|
||||
private sourcePreviewNodeOptions;
|
||||
private sourceNodes;
|
||||
private sourceNodeOptions;
|
||||
private dragStartSourceIds;
|
||||
private dropTargetIds;
|
||||
private dragEnterTargetIds;
|
||||
private currentNativeSource;
|
||||
private currentNativeHandle;
|
||||
private currentDragSourceNode;
|
||||
private altKeyPressed;
|
||||
private mouseMoveTimeoutTimer;
|
||||
private asyncEndDragFrameId;
|
||||
private dragOverTargetIds;
|
||||
private lastClientOffset;
|
||||
private hoverRafId;
|
||||
constructor(manager: DragDropManager, globalContext?: HTML5BackendContext, options?: HTML5BackendOptions);
|
||||
/**
|
||||
* Generate profiling statistics for the HTML5Backend.
|
||||
*/
|
||||
profile(): Record<string, number>;
|
||||
get window(): Window | undefined;
|
||||
get document(): Document | undefined;
|
||||
/**
|
||||
* Get the root element to use for event subscriptions
|
||||
*/
|
||||
private get rootElement();
|
||||
setup(): void;
|
||||
teardown(): void;
|
||||
connectDragPreview(sourceId: string, node: Element, options: any): Unsubscribe;
|
||||
connectDragSource(sourceId: string, node: Element, options: any): Unsubscribe;
|
||||
connectDropTarget(targetId: string, node: HTMLElement): Unsubscribe;
|
||||
private addEventListeners;
|
||||
private removeEventListeners;
|
||||
private getCurrentSourceNodeOptions;
|
||||
private getCurrentDropEffect;
|
||||
private getCurrentSourcePreviewNodeOptions;
|
||||
private getSourceClientOffset;
|
||||
private isDraggingNativeItem;
|
||||
private beginDragNativeItem;
|
||||
private endDragNativeItem;
|
||||
private isNodeInDocument;
|
||||
private endDragIfSourceWasRemovedFromDOM;
|
||||
private setCurrentDragSourceNode;
|
||||
private clearCurrentDragSourceNode;
|
||||
private scheduleHover;
|
||||
private cancelHover;
|
||||
handleTopDragStartCapture: () => void;
|
||||
handleDragStart(e: DragEvent, sourceId: string): void;
|
||||
handleTopDragStart: (e: DragEvent) => void;
|
||||
handleTopDragEndCapture: () => void;
|
||||
handleTopDragEnterCapture: (e: DragEvent) => void;
|
||||
handleDragEnter(_e: DragEvent, targetId: string): void;
|
||||
handleTopDragEnter: (e: DragEvent) => void;
|
||||
handleTopDragOverCapture: (e: DragEvent) => void;
|
||||
handleDragOver(_e: DragEvent, targetId: string): void;
|
||||
handleTopDragOver: (e: DragEvent) => void;
|
||||
handleTopDragLeaveCapture: (e: DragEvent) => void;
|
||||
handleTopDropCapture: (e: DragEvent) => void;
|
||||
handleDrop(_e: DragEvent, targetId: string): void;
|
||||
handleTopDrop: (e: DragEvent) => void;
|
||||
handleSelectStart: (e: DragEvent) => void;
|
||||
}
|
||||
571
frontend/node_modules/react-dnd-html5-backend/dist/HTML5BackendImpl.js
generated
vendored
571
frontend/node_modules/react-dnd-html5-backend/dist/HTML5BackendImpl.js
generated
vendored
@@ -1,571 +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 { EnterLeaveCounter } from './EnterLeaveCounter.js';
|
||||
import { createNativeDragSource, matchNativeItemType } from './NativeDragSources/index.js';
|
||||
import * as NativeTypes from './NativeTypes.js';
|
||||
import { getDragPreviewOffset, getEventClientOffset, getNodeClientOffset } from './OffsetUtils.js';
|
||||
import { OptionsReader } from './OptionsReader.js';
|
||||
export class HTML5BackendImpl {
|
||||
/**
|
||||
* Generate profiling statistics for the HTML5Backend.
|
||||
*/ profile() {
|
||||
var ref, ref1;
|
||||
return {
|
||||
sourcePreviewNodes: this.sourcePreviewNodes.size,
|
||||
sourcePreviewNodeOptions: this.sourcePreviewNodeOptions.size,
|
||||
sourceNodeOptions: this.sourceNodeOptions.size,
|
||||
sourceNodes: this.sourceNodes.size,
|
||||
dragStartSourceIds: ((ref = this.dragStartSourceIds) === null || ref === void 0 ? void 0 : ref.length) || 0,
|
||||
dropTargetIds: this.dropTargetIds.length,
|
||||
dragEnterTargetIds: this.dragEnterTargetIds.length,
|
||||
dragOverTargetIds: ((ref1 = this.dragOverTargetIds) === null || ref1 === void 0 ? void 0 : ref1.length) || 0
|
||||
};
|
||||
}
|
||||
// public for test
|
||||
get window() {
|
||||
return this.options.window;
|
||||
}
|
||||
get document() {
|
||||
return this.options.document;
|
||||
}
|
||||
/**
|
||||
* Get the root element to use for event subscriptions
|
||||
*/ get rootElement() {
|
||||
return this.options.rootElement;
|
||||
}
|
||||
setup() {
|
||||
const root = this.rootElement;
|
||||
if (root === undefined) {
|
||||
return;
|
||||
}
|
||||
if (root.__isReactDndBackendSetUp) {
|
||||
throw new Error('Cannot have two HTML5 backends at the same time.');
|
||||
}
|
||||
root.__isReactDndBackendSetUp = true;
|
||||
this.addEventListeners(root);
|
||||
}
|
||||
teardown() {
|
||||
const root = this.rootElement;
|
||||
if (root === undefined) {
|
||||
return;
|
||||
}
|
||||
root.__isReactDndBackendSetUp = false;
|
||||
this.removeEventListeners(this.rootElement);
|
||||
this.clearCurrentDragSourceNode();
|
||||
if (this.asyncEndDragFrameId) {
|
||||
var ref;
|
||||
(ref = this.window) === null || ref === void 0 ? void 0 : ref.cancelAnimationFrame(this.asyncEndDragFrameId);
|
||||
}
|
||||
}
|
||||
connectDragPreview(sourceId, node, options) {
|
||||
this.sourcePreviewNodeOptions.set(sourceId, options);
|
||||
this.sourcePreviewNodes.set(sourceId, node);
|
||||
return ()=>{
|
||||
this.sourcePreviewNodes.delete(sourceId);
|
||||
this.sourcePreviewNodeOptions.delete(sourceId);
|
||||
};
|
||||
}
|
||||
connectDragSource(sourceId, node, options) {
|
||||
this.sourceNodes.set(sourceId, node);
|
||||
this.sourceNodeOptions.set(sourceId, options);
|
||||
const handleDragStart = (e)=>this.handleDragStart(e, sourceId)
|
||||
;
|
||||
const handleSelectStart = (e)=>this.handleSelectStart(e)
|
||||
;
|
||||
node.setAttribute('draggable', 'true');
|
||||
node.addEventListener('dragstart', handleDragStart);
|
||||
node.addEventListener('selectstart', handleSelectStart);
|
||||
return ()=>{
|
||||
this.sourceNodes.delete(sourceId);
|
||||
this.sourceNodeOptions.delete(sourceId);
|
||||
node.removeEventListener('dragstart', handleDragStart);
|
||||
node.removeEventListener('selectstart', handleSelectStart);
|
||||
node.setAttribute('draggable', 'false');
|
||||
};
|
||||
}
|
||||
connectDropTarget(targetId, node) {
|
||||
const handleDragEnter = (e)=>this.handleDragEnter(e, targetId)
|
||||
;
|
||||
const handleDragOver = (e)=>this.handleDragOver(e, targetId)
|
||||
;
|
||||
const handleDrop = (e)=>this.handleDrop(e, targetId)
|
||||
;
|
||||
node.addEventListener('dragenter', handleDragEnter);
|
||||
node.addEventListener('dragover', handleDragOver);
|
||||
node.addEventListener('drop', handleDrop);
|
||||
return ()=>{
|
||||
node.removeEventListener('dragenter', handleDragEnter);
|
||||
node.removeEventListener('dragover', handleDragOver);
|
||||
node.removeEventListener('drop', handleDrop);
|
||||
};
|
||||
}
|
||||
addEventListeners(target) {
|
||||
// SSR Fix (https://github.com/react-dnd/react-dnd/pull/813
|
||||
if (!target.addEventListener) {
|
||||
return;
|
||||
}
|
||||
target.addEventListener('dragstart', this.handleTopDragStart);
|
||||
target.addEventListener('dragstart', this.handleTopDragStartCapture, true);
|
||||
target.addEventListener('dragend', this.handleTopDragEndCapture, true);
|
||||
target.addEventListener('dragenter', this.handleTopDragEnter);
|
||||
target.addEventListener('dragenter', this.handleTopDragEnterCapture, true);
|
||||
target.addEventListener('dragleave', this.handleTopDragLeaveCapture, true);
|
||||
target.addEventListener('dragover', this.handleTopDragOver);
|
||||
target.addEventListener('dragover', this.handleTopDragOverCapture, true);
|
||||
target.addEventListener('drop', this.handleTopDrop);
|
||||
target.addEventListener('drop', this.handleTopDropCapture, true);
|
||||
}
|
||||
removeEventListeners(target) {
|
||||
// SSR Fix (https://github.com/react-dnd/react-dnd/pull/813
|
||||
if (!target.removeEventListener) {
|
||||
return;
|
||||
}
|
||||
target.removeEventListener('dragstart', this.handleTopDragStart);
|
||||
target.removeEventListener('dragstart', this.handleTopDragStartCapture, true);
|
||||
target.removeEventListener('dragend', this.handleTopDragEndCapture, true);
|
||||
target.removeEventListener('dragenter', this.handleTopDragEnter);
|
||||
target.removeEventListener('dragenter', this.handleTopDragEnterCapture, true);
|
||||
target.removeEventListener('dragleave', this.handleTopDragLeaveCapture, true);
|
||||
target.removeEventListener('dragover', this.handleTopDragOver);
|
||||
target.removeEventListener('dragover', this.handleTopDragOverCapture, true);
|
||||
target.removeEventListener('drop', this.handleTopDrop);
|
||||
target.removeEventListener('drop', this.handleTopDropCapture, true);
|
||||
}
|
||||
getCurrentSourceNodeOptions() {
|
||||
const sourceId = this.monitor.getSourceId();
|
||||
const sourceNodeOptions = this.sourceNodeOptions.get(sourceId);
|
||||
return _objectSpread({
|
||||
dropEffect: this.altKeyPressed ? 'copy' : 'move'
|
||||
}, sourceNodeOptions || {});
|
||||
}
|
||||
getCurrentDropEffect() {
|
||||
if (this.isDraggingNativeItem()) {
|
||||
// It makes more sense to default to 'copy' for native resources
|
||||
return 'copy';
|
||||
}
|
||||
return this.getCurrentSourceNodeOptions().dropEffect;
|
||||
}
|
||||
getCurrentSourcePreviewNodeOptions() {
|
||||
const sourceId = this.monitor.getSourceId();
|
||||
const sourcePreviewNodeOptions = this.sourcePreviewNodeOptions.get(sourceId);
|
||||
return _objectSpread({
|
||||
anchorX: 0.5,
|
||||
anchorY: 0.5,
|
||||
captureDraggingState: false
|
||||
}, sourcePreviewNodeOptions || {});
|
||||
}
|
||||
isDraggingNativeItem() {
|
||||
const itemType = this.monitor.getItemType();
|
||||
return Object.keys(NativeTypes).some((key)=>NativeTypes[key] === itemType
|
||||
);
|
||||
}
|
||||
beginDragNativeItem(type, dataTransfer) {
|
||||
this.clearCurrentDragSourceNode();
|
||||
this.currentNativeSource = createNativeDragSource(type, dataTransfer);
|
||||
this.currentNativeHandle = this.registry.addSource(type, this.currentNativeSource);
|
||||
this.actions.beginDrag([
|
||||
this.currentNativeHandle
|
||||
]);
|
||||
}
|
||||
setCurrentDragSourceNode(node) {
|
||||
this.clearCurrentDragSourceNode();
|
||||
this.currentDragSourceNode = node;
|
||||
// A timeout of > 0 is necessary to resolve Firefox issue referenced
|
||||
// See:
|
||||
// * https://github.com/react-dnd/react-dnd/pull/928
|
||||
// * https://github.com/react-dnd/react-dnd/issues/869
|
||||
const MOUSE_MOVE_TIMEOUT = 1000;
|
||||
// Receiving a mouse event in the middle of a dragging operation
|
||||
// means it has ended and the drag source node disappeared from DOM,
|
||||
// so the browser didn't dispatch the dragend event.
|
||||
//
|
||||
// We need to wait before we start listening for mousemove events.
|
||||
// This is needed because the drag preview needs to be drawn or else it fires an 'mousemove' event
|
||||
// immediately in some browsers.
|
||||
//
|
||||
// See:
|
||||
// * https://github.com/react-dnd/react-dnd/pull/928
|
||||
// * https://github.com/react-dnd/react-dnd/issues/869
|
||||
//
|
||||
this.mouseMoveTimeoutTimer = setTimeout(()=>{
|
||||
var ref;
|
||||
return (ref = this.rootElement) === null || ref === void 0 ? void 0 : ref.addEventListener('mousemove', this.endDragIfSourceWasRemovedFromDOM, true);
|
||||
}, MOUSE_MOVE_TIMEOUT);
|
||||
}
|
||||
clearCurrentDragSourceNode() {
|
||||
if (this.currentDragSourceNode) {
|
||||
this.currentDragSourceNode = null;
|
||||
if (this.rootElement) {
|
||||
var ref;
|
||||
(ref = this.window) === null || ref === void 0 ? void 0 : ref.clearTimeout(this.mouseMoveTimeoutTimer || undefined);
|
||||
this.rootElement.removeEventListener('mousemove', this.endDragIfSourceWasRemovedFromDOM, true);
|
||||
}
|
||||
this.mouseMoveTimeoutTimer = null;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
handleDragStart(e, sourceId) {
|
||||
if (e.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
if (!this.dragStartSourceIds) {
|
||||
this.dragStartSourceIds = [];
|
||||
}
|
||||
this.dragStartSourceIds.unshift(sourceId);
|
||||
}
|
||||
handleDragEnter(_e, targetId) {
|
||||
this.dragEnterTargetIds.unshift(targetId);
|
||||
}
|
||||
handleDragOver(_e, targetId) {
|
||||
if (this.dragOverTargetIds === null) {
|
||||
this.dragOverTargetIds = [];
|
||||
}
|
||||
this.dragOverTargetIds.unshift(targetId);
|
||||
}
|
||||
handleDrop(_e, targetId) {
|
||||
this.dropTargetIds.unshift(targetId);
|
||||
}
|
||||
constructor(manager, globalContext, options){
|
||||
this.sourcePreviewNodes = new Map();
|
||||
this.sourcePreviewNodeOptions = new Map();
|
||||
this.sourceNodes = new Map();
|
||||
this.sourceNodeOptions = new Map();
|
||||
this.dragStartSourceIds = null;
|
||||
this.dropTargetIds = [];
|
||||
this.dragEnterTargetIds = [];
|
||||
this.currentNativeSource = null;
|
||||
this.currentNativeHandle = null;
|
||||
this.currentDragSourceNode = null;
|
||||
this.altKeyPressed = false;
|
||||
this.mouseMoveTimeoutTimer = null;
|
||||
this.asyncEndDragFrameId = null;
|
||||
this.dragOverTargetIds = null;
|
||||
this.lastClientOffset = null;
|
||||
this.hoverRafId = null;
|
||||
this.getSourceClientOffset = (sourceId)=>{
|
||||
const source = this.sourceNodes.get(sourceId);
|
||||
return source && getNodeClientOffset(source) || null;
|
||||
};
|
||||
this.endDragNativeItem = ()=>{
|
||||
if (!this.isDraggingNativeItem()) {
|
||||
return;
|
||||
}
|
||||
this.actions.endDrag();
|
||||
if (this.currentNativeHandle) {
|
||||
this.registry.removeSource(this.currentNativeHandle);
|
||||
}
|
||||
this.currentNativeHandle = null;
|
||||
this.currentNativeSource = null;
|
||||
};
|
||||
this.isNodeInDocument = (node)=>{
|
||||
// Check the node either in the main document or in the current context
|
||||
return Boolean(node && this.document && this.document.body && this.document.body.contains(node));
|
||||
};
|
||||
this.endDragIfSourceWasRemovedFromDOM = ()=>{
|
||||
const node = this.currentDragSourceNode;
|
||||
if (node == null || this.isNodeInDocument(node)) {
|
||||
return;
|
||||
}
|
||||
if (this.clearCurrentDragSourceNode() && this.monitor.isDragging()) {
|
||||
this.actions.endDrag();
|
||||
}
|
||||
this.cancelHover();
|
||||
};
|
||||
this.scheduleHover = (dragOverTargetIds)=>{
|
||||
if (this.hoverRafId === null && typeof requestAnimationFrame !== 'undefined') {
|
||||
this.hoverRafId = requestAnimationFrame(()=>{
|
||||
if (this.monitor.isDragging()) {
|
||||
this.actions.hover(dragOverTargetIds || [], {
|
||||
clientOffset: this.lastClientOffset
|
||||
});
|
||||
}
|
||||
this.hoverRafId = null;
|
||||
});
|
||||
}
|
||||
};
|
||||
this.cancelHover = ()=>{
|
||||
if (this.hoverRafId !== null && typeof cancelAnimationFrame !== 'undefined') {
|
||||
cancelAnimationFrame(this.hoverRafId);
|
||||
this.hoverRafId = null;
|
||||
}
|
||||
};
|
||||
this.handleTopDragStartCapture = ()=>{
|
||||
this.clearCurrentDragSourceNode();
|
||||
this.dragStartSourceIds = [];
|
||||
};
|
||||
this.handleTopDragStart = (e)=>{
|
||||
if (e.defaultPrevented) {
|
||||
return;
|
||||
}
|
||||
const { dragStartSourceIds } = this;
|
||||
this.dragStartSourceIds = null;
|
||||
const clientOffset = getEventClientOffset(e);
|
||||
// Avoid crashing if we missed a drop event or our previous drag died
|
||||
if (this.monitor.isDragging()) {
|
||||
this.actions.endDrag();
|
||||
this.cancelHover();
|
||||
}
|
||||
// Don't publish the source just yet (see why below)
|
||||
this.actions.beginDrag(dragStartSourceIds || [], {
|
||||
publishSource: false,
|
||||
getSourceClientOffset: this.getSourceClientOffset,
|
||||
clientOffset
|
||||
});
|
||||
const { dataTransfer } = e;
|
||||
const nativeType = matchNativeItemType(dataTransfer);
|
||||
if (this.monitor.isDragging()) {
|
||||
if (dataTransfer && typeof dataTransfer.setDragImage === 'function') {
|
||||
// Use custom drag image if user specifies it.
|
||||
// If child drag source refuses drag but parent agrees,
|
||||
// use parent's node as drag image. Neither works in IE though.
|
||||
const sourceId = this.monitor.getSourceId();
|
||||
const sourceNode = this.sourceNodes.get(sourceId);
|
||||
const dragPreview = this.sourcePreviewNodes.get(sourceId) || sourceNode;
|
||||
if (dragPreview) {
|
||||
const { anchorX , anchorY , offsetX , offsetY } = this.getCurrentSourcePreviewNodeOptions();
|
||||
const anchorPoint = {
|
||||
anchorX,
|
||||
anchorY
|
||||
};
|
||||
const offsetPoint = {
|
||||
offsetX,
|
||||
offsetY
|
||||
};
|
||||
const dragPreviewOffset = getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint);
|
||||
dataTransfer.setDragImage(dragPreview, dragPreviewOffset.x, dragPreviewOffset.y);
|
||||
}
|
||||
}
|
||||
try {
|
||||
// Firefox won't drag without setting data
|
||||
dataTransfer === null || dataTransfer === void 0 ? void 0 : dataTransfer.setData('application/json', {});
|
||||
} catch (err) {
|
||||
// IE doesn't support MIME types in setData
|
||||
}
|
||||
// Store drag source node so we can check whether
|
||||
// it is removed from DOM and trigger endDrag manually.
|
||||
this.setCurrentDragSourceNode(e.target);
|
||||
// Now we are ready to publish the drag source.. or are we not?
|
||||
const { captureDraggingState } = this.getCurrentSourcePreviewNodeOptions();
|
||||
if (!captureDraggingState) {
|
||||
// Usually we want to publish it in the next tick so that browser
|
||||
// is able to screenshot the current (not yet dragging) state.
|
||||
//
|
||||
// It also neatly avoids a situation where render() returns null
|
||||
// in the same tick for the source element, and browser freaks out.
|
||||
setTimeout(()=>this.actions.publishDragSource()
|
||||
, 0);
|
||||
} else {
|
||||
// In some cases the user may want to override this behavior, e.g.
|
||||
// to work around IE not supporting custom drag previews.
|
||||
//
|
||||
// When using a custom drag layer, the only way to prevent
|
||||
// the default drag preview from drawing in IE is to screenshot
|
||||
// the dragging state in which the node itself has zero opacity
|
||||
// and height. In this case, though, returning null from render()
|
||||
// will abruptly end the dragging, which is not obvious.
|
||||
//
|
||||
// This is the reason such behavior is strictly opt-in.
|
||||
this.actions.publishDragSource();
|
||||
}
|
||||
} else if (nativeType) {
|
||||
// A native item (such as URL) dragged from inside the document
|
||||
this.beginDragNativeItem(nativeType);
|
||||
} else if (dataTransfer && !dataTransfer.types && (e.target && !e.target.hasAttribute || !e.target.hasAttribute('draggable'))) {
|
||||
// Looks like a Safari bug: dataTransfer.types is null, but there was no draggable.
|
||||
// Just let it drag. It's a native type (URL or text) and will be picked up in
|
||||
// dragenter handler.
|
||||
return;
|
||||
} else {
|
||||
// If by this time no drag source reacted, tell browser not to drag.
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
this.handleTopDragEndCapture = ()=>{
|
||||
if (this.clearCurrentDragSourceNode() && this.monitor.isDragging()) {
|
||||
// Firefox can dispatch this event in an infinite loop
|
||||
// if dragend handler does something like showing an alert.
|
||||
// Only proceed if we have not handled it already.
|
||||
this.actions.endDrag();
|
||||
}
|
||||
this.cancelHover();
|
||||
};
|
||||
this.handleTopDragEnterCapture = (e)=>{
|
||||
this.dragEnterTargetIds = [];
|
||||
if (this.isDraggingNativeItem()) {
|
||||
var ref;
|
||||
(ref = this.currentNativeSource) === null || ref === void 0 ? void 0 : ref.loadDataTransfer(e.dataTransfer);
|
||||
}
|
||||
const isFirstEnter = this.enterLeaveCounter.enter(e.target);
|
||||
if (!isFirstEnter || this.monitor.isDragging()) {
|
||||
return;
|
||||
}
|
||||
const { dataTransfer } = e;
|
||||
const nativeType = matchNativeItemType(dataTransfer);
|
||||
if (nativeType) {
|
||||
// A native item (such as file or URL) dragged from outside the document
|
||||
this.beginDragNativeItem(nativeType, dataTransfer);
|
||||
}
|
||||
};
|
||||
this.handleTopDragEnter = (e)=>{
|
||||
const { dragEnterTargetIds } = this;
|
||||
this.dragEnterTargetIds = [];
|
||||
if (!this.monitor.isDragging()) {
|
||||
// This is probably a native item type we don't understand.
|
||||
return;
|
||||
}
|
||||
this.altKeyPressed = e.altKey;
|
||||
// If the target changes position as the result of `dragenter`, `dragover` might still
|
||||
// get dispatched despite target being no longer there. The easy solution is to check
|
||||
// whether there actually is a target before firing `hover`.
|
||||
if (dragEnterTargetIds.length > 0) {
|
||||
this.actions.hover(dragEnterTargetIds, {
|
||||
clientOffset: getEventClientOffset(e)
|
||||
});
|
||||
}
|
||||
const canDrop = dragEnterTargetIds.some((targetId)=>this.monitor.canDropOnTarget(targetId)
|
||||
);
|
||||
if (canDrop) {
|
||||
// IE requires this to fire dragover events
|
||||
e.preventDefault();
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.dropEffect = this.getCurrentDropEffect();
|
||||
}
|
||||
}
|
||||
};
|
||||
this.handleTopDragOverCapture = (e)=>{
|
||||
this.dragOverTargetIds = [];
|
||||
if (this.isDraggingNativeItem()) {
|
||||
var ref;
|
||||
(ref = this.currentNativeSource) === null || ref === void 0 ? void 0 : ref.loadDataTransfer(e.dataTransfer);
|
||||
}
|
||||
};
|
||||
this.handleTopDragOver = (e)=>{
|
||||
const { dragOverTargetIds } = this;
|
||||
this.dragOverTargetIds = [];
|
||||
if (!this.monitor.isDragging()) {
|
||||
// This is probably a native item type we don't understand.
|
||||
// Prevent default "drop and blow away the whole document" action.
|
||||
e.preventDefault();
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.dropEffect = 'none';
|
||||
}
|
||||
return;
|
||||
}
|
||||
this.altKeyPressed = e.altKey;
|
||||
this.lastClientOffset = getEventClientOffset(e);
|
||||
this.scheduleHover(dragOverTargetIds);
|
||||
const canDrop = (dragOverTargetIds || []).some((targetId)=>this.monitor.canDropOnTarget(targetId)
|
||||
);
|
||||
if (canDrop) {
|
||||
// Show user-specified drop effect.
|
||||
e.preventDefault();
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.dropEffect = this.getCurrentDropEffect();
|
||||
}
|
||||
} else if (this.isDraggingNativeItem()) {
|
||||
// Don't show a nice cursor but still prevent default
|
||||
// "drop and blow away the whole document" action.
|
||||
e.preventDefault();
|
||||
} else {
|
||||
e.preventDefault();
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.dropEffect = 'none';
|
||||
}
|
||||
}
|
||||
};
|
||||
this.handleTopDragLeaveCapture = (e)=>{
|
||||
if (this.isDraggingNativeItem()) {
|
||||
e.preventDefault();
|
||||
}
|
||||
const isLastLeave = this.enterLeaveCounter.leave(e.target);
|
||||
if (!isLastLeave) {
|
||||
return;
|
||||
}
|
||||
if (this.isDraggingNativeItem()) {
|
||||
setTimeout(()=>this.endDragNativeItem()
|
||||
, 0);
|
||||
}
|
||||
this.cancelHover();
|
||||
};
|
||||
this.handleTopDropCapture = (e)=>{
|
||||
this.dropTargetIds = [];
|
||||
if (this.isDraggingNativeItem()) {
|
||||
var ref;
|
||||
e.preventDefault();
|
||||
(ref = this.currentNativeSource) === null || ref === void 0 ? void 0 : ref.loadDataTransfer(e.dataTransfer);
|
||||
} else if (matchNativeItemType(e.dataTransfer)) {
|
||||
// Dragging some elements, like <a> and <img> may still behave like a native drag event,
|
||||
// even if the current drag event matches a user-defined type.
|
||||
// Stop the default behavior when we're not expecting a native item to be dropped.
|
||||
e.preventDefault();
|
||||
}
|
||||
this.enterLeaveCounter.reset();
|
||||
};
|
||||
this.handleTopDrop = (e)=>{
|
||||
const { dropTargetIds } = this;
|
||||
this.dropTargetIds = [];
|
||||
this.actions.hover(dropTargetIds, {
|
||||
clientOffset: getEventClientOffset(e)
|
||||
});
|
||||
this.actions.drop({
|
||||
dropEffect: this.getCurrentDropEffect()
|
||||
});
|
||||
if (this.isDraggingNativeItem()) {
|
||||
this.endDragNativeItem();
|
||||
} else if (this.monitor.isDragging()) {
|
||||
this.actions.endDrag();
|
||||
}
|
||||
this.cancelHover();
|
||||
};
|
||||
this.handleSelectStart = (e)=>{
|
||||
const target = e.target;
|
||||
// Only IE requires us to explicitly say
|
||||
// we want drag drop operation to start
|
||||
if (typeof target.dragDrop !== 'function') {
|
||||
return;
|
||||
}
|
||||
// Inputs and textareas should be selectable
|
||||
if (target.tagName === 'INPUT' || target.tagName === 'SELECT' || target.tagName === 'TEXTAREA' || target.isContentEditable) {
|
||||
return;
|
||||
}
|
||||
// For other targets, ask IE
|
||||
// to enable drag and drop
|
||||
e.preventDefault();
|
||||
target.dragDrop();
|
||||
};
|
||||
this.options = new OptionsReader(globalContext, options);
|
||||
this.actions = manager.getActions();
|
||||
this.monitor = manager.getMonitor();
|
||||
this.registry = manager.getRegistry();
|
||||
this.enterLeaveCounter = new EnterLeaveCounter(this.isNodeInDocument);
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=HTML5BackendImpl.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/HTML5BackendImpl.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/HTML5BackendImpl.js.map
generated
vendored
File diff suppressed because one or more lines are too long
9
frontend/node_modules/react-dnd-html5-backend/dist/MonotonicInterpolant.d.ts
generated
vendored
9
frontend/node_modules/react-dnd-html5-backend/dist/MonotonicInterpolant.d.ts
generated
vendored
@@ -1,9 +0,0 @@
|
||||
export declare class MonotonicInterpolant {
|
||||
private xs;
|
||||
private ys;
|
||||
private c1s;
|
||||
private c2s;
|
||||
private c3s;
|
||||
constructor(xs: number[], ys: number[]);
|
||||
interpolate(x: number): number;
|
||||
}
|
||||
89
frontend/node_modules/react-dnd-html5-backend/dist/MonotonicInterpolant.js
generated
vendored
89
frontend/node_modules/react-dnd-html5-backend/dist/MonotonicInterpolant.js
generated
vendored
@@ -1,89 +0,0 @@
|
||||
export class MonotonicInterpolant {
|
||||
interpolate(x) {
|
||||
const { xs , ys , c1s , c2s , c3s } = this;
|
||||
// The rightmost point in the dataset should give an exact result
|
||||
let i = xs.length - 1;
|
||||
if (x === xs[i]) {
|
||||
return ys[i];
|
||||
}
|
||||
// Search for the interval x is in, returning the corresponding y if x is one of the original xs
|
||||
let low = 0;
|
||||
let high = c3s.length - 1;
|
||||
let mid;
|
||||
while(low <= high){
|
||||
mid = Math.floor(0.5 * (low + high));
|
||||
const xHere = xs[mid];
|
||||
if (xHere < x) {
|
||||
low = mid + 1;
|
||||
} else if (xHere > x) {
|
||||
high = mid - 1;
|
||||
} else {
|
||||
return ys[mid];
|
||||
}
|
||||
}
|
||||
i = Math.max(0, high);
|
||||
// Interpolate
|
||||
const diff = x - xs[i];
|
||||
const diffSq = diff * diff;
|
||||
return ys[i] + c1s[i] * diff + c2s[i] * diffSq + c3s[i] * diff * diffSq;
|
||||
}
|
||||
constructor(xs, ys){
|
||||
const { length } = xs;
|
||||
// Rearrange xs and ys so that xs is sorted
|
||||
const indexes = [];
|
||||
for(let i = 0; i < length; i++){
|
||||
indexes.push(i);
|
||||
}
|
||||
indexes.sort((a, b)=>xs[a] < xs[b] ? -1 : 1
|
||||
);
|
||||
// Get consecutive differences and slopes
|
||||
const dys = [];
|
||||
const dxs = [];
|
||||
const ms = [];
|
||||
let dx;
|
||||
let dy;
|
||||
for(let i1 = 0; i1 < length - 1; i1++){
|
||||
dx = xs[i1 + 1] - xs[i1];
|
||||
dy = ys[i1 + 1] - ys[i1];
|
||||
dxs.push(dx);
|
||||
dys.push(dy);
|
||||
ms.push(dy / dx);
|
||||
}
|
||||
// Get degree-1 coefficients
|
||||
const c1s = [
|
||||
ms[0]
|
||||
];
|
||||
for(let i2 = 0; i2 < dxs.length - 1; i2++){
|
||||
const m2 = ms[i2];
|
||||
const mNext = ms[i2 + 1];
|
||||
if (m2 * mNext <= 0) {
|
||||
c1s.push(0);
|
||||
} else {
|
||||
dx = dxs[i2];
|
||||
const dxNext = dxs[i2 + 1];
|
||||
const common = dx + dxNext;
|
||||
c1s.push(3 * common / ((common + dxNext) / m2 + (common + dx) / mNext));
|
||||
}
|
||||
}
|
||||
c1s.push(ms[ms.length - 1]);
|
||||
// Get degree-2 and degree-3 coefficients
|
||||
const c2s = [];
|
||||
const c3s = [];
|
||||
let m;
|
||||
for(let i3 = 0; i3 < c1s.length - 1; i3++){
|
||||
m = ms[i3];
|
||||
const c1 = c1s[i3];
|
||||
const invDx = 1 / dxs[i3];
|
||||
const common = c1 + c1s[i3 + 1] - m - m;
|
||||
c2s.push((m - c1 - common) * invDx);
|
||||
c3s.push(common * invDx * invDx);
|
||||
}
|
||||
this.xs = xs;
|
||||
this.ys = ys;
|
||||
this.c1s = c1s;
|
||||
this.c2s = c2s;
|
||||
this.c3s = c3s;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=MonotonicInterpolant.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/MonotonicInterpolant.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/MonotonicInterpolant.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -1,13 +0,0 @@
|
||||
import type { DragDropMonitor } from 'dnd-core';
|
||||
import type { NativeItemConfig } from './nativeTypesConfig.js';
|
||||
export declare class NativeDragSource {
|
||||
item: any;
|
||||
private config;
|
||||
constructor(config: NativeItemConfig);
|
||||
private initializeExposedProperties;
|
||||
loadDataTransfer(dataTransfer: DataTransfer | null | undefined): void;
|
||||
canDrag(): boolean;
|
||||
beginDrag(): any;
|
||||
isDragging(monitor: DragDropMonitor, handle: string): boolean;
|
||||
endDrag(): void;
|
||||
}
|
||||
50
frontend/node_modules/react-dnd-html5-backend/dist/NativeDragSources/NativeDragSource.js
generated
vendored
50
frontend/node_modules/react-dnd-html5-backend/dist/NativeDragSources/NativeDragSource.js
generated
vendored
@@ -1,50 +0,0 @@
|
||||
export class NativeDragSource {
|
||||
initializeExposedProperties() {
|
||||
Object.keys(this.config.exposeProperties).forEach((property)=>{
|
||||
Object.defineProperty(this.item, property, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get () {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`Browser doesn't allow reading "${property}" until the drop event.`);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
loadDataTransfer(dataTransfer) {
|
||||
if (dataTransfer) {
|
||||
const newProperties = {};
|
||||
Object.keys(this.config.exposeProperties).forEach((property)=>{
|
||||
const propertyFn = this.config.exposeProperties[property];
|
||||
if (propertyFn != null) {
|
||||
newProperties[property] = {
|
||||
value: propertyFn(dataTransfer, this.config.matchesTypes),
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
};
|
||||
}
|
||||
});
|
||||
Object.defineProperties(this.item, newProperties);
|
||||
}
|
||||
}
|
||||
canDrag() {
|
||||
return true;
|
||||
}
|
||||
beginDrag() {
|
||||
return this.item;
|
||||
}
|
||||
isDragging(monitor, handle) {
|
||||
return handle === monitor.getSourceId();
|
||||
}
|
||||
endDrag() {
|
||||
// empty
|
||||
}
|
||||
constructor(config){
|
||||
this.config = config;
|
||||
this.item = {};
|
||||
this.initializeExposedProperties();
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=NativeDragSource.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/NativeDragSources/NativeDragSource.ts"],"sourcesContent":["import type { DragDropMonitor } from 'dnd-core'\n\nimport type { NativeItemConfig } from './nativeTypesConfig.js'\n\nexport class NativeDragSource {\n\tpublic item: any\n\tprivate config: NativeItemConfig\n\n\tpublic constructor(config: NativeItemConfig) {\n\t\tthis.config = config\n\t\tthis.item = {}\n\t\tthis.initializeExposedProperties()\n\t}\n\n\tprivate initializeExposedProperties() {\n\t\tObject.keys(this.config.exposeProperties).forEach((property) => {\n\t\t\tObject.defineProperty(this.item, property, {\n\t\t\t\tconfigurable: true, // This is needed to allow redefining it later\n\t\t\t\tenumerable: true,\n\t\t\t\tget() {\n\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`Browser doesn't allow reading \"${property}\" until the drop event.`,\n\t\t\t\t\t)\n\t\t\t\t\treturn null\n\t\t\t\t},\n\t\t\t})\n\t\t})\n\t}\n\n\tpublic loadDataTransfer(dataTransfer: DataTransfer | null | undefined): void {\n\t\tif (dataTransfer) {\n\t\t\tconst newProperties: PropertyDescriptorMap = {}\n\t\t\tObject.keys(this.config.exposeProperties).forEach((property) => {\n\t\t\t\tconst propertyFn = this.config.exposeProperties[property]\n\t\t\t\tif (propertyFn != null) {\n\t\t\t\t\tnewProperties[property] = {\n\t\t\t\t\t\tvalue: propertyFn(dataTransfer, this.config.matchesTypes),\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\tObject.defineProperties(this.item, newProperties)\n\t\t}\n\t}\n\n\tpublic canDrag(): boolean {\n\t\treturn true\n\t}\n\n\tpublic beginDrag(): any {\n\t\treturn this.item\n\t}\n\n\tpublic isDragging(monitor: DragDropMonitor, handle: string): boolean {\n\t\treturn handle === monitor.getSourceId()\n\t}\n\n\tpublic endDrag(): void {\n\t\t// empty\n\t}\n}\n"],"names":["NativeDragSource","initializeExposedProperties","Object","keys","config","exposeProperties","forEach","property","defineProperty","item","configurable","enumerable","get","console","warn","loadDataTransfer","dataTransfer","newProperties","propertyFn","value","matchesTypes","defineProperties","canDrag","beginDrag","isDragging","monitor","handle","getSourceId","endDrag"],"mappings":"AAIA,OAAO,MAAMA,gBAAgB;IAU5B,AAAQC,2BAA2B,GAAG;QACrCC,MAAM,CAACC,IAAI,CAAC,IAAI,CAACC,MAAM,CAACC,gBAAgB,CAAC,CAACC,OAAO,CAAC,CAACC,QAAQ,GAAK;YAC/DL,MAAM,CAACM,cAAc,CAAC,IAAI,CAACC,IAAI,EAAEF,QAAQ,EAAE;gBAC1CG,YAAY,EAAE,IAAI;gBAClBC,UAAU,EAAE,IAAI;gBAChBC,GAAG,IAAG;oBACL,sCAAsC;oBACtCC,OAAO,CAACC,IAAI,CACX,CAAC,+BAA+B,EAAEP,QAAQ,CAAC,uBAAuB,CAAC,CACnE;oBACD,OAAO,IAAI,CAAA;iBACX;aACD,CAAC;SACF,CAAC;KACF;IAED,AAAOQ,gBAAgB,CAACC,YAA6C,EAAQ;QAC5E,IAAIA,YAAY,EAAE;YACjB,MAAMC,aAAa,GAA0B,EAAE;YAC/Cf,MAAM,CAACC,IAAI,CAAC,IAAI,CAACC,MAAM,CAACC,gBAAgB,CAAC,CAACC,OAAO,CAAC,CAACC,QAAQ,GAAK;gBAC/D,MAAMW,UAAU,GAAG,IAAI,CAACd,MAAM,CAACC,gBAAgB,CAACE,QAAQ,CAAC;gBACzD,IAAIW,UAAU,IAAI,IAAI,EAAE;oBACvBD,aAAa,CAACV,QAAQ,CAAC,GAAG;wBACzBY,KAAK,EAAED,UAAU,CAACF,YAAY,EAAE,IAAI,CAACZ,MAAM,CAACgB,YAAY,CAAC;wBACzDV,YAAY,EAAE,IAAI;wBAClBC,UAAU,EAAE,IAAI;qBAChB;iBACD;aACD,CAAC;YACFT,MAAM,CAACmB,gBAAgB,CAAC,IAAI,CAACZ,IAAI,EAAEQ,aAAa,CAAC;SACjD;KACD;IAED,AAAOK,OAAO,GAAY;QACzB,OAAO,IAAI,CAAA;KACX;IAED,AAAOC,SAAS,GAAQ;QACvB,OAAO,IAAI,CAACd,IAAI,CAAA;KAChB;IAED,AAAOe,UAAU,CAACC,OAAwB,EAAEC,MAAc,EAAW;QACpE,OAAOA,MAAM,KAAKD,OAAO,CAACE,WAAW,EAAE,CAAA;KACvC;IAED,AAAOC,OAAO,GAAS;IACtB,QAAQ;KACR;IArDD,YAAmBxB,MAAwB,CAAE;QAC5C,IAAI,CAACA,MAAM,GAAGA,MAAM;QACpB,IAAI,CAACK,IAAI,GAAG,EAAE;QACd,IAAI,CAACR,2BAA2B,EAAE;KAClC;CAkDD"}
|
||||
@@ -1 +0,0 @@
|
||||
export declare function getDataFromDataTransfer(dataTransfer: DataTransfer, typesToTry: string[], defaultValue: string): string;
|
||||
@@ -1,7 +0,0 @@
|
||||
export function getDataFromDataTransfer(dataTransfer, typesToTry, defaultValue) {
|
||||
const result = typesToTry.reduce((resultSoFar, typeToTry)=>resultSoFar || dataTransfer.getData(typeToTry)
|
||||
, '');
|
||||
return result != null ? result : defaultValue;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=getDataFromDataTransfer.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/NativeDragSources/getDataFromDataTransfer.ts"],"sourcesContent":["export function getDataFromDataTransfer(\n\tdataTransfer: DataTransfer,\n\ttypesToTry: string[],\n\tdefaultValue: string,\n): string {\n\tconst result = typesToTry.reduce(\n\t\t(resultSoFar, typeToTry) => resultSoFar || dataTransfer.getData(typeToTry),\n\t\t'',\n\t)\n\n\treturn result != null ? result : defaultValue\n}\n"],"names":["getDataFromDataTransfer","dataTransfer","typesToTry","defaultValue","result","reduce","resultSoFar","typeToTry","getData"],"mappings":"AAAA,OAAO,SAASA,uBAAuB,CACtCC,YAA0B,EAC1BC,UAAoB,EACpBC,YAAoB,EACX;IACT,MAAMC,MAAM,GAAGF,UAAU,CAACG,MAAM,CAC/B,CAACC,WAAW,EAAEC,SAAS,GAAKD,WAAW,IAAIL,YAAY,CAACO,OAAO,CAACD,SAAS,CAAC;IAAA,EAC1E,EAAE,CACF;IAED,OAAOH,MAAM,IAAI,IAAI,GAAGA,MAAM,GAAGD,YAAY,CAAA;CAC7C"}
|
||||
3
frontend/node_modules/react-dnd-html5-backend/dist/NativeDragSources/index.d.ts
generated
vendored
3
frontend/node_modules/react-dnd-html5-backend/dist/NativeDragSources/index.d.ts
generated
vendored
@@ -1,3 +0,0 @@
|
||||
import { NativeDragSource } from './NativeDragSource.js';
|
||||
export declare function createNativeDragSource(type: string, dataTransfer?: DataTransfer): NativeDragSource;
|
||||
export declare function matchNativeItemType(dataTransfer: DataTransfer | null): string | null;
|
||||
27
frontend/node_modules/react-dnd-html5-backend/dist/NativeDragSources/index.js
generated
vendored
27
frontend/node_modules/react-dnd-html5-backend/dist/NativeDragSources/index.js
generated
vendored
@@ -1,27 +0,0 @@
|
||||
import { NativeDragSource } from './NativeDragSource.js';
|
||||
import { nativeTypesConfig } from './nativeTypesConfig.js';
|
||||
export function createNativeDragSource(type, dataTransfer) {
|
||||
const config = nativeTypesConfig[type];
|
||||
if (!config) {
|
||||
throw new Error(`native type ${type} has no configuration`);
|
||||
}
|
||||
const result = new NativeDragSource(config);
|
||||
result.loadDataTransfer(dataTransfer);
|
||||
return result;
|
||||
}
|
||||
export function matchNativeItemType(dataTransfer) {
|
||||
if (!dataTransfer) {
|
||||
return null;
|
||||
}
|
||||
const dataTransferTypes = Array.prototype.slice.call(dataTransfer.types || []);
|
||||
return Object.keys(nativeTypesConfig).filter((nativeItemType)=>{
|
||||
const typeConfig = nativeTypesConfig[nativeItemType];
|
||||
if (!(typeConfig === null || typeConfig === void 0 ? void 0 : typeConfig.matchesTypes)) {
|
||||
return false;
|
||||
}
|
||||
return typeConfig.matchesTypes.some((t)=>dataTransferTypes.indexOf(t) > -1
|
||||
);
|
||||
})[0] || null;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/NativeDragSources/index.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/NativeDragSources/index.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/NativeDragSources/index.ts"],"sourcesContent":["import { NativeDragSource } from './NativeDragSource.js'\nimport { nativeTypesConfig } from './nativeTypesConfig.js'\n\nexport function createNativeDragSource(\n\ttype: string,\n\tdataTransfer?: DataTransfer,\n): NativeDragSource {\n\tconst config = nativeTypesConfig[type]\n\tif (!config) {\n\t\tthrow new Error(`native type ${type} has no configuration`)\n\t}\n\tconst result = new NativeDragSource(config)\n\tresult.loadDataTransfer(dataTransfer)\n\treturn result\n}\n\nexport function matchNativeItemType(\n\tdataTransfer: DataTransfer | null,\n): string | null {\n\tif (!dataTransfer) {\n\t\treturn null\n\t}\n\n\tconst dataTransferTypes = Array.prototype.slice.call(dataTransfer.types || [])\n\treturn (\n\t\tObject.keys(nativeTypesConfig).filter((nativeItemType) => {\n\t\t\tconst typeConfig = nativeTypesConfig[nativeItemType]\n\t\t\tif (!typeConfig?.matchesTypes) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn typeConfig.matchesTypes.some(\n\t\t\t\t(t) => dataTransferTypes.indexOf(t) > -1,\n\t\t\t)\n\t\t})[0] || null\n\t)\n}\n"],"names":["NativeDragSource","nativeTypesConfig","createNativeDragSource","type","dataTransfer","config","Error","result","loadDataTransfer","matchNativeItemType","dataTransferTypes","Array","prototype","slice","call","types","Object","keys","filter","nativeItemType","typeConfig","matchesTypes","some","t","indexOf"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,uBAAuB,CAAA;AACxD,SAASC,iBAAiB,QAAQ,wBAAwB,CAAA;AAE1D,OAAO,SAASC,sBAAsB,CACrCC,IAAY,EACZC,YAA2B,EACR;IACnB,MAAMC,MAAM,GAAGJ,iBAAiB,CAACE,IAAI,CAAC;IACtC,IAAI,CAACE,MAAM,EAAE;QACZ,MAAM,IAAIC,KAAK,CAAC,CAAC,YAAY,EAAEH,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAA;KAC3D;IACD,MAAMI,MAAM,GAAG,IAAIP,gBAAgB,CAACK,MAAM,CAAC;IAC3CE,MAAM,CAACC,gBAAgB,CAACJ,YAAY,CAAC;IACrC,OAAOG,MAAM,CAAA;CACb;AAED,OAAO,SAASE,mBAAmB,CAClCL,YAAiC,EACjB;IAChB,IAAI,CAACA,YAAY,EAAE;QAClB,OAAO,IAAI,CAAA;KACX;IAED,MAAMM,iBAAiB,GAAGC,KAAK,CAACC,SAAS,CAACC,KAAK,CAACC,IAAI,CAACV,YAAY,CAACW,KAAK,IAAI,EAAE,CAAC;IAC9E,OACCC,MAAM,CAACC,IAAI,CAAChB,iBAAiB,CAAC,CAACiB,MAAM,CAAC,CAACC,cAAc,GAAK;QACzD,MAAMC,UAAU,GAAGnB,iBAAiB,CAACkB,cAAc,CAAC;QACpD,IAAI,CAACC,CAAAA,UAAU,aAAVA,UAAU,WAAc,GAAxBA,KAAAA,CAAwB,GAAxBA,UAAU,CAAEC,YAAY,CAAA,EAAE;YAC9B,OAAO,KAAK,CAAA;SACZ;QACD,OAAOD,UAAU,CAACC,YAAY,CAACC,IAAI,CAClC,CAACC,CAAC,GAAKb,iBAAiB,CAACc,OAAO,CAACD,CAAC,CAAC,GAAG,CAAC,CAAC;QAAA,CACxC,CAAA;KACD,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CACb;CACD"}
|
||||
@@ -1,10 +0,0 @@
|
||||
export interface NativeItemConfigExposePropreties {
|
||||
[property: string]: (dataTransfer: DataTransfer, matchesTypes: string[]) => any;
|
||||
}
|
||||
export interface NativeItemConfig {
|
||||
exposeProperties: NativeItemConfigExposePropreties;
|
||||
matchesTypes: string[];
|
||||
}
|
||||
export declare const nativeTypesConfig: {
|
||||
[key: string]: NativeItemConfig;
|
||||
};
|
||||
@@ -1,51 +0,0 @@
|
||||
import * as NativeTypes from '../NativeTypes.js';
|
||||
import { getDataFromDataTransfer } from './getDataFromDataTransfer.js';
|
||||
export const nativeTypesConfig = {
|
||||
[NativeTypes.FILE]: {
|
||||
exposeProperties: {
|
||||
files: (dataTransfer)=>Array.prototype.slice.call(dataTransfer.files)
|
||||
,
|
||||
items: (dataTransfer)=>dataTransfer.items
|
||||
,
|
||||
dataTransfer: (dataTransfer)=>dataTransfer
|
||||
},
|
||||
matchesTypes: [
|
||||
'Files'
|
||||
]
|
||||
},
|
||||
[NativeTypes.HTML]: {
|
||||
exposeProperties: {
|
||||
html: (dataTransfer, matchesTypes)=>getDataFromDataTransfer(dataTransfer, matchesTypes, '')
|
||||
,
|
||||
dataTransfer: (dataTransfer)=>dataTransfer
|
||||
},
|
||||
matchesTypes: [
|
||||
'Html',
|
||||
'text/html'
|
||||
]
|
||||
},
|
||||
[NativeTypes.URL]: {
|
||||
exposeProperties: {
|
||||
urls: (dataTransfer, matchesTypes)=>getDataFromDataTransfer(dataTransfer, matchesTypes, '').split('\n')
|
||||
,
|
||||
dataTransfer: (dataTransfer)=>dataTransfer
|
||||
},
|
||||
matchesTypes: [
|
||||
'Url',
|
||||
'text/uri-list'
|
||||
]
|
||||
},
|
||||
[NativeTypes.TEXT]: {
|
||||
exposeProperties: {
|
||||
text: (dataTransfer, matchesTypes)=>getDataFromDataTransfer(dataTransfer, matchesTypes, '')
|
||||
,
|
||||
dataTransfer: (dataTransfer)=>dataTransfer
|
||||
},
|
||||
matchesTypes: [
|
||||
'Text',
|
||||
'text/plain'
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
//# sourceMappingURL=nativeTypesConfig.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/NativeDragSources/nativeTypesConfig.ts"],"sourcesContent":["import * as NativeTypes from '../NativeTypes.js'\nimport { getDataFromDataTransfer } from './getDataFromDataTransfer.js'\n\nexport interface NativeItemConfigExposePropreties {\n\t[property: string]: (\n\t\tdataTransfer: DataTransfer,\n\t\tmatchesTypes: string[],\n\t) => any\n}\n\nexport interface NativeItemConfig {\n\texposeProperties: NativeItemConfigExposePropreties\n\tmatchesTypes: string[]\n}\n\nexport const nativeTypesConfig: {\n\t[key: string]: NativeItemConfig\n} = {\n\t[NativeTypes.FILE]: {\n\t\texposeProperties: {\n\t\t\tfiles: (dataTransfer: DataTransfer): File[] =>\n\t\t\t\tArray.prototype.slice.call(dataTransfer.files),\n\t\t\titems: (dataTransfer: DataTransfer): DataTransferItemList =>\n\t\t\t\tdataTransfer.items,\n\t\t\tdataTransfer: (dataTransfer: DataTransfer): DataTransfer => dataTransfer,\n\t\t},\n\t\tmatchesTypes: ['Files'],\n\t},\n\t[NativeTypes.HTML]: {\n\t\texposeProperties: {\n\t\t\thtml: (dataTransfer: DataTransfer, matchesTypes: string[]): string =>\n\t\t\t\tgetDataFromDataTransfer(dataTransfer, matchesTypes, ''),\n\t\t\tdataTransfer: (dataTransfer: DataTransfer): DataTransfer => dataTransfer,\n\t\t},\n\t\tmatchesTypes: ['Html', 'text/html'],\n\t},\n\t[NativeTypes.URL]: {\n\t\texposeProperties: {\n\t\t\turls: (dataTransfer: DataTransfer, matchesTypes: string[]): string[] =>\n\t\t\t\tgetDataFromDataTransfer(dataTransfer, matchesTypes, '').split('\\n'),\n\t\t\tdataTransfer: (dataTransfer: DataTransfer): DataTransfer => dataTransfer,\n\t\t},\n\t\tmatchesTypes: ['Url', 'text/uri-list'],\n\t},\n\t[NativeTypes.TEXT]: {\n\t\texposeProperties: {\n\t\t\ttext: (dataTransfer: DataTransfer, matchesTypes: string[]): string =>\n\t\t\t\tgetDataFromDataTransfer(dataTransfer, matchesTypes, ''),\n\t\t\tdataTransfer: (dataTransfer: DataTransfer): DataTransfer => dataTransfer,\n\t\t},\n\t\tmatchesTypes: ['Text', 'text/plain'],\n\t},\n}\n"],"names":["NativeTypes","getDataFromDataTransfer","nativeTypesConfig","FILE","exposeProperties","files","dataTransfer","Array","prototype","slice","call","items","matchesTypes","HTML","html","URL","urls","split","TEXT","text"],"mappings":"AAAA,YAAYA,WAAW,MAAM,mBAAmB,CAAA;AAChD,SAASC,uBAAuB,QAAQ,8BAA8B,CAAA;AActE,OAAO,MAAMC,iBAAiB,GAE1B;IACH,CAACF,WAAW,CAACG,IAAI,CAAC,EAAE;QACnBC,gBAAgB,EAAE;YACjBC,KAAK,EAAE,CAACC,YAA0B,GACjCC,KAAK,CAACC,SAAS,CAACC,KAAK,CAACC,IAAI,CAACJ,YAAY,CAACD,KAAK,CAAC;YAAA;YAC/CM,KAAK,EAAE,CAACL,YAA0B,GACjCA,YAAY,CAACK,KAAK;YAAA;YACnBL,YAAY,EAAE,CAACA,YAA0B,GAAmBA,YAAY;SACxE;QACDM,YAAY,EAAE;YAAC,OAAO;SAAC;KACvB;IACD,CAACZ,WAAW,CAACa,IAAI,CAAC,EAAE;QACnBT,gBAAgB,EAAE;YACjBU,IAAI,EAAE,CAACR,YAA0B,EAAEM,YAAsB,GACxDX,uBAAuB,CAACK,YAAY,EAAEM,YAAY,EAAE,EAAE,CAAC;YAAA;YACxDN,YAAY,EAAE,CAACA,YAA0B,GAAmBA,YAAY;SACxE;QACDM,YAAY,EAAE;YAAC,MAAM;YAAE,WAAW;SAAC;KACnC;IACD,CAACZ,WAAW,CAACe,GAAG,CAAC,EAAE;QAClBX,gBAAgB,EAAE;YACjBY,IAAI,EAAE,CAACV,YAA0B,EAAEM,YAAsB,GACxDX,uBAAuB,CAACK,YAAY,EAAEM,YAAY,EAAE,EAAE,CAAC,CAACK,KAAK,CAAC,IAAI,CAAC;YAAA;YACpEX,YAAY,EAAE,CAACA,YAA0B,GAAmBA,YAAY;SACxE;QACDM,YAAY,EAAE;YAAC,KAAK;YAAE,eAAe;SAAC;KACtC;IACD,CAACZ,WAAW,CAACkB,IAAI,CAAC,EAAE;QACnBd,gBAAgB,EAAE;YACjBe,IAAI,EAAE,CAACb,YAA0B,EAAEM,YAAsB,GACxDX,uBAAuB,CAACK,YAAY,EAAEM,YAAY,EAAE,EAAE,CAAC;YAAA;YACxDN,YAAY,EAAE,CAACA,YAA0B,GAAmBA,YAAY;SACxE;QACDM,YAAY,EAAE;YAAC,MAAM;YAAE,YAAY;SAAC;KACpC;CACD,CAAA"}
|
||||
4
frontend/node_modules/react-dnd-html5-backend/dist/NativeTypes.d.ts
generated
vendored
4
frontend/node_modules/react-dnd-html5-backend/dist/NativeTypes.d.ts
generated
vendored
@@ -1,4 +0,0 @@
|
||||
export declare const FILE = "__NATIVE_FILE__";
|
||||
export declare const URL = "__NATIVE_URL__";
|
||||
export declare const TEXT = "__NATIVE_TEXT__";
|
||||
export declare const HTML = "__NATIVE_HTML__";
|
||||
6
frontend/node_modules/react-dnd-html5-backend/dist/NativeTypes.js
generated
vendored
6
frontend/node_modules/react-dnd-html5-backend/dist/NativeTypes.js
generated
vendored
@@ -1,6 +0,0 @@
|
||||
export const FILE = '__NATIVE_FILE__';
|
||||
export const URL = '__NATIVE_URL__';
|
||||
export const TEXT = '__NATIVE_TEXT__';
|
||||
export const HTML = '__NATIVE_HTML__';
|
||||
|
||||
//# sourceMappingURL=NativeTypes.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/NativeTypes.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/NativeTypes.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/NativeTypes.ts"],"sourcesContent":["export const FILE = '__NATIVE_FILE__'\nexport const URL = '__NATIVE_URL__'\nexport const TEXT = '__NATIVE_TEXT__'\nexport const HTML = '__NATIVE_HTML__'\n"],"names":["FILE","URL","TEXT","HTML"],"mappings":"AAAA,OAAO,MAAMA,IAAI,GAAG,iBAAiB,CAAA;AACrC,OAAO,MAAMC,GAAG,GAAG,gBAAgB,CAAA;AACnC,OAAO,MAAMC,IAAI,GAAG,iBAAiB,CAAA;AACrC,OAAO,MAAMC,IAAI,GAAG,iBAAiB,CAAA"}
|
||||
10
frontend/node_modules/react-dnd-html5-backend/dist/OffsetUtils.d.ts
generated
vendored
10
frontend/node_modules/react-dnd-html5-backend/dist/OffsetUtils.d.ts
generated
vendored
@@ -1,10 +0,0 @@
|
||||
import type { XYCoord } from 'dnd-core';
|
||||
export declare function getNodeClientOffset(node: Node): XYCoord | null;
|
||||
export declare function getEventClientOffset(e: MouseEvent): XYCoord;
|
||||
export declare function getDragPreviewOffset(sourceNode: HTMLElement, dragPreview: HTMLElement, clientOffset: XYCoord, anchorPoint: {
|
||||
anchorX: number;
|
||||
anchorY: number;
|
||||
}, offsetPoint: {
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
}): XYCoord;
|
||||
99
frontend/node_modules/react-dnd-html5-backend/dist/OffsetUtils.js
generated
vendored
99
frontend/node_modules/react-dnd-html5-backend/dist/OffsetUtils.js
generated
vendored
@@ -1,99 +0,0 @@
|
||||
import { isFirefox, isSafari } from './BrowserDetector.js';
|
||||
import { MonotonicInterpolant } from './MonotonicInterpolant.js';
|
||||
const ELEMENT_NODE = 1;
|
||||
export function getNodeClientOffset(node) {
|
||||
const el = node.nodeType === ELEMENT_NODE ? node : node.parentElement;
|
||||
if (!el) {
|
||||
return null;
|
||||
}
|
||||
const { top , left } = el.getBoundingClientRect();
|
||||
return {
|
||||
x: left,
|
||||
y: top
|
||||
};
|
||||
}
|
||||
export function getEventClientOffset(e) {
|
||||
return {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
};
|
||||
}
|
||||
function isImageNode(node) {
|
||||
var ref;
|
||||
return node.nodeName === 'IMG' && (isFirefox() || !((ref = document.documentElement) === null || ref === void 0 ? void 0 : ref.contains(node)));
|
||||
}
|
||||
function getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight) {
|
||||
let dragPreviewWidth = isImage ? dragPreview.width : sourceWidth;
|
||||
let dragPreviewHeight = isImage ? dragPreview.height : sourceHeight;
|
||||
// Work around @2x coordinate discrepancies in browsers
|
||||
if (isSafari() && isImage) {
|
||||
dragPreviewHeight /= window.devicePixelRatio;
|
||||
dragPreviewWidth /= window.devicePixelRatio;
|
||||
}
|
||||
return {
|
||||
dragPreviewWidth,
|
||||
dragPreviewHeight
|
||||
};
|
||||
}
|
||||
export function getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint, offsetPoint) {
|
||||
// The browsers will use the image intrinsic size under different conditions.
|
||||
// Firefox only cares if it's an image, but WebKit also wants it to be detached.
|
||||
const isImage = isImageNode(dragPreview);
|
||||
const dragPreviewNode = isImage ? sourceNode : dragPreview;
|
||||
const dragPreviewNodeOffsetFromClient = getNodeClientOffset(dragPreviewNode);
|
||||
const offsetFromDragPreview = {
|
||||
x: clientOffset.x - dragPreviewNodeOffsetFromClient.x,
|
||||
y: clientOffset.y - dragPreviewNodeOffsetFromClient.y
|
||||
};
|
||||
const { offsetWidth: sourceWidth , offsetHeight: sourceHeight } = sourceNode;
|
||||
const { anchorX , anchorY } = anchorPoint;
|
||||
const { dragPreviewWidth , dragPreviewHeight } = getDragPreviewSize(isImage, dragPreview, sourceWidth, sourceHeight);
|
||||
const calculateYOffset = ()=>{
|
||||
const interpolantY = new MonotonicInterpolant([
|
||||
0,
|
||||
0.5,
|
||||
1
|
||||
], [
|
||||
// Dock to the top
|
||||
offsetFromDragPreview.y,
|
||||
// Align at the center
|
||||
(offsetFromDragPreview.y / sourceHeight) * dragPreviewHeight,
|
||||
// Dock to the bottom
|
||||
offsetFromDragPreview.y + dragPreviewHeight - sourceHeight,
|
||||
]);
|
||||
let y = interpolantY.interpolate(anchorY);
|
||||
// Work around Safari 8 positioning bug
|
||||
if (isSafari() && isImage) {
|
||||
// We'll have to wait for @3x to see if this is entirely correct
|
||||
y += (window.devicePixelRatio - 1) * dragPreviewHeight;
|
||||
}
|
||||
return y;
|
||||
};
|
||||
const calculateXOffset = ()=>{
|
||||
// Interpolate coordinates depending on anchor point
|
||||
// If you know a simpler way to do this, let me know
|
||||
const interpolantX = new MonotonicInterpolant([
|
||||
0,
|
||||
0.5,
|
||||
1
|
||||
], [
|
||||
// Dock to the left
|
||||
offsetFromDragPreview.x,
|
||||
// Align at the center
|
||||
(offsetFromDragPreview.x / sourceWidth) * dragPreviewWidth,
|
||||
// Dock to the right
|
||||
offsetFromDragPreview.x + dragPreviewWidth - sourceWidth,
|
||||
]);
|
||||
return interpolantX.interpolate(anchorX);
|
||||
};
|
||||
// Force offsets if specified in the options.
|
||||
const { offsetX , offsetY } = offsetPoint;
|
||||
const isManualOffsetX = offsetX === 0 || offsetX;
|
||||
const isManualOffsetY = offsetY === 0 || offsetY;
|
||||
return {
|
||||
x: isManualOffsetX ? offsetX : calculateXOffset(),
|
||||
y: isManualOffsetY ? offsetY : calculateYOffset()
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=OffsetUtils.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/OffsetUtils.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/OffsetUtils.js.map
generated
vendored
File diff suppressed because one or more lines are too long
10
frontend/node_modules/react-dnd-html5-backend/dist/OptionsReader.d.ts
generated
vendored
10
frontend/node_modules/react-dnd-html5-backend/dist/OptionsReader.d.ts
generated
vendored
@@ -1,10 +0,0 @@
|
||||
import type { HTML5BackendContext, HTML5BackendOptions } from './types.js';
|
||||
export declare class OptionsReader {
|
||||
ownerDocument: Document | null;
|
||||
private globalContext;
|
||||
private optionsArgs;
|
||||
constructor(globalContext: HTML5BackendContext, options?: HTML5BackendOptions);
|
||||
get window(): Window | undefined;
|
||||
get document(): Document | undefined;
|
||||
get rootElement(): Node | undefined;
|
||||
}
|
||||
31
frontend/node_modules/react-dnd-html5-backend/dist/OptionsReader.js
generated
vendored
31
frontend/node_modules/react-dnd-html5-backend/dist/OptionsReader.js
generated
vendored
@@ -1,31 +0,0 @@
|
||||
export class OptionsReader {
|
||||
get window() {
|
||||
if (this.globalContext) {
|
||||
return this.globalContext;
|
||||
} else if (typeof window !== 'undefined') {
|
||||
return window;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
get document() {
|
||||
var ref;
|
||||
if ((ref = this.globalContext) === null || ref === void 0 ? void 0 : ref.document) {
|
||||
return this.globalContext.document;
|
||||
} else if (this.window) {
|
||||
return this.window.document;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
get rootElement() {
|
||||
var ref;
|
||||
return ((ref = this.optionsArgs) === null || ref === void 0 ? void 0 : ref.rootElement) || this.window;
|
||||
}
|
||||
constructor(globalContext, options){
|
||||
this.ownerDocument = null;
|
||||
this.globalContext = globalContext;
|
||||
this.optionsArgs = options;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=OptionsReader.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/OptionsReader.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/OptionsReader.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/OptionsReader.ts"],"sourcesContent":["import type { HTML5BackendContext, HTML5BackendOptions } from './types.js'\n\nexport class OptionsReader {\n\tpublic ownerDocument: Document | null = null\n\tprivate globalContext: HTML5BackendContext\n\tprivate optionsArgs: HTML5BackendOptions | undefined\n\n\tpublic constructor(\n\t\tglobalContext: HTML5BackendContext,\n\t\toptions?: HTML5BackendOptions,\n\t) {\n\t\tthis.globalContext = globalContext\n\t\tthis.optionsArgs = options\n\t}\n\n\tpublic get window(): Window | undefined {\n\t\tif (this.globalContext) {\n\t\t\treturn this.globalContext\n\t\t} else if (typeof window !== 'undefined') {\n\t\t\treturn window\n\t\t}\n\t\treturn undefined\n\t}\n\n\tpublic get document(): Document | undefined {\n\t\tif (this.globalContext?.document) {\n\t\t\treturn this.globalContext.document\n\t\t} else if (this.window) {\n\t\t\treturn this.window.document\n\t\t} else {\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\tpublic get rootElement(): Node | undefined {\n\t\treturn this.optionsArgs?.rootElement || this.window\n\t}\n}\n"],"names":["OptionsReader","window","globalContext","undefined","document","rootElement","optionsArgs","options","ownerDocument"],"mappings":"AAEA,OAAO,MAAMA,aAAa;IAazB,IAAWC,MAAM,GAAuB;QACvC,IAAI,IAAI,CAACC,aAAa,EAAE;YACvB,OAAO,IAAI,CAACA,aAAa,CAAA;SACzB,MAAM,IAAI,OAAOD,MAAM,KAAK,WAAW,EAAE;YACzC,OAAOA,MAAM,CAAA;SACb;QACD,OAAOE,SAAS,CAAA;KAChB;IAED,IAAWC,QAAQ,GAAyB;YACvC,GAAkB;QAAtB,IAAI,CAAA,GAAkB,GAAlB,IAAI,CAACF,aAAa,cAAlB,GAAkB,WAAU,GAA5B,KAAA,CAA4B,GAA5B,GAAkB,CAAEE,QAAQ,EAAE;YACjC,OAAO,IAAI,CAACF,aAAa,CAACE,QAAQ,CAAA;SAClC,MAAM,IAAI,IAAI,CAACH,MAAM,EAAE;YACvB,OAAO,IAAI,CAACA,MAAM,CAACG,QAAQ,CAAA;SAC3B,MAAM;YACN,OAAOD,SAAS,CAAA;SAChB;KACD;IAED,IAAWE,WAAW,GAAqB;YACnC,GAAgB;QAAvB,OAAO,CAAA,CAAA,GAAgB,GAAhB,IAAI,CAACC,WAAW,cAAhB,GAAgB,WAAa,GAA7B,KAAA,CAA6B,GAA7B,GAAgB,CAAED,WAAW,CAAA,IAAI,IAAI,CAACJ,MAAM,CAAA;KACnD;IA7BD,YACCC,aAAkC,EAClCK,OAA6B,CAC5B;QAPF,KAAOC,aAAa,GAAoB,IAAI,AAH7C,CAG6C;QAQ3C,IAAI,CAACN,aAAa,GAAGA,aAAa;QAClC,IAAI,CAACI,WAAW,GAAGC,OAAO;KAC1B;CAwBD"}
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/getEmptyImage.d.ts
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/getEmptyImage.d.ts
generated
vendored
@@ -1 +0,0 @@
|
||||
export declare function getEmptyImage(): HTMLImageElement;
|
||||
10
frontend/node_modules/react-dnd-html5-backend/dist/getEmptyImage.js
generated
vendored
10
frontend/node_modules/react-dnd-html5-backend/dist/getEmptyImage.js
generated
vendored
@@ -1,10 +0,0 @@
|
||||
let emptyImage;
|
||||
export function getEmptyImage() {
|
||||
if (!emptyImage) {
|
||||
emptyImage = new Image();
|
||||
emptyImage.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
|
||||
}
|
||||
return emptyImage;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=getEmptyImage.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/getEmptyImage.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/getEmptyImage.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/getEmptyImage.ts"],"sourcesContent":["let emptyImage: HTMLImageElement | undefined\n\nexport function getEmptyImage(): HTMLImageElement {\n\tif (!emptyImage) {\n\t\temptyImage = new Image()\n\t\temptyImage.src =\n\t\t\t'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='\n\t}\n\n\treturn emptyImage\n}\n"],"names":["emptyImage","getEmptyImage","Image","src"],"mappings":"AAAA,IAAIA,UAAU,AAA8B;AAE5C,OAAO,SAASC,aAAa,GAAqB;IACjD,IAAI,CAACD,UAAU,EAAE;QAChBA,UAAU,GAAG,IAAIE,KAAK,EAAE;QACxBF,UAAU,CAACG,GAAG,GACb,4EAA4E;KAC7E;IAED,OAAOH,UAAU,CAAA;CACjB"}
|
||||
5
frontend/node_modules/react-dnd-html5-backend/dist/index.d.ts
generated
vendored
5
frontend/node_modules/react-dnd-html5-backend/dist/index.d.ts
generated
vendored
@@ -1,5 +0,0 @@
|
||||
import type { BackendFactory } from 'dnd-core';
|
||||
export { getEmptyImage } from './getEmptyImage.js';
|
||||
export * as NativeTypes from './NativeTypes.js';
|
||||
export type { HTML5BackendContext, HTML5BackendOptions } from './types.js';
|
||||
export declare const HTML5Backend: BackendFactory;
|
||||
9
frontend/node_modules/react-dnd-html5-backend/dist/index.js
generated
vendored
9
frontend/node_modules/react-dnd-html5-backend/dist/index.js
generated
vendored
@@ -1,9 +0,0 @@
|
||||
import { HTML5BackendImpl } from './HTML5BackendImpl.js';
|
||||
import * as _NativeTypes from './NativeTypes.js';
|
||||
export { getEmptyImage } from './getEmptyImage.js';
|
||||
export { _NativeTypes as NativeTypes };
|
||||
export const HTML5Backend = function createBackend(manager, context, options) {
|
||||
return new HTML5BackendImpl(manager, context, options);
|
||||
};
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/index.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/index.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { BackendFactory, DragDropManager } from 'dnd-core'\n\nimport { HTML5BackendImpl } from './HTML5BackendImpl.js'\nimport type { HTML5BackendContext, HTML5BackendOptions } from './types.js'\nexport { getEmptyImage } from './getEmptyImage.js'\nexport * as NativeTypes from './NativeTypes.js'\nexport type { HTML5BackendContext, HTML5BackendOptions } from './types.js'\n\nexport const HTML5Backend: BackendFactory = function createBackend(\n\tmanager: DragDropManager,\n\tcontext?: HTML5BackendContext,\n\toptions?: HTML5BackendOptions,\n): HTML5BackendImpl {\n\treturn new HTML5BackendImpl(manager, context, options)\n}\n"],"names":["HTML5BackendImpl","NativeTypes","getEmptyImage","HTML5Backend","createBackend","manager","context","options"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,uBAAuB,CAAA;YAG5CC,YAAW,MAAM,kBAAkB;AAD/C,SAASC,aAAa,QAAQ,oBAAoB,CAAA;SACtCD,YAAW,IAAXA,WAAW;AAGvB,OAAO,MAAME,YAAY,GAAmB,SAASC,aAAa,CACjEC,OAAwB,EACxBC,OAA6B,EAC7BC,OAA6B,EACV;IACnB,OAAO,IAAIP,gBAAgB,CAACK,OAAO,EAAEC,OAAO,EAAEC,OAAO,CAAC,CAAA;CACtD,CAAA"}
|
||||
2
frontend/node_modules/react-dnd-html5-backend/dist/matchesType.d.ts
generated
vendored
2
frontend/node_modules/react-dnd-html5-backend/dist/matchesType.d.ts
generated
vendored
@@ -1,2 +0,0 @@
|
||||
import type { SourceType, TargetType } from 'dnd-core';
|
||||
export declare function matchesType(targetType: TargetType | null, draggedItemType: SourceType | null): boolean;
|
||||
9
frontend/node_modules/react-dnd-html5-backend/dist/matchesType.js
generated
vendored
9
frontend/node_modules/react-dnd-html5-backend/dist/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/react-dnd-html5-backend/dist/matchesType.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/matchesType.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/matchesType.ts"],"sourcesContent":["//\n// HACK: copied from dnd-core. duplicating here to fix a CI issue\n//\nimport type { Identifier, SourceType, TargetType } from 'dnd-core'\n\nexport function matchesType(\n\ttargetType: TargetType | null,\n\tdraggedItemType: SourceType | 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":"AAKA,OAAO,SAASA,WAAW,CAC1BC,UAA6B,EAC7BC,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"}
|
||||
10
frontend/node_modules/react-dnd-html5-backend/dist/types.d.ts
generated
vendored
10
frontend/node_modules/react-dnd-html5-backend/dist/types.d.ts
generated
vendored
@@ -1,10 +0,0 @@
|
||||
export declare type HTML5BackendContext = Window | undefined;
|
||||
/**
|
||||
* Configuration options for the HTML5Backend
|
||||
*/
|
||||
export interface HTML5BackendOptions {
|
||||
/**
|
||||
* The root DOM node to use for subscribing to events. Default=Window
|
||||
*/
|
||||
rootElement: Node;
|
||||
}
|
||||
3
frontend/node_modules/react-dnd-html5-backend/dist/types.js
generated
vendored
3
frontend/node_modules/react-dnd-html5-backend/dist/types.js
generated
vendored
@@ -1,3 +0,0 @@
|
||||
export { };
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/types.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/types.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["export type HTML5BackendContext = Window | undefined\n\n/**\n * Configuration options for the HTML5Backend\n */\nexport interface HTML5BackendOptions {\n\t/**\n\t * The root DOM node to use for subscribing to events. Default=Window\n\t */\n\trootElement: Node\n}\n"],"names":[],"mappings":"AAAA,WAUC"}
|
||||
6
frontend/node_modules/react-dnd-html5-backend/dist/utils/js_utils.d.ts
generated
vendored
6
frontend/node_modules/react-dnd-html5-backend/dist/utils/js_utils.d.ts
generated
vendored
@@ -1,6 +0,0 @@
|
||||
export declare function memoize<T>(fn: () => T): () => T;
|
||||
/**
|
||||
* drop-in replacement for _.without
|
||||
*/
|
||||
export declare function without<T>(items: T[], item: T): T[];
|
||||
export declare function union<T extends string | number>(itemsA: T[], itemsB: T[]): T[];
|
||||
30
frontend/node_modules/react-dnd-html5-backend/dist/utils/js_utils.js
generated
vendored
30
frontend/node_modules/react-dnd-html5-backend/dist/utils/js_utils.js
generated
vendored
@@ -1,30 +0,0 @@
|
||||
// cheap lodash replacements
|
||||
export function memoize(fn) {
|
||||
let result = null;
|
||||
const memoized = ()=>{
|
||||
if (result == null) {
|
||||
result = fn();
|
||||
}
|
||||
return result;
|
||||
};
|
||||
return memoized;
|
||||
}
|
||||
/**
|
||||
* drop-in replacement for _.without
|
||||
*/ export function without(items, item) {
|
||||
return items.filter((i)=>i !== item
|
||||
);
|
||||
}
|
||||
export function union(itemsA, itemsB) {
|
||||
const set = new Set();
|
||||
const insertItem = (item)=>set.add(item)
|
||||
;
|
||||
itemsA.forEach(insertItem);
|
||||
itemsB.forEach(insertItem);
|
||||
const result = [];
|
||||
set.forEach((key)=>result.push(key)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=js_utils.js.map
|
||||
1
frontend/node_modules/react-dnd-html5-backend/dist/utils/js_utils.js.map
generated
vendored
1
frontend/node_modules/react-dnd-html5-backend/dist/utils/js_utils.js.map
generated
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../src/utils/js_utils.ts"],"sourcesContent":["// cheap lodash replacements\n\nexport function memoize<T>(fn: () => T): () => T {\n\tlet result: T | null = null\n\tconst memoized = () => {\n\t\tif (result == null) {\n\t\t\tresult = fn()\n\t\t}\n\t\treturn result\n\t}\n\treturn memoized\n}\n\n/**\n * drop-in replacement for _.without\n */\nexport function without<T>(items: T[], item: T) {\n\treturn items.filter((i) => i !== item)\n}\n\nexport function union<T extends string | number>(itemsA: T[], itemsB: T[]) {\n\tconst set = new Set<T>()\n\tconst insertItem = (item: T) => set.add(item)\n\titemsA.forEach(insertItem)\n\titemsB.forEach(insertItem)\n\n\tconst result: T[] = []\n\tset.forEach((key) => result.push(key))\n\treturn result\n}\n"],"names":["memoize","fn","result","memoized","without","items","item","filter","i","union","itemsA","itemsB","set","Set","insertItem","add","forEach","key","push"],"mappings":"AAAA,4BAA4B;AAE5B,OAAO,SAASA,OAAO,CAAIC,EAAW,EAAW;IAChD,IAAIC,MAAM,GAAa,IAAI;IAC3B,MAAMC,QAAQ,GAAG,IAAM;QACtB,IAAID,MAAM,IAAI,IAAI,EAAE;YACnBA,MAAM,GAAGD,EAAE,EAAE;SACb;QACD,OAAOC,MAAM,CAAA;KACb;IACD,OAAOC,QAAQ,CAAA;CACf;AAED;;GAEG,CACH,OAAO,SAASC,OAAO,CAAIC,KAAU,EAAEC,IAAO,EAAE;IAC/C,OAAOD,KAAK,CAACE,MAAM,CAAC,CAACC,CAAC,GAAKA,CAAC,KAAKF,IAAI;IAAA,CAAC,CAAA;CACtC;AAED,OAAO,SAASG,KAAK,CAA4BC,MAAW,EAAEC,MAAW,EAAE;IAC1E,MAAMC,GAAG,GAAG,IAAIC,GAAG,EAAK;IACxB,MAAMC,UAAU,GAAG,CAACR,IAAO,GAAKM,GAAG,CAACG,GAAG,CAACT,IAAI,CAAC;IAAA;IAC7CI,MAAM,CAACM,OAAO,CAACF,UAAU,CAAC;IAC1BH,MAAM,CAACK,OAAO,CAACF,UAAU,CAAC;IAE1B,MAAMZ,MAAM,GAAQ,EAAE;IACtBU,GAAG,CAACI,OAAO,CAAC,CAACC,GAAG,GAAKf,MAAM,CAACgB,IAAI,CAACD,GAAG,CAAC;IAAA,CAAC;IACtC,OAAOf,MAAM,CAAA;CACb"}
|
||||
31
frontend/node_modules/react-dnd-html5-backend/package.json
generated
vendored
31
frontend/node_modules/react-dnd-html5-backend/package.json
generated
vendored
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"name": "react-dnd-html5-backend",
|
||||
"version": "16.0.1",
|
||||
"description": "HTML5 backend for React DnD",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"sideEffects": false,
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/react-dnd/react-dnd.git"
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"dependencies": {
|
||||
"dnd-core": "^16.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "^0.1.57",
|
||||
"@swc/core": "^1.2.168",
|
||||
"@types/jest": "^27.4.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"shx": "^0.3.4",
|
||||
"typescript": "^4.6.3"
|
||||
}
|
||||
}
|
||||
13
frontend/node_modules/react-dnd-html5-backend/src/BrowserDetector.ts
generated
vendored
13
frontend/node_modules/react-dnd-html5-backend/src/BrowserDetector.ts
generated
vendored
@@ -1,13 +0,0 @@
|
||||
import { memoize } from './utils/js_utils.js'
|
||||
|
||||
declare global {
|
||||
interface Window extends HTMLElement {
|
||||
safari: any
|
||||
}
|
||||
}
|
||||
|
||||
export type Predicate = () => boolean
|
||||
export const isFirefox: Predicate = memoize(() =>
|
||||
/firefox/i.test(navigator.userAgent),
|
||||
)
|
||||
export const isSafari: Predicate = memoize(() => Boolean(window.safari))
|
||||
39
frontend/node_modules/react-dnd-html5-backend/src/EnterLeaveCounter.ts
generated
vendored
39
frontend/node_modules/react-dnd-html5-backend/src/EnterLeaveCounter.ts
generated
vendored
@@ -1,39 +0,0 @@
|
||||
import { union, without } from './utils/js_utils.js'
|
||||
|
||||
type NodePredicate = (node: Node | null | undefined) => boolean
|
||||
|
||||
export class EnterLeaveCounter {
|
||||
private entered: any[] = []
|
||||
private isNodeInDocument: NodePredicate
|
||||
|
||||
public constructor(isNodeInDocument: NodePredicate) {
|
||||
this.isNodeInDocument = isNodeInDocument
|
||||
}
|
||||
|
||||
public enter(enteringNode: EventTarget | null): boolean {
|
||||
const previousLength = this.entered.length
|
||||
|
||||
const isNodeEntered = (node: Node): boolean =>
|
||||
this.isNodeInDocument(node) &&
|
||||
(!node.contains || node.contains(enteringNode as Node))
|
||||
|
||||
this.entered = union(this.entered.filter(isNodeEntered), [enteringNode])
|
||||
|
||||
return previousLength === 0 && this.entered.length > 0
|
||||
}
|
||||
|
||||
public leave(leavingNode: EventTarget | null): boolean {
|
||||
const previousLength = this.entered.length
|
||||
|
||||
this.entered = without(
|
||||
this.entered.filter(this.isNodeInDocument),
|
||||
leavingNode,
|
||||
)
|
||||
|
||||
return previousLength > 0 && this.entered.length === 0
|
||||
}
|
||||
|
||||
public reset(): void {
|
||||
this.entered = []
|
||||
}
|
||||
}
|
||||
758
frontend/node_modules/react-dnd-html5-backend/src/HTML5BackendImpl.ts
generated
vendored
758
frontend/node_modules/react-dnd-html5-backend/src/HTML5BackendImpl.ts
generated
vendored
@@ -1,758 +0,0 @@
|
||||
import type {
|
||||
Backend,
|
||||
DragDropActions,
|
||||
DragDropManager,
|
||||
DragDropMonitor,
|
||||
HandlerRegistry,
|
||||
Identifier,
|
||||
Unsubscribe,
|
||||
XYCoord,
|
||||
} from 'dnd-core'
|
||||
|
||||
import { EnterLeaveCounter } from './EnterLeaveCounter.js'
|
||||
import {
|
||||
createNativeDragSource,
|
||||
matchNativeItemType,
|
||||
} from './NativeDragSources/index.js'
|
||||
import type { NativeDragSource } from './NativeDragSources/NativeDragSource.js'
|
||||
import * as NativeTypes from './NativeTypes.js'
|
||||
import {
|
||||
getDragPreviewOffset,
|
||||
getEventClientOffset,
|
||||
getNodeClientOffset,
|
||||
} from './OffsetUtils.js'
|
||||
import { OptionsReader } from './OptionsReader.js'
|
||||
import type { HTML5BackendContext, HTML5BackendOptions } from './types.js'
|
||||
|
||||
type RootNode = Node & { __isReactDndBackendSetUp: boolean | undefined }
|
||||
|
||||
export class HTML5BackendImpl implements Backend {
|
||||
private options: OptionsReader
|
||||
|
||||
// React-Dnd Components
|
||||
private actions: DragDropActions
|
||||
private monitor: DragDropMonitor
|
||||
private registry: HandlerRegistry
|
||||
|
||||
// Internal State
|
||||
private enterLeaveCounter: EnterLeaveCounter
|
||||
|
||||
private sourcePreviewNodes: Map<string, Element> = new Map()
|
||||
private sourcePreviewNodeOptions: Map<string, any> = new Map()
|
||||
private sourceNodes: Map<string, Element> = new Map()
|
||||
private sourceNodeOptions: Map<string, any> = new Map()
|
||||
|
||||
private dragStartSourceIds: string[] | null = null
|
||||
private dropTargetIds: string[] = []
|
||||
private dragEnterTargetIds: string[] = []
|
||||
private currentNativeSource: NativeDragSource | null = null
|
||||
private currentNativeHandle: Identifier | null = null
|
||||
private currentDragSourceNode: Element | null = null
|
||||
private altKeyPressed = false
|
||||
private mouseMoveTimeoutTimer: number | null = null
|
||||
private asyncEndDragFrameId: number | null = null
|
||||
private dragOverTargetIds: string[] | null = null
|
||||
|
||||
private lastClientOffset: XYCoord | null = null
|
||||
private hoverRafId: number | null = null
|
||||
|
||||
public constructor(
|
||||
manager: DragDropManager,
|
||||
globalContext?: HTML5BackendContext,
|
||||
options?: HTML5BackendOptions,
|
||||
) {
|
||||
this.options = new OptionsReader(globalContext, options)
|
||||
this.actions = manager.getActions()
|
||||
this.monitor = manager.getMonitor()
|
||||
this.registry = manager.getRegistry()
|
||||
this.enterLeaveCounter = new EnterLeaveCounter(this.isNodeInDocument)
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate profiling statistics for the HTML5Backend.
|
||||
*/
|
||||
public profile(): Record<string, number> {
|
||||
return {
|
||||
sourcePreviewNodes: this.sourcePreviewNodes.size,
|
||||
sourcePreviewNodeOptions: this.sourcePreviewNodeOptions.size,
|
||||
sourceNodeOptions: this.sourceNodeOptions.size,
|
||||
sourceNodes: this.sourceNodes.size,
|
||||
dragStartSourceIds: this.dragStartSourceIds?.length || 0,
|
||||
dropTargetIds: this.dropTargetIds.length,
|
||||
dragEnterTargetIds: this.dragEnterTargetIds.length,
|
||||
dragOverTargetIds: this.dragOverTargetIds?.length || 0,
|
||||
}
|
||||
}
|
||||
|
||||
// public for test
|
||||
public get window(): Window | undefined {
|
||||
return this.options.window
|
||||
}
|
||||
public get document(): Document | undefined {
|
||||
return this.options.document
|
||||
}
|
||||
/**
|
||||
* Get the root element to use for event subscriptions
|
||||
*/
|
||||
private get rootElement(): Node | undefined {
|
||||
return this.options.rootElement as Node
|
||||
}
|
||||
|
||||
public setup(): void {
|
||||
const root = this.rootElement as RootNode | undefined
|
||||
if (root === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
if (root.__isReactDndBackendSetUp) {
|
||||
throw new Error('Cannot have two HTML5 backends at the same time.')
|
||||
}
|
||||
root.__isReactDndBackendSetUp = true
|
||||
this.addEventListeners(root)
|
||||
}
|
||||
|
||||
public teardown(): void {
|
||||
const root = this.rootElement as RootNode
|
||||
if (root === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
root.__isReactDndBackendSetUp = false
|
||||
this.removeEventListeners(this.rootElement as Element)
|
||||
this.clearCurrentDragSourceNode()
|
||||
if (this.asyncEndDragFrameId) {
|
||||
this.window?.cancelAnimationFrame(this.asyncEndDragFrameId)
|
||||
}
|
||||
}
|
||||
|
||||
public connectDragPreview(
|
||||
sourceId: string,
|
||||
node: Element,
|
||||
options: any,
|
||||
): Unsubscribe {
|
||||
this.sourcePreviewNodeOptions.set(sourceId, options)
|
||||
this.sourcePreviewNodes.set(sourceId, node)
|
||||
|
||||
return (): void => {
|
||||
this.sourcePreviewNodes.delete(sourceId)
|
||||
this.sourcePreviewNodeOptions.delete(sourceId)
|
||||
}
|
||||
}
|
||||
|
||||
public connectDragSource(
|
||||
sourceId: string,
|
||||
node: Element,
|
||||
options: any,
|
||||
): Unsubscribe {
|
||||
this.sourceNodes.set(sourceId, node)
|
||||
this.sourceNodeOptions.set(sourceId, options)
|
||||
|
||||
const handleDragStart = (e: any) => this.handleDragStart(e, sourceId)
|
||||
const handleSelectStart = (e: any) => this.handleSelectStart(e)
|
||||
|
||||
node.setAttribute('draggable', 'true')
|
||||
node.addEventListener('dragstart', handleDragStart)
|
||||
node.addEventListener('selectstart', handleSelectStart)
|
||||
|
||||
return (): void => {
|
||||
this.sourceNodes.delete(sourceId)
|
||||
this.sourceNodeOptions.delete(sourceId)
|
||||
|
||||
node.removeEventListener('dragstart', handleDragStart)
|
||||
node.removeEventListener('selectstart', handleSelectStart)
|
||||
node.setAttribute('draggable', 'false')
|
||||
}
|
||||
}
|
||||
|
||||
public connectDropTarget(targetId: string, node: HTMLElement): Unsubscribe {
|
||||
const handleDragEnter = (e: DragEvent) => this.handleDragEnter(e, targetId)
|
||||
const handleDragOver = (e: DragEvent) => this.handleDragOver(e, targetId)
|
||||
const handleDrop = (e: DragEvent) => this.handleDrop(e, targetId)
|
||||
|
||||
node.addEventListener('dragenter', handleDragEnter)
|
||||
node.addEventListener('dragover', handleDragOver)
|
||||
node.addEventListener('drop', handleDrop)
|
||||
|
||||
return (): void => {
|
||||
node.removeEventListener('dragenter', handleDragEnter)
|
||||
node.removeEventListener('dragover', handleDragOver)
|
||||
node.removeEventListener('drop', handleDrop)
|
||||
}
|
||||
}
|
||||
|
||||
private addEventListeners(target: Node) {
|
||||
// SSR Fix (https://github.com/react-dnd/react-dnd/pull/813
|
||||
if (!target.addEventListener) {
|
||||
return
|
||||
}
|
||||
target.addEventListener(
|
||||
'dragstart',
|
||||
this.handleTopDragStart as EventListener,
|
||||
)
|
||||
target.addEventListener('dragstart', this.handleTopDragStartCapture, true)
|
||||
target.addEventListener('dragend', this.handleTopDragEndCapture, true)
|
||||
target.addEventListener(
|
||||
'dragenter',
|
||||
this.handleTopDragEnter as EventListener,
|
||||
)
|
||||
target.addEventListener(
|
||||
'dragenter',
|
||||
this.handleTopDragEnterCapture as EventListener,
|
||||
true,
|
||||
)
|
||||
target.addEventListener(
|
||||
'dragleave',
|
||||
this.handleTopDragLeaveCapture as EventListener,
|
||||
true,
|
||||
)
|
||||
target.addEventListener('dragover', this.handleTopDragOver as EventListener)
|
||||
target.addEventListener(
|
||||
'dragover',
|
||||
this.handleTopDragOverCapture as EventListener,
|
||||
true,
|
||||
)
|
||||
target.addEventListener('drop', this.handleTopDrop as EventListener)
|
||||
target.addEventListener(
|
||||
'drop',
|
||||
this.handleTopDropCapture as EventListener,
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
private removeEventListeners(target: Node) {
|
||||
// SSR Fix (https://github.com/react-dnd/react-dnd/pull/813
|
||||
if (!target.removeEventListener) {
|
||||
return
|
||||
}
|
||||
target.removeEventListener('dragstart', this.handleTopDragStart as any)
|
||||
target.removeEventListener(
|
||||
'dragstart',
|
||||
this.handleTopDragStartCapture,
|
||||
true,
|
||||
)
|
||||
target.removeEventListener('dragend', this.handleTopDragEndCapture, true)
|
||||
target.removeEventListener(
|
||||
'dragenter',
|
||||
this.handleTopDragEnter as EventListener,
|
||||
)
|
||||
target.removeEventListener(
|
||||
'dragenter',
|
||||
this.handleTopDragEnterCapture as EventListener,
|
||||
true,
|
||||
)
|
||||
target.removeEventListener(
|
||||
'dragleave',
|
||||
this.handleTopDragLeaveCapture as EventListener,
|
||||
true,
|
||||
)
|
||||
target.removeEventListener(
|
||||
'dragover',
|
||||
this.handleTopDragOver as EventListener,
|
||||
)
|
||||
target.removeEventListener(
|
||||
'dragover',
|
||||
this.handleTopDragOverCapture as EventListener,
|
||||
true,
|
||||
)
|
||||
target.removeEventListener('drop', this.handleTopDrop as EventListener)
|
||||
target.removeEventListener(
|
||||
'drop',
|
||||
this.handleTopDropCapture as EventListener,
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
private getCurrentSourceNodeOptions() {
|
||||
const sourceId = this.monitor.getSourceId() as string
|
||||
const sourceNodeOptions = this.sourceNodeOptions.get(sourceId)
|
||||
|
||||
return {
|
||||
dropEffect: this.altKeyPressed ? 'copy' : 'move',
|
||||
...(sourceNodeOptions || {}),
|
||||
}
|
||||
}
|
||||
|
||||
private getCurrentDropEffect() {
|
||||
if (this.isDraggingNativeItem()) {
|
||||
// It makes more sense to default to 'copy' for native resources
|
||||
return 'copy'
|
||||
}
|
||||
|
||||
return this.getCurrentSourceNodeOptions().dropEffect
|
||||
}
|
||||
|
||||
private getCurrentSourcePreviewNodeOptions() {
|
||||
const sourceId = this.monitor.getSourceId() as string
|
||||
const sourcePreviewNodeOptions = this.sourcePreviewNodeOptions.get(sourceId)
|
||||
|
||||
return {
|
||||
anchorX: 0.5,
|
||||
anchorY: 0.5,
|
||||
captureDraggingState: false,
|
||||
...(sourcePreviewNodeOptions || {}),
|
||||
}
|
||||
}
|
||||
|
||||
private getSourceClientOffset = (sourceId: string): XYCoord | null => {
|
||||
const source = this.sourceNodes.get(sourceId)
|
||||
return (source && getNodeClientOffset(source as HTMLElement)) || null
|
||||
}
|
||||
|
||||
private isDraggingNativeItem() {
|
||||
const itemType = this.monitor.getItemType()
|
||||
return Object.keys(NativeTypes).some(
|
||||
(key: string) => (NativeTypes as any)[key] === itemType,
|
||||
)
|
||||
}
|
||||
|
||||
private beginDragNativeItem(type: string, dataTransfer?: DataTransfer) {
|
||||
this.clearCurrentDragSourceNode()
|
||||
|
||||
this.currentNativeSource = createNativeDragSource(type, dataTransfer)
|
||||
this.currentNativeHandle = this.registry.addSource(
|
||||
type,
|
||||
this.currentNativeSource,
|
||||
)
|
||||
this.actions.beginDrag([this.currentNativeHandle])
|
||||
}
|
||||
|
||||
private endDragNativeItem = (): void => {
|
||||
if (!this.isDraggingNativeItem()) {
|
||||
return
|
||||
}
|
||||
|
||||
this.actions.endDrag()
|
||||
if (this.currentNativeHandle) {
|
||||
this.registry.removeSource(this.currentNativeHandle)
|
||||
}
|
||||
this.currentNativeHandle = null
|
||||
this.currentNativeSource = null
|
||||
}
|
||||
|
||||
private isNodeInDocument = (node: Node | null | undefined): boolean => {
|
||||
// Check the node either in the main document or in the current context
|
||||
return Boolean(
|
||||
node &&
|
||||
this.document &&
|
||||
this.document.body &&
|
||||
this.document.body.contains(node),
|
||||
)
|
||||
}
|
||||
|
||||
private endDragIfSourceWasRemovedFromDOM = (): void => {
|
||||
const node = this.currentDragSourceNode
|
||||
if (node == null || this.isNodeInDocument(node)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.clearCurrentDragSourceNode() && this.monitor.isDragging()) {
|
||||
this.actions.endDrag()
|
||||
}
|
||||
this.cancelHover()
|
||||
}
|
||||
|
||||
private setCurrentDragSourceNode(node: Element | null) {
|
||||
this.clearCurrentDragSourceNode()
|
||||
this.currentDragSourceNode = node
|
||||
|
||||
// A timeout of > 0 is necessary to resolve Firefox issue referenced
|
||||
// See:
|
||||
// * https://github.com/react-dnd/react-dnd/pull/928
|
||||
// * https://github.com/react-dnd/react-dnd/issues/869
|
||||
const MOUSE_MOVE_TIMEOUT = 1000
|
||||
|
||||
// Receiving a mouse event in the middle of a dragging operation
|
||||
// means it has ended and the drag source node disappeared from DOM,
|
||||
// so the browser didn't dispatch the dragend event.
|
||||
//
|
||||
// We need to wait before we start listening for mousemove events.
|
||||
// This is needed because the drag preview needs to be drawn or else it fires an 'mousemove' event
|
||||
// immediately in some browsers.
|
||||
//
|
||||
// See:
|
||||
// * https://github.com/react-dnd/react-dnd/pull/928
|
||||
// * https://github.com/react-dnd/react-dnd/issues/869
|
||||
//
|
||||
this.mouseMoveTimeoutTimer = setTimeout(() => {
|
||||
return this.rootElement?.addEventListener(
|
||||
'mousemove',
|
||||
this.endDragIfSourceWasRemovedFromDOM,
|
||||
true,
|
||||
)
|
||||
}, MOUSE_MOVE_TIMEOUT) as any as number
|
||||
}
|
||||
|
||||
private clearCurrentDragSourceNode() {
|
||||
if (this.currentDragSourceNode) {
|
||||
this.currentDragSourceNode = null
|
||||
|
||||
if (this.rootElement) {
|
||||
this.window?.clearTimeout(this.mouseMoveTimeoutTimer || undefined)
|
||||
this.rootElement.removeEventListener(
|
||||
'mousemove',
|
||||
this.endDragIfSourceWasRemovedFromDOM,
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
this.mouseMoveTimeoutTimer = null
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private scheduleHover = (dragOverTargetIds: string[] | null) => {
|
||||
if (
|
||||
this.hoverRafId === null &&
|
||||
typeof requestAnimationFrame !== 'undefined'
|
||||
) {
|
||||
this.hoverRafId = requestAnimationFrame(() => {
|
||||
if (this.monitor.isDragging()) {
|
||||
this.actions.hover(dragOverTargetIds || [], {
|
||||
clientOffset: this.lastClientOffset,
|
||||
})
|
||||
}
|
||||
|
||||
this.hoverRafId = null
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private cancelHover = () => {
|
||||
if (
|
||||
this.hoverRafId !== null &&
|
||||
typeof cancelAnimationFrame !== 'undefined'
|
||||
) {
|
||||
cancelAnimationFrame(this.hoverRafId)
|
||||
this.hoverRafId = null
|
||||
}
|
||||
}
|
||||
|
||||
public handleTopDragStartCapture = (): void => {
|
||||
this.clearCurrentDragSourceNode()
|
||||
this.dragStartSourceIds = []
|
||||
}
|
||||
|
||||
public handleDragStart(e: DragEvent, sourceId: string): void {
|
||||
if (e.defaultPrevented) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.dragStartSourceIds) {
|
||||
this.dragStartSourceIds = []
|
||||
}
|
||||
this.dragStartSourceIds.unshift(sourceId)
|
||||
}
|
||||
|
||||
public handleTopDragStart = (e: DragEvent): void => {
|
||||
if (e.defaultPrevented) {
|
||||
return
|
||||
}
|
||||
|
||||
const { dragStartSourceIds } = this
|
||||
this.dragStartSourceIds = null
|
||||
|
||||
const clientOffset = getEventClientOffset(e)
|
||||
|
||||
// Avoid crashing if we missed a drop event or our previous drag died
|
||||
if (this.monitor.isDragging()) {
|
||||
this.actions.endDrag()
|
||||
this.cancelHover()
|
||||
}
|
||||
|
||||
// Don't publish the source just yet (see why below)
|
||||
this.actions.beginDrag(dragStartSourceIds || [], {
|
||||
publishSource: false,
|
||||
getSourceClientOffset: this.getSourceClientOffset,
|
||||
clientOffset,
|
||||
})
|
||||
|
||||
const { dataTransfer } = e
|
||||
const nativeType = matchNativeItemType(dataTransfer)
|
||||
|
||||
if (this.monitor.isDragging()) {
|
||||
if (dataTransfer && typeof dataTransfer.setDragImage === 'function') {
|
||||
// Use custom drag image if user specifies it.
|
||||
// If child drag source refuses drag but parent agrees,
|
||||
// use parent's node as drag image. Neither works in IE though.
|
||||
const sourceId: string = this.monitor.getSourceId() as string
|
||||
const sourceNode = this.sourceNodes.get(sourceId)
|
||||
const dragPreview = this.sourcePreviewNodes.get(sourceId) || sourceNode
|
||||
|
||||
if (dragPreview) {
|
||||
const { anchorX, anchorY, offsetX, offsetY } =
|
||||
this.getCurrentSourcePreviewNodeOptions()
|
||||
const anchorPoint = { anchorX, anchorY }
|
||||
const offsetPoint = { offsetX, offsetY }
|
||||
const dragPreviewOffset = getDragPreviewOffset(
|
||||
sourceNode as HTMLElement,
|
||||
dragPreview as HTMLElement,
|
||||
clientOffset,
|
||||
anchorPoint,
|
||||
offsetPoint,
|
||||
)
|
||||
|
||||
dataTransfer.setDragImage(
|
||||
dragPreview,
|
||||
dragPreviewOffset.x,
|
||||
dragPreviewOffset.y,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// Firefox won't drag without setting data
|
||||
dataTransfer?.setData('application/json', {} as any)
|
||||
} catch (err) {
|
||||
// IE doesn't support MIME types in setData
|
||||
}
|
||||
|
||||
// Store drag source node so we can check whether
|
||||
// it is removed from DOM and trigger endDrag manually.
|
||||
this.setCurrentDragSourceNode(e.target as Element)
|
||||
|
||||
// Now we are ready to publish the drag source.. or are we not?
|
||||
const { captureDraggingState } = this.getCurrentSourcePreviewNodeOptions()
|
||||
if (!captureDraggingState) {
|
||||
// Usually we want to publish it in the next tick so that browser
|
||||
// is able to screenshot the current (not yet dragging) state.
|
||||
//
|
||||
// It also neatly avoids a situation where render() returns null
|
||||
// in the same tick for the source element, and browser freaks out.
|
||||
setTimeout(() => this.actions.publishDragSource(), 0)
|
||||
} else {
|
||||
// In some cases the user may want to override this behavior, e.g.
|
||||
// to work around IE not supporting custom drag previews.
|
||||
//
|
||||
// When using a custom drag layer, the only way to prevent
|
||||
// the default drag preview from drawing in IE is to screenshot
|
||||
// the dragging state in which the node itself has zero opacity
|
||||
// and height. In this case, though, returning null from render()
|
||||
// will abruptly end the dragging, which is not obvious.
|
||||
//
|
||||
// This is the reason such behavior is strictly opt-in.
|
||||
this.actions.publishDragSource()
|
||||
}
|
||||
} else if (nativeType) {
|
||||
// A native item (such as URL) dragged from inside the document
|
||||
this.beginDragNativeItem(nativeType)
|
||||
} else if (
|
||||
dataTransfer &&
|
||||
!dataTransfer.types &&
|
||||
((e.target && !(e.target as Element).hasAttribute) ||
|
||||
!(e.target as Element).hasAttribute('draggable'))
|
||||
) {
|
||||
// Looks like a Safari bug: dataTransfer.types is null, but there was no draggable.
|
||||
// Just let it drag. It's a native type (URL or text) and will be picked up in
|
||||
// dragenter handler.
|
||||
return
|
||||
} else {
|
||||
// If by this time no drag source reacted, tell browser not to drag.
|
||||
e.preventDefault()
|
||||
}
|
||||
}
|
||||
|
||||
public handleTopDragEndCapture = (): void => {
|
||||
if (this.clearCurrentDragSourceNode() && this.monitor.isDragging()) {
|
||||
// Firefox can dispatch this event in an infinite loop
|
||||
// if dragend handler does something like showing an alert.
|
||||
// Only proceed if we have not handled it already.
|
||||
this.actions.endDrag()
|
||||
}
|
||||
this.cancelHover()
|
||||
}
|
||||
|
||||
public handleTopDragEnterCapture = (e: DragEvent): void => {
|
||||
this.dragEnterTargetIds = []
|
||||
|
||||
if (this.isDraggingNativeItem()) {
|
||||
this.currentNativeSource?.loadDataTransfer(e.dataTransfer)
|
||||
}
|
||||
|
||||
const isFirstEnter = this.enterLeaveCounter.enter(e.target)
|
||||
if (!isFirstEnter || this.monitor.isDragging()) {
|
||||
return
|
||||
}
|
||||
|
||||
const { dataTransfer } = e
|
||||
const nativeType = matchNativeItemType(dataTransfer)
|
||||
|
||||
if (nativeType) {
|
||||
// A native item (such as file or URL) dragged from outside the document
|
||||
this.beginDragNativeItem(nativeType, dataTransfer as DataTransfer)
|
||||
}
|
||||
}
|
||||
|
||||
public handleDragEnter(_e: DragEvent, targetId: string): void {
|
||||
this.dragEnterTargetIds.unshift(targetId)
|
||||
}
|
||||
|
||||
public handleTopDragEnter = (e: DragEvent): void => {
|
||||
const { dragEnterTargetIds } = this
|
||||
this.dragEnterTargetIds = []
|
||||
|
||||
if (!this.monitor.isDragging()) {
|
||||
// This is probably a native item type we don't understand.
|
||||
return
|
||||
}
|
||||
|
||||
this.altKeyPressed = e.altKey
|
||||
|
||||
// If the target changes position as the result of `dragenter`, `dragover` might still
|
||||
// get dispatched despite target being no longer there. The easy solution is to check
|
||||
// whether there actually is a target before firing `hover`.
|
||||
if (dragEnterTargetIds.length > 0) {
|
||||
this.actions.hover(dragEnterTargetIds, {
|
||||
clientOffset: getEventClientOffset(e),
|
||||
})
|
||||
}
|
||||
|
||||
const canDrop = dragEnterTargetIds.some((targetId) =>
|
||||
this.monitor.canDropOnTarget(targetId),
|
||||
)
|
||||
|
||||
if (canDrop) {
|
||||
// IE requires this to fire dragover events
|
||||
e.preventDefault()
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.dropEffect = this.getCurrentDropEffect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public handleTopDragOverCapture = (e: DragEvent): void => {
|
||||
this.dragOverTargetIds = []
|
||||
|
||||
if (this.isDraggingNativeItem()) {
|
||||
this.currentNativeSource?.loadDataTransfer(e.dataTransfer)
|
||||
}
|
||||
}
|
||||
|
||||
public handleDragOver(_e: DragEvent, targetId: string): void {
|
||||
if (this.dragOverTargetIds === null) {
|
||||
this.dragOverTargetIds = []
|
||||
}
|
||||
this.dragOverTargetIds.unshift(targetId)
|
||||
}
|
||||
|
||||
public handleTopDragOver = (e: DragEvent): void => {
|
||||
const { dragOverTargetIds } = this
|
||||
this.dragOverTargetIds = []
|
||||
|
||||
if (!this.monitor.isDragging()) {
|
||||
// This is probably a native item type we don't understand.
|
||||
// Prevent default "drop and blow away the whole document" action.
|
||||
e.preventDefault()
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.dropEffect = 'none'
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
this.altKeyPressed = e.altKey
|
||||
this.lastClientOffset = getEventClientOffset(e)
|
||||
|
||||
this.scheduleHover(dragOverTargetIds)
|
||||
|
||||
const canDrop = (dragOverTargetIds || []).some((targetId) =>
|
||||
this.monitor.canDropOnTarget(targetId),
|
||||
)
|
||||
|
||||
if (canDrop) {
|
||||
// Show user-specified drop effect.
|
||||
e.preventDefault()
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.dropEffect = this.getCurrentDropEffect()
|
||||
}
|
||||
} else if (this.isDraggingNativeItem()) {
|
||||
// Don't show a nice cursor but still prevent default
|
||||
// "drop and blow away the whole document" action.
|
||||
e.preventDefault()
|
||||
} else {
|
||||
e.preventDefault()
|
||||
if (e.dataTransfer) {
|
||||
e.dataTransfer.dropEffect = 'none'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public handleTopDragLeaveCapture = (e: DragEvent): void => {
|
||||
if (this.isDraggingNativeItem()) {
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
const isLastLeave = this.enterLeaveCounter.leave(e.target)
|
||||
if (!isLastLeave) {
|
||||
return
|
||||
}
|
||||
|
||||
if (this.isDraggingNativeItem()) {
|
||||
setTimeout(() => this.endDragNativeItem(), 0)
|
||||
}
|
||||
this.cancelHover()
|
||||
}
|
||||
|
||||
public handleTopDropCapture = (e: DragEvent): void => {
|
||||
this.dropTargetIds = []
|
||||
|
||||
if (this.isDraggingNativeItem()) {
|
||||
e.preventDefault()
|
||||
this.currentNativeSource?.loadDataTransfer(e.dataTransfer)
|
||||
} else if (matchNativeItemType(e.dataTransfer)) {
|
||||
// Dragging some elements, like <a> and <img> may still behave like a native drag event,
|
||||
// even if the current drag event matches a user-defined type.
|
||||
// Stop the default behavior when we're not expecting a native item to be dropped.
|
||||
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
this.enterLeaveCounter.reset()
|
||||
}
|
||||
|
||||
public handleDrop(_e: DragEvent, targetId: string): void {
|
||||
this.dropTargetIds.unshift(targetId)
|
||||
}
|
||||
|
||||
public handleTopDrop = (e: DragEvent): void => {
|
||||
const { dropTargetIds } = this
|
||||
this.dropTargetIds = []
|
||||
|
||||
this.actions.hover(dropTargetIds, {
|
||||
clientOffset: getEventClientOffset(e),
|
||||
})
|
||||
this.actions.drop({ dropEffect: this.getCurrentDropEffect() })
|
||||
|
||||
if (this.isDraggingNativeItem()) {
|
||||
this.endDragNativeItem()
|
||||
} else if (this.monitor.isDragging()) {
|
||||
this.actions.endDrag()
|
||||
}
|
||||
this.cancelHover()
|
||||
}
|
||||
|
||||
public handleSelectStart = (e: DragEvent): void => {
|
||||
const target = e.target as HTMLElement & { dragDrop: () => void }
|
||||
|
||||
// Only IE requires us to explicitly say
|
||||
// we want drag drop operation to start
|
||||
if (typeof target.dragDrop !== 'function') {
|
||||
return
|
||||
}
|
||||
|
||||
// Inputs and textareas should be selectable
|
||||
if (
|
||||
target.tagName === 'INPUT' ||
|
||||
target.tagName === 'SELECT' ||
|
||||
target.tagName === 'TEXTAREA' ||
|
||||
target.isContentEditable
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
// For other targets, ask IE
|
||||
// to enable drag and drop
|
||||
e.preventDefault()
|
||||
target.dragDrop()
|
||||
}
|
||||
}
|
||||
101
frontend/node_modules/react-dnd-html5-backend/src/MonotonicInterpolant.ts
generated
vendored
101
frontend/node_modules/react-dnd-html5-backend/src/MonotonicInterpolant.ts
generated
vendored
@@ -1,101 +0,0 @@
|
||||
export class MonotonicInterpolant {
|
||||
private xs: any
|
||||
private ys: any
|
||||
private c1s: any
|
||||
private c2s: any
|
||||
private c3s: any
|
||||
|
||||
public constructor(xs: number[], ys: number[]) {
|
||||
const { length } = xs
|
||||
|
||||
// Rearrange xs and ys so that xs is sorted
|
||||
const indexes = []
|
||||
for (let i = 0; i < length; i++) {
|
||||
indexes.push(i)
|
||||
}
|
||||
indexes.sort((a, b) => ((xs[a] as number) < (xs[b] as number) ? -1 : 1))
|
||||
|
||||
// Get consecutive differences and slopes
|
||||
const dys = []
|
||||
const dxs = []
|
||||
const ms = []
|
||||
let dx
|
||||
let dy
|
||||
for (let i = 0; i < length - 1; i++) {
|
||||
dx = (xs[i + 1] as number) - (xs[i] as number)
|
||||
dy = (ys[i + 1] as number) - (ys[i] as number)
|
||||
dxs.push(dx)
|
||||
dys.push(dy)
|
||||
ms.push(dy / dx)
|
||||
}
|
||||
|
||||
// Get degree-1 coefficients
|
||||
const c1s = [ms[0]]
|
||||
for (let i = 0; i < dxs.length - 1; i++) {
|
||||
const m2 = ms[i] as number
|
||||
const mNext = ms[i + 1] as number
|
||||
if (m2 * mNext <= 0) {
|
||||
c1s.push(0)
|
||||
} else {
|
||||
dx = dxs[i] as number
|
||||
const dxNext = dxs[i + 1] as number
|
||||
const common = dx + dxNext
|
||||
c1s.push(
|
||||
(3 * common) / ((common + dxNext) / m2 + (common + dx) / mNext),
|
||||
)
|
||||
}
|
||||
}
|
||||
c1s.push(ms[ms.length - 1])
|
||||
|
||||
// Get degree-2 and degree-3 coefficients
|
||||
const c2s = []
|
||||
const c3s = []
|
||||
let m
|
||||
for (let i = 0; i < c1s.length - 1; i++) {
|
||||
m = ms[i] as number
|
||||
const c1 = c1s[i] as number
|
||||
const invDx = 1 / (dxs[i] as number)
|
||||
const common = c1 + (c1s[i + 1] as number) - m - m
|
||||
c2s.push((m - c1 - common) * invDx)
|
||||
c3s.push(common * invDx * invDx)
|
||||
}
|
||||
|
||||
this.xs = xs
|
||||
this.ys = ys
|
||||
this.c1s = c1s
|
||||
this.c2s = c2s
|
||||
this.c3s = c3s
|
||||
}
|
||||
|
||||
public interpolate(x: number): number {
|
||||
const { xs, ys, c1s, c2s, c3s } = this
|
||||
|
||||
// The rightmost point in the dataset should give an exact result
|
||||
let i = xs.length - 1
|
||||
if (x === xs[i]) {
|
||||
return ys[i]
|
||||
}
|
||||
|
||||
// Search for the interval x is in, returning the corresponding y if x is one of the original xs
|
||||
let low = 0
|
||||
let high = c3s.length - 1
|
||||
let mid
|
||||
while (low <= high) {
|
||||
mid = Math.floor(0.5 * (low + high))
|
||||
const xHere = xs[mid]
|
||||
if (xHere < x) {
|
||||
low = mid + 1
|
||||
} else if (xHere > x) {
|
||||
high = mid - 1
|
||||
} else {
|
||||
return ys[mid]
|
||||
}
|
||||
}
|
||||
i = Math.max(0, high)
|
||||
|
||||
// Interpolate
|
||||
const diff = x - xs[i]
|
||||
const diffSq = diff * diff
|
||||
return ys[i] + c1s[i] * diff + c2s[i] * diffSq + c3s[i] * diff * diffSq
|
||||
}
|
||||
}
|
||||
63
frontend/node_modules/react-dnd-html5-backend/src/NativeDragSources/NativeDragSource.ts
generated
vendored
63
frontend/node_modules/react-dnd-html5-backend/src/NativeDragSources/NativeDragSource.ts
generated
vendored
@@ -1,63 +0,0 @@
|
||||
import type { DragDropMonitor } from 'dnd-core'
|
||||
|
||||
import type { NativeItemConfig } from './nativeTypesConfig.js'
|
||||
|
||||
export class NativeDragSource {
|
||||
public item: any
|
||||
private config: NativeItemConfig
|
||||
|
||||
public constructor(config: NativeItemConfig) {
|
||||
this.config = config
|
||||
this.item = {}
|
||||
this.initializeExposedProperties()
|
||||
}
|
||||
|
||||
private initializeExposedProperties() {
|
||||
Object.keys(this.config.exposeProperties).forEach((property) => {
|
||||
Object.defineProperty(this.item, property, {
|
||||
configurable: true, // This is needed to allow redefining it later
|
||||
enumerable: true,
|
||||
get() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(
|
||||
`Browser doesn't allow reading "${property}" until the drop event.`,
|
||||
)
|
||||
return null
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
public loadDataTransfer(dataTransfer: DataTransfer | null | undefined): void {
|
||||
if (dataTransfer) {
|
||||
const newProperties: PropertyDescriptorMap = {}
|
||||
Object.keys(this.config.exposeProperties).forEach((property) => {
|
||||
const propertyFn = this.config.exposeProperties[property]
|
||||
if (propertyFn != null) {
|
||||
newProperties[property] = {
|
||||
value: propertyFn(dataTransfer, this.config.matchesTypes),
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
}
|
||||
}
|
||||
})
|
||||
Object.defineProperties(this.item, newProperties)
|
||||
}
|
||||
}
|
||||
|
||||
public canDrag(): boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
public beginDrag(): any {
|
||||
return this.item
|
||||
}
|
||||
|
||||
public isDragging(monitor: DragDropMonitor, handle: string): boolean {
|
||||
return handle === monitor.getSourceId()
|
||||
}
|
||||
|
||||
public endDrag(): void {
|
||||
// empty
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
export function getDataFromDataTransfer(
|
||||
dataTransfer: DataTransfer,
|
||||
typesToTry: string[],
|
||||
defaultValue: string,
|
||||
): string {
|
||||
const result = typesToTry.reduce(
|
||||
(resultSoFar, typeToTry) => resultSoFar || dataTransfer.getData(typeToTry),
|
||||
'',
|
||||
)
|
||||
|
||||
return result != null ? result : defaultValue
|
||||
}
|
||||
36
frontend/node_modules/react-dnd-html5-backend/src/NativeDragSources/index.ts
generated
vendored
36
frontend/node_modules/react-dnd-html5-backend/src/NativeDragSources/index.ts
generated
vendored
@@ -1,36 +0,0 @@
|
||||
import { NativeDragSource } from './NativeDragSource.js'
|
||||
import { nativeTypesConfig } from './nativeTypesConfig.js'
|
||||
|
||||
export function createNativeDragSource(
|
||||
type: string,
|
||||
dataTransfer?: DataTransfer,
|
||||
): NativeDragSource {
|
||||
const config = nativeTypesConfig[type]
|
||||
if (!config) {
|
||||
throw new Error(`native type ${type} has no configuration`)
|
||||
}
|
||||
const result = new NativeDragSource(config)
|
||||
result.loadDataTransfer(dataTransfer)
|
||||
return result
|
||||
}
|
||||
|
||||
export function matchNativeItemType(
|
||||
dataTransfer: DataTransfer | null,
|
||||
): string | null {
|
||||
if (!dataTransfer) {
|
||||
return null
|
||||
}
|
||||
|
||||
const dataTransferTypes = Array.prototype.slice.call(dataTransfer.types || [])
|
||||
return (
|
||||
Object.keys(nativeTypesConfig).filter((nativeItemType) => {
|
||||
const typeConfig = nativeTypesConfig[nativeItemType]
|
||||
if (!typeConfig?.matchesTypes) {
|
||||
return false
|
||||
}
|
||||
return typeConfig.matchesTypes.some(
|
||||
(t) => dataTransferTypes.indexOf(t) > -1,
|
||||
)
|
||||
})[0] || null
|
||||
)
|
||||
}
|
||||
53
frontend/node_modules/react-dnd-html5-backend/src/NativeDragSources/nativeTypesConfig.ts
generated
vendored
53
frontend/node_modules/react-dnd-html5-backend/src/NativeDragSources/nativeTypesConfig.ts
generated
vendored
@@ -1,53 +0,0 @@
|
||||
import * as NativeTypes from '../NativeTypes.js'
|
||||
import { getDataFromDataTransfer } from './getDataFromDataTransfer.js'
|
||||
|
||||
export interface NativeItemConfigExposePropreties {
|
||||
[property: string]: (
|
||||
dataTransfer: DataTransfer,
|
||||
matchesTypes: string[],
|
||||
) => any
|
||||
}
|
||||
|
||||
export interface NativeItemConfig {
|
||||
exposeProperties: NativeItemConfigExposePropreties
|
||||
matchesTypes: string[]
|
||||
}
|
||||
|
||||
export const nativeTypesConfig: {
|
||||
[key: string]: NativeItemConfig
|
||||
} = {
|
||||
[NativeTypes.FILE]: {
|
||||
exposeProperties: {
|
||||
files: (dataTransfer: DataTransfer): File[] =>
|
||||
Array.prototype.slice.call(dataTransfer.files),
|
||||
items: (dataTransfer: DataTransfer): DataTransferItemList =>
|
||||
dataTransfer.items,
|
||||
dataTransfer: (dataTransfer: DataTransfer): DataTransfer => dataTransfer,
|
||||
},
|
||||
matchesTypes: ['Files'],
|
||||
},
|
||||
[NativeTypes.HTML]: {
|
||||
exposeProperties: {
|
||||
html: (dataTransfer: DataTransfer, matchesTypes: string[]): string =>
|
||||
getDataFromDataTransfer(dataTransfer, matchesTypes, ''),
|
||||
dataTransfer: (dataTransfer: DataTransfer): DataTransfer => dataTransfer,
|
||||
},
|
||||
matchesTypes: ['Html', 'text/html'],
|
||||
},
|
||||
[NativeTypes.URL]: {
|
||||
exposeProperties: {
|
||||
urls: (dataTransfer: DataTransfer, matchesTypes: string[]): string[] =>
|
||||
getDataFromDataTransfer(dataTransfer, matchesTypes, '').split('\n'),
|
||||
dataTransfer: (dataTransfer: DataTransfer): DataTransfer => dataTransfer,
|
||||
},
|
||||
matchesTypes: ['Url', 'text/uri-list'],
|
||||
},
|
||||
[NativeTypes.TEXT]: {
|
||||
exposeProperties: {
|
||||
text: (dataTransfer: DataTransfer, matchesTypes: string[]): string =>
|
||||
getDataFromDataTransfer(dataTransfer, matchesTypes, ''),
|
||||
dataTransfer: (dataTransfer: DataTransfer): DataTransfer => dataTransfer,
|
||||
},
|
||||
matchesTypes: ['Text', 'text/plain'],
|
||||
},
|
||||
}
|
||||
4
frontend/node_modules/react-dnd-html5-backend/src/NativeTypes.ts
generated
vendored
4
frontend/node_modules/react-dnd-html5-backend/src/NativeTypes.ts
generated
vendored
@@ -1,4 +0,0 @@
|
||||
export const FILE = '__NATIVE_FILE__'
|
||||
export const URL = '__NATIVE_URL__'
|
||||
export const TEXT = '__NATIVE_TEXT__'
|
||||
export const HTML = '__NATIVE_HTML__'
|
||||
123
frontend/node_modules/react-dnd-html5-backend/src/OffsetUtils.ts
generated
vendored
123
frontend/node_modules/react-dnd-html5-backend/src/OffsetUtils.ts
generated
vendored
@@ -1,123 +0,0 @@
|
||||
import type { XYCoord } from 'dnd-core'
|
||||
|
||||
import { isFirefox, isSafari } from './BrowserDetector.js'
|
||||
import { MonotonicInterpolant } from './MonotonicInterpolant.js'
|
||||
|
||||
const ELEMENT_NODE = 1
|
||||
|
||||
export function getNodeClientOffset(node: Node): XYCoord | null {
|
||||
const el = node.nodeType === ELEMENT_NODE ? node : node.parentElement
|
||||
|
||||
if (!el) {
|
||||
return null
|
||||
}
|
||||
|
||||
const { top, left } = (el as HTMLElement).getBoundingClientRect()
|
||||
return { x: left, y: top }
|
||||
}
|
||||
|
||||
export function getEventClientOffset(e: MouseEvent): XYCoord {
|
||||
return {
|
||||
x: e.clientX,
|
||||
y: e.clientY,
|
||||
}
|
||||
}
|
||||
|
||||
function isImageNode(node: any) {
|
||||
return (
|
||||
node.nodeName === 'IMG' &&
|
||||
(isFirefox() || !document.documentElement?.contains(node))
|
||||
)
|
||||
}
|
||||
|
||||
function getDragPreviewSize(
|
||||
isImage: boolean,
|
||||
dragPreview: any,
|
||||
sourceWidth: number,
|
||||
sourceHeight: number,
|
||||
) {
|
||||
let dragPreviewWidth = isImage ? dragPreview.width : sourceWidth
|
||||
let dragPreviewHeight = isImage ? dragPreview.height : sourceHeight
|
||||
|
||||
// Work around @2x coordinate discrepancies in browsers
|
||||
if (isSafari() && isImage) {
|
||||
dragPreviewHeight /= window.devicePixelRatio
|
||||
dragPreviewWidth /= window.devicePixelRatio
|
||||
}
|
||||
return { dragPreviewWidth, dragPreviewHeight }
|
||||
}
|
||||
|
||||
export function getDragPreviewOffset(
|
||||
sourceNode: HTMLElement,
|
||||
dragPreview: HTMLElement,
|
||||
clientOffset: XYCoord,
|
||||
anchorPoint: { anchorX: number; anchorY: number },
|
||||
offsetPoint: { offsetX: number; offsetY: number },
|
||||
): XYCoord {
|
||||
// The browsers will use the image intrinsic size under different conditions.
|
||||
// Firefox only cares if it's an image, but WebKit also wants it to be detached.
|
||||
const isImage = isImageNode(dragPreview)
|
||||
const dragPreviewNode = isImage ? sourceNode : dragPreview
|
||||
const dragPreviewNodeOffsetFromClient = getNodeClientOffset(
|
||||
dragPreviewNode,
|
||||
) as XYCoord
|
||||
const offsetFromDragPreview = {
|
||||
x: clientOffset.x - dragPreviewNodeOffsetFromClient.x,
|
||||
y: clientOffset.y - dragPreviewNodeOffsetFromClient.y,
|
||||
}
|
||||
const { offsetWidth: sourceWidth, offsetHeight: sourceHeight } = sourceNode
|
||||
const { anchorX, anchorY } = anchorPoint
|
||||
const { dragPreviewWidth, dragPreviewHeight } = getDragPreviewSize(
|
||||
isImage,
|
||||
dragPreview,
|
||||
sourceWidth,
|
||||
sourceHeight,
|
||||
)
|
||||
|
||||
const calculateYOffset = () => {
|
||||
const interpolantY = new MonotonicInterpolant(
|
||||
[0, 0.5, 1],
|
||||
[
|
||||
// Dock to the top
|
||||
offsetFromDragPreview.y,
|
||||
// Align at the center
|
||||
(offsetFromDragPreview.y / sourceHeight) * dragPreviewHeight,
|
||||
// Dock to the bottom
|
||||
offsetFromDragPreview.y + dragPreviewHeight - sourceHeight,
|
||||
],
|
||||
)
|
||||
let y = interpolantY.interpolate(anchorY)
|
||||
// Work around Safari 8 positioning bug
|
||||
if (isSafari() && isImage) {
|
||||
// We'll have to wait for @3x to see if this is entirely correct
|
||||
y += (window.devicePixelRatio - 1) * dragPreviewHeight
|
||||
}
|
||||
return y
|
||||
}
|
||||
|
||||
const calculateXOffset = () => {
|
||||
// Interpolate coordinates depending on anchor point
|
||||
// If you know a simpler way to do this, let me know
|
||||
const interpolantX = new MonotonicInterpolant(
|
||||
[0, 0.5, 1],
|
||||
[
|
||||
// Dock to the left
|
||||
offsetFromDragPreview.x,
|
||||
// Align at the center
|
||||
(offsetFromDragPreview.x / sourceWidth) * dragPreviewWidth,
|
||||
// Dock to the right
|
||||
offsetFromDragPreview.x + dragPreviewWidth - sourceWidth,
|
||||
],
|
||||
)
|
||||
return interpolantX.interpolate(anchorX)
|
||||
}
|
||||
|
||||
// Force offsets if specified in the options.
|
||||
const { offsetX, offsetY } = offsetPoint
|
||||
const isManualOffsetX = offsetX === 0 || offsetX
|
||||
const isManualOffsetY = offsetY === 0 || offsetY
|
||||
return {
|
||||
x: isManualOffsetX ? offsetX : calculateXOffset(),
|
||||
y: isManualOffsetY ? offsetY : calculateYOffset(),
|
||||
}
|
||||
}
|
||||
38
frontend/node_modules/react-dnd-html5-backend/src/OptionsReader.ts
generated
vendored
38
frontend/node_modules/react-dnd-html5-backend/src/OptionsReader.ts
generated
vendored
@@ -1,38 +0,0 @@
|
||||
import type { HTML5BackendContext, HTML5BackendOptions } from './types.js'
|
||||
|
||||
export class OptionsReader {
|
||||
public ownerDocument: Document | null = null
|
||||
private globalContext: HTML5BackendContext
|
||||
private optionsArgs: HTML5BackendOptions | undefined
|
||||
|
||||
public constructor(
|
||||
globalContext: HTML5BackendContext,
|
||||
options?: HTML5BackendOptions,
|
||||
) {
|
||||
this.globalContext = globalContext
|
||||
this.optionsArgs = options
|
||||
}
|
||||
|
||||
public get window(): Window | undefined {
|
||||
if (this.globalContext) {
|
||||
return this.globalContext
|
||||
} else if (typeof window !== 'undefined') {
|
||||
return window
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
public get document(): Document | undefined {
|
||||
if (this.globalContext?.document) {
|
||||
return this.globalContext.document
|
||||
} else if (this.window) {
|
||||
return this.window.document
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
public get rootElement(): Node | undefined {
|
||||
return this.optionsArgs?.rootElement || this.window
|
||||
}
|
||||
}
|
||||
11
frontend/node_modules/react-dnd-html5-backend/src/getEmptyImage.ts
generated
vendored
11
frontend/node_modules/react-dnd-html5-backend/src/getEmptyImage.ts
generated
vendored
@@ -1,11 +0,0 @@
|
||||
let emptyImage: HTMLImageElement | undefined
|
||||
|
||||
export function getEmptyImage(): HTMLImageElement {
|
||||
if (!emptyImage) {
|
||||
emptyImage = new Image()
|
||||
emptyImage.src =
|
||||
'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='
|
||||
}
|
||||
|
||||
return emptyImage
|
||||
}
|
||||
15
frontend/node_modules/react-dnd-html5-backend/src/index.ts
generated
vendored
15
frontend/node_modules/react-dnd-html5-backend/src/index.ts
generated
vendored
@@ -1,15 +0,0 @@
|
||||
import type { BackendFactory, DragDropManager } from 'dnd-core'
|
||||
|
||||
import { HTML5BackendImpl } from './HTML5BackendImpl.js'
|
||||
import type { HTML5BackendContext, HTML5BackendOptions } from './types.js'
|
||||
export { getEmptyImage } from './getEmptyImage.js'
|
||||
export * as NativeTypes from './NativeTypes.js'
|
||||
export type { HTML5BackendContext, HTML5BackendOptions } from './types.js'
|
||||
|
||||
export const HTML5Backend: BackendFactory = function createBackend(
|
||||
manager: DragDropManager,
|
||||
context?: HTML5BackendContext,
|
||||
options?: HTML5BackendOptions,
|
||||
): HTML5BackendImpl {
|
||||
return new HTML5BackendImpl(manager, context, options)
|
||||
}
|
||||
16
frontend/node_modules/react-dnd-html5-backend/src/matchesType.ts
generated
vendored
16
frontend/node_modules/react-dnd-html5-backend/src/matchesType.ts
generated
vendored
@@ -1,16 +0,0 @@
|
||||
//
|
||||
// HACK: copied from dnd-core. duplicating here to fix a CI issue
|
||||
//
|
||||
import type { Identifier, SourceType, TargetType } from 'dnd-core'
|
||||
|
||||
export function matchesType(
|
||||
targetType: TargetType | null,
|
||||
draggedItemType: SourceType | null,
|
||||
): boolean {
|
||||
if (draggedItemType === null) {
|
||||
return targetType === null
|
||||
}
|
||||
return Array.isArray(targetType)
|
||||
? (targetType as Identifier[]).some((t) => t === draggedItemType)
|
||||
: targetType === draggedItemType
|
||||
}
|
||||
11
frontend/node_modules/react-dnd-html5-backend/src/types.ts
generated
vendored
11
frontend/node_modules/react-dnd-html5-backend/src/types.ts
generated
vendored
@@ -1,11 +0,0 @@
|
||||
export type HTML5BackendContext = Window | undefined
|
||||
|
||||
/**
|
||||
* Configuration options for the HTML5Backend
|
||||
*/
|
||||
export interface HTML5BackendOptions {
|
||||
/**
|
||||
* The root DOM node to use for subscribing to events. Default=Window
|
||||
*/
|
||||
rootElement: Node
|
||||
}
|
||||
30
frontend/node_modules/react-dnd-html5-backend/src/utils/js_utils.ts
generated
vendored
30
frontend/node_modules/react-dnd-html5-backend/src/utils/js_utils.ts
generated
vendored
@@ -1,30 +0,0 @@
|
||||
// cheap lodash replacements
|
||||
|
||||
export function memoize<T>(fn: () => T): () => T {
|
||||
let result: T | null = null
|
||||
const memoized = () => {
|
||||
if (result == null) {
|
||||
result = fn()
|
||||
}
|
||||
return result
|
||||
}
|
||||
return memoized
|
||||
}
|
||||
|
||||
/**
|
||||
* drop-in replacement for _.without
|
||||
*/
|
||||
export function without<T>(items: T[], item: T) {
|
||||
return items.filter((i) => i !== item)
|
||||
}
|
||||
|
||||
export function union<T extends string | number>(itemsA: T[], itemsB: T[]) {
|
||||
const set = new Set<T>()
|
||||
const insertItem = (item: T) => set.add(item)
|
||||
itemsA.forEach(insertItem)
|
||||
itemsB.forEach(insertItem)
|
||||
|
||||
const result: T[] = []
|
||||
set.forEach((key) => result.push(key))
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user