vue-fluid-dnd
Advanced tools
Comparing version 0.6.17 to 0.6.18
@@ -5,1 +5,2 @@ import { DroppableConfig } from "../composables/configHandler"; | ||
export declare const removeTempChildrens: (droppable: HTMLElement, parent: HTMLElement, droppableGroupClass: string | null, animationDuration: number) => void; | ||
export declare const removeTempChild: (parent: HTMLElement, animationDuration: number) => void; |
@@ -1,6 +0,6 @@ | ||
var Xt = Object.defineProperty; | ||
var Wt = (t, e, n) => e in t ? Xt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; | ||
var gt = (t, e, n) => (Wt(t, typeof e != "symbol" ? e + "" : e, n), n); | ||
var Yt = Object.defineProperty; | ||
var Vt = (t, e, n) => e in t ? Yt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n; | ||
var dt = (t, e, n) => (Vt(t, typeof e != "symbol" ? e + "" : e, n), n); | ||
import { ref as M, watch as ot } from "vue"; | ||
const Yt = (t, e) => { | ||
const Ht = (t, e) => { | ||
const n = t.value; | ||
@@ -11,5 +11,5 @@ if (n.length <= 0) | ||
return o; | ||
}, Vt = (t, e, n) => { | ||
}, Ft = (t, e, n) => { | ||
t.value.splice(e, 0, n); | ||
}, Ht = (t) => { | ||
}, qt = (t) => { | ||
if (t) { | ||
@@ -20,6 +20,6 @@ const { scrollLeft: e, scrollTop: n } = t; | ||
return { scrollLeft: 0, scrollTop: 0 }; | ||
}, Ft = () => { | ||
}, kt = () => { | ||
const { scrollX: t, scrollY: e } = window; | ||
return { scrollX: t, scrollY: e }; | ||
}, lt = (t) => !t || t.trim().length == 0 || t == "normal" ? 0 : parseFloat(t), qt = (t) => t ? parseInt(t) : -1, It = (t) => { | ||
}, ut = (t) => !t || t.trim().length == 0 || t == "normal" ? 0 : parseFloat(t), Ut = (t) => t ? parseInt(t) : -1, It = (t) => { | ||
const e = getComputedStyle(t), n = new DOMMatrixReadOnly(e.transform); | ||
@@ -30,6 +30,6 @@ return { | ||
}; | ||
}, Pt = (t, e) => t.x1 > e.x1 ? Pt(e, t) : t.x2 < e.x1 ? 0 : t.x2 >= e.x2 ? t.x2 - t.x1 : t.x2 - e.x1, K = (t, e) => !kt(t, e), kt = (t, e) => { | ||
const n = t.getBoundingClientRect(), o = e.getBoundingClientRect(), s = yt(n, o, "vertical"), i = yt(n, o, "horizontal"); | ||
}, Pt = (t, e) => t.x1 > e.x1 ? Pt(e, t) : t.x2 < e.x1 ? 0 : t.x2 >= e.x2 ? t.x2 - t.x1 : t.x2 - e.x1, J = (t, e) => !Zt(t, e), Zt = (t, e) => { | ||
const n = t.getBoundingClientRect(), o = e.getBoundingClientRect(), s = Et(n, o, "vertical"), i = Et(n, o, "horizontal"); | ||
return s >= Math.min(n.height, o.height) / 2 && i >= Math.min(n.width, o.width) / 2; | ||
}, yt = (t, e, n) => { | ||
}, Et = (t, e, n) => { | ||
const { before: o, distance: s } = G(n); | ||
@@ -46,3 +46,3 @@ return Pt( | ||
); | ||
}, ut = (t, e) => t ? lt(getComputedStyle(t)[e]) : 0, B = (t, e) => t ? lt(getComputedStyle(t)[e]) : 0, At = (t) => { | ||
}, ft = (t, e) => t ? ut(getComputedStyle(t)[e]) : 0, B = (t, e) => t ? ut(getComputedStyle(t)[e]) : 0, yt = (t) => { | ||
const { scrollLeft: e, scrollTop: n } = t; | ||
@@ -84,3 +84,3 @@ return { scrollLeft: e, scrollTop: n }; | ||
clientDistance: "clientHeight" | ||
}, dt = (t, e) => Ut(t, e), Ut = (t, e) => { | ||
}, pt = (t, e) => jt(t, e), jt = (t, e) => { | ||
const n = [...e.children].filter( | ||
@@ -96,5 +96,5 @@ (s) => !s.isEqualNode(t) && s.classList.contains("draggable") | ||
}; | ||
}, ht = (t) => window.TouchEvent && t instanceof TouchEvent, Q = (t) => t instanceof HTMLElement, Zt = ["onmouseup", "onmousedown", "onmousemove"], nt = (t, e, n) => { | ||
!t || !Q(t) || (n == 0 && e == 0 ? t.style.transform = "" : t.style.transform = `translate(${n}px,${e}px)`); | ||
}, jt = (t, e, n) => { | ||
}, ht = (t) => window.TouchEvent && t instanceof TouchEvent, K = (t) => t instanceof HTMLElement, Jt = ["onmouseup", "onmousedown", "onmousemove"], nt = (t, e, n) => { | ||
!t || !K(t) || (n == 0 && e == 0 ? t.style.transform = "" : t.style.transform = `translate(${n}px,${e}px)`); | ||
}, Kt = (t, e, n) => { | ||
t[e] = (o) => { | ||
@@ -106,5 +106,5 @@ if (o.defaultPrevented) | ||
}; | ||
}, Gt = (t, e, n) => { | ||
n && (Jt(e) ? t[e] = n : jt(t, e, n)); | ||
}, Jt = (t) => Zt.includes(t), Kt = (t) => { | ||
}, At = (t, e, n) => { | ||
n && (Qt(e) ? t[e] = n : Kt(t, e, n)); | ||
}, Qt = (t) => Jt.includes(t), te = (t) => { | ||
const { target: e } = t; | ||
@@ -122,4 +122,4 @@ return { | ||
}; | ||
}, Qt = (t, e) => { | ||
const n = (o, s) => ee(e, window, s, o); | ||
}, ee = (t, e) => { | ||
const n = (o, s) => oe(e, window, s, o); | ||
if (t instanceof MouseEvent) { | ||
@@ -136,6 +136,6 @@ const { offsetX: o, offsetY: s } = t; | ||
}, vt = (t) => { | ||
const e = te(t); | ||
const e = ne(t); | ||
if (!e) | ||
return Kt(t); | ||
const { offsetX: n, offsetY: o } = Qt(t, e), { clientX: s, clientY: i, pageX: r, pageY: a, screenX: f, screenY: g, target: p } = e; | ||
return te(t); | ||
const { offsetX: n, offsetY: o } = ee(t, e), { clientX: s, clientY: i, pageX: r, pageY: a, screenX: u, screenY: g, target: p } = e; | ||
return { | ||
@@ -146,3 +146,3 @@ clientX: s, | ||
pageY: a, | ||
screenX: f, | ||
screenX: u, | ||
screenY: g, | ||
@@ -153,3 +153,3 @@ target: p, | ||
}; | ||
}, te = (t) => { | ||
}, ne = (t) => { | ||
if (ht(t)) | ||
@@ -159,12 +159,12 @@ return t.touches[0]; | ||
return t; | ||
}, ee = (t, e, n, o) => { | ||
const { page: s, scroll: i, before: r, borderBeforeWidth: a } = G(n), f = o.getBoundingClientRect(); | ||
return t[s] - e[i] - f[r] - ut(o, a); | ||
}, Tt = (t, e, n = "ease-out", o = "transform") => { | ||
Q(t) && (t.style.transition = `${e}ms ${n}`, t.style.transitionProperty = `${o}`); | ||
}, ne = (t, e, n) => { | ||
!t || !Q(t) || (t[e] = () => { | ||
}, oe = (t, e, n, o) => { | ||
const { page: s, scroll: i, before: r, borderBeforeWidth: a } = G(n), u = o.getBoundingClientRect(); | ||
return t[s] - e[i] - u[r] - ft(o, a); | ||
}, bt = (t, e, n = "ease-out", o = "transform") => { | ||
K(t) && (t.style.transitionDuration = `${e}ms`, t.style.transitionTimingFunction = `${n}`, t.style.transitionProperty = `${o}`); | ||
}, se = (t, e, n) => { | ||
!t || !K(t) || (t[e] = () => { | ||
n(); | ||
}); | ||
}, oe = (t) => { | ||
}, re = (t) => { | ||
var e = t.querySelector("style"); | ||
@@ -176,3 +176,3 @@ if (!e) { | ||
return e; | ||
}, se = (t, e) => { | ||
}, ie = (t, e) => { | ||
const n = /\.-?[_a-zA-Z0-9-*\s<>():]+/g, [o] = e.match(n) || []; | ||
@@ -185,16 +185,16 @@ for (const s of t.cssRules) { | ||
return !1; | ||
}, re = (t, e) => { | ||
}, ce = (t, e) => { | ||
e.forEach((n) => { | ||
ie(t, n); | ||
ae(t, n); | ||
}); | ||
}, ie = (t, e) => { | ||
}, ae = (t, e) => { | ||
var o; | ||
var n = oe(t); | ||
n.sheet && (se(n.sheet, e) || (o = n.sheet) == null || o.insertRule(e, n.sheet.cssRules.length)); | ||
}, ce = (t, e, n) => { | ||
var n = re(t); | ||
n.sheet && (ie(n.sheet, e) || (o = n.sheet) == null || o.insertRule(e, n.sheet.cssRules.length)); | ||
}, le = (t, e, n) => { | ||
n != 0 && (e === "vertical" ? t.scrollBy(0, n) : t.scrollBy(n, 0)); | ||
}, ae = (t, e, n) => { | ||
}, ue = (t, e, n) => { | ||
const { scrollDistance: o, clientDistance: s, scrollElement: i } = G(t); | ||
return n[i] / (e[o] - e[s]); | ||
}, le = "handler-class", ue = (t) => { | ||
}, fe = "handler-class", ge = (t) => { | ||
const e = M({ offsetX: 0, offsetY: 0 }), n = M({ top: 0, left: 0 }), o = M({ x: 0, y: 0 }); | ||
@@ -216,34 +216,34 @@ ot( | ||
); | ||
function s(r, a, f, g) { | ||
const p = (b) => { | ||
function s(r, a, u, g) { | ||
const p = (S) => { | ||
const { | ||
beforeMargin: x, | ||
beforeMargin: y, | ||
borderBeforeWidth: R, | ||
before: S, | ||
before: T, | ||
offset: w, | ||
scroll: z, | ||
page: k, | ||
page: q, | ||
inner: X, | ||
distance: W, | ||
axis: C | ||
} = G(b), Y = f.value[k], V = window[z], H = window[X], F = r.getBoundingClientRect()[W], I = ut(r, R), l = B(r, x), u = Y - e.value[w]; | ||
if (u >= V - F / 2 && u <= V + H) { | ||
const v = u - n.value[S] - I - l - V; | ||
return E(b), v; | ||
} = G(S), H = u.value[q], Y = window[z], V = window[X], P = r.getBoundingClientRect()[W], l = ft(r, R), f = B(r, y), h = H - e.value[w]; | ||
if (h >= Y - P / 2 && h <= Y + V) { | ||
const x = h - n.value[T] - l - f - Y; | ||
return E(S), x; | ||
} | ||
return o.value[C]; | ||
}, E = (b) => { | ||
if (r && r.classList.contains("dragging") && b === g) { | ||
const { before: x, distance: R, axis: S } = G(g), w = r.getBoundingClientRect()[R], z = a.getBoundingClientRect(), k = n.value[x] - z[x] + o.value[S], W = z[R] - w, C = k / W, Y = w / W, V = 0.1, H = 0.2, F = 0.8; | ||
let I = 0; | ||
const l = K(r, a); | ||
!l && C < H && C > -Y ? I = C / H - 1 : !l && C > F && C < 1 + Y && (I = 1 / (1 - F) * (C - F)); | ||
const u = V * w * I; | ||
ce(a, g, u); | ||
}, E = (S) => { | ||
if (r && r.classList.contains("dragging") && S === g) { | ||
const { before: y, distance: R, axis: T } = G(g), w = r.getBoundingClientRect()[R], z = a.getBoundingClientRect(), q = n.value[y] - z[y] + o.value[T], W = z[R] - w, C = q / W, H = w / W, Y = 0.1, V = 0.2, P = 0.8; | ||
let l = 0; | ||
const f = J(r, a); | ||
!f && C < V && C > -H ? l = C / V - 1 : !f && C > P && C < 1 + H && (l = 1 / (1 - P) * (C - P)); | ||
const h = Y * w * l; | ||
le(a, g, h); | ||
} | ||
}, m = (b) => { | ||
const { axis: x } = G(b); | ||
o.value[x] = p(b); | ||
}, D = (S) => { | ||
const { axis: y } = G(S); | ||
o.value[y] = p(S); | ||
}; | ||
m("horizontal"), m("vertical"); | ||
D("horizontal"), D("vertical"); | ||
} | ||
@@ -253,3 +253,3 @@ return { | ||
updateTransformState: (r, a) => { | ||
const { offsetX: f, offsetY: g, top: p, left: E } = de( | ||
const { offsetX: u, offsetY: g, top: p, left: E } = he( | ||
r, | ||
@@ -262,25 +262,25 @@ a, | ||
left: E | ||
}, e.value = { offsetX: f, offsetY: g }; | ||
}, e.value = { offsetX: u, offsetY: g }; | ||
} | ||
}; | ||
}, Rt = (t, e, n) => { | ||
}, xt = (t, e, n) => { | ||
const { borderBeforeWidth: o, before: s } = G(t); | ||
return e.getBoundingClientRect()[s] - n.getBoundingClientRect()[s] - ut(n, o); | ||
}, fe = (t, e) => { | ||
let { offsetX: n, offsetY: o, target: s } = t, i = ge(s, e); | ||
return e && i && e != s && (n += Rt("horizontal", i, e), o += Rt("vertical", i, e)), { offsetX: n, offsetY: o }; | ||
}, ge = (t, e) => { | ||
const n = t == null ? void 0 : t.closest(`.${le}`); | ||
return e.getBoundingClientRect()[s] - n.getBoundingClientRect()[s] - ft(n, o); | ||
}, de = (t, e) => { | ||
let { offsetX: n, offsetY: o, target: s } = t, i = pe(s, e); | ||
return e && i && e != s && (n += xt("horizontal", i, e), o += xt("vertical", i, e)), { offsetX: n, offsetY: o }; | ||
}, pe = (t, e) => { | ||
const n = t == null ? void 0 : t.closest(`.${fe}`); | ||
return n && e && n.isSameNode(e) ? t : n; | ||
}, Ct = (t, e, n, o) => { | ||
const { offset: s, beforeMargin: i, page: r, borderBeforeWidth: a, scroll: f } = G(t); | ||
return e[r] - o[s] - B(n, i) - ut(n, a) - window[f]; | ||
}, de = (t, e, n) => { | ||
const { offsetX: o, offsetY: s } = fe(t, n); | ||
}, Gt = (t, e, n, o) => { | ||
const { offset: s, beforeMargin: i, page: r, borderBeforeWidth: a, scroll: u } = G(t); | ||
return e[r] - o[s] - B(n, i) - ft(n, a) - window[u]; | ||
}, he = (t, e, n) => { | ||
const { offsetX: o, offsetY: s } = de(t, n); | ||
return { | ||
top: Ct("vertical", t, e, { | ||
top: Gt("vertical", t, e, { | ||
offsetX: o, | ||
offsetY: s | ||
}), | ||
left: Ct("horizontal", t, e, { | ||
left: Gt("horizontal", t, e, { | ||
offsetX: o, | ||
@@ -292,12 +292,12 @@ offsetY: s | ||
}; | ||
}, pe = "drag", he = "startDrop", ve = "drop", me = (t) => t === ve || t === he; | ||
var $ = /* @__PURE__ */ ((t) => (t[t.NOT_DRAGGING = 0] = "NOT_DRAGGING", t[t.START_DRAGGING = 1] = "START_DRAGGING", t[t.DRAGING = 2] = "DRAGING", t[t.END_DRAGGING = 3] = "END_DRAGGING", t))($ || {}); | ||
const mt = (t) => !t || t.length == 0 ? 0 : lt(t.replace("px", "")), De = (t, e) => { | ||
}, ve = "drag", me = "startDrop", De = "drop", be = (t) => t === De || t === me; | ||
var I = /* @__PURE__ */ ((t) => (t[t.NOT_DRAGGING = 0] = "NOT_DRAGGING", t[t.START_DRAGGING = 1] = "START_DRAGGING", t[t.DRAGING = 2] = "DRAGING", t[t.END_DRAGGING = 3] = "END_DRAGGING", t))(I || {}); | ||
const mt = (t) => !t || t.length == 0 ? 0 : ut(t.replace("px", "")), Se = (t, e) => { | ||
const n = getComputedStyle(t)[e]; | ||
if (n.match("%")) { | ||
const s = lt(n.replace("%", "")), { width: i } = t.getBoundingClientRect(); | ||
const s = ut(n.replace("%", "")), { width: i } = t.getBoundingClientRect(); | ||
return i * (s / 100); | ||
} | ||
return mt(n); | ||
}, Et = (t, e) => { | ||
}, St = (t, e) => { | ||
if (!(t instanceof Element)) | ||
@@ -308,3 +308,3 @@ return { | ||
}; | ||
const n = De(t, e), o = getComputedStyle(t).display, s = n > 0 || o === "flex"; | ||
const n = Se(t, e), o = getComputedStyle(t).display, s = n > 0 || o === "flex"; | ||
return { | ||
@@ -314,3 +314,3 @@ gap: n, | ||
}; | ||
}, be = (t) => { | ||
}, Te = (t) => { | ||
const { top: e, left: n } = getComputedStyle(t); | ||
@@ -321,8 +321,8 @@ return { | ||
}; | ||
}, Se = (t, e) => { | ||
const { gap: n } = G(e), { gap: o, hasGaps: s } = Et(t, n); | ||
}, Ee = (t, e) => { | ||
const { gap: n } = G(e), { gap: o, hasGaps: s } = St(t, n); | ||
return s ? o : 0; | ||
}; | ||
function Dt(t, e, n, o, s = t.previousElementSibling, i = t.nextElementSibling) { | ||
let { height: r, width: a } = Te( | ||
let { height: r, width: a } = ye( | ||
n, | ||
@@ -333,5 +333,5 @@ t, | ||
); | ||
return K(t, o) && e == pe && (r = 0, a = 0), { height: r, width: a }; | ||
return J(t, o) && e == ve && (r = 0, a = 0), { height: r, width: a }; | ||
} | ||
function Te(t, e, n, o) { | ||
function ye(t, e, n, o) { | ||
const { | ||
@@ -342,29 +342,29 @@ afterMargin: s, | ||
gap: a | ||
} = G(t), f = B(e, s), g = B(e, i), p = B(o, i), { gap: E, hasGaps: m } = Et( | ||
} = G(t), u = B(e, s), g = B(e, i), p = B(o, i), { gap: E, hasGaps: D } = St( | ||
e.parentElement, | ||
a | ||
), b = e.getBoundingClientRect()[r]; | ||
if (m) | ||
return Nt(b, g, f, E, 0, t); | ||
const { afterSpace: x, beforeScace: R, rest: S } = Ee( | ||
), S = e.getBoundingClientRect()[r]; | ||
if (D) | ||
return Rt(S, g, u, E, 0, t); | ||
const { afterSpace: y, beforeScace: R, rest: T } = Ae( | ||
n, | ||
p, | ||
f, | ||
u, | ||
g, | ||
s | ||
); | ||
return Nt(b, R, x, 0, S, t); | ||
return Rt(S, R, y, 0, T, t); | ||
} | ||
const Ee = (t, e, n, o, s) => { | ||
const Ae = (t, e, n, o, s) => { | ||
const i = Math.max(e, n); | ||
let r = o, a = e; | ||
if (t) { | ||
const f = B( | ||
const u = B( | ||
t, | ||
s | ||
); | ||
r = Math.max(f, o), a = Math.max(a, f); | ||
r = Math.max(u, o), a = Math.max(a, u); | ||
} | ||
return { afterSpace: i, beforeScace: r, rest: a }; | ||
}, Nt = (t, e, n, o, s, i) => xe(i, t + e + n + o - s), xe = (t, e) => t == "horizontal" ? { width: e, height: 0 } : { width: 0, height: e }, ye = (t, e, n) => { | ||
}, Rt = (t, e, n, o, s, i) => xe(i, t + e + n + o - s), xe = (t, e) => t == "horizontal" ? { width: e, height: 0 } : { width: 0, height: e }, Ge = (t, e, n) => { | ||
console.log(n); | ||
@@ -377,15 +377,15 @@ const { beforeMargin: o } = G("vertical"), { beforeMargin: s } = G("horizontal"), i = B( | ||
s | ||
), { top: a, left: f } = be(e), { top: g, left: p } = t.getBoundingClientRect(), { x: E, y: m } = It(t); | ||
), { top: a, left: u } = Te(e), { top: g, left: p } = t.getBoundingClientRect(), { x: E, y: D } = It(t); | ||
return console.log( | ||
g - B(t, o) - m - (a - i) - 13, | ||
g - a - m - i - 25 | ||
g - B(t, o) - D - (a - i) - 13, | ||
g - a - D - i - 25 | ||
), { | ||
y: g - a - m - i, | ||
x: p - f - E - r | ||
y: g - a - D - i, | ||
x: p - u - E - r | ||
}; | ||
}; | ||
function Ae(t, e, n, o, s, i, r, a, f) { | ||
function Re(t, e, n, o, s, i, r, a, u) { | ||
let g = 0, p = 0, E = !1; | ||
if (n === o) | ||
return Lt( | ||
return Ct( | ||
{ height: g, width: p }, | ||
@@ -397,44 +397,44 @@ t, | ||
); | ||
if (n < 0 && f) { | ||
if (n < 0 && u) { | ||
E = !0; | ||
const [D] = e, { x: y, y: N } = ye( | ||
D, | ||
f, | ||
const [A] = e, { x: N, y: L } = Ge( | ||
A, | ||
u, | ||
t | ||
); | ||
g += N, p += y; | ||
g += L, p += N; | ||
} | ||
const { sourceElement: m, targetElement: b, siblingsBetween: x, isDraggedFoward: R } = Ce(e, n, o, f), { | ||
scrollElement: S, | ||
const { sourceElement: D, targetElement: S, siblingsBetween: y, isDraggedFoward: R } = Le(e, n, o, u), { | ||
scrollElement: T, | ||
beforeMargin: w, | ||
afterMargin: z, | ||
distance: k, | ||
distance: q, | ||
gap: X | ||
} = G(t), { gap: W, hasGaps: C } = Et(a, X), { | ||
beforeMargin: Y, | ||
afterMargin: V, | ||
spaceBeforeDraggedElement: H | ||
} = Le( | ||
} = G(t), { gap: W, hasGaps: C } = St(a, X), { | ||
beforeMargin: H, | ||
afterMargin: Y, | ||
spaceBeforeDraggedElement: V | ||
} = Be( | ||
w, | ||
z, | ||
m, | ||
b == null ? void 0 : b.previousElementSibling, | ||
D, | ||
S == null ? void 0 : S.previousElementSibling, | ||
R, | ||
C | ||
), { beforeSpace: F, space: I, afterSpace: l } = Ne( | ||
), { beforeSpace: P, space: l, afterSpace: f } = Me( | ||
w, | ||
z, | ||
k, | ||
x, | ||
q, | ||
y, | ||
W, | ||
C | ||
), u = Re( | ||
I, | ||
F, | ||
), h = Ne( | ||
l, | ||
P, | ||
f, | ||
H, | ||
Y, | ||
V, | ||
W | ||
), h = E ? 0 : Ge(S, a, i), A = (R ? u - H : H - u) - h; | ||
return t === "vertical" ? g += A : t === "horizontal" && (p += A), Lt( | ||
), v = E ? 0 : Ce(T, a, i), b = (R ? h - V : V - h) - v; | ||
return t === "vertical" ? g += b : t === "horizontal" && (p += b), Ct( | ||
{ height: g, width: p }, | ||
@@ -447,20 +447,20 @@ t, | ||
} | ||
const Ge = (t, e, n) => { | ||
const Ce = (t, e, n) => { | ||
const o = e[t], s = n[t]; | ||
return o - s; | ||
}, Re = (t, e, n, o, s, i) => { | ||
}, Ne = (t, e, n, o, s, i) => { | ||
const r = Math.max(e, s); | ||
return Math.max(n, o) + t + r + i; | ||
}, Ce = (t, e, n, o) => { | ||
}, Le = (t, e, n, o) => { | ||
const s = e < n, [i, r] = [e, n].toSorted( | ||
(p, E) => p - E | ||
), a = t[e] ?? o, f = t[n]; | ||
), a = t[e] ?? o, u = t[n]; | ||
let g = s ? t.slice(i + 1, r + 1) : t.slice(i, r); | ||
return i < 0 && o && (g = t.slice(i + 1, r)), { | ||
sourceElement: a, | ||
targetElement: f, | ||
targetElement: u, | ||
siblingsBetween: g, | ||
isDraggedFoward: s | ||
}; | ||
}, Ne = (t, e, n, o, s, i) => { | ||
}, Me = (t, e, n, o, s, i) => { | ||
if (o.length == 0) | ||
@@ -473,14 +473,14 @@ return { | ||
const r = B(o[0], t); | ||
let a = 0, f = -r; | ||
let a = 0, u = -r; | ||
for (const [g, p] of o.entries()) { | ||
const E = p.getBoundingClientRect()[n], m = B(p, t); | ||
i && (a += m), i && g > 0 ? a += s : a = Math.max(a, m), f += a + E, a = B(p, e); | ||
const E = p.getBoundingClientRect()[n], D = B(p, t); | ||
i && (a += D), i && g > 0 ? a += s : a = Math.max(a, D), u += a + E, a = B(p, e); | ||
} | ||
return { beforeSpace: r, space: f, afterSpace: a }; | ||
}, Lt = (t, e, n, o, s) => { | ||
const { scroll: i, distance: r } = G(e), a = window[i], f = n[i], g = s ? 0 : f - 2 * a + o[i]; | ||
return { beforeSpace: r, space: u, afterSpace: a }; | ||
}, Ct = (t, e, n, o, s) => { | ||
const { scroll: i, distance: r } = G(e), a = window[i], u = n[i], g = s ? 0 : u - 2 * a + o[i]; | ||
return t[r] += g, t; | ||
}, Le = (t, e, n, o, s, i) => { | ||
}, Be = (t, e, n, o, s, i) => { | ||
const r = s ? n.previousElementSibling : o; | ||
return Me( | ||
return we( | ||
t, | ||
@@ -492,3 +492,3 @@ e, | ||
); | ||
}, Me = (t, e, n, o, s) => { | ||
}, we = (t, e, n, o, s) => { | ||
if (s) | ||
@@ -510,122 +510,199 @@ return { | ||
}; | ||
}, Mt = "dragging-handler-class", Be = "dragging", we = "draggable", pt = "temp-child", Oe = "startDrop", _e = "drag", $e = "startDrag", Bt = "dropping", Ie = "cubic-bezier(0.2, 0, 0, 1)"; | ||
function Pe(t, e, n, o, s, i) { | ||
const r = M(s), { direction: a, handlerSelector: f, onRemoveAtEvent: g, animationDuration: p } = t, E = (l, u, h, v, A) => { | ||
}, zt = (t, e, n) => { | ||
const o = new MutationObserver((s) => { | ||
s.forEach(() => { | ||
t(o); | ||
}); | ||
}); | ||
o.observe(e, n); | ||
}, lt = "temp-child", Oe = "startDrag", _e = "cubic-bezier(0.2, 0, 0, 1)", $e = (t, e, n) => { | ||
let o = Dt( | ||
e, | ||
Oe, | ||
n, | ||
t | ||
); | ||
const s = Ee(t, n), { distance: i } = G(n); | ||
o[i] -= s; | ||
const { large: r, largeDistance: a } = Ie(n, e); | ||
return o[a] = r, o; | ||
}, Ie = (t, e) => { | ||
const n = t == "horizontal" ? "vertical" : "horizontal", { distance: o } = G(n); | ||
return { | ||
large: e.getBoundingClientRect()[o], | ||
largeDistance: o | ||
}; | ||
}, st = (t, e, n) => { | ||
t.style.height = `${e}px`, t.style.width = `${n}px`, t.style.minWidth = `${n}px`; | ||
}, Pe = (t, e, n) => (o) => { | ||
e.contains(t) && (st(t, n.height, n.width), o.disconnect()); | ||
}, ze = (t, e) => { | ||
if (e != I.START_DRAGGING) | ||
return; | ||
const { droppable: n, config: o, droppableScroll: s } = t, { direction: i } = o, r = ue(o.direction, n, s) > 0.99, { scrollDistance: a, clientDistance: u, scrollElement: g } = G(i); | ||
r && (n[g] = n[a] - n[u]); | ||
}, Nt = (t, e, n, o) => { | ||
if (!o) | ||
return; | ||
const { droppable: s, config: i } = o, { direction: r, animationDuration: a } = i; | ||
if (ze(o, n), s.querySelector(`.${lt}`) || !t) | ||
return; | ||
var u = document.createElement("div"); | ||
u.classList.add(lt), st(u, 0, 0); | ||
const g = $e(s, t, r); | ||
bt( | ||
u, | ||
a, | ||
_e, | ||
"width, min-width, height" | ||
), e.isSameNode(s) && st(u, g.height, g.width), zt( | ||
Pe(u, s, g), | ||
s, | ||
{ | ||
childList: !0, | ||
subtree: !0 | ||
} | ||
), s.appendChild(u); | ||
}, Xe = (t, e, n, o) => { | ||
if (n) { | ||
var s = document.querySelectorAll( | ||
`.${n} .${lt}` | ||
); | ||
s.forEach((i) => { | ||
const r = i.parentElement; | ||
if (r != null && r.isSameNode(e) || r != null && r.isSameNode(t)) | ||
return; | ||
st(i, 0, 0), setTimeout(() => { | ||
var u; | ||
(u = i.parentNode) == null || u.removeChild(i); | ||
}, o); | ||
}); | ||
} | ||
}, Lt = (t, e) => { | ||
var n = t.querySelectorAll(`.${lt}`); | ||
n.forEach((o) => { | ||
st(o, 0, 0), setTimeout(() => { | ||
t.removeChild(o); | ||
}, e); | ||
}); | ||
}, Mt = "dragging-handler-class", We = "dragging", Ye = "draggable", Bt = "temp-child", Ve = "startDrop", He = "drag", Fe = "startDrag", wt = "dropping", qe = "cubic-bezier(0.2, 0, 0, 1)"; | ||
function ke(t, e, n, o, s, i) { | ||
const r = M(s), { direction: a, handlerSelector: u, onRemoveAtEvent: g, animationDuration: p } = t, E = (l, f, h, v, x) => { | ||
if (!v) | ||
return; | ||
const { droppable: D, config: y } = v, N = Dt( | ||
const { droppable: b, config: A } = v, N = Dt( | ||
l, | ||
u, | ||
y.direction, | ||
D | ||
f, | ||
A.direction, | ||
b | ||
); | ||
me(u) ? w( | ||
be(f) ? w( | ||
l, | ||
u, | ||
f, | ||
N, | ||
h, | ||
v, | ||
A | ||
) : m( | ||
x | ||
) : D( | ||
l, | ||
u, | ||
f, | ||
N, | ||
v | ||
); | ||
}, m = (l, u, h, v) => { | ||
const { config: A, droppable: D } = v, { siblings: y } = dt(l, D), N = K(l, D); | ||
for (const [O, L] of y.entries()) { | ||
if (!L.classList.contains(we)) | ||
}, D = (l, f, h, v) => { | ||
const { config: x, droppable: b } = v, { siblings: A } = pt(l, b), N = J(l, b); | ||
for (const [L, O] of A.entries()) { | ||
if (!O.classList.contains(Ye)) | ||
continue; | ||
const P = b( | ||
A.direction, | ||
const _ = S( | ||
x.direction, | ||
l, | ||
L, | ||
O, | ||
h | ||
); | ||
if (!N && P) | ||
h = P; | ||
if (!N && _) | ||
h = _; | ||
else if (!N) | ||
continue; | ||
const U = y.length - O; | ||
x( | ||
const k = A.length - L; | ||
y( | ||
h, | ||
U, | ||
A.direction, | ||
y | ||
), u === $e ? R(L, h) : u === _e && S(L, h); | ||
k, | ||
x.direction, | ||
A | ||
), f === Fe ? R(O, h) : f === He && T(O, h); | ||
} | ||
}, b = (l, u, h, v) => { | ||
const { before: A, distance: D, axis: y } = G(l), N = u.getBoundingClientRect(), O = h.getBoundingClientRect(), L = N[A], P = O[A], U = O[D], tt = P + U / 2; | ||
}, S = (l, f, h, v) => { | ||
const { before: x, distance: b, axis: A } = G(l), N = f.getBoundingClientRect(), L = h.getBoundingClientRect(), O = N[x], _ = L[x], k = L[b], Q = _ + k / 2; | ||
if (h.getAnimations().length !== 0) | ||
return; | ||
const Z = It(h)[y], et = tt - Z; | ||
return L > et ? { height: 0, width: 0 } : v; | ||
}, x = (l, u, h, v) => { | ||
const A = v.filter( | ||
(y) => y.classList.contains("draggable") | ||
).length, { distance: D } = G(h); | ||
l[D] == 0 ? r.value = Math.max(r.value, u) : r.value = Math.min(r.value, u - 1), r.value = Math.min(r.value, A); | ||
}, R = (l, u) => { | ||
const { width: h, height: v } = u; | ||
const U = It(h)[A], tt = Q - U; | ||
return O > tt ? { height: 0, width: 0 } : v; | ||
}, y = (l, f, h, v) => { | ||
const x = v.filter( | ||
(A) => A.classList.contains("draggable") | ||
).length, { distance: b } = G(h); | ||
l[b] == 0 ? r.value = Math.max(r.value, f) : r.value = Math.min(r.value, f - 1), r.value = Math.min(r.value, x); | ||
}, R = (l, f) => { | ||
const { width: h, height: v } = f; | ||
nt(l, v, h); | ||
}, S = (l, u) => { | ||
const { width: h, height: v } = u; | ||
nt(l, v, h), Tt(l, p, Ie); | ||
}, w = (l, u, h, v, A, D) => { | ||
const { droppable: y, droppableScroll: N, config: O } = A, { siblings: L, positionOnDroppable: P } = dt( | ||
}, T = (l, f) => { | ||
const { width: h, height: v } = f; | ||
nt(l, v, h), bt(l, p, qe); | ||
}, w = (l, f, h, v, x, b) => { | ||
const { droppable: A, droppableScroll: N, config: L } = x, { siblings: O, positionOnDroppable: _ } = pt( | ||
l, | ||
y | ||
), U = L.toReversed(); | ||
U.splice(P, 0, l); | ||
const { previousElement: tt, nextElement: st, targetIndex: Z } = z( | ||
A | ||
), k = O.toReversed(); | ||
k.splice(_, 0, l); | ||
const { previousElement: Q, nextElement: rt, targetIndex: U } = z( | ||
l, | ||
P, | ||
U, | ||
y | ||
_, | ||
k, | ||
A | ||
); | ||
h = Dt( | ||
l, | ||
u, | ||
O.direction, | ||
f, | ||
L.direction, | ||
i, | ||
tt, | ||
st | ||
Q, | ||
rt | ||
); | ||
const et = Ft(), rt = Ae( | ||
O.direction, | ||
const tt = kt(), it = Re( | ||
L.direction, | ||
k, | ||
_, | ||
U, | ||
P, | ||
Z, | ||
et, | ||
tt, | ||
N, | ||
v, | ||
y, | ||
A, | ||
l | ||
); | ||
for (const [ft, it] of L.toReversed().entries()) { | ||
for (const [gt, et] of O.toReversed().entries()) { | ||
let ct = h; | ||
Z - 1 >= ft && (ct = { height: 0, width: 0 }), u === Oe && !it.classList.contains(pt) && k( | ||
it, | ||
U - 1 >= gt && (ct = { height: 0, width: 0 }), f === Ve && !et.classList.contains(Bt) && q( | ||
et, | ||
ct, | ||
l, | ||
rt | ||
it | ||
); | ||
} | ||
X( | ||
Z, | ||
U, | ||
l, | ||
O.onInsertEvent, | ||
y, | ||
D | ||
L.onInsertEvent, | ||
A, | ||
b | ||
); | ||
}, z = (l, u, h, v) => { | ||
const D = K(l, v) ? u : r.value, y = () => u < D ? [D, D + 1] : u > D ? [D - 1, D] : [D - 1, D + 1], [N, O] = y(), L = h[N] ?? null, P = h[O] ?? null; | ||
}, z = (l, f, h, v) => { | ||
const b = J(l, v) ? f : r.value, A = () => f < b ? [b, b + 1] : f > b ? [b - 1, b] : [b - 1, b + 1], [N, L] = A(), O = h[N] ?? null, _ = h[L] ?? null; | ||
return { | ||
previousElement: L, | ||
nextElement: P, | ||
targetIndex: D | ||
previousElement: O, | ||
nextElement: _, | ||
targetIndex: b | ||
}; | ||
}, k = (l, u, h, v) => { | ||
nt(l, u.height, u.width), nt( | ||
}, q = (l, f, h, v) => { | ||
nt(l, f.height, f.width), nt( | ||
h, | ||
@@ -635,9 +712,9 @@ v.height, | ||
); | ||
}, X = (l, u, h, v, A) => { | ||
u.classList.add(Bt), W(v), setTimeout(() => { | ||
if (u.classList.remove(Bt), C(i), C(v), A != null) { | ||
const D = g(A); | ||
D && h(l, D); | ||
}, X = (l, f, h, v, x) => { | ||
f.classList.add(wt), W(v), setTimeout(() => { | ||
if (f.classList.remove(wt), Lt(i, p), Lt(v, p), x != null) { | ||
const b = g(x); | ||
b && h(l, b); | ||
} | ||
H(u), Y(u, i), Y(u, v); | ||
Y(f), C(f, i), C(f, v); | ||
}, p); | ||
@@ -647,33 +724,28 @@ }, W = (l) => { | ||
return; | ||
var [u] = i.querySelectorAll(`.${pt}`); | ||
if (!u) | ||
var [f] = i.querySelectorAll(`.${Bt}`); | ||
if (!f) | ||
return; | ||
const { distance: h } = G(a); | ||
Q(u) && (u.style[h] = "0px"); | ||
}, C = (l) => { | ||
var u = l.querySelectorAll(`.${pt}`); | ||
u.forEach((h) => { | ||
l.removeChild(h); | ||
}); | ||
}, Y = (l, u) => { | ||
const { siblings: h } = dt(l, u); | ||
K(f) && (f.style[h] = "0px"); | ||
}, C = (l, f) => { | ||
const { siblings: h } = pt(l, f); | ||
for (const v of [...h, l]) | ||
V(v); | ||
}, V = (l) => { | ||
Q(l) && (l.style.transition = "", l.style.transform = ""); | ||
H(v); | ||
}, H = (l) => { | ||
e.value = $.NOT_DRAGGING, I(l, !1), l.style.transform = "", l.style.transition = "", l.style.top = "", l.style.left = "", n.value = "", o.value = ""; | ||
}, F = (l, u) => { | ||
const h = u.querySelector(f); | ||
h ? h.classList.toggle(Mt, l) : u.classList.toggle(Mt, l); | ||
}, I = (l, u) => { | ||
l.classList.toggle(Be, u), F(u, l); | ||
K(l) && (l.style.transition = "", l.style.transform = ""); | ||
}, Y = (l) => { | ||
e.value = I.NOT_DRAGGING, P(l, !1), l.style.transform = "", l.style.transition = "", l.style.top = "", l.style.left = "", n.value = "", o.value = ""; | ||
}, V = (l, f) => { | ||
const h = f.querySelector(u); | ||
h ? h.classList.toggle(Mt, l) : f.classList.toggle(Mt, l); | ||
}, P = (l, f) => { | ||
l.classList.toggle(We, f), V(f, l); | ||
}; | ||
return { emitEventToSiblings: E, toggleDraggingClass: I }; | ||
return { emitEventToSiblings: E, toggleDraggingClass: P }; | ||
} | ||
const q = class q { | ||
const F = class F { | ||
static addConfig(e, n) { | ||
const o = q.configs.filter( | ||
const o = F.configs.filter( | ||
(i) => !i.droppable.isSameNode(e) | ||
), s = At(e); | ||
), s = yt(e); | ||
o.push({ | ||
@@ -683,12 +755,12 @@ droppable: e, | ||
droppableScroll: s | ||
}), q.configs = o; | ||
}), F.configs = o; | ||
} | ||
static updateScrolls(e, n) { | ||
for (const o of q.configs) { | ||
for (const o of F.configs) { | ||
const { droppable: s } = o; | ||
(n && s.classList.contains(n) || s.isSameNode(e)) && (o.droppableScroll = At(s)); | ||
(n && s.classList.contains(n) || s.isSameNode(e)) && (o.droppableScroll = yt(s)); | ||
} | ||
} | ||
static getConfig(e) { | ||
return q.configs.find( | ||
return F.configs.find( | ||
({ droppable: o }) => o.isSameNode(e) | ||
@@ -698,85 +770,19 @@ ); | ||
}; | ||
gt(q, "configs", []), gt(q, "removeObsoleteConfigs", () => { | ||
const e = q.configs.filter( | ||
dt(F, "configs", []), dt(F, "removeObsoleteConfigs", () => { | ||
const e = F.configs.filter( | ||
({ droppable: n }) => document.contains(n) | ||
); | ||
q.configs = e; | ||
F.configs = e; | ||
}); | ||
let j = q; | ||
const zt = (t, e, n) => { | ||
const o = new MutationObserver((s) => { | ||
s.forEach(() => { | ||
t(o); | ||
}); | ||
}); | ||
o.observe(e, n); | ||
}, bt = "temp-child", ze = "startDrag", Xe = "cubic-bezier(0.2, 0, 0, 1)", We = (t, e, n) => { | ||
let o = Dt( | ||
e, | ||
ze, | ||
n, | ||
t | ||
); | ||
const s = Se(t, n), { distance: i } = G(n); | ||
o[i] -= s; | ||
const { large: r, largeDistance: a } = Ye(n, e); | ||
return o[a] = r, o; | ||
}, Ye = (t, e) => { | ||
const n = t == "horizontal" ? "vertical" : "horizontal", { distance: o } = G(n); | ||
return { | ||
large: e.getBoundingClientRect()[o], | ||
largeDistance: o | ||
}; | ||
}, St = (t, e, n) => { | ||
t.style.height = `${e}px`, t.style.width = `${n}px`, t.style.width = `${n}px`, t.style.minWidth = `${n}px`; | ||
}, Ve = (t, e, n) => (o) => { | ||
e.contains(t) && (St(t, n.height, n.width), o.disconnect()); | ||
}, He = (t, e) => { | ||
if (e != $.START_DRAGGING) | ||
return; | ||
const { droppable: n, config: o, droppableScroll: s } = t, { direction: i } = o, r = ae(o.direction, n, s) > 0.99, { scrollDistance: a, clientDistance: f, scrollElement: g } = G(i); | ||
r && (n[g] = n[a] - n[f]); | ||
}, wt = (t, e, n, o) => { | ||
if (!o) | ||
return; | ||
const { droppable: s, config: i } = o, { direction: r, animationDuration: a } = i; | ||
if (He(o, n), s.querySelector(`.${bt}`) || !t) | ||
return; | ||
var f = document.createElement("div"); | ||
f.classList.add(bt), St(f, 0, 0); | ||
const g = We(s, t, r); | ||
Tt(f, a, Xe, "height, width"), e.isSameNode(s) && St(f, g.height, g.width), zt( | ||
Ve(f, s, g), | ||
s, | ||
{ | ||
childList: !0, | ||
subtree: !0 | ||
} | ||
), s.appendChild(f); | ||
}, Fe = (t, e, n, o) => { | ||
if (n) { | ||
var s = document.querySelectorAll( | ||
`.${n} .${bt}` | ||
); | ||
s.forEach((i) => { | ||
const r = i.parentElement; | ||
if (r != null && r.isSameNode(e) || r != null && r.isSameNode(t)) | ||
return; | ||
const a = i; | ||
a.style.width = "0px", a.style.height = "0px", setTimeout(() => { | ||
var f; | ||
(f = i.parentNode) == null || f.removeChild(i); | ||
}, o); | ||
}); | ||
} | ||
}, Ot = "draggable", at = "handler-class", qe = "dragging-handler-class", ke = "droppable", Ue = "dropping", _t = "drag", Ze = "startDrag", je = "startDrop", Je = "cubic-bezier(0.2, 0, 0, 1)"; | ||
function Ke(t, e, n, o) { | ||
const { handlerSelector: s, isDraggable: i, droppableGroup: r, animationDuration: a } = n, f = r ? `droppable-group-${r}` : null, g = M($.NOT_DRAGGING), p = M(t), E = M({ scrollLeft: 0, scrollTop: 0 }), m = M({ | ||
let Z = F; | ||
const Ot = "draggable", at = "handler-class", Ue = "dragging-handler-class", Ze = "droppable", je = "dropping", _t = "drag", Je = "startDrag", Ke = "startDrop", Qe = "cubic-bezier(0.2, 0, 0, 1)"; | ||
function tn(t, e, n, o) { | ||
const { handlerSelector: s, isDraggable: i, droppableGroup: r, animationDuration: a } = n, u = r ? `droppable-group-${r}` : null, g = M(I.NOT_DRAGGING), p = M(t), E = M({ scrollLeft: 0, scrollTop: 0 }), D = M({ | ||
scrollX: 0, | ||
scrollY: 0 | ||
}), b = M({ pageX: 0, pageY: 0 }), x = M(""), R = M(""), S = M(), w = M(), { setTransform: z, updateTransformState: k } = ue(p), { emitEventToSiblings: X, toggleDraggingClass: W } = Pe( | ||
}), S = M({ pageX: 0, pageY: 0 }), y = M(""), R = M(""), T = M(), w = M(), { setTransform: z, updateTransformState: q } = ge(p), { emitEventToSiblings: X, toggleDraggingClass: W } = ke( | ||
n, | ||
g, | ||
R, | ||
x, | ||
y, | ||
e, | ||
@@ -786,3 +792,3 @@ o | ||
p.value && p.value.classList.add(Ot); | ||
}, Y = () => { | ||
}, H = () => { | ||
if (p.value && i(p.value)) { | ||
@@ -792,4 +798,4 @@ const c = p.value.querySelector(s); | ||
} | ||
}, V = () => { | ||
re(o, [ | ||
}, Y = () => { | ||
ce(o, [ | ||
`.${Ot} { touch-action: manipulation; user-select: none; box-sizing: border-box !important; -webkit-user-select: none; }`, | ||
@@ -801,50 +807,50 @@ `.${at} { cursor: grab; pointer-events: auto !important; }`, | ||
".dragging { position: fixed; z-index: 5000; width: var(--fixedWidth) !important; height: var(--fixedHeight) !important; }", | ||
`.${qe} { cursor: grabbing; cursor: grabbing; }`, | ||
`.${Ue} { pointer-events: none !important; }` | ||
]), Y(), C(), H(); | ||
}, H = () => { | ||
f && o.classList.add(f); | ||
}, F = (c) => { | ||
`.${Ue} { cursor: grabbing; cursor: grabbing; }`, | ||
`.${je} { pointer-events: none !important; }` | ||
]), H(), C(), V(); | ||
}, V = () => { | ||
u && o.classList.add(u); | ||
}, P = (c) => { | ||
const d = (c == null ? void 0 : c.querySelector(`.${at}`)) ?? c; | ||
d && c && i(c) && (Gt( | ||
d && c && i(c) && (At( | ||
d, | ||
"onmousedown", | ||
L("mousemove", "mouseup") | ||
), Gt( | ||
_("mousemove", "mouseup") | ||
), At( | ||
d, | ||
"ontouchstart", | ||
L("touchmove", "touchend") | ||
), I(d)), o.classList.add(ke); | ||
_("touchmove", "touchend") | ||
), l(d)), o.classList.add(Ze); | ||
}; | ||
function I(c) { | ||
function l(c) { | ||
const d = c.querySelectorAll("img"); | ||
Array.from(d).forEach((T) => { | ||
T.onmousedown = () => !1; | ||
Array.from(d).forEach((m) => { | ||
m.onmousedown = () => !1; | ||
}); | ||
} | ||
const l = function(c) { | ||
S.value = y(c), g.value === $.START_DRAGGING ? (wt( | ||
const f = function(c) { | ||
T.value = N(c), g.value === I.START_DRAGGING ? (Nt( | ||
p.value, | ||
o, | ||
g.value, | ||
S.value | ||
), U(c)) : g.value === $.DRAGING && (u(), st(c)); | ||
}, u = () => { | ||
if (!S.value) | ||
T.value | ||
), rt(c)) : g.value === I.DRAGING && (h(), tt(c)); | ||
}, h = () => { | ||
if (!T.value) | ||
return; | ||
const { droppable: c } = S.value; | ||
Fe( | ||
const { droppable: c } = T.value; | ||
Xe( | ||
c, | ||
o, | ||
f, | ||
u, | ||
a | ||
), wt( | ||
), Nt( | ||
p.value, | ||
o, | ||
g.value, | ||
S.value | ||
T.value | ||
); | ||
}, h = (c, d, T) => document.elementsFromPoint(c, d).filter((_) => !_.isSameNode(T)), v = (c, d) => { | ||
}, v = (c, d, m) => document.elementsFromPoint(c, d).filter(($) => !$.isSameNode(m)), x = (c, d) => { | ||
c.hidden = !0; | ||
const [T] = h( | ||
const [m] = v( | ||
d.clientX, | ||
@@ -854,23 +860,23 @@ d.clientY, | ||
); | ||
return c.hidden = !1, !f || !T ? void 0 : T.closest(`.${f}`); | ||
}, A = (c) => Array.from( | ||
document.querySelectorAll(`.${f}`) | ||
return c.hidden = !1, !u || !m ? void 0 : m.closest(`.${u}`); | ||
}, b = (c) => Array.from( | ||
document.querySelectorAll(`.${u}`) | ||
).every( | ||
(T) => K(c, T) | ||
), D = (c, d) => !K(c, d) || A(c), y = (c) => { | ||
var _, J; | ||
(m) => J(c, m) | ||
), A = (c, d) => !J(c, d) || b(c), N = (c) => { | ||
var $, j; | ||
const d = p.value; | ||
if (!d) | ||
return; | ||
if (S.value && D( | ||
if (T.value && A( | ||
d, | ||
(_ = S.value) == null ? void 0 : _.droppable | ||
) || S.value && D( | ||
($ = T.value) == null ? void 0 : $.droppable | ||
) || T.value && A( | ||
d, | ||
(J = S.value) == null ? void 0 : J.droppable | ||
(j = T.value) == null ? void 0 : j.droppable | ||
)) | ||
return S.value; | ||
const T = v(d, c); | ||
return T ? (Q(T) && !T.onscroll && Z(T), j.getConfig(T)) : j.getConfig(o); | ||
}, N = (c) => { | ||
return T.value; | ||
const m = x(d, c); | ||
return m ? (K(m) && !m.onscroll && it(m), Z.getConfig(m)) : Z.getConfig(o); | ||
}, L = (c) => { | ||
if (ht(c) && c.cancelable) | ||
@@ -881,3 +887,3 @@ c.preventDefault(); | ||
const d = vt(c); | ||
l(d); | ||
f(d); | ||
}, O = (c, d) => { | ||
@@ -887,87 +893,95 @@ c == "touchmove" ? w.value = setTimeout(() => { | ||
}, 200) : d(); | ||
}, L = (c, d) => () => { | ||
const T = p.value; | ||
j.updateScrolls(o, f); | ||
const { scrollX: _, scrollY: J } = window; | ||
m.value = { scrollX: _, scrollY: J }, g.value === $.NOT_DRAGGING && (g.value = $.START_DRAGGING, O(c, () => { | ||
document.addEventListener(c, N, { | ||
}, _ = (c, d) => () => { | ||
const m = p.value; | ||
Z.updateScrolls(o, u); | ||
const { scrollX: $, scrollY: j } = window; | ||
D.value = { scrollX: $, scrollY: j }, g.value === I.NOT_DRAGGING && (g.value = I.START_DRAGGING, O(c, () => { | ||
document.addEventListener(c, L, { | ||
passive: !1 | ||
}); | ||
}), Z(o), T && document.addEventListener(d, P(c), { | ||
}), it(o), m && document.addEventListener(d, k(c), { | ||
once: !0 | ||
})); | ||
}, P = (c) => (d) => { | ||
const T = vt(d); | ||
clearTimeout(w.value), ft(), document.removeEventListener(c, N); | ||
const _ = y(T); | ||
if (_) { | ||
const { droppable: J } = _; | ||
J.onscroll = null; | ||
}, k = (c) => (d) => { | ||
const m = vt(d); | ||
clearTimeout(w.value), ct(), document.removeEventListener(c, L); | ||
const $ = N(m); | ||
if ($) { | ||
const { droppable: j } = $; | ||
Q(j); | ||
} | ||
o.onscroll = null; | ||
}, U = (c) => { | ||
}, Q = (c) => { | ||
if (c.onscroll = null, !u) | ||
return; | ||
const d = Array.from( | ||
document.querySelectorAll(`.${u}`) | ||
); | ||
for (const m of d) | ||
m instanceof HTMLElement && (m.onscroll = null); | ||
}, rt = (c) => { | ||
const d = p.value; | ||
d && (tt(), X( | ||
d && (U(), X( | ||
d, | ||
Ze, | ||
m.value, | ||
S.value | ||
), k(c, d), ct(d)); | ||
}, tt = () => { | ||
E.value = Ht(o), g.value = $.DRAGING; | ||
}, st = (c) => { | ||
const { pageX: d, pageY: T } = c; | ||
b.value = { pageX: d, pageY: T }, rt(); | ||
}, Z = (c) => { | ||
ne(c, "onscroll", et); | ||
Je, | ||
D.value, | ||
T.value | ||
), q(c, d), Wt(d)); | ||
}, U = () => { | ||
E.value = qt(o), g.value = I.DRAGING; | ||
}, tt = (c) => { | ||
const { pageX: d, pageY: m } = c; | ||
S.value = { pageX: d, pageY: m }, et(); | ||
}, it = (c) => { | ||
se(c, "onscroll", gt); | ||
}, gt = () => { | ||
et(); | ||
}, et = () => { | ||
rt(); | ||
}, rt = () => { | ||
const c = p.value; | ||
if (b.value.pageX == 0 && b.value.pageY == 0 || !S.value) | ||
if (S.value.pageX == 0 && S.value.pageY == 0 || !T.value) | ||
return; | ||
const { droppable: d, config: T } = S.value; | ||
z(c, d, b, T.direction), X( | ||
const { droppable: d, config: m } = T.value; | ||
z(c, d, S, m.direction), X( | ||
c, | ||
_t, | ||
m.value, | ||
S.value | ||
D.value, | ||
T.value | ||
); | ||
}, ft = () => { | ||
if (g.value !== $.DRAGING) { | ||
g.value = $.NOT_DRAGGING; | ||
}, ct = () => { | ||
if (g.value !== I.DRAGING) { | ||
g.value = I.NOT_DRAGGING; | ||
return; | ||
} | ||
g.value = $.END_DRAGGING; | ||
g.value = I.END_DRAGGING; | ||
const c = p.value; | ||
c && (it(c), X( | ||
c && (Xt(c), X( | ||
c, | ||
je, | ||
m.value, | ||
S.value, | ||
Ke, | ||
D.value, | ||
T.value, | ||
e | ||
)); | ||
}, it = (c) => { | ||
Tt(c, a, Je), nt(c, 0, 0); | ||
}, ct = (c) => { | ||
const { height: d, width: T } = c.getBoundingClientRect(); | ||
R.value = `${d}px`, x.value = `${T}px`, W(c, !0), c.style.transition = ""; | ||
}, xt = (c, d) => { | ||
ot(c, (T) => { | ||
const _ = p.value; | ||
_ && _.style.setProperty(d, T); | ||
}, Xt = (c) => { | ||
bt(c, a, Qe), nt(c, 0, 0); | ||
}, Wt = (c) => { | ||
const { height: d, width: m } = c.getBoundingClientRect(); | ||
R.value = `${d}px`, y.value = `${m}px`, W(c, !0), c.style.transition = ""; | ||
}, Tt = (c, d) => { | ||
ot(c, (m) => { | ||
const $ = p.value; | ||
$ && $.style.setProperty(d, m); | ||
}); | ||
}; | ||
ot(S, (c, d) => { | ||
p.value && d && g.value == $.DRAGING && !(c != null && c.droppable.isSameNode(d.droppable)) && X( | ||
ot(T, (c, d) => { | ||
p.value && d && g.value == I.DRAGING && !(c != null && c.droppable.isSameNode(d.droppable)) && X( | ||
p.value, | ||
_t, | ||
m.value, | ||
D.value, | ||
d | ||
); | ||
}, { deep: !0 }), xt(x, "--fixedWidth"), xt(R, "--fixedHeight"), V(), F(p.value); | ||
}, { deep: !0 }), Tt(y, "--fixedWidth"), Tt(R, "--fixedHeight"), Y(), P(p.value); | ||
} | ||
const Qe = "vertical", $t = (t, e, n) => { | ||
const en = "vertical", $t = (t, e, n) => { | ||
const o = { | ||
direction: Qe, | ||
direction: en, | ||
handlerSelector: "draggable", | ||
@@ -989,10 +1003,10 @@ isDraggable: () => !0, | ||
}; | ||
function on(t, e) { | ||
const n = "index", o = M(), s = (m) => (b) => Yt(m, b), i = (m) => (b, x) => Vt(m, b, x), r = s(t), a = i(t), f = () => { | ||
function rn(t, e) { | ||
const n = "index", o = M(), s = (D) => (S) => Ht(D, S), i = (D) => (S, y) => Ft(D, S, y), r = s(t), a = i(t), u = () => { | ||
if (o.value) | ||
for (const m of o.value.children) { | ||
const b = m.getAttribute(n), x = qt(b), R = m; | ||
R && x >= 0 && Ke( | ||
for (const D of o.value.children) { | ||
const S = D.getAttribute(n), y = Ut(S), R = D; | ||
R && y >= 0 && tn( | ||
R, | ||
x, | ||
y, | ||
$t(r, a, e), | ||
@@ -1005,3 +1019,3 @@ o.value | ||
() => { | ||
f(); | ||
u(); | ||
}, | ||
@@ -1014,3 +1028,3 @@ o.value, | ||
}, E = () => { | ||
o.value && j.addConfig( | ||
o.value && Z.addConfig( | ||
o.value, | ||
@@ -1021,7 +1035,7 @@ $t(r, a, e) | ||
return ot(o, () => { | ||
p(), E(), g(), f(), j.removeObsoleteConfigs(); | ||
p(), E(), g(), u(), Z.removeObsoleteConfigs(); | ||
}), { parent: o }; | ||
} | ||
export { | ||
on as useDragAndDrop | ||
rn as useDragAndDrop | ||
}; |
{ | ||
"name": "vue-fluid-dnd", | ||
"version": "0.6.17", | ||
"version": "0.6.18", | ||
"description": "A Vue 3 drag and drop library to sort all kind of lists", | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
64713
1327