svelte-dnd-action 0.9.54 → 0.9.56

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
@@ -1633,7 +1633,11 @@
1633
1633
  source: SOURCES.POINTER
1634
1634
  });
1635
1635
  }
1636
- if (shadowElIdx !== -1) unDecorateShadowElement(shadowElDropZone.children[shadowElIdx]);
1636
+ // In edge cases the dom might have not been updated yet so we can't rely on data list index
1637
+ var domShadowEl = Array.from(shadowElDropZone.children).find(function (c) {
1638
+ return c.getAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME);
1639
+ });
1640
+ if (domShadowEl) unDecorateShadowElement(domShadowEl);
1637
1641
  cleanupPostDrop();
1638
1642
  }
1639
1643
  if (dzToConfig$1.get(shadowElDropZone).dropAnimationDisabled) {
@@ -1806,7 +1810,7 @@
1806
1810
  originIndex = currentIdx;
1807
1811
  originDropZone = originalDragTarget.parentElement;
1808
1812
  /** @type {ShadowRoot | HTMLDocument | Element } */
1809
- var rootNode = originDropZone.closest("dialog") || originDropZone.getRootNode();
1813
+ var rootNode = originDropZone.closest("dialog") || originDropZone.closest("[popover]") || originDropZone.getRootNode();
1810
1814
  var originDropZoneRoot = rootNode.body || rootNode;
1811
1815
  var originalItems = config.items,
1812
1816
  type = config.type,
package/dist/index.mjs CHANGED
@@ -1627,7 +1627,11 @@ function handleDrop$1() {
1627
1627
  source: SOURCES.POINTER
1628
1628
  });
1629
1629
  }
1630
- if (shadowElIdx !== -1) unDecorateShadowElement(shadowElDropZone.children[shadowElIdx]);
1630
+ // In edge cases the dom might have not been updated yet so we can't rely on data list index
1631
+ var domShadowEl = Array.from(shadowElDropZone.children).find(function (c) {
1632
+ return c.getAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME);
1633
+ });
1634
+ if (domShadowEl) unDecorateShadowElement(domShadowEl);
1631
1635
  cleanupPostDrop();
1632
1636
  }
1633
1637
  if (dzToConfig$1.get(shadowElDropZone).dropAnimationDisabled) {
@@ -1800,7 +1804,7 @@ function dndzone$2(node, options) {
1800
1804
  originIndex = currentIdx;
1801
1805
  originDropZone = originalDragTarget.parentElement;
1802
1806
  /** @type {ShadowRoot | HTMLDocument | Element } */
1803
- var rootNode = originDropZone.closest("dialog") || originDropZone.getRootNode();
1807
+ var rootNode = originDropZone.closest("dialog") || originDropZone.closest("[popover]") || originDropZone.getRootNode();
1804
1808
  var originDropZoneRoot = rootNode.body || rootNode;
1805
1809
  var originalItems = config.items,
1806
1810
  type = config.type,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "svelte-dnd-action",
3
3
  "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 *",
4
- "version": "0.9.54",
4
+ "version": "0.9.56",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/isaacHagoel/svelte-dnd-action.git"
@@ -3,6 +3,7 @@ import {
3
3
  incrementActiveDropZoneCount,
4
4
  ITEM_ID_KEY,
5
5
  printDebug,
6
+ SHADOW_ELEMENT_ATTRIBUTE_NAME,
6
7
  SHADOW_ITEM_MARKER_PROPERTY_NAME,
7
8
  SHADOW_PLACEHOLDER_ITEM_ID,
8
9
  SOURCES,
@@ -114,7 +115,7 @@ function unWatchDraggedElement() {
114
115
  }
115
116
  window.removeEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, handleDrop);
116
117
  // ensuring multiScroller is not already destroyed before destroying
117
- if(multiScroller) {
118
+ if (multiScroller) {
118
119
  multiScroller.destroy();
119
120
  multiScroller = undefined;
120
121
  }
@@ -271,7 +272,9 @@ function handleDrop() {
271
272
  source: SOURCES.POINTER
272
273
  });
273
274
  }
274
- if (shadowElIdx !== -1) unDecorateShadowElement(shadowElDropZone.children[shadowElIdx]);
275
+ // In edge cases the dom might have not been updated yet so we can't rely on data list index
276
+ const domShadowEl = Array.from(shadowElDropZone.children).find(c => c.getAttribute(SHADOW_ELEMENT_ATTRIBUTE_NAME));
277
+ if (domShadowEl) unDecorateShadowElement(domShadowEl);
275
278
  cleanupPostDrop();
276
279
  }
277
280
  if (dzToConfig.get(shadowElDropZone).dropAnimationDisabled) {
@@ -420,7 +423,7 @@ export function dndzone(node, options) {
420
423
  originIndex = currentIdx;
421
424
  originDropZone = originalDragTarget.parentElement;
422
425
  /** @type {ShadowRoot | HTMLDocument | Element } */
423
- const rootNode = originDropZone.closest("dialog") || originDropZone.getRootNode();
426
+ const rootNode = originDropZone.closest("dialog") || originDropZone.closest("[popover]") || originDropZone.getRootNode();
424
427
  const originDropZoneRoot = rootNode.body || rootNode;
425
428
  const {items: originalItems, type, centreDraggedOnCursor} = config;
426
429
  const items = [...originalItems];