Add files

This commit is contained in:
DoomRye 2022-07-26 10:06:20 -07:00
commit bb80829159
18195 changed files with 2122994 additions and 0 deletions

View file

@ -0,0 +1,27 @@
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _lodashFunctionMemoize = require('lodash/function/memoize');
var _lodashFunctionMemoize2 = _interopRequireDefault(_lodashFunctionMemoize);
var isFirefox = _lodashFunctionMemoize2['default'](function () {
return (/firefox/i.test(navigator.userAgent)
);
});
exports.isFirefox = isFirefox;
var isSafari = _lodashFunctionMemoize2['default'](function () {
return Boolean(window.safari);
});
exports.isSafari = isSafari;
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/BrowserDetector.js
// module id = 1114
// module chunks = 4

View file

@ -0,0 +1,59 @@
'use strict';
exports.__esModule = true;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var _lodashArrayUnion = require('lodash/array/union');
var _lodashArrayUnion2 = _interopRequireDefault(_lodashArrayUnion);
var _lodashArrayWithout = require('lodash/array/without');
var _lodashArrayWithout2 = _interopRequireDefault(_lodashArrayWithout);
var EnterLeaveCounter = (function () {
function EnterLeaveCounter() {
_classCallCheck(this, EnterLeaveCounter);
this.entered = [];
}
EnterLeaveCounter.prototype.enter = function enter(enteringNode) {
var previousLength = this.entered.length;
this.entered = _lodashArrayUnion2['default'](this.entered.filter(function (node) {
return document.documentElement.contains(node) && (!node.contains || node.contains(enteringNode));
}), [enteringNode]);
return previousLength === 0 && this.entered.length > 0;
};
EnterLeaveCounter.prototype.leave = function leave(leavingNode) {
var previousLength = this.entered.length;
this.entered = _lodashArrayWithout2['default'](this.entered.filter(function (node) {
return document.documentElement.contains(node);
}), leavingNode);
return previousLength > 0 && this.entered.length === 0;
};
EnterLeaveCounter.prototype.reset = function reset() {
this.entered = [];
};
return EnterLeaveCounter;
})();
exports['default'] = EnterLeaveCounter;
module.exports = exports['default'];
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/EnterLeaveCounter.js
// module id = 2697
// module chunks = 4

View file

