dragselect 2.5.4 → 2.5.6

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.
@@ -1,6 +1,6 @@
1
1
  /***
2
2
 
3
- ~~~ Version 2.5.4 ~~~
3
+ ~~~ Version 2.5.6 ~~~
4
4
 
5
5
  ******************************************
6
6
 
@@ -25,10 +25,58 @@
25
25
  ********* The MIT License (MIT) **********
26
26
  ******************************************
27
27
  Created 2017 by ThibaultJanBeyer
28
- web: http://www.thibaultjanbeyer.com/
28
+ web: http://www.DragSelect.com/
29
29
  github: https://github.com/ThibaultJanBeyer/DragSelect
30
30
 
31
31
  */
32
+ function _iterableToArrayLimit(arr, i) {
33
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
34
+ if (null != _i) {
35
+ var _s,
36
+ _e,
37
+ _x,
38
+ _r,
39
+ _arr = [],
40
+ _n = !0,
41
+ _d = !1;
42
+ try {
43
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
44
+ if (Object(_i) !== _i) return;
45
+ _n = !1;
46
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
47
+ } catch (err) {
48
+ _d = !0, _e = err;
49
+ } finally {
50
+ try {
51
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
52
+ } finally {
53
+ if (_d) throw _e;
54
+ }
55
+ }
56
+ return _arr;
57
+ }
58
+ }
59
+ function ownKeys(object, enumerableOnly) {
60
+ var keys = Object.keys(object);
61
+ if (Object.getOwnPropertySymbols) {
62
+ var symbols = Object.getOwnPropertySymbols(object);
63
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
64
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65
+ })), keys.push.apply(keys, symbols);
66
+ }
67
+ return keys;
68
+ }
69
+ function _objectSpread2(target) {
70
+ for (var i = 1; i < arguments.length; i++) {
71
+ var source = null != arguments[i] ? arguments[i] : {};
72
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
73
+ _defineProperty(target, key, source[key]);
74
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
75
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
76
+ });
77
+ }
78
+ return target;
79
+ }
32
80
  function _classCallCheck(instance, Constructor) {
33
81
  if (!(instance instanceof Constructor)) {
34
82
  throw new TypeError("Cannot call a class as a function");
@@ -40,15 +88,19 @@ function _defineProperties(target, props) {
40
88
  descriptor.enumerable = descriptor.enumerable || false;
41
89
  descriptor.configurable = true;
42
90
  if ("value" in descriptor) descriptor.writable = true;
43
- Object.defineProperty(target, descriptor.key, descriptor);
91
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
44
92
  }
45
93
  }
46
94
  function _createClass(Constructor, protoProps, staticProps) {
47
95
  if (protoProps) _defineProperties(Constructor.prototype, protoProps);
48
96
  if (staticProps) _defineProperties(Constructor, staticProps);
97
+ Object.defineProperty(Constructor, "prototype", {
98
+ writable: false
99
+ });
49
100
  return Constructor;
50
101
  }
51
102
  function _defineProperty(obj, key, value) {
103
+ key = _toPropertyKey(key);
52
104
  if (key in obj) {
53
105
  Object.defineProperty(obj, key, {
54
106
  value: value,
@@ -61,34 +113,6 @@ function _defineProperty(obj, key, value) {
61
113
  }
62
114
  return obj;
63
115
  }
64
- function ownKeys(object, enumerableOnly) {
65
- var keys = Object.keys(object);
66
- if (Object.getOwnPropertySymbols) {
67
- var symbols = Object.getOwnPropertySymbols(object);
68
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
69
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
70
- });
71
- keys.push.apply(keys, symbols);
72
- }
73
- return keys;
74
- }
75
- function _objectSpread2(target) {
76
- for (var i = 1; i < arguments.length; i++) {
77
- var source = arguments[i] != null ? arguments[i] : {};
78
- if (i % 2) {
79
- ownKeys(Object(source), true).forEach(function (key) {
80
- _defineProperty(target, key, source[key]);
81
- });
82
- } else if (Object.getOwnPropertyDescriptors) {
83
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
84
- } else {
85
- ownKeys(Object(source)).forEach(function (key) {
86
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
87
- });
88
- }
89
- }
90
- return target;
91
- }
92
116
  function _inherits(subClass, superClass) {
93
117
  if (typeof superClass !== "function" && superClass !== null) {
94
118
  throw new TypeError("Super expression must either be null or a function");
@@ -100,16 +124,19 @@ function _inherits(subClass, superClass) {
100
124
  configurable: true
101
125
  }
102
126
  });
127
+ Object.defineProperty(subClass, "prototype", {
128
+ writable: false
129
+ });
103
130
  if (superClass) _setPrototypeOf(subClass, superClass);
104
131
  }
105
132
  function _getPrototypeOf(o) {
106
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
133
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
107
134
  return o.__proto__ || Object.getPrototypeOf(o);
108
135
  };
109
136
  return _getPrototypeOf(o);
110
137
  }
