dragselect 2.5.1 → 2.5.3

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 2.5.3
2
+
3
+ - Fix a bug where `setSettings` would not work with dropZones.
4
+
5
+ # 2.5.2
6
+
7
+ - Make `droppables` within `dropZones` optional and use all selectables as default value if no droppables are provided.
8
+
1
9
  # 2.5.1
2
10
 
3
11
  - Fix: when an item had multiple dropzones, the `${droppedInsideClass}` was removed even tho’ the item was dropped inside a zone
package/README.md CHANGED
@@ -170,8 +170,8 @@ const ds = new DragSelect({
170
170
  selectables: document.querySelectorAll('.selectable-nodes'),
171
171
  area: document.querySelector('#area'),
172
172
  dropZones: [
173
- { element: document.querySelector('#zone-1'), id: 'zone-1', droppables: document.querySelectorAll('.selectable-nodes') },
174
- { element: document.querySelector('#zone-2'), id: 'zone-2', droppables: document.querySelectorAll('#item-2,#item-4') },
173
+ { element: document.querySelector('#zone-1'), id: 'zone-1' }, // all selectables can be dropped into zone 1
174
+ { element: document.querySelector('#zone-2'), id: 'zone-2', droppables: document.querySelectorAll('#item-2,#item-4') }, // only items 2 and 4 are droppable
175
175
  ],
176
176
  dropInsideThreshold: 1, // 1 = has to be 100% inside the dropzone, 0.5 = 50% inside, 0 = just touching is fine
177
177
  });
@@ -334,7 +334,7 @@ Here is the full list:
334
334
  |keyboardDragSpeed |number |The speed at which elements are dragged using the keyboard. In pixels per keyDown. |`10`
335
335
  |useTransform |boolean |Whether to use the more performant hardware accelerated css transforms when dragging instead of the top/left positions. |`true`
336
336
  |refreshMemoryRate |number |Refresh rate on memoization, higher numbers mean better performance but more lag if elements are moving, lower numbers mean less lag but worse performance. If none of your DOMNodes are moving, you can set it to a very high number to increase performance. Value in milliseconds. |`80`
337
- |dropZones |[{ id: 'string', element: single DOM element (node), droppables: DOM elements [nodes] }] |zones with association of droppable items that can be dropped into them |`[]`
337
+ |dropZones |[{ id: 'string', element: single DOM element (node), droppables?: DOM elements [nodes] }] |zones with association of droppable items that can be dropped into them. `id`: any unique identifying string. `element`: is the dropzone itself. `droppables`: the elements that can be dropped into that zone. This is optional, by default it is all selectables |`[]`
338
338
  |dropInsideThreshold |number |How much % of the item has to be inside the dropzone to be considered inside (0 = barely touching, 1 = completely inside) |`1`
339
339
  |dropTargetThreshold |number |How much % of the zone does the pointer has to be in to be considered a target (0 = anywhere in the zone, max: 0.5 = has to point at the center of the zone) |`0`
340
340
  |usePointerEvents |boolean |Whether to use Pointer Events to replace traditional Mouse or Touch Events. Useful for tools like Google Blockly. |`false`
@@ -1,6 +1,6 @@
1
1
  /***
2
2
 
3
- ~~~ Version 2.5.1 ~~~
3
+ ~~~ Version 2.5.3 ~~~
4
4
 
5
5
  ******************************************
6
6
 
@@ -388,9 +388,9 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
388
388
 
389
389
  /**
390
390
  * @typedef {Object} DSInputDropZone
391
- * @property {string} id
392
- * @property {DSElement} element
393
- * @property {DSInputElements} droppables
391
+ * @property {string} id can be any unique identifier of type string
392
+ * @property {DSElement} element is the dropzone itself
393
+ * @property {DSInputElements} [droppables] the elements that can be dropped into that zone. This is optional, by default it will be all selectables
394
394
  */
