fluid-dnd 2.3.0 → 2.5.0

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.
Files changed (71) hide show
  1. package/README.md +14 -15
  2. package/dist/{HandlerPublisher-BNn5KECH.cjs → HandlerPublisher-1MmlNkG3.cjs} +1 -1
  3. package/dist/{HandlerPublisher-xM3zyGAn.js → HandlerPublisher-DBjPMiyO.js} +1 -1
  4. package/dist/core/{configHandler.d.ts → config/configHandler.d.ts} +2 -2
  5. package/dist/core/{configHandler.js → config/configHandler.js} +7 -8
  6. package/dist/core/{utils → config}/droppableConfigurator.d.ts +5 -4
  7. package/dist/core/{utils → config}/droppableConfigurator.js +42 -29
  8. package/dist/core/dragAndDrop.d.ts +3 -3
  9. package/dist/core/dragAndDrop.js +53 -9
  10. package/dist/core/events/changeDraggableStyles.d.ts +4 -0
  11. package/dist/core/events/changeDraggableStyles.js +38 -0
  12. package/dist/core/events/dragAndDrop/dragAndDrop.d.ts +9 -0
  13. package/dist/core/events/dragAndDrop/dragAndDrop.js +202 -0
  14. package/dist/core/{utils/translate/GetTranslateBeforeDropping.d.ts → events/dragAndDrop/getTranslateBeforeDropping.d.ts} +2 -2
  15. package/dist/core/{utils/translate/GetTranslateBeforeDropping.js → events/dragAndDrop/getTranslateBeforeDropping.js} +33 -41
  16. package/dist/core/{utils/translate/GetTranslationByDraggingAndEvent.d.ts → events/dragAndDrop/getTranslationByDraggingAndEvent.d.ts} +2 -2
  17. package/dist/core/{utils/translate/GetTranslationByDraggingAndEvent.js → events/dragAndDrop/getTranslationByDraggingAndEvent.js} +12 -13
  18. package/dist/core/events/insert.d.ts +5 -0
  19. package/dist/core/events/insert.js +74 -0
  20. package/dist/core/events/remove.d.ts +4 -0
  21. package/dist/core/events/remove.js +66 -0
  22. package/dist/core/index.d.ts +6 -0
  23. package/dist/core/index.js +7 -0
  24. package/dist/core/{utils/scroll.d.ts → positioning/autoScroll.d.ts} +0 -2
  25. package/dist/core/{utils/scroll.js → positioning/autoScroll.js} +6 -9
  26. package/dist/core/{utils/SetTransform.d.ts → positioning/usePositioning.d.ts} +1 -1
  27. package/dist/core/{utils/SetTransform.js → positioning/usePositioning.js} +24 -27
  28. package/dist/core/{utils/tempChildren.d.ts → tempChildren.d.ts} +1 -2
  29. package/dist/core/{utils/tempChildren.js → tempChildren.js} +44 -47
  30. package/dist/core/useDraggable.js +50 -57
  31. package/dist/core/useDroppable.d.ts +2 -2
  32. package/dist/core/useDroppable.js +10 -16
  33. package/dist/core/utils/GetStyles.d.ts +24 -3
  34. package/dist/core/utils/GetStyles.js +53 -5
  35. package/dist/core/utils/ParseStyles.d.ts +3 -2
  36. package/dist/core/utils/ParseStyles.js +12 -12
  37. package/dist/core/utils/SetStyles.d.ts +6 -5
  38. package/dist/core/utils/SetStyles.js +30 -25
  39. package/dist/core/utils/index.d.ts +5 -1
  40. package/dist/core/utils/index.js +7 -6
  41. package/dist/core/utils/observer.d.ts +1 -0
  42. package/dist/core/utils/observer.js +8 -0
  43. package/dist/fluid-dnd-logo.png +0 -0
  44. package/dist/index-BdOAK6C7.cjs +1 -0
  45. package/dist/index-HczUoMBK.js +1131 -0
  46. package/dist/index.cjs +1 -1
  47. package/dist/index.mjs +2 -2
  48. package/dist/insert-Dd8savAS.js +51 -0
  49. package/dist/insert-T4Y6rI_j.cjs +1 -0
  50. package/dist/react/index.cjs +1 -1
  51. package/dist/react/index.mjs +32 -37
  52. package/dist/react/utils/ReactLilstConfig.d.ts +2 -2
  53. package/dist/react/utils/ReactLilstConfig.js +9 -18
  54. package/dist/remove-BC4sUY1o.cjs +1 -0
  55. package/dist/remove-M01dmTvo.js +48 -0
  56. package/dist/svelte/index.cjs +1 -1
  57. package/dist/svelte/index.mjs +18 -16
  58. package/dist/svelte/utils/SvelteListCondig.js +3 -2
  59. package/dist/vue/index.cjs +1 -1
  60. package/dist/vue/index.mjs +26 -24
  61. package/dist/vue/utils/VueListCondig.d.ts +3 -3
  62. package/dist/vue/utils/VueListCondig.js +4 -6
  63. package/package.json +1 -1
  64. package/dist/core/utils/config.d.ts +0 -5
  65. package/dist/core/utils/config.js +0 -57
  66. package/dist/core/utils/events/emitEvents.d.ts +0 -11
  67. package/dist/core/utils/events/emitEvents.js +0 -333
  68. package/dist/index-BYT3HBbe.cjs +0 -1
  69. package/dist/index-m7C-XuaH.js +0 -1275
  70. /package/dist/core/utils/{touchDevice.d.ts → typesCheckers.d.ts} +0 -0
  71. /package/dist/core/utils/{touchDevice.js → typesCheckers.js} +0 -0
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BYT3HBbe.cjs");exports.dragAndDrop=e.dragAndDrop;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BdOAK6C7.cjs");exports.dragAndDrop=e.dragAndDrop;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { d as o } from "./index-m7C-XuaH.js";
1
+ import { p } from "./index-HczUoMBK.js";
2
2
  export {
3
- o as dragAndDrop
3
+ p as dragAndDrop
4
4
  };
