svelte-dnd-action 0.9.58 → 0.9.60

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
@@ -1752,7 +1752,12 @@
1752
1752
 
1753
1753
  // dragging initiated by touch events prevents onclick from initially firing
1754
1754
  if (e.type === "touchend") {
1755
- e.target.click();
1755
+ var clickEvent = new Event("click", {
1756
+ bubbles: true,
1757
+ cancelable: true
1758
+ });
1759
+ // doing it this way instead of calling .click() because that doesn't work for SVG elements
1760
+ e.target.dispatchEvent(clickEvent);
1756
1761
  }
1757
1762
  }
1758
1763
  function handleMouseMoveMaybeDragStart(e) {
@@ -1828,12 +1833,13 @@
1828
1833
  if (!originalDragTarget.parentElement) {
1829
1834
  originalDragTarget.setAttribute(ORIGINAL_DRAGGED_ITEM_MARKER_ATTRIBUTE, true);
1830
1835
  originDropZoneRoot.appendChild(originalDragTarget);
1836
+ // have to watch before we hide, otherwise Svelte 5 $state gets confused
1837
+ watchDraggedElement();
1831
1838
  hideElement(originalDragTarget);
1832
1839
  // after the removal of the original element we can give the shadow element the original item id so that the host zone can find it and render it correctly if it does lookups by id
1833
1840
  shadowElData[ITEM_ID_KEY] = draggedElData[ITEM_ID_KEY];
1834
1841
  // to prevent the outline from disappearing
1835
1842
  draggedEl.focus();
1836
- watchDraggedElement();
1837
1843
  } else {
1838
1844
  window.requestAnimationFrame(keepOriginalElementInDom);
1839
1845
  }
package/dist/index.mjs CHANGED
@@ -1746,7 +1746,12 @@ function dndzone$2(node, options) {
1746
1746
 
1747
1747
  // dragging initiated by touch events prevents onclick from initially firing
1748
1748
  if (e.type === "touchend") {
1749
- e.target.click();
1749
+ var clickEvent = new Event("click", {
1750
+ bubbles: true,
1751
+ cancelable: true
1752
+ });
1753
+ // doing it this way instead of calling .click() because that doesn't work for SVG elements
1754
+ e.target.dispatchEvent(clickEvent);
1750
1755
  }
1751
1756
  }
1752
1757
  function handleMouseMoveMaybeDragStart(e) {
@@ -1822,12 +1827,13 @@ function dndzone$2(node, options) {
1822
1827
  if (!originalDragTarget.parentElement) {
1823
1828
  originalDragTarget.setAttribute(ORIGINAL_DRAGGED_ITEM_MARKER_ATTRIBUTE, true);
1824
1829
  originDropZoneRoot.appendChild(originalDragTarget);
1830
+ // have to watch before we hide, otherwise Svelte 5 $state gets confused
1831
+ watchDraggedElement();
1825
1832
  hideElement(originalDragTarget);
1826
1833
  // after the removal of the original element we can give the shadow element the original item id so that the host zone can find it and render it correctly if it does lookups by id
1827
1834
  shadowElData[ITEM_ID_KEY] = draggedElData[ITEM_ID_KEY];
1828
1835
  // to prevent the outline from disappearing
1829
1836
  draggedEl.focus();
1830
- watchDraggedElement();
1831
1837
  } else {
1832
1838
  window.requestAnimationFrame(keepOriginalElementInDom);
1833
1839
  }
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.58",
4
+ "version": "0.9.60",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/isaacHagoel/svelte-dnd-action.git"
@@ -374,7 +374,12 @@ export function dndzone(node, options) {
374
374
 
375
375
  // dragging initiated by touch events prevents onclick from initially firing
376
376
  if (e.type === "touchend") {
377
- e.target.click();
377
+ const clickEvent = new Event("click", {
378
+ bubbles: true,
379
+ cancelable: true
380
+ });
381
+ // doing it this way instead of calling .click() because that doesn't work for SVG elements
382
+ e.target.dispatchEvent(clickEvent);
378
383
  }
379
384
  }
380
385
 
@@ -439,12 +444,13 @@ export function dndzone(node, options) {
439
444
  if (!originalDragTarget.parentElement) {
440
445
  originalDragTarget.setAttribute(ORIGINAL_DRAGGED_ITEM_MARKER_ATTRIBUTE, true);
441
446
  originDropZoneRoot.appendChild(originalDragTarget);
447
+ // have to watch before we hide, otherwise Svelte 5 $state gets confused
448
+ watchDraggedElement();
442
449
  hideElement(originalDragTarget);
443
450
  // after the removal of the original element we can give the shadow element the original item id so that the host zone can find it and render it correctly if it does lookups by id
444
451
  shadowElData[ITEM_ID_KEY] = draggedElData[ITEM_ID_KEY];
445
452
  // to prevent the outline from disappearing
446
453
  draggedEl.focus();
447
- watchDraggedElement();
448
454
  } else {
449
455
  window.requestAnimationFrame(keepOriginalElementInDom);
450
456
  }