svelte-dnd-action 0.9.29 → 0.9.30

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/README.md CHANGED
@@ -106,7 +106,7 @@ An options-object with the following attributes:
106
106
  | Name | Type | Required? | Default Value | Description |
107
107
  | ------------------------- | -------------- | ------------------------------------------------------------ | ------------------------------------------------- | ------------------------------------------------------------ |
108
108
  | `items` | Array<Object> | Yes. Each object in the array **has to have** an `id` property (key name can be overridden globally) with a unique value (within all dnd-zones of the same type) | N/A | The data array that is used to produce the list with the draggable items (the same thing you run your #each block on). The dndzone should not have children that don't originate in `items` |
109
- | `flipDurationMs` | Number | No | `0` | The same value you give the flip animation on the items (to make them animated as they "make space" for the dragged item). Set to zero or leave out if you don't want animations |
109
+ | `flipDurationMs` | Number | No | `0` | The same value you give the flip animation on the items (to make them animated as they "make space" for the dragged item). Set to zero if you dont want animations, if unset it defaults to 100ms |
110
110
  | `type` | String | No | Internal | dnd-zones that share the same type can have elements from one dragged into another. By default, all dnd-zones have the same type |
111
111
  | `dragDisabled` | Boolean | No | `false` | Setting it to true will make it impossible to drag elements out of the dnd-zone. You can change it at any time, and the zone will adjust on the fly |
112
112
  | `morphDisabled` | Boolean | No | `false` | By default, when dragging over a zone, the dragged element is morphed to look like it would if dropped. You can prevent it by setting this option. |
package/dist/index.js CHANGED
@@ -1226,6 +1226,7 @@
1226
1226
 
1227
1227
  var DEFAULT_DROP_ZONE_TYPE = "--any--";
1228
1228
  var MIN_OBSERVATION_INTERVAL_MS = 100;
1229
+ var DISABLED_OBSERVATION_INTERVAL_MS = 20;
1229
1230
  var MIN_MOVEMENT_BEFORE_DRAG_START_PX = 3;
1230
1231
  var DEFAULT_DROP_TARGET_STYLE = {
1231
1232
  outline: "rgba(255, 255, 102, 0.7) solid 2px"
@@ -1298,9 +1299,10 @@
1298
1299
  }
1299
1300
  window.addEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, handleDrop);
1300
1301
  // it is important that we don't have an interval that is faster than the flip duration because it can cause elements to jump bach and forth
1301
- var observationIntervalMs = Math.max.apply(Math, [MIN_OBSERVATION_INTERVAL_MS].concat(_toConsumableArray(Array.from(dropZones.keys()).map(function (dz) {
1302
+ var setIntervalMs = Math.max.apply(Math, _toConsumableArray(Array.from(dropZones.keys()).map(function (dz) {
1302
1303
  return dzToConfig.get(dz).dropAnimationDurationMs;
1303
- }))));
1304
+ })));
1305
+ var observationIntervalMs = setIntervalMs === 0 ? DISABLED_OBSERVATION_INTERVAL_MS : Math.max(setIntervalMs, MIN_OBSERVATION_INTERVAL_MS); //if setintervalms is 0 it goes to 20, otherwise it is max between it and min observation.
1304
1306
  observe(draggedEl, dropZones, observationIntervalMs * 1.07);
1305
1307
  }
1306
1308
  function unWatchDraggedElement() {
package/dist/index.mjs CHANGED
@@ -1220,6 +1220,7 @@ function preventShrinking(el) {
1220
1220
 
1221
1221
  var DEFAULT_DROP_ZONE_TYPE = "--any--";
1222
1222
  var MIN_OBSERVATION_INTERVAL_MS = 100;
1223
+ var DISABLED_OBSERVATION_INTERVAL_MS = 20;
1223
1224
  var MIN_MOVEMENT_BEFORE_DRAG_START_PX = 3;
1224
1225
  var DEFAULT_DROP_TARGET_STYLE = {
1225
1226
  outline: "rgba(255, 255, 102, 0.7) solid 2px"
@@ -1292,9 +1293,10 @@ function watchDraggedElement() {
1292
1293
  }
1293
1294
  window.addEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, handleDrop);
1294
1295
  // it is important that we don't have an interval that is faster than the flip duration because it can cause elements to jump bach and forth
1295
- var observationIntervalMs = Math.max.apply(Math, [MIN_OBSERVATION_INTERVAL_MS].concat(_toConsumableArray(Array.from(dropZones.keys()).map(function (dz) {
1296
+ var setIntervalMs = Math.max.apply(Math, _toConsumableArray(Array.from(dropZones.keys()).map(function (dz) {
1296
1297
  return dzToConfig.get(dz).dropAnimationDurationMs;
1297
- }))));
1298
+ })));
1299
+ var observationIntervalMs = setIntervalMs === 0 ? DISABLED_OBSERVATION_INTERVAL_MS : Math.max(setIntervalMs, MIN_OBSERVATION_INTERVAL_MS); //if setintervalms is 0 it goes to 20, otherwise it is max between it and min observation.
1298
1300
  observe(draggedEl, dropZones, observationIntervalMs * 1.07);
1299
1301
  }
1300
1302
  function unWatchDraggedElement() {
package/package.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "dist"
44
44
  ],
45
45
  "description": "*An awesome drag and drop library for Svelte 3 and 4 (not using the browser's built-in dnd, thanks god): Rich animations, nested containers, touch support and more *",
46
- "version": "0.9.29",
46
+ "version": "0.9.30",
47
47
  "repository": {
48
48
  "type": "git",
49
49
  "url": "git+https://github.com/isaacHagoel/svelte-dnd-action.git"
@@ -36,6 +36,7 @@ import {getBoundingRectNoTransforms} from "./helpers/intersection";
36
36
 
37
37
  const DEFAULT_DROP_ZONE_TYPE = "--any--";
38
38
  const MIN_OBSERVATION_INTERVAL_MS = 100;
39
+ const DISABLED_OBSERVATION_INTERVAL_MS = 20;
39
40
  const MIN_MOVEMENT_BEFORE_DRAG_START_PX = 3;
40
41
  const DEFAULT_DROP_TARGET_STYLE = {
41
42
  outline: "rgba(255, 255, 102, 0.7) solid 2px"
@@ -96,10 +97,8 @@ function watchDraggedElement() {
96
97
  }
97
98
  window.addEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, handleDrop);
98
99
  // it is important that we don't have an interval that is faster than the flip duration because it can cause elements to jump bach and forth
99
- const observationIntervalMs = Math.max(
100
- MIN_OBSERVATION_INTERVAL_MS,
101
- ...Array.from(dropZones.keys()).map(dz => dzToConfig.get(dz).dropAnimationDurationMs)
102
- );
100
+ const setIntervalMs = Math.max(...Array.from(dropZones.keys()).map(dz => dzToConfig.get(dz).dropAnimationDurationMs));
101
+ const observationIntervalMs = setIntervalMs === 0 ? DISABLED_OBSERVATION_INTERVAL_MS : Math.max(setIntervalMs, MIN_OBSERVATION_INTERVAL_MS); //if setintervalms is 0 it goes to 20, otherwise it is max between it and min observation.
103
102
  observe(draggedEl, dropZones, observationIntervalMs * 1.07);
104
103
  }
105
104
  function unWatchDraggedElement() {