@@ -0,0 +1,51 @@
1
+ import { u as B, c as C, h as g, i as L, j as N, k as F, e as O, g as _, f as G, o as M, a as u, l as v, r as T, n as R } from "./index-HczUoMBK.js";
2
+ function w(s, n, t, e) {
3
+ const { delayBeforeInsert: r } = s, [l, f, i] = B(
4
+ s,
5
+ t,
6
+ e
7
+ ), h = (o, a, c, m, S) => {
8
+ const I = C(
9
+ a,
10
+ "insert",
11
+ s.direction,
12
+ c
13
+ ), { onInsertEvent: y } = s, A = g(c);
14
+ for (const [D, d] of A.entries())
15
+ L(d, N) && D >= o && i(d, I);
16
+ F(a, !1, S), setTimeout(() => {
17
+ y(o, m), E(o, c, s), l(a), b(a, n), O(n, 0, !0);
18
+ }, r);
19
+ }, b = (o, a) => {
20
+ const [c] = _(o, a);
21
+ for (const m of [...c, o])
22
+ G(m);
23
+ };
24
+ return [h];
25
+ }
26
+ const j = (s) => s.addedNodes.values().filter((t) => !R(t)).toArray().length > 0, E = (s, n, t) => {
27
+ const { insertingFromClass: e, animationDuration: r } = t, l = M(
28
+ () => {
29
+ const i = g(n)[s];
30
+ u(i, e), u(i, v), setTimeout(() => {
31
+ T(i, v), T(i, e), l.disconnect();
32
+ }, r);
33
+ },
34
+ n,
35
+ {
36
+ childList: !0
37
+ },
38
+ j
39
+ );
40
+ }, P = (s, n, t, e) => {
41
+ if (!n)
42
+ return;
43
+ const { onInsertEvent: r, delayBeforeInsert: l } = s;
44
+ setTimeout(() => {
45
+ r(t, e), E(t, n, s);
46
+ }, l);
47
+ };
48
+ export {
49
+ w as default,
50
+ P as insertToListEmpty
51
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BdOAK6C7.cjs");function f(s,t,n,i){const{delayBeforeInsert:a}=s,[c,g,o]=e.useChangeDraggableStyles(s,n,i),v=(r,l,d,m,S)=>{const b=e.getTranslationByDraggingAndEvent(l,"insert",s.direction,d),{onInsertEvent:I}=s,h=e.getParentDraggableChildren(d);for(const[y,u]of h.entries())e.containClass(u,e.DRAGGABLE_CLASS)&&y>=r&&o(u,b);e.addTempChildOnInsert(l,!1,S),setTimeout(()=>{I(r,m),T(r,d,s),c(l),E(l,t),e.removeTempChild(t,0,!0)},a)},E=(r,l)=>{const[d]=e.getSiblings(r,l);for(const m of[...d,r])e.removeTranslateWhitoutTransition(m)};return[v]}const A=s=>s.addedNodes.values().filter(n=>!e.isTempElement(n)).toArray().length>0,T=(s,t,n)=>{const{insertingFromClass:i,animationDuration:a}=n,c=e.observeMutation(()=>{const o=e.getParentDraggableChildren(t)[s];e.addClass(o,i),e.addClass(o,e.DISABLE_TRANSITION),setTimeout(()=>{e.removeClass(o,e.DISABLE_TRANSITION),e.removeClass(o,i),c.disconnect()},a)},t,{childList:!0},A)},D=(s,t,n,i)=>{if(!t)return;const{onInsertEvent:a,delayBeforeInsert:c}=s;setTimeout(()=>{a(n,i),T(n,t,s)},c)};exports.default=f;exports.insertToListEmpty=D;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),y=require("../HandlerPublisher-BNn5KECH.cjs"),b=require("../index-BYT3HBbe.cjs"),S=require("react-dom");function A(f,i){const[e,n]=u.useState(f),a=u.useRef(e);u.useEffect(()=>{a.current=e},[e]);function d(t,r=!1){const s=a.current[t],c=()=>{n(o=>[...o.slice(0,t),...o.slice(t+1)])};return r?S.flushSync(c):c(),s}function g(t,r,s=!1){const c=()=>{n(o=>[...o.slice(0,t),r,...o.slice(t)])};s?S.flushSync(c):c()}function h(){return e.length}function m(t){return e[t]}function l(t,r,s){b.insertToListEmpty(t,i.current,r,s)}return[e,n,{removeAtEvent:d,insertEvent:g,getLength:h,getValue:m,insertToListEmpty:l}]}const D=new y.HandlerPublisher;function E(f,i){const e=u.useRef(null),[n,a,d]=A(f,e),[g,h,m]=b.dragAndDrop(d,D,i,"data-index");return u.useEffect(()=>{const l=m(e.current);return()=>{l&&l.disconnect()}},[n.length,i]),[e,n,a,h,g]}exports.useDragAndDrop=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),b=require("../HandlerPublisher-1MmlNkG3.cjs"),v=require("../index-BdOAK6C7.cjs"),S=require("react-dom");function y(f,i){const[e,r]=u.useState(f),a=u.useRef(e);u.useEffect(()=>{a.current=e},[e]);function d(t,s=!1){const c=a.current[t],n=()=>{r(o=>[...o.slice(0,t),...o.slice(t+1)])};return s?S.flushSync(n):n(),c}function g(t,s,c=!1){const n=()=>{r(o=>[...o.slice(0,t),s,...o.slice(t)])};c?S.flushSync(n):n()}function h(){return e.length}function m(t){return e[t]}function l(t,s,c){Promise.resolve().then(()=>require("../insert-T4Y6rI_j.cjs")).then(({insertToListEmpty:n})=>{n(t,i.current,s,c)})}return[e,r,{removeAtEvent:d,insertEvent:g,getLength:h,getValue:m,insertToListEmpty:l}]}const A=new b.HandlerPublisher;function D(f,i){const e=u.useRef(null),[r,a,d]=y(f,e),[g,h,m]=v.dragAndDrop(d,A,i,"data-index");return u.useEffect(()=>{const l=m(e.current);return()=>{l&&l.disconnect()}},[r.length,i]),[e,r,a,h,g]}exports.useDragAndDrop=D;
@@ -1,62 +1,57 @@
1
- import { useState as S, useRef as h, useEffect as E } from "react";
2
- import { H as b } from "../HandlerPublisher-xM3zyGAn.js";
3
- import { i as A, d as C } from "../index-m7C-XuaH.js";
4
- import { flushSync as p } from "react-dom";
5
- function L(l, c) {
6
- const [t, n] = S(l), a = h(t);
7
- E(() => {
8
- a.current = t;
1
+ import { useState as b, useRef as d, useEffect as S } from "react";
2
+ import { H as A } from "../HandlerPublisher-DBjPMiyO.js";
3
+ import { p as C } from "../index-HczUoMBK.js";
4
+ import { flushSync as h } from "react-dom";
5
+ function E(l, i) {
6
+ const [t, r] = b(l), u = d(t);
7
+ S(() => {
8
+ u.current = t;
9
9
  }, [t]);
10
- function f(e, r = !1) {
11
- const s = a.current[e], o = () => {
12
- n((i) => [
13
- ...i.slice(0, e),
14
- ...i.slice(e + 1)
15
- ]);
10
+ function f(e, s = !1) {
11
+ const o = u.current[e], n = () => {
12
+ r((c) => [...c.slice(0, e), ...c.slice(e + 1)]);
16
13
  };
17
- return r ? p(o) : o(), s;
14
+ return s ? h(n) : n(), o;
18
15
  }
19
- function m(e, r, s = !1) {
20
- const o = () => {
21
- n((i) => [
22
- ...i.slice(0, e),
23
- r,
24
- ...i.slice(e)
25
- ]);
16
+ function m(e, s, o = !1) {
17
+ const n = () => {
18
+ r((c) => [...c.slice(0, e), s, ...c.slice(e)]);
26
19
  };
27
- s ? p(o) : o();
20
+ o ? h(n) : n();
28
21
  }
29
- function d() {
22
+ function p() {
30
23
  return t.length;
31
24
  }
32
25
  function g(e) {
33
26
  return t[e];
34
27
  }
35
- function u(e, r, s) {
36
- A(e, c.current, r, s);
28
+ function a(e, s, o) {
29
+ import("../insert-Dd8savAS.js").then(({ insertToListEmpty: n }) => {
30
+ n(e, i.current, s, o);
31
+ });
37
32
  }
38
- return [t, n, {
33
+ return [t, r, {
39
34
  removeAtEvent: f,
40
35
  insertEvent: m,
41
- getLength: d,
36
+ getLength: p,
42
37
  getValue: g,
43
- insertToListEmpty: u
38
+ insertToListEmpty: a
44
39
  }];
45
40
  }
46
- const v = new b();
47
- function k(l, c) {
48
- const t = h(null), [n, a, f] = L(l, t), [m, d, g] = C(
41
+ const v = new A();
42
+ function k(l, i) {
43
+ const t = d(null), [r, u, f] = E(l, t), [m, p, g] = C(
49
44
  f,
50
45
  v,
51
- c,
46
+ i,
52
47
  "data-index"
53
48
  );
54
- return E(() => {
55
- const u = g(t.current);
49
+ return S(() => {
50
+ const a = g(t.current);
56
51
  return () => {
57
- u && u.disconnect();
52
+ a && a.disconnect();
58
53
  };
59
- }, [n.length, c]), [t, n, a, d, m];
54
+ }, [r.length, i]), [t, r, u, p, m];
60
55
  }
61
56
  export {
62
57
  k as useDragAndDrop
@@ -1,3 +1,3 @@
1
- import { RefObject } from "react";
2
- import { ListCondig } from "../../core";
1
+ import { RefObject } from 'react';
2
+ import { ListCondig } from '../../core';
3
3
  export declare function useReactListConfig<T, E extends HTMLElement>(items: T[], parent: RefObject<E>): readonly [T[], import("react").Dispatch<import("react").SetStateAction<T[]>>, ListCondig<T>];
@@ -1,7 +1,6 @@
1
- import { useEffect, useRef, useState } from "react";
2
- import { insertToListEmpty as insertToListEmptyEvent } from "../../core/utils/events/emitEvents";
3
- // @ts-ignore
4
- import { flushSync } from "react-dom";
1
+ import { useEffect, useRef, useState } from 'react';
2
+ // @ts-ignore
3
+ import { flushSync } from 'react-dom';
5
4
  export function useReactListConfig(items, parent) {
6
5
  const [itemsState, setItemsState] = useState(items);
7
6
  const stateRef = useRef(itemsState);
@@ -11,10 +10,7 @@ export function useReactListConfig(items, parent) {
11
10
  function removeAtEvent(index, sync = false) {
12
11
  const deletedItem = stateRef.current[index];
13
12
  const removeCallback = () => {
14
- setItemsState(prevItems => [
15
- ...prevItems.slice(0, index),
16
- ...prevItems.slice(index + 1)
17
- ]);
13
+ setItemsState((prevItems) => [...prevItems.slice(0, index), ...prevItems.slice(index + 1)]);
18
14
  };
19
15
  if (sync) {
20
16
  flushSync(removeCallback);
@@ -24,15 +20,10 @@ export function useReactListConfig(items, parent) {
24
20
  }
25
21
  return deletedItem;
26
22
  }
27
- ;
28
23
  function insertEvent(index, value, sync = false) {
29
24
  const insertCallback = () => {
30
- setItemsState(prevItems => {
31
- return [
32
- ...prevItems.slice(0, index),
33
- value,
34
- ...prevItems.slice(index)
35
- ];
25
+ setItemsState((prevItems) => {
26
+ return [...prevItems.slice(0, index), value, ...prevItems.slice(index)];
36
27
  });
37
28
  };
38
29
  if (sync) {
@@ -42,16 +33,16 @@ export function useReactListConfig(items, parent) {
42
33
  insertCallback();
43
34
  }
44
35
  }
45
- ;
46
36
  function getLength() {
47
37
  return itemsState.length;
48
38
  }
49
- ;
50
39
  function getValue(index) {
51
40
  return itemsState[index];
52
41
  }
53
42
  function insertToListEmpty(config, index, value) {
54
- insertToListEmptyEvent(config, parent.current, index, value);
43
+ import('../../core/events/insert').then(({ insertToListEmpty }) => {
44
+ insertToListEmpty(config, parent.current, index, value);
45
+ });
55
46
  }
56
47
  const actions = {
57
48
  removeAtEvent,
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-BdOAK6C7.cjs");function d(a,l,g,u){const{animationDuration:m}=a,[S]=t.useChangeDraggableStyles(a,g,u),R=(s,o,e,i)=>{if(!e||!e.droppable||!e.config)return;const{droppable:n,config:v}=e;let[r]=t.getSiblings(o,n);r=[o,...r].toReversed();const c=t.getTranslationByDraggingAndEvent(o,"remove",v.direction,n);for(const[h,T]of r.entries())h>=s&&(t.moveTranslate(T,c),setTimeout(()=>{i(T)},m))},b=s=>{t.removeTempChild(l,m,!0),setTimeout(()=>{S(s),f(s,l)},m)},f=(s,o)=>{const[e]=t.getSiblings(s,o);for(const i of[...e,s])t.removeTranslateWhitoutTransition(i)},y=(s,o,e,i,n)=>{const{removingClass:v,delayBeforeRemove:r}=a;o==s&&(t.addClass(e,v),setTimeout(()=>{D(s,o,e,i,n)},r))},D=(s,o,e,i,n)=>{const{removingClass:v,onRemoveAtEvent:r}=a;t.removeClass(e,v),t.addTempChild(e,l,i==t.DraggingState.START_DRAGGING,n),R(o,e,n,c=>{A(c),b(e)}),r(s,!0)},A=s=>{t.setTranistion(s,m,t.draggableTargetTimingFunction),t.moveTranslate(s)};return[y]}exports.default=d;
@@ -0,0 +1,48 @@
1
+ import { u as G, a as B, r as C, b as d, D as N, g as l, c as W, m as g, s as _, d as j, e as k, f as p } from "./index-HczUoMBK.js";
2
+ function w(r, m, u, R) {
3
+ const { animationDuration: v } = r, [S] = G(
4
+ r,
5
+ u,
6
+ R
7
+ ), f = (s, t, o, e) => {
8
+ if (!o || !o.droppable || !o.config)
9
+ return;
10
+ const { droppable: i, config: a } = o;
11
+ let [n] = l(t, i);
12
+ n = [t, ...n].toReversed();
13
+ const c = W(
14
+ t,
15
+ "remove",
16
+ a.direction,
17
+ i
18
+ );
19
+ for (const [F, T] of n.entries())
20
+ F >= s && (g(T, c), setTimeout(() => {
21
+ e(T);
22
+ }, v));
23
+ }, D = (s) => {
24
+ k(m, v, !0), setTimeout(() => {
25
+ S(s), b(s, m);
26
+ }, v);
27
+ }, b = (s, t) => {
28
+ const [o] = l(s, t);
29
+ for (const e of [...o, s])
30
+ p(e);
31
+ }, A = (s, t, o, e, i) => {
32
+ const { removingClass: a, delayBeforeRemove: n } = r;
33
+ t == s && (B(o, a), setTimeout(() => {
34
+ h(s, t, o, e, i);
35
+ }, n));
36
+ }, h = (s, t, o, e, i) => {
37
+ const { removingClass: a, onRemoveAtEvent: n } = r;
38
+ C(o, a), d(o, m, e == N.START_DRAGGING, i), f(t, o, i, (c) => {
39
+ y(c), D(o);
40
+ }), n(s, !0);
41
+ }, y = (s) => {
42
+ _(s, v, j), g(s);
43
+ };
44
+ return [A];
45
+ }
46
+ export {
47
+ w as default
48
+ };
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var d=(n,t,e)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var s=(n,t,e)=>d(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../HandlerPublisher-BNn5KECH.cjs"),o=require("../index-BYT3HBbe.cjs");class g{constructor(t){s(this,"items");s(this,"parent");this.items=t}setParent(t){this.parent=t}removeAtEvent(t){const e=this.items;if(e.length<=0)return;const[r]=e.splice(t,1);return r}insertEvent(t,e){this.items.splice(t,0,e)}getLength(){return this.items.length}getValue(t){return this.items[t]}insertToListEmpty(t,e,r){o.insertToListEmpty(t,this.parent,e,r)}}const h=new c.HandlerPublisher;function m(n,t){const e=new g(n),[r,l,a]=o.dragAndDrop(e,h,t,"data-index");return[i=>(e.setParent(i),a(i),{destroy(){}}),l,r]}exports.useDragAndDrop=m;
1
+ "use strict";var a=Object.defineProperty;var u=(n,e,t)=>e in n?a(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var i=(n,e,t)=>u(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../HandlerPublisher-1MmlNkG3.cjs"),c=require("../index-BdOAK6C7.cjs");class h{constructor(e){i(this,"items");i(this,"parent");this.items=e}setParent(e){this.parent=e}removeAtEvent(e){const t=this.items;if(t.length<=0)return;const[r]=t.splice(e,1);return r}insertEvent(e,t){this.items.splice(e,0,t)}getLength(){return this.items.length}getValue(e){return this.items[e]}insertToListEmpty(e,t,r){Promise.resolve().then(()=>require("../insert-T4Y6rI_j.cjs")).then(({insertToListEmpty:s})=>{s(e,this.parent,t,r)})}}const g=new d.HandlerPublisher;function m(n,e){const t=new h(n),[r,s,l]=c.dragAndDrop(t,g,e,"data-index");return[o=>(t.setParent(o),l(o),{destroy(){}}),s,r]}exports.useDragAndDrop=m;
@@ -1,12 +1,12 @@
1
1
  var l = Object.defineProperty;
2
2
  var d = (n, t, e) => t in n ? l(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var r = (n, t, e) => d(n, typeof t != "symbol" ? t + "" : t, e);
4
- import { H as c } from "../HandlerPublisher-xM3zyGAn.js";
5
- import { i as m, d as u } from "../index-m7C-XuaH.js";
6
- class h {
3
+ var i = (n, t, e) => d(n, typeof t != "symbol" ? t + "" : t, e);
4
+ import { H as c } from "../HandlerPublisher-DBjPMiyO.js";
5
+ import { p as h } from "../index-HczUoMBK.js";
6
+ class m {
7
7
  constructor(t) {
8
- r(this, "items");
9
- r(this, "parent");
8
+ i(this, "items");
9
+ i(this, "parent");
10
10
  this.items = t;
11
11
  }
12
12
  setParent(t) {
@@ -16,8 +16,8 @@ class h {
16
16
  const e = this.items;
17
17
  if (e.length <= 0)
18
18
  return;
19
- const [s] = e.splice(t, 1);
20
- return s;
19
+ const [r] = e.splice(t, 1);
20
+ return r;
21
21
  }
22
22
  insertEvent(t, e) {
23
23
  this.items.splice(t, 0, e);
@@ -28,18 +28,20 @@ class h {
28
28
  getValue(t) {
29
29
  return this.items[t];
30
30
  }
31
- insertToListEmpty(t, e, s) {
32
- m(t, this.parent, e, s);
31
+ insertToListEmpty(t, e, r) {
32
+ import("../insert-Dd8savAS.js").then(({ insertToListEmpty: s }) => {
33
+ s(t, this.parent, e, r);
34
+ });
33
35
  }
34
36
  }
35
- const p = new c();
36
- function P(n, t) {
37
- const e = new h(n), [s, o, a] = u(e, p, t, "data-index");
38
- return [(i) => (e.setParent(i), a(i), {
37
+ const u = new c();
38
+ function D(n, t) {
39
+ const e = new m(n), [r, s, a] = h(e, u, t, "data-index");
40
+ return [(o) => (e.setParent(o), a(o), {
39
41
  destroy() {
40
42
  }
41
- }), o, s];
43
+ }), s, r];
42
44
  }
43
45
  export {
44
- P as useDragAndDrop
46
+ D as useDragAndDrop
45
47
  };
@@ -1,4 +1,3 @@
1
- import { insertToListEmpty } from '../../core/utils/events/emitEvents';
2
1
  export class SvelteListCondig {
3
2
  items;
4
3
  parent;
@@ -27,6 +26,8 @@ export class SvelteListCondig {
27
26
  return this.items[index];
28
27
  }
29
28
  insertToListEmpty(config, index, value) {
30
- insertToListEmpty(config, this.parent, index, value);
29
+ import('../../core/events/insert').then(({ insertToListEmpty }) => {
30
+ insertToListEmpty(config, this.parent, index, value);
31
+ });
31
32
  }
32
33
  }
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var h=(n,e,t)=>e in n?c(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var s=(n,e,t)=>h(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("vue"),g=require("../HandlerPublisher-BNn5KECH.cjs"),u=require("../index-BYT3HBbe.cjs"),v=(n,e)=>{const t=n.value;if(t.length<=0)return;const[r]=t.splice(e,1);return r},d=(n,e,t)=>{n.value.splice(e,0,t)},m=n=>n.value.length,p=(n,e)=>n.value[e];class V{constructor(e,t){s(this,"items");s(this,"parent");this.items=e,this.parent=t}removeAtEvent(e){return v(this.items,e)}insertEvent(e,t){return d(this.items,e,t)}getLength(){return m(this.items)}getValue(e){return p(this.items,e)}insertToListEmpty(e,t,r){u.insertToListEmpty(e,this.parent.value,t,r)}}const A=new g.HandlerPublisher;function L(n,e){const t=i.ref();var r=new V(n,t);const[l,o,a]=u.dragAndDrop(r,A,e);return i.watch(t,()=>{a(t.value)}),[t,o,l]}exports.useDragAndDrop=L;
1
+ "use strict";var a=Object.defineProperty;var c=(n,e,t)=>e in n?a(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var i=(n,e,t)=>c(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue"),h=require("../HandlerPublisher-1MmlNkG3.cjs"),v=require("../index-BdOAK6C7.cjs"),g=(n,e)=>{const t=n.value;if(t.length<=0)return;const[r]=t.splice(e,1);return r},d=(n,e,t)=>{n.value.splice(e,0,t)},m=n=>n.value.length,p=(n,e)=>n.value[e];class V{constructor(e,t){i(this,"items");i(this,"parent");this.items=e,this.parent=t}removeAtEvent(e){return g(this.items,e)}insertEvent(e,t){return d(this.items,e,t)}getLength(){return m(this.items)}getValue(e){return p(this.items,e)}insertToListEmpty(e,t,r){Promise.resolve().then(()=>require("../insert-T4Y6rI_j.cjs")).then(({insertToListEmpty:s})=>{s(e,this.parent.value,t,r)})}}const A=new h.HandlerPublisher;function L(n,e){const t=u.ref();var r=new V(n,t);const[s,l,o]=v.dragAndDrop(r,A,e);return u.watch(t,()=>{o(t.value)}),[t,l,s]}exports.useDragAndDrop=L;
@@ -1,49 +1,51 @@
1
- var l = Object.defineProperty;
2
- var u = (n, t, e) => t in n ? l(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var r = (n, t, e) => u(n, typeof t != "symbol" ? t + "" : t, e);
1
+ var a = Object.defineProperty;
2
+ var u = (n, t, e) => t in n ? a(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var i = (n, t, e) => u(n, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { ref as c, watch as m } from "vue";
5
- import { H as h } from "../HandlerPublisher-xM3zyGAn.js";
6
- import { i as p, d as v } from "../index-m7C-XuaH.js";
7
- const g = (n, t) => {
5
+ import { H as h } from "../HandlerPublisher-DBjPMiyO.js";
6
+ import { p } from "../index-HczUoMBK.js";
7
+ const v = (n, t) => {
8
8
  const e = n.value;
9
9
  if (e.length <= 0)
10
10
  return;
11
- const [s] = e.splice(t, 1);
12
- return s;
13
- }, d = (n, t, e) => {
11
+ const [r] = e.splice(t, 1);
12
+ return r;
13
+ }, g = (n, t, e) => {
14
14
  n.value.splice(t, 0, e);
15
- }, V = (n) => n.value.length, L = (n, t) => n.value[t];
15
+ }, d = (n) => n.value.length, V = (n, t) => n.value[t];
16
16
  class f {
17
17
  constructor(t, e) {
18
- r(this, "items");
19
- r(this, "parent");
18
+ i(this, "items");
19
+ i(this, "parent");
20
20
  this.items = t, this.parent = e;
21
21
  }
22
22
  removeAtEvent(t) {
23
- return g(this.items, t);
23
+ return v(this.items, t);
24
24
  }
25
25
  insertEvent(t, e) {
26
- return d(this.items, t, e);
26
+ return g(this.items, t, e);
27
27
  }
28
28
  getLength() {
29
- return V(this.items);
29
+ return d(this.items);
30
30
  }
31
31
  getValue(t) {
32
- return L(this.items, t);
32
+ return V(this.items, t);
33
33
  }
34
- insertToListEmpty(t, e, s) {
35
- p(t, this.parent.value, e, s);
34
+ insertToListEmpty(t, e, r) {
35
+ import("../insert-Dd8savAS.js").then(({ insertToListEmpty: s }) => {
36
+ s(t, this.parent.value, e, r);
37
+ });
36
38
  }
37
39
  }
38
40
  const A = new h();
39
- function P(n, t) {
41
+ function D(n, t) {
40
42
  const e = c();
41
- var s = new f(n, e);
42
- const [i, o, a] = v(s, A, t);
43
+ var r = new f(n, e);
44
+ const [s, o, l] = p(r, A, t);
43
45
  return m(e, () => {
44
- a(e.value);
45
- }), [e, o, i];
46
+ l(e.value);
47
+ }), [e, o, s];
46
48
  }
47
49
  export {
48
- P as useDragAndDrop
50
+ D as useDragAndDrop
49
51
  };
@@ -1,6 +1,6 @@
1
- import { CoreConfig } from "../../core";
2
- import { ListCondig } from "../../core";
3
- import { Ref } from "vue";
1
+ import { CoreConfig } from '../../core';
2
+ import { ListCondig } from '../../core';
3
+ import { Ref } from 'vue';
4
4
  export declare class VueListCondig<T> implements ListCondig<T> {
5
5
  private items;
6
6
  private parent;
@@ -1,5 +1,4 @@
1
- import { getLength, getValue, onInsertEventOnList, removeAtEventOnList } from "./DropMethods";
2
- import { insertToListEmpty } from "../../core/utils/events/emitEvents";
1
+ import { getLength, getValue, onInsertEventOnList, removeAtEventOnList } from './DropMethods';
3
2
  export class VueListCondig {
4
3
  items;
5
4
  parent;
@@ -10,19 +9,18 @@ export class VueListCondig {
10
9
  removeAtEvent(index) {
11
10
  return removeAtEventOnList(this.items, index);
12
11
  }
13
- ;
14
12
  insertEvent(index, value) {
15
13
  return onInsertEventOnList(this.items, index, value);
16
14
  }
17
- ;
18
15
  getLength() {
19
16
  return getLength(this.items);
20
17
  }
21
- ;
22
18
  getValue(index) {
23
19
  return getValue(this.items, index);
24
20
  }
25
21
  insertToListEmpty(config, index, value) {
26
- insertToListEmpty(config, this.parent.value, index, value);
22
+ import('../../core/events/insert').then(({ insertToListEmpty }) => {
23
+ insertToListEmpty(config, this.parent.value, index, value);
24
+ });
27
25
  }
28
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fluid-dnd",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "An agnostic drag and drop library to sort all kind of lists. With current support for vue, react and svelte",
5
5
  "type": "module",
6
6
  "homepage": "https://fluid-dnd.netlify.app",
@@ -1,5 +0,0 @@
1
- import { ListCondig, MapFrom } from '..';
2
- import { Config, CoreConfig } from '..';
3
- import { DroppableConfig } from '../configHandler';
4
- export declare const getConfig: <T>(listCondig: ListCondig<T>, config?: Config<T>) => CoreConfig<T>;
5
- export declare const MapConfig: <T>(coreConfig: DroppableConfig<any>, mapFrom: MapFrom<T>) => CoreConfig<any>;
@@ -1,57 +0,0 @@
1
- import { VERTICAL } from '..';
2
- import { DRAGGABLE_CLASS } from './classes';
3
- export const getConfig = (listCondig, config) => {
4
- const onRemoveAtEvent = (index, sync) => {
5
- return listCondig.removeAtEvent(index, sync);
6
- };
7
- const onInsertEvent = (index, value, sync) => {
8
- return listCondig.insertEvent(index, value, sync);
9
- };
10
- const onGetLegth = () => {
11
- return listCondig.getLength();
12
- };
13
- const onGetValue = (index) => {
14
- return listCondig.getValue(index);
15
- };
16
- const defaultMapFrom = (object) => {
17
- return object;
18
- };
19
- return {
20
- direction: config?.direction ?? VERTICAL,
21
- handlerSelector: config?.handlerSelector ?? DRAGGABLE_CLASS,
22
- draggingClass: config?.draggingClass ?? 'dragging',
23
- droppableClass: config?.droppableClass ?? 'droppable-hover',
24
- isDraggable: config?.isDraggable ?? (() => true),
25
- onDragStart: config?.onDragStart ?? (() => { }),
26
- onDragEnd: config?.onDragEnd ?? (() => { }),
27
- droppableGroup: config?.droppableGroup,
28
- onRemoveAtEvent,
29
- onInsertEvent,
30
- onGetLegth,
31
- onGetValue,
32
- animationDuration: config?.animationDuration ?? 200,
33
- removingClass: config?.removingClass ?? 'removing',
34
- insertingFromClass: config?.insertingFromClass ?? 'from-inserting',
35
- delayBeforeRemove: config?.delayBeforeRemove ?? 200,
36
- delayBeforeInsert: config?.delayBeforeInsert ?? 200,
37
- mapFrom: config?.mapFrom ?? defaultMapFrom,
38
- delayBeforeTouchMoveEvent: config?.delayBeforeTouchMoveEvent ?? 150,
39
- coordinateTransform: config?.coordinateTransform ?? [(coordinate) => coordinate]
40
- };
41
- };
42
- export const MapConfig = (coreConfig, mapFrom) => {
43
- const { config, droppable } = coreConfig;
44
- const { onInsertEvent, onDragEnd } = config;
45
- const mapOnInsertEvent = (index, value) => {
46
- return onInsertEvent(index, mapFrom(value, droppable), true);
47
- };
48
- const mapOnDragEnd = (eventData) => {
49
- const { index, value } = eventData;
50
- onDragEnd({ index, value: mapFrom(value, droppable) });
51
- };
52
- return {
53
- ...config,
54
- onDragEnd: mapOnDragEnd,
55
- onInsertEvent: mapOnInsertEvent
56
- };
57
- };
@@ -1,11 +0,0 @@
1
- import { WindowScroll } from "../../../../index";
2
- import { CoreConfig } from "../..";
3
- import { DRAG_EVENT, START_DRAG_EVENT, START_DROP_EVENT } from "..";
4
- import { DroppableConfig } from "../../configHandler";
5
- import HandlerPublisher from '../../HandlerPublisher';
6
- type DraggingEvent = typeof DRAG_EVENT | typeof START_DRAG_EVENT;
7
- type DragAndDropEvent = DraggingEvent | DropEvent;
8
- type DropEvent = "drop" | typeof START_DROP_EVENT;
9
- export default function useEmitEvents<T>(currentConfig: CoreConfig<T>, index: number, parent: HTMLElement, droppableGroupClass: string | null, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(draggedElement: HTMLElement, event: DragAndDropEvent, initialWindowScroll: WindowScroll, droppableConfig: DroppableConfig<T> | undefined, positionOnSourceDroppable?: number) => void, (targetIndex: number, draggedElement: HTMLElement, droppableConfig: DroppableConfig<T>, onFinishRemoveEvent: (element: HTMLElement) => void) => void, (targetIndex: number, draggedElement: HTMLElement, droppable: HTMLElement, value: T, startInserting: () => void) => void, (draggedElement: HTMLElement) => void, (element: Element, force: boolean) => void];
10
- export declare const insertToListEmpty: <T>(config: CoreConfig<T>, droppable: HTMLElement | undefined | null, targetIndex: number, value: T) => void;
11
- export {};