@vue-dnd-kit/core 2.4.3 → 2.4.5
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/vue-dnd-kit-core.cjs.js +1 -1
- package/dist/vue-dnd-kit-core.es.js +321 -309
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-preview{transform-origin:0 0;will-change:transform}.dnd-kit-preview-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing;z-index:9999}")),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
import { shallowRef as V, ref as
|
|
2
|
+
import { shallowRef as V, ref as q, reactive as $, computed as b, watch as ne, onScopeDispose as Je, onMounted as Y, onBeforeUnmount as Z, inject as Be, defineComponent as Oe, useTemplateRef as Fe, unref as j, openBlock as L, createElementBlock as W, normalizeStyle as Ce, renderSlot as me, Fragment as he, renderList as Qe, createBlock as Q, resolveDynamicComponent as be, createCommentVNode as et, provide as tt, Teleport as nt, createElementVNode as st, mergeProps as it } from "vue";
|
|
3
3
|
const I = {
|
|
4
4
|
SELECT_AREA: "data-dnd-kit-select-area",
|
|
5
5
|
DRAGGABLE: "data-dnd-kit-draggable",
|
|
@@ -9,7 +9,7 @@ const I = {
|
|
|
9
9
|
SELECT_AREA: `[${I.SELECT_AREA}]`,
|
|
10
10
|
DRAGGABLE: `[${I.DRAGGABLE}]`,
|
|
11
11
|
CONSTRAINT_AREA: `[${I.CONSTRAINT_AREA}]`
|
|
12
|
-
},
|
|
12
|
+
}, xe = "VueDnDKitProvider", Ie = (e, t, n, s) => {
|
|
13
13
|
const i = /* @__PURE__ */ new Set();
|
|
14
14
|
return t.forEach((r) => {
|
|
15
15
|
const a = e.get(r), o = s ? s(r) : a?.disabled;
|
|
@@ -22,14 +22,14 @@ const I = {
|
|
|
22
22
|
c[l]((g) => n.value.has(g)) && i.add(r);
|
|
23
23
|
}), i;
|
|
24
24
|
};
|
|
25
|
-
let
|
|
26
|
-
const S = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, H = (e, t) => e !== t && e.contains(t),
|
|
25
|
+
let ze = "", at = "", ot = "";
|
|
26
|
+
const S = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, H = (e, t) => e !== t && e.contains(t), rt = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), pe = () => {
|
|
27
27
|
const e = document.body;
|
|
28
|
-
|
|
28
|
+
ze = e.style.userSelect, e.style.userSelect = "none", window.addEventListener("contextmenu", M), window.addEventListener("selectstart", M), window.addEventListener("touchstart", M), window.addEventListener("touchmove", M);
|
|
29
29
|
}, ye = () => {
|
|
30
30
|
const e = document.body;
|
|
31
|
-
e.style.userSelect =
|
|
32
|
-
},
|
|
31
|
+
e.style.userSelect = ze, e.style.touchAction = at, e.style.overscrollBehavior = ot, window.removeEventListener("contextmenu", M), window.removeEventListener("selectstart", M), window.removeEventListener("touchstart", M), window.removeEventListener("touchmove", M);
|
|
32
|
+
}, M = (e) => e.preventDefault(), Ee = (e, t) => {
|
|
33
33
|
if (t.entities.draggableMap.get(e)?.disabled) return !0;
|
|
34
34
|
for (const s of t.entities.visibleDraggableSet)
|
|
35
35
|
if (t.entities.draggableMap.get(s)?.disabled && H(s, e)) return !0;
|
|
@@ -39,12 +39,12 @@ const S = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$e
|
|
|
39
39
|
for (const s of t.entities.visibleDroppableSet)
|
|
40
40
|
if (t.entities.droppableMap.get(s)?.disabled && H(s, e)) return !0;
|
|
41
41
|
return !1;
|
|
42
|
-
},
|
|
42
|
+
}, se = (e, t) => {
|
|
43
43
|
if (!e.length || !t.length) return !0;
|
|
44
44
|
const n = new Set(t);
|
|
45
45
|
return e.some((s) => n.has(s));
|
|
46
46
|
};
|
|
47
|
-
function
|
|
47
|
+
function lt(e, t, n, s) {
|
|
48
48
|
const i = [];
|
|
49
49
|
for (const a of t.keys()) {
|
|
50
50
|
const o = n.get(a);
|
|
@@ -53,11 +53,11 @@ function rt(e, t, n, s) {
|
|
|
53
53
|
const r = /* @__PURE__ */ new Set();
|
|
54
54
|
for (const a of e) {
|
|
55
55
|
const o = s.get(a), c = o?.groups ?? [], l = o?.groupMatch ?? "every";
|
|
56
|
-
(!i.length || i[l]((g) =>
|
|
56
|
+
(!i.length || i[l]((g) => se(g.groups, c))) && r.add(a);
|
|
57
57
|
}
|
|
58
58
|
return r;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function ct(e, t, n) {
|
|
61
61
|
const s = /* @__PURE__ */ new Set();
|
|
62
62
|
for (const a of t.keys()) {
|
|
63
63
|
const o = n.get(a);
|
|
@@ -66,11 +66,16 @@ function lt(e, t, n) {
|
|
|
66
66
|
const i = [...s], r = /* @__PURE__ */ new Set();
|
|
67
67
|
for (const a of e) {
|
|
68
68
|
const c = n.get(a)?.groups ?? [];
|
|
69
|
-
|
|
69
|
+
se(i, c) && r.add(a);
|
|
70
70
|
}
|
|
71
71
|
return r;
|
|
72
72
|
}
|
|
73
73
|
const re = (e) => {
|
|
74
|
+
if (typeof IntersectionObserver > "u")
|
|
75
|
+
return { observe: () => {
|
|
76
|
+
}, unobserve: () => {
|
|
77
|
+
}, disconnect: () => {
|
|
78
|
+
} };
|
|
74
79
|
const t = new IntersectionObserver((n) => {
|
|
75
80
|
n.forEach((s) => {
|
|
76
81
|
const i = s.target;
|
|
@@ -90,11 +95,11 @@ function De(e, t = 0, n = 0) {
|
|
|
90
95
|
offset: { x: t, y: n }
|
|
91
96
|
};
|
|
92
97
|
}
|
|
93
|
-
function
|
|
98
|
+
function _e(e, t) {
|
|
94
99
|
const n = t.getBoundingClientRect(), s = n.width > 0 ? (e.clientX - n.left) / n.width : 0.5, i = n.height > 0 ? (e.clientY - n.top) / n.height : 0.5;
|
|
95
100
|
return { x: s, y: i };
|
|
96
101
|
}
|
|
97
|
-
function
|
|
102
|
+
function Ge(e, t) {
|
|
98
103
|
return {
|
|
99
104
|
...t,
|
|
100
105
|
initialHTML: e.innerHTML,
|
|
@@ -102,34 +107,34 @@ function _e(e, t) {
|
|
|
102
107
|
initialOuterHTML: e.outerHTML
|
|
103
108
|
};
|
|
104
109
|
}
|
|
105
|
-
function
|
|
110
|
+
function gt(e, t, n) {
|
|
106
111
|
e.forEach((s) => {
|
|
107
112
|
const i = t.get(s);
|
|
108
|
-
n.set(s,
|
|
113
|
+
n.set(s, Ge(s, i));
|
|
109
114
|
}), e.clear();
|
|
110
115
|
}
|
|
111
|
-
function
|
|
116
|
+
function ut(e, t, n) {
|
|
112
117
|
n.clear();
|
|
113
118
|
const s = t.get(e);
|
|
114
|
-
n.set(e,
|
|
119
|
+
n.set(e, Ge(e, s));
|
|
115
120
|
}
|
|
116
|
-
function
|
|
117
|
-
e.entities.initiatingDraggable && (e.state.value = "dragging",
|
|
121
|
+
function ee(e) {
|
|
122
|
+
e.entities.initiatingDraggable && (e.state.value = "dragging", ft(
|
|
118
123
|
e.entities.initiatingDraggable,
|
|
119
124
|
e.entities.selectedSet,
|
|
120
125
|
e.entities.draggableMap,
|
|
121
126
|
e.entities.draggingMap
|
|
122
127
|
));
|
|
123
128
|
}
|
|
124
|
-
function
|
|
125
|
-
t.has(e) ?
|
|
129
|
+
function ft(e, t, n, s) {
|
|
130
|
+
t.has(e) ? gt(t, n, s) : (t.clear(), ut(e, n, s));
|
|
126
131
|
}
|
|
127
|
-
function
|
|
132
|
+
function He(e, t, n, s) {
|
|
128
133
|
if (s || !n) return !0;
|
|
129
134
|
const i = e.closest(n);
|
|
130
135
|
return i ? t.contains(i) : !1;
|
|
131
136
|
}
|
|
132
|
-
function
|
|
137
|
+
function dt(e, t) {
|
|
133
138
|
if (!e || !t) return 1;
|
|
134
139
|
const n = Math.abs(e.current.x - e.start.x), s = Math.abs(e.current.y - e.start.y);
|
|
135
140
|
if (typeof t == "number") {
|
|
@@ -145,24 +150,24 @@ function ft(e, t) {
|
|
|
145
150
|
const o = i > 0 ? Math.min(n / i, 1) : 1, c = r > 0 ? Math.min(s / r, 1) : 1;
|
|
146
151
|
return a === "both" ? Math.min(o, c) : Math.max(o, c);
|
|
147
152
|
}
|
|
148
|
-
function
|
|
153
|
+
function Ke(e, t, n) {
|
|
149
154
|
if (!n) return !0;
|
|
150
155
|
const s = n.distance != null, i = n.delay != null;
|
|
151
156
|
return !s && !i ? !0 : s && !i ? e >= 1 : !s && i ? t >= 1 : (n.condition ?? "both") === "both" ? e >= 1 && t >= 1 : e >= 1 || t >= 1;
|
|
152
157
|
}
|
|
153
|
-
function
|
|
158
|
+
function mt(e) {
|
|
154
159
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable)
|
|
155
160
|
return !1;
|
|
156
161
|
const t = e.entities.draggableMap.get(
|
|
157
162
|
e.entities.initiatingDraggable
|
|
158
163
|
);
|
|
159
|
-
return
|
|
164
|
+
return Ke(
|
|
160
165
|
e.distanceProgress.value,
|
|
161
166
|
e.delay.progress,
|
|
162
167
|
t?.activation
|
|
163
|
-
) ? (
|
|
168
|
+
) ? (ee(e), !0) : !1;
|
|
164
169
|
}
|
|
165
|
-
function
|
|
170
|
+
function ht(e, t) {
|
|
166
171
|
let n = null;
|
|
167
172
|
const s = () => {
|
|
168
173
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable) {
|
|
@@ -179,7 +184,7 @@ function mt(e, t) {
|
|
|
179
184
|
e.delay.progress = Math.min(
|
|
180
185
|
(Date.now() - e.delay.startTime) / (r * 1e3),
|
|
181
186
|
1
|
|
182
|
-
),
|
|
187
|
+
), Ke(
|
|
183
188
|
e.distanceProgress.value,
|
|
184
189
|
e.delay.progress,
|
|
185
190
|
i?.activation
|
|
@@ -191,7 +196,7 @@ function mt(e, t) {
|
|
|
191
196
|
}
|
|
192
197
|
};
|
|
193
198
|
}
|
|
194
|
-
function
|
|
199
|
+
function bt(e, t) {
|
|
195
200
|
const n = e.closest(
|
|
196
201
|
G.CONSTRAINT_AREA
|
|
197
202
|
);
|
|
@@ -200,10 +205,10 @@ function ht(e, t) {
|
|
|
200
205
|
entity: t.get(n)
|
|
201
206
|
};
|
|
202
207
|
}
|
|
203
|
-
function
|
|
208
|
+
function pt(e, t, n, s) {
|
|
204
209
|
return n === "x" ? { x: e, y: s.top } : n === "y" ? { x: s.left, y: t } : { x: e, y: t };
|
|
205
210
|
}
|
|
206
|
-
function
|
|
211
|
+
function yt(e, t, n, s, i) {
|
|
207
212
|
let r = e, a = t;
|
|
208
213
|
return n !== "y" && (r = Math.max(
|
|
209
214
|
s.left,
|
|
@@ -213,23 +218,23 @@ function pt(e, t, n, s, i) {
|
|
|
213
218
|
Math.min(s.bottom - i.height, t)
|
|
214
219
|
)), { x: r, y: a };
|
|
215
220
|
}
|
|
216
|
-
function
|
|
221
|
+
function Dt(e, t, n, s) {
|
|
217
222
|
if (!e)
|
|
218
223
|
return { x: 0, y: 0 };
|
|
219
224
|
const i = t?.width ?? 0, r = t?.height ?? 0;
|
|
220
225
|
let a = e.current.x - i * e.offset.x, o = e.current.y - r * e.offset.y;
|
|
221
226
|
if (!n)
|
|
222
227
|
return { x: a, y: o };
|
|
223
|
-
const c =
|
|
228
|
+
const c = bt(n, s);
|
|
224
229
|
if (!c)
|
|
225
230
|
return { x: a, y: o };
|
|
226
|
-
const { element: l, entity: u } = c, g = l.getBoundingClientRect(), f = n.getBoundingClientRect(), d =
|
|
231
|
+
const { element: l, entity: u } = c, g = l.getBoundingClientRect(), f = n.getBoundingClientRect(), d = pt(
|
|
227
232
|
a,
|
|
228
233
|
o,
|
|
229
234
|
u.axis || "both",
|
|
230
235
|
f
|
|
231
236
|
);
|
|
232
|
-
return u.restrictToArea ?
|
|
237
|
+
return u.restrictToArea ? yt(
|
|
233
238
|
d.x,
|
|
234
239
|
d.y,
|
|
235
240
|
u.axis || "both",
|
|
@@ -237,7 +242,7 @@ function yt(e, t, n, s) {
|
|
|
237
242
|
t ?? { width: 0, height: 0 }
|
|
238
243
|
) : d;
|
|
239
244
|
}
|
|
240
|
-
const
|
|
245
|
+
const X = {
|
|
241
246
|
forDrag: ["Enter", "Space"],
|
|
242
247
|
forCancel: ["Escape"],
|
|
243
248
|
forDrop: ["Enter", "Space"],
|
|
@@ -253,15 +258,15 @@ const Y = {
|
|
|
253
258
|
],
|
|
254
259
|
forMoveFaster: ["ShiftLeft", "ShiftRight"]
|
|
255
260
|
};
|
|
256
|
-
function
|
|
257
|
-
const n = V(), s =
|
|
261
|
+
function wt(e, t) {
|
|
262
|
+
const n = V(), s = q(), r = {
|
|
258
263
|
keys: {
|
|
259
|
-
pressedKeys:
|
|
260
|
-
forDrag: [...
|
|
261
|
-
forCancel: [...
|
|
262
|
-
forDrop: [...
|
|
263
|
-
forMove: [...
|
|
264
|
-
forMoveFaster: [...
|
|
264
|
+
pressedKeys: q(/* @__PURE__ */ new Set()),
|
|
265
|
+
forDrag: [...X.forDrag],
|
|
266
|
+
forCancel: [...X.forCancel],
|
|
267
|
+
forDrop: [...X.forDrop],
|
|
268
|
+
forMove: [...X.forMove],
|
|
269
|
+
forMoveFaster: [...X.forMoveFaster]
|
|
265
270
|
},
|
|
266
271
|
step: 8,
|
|
267
272
|
moveFaster: 4
|
|
@@ -275,13 +280,13 @@ function Dt(e, t) {
|
|
|
275
280
|
draggingMap: /* @__PURE__ */ new Map(),
|
|
276
281
|
selectedSet: /* @__PURE__ */ new Set(),
|
|
277
282
|
selectionBase: /* @__PURE__ */ new Set(),
|
|
278
|
-
allowedDroppableSet: b(() => n.value ?
|
|
283
|
+
allowedDroppableSet: b(() => n.value ? lt(
|
|
279
284
|
a.visibleDroppableSet,
|
|
280
285
|
a.draggingMap,
|
|
281
286
|
a.draggableMap,
|
|
282
287
|
a.droppableMap
|
|
283
288
|
) : /* @__PURE__ */ new Set()),
|
|
284
|
-
allowedDraggableSet: b(() => n.value ?
|
|
289
|
+
allowedDraggableSet: b(() => n.value ? ct(
|
|
285
290
|
a.visibleDraggableSet,
|
|
286
291
|
a.draggingMap,
|
|
287
292
|
a.draggableMap
|
|
@@ -295,7 +300,7 @@ function Dt(e, t) {
|
|
|
295
300
|
a.draggableMap,
|
|
296
301
|
a.visibleDraggableSet,
|
|
297
302
|
r.keys.pressedKeys,
|
|
298
|
-
(
|
|
303
|
+
(w) => Ee(w, { entities: a })
|
|
299
304
|
)),
|
|
300
305
|
visibleDraggableSet: /* @__PURE__ */ new Set(),
|
|
301
306
|
visibleDroppableSet: /* @__PURE__ */ new Set(),
|
|
@@ -306,33 +311,33 @@ function Dt(e, t) {
|
|
|
306
311
|
}), c = {
|
|
307
312
|
throttle: V(0)
|
|
308
313
|
}, l = $({
|
|
309
|
-
x: window.scrollX,
|
|
310
|
-
y: window.scrollY
|
|
314
|
+
x: typeof window < "u" ? window.scrollX : 0,
|
|
315
|
+
y: typeof window < "u" ? window.scrollY : 0
|
|
311
316
|
}), u = $({
|
|
312
317
|
progress: 0,
|
|
313
318
|
startTime: 0
|
|
314
319
|
}), g = b(() => {
|
|
315
320
|
if (!s.value || !a.initiatingDraggable) return 0;
|
|
316
|
-
const
|
|
317
|
-
return
|
|
321
|
+
const w = a.draggableMap.get(a.initiatingDraggable)?.activation?.distance;
|
|
322
|
+
return w ? dt(s.value, w) : 1;
|
|
318
323
|
}), f = re(
|
|
319
324
|
a.visibleDraggableSet
|
|
320
325
|
), d = re(
|
|
321
326
|
a.visibleDroppableSet
|
|
322
|
-
),
|
|
327
|
+
), h = re(
|
|
323
328
|
a.visibleSelectableAreaSet
|
|
324
|
-
),
|
|
329
|
+
), m = q(), y = V(typeof DOMRect < "u" ? new DOMRect() : {}), p = b(() => {
|
|
325
330
|
l.x, l.y;
|
|
326
|
-
const
|
|
327
|
-
return
|
|
331
|
+
const D = y.value, w = a.initiatingDraggable, T = w ? a.draggingMap.get(w) : null, P = D.width && D.height ? D : T?.initialRect ?? null;
|
|
332
|
+
return Dt(
|
|
328
333
|
s.value,
|
|
329
334
|
P,
|
|
330
|
-
|
|
335
|
+
w || null,
|
|
331
336
|
a.constraintsAreaMap
|
|
332
337
|
);
|
|
333
|
-
}),
|
|
338
|
+
}), x = b({
|
|
334
339
|
get: () => t?.previewTo,
|
|
335
|
-
set: (
|
|
340
|
+
set: (D) => x.value = D
|
|
336
341
|
}), k = b(() => t?.autoScrollViewport);
|
|
337
342
|
return {
|
|
338
343
|
state: n,
|
|
@@ -345,22 +350,22 @@ function Dt(e, t) {
|
|
|
345
350
|
hovered: o,
|
|
346
351
|
collision: c,
|
|
347
352
|
preview: {
|
|
348
|
-
size:
|
|
353
|
+
size: y,
|
|
349
354
|
position: p,
|
|
350
|
-
render:
|
|
355
|
+
render: m,
|
|
351
356
|
ref: e,
|
|
352
|
-
to:
|
|
357
|
+
to: x
|
|
353
358
|
},
|
|
354
359
|
lib: {
|
|
355
360
|
draggableObserver: f,
|
|
356
361
|
droppableObserver: d,
|
|
357
|
-
selectableAreaObserver:
|
|
362
|
+
selectableAreaObserver: h,
|
|
358
363
|
rectCache: /* @__PURE__ */ new Map()
|
|
359
364
|
},
|
|
360
365
|
autoScrollViewport: k
|
|
361
366
|
};
|
|
362
367
|
}
|
|
363
|
-
const
|
|
368
|
+
const te = (e) => {
|
|
364
369
|
const t = e.hovered.draggable.keys().next().value;
|
|
365
370
|
if (t) {
|
|
366
371
|
const s = e.entities.draggableMap.get(t);
|
|
@@ -378,7 +383,7 @@ function St(e) {
|
|
|
378
383
|
G.SELECT_AREA
|
|
379
384
|
) ?? null;
|
|
380
385
|
}
|
|
381
|
-
const
|
|
386
|
+
const Mt = (e, t, n) => {
|
|
382
387
|
if (!n) return {};
|
|
383
388
|
const s = n.getBoundingClientRect(), i = Math.max(s.left, Math.min(e.x, t.x)), r = Math.max(s.top, Math.min(e.y, t.y)), a = Math.min(s.right, Math.max(e.x, t.x)), o = Math.min(s.bottom, Math.max(e.y, t.y)), c = Math.max(0, a - i), l = Math.max(0, o - r), u = i - s.left + n.scrollLeft, g = r - s.top + n.scrollTop;
|
|
384
389
|
return {
|
|
@@ -391,9 +396,9 @@ const wt = (e, t, n) => {
|
|
|
391
396
|
border: "1px solid #3b82f6",
|
|
392
397
|
backgroundColor: "#3b82f61a"
|
|
393
398
|
};
|
|
394
|
-
},
|
|
399
|
+
}, Ne = (e) => {
|
|
395
400
|
if (!e.pointer.value || !e.entities.selectingArea) return;
|
|
396
|
-
const { selectingArea: t } = e.entities, n =
|
|
401
|
+
const { selectingArea: t } = e.entities, n = vt(
|
|
397
402
|
e.pointer.value.start,
|
|
398
403
|
e.pointer.value.current
|
|
399
404
|
), s = e.entities.selectableAreaMap.get(t)?.groups ?? [], i = e.lib.rectCache;
|
|
@@ -404,18 +409,18 @@ const wt = (e, t, n) => {
|
|
|
404
409
|
e.entities.selectedSet.delete(r);
|
|
405
410
|
return;
|
|
406
411
|
}
|
|
407
|
-
if (
|
|
412
|
+
if (Ee(r, e)) {
|
|
408
413
|
e.entities.selectedSet.delete(r);
|
|
409
414
|
return;
|
|
410
415
|
}
|
|
411
416
|
const c = e.entities.draggableMap.get(r)?.groups ?? [];
|
|
412
|
-
if (!
|
|
417
|
+
if (!se(s, c)) {
|
|
413
418
|
e.entities.selectedSet.delete(r);
|
|
414
419
|
return;
|
|
415
420
|
}
|
|
416
421
|
let l = i.get(r);
|
|
417
422
|
l || (l = r.getBoundingClientRect(), i.set(r, l));
|
|
418
|
-
const u = e.entities.selectionBase.has(r), g =
|
|
423
|
+
const u = e.entities.selectionBase.has(r), g = rt(n, l);
|
|
419
424
|
switch (e.entities.selectableAreaMap.get(t)?.strategy) {
|
|
420
425
|
case "toggle":
|
|
421
426
|
e.entities.selectedSet[g !== u ? "add" : "delete"](
|
|
@@ -427,7 +432,7 @@ const wt = (e, t, n) => {
|
|
|
427
432
|
break;
|
|
428
433
|
}
|
|
429
434
|
});
|
|
430
|
-
},
|
|
435
|
+
}, vt = (e, t) => {
|
|
431
436
|
const n = Math.min(e.x, t.x), s = Math.min(e.y, t.y), i = Math.max(e.x, t.x), r = Math.max(e.y, t.y), a = i - n, o = r - s;
|
|
432
437
|
return new DOMRect(n, s, a, o);
|
|
433
438
|
};
|
|
@@ -445,7 +450,7 @@ function N(e, t) {
|
|
|
445
450
|
for (const i of n) s = Le(s, i, 1);
|
|
446
451
|
return s;
|
|
447
452
|
}
|
|
448
|
-
function
|
|
453
|
+
function Ye(e, t, n) {
|
|
449
454
|
if (t === n || t < 0 || n < 0 || t >= e.length || n >= e.length)
|
|
450
455
|
return e;
|
|
451
456
|
const s = [...e];
|
|
@@ -462,7 +467,7 @@ const R = {
|
|
|
462
467
|
return R.getInsertSide(e, t) === "after" && !e?.center;
|
|
463
468
|
}
|
|
464
469
|
};
|
|
465
|
-
function
|
|
470
|
+
function Xe(e, t) {
|
|
466
471
|
const { draggedItems: n, dropZone: s, hoveredDraggable: i } = e;
|
|
467
472
|
if (!n.length) return null;
|
|
468
473
|
const r = i?.placement.center === !0 && s != null && s.items !== i.items, a = r ? s.items : i?.items ?? s?.items;
|
|
@@ -478,8 +483,8 @@ function Ye(e, t) {
|
|
|
478
483
|
if (f)
|
|
479
484
|
return null;
|
|
480
485
|
{
|
|
481
|
-
const d = R.getInsertSide(i.placement, t),
|
|
482
|
-
d === "before" ? (u = Math.max(0,
|
|
486
|
+
const d = R.getInsertSide(i.placement, t), h = i.index;
|
|
487
|
+
d === "before" ? (u = Math.max(0, h), g = "insert") : d === "after" ? (u = Math.min(l, h + 1), g = "insert") : (u = l, g = "append");
|
|
483
488
|
}
|
|
484
489
|
}
|
|
485
490
|
} else {
|
|
@@ -492,7 +497,7 @@ function Ye(e, t) {
|
|
|
492
497
|
function At(e, t = "vertical") {
|
|
493
498
|
const { draggedItems: n } = e;
|
|
494
499
|
if (!n.length) return null;
|
|
495
|
-
const s =
|
|
500
|
+
const s = Xe(e, t);
|
|
496
501
|
if (!s) return null;
|
|
497
502
|
const { targetArr: i, mode: r } = s;
|
|
498
503
|
let { targetIndex: a } = s;
|
|
@@ -507,7 +512,7 @@ function At(e, t = "vertical") {
|
|
|
507
512
|
return { sourceItems: g, targetItems: f, draggedItems: c, sourceIndexes: o, targetIndex: a, mode: r, sameList: !1 };
|
|
508
513
|
}
|
|
509
514
|
}
|
|
510
|
-
function
|
|
515
|
+
function xt(e) {
|
|
511
516
|
const { draggedItems: t, hoveredDraggable: n } = e;
|
|
512
517
|
if (!t.length || !n) return null;
|
|
513
518
|
const s = t.map((u) => u.index), i = n.index, r = t.map((u) => u.item), a = n.item, o = t[0].items, c = n.items, l = o === c;
|
|
@@ -515,7 +520,7 @@ function vt(e) {
|
|
|
515
520
|
if (t.length === 1) {
|
|
516
521
|
const u = s[0];
|
|
517
522
|
if (l) {
|
|
518
|
-
const g =
|
|
523
|
+
const g = Ye(o, u, i);
|
|
519
524
|
return { sourceItems: g, targetItems: g, sourceIndexes: s, targetIndex: i, sameList: !0 };
|
|
520
525
|
} else {
|
|
521
526
|
const g = [...o], f = [...c];
|
|
@@ -524,29 +529,29 @@ function vt(e) {
|
|
|
524
529
|
} else {
|
|
525
530
|
const u = Math.min(...s);
|
|
526
531
|
if (l) {
|
|
527
|
-
const g = s.filter((p) => p < i).length, f = Math.max(0, i - g), d = s.filter((p) => p < u).length,
|
|
528
|
-
let
|
|
529
|
-
|
|
530
|
-
const
|
|
531
|
-
return
|
|
532
|
+
const g = s.filter((p) => p < i).length, f = Math.max(0, i - g), d = s.filter((p) => p < u).length, h = Math.max(0, u - d);
|
|
533
|
+
let m = N(o, s);
|
|
534
|
+
m = C(m, f, r);
|
|
535
|
+
const y = h >= f ? h + r.length : h;
|
|
536
|
+
return m = C(m, y, [a]), { sourceItems: m, targetItems: m, sourceIndexes: s, targetIndex: f, sameList: !0 };
|
|
532
537
|
} else {
|
|
533
|
-
const g = s.filter((
|
|
538
|
+
const g = s.filter((m) => m < u).length, f = Math.max(0, u - g);
|
|
534
539
|
let d = N(o, s);
|
|
535
540
|
d = C(d, f, [a]);
|
|
536
|
-
let
|
|
537
|
-
return
|
|
541
|
+
let h = Le(c, i);
|
|
542
|
+
return h = C(h, i, r), { sourceItems: d, targetItems: h, sourceIndexes: s, targetIndex: i, sameList: !1 };
|
|
538
543
|
}
|
|
539
544
|
}
|
|
540
545
|
}
|
|
541
546
|
function Et(e, t = "vertical") {
|
|
542
547
|
const { draggedItems: n } = e;
|
|
543
548
|
if (!n.length) return null;
|
|
544
|
-
const s =
|
|
549
|
+
const s = Xe(e, t);
|
|
545
550
|
if (!s) return null;
|
|
546
551
|
const { targetArr: i, targetIndex: r, mode: a } = s, o = n.map((l) => l.item);
|
|
547
552
|
return { targetItems: C(i, r, o), copiedItems: o, targetIndex: r, mode: a };
|
|
548
553
|
}
|
|
549
|
-
function
|
|
554
|
+
function Lt(e) {
|
|
550
555
|
const { draggedItems: t } = e;
|
|
551
556
|
if (!t.length) return null;
|
|
552
557
|
const n = t.map((a) => a.index), s = t.map((a) => a.item), i = t[0].items;
|
|
@@ -558,22 +563,22 @@ function Ve(e) {
|
|
|
558
563
|
insertAt: C,
|
|
559
564
|
removeAt: Le,
|
|
560
565
|
removeIndexes: N,
|
|
561
|
-
swapAt:
|
|
566
|
+
swapAt: Ye,
|
|
562
567
|
// Placement helpers
|
|
563
568
|
getInsertSide: (t, n) => R.getInsertSide(t, n),
|
|
564
569
|
isAtZoneStart: (t, n) => R.isAtZoneStart(t, n),
|
|
565
570
|
isAtZoneEnd: (t, n) => R.isAtZoneEnd(t, n),
|
|
566
571
|
// High-level (event-bound)
|
|
567
572
|
suggestSort: (t) => At(e, t),
|
|
568
|
-
suggestSwap: () =>
|
|
573
|
+
suggestSwap: () => xt(e),
|
|
569
574
|
suggestCopy: (t) => Et(e, t),
|
|
570
|
-
suggestRemove: () =>
|
|
575
|
+
suggestRemove: () => Lt(e)
|
|
571
576
|
};
|
|
572
577
|
}
|
|
573
|
-
const O = (e) => e.keys().next().value,
|
|
578
|
+
const O = (e) => e.keys().next().value, Ct = (e) => e.target.closest(
|
|
574
579
|
G.DRAGGABLE
|
|
575
580
|
);
|
|
576
|
-
function
|
|
581
|
+
function Ze(e, t) {
|
|
577
582
|
const n = t.entities.draggingMap.get(e);
|
|
578
583
|
if (n) return n;
|
|
579
584
|
const s = e.getAttribute(I.DRAGGABLE);
|
|
@@ -582,10 +587,10 @@ function Xe(e, t) {
|
|
|
582
587
|
if (i.id === s) return i;
|
|
583
588
|
}
|
|
584
589
|
}
|
|
585
|
-
function
|
|
590
|
+
function It(e) {
|
|
586
591
|
const t = e.entities.initiatingDraggable;
|
|
587
592
|
if (!t) return [];
|
|
588
|
-
const n =
|
|
593
|
+
const n = Ze(t, e) ?? e.entities.draggableMap.get(t), s = n?.payload;
|
|
589
594
|
if (!s)
|
|
590
595
|
return n?.data ? [{ index: -1, item: void 0, items: [], data: n.data() }] : [];
|
|
591
596
|
const i = s();
|
|
@@ -599,21 +604,21 @@ function Ct(e) {
|
|
|
599
604
|
}), e.entities.draggingMap.forEach((u, g) => {
|
|
600
605
|
const f = e.entities.draggableMap.get(g), d = f?.payload;
|
|
601
606
|
if (!d) return;
|
|
602
|
-
const
|
|
603
|
-
if (!Array.isArray(
|
|
604
|
-
const [
|
|
605
|
-
if (
|
|
606
|
-
const p = Number(
|
|
607
|
+
const h = d();
|
|
608
|
+
if (!Array.isArray(h) || h.length < 2) return;
|
|
609
|
+
const [m, y] = h;
|
|
610
|
+
if (y !== c) return;
|
|
611
|
+
const p = Number(m);
|
|
607
612
|
l.has(p) || l.set(p, {
|
|
608
613
|
index: p,
|
|
609
|
-
item:
|
|
614
|
+
item: y[p],
|
|
610
615
|
items: c,
|
|
611
616
|
data: f?.data?.()
|
|
612
617
|
});
|
|
613
618
|
}), [...l.values()].sort((u, g) => u.index - g.index);
|
|
614
619
|
}
|
|
615
|
-
const
|
|
616
|
-
const n =
|
|
620
|
+
const A = (e, t) => {
|
|
621
|
+
const n = It(e);
|
|
617
622
|
let s, i;
|
|
618
623
|
if (t) {
|
|
619
624
|
const r = e.entities.droppableMap.get(t);
|
|
@@ -631,13 +636,13 @@ const v = (e, t) => {
|
|
|
631
636
|
if (l) {
|
|
632
637
|
const f = l();
|
|
633
638
|
if (Array.isArray(f) && f.length >= 2) {
|
|
634
|
-
const [d,
|
|
639
|
+
const [d, h] = f, m = Number(d);
|
|
635
640
|
i = {
|
|
636
641
|
element: a,
|
|
637
642
|
placement: u ?? g,
|
|
638
|
-
index:
|
|
639
|
-
item: m
|
|
640
|
-
items:
|
|
643
|
+
index: m,
|
|
644
|
+
item: h[m],
|
|
645
|
+
items: h,
|
|
641
646
|
data: c?.data?.()
|
|
642
647
|
};
|
|
643
648
|
}
|
|
@@ -660,27 +665,27 @@ const v = (e, t) => {
|
|
|
660
665
|
};
|
|
661
666
|
}, F = (e, t, n) => {
|
|
662
667
|
if (!t) return;
|
|
663
|
-
const s =
|
|
664
|
-
!s || s.disabled || s.events?.[n]?.(
|
|
665
|
-
},
|
|
666
|
-
const n =
|
|
668
|
+
const s = Ze(t, e) ?? e.entities.draggableMap.get(t);
|
|
669
|
+
!s || s.disabled || s.events?.[n]?.(A(e));
|
|
670
|
+
}, v = (e, t) => {
|
|
671
|
+
const n = A(e);
|
|
667
672
|
e.entities.draggingMap.forEach((s) => {
|
|
668
673
|
s.disabled || s.events?.[t]?.(n);
|
|
669
674
|
});
|
|
670
|
-
},
|
|
675
|
+
}, Rt = (e, t, n) => {
|
|
671
676
|
if (t !== n) {
|
|
672
677
|
if (t && !K(t, e)) {
|
|
673
|
-
const s =
|
|
678
|
+
const s = A(e, t);
|
|
674
679
|
e.entities.droppableMap.get(t)?.events?.onLeave?.(s);
|
|
675
680
|
}
|
|
676
681
|
if (n && !K(n, e)) {
|
|
677
|
-
const s =
|
|
682
|
+
const s = A(e, n);
|
|
678
683
|
e.entities.droppableMap.get(n)?.events?.onEnter?.(s);
|
|
679
684
|
}
|
|
680
685
|
}
|
|
681
|
-
},
|
|
686
|
+
}, kt = (e, t, n) => {
|
|
682
687
|
if (t !== n) {
|
|
683
|
-
const s =
|
|
688
|
+
const s = A(e);
|
|
684
689
|
if (t) {
|
|
685
690
|
const i = e.entities.draggableMap.get(t);
|
|
686
691
|
i && !i.disabled && i.events?.onLeave?.(s);
|
|
@@ -691,15 +696,15 @@ const v = (e, t) => {
|
|
|
691
696
|
}
|
|
692
697
|
}
|
|
693
698
|
}, le = (e, t, n) => {
|
|
694
|
-
const s =
|
|
695
|
-
!s || !e.entities.draggingMap.has(s) || e.entities.draggingMap.get(s)?.events?.[n]?.(
|
|
696
|
-
},
|
|
699
|
+
const s = Ct(t);
|
|
700
|
+
!s || !e.entities.draggingMap.has(s) || e.entities.draggingMap.get(s)?.events?.[n]?.(A(e));
|
|
701
|
+
}, Tt = (e, t) => {
|
|
697
702
|
const n = O(t.droppable);
|
|
698
|
-
n && !K(n, e) && e.entities.droppableMap.get(n)?.events?.onLeave?.(
|
|
699
|
-
},
|
|
703
|
+
n && !K(n, e) && e.entities.droppableMap.get(n)?.events?.onLeave?.(A(e, n));
|
|
704
|
+
}, we = (e, t) => {
|
|
700
705
|
const n = O(t.droppable);
|
|
701
|
-
n && !K(n, e) && e.entities.droppableMap.get(n)?.events?.onLeave?.(
|
|
702
|
-
},
|
|
706
|
+
n && !K(n, e) && e.entities.droppableMap.get(n)?.events?.onLeave?.(A(e, n));
|
|
707
|
+
}, Pt = (e, t, n = 5) => {
|
|
703
708
|
const s = n / 2;
|
|
704
709
|
return {
|
|
705
710
|
left: e - s,
|
|
@@ -707,14 +712,14 @@ const v = (e, t) => {
|
|
|
707
712
|
width: n,
|
|
708
713
|
height: n
|
|
709
714
|
};
|
|
710
|
-
},
|
|
715
|
+
}, Bt = (e) => {
|
|
711
716
|
const t = e.pointer.value?.current, n = t?.x ?? 0, s = t?.y ?? 0;
|
|
712
|
-
return
|
|
717
|
+
return Pt(n, s, 5);
|
|
713
718
|
}, B = (e, t, n) => {
|
|
714
719
|
const s = e.left + e.width / 2, i = e.top + e.height / 2;
|
|
715
720
|
if (n) {
|
|
716
|
-
const o = n.top ?? 0, c = n.right ?? 0, l = n.bottom ?? 0, u = n.left ?? 0, g = t.left + u, f = t.right - c, d = t.top + o,
|
|
717
|
-
if (g < f && d <
|
|
721
|
+
const o = n.top ?? 0, c = n.right ?? 0, l = n.bottom ?? 0, u = n.left ?? 0, g = t.left + u, f = t.right - c, d = t.top + o, h = t.bottom - l;
|
|
722
|
+
if (g < f && d < h && s >= g && s <= f && i >= d && i <= h)
|
|
718
723
|
return {
|
|
719
724
|
top: !1,
|
|
720
725
|
right: !1,
|
|
@@ -731,43 +736,43 @@ const v = (e, t) => {
|
|
|
731
736
|
right: s > r,
|
|
732
737
|
center: !1
|
|
733
738
|
};
|
|
734
|
-
},
|
|
739
|
+
}, Ot = (e) => ({
|
|
735
740
|
x: e.left + e.width / 2,
|
|
736
741
|
y: e.top + e.height / 2
|
|
737
742
|
}), Re = (e, t) => {
|
|
738
|
-
const n =
|
|
743
|
+
const n = Ot(t);
|
|
739
744
|
return Math.hypot(e.x - n.x, e.y - n.y);
|
|
740
745
|
};
|
|
741
|
-
function
|
|
746
|
+
function Ft(e, t) {
|
|
742
747
|
return e === t ? !0 : !e || !t ? !1 : e.top === t.top && e.right === t.right && e.bottom === t.bottom && e.left === t.left && e.center === t.center;
|
|
743
748
|
}
|
|
744
749
|
function U(e, t) {
|
|
745
|
-
|
|
750
|
+
Ft(e.hoveredPlacement, t) || (e.hoveredPlacement = t);
|
|
746
751
|
}
|
|
747
|
-
const
|
|
752
|
+
const zt = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
748
753
|
const s = O(t.droppable), i = O(t.draggable);
|
|
749
754
|
i && t.draggable.delete(i), s && t.droppable.delete(s);
|
|
750
|
-
const r =
|
|
755
|
+
const r = Bt(e), a = n.zones[0], o = n.elements[0];
|
|
751
756
|
if (a && o && a === o && e.entities.droppableMap.has(a) && a) {
|
|
752
757
|
const g = a.getBoundingClientRect(), f = e.entities.draggableMap.get(a)?.placementMargins, d = B(r, g, f);
|
|
753
758
|
if (d.center) {
|
|
754
759
|
t.droppable.set(a, d);
|
|
755
|
-
const
|
|
756
|
-
if (
|
|
757
|
-
const
|
|
760
|
+
const h = zt(n.elements, a);
|
|
761
|
+
if (h) {
|
|
762
|
+
const m = h.getBoundingClientRect();
|
|
758
763
|
t.draggable.set(
|
|
759
|
-
|
|
760
|
-
B(r,
|
|
764
|
+
h,
|
|
765
|
+
B(r, m, void 0)
|
|
761
766
|
);
|
|
762
767
|
}
|
|
763
768
|
} else {
|
|
764
769
|
t.draggable.set(o, d);
|
|
765
|
-
const
|
|
766
|
-
if (
|
|
767
|
-
const
|
|
770
|
+
const h = n.zones.find((m) => m !== a);
|
|
771
|
+
if (h) {
|
|
772
|
+
const m = h.getBoundingClientRect();
|
|
768
773
|
t.droppable.set(
|
|
769
|
-
|
|
770
|
-
B(r,
|
|
774
|
+
h,
|
|
775
|
+
B(r, m)
|
|
771
776
|
);
|
|
772
777
|
}
|
|
773
778
|
}
|
|
@@ -785,13 +790,13 @@ const Ft = (e, t) => e.find((n) => n !== t && H(t, n)), we = (e, t, n) => {
|
|
|
785
790
|
B(r, g, f)
|
|
786
791
|
);
|
|
787
792
|
} else {
|
|
788
|
-
const g = e.pointer.value?.current ?? { x: 0, y: 0 }, f = a.getBoundingClientRect(), d = o.getBoundingClientRect(),
|
|
789
|
-
if (Re(g, d) <
|
|
793
|
+
const g = e.pointer.value?.current ?? { x: 0, y: 0 }, f = a.getBoundingClientRect(), d = o.getBoundingClientRect(), h = Re(g, f);
|
|
794
|
+
if (Re(g, d) < h) {
|
|
790
795
|
t.droppable.clear();
|
|
791
|
-
const
|
|
796
|
+
const y = e.entities.draggableMap.get(o)?.placementMargins;
|
|
792
797
|
t.draggable.set(
|
|
793
798
|
o,
|
|
794
|
-
B(r, d,
|
|
799
|
+
B(r, d, y)
|
|
795
800
|
);
|
|
796
801
|
}
|
|
797
802
|
}
|
|
@@ -820,7 +825,7 @@ const Ft = (e, t) => e.find((n) => n !== t && H(t, n)), we = (e, t, n) => {
|
|
|
820
825
|
const g = e.entities.droppableMap.get(l);
|
|
821
826
|
g && U(g, t.droppable.get(l));
|
|
822
827
|
}
|
|
823
|
-
|
|
828
|
+
Rt(e, s, l), kt(e, i, u);
|
|
824
829
|
}, ce = (e, t) => e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y, ge = (e) => {
|
|
825
830
|
if (!e)
|
|
826
831
|
return { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 };
|
|
@@ -844,7 +849,7 @@ const Ft = (e, t) => e.find((n) => n !== t && H(t, n)), we = (e, t, n) => {
|
|
|
844
849
|
Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
|
|
845
850
|
), i = n * s, r = e.width * e.height, a = t.width * t.height;
|
|
846
851
|
return r === 0 || a === 0 ? 0 : (i / r * 100 + i / a * 100) / 2;
|
|
847
|
-
},
|
|
852
|
+
}, _t = (e) => e.preview.ref?.value ?? null, ke = (e) => {
|
|
848
853
|
const t = e.preview.position?.value ?? { x: 0, y: 0 }, { x: n, y: s } = t, i = e.preview.size?.value;
|
|
849
854
|
let r, a;
|
|
850
855
|
if (i)
|
|
@@ -863,46 +868,50 @@ const Ft = (e, t) => e.find((n) => n !== t && H(t, n)), we = (e, t, n) => {
|
|
|
863
868
|
right: n + r,
|
|
864
869
|
bottom: s + a
|
|
865
870
|
};
|
|
866
|
-
}, Me = (e) => e.entities.allowedDraggableSet,
|
|
871
|
+
}, Me = (e) => e.entities.allowedDraggableSet, $e = (e) => e.entities.allowedDroppableSet, Gt = (e, t) => !t.entities.draggingMap.has(e), Ht = (e, t) => ![...t.entities.draggingMap.keys()].some((n) => {
|
|
867
872
|
if (H(n, e)) return !0;
|
|
868
873
|
const s = n.parentElement;
|
|
869
874
|
return !!(s && e !== n && !t.entities.draggableMap.has(s) && !t.entities.droppableMap.has(s) && H(s, e) && [
|
|
870
875
|
...t.entities.draggableMap.keys()
|
|
871
876
|
].filter((r) => r.parentElement === s).length === 1);
|
|
872
|
-
}),
|
|
877
|
+
}), Kt = (e, t) => t.entities.draggableMap.has(e) ? !Ee(e, t) : t.entities.droppableMap.has(e) ? !K(e, t) : !0, J = (e, t) => Gt(e, t) && Ht(e, t) && Kt(e, t), fe = 10;
|
|
873
878
|
function _(e, t) {
|
|
874
879
|
return Math.hypot(
|
|
875
880
|
t.x - (e.x + e.width / 2),
|
|
876
881
|
t.y - (e.y + e.height / 2)
|
|
877
882
|
);
|
|
878
883
|
}
|
|
879
|
-
function
|
|
884
|
+
function Te(e, t) {
|
|
885
|
+
const n = Math.max(e.x, Math.min(t.x, e.x + e.width)), s = Math.max(e.y, Math.min(t.y, e.y + e.height));
|
|
886
|
+
return Math.hypot(t.x - n, t.y - s);
|
|
887
|
+
}
|
|
888
|
+
function Nt(e) {
|
|
880
889
|
const t = e.pointer.value?.current ?? { x: 0, y: 0 }, n = document.elementFromPoint(t.x, t.y);
|
|
881
890
|
if (!n) return null;
|
|
882
|
-
const s = Me(e), i =
|
|
891
|
+
const s = Me(e), i = $e(e), r = [], a = [];
|
|
883
892
|
let o = n;
|
|
884
893
|
for (; o; )
|
|
885
|
-
(s.has(o) || i.has(o)) &&
|
|
894
|
+
(s.has(o) || i.has(o)) && J(o, e) && (s.has(o) && r.push(o), i.has(o) && a.push(o)), o = o.parentElement;
|
|
886
895
|
return r.length === 0 && a.length === 0 ? null : { elements: r, zones: a };
|
|
887
896
|
}
|
|
888
|
-
const
|
|
889
|
-
if (!
|
|
890
|
-
const n = e.pointer.value?.current ?? { x: 0, y: 0 }, s =
|
|
897
|
+
const ve = (e) => {
|
|
898
|
+
if (!_t(e)) return { elements: [], zones: [] };
|
|
899
|
+
const n = e.pointer.value?.current ?? { x: 0, y: 0 }, s = Nt(e);
|
|
891
900
|
if (s) {
|
|
892
901
|
if (s.elements.length > 0) return s;
|
|
893
902
|
const l = s.zones[0];
|
|
894
903
|
if (!l) return s;
|
|
895
|
-
const u = ke(e)
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
904
|
+
const u = ke(e), f = [...Me(e)].filter(
|
|
905
|
+
(m) => l.contains(m) && J(m, e)
|
|
906
|
+
).map((m) => ({ el: m, box: ge(m) })), d = f.filter(
|
|
907
|
+
({ box: m }) => ce(m, u) && ue(m, u) >= fe
|
|
908
|
+
).sort((m, y) => _(m.box, n) - _(y.box, n)).map(({ el: m }) => m);
|
|
909
|
+
return d.length > 0 ? { elements: d, zones: s.zones } : { elements: f.sort((m, y) => Te(m.box, n) - Te(y.box, n)).map(({ el: m }) => m), zones: s.zones };
|
|
901
910
|
}
|
|
902
911
|
const i = ke(e), r = [...Me(e)].filter(
|
|
903
|
-
(l) =>
|
|
904
|
-
), a = [
|
|
905
|
-
(l) =>
|
|
912
|
+
(l) => J(l, e)
|
|
913
|
+
), a = [...$e(e)].filter(
|
|
914
|
+
(l) => J(l, e)
|
|
906
915
|
), o = r.map((l) => ({ n: l, box: ge(l) })).filter(
|
|
907
916
|
({ box: l }) => ce(l, i) && ue(l, i) >= fe
|
|
908
917
|
).sort((l, u) => _(l.box, n) - _(u.box, n)).map(({ n: l }) => l), c = a.map((l) => ({ n: l, box: ge(l) })).filter(
|
|
@@ -910,30 +919,30 @@ const Ae = (e) => {
|
|
|
910
919
|
).sort((l, u) => _(l.box, n) - _(u.box, n)).map(({ n: l }) => l);
|
|
911
920
|
return { elements: o, zones: c };
|
|
912
921
|
};
|
|
913
|
-
function
|
|
914
|
-
const t =
|
|
915
|
-
|
|
922
|
+
function Ae(e) {
|
|
923
|
+
const t = ve(e);
|
|
924
|
+
Se(e, e.hovered, t);
|
|
916
925
|
}
|
|
917
|
-
function
|
|
926
|
+
function Yt(e, t) {
|
|
918
927
|
const n = e.collision?.throttle?.value ?? 0;
|
|
919
928
|
if (n <= 0) {
|
|
920
|
-
|
|
929
|
+
Ae(e);
|
|
921
930
|
return;
|
|
922
931
|
}
|
|
923
932
|
const s = Date.now();
|
|
924
|
-
s - t.value >= n && (t.value = s,
|
|
933
|
+
s - t.value >= n && (t.value = s, Ae(e));
|
|
925
934
|
}
|
|
926
|
-
async function
|
|
935
|
+
async function Ue(e) {
|
|
927
936
|
const t = e.hovered.droppable.keys().next().value;
|
|
928
937
|
if (!t || K(t, e)) return "accept";
|
|
929
|
-
const n = e.entities.droppableMap.get(t), s =
|
|
938
|
+
const n = e.entities.droppableMap.get(t), s = A(e, t);
|
|
930
939
|
let i = s;
|
|
931
940
|
if (n?.groupMatch === "some" && (n.groups?.length ?? 0) > 0) {
|
|
932
941
|
const o = n.groups, c = s.draggedItems.filter((u) => {
|
|
933
942
|
for (const [, g] of e.entities.draggingMap) {
|
|
934
943
|
const f = g.payload?.();
|
|
935
944
|
if (!(!Array.isArray(f) || f.length < 2) && Number(f[0]) === u.index && f[1] === u.items)
|
|
936
|
-
return
|
|
945
|
+
return se(g.groups ?? [], o);
|
|
937
946
|
}
|
|
938
947
|
return !0;
|
|
939
948
|
}), l = s.draggedItems.filter(
|
|
@@ -958,16 +967,16 @@ async function $e(e) {
|
|
|
958
967
|
try {
|
|
959
968
|
d = await g;
|
|
960
969
|
} catch {
|
|
961
|
-
const
|
|
962
|
-
return F(e,
|
|
970
|
+
const m = e.entities.initiatingDraggable;
|
|
971
|
+
return F(e, m, "onSelfDragCancel"), v(e, "onDragCancel"), we(e, e.hovered), "cancel";
|
|
963
972
|
}
|
|
964
973
|
} else
|
|
965
974
|
d = g;
|
|
966
975
|
if (d === !1)
|
|
967
976
|
return e.state.value = "dragging", "decline";
|
|
968
|
-
const
|
|
969
|
-
if (
|
|
970
|
-
i = u(
|
|
977
|
+
const h = Array.isArray(d) ? d : c;
|
|
978
|
+
if (h.length === 0) return "accept";
|
|
979
|
+
i = u(h);
|
|
971
980
|
} else {
|
|
972
981
|
if (c.length === 0) return "accept";
|
|
973
982
|
i = u(c);
|
|
@@ -982,17 +991,17 @@ async function $e(e) {
|
|
|
982
991
|
o = await r;
|
|
983
992
|
} catch {
|
|
984
993
|
const c = e.entities.initiatingDraggable;
|
|
985
|
-
return F(e, c, "onSelfDragCancel"),
|
|
994
|
+
return F(e, c, "onSelfDragCancel"), v(e, "onDragCancel"), we(e, e.hovered), "cancel";
|
|
986
995
|
}
|
|
987
996
|
return o === !1 ? (e.state.value = "dragging", "decline") : "accept";
|
|
988
997
|
}
|
|
989
998
|
return r === !1 ? "decline" : "accept";
|
|
990
999
|
}
|
|
991
|
-
function
|
|
1000
|
+
function qe(e) {
|
|
992
1001
|
const t = e.entities.initiatingDraggable;
|
|
993
|
-
F(e, t, "onSelfDragEnd"),
|
|
1002
|
+
F(e, t, "onSelfDragEnd"), v(e, "onDragEnd"), Tt(e, e.hovered);
|
|
994
1003
|
}
|
|
995
|
-
function
|
|
1004
|
+
function Xt(e) {
|
|
996
1005
|
const t = e.entities.selectingArea;
|
|
997
1006
|
if (!t) return;
|
|
998
1007
|
const n = e.entities.selectableAreaMap.get(t), s = [...e.entities.selectedSet];
|
|
@@ -1005,26 +1014,26 @@ const Vt = (e) => {
|
|
|
1005
1014
|
ye(), t.current?.cancel(), t.current = null;
|
|
1006
1015
|
const o = e.state.value;
|
|
1007
1016
|
if (o === "dragging") {
|
|
1008
|
-
const c = await
|
|
1009
|
-
if (c === "accept" &&
|
|
1010
|
-
|
|
1017
|
+
const c = await Ue(e);
|
|
1018
|
+
if (c === "accept" && qe(e), c === "accept" || c === "cancel") {
|
|
1019
|
+
te(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i);
|
|
1011
1020
|
return;
|
|
1012
1021
|
}
|
|
1013
1022
|
return;
|
|
1014
|
-
} else o === "selecting" &&
|
|
1015
|
-
|
|
1023
|
+
} else o === "selecting" && Xt(e);
|
|
1024
|
+
te(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i);
|
|
1016
1025
|
}, i = (o) => {
|
|
1017
1026
|
if (e.pointer.value && e.state.value !== "pending") {
|
|
1018
|
-
if (e.pointer.value.current = { x: o.clientX, y: o.clientY },
|
|
1019
|
-
le(e, o, "onSelfDragStart"),
|
|
1027
|
+
if (e.pointer.value.current = { x: o.clientX, y: o.clientY }, mt(e)) {
|
|
1028
|
+
le(e, o, "onSelfDragStart"), v(e, "onDragStart");
|
|
1020
1029
|
return;
|
|
1021
1030
|
}
|
|
1022
1031
|
if (e.state.value === "dragging") {
|
|
1023
|
-
|
|
1032
|
+
Yt(e, n);
|
|
1024
1033
|
const c = e.entities.initiatingDraggable;
|
|
1025
|
-
F(e, c, "onSelfDragMove"),
|
|
1034
|
+
F(e, c, "onSelfDragMove"), v(e, "onDragMove");
|
|
1026
1035
|
}
|
|
1027
|
-
e.state.value === "selecting" &&
|
|
1036
|
+
e.state.value === "selecting" && Ne(e);
|
|
1028
1037
|
}
|
|
1029
1038
|
};
|
|
1030
1039
|
return { pointerDown: (o) => {
|
|
@@ -1040,18 +1049,18 @@ const Vt = (e) => {
|
|
|
1040
1049
|
}
|
|
1041
1050
|
if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(u)) {
|
|
1042
1051
|
const g = e.entities.draggableMap.get(u);
|
|
1043
|
-
if (!
|
|
1052
|
+
if (!He(c, u, g?.dragHandle))
|
|
1044
1053
|
return;
|
|
1045
1054
|
pe(), e.entities.initiatingDraggable = u;
|
|
1046
|
-
const f =
|
|
1047
|
-
e.pointer.value = De(o, f.x, f.y), g?.activation?.distance || g?.activation?.delay ? (e.state.value = "activating", g?.activation?.delay && (e.delay.startTime = Date.now(), t.current =
|
|
1048
|
-
|
|
1049
|
-
}))) : (
|
|
1055
|
+
const f = _e(o, u);
|
|
1056
|
+
e.pointer.value = De(o, f.x, f.y), g?.activation?.distance || g?.activation?.delay ? (e.state.value = "activating", g?.activation?.delay && (e.delay.startTime = Date.now(), t.current = ht(e, () => {
|
|
1057
|
+
ee(e), le(e, o, "onSelfDragStart"), v(e, "onDragStart");
|
|
1058
|
+
}))) : (ee(e), le(e, o, "onSelfDragStart"), v(e, "onDragStart"));
|
|
1050
1059
|
}
|
|
1051
1060
|
}, pointerUp: s, pointerMove: i, cleanup: () => {
|
|
1052
1061
|
t.current?.cancel(), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i), e.lib.draggableObserver.disconnect(), e.lib.droppableObserver.disconnect(), e.lib.selectableAreaObserver.disconnect();
|
|
1053
1062
|
} };
|
|
1054
|
-
},
|
|
1063
|
+
}, Zt = {
|
|
1055
1064
|
ArrowUp: { dx: 0, dy: -1 },
|
|
1056
1065
|
ArrowDown: { dx: 0, dy: 1 },
|
|
1057
1066
|
ArrowLeft: { dx: -1, dy: 0 },
|
|
@@ -1060,7 +1069,7 @@ const Vt = (e) => {
|
|
|
1060
1069
|
KeyA: { dx: -1, dy: 0 },
|
|
1061
1070
|
KeyS: { dx: 0, dy: 1 },
|
|
1062
1071
|
KeyD: { dx: 1, dy: 0 }
|
|
1063
|
-
},
|
|
1072
|
+
}, $t = (e) => (t) => {
|
|
1064
1073
|
const { keys: n } = e.keyboard;
|
|
1065
1074
|
if (n.pressedKeys.value.add(t.code), e.state.value === "dragging") {
|
|
1066
1075
|
if (n.forCancel.includes(t.code)) {
|
|
@@ -1068,14 +1077,14 @@ const Vt = (e) => {
|
|
|
1068
1077
|
e,
|
|
1069
1078
|
e.entities.initiatingDraggable,
|
|
1070
1079
|
"onSelfDragCancel"
|
|
1071
|
-
),
|
|
1080
|
+
), v(e, "onDragCancel"), we(e, e.hovered), te(e);
|
|
1072
1081
|
return;
|
|
1073
1082
|
}
|
|
1074
1083
|
if (n.forDrop.includes(t.code)) {
|
|
1075
|
-
t.preventDefault(), (async () => (await
|
|
1084
|
+
t.preventDefault(), (async () => (await Ue(e) && qe(e), ye(), te(e)))();
|
|
1076
1085
|
return;
|
|
1077
1086
|
}
|
|
1078
|
-
const i =
|
|
1087
|
+
const i = Zt[t.code];
|
|
1079
1088
|
if (i && n.forMove.includes(t.code) && e.pointer.value) {
|
|
1080
1089
|
t.preventDefault();
|
|
1081
1090
|
const r = n.forMoveFaster.some(
|
|
@@ -1085,12 +1094,12 @@ const Vt = (e) => {
|
|
|
1085
1094
|
x: e.pointer.value.current.x + i.dx * a,
|
|
1086
1095
|
y: e.pointer.value.current.y + i.dy * a
|
|
1087
1096
|
};
|
|
1088
|
-
const o =
|
|
1089
|
-
|
|
1097
|
+
const o = ve(e);
|
|
1098
|
+
Se(e, e.hovered, o), F(
|
|
1090
1099
|
e,
|
|
1091
1100
|
e.entities.initiatingDraggable,
|
|
1092
1101
|
"onSelfDragMove"
|
|
1093
|
-
),
|
|
1102
|
+
), v(e, "onDragMove");
|
|
1094
1103
|
return;
|
|
1095
1104
|
}
|
|
1096
1105
|
return;
|
|
@@ -1104,7 +1113,7 @@ const Vt = (e) => {
|
|
|
1104
1113
|
if (!r || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(r))
|
|
1105
1114
|
return;
|
|
1106
1115
|
const a = e.entities.draggableMap.get(r);
|
|
1107
|
-
if (!
|
|
1116
|
+
if (!He(i, r, a?.dragHandle, !0))
|
|
1108
1117
|
return;
|
|
1109
1118
|
t.preventDefault(), pe();
|
|
1110
1119
|
const o = r.getBoundingClientRect(), c = o.left + o.width / 2, l = o.top + o.height / 2, u = {
|
|
@@ -1112,54 +1121,54 @@ const Vt = (e) => {
|
|
|
1112
1121
|
clientY: l
|
|
1113
1122
|
};
|
|
1114
1123
|
e.entities.initiatingDraggable = r;
|
|
1115
|
-
const g =
|
|
1124
|
+
const g = _e(u, r);
|
|
1116
1125
|
e.pointer.value = De(
|
|
1117
1126
|
u,
|
|
1118
1127
|
g.x,
|
|
1119
1128
|
g.y
|
|
1120
|
-
),
|
|
1121
|
-
const f =
|
|
1122
|
-
|
|
1129
|
+
), ee(e);
|
|
1130
|
+
const f = ve(e);
|
|
1131
|
+
Se(e, e.hovered, f), F(e, r, "onSelfDragStart"), v(e, "onDragStart");
|
|
1123
1132
|
}
|
|
1124
|
-
},
|
|
1133
|
+
}, Ut = (e) => (t) => {
|
|
1125
1134
|
e.keyboard.keys.pressedKeys.value.delete(t.code);
|
|
1126
|
-
},
|
|
1135
|
+
}, qt = (e) => () => {
|
|
1127
1136
|
e.keyboard.keys.pressedKeys.value.clear();
|
|
1128
1137
|
}, de = {
|
|
1129
|
-
keyDown:
|
|
1130
|
-
keyUp:
|
|
1131
|
-
clear:
|
|
1132
|
-
},
|
|
1138
|
+
keyDown: $t,
|
|
1139
|
+
keyUp: Ut,
|
|
1140
|
+
clear: qt
|
|
1141
|
+
}, jt = (e) => () => {
|
|
1133
1142
|
if (!e.state.value) return;
|
|
1134
1143
|
const t = e.scrollPosition.x, n = e.scrollPosition.y;
|
|
1135
1144
|
if (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY, e.lib.rectCache.clear(), e.state.value === "dragging") {
|
|
1136
|
-
|
|
1145
|
+
Ae(e);
|
|
1137
1146
|
return;
|
|
1138
1147
|
}
|
|
1139
1148
|
if (e.state.value === "selecting" && e.pointer.value) {
|
|
1140
1149
|
const s = window.scrollX - t, i = window.scrollY - n;
|
|
1141
|
-
e.pointer.value.start.x -= s, e.pointer.value.start.y -= i,
|
|
1150
|
+
e.pointer.value.start.x -= s, e.pointer.value.start.y -= i, Ne(e);
|
|
1142
1151
|
}
|
|
1143
|
-
},
|
|
1144
|
-
function
|
|
1152
|
+
}, E = 50, Wt = 144, Pe = 1e3 / Wt;
|
|
1153
|
+
function Jt(e) {
|
|
1145
1154
|
return e == null ? {
|
|
1146
|
-
top:
|
|
1147
|
-
right:
|
|
1148
|
-
bottom:
|
|
1149
|
-
left:
|
|
1155
|
+
top: E,
|
|
1156
|
+
right: E,
|
|
1157
|
+
bottom: E,
|
|
1158
|
+
left: E
|
|
1150
1159
|
} : typeof e == "number" ? {
|
|
1151
1160
|
top: e,
|
|
1152
1161
|
right: e,
|
|
1153
1162
|
bottom: e,
|
|
1154
1163
|
left: e
|
|
1155
1164
|
} : {
|
|
1156
|
-
top: e.top ??
|
|
1157
|
-
right: e.right ??
|
|
1158
|
-
bottom: e.bottom ??
|
|
1159
|
-
left: e.left ??
|
|
1165
|
+
top: e.top ?? E,
|
|
1166
|
+
right: e.right ?? E,
|
|
1167
|
+
bottom: e.bottom ?? E,
|
|
1168
|
+
left: e.left ?? E
|
|
1160
1169
|
};
|
|
1161
1170
|
}
|
|
1162
|
-
const
|
|
1171
|
+
const Qt = {
|
|
1163
1172
|
getScrollState(e) {
|
|
1164
1173
|
return {
|
|
1165
1174
|
scrollTop: e.scrollTop,
|
|
@@ -1170,37 +1179,37 @@ const Jt = {
|
|
|
1170
1179
|
e.scrollTop = t, e.scrollLeft = n;
|
|
1171
1180
|
}
|
|
1172
1181
|
};
|
|
1173
|
-
function
|
|
1174
|
-
const { speed: r = 10, disabled: a = !1 } = t, o =
|
|
1182
|
+
function je(e, t, n, s = Qt, i) {
|
|
1183
|
+
const { speed: r = 10, disabled: a = !1 } = t, o = Jt(t.threshold);
|
|
1175
1184
|
let c = null, l = null, u = null, g = 0, f = 0;
|
|
1176
1185
|
const d = (p) => {
|
|
1177
1186
|
i && (i.value = p);
|
|
1178
|
-
},
|
|
1179
|
-
const
|
|
1180
|
-
if (!
|
|
1187
|
+
}, h = (p) => {
|
|
1188
|
+
const x = e.value, k = n();
|
|
1189
|
+
if (!x || !k || a) {
|
|
1181
1190
|
d(!1);
|
|
1182
1191
|
return;
|
|
1183
1192
|
}
|
|
1184
1193
|
l || (l = p);
|
|
1185
|
-
const
|
|
1186
|
-
if (
|
|
1187
|
-
c = requestAnimationFrame(
|
|
1194
|
+
const D = p - l;
|
|
1195
|
+
if (D < Pe) {
|
|
1196
|
+
c = requestAnimationFrame(h);
|
|
1188
1197
|
return;
|
|
1189
1198
|
}
|
|
1190
|
-
const
|
|
1199
|
+
const w = r * (D / Pe);
|
|
1191
1200
|
l = p;
|
|
1192
|
-
const { scrollTop: T, scrollLeft: P } = s.getScrollState(
|
|
1193
|
-
(!u || g !== T || f !== P) && (u = s.getRect ? s.getRect(
|
|
1194
|
-
let z = !1,
|
|
1195
|
-
o.top > 0 && k.y - u.top < o.top ? (
|
|
1201
|
+
const { scrollTop: T, scrollLeft: P } = s.getScrollState(x);
|
|
1202
|
+
(!u || g !== T || f !== P) && (u = s.getRect ? s.getRect(x) : x.getBoundingClientRect(), g = T, f = P);
|
|
1203
|
+
let z = !1, ae = T, oe = P;
|
|
1204
|
+
o.top > 0 && k.y - u.top < o.top ? (ae = T - w, z = !0) : o.bottom > 0 && u.bottom - k.y < o.bottom && (ae = T + w, z = !0), o.left > 0 && k.x - u.left < o.left ? (oe = P - w, z = !0) : o.right > 0 && u.right - k.x < o.right && (oe = P + w, z = !0), z && s.setScroll(x, ae, oe), d(z), c = requestAnimationFrame(h);
|
|
1196
1205
|
};
|
|
1197
1206
|
return { run: () => {
|
|
1198
|
-
l = null, c = requestAnimationFrame(
|
|
1207
|
+
l = null, c = requestAnimationFrame(h);
|
|
1199
1208
|
}, stop: () => {
|
|
1200
1209
|
c && (cancelAnimationFrame(c), c = null), u = null, g = 0, f = 0, l = null, d(!1);
|
|
1201
1210
|
} };
|
|
1202
1211
|
}
|
|
1203
|
-
const
|
|
1212
|
+
const en = {
|
|
1204
1213
|
getScrollState() {
|
|
1205
1214
|
return {
|
|
1206
1215
|
scrollTop: window.scrollY ?? document.documentElement.scrollTop,
|
|
@@ -1213,14 +1222,14 @@ const Qt = {
|
|
|
1213
1222
|
getRect() {
|
|
1214
1223
|
return new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
1215
1224
|
}
|
|
1216
|
-
},
|
|
1225
|
+
}, tn = {
|
|
1217
1226
|
get value() {
|
|
1218
1227
|
return typeof document < "u" ? document.documentElement : null;
|
|
1219
1228
|
}
|
|
1220
1229
|
};
|
|
1221
|
-
function
|
|
1222
|
-
const n = V(!1), i =
|
|
1223
|
-
|
|
1230
|
+
function nn(e, t) {
|
|
1231
|
+
const n = V(!1), i = je(
|
|
1232
|
+
tn,
|
|
1224
1233
|
t ?? {},
|
|
1225
1234
|
() => {
|
|
1226
1235
|
if (e.state.value !== "dragging") return null;
|
|
@@ -1230,9 +1239,9 @@ function tn(e, t) {
|
|
|
1230
1239
|
y: o.y + c.height / 2
|
|
1231
1240
|
} : o : null;
|
|
1232
1241
|
},
|
|
1233
|
-
|
|
1242
|
+
en,
|
|
1234
1243
|
n
|
|
1235
|
-
), r =
|
|
1244
|
+
), r = ne(
|
|
1236
1245
|
() => e.state.value,
|
|
1237
1246
|
(o) => {
|
|
1238
1247
|
o === "dragging" ? i.run() : i.stop();
|
|
@@ -1240,31 +1249,31 @@ function tn(e, t) {
|
|
|
1240
1249
|
), a = () => {
|
|
1241
1250
|
r(), i.stop();
|
|
1242
1251
|
};
|
|
1243
|
-
return
|
|
1252
|
+
return Je(a), { isScrolling: n, stop: a };
|
|
1244
1253
|
}
|
|
1245
|
-
const
|
|
1246
|
-
const t = Vt(e), n = de.keyDown(e), s = de.keyUp(e), i = de.clear(e), r =
|
|
1254
|
+
const sn = (e) => {
|
|
1255
|
+
const t = Vt(e), n = de.keyDown(e), s = de.keyUp(e), i = de.clear(e), r = jt(e);
|
|
1247
1256
|
let a = null;
|
|
1248
|
-
|
|
1257
|
+
ne(
|
|
1249
1258
|
e.autoScrollViewport,
|
|
1250
1259
|
(o) => {
|
|
1251
|
-
a?.(), a = null, (o === !0 || o && typeof o == "object") && (a =
|
|
1260
|
+
a?.(), a = null, (o === !0 || o && typeof o == "object") && (a = nn(
|
|
1252
1261
|
e,
|
|
1253
1262
|
o === !0 ? {} : o
|
|
1254
1263
|
).stop);
|
|
1255
1264
|
},
|
|
1256
1265
|
{ immediate: !0 }
|
|
1257
|
-
),
|
|
1266
|
+
), Y(() => {
|
|
1258
1267
|
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", n), document.addEventListener("keyup", s), document.addEventListener("blur", i), document.addEventListener("scroll", r, !0);
|
|
1259
1268
|
}), Z(() => {
|
|
1260
1269
|
document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", n), document.removeEventListener("keyup", s), document.removeEventListener("blur", i), document.removeEventListener("scroll", r, !0), a?.(), t.cleanup();
|
|
1261
1270
|
});
|
|
1262
|
-
},
|
|
1263
|
-
const e =
|
|
1271
|
+
}, ie = () => {
|
|
1272
|
+
const e = Be(xe);
|
|
1264
1273
|
if (!e) throw Error("DnD provider not found");
|
|
1265
1274
|
return e;
|
|
1266
|
-
},
|
|
1267
|
-
const e =
|
|
1275
|
+
}, We = () => {
|
|
1276
|
+
const e = ie();
|
|
1268
1277
|
return {
|
|
1269
1278
|
preview: e.preview,
|
|
1270
1279
|
delay: e.delay,
|
|
@@ -1278,14 +1287,14 @@ const nn = (e) => {
|
|
|
1278
1287
|
collision: e.collision,
|
|
1279
1288
|
autoScrollViewport: e.autoScrollViewport
|
|
1280
1289
|
};
|
|
1281
|
-
},
|
|
1290
|
+
}, an = /* @__PURE__ */ Oe({
|
|
1282
1291
|
__name: "DragPreview",
|
|
1283
1292
|
props: {
|
|
1284
1293
|
grid: {}
|
|
1285
1294
|
},
|
|
1286
1295
|
setup(e) {
|
|
1287
|
-
const { state: t, entities: n, preview: s } =
|
|
1288
|
-
|
|
1296
|
+
const { state: t, entities: n, preview: s } = We(), i = Fe("contentRef");
|
|
1297
|
+
ne(
|
|
1289
1298
|
() => i.value,
|
|
1290
1299
|
() => {
|
|
1291
1300
|
const o = i.value?.getBoundingClientRect();
|
|
@@ -1296,7 +1305,7 @@ const nn = (e) => {
|
|
|
1296
1305
|
const { x: o, y: c } = s.position.value, l = typeof e.grid == "object" ? e.grid.x : e.grid, u = typeof e.grid == "object" ? e.grid.y : e.grid;
|
|
1297
1306
|
return { x: r(o, l), y: r(c, u) };
|
|
1298
1307
|
});
|
|
1299
|
-
return (o, c) =>
|
|
1308
|
+
return (o, c) => j(t) === "dragging" ? (L(), W("div", {
|
|
1300
1309
|
key: 0,
|
|
1301
1310
|
class: "dnd-kit-preview",
|
|
1302
1311
|
ref_key: "contentRef",
|
|
@@ -1306,10 +1315,10 @@ const nn = (e) => {
|
|
|
1306
1315
|
})
|
|
1307
1316
|
}, [
|
|
1308
1317
|
me(o.$slots, "default", {
|
|
1309
|
-
draggingMap:
|
|
1318
|
+
draggingMap: j(n).draggingMap
|
|
1310
1319
|
}, () => [
|
|
1311
|
-
(L(!0),
|
|
1312
|
-
u.render ? (L(),
|
|
1320
|
+
(L(!0), W(he, null, Qe(j(n).draggingMap, ([l, u]) => (L(), W(he, { key: l }, [
|
|
1321
|
+
u.render ? (L(), Q(be(u.render), { key: 0 })) : (L(), Q(be(l.tagName), {
|
|
1313
1322
|
key: 1,
|
|
1314
1323
|
innerHTML: u.initialOuterHTML,
|
|
1315
1324
|
style: Ce({
|
|
@@ -1319,9 +1328,9 @@ const nn = (e) => {
|
|
|
1319
1328
|
}, null, 8, ["innerHTML", "style"]))
|
|
1320
1329
|
], 64))), 128))
|
|
1321
1330
|
])
|
|
1322
|
-
], 4)) :
|
|
1331
|
+
], 4)) : et("", !0);
|
|
1323
1332
|
}
|
|
1324
|
-
}),
|
|
1333
|
+
}), rn = /* @__PURE__ */ Oe({
|
|
1325
1334
|
__name: "DnDProvider",
|
|
1326
1335
|
props: {
|
|
1327
1336
|
autoScrollViewport: { type: [Object, Boolean, null] },
|
|
@@ -1330,29 +1339,32 @@ const nn = (e) => {
|
|
|
1330
1339
|
class: {}
|
|
1331
1340
|
},
|
|
1332
1341
|
setup(e) {
|
|
1333
|
-
const t = e, n =
|
|
1334
|
-
|
|
1335
|
-
const i =
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1342
|
+
const t = e, n = Fe("previewRef"), s = wt(n, t);
|
|
1343
|
+
sn(s);
|
|
1344
|
+
const i = q(!1);
|
|
1345
|
+
Y(() => i.value = !0);
|
|
1346
|
+
const r = b(() => s.preview.render.value ?? an);
|
|
1347
|
+
return tt(xe, s), (a, o) => (L(), W(he, null, [
|
|
1348
|
+
me(a.$slots, "default"),
|
|
1349
|
+
(L(), Q(nt, {
|
|
1350
|
+
disabled: !i.value,
|
|
1351
|
+
to: j(s).preview.to.value || "body"
|
|
1340
1352
|
}, [
|
|
1341
|
-
|
|
1353
|
+
st("div", it({
|
|
1342
1354
|
ref_key: "previewRef",
|
|
1343
1355
|
ref: n,
|
|
1344
1356
|
class: "dnd-kit-preview-container"
|
|
1345
1357
|
}, t), [
|
|
1346
|
-
me(
|
|
1347
|
-
(L(),
|
|
1358
|
+
me(a.$slots, "preview", { preview: r.value }, () => [
|
|
1359
|
+
(L(), Q(be(r.value)))
|
|
1348
1360
|
])
|
|
1349
1361
|
], 16)
|
|
1350
|
-
], 8, ["to"]))
|
|
1362
|
+
], 8, ["disabled", "to"]))
|
|
1351
1363
|
], 64));
|
|
1352
1364
|
}
|
|
1353
1365
|
});
|
|
1354
|
-
function
|
|
1355
|
-
const s =
|
|
1366
|
+
function ln(e, t, n) {
|
|
1367
|
+
const s = ie();
|
|
1356
1368
|
let i, r, a;
|
|
1357
1369
|
typeof t == "function" ? (i = {}, r = t) : (i = t ?? {}, r = n);
|
|
1358
1370
|
const o = i.id ?? Math.random().toString(36).slice(2), c = b({
|
|
@@ -1375,8 +1387,8 @@ function rn(e, t, n) {
|
|
|
1375
1387
|
if (f)
|
|
1376
1388
|
return s.entities.draggableMap.get(f)?.hoveredPlacement;
|
|
1377
1389
|
});
|
|
1378
|
-
return
|
|
1379
|
-
if (a = S(e), !!a && (a.addEventListener("dragstart",
|
|
1390
|
+
return Y(() => {
|
|
1391
|
+
if (a = S(e), !!a && (a.addEventListener("dragstart", M), a.addEventListener("drag", M), a.addEventListener("dragend", M), a.setAttribute(I.DRAGGABLE, o), s.lib.draggableObserver.observe(a), s.entities.draggableMap.set(a, {
|
|
1380
1392
|
id: o,
|
|
1381
1393
|
render: i.render,
|
|
1382
1394
|
disabled: i.disabled ?? !1,
|
|
@@ -1405,10 +1417,10 @@ function rn(e, t, n) {
|
|
|
1405
1417
|
isDragOver: g
|
|
1406
1418
|
};
|
|
1407
1419
|
}
|
|
1408
|
-
const
|
|
1409
|
-
const n =
|
|
1420
|
+
const cn = (e, t) => {
|
|
1421
|
+
const n = ie(), s = b(() => e.value === n.entities.selectingArea);
|
|
1410
1422
|
let i = null;
|
|
1411
|
-
|
|
1423
|
+
Y(() => {
|
|
1412
1424
|
i = S(e), i && (i.setAttribute(I.SELECT_AREA, ""), n.lib.selectableAreaObserver.observe(i), n.entities.selectableAreaMap.set(i, {
|
|
1413
1425
|
modifier: t?.modifier ?? {
|
|
1414
1426
|
keys: ["ControlLeft"],
|
|
@@ -1425,18 +1437,18 @@ const ln = (e, t) => {
|
|
|
1425
1437
|
const r = b(() => {
|
|
1426
1438
|
n.scrollPosition.x, n.scrollPosition.y;
|
|
1427
1439
|
const a = n.pointer.value;
|
|
1428
|
-
return !a || n.state.value !== "selecting" || !i || !s.value ? {} :
|
|
1440
|
+
return !a || n.state.value !== "selecting" || !i || !s.value ? {} : Mt(a.start, a.current, i);
|
|
1429
1441
|
});
|
|
1430
1442
|
return {
|
|
1431
1443
|
isSelecting: s,
|
|
1432
1444
|
style: r
|
|
1433
1445
|
};
|
|
1434
1446
|
};
|
|
1435
|
-
function
|
|
1436
|
-
const n =
|
|
1447
|
+
function gn(e, t) {
|
|
1448
|
+
const n = Be(xe);
|
|
1437
1449
|
if (!n) throw Error("DnD provider not found");
|
|
1438
1450
|
let s = null;
|
|
1439
|
-
return
|
|
1451
|
+
return Y(() => {
|
|
1440
1452
|
s = S(e), s && (s.setAttribute(I.CONSTRAINT_AREA, ""), n.entities.constraintsAreaMap.set(s, {
|
|
1441
1453
|
axis: t?.axis || "both",
|
|
1442
1454
|
restrictToArea: t?.restrictToArea || !1
|
|
@@ -1445,8 +1457,8 @@ function cn(e, t) {
|
|
|
1445
1457
|
s && n.entities.constraintsAreaMap.delete(s);
|
|
1446
1458
|
}), {};
|
|
1447
1459
|
}
|
|
1448
|
-
function
|
|
1449
|
-
const s =
|
|
1460
|
+
function un(e, t, n) {
|
|
1461
|
+
const s = ie();
|
|
1450
1462
|
let i = null, r, a;
|
|
1451
1463
|
typeof t == "function" ? (r = {}, a = t) : (r = t ?? {}, a = n);
|
|
1452
1464
|
const o = b(() => {
|
|
@@ -1457,7 +1469,7 @@ function gn(e, t, n) {
|
|
|
1457
1469
|
if (l)
|
|
1458
1470
|
return s.entities.droppableMap.get(l)?.hoveredPlacement;
|
|
1459
1471
|
});
|
|
1460
|
-
return
|
|
1472
|
+
return Y(() => {
|
|
1461
1473
|
i = S(e), i && (i.setAttribute(I.DROPPABLE, ""), s.lib.droppableObserver.observe(i), s.entities.droppableMap.set(i, {
|
|
1462
1474
|
disabled: r.disabled ?? !1,
|
|
1463
1475
|
groups: r.groups ?? [],
|
|
@@ -1474,8 +1486,8 @@ function gn(e, t, n) {
|
|
|
1474
1486
|
isDragOver: c
|
|
1475
1487
|
};
|
|
1476
1488
|
}
|
|
1477
|
-
const
|
|
1478
|
-
const n =
|
|
1489
|
+
const fn = (e, t) => {
|
|
1490
|
+
const n = We(), s = V(!1), r = je(
|
|
1479
1491
|
e,
|
|
1480
1492
|
t ?? {},
|
|
1481
1493
|
() => {
|
|
@@ -1489,7 +1501,7 @@ const un = (e, t) => {
|
|
|
1489
1501
|
void 0,
|
|
1490
1502
|
s
|
|
1491
1503
|
);
|
|
1492
|
-
return
|
|
1504
|
+
return ne(
|
|
1493
1505
|
() => n.state.value,
|
|
1494
1506
|
(a) => {
|
|
1495
1507
|
a === "dragging" ? r.run() : r.stop();
|
|
@@ -1497,13 +1509,13 @@ const un = (e, t) => {
|
|
|
1497
1509
|
), { isScrolling: s };
|
|
1498
1510
|
};
|
|
1499
1511
|
export {
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1512
|
+
rn as DnDProvider,
|
|
1513
|
+
an as DragPreview,
|
|
1514
|
+
xe as injectionKey,
|
|
1515
|
+
fn as makeAutoScroll,
|
|
1516
|
+
gn as makeConstraintArea,
|
|
1517
|
+
ln as makeDraggable,
|
|
1518
|
+
un as makeDroppable,
|
|
1519
|
+
cn as makeSelectionArea,
|
|
1520
|
+
We as useDnDProvider
|
|
1509
1521
|
};
|