⬆️ Update vendor dependencies.

This commit is contained in:
Andrey Antukh 2020-01-16 19:29:13 +01:00
parent 595cdd66c7
commit d16d506a78
10 changed files with 3840 additions and 2809 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,8 @@
import fr_FR from "date-fns/locale/fr";
import en_US from "date-fns/locale/en-US";
import format from "date-fns/format"; import format from "date-fns/format";
import distanceInWordsToNow from "date-fns/distance_in_words_to_now"; import formatDistanceToNow from "date-fns/formatDistanceToNow";
if (typeof self !== "undefined") { init(self); } if (typeof self !== "undefined") { init(self); }
else if (typeof global !== "undefined") { init(global); } else if (typeof global !== "undefined") { init(global); }
@ -8,7 +11,14 @@ else { throw new Error("unsupported execution environment"); }
function init(g) { function init(g) {
g.dateFns = { g.dateFns = {
locales: {
"default": en_US,
"en": en_US,
"en_US": en_US,
"fr": fr_FR,
"fr_FR": fr_FR
},
format, format,
distanceInWordsToNow formatDistanceToNow,
}; };
} }

View file

@ -1,155 +1,4 @@
var dateFns = {}; var dateFns = {};
dateFns.addDays = function() {};
dateFns.addHours = function() {};
dateFns.addISOYears = function() {};
dateFns.addMilliseconds = function() {};
dateFns.addMinutes = function() {};
dateFns.addMonths = function() {};
dateFns.addQuarters = function() {};
dateFns.addSeconds = function() {};
dateFns.addWeeks = function() {};
dateFns.addYears = function() {};
dateFns.areRangesOverlapping = function() {};
dateFns.closestIndexTo = function() {};
dateFns.closestTo = function() {};
dateFns.compareAsc = function() {};
dateFns.compareDesc = function() {};
dateFns.differenceInCalendarDays = function() {};
dateFns.differenceInCalendarISOWeeks = function() {};
dateFns.differenceInCalendarISOYears = function() {};
dateFns.differenceInCalendarMonths = function() {};
dateFns.differenceInCalendarQuarters = function() {};
dateFns.differenceInCalendarWeeks = function() {};
dateFns.differenceInCalendarYears = function() {};
dateFns.differenceInDays = function() {};
dateFns.differenceInHours = function() {};
dateFns.differenceInISOYears = function() {};
dateFns.differenceInMilliseconds = function() {};
dateFns.differenceInMinutes = function() {};
dateFns.differenceInMonths = function() {};
dateFns.differenceInQuarters = function() {};
dateFns.differenceInSeconds = function() {};
dateFns.differenceInWeeks = function() {};
dateFns.differenceInYears = function() {};
dateFns.distanceInWords = function() {};
dateFns.distanceInWordsStrict = function() {};
dateFns.distanceInWordsToNow = function() {};
dateFns.eachDay = function() {};
dateFns.endOfDay = function() {};
dateFns.endOfHour = function() {};
dateFns.endOfISOWeek = function() {};
dateFns.endOfISOYear = function() {};
dateFns.endOfMinute = function() {};
dateFns.endOfMonth = function() {};
dateFns.endOfQuarter = function() {};
dateFns.endOfSecond = function() {};
dateFns.endOfToday = function() {};
dateFns.endOfTomorrow = function() {};
dateFns.endOfWeek = function() {};
dateFns.endOfYear = function() {};
dateFns.endOfYesterday = function() {};
dateFns.format = function() {}; dateFns.format = function() {};
dateFns.getDate = function() {}; dateFns.formatDistanceToNow = function() {}
dateFns.getDay = function() {}; dateFns.locales = {};
dateFns.getDayOfYear = function() {};
dateFns.getDaysInMonth = function() {};
dateFns.getDaysInYear = function() {};
dateFns.getHours = function() {};
dateFns.getISODay = function() {};
dateFns.getISOWeek = function() {};
dateFns.getISOWeeksInYear = function() {};
dateFns.getISOYear = function() {};
dateFns.getMilliseconds = function() {};
dateFns.getMinutes = function() {};
dateFns.getMonth = function() {};
dateFns.getOverlappingDaysInRanges = function() {};
dateFns.getQuarter = function() {};
dateFns.getSeconds = function() {};
dateFns.getTime = function() {};
dateFns.getYear = function() {};
dateFns.isAfter = function() {};
dateFns.isBefore = function() {};
dateFns.isDate = function() {};
dateFns.isEqual = function() {};
dateFns.isFirstDayOfMonth = function() {};
dateFns.isFriday = function() {};
dateFns.isFuture = function() {};
dateFns.isLastDayOfMonth = function() {};
dateFns.isLeapYear = function() {};
dateFns.isMonday = function() {};
dateFns.isPast = function() {};
dateFns.isSameDay = function() {};
dateFns.isSameHour = function() {};
dateFns.isSameISOWeek = function() {};
dateFns.isSameISOYear = function() {};
dateFns.isSameMinute = function() {};
dateFns.isSameMonth = function() {};
dateFns.isSameQuarter = function() {};
dateFns.isSameSecond = function() {};
dateFns.isSameWeek = function() {};
dateFns.isSameYear = function() {};
dateFns.isSaturday = function() {};
dateFns.isSunday = function() {};
dateFns.isThisHour = function() {};
dateFns.isThisISOWeek = function() {};
dateFns.isThisISOYear = function() {};
dateFns.isThisMinute = function() {};
dateFns.isThisMonth = function() {};
dateFns.isThisQuarter = function() {};
dateFns.isThisSecond = function() {};
dateFns.isThisWeek = function() {};
dateFns.isThisYear = function() {};
dateFns.isThursday = function() {};
dateFns.isToday = function() {};
dateFns.isTomorrow = function() {};
dateFns.isTuesday = function() {};
dateFns.isValid = function() {};
dateFns.isWednesday = function() {};
dateFns.isWeekend = function() {};
dateFns.isWithinRange = function() {};
dateFns.isYesterday = function() {};
dateFns.lastDayOfISOWeek = function() {};
dateFns.lastDayOfISOYear = function() {};
dateFns.lastDayOfMonth = function() {};
dateFns.lastDayOfQuarter = function() {};
dateFns.lastDayOfWeek = function() {};
dateFns.lastDayOfYear = function() {};
dateFns.max = function() {};
dateFns.min = function() {};
dateFns.parse = function() {};
dateFns.setDate = function() {};
dateFns.setDay = function() {};
dateFns.setDayOfYear = function() {};
dateFns.setHours = function() {};
dateFns.setISODay = function() {};
dateFns.setISOWeek = function() {};
dateFns.setISOYear = function() {};
dateFns.setMilliseconds = function() {};
dateFns.setMinutes = function() {};
dateFns.setMonth = function() {};
dateFns.setQuarter = function() {};
dateFns.setSeconds = function() {};
dateFns.setYear = function() {};
dateFns.startOfDay = function() {};
dateFns.startOfHour = function() {};
dateFns.startOfISOWeek = function() {};
dateFns.startOfISOYear = function() {};
dateFns.startOfMinute = function() {};
dateFns.startOfMonth = function() {};
dateFns.startOfQuarter = function() {};
dateFns.startOfSecond = function() {};
dateFns.startOfToday = function() {};
dateFns.startOfTomorrow = function() {};
dateFns.startOfWeek = function() {};
dateFns.startOfYear = function() {};
dateFns.startOfYesterday = function() {};
dateFns.subDays = function() {};
dateFns.subHours = function() {};
dateFns.subISOYears = function() {};
dateFns.subMilliseconds = function() {};
dateFns.subMinutes = function() {};
dateFns.subMonths = function() {};
dateFns.subQuarters = function() {};
dateFns.subSeconds = function() {};
dateFns.subWeeks = function() {};
dateFns.subYears = function() {};