111
138
  function _setPrototypeOf(o, p) {
112
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
139
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
113
140
  o.__proto__ = p;
114
141
  return o;
115
142
  };
@@ -120,7 +147,7 @@ function _isNativeReflectConstruct() {
120
147
  if (Reflect.construct.sham) return false;
121
148
  if (typeof Proxy === "function") return true;
122
149
  try {
123
- Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
150
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
124
151
  return true;
125
152
  } catch (e) {
126
153
  return false;
@@ -128,7 +155,7 @@ function _isNativeReflectConstruct() {
128
155
  }
129
156
  function _construct(Parent, args, Class) {
130
157
  if (_isNativeReflectConstruct()) {
131
- _construct = Reflect.construct;
158
+ _construct = Reflect.construct.bind();
132
159
  } else {
133
160
  _construct = function _construct(Parent, args, Class) {
134
161
  var a = [null];
@@ -179,6 +206,8 @@ function _assertThisInitialized(self) {
179
206
  function _possibleConstructorReturn(self, call) {
180
207
  if (call && (typeof call === "object" || typeof call === "function")) {
181
208
  return call;
209
+ } else if (call !== void 0) {
210
+ throw new TypeError("Derived constructors may only return object or undefined");
182
211
  }
183
212
  return _assertThisInitialized(self);
184
213
  }
@@ -203,21 +232,21 @@ function _superPropBase(object, property) {
203
232
  }
204
233
  return object;
205
234
  }
206
- function _get(target, property, receiver) {
235
+ function _get() {
207
236
  if (typeof Reflect !== "undefined" && Reflect.get) {
208
- _get = Reflect.get;
237
+ _get = Reflect.get.bind();
209
238
  } else {
210
239
  _get = function _get(target, property, receiver) {
211
240
  var base = _superPropBase(target, property);
212
241
  if (!base) return;
213
242
  var desc = Object.getOwnPropertyDescriptor(base, property);
214
243
  if (desc.get) {
215
- return desc.get.call(receiver);
244
+ return desc.get.call(arguments.length < 3 ? target : receiver);
216
245
  }
217
246
  return desc.value;
218
247
  };
219
248
  }
220
- return _get(target, property, receiver || target);
249
+ return _get.apply(this, arguments);
221
250
  }
222
251
  function _slicedToArray(arr, i) {
223
252
  return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
@@ -232,30 +261,7 @@ function _arrayWithHoles(arr) {
232
261
  if (Array.isArray(arr)) return arr;
233
262
  }
234
263
  function _iterableToArray(iter) {
235
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
236
- }
237
- function _iterableToArrayLimit(arr, i) {
238
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
239
- var _arr = [];
240
- var _n = true;
241
- var _d = false;
242
- var _e = undefined;
243
- try {
244
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
245
- _arr.push(_s.value);
246
- if (i && _arr.length === i) break;
247
- }
248
- } catch (err) {
249
- _d = true;
250
- _e = err;
251
- } finally {
252
- try {
253
- if (!_n && _i["return"] != null) _i["return"]();
254
- } finally {
255
- if (_d) throw _e;
256
- }
257
- }
258
- return _arr;
264
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
259
265
  }
260
266
  function _unsupportedIterableToArray(o, minLen) {
261
267
  if (!o) return;
@@ -277,8 +283,8 @@ function _nonIterableRest() {
277
283
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
278
284
  }
279
285
  function _createForOfIteratorHelper(o, allowArrayLike) {
280
- var it;
281
- if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
286
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
287
+ if (!it) {
282
288
  if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
283
289
  if (it) o = it;
284
290
  var i = 0;
@@ -307,7 +313,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
307
313
  err;
308
314
  return {
309
315
  s: function () {
310
- it = o[Symbol.iterator]();
316
+ it = it.call(o);
311
317
  },
312
318
  n: function () {
313
319
  var step = it.next();
@@ -327,6 +333,20 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
327
333
  }
328
334
  };
329
335
  }
336
+ function _toPrimitive(input, hint) {
337
+ if (typeof input !== "object" || input === null) return input;
338
+ var prim = input[Symbol.toPrimitive];
339
+ if (prim !== undefined) {
340
+ var res = prim.call(input, hint || "default");
341
+ if (typeof res !== "object") return res;
342
+ throw new TypeError("@@toPrimitive must return a primitive value.");
343
+ }
344
+ return (hint === "string" ? String : Number)(input);
345
+ }
346
+ function _toPropertyKey(arg) {
347
+ var key = _toPrimitive(arg, "string");
348
+ return typeof key === "symbol" ? key : String(key);
349
+ }
330
350
 
331
351
  /**
332
352
  * The Settings to be passed to the Class
@@ -1488,6 +1508,7 @@ var Area = /*#__PURE__*/function () {
1488
1508
  _defineProperty(this, "_computedBorder", void 0);
1489
1509
  _defineProperty(this, "_rect", void 0);
1490
1510
  _defineProperty(this, "setArea", function (area) {
1511
+ _this.reset();
1491
1512
  _this._node = area;
1492
1513
  handleElementPositionAttribute({
1493
1514
  computedStyle: _this.computedStyle,
@@ -1542,7 +1563,7 @@ var Area = /*#__PURE__*/function () {
1542
1563
  // @ts-ignore: @todo: update to typescript
1543
1564
  this.DS.PubSub.subscribe('Settings:updated:area', function (_ref2) {
1544
1565
  var settings = _ref2.settings;
1545
- return _this.setArea(settings.area);
1566
+ _this.setArea(settings.area);
1546
1567
  });
1547
1568
  this.DS.PubSub.subscribe('Interaction:init', this.start);
1548
1569
  this.DS.PubSub.subscribe('Interaction:end', this.reset);
@@ -1551,12 +1572,15 @@ var Area = /*#__PURE__*/function () {
1551
1572
  /** @param {DSArea} area */
1552
1573
  _createClass(Area, [{
1553
1574
  key: "HTMLNode",
1575
+ get:
1554
1576
  /// ///////////////////////////////////////////////////////////////////////////////////
1555
1577
  // Node Getters
1556
- get: function get() {
1578
+
1579
+ function get() {
1557
1580
  return (/** @type {DSArea} */this._node
1558
1581
  );
1559
1582
  }
1583
+
1560
1584
  /**
1561
1585
  * The computed border from the element (caches result)
1562
1586
  * @type {{top:number,bottom:number,left:number,right:number}}
@@ -1572,6 +1596,7 @@ var Area = /*#__PURE__*/function () {
1572
1596
  right: parseInt(this.computedStyle.borderRightWidth)
1573
1597
  };
1574
1598
  }
1599
+
1575
1600
  /**
1576
1601
  * The computed styles from the element (caches result)
1577
1602
  * @type {CSSStyleDeclaration}
@@ -1583,6 +1608,7 @@ var Area = /*#__PURE__*/function () {
1583
1608
  if (this.HTMLNode instanceof Document) return this._computedStyle = window.getComputedStyle(this.HTMLNode.body || this.HTMLNode.documentElement);
1584
1609
  return this._computedStyle = window.getComputedStyle(this.HTMLNode);
1585
1610
  }
1611
+
1586
1612
  /**
1587
1613
  * The element rect (caches result) (without scrollbar or borders)
1588
1614
  * @type {DSBoundingRect}
@@ -1960,6 +1986,7 @@ var DropZone = /*#__PURE__*/function () {
1960
1986
  this._itemsInside = null;
1961
1987
  this.isDestroyed = true;
1962
1988
  }
1989
+
1963
1990
  /**
1964
1991
  * @returns {DSDropZone}
1965
1992
  */
@@ -2013,7 +2040,7 @@ var DropZone = /*#__PURE__*/function () {
2013
2040
  return DropZone;
2014
2041
  }();
2015
2042
 
2016
- var DropZones =
2043
+ var DropZones = /*#__PURE__*/_createClass(
2017
2044
  /**
2018
2045
  * Get the drop zone by the zone element
2019
2046
  * @type {Map<DSElement, DropZone>}
@@ -2142,7 +2169,7 @@ function DropZones(_ref) {
2142
2169
  /**
2143
2170
  * @param {Object} obj
2144
2171
  * @param {DSDropZone[]} [obj.dropZones]
2145
- */;
2172
+ */);
2146
2173
 
2147
2174
  var Interaction = /*#__PURE__*/function () {
2148
2175
  /** @type {boolean} */
@@ -2214,6 +2241,7 @@ var Interaction = /*#__PURE__*/function () {
2214
2241
  var event = _ref2.event;
2215
2242
  if (!_this._canInteract(event)) return;
2216
2243
  if (event.detail > 0) return; // mouse interaction
2244
+
2217
2245
  var _this$DS = _this.DS,
2218
2246
  _this$DS$stores = _this$DS.stores,
2219
2247
  PointerStore = _this$DS$stores.PointerStore,
@@ -2228,22 +2256,23 @@ var Interaction = /*#__PURE__*/function () {
2228
2256
  _this.reset(); // simulate mouse-up (that does not exist on keyboard)
2229
2257
  });
2230
2258
  _defineProperty(this, "stop", function () {
2259
+ var area = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.DS.Area.HTMLNode;
2231
2260
  _this.isInteracting = false;
2232
2261
  _this.isDragging = false;
2233
2262
 
2234
2263
  // @TODO: fix pointer events mixing issue see [PR](https://github.com/ThibaultJanBeyer/DragSelect/pull/128#issuecomment-1154885289)
2235
2264
  if (_this.Settings.usePointerEvents) {
2236
- _this.DS.Area.HTMLNode.removeEventListener('pointerdown', _this.start, {
2265
+ area.removeEventListener('pointerdown', _this.start, {
2237
2266
  // @ts-ignore
2238
2267
  passive: false
2239
2268
  });
2240
2269
  document.removeEventListener('pointerup', _this.reset);
2241
2270
  document.removeEventListener('pointercancel', _this.reset);
2242
2271
  } else {
2243
- _this.DS.Area.HTMLNode.removeEventListener('mousedown', _this.start);
2272
+ area.removeEventListener('mousedown', _this.start);
2244
2273
  document.removeEventListener('mouseup', _this.reset);
2245
2274
  }
2246
- _this.DS.Area.HTMLNode.removeEventListener('touchstart', _this.start, {
2275
+ area.removeEventListener('touchstart', _this.start, {
2247
2276
  // @ts-ignore
2248
2277
  passive: false
2249
2278
  });
@@ -2278,30 +2307,35 @@ var Interaction = /*#__PURE__*/function () {
2278
2307
  this.DS = DS;
2279
2308
  this.Settings = DS.stores.SettingsStore.s;
2280
2309
  // @ts-ignore: @todo: update to typescript
2281
- this.DS.subscribe('Settings:updated:area', this.init);
2310
+ this.DS.subscribe('Settings:updated:area', function (_ref4) {
2311
+ var settings = _ref4.settings;
2312
+ _this.stop(settings['area:pre']);
2313
+ _this.init();
2314
+ });
2282
2315
  this.DS.subscribe('PointerStore:updated', this.update);
2283
2316
  this.DS.subscribe('Selectable:click', this.onClick);
2284
- this.DS.subscribe('Selectable:pointer', function (_ref4) {
2285
- var event = _ref4.event;
2317
+ this.DS.subscribe('Selectable:pointer', function (_ref5) {
2318
+ var event = _ref5.event;
2286
2319
  return _this.start(event);
2287
2320
  });
2288
- this.DS.subscribe('Interaction:start:pre', function (_ref5) {
2289
- var event = _ref5.event;
2321
+ this.DS.subscribe('Interaction:start:pre', function (_ref6) {
2322
+ var event = _ref6.event;
2290
2323
  return _this._start(event);
2291
2324
  });
2292
2325
  this.DS.subscribe('Interaction:init:pre', this._init);
2293
- this.DS.subscribe('Interaction:end:pre', function (_ref6) {
2294
- var event = _ref6.event;
2326
+ this.DS.subscribe('Interaction:end:pre', function (_ref7) {
2327
+ var event = _ref7.event;
2295
2328
  return _this._reset(event);
2296
2329
  });
2297
2330
  this.DS.subscribe('Area:scroll', this.update);
2298
2331
  }
2299
2332
  _createClass(Interaction, [{
2300
2333
  key: "_canInteract",
2334
+ value:
2301
2335
  /**
2302
2336
  * @param {DSEvent} event
2303
2337
  */
2304
- value: function _canInteract(event) {
2338
+ function _canInteract(event) {
2305
2339
  var isKeyboardClick = /** @type {MouseEvent} */event.clientX === 0 && /** @type {MouseEvent} */event.clientY === 0 && /** @type {MouseEvent} */event.detail === 0 && event.target;
2306
2340
  if ( /** @type {MouseEvent} */event.button === 2 ||
2307
2341
  // right-clicks
@@ -2313,6 +2347,7 @@ var Interaction = /*#__PURE__*/function () {
2313
2347
  ) return false;
2314
2348
  return true;
2315
2349
  }
2350
+
2316
2351
  /**
2317
2352
  * @param {DSEvent} event
2318
2353
  */
@@ -2320,7 +2355,7 @@ var Interaction = /*#__PURE__*/function () {
2320
2355
  return Interaction;
2321
2356
  }();
2322
2357
 
2323
- var PubSub = function PubSub(_ref) {
2358
+ var PubSub = /*#__PURE__*/_createClass(function PubSub(_ref) {
2324
2359
  var _this = this;
2325
2360
  var DS = _ref.DS;
2326
2361
  _classCallCheck(this, PubSub);
@@ -2368,7 +2403,7 @@ var PubSub = function PubSub(_ref) {
2368
2403
  * @param {DSCallbackNames} eventName
2369
2404
  * @param {DSCallback} callback
2370
2405
  * @returns {number} event id, can be used to unsubscribe more efficiently
2371
- */;
2406
+ */);
2372
2407
 
2373
2408
  var SelectableSet = /*#__PURE__*/function (_Set) {
2374
2409
  _inherits(SelectableSet, _Set);
@@ -2445,7 +2480,8 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
2445
2480
  }
2446
2481
  _createClass(SelectableSet, [{
2447
2482
  key: "add",
2448
- /** @param {DSElement} element */value: function add(element) {
2483
+ value: /** @param {DSElement} element */
2484
+ function add(element) {
2449
2485
  if (_get(_getPrototypeOf(SelectableSet.prototype), "has", this).call(this, element)) return;
2450
2486
  var publishData = {
2451
2487
  items: this.elements,
@@ -2468,7 +2504,9 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
2468
2504
  });
2469
2505
  this.DS.publish('Selectable:added', publishData);
2470
2506
  return _get(_getPrototypeOf(SelectableSet.prototype), "add", this).call(this, element);
2471
- } /** @param {DSElement} element */
2507
+ }
2508
+
2509
+ /** @param {DSElement} element */
2472
2510
  }, {
2473
2511
  key: "delete",
2474
2512
  value: function _delete(element) {
@@ -2494,7 +2532,8 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
2494
2532
  }
2495
2533
  }, {
2496
2534
  key: "elements",
2497
- /** @return {DSElements} */get: function get() {
2535
+ get: /** @return {DSElements} */
2536
+ function get() {
2498
2537
  return Array.from(this.values());
2499
2538
  }
2500
2539
  }, {
@@ -2565,7 +2604,9 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
2565
2604
  element.style.zIndex = "".concat((parseInt(element.style.zIndex) || 0) + 1);
2566
2605
  this.DS.publish('Selected:added', publishData);
2567
2606
  return this;
2568
- } /** @param {DSElement} element */
2607
+ }
2608
+
2609
+ /** @param {DSElement} element */
2569
2610
  }, {
2570
2611
  key: "delete",
2571
2612
  value: function _delete(element) {
@@ -2583,18 +2624,22 @@ var SelectedSet = /*#__PURE__*/function (_Set) {
2583
2624
  }
2584
2625
  }, {
2585
2626
  key: "toggle",
2627
+ value:
2586
2628
  /**
2587
2629
  * Adds/Removes an element. If it is already selected = remove, if not = add.
2588
2630
  * @param {DSElement} element
2589
2631
  * @return {DSElement}
2590
2632
  */
2591
- value: function toggle(element) {
2633
+ function toggle(element) {
2592
2634
  if (this.has(element)) this["delete"](element);else this.add(element);
2593
2635
  return element;
2594
- } /** @param {DSElements} elements */
2636
+ }
2637
+
2638
+ /** @param {DSElements} elements */
2595
2639
  }, {
2596
2640
  key: "elements",
2597
- /** @return {DSElements} */get: function get() {
2641
+ get: /** @return {DSElements} */
2642
+ function get() {
2598
2643
  return Array.from(this.values());
2599
2644
  }
2600
2645
  }]);
@@ -2634,6 +2679,7 @@ var Selection = /*#__PURE__*/function () {
2634
2679
  SelectableSet = _this$DS.SelectableSet,
2635
2680
  SelectorArea = _this$DS.SelectorArea,
2636
2681
  Selector = _this$DS.Selector;
2682
+
2637
2683
  /** @type {any} */
2638
2684
  var elRects = SelectableSet.rects;
2639
2685
  var select = [];
@@ -2692,7 +2738,9 @@ var Selection = /*#__PURE__*/function () {
2692
2738
  KeyStore = _this$DS2.stores.KeyStore,
2693
2739
  SelectedSet = _this$DS2.SelectedSet;
2694
2740
  if (KeyStore.isMultiSelectKeyPressed(event)) this._prevSelectedSet = new Set(SelectedSet);else this._prevSelectedSet = new Set();
2695
- } /** @param {{event:DSEvent,isDragging:boolean}} event */
2741
+ }
2742
+
2743
+ /** @param {{event:DSEvent,isDragging:boolean}} event */
2696
2744
  }]);
2697
2745
  return Selection;
2698
2746
  }();
@@ -2878,12 +2926,13 @@ var SelectorArea = /*#__PURE__*/function () {
2878
2926
  }
2879
2927
  _createClass(SelectorArea, [{
2880
2928
  key: "isClicked",
2929
+ value:
2881
2930
  /**
2882
2931
  * checks if the click was triggered on the area.
2883
2932
  * @param {DSEvent} [event]
2884
2933
  * @returns {boolean}
2885
2934
  */
2886
- value: function isClicked(event) {
2935
+ function isClicked(event) {
2887
2936
  var PointerStore = this.DS.stores.PointerStore;
2888
2937
  var initialVal = event ? PointerStore.getPointerPosition(event) : PointerStore.initialVal;
2889
2938
  return isCollision({
@@ -2973,7 +3022,8 @@ var KeyStore = /*#__PURE__*/function () {
2973
3022
  }
2974
3023
  _createClass(KeyStore, [{
2975
3024
  key: "isMultiSelectKeyPressed",
2976
- /** @param {KeyboardEvent|MouseEvent|PointerEvent|TouchEvent} [event] */value: function isMultiSelectKeyPressed(event) {
3025
+ value: /** @param {KeyboardEvent|MouseEvent|PointerEvent|TouchEvent} [event] */
3026
+ function isMultiSelectKeyPressed(event) {
2977
3027
  var _this2 = this;
2978
3028
  if (this.DS.stores.SettingsStore.s.multiSelectMode) return true;
2979
3029
  var multiSelectKeys = this.DS.stores.SettingsStore.s.multiSelectKeys.map(function (key) {
@@ -3115,25 +3165,31 @@ var PointerStore = /*#__PURE__*/function () {
3115
3165
  }
3116
3166
  _createClass(PointerStore, [{
3117
3167
  key: "start",
3118
- /** @param {DSEvent} [event] */value: function start(event) {
3168
+ value: /** @param {DSEvent} [event] */
3169
+ function start(event) {
3119
3170
  if (!event) return;
3120
3171
  this._isMouseInteraction = true;
3121
3172
  this.currentVal = this.initialVal = this.getPointerPosition(event);
3122
- } /** @param {DSEvent} event */
3173
+ }
3174
+
3175
+ /** @param {DSEvent} event */
3123
3176
  }, {
3124
3177
  key: "_normalizedEvent",
3178
+ value:
3125
3179
  /**
3126
3180
  * @param {DSEvent} event
3127
3181
  * @return {MouseEvent|PointerEvent|Touch}
3128
3182
  * @private
3129
3183
  */
3130
- value: function _normalizedEvent(event) {
3184
+ function _normalizedEvent(event) {
3131
3185
  // touchend has not touches. so we take the last touch if a touchevent, we need to store the positions
3132
3186
  if ('touches' in event && event.type !== 'touchend') this._lastTouch = event;
3133
3187
  // if a touchevent, return the last touch rather than the regular event
3134
3188
  // we need .touches[0] from that event instead
3135
3189
  return 'touches' in event ? this._lastTouch.touches[0] : event;
3136
- } /** First recorded pointer position within the area */
3190
+ }
3191
+
3192
+ /** First recorded pointer position within the area */
3137
3193
  }, {
3138
3194
  key: "initialValArea",
3139
3195
  get: function get() {
@@ -3142,7 +3198,9 @@ var PointerStore = /*#__PURE__*/function () {
3142
3198
  y: 0
3143
3199
  };
3144
3200
  return this._initialValArea;
3145
- } /** Current pointer position within the area */
3201
+ }
3202
+
3203
+ /** Current pointer position within the area */
3146
3204
  }, {
3147
3205
  key: "currentValArea",
3148
3206
  get: function get() {
@@ -3151,7 +3209,9 @@ var PointerStore = /*#__PURE__*/function () {
3151
3209
  y: 0
3152
3210
  };
3153
3211
  return this._currentValArea;
3154
- } /** Last recorded pointer position within the area */
3212
+ }
3213
+
3214
+ /** Last recorded pointer position within the area */
3155
3215
  }, {
3156
3216
  key: "lastValArea",
3157
3217
  get: function get() {
@@ -3160,7 +3220,9 @@ var PointerStore = /*#__PURE__*/function () {
3160
3220
  y: 0
3161
3221
  };
3162
3222
  return this._lastValArea;
3163
- } /** First recorded pointer position */
3223
+ }
3224
+
3225
+ /** First recorded pointer position */
3164
3226
  }, {
3165
3227
  key: "initialVal",
3166
3228
  get: function get() {
@@ -3169,7 +3231,9 @@ var PointerStore = /*#__PURE__*/function () {
3169
3231
  y: 0
3170
3232
  };
3171
3233
  return this._initialVal;
3172
- } /** Current pointer position */,
3234
+ }
3235
+
3236
+ /** Current pointer position */,
3173
3237
  set: function set(value) {
3174
3238
  this._initialVal = value;
3175
3239
  this._initialValArea = value && calc(value, '-', calc(rect2vect(this.DS.Area.rect), '+', rect2vect(this.DS.Area.computedBorder)));
@@ -3182,7 +3246,9 @@ var PointerStore = /*#__PURE__*/function () {
3182
3246
  y: 0
3183
3247
  };
3184
3248
  return this._currentVal;
3185
- } /** Last recorded pointer position */,
3249
+ }
3250
+
3251
+ /** Last recorded pointer position */,
3186
3252
  set: function set(value) {
3187
3253
  this._currentVal = value;
3188
3254
  this._currentValArea = value && calc(value, '-', calc(rect2vect(this.DS.Area.rect), '+', rect2vect(this.DS.Area.computedBorder)));
@@ -3299,7 +3365,7 @@ var ScrollStore = /*#__PURE__*/function () {
3299
3365
  return ScrollStore;
3300
3366
  }();
3301
3367
 
3302
- var SettingsStore =
3368
+ var SettingsStore = /*#__PURE__*/_createClass(
3303
3369
  /**
3304
3370
  * @type {Settings}
3305
3371
  * @private
@@ -3378,10 +3444,10 @@ function SettingsStore(_ref) {
3378
3444
  });
3379
3445
  }
3380
3446
 
3381
- /** @param {{settings: Settings, init?: boolean}} props */;
3447
+ /** @param {{settings: Settings, init?: boolean}} props */);
3382
3448
 
3383
3449
  // Setup
3384
- //////////////////////////////////////////////////////////////////////////////////////
3450
+ /// ///////////////////////////////////////////////////////////////////////////////////
3385
3451
  var DragSelect = /*#__PURE__*/function () {
3386
3452
  /**
3387
3453
  * used to skip all current Selection and dragNdrop functionality
@@ -3512,13 +3578,14 @@ var DragSelect = /*#__PURE__*/function () {
3512
3578
  }
3513
3579
 
3514
3580
  // Useful methods for the user
3515
- //////////////////////////////////////////////////////////////////////////////////////
3581
+ /// ///////////////////////////////////////////////////////////////////////////////////
3516
3582
  /**
3517
3583
  * Initializes the functionality. Automatically triggered when created.
3518
3584
  * Also, reset the functionality after a teardown
3519
3585
  */
3520
3586
  _createClass(DragSelect, [{
3521
3587
  key: "stop",
3588
+ value:
3522
3589
  /**
3523
3590
  * Complete function teardown
3524
3591
  * Will teardown/stop the whole functionality
@@ -3526,7 +3593,7 @@ var DragSelect = /*#__PURE__*/function () {
3526
3593
  * @param {boolean} [fromSelection] - if elements should also be added/removed to the selection.
3527
3594
  * @param {boolean} [withCallback] - if elements should also be added/removed to the selection.
3528
3595
  */
3529
- value: function stop() {
3596
+ function stop() {
3530
3597
  var remove = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
3531
3598
  var fromSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
3532
3599
  var withCallback = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
@@ -3545,6 +3612,7 @@ var DragSelect = /*#__PURE__*/function () {
3545
3612
  if (fromSelection) this.SelectedSet.clear();
3546
3613
  this.stopped = true;
3547
3614
  }
3615
+
3548
3616
  /**
3549
3617
  * Utility to override DragSelect internal functionality:
3550
3618
  * Break will skip the selection or dragging functionality (until after the callback) but let everything continue to run.
@@ -3552,6 +3620,7 @@ var DragSelect = /*#__PURE__*/function () {
3552
3620
  */
3553
3621
  }, {
3554
3622
  key: "addSelection",
3623
+ value:
3555
3624
  /**
3556
3625
  * Adds several elements to the selection list also adds the specific classes and take into account all calculations.
3557
3626
  * Does not clear the selection, in contrary to .setSelection. Can add multiple elements at once
@@ -3560,7 +3629,7 @@ var DragSelect = /*#__PURE__*/function () {
3560
3629
  * @param {boolean} [dontAddToSelectables] - if element should not be added to the list of selectable elements
3561
3630
  * @return {DSElements} all selected elements
3562
3631
  */
3563
- value: function addSelection(elements) {
3632
+ function addSelection(elements) {
3564
3633
  var triggerCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3565
3634
  var dontAddToSelectables = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3566
3635
  this.SelectedSet.addAll(toArray(elements));
@@ -3570,6 +3639,7 @@ var DragSelect = /*#__PURE__*/function () {
3570
3639
  });
3571
3640
  return this.getSelection();
3572
3641
  }
3642
+
3573
3643
  /**
3574
3644
  * Removes specific elements from the selection
3575
3645
  * Multiple elements can be given at once, in contrary to unselect
@@ -3590,13 +3660,14 @@ var DragSelect = /*#__PURE__*/function () {
3590
3660
  });
3591
3661
  return this.getSelection();
3592
3662
  }
3663
+
3593
3664
  /**
3594
3665
  * Toggles specific elements from the selection:
3595
3666
  * If element is not in selection it will be added, if it is already selected, it will be removed.
3596
3667
  * Multiple elements can be given at once.
3597
3668
  * @param {DSInputElements} elements one or multiple elements
3598
3669
  * @param {boolean} [triggerCallback] - if callback should be called
3599
- * @param {boolean} [alsoSelectables] - if element should not be added/removed to the list of selectable elements accordingly
3670
+ * @param {boolean} [removeFromSelectables] - if element should not be added/removed to the list of selectable elements accordingly
3600
3671
  * @return {DSElements} all selected elements
3601
3672
  */
3602
3673
  }, {
@@ -3604,15 +3675,16 @@ var DragSelect = /*#__PURE__*/function () {
3604
3675
  value: function toggleSelection(elements) {
3605
3676
  var _this2 = this;
3606
3677
  var triggerCallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3607
- var alsoSelectables = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3678
+ var removeFromSelectables = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3608
3679
  toArray(elements).forEach(function (el) {
3609
- return _this2.SelectedSet.has(el) ? _this2.removeSelection(elements, triggerCallback, alsoSelectables) : _this2.addSelection(elements, triggerCallback, alsoSelectables);
3680
+ return _this2.SelectedSet.has(el) ? _this2.removeSelection(elements, triggerCallback, removeFromSelectables) : _this2.addSelection(elements, triggerCallback, removeFromSelectables);
3610
3681
  });
3611
3682
  if (triggerCallback) this.PubSub.publish('callback', {
3612
3683
  items: this.getSelection()
3613
3684
  });
3614
3685
  return this.getSelection();
3615
3686
  }
3687
+
3616
3688
  /**
3617
3689
  * Sets the current selected elements and optionally run the callback
3618
3690
  * By default, adds new elements also to the list of selectables
@@ -3630,6 +3702,7 @@ var DragSelect = /*#__PURE__*/function () {
3630
3702
  this.addSelection(elements, triggerCallback, dontAddToSelectables);
3631
3703
  return this.getSelection();
3632
3704
  }
3705
+
3633
3706
  /**
3634
3707
  * Unselect / Deselect all current selected Nodes
3635
3708
  * @param {boolean} [triggerCallback] - if callback should be called
@@ -3645,6 +3718,7 @@ var DragSelect = /*#__PURE__*/function () {
3645
3718
  });
3646
3719
  return this.getSelection();
3647
3720
  }
3721
+
3648
3722
  /**
3649
3723
  * Add elements that can be selected. No node is added twice
3650
3724
  * @param {DSInputElements} elements dom element(s)
@@ -3663,12 +3737,14 @@ var DragSelect = /*#__PURE__*/function () {
3663
3737
  });
3664
3738
  return elements;
3665
3739
  }
3740
+
3666
3741
  /**
3667
3742
  * Gets all nodes that can potentially be selected
3668
3743
  * @return {DSElements} this.selectables
3669
3744
  */
3670
3745
  }, {
3671
3746
  key: "setSelectables",
3747
+ value:
3672
3748
  /**
3673
3749
  * Sets all elements that can be selected.
3674
3750
  * Removes all current selectables (& their respective classes).
@@ -3678,13 +3754,14 @@ var DragSelect = /*#__PURE__*/function () {
3678
3754
  * @param {boolean} [addToSelection] if elements should also be added to current selection
3679
3755
  * @return {DSInputElements} elements – the added element(s)
3680
3756
  */
3681
- value: function setSelectables(elements) {
3757
+ function setSelectables(elements) {
3682
3758
  var removeFromSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3683
3759
  var addToSelection = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
3684
3760
  console.warn('[DragSelect] DEPRECATION ".setSelectables" is deprecated and will be removed soon. Please use "ds.setSettings({ selectables: << new dom elements >> })" instead (see docs)');
3685
3761
  this.removeSelectables(elements, removeFromSelection);
3686
3762
  return this.addSelectables(elements, addToSelection);
3687
3763
  }
3764
+
3688
3765
  /**
3689
3766
  * Remove elements from the elements that can be selected.
3690
3767
  * @param {DSInputElements} elements – dom element(s)
@@ -3701,9 +3778,11 @@ var DragSelect = /*#__PURE__*/function () {
3701
3778
  items: this.getSelection()
3702
3779
  });
3703
3780
  return elements;
3704
- } /** The starting/initial position of the cursor/selector @return {Vect2} */
3781
+ }
3782
+
3783
+ /** The starting/initial position of the cursor/selector @return {Vect2} */
3705
3784
  }]);
3706
3785
  return DragSelect;
3707
3786
  }();
3708
3787
 
3709
- export default DragSelect;
3788
+ export { DragSelect as default };