@vue-dnd-kit/core 1.7.0 → 2.0.0-alpha2
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 +5 -305
- package/dist/external/components/DefaultOverlay.vue.d.ts +3 -0
- package/dist/external/components/DefaultOverlay.vue.d.ts.map +1 -0
- package/dist/external/components/DnDProvider.vue.d.ts +25 -0
- package/dist/external/components/DnDProvider.vue.d.ts.map +1 -0
- package/dist/external/composables/makeBoundingBox.d.ts +8 -0
- package/dist/external/composables/makeBoundingBox.d.ts.map +1 -0
- package/dist/external/composables/makeCustomOverlay.d.ts +2 -0
- package/dist/external/composables/makeCustomOverlay.d.ts.map +1 -0
- package/dist/external/composables/makeDraggable.d.ts +17 -0
- package/dist/external/composables/makeDraggable.d.ts.map +1 -0
- package/dist/external/composables/makeDroppable.d.ts +7 -0
- package/dist/external/composables/makeDroppable.d.ts.map +1 -0
- package/dist/external/composables/makeSelectableArea.d.ts +15 -0
- package/dist/external/composables/makeSelectableArea.d.ts.map +1 -0
- package/dist/external/composables/useDnDProvider.d.ts +3 -0
- package/dist/external/composables/useDnDProvider.d.ts.map +1 -0
- package/dist/external/index.d.ts +12 -0
- package/dist/external/index.d.ts.map +1 -0
- package/dist/external/types/entities.d.ts +144 -0
- package/dist/external/types/index.d.ts +4 -0
- package/dist/external/types/placement.d.ts +15 -0
- package/dist/external/types/pointer.d.ts +10 -0
- package/dist/external/types/provider.d.ts +64 -0
- package/dist/index.d.ts +2 -2141
- package/dist/internal/composables/useDnDProviderEvents.d.ts +3 -0
- package/dist/internal/composables/useDnDProviderEvents.d.ts.map +1 -0
- package/dist/internal/composables/useDnDProviderInternal.d.ts +3 -0
- package/dist/internal/composables/useDnDProviderInternal.d.ts.map +1 -0
- package/dist/internal/composables/useDnDProviderState.d.ts +4 -0
- package/dist/internal/composables/useDnDProviderState.d.ts.map +1 -0
- package/dist/internal/composables/useSizeObserver.d.ts +34 -0
- package/dist/internal/composables/useSizeObserver.d.ts.map +1 -0
- package/dist/internal/logic/hover.d.ts +8 -0
- package/dist/internal/logic/hover.d.ts.map +1 -0
- package/dist/internal/logic/keyboard.d.ts +7 -0
- package/dist/internal/logic/keyboard.d.ts.map +1 -0
- package/dist/internal/logic/payload.d.ts +8 -0
- package/dist/internal/logic/payload.d.ts.map +1 -0
- package/dist/internal/logic/pointer.d.ts +10 -0
- package/dist/internal/logic/pointer.d.ts.map +1 -0
- package/dist/internal/logic/scroll.d.ts +3 -0
- package/dist/internal/logic/scroll.d.ts.map +1 -0
- package/dist/internal/sensors/defaultCollision.d.ts +8 -0
- package/dist/internal/sensors/defaultCollision.d.ts.map +1 -0
- package/dist/internal/sensors/index.d.ts +3 -0
- package/dist/internal/sensors/index.d.ts.map +1 -0
- package/dist/internal/sensors/sensor.d.ts +53 -0
- package/dist/internal/sensors/sensor.d.ts.map +1 -0
- package/dist/internal/sensors/steps.d.ts +27 -0
- package/dist/internal/sensors/steps.d.ts.map +1 -0
- package/dist/internal/types/observer.d.ts +11 -0
- package/dist/internal/types/provider.d.ts +29 -0
- package/dist/internal/utils/constraints.d.ts +41 -0
- package/dist/internal/utils/constraints.d.ts.map +1 -0
- package/dist/internal/utils/disabled.d.ts +10 -0
- package/dist/internal/utils/disabled.d.ts.map +1 -0
- package/dist/internal/utils/dom.d.ts +45 -0
- package/dist/internal/utils/dom.d.ts.map +1 -0
- package/dist/internal/utils/drag-activation.d.ts +30 -0
- package/dist/internal/utils/drag-activation.d.ts.map +1 -0
- package/dist/internal/utils/events.d.ts +22 -0
- package/dist/internal/utils/events.d.ts.map +1 -0
- package/dist/internal/utils/geometry.d.ts +24 -0
- package/dist/internal/utils/geometry.d.ts.map +1 -0
- package/dist/internal/utils/groups.d.ts +9 -0
- package/dist/internal/utils/groups.d.ts.map +1 -0
- package/dist/internal/utils/keyboard.d.ts +6 -0
- package/dist/internal/utils/keyboard.d.ts.map +1 -0
- package/dist/internal/utils/namespaces.d.ts +19 -0
- package/dist/internal/utils/namespaces.d.ts.map +1 -0
- package/dist/internal/utils/observer.d.ts +28 -0
- package/dist/internal/utils/observer.d.ts.map +1 -0
- package/dist/internal/utils/placement.d.ts +29 -0
- package/dist/internal/utils/placement.d.ts.map +1 -0
- package/dist/internal/utils/pointer.d.ts +34 -0
- package/dist/internal/utils/pointer.d.ts.map +1 -0
- package/dist/internal/utils/provider.d.ts +13 -0
- package/dist/internal/utils/provider.d.ts.map +1 -0
- package/dist/internal/utils/selection.d.ts +28 -0
- package/dist/internal/utils/selection.d.ts.map +1 -0
- package/dist/internal/utils/session.d.ts +6 -0
- package/dist/internal/utils/session.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/dist/vue-dnd-kit-core.cjs.js +2 -1
- package/dist/vue-dnd-kit-core.cjs.js.map +1 -1
- package/dist/vue-dnd-kit-core.es.js +886 -857
- package/dist/vue-dnd-kit-core.es.js.map +1 -1
- package/package.json +78 -73
- package/LICENSE +0 -21
|
@@ -1,900 +1,929 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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;right:0;height:100svh;overflow:auto}.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 F, watch as Ae, 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 p, createElementBlock as K, normalizeStyle as se, Fragment as X, renderList as we, createBlock as V, resolveDynamicComponent as q, createCommentVNode as xe, useTemplateRef as Le, provide as Ce, renderSlot as ie, createElementVNode as ke } from "vue";
|
|
3
|
+
const v = {
|
|
4
|
+
SELECT_AREA: "data-dnd-kit-select-area",
|
|
5
|
+
DRAGGABLE: "data-dnd-kit-draggable",
|
|
6
|
+
DROPPABLE: "data-dnd-kit-droppable",
|
|
7
|
+
CONSTRAINT_AREA: "data-dnd-kit-constraint-area"
|
|
8
|
+
}, k = {
|
|
9
|
+
SELECT_AREA: `[${v.SELECT_AREA}]`,
|
|
10
|
+
DRAGGABLE: `[${v.DRAGGABLE}]`,
|
|
11
|
+
CONSTRAINT_AREA: `[${v.CONSTRAINT_AREA}]`
|
|
12
|
+
}, te = "VueDnDKitProvider", ae = (e, t, n, s) => {
|
|
13
|
+
const i = /* @__PURE__ */ new Set();
|
|
14
|
+
return t.forEach((a) => {
|
|
15
|
+
const o = e.get(a), r = s ? s(a) : o?.disabled;
|
|
16
|
+
if (!o || r) return;
|
|
17
|
+
const l = o.modifier?.keys, c = o.modifier?.method;
|
|
18
|
+
if (!l || !c || l.length === 0) {
|
|
19
|
+
i.add(a);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
l[c]((u) => n.value.has(u)) && i.add(a);
|
|
23
|
+
}), i;
|
|
7
24
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const s
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const s
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var l, s, o, g, i, c, d;
|
|
31
|
-
const t = e.hovered.element.value, a = e.hovered.zone.value;
|
|
32
|
-
if (t) {
|
|
33
|
-
const f = (s = (l = e.elementsMap.value.get(t)) == null ? void 0 : l.data) == null ? void 0 : s.source, r = (g = (o = e.elementsMap.value.get(t)) == null ? void 0 : o.data) == null ? void 0 : g.index, v = e.draggingElements.value.values().next().value, u = (i = v == null ? void 0 : v.data) == null ? void 0 : i.index, m = u !== void 0 && r !== void 0 && u > r ? 1 : -1;
|
|
34
|
-
Array.from(
|
|
35
|
-
e.draggingElements.value.values()
|
|
36
|
-
).sort(
|
|
37
|
-
(h, L) => {
|
|
38
|
-
var b, z;
|
|
39
|
-
return m * ((((b = h.data) == null ? void 0 : b.index) || 0) - (((z = L.data) == null ? void 0 : z.index) || 0));
|
|
40
|
-
}
|
|
41
|
-
).forEach(
|
|
42
|
-
(h) => {
|
|
43
|
-
var L, b;
|
|
44
|
-
return M.move(
|
|
45
|
-
(L = h.data) == null ? void 0 : L.source,
|
|
46
|
-
(b = h.data) == null ? void 0 : b.index,
|
|
47
|
-
f,
|
|
48
|
-
r
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
} else if (a) {
|
|
53
|
-
const f = (d = (c = e.zonesMap.value.get(a)) == null ? void 0 : c.data) == null ? void 0 : d.source, r = f == null ? void 0 : f.length;
|
|
54
|
-
Array.from(
|
|
55
|
-
e.draggingElements.value.values()
|
|
56
|
-
).sort((u, m) => {
|
|
57
|
-
var p, h;
|
|
58
|
-
return (((p = m.data) == null ? void 0 : p.index) || 0) - (((h = u.data) == null ? void 0 : h.index) || 0);
|
|
59
|
-
}).forEach(
|
|
60
|
-
(u) => {
|
|
61
|
-
var m, p;
|
|
62
|
-
return M.move(
|
|
63
|
-
(m = u.data) == null ? void 0 : m.source,
|
|
64
|
-
(p = u.data) == null ? void 0 : p.index,
|
|
65
|
-
f,
|
|
66
|
-
r
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}), V(M, "applyCopy", (e) => {
|
|
72
|
-
var l, s, o, g, i, c;
|
|
73
|
-
const t = e.hovered.element.value, a = e.hovered.zone.value;
|
|
74
|
-
if (t) {
|
|
75
|
-
const d = (s = (l = e.elementsMap.value.get(t)) == null ? void 0 : l.data) == null ? void 0 : s.source, f = (g = (o = e.elementsMap.value.get(t)) == null ? void 0 : o.data) == null ? void 0 : g.index;
|
|
76
|
-
Array.from(
|
|
77
|
-
e.draggingElements.value.values()
|
|
78
|
-
).sort((v, u) => {
|
|
79
|
-
var m, p;
|
|
80
|
-
return (((m = u.data) == null ? void 0 : m.index) || 0) - (((p = v.data) == null ? void 0 : p.index) || 0);
|
|
81
|
-
}).forEach(
|
|
82
|
-
(v) => {
|
|
83
|
-
var u, m;
|
|
84
|
-
return M.copy(
|
|
85
|
-
(u = v.data) == null ? void 0 : u.source,
|
|
86
|
-
(m = v.data) == null ? void 0 : m.index,
|
|
87
|
-
d,
|
|
88
|
-
f
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
} else if (a) {
|
|
93
|
-
const d = (c = (i = e.zonesMap.value.get(a)) == null ? void 0 : i.data) == null ? void 0 : c.source, f = d == null ? void 0 : d.length;
|
|
94
|
-
Array.from(
|
|
95
|
-
e.draggingElements.value.values()
|
|
96
|
-
).sort((v, u) => {
|
|
97
|
-
var m, p;
|
|
98
|
-
return (((m = u.data) == null ? void 0 : m.index) || 0) - (((p = v.data) == null ? void 0 : p.index) || 0);
|
|
99
|
-
}).forEach(
|
|
100
|
-
(v) => {
|
|
101
|
-
var u, m;
|
|
102
|
-
return M.copy(
|
|
103
|
-
(u = v.data) == null ? void 0 : u.source,
|
|
104
|
-
(m = v.data) == null ? void 0 : m.index,
|
|
105
|
-
d,
|
|
106
|
-
f
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
}), V(M, "applySwap", (e) => {
|
|
112
|
-
var l, s, o, g, i, c, d, f;
|
|
113
|
-
const t = e.hovered.element.value, a = e.hovered.zone.value;
|
|
114
|
-
if (t && e.draggingElements.value.size === 1) {
|
|
115
|
-
const r = e.draggingElements.value.values().next().value;
|
|
116
|
-
M.swap(
|
|
117
|
-
(l = r == null ? void 0 : r.data) == null ? void 0 : l.source,
|
|
118
|
-
(s = r == null ? void 0 : r.data) == null ? void 0 : s.index,
|
|
119
|
-
(g = (o = e.elementsMap.value.get(t)) == null ? void 0 : o.data) == null ? void 0 : g.source,
|
|
120
|
-
(c = (i = e.elementsMap.value.get(t)) == null ? void 0 : i.data) == null ? void 0 : c.index
|
|
121
|
-
);
|
|
122
|
-
} else if (a) {
|
|
123
|
-
const r = (f = (d = e.zonesMap.value.get(a)) == null ? void 0 : d.data) == null ? void 0 : f.source, v = r == null ? void 0 : r.length;
|
|
124
|
-
Array.from(
|
|
125
|
-
e.draggingElements.value.values()
|
|
126
|
-
).sort((m, p) => {
|
|
127
|
-
var h, L;
|
|
128
|
-
return (((h = p.data) == null ? void 0 : h.index) || 0) - (((L = m.data) == null ? void 0 : L.index) || 0);
|
|
129
|
-
}).forEach(
|
|
130
|
-
(m) => {
|
|
131
|
-
var p, h;
|
|
132
|
-
return M.move(
|
|
133
|
-
(p = m.data) == null ? void 0 : p.source,
|
|
134
|
-
(h = m.data) == null ? void 0 : h.index,
|
|
135
|
-
r,
|
|
136
|
-
v
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
}), V(M, "applyRemove", (e) => {
|
|
142
|
-
Array.from(
|
|
143
|
-
e.draggingElements.value.values()
|
|
144
|
-
).sort((a, l) => {
|
|
145
|
-
var s, o;
|
|
146
|
-
return (((s = l.data) == null ? void 0 : s.index) || 0) - (((o = a.data) == null ? void 0 : o.index) || 0);
|
|
147
|
-
}).forEach((a) => {
|
|
148
|
-
var l, s;
|
|
149
|
-
(l = a.data) != null && l.source && ((s = a.data) == null ? void 0 : s.index) !== void 0 && M.remove(a.data.source, a.data.index);
|
|
150
|
-
});
|
|
151
|
-
}), V(M, "applyInsert", (e, t) => {
|
|
152
|
-
var s, o, g, i, c, d;
|
|
153
|
-
const a = e.hovered.element.value, l = e.hovered.zone.value;
|
|
154
|
-
if (a && t.length > 0) {
|
|
155
|
-
const f = (o = (s = e.elementsMap.value.get(a)) == null ? void 0 : s.data) == null ? void 0 : o.source, r = (i = (g = e.elementsMap.value.get(a)) == null ? void 0 : g.data) == null ? void 0 : i.index;
|
|
156
|
-
t.forEach((v) => {
|
|
157
|
-
M.insert(f, r, v);
|
|
158
|
-
});
|
|
159
|
-
} else if (l) {
|
|
160
|
-
const f = (d = (c = e.zonesMap.value.get(l)) == null ? void 0 : c.data) == null ? void 0 : d.source, r = f == null ? void 0 : f.length;
|
|
161
|
-
t.forEach((v) => {
|
|
162
|
-
M.insert(f, r, v);
|
|
25
|
+
let be = "", Re = "", Pe = "";
|
|
26
|
+
const N = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, B = (e, t) => e !== t && e.contains(t), Be = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), W = () => {
|
|
27
|
+
const e = document.body;
|
|
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
|
+
}, j = () => {
|
|
30
|
+
const e = document.body;
|
|
31
|
+
e.style.userSelect = be, e.style.touchAction = Re, e.style.overscrollBehavior = Pe, window.removeEventListener("contextmenu", m), window.removeEventListener("selectstart", m), window.removeEventListener("touchstart", m), window.removeEventListener("touchmove", m);
|
|
32
|
+
}, m = (e) => e.preventDefault(), M = (e, t) => {
|
|
33
|
+
if (t.entities.draggableMap.get(e)?.disabled) return !0;
|
|
34
|
+
for (const [s, i] of t.entities.draggableMap)
|
|
35
|
+
if (i.disabled && B(s, e)) return !0;
|
|
36
|
+
return !1;
|
|
37
|
+
}, L = (e, t) => {
|
|
38
|
+
if (t.entities.droppableMap.get(e)?.disabled) return !0;
|
|
39
|
+
for (const [s, i] of t.entities.droppableMap)
|
|
40
|
+
if (i.disabled && B(s, e)) return !0;
|
|
41
|
+
return !1;
|
|
42
|
+
}, Y = (e) => {
|
|
43
|
+
const t = new IntersectionObserver((n) => {
|
|
44
|
+
n.forEach((s) => {
|
|
45
|
+
const i = s.target;
|
|
46
|
+
e[s.isIntersecting ? "add" : "delete"](i);
|
|
163
47
|
});
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
observe: (n) => t.observe(n),
|
|
51
|
+
unobserve: (n) => t.unobserve(n),
|
|
52
|
+
disconnect: () => t.disconnect()
|
|
53
|
+
};
|
|
54
|
+
}, Oe = (e) => {
|
|
55
|
+
const t = new ResizeObserver((n) => {
|
|
56
|
+
const s = n[0];
|
|
57
|
+
if (!s) return;
|
|
58
|
+
const { width: i, height: a } = s.contentRect;
|
|
59
|
+
e.value = { width: i, height: a };
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
observe: (n) => t.observe(n),
|
|
63
|
+
unobserve: (n) => t.unobserve(n),
|
|
64
|
+
disconnect: () => t.disconnect()
|
|
65
|
+
};
|
|
66
|
+
}, Te = (e) => {
|
|
67
|
+
const t = F(null), n = Oe(t), s = Ae(
|
|
68
|
+
e,
|
|
69
|
+
(a) => {
|
|
70
|
+
n.disconnect(), a && n.observe(a);
|
|
71
|
+
},
|
|
72
|
+
{ immediate: !0 }
|
|
73
|
+
);
|
|
74
|
+
return { overlaySize: t, overlaySizeObserver: {
|
|
75
|
+
disconnect: () => {
|
|
76
|
+
s(), n.disconnect();
|
|
77
|
+
}
|
|
78
|
+
} };
|
|
79
|
+
};
|
|
80
|
+
function J(e, t = 0, n = 0) {
|
|
81
|
+
return {
|
|
82
|
+
start: { x: e.clientX, y: e.clientY },
|
|
83
|
+
current: { x: e.clientX, y: e.clientY },
|
|
84
|
+
offset: { x: t, y: n }
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function me(e, t) {
|
|
88
|
+
const n = t.getBoundingClientRect(), s = n.width > 0 ? (e.clientX - n.left) / n.width : 0.5, i = n.height > 0 ? (e.clientY - n.top) / n.height : 0.5;
|
|
89
|
+
return { x: s, y: i };
|
|
90
|
+
}
|
|
91
|
+
function he(e, t) {
|
|
92
|
+
return {
|
|
93
|
+
...t,
|
|
94
|
+
initialHTML: e.innerHTML,
|
|
95
|
+
initialRect: e.getBoundingClientRect()
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function ze(e, t, n) {
|
|
99
|
+
e.forEach((s) => {
|
|
100
|
+
const i = t.get(s);
|
|
101
|
+
n.set(s, he(s, i));
|
|
102
|
+
}), e.clear();
|
|
103
|
+
}
|
|
104
|
+
function _e(e, t, n) {
|
|
105
|
+
n.clear();
|
|
106
|
+
const s = t.get(e);
|
|
107
|
+
n.set(e, he(e, s));
|
|
108
|
+
}
|
|
109
|
+
function G(e) {
|
|
110
|
+
e.entities.initiatingDraggable && (e.state.value = "dragging", Ie(
|
|
111
|
+
e.entities.initiatingDraggable,
|
|
112
|
+
e.entities.selectedSet,
|
|
113
|
+
e.entities.draggableMap,
|
|
114
|
+
e.entities.draggingMap
|
|
115
|
+
));
|
|
116
|
+
}
|
|
117
|
+
function Ie(e, t, n, s) {
|
|
118
|
+
t.has(e) ? ze(t, n, s) : (t.clear(), _e(e, n, s));
|
|
119
|
+
}
|
|
120
|
+
function De(e, t, n, s) {
|
|
121
|
+
if (s || !n) return !0;
|
|
122
|
+
const i = e.closest(n);
|
|
123
|
+
return i ? t.contains(i) : !1;
|
|
124
|
+
}
|
|
125
|
+
function Fe(e, t) {
|
|
126
|
+
if (!e || !t) return 1;
|
|
127
|
+
const n = Math.abs(e.current.x - e.start.x), s = Math.abs(e.current.y - e.start.y);
|
|
128
|
+
if (typeof t == "number") {
|
|
129
|
+
const c = Math.sqrt(n * n + s * s);
|
|
130
|
+
return Math.min(c / t, 1);
|
|
164
131
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
132
|
+
const {
|
|
133
|
+
x: i = 0,
|
|
134
|
+
y: a = 0,
|
|
135
|
+
condition: o = "any"
|
|
136
|
+
} = t;
|
|
137
|
+
if (i === 0 && a === 0) return 1;
|
|
138
|
+
const r = i > 0 ? Math.min(n / i, 1) : 1, l = a > 0 ? Math.min(s / a, 1) : 1;
|
|
139
|
+
return o === "both" ? Math.min(r, l) : Math.max(r, l);
|
|
140
|
+
}
|
|
141
|
+
function pe(e, t, n) {
|
|
142
|
+
if (!n) return !0;
|
|
143
|
+
const s = n.distance != null, i = n.delay != null;
|
|
144
|
+
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
|
+
function Ke(e) {
|
|
147
|
+
if (e.state.value !== "activating" || !e.entities.initiatingDraggable)
|
|
148
|
+
return !1;
|
|
149
|
+
const t = e.entities.draggableMap.get(
|
|
150
|
+
e.entities.initiatingDraggable
|
|
151
|
+
);
|
|
152
|
+
return pe(
|
|
153
|
+
e.distanceProgress.value,
|
|
154
|
+
e.delay.progress,
|
|
155
|
+
t?.activation
|
|
156
|
+
) ? (G(e), !0) : !1;
|
|
157
|
+
}
|
|
158
|
+
function Ge(e, t) {
|
|
159
|
+
let n = null;
|
|
160
|
+
const s = () => {
|
|
161
|
+
if (e.state.value !== "activating" || !e.entities.initiatingDraggable) {
|
|
162
|
+
n = null;
|
|
163
|
+
return;
|
|
179
164
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
(
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
offset: {
|
|
200
|
-
percent: C(null),
|
|
201
|
-
pixel: C(null)
|
|
165
|
+
const i = e.entities.draggableMap.get(
|
|
166
|
+
e.entities.initiatingDraggable
|
|
167
|
+
), a = i?.activation?.delay;
|
|
168
|
+
if (!a) {
|
|
169
|
+
n = null;
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
e.delay.progress = Math.min(
|
|
173
|
+
(Date.now() - e.delay.startTime) / (a * 1e3),
|
|
174
|
+
1
|
|
175
|
+
), pe(
|
|
176
|
+
e.distanceProgress.value,
|
|
177
|
+
e.delay.progress,
|
|
178
|
+
i?.activation
|
|
179
|
+
) ? (t(), n = null) : n = requestAnimationFrame(s);
|
|
180
|
+
};
|
|
181
|
+
return n = requestAnimationFrame(s), {
|
|
182
|
+
cancel: () => {
|
|
183
|
+
n !== null && (cancelAnimationFrame(n), n = null);
|
|
202
184
|
}
|
|
203
|
-
}, { KeyW: m, KeyS: p, KeyA: h, KeyD: L, ctrl: b, shift: z, alt: B, meta: D } = Ie(), w = {
|
|
204
|
-
zone: C(null),
|
|
205
|
-
element: C(null)
|
|
206
185
|
};
|
|
186
|
+
}
|
|
187
|
+
function He(e, t) {
|
|
188
|
+
const n = e.closest(
|
|
189
|
+
k.CONSTRAINT_AREA
|
|
190
|
+
);
|
|
191
|
+
return !n || !t.has(n) ? null : {
|
|
192
|
+
element: n,
|
|
193
|
+
entity: t.get(n)
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function Ne(e, t, n, s) {
|
|
197
|
+
return n === "x" ? { x: e, y: s.top } : n === "y" ? { x: s.left, y: t } : { x: e, y: t };
|
|
198
|
+
}
|
|
199
|
+
function Ue(e, t, n, s, i) {
|
|
200
|
+
let a = e, o = t;
|
|
201
|
+
return n !== "y" && (a = Math.max(
|
|
202
|
+
s.left,
|
|
203
|
+
Math.min(s.right - i.width, e)
|
|
204
|
+
)), n !== "x" && (o = Math.max(
|
|
205
|
+
s.top,
|
|
206
|
+
Math.min(s.bottom - i.height, t)
|
|
207
|
+
)), { x: a, y: o };
|
|
208
|
+
}
|
|
209
|
+
function Ye(e, t, n, s, i) {
|
|
210
|
+
if (!e || !t)
|
|
211
|
+
return { x: 0, y: 0 };
|
|
212
|
+
const a = t.getBoundingClientRect(), o = a.width || i?.width || 0, r = a.height || i?.height || 0;
|
|
213
|
+
let l = e.current.x - o * e.offset.x, c = e.current.y - r * e.offset.y;
|
|
214
|
+
if (!n)
|
|
215
|
+
return { x: l, y: c };
|
|
216
|
+
const f = He(n, s);
|
|
217
|
+
if (!f)
|
|
218
|
+
return { x: l, y: c };
|
|
219
|
+
const { element: u, entity: d } = f, g = u.getBoundingClientRect(), y = n.getBoundingClientRect(), b = Ne(
|
|
220
|
+
l,
|
|
221
|
+
c,
|
|
222
|
+
d.axis || "both",
|
|
223
|
+
y
|
|
224
|
+
);
|
|
225
|
+
return d.restrictToArea ? Ue(
|
|
226
|
+
b.x,
|
|
227
|
+
b.y,
|
|
228
|
+
d.axis || "both",
|
|
229
|
+
g,
|
|
230
|
+
a
|
|
231
|
+
) : b;
|
|
232
|
+
}
|
|
233
|
+
const C = {
|
|
234
|
+
forDrag: ["Enter", "Space"],
|
|
235
|
+
forCancel: ["Escape"],
|
|
236
|
+
forDrop: ["Enter", "Space"],
|
|
237
|
+
forMove: [
|
|
238
|
+
"ArrowUp",
|
|
239
|
+
"ArrowDown",
|
|
240
|
+
"ArrowLeft",
|
|
241
|
+
"ArrowRight",
|
|
242
|
+
"KeyW",
|
|
243
|
+
"KeyA",
|
|
244
|
+
"KeyS",
|
|
245
|
+
"KeyD"
|
|
246
|
+
],
|
|
247
|
+
forMoveFaster: ["ShiftLeft", "ShiftRight"]
|
|
248
|
+
};
|
|
249
|
+
function Ze(e) {
|
|
250
|
+
const t = ne(), n = F(), i = {
|
|
251
|
+
keys: {
|
|
252
|
+
pressedKeys: F(/* @__PURE__ */ new Set()),
|
|
253
|
+
forDrag: [...C.forDrag],
|
|
254
|
+
forCancel: [...C.forCancel],
|
|
255
|
+
forDrop: [...C.forDrop],
|
|
256
|
+
forMove: [...C.forMove],
|
|
257
|
+
forMoveFaster: [...C.forMoveFaster]
|
|
258
|
+
},
|
|
259
|
+
step: 8,
|
|
260
|
+
moveFaster: 4
|
|
261
|
+
}, a = _({
|
|
262
|
+
draggableMap: /* @__PURE__ */ new Map(),
|
|
263
|
+
droppableMap: /* @__PURE__ */ new Map(),
|
|
264
|
+
selectableAreaMap: /* @__PURE__ */ new Map(),
|
|
265
|
+
constraintsAreaMap: /* @__PURE__ */ new Map(),
|
|
266
|
+
initiatingDraggable: void 0,
|
|
267
|
+
selectingArea: void 0,
|
|
268
|
+
draggingMap: /* @__PURE__ */ new Map(),
|
|
269
|
+
selectedSet: /* @__PURE__ */ new Set(),
|
|
270
|
+
modifiersSelectableAreaSet: E(() => ae(
|
|
271
|
+
a.selectableAreaMap,
|
|
272
|
+
a.visibleSelectableAreaSet,
|
|
273
|
+
i.keys.pressedKeys
|
|
274
|
+
)),
|
|
275
|
+
modifiersDraggableSet: E(() => ae(
|
|
276
|
+
a.draggableMap,
|
|
277
|
+
a.visibleDraggableSet,
|
|
278
|
+
i.keys.pressedKeys,
|
|
279
|
+
(z) => M(z, { entities: a })
|
|
280
|
+
)),
|
|
281
|
+
visibleDraggableSet: /* @__PURE__ */ new Set(),
|
|
282
|
+
visibleDroppableSet: /* @__PURE__ */ new Set(),
|
|
283
|
+
visibleSelectableAreaSet: /* @__PURE__ */ new Set()
|
|
284
|
+
}), o = _({
|
|
285
|
+
x: window.scrollX,
|
|
286
|
+
y: window.scrollY
|
|
287
|
+
}), r = _({
|
|
288
|
+
progress: 0,
|
|
289
|
+
startTime: 0
|
|
290
|
+
}), l = E(() => {
|
|
291
|
+
if (!n.value || !a.initiatingDraggable) return 0;
|
|
292
|
+
const z = a.draggableMap.get(a.initiatingDraggable)?.activation?.distance;
|
|
293
|
+
return z ? Fe(n.value, z) : 1;
|
|
294
|
+
}), c = Y(
|
|
295
|
+
a.visibleDraggableSet
|
|
296
|
+
), f = Y(
|
|
297
|
+
a.visibleDroppableSet
|
|
298
|
+
), u = Y(
|
|
299
|
+
a.visibleSelectableAreaSet
|
|
300
|
+
), { overlaySize: d, overlaySizeObserver: g } = Te(e), y = F(), b = _({
|
|
301
|
+
draggable: /* @__PURE__ */ new Map(),
|
|
302
|
+
droppable: /* @__PURE__ */ new Map()
|
|
303
|
+
}), D = {
|
|
304
|
+
throttle: ne(0)
|
|
305
|
+
}, O = E(() => {
|
|
306
|
+
o.y, o.x;
|
|
307
|
+
const T = a.initiatingDraggable;
|
|
308
|
+
return Ye(
|
|
309
|
+
n.value,
|
|
310
|
+
e.value,
|
|
311
|
+
T || null,
|
|
312
|
+
a.constraintsAreaMap,
|
|
313
|
+
d.value
|
|
314
|
+
);
|
|
315
|
+
});
|
|
207
316
|
return {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
ctrl: b,
|
|
223
|
-
shift: z,
|
|
224
|
-
alt: B,
|
|
225
|
-
meta: D
|
|
317
|
+
state: t,
|
|
318
|
+
pointer: n,
|
|
319
|
+
entities: a,
|
|
320
|
+
keyboard: i,
|
|
321
|
+
scrollPosition: o,
|
|
322
|
+
delay: r,
|
|
323
|
+
distanceProgress: l,
|
|
324
|
+
hovered: b,
|
|
325
|
+
collision: D,
|
|
326
|
+
overlay: {
|
|
327
|
+
size: d,
|
|
328
|
+
style: O,
|
|
329
|
+
render: y,
|
|
330
|
+
ref: e
|
|
226
331
|
},
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
332
|
+
lib: {
|
|
333
|
+
draggableObserver: c,
|
|
334
|
+
droppableObserver: f,
|
|
335
|
+
selectableAreaObserver: u,
|
|
336
|
+
overlaySizeObserver: g
|
|
337
|
+
}
|
|
231
338
|
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
339
|
+
}
|
|
340
|
+
const H = (e) => {
|
|
341
|
+
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
|
+
}, Ee = (e) => {
|
|
343
|
+
const t = e.entities.initiatingDraggable;
|
|
344
|
+
if (!t) return;
|
|
345
|
+
const s = e.entities.draggableMap.get(t)?.payload;
|
|
346
|
+
if (!s) return;
|
|
347
|
+
const i = s();
|
|
348
|
+
if (!Array.isArray(i) || i.length < 2) return;
|
|
349
|
+
const [a, o, r] = i;
|
|
350
|
+
return {
|
|
351
|
+
index: Number(a),
|
|
352
|
+
items: Array.isArray(o) ? o : [],
|
|
353
|
+
dropData: r
|
|
244
354
|
};
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
ref: e,
|
|
267
|
-
style: re(s.value)
|
|
268
|
-
}, [
|
|
269
|
-
(X(!0), j(ae, null, we(P(l), ([i, c]) => {
|
|
270
|
-
var d, f;
|
|
271
|
-
return X(), j(ae, {
|
|
272
|
-
key: c.id
|
|
273
|
-
}, [
|
|
274
|
-
c.layer ? (X(), J(ee(c.layer), {
|
|
275
|
-
key: 0,
|
|
276
|
-
node: i,
|
|
277
|
-
data: c.data,
|
|
278
|
-
id: c.id,
|
|
279
|
-
groups: c.groups
|
|
280
|
-
}, null, 8, ["node", "data", "id", "groups"])) : (X(), j("div", {
|
|
281
|
-
key: 1,
|
|
282
|
-
innerHTML: c.initialHTML,
|
|
283
|
-
style: re({
|
|
284
|
-
width: `${(d = c.initialRect) == null ? void 0 : d.width}px`,
|
|
285
|
-
height: `${(f = c.initialRect) == null ? void 0 : f.height}px`
|
|
286
|
-
})
|
|
287
|
-
}, null, 12, Se))
|
|
288
|
-
], 64);
|
|
289
|
-
}), 128))
|
|
290
|
-
], 4)) : Ee("", !0);
|
|
355
|
+
}, w = (e) => e.keys().next().value, $e = (e) => e.target.closest(k.DRAGGABLE), S = (e) => ({
|
|
356
|
+
payload: Ee(e),
|
|
357
|
+
provider: e
|
|
358
|
+
}), Z = (e, t, n) => {
|
|
359
|
+
const s = $e(t);
|
|
360
|
+
if (!s || !e.entities.draggingMap.has(s)) return;
|
|
361
|
+
const i = S(e);
|
|
362
|
+
e.entities.draggingMap.get(s)?.events?.[n]?.(i);
|
|
363
|
+
}, x = (e, t, n) => {
|
|
364
|
+
if (!t || M(t, e)) return;
|
|
365
|
+
const s = S(e);
|
|
366
|
+
e.entities.draggableMap.get(t)?.events?.[n]?.(s);
|
|
367
|
+
}, h = (e, t) => {
|
|
368
|
+
const n = S(e);
|
|
369
|
+
e.entities.draggableMap.forEach((s, i) => {
|
|
370
|
+
M(i, e) || s.events?.[t]?.(n);
|
|
371
|
+
});
|
|
372
|
+
}, Xe = (e, t, n) => {
|
|
373
|
+
if (t !== n) {
|
|
374
|
+
const s = S(e);
|
|
375
|
+
t && !L(t, e) && e.entities.droppableMap.get(t)?.events?.onLeave?.(s), n && !L(n, e) && e.entities.droppableMap.get(n)?.events?.onEnter?.(s);
|
|
291
376
|
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
},
|
|
297
|
-
setup(n) {
|
|
298
|
-
const e = n, { activeContainer: t } = Y(), a = O(() => ({
|
|
299
|
-
component: t.component.value ?? De,
|
|
300
|
-
props: {
|
|
301
|
-
...e,
|
|
302
|
-
...t.props.value
|
|
303
|
-
}
|
|
304
|
-
}));
|
|
305
|
-
return (l, s) => P(t).options.value ? (X(), J(Pe, {
|
|
306
|
-
key: 0,
|
|
307
|
-
name: P(t).options.value.name,
|
|
308
|
-
duration: P(t).options.value.duration,
|
|
309
|
-
"enter-from-class": P(t).options.value.enterFromClass,
|
|
310
|
-
"enter-to-class": P(t).options.value.enterToClass,
|
|
311
|
-
"enter-active-class": P(t).options.value.enterActiveClass,
|
|
312
|
-
"leave-from-class": P(t).options.value.leaveFromClass,
|
|
313
|
-
"leave-to-class": P(t).options.value.leaveToClass,
|
|
314
|
-
"leave-active-class": P(t).options.value.leaveActiveClass,
|
|
315
|
-
"appear-active-class": P(t).options.value.appearActiveClass,
|
|
316
|
-
"appear-from-class": P(t).options.value.appearFromClass,
|
|
317
|
-
"appear-to-class": P(t).options.value.appearToClass,
|
|
318
|
-
mode: P(t).options.value.mode,
|
|
319
|
-
type: P(t).options.value.type,
|
|
320
|
-
css: P(t).options.value.css,
|
|
321
|
-
appear: !0,
|
|
322
|
-
persisted: P(t).options.value.persisted,
|
|
323
|
-
onEnter: P(t).options.value.onEnter,
|
|
324
|
-
onLeave: P(t).options.value.onLeave,
|
|
325
|
-
onBeforeEnter: P(t).options.value.onBeforeEnter,
|
|
326
|
-
onBeforeLeave: P(t).options.value.onBeforeLeave,
|
|
327
|
-
onBeforeAppear: P(t).options.value.onBeforeAppear,
|
|
328
|
-
onAfterEnter: P(t).options.value.onAfterEnter,
|
|
329
|
-
onAfterLeave: P(t).options.value.onAfterLeave,
|
|
330
|
-
onAfterAppear: P(t).options.value.onAfterAppear
|
|
331
|
-
}, {
|
|
332
|
-
default: xe(() => [
|
|
333
|
-
(X(), J(ee(a.value.component || a.value), le(Me(a.value.props || {})), null, 16))
|
|
334
|
-
]),
|
|
335
|
-
_: 1
|
|
336
|
-
}, 8, ["name", "duration", "enter-from-class", "enter-to-class", "enter-active-class", "leave-from-class", "leave-to-class", "leave-active-class", "appear-active-class", "appear-from-class", "appear-to-class", "mode", "type", "css", "persisted", "onEnter", "onLeave", "onBeforeEnter", "onBeforeLeave", "onBeforeAppear", "onAfterEnter", "onAfterLeave", "onAfterAppear"])) : (X(), J(ee(a.value.component || a.value), le(Ae({ key: 1 }, a.value.props || {})), null, 16));
|
|
377
|
+
}, Ve = (e, t, n) => {
|
|
378
|
+
if (t !== n) {
|
|
379
|
+
const s = S(e);
|
|
380
|
+
t && !M(t, e) && e.entities.draggableMap.get(t)?.events?.onLeave?.(s), n && !M(n, e) && e.entities.draggableMap.get(n)?.events?.onHover?.(s);
|
|
337
381
|
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
var g, i, c, d, f, r, v;
|
|
344
|
-
const s = t.call(this, l), o = typeof l == "string" ? document.querySelector(l) : l;
|
|
345
|
-
if (o && o instanceof Element && !o.querySelector("#vue-dnd-kit-overlay")) {
|
|
346
|
-
const u = document.createElement("div");
|
|
347
|
-
u.id = "vue-dnd-kit-overlay", u.style.pointerEvents = "none", (g = e == null ? void 0 : e.overlayPosition) != null && g.zIndex && (u.style.zIndex = e.overlayPosition.zIndex.toString()), (i = e == null ? void 0 : e.overlayPosition) != null && i.className && (u.className = e.overlayPosition.className);
|
|
348
|
-
const m = ((c = e == null ? void 0 : e.overlayPosition) == null ? void 0 : c.method) || "append", p = (d = e == null ? void 0 : e.overlayPosition) != null && d.target ? typeof e.overlayPosition.target == "string" ? document.querySelector(e.overlayPosition.target) : e.overlayPosition.target : o;
|
|
349
|
-
if (p && p instanceof Element)
|
|
350
|
-
switch (m) {
|
|
351
|
-
case "prepend":
|
|
352
|
-
p.insertBefore(
|
|
353
|
-
u,
|
|
354
|
-
p.firstChild
|
|
355
|
-
);
|
|
356
|
-
break;
|
|
357
|
-
case "after":
|
|
358
|
-
(f = p.parentNode) == null || f.insertBefore(
|
|
359
|
-
u,
|
|
360
|
-
p.nextSibling
|
|
361
|
-
);
|
|
362
|
-
break;
|
|
363
|
-
case "before":
|
|
364
|
-
(r = p.parentNode) == null || r.insertBefore(
|
|
365
|
-
u,
|
|
366
|
-
p
|
|
367
|
-
);
|
|
368
|
-
break;
|
|
369
|
-
case "append":
|
|
370
|
-
default:
|
|
371
|
-
p.appendChild(u);
|
|
372
|
-
break;
|
|
373
|
-
}
|
|
374
|
-
else
|
|
375
|
-
o.appendChild(u);
|
|
376
|
-
const h = Le(ie, {
|
|
377
|
-
styles: (v = e == null ? void 0 : e.defaultOverlay) == null ? void 0 : v.styles
|
|
378
|
-
});
|
|
379
|
-
se(h, u), n.__VUE_DND_KIT_OVERLAY__ = {
|
|
380
|
-
container: u,
|
|
381
|
-
vnode: h,
|
|
382
|
-
options: (e == null ? void 0 : e.defaultOverlay) || {}
|
|
383
|
-
};
|
|
384
|
-
const L = Y();
|
|
385
|
-
n.__VUE_DND_KIT_STORE__ = L;
|
|
386
|
-
}
|
|
387
|
-
return s;
|
|
388
|
-
};
|
|
389
|
-
const a = n.unmount;
|
|
390
|
-
n.unmount = function() {
|
|
391
|
-
return n.__VUE_DND_KIT_OVERLAY__ && (se(null, n.__VUE_DND_KIT_OVERLAY__.container), delete n.__VUE_DND_KIT_OVERLAY__), a.call(this);
|
|
392
|
-
};
|
|
382
|
+
}, qe = (e, t) => {
|
|
383
|
+
const n = w(t.droppable);
|
|
384
|
+
if (n && !L(n, e)) {
|
|
385
|
+
const s = S(e);
|
|
386
|
+
e.entities.droppableMap.get(n)?.events?.onLeave?.(s);
|
|
393
387
|
}
|
|
394
|
-
},
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
right: 0,
|
|
404
|
-
top: 0
|
|
405
|
-
};
|
|
406
|
-
const e = n.getBoundingClientRect();
|
|
388
|
+
}, ve = (e, t) => {
|
|
389
|
+
const n = w(t.droppable);
|
|
390
|
+
if (n && !L(n, e)) {
|
|
391
|
+
const s = S(e);
|
|
392
|
+
e.entities.droppableMap.get(n)?.events?.onLeave?.(s);
|
|
393
|
+
}
|
|
394
|
+
}, We = (e, t) => !e.length || !t.length ? !0 : e.some((n) => t.includes(n)), je = (e, t, n) => {
|
|
395
|
+
if (!n) return {};
|
|
396
|
+
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);
|
|
407
397
|
return {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
398
|
+
left: `${i}px`,
|
|
399
|
+
top: `${a}px`,
|
|
400
|
+
width: `${l}px`,
|
|
401
|
+
height: `${c}px`,
|
|
402
|
+
position: "fixed",
|
|
403
|
+
pointerEvents: "none",
|
|
404
|
+
border: "1px solid #3b82f6",
|
|
405
|
+
backgroundColor: "#3b82f61a"
|
|
416
406
|
};
|
|
417
|
-
},
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
x: (e.x - t.x) / t.width * 100,
|
|
429
|
-
y: (e.y - t.y) / t.height * 100
|
|
407
|
+
}, Je = (e) => {
|
|
408
|
+
if (!e.pointer.value || !e.entities.selectingArea) return;
|
|
409
|
+
const { selectingArea: t } = e.entities, n = Qe(
|
|
410
|
+
e.pointer.value.start,
|
|
411
|
+
e.pointer.value.current
|
|
412
|
+
), s = e.entities.selectableAreaMap.get(t)?.groups ?? [];
|
|
413
|
+
e.entities.visibleDraggableSet.forEach((i) => {
|
|
414
|
+
if (!t.contains(i)) return;
|
|
415
|
+
if (M(i, e)) {
|
|
416
|
+
e.entities.selectedSet.delete(i);
|
|
417
|
+
return;
|
|
430
418
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
0,
|
|
438
|
-
Math.min(n.x + n.width, e.x + e.width) - Math.max(n.x, e.x)
|
|
439
|
-
), a = Math.max(
|
|
440
|
-
0,
|
|
441
|
-
Math.min(n.y + n.height, e.y + e.height) - Math.max(n.y, e.y)
|
|
442
|
-
), l = t * a, s = n.width * n.height, o = e.width * e.height;
|
|
443
|
-
return (l / s * 100 + l / o * 100) / 2;
|
|
444
|
-
}, de = "data-vue-dnd-kit-draggable", Z = (n) => {
|
|
445
|
-
n.preventDefault();
|
|
446
|
-
}, R = (n) => ({
|
|
447
|
-
items: Array.from(n.draggingElements.value.values())
|
|
448
|
-
}), ke = (n) => {
|
|
449
|
-
const {
|
|
450
|
-
elementsMap: e,
|
|
451
|
-
draggingElements: t,
|
|
452
|
-
hovered: a,
|
|
453
|
-
selectedElements: l,
|
|
454
|
-
isDragging: s,
|
|
455
|
-
visibleElements: o,
|
|
456
|
-
handleDragElementIntersection: g
|
|
457
|
-
} = Y(), i = F(null), c = O(() => a.element.value === i.value), d = C((n == null ? void 0 : n.id) || be()), f = C((n == null ? void 0 : n.disabled) ?? !1), r = O(() => f.value || !i.value || !e.value.has(i.value) ? !1 : t.value.has(i.value)), v = O(() => {
|
|
458
|
-
if (f.value || !i.value || !s.value || !o.value.has(i.value)) return !1;
|
|
459
|
-
const h = e.value.get(i.value);
|
|
460
|
-
return h != null && h.groups.length ? !Array.from(t.value.entries()).some(
|
|
461
|
-
([L, b]) => b.groups.length ? !b.groups.some(
|
|
462
|
-
(z) => h.groups.includes(z)
|
|
463
|
-
) : !1
|
|
464
|
-
) : !0;
|
|
465
|
-
}), u = O(() => {
|
|
466
|
-
if (f.value || !i.value || !s.value || !o.value.has(i.value) || a.element.value !== i.value) return !1;
|
|
467
|
-
const h = e.value.get(i.value);
|
|
468
|
-
return h != null && h.groups.length ? !Array.from(t.value.entries()).some(
|
|
469
|
-
([L, b]) => b.groups.length ? !b.groups.some(
|
|
470
|
-
(z) => h.groups.includes(z)
|
|
471
|
-
) : !1
|
|
472
|
-
) : !0;
|
|
419
|
+
const o = e.entities.draggableMap.get(i)?.groups ?? [];
|
|
420
|
+
if (!We(s, o)) {
|
|
421
|
+
e.entities.selectedSet.delete(i);
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
Be(n, i.getBoundingClientRect()) ? e.entities.selectedSet.add(i) : e.entities.selectedSet.delete(i);
|
|
473
425
|
});
|
|
426
|
+
}, Qe = (e, t) => {
|
|
427
|
+
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
|
+
return new DOMRect(n, s, o, r);
|
|
429
|
+
}, et = (e, t, n = 5) => {
|
|
430
|
+
const s = n / 2;
|
|
474
431
|
return {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
node: i.value,
|
|
480
|
-
groups: (n == null ? void 0 : n.groups) ?? [],
|
|
481
|
-
layer: (n == null ? void 0 : n.layer) ?? null,
|
|
482
|
-
defaultLayer: (n == null ? void 0 : n.layer) ?? null,
|
|
483
|
-
events: (n == null ? void 0 : n.events) ?? {},
|
|
484
|
-
data: (n == null ? void 0 : n.data) ?? null,
|
|
485
|
-
id: d.value,
|
|
486
|
-
disabled: f ?? !1
|
|
487
|
-
}), g("add", i.value), i.value.addEventListener("dragstart", Z), i.value.addEventListener("drag", Z), i.value.setAttribute(de, "true"), i.value.setAttribute("draggable", "false");
|
|
488
|
-
},
|
|
489
|
-
unregisterElement: () => {
|
|
490
|
-
i.value && (e.value.delete(i.value), l.value.delete(i.value), i.value.removeEventListener("dragstart", Z), i.value.removeEventListener("drag", Z), i.value.removeAttribute(de), i.value.removeAttribute("draggable"));
|
|
491
|
-
},
|
|
492
|
-
isDragging: r,
|
|
493
|
-
isOvered: c,
|
|
494
|
-
isAllowed: v,
|
|
495
|
-
isLazyAllowed: u,
|
|
496
|
-
id: d
|
|
432
|
+
left: e - s,
|
|
433
|
+
top: t - s,
|
|
434
|
+
width: n,
|
|
435
|
+
height: n
|
|
497
436
|
};
|
|
498
|
-
},
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
437
|
+
}, tt = (e) => {
|
|
438
|
+
const t = e.pointer.value?.current, n = t?.x ?? 0, s = t?.y ?? 0;
|
|
439
|
+
return et(n, s, 5);
|
|
440
|
+
}, I = (e, t, n) => {
|
|
441
|
+
const s = e.left + e.width / 2, i = e.top + e.height / 2;
|
|
442
|
+
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, D = t.top + f, O = t.bottom - d;
|
|
444
|
+
if (y < b && D < O && s >= y && s <= b && i >= D && i <= O)
|
|
445
|
+
return { top: !1, right: !1, bottom: !1, left: !1, center: !0 };
|
|
446
|
+
}
|
|
447
|
+
const a = i - t.top, o = t.bottom - i, r = s - t.left, l = t.right - s, c = Math.min(a, o, r, l);
|
|
448
|
+
return {
|
|
449
|
+
top: a === c,
|
|
450
|
+
bottom: o === c,
|
|
451
|
+
left: r === c,
|
|
452
|
+
right: l === c
|
|
453
|
+
};
|
|
454
|
+
}, nt = (e, t) => e.find((n) => n !== t && B(t, n)), Q = (e, t, n) => {
|
|
455
|
+
const s = w(t.droppable), i = w(t.draggable);
|
|
456
|
+
t.draggable.clear(), t.droppable.clear();
|
|
457
|
+
const a = tt(e), o = n.zones[0], r = n.elements[0];
|
|
458
|
+
if (o && r && o === r && e.entities.droppableMap.has(o) && o) {
|
|
459
|
+
const u = o.getBoundingClientRect(), d = e.entities.draggableMap.get(o)?.placementMargins, g = I(a, u, d);
|
|
460
|
+
if (g.center) {
|
|
461
|
+
t.droppable.set(o, g);
|
|
462
|
+
const y = nt(n.elements, o);
|
|
463
|
+
if (y) {
|
|
464
|
+
const b = y.getBoundingClientRect();
|
|
465
|
+
t.draggable.set(
|
|
466
|
+
y,
|
|
467
|
+
I(a, b, void 0)
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
} else
|
|
471
|
+
t.draggable.set(r, g), t.droppable.set(o, g);
|
|
472
|
+
} else {
|
|
473
|
+
if (o) {
|
|
474
|
+
const u = o.getBoundingClientRect();
|
|
475
|
+
t.droppable.set(o, I(a, u));
|
|
523
476
|
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
const u = $(r);
|
|
531
|
-
return u && e && ue(u, e);
|
|
532
|
-
}).map(([r, v]) => {
|
|
533
|
-
const u = $(r), m = Q(u), p = a >= u.x && a <= u.x + u.width && l >= u.y && l <= u.y + u.height, h = ve(u, e), L = ce(t, m);
|
|
534
|
-
let b = 0;
|
|
535
|
-
for (const [z, B] of n.visibleZones.value.entries())
|
|
536
|
-
z !== r && z && r && k(r, z) && b++;
|
|
537
|
-
return {
|
|
538
|
-
zone: v,
|
|
539
|
-
node: r,
|
|
540
|
-
isPointerInElement: p,
|
|
541
|
-
overlapPercent: h,
|
|
542
|
-
depth: b,
|
|
543
|
-
centerDistance: L
|
|
544
|
-
};
|
|
545
|
-
}).sort((r, v) => {
|
|
546
|
-
if (!o) {
|
|
547
|
-
if (r.isPointerInElement && v.isPointerInElement)
|
|
548
|
-
return v.depth - r.depth;
|
|
549
|
-
if (r.isPointerInElement !== v.isPointerInElement)
|
|
550
|
-
return r.isPointerInElement ? -1 : 1;
|
|
477
|
+
if (r) {
|
|
478
|
+
const u = r.getBoundingClientRect(), d = e.entities.draggableMap.get(r)?.placementMargins;
|
|
479
|
+
t.draggable.set(
|
|
480
|
+
r,
|
|
481
|
+
I(a, u, d)
|
|
482
|
+
);
|
|
551
483
|
}
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
const { pointerPosition: t, keyboard: a } = Y(), l = (e == null ? void 0 : e.moveStep) || 10;
|
|
484
|
+
}
|
|
485
|
+
const c = w(t.droppable), f = w(t.draggable);
|
|
486
|
+
Xe(e, s, c), Ve(e, i, f);
|
|
487
|
+
}, st = (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
|
+
if (!e)
|
|
489
|
+
return { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 };
|
|
490
|
+
const t = e.getBoundingClientRect();
|
|
560
491
|
return {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
492
|
+
x: t.x,
|
|
493
|
+
y: t.y,
|
|
494
|
+
width: t.width,
|
|
495
|
+
height: t.height,
|
|
496
|
+
top: t.top,
|
|
497
|
+
left: t.left,
|
|
498
|
+
right: t.right,
|
|
499
|
+
bottom: t.bottom
|
|
500
|
+
};
|
|
501
|
+
}, re = (e) => ({
|
|
502
|
+
x: e.x + e.width / 2,
|
|
503
|
+
y: e.y + e.height / 2
|
|
504
|
+
}), it = (e, t) => Math.hypot(t.x - e.x, t.y - e.y), at = (e, t) => {
|
|
505
|
+
const n = Math.max(
|
|
506
|
+
0,
|
|
507
|
+
Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)
|
|
508
|
+
), s = Math.max(
|
|
509
|
+
0,
|
|
510
|
+
Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
|
|
511
|
+
), i = n * s, a = e.width * e.height, o = t.width * t.height;
|
|
512
|
+
return a === 0 || o === 0 ? 0 : (i / a * 100 + i / o * 100) / 2;
|
|
513
|
+
}, ot = (e, t, n) => t >= e.x && t <= e.x + e.width && n >= e.y && n <= e.y + e.height, le = () => !0, ce = () => 0, rt = () => {
|
|
514
|
+
const e = {
|
|
515
|
+
filterElements: le,
|
|
516
|
+
filterZones: le,
|
|
517
|
+
sortElements: ce,
|
|
518
|
+
sortZones: ce
|
|
519
|
+
}, t = (s, i, a, o, r, l, c) => {
|
|
520
|
+
const f = new Set(o), u = { containerBox: i, pointer: a }, d = [...o].filter((g) => r(g, s)).map((g) => {
|
|
521
|
+
const y = oe(g);
|
|
522
|
+
if (!c(y, u)) return null;
|
|
523
|
+
let b = 0;
|
|
524
|
+
for (const D of f)
|
|
525
|
+
D !== g && B(D, g) && b++;
|
|
526
|
+
return {
|
|
527
|
+
node: g,
|
|
528
|
+
box: y,
|
|
529
|
+
meta: {
|
|
530
|
+
isPointerInElement: ot(y, a.x, a.y),
|
|
531
|
+
overlapPercent: at(y, i),
|
|
532
|
+
depth: b,
|
|
533
|
+
centerDistance: it(re(i), re(y))
|
|
534
|
+
}
|
|
579
535
|
};
|
|
536
|
+
}).filter((g) => g !== null);
|
|
537
|
+
return d.sort((g, y) => l(g, y, u)), d.map((g) => g.node);
|
|
538
|
+
}, n = {
|
|
539
|
+
container(s) {
|
|
540
|
+
return e.container = s, n;
|
|
580
541
|
},
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
const i = t.current.value.x, c = t.current.value.y;
|
|
584
|
-
let d = i, f = c;
|
|
585
|
-
a.w.value && (f -= l), a.s.value && (f += l), a.a.value && (d -= l), a.d.value && (d += l), t.current.value = {
|
|
586
|
-
x: d,
|
|
587
|
-
y: f
|
|
588
|
-
};
|
|
542
|
+
containerBox(s) {
|
|
543
|
+
return e.containerBox = s, n;
|
|
589
544
|
},
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
}
|
|
593
|
-
};
|
|
594
|
-
}, Ze = (n) => {
|
|
595
|
-
const e = Y();
|
|
596
|
-
return {
|
|
597
|
-
onPointerStart: (s) => {
|
|
598
|
-
e.pointerPosition.start.value = { x: s.clientX, y: s.clientY }, e.pointerPosition.current.value = {
|
|
599
|
-
x: s.clientX,
|
|
600
|
-
y: s.clientY
|
|
601
|
-
};
|
|
602
|
-
const { pixel: o, percent: g } = _e(n.value, {
|
|
603
|
-
x: s.clientX,
|
|
604
|
-
y: s.clientY
|
|
605
|
-
});
|
|
606
|
-
e.pointerPosition.offset.pixel.value = o, e.pointerPosition.offset.percent.value = g;
|
|
545
|
+
elements(s) {
|
|
546
|
+
return e.elements = s, n;
|
|
607
547
|
},
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
x: s.clientX,
|
|
611
|
-
y: s.clientY
|
|
612
|
-
});
|
|
548
|
+
zones(s) {
|
|
549
|
+
return e.zones = s, n;
|
|
613
550
|
},
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
}, Oe = (n, e) => {
|
|
619
|
-
var B, D;
|
|
620
|
-
const t = Y(), { onPointerStart: a, onPointerMove: l, onPointerEnd: s } = Ze(n), { onKeyboardStart: o, onKeyboardMove: g, onKeyboardEnd: i } = Te(
|
|
621
|
-
n,
|
|
622
|
-
e == null ? void 0 : e.keyboard
|
|
623
|
-
);
|
|
624
|
-
let c = null;
|
|
625
|
-
const d = (w) => {
|
|
626
|
-
var _, S;
|
|
627
|
-
if (!w) return /* @__PURE__ */ new Map();
|
|
628
|
-
const x = t.selectedElements.value.has(w);
|
|
629
|
-
if (t.selectedElements.value.size > 0 && x) {
|
|
630
|
-
const U = /* @__PURE__ */ new Map();
|
|
631
|
-
return t.selectedElements.value.forEach((G) => {
|
|
632
|
-
var A, K;
|
|
633
|
-
const E = t.elementsMap.value.get(G);
|
|
634
|
-
E && U.set(G, {
|
|
635
|
-
...E,
|
|
636
|
-
initialHTML: ((A = E.node) == null ? void 0 : A.outerHTML) ?? "",
|
|
637
|
-
initialRect: (K = E.node) == null ? void 0 : K.getBoundingClientRect()
|
|
638
|
-
});
|
|
639
|
-
}), U;
|
|
640
|
-
}
|
|
641
|
-
t.selectedElements.value.clear();
|
|
642
|
-
const y = t.elementsMap.value.get(w);
|
|
643
|
-
if (!y) return /* @__PURE__ */ new Map();
|
|
644
|
-
const I = /* @__PURE__ */ new Map();
|
|
645
|
-
return I.set(w, {
|
|
646
|
-
...y,
|
|
647
|
-
initialHTML: ((_ = y.node) == null ? void 0 : _.outerHTML) ?? "",
|
|
648
|
-
initialRect: (S = y.node) == null ? void 0 : S.getBoundingClientRect()
|
|
649
|
-
}), I;
|
|
650
|
-
}, f = (w) => {
|
|
651
|
-
if (!w)
|
|
652
|
-
return { element: null, zone: null };
|
|
653
|
-
const x = Array.isArray(w) ? w : [w], y = Array.from(t.draggingElements.value.keys()), I = Array.from(t.zonesMap.value.entries()).flatMap(
|
|
654
|
-
([E, A]) => A.disabled ? [E] : []
|
|
655
|
-
), _ = Array.from(
|
|
656
|
-
t.elementsMap.value.entries()
|
|
657
|
-
).flatMap(([E, A]) => A.disabled ? [E] : []), S = x.find((E) => {
|
|
658
|
-
if (!t.visibleZones.value.has(E)) return !1;
|
|
659
|
-
const A = t.zonesMap.value.get(E);
|
|
660
|
-
return !(!A || A.disabled || I.some(
|
|
661
|
-
(N) => E === N || k(E, N)
|
|
662
|
-
) || y.some(
|
|
663
|
-
(N) => N && (N === A.node || k(A.node, N))
|
|
664
|
-
) || A.groups.length && !!Array.from(
|
|
665
|
-
t.draggingElements.value.values()
|
|
666
|
-
).some((H) => H.groups.length ? !H.groups.some((T) => A.groups.includes(T)) : !1));
|
|
667
|
-
});
|
|
668
|
-
return S ? {
|
|
669
|
-
element: x.filter((E) => {
|
|
670
|
-
if (!t.visibleElements.value.has(E) || !t.elementsMap.value.has(E)) return !1;
|
|
671
|
-
const A = t.elementsMap.value.get(E);
|
|
672
|
-
if (A != null && A.disabled) return !1;
|
|
673
|
-
const K = I.some(
|
|
674
|
-
(T) => E === T || k(E, T)
|
|
675
|
-
), N = _.some(
|
|
676
|
-
(T) => E === T || k(
|
|
677
|
-
E,
|
|
678
|
-
T
|
|
679
|
-
)
|
|
680
|
-
);
|
|
681
|
-
return K || N ? !1 : !Array.from(
|
|
682
|
-
t.draggingElements.value.values()
|
|
683
|
-
).some((T) => T.groups.length ? !T.groups.some(
|
|
684
|
-
(W) => {
|
|
685
|
-
var q;
|
|
686
|
-
return (q = t.elementsMap.value.get(E)) == null ? void 0 : q.groups.includes(W);
|
|
687
|
-
}
|
|
688
|
-
) : !1);
|
|
689
|
-
}).find((E) => y.some(
|
|
690
|
-
(K) => K && (K === E || k(E, K) || k(K, E))
|
|
691
|
-
) ? !1 : E === S || k(
|
|
692
|
-
E,
|
|
693
|
-
S
|
|
694
|
-
)) || null,
|
|
695
|
-
zone: S
|
|
696
|
-
} : { element: null, zone: null };
|
|
697
|
-
}, r = ((B = e == null ? void 0 : e.sensor) == null ? void 0 : B.setup) || Ke, v = (w) => {
|
|
698
|
-
var S, U, G, E, A, K, N, H, T, W, q, ne;
|
|
699
|
-
const x = t.hovered.element.value, y = t.hovered.zone.value, I = w.element, _ = w.zone;
|
|
700
|
-
t.hovered.element.value = I, t.hovered.zone.value = _, x !== I && (x && ((G = (U = (S = t.elementsMap.value.get(x)) == null ? void 0 : S.events) == null ? void 0 : U.onLeave) == null || G.call(U, t, R(t))), I && ((K = (A = (E = t.elementsMap.value.get(I)) == null ? void 0 : E.events) == null ? void 0 : A.onHover) == null || K.call(A, t, R(t)))), y !== _ && (y && ((T = (H = (N = t.zonesMap.value.get(y)) == null ? void 0 : N.events) == null ? void 0 : H.onLeave) == null || T.call(H, t, R(t))), _ && ((ne = (q = (W = t.zonesMap.value.get(_)) == null ? void 0 : W.events) == null ? void 0 : q.onHover) == null || ne.call(q, t, R(t))));
|
|
701
|
-
}, u = ze(() => {
|
|
702
|
-
const w = r(t), x = f(w);
|
|
703
|
-
v(x);
|
|
704
|
-
}, ((D = e == null ? void 0 : e.sensor) == null ? void 0 : D.throttle) ?? 0), m = () => {
|
|
705
|
-
u(), c = requestAnimationFrame(m);
|
|
706
|
-
}, p = () => m(), h = () => {
|
|
707
|
-
c !== null && (s(), i(), cancelAnimationFrame(c), c = null);
|
|
708
|
-
};
|
|
709
|
-
return {
|
|
710
|
-
activate: (w) => {
|
|
711
|
-
t.draggingElements.value = d(n.value), t.draggingElements.value.forEach(
|
|
712
|
-
(x) => {
|
|
713
|
-
var y, I;
|
|
714
|
-
return (I = (y = x.events).onStart) == null ? void 0 : I.call(y, t, R(t));
|
|
715
|
-
}
|
|
716
|
-
), w instanceof PointerEvent ? a(w) : o(w), p();
|
|
551
|
+
filterElements(s) {
|
|
552
|
+
return e.filterElements = s, n;
|
|
717
553
|
},
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
(x) => {
|
|
721
|
-
var y, I;
|
|
722
|
-
return (I = (y = x.events).onMove) == null ? void 0 : I.call(y, t, R(t));
|
|
723
|
-
}
|
|
724
|
-
), w instanceof KeyboardEvent ? g() : l(w);
|
|
554
|
+
filterZones(s) {
|
|
555
|
+
return e.filterZones = s, n;
|
|
725
556
|
},
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
(
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
557
|
+
collision(s) {
|
|
558
|
+
return e.collision = s, n;
|
|
559
|
+
},
|
|
560
|
+
sortElements(s) {
|
|
561
|
+
return e.sortElements = s, n;
|
|
562
|
+
},
|
|
563
|
+
sortZones(s) {
|
|
564
|
+
return e.sortZones = s, n;
|
|
565
|
+
},
|
|
566
|
+
build() {
|
|
567
|
+
const s = e;
|
|
568
|
+
if (!s.container || !s.elements || !s.zones || !s.collision)
|
|
569
|
+
throw new Error("sensor: container, elements, zones, collision are required");
|
|
570
|
+
return (i) => {
|
|
571
|
+
const a = s.container(i);
|
|
572
|
+
if (!a) return { elements: [], zones: [] };
|
|
573
|
+
const o = s.containerBox ? s.containerBox(i) : oe(a), r = i.pointer.value?.current ?? { x: 0, y: 0 };
|
|
574
|
+
return {
|
|
575
|
+
elements: t(
|
|
576
|
+
i,
|
|
577
|
+
o,
|
|
578
|
+
r,
|
|
579
|
+
s.elements(i),
|
|
580
|
+
s.filterElements,
|
|
581
|
+
s.sortElements,
|
|
582
|
+
s.collision
|
|
583
|
+
),
|
|
584
|
+
zones: t(
|
|
585
|
+
i,
|
|
586
|
+
o,
|
|
587
|
+
r,
|
|
588
|
+
s.zones(i),
|
|
589
|
+
s.filterZones,
|
|
590
|
+
s.sortZones,
|
|
591
|
+
s.collision
|
|
592
|
+
)
|
|
593
|
+
};
|
|
594
|
+
};
|
|
749
595
|
}
|
|
750
596
|
};
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
const {
|
|
754
|
-
const m = document.body;
|
|
755
|
-
n = m.style.userSelect, m.style.userSelect = "none", window.addEventListener("contextmenu", Z), window.addEventListener("selectstart", Z), window.addEventListener("touchstart", Z), window.addEventListener("touchmove", Z);
|
|
756
|
-
}, r = () => {
|
|
757
|
-
const m = document.body;
|
|
758
|
-
m.style.userSelect = n, m.style.touchAction = e, m.style.overscrollBehavior = t, window.removeEventListener("contextmenu", Z), window.removeEventListener("selectstart", Z), window.removeEventListener("touchstart", Z), window.removeEventListener("touchmove", Z);
|
|
759
|
-
}, v = () => {
|
|
760
|
-
a && (document.removeEventListener("pointermove", a), a = null), l && (document.removeEventListener("pointerup", l), l = null), s && (s = null), o && (document.removeEventListener("wheel", o), o = null), g && (document.removeEventListener("keydown", g), document.removeEventListener("keypress", g), document.removeEventListener("keyup", g), g = null);
|
|
761
|
-
};
|
|
597
|
+
return n;
|
|
598
|
+
}, lt = () => rt(), ct = (e) => e.overlay.ref?.value ?? null, gt = (e) => {
|
|
599
|
+
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;
|
|
762
600
|
return {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
D !== !1 && (i.component.value = null, r(), B(!0), v());
|
|
772
|
-
});
|
|
773
|
-
}, s = () => {
|
|
774
|
-
i.component.value = null, r(), B(!1), v();
|
|
775
|
-
}, a = (D) => z(D), o = (D) => z(D), g = (D) => {
|
|
776
|
-
D.type === "keyup" && (D.code === "Escape" && (s == null || s()), D.code === "Enter" && (l == null || l())), z(D);
|
|
777
|
-
}, f(), b(m), document.addEventListener("pointermove", a), document.addEventListener("pointerup", l), document.addEventListener("wheel", o), document.addEventListener("keydown", g), document.addEventListener("keypress", g), document.addEventListener("keyup", g);
|
|
778
|
-
}
|
|
601
|
+
x: s,
|
|
602
|
+
y: i,
|
|
603
|
+
width: a,
|
|
604
|
+
height: o,
|
|
605
|
+
top: i,
|
|
606
|
+
left: s,
|
|
607
|
+
right: s + a,
|
|
608
|
+
bottom: i + o
|
|
779
609
|
};
|
|
780
|
-
}),
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
610
|
+
}, ut = (e) => e.entities.visibleDraggableSet, ft = (e) => e.entities.visibleDroppableSet, dt = (e, t) => !t.entities.draggingMap.has(e), yt = (e, t) => ![...t.entities.draggingMap.keys()].some(
|
|
611
|
+
(n) => B(n, e)
|
|
612
|
+
), bt = (e, t) => t.entities.draggableMap.has(e) ? !M(e, t) : t.entities.droppableMap.has(e) ? !L(e, t) : !0, ge = (e, t) => dt(e, t) && yt(e, t) && bt(e, t), mt = (e, t) => st(e, t.containerBox), ue = (e, t, n) => {
|
|
613
|
+
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
|
+
if (e.meta.isPointerInElement && t.meta.isPointerInElement)
|
|
615
|
+
return t.meta.depth - e.meta.depth;
|
|
616
|
+
if (e.meta.isPointerInElement !== t.meta.isPointerInElement)
|
|
617
|
+
return e.meta.isPointerInElement ? -1 : 1;
|
|
618
|
+
}
|
|
619
|
+
return Math.abs(e.meta.overlapPercent - t.meta.overlapPercent) <= 1 ? e.meta.centerDistance - t.meta.centerDistance : t.meta.overlapPercent - e.meta.overlapPercent;
|
|
620
|
+
}, ee = lt().container(ct).containerBox(gt).elements(ut).zones(ft).filterElements(ge).filterZones(ge).collision(mt).sortElements(ue).sortZones(ue).build();
|
|
621
|
+
function fe(e) {
|
|
622
|
+
const n = (e.collision?.run ?? ee)(e);
|
|
623
|
+
Q(e, e.hovered, n);
|
|
624
|
+
}
|
|
625
|
+
function ht(e, t) {
|
|
626
|
+
const n = e.collision?.throttle?.value ?? 0;
|
|
627
|
+
if (n <= 0) {
|
|
628
|
+
fe(e);
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
const s = Date.now();
|
|
632
|
+
s - t.value >= n && (t.value = s, fe(e));
|
|
633
|
+
}
|
|
634
|
+
async function Me(e) {
|
|
635
|
+
const t = e.hovered.droppable.keys().next().value;
|
|
636
|
+
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);
|
|
641
|
+
if (i != null && typeof i.then == "function")
|
|
642
|
+
try {
|
|
643
|
+
return await i, !0;
|
|
644
|
+
} catch {
|
|
645
|
+
const o = e.entities.initiatingDraggable;
|
|
646
|
+
return x(e, o, "onSelfDragCancel"), h(e, "onDragCancel"), ve(e, e.hovered), !1;
|
|
647
|
+
}
|
|
648
|
+
return !0;
|
|
649
|
+
}
|
|
650
|
+
function Se(e) {
|
|
651
|
+
const t = e.entities.initiatingDraggable;
|
|
652
|
+
x(e, t, "onSelfDragEnd"), h(e, "onDragEnd"), qe(e, e.hovered);
|
|
653
|
+
}
|
|
654
|
+
function Dt(e) {
|
|
655
|
+
const t = e.entities.selectingArea;
|
|
656
|
+
if (!t) return;
|
|
657
|
+
const n = e.entities.selectableAreaMap.get(t), s = [...e.entities.selectedSet];
|
|
658
|
+
n?.events?.onSelected?.(s);
|
|
659
|
+
}
|
|
660
|
+
const pt = (e) => {
|
|
661
|
+
const t = {
|
|
662
|
+
current: null
|
|
663
|
+
}, n = { value: 0 }, s = async () => {
|
|
664
|
+
j(), t.current?.cancel(), t.current = null;
|
|
665
|
+
const r = e.state.value;
|
|
666
|
+
if (r === "dragging") {
|
|
667
|
+
if (!await Me(e)) {
|
|
668
|
+
H(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i);
|
|
669
|
+
return;
|
|
670
|
+
}
|
|
671
|
+
Se(e);
|
|
672
|
+
} else r === "selecting" && Dt(e);
|
|
673
|
+
H(e), document.removeEventListener("pointerup", s), document.removeEventListener("pointermove", i);
|
|
674
|
+
}, i = (r) => {
|
|
675
|
+
if (e.pointer.value) {
|
|
676
|
+
if (e.pointer.value.current = { x: r.clientX, y: r.clientY }, Ke(e)) {
|
|
677
|
+
Z(e, r, "onSelfDragStart"), h(e, "onDragStart");
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
if (e.state.value === "dragging") {
|
|
681
|
+
ht(e, n);
|
|
682
|
+
const l = e.entities.initiatingDraggable;
|
|
683
|
+
x(e, l, "onSelfDragMove"), h(e, "onDragMove");
|
|
684
|
+
}
|
|
685
|
+
e.state.value === "selecting" && Je(e);
|
|
686
|
+
}
|
|
800
687
|
};
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
(
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
(
|
|
821
|
-
|
|
688
|
+
return { pointerDown: (r) => {
|
|
689
|
+
document.addEventListener("pointerup", s), document.addEventListener("pointermove", i);
|
|
690
|
+
const l = r.target, c = l.closest(
|
|
691
|
+
k.SELECT_AREA
|
|
692
|
+
), f = l.closest(
|
|
693
|
+
k.DRAGGABLE
|
|
694
|
+
);
|
|
695
|
+
if (e.entities.modifiersSelectableAreaSet.size > 0 && e.entities.modifiersSelectableAreaSet.has(c)) {
|
|
696
|
+
W(), e.pointer.value = J(r), e.state.value = "selecting", e.entities.selectingArea = c;
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(f)) {
|
|
700
|
+
const u = e.entities.draggableMap.get(f);
|
|
701
|
+
if (!De(l, f, u?.dragHandle))
|
|
702
|
+
return;
|
|
703
|
+
W(), e.entities.initiatingDraggable = f;
|
|
704
|
+
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 = Ge(e, () => {
|
|
706
|
+
G(e), Z(e, r, "onSelfDragStart"), h(e, "onDragStart");
|
|
707
|
+
}))) : (G(e), Z(e, r, "onSelfDragStart"), h(e, "onDragStart"));
|
|
708
|
+
}
|
|
709
|
+
}, pointerUp: s, pointerMove: i, cleanup: () => {
|
|
710
|
+
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();
|
|
711
|
+
} };
|
|
712
|
+
}, Et = {
|
|
713
|
+
ArrowUp: { dx: 0, dy: -1 },
|
|
714
|
+
ArrowDown: { dx: 0, dy: 1 },
|
|
715
|
+
ArrowLeft: { dx: -1, dy: 0 },
|
|
716
|
+
ArrowRight: { dx: 1, dy: 0 },
|
|
717
|
+
KeyW: { dx: 0, dy: -1 },
|
|
718
|
+
KeyA: { dx: -1, dy: 0 },
|
|
719
|
+
KeyS: { dx: 0, dy: 1 },
|
|
720
|
+
KeyD: { dx: 1, dy: 0 }
|
|
721
|
+
}, vt = (e) => (t) => {
|
|
722
|
+
const { keys: n } = e.keyboard;
|
|
723
|
+
if (n.pressedKeys.value.add(t.code), e.state.value === "dragging") {
|
|
724
|
+
if (n.forCancel.includes(t.code)) {
|
|
725
|
+
t.preventDefault(), j(), x(e, e.entities.initiatingDraggable, "onSelfDragCancel"), h(e, "onDragCancel"), ve(e, e.hovered), H(e);
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
if (n.forDrop.includes(t.code)) {
|
|
729
|
+
t.preventDefault(), (async () => (await Me(e) && Se(e), j(), H(e)))();
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
const i = Et[t.code];
|
|
733
|
+
if (i && n.forMove.includes(t.code) && e.pointer.value) {
|
|
734
|
+
t.preventDefault();
|
|
735
|
+
const a = n.forMoveFaster.some((c) => n.pressedKeys.value.has(c)), o = e.keyboard.step * (a ? e.keyboard.moveFaster : 1);
|
|
736
|
+
e.pointer.value.current = {
|
|
737
|
+
x: e.pointer.value.current.x + i.dx * o,
|
|
738
|
+
y: e.pointer.value.current.y + i.dy * o
|
|
739
|
+
};
|
|
740
|
+
const l = (e.collision?.run ?? ee)(e);
|
|
741
|
+
Q(e, e.hovered, l), x(e, e.entities.initiatingDraggable, "onSelfDragMove"), h(e, "onDragMove");
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
return;
|
|
745
|
+
}
|
|
746
|
+
if (n.forDrag.includes(t.code)) {
|
|
747
|
+
const i = document.activeElement;
|
|
748
|
+
if (!i) return;
|
|
749
|
+
const a = i.closest(k.DRAGGABLE);
|
|
750
|
+
if (!a || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(a))
|
|
751
|
+
return;
|
|
752
|
+
const o = e.entities.draggableMap.get(a);
|
|
753
|
+
if (!De(i, a, o?.dragHandle, !0)) return;
|
|
754
|
+
t.preventDefault(), W();
|
|
755
|
+
const r = a.getBoundingClientRect(), l = r.left + r.width / 2, c = r.top + r.height / 2, f = {
|
|
756
|
+
clientX: l,
|
|
757
|
+
clientY: c
|
|
758
|
+
};
|
|
759
|
+
e.entities.initiatingDraggable = a;
|
|
760
|
+
const u = me(f, a);
|
|
761
|
+
e.pointer.value = J(f, u.x, u.y), G(e);
|
|
762
|
+
const g = (e.collision?.run ?? ee)(e);
|
|
763
|
+
Q(e, e.hovered, g), x(e, a, "onSelfDragStart"), h(e, "onDragStart");
|
|
764
|
+
}
|
|
765
|
+
}, Mt = (e) => (t) => {
|
|
766
|
+
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
|
+
}, At = (e) => () => {
|
|
774
|
+
e.state.value && (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY);
|
|
775
|
+
}, wt = (e) => {
|
|
776
|
+
const t = pt(e), n = $.keyDown(e), s = $.keyUp(e), i = $.clear(e), a = At(e);
|
|
777
|
+
R(() => {
|
|
778
|
+
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", n), document.addEventListener("keyup", s), document.addEventListener("blur", i), document.addEventListener("scroll", a, !0);
|
|
779
|
+
}), P(() => {
|
|
780
|
+
document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", n), document.removeEventListener("keyup", s), document.removeEventListener("blur", i), document.removeEventListener("scroll", a, !0), t.cleanup();
|
|
822
781
|
});
|
|
782
|
+
}, U = () => {
|
|
783
|
+
const e = de(te);
|
|
784
|
+
if (!e) throw Error("DnD provider not found");
|
|
785
|
+
return e;
|
|
786
|
+
}, xt = () => {
|
|
787
|
+
const e = U();
|
|
823
788
|
return {
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
},
|
|
835
|
-
unregisterZone: () => {
|
|
836
|
-
o.value && (s("remove", o.value), e.value.delete(o.value));
|
|
837
|
-
},
|
|
838
|
-
isOvered: g,
|
|
839
|
-
isAllowed: i,
|
|
840
|
-
isLazyAllowed: c
|
|
841
|
-
};
|
|
842
|
-
}, Fe = (n) => {
|
|
843
|
-
const {
|
|
844
|
-
elementRef: e,
|
|
845
|
-
registerZone: t,
|
|
846
|
-
unregisterZone: a,
|
|
847
|
-
isOvered: l,
|
|
848
|
-
isAllowed: s,
|
|
849
|
-
isLazyAllowed: o
|
|
850
|
-
} = Ve(n);
|
|
851
|
-
return te(t), ge(a), { elementRef: e, isOvered: l, isAllowed: s, isLazyAllowed: o };
|
|
852
|
-
}, Xe = (n) => {
|
|
853
|
-
const { selectedElements: e, elementsMap: t } = Y(), a = O(
|
|
854
|
-
() => n.value ? e.value.has(n.value) : !1
|
|
855
|
-
), l = O(() => {
|
|
856
|
-
if (!n.value) return !1;
|
|
857
|
-
for (const c of e.value)
|
|
858
|
-
if (c && k(c, n.value))
|
|
859
|
-
return !0;
|
|
860
|
-
return !1;
|
|
861
|
-
}), s = O(() => {
|
|
862
|
-
if (!n.value) return !1;
|
|
863
|
-
for (const c of e.value)
|
|
864
|
-
if (c && k(n.value, c))
|
|
865
|
-
return !0;
|
|
866
|
-
return !1;
|
|
867
|
-
}), o = () => {
|
|
868
|
-
n.value && e.value.delete(n.value);
|
|
869
|
-
}, g = () => {
|
|
870
|
-
if (!(!n.value || !t.value.get(n.value))) {
|
|
871
|
-
if (l.value)
|
|
872
|
-
for (const d of e.value)
|
|
873
|
-
d && k(d, n.value) && e.value.delete(d);
|
|
874
|
-
if (s.value)
|
|
875
|
-
for (const d of e.value)
|
|
876
|
-
d && k(n.value, d) && e.value.delete(d);
|
|
877
|
-
e.value.add(n.value);
|
|
878
|
-
}
|
|
789
|
+
overlay: e.overlay,
|
|
790
|
+
delay: e.delay,
|
|
791
|
+
distanceProgress: e.distanceProgress,
|
|
792
|
+
entities: e.entities,
|
|
793
|
+
pointer: e.pointer,
|
|
794
|
+
state: e.state,
|
|
795
|
+
scrollPosition: e.scrollPosition,
|
|
796
|
+
keyboard: e.keyboard,
|
|
797
|
+
hovered: e.hovered,
|
|
798
|
+
collision: e.collision
|
|
879
799
|
};
|
|
800
|
+
}, Lt = /* @__PURE__ */ ye({
|
|
801
|
+
__name: "DefaultOverlay",
|
|
802
|
+
setup(e) {
|
|
803
|
+
const { entities: t, state: n, overlay: s } = xt();
|
|
804
|
+
return (i, a) => A(n) === "dragging" ? (p(), K("div", {
|
|
805
|
+
key: 0,
|
|
806
|
+
class: "dnd-kit-default-overlay",
|
|
807
|
+
style: se({
|
|
808
|
+
"--position-x": A(s).style.value.x + "px",
|
|
809
|
+
"--position-y": A(s).style.value.y + "px"
|
|
810
|
+
})
|
|
811
|
+
}, [
|
|
812
|
+
(p(!0), K(X, null, we(A(t).draggingMap, ([o, r]) => (p(), K(X, null, [
|
|
813
|
+
A(t).draggableMap.get(o)?.render ? (p(), V(q(A(t).draggableMap.get(o)?.render), {
|
|
814
|
+
key: 0,
|
|
815
|
+
class: "test"
|
|
816
|
+
})) : (p(), V(q(o.tagName), {
|
|
817
|
+
key: 1,
|
|
818
|
+
innerHTML: r.initialHTML,
|
|
819
|
+
class: "test",
|
|
820
|
+
style: se({
|
|
821
|
+
width: r.initialRect.width + "px",
|
|
822
|
+
height: r.initialRect.height + "px"
|
|
823
|
+
})
|
|
824
|
+
}, null, 8, ["innerHTML", "style"]))
|
|
825
|
+
], 64))), 256))
|
|
826
|
+
], 4)) : xe("", !0);
|
|
827
|
+
}
|
|
828
|
+
}), kt = /* @__PURE__ */ ye({
|
|
829
|
+
__name: "DnDProvider",
|
|
830
|
+
setup(e) {
|
|
831
|
+
const t = Le("overlayRef"), n = Ze(t);
|
|
832
|
+
wt(n);
|
|
833
|
+
const s = E(
|
|
834
|
+
() => n.overlay.render.value ?? Lt
|
|
835
|
+
);
|
|
836
|
+
return Ce(te, n), (i, a) => (p(), K(X, null, [
|
|
837
|
+
ie(i.$slots, "default"),
|
|
838
|
+
ke("div", {
|
|
839
|
+
ref_key: "overlayRef",
|
|
840
|
+
ref: t,
|
|
841
|
+
class: "dnd-kit-overlay-container"
|
|
842
|
+
}, [
|
|
843
|
+
ie(i.$slots, "overlay", { overlay: s.value }, () => [
|
|
844
|
+
(p(), V(q(s.value)))
|
|
845
|
+
])
|
|
846
|
+
], 512)
|
|
847
|
+
], 64));
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
function Rt(e, t, n) {
|
|
851
|
+
const s = U();
|
|
852
|
+
let i, a, o;
|
|
853
|
+
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(v.DRAGGABLE, ""), s.lib.draggableObserver.observe(o), s.entities.draggableMap.set(o, {
|
|
855
|
+
render: i.render,
|
|
856
|
+
disabled: i.disabled ?? !1,
|
|
857
|
+
groups: i.groups ?? [],
|
|
858
|
+
modifier: i.modifier,
|
|
859
|
+
events: i.events,
|
|
860
|
+
payload: a,
|
|
861
|
+
dragHandle: i.dragHandle,
|
|
862
|
+
activation: i.activation,
|
|
863
|
+
placementMargins: i.placementMargins
|
|
864
|
+
}));
|
|
865
|
+
}), P(() => {
|
|
866
|
+
o && (s.lib.draggableObserver.unobserve(o), s.entities.visibleDraggableSet.delete(o), s.entities.draggableMap.delete(o), s.entities.modifiersDraggableSet.delete(o));
|
|
867
|
+
}), {};
|
|
868
|
+
}
|
|
869
|
+
const Pt = (e, t) => {
|
|
870
|
+
const n = U(), s = E(() => e.value === n.entities.selectingArea);
|
|
871
|
+
let i = null;
|
|
872
|
+
R(() => {
|
|
873
|
+
i = N(e), i && (i.setAttribute(v.SELECT_AREA, ""), n.lib.selectableAreaObserver.observe(i), n.entities.selectableAreaMap.set(i, {
|
|
874
|
+
modifier: t?.modifier ?? {
|
|
875
|
+
keys: ["ControlLeft"],
|
|
876
|
+
method: "every"
|
|
877
|
+
},
|
|
878
|
+
events: t?.events,
|
|
879
|
+
disabled: t?.disabled ?? !1,
|
|
880
|
+
groups: t?.groups ?? []
|
|
881
|
+
}));
|
|
882
|
+
}), P(() => {
|
|
883
|
+
i && (n.lib.selectableAreaObserver.unobserve(i), n.entities.visibleSelectableAreaSet.delete(i), n.entities.modifiersSelectableAreaSet.delete(i), n.entities.selectableAreaMap.delete(i));
|
|
884
|
+
});
|
|
885
|
+
const a = E(() => {
|
|
886
|
+
n.scrollPosition.x, n.scrollPosition.y;
|
|
887
|
+
const o = n.pointer.value;
|
|
888
|
+
return !o || n.state.value !== "selecting" || !i ? {} : je(o.start, o.current, i);
|
|
889
|
+
});
|
|
880
890
|
return {
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
handleToggleSelect: () => {
|
|
884
|
-
n.value && (e.value.has(n.value) ? o() : g());
|
|
885
|
-
},
|
|
886
|
-
isSelected: a,
|
|
887
|
-
isParentOfSelected: l
|
|
891
|
+
isSelecting: s,
|
|
892
|
+
style: a
|
|
888
893
|
};
|
|
889
894
|
};
|
|
895
|
+
function Bt(e, t) {
|
|
896
|
+
const n = de(te);
|
|
897
|
+
if (!n) throw Error("DnD provider not found");
|
|
898
|
+
let s = null;
|
|
899
|
+
return R(() => {
|
|
900
|
+
s = N(e), s && (s.setAttribute(v.CONSTRAINT_AREA, ""), n.entities.constraintsAreaMap.set(s, {
|
|
901
|
+
axis: t?.axis || "both",
|
|
902
|
+
restrictToArea: t?.restrictToArea || !1
|
|
903
|
+
}));
|
|
904
|
+
}), P(() => {
|
|
905
|
+
s && n.entities.constraintsAreaMap.delete(s);
|
|
906
|
+
}), {};
|
|
907
|
+
}
|
|
908
|
+
function Ot(e, t = {}) {
|
|
909
|
+
const n = U();
|
|
910
|
+
let s = null;
|
|
911
|
+
R(() => {
|
|
912
|
+
s = N(e), s && (s.setAttribute(v.DROPPABLE, ""), n.lib.droppableObserver.observe(s), n.entities.droppableMap.set(s, {
|
|
913
|
+
disabled: t.disabled ?? !1,
|
|
914
|
+
groups: t.groups ?? [],
|
|
915
|
+
events: t.events
|
|
916
|
+
}));
|
|
917
|
+
}), P(() => {
|
|
918
|
+
s && (n.lib.droppableObserver.unobserve(s), n.entities.visibleDroppableSet.delete(s), n.entities.droppableMap.delete(s));
|
|
919
|
+
});
|
|
920
|
+
}
|
|
890
921
|
export {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
Fe as useDroppable,
|
|
898
|
-
Xe as useSelection
|
|
922
|
+
kt as DnDProvider,
|
|
923
|
+
Bt as makeBoundingBox,
|
|
924
|
+
Rt as makeDraggable,
|
|
925
|
+
Ot as makeDroppable,
|
|
926
|
+
Pt as makeSelectableArea,
|
|
927
|
+
xt as useDnDProvider
|
|
899
928
|
};
|
|
900
929
|
//# sourceMappingURL=vue-dnd-kit-core.es.js.map
|