1602
frontend/vendor/package-lock.json generated vendored

File diff suppressed because it is too large Load diff

View file

@ -14,27 +14,27 @@
"author": "", "author": "",
"license": "MPL2", "license": "MPL2",
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.7.7", "@babel/cli": "^7.8.3",
"@babel/core": "^7.7.7", "@babel/core": "^7.8.3",
"@babel/plugin-proposal-class-properties": "^7.7.4", "@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-export-default-from": "^7.7.4", "@babel/plugin-proposal-export-default-from": "^7.8.3",
"@babel/preset-env": "^7.7.7", "@babel/preset-env": "^7.8.3",
"@babel/preset-react": "^7.7.4", "@babel/preset-react": "^7.8.3",
"rollup": "^1.27.13", "rollup": "^1.29.0",
"rollup-plugin-babel": "^4.3.2", "rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^10.1.0", "rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-builtins": "^2.1.2",
"rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^5.0.0", "rollup-plugin-node-resolve": "^5.0.0",
"rollup-plugin-replace": "^2.2.0", "rollup-plugin-replace": "^2.2.0",
"terser": "^4.4.3" "terser": "^4.6.3"
}, },
"dependencies": { "dependencies": {
"date-fns": "^1.30.1", "date-fns": "^2.9.0",
"randomcolor": "^0.5.4", "randomcolor": "^0.5.4",
"react-color": "^2.17.3", "react-color": "^2.18.0",
"react-dnd": "^9.5.1", "react-dnd": "^10.0.2",
"react-dnd-html5-backend": "^9.5.1", "react-dnd-html5-backend": "^10.0.2",
"snapsvg": "^0.5.1" "snapsvg": "^0.5.1"
} }
} }

View file

