fluid-dnd 1.0.7-beta.0 → 1.0.8-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-Bp-hKsuU.js} +1 -1
- package/dist/{HandlerPublisher-D-RJfytA.cjs → HandlerPublisher-DiASUxtT.cjs} +1 -1
- package/dist/index/index.cjs +1 -1
- package/dist/index/index.mjs +1 -1
- package/dist/index-TH8hx6fO.cjs +1 -0
- package/dist/{index-B0MByO4j.js → index-WuPwAM50.js} +207 -209
- 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-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-WuPwAM50.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-TH8hx6fO.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;
|
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-TH8hx6fO.cjs");exports.dragAndDrop=e.dragAndDrop;
|
package/dist/index/index.mjs
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";var me=Object.defineProperty;var Se=(t,e,n)=>e in t?me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var J=(t,e,n)=>Se(t,typeof e!="symbol"?e+"":e,n);const Q="draggable",It="droppable",Ot="handler-class",Ht="dragging",Wt="dragging-handler-class",Xt="dropping",ne="grabbing",se="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)},Ct=(t,e)=>{t.classList.remove(e)},De=(t,e)=>Et(e).every(n=>nt(t,n)),dt=t=>t?`.${Et(t).join(".")}`:"",ve=(t,e)=>{if(!e)return;const n=Et(e);t.classList.add(...n)},Et=t=>t?t.split(" ").filter(e=>e):[],_="horizontal",tt="vertical",be=()=>{const{scrollX:t,scrollY:e}=window;return{scrollX:t,scrollY:e}},qt=t=>!t||t.trim().length==0||t=="normal"?0:parseFloat(t),Te=t=>t?parseInt(t):-1,ye=t=>{const e=getComputedStyle(t),n=new DOMMatrixReadOnly(e.transform);return{x:n.m41,y:n.m42}},oe=(t,e)=>t.x1>e.x1?oe(e,t):t.x2<e.x1?0:t.x2>=e.x2?t.x2-t.x1:t.x2-e.x1,pt=(t,e)=>!Ce(t,e),Ce=(t,e)=>{const n=Mt(t),s=Mt(e),o=Jt(n,s,tt),i=Jt(n,s,_);return o>=Math.min(n.height,s.height)/2&&i>=Math.min(n.width,s.width)/2},Jt=(t,e,n)=>{const{before:s,distance:o}=w(n);return oe({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==_;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)=>Ee(t,e),re=t=>[...t.children].filter(n=>nt(n,Q)),Ee=(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]},Ae=t=>{let e=t.parentElement;for(;e;){if(window.getComputedStyle(e).position==="fixed")return e;e=e.parentElement}return null},ie=(t,e)=>{const{before:n,borderBeforeWidth:s}=w(e),o=Ae(t);return o?Mt(o)[n]+L(o,s):0},Yt=t=>window.TouchEvent&&t instanceof TouchEvent,at=t=>t instanceof HTMLElement,ce=t=>t instanceof MouseEvent,xe=["onmouseup","onmousedown","onmousemove"],we=(t,e,n)=>{t&&(t.style.height=`${e}px`,t.style.width=`${n}px`)},Tt=(t,e,n)=>{!t||!at(t)||(n==0&&e==0?t.style.transform="":t.style.transform=`translate(${n}px,${e}px)`)},Be=(t,e,n)=>{t[e]=s=>{if(s.defaultPrevented)return;const o=Vt(s);n(o)}},$t=(t,e,n)=>{n&&(Re(e)?t[e]=n:Be(t,e,n))},Re=t=>xe.includes(t),Le=t=>{const{target:e}=t;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:e,offsetX:0,offsetY:0}},Oe=(t,e)=>{const n=(s,o)=>Pe(e,window,o,s);if(ce(t)){const{offsetX:s,offsetY:o}=t;return[s,o]}else{const s=t.target;return[n(s,_),n(s,tt)]}},Vt=t=>{const e=Me(t);if(!e)return Le(t);const[n,s]=Oe(t,e),{clientX:o,clientY:i,pageX:c,pageY:l,screenX:f,screenY:p,target:h}=e;return{clientX:o,clientY:i,pageX:c,pageY:l,screenX:f,screenY:p,target:h,offsetX:n,offsetY:s}},Me=t=>{if(Yt(t))return t.touches[0]??t.changedTouches[0];if(ce(t))return t},Pe=(t,e,n,s)=>{const{page:o,scroll:i,before:c,borderBeforeWidth:l,getRect:f}=w(n),p=f(s);return t[o]-e[i]-p[c]-L(s,l)},Nt=(t,e,n="ease-out",s="transform")=>{at(t)&&(t.style.transitionDuration=`${e}ms`,t.style.transitionTimingFunction=`${n}`,t.style.transitionProperty=`${s}`)},ae=(t,e,n)=>{!t||!at(t)||(t[e]=()=>{n()})},Ne=t=>{var e=t.querySelector("style");if(!e){var n=document.createElement("style");return t.appendChild(n),n}return e},Fe=(t,e)=>{const n=/\.-?[_a-zA-Z0-9-*\s<>():]+/g,[s]=e.match(n)||[];for(const o of t.cssRules){const[i]=o.cssText.match(n)||[];if(s===i)return!0}return!1},$e=(t,e)=>{e.forEach(n=>{Ge(t,n)})},Ge=(t,e)=>{var s;var n=Ne(t);n.sheet&&(Fe(n.sheet,e)||(s=n.sheet)==null||s.insertRule(e,n.sheet.cssRules.length))},le=(t,e={})=>{for(const n of Object.keys(e)){const s=e[n];s!=null&&Ie(t,`--${n}`,s)}},Ie=(t,e,n)=>t&&t.style.setProperty(e,n),ue="startDrag",Pt="drag",zt="startDrop",We="drop",ht="temp-child",fe="cubic-bezier(0.2, 0, 0, 1)",Xe=t=>t===We||t===zt,_t=t=>!t||t.length==0?0:qt(t.replace("px","")),Ye=(t,e)=>{const n=getComputedStyle(t)[e];if(n.match("%")){const o=qt(n.replace("%","")),{width:i}=t.getBoundingClientRect();return i*(o/100)}return _t(n)},jt=(t,e)=>{if(!(t instanceof Element))return[0,!1];const n=Ye(t,e),s=getComputedStyle(t).display,o=n>0||s==="flex";return[n,o]},Ve=t=>{const{top:e,left:n}=getComputedStyle(t);return[_t(e),_t(n)]},_e=(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,i=t.nextElementSibling){let{height:c,width:l}=He(n,t,o,i);return pt(t,s)&&e==Pt&&(c=0,l=0),{height:c,width:l}}const He=(t,e,n,s)=>{const{afterMargin:o,beforeMargin:i,distance:c,gap:l,getRect:f}=w(t),p=L(e,o),h=L(e,i),b=L(s,i),[B,M]=jt(e.parentElement,l),S=f(e)[c];if(M)return Qt(S,h,p,B,0,t);const[D,v,R]=qe(n,b,p,h,o);return Qt(S,v,D,0,R,t)},qe=(t,e,n,s,o)=>{const i=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[i,c,l]},Qt=(t,e,n,s,o,i)=>ze(i,t+e+n+s-o),ze=(t,e)=>t==_?{width:e,height:0}:{width:0,height:e},Ut=(t,e)=>{const{borderBeforeWidth:n,paddingBefore:s,axis:o,getRect:i}=w(t),c=L(e,n),l=L(e,s),f=i(e)[o];return c+l+f},je=(t,e)=>{const[n,s]=Ve(e),o=Ut(tt,t);return[Ut(_,t)-s,o-n]};function ke(t,e,n,s,o,i,c,l,f){let p=0,h=0;const b=!!(n<0&&f);if(n===s&&!b)return te({height:p,width:h},t,o,c,b);const[B,M,S,D]=Ke(e,n,s,f);if(b){const[et,ot]=je(l,f);p+=ot,h+=et}const{scrollElement:v,beforeMargin:R,afterMargin:N,distance:I,gap:W}=w(t),[X,F]=jt(l,W),[st,H,P]=Ue(R,N,B,M==null?void 0:M.previousElementSibling,D,F,b),[k,q,z]=Qe(R,N,I,S,X,F),Y=Je(q,k,z,H,st,X),j=b?l[v]:Ze(v,l,i),$=(D?Y-P:P-Y)-j;return t===tt?p+=$:t===_&&(h+=$),te({height:p,width:h},t,o,c,b)}const Ze=(t,e,n)=>{const s=e[t],o=n[t];return s-o},Je=(t,e,n,s,o,i)=>{const c=Math.max(e,o);return Math.max(n,s)+t+c+i},Ke=(t,e,n,s)=>{const o=e<n,[i,c]=[e,n].toSorted((h,b)=>h-b),l=t[e]??s,f=t[n];let p=o?t.slice(i+1,c+1):t.slice(i,c);return i<0&&s&&(p=t.slice(i+1,c)),[l,f,p,o]},Qe=(t,e,n,s,o,i)=>{if(s.length==0)return[0,0,0];const c=L(s[0],t);let l=0,f=-c;for(const[p,h]of s.entries()){const b=h.getBoundingClientRect()[n],B=L(h,t);i&&(l+=B),i&&p>0?l+=o:l=Math.max(l,B),f+=l+b,l=L(h,e)}return[c,f,l]},te=(t,e,n,s,o)=>{const{scroll:i,distance:c}=w(e),l=window[i],f=n[i],p=o?0:f-2*l+s[i];return t[c]+=p,t},Ue=(t,e,n,s,o,i,c)=>{const l=o?n.previousElementSibling:s;return tn(t,e,l,n,i,c)},tn=(t,e,n,s,o,i)=>{if(o)return[0,0,0];const c=L(i?null:n,e),l=L(s,t);let f=Math.max(c,l);return[c,l,f]},kt=(t,e,n)=>{const s=new MutationObserver(o=>{if(o.length>0){const i=o[0];t(s,i)}});return s.observe(e,n),s},en=(t,e,n)=>{n!=0&&(e==="vertical"?t.scrollBy(0,n):t.scrollBy(n,0))},nn=(t,e,n)=>{const{scrollDistance:s,clientDistance:o,scrollElement:i}=w(t);return n[i]/(e[s]-e[o])},sn="startDrag",ge="cubic-bezier(0.2, 0, 0, 1)",on=(t,e,n)=>{let s=yt(e,sn,n,t);const o=_e(t,n),{distance:i}=w(n);s[i]-=o;const[c,l]=rn(n,e);return s[l]=c,s},rn=(t,e)=>{const n=t==_?tt:_,{distance:s,getRect:o}=w(n);return[o(e)[s],s]},mt=(t,e,n)=>{we(t,e,n),t.style.minWidth=`${n}px`},cn=(t,e,n)=>s=>{e.contains(t)&&(mt(t,n.height,n.width),s.disconnect())},an=(t,e)=>{if(!e)return;const{droppable:n,config:s,scroll:o}=t,{direction:i}=s,c=nn(s.direction,n,o)>.99,{scrollDistance:l,clientDistance:f,scrollElement:p}=w(i);c&&(n[p]=n[l]-n[f])},de=(t,e,n,s)=>{if(!n)return;const{droppable:o,config:i}=n,{direction:c,animationDuration:l}=i;if(an(n,e),o.querySelector(`.${ht}`)||!t)return;var f=t.tagName=="LI"?"DIV":t.tagName,p=document.createElement(f);U(p,ht),mt(p,0,0);const h=on(o,t,c);return Nt(p,l,ge,"width, min-width, height"),[p,h,o]},Gt=(t,e,n,s,o)=>{const i=de(t,n,s);if(!i)return;const[c,l,f]=i;e.isSameNode(f)&&mt(c,l.height,l.width),kt(cn(c,f,l),f,{childList:!0,subtree:!0}),f.appendChild(c)},ln=(t,e,n)=>{const s=de(t,e,n);if(!s)return;const[o,i,c]=s;c.appendChild(o),un(o,i)},un=(t,e)=>requestAnimationFrame(()=>{mt(t,e.height,e.width),requestAnimationFrame(()=>{Nt(t,0,ge,"width, min-width, height")})}),fn=(t,e,n,s,o=!0)=>{if(n){var i=document.querySelectorAll(`${dt(n)} > .${ht}`);i.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)})}},bt=(t,e,n=!1)=>{var s=t.querySelectorAll(`.${ht}`);s.forEach(o=>{n?(mt(o,0,0),setTimeout(()=>{t.contains(o)&&t.removeChild(o)},e)):t.removeChild(o)})},gn=50;function dn(t,e,n,s,o,i){let c=e;const{direction:l,handlerSelector:f,onRemoveAtEvent:p,animationDuration:h,delayBeforeInsert:b,draggingClass:B}=t,M=(r,u,g,m,E)=>{if(!m)return;const{droppable:T,config:y}=m,A=yt(r,u,y.direction,T);Xe(u)?F(r,u,A,g,m,E):R(r,u,A,m)},S=(r,u,g,m,E)=>{const T=yt(u,"insert",t.direction,g),{onInsertEvent:y}=t,A=re(g);for(const[O,x]of A.entries())nt(x,Q)&&O>=r&&X(x,T);E(),setTimeout(()=>{y(r,m),bt(n,0,!0),pe(r,g,t),et(u),V(u,n)},b)},D=(r,u,g,m)=>{if(!g||!g.droppable||!g.config)return;const{droppable:E,config:T}=g;let[y]=Rt(u,E);y=[u,...y].toReversed();const A=yt(u,"remove",T.direction,E);for(const[O,x]of y.entries())O>=r&&(W(x,A),setTimeout(()=>{m(x)},h))},v=r=>{bt(n,h,!0),setTimeout(()=>{et(r),V(r,n)},h)},R=(r,u,g,m)=>{const{config:E,droppable:T}=m,[y]=Rt(r,T),A=pt(r,T);y.length==0&&I(g,1,E.direction,y);for(const[O,x]of y.entries()){if(!nt(x,Q))continue;const G=N(E.direction,r,x,g);if(!A&&G)g=G;else if(!A)continue;const Z=y.length-O;I(g,Z,E.direction,y),u===ue?W(x,g):u===Pt&&X(x,g)}},N=(r,u,g,m)=>{const{before:E,distance:T,axis:y,getRect:A}=w(r),O=A(u),x=A(g),G=O[E],Z=x[E],ut=x[T],St=Z+ut/2,Dt=ye(g)[y],ct=St-Dt;return G>ct?{height:0,width:0}:m},I=(r,u,g,m)=>{const E=m.filter(y=>nt(y,Q)).length,{distance:T}=w(g);r[T]==0?c=Math.max(c,u):c=Math.min(c,u-1),c=Math.min(c,E)},W=(r,u)=>{const{width:g,height:m}=u;Tt(r,m,g)},X=(r,u)=>{const{width:g,height:m}=u;Tt(r,m,g),Nt(r,h,fe)},F=(r,u,g,m,E,T)=>{const{droppable:y,scroll:A,config:O}=E,[x,G]=Rt(r,y),Z=x.toReversed(),ut=G===-1?Z.length:G;Z.splice(ut,0,r);const[St,Dt,ct]=st(r,G,Z,y);g=yt(r,u,O.direction,n,St,Dt);const Ft=be(),At=ke(O.direction,Z,G,ct,Ft,A,m,y,r);x.length==0&&H(void 0,g,r,At);for(const[xt,wt]of x.toReversed().entries()){let Bt=g;ct-1>=xt&&(Bt={height:0,width:0}),u===zt&&!nt(wt,ht)&&H(wt,Bt,r,At)}P(ct,r,O,y,T)},st=(r,u,g,m)=>{const T=pt(r,m)?u:c,y=()=>u<T?[T,T+1]:u>T?[T-1,T]:[T-1,T+1],[A,O]=y(),x=g[A]??null,G=g[O]??null;return[x,G,T]},H=(r,u,g,m)=>{Tt(r,u.height,u.width),Tt(g,m.height,m.width)},P=(r,u,g,m,E)=>{const{onInsertEvent:T,onDragEnd:y}=g;U(u,Xt),z(u,n,m,()=>{if(Ct(u,Xt),E!=null){const A=p(E);A!=null&&(T(r,A),y({value:A,index:r})),q(u),k()}})},k=()=>{if(s){var r=document.querySelectorAll(`${dt(s)} > .${Q}`);for(const u of r)$(u)}},q=r=>{setTimeout(()=>{Ct(r,B)},gn)},z=(r,u,g,m)=>{setTimeout(()=>{m&&m(),Y(u,g),j(g),et(r),V(r,u),V(r,g)},h)},Y=(r,u)=>{r.isSameNode(u)?bt(r,h):(bt(r,h,!0),bt(u,h))},j=r=>{if(n.isSameNode(r))return;var[u]=n.querySelectorAll(`.${ht}`);if(!u)return;const{distance:g}=w(l);at(u)&&(u.style[g]="0px")},V=(r,u)=>{const[g]=Rt(r,u);for(const m of[...g,r])$(m)},$=r=>{at(r)&&(r.style.transition="",r.style.transform="")},et=r=>{i(),lt(r,!1),r.style.transform="",r.style.transition="",r.style.top="",r.style.left="",le(r,{fixedHeight:"",fixedWidth:""})},ot=(r,u)=>{const g=u.querySelector(f);gt(document.body,ne,r),gt(g||u,Wt,r)},lt=(r,u)=>{gt(r,Ht,u),ot(u,r),o.toggleGrabClass(!u)};return[M,D,S,v,lt]}const pe=(t,e,n)=>{const{insertingFromClass:s,animationDuration:o}=n,i=kt(()=>{const l=re(e)[t];U(l,s),U(l,Zt),setTimeout(()=>{Ct(l,Zt),Ct(l,s),i.disconnect()},o)},e,{childList:!0})},pn=(t,e,n,s)=>{if(!e)return;const{onInsertEvent:o,delayBeforeInsert:i}=t;setTimeout(()=>{o(n,s),pe(n,e,t)},i)},hn=(t,e)=>{const n=c=>t.removeAtEvent(c),s=(c,l)=>t.insertEvent(c,l),o=()=>t.getLength(),i=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:i,animationDuration:(e==null?void 0:e.animationDuration)??150,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}},mn=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)`},i=f=>{t.style.top=`${f.top}px`,t.style.left=`${f.left}px`};return[(f,p,h,b)=>{const B=D=>{const{beforeMargin:v,borderBeforeWidth:R,before:N,offset:I,scroll:W,page:X,inner:F,distance:st,axis:H,getRect:P}=w(D),k=h[X],q=window[W],z=window[F],Y=P(f)[st],j=L(f,R),V=L(f,v),$=k-e[I],et=ie(f,D);if($>=q-Y/2&&$<=q+z){const lt=$-n[N]-j-V-q-et;return M(D),lt}return s[H]},M=D=>{if(f&&nt(f,Ht)&&D===b){const{before:v,distance:R,axis:N,getRect:I}=w(b),W=I(f)[R],X=I(p),F=n[v]-X[v]+s[N],H=X[R]-W,P=F/H,k=W/H,q=.1,z=.2,Y=.8;let j=0;const V=pt(f,p);!V&&P<z&&P>-k?j=P/z-1:!V&&P>Y&&P<1+k&&(j=1/(1-Y)*(P-Y));const $=q*W*j;en(p,b,$)}},S=D=>{const{axis:v}=w(D);s[v]=B(D),o(s)};S(_),S(tt)},(f,p)=>{const[h,b,B,M]=vn(f,p,t);n={top:h,left:b},i(n),e={offsetX:B,offsetY:M}}]},Lt=(t,e,n)=>{const{borderBeforeWidth:s,before:o,getRect:i}=w(t);return i(e)[o]-i(n)[o]-L(n,s)},Sn=(t,e)=>{let{offsetX:n,offsetY:s,target:o}=t,i=Dn(o,e);const c=o;return c&&i&&!c.isSameNode(i)&&(n+=Lt(_,c,i),s+=Lt(tt,c,i)),i&&e!=o&&(n+=Lt(_,i,e),s+=Lt(tt,i,e)),[n,s]},Dn=(t,e)=>{const n=t==null?void 0:t.closest(`.${Ot}`);return n&&n.isSameNode(e)?t:n},ee=(t,e,n,s)=>{const{offset:o,beforeMargin:i,page:c,borderBeforeWidth:l,scroll:f}=w(t),p=ie(n,t);return e[c]-s[o]-L(n,i)-L(n,l)-window[f]-p},vn=(t,e,n)=>{const[s,o]=Sn(t,n);return[ee(tt,t,e,{offsetX:s,offsetY:o}),ee(_,t,e,{offsetX:s,offsetY:o}),s,o]},K=class K{static addConfig(e,n){const s=K.configs.filter(i=>!i.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&&De(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 bn{constructor(e,n,s,o,i){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=i}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 i=null;return s?(e.hidden=!0,i=o(this),e.hidden=!1):i=o(this),i}getCurrent(e,n,s=!0){const o=this.getElementBelow(e,n,s);return!this.groupClass||!o?void 0:o.closest(dt(this.groupClass))}isOutsideOfAllDroppables(e){return(this.groupClass?Array.from(document.querySelectorAll(dt(this.groupClass))):[this.parent]).every(s=>pt(e,s))}isNotInsideAnotherDroppable(e,n){return!pt(e,n)||this.isOutsideOfAllDroppables(e)}onScrollEvent(){this.dragEvent()}setOnScroll(e){ae(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?(at(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 Tn(t,e,n,s,o){const{handlerSelector:i,isDraggable:c,droppableGroup:l,animationDuration:f,delayBeforeRemove:p,draggingClass:h,removingClass:b,onRemoveAtEvent:B,droppableClass:M,onDragStart:S}=n,D=Et(l).map(a=>`droppable-group-${a}`).join(" ");let v=0,R={scrollX:0,scrollY:0},N={pageX:0,pageY:0},I;const[W,X]=mn(t),[F,st,H,P,k]=dn(n,e,s,D,o,()=>v=0),q=()=>{U(t,Q)},z=a=>{U(a,Ot),o.addSubscriber(a)},Y=()=>{if(c(t)){const a=t.querySelector(i);z(a||t)}},j=()=>{$e(document.body,[`.${Q}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Ot}{pointer-events:auto!important;}`,`.${se}{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;}`,`.${Wt}{pointer-events:none!important;}`,`.${Xt}{pointer-events:none!important;}`,`.${ne}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"]),Y(),q()},V=a=>{const d=a==null?void 0:a.querySelector(`.${Ot}`),C=d==null?void 0:d.parentElement;return d&&C&&nt(C,It)&&!C.isSameNode(s)?null:d},$=a=>{const d=V(a)??a;d&&c(a)&&($t(d,"onmousedown",O("mousemove","mouseup")),$t(d,"ontouchstart",O("touchmove","touchend")),et(d)),a!=null&&a.isSameNode(d)||$t(a,"onmousedown",x),U(s,It)},et=a=>{const d=a.querySelectorAll("img");Array.from(d).forEach(C=>{C.onmousedown=()=>!1})},ot=()=>{if(N.pageX==0&&N.pageY==0||!r.current)return;const{droppable:a,config:d}=r.current;W(t,a,N,d.direction),F(t,Pt,R,r.current)},lt=(a,d)=>{d&&v==2&&!(a!=null&&a.droppable.isSameNode(d.droppable))&&F(t,Pt,R,d)},r=new bn(t,D,s,ot,lt),u=a=>{if(!r.current)return;const d=D?Array.from(document.querySelectorAll(dt(D))):[s];for(const C of d)C.classList.toggle(M,!a&&C.isSameNode(r.current.droppable))},g=a=>{r.updateConfig(a);const d=r.isOutside(a);u(d),v===1?ut(a):v===2&&(m(d),Dt(a))},m=(a=!0)=>{if(!r.current)return;const{droppable:d}=r.current;fn(d,s,D,f,a),!a&&Gt(t,s,v==1,r.current)},E=a=>{if(Yt(a)&&a.cancelable)a.preventDefault();else if(Yt(a))return;const d=Vt(a);g(d)},T=(a,d)=>{a=="touchmove"?I=setTimeout(()=>{d()},200):d()},y=(a,d)=>{const{clientX:C,clientY:ft}=a,rt=document.elementFromPoint(C,ft),vt=rt==null?void 0:rt.closest(`.${Q}`);return rt&&d&&vt&&!d.isSameNode(vt)},A=a=>{const d=n.onGetValue(e);return{index:e,element:a,value:d}},O=(a,d)=>C=>{if(y(C,t))return;it.updateScrolls(s,D);const{scrollX:ft,scrollY:rt}=window;if(R={scrollX:ft,scrollY:rt},v===0){v=1;const vt=A(t);vt&&S(vt),T(a,()=>{a=="touchmove"&&(r.updateConfig(C),u(r.isOutside(C)),ut(C)),document.addEventListener(a,E,{passive:!1})}),ct(s),document.addEventListener(d,G(a),{once:!0})}},x=a=>r.updateConfig(a),G=a=>d=>{u(!0);const C=Vt(d);clearTimeout(I),At(r.isOutside(C,!1)),document.removeEventListener(a,E),r.updateConfig(C);const ft=r.getCurrentConfig(C);if(ft){const{droppable:rt}=ft;Z(rt)}s.onscroll=null},Z=a=>{if(a.onscroll=null,!D)return;const d=Array.from(document.querySelectorAll(dt(D)));for(const C of d)at(C)&&(C.onscroll=null)},ut=a=>{Gt(t,s,v==1,r.current),St(),F(t,ue,R,r.current),wt(t),X(a,t)},St=()=>{v=2},Dt=a=>{const{pageX:d,pageY:C}=a;N={pageX:d,pageY:C},ot()},ct=a=>ae(a,"onscroll",Ft),Ft=()=>ot(),At=a=>{if(v!==2){v=0;return}v=3,xt(t),F(t,zt,R,a?r.initial:r.current,e)},xt=a=>{Nt(a,f,fe),Tt(a,0,0)},wt=a=>{const{height:d,width:C}=a.getBoundingClientRect();le(a,{fixedHeight:`${d}px`,fixedWidth:`${C}px`}),k(a,!0),gt(a,h,!0),a.style.transition=""},Bt=a=>{if(!r.initial)return;const d=r.initial;a==e&&(U(t,b),setTimeout(()=>{B(e),Ct(t,b),Gt(t,s,v==1,r.initial),st(a,t,d,C=>{xt(C),P(t)})},p))},he=(a,d)=>{(a===e||a===n.onGetLegth()&&e===a-1)&&H(a,t,s,d,()=>{ln(t,v==1,r.initial)})};return j(),$(t),[Bt,he]}const yn=(t,e)=>{t&&ve(e,t)};function Cn(t,e,n,s="index"){const o=s;let i=[],c=[];const{droppableGroup:l}=t;if(!n)return[i,c];const f=Et(l).map(p=>`droppable-group-${p}`).join(" ");yn(f,n);for(const p of n.children){const h=p.getAttribute(o),b=Te(h),B=p;if(B&&b>=0){const[M,S]=Tn(B,b,t,n,e);i.push(M),c.push(S)}}return[i,c]}function En(t,e,n,s="index"){let o=[],i=[];const c=hn(t,n),l=S=>{for(const D of o)D(S)},f=(S,D)=>{if(c.onGetLegth()===0)t.insertToListEmpty(c,S,D);else for(const R of i)R(S,D)},p=S=>{const[D,v]=Cn(c,e,S,s);o=D,i=v},h=S=>{kt(()=>{p(S)},S,{childList:!0})},b=S=>{U(S,It)},B=S=>{it.addConfig(S,c)};return[l,f,S=>{S&&(b(S),B(S),h(S),p(S),it.removeObsoleteConfigs())}]}exports.GRAB_CLASS=se;exports.addClass=U;exports.dragAndDrop=En;exports.insertToListEmpty=pn;exports.toggleClass=gt;
|
@@ -1,20 +1,20 @@
|
|
1
1
|
var he = Object.defineProperty;
|
2
2
|
var me = (t, e, n) => e in t ? he(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
3
3
|
var J = (t, e, n) => me(t, typeof e != "symbol" ? e + "" : e, n);
|
4
|
-
const Q = "draggable", It = "droppable", Ot = "handler-class", _t = "dragging", Wt = "dragging-handler-class", Xt = "dropping", ne = "grabbing", Se = "grab", Zt = "disable-transition", et = (t, e) => t.classList.contains(e),
|
4
|
+
const Q = "draggable", It = "droppable", Ot = "handler-class", _t = "dragging", Wt = "dragging-handler-class", Xt = "dropping", ne = "grabbing", Se = "grab", Zt = "disable-transition", et = (t, e) => t.classList.contains(e), bt = (t, e, n = !1) => {
|
5
5
|
t.classList.toggle(e, n);
|
6
6
|
}, nt = (t, e) => {
|
7
7
|
t.classList.add(e);
|
8
|
-
},
|
8
|
+
}, Et = (t, e) => {
|
9
9
|
t.classList.remove(e);
|
10
|
-
}, De = (t, e) =>
|
10
|
+
}, De = (t, e) => Ct(e).every(
|
11
11
|
(n) => et(t, n)
|
12
|
-
), gt = (t) => t ? `.${
|
12
|
+
), gt = (t) => t ? `.${Ct(t).join(".")}` : "", ve = (t, e) => {
|
13
13
|
if (!e)
|
14
14
|
return;
|
15
|
-
const n =
|
15
|
+
const n = Ct(e);
|
16
16
|
t.classList.add(...n);
|
17
|
-
},
|
17
|
+
}, Ct = (t) => t ? t.split(" ").filter((e) => e) : [], H = "horizontal", U = "vertical", be = () => {
|
18
18
|
const { scrollX: t, scrollY: e } = window;
|
19
19
|
return { scrollX: t, scrollY: e };
|
20
20
|
}, qt = (t) => !t || t.trim().length == 0 || t == "normal" ? 0 : parseFloat(t), Te = (t) => t ? parseInt(t) : -1, ye = (t) => {
|
@@ -92,7 +92,7 @@ const Q = "draggable", It = "droppable", Ot = "handler-class", _t = "dragging",
|
|
92
92
|
return o ? Mt(o)[n] + L(o, s) : 0;
|
93
93
|
}, Yt = (t) => window.TouchEvent && t instanceof TouchEvent, at = (t) => t instanceof HTMLElement, ie = (t) => t instanceof MouseEvent, xe = ["onmouseup", "onmousedown", "onmousemove"], we = (t, e, n) => {
|
94
94
|
t && (t.style.height = `${e}px`, t.style.width = `${n}px`);
|
95
|
-
},
|
95
|
+
}, Tt = (t, e, n) => {
|
96
96
|
!t || !at(t) || (n == 0 && e == 0 ? t.style.transform = "" : t.style.transform = `translate(${n}px,${e}px)`);
|
97
97
|
}, Be = (t, e, n) => {
|
98
98
|
t[e] = (s) => {
|
@@ -132,14 +132,14 @@ const Q = "draggable", It = "droppable", Ot = "handler-class", _t = "dragging",
|
|
132
132
|
const e = Me(t);
|
133
133
|
if (!e)
|
134
134
|
return Le(t);
|
135
|
-
const [n, s] = Oe(t, e), { clientX: o, clientY: i, pageX: c, pageY: l, screenX: f, screenY:
|
135
|
+
const [n, s] = Oe(t, e), { clientX: o, clientY: i, pageX: c, pageY: l, screenX: f, screenY: p, target: h } = e;
|
136
136
|
return {
|
137
137
|
clientX: o,
|
138
138
|
clientY: i,
|
139
139
|
pageX: c,
|
140
140
|
pageY: l,
|
141
141
|
screenX: f,
|
142
|
-
screenY:
|
142
|
+
screenY: p,
|
143
143
|
target: h,
|
144
144
|
offsetX: n,
|
145
145
|
offsetY: s
|
@@ -150,8 +150,8 @@ const Q = "draggable", It = "droppable", Ot = "handler-class", _t = "dragging",
|
|
150
150
|
if (ie(t))
|
151
151
|
return t;
|
152
152
|
}, Pe = (t, e, n, s) => {
|
153
|
-
const { page: o, scroll: i, before: c, borderBeforeWidth: l, getRect: f } = w(n),
|
154
|
-
return t[o] - e[i] -
|
153
|
+
const { page: o, scroll: i, before: c, borderBeforeWidth: l, getRect: f } = w(n), p = f(s);
|
154
|
+
return t[o] - e[i] - p[c] - L(s, l);
|
155
155
|
}, Nt = (t, e, n = "ease-out", s = "transform") => {
|
156
156
|
at(t) && (t.style.transitionDuration = `${e}ms`, t.style.transitionTimingFunction = `${n}`, t.style.transitionProperty = `${s}`);
|
157
157
|
}, ce = (t, e, n) => {
|
@@ -208,7 +208,7 @@ const Q = "draggable", It = "droppable", Ot = "handler-class", _t = "dragging",
|
|
208
208
|
const { gap: n } = w(e), [s, o] = jt(t, n);
|
209
209
|
return o ? s : 0;
|
210
210
|
};
|
211
|
-
function
|
211
|
+
function yt(t, e, n, s, o = t.previousElementSibling, i = t.nextElementSibling) {
|
212
212
|
let { height: c, width: l } = _e(
|
213
213
|
n,
|
214
214
|
t,
|
@@ -224,16 +224,16 @@ const _e = (t, e, n, s) => {
|
|
224
224
|
distance: c,
|
225
225
|
gap: l,
|
226
226
|
getRect: f
|
227
|
-
} = w(t),
|
227
|
+
} = w(t), p = L(e, o), h = L(e, i), b = L(s, i), [B, M] = jt(
|
228
228
|
e.parentElement,
|
229
229
|
l
|
230
230
|
), S = f(e)[c];
|
231
231
|
if (M)
|
232
|
-
return Qt(S, h,
|
232
|
+
return Qt(S, h, p, B, 0, t);
|
233
233
|
const [D, v, R] = qe(
|
234
234
|
n,
|
235
235
|
b,
|
236
|
-
|
236
|
+
p,
|
237
237
|
h,
|
238
238
|
o
|
239
239
|
);
|
@@ -265,11 +265,11 @@ const _e = (t, e, n, s) => {
|
|
265
265
|
];
|
266
266
|
};
|
267
267
|
function ke(t, e, n, s, o, i, c, l, f) {
|
268
|
-
let
|
268
|
+
let p = 0, h = 0;
|
269
269
|
const b = !!(n < 0 && f);
|
270
270
|
if (n === s && !b)
|
271
271
|
return te(
|
272
|
-
{ height:
|
272
|
+
{ height: p, width: h },
|
273
273
|
t,
|
274
274
|
o,
|
275
275
|
c,
|
@@ -278,7 +278,7 @@ function ke(t, e, n, s, o, i, c, l, f) {
|
|
278
278
|
const [B, M, S, D] = Ke(e, n, s, f);
|
279
279
|
if (b) {
|
280
280
|
const [tt, ot] = je(l, f);
|
281
|
-
|
281
|
+
p += ot, h += tt;
|
282
282
|
}
|
283
283
|
const {
|
284
284
|
scrollElement: v,
|
@@ -313,8 +313,8 @@ function ke(t, e, n, s, o, i, c, l, f) {
|
|
313
313
|
st,
|
314
314
|
X
|
315
315
|
), j = b ? l[v] : Ze(v, l, i), $ = (D ? Y - P : P - Y) - j;
|
316
|
-
return t === U ?
|
317
|
-
{ height:
|
316
|
+
return t === U ? p += $ : t === H && (h += $), te(
|
317
|
+
{ height: p, width: h },
|
318
318
|
t,
|
319
319
|
o,
|
320
320
|
c,
|
@@ -331,11 +331,11 @@ const Ze = (t, e, n) => {
|
|
331
331
|
const o = e < n, [i, c] = [e, n].toSorted(
|
332
332
|
(h, b) => h - b
|
333
333
|
), l = t[e] ?? s, f = t[n];
|
334
|
-
let
|
335
|
-
return i < 0 && s && (
|
334
|
+
let p = o ? t.slice(i + 1, c + 1) : t.slice(i, c);
|
335
|
+
return i < 0 && s && (p = t.slice(i + 1, c)), [
|
336
336
|
l,
|
337
337
|
f,
|
338
|
-
|
338
|
+
p,
|
339
339
|
o
|
340
340
|
];
|
341
341
|
}, Qe = (t, e, n, s, o, i) => {
|
@@ -343,14 +343,14 @@ const Ze = (t, e, n) => {
|
|
343
343
|
return [0, 0, 0];
|
344
344
|
const c = L(s[0], t);
|
345
345
|
let l = 0, f = -c;
|
346
|
-
for (const [
|
346
|
+
for (const [p, h] of s.entries()) {
|
347
347
|
const b = h.getBoundingClientRect()[n], B = L(h, t);
|
348
|
-
i && (l += B), i &&
|
348
|
+
i && (l += B), i && p > 0 ? l += o : l = Math.max(l, B), f += l + b, l = L(h, e);
|
349
349
|
}
|
350
350
|
return [c, f, l];
|
351
351
|
}, te = (t, e, n, s, o) => {
|
352
|
-
const { scroll: i, distance: c } = w(e), l = window[i], f = n[i],
|
353
|
-
return t[c] +=
|
352
|
+
const { scroll: i, distance: c } = w(e), l = window[i], f = n[i], p = o ? 0 : f - 2 * l + s[i];
|
353
|
+
return t[c] += p, t;
|
354
354
|
}, Ue = (t, e, n, s, o, i, c) => {
|
355
355
|
const l = o ? n.previousElementSibling : s;
|
356
356
|
return tn(
|
@@ -384,7 +384,7 @@ const Ze = (t, e, n) => {
|
|
384
384
|
const { scrollDistance: s, clientDistance: o, scrollElement: i } = w(t);
|
385
385
|
return n[i] / (e[s] - e[o]);
|
386
386
|
}, sn = "startDrag", fe = "cubic-bezier(0.2, 0, 0, 1)", on = (t, e, n) => {
|
387
|
-
let s =
|
387
|
+
let s = yt(
|
388
388
|
e,
|
389
389
|
sn,
|
390
390
|
n,
|
@@ -400,53 +400,51 @@ const Ze = (t, e, n) => {
|
|
400
400
|
o(e)[s],
|
401
401
|
s
|
402
402
|
];
|
403
|
-
},
|
403
|
+
}, ht = (t, e, n) => {
|
404
404
|
we(t, e, n), t.style.minWidth = `${n}px`;
|
405
|
-
}, cn = (t, e) => {
|
405
|
+
}, cn = (t, e, n) => (s) => {
|
406
|
+
e.contains(t) && (ht(t, n.height, n.width), s.disconnect());
|
407
|
+
}, an = (t, e) => {
|
406
408
|
if (!e)
|
407
409
|
return;
|
408
|
-
const { droppable: n, config: s, scroll: o } = t, { direction: i } = s, c = nn(s.direction, n, o) > 0.99, { scrollDistance: l, clientDistance: f, scrollElement:
|
409
|
-
c && (n[
|
410
|
+
const { droppable: n, config: s, scroll: o } = t, { direction: i } = s, c = nn(s.direction, n, o) > 0.99, { scrollDistance: l, clientDistance: f, scrollElement: p } = w(i);
|
411
|
+
c && (n[p] = n[l] - n[f]);
|
410
412
|
}, ge = (t, e, n, s) => {
|
411
413
|
if (!n)
|
412
414
|
return;
|
413
415
|
const { droppable: o, config: i } = n, { direction: c, animationDuration: l } = i;
|
414
|
-
if (
|
416
|
+
if (an(n, e), o.querySelector(`.${pt}`) || !t)
|
415
417
|
return;
|
416
|
-
var f = t.tagName == "LI" ? "DIV" : t.tagName,
|
417
|
-
nt(
|
418
|
+
var f = t.tagName == "LI" ? "DIV" : t.tagName, p = document.createElement(f);
|
419
|
+
nt(p, pt), ht(p, 0, 0);
|
418
420
|
const h = on(o, t, c);
|
419
421
|
return Nt(
|
420
|
-
|
422
|
+
p,
|
421
423
|
l,
|
422
424
|
fe,
|
423
425
|
"width, min-width, height"
|
424
|
-
), [
|
426
|
+
), [p, h, o];
|
425
427
|
}, Gt = (t, e, n, s, o) => {
|
426
428
|
const i = ge(t, n, s);
|
427
429
|
if (!i)
|
428
430
|
return;
|
429
431
|
const [c, l, f] = i;
|
430
|
-
e.isSameNode(f) &&
|
431
|
-
|
432
|
-
() => {
|
433
|
-
g.disconnect();
|
434
|
-
},
|
432
|
+
e.isSameNode(f) && ht(c, l.height, l.width), kt(
|
433
|
+
cn(c, f, l),
|
435
434
|
f,
|
436
435
|
{
|
437
436
|
childList: !0,
|
438
437
|
subtree: !0
|
439
438
|
}
|
440
|
-
);
|
441
|
-
|
442
|
-
}, an = (t, e, n) => {
|
439
|
+
), f.appendChild(c);
|
440
|
+
}, ln = (t, e, n) => {
|
443
441
|
const s = ge(t, e, n);
|
444
442
|
if (!s)
|
445
443
|
return;
|
446
444
|
const [o, i, c] = s;
|
447
|
-
c.appendChild(o),
|
448
|
-
},
|
449
|
-
|
445
|
+
c.appendChild(o), un(o, i);
|
446
|
+
}, un = (t, e) => requestAnimationFrame(() => {
|
447
|
+
ht(t, e.height, e.width), requestAnimationFrame(() => {
|
450
448
|
Nt(
|
451
449
|
t,
|
452
450
|
0,
|
@@ -454,7 +452,7 @@ const Ze = (t, e, n) => {
|
|
454
452
|
"width, min-width, height"
|
455
453
|
);
|
456
454
|
});
|
457
|
-
}),
|
455
|
+
}), fn = (t, e, n, s, o = !0) => {
|
458
456
|
if (n) {
|
459
457
|
var i = document.querySelectorAll(
|
460
458
|
`${gt(n)} > .${pt}`
|
@@ -463,33 +461,33 @@ const Ze = (t, e, n) => {
|
|
463
461
|
const l = c.parentElement;
|
464
462
|
if (l != null && l.isSameNode(e) || !o && (l != null && l.isSameNode(t)))
|
465
463
|
return;
|
466
|
-
|
467
|
-
var
|
468
|
-
(
|
464
|
+
ht(c, 0, 0), setTimeout(() => {
|
465
|
+
var p;
|
466
|
+
(p = c.parentNode) == null || p.removeChild(c);
|
469
467
|
}, s);
|
470
468
|
});
|
471
469
|
}
|
472
|
-
},
|
470
|
+
}, vt = (t, e, n = !1) => {
|
473
471
|
var s = t.querySelectorAll(`.${pt}`);
|
474
472
|
s.forEach((o) => {
|
475
|
-
n ? (
|
473
|
+
n ? (ht(o, 0, 0), setTimeout(() => {
|
476
474
|
t.contains(o) && t.removeChild(o);
|
477
475
|
}, e)) : t.removeChild(o);
|
478
476
|
});
|
479
|
-
},
|
480
|
-
function
|
477
|
+
}, gn = 50;
|
478
|
+
function dn(t, e, n, s, o, i) {
|
481
479
|
let c = e;
|
482
480
|
const {
|
483
481
|
direction: l,
|
484
482
|
handlerSelector: f,
|
485
|
-
onRemoveAtEvent:
|
483
|
+
onRemoveAtEvent: p,
|
486
484
|
animationDuration: h,
|
487
485
|
delayBeforeInsert: b,
|
488
486
|
draggingClass: B
|
489
|
-
} = t, M = (r, u,
|
487
|
+
} = t, M = (r, u, g, m, C) => {
|
490
488
|
if (!m)
|
491
489
|
return;
|
492
|
-
const { droppable: T, config: y } = m, A =
|
490
|
+
const { droppable: T, config: y } = m, A = yt(
|
493
491
|
r,
|
494
492
|
u,
|
495
493
|
y.direction,
|
@@ -499,7 +497,7 @@ function gn(t, e, n, s, o, i) {
|
|
499
497
|
r,
|
500
498
|
u,
|
501
499
|
A,
|
502
|
-
|
500
|
+
g,
|
503
501
|
m,
|
504
502
|
C
|
505
503
|
) : R(
|
@@ -508,25 +506,25 @@ function gn(t, e, n, s, o, i) {
|
|
508
506
|
A,
|
509
507
|
m
|
510
508
|
);
|
511
|
-
}, S = (r, u,
|
512
|
-
const T =
|
509
|
+
}, S = (r, u, g, m, C) => {
|
510
|
+
const T = yt(
|
513
511
|
u,
|
514
512
|
"insert",
|
515
513
|
t.direction,
|
516
|
-
|
517
|
-
), { onInsertEvent: y } = t, A = oe(
|
514
|
+
g
|
515
|
+
), { onInsertEvent: y } = t, A = oe(g);
|
518
516
|
for (const [O, x] of A.entries())
|
519
517
|
et(x, Q) && O >= r && X(x, T);
|
520
518
|
C(), setTimeout(() => {
|
521
|
-
y(r, m),
|
519
|
+
y(r, m), vt(n, 0, !0), de(r, g, t), tt(u), V(u, n);
|
522
520
|
}, b);
|
523
|
-
}, D = (r, u,
|
524
|
-
if (!
|
521
|
+
}, D = (r, u, g, m) => {
|
522
|
+
if (!g || !g.droppable || !g.config)
|
525
523
|
return;
|
526
|
-
const { droppable: C, config: T } =
|
524
|
+
const { droppable: C, config: T } = g;
|
527
525
|
let [y] = Rt(u, C);
|
528
526
|
y = [u, ...y].toReversed();
|
529
|
-
const A =
|
527
|
+
const A = yt(
|
530
528
|
u,
|
531
529
|
"remove",
|
532
530
|
T.direction,
|
@@ -537,13 +535,13 @@ function gn(t, e, n, s, o, i) {
|
|
537
535
|
m(x);
|
538
536
|
}, h));
|
539
537
|
}, v = (r) => {
|
540
|
-
|
538
|
+
vt(n, h, !0), setTimeout(() => {
|
541
539
|
tt(r), V(r, n);
|
542
540
|
}, h);
|
543
|
-
}, R = (r, u,
|
541
|
+
}, R = (r, u, g, m) => {
|
544
542
|
const { config: C, droppable: T } = m, [y] = Rt(r, T), A = dt(r, T);
|
545
543
|
y.length == 0 && I(
|
546
|
-
|
544
|
+
g,
|
547
545
|
1,
|
548
546
|
C.direction,
|
549
547
|
y
|
@@ -555,53 +553,53 @@ function gn(t, e, n, s, o, i) {
|
|
555
553
|
C.direction,
|
556
554
|
r,
|
557
555
|
x,
|
558
|
-
|
556
|
+
g
|
559
557
|
);
|
560
558
|
if (!A && G)
|
561
|
-
|
559
|
+
g = G;
|
562
560
|
else if (!A)
|
563
561
|
continue;
|
564
562
|
const Z = y.length - O;
|
565
563
|
I(
|
566
|
-
|
564
|
+
g,
|
567
565
|
Z,
|
568
566
|
C.direction,
|
569
567
|
y
|
570
|
-
), u === le ? W(x,
|
568
|
+
), u === le ? W(x, g) : u === Pt && X(x, g);
|
571
569
|
}
|
572
|
-
}, N = (r, u,
|
573
|
-
const { before: C, distance: T, axis: y, getRect: A } = w(r), O = A(u), x = A(
|
570
|
+
}, N = (r, u, g, m) => {
|
571
|
+
const { before: C, distance: T, axis: y, getRect: A } = w(r), O = A(u), x = A(g), G = O[C], Z = x[C], ut = x[T], mt = Z + ut / 2, St = ye(g)[y], ct = mt - St;
|
574
572
|
return G > ct ? { height: 0, width: 0 } : m;
|
575
|
-
}, I = (r, u,
|
573
|
+
}, I = (r, u, g, m) => {
|
576
574
|
const C = m.filter(
|
577
575
|
(y) => et(y, Q)
|
578
|
-
).length, { distance: T } = w(
|
576
|
+
).length, { distance: T } = w(g);
|
579
577
|
r[T] == 0 ? c = Math.max(c, u) : c = Math.min(c, u - 1), c = Math.min(c, C);
|
580
578
|
}, W = (r, u) => {
|
581
|
-
const { width:
|
582
|
-
|
579
|
+
const { width: g, height: m } = u;
|
580
|
+
Tt(r, m, g);
|
583
581
|
}, X = (r, u) => {
|
584
|
-
const { width:
|
585
|
-
|
586
|
-
}, F = (r, u,
|
582
|
+
const { width: g, height: m } = u;
|
583
|
+
Tt(r, m, g), Nt(r, h, ue);
|
584
|
+
}, F = (r, u, g, m, C, T) => {
|
587
585
|
const { droppable: y, scroll: A, config: O } = C, [x, G] = Rt(
|
588
586
|
r,
|
589
587
|
y
|
590
588
|
), Z = x.toReversed(), ut = G === -1 ? Z.length : G;
|
591
589
|
Z.splice(ut, 0, r);
|
592
|
-
const [
|
590
|
+
const [mt, St, ct] = st(
|
593
591
|
r,
|
594
592
|
G,
|
595
593
|
Z,
|
596
594
|
y
|
597
595
|
);
|
598
|
-
|
596
|
+
g = yt(
|
599
597
|
r,
|
600
598
|
u,
|
601
599
|
O.direction,
|
602
600
|
n,
|
603
|
-
|
604
|
-
|
601
|
+
mt,
|
602
|
+
St
|
605
603
|
);
|
606
604
|
const Ft = be(), At = ke(
|
607
605
|
O.direction,
|
@@ -616,12 +614,12 @@ function gn(t, e, n, s, o, i) {
|
|
616
614
|
);
|
617
615
|
x.length == 0 && _(
|
618
616
|
void 0,
|
619
|
-
|
617
|
+
g,
|
620
618
|
r,
|
621
619
|
At
|
622
620
|
);
|
623
621
|
for (const [xt, wt] of x.toReversed().entries()) {
|
624
|
-
let Bt =
|
622
|
+
let Bt = g;
|
625
623
|
ct - 1 >= xt && (Bt = { height: 0, width: 0 }), u === zt && !et(wt, pt) && _(
|
626
624
|
wt,
|
627
625
|
Bt,
|
@@ -636,24 +634,24 @@ function gn(t, e, n, s, o, i) {
|
|
636
634
|
y,
|
637
635
|
T
|
638
636
|
);
|
639
|
-
}, st = (r, u,
|
640
|
-
const T = dt(r, m) ? u : c, y = () => u < T ? [T, T + 1] : u > T ? [T - 1, T] : [T - 1, T + 1], [A, O] = y(), x =
|
637
|
+
}, st = (r, u, g, m) => {
|
638
|
+
const T = dt(r, m) ? u : c, y = () => u < T ? [T, T + 1] : u > T ? [T - 1, T] : [T - 1, T + 1], [A, O] = y(), x = g[A] ?? null, G = g[O] ?? null;
|
641
639
|
return [
|
642
640
|
x,
|
643
641
|
G,
|
644
642
|
T
|
645
643
|
];
|
646
|
-
}, _ = (r, u,
|
647
|
-
|
648
|
-
|
644
|
+
}, _ = (r, u, g, m) => {
|
645
|
+
Tt(r, u.height, u.width), Tt(
|
646
|
+
g,
|
649
647
|
m.height,
|
650
648
|
m.width
|
651
649
|
);
|
652
|
-
}, P = (r, u,
|
653
|
-
const { onInsertEvent: T, onDragEnd: y } =
|
650
|
+
}, P = (r, u, g, m, C) => {
|
651
|
+
const { onInsertEvent: T, onDragEnd: y } = g;
|
654
652
|
nt(u, Xt), z(u, n, m, () => {
|
655
|
-
if (
|
656
|
-
const A =
|
653
|
+
if (Et(u, Xt), C != null) {
|
654
|
+
const A = p(C);
|
657
655
|
A != null && (T(r, A), y({ value: A, index: r })), q(u), k();
|
658
656
|
}
|
659
657
|
});
|
@@ -667,25 +665,25 @@ function gn(t, e, n, s, o, i) {
|
|
667
665
|
}
|
668
666
|
}, q = (r) => {
|
669
667
|
setTimeout(() => {
|
670
|
-
|
671
|
-
},
|
672
|
-
}, z = (r, u,
|
668
|
+
Et(r, B);
|
669
|
+
}, gn);
|
670
|
+
}, z = (r, u, g, m) => {
|
673
671
|
setTimeout(() => {
|
674
|
-
m && m(), Y(u,
|
672
|
+
m && m(), Y(u, g), j(g), tt(r), V(r, u), V(r, g);
|
675
673
|
}, h);
|
676
674
|
}, Y = (r, u) => {
|
677
|
-
r.isSameNode(u) ?
|
675
|
+
r.isSameNode(u) ? vt(r, h) : (vt(r, h, !0), vt(u, h));
|
678
676
|
}, j = (r) => {
|
679
677
|
if (n.isSameNode(r))
|
680
678
|
return;
|
681
679
|
var [u] = n.querySelectorAll(`.${pt}`);
|
682
680
|
if (!u)
|
683
681
|
return;
|
684
|
-
const { distance:
|
685
|
-
at(u) && (u.style[
|
682
|
+
const { distance: g } = w(l);
|
683
|
+
at(u) && (u.style[g] = "0px");
|
686
684
|
}, V = (r, u) => {
|
687
|
-
const [
|
688
|
-
for (const m of [...
|
685
|
+
const [g] = Rt(r, u);
|
686
|
+
for (const m of [...g, r])
|
689
687
|
$(m);
|
690
688
|
}, $ = (r) => {
|
691
689
|
at(r) && (r.style.transition = "", r.style.transform = "");
|
@@ -695,10 +693,10 @@ function gn(t, e, n, s, o, i) {
|
|
695
693
|
fixedWidth: ""
|
696
694
|
});
|
697
695
|
}, ot = (r, u) => {
|
698
|
-
const
|
699
|
-
|
696
|
+
const g = u.querySelector(f);
|
697
|
+
bt(document.body, ne, r), bt(g || u, Wt, r);
|
700
698
|
}, lt = (r, u) => {
|
701
|
-
|
699
|
+
bt(r, _t, u), ot(u, r), o.toggleGrabClass(!u);
|
702
700
|
};
|
703
701
|
return [
|
704
702
|
M,
|
@@ -712,19 +710,19 @@ const de = (t, e, n) => {
|
|
712
710
|
const { insertingFromClass: s, animationDuration: o } = n, i = kt(() => {
|
713
711
|
const l = oe(e)[t];
|
714
712
|
nt(l, s), nt(l, Zt), setTimeout(() => {
|
715
|
-
|
713
|
+
Et(l, Zt), Et(l, s), i.disconnect();
|
716
714
|
}, o);
|
717
715
|
}, e, {
|
718
716
|
childList: !0
|
719
717
|
});
|
720
|
-
},
|
718
|
+
}, Cn = (t, e, n, s) => {
|
721
719
|
if (!e)
|
722
720
|
return;
|
723
721
|
const { onInsertEvent: o, delayBeforeInsert: i } = t;
|
724
722
|
setTimeout(() => {
|
725
723
|
o(n, s), de(n, e, t);
|
726
724
|
}, i);
|
727
|
-
},
|
725
|
+
}, pn = (t, e) => {
|
728
726
|
const n = (c) => t.removeAtEvent(c), s = (c, l) => t.insertEvent(c, l), o = () => t.getLength(), i = (c) => t.getValue(c);
|
729
727
|
return {
|
730
728
|
direction: (e == null ? void 0 : e.direction) ?? U,
|
@@ -747,7 +745,7 @@ const de = (t, e, n) => {
|
|
747
745
|
delayBeforeRemove: (e == null ? void 0 : e.delayBeforeRemove) ?? 200,
|
748
746
|
delayBeforeInsert: (e == null ? void 0 : e.delayBeforeInsert) ?? 200
|
749
747
|
};
|
750
|
-
},
|
748
|
+
}, hn = (t) => {
|
751
749
|
let e = { offsetX: 0, offsetY: 0 }, n = { top: 0, left: 0 }, s = { x: 0, y: 0 };
|
752
750
|
const o = (f) => {
|
753
751
|
t.style.transform = `translate( ${f.x}px, ${f.y}px)`;
|
@@ -755,7 +753,7 @@ const de = (t, e, n) => {
|
|
755
753
|
t.style.top = `${f.top}px`, t.style.left = `${f.left}px`;
|
756
754
|
};
|
757
755
|
return [
|
758
|
-
(f,
|
756
|
+
(f, p, h, b) => {
|
759
757
|
const B = (D) => {
|
760
758
|
const {
|
761
759
|
beforeMargin: v,
|
@@ -776,12 +774,12 @@ const de = (t, e, n) => {
|
|
776
774
|
return s[_];
|
777
775
|
}, M = (D) => {
|
778
776
|
if (f && et(f, _t) && D === b) {
|
779
|
-
const { before: v, distance: R, axis: N, getRect: I } = w(b), W = I(f)[R], X = I(
|
777
|
+
const { before: v, distance: R, axis: N, getRect: I } = w(b), W = I(f)[R], X = I(p), F = n[v] - X[v] + s[N], _ = X[R] - W, P = F / _, k = W / _, q = 0.1, z = 0.2, Y = 0.8;
|
780
778
|
let j = 0;
|
781
|
-
const V = dt(f,
|
779
|
+
const V = dt(f, p);
|
782
780
|
!V && P < z && P > -k ? j = P / z - 1 : !V && P > Y && P < 1 + k && (j = 1 / (1 - Y) * (P - Y));
|
783
781
|
const $ = q * W * j;
|
784
|
-
en(
|
782
|
+
en(p, b, $);
|
785
783
|
}
|
786
784
|
}, S = (D) => {
|
787
785
|
const { axis: v } = w(D);
|
@@ -789,10 +787,10 @@ const de = (t, e, n) => {
|
|
789
787
|
};
|
790
788
|
S(H), S(U);
|
791
789
|
},
|
792
|
-
(f,
|
793
|
-
const [h, b, B, M] =
|
790
|
+
(f, p) => {
|
791
|
+
const [h, b, B, M] = Dn(
|
794
792
|
f,
|
795
|
-
|
793
|
+
p,
|
796
794
|
t
|
797
795
|
);
|
798
796
|
n = {
|
@@ -804,18 +802,18 @@ const de = (t, e, n) => {
|
|
804
802
|
}, Lt = (t, e, n) => {
|
805
803
|
const { borderBeforeWidth: s, before: o, getRect: i } = w(t);
|
806
804
|
return i(e)[o] - i(n)[o] - L(n, s);
|
807
|
-
},
|
808
|
-
let { offsetX: n, offsetY: s, target: o } = t, i =
|
805
|
+
}, mn = (t, e) => {
|
806
|
+
let { offsetX: n, offsetY: s, target: o } = t, i = Sn(o, e);
|
809
807
|
const c = o;
|
810
808
|
return c && i && !c.isSameNode(i) && (n += Lt(H, c, i), s += Lt(U, c, i)), i && e != o && (n += Lt(H, i, e), s += Lt(U, i, e)), [n, s];
|
811
|
-
},
|
809
|
+
}, Sn = (t, e) => {
|
812
810
|
const n = t == null ? void 0 : t.closest(`.${Ot}`);
|
813
811
|
return n && n.isSameNode(e) ? t : n;
|
814
812
|
}, ee = (t, e, n, s) => {
|
815
|
-
const { offset: o, beforeMargin: i, page: c, borderBeforeWidth: l, scroll: f } = w(t),
|
816
|
-
return e[c] - s[o] - L(n, i) - L(n, l) - window[f] -
|
817
|
-
},
|
818
|
-
const [s, o] =
|
813
|
+
const { offset: o, beforeMargin: i, page: c, borderBeforeWidth: l, scroll: f } = w(t), p = re(n, t);
|
814
|
+
return e[c] - s[o] - L(n, i) - L(n, l) - window[f] - p;
|
815
|
+
}, Dn = (t, e, n) => {
|
816
|
+
const [s, o] = mn(t, n);
|
819
817
|
return [
|
820
818
|
ee(U, t, e, {
|
821
819
|
offsetX: s,
|
@@ -858,7 +856,7 @@ J(K, "configs", []), J(K, "removeObsoleteConfigs", () => {
|
|
858
856
|
K.configs = e;
|
859
857
|
});
|
860
858
|
let it = K;
|
861
|
-
class
|
859
|
+
class vn {
|
862
860
|
constructor(e, n, s, o, i) {
|
863
861
|
J(this, "initial");
|
864
862
|
J(this, "current");
|
@@ -928,24 +926,24 @@ class Dn {
|
|
928
926
|
return !this.getCurrent(s, e, n);
|
929
927
|
}
|
930
928
|
}
|
931
|
-
function
|
929
|
+
function bn(t, e, n, s, o) {
|
932
930
|
const {
|
933
931
|
handlerSelector: i,
|
934
932
|
isDraggable: c,
|
935
933
|
droppableGroup: l,
|
936
934
|
animationDuration: f,
|
937
|
-
delayBeforeRemove:
|
935
|
+
delayBeforeRemove: p,
|
938
936
|
draggingClass: h,
|
939
937
|
removingClass: b,
|
940
938
|
onRemoveAtEvent: B,
|
941
939
|
droppableClass: M,
|
942
940
|
onDragStart: S
|
943
|
-
} = n, D =
|
941
|
+
} = n, D = Ct(l).map((a) => `droppable-group-${a}`).join(" ");
|
944
942
|
let v = 0, R = {
|
945
943
|
scrollX: 0,
|
946
944
|
scrollY: 0
|
947
945
|
}, N = { pageX: 0, pageY: 0 }, I;
|
948
|
-
const [W, X] =
|
946
|
+
const [W, X] = hn(
|
949
947
|
t
|
950
948
|
), [
|
951
949
|
F,
|
@@ -953,7 +951,7 @@ function vn(t, e, n, s, o) {
|
|
953
951
|
_,
|
954
952
|
P,
|
955
953
|
k
|
956
|
-
] =
|
954
|
+
] = dn(
|
957
955
|
n,
|
958
956
|
e,
|
959
957
|
s,
|
@@ -984,42 +982,42 @@ function vn(t, e, n, s, o) {
|
|
984
982
|
".disable-transition{transition:none!important;}"
|
985
983
|
]), Y(), q();
|
986
984
|
}, V = (a) => {
|
987
|
-
const
|
988
|
-
return
|
985
|
+
const d = a == null ? void 0 : a.querySelector(`.${Ot}`), E = d == null ? void 0 : d.parentElement;
|
986
|
+
return d && E && et(E, It) && !E.isSameNode(s) ? null : d;
|
989
987
|
}, $ = (a) => {
|
990
|
-
const
|
991
|
-
|
992
|
-
|
988
|
+
const d = V(a) ?? a;
|
989
|
+
d && c(a) && ($t(
|
990
|
+
d,
|
993
991
|
"onmousedown",
|
994
992
|
O("mousemove", "mouseup")
|
995
993
|
), $t(
|
996
|
-
|
994
|
+
d,
|
997
995
|
"ontouchstart",
|
998
996
|
O("touchmove", "touchend")
|
999
|
-
), tt(
|
997
|
+
), tt(d)), a != null && a.isSameNode(d) || $t(a, "onmousedown", x), nt(s, It);
|
1000
998
|
}, tt = (a) => {
|
1001
|
-
const
|
1002
|
-
Array.from(
|
999
|
+
const d = a.querySelectorAll("img");
|
1000
|
+
Array.from(d).forEach((E) => {
|
1003
1001
|
E.onmousedown = () => !1;
|
1004
1002
|
});
|
1005
1003
|
}, ot = () => {
|
1006
1004
|
if (N.pageX == 0 && N.pageY == 0 || !r.current)
|
1007
1005
|
return;
|
1008
|
-
const { droppable: a, config:
|
1009
|
-
W(t, a, N,
|
1006
|
+
const { droppable: a, config: d } = r.current;
|
1007
|
+
W(t, a, N, d.direction), F(
|
1010
1008
|
t,
|
1011
1009
|
Pt,
|
1012
1010
|
R,
|
1013
1011
|
r.current
|
1014
1012
|
);
|
1015
|
-
}, lt = (a,
|
1016
|
-
|
1013
|
+
}, lt = (a, d) => {
|
1014
|
+
d && v == 2 && !(a != null && a.droppable.isSameNode(d.droppable)) && F(
|
1017
1015
|
t,
|
1018
1016
|
Pt,
|
1019
1017
|
R,
|
1020
|
-
|
1018
|
+
d
|
1021
1019
|
);
|
1022
|
-
}, r = new
|
1020
|
+
}, r = new vn(
|
1023
1021
|
t,
|
1024
1022
|
D,
|
1025
1023
|
s,
|
@@ -1028,24 +1026,24 @@ function vn(t, e, n, s, o) {
|
|
1028
1026
|
), u = (a) => {
|
1029
1027
|
if (!r.current)
|
1030
1028
|
return;
|
1031
|
-
const
|
1029
|
+
const d = D ? Array.from(
|
1032
1030
|
document.querySelectorAll(gt(D))
|
1033
1031
|
) : [s];
|
1034
|
-
for (const E of
|
1032
|
+
for (const E of d)
|
1035
1033
|
E.classList.toggle(
|
1036
1034
|
M,
|
1037
1035
|
!a && E.isSameNode(r.current.droppable)
|
1038
1036
|
);
|
1039
|
-
},
|
1037
|
+
}, g = (a) => {
|
1040
1038
|
r.updateConfig(a);
|
1041
|
-
const
|
1042
|
-
u(
|
1039
|
+
const d = r.isOutside(a);
|
1040
|
+
u(d), v === 1 ? ut(a) : v === 2 && (m(d), St(a));
|
1043
1041
|
}, m = (a = !0) => {
|
1044
1042
|
if (!r.current)
|
1045
1043
|
return;
|
1046
|
-
const { droppable:
|
1047
|
-
|
1048
|
-
|
1044
|
+
const { droppable: d } = r.current;
|
1045
|
+
fn(
|
1046
|
+
d,
|
1049
1047
|
s,
|
1050
1048
|
D,
|
1051
1049
|
f,
|
@@ -1061,37 +1059,37 @@ function vn(t, e, n, s, o) {
|
|
1061
1059
|
a.preventDefault();
|
1062
1060
|
else if (Yt(a))
|
1063
1061
|
return;
|
1064
|
-
const
|
1065
|
-
d
|
1066
|
-
}, T = (a,
|
1062
|
+
const d = Vt(a);
|
1063
|
+
g(d);
|
1064
|
+
}, T = (a, d) => {
|
1067
1065
|
a == "touchmove" ? I = setTimeout(() => {
|
1068
|
-
|
1069
|
-
}, 200) :
|
1070
|
-
}, y = (a,
|
1071
|
-
const { clientX: E, clientY: ft } = a, rt = document.elementFromPoint(E, ft),
|
1072
|
-
return rt &&
|
1066
|
+
d();
|
1067
|
+
}, 200) : d();
|
1068
|
+
}, y = (a, d) => {
|
1069
|
+
const { clientX: E, clientY: ft } = a, rt = document.elementFromPoint(E, ft), Dt = rt == null ? void 0 : rt.closest(`.${Q}`);
|
1070
|
+
return rt && d && Dt && !d.isSameNode(Dt);
|
1073
1071
|
}, A = (a) => {
|
1074
|
-
const
|
1075
|
-
return { index: e, element: a, value:
|
1076
|
-
}, O = (a,
|
1072
|
+
const d = n.onGetValue(e);
|
1073
|
+
return { index: e, element: a, value: d };
|
1074
|
+
}, O = (a, d) => (E) => {
|
1077
1075
|
if (y(E, t))
|
1078
1076
|
return;
|
1079
1077
|
it.updateScrolls(s, D);
|
1080
1078
|
const { scrollX: ft, scrollY: rt } = window;
|
1081
1079
|
if (R = { scrollX: ft, scrollY: rt }, v === 0) {
|
1082
1080
|
v = 1;
|
1083
|
-
const
|
1084
|
-
|
1081
|
+
const Dt = A(t);
|
1082
|
+
Dt && S(Dt), T(a, () => {
|
1085
1083
|
a == "touchmove" && (r.updateConfig(E), u(r.isOutside(E)), ut(E)), document.addEventListener(a, C, {
|
1086
1084
|
passive: !1
|
1087
1085
|
});
|
1088
|
-
}), ct(s), document.addEventListener(
|
1086
|
+
}), ct(s), document.addEventListener(d, G(a), {
|
1089
1087
|
once: !0
|
1090
1088
|
});
|
1091
1089
|
}
|
1092
|
-
}, x = (a) => r.updateConfig(a), G = (a) => (
|
1090
|
+
}, x = (a) => r.updateConfig(a), G = (a) => (d) => {
|
1093
1091
|
u(!0);
|
1094
|
-
const E = Vt(
|
1092
|
+
const E = Vt(d);
|
1095
1093
|
clearTimeout(I), At(r.isOutside(E, !1)), document.removeEventListener(a, C), r.updateConfig(E);
|
1096
1094
|
const ft = r.getCurrentConfig(E);
|
1097
1095
|
if (ft) {
|
@@ -1102,10 +1100,10 @@ function vn(t, e, n, s, o) {
|
|
1102
1100
|
}, Z = (a) => {
|
1103
1101
|
if (a.onscroll = null, !D)
|
1104
1102
|
return;
|
1105
|
-
const
|
1103
|
+
const d = Array.from(
|
1106
1104
|
document.querySelectorAll(gt(D))
|
1107
1105
|
);
|
1108
|
-
for (const E of
|
1106
|
+
for (const E of d)
|
1109
1107
|
at(E) && (E.onscroll = null);
|
1110
1108
|
}, ut = (a) => {
|
1111
1109
|
Gt(
|
@@ -1113,17 +1111,17 @@ function vn(t, e, n, s, o) {
|
|
1113
1111
|
s,
|
1114
1112
|
v == 1,
|
1115
1113
|
r.current
|
1116
|
-
),
|
1114
|
+
), mt(), F(
|
1117
1115
|
t,
|
1118
1116
|
le,
|
1119
1117
|
R,
|
1120
1118
|
r.current
|
1121
1119
|
), wt(t), X(a, t);
|
1122
|
-
},
|
1120
|
+
}, mt = () => {
|
1123
1121
|
v = 2;
|
1124
|
-
},
|
1125
|
-
const { pageX:
|
1126
|
-
N = { pageX:
|
1122
|
+
}, St = (a) => {
|
1123
|
+
const { pageX: d, pageY: E } = a;
|
1124
|
+
N = { pageX: d, pageY: E }, ot();
|
1127
1125
|
}, ct = (a) => ce(a, "onscroll", Ft), Ft = () => ot(), At = (a) => {
|
1128
1126
|
if (v !== 2) {
|
1129
1127
|
v = 0;
|
@@ -1137,19 +1135,19 @@ function vn(t, e, n, s, o) {
|
|
1137
1135
|
e
|
1138
1136
|
);
|
1139
1137
|
}, xt = (a) => {
|
1140
|
-
Nt(a, f, ue),
|
1138
|
+
Nt(a, f, ue), Tt(a, 0, 0);
|
1141
1139
|
}, wt = (a) => {
|
1142
|
-
const { height:
|
1140
|
+
const { height: d, width: E } = a.getBoundingClientRect();
|
1143
1141
|
ae(a, {
|
1144
|
-
fixedHeight: `${
|
1142
|
+
fixedHeight: `${d}px`,
|
1145
1143
|
fixedWidth: `${E}px`
|
1146
|
-
}), k(a, !0),
|
1144
|
+
}), k(a, !0), bt(a, h, !0), a.style.transition = "";
|
1147
1145
|
}, Bt = (a) => {
|
1148
1146
|
if (!r.initial)
|
1149
1147
|
return;
|
1150
|
-
const
|
1148
|
+
const d = r.initial;
|
1151
1149
|
a == e && (nt(t, b), setTimeout(() => {
|
1152
|
-
B(e),
|
1150
|
+
B(e), Et(t, b), Gt(
|
1153
1151
|
t,
|
1154
1152
|
s,
|
1155
1153
|
v == 1,
|
@@ -1157,20 +1155,20 @@ function vn(t, e, n, s, o) {
|
|
1157
1155
|
), st(
|
1158
1156
|
a,
|
1159
1157
|
t,
|
1160
|
-
|
1158
|
+
d,
|
1161
1159
|
(E) => {
|
1162
1160
|
xt(E), P(t);
|
1163
1161
|
}
|
1164
1162
|
);
|
1165
|
-
},
|
1166
|
-
}, pe = (a,
|
1163
|
+
}, p));
|
1164
|
+
}, pe = (a, d) => {
|
1167
1165
|
(a === e || a === n.onGetLegth() && e === a - 1) && _(
|
1168
1166
|
a,
|
1169
1167
|
t,
|
1170
1168
|
s,
|
1171
|
-
|
1169
|
+
d,
|
1172
1170
|
() => {
|
1173
|
-
|
1171
|
+
ln(
|
1174
1172
|
t,
|
1175
1173
|
v == 1,
|
1176
1174
|
r.initial
|
@@ -1180,10 +1178,10 @@ function vn(t, e, n, s, o) {
|
|
1180
1178
|
};
|
1181
1179
|
return j(), $(t), [Bt, pe];
|
1182
1180
|
}
|
1183
|
-
const
|
1181
|
+
const Tn = (t, e) => {
|
1184
1182
|
t && ve(e, t);
|
1185
1183
|
};
|
1186
|
-
function
|
1184
|
+
function yn(t, e, n, s = "index") {
|
1187
1185
|
const o = s;
|
1188
1186
|
let i = [], c = [];
|
1189
1187
|
const { droppableGroup: l } = t;
|
@@ -1192,12 +1190,12 @@ function Tn(t, e, n, s = "index") {
|
|
1192
1190
|
i,
|
1193
1191
|
c
|
1194
1192
|
];
|
1195
|
-
const f =
|
1196
|
-
|
1197
|
-
for (const
|
1198
|
-
const h =
|
1193
|
+
const f = Ct(l).map((p) => `droppable-group-${p}`).join(" ");
|
1194
|
+
Tn(f, n);
|
1195
|
+
for (const p of n.children) {
|
1196
|
+
const h = p.getAttribute(o), b = Te(h), B = p;
|
1199
1197
|
if (B && b >= 0) {
|
1200
|
-
const [M, S] =
|
1198
|
+
const [M, S] = bn(
|
1201
1199
|
B,
|
1202
1200
|
b,
|
1203
1201
|
t,
|
@@ -1212,9 +1210,9 @@ function Tn(t, e, n, s = "index") {
|
|
1212
1210
|
c
|
1213
1211
|
];
|
1214
1212
|
}
|
1215
|
-
function
|
1213
|
+
function An(t, e, n, s = "index") {
|
1216
1214
|
let o = [], i = [];
|
1217
|
-
const c =
|
1215
|
+
const c = pn(t, n), l = (S) => {
|
1218
1216
|
for (const D of o)
|
1219
1217
|
D(S);
|
1220
1218
|
}, f = (S, D) => {
|
@@ -1223,13 +1221,13 @@ function Cn(t, e, n, s = "index") {
|
|
1223
1221
|
else
|
1224
1222
|
for (const R of i)
|
1225
1223
|
R(S, D);
|
1226
|
-
},
|
1227
|
-
const [D, v] =
|
1224
|
+
}, p = (S) => {
|
1225
|
+
const [D, v] = yn(c, e, S, s);
|
1228
1226
|
o = D, i = v;
|
1229
1227
|
}, h = (S) => {
|
1230
1228
|
kt(
|
1231
1229
|
() => {
|
1232
|
-
|
1230
|
+
p(S);
|
1233
1231
|
},
|
1234
1232
|
S,
|
1235
1233
|
{ childList: !0 }
|
@@ -1243,13 +1241,13 @@ function Cn(t, e, n, s = "index") {
|
|
1243
1241
|
);
|
1244
1242
|
};
|
1245
1243
|
return [l, f, (S) => {
|
1246
|
-
S && (b(S), B(S), h(S),
|
1244
|
+
S && (b(S), B(S), h(S), p(S), it.removeObsoleteConfigs());
|
1247
1245
|
}];
|
1248
1246
|
}
|
1249
1247
|
export {
|
1250
1248
|
Se as G,
|
1251
1249
|
nt as a,
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1250
|
+
An as d,
|
1251
|
+
Cn as i,
|
1252
|
+
bt as t
|
1255
1253
|
};
|
package/dist/svelte/index.cjs
CHANGED
@@ -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-
|
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-DiASUxtT.cjs"),o=require("../index-TH8hx6fO.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;
|
package/dist/svelte/index.mjs
CHANGED
@@ -1,8 +1,8 @@
|
|
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
3
|
var r = (n, t, e) => d(n, typeof t != "symbol" ? t + "" : t, e);
|
4
|
-
import { H as c } from "../HandlerPublisher-
|
5
|
-
import { i as m, d as u } from "../index-
|
4
|
+
import { H as c } from "../HandlerPublisher-Bp-hKsuU.js";
|
5
|
+
import { i as m, d as u } from "../index-WuPwAM50.js";
|
6
6
|
class h {
|
7
7
|
constructor(t) {
|
8
8
|
r(this, "items");
|
package/dist/vue/index.cjs
CHANGED
@@ -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-
|
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-DiASUxtT.cjs"),u=require("../index-TH8hx6fO.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;
|
package/dist/vue/index.mjs
CHANGED
@@ -2,8 +2,8 @@ var l = Object.defineProperty;
|
|
2
2
|
var u = (n, t, e) => t in n ? l(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
3
3
|
var r = (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-
|
6
|
-
import { i as p, d as v } from "../index-
|
5
|
+
import { H as h } from "../HandlerPublisher-Bp-hKsuU.js";
|
6
|
+
import { i as p, d as v } from "../index-WuPwAM50.js";
|
7
7
|
const g = (n, t) => {
|
8
8
|
const e = n.value;
|
9
9
|
if (e.length <= 0)
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "fluid-dnd",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.8-beta.0",
|
4
4
|
"description": "An agnostic drag and drop library to sort all kind of lists. With current support for vue 3 and svelte",
|
5
5
|
"type": "module",
|
6
6
|
"homepage": "https://fluid-dnd.netlify.app",
|
package/dist/index-B6KgPfpv.cjs
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
"use strict";var me=Object.defineProperty;var Se=(t,e,n)=>e in t?me(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var J=(t,e,n)=>Se(t,typeof e!="symbol"?e+"":e,n);const Q="draggable",It="droppable",Ot="handler-class",Ht="dragging",Wt="dragging-handler-class",Xt="dropping",ne="grabbing",se="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)},yt=(t,e)=>{t.classList.remove(e)},De=(t,e)=>Et(e).every(n=>nt(t,n)),dt=t=>t?`.${Et(t).join(".")}`:"",ve=(t,e)=>{if(!e)return;const n=Et(e);t.classList.add(...n)},Et=t=>t?t.split(" ").filter(e=>e):[],_="horizontal",tt="vertical",be=()=>{const{scrollX:t,scrollY:e}=window;return{scrollX:t,scrollY:e}},qt=t=>!t||t.trim().length==0||t=="normal"?0:parseFloat(t),Te=t=>t?parseInt(t):-1,ye=t=>{const e=getComputedStyle(t),n=new DOMMatrixReadOnly(e.transform);return{x:n.m41,y:n.m42}},oe=(t,e)=>t.x1>e.x1?oe(e,t):t.x2<e.x1?0:t.x2>=e.x2?t.x2-t.x1:t.x2-e.x1,pt=(t,e)=>!Ee(t,e),Ee=(t,e)=>{const n=Mt(t),s=Mt(e),o=Jt(n,s,tt),i=Jt(n,s,_);return o>=Math.min(n.height,s.height)/2&&i>=Math.min(n.width,s.width)/2},Jt=(t,e,n)=>{const{before:s,distance:o}=B(n);return oe({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(),B=t=>{const e=t==_;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)=>Ce(t,e),re=t=>[...t.children].filter(n=>nt(n,Q)),Ce=(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]},Ae=t=>{let e=t.parentElement;for(;e;){if(window.getComputedStyle(e).position==="fixed")return e;e=e.parentElement}return null},ie=(t,e)=>{const{before:n,borderBeforeWidth:s}=B(e),o=Ae(t);return o?Mt(o)[n]+L(o,s):0},Yt=t=>window.TouchEvent&&t instanceof TouchEvent,at=t=>t instanceof HTMLElement,ce=t=>t instanceof MouseEvent,xe=["onmouseup","onmousedown","onmousemove"],Be=(t,e,n)=>{t&&(t.style.height=`${e}px`,t.style.width=`${n}px`)},bt=(t,e,n)=>{!t||!at(t)||(n==0&&e==0?t.style.transform="":t.style.transform=`translate(${n}px,${e}px)`)},we=(t,e,n)=>{t[e]=s=>{if(s.defaultPrevented)return;const o=Vt(s);n(o)}},$t=(t,e,n)=>{n&&(Re(e)?t[e]=n:we(t,e,n))},Re=t=>xe.includes(t),Le=t=>{const{target:e}=t;return{clientX:0,clientY:0,pageX:0,pageY:0,screenX:0,screenY:0,target:e,offsetX:0,offsetY:0}},Oe=(t,e)=>{const n=(s,o)=>Pe(e,window,o,s);if(ce(t)){const{offsetX:s,offsetY:o}=t;return[s,o]}else{const s=t.target;return[n(s,_),n(s,tt)]}},Vt=t=>{const e=Me(t);if(!e)return Le(t);const[n,s]=Oe(t,e),{clientX:o,clientY:i,pageX:c,pageY:l,screenX:f,screenY:g,target:h}=e;return{clientX:o,clientY:i,pageX:c,pageY:l,screenX:f,screenY:g,target:h,offsetX:n,offsetY:s}},Me=t=>{if(Yt(t))return t.touches[0]??t.changedTouches[0];if(ce(t))return t},Pe=(t,e,n,s)=>{const{page:o,scroll:i,before:c,borderBeforeWidth:l,getRect:f}=B(n),g=f(s);return t[o]-e[i]-g[c]-L(s,l)},Nt=(t,e,n="ease-out",s="transform")=>{at(t)&&(t.style.transitionDuration=`${e}ms`,t.style.transitionTimingFunction=`${n}`,t.style.transitionProperty=`${s}`)},ae=(t,e,n)=>{!t||!at(t)||(t[e]=()=>{n()})},Ne=t=>{var e=t.querySelector("style");if(!e){var n=document.createElement("style");return t.appendChild(n),n}return e},Fe=(t,e)=>{const n=/\.-?[_a-zA-Z0-9-*\s<>():]+/g,[s]=e.match(n)||[];for(const o of t.cssRules){const[i]=o.cssText.match(n)||[];if(s===i)return!0}return!1},$e=(t,e)=>{e.forEach(n=>{Ge(t,n)})},Ge=(t,e)=>{var s;var n=Ne(t);n.sheet&&(Fe(n.sheet,e)||(s=n.sheet)==null||s.insertRule(e,n.sheet.cssRules.length))},le=(t,e={})=>{for(const n of Object.keys(e)){const s=e[n];s!=null&&Ie(t,`--${n}`,s)}},Ie=(t,e,n)=>t&&t.style.setProperty(e,n),ue="startDrag",Pt="drag",zt="startDrop",We="drop",ht="temp-child",fe="cubic-bezier(0.2, 0, 0, 1)",Xe=t=>t===We||t===zt,_t=t=>!t||t.length==0?0:qt(t.replace("px","")),Ye=(t,e)=>{const n=getComputedStyle(t)[e];if(n.match("%")){const o=qt(n.replace("%","")),{width:i}=t.getBoundingClientRect();return i*(o/100)}return _t(n)},jt=(t,e)=>{if(!(t instanceof Element))return[0,!1];const n=Ye(t,e),s=getComputedStyle(t).display,o=n>0||s==="flex";return[n,o]},Ve=t=>{const{top:e,left:n}=getComputedStyle(t);return[_t(e),_t(n)]},_e=(t,e)=>{const{gap:n}=B(e),[s,o]=jt(t,n);return o?s:0};function Tt(t,e,n,s,o=t.previousElementSibling,i=t.nextElementSibling){let{height:c,width:l}=He(n,t,o,i);return pt(t,s)&&e==Pt&&(c=0,l=0),{height:c,width:l}}const He=(t,e,n,s)=>{const{afterMargin:o,beforeMargin:i,distance:c,gap:l,getRect:f}=B(t),g=L(e,o),h=L(e,i),b=L(s,i),[w,M]=jt(e.parentElement,l),S=f(e)[c];if(M)return Qt(S,h,g,w,0,t);const[D,v,R]=qe(n,b,g,h,o);return Qt(S,v,D,0,R,t)},qe=(t,e,n,s,o)=>{const i=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[i,c,l]},Qt=(t,e,n,s,o,i)=>ze(i,t+e+n+s-o),ze=(t,e)=>t==_?{width:e,height:0}:{width:0,height:e},Ut=(t,e)=>{const{borderBeforeWidth:n,paddingBefore:s,axis:o,getRect:i}=B(t),c=L(e,n),l=L(e,s),f=i(e)[o];return c+l+f},je=(t,e)=>{const[n,s]=Ve(e),o=Ut(tt,t);return[Ut(_,t)-s,o-n]};function ke(t,e,n,s,o,i,c,l,f){let g=0,h=0;const b=!!(n<0&&f);if(n===s&&!b)return te({height:g,width:h},t,o,c,b);const[w,M,S,D]=Ke(e,n,s,f);if(b){const[et,ot]=je(l,f);g+=ot,h+=et}const{scrollElement:v,beforeMargin:R,afterMargin:N,distance:I,gap:W}=B(t),[X,F]=jt(l,W),[st,H,P]=Ue(R,N,w,M==null?void 0:M.previousElementSibling,D,F,b),[k,q,z]=Qe(R,N,I,S,X,F),Y=Je(q,k,z,H,st,X),j=b?l[v]:Ze(v,l,i),$=(D?Y-P:P-Y)-j;return t===tt?g+=$:t===_&&(h+=$),te({height:g,width:h},t,o,c,b)}const Ze=(t,e,n)=>{const s=e[t],o=n[t];return s-o},Je=(t,e,n,s,o,i)=>{const c=Math.max(e,o);return Math.max(n,s)+t+c+i},Ke=(t,e,n,s)=>{const o=e<n,[i,c]=[e,n].toSorted((h,b)=>h-b),l=t[e]??s,f=t[n];let g=o?t.slice(i+1,c+1):t.slice(i,c);return i<0&&s&&(g=t.slice(i+1,c)),[l,f,g,o]},Qe=(t,e,n,s,o,i)=>{if(s.length==0)return[0,0,0];const c=L(s[0],t);let l=0,f=-c;for(const[g,h]of s.entries()){const b=h.getBoundingClientRect()[n],w=L(h,t);i&&(l+=w),i&&g>0?l+=o:l=Math.max(l,w),f+=l+b,l=L(h,e)}return[c,f,l]},te=(t,e,n,s,o)=>{const{scroll:i,distance:c}=B(e),l=window[i],f=n[i],g=o?0:f-2*l+s[i];return t[c]+=g,t},Ue=(t,e,n,s,o,i,c)=>{const l=o?n.previousElementSibling:s;return tn(t,e,l,n,i,c)},tn=(t,e,n,s,o,i)=>{if(o)return[0,0,0];const c=L(i?null:n,e),l=L(s,t);let f=Math.max(c,l);return[c,l,f]},kt=(t,e,n)=>{const s=new MutationObserver(o=>{if(o.length>0){const i=o[0];t(s,i)}});return s.observe(e,n),s},en=(t,e,n)=>{n!=0&&(e==="vertical"?t.scrollBy(0,n):t.scrollBy(n,0))},nn=(t,e,n)=>{const{scrollDistance:s,clientDistance:o,scrollElement:i}=B(t);return n[i]/(e[s]-e[o])},sn="startDrag",ge="cubic-bezier(0.2, 0, 0, 1)",on=(t,e,n)=>{let s=Tt(e,sn,n,t);const o=_e(t,n),{distance:i}=B(n);s[i]-=o;const[c,l]=rn(n,e);return s[l]=c,s},rn=(t,e)=>{const n=t==_?tt:_,{distance:s,getRect:o}=B(n);return[o(e)[s],s]},Ct=(t,e,n)=>{Be(t,e,n),t.style.minWidth=`${n}px`},cn=(t,e)=>{if(!e)return;const{droppable:n,config:s,scroll:o}=t,{direction:i}=s,c=nn(s.direction,n,o)>.99,{scrollDistance:l,clientDistance:f,scrollElement:g}=B(i);c&&(n[g]=n[l]-n[f])},de=(t,e,n,s)=>{if(!n)return;const{droppable:o,config:i}=n,{direction:c,animationDuration:l}=i;if(cn(n,e),o.querySelector(`.${ht}`)||!t)return;var f=t.tagName=="LI"?"DIV":t.tagName,g=document.createElement(f);U(g,ht),Ct(g,0,0);const h=on(o,t,c);return Nt(g,l,ge,"width, min-width, height"),[g,h,o]},Gt=(t,e,n,s,o)=>{const i=de(t,n,s);if(!i)return;const[c,l,f]=i;e.isSameNode(f)&&Ct(c,l.height,l.width);const g=kt(()=>{g.disconnect()},f,{childList:!0,subtree:!0});f.appendChild(c)},an=(t,e,n)=>{const s=de(t,e,n);if(!s)return;const[o,i,c]=s;c.appendChild(o),ln(o,i)},ln=(t,e)=>requestAnimationFrame(()=>{Ct(t,e.height,e.width),requestAnimationFrame(()=>{Nt(t,0,ge,"width, min-width, height")})}),un=(t,e,n,s,o=!0)=>{if(n){var i=document.querySelectorAll(`${dt(n)} > .${ht}`);i.forEach(c=>{const l=c.parentElement;if(l!=null&&l.isSameNode(e)||!o&&(l!=null&&l.isSameNode(t)))return;Ct(c,0,0),setTimeout(()=>{var g;(g=c.parentNode)==null||g.removeChild(c)},s)})}},vt=(t,e,n=!1)=>{var s=t.querySelectorAll(`.${ht}`);s.forEach(o=>{n?(Ct(o,0,0),setTimeout(()=>{t.contains(o)&&t.removeChild(o)},e)):t.removeChild(o)})},fn=50;function gn(t,e,n,s,o,i){let c=e;const{direction:l,handlerSelector:f,onRemoveAtEvent:g,animationDuration:h,delayBeforeInsert:b,draggingClass:w}=t,M=(r,u,d,m,C)=>{if(!m)return;const{droppable:T,config:y}=m,A=Tt(r,u,y.direction,T);Xe(u)?F(r,u,A,d,m,C):R(r,u,A,m)},S=(r,u,d,m,C)=>{const T=Tt(u,"insert",t.direction,d),{onInsertEvent:y}=t,A=re(d);for(const[O,x]of A.entries())nt(x,Q)&&O>=r&&X(x,T);C(),setTimeout(()=>{y(r,m),vt(n,0,!0),pe(r,d,t),et(u),V(u,n)},b)},D=(r,u,d,m)=>{if(!d||!d.droppable||!d.config)return;const{droppable:C,config:T}=d;let[y]=Rt(u,C);y=[u,...y].toReversed();const A=Tt(u,"remove",T.direction,C);for(const[O,x]of y.entries())O>=r&&(W(x,A),setTimeout(()=>{m(x)},h))},v=r=>{vt(n,h,!0),setTimeout(()=>{et(r),V(r,n)},h)},R=(r,u,d,m)=>{const{config:C,droppable:T}=m,[y]=Rt(r,T),A=pt(r,T);y.length==0&&I(d,1,C.direction,y);for(const[O,x]of y.entries()){if(!nt(x,Q))continue;const G=N(C.direction,r,x,d);if(!A&&G)d=G;else if(!A)continue;const Z=y.length-O;I(d,Z,C.direction,y),u===ue?W(x,d):u===Pt&&X(x,d)}},N=(r,u,d,m)=>{const{before:C,distance:T,axis:y,getRect:A}=B(r),O=A(u),x=A(d),G=O[C],Z=x[C],ut=x[T],mt=Z+ut/2,St=ye(d)[y],ct=mt-St;return G>ct?{height:0,width:0}:m},I=(r,u,d,m)=>{const C=m.filter(y=>nt(y,Q)).length,{distance:T}=B(d);r[T]==0?c=Math.max(c,u):c=Math.min(c,u-1),c=Math.min(c,C)},W=(r,u)=>{const{width:d,height:m}=u;bt(r,m,d)},X=(r,u)=>{const{width:d,height:m}=u;bt(r,m,d),Nt(r,h,fe)},F=(r,u,d,m,C,T)=>{const{droppable:y,scroll:A,config:O}=C,[x,G]=Rt(r,y),Z=x.toReversed(),ut=G===-1?Z.length:G;Z.splice(ut,0,r);const[mt,St,ct]=st(r,G,Z,y);d=Tt(r,u,O.direction,n,mt,St);const Ft=be(),At=ke(O.direction,Z,G,ct,Ft,A,m,y,r);x.length==0&&H(void 0,d,r,At);for(const[xt,Bt]of x.toReversed().entries()){let wt=d;ct-1>=xt&&(wt={height:0,width:0}),u===zt&&!nt(Bt,ht)&&H(Bt,wt,r,At)}P(ct,r,O,y,T)},st=(r,u,d,m)=>{const T=pt(r,m)?u:c,y=()=>u<T?[T,T+1]:u>T?[T-1,T]:[T-1,T+1],[A,O]=y(),x=d[A]??null,G=d[O]??null;return[x,G,T]},H=(r,u,d,m)=>{bt(r,u.height,u.width),bt(d,m.height,m.width)},P=(r,u,d,m,C)=>{const{onInsertEvent:T,onDragEnd:y}=d;U(u,Xt),z(u,n,m,()=>{if(yt(u,Xt),C!=null){const A=g(C);A!=null&&(T(r,A),y({value:A,index:r})),q(u),k()}})},k=()=>{if(s){var r=document.querySelectorAll(`${dt(s)} > .${Q}`);for(const u of r)$(u)}},q=r=>{setTimeout(()=>{yt(r,w)},fn)},z=(r,u,d,m)=>{setTimeout(()=>{m&&m(),Y(u,d),j(d),et(r),V(r,u),V(r,d)},h)},Y=(r,u)=>{r.isSameNode(u)?vt(r,h):(vt(r,h,!0),vt(u,h))},j=r=>{if(n.isSameNode(r))return;var[u]=n.querySelectorAll(`.${ht}`);if(!u)return;const{distance:d}=B(l);at(u)&&(u.style[d]="0px")},V=(r,u)=>{const[d]=Rt(r,u);for(const m of[...d,r])$(m)},$=r=>{at(r)&&(r.style.transition="",r.style.transform="")},et=r=>{i(),lt(r,!1),r.style.transform="",r.style.transition="",r.style.top="",r.style.left="",le(r,{fixedHeight:"",fixedWidth:""})},ot=(r,u)=>{const d=u.querySelector(f);gt(document.body,ne,r),gt(d||u,Wt,r)},lt=(r,u)=>{gt(r,Ht,u),ot(u,r),o.toggleGrabClass(!u)};return[M,D,S,v,lt]}const pe=(t,e,n)=>{const{insertingFromClass:s,animationDuration:o}=n,i=kt(()=>{const l=re(e)[t];U(l,s),U(l,Zt),setTimeout(()=>{yt(l,Zt),yt(l,s),i.disconnect()},o)},e,{childList:!0})},dn=(t,e,n,s)=>{if(!e)return;const{onInsertEvent:o,delayBeforeInsert:i}=t;setTimeout(()=>{o(n,s),pe(n,e,t)},i)},pn=(t,e)=>{const n=c=>t.removeAtEvent(c),s=(c,l)=>t.insertEvent(c,l),o=()=>t.getLength(),i=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:i,animationDuration:(e==null?void 0:e.animationDuration)??150,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}},hn=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)`},i=f=>{t.style.top=`${f.top}px`,t.style.left=`${f.left}px`};return[(f,g,h,b)=>{const w=D=>{const{beforeMargin:v,borderBeforeWidth:R,before:N,offset:I,scroll:W,page:X,inner:F,distance:st,axis:H,getRect:P}=B(D),k=h[X],q=window[W],z=window[F],Y=P(f)[st],j=L(f,R),V=L(f,v),$=k-e[I],et=ie(f,D);if($>=q-Y/2&&$<=q+z){const lt=$-n[N]-j-V-q-et;return M(D),lt}return s[H]},M=D=>{if(f&&nt(f,Ht)&&D===b){const{before:v,distance:R,axis:N,getRect:I}=B(b),W=I(f)[R],X=I(g),F=n[v]-X[v]+s[N],H=X[R]-W,P=F/H,k=W/H,q=.1,z=.2,Y=.8;let j=0;const V=pt(f,g);!V&&P<z&&P>-k?j=P/z-1:!V&&P>Y&&P<1+k&&(j=1/(1-Y)*(P-Y));const $=q*W*j;en(g,b,$)}},S=D=>{const{axis:v}=B(D);s[v]=w(D),o(s)};S(_),S(tt)},(f,g)=>{const[h,b,w,M]=Dn(f,g,t);n={top:h,left:b},i(n),e={offsetX:w,offsetY:M}}]},Lt=(t,e,n)=>{const{borderBeforeWidth:s,before:o,getRect:i}=B(t);return i(e)[o]-i(n)[o]-L(n,s)},mn=(t,e)=>{let{offsetX:n,offsetY:s,target:o}=t,i=Sn(o,e);const c=o;return c&&i&&!c.isSameNode(i)&&(n+=Lt(_,c,i),s+=Lt(tt,c,i)),i&&e!=o&&(n+=Lt(_,i,e),s+=Lt(tt,i,e)),[n,s]},Sn=(t,e)=>{const n=t==null?void 0:t.closest(`.${Ot}`);return n&&n.isSameNode(e)?t:n},ee=(t,e,n,s)=>{const{offset:o,beforeMargin:i,page:c,borderBeforeWidth:l,scroll:f}=B(t),g=ie(n,t);return e[c]-s[o]-L(n,i)-L(n,l)-window[f]-g},Dn=(t,e,n)=>{const[s,o]=mn(t,n);return[ee(tt,t,e,{offsetX:s,offsetY:o}),ee(_,t,e,{offsetX:s,offsetY:o}),s,o]},K=class K{static addConfig(e,n){const s=K.configs.filter(i=>!i.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&&De(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 vn{constructor(e,n,s,o,i){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=i}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 i=null;return s?(e.hidden=!0,i=o(this),e.hidden=!1):i=o(this),i}getCurrent(e,n,s=!0){const o=this.getElementBelow(e,n,s);return!this.groupClass||!o?void 0:o.closest(dt(this.groupClass))}isOutsideOfAllDroppables(e){return(this.groupClass?Array.from(document.querySelectorAll(dt(this.groupClass))):[this.parent]).every(s=>pt(e,s))}isNotInsideAnotherDroppable(e,n){return!pt(e,n)||this.isOutsideOfAllDroppables(e)}onScrollEvent(){this.dragEvent()}setOnScroll(e){ae(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?(at(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 bn(t,e,n,s,o){const{handlerSelector:i,isDraggable:c,droppableGroup:l,animationDuration:f,delayBeforeRemove:g,draggingClass:h,removingClass:b,onRemoveAtEvent:w,droppableClass:M,onDragStart:S}=n,D=Et(l).map(a=>`droppable-group-${a}`).join(" ");let v=0,R={scrollX:0,scrollY:0},N={pageX:0,pageY:0},I;const[W,X]=hn(t),[F,st,H,P,k]=gn(n,e,s,D,o,()=>v=0),q=()=>{U(t,Q)},z=a=>{U(a,Ot),o.addSubscriber(a)},Y=()=>{if(c(t)){const a=t.querySelector(i);z(a||t)}},j=()=>{$e(document.body,[`.${Q}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,`.${Ot}{pointer-events:auto!important;}`,`.${se}{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;}`,`.${Wt}{pointer-events:none!important;}`,`.${Xt}{pointer-events:none!important;}`,`.${ne}{cursor:grabbing;}`,".disable-transition{transition:none!important;}"]),Y(),q()},V=a=>{const p=a==null?void 0:a.querySelector(`.${Ot}`),E=p==null?void 0:p.parentElement;return p&&E&&nt(E,It)&&!E.isSameNode(s)?null:p},$=a=>{const p=V(a)??a;p&&c(a)&&($t(p,"onmousedown",O("mousemove","mouseup")),$t(p,"ontouchstart",O("touchmove","touchend")),et(p)),a!=null&&a.isSameNode(p)||$t(a,"onmousedown",x),U(s,It)},et=a=>{const p=a.querySelectorAll("img");Array.from(p).forEach(E=>{E.onmousedown=()=>!1})},ot=()=>{if(N.pageX==0&&N.pageY==0||!r.current)return;const{droppable:a,config:p}=r.current;W(t,a,N,p.direction),F(t,Pt,R,r.current)},lt=(a,p)=>{p&&v==2&&!(a!=null&&a.droppable.isSameNode(p.droppable))&&F(t,Pt,R,p)},r=new vn(t,D,s,ot,lt),u=a=>{if(!r.current)return;const p=D?Array.from(document.querySelectorAll(dt(D))):[s];for(const E of p)E.classList.toggle(M,!a&&E.isSameNode(r.current.droppable))},d=a=>{r.updateConfig(a);const p=r.isOutside(a);u(p),v===1?ut(a):v===2&&(m(p),St(a))},m=(a=!0)=>{if(!r.current)return;const{droppable:p}=r.current;un(p,s,D,f,a),!a&&Gt(t,s,v==1,r.current)},C=a=>{if(Yt(a)&&a.cancelable)a.preventDefault();else if(Yt(a))return;const p=Vt(a);d(p)},T=(a,p)=>{a=="touchmove"?I=setTimeout(()=>{p()},200):p()},y=(a,p)=>{const{clientX:E,clientY:ft}=a,rt=document.elementFromPoint(E,ft),Dt=rt==null?void 0:rt.closest(`.${Q}`);return rt&&p&&Dt&&!p.isSameNode(Dt)},A=a=>{const p=n.onGetValue(e);return{index:e,element:a,value:p}},O=(a,p)=>E=>{if(y(E,t))return;it.updateScrolls(s,D);const{scrollX:ft,scrollY:rt}=window;if(R={scrollX:ft,scrollY:rt},v===0){v=1;const Dt=A(t);Dt&&S(Dt),T(a,()=>{a=="touchmove"&&(r.updateConfig(E),u(r.isOutside(E)),ut(E)),document.addEventListener(a,C,{passive:!1})}),ct(s),document.addEventListener(p,G(a),{once:!0})}},x=a=>r.updateConfig(a),G=a=>p=>{u(!0);const E=Vt(p);clearTimeout(I),At(r.isOutside(E,!1)),document.removeEventListener(a,C),r.updateConfig(E);const ft=r.getCurrentConfig(E);if(ft){const{droppable:rt}=ft;Z(rt)}s.onscroll=null},Z=a=>{if(a.onscroll=null,!D)return;const p=Array.from(document.querySelectorAll(dt(D)));for(const E of p)at(E)&&(E.onscroll=null)},ut=a=>{Gt(t,s,v==1,r.current),mt(),F(t,ue,R,r.current),Bt(t),X(a,t)},mt=()=>{v=2},St=a=>{const{pageX:p,pageY:E}=a;N={pageX:p,pageY:E},ot()},ct=a=>ae(a,"onscroll",Ft),Ft=()=>ot(),At=a=>{if(v!==2){v=0;return}v=3,xt(t),F(t,zt,R,a?r.initial:r.current,e)},xt=a=>{Nt(a,f,fe),bt(a,0,0)},Bt=a=>{const{height:p,width:E}=a.getBoundingClientRect();le(a,{fixedHeight:`${p}px`,fixedWidth:`${E}px`}),k(a,!0),gt(a,h,!0),a.style.transition=""},wt=a=>{if(!r.initial)return;const p=r.initial;a==e&&(U(t,b),setTimeout(()=>{w(e),yt(t,b),Gt(t,s,v==1,r.initial),st(a,t,p,E=>{xt(E),P(t)})},g))},he=(a,p)=>{(a===e||a===n.onGetLegth()&&e===a-1)&&H(a,t,s,p,()=>{an(t,v==1,r.initial)})};return j(),$(t),[wt,he]}const Tn=(t,e)=>{t&&ve(e,t)};function yn(t,e,n,s="index"){const o=s;let i=[],c=[];const{droppableGroup:l}=t;if(!n)return[i,c];const f=Et(l).map(g=>`droppable-group-${g}`).join(" ");Tn(f,n);for(const g of n.children){const h=g.getAttribute(o),b=Te(h),w=g;if(w&&b>=0){const[M,S]=bn(w,b,t,n,e);i.push(M),c.push(S)}}return[i,c]}function En(t,e,n,s="index"){let o=[],i=[];const c=pn(t,n),l=S=>{for(const D of o)D(S)},f=(S,D)=>{if(c.onGetLegth()===0)t.insertToListEmpty(c,S,D);else for(const R of i)R(S,D)},g=S=>{const[D,v]=yn(c,e,S,s);o=D,i=v},h=S=>{kt(()=>{g(S)},S,{childList:!0})},b=S=>{U(S,It)},w=S=>{it.addConfig(S,c)};return[l,f,S=>{S&&(b(S),w(S),h(S),g(S),it.removeObsoleteConfigs())}]}exports.GRAB_CLASS=se;exports.addClass=U;exports.dragAndDrop=En;exports.insertToListEmpty=dn;exports.toggleClass=gt;
|