@ -0,0 +1,567 @@
'use strict';
exports.__esModule = true;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
var _lodashObjectDefaults = require('lodash/object/defaults');
var _lodashObjectDefaults2 = _interopRequireDefault(_lodashObjectDefaults);
var _shallowEqual = require('./shallowEqual');
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
var _EnterLeaveCounter = require('./EnterLeaveCounter');
var _EnterLeaveCounter2 = _interopRequireDefault(_EnterLeaveCounter);
var _BrowserDetector = require('./BrowserDetector');
var _OffsetUtils = require('./OffsetUtils');
var _NativeDragSources = require('./NativeDragSources');
var _NativeTypes = require('./NativeTypes');
var NativeTypes = _interopRequireWildcard(_NativeTypes);
var HTML5Backend = (function () {
function HTML5Backend(manager) {
_classCallCheck(this, HTML5Backend);
this.actions = manager.getActions();
this.monitor = manager.getMonitor();
this.registry = manager.getRegistry();
this.sourcePreviewNodes = {};
this.sourcePreviewNodeOptions = {};
this.sourceNodes = {};
this.sourceNodeOptions = {};
this.enterLeaveCounter = new _EnterLeaveCounter2['default']();
this.getSourceClientOffset = this.getSourceClientOffset.bind(this);
this.handleTopDragStart = this.handleTopDragStart.bind(this);
this.handleTopDragStartCapture = this.handleTopDragStartCapture.bind(this);
this.handleTopDragEndCapture = this.handleTopDragEndCapture.bind(this);
this.handleTopDragEnter = this.handleTopDragEnter.bind(this);
this.handleTopDragEnterCapture = this.handleTopDragEnterCapture.bind(this);
this.handleTopDragLeaveCapture = this.handleTopDragLeaveCapture.bind(this);
this.handleTopDragOver = this.handleTopDragOver.bind(this);
this.handleTopDragOverCapture = this.handleTopDragOverCapture.bind(this);
this.handleTopDrop = this.handleTopDrop.bind(this);
this.handleTopDropCapture = this.handleTopDropCapture.bind(this);
this.handleSelectStart = this.handleSelectStart.bind(this);
this.endDragIfSourceWasRemovedFromDOM = this.endDragIfSourceWasRemovedFromDOM.bind(this);
this.endDragNativeItem = this.endDragNativeItem.bind(this);
}
HTML5Backend.prototype.setup = function setup() {
if (typeof window === 'undefined') {
return;
}
if (this.constructor.isSetUp) {
throw new Error('Cannot have two HTML5 backends at the same time.');
}
this.constructor.isSetUp = true;
this.addEventListeners(window);
};
HTML5Backend.prototype.teardown = function teardown() {
if (typeof window === 'undefined') {
return;
}
this.constructor.isSetUp = false;
this.removeEventListeners(window);
this.clearCurrentDragSourceNode();
};
HTML5Backend.prototype.addEventListeners = function addEventListeners(target) {
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);
};
HTML5Backend.prototype.removeEventListeners = function removeEventListeners(target) {
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);
};
HTML5Backend.prototype.connectDragPreview = function connectDragPreview(sourceId, node, options) {
var _this = this;
this.sourcePreviewNodeOptions[sourceId] = options;
this.sourcePreviewNodes[sourceId] = node;
return function () {
delete _this.sourcePreviewNodes[sourceId];
delete _this.sourcePreviewNodeOptions[sourceId];
};
};
HTML5Backend.prototype.connectDragSource = function connectDragSource(sourceId, node, options) {
var _this2 = this;
this.sourceNodes[sourceId] = node;
this.sourceNodeOptions[sourceId] = options;
var handleDragStart = function handleDragStart(e) {
return _this2.handleDragStart(e, sourceId);
};
var handleSelectStart = function handleSelectStart(e) {
return _this2.handleSelectStart(e, sourceId);
};
node.setAttribute('draggable', true);
node.addEventListener('dragstart', handleDragStart);
node.addEventListener('selectstart', handleSelectStart);
return function () {
delete _this2.sourceNodes[sourceId];
delete _this2.sourceNodeOptions[sourceId];
node.removeEventListener('dragstart', handleDragStart);
node.removeEventListener('selectstart', handleSelectStart);
node.setAttribute('draggable', false);
};
};
HTML5Backend.prototype.connectDropTarget = function connectDropTarget(targetId, node) {
var _this3 = this;
var handleDragEnter = function handleDragEnter(e) {
return _this3.handleDragEnter(e, targetId);
};
var handleDragOver = function handleDragOver(e) {
return _this3.handleDragOver(e, targetId);
};
var handleDrop = function handleDrop(e) {
return _this3.handleDrop(e, targetId);
};
node.addEventListener('dragenter', handleDragEnter);
node.addEventListener('dragover', handleDragOver);
node.addEventListener('drop', handleDrop);
return function () {
node.removeEventListener('dragenter', handleDragEnter);
node.removeEventListener('dragover', handleDragOver);
node.removeEventListener('drop', handleDrop);
};
};
HTML5Backend.prototype.getCurrentSourceNodeOptions = function getCurrentSourceNodeOptions() {
var sourceId = this.monitor.getSourceId();
var sourceNodeOptions = this.sourceNodeOptions[sourceId];
return _lodashObjectDefaults2['default'](sourceNodeOptions || {}, {
dropEffect: 'move'
});
};
HTML5Backend.prototype.getCurrentDropEffect = function getCurrentDropEffect() {
if (this.isDraggingNativeItem()) {
// It makes more sense to default to 'copy' for native resources
return 'copy';
}
return this.getCurrentSourceNodeOptions().dropEffect;
};
HTML5Backend.prototype.getCurrentSourcePreviewNodeOptions = function getCurrentSourcePreviewNodeOptions() {
var sourceId = this.monitor.getSourceId();
var sourcePreviewNodeOptions = this.sourcePreviewNodeOptions[sourceId];
return _lodashObjectDefaults2['default'](sourcePreviewNodeOptions || {}, {
anchorX: 0.5,
anchorY: 0.5,
captureDraggingState: false
});
};
HTML5Backend.prototype.getSourceClientOffset = function getSourceClientOffset(sourceId) {
return _OffsetUtils.getNodeClientOffset(this.sourceNodes[sourceId]);
};
HTML5Backend.prototype.isDraggingNativeItem = function isDraggingNativeItem() {
var itemType = this.monitor.getItemType();
return Object.keys(NativeTypes).some(function (key) {
return NativeTypes[key] === itemType;
});
};
HTML5Backend.prototype.beginDragNativeItem = function beginDragNativeItem(type) {
this.clearCurrentDragSourceNode();
var SourceType = _NativeDragSources.createNativeDragSource(type);
this.currentNativeSource = new SourceType();
this.currentNativeHandle = this.registry.addSource(type, this.currentNativeSource);
this.actions.beginDrag([this.currentNativeHandle]);
// If mousemove fires, the drag is over but browser failed to tell us.
window.addEventListener('mousemove', this.endDragNativeItem, true);
};
HTML5Backend.prototype.endDragNativeItem = function endDragNativeItem() {
if (!this.isDraggingNativeItem()) {
return;
}
window.removeEventListener('mousemove', this.endDragNativeItem, true);
this.actions.endDrag();
this.registry.removeSource(this.currentNativeHandle);
this.currentNativeHandle = null;
this.currentNativeSource = null;
};
HTML5Backend.prototype.endDragIfSourceWasRemovedFromDOM = function endDragIfSourceWasRemovedFromDOM() {
var node = this.currentDragSourceNode;
if (document.body.contains(node)) {
return;
}
if (this.clearCurrentDragSourceNode()) {
this.actions.endDrag();
}
};
HTML5Backend.prototype.setCurrentDragSourceNode = function setCurrentDragSourceNode(node) {
this.clearCurrentDragSourceNode();
this.currentDragSourceNode = node;
this.currentDragSourceNodeOffset = _OffsetUtils.getNodeClientOffset(node);
this.currentDragSourceNodeOffsetChanged = false;
// 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.
window.addEventListener('mousemove', this.endDragIfSourceWasRemovedFromDOM, true);
};
HTML5Backend.prototype.clearCurrentDragSourceNode = function clearCurrentDragSourceNode() {
if (this.currentDragSourceNode) {
this.currentDragSourceNode = null;
this.currentDragSourceNodeOffset = null;
this.currentDragSourceNodeOffsetChanged = false;
window.removeEventListener('mousemove', this.endDragIfSourceWasRemovedFromDOM, true);
return true;
}
return false;
};
HTML5Backend.prototype.checkIfCurrentDragSourceRectChanged = function checkIfCurrentDragSourceRectChanged() {
var node = this.currentDragSourceNode;
if (!node) {
return false;
}
if (this.currentDragSourceNodeOffsetChanged) {
return true;
}
this.currentDragSourceNodeOffsetChanged = !_shallowEqual2['default'](_OffsetUtils.getNodeClientOffset(node), this.currentDragSourceNodeOffset);
return this.currentDragSourceNodeOffsetChanged;
};
HTML5Backend.prototype.handleTopDragStartCapture = function handleTopDragStartCapture() {
this.clearCurrentDragSourceNode();
this.dragStartSourceIds = [];
};
HTML5Backend.prototype.handleDragStart = function handleDragStart(e, sourceId) {
this.dragStartSourceIds.unshift(sourceId);
};
HTML5Backend.prototype.handleTopDragStart = function handleTopDragStart(e) {
var _this4 = this;
var dragStartSourceIds = this.dragStartSourceIds;
this.dragStartSourceIds = null;
var clientOffset = _OffsetUtils.getEventClientOffset(e);
// Don't publish the source just yet (see why below)
this.actions.beginDrag(dragStartSourceIds, {
publishSource: false,
getSourceClientOffset: this.getSourceClientOffset,
clientOffset: clientOffset
});
var dataTransfer = e.dataTransfer;
var nativeType = _NativeDragSources.matchNativeItemType(dataTransfer);
if (this.monitor.isDragging()) {
if (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.
var sourceId = this.monitor.getSourceId();
var sourceNode = this.sourceNodes[sourceId];
var dragPreview = this.sourcePreviewNodes[sourceId] || sourceNode;
var _getCurrentSourcePreviewNodeOptions = this.getCurrentSourcePreviewNodeOptions();
var anchorX = _getCurrentSourcePreviewNodeOptions.anchorX;
var anchorY = _getCurrentSourcePreviewNodeOptions.anchorY;
var anchorPoint = { anchorX: anchorX, anchorY: anchorY };
var dragPreviewOffset = _OffsetUtils.getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint);
dataTransfer.setDragImage(dragPreview, dragPreviewOffset.x, dragPreviewOffset.y);
}
try {
// Firefox won't drag without setting data
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?
var _getCurrentSourcePreviewNodeOptions2 = this.getCurrentSourcePreviewNodeOptions();
var captureDraggingState = _getCurrentSourcePreviewNodeOptions2.captureDraggingState;
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(function () {
return _this4.actions.publishDragSource();
});
} 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.types && (!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();
}
};
HTML5Backend.prototype.handleTopDragEndCapture = function handleTopDragEndCapture() {
if (this.clearCurrentDragSourceNode()) {
// 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();
}
};
HTML5Backend.prototype.handleTopDragEnterCapture = function handleTopDragEnterCapture(e) {
this.dragEnterTargetIds = [];
var isFirstEnter = this.enterLeaveCounter.enter(e.target);
if (!isFirstEnter || this.monitor.isDragging()) {
return;
}
var dataTransfer = e.dataTransfer;
var nativeType = _NativeDragSources.matchNativeItemType(dataTransfer);
if (nativeType) {
// A native item (such as file or URL) dragged from outside the document
this.beginDragNativeItem(nativeType);
}
};
HTML5Backend.prototype.handleDragEnter = function handleDragEnter(e, targetId) {
this.dragEnterTargetIds.unshift(targetId);
};
HTML5Backend.prototype.handleTopDragEnter = function handleTopDragEnter(e) {
var _this5 = this;
var dragEnterTargetIds = this.dragEnterTargetIds;
this.dragEnterTargetIds = [];
if (!this.monitor.isDragging()) {
// This is probably a native item type we don't understand.
return;
}
if (!_BrowserDetector.isFirefox()) {
// Don't emit hover in `dragenter` on Firefox due to an edge case.
// If the target changes position as the result of `dragenter`, Firefox
// will still happily dispatch `dragover` despite target being no longer
// there. The easy solution is to only fire `hover` in `dragover` on FF.
this.actions.hover(dragEnterTargetIds, {
clientOffset: _OffsetUtils.getEventClientOffset(e)
});
}
var canDrop = dragEnterTargetIds.some(function (targetId) {
return _this5.monitor.canDropOnTarget(targetId);
});
if (canDrop) {
// IE requires this to fire dragover events
e.preventDefault();
e.dataTransfer.dropEffect = this.getCurrentDropEffect();
}
};
HTML5Backend.prototype.handleTopDragOverCapture = function handleTopDragOverCapture() {
this.dragOverTargetIds = [];
};
HTML5Backend.prototype.handleDragOver = function handleDragOver(e, targetId) {
this.dragOverTargetIds.unshift(targetId);
};
HTML5Backend.prototype.handleTopDragOver = function handleTopDragOver(e) {
var _this6 = this;
var dragOverTargetIds = this.dragOverTargetIds;
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();
e.dataTransfer.dropEffect = 'none';
return;
}
this.actions.hover(dragOverTargetIds, {
clientOffset: _OffsetUtils.getEventClientOffset(e)
});
var canDrop = dragOverTargetIds.some(function (targetId) {
return _this6.monitor.canDropOnTarget(targetId);
});
if (canDrop) {
// Show user-specified drop effect.
e.preventDefault();
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();
e.dataTransfer.dropEffect = 'none';
} else if (this.checkIfCurrentDragSourceRectChanged()) {
// Prevent animating to incorrect position.
// Drop effect must be other than 'none' to prevent animation.
e.preventDefault();
e.dataTransfer.dropEffect = 'move';
}
};
HTML5Backend.prototype.handleTopDragLeaveCapture = function handleTopDragLeaveCapture(e) {
if (this.isDraggingNativeItem()) {
e.preventDefault();
}
var isLastLeave = this.enterLeaveCounter.leave(e.target);
if (!isLastLeave) {
return;
}
if (this.isDraggingNativeItem()) {
this.endDragNativeItem();
}
};
HTML5Backend.prototype.handleTopDropCapture = function handleTopDropCapture(e) {
this.dropTargetIds = [];
e.preventDefault();
if (this.isDraggingNativeItem()) {
this.currentNativeSource.mutateItemByReadingDataTransfer(e.dataTransfer);
}
this.enterLeaveCounter.reset();
};
HTML5Backend.prototype.handleDrop = function handleDrop(e, targetId) {
this.dropTargetIds.unshift(targetId);
};
HTML5Backend.prototype.handleTopDrop = function handleTopDrop(e) {
var dropTargetIds = this.dropTargetIds;
this.dropTargetIds = [];
this.actions.hover(dropTargetIds, {
clientOffset: _OffsetUtils.getEventClientOffset(e)
});
this.actions.drop();
if (this.isDraggingNativeItem()) {
this.endDragNativeItem();
} else {
this.endDragIfSourceWasRemovedFromDOM();
}
};
HTML5Backend.prototype.handleSelectStart = function handleSelectStart(e) {
// Prevent selection on IE
// and instead ask it to consider dragging.
if (typeof e.target.dragDrop === 'function') {
e.preventDefault();
e.target.dragDrop();
}
};
return HTML5Backend;
})();
exports['default'] = HTML5Backend;
module.exports = exports['default'];
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/HTML5Backend.js
// module id = 2698
// module chunks = 4