@ -5057,14 +5057,13 @@ var EditableInput = exports.EditableInput = function (_ref) {
} }
_createClass(EditableInput, [{ _createClass(EditableInput, [{
key: 'componentWillReceiveProps', key: 'componentDidUpdate',
value: function componentWillReceiveProps(nextProps) { value: function componentDidUpdate(prevProps, prevState) {
var input = this.input; if (this.props.value !== this.state.value && (prevProps.value !== this.props.value || prevState.value !== this.state.value)) {
if (nextProps.value !== this.state.value) { if (this.input === document.activeElement) {
if (input === document.activeElement) { this.setState({ blurValue: String(this.props.value).toUpperCase() });
this.setState({ blurValue: String(nextProps.value).toUpperCase() });
} else { } else {
this.setState({ value: String(nextProps.value).toUpperCase(), blurValue: !this.state.blurValue && String(nextProps.value).toUpperCase() }); this.setState({ value: String(this.props.value).toUpperCase(), blurValue: !this.state.blurValue && String(this.props.value).toUpperCase() });
} }
} }
} }
@ -5086,7 +5085,7 @@ var EditableInput = exports.EditableInput = function (_ref) {
}, { }, {
key: 'setUpdatedValue', key: 'setUpdatedValue',
value: function setUpdatedValue(value, e) { value: function setUpdatedValue(value, e) {
var onChangeValue = this.props.label !== null ? this.getValueObjectWithLabel(value) : value; var onChangeValue = this.props.label ? this.getValueObjectWithLabel(value) : value;
this.props.onChange && this.props.onChange(onChangeValue, e); this.props.onChange && this.props.onChange(onChangeValue, e);
var isPercentage = getIsPercentage(e.target.value); var isPercentage = getIsPercentage(e.target.value);
@ -5832,14 +5831,16 @@ var calculateChange = exports.calculateChange = function calculateChange(e, hsl,
left = 0; left = 0;
} else if (left > containerWidth) { } else if (left > containerWidth) {
left = containerWidth; left = containerWidth;
} else if (top < 0) { }
if (top < 0) {
top = 0; top = 0;
} else if (top > containerHeight) { } else if (top > containerHeight) {
top = containerHeight; top = containerHeight;
} }
var saturation = left * 100 / containerWidth; var saturation = left / containerWidth;
var bright = -(top * 100 / containerHeight) + 100; var bright = 1 - top / containerHeight;
return { return {
h: hsl.h, h: hsl.h,
@ -7403,11 +7404,6 @@ var ColorWrap = exports.ColorWrap = function ColorWrap(Picker) {
} }
_createClass(ColorPicker, [{ _createClass(ColorPicker, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
this.setState(_extends({}, _color2.default.toState(nextProps.color, this.state.oldHue)));
}
}, {
key: 'render', key: 'render',
value: function render() { value: function render() {
var optionalEvents = {}; var optionalEvents = {};
@ -7419,6 +7415,11 @@ var ColorWrap = exports.ColorWrap = function ColorWrap(Picker) {
onChange: this.handleChange onChange: this.handleChange
}, optionalEvents)); }, optionalEvents));
} }
}], [{
key: 'getDerivedStateFromProps',
value: function getDerivedStateFromProps(nextProps, state) {
return _extends({}, _color2.default.toState(nextProps.color, state.oldHue));
}
}]); }]);
return ColorPicker; return ColorPicker;

File diff suppressed because one or more lines are too long

View file

@ -1,60 +1,49 @@
(function(React){'use strict';var global$1 = (typeof global !== "undefined" ? global : (function(React){'use strict';var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self : typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});/** typeof window !== "undefined" ? window : {});/**
* Copyright (c) 2013-present, Facebook, Inc. * Use invariant() to assert state which your program assumes to be true.
* *
* This source code is licensed under the MIT license found in the * Provide sprintf-style format (only %s is supported) and arguments
* LICENSE file in the root directory of this source tree. * to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/ */
function invariant(condition, format) {
/** for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
* Use invariant() to assert state which your program assumes to be true. args[_key - 2] = arguments[_key];
* }
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function(condition, format, a, b, c, d, e, f) {
if (!condition) { if (!condition) {
var error; var error;
if (format === undefined) { if (format === undefined) {
error = new Error( error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
'Minified exception occurred; use the non-minified dev environment ' +
'for the full error message and additional helpful warnings.'
);
} else { } else {
var args = [a, b, c, d, e, f];
var argIndex = 0; var argIndex = 0;
error = new Error( error = new Error(format.replace(/%s/g, function () {
format.replace(/%s/g, function() { return args[argIndex++]; }) return args[argIndex++];
); }));
error.name = 'Invariant Violation'; error.name = 'Invariant Violation';
} }
error.framesToPop = 1; // we don't care about invariant's own frame error.framesToPop = 1; // we don't care about invariant's own frame
throw error; throw error;
} }
}; }var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;function shallowEqual(objA, objB, compare, compareContext) {
var compareResult = compare ? compare.call(compareContext, objA, objB) : void 0;
var browser = invariant;var useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;// if (compareResult !== void 0) {
return !!compareResult;
var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
if (ret !== void 0) {
return !!ret;
} }
if (objA === objB) { if (objA === objB) {
return true; return true;
} }
if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) { if (typeof objA !== 'object' || !objA || typeof objB !== 'object' || !objB) {
return false; return false;
} }
@ -65,9 +54,8 @@ var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
return false; return false;
} }
var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); // Test for A's keys different from B.
// Test for A's keys different from B.
for (var idx = 0; idx < keysA.length; idx++) { for (var idx = 0; idx < keysA.length; idx++) {
var key = keysA[idx]; var key = keysA[idx];
@ -77,16 +65,15 @@ var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
var valueA = objA[key]; var valueA = objA[key];
var valueB = objB[key]; var valueB = objB[key];
compareResult = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0; if (compareResult === false || compareResult === void 0 && valueA !== valueB) {
if (ret === false || (ret === void 0 && valueA !== valueB)) {
return false; return false;
} }
} }
return true; return true;
};function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } }function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
@ -111,7 +98,7 @@ function useCollector(monitor, collect, onUpdate) {
var updateCollected = React.useCallback(function () { var updateCollected = React.useCallback(function () {
var nextValue = collect(monitor); var nextValue = collect(monitor);
if (!shallowequal(collected, nextValue)) { if (!shallowEqual(collected, nextValue)) {
setCollected(nextValue); setCollected(nextValue);
if (onUpdate) { if (onUpdate) {
@ -342,7 +329,7 @@ function createStore(reducer, preloadedState, enhancer) {
} }
if (isDispatching) { if (isDispatching) {
throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.'); throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');
} }
var isSubscribed = true; var isSubscribed = true;
@ -354,13 +341,14 @@ function createStore(reducer, preloadedState, enhancer) {
} }
if (isDispatching) { if (isDispatching) {
throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.'); throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');
} }
isSubscribed = false; isSubscribed = false;
ensureCanMutateNextListeners(); ensureCanMutateNextListeners();
var index = nextListeners.indexOf(listener); var index = nextListeners.indexOf(listener);
nextListeners.splice(index, 1); nextListeners.splice(index, 1);
currentListeners = null;
}; };
} }
/** /**
@ -638,18 +626,18 @@ function createBeginDrag(manager) {
} }
function verifyInvariants(sourceIds, monitor, registry) { function verifyInvariants(sourceIds, monitor, registry) {
browser(!monitor.isDragging(), 'Cannot call beginDrag while dragging.'); invariant(!monitor.isDragging(), 'Cannot call beginDrag while dragging.');
sourceIds.forEach(function (sourceId) { sourceIds.forEach(function (sourceId) {
browser(registry.getSource(sourceId), 'Expected sourceIds to be registered.'); invariant(registry.getSource(sourceId), 'Expected sourceIds to be registered.');
}); });
} }
function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) { function verifyGetSourceClientOffsetIsFunction(getSourceClientOffset) {
browser(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.'); invariant(typeof getSourceClientOffset === 'function', 'When clientOffset is provided, getSourceClientOffset must be a function.');
} }
function verifyItemIsObject(item) { function verifyItemIsObject(item) {
browser(isObject(item), 'Item must be an object.'); invariant(isObject(item), 'Item must be an object.');
} }
function getDraggableSource(sourceIds, monitor) { function getDraggableSource(sourceIds, monitor) {
@ -705,18 +693,18 @@ function getDraggableSource(sourceIds, monitor) {
} }
function verifyTargetIdsIsArray(targetIdsArg) { function verifyTargetIdsIsArray(targetIdsArg) {
browser(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.'); invariant(Array.isArray(targetIdsArg), 'Expected targetIds to be an array.');
} }
function checkInvariants(targetIds, monitor, registry) { function checkInvariants(targetIds, monitor, registry) {
browser(monitor.isDragging(), 'Cannot call hover while not dragging.'); invariant(monitor.isDragging(), 'Cannot call hover while not dragging.');
browser(!monitor.didDrop(), 'Cannot call hover after drop.'); invariant(!monitor.didDrop(), 'Cannot call hover after drop.');
for (var i = 0; i < targetIds.length; i++) { for (var i = 0; i < targetIds.length; i++) {
var targetId = targetIds[i]; var targetId = targetIds[i];
browser(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.'); invariant(targetIds.lastIndexOf(targetId) === i, 'Expected targetIds to be unique in the passed array.');
var target = registry.getTarget(targetId); var target = registry.getTarget(targetId);
browser(target, 'Expected targetIds to be registered.'); invariant(target, 'Expected targetIds to be registered.');
} }
} }
@ -767,8 +755,8 @@ function createDrop(manager) {
} }
function verifyInvariants$1(monitor) { function verifyInvariants$1(monitor) {
browser(monitor.isDragging(), 'Cannot call drop while not dragging.'); invariant(monitor.isDragging(), 'Cannot call drop while not dragging.');
browser(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.'); invariant(!monitor.didDrop(), 'Cannot call drop twice during one drag operation.');
} }
function determineDropResult(targetId, index, registry, monitor) { function determineDropResult(targetId, index, registry, monitor) {
@ -784,7 +772,7 @@ function determineDropResult(targetId, index, registry, monitor) {
} }
function verifyDropResultType(dropResult) { function verifyDropResultType(dropResult) {
browser(typeof dropResult === 'undefined' || isObject(dropResult), 'Drop result must either be an object or undefined.'); invariant(typeof dropResult === 'undefined' || isObject(dropResult), 'Drop result must either be an object or undefined.');
} }
function getDroppableTargets(monitor) { function getDroppableTargets(monitor) {
@ -807,7 +795,7 @@ function getDroppableTargets(monitor) {
} }
function verifyIsDragging(monitor) { function verifyIsDragging(monitor) {
browser(monitor.isDragging(), 'Cannot call endDrag while not dragging.'); invariant(monitor.isDragging(), 'Cannot call endDrag while not dragging.');
}function createDragDropActions(manager) { }function createDragDropActions(manager) {
return { return {
beginDrag: createBeginDrag(manager), beginDrag: createBeginDrag(manager),
@ -1192,8 +1180,8 @@ function () {
handlerIds: undefined handlerIds: undefined
}; };
var handlerIds = options.handlerIds; var handlerIds = options.handlerIds;
browser(typeof listener === 'function', 'listener must be a function.'); invariant(typeof listener === 'function', 'listener must be a function.');
browser(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.'); invariant(typeof handlerIds === 'undefined' || Array.isArray(handlerIds), 'handlerIds, when specified, must be an array of strings.');
var prevStateId = this.store.getState().stateId; var prevStateId = this.store.getState().stateId;
var handleChange = function handleChange() { var handleChange = function handleChange() {
@ -1219,7 +1207,7 @@ function () {
value: function subscribeToOffsetChange(listener) { value: function subscribeToOffsetChange(listener) {
var _this2 = this; var _this2 = this;
browser(typeof listener === 'function', 'listener must be a function.'); invariant(typeof listener === 'function', 'listener must be a function.');
var previousState = this.store.getState().dragOffset; var previousState = this.store.getState().dragOffset;
var handleChange = function handleChange() { var handleChange = function handleChange() {
@ -1243,7 +1231,7 @@ function () {
} }
var source = this.registry.getSource(sourceId); var source = this.registry.getSource(sourceId);
browser(source, 'Expected to find a valid source.'); invariant(source, 'Expected to find a valid source.');
if (this.isDragging()) { if (this.isDragging()) {
return false; return false;
@ -1260,7 +1248,7 @@ function () {
} }
var target = this.registry.getTarget(targetId); var target = this.registry.getTarget(targetId);
browser(target, 'Expected to find a valid target.'); invariant(target, 'Expected to find a valid target.');
if (!this.isDragging() || this.didDrop()) { if (!this.isDragging() || this.didDrop()) {
return false; return false;
@ -1284,7 +1272,7 @@ function () {
} }
var source = this.registry.getSource(sourceId, true); var source = this.registry.getSource(sourceId, true);
browser(source, 'Expected to find a valid source.'); invariant(source, 'Expected to find a valid source.');
if (!this.isDragging() || !this.isSourcePublic()) { if (!this.isDragging() || !this.isSourcePublic()) {
return false; return false;
@ -1401,7 +1389,30 @@ function () {
}]); }]);
return DragDropMonitorImpl; return DragDropMonitorImpl;
}();var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};// Use the fastest means possible to execute a task in its own turn, with }();var nextUniqueId = 0;
function getNextUniqueId() {
return nextUniqueId++;
}function _typeof$1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
function validateSourceContract(source) {
invariant(typeof source.canDrag === 'function', 'Expected canDrag to be a function.');
invariant(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.');
invariant(typeof source.endDrag === 'function', 'Expected endDrag to be a function.');
}
function validateTargetContract(target) {
invariant(typeof target.canDrop === 'function', 'Expected canDrop to be a function.');
invariant(typeof target.hover === 'function', 'Expected hover to be a function.');
invariant(typeof target.drop === 'function', 'Expected beginDrag to be a function.');
}
function validateType(type, allowArray) {
if (allowArray && Array.isArray(type)) {
type.forEach(function (t) {
return validateType(t, false);
});
return;
}
invariant(typeof type === 'string' || _typeof$1(type) === 'symbol', allowArray ? 'Type can only be a string, a symbol, or an array of either.' : 'Type can only be a string or a symbol.');
}// Use the fastest means possible to execute a task in its own turn, with
// priority over other events including IO, animation, reflow, and redraw // priority over other events including IO, animation, reflow, and redraw
// events in browsers. // events in browsers.
// //
@ -1411,75 +1422,72 @@ function () {
// soon as possible, but if you use `rawAsap` directly, you are responsible to // soon as possible, but if you use `rawAsap` directly, you are responsible to
// either ensure that no exceptions are thrown from your task, or to manually // either ensure that no exceptions are thrown from your task, or to manually
// call `rawAsap.requestFlush` if an exception is thrown. // call `rawAsap.requestFlush` if an exception is thrown.
var browserRaw = rawAsap;
function rawAsap(task) { function rawAsap(task) {
if (!queue.length) { if (!queue.length) {
requestFlush(); requestFlush();
} } // Equivalent to push, but avoids a function call.
// Equivalent to push, but avoids a function call.
queue[queue.length] = task;
}
var queue = [];
// `requestFlush` is an implementation-specific method that attempts to kick queue[queue.length] = task;
}
var queue = []; // Once a flush has been requested, no further calls to `requestFlush` are
// off a `flush` event as quickly as possible. `flush` will attempt to exhaust // off a `flush` event as quickly as possible. `flush` will attempt to exhaust
// the event queue before yielding to the browser's own event loop. // the event queue before yielding to the browser's own event loop.
var requestFlush;
// The position of the next task to execute in the task queue. This is var requestFlush; // The position of the next task to execute in the task queue. This is
// preserved between calls to `flush` so that it can be resumed if // preserved between calls to `flush` so that it can be resumed if
// a task throws an exception. // a task throws an exception.
var index = 0;
// If a task schedules additional tasks recursively, the task queue can grow var index = 0; // If a task schedules additional tasks recursively, the task queue can grow
// unbounded. To prevent memory exhaustion, the task queue will periodically // unbounded. To prevent memory exhaustion, the task queue will periodically
// truncate already-completed tasks. // truncate already-completed tasks.
var capacity = 1024;
// The flush function processes all tasks that have been scheduled with var capacity = 1024; // The flush function processes all tasks that have been scheduled with
// `rawAsap` unless and until one of those tasks throws an exception. // `rawAsap` unless and until one of those tasks throws an exception.
// If a task throws an exception, `flush` ensures that its state will remain // If a task throws an exception, `flush` ensures that its state will remain
// consistent and will resume where it left off when called again. // consistent and will resume where it left off when called again.
// However, `flush` does not make any arrangements to be called again if an // However, `flush` does not make any arrangements to be called again if an
// exception is thrown. // exception is thrown.
function flush() {
while (index < queue.length) {
var currentIndex = index;
// Advance the index before calling the task. This ensures that we will
// begin flushing on the next task the task throws an error.
index = index + 1;
queue[currentIndex].call();
// Prevent leaking memory for long chains of recursive calls to `asap`.
// If we call `asap` within tasks scheduled by `asap`, the queue will
// grow, but to avoid an O(n) walk for every task we execute, we don't
// shift tasks off the queue after they have been executed.
// Instead, we periodically shift 1024 tasks off the queue.
if (index > capacity) {
// Manually shift all values starting at the index back to the
// beginning of the queue.
for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
queue[scan] = queue[scan + index];
}
queue.length -= index;
index = 0;
}
}
queue.length = 0;
index = 0;
}
// `requestFlush` is implemented using a strategy based on data collected from function flush() {
while (index < queue.length) {
var currentIndex = index; // Advance the index before calling the task. This ensures that we will
// begin flushing on the next task the task throws an error.
index = index + 1;
queue[currentIndex].call(); // Prevent leaking memory for long chains of recursive calls to `asap`.
// If we call `asap` within tasks scheduled by `asap`, the queue will
// grow, but to avoid an O(n) walk for every task we execute, we don't
// shift tasks off the queue after they have been executed.
// Instead, we periodically shift 1024 tasks off the queue.
if (index > capacity) {
// Manually shift all values starting at the index back to the
// beginning of the queue.
for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) {
queue[scan] = queue[scan + index];
}
queue.length -= index;
index = 0;
}
}
queue.length = 0;
index = 0;
} // `requestFlush` is implemented using a strategy based on data collected from
// every available SauceLabs Selenium web driver worker at time of writing. // every available SauceLabs Selenium web driver worker at time of writing.
// https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593 // https://docs.google.com/spreadsheets/d/1mG-5UYGup5qxGdEMWkhP6BWCz053NUb2E1QoUTU16uA/edit#gid=783724593
// Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that // Safari 6 and 6.1 for desktop, iPad, and iPhone are the only browsers that
// have WebKitMutationObserver but not un-prefixed MutationObserver. // have WebKitMutationObserver but not un-prefixed MutationObserver.
// Must use `global` or `self` instead of `window` to work in both frames and web // Must use `global` or `self` instead of `window` to work in both frames and web
// workers. `global` is a provision of Browserify, Mr, Mrs, or Mop. // workers. `global` is a provision of Browserify, Mr, Mrs, or Mop.
/* globals self */ /* globals self */
var scope = typeof commonjsGlobal !== "undefined" ? commonjsGlobal : self;
var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver;
// MutationObservers are desirable because they have high priority and work
var scope = typeof global$1 !== 'undefined' ? global$1 : self;
var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObserver; // MutationObservers are desirable because they have high priority and work
// reliably everywhere they are implemented. // reliably everywhere they are implemented.
// They are implemented in all modern browsers. // They are implemented in all modern browsers.
// //
@ -1490,68 +1498,62 @@ var BrowserMutationObserver = scope.MutationObserver || scope.WebKitMutationObse
// - iPad Safari 6-7.1 // - iPad Safari 6-7.1
// - iPhone Safari 7-7.1 // - iPhone Safari 7-7.1
// - Safari 6-7 // - Safari 6-7
if (typeof BrowserMutationObserver === "function") {
requestFlush = makeRequestCallFromMutationObserver(flush);
// MessageChannels are desirable because they give direct access to the HTML if (typeof BrowserMutationObserver === 'function') {
// task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera requestFlush = makeRequestCallFromMutationObserver(flush); // MessageChannels are desirable because they give direct access to the HTML
// 11-12, and in web workers in many engines. // task queue, are implemented in Internet Explorer 10, Safari 5.0-1, and Opera
// Although message channels yield to any queued rendering and IO tasks, they // 11-12, and in web workers in many engines.
// would be better than imposing the 4ms delay of timers. // Although message channels yield to any queued rendering and IO tasks, they
// However, they do not work reliably in Internet Explorer or Safari. // would be better than imposing the 4ms delay of timers.
// However, they do not work reliably in Internet Explorer or Safari.
// Internet Explorer 10 is the only browser that has setImmediate but does // Internet Explorer 10 is the only browser that has setImmediate but does
// not have MutationObservers. // not have MutationObservers.
// Although setImmediate yields to the browser's renderer, it would be // Although setImmediate yields to the browser's renderer, it would be
// preferrable to falling back to setTimeout since it does not have // preferrable to falling back to setTimeout since it does not have
// the minimum 4ms penalty. // the minimum 4ms penalty.
// Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and // Unfortunately there appears to be a bug in Internet Explorer 10 Mobile (and
// Desktop to a lesser extent) that renders both setImmediate and // Desktop to a lesser extent) that renders both setImmediate and
// MessageChannel useless for the purposes of ASAP. // MessageChannel useless for the purposes of ASAP.
// https://github.com/kriskowal/q/issues/396 // https://github.com/kriskowal/q/issues/396
// Timers are implemented universally.
// Timers are implemented universally. // We fall back to timers in workers in most engines, and in foreground
// We fall back to timers in workers in most engines, and in foreground // contexts in the following browsers.
// contexts in the following browsers. // However, note that even this simple case requires nuances to operate in a
// However, note that even this simple case requires nuances to operate in a // broad spectrum of browsers.
// broad spectrum of browsers. //
// // - Firefox 3-13
// - Firefox 3-13 // - Internet Explorer 6-9
// - Internet Explorer 6-9 // - iPad Safari 4.3
// - iPad Safari 4.3 // - Lynx 2.8.7
// - Lynx 2.8.7
} else { } else {
requestFlush = makeRequestCallFromTimer(flush); requestFlush = makeRequestCallFromTimer(flush);
} } // `requestFlush` requests that the high priority event queue be flushed as
// `requestFlush` requests that the high priority event queue be flushed as
// soon as possible. // soon as possible.
// This is useful to prevent an error thrown in a task from stalling the event // This is useful to prevent an error thrown in a task from stalling the event
// queue if the exception handled by Node.jss // queue if the exception handled by Node.jss
// `process.on("uncaughtException")` or by a domain. // `process.on("uncaughtException")` or by a domain.
rawAsap.requestFlush = requestFlush;
// To request a high priority event, we induce a mutation observer by toggling
rawAsap.requestFlush = requestFlush; // To request a high priority event, we induce a mutation observer by toggling
// the text of a text node between "1" and "-1". // the text of a text node between "1" and "-1".
function makeRequestCallFromMutationObserver(callback) {
var toggle = 1;
var observer = new BrowserMutationObserver(callback);
var node = document.createTextNode("");
observer.observe(node, {characterData: true});
return function requestCall() {
toggle = -toggle;
node.data = toggle;
};
}
// The message channel technique was discovered by Malte Ubl and was the function makeRequestCallFromMutationObserver(callback) {
var toggle = 1;
var observer = new BrowserMutationObserver(callback);
var node = document.createTextNode('');
observer.observe(node, {
characterData: true
});
return function requestCall() {
toggle = -toggle;
node.data = toggle;
};
} // The message channel technique was discovered by Malte Ubl and was the
// original foundation for this library. // original foundation for this library.
// http://www.nonblocking.io/2011/06/windownexttick.html // http://www.nonblocking.io/2011/06/windownexttick.html
// Safari 6.0.5 (at least) intermittently fails to create message ports on a // Safari 6.0.5 (at least) intermittently fails to create message ports on a
// page's first load. Thankfully, this version of Safari supports // page's first load. Thankfully, this version of Safari supports
// MutationObservers, so we don't need to fall back in that case. // MutationObservers, so we don't need to fall back in that case.
// function makeRequestCallFromMessageChannel(callback) { // function makeRequestCallFromMessageChannel(callback) {
// var channel = new MessageChannel(); // var channel = new MessageChannel();
// channel.port1.onmessage = callback; // channel.port1.onmessage = callback;
@ -1559,7 +1561,6 @@ function makeRequestCallFromMutationObserver(callback) {
// channel.port2.postMessage(0); // channel.port2.postMessage(0);
// }; // };
// } // }
// For reasons explained above, we are also unable to use `setImmediate` // For reasons explained above, we are also unable to use `setImmediate`
// under any circumstances. // under any circumstances.
// Even if we were, there is another bug in Internet Explorer 10. // Even if we were, there is another bug in Internet Explorer 10.
@ -1567,63 +1568,65 @@ function makeRequestCallFromMutationObserver(callback) {
// `setImmediate` must be called *by name* and therefore must be wrapped in a // `setImmediate` must be called *by name* and therefore must be wrapped in a
// closure. // closure.
// Never forget. // Never forget.
// function makeRequestCallFromSetImmediate(callback) { // function makeRequestCallFromSetImmediate(callback) {
// return function requestCall() { // return function requestCall() {
// setImmediate(callback); // setImmediate(callback);
// }; // };
// } // }
// Safari 6.0 has a problem where timers will get lost while the user is // Safari 6.0 has a problem where timers will get lost while the user is
// scrolling. This problem does not impact ASAP because Safari 6.0 supports // scrolling. This problem does not impact ASAP because Safari 6.0 supports
// mutation observers, so that implementation is used instead. // mutation observers, so that implementation is used instead.
// However, if we ever elect to use timers in Safari, the prevalent work-around // However, if we ever elect to use timers in Safari, the prevalent work-around
// is to add a scroll event listener that calls for a flush. // is to add a scroll event listener that calls for a flush.
// `setTimeout` does not call the passed callback if the delay is less than // `setTimeout` does not call the passed callback if the delay is less than
// approximately 7 in web workers in Firefox 8 through 18, and sometimes not // approximately 7 in web workers in Firefox 8 through 18, and sometimes not
// even then. // even then.
function makeRequestCallFromTimer(callback) { function makeRequestCallFromTimer(callback) {
return function requestCall() { return function requestCall() {
// We dispatch a timeout with a specified delay of 0 for engines that // We dispatch a timeout with a specified delay of 0 for engines that
// can reliably accommodate that request. This will usually be snapped // can reliably accommodate that request. This will usually be snapped
// to a 4 milisecond delay, but once we're flushing, there's no delay // to a 4 milisecond delay, but once we're flushing, there's no delay
// between events. // between events.
var timeoutHandle = setTimeout(handleTimer, 0); var timeoutHandle = setTimeout(handleTimer, 0); // However, since this timer gets frequently dropped in Firefox
// However, since this timer gets frequently dropped in Firefox // workers, we enlist an interval handle that will try to fire
// workers, we enlist an interval handle that will try to fire // an event 20 times per second until it succeeds.
// an event 20 times per second until it succeeds.
var intervalHandle = setInterval(handleTimer, 50);
function handleTimer() { var intervalHandle = setInterval(handleTimer, 50);
// Whichever timer succeeds will cancel both timers and
// execute the callback.
clearTimeout(timeoutHandle);
clearInterval(intervalHandle);
callback();
}
};
}
// This is for `asap.js` only. function handleTimer() {
// Whichever timer succeeds will cancel both timers and
// execute the callback.
clearTimeout(timeoutHandle);
clearInterval(intervalHandle);
callback();
}
};
} // This is for `asap.js` only.
// Its name will be periodically randomized to break any code that depends on // Its name will be periodically randomized to break any code that depends on
// its existence. // its existence.
rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer;// rawAsap provides everything we need except exception management.
rawAsap.makeRequestCallFromTimer = makeRequestCallFromTimer; // ASAP was originally a nextTick shim included in Q. This was factored out
// into this ASAP package. It was later adapted to RSVP which made further
// amendments. These decisions, particularly to marginalize MessageChannel and
// to capture the MutationObserver implementation in a closure, were integrated
// back into ASAP proper.
// https://github.com/tildeio/rsvp.js/blob/cddf7232546a9cf858524b75cde6f9edf72620a7/lib/rsvp/asap.js
// RawTasks are recycled to reduce GC churn. // RawTasks are recycled to reduce GC churn.
var freeTasks = [];
// We queue errors to ensure they are thrown in right order (FIFO). var freeTasks = []; // We queue errors to ensure they are thrown in right order (FIFO).
// Array-as-queue is good enough here, since we are just dealing with exceptions. // Array-as-queue is good enough here, since we are just dealing with exceptions.
var pendingErrors = []; var pendingErrors = [];
var requestErrorThrow = browserRaw.makeRequestCallFromTimer(throwFirstError); var requestErrorThrow = rawAsap.makeRequestCallFromTimer(throwFirstError);
function throwFirstError() { function throwFirstError() {
if (pendingErrors.length) { if (pendingErrors.length) {
throw pendingErrors.shift(); throw pendingErrors.shift();
} }
} }
/** /**
* Calls a task as soon as possible after returning, in its own event, with priority * Calls a task as soon as possible after returning, in its own event, with priority
* over other events like animation, reflow, and repaint. An error thrown from an * over other events like animation, reflow, and repaint. An error thrown from an
@ -1632,70 +1635,51 @@ function throwFirstError() {
* @param {{call}} task A callable object, typically a function that takes no * @param {{call}} task A callable object, typically a function that takes no
* arguments. * arguments.
*/ */
var browserAsap = asap;
function asap(task) { function asap(task) {
var rawTask; var rawTask;
if (freeTasks.length) {
rawTask = freeTasks.pop();
} else {
rawTask = new RawTask();
}
rawTask.task = task;
browserRaw(rawTask);
}
// We wrap tasks with recyclable task objects. A task object implements if (freeTasks.length) {
// `call`, just like a function. rawTask = freeTasks.pop();
function RawTask() { } else {
this.task = null; rawTask = new RawTask();
}
// The sole purpose of wrapping the task is to catch the exception and recycle
// the task object after its single use.
RawTask.prototype.call = function () {
try {
this.task.call();
} catch (error) {
if (asap.onerror) {
// This hook exists purely for testing purposes.
// Its name will be periodically randomized to break any code that
// depends on its existence.
asap.onerror(error);
} else {
// In a web browser, exceptions are not fatal. However, to avoid
// slowing down the queue of pending tasks, we rethrow the error in a
// lower priority turn.
pendingErrors.push(error);
requestErrorThrow();
}
} finally {
this.task = null;
freeTasks[freeTasks.length] = this;
}
};var nextUniqueId = 0;
function getNextUniqueId() {
return nextUniqueId++;
}function _typeof$1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
function validateSourceContract(source) {
browser(typeof source.canDrag === 'function', 'Expected canDrag to be a function.');
browser(typeof source.beginDrag === 'function', 'Expected beginDrag to be a function.');
browser(typeof source.endDrag === 'function', 'Expected endDrag to be a function.');
}
function validateTargetContract(target) {
browser(typeof target.canDrop === 'function', 'Expected canDrop to be a function.');
browser(typeof target.hover === 'function', 'Expected hover to be a function.');
browser(typeof target.drop === 'function', 'Expected beginDrag to be a function.');
}
function validateType(type, allowArray) {
if (allowArray && Array.isArray(type)) {
type.forEach(function (t) {
return validateType(t, false);
});
return;
} }
browser(typeof type === 'string' || _typeof$1(type) === 'symbol', allowArray ? 'Type can only be a string, a symbol, or an array of either.' : 'Type can only be a string or a symbol.'); rawTask.task = task;
}function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } rawAsap(rawTask);
} // We wrap tasks with recyclable task objects. A task object implements
// `call`, just like a function.
var RawTask =
/** @class */
function () {
function RawTask() {}
RawTask.prototype.call = function () {
try {
this.task.call();
} catch (error) {
if (asap.onerror) {
// This hook exists purely for testing purposes.
// Its name will be periodically randomized to break any code that
// depends on its existence.
asap.onerror(error);
} else {
// In a web browser, exceptions are not fatal. However, to avoid
// slowing down the queue of pending tasks, we rethrow the error in a
// lower priority turn.
pendingErrors.push(error);
requestErrorThrow();
}
} finally {
this.task = null;
freeTasks[freeTasks.length] = this;
}
};
return RawTask;
}();function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@ -1733,7 +1717,7 @@ function parseRoleFromHandlerId(handlerId) {
return HandlerRole.TARGET; return HandlerRole.TARGET;
default: default:
browser(false, "Cannot parse handler ID: ".concat(handlerId)); invariant(false, "Cannot parse handler ID: ".concat(handlerId));
} }
} }
@ -1798,7 +1782,7 @@ function () {
key: "getSource", key: "getSource",
value: function getSource(sourceId) { value: function getSource(sourceId) {
var includePinned = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var includePinned = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
browser(this.isSourceId(sourceId), 'Expected a valid source ID.'); invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');
var isPinned = includePinned && sourceId === this.pinnedSourceId; var isPinned = includePinned && sourceId === this.pinnedSourceId;
var source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId); var source = isPinned ? this.pinnedSource : this.dragSources.get(sourceId);
return source; return source;
@ -1806,19 +1790,19 @@ function () {
}, { }, {
key: "getTarget", key: "getTarget",
value: function getTarget(targetId) { value: function getTarget(targetId) {
browser(this.isTargetId(targetId), 'Expected a valid target ID.'); invariant(this.isTargetId(targetId), 'Expected a valid target ID.');
return this.dropTargets.get(targetId); return this.dropTargets.get(targetId);
} }
}, { }, {
key: "getSourceType", key: "getSourceType",
value: function getSourceType(sourceId) { value: function getSourceType(sourceId) {
browser(this.isSourceId(sourceId), 'Expected a valid source ID.'); invariant(this.isSourceId(sourceId), 'Expected a valid source ID.');
return this.types.get(sourceId); return this.types.get(sourceId);
} }
}, { }, {
key: "getTargetType", key: "getTargetType",
value: function getTargetType(targetId) { value: function getTargetType(targetId) {
browser(this.isTargetId(targetId), 'Expected a valid target ID.'); invariant(this.isTargetId(targetId), 'Expected a valid target ID.');
return this.types.get(targetId); return this.types.get(targetId);
} }
}, { }, {
@ -1838,9 +1822,9 @@ function () {
value: function removeSource$1(sourceId) { value: function removeSource$1(sourceId) {
var _this = this; var _this = this;
browser(this.getSource(sourceId), 'Expected an existing source.'); invariant(this.getSource(sourceId), 'Expected an existing source.');
this.store.dispatch(removeSource(sourceId)); this.store.dispatch(removeSource(sourceId));
browserAsap(function () { asap(function () {
_this.dragSources.delete(sourceId); _this.dragSources.delete(sourceId);
_this.types.delete(sourceId); _this.types.delete(sourceId);
@ -1849,7 +1833,7 @@ function () {
}, { }, {
key: "removeTarget", key: "removeTarget",
value: function removeTarget$1(targetId) { value: function removeTarget$1(targetId) {
browser(this.getTarget(targetId), 'Expected an existing target.'); invariant(this.getTarget(targetId), 'Expected an existing target.');
this.store.dispatch(removeTarget(targetId)); this.store.dispatch(removeTarget(targetId));
this.dropTargets.delete(targetId); this.dropTargets.delete(targetId);
this.types.delete(targetId); this.types.delete(targetId);
@ -1858,14 +1842,14 @@ function () {
key: "pinSource", key: "pinSource",
value: function pinSource(sourceId) { value: function pinSource(sourceId) {
var source = this.getSource(sourceId); var source = this.getSource(sourceId);
browser(source, 'Expected an existing source.'); invariant(source, 'Expected an existing source.');
this.pinnedSourceId = sourceId; this.pinnedSourceId = sourceId;
this.pinnedSource = source; this.pinnedSource = source;
} }
}, { }, {
key: "unpinSource", key: "unpinSource",
value: function unpinSource() { value: function unpinSource() {
browser(this.pinnedSource, 'No source is pinned at the time.'); invariant(this.pinnedSource, 'No source is pinned at the time.');
this.pinnedSourceId = null; this.pinnedSourceId = null;
this.pinnedSource = null; this.pinnedSource = null;
} }
@ -2022,7 +2006,7 @@ function useDragDropManager() {
var _useContext = React.useContext(DndContext), var _useContext = React.useContext(DndContext),
dragDropManager = _useContext.dragDropManager; dragDropManager = _useContext.dragDropManager;
browser(dragDropManager != null, 'Expected drag drop context'); invariant(dragDropManager != null, 'Expected drag drop context');
return dragDropManager; return dragDropManager;
}function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } }function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -2054,7 +2038,7 @@ function () {
}, { }, {
key: "canDrag", key: "canDrag",
value: function canDrag() { value: function canDrag() {
browser(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor'); invariant(!isCallingCanDrag, 'You may not call monitor.canDrag() inside your canDrag() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
try { try {
isCallingCanDrag = true; isCallingCanDrag = true;
@ -2070,7 +2054,7 @@ function () {
return false; return false;
} }
browser(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor'); invariant(!isCallingIsDragging, 'You may not call monitor.isDragging() inside your isDragging() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor');
try { try {
isCallingIsDragging = true; isCallingIsDragging = true;
@ -2182,7 +2166,7 @@ function () {
function cloneWithRef(element, newRef) { function cloneWithRef(element, newRef) {
var previousRef = element.ref; var previousRef = element.ref;
browser(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' + 'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' + 'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute'); invariant(typeof previousRef !== 'string', 'Cannot connect React DnD to an element with an existing string ref. ' + 'Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. ' + 'Read more: https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute');
if (!previousRef) { if (!previousRef) {
// When there is no ref on the element, use the new ref directly // When there is no ref on the element, use the new ref directly
@ -2391,12 +2375,12 @@ function () {
}, { }, {
key: "didDragSourceOptionsChange", key: "didDragSourceOptionsChange",
value: function didDragSourceOptionsChange() { value: function didDragSourceOptionsChange() {
return !shallowequal(this.lastConnectedDragSourceOptions, this.dragSourceOptions); return !shallowEqual(this.lastConnectedDragSourceOptions, this.dragSourceOptions);
} }
}, { }, {
key: "didDragPreviewOptionsChange", key: "didDragPreviewOptionsChange",
value: function didDragPreviewOptionsChange() { value: function didDragPreviewOptionsChange() {
return !shallowequal(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions); return !shallowEqual(this.lastConnectedDragPreviewOptions, this.dragPreviewOptions);
} }
}, { }, {
key: "disconnectDragSource", key: "disconnectDragSource",
@ -2492,7 +2476,7 @@ function useDragHandler(spec, monitor, connector) {
if (begin) { if (begin) {
var beginResult = begin(monitor); var beginResult = begin(monitor);
browser(beginResult == null || _typeof$3(beginResult) === 'object', 'dragSpec.begin() must either return an object, undefined, or null'); invariant(beginResult == null || _typeof$3(beginResult) === 'object', 'dragSpec.begin() must either return an object, undefined, or null');
return beginResult || item || {}; return beginResult || item || {};
} }
@ -2548,8 +2532,8 @@ function useDrag(spec) {
var specRef = React.useRef(spec); var specRef = React.useRef(spec);
specRef.current = spec; // TODO: wire options into createSourceConnector specRef.current = spec; // TODO: wire options into createSourceConnector
browser(spec.item != null, 'item must be defined'); invariant(spec.item != null, 'item must be defined');
browser(spec.item.type != null, 'item type must be defined'); invariant(spec.item.type != null, 'item type must be defined');
var _useDragSourceMonitor = useDragSourceMonitor(), var _useDragSourceMonitor = useDragSourceMonitor(),
_useDragSourceMonitor2 = _slicedToArray$4(_useDragSourceMonitor, 2), _useDragSourceMonitor2 = _slicedToArray$4(_useDragSourceMonitor, 2),
@ -2666,7 +2650,7 @@ function () {
}, { }, {
key: "didOptionsChange", key: "didOptionsChange",
value: function didOptionsChange() { value: function didOptionsChange() {
return !shallowequal(this.lastConnectedDropTargetOptions, this.dropTargetOptions); return !shallowEqual(this.lastConnectedDropTargetOptions, this.dropTargetOptions);
} }
}, { }, {
key: "disconnectDropTarget", key: "disconnectDropTarget",
@ -2744,7 +2728,7 @@ function () {
return false; return false;
} }
browser(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor'); invariant(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');
try { try {
isCallingCanDrop = true; isCallingCanDrop = true;
@ -2876,7 +2860,7 @@ function _arrayWithHoles$6(arr) { if (Array.isArray(arr)) return arr; }
function useDrop(spec) { function useDrop(spec) {
var specRef = React.useRef(spec); var specRef = React.useRef(spec);
specRef.current = spec; specRef.current = spec;
browser(spec.accept != null, 'accept must be defined'); invariant(spec.accept != null, 'accept must be defined');
var _useDropTargetMonitor = useDropTargetMonitor(), var _useDropTargetMonitor = useDropTargetMonitor(),
_useDropTargetMonitor2 = _slicedToArray$6(_useDropTargetMonitor, 2), _useDropTargetMonitor2 = _slicedToArray$6(_useDropTargetMonitor, 2),
@ -4079,7 +4063,7 @@ function () {
}]); }]);
return HTML5Backend; return HTML5Backend;
}();var createHTML5Backend = function createHTML5Backend(manager, context) { }();var createBackend = function createBackend(manager, context) {
return new HTML5Backend(manager, context); return new HTML5Backend(manager, context);
};if (typeof self !== "undefined") { };if (typeof self !== "undefined") {
init(self); init(self);
@ -4096,6 +4080,6 @@ function init(g) {
useDrag, useDrag,
useDrop, useDrop,
DndProvider, DndProvider,
HTML5Backend: createHTML5Backend HTML5Backend: createBackend
}; };
}}(React)); }}(React));

File diff suppressed because one or more lines are too long