@vue-dnd-kit/core 2.0.0-alpha2 → 2.0.0-alpha4
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/README.md +72 -3
- package/dist/external/components/DefaultOverlay.vue.d.ts +0 -1
- package/dist/external/components/DnDProvider.vue.d.ts +0 -1
- package/dist/external/composables/makeConstraintArea.d.ts +7 -0
- package/dist/external/composables/makeDraggable.d.ts +0 -1
- package/dist/external/composables/makeDroppable.d.ts +4 -3
- package/dist/external/composables/{makeSelectableArea.d.ts → makeSelectionArea.d.ts} +2 -3
- package/dist/external/composables/useDnDProvider.d.ts +0 -1
- package/dist/external/index.d.ts +2 -3
- package/dist/external/types/entities.d.ts +10 -0
- package/dist/external/types/provider.d.ts +5 -2
- package/dist/internal/composables/useDnDProviderEvents.d.ts +0 -1
- package/dist/internal/composables/useDnDProviderInternal.d.ts +0 -1
- package/dist/internal/composables/useDnDProviderState.d.ts +0 -1
- package/dist/internal/composables/useSizeObserver.d.ts +0 -1
- package/dist/internal/logic/hover.d.ts +0 -1
- package/dist/internal/logic/keyboard.d.ts +0 -1
- package/dist/internal/logic/payload.d.ts +6 -2
- package/dist/internal/logic/pointer.d.ts +0 -1
- package/dist/internal/logic/scroll.d.ts +0 -1
- package/dist/internal/sensors/defaultCollision.d.ts +0 -1
- package/dist/internal/sensors/index.d.ts +0 -1
- package/dist/internal/sensors/sensor.d.ts +0 -1
- package/dist/internal/sensors/steps.d.ts +0 -1
- package/dist/internal/utils/constraints.d.ts +0 -1
- package/dist/internal/utils/disabled.d.ts +0 -1
- package/dist/internal/utils/dom.d.ts +0 -1
- package/dist/internal/utils/drag-activation.d.ts +0 -1
- package/dist/internal/utils/events.d.ts +2 -2
- package/dist/internal/utils/geometry.d.ts +0 -1
- package/dist/internal/utils/groups.d.ts +0 -1
- package/dist/internal/utils/keyboard.d.ts +0 -1
- package/dist/internal/utils/namespaces.d.ts +0 -1
- package/dist/internal/utils/observer.d.ts +0 -1
- package/dist/internal/utils/placement.d.ts +0 -1
- package/dist/internal/utils/pointer.d.ts +0 -1
- package/dist/internal/utils/provider.d.ts +0 -1
- package/dist/internal/utils/selection.d.ts +0 -1
- package/dist/internal/utils/session.d.ts +0 -1
- package/dist/vue-dnd-kit-core.cjs.js +2 -3
- package/dist/vue-dnd-kit-core.es.js +181 -164
- package/package.json +4 -4
- package/dist/external/components/DefaultOverlay.vue.d.ts.map +0 -1
- package/dist/external/components/DnDProvider.vue.d.ts.map +0 -1
- package/dist/external/composables/makeBoundingBox.d.ts +0 -8
- package/dist/external/composables/makeBoundingBox.d.ts.map +0 -1
- package/dist/external/composables/makeCustomOverlay.d.ts +0 -2
- package/dist/external/composables/makeCustomOverlay.d.ts.map +0 -1
- package/dist/external/composables/makeDraggable.d.ts.map +0 -1
- package/dist/external/composables/makeDroppable.d.ts.map +0 -1
- package/dist/external/composables/makeSelectableArea.d.ts.map +0 -1
- package/dist/external/composables/useDnDProvider.d.ts.map +0 -1
- package/dist/external/index.d.ts.map +0 -1
- package/dist/internal/composables/useDnDProviderEvents.d.ts.map +0 -1
- package/dist/internal/composables/useDnDProviderInternal.d.ts.map +0 -1
- package/dist/internal/composables/useDnDProviderState.d.ts.map +0 -1
- package/dist/internal/composables/useSizeObserver.d.ts.map +0 -1
- package/dist/internal/logic/hover.d.ts.map +0 -1
- package/dist/internal/logic/keyboard.d.ts.map +0 -1
- package/dist/internal/logic/payload.d.ts.map +0 -1
- package/dist/internal/logic/pointer.d.ts.map +0 -1
- package/dist/internal/logic/scroll.d.ts.map +0 -1
- package/dist/internal/sensors/defaultCollision.d.ts.map +0 -1
- package/dist/internal/sensors/index.d.ts.map +0 -1
- package/dist/internal/sensors/sensor.d.ts.map +0 -1
- package/dist/internal/sensors/steps.d.ts.map +0 -1
- package/dist/internal/utils/constraints.d.ts.map +0 -1
- package/dist/internal/utils/disabled.d.ts.map +0 -1
- package/dist/internal/utils/dom.d.ts.map +0 -1
- package/dist/internal/utils/drag-activation.d.ts.map +0 -1
- package/dist/internal/utils/events.d.ts.map +0 -1
- package/dist/internal/utils/geometry.d.ts.map +0 -1
- package/dist/internal/utils/groups.d.ts.map +0 -1
- package/dist/internal/utils/keyboard.d.ts.map +0 -1
- package/dist/internal/utils/namespaces.d.ts.map +0 -1
- package/dist/internal/utils/observer.d.ts.map +0 -1
- package/dist/internal/utils/placement.d.ts.map +0 -1
- package/dist/internal/utils/pointer.d.ts.map +0 -1
- package/dist/internal/utils/provider.d.ts.map +0 -1
- package/dist/internal/utils/selection.d.ts.map +0 -1
- package/dist/internal/utils/session.d.ts.map +0 -1
- package/dist/vue-dnd-kit-core.cjs.js.map +0 -1
- package/dist/vue-dnd-kit-core.es.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
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)}
|
|
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)}.dnd-kit-overlay-container{position:fixed;top:0;left:0;pointer-events:none;cursor:grabbing}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
import { ref as I, watch as Se, shallowRef as ne, reactive as _, computed as E, onMounted as R, onBeforeUnmount as P, inject as de, defineComponent as ye, unref as A, openBlock as v, createElementBlock as K, normalizeStyle as se, Fragment as Z, renderList as Ae, createBlock as V, resolveDynamicComponent as q, createCommentVNode as we, useTemplateRef as xe, provide as Le, renderSlot as ie, createElementVNode as Ce } from "vue";
|
|
3
|
+
const M = {
|
|
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
|
}, k = {
|
|
9
|
-
SELECT_AREA: `[${
|
|
10
|
-
DRAGGABLE: `[${
|
|
11
|
-
CONSTRAINT_AREA: `[${
|
|
9
|
+
SELECT_AREA: `[${M.SELECT_AREA}]`,
|
|
10
|
+
DRAGGABLE: `[${M.DRAGGABLE}]`,
|
|
11
|
+
CONSTRAINT_AREA: `[${M.CONSTRAINT_AREA}]`
|
|
12
12
|
}, te = "VueDnDKitProvider", ae = (e, t, n, s) => {
|
|
13
13
|
const i = /* @__PURE__ */ new Set();
|
|
14
14
|
return t.forEach((a) => {
|
|
@@ -22,14 +22,14 @@ const v = {
|
|
|
22
22
|
l[c]((u) => n.value.has(u)) && i.add(a);
|
|
23
23
|
}), i;
|
|
24
24
|
};
|
|
25
|
-
let be = "",
|
|
26
|
-
const N = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, B = (e, t) => e !== t && e.contains(t),
|
|
25
|
+
let be = "", ke = "", Re = "";
|
|
26
|
+
const N = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, B = (e, t) => e !== t && e.contains(t), Pe = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), W = () => {
|
|
27
27
|
const e = document.body;
|
|
28
28
|
be = 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
|
}, j = () => {
|
|
30
30
|
const e = document.body;
|
|
31
|
-
e.style.userSelect = be, e.style.touchAction =
|
|
32
|
-
}, m = (e) => e.preventDefault(),
|
|
31
|
+
e.style.userSelect = be, e.style.touchAction = ke, e.style.overscrollBehavior = Re, window.removeEventListener("contextmenu", m), window.removeEventListener("selectstart", m), window.removeEventListener("touchstart", m), window.removeEventListener("touchmove", m);
|
|
32
|
+
}, m = (e) => e.preventDefault(), S = (e, t) => {
|
|
33
33
|
if (t.entities.draggableMap.get(e)?.disabled) return !0;
|
|
34
34
|
for (const [s, i] of t.entities.draggableMap)
|
|
35
35
|
if (i.disabled && B(s, e)) return !0;
|
|
@@ -51,7 +51,7 @@ const N = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$e
|
|
|
51
51
|
unobserve: (n) => t.unobserve(n),
|
|
52
52
|
disconnect: () => t.disconnect()
|
|
53
53
|
};
|
|
54
|
-
},
|
|
54
|
+
}, Be = (e) => {
|
|
55
55
|
const t = new ResizeObserver((n) => {
|
|
56
56
|
const s = n[0];
|
|
57
57
|
if (!s) return;
|
|
@@ -63,8 +63,8 @@ const N = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$e
|
|
|
63
63
|
unobserve: (n) => t.unobserve(n),
|
|
64
64
|
disconnect: () => t.disconnect()
|
|
65
65
|
};
|
|
66
|
-
},
|
|
67
|
-
const t =
|
|
66
|
+
}, Oe = (e) => {
|
|
67
|
+
const t = I(null), n = Be(t), s = Se(
|
|
68
68
|
e,
|
|
69
69
|
(a) => {
|
|
70
70
|
n.disconnect(), a && n.observe(a);
|
|
@@ -92,30 +92,31 @@ function he(e, t) {
|
|
|
92
92
|
return {
|
|
93
93
|
...t,
|
|
94
94
|
initialHTML: e.innerHTML,
|
|
95
|
-
initialRect: e.getBoundingClientRect()
|
|
95
|
+
initialRect: e.getBoundingClientRect(),
|
|
96
|
+
initialOuterHTML: e.outerHTML
|
|
96
97
|
};
|
|
97
98
|
}
|
|
98
|
-
function
|
|
99
|
+
function Te(e, t, n) {
|
|
99
100
|
e.forEach((s) => {
|
|
100
101
|
const i = t.get(s);
|
|
101
102
|
n.set(s, he(s, i));
|
|
102
103
|
}), e.clear();
|
|
103
104
|
}
|
|
104
|
-
function
|
|
105
|
+
function ze(e, t, n) {
|
|
105
106
|
n.clear();
|
|
106
107
|
const s = t.get(e);
|
|
107
108
|
n.set(e, he(e, s));
|
|
108
109
|
}
|
|
109
|
-
function
|
|
110
|
-
e.entities.initiatingDraggable && (e.state.value = "dragging",
|
|
110
|
+
function H(e) {
|
|
111
|
+
e.entities.initiatingDraggable && (e.state.value = "dragging", _e(
|
|
111
112
|
e.entities.initiatingDraggable,
|
|
112
113
|
e.entities.selectedSet,
|
|
113
114
|
e.entities.draggableMap,
|
|
114
115
|
e.entities.draggingMap
|
|
115
116
|
));
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
-
t.has(e) ?
|
|
118
|
+
function _e(e, t, n, s) {
|
|
119
|
+
t.has(e) ? Te(t, n, s) : (t.clear(), ze(e, n, s));
|
|
119
120
|
}
|
|
120
121
|
function De(e, t, n, s) {
|
|
121
122
|
if (s || !n) return !0;
|
|
@@ -143,7 +144,7 @@ function pe(e, t, n) {
|
|
|
143
144
|
const s = n.distance != null, i = n.delay != null;
|
|
144
145
|
return !s && !i ? !0 : s && !i ? e >= 1 : !s && i ? t >= 1 : (n.condition ?? "both") === "both" ? e >= 1 && t >= 1 : e >= 1 || t >= 1;
|
|
145
146
|
}
|
|
146
|
-
function
|
|
147
|
+
function Ie(e) {
|
|
147
148
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable)
|
|
148
149
|
return !1;
|
|
149
150
|
const t = e.entities.draggableMap.get(
|
|
@@ -153,9 +154,9 @@ function Ke(e) {
|
|
|
153
154
|
e.distanceProgress.value,
|
|
154
155
|
e.delay.progress,
|
|
155
156
|
t?.activation
|
|
156
|
-
) ? (
|
|
157
|
+
) ? (H(e), !0) : !1;
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
+
function Ke(e, t) {
|
|
159
160
|
let n = null;
|
|
160
161
|
const s = () => {
|
|
161
162
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable) {
|
|
@@ -193,10 +194,10 @@ function He(e, t) {
|
|
|
193
194
|
entity: t.get(n)
|
|
194
195
|
};
|
|
195
196
|
}
|
|
196
|
-
function
|
|
197
|
+
function Ge(e, t, n, s) {
|
|
197
198
|
return n === "x" ? { x: e, y: s.top } : n === "y" ? { x: s.left, y: t } : { x: e, y: t };
|
|
198
199
|
}
|
|
199
|
-
function
|
|
200
|
+
function Ne(e, t, n, s, i) {
|
|
200
201
|
let a = e, o = t;
|
|
201
202
|
return n !== "y" && (a = Math.max(
|
|
202
203
|
s.left,
|
|
@@ -206,7 +207,7 @@ function Ue(e, t, n, s, i) {
|
|
|
206
207
|
Math.min(s.bottom - i.height, t)
|
|
207
208
|
)), { x: a, y: o };
|
|
208
209
|
}
|
|
209
|
-
function
|
|
210
|
+
function Ue(e, t, n, s, i) {
|
|
210
211
|
if (!e || !t)
|
|
211
212
|
return { x: 0, y: 0 };
|
|
212
213
|
const a = t.getBoundingClientRect(), o = a.width || i?.width || 0, r = a.height || i?.height || 0;
|
|
@@ -216,13 +217,13 @@ function Ye(e, t, n, s, i) {
|
|
|
216
217
|
const f = He(n, s);
|
|
217
218
|
if (!f)
|
|
218
219
|
return { x: l, y: c };
|
|
219
|
-
const { element: u, entity: d } = f, g = u.getBoundingClientRect(), y = n.getBoundingClientRect(), b =
|
|
220
|
+
const { element: u, entity: d } = f, g = u.getBoundingClientRect(), y = n.getBoundingClientRect(), b = Ge(
|
|
220
221
|
l,
|
|
221
222
|
c,
|
|
222
223
|
d.axis || "both",
|
|
223
224
|
y
|
|
224
225
|
);
|
|
225
|
-
return d.restrictToArea ?
|
|
226
|
+
return d.restrictToArea ? Ne(
|
|
226
227
|
b.x,
|
|
227
228
|
b.y,
|
|
228
229
|
d.axis || "both",
|
|
@@ -246,10 +247,10 @@ const C = {
|
|
|
246
247
|
],
|
|
247
248
|
forMoveFaster: ["ShiftLeft", "ShiftRight"]
|
|
248
249
|
};
|
|
249
|
-
function
|
|
250
|
-
const t = ne(), n =
|
|
250
|
+
function Ye(e) {
|
|
251
|
+
const t = ne(), n = I(), i = {
|
|
251
252
|
keys: {
|
|
252
|
-
pressedKeys:
|
|
253
|
+
pressedKeys: I(/* @__PURE__ */ new Set()),
|
|
253
254
|
forDrag: [...C.forDrag],
|
|
254
255
|
forCancel: [...C.forCancel],
|
|
255
256
|
forDrop: [...C.forDrop],
|
|
@@ -276,7 +277,7 @@ function Ze(e) {
|
|
|
276
277
|
a.draggableMap,
|
|
277
278
|
a.visibleDraggableSet,
|
|
278
279
|
i.keys.pressedKeys,
|
|
279
|
-
(z) =>
|
|
280
|
+
(z) => S(z, { entities: a })
|
|
280
281
|
)),
|
|
281
282
|
visibleDraggableSet: /* @__PURE__ */ new Set(),
|
|
282
283
|
visibleDroppableSet: /* @__PURE__ */ new Set(),
|
|
@@ -297,15 +298,15 @@ function Ze(e) {
|
|
|
297
298
|
a.visibleDroppableSet
|
|
298
299
|
), u = Y(
|
|
299
300
|
a.visibleSelectableAreaSet
|
|
300
|
-
), { overlaySize: d, overlaySizeObserver: g } =
|
|
301
|
+
), { overlaySize: d, overlaySizeObserver: g } = Oe(e), y = I(), b = _({
|
|
301
302
|
draggable: /* @__PURE__ */ new Map(),
|
|
302
303
|
droppable: /* @__PURE__ */ new Map()
|
|
303
|
-
}),
|
|
304
|
+
}), p = {
|
|
304
305
|
throttle: ne(0)
|
|
305
306
|
}, O = E(() => {
|
|
306
307
|
o.y, o.x;
|
|
307
308
|
const T = a.initiatingDraggable;
|
|
308
|
-
return
|
|
309
|
+
return Ue(
|
|
309
310
|
n.value,
|
|
310
311
|
e.value,
|
|
311
312
|
T || null,
|
|
@@ -322,7 +323,7 @@ function Ze(e) {
|
|
|
322
323
|
delay: r,
|
|
323
324
|
distanceProgress: l,
|
|
324
325
|
hovered: b,
|
|
325
|
-
collision:
|
|
326
|
+
collision: p,
|
|
326
327
|
overlay: {
|
|
327
328
|
size: d,
|
|
328
329
|
style: O,
|
|
@@ -337,9 +338,9 @@ function Ze(e) {
|
|
|
337
338
|
}
|
|
338
339
|
};
|
|
339
340
|
}
|
|
340
|
-
const
|
|
341
|
+
const G = (e) => {
|
|
341
342
|
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();
|
|
342
|
-
},
|
|
343
|
+
}, $e = (e) => {
|
|
343
344
|
const t = e.entities.initiatingDraggable;
|
|
344
345
|
if (!t) return;
|
|
345
346
|
const s = e.entities.draggableMap.get(t)?.payload;
|
|
@@ -352,46 +353,65 @@ const H = (e) => {
|
|
|
352
353
|
items: Array.isArray(o) ? o : [],
|
|
353
354
|
dropData: r
|
|
354
355
|
};
|
|
355
|
-
},
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
356
|
+
}, Xe = (e, t) => {
|
|
357
|
+
const s = e.entities.droppableMap.get(t)?.payload;
|
|
358
|
+
if (!s) return;
|
|
359
|
+
const i = s();
|
|
360
|
+
if (!Array.isArray(i) || i.length < 1) return;
|
|
361
|
+
const [a, o] = i;
|
|
362
|
+
return {
|
|
363
|
+
items: Array.isArray(a) ? a : [],
|
|
364
|
+
userData: o
|
|
365
|
+
};
|
|
366
|
+
}, w = (e) => e.keys().next().value, Ze = (e) => e.target.closest(k.DRAGGABLE), D = (e, t) => {
|
|
367
|
+
const n = {
|
|
368
|
+
payload: $e(e),
|
|
369
|
+
provider: e
|
|
370
|
+
};
|
|
371
|
+
return t && (n.dropZonePayload = Xe(e, t)), n;
|
|
372
|
+
}, $ = (e, t, n) => {
|
|
373
|
+
const s = Ze(t);
|
|
360
374
|
if (!s || !e.entities.draggingMap.has(s)) return;
|
|
361
|
-
const i =
|
|
375
|
+
const i = D(e);
|
|
362
376
|
e.entities.draggingMap.get(s)?.events?.[n]?.(i);
|
|
363
377
|
}, x = (e, t, n) => {
|
|
364
|
-
if (!t ||
|
|
365
|
-
const s =
|
|
378
|
+
if (!t || S(t, e)) return;
|
|
379
|
+
const s = D(e);
|
|
366
380
|
e.entities.draggableMap.get(t)?.events?.[n]?.(s);
|
|
367
381
|
}, h = (e, t) => {
|
|
368
|
-
const n =
|
|
382
|
+
const n = D(e);
|
|
369
383
|
e.entities.draggableMap.forEach((s, i) => {
|
|
370
|
-
|
|
384
|
+
S(i, e) || s.events?.[t]?.(n);
|
|
371
385
|
});
|
|
372
|
-
},
|
|
386
|
+
}, Ve = (e, t, n) => {
|
|
373
387
|
if (t !== n) {
|
|
374
|
-
|
|
375
|
-
|
|
388
|
+
if (t && !L(t, e)) {
|
|
389
|
+
const s = D(e, t);
|
|
390
|
+
e.entities.droppableMap.get(t)?.events?.onLeave?.(s);
|
|
391
|
+
}
|
|
392
|
+
if (n && !L(n, e)) {
|
|
393
|
+
const s = D(e, n);
|
|
394
|
+
e.entities.droppableMap.get(n)?.events?.onEnter?.(s);
|
|
395
|
+
}
|
|
376
396
|
}
|
|
377
|
-
},
|
|
397
|
+
}, qe = (e, t, n) => {
|
|
378
398
|
if (t !== n) {
|
|
379
|
-
const s =
|
|
380
|
-
t && !
|
|
399
|
+
const s = D(e);
|
|
400
|
+
t && !S(t, e) && e.entities.draggableMap.get(t)?.events?.onLeave?.(s), n && !S(n, e) && e.entities.draggableMap.get(n)?.events?.onHover?.(s);
|
|
381
401
|
}
|
|
382
|
-
},
|
|
402
|
+
}, We = (e, t) => {
|
|
383
403
|
const n = w(t.droppable);
|
|
384
404
|
if (n && !L(n, e)) {
|
|
385
|
-
const s =
|
|
405
|
+
const s = D(e, n);
|
|
386
406
|
e.entities.droppableMap.get(n)?.events?.onLeave?.(s);
|
|
387
407
|
}
|
|
388
408
|
}, ve = (e, t) => {
|
|
389
409
|
const n = w(t.droppable);
|
|
390
410
|
if (n && !L(n, e)) {
|
|
391
|
-
const s =
|
|
411
|
+
const s = D(e, n);
|
|
392
412
|
e.entities.droppableMap.get(n)?.events?.onLeave?.(s);
|
|
393
413
|
}
|
|
394
|
-
},
|
|
414
|
+
}, je = (e, t) => !e.length || !t.length ? !0 : e.some((n) => t.includes(n)), Je = (e, t, n) => {
|
|
395
415
|
if (!n) return {};
|
|
396
416
|
const s = n.getBoundingClientRect(), i = Math.max(s.left, Math.min(e.x, t.x)), a = Math.max(s.top, Math.min(e.y, t.y)), o = Math.min(s.right, Math.max(e.x, t.x)), r = Math.min(s.bottom, Math.max(e.y, t.y)), l = Math.max(0, o - i), c = Math.max(0, r - a);
|
|
397
417
|
return {
|
|
@@ -404,29 +424,29 @@ const H = (e) => {
|
|
|
404
424
|
border: "1px solid #3b82f6",
|
|
405
425
|
backgroundColor: "#3b82f61a"
|
|
406
426
|
};
|
|
407
|
-
},
|
|
427
|
+
}, Qe = (e) => {
|
|
408
428
|
if (!e.pointer.value || !e.entities.selectingArea) return;
|
|
409
|
-
const { selectingArea: t } = e.entities, n =
|
|
429
|
+
const { selectingArea: t } = e.entities, n = et(
|
|
410
430
|
e.pointer.value.start,
|
|
411
431
|
e.pointer.value.current
|
|
412
432
|
), s = e.entities.selectableAreaMap.get(t)?.groups ?? [];
|
|
413
433
|
e.entities.visibleDraggableSet.forEach((i) => {
|
|
414
434
|
if (!t.contains(i)) return;
|
|
415
|
-
if (
|
|
435
|
+
if (S(i, e)) {
|
|
416
436
|
e.entities.selectedSet.delete(i);
|
|
417
437
|
return;
|
|
418
438
|
}
|
|
419
439
|
const o = e.entities.draggableMap.get(i)?.groups ?? [];
|
|
420
|
-
if (!
|
|
440
|
+
if (!je(s, o)) {
|
|
421
441
|
e.entities.selectedSet.delete(i);
|
|
422
442
|
return;
|
|
423
443
|
}
|
|
424
|
-
|
|
444
|
+
Pe(n, i.getBoundingClientRect()) ? e.entities.selectedSet.add(i) : e.entities.selectedSet.delete(i);
|
|
425
445
|
});
|
|
426
|
-
},
|
|
446
|
+
}, et = (e, t) => {
|
|
427
447
|
const n = Math.min(e.x, t.x), s = Math.min(e.y, t.y), i = Math.max(e.x, t.x), a = Math.max(e.y, t.y), o = i - n, r = a - s;
|
|
428
448
|
return new DOMRect(n, s, o, r);
|
|
429
|
-
},
|
|
449
|
+
}, tt = (e, t, n = 5) => {
|
|
430
450
|
const s = n / 2;
|
|
431
451
|
return {
|
|
432
452
|
left: e - s,
|
|
@@ -434,14 +454,14 @@ const H = (e) => {
|
|
|
434
454
|
width: n,
|
|
435
455
|
height: n
|
|
436
456
|
};
|
|
437
|
-
},
|
|
457
|
+
}, nt = (e) => {
|
|
438
458
|
const t = e.pointer.value?.current, n = t?.x ?? 0, s = t?.y ?? 0;
|
|
439
|
-
return
|
|
440
|
-
},
|
|
459
|
+
return tt(n, s, 5);
|
|
460
|
+
}, F = (e, t, n) => {
|
|
441
461
|
const s = e.left + e.width / 2, i = e.top + e.height / 2;
|
|
442
462
|
if (n) {
|
|
443
|
-
const f = n.top ?? 0, u = n.right ?? 0, d = n.bottom ?? 0, g = n.left ?? 0, y = t.left + g, b = t.right - u,
|
|
444
|
-
if (y < b &&
|
|
463
|
+
const f = n.top ?? 0, u = n.right ?? 0, d = n.bottom ?? 0, g = n.left ?? 0, y = t.left + g, b = t.right - u, p = t.top + f, O = t.bottom - d;
|
|
464
|
+
if (y < b && p < O && s >= y && s <= b && i >= p && i <= O)
|
|
445
465
|
return { top: !1, right: !1, bottom: !1, left: !1, center: !0 };
|
|
446
466
|
}
|
|
447
467
|
const a = i - t.top, o = t.bottom - i, r = s - t.left, l = t.right - s, c = Math.min(a, o, r, l);
|
|
@@ -451,20 +471,20 @@ const H = (e) => {
|
|
|
451
471
|
left: r === c,
|
|
452
472
|
right: l === c
|
|
453
473
|
};
|
|
454
|
-
},
|
|
474
|
+
}, st = (e, t) => e.find((n) => n !== t && B(t, n)), Q = (e, t, n) => {
|
|
455
475
|
const s = w(t.droppable), i = w(t.draggable);
|
|
456
476
|
t.draggable.clear(), t.droppable.clear();
|
|
457
|
-
const a =
|
|
477
|
+
const a = nt(e), o = n.zones[0], r = n.elements[0];
|
|
458
478
|
if (o && r && o === r && e.entities.droppableMap.has(o) && o) {
|
|
459
|
-
const u = o.getBoundingClientRect(), d = e.entities.draggableMap.get(o)?.placementMargins, g =
|
|
479
|
+
const u = o.getBoundingClientRect(), d = e.entities.draggableMap.get(o)?.placementMargins, g = F(a, u, d);
|
|
460
480
|
if (g.center) {
|
|
461
481
|
t.droppable.set(o, g);
|
|
462
|
-
const y =
|
|
482
|
+
const y = st(n.elements, o);
|
|
463
483
|
if (y) {
|
|
464
484
|
const b = y.getBoundingClientRect();
|
|
465
485
|
t.draggable.set(
|
|
466
486
|
y,
|
|
467
|
-
|
|
487
|
+
F(a, b, void 0)
|
|
468
488
|
);
|
|
469
489
|
}
|
|
470
490
|
} else
|
|
@@ -472,19 +492,19 @@ const H = (e) => {
|
|
|
472
492
|
} else {
|
|
473
493
|
if (o) {
|
|
474
494
|
const u = o.getBoundingClientRect();
|
|
475
|
-
t.droppable.set(o,
|
|
495
|
+
t.droppable.set(o, F(a, u));
|
|
476
496
|
}
|
|
477
497
|
if (r) {
|
|
478
498
|
const u = r.getBoundingClientRect(), d = e.entities.draggableMap.get(r)?.placementMargins;
|
|
479
499
|
t.draggable.set(
|
|
480
500
|
r,
|
|
481
|
-
|
|
501
|
+
F(a, u, d)
|
|
482
502
|
);
|
|
483
503
|
}
|
|
484
504
|
}
|
|
485
505
|
const c = w(t.droppable), f = w(t.draggable);
|
|
486
|
-
|
|
487
|
-
},
|
|
506
|
+
Ve(e, s, c), qe(e, i, f);
|
|
507
|
+
}, it = (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, oe = (e) => {
|
|
488
508
|
if (!e)
|
|
489
509
|
return { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 };
|
|
490
510
|
const t = e.getBoundingClientRect();
|
|
@@ -501,7 +521,7 @@ const H = (e) => {
|
|
|
501
521
|
}, re = (e) => ({
|
|
502
522
|
x: e.x + e.width / 2,
|
|
503
523
|
y: e.y + e.height / 2
|
|
504
|
-
}),
|
|
524
|
+
}), at = (e, t) => Math.hypot(t.x - e.x, t.y - e.y), ot = (e, t) => {
|
|
505
525
|
const n = Math.max(
|
|
506
526
|
0,
|
|
507
527
|
Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)
|
|
@@ -510,7 +530,7 @@ const H = (e) => {
|
|
|
510
530
|
Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
|
|
511
531
|
), i = n * s, a = e.width * e.height, o = t.width * t.height;
|
|
512
532
|
return a === 0 || o === 0 ? 0 : (i / a * 100 + i / o * 100) / 2;
|
|
513
|
-
},
|
|
533
|
+
}, rt = (e, t, n) => t >= e.x && t <= e.x + e.width && n >= e.y && n <= e.y + e.height, le = () => !0, ce = () => 0, lt = () => {
|
|
514
534
|
const e = {
|
|
515
535
|
filterElements: le,
|
|
516
536
|
filterZones: le,
|
|
@@ -521,16 +541,16 @@ const H = (e) => {
|
|
|
521
541
|
const y = oe(g);
|
|
522
542
|
if (!c(y, u)) return null;
|
|
523
543
|
let b = 0;
|
|
524
|
-
for (const
|
|
525
|
-
|
|
544
|
+
for (const p of f)
|
|
545
|
+
p !== g && B(p, g) && b++;
|
|
526
546
|
return {
|
|
527
547
|
node: g,
|
|
528
548
|
box: y,
|
|
529
549
|
meta: {
|
|
530
|
-
isPointerInElement:
|
|
531
|
-
overlapPercent:
|
|
550
|
+
isPointerInElement: rt(y, a.x, a.y),
|
|
551
|
+
overlapPercent: ot(y, i),
|
|
532
552
|
depth: b,
|
|
533
|
-
centerDistance:
|
|
553
|
+
centerDistance: at(re(i), re(y))
|
|
534
554
|
}
|
|
535
555
|
};
|
|
536
556
|
}).filter((g) => g !== null);
|
|
@@ -595,7 +615,7 @@ const H = (e) => {
|
|
|
595
615
|
}
|
|
596
616
|
};
|
|
597
617
|
return n;
|
|
598
|
-
},
|
|
618
|
+
}, ct = () => lt(), gt = (e) => e.overlay.ref?.value ?? null, ut = (e) => {
|
|
599
619
|
const t = e.overlay.style?.value ?? { x: 0, y: 0 }, n = e.overlay.size?.value ?? null, { x: s, y: i } = t, a = n?.width ?? 0, o = n?.height ?? 0;
|
|
600
620
|
return {
|
|
601
621
|
x: s,
|
|
@@ -607,9 +627,9 @@ const H = (e) => {
|
|
|
607
627
|
right: s + a,
|
|
608
628
|
bottom: i + o
|
|
609
629
|
};
|
|
610
|
-
},
|
|
630
|
+
}, ft = (e) => e.entities.visibleDraggableSet, dt = (e) => e.entities.visibleDroppableSet, yt = (e, t) => !t.entities.draggingMap.has(e), bt = (e, t) => ![...t.entities.draggingMap.keys()].some(
|
|
611
631
|
(n) => B(n, e)
|
|
612
|
-
),
|
|
632
|
+
), mt = (e, t) => t.entities.draggableMap.has(e) ? !S(e, t) : t.entities.droppableMap.has(e) ? !L(e, t) : !0, ge = (e, t) => yt(e, t) && bt(e, t) && mt(e, t), ht = (e, t) => it(e, t.containerBox), ue = (e, t, n) => {
|
|
613
633
|
if (n.pointer.x >= n.containerBox.x && n.pointer.x <= n.containerBox.x + n.containerBox.width && n.pointer.y >= n.containerBox.y && n.pointer.y <= n.containerBox.y + n.containerBox.height) {
|
|
614
634
|
if (e.meta.isPointerInElement && t.meta.isPointerInElement)
|
|
615
635
|
return t.meta.depth - e.meta.depth;
|
|
@@ -617,12 +637,12 @@ const H = (e) => {
|
|
|
617
637
|
return e.meta.isPointerInElement ? -1 : 1;
|
|
618
638
|
}
|
|
619
639
|
return Math.abs(e.meta.overlapPercent - t.meta.overlapPercent) <= 1 ? e.meta.centerDistance - t.meta.centerDistance : t.meta.overlapPercent - e.meta.overlapPercent;
|
|
620
|
-
}, ee =
|
|
640
|
+
}, ee = ct().container(gt).containerBox(ut).elements(ft).zones(dt).filterElements(ge).filterZones(ge).collision(ht).sortElements(ue).sortZones(ue).build();
|
|
621
641
|
function fe(e) {
|
|
622
642
|
const n = (e.collision?.run ?? ee)(e);
|
|
623
643
|
Q(e, e.hovered, n);
|
|
624
644
|
}
|
|
625
|
-
function
|
|
645
|
+
function Dt(e, t) {
|
|
626
646
|
const n = e.collision?.throttle?.value ?? 0;
|
|
627
647
|
if (n <= 0) {
|
|
628
648
|
fe(e);
|
|
@@ -631,13 +651,10 @@ function ht(e, t) {
|
|
|
631
651
|
const s = Date.now();
|
|
632
652
|
s - t.value >= n && (t.value = s, fe(e));
|
|
633
653
|
}
|
|
634
|
-
async function
|
|
654
|
+
async function Ee(e) {
|
|
635
655
|
const t = e.hovered.droppable.keys().next().value;
|
|
636
656
|
if (!t || L(t, e)) return !0;
|
|
637
|
-
const n = e.entities.droppableMap.get(t), s =
|
|
638
|
-
payload: Ee(e),
|
|
639
|
-
provider: e
|
|
640
|
-
}, i = n?.events?.onDrop?.(s);
|
|
657
|
+
const n = e.entities.droppableMap.get(t), s = D(e, t), i = n?.events?.onDrop?.(s);
|
|
641
658
|
if (i != null && typeof i.then == "function")
|
|
642
659
|
try {
|
|
643
660
|
return await i, !0;
|
|
@@ -647,42 +664,42 @@ async function Me(e) {
|
|
|
647
664
|
}
|
|
648
665
|
return !0;
|
|
649
666
|
}
|
|
650
|
-
function
|
|
667
|
+
function Me(e) {
|
|
651
668
|
const t = e.entities.initiatingDraggable;
|
|
652
|
-
x(e, t, "onSelfDragEnd"), h(e, "onDragEnd"),
|
|
669
|
+
x(e, t, "onSelfDragEnd"), h(e, "onDragEnd"), We(e, e.hovered);
|
|
653
670
|
}
|
|
654
|
-
function
|
|
671
|
+
function pt(e) {
|
|
655
672
|
const t = e.entities.selectingArea;
|
|
656
673
|
if (!t) return;
|
|
657
674
|
const n = e.entities.selectableAreaMap.get(t), s = [...e.entities.selectedSet];
|
|
658
675
|
n?.events?.onSelected?.(s);
|
|
659
676
|
}
|
|
660
|
-
const
|
|
677
|
+
const vt = (e) => {
|
|
661
678
|
const t = {
|
|
662
679
|
current: null
|
|
663
680
|
}, n = { value: 0 }, s = async () => {
|
|
664
681
|
j(), t.current?.cancel(), t.current = null;
|
|
665
682
|
const r = e.state.value;
|
|
666
683
|
if (r === "dragging") {
|
|
667
|
-
if (!await
|
|
668
|
-
|
|
684
|
+
if (!await Ee(e)) {
|
|
685
|
+
G(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i);
|
|
669
686
|
return;
|
|
670
687
|
}
|
|
671
|
-
|
|
672
|
-
} else r === "selecting" &&
|
|
673
|
-
|
|
688
|
+
Me(e);
|
|
689
|
+
} else r === "selecting" && pt(e);
|
|
690
|
+
G(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i);
|
|
674
691
|
}, i = (r) => {
|
|
675
692
|
if (e.pointer.value) {
|
|
676
|
-
if (e.pointer.value.current = { x: r.clientX, y: r.clientY },
|
|
677
|
-
|
|
693
|
+
if (e.pointer.value.current = { x: r.clientX, y: r.clientY }, Ie(e)) {
|
|
694
|
+
$(e, r, "onSelfDragStart"), h(e, "onDragStart");
|
|
678
695
|
return;
|
|
679
696
|
}
|
|
680
697
|
if (e.state.value === "dragging") {
|
|
681
|
-
|
|
698
|
+
Dt(e, n);
|
|
682
699
|
const l = e.entities.initiatingDraggable;
|
|
683
700
|
x(e, l, "onSelfDragMove"), h(e, "onDragMove");
|
|
684
701
|
}
|
|
685
|
-
e.state.value === "selecting" &&
|
|
702
|
+
e.state.value === "selecting" && Qe(e);
|
|
686
703
|
}
|
|
687
704
|
};
|
|
688
705
|
return { pointerDown: (r) => {
|
|
@@ -702,9 +719,9 @@ const pt = (e) => {
|
|
|
702
719
|
return;
|
|
703
720
|
W(), e.entities.initiatingDraggable = f;
|
|
704
721
|
const d = me(r, f);
|
|
705
|
-
e.pointer.value = J(r, d.x, d.y), u?.activation?.distance || u?.activation?.delay ? (e.state.value = "activating", u?.activation?.delay && (e.delay.startTime = Date.now(), t.current =
|
|
706
|
-
|
|
707
|
-
}))) : (
|
|
722
|
+
e.pointer.value = J(r, d.x, d.y), u?.activation?.distance || u?.activation?.delay ? (e.state.value = "activating", u?.activation?.delay && (e.delay.startTime = Date.now(), t.current = Ke(e, () => {
|
|
723
|
+
H(e), $(e, r, "onSelfDragStart"), h(e, "onDragStart");
|
|
724
|
+
}))) : (H(e), $(e, r, "onSelfDragStart"), h(e, "onDragStart"));
|
|
708
725
|
}
|
|
709
726
|
}, pointerUp: s, pointerMove: i, cleanup: () => {
|
|
710
727
|
t.current?.cancel(), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i), e.lib.draggableObserver.disconnect(), e.lib.droppableObserver.disconnect(), e.lib.selectableAreaObserver.disconnect(), e.lib.overlaySizeObserver.disconnect();
|
|
@@ -718,15 +735,15 @@ const pt = (e) => {
|
|
|
718
735
|
KeyA: { dx: -1, dy: 0 },
|
|
719
736
|
KeyS: { dx: 0, dy: 1 },
|
|
720
737
|
KeyD: { dx: 1, dy: 0 }
|
|
721
|
-
},
|
|
738
|
+
}, Mt = (e) => (t) => {
|
|
722
739
|
const { keys: n } = e.keyboard;
|
|
723
740
|
if (n.pressedKeys.value.add(t.code), e.state.value === "dragging") {
|
|
724
741
|
if (n.forCancel.includes(t.code)) {
|
|
725
|
-
t.preventDefault(), j(), x(e, e.entities.initiatingDraggable, "onSelfDragCancel"), h(e, "onDragCancel"), ve(e, e.hovered),
|
|
742
|
+
t.preventDefault(), j(), x(e, e.entities.initiatingDraggable, "onSelfDragCancel"), h(e, "onDragCancel"), ve(e, e.hovered), G(e);
|
|
726
743
|
return;
|
|
727
744
|
}
|
|
728
745
|
if (n.forDrop.includes(t.code)) {
|
|
729
|
-
t.preventDefault(), (async () => (await
|
|
746
|
+
t.preventDefault(), (async () => (await Ee(e) && Me(e), j(), G(e)))();
|
|
730
747
|
return;
|
|
731
748
|
}
|
|
732
749
|
const i = Et[t.code];
|
|
@@ -758,22 +775,22 @@ const pt = (e) => {
|
|
|
758
775
|
};
|
|
759
776
|
e.entities.initiatingDraggable = a;
|
|
760
777
|
const u = me(f, a);
|
|
761
|
-
e.pointer.value = J(f, u.x, u.y),
|
|
778
|
+
e.pointer.value = J(f, u.x, u.y), H(e);
|
|
762
779
|
const g = (e.collision?.run ?? ee)(e);
|
|
763
780
|
Q(e, e.hovered, g), x(e, a, "onSelfDragStart"), h(e, "onDragStart");
|
|
764
781
|
}
|
|
765
|
-
},
|
|
782
|
+
}, St = (e) => (t) => {
|
|
766
783
|
e.keyboard.keys.pressedKeys.value.delete(t.code);
|
|
767
|
-
}, St = (e) => () => {
|
|
768
|
-
e.keyboard.keys.pressedKeys.value.clear();
|
|
769
|
-
}, $ = {
|
|
770
|
-
keyDown: vt,
|
|
771
|
-
keyUp: Mt,
|
|
772
|
-
clear: St
|
|
773
784
|
}, At = (e) => () => {
|
|
785
|
+
e.keyboard.keys.pressedKeys.value.clear();
|
|
786
|
+
}, X = {
|
|
787
|
+
keyDown: Mt,
|
|
788
|
+
keyUp: St,
|
|
789
|
+
clear: At
|
|
790
|
+
}, wt = (e) => () => {
|
|
774
791
|
e.state.value && (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY);
|
|
775
|
-
},
|
|
776
|
-
const t =
|
|
792
|
+
}, xt = (e) => {
|
|
793
|
+
const t = vt(e), n = X.keyDown(e), s = X.keyUp(e), i = X.clear(e), a = wt(e);
|
|
777
794
|
R(() => {
|
|
778
795
|
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", n), document.addEventListener("keyup", s), document.addEventListener("blur", i), document.addEventListener("scroll", a, !0);
|
|
779
796
|
}), P(() => {
|
|
@@ -783,7 +800,7 @@ const pt = (e) => {
|
|
|
783
800
|
const e = de(te);
|
|
784
801
|
if (!e) throw Error("DnD provider not found");
|
|
785
802
|
return e;
|
|
786
|
-
},
|
|
803
|
+
}, Lt = () => {
|
|
787
804
|
const e = U();
|
|
788
805
|
return {
|
|
789
806
|
overlay: e.overlay,
|
|
@@ -797,11 +814,11 @@ const pt = (e) => {
|
|
|
797
814
|
hovered: e.hovered,
|
|
798
815
|
collision: e.collision
|
|
799
816
|
};
|
|
800
|
-
},
|
|
817
|
+
}, Ct = /* @__PURE__ */ ye({
|
|
801
818
|
__name: "DefaultOverlay",
|
|
802
819
|
setup(e) {
|
|
803
|
-
const { entities: t, state: n, overlay: s } =
|
|
804
|
-
return (i, a) => A(n) === "dragging" ? (
|
|
820
|
+
const { entities: t, state: n, overlay: s } = Lt();
|
|
821
|
+
return (i, a) => A(n) === "dragging" ? (v(), K("div", {
|
|
805
822
|
key: 0,
|
|
806
823
|
class: "dnd-kit-default-overlay",
|
|
807
824
|
style: se({
|
|
@@ -809,13 +826,13 @@ const pt = (e) => {
|
|
|
809
826
|
"--position-y": A(s).style.value.y + "px"
|
|
810
827
|
})
|
|
811
828
|
}, [
|
|
812
|
-
(
|
|
813
|
-
A(t).draggableMap.get(o)?.render ? (
|
|
829
|
+
(v(!0), K(Z, null, Ae(A(t).draggingMap, ([o, r]) => (v(), K(Z, null, [
|
|
830
|
+
A(t).draggableMap.get(o)?.render ? (v(), V(q(A(t).draggableMap.get(o)?.render), {
|
|
814
831
|
key: 0,
|
|
815
832
|
class: "test"
|
|
816
|
-
})) : (
|
|
833
|
+
})) : (v(), V(q(o.tagName), {
|
|
817
834
|
key: 1,
|
|
818
|
-
innerHTML: r.
|
|
835
|
+
innerHTML: r.initialOuterHTML,
|
|
819
836
|
class: "test",
|
|
820
837
|
style: se({
|
|
821
838
|
width: r.initialRect.width + "px",
|
|
@@ -823,35 +840,35 @@ const pt = (e) => {
|
|
|
823
840
|
})
|
|
824
841
|
}, null, 8, ["innerHTML", "style"]))
|
|
825
842
|
], 64))), 256))
|
|
826
|
-
], 4)) :
|
|
843
|
+
], 4)) : we("", !0);
|
|
827
844
|
}
|
|
828
|
-
}),
|
|
845
|
+
}), Rt = /* @__PURE__ */ ye({
|
|
829
846
|
__name: "DnDProvider",
|
|
830
847
|
setup(e) {
|
|
831
|
-
const t =
|
|
832
|
-
|
|
848
|
+
const t = xe("overlayRef"), n = Ye(t);
|
|
849
|
+
xt(n);
|
|
833
850
|
const s = E(
|
|
834
|
-
() => n.overlay.render.value ??
|
|
851
|
+
() => n.overlay.render.value ?? Ct
|
|
835
852
|
);
|
|
836
|
-
return
|
|
853
|
+
return Le(te, n), (i, a) => (v(), K(Z, null, [
|
|
837
854
|
ie(i.$slots, "default"),
|
|
838
|
-
|
|
855
|
+
Ce("div", {
|
|
839
856
|
ref_key: "overlayRef",
|
|
840
857
|
ref: t,
|
|
841
858
|
class: "dnd-kit-overlay-container"
|
|
842
859
|
}, [
|
|
843
860
|
ie(i.$slots, "overlay", { overlay: s.value }, () => [
|
|
844
|
-
(
|
|
861
|
+
(v(), V(q(s.value)))
|
|
845
862
|
])
|
|
846
863
|
], 512)
|
|
847
864
|
], 64));
|
|
848
865
|
}
|
|
849
866
|
});
|
|
850
|
-
function
|
|
867
|
+
function Pt(e, t, n) {
|
|
851
868
|
const s = U();
|
|
852
869
|
let i, a, o;
|
|
853
870
|
return typeof t == "function" ? (i = {}, a = t) : (i = t ?? {}, a = n), R(() => {
|
|
854
|
-
o = N(e), o && (o.addEventListener("dragstart", m), o.addEventListener("drag", m), o.addEventListener("dragend", m), o.setAttribute(
|
|
871
|
+
o = N(e), o && (o.addEventListener("dragstart", m), o.addEventListener("drag", m), o.addEventListener("dragend", m), o.setAttribute(M.DRAGGABLE, ""), s.lib.draggableObserver.observe(o), s.entities.draggableMap.set(o, {
|
|
855
872
|
render: i.render,
|
|
856
873
|
disabled: i.disabled ?? !1,
|
|
857
874
|
groups: i.groups ?? [],
|
|
@@ -866,11 +883,11 @@ function Rt(e, t, n) {
|
|
|
866
883
|
o && (s.lib.draggableObserver.unobserve(o), s.entities.visibleDraggableSet.delete(o), s.entities.draggableMap.delete(o), s.entities.modifiersDraggableSet.delete(o));
|
|
867
884
|
}), {};
|
|
868
885
|
}
|
|
869
|
-
const
|
|
886
|
+
const Bt = (e, t) => {
|
|
870
887
|
const n = U(), s = E(() => e.value === n.entities.selectingArea);
|
|
871
888
|
let i = null;
|
|
872
889
|
R(() => {
|
|
873
|
-
i = N(e), i && (i.setAttribute(
|
|
890
|
+
i = N(e), i && (i.setAttribute(M.SELECT_AREA, ""), n.lib.selectableAreaObserver.observe(i), n.entities.selectableAreaMap.set(i, {
|
|
874
891
|
modifier: t?.modifier ?? {
|
|
875
892
|
keys: ["ControlLeft"],
|
|
876
893
|
method: "every"
|
|
@@ -885,19 +902,19 @@ const Pt = (e, t) => {
|
|
|
885
902
|
const a = E(() => {
|
|
886
903
|
n.scrollPosition.x, n.scrollPosition.y;
|
|
887
904
|
const o = n.pointer.value;
|
|
888
|
-
return !o || n.state.value !== "selecting" || !i ? {} :
|
|
905
|
+
return !o || n.state.value !== "selecting" || !i ? {} : Je(o.start, o.current, i);
|
|
889
906
|
});
|
|
890
907
|
return {
|
|
891
908
|
isSelecting: s,
|
|
892
909
|
style: a
|
|
893
910
|
};
|
|
894
911
|
};
|
|
895
|
-
function
|
|
912
|
+
function Ot(e, t) {
|
|
896
913
|
const n = de(te);
|
|
897
914
|
if (!n) throw Error("DnD provider not found");
|
|
898
915
|
let s = null;
|
|
899
916
|
return R(() => {
|
|
900
|
-
s = N(e), s && (s.setAttribute(
|
|
917
|
+
s = N(e), s && (s.setAttribute(M.CONSTRAINT_AREA, ""), n.entities.constraintsAreaMap.set(s, {
|
|
901
918
|
axis: t?.axis || "both",
|
|
902
919
|
restrictToArea: t?.restrictToArea || !1
|
|
903
920
|
}));
|
|
@@ -905,25 +922,25 @@ function Bt(e, t) {
|
|
|
905
922
|
s && n.entities.constraintsAreaMap.delete(s);
|
|
906
923
|
}), {};
|
|
907
924
|
}
|
|
908
|
-
function
|
|
909
|
-
const
|
|
910
|
-
let
|
|
911
|
-
R(() => {
|
|
912
|
-
|
|
913
|
-
disabled:
|
|
914
|
-
groups:
|
|
915
|
-
events:
|
|
925
|
+
function Tt(e, t, n) {
|
|
926
|
+
const s = U();
|
|
927
|
+
let i = null, a, o;
|
|
928
|
+
typeof t == "function" ? (a = {}, o = t) : (a = t ?? {}, o = n), R(() => {
|
|
929
|
+
i = N(e), i && (i.setAttribute(M.DROPPABLE, ""), s.lib.droppableObserver.observe(i), s.entities.droppableMap.set(i, {
|
|
930
|
+
disabled: a.disabled ?? !1,
|
|
931
|
+
groups: a.groups ?? [],
|
|
932
|
+
events: a.events,
|
|
933
|
+
payload: o
|
|
916
934
|
}));
|
|
917
935
|
}), P(() => {
|
|
918
|
-
|
|
936
|
+
i && (s.lib.droppableObserver.unobserve(i), s.entities.visibleDroppableSet.delete(i), s.entities.droppableMap.delete(i));
|
|
919
937
|
});
|
|
920
938
|
}
|
|
921
939
|
export {
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
940
|
+
Rt as DnDProvider,
|
|
941
|
+
Ot as makeConstraintArea,
|
|
942
|
+
Pt as makeDraggable,
|
|
943
|
+
Tt as makeDroppable,
|
|
944
|
+
Bt as makeSelectionArea,
|
|
945
|
+
Lt as useDnDProvider
|
|
928
946
|
};
|
|
929
|
-
//# sourceMappingURL=vue-dnd-kit-core.es.js.map
|