@vue-dnd-kit/core 2.4.4 → 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 +271 -267
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
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
|
|
3
|
-
const
|
|
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
|
+
const I = {
|
|
4
4
|
SELECT_AREA: "data-dnd-kit-select-area",
|
|
5
5
|
DRAGGABLE: "data-dnd-kit-draggable",
|
|
6
6
|
DROPPABLE: "data-dnd-kit-droppable",
|
|
7
7
|
CONSTRAINT_AREA: "data-dnd-kit-constraint-area"
|
|
8
8
|
}, G = {
|
|
9
|
-
SELECT_AREA: `[${
|
|
10
|
-
DRAGGABLE: `[${
|
|
11
|
-
CONSTRAINT_AREA: `[${
|
|
12
|
-
},
|
|
9
|
+
SELECT_AREA: `[${I.SELECT_AREA}]`,
|
|
10
|
+
DRAGGABLE: `[${I.DRAGGABLE}]`,
|
|
11
|
+
CONSTRAINT_AREA: `[${I.CONSTRAINT_AREA}]`
|
|
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 C = {
|
|
|
22
22
|
c[l]((g) => n.value.has(g)) && i.add(r);
|
|
23
23
|
}), i;
|
|
24
24
|
};
|
|
25
|
-
let
|
|
26
|
-
const
|
|
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;
|
|
@@ -44,7 +44,7 @@ const w = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$e
|
|
|
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);
|
|
@@ -57,7 +57,7 @@ function rt(e, t, n, s) {
|
|
|
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);
|
|
@@ -95,11 +95,11 @@ function De(e, t = 0, n = 0) {
|
|
|
95
95
|
offset: { x: t, y: n }
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function _e(e, t) {
|
|
99
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;
|
|
100
100
|
return { x: s, y: i };
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function Ge(e, t) {
|
|
103
103
|
return {
|
|
104
104
|
...t,
|
|
105
105
|
initialHTML: e.innerHTML,
|
|
@@ -107,34 +107,34 @@ function _e(e, t) {
|
|
|
107
107
|
initialOuterHTML: e.outerHTML
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function gt(e, t, n) {
|
|
111
111
|
e.forEach((s) => {
|
|
112
112
|
const i = t.get(s);
|
|
113
|
-
n.set(s,
|
|
113
|
+
n.set(s, Ge(s, i));
|
|
114
114
|
}), e.clear();
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function ut(e, t, n) {
|
|
117
117
|
n.clear();
|
|
118
118
|
const s = t.get(e);
|
|
119
|
-
n.set(e,
|
|
119
|
+
n.set(e, Ge(e, s));
|
|
120
120
|
}
|
|
121
121
|
function ee(e) {
|
|
122
|
-
e.entities.initiatingDraggable && (e.state.value = "dragging",
|
|
122
|
+
e.entities.initiatingDraggable && (e.state.value = "dragging", ft(
|
|
123
123
|
e.entities.initiatingDraggable,
|
|
124
124
|
e.entities.selectedSet,
|
|
125
125
|
e.entities.draggableMap,
|
|
126
126
|
e.entities.draggingMap
|
|
127
127
|
));
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
t.has(e) ?
|
|
129
|
+
function ft(e, t, n, s) {
|
|
130
|
+
t.has(e) ? gt(t, n, s) : (t.clear(), ut(e, n, s));
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function He(e, t, n, s) {
|
|
133
133
|
if (s || !n) return !0;
|
|
134
134
|
const i = e.closest(n);
|
|
135
135
|
return i ? t.contains(i) : !1;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function dt(e, t) {
|
|
138
138
|
if (!e || !t) return 1;
|
|
139
139
|
const n = Math.abs(e.current.x - e.start.x), s = Math.abs(e.current.y - e.start.y);
|
|
140
140
|
if (typeof t == "number") {
|
|
@@ -150,24 +150,24 @@ function ft(e, t) {
|
|
|
150
150
|
const o = i > 0 ? Math.min(n / i, 1) : 1, c = r > 0 ? Math.min(s / r, 1) : 1;
|
|
151
151
|
return a === "both" ? Math.min(o, c) : Math.max(o, c);
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function Ke(e, t, n) {
|
|
154
154
|
if (!n) return !0;
|
|
155
155
|
const s = n.distance != null, i = n.delay != null;
|
|
156
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;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function mt(e) {
|
|
159
159
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable)
|
|
160
160
|
return !1;
|
|
161
161
|
const t = e.entities.draggableMap.get(
|
|
162
162
|
e.entities.initiatingDraggable
|
|
163
163
|
);
|
|
164
|
-
return
|
|
164
|
+
return Ke(
|
|
165
165
|
e.distanceProgress.value,
|
|
166
166
|
e.delay.progress,
|
|
167
167
|
t?.activation
|
|
168
168
|
) ? (ee(e), !0) : !1;
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function ht(e, t) {
|
|
171
171
|
let n = null;
|
|
172
172
|
const s = () => {
|
|
173
173
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable) {
|
|
@@ -184,7 +184,7 @@ function mt(e, t) {
|
|
|
184
184
|
e.delay.progress = Math.min(
|
|
185
185
|
(Date.now() - e.delay.startTime) / (r * 1e3),
|
|
186
186
|
1
|
|
187
|
-
),
|
|
187
|
+
), Ke(
|
|
188
188
|
e.distanceProgress.value,
|
|
189
189
|
e.delay.progress,
|
|
190
190
|
i?.activation
|
|
@@ -196,7 +196,7 @@ function mt(e, t) {
|
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function bt(e, t) {
|
|
200
200
|
const n = e.closest(
|
|
201
201
|
G.CONSTRAINT_AREA
|
|
202
202
|
);
|
|
@@ -205,10 +205,10 @@ function ht(e, t) {
|
|
|
205
205
|
entity: t.get(n)
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function pt(e, t, n, s) {
|
|
209
209
|
return n === "x" ? { x: e, y: s.top } : n === "y" ? { x: s.left, y: t } : { x: e, y: t };
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function yt(e, t, n, s, i) {
|
|
212
212
|
let r = e, a = t;
|
|
213
213
|
return n !== "y" && (r = Math.max(
|
|
214
214
|
s.left,
|
|
@@ -218,23 +218,23 @@ function pt(e, t, n, s, i) {
|
|
|
218
218
|
Math.min(s.bottom - i.height, t)
|
|
219
219
|
)), { x: r, y: a };
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function Dt(e, t, n, s) {
|
|
222
222
|
if (!e)
|
|
223
223
|
return { x: 0, y: 0 };
|
|
224
224
|
const i = t?.width ?? 0, r = t?.height ?? 0;
|
|
225
225
|
let a = e.current.x - i * e.offset.x, o = e.current.y - r * e.offset.y;
|
|
226
226
|
if (!n)
|
|
227
227
|
return { x: a, y: o };
|
|
228
|
-
const c =
|
|
228
|
+
const c = bt(n, s);
|
|
229
229
|
if (!c)
|
|
230
230
|
return { x: a, y: o };
|
|
231
|
-
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(
|
|
232
232
|
a,
|
|
233
233
|
o,
|
|
234
234
|
u.axis || "both",
|
|
235
235
|
f
|
|
236
236
|
);
|
|
237
|
-
return u.restrictToArea ?
|
|
237
|
+
return u.restrictToArea ? yt(
|
|
238
238
|
d.x,
|
|
239
239
|
d.y,
|
|
240
240
|
u.axis || "both",
|
|
@@ -242,7 +242,7 @@ function yt(e, t, n, s) {
|
|
|
242
242
|
t ?? { width: 0, height: 0 }
|
|
243
243
|
) : d;
|
|
244
244
|
}
|
|
245
|
-
const
|
|
245
|
+
const X = {
|
|
246
246
|
forDrag: ["Enter", "Space"],
|
|
247
247
|
forCancel: ["Escape"],
|
|
248
248
|
forDrop: ["Enter", "Space"],
|
|
@@ -258,15 +258,15 @@ const V = {
|
|
|
258
258
|
],
|
|
259
259
|
forMoveFaster: ["ShiftLeft", "ShiftRight"]
|
|
260
260
|
};
|
|
261
|
-
function
|
|
262
|
-
const n =
|
|
261
|
+
function wt(e, t) {
|
|
262
|
+
const n = V(), s = q(), r = {
|
|
263
263
|
keys: {
|
|
264
264
|
pressedKeys: q(/* @__PURE__ */ new Set()),
|
|
265
|
-
forDrag: [...
|
|
266
|
-
forCancel: [...
|
|
267
|
-
forDrop: [...
|
|
268
|
-
forMove: [...
|
|
269
|
-
forMoveFaster: [...
|
|
265
|
+
forDrag: [...X.forDrag],
|
|
266
|
+
forCancel: [...X.forCancel],
|
|
267
|
+
forDrop: [...X.forDrop],
|
|
268
|
+
forMove: [...X.forMove],
|
|
269
|
+
forMoveFaster: [...X.forMoveFaster]
|
|
270
270
|
},
|
|
271
271
|
step: 8,
|
|
272
272
|
moveFaster: 4
|
|
@@ -280,27 +280,27 @@ function Dt(e, t) {
|
|
|
280
280
|
draggingMap: /* @__PURE__ */ new Map(),
|
|
281
281
|
selectedSet: /* @__PURE__ */ new Set(),
|
|
282
282
|
selectionBase: /* @__PURE__ */ new Set(),
|
|
283
|
-
allowedDroppableSet: b(() => n.value ?
|
|
283
|
+
allowedDroppableSet: b(() => n.value ? lt(
|
|
284
284
|
a.visibleDroppableSet,
|
|
285
285
|
a.draggingMap,
|
|
286
286
|
a.draggableMap,
|
|
287
287
|
a.droppableMap
|
|
288
288
|
) : /* @__PURE__ */ new Set()),
|
|
289
|
-
allowedDraggableSet: b(() => n.value ?
|
|
289
|
+
allowedDraggableSet: b(() => n.value ? ct(
|
|
290
290
|
a.visibleDraggableSet,
|
|
291
291
|
a.draggingMap,
|
|
292
292
|
a.draggableMap
|
|
293
293
|
) : /* @__PURE__ */ new Set()),
|
|
294
|
-
modifiersSelectableAreaSet: b(() =>
|
|
294
|
+
modifiersSelectableAreaSet: b(() => Ie(
|
|
295
295
|
a.selectableAreaMap,
|
|
296
296
|
a.visibleSelectableAreaSet,
|
|
297
297
|
r.keys.pressedKeys
|
|
298
298
|
)),
|
|
299
|
-
modifiersDraggableSet: b(() =>
|
|
299
|
+
modifiersDraggableSet: b(() => Ie(
|
|
300
300
|
a.draggableMap,
|
|
301
301
|
a.visibleDraggableSet,
|
|
302
302
|
r.keys.pressedKeys,
|
|
303
|
-
(
|
|
303
|
+
(w) => Ee(w, { entities: a })
|
|
304
304
|
)),
|
|
305
305
|
visibleDraggableSet: /* @__PURE__ */ new Set(),
|
|
306
306
|
visibleDroppableSet: /* @__PURE__ */ new Set(),
|
|
@@ -309,7 +309,7 @@ function Dt(e, t) {
|
|
|
309
309
|
draggable: /* @__PURE__ */ new Map(),
|
|
310
310
|
droppable: /* @__PURE__ */ new Map()
|
|
311
311
|
}), c = {
|
|
312
|
-
throttle:
|
|
312
|
+
throttle: V(0)
|
|
313
313
|
}, l = $({
|
|
314
314
|
x: typeof window < "u" ? window.scrollX : 0,
|
|
315
315
|
y: typeof window < "u" ? window.scrollY : 0
|
|
@@ -318,26 +318,26 @@ function Dt(e, t) {
|
|
|
318
318
|
startTime: 0
|
|
319
319
|
}), g = b(() => {
|
|
320
320
|
if (!s.value || !a.initiatingDraggable) return 0;
|
|
321
|
-
const
|
|
322
|
-
return
|
|
321
|
+
const w = a.draggableMap.get(a.initiatingDraggable)?.activation?.distance;
|
|
322
|
+
return w ? dt(s.value, w) : 1;
|
|
323
323
|
}), f = re(
|
|
324
324
|
a.visibleDraggableSet
|
|
325
325
|
), d = re(
|
|
326
326
|
a.visibleDroppableSet
|
|
327
|
-
),
|
|
327
|
+
), h = re(
|
|
328
328
|
a.visibleSelectableAreaSet
|
|
329
|
-
),
|
|
329
|
+
), m = q(), y = V(typeof DOMRect < "u" ? new DOMRect() : {}), p = b(() => {
|
|
330
330
|
l.x, l.y;
|
|
331
|
-
const
|
|
332
|
-
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(
|
|
333
333
|
s.value,
|
|
334
334
|
P,
|
|
335
|
-
|
|
335
|
+
w || null,
|
|
336
336
|
a.constraintsAreaMap
|
|
337
337
|
);
|
|
338
|
-
}),
|
|
338
|
+
}), x = b({
|
|
339
339
|
get: () => t?.previewTo,
|
|
340
|
-
set: (
|
|
340
|
+
set: (D) => x.value = D
|
|
341
341
|
}), k = b(() => t?.autoScrollViewport);
|
|
342
342
|
return {
|
|
343
343
|
state: n,
|
|
@@ -350,16 +350,16 @@ function Dt(e, t) {
|
|
|
350
350
|
hovered: o,
|
|
351
351
|
collision: c,
|
|
352
352
|
preview: {
|
|
353
|
-
size:
|
|
353
|
+
size: y,
|
|
354
354
|
position: p,
|
|
355
|
-
render:
|
|
355
|
+
render: m,
|
|
356
356
|
ref: e,
|
|
357
|
-
to:
|
|
357
|
+
to: x
|
|
358
358
|
},
|
|
359
359
|
lib: {
|
|
360
360
|
draggableObserver: f,
|
|
361
361
|
droppableObserver: d,
|
|
362
|
-
selectableAreaObserver:
|
|
362
|
+
selectableAreaObserver: h,
|
|
363
363
|
rectCache: /* @__PURE__ */ new Map()
|
|
364
364
|
},
|
|
365
365
|
autoScrollViewport: k
|
|
@@ -378,12 +378,12 @@ const te = (e) => {
|
|
|
378
378
|
}
|
|
379
379
|
e.lib.rectCache.clear(), e.pointer.value = void 0, e.state.value = void 0, e.entities.selectingArea = void 0, e.entities.selectionBase.clear(), e.entities.initiatingDraggable = void 0, e.delay.progress = 0, e.delay.startTime = 0, e.entities.draggingMap.clear(), e.hovered.draggable.clear(), e.hovered.droppable.clear();
|
|
380
380
|
};
|
|
381
|
-
function
|
|
381
|
+
function St(e) {
|
|
382
382
|
return e.parentElement?.closest(
|
|
383
383
|
G.SELECT_AREA
|
|
384
384
|
) ?? null;
|
|
385
385
|
}
|
|
386
|
-
const
|
|
386
|
+
const Mt = (e, t, n) => {
|
|
387
387
|
if (!n) return {};
|
|
388
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;
|
|
389
389
|
return {
|
|
@@ -396,20 +396,20 @@ const St = (e, t, n) => {
|
|
|
396
396
|
border: "1px solid #3b82f6",
|
|
397
397
|
backgroundColor: "#3b82f61a"
|
|
398
398
|
};
|
|
399
|
-
},
|
|
399
|
+
}, Ne = (e) => {
|
|
400
400
|
if (!e.pointer.value || !e.entities.selectingArea) return;
|
|
401
|
-
const { selectingArea: t } = e.entities, n =
|
|
401
|
+
const { selectingArea: t } = e.entities, n = vt(
|
|
402
402
|
e.pointer.value.start,
|
|
403
403
|
e.pointer.value.current
|
|
404
404
|
), s = e.entities.selectableAreaMap.get(t)?.groups ?? [], i = e.lib.rectCache;
|
|
405
405
|
e.entities.visibleDraggableSet.forEach((r) => {
|
|
406
406
|
if (r === t || !t.contains(r)) return;
|
|
407
|
-
const a =
|
|
407
|
+
const a = St(r);
|
|
408
408
|
if (a && a !== t) {
|
|
409
409
|
e.entities.selectedSet.delete(r);
|
|
410
410
|
return;
|
|
411
411
|
}
|
|
412
|
-
if (
|
|
412
|
+
if (Ee(r, e)) {
|
|
413
413
|
e.entities.selectedSet.delete(r);
|
|
414
414
|
return;
|
|
415
415
|
}
|
|
@@ -420,7 +420,7 @@ const St = (e, t, n) => {
|
|
|
420
420
|
}
|
|
421
421
|
let l = i.get(r);
|
|
422
422
|
l || (l = r.getBoundingClientRect(), i.set(r, l));
|
|
423
|
-
const u = e.entities.selectionBase.has(r), g =
|
|
423
|
+
const u = e.entities.selectionBase.has(r), g = rt(n, l);
|
|
424
424
|
switch (e.entities.selectableAreaMap.get(t)?.strategy) {
|
|
425
425
|
case "toggle":
|
|
426
426
|
e.entities.selectedSet[g !== u ? "add" : "delete"](
|
|
@@ -432,11 +432,11 @@ const St = (e, t, n) => {
|
|
|
432
432
|
break;
|
|
433
433
|
}
|
|
434
434
|
});
|
|
435
|
-
},
|
|
435
|
+
}, vt = (e, t) => {
|
|
436
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;
|
|
437
437
|
return new DOMRect(n, s, a, o);
|
|
438
438
|
};
|
|
439
|
-
function
|
|
439
|
+
function C(e, t, n) {
|
|
440
440
|
const s = Math.max(0, Math.min(t, e.length));
|
|
441
441
|
return [...e.slice(0, s), ...n, ...e.slice(s)];
|
|
442
442
|
}
|
|
@@ -450,7 +450,7 @@ function N(e, t) {
|
|
|
450
450
|
for (const i of n) s = Le(s, i, 1);
|
|
451
451
|
return s;
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function Ye(e, t, n) {
|
|
454
454
|
if (t === n || t < 0 || n < 0 || t >= e.length || n >= e.length)
|
|
455
455
|
return e;
|
|
456
456
|
const s = [...e];
|
|
@@ -467,7 +467,7 @@ const R = {
|
|
|
467
467
|
return R.getInsertSide(e, t) === "after" && !e?.center;
|
|
468
468
|
}
|
|
469
469
|
};
|
|
470
|
-
function
|
|
470
|
+
function Xe(e, t) {
|
|
471
471
|
const { draggedItems: n, dropZone: s, hoveredDraggable: i } = e;
|
|
472
472
|
if (!n.length) return null;
|
|
473
473
|
const r = i?.placement.center === !0 && s != null && s.items !== i.items, a = r ? s.items : i?.items ?? s?.items;
|
|
@@ -483,8 +483,8 @@ function Ye(e, t) {
|
|
|
483
483
|
if (f)
|
|
484
484
|
return null;
|
|
485
485
|
{
|
|
486
|
-
const d = R.getInsertSide(i.placement, t),
|
|
487
|
-
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");
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
} else {
|
|
@@ -494,10 +494,10 @@ function Ye(e, t) {
|
|
|
494
494
|
}
|
|
495
495
|
return { targetIndex: u, mode: g, targetArr: a };
|
|
496
496
|
}
|
|
497
|
-
function
|
|
497
|
+
function At(e, t = "vertical") {
|
|
498
498
|
const { draggedItems: n } = e;
|
|
499
499
|
if (!n.length) return null;
|
|
500
|
-
const s =
|
|
500
|
+
const s = Xe(e, t);
|
|
501
501
|
if (!s) return null;
|
|
502
502
|
const { targetArr: i, mode: r } = s;
|
|
503
503
|
let { targetIndex: a } = s;
|
|
@@ -505,14 +505,14 @@ function vt(e, t = "vertical") {
|
|
|
505
505
|
if (l === i) {
|
|
506
506
|
const g = o.filter((d) => d < a).length;
|
|
507
507
|
a = Math.max(0, a - g);
|
|
508
|
-
const f =
|
|
508
|
+
const f = C(N(l, o), a, c);
|
|
509
509
|
return { sourceItems: f, targetItems: f, draggedItems: c, sourceIndexes: o, targetIndex: a, mode: r, sameList: !0 };
|
|
510
510
|
} else {
|
|
511
|
-
const g = N(l, o), f =
|
|
511
|
+
const g = N(l, o), f = C(i, a, c);
|
|
512
512
|
return { sourceItems: g, targetItems: f, draggedItems: c, sourceIndexes: o, targetIndex: a, mode: r, sameList: !1 };
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
|
-
function
|
|
515
|
+
function xt(e) {
|
|
516
516
|
const { draggedItems: t, hoveredDraggable: n } = e;
|
|
517
517
|
if (!t.length || !n) return null;
|
|
518
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;
|
|
@@ -520,7 +520,7 @@ function At(e) {
|
|
|
520
520
|
if (t.length === 1) {
|
|
521
521
|
const u = s[0];
|
|
522
522
|
if (l) {
|
|
523
|
-
const g =
|
|
523
|
+
const g = Ye(o, u, i);
|
|
524
524
|
return { sourceItems: g, targetItems: g, sourceIndexes: s, targetIndex: i, sameList: !0 };
|
|
525
525
|
} else {
|
|
526
526
|
const g = [...o], f = [...c];
|
|
@@ -529,29 +529,29 @@ function At(e) {
|
|
|
529
529
|
} else {
|
|
530
530
|
const u = Math.min(...s);
|
|
531
531
|
if (l) {
|
|
532
|
-
const g = s.filter((p) => p < i).length, f = Math.max(0, i - g), d = s.filter((p) => p < u).length,
|
|
533
|
-
let
|
|
534
|
-
|
|
535
|
-
const
|
|
536
|
-
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 };
|
|
537
537
|
} else {
|
|
538
|
-
const g = s.filter((
|
|
538
|
+
const g = s.filter((m) => m < u).length, f = Math.max(0, u - g);
|
|
539
539
|
let d = N(o, s);
|
|
540
|
-
d =
|
|
541
|
-
let
|
|
542
|
-
return
|
|
540
|
+
d = C(d, f, [a]);
|
|
541
|
+
let h = Le(c, i);
|
|
542
|
+
return h = C(h, i, r), { sourceItems: d, targetItems: h, sourceIndexes: s, targetIndex: i, sameList: !1 };
|
|
543
543
|
}
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
function Et(e, t = "vertical") {
|
|
547
547
|
const { draggedItems: n } = e;
|
|
548
548
|
if (!n.length) return null;
|
|
549
|
-
const s =
|
|
549
|
+
const s = Xe(e, t);
|
|
550
550
|
if (!s) return null;
|
|
551
551
|
const { targetArr: i, targetIndex: r, mode: a } = s, o = n.map((l) => l.item);
|
|
552
|
-
return { targetItems:
|
|
552
|
+
return { targetItems: C(i, r, o), copiedItems: o, targetIndex: r, mode: a };
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function Lt(e) {
|
|
555
555
|
const { draggedItems: t } = e;
|
|
556
556
|
if (!t.length) return null;
|
|
557
557
|
const n = t.map((a) => a.index), s = t.map((a) => a.item), i = t[0].items;
|
|
@@ -560,28 +560,28 @@ function xt(e) {
|
|
|
560
560
|
function Ve(e) {
|
|
561
561
|
return {
|
|
562
562
|
// Low-level array ops
|
|
563
|
-
insertAt:
|
|
563
|
+
insertAt: C,
|
|
564
564
|
removeAt: Le,
|
|
565
565
|
removeIndexes: N,
|
|
566
|
-
swapAt:
|
|
566
|
+
swapAt: Ye,
|
|
567
567
|
// Placement helpers
|
|
568
568
|
getInsertSide: (t, n) => R.getInsertSide(t, n),
|
|
569
569
|
isAtZoneStart: (t, n) => R.isAtZoneStart(t, n),
|
|
570
570
|
isAtZoneEnd: (t, n) => R.isAtZoneEnd(t, n),
|
|
571
571
|
// High-level (event-bound)
|
|
572
|
-
suggestSort: (t) =>
|
|
573
|
-
suggestSwap: () =>
|
|
572
|
+
suggestSort: (t) => At(e, t),
|
|
573
|
+
suggestSwap: () => xt(e),
|
|
574
574
|
suggestCopy: (t) => Et(e, t),
|
|
575
|
-
suggestRemove: () =>
|
|
575
|
+
suggestRemove: () => Lt(e)
|
|
576
576
|
};
|
|
577
577
|
}
|
|
578
|
-
const O = (e) => e.keys().next().value,
|
|
578
|
+
const O = (e) => e.keys().next().value, Ct = (e) => e.target.closest(
|
|
579
579
|
G.DRAGGABLE
|
|
580
580
|
);
|
|
581
|
-
function
|
|
581
|
+
function Ze(e, t) {
|
|
582
582
|
const n = t.entities.draggingMap.get(e);
|
|
583
583
|
if (n) return n;
|
|
584
|
-
const s = e.getAttribute(
|
|
584
|
+
const s = e.getAttribute(I.DRAGGABLE);
|
|
585
585
|
if (s) {
|
|
586
586
|
for (const [, i] of t.entities.draggingMap)
|
|
587
587
|
if (i.id === s) return i;
|
|
@@ -590,7 +590,7 @@ function Xe(e, t) {
|
|
|
590
590
|
function It(e) {
|
|
591
591
|
const t = e.entities.initiatingDraggable;
|
|
592
592
|
if (!t) return [];
|
|
593
|
-
const n =
|
|
593
|
+
const n = Ze(t, e) ?? e.entities.draggableMap.get(t), s = n?.payload;
|
|
594
594
|
if (!s)
|
|
595
595
|
return n?.data ? [{ index: -1, item: void 0, items: [], data: n.data() }] : [];
|
|
596
596
|
const i = s();
|
|
@@ -604,14 +604,14 @@ function It(e) {
|
|
|
604
604
|
}), e.entities.draggingMap.forEach((u, g) => {
|
|
605
605
|
const f = e.entities.draggableMap.get(g), d = f?.payload;
|
|
606
606
|
if (!d) return;
|
|
607
|
-
const
|
|
608
|
-
if (!Array.isArray(
|
|
609
|
-
const [
|
|
610
|
-
if (
|
|
611
|
-
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);
|
|
612
612
|
l.has(p) || l.set(p, {
|
|
613
613
|
index: p,
|
|
614
|
-
item:
|
|
614
|
+
item: y[p],
|
|
615
615
|
items: c,
|
|
616
616
|
data: f?.data?.()
|
|
617
617
|
});
|
|
@@ -636,13 +636,13 @@ const A = (e, t) => {
|
|
|
636
636
|
if (l) {
|
|
637
637
|
const f = l();
|
|
638
638
|
if (Array.isArray(f) && f.length >= 2) {
|
|
639
|
-
const [d,
|
|
639
|
+
const [d, h] = f, m = Number(d);
|
|
640
640
|
i = {
|
|
641
641
|
element: a,
|
|
642
642
|
placement: u ?? g,
|
|
643
|
-
index:
|
|
644
|
-
item: m
|
|
645
|
-
items:
|
|
643
|
+
index: m,
|
|
644
|
+
item: h[m],
|
|
645
|
+
items: h,
|
|
646
646
|
data: c?.data?.()
|
|
647
647
|
};
|
|
648
648
|
}
|
|
@@ -665,14 +665,14 @@ const A = (e, t) => {
|
|
|
665
665
|
};
|
|
666
666
|
}, F = (e, t, n) => {
|
|
667
667
|
if (!t) return;
|
|
668
|
-
const s =
|
|
668
|
+
const s = Ze(t, e) ?? e.entities.draggableMap.get(t);
|
|
669
669
|
!s || s.disabled || s.events?.[n]?.(A(e));
|
|
670
670
|
}, v = (e, t) => {
|
|
671
671
|
const n = A(e);
|
|
672
672
|
e.entities.draggingMap.forEach((s) => {
|
|
673
673
|
s.disabled || s.events?.[t]?.(n);
|
|
674
674
|
});
|
|
675
|
-
},
|
|
675
|
+
}, Rt = (e, t, n) => {
|
|
676
676
|
if (t !== n) {
|
|
677
677
|
if (t && !K(t, e)) {
|
|
678
678
|
const s = A(e, t);
|
|
@@ -683,7 +683,7 @@ const A = (e, t) => {
|
|
|
683
683
|
e.entities.droppableMap.get(n)?.events?.onEnter?.(s);
|
|
684
684
|
}
|
|
685
685
|
}
|
|
686
|
-
},
|
|
686
|
+
}, kt = (e, t, n) => {
|
|
687
687
|
if (t !== n) {
|
|
688
688
|
const s = A(e);
|
|
689
689
|
if (t) {
|
|
@@ -696,15 +696,15 @@ const A = (e, t) => {
|
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
}, le = (e, t, n) => {
|
|
699
|
-
const s =
|
|
699
|
+
const s = Ct(t);
|
|
700
700
|
!s || !e.entities.draggingMap.has(s) || e.entities.draggingMap.get(s)?.events?.[n]?.(A(e));
|
|
701
|
-
},
|
|
701
|
+
}, Tt = (e, t) => {
|
|
702
702
|
const n = O(t.droppable);
|
|
703
703
|
n && !K(n, e) && e.entities.droppableMap.get(n)?.events?.onLeave?.(A(e, n));
|
|
704
704
|
}, we = (e, t) => {
|
|
705
705
|
const n = O(t.droppable);
|
|
706
706
|
n && !K(n, e) && e.entities.droppableMap.get(n)?.events?.onLeave?.(A(e, n));
|
|
707
|
-
},
|
|
707
|
+
}, Pt = (e, t, n = 5) => {
|
|
708
708
|
const s = n / 2;
|
|
709
709
|
return {
|
|
710
710
|
left: e - s,
|
|
@@ -712,14 +712,14 @@ const A = (e, t) => {
|
|
|
712
712
|
width: n,
|
|
713
713
|
height: n
|
|
714
714
|
};
|
|
715
|
-
},
|
|
715
|
+
}, Bt = (e) => {
|
|
716
716
|
const t = e.pointer.value?.current, n = t?.x ?? 0, s = t?.y ?? 0;
|
|
717
|
-
return
|
|
717
|
+
return Pt(n, s, 5);
|
|
718
718
|
}, B = (e, t, n) => {
|
|
719
719
|
const s = e.left + e.width / 2, i = e.top + e.height / 2;
|
|
720
720
|
if (n) {
|
|
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,
|
|
722
|
-
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)
|
|
723
723
|
return {
|
|
724
724
|
top: !1,
|
|
725
725
|
right: !1,
|
|
@@ -736,43 +736,43 @@ const A = (e, t) => {
|
|
|
736
736
|
right: s > r,
|
|
737
737
|
center: !1
|
|
738
738
|
};
|
|
739
|
-
},
|
|
739
|
+
}, Ot = (e) => ({
|
|
740
740
|
x: e.left + e.width / 2,
|
|
741
741
|
y: e.top + e.height / 2
|
|
742
742
|
}), Re = (e, t) => {
|
|
743
|
-
const n =
|
|
743
|
+
const n = Ot(t);
|
|
744
744
|
return Math.hypot(e.x - n.x, e.y - n.y);
|
|
745
745
|
};
|
|
746
|
-
function
|
|
746
|
+
function Ft(e, t) {
|
|
747
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;
|
|
748
748
|
}
|
|
749
749
|
function U(e, t) {
|
|
750
|
-
|
|
750
|
+
Ft(e.hoveredPlacement, t) || (e.hoveredPlacement = t);
|
|
751
751
|
}
|
|
752
|
-
const
|
|
752
|
+
const zt = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
753
753
|
const s = O(t.droppable), i = O(t.draggable);
|
|
754
754
|
i && t.draggable.delete(i), s && t.droppable.delete(s);
|
|
755
|
-
const r =
|
|
755
|
+
const r = Bt(e), a = n.zones[0], o = n.elements[0];
|
|
756
756
|
if (a && o && a === o && e.entities.droppableMap.has(a) && a) {
|
|
757
757
|
const g = a.getBoundingClientRect(), f = e.entities.draggableMap.get(a)?.placementMargins, d = B(r, g, f);
|
|
758
758
|
if (d.center) {
|
|
759
759
|
t.droppable.set(a, d);
|
|
760
|
-
const
|
|
761
|
-
if (
|
|
762
|
-
const
|
|
760
|
+
const h = zt(n.elements, a);
|
|
761
|
+
if (h) {
|
|
762
|
+
const m = h.getBoundingClientRect();
|
|
763
763
|
t.draggable.set(
|
|
764
|
-
|
|
765
|
-
B(r,
|
|
764
|
+
h,
|
|
765
|
+
B(r, m, void 0)
|
|
766
766
|
);
|
|
767
767
|
}
|
|
768
768
|
} else {
|
|
769
769
|
t.draggable.set(o, d);
|
|
770
|
-
const
|
|
771
|
-
if (
|
|
772
|
-
const
|
|
770
|
+
const h = n.zones.find((m) => m !== a);
|
|
771
|
+
if (h) {
|
|
772
|
+
const m = h.getBoundingClientRect();
|
|
773
773
|
t.droppable.set(
|
|
774
|
-
|
|
775
|
-
B(r,
|
|
774
|
+
h,
|
|
775
|
+
B(r, m)
|
|
776
776
|
);
|
|
777
777
|
}
|
|
778
778
|
}
|
|
@@ -790,13 +790,13 @@ const Ft = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
|
790
790
|
B(r, g, f)
|
|
791
791
|
);
|
|
792
792
|
} else {
|
|
793
|
-
const g = e.pointer.value?.current ?? { x: 0, y: 0 }, f = a.getBoundingClientRect(), d = o.getBoundingClientRect(),
|
|
794
|
-
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) {
|
|
795
795
|
t.droppable.clear();
|
|
796
|
-
const
|
|
796
|
+
const y = e.entities.draggableMap.get(o)?.placementMargins;
|
|
797
797
|
t.draggable.set(
|
|
798
798
|
o,
|
|
799
|
-
B(r, d,
|
|
799
|
+
B(r, d, y)
|
|
800
800
|
);
|
|
801
801
|
}
|
|
802
802
|
}
|
|
@@ -825,7 +825,7 @@ const Ft = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
|
825
825
|
const g = e.entities.droppableMap.get(l);
|
|
826
826
|
g && U(g, t.droppable.get(l));
|
|
827
827
|
}
|
|
828
|
-
|
|
828
|
+
Rt(e, s, l), kt(e, i, u);
|
|
829
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) => {
|
|
830
830
|
if (!e)
|
|
831
831
|
return { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 };
|
|
@@ -849,7 +849,7 @@ const Ft = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
|
849
849
|
Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
|
|
850
850
|
), i = n * s, r = e.width * e.height, a = t.width * t.height;
|
|
851
851
|
return r === 0 || a === 0 ? 0 : (i / r * 100 + i / a * 100) / 2;
|
|
852
|
-
},
|
|
852
|
+
}, _t = (e) => e.preview.ref?.value ?? null, ke = (e) => {
|
|
853
853
|
const t = e.preview.position?.value ?? { x: 0, y: 0 }, { x: n, y: s } = t, i = e.preview.size?.value;
|
|
854
854
|
let r, a;
|
|
855
855
|
if (i)
|
|
@@ -868,45 +868,49 @@ const Ft = (e, t) => e.find((n) => n !== t && H(t, n)), Se = (e, t, n) => {
|
|
|
868
868
|
right: n + r,
|
|
869
869
|
bottom: s + a
|
|
870
870
|
};
|
|
871
|
-
}, 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) => {
|
|
872
872
|
if (H(n, e)) return !0;
|
|
873
873
|
const s = n.parentElement;
|
|
874
874
|
return !!(s && e !== n && !t.entities.draggableMap.has(s) && !t.entities.droppableMap.has(s) && H(s, e) && [
|
|
875
875
|
...t.entities.draggableMap.keys()
|
|
876
876
|
].filter((r) => r.parentElement === s).length === 1);
|
|
877
|
-
}),
|
|
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;
|
|
878
878
|
function _(e, t) {
|
|
879
879
|
return Math.hypot(
|
|
880
880
|
t.x - (e.x + e.width / 2),
|
|
881
881
|
t.y - (e.y + e.height / 2)
|
|
882
882
|
);
|
|
883
883
|
}
|
|
884
|
-
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) {
|
|
885
889
|
const t = e.pointer.value?.current ?? { x: 0, y: 0 }, n = document.elementFromPoint(t.x, t.y);
|
|
886
890
|
if (!n) return null;
|
|
887
|
-
const s = Me(e), i =
|
|
891
|
+
const s = Me(e), i = $e(e), r = [], a = [];
|
|
888
892
|
let o = n;
|
|
889
893
|
for (; o; )
|
|
890
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;
|
|
891
895
|
return r.length === 0 && a.length === 0 ? null : { elements: r, zones: a };
|
|
892
896
|
}
|
|
893
897
|
const ve = (e) => {
|
|
894
|
-
if (!
|
|
895
|
-
const n = e.pointer.value?.current ?? { x: 0, y: 0 }, s =
|
|
898
|
+
if (!_t(e)) return { elements: [], zones: [] };
|
|
899
|
+
const n = e.pointer.value?.current ?? { x: 0, y: 0 }, s = Nt(e);
|
|
896
900
|
if (s) {
|
|
897
901
|
if (s.elements.length > 0) return s;
|
|
898
902
|
const l = s.zones[0];
|
|
899
903
|
if (!l) return s;
|
|
900
|
-
const u = ke(e)
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
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 };
|
|
906
910
|
}
|
|
907
911
|
const i = ke(e), r = [...Me(e)].filter(
|
|
908
912
|
(l) => J(l, e)
|
|
909
|
-
), a = [
|
|
913
|
+
), a = [...$e(e)].filter(
|
|
910
914
|
(l) => J(l, e)
|
|
911
915
|
), o = r.map((l) => ({ n: l, box: ge(l) })).filter(
|
|
912
916
|
({ box: l }) => ce(l, i) && ue(l, i) >= fe
|
|
@@ -919,7 +923,7 @@ function Ae(e) {
|
|
|
919
923
|
const t = ve(e);
|
|
920
924
|
Se(e, e.hovered, t);
|
|
921
925
|
}
|
|
922
|
-
function
|
|
926
|
+
function Yt(e, t) {
|
|
923
927
|
const n = e.collision?.throttle?.value ?? 0;
|
|
924
928
|
if (n <= 0) {
|
|
925
929
|
Ae(e);
|
|
@@ -928,7 +932,7 @@ function Nt(e, t) {
|
|
|
928
932
|
const s = Date.now();
|
|
929
933
|
s - t.value >= n && (t.value = s, Ae(e));
|
|
930
934
|
}
|
|
931
|
-
async function
|
|
935
|
+
async function Ue(e) {
|
|
932
936
|
const t = e.hovered.droppable.keys().next().value;
|
|
933
937
|
if (!t || K(t, e)) return "accept";
|
|
934
938
|
const n = e.entities.droppableMap.get(t), s = A(e, t);
|
|
@@ -963,16 +967,16 @@ async function $e(e) {
|
|
|
963
967
|
try {
|
|
964
968
|
d = await g;
|
|
965
969
|
} catch {
|
|
966
|
-
const
|
|
967
|
-
return F(e,
|
|
970
|
+
const m = e.entities.initiatingDraggable;
|
|
971
|
+
return F(e, m, "onSelfDragCancel"), v(e, "onDragCancel"), we(e, e.hovered), "cancel";
|
|
968
972
|
}
|
|
969
973
|
} else
|
|
970
974
|
d = g;
|
|
971
975
|
if (d === !1)
|
|
972
976
|
return e.state.value = "dragging", "decline";
|
|
973
|
-
const
|
|
974
|
-
if (
|
|
975
|
-
i = u(
|
|
977
|
+
const h = Array.isArray(d) ? d : c;
|
|
978
|
+
if (h.length === 0) return "accept";
|
|
979
|
+
i = u(h);
|
|
976
980
|
} else {
|
|
977
981
|
if (c.length === 0) return "accept";
|
|
978
982
|
i = u(c);
|
|
@@ -993,11 +997,11 @@ async function $e(e) {
|
|
|
993
997
|
}
|
|
994
998
|
return r === !1 ? "decline" : "accept";
|
|
995
999
|
}
|
|
996
|
-
function
|
|
1000
|
+
function qe(e) {
|
|
997
1001
|
const t = e.entities.initiatingDraggable;
|
|
998
|
-
F(e, t, "onSelfDragEnd"), v(e, "onDragEnd"),
|
|
1002
|
+
F(e, t, "onSelfDragEnd"), v(e, "onDragEnd"), Tt(e, e.hovered);
|
|
999
1003
|
}
|
|
1000
|
-
function
|
|
1004
|
+
function Xt(e) {
|
|
1001
1005
|
const t = e.entities.selectingArea;
|
|
1002
1006
|
if (!t) return;
|
|
1003
1007
|
const n = e.entities.selectableAreaMap.get(t), s = [...e.entities.selectedSet];
|
|
@@ -1010,26 +1014,26 @@ const Vt = (e) => {
|
|
|
1010
1014
|
ye(), t.current?.cancel(), t.current = null;
|
|
1011
1015
|
const o = e.state.value;
|
|
1012
1016
|
if (o === "dragging") {
|
|
1013
|
-
const c = await
|
|
1014
|
-
if (c === "accept" &&
|
|
1017
|
+
const c = await Ue(e);
|
|
1018
|
+
if (c === "accept" && qe(e), c === "accept" || c === "cancel") {
|
|
1015
1019
|
te(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i);
|
|
1016
1020
|
return;
|
|
1017
1021
|
}
|
|
1018
1022
|
return;
|
|
1019
|
-
} else o === "selecting" &&
|
|
1023
|
+
} else o === "selecting" && Xt(e);
|
|
1020
1024
|
te(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i);
|
|
1021
1025
|
}, i = (o) => {
|
|
1022
1026
|
if (e.pointer.value && e.state.value !== "pending") {
|
|
1023
|
-
if (e.pointer.value.current = { x: o.clientX, y: o.clientY },
|
|
1027
|
+
if (e.pointer.value.current = { x: o.clientX, y: o.clientY }, mt(e)) {
|
|
1024
1028
|
le(e, o, "onSelfDragStart"), v(e, "onDragStart");
|
|
1025
1029
|
return;
|
|
1026
1030
|
}
|
|
1027
1031
|
if (e.state.value === "dragging") {
|
|
1028
|
-
|
|
1032
|
+
Yt(e, n);
|
|
1029
1033
|
const c = e.entities.initiatingDraggable;
|
|
1030
1034
|
F(e, c, "onSelfDragMove"), v(e, "onDragMove");
|
|
1031
1035
|
}
|
|
1032
|
-
e.state.value === "selecting" &&
|
|
1036
|
+
e.state.value === "selecting" && Ne(e);
|
|
1033
1037
|
}
|
|
1034
1038
|
};
|
|
1035
1039
|
return { pointerDown: (o) => {
|
|
@@ -1045,18 +1049,18 @@ const Vt = (e) => {
|
|
|
1045
1049
|
}
|
|
1046
1050
|
if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(u)) {
|
|
1047
1051
|
const g = e.entities.draggableMap.get(u);
|
|
1048
|
-
if (!
|
|
1052
|
+
if (!He(c, u, g?.dragHandle))
|
|
1049
1053
|
return;
|
|
1050
1054
|
pe(), e.entities.initiatingDraggable = u;
|
|
1051
|
-
const f =
|
|
1052
|
-
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 =
|
|
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, () => {
|
|
1053
1057
|
ee(e), le(e, o, "onSelfDragStart"), v(e, "onDragStart");
|
|
1054
1058
|
}))) : (ee(e), le(e, o, "onSelfDragStart"), v(e, "onDragStart"));
|
|
1055
1059
|
}
|
|
1056
1060
|
}, pointerUp: s, pointerMove: i, cleanup: () => {
|
|
1057
1061
|
t.current?.cancel(), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i), e.lib.draggableObserver.disconnect(), e.lib.droppableObserver.disconnect(), e.lib.selectableAreaObserver.disconnect();
|
|
1058
1062
|
} };
|
|
1059
|
-
},
|
|
1063
|
+
}, Zt = {
|
|
1060
1064
|
ArrowUp: { dx: 0, dy: -1 },
|
|
1061
1065
|
ArrowDown: { dx: 0, dy: 1 },
|
|
1062
1066
|
ArrowLeft: { dx: -1, dy: 0 },
|
|
@@ -1065,7 +1069,7 @@ const Vt = (e) => {
|
|
|
1065
1069
|
KeyA: { dx: -1, dy: 0 },
|
|
1066
1070
|
KeyS: { dx: 0, dy: 1 },
|
|
1067
1071
|
KeyD: { dx: 1, dy: 0 }
|
|
1068
|
-
},
|
|
1072
|
+
}, $t = (e) => (t) => {
|
|
1069
1073
|
const { keys: n } = e.keyboard;
|
|
1070
1074
|
if (n.pressedKeys.value.add(t.code), e.state.value === "dragging") {
|
|
1071
1075
|
if (n.forCancel.includes(t.code)) {
|
|
@@ -1077,10 +1081,10 @@ const Vt = (e) => {
|
|
|
1077
1081
|
return;
|
|
1078
1082
|
}
|
|
1079
1083
|
if (n.forDrop.includes(t.code)) {
|
|
1080
|
-
t.preventDefault(), (async () => (await
|
|
1084
|
+
t.preventDefault(), (async () => (await Ue(e) && qe(e), ye(), te(e)))();
|
|
1081
1085
|
return;
|
|
1082
1086
|
}
|
|
1083
|
-
const i =
|
|
1087
|
+
const i = Zt[t.code];
|
|
1084
1088
|
if (i && n.forMove.includes(t.code) && e.pointer.value) {
|
|
1085
1089
|
t.preventDefault();
|
|
1086
1090
|
const r = n.forMoveFaster.some(
|
|
@@ -1109,7 +1113,7 @@ const Vt = (e) => {
|
|
|
1109
1113
|
if (!r || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(r))
|
|
1110
1114
|
return;
|
|
1111
1115
|
const a = e.entities.draggableMap.get(r);
|
|
1112
|
-
if (!
|
|
1116
|
+
if (!He(i, r, a?.dragHandle, !0))
|
|
1113
1117
|
return;
|
|
1114
1118
|
t.preventDefault(), pe();
|
|
1115
1119
|
const o = r.getBoundingClientRect(), c = o.left + o.width / 2, l = o.top + o.height / 2, u = {
|
|
@@ -1117,7 +1121,7 @@ const Vt = (e) => {
|
|
|
1117
1121
|
clientY: l
|
|
1118
1122
|
};
|
|
1119
1123
|
e.entities.initiatingDraggable = r;
|
|
1120
|
-
const g =
|
|
1124
|
+
const g = _e(u, r);
|
|
1121
1125
|
e.pointer.value = De(
|
|
1122
1126
|
u,
|
|
1123
1127
|
g.x,
|
|
@@ -1126,15 +1130,15 @@ const Vt = (e) => {
|
|
|
1126
1130
|
const f = ve(e);
|
|
1127
1131
|
Se(e, e.hovered, f), F(e, r, "onSelfDragStart"), v(e, "onDragStart");
|
|
1128
1132
|
}
|
|
1129
|
-
},
|
|
1133
|
+
}, Ut = (e) => (t) => {
|
|
1130
1134
|
e.keyboard.keys.pressedKeys.value.delete(t.code);
|
|
1131
|
-
},
|
|
1135
|
+
}, qt = (e) => () => {
|
|
1132
1136
|
e.keyboard.keys.pressedKeys.value.clear();
|
|
1133
1137
|
}, de = {
|
|
1134
|
-
keyDown:
|
|
1135
|
-
keyUp:
|
|
1136
|
-
clear:
|
|
1137
|
-
},
|
|
1138
|
+
keyDown: $t,
|
|
1139
|
+
keyUp: Ut,
|
|
1140
|
+
clear: qt
|
|
1141
|
+
}, jt = (e) => () => {
|
|
1138
1142
|
if (!e.state.value) return;
|
|
1139
1143
|
const t = e.scrollPosition.x, n = e.scrollPosition.y;
|
|
1140
1144
|
if (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY, e.lib.rectCache.clear(), e.state.value === "dragging") {
|
|
@@ -1143,28 +1147,28 @@ const Vt = (e) => {
|
|
|
1143
1147
|
}
|
|
1144
1148
|
if (e.state.value === "selecting" && e.pointer.value) {
|
|
1145
1149
|
const s = window.scrollX - t, i = window.scrollY - n;
|
|
1146
|
-
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);
|
|
1147
1151
|
}
|
|
1148
|
-
},
|
|
1149
|
-
function
|
|
1152
|
+
}, E = 50, Wt = 144, Pe = 1e3 / Wt;
|
|
1153
|
+
function Jt(e) {
|
|
1150
1154
|
return e == null ? {
|
|
1151
|
-
top:
|
|
1152
|
-
right:
|
|
1153
|
-
bottom:
|
|
1154
|
-
left:
|
|
1155
|
+
top: E,
|
|
1156
|
+
right: E,
|
|
1157
|
+
bottom: E,
|
|
1158
|
+
left: E
|
|
1155
1159
|
} : typeof e == "number" ? {
|
|
1156
1160
|
top: e,
|
|
1157
1161
|
right: e,
|
|
1158
1162
|
bottom: e,
|
|
1159
1163
|
left: e
|
|
1160
1164
|
} : {
|
|
1161
|
-
top: e.top ??
|
|
1162
|
-
right: e.right ??
|
|
1163
|
-
bottom: e.bottom ??
|
|
1164
|
-
left: e.left ??
|
|
1165
|
+
top: e.top ?? E,
|
|
1166
|
+
right: e.right ?? E,
|
|
1167
|
+
bottom: e.bottom ?? E,
|
|
1168
|
+
left: e.left ?? E
|
|
1165
1169
|
};
|
|
1166
1170
|
}
|
|
1167
|
-
const
|
|
1171
|
+
const Qt = {
|
|
1168
1172
|
getScrollState(e) {
|
|
1169
1173
|
return {
|
|
1170
1174
|
scrollTop: e.scrollTop,
|
|
@@ -1175,37 +1179,37 @@ const Jt = {
|
|
|
1175
1179
|
e.scrollTop = t, e.scrollLeft = n;
|
|
1176
1180
|
}
|
|
1177
1181
|
};
|
|
1178
|
-
function
|
|
1179
|
-
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);
|
|
1180
1184
|
let c = null, l = null, u = null, g = 0, f = 0;
|
|
1181
1185
|
const d = (p) => {
|
|
1182
1186
|
i && (i.value = p);
|
|
1183
|
-
},
|
|
1184
|
-
const
|
|
1185
|
-
if (!
|
|
1187
|
+
}, h = (p) => {
|
|
1188
|
+
const x = e.value, k = n();
|
|
1189
|
+
if (!x || !k || a) {
|
|
1186
1190
|
d(!1);
|
|
1187
1191
|
return;
|
|
1188
1192
|
}
|
|
1189
1193
|
l || (l = p);
|
|
1190
|
-
const
|
|
1191
|
-
if (
|
|
1192
|
-
c = requestAnimationFrame(
|
|
1194
|
+
const D = p - l;
|
|
1195
|
+
if (D < Pe) {
|
|
1196
|
+
c = requestAnimationFrame(h);
|
|
1193
1197
|
return;
|
|
1194
1198
|
}
|
|
1195
|
-
const
|
|
1199
|
+
const w = r * (D / Pe);
|
|
1196
1200
|
l = p;
|
|
1197
|
-
const { scrollTop: T, scrollLeft: P } = s.getScrollState(
|
|
1198
|
-
(!u || g !== T || f !== P) && (u = s.getRect ? s.getRect(
|
|
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);
|
|
1199
1203
|
let z = !1, ae = T, oe = P;
|
|
1200
|
-
o.top > 0 && k.y - u.top < o.top ? (ae = T -
|
|
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);
|
|
1201
1205
|
};
|
|
1202
1206
|
return { run: () => {
|
|
1203
|
-
l = null, c = requestAnimationFrame(
|
|
1207
|
+
l = null, c = requestAnimationFrame(h);
|
|
1204
1208
|
}, stop: () => {
|
|
1205
1209
|
c && (cancelAnimationFrame(c), c = null), u = null, g = 0, f = 0, l = null, d(!1);
|
|
1206
1210
|
} };
|
|
1207
1211
|
}
|
|
1208
|
-
const
|
|
1212
|
+
const en = {
|
|
1209
1213
|
getScrollState() {
|
|
1210
1214
|
return {
|
|
1211
1215
|
scrollTop: window.scrollY ?? document.documentElement.scrollTop,
|
|
@@ -1218,14 +1222,14 @@ const Qt = {
|
|
|
1218
1222
|
getRect() {
|
|
1219
1223
|
return new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
1220
1224
|
}
|
|
1221
|
-
},
|
|
1225
|
+
}, tn = {
|
|
1222
1226
|
get value() {
|
|
1223
1227
|
return typeof document < "u" ? document.documentElement : null;
|
|
1224
1228
|
}
|
|
1225
1229
|
};
|
|
1226
|
-
function
|
|
1227
|
-
const n =
|
|
1228
|
-
|
|
1230
|
+
function nn(e, t) {
|
|
1231
|
+
const n = V(!1), i = je(
|
|
1232
|
+
tn,
|
|
1229
1233
|
t ?? {},
|
|
1230
1234
|
() => {
|
|
1231
1235
|
if (e.state.value !== "dragging") return null;
|
|
@@ -1235,7 +1239,7 @@ function tn(e, t) {
|
|
|
1235
1239
|
y: o.y + c.height / 2
|
|
1236
1240
|
} : o : null;
|
|
1237
1241
|
},
|
|
1238
|
-
|
|
1242
|
+
en,
|
|
1239
1243
|
n
|
|
1240
1244
|
), r = ne(
|
|
1241
1245
|
() => e.state.value,
|
|
@@ -1245,15 +1249,15 @@ function tn(e, t) {
|
|
|
1245
1249
|
), a = () => {
|
|
1246
1250
|
r(), i.stop();
|
|
1247
1251
|
};
|
|
1248
|
-
return
|
|
1252
|
+
return Je(a), { isScrolling: n, stop: a };
|
|
1249
1253
|
}
|
|
1250
|
-
const
|
|
1251
|
-
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);
|
|
1252
1256
|
let a = null;
|
|
1253
1257
|
ne(
|
|
1254
1258
|
e.autoScrollViewport,
|
|
1255
1259
|
(o) => {
|
|
1256
|
-
a?.(), a = null, (o === !0 || o && typeof o == "object") && (a =
|
|
1260
|
+
a?.(), a = null, (o === !0 || o && typeof o == "object") && (a = nn(
|
|
1257
1261
|
e,
|
|
1258
1262
|
o === !0 ? {} : o
|
|
1259
1263
|
).stop);
|
|
@@ -1265,10 +1269,10 @@ const nn = (e) => {
|
|
|
1265
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();
|
|
1266
1270
|
});
|
|
1267
1271
|
}, ie = () => {
|
|
1268
|
-
const e =
|
|
1272
|
+
const e = Be(xe);
|
|
1269
1273
|
if (!e) throw Error("DnD provider not found");
|
|
1270
1274
|
return e;
|
|
1271
|
-
},
|
|
1275
|
+
}, We = () => {
|
|
1272
1276
|
const e = ie();
|
|
1273
1277
|
return {
|
|
1274
1278
|
preview: e.preview,
|
|
@@ -1283,13 +1287,13 @@ const nn = (e) => {
|
|
|
1283
1287
|
collision: e.collision,
|
|
1284
1288
|
autoScrollViewport: e.autoScrollViewport
|
|
1285
1289
|
};
|
|
1286
|
-
},
|
|
1290
|
+
}, an = /* @__PURE__ */ Oe({
|
|
1287
1291
|
__name: "DragPreview",
|
|
1288
1292
|
props: {
|
|
1289
1293
|
grid: {}
|
|
1290
1294
|
},
|
|
1291
1295
|
setup(e) {
|
|
1292
|
-
const { state: t, entities: n, preview: s } =
|
|
1296
|
+
const { state: t, entities: n, preview: s } = We(), i = Fe("contentRef");
|
|
1293
1297
|
ne(
|
|
1294
1298
|
() => i.value,
|
|
1295
1299
|
() => {
|
|
@@ -1306,27 +1310,27 @@ const nn = (e) => {
|
|
|
1306
1310
|
class: "dnd-kit-preview",
|
|
1307
1311
|
ref_key: "contentRef",
|
|
1308
1312
|
ref: i,
|
|
1309
|
-
style:
|
|
1313
|
+
style: Ce({
|
|
1310
1314
|
transform: `translate3d(${a.value.x}px, ${a.value.y}px, 0)`
|
|
1311
1315
|
})
|
|
1312
1316
|
}, [
|
|
1313
1317
|
me(o.$slots, "default", {
|
|
1314
1318
|
draggingMap: j(n).draggingMap
|
|
1315
1319
|
}, () => [
|
|
1316
|
-
(L(!0), W(he, null,
|
|
1320
|
+
(L(!0), W(he, null, Qe(j(n).draggingMap, ([l, u]) => (L(), W(he, { key: l }, [
|
|
1317
1321
|
u.render ? (L(), Q(be(u.render), { key: 0 })) : (L(), Q(be(l.tagName), {
|
|
1318
1322
|
key: 1,
|
|
1319
1323
|
innerHTML: u.initialOuterHTML,
|
|
1320
|
-
style:
|
|
1324
|
+
style: Ce({
|
|
1321
1325
|
width: u.initialRect.width + "px",
|
|
1322
1326
|
height: u.initialRect.height + "px"
|
|
1323
1327
|
})
|
|
1324
1328
|
}, null, 8, ["innerHTML", "style"]))
|
|
1325
1329
|
], 64))), 128))
|
|
1326
1330
|
])
|
|
1327
|
-
], 4)) :
|
|
1331
|
+
], 4)) : et("", !0);
|
|
1328
1332
|
}
|
|
1329
|
-
}),
|
|
1333
|
+
}), rn = /* @__PURE__ */ Oe({
|
|
1330
1334
|
__name: "DnDProvider",
|
|
1331
1335
|
props: {
|
|
1332
1336
|
autoScrollViewport: { type: [Object, Boolean, null] },
|
|
@@ -1335,18 +1339,18 @@ const nn = (e) => {
|
|
|
1335
1339
|
class: {}
|
|
1336
1340
|
},
|
|
1337
1341
|
setup(e) {
|
|
1338
|
-
const t = e, n =
|
|
1339
|
-
|
|
1342
|
+
const t = e, n = Fe("previewRef"), s = wt(n, t);
|
|
1343
|
+
sn(s);
|
|
1340
1344
|
const i = q(!1);
|
|
1341
1345
|
Y(() => i.value = !0);
|
|
1342
|
-
const r = b(() => s.preview.render.value ??
|
|
1343
|
-
return
|
|
1346
|
+
const r = b(() => s.preview.render.value ?? an);
|
|
1347
|
+
return tt(xe, s), (a, o) => (L(), W(he, null, [
|
|
1344
1348
|
me(a.$slots, "default"),
|
|
1345
|
-
(L(), Q(
|
|
1349
|
+
(L(), Q(nt, {
|
|
1346
1350
|
disabled: !i.value,
|
|
1347
1351
|
to: j(s).preview.to.value || "body"
|
|
1348
1352
|
}, [
|
|
1349
|
-
|
|
1353
|
+
st("div", it({
|
|
1350
1354
|
ref_key: "previewRef",
|
|
1351
1355
|
ref: n,
|
|
1352
1356
|
class: "dnd-kit-preview-container"
|
|
@@ -1359,32 +1363,32 @@ const nn = (e) => {
|
|
|
1359
1363
|
], 64));
|
|
1360
1364
|
}
|
|
1361
1365
|
});
|
|
1362
|
-
function
|
|
1366
|
+
function ln(e, t, n) {
|
|
1363
1367
|
const s = ie();
|
|
1364
1368
|
let i, r, a;
|
|
1365
1369
|
typeof t == "function" ? (i = {}, r = t) : (i = t ?? {}, r = n);
|
|
1366
1370
|
const o = i.id ?? Math.random().toString(36).slice(2), c = b({
|
|
1367
1371
|
get() {
|
|
1368
|
-
const f =
|
|
1372
|
+
const f = S(e);
|
|
1369
1373
|
return f ? s.entities.selectedSet.has(f) : !1;
|
|
1370
1374
|
},
|
|
1371
1375
|
set(f) {
|
|
1372
|
-
const d =
|
|
1376
|
+
const d = S(e);
|
|
1373
1377
|
d && s.entities.selectedSet[f ? "add" : "delete"](d);
|
|
1374
1378
|
}
|
|
1375
1379
|
}), l = b(() => {
|
|
1376
|
-
const f =
|
|
1380
|
+
const f = S(e);
|
|
1377
1381
|
return f ? s.entities.draggingMap.has(f) : !1;
|
|
1378
1382
|
}), u = b(() => {
|
|
1379
|
-
const f =
|
|
1383
|
+
const f = S(e);
|
|
1380
1384
|
return f ? s.entities.allowedDraggableSet.has(f) : !1;
|
|
1381
1385
|
}), g = b(() => {
|
|
1382
|
-
const f =
|
|
1386
|
+
const f = S(e);
|
|
1383
1387
|
if (f)
|
|
1384
1388
|
return s.entities.draggableMap.get(f)?.hoveredPlacement;
|
|
1385
1389
|
});
|
|
1386
1390
|
return Y(() => {
|
|
1387
|
-
if (a =
|
|
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, {
|
|
1388
1392
|
id: o,
|
|
1389
1393
|
render: i.render,
|
|
1390
1394
|
disabled: i.disabled ?? !1,
|
|
@@ -1413,11 +1417,11 @@ function rn(e, t, n) {
|
|
|
1413
1417
|
isDragOver: g
|
|
1414
1418
|
};
|
|
1415
1419
|
}
|
|
1416
|
-
const
|
|
1420
|
+
const cn = (e, t) => {
|
|
1417
1421
|
const n = ie(), s = b(() => e.value === n.entities.selectingArea);
|
|
1418
1422
|
let i = null;
|
|
1419
1423
|
Y(() => {
|
|
1420
|
-
i =
|
|
1424
|
+
i = S(e), i && (i.setAttribute(I.SELECT_AREA, ""), n.lib.selectableAreaObserver.observe(i), n.entities.selectableAreaMap.set(i, {
|
|
1421
1425
|
modifier: t?.modifier ?? {
|
|
1422
1426
|
keys: ["ControlLeft"],
|
|
1423
1427
|
method: "every"
|
|
@@ -1433,19 +1437,19 @@ const ln = (e, t) => {
|
|
|
1433
1437
|
const r = b(() => {
|
|
1434
1438
|
n.scrollPosition.x, n.scrollPosition.y;
|
|
1435
1439
|
const a = n.pointer.value;
|
|
1436
|
-
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);
|
|
1437
1441
|
});
|
|
1438
1442
|
return {
|
|
1439
1443
|
isSelecting: s,
|
|
1440
1444
|
style: r
|
|
1441
1445
|
};
|
|
1442
1446
|
};
|
|
1443
|
-
function
|
|
1444
|
-
const n =
|
|
1447
|
+
function gn(e, t) {
|
|
1448
|
+
const n = Be(xe);
|
|
1445
1449
|
if (!n) throw Error("DnD provider not found");
|
|
1446
1450
|
let s = null;
|
|
1447
1451
|
return Y(() => {
|
|
1448
|
-
s =
|
|
1452
|
+
s = S(e), s && (s.setAttribute(I.CONSTRAINT_AREA, ""), n.entities.constraintsAreaMap.set(s, {
|
|
1449
1453
|
axis: t?.axis || "both",
|
|
1450
1454
|
restrictToArea: t?.restrictToArea || !1
|
|
1451
1455
|
}));
|
|
@@ -1453,20 +1457,20 @@ function cn(e, t) {
|
|
|
1453
1457
|
s && n.entities.constraintsAreaMap.delete(s);
|
|
1454
1458
|
}), {};
|
|
1455
1459
|
}
|
|
1456
|
-
function
|
|
1460
|
+
function un(e, t, n) {
|
|
1457
1461
|
const s = ie();
|
|
1458
1462
|
let i = null, r, a;
|
|
1459
1463
|
typeof t == "function" ? (r = {}, a = t) : (r = t ?? {}, a = n);
|
|
1460
1464
|
const o = b(() => {
|
|
1461
|
-
const l =
|
|
1465
|
+
const l = S(e);
|
|
1462
1466
|
return l ? s.entities.allowedDroppableSet.has(l) : !1;
|
|
1463
1467
|
}), c = b(() => {
|
|
1464
|
-
const l =
|
|
1468
|
+
const l = S(e);
|
|
1465
1469
|
if (l)
|
|
1466
1470
|
return s.entities.droppableMap.get(l)?.hoveredPlacement;
|
|
1467
1471
|
});
|
|
1468
1472
|
return Y(() => {
|
|
1469
|
-
i =
|
|
1473
|
+
i = S(e), i && (i.setAttribute(I.DROPPABLE, ""), s.lib.droppableObserver.observe(i), s.entities.droppableMap.set(i, {
|
|
1470
1474
|
disabled: r.disabled ?? !1,
|
|
1471
1475
|
groups: r.groups ?? [],
|
|
1472
1476
|
groupMatch: r.groupMatch ?? "every",
|
|
@@ -1482,8 +1486,8 @@ function gn(e, t, n) {
|
|
|
1482
1486
|
isDragOver: c
|
|
1483
1487
|
};
|
|
1484
1488
|
}
|
|
1485
|
-
const
|
|
1486
|
-
const n =
|
|
1489
|
+
const fn = (e, t) => {
|
|
1490
|
+
const n = We(), s = V(!1), r = je(
|
|
1487
1491
|
e,
|
|
1488
1492
|
t ?? {},
|
|
1489
1493
|
() => {
|
|
@@ -1505,13 +1509,13 @@ const un = (e, t) => {
|
|
|
1505
1509
|
), { isScrolling: s };
|
|
1506
1510
|
};
|
|
1507
1511
|
export {
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
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
|
|
1517
1521
|
};
|