395
395
  /**
396
396
  * @typedef {Object} DSDropZone
@@ -548,7 +548,8 @@ var canScroll = (function (area) {
548
548
  var scroll = getCurrentScroll(area);
549
549
  if (scroll.x || scroll.y) return true;
550
550
  if (area instanceof Document) {
551
- if (area.body) return !!(area.body.scrollTop = 1);else return !!(area.documentElement.scrollTop = 1);
551
+ if (area.body) return !!(area.body.scrollTop = 1);
552
+ return !!(area.documentElement.scrollTop = 1);
552
553
  }
553
554
  return !!(area.scrollTop = 1);
554
555
  });
@@ -650,9 +651,8 @@ var getAllParentNodes = (function (node) {
650
651
  toWatch.push(parent);
651
652
  index++;
652
653
  return traverse(toWatch, index);
653
- } else {
654
- return toWatch;
655
654
  }
655
+ return toWatch;
656
656
  };
657
657
  return traverse([node]);
658
658
  });
@@ -831,24 +831,23 @@ var getComputedTranslatePositions = function getComputedTranslatePositions(eleme
831
831
  var computed = window.getComputedStyle(element);
832
832
  if (!computed.transform || computed.transform === 'none') return position;
833
833
  if (computed.transform.indexOf('3d') >= 0) {
834
- var match = computed.transform.trim().match(/matrix3d\((.*?)\)/);
835
- if (match && match.length) {
834
+ var _match = computed.transform.trim().match(/matrix3d\((.*?)\)/);
835
+ if (_match && _match.length) {
836
836
  var _match$;
837
- var values = (_match$ = match[1]) === null || _match$ === void 0 ? void 0 : _match$.split(',');
837
+ var values = (_match$ = _match[1]) === null || _match$ === void 0 ? void 0 : _match$.split(',');
838
838
  position.x = parseInt(values[12]) || 0;
839
839
  position.y = parseInt(values[13]) || 0;
840
840
  }
841
841
  return position;
842
- } else {
843
- var _match = computed.transform.trim().match(/matrix\((.*?)\)/);
844
- if (_match && _match.length) {
845
- var _match$2;
846
- var _values = (_match$2 = _match[1]) === null || _match$2 === void 0 ? void 0 : _match$2.split(',');
847
- position.x = parseInt(_values[4]) || 0;
848
- position.y = parseInt(_values[5]) || 0;
849
- }
850
- return position;
851
842
  }
843
+ var match = computed.transform.trim().match(/matrix\((.*?)\)/);
844
+ if (match && match.length) {
845
+ var _match$2;
846
+ var _values = (_match$2 = match[1]) === null || _match$2 === void 0 ? void 0 : _match$2.split(',');
847
+ position.x = parseInt(_values[4]) || 0;
848
+ position.y = parseInt(_values[5]) || 0;
849
+ }
850
+ return position;
852
851
  };
853
852
 
854
853
  /**
@@ -907,7 +906,8 @@ var getTopLeftPosition = function getTopLeftPosition(element) {
907
906
  * @return {Vect2}
908
907
  */
909
908
  var getStylePosition = (function (element, useTranslate) {
910
- if (useTranslate) return getTranslatedPositions(element);else return getTopLeftPosition(element);
909
+ if (useTranslate) return getTranslatedPositions(element);
910
+ return getTopLeftPosition(element);
911
911
  });
912
912
 
913
913
  // @ts-check
@@ -1079,8 +1079,8 @@ var handleUnSelection = (function (_ref) {
1079
1079
  });
1080
1080
 
1081
1081
  /**
1082
- * @param {string} key
1083
- * @param {string} type
1082
+ * @param {string} key
1083
+ * @param {string} type
1084
1084
  * @param {*} fallback
1085
1085
  * @returns {void}
1086
1086
  */
@@ -1089,10 +1089,10 @@ var wrongTypeWarn = function wrongTypeWarn(key, type, fallback) {
1089
1089
  };
1090
1090
 
1091
1091
  /**
1092
- * @param {string} key
1092
+ * @param {string} key
1093
1093
  * @param {*} value
1094
- * @param {boolean} withFallback
1095
- * @param {*} fallback
1094
+ * @param {boolean} withFallback
1095
+ * @param {*} fallback
1096
1096
  * @returns {object}
1097
1097
  */
