@vue-dnd-kit/core 2.0.0-alpha1 → 2.0.0-alpha10
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 +2 -2
- package/dist/external/composables/makeAutoScroll.d.ts +13 -0
- package/dist/external/composables/makeConstraintArea.d.ts +7 -0
- package/dist/external/composables/makeDraggable.d.ts +6 -4
- package/dist/external/composables/makeDroppable.d.ts +9 -3
- package/dist/external/composables/{makeSelectableArea.d.ts → makeSelectionArea.d.ts} +2 -3
- package/dist/external/composables/makeSnappedOverlayPosition.d.ts +20 -0
- package/dist/external/composables/useDnDProvider.d.ts +0 -1
- package/dist/external/env.d.ts +7 -0
- package/dist/external/index.d.ts +7 -8
- package/dist/external/types/entities.d.ts +13 -0
- package/dist/external/types/index.d.ts +1 -1
- package/dist/external/types/placement.d.ts +8 -1
- package/dist/external/types/provider.d.ts +25 -5
- 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 +2 -2
- package/dist/internal/composables/useSizeObserver.d.ts +0 -1
- package/dist/internal/composables/useViewportAutoScroll.d.ts +9 -0
- 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 → default-collision.d.ts} +1 -2
- package/dist/internal/sensors/index.d.ts +2 -2
- package/dist/internal/sensors/sensor.d.ts +16 -1
- package/dist/internal/sensors/steps.d.ts +8 -5
- package/dist/internal/types/auto-scroll.d.ts +19 -0
- package/dist/internal/types/provider.d.ts +2 -1
- package/dist/internal/utils/auto-scroll.d.ts +13 -0
- 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 +11 -1
- package/dist/internal/utils/hover.d.ts +29 -0
- 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 +5 -12
- 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 -2
- package/dist/vue-dnd-kit-core.es.js +902 -543
- package/package.json +4 -3
- package/dist/core.css +0 -1
- 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,48 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 U, watch as J, shallowRef as V, reactive as Z, computed as m, onScopeDispose as Ie, onMounted as N, onBeforeUnmount as Y, inject as xe, defineComponent as Ce, unref as C, openBlock as x, createElementBlock as $, normalizeStyle as ye, Fragment as ie, renderList as Ke, createBlock as q, resolveDynamicComponent as re, createCommentVNode as He, useTemplateRef as Ne, provide as Ye, renderSlot as me, Teleport as Xe, createElementVNode as Ze } from "vue";
|
|
3
|
+
const L = {
|
|
3
4
|
SELECT_AREA: "data-dnd-kit-select-area",
|
|
4
5
|
DRAGGABLE: "data-dnd-kit-draggable",
|
|
5
6
|
DROPPABLE: "data-dnd-kit-droppable",
|
|
6
7
|
CONSTRAINT_AREA: "data-dnd-kit-constraint-area"
|
|
7
|
-
},
|
|
8
|
-
SELECT_AREA: `[${
|
|
9
|
-
DRAGGABLE: `[${
|
|
10
|
-
CONSTRAINT_AREA: `[${
|
|
11
|
-
},
|
|
12
|
-
const
|
|
13
|
-
return t.forEach((
|
|
14
|
-
const
|
|
15
|
-
if (!
|
|
16
|
-
const l =
|
|
17
|
-
if (!l || !
|
|
18
|
-
|
|
8
|
+
}, H = {
|
|
9
|
+
SELECT_AREA: `[${L.SELECT_AREA}]`,
|
|
10
|
+
DRAGGABLE: `[${L.DRAGGABLE}]`,
|
|
11
|
+
CONSTRAINT_AREA: `[${L.CONSTRAINT_AREA}]`
|
|
12
|
+
}, fe = "VueDnDKitProvider", be = (e, t, n, o) => {
|
|
13
|
+
const s = /* @__PURE__ */ new Set();
|
|
14
|
+
return t.forEach((r) => {
|
|
15
|
+
const i = e.get(r), a = o ? o(r) : i?.disabled;
|
|
16
|
+
if (!i || a) return;
|
|
17
|
+
const l = i.modifier?.keys, u = i.modifier?.method;
|
|
18
|
+
if (!l || !u || l.length === 0) {
|
|
19
|
+
s.add(r);
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
21
|
-
l[
|
|
22
|
-
}),
|
|
22
|
+
l[u]((c) => n.value.has(c)) && s.add(r);
|
|
23
|
+
}), s;
|
|
23
24
|
};
|
|
24
|
-
let
|
|
25
|
-
const
|
|
25
|
+
let Le = "", Ue = "", $e = "";
|
|
26
|
+
const p = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$el : null, F = (e, t) => e !== t && e.contains(t), Ve = (e, t) => !(e.right < t.left || e.left > t.right || e.bottom < t.top || e.top > t.bottom), ae = () => {
|
|
26
27
|
const e = document.body;
|
|
27
|
-
|
|
28
|
-
},
|
|
28
|
+
Le = e.style.userSelect, e.style.userSelect = "none", window.addEventListener("contextmenu", D), window.addEventListener("selectstart", D), window.addEventListener("touchstart", D), window.addEventListener("touchmove", D);
|
|
29
|
+
}, le = () => {
|
|
29
30
|
const e = document.body;
|
|
30
|
-
e.style.userSelect =
|
|
31
|
-
},
|
|
31
|
+
e.style.userSelect = Le, e.style.touchAction = Ue, e.style.overscrollBehavior = $e, window.removeEventListener("contextmenu", D), window.removeEventListener("selectstart", D), window.removeEventListener("touchstart", D), window.removeEventListener("touchmove", D);
|
|
32
|
+
}, D = (e) => e.preventDefault(), k = (e, t) => {
|
|
32
33
|
if (t.entities.draggableMap.get(e)?.disabled) return !0;
|
|
33
|
-
for (const [
|
|
34
|
-
if (
|
|
34
|
+
for (const [o, s] of t.entities.draggableMap)
|
|
35
|
+
if (s.disabled && F(o, e)) return !0;
|
|
35
36
|
return !1;
|
|
36
|
-
},
|
|
37
|
+
}, z = (e, t) => {
|
|
37
38
|
if (t.entities.droppableMap.get(e)?.disabled) return !0;
|
|
38
|
-
for (const [
|
|
39
|
-
if (
|
|
39
|
+
for (const [o, s] of t.entities.droppableMap)
|
|
40
|
+
if (s.disabled && F(o, e)) return !0;
|
|
40
41
|
return !1;
|
|
41
|
-
},
|
|
42
|
+
}, de = (e, t) => !e.length || !t.length ? !0 : e.some((n) => t.includes(n));
|
|
43
|
+
function qe(e, t, n, o) {
|
|
44
|
+
const s = /* @__PURE__ */ new Set();
|
|
45
|
+
for (const a of t.keys()) {
|
|
46
|
+
const l = n.get(a);
|
|
47
|
+
for (const u of l?.groups ?? []) s.add(u);
|
|
48
|
+
}
|
|
49
|
+
const r = [...s], i = /* @__PURE__ */ new Set();
|
|
50
|
+
for (const a of e) {
|
|
51
|
+
const u = o.get(a)?.groups ?? [];
|
|
52
|
+
de(r, u) && i.add(a);
|
|
53
|
+
}
|
|
54
|
+
return i;
|
|
55
|
+
}
|
|
56
|
+
function We(e, t, n) {
|
|
57
|
+
const o = /* @__PURE__ */ new Set();
|
|
58
|
+
for (const i of t.keys()) {
|
|
59
|
+
const a = n.get(i);
|
|
60
|
+
for (const l of a?.groups ?? []) o.add(l);
|
|
61
|
+
}
|
|
62
|
+
const s = [...o], r = /* @__PURE__ */ new Set();
|
|
63
|
+
for (const i of e) {
|
|
64
|
+
const l = n.get(i)?.groups ?? [];
|
|
65
|
+
de(s, l) && r.add(i);
|
|
66
|
+
}
|
|
67
|
+
return r;
|
|
68
|
+
}
|
|
69
|
+
const ne = (e) => {
|
|
42
70
|
const t = new IntersectionObserver((n) => {
|
|
43
|
-
n.forEach((
|
|
44
|
-
const
|
|
45
|
-
e[
|
|
71
|
+
n.forEach((o) => {
|
|
72
|
+
const s = o.target;
|
|
73
|
+
e[o.isIntersecting ? "add" : "delete"](s);
|
|
46
74
|
});
|
|
47
75
|
});
|
|
48
76
|
return {
|
|
@@ -50,186 +78,187 @@ const N = (e) => e.value ? e.value instanceof HTMLElement ? e.value : e.value.$e
|
|
|
50
78
|
unobserve: (n) => t.unobserve(n),
|
|
51
79
|
disconnect: () => t.disconnect()
|
|
52
80
|
};
|
|
53
|
-
},
|
|
81
|
+
}, je = (e) => {
|
|
54
82
|
const t = new ResizeObserver((n) => {
|
|
55
|
-
const
|
|
56
|
-
if (!
|
|
57
|
-
const { width:
|
|
58
|
-
e.value = { width:
|
|
83
|
+
const o = n[0];
|
|
84
|
+
if (!o) return;
|
|
85
|
+
const { width: s, height: r } = o.contentRect;
|
|
86
|
+
e.value = { width: s, height: r };
|
|
59
87
|
});
|
|
60
88
|
return {
|
|
61
89
|
observe: (n) => t.observe(n),
|
|
62
90
|
unobserve: (n) => t.unobserve(n),
|
|
63
91
|
disconnect: () => t.disconnect()
|
|
64
92
|
};
|
|
65
|
-
},
|
|
66
|
-
const t =
|
|
93
|
+
}, Je = (e) => {
|
|
94
|
+
const t = U(null), n = je(t), o = J(
|
|
67
95
|
e,
|
|
68
|
-
(
|
|
69
|
-
n.disconnect(),
|
|
96
|
+
(r) => {
|
|
97
|
+
n.disconnect(), r && n.observe(r);
|
|
70
98
|
},
|
|
71
99
|
{ immediate: !0 }
|
|
72
100
|
);
|
|
73
101
|
return { overlaySize: t, overlaySizeObserver: {
|
|
74
102
|
disconnect: () => {
|
|
75
|
-
|
|
103
|
+
o(), n.disconnect();
|
|
76
104
|
}
|
|
77
105
|
} };
|
|
78
106
|
};
|
|
79
|
-
function
|
|
107
|
+
function ce(e, t = 0, n = 0) {
|
|
80
108
|
return {
|
|
81
109
|
start: { x: e.clientX, y: e.clientY },
|
|
82
110
|
current: { x: e.clientX, y: e.clientY },
|
|
83
111
|
offset: { x: t, y: n }
|
|
84
112
|
};
|
|
85
113
|
}
|
|
86
|
-
function
|
|
87
|
-
const n = t.getBoundingClientRect(),
|
|
88
|
-
return { x:
|
|
114
|
+
function ke(e, t) {
|
|
115
|
+
const n = t.getBoundingClientRect(), o = n.width > 0 ? (e.clientX - n.left) / n.width : 0.5, s = n.height > 0 ? (e.clientY - n.top) / n.height : 0.5;
|
|
116
|
+
return { x: o, y: s };
|
|
89
117
|
}
|
|
90
|
-
function
|
|
118
|
+
function Re(e, t) {
|
|
91
119
|
return {
|
|
92
120
|
...t,
|
|
93
121
|
initialHTML: e.innerHTML,
|
|
94
|
-
initialRect: e.getBoundingClientRect()
|
|
122
|
+
initialRect: e.getBoundingClientRect(),
|
|
123
|
+
initialOuterHTML: e.outerHTML
|
|
95
124
|
};
|
|
96
125
|
}
|
|
97
|
-
function
|
|
98
|
-
e.forEach((
|
|
99
|
-
const
|
|
100
|
-
n.set(
|
|
126
|
+
function Qe(e, t, n) {
|
|
127
|
+
e.forEach((o) => {
|
|
128
|
+
const s = t.get(o);
|
|
129
|
+
n.set(o, Re(o, s));
|
|
101
130
|
}), e.clear();
|
|
102
131
|
}
|
|
103
|
-
function
|
|
132
|
+
function et(e, t, n) {
|
|
104
133
|
n.clear();
|
|
105
|
-
const
|
|
106
|
-
n.set(e,
|
|
134
|
+
const o = t.get(e);
|
|
135
|
+
n.set(e, Re(e, o));
|
|
107
136
|
}
|
|
108
|
-
function
|
|
109
|
-
e.entities.initiatingDraggable && (e.state.value = "dragging",
|
|
137
|
+
function W(e) {
|
|
138
|
+
e.entities.initiatingDraggable && (e.state.value = "dragging", tt(
|
|
110
139
|
e.entities.initiatingDraggable,
|
|
111
140
|
e.entities.selectedSet,
|
|
112
141
|
e.entities.draggableMap,
|
|
113
142
|
e.entities.draggingMap
|
|
114
143
|
));
|
|
115
144
|
}
|
|
116
|
-
function
|
|
117
|
-
t.has(e) ?
|
|
145
|
+
function tt(e, t, n, o) {
|
|
146
|
+
t.has(e) ? Qe(t, n, o) : (t.clear(), et(e, n, o));
|
|
118
147
|
}
|
|
119
|
-
function
|
|
120
|
-
if (
|
|
121
|
-
const
|
|
122
|
-
return
|
|
148
|
+
function Pe(e, t, n, o) {
|
|
149
|
+
if (o || !n) return !0;
|
|
150
|
+
const s = e.closest(n);
|
|
151
|
+
return s ? t.contains(s) : !1;
|
|
123
152
|
}
|
|
124
|
-
function
|
|
153
|
+
function nt(e, t) {
|
|
125
154
|
if (!e || !t) return 1;
|
|
126
|
-
const n = Math.abs(e.current.x - e.start.x),
|
|
155
|
+
const n = Math.abs(e.current.x - e.start.x), o = Math.abs(e.current.y - e.start.y);
|
|
127
156
|
if (typeof t == "number") {
|
|
128
|
-
const
|
|
129
|
-
return Math.min(
|
|
157
|
+
const u = Math.sqrt(n * n + o * o);
|
|
158
|
+
return Math.min(u / t, 1);
|
|
130
159
|
}
|
|
131
160
|
const {
|
|
132
|
-
x:
|
|
133
|
-
y:
|
|
134
|
-
condition:
|
|
161
|
+
x: s = 0,
|
|
162
|
+
y: r = 0,
|
|
163
|
+
condition: i = "any"
|
|
135
164
|
} = t;
|
|
136
|
-
if (
|
|
137
|
-
const
|
|
138
|
-
return
|
|
165
|
+
if (s === 0 && r === 0) return 1;
|
|
166
|
+
const a = s > 0 ? Math.min(n / s, 1) : 1, l = r > 0 ? Math.min(o / r, 1) : 1;
|
|
167
|
+
return i === "both" ? Math.min(a, l) : Math.max(a, l);
|
|
139
168
|
}
|
|
140
|
-
function
|
|
169
|
+
function Te(e, t, n) {
|
|
141
170
|
if (!n) return !0;
|
|
142
|
-
const
|
|
143
|
-
return !
|
|
171
|
+
const o = n.distance != null, s = n.delay != null;
|
|
172
|
+
return !o && !s ? !0 : o && !s ? e >= 1 : !o && s ? t >= 1 : (n.condition ?? "both") === "both" ? e >= 1 && t >= 1 : e >= 1 || t >= 1;
|
|
144
173
|
}
|
|
145
|
-
function
|
|
174
|
+
function ot(e) {
|
|
146
175
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable)
|
|
147
176
|
return !1;
|
|
148
177
|
const t = e.entities.draggableMap.get(
|
|
149
178
|
e.entities.initiatingDraggable
|
|
150
179
|
);
|
|
151
|
-
return
|
|
180
|
+
return Te(
|
|
152
181
|
e.distanceProgress.value,
|
|
153
182
|
e.delay.progress,
|
|
154
183
|
t?.activation
|
|
155
|
-
) ? (
|
|
184
|
+
) ? (W(e), !0) : !1;
|
|
156
185
|
}
|
|
157
|
-
function
|
|
186
|
+
function st(e, t) {
|
|
158
187
|
let n = null;
|
|
159
|
-
const
|
|
188
|
+
const o = () => {
|
|
160
189
|
if (e.state.value !== "activating" || !e.entities.initiatingDraggable) {
|
|
161
190
|
n = null;
|
|
162
191
|
return;
|
|
163
192
|
}
|
|
164
|
-
const
|
|
193
|
+
const s = e.entities.draggableMap.get(
|
|
165
194
|
e.entities.initiatingDraggable
|
|
166
|
-
),
|
|
167
|
-
if (!
|
|
195
|
+
), r = s?.activation?.delay;
|
|
196
|
+
if (!r) {
|
|
168
197
|
n = null;
|
|
169
198
|
return;
|
|
170
199
|
}
|
|
171
200
|
e.delay.progress = Math.min(
|
|
172
|
-
(Date.now() - e.delay.startTime) / (
|
|
201
|
+
(Date.now() - e.delay.startTime) / (r * 1e3),
|
|
173
202
|
1
|
|
174
|
-
),
|
|
203
|
+
), Te(
|
|
175
204
|
e.distanceProgress.value,
|
|
176
205
|
e.delay.progress,
|
|
177
|
-
|
|
178
|
-
) ? (t(), n = null) : n = requestAnimationFrame(
|
|
206
|
+
s?.activation
|
|
207
|
+
) ? (t(), n = null) : n = requestAnimationFrame(o);
|
|
179
208
|
};
|
|
180
|
-
return n = requestAnimationFrame(
|
|
209
|
+
return n = requestAnimationFrame(o), {
|
|
181
210
|
cancel: () => {
|
|
182
211
|
n !== null && (cancelAnimationFrame(n), n = null);
|
|
183
212
|
}
|
|
184
213
|
};
|
|
185
214
|
}
|
|
186
|
-
function
|
|
215
|
+
function it(e, t) {
|
|
187
216
|
const n = e.closest(
|
|
188
|
-
|
|
217
|
+
H.CONSTRAINT_AREA
|
|
189
218
|
);
|
|
190
219
|
return !n || !t.has(n) ? null : {
|
|
191
220
|
element: n,
|
|
192
221
|
entity: t.get(n)
|
|
193
222
|
};
|
|
194
223
|
}
|
|
195
|
-
function
|
|
196
|
-
return n === "x" ? { x: e, y:
|
|
224
|
+
function rt(e, t, n, o) {
|
|
225
|
+
return n === "x" ? { x: e, y: o.top } : n === "y" ? { x: o.left, y: t } : { x: e, y: t };
|
|
197
226
|
}
|
|
198
|
-
function
|
|
199
|
-
let
|
|
200
|
-
return n !== "y" && (
|
|
201
|
-
|
|
202
|
-
Math.min(
|
|
203
|
-
)), n !== "x" && (
|
|
204
|
-
|
|
205
|
-
Math.min(
|
|
206
|
-
)), { x:
|
|
227
|
+
function at(e, t, n, o, s) {
|
|
228
|
+
let r = e, i = t;
|
|
229
|
+
return n !== "y" && (r = Math.max(
|
|
230
|
+
o.left,
|
|
231
|
+
Math.min(o.right - s.width, e)
|
|
232
|
+
)), n !== "x" && (i = Math.max(
|
|
233
|
+
o.top,
|
|
234
|
+
Math.min(o.bottom - s.height, t)
|
|
235
|
+
)), { x: r, y: i };
|
|
207
236
|
}
|
|
208
|
-
function
|
|
237
|
+
function lt(e, t, n, o, s) {
|
|
209
238
|
if (!e || !t)
|
|
210
239
|
return { x: 0, y: 0 };
|
|
211
|
-
const
|
|
212
|
-
let l = e.current.x -
|
|
240
|
+
const r = t.getBoundingClientRect(), i = r.width || s?.width || 0, a = r.height || s?.height || 0;
|
|
241
|
+
let l = e.current.x - i * e.offset.x, u = e.current.y - a * e.offset.y;
|
|
213
242
|
if (!n)
|
|
214
|
-
return { x: l, y:
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
217
|
-
return { x: l, y:
|
|
218
|
-
const { element:
|
|
243
|
+
return { x: l, y: u };
|
|
244
|
+
const d = it(n, o);
|
|
245
|
+
if (!d)
|
|
246
|
+
return { x: l, y: u };
|
|
247
|
+
const { element: c, entity: g } = d, f = c.getBoundingClientRect(), y = n.getBoundingClientRect(), b = rt(
|
|
219
248
|
l,
|
|
220
|
-
|
|
221
|
-
|
|
249
|
+
u,
|
|
250
|
+
g.axis || "both",
|
|
222
251
|
y
|
|
223
252
|
);
|
|
224
|
-
return
|
|
253
|
+
return g.restrictToArea ? at(
|
|
225
254
|
b.x,
|
|
226
255
|
b.y,
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
256
|
+
g.axis || "both",
|
|
257
|
+
f,
|
|
258
|
+
r
|
|
230
259
|
) : b;
|
|
231
260
|
}
|
|
232
|
-
const
|
|
261
|
+
const I = {
|
|
233
262
|
forDrag: ["Enter", "Space"],
|
|
234
263
|
forCancel: ["Escape"],
|
|
235
264
|
forDrop: ["Enter", "Space"],
|
|
@@ -245,19 +274,19 @@ const C = {
|
|
|
245
274
|
],
|
|
246
275
|
forMoveFaster: ["ShiftLeft", "ShiftRight"]
|
|
247
276
|
};
|
|
248
|
-
function
|
|
249
|
-
const
|
|
277
|
+
function ct(e, t) {
|
|
278
|
+
const n = V(), o = U(), r = {
|
|
250
279
|
keys: {
|
|
251
|
-
pressedKeys:
|
|
252
|
-
forDrag: [...
|
|
253
|
-
forCancel: [...
|
|
254
|
-
forDrop: [...
|
|
255
|
-
forMove: [...
|
|
256
|
-
forMoveFaster: [...
|
|
280
|
+
pressedKeys: U(/* @__PURE__ */ new Set()),
|
|
281
|
+
forDrag: [...I.forDrag],
|
|
282
|
+
forCancel: [...I.forCancel],
|
|
283
|
+
forDrop: [...I.forDrop],
|
|
284
|
+
forMove: [...I.forMove],
|
|
285
|
+
forMoveFaster: [...I.forMoveFaster]
|
|
257
286
|
},
|
|
258
287
|
step: 8,
|
|
259
288
|
moveFaster: 4
|
|
260
|
-
},
|
|
289
|
+
}, i = Z({
|
|
261
290
|
draggableMap: /* @__PURE__ */ new Map(),
|
|
262
291
|
droppableMap: /* @__PURE__ */ new Map(),
|
|
263
292
|
selectableAreaMap: /* @__PURE__ */ new Map(),
|
|
@@ -266,224 +295,290 @@ function Ze(e) {
|
|
|
266
295
|
selectingArea: void 0,
|
|
267
296
|
draggingMap: /* @__PURE__ */ new Map(),
|
|
268
297
|
selectedSet: /* @__PURE__ */ new Set(),
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
i.
|
|
298
|
+
allowedDroppableSet: m(() => n.value ? qe(
|
|
299
|
+
i.visibleDroppableSet,
|
|
300
|
+
i.draggingMap,
|
|
301
|
+
i.draggableMap,
|
|
302
|
+
i.droppableMap
|
|
303
|
+
) : /* @__PURE__ */ new Set()),
|
|
304
|
+
allowedDraggableSet: m(() => n.value ? We(
|
|
305
|
+
i.visibleDraggableSet,
|
|
306
|
+
i.draggingMap,
|
|
307
|
+
i.draggableMap
|
|
308
|
+
) : /* @__PURE__ */ new Set()),
|
|
309
|
+
modifiersSelectableAreaSet: m(() => be(
|
|
310
|
+
i.selectableAreaMap,
|
|
311
|
+
i.visibleSelectableAreaSet,
|
|
312
|
+
r.keys.pressedKeys
|
|
273
313
|
)),
|
|
274
|
-
modifiersDraggableSet:
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
(
|
|
314
|
+
modifiersDraggableSet: m(() => be(
|
|
315
|
+
i.draggableMap,
|
|
316
|
+
i.visibleDraggableSet,
|
|
317
|
+
r.keys.pressedKeys,
|
|
318
|
+
(v) => k(v, { entities: i })
|
|
279
319
|
)),
|
|
280
320
|
visibleDraggableSet: /* @__PURE__ */ new Set(),
|
|
281
321
|
visibleDroppableSet: /* @__PURE__ */ new Set(),
|
|
282
322
|
visibleSelectableAreaSet: /* @__PURE__ */ new Set()
|
|
283
|
-
}),
|
|
323
|
+
}), a = Z({
|
|
324
|
+
draggable: /* @__PURE__ */ new Map(),
|
|
325
|
+
droppable: /* @__PURE__ */ new Map()
|
|
326
|
+
}), l = {
|
|
327
|
+
throttle: V(0)
|
|
328
|
+
}, u = Z({
|
|
284
329
|
x: window.scrollX,
|
|
285
330
|
y: window.scrollY
|
|
286
|
-
}),
|
|
331
|
+
}), d = Z({
|
|
287
332
|
progress: 0,
|
|
288
333
|
startTime: 0
|
|
289
|
-
}),
|
|
290
|
-
if (!
|
|
291
|
-
const
|
|
292
|
-
return
|
|
293
|
-
}),
|
|
294
|
-
|
|
295
|
-
), f =
|
|
296
|
-
|
|
297
|
-
),
|
|
298
|
-
|
|
299
|
-
), { overlaySize:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
throttle: ne(0)
|
|
304
|
-
}, O = E(() => {
|
|
305
|
-
o.y, o.x;
|
|
306
|
-
const T = a.initiatingDraggable;
|
|
307
|
-
return Ye(
|
|
308
|
-
n.value,
|
|
334
|
+
}), c = m(() => {
|
|
335
|
+
if (!o.value || !i.initiatingDraggable) return 0;
|
|
336
|
+
const v = i.draggableMap.get(i.initiatingDraggable)?.activation?.distance;
|
|
337
|
+
return v ? nt(o.value, v) : 1;
|
|
338
|
+
}), g = ne(
|
|
339
|
+
i.visibleDraggableSet
|
|
340
|
+
), f = ne(
|
|
341
|
+
i.visibleDroppableSet
|
|
342
|
+
), y = ne(
|
|
343
|
+
i.visibleSelectableAreaSet
|
|
344
|
+
), { overlaySize: b, overlaySizeObserver: R } = Je(e), S = U(), _ = m(() => {
|
|
345
|
+
const h = i.initiatingDraggable;
|
|
346
|
+
return lt(
|
|
347
|
+
o.value,
|
|
309
348
|
e.value,
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
349
|
+
h || null,
|
|
350
|
+
i.constraintsAreaMap,
|
|
351
|
+
b.value
|
|
313
352
|
);
|
|
314
|
-
})
|
|
353
|
+
}), E = m({
|
|
354
|
+
get: () => t?.overlayTo,
|
|
355
|
+
set: (h) => E.value = h
|
|
356
|
+
}), X = m(() => t?.autoScrollViewport);
|
|
315
357
|
return {
|
|
316
|
-
state:
|
|
317
|
-
pointer:
|
|
318
|
-
entities:
|
|
319
|
-
keyboard:
|
|
320
|
-
scrollPosition:
|
|
321
|
-
delay:
|
|
322
|
-
distanceProgress:
|
|
323
|
-
hovered:
|
|
324
|
-
collision:
|
|
358
|
+
state: n,
|
|
359
|
+
pointer: o,
|
|
360
|
+
entities: i,
|
|
361
|
+
keyboard: r,
|
|
362
|
+
scrollPosition: u,
|
|
363
|
+
delay: d,
|
|
364
|
+
distanceProgress: c,
|
|
365
|
+
hovered: a,
|
|
366
|
+
collision: l,
|
|
325
367
|
overlay: {
|
|
326
|
-
size:
|
|
327
|
-
|
|
328
|
-
render:
|
|
329
|
-
ref: e
|
|
368
|
+
size: b,
|
|
369
|
+
position: _,
|
|
370
|
+
render: S,
|
|
371
|
+
ref: e,
|
|
372
|
+
to: E
|
|
330
373
|
},
|
|
331
374
|
lib: {
|
|
332
|
-
draggableObserver:
|
|
375
|
+
draggableObserver: g,
|
|
333
376
|
droppableObserver: f,
|
|
334
|
-
selectableAreaObserver:
|
|
335
|
-
overlaySizeObserver:
|
|
336
|
-
}
|
|
377
|
+
selectableAreaObserver: y,
|
|
378
|
+
overlaySizeObserver: R
|
|
379
|
+
},
|
|
380
|
+
autoScrollViewport: X
|
|
337
381
|
};
|
|
338
382
|
}
|
|
339
|
-
const
|
|
383
|
+
const j = (e) => {
|
|
340
384
|
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();
|
|
341
|
-
},
|
|
385
|
+
}, ut = (e) => {
|
|
342
386
|
const t = e.entities.initiatingDraggable;
|
|
343
387
|
if (!t) return;
|
|
344
|
-
const
|
|
345
|
-
if (!
|
|
346
|
-
const
|
|
347
|
-
if (!Array.isArray(
|
|
348
|
-
const [
|
|
388
|
+
const o = e.entities.draggableMap.get(t)?.payload;
|
|
389
|
+
if (!o) return;
|
|
390
|
+
const s = o();
|
|
391
|
+
if (!Array.isArray(s) || s.length < 2) return;
|
|
392
|
+
const [r, i, a] = s;
|
|
393
|
+
return {
|
|
394
|
+
index: Number(r),
|
|
395
|
+
items: Array.isArray(i) ? i : [],
|
|
396
|
+
dropData: a
|
|
397
|
+
};
|
|
398
|
+
}, gt = (e, t) => {
|
|
399
|
+
const o = e.entities.droppableMap.get(t)?.payload;
|
|
400
|
+
if (!o) return;
|
|
401
|
+
const s = o();
|
|
402
|
+
if (!Array.isArray(s) || s.length < 1) return;
|
|
403
|
+
const [r, i] = s;
|
|
349
404
|
return {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
dropData: r
|
|
405
|
+
items: Array.isArray(r) ? r : [],
|
|
406
|
+
userData: i
|
|
353
407
|
};
|
|
354
|
-
},
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const
|
|
368
|
-
e.entities.draggableMap.
|
|
369
|
-
|
|
408
|
+
}, B = (e) => e.keys().next().value, ft = (e) => e.target.closest(H.DRAGGABLE), M = (e, t) => {
|
|
409
|
+
const n = {
|
|
410
|
+
payload: ut(e),
|
|
411
|
+
provider: e
|
|
412
|
+
};
|
|
413
|
+
return t && (n.dropZonePayload = gt(e, t)), n;
|
|
414
|
+
}, oe = (e, t, n) => {
|
|
415
|
+
const o = ft(t);
|
|
416
|
+
if (!o || !e.entities.draggingMap.has(o)) return;
|
|
417
|
+
const s = M(e);
|
|
418
|
+
e.entities.draggingMap.get(o)?.events?.[n]?.(s);
|
|
419
|
+
}, O = (e, t, n) => {
|
|
420
|
+
if (!t || k(t, e)) return;
|
|
421
|
+
const o = M(e);
|
|
422
|
+
e.entities.draggableMap.get(t)?.events?.[n]?.(o);
|
|
423
|
+
}, w = (e, t) => {
|
|
424
|
+
const n = M(e);
|
|
425
|
+
e.entities.draggableMap.forEach((o, s) => {
|
|
426
|
+
k(s, e) || o.events?.[t]?.(n);
|
|
370
427
|
});
|
|
371
|
-
},
|
|
428
|
+
}, dt = (e, t, n) => {
|
|
372
429
|
if (t !== n) {
|
|
373
|
-
|
|
374
|
-
|
|
430
|
+
if (t && !z(t, e)) {
|
|
431
|
+
const o = M(e, t);
|
|
432
|
+
e.entities.droppableMap.get(t)?.events?.onLeave?.(o);
|
|
433
|
+
}
|
|
434
|
+
if (n && !z(n, e)) {
|
|
435
|
+
const o = M(e, n);
|
|
436
|
+
e.entities.droppableMap.get(n)?.events?.onEnter?.(o);
|
|
437
|
+
}
|
|
375
438
|
}
|
|
376
|
-
},
|
|
439
|
+
}, yt = (e, t, n) => {
|
|
377
440
|
if (t !== n) {
|
|
378
|
-
const
|
|
379
|
-
t && !
|
|
441
|
+
const o = M(e);
|
|
442
|
+
t && !k(t, e) && e.entities.draggableMap.get(t)?.events?.onLeave?.(o), n && !k(n, e) && e.entities.draggableMap.get(n)?.events?.onHover?.(o);
|
|
380
443
|
}
|
|
381
|
-
},
|
|
382
|
-
const n =
|
|
383
|
-
if (n && !
|
|
384
|
-
const
|
|
385
|
-
e.entities.droppableMap.get(n)?.events?.onLeave?.(
|
|
444
|
+
}, mt = (e, t) => {
|
|
445
|
+
const n = B(t.droppable);
|
|
446
|
+
if (n && !z(n, e)) {
|
|
447
|
+
const o = M(e, n);
|
|
448
|
+
e.entities.droppableMap.get(n)?.events?.onLeave?.(o);
|
|
386
449
|
}
|
|
387
|
-
},
|
|
388
|
-
const n =
|
|
389
|
-
if (n && !
|
|
390
|
-
const
|
|
391
|
-
e.entities.droppableMap.get(n)?.events?.onLeave?.(
|
|
450
|
+
}, Be = (e, t) => {
|
|
451
|
+
const n = B(t.droppable);
|
|
452
|
+
if (n && !z(n, e)) {
|
|
453
|
+
const o = M(e, n);
|
|
454
|
+
e.entities.droppableMap.get(n)?.events?.onLeave?.(o);
|
|
392
455
|
}
|
|
393
|
-
},
|
|
456
|
+
}, bt = (e, t, n) => {
|
|
394
457
|
if (!n) return {};
|
|
395
|
-
const
|
|
458
|
+
const o = n.getBoundingClientRect(), s = Math.max(o.left, Math.min(e.x, t.x)), r = Math.max(o.top, Math.min(e.y, t.y)), i = Math.min(o.right, Math.max(e.x, t.x)), a = Math.min(o.bottom, Math.max(e.y, t.y)), l = Math.max(0, i - s), u = Math.max(0, a - r);
|
|
396
459
|
return {
|
|
397
|
-
left: `${
|
|
398
|
-
top: `${
|
|
460
|
+
left: `${s}px`,
|
|
461
|
+
top: `${r}px`,
|
|
399
462
|
width: `${l}px`,
|
|
400
|
-
height: `${
|
|
463
|
+
height: `${u}px`,
|
|
401
464
|
position: "fixed",
|
|
402
465
|
pointerEvents: "none",
|
|
403
466
|
border: "1px solid #3b82f6",
|
|
404
467
|
backgroundColor: "#3b82f61a"
|
|
405
468
|
};
|
|
406
|
-
},
|
|
469
|
+
}, ht = (e) => {
|
|
407
470
|
if (!e.pointer.value || !e.entities.selectingArea) return;
|
|
408
|
-
const { selectingArea: t } = e.entities, n =
|
|
471
|
+
const { selectingArea: t } = e.entities, n = pt(
|
|
409
472
|
e.pointer.value.start,
|
|
410
473
|
e.pointer.value.current
|
|
411
|
-
),
|
|
412
|
-
e.entities.visibleDraggableSet.forEach((
|
|
413
|
-
if (!t.contains(
|
|
414
|
-
if (
|
|
415
|
-
e.entities.selectedSet.delete(
|
|
474
|
+
), o = e.entities.selectableAreaMap.get(t)?.groups ?? [];
|
|
475
|
+
e.entities.visibleDraggableSet.forEach((s) => {
|
|
476
|
+
if (!t.contains(s)) return;
|
|
477
|
+
if (k(s, e)) {
|
|
478
|
+
e.entities.selectedSet.delete(s);
|
|
416
479
|
return;
|
|
417
480
|
}
|
|
418
|
-
const
|
|
419
|
-
if (!
|
|
420
|
-
e.entities.selectedSet.delete(
|
|
481
|
+
const i = e.entities.draggableMap.get(s)?.groups ?? [];
|
|
482
|
+
if (!de(o, i)) {
|
|
483
|
+
e.entities.selectedSet.delete(s);
|
|
421
484
|
return;
|
|
422
485
|
}
|
|
423
|
-
|
|
486
|
+
Ve(n, s.getBoundingClientRect()) ? e.entities.selectedSet.add(s) : e.entities.selectedSet.delete(s);
|
|
424
487
|
});
|
|
425
|
-
},
|
|
426
|
-
const n = Math.min(e.x, t.x),
|
|
427
|
-
return new DOMRect(n,
|
|
428
|
-
},
|
|
429
|
-
const
|
|
488
|
+
}, pt = (e, t) => {
|
|
489
|
+
const n = Math.min(e.x, t.x), o = Math.min(e.y, t.y), s = Math.max(e.x, t.x), r = Math.max(e.y, t.y), i = s - n, a = r - o;
|
|
490
|
+
return new DOMRect(n, o, i, a);
|
|
491
|
+
}, Dt = (e, t, n = 5) => {
|
|
492
|
+
const o = n / 2;
|
|
430
493
|
return {
|
|
431
|
-
left: e -
|
|
432
|
-
top: t -
|
|
494
|
+
left: e - o,
|
|
495
|
+
top: t - o,
|
|
433
496
|
width: n,
|
|
434
497
|
height: n
|
|
435
498
|
};
|
|
436
|
-
},
|
|
437
|
-
const t = e.pointer.value?.current, n = t?.x ?? 0,
|
|
438
|
-
return
|
|
439
|
-
},
|
|
440
|
-
const
|
|
499
|
+
}, St = (e) => {
|
|
500
|
+
const t = e.pointer.value?.current, n = t?.x ?? 0, o = t?.y ?? 0;
|
|
501
|
+
return Dt(n, o, 5);
|
|
502
|
+
}, T = (e, t, n) => {
|
|
503
|
+
const o = e.left + e.width / 2, s = e.top + e.height / 2;
|
|
441
504
|
if (n) {
|
|
442
|
-
const
|
|
443
|
-
if (
|
|
444
|
-
return {
|
|
505
|
+
const a = n.top ?? 0, l = n.right ?? 0, u = n.bottom ?? 0, d = n.left ?? 0, c = t.left + d, g = t.right - l, f = t.top + a, y = t.bottom - u;
|
|
506
|
+
if (c < g && f < y && o >= c && o <= g && s >= f && s <= y)
|
|
507
|
+
return {
|
|
508
|
+
top: !1,
|
|
509
|
+
right: !1,
|
|
510
|
+
bottom: !1,
|
|
511
|
+
left: !1,
|
|
512
|
+
center: !0
|
|
513
|
+
};
|
|
445
514
|
}
|
|
446
|
-
const
|
|
515
|
+
const r = t.left + t.width / 2, i = t.top + t.height / 2;
|
|
447
516
|
return {
|
|
448
|
-
top:
|
|
449
|
-
bottom:
|
|
450
|
-
left:
|
|
451
|
-
right:
|
|
517
|
+
top: s < i,
|
|
518
|
+
bottom: s > i,
|
|
519
|
+
left: o < r,
|
|
520
|
+
right: o > r,
|
|
521
|
+
center: !1
|
|
452
522
|
};
|
|
453
|
-
},
|
|
454
|
-
|
|
523
|
+
}, vt = (e) => ({
|
|
524
|
+
x: e.left + e.width / 2,
|
|
525
|
+
y: e.top + e.height / 2
|
|
526
|
+
}), K = (e, t) => {
|
|
527
|
+
const n = vt(t);
|
|
528
|
+
return Math.hypot(e.x - n.x, e.y - n.y);
|
|
529
|
+
}, wt = (e, t) => e.find((n) => n !== t && F(t, n)), ue = (e, t, n) => {
|
|
530
|
+
const o = B(t.droppable), s = B(t.draggable);
|
|
455
531
|
t.draggable.clear(), t.droppable.clear();
|
|
456
|
-
const
|
|
457
|
-
if (
|
|
458
|
-
const
|
|
459
|
-
if (
|
|
460
|
-
t.droppable.set(
|
|
461
|
-
const y =
|
|
532
|
+
const r = St(e), i = n.zones[0], a = n.elements[0];
|
|
533
|
+
if (i && a && i === a && e.entities.droppableMap.has(i) && i) {
|
|
534
|
+
const c = i.getBoundingClientRect(), g = e.entities.draggableMap.get(i)?.placementMargins, f = T(r, c, g);
|
|
535
|
+
if (f.center) {
|
|
536
|
+
t.droppable.set(i, f);
|
|
537
|
+
const y = wt(n.elements, i);
|
|
462
538
|
if (y) {
|
|
463
539
|
const b = y.getBoundingClientRect();
|
|
464
540
|
t.draggable.set(
|
|
465
541
|
y,
|
|
466
|
-
|
|
542
|
+
T(r, b, void 0)
|
|
467
543
|
);
|
|
468
544
|
}
|
|
469
545
|
} else
|
|
470
|
-
t.draggable.set(
|
|
546
|
+
t.draggable.set(a, f);
|
|
471
547
|
} else {
|
|
472
|
-
if (
|
|
473
|
-
const
|
|
474
|
-
t.droppable.set(
|
|
475
|
-
}
|
|
476
|
-
if (r) {
|
|
477
|
-
const u = r.getBoundingClientRect(), d = e.entities.draggableMap.get(r)?.placementMargins;
|
|
478
|
-
t.draggable.set(
|
|
479
|
-
r,
|
|
480
|
-
I(a, u, d)
|
|
481
|
-
);
|
|
548
|
+
if (i) {
|
|
549
|
+
const c = i.getBoundingClientRect();
|
|
550
|
+
t.droppable.set(i, T(r, c));
|
|
482
551
|
}
|
|
552
|
+
if (a)
|
|
553
|
+
if (i)
|
|
554
|
+
if (F(i, a)) {
|
|
555
|
+
const c = a.getBoundingClientRect(), g = e.entities.draggableMap.get(a)?.placementMargins;
|
|
556
|
+
t.draggable.set(
|
|
557
|
+
a,
|
|
558
|
+
T(r, c, g)
|
|
559
|
+
);
|
|
560
|
+
} else {
|
|
561
|
+
const c = e.pointer.value?.current ?? { x: 0, y: 0 }, g = i.getBoundingClientRect(), f = a.getBoundingClientRect(), y = K(c, g);
|
|
562
|
+
if (K(c, f) < y) {
|
|
563
|
+
t.droppable.clear();
|
|
564
|
+
const R = e.entities.draggableMap.get(a)?.placementMargins;
|
|
565
|
+
t.draggable.set(
|
|
566
|
+
a,
|
|
567
|
+
T(r, f, R)
|
|
568
|
+
);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
else {
|
|
572
|
+
const c = a.getBoundingClientRect(), g = e.entities.draggableMap.get(a)?.placementMargins;
|
|
573
|
+
t.draggable.set(
|
|
574
|
+
a,
|
|
575
|
+
T(r, c, g)
|
|
576
|
+
);
|
|
577
|
+
}
|
|
483
578
|
}
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
},
|
|
579
|
+
const u = B(t.droppable), d = B(t.draggable);
|
|
580
|
+
dt(e, o, u), yt(e, s, d);
|
|
581
|
+
}, Mt = (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, he = (e) => {
|
|
487
582
|
if (!e)
|
|
488
583
|
return { x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 };
|
|
489
584
|
const t = e.getBoundingClientRect();
|
|
@@ -497,118 +592,161 @@ const H = (e) => {
|
|
|
497
592
|
right: t.right,
|
|
498
593
|
bottom: t.bottom
|
|
499
594
|
};
|
|
500
|
-
},
|
|
595
|
+
}, pe = (e) => ({
|
|
501
596
|
x: e.x + e.width / 2,
|
|
502
597
|
y: e.y + e.height / 2
|
|
503
|
-
}),
|
|
598
|
+
}), Et = (e, t) => Math.hypot(t.x - e.x, t.y - e.y), At = (e, t) => {
|
|
504
599
|
const n = Math.max(
|
|
505
600
|
0,
|
|
506
601
|
Math.min(e.x + e.width, t.x + t.width) - Math.max(e.x, t.x)
|
|
507
|
-
),
|
|
602
|
+
), o = Math.max(
|
|
508
603
|
0,
|
|
509
604
|
Math.min(e.y + e.height, t.y + t.height) - Math.max(e.y, t.y)
|
|
510
|
-
),
|
|
511
|
-
return
|
|
512
|
-
},
|
|
605
|
+
), s = n * o, r = e.width * e.height, i = t.width * t.height;
|
|
606
|
+
return r === 0 || i === 0 ? 0 : (s / r * 100 + s / i * 100) / 2;
|
|
607
|
+
}, xt = (e, t, n) => t >= e.x && t <= e.x + e.width && n >= e.y && n <= e.y + e.height, De = () => !0, Se = () => 0, Ct = "separate", Lt = () => {
|
|
513
608
|
const e = {
|
|
514
|
-
filterElements:
|
|
515
|
-
filterZones:
|
|
516
|
-
sortElements:
|
|
517
|
-
sortZones:
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
609
|
+
filterElements: De,
|
|
610
|
+
filterZones: De,
|
|
611
|
+
sortElements: Se,
|
|
612
|
+
sortZones: Se,
|
|
613
|
+
mergeStrategy: Ct,
|
|
614
|
+
pickClosestBetweenFirst: !1
|
|
615
|
+
}, t = (o, s, r, i, a, l, u) => {
|
|
616
|
+
const d = new Set(i), c = { containerBox: s, pointer: r }, g = [...i].filter((f) => a(f, o)).map((f) => {
|
|
617
|
+
const y = he(f);
|
|
618
|
+
if (!u(y, c)) return null;
|
|
522
619
|
let b = 0;
|
|
523
|
-
for (const
|
|
524
|
-
|
|
620
|
+
for (const S of d)
|
|
621
|
+
S !== f && F(S, f) && b++;
|
|
622
|
+
const R = At(y, s);
|
|
525
623
|
return {
|
|
526
|
-
node:
|
|
624
|
+
node: f,
|
|
527
625
|
box: y,
|
|
528
626
|
meta: {
|
|
529
|
-
isPointerInElement:
|
|
530
|
-
overlapPercent:
|
|
627
|
+
isPointerInElement: xt(y, r.x, r.y),
|
|
628
|
+
overlapPercent: R,
|
|
531
629
|
depth: b,
|
|
532
|
-
centerDistance:
|
|
630
|
+
centerDistance: Et(
|
|
631
|
+
pe(s),
|
|
632
|
+
pe(y)
|
|
633
|
+
)
|
|
533
634
|
}
|
|
534
635
|
};
|
|
535
|
-
}).filter((
|
|
536
|
-
|
|
636
|
+
}).filter((f) => f !== null);
|
|
637
|
+
if (e.minOverlapPercent !== void 0) {
|
|
638
|
+
const f = e.minOverlapPercent, y = g.filter((b) => b.meta.overlapPercent >= f);
|
|
639
|
+
g.length = 0, g.push(...y);
|
|
640
|
+
}
|
|
641
|
+
return g.sort((f, y) => l(f, y, c)), g.map((f) => f.node);
|
|
537
642
|
}, n = {
|
|
538
|
-
container(
|
|
539
|
-
return e.container =
|
|
643
|
+
container(o) {
|
|
644
|
+
return e.container = o, n;
|
|
645
|
+
},
|
|
646
|
+
containerBox(o) {
|
|
647
|
+
return e.containerBox = o, n;
|
|
648
|
+
},
|
|
649
|
+
elements(o) {
|
|
650
|
+
return e.elements = o, n;
|
|
540
651
|
},
|
|
541
|
-
|
|
542
|
-
return e.
|
|
652
|
+
zones(o) {
|
|
653
|
+
return e.zones = o, n;
|
|
543
654
|
},
|
|
544
|
-
|
|
545
|
-
return e.
|
|
655
|
+
filterElements(o) {
|
|
656
|
+
return e.filterElements = o, n;
|
|
546
657
|
},
|
|
547
|
-
|
|
548
|
-
return e.
|
|
658
|
+
filterZones(o) {
|
|
659
|
+
return e.filterZones = o, n;
|
|
549
660
|
},
|
|
550
|
-
|
|
551
|
-
return e.
|
|
661
|
+
collision(o) {
|
|
662
|
+
return e.collision = o, n;
|
|
552
663
|
},
|
|
553
|
-
|
|
554
|
-
return e.
|
|
664
|
+
sortElements(o) {
|
|
665
|
+
return e.sortElements = o, n;
|
|
555
666
|
},
|
|
556
|
-
|
|
557
|
-
return e.
|
|
667
|
+
sortZones(o) {
|
|
668
|
+
return e.sortZones = o, n;
|
|
558
669
|
},
|
|
559
|
-
|
|
560
|
-
return e.
|
|
670
|
+
mergeStrategy(o) {
|
|
671
|
+
return e.mergeStrategy = o, n;
|
|
561
672
|
},
|
|
562
|
-
|
|
563
|
-
return e.
|
|
673
|
+
pickClosestBetweenFirst(o) {
|
|
674
|
+
return e.pickClosestBetweenFirst = o, n;
|
|
675
|
+
},
|
|
676
|
+
minOverlapPercent(o) {
|
|
677
|
+
return e.minOverlapPercent = o, n;
|
|
564
678
|
},
|
|
565
679
|
build() {
|
|
566
|
-
const
|
|
567
|
-
if (!
|
|
568
|
-
throw new Error(
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
const
|
|
573
|
-
return {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
680
|
+
const o = e;
|
|
681
|
+
if (!o.container || !o.elements || !o.zones || !o.collision)
|
|
682
|
+
throw new Error(
|
|
683
|
+
"sensor: container, elements, zones, collision are required"
|
|
684
|
+
);
|
|
685
|
+
return (s) => {
|
|
686
|
+
const r = o.container(s);
|
|
687
|
+
if (!r) return { elements: [], zones: [] };
|
|
688
|
+
const i = o.containerBox ? o.containerBox(s) : he(r), a = s.pointer.value?.current ?? { x: 0, y: 0 }, l = t(
|
|
689
|
+
s,
|
|
690
|
+
i,
|
|
691
|
+
a,
|
|
692
|
+
o.elements(s),
|
|
693
|
+
o.filterElements,
|
|
694
|
+
o.sortElements,
|
|
695
|
+
o.collision
|
|
696
|
+
), u = t(
|
|
697
|
+
s,
|
|
698
|
+
i,
|
|
699
|
+
a,
|
|
700
|
+
o.zones(s),
|
|
701
|
+
o.filterZones,
|
|
702
|
+
o.sortZones,
|
|
703
|
+
o.collision
|
|
704
|
+
);
|
|
705
|
+
if (o.mergeStrategy === "unified-closest") {
|
|
706
|
+
const d = [
|
|
707
|
+
...l.map((g) => ({ node: g, isZone: !1, distance: 0 })),
|
|
708
|
+
...u.map((g) => ({ node: g, isZone: !0, distance: 0 }))
|
|
709
|
+
];
|
|
710
|
+
if (d.length === 0) return { elements: [], zones: [] };
|
|
711
|
+
for (const g of d) {
|
|
712
|
+
const f = g.node.getBoundingClientRect();
|
|
713
|
+
g.distance = K(a, f);
|
|
714
|
+
}
|
|
715
|
+
const c = d.reduce(
|
|
716
|
+
(g, f) => f.distance < g.distance ? f : g
|
|
717
|
+
);
|
|
718
|
+
return c.isZone ? { elements: [], zones: [c.node] } : { elements: [c.node], zones: [] };
|
|
719
|
+
}
|
|
720
|
+
if (o.pickClosestBetweenFirst && l[0] && u[0]) {
|
|
721
|
+
const d = K(
|
|
722
|
+
a,
|
|
723
|
+
u[0].getBoundingClientRect()
|
|
724
|
+
);
|
|
725
|
+
return K(
|
|
726
|
+
a,
|
|
727
|
+
l[0].getBoundingClientRect()
|
|
728
|
+
) < d ? { elements: l, zones: [] } : { elements: [], zones: u };
|
|
729
|
+
}
|
|
730
|
+
return { elements: l, zones: u };
|
|
593
731
|
};
|
|
594
732
|
}
|
|
595
733
|
};
|
|
596
734
|
return n;
|
|
597
|
-
},
|
|
598
|
-
const t = e.overlay.
|
|
735
|
+
}, kt = () => Lt(), Rt = (e) => e.overlay.ref?.value ?? null, Pt = (e) => {
|
|
736
|
+
const t = e.overlay.position?.value ?? { x: 0, y: 0 }, n = e.overlay.size?.value ?? null, { x: o, y: s } = t, r = n?.width ?? 0, i = n?.height ?? 0;
|
|
599
737
|
return {
|
|
600
|
-
x:
|
|
601
|
-
y:
|
|
602
|
-
width:
|
|
603
|
-
height:
|
|
604
|
-
top:
|
|
605
|
-
left:
|
|
606
|
-
right:
|
|
607
|
-
bottom:
|
|
738
|
+
x: o,
|
|
739
|
+
y: s,
|
|
740
|
+
width: r,
|
|
741
|
+
height: i,
|
|
742
|
+
top: s,
|
|
743
|
+
left: o,
|
|
744
|
+
right: o + r,
|
|
745
|
+
bottom: s + i
|
|
608
746
|
};
|
|
609
|
-
},
|
|
610
|
-
(n) =>
|
|
611
|
-
),
|
|
747
|
+
}, Tt = (e) => e.entities.allowedDraggableSet, Bt = (e) => e.entities.allowedDroppableSet, Ot = (e, t) => !t.entities.draggingMap.has(e), zt = (e, t) => ![...t.entities.draggingMap.keys()].some(
|
|
748
|
+
(n) => F(n, e)
|
|
749
|
+
), Ft = (e, t) => t.entities.draggableMap.has(e) ? !k(e, t) : t.entities.droppableMap.has(e) ? !z(e, t) : !0, ve = (e, t) => Ot(e, t) && zt(e, t) && Ft(e, t), _t = (e, t) => Mt(e, t.containerBox), we = (e, t, n) => {
|
|
612
750
|
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) {
|
|
613
751
|
if (e.meta.isPointerInElement && t.meta.isPointerInElement)
|
|
614
752
|
return t.meta.depth - e.meta.depth;
|
|
@@ -616,99 +754,96 @@ const H = (e) => {
|
|
|
616
754
|
return e.meta.isPointerInElement ? -1 : 1;
|
|
617
755
|
}
|
|
618
756
|
return Math.abs(e.meta.overlapPercent - t.meta.overlapPercent) <= 1 ? e.meta.centerDistance - t.meta.centerDistance : t.meta.overlapPercent - e.meta.overlapPercent;
|
|
619
|
-
},
|
|
620
|
-
function
|
|
621
|
-
const n = (e.collision?.run ??
|
|
622
|
-
|
|
757
|
+
}, ge = kt().container(Rt).containerBox(Pt).elements(Tt).zones(Bt).filterElements(ve).filterZones(ve).collision(_t).minOverlapPercent(10).sortElements(we).sortZones(we).build();
|
|
758
|
+
function Me(e) {
|
|
759
|
+
const n = (e.collision?.run ?? ge)(e);
|
|
760
|
+
ue(e, e.hovered, n);
|
|
623
761
|
}
|
|
624
|
-
function
|
|
762
|
+
function Gt(e, t) {
|
|
625
763
|
const n = e.collision?.throttle?.value ?? 0;
|
|
626
764
|
if (n <= 0) {
|
|
627
|
-
|
|
765
|
+
Me(e);
|
|
628
766
|
return;
|
|
629
767
|
}
|
|
630
|
-
const
|
|
631
|
-
|
|
768
|
+
const o = Date.now();
|
|
769
|
+
o - t.value >= n && (t.value = o, Me(e));
|
|
632
770
|
}
|
|
633
|
-
async function
|
|
771
|
+
async function Oe(e) {
|
|
634
772
|
const t = e.hovered.droppable.keys().next().value;
|
|
635
|
-
if (!t ||
|
|
636
|
-
const n = e.entities.droppableMap.get(t), s =
|
|
637
|
-
|
|
638
|
-
provider: e
|
|
639
|
-
}, i = n?.events?.onDrop?.(s);
|
|
640
|
-
if (i != null && typeof i.then == "function")
|
|
773
|
+
if (!t || z(t, e)) return !0;
|
|
774
|
+
const n = e.entities.droppableMap.get(t), o = M(e, t), s = n?.events?.onDrop?.(o);
|
|
775
|
+
if (s != null && typeof s.then == "function")
|
|
641
776
|
try {
|
|
642
|
-
return await
|
|
777
|
+
return await s, !0;
|
|
643
778
|
} catch {
|
|
644
|
-
const
|
|
645
|
-
return
|
|
779
|
+
const i = e.entities.initiatingDraggable;
|
|
780
|
+
return O(e, i, "onSelfDragCancel"), w(e, "onDragCancel"), Be(e, e.hovered), !1;
|
|
646
781
|
}
|
|
647
782
|
return !0;
|
|
648
783
|
}
|
|
649
|
-
function
|
|
784
|
+
function ze(e) {
|
|
650
785
|
const t = e.entities.initiatingDraggable;
|
|
651
|
-
|
|
786
|
+
O(e, t, "onSelfDragEnd"), w(e, "onDragEnd"), mt(e, e.hovered);
|
|
652
787
|
}
|
|
653
|
-
function
|
|
788
|
+
function It(e) {
|
|
654
789
|
const t = e.entities.selectingArea;
|
|
655
790
|
if (!t) return;
|
|
656
|
-
const n = e.entities.selectableAreaMap.get(t),
|
|
657
|
-
n?.events?.onSelected?.(
|
|
791
|
+
const n = e.entities.selectableAreaMap.get(t), o = [...e.entities.selectedSet];
|
|
792
|
+
n?.events?.onSelected?.(o);
|
|
658
793
|
}
|
|
659
|
-
const
|
|
794
|
+
const Kt = (e) => {
|
|
660
795
|
const t = {
|
|
661
796
|
current: null
|
|
662
|
-
}, n = { value: 0 },
|
|
663
|
-
|
|
664
|
-
const
|
|
665
|
-
if (
|
|
666
|
-
if (!await
|
|
667
|
-
|
|
797
|
+
}, n = { value: 0 }, o = async () => {
|
|
798
|
+
le(), t.current?.cancel(), t.current = null;
|
|
799
|
+
const a = e.state.value;
|
|
800
|
+
if (a === "dragging") {
|
|
801
|
+
if (!await Oe(e)) {
|
|
802
|
+
j(e), document.removeEventListener("pointerup", o), document.removeEventListener("pointermove", s);
|
|
668
803
|
return;
|
|
669
804
|
}
|
|
670
|
-
|
|
671
|
-
} else
|
|
672
|
-
|
|
673
|
-
},
|
|
805
|
+
ze(e);
|
|
806
|
+
} else a === "selecting" && It(e);
|
|
807
|
+
j(e), document.removeEventListener("pointerup", o), document.removeEventListener("pointermove", s);
|
|
808
|
+
}, s = (a) => {
|
|
674
809
|
if (e.pointer.value) {
|
|
675
|
-
if (e.pointer.value.current = { x:
|
|
676
|
-
|
|
810
|
+
if (e.pointer.value.current = { x: a.clientX, y: a.clientY }, ot(e)) {
|
|
811
|
+
oe(e, a, "onSelfDragStart"), w(e, "onDragStart");
|
|
677
812
|
return;
|
|
678
813
|
}
|
|
679
814
|
if (e.state.value === "dragging") {
|
|
680
|
-
|
|
815
|
+
Gt(e, n);
|
|
681
816
|
const l = e.entities.initiatingDraggable;
|
|
682
|
-
|
|
817
|
+
O(e, l, "onSelfDragMove"), w(e, "onDragMove");
|
|
683
818
|
}
|
|
684
|
-
e.state.value === "selecting" &&
|
|
819
|
+
e.state.value === "selecting" && ht(e);
|
|
685
820
|
}
|
|
686
821
|
};
|
|
687
|
-
return { pointerDown: (
|
|
688
|
-
document.addEventListener("pointerup",
|
|
689
|
-
const l =
|
|
690
|
-
|
|
691
|
-
),
|
|
692
|
-
|
|
822
|
+
return { pointerDown: (a) => {
|
|
823
|
+
document.addEventListener("pointerup", o), document.addEventListener("pointermove", s);
|
|
824
|
+
const l = a.target, u = l.closest(
|
|
825
|
+
H.SELECT_AREA
|
|
826
|
+
), d = l.closest(
|
|
827
|
+
H.DRAGGABLE
|
|
693
828
|
);
|
|
694
|
-
if (e.entities.modifiersSelectableAreaSet.size > 0 && e.entities.modifiersSelectableAreaSet.has(
|
|
695
|
-
|
|
829
|
+
if (e.entities.modifiersSelectableAreaSet.size > 0 && e.entities.modifiersSelectableAreaSet.has(u)) {
|
|
830
|
+
ae(), e.pointer.value = ce(a), e.state.value = "selecting", e.entities.selectingArea = u;
|
|
696
831
|
return;
|
|
697
832
|
}
|
|
698
|
-
if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(
|
|
699
|
-
const
|
|
700
|
-
if (!
|
|
833
|
+
if (e.entities.modifiersDraggableSet.size > 0 && e.entities.modifiersDraggableSet.has(d)) {
|
|
834
|
+
const c = e.entities.draggableMap.get(d);
|
|
835
|
+
if (!Pe(l, d, c?.dragHandle))
|
|
701
836
|
return;
|
|
702
|
-
|
|
703
|
-
const
|
|
704
|
-
e.pointer.value =
|
|
705
|
-
|
|
706
|
-
}))) : (
|
|
837
|
+
ae(), e.entities.initiatingDraggable = d;
|
|
838
|
+
const g = ke(a, d);
|
|
839
|
+
e.pointer.value = ce(a, g.x, g.y), c?.activation?.distance || c?.activation?.delay ? (e.state.value = "activating", c?.activation?.delay && (e.delay.startTime = Date.now(), t.current = st(e, () => {
|
|
840
|
+
W(e), oe(e, a, "onSelfDragStart"), w(e, "onDragStart");
|
|
841
|
+
}))) : (W(e), oe(e, a, "onSelfDragStart"), w(e, "onDragStart"));
|
|
707
842
|
}
|
|
708
|
-
}, pointerUp:
|
|
709
|
-
t.current?.cancel(), document.removeEventListener("pointerup",
|
|
843
|
+
}, pointerUp: o, pointerMove: s, cleanup: () => {
|
|
844
|
+
t.current?.cancel(), document.removeEventListener("pointerup", o), document.removeEventListener("pointermove", s), e.lib.draggableObserver.disconnect(), e.lib.droppableObserver.disconnect(), e.lib.selectableAreaObserver.disconnect(), e.lib.overlaySizeObserver.disconnect();
|
|
710
845
|
} };
|
|
711
|
-
},
|
|
846
|
+
}, Ht = {
|
|
712
847
|
ArrowUp: { dx: 0, dy: -1 },
|
|
713
848
|
ArrowDown: { dx: 0, dy: 1 },
|
|
714
849
|
ArrowLeft: { dx: -1, dy: 0 },
|
|
@@ -717,73 +852,205 @@ const pt = (e) => {
|
|
|
717
852
|
KeyA: { dx: -1, dy: 0 },
|
|
718
853
|
KeyS: { dx: 0, dy: 1 },
|
|
719
854
|
KeyD: { dx: 1, dy: 0 }
|
|
720
|
-
},
|
|
855
|
+
}, Nt = (e) => (t) => {
|
|
721
856
|
const { keys: n } = e.keyboard;
|
|
722
857
|
if (n.pressedKeys.value.add(t.code), e.state.value === "dragging") {
|
|
723
858
|
if (n.forCancel.includes(t.code)) {
|
|
724
|
-
t.preventDefault(),
|
|
859
|
+
t.preventDefault(), le(), O(
|
|
860
|
+
e,
|
|
861
|
+
e.entities.initiatingDraggable,
|
|
862
|
+
"onSelfDragCancel"
|
|
863
|
+
), w(e, "onDragCancel"), Be(e, e.hovered), j(e);
|
|
725
864
|
return;
|
|
726
865
|
}
|
|
727
866
|
if (n.forDrop.includes(t.code)) {
|
|
728
|
-
t.preventDefault(), (async () => (await
|
|
867
|
+
t.preventDefault(), (async () => (await Oe(e) && ze(e), le(), j(e)))();
|
|
729
868
|
return;
|
|
730
869
|
}
|
|
731
|
-
const
|
|
732
|
-
if (
|
|
870
|
+
const s = Ht[t.code];
|
|
871
|
+
if (s && n.forMove.includes(t.code) && e.pointer.value) {
|
|
733
872
|
t.preventDefault();
|
|
734
|
-
const
|
|
873
|
+
const r = n.forMoveFaster.some(
|
|
874
|
+
(u) => n.pressedKeys.value.has(u)
|
|
875
|
+
), i = e.keyboard.step * (r ? e.keyboard.moveFaster : 1);
|
|
735
876
|
e.pointer.value.current = {
|
|
736
|
-
x: e.pointer.value.current.x +
|
|
737
|
-
y: e.pointer.value.current.y +
|
|
877
|
+
x: e.pointer.value.current.x + s.dx * i,
|
|
878
|
+
y: e.pointer.value.current.y + s.dy * i
|
|
738
879
|
};
|
|
739
|
-
const l = (e.collision?.run ??
|
|
740
|
-
|
|
880
|
+
const l = (e.collision?.run ?? ge)(e);
|
|
881
|
+
ue(e, e.hovered, l), O(
|
|
882
|
+
e,
|
|
883
|
+
e.entities.initiatingDraggable,
|
|
884
|
+
"onSelfDragMove"
|
|
885
|
+
), w(e, "onDragMove");
|
|
741
886
|
return;
|
|
742
887
|
}
|
|
743
888
|
return;
|
|
744
889
|
}
|
|
745
890
|
if (n.forDrag.includes(t.code)) {
|
|
746
|
-
const
|
|
747
|
-
if (!
|
|
748
|
-
const
|
|
749
|
-
|
|
891
|
+
const s = document.activeElement;
|
|
892
|
+
if (!s) return;
|
|
893
|
+
const r = s.closest(
|
|
894
|
+
H.DRAGGABLE
|
|
895
|
+
);
|
|
896
|
+
if (!r || e.entities.modifiersDraggableSet.size === 0 || !e.entities.modifiersDraggableSet.has(r))
|
|
750
897
|
return;
|
|
751
|
-
const
|
|
752
|
-
if (!
|
|
753
|
-
|
|
754
|
-
|
|
898
|
+
const i = e.entities.draggableMap.get(r);
|
|
899
|
+
if (!Pe(s, r, i?.dragHandle, !0))
|
|
900
|
+
return;
|
|
901
|
+
t.preventDefault(), ae();
|
|
902
|
+
const a = r.getBoundingClientRect(), l = a.left + a.width / 2, u = a.top + a.height / 2, d = {
|
|
755
903
|
clientX: l,
|
|
756
|
-
clientY:
|
|
904
|
+
clientY: u
|
|
757
905
|
};
|
|
758
|
-
e.entities.initiatingDraggable =
|
|
759
|
-
const
|
|
760
|
-
e.pointer.value =
|
|
761
|
-
|
|
762
|
-
|
|
906
|
+
e.entities.initiatingDraggable = r;
|
|
907
|
+
const c = ke(d, r);
|
|
908
|
+
e.pointer.value = ce(
|
|
909
|
+
d,
|
|
910
|
+
c.x,
|
|
911
|
+
c.y
|
|
912
|
+
), W(e);
|
|
913
|
+
const f = (e.collision?.run ?? ge)(e);
|
|
914
|
+
ue(e, e.hovered, f), O(e, r, "onSelfDragStart"), w(e, "onDragStart");
|
|
763
915
|
}
|
|
764
|
-
},
|
|
916
|
+
}, Yt = (e) => (t) => {
|
|
765
917
|
e.keyboard.keys.pressedKeys.value.delete(t.code);
|
|
766
|
-
},
|
|
918
|
+
}, Xt = (e) => () => {
|
|
767
919
|
e.keyboard.keys.pressedKeys.value.clear();
|
|
768
|
-
},
|
|
769
|
-
keyDown:
|
|
770
|
-
keyUp:
|
|
771
|
-
clear:
|
|
772
|
-
},
|
|
920
|
+
}, se = {
|
|
921
|
+
keyDown: Nt,
|
|
922
|
+
keyUp: Yt,
|
|
923
|
+
clear: Xt
|
|
924
|
+
}, Zt = (e) => () => {
|
|
773
925
|
e.state.value && (e.scrollPosition.x = window.scrollX, e.scrollPosition.y = window.scrollY);
|
|
774
|
-
},
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
926
|
+
}, A = 50, Ut = 144, Ee = 1e3 / Ut;
|
|
927
|
+
function $t(e) {
|
|
928
|
+
return e == null ? {
|
|
929
|
+
top: A,
|
|
930
|
+
right: A,
|
|
931
|
+
bottom: A,
|
|
932
|
+
left: A
|
|
933
|
+
} : typeof e == "number" ? {
|
|
934
|
+
top: e,
|
|
935
|
+
right: e,
|
|
936
|
+
bottom: e,
|
|
937
|
+
left: e
|
|
938
|
+
} : {
|
|
939
|
+
top: e.top ?? A,
|
|
940
|
+
right: e.right ?? A,
|
|
941
|
+
bottom: e.bottom ?? A,
|
|
942
|
+
left: e.left ?? A
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
const Vt = {
|
|
946
|
+
getScrollState(e) {
|
|
947
|
+
return {
|
|
948
|
+
scrollTop: e.scrollTop,
|
|
949
|
+
scrollLeft: e.scrollLeft,
|
|
950
|
+
rect: e.getBoundingClientRect()
|
|
951
|
+
};
|
|
952
|
+
},
|
|
953
|
+
setScroll(e, t, n) {
|
|
954
|
+
e.scrollTop = t, e.scrollLeft = n;
|
|
955
|
+
}
|
|
956
|
+
};
|
|
957
|
+
function Fe(e, t, n, o = Vt, s) {
|
|
958
|
+
const { speed: r = 10, disabled: i = !1 } = t, a = $t(t.threshold);
|
|
959
|
+
let l = null, u = null, d = null, c = 0, g = 0;
|
|
960
|
+
const f = (S) => {
|
|
961
|
+
s && (s.value = S);
|
|
962
|
+
}, y = (S) => {
|
|
963
|
+
const _ = e.value, E = n();
|
|
964
|
+
if (!_ || !E || i) {
|
|
965
|
+
f(!1);
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
u || (u = S);
|
|
969
|
+
const X = S - u;
|
|
970
|
+
if (X < Ee) {
|
|
971
|
+
l = requestAnimationFrame(y);
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
const h = r * (X / Ee);
|
|
975
|
+
u = S;
|
|
976
|
+
const {
|
|
977
|
+
scrollTop: v,
|
|
978
|
+
scrollLeft: G,
|
|
979
|
+
rect: Ge
|
|
980
|
+
} = o.getScrollState(_);
|
|
981
|
+
(!d || c !== v || g !== G) && (d = Ge, c = v, g = G);
|
|
982
|
+
let P = !1, ee = v, te = G;
|
|
983
|
+
a.top > 0 && E.y - d.top < a.top ? (ee = v - h, P = !0) : a.bottom > 0 && d.bottom - E.y < a.bottom && (ee = v + h, P = !0), a.left > 0 && E.x - d.left < a.left ? (te = G - h, P = !0) : a.right > 0 && d.right - E.x < a.right && (te = G + h, P = !0), P && o.setScroll(_, ee, te), f(P), l = requestAnimationFrame(y);
|
|
984
|
+
};
|
|
985
|
+
return { run: () => {
|
|
986
|
+
u = null, l = requestAnimationFrame(y);
|
|
987
|
+
}, stop: () => {
|
|
988
|
+
l && (cancelAnimationFrame(l), l = null), d = null, c = 0, g = 0, u = null, f(!1);
|
|
989
|
+
} };
|
|
990
|
+
}
|
|
991
|
+
const qt = {
|
|
992
|
+
getScrollState() {
|
|
993
|
+
return {
|
|
994
|
+
scrollTop: window.scrollY ?? document.documentElement.scrollTop,
|
|
995
|
+
scrollLeft: window.scrollX ?? document.documentElement.scrollLeft,
|
|
996
|
+
rect: new DOMRect(0, 0, window.innerWidth, window.innerHeight)
|
|
997
|
+
};
|
|
998
|
+
},
|
|
999
|
+
setScroll(e, t, n) {
|
|
1000
|
+
window.scrollTo(n, t);
|
|
1001
|
+
}
|
|
1002
|
+
}, Wt = {
|
|
1003
|
+
get value() {
|
|
1004
|
+
return typeof document < "u" ? document.documentElement : null;
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
function jt(e, t) {
|
|
1008
|
+
const n = V(!1), s = Fe(
|
|
1009
|
+
Wt,
|
|
1010
|
+
t ?? {},
|
|
1011
|
+
() => {
|
|
1012
|
+
if (e.state.value !== "dragging") return null;
|
|
1013
|
+
const a = e.overlay.position.value, l = e.overlay.size.value;
|
|
1014
|
+
return a ? l?.width && l?.height ? {
|
|
1015
|
+
x: a.x + l.width / 2,
|
|
1016
|
+
y: a.y + l.height / 2
|
|
1017
|
+
} : a : null;
|
|
1018
|
+
},
|
|
1019
|
+
qt,
|
|
1020
|
+
n
|
|
1021
|
+
), r = J(
|
|
1022
|
+
() => e.state.value,
|
|
1023
|
+
(a) => {
|
|
1024
|
+
a === "dragging" ? s.run() : s.stop();
|
|
1025
|
+
}
|
|
1026
|
+
), i = () => {
|
|
1027
|
+
r(), s.stop();
|
|
1028
|
+
};
|
|
1029
|
+
return Ie(i), { isScrolling: n, stop: i };
|
|
1030
|
+
}
|
|
1031
|
+
const Jt = (e) => {
|
|
1032
|
+
const t = Kt(e), n = se.keyDown(e), o = se.keyUp(e), s = se.clear(e), r = Zt(e);
|
|
1033
|
+
let i = null;
|
|
1034
|
+
J(
|
|
1035
|
+
e.autoScrollViewport,
|
|
1036
|
+
(a) => {
|
|
1037
|
+
i?.(), i = null, (a === !0 || a && typeof a == "object") && (i = jt(
|
|
1038
|
+
e,
|
|
1039
|
+
a === !0 ? {} : a
|
|
1040
|
+
).stop);
|
|
1041
|
+
},
|
|
1042
|
+
{ immediate: !0 }
|
|
1043
|
+
), N(() => {
|
|
1044
|
+
document.addEventListener("pointerdown", t.pointerDown), document.addEventListener("keydown", n), document.addEventListener("keyup", o), document.addEventListener("blur", s), document.addEventListener("scroll", r, !0);
|
|
1045
|
+
}), Y(() => {
|
|
1046
|
+
document.removeEventListener("pointerdown", t.pointerDown), document.removeEventListener("pointerup", t.pointerUp), document.removeEventListener("pointermove", t.pointerMove), document.removeEventListener("keydown", n), document.removeEventListener("keyup", o), document.removeEventListener("blur", s), document.removeEventListener("scroll", r, !0), i?.(), t.cleanup();
|
|
780
1047
|
});
|
|
781
|
-
},
|
|
782
|
-
const e =
|
|
1048
|
+
}, Q = () => {
|
|
1049
|
+
const e = xe(fe);
|
|
783
1050
|
if (!e) throw Error("DnD provider not found");
|
|
784
1051
|
return e;
|
|
785
|
-
},
|
|
786
|
-
const e =
|
|
1052
|
+
}, _e = () => {
|
|
1053
|
+
const e = Q();
|
|
787
1054
|
return {
|
|
788
1055
|
overlay: e.overlay,
|
|
789
1056
|
delay: e.delay,
|
|
@@ -794,82 +1061,118 @@ const pt = (e) => {
|
|
|
794
1061
|
scrollPosition: e.scrollPosition,
|
|
795
1062
|
keyboard: e.keyboard,
|
|
796
1063
|
hovered: e.hovered,
|
|
797
|
-
collision: e.collision
|
|
1064
|
+
collision: e.collision,
|
|
1065
|
+
autoScrollViewport: e.autoScrollViewport
|
|
798
1066
|
};
|
|
799
|
-
},
|
|
1067
|
+
}, Qt = /* @__PURE__ */ Ce({
|
|
800
1068
|
__name: "DefaultOverlay",
|
|
801
1069
|
setup(e) {
|
|
802
|
-
const { entities: t, state: n, overlay:
|
|
803
|
-
return (
|
|
1070
|
+
const { entities: t, state: n, overlay: o } = _e();
|
|
1071
|
+
return (s, r) => C(n) === "dragging" ? (x(), $("div", {
|
|
804
1072
|
key: 0,
|
|
805
1073
|
class: "dnd-kit-default-overlay",
|
|
806
|
-
style:
|
|
807
|
-
"--position-x":
|
|
808
|
-
"--position-y":
|
|
1074
|
+
style: ye({
|
|
1075
|
+
"--position-x": C(o).position.value.x + "px",
|
|
1076
|
+
"--position-y": C(o).position.value.y + "px"
|
|
809
1077
|
})
|
|
810
1078
|
}, [
|
|
811
|
-
(
|
|
812
|
-
|
|
813
|
-
key: 0,
|
|
814
|
-
class: "test"
|
|
815
|
-
})) : (p(), V(q(o.tagName), {
|
|
1079
|
+
(x(!0), $(ie, null, Ke(C(t).draggingMap, ([i, a]) => (x(), $(ie, null, [
|
|
1080
|
+
C(t).draggableMap.get(i)?.render ? (x(), q(re(C(t).draggableMap.get(i)?.render), { key: 0 })) : (x(), q(re(i.tagName), {
|
|
816
1081
|
key: 1,
|
|
817
|
-
innerHTML:
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
height: r.initialRect.height + "px"
|
|
1082
|
+
innerHTML: a.initialOuterHTML,
|
|
1083
|
+
style: ye({
|
|
1084
|
+
width: a.initialRect.width + "px",
|
|
1085
|
+
height: a.initialRect.height + "px"
|
|
822
1086
|
})
|
|
823
1087
|
}, null, 8, ["innerHTML", "style"]))
|
|
824
1088
|
], 64))), 256))
|
|
825
|
-
], 4)) :
|
|
1089
|
+
], 4)) : He("", !0);
|
|
826
1090
|
}
|
|
827
|
-
}),
|
|
1091
|
+
}), tn = /* @__PURE__ */ Ce({
|
|
828
1092
|
__name: "DnDProvider",
|
|
1093
|
+
props: {
|
|
1094
|
+
autoScrollViewport: { type: [Object, Boolean, null] },
|
|
1095
|
+
overlayTo: { type: [String, Boolean, null] }
|
|
1096
|
+
},
|
|
829
1097
|
setup(e) {
|
|
830
|
-
const t =
|
|
831
|
-
|
|
832
|
-
const s =
|
|
833
|
-
() =>
|
|
1098
|
+
const t = e, n = Ne("overlayRef"), o = ct(n, t);
|
|
1099
|
+
Jt(o);
|
|
1100
|
+
const s = m(
|
|
1101
|
+
() => o.overlay.render.value ?? Qt
|
|
834
1102
|
);
|
|
835
|
-
return
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
ref: t,
|
|
840
|
-
class: "dnd-kit-overlay-container"
|
|
1103
|
+
return Ye(fe, o), (r, i) => (x(), $(ie, null, [
|
|
1104
|
+
me(r.$slots, "default"),
|
|
1105
|
+
(x(), q(Xe, {
|
|
1106
|
+
to: C(o).overlay.to.value || "body"
|
|
841
1107
|
}, [
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1108
|
+
Ze("div", {
|
|
1109
|
+
ref_key: "overlayRef",
|
|
1110
|
+
ref: n,
|
|
1111
|
+
class: "dnd-kit-overlay-container"
|
|
1112
|
+
}, [
|
|
1113
|
+
me(r.$slots, "overlay", { overlay: s.value }, () => [
|
|
1114
|
+
(x(), q(re(s.value)))
|
|
1115
|
+
])
|
|
1116
|
+
], 512)
|
|
1117
|
+
], 8, ["to"]))
|
|
846
1118
|
], 64));
|
|
847
1119
|
}
|
|
848
1120
|
});
|
|
849
|
-
function
|
|
850
|
-
const
|
|
851
|
-
let
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
1121
|
+
function nn(e, t, n) {
|
|
1122
|
+
const o = Q();
|
|
1123
|
+
let s, r, i;
|
|
1124
|
+
typeof t == "function" ? (s = {}, r = t) : (s = t ?? {}, r = n);
|
|
1125
|
+
const a = m({
|
|
1126
|
+
get() {
|
|
1127
|
+
const c = p(e);
|
|
1128
|
+
return c ? o.entities.selectedSet.has(c) : !1;
|
|
1129
|
+
},
|
|
1130
|
+
set(c) {
|
|
1131
|
+
const g = p(e);
|
|
1132
|
+
g && o.entities.selectedSet[c ? "add" : "delete"](g);
|
|
1133
|
+
}
|
|
1134
|
+
}), l = m(() => {
|
|
1135
|
+
const c = p(e);
|
|
1136
|
+
return c ? o.entities.draggingMap.has(c) : !1;
|
|
1137
|
+
}), u = m(() => {
|
|
1138
|
+
const c = p(e);
|
|
1139
|
+
return c ? o.entities.allowedDraggableSet.has(c) : !1;
|
|
1140
|
+
}), d = m(() => {
|
|
1141
|
+
const c = p(e);
|
|
1142
|
+
return c ? o.hovered.draggable.get(c) : {
|
|
1143
|
+
bottom: !1,
|
|
1144
|
+
left: !1,
|
|
1145
|
+
right: !1,
|
|
1146
|
+
top: !1,
|
|
1147
|
+
center: !1
|
|
1148
|
+
};
|
|
1149
|
+
});
|
|
1150
|
+
return N(() => {
|
|
1151
|
+
i = p(e), i && (i.addEventListener("dragstart", D), i.addEventListener("drag", D), i.addEventListener("dragend", D), i.setAttribute(L.DRAGGABLE, ""), o.lib.draggableObserver.observe(i), o.entities.draggableMap.set(i, {
|
|
1152
|
+
render: s.render,
|
|
1153
|
+
disabled: s.disabled ?? !1,
|
|
1154
|
+
groups: s.groups ?? [],
|
|
1155
|
+
modifier: s.modifier,
|
|
1156
|
+
events: s.events,
|
|
1157
|
+
payload: r,
|
|
1158
|
+
dragHandle: s.dragHandle,
|
|
1159
|
+
activation: s.activation,
|
|
1160
|
+
placementMargins: s.placementMargins
|
|
863
1161
|
}));
|
|
864
|
-
}),
|
|
865
|
-
|
|
866
|
-
}), {
|
|
1162
|
+
}), Y(() => {
|
|
1163
|
+
i && (o.lib.draggableObserver.unobserve(i), o.entities.visibleDraggableSet.delete(i), o.entities.draggableMap.delete(i), o.entities.modifiersDraggableSet.delete(i));
|
|
1164
|
+
}), {
|
|
1165
|
+
selected: a,
|
|
1166
|
+
isDragging: l,
|
|
1167
|
+
isAllowed: u,
|
|
1168
|
+
isDragOver: d
|
|
1169
|
+
};
|
|
867
1170
|
}
|
|
868
|
-
const
|
|
869
|
-
const n =
|
|
870
|
-
let
|
|
871
|
-
|
|
872
|
-
|
|
1171
|
+
const on = (e, t) => {
|
|
1172
|
+
const n = Q(), o = m(() => e.value === n.entities.selectingArea);
|
|
1173
|
+
let s = null;
|
|
1174
|
+
N(() => {
|
|
1175
|
+
s = p(e), s && (s.setAttribute(L.SELECT_AREA, ""), n.lib.selectableAreaObserver.observe(s), n.entities.selectableAreaMap.set(s, {
|
|
873
1176
|
modifier: t?.modifier ?? {
|
|
874
1177
|
keys: ["ControlLeft"],
|
|
875
1178
|
method: "every"
|
|
@@ -878,51 +1181,107 @@ const Pt = (e, t) => {
|
|
|
878
1181
|
disabled: t?.disabled ?? !1,
|
|
879
1182
|
groups: t?.groups ?? []
|
|
880
1183
|
}));
|
|
881
|
-
}),
|
|
882
|
-
|
|
1184
|
+
}), Y(() => {
|
|
1185
|
+
s && (n.lib.selectableAreaObserver.unobserve(s), n.entities.visibleSelectableAreaSet.delete(s), n.entities.modifiersSelectableAreaSet.delete(s), n.entities.selectableAreaMap.delete(s));
|
|
883
1186
|
});
|
|
884
|
-
const
|
|
1187
|
+
const r = m(() => {
|
|
885
1188
|
n.scrollPosition.x, n.scrollPosition.y;
|
|
886
|
-
const
|
|
887
|
-
return !
|
|
1189
|
+
const i = n.pointer.value;
|
|
1190
|
+
return !i || n.state.value !== "selecting" || !s ? {} : bt(i.start, i.current, s);
|
|
888
1191
|
});
|
|
889
1192
|
return {
|
|
890
|
-
isSelecting:
|
|
891
|
-
style:
|
|
1193
|
+
isSelecting: o,
|
|
1194
|
+
style: r
|
|
892
1195
|
};
|
|
893
1196
|
};
|
|
894
|
-
function
|
|
895
|
-
const n =
|
|
1197
|
+
function sn(e, t) {
|
|
1198
|
+
const n = xe(fe);
|
|
896
1199
|
if (!n) throw Error("DnD provider not found");
|
|
897
|
-
let
|
|
898
|
-
return
|
|
899
|
-
|
|
1200
|
+
let o = null;
|
|
1201
|
+
return N(() => {
|
|
1202
|
+
o = p(e), o && (o.setAttribute(L.CONSTRAINT_AREA, ""), n.entities.constraintsAreaMap.set(o, {
|
|
900
1203
|
axis: t?.axis || "both",
|
|
901
1204
|
restrictToArea: t?.restrictToArea || !1
|
|
902
1205
|
}));
|
|
903
|
-
}),
|
|
904
|
-
|
|
1206
|
+
}), Y(() => {
|
|
1207
|
+
o && n.entities.constraintsAreaMap.delete(o);
|
|
905
1208
|
}), {};
|
|
906
1209
|
}
|
|
907
|
-
function
|
|
908
|
-
const
|
|
909
|
-
let s = null;
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1210
|
+
function rn(e, t, n) {
|
|
1211
|
+
const o = Q();
|
|
1212
|
+
let s = null, r, i;
|
|
1213
|
+
typeof t == "function" ? (r = {}, i = t) : (r = t ?? {}, i = n);
|
|
1214
|
+
const a = m(() => {
|
|
1215
|
+
const u = p(e);
|
|
1216
|
+
return u ? o.entities.allowedDroppableSet.has(u) : !1;
|
|
1217
|
+
}), l = m(() => {
|
|
1218
|
+
const u = p(e);
|
|
1219
|
+
return u ? o.hovered.droppable.get(u) : {
|
|
1220
|
+
bottom: !1,
|
|
1221
|
+
left: !1,
|
|
1222
|
+
right: !1,
|
|
1223
|
+
top: !1,
|
|
1224
|
+
center: !1
|
|
1225
|
+
};
|
|
1226
|
+
});
|
|
1227
|
+
return N(() => {
|
|
1228
|
+
s = p(e), s && (s.setAttribute(L.DROPPABLE, ""), o.lib.droppableObserver.observe(s), o.entities.droppableMap.set(s, {
|
|
1229
|
+
disabled: r.disabled ?? !1,
|
|
1230
|
+
groups: r.groups ?? [],
|
|
1231
|
+
events: r.events,
|
|
1232
|
+
payload: i
|
|
915
1233
|
}));
|
|
916
|
-
}),
|
|
917
|
-
s && (
|
|
1234
|
+
}), Y(() => {
|
|
1235
|
+
s && (o.lib.droppableObserver.unobserve(s), o.entities.visibleDroppableSet.delete(s), o.entities.droppableMap.delete(s));
|
|
1236
|
+
}), {
|
|
1237
|
+
isAllowed: a,
|
|
1238
|
+
isDragOver: l
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
const an = (e, t) => {
|
|
1242
|
+
const n = _e(), o = V(!1), r = Fe(
|
|
1243
|
+
e,
|
|
1244
|
+
t ?? {},
|
|
1245
|
+
() => {
|
|
1246
|
+
if (n.state.value !== "dragging") return null;
|
|
1247
|
+
const i = n.overlay.position.value, a = n.overlay.size.value;
|
|
1248
|
+
return i ? a?.width && a?.height ? {
|
|
1249
|
+
x: i.x + a.width / 2,
|
|
1250
|
+
y: i.y + a.height / 2
|
|
1251
|
+
} : i : null;
|
|
1252
|
+
},
|
|
1253
|
+
void 0,
|
|
1254
|
+
o
|
|
1255
|
+
);
|
|
1256
|
+
return J(
|
|
1257
|
+
() => n.state.value,
|
|
1258
|
+
(i) => {
|
|
1259
|
+
i === "dragging" ? r.run() : r.stop();
|
|
1260
|
+
}
|
|
1261
|
+
), { isScrolling: o };
|
|
1262
|
+
};
|
|
1263
|
+
function Ae(e, t) {
|
|
1264
|
+
return t <= 0 ? e : Math.round(e / t) * t;
|
|
1265
|
+
}
|
|
1266
|
+
function ln(e, t) {
|
|
1267
|
+
const n = t && "grid" in t && t.grid != null, o = t ? n ? t.grid : t.gridX : 1, s = t ? n ? t.grid : t.gridY : 1;
|
|
1268
|
+
return m(() => {
|
|
1269
|
+
const { x: r, y: i } = e.value;
|
|
1270
|
+
return {
|
|
1271
|
+
x: Ae(r, o),
|
|
1272
|
+
y: Ae(i, s)
|
|
1273
|
+
};
|
|
918
1274
|
});
|
|
919
1275
|
}
|
|
920
1276
|
export {
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1277
|
+
tn as DnDProvider,
|
|
1278
|
+
kt as createSensor,
|
|
1279
|
+
ge as defaultCollisionDetection,
|
|
1280
|
+
an as makeAutoScroll,
|
|
1281
|
+
sn as makeConstraintArea,
|
|
1282
|
+
nn as makeDraggable,
|
|
1283
|
+
rn as makeDroppable,
|
|
1284
|
+
on as makeSelectionArea,
|
|
1285
|
+
ln as makeSnappedOverlayPosition,
|
|
1286
|
+
_e as useDnDProvider
|
|
927
1287
|
};
|
|
928
|
-
//# sourceMappingURL=vue-dnd-kit-core.es.js.map
|