@vue-dnd-kit/core 2.0.2 → 2.0.4
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.
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-default-overlay{transform:translate3d(var(--position-x),var(--position-y),0)}.dnd-kit-overlay-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing;z-index:9999}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
import { ref as
|
|
3
|
-
const
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dnd-kit-default-overlay{transform:translate3d(var(--position-x),var(--position-y),0)}pre{position:fixed;top:0;left:0;height:100svh}.dnd-kit-overlay-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing;z-index:9999}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
import { ref as W, watch as oe, shallowRef as J, reactive as V, computed as b, onScopeDispose as We, onMounted as Y, onBeforeUnmount as X, inject as ze, defineComponent as Oe, unref as k, openBlock as C, createElementBlock as j, normalizeStyle as xe, Fragment as ue, renderList as je, createBlock as Q, resolveDynamicComponent as fe, createCommentVNode as Je, useTemplateRef as Qe, provide as et, renderSlot as Ae, Teleport as tt, createElementVNode as nt, mergeProps as st } from "vue";
|
|
3
|
+
const T = {
|
|
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
|
-
},
|
|
9
|
-
SELECT_AREA: `[${
|
|
10
|
-
DRAGGABLE: `[${
|
|
11
|
-
CONSTRAINT_AREA: `[${
|
|
12
|
-
},
|
|
8
|
+
}, F = {
|
|
9
|
+
SELECT_AREA: `[${T.SELECT_AREA}]`,
|
|
10
|
+
DRAGGABLE: `[${T.DRAGGABLE}]`,
|
|
11
|
+
CONSTRAINT_AREA: `[${T.CONSTRAINT_AREA}]`
|
|
12
|
+
}, De = "VueDnDKitProvider", Ee = (e, t, s, n) => {
|
|
13
13
|
const o = /* @__PURE__ */ new Set();
|
|
14
|
-
return t.forEach((
|
|
15
|
-
const r = e.get(
|
|
16
|
-
if (!r ||
|
|
17
|
-
const g = r.modifier?.keys,
|
|
18
|
-
if (!g || !
|
|
19
|
-
o.add(
|
|
14
|
+
return t.forEach((a) => {
|
|
15
|
+
const r = e.get(a), i = n ? n(a) : r?.disabled;
|
|
16
|
+
if (!r || i) return;
|
|
17
|
+
const g = r.modifier?.keys, l = r.modifier?.method;
|
|
18
|
+
if (!g || !l || g.length === 0) {
|
|
19
|
+
o.add(a);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
g[
|
|
22
|
+
g[l]((c) => s.value.has(c)) && o.add(a);
|
|
23
23
|
}), o;
|
|
24
24
|
};
|
|
25
|
-
let
|
|
26
|
-
const
|
|
25
|
+
let Be = "", ot = "", rt = "";
|
|
26
|
+
const v = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, H = (e, t) => e !== t && e.contains(t), it = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), de = () => {
|
|
27
27
|
const e = document.body;
|
|
28
|
-
|
|
29
|
-
},
|
|
28
|
+
Be = e.style.userSelect, e.style.userSelect = "none", window.addEventListener("contextmenu", w), window.addEventListener("selectstart", w), window.addEventListener("touchstart", w), window.addEventListener("touchmove", w);
|
|
29
|
+
}, me = () => {
|
|
30
30
|
const e = document.body;
|
|
31
|
-
e.style.userSelect =
|
|
32
|
-
},
|
|
31
|
+
e.style.userSelect = Be, e.style.touchAction = ot, e.style.overscrollBehavior = rt, window.removeEventListener("contextmenu", w), window.removeEventListener("selectstart", w), window.removeEventListener("touchstart", w), window.removeEventListener("touchmove", w);
|
|
32
|
+
}, w = (e) => e.preventDefault(), Me = (e, t) => {
|
|
33
33
|
if (t.entities.draggableMap.get(e)?.disabled) return !0;
|
|
34
34
|
for (const n of t.entities.visibleDraggableSet)
|
|
35
|
-
if (t.entities.draggableMap.get(n)?.disabled &&
|
|
35
|
+
if (t.entities.draggableMap.get(n)?.disabled && H(n, e)) return !0;
|
|
36
36
|
return !1;
|
|
37
|
-
},
|
|
37
|
+
}, _ = (e, t) => {
|
|
38
38
|
if (t.entities.droppableMap.get(e)?.disabled) return !0;
|
|
39
39
|
for (const n of t.entities.visibleDroppableSet)
|
|
40
|
-
if (t.entities.droppableMap.get(n)?.disabled &&
|
|
40
|
+
if (t.entities.droppableMap.get(n)?.disabled && H(n, e)) return !0;
|
|
41
41
|
return !1;
|
|
42
|
-
},
|
|
42
|
+
}, ve = (e, t) => {
|
|
43
43
|
if (!e.length || !t.length) return !0;
|
|
44
44
|
const s = new Set(t);
|
|
45
45
|
return e.some((n) => s.has(n));
|
|
46
46
|
};
|
|
47
|
-
function
|
|
47
|
+
function at(e, t, s, n) {
|
|
48
48
|
const o = /* @__PURE__ */ new Set();
|
|
49
|
-
for (const
|
|
50
|
-
const g = s.get(
|
|
51
|
-
for (const
|
|
49
|
+
for (const i of t.keys()) {
|
|
50
|
+
const g = s.get(i);
|
|
51
|
+
for (const l of g?.groups ?? []) o.add(l);
|
|
52
52
|
}
|
|
53
|
-
const
|
|
54
|
-
for (const
|
|
55
|
-
const
|
|
56
|
-
|
|
53
|
+
const a = [...o], r = /* @__PURE__ */ new Set();
|
|
54
|
+
for (const i of e) {
|
|
55
|
+
const l = n.get(i)?.groups ?? [];
|
|
56
|
+
ve(a, l) && r.add(i);
|
|
57
57
|
}
|
|
58
58
|
return r;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function lt(e, t, s) {
|
|
61
61
|
const n = /* @__PURE__ */ new Set();
|
|
62
62
|
for (const r of t.keys()) {
|
|
63
|
-
const
|
|
64
|
-
for (const g of
|
|
63
|
+
const i = s.get(r);
|
|
64
|
+
for (const g of i?.groups ?? []) n.add(g);
|
|
65
65
|
}
|
|
66
|
-
const o = [...n],
|
|
66
|
+
const o = [...n], a = /* @__PURE__ */ new Set();
|
|
67
67
|
for (const r of e) {
|
|
68
68
|
const g = s.get(r)?.groups ?? [];
|
|
69
|
-
|
|
69
|
+
ve(o, g) && a.add(r);
|
|
70
70
|
}
|
|
71
|
-
return
|
|
71
|
+
return a;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const le = (e) => {
|
|
74
74
|
const t = new IntersectionObserver((s) => {
|
|
75
75
|
s.forEach((n) => {
|
|
76
76
|
const o = n.target;
|
|
@@ -82,23 +82,23 @@ const fe = (e) => {
|
|
|
82
82
|
unobserve: (s) => t.unobserve(s),
|
|
83
83
|
disconnect: () => t.disconnect()
|
|
84
84
|
};
|
|
85
|
-
},
|
|
85
|
+
}, ct = (e) => {
|
|
86
86
|
const t = new ResizeObserver((s) => {
|
|
87
87
|
const n = s[0];
|
|
88
88
|
if (!n) return;
|
|
89
|
-
const { width: o, height:
|
|
90
|
-
e.value = { width: o, height:
|
|
89
|
+
const { width: o, height: a } = n.contentRect;
|
|
90
|
+
e.value = { width: o, height: a };
|
|
91
91
|
});
|
|
92
92
|
return {
|
|
93
93
|
observe: (s) => t.observe(s),
|
|
94
94
|
unobserve: (s) => t.unobserve(s),
|
|
95
95
|
disconnect: () => t.disconnect()
|
|
96
96
|
};
|
|
97
|
-
},
|
|
98
|
-
const t =
|
|
97
|
+
}, gt = (e) => {
|
|
98
|
+
const t = W(null), s = ct(t), n = oe(
|
|
99
99
|
e,
|
|
100
|
-
(
|
|
101
|
-
s.disconnect(),
|
|
100
|
+
(a) => {
|
|
101
|
+
s.disconnect(), a && s.observe(a);
|
|
102
102
|
},
|
|
103
103
|
{ immediate: !0 }
|
|
104
104
|
);
|
|
@@ -108,18 +108,18 @@ const fe = (e) => {
|
|
|
108
108
|
}
|
|
109
109
|
} };
|
|
110
110
|
};
|
|
111
|
-
function
|
|
111
|
+
function he(e, t = 0, s = 0) {
|
|
112
112
|
return {
|
|
113
113
|
start: { x: e.clientX, y: e.clientY },
|
|
114
114
|
current: { x: e.clientX, y: e.clientY },
|
|
115
115
|
offset: { x: t, y: s }
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function Fe(e, t) {
|
|
119
119
|
const s = t.getBoundingClientRect(), n = s.width > 0 ? (e.clientX - s.left) / s.width : 0.5, o = s.height > 0 ? (e.clientY - s.top) / s.height : 0.5;
|
|
120
120
|
return { x: n, y: o };
|
|
121
121
|
}
|
|
122
|
-
function
|
|
122
|
+
function _e(e, t) {
|
|
123
123
|
return {
|
|
124
124
|
...t,
|
|
125
125
|
initialHTML: e.innerHTML,
|
|
@@ -127,67 +127,67 @@ function je(e, t) {
|
|
|
127
127
|
initialOuterHTML: e.outerHTML
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function ut(e, t, s) {
|
|
131
131
|
e.forEach((n) => {
|
|
132
132
|
const o = t.get(n);
|
|
133
|
-
s.set(n,
|
|
133
|
+
s.set(n, _e(n, o));
|
|
134
134
|
}), e.clear();
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function ft(e, t, s) {
|
|
137
137
|
s.clear();
|
|
138
138
|
const n = t.get(e);
|
|
139
|
-
s.set(e,
|
|
139
|
+
s.set(e, _e(e, n));
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
e.entities.initiatingDraggable && (e.state.value = "dragging",
|
|
141
|
+
function ee(e) {
|
|
142
|
+
e.entities.initiatingDraggable && (e.state.value = "dragging", dt(
|
|
143
143
|
e.entities.initiatingDraggable,
|
|
144
144
|
e.entities.selectedSet,
|
|
145
145
|
e.entities.draggableMap,
|
|
146
146
|
e.entities.draggingMap
|
|
147
147
|
));
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
t.has(e) ?
|
|
149
|
+
function dt(e, t, s, n) {
|
|
150
|
+
t.has(e) ? ut(t, s, n) : (t.clear(), ft(e, s, n));
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function Ge(e, t, s, n) {
|
|
153
153
|
if (n || !s) return !0;
|
|
154
154
|
const o = e.closest(s);
|
|
155
155
|
return o ? t.contains(o) : !1;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
157
|
+
function mt(e, t) {
|
|
158
158
|
if (!e || !t) return 1;
|
|
159
159
|
const s = Math.abs(e.current.x - e.start.x), n = Math.abs(e.current.y - e.start.y);
|
|
160
160
|
if (typeof t == "number") {
|
|
161
|
-
const
|
|
162
|
-
return Math.min(
|
|
161
|
+
const l = Math.sqrt(s * s + n * n);
|
|
162
|
+
return Math.min(l / t, 1);
|
|
163
163
|
}
|
|
164
164
|
const {
|
|
165
165
|
x: o = 0,
|
|
166
|
-
y:
|
|
166
|
+
y: a = 0,
|
|
167
167
|
condition: r = "any"
|
|
168
168
|
} = t;
|
|
169
|
-
if (o === 0 &&
|
|
170
|
-
const
|
|
171
|
-
return r === "both" ? Math.min(
|
|
169
|
+
if (o === 0 && a === 0) return 1;
|
|
170
|
+
const i = o > 0 ? Math.min(s / o, 1) : 1, g = a > 0 ? Math.min(n / a, 1) : 1;
|
|
171
|
+
return r === "both" ? Math.min(i, g) : Math.max(i, g);
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function He(e, t, s) {
|
|
174
174
|
if (!s) return !0;
|
|
175
175
|
const n = s.distance != null, o = s.delay != null;
|
|
176
176
|
return !n && !o ? !0 : n && !o ? e >= 1 : !n && o ? t >= 1 : (s.condition ?? "both") === "both" ? e >= 1 && t >= 1 : e >= 1 || t >= 1;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function ht(e) {
|
|
179
179
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable)
|
|
180
180
|
return !1;
|
|
181
181
|
const t = e.entities.draggableMap.get(
|
|
182
182
|
e.entities.initiatingDraggable
|
|
183
183
|
);
|
|
184
|
-
return
|
|
184
|
+
return He(
|
|
185
185
|
e.distanceProgress.value,
|
|
186
186
|
e.delay.progress,
|
|
187
187
|
t?.activation
|
|
188
|
-
) ? (
|
|
188
|
+
) ? (ee(e), !0) : !1;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function bt(e, t) {
|
|
191
191
|
let s = null;
|
|
192
192
|
const n = () => {
|
|
193
193
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable) {
|
|
@@ -196,15 +196,15 @@ function Ct(e, t) {
|
|
|
196
196
|
}
|
|
197
197
|
const o = e.entities.draggableMap.get(
|
|
198
198
|
e.entities.initiatingDraggable
|
|
199
|
-
),
|
|
200
|
-
if (!
|
|
199
|
+
), a = o?.activation?.delay;
|
|
200
|
+
if (!a) {
|
|
201
201
|
s = null;
|
|
202
202
|
return;
|
|
203
203
|
}
|
|
204
204
|
e.delay.progress = Math.min(
|
|
205
|
-
(Date.now() - e.delay.startTime) / (
|
|
205
|
+
(Date.now() - e.delay.startTime) / (a * 1e3),
|
|
206
206
|
1
|
|
207
|
-
),
|
|
207
|
+
), He(
|
|
208
208
|
e.distanceProgress.value,
|
|
209
209
|
e.delay.progress,
|
|
210
210
|
o?.activation
|
|
@@ -216,53 +216,53 @@ function Ct(e, t) {
|
|
|
216
216
|
}
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function yt(e, t) {
|
|
220
220
|
const s = e.closest(
|
|
221
|
-
|
|
221
|
+
F.CONSTRAINT_AREA
|
|
222
222
|
);
|
|
223
223
|
return !s || !t.has(s) ? null : {
|
|
224
224
|
element: s,
|
|
225
225
|
entity: t.get(s)
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function pt(e, t, s, n) {
|
|
229
229
|
return s === "x" ? { x: e, y: n.top } : s === "y" ? { x: n.left, y: t } : { x: e, y: t };
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
let
|
|
233
|
-
return s !== "y" && (
|
|
231
|
+
function St(e, t, s, n, o) {
|
|
232
|
+
let a = e, r = t;
|
|
233
|
+
return s !== "y" && (a = Math.max(
|
|
234
234
|
n.left,
|
|
235
235
|
Math.min(n.right - o.width, e)
|
|
236
236
|
)), s !== "x" && (r = Math.max(
|
|
237
237
|
n.top,
|
|
238
238
|
Math.min(n.bottom - o.height, t)
|
|
239
|
-
)), { x:
|
|
239
|
+
)), { x: a, y: r };
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function Dt(e, t, s, n, o) {
|
|
242
242
|
if (!e || !t)
|
|
243
243
|
return { x: 0, y: 0 };
|
|
244
|
-
const
|
|
245
|
-
let g = e.current.x - r * e.offset.x,
|
|
244
|
+
const a = t.getBoundingClientRect(), r = a.width || o?.width || 0, i = a.height || o?.height || 0;
|
|
245
|
+
let g = e.current.x - r * e.offset.x, l = e.current.y - i * e.offset.y;
|
|
246
246
|
if (!s)
|
|
247
|
-
return { x: g, y:
|
|
248
|
-
const
|
|
249
|
-
if (!
|
|
250
|
-
return { x: g, y:
|
|
251
|
-
const { element:
|
|
247
|
+
return { x: g, y: l };
|
|
248
|
+
const u = yt(s, n);
|
|
249
|
+
if (!u)
|
|
250
|
+
return { x: g, y: l };
|
|
251
|
+
const { element: c, entity: f } = u, d = c.getBoundingClientRect(), m = s.getBoundingClientRect(), h = pt(
|
|
252
252
|
g,
|
|
253
|
-
|
|
253
|
+
l,
|
|
254
254
|
f.axis || "both",
|
|
255
255
|
m
|
|
256
256
|
);
|
|
257
|
-
return f.restrictToArea ?
|
|
257
|
+
return f.restrictToArea ? St(
|
|
258
258
|
h.x,
|
|
259
259
|
h.y,
|
|
260
260
|
f.axis || "both",
|
|
261
261
|
d,
|
|
262
|
-
|
|
262
|
+
a
|
|
263
263
|
) : h;
|
|
264
264
|
}
|
|
265
|
-
const
|
|
265
|
+
const N = {
|
|
266
266
|
forDrag: ["Enter", "Space"],
|
|
267
267
|
forCancel: ["Escape"],
|
|
268
268
|
forDrop: ["Enter", "Space"],
|
|
@@ -278,19 +278,19 @@ const V = {
|
|
|
278
278
|
],
|
|
279
279
|
forMoveFaster: ["ShiftLeft", "ShiftRight"]
|
|
280
280
|
};
|
|
281
|
-
function
|
|
282
|
-
const s =
|
|
281
|
+
function Mt(e, t) {
|
|
282
|
+
const s = J(), n = W(), a = {
|
|
283
283
|
keys: {
|
|
284
|
-
pressedKeys:
|
|
285
|
-
forDrag: [...
|
|
286
|
-
forCancel: [...
|
|
287
|
-
forDrop: [...
|
|
288
|
-
forMove: [...
|
|
289
|
-
forMoveFaster: [...
|
|
284
|
+
pressedKeys: W(/* @__PURE__ */ new Set()),
|
|
285
|
+
forDrag: [...N.forDrag],
|
|
286
|
+
forCancel: [...N.forCancel],
|
|
287
|
+
forDrop: [...N.forDrop],
|
|
288
|
+
forMove: [...N.forMove],
|
|
289
|
+
forMoveFaster: [...N.forMoveFaster]
|
|
290
290
|
},
|
|
291
291
|
step: 8,
|
|
292
292
|
moveFaster: 4
|
|
293
|
-
}, r =
|
|
293
|
+
}, r = V({
|
|
294
294
|
draggableMap: /* @__PURE__ */ new Map(),
|
|
295
295
|
droppableMap: /* @__PURE__ */ new Map(),
|
|
296
296
|
selectableAreaMap: /* @__PURE__ */ new Map(),
|
|
@@ -299,93 +299,93 @@ function Rt(e, t) {
|
|
|
299
299
|
selectingArea: void 0,
|
|
300
300
|
draggingMap: /* @__PURE__ */ new Map(),
|
|
301
301
|
selectedSet: /* @__PURE__ */ new Set(),
|
|
302
|
-
allowedDroppableSet:
|
|
302
|
+
allowedDroppableSet: b(() => s.value ? at(
|
|
303
303
|
r.visibleDroppableSet,
|
|
304
304
|
r.draggingMap,
|
|
305
305
|
r.draggableMap,
|
|
306
306
|
r.droppableMap
|
|
307
307
|
) : /* @__PURE__ */ new Set()),
|
|
308
|
-
allowedDraggableSet:
|
|
308
|
+
allowedDraggableSet: b(() => s.value ? lt(
|
|
309
309
|
r.visibleDraggableSet,
|
|
310
310
|
r.draggingMap,
|
|
311
311
|
r.draggableMap
|
|
312
312
|
) : /* @__PURE__ */ new Set()),
|
|
313
|
-
modifiersSelectableAreaSet:
|
|
313
|
+
modifiersSelectableAreaSet: b(() => Ee(
|
|
314
314
|
r.selectableAreaMap,
|
|
315
315
|
r.visibleSelectableAreaSet,
|
|
316
|
-
|
|
316
|
+
a.keys.pressedKeys
|
|
317
317
|
)),
|
|
318
|
-
modifiersDraggableSet:
|
|
318
|
+
modifiersDraggableSet: b(() => Ee(
|
|
319
319
|
r.draggableMap,
|
|
320
320
|
r.visibleDraggableSet,
|
|
321
|
-
|
|
322
|
-
(
|
|
321
|
+
a.keys.pressedKeys,
|
|
322
|
+
(x) => Me(x, { entities: r })
|
|
323
323
|
)),
|
|
324
324
|
visibleDraggableSet: /* @__PURE__ */ new Set(),
|
|
325
325
|
visibleDroppableSet: /* @__PURE__ */ new Set(),
|
|
326
326
|
visibleSelectableAreaSet: /* @__PURE__ */ new Set()
|
|
327
|
-
}),
|
|
327
|
+
}), i = V({
|
|
328
328
|
draggable: /* @__PURE__ */ new Map(),
|
|
329
329
|
droppable: /* @__PURE__ */ new Map()
|
|
330
330
|
}), g = {
|
|
331
|
-
throttle:
|
|
332
|
-
},
|
|
331
|
+
throttle: J(0)
|
|
332
|
+
}, l = V({
|
|
333
333
|
x: window.scrollX,
|
|
334
334
|
y: window.scrollY
|
|
335
|
-
}),
|
|
335
|
+
}), u = V({
|
|
336
336
|
progress: 0,
|
|
337
337
|
startTime: 0
|
|
338
|
-
}),
|
|
338
|
+
}), c = b(() => {
|
|
339
339
|
if (!n.value || !r.initiatingDraggable) return 0;
|
|
340
|
-
const
|
|
341
|
-
return
|
|
342
|
-
}), f =
|
|
340
|
+
const x = r.draggableMap.get(r.initiatingDraggable)?.activation?.distance;
|
|
341
|
+
return x ? mt(n.value, x) : 1;
|
|
342
|
+
}), f = le(
|
|
343
343
|
r.visibleDraggableSet
|
|
344
|
-
), d =
|
|
344
|
+
), d = le(
|
|
345
345
|
r.visibleDroppableSet
|
|
346
|
-
), m =
|
|
346
|
+
), m = le(
|
|
347
347
|
r.visibleSelectableAreaSet
|
|
348
|
-
), { overlaySize: h, overlaySizeObserver:
|
|
349
|
-
const
|
|
350
|
-
return
|
|
348
|
+
), { overlaySize: h, overlaySizeObserver: p } = gt(e), y = W(), M = b(() => {
|
|
349
|
+
const D = r.initiatingDraggable;
|
|
350
|
+
return Dt(
|
|
351
351
|
n.value,
|
|
352
352
|
e.value,
|
|
353
|
-
|
|
353
|
+
D || null,
|
|
354
354
|
r.constraintsAreaMap,
|
|
355
355
|
h.value
|
|
356
356
|
);
|
|
357
|
-
}),
|
|
357
|
+
}), S = b({
|
|
358
358
|
get: () => t?.overlayTo,
|
|
359
|
-
set: (
|
|
360
|
-
}),
|
|
359
|
+
set: (D) => S.value = D
|
|
360
|
+
}), U = b(() => t?.autoScrollViewport);
|
|
361
361
|
return {
|
|
362
362
|
state: s,
|
|
363
363
|
pointer: n,
|
|
364
364
|
entities: r,
|
|
365
|
-
keyboard:
|
|
366
|
-
scrollPosition:
|
|
367
|
-
delay:
|
|
368
|
-
distanceProgress:
|
|
369
|
-
hovered:
|
|
365
|
+
keyboard: a,
|
|
366
|
+
scrollPosition: l,
|
|
367
|
+
delay: u,
|
|
368
|
+
distanceProgress: c,
|
|
369
|
+
hovered: i,
|
|
370
370
|
collision: g,
|
|
371
371
|
overlay: {
|
|
372
372
|
size: h,
|
|
373
|
-
position:
|
|
374
|
-
render:
|
|
373
|
+
position: M,
|
|
374
|
+
render: y,
|
|
375
375
|
ref: e,
|
|
376
|
-
to:
|
|
376
|
+
to: S
|
|
377
377
|
},
|
|
378
378
|
lib: {
|
|
379
379
|
draggableObserver: f,
|
|
380
380
|
droppableObserver: d,
|
|
381
381
|
selectableAreaObserver: m,
|
|
382
|
-
overlaySizeObserver:
|
|
382
|
+
overlaySizeObserver: p,
|
|
383
383
|
rectCache: /* @__PURE__ */ new Map()
|
|
384
384
|
},
|
|
385
|
-
autoScrollViewport:
|
|
385
|
+
autoScrollViewport: U
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
|
-
const
|
|
388
|
+
const te = (e) => {
|
|
389
389
|
const t = e.hovered.draggable.keys().next().value;
|
|
390
390
|
if (t) {
|
|
391
391
|
const n = e.entities.draggableMap.get(t);
|
|
@@ -398,208 +398,208 @@ const le = (e) => {
|
|
|
398
398
|
}
|
|
399
399
|
e.lib.rectCache.clear(), e.pointer.value = void 0, e.state.value = void 0, e.entities.selectingArea = void 0, 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();
|
|
400
400
|
};
|
|
401
|
-
function
|
|
401
|
+
function I(e, t, s) {
|
|
402
402
|
const n = Math.max(0, Math.min(t, e.length));
|
|
403
403
|
return [...e.slice(0, n), ...s, ...e.slice(n)];
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function we(e, t, s = 1) {
|
|
406
406
|
const n = Math.max(0, Math.min(t, e.length - 1)), o = Math.max(0, Math.min(s, e.length - n));
|
|
407
407
|
return [...e.slice(0, n), ...e.slice(n + o)];
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
const s = [...new Set(t)].filter((o) => o >= 0 && o < e.length).sort((o,
|
|
409
|
+
function G(e, t) {
|
|
410
|
+
const s = [...new Set(t)].filter((o) => o >= 0 && o < e.length).sort((o, a) => a - o);
|
|
411
411
|
let n = e;
|
|
412
|
-
for (const o of s) n =
|
|
412
|
+
for (const o of s) n = we(n, o, 1);
|
|
413
413
|
return n;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function Ke(e, t, s) {
|
|
416
416
|
if (t === s || t < 0 || s < 0 || t >= e.length || s >= e.length)
|
|
417
417
|
return e;
|
|
418
418
|
const n = [...e];
|
|
419
419
|
return [n[t], n[s]] = [n[s], n[t]], n;
|
|
420
420
|
}
|
|
421
|
-
const
|
|
421
|
+
const R = {
|
|
422
422
|
getInsertSide(e, t) {
|
|
423
423
|
return e ? t === "vertical" ? e.top && !e.bottom ? "before" : e.bottom && !e.top ? "after" : e.top ? "before" : null : e.left && !e.right ? "before" : e.right && !e.left ? "after" : e.left ? "before" : null : null;
|
|
424
424
|
},
|
|
425
425
|
isAtZoneStart(e, t) {
|
|
426
|
-
return
|
|
426
|
+
return R.getInsertSide(e, t) === "before" && !e?.center;
|
|
427
427
|
},
|
|
428
428
|
isAtZoneEnd(e, t) {
|
|
429
|
-
return
|
|
429
|
+
return R.getInsertSide(e, t) === "after" && !e?.center;
|
|
430
430
|
}
|
|
431
431
|
};
|
|
432
|
-
function
|
|
432
|
+
function Ne(e, t) {
|
|
433
433
|
const { draggedItems: s, dropZone: n, hoveredDraggable: o } = e;
|
|
434
434
|
if (!s.length) return null;
|
|
435
|
-
const
|
|
435
|
+
const a = o?.placement.center === !0 && n != null && n.items !== o.items, r = a ? n.items : o?.items ?? n?.items;
|
|
436
436
|
if (!r) return null;
|
|
437
|
-
const
|
|
438
|
-
let
|
|
439
|
-
if (o && !
|
|
440
|
-
const f = o.items ===
|
|
437
|
+
const i = s[0].items, g = s.map((f) => f.index), l = r.length;
|
|
438
|
+
let u, c;
|
|
439
|
+
if (o && !a) {
|
|
440
|
+
const f = o.items === i && g.includes(o.index);
|
|
441
441
|
if (f && s.length === 1) {
|
|
442
|
-
const d =
|
|
443
|
-
|
|
442
|
+
const d = R.isAtZoneStart(n?.placement, t);
|
|
443
|
+
u = d ? 0 : l, c = d ? "prepend" : "append";
|
|
444
444
|
} else {
|
|
445
445
|
if (f)
|
|
446
446
|
return null;
|
|
447
447
|
{
|
|
448
|
-
const d =
|
|
449
|
-
d === "before" ? (
|
|
448
|
+
const d = R.getInsertSide(o.placement, t), m = o.index;
|
|
449
|
+
d === "before" ? (u = Math.max(0, m), c = "insert") : d === "after" ? (u = Math.min(l, m + 1), c = "insert") : (u = l, c = "append");
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
452
|
} else {
|
|
453
453
|
if (!n) return null;
|
|
454
|
-
const f =
|
|
455
|
-
|
|
454
|
+
const f = R.isAtZoneStart(n.placement, t);
|
|
455
|
+
u = f ? 0 : l, c = f ? "prepend" : "append";
|
|
456
456
|
}
|
|
457
|
-
return { targetIndex:
|
|
457
|
+
return { targetIndex: u, mode: c, targetArr: r };
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function vt(e, t = "vertical") {
|
|
460
460
|
const { draggedItems: s } = e;
|
|
461
461
|
if (!s.length) return null;
|
|
462
|
-
const n =
|
|
462
|
+
const n = Ne(e, t);
|
|
463
463
|
if (!n) return null;
|
|
464
|
-
const { targetArr: o, mode:
|
|
464
|
+
const { targetArr: o, mode: a } = n;
|
|
465
465
|
let { targetIndex: r } = n;
|
|
466
|
-
const
|
|
467
|
-
if (
|
|
468
|
-
const
|
|
469
|
-
r = Math.max(0, r -
|
|
470
|
-
const f =
|
|
471
|
-
return { sourceItems: f, targetItems: f, draggedItems: g, sourceIndexes:
|
|
466
|
+
const i = s.map((c) => c.index), g = s.map((c) => c.item), l = s[0].items;
|
|
467
|
+
if (l === o) {
|
|
468
|
+
const c = i.filter((d) => d < r).length;
|
|
469
|
+
r = Math.max(0, r - c);
|
|
470
|
+
const f = I(G(l, i), r, g);
|
|
471
|
+
return { sourceItems: f, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex: r, mode: a, sameList: !0 };
|
|
472
472
|
} else {
|
|
473
|
-
const
|
|
474
|
-
return { sourceItems:
|
|
473
|
+
const c = G(l, i), f = I(o, r, g);
|
|
474
|
+
return { sourceItems: c, targetItems: f, draggedItems: g, sourceIndexes: i, targetIndex: r, mode: a, sameList: !1 };
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function wt(e) {
|
|
478
478
|
const { draggedItems: t, hoveredDraggable: s } = e;
|
|
479
479
|
if (!t.length || !s) return null;
|
|
480
|
-
const n = t.map((
|
|
481
|
-
if (
|
|
480
|
+
const n = t.map((u) => u.index), o = s.index, a = t.map((u) => u.item), r = s.item, i = t[0].items, g = s.items, l = i === g;
|
|
481
|
+
if (l && n.includes(o)) return null;
|
|
482
482
|
if (t.length === 1) {
|
|
483
|
-
const
|
|
484
|
-
if (
|
|
485
|
-
const
|
|
486
|
-
return { sourceItems:
|
|
483
|
+
const u = n[0];
|
|
484
|
+
if (l) {
|
|
485
|
+
const c = Ke(i, u, o);
|
|
486
|
+
return { sourceItems: c, targetItems: c, sourceIndexes: n, targetIndex: o, sameList: !0 };
|
|
487
487
|
} else {
|
|
488
|
-
const
|
|
489
|
-
return
|
|
488
|
+
const c = [...i], f = [...g];
|
|
489
|
+
return c[u] = g[o], f[o] = i[u], { sourceItems: c, targetItems: f, sourceIndexes: n, targetIndex: o, sameList: !1 };
|
|
490
490
|
}
|
|
491
491
|
} else {
|
|
492
|
-
const
|
|
493
|
-
if (
|
|
494
|
-
const
|
|
495
|
-
let h =
|
|
496
|
-
h =
|
|
497
|
-
const
|
|
498
|
-
return h =
|
|
492
|
+
const u = Math.min(...n);
|
|
493
|
+
if (l) {
|
|
494
|
+
const c = n.filter((y) => y < o).length, f = Math.max(0, o - c), d = n.filter((y) => y < u).length, m = Math.max(0, u - d);
|
|
495
|
+
let h = G(i, n);
|
|
496
|
+
h = I(h, f, a);
|
|
497
|
+
const p = m >= f ? m + a.length : m;
|
|
498
|
+
return h = I(h, p, [r]), { sourceItems: h, targetItems: h, sourceIndexes: n, targetIndex: f, sameList: !0 };
|
|
499
499
|
} else {
|
|
500
|
-
const
|
|
501
|
-
let d =
|
|
502
|
-
d =
|
|
503
|
-
let m =
|
|
504
|
-
return m =
|
|
500
|
+
const c = n.filter((h) => h < u).length, f = Math.max(0, u - c);
|
|
501
|
+
let d = G(i, n);
|
|
502
|
+
d = I(d, f, [r]);
|
|
503
|
+
let m = we(g, o);
|
|
504
|
+
return m = I(m, o, a), { sourceItems: d, targetItems: m, sourceIndexes: n, targetIndex: o, sameList: !1 };
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function xt(e, t = "vertical") {
|
|
509
509
|
const { draggedItems: s } = e;
|
|
510
510
|
if (!s.length) return null;
|
|
511
|
-
const n =
|
|
511
|
+
const n = Ne(e, t);
|
|
512
512
|
if (!n) return null;
|
|
513
|
-
const { targetArr: o, targetIndex:
|
|
514
|
-
return { targetItems:
|
|
513
|
+
const { targetArr: o, targetIndex: a, mode: r } = n, i = s.map((l) => l.item);
|
|
514
|
+
return { targetItems: I(o, a, i), copiedItems: i, targetIndex: a, mode: r };
|
|
515
515
|
}
|
|
516
|
-
function
|
|
516
|
+
function At(e) {
|
|
517
517
|
const { draggedItems: t } = e;
|
|
518
518
|
if (!t.length) return null;
|
|
519
519
|
const s = t.map((r) => r.index), n = t.map((r) => r.item), o = t[0].items;
|
|
520
|
-
return { sourceItems:
|
|
520
|
+
return { sourceItems: G(o, s), removedItems: n, sourceIndexes: s };
|
|
521
521
|
}
|
|
522
|
-
function
|
|
522
|
+
function Et(e) {
|
|
523
523
|
return {
|
|
524
524
|
// Low-level array ops
|
|
525
|
-
insertAt:
|
|
526
|
-
removeAt:
|
|
527
|
-
removeIndexes:
|
|
528
|
-
swapAt:
|
|
525
|
+
insertAt: I,
|
|
526
|
+
removeAt: we,
|
|
527
|
+
removeIndexes: G,
|
|
528
|
+
swapAt: Ke,
|
|
529
529
|
// Placement helpers
|
|
530
|
-
getInsertSide: (t, s) =>
|
|
531
|
-
isAtZoneStart: (t, s) =>
|
|
532
|
-
isAtZoneEnd: (t, s) =>
|
|
530
|
+
getInsertSide: (t, s) => R.getInsertSide(t, s),
|
|
531
|
+
isAtZoneStart: (t, s) => R.isAtZoneStart(t, s),
|
|
532
|
+
isAtZoneEnd: (t, s) => R.isAtZoneEnd(t, s),
|
|
533
533
|
// High-level (event-bound)
|
|
534
|
-
suggestSort: (t) =>
|
|
535
|
-
suggestSwap: () =>
|
|
536
|
-
suggestCopy: (t) =>
|
|
537
|
-
suggestRemove: () =>
|
|
534
|
+
suggestSort: (t) => vt(e, t),
|
|
535
|
+
suggestSwap: () => wt(e),
|
|
536
|
+
suggestCopy: (t) => xt(e, t),
|
|
537
|
+
suggestRemove: () => At(e)
|
|
538
538
|
};
|
|
539
539
|
}
|
|
540
|
-
const
|
|
541
|
-
|
|
540
|
+
const P = (e) => e.keys().next().value, Lt = (e) => e.target.closest(
|
|
541
|
+
F.DRAGGABLE
|
|
542
542
|
);
|
|
543
|
-
function
|
|
543
|
+
function Ct(e) {
|
|
544
544
|
const t = e.entities.initiatingDraggable;
|
|
545
545
|
if (!t) return [];
|
|
546
546
|
const n = (e.entities.draggingMap.get(t) ?? e.entities.draggableMap.get(t))?.payload;
|
|
547
547
|
if (!n) return [];
|
|
548
548
|
const o = n();
|
|
549
549
|
if (!Array.isArray(o) || o.length < 2) return [];
|
|
550
|
-
const [
|
|
551
|
-
return
|
|
550
|
+
const [a, r, i] = o, g = Number(a), l = r, u = /* @__PURE__ */ new Map();
|
|
551
|
+
return u.set(g, {
|
|
552
552
|
index: g,
|
|
553
|
-
item:
|
|
554
|
-
items:
|
|
555
|
-
dropData:
|
|
556
|
-
}), e.entities.draggingMap.forEach((
|
|
553
|
+
item: l[g],
|
|
554
|
+
items: l,
|
|
555
|
+
dropData: i
|
|
556
|
+
}), e.entities.draggingMap.forEach((c, f) => {
|
|
557
557
|
const m = e.entities.draggableMap.get(f)?.payload;
|
|
558
558
|
if (!m) return;
|
|
559
559
|
const h = m();
|
|
560
560
|
if (!Array.isArray(h) || h.length < 2) return;
|
|
561
|
-
const [
|
|
562
|
-
if (
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
index:
|
|
566
|
-
item:
|
|
567
|
-
items:
|
|
568
|
-
dropData:
|
|
561
|
+
const [p, y, M] = h;
|
|
562
|
+
if (y !== l) return;
|
|
563
|
+
const S = Number(p);
|
|
564
|
+
u.has(S) || u.set(S, {
|
|
565
|
+
index: S,
|
|
566
|
+
item: y[S],
|
|
567
|
+
items: l,
|
|
568
|
+
dropData: M
|
|
569
569
|
});
|
|
570
|
-
}), [...
|
|
570
|
+
}), [...u.values()].sort((c, f) => c.index - f.index);
|
|
571
571
|
}
|
|
572
|
-
const
|
|
573
|
-
const s =
|
|
572
|
+
const E = (e, t) => {
|
|
573
|
+
const s = Ct(e);
|
|
574
574
|
let n, o;
|
|
575
575
|
if (t) {
|
|
576
576
|
const r = e.entities.droppableMap.get(t)?.payload;
|
|
577
577
|
if (r) {
|
|
578
|
-
const
|
|
579
|
-
Array.isArray(
|
|
580
|
-
items: Array.isArray(
|
|
581
|
-
userData:
|
|
578
|
+
const l = r();
|
|
579
|
+
Array.isArray(l) && l.length >= 1 && (n = {
|
|
580
|
+
items: Array.isArray(l[0]) ? l[0] : [],
|
|
581
|
+
userData: l[1],
|
|
582
582
|
placement: e.hovered.droppable.get(t)
|
|
583
583
|
});
|
|
584
584
|
}
|
|
585
|
-
const
|
|
586
|
-
if (
|
|
587
|
-
const
|
|
588
|
-
if (
|
|
589
|
-
const f =
|
|
585
|
+
const i = P(e.hovered.draggable);
|
|
586
|
+
if (i && (i === t || t.contains(i)) && i) {
|
|
587
|
+
const u = e.entities.draggableMap.get(i)?.payload, c = e.hovered.draggable.get(i);
|
|
588
|
+
if (u) {
|
|
589
|
+
const f = u();
|
|
590
590
|
if (Array.isArray(f) && f.length >= 2) {
|
|
591
|
-
const [d, m, h] = f,
|
|
591
|
+
const [d, m, h] = f, p = Number(d);
|
|
592
592
|
o = {
|
|
593
|
-
element:
|
|
594
|
-
placement:
|
|
593
|
+
element: i,
|
|
594
|
+
placement: c ?? {
|
|
595
595
|
top: !1,
|
|
596
596
|
right: !1,
|
|
597
597
|
bottom: !1,
|
|
598
598
|
left: !1,
|
|
599
599
|
center: !1
|
|
600
600
|
},
|
|
601
|
-
index:
|
|
602
|
-
item: m[
|
|
601
|
+
index: p,
|
|
602
|
+
item: m[p],
|
|
603
603
|
items: m,
|
|
604
604
|
dropData: h
|
|
605
605
|
};
|
|
@@ -612,31 +612,31 @@ const R = (e, t) => {
|
|
|
612
612
|
dropZone: n,
|
|
613
613
|
hoveredDraggable: o,
|
|
614
614
|
provider: e,
|
|
615
|
-
helpers:
|
|
615
|
+
helpers: Et({ draggedItems: s, dropZone: n, hoveredDraggable: o })
|
|
616
616
|
};
|
|
617
|
-
},
|
|
617
|
+
}, B = (e, t, s) => {
|
|
618
618
|
if (!t) return;
|
|
619
619
|
const n = e.entities.draggingMap.get(t) ?? e.entities.draggableMap.get(t);
|
|
620
|
-
!n || n.disabled || n.events?.[s]?.(
|
|
621
|
-
},
|
|
622
|
-
const s =
|
|
620
|
+
!n || n.disabled || n.events?.[s]?.(E(e));
|
|
621
|
+
}, A = (e, t) => {
|
|
622
|
+
const s = E(e);
|
|
623
623
|
e.entities.draggingMap.forEach((n) => {
|
|
624
624
|
n.disabled || n.events?.[t]?.(s);
|
|
625
625
|
});
|
|
626
|
-
},
|
|
626
|
+
}, It = (e, t, s) => {
|
|
627
627
|
if (t !== s) {
|
|
628
|
-
if (t && !
|
|
629
|
-
const n =
|
|
628
|
+
if (t && !_(t, e)) {
|
|
629
|
+
const n = E(e, t);
|
|
630
630
|
e.entities.droppableMap.get(t)?.events?.onLeave?.(n);
|
|
631
631
|
}
|
|
632
|
-
if (s && !
|
|
633
|
-
const n =
|
|
632
|
+
if (s && !_(s, e)) {
|
|
633
|
+
const n = E(e, s);
|
|
634
634
|
e.entities.droppableMap.get(s)?.events?.onEnter?.(n);
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
|
-
},
|
|
637
|
+
}, Rt = (e, t, s) => {
|
|
638
638
|
if (t !== s) {
|
|
639
|
-
const n =
|
|
639
|
+
const n = E(e);
|
|
640
640
|
if (t) {
|
|
641
641
|
const o = e.entities.draggableMap.get(t);
|
|
642
642
|
o && !o.disabled && o.events?.onLeave?.(n);
|
|
@@ -646,61 +646,61 @@ const R = (e, t) => {
|
|
|
646
646
|
o && !o.disabled && o.events?.onHover?.(n);
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
},
|
|
650
|
-
const n =
|
|
651
|
-
!n || !e.entities.draggingMap.has(n) || e.entities.draggingMap.get(n)?.events?.[s]?.(
|
|
652
|
-
},
|
|
653
|
-
const s =
|
|
654
|
-
s && !
|
|
655
|
-
},
|
|
656
|
-
const s =
|
|
657
|
-
s && !
|
|
649
|
+
}, ce = (e, t, s) => {
|
|
650
|
+
const n = Lt(t);
|
|
651
|
+
!n || !e.entities.draggingMap.has(n) || e.entities.draggingMap.get(n)?.events?.[s]?.(E(e));
|
|
652
|
+
}, kt = (e, t) => {
|
|
653
|
+
const s = P(t.droppable);
|
|
654
|
+
s && !_(s, e) && e.entities.droppableMap.get(s)?.events?.onLeave?.(E(e, s));
|
|
655
|
+
}, Ze = (e, t) => {
|
|
656
|
+
const s = P(t.droppable);
|
|
657
|
+
s && !_(s, e) && e.entities.droppableMap.get(s)?.events?.onLeave?.(E(e, s));
|
|
658
658
|
};
|
|
659
|
-
function
|
|
660
|
-
return e.parentElement?.closest(
|
|
659
|
+
function Pt(e) {
|
|
660
|
+
return e.parentElement?.closest(F.SELECT_AREA) ?? null;
|
|
661
661
|
}
|
|
662
|
-
const
|
|
662
|
+
const Tt = (e, t, s) => {
|
|
663
663
|
if (!s) return {};
|
|
664
|
-
const n = s.getBoundingClientRect(), o = Math.max(n.left, Math.min(e.x, t.x)),
|
|
664
|
+
const n = s.getBoundingClientRect(), o = Math.max(n.left, Math.min(e.x, t.x)), a = Math.max(n.top, Math.min(e.y, t.y)), r = Math.min(n.right, Math.max(e.x, t.x)), i = Math.min(n.bottom, Math.max(e.y, t.y)), g = Math.max(0, r - o), l = Math.max(0, i - a);
|
|
665
665
|
return {
|
|
666
666
|
left: `${o}px`,
|
|
667
|
-
top: `${
|
|
667
|
+
top: `${a}px`,
|
|
668
668
|
width: `${g}px`,
|
|
669
|
-
height: `${
|
|
669
|
+
height: `${l}px`,
|
|
670
670
|
position: "fixed",
|
|
671
671
|
pointerEvents: "none",
|
|
672
672
|
border: "1px solid #3b82f6",
|
|
673
673
|
backgroundColor: "#3b82f61a"
|
|
674
674
|
};
|
|
675
|
-
},
|
|
675
|
+
}, zt = (e) => {
|
|
676
676
|
if (!e.pointer.value || !e.entities.selectingArea) return;
|
|
677
|
-
const { selectingArea: t } = e.entities, s =
|
|
677
|
+
const { selectingArea: t } = e.entities, s = Ot(
|
|
678
678
|
e.pointer.value.start,
|
|
679
679
|
e.pointer.value.current
|
|
680
680
|
), n = e.entities.selectableAreaMap.get(t)?.groups ?? [], o = e.lib.rectCache;
|
|
681
|
-
e.entities.visibleDraggableSet.forEach((
|
|
682
|
-
if (
|
|
683
|
-
const r =
|
|
681
|
+
e.entities.visibleDraggableSet.forEach((a) => {
|
|
682
|
+
if (a === t || !t.contains(a)) return;
|
|
683
|
+
const r = Pt(a);
|
|
684
684
|
if (r && r !== t) {
|
|
685
|
-
e.entities.selectedSet.delete(
|
|
685
|
+
e.entities.selectedSet.delete(a);
|
|
686
686
|
return;
|
|
687
687
|
}
|
|
688
|
-
if (
|
|
689
|
-
e.entities.selectedSet.delete(
|
|
688
|
+
if (Me(a, e)) {
|
|
689
|
+
e.entities.selectedSet.delete(a);
|
|
690
690
|
return;
|
|
691
691
|
}
|
|
692
|
-
const g = e.entities.draggableMap.get(
|
|
693
|
-
if (!
|
|
694
|
-
e.entities.selectedSet.delete(
|
|
692
|
+
const g = e.entities.draggableMap.get(a)?.groups ?? [];
|
|
693
|
+
if (!ve(n, g)) {
|
|
694
|
+
e.entities.selectedSet.delete(a);
|
|
695
695
|
return;
|
|
696
696
|
}
|
|
697
|
-
let
|
|
698
|
-
|
|
697
|
+
let l = o.get(a);
|
|
698
|
+
l || (l = a.getBoundingClientRect(), o.set(a, l)), it(s, l) ? e.entities.selectedSet.add(a) : e.entities.selectedSet.delete(a);
|
|
699
699
|
});
|
|
700
|
-
},
|
|
701
|
-
const s = Math.min(e.x, t.x), n = Math.min(e.y, t.y), o = Math.max(e.x, t.x),
|
|
702
|
-
return new DOMRect(s, n, r,
|
|
703
|
-
},
|
|
700
|
+
}, Ot = (e, t) => {
|
|
701
|
+
const s = Math.min(e.x, t.x), n = Math.min(e.y, t.y), o = Math.max(e.x, t.x), a = Math.max(e.y, t.y), r = o - s, i = a - n;
|
|
702
|
+
return new DOMRect(s, n, r, i);
|
|
703
|
+
}, Bt = (e, t, s = 5) => {
|
|
704
704
|
const n = s / 2;
|
|
705
705
|
return {
|
|
706
706
|
left: e - n,
|
|
@@ -708,14 +708,14 @@ const Ut = (e, t, s) => {
|
|
|
708
708
|
width: s,
|
|
709
709
|
height: s
|
|
710
710
|
};
|
|
711
|
-
},
|
|
711
|
+
}, Ft = (e) => {
|
|
712
712
|
const t = e.pointer.value?.current, s = t?.x ?? 0, n = t?.y ?? 0;
|
|
713
|
-
return
|
|
714
|
-
},
|
|
713
|
+
return Bt(s, n, 5);
|
|
714
|
+
}, O = (e, t, s) => {
|
|
715
715
|
const n = e.left + e.width / 2, o = e.top + e.height / 2;
|
|
716
716
|
if (s) {
|
|
717
|
-
const
|
|
718
|
-
if (
|
|
717
|
+
const i = s.top ?? 0, g = s.right ?? 0, l = s.bottom ?? 0, u = s.left ?? 0, c = t.left + u, f = t.right - g, d = t.top + i, m = t.bottom - l;
|
|
718
|
+
if (c < f && d < m && n >= c && n <= f && o >= d && o <= m)
|
|
719
719
|
return {
|
|
720
720
|
top: !1,
|
|
721
721
|
right: !1,
|
|
@@ -724,96 +724,96 @@ const Ut = (e, t, s) => {
|
|
|
724
724
|
center: !0
|
|
725
725
|
};
|
|
726
726
|
}
|
|
727
|
-
const
|
|
727
|
+
const a = t.left + t.width / 2, r = t.top + t.height / 2;
|
|
728
728
|
return {
|
|
729
729
|
top: o <= r,
|
|
730
730
|
bottom: o > r,
|
|
731
|
-
left: n <=
|
|
732
|
-
right: n >
|
|
731
|
+
left: n <= a,
|
|
732
|
+
right: n > a,
|
|
733
733
|
center: !1
|
|
734
734
|
};
|
|
735
|
-
},
|
|
735
|
+
}, _t = (e) => ({
|
|
736
736
|
x: e.left + e.width / 2,
|
|
737
737
|
y: e.top + e.height / 2
|
|
738
|
-
}),
|
|
739
|
-
const s =
|
|
738
|
+
}), Le = (e, t) => {
|
|
739
|
+
const s = _t(t);
|
|
740
740
|
return Math.hypot(e.x - s.x, e.y - s.y);
|
|
741
741
|
};
|
|
742
|
-
function
|
|
742
|
+
function Gt(e, t) {
|
|
743
743
|
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;
|
|
744
744
|
}
|
|
745
|
-
function
|
|
746
|
-
|
|
745
|
+
function $(e, t) {
|
|
746
|
+
Gt(e.hoveredPlacement, t) || (e.hoveredPlacement = t);
|
|
747
747
|
}
|
|
748
|
-
const
|
|
749
|
-
const n =
|
|
748
|
+
const Ht = (e, t) => e.find((s) => s !== t && H(t, s)), ne = (e, t, s) => {
|
|
749
|
+
const n = P(t.droppable), o = P(t.draggable);
|
|
750
750
|
o && t.draggable.delete(o), n && t.droppable.delete(n);
|
|
751
|
-
const
|
|
752
|
-
if (r &&
|
|
753
|
-
const
|
|
751
|
+
const a = Ft(e), r = s.zones[0], i = s.elements[0];
|
|
752
|
+
if (r && i && r === i && e.entities.droppableMap.has(r) && r) {
|
|
753
|
+
const c = r.getBoundingClientRect(), f = e.entities.draggableMap.get(r)?.placementMargins, d = O(a, c, f);
|
|
754
754
|
if (d.center) {
|
|
755
755
|
t.droppable.set(r, d);
|
|
756
|
-
const m =
|
|
756
|
+
const m = Ht(s.elements, r);
|
|
757
757
|
if (m) {
|
|
758
758
|
const h = m.getBoundingClientRect();
|
|
759
759
|
t.draggable.set(
|
|
760
760
|
m,
|
|
761
|
-
|
|
761
|
+
O(a, h, void 0)
|
|
762
762
|
);
|
|
763
763
|
}
|
|
764
764
|
} else
|
|
765
|
-
t.draggable.set(
|
|
765
|
+
t.draggable.set(i, d);
|
|
766
766
|
} else {
|
|
767
767
|
if (r) {
|
|
768
|
-
const
|
|
769
|
-
t.droppable.set(r,
|
|
768
|
+
const c = r.getBoundingClientRect();
|
|
769
|
+
t.droppable.set(r, O(a, c));
|
|
770
770
|
}
|
|
771
|
-
if (
|
|
771
|
+
if (i)
|
|
772
772
|
if (r)
|
|
773
|
-
if (
|
|
774
|
-
const
|
|
773
|
+
if (H(r, i)) {
|
|
774
|
+
const c = i.getBoundingClientRect(), f = e.entities.draggableMap.get(i)?.placementMargins;
|
|
775
775
|
t.draggable.set(
|
|
776
|
-
|
|
777
|
-
|
|
776
|
+
i,
|
|
777
|
+
O(a, c, f)
|
|
778
778
|
);
|
|
779
779
|
} else {
|
|
780
|
-
const
|
|
781
|
-
if (
|
|
780
|
+
const c = e.pointer.value?.current ?? { x: 0, y: 0 }, f = r.getBoundingClientRect(), d = i.getBoundingClientRect(), m = Le(c, f);
|
|
781
|
+
if (Le(c, d) < m) {
|
|
782
782
|
t.droppable.clear();
|
|
783
|
-
const
|
|
783
|
+
const p = e.entities.draggableMap.get(i)?.placementMargins;
|
|
784
784
|
t.draggable.set(
|
|
785
|
-
|
|
786
|
-
|
|
785
|
+
i,
|
|
786
|
+
O(a, d, p)
|
|
787
787
|
);
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
790
|
else {
|
|
791
|
-
const
|
|
791
|
+
const c = i.getBoundingClientRect(), f = e.entities.draggableMap.get(i)?.placementMargins;
|
|
792
792
|
t.draggable.set(
|
|
793
|
-
|
|
794
|
-
|
|
793
|
+
i,
|
|
794
|
+
O(a, c, f)
|
|
795
795
|
);
|
|
796
796
|
}
|
|
797
797
|
}
|
|
798
|
-
const
|
|
799
|
-
if (o && o !==
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
}
|
|
803
|
-
if (n && n !== u) {
|
|
804
|
-
const l = e.entities.droppableMap.get(n);
|
|
805
|
-
l && ee(l, void 0);
|
|
798
|
+
const l = P(t.droppable), u = P(t.draggable);
|
|
799
|
+
if (o && o !== u) {
|
|
800
|
+
const c = e.entities.draggableMap.get(o);
|
|
801
|
+
c && $(c, void 0);
|
|
806
802
|
}
|
|
807
|
-
if (
|
|
808
|
-
const
|
|
809
|
-
|
|
803
|
+
if (n && n !== l) {
|
|
804
|
+
const c = e.entities.droppableMap.get(n);
|
|
805
|
+
c && $(c, void 0);
|
|
810
806
|
}
|
|
811
807
|
if (u) {
|
|
812
|
-
const
|
|
813
|
-
|
|
808
|
+
const c = e.entities.draggableMap.get(u);
|
|
809
|
+
c && $(c, t.draggable.get(u));
|
|
814
810
|
}
|
|
815
|
-
|
|
816
|
-
|
|
811
|
+
if (l) {
|
|
812
|
+
const c = e.entities.droppableMap.get(l);
|
|
813
|
+
c && $(c, t.droppable.get(l));
|
|
814
|
+
}
|
|
815
|
+
It(e, n, l), Rt(e, o, u);
|
|
816
|
+
}, 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, se = (e) => {
|
|
817
817
|
if (!e)
|
|
818
818
|
return { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 };
|
|
819
819
|
const t = e.getBoundingClientRect();
|
|
@@ -827,332 +827,168 @@ const qt = (e, t) => e.find((s) => s !== t && _(t, s)), W = (e, t, s) => {
|
|
|
827
827
|
right: t.right,
|
|
828
828
|
bottom: t.bottom
|
|
829
829
|
};
|
|
830
|
-
},
|
|
830
|
+
}, Z = (e) => ({
|
|
831
831
|
x: e.x + e.width / 2,
|
|
832
832
|
y: e.y + e.height / 2
|
|
833
|
-
}),
|
|
833
|
+
}), Kt = (e, t) => Math.hypot(t.x - e.x, t.y - e.y), be = (e, t) => {
|
|
834
834
|
const s = Math.max(
|
|
835
835
|
0,
|
|
836
836
|
Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)
|
|
837
837
|
), n = Math.max(
|
|
838
838
|
0,
|
|
839
839
|
Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
|
|
840
|
-
), o = s * n,
|
|
841
|
-
return
|
|
842
|
-
},
|
|
840
|
+
), o = s * n, a = e.width * e.height, r = t.width * t.height;
|
|
841
|
+
return a === 0 || r === 0 ? 0 : (o / a * 100 + o / r * 100) / 2;
|
|
842
|
+
}, Nt = (e, t, s) => t >= e.x && t <= e.x + e.width && s >= e.y && s <= e.y + e.height, Zt = (e) => e.overlay.ref?.value ?? null, Yt = (e) => {
|
|
843
843
|
const t = e.overlay.position?.value ?? { x: 0, y: 0 }, { x: s, y: n } = t, o = e.overlay.size?.value;
|
|
844
|
-
let
|
|
844
|
+
let a, r;
|
|
845
845
|
if (o)
|
|
846
|
-
|
|
846
|
+
a = o.width, r = o.height;
|
|
847
847
|
else {
|
|
848
|
-
const
|
|
849
|
-
|
|
848
|
+
const i = e.overlay.ref?.value?.getBoundingClientRect();
|
|
849
|
+
a = i?.width ?? 0, r = i?.height ?? 0;
|
|
850
850
|
}
|
|
851
851
|
return {
|
|
852
852
|
x: s,
|
|
853
853
|
y: n,
|
|
854
|
-
width:
|
|
854
|
+
width: a,
|
|
855
855
|
height: r,
|
|
856
856
|
top: n,
|
|
857
857
|
left: s,
|
|
858
|
-
right: s +
|
|
858
|
+
right: s + a,
|
|
859
859
|
bottom: n + r
|
|
860
860
|
};
|
|
861
|
-
},
|
|
862
|
-
(s) =>
|
|
863
|
-
),
|
|
864
|
-
function
|
|
861
|
+
}, Ye = (e) => e.entities.allowedDraggableSet, Xe = (e) => e.entities.allowedDroppableSet, Xt = (e, t) => !t.entities.draggingMap.has(e), Ut = (e, t) => ![...t.entities.draggingMap.keys()].some(
|
|
862
|
+
(s) => H(s, e)
|
|
863
|
+
), Vt = (e, t) => t.entities.draggableMap.has(e) ? !Me(e, t) : t.entities.droppableMap.has(e) ? !_(e, t) : !0, ye = (e, t) => Xt(e, t) && Ut(e, t) && Vt(e, t), Ie = 10;
|
|
864
|
+
function q(e, t) {
|
|
865
865
|
return Math.hypot(
|
|
866
866
|
t.x - (e.x + e.width / 2),
|
|
867
867
|
t.y - (e.y + e.height / 2)
|
|
868
868
|
);
|
|
869
869
|
}
|
|
870
|
-
function
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
}
|
|
876
|
-
const ve = (e) => {
|
|
877
|
-
if (!Qt(e)) return { elements: [], zones: [] };
|
|
878
|
-
const s = Qe(e), n = e.pointer.value?.current ?? { x: 0, y: 0 }, o = [...en(e)].filter(
|
|
879
|
-
(c) => ce(c, e)
|
|
880
|
-
), i = [...tn(e)].filter(
|
|
881
|
-
(c) => ce(c, e)
|
|
882
|
-
), r = o.filter(
|
|
883
|
-
(c) => we(Z(c), n.x, n.y)
|
|
884
|
-
), a = i.filter(
|
|
885
|
-
(c) => we(Z(c), n.x, n.y)
|
|
886
|
-
);
|
|
887
|
-
if (r.length > 0 || a.length > 0)
|
|
888
|
-
return {
|
|
889
|
-
elements: Oe(r),
|
|
890
|
-
zones: Oe(a)
|
|
891
|
-
};
|
|
892
|
-
const g = o.map((c) => ({ n: c, box: Z(c) })).filter(
|
|
893
|
-
({ box: c }) => ze(c, s) && Me(c, s) >= Be
|
|
894
|
-
).sort((c, l) => te(c.box, n) - te(l.box, n)).map(({ n: c }) => c), u = i.map((c) => ({ n: c, box: Z(c) })).filter(
|
|
895
|
-
({ box: c }) => ze(c, s) && Me(c, s) >= Be
|
|
896
|
-
).sort((c, l) => te(c.box, n) - te(l.box, n)).map(({ n: c }) => c);
|
|
897
|
-
return { elements: g, zones: u };
|
|
898
|
-
};
|
|
899
|
-
function rn(e) {
|
|
900
|
-
globalThis.onmessage = (t) => {
|
|
901
|
-
const { callId: s, data: n } = t.data;
|
|
902
|
-
try {
|
|
903
|
-
const o = e(n);
|
|
904
|
-
globalThis.postMessage({ callId: s, ok: !0, result: o });
|
|
905
|
-
} catch (o) {
|
|
906
|
-
globalThis.postMessage({ callId: s, ok: !1, error: String(o) });
|
|
907
|
-
}
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
function an(e, t) {
|
|
911
|
-
return [
|
|
912
|
-
t.map((n) => n.toString()).join(`
|
|
913
|
-
|
|
914
|
-
`),
|
|
915
|
-
`var __fn = ${e.toString()};`,
|
|
916
|
-
`(${rn.toString()})(__fn);`
|
|
917
|
-
].join(`
|
|
918
|
-
|
|
919
|
-
`);
|
|
920
|
-
}
|
|
921
|
-
function ln(e, t) {
|
|
922
|
-
let s = null, n = null, o = !1, i = 0;
|
|
923
|
-
const r = /* @__PURE__ */ new Map();
|
|
924
|
-
try {
|
|
925
|
-
const u = an(e, t?.localDependencies ?? []), c = new Blob([u], { type: "application/javascript" });
|
|
926
|
-
n = URL.createObjectURL(c), s = new Worker(n), o = !0, s.onmessage = (l) => {
|
|
927
|
-
const f = r.get(l.data.callId);
|
|
928
|
-
f && (r.delete(l.data.callId), l.data.ok ? f.resolve(l.data.result) : f.reject(new Error(l.data.error)));
|
|
929
|
-
}, s.onerror = (l) => {
|
|
930
|
-
o = !1;
|
|
931
|
-
for (const f of r.values()) f.reject(new Error(l.message));
|
|
932
|
-
r.clear(), s?.terminate(), s = null;
|
|
933
|
-
};
|
|
934
|
-
} catch {
|
|
935
|
-
o = !1;
|
|
936
|
-
}
|
|
937
|
-
return {
|
|
938
|
-
run: (u) => {
|
|
939
|
-
if (!s || !o)
|
|
940
|
-
try {
|
|
941
|
-
return Promise.resolve(e(u));
|
|
942
|
-
} catch (l) {
|
|
943
|
-
return Promise.reject(l instanceof Error ? l : new Error(String(l)));
|
|
944
|
-
}
|
|
945
|
-
const c = ++i;
|
|
946
|
-
return new Promise((l, f) => {
|
|
947
|
-
r.set(c, { resolve: l, reject: f }), s.postMessage({ callId: c, data: u });
|
|
948
|
-
});
|
|
949
|
-
},
|
|
950
|
-
terminate: () => {
|
|
951
|
-
for (const u of r.values()) u.reject(new Error("Worker terminated"));
|
|
952
|
-
r.clear(), s?.terminate(), s = null, n && (URL.revokeObjectURL(n), n = null), o = !1;
|
|
953
|
-
},
|
|
954
|
-
get isSupported() {
|
|
955
|
-
return o;
|
|
956
|
-
}
|
|
957
|
-
};
|
|
958
|
-
}
|
|
959
|
-
function et(e, t, s, n, o, i, r, a) {
|
|
960
|
-
return e < o + r && e + s > o && t < i + a && t + n > i;
|
|
961
|
-
}
|
|
962
|
-
function tt(e, t, s, n, o, i, r, a) {
|
|
963
|
-
const g = Math.max(0, Math.min(e + s, o + r) - Math.max(e, o)), u = Math.max(0, Math.min(t + n, i + a) - Math.max(t, i)), c = g * u, l = s * n, f = r * a;
|
|
964
|
-
return !l || !f ? 0 : (c / l * 100 + c / f * 100) / 2;
|
|
965
|
-
}
|
|
966
|
-
function oe(e, t, s, n, o, i) {
|
|
967
|
-
return o >= e && o <= e + s && i >= t && i <= t + n;
|
|
968
|
-
}
|
|
969
|
-
function cn(e) {
|
|
970
|
-
const { containerBox: t, pointer: s, elements: n, elementCount: o, zones: i, zoneCount: r, config: a } = e, { x: g, y: u, width: c, height: l } = t, { x: f, y: d } = s, m = a.minOverlapPercent, h = g + c / 2, w = u + l / 2, D = oe(g, u, c, l, f, d);
|
|
971
|
-
function v(x, K) {
|
|
972
|
-
const S = [], b = x;
|
|
973
|
-
for (let y = 0; y < K; y++) {
|
|
974
|
-
const p = y * 4, C = b[p], I = b[p + 1], L = b[p + 2], k = b[p + 3];
|
|
975
|
-
if (!et(C, I, L, k, g, u, c, l)) continue;
|
|
976
|
-
const Le = tt(C, I, L, k, g, u, c, l);
|
|
977
|
-
Le < m || S.push({
|
|
978
|
-
index: y,
|
|
979
|
-
overlapPercent: Le,
|
|
980
|
-
centerDistance: Math.hypot(h - (C + L / 2), w - (I + k / 2)),
|
|
981
|
-
isPointerInElement: oe(C, I, L, k, f, d),
|
|
982
|
-
depth: 0
|
|
983
|
-
});
|
|
984
|
-
}
|
|
985
|
-
for (let y = 0; y < S.length; y++) {
|
|
986
|
-
const p = S[y].index * 4, C = b[p] + b[p + 2] / 2, I = b[p + 1] + b[p + 3] / 2;
|
|
987
|
-
for (let L = 0; L < S.length; L++) {
|
|
988
|
-
if (y === L) continue;
|
|
989
|
-
const k = S[L].index * 4;
|
|
990
|
-
oe(b[k], b[k + 1], b[k + 2], b[k + 3], C, I) && S[y].depth++;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
return S.sort((y, p) => {
|
|
994
|
-
if (D) {
|
|
995
|
-
if (y.isPointerInElement && p.isPointerInElement) return p.depth - y.depth;
|
|
996
|
-
if (y.isPointerInElement !== p.isPointerInElement) return y.isPointerInElement ? -1 : 1;
|
|
997
|
-
}
|
|
998
|
-
return Math.abs(y.overlapPercent - p.overlapPercent) <= 1 ? y.centerDistance - p.centerDistance : p.overlapPercent - y.overlapPercent;
|
|
999
|
-
}), S.map((y) => y.index);
|
|
1000
|
-
}
|
|
1001
|
-
return {
|
|
1002
|
-
elementIndices: v(n, o),
|
|
1003
|
-
zoneIndices: v(i, r)
|
|
1004
|
-
};
|
|
1005
|
-
}
|
|
1006
|
-
let me = null;
|
|
1007
|
-
function nt() {
|
|
1008
|
-
return me || (me = ln(cn, {
|
|
1009
|
-
localDependencies: [et, tt, oe]
|
|
1010
|
-
})), me;
|
|
1011
|
-
}
|
|
1012
|
-
function _e(e, t) {
|
|
1013
|
-
const s = [];
|
|
1014
|
-
for (const n of e) {
|
|
1015
|
-
let o = t.get(n);
|
|
1016
|
-
o || (o = n.getBoundingClientRect(), t.set(n, o)), s.push(o.x, o.y, o.width, o.height);
|
|
870
|
+
function $t(e) {
|
|
871
|
+
const t = e.pointer.value?.current ?? { x: 0, y: 0 }, s = document.elementsFromPoint(t.x, t.y), n = Ye(e), o = Xe(e), a = [], r = [];
|
|
872
|
+
for (const i of s) {
|
|
873
|
+
const g = n.has(i), l = o.has(i);
|
|
874
|
+
!g && !l || ye(i, e) && (g && a.push(i), l && r.push(i));
|
|
1017
875
|
}
|
|
1018
|
-
return
|
|
876
|
+
return a.length === 0 && r.length === 0 ? null : { elements: a, zones: r };
|
|
1019
877
|
}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
const
|
|
1023
|
-
|
|
1024
|
-
), o = [...e
|
|
1025
|
-
(
|
|
1026
|
-
),
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
zones: _e(o, a),
|
|
1037
|
-
zoneCount: o.length,
|
|
1038
|
-
config: { minOverlapPercent: 10 }
|
|
1039
|
-
};
|
|
1040
|
-
t.run(g).then((u) => {
|
|
1041
|
-
if (s !== Fe || e.state.value !== "dragging") return;
|
|
1042
|
-
const c = u.elementIndices.map(
|
|
1043
|
-
(f) => n[f]
|
|
1044
|
-
), l = u.zoneIndices.map(
|
|
1045
|
-
(f) => o[f]
|
|
1046
|
-
);
|
|
1047
|
-
W(e, e.hovered, {
|
|
1048
|
-
elements: c,
|
|
1049
|
-
zones: l
|
|
1050
|
-
});
|
|
1051
|
-
});
|
|
1052
|
-
}
|
|
1053
|
-
function xe(e) {
|
|
878
|
+
const pe = (e) => {
|
|
879
|
+
if (!Zt(e)) return { elements: [], zones: [] };
|
|
880
|
+
const s = $t(e);
|
|
881
|
+
if (s) return s;
|
|
882
|
+
const n = Yt(e), o = e.pointer.value?.current ?? { x: 0, y: 0 }, a = [...Ye(e)].filter(
|
|
883
|
+
(l) => ye(l, e)
|
|
884
|
+
), r = [...Xe(e)].filter(
|
|
885
|
+
(l) => ye(l, e)
|
|
886
|
+
), i = a.map((l) => ({ n: l, box: se(l) })).filter(
|
|
887
|
+
({ box: l }) => Ce(l, n) && be(l, n) >= Ie
|
|
888
|
+
).sort((l, u) => q(l.box, o) - q(u.box, o)).map(({ n: l }) => l), g = r.map((l) => ({ n: l, box: se(l) })).filter(
|
|
889
|
+
({ box: l }) => Ce(l, n) && be(l, n) >= Ie
|
|
890
|
+
).sort((l, u) => q(l.box, o) - q(u.box, o)).map(({ n: l }) => l);
|
|
891
|
+
return { elements: i, zones: g };
|
|
892
|
+
};
|
|
893
|
+
function Se(e) {
|
|
1054
894
|
if (e.collision?.run) {
|
|
1055
895
|
const s = e.collision.run(e);
|
|
1056
|
-
|
|
896
|
+
ne(e, e.hovered, s);
|
|
1057
897
|
return;
|
|
1058
898
|
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
else {
|
|
1062
|
-
const s = ve(e);
|
|
1063
|
-
W(e, e.hovered, s);
|
|
1064
|
-
}
|
|
899
|
+
const t = pe(e);
|
|
900
|
+
ne(e, e.hovered, t);
|
|
1065
901
|
}
|
|
1066
|
-
function
|
|
902
|
+
function qt(e, t) {
|
|
1067
903
|
const s = e.collision?.throttle?.value ?? 0;
|
|
1068
904
|
if (s <= 0) {
|
|
1069
|
-
|
|
905
|
+
Se(e);
|
|
1070
906
|
return;
|
|
1071
907
|
}
|
|
1072
908
|
const n = Date.now();
|
|
1073
|
-
n - t.value >= s && (t.value = n,
|
|
909
|
+
n - t.value >= s && (t.value = n, Se(e));
|
|
1074
910
|
}
|
|
1075
|
-
async function
|
|
911
|
+
async function Ue(e) {
|
|
1076
912
|
const t = e.hovered.droppable.keys().next().value;
|
|
1077
|
-
if (!t ||
|
|
1078
|
-
const s = e.entities.droppableMap.get(t), n =
|
|
913
|
+
if (!t || _(t, e)) return "accept";
|
|
914
|
+
const s = e.entities.droppableMap.get(t), n = E(e, t), o = s?.events?.onDrop?.(n);
|
|
1079
915
|
if (o != null && typeof o.then == "function") {
|
|
1080
916
|
e.state.value = "pending";
|
|
1081
917
|
let r;
|
|
1082
918
|
try {
|
|
1083
919
|
r = await o;
|
|
1084
920
|
} catch {
|
|
1085
|
-
const
|
|
1086
|
-
return
|
|
921
|
+
const i = e.entities.initiatingDraggable;
|
|
922
|
+
return B(e, i, "onSelfDragCancel"), A(e, "onDragCancel"), Ze(e, e.hovered), "cancel";
|
|
1087
923
|
}
|
|
1088
924
|
return r === !1 ? (e.state.value = "dragging", "decline") : "accept";
|
|
1089
925
|
}
|
|
1090
926
|
return o === !1 ? "decline" : "accept";
|
|
1091
927
|
}
|
|
1092
|
-
function
|
|
928
|
+
function Ve(e) {
|
|
1093
929
|
const t = e.entities.initiatingDraggable;
|
|
1094
|
-
|
|
930
|
+
B(e, t, "onSelfDragEnd"), A(e, "onDragEnd"), kt(e, e.hovered);
|
|
1095
931
|
}
|
|
1096
|
-
function
|
|
932
|
+
function Wt(e) {
|
|
1097
933
|
const t = e.entities.selectingArea;
|
|
1098
934
|
if (!t) return;
|
|
1099
935
|
const s = e.entities.selectableAreaMap.get(t), n = [...e.entities.selectedSet];
|
|
1100
936
|
s?.events?.onSelected?.(n);
|
|
1101
937
|
}
|
|
1102
|
-
const
|
|
938
|
+
const jt = (e) => {
|
|
1103
939
|
const t = {
|
|
1104
940
|
current: null
|
|
1105
941
|
}, s = { value: 0 }, n = async () => {
|
|
1106
|
-
|
|
1107
|
-
const
|
|
1108
|
-
if (
|
|
1109
|
-
const g = await
|
|
1110
|
-
if (g === "accept" &&
|
|
1111
|
-
|
|
942
|
+
me(), t.current?.cancel(), t.current = null;
|
|
943
|
+
const i = e.state.value;
|
|
944
|
+
if (i === "dragging") {
|
|
945
|
+
const g = await Ue(e);
|
|
946
|
+
if (g === "accept" && Ve(e), g === "accept" || g === "cancel") {
|
|
947
|
+
te(e), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o);
|
|
1112
948
|
return;
|
|
1113
949
|
}
|
|
1114
950
|
return;
|
|
1115
|
-
} else
|
|
1116
|
-
|
|
1117
|
-
}, o = (
|
|
951
|
+
} else i === "selecting" && Wt(e);
|
|
952
|
+
te(e), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o);
|
|
953
|
+
}, o = (i) => {
|
|
1118
954
|
if (e.pointer.value) {
|
|
1119
|
-
if (e.pointer.value.current = { x:
|
|
1120
|
-
|
|
955
|
+
if (e.pointer.value.current = { x: i.clientX, y: i.clientY }, ht(e)) {
|
|
956
|
+
ce(e, i, "onSelfDragStart"), A(e, "onDragStart");
|
|
1121
957
|
return;
|
|
1122
958
|
}
|
|
1123
959
|
if (e.state.value === "dragging") {
|
|
1124
|
-
|
|
960
|
+
qt(e, s);
|
|
1125
961
|
const g = e.entities.initiatingDraggable;
|
|
1126
|
-
|
|
962
|
+
B(e, g, "onSelfDragMove"), A(e, "onDragMove");
|
|
1127
963
|
}
|
|
1128
|
-
e.state.value === "selecting" &&
|
|
964
|
+
e.state.value === "selecting" && zt(e);
|
|
1129
965
|
}
|
|
1130
966
|
};
|
|
1131
|
-
return { pointerDown: (
|
|
967
|
+
return { pointerDown: (i) => {
|
|
1132
968
|
document.addEventListener("pointerup", n), document.addEventListener("pointermove", o);
|
|
1133
|
-
const g =
|
|
1134
|
-
|
|
1135
|
-
),
|
|
1136
|
-
|
|
969
|
+
const g = i.target, l = g.closest(
|
|
970
|
+
F.SELECT_AREA
|
|
971
|
+
), u = g.closest(
|
|
972
|
+
F.DRAGGABLE
|
|
1137
973
|
);
|
|
1138
|
-
if (e.entities.modifiersSelectableAreaSet.size > 0 && e.entities.modifiersSelectableAreaSet.has(
|
|
1139
|
-
|
|
974
|
+
if (e.entities.modifiersSelectableAreaSet.size > 0 && e.entities.modifiersSelectableAreaSet.has(l)) {
|
|
975
|
+
de(), e.pointer.value = he(i), e.state.value = "selecting", e.entities.selectingArea = l;
|
|
1140
976
|
return;
|
|
1141
977
|
}
|
|
1142
|
-
if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(
|
|
1143
|
-
const
|
|
1144
|
-
if (!
|
|
978
|
+
if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(u)) {
|
|
979
|
+
const c = e.entities.draggableMap.get(u);
|
|
980
|
+
if (!Ge(g, u, c?.dragHandle))
|
|
1145
981
|
return;
|
|
1146
|
-
|
|
1147
|
-
const f =
|
|
1148
|
-
e.pointer.value =
|
|
1149
|
-
|
|
1150
|
-
}))) : (
|
|
982
|
+
de(), e.entities.initiatingDraggable = u;
|
|
983
|
+
const f = Fe(i, u);
|
|
984
|
+
e.pointer.value = he(i, f.x, f.y), c?.activation?.distance || c?.activation?.delay ? (e.state.value = "activating", c?.activation?.delay && (e.delay.startTime = Date.now(), t.current = bt(e, () => {
|
|
985
|
+
ee(e), ce(e, i, "onSelfDragStart"), A(e, "onDragStart");
|
|
986
|
+
}))) : (ee(e), ce(e, i, "onSelfDragStart"), A(e, "onDragStart"));
|
|
1151
987
|
}
|
|
1152
988
|
}, pointerUp: n, pointerMove: o, cleanup: () => {
|
|
1153
989
|
t.current?.cancel(), document.removeEventListener("pointerup", n), document.removeEventListener("pointermove", o), e.lib.draggableObserver.disconnect(), e.lib.droppableObserver.disconnect(), e.lib.selectableAreaObserver.disconnect(), e.lib.overlaySizeObserver.disconnect();
|
|
1154
990
|
} };
|
|
1155
|
-
},
|
|
991
|
+
}, Jt = {
|
|
1156
992
|
ArrowUp: { dx: 0, dy: -1 },
|
|
1157
993
|
ArrowDown: { dx: 0, dy: 1 },
|
|
1158
994
|
ArrowLeft: { dx: -1, dy: 0 },
|
|
@@ -1161,37 +997,37 @@ const dn = (e) => {
|
|
|
1161
997
|
KeyA: { dx: -1, dy: 0 },
|
|
1162
998
|
KeyS: { dx: 0, dy: 1 },
|
|
1163
999
|
KeyD: { dx: 1, dy: 0 }
|
|
1164
|
-
},
|
|
1000
|
+
}, Qt = (e) => (t) => {
|
|
1165
1001
|
const { keys: s } = e.keyboard;
|
|
1166
1002
|
if (s.pressedKeys.value.add(t.code), e.state.value === "dragging") {
|
|
1167
1003
|
if (s.forCancel.includes(t.code)) {
|
|
1168
|
-
t.preventDefault(),
|
|
1004
|
+
t.preventDefault(), me(), B(
|
|
1169
1005
|
e,
|
|
1170
1006
|
e.entities.initiatingDraggable,
|
|
1171
1007
|
"onSelfDragCancel"
|
|
1172
|
-
),
|
|
1008
|
+
), A(e, "onDragCancel"), Ze(e, e.hovered), te(e);
|
|
1173
1009
|
return;
|
|
1174
1010
|
}
|
|
1175
1011
|
if (s.forDrop.includes(t.code)) {
|
|
1176
|
-
t.preventDefault(), (async () => (await
|
|
1012
|
+
t.preventDefault(), (async () => (await Ue(e) && Ve(e), me(), te(e)))();
|
|
1177
1013
|
return;
|
|
1178
1014
|
}
|
|
1179
|
-
const o =
|
|
1015
|
+
const o = Jt[t.code];
|
|
1180
1016
|
if (o && s.forMove.includes(t.code) && e.pointer.value) {
|
|
1181
1017
|
t.preventDefault();
|
|
1182
|
-
const
|
|
1183
|
-
(
|
|
1184
|
-
), r = e.keyboard.step * (
|
|
1018
|
+
const a = s.forMoveFaster.some(
|
|
1019
|
+
(l) => s.pressedKeys.value.has(l)
|
|
1020
|
+
), r = e.keyboard.step * (a ? e.keyboard.moveFaster : 1);
|
|
1185
1021
|
e.pointer.value.current = {
|
|
1186
1022
|
x: e.pointer.value.current.x + o.dx * r,
|
|
1187
1023
|
y: e.pointer.value.current.y + o.dy * r
|
|
1188
1024
|
};
|
|
1189
|
-
const g = (e.collision?.run ??
|
|
1190
|
-
|
|
1025
|
+
const g = (e.collision?.run ?? pe)(e);
|
|
1026
|
+
ne(e, e.hovered, g), B(
|
|
1191
1027
|
e,
|
|
1192
1028
|
e.entities.initiatingDraggable,
|
|
1193
1029
|
"onSelfDragMove"
|
|
1194
|
-
),
|
|
1030
|
+
), A(e, "onDragMove");
|
|
1195
1031
|
return;
|
|
1196
1032
|
}
|
|
1197
1033
|
return;
|
|
@@ -1199,59 +1035,59 @@ const dn = (e) => {
|
|
|
1199
1035
|
if (s.forDrag.includes(t.code)) {
|
|
1200
1036
|
const o = document.activeElement;
|
|
1201
1037
|
if (!o) return;
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1038
|
+
const a = o.closest(
|
|
1039
|
+
F.DRAGGABLE
|
|
1204
1040
|
);
|
|
1205
|
-
if (!
|
|
1041
|
+
if (!a || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(a))
|
|
1206
1042
|
return;
|
|
1207
|
-
const r = e.entities.draggableMap.get(
|
|
1208
|
-
if (!
|
|
1043
|
+
const r = e.entities.draggableMap.get(a);
|
|
1044
|
+
if (!Ge(o, a, r?.dragHandle, !0))
|
|
1209
1045
|
return;
|
|
1210
|
-
t.preventDefault(),
|
|
1211
|
-
const
|
|
1046
|
+
t.preventDefault(), de();
|
|
1047
|
+
const i = a.getBoundingClientRect(), g = i.left + i.width / 2, l = i.top + i.height / 2, u = {
|
|
1212
1048
|
clientX: g,
|
|
1213
|
-
clientY:
|
|
1049
|
+
clientY: l
|
|
1214
1050
|
};
|
|
1215
|
-
e.entities.initiatingDraggable =
|
|
1216
|
-
const
|
|
1217
|
-
e.pointer.value =
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
),
|
|
1222
|
-
const d = (e.collision?.run ??
|
|
1223
|
-
|
|
1051
|
+
e.entities.initiatingDraggable = a;
|
|
1052
|
+
const c = Fe(u, a);
|
|
1053
|
+
e.pointer.value = he(
|
|
1054
|
+
u,
|
|
1055
|
+
c.x,
|
|
1056
|
+
c.y
|
|
1057
|
+
), ee(e);
|
|
1058
|
+
const d = (e.collision?.run ?? pe)(e);
|
|
1059
|
+
ne(e, e.hovered, d), B(e, a, "onSelfDragStart"), A(e, "onDragStart");
|
|
1224
1060
|
}
|
|
1225
|
-
},
|
|
1061
|
+
}, en = (e) => (t) => {
|
|
1226
1062
|
e.keyboard.keys.pressedKeys.value.delete(t.code);
|
|
1227
|
-
},
|
|
1063
|
+
}, tn = (e) => () => {
|
|
1228
1064
|
e.keyboard.keys.pressedKeys.value.clear();
|
|
1229
|
-
},
|
|
1230
|
-
keyDown:
|
|
1231
|
-
keyUp:
|
|
1232
|
-
clear:
|
|
1233
|
-
},
|
|
1234
|
-
e.state.value && (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY, e.lib.rectCache.clear(), e.state.value === "dragging" &&
|
|
1235
|
-
},
|
|
1236
|
-
function
|
|
1065
|
+
}, ge = {
|
|
1066
|
+
keyDown: Qt,
|
|
1067
|
+
keyUp: en,
|
|
1068
|
+
clear: tn
|
|
1069
|
+
}, nn = (e) => () => {
|
|
1070
|
+
e.state.value && (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY, e.lib.rectCache.clear(), e.state.value === "dragging" && Se(e));
|
|
1071
|
+
}, L = 50, sn = 144, Re = 1e3 / sn;
|
|
1072
|
+
function on(e) {
|
|
1237
1073
|
return e == null ? {
|
|
1238
|
-
top:
|
|
1239
|
-
right:
|
|
1240
|
-
bottom:
|
|
1241
|
-
left:
|
|
1074
|
+
top: L,
|
|
1075
|
+
right: L,
|
|
1076
|
+
bottom: L,
|
|
1077
|
+
left: L
|
|
1242
1078
|
} : typeof e == "number" ? {
|
|
1243
1079
|
top: e,
|
|
1244
1080
|
right: e,
|
|
1245
1081
|
bottom: e,
|
|
1246
1082
|
left: e
|
|
1247
1083
|
} : {
|
|
1248
|
-
top: e.top ??
|
|
1249
|
-
right: e.right ??
|
|
1250
|
-
bottom: e.bottom ??
|
|
1251
|
-
left: e.left ??
|
|
1084
|
+
top: e.top ?? L,
|
|
1085
|
+
right: e.right ?? L,
|
|
1086
|
+
bottom: e.bottom ?? L,
|
|
1087
|
+
left: e.left ?? L
|
|
1252
1088
|
};
|
|
1253
1089
|
}
|
|
1254
|
-
const
|
|
1090
|
+
const rn = {
|
|
1255
1091
|
getScrollState(e) {
|
|
1256
1092
|
return {
|
|
1257
1093
|
scrollTop: e.scrollTop,
|
|
@@ -1262,37 +1098,37 @@ const Mn = {
|
|
|
1262
1098
|
e.scrollTop = t, e.scrollLeft = s;
|
|
1263
1099
|
}
|
|
1264
1100
|
};
|
|
1265
|
-
function
|
|
1266
|
-
const { speed:
|
|
1267
|
-
let g = null,
|
|
1268
|
-
const d = (
|
|
1269
|
-
o && (o.value =
|
|
1270
|
-
}, m = (
|
|
1271
|
-
const
|
|
1272
|
-
if (!
|
|
1101
|
+
function $e(e, t, s, n = rn, o) {
|
|
1102
|
+
const { speed: a = 10, disabled: r = !1 } = t, i = on(t.threshold);
|
|
1103
|
+
let g = null, l = null, u = null, c = 0, f = 0;
|
|
1104
|
+
const d = (y) => {
|
|
1105
|
+
o && (o.value = y);
|
|
1106
|
+
}, m = (y) => {
|
|
1107
|
+
const M = e.value, S = s();
|
|
1108
|
+
if (!M || !S || r) {
|
|
1273
1109
|
d(!1);
|
|
1274
1110
|
return;
|
|
1275
1111
|
}
|
|
1276
|
-
|
|
1277
|
-
const
|
|
1278
|
-
if (
|
|
1112
|
+
l || (l = y);
|
|
1113
|
+
const U = y - l;
|
|
1114
|
+
if (U < Re) {
|
|
1279
1115
|
g = requestAnimationFrame(m);
|
|
1280
1116
|
return;
|
|
1281
1117
|
}
|
|
1282
|
-
const
|
|
1283
|
-
|
|
1284
|
-
const { scrollTop:
|
|
1285
|
-
(!
|
|
1286
|
-
let
|
|
1287
|
-
|
|
1118
|
+
const D = a * (U / Re);
|
|
1119
|
+
l = y;
|
|
1120
|
+
const { scrollTop: x, scrollLeft: K } = n.getScrollState(M);
|
|
1121
|
+
(!u || c !== x || f !== K) && (u = n.getRect ? n.getRect(M) : M.getBoundingClientRect(), c = x, f = K);
|
|
1122
|
+
let z = !1, ie = x, ae = K;
|
|
1123
|
+
i.top > 0 && S.y - u.top < i.top ? (ie = x - D, z = !0) : i.bottom > 0 && u.bottom - S.y < i.bottom && (ie = x + D, z = !0), i.left > 0 && S.x - u.left < i.left ? (ae = K - D, z = !0) : i.right > 0 && u.right - S.x < i.right && (ae = K + D, z = !0), z && n.setScroll(M, ie, ae), d(z), g = requestAnimationFrame(m);
|
|
1288
1124
|
};
|
|
1289
1125
|
return { run: () => {
|
|
1290
|
-
|
|
1126
|
+
l = null, g = requestAnimationFrame(m);
|
|
1291
1127
|
}, stop: () => {
|
|
1292
|
-
g && (cancelAnimationFrame(g), g = null),
|
|
1128
|
+
g && (cancelAnimationFrame(g), g = null), u = null, c = 0, f = 0, l = null, d(!1);
|
|
1293
1129
|
} };
|
|
1294
1130
|
}
|
|
1295
|
-
const
|
|
1131
|
+
const an = {
|
|
1296
1132
|
getScrollState() {
|
|
1297
1133
|
return {
|
|
1298
1134
|
scrollTop: window.scrollY ?? document.documentElement.scrollTop,
|
|
@@ -1305,58 +1141,58 @@ const wn = {
|
|
|
1305
1141
|
getRect() {
|
|
1306
1142
|
return new DOMRect(0, 0, window.innerWidth, window.innerHeight);
|
|
1307
1143
|
}
|
|
1308
|
-
},
|
|
1144
|
+
}, ln = {
|
|
1309
1145
|
get value() {
|
|
1310
1146
|
return typeof document < "u" ? document.documentElement : null;
|
|
1311
1147
|
}
|
|
1312
1148
|
};
|
|
1313
|
-
function
|
|
1314
|
-
const s =
|
|
1315
|
-
|
|
1149
|
+
function cn(e, t) {
|
|
1150
|
+
const s = J(!1), o = $e(
|
|
1151
|
+
ln,
|
|
1316
1152
|
t ?? {},
|
|
1317
1153
|
() => {
|
|
1318
1154
|
if (e.state.value !== "dragging") return null;
|
|
1319
|
-
const
|
|
1320
|
-
return
|
|
1321
|
-
x:
|
|
1322
|
-
y:
|
|
1323
|
-
} :
|
|
1155
|
+
const i = e.overlay.position.value, g = e.overlay.size.value;
|
|
1156
|
+
return i ? g?.width && g?.height ? {
|
|
1157
|
+
x: i.x + g.width / 2,
|
|
1158
|
+
y: i.y + g.height / 2
|
|
1159
|
+
} : i : null;
|
|
1324
1160
|
},
|
|
1325
|
-
|
|
1161
|
+
an,
|
|
1326
1162
|
s
|
|
1327
|
-
),
|
|
1163
|
+
), a = oe(
|
|
1328
1164
|
() => e.state.value,
|
|
1329
|
-
(
|
|
1330
|
-
|
|
1165
|
+
(i) => {
|
|
1166
|
+
i === "dragging" ? o.run() : o.stop();
|
|
1331
1167
|
}
|
|
1332
1168
|
), r = () => {
|
|
1333
|
-
|
|
1169
|
+
a(), o.stop();
|
|
1334
1170
|
};
|
|
1335
|
-
return
|
|
1171
|
+
return We(r), { isScrolling: s, stop: r };
|
|
1336
1172
|
}
|
|
1337
|
-
const
|
|
1338
|
-
const t =
|
|
1173
|
+
const gn = (e) => {
|
|
1174
|
+
const t = jt(e), s = ge.keyDown(e), n = ge.keyUp(e), o = ge.clear(e), a = nn(e);
|
|
1339
1175
|
let r = null;
|
|
1340
|
-
|
|
1176
|
+
oe(
|
|
1341
1177
|
e.autoScrollViewport,
|
|
1342
|
-
(
|
|
1343
|
-
r?.(), r = null, (
|
|
1178
|
+
(i) => {
|
|
1179
|
+
r?.(), r = null, (i === !0 || i && typeof i == "object") && (r = cn(
|
|
1344
1180
|
e,
|
|
1345
|
-
|
|
1181
|
+
i === !0 ? {} : i
|
|
1346
1182
|
).stop);
|
|
1347
1183
|
},
|
|
1348
1184
|
{ immediate: !0 }
|
|
1349
|
-
),
|
|
1350
|
-
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", s), document.addEventListener("keyup", n), document.addEventListener("blur", o), document.addEventListener("scroll",
|
|
1351
|
-
}),
|
|
1352
|
-
document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", s), document.removeEventListener("keyup", n), document.removeEventListener("blur", o), document.removeEventListener("scroll",
|
|
1185
|
+
), Y(() => {
|
|
1186
|
+
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", s), document.addEventListener("keyup", n), document.addEventListener("blur", o), document.addEventListener("scroll", a, !0);
|
|
1187
|
+
}), X(() => {
|
|
1188
|
+
document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", s), document.removeEventListener("keyup", n), document.removeEventListener("blur", o), document.removeEventListener("scroll", a, !0), r?.(), t.cleanup();
|
|
1353
1189
|
});
|
|
1354
|
-
},
|
|
1355
|
-
const e =
|
|
1190
|
+
}, re = () => {
|
|
1191
|
+
const e = ze(De);
|
|
1356
1192
|
if (!e) throw Error("DnD provider not found");
|
|
1357
1193
|
return e;
|
|
1358
|
-
},
|
|
1359
|
-
const e =
|
|
1194
|
+
}, qe = () => {
|
|
1195
|
+
const e = re();
|
|
1360
1196
|
return {
|
|
1361
1197
|
overlay: e.overlay,
|
|
1362
1198
|
delay: e.delay,
|
|
@@ -1370,31 +1206,31 @@ const En = (e) => {
|
|
|
1370
1206
|
collision: e.collision,
|
|
1371
1207
|
autoScrollViewport: e.autoScrollViewport
|
|
1372
1208
|
};
|
|
1373
|
-
},
|
|
1209
|
+
}, un = /* @__PURE__ */ Oe({
|
|
1374
1210
|
__name: "DefaultOverlay",
|
|
1375
1211
|
setup(e) {
|
|
1376
|
-
const { entities: t, state: s, overlay: n } =
|
|
1377
|
-
return (o,
|
|
1212
|
+
const { entities: t, state: s, overlay: n } = qe();
|
|
1213
|
+
return (o, a) => k(s) === "dragging" ? (C(), j("div", {
|
|
1378
1214
|
key: 0,
|
|
1379
1215
|
class: "dnd-kit-default-overlay",
|
|
1380
|
-
style:
|
|
1381
|
-
"--position-x":
|
|
1382
|
-
"--position-y":
|
|
1216
|
+
style: xe({
|
|
1217
|
+
"--position-x": k(n).position.value.x + "px",
|
|
1218
|
+
"--position-y": k(n).position.value.y + "px"
|
|
1383
1219
|
})
|
|
1384
1220
|
}, [
|
|
1385
|
-
(
|
|
1386
|
-
|
|
1221
|
+
(C(!0), j(ue, null, je(k(t).draggingMap, ([r, i]) => (C(), j(ue, null, [
|
|
1222
|
+
k(t).draggableMap.get(r)?.render ? (C(), Q(fe(k(t).draggableMap.get(r)?.render), { key: 0 })) : (C(), Q(fe(r.tagName), {
|
|
1387
1223
|
key: 1,
|
|
1388
|
-
innerHTML:
|
|
1389
|
-
style:
|
|
1390
|
-
width:
|
|
1391
|
-
height:
|
|
1224
|
+
innerHTML: i.initialOuterHTML,
|
|
1225
|
+
style: xe({
|
|
1226
|
+
width: i.initialRect.width + "px",
|
|
1227
|
+
height: i.initialRect.height + "px"
|
|
1392
1228
|
})
|
|
1393
1229
|
}, null, 8, ["innerHTML", "style"]))
|
|
1394
1230
|
], 64))), 256))
|
|
1395
|
-
], 4)) :
|
|
1231
|
+
], 4)) : Je("", !0);
|
|
1396
1232
|
}
|
|
1397
|
-
}),
|
|
1233
|
+
}), hn = /* @__PURE__ */ Oe({
|
|
1398
1234
|
__name: "DnDProvider",
|
|
1399
1235
|
props: {
|
|
1400
1236
|
autoScrollViewport: { type: [Object, Boolean, null] },
|
|
@@ -1403,80 +1239,80 @@ const En = (e) => {
|
|
|
1403
1239
|
class: {}
|
|
1404
1240
|
},
|
|
1405
1241
|
setup(e) {
|
|
1406
|
-
const t = e, s =
|
|
1407
|
-
|
|
1408
|
-
const o =
|
|
1409
|
-
() => n.overlay.render.value ??
|
|
1242
|
+
const t = e, s = Qe("overlayRef"), n = Mt(s, t);
|
|
1243
|
+
gn(n);
|
|
1244
|
+
const o = b(
|
|
1245
|
+
() => n.overlay.render.value ?? un
|
|
1410
1246
|
);
|
|
1411
|
-
return
|
|
1412
|
-
|
|
1413
|
-
(
|
|
1414
|
-
to:
|
|
1247
|
+
return et(De, n), (a, r) => (C(), j(ue, null, [
|
|
1248
|
+
Ae(a.$slots, "default"),
|
|
1249
|
+
(C(), Q(tt, {
|
|
1250
|
+
to: k(n).overlay.to.value || "body"
|
|
1415
1251
|
}, [
|
|
1416
|
-
|
|
1252
|
+
nt("div", st({
|
|
1417
1253
|
ref_key: "overlayRef",
|
|
1418
1254
|
ref: s,
|
|
1419
1255
|
class: "dnd-kit-overlay-container"
|
|
1420
1256
|
}, t), [
|
|
1421
|
-
|
|
1422
|
-
(
|
|
1257
|
+
Ae(a.$slots, "overlay", { overlay: o.value }, () => [
|
|
1258
|
+
(C(), Q(fe(o.value)))
|
|
1423
1259
|
])
|
|
1424
1260
|
], 16)
|
|
1425
1261
|
], 8, ["to"]))
|
|
1426
1262
|
], 64));
|
|
1427
1263
|
}
|
|
1428
1264
|
});
|
|
1429
|
-
function
|
|
1430
|
-
const n =
|
|
1431
|
-
let o,
|
|
1432
|
-
typeof t == "function" ? (o = {},
|
|
1433
|
-
const
|
|
1265
|
+
function bn(e, t, s) {
|
|
1266
|
+
const n = re();
|
|
1267
|
+
let o, a, r;
|
|
1268
|
+
typeof t == "function" ? (o = {}, a = t) : (o = t ?? {}, a = s);
|
|
1269
|
+
const i = b({
|
|
1434
1270
|
get() {
|
|
1435
|
-
const
|
|
1436
|
-
return
|
|
1271
|
+
const c = v(e);
|
|
1272
|
+
return c ? n.entities.selectedSet.has(c) : !1;
|
|
1437
1273
|
},
|
|
1438
|
-
set(
|
|
1439
|
-
const f =
|
|
1440
|
-
f && n.entities.selectedSet[
|
|
1274
|
+
set(c) {
|
|
1275
|
+
const f = v(e);
|
|
1276
|
+
f && n.entities.selectedSet[c ? "add" : "delete"](f);
|
|
1441
1277
|
}
|
|
1442
|
-
}), g =
|
|
1443
|
-
const
|
|
1444
|
-
return
|
|
1445
|
-
}),
|
|
1446
|
-
const
|
|
1447
|
-
return
|
|
1448
|
-
}),
|
|
1449
|
-
const
|
|
1450
|
-
if (
|
|
1451
|
-
return n.entities.draggableMap.get(
|
|
1278
|
+
}), g = b(() => {
|
|
1279
|
+
const c = v(e);
|
|
1280
|
+
return c ? n.entities.draggingMap.has(c) : !1;
|
|
1281
|
+
}), l = b(() => {
|
|
1282
|
+
const c = v(e);
|
|
1283
|
+
return c ? n.entities.allowedDraggableSet.has(c) : !1;
|
|
1284
|
+
}), u = b(() => {
|
|
1285
|
+
const c = v(e);
|
|
1286
|
+
if (c)
|
|
1287
|
+
return n.entities.draggableMap.get(c)?.hoveredPlacement;
|
|
1452
1288
|
});
|
|
1453
|
-
return
|
|
1454
|
-
r =
|
|
1289
|
+
return Y(() => {
|
|
1290
|
+
r = v(e), r && (r.addEventListener("dragstart", w), r.addEventListener("drag", w), r.addEventListener("dragend", w), r.setAttribute(T.DRAGGABLE, ""), n.lib.draggableObserver.observe(r), n.entities.draggableMap.set(r, {
|
|
1455
1291
|
render: o.render,
|
|
1456
1292
|
disabled: o.disabled ?? !1,
|
|
1457
1293
|
groups: o.groups ?? [],
|
|
1458
1294
|
modifier: o.modifier,
|
|
1459
1295
|
events: o.events,
|
|
1460
|
-
payload:
|
|
1296
|
+
payload: a,
|
|
1461
1297
|
dragHandle: o.dragHandle,
|
|
1462
1298
|
activation: o.activation,
|
|
1463
1299
|
placementMargins: o.placementMargins,
|
|
1464
1300
|
hoveredPlacement: void 0
|
|
1465
1301
|
}));
|
|
1466
|
-
}),
|
|
1302
|
+
}), X(() => {
|
|
1467
1303
|
r && (n.lib.draggableObserver.unobserve(r), n.entities.visibleDraggableSet.delete(r), n.entities.draggableMap.delete(r), n.entities.modifiersDraggableSet.delete(r));
|
|
1468
1304
|
}), {
|
|
1469
|
-
selected:
|
|
1305
|
+
selected: i,
|
|
1470
1306
|
isDragging: g,
|
|
1471
|
-
isAllowed:
|
|
1472
|
-
isDragOver:
|
|
1307
|
+
isAllowed: l,
|
|
1308
|
+
isDragOver: u
|
|
1473
1309
|
};
|
|
1474
1310
|
}
|
|
1475
|
-
const
|
|
1476
|
-
const s =
|
|
1311
|
+
const yn = (e, t) => {
|
|
1312
|
+
const s = re(), n = b(() => e.value === s.entities.selectingArea);
|
|
1477
1313
|
let o = null;
|
|
1478
|
-
|
|
1479
|
-
o =
|
|
1314
|
+
Y(() => {
|
|
1315
|
+
o = v(e), o && (o.setAttribute(T.SELECT_AREA, ""), s.lib.selectableAreaObserver.observe(o), s.entities.selectableAreaMap.set(o, {
|
|
1480
1316
|
modifier: t?.modifier ?? {
|
|
1481
1317
|
keys: ["ControlLeft"],
|
|
1482
1318
|
method: "every"
|
|
@@ -1485,128 +1321,128 @@ const Rn = (e, t) => {
|
|
|
1485
1321
|
disabled: t?.disabled ?? !1,
|
|
1486
1322
|
groups: t?.groups ?? []
|
|
1487
1323
|
}));
|
|
1488
|
-
}),
|
|
1324
|
+
}), X(() => {
|
|
1489
1325
|
o && (s.lib.selectableAreaObserver.unobserve(o), s.entities.visibleSelectableAreaSet.delete(o), s.entities.modifiersSelectableAreaSet.delete(o), s.entities.selectableAreaMap.delete(o));
|
|
1490
1326
|
});
|
|
1491
|
-
const
|
|
1327
|
+
const a = b(() => {
|
|
1492
1328
|
s.scrollPosition.x, s.scrollPosition.y;
|
|
1493
1329
|
const r = s.pointer.value;
|
|
1494
|
-
return !r || s.state.value !== "selecting" || !o || !n.value ? {} :
|
|
1330
|
+
return !r || s.state.value !== "selecting" || !o || !n.value ? {} : Tt(r.start, r.current, o);
|
|
1495
1331
|
});
|
|
1496
1332
|
return {
|
|
1497
1333
|
isSelecting: n,
|
|
1498
|
-
style:
|
|
1334
|
+
style: a
|
|
1499
1335
|
};
|
|
1500
1336
|
};
|
|
1501
|
-
function
|
|
1502
|
-
const s =
|
|
1337
|
+
function pn(e, t) {
|
|
1338
|
+
const s = ze(De);
|
|
1503
1339
|
if (!s) throw Error("DnD provider not found");
|
|
1504
1340
|
let n = null;
|
|
1505
|
-
return
|
|
1506
|
-
n =
|
|
1341
|
+
return Y(() => {
|
|
1342
|
+
n = v(e), n && (n.setAttribute(T.CONSTRAINT_AREA, ""), s.entities.constraintsAreaMap.set(n, {
|
|
1507
1343
|
axis: t?.axis || "both",
|
|
1508
1344
|
restrictToArea: t?.restrictToArea || !1
|
|
1509
1345
|
}));
|
|
1510
|
-
}),
|
|
1346
|
+
}), X(() => {
|
|
1511
1347
|
n && s.entities.constraintsAreaMap.delete(n);
|
|
1512
1348
|
}), {};
|
|
1513
1349
|
}
|
|
1514
|
-
function
|
|
1515
|
-
const n =
|
|
1516
|
-
let o = null,
|
|
1517
|
-
typeof t == "function" ? (
|
|
1518
|
-
const
|
|
1519
|
-
const
|
|
1520
|
-
return
|
|
1521
|
-
}), g =
|
|
1522
|
-
const
|
|
1523
|
-
if (
|
|
1524
|
-
return n.entities.droppableMap.get(
|
|
1350
|
+
function Sn(e, t, s) {
|
|
1351
|
+
const n = re();
|
|
1352
|
+
let o = null, a, r;
|
|
1353
|
+
typeof t == "function" ? (a = {}, r = t) : (a = t ?? {}, r = s);
|
|
1354
|
+
const i = b(() => {
|
|
1355
|
+
const l = v(e);
|
|
1356
|
+
return l ? n.entities.allowedDroppableSet.has(l) : !1;
|
|
1357
|
+
}), g = b(() => {
|
|
1358
|
+
const l = v(e);
|
|
1359
|
+
if (l)
|
|
1360
|
+
return n.entities.droppableMap.get(l)?.hoveredPlacement;
|
|
1525
1361
|
});
|
|
1526
|
-
return
|
|
1527
|
-
o =
|
|
1528
|
-
disabled:
|
|
1529
|
-
groups:
|
|
1530
|
-
events:
|
|
1362
|
+
return Y(() => {
|
|
1363
|
+
o = v(e), o && (o.setAttribute(T.DROPPABLE, ""), n.lib.droppableObserver.observe(o), n.entities.droppableMap.set(o, {
|
|
1364
|
+
disabled: a.disabled ?? !1,
|
|
1365
|
+
groups: a.groups ?? [],
|
|
1366
|
+
events: a.events,
|
|
1531
1367
|
payload: r,
|
|
1532
1368
|
hoveredPlacement: void 0
|
|
1533
1369
|
}));
|
|
1534
|
-
}),
|
|
1370
|
+
}), X(() => {
|
|
1535
1371
|
o && (n.lib.droppableObserver.unobserve(o), n.entities.visibleDroppableSet.delete(o), n.entities.droppableMap.delete(o));
|
|
1536
1372
|
}), {
|
|
1537
|
-
isAllowed:
|
|
1373
|
+
isAllowed: i,
|
|
1538
1374
|
isDragOver: g
|
|
1539
1375
|
};
|
|
1540
1376
|
}
|
|
1541
|
-
const
|
|
1542
|
-
const s =
|
|
1377
|
+
const Dn = (e, t) => {
|
|
1378
|
+
const s = qe(), n = J(!1), a = $e(
|
|
1543
1379
|
e,
|
|
1544
1380
|
t ?? {},
|
|
1545
1381
|
() => {
|
|
1546
1382
|
if (s.state.value !== "dragging") return null;
|
|
1547
|
-
const r = s.overlay.position.value,
|
|
1548
|
-
return r ?
|
|
1549
|
-
x: r.x +
|
|
1550
|
-
y: r.y +
|
|
1383
|
+
const r = s.overlay.position.value, i = s.overlay.size.value;
|
|
1384
|
+
return r ? i?.width && i?.height ? {
|
|
1385
|
+
x: r.x + i.width / 2,
|
|
1386
|
+
y: r.y + i.height / 2
|
|
1551
1387
|
} : r : null;
|
|
1552
1388
|
},
|
|
1553
1389
|
void 0,
|
|
1554
1390
|
n
|
|
1555
1391
|
);
|
|
1556
|
-
return
|
|
1392
|
+
return oe(
|
|
1557
1393
|
() => s.state.value,
|
|
1558
1394
|
(r) => {
|
|
1559
|
-
r === "dragging" ?
|
|
1395
|
+
r === "dragging" ? a.run() : a.stop();
|
|
1560
1396
|
}
|
|
1561
1397
|
), { isScrolling: n };
|
|
1562
1398
|
};
|
|
1563
|
-
function
|
|
1399
|
+
function ke(e, t) {
|
|
1564
1400
|
return t <= 0 ? e : Math.round(e / t) * t;
|
|
1565
1401
|
}
|
|
1566
|
-
function
|
|
1402
|
+
function Mn(e, t) {
|
|
1567
1403
|
const s = t && "grid" in t && t.grid != null, n = t ? s ? t.grid : t.gridX : 1, o = t ? s ? t.grid : t.gridY : 1;
|
|
1568
|
-
return
|
|
1569
|
-
const { x:
|
|
1404
|
+
return b(() => {
|
|
1405
|
+
const { x: a, y: r } = e.value;
|
|
1570
1406
|
return {
|
|
1571
|
-
x:
|
|
1572
|
-
y:
|
|
1407
|
+
x: ke(a, n),
|
|
1408
|
+
y: ke(r, o)
|
|
1573
1409
|
};
|
|
1574
1410
|
});
|
|
1575
1411
|
}
|
|
1576
|
-
const
|
|
1412
|
+
const Pe = () => !0, Te = () => 0, fn = "separate", dn = () => {
|
|
1577
1413
|
const e = {
|
|
1578
|
-
filterElements:
|
|
1579
|
-
filterZones:
|
|
1580
|
-
sortElements:
|
|
1581
|
-
sortZones:
|
|
1582
|
-
mergeStrategy:
|
|
1414
|
+
filterElements: Pe,
|
|
1415
|
+
filterZones: Pe,
|
|
1416
|
+
sortElements: Te,
|
|
1417
|
+
sortZones: Te,
|
|
1418
|
+
mergeStrategy: fn,
|
|
1583
1419
|
pickClosestBetweenFirst: !1
|
|
1584
|
-
}, t = (n, o,
|
|
1585
|
-
const
|
|
1586
|
-
for (const m of
|
|
1587
|
-
if (!
|
|
1588
|
-
const h =
|
|
1589
|
-
if (!
|
|
1590
|
-
const
|
|
1591
|
-
if (f !== void 0 &&
|
|
1592
|
-
let
|
|
1593
|
-
for (const
|
|
1594
|
-
|
|
1420
|
+
}, t = (n, o, a, r, i, g, l) => {
|
|
1421
|
+
const u = r instanceof Set ? r : new Set(r), c = { containerBox: o, pointer: a }, f = e.minOverlapPercent, d = [];
|
|
1422
|
+
for (const m of u) {
|
|
1423
|
+
if (!i(m, n)) continue;
|
|
1424
|
+
const h = se(m);
|
|
1425
|
+
if (!l(h, c)) continue;
|
|
1426
|
+
const p = be(h, o);
|
|
1427
|
+
if (f !== void 0 && p < f) continue;
|
|
1428
|
+
let y = 0;
|
|
1429
|
+
for (const M of u)
|
|
1430
|
+
M !== m && H(M, m) && y++;
|
|
1595
1431
|
d.push({
|
|
1596
1432
|
node: m,
|
|
1597
1433
|
box: h,
|
|
1598
1434
|
meta: {
|
|
1599
|
-
isPointerInElement:
|
|
1600
|
-
overlapPercent:
|
|
1601
|
-
depth:
|
|
1602
|
-
centerDistance:
|
|
1603
|
-
|
|
1604
|
-
|
|
1435
|
+
isPointerInElement: Nt(h, a.x, a.y),
|
|
1436
|
+
overlapPercent: p,
|
|
1437
|
+
depth: y,
|
|
1438
|
+
centerDistance: Kt(
|
|
1439
|
+
Z(o),
|
|
1440
|
+
Z(h)
|
|
1605
1441
|
)
|
|
1606
1442
|
}
|
|
1607
1443
|
});
|
|
1608
1444
|
}
|
|
1609
|
-
return d.sort((m, h) => g(m, h,
|
|
1445
|
+
return d.sort((m, h) => g(m, h, c)), d;
|
|
1610
1446
|
}, s = {
|
|
1611
1447
|
container(n) {
|
|
1612
1448
|
return e.container = n, s;
|
|
@@ -1651,81 +1487,81 @@ const Ke = () => !0, Ne = () => 0, Cn = "separate", In = () => {
|
|
|
1651
1487
|
"sensor: container, elements, zones, collision are required"
|
|
1652
1488
|
);
|
|
1653
1489
|
return (o) => {
|
|
1654
|
-
const
|
|
1655
|
-
if (!
|
|
1656
|
-
const r = n.containerBox ? n.containerBox(o) :
|
|
1490
|
+
const a = n.container(o);
|
|
1491
|
+
if (!a) return { elements: [], zones: [] };
|
|
1492
|
+
const r = n.containerBox ? n.containerBox(o) : se(a), i = o.pointer.value?.current ?? { x: 0, y: 0 }, g = t(
|
|
1657
1493
|
o,
|
|
1658
1494
|
r,
|
|
1659
|
-
|
|
1495
|
+
i,
|
|
1660
1496
|
n.elements(o),
|
|
1661
1497
|
n.filterElements,
|
|
1662
1498
|
n.sortElements,
|
|
1663
1499
|
n.collision
|
|
1664
|
-
),
|
|
1500
|
+
), l = t(
|
|
1665
1501
|
o,
|
|
1666
1502
|
r,
|
|
1667
|
-
|
|
1503
|
+
i,
|
|
1668
1504
|
n.zones(o),
|
|
1669
1505
|
n.filterZones,
|
|
1670
1506
|
n.sortZones,
|
|
1671
1507
|
n.collision
|
|
1672
1508
|
);
|
|
1673
1509
|
if (n.mergeStrategy === "unified-closest") {
|
|
1674
|
-
const
|
|
1510
|
+
const u = [
|
|
1675
1511
|
...g.map((f) => ({
|
|
1676
1512
|
node: f.node,
|
|
1677
1513
|
box: f.box,
|
|
1678
1514
|
isZone: !1,
|
|
1679
1515
|
distance: 0
|
|
1680
1516
|
})),
|
|
1681
|
-
...
|
|
1517
|
+
...l.map((f) => ({
|
|
1682
1518
|
node: f.node,
|
|
1683
1519
|
box: f.box,
|
|
1684
1520
|
isZone: !0,
|
|
1685
1521
|
distance: 0
|
|
1686
1522
|
}))
|
|
1687
1523
|
];
|
|
1688
|
-
if (
|
|
1689
|
-
for (const f of
|
|
1690
|
-
const d =
|
|
1524
|
+
if (u.length === 0) return { elements: [], zones: [] };
|
|
1525
|
+
for (const f of u) {
|
|
1526
|
+
const d = Z(f.box);
|
|
1691
1527
|
f.distance = Math.hypot(
|
|
1692
|
-
|
|
1693
|
-
|
|
1528
|
+
i.x - d.x,
|
|
1529
|
+
i.y - d.y
|
|
1694
1530
|
);
|
|
1695
1531
|
}
|
|
1696
|
-
const
|
|
1532
|
+
const c = u.reduce(
|
|
1697
1533
|
(f, d) => d.distance < f.distance ? d : f
|
|
1698
1534
|
);
|
|
1699
|
-
return
|
|
1535
|
+
return c.isZone ? { elements: [], zones: [c.node] } : { elements: [c.node], zones: [] };
|
|
1700
1536
|
}
|
|
1701
|
-
if (n.pickClosestBetweenFirst && g[0] &&
|
|
1702
|
-
const
|
|
1703
|
-
|
|
1704
|
-
|
|
1537
|
+
if (n.pickClosestBetweenFirst && g[0] && l[0]) {
|
|
1538
|
+
const u = Z(l[0].box), c = Z(g[0].box), f = Math.hypot(
|
|
1539
|
+
i.x - u.x,
|
|
1540
|
+
i.y - u.y
|
|
1705
1541
|
);
|
|
1706
1542
|
return Math.hypot(
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
) < f ? { elements: g.map((m) => m.node), zones: [] } : { elements: [], zones:
|
|
1543
|
+
i.x - c.x,
|
|
1544
|
+
i.y - c.y
|
|
1545
|
+
) < f ? { elements: g.map((m) => m.node), zones: [] } : { elements: [], zones: l.map((m) => m.node) };
|
|
1710
1546
|
}
|
|
1711
1547
|
return {
|
|
1712
|
-
elements: g.map((
|
|
1713
|
-
zones:
|
|
1548
|
+
elements: g.map((u) => u.node),
|
|
1549
|
+
zones: l.map((u) => u.node)
|
|
1714
1550
|
};
|
|
1715
1551
|
};
|
|
1716
1552
|
}
|
|
1717
1553
|
};
|
|
1718
1554
|
return s;
|
|
1719
|
-
},
|
|
1555
|
+
}, vn = () => dn();
|
|
1720
1556
|
export {
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1557
|
+
hn as DnDProvider,
|
|
1558
|
+
vn as createSensor,
|
|
1559
|
+
pe as defaultCollisionDetection,
|
|
1560
|
+
Dn as makeAutoScroll,
|
|
1561
|
+
pn as makeConstraintArea,
|
|
1562
|
+
bn as makeDraggable,
|
|
1563
|
+
Sn as makeDroppable,
|
|
1564
|
+
yn as makeSelectionArea,
|
|
1565
|
+
Mn as makeSnappedOverlayPosition,
|
|
1566
|
+
qe as useDnDProvider
|
|
1731
1567
|
};
|