View file

@ -0,0 +1,119 @@
"use strict";
exports.__esModule = true;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var MonotonicInterpolant = (function () {
function MonotonicInterpolant(xs, ys) {
_classCallCheck(this, MonotonicInterpolant);
var length = xs.length;
// Rearrange xs and ys so that xs is sorted
var indexes = [];
for (var i = 0; i < length; i++) {
indexes.push(i);
}
indexes.sort(function (a, b) {
return xs[a] < xs[b] ? -1 : 1;
});
// Get consecutive differences and slopes
var dys = [];
var dxs = [];
var ms = [];
var dx = undefined;
var dy = undefined;
for (var i = 0; i < length - 1; i++) {
dx = xs[i + 1] - xs[i];
dy = ys[i + 1] - ys[i];
dxs.push(dx);
dys.push(dy);
ms.push(dy / dx);
}
// Get degree-1 coefficients
var c1s = [ms[0]];
for (var i = 0; i < dxs.length - 1; i++) {
var _m = ms[i];
var mNext = ms[i + 1];
if (_m * mNext <= 0) {
c1s.push(0);
} else {
dx = dxs[i];
var dxNext = dxs[i + 1];
var common = dx + dxNext;
c1s.push(3 * common / ((common + dxNext) / _m + (common + dx) / mNext));
}
}
c1s.push(ms[ms.length - 1]);
// Get degree-2 and degree-3 coefficients
var c2s = [];
var c3s = [];
var m = undefined;
for (var i = 0; i < c1s.length - 1; i++) {
m = ms[i];
var c1 = c1s[i];
var invDx = 1 / dxs[i];
var common = c1 + c1s[i + 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;
}
MonotonicInterpolant.prototype.interpolate = function interpolate(x) {
var xs = this.xs;
var ys = this.ys;
var c1s = this.c1s;
var c2s = this.c2s;
var c3s = this.c3s;
// The rightmost point in the dataset should give an exact result
var 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
var low = 0;
var high = c3s.length - 1;
var mid = undefined;
while (low <= high) {
mid = Math.floor(0.5 * (low + high));
var 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
var diff = x - xs[i];
var diffSq = diff * diff;
return ys[i] + c1s[i] * diff + c2s[i] * diffSq + c3s[i] * diff * diffSq;
};
return MonotonicInterpolant;
})();
exports["default"] = MonotonicInterpolant;
module.exports = exports["default"];
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/MonotonicInterpolant.js
// module id = 2699
// module chunks = 4

View file

@ -0,0 +1,110 @@
'use strict';
exports.__esModule = true;
var _nativeTypesConfig;
exports.createNativeDragSource = createNativeDragSource;
exports.matchNativeItemType = matchNativeItemType;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
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; }
var _NativeTypes = require('./NativeTypes');
var NativeTypes = _interopRequireWildcard(_NativeTypes);
function getDataFromDataTransfer(dataTransfer, typesToTry, defaultValue) {
var result = typesToTry.reduce(function (resultSoFar, typeToTry) {
return resultSoFar || dataTransfer.getData(typeToTry);
}, null);
return result != null ? // eslint-disable-line eqeqeq
result : defaultValue;
}
var nativeTypesConfig = (_nativeTypesConfig = {}, _defineProperty(_nativeTypesConfig, NativeTypes.FILE, {
exposeProperty: 'files',
matchesTypes: ['Files'],
getData: function getData(dataTransfer) {
return Array.prototype.slice.call(dataTransfer.files);
}
}), _defineProperty(_nativeTypesConfig, NativeTypes.URL, {
exposeProperty: 'urls',
matchesTypes: ['Url', 'text/uri-list'],
getData: function getData(dataTransfer, matchesTypes) {
return getDataFromDataTransfer(dataTransfer, matchesTypes, '').split('\n');
}
}), _defineProperty(_nativeTypesConfig, NativeTypes.TEXT, {
exposeProperty: 'text',
matchesTypes: ['Text', 'text/plain'],
getData: function getData(dataTransfer, matchesTypes) {
return getDataFromDataTransfer(dataTransfer, matchesTypes, '');
}
}), _nativeTypesConfig);
function createNativeDragSource(type) {
var _nativeTypesConfig$type = nativeTypesConfig[type];
var exposeProperty = _nativeTypesConfig$type.exposeProperty;
var matchesTypes = _nativeTypesConfig$type.matchesTypes;
var getData = _nativeTypesConfig$type.getData;
return (function () {
function NativeDragSource() {
_classCallCheck(this, NativeDragSource);
this.item = Object.defineProperties({}, _defineProperty({}, exposeProperty, {
get: function get() {
console.warn( // eslint-disable-line no-console
'Browser doesn\'t allow reading "' + exposeProperty + '" until the drop event.');
return null;
},
configurable: true,
enumerable: true
}));
}
NativeDragSource.prototype.mutateItemByReadingDataTransfer = function mutateItemByReadingDataTransfer(dataTransfer) {
delete this.item[exposeProperty];
this.item[exposeProperty] = getData(dataTransfer, matchesTypes);
};
NativeDragSource.prototype.canDrag = function canDrag() {
return true;
};
NativeDragSource.prototype.beginDrag = function beginDrag() {
return this.item;
};
NativeDragSource.prototype.isDragging = function isDragging(monitor, handle) {
return handle === monitor.getSourceId();
};
NativeDragSource.prototype.endDrag = function endDrag() {};
return NativeDragSource;
})();
}
function matchNativeItemType(dataTransfer) {
var dataTransferTypes = Array.prototype.slice.call(dataTransfer.types || []);
return Object.keys(nativeTypesConfig).filter(function (nativeItemType) {
var matchesTypes = nativeTypesConfig[nativeItemType].matchesTypes;
return matchesTypes.some(function (t) {
return dataTransferTypes.indexOf(t) > -1;
});
})[0] || null;
}
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/NativeDragSources.js
// module id = 2700
// module chunks = 4

View file

@ -0,0 +1,16 @@
'use strict';
exports.__esModule = true;
var FILE = '__NATIVE_FILE__';
exports.FILE = FILE;
var URL = '__NATIVE_URL__';
exports.URL = URL;
var TEXT = '__NATIVE_TEXT__';
exports.TEXT = TEXT;
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/NativeTypes.js
// module id = 645
// module chunks = 4

View file

@ -0,0 +1,102 @@
'use strict';
exports.__esModule = true;
exports.getNodeClientOffset = getNodeClientOffset;
exports.getEventClientOffset = getEventClientOffset;
exports.getDragPreviewOffset = getDragPreviewOffset;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _BrowserDetector = require('./BrowserDetector');
var _MonotonicInterpolant = require('./MonotonicInterpolant');
var _MonotonicInterpolant2 = _interopRequireDefault(_MonotonicInterpolant);
var ELEMENT_NODE = 1;
function getNodeClientOffset(node) {
var el = node.nodeType === ELEMENT_NODE ? node : node.parentElement;
if (!el) {
return null;
}
var _el$getBoundingClientRect = el.getBoundingClientRect();
var top = _el$getBoundingClientRect.top;
var left = _el$getBoundingClientRect.left;
return { x: left, y: top };
}
function getEventClientOffset(e) {
return {
x: e.clientX,
y: e.clientY
};
}
function getDragPreviewOffset(sourceNode, dragPreview, clientOffset, anchorPoint) {
// 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.
var isImage = dragPreview.nodeName === 'IMG' && (_BrowserDetector.isFirefox() || !document.documentElement.contains(dragPreview));
var dragPreviewNode = isImage ? sourceNode : dragPreview;
var dragPreviewNodeOffsetFromClient = getNodeClientOffset(dragPreviewNode);
var offsetFromDragPreview = {
x: clientOffset.x - dragPreviewNodeOffsetFromClient.x,
y: clientOffset.y - dragPreviewNodeOffsetFromClient.y
};
var sourceWidth = sourceNode.offsetWidth;
var sourceHeight = sourceNode.offsetHeight;
var anchorX = anchorPoint.anchorX;
var anchorY = anchorPoint.anchorY;
var dragPreviewWidth = isImage ? dragPreview.width : sourceWidth;
var dragPreviewHeight = isImage ? dragPreview.height : sourceHeight;
// Work around @2x coordinate discrepancies in browsers
if (_BrowserDetector.isSafari() && isImage) {
dragPreviewHeight /= window.devicePixelRatio;
dragPreviewWidth /= window.devicePixelRatio;
} else if (_BrowserDetector.isFirefox() && !isImage) {
dragPreviewHeight *= window.devicePixelRatio;
dragPreviewWidth *= window.devicePixelRatio;
}
// Interpolate coordinates depending on anchor point
// If you know a simpler way to do this, let me know
var interpolantX = new _MonotonicInterpolant2['default']([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]);
var interpolantY = new _MonotonicInterpolant2['default']([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]);
var x = interpolantX.interpolate(anchorX);
var y = interpolantY.interpolate(anchorY);
// Work around Safari 8 positioning bug
if (_BrowserDetector.isSafari() && isImage) {
// We'll have to wait for @3x to see if this is entirely correct
y += (window.devicePixelRatio - 1) * dragPreviewHeight;
}
return { x: x, y: y };
}
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/OffsetUtils.js
// module id = 2701
// module chunks = 4

View file

@ -0,0 +1,23 @@
'use strict';
exports.__esModule = true;
exports['default'] = getEmptyImage;
var emptyImage = undefined;
function getEmptyImage() {
if (!emptyImage) {
emptyImage = new Image();
emptyImage.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
}
return emptyImage;
}
module.exports = exports['default'];
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/getEmptyImage.js
// module id = 2702
// module chunks = 4

View file

@ -0,0 +1,34 @@
'use strict';
exports.__esModule = true;
exports['default'] = createHTML5Backend;
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var _HTML5Backend = require('./HTML5Backend');
var _HTML5Backend2 = _interopRequireDefault(_HTML5Backend);
var _getEmptyImage = require('./getEmptyImage');
var _getEmptyImage2 = _interopRequireDefault(_getEmptyImage);
var _NativeTypes = require('./NativeTypes');
var NativeTypes = _interopRequireWildcard(_NativeTypes);
exports.NativeTypes = NativeTypes;
exports.getEmptyImage = _getEmptyImage2['default'];
function createHTML5Backend(manager) {
return new _HTML5Backend2['default'](manager);
}
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/index.js
// module id = 479
// module chunks = 4

View file

@ -0,0 +1,43 @@
"use strict";
exports.__esModule = true;
exports["default"] = shallowEqual;
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
var hasOwn = Object.prototype.hasOwnProperty;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
var valA = objA[keysA[i]];
var valB = objB[keysA[i]];
if (valA !== valB) {
return false;
}
}
return true;
}
module.exports = exports["default"];
//////////////////
// WEBPACK FOOTER
// ./~/react-dnd-html5-backend/lib/shallowEqual.js
// module id = 2703
// module chunks = 4