1098
1098
  var hydrateHelper = function hydrateHelper(key, value, withFallback, fallback) {
@@ -1114,24 +1114,24 @@ var hydrateHelper = function hydrateHelper(key, value, withFallback, fallback) {
1114
1114
  }
1115
1115
 
1116
1116
  // TypeCheck [Number]
1117
- var expectedNumber = !isNaN(fallback) && typeof fallback === 'number';
1118
- if (expectedNumber) isAvailable = !isNaN(value) && typeof value === 'number';
1117
+ var expectedNumber = !Number.isNaN(fallback) && typeof fallback === 'number';
1118
+ if (expectedNumber) isAvailable = !Number.isNaN(value) && typeof value === 'number';
1119
1119
  if (expectedNumber && !isAvailable) {
1120
1120
  forceFallback = true;
1121
1121
  wrongTypeWarn(key, 'number');
1122
1122
  }
1123
1123
 
1124
1124
  // TypeCheck [Object]
1125
- var expectedObject = Object.prototype.toString.call(fallback) === "[object Object]";
1126
- if (expectedObject) isAvailable = Object.prototype.toString.call(value) === "[object Object]";
1125
+ var expectedObject = Object.prototype.toString.call(fallback) === '[object Object]';
1126
+ if (expectedObject) isAvailable = Object.prototype.toString.call(value) === '[object Object]';
1127
1127
  if (expectedObject && !isAvailable) {
1128
1128
  forceFallback = true;
1129
1129
  wrongTypeWarn(key, 'object');
1130
1130
  }
1131
1131
 
1132
1132
  // TypeCheck [Boolean]
1133
- var expectedBoolean = typeof fallback === "boolean";
1134
- if (expectedBoolean) isAvailable = typeof value === "boolean";
1133
+ var expectedBoolean = typeof fallback === 'boolean';
1134
+ if (expectedBoolean) isAvailable = typeof value === 'boolean';
1135
1135
  if (expectedBoolean && !isAvailable) {
1136
1136
  forceFallback = true;
1137
1137
  wrongTypeWarn(key, 'boolean');
@@ -1147,24 +1147,27 @@ var hydrateHelper = function hydrateHelper(key, value, withFallback, fallback) {
1147
1147
  var isFallback = forceFallback || withFallback;
1148
1148
 
1149
1149
  // Special rule for [dragKeys]
1150
- if (key === 'dragKeys' && isAvailable) return _defineProperty({}, key, Object.assign(fallback, value));else if (key === 'dragKeys' && !isAvailable) return isFallback ? _defineProperty({}, key, fallback) : {};
1150
+ if (key === 'dragKeys' && isAvailable) return _defineProperty({}, key, Object.assign(fallback, value));
1151
+ if (key === 'dragKeys' && !isAvailable) return isFallback ? _defineProperty({}, key, fallback) : {};
1151
1152
 
1152
1153
  // Special rule for [dropZones]
1153
1154
  if (key === 'dropZones' && isAvailable && new Set(value.map(function (v) {
1154
1155
  return v.id;
1155
1156
  })).size !== value.length) console.warn("[DragSelect] UniqueConstraintsIssue: setting \"dropZones\" contains duplicate ids.");
1156
- return isAvailable ? _defineProperty({}, key, value) : isFallback ? _defineProperty({}, key, fallback) : {};
1157
+ if (isAvailable) return _defineProperty({}, key, value);
1158
+ if (isFallback) return _defineProperty({}, key, fallback);
1159
+ return {};
1157
1160
  };
1158
1161
 
1159
1162
  /**
1160
1163
  * This helper method creates the setting object,
1161
1164
  * - if the settings provided are of wrong type, the fallback value will be used
1162
1165
  * - - except for if settings are undefined or explicitly marked as "null"
1163
- * - if "withfallback" is true, it will return the object with all settings:
1166
+ * - if "withfallback" is true, it will return the object with all settings:
1164
1167
  * - - if not provided from the settings object (or wrong type), the fallback will be used
1165
1168
  * (the fallback value for each setting is the last prop of the hydrateHelper)
1166
- * @param {Settings} settings
1167
- * @param {boolean} withFallback
1169
+ * @param {Settings} settings
1170
+ * @param {boolean} withFallback
1168
1171
  */
1169
1172
  var hydrateSettings = (function (settings, withFallback) {
1170
1173
  return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, hydrateHelper('area', settings.area, withFallback, document)), hydrateHelper('selectables', settings.selectables, withFallback, null)), hydrateHelper('autoScrollSpeed', settings.autoScrollSpeed, withFallback, 5)), hydrateHelper('overflowTolerance', settings.overflowTolerance, withFallback, {
@@ -1229,8 +1232,8 @@ var isCollision = (function (el1, el2) {
1229
1232
  // 3.
1230
1233
  element1.bottom > el2.top // 4.
1231
1234
  ) return true;
1232
- // collision detected!
1233
- else return false;
1235
+ // collision detected!
1236
+ return false;
1234
1237
  });
1235
1238
 
1236
1239
  // @ts-check
@@ -1548,7 +1551,7 @@ var Area = /*#__PURE__*/function () {
1548
1551
  /** @param {DSArea} area */
1549
1552
  _createClass(Area, [{
1550
1553
  key: "HTMLNode",
1551
- //////////////////////////////////////////////////////////////////////////////////////
1554
+ /// ///////////////////////////////////////////////////////////////////////////////////
1552
1555
  // Node Getters
1553
1556
  get: function get() {
1554
1557
  return (/** @type {DSArea} */this._node
@@ -1577,7 +1580,8 @@ var Area = /*#__PURE__*/function () {
1577
1580
  key: "computedStyle",
1578
1581
  get: function get() {
1579
1582
  if (this._computedStyle) return this._computedStyle;
1580
- if (this.HTMLNode instanceof Document) return this._computedStyle = window.getComputedStyle(this.HTMLNode.body || this.HTMLNode.documentElement);else return this._computedStyle = window.getComputedStyle(this.HTMLNode);
1583
+ if (this.HTMLNode instanceof Document) return this._computedStyle = window.getComputedStyle(this.HTMLNode.body || this.HTMLNode.documentElement);
1584
+ return this._computedStyle = window.getComputedStyle(this.HTMLNode);
1581
1585
  }
1582
1586
  /**
1583
1587
  * The element rect (caches result) (without scrollbar or borders)
@@ -1817,7 +1821,7 @@ var DropZone = /*#__PURE__*/function () {
1817
1821
  * @param {DragSelect} obj.DS
1818
1822
  * @param {string} obj.id
1819
1823
  * @param {DSElement} obj.element
1820
- * @param {DSInputElements} obj.droppables
1824
+ * @param {DSInputElements} [obj.droppables]
1821
1825
  * @ignore
1822
1826
  */
1823
1827
  function DropZone(_ref) {
@@ -1829,7 +1833,7 @@ var DropZone = /*#__PURE__*/function () {
1829
1833
  _classCallCheck(this, DropZone);
1830
1834
  _defineProperty(this, "id", void 0);
1831
1835
  _defineProperty(this, "element", void 0);
1832
- _defineProperty(this, "droppables", void 0);
1836
+ _defineProperty(this, "_droppables", void 0);
1833
1837
  _defineProperty(this, "_rect", void 0);
1834
1838
  _defineProperty(this, "_observers", void 0);
1835
1839
  _defineProperty(this, "_timeout", void 0);
@@ -1914,7 +1918,7 @@ var DropZone = /*#__PURE__*/function () {
1914
1918
  this.Settings = DS.stores.SettingsStore.s;
1915
1919
  this.id = id;
1916
1920
  this.element = element;
1917
- this.droppables = toArray(droppables);
1921
+ if (droppables) this.droppables = toArray(droppables);
1918
1922
  this.element.classList.add("".concat(this.Settings.dropZoneClass));
1919
1923
 
1920
1924
  // @ts-ignore: @todo: update to typescript
@@ -1996,6 +2000,15 @@ var DropZone = /*#__PURE__*/function () {
1996
2000
  if (this._parentNodes) return this._parentNodes;
1997
2001
  return this._parentNodes = getAllParentNodes(this.element);
1998
2002
  }
2003
+ }, {
2004
+ key: "droppables",
2005
+ get: function get() {
2006
+ if (this._droppables) return this._droppables;
2007
+ return this.DS.SelectableSet.elements;
2008
+ },
2009
+ set: function set(value) {
2010
+ this._droppables = value;
2011
+ }
1999
2012
  }]);
2000
2013
  return DropZone;
2001
2014
  }();
@@ -2116,7 +2129,10 @@ function DropZones(_ref) {
2116
2129
  this.Settings = DS.stores.SettingsStore.s;
2117
2130
 
2118
2131
  // @ts-ignore: @todo: update to typescript
2119
- this.DS.subscribe('Settings:updated:dropZones', this.setDropZones);
2132
+ this.DS.subscribe('Settings:updated:dropZones', function (_ref5) {
2133
+ var settings = _ref5.settings;
2134
+ return _this.setDropZones(settings);
2135
+ });
2120
2136
  this.setDropZones({
2121
2137
  dropZones: /** @type {DSDropZone[]} */this.DS.stores.SettingsStore.s.dropZones
2122
2138
  });
@@ -2292,7 +2308,7 @@ var Interaction = /*#__PURE__*/function () {
2292
2308
  this.isInteracting ||
2293
2309
  // fix double-click issues
2294
2310
  event.target && !this.DS.SelectorArea.isInside( /** @type {DSElement} */event.target) ||
2295
- //fix outside elements issue
2311
+ // fix outside elements issue
2296
2312
  !isKeyboardClick && !this.DS.SelectorArea.isClicked(event) // make sure the mouse click is inside the area
2297
2313
  ) return false;
2298
2314
  return true;
@@ -2422,7 +2438,7 @@ var SelectableSet = /*#__PURE__*/function (_Set) {
2422
2438
  var settings = _ref2.settings;
2423
2439
  _this.forEach(function (el) {
2424
2440
  el.classList.remove(settings['selectableClass:pre']);
2425
- el.classList.add(settings['selectableClass']);
2441
+ el.classList.add(settings.selectableClass);
2426
2442
  });
2427
2443
  });
2428
2444
  return _this;
@@ -2738,7 +2754,7 @@ var Selector = /*#__PURE__*/function () {
2738
2754
  this.DS.subscribe('Settings:updated:selectorClass', function (_ref4) {
2739
2755
  var settings = _ref4.settings;
2740
2756
  _this.HTMLNode.classList.remove(settings['selectorClass:pre']);
2741
- _this.HTMLNode.classList.add(settings['selectorClass']);
2757
+ _this.HTMLNode.classList.add(settings.selectorClass);
2742
2758
  });
2743
2759
  // @ts-ignore: @todo: update to typescript
2744
2760
  this.DS.subscribe('Settings:updated:selector', this.attachSelector);
@@ -1,6 +1,6 @@
1
1
  /***
2
2
 
3
- ~~~ Version 2.5.1 ~~~
3
+ ~~~ Version 2.5.3 ~~~
4
4
 
5
5
  ******************************************
6
6
 
@@ -394,9 +394,9 @@
394
394
 
395
395
  /**
396
396
  * @typedef {Object} DSInputDropZone
397
- * @property {string} id
398
- * @property {DSElement} element
399
- * @property {DSInputElements} droppables
397
+ * @property {string} id can be any unique identifier of type string
398
+ * @property {DSElement} element is the dropzone itself
399
+ * @property {DSInputElements} [droppables] the elements that can be dropped into that zone. This is optional, by default it will be all selectables
400
400
  */
401
401
  /**
402
402
  * @typedef {Object} DSDropZone
@@ -554,7 +554,8 @@
554
554
  var scroll = getCurrentScroll(area);
555
555
  if (scroll.x || scroll.y) return true;
556
556
  if (area instanceof Document) {
557
- if (area.body) return !!(area.body.scrollTop = 1);else return !!(area.documentElement.scrollTop = 1);
557
+ if (area.body) return !!(area.body.scrollTop = 1);
558
+ return !!(area.documentElement.scrollTop = 1);
558
559
  }
559
560
  return !!(area.scrollTop = 1);
560
561
  });
@@ -656,9 +657,8 @@
656
657
  toWatch.push(parent);
657
658
  index++;
658
659
  return traverse(toWatch, index);
659
- } else {
660
- return toWatch;
661
660
  }
661
+ return toWatch;
662
662
  };
663
663
  return traverse([node]);
664
664
  });
@@ -837,24 +837,23 @@
837
837
  var computed = window.getComputedStyle(element);
838
838
  if (!computed.transform || computed.transform === 'none') return position;
839
839
  if (computed.transform.indexOf('3d') >= 0) {
840
- var match = computed.transform.trim().match(/matrix3d\((.*?)\)/);
841
- if (match && match.length) {
840
+ var _match = computed.transform.trim().match(/matrix3d\((.*?)\)/);
841
+ if (_match && _match.length) {
842
842
  var _match$;
843
- var values = (_match$ = match[1]) === null || _match$ === void 0 ? void 0 : _match$.split(',');
843
+ var values = (_match$ = _match[1]) === null || _match$ === void 0 ? void 0 : _match$.split(',');
844
844
  position.x = parseInt(values[12]) || 0;
845
845
  position.y = parseInt(values[13]) || 0;
846
846
  }
847
847
  return position;
848
- } else {
849
- var _match = computed.transform.trim().match(/matrix\((.*?)\)/);
850
- if (_match && _match.length) {
851
- var _match$2;
852
- var _values = (_match$2 = _match[1]) === null || _match$2 === void 0 ? void 0 : _match$2.split(',');
853
- position.x = parseInt(_values[4]) || 0;
854
- position.y = parseInt(_values[5]) || 0;
855
- }
856
- return position;
857
848
  }
849
+ var match = computed.transform.trim().match(/matrix\((.*?)\)/);
850
+ if (match && match.length) {
851
+ var _match$2;
852
+ var _values = (_match$2 = match[1]) === null || _match$2 === void 0 ? void 0 : _match$2.split(',');
853
+ position.x = parseInt(_values[4]) || 0;
854
+ position.y = parseInt(_values[5]) || 0;
855
+ }
856
+ return position;
858
857
  };
859
858
 
860
859
  /**
@@ -913,7 +912,8 @@
913
912
  * @return {Vect2}
914
913
  */
915
914
  var getStylePosition = (function (element, useTranslate) {
916
- if (useTranslate) return getTranslatedPositions(element);else return getTopLeftPosition(element);
915
+ if (useTranslate) return getTranslatedPositions(element);
916
+ return getTopLeftPosition(element);
917
917
  });
918
918
 
919
919
  // @ts-check
@@ -1085,8 +1085,8 @@
1085
1085
  });
1086
1086
 
1087
1087
  /**
1088
- * @param {string} key
1089
- * @param {string} type
1088
+ * @param {string} key
1089
+ * @param {string} type
1090
1090
  * @param {*} fallback
1091
1091
  * @returns {void}
1092
1092
  */
@@ -1095,10 +1095,10 @@
1095
1095
  };
1096
1096
 
1097
1097
  /**
1098
- * @param {string} key
1098
+ * @param {string} key
1099
1099
  * @param {*} value
1100
- * @param {boolean} withFallback
1101
- * @param {*} fallback
1100
+ * @param {boolean} withFallback
1101
+ * @param {*} fallback
1102
1102
  * @returns {object}
1103
1103
  */
1104
1104
  var hydrateHelper = function hydrateHelper(key, value, withFallback, fallback) {
@@ -1120,24 +1120,24 @@
1120
1120
  }
1121
1121
 
1122
1122
  // TypeCheck [Number]
1123
- var expectedNumber = !isNaN(fallback) && typeof fallback === 'number';
1124
- if (expectedNumber) isAvailable = !isNaN(value) && typeof value === 'number';
1123
+ var expectedNumber = !Number.isNaN(fallback) && typeof fallback === 'number';
1124
+ if (expectedNumber) isAvailable = !Number.isNaN(value) && typeof value === 'number';
1125
1125
  if (expectedNumber && !isAvailable) {
1126
1126
  forceFallback = true;
1127
1127
  wrongTypeWarn(key, 'number');
1128
1128
  }
1129
1129
 
1130
1130
  // TypeCheck [Object]
1131
- var expectedObject = Object.prototype.toString.call(fallback) === "[object Object]";
1132
- if (expectedObject) isAvailable = Object.prototype.toString.call(value) === "[object Object]";
1131
+ var expectedObject = Object.prototype.toString.call(fallback) === '[object Object]';
1132
+ if (expectedObject) isAvailable = Object.prototype.toString.call(value) === '[object Object]';
1133
1133
  if (expectedObject && !isAvailable) {
1134
1134
  forceFallback = true;
1135
1135
  wrongTypeWarn(key, 'object');
1136
1136
  }
1137
1137
 
1138
1138
  // TypeCheck [Boolean]
1139
- var expectedBoolean = typeof fallback === "boolean";
1140
- if (expectedBoolean) isAvailable = typeof value === "boolean";
1139
+ var expectedBoolean = typeof fallback === 'boolean';
1140
+ if (expectedBoolean) isAvailable = typeof value === 'boolean';
1141
1141
  if (expectedBoolean && !isAvailable) {
1142
1142
  forceFallback = true;
1143
1143
  wrongTypeWarn(key, 'boolean');
@@ -1153,24 +1153,27 @@
1153
1153
  var isFallback = forceFallback || withFallback;
1154
1154
 
1155
1155
  // Special rule for [dragKeys]
1156
- if (key === 'dragKeys' && isAvailable) return _defineProperty({}, key, Object.assign(fallback, value));else if (key === 'dragKeys' && !isAvailable) return isFallback ? _defineProperty({}, key, fallback) : {};
1156
+ if (key === 'dragKeys' && isAvailable) return _defineProperty({}, key, Object.assign(fallback, value));
1157
+ if (key === 'dragKeys' && !isAvailable) return isFallback ? _defineProperty({}, key, fallback) : {};
1157
1158
 
1158
1159
  // Special rule for [dropZones]
1159
1160
  if (key === 'dropZones' && isAvailable && new Set(value.map(function (v) {
1160
1161
  return v.id;
1161
1162
  })).size !== value.length) console.warn("[DragSelect] UniqueConstraintsIssue: setting \"dropZones\" contains duplicate ids.");
1162
- return isAvailable ? _defineProperty({}, key, value) : isFallback ? _defineProperty({}, key, fallback) : {};
1163
+ if (isAvailable) return _defineProperty({}, key, value);
1164
+ if (isFallback) return _defineProperty({}, key, fallback);
1165
+ return {};
1163
1166
  };
1164
1167
 
1165
1168
  /**
1166
1169
  * This helper method creates the setting object,
1167
1170
  * - if the settings provided are of wrong type, the fallback value will be used
1168
1171
  * - - except for if settings are undefined or explicitly marked as "null"
1169
- * - if "withfallback" is true, it will return the object with all settings:
1172
+ * - if "withfallback" is true, it will return the object with all settings:
1170
1173
  * - - if not provided from the settings object (or wrong type), the fallback will be used
1171
1174
  * (the fallback value for each setting is the last prop of the hydrateHelper)
1172
- * @param {Settings} settings
1173
- * @param {boolean} withFallback
1175
+ * @param {Settings} settings
1176
+ * @param {boolean} withFallback
1174
1177
  */
1175
1178
  var hydrateSettings = (function (settings, withFallback) {
1176
1179
  return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, hydrateHelper('area', settings.area, withFallback, document)), hydrateHelper('selectables', settings.selectables, withFallback, null)), hydrateHelper('autoScrollSpeed', settings.autoScrollSpeed, withFallback, 5)), hydrateHelper('overflowTolerance', settings.overflowTolerance, withFallback, {
@@ -1235,8 +1238,8 @@
1235
1238
  // 3.
1236
1239
  element1.bottom > el2.top // 4.
1237
1240
  ) return true;
1238
- // collision detected!
1239
- else return false;
1241
+ // collision detected!
1242
+ return false;
1240
1243
  });
1241
1244
 
1242
1245
  // @ts-check
@@ -1554,7 +1557,7 @@
1554
1557
  /** @param {DSArea} area */
1555
1558
  _createClass(Area, [{
1556
1559
  key: "HTMLNode",
1557
- //////////////////////////////////////////////////////////////////////////////////////
1560
+ /// ///////////////////////////////////////////////////////////////////////////////////
1558
1561
  // Node Getters
1559
1562
  get: function get() {
1560
1563
  return (/** @type {DSArea} */this._node
@@ -1583,7 +1586,8 @@
1583
1586
  key: "computedStyle",
1584
1587
  get: function get() {
1585
1588
  if (this._computedStyle) return this._computedStyle;
1586
- if (this.HTMLNode instanceof Document) return this._computedStyle = window.getComputedStyle(this.HTMLNode.body || this.HTMLNode.documentElement);else return this._computedStyle = window.getComputedStyle(this.HTMLNode);
1589
+ if (this.HTMLNode instanceof Document) return this._computedStyle = window.getComputedStyle(this.HTMLNode.body || this.HTMLNode.documentElement);
1590
+ return this._computedStyle = window.getComputedStyle(this.HTMLNode);
1587
1591
  }
1588
1592
  /**
1589
1593
  * The element rect (caches result) (without scrollbar or borders)
@@ -1823,7 +1827,7 @@
1823
1827
  * @param {DragSelect} obj.DS
1824
1828
  * @param {string} obj.id
1825
1829
  * @param {DSElement} obj.element
1826
- * @param {DSInputElements} obj.droppables
1830
+ * @param {DSInputElements} [obj.droppables]
1827
1831
  * @ignore
1828
1832
  */
1829
1833
  function DropZone(_ref) {
@@ -1835,7 +1839,7 @@
1835
1839
  _classCallCheck(this, DropZone);
1836
1840
  _defineProperty(this, "id", void 0);
1837
1841
  _defineProperty(this, "element", void 0);
1838
- _defineProperty(this, "droppables", void 0);
1842
+ _defineProperty(this, "_droppables", void 0);
1839
1843
  _defineProperty(this, "_rect", void 0);
1840
1844
  _defineProperty(this, "_observers", void 0);
1841
1845
  _defineProperty(this, "_timeout", void 0);
@@ -1920,7 +1924,7 @@
1920
1924
  this.Settings = DS.stores.SettingsStore.s;
1921
1925
  this.id = id;
1922
1926
  this.element = element;
1923
- this.droppables = toArray(droppables);
1927
+ if (droppables) this.droppables = toArray(droppables);
1924
1928
  this.element.classList.add("".concat(this.Settings.dropZoneClass));
1925
1929
 
1926
1930
  // @ts-ignore: @todo: update to typescript
@@ -2002,6 +2006,15 @@
2002
2006
  if (this._parentNodes) return this._parentNodes;
2003
2007
  return this._parentNodes = getAllParentNodes(this.element);
2004
2008
  }
2009
+ }, {
2010
+ key: "droppables",
2011
+ get: function get() {
2012
+ if (this._droppables) return this._droppables;
2013
+ return this.DS.SelectableSet.elements;
2014
+ },
2015
+ set: function set(value) {
2016
+ this._droppables = value;
2017
+ }
2005
2018
  }]);
2006
2019
  return DropZone;
2007
2020
  }();
@@ -2122,7 +2135,10 @@
2122
2135
  this.Settings = DS.stores.SettingsStore.s;
2123
2136
 
2124
2137
  // @ts-ignore: @todo: update to typescript
2125
- this.DS.subscribe('Settings:updated:dropZones', this.setDropZones);
2138
+ this.DS.subscribe('Settings:updated:dropZones', function (_ref5) {
2139
+ var settings = _ref5.settings;
2140
+ return _this.setDropZones(settings);
2141
+ });
2126
2142
  this.setDropZones({
2127
2143
  dropZones: /** @type {DSDropZone[]} */this.DS.stores.SettingsStore.s.dropZones
2128
2144
  });
@@ -2298,7 +2314,7 @@
2298
2314
  this.isInteracting ||
2299
2315
  // fix double-click issues
2300
2316
  event.target && !this.DS.SelectorArea.isInside( /** @type {DSElement} */event.target) ||
2301
- //fix outside elements issue
2317
+ // fix outside elements issue
2302
2318
  !isKeyboardClick && !this.DS.SelectorArea.isClicked(event) // make sure the mouse click is inside the area
2303
2319
  ) return false;
2304
2320
  return true;
@@ -2428,7 +2444,7 @@
2428
2444
  var settings = _ref2.settings;
2429
2445
  _this.forEach(function (el) {
2430
2446
  el.classList.remove(settings['selectableClass:pre']);
2431
- el.classList.add(settings['selectableClass']);
2447
+ el.classList.add(settings.selectableClass);
2432
2448
  });
2433
2449
  });
2434
2450
  return _this;
@@ -2744,7 +2760,7 @@
2744
2760
  this.DS.subscribe('Settings:updated:selectorClass', function (_ref4) {
2745
2761
  var settings = _ref4.settings;
2746
2762
  _this.HTMLNode.classList.remove(settings['selectorClass:pre']);
2747
- _this.HTMLNode.classList.add(settings['selectorClass']);
2763
+ _this.HTMLNode.classList.add(settings.selectorClass);
2748
2764
  });
2749
2765
  // @ts-ignore: @todo: update to typescript
2750
2766
  this.DS.subscribe('Settings:updated:selector', this.attachSelector);