svelte-dnd-action 0.9.15 → 0.9.16

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/dist/index.js CHANGED
@@ -1649,6 +1649,7 @@
1649
1649
  }
1650
1650
 
1651
1651
  function dndzone(node, options) {
1652
+ var initialized = false;
1652
1653
  var config = {
1653
1654
  items: undefined,
1654
1655
  type: undefined,
@@ -1852,7 +1853,7 @@
1852
1853
  config.transformDraggedElement = transformDraggedElement;
1853
1854
  config.centreDraggedOnCursor = centreDraggedOnCursor; // realtime update for dropTargetStyle
1854
1855
 
1855
- if (isWorkingOnPreviousDrag && !finalizingPreviousDrag && (!areObjectsShallowEqual(dropTargetStyle, config.dropTargetStyle) || !areArraysShallowEqualSameOrder(dropTargetClasses, config.dropTargetClasses))) {
1856
+ if (initialized && isWorkingOnPreviousDrag && !finalizingPreviousDrag && (!areObjectsShallowEqual(dropTargetStyle, config.dropTargetStyle) || !areArraysShallowEqualSameOrder(dropTargetClasses, config.dropTargetClasses))) {
1856
1857
  styleInactiveDropZones([node], function () {
1857
1858
  return config.dropTargetStyle;
1858
1859
  }, function () {
@@ -1872,7 +1873,7 @@
1872
1873
  return dzToConfig.get(dz) ? dzToConfig.get(dz)[propName] : config[propName];
1873
1874
  }
1874
1875
 
1875
- if (isWorkingOnPreviousDrag && config.dropFromOthersDisabled !== dropFromOthersDisabled) {
1876
+ if (initialized && isWorkingOnPreviousDrag && config.dropFromOthersDisabled !== dropFromOthersDisabled) {
1876
1877
  if (dropFromOthersDisabled) {
1877
1878
  styleInactiveDropZones([node], function (dz) {
1878
1879
  return getConfigProp(dz, "dropTargetStyle");
@@ -1918,6 +1919,10 @@
1918
1919
 
1919
1920
 
1920
1921
  elToIdx.set(draggableEl, idx);
1922
+
1923
+ if (!initialized) {
1924
+ initialized = true;
1925
+ }
1921
1926
  };
1922
1927
 
1923
1928
  for (var idx = 0; idx < node.children.length; idx++) {
package/dist/index.mjs CHANGED
@@ -1643,6 +1643,7 @@ function cleanupPostDrop() {
1643
1643
  }
1644
1644
 
1645
1645
  function dndzone(node, options) {
1646
+ var initialized = false;
1646
1647
  var config = {
1647
1648
  items: undefined,
1648
1649
  type: undefined,
@@ -1846,7 +1847,7 @@ function dndzone(node, options) {
1846
1847
  config.transformDraggedElement = transformDraggedElement;
1847
1848
  config.centreDraggedOnCursor = centreDraggedOnCursor; // realtime update for dropTargetStyle
1848
1849
 
1849
- if (isWorkingOnPreviousDrag && !finalizingPreviousDrag && (!areObjectsShallowEqual(dropTargetStyle, config.dropTargetStyle) || !areArraysShallowEqualSameOrder(dropTargetClasses, config.dropTargetClasses))) {
1850
+ if (initialized && isWorkingOnPreviousDrag && !finalizingPreviousDrag && (!areObjectsShallowEqual(dropTargetStyle, config.dropTargetStyle) || !areArraysShallowEqualSameOrder(dropTargetClasses, config.dropTargetClasses))) {
1850
1851
  styleInactiveDropZones([node], function () {
1851
1852
  return config.dropTargetStyle;
1852
1853
  }, function () {
@@ -1866,7 +1867,7 @@ function dndzone(node, options) {
1866
1867
  return dzToConfig.get(dz) ? dzToConfig.get(dz)[propName] : config[propName];
1867
1868
  }
1868
1869
 
1869
- if (isWorkingOnPreviousDrag && config.dropFromOthersDisabled !== dropFromOthersDisabled) {
1870
+ if (initialized && isWorkingOnPreviousDrag && config.dropFromOthersDisabled !== dropFromOthersDisabled) {
1870
1871
  if (dropFromOthersDisabled) {
1871
1872
  styleInactiveDropZones([node], function (dz) {
1872
1873
  return getConfigProp(dz, "dropTargetStyle");
@@ -1912,6 +1913,10 @@ function dndzone(node, options) {
1912
1913
 
1913
1914
 
1914
1915
  elToIdx.set(draggableEl, idx);
1916
+
1917
+ if (!initialized) {
1918
+ initialized = true;
1919
+ }
1915
1920
  };
1916
1921
 
1917
1922
  for (var idx = 0; idx < node.children.length; idx++) {
package/package.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "dist"
41
41
  ],
42
42
  "description": "*An awesome drag and drop library for Svelte 3 (not using the browser's built-in dnd, thanks god): Rich animations, nested containers, touch support and more *",
43
- "version": "0.9.15",
43
+ "version": "0.9.16",
44
44
  "repository": {
45
45
  "type": "git",
46
46
  "url": "git+https://github.com/isaacHagoel/svelte-dnd-action.git"
@@ -301,6 +301,7 @@ function cleanupPostDrop() {
301
301
  }
302
302
 
303
303
  export function dndzone(node, options) {
304
+ let initialized = false;
304
305
  const config = {
305
306
  items: undefined,
306
307
  type: undefined,
@@ -442,7 +443,6 @@ export function dndzone(node, options) {
442
443
  }
443
444
  config.type = newType;
444
445
  registerDropZone(node, newType);
445
-
446
446
  config.items = [...items];
447
447
  config.dragDisabled = dragDisabled;
448
448
  config.morphDisabled = morphDisabled;
@@ -451,6 +451,7 @@ export function dndzone(node, options) {
451
451
 
452
452
  // realtime update for dropTargetStyle
453
453
  if (
454
+ initialized &&
454
455
  isWorkingOnPreviousDrag &&
455
456
  !finalizingPreviousDrag &&
456
457
  (!areObjectsShallowEqual(dropTargetStyle, config.dropTargetStyle) ||
@@ -474,7 +475,7 @@ export function dndzone(node, options) {
474
475
  function getConfigProp(dz, propName) {
475
476
  return dzToConfig.get(dz) ? dzToConfig.get(dz)[propName] : config[propName];
476
477
  }
477
- if (isWorkingOnPreviousDrag && config.dropFromOthersDisabled !== dropFromOthersDisabled) {
478
+ if (initialized && isWorkingOnPreviousDrag && config.dropFromOthersDisabled !== dropFromOthersDisabled) {
478
479
  if (dropFromOthersDisabled) {
479
480
  styleInactiveDropZones(
480
481
  [node],
@@ -514,6 +515,10 @@ export function dndzone(node, options) {
514
515
  }
515
516
  // updating the idx
516
517
  elToIdx.set(draggableEl, idx);
518
+
519
+ if (!initialized) {
520
+ initialized = true;
521
+ }
517
522
  }
518
523
  }
519
524
  configure(options);