fluid-dnd 1.0.8-beta.0 → 1.1.0-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-DiASUxtT.cjs → HandlerPublisher-CaFG_170.cjs} +1 -1
- package/dist/{HandlerPublisher-Bp-hKsuU.js → HandlerPublisher-CdjuhrMS.js} +1 -1
- package/dist/core/index.d.ts +6 -0
- package/dist/core/utils/config.d.ts +3 -1
- package/dist/core/utils/droppableConfigurator.d.ts +13 -2
- package/dist/core/utils/observer.d.ts +1 -1
- package/dist/core/utils/tempChildren.d.ts +1 -0
- package/dist/core/utils/touchDevice.d.ts +1 -1
- package/dist/index/index.cjs +1 -1
- package/dist/index/index.mjs +1 -1
- package/dist/index-BUdB26zt.cjs +1 -0
- package/dist/index-Cj5Hg1w9.js +1279 -0
- package/dist/svelte/index.cjs +1 -1
- package/dist/svelte/index.mjs +2 -2
- package/dist/vue/index.cjs +1 -1
- package/dist/vue/index.mjs +2 -2
- package/package.json +4 -5
- package/dist/index-TH8hx6fO.cjs +0 -1
- package/dist/index-WuPwAM50.js +0 -1253
@@ -0,0 +1,1279 @@
|
|
1
|
+
var Se = Object.defineProperty;
|
2
|
+
var De = (t, e, n) => e in t ? Se(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
3
|
+
var k = (t, e, n) => De(t, typeof e != "symbol" ? e + "" : e, n);
|
4
|
+
const Q = "draggable", It = "droppable", Ot = "handler-class", Ht = "dragging", Yt = "dragging-handler-class", Wt = "dropping", se = "grabbing", ve = "grab", Zt = "disable-transition", et = (t, e) => t.classList.contains(e), bt = (t, e, n = !1) => {
|
5
|
+
t.classList.toggle(e, n);
|
6
|
+
}, nt = (t, e) => {
|
7
|
+
t.classList.add(e);
|
8
|
+
}, yt = (t, e) => {
|
9
|
+
t.classList.remove(e);
|
10
|
+
}, be = (t, e) => Ct(e).every(
|
11
|
+
(n) => et(t, n)
|
12
|
+
), dt = (t) => t ? `.${Ct(t).join(".")}` : "", Te = (t, e) => {
|
13
|
+
if (!e)
|
14
|
+
return;
|
15
|
+
const n = Ct(e);
|
16
|
+
t.classList.add(...n);
|
17
|
+
}, Ct = (t) => t ? t.split(" ").filter((e) => e) : [], _ = "horizontal", U = "vertical", Ee = () => {
|
18
|
+
const { scrollX: t, scrollY: e } = window;
|
19
|
+
return { scrollX: t, scrollY: e };
|
20
|
+
}, qt = (t) => !t || t.trim().length == 0 || t == "normal" ? 0 : parseFloat(t), ye = (t) => t ? parseInt(t) : -1, Ce = (t) => {
|
21
|
+
const e = getComputedStyle(t), n = new DOMMatrixReadOnly(e.transform);
|
22
|
+
return {
|
23
|
+
x: n.m41,
|
24
|
+
y: n.m42
|
25
|
+
};
|
26
|
+
}, 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, gt = (t, e) => !Ae(t, e), Ae = (t, e) => {
|
27
|
+
const n = Mt(t), s = Mt(e), o = Jt(n, s, U), r = Jt(n, s, _);
|
28
|
+
return o >= Math.min(n.height, s.height) / 2 && r >= Math.min(n.width, s.width) / 2;
|
29
|
+
}, Jt = (t, e, n) => {
|
30
|
+
const { before: s, distance: o } = w(n);
|
31
|
+
return oe(
|
32
|
+
{
|
33
|
+
x1: t[s],
|
34
|
+
x2: t[s] + t[o]
|
35
|
+
},
|
36
|
+
{
|
37
|
+
x1: e[s],
|
38
|
+
x2: e[s] + e[o]
|
39
|
+
}
|
40
|
+
);
|
41
|
+
}, L = (t, e) => t ? qt(getComputedStyle(t)[e]) : 0, Kt = (t) => {
|
42
|
+
const { scrollLeft: e, scrollTop: n } = t;
|
43
|
+
return { scrollLeft: e, scrollTop: n };
|
44
|
+
}, Mt = (t) => t.getBoundingClientRect(), w = (t) => {
|
45
|
+
const e = t == _;
|
46
|
+
return {
|
47
|
+
beforeMargin: e ? "marginLeft" : "marginTop",
|
48
|
+
afterMargin: e ? "marginRight" : "marginBottom",
|
49
|
+
borderBeforeWidth: e ? "borderLeftWidth" : "borderTopWidth",
|
50
|
+
before: e ? "left" : "top",
|
51
|
+
after: e ? "right" : "down",
|
52
|
+
gap: e ? "columnGap" : "rowGap",
|
53
|
+
distance: e ? "width" : "height",
|
54
|
+
axis: e ? "x" : "y",
|
55
|
+
offset: e ? "offsetX" : "offsetY",
|
56
|
+
scroll: e ? "scrollX" : "scrollY",
|
57
|
+
scrollElement: e ? "scrollLeft" : "scrollTop",
|
58
|
+
page: e ? "pageX" : "pageY",
|
59
|
+
inner: e ? "innerWidth" : "innerHeight",
|
60
|
+
offsetElement: e ? "offsetLeft" : "offsetTop",
|
61
|
+
scrollDistance: e ? "scrollWidth" : "scrollHeight",
|
62
|
+
clientDistance: e ? "clientWidth" : "clientHeight",
|
63
|
+
paddingBefore: e ? "paddingLeft" : "paddingTop",
|
64
|
+
getRect: Mt
|
65
|
+
};
|
66
|
+
}, Rt = (t, e) => xe(t, e), re = (t) => [...t.children].filter(
|
67
|
+
(n) => et(n, Q)
|
68
|
+
), xe = (t, e) => {
|
69
|
+
const n = [...e.children].filter(
|
70
|
+
(o) => et(o, Q) && !o.isEqualNode(t)
|
71
|
+
).toReversed(), s = [...e.children].findLastIndex(
|
72
|
+
(o) => o.isEqualNode(t)
|
73
|
+
);
|
74
|
+
return [
|
75
|
+
n,
|
76
|
+
s,
|
77
|
+
e
|
78
|
+
];
|
79
|
+
}, we = (t) => {
|
80
|
+
let e = t.parentElement;
|
81
|
+
for (; e; ) {
|
82
|
+
if (window.getComputedStyle(e).position === "fixed")
|
83
|
+
return e;
|
84
|
+
e = e.parentElement;
|
85
|
+
}
|
86
|
+
return null;
|
87
|
+
}, ie = (t, e) => {
|
88
|
+
const {
|
89
|
+
before: n,
|
90
|
+
borderBeforeWidth: s
|
91
|
+
} = w(e), o = we(t);
|
92
|
+
return o ? Mt(o)[n] + L(o, s) : 0;
|
93
|
+
}, Xt = (t) => window.TouchEvent && t instanceof TouchEvent, it = (t) => t instanceof HTMLElement, ce = (t) => t instanceof MouseEvent, Be = ["onmouseup", "onmousedown", "onmousemove"], Re = (t, e, n) => {
|
94
|
+
t && (t.style.height = `${e}px`, t.style.width = `${n}px`);
|
95
|
+
}, Tt = (t, e, n) => {
|
96
|
+
!t || !it(t) || (n == 0 && e == 0 ? t.style.transform = "" : t.style.transform = `translate(${n}px,${e}px)`);
|
97
|
+
}, Le = (t, e, n) => {
|
98
|
+
t[e] = (s) => {
|
99
|
+
if (s.defaultPrevented)
|
100
|
+
return;
|
101
|
+
const o = Vt(s);
|
102
|
+
n(o);
|
103
|
+
};
|
104
|
+
}, $t = (t, e, n) => {
|
105
|
+
n && (Oe(e) ? t[e] = n : Le(t, e, n));
|
106
|
+
}, Oe = (t) => Be.includes(t), Me = (t) => {
|
107
|
+
const { target: e } = t;
|
108
|
+
return {
|
109
|
+
clientX: 0,
|
110
|
+
clientY: 0,
|
111
|
+
pageX: 0,
|
112
|
+
pageY: 0,
|
113
|
+
screenX: 0,
|
114
|
+
screenY: 0,
|
115
|
+
target: e,
|
116
|
+
offsetX: 0,
|
117
|
+
offsetY: 0
|
118
|
+
};
|
119
|
+
}, Fe = (t, e) => {
|
120
|
+
const n = (s, o) => Pe(e, window, o, s);
|
121
|
+
if (ce(t)) {
|
122
|
+
const { offsetX: s, offsetY: o } = t;
|
123
|
+
return [s, o];
|
124
|
+
} else {
|
125
|
+
const s = t.target;
|
126
|
+
return [
|
127
|
+
n(s, _),
|
128
|
+
n(s, U)
|
129
|
+
];
|
130
|
+
}
|
131
|
+
}, Vt = (t) => {
|
132
|
+
const e = Ne(t);
|
133
|
+
if (!e)
|
134
|
+
return Me(t);
|
135
|
+
const [n, s] = Fe(t, e), { clientX: o, clientY: r, pageX: c, pageY: l, screenX: u, screenY: d, target: m } = e;
|
136
|
+
return {
|
137
|
+
clientX: o,
|
138
|
+
clientY: r,
|
139
|
+
pageX: c,
|
140
|
+
pageY: l,
|
141
|
+
screenX: u,
|
142
|
+
screenY: d,
|
143
|
+
target: m,
|
144
|
+
offsetX: n,
|
145
|
+
offsetY: s
|
146
|
+
};
|
147
|
+
}, Ne = (t) => {
|
148
|
+
if (Xt(t))
|
149
|
+
return t.touches[0] ?? t.changedTouches[0];
|
150
|
+
if (ce(t))
|
151
|
+
return t;
|
152
|
+
}, Pe = (t, e, n, s) => {
|
153
|
+
const { page: o, scroll: r, before: c, borderBeforeWidth: l, getRect: u } = w(n), d = u(s);
|
154
|
+
return t[o] - e[r] - d[c] - L(s, l);
|
155
|
+
}, Nt = (t, e, n = "ease-out", s = "transform") => {
|
156
|
+
it(t) && (t.style.transitionDuration = `${e}ms`, t.style.transitionTimingFunction = `${n}`, t.style.transitionProperty = `${s}`);
|
157
|
+
}, ae = (t, e, n) => {
|
158
|
+
!t || !it(t) || (t[e] = () => {
|
159
|
+
n();
|
160
|
+
});
|
161
|
+
}, $e = (t) => {
|
162
|
+
var e = t.querySelector("style");
|
163
|
+
if (!e) {
|
164
|
+
var n = document.createElement("style");
|
165
|
+
return t.appendChild(n), n;
|
166
|
+
}
|
167
|
+
return e;
|
168
|
+
}, Ge = (t, e) => {
|
169
|
+
const n = /\.-?[_a-zA-Z0-9-*\s<>():]+/g, [s] = e.match(n) || [];
|
170
|
+
for (const o of t.cssRules) {
|
171
|
+
const [r] = o.cssText.match(n) || [];
|
172
|
+
if (s === r)
|
173
|
+
return !0;
|
174
|
+
}
|
175
|
+
return !1;
|
176
|
+
}, Ie = (t, e) => {
|
177
|
+
e.forEach((n) => {
|
178
|
+
Ye(t, n);
|
179
|
+
});
|
180
|
+
}, Ye = (t, e) => {
|
181
|
+
var s;
|
182
|
+
var n = $e(t);
|
183
|
+
n.sheet && (Ge(n.sheet, e) || (s = n.sheet) == null || s.insertRule(e, n.sheet.cssRules.length));
|
184
|
+
}, le = (t, e = {}) => {
|
185
|
+
for (const n of Object.keys(e)) {
|
186
|
+
const s = e[n];
|
187
|
+
s != null && We(t, `--${n}`, s);
|
188
|
+
}
|
189
|
+
}, We = (t, e, n) => t && t.style.setProperty(e, n), ue = "startDrag", Ft = "drag", zt = "startDrop", Xe = "drop", at = "temp-child", fe = "cubic-bezier(0.2, 0, 0, 1)", Ve = (t) => t === Xe || t === zt, _t = (t) => !t || t.length == 0 ? 0 : qt(t.replace("px", "")), _e = (t, e) => {
|
190
|
+
const n = getComputedStyle(t)[e];
|
191
|
+
if (n.match("%")) {
|
192
|
+
const o = qt(n.replace("%", "")), { width: r } = t.getBoundingClientRect();
|
193
|
+
return r * (o / 100);
|
194
|
+
}
|
195
|
+
return _t(n);
|
196
|
+
}, jt = (t, e) => {
|
197
|
+
if (!(t instanceof Element))
|
198
|
+
return [
|
199
|
+
0,
|
200
|
+
!1
|
201
|
+
];
|
202
|
+
const n = _e(t, e), s = getComputedStyle(t).display, o = n > 0 || s === "flex";
|
203
|
+
return [n, o];
|
204
|
+
}, He = (t) => {
|
205
|
+
const { top: e, left: n } = getComputedStyle(t);
|
206
|
+
return [_t(e), _t(n)];
|
207
|
+
}, qe = (t, e) => {
|
208
|
+
const { gap: n } = w(e), [s, o] = jt(t, n);
|
209
|
+
return o ? s : 0;
|
210
|
+
};
|
211
|
+
function Et(t, e, n, s, o = t.previousElementSibling, r = t.nextElementSibling) {
|
212
|
+
let { height: c, width: l } = ze(
|
213
|
+
n,
|
214
|
+
t,
|
215
|
+
o,
|
216
|
+
r
|
217
|
+
);
|
218
|
+
return gt(t, s) && e == Ft && (c = 0, l = 0), { height: c, width: l };
|
219
|
+
}
|
220
|
+
const ze = (t, e, n, s) => {
|
221
|
+
const {
|
222
|
+
afterMargin: o,
|
223
|
+
beforeMargin: r,
|
224
|
+
distance: c,
|
225
|
+
gap: l,
|
226
|
+
getRect: u
|
227
|
+
} = w(t), d = L(e, o), m = L(e, r), v = L(s, r), [B, O] = jt(
|
228
|
+
e.parentElement,
|
229
|
+
l
|
230
|
+
), N = u(e)[c];
|
231
|
+
if (O)
|
232
|
+
return Qt(N, m, d, B, 0, t);
|
233
|
+
const [h, S, C] = je(
|
234
|
+
n,
|
235
|
+
v,
|
236
|
+
d,
|
237
|
+
m,
|
238
|
+
o
|
239
|
+
);
|
240
|
+
return Qt(N, S, h, 0, C, t);
|
241
|
+
}, je = (t, e, n, s, o) => {
|
242
|
+
const r = Math.max(e, n);
|
243
|
+
let c = s, l = e;
|
244
|
+
if (t) {
|
245
|
+
const u = L(
|
246
|
+
t,
|
247
|
+
o
|
248
|
+
);
|
249
|
+
c = Math.max(u, s), l = Math.max(l, u);
|
250
|
+
}
|
251
|
+
return [r, c, l];
|
252
|
+
}, Qt = (t, e, n, s, o, r) => ke(r, t + e + n + s - o), ke = (t, e) => t == _ ? { width: e, height: 0 } : { width: 0, height: e }, Ut = (t, e) => {
|
253
|
+
const {
|
254
|
+
borderBeforeWidth: n,
|
255
|
+
paddingBefore: s,
|
256
|
+
axis: o,
|
257
|
+
getRect: r
|
258
|
+
} = w(t), c = L(e, n), l = L(e, s), u = r(e)[o];
|
259
|
+
return c + l + u;
|
260
|
+
}, Ze = (t, e) => {
|
261
|
+
const [n, s] = He(e), o = Ut(U, t);
|
262
|
+
return [
|
263
|
+
Ut(_, t) - s,
|
264
|
+
o - n
|
265
|
+
];
|
266
|
+
};
|
267
|
+
function Je(t, e, n, s, o, r, c, l, u) {
|
268
|
+
let d = 0, m = 0;
|
269
|
+
const v = !!(n < 0 && u);
|
270
|
+
if (n === s && !v)
|
271
|
+
return te(
|
272
|
+
{ height: d, width: m },
|
273
|
+
t,
|
274
|
+
o,
|
275
|
+
c,
|
276
|
+
v
|
277
|
+
);
|
278
|
+
const [B, O, N, h] = Ue(e, n, s, u);
|
279
|
+
if (v) {
|
280
|
+
const [tt, ot] = Ze(l, u);
|
281
|
+
d += ot, m += tt;
|
282
|
+
}
|
283
|
+
const {
|
284
|
+
scrollElement: S,
|
285
|
+
beforeMargin: C,
|
286
|
+
afterMargin: R,
|
287
|
+
distance: I,
|
288
|
+
gap: Y
|
289
|
+
} = w(t), [W, P] = jt(l, Y), [
|
290
|
+
st,
|
291
|
+
H,
|
292
|
+
F
|
293
|
+
] = en(
|
294
|
+
C,
|
295
|
+
R,
|
296
|
+
B,
|
297
|
+
O == null ? void 0 : O.previousElementSibling,
|
298
|
+
h,
|
299
|
+
P,
|
300
|
+
v
|
301
|
+
), [Z, q, z] = tn(
|
302
|
+
C,
|
303
|
+
R,
|
304
|
+
I,
|
305
|
+
N,
|
306
|
+
W,
|
307
|
+
P
|
308
|
+
), X = Qe(
|
309
|
+
q,
|
310
|
+
Z,
|
311
|
+
z,
|
312
|
+
H,
|
313
|
+
st,
|
314
|
+
W
|
315
|
+
), j = v ? l[S] : Ke(S, l, r), $ = (h ? X - F : F - X) - j;
|
316
|
+
return t === U ? d += $ : t === _ && (m += $), te(
|
317
|
+
{ height: d, width: m },
|
318
|
+
t,
|
319
|
+
o,
|
320
|
+
c,
|
321
|
+
v
|
322
|
+
);
|
323
|
+
}
|
324
|
+
const Ke = (t, e, n) => {
|
325
|
+
const s = e[t], o = n[t];
|
326
|
+
return s - o;
|
327
|
+
}, Qe = (t, e, n, s, o, r) => {
|
328
|
+
const c = Math.max(e, o);
|
329
|
+
return Math.max(n, s) + t + c + r;
|
330
|
+
}, Ue = (t, e, n, s) => {
|
331
|
+
const o = e < n, [r, c] = [e, n].toSorted(
|
332
|
+
(m, v) => m - v
|
333
|
+
), l = t[e] ?? s, u = t[n];
|
334
|
+
let d = o ? t.slice(r + 1, c + 1) : t.slice(r, c);
|
335
|
+
return r < 0 && s && (d = t.slice(r + 1, c)), [
|
336
|
+
l,
|
337
|
+
u,
|
338
|
+
d,
|
339
|
+
o
|
340
|
+
];
|
341
|
+
}, tn = (t, e, n, s, o, r) => {
|
342
|
+
if (s.length == 0)
|
343
|
+
return [0, 0, 0];
|
344
|
+
const c = L(s[0], t);
|
345
|
+
let l = 0, u = -c;
|
346
|
+
for (const [d, m] of s.entries()) {
|
347
|
+
const v = m.getBoundingClientRect()[n], B = L(m, t);
|
348
|
+
r && (l += B), r && d > 0 ? l += o : l = Math.max(l, B), u += l + v, l = L(m, e);
|
349
|
+
}
|
350
|
+
return [c, u, l];
|
351
|
+
}, te = (t, e, n, s, o) => {
|
352
|
+
const { scroll: r, distance: c } = w(e), l = window[r], u = n[r], d = o ? 0 : u - 2 * l + s[r];
|
353
|
+
return t[c] += d, t;
|
354
|
+
}, en = (t, e, n, s, o, r, c) => {
|
355
|
+
const l = o ? n.previousElementSibling : s;
|
356
|
+
return nn(
|
357
|
+
t,
|
358
|
+
e,
|
359
|
+
l,
|
360
|
+
n,
|
361
|
+
r,
|
362
|
+
c
|
363
|
+
);
|
364
|
+
}, nn = (t, e, n, s, o, r) => {
|
365
|
+
if (o)
|
366
|
+
return [0, 0, 0];
|
367
|
+
const c = L(
|
368
|
+
r ? null : n,
|
369
|
+
e
|
370
|
+
), l = L(s, t);
|
371
|
+
let u = Math.max(c, l);
|
372
|
+
return [c, l, u];
|
373
|
+
}, kt = (t, e, n, s = () => !0) => {
|
374
|
+
const o = new MutationObserver((r) => {
|
375
|
+
if (r = r.filter(s), r.length > 0) {
|
376
|
+
const c = r[0];
|
377
|
+
t(o, c);
|
378
|
+
}
|
379
|
+
});
|
380
|
+
return o.observe(e, n), o;
|
381
|
+
}, sn = (t, e, n) => {
|
382
|
+
n != 0 && (e === "vertical" ? t.scrollBy(0, n) : t.scrollBy(n, 0));
|
383
|
+
}, on = (t, e, n) => {
|
384
|
+
const { scrollDistance: s, clientDistance: o, scrollElement: r } = w(t);
|
385
|
+
return n[r] / (e[s] - e[o]);
|
386
|
+
}, rn = "startDrag", de = "cubic-bezier(0.2, 0, 0, 1)", ge = 50, ee = (t) => it(t) ? t.classList.contains(at) : !1, cn = (t, e, n) => {
|
387
|
+
let s = Et(
|
388
|
+
e,
|
389
|
+
rn,
|
390
|
+
n,
|
391
|
+
t
|
392
|
+
);
|
393
|
+
const o = qe(t, n), { distance: r } = w(n);
|
394
|
+
s[r] -= o;
|
395
|
+
const [c, l] = an(n, e);
|
396
|
+
return s[l] = c, s;
|
397
|
+
}, an = (t, e) => {
|
398
|
+
const n = t == _ ? U : _, { distance: s, getRect: o } = w(n);
|
399
|
+
return [
|
400
|
+
o(e)[s],
|
401
|
+
s
|
402
|
+
];
|
403
|
+
}, ht = (t, e, n) => {
|
404
|
+
Re(t, e, n), t.style.minWidth = `${n}px`;
|
405
|
+
}, ln = (t, e, n) => (s) => {
|
406
|
+
e.contains(t) && (ht(t, n.height, n.width), s.disconnect());
|
407
|
+
}, un = (t, e) => {
|
408
|
+
if (!e)
|
409
|
+
return;
|
410
|
+
const { droppable: n, config: s, scroll: o } = t, { direction: r } = s, c = on(s.direction, n, o) > 0.99, { scrollDistance: l, clientDistance: u, scrollElement: d } = w(r);
|
411
|
+
c && (n[d] = n[l] - n[u]);
|
412
|
+
}, pe = (t, e, n, s) => {
|
413
|
+
if (!n)
|
414
|
+
return;
|
415
|
+
const { droppable: o, config: r } = n, { direction: c, animationDuration: l } = r;
|
416
|
+
if (un(n, e), o.querySelector(`.${at}`) || !t)
|
417
|
+
return;
|
418
|
+
var u = t.tagName == "LI" ? "DIV" : t.tagName, d = document.createElement(u);
|
419
|
+
nt(d, at), ht(d, 0, 0);
|
420
|
+
const m = cn(o, t, c);
|
421
|
+
return Nt(
|
422
|
+
d,
|
423
|
+
l,
|
424
|
+
de,
|
425
|
+
"width, min-width, height"
|
426
|
+
), [d, m, o];
|
427
|
+
}, Gt = (t, e, n, s, o) => {
|
428
|
+
const r = pe(t, n, s);
|
429
|
+
if (!r)
|
430
|
+
return;
|
431
|
+
const [c, l, u] = r;
|
432
|
+
e.isSameNode(u) && ht(c, l.height, l.width), kt(
|
433
|
+
ln(c, u, l),
|
434
|
+
u,
|
435
|
+
{
|
436
|
+
childList: !0,
|
437
|
+
subtree: !0
|
438
|
+
}
|
439
|
+
), u.appendChild(c);
|
440
|
+
}, fn = (t, e, n) => {
|
441
|
+
const s = pe(t, e, n);
|
442
|
+
if (!s)
|
443
|
+
return;
|
444
|
+
const [o, r, c] = s;
|
445
|
+
c.appendChild(o), dn(o, r);
|
446
|
+
}, dn = (t, e) => requestAnimationFrame(() => {
|
447
|
+
ht(t, e.height, e.width), requestAnimationFrame(() => {
|
448
|
+
Nt(
|
449
|
+
t,
|
450
|
+
0,
|
451
|
+
de,
|
452
|
+
"width, min-width, height"
|
453
|
+
);
|
454
|
+
});
|
455
|
+
}), gn = (t, e, n, s, o = !0) => {
|
456
|
+
if (n) {
|
457
|
+
var r = document.querySelectorAll(
|
458
|
+
`${dt(n)} > .${at}`
|
459
|
+
);
|
460
|
+
r.forEach((c) => {
|
461
|
+
const l = c.parentElement;
|
462
|
+
if (l != null && l.isSameNode(e) || !o && (l != null && l.isSameNode(t)))
|
463
|
+
return;
|
464
|
+
ht(c, 0, 0), setTimeout(() => {
|
465
|
+
var d;
|
466
|
+
(d = c.parentNode) == null || d.removeChild(c);
|
467
|
+
}, s + ge);
|
468
|
+
});
|
469
|
+
}
|
470
|
+
}, vt = (t, e, n = !1) => {
|
471
|
+
var s = t.querySelectorAll(`.${at}`);
|
472
|
+
s.forEach((o) => {
|
473
|
+
const r = o;
|
474
|
+
n ? (ht(r, 0, 0), setTimeout(() => {
|
475
|
+
t.contains(r) && t.removeChild(r);
|
476
|
+
}, e + ge)) : t.removeChild(o);
|
477
|
+
});
|
478
|
+
}, pn = 50;
|
479
|
+
function hn(t, e, n, s, o, r) {
|
480
|
+
let c = e;
|
481
|
+
const {
|
482
|
+
direction: l,
|
483
|
+
handlerSelector: u,
|
484
|
+
onRemoveAtEvent: d,
|
485
|
+
animationDuration: m,
|
486
|
+
delayBeforeInsert: v,
|
487
|
+
draggingClass: B
|
488
|
+
} = t, O = (i, f, g, D, y) => {
|
489
|
+
if (!D)
|
490
|
+
return;
|
491
|
+
const { droppable: b, config: T } = D, A = Et(
|
492
|
+
i,
|
493
|
+
f,
|
494
|
+
T.direction,
|
495
|
+
b
|
496
|
+
);
|
497
|
+
Ve(f) ? P(
|
498
|
+
i,
|
499
|
+
f,
|
500
|
+
A,
|
501
|
+
g,
|
502
|
+
D,
|
503
|
+
y
|
504
|
+
) : C(
|
505
|
+
i,
|
506
|
+
f,
|
507
|
+
A,
|
508
|
+
D
|
509
|
+
);
|
510
|
+
}, N = (i, f, g, D, y) => {
|
511
|
+
const b = Et(
|
512
|
+
f,
|
513
|
+
"insert",
|
514
|
+
t.direction,
|
515
|
+
g
|
516
|
+
), { onInsertEvent: T } = t, A = re(g);
|
517
|
+
for (const [M, x] of A.entries())
|
518
|
+
et(x, Q) && M >= i && W(x, b);
|
519
|
+
y(), setTimeout(() => {
|
520
|
+
T(i, D), vt(n, 0, !0), he(i, g, t), tt(f), V(f, n);
|
521
|
+
}, v);
|
522
|
+
}, h = (i, f, g, D) => {
|
523
|
+
if (!g || !g.droppable || !g.config)
|
524
|
+
return;
|
525
|
+
const { droppable: y, config: b } = g;
|
526
|
+
let [T] = Rt(f, y);
|
527
|
+
T = [f, ...T].toReversed();
|
528
|
+
const A = Et(
|
529
|
+
f,
|
530
|
+
"remove",
|
531
|
+
b.direction,
|
532
|
+
y
|
533
|
+
);
|
534
|
+
for (const [M, x] of T.entries())
|
535
|
+
M >= i && (Y(x, A), setTimeout(() => {
|
536
|
+
D(x);
|
537
|
+
}, m));
|
538
|
+
}, S = (i) => {
|
539
|
+
vt(n, m, !0), setTimeout(() => {
|
540
|
+
tt(i), V(i, n);
|
541
|
+
}, m);
|
542
|
+
}, C = (i, f, g, D) => {
|
543
|
+
const { config: y, droppable: b } = D, [T] = Rt(i, b), A = gt(i, b);
|
544
|
+
T.length == 0 && I(
|
545
|
+
g,
|
546
|
+
1,
|
547
|
+
y.direction,
|
548
|
+
T
|
549
|
+
);
|
550
|
+
for (const [M, x] of T.entries()) {
|
551
|
+
if (!et(x, Q))
|
552
|
+
continue;
|
553
|
+
const G = R(
|
554
|
+
y.direction,
|
555
|
+
i,
|
556
|
+
x,
|
557
|
+
g
|
558
|
+
);
|
559
|
+
if (!A && G)
|
560
|
+
g = G;
|
561
|
+
else if (!A)
|
562
|
+
continue;
|
563
|
+
const J = T.length - M;
|
564
|
+
I(
|
565
|
+
g,
|
566
|
+
J,
|
567
|
+
y.direction,
|
568
|
+
T
|
569
|
+
), f === ue ? Y(x, g) : f === Ft && W(x, g);
|
570
|
+
}
|
571
|
+
}, R = (i, f, g, D) => {
|
572
|
+
const { before: y, distance: b, axis: T, getRect: A } = w(i), M = A(f), x = A(g), G = M[y], J = x[y], ut = x[b], mt = J + ut / 2, St = Ce(g)[T], ct = mt - St;
|
573
|
+
return G > ct ? { height: 0, width: 0 } : D;
|
574
|
+
}, I = (i, f, g, D) => {
|
575
|
+
const y = D.filter(
|
576
|
+
(T) => et(T, Q)
|
577
|
+
).length, { distance: b } = w(g);
|
578
|
+
i[b] == 0 ? c = Math.max(c, f) : c = Math.min(c, f - 1), c = Math.min(c, y);
|
579
|
+
}, Y = (i, f) => {
|
580
|
+
const { width: g, height: D } = f;
|
581
|
+
Tt(i, D, g);
|
582
|
+
}, W = (i, f) => {
|
583
|
+
const { width: g, height: D } = f;
|
584
|
+
Tt(i, D, g), Nt(i, m, fe);
|
585
|
+
}, P = (i, f, g, D, y, b) => {
|
586
|
+
const { droppable: T, scroll: A, config: M } = y, [x, G] = Rt(
|
587
|
+
i,
|
588
|
+
T
|
589
|
+
), J = x.toReversed(), ut = G === -1 ? J.length : G;
|
590
|
+
J.splice(ut, 0, i);
|
591
|
+
const [mt, St, ct] = st(
|
592
|
+
i,
|
593
|
+
G,
|
594
|
+
J,
|
595
|
+
T
|
596
|
+
);
|
597
|
+
g = Et(
|
598
|
+
i,
|
599
|
+
f,
|
600
|
+
M.direction,
|
601
|
+
n,
|
602
|
+
mt,
|
603
|
+
St
|
604
|
+
);
|
605
|
+
const Pt = Ee(), At = Je(
|
606
|
+
M.direction,
|
607
|
+
J,
|
608
|
+
G,
|
609
|
+
ct,
|
610
|
+
Pt,
|
611
|
+
A,
|
612
|
+
D,
|
613
|
+
T,
|
614
|
+
i
|
615
|
+
);
|
616
|
+
x.length == 0 && H(
|
617
|
+
void 0,
|
618
|
+
g,
|
619
|
+
i,
|
620
|
+
At
|
621
|
+
);
|
622
|
+
for (const [xt, wt] of x.toReversed().entries()) {
|
623
|
+
let Bt = g;
|
624
|
+
ct - 1 >= xt && (Bt = { height: 0, width: 0 }), f === zt && !et(wt, at) && H(
|
625
|
+
wt,
|
626
|
+
Bt,
|
627
|
+
i,
|
628
|
+
At
|
629
|
+
);
|
630
|
+
}
|
631
|
+
F(
|
632
|
+
ct,
|
633
|
+
i,
|
634
|
+
M,
|
635
|
+
T,
|
636
|
+
b
|
637
|
+
);
|
638
|
+
}, st = (i, f, g, D) => {
|
639
|
+
const b = gt(i, D) ? f : c, T = () => f < b ? [b, b + 1] : f > b ? [b - 1, b] : [b - 1, b + 1], [A, M] = T(), x = g[A] ?? null, G = g[M] ?? null;
|
640
|
+
return [
|
641
|
+
x,
|
642
|
+
G,
|
643
|
+
b
|
644
|
+
];
|
645
|
+
}, H = (i, f, g, D) => {
|
646
|
+
Tt(i, f.height, f.width), Tt(
|
647
|
+
g,
|
648
|
+
D.height,
|
649
|
+
D.width
|
650
|
+
);
|
651
|
+
}, F = (i, f, g, D, y) => {
|
652
|
+
const { onInsertEvent: b, onDragEnd: T } = g;
|
653
|
+
nt(f, Wt), z(f, n, D, () => {
|
654
|
+
if (yt(f, Wt), y != null) {
|
655
|
+
const A = d(y);
|
656
|
+
A != null && (b(i, A), T({ value: A, index: i })), q(f), Z();
|
657
|
+
}
|
658
|
+
});
|
659
|
+
}, Z = () => {
|
660
|
+
if (s) {
|
661
|
+
var i = document.querySelectorAll(
|
662
|
+
`${dt(s)} > .${Q}`
|
663
|
+
);
|
664
|
+
for (const f of i)
|
665
|
+
$(f);
|
666
|
+
}
|
667
|
+
}, q = (i) => {
|
668
|
+
setTimeout(() => {
|
669
|
+
yt(i, B);
|
670
|
+
}, pn);
|
671
|
+
}, z = (i, f, g, D) => {
|
672
|
+
setTimeout(() => {
|
673
|
+
D && D(), X(f, g), j(g), tt(i), V(i, f), V(i, g);
|
674
|
+
}, m);
|
675
|
+
}, X = (i, f) => {
|
676
|
+
i.isSameNode(f) ? vt(i, m) : (vt(i, m, !0), vt(f, m));
|
677
|
+
}, j = (i) => {
|
678
|
+
if (n.isSameNode(i))
|
679
|
+
return;
|
680
|
+
var [f] = n.querySelectorAll(`.${at}`);
|
681
|
+
if (!f)
|
682
|
+
return;
|
683
|
+
const { distance: g } = w(l);
|
684
|
+
it(f) && (f.style[g] = "0px");
|
685
|
+
}, V = (i, f) => {
|
686
|
+
const [g] = Rt(i, f);
|
687
|
+
for (const D of [...g, i])
|
688
|
+
$(D);
|
689
|
+
}, $ = (i) => {
|
690
|
+
it(i) && (i.style.transition = "", i.style.transform = "");
|
691
|
+
}, tt = (i) => {
|
692
|
+
r(), lt(i, !1), i.style.transform = "", i.style.transition = "", i.style.top = "", i.style.left = "", le(i, {
|
693
|
+
fixedHeight: "",
|
694
|
+
fixedWidth: ""
|
695
|
+
});
|
696
|
+
}, ot = (i, f) => {
|
697
|
+
const g = f.querySelector(u);
|
698
|
+
bt(document.body, se, i), bt(g || f, Yt, i);
|
699
|
+
}, lt = (i, f) => {
|
700
|
+
bt(i, Ht, f), ot(f, i), o.toggleGrabClass(!f);
|
701
|
+
};
|
702
|
+
return [
|
703
|
+
O,
|
704
|
+
h,
|
705
|
+
N,
|
706
|
+
S,
|
707
|
+
lt
|
708
|
+
];
|
709
|
+
}
|
710
|
+
const he = (t, e, n) => {
|
711
|
+
const { insertingFromClass: s, animationDuration: o } = n, r = kt(() => {
|
712
|
+
const l = re(e)[t];
|
713
|
+
nt(l, s), nt(l, Zt), setTimeout(() => {
|
714
|
+
yt(l, Zt), yt(l, s), r.disconnect();
|
715
|
+
}, o);
|
716
|
+
}, e, {
|
717
|
+
childList: !0
|
718
|
+
});
|
719
|
+
}, wn = (t, e, n, s) => {
|
720
|
+
if (!e)
|
721
|
+
return;
|
722
|
+
const { onInsertEvent: o, delayBeforeInsert: r } = t;
|
723
|
+
setTimeout(() => {
|
724
|
+
o(n, s), he(n, e, t);
|
725
|
+
}, r);
|
726
|
+
}, mn = (t, e) => {
|
727
|
+
const n = (l) => t.removeAtEvent(l), s = (l, u) => t.insertEvent(l, u), o = () => t.getLength(), r = (l) => t.getValue(l), c = (l) => l;
|
728
|
+
return {
|
729
|
+
direction: (e == null ? void 0 : e.direction) ?? U,
|
730
|
+
handlerSelector: (e == null ? void 0 : e.handlerSelector) ?? Q,
|
731
|
+
draggingClass: (e == null ? void 0 : e.draggingClass) ?? "dragging",
|
732
|
+
droppableClass: (e == null ? void 0 : e.droppableClass) ?? "droppable-hover",
|
733
|
+
isDraggable: (e == null ? void 0 : e.isDraggable) ?? (() => !0),
|
734
|
+
onDragStart: (e == null ? void 0 : e.onDragStart) ?? (() => {
|
735
|
+
}),
|
736
|
+
onDragEnd: (e == null ? void 0 : e.onDragEnd) ?? (() => {
|
737
|
+
}),
|
738
|
+
droppableGroup: e == null ? void 0 : e.droppableGroup,
|
739
|
+
onRemoveAtEvent: n,
|
740
|
+
onInsertEvent: s,
|
741
|
+
onGetLegth: o,
|
742
|
+
onGetValue: r,
|
743
|
+
animationDuration: (e == null ? void 0 : e.animationDuration) ?? 200,
|
744
|
+
removingClass: (e == null ? void 0 : e.removingClass) ?? "removing",
|
745
|
+
insertingFromClass: (e == null ? void 0 : e.insertingFromClass) ?? "from-inserting",
|
746
|
+
delayBeforeRemove: (e == null ? void 0 : e.delayBeforeRemove) ?? 200,
|
747
|
+
delayBeforeInsert: (e == null ? void 0 : e.delayBeforeInsert) ?? 200,
|
748
|
+
mapFrom: (e == null ? void 0 : e.mapFrom) ?? c
|
749
|
+
};
|
750
|
+
}, Sn = (t, e) => {
|
751
|
+
const { config: n, droppable: s } = t, { onInsertEvent: o, onDragEnd: r } = n;
|
752
|
+
return {
|
753
|
+
...n,
|
754
|
+
onDragEnd: (u) => {
|
755
|
+
const { index: d, value: m } = u;
|
756
|
+
r({ index: d, value: e(m, s) });
|
757
|
+
},
|
758
|
+
onInsertEvent: (u, d) => o(u, e(d, s))
|
759
|
+
};
|
760
|
+
}, Dn = (t) => {
|
761
|
+
let e = { offsetX: 0, offsetY: 0 }, n = { top: 0, left: 0 }, s = { x: 0, y: 0 };
|
762
|
+
const o = (u) => {
|
763
|
+
t.style.transform = `translate( ${u.x}px, ${u.y}px)`;
|
764
|
+
}, r = (u) => {
|
765
|
+
t.style.top = `${u.top}px`, t.style.left = `${u.left}px`;
|
766
|
+
};
|
767
|
+
return [
|
768
|
+
(u, d, m, v) => {
|
769
|
+
const B = (h) => {
|
770
|
+
const {
|
771
|
+
beforeMargin: S,
|
772
|
+
borderBeforeWidth: C,
|
773
|
+
before: R,
|
774
|
+
offset: I,
|
775
|
+
scroll: Y,
|
776
|
+
page: W,
|
777
|
+
inner: P,
|
778
|
+
distance: st,
|
779
|
+
axis: H,
|
780
|
+
getRect: F
|
781
|
+
} = w(h), Z = m[W], q = window[Y], z = window[P], X = F(u)[st], j = L(u, C), V = L(u, S), $ = Z - e[I], tt = ie(u, h);
|
782
|
+
if ($ >= q - X / 2 && $ <= q + z) {
|
783
|
+
const lt = $ - n[R] - j - V - q - tt;
|
784
|
+
return O(h), lt;
|
785
|
+
}
|
786
|
+
return s[H];
|
787
|
+
}, O = (h) => {
|
788
|
+
if (u && et(u, Ht) && h === v) {
|
789
|
+
const { before: S, distance: C, axis: R, getRect: I } = w(v), Y = I(u)[C], W = I(d), P = n[S] - W[S] + s[R], H = W[C] - Y, F = P / H, Z = Y / H, q = 0.1, z = 0.2, X = 0.8;
|
790
|
+
let j = 0;
|
791
|
+
const V = gt(u, d);
|
792
|
+
!V && F < z && F > -Z ? j = F / z - 1 : !V && F > X && F < 1 + Z && (j = 1 / (1 - X) * (F - X));
|
793
|
+
const $ = q * Y * j;
|
794
|
+
sn(d, v, $);
|
795
|
+
}
|
796
|
+
}, N = (h) => {
|
797
|
+
const { axis: S } = w(h);
|
798
|
+
s[S] = B(h), o(s);
|
799
|
+
};
|
800
|
+
N(_), N(U);
|
801
|
+
},
|
802
|
+
(u, d) => {
|
803
|
+
const [m, v, B, O] = Tn(
|
804
|
+
u,
|
805
|
+
d,
|
806
|
+
t
|
807
|
+
);
|
808
|
+
n = {
|
809
|
+
top: m,
|
810
|
+
left: v
|
811
|
+
}, r(n), e = { offsetX: B, offsetY: O };
|
812
|
+
}
|
813
|
+
];
|
814
|
+
}, Lt = (t, e, n) => {
|
815
|
+
const { borderBeforeWidth: s, before: o, getRect: r } = w(t);
|
816
|
+
return r(e)[o] - r(n)[o] - L(n, s);
|
817
|
+
}, vn = (t, e) => {
|
818
|
+
let { offsetX: n, offsetY: s, target: o } = t, r = bn(o, e);
|
819
|
+
const c = o;
|
820
|
+
return c && r && !c.isSameNode(r) && (n += Lt(_, c, r), s += Lt(U, c, r)), r && e != o && (n += Lt(_, r, e), s += Lt(U, r, e)), [n, s];
|
821
|
+
}, bn = (t, e) => {
|
822
|
+
const n = t == null ? void 0 : t.closest(`.${Ot}`);
|
823
|
+
return n && n.isSameNode(e) ? t : n;
|
824
|
+
}, ne = (t, e, n, s) => {
|
825
|
+
const { offset: o, beforeMargin: r, page: c, borderBeforeWidth: l, scroll: u } = w(t), d = ie(n, t);
|
826
|
+
return e[c] - s[o] - L(n, r) - L(n, l) - window[u] - d;
|
827
|
+
}, Tn = (t, e, n) => {
|
828
|
+
const [s, o] = vn(t, n);
|
829
|
+
return [
|
830
|
+
ne(U, t, e, {
|
831
|
+
offsetX: s,
|
832
|
+
offsetY: o
|
833
|
+
}),
|
834
|
+
ne(_, t, e, {
|
835
|
+
offsetX: s,
|
836
|
+
offsetY: o
|
837
|
+
}),
|
838
|
+
s,
|
839
|
+
o
|
840
|
+
];
|
841
|
+
}, K = class K {
|
842
|
+
static addConfig(e, n) {
|
843
|
+
const s = K.configs.filter(
|
844
|
+
(r) => !r.droppable.isSameNode(e)
|
845
|
+
), o = Kt(e);
|
846
|
+
s.push({
|
847
|
+
droppable: e,
|
848
|
+
config: n,
|
849
|
+
scroll: o
|
850
|
+
}), K.configs = s;
|
851
|
+
}
|
852
|
+
static updateScrolls(e, n) {
|
853
|
+
for (const s of K.configs) {
|
854
|
+
const { droppable: o } = s;
|
855
|
+
(n && be(o, n) || o.isSameNode(e)) && (s.scroll = Kt(o));
|
856
|
+
}
|
857
|
+
}
|
858
|
+
static getConfig(e) {
|
859
|
+
return K.configs.find(
|
860
|
+
({ droppable: s }) => s.isSameNode(e)
|
861
|
+
);
|
862
|
+
}
|
863
|
+
};
|
864
|
+
k(K, "configs", []), k(K, "removeObsoleteConfigs", () => {
|
865
|
+
const e = K.configs.filter(
|
866
|
+
({ droppable: n }) => document.contains(n)
|
867
|
+
);
|
868
|
+
K.configs = e;
|
869
|
+
});
|
870
|
+
let pt = K;
|
871
|
+
class En {
|
872
|
+
constructor(e, n, s, o, r, c) {
|
873
|
+
k(this, "initial");
|
874
|
+
k(this, "current");
|
875
|
+
k(this, "parent");
|
876
|
+
k(this, "draggableElement");
|
877
|
+
k(this, "groupClass");
|
878
|
+
k(this, "dragEvent");
|
879
|
+
k(this, "changeDroppable");
|
880
|
+
k(this, "mapFrom");
|
881
|
+
this.parent = s, this.draggableElement = e, this.groupClass = n, this.dragEvent = o, this.mapFrom = c, this.initial = s ? this.getConfigFrom(s) : void 0, this.changeDroppable = r;
|
882
|
+
}
|
883
|
+
getDraggableAncestor(e, n, s) {
|
884
|
+
return document.elementsFromPoint(e, n).filter((o) => !o.isSameNode(s));
|
885
|
+
}
|
886
|
+
getElementBelow(e, n, s = !0) {
|
887
|
+
const o = (c) => {
|
888
|
+
const [l] = c.getDraggableAncestor(
|
889
|
+
n.clientX,
|
890
|
+
n.clientY,
|
891
|
+
e
|
892
|
+
);
|
893
|
+
return l;
|
894
|
+
};
|
895
|
+
let r = null;
|
896
|
+
return s ? (e.hidden = !0, r = o(this), e.hidden = !1) : r = o(this), r;
|
897
|
+
}
|
898
|
+
getCurrent(e, n, s = !0) {
|
899
|
+
const o = this.getElementBelow(e, n, s);
|
900
|
+
return !this.groupClass || !o ? void 0 : o.closest(
|
901
|
+
dt(this.groupClass)
|
902
|
+
);
|
903
|
+
}
|
904
|
+
isOutsideOfAllDroppables(e) {
|
905
|
+
return (this.groupClass ? Array.from(
|
906
|
+
document.querySelectorAll(dt(this.groupClass))
|
907
|
+
) : [this.parent]).every(
|
908
|
+
(s) => gt(e, s)
|
909
|
+
);
|
910
|
+
}
|
911
|
+
isNotInsideAnotherDroppable(e, n) {
|
912
|
+
return !gt(e, n) || this.isOutsideOfAllDroppables(e);
|
913
|
+
}
|
914
|
+
onScrollEvent() {
|
915
|
+
this.dragEvent();
|
916
|
+
}
|
917
|
+
setOnScroll(e) {
|
918
|
+
ae(e, "onscroll", () => {
|
919
|
+
this.onScrollEvent();
|
920
|
+
});
|
921
|
+
}
|
922
|
+
getConfigFrom(e) {
|
923
|
+
const n = pt.getConfig(e);
|
924
|
+
if (n)
|
925
|
+
return {
|
926
|
+
...n,
|
927
|
+
config: Sn(n, this.mapFrom)
|
928
|
+
};
|
929
|
+
}
|
930
|
+
getCurrentConfig(e) {
|
931
|
+
var o;
|
932
|
+
const n = this.draggableElement;
|
933
|
+
if (this.current && this.isNotInsideAnotherDroppable(
|
934
|
+
n,
|
935
|
+
(o = this.current) == null ? void 0 : o.droppable
|
936
|
+
))
|
937
|
+
return this.current;
|
938
|
+
const s = this.getCurrent(n, e);
|
939
|
+
return s ? (it(s) && !s.onscroll && this.setOnScroll(s), this.getConfigFrom(s)) : this.getConfigFrom(this.parent);
|
940
|
+
}
|
941
|
+
updateConfig(e) {
|
942
|
+
const n = this.current;
|
943
|
+
this.current = this.getCurrentConfig(e), this.changeDroppable(this.current, n);
|
944
|
+
}
|
945
|
+
isOutside(e, n = !0) {
|
946
|
+
const s = this.draggableElement;
|
947
|
+
return !this.getCurrent(s, e, n);
|
948
|
+
}
|
949
|
+
}
|
950
|
+
function yn(t, e, n, s, o) {
|
951
|
+
const {
|
952
|
+
handlerSelector: r,
|
953
|
+
isDraggable: c,
|
954
|
+
droppableGroup: l,
|
955
|
+
animationDuration: u,
|
956
|
+
delayBeforeRemove: d,
|
957
|
+
draggingClass: m,
|
958
|
+
removingClass: v,
|
959
|
+
onRemoveAtEvent: B,
|
960
|
+
droppableClass: O,
|
961
|
+
onDragStart: N
|
962
|
+
} = n, h = Ct(l).map((a) => `droppable-group-${a}`).join(" ");
|
963
|
+
let S = 0, C = {
|
964
|
+
scrollX: 0,
|
965
|
+
scrollY: 0
|
966
|
+
}, R = { pageX: 0, pageY: 0 }, I;
|
967
|
+
const [Y, W] = Dn(
|
968
|
+
t
|
969
|
+
), [
|
970
|
+
P,
|
971
|
+
st,
|
972
|
+
H,
|
973
|
+
F,
|
974
|
+
Z
|
975
|
+
] = hn(
|
976
|
+
n,
|
977
|
+
e,
|
978
|
+
s,
|
979
|
+
h,
|
980
|
+
o,
|
981
|
+
() => S = 0
|
982
|
+
/* NOT_DRAGGING */
|
983
|
+
), q = () => {
|
984
|
+
nt(t, Q);
|
985
|
+
}, z = (a) => {
|
986
|
+
nt(a, Ot), o.addSubscriber(a);
|
987
|
+
}, X = () => {
|
988
|
+
if (c(t)) {
|
989
|
+
const a = t.querySelector(r);
|
990
|
+
z(a || t);
|
991
|
+
}
|
992
|
+
}, j = () => {
|
993
|
+
Ie(document.body, [
|
994
|
+
`.${Q}{touch-action:manipulation;user-select:none;box-sizing:border-box!important;-webkit-user-select:none;}`,
|
995
|
+
`.${Ot}{pointer-events:auto!important;}`,
|
996
|
+
`.${ve}{cursor:grab;}`,
|
997
|
+
".temp-child{touch-action:none;pointer-events:none;box-sizing:border-box!important;}",
|
998
|
+
".droppable{box-sizing:border-box!important;}",
|
999
|
+
`.${Ht}{position:fixed;z-index:5000;width:var(--fixedWidth)!important;height:var(--fixedHeight)!important;}`,
|
1000
|
+
`.${Yt}{pointer-events:none!important;}`,
|
1001
|
+
`.${Wt}{pointer-events:none!important;}`,
|
1002
|
+
`.${se}{cursor:grabbing;}`,
|
1003
|
+
".disable-transition{transition:none!important;}"
|
1004
|
+
]), X(), q();
|
1005
|
+
}, V = (a) => {
|
1006
|
+
const p = a == null ? void 0 : a.querySelector(`.${Ot}`), E = p == null ? void 0 : p.parentElement;
|
1007
|
+
return p && E && et(E, It) && !E.isSameNode(s) ? null : p;
|
1008
|
+
}, $ = (a) => {
|
1009
|
+
const p = V(a) ?? a;
|
1010
|
+
p && c(a) && ($t(
|
1011
|
+
p,
|
1012
|
+
"onmousedown",
|
1013
|
+
M("mousemove", "mouseup")
|
1014
|
+
), $t(
|
1015
|
+
p,
|
1016
|
+
"ontouchstart",
|
1017
|
+
M("touchmove", "touchend")
|
1018
|
+
), tt(p)), a != null && a.isSameNode(p) || $t(a, "onmousedown", x), nt(s, It);
|
1019
|
+
}, tt = (a) => {
|
1020
|
+
const p = a.querySelectorAll("img");
|
1021
|
+
Array.from(p).forEach((E) => {
|
1022
|
+
E.onmousedown = () => !1;
|
1023
|
+
});
|
1024
|
+
}, ot = () => {
|
1025
|
+
if (R.pageX == 0 && R.pageY == 0 || !i.current)
|
1026
|
+
return;
|
1027
|
+
const { droppable: a, config: p } = i.current;
|
1028
|
+
Y(t, a, R, p.direction), P(
|
1029
|
+
t,
|
1030
|
+
Ft,
|
1031
|
+
C,
|
1032
|
+
i.current
|
1033
|
+
);
|
1034
|
+
}, lt = (a, p) => {
|
1035
|
+
p && S == 2 && !(a != null && a.droppable.isSameNode(p.droppable)) && P(
|
1036
|
+
t,
|
1037
|
+
Ft,
|
1038
|
+
C,
|
1039
|
+
p
|
1040
|
+
);
|
1041
|
+
}, i = new En(
|
1042
|
+
t,
|
1043
|
+
h,
|
1044
|
+
s,
|
1045
|
+
ot,
|
1046
|
+
lt,
|
1047
|
+
n.mapFrom
|
1048
|
+
), f = (a) => {
|
1049
|
+
if (!i.current)
|
1050
|
+
return;
|
1051
|
+
const p = h ? Array.from(
|
1052
|
+
document.querySelectorAll(dt(h))
|
1053
|
+
) : [s];
|
1054
|
+
for (const E of p)
|
1055
|
+
E.classList.toggle(
|
1056
|
+
O,
|
1057
|
+
!a && E.isSameNode(i.current.droppable)
|
1058
|
+
);
|
1059
|
+
}, g = (a) => {
|
1060
|
+
i.updateConfig(a);
|
1061
|
+
const p = i.isOutside(a);
|
1062
|
+
f(p), S === 1 ? ut(a) : S === 2 && (D(p), St(a));
|
1063
|
+
}, D = (a = !0) => {
|
1064
|
+
if (!i.current)
|
1065
|
+
return;
|
1066
|
+
const { droppable: p } = i.current;
|
1067
|
+
gn(
|
1068
|
+
p,
|
1069
|
+
s,
|
1070
|
+
h,
|
1071
|
+
u,
|
1072
|
+
a
|
1073
|
+
), !a && Gt(
|
1074
|
+
t,
|
1075
|
+
s,
|
1076
|
+
S == 1,
|
1077
|
+
i.current
|
1078
|
+
);
|
1079
|
+
}, y = (a) => {
|
1080
|
+
if (Xt(a) && a.cancelable)
|
1081
|
+
a.preventDefault();
|
1082
|
+
else if (Xt(a))
|
1083
|
+
return;
|
1084
|
+
const p = Vt(a);
|
1085
|
+
g(p);
|
1086
|
+
}, b = (a, p) => {
|
1087
|
+
a == "touchmove" ? I = setTimeout(() => {
|
1088
|
+
p();
|
1089
|
+
}, 200) : p();
|
1090
|
+
}, T = (a, p) => {
|
1091
|
+
const { clientX: E, clientY: ft } = a, rt = document.elementFromPoint(E, ft), Dt = rt == null ? void 0 : rt.closest(`.${Q}`);
|
1092
|
+
return rt && p && Dt && !p.isSameNode(Dt);
|
1093
|
+
}, A = (a) => {
|
1094
|
+
const p = n.onGetValue(e);
|
1095
|
+
return { index: e, element: a, value: p };
|
1096
|
+
}, M = (a, p) => (E) => {
|
1097
|
+
if (T(E, t))
|
1098
|
+
return;
|
1099
|
+
pt.updateScrolls(s, h);
|
1100
|
+
const { scrollX: ft, scrollY: rt } = window;
|
1101
|
+
if (C = { scrollX: ft, scrollY: rt }, S === 0) {
|
1102
|
+
S = 1;
|
1103
|
+
const Dt = A(t);
|
1104
|
+
Dt && N(Dt), b(a, () => {
|
1105
|
+
a == "touchmove" && (i.updateConfig(E), f(i.isOutside(E)), ut(E)), document.addEventListener(a, y, {
|
1106
|
+
passive: !1
|
1107
|
+
});
|
1108
|
+
}), ct(s), document.addEventListener(p, G(a), {
|
1109
|
+
once: !0
|
1110
|
+
});
|
1111
|
+
}
|
1112
|
+
}, x = (a) => i.updateConfig(a), G = (a) => (p) => {
|
1113
|
+
f(!0);
|
1114
|
+
const E = Vt(p);
|
1115
|
+
clearTimeout(I), At(i.isOutside(E, !1)), document.removeEventListener(a, y), i.updateConfig(E);
|
1116
|
+
const ft = i.getCurrentConfig(E);
|
1117
|
+
if (ft) {
|
1118
|
+
const { droppable: rt } = ft;
|
1119
|
+
J(rt);
|
1120
|
+
}
|
1121
|
+
s.onscroll = null;
|
1122
|
+
}, J = (a) => {
|
1123
|
+
if (a.onscroll = null, !h)
|
1124
|
+
return;
|
1125
|
+
const p = Array.from(
|
1126
|
+
document.querySelectorAll(dt(h))
|
1127
|
+
);
|
1128
|
+
for (const E of p)
|
1129
|
+
it(E) && (E.onscroll = null);
|
1130
|
+
}, ut = (a) => {
|
1131
|
+
Gt(
|
1132
|
+
t,
|
1133
|
+
s,
|
1134
|
+
S == 1,
|
1135
|
+
i.current
|
1136
|
+
), mt(), P(
|
1137
|
+
t,
|
1138
|
+
ue,
|
1139
|
+
C,
|
1140
|
+
i.current
|
1141
|
+
), wt(t), W(a, t);
|
1142
|
+
}, mt = () => {
|
1143
|
+
S = 2;
|
1144
|
+
}, St = (a) => {
|
1145
|
+
const { pageX: p, pageY: E } = a;
|
1146
|
+
R = { pageX: p, pageY: E }, ot();
|
1147
|
+
}, ct = (a) => ae(a, "onscroll", Pt), Pt = () => ot(), At = (a) => {
|
1148
|
+
if (S !== 2) {
|
1149
|
+
S = 0;
|
1150
|
+
return;
|
1151
|
+
}
|
1152
|
+
S = 3, xt(t), P(
|
1153
|
+
t,
|
1154
|
+
zt,
|
1155
|
+
C,
|
1156
|
+
a ? i.initial : i.current,
|
1157
|
+
e
|
1158
|
+
);
|
1159
|
+
}, xt = (a) => {
|
1160
|
+
Nt(a, u, fe), Tt(a, 0, 0);
|
1161
|
+
}, wt = (a) => {
|
1162
|
+
const { height: p, width: E } = a.getBoundingClientRect();
|
1163
|
+
le(a, {
|
1164
|
+
fixedHeight: `${p}px`,
|
1165
|
+
fixedWidth: `${E}px`
|
1166
|
+
}), Z(a, !0), bt(a, m, !0), a.style.transition = "";
|
1167
|
+
}, Bt = (a) => {
|
1168
|
+
if (!i.initial)
|
1169
|
+
return;
|
1170
|
+
const p = i.initial;
|
1171
|
+
a == e && (nt(t, v), setTimeout(() => {
|
1172
|
+
B(e), yt(t, v), Gt(
|
1173
|
+
t,
|
1174
|
+
s,
|
1175
|
+
S == 1,
|
1176
|
+
i.initial
|
1177
|
+
), st(
|
1178
|
+
a,
|
1179
|
+
t,
|
1180
|
+
p,
|
1181
|
+
(E) => {
|
1182
|
+
xt(E), F(t);
|
1183
|
+
}
|
1184
|
+
);
|
1185
|
+
}, d));
|
1186
|
+
}, me = (a, p) => {
|
1187
|
+
(a === e || a === n.onGetLegth() && e === a - 1) && H(
|
1188
|
+
a,
|
1189
|
+
t,
|
1190
|
+
s,
|
1191
|
+
p,
|
1192
|
+
() => {
|
1193
|
+
fn(
|
1194
|
+
t,
|
1195
|
+
S == 1,
|
1196
|
+
i.initial
|
1197
|
+
);
|
1198
|
+
}
|
1199
|
+
);
|
1200
|
+
};
|
1201
|
+
return j(), $(t), [Bt, me];
|
1202
|
+
}
|
1203
|
+
const Cn = (t, e) => {
|
1204
|
+
t && Te(e, t);
|
1205
|
+
};
|
1206
|
+
function An(t, e, n, s = "index") {
|
1207
|
+
const o = s;
|
1208
|
+
let r = [], c = [];
|
1209
|
+
const { droppableGroup: l } = t;
|
1210
|
+
if (!n)
|
1211
|
+
return [
|
1212
|
+
r,
|
1213
|
+
c
|
1214
|
+
];
|
1215
|
+
const u = Ct(l).map((d) => `droppable-group-${d}`).join(" ");
|
1216
|
+
Cn(u, n);
|
1217
|
+
for (const d of n.children) {
|
1218
|
+
const m = d.getAttribute(o), v = ye(m), B = d;
|
1219
|
+
if (B && v >= 0) {
|
1220
|
+
const [O, N] = yn(
|
1221
|
+
B,
|
1222
|
+
v,
|
1223
|
+
t,
|
1224
|
+
n,
|
1225
|
+
e
|
1226
|
+
);
|
1227
|
+
r.push(O), c.push(N);
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
return [
|
1231
|
+
r,
|
1232
|
+
c
|
1233
|
+
];
|
1234
|
+
}
|
1235
|
+
function Bn(t, e, n, s = "index") {
|
1236
|
+
let o = [], r = [];
|
1237
|
+
const c = mn(t, n), l = (h) => {
|
1238
|
+
for (const S of o)
|
1239
|
+
S(h);
|
1240
|
+
}, u = (h, S) => {
|
1241
|
+
if (c.onGetLegth() === 0)
|
1242
|
+
t.insertToListEmpty(c, h, S);
|
1243
|
+
else
|
1244
|
+
for (const R of r)
|
1245
|
+
R(h, S);
|
1246
|
+
}, d = (h) => {
|
1247
|
+
const [S, C] = An(c, e, h, s);
|
1248
|
+
o = S, r = C;
|
1249
|
+
}, m = (h) => {
|
1250
|
+
const S = h.addedNodes.values().filter((R) => !ee(R)).toArray(), C = h.removedNodes.values().filter((R) => !ee(R)).toArray();
|
1251
|
+
return S.length > 0 || C.length > 0;
|
1252
|
+
}, v = (h) => {
|
1253
|
+
kt(
|
1254
|
+
() => {
|
1255
|
+
d(h);
|
1256
|
+
},
|
1257
|
+
h,
|
1258
|
+
{ childList: !0 },
|
1259
|
+
m
|
1260
|
+
);
|
1261
|
+
}, B = (h) => {
|
1262
|
+
nt(h, It);
|
1263
|
+
}, O = (h) => {
|
1264
|
+
pt.addConfig(
|
1265
|
+
h,
|
1266
|
+
c
|
1267
|
+
);
|
1268
|
+
};
|
1269
|
+
return [l, u, (h) => {
|
1270
|
+
h && (B(h), O(h), v(h), d(h), pt.removeObsoleteConfigs());
|
1271
|
+
}];
|
1272
|
+
}
|
1273
|
+
export {
|
1274
|
+
ve as G,
|
1275
|
+
nt as a,
|
1276
|
+
Bn as d,
|
1277
|
+
wn as i,
|
1278
|
+
bt as t
|
1279
|
+
};
|