@opengeoweb/shared 8.3.0 → 8.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.esm.js +710 -1132
  2. package/package.json +5 -5
package/index.esm.js CHANGED
@@ -86,7 +86,7 @@ var StatusTag = function StatusTag(_a) {
86
86
  }, content));
87
87
  };
88
88
 
89
- function _iterableToArrayLimit$1(r, l) {
89
+ function _iterableToArrayLimit(r, l) {
90
90
  var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
91
91
  if (null != t) {
92
92
  var e,
@@ -113,30 +113,30 @@ function _iterableToArrayLimit$1(r, l) {
113
113
  return a;
114
114
  }
115
115
  }
116
- function _classCallCheck$1(instance, Constructor) {
116
+ function _classCallCheck(instance, Constructor) {
117
117
  if (!(instance instanceof Constructor)) {
118
118
  throw new TypeError("Cannot call a class as a function");
119
119
  }
120
120
  }
121
- function _defineProperties$1(target, props) {
121
+ function _defineProperties(target, props) {
122
122
  for (var i = 0; i < props.length; i++) {
123
123
  var descriptor = props[i];
124
124
  descriptor.enumerable = descriptor.enumerable || false;
125
125
  descriptor.configurable = true;
126
126
  if ("value" in descriptor) descriptor.writable = true;
127
- Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
127
+ Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
128
128
  }
129
129
  }
130
- function _createClass$1(Constructor, protoProps, staticProps) {
131
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
132
- if (staticProps) _defineProperties$1(Constructor, staticProps);
130
+ function _createClass(Constructor, protoProps, staticProps) {
131
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
132
+ if (staticProps) _defineProperties(Constructor, staticProps);
133
133
  Object.defineProperty(Constructor, "prototype", {
134
134
  writable: false
135
135
  });
136
136
  return Constructor;
137
137
  }
138
- function _defineProperty$3(obj, key, value) {
139
- key = _toPropertyKey$1(key);
138
+ function _defineProperty$2(obj, key, value) {
139
+ key = _toPropertyKey$2(key);
140
140
  if (key in obj) {
141
141
  Object.defineProperty(obj, key, {
142
142
  value: value,
@@ -149,7 +149,7 @@ function _defineProperty$3(obj, key, value) {
149
149
  }
150
150
  return obj;
151
151
  }
152
- function _inherits$1(subClass, superClass) {
152
+ function _inherits(subClass, superClass) {
153
153
  if (typeof superClass !== "function" && superClass !== null) {
154
154
  throw new TypeError("Super expression must either be null or a function");
155
155
  }
@@ -163,22 +163,22 @@ function _inherits$1(subClass, superClass) {
163
163
  Object.defineProperty(subClass, "prototype", {
164
164
  writable: false
165
165
  });
166
- if (superClass) _setPrototypeOf$1(subClass, superClass);
166
+ if (superClass) _setPrototypeOf(subClass, superClass);
167
167
  }
168
- function _getPrototypeOf$1(o) {
169
- _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
168
+ function _getPrototypeOf(o) {
169
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
170
170
  return o.__proto__ || Object.getPrototypeOf(o);
171
171
  };
172
- return _getPrototypeOf$1(o);
172
+ return _getPrototypeOf(o);
173
173
  }
174
- function _setPrototypeOf$1(o, p) {
175
- _setPrototypeOf$1 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
174
+ function _setPrototypeOf(o, p) {
175
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
176
176
  o.__proto__ = p;
177
177
  return o;
178
178
  };
179
- return _setPrototypeOf$1(o, p);
179
+ return _setPrototypeOf(o, p);
180
180
  }
181
- function _isNativeReflectConstruct$1() {
181
+ function _isNativeReflectConstruct() {
182
182
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
183
183
  if (Reflect.construct.sham) return false;
184
184
  if (typeof Proxy === "function") return true;
@@ -189,61 +189,61 @@ function _isNativeReflectConstruct$1() {
189
189
  return false;
190
190
  }
191
191
  }
192
- function _assertThisInitialized$1(self) {
192
+ function _assertThisInitialized(self) {
193
193
  if (self === void 0) {
194
194
  throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
195
195
  }
196
196
  return self;
197
197
  }
198
- function _possibleConstructorReturn$1(self, call) {
198
+ function _possibleConstructorReturn(self, call) {
199
199
  if (call && (typeof call === "object" || typeof call === "function")) {
200
200
  return call;
201
201
  } else if (call !== void 0) {
202
202
  throw new TypeError("Derived constructors may only return object or undefined");
203
203
  }
204
- return _assertThisInitialized$1(self);
204
+ return _assertThisInitialized(self);
205
205
  }
206
- function _createSuper$1(Derived) {
207
- var hasNativeReflectConstruct = _isNativeReflectConstruct$1();
206
+ function _createSuper(Derived) {
207
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
208
208
  return function _createSuperInternal() {
209
- var Super = _getPrototypeOf$1(Derived),
209
+ var Super = _getPrototypeOf(Derived),
210
210
  result;
211
211
  if (hasNativeReflectConstruct) {
212
- var NewTarget = _getPrototypeOf$1(this).constructor;
212
+ var NewTarget = _getPrototypeOf(this).constructor;
213
213
  result = Reflect.construct(Super, arguments, NewTarget);
214
214
  } else {
215
215
  result = Super.apply(this, arguments);
216
216
  }
217
- return _possibleConstructorReturn$1(this, result);
217
+ return _possibleConstructorReturn(this, result);
218
218
  };
219
219
  }
220
- function _slicedToArray$1(arr, i) {
221
- return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
220
+ function _slicedToArray(arr, i) {
221
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
222
222
  }
223
223
  function _toArray(arr) {
224
- return _arrayWithHoles$1(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableRest$1();
224
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
225
225
  }
226
226
  function _toConsumableArray$1(arr) {
227
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread();
227
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
228
228
  }
229
229
  function _arrayWithoutHoles(arr) {
230
- if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
230
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
231
231
  }
232
- function _arrayWithHoles$1(arr) {
232
+ function _arrayWithHoles(arr) {
233
233
  if (Array.isArray(arr)) return arr;
234
234
  }
235
235
  function _iterableToArray(iter) {
236
236
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
237
237
  }
238
- function _unsupportedIterableToArray$1(o, minLen) {
238
+ function _unsupportedIterableToArray(o, minLen) {
239
239
  if (!o) return;
240
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
240
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
241
241
  var n = Object.prototype.toString.call(o).slice(8, -1);
242
242
  if (n === "Object" && o.constructor) n = o.constructor.name;
243
243
  if (n === "Map" || n === "Set") return Array.from(o);
244
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
244
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
245
245
  }
246
- function _arrayLikeToArray$1(arr, len) {
246
+ function _arrayLikeToArray(arr, len) {
247
247
  if (len == null || len > arr.length) len = arr.length;
248
248
  for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
249
249
  return arr2;
@@ -251,10 +251,10 @@ function _arrayLikeToArray$1(arr, len) {
251
251
  function _nonIterableSpread() {
252
252
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
253
253
  }
254
- function _nonIterableRest$1() {
254
+ function _nonIterableRest() {
255
255
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
256
256
  }
257
- function _toPrimitive$1(input, hint) {
257
+ function _toPrimitive$2(input, hint) {
258
258
  if (typeof input !== "object" || input === null) return input;
259
259
  var prim = input[Symbol.toPrimitive];
260
260
  if (prim !== undefined) {
@@ -264,19 +264,19 @@ function _toPrimitive$1(input, hint) {
264
264
  }
265
265
  return (hint === "string" ? String : Number)(input);
266
266
  }
267
- function _toPropertyKey$1(arg) {
268
- var key = _toPrimitive$1(arg, "string");
267
+ function _toPropertyKey$2(arg) {
268
+ var key = _toPrimitive$2(arg, "string");
269
269
  return typeof key === "symbol" ? key : String(key);
270
270
  }
271
271
 
272
272
  var defaultDelay = 1000;
273
273
  var useControlledTooltip = function useControlledTooltip() {
274
274
  var _React$useState = React$1.useState(false),
275
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
275
+ _React$useState2 = _slicedToArray(_React$useState, 2),
276
276
  tooltipOpen = _React$useState2[0],
277
277
  setTooltipOpen = _React$useState2[1];
278
278
  var _React$useState3 = React$1.useState(false),
279
- _React$useState4 = _slicedToArray$1(_React$useState3, 2),
279
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
280
280
  delayedTooltip = _React$useState4[0],
281
281
  setDelayedTooltip = _React$useState4[1];
282
282
  React$1.useEffect(function () {
@@ -17940,7 +17940,7 @@ var useDialogActions = function useDialogActions(awaitingPromiseRef) {
17940
17940
  var _useIsMounted = useIsMounted(),
17941
17941
  isMounted = _useIsMounted.isMounted;
17942
17942
  var _React$useState = React$1.useState(defaultOptions),
17943
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
17943
+ _React$useState2 = _slicedToArray(_React$useState, 2),
17944
17944
  confirmationState = _React$useState2[0],
17945
17945
  setConfirmationState = _React$useState2[1];
17946
17946
  var openConfirmation = function openConfirmation(options) {
@@ -18074,7 +18074,7 @@ var AlertBanner = function AlertBanner(_ref) {
18074
18074
  _ref$actionButtonProp = _ref.actionButtonProps,
18075
18075
  actionButtonProps = _ref$actionButtonProp === void 0 ? undefined : _ref$actionButtonProp;
18076
18076
  var _React$useState = React$1.useState(true),
18077
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
18077
+ _React$useState2 = _slicedToArray(_React$useState, 2),
18078
18078
  isOpen = _React$useState2[0],
18079
18079
  setIsOpen = _React$useState2[1];
18080
18080
  if (!isOpen) {
@@ -18197,7 +18197,7 @@ var AppHeader = function AppHeader(_ref) {
18197
18197
  onClick = _ref.onClick;
18198
18198
  var theme = useTheme();
18199
18199
  var _React$useState = React__default.useState(false),
18200
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
18200
+ _React$useState2 = _slicedToArray(_React$useState, 2),
18201
18201
  isDrawerOpen = _React$useState2[0],
18202
18202
  toggleDrawer = _React$useState2[1];
18203
18203
  var onToggleDrawer = function onToggleDrawer(isOpen) {
@@ -18220,9 +18220,9 @@ var AppHeader = function AppHeader(_ref) {
18220
18220
  zIndex: 1000,
18221
18221
  display: 'flex',
18222
18222
  padding: '0 16px'
18223
- }, _defineProperty$3(_sx, theme.breakpoints.up('md'), {
18223
+ }, _defineProperty$2(_sx, theme.breakpoints.up('md'), {
18224
18224
  padding: '0 24px'
18225
- }), _defineProperty$3(_sx, theme.breakpoints.up('sm'), {
18225
+ }), _defineProperty$2(_sx, theme.breakpoints.up('sm'), {
18226
18226
  '.workspace-topbar': {
18227
18227
  marginLeft: 3,
18228
18228
  maxWidth: 260
@@ -19448,54 +19448,23 @@ shims.findInArray = findInArray;
19448
19448
  shims.int = int;
19449
19449
  shims.isFunction = isFunction$1;
19450
19450
  shims.isNum = isNum;
19451
-
19452
19451
  // @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
19453
- function findInArray(array
19454
- /*: Array<any> | TouchList*/
19455
- , callback
19456
- /*: Function*/
19457
- )
19458
- /*: any*/
19459
- {
19460
- for (var i = 0, length = array.length; i < length; i++) {
19452
+ function findInArray(array /*: Array<any> | TouchList*/, callback /*: Function*/) /*: any*/{
19453
+ for (let i = 0, length = array.length; i < length; i++) {
19461
19454
  if (callback.apply(callback, [array[i], i, array])) return array[i];
19462
19455
  }
19463
19456
  }
19464
-
19465
- function isFunction$1(func
19466
- /*: any*/
19467
- )
19468
- /*: boolean %checks*/
19469
- {
19457
+ function isFunction$1(func /*: any*/) /*: boolean %checks*/{
19470
19458
  // $FlowIgnore[method-unbinding]
19471
19459
  return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
19472
19460
  }
19473
-
19474
- function isNum(num
19475
- /*: any*/
19476
- )
19477
- /*: boolean %checks*/
19478
- {
19461
+ function isNum(num /*: any*/) /*: boolean %checks*/{
19479
19462
  return typeof num === 'number' && !isNaN(num);
19480
19463
  }
19481
-
19482
- function int(a
19483
- /*: string*/
19484
- )
19485
- /*: number*/
19486
- {
19464
+ function int(a /*: string*/) /*: number*/{
19487
19465
  return parseInt(a, 10);
19488
19466
  }
19489
-
19490
- function dontSetMe(props
19491
- /*: Object*/
19492
- , propName
19493
- /*: string*/
19494
- , componentName
19495
- /*: string*/
19496
- )
19497
- /*: ?Error*/
19498
- {
19467
+ function dontSetMe(props /*: Object*/, propName /*: string*/, componentName /*: string*/) /*: ?Error*/{
19499
19468
  if (props[propName]) {
19500
19469
  return new Error("Invalid prop ".concat(propName, " passed to ").concat(componentName, " - do not set this, set it on the child."));
19501
19470
  }
@@ -19510,61 +19479,34 @@ getPrefix$1.browserPrefixToKey = browserPrefixToKey;
19510
19479
  getPrefix$1.browserPrefixToStyle = browserPrefixToStyle;
19511
19480
  getPrefix$1.default = void 0;
19512
19481
  getPrefix$1.getPrefix = getPrefix;
19513
- var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
19514
-
19515
- function getPrefix()
19516
- /*: string*/
19517
- {
19518
- var _window$document, _window$document$docu;
19519
-
19520
- var prop
19521
- /*: string*/
19522
- = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
19482
+ const prefixes = ['Moz', 'Webkit', 'O', 'ms'];
19483
+ function getPrefix() /*: string*/{
19484
+ var _window$document;
19485
+ let prop /*: string*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
19523
19486
  // Ensure we're running in an environment where there is actually a global
19524
19487
  // `window` obj
19525
- if (typeof window === 'undefined') return ''; // If we're in a pseudo-browser server-side environment, this access
19526
- // path may not exist, so bail out if it doesn't.
19488
+ if (typeof window === 'undefined') return '';
19527
19489
 
19528
- var style = (_window$document = window.document) === null || _window$document === void 0 ? void 0 : (_window$document$docu = _window$document.documentElement) === null || _window$document$docu === void 0 ? void 0 : _window$document$docu.style;
19490
+ // If we're in a pseudo-browser server-side environment, this access
19491
+ // path may not exist, so bail out if it doesn't.
19492
+ const style = (_window$document = window.document) === null || _window$document === void 0 || (_window$document = _window$document.documentElement) === null || _window$document === void 0 ? void 0 : _window$document.style;
19529
19493
  if (!style) return '';
19530
19494
  if (prop in style) return '';
19531
-
19532
- for (var i = 0; i < prefixes.length; i++) {
19495
+ for (let i = 0; i < prefixes.length; i++) {
19533
19496
  if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
19534
19497
  }
19535
-
19536
19498
  return '';
19537
19499
  }
19538
-
19539
- function browserPrefixToKey(prop
19540
- /*: string*/
19541
- , prefix
19542
- /*: string*/
19543
- )
19544
- /*: string*/
19545
- {
19500
+ function browserPrefixToKey(prop /*: string*/, prefix /*: string*/) /*: string*/{
19546
19501
  return prefix ? "".concat(prefix).concat(kebabToTitleCase(prop)) : prop;
19547
19502
  }
19548
-
19549
- function browserPrefixToStyle(prop
19550
- /*: string*/
19551
- , prefix
19552
- /*: string*/
19553
- )
19554
- /*: string*/
19555
- {
19503
+ function browserPrefixToStyle(prop /*: string*/, prefix /*: string*/) /*: string*/{
19556
19504
  return prefix ? "-".concat(prefix.toLowerCase(), "-").concat(prop) : prop;
19557
19505
  }
19558
-
19559
- function kebabToTitleCase(str
19560
- /*: string*/
19561
- )
19562
- /*: string*/
19563
- {
19564
- var out = '';
19565
- var shouldCapitalize = true;
19566
-
19567
- for (var i = 0; i < str.length; i++) {
19506
+ function kebabToTitleCase(str /*: string*/) /*: string*/{
19507
+ let out = '';
19508
+ let shouldCapitalize = true;
19509
+ for (let i = 0; i < str.length; i++) {
19568
19510
  if (shouldCapitalize) {
19569
19511
  out += str[i].toUpperCase();
19570
19512
  shouldCapitalize = false;
@@ -19574,20 +19516,13 @@ function kebabToTitleCase(str
19574
19516
  out += str[i];
19575
19517
  }
19576
19518
  }
19577
-
19578
19519
  return out;
19579
- } // Default export is the prefix itself, like 'Moz', 'Webkit', etc
19520
+ }
19521
+
19522
+ // Default export is the prefix itself, like 'Moz', 'Webkit', etc
19580
19523
  // Note that you may have to re-test for certain things; for instance, Chrome 50
19581
19524
  // can handle unprefixed `transform`, but not unprefixed `user-select`
19582
-
19583
-
19584
- var _default$1 = (getPrefix()
19585
- /*: string*/
19586
- );
19587
-
19588
- getPrefix$1.default = _default$1;
19589
-
19590
- function _typeof$2(obj) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$2(obj); }
19525
+ getPrefix$1.default = (getPrefix() /*: string*/);
19591
19526
 
19592
19527
  Object.defineProperty(domFns, "__esModule", {
19593
19528
  value: true
@@ -19610,83 +19545,46 @@ domFns.outerWidth = outerWidth;
19610
19545
  domFns.removeClassName = removeClassName;
19611
19546
  domFns.removeEvent = removeEvent;
19612
19547
  domFns.removeUserSelectStyles = removeUserSelectStyles;
19613
-
19614
19548
  var _shims$2 = shims;
19615
-
19616
19549
  var _getPrefix = _interopRequireWildcard$1(getPrefix$1);
19617
-
19618
- function _getRequireWildcardCache$1(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache$1 = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19619
-
19620
- function _interopRequireWildcard$1(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof$2(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$1(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19621
-
19622
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
19623
-
19624
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19625
-
19626
- function _defineProperty$2(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; }
19627
-
19628
- var matchesSelectorFunc = '';
19629
-
19630
- function matchesSelector(el
19631
- /*: Node*/
19632
- , selector
19633
- /*: string*/
19634
- )
19635
- /*: boolean*/
19636
- {
19550
+ function _getRequireWildcardCache$1(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache$1 = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19551
+ function _interopRequireWildcard$1(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache$1(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19552
+ /*:: import type {ControlPosition, PositionOffsetControlPosition, MouseTouchEvent} from './types';*/
19553
+ let matchesSelectorFunc = '';
19554
+ function matchesSelector(el /*: Node*/, selector /*: string*/) /*: boolean*/{
19637
19555
  if (!matchesSelectorFunc) {
19638
19556
  matchesSelectorFunc = (0, _shims$2.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
19639
19557
  // $FlowIgnore: Doesn't think elements are indexable
19640
19558
  return (0, _shims$2.isFunction)(el[method]);
19641
19559
  });
19642
- } // Might not be found entirely (not an Element?) - in that case, bail
19643
- // $FlowIgnore: Doesn't think elements are indexable
19644
-
19560
+ }
19645
19561
 
19646
- if (!(0, _shims$2.isFunction)(el[matchesSelectorFunc])) return false; // $FlowIgnore: Doesn't think elements are indexable
19562
+ // Might not be found entirely (not an Element?) - in that case, bail
19563
+ // $FlowIgnore: Doesn't think elements are indexable
19564
+ if (!(0, _shims$2.isFunction)(el[matchesSelectorFunc])) return false;
19647
19565
 
19566
+ // $FlowIgnore: Doesn't think elements are indexable
19648
19567
  return el[matchesSelectorFunc](selector);
19649
- } // Works up the tree to the draggable itself attempting to match selector.
19650
-
19651
-
19652
- function matchesSelectorAndParentsTo(el
19653
- /*: Node*/
19654
- , selector
19655
- /*: string*/
19656
- , baseNode
19657
- /*: Node*/
19658
- )
19659
- /*: boolean*/
19660
- {
19661
- var node = el;
19568
+ }
19662
19569
 
19570
+ // Works up the tree to the draggable itself attempting to match selector.
19571
+ function matchesSelectorAndParentsTo(el /*: Node*/, selector /*: string*/, baseNode /*: Node*/) /*: boolean*/{
19572
+ let node = el;
19663
19573
  do {
19664
19574
  if (matchesSelector(node, selector)) return true;
19665
19575
  if (node === baseNode) return false;
19576
+ // $FlowIgnore[incompatible-type]
19666
19577
  node = node.parentNode;
19667
19578
  } while (node);
19668
-
19669
19579
  return false;
19670
19580
  }
19671
-
19672
- function addEvent(el
19673
- /*: ?Node*/
19674
- , event
19675
- /*: string*/
19676
- , handler
19677
- /*: Function*/
19678
- , inputOptions
19679
- /*: Object*/
19680
- )
19681
- /*: void*/
19682
- {
19581
+ function addEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/, inputOptions /*: Object*/) /*: void*/{
19683
19582
  if (!el) return;
19684
-
19685
- var options = _objectSpread({
19686
- capture: true
19687
- }, inputOptions); // $FlowIgnore[method-unbinding]
19688
-
19689
-
19583
+ const options = {
19584
+ capture: true,
19585
+ ...inputOptions
19586
+ };
19587
+ // $FlowIgnore[method-unbinding]
19690
19588
  if (el.addEventListener) {
19691
19589
  el.addEventListener(event, handler, options);
19692
19590
  } else if (el.attachEvent) {
@@ -19696,25 +19594,13 @@ function addEvent(el
19696
19594
  el['on' + event] = handler;
19697
19595
  }
19698
19596
  }
19699
-
19700
- function removeEvent(el
19701
- /*: ?Node*/
19702
- , event
19703
- /*: string*/
19704
- , handler
19705
- /*: Function*/
19706
- , inputOptions
19707
- /*: Object*/
19708
- )
19709
- /*: void*/
19710
- {
19597
+ function removeEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/, inputOptions /*: Object*/) /*: void*/{
19711
19598
  if (!el) return;
19712
-
19713
- var options = _objectSpread({
19714
- capture: true
19715
- }, inputOptions); // $FlowIgnore[method-unbinding]
19716
-
19717
-
19599
+ const options = {
19600
+ capture: true,
19601
+ ...inputOptions
19602
+ };
19603
+ // $FlowIgnore[method-unbinding]
19718
19604
  if (el.removeEventListener) {
19719
19605
  el.removeEventListener(event, handler, options);
19720
19606
  } else if (el.detachEvent) {
@@ -19724,54 +19610,34 @@ function removeEvent(el
19724
19610
  el['on' + event] = null;
19725
19611
  }
19726
19612
  }
19727
-
19728
- function outerHeight(node
19729
- /*: HTMLElement*/
19730
- )
19731
- /*: number*/
19732
- {
19613
+ function outerHeight(node /*: HTMLElement*/) /*: number*/{
19733
19614
  // This is deliberately excluding margin for our calculations, since we are using
19734
19615
  // offsetTop which is including margin. See getBoundPosition
19735
- var height = node.clientHeight;
19736
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
19616
+ let height = node.clientHeight;
19617
+ const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
19737
19618
  height += (0, _shims$2.int)(computedStyle.borderTopWidth);
19738
19619
  height += (0, _shims$2.int)(computedStyle.borderBottomWidth);
19739
19620
  return height;
19740
19621
  }
19741
-
19742
- function outerWidth(node
19743
- /*: HTMLElement*/
19744
- )
19745
- /*: number*/
19746
- {
19622
+ function outerWidth(node /*: HTMLElement*/) /*: number*/{
19747
19623
  // This is deliberately excluding margin for our calculations, since we are using
19748
19624
  // offsetLeft which is including margin. See getBoundPosition
19749
- var width = node.clientWidth;
19750
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
19625
+ let width = node.clientWidth;
19626
+ const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
19751
19627
  width += (0, _shims$2.int)(computedStyle.borderLeftWidth);
19752
19628
  width += (0, _shims$2.int)(computedStyle.borderRightWidth);
19753
19629
  return width;
19754
19630
  }
19755
-
19756
- function innerHeight(node
19757
- /*: HTMLElement*/
19758
- )
19759
- /*: number*/
19760
- {
19761
- var height = node.clientHeight;
19762
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
19631
+ function innerHeight(node /*: HTMLElement*/) /*: number*/{
19632
+ let height = node.clientHeight;
19633
+ const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
19763
19634
  height -= (0, _shims$2.int)(computedStyle.paddingTop);
19764
19635
  height -= (0, _shims$2.int)(computedStyle.paddingBottom);
19765
19636
  return height;
19766
19637
  }
19767
-
19768
- function innerWidth(node
19769
- /*: HTMLElement*/
19770
- )
19771
- /*: number*/
19772
- {
19773
- var width = node.clientWidth;
19774
- var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
19638
+ function innerWidth(node /*: HTMLElement*/) /*: number*/{
19639
+ let width = node.clientWidth;
19640
+ const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
19775
19641
  width -= (0, _shims$2.int)(computedStyle.paddingLeft);
19776
19642
  width -= (0, _shims$2.int)(computedStyle.paddingRight);
19777
19643
  return width;
@@ -19779,106 +19645,59 @@ function innerWidth(node
19779
19645
  /*:: interface EventWithOffset {
19780
19646
  clientX: number, clientY: number
19781
19647
  }*/
19782
-
19783
-
19784
19648
  // Get from offsetParent
19785
- function offsetXYFromParent(evt
19786
- /*: EventWithOffset*/
19787
- , offsetParent
19788
- /*: HTMLElement*/
19789
- , scale
19790
- /*: number*/
19791
- )
19792
- /*: ControlPosition*/
19793
- {
19794
- var isBody = offsetParent === offsetParent.ownerDocument.body;
19795
- var offsetParentRect = isBody ? {
19649
+ function offsetXYFromParent(evt /*: EventWithOffset*/, offsetParent /*: HTMLElement*/, scale /*: number*/) /*: ControlPosition*/{
19650
+ const isBody = offsetParent === offsetParent.ownerDocument.body;
19651
+ const offsetParentRect = isBody ? {
19796
19652
  left: 0,
19797
19653
  top: 0
19798
19654
  } : offsetParent.getBoundingClientRect();
19799
- var x = (evt.clientX + offsetParent.scrollLeft - offsetParentRect.left) / scale;
19800
- var y = (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale;
19655
+ const x = (evt.clientX + offsetParent.scrollLeft - offsetParentRect.left) / scale;
19656
+ const y = (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale;
19801
19657
  return {
19802
- x: x,
19803
- y: y
19658
+ x,
19659
+ y
19804
19660
  };
19805
19661
  }
19806
-
19807
- function createCSSTransform(controlPos
19808
- /*: ControlPosition*/
19809
- , positionOffset
19810
- /*: PositionOffsetControlPosition*/
19811
- )
19812
- /*: Object*/
19813
- {
19814
- var translation = getTranslation(controlPos, positionOffset, 'px');
19815
- return _defineProperty$2({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix.default), translation);
19662
+ function createCSSTransform(controlPos /*: ControlPosition*/, positionOffset /*: PositionOffsetControlPosition*/) /*: Object*/{
19663
+ const translation = getTranslation(controlPos, positionOffset, 'px');
19664
+ return {
19665
+ [(0, _getPrefix.browserPrefixToKey)('transform', _getPrefix.default)]: translation
19666
+ };
19816
19667
  }
19817
-
19818
- function createSVGTransform(controlPos
19819
- /*: ControlPosition*/
19820
- , positionOffset
19821
- /*: PositionOffsetControlPosition*/
19822
- )
19823
- /*: string*/
19824
- {
19825
- var translation = getTranslation(controlPos, positionOffset, '');
19668
+ function createSVGTransform(controlPos /*: ControlPosition*/, positionOffset /*: PositionOffsetControlPosition*/) /*: string*/{
19669
+ const translation = getTranslation(controlPos, positionOffset, '');
19826
19670
  return translation;
19827
19671
  }
19828
-
19829
- function getTranslation(_ref2, positionOffset
19830
- /*: PositionOffsetControlPosition*/
19831
- , unitSuffix
19832
- /*: string*/
19833
- )
19834
- /*: string*/
19835
- {
19836
- var x = _ref2.x,
19837
- y = _ref2.y;
19838
- var translation = "translate(".concat(x).concat(unitSuffix, ",").concat(y).concat(unitSuffix, ")");
19839
-
19672
+ function getTranslation(_ref /*:: */, positionOffset /*: PositionOffsetControlPosition*/, unitSuffix /*: string*/) /*: string*/{
19673
+ let {
19674
+ x,
19675
+ y
19676
+ } /*: ControlPosition*/ = _ref /*: ControlPosition*/;
19677
+ let translation = "translate(".concat(x).concat(unitSuffix, ",").concat(y).concat(unitSuffix, ")");
19840
19678
  if (positionOffset) {
19841
- var defaultX = "".concat(typeof positionOffset.x === 'string' ? positionOffset.x : positionOffset.x + unitSuffix);
19842
- var defaultY = "".concat(typeof positionOffset.y === 'string' ? positionOffset.y : positionOffset.y + unitSuffix);
19679
+ const defaultX = "".concat(typeof positionOffset.x === 'string' ? positionOffset.x : positionOffset.x + unitSuffix);
19680
+ const defaultY = "".concat(typeof positionOffset.y === 'string' ? positionOffset.y : positionOffset.y + unitSuffix);
19843
19681
  translation = "translate(".concat(defaultX, ", ").concat(defaultY, ")") + translation;
19844
19682
  }
19845
-
19846
19683
  return translation;
19847
19684
  }
19848
-
19849
- function getTouch(e
19850
- /*: MouseTouchEvent*/
19851
- , identifier
19852
- /*: number*/
19853
- )
19854
- /*: ?{clientX: number, clientY: number}*/
19855
- {
19856
- return e.targetTouches && (0, _shims$2.findInArray)(e.targetTouches, function (t) {
19857
- return identifier === t.identifier;
19858
- }) || e.changedTouches && (0, _shims$2.findInArray)(e.changedTouches, function (t) {
19859
- return identifier === t.identifier;
19860
- });
19685
+ function getTouch(e /*: MouseTouchEvent*/, identifier /*: number*/) /*: ?{clientX: number, clientY: number}*/{
19686
+ return e.targetTouches && (0, _shims$2.findInArray)(e.targetTouches, t => identifier === t.identifier) || e.changedTouches && (0, _shims$2.findInArray)(e.changedTouches, t => identifier === t.identifier);
19861
19687
  }
19862
-
19863
- function getTouchIdentifier(e
19864
- /*: MouseTouchEvent*/
19865
- )
19866
- /*: ?number*/
19867
- {
19688
+ function getTouchIdentifier(e /*: MouseTouchEvent*/) /*: ?number*/{
19868
19689
  if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
19869
19690
  if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
19870
- } // User-select Hacks:
19691
+ }
19692
+
19693
+ // User-select Hacks:
19871
19694
  //
19872
19695
  // Useful for preventing blue highlights all over everything when dragging.
19873
- // Note we're passing `document` b/c we could be iframed
19874
-
19875
19696
 
19876
- function addUserSelectStyles(doc
19877
- /*: ?Document*/
19878
- ) {
19697
+ // Note we're passing `document` b/c we could be iframed
19698
+ function addUserSelectStyles(doc /*: ?Document*/) {
19879
19699
  if (!doc) return;
19880
- var styleEl = doc.getElementById('react-draggable-style-el');
19881
-
19700
+ let styleEl = doc.getElementById('react-draggable-style-el');
19882
19701
  if (!styleEl) {
19883
19702
  styleEl = doc.createElement('style');
19884
19703
  styleEl.type = 'text/css';
@@ -19887,39 +19706,29 @@ function addUserSelectStyles(doc
19887
19706
  styleEl.innerHTML += '.react-draggable-transparent-selection *::selection {all: inherit;}\n';
19888
19707
  doc.getElementsByTagName('head')[0].appendChild(styleEl);
19889
19708
  }
19890
-
19891
19709
  if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');
19892
19710
  }
19893
-
19894
- function removeUserSelectStyles(doc
19895
- /*: ?Document*/
19896
- ) {
19711
+ function removeUserSelectStyles(doc /*: ?Document*/) {
19897
19712
  if (!doc) return;
19898
-
19899
19713
  try {
19900
- if (doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection'); // $FlowIgnore: IE
19901
-
19714
+ if (doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection');
19715
+ // $FlowIgnore: IE
19902
19716
  if (doc.selection) {
19903
19717
  // $FlowIgnore: IE
19904
19718
  doc.selection.empty();
19905
19719
  } else {
19906
19720
  // Remove selection caused by scroll, unless it's a focused input
19907
19721
  // (we use doc.defaultView in case we're in an iframe)
19908
- var selection = (doc.defaultView || window).getSelection();
19909
-
19722
+ const selection = (doc.defaultView || window).getSelection();
19910
19723
  if (selection && selection.type !== 'Caret') {
19911
19724
  selection.removeAllRanges();
19912
19725
  }
19913
19726
  }
19914
- } catch (e) {// probably IE
19727
+ } catch (e) {
19728
+ // probably IE
19915
19729
  }
19916
19730
  }
19917
-
19918
- function addClassName(el
19919
- /*: HTMLElement*/
19920
- , className
19921
- /*: string*/
19922
- ) {
19731
+ function addClassName(el /*: HTMLElement*/, className /*: string*/) {
19923
19732
  if (el.classList) {
19924
19733
  el.classList.add(className);
19925
19734
  } else {
@@ -19928,12 +19737,7 @@ function addClassName(el
19928
19737
  }
19929
19738
  }
19930
19739
  }
19931
-
19932
- function removeClassName(el
19933
- /*: HTMLElement*/
19934
- , className
19935
- /*: string*/
19936
- ) {
19740
+ function removeClassName(el /*: HTMLElement*/, className /*: string*/) {
19937
19741
  if (el.classList) {
19938
19742
  el.classList.remove(className);
19939
19743
  } else {
@@ -19953,163 +19757,110 @@ positionFns.createDraggableData = createDraggableData;
19953
19757
  positionFns.getBoundPosition = getBoundPosition;
19954
19758
  positionFns.getControlPosition = getControlPosition;
19955
19759
  positionFns.snapToGrid = snapToGrid;
19956
-
19957
19760
  var _shims$1 = shims;
19958
-
19959
19761
  var _domFns$1 = domFns;
19960
-
19961
- function getBoundPosition(draggable
19962
- /*: Draggable*/
19963
- , x
19964
- /*: number*/
19965
- , y
19966
- /*: number*/
19967
- )
19968
- /*: [number, number]*/
19969
- {
19762
+ /*:: import type Draggable from '../Draggable';*/
19763
+ /*:: import type {Bounds, ControlPosition, DraggableData, MouseTouchEvent} from './types';*/
19764
+ /*:: import type DraggableCore from '../DraggableCore';*/
19765
+ function getBoundPosition(draggable /*: Draggable*/, x /*: number*/, y /*: number*/) /*: [number, number]*/{
19970
19766
  // If no bounds, short-circuit and move on
19971
- if (!draggable.props.bounds) return [x, y]; // Clone new bounds
19767
+ if (!draggable.props.bounds) return [x, y];
19972
19768
 
19973
- var bounds = draggable.props.bounds;
19769
+ // Clone new bounds
19770
+ let {
19771
+ bounds
19772
+ } = draggable.props;
19974
19773
  bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
19975
- var node = findDOMNode(draggable);
19976
-
19774
+ const node = findDOMNode(draggable);
19977
19775
  if (typeof bounds === 'string') {
19978
- var ownerDocument = node.ownerDocument;
19979
- var ownerWindow = ownerDocument.defaultView;
19980
- var boundNode;
19981
-
19776
+ const {
19777
+ ownerDocument
19778
+ } = node;
19779
+ const ownerWindow = ownerDocument.defaultView;
19780
+ let boundNode;
19982
19781
  if (bounds === 'parent') {
19983
19782
  boundNode = node.parentNode;
19984
19783
  } else {
19985
19784
  boundNode = ownerDocument.querySelector(bounds);
19986
19785
  }
19987
-
19988
19786
  if (!(boundNode instanceof ownerWindow.HTMLElement)) {
19989
19787
  throw new Error('Bounds selector "' + bounds + '" could not find an element.');
19990
19788
  }
19991
-
19992
- var boundNodeEl
19993
- /*: HTMLElement*/
19994
- = boundNode; // for Flow, can't seem to refine correctly
19995
-
19996
- var nodeStyle = ownerWindow.getComputedStyle(node);
19997
- var boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl); // Compute bounds. This is a pain with padding and offsets but this gets it exactly right.
19998
-
19789
+ const boundNodeEl /*: HTMLElement*/ = boundNode; // for Flow, can't seem to refine correctly
19790
+ const nodeStyle = ownerWindow.getComputedStyle(node);
19791
+ const boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl);
19792
+ // Compute bounds. This is a pain with padding and offsets but this gets it exactly right.
19999
19793
  bounds = {
20000
19794
  left: -node.offsetLeft + (0, _shims$1.int)(boundNodeStyle.paddingLeft) + (0, _shims$1.int)(nodeStyle.marginLeft),
20001
19795
  top: -node.offsetTop + (0, _shims$1.int)(boundNodeStyle.paddingTop) + (0, _shims$1.int)(nodeStyle.marginTop),
20002
19796
  right: (0, _domFns$1.innerWidth)(boundNodeEl) - (0, _domFns$1.outerWidth)(node) - node.offsetLeft + (0, _shims$1.int)(boundNodeStyle.paddingRight) - (0, _shims$1.int)(nodeStyle.marginRight),
20003
19797
  bottom: (0, _domFns$1.innerHeight)(boundNodeEl) - (0, _domFns$1.outerHeight)(node) - node.offsetTop + (0, _shims$1.int)(boundNodeStyle.paddingBottom) - (0, _shims$1.int)(nodeStyle.marginBottom)
20004
19798
  };
20005
- } // Keep x and y below right and bottom limits...
20006
-
19799
+ }
20007
19800
 
19801
+ // Keep x and y below right and bottom limits...
20008
19802
  if ((0, _shims$1.isNum)(bounds.right)) x = Math.min(x, bounds.right);
20009
- if ((0, _shims$1.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom); // But above left and top limits.
19803
+ if ((0, _shims$1.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom);
20010
19804
 
19805
+ // But above left and top limits.
20011
19806
  if ((0, _shims$1.isNum)(bounds.left)) x = Math.max(x, bounds.left);
20012
19807
  if ((0, _shims$1.isNum)(bounds.top)) y = Math.max(y, bounds.top);
20013
19808
  return [x, y];
20014
19809
  }
20015
-
20016
- function snapToGrid(grid
20017
- /*: [number, number]*/
20018
- , pendingX
20019
- /*: number*/
20020
- , pendingY
20021
- /*: number*/
20022
- )
20023
- /*: [number, number]*/
20024
- {
20025
- var x = Math.round(pendingX / grid[0]) * grid[0];
20026
- var y = Math.round(pendingY / grid[1]) * grid[1];
19810
+ function snapToGrid(grid /*: [number, number]*/, pendingX /*: number*/, pendingY /*: number*/) /*: [number, number]*/{
19811
+ const x = Math.round(pendingX / grid[0]) * grid[0];
19812
+ const y = Math.round(pendingY / grid[1]) * grid[1];
20027
19813
  return [x, y];
20028
19814
  }
20029
-
20030
- function canDragX(draggable
20031
- /*: Draggable*/
20032
- )
20033
- /*: boolean*/
20034
- {
19815
+ function canDragX(draggable /*: Draggable*/) /*: boolean*/{
20035
19816
  return draggable.props.axis === 'both' || draggable.props.axis === 'x';
20036
19817
  }
20037
-
20038
- function canDragY(draggable
20039
- /*: Draggable*/
20040
- )
20041
- /*: boolean*/
20042
- {
19818
+ function canDragY(draggable /*: Draggable*/) /*: boolean*/{
20043
19819
  return draggable.props.axis === 'both' || draggable.props.axis === 'y';
20044
- } // Get {x, y} positions from event.
20045
-
19820
+ }
20046
19821
 
20047
- function getControlPosition(e
20048
- /*: MouseTouchEvent*/
20049
- , touchIdentifier
20050
- /*: ?number*/
20051
- , draggableCore
20052
- /*: DraggableCore*/
20053
- )
20054
- /*: ?ControlPosition*/
20055
- {
20056
- var touchObj = typeof touchIdentifier === 'number' ? (0, _domFns$1.getTouch)(e, touchIdentifier) : null;
19822
+ // Get {x, y} positions from event.
19823
+ function getControlPosition(e /*: MouseTouchEvent*/, touchIdentifier /*: ?number*/, draggableCore /*: DraggableCore*/) /*: ?ControlPosition*/{
19824
+ const touchObj = typeof touchIdentifier === 'number' ? (0, _domFns$1.getTouch)(e, touchIdentifier) : null;
20057
19825
  if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch
20058
-
20059
- var node = findDOMNode(draggableCore); // User can provide an offsetParent if desired.
20060
-
20061
- var offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
19826
+ const node = findDOMNode(draggableCore);
19827
+ // User can provide an offsetParent if desired.
19828
+ const offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
20062
19829
  return (0, _domFns$1.offsetXYFromParent)(touchObj || e, offsetParent, draggableCore.props.scale);
20063
- } // Create an data object exposed by <DraggableCore>'s events
20064
-
20065
-
20066
- function createCoreData(draggable
20067
- /*: DraggableCore*/
20068
- , x
20069
- /*: number*/
20070
- , y
20071
- /*: number*/
20072
- )
20073
- /*: DraggableData*/
20074
- {
20075
- var state = draggable.state;
20076
- var isStart = !(0, _shims$1.isNum)(state.lastX);
20077
- var node = findDOMNode(draggable);
19830
+ }
20078
19831
 
19832
+ // Create an data object exposed by <DraggableCore>'s events
19833
+ function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/{
19834
+ const isStart = !(0, _shims$1.isNum)(draggable.lastX);
19835
+ const node = findDOMNode(draggable);
20079
19836
  if (isStart) {
20080
19837
  // If this is our first move, use the x and y as last coords.
20081
19838
  return {
20082
- node: node,
19839
+ node,
20083
19840
  deltaX: 0,
20084
19841
  deltaY: 0,
20085
19842
  lastX: x,
20086
19843
  lastY: y,
20087
- x: x,
20088
- y: y
19844
+ x,
19845
+ y
20089
19846
  };
20090
19847
  } else {
20091
19848
  // Otherwise calculate proper values.
20092
19849
  return {
20093
- node: node,
20094
- deltaX: x - state.lastX,
20095
- deltaY: y - state.lastY,
20096
- lastX: state.lastX,
20097
- lastY: state.lastY,
20098
- x: x,
20099
- y: y
19850
+ node,
19851
+ deltaX: x - draggable.lastX,
19852
+ deltaY: y - draggable.lastY,
19853
+ lastX: draggable.lastX,
19854
+ lastY: draggable.lastY,
19855
+ x,
19856
+ y
20100
19857
  };
20101
19858
  }
20102
- } // Create an data exposed by <Draggable>'s events
20103
-
19859
+ }
20104
19860
 
20105
- function createDraggableData(draggable
20106
- /*: Draggable*/
20107
- , coreData
20108
- /*: DraggableData*/
20109
- )
20110
- /*: DraggableData*/
20111
- {
20112
- var scale = draggable.props.scale;
19861
+ // Create an data exposed by <Draggable>'s events
19862
+ function createDraggableData(draggable /*: Draggable*/, coreData /*: DraggableData*/) /*: DraggableData*/{
19863
+ const scale = draggable.props.scale;
20113
19864
  return {
20114
19865
  node: coreData.node,
20115
19866
  x: draggable.state.x + coreData.deltaX / scale,
@@ -20119,14 +19870,10 @@ function createDraggableData(draggable
20119
19870
  lastX: draggable.state.x,
20120
19871
  lastY: draggable.state.y
20121
19872
  };
20122
- } // A lot faster than stringify/parse
20123
-
19873
+ }
20124
19874
 
20125
- function cloneBounds(bounds
20126
- /*: Bounds*/
20127
- )
20128
- /*: Bounds*/
20129
- {
19875
+ // A lot faster than stringify/parse
19876
+ function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/{
20130
19877
  return {
20131
19878
  left: bounds.left,
20132
19879
  top: bounds.top,
@@ -20134,19 +19881,12 @@ function cloneBounds(bounds
20134
19881
  bottom: bounds.bottom
20135
19882
  };
20136
19883
  }
20137
-
20138
- function findDOMNode(draggable
20139
- /*: Draggable | DraggableCore*/
20140
- )
20141
- /*: HTMLElement*/
20142
- {
20143
- var node = draggable.findDOMNode();
20144
-
19884
+ function findDOMNode(draggable /*: Draggable | DraggableCore*/) /*: HTMLElement*/{
19885
+ const node = draggable.findDOMNode();
20145
19886
  if (!node) {
20146
19887
  throw new Error('<DraggableCore>: Unmounted during event!');
20147
- } // $FlowIgnore we can't assert on HTMLElement due to tests... FIXME
20148
-
20149
-
19888
+ }
19889
+ // $FlowIgnore we can't assert on HTMLElement due to tests... FIXME
20150
19890
  return node;
20151
19891
  }
20152
19892
 
@@ -20158,74 +19898,31 @@ Object.defineProperty(log$1, "__esModule", {
20158
19898
  value: true
20159
19899
  });
20160
19900
  log$1.default = log;
20161
-
20162
19901
  /*eslint no-console:0*/
20163
19902
  function log() {
20164
19903
  }
20165
19904
 
20166
- function _typeof$1(obj) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$1(obj); }
20167
-
20168
19905
  Object.defineProperty(DraggableCore$2, "__esModule", {
20169
19906
  value: true
20170
19907
  });
20171
19908
  DraggableCore$2.default = void 0;
20172
-
20173
19909
  var React = _interopRequireWildcard(React__default);
20174
-
20175
19910
  var _propTypes = _interopRequireDefault$1(propTypes.exports);
20176
-
20177
19911
  var _reactDom = _interopRequireDefault$1(require$$2);
20178
-
20179
19912
  var _domFns = domFns;
20180
-
20181
19913
  var _positionFns = positionFns;
20182
-
20183
19914
  var _shims = shims;
20184
-
20185
19915
  var _log = _interopRequireDefault$1(log$1);
20186
-
20187
19916
  function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20188
-
20189
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20190
-
20191
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof$1(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20192
-
20193
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20194
-
20195
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20196
-
20197
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20198
-
20199
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20200
-
20201
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
20202
-
20203
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20204
-
20205
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20206
-
20207
- function _defineProperties(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); } }
20208
-
20209
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20210
-
20211
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
20212
-
20213
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
20214
-
20215
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
20216
-
20217
- function _possibleConstructorReturn(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
20218
-
20219
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20220
-
20221
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20222
-
20223
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
20224
-
20225
- function _defineProperty$1(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; }
20226
-
19917
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19918
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19919
+ function _defineProperty$1(obj, key, value) { key = _toPropertyKey$1(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19920
+ function _toPropertyKey$1(arg) { var key = _toPrimitive$1(arg, "string"); return typeof key === "symbol" ? key : String(key); }
19921
+ function _toPrimitive$1(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
19922
+ /*:: import type {EventHandler, MouseTouchEvent} from './utils/types';*/
19923
+ /*:: import type {Element as ReactElement} from 'react';*/
20227
19924
  // Simple abstraction for dragging events names.
20228
- var eventsFor = {
19925
+ const eventsFor = {
20229
19926
  touch: {
20230
19927
  start: 'touchstart',
20231
19928
  move: 'touchmove',
@@ -20236,29 +19933,19 @@ var eventsFor = {
20236
19933
  move: 'mousemove',
20237
19934
  stop: 'mouseup'
20238
19935
  }
20239
- }; // Default to mouse events.
20240
-
20241
- var dragEventFor = eventsFor.mouse;
20242
- /*:: type DraggableCoreState = {
20243
- dragging: boolean,
20244
- lastX: number,
20245
- lastY: number,
20246
- touchIdentifier: ?number
20247
- };*/
19936
+ };
20248
19937
 
19938
+ // Default to mouse events.
19939
+ let dragEventFor = eventsFor.mouse;
20249
19940
  /*:: export type DraggableData = {
20250
19941
  node: HTMLElement,
20251
19942
  x: number, y: number,
20252
19943
  deltaX: number, deltaY: number,
20253
19944
  lastX: number, lastY: number,
20254
19945
  };*/
20255
-
20256
19946
  /*:: export type DraggableEventHandler = (e: MouseEvent, data: DraggableData) => void | false;*/
20257
-
20258
19947
  /*:: export type ControlPosition = {x: number, y: number};*/
20259
-
20260
19948
  /*:: export type PositionOffsetControlPosition = {x: number|string, y: number|string};*/
20261
-
20262
19949
  /*:: export type DraggableCoreDefaultProps = {
20263
19950
  allowAnyClick: boolean,
20264
19951
  disabled: boolean,
@@ -20269,7 +19956,6 @@ var dragEventFor = eventsFor.mouse;
20269
19956
  onMouseDown: (e: MouseEvent) => void,
20270
19957
  scale: number,
20271
19958
  };*/
20272
-
20273
19959
  /*:: export type DraggableCoreProps = {
20274
19960
  ...DraggableCoreDefaultProps,
20275
19961
  cancel: string,
@@ -20279,305 +19965,240 @@ var dragEventFor = eventsFor.mouse;
20279
19965
  handle: string,
20280
19966
  nodeRef?: ?React.ElementRef<any>,
20281
19967
  };*/
20282
-
20283
19968
  //
20284
19969
  // Define <DraggableCore>.
20285
19970
  //
20286
19971
  // <DraggableCore> is for advanced usage of <Draggable>. It maintains minimal internal state so it can
20287
19972
  // work well with libraries that require more control over the element.
20288
19973
  //
20289
- var DraggableCore$1 = /*#__PURE__*/function (_React$Component) {
20290
- _inherits(DraggableCore, _React$Component);
20291
-
20292
- var _super = _createSuper(DraggableCore);
20293
-
20294
- function DraggableCore() {
20295
- var _this;
20296
-
20297
- _classCallCheck(this, DraggableCore);
20298
-
20299
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20300
- args[_key] = arguments[_key];
20301
- }
20302
-
20303
- _this = _super.call.apply(_super, [this].concat(args));
20304
19974
 
20305
- _defineProperty$1(_assertThisInitialized(_this), "state", {
20306
- dragging: false,
20307
- // Used while dragging to determine deltas.
20308
- lastX: NaN,
20309
- lastY: NaN,
20310
- touchIdentifier: null
20311
- });
20312
-
20313
- _defineProperty$1(_assertThisInitialized(_this), "mounted", false);
20314
-
20315
- _defineProperty$1(_assertThisInitialized(_this), "handleDragStart", function (e) {
19975
+ class DraggableCore$1 extends React.Component /*:: <DraggableCoreProps>*/{
19976
+ constructor() {
19977
+ super(...arguments);
19978
+ _defineProperty$1(this, "dragging", false);
19979
+ // Used while dragging to determine deltas.
19980
+ _defineProperty$1(this, "lastX", NaN);
19981
+ _defineProperty$1(this, "lastY", NaN);
19982
+ _defineProperty$1(this, "touchIdentifier", null);
19983
+ _defineProperty$1(this, "mounted", false);
19984
+ _defineProperty$1(this, "handleDragStart", e => {
20316
19985
  // Make it possible to attach event handlers on top of this one.
20317
- _this.props.onMouseDown(e); // Only accept left-clicks.
19986
+ this.props.onMouseDown(e);
20318
19987
 
19988
+ // Only accept left-clicks.
19989
+ if (!this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false;
20319
19990
 
20320
- if (!_this.props.allowAnyClick && typeof e.button === 'number' && e.button !== 0) return false; // Get nodes. Be sure to grab relative document (could be iframed)
20321
-
20322
- var thisNode = _this.findDOMNode();
20323
-
19991
+ // Get nodes. Be sure to grab relative document (could be iframed)
19992
+ const thisNode = this.findDOMNode();
20324
19993
  if (!thisNode || !thisNode.ownerDocument || !thisNode.ownerDocument.body) {
20325
19994
  throw new Error('<DraggableCore> not mounted on DragStart!');
20326
19995
  }
19996
+ const {
19997
+ ownerDocument
19998
+ } = thisNode;
20327
19999
 
20328
- var ownerDocument = thisNode.ownerDocument; // Short circuit if handle or cancel prop was provided and selector doesn't match.
20329
-
20330
- if (_this.props.disabled || !(e.target instanceof ownerDocument.defaultView.Node) || _this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.handle, thisNode) || _this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, _this.props.cancel, thisNode)) {
20000
+ // Short circuit if handle or cancel prop was provided and selector doesn't match.
20001
+ if (this.props.disabled || !(e.target instanceof ownerDocument.defaultView.Node) || this.props.handle && !(0, _domFns.matchesSelectorAndParentsTo)(e.target, this.props.handle, thisNode) || this.props.cancel && (0, _domFns.matchesSelectorAndParentsTo)(e.target, this.props.cancel, thisNode)) {
20331
20002
  return;
20332
- } // Prevent scrolling on mobile devices, like ipad/iphone.
20333
- // Important that this is after handle/cancel.
20003
+ }
20334
20004
 
20005
+ // Prevent scrolling on mobile devices, like ipad/iphone.
20006
+ // Important that this is after handle/cancel.
20007
+ if (e.type === 'touchstart') e.preventDefault();
20335
20008
 
20336
- if (e.type === 'touchstart') e.preventDefault(); // Set touch identifier in component state if this is a touch event. This allows us to
20009
+ // Set touch identifier in component state if this is a touch event. This allows us to
20337
20010
  // distinguish between individual touches on multitouch screens by identifying which
20338
20011
  // touchpoint was set to this element.
20012
+ const touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
20013
+ this.touchIdentifier = touchIdentifier;
20339
20014
 
20340
- var touchIdentifier = (0, _domFns.getTouchIdentifier)(e);
20341
-
20342
- _this.setState({
20343
- touchIdentifier: touchIdentifier
20344
- }); // Get the current drag point from the event. This is used as the offset.
20345
-
20346
-
20347
- var position = (0, _positionFns.getControlPosition)(e, touchIdentifier, _assertThisInitialized(_this));
20015
+ // Get the current drag point from the event. This is used as the offset.
20016
+ const position = (0, _positionFns.getControlPosition)(e, touchIdentifier, this);
20348
20017
  if (position == null) return; // not possible but satisfies flow
20018
+ const {
20019
+ x,
20020
+ y
20021
+ } = position;
20349
20022
 
20350
- var x = position.x,
20351
- y = position.y; // Create an event object with all the data parents need to make a decision here.
20352
-
20353
- var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y);
20354
- (0, _log.default)('DraggableCore: handleDragStart: %j', coreEvent); // Call event handler. If it returns explicit false, cancel.
20023
+ // Create an event object with all the data parents need to make a decision here.
20024
+ const coreEvent = (0, _positionFns.createCoreData)(this, x, y);
20025
+ (0, _log.default)('DraggableCore: handleDragStart: %j', coreEvent);
20355
20026
 
20356
- (0, _log.default)('calling', _this.props.onStart);
20027
+ // Call event handler. If it returns explicit false, cancel.
20028
+ (0, _log.default)('calling', this.props.onStart);
20029
+ const shouldUpdate = this.props.onStart(e, coreEvent);
20030
+ if (shouldUpdate === false || this.mounted === false) return;
20357
20031
 
20358
- var shouldUpdate = _this.props.onStart(e, coreEvent);
20359
-
20360
- if (shouldUpdate === false || _this.mounted === false) return; // Add a style to the body to disable user-select. This prevents text from
20032
+ // Add a style to the body to disable user-select. This prevents text from
20361
20033
  // being selected all over the page.
20034
+ if (this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument);
20362
20035
 
20363
- if (_this.props.enableUserSelectHack) (0, _domFns.addUserSelectStyles)(ownerDocument); // Initiate dragging. Set the current x and y as offsets
20036
+ // Initiate dragging. Set the current x and y as offsets
20364
20037
  // so we know how much we've moved during the drag. This allows us
20365
20038
  // to drag elements around even if they have been moved, without issue.
20039
+ this.dragging = true;
20040
+ this.lastX = x;
20041
+ this.lastY = y;
20366
20042
 
20367
- _this.setState({
20368
- dragging: true,
20369
- lastX: x,
20370
- lastY: y
20371
- }); // Add events to the document directly so we catch when the user's mouse/touch moves outside of
20043
+ // Add events to the document directly so we catch when the user's mouse/touch moves outside of
20372
20044
  // this element. We use different events depending on whether or not we have detected that this
20373
20045
  // is a touch-capable device.
20374
-
20375
-
20376
- (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, _this.handleDrag);
20377
- (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, _this.handleDragStop);
20046
+ (0, _domFns.addEvent)(ownerDocument, dragEventFor.move, this.handleDrag);
20047
+ (0, _domFns.addEvent)(ownerDocument, dragEventFor.stop, this.handleDragStop);
20378
20048
  });
20379
-
20380
- _defineProperty$1(_assertThisInitialized(_this), "handleDrag", function (e) {
20049
+ _defineProperty$1(this, "handleDrag", e => {
20381
20050
  // Get the current drag point from the event. This is used as the offset.
20382
- var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
20051
+ const position = (0, _positionFns.getControlPosition)(e, this.touchIdentifier, this);
20383
20052
  if (position == null) return;
20384
- var x = position.x,
20385
- y = position.y; // Snap to grid if prop has been provided
20386
-
20387
- if (Array.isArray(_this.props.grid)) {
20388
- var deltaX = x - _this.state.lastX,
20389
- deltaY = y - _this.state.lastY;
20390
-
20391
- var _snapToGrid = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
20392
-
20393
- var _snapToGrid2 = _slicedToArray(_snapToGrid, 2);
20394
-
20395
- deltaX = _snapToGrid2[0];
20396
- deltaY = _snapToGrid2[1];
20053
+ let {
20054
+ x,
20055
+ y
20056
+ } = position;
20057
+
20058
+ // Snap to grid if prop has been provided
20059
+ if (Array.isArray(this.props.grid)) {
20060
+ let deltaX = x - this.lastX,
20061
+ deltaY = y - this.lastY;
20062
+ [deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY);
20397
20063
  if (!deltaX && !deltaY) return; // skip useless drag
20398
-
20399
- x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
20064
+ x = this.lastX + deltaX, y = this.lastY + deltaY;
20400
20065
  }
20066
+ const coreEvent = (0, _positionFns.createCoreData)(this, x, y);
20067
+ (0, _log.default)('DraggableCore: handleDrag: %j', coreEvent);
20401
20068
 
20402
- var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y);
20403
- (0, _log.default)('DraggableCore: handleDrag: %j', coreEvent); // Call event handler. If it returns explicit false, trigger end.
20404
-
20405
- var shouldUpdate = _this.props.onDrag(e, coreEvent);
20406
-
20407
- if (shouldUpdate === false || _this.mounted === false) {
20069
+ // Call event handler. If it returns explicit false, trigger end.
20070
+ const shouldUpdate = this.props.onDrag(e, coreEvent);
20071
+ if (shouldUpdate === false || this.mounted === false) {
20408
20072
  try {
20409
20073
  // $FlowIgnore
20410
- _this.handleDragStop(new MouseEvent('mouseup'));
20074
+ this.handleDragStop(new MouseEvent('mouseup'));
20411
20075
  } catch (err) {
20412
20076
  // Old browsers
20413
- var event = ((document.createEvent('MouseEvents')
20414
- /*: any*/
20415
- )
20416
- /*: MouseTouchEvent*/
20417
- ); // I see why this insanity was deprecated
20077
+ const event = ((document.createEvent('MouseEvents') /*: any*/) /*: MouseTouchEvent*/);
20078
+ // I see why this insanity was deprecated
20418
20079
  // $FlowIgnore
20419
-
20420
20080
  event.initMouseEvent('mouseup', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
20421
-
20422
- _this.handleDragStop(event);
20081
+ this.handleDragStop(event);
20423
20082
  }
20424
-
20425
20083
  return;
20426
20084
  }
20427
-
20428
- _this.setState({
20429
- lastX: x,
20430
- lastY: y
20431
- });
20085
+ this.lastX = x;
20086
+ this.lastY = y;
20432
20087
  });
20433
-
20434
- _defineProperty$1(_assertThisInitialized(_this), "handleDragStop", function (e) {
20435
- if (!_this.state.dragging) return;
20436
- var position = (0, _positionFns.getControlPosition)(e, _this.state.touchIdentifier, _assertThisInitialized(_this));
20088
+ _defineProperty$1(this, "handleDragStop", e => {
20089
+ if (!this.dragging) return;
20090
+ const position = (0, _positionFns.getControlPosition)(e, this.touchIdentifier, this);
20437
20091
  if (position == null) return;
20438
- var x = position.x,
20439
- y = position.y; // Snap to grid if prop has been provided
20440
-
20441
- if (Array.isArray(_this.props.grid)) {
20442
- var deltaX = x - _this.state.lastX || 0;
20443
- var deltaY = y - _this.state.lastY || 0;
20444
-
20445
- var _snapToGrid3 = (0, _positionFns.snapToGrid)(_this.props.grid, deltaX, deltaY);
20446
-
20447
- var _snapToGrid4 = _slicedToArray(_snapToGrid3, 2);
20448
-
20449
- deltaX = _snapToGrid4[0];
20450
- deltaY = _snapToGrid4[1];
20451
- x = _this.state.lastX + deltaX, y = _this.state.lastY + deltaY;
20452
- }
20453
-
20454
- var coreEvent = (0, _positionFns.createCoreData)(_assertThisInitialized(_this), x, y); // Call event handler
20455
-
20456
- var shouldContinue = _this.props.onStop(e, coreEvent);
20457
-
20458
- if (shouldContinue === false || _this.mounted === false) return false;
20459
-
20460
- var thisNode = _this.findDOMNode();
20461
-
20092
+ let {
20093
+ x,
20094
+ y
20095
+ } = position;
20096
+
20097
+ // Snap to grid if prop has been provided
20098
+ if (Array.isArray(this.props.grid)) {
20099
+ let deltaX = x - this.lastX || 0;
20100
+ let deltaY = y - this.lastY || 0;
20101
+ [deltaX, deltaY] = (0, _positionFns.snapToGrid)(this.props.grid, deltaX, deltaY);
20102
+ x = this.lastX + deltaX, y = this.lastY + deltaY;
20103
+ }
20104
+ const coreEvent = (0, _positionFns.createCoreData)(this, x, y);
20105
+
20106
+ // Call event handler
20107
+ const shouldContinue = this.props.onStop(e, coreEvent);
20108
+ if (shouldContinue === false || this.mounted === false) return false;
20109
+ const thisNode = this.findDOMNode();
20462
20110
  if (thisNode) {
20463
20111
  // Remove user-select hack
20464
- if (_this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
20112
+ if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(thisNode.ownerDocument);
20465
20113
  }
20114
+ (0, _log.default)('DraggableCore: handleDragStop: %j', coreEvent);
20466
20115
 
20467
- (0, _log.default)('DraggableCore: handleDragStop: %j', coreEvent); // Reset the el.
20468
-
20469
- _this.setState({
20470
- dragging: false,
20471
- lastX: NaN,
20472
- lastY: NaN
20473
- });
20474
-
20116
+ // Reset the el.
20117
+ this.dragging = false;
20118
+ this.lastX = NaN;
20119
+ this.lastY = NaN;
20475
20120
  if (thisNode) {
20476
20121
  // Remove event handlers
20477
20122
  (0, _log.default)('DraggableCore: Removing handlers');
20478
- (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, _this.handleDrag);
20479
- (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, _this.handleDragStop);
20123
+ (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.move, this.handleDrag);
20124
+ (0, _domFns.removeEvent)(thisNode.ownerDocument, dragEventFor.stop, this.handleDragStop);
20480
20125
  }
20481
20126
  });
20482
-
20483
- _defineProperty$1(_assertThisInitialized(_this), "onMouseDown", function (e) {
20127
+ _defineProperty$1(this, "onMouseDown", e => {
20484
20128
  dragEventFor = eventsFor.mouse; // on touchscreen laptops we could switch back to mouse
20485
20129
 
20486
- return _this.handleDragStart(e);
20130
+ return this.handleDragStart(e);
20487
20131
  });
20488
-
20489
- _defineProperty$1(_assertThisInitialized(_this), "onMouseUp", function (e) {
20132
+ _defineProperty$1(this, "onMouseUp", e => {
20490
20133
  dragEventFor = eventsFor.mouse;
20491
- return _this.handleDragStop(e);
20134
+ return this.handleDragStop(e);
20492
20135
  });
20493
-
20494
- _defineProperty$1(_assertThisInitialized(_this), "onTouchStart", function (e) {
20136
+ // Same as onMouseDown (start drag), but now consider this a touch device.
20137
+ _defineProperty$1(this, "onTouchStart", e => {
20495
20138
  // We're on a touch device now, so change the event handlers
20496
20139
  dragEventFor = eventsFor.touch;
20497
- return _this.handleDragStart(e);
20140
+ return this.handleDragStart(e);
20498
20141
  });
20499
-
20500
- _defineProperty$1(_assertThisInitialized(_this), "onTouchEnd", function (e) {
20142
+ _defineProperty$1(this, "onTouchEnd", e => {
20501
20143
  // We're on a touch device now, so change the event handlers
20502
20144
  dragEventFor = eventsFor.touch;
20503
- return _this.handleDragStop(e);
20145
+ return this.handleDragStop(e);
20504
20146
  });
20505
-
20506
- return _this;
20507
20147
  }
20508
-
20509
- _createClass(DraggableCore, [{
20510
- key: "componentDidMount",
20511
- value: function componentDidMount() {
20512
- this.mounted = true; // Touch handlers must be added with {passive: false} to be cancelable.
20513
- // https://developers.google.com/web/updates/2017/01/scrolling-intervention
20514
-
20515
- var thisNode = this.findDOMNode();
20516
-
20517
- if (thisNode) {
20518
- (0, _domFns.addEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
20519
- passive: false
20520
- });
20521
- }
20522
- }
20523
- }, {
20524
- key: "componentWillUnmount",
20525
- value: function componentWillUnmount() {
20526
- this.mounted = false; // Remove any leftover event handlers. Remove both touch and mouse handlers in case
20527
- // some browser quirk caused a touch event to fire during a mouse move, or vice versa.
20528
-
20529
- var thisNode = this.findDOMNode();
20530
-
20531
- if (thisNode) {
20532
- var ownerDocument = thisNode.ownerDocument;
20533
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
20534
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
20535
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
20536
- (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
20537
- (0, _domFns.removeEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
20538
- passive: false
20539
- });
20540
- if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument);
20541
- }
20542
- } // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
20543
- // the underlying DOM node ourselves. See the README for more information.
20544
-
20545
- }, {
20546
- key: "findDOMNode",
20547
- value: function findDOMNode()
20548
- /*: ?HTMLElement*/
20549
- {
20550
- var _this$props, _this$props2, _this$props2$nodeRef;
20551
-
20552
- return (_this$props = this.props) !== null && _this$props !== void 0 && _this$props.nodeRef ? (_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$nodeRef = _this$props2.nodeRef) === null || _this$props2$nodeRef === void 0 ? void 0 : _this$props2$nodeRef.current : _reactDom.default.findDOMNode(this);
20553
- }
20554
- }, {
20555
- key: "render",
20556
- value: function render()
20557
- /*: React.Element<any>*/
20558
- {
20559
- // Reuse the child provided
20560
- // This makes it flexible to use whatever element is wanted (div, ul, etc)
20561
- return /*#__PURE__*/React.cloneElement(React.Children.only(this.props.children), {
20562
- // Note: mouseMove handler is attached to document so it will still function
20563
- // when the user drags quickly and leaves the bounds of the element.
20564
- onMouseDown: this.onMouseDown,
20565
- onMouseUp: this.onMouseUp,
20566
- // onTouchStart is added on `componentDidMount` so they can be added with
20567
- // {passive: false}, which allows it to cancel. See
20568
- // https://developers.google.com/web/updates/2017/01/scrolling-intervention
20569
- onTouchEnd: this.onTouchEnd
20148
+ componentDidMount() {
20149
+ this.mounted = true;
20150
+ // Touch handlers must be added with {passive: false} to be cancelable.
20151
+ // https://developers.google.com/web/updates/2017/01/scrolling-intervention
20152
+ const thisNode = this.findDOMNode();
20153
+ if (thisNode) {
20154
+ (0, _domFns.addEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
20155
+ passive: false
20156
+ });
20157
+ }
20158
+ }
20159
+ componentWillUnmount() {
20160
+ this.mounted = false;
20161
+ // Remove any leftover event handlers. Remove both touch and mouse handlers in case
20162
+ // some browser quirk caused a touch event to fire during a mouse move, or vice versa.
20163
+ const thisNode = this.findDOMNode();
20164
+ if (thisNode) {
20165
+ const {
20166
+ ownerDocument
20167
+ } = thisNode;
20168
+ (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.move, this.handleDrag);
20169
+ (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.move, this.handleDrag);
20170
+ (0, _domFns.removeEvent)(ownerDocument, eventsFor.mouse.stop, this.handleDragStop);
20171
+ (0, _domFns.removeEvent)(ownerDocument, eventsFor.touch.stop, this.handleDragStop);
20172
+ (0, _domFns.removeEvent)(thisNode, eventsFor.touch.start, this.onTouchStart, {
20173
+ passive: false
20570
20174
  });
20175
+ if (this.props.enableUserSelectHack) (0, _domFns.removeUserSelectStyles)(ownerDocument);
20571
20176
  }
20572
- }]);
20573
-
20574
- return DraggableCore;
20575
- }(React.Component);
20177
+ }
20576
20178
 
20179
+ // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
20180
+ // the underlying DOM node ourselves. See the README for more information.
20181
+ findDOMNode() /*: ?HTMLElement*/{
20182
+ var _this$props, _this$props2;
20183
+ return (_this$props = this.props) !== null && _this$props !== void 0 && _this$props.nodeRef ? (_this$props2 = this.props) === null || _this$props2 === void 0 || (_this$props2 = _this$props2.nodeRef) === null || _this$props2 === void 0 ? void 0 : _this$props2.current : _reactDom.default.findDOMNode(this);
20184
+ }
20185
+ render() /*: React.Element<any>*/{
20186
+ // Reuse the child provided
20187
+ // This makes it flexible to use whatever element is wanted (div, ul, etc)
20188
+ return /*#__PURE__*/React.cloneElement(React.Children.only(this.props.children), {
20189
+ // Note: mouseMove handler is attached to document so it will still function
20190
+ // when the user drags quickly and leaves the bounds of the element.
20191
+ onMouseDown: this.onMouseDown,
20192
+ onMouseUp: this.onMouseUp,
20193
+ // onTouchStart is added on `componentDidMount` so they can be added with
20194
+ // {passive: false}, which allows it to cancel. See
20195
+ // https://developers.google.com/web/updates/2017/01/scrolling-intervention
20196
+ onTouchEnd: this.onTouchEnd
20197
+ });
20198
+ }
20199
+ }
20577
20200
  DraggableCore$2.default = DraggableCore$1;
20578
-
20579
20201
  _defineProperty$1(DraggableCore$1, "displayName", 'DraggableCore');
20580
-
20581
20202
  _defineProperty$1(DraggableCore$1, "propTypes", {
20582
20203
  /**
20583
20204
  * `allowAnyClick` allows dragging using any mouse button.
@@ -20586,39 +20207,31 @@ _defineProperty$1(DraggableCore$1, "propTypes", {
20586
20207
  * Defaults to `false`.
20587
20208
  */
20588
20209
  allowAnyClick: _propTypes.default.bool,
20589
-
20210
+ children: _propTypes.default.node.isRequired,
20590
20211
  /**
20591
20212
  * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
20592
20213
  * with the exception of `onMouseDown`, will not fire.
20593
20214
  */
20594
20215
  disabled: _propTypes.default.bool,
20595
-
20596
20216
  /**
20597
20217
  * By default, we add 'user-select:none' attributes to the document body
20598
20218
  * to prevent ugly text selection during drag. If this is causing problems
20599
20219
  * for your app, set this to `false`.
20600
20220
  */
20601
20221
  enableUserSelectHack: _propTypes.default.bool,
20602
-
20603
20222
  /**
20604
20223
  * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
20605
20224
  * instead of using the parent node.
20606
20225
  */
20607
- offsetParent: function offsetParent(props
20608
- /*: DraggableCoreProps*/
20609
- , propName
20610
- /*: $Keys<DraggableCoreProps>*/
20611
- ) {
20226
+ offsetParent: function (props /*: DraggableCoreProps*/, propName /*: $Keys<DraggableCoreProps>*/) {
20612
20227
  if (props[propName] && props[propName].nodeType !== 1) {
20613
20228
  throw new Error('Draggable\'s offsetParent must be a DOM Node.');
20614
20229
  }
20615
20230
  },
20616
-
20617
20231
  /**
20618
20232
  * `grid` specifies the x and y that dragging should snap to.
20619
20233
  */
20620
20234
  grid: _propTypes.default.arrayOf(_propTypes.default.number),
20621
-
20622
20235
  /**
20623
20236
  * `handle` specifies a selector to be used as the handle that initiates drag.
20624
20237
  *
@@ -20640,7 +20253,6 @@ _defineProperty$1(DraggableCore$1, "propTypes", {
20640
20253
  * ```
20641
20254
  */
20642
20255
  handle: _propTypes.default.string,
20643
-
20644
20256
  /**
20645
20257
  * `cancel` specifies a selector to be used to prevent drag initialization.
20646
20258
  *
@@ -20662,7 +20274,6 @@ _defineProperty$1(DraggableCore$1, "propTypes", {
20662
20274
  * ```
20663
20275
  */
20664
20276
  cancel: _propTypes.default.string,
20665
-
20666
20277
  /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
20667
20278
  * Unfortunately, in order for <Draggable> to work properly, we need raw access
20668
20279
  * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
@@ -20681,36 +20292,30 @@ _defineProperty$1(DraggableCore$1, "propTypes", {
20681
20292
  * pointing to the actual child DOM node and not a custom component.
20682
20293
  */
20683
20294
  nodeRef: _propTypes.default.object,
20684
-
20685
20295
  /**
20686
20296
  * Called when dragging starts.
20687
20297
  * If this function returns the boolean false, dragging will be canceled.
20688
20298
  */
20689
20299
  onStart: _propTypes.default.func,
20690
-
20691
20300
  /**
20692
20301
  * Called while dragging.
20693
20302
  * If this function returns the boolean false, dragging will be canceled.
20694
20303
  */
20695
20304
  onDrag: _propTypes.default.func,
20696
-
20697
20305
  /**
20698
20306
  * Called when dragging stops.
20699
20307
  * If this function returns the boolean false, the drag will remain active.
20700
20308
  */
20701
20309
  onStop: _propTypes.default.func,
20702
-
20703
20310
  /**
20704
20311
  * A workaround option which can be passed if onMouseDown needs to be accessed,
20705
20312
  * since it'll always be blocked (as there is internal use of onMouseDown)
20706
20313
  */
20707
20314
  onMouseDown: _propTypes.default.func,
20708
-
20709
20315
  /**
20710
20316
  * `scale`, if set, applies scaling while dragging an element
20711
20317
  */
20712
20318
  scale: _propTypes.default.number,
20713
-
20714
20319
  /**
20715
20320
  * These properties should be defined on the child, not here.
20716
20321
  */
@@ -20718,211 +20323,188 @@ _defineProperty$1(DraggableCore$1, "propTypes", {
20718
20323
  style: _shims.dontSetMe,
20719
20324
  transform: _shims.dontSetMe
20720
20325
  });
20721
-
20722
20326
  _defineProperty$1(DraggableCore$1, "defaultProps", {
20723
20327
  allowAnyClick: false,
20724
20328
  // by default only accept left click
20725
20329
  disabled: false,
20726
20330
  enableUserSelectHack: true,
20727
- onStart: function onStart() {},
20728
- onDrag: function onDrag() {},
20729
- onStop: function onStop() {},
20730
- onMouseDown: function onMouseDown() {},
20331
+ onStart: function () {},
20332
+ onDrag: function () {},
20333
+ onStop: function () {},
20334
+ onMouseDown: function () {},
20731
20335
  scale: 1
20732
20336
  });
20733
20337
 
20734
20338
  (function (exports) {
20735
20339
 
20736
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
20737
-
20738
20340
  Object.defineProperty(exports, "__esModule", {
20739
20341
  value: true
20740
20342
  });
20741
20343
  Object.defineProperty(exports, "DraggableCore", {
20742
20344
  enumerable: true,
20743
- get: function get() {
20345
+ get: function () {
20744
20346
  return _DraggableCore.default;
20745
20347
  }
20746
20348
  });
20747
20349
  exports.default = void 0;
20748
-
20749
20350
  var React = _interopRequireWildcard(React__default);
20750
-
20751
20351
  var _propTypes = _interopRequireDefault(propTypes.exports);
20752
-
20753
20352
  var _reactDom = _interopRequireDefault(require$$2);
20754
-
20755
- var _clsx2 = _interopRequireDefault(require$$3);
20756
-
20353
+ var _clsx = _interopRequireDefault(require$$3);
20757
20354
  var _domFns = domFns;
20758
-
20759
20355
  var _positionFns = positionFns;
20760
-
20761
20356
  var _shims = shims;
20762
-
20763
20357
  var _DraggableCore = _interopRequireDefault(DraggableCore$2);
20764
-
20765
20358
  var _log = _interopRequireDefault(log$1);
20766
-
20767
- var _excluded = ["axis", "bounds", "children", "defaultPosition", "defaultClassName", "defaultClassNameDragging", "defaultClassNameDragged", "position", "positionOffset", "scale"];
20768
-
20769
20359
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20770
-
20771
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20772
-
20773
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20774
-
20775
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
20776
-
20777
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
20778
-
20779
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20780
-
20781
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20782
-
20783
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
20784
-
20785
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20786
-
20787
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20788
-
20789
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20790
-
20791
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
20792
-
20793
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
20794
-
20795
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20796
-
20797
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
20798
-
20799
- function _defineProperties(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); } }
20800
-
20801
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20802
-
20803
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
20804
-
20805
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
20806
-
20807
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
20808
-
20809
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
20810
-
20811
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
20812
-
20813
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20814
-
20815
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
20816
-
20817
- 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; }
20818
-
20360
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20361
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20362
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
20363
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
20364
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
20365
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /*:: import type {ControlPosition, PositionOffsetControlPosition, DraggableCoreProps, DraggableCoreDefaultProps} from './DraggableCore';*/
20366
+ /*:: import type {Bounds, DraggableEventHandler} from './utils/types';*/
20367
+ /*:: import type {Element as ReactElement} from 'react';*/
20368
+ /*:: type DraggableState = {
20369
+ dragging: boolean,
20370
+ dragged: boolean,
20371
+ x: number, y: number,
20372
+ slackX: number, slackY: number,
20373
+ isElementSVG: boolean,
20374
+ prevPropsPosition: ?ControlPosition,
20375
+ };*/
20376
+ /*:: export type DraggableDefaultProps = {
20377
+ ...DraggableCoreDefaultProps,
20378
+ axis: 'both' | 'x' | 'y' | 'none',
20379
+ bounds: Bounds | string | false,
20380
+ defaultClassName: string,
20381
+ defaultClassNameDragging: string,
20382
+ defaultClassNameDragged: string,
20383
+ defaultPosition: ControlPosition,
20384
+ scale: number,
20385
+ };*/
20386
+ /*:: export type DraggableProps = {
20387
+ ...DraggableCoreProps,
20388
+ ...DraggableDefaultProps,
20389
+ positionOffset: PositionOffsetControlPosition,
20390
+ position: ControlPosition,
20391
+ };*/
20819
20392
  //
20820
20393
  // Define <Draggable>
20821
20394
  //
20822
- var Draggable = /*#__PURE__*/function (_React$Component) {
20823
- _inherits(Draggable, _React$Component);
20824
-
20825
- var _super = _createSuper(Draggable);
20826
-
20827
- function Draggable(props
20828
- /*: DraggableProps*/
20829
- ) {
20830
- var _this;
20831
-
20832
- _classCallCheck(this, Draggable);
20833
-
20834
- _this = _super.call(this, props);
20835
-
20836
- _defineProperty(_assertThisInitialized(_this), "onDragStart", function (e, coreData) {
20837
- (0, _log.default)('Draggable: onDragStart: %j', coreData); // Short-circuit if user's callback killed it.
20838
-
20839
- var shouldStart = _this.props.onStart(e, (0, _positionFns.createDraggableData)(_assertThisInitialized(_this), coreData)); // Kills start event on core as well, so move handlers are never bound.
20840
-
20841
-
20395
+ class Draggable extends React.Component /*:: <DraggableProps, DraggableState>*/{
20396
+ // React 16.3+
20397
+ // Arity (props, state)
20398
+ static getDerivedStateFromProps(_ref /*:: */, _ref2 /*:: */) /*: ?Partial<DraggableState>*/{
20399
+ let {
20400
+ position
20401
+ } /*: DraggableProps*/ = _ref /*: DraggableProps*/;
20402
+ let {
20403
+ prevPropsPosition
20404
+ } /*: DraggableState*/ = _ref2 /*: DraggableState*/;
20405
+ // Set x/y if a new position is provided in props that is different than the previous.
20406
+ if (position && (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y)) {
20407
+ (0, _log.default)('Draggable: getDerivedStateFromProps %j', {
20408
+ position,
20409
+ prevPropsPosition
20410
+ });
20411
+ return {
20412
+ x: position.x,
20413
+ y: position.y,
20414
+ prevPropsPosition: {
20415
+ ...position
20416
+ }
20417
+ };
20418
+ }
20419
+ return null;
20420
+ }
20421
+ constructor(props /*: DraggableProps*/) {
20422
+ super(props);
20423
+ _defineProperty(this, "onDragStart", (e, coreData) => {
20424
+ (0, _log.default)('Draggable: onDragStart: %j', coreData);
20425
+
20426
+ // Short-circuit if user's callback killed it.
20427
+ const shouldStart = this.props.onStart(e, (0, _positionFns.createDraggableData)(this, coreData));
20428
+ // Kills start event on core as well, so move handlers are never bound.
20842
20429
  if (shouldStart === false) return false;
20843
-
20844
- _this.setState({
20430
+ this.setState({
20845
20431
  dragging: true,
20846
20432
  dragged: true
20847
20433
  });
20848
20434
  });
20849
-
20850
- _defineProperty(_assertThisInitialized(_this), "onDrag", function (e, coreData) {
20851
- if (!_this.state.dragging) return false;
20435
+ _defineProperty(this, "onDrag", (e, coreData) => {
20436
+ if (!this.state.dragging) return false;
20852
20437
  (0, _log.default)('Draggable: onDrag: %j', coreData);
20853
- var uiData = (0, _positionFns.createDraggableData)(_assertThisInitialized(_this), coreData);
20854
- var newState
20855
- /*: $Shape<DraggableState>*/
20856
- = {
20438
+ const uiData = (0, _positionFns.createDraggableData)(this, coreData);
20439
+ const newState = {
20857
20440
  x: uiData.x,
20858
- y: uiData.y
20859
- }; // Keep within bounds.
20441
+ y: uiData.y,
20442
+ slackX: 0,
20443
+ slackY: 0
20444
+ };
20860
20445
 
20861
- if (_this.props.bounds) {
20446
+ // Keep within bounds.
20447
+ if (this.props.bounds) {
20862
20448
  // Save original x and y.
20863
- var x = newState.x,
20864
- y = newState.y; // Add slack to the values used to calculate bound position. This will ensure that if
20449
+ const {
20450
+ x,
20451
+ y
20452
+ } = newState;
20453
+
20454
+ // Add slack to the values used to calculate bound position. This will ensure that if
20865
20455
  // we start removing slack, the element won't react to it right away until it's been
20866
20456
  // completely removed.
20457
+ newState.x += this.state.slackX;
20458
+ newState.y += this.state.slackY;
20867
20459
 
20868
- newState.x += _this.state.slackX;
20869
- newState.y += _this.state.slackY; // Get bound position. This will ceil/floor the x and y within the boundaries.
20870
-
20871
- var _getBoundPosition = (0, _positionFns.getBoundPosition)(_assertThisInitialized(_this), newState.x, newState.y),
20872
- _getBoundPosition2 = _slicedToArray(_getBoundPosition, 2),
20873
- newStateX = _getBoundPosition2[0],
20874
- newStateY = _getBoundPosition2[1];
20875
-
20460
+ // Get bound position. This will ceil/floor the x and y within the boundaries.
20461
+ const [newStateX, newStateY] = (0, _positionFns.getBoundPosition)(this, newState.x, newState.y);
20876
20462
  newState.x = newStateX;
20877
- newState.y = newStateY; // Recalculate slack by noting how much was shaved by the boundPosition handler.
20463
+ newState.y = newStateY;
20878
20464
 
20879
- newState.slackX = _this.state.slackX + (x - newState.x);
20880
- newState.slackY = _this.state.slackY + (y - newState.y); // Update the event we fire to reflect what really happened after bounds took effect.
20465
+ // Recalculate slack by noting how much was shaved by the boundPosition handler.
20466
+ newState.slackX = this.state.slackX + (x - newState.x);
20467
+ newState.slackY = this.state.slackY + (y - newState.y);
20881
20468
 
20469
+ // Update the event we fire to reflect what really happened after bounds took effect.
20882
20470
  uiData.x = newState.x;
20883
20471
  uiData.y = newState.y;
20884
- uiData.deltaX = newState.x - _this.state.x;
20885
- uiData.deltaY = newState.y - _this.state.y;
20886
- } // Short-circuit if user's callback killed it.
20887
-
20888
-
20889
- var shouldUpdate = _this.props.onDrag(e, uiData);
20472
+ uiData.deltaX = newState.x - this.state.x;
20473
+ uiData.deltaY = newState.y - this.state.y;
20474
+ }
20890
20475
 
20476
+ // Short-circuit if user's callback killed it.
20477
+ const shouldUpdate = this.props.onDrag(e, uiData);
20891
20478
  if (shouldUpdate === false) return false;
20892
-
20893
- _this.setState(newState);
20479
+ this.setState(newState);
20894
20480
  });
20481
+ _defineProperty(this, "onDragStop", (e, coreData) => {
20482
+ if (!this.state.dragging) return false;
20895
20483
 
20896
- _defineProperty(_assertThisInitialized(_this), "onDragStop", function (e, coreData) {
20897
- if (!_this.state.dragging) return false; // Short-circuit if user's callback killed it.
20898
-
20899
- var shouldContinue = _this.props.onStop(e, (0, _positionFns.createDraggableData)(_assertThisInitialized(_this), coreData));
20900
-
20484
+ // Short-circuit if user's callback killed it.
20485
+ const shouldContinue = this.props.onStop(e, (0, _positionFns.createDraggableData)(this, coreData));
20901
20486
  if (shouldContinue === false) return false;
20902
20487
  (0, _log.default)('Draggable: onDragStop: %j', coreData);
20903
- var newState
20904
- /*: $Shape<DraggableState>*/
20905
- = {
20488
+ const newState /*: Partial<DraggableState>*/ = {
20906
20489
  dragging: false,
20907
20490
  slackX: 0,
20908
20491
  slackY: 0
20909
- }; // If this is a controlled component, the result of this operation will be to
20910
- // revert back to the old position. We expect a handler on `onDragStop`, at the least.
20911
-
20912
- var controlled = Boolean(_this.props.position);
20492
+ };
20913
20493
 
20494
+ // If this is a controlled component, the result of this operation will be to
20495
+ // revert back to the old position. We expect a handler on `onDragStop`, at the least.
20496
+ const controlled = Boolean(this.props.position);
20914
20497
  if (controlled) {
20915
- var _this$props$position = _this.props.position,
20916
- x = _this$props$position.x,
20917
- y = _this$props$position.y;
20498
+ const {
20499
+ x,
20500
+ y
20501
+ } = this.props.position;
20918
20502
  newState.x = x;
20919
20503
  newState.y = y;
20920
20504
  }
20921
-
20922
- _this.setState(newState);
20505
+ this.setState(newState);
20923
20506
  });
20924
-
20925
- _this.state = {
20507
+ this.state = {
20926
20508
  // Whether or not we are currently dragging.
20927
20509
  dragging: false,
20928
20510
  // Whether or not we have been dragged before.
@@ -20930,142 +20512,106 @@ var Draggable = /*#__PURE__*/function (_React$Component) {
20930
20512
  // Current transform x and y.
20931
20513
  x: props.position ? props.position.x : props.defaultPosition.x,
20932
20514
  y: props.position ? props.position.y : props.defaultPosition.y,
20933
- prevPropsPosition: _objectSpread({}, props.position),
20515
+ prevPropsPosition: {
20516
+ ...props.position
20517
+ },
20934
20518
  // Used for compensating for out-of-bounds drags
20935
20519
  slackX: 0,
20936
20520
  slackY: 0,
20937
20521
  // Can only determine if SVG after mounting
20938
20522
  isElementSVG: false
20939
20523
  };
20940
-
20941
20524
  if (props.position && !(props.onDrag || props.onStop)) {
20942
20525
  // eslint-disable-next-line no-console
20943
20526
  console.warn('A `position` was applied to this <Draggable>, without drag handlers. This will make this ' + 'component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the ' + '`position` of this element.');
20944
20527
  }
20945
-
20946
- return _this;
20947
20528
  }
20948
-
20949
- _createClass(Draggable, [{
20950
- key: "componentDidMount",
20951
- value: function componentDidMount() {
20952
- // Check to see if the element passed is an instanceof SVGElement
20953
- if (typeof window.SVGElement !== 'undefined' && this.findDOMNode() instanceof window.SVGElement) {
20954
- this.setState({
20955
- isElementSVG: true
20956
- });
20957
- }
20958
- }
20959
- }, {
20960
- key: "componentWillUnmount",
20961
- value: function componentWillUnmount() {
20529
+ componentDidMount() {
20530
+ // Check to see if the element passed is an instanceof SVGElement
20531
+ if (typeof window.SVGElement !== 'undefined' && this.findDOMNode() instanceof window.SVGElement) {
20962
20532
  this.setState({
20963
- dragging: false
20964
- }); // prevents invariant if unmounted while dragging
20965
- } // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
20966
- // the underlying DOM node ourselves. See the README for more information.
20967
-
20968
- }, {
20969
- key: "findDOMNode",
20970
- value: function findDOMNode()
20971
- /*: ?HTMLElement*/
20972
- {
20973
- var _this$props$nodeRef$c, _this$props, _this$props$nodeRef;
20974
-
20975
- return (_this$props$nodeRef$c = (_this$props = this.props) === null || _this$props === void 0 ? void 0 : (_this$props$nodeRef = _this$props.nodeRef) === null || _this$props$nodeRef === void 0 ? void 0 : _this$props$nodeRef.current) !== null && _this$props$nodeRef$c !== void 0 ? _this$props$nodeRef$c : _reactDom.default.findDOMNode(this);
20976
- }
20977
- }, {
20978
- key: "render",
20979
- value: function render()
20980
- /*: ReactElement<any>*/
20981
- {
20982
- var _clsx;
20983
-
20984
- var _this$props2 = this.props;
20985
- _this$props2.axis;
20986
- _this$props2.bounds;
20987
- var children = _this$props2.children,
20988
- defaultPosition = _this$props2.defaultPosition,
20989
- defaultClassName = _this$props2.defaultClassName,
20990
- defaultClassNameDragging = _this$props2.defaultClassNameDragging,
20991
- defaultClassNameDragged = _this$props2.defaultClassNameDragged,
20992
- position = _this$props2.position,
20993
- positionOffset = _this$props2.positionOffset;
20994
- _this$props2.scale;
20995
- var draggableCoreProps = _objectWithoutProperties(_this$props2, _excluded);
20996
-
20997
- var style = {};
20998
- var svgTransform = null; // If this is controlled, we don't want to move it - unless it's dragging.
20999
-
21000
- var controlled = Boolean(position);
21001
- var draggable = !controlled || this.state.dragging;
21002
- var validPosition = position || defaultPosition;
21003
- var transformOpts = {
21004
- // Set left if horizontal drag is enabled
21005
- x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : validPosition.x,
21006
- // Set top if vertical drag is enabled
21007
- y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : validPosition.y
21008
- }; // If this element was SVG, we use the `transform` attribute.
21009
-
21010
- if (this.state.isElementSVG) {
21011
- svgTransform = (0, _domFns.createSVGTransform)(transformOpts, positionOffset);
21012
- } else {
21013
- // Add a CSS transform to move the element around. This allows us to move the element around
21014
- // without worrying about whether or not it is relatively or absolutely positioned.
21015
- // If the item you are dragging already has a transform set, wrap it in a <span> so <Draggable>
21016
- // has a clean slate.
21017
- style = (0, _domFns.createCSSTransform)(transformOpts, positionOffset);
21018
- } // Mark with class while dragging
21019
-
21020
-
21021
- var className = (0, _clsx2.default)(children.props.className || '', defaultClassName, (_clsx = {}, _defineProperty(_clsx, defaultClassNameDragging, this.state.dragging), _defineProperty(_clsx, defaultClassNameDragged, this.state.dragged), _clsx)); // Reuse the child provided
21022
- // This makes it flexible to use whatever element is wanted (div, ul, etc)
21023
-
21024
- return /*#__PURE__*/React.createElement(_DraggableCore.default, _extends({}, draggableCoreProps, {
21025
- onStart: this.onDragStart,
21026
- onDrag: this.onDrag,
21027
- onStop: this.onDragStop
21028
- }), /*#__PURE__*/React.cloneElement(React.Children.only(children), {
21029
- className: className,
21030
- style: _objectSpread(_objectSpread({}, children.props.style), style),
21031
- transform: svgTransform
21032
- }));
20533
+ isElementSVG: true
20534
+ });
21033
20535
  }
21034
- }], [{
21035
- key: "getDerivedStateFromProps",
21036
- value: // React 16.3+
21037
- // Arity (props, state)
21038
- function getDerivedStateFromProps(_ref, _ref2)
21039
- /*: ?$Shape<DraggableState>*/
21040
- {
21041
- var position = _ref.position;
21042
- var prevPropsPosition = _ref2.prevPropsPosition;
20536
+ }
20537
+ componentWillUnmount() {
20538
+ this.setState({
20539
+ dragging: false
20540
+ }); // prevents invariant if unmounted while dragging
20541
+ }
21043
20542
 
21044
- // Set x/y if a new position is provided in props that is different than the previous.
21045
- if (position && (!prevPropsPosition || position.x !== prevPropsPosition.x || position.y !== prevPropsPosition.y)) {
21046
- (0, _log.default)('Draggable: getDerivedStateFromProps %j', {
21047
- position: position,
21048
- prevPropsPosition: prevPropsPosition
21049
- });
21050
- return {
21051
- x: position.x,
21052
- y: position.y,
21053
- prevPropsPosition: _objectSpread({}, position)
21054
- };
21055
- }
20543
+ // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
20544
+ // the underlying DOM node ourselves. See the README for more information.
20545
+ findDOMNode() /*: ?HTMLElement*/{
20546
+ var _this$props$nodeRef$c, _this$props;
20547
+ return (_this$props$nodeRef$c = (_this$props = this.props) === null || _this$props === void 0 || (_this$props = _this$props.nodeRef) === null || _this$props === void 0 ? void 0 : _this$props.current) !== null && _this$props$nodeRef$c !== void 0 ? _this$props$nodeRef$c : _reactDom.default.findDOMNode(this);
20548
+ }
20549
+ render() /*: ReactElement<any>*/{
20550
+ const {
20551
+ axis,
20552
+ bounds,
20553
+ children,
20554
+ defaultPosition,
20555
+ defaultClassName,
20556
+ defaultClassNameDragging,
20557
+ defaultClassNameDragged,
20558
+ position,
20559
+ positionOffset,
20560
+ scale,
20561
+ ...draggableCoreProps
20562
+ } = this.props;
20563
+ let style = {};
20564
+ let svgTransform = null;
20565
+
20566
+ // If this is controlled, we don't want to move it - unless it's dragging.
20567
+ const controlled = Boolean(position);
20568
+ const draggable = !controlled || this.state.dragging;
20569
+ const validPosition = position || defaultPosition;
20570
+ const transformOpts = {
20571
+ // Set left if horizontal drag is enabled
20572
+ x: (0, _positionFns.canDragX)(this) && draggable ? this.state.x : validPosition.x,
20573
+ // Set top if vertical drag is enabled
20574
+ y: (0, _positionFns.canDragY)(this) && draggable ? this.state.y : validPosition.y
20575
+ };
21056
20576
 
21057
- return null;
20577
+ // If this element was SVG, we use the `transform` attribute.
20578
+ if (this.state.isElementSVG) {
20579
+ svgTransform = (0, _domFns.createSVGTransform)(transformOpts, positionOffset);
20580
+ } else {
20581
+ // Add a CSS transform to move the element around. This allows us to move the element around
20582
+ // without worrying about whether or not it is relatively or absolutely positioned.
20583
+ // If the item you are dragging already has a transform set, wrap it in a <span> so <Draggable>
20584
+ // has a clean slate.
20585
+ style = (0, _domFns.createCSSTransform)(transformOpts, positionOffset);
21058
20586
  }
21059
- }]);
21060
20587
 
21061
- return Draggable;
21062
- }(React.Component);
20588
+ // Mark with class while dragging
20589
+ const className = (0, _clsx.default)(children.props.className || '', defaultClassName, {
20590
+ [defaultClassNameDragging]: this.state.dragging,
20591
+ [defaultClassNameDragged]: this.state.dragged
20592
+ });
21063
20593
 
20594
+ // Reuse the child provided
20595
+ // This makes it flexible to use whatever element is wanted (div, ul, etc)
20596
+ return /*#__PURE__*/React.createElement(_DraggableCore.default, _extends({}, draggableCoreProps, {
20597
+ onStart: this.onDragStart,
20598
+ onDrag: this.onDrag,
20599
+ onStop: this.onDragStop
20600
+ }), /*#__PURE__*/React.cloneElement(React.Children.only(children), {
20601
+ className: className,
20602
+ style: {
20603
+ ...children.props.style,
20604
+ ...style
20605
+ },
20606
+ transform: svgTransform
20607
+ }));
20608
+ }
20609
+ }
21064
20610
  exports.default = Draggable;
21065
-
21066
20611
  _defineProperty(Draggable, "displayName", 'Draggable');
21067
-
21068
- _defineProperty(Draggable, "propTypes", _objectSpread(_objectSpread({}, _DraggableCore.default.propTypes), {}, {
20612
+ _defineProperty(Draggable, "propTypes", {
20613
+ // Accepts all props <DraggableCore> accepts.
20614
+ ..._DraggableCore.default.propTypes,
21069
20615
  /**
21070
20616
  * `axis` determines which axis the draggable can move.
21071
20617
  *
@@ -21080,7 +20626,6 @@ _defineProperty(Draggable, "propTypes", _objectSpread(_objectSpread({}, _Draggab
21080
20626
  * Defaults to 'both'.
21081
20627
  */
21082
20628
  axis: _propTypes.default.oneOf(['both', 'x', 'y', 'none']),
21083
-
21084
20629
  /**
21085
20630
  * `bounds` determines the range of movement available to the element.
21086
20631
  * Available values are:
@@ -21116,7 +20661,6 @@ _defineProperty(Draggable, "propTypes", _objectSpread(_objectSpread({}, _Draggab
21116
20661
  defaultClassName: _propTypes.default.string,
21117
20662
  defaultClassNameDragging: _propTypes.default.string,
21118
20663
  defaultClassNameDragged: _propTypes.default.string,
21119
-
21120
20664
  /**
21121
20665
  * `defaultPosition` specifies the x and y that the dragged item should start at
21122
20666
  *
@@ -21142,7 +20686,6 @@ _defineProperty(Draggable, "propTypes", _objectSpread(_objectSpread({}, _Draggab
21142
20686
  x: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
21143
20687
  y: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
21144
20688
  }),
21145
-
21146
20689
  /**
21147
20690
  * `position`, if present, defines the current position of the element.
21148
20691
  *
@@ -21167,16 +20710,15 @@ _defineProperty(Draggable, "propTypes", _objectSpread(_objectSpread({}, _Draggab
21167
20710
  x: _propTypes.default.number,
21168
20711
  y: _propTypes.default.number
21169
20712
  }),
21170
-
21171
20713
  /**
21172
20714
  * These properties should be defined on the child, not here.
21173
20715
  */
21174
20716
  className: _shims.dontSetMe,
21175
20717
  style: _shims.dontSetMe,
21176
20718
  transform: _shims.dontSetMe
21177
- }));
21178
-
21179
- _defineProperty(Draggable, "defaultProps", _objectSpread(_objectSpread({}, _DraggableCore.default.defaultProps), {}, {
20719
+ });
20720
+ _defineProperty(Draggable, "defaultProps", {
20721
+ ..._DraggableCore.default.defaultProps,
21180
20722
  axis: 'both',
21181
20723
  bounds: false,
21182
20724
  defaultClassName: 'react-draggable',
@@ -21187,16 +20729,17 @@ _defineProperty(Draggable, "defaultProps", _objectSpread(_objectSpread({}, _Drag
21187
20729
  y: 0
21188
20730
  },
21189
20731
  scale: 1
21190
- }));
20732
+ });
21191
20733
  }(Draggable$2));
21192
20734
 
21193
- var _require = Draggable$2,
21194
- Draggable = _require.default,
21195
- DraggableCore = _require.DraggableCore; // Previous versions of this lib exported <Draggable> as the root export. As to no-// them, or TypeScript, we export *both* as the root and as 'default'.
20735
+ const {
20736
+ default: Draggable,
20737
+ DraggableCore
20738
+ } = Draggable$2;
20739
+
20740
+ // Previous versions of this lib exported <Draggable> as the root export. As to no-// them, or TypeScript, we export *both* as the root and as 'default'.
21196
20741
  // See https://github.com/mzabriskie/react-draggable/pull/254
21197
20742
  // and https://github.com/mzabriskie/react-draggable/issues/266
21198
-
21199
-
21200
20743
  cjs.exports = Draggable;
21201
20744
  cjs.exports.default = Draggable;
21202
20745
  cjs.exports.DraggableCore = DraggableCore;
@@ -22161,11 +21704,11 @@ var ResizeComponent = function ResizeComponent(_a) {
22161
21704
  * ``` <ErrorBoundary><ExampleComponent /></ErrorBoundary> ```
22162
21705
  */
22163
21706
  var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
22164
- _inherits$1(ErrorBoundary, _React$Component);
22165
- var _super = _createSuper$1(ErrorBoundary);
21707
+ _inherits(ErrorBoundary, _React$Component);
21708
+ var _super = _createSuper(ErrorBoundary);
22166
21709
  function ErrorBoundary(props) {
22167
21710
  var _this;
22168
- _classCallCheck$1(this, ErrorBoundary);
21711
+ _classCallCheck(this, ErrorBoundary);
22169
21712
  _this = _super.call(this, props);
22170
21713
  _this.state = {
22171
21714
  error: undefined,
@@ -22173,7 +21716,7 @@ var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
22173
21716
  };
22174
21717
  return _this;
22175
21718
  }
22176
- _createClass$1(ErrorBoundary, [{
21719
+ _createClass(ErrorBoundary, [{
22177
21720
  key: "componentDidCatch",
22178
21721
  value: function componentDidCatch(error, errorInfo) {
22179
21722
  var onError = this.props.onError;
@@ -22891,11 +22434,11 @@ var DraggableComponent = function DraggableComponent(_a) {
22891
22434
  x: 0,
22892
22435
  y: 0
22893
22436
  }),
22894
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
22437
+ _React$useState2 = _slicedToArray(_React$useState, 2),
22895
22438
  position = _React$useState2[0],
22896
22439
  setPosition = _React$useState2[1];
22897
22440
  var _React$useState3 = React__default.useState(startSize),
22898
- _React$useState4 = _slicedToArray$1(_React$useState3, 2),
22441
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
22899
22442
  size = _React$useState4[0],
22900
22443
  setSize = _React$useState4[1];
22901
22444
  var isRightAligned = startPosition && startPosition.right !== null && startPosition.right !== undefined;
@@ -22904,7 +22447,7 @@ var DraggableComponent = function DraggableComponent(_a) {
22904
22447
  onDragEnd(position, size);
22905
22448
  }, [setPosition, onDragEnd, size]);
22906
22449
  var _React$useState5 = React__default.useState(defaultInitialMaxHeight),
22907
- _React$useState6 = _slicedToArray$1(_React$useState5, 2),
22450
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
22908
22451
  initialMaxHeight = _React$useState6[0],
22909
22452
  setInitialMaxHeight = _React$useState6[1];
22910
22453
  var onStartResize = function onStartResize() {
@@ -23316,7 +22859,7 @@ var styles$1 = {
23316
22859
  };
23317
22860
  var CheatSheet = function CheatSheet() {
23318
22861
  var _React$useState = React__default.useState(0),
23319
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
22862
+ _React$useState2 = _slicedToArray(_React$useState, 2),
23320
22863
  activeTab = _React$useState2[0],
23321
22864
  onChangeActiveTab = _React$useState2[1];
23322
22865
  var onChangeTab = function onChangeTab(_event, newValue) {
@@ -23347,7 +22890,7 @@ var CheatSheet = function CheatSheet() {
23347
22890
 
23348
22891
  var UserMenuItemCheatSheet = function UserMenuItemCheatSheet() {
23349
22892
  var _React$useState = React__default.useState(false),
23350
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
22893
+ _React$useState2 = _slicedToArray(_React$useState, 2),
23351
22894
  open = _React$useState2[0],
23352
22895
  setOpen = _React$useState2[1];
23353
22896
  var onClose = function onClose() {
@@ -23386,7 +22929,7 @@ var UserMenuItemCheatSheet = function UserMenuItemCheatSheet() {
23386
22929
  var useUserMenu = function useUserMenu() {
23387
22930
  var open = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
23388
22931
  var _React$useState = React__default.useState(open),
23389
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
22932
+ _React$useState2 = _slicedToArray(_React$useState, 2),
23390
22933
  isOpen = _React$useState2[0],
23391
22934
  setOpen = _React$useState2[1];
23392
22935
  var onClose = function onClose() {
@@ -23626,7 +23169,7 @@ var ToggleMenu = function ToggleMenu(_ref) {
23626
23169
  _ref$isDisabled = _ref.isDisabled,
23627
23170
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
23628
23171
  var _React$useState = React$1.useState(null),
23629
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
23172
+ _React$useState2 = _slicedToArray(_React$useState, 2),
23630
23173
  anchorEl = _React$useState2[0],
23631
23174
  setAnchorEl = _React$useState2[1];
23632
23175
  var isOpen = Boolean(anchorEl);
@@ -23810,11 +23353,11 @@ var TooltipSelect = function TooltipSelect(_a) {
23810
23353
  hasBackgroundColor = _a.hasBackgroundColor,
23811
23354
  props = __rest(_a, ["tooltip", "list", "currentIndex", "onChangeMouseWheel", "requiresCtrlToChange", "isEnabled", "noStyling", "hasBackgroundColor"]);
23812
23355
  var _React$useState = React$1.useState(false),
23813
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
23356
+ _React$useState2 = _slicedToArray(_React$useState, 2),
23814
23357
  selectOpen = _React$useState2[0],
23815
23358
  setSelectOpen = _React$useState2[1];
23816
23359
  var _useControlledTooltip = useControlledTooltip(),
23817
- _useControlledTooltip2 = _slicedToArray$1(_useControlledTooltip, 2),
23360
+ _useControlledTooltip2 = _slicedToArray(_useControlledTooltip, 2),
23818
23361
  tooltipOpen = _useControlledTooltip2[0],
23819
23362
  setTooltipOpen = _useControlledTooltip2[1];
23820
23363
  var theme = useTheme();
@@ -24385,12 +23928,12 @@ function getContext() {
24385
23928
 
24386
23929
  const ReactReduxContext = /*#__PURE__*/getContext();
24387
23930
 
24388
- /**
24389
- * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
24390
- * hook that you should usually not need to call directly.
24391
- *
24392
- * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
24393
- * @returns {Function} A `useReduxContext` hook bound to the specified context.
23931
+ /**
23932
+ * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
23933
+ * hook that you should usually not need to call directly.
23934
+ *
23935
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
23936
+ * @returns {Function} A `useReduxContext` hook bound to the specified context.
24394
23937
  */
24395
23938
  function createReduxContextHook(context = ReactReduxContext) {
24396
23939
  return function useReduxContext() {
@@ -24403,21 +23946,21 @@ function createReduxContextHook(context = ReactReduxContext) {
24403
23946
  return contextValue;
24404
23947
  };
24405
23948
  }
24406
- /**
24407
- * A hook to access the value of the `ReactReduxContext`. This is a low-level
24408
- * hook that you should usually not need to call directly.
24409
- *
24410
- * @returns {any} the value of the `ReactReduxContext`
24411
- *
24412
- * @example
24413
- *
24414
- * import React from 'react'
24415
- * import { useReduxContext } from 'react-redux'
24416
- *
24417
- * export const CounterComponent = () => {
24418
- * const { store } = useReduxContext()
24419
- * return <div>{store.getState()}</div>
24420
- * }
23949
+ /**
23950
+ * A hook to access the value of the `ReactReduxContext`. This is a low-level
23951
+ * hook that you should usually not need to call directly.
23952
+ *
23953
+ * @returns {any} the value of the `ReactReduxContext`
23954
+ *
23955
+ * @example
23956
+ *
23957
+ * import React from 'react'
23958
+ * import { useReduxContext } from 'react-redux'
23959
+ *
23960
+ * export const CounterComponent = () => {
23961
+ * const { store } = useReduxContext()
23962
+ * return <div>{store.getState()}</div>
23963
+ * }
24421
23964
  */
24422
23965
 
24423
23966
  const useReduxContext = /*#__PURE__*/createReduxContextHook();
@@ -24888,11 +24431,11 @@ reactIs_development.typeOf = typeOf;
24888
24431
 
24889
24432
  if (process.env.NODE_ENV === 'production') ;
24890
24433
 
24891
- /**
24892
- * Hook factory, which creates a `useStore` hook bound to a given context.
24893
- *
24894
- * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
24895
- * @returns {Function} A `useStore` hook bound to the specified context.
24434
+ /**
24435
+ * Hook factory, which creates a `useStore` hook bound to a given context.
24436
+ *
24437
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
24438
+ * @returns {Function} A `useStore` hook bound to the specified context.
24896
24439
  */
24897
24440
 
24898
24441
  function createStoreHook(context = ReactReduxContext) {
@@ -24907,20 +24450,20 @@ function createStoreHook(context = ReactReduxContext) {
24907
24450
  return store;
24908
24451
  };
24909
24452
  }
24910
- /**
24911
- * A hook to access the redux store.
24912
- *
24913
- * @returns {any} the redux store
24914
- *
24915
- * @example
24916
- *
24917
- * import React from 'react'
24918
- * import { useStore } from 'react-redux'
24919
- *
24920
- * export const ExampleComponent = () => {
24921
- * const store = useStore()
24922
- * return <div>{store.getState()}</div>
24923
- * }
24453
+ /**
24454
+ * A hook to access the redux store.
24455
+ *
24456
+ * @returns {any} the redux store
24457
+ *
24458
+ * @example
24459
+ *
24460
+ * import React from 'react'
24461
+ * import { useStore } from 'react-redux'
24462
+ *
24463
+ * export const ExampleComponent = () => {
24464
+ * const store = useStore()
24465
+ * return <div>{store.getState()}</div>
24466
+ * }
24924
24467
  */
24925
24468
 
24926
24469
  const useStore = /*#__PURE__*/createStoreHook();
@@ -24932,7 +24475,7 @@ function withEggs(eggs) {
24932
24475
  var _React$useState = React$1.useState(function () {
24933
24476
  return store.addEggs(eggs);
24934
24477
  }),
24935
- _React$useState2 = _slicedToArray$1(_React$useState, 1),
24478
+ _React$useState2 = _slicedToArray(_React$useState, 1),
24936
24479
  remover = _React$useState2[0];
24937
24480
  React$1.useEffect(function () {
24938
24481
  return remover;
@@ -24960,7 +24503,7 @@ var CustomAccordion = function CustomAccordion(_a) {
24960
24503
  children = _a.children,
24961
24504
  props = __rest(_a, ["title", "defaultExpanded", "disableGutters", "expandedElevation", "collapsedElevation", "transitionDuration", "detailsSx", "children"]);
24962
24505
  var _React$useState = React$1.useState(defaultExpanded),
24963
- _React$useState2 = _slicedToArray$1(_React$useState, 2),
24506
+ _React$useState2 = _slicedToArray(_React$useState, 2),
24964
24507
  expanded = _React$useState2[0],
24965
24508
  setExpanded = _React$useState2[1];
24966
24509
  return /*#__PURE__*/React$1.createElement(Accordion, Object.assign({}, props, {
@@ -26594,6 +26137,56 @@ function isPlainObject(value) {
26594
26137
  }
26595
26138
  return proto === baseProto;
26596
26139
  }
26140
+ // src/tsHelpers.ts
26141
+ var hasMatchFunction = function (v) {
26142
+ return v && typeof v.match === "function";
26143
+ };
26144
+ // src/createAction.ts
26145
+ function createAction(type, prepareAction) {
26146
+ function actionCreator() {
26147
+ var args = [];
26148
+ for (var _i = 0; _i < arguments.length; _i++) {
26149
+ args[_i] = arguments[_i];
26150
+ }
26151
+ if (prepareAction) {
26152
+ var prepared = prepareAction.apply(void 0, args);
26153
+ if (!prepared) {
26154
+ throw new Error("prepareAction did not return an object");
26155
+ }
26156
+ return __spreadValues(__spreadValues({
26157
+ type: type,
26158
+ payload: prepared.payload
26159
+ }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
26160
+ }
26161
+ return { type: type, payload: args[0] };
26162
+ }
26163
+ actionCreator.toString = function () { return "" + type; };
26164
+ actionCreator.type = type;
26165
+ actionCreator.match = function (action) { return action.type === type; };
26166
+ return actionCreator;
26167
+ }
26168
+ function isActionCreator(action) {
26169
+ return typeof action === "function" && "type" in action && hasMatchFunction(action);
26170
+ }
26171
+ // src/actionCreatorInvariantMiddleware.ts
26172
+ function getMessage(type) {
26173
+ var splitType = type ? ("" + type).split("/") : [];
26174
+ var actionName = splitType[splitType.length - 1] || "actionCreator";
26175
+ return "Detected an action creator with type \"" + (type || "unknown") + "\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. `dispatch(" + actionName + "())` instead of `dispatch(" + actionName + ")`. This is necessary even if the action has no payload.";
26176
+ }
26177
+ function createActionCreatorInvariantMiddleware(options) {
26178
+ if (options === void 0) { options = {}; }
26179
+ if (process.env.NODE_ENV === "production") {
26180
+ return function () { return function (next) { return function (action) { return next(action); }; }; };
26181
+ }
26182
+ var _c = options.isActionCreator, isActionCreator2 = _c === void 0 ? isActionCreator : _c;
26183
+ return function () { return function (next) { return function (action) {
26184
+ if (isActionCreator2(action)) {
26185
+ console.warn(getMessage(action.type));
26186
+ }
26187
+ return next(action);
26188
+ }; }; };
26189
+ }
26597
26190
  function getTimeMeasureUtils(maxDelay, fnName) {
26598
26191
  var elapsed = 0;
26599
26192
  return {
@@ -26735,11 +26328,13 @@ function trackForMutations(isImmutable, ignorePaths, obj) {
26735
26328
  }
26736
26329
  };
26737
26330
  }
26738
- function trackProperties(isImmutable, ignorePaths, obj, path) {
26331
+ function trackProperties(isImmutable, ignorePaths, obj, path, checkedObjects) {
26739
26332
  if (ignorePaths === void 0) { ignorePaths = []; }
26740
26333
  if (path === void 0) { path = ""; }
26334
+ if (checkedObjects === void 0) { checkedObjects = new Set(); }
26741
26335
  var tracked = { value: obj };
26742
- if (!isImmutable(obj)) {
26336
+ if (!isImmutable(obj) && !checkedObjects.has(obj)) {
26337
+ checkedObjects.add(obj);
26743
26338
  tracked.children = {};
26744
26339
  for (var key in obj) {
26745
26340
  var childPath = path ? path + "." + key : key;
@@ -26944,7 +26539,7 @@ function curryGetDefaultMiddleware() {
26944
26539
  }
26945
26540
  function getDefaultMiddleware(options) {
26946
26541
  if (options === void 0) { options = {}; }
26947
- var _c = options.thunk, thunk = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e;
26542
+ var _c = options.thunk, thunk = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e, _f = options.actionCreatorCheck, actionCreatorCheck = _f === void 0 ? true : _f;
26948
26543
  var middlewareArray = new MiddlewareArray();
26949
26544
  if (thunk) {
26950
26545
  if (isBoolean(thunk)) {
@@ -26969,6 +26564,13 @@ function getDefaultMiddleware(options) {
26969
26564
  }
26970
26565
  middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
26971
26566
  }
26567
+ if (actionCreatorCheck) {
26568
+ var actionCreatorOptions = {};
26569
+ if (!isBoolean(actionCreatorCheck)) {
26570
+ actionCreatorOptions = actionCreatorCheck;
26571
+ }
26572
+ middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
26573
+ }
26972
26574
  }
26973
26575
  return middlewareArray;
26974
26576
  }
@@ -27015,30 +26617,6 @@ function configureStore(options) {
27015
26617
  var composedEnhancer = finalCompose.apply(void 0, storeEnhancers);
27016
26618
  return createStore(rootReducer, preloadedState, composedEnhancer);
27017
26619
  }
27018
- // src/createAction.ts
27019
- function createAction(type, prepareAction) {
27020
- function actionCreator() {
27021
- var args = [];
27022
- for (var _i = 0; _i < arguments.length; _i++) {
27023
- args[_i] = arguments[_i];
27024
- }
27025
- if (prepareAction) {
27026
- var prepared = prepareAction.apply(void 0, args);
27027
- if (!prepared) {
27028
- throw new Error("prepareAction did not return an object");
27029
- }
27030
- return __spreadValues(__spreadValues({
27031
- type: type,
27032
- payload: prepared.payload
27033
- }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error });
27034
- }
27035
- return { type: type, payload: args[0] };
27036
- }
27037
- actionCreator.toString = function () { return "" + type; };
27038
- actionCreator.type = type;
27039
- actionCreator.match = function (action) { return action.type === type; };
27040
- return actionCreator;
27041
- }
27042
26620
  // src/nanoid.ts
27043
26621
  var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
27044
26622
  var nanoid = function (size) {