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