fluid-dnd 1.0.7-beta.0 → 1.0.9-beta.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.
- package/dist/{HandlerPublisher-BUubPiyW.js → HandlerPublisher-BB9x-ZRw.js} +1 -1
- package/dist/{HandlerPublisher-D-RJfytA.cjs → HandlerPublisher-DOxQ571w.cjs} +1 -1
- package/dist/core/utils/observer.d.ts +1 -1
- package/dist/core/utils/tempChildren.d.ts +1 -0
- package/dist/core/utils/touchDevice.d.ts +1 -1
- package/dist/index/index.cjs +1 -1
- package/dist/index/index.mjs +1 -1
- package/dist/index-8hgMEqsO.cjs +1 -0
- package/dist/index-yDxrxM5t.js +1258 -0
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.mjs +2 -2
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/index-B0MByO4j.js +0 -1255
- package/dist/index-B6KgPfpv.cjs +0 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
var d = Object.defineProperty;
|
2
2
|
var e = (a, s, l) => s in a ? d(a, s, { enumerable: !0, configurable: !0, writable: !0, value: l }) : a[s] = l;
|
3
3
|
var r = (a, s, l) => e(a, typeof s != "symbol" ? s + "" : s, l);
|
4
|
-
import { a as h, t as n, G as t } from "./index-
|
4
|
+
import { a as h, t as n, G as t } from "./index-yDxrxM5t.js";
|
5
5
|
class c {
|
6
6
|
constructor() {
|
7
7
|
r(this, "handlers");
|
@@ -1 +1 @@
|
|
1
|
-
"use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-
|
1
|
+
"use strict";var d=Object.defineProperty;var n=(e,s,l)=>s in e?d(e,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[s]=l;var a=(e,s,l)=>n(e,typeof s!="symbol"?s+"":s,l);const r=require("./index-8hgMEqsO.cjs");class h{constructor(){a(this,"handlers");this.handlers=[]}addSubscriber(s){this.handlers.includes(s)||(this.handlers.push(s),r.addClass(s,r.GRAB_CLASS))}toggleGrabClass(s){for(const l of this.handlers)r.toggleClass(l,r.GRAB_CLASS,s)}}exports.HandlerPublisher=h;
|
@@ -1 +1 @@
|
|
1
|
-
export declare const observeMutation: (callback: (observer: MutationObserver, mutation: MutationRecord) => void, element: Element, options?: MutationObserverInit) => MutationObserver;
|
1
|
+
export declare const observeMutation: (callback: (observer: MutationObserver, mutation: MutationRecord) => void, element: Element, options?: MutationObserverInit, mutationFilter?: (mutation: MutationRecord) => boolean) => MutationObserver;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { DroppableConfig } from "../configHandler";
|
2
|
+
export declare const isTempElement: (element: Node) => boolean;
|
2
3
|
export declare const addTempChild: <T>(draggedElement: HTMLElement | undefined, parent: Element, ifStartDragging: boolean, droppableConfig?: DroppableConfig<T>, addingAnimationDuration?: number) => void;
|
3
4
|
export declare const addTempChildOnInsert: <T>(draggedElement: HTMLElement | undefined, ifStartDragging: boolean, droppableConfig?: DroppableConfig<T>) => void;
|
4
5
|
export declare const removeTempChildrens: (droppable: HTMLElement, parent: HTMLElement, droppableGroupClass: string | null, animationDuration: number, draggedElementIsOutside?: boolean) => void;
|
@@ -1,3 +1,3 @@
|
|
1
1
|
export declare const isTouchEvent: (event: MouseEvent | TouchEvent) => event is TouchEvent;
|
2
|
-
export declare const IsHTMLElement: (element: Element | undefined) => element is HTMLElement;
|
2
|
+
export declare const IsHTMLElement: (element: Element | Node | undefined) => element is HTMLElement;
|
3
3
|
export declare const IsMouseEvent: (event: MouseEvent | TouchEvent) => event is MouseEvent;
|
package/dist/index/index.cjs
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../index-8hgMEqsO.cjs");exports.dragAndDrop=e.dragAndDrop;
|
package/dist/index/index.mjs
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";var De=Object.defineProperty;var ve=(t,e,n)=>e in t?De(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var J=(t,e,n)=>ve(t,typeof e!="symbol"?e+"":e,n);const Q="draggable",It="droppable",Ot="handler-class",Ht="dragging",Yt="dragging-handler-class",Wt="dropping",se="grabbing",oe="grab",Zt="disable-transition",nt=(t,e)=>t.classList.contains(e),gt=(t,e,n=!1)=>{t.classList.toggle(e,n)},U=(t,e)=>{t.classList.add(e)},Et=(t,e)=>{t.classList.remove(e)},Te=(t,e)=>Ct(e).every(n=>nt(t,n)),pt=t=>t?`.${Ct(t).join(".")}`:"",be=(t,e)=>{if(!e)return;const n=Ct(e);t.classList.add(...n)},Ct=t=>t?t.split(" ").filter(e=>e):[],V="horizontal",tt="vertical",ye=()=>{const{scrollX:t,scrollY:e}=window;return{scrollX:t,scrollY:e}},qt=t=>!t||t.trim().length==0||t=="normal"?0:parseFloat(t),Ee=t=>t?parseInt(t):-1,Ce=t=>{const e=getComputedStyle(t),n=new DOMMatrixReadOnly(e.transform);return{x:n.m41,y:n.m42}},re=(t,e)=>t.x1>e.x1?re(e,t):t.x2<e.x1?0:t.x2>=e.x2?t.x2-t.x1:t.x2-e.x1,ht=(t,e)=>!Ae(t,e),Ae=(t,e)=>{const n=Mt(t),s=Mt(e),o=Jt(n,s,tt),r=Jt(n,s,V);return o>=Math.min(n.height,s.height)/2&&r>=Math.min(n.width,s.width)/2},Jt=(t,e,n)=>{const{before:s,distance:o}=w(n);return re({x1:t[s],x2:t[s]+t[o]},{x1:e[s],x2:e[s]+e[o]})},L=(t,e)=>t?qt(getComputedStyle(t)[e]):0,Kt=t=>{const{scrollLeft:e,scrollTop:n}=t;return{scrollLeft:e,scrollTop:n}},Mt=t=>t.getBoundingClientRect(),w=t=>{const e=t==V;return{beforeMargin:e?"marginLeft":"marginTop",afterMargin:e?"marginRight":"marginBottom",borderBeforeWidth:e?"borderLeftWidth":"borderTopWidth",before:e?"left":"top",after:e?"right":"down",gap:e?"columnGap":"rowGap",distance:e?"width":"height",axis:e?"x":"y",offset:e?"offsetX":"offsetY",scroll:e?"scrollX":"scrollY",scrollElement:e?"scrollLeft":"scrollTop",page:e?"pageX":"pageY",inner:e?"innerWidth":"innerHeight",offsetElement:e?"offsetLeft":"offsetTop",scrollDistance:e?"scrollWidth":"scrollHeight",clientDistance:e?"clientWidth":"clientHeight",paddingBefore:e?"paddingLeft":"paddingTop",getRect:Mt}},Rt=(t,e)=>xe(t,e),ie=t=>[...t.children].filter(n=>nt(n,Q)),xe=(t,e)=>{const n=[...e.children].filter(o=>nt(o,Q)&&!o.isEqualNode(t)).toReversed(),s=[...e.children].findLastIndex(o=>o.isEqualNode(t));return[n,s,e]},we=t=>{let e=t.parentElement;for(;e;){if(window.getComputedStyle(e).position==="fixed")return e;e=e.parentElement}return null},ce=(t,e)=>{const{before:n,borderBeforeWidth:s}=w(e),o=we(t);return o?Mt(o)[n]+L(o,s):0},Xt=t=>window.TouchEvent&&t instanceof TouchEvent,ct=t=>t instanceof HTMLElement,ae=t=>t instanceof MouseEvent,Be=["onmouseup","onmousedown","onmousemove"],Re=(t,e,n)=>{t&&(t.style.height=`${e}px`,t.style.width=`${n}px`)},bt=(t,e,n)=>{!t||!ct(t)||(n==0&&e==0?t.style.transform="":t.style.transform=`translate(${n}px,${e}px)`)},Le=(t,e,n)=>{t[e]=s=>{if(s.defaultPrevented)return;const o=_t(s);n(o)}},$t=(t,e,n)=>{n&&(Oe(e)?t[e]=n:Le(t,e,n))},Oe=t=>Be.includes(t),Me=t=>{const{target:e}=t;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:e,offsetX:0,offsetY:0}},Ne=(t,e)=>{const n=(s,o)=>Fe(e,window,o,s);if(ae(t)){const{offsetX:s,offsetY:o}=t;return[s,o]}else{const s=t.target;return[n(s,V),n(s,tt)]}},_t=t=>{const e=Pe(t);if(!e)return Me(t);const[n,s]=Ne(t,e),{clientX:o,clientY:r,pageX:c,pageY:l,screenX:f,screenY:p,target:S}=e;return{clientX:o,clientY:r,pageX:c,pageY:l,screenX:f,screenY:p,target:S,offsetX:n,offsetY:s}},Pe=t=>{if(Xt(t))return t.touches[0]??t.changedTouches[0];if(ae(t))return t},Fe=(t,e,n,s)=>{const{page:o,scroll:r,before:c,borderBeforeWidth:l,getRect:f}=w(n),p=f(s);return t[o]-e[r]-p[c]-L(s,l)},Pt=(t,e,n="ease-out",s="transform")=>{ct(t)&&(t.style.transitionDuration=`${e}ms`,t.style.transitionTimingFunction=`${n}`,t.style.transitionProperty=`${s}`)},le=(t,e,n)=>{!t||!ct(t)||(t[e]=()=>{n()})},$e=t=>{var e=t.querySelector("style");if(!e){var n=document.createElement("style");return t.appendChild(n),n}return e},Ge=(t,e)=>{const n=/\.-?[_a-zA-Z0-9-*\s<>():]+/g,[s]=e.match(n)||[];for(const o of t.cssRules){const[r]=o.cssText.match(n)||[];if(s===r)return!0}return!1},Ie=(t,e)=>{e.forEach(n=>{Ye(t,n)})},Ye=(t,e)=>{var s;var n=$e(t);n.sheet&&(Ge(n.sheet,e)||(s=n.sheet)==null||s.insertRule(e,n.sheet.cssRules.length))},ue=(t,e={})=>{for(const n of Object.keys(e)){const s=e[n];s!=null&&We(t,`--${n}`,s)}},We=(t,e,n)=>t&&t.style.setProperty(e,n),fe="startDrag",Nt="drag",zt="startDrop",Xe="drop",lt="temp-child",de="cubic-bezier(0.2, 0, 0, 1)",_e=t=>t===Xe||t===zt,Vt=t=>!t||t.length==0?0:qt(t.replace("px","")),Ve=(t,e)=>{const n=getComputedStyle(t)[e];if(n.match("%")){const o=qt(n.replace("%","")),{width:r}=t.getBoundingClientRect();return r*(o/100)}return Vt(n)},jt=(t,e)=>{if(!(t instanceof Element))return[0,!1];const n=Ve(t,e),s=getComputedStyle(t).display,o=n>0||s==="flex";return[n,o]},He=t=>{const{top:e,left:n}=getComputedStyle(t);return[Vt(e),Vt(n)]},qe=(t,e)=>{const{gap:n}=w(e),[s,o]=jt(t,n);return o?s:0};function yt(t,e,n,s,o=t.previousElementSibling,r=t.nextElementSibling){let{height:c,width:l}=ze(n,t,o,r);return ht(t,s)&&e==Nt&&(c=0,l=0),{height:c,width:l}}const ze=(t,e,n,s)=>{const{afterMargin:o,beforeMargin:r,distance:c,gap:l,getRect:f}=w(t),p=L(e,o),S=L(e,r),v=L(s,r),[B,O]=jt(e.parentElement,l),P=f(e)[c];if(O)return Qt(P,S,p,B,0,t);const[h,m,C]=je(n,v,p,S,o);return Qt(P,m,h,0,C,t)},je=(t,e,n,s,o)=>{const r=Math.max(e,n);let c=s,l=e;if(t){const f=L(t,o);c=Math.max(f,s),l=Math.max(l,f)}return[r,c,l]},Qt=(t,e,n,s,o,r)=>ke(r,t+e+n+s-o),ke=(t,e)=>t==V?{width:e,height:0}:{width:0,height:e},Ut=(t,e)=>{const{borderBeforeWidth:n,paddingBefore:s,axis:o,getRect:r}=w(t),c=L(e,n),l=L(e,s),f=r(e)[o];return c+l+f},Ze=(t,e)=>{const[n,s]=He(e),o=Ut(tt,t);return[Ut(V,t)-s,o-n]};function Je(t,e,n,s,o,r,c,l,f){let p=0,S=0;const v=!!(n<0&&f);if(n===s&&!v)return te({height:p,width:S},t,o,c,v);const[B,O,P,h]=Ue(e,n,s,f);if(v){const[et,ot]=Ze(l,f);p+=ot,S+=et}const{scrollElement:m,beforeMargin:C,afterMargin:R,distance:I,gap:Y}=w(t),[W,F]=jt(l,Y),[st,H,N]=en(C,R,B,O==null?void 0:O.previousElementSibling,h,F,v),[k,q,z]=tn(C,R,I,P,W,F),X=Qe(q,k,z,H,st,W),j=v?l[m]:Ke(m,l,r),$=(h?X-N:N-X)-j;return t===tt?p+=$:t===V&&(S+=$),te({height:p,width:S},t,o,c,v)}const Ke=(t,e,n)=>{const s=e[t],o=n[t];return s-o},Qe=(t,e,n,s,o,r)=>{const c=Math.max(e,o);return Math.max(n,s)+t+c+r},Ue=(t,e,n,s)=>{const o=e<n,[r,c]=[e,n].toSorted((S,v)=>S-v),l=t[e]??s,f=t[n];let p=o?t.slice(r+1,c+1):t.slice(r,c);return r<0&&s&&(p=t.slice(r+1,c)),[l,f,p,o]},tn=(t,e,n,s,o,r)=>{if(s.length==0)return[0,0,0];const c=L(s[0],t);let l=0,f=-c;for(const[p,S]of s.entries()){const v=S.getBoundingClientRect()[n],B=L(S,t);r&&(l+=B),r&&p>0?l+=o:l=Math.max(l,B),f+=l+v,l=L(S,e)}return[c,f,l]},te=(t,e,n,s,o)=>{const{scroll:r,distance:c}=w(e),l=window[r],f=n[r],p=o?0:f-2*l+s[r];return t[c]+=p,t},en=(t,e,n,s,o,r,c)=>{const l=o?n.previousElementSibling:s;return nn(t,e,l,n,r,c)},nn=(t,e,n,s,o,r)=>{if(o)return[0,0,0];const c=L(r?null:n,e),l=L(s,t);let f=Math.max(c,l);return[c,l,f]},kt=(t,e,n,s=()=>!0)=>{const o=new MutationObserver(r=>{if(r=r.filter(s),r.length>0){const c=r[0];t(o,c)}});return o.observe(e,n),o},sn=(t,e,n)=>{n!=0&&(e==="vertical"?t.scrollBy(0,n):t.scrollBy(n,0))},on=(t,e,n)=>{const{scrollDistance:s,clientDistance:o,scrollElement:r}=w(t);return n[r]/(e[s]-e[o])},rn="startDrag",ge="cubic-bezier(0.2, 0, 0, 1)",pe=50,ee=t=>ct(t)?t.classList.contains(lt):!1,cn=(t,e,n)=>{let s=yt(e,rn,n,t);const o=qe(t,n),{distance:r}=w(n);s[r]-=o;const[c,l]=an(n,e);return s[l]=c,s},an=(t,e)=>{const n=t==V?tt:V,{distance:s,getRect:o}=w(n);return[o(e)[s],s]},mt=(t,e,n)=>{Re(t,e,n),t.style.minWidth=`${n}px`},ln=(t,e,n)=>s=>{e.contains(t)&&(mt(t,n.height,n.width),s.disconnect())},un=(t,e)=>{if(!e)return;const{droppable:n,config:s,scroll:o}=t,{direction:r}=s,c=on(s.direction,n,o)>.99,{scrollDistance:l,clientDistance:f,scrollElement:p}=w(r);c&&(n[p]=n[l]-n[f])},he=(t,e,n,s)=>{if(!n)return;const{droppable:o,config:r}=n,{direction:c,animationDuration:l}=r;if(un(n,e),o.querySelector(`.${lt}`)||!t)return;var f=t.tagName=="LI"?"DIV":t.tagName,p=document.createElement(f);U(p,lt),mt(p,0,0);const S=cn(o,t,c);return Pt(p,l,ge,"width, min-width, height"),[p,S,o]},Gt=(t,e,n,s,o)=>{const r=he(t,n,s);if(!r)return;const[c,l,f]=r;e.isSameNode(f)&&mt(c,l.height,l.width),kt(ln(c,f,l),f,{childList:!0,subtree:!0}),f.appendChild(c)},fn=(t,e,n)=>{const s=he(t,e,n);if(!s)return;const[o,r,c]=s;c.appendChild(o),dn(o,r)},dn=(t,e)=>requestAnimationFrame(()=>{mt(t,e.height,e.width),requestAnimationFrame(()=>{Pt(t,0,ge,"width, min-width, height")})}),gn=(t,e,n,s,o=!0)=>{if(n){var r=document.querySelectorAll(`${pt(n)} > .${lt}`);r.forEach(c=>{const l=c.parentElement;if(l!=null&&l.isSameNode(e)||!o&&(l!=null&&l.isSameNode(t)))return;mt(c,0,0),setTimeout(()=>{var p;(p=c.parentNode)==null||p.removeChild(c)},s+pe)})}},Tt=(t,e,n=!1)=>{var s=t.querySelectorAll(`.${lt}`);s.forEach(o=>{const r=o;n?(mt(r,0,0),setTimeout(()=>{t.contains(r)&&t.removeChild(r)},e+pe)):t.removeChild(o)})},pn=50;function hn(t,e,n,s,o,r){let c=e;const{direction:l,handlerSelector:f,onRemoveAtEvent:p,animationDuration:S,delayBeforeInsert:v,draggingClass:B}=t,O=(i,u,d,D,E)=>{if(!D)return;const{droppable:T,config:b}=D,A=yt(i,u,b.direction,T);_e(u)?F(i,u,A,d,D,E):C(i,u,A,D)},P=(i,u,d,D,E)=>{const T=yt(u,"insert",t.direction,d),{onInsertEvent:b}=t,A=ie(d);for(const[M,x]of A.entries())nt(x,Q)&&M>=i&&W(x,T);E(),setTimeout(()=>{b(i,D),Tt(n,0,!0),me(i,d,t),et(u),_(u,n)},v)},h=(i,u,d,D)=>{if(!d||!d.droppable||!d.config)return;const{droppable:E,config:T}=d;let[b]=Rt(u,E);b=[u,...b].toReversed();const A=yt(u,"remove",T.direction,E);for(const[M,x]of b.entries())M>=i&&(Y(x,A),setTimeout(()=>{D(x)},S))},m=i=>{Tt(n,S,!0),setTimeout(()=>{et(i),_(i,n)},S)},C=(i,u,d,D)=>{const{config:E,droppable:T}=D,[b]=Rt(i,T),A=ht(i,T);b.length==0&&I(d,1,E.direction,b);for(const[M,x]of b.entries()){if(!nt(x,Q))continue;const G=R(E.direction,i,x,d);if(!A&&G)d=G;else if(!A)continue;const Z=b.length-M;I(d,Z,E.direction,b),u===fe?Y(x,d):u===Nt&&W(x,d)}},R=(i,u,d,D)=>{const{before:E,distance:T,axis:b,getRect:A}=w(i),M=A(u),x=A(d),G=M[E],Z=x[E],ft=x[T],St=Z+ft/2,Dt=Ce(d)[b],at=St-Dt;return G>at?{height:0,width:0}:D},I=(i,u,d,D)=>{const E=D.filter(b=>nt(b,Q)).length,{distance:T}=w(d);i[T]==0?c=Math.max(c,u):c=Math.min(c,u-1),c=Math.min(c,E)},Y=(i,u)=>{const{width:d,height:D}=u;bt(i,D,d)},W=(i,u)=>{const{width:d,height:D}=u;bt(i,D,d),Pt(i,S,de)},F=(i,u,d,D,E,T)=>{const{droppable:b,scroll:A,config:M}=E,[x,G]=Rt(i,b),Z=x.toReversed(),ft=G===-1?Z.length:G;Z.splice(ft,0,i);const[St,Dt,at]=st(i,G,Z,b);d=yt(i,u,M.direction,n,St,Dt);const Ft=ye(),At=Je(M.direction,Z,G,at,Ft,A,D,b,i);x.length==0&&H(void 0,d,i,At);for(const[xt,wt]of x.toReversed().entries()){let Bt=d;at-1>=xt&&(Bt={height:0,width:0}),u===zt&&!nt(wt,lt)&&H(wt,Bt,i,At)}N(at,i,M,b,T)},st=(i,u,d,D)=>{const T=ht(i,D)?u:c,b=()=>u<T?[T,T+1]:u>T?[T-1,T]:[T-1,T+1],[A,M]=b(),x=d[A]??null,G=d[M]??null;return[x,G,T]},H=(i,u,d,D)=>{bt(i,u.height,u.width),bt(d,D.height,D.width)},N=(i,u,d,D,E)=>{const{onInsertEvent:T,onDragEnd:b}=d;U(u,Wt),z(u,n,D,()=>{if(Et(u,Wt),E!=null){const A=p(E);A!=null&&(T(i,A),b({value:A,index:i})),q(u),k()}})},k=()=>{if(s){var i=document.querySelectorAll(`${pt(s)} > .${Q}`);for(const u of i)$(u)}},q=i=>{setTimeout(()=>{Et(i,B)},pn)},z=(i,u,d,D)=>{setTimeout(()=>{D&&D(),X(u,d),j(d),et(i),_(i,u),_(i,d)},S)},X=(i,u)=>{i.isSameNode(u)?Tt(i,S):(Tt(i,S,!0),Tt(u,S))},j=i=>{if(n.isSameNode(i))return;var[u]=n.querySelectorAll(`.${lt}`);if(!u)return;const{distance:d}=w(l);ct(u)&&(u.style[d]="0px")},_=(i,u)=>{const[d]=Rt(i,u);for(const D of[...d,i])$(D)},$=i=>{ct(i)&&(i.style.transition="",i.style.transform="")},et=i=>{r(),ut(i,!1),i.style.transform="",i.style.transition="",i.style.top="",i.style.left="",ue(i,{fixedHeight:"",fixedWidth:""})},ot=(i,u)=>{const d=u.querySelector(f);gt(document.body,se,i),gt(d||u,Yt,i)},ut=(i,u)=>{gt(i,Ht,u),ot(u,i),o.toggleGrabClass(!u)};return[O,h,P,m,ut]}const me=(t,e,n)=>{const{insertingFromClass:s,animationDuration:o}=n,r=kt(()=>{const l=ie(e)[t];U(l,s),U(l,Zt),setTimeout(()=>{Et(l,Zt),Et(l,s),r.disconnect()},o)},e,{childList:!0})},mn=(t,e,n,s)=>{if(!e)return;const{onInsertEvent:o,delayBeforeInsert:r}=t;setTimeout(()=>{o(n,s),me(n,e,t)},r)},Sn=(t,e)=>{const n=c=>t.removeAtEvent(c),s=(c,l)=>t.insertEvent(c,l),o=()=>t.getLength(),r=c=>t.getValue(c);return{direction:(e==null?void 0:e.direction)??tt,handlerSelector:(e==null?void 0:e.handlerSelector)??Q,draggingClass:(e==null?void 0:e.draggingClass)??"dragging",droppableClass:(e==null?void 0:e.droppableClass)??"droppable-hover",isDraggable:(e==null?void 0:e.isDraggable)??(()=>!0),onDragStart:(e==null?void 0:e.onDragStart)??(()=>{}),onDragEnd:(e==null?void 0:e.onDragEnd)??(()=>{}),droppableGroup:e==null?void 0:e.droppableGroup,onRemoveAtEvent:n,onInsertEvent:s,onGetLegth:o,onGetValue:r,animationDuration:(e==null?void 0:e.animationDuration)??200,removingClass:(e==null?void 0:e.removingClass)??"removing",insertingFromClass:(e==null?void 0:e.insertingFromClass)??"from-inserting",delayBeforeRemove:(e==null?void 0:e.delayBeforeRemove)??200,delayBeforeInsert:(e==null?void 0:e.delayBeforeInsert)??200}},Dn=t=>{let e={offsetX:0,offsetY:0},n={top:0,left:0},s={x:0,y:0};const o=f=>{t.style.transform=`translate( ${f.x}px, ${f.y}px)`},r=f=>{t.style.top=`${f.top}px`,t.style.left=`${f.left}px`};return[(f,p,S,v)=>{const B=h=>{const{beforeMargin:m,borderBeforeWidth:C,before:R,offset:I,scroll:Y,page:W,inner:F,distance:st,axis:H,getRect:N}=w(h),k=S[W],q=window[Y],z=window[F],X=N(f)[st],j=L(f,C),_=L(f,m),$=k-e[I],et=ce(f,h);if($>=q-X/2&&$<=q+z){const ut=$-n[R]-j-_-q-et;return O(h),ut}return s[H]},O=h=>{if(f&&nt(f,Ht)&&h===v){const{before:m,distance:C,axis:R,getRect:I}=w(v),Y=I(f)[C],W=I(p),F=n[m]-W[m]+s[R],H=W[C]-Y,N=F/H,k=Y/H,q=.1,z=.2,X=.8;let j=0;const _=ht(f,p);!_&&N<z&&N>-k?j=N/z-1:!_&&N>X&&N<1+k&&(j=1/(1-X)*(N-X));const $=q*Y*j;sn(p,v,$)}},P=h=>{const{axis:m}=w(h);s[m]=B(h),o(s)};P(V),P(tt)},(f,p)=>{const[S,v,B,O]=bn(f,p,t);n={top:S,left:v},r(n),e={offsetX:B,offsetY:O}}]},Lt=(t,e,n)=>{const{borderBeforeWidth:s,before:o,getRect:r}=w(t);return r(e)[o]-r(n)[o]-L(n,s)},vn=(t,e)=>{let{offsetX:n,offsetY:s,target:o}=t,r=Tn(o,e);const c=o;return c&&r&&!c.isSameNode(r)&&(n+=Lt(V,c,r),s+=Lt(tt,c,r)),r&&e!=o&&(n+=Lt(V,r,e),s+=Lt(tt,r,e)),[n,s]},Tn=(t,e)=>{const n=t==null?void 0:t.closest(`.${Ot}`);return n&&n.isSameNode(e)?t:n},ne=(t,e,n,s)=>{const{offset:o,beforeMargin:r,page:c,borderBeforeWidth:l,scroll:f}=w(t),p=ce(n,t);return e[c]-s[o]-L(n,r)-L(n,l)-window[f]-p},bn=(t,e,n)=>{const[s,o]=vn(t,n);return[ne(tt,t,e,{offsetX:s,offsetY:o}),ne(V,t,e,{offsetX:s,offsetY:o}),s,o]},K=class K{static addConfig(e,n){const s=K.configs.filter(r=>!r.droppable.isSameNode(e)),o=Kt(e);s.push({droppable:e,config:n,scroll:o}),K.configs=s}static updateScrolls(e,n){for(const s of K.configs){const{droppable:o}=s;(n&&Te(o,n)||o.isSameNode(e))&&(s.scroll=Kt(o))}}static getConfig(e){return K.configs.find(({droppable:s})=>s.isSameNode(e))}};J(K,"configs",[]),J(K,"removeObsoleteConfigs",()=>{const e=K.configs.filter(({droppable:n})=>document.contains(n));K.configs=e});let it=K;class yn{constructor(e,n,s,o,r){J(this,"initial");J(this,"current");J(this,"parent");J(this,"draggableElement");J(this,"groupClass");J(this,"dragEvent");J(this,"changeDroppable");this.parent=s,this.draggableElement=e,this.groupClass=n,this.dragEvent=o,this.initial=s?it.getConfig(s):void 0,this.changeDroppable=r}getDraggableAncestor(e,n,s){return document.elementsFromPoint(e,n).filter(o=>!o.isSameNode(s))}getElementBelow(e,n,s=!0){const o=c=>{const[l]=c.getDraggableAncestor(n.clientX,n.clientY,e);return l};let r=null;return s?(e.hidden=!0,r=o(this),e.hidden=!1):r=o(this),r}getCurrent(e,n,s=!0){const o=this.getElementBelow(e,n,s);return!this.groupClass||!o?void 0:o.closest(pt(this.groupClass))}isOutsideOfAllDroppables(e){return(this.groupClass?Array.from(document.querySelectorAll(pt(this.groupClass))):[this.parent]).every(s=>ht(e,s))}isNotInsideAnotherDroppable(e,n){return!ht(e,n)||this.isOutsideOfAllDroppables(e)}onScrollEvent(){this.dragEvent()}setOnScroll(e){le(e,"onscroll",()=>{this.onScrollEvent()})}getCurrentConfig(e){var o;const n=this.draggableElement;if(this.current&&this.isNotInsideAnotherDroppable(n,(o=this.current)==null?void 0:o.droppable))return this.current;const s=this.getCurrent(n,e);return s?(ct(s)&&!s.onscroll&&this.setOnScroll(s),it.getConfig(s)):it.getConfig(this.parent)}updateConfig(e){const n=this.current;this.current=this.getCurrentConfig(e),this.changeDroppable(this.current,n)}isOutside(e,n=!0){const s=this.draggableElement;return!this.getCurrent(s,e,n)}}function En(t,e,n,s,o){const{handlerSelector:r,isDraggable:c,droppableGroup:l,animationDuration:f,delayBeforeRemove:p,draggingClass:S,removingClass:v,onRemoveAtEvent:B,droppableClass:O,onDragStart:P}=n,h=Ct(l).map(a=>`droppable-group-${a}`).join(" ");let m=0,C={scrollX:0,scrollY:0},R={pageX:0,pageY:0},I;const[Y,W]=Dn(t),[F,st,H,N,k]=hn(n,e,s,h,o,()=>m=0),q=()=>{U(t,Q)},z=a=>{U(a,Ot),o.addSubscriber(a)},X=()=>{if(c(t)){const a=t.querySelector(r);z(a||t)}},j=()=>{Ie(document.body,[`.${Q}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Ot}{pointer-events:auto!important;}`,`.${oe}{cursor:grab;}`,".temp-child{touch-action:none;pointer-events:none;box-sizing:border-box!important;}",".droppable{box-sizing:border-box!important;}",`.${Ht}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,`.${Yt}{pointer-events:none!important;}`,`.${Wt}{pointer-events:none!important;}`,`.${se}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"]),X(),q()},_=a=>{const g=a==null?void 0:a.querySelector(`.${Ot}`),y=g==null?void 0:g.parentElement;return g&&y&&nt(y,It)&&!y.isSameNode(s)?null:g},$=a=>{const g=_(a)??a;g&&c(a)&&($t(g,"onmousedown",M("mousemove","mouseup")),$t(g,"ontouchstart",M("touchmove","touchend")),et(g)),a!=null&&a.isSameNode(g)||$t(a,"onmousedown",x),U(s,It)},et=a=>{const g=a.querySelectorAll("img");Array.from(g).forEach(y=>{y.onmousedown=()=>!1})},ot=()=>{if(R.pageX==0&&R.pageY==0||!i.current)return;const{droppable:a,config:g}=i.current;Y(t,a,R,g.direction),F(t,Nt,C,i.current)},ut=(a,g)=>{g&&m==2&&!(a!=null&&a.droppable.isSameNode(g.droppable))&&F(t,Nt,C,g)},i=new yn(t,h,s,ot,ut),u=a=>{if(!i.current)return;const g=h?Array.from(document.querySelectorAll(pt(h))):[s];for(const y of g)y.classList.toggle(O,!a&&y.isSameNode(i.current.droppable))},d=a=>{i.updateConfig(a);const g=i.isOutside(a);u(g),m===1?ft(a):m===2&&(D(g),Dt(a))},D=(a=!0)=>{if(!i.current)return;const{droppable:g}=i.current;gn(g,s,h,f,a),!a&&Gt(t,s,m==1,i.current)},E=a=>{if(Xt(a)&&a.cancelable)a.preventDefault();else if(Xt(a))return;const g=_t(a);d(g)},T=(a,g)=>{a=="touchmove"?I=setTimeout(()=>{g()},200):g()},b=(a,g)=>{const{clientX:y,clientY:dt}=a,rt=document.elementFromPoint(y,dt),vt=rt==null?void 0:rt.closest(`.${Q}`);return rt&&g&&vt&&!g.isSameNode(vt)},A=a=>{const g=n.onGetValue(e);return{index:e,element:a,value:g}},M=(a,g)=>y=>{if(b(y,t))return;it.updateScrolls(s,h);const{scrollX:dt,scrollY:rt}=window;if(C={scrollX:dt,scrollY:rt},m===0){m=1;const vt=A(t);vt&&P(vt),T(a,()=>{a=="touchmove"&&(i.updateConfig(y),u(i.isOutside(y)),ft(y)),document.addEventListener(a,E,{passive:!1})}),at(s),document.addEventListener(g,G(a),{once:!0})}},x=a=>i.updateConfig(a),G=a=>g=>{u(!0);const y=_t(g);clearTimeout(I),At(i.isOutside(y,!1)),document.removeEventListener(a,E),i.updateConfig(y);const dt=i.getCurrentConfig(y);if(dt){const{droppable:rt}=dt;Z(rt)}s.onscroll=null},Z=a=>{if(a.onscroll=null,!h)return;const g=Array.from(document.querySelectorAll(pt(h)));for(const y of g)ct(y)&&(y.onscroll=null)},ft=a=>{Gt(t,s,m==1,i.current),St(),F(t,fe,C,i.current),wt(t),W(a,t)},St=()=>{m=2},Dt=a=>{const{pageX:g,pageY:y}=a;R={pageX:g,pageY:y},ot()},at=a=>le(a,"onscroll",Ft),Ft=()=>ot(),At=a=>{if(m!==2){m=0;return}m=3,xt(t),F(t,zt,C,a?i.initial:i.current,e)},xt=a=>{Pt(a,f,de),bt(a,0,0)},wt=a=>{const{height:g,width:y}=a.getBoundingClientRect();ue(a,{fixedHeight:`${g}px`,fixedWidth:`${y}px`}),k(a,!0),gt(a,S,!0),a.style.transition=""},Bt=a=>{if(!i.initial)return;const g=i.initial;a==e&&(U(t,v),setTimeout(()=>{B(e),Et(t,v),Gt(t,s,m==1,i.initial),st(a,t,g,y=>{xt(y),N(t)})},p))},Se=(a,g)=>{(a===e||a===n.onGetLegth()&&e===a-1)&&H(a,t,s,g,()=>{fn(t,m==1,i.initial)})};return j(),$(t),[Bt,Se]}const Cn=(t,e)=>{t&&be(e,t)};function An(t,e,n,s="index"){const o=s;let r=[],c=[];const{droppableGroup:l}=t;if(!n)return[r,c];const f=Ct(l).map(p=>`droppable-group-${p}`).join(" ");Cn(f,n);for(const p of n.children){const S=p.getAttribute(o),v=Ee(S),B=p;if(B&&v>=0){const[O,P]=En(B,v,t,n,e);r.push(O),c.push(P)}}return[r,c]}function xn(t,e,n,s="index"){let o=[],r=[];const c=Sn(t,n),l=h=>{for(const m of o)m(h)},f=(h,m)=>{if(c.onGetLegth()===0)t.insertToListEmpty(c,h,m);else for(const R of r)R(h,m)},p=h=>{const[m,C]=An(c,e,h,s);o=m,r=C},S=h=>{const m=h.addedNodes.values().filter(R=>!ee(R)).toArray(),C=h.removedNodes.values().filter(R=>!ee(R)).toArray();return m.length>0||C.length>0},v=h=>{kt(()=>{p(h)},h,{childList:!0},S)},B=h=>{U(h,It)},O=h=>{it.addConfig(h,c)};return[l,f,h=>{h&&(B(h),O(h),v(h),p(h),it.removeObsoleteConfigs())}]}exports.GRAB_CLASS=oe;exports.addClass=U;exports.dragAndDrop=xn;exports.insertToListEmpty=mn;exports.toggleClass=gt;
|