@vue-dnd-kit/core 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,153 +1,201 @@
1
1
  var ue = Object.defineProperty;
2
2
  var ce = (n, e, t) => e in n ? ue(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
3
  var b = (n, e, t) => ce(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { ref as K, computed as C, shallowRef as V, onMounted as q, onBeforeUnmount as G, defineComponent as oe, createElementBlock as F, createCommentVNode as ve, unref as W, openBlock as N, normalizeStyle as B, Fragment as de, renderList as ge, createBlock as fe, resolveDynamicComponent as me, createVNode as he, render as ee, useId as ye, markRaw as Ee } from "vue";
5
- import { createGlobalState as ie, useMagicKeys as pe, useThrottleFn as Me } from "@vueuse/core";
6
- const y = class y {
4
+ import { ref as K, computed as C, shallowRef as V, onMounted as q, onBeforeUnmount as G, defineComponent as oe, createElementBlock as F, createCommentVNode as ve, unref as W, openBlock as N, normalizeStyle as B, Fragment as de, renderList as ge, createBlock as fe, resolveDynamicComponent as me, createVNode as he, render as ee, useId as Ee, markRaw as ye } from "vue";
5
+ import { createGlobalState as ie, useMagicKeys as pe, useThrottleFn as xe } from "@vueuse/core";
6
+ const M = class M {
7
7
  };
8
- b(y, "remove", (e, t) => {
8
+ b(M, "remove", (e, t) => {
9
9
  if (!e || t === void 0) return;
10
10
  const [r] = e.splice(t, 1);
11
11
  return r;
12
- }), b(y, "insert", (e, t, r) => {
12
+ }), b(M, "insert", (e, t, r) => {
13
13
  !e || t === void 0 || e.splice(t, 0, r);
14
- }), b(y, "move", (e, t, r, a) => {
15
- if (!e || !r || t === void 0 || a === void 0)
14
+ }), b(M, "move", (e, t, r, l) => {
15
+ if (!e || !r || t === void 0 || l === void 0)
16
16
  return;
17
- const o = y.remove(e, t);
18
- y.insert(r, a, o);
19
- }), b(y, "swap", (e, t, r, a) => {
20
- if (!e || !r || t === void 0 || a === void 0)
17
+ const o = M.remove(e, t);
18
+ M.insert(r, l, o);
19
+ }), b(M, "swap", (e, t, r, l) => {
20
+ if (!e || !r || t === void 0 || l === void 0)
21
21
  return;
22
- const o = e[t], l = r[a];
23
- e[t] = l, r[a] = o;
24
- }), b(y, "copy", (e, t, r, a) => {
25
- if (!e || t === void 0 || !r || a === void 0)
22
+ const o = e[t], s = r[l];
23
+ e[t] = s, r[l] = o;
24
+ }), b(M, "copy", (e, t, r, l) => {
25
+ if (!e || t === void 0 || !r || l === void 0)
26
26
  return;
27
27
  const o = e[t];
28
- y.insert(r, a, o);
29
- }), b(y, "applyTransfer", (e) => {
28
+ M.insert(r, l, o);
29
+ }), b(M, "applyTransfer", (e) => {
30
+ var l, o, s, d, i, c, g;
30
31
  const t = e.hovered.element.value, r = e.hovered.zone.value;
31
- t ? e.draggingElements.value.forEach(
32
- (a) => {
33
- var o, l, c, s, i, u;
34
- return y.move(
35
- (o = a.data) == null ? void 0 : o.source,
36
- (l = a.data) == null ? void 0 : l.index,
37
- (s = (c = e.elementsMap.value.get(t)) == null ? void 0 : c.data) == null ? void 0 : s.source,
38
- (u = (i = e.elementsMap.value.get(t)) == null ? void 0 : i.data) == null ? void 0 : u.index
39
- );
40
- }
41
- ) : r && e.draggingElements.value.forEach(
42
- (a) => {
43
- var o, l, c, s, i, u, d;
44
- return y.move(
45
- (o = a.data) == null ? void 0 : o.source,
46
- (l = a.data) == null ? void 0 : l.index,
47
- (s = (c = e.zonesMap.value.get(r)) == null ? void 0 : c.data) == null ? void 0 : s.source,
48
- (d = (u = (i = e.zonesMap.value.get(r)) == null ? void 0 : i.data) == null ? void 0 : u.source) == null ? void 0 : d.length
49
- );
50
- }
51
- );
52
- }), b(y, "applyCopy", (e) => {
32
+ if (t) {
33
+ const u = (o = (l = e.elementsMap.value.get(t)) == null ? void 0 : l.data) == null ? void 0 : o.source, a = (d = (s = e.elementsMap.value.get(t)) == null ? void 0 : s.data) == null ? void 0 : d.index, v = e.draggingElements.value.values().next().value, f = (i = v == null ? void 0 : v.data) == null ? void 0 : i.index, m = f !== void 0 && a !== void 0 && f > a ? 1 : -1;
34
+ Array.from(
35
+ e.draggingElements.value.values()
36
+ ).sort(
37
+ (E, x) => {
38
+ var p, z;
39
+ return m * ((((p = E.data) == null ? void 0 : p.index) || 0) - (((z = x.data) == null ? void 0 : z.index) || 0));
40
+ }
41
+ ).forEach(
42
+ (E) => {
43
+ var x, p;
44
+ return M.move(
45
+ (x = E.data) == null ? void 0 : x.source,
46
+ (p = E.data) == null ? void 0 : p.index,
47
+ u,
48
+ a
49
+ );
50
+ }
51
+ );
52
+ } else if (r) {
53
+ const u = (g = (c = e.zonesMap.value.get(r)) == null ? void 0 : c.data) == null ? void 0 : g.source, a = u == null ? void 0 : u.length;
54
+ Array.from(
55
+ e.draggingElements.value.values()
56
+ ).sort((f, m) => {
57
+ var y, E;
58
+ return (((y = m.data) == null ? void 0 : y.index) || 0) - (((E = f.data) == null ? void 0 : E.index) || 0);
59
+ }).forEach(
60
+ (f) => {
61
+ var m, y;
62
+ return M.move(
63
+ (m = f.data) == null ? void 0 : m.source,
64
+ (y = f.data) == null ? void 0 : y.index,
65
+ u,
66
+ a
67
+ );
68
+ }
69
+ );
70
+ }
71
+ }), b(M, "applyCopy", (e) => {
72
+ var l, o, s, d, i, c, g;
53
73
  const t = e.hovered.element.value, r = e.hovered.zone.value;
54
- t ? e.draggingElements.value.forEach(
55
- (a) => {
56
- var o, l, c, s, i, u;
57
- return y.copy(
58
- (o = a.data) == null ? void 0 : o.source,
59
- (l = a.data) == null ? void 0 : l.index,
60
- (s = (c = e.elementsMap.value.get(t)) == null ? void 0 : c.data) == null ? void 0 : s.source,
61
- (u = (i = e.elementsMap.value.get(t)) == null ? void 0 : i.data) == null ? void 0 : u.index
62
- );
63
- }
64
- ) : r && e.draggingElements.value.forEach(
65
- (a) => {
66
- var o, l, c, s, i, u, d;
67
- return y.copy(
68
- (o = a.data) == null ? void 0 : o.source,
69
- (l = a.data) == null ? void 0 : l.index,
70
- (s = (c = e.zonesMap.value.get(r)) == null ? void 0 : c.data) == null ? void 0 : s.source,
71
- (d = (u = (i = e.zonesMap.value.get(r)) == null ? void 0 : i.data) == null ? void 0 : u.source) == null ? void 0 : d.length
72
- );
73
- }
74
- );
75
- }), b(y, "applySwap", (e) => {
76
- var a, o, l, c, s, i;
74
+ if (t) {
75
+ const u = (o = (l = e.elementsMap.value.get(t)) == null ? void 0 : l.data) == null ? void 0 : o.source, a = (d = (s = e.elementsMap.value.get(t)) == null ? void 0 : s.data) == null ? void 0 : d.index, v = e.draggingElements.value.values().next().value, f = (i = v == null ? void 0 : v.data) == null ? void 0 : i.index, m = f !== void 0 && a !== void 0 && f > a ? 1 : -1;
76
+ Array.from(
77
+ e.draggingElements.value.values()
78
+ ).sort(
79
+ (E, x) => {
80
+ var p, z;
81
+ return m * ((((p = E.data) == null ? void 0 : p.index) || 0) - (((z = x.data) == null ? void 0 : z.index) || 0));
82
+ }
83
+ ).forEach(
84
+ (E) => {
85
+ var x, p;
86
+ return M.copy(
87
+ (x = E.data) == null ? void 0 : x.source,
88
+ (p = E.data) == null ? void 0 : p.index,
89
+ u,
90
+ a
91
+ );
92
+ }
93
+ );
94
+ } else if (r) {
95
+ const u = (g = (c = e.zonesMap.value.get(r)) == null ? void 0 : c.data) == null ? void 0 : g.source, a = u == null ? void 0 : u.length;
96
+ Array.from(
97
+ e.draggingElements.value.values()
98
+ ).sort((f, m) => {
99
+ var y, E;
100
+ return (((y = m.data) == null ? void 0 : y.index) || 0) - (((E = f.data) == null ? void 0 : E.index) || 0);
101
+ }).forEach(
102
+ (f) => {
103
+ var m, y;
104
+ return M.copy(
105
+ (m = f.data) == null ? void 0 : m.source,
106
+ (y = f.data) == null ? void 0 : y.index,
107
+ u,
108
+ a
109
+ );
110
+ }
111
+ );
112
+ }
113
+ }), b(M, "applySwap", (e) => {
114
+ var l, o, s, d, i, c, g, u;
77
115
  const t = e.hovered.element.value, r = e.hovered.zone.value;
78
116
  if (t && e.draggingElements.value.size === 1) {
79
- const u = e.draggingElements.value.values().next().value;
80
- y.swap(
81
- (a = u == null ? void 0 : u.data) == null ? void 0 : a.source,
82
- (o = u == null ? void 0 : u.data) == null ? void 0 : o.index,
83
- (c = (l = e.elementsMap.value.get(t)) == null ? void 0 : l.data) == null ? void 0 : c.source,
84
- (i = (s = e.elementsMap.value.get(t)) == null ? void 0 : s.data) == null ? void 0 : i.index
85
- );
86
- } else r && e.draggingElements.value.forEach(
87
- (u) => {
88
- var d, v, g, m, h, z, w;
89
- return y.move(
90
- (d = u.data) == null ? void 0 : d.source,
91
- (v = u.data) == null ? void 0 : v.index,
92
- (m = (g = e.zonesMap.value.get(r)) == null ? void 0 : g.data) == null ? void 0 : m.source,
93
- (w = (z = (h = e.zonesMap.value.get(r)) == null ? void 0 : h.data) == null ? void 0 : z.source) == null ? void 0 : w.length
94
- );
95
- }
96
- );
97
- }), b(y, "applyRemove", (e) => {
98
- e.draggingElements.value.forEach((t) => {
99
- var r, a;
100
- (r = t.data) != null && r.source && ((a = t.data) == null ? void 0 : a.index) !== void 0 && y.remove(t.data.source, t.data.index);
101
- });
102
- }), b(y, "applyInsert", (e, t) => {
103
- const r = e.hovered.element.value, a = e.hovered.zone.value;
104
- r && t.length > 0 ? t.forEach((o) => {
105
- var l, c, s, i;
106
- y.insert(
107
- (c = (l = e.elementsMap.value.get(r)) == null ? void 0 : l.data) == null ? void 0 : c.source,
108
- (i = (s = e.elementsMap.value.get(r)) == null ? void 0 : s.data) == null ? void 0 : i.index,
109
- o
117
+ const a = e.draggingElements.value.values().next().value;
118
+ M.swap(
119
+ (l = a == null ? void 0 : a.data) == null ? void 0 : l.source,
120
+ (o = a == null ? void 0 : a.data) == null ? void 0 : o.index,
121
+ (d = (s = e.elementsMap.value.get(t)) == null ? void 0 : s.data) == null ? void 0 : d.source,
122
+ (c = (i = e.elementsMap.value.get(t)) == null ? void 0 : i.data) == null ? void 0 : c.index
110
123
  );
111
- }) : a && t.forEach((o) => {
112
- var l, c, s, i, u;
113
- y.insert(
114
- (c = (l = e.zonesMap.value.get(a)) == null ? void 0 : l.data) == null ? void 0 : c.source,
115
- (u = (i = (s = e.zonesMap.value.get(a)) == null ? void 0 : s.data) == null ? void 0 : i.source) == null ? void 0 : u.length,
116
- o
124
+ } else if (r) {
125
+ const a = (u = (g = e.zonesMap.value.get(r)) == null ? void 0 : g.data) == null ? void 0 : u.source, v = a == null ? void 0 : a.length;
126
+ Array.from(
127
+ e.draggingElements.value.values()
128
+ ).sort((m, y) => {
129
+ var E, x;
130
+ return (((E = y.data) == null ? void 0 : E.index) || 0) - (((x = m.data) == null ? void 0 : x.index) || 0);
131
+ }).forEach(
132
+ (m) => {
133
+ var y, E;
134
+ return M.move(
135
+ (y = m.data) == null ? void 0 : y.source,
136
+ (E = m.data) == null ? void 0 : E.index,
137
+ a,
138
+ v
139
+ );
140
+ }
117
141
  );
142
+ }
143
+ }), b(M, "applyRemove", (e) => {
144
+ Array.from(
145
+ e.draggingElements.value.values()
146
+ ).sort((r, l) => {
147
+ var o, s;
148
+ return (((o = l.data) == null ? void 0 : o.index) || 0) - (((s = r.data) == null ? void 0 : s.index) || 0);
149
+ }).forEach((r) => {
150
+ var l, o;
151
+ (l = r.data) != null && l.source && ((o = r.data) == null ? void 0 : o.index) !== void 0 && M.remove(r.data.source, r.data.index);
118
152
  });
153
+ }), b(M, "applyInsert", (e, t) => {
154
+ var o, s, d, i, c, g;
155
+ const r = e.hovered.element.value, l = e.hovered.zone.value;
156
+ if (r && t.length > 0) {
157
+ const u = (s = (o = e.elementsMap.value.get(r)) == null ? void 0 : o.data) == null ? void 0 : s.source, a = (i = (d = e.elementsMap.value.get(r)) == null ? void 0 : d.data) == null ? void 0 : i.index;
158
+ t.forEach((v) => {
159
+ M.insert(u, a, v);
160
+ });
161
+ } else if (l) {
162
+ const u = (g = (c = e.zonesMap.value.get(l)) == null ? void 0 : c.data) == null ? void 0 : g.source, a = u == null ? void 0 : u.length;
163
+ t.forEach((v) => {
164
+ M.insert(u, a, v);
165
+ });
166
+ }
119
167
  });
120
- let te = y;
168
+ let te = M;
121
169
  const T = ie(() => {
122
170
  const n = K(
123
171
  /* @__PURE__ */ new Map()
124
172
  ), e = C(() => n.value.size > 0), t = {
125
173
  component: K(null),
126
174
  ref: V(null)
127
- }, r = K(/* @__PURE__ */ new Map()), a = K(
175
+ }, r = K(/* @__PURE__ */ new Map()), l = K(
128
176
  /* @__PURE__ */ new Map()
129
- ), o = K(/* @__PURE__ */ new Map()), l = K(/* @__PURE__ */ new Set()), c = K(/* @__PURE__ */ new Set()), s = new IntersectionObserver((Z) => {
177
+ ), o = K(/* @__PURE__ */ new Map()), s = K(/* @__PURE__ */ new Set()), d = K(/* @__PURE__ */ new Set()), i = new IntersectionObserver((Z) => {
130
178
  Z.forEach(
131
- (f) => c.value[f.isIntersecting ? "add" : "delete"](
132
- f.target
179
+ (h) => d.value[h.isIntersecting ? "add" : "delete"](
180
+ h.target
133
181
  )
134
182
  );
135
- }), i = new IntersectionObserver((Z) => {
183
+ }), c = new IntersectionObserver((Z) => {
136
184
  Z.forEach(
137
- (f) => l.value[f.isIntersecting ? "add" : "delete"](f.target)
185
+ (h) => s.value[h.isIntersecting ? "add" : "delete"](h.target)
138
186
  );
139
- }), u = (Z, f) => {
140
- Z === "add" ? s.observe(f) : (s.unobserve(f), c.value.delete(f));
141
- }, d = (Z, f) => {
142
- Z === "add" ? i.observe(f) : (i.unobserve(f), l.value.delete(f));
143
- }, v = {
187
+ }), g = (Z, h) => {
188
+ Z === "add" ? i.observe(h) : (i.unobserve(h), d.value.delete(h));
189
+ }, u = (Z, h) => {
190
+ Z === "add" ? c.observe(h) : (c.unobserve(h), s.value.delete(h));
191
+ }, a = {
144
192
  start: V(null),
145
193
  current: V(null),
146
194
  offset: {
147
195
  percent: V(null),
148
196
  pixel: V(null)
149
197
  }
150
- }, { w: g, s: m, a: h, d: z, ctrl: w, shift: _, alt: P, meta: A } = pe(), U = {
198
+ }, { w: v, s: f, a: m, d: y, ctrl: E, shift: x, alt: p, meta: z } = pe(), U = {
151
199
  zone: V(null),
152
200
  element: V(null)
153
201
  };
@@ -156,44 +204,44 @@ const T = ie(() => {
156
204
  isDragging: e,
157
205
  activeContainer: t,
158
206
  elementsMap: r,
159
- selectedElementsMap: a,
207
+ selectedElementsMap: l,
160
208
  zonesMap: o,
161
- visibleZones: l,
162
- visibleElements: c,
163
- pointerPosition: v,
209
+ visibleZones: s,
210
+ visibleElements: d,
211
+ pointerPosition: a,
164
212
  keyboard: {
165
- w: g,
166
- s: m,
167
- a: h,
168
- d: z,
169
- ctrl: w,
170
- shift: _,
171
- alt: P,
172
- meta: A
213
+ w: v,
214
+ s: f,
215
+ a: m,
216
+ d: y,
217
+ ctrl: E,
218
+ shift: x,
219
+ alt: p,
220
+ meta: z
173
221
  },
174
222
  hovered: U,
175
- handleDragElementIntersection: u,
176
- handleDropZoneIntersection: d
223
+ handleDragElementIntersection: g,
224
+ handleDropZoneIntersection: u
177
225
  };
178
- }), we = () => {
179
- const n = K(null), { draggingElements: e, pointerPosition: t, isDragging: r, activeContainer: a } = T();
226
+ }), Me = () => {
227
+ const n = K(null), { draggingElements: e, pointerPosition: t, isDragging: r, activeContainer: l } = T();
180
228
  return q(() => {
181
- a.ref = n;
229
+ l.ref = n;
182
230
  }), G(() => {
183
- a.ref.value = null;
231
+ l.ref.value = null;
184
232
  }), {
185
233
  elementRef: n,
186
234
  draggingElements: e,
187
235
  pointerPosition: t,
188
236
  isDragging: r
189
237
  };
190
- }, Pe = ["innerHTML"], xe = /* @__PURE__ */ oe({
238
+ }, we = ["innerHTML"], Pe = /* @__PURE__ */ oe({
191
239
  __name: "DefaultOverlay",
192
240
  setup(n) {
193
- const { elementRef: e, pointerPosition: t, isDragging: r, draggingElements: a } = we(), o = C(() => {
194
- var l, c, s, i;
241
+ const { elementRef: e, pointerPosition: t, isDragging: r, draggingElements: l } = Me(), o = C(() => {
242
+ var s, d, i, c;
195
243
  return {
196
- transform: `translate3d(${(((l = t.current.value) == null ? void 0 : l.x) ?? 0) - (((c = t.offset.pixel.value) == null ? void 0 : c.x) ?? 0)}px, ${(((s = t.current.value) == null ? void 0 : s.y) ?? 0) - (((i = t.offset.pixel.value) == null ? void 0 : i.y) ?? 0)}px, 0)`,
244
+ transform: `translate3d(${(((s = t.current.value) == null ? void 0 : s.x) ?? 0) - (((d = t.offset.pixel.value) == null ? void 0 : d.x) ?? 0)}px, ${(((i = t.current.value) == null ? void 0 : i.y) ?? 0) - (((c = t.offset.pixel.value) == null ? void 0 : c.y) ?? 0)}px, 0)`,
197
245
  zIndex: 1e3,
198
246
  position: "fixed",
199
247
  top: 0,
@@ -201,22 +249,22 @@ const T = ie(() => {
201
249
  transition: "0.3s cubic-bezier(0.165, 0.84, 0.44, 1)"
202
250
  };
203
251
  });
204
- return (l, c) => W(r) ? (N(), F("div", {
252
+ return (s, d) => W(r) ? (N(), F("div", {
205
253
  key: 0,
206
254
  ref_key: "elementRef",
207
255
  ref: e,
208
256
  style: B(o.value)
209
257
  }, [
210
- (N(!0), F(de, null, ge(W(a), ([s, i]) => {
211
- var u, d;
258
+ (N(!0), F(de, null, ge(W(l), ([i, c]) => {
259
+ var g, u;
212
260
  return N(), F("div", {
213
- key: i.id,
214
- innerHTML: i.initialHTML,
261
+ key: c.id,
262
+ innerHTML: c.initialHTML,
215
263
  style: B({
216
- width: `${(u = i.initialRect) == null ? void 0 : u.width}px`,
217
- height: `${(d = i.initialRect) == null ? void 0 : d.height}px`
264
+ width: `${(g = c.initialRect) == null ? void 0 : g.width}px`,
265
+ height: `${(u = c.initialRect) == null ? void 0 : u.height}px`
218
266
  })
219
- }, null, 12, Pe);
267
+ }, null, 12, we);
220
268
  }), 128))
221
269
  ], 4)) : ve("", !0);
222
270
  }
@@ -224,26 +272,26 @@ const T = ie(() => {
224
272
  __name: "DragOverlay",
225
273
  setup(n) {
226
274
  const { activeContainer: e } = T(), t = C(
227
- () => e.component.value ?? xe
275
+ () => e.component.value ?? Pe
228
276
  );
229
- return (r, a) => (N(), fe(me(t.value)));
277
+ return (r, l) => (N(), fe(me(t.value)));
230
278
  }
231
279
  }), Ke = {
232
280
  install(n) {
233
281
  n.component("DragOverlay", ne);
234
282
  const e = n.mount;
235
283
  n.mount = function(r) {
236
- const a = e.call(this, r), o = typeof r == "string" ? document.querySelector(r) : r;
284
+ const l = e.call(this, r), o = typeof r == "string" ? document.querySelector(r) : r;
237
285
  if (o && o instanceof Element && !o.querySelector("#vue-dnd-kit-overlay")) {
238
- const l = document.createElement("div");
239
- l.id = "vue-dnd-kit-overlay", l.style.pointerEvents = "none", o.appendChild(l);
240
- const c = he(ne);
241
- ee(c, l), n.__VUE_DND_KIT_OVERLAY__ = {
242
- container: l,
243
- vnode: c
286
+ const s = document.createElement("div");
287
+ s.id = "vue-dnd-kit-overlay", s.style.pointerEvents = "none", o.appendChild(s);
288
+ const d = he(ne);
289
+ ee(d, s), n.__VUE_DND_KIT_OVERLAY__ = {
290
+ container: s,
291
+ vnode: d
244
292
  };
245
293
  }
246
- return a;
294
+ return l;
247
295
  };
248
296
  const t = n.unmount;
249
297
  n.unmount = function() {
@@ -298,130 +346,130 @@ const T = ie(() => {
298
346
  ), r = Math.max(
299
347
  0,
300
348
  Math.min(n.y + n.height, e.y + e.height) - Math.max(n.y, e.y)
301
- ), a = t * r, o = n.width * n.height, l = e.width * e.height;
302
- return (a / o * 100 + a / l * 100) / 2;
303
- }, se = "data-vue-dnd-kit-draggable", S = (n) => {
349
+ ), l = t * r, o = n.width * n.height, s = e.width * e.height;
350
+ return (l / o * 100 + l / s * 100) / 2;
351
+ }, se = "data-vue-dnd-kit-draggable", _ = (n) => {
304
352
  n.preventDefault();
305
- }, ze = (n) => {
353
+ }, Ie = (n) => {
306
354
  const {
307
355
  elementsMap: e,
308
356
  draggingElements: t,
309
357
  hovered: r,
310
- selectedElementsMap: a,
358
+ selectedElementsMap: l,
311
359
  isDragging: o,
312
- visibleElements: l,
313
- handleDragElementIntersection: c
314
- } = T(), s = K(null), i = C(
315
- () => l.value.has(s.value) && r.element.value === s.value
316
- ), u = V((n == null ? void 0 : n.id) || ye()), d = C(() => !s.value || !l.value.has(s.value) ? !1 : t.value.has(s.value)), v = C(() => {
317
- if (!s.value || !o.value || !l.value.has(s.value)) return !1;
318
- const h = e.value.get(s.value);
319
- return h != null && h.groups.length ? !Array.from(t.value.entries()).some(
320
- ([z, w]) => w.groups.length ? !w.groups.some(
321
- (_) => h.groups.includes(_)
360
+ visibleElements: s,
361
+ handleDragElementIntersection: d
362
+ } = T(), i = K(null), c = C(
363
+ () => s.value.has(i.value) && r.element.value === i.value
364
+ ), g = V((n == null ? void 0 : n.id) || Ee()), u = C(() => !i.value || !s.value.has(i.value) ? !1 : t.value.has(i.value)), a = C(() => {
365
+ if (!i.value || !o.value || !s.value.has(i.value)) return !1;
366
+ const m = e.value.get(i.value);
367
+ return m != null && m.groups.length ? !Array.from(t.value.entries()).some(
368
+ ([y, E]) => E.groups.length ? !E.groups.some(
369
+ (x) => m.groups.includes(x)
322
370
  ) : !1
323
371
  ) : !0;
324
372
  });
325
373
  return {
326
- elementRef: s,
374
+ elementRef: i,
327
375
  registerElement: () => {
328
- if (!s.value) throw new Error("ElementRef is not set");
329
- e.value.set(s.value, {
330
- node: s.value,
376
+ if (!i.value) throw new Error("ElementRef is not set");
377
+ e.value.set(i.value, {
378
+ node: i.value,
331
379
  groups: (n == null ? void 0 : n.groups) ?? [],
332
380
  layer: (n == null ? void 0 : n.layer) ?? null,
333
381
  defaultLayer: (n == null ? void 0 : n.layer) ?? null,
334
382
  events: (n == null ? void 0 : n.events) ?? {},
335
383
  data: (n == null ? void 0 : n.data) ?? null,
336
- id: u.value
337
- }), c("add", s.value), s.value.addEventListener("dragstart", S), s.value.addEventListener("drag", S), s.value.setAttribute(se, "true"), s.value.setAttribute("draggable", "false");
384
+ id: g.value
385
+ }), d("add", i.value), i.value.addEventListener("dragstart", _), i.value.addEventListener("drag", _), i.value.setAttribute(se, "true"), i.value.setAttribute("draggable", "false");
338
386
  },
339
387
  unregisterElement: () => {
340
- s.value && (e.value.delete(s.value), a.value.delete(s.value), s.value.removeEventListener("dragstart", S), s.value.removeEventListener("drag", S), s.value.removeAttribute(se), s.value.removeAttribute("draggable"));
388
+ i.value && (e.value.delete(i.value), l.value.delete(i.value), i.value.removeEventListener("dragstart", _), i.value.removeEventListener("drag", _), i.value.removeAttribute(se), i.value.removeAttribute("draggable"));
341
389
  },
342
- isDragging: d,
343
- isOvered: i,
344
- isAllowed: v,
345
- id: u
390
+ isDragging: u,
391
+ isOvered: c,
392
+ isAllowed: a,
393
+ id: g
346
394
  };
347
- }, k = (n, e) => n ? e.contains(n) : !1, Se = (n) => {
348
- var u, d;
349
- const e = R(n.activeContainer.ref.value), t = $(e), r = ((u = n.pointerPosition.current.value) == null ? void 0 : u.x) ?? 0, a = ((d = n.pointerPosition.current.value) == null ? void 0 : d.y) ?? 0, l = !(e && r >= e.x && r <= e.x + e.width && a >= e.y && a <= e.y + e.height), c = Array.from(n.draggingElements.value.keys()), s = Array.from(n.visibleElements.value.entries()).filter(([v, g]) => {
350
- if (!v) return !1;
351
- const m = R(v);
352
- return m && e && re(m, e);
353
- }).map(([v, g]) => {
354
- const m = R(v), h = $(m), z = r >= m.x && r <= m.x + m.width && a >= m.y && a <= m.y + m.height, w = le(m, e), _ = ae(t, h);
355
- let P = 0;
356
- for (const [A, U] of n.visibleElements.value.entries())
357
- A !== v && A && v && k(v, A) && P++;
395
+ }, k = (n, e) => n ? e.contains(n) : !1, ze = (n) => {
396
+ var g, u;
397
+ const e = R(n.activeContainer.ref.value), t = $(e), r = ((g = n.pointerPosition.current.value) == null ? void 0 : g.x) ?? 0, l = ((u = n.pointerPosition.current.value) == null ? void 0 : u.y) ?? 0, s = !(e && r >= e.x && r <= e.x + e.width && l >= e.y && l <= e.y + e.height), d = Array.from(n.draggingElements.value.keys()), i = Array.from(n.visibleElements.value.entries()).filter(([a, v]) => {
398
+ if (!a) return !1;
399
+ const f = R(a);
400
+ return f && e && re(f, e);
401
+ }).map(([a, v]) => {
402
+ const f = R(a), m = $(f), y = r >= f.x && r <= f.x + f.width && l >= f.y && l <= f.y + f.height, E = le(f, e), x = ae(t, m);
403
+ let p = 0;
404
+ for (const [z, U] of n.visibleElements.value.entries())
405
+ z !== a && z && a && k(a, z) && p++;
358
406
  return {
359
- element: g,
360
- node: v,
361
- isPointerInElement: z,
362
- overlapPercent: w,
363
- depth: P,
364
- centerDistance: _
407
+ element: v,
408
+ node: a,
409
+ isPointerInElement: y,
410
+ overlapPercent: E,
411
+ depth: p,
412
+ centerDistance: x
365
413
  };
366
- }).sort((v, g) => {
367
- if (!l) {
368
- if (v.isPointerInElement && g.isPointerInElement)
369
- return g.depth - v.depth;
370
- if (v.isPointerInElement !== g.isPointerInElement)
371
- return v.isPointerInElement ? -1 : 1;
414
+ }).sort((a, v) => {
415
+ if (!s) {
416
+ if (a.isPointerInElement && v.isPointerInElement)
417
+ return v.depth - a.depth;
418
+ if (a.isPointerInElement !== v.isPointerInElement)
419
+ return a.isPointerInElement ? -1 : 1;
372
420
  }
373
- return Math.abs(v.overlapPercent - g.overlapPercent) <= 1 ? v.centerDistance - g.centerDistance : g.overlapPercent - v.overlapPercent;
374
- }), i = Array.from(n.visibleZones.value.entries()).filter(([v, g]) => {
375
- if (!v || c.some(
376
- (h) => h && k(v, h)
421
+ return Math.abs(a.overlapPercent - v.overlapPercent) <= 1 ? a.centerDistance - v.centerDistance : v.overlapPercent - a.overlapPercent;
422
+ }), c = Array.from(n.visibleZones.value.entries()).filter(([a, v]) => {
423
+ if (!a || d.some(
424
+ (m) => m && k(a, m)
377
425
  ))
378
426
  return !1;
379
- const m = R(v);
380
- return m && e && re(m, e);
381
- }).map(([v, g]) => {
382
- const m = R(v), h = $(m), z = r >= m.x && r <= m.x + m.width && a >= m.y && a <= m.y + m.height, w = le(m, e), _ = ae(t, h);
383
- let P = 0;
384
- for (const [A, U] of n.visibleZones.value.entries())
385
- A !== v && A && v && k(v, A) && P++;
427
+ const f = R(a);
428
+ return f && e && re(f, e);
429
+ }).map(([a, v]) => {
430
+ const f = R(a), m = $(f), y = r >= f.x && r <= f.x + f.width && l >= f.y && l <= f.y + f.height, E = le(f, e), x = ae(t, m);
431
+ let p = 0;
432
+ for (const [z, U] of n.visibleZones.value.entries())
433
+ z !== a && z && a && k(a, z) && p++;
386
434
  return {
387
- zone: g,
388
- node: v,
389
- isPointerInElement: z,
390
- overlapPercent: w,
391
- depth: P,
392
- centerDistance: _
435
+ zone: v,
436
+ node: a,
437
+ isPointerInElement: y,
438
+ overlapPercent: E,
439
+ depth: p,
440
+ centerDistance: x
393
441
  };
394
- }).sort((v, g) => {
395
- if (!l) {
396
- if (v.isPointerInElement && g.isPointerInElement)
397
- return g.depth - v.depth;
398
- if (v.isPointerInElement !== g.isPointerInElement)
399
- return v.isPointerInElement ? -1 : 1;
442
+ }).sort((a, v) => {
443
+ if (!s) {
444
+ if (a.isPointerInElement && v.isPointerInElement)
445
+ return v.depth - a.depth;
446
+ if (a.isPointerInElement !== v.isPointerInElement)
447
+ return a.isPointerInElement ? -1 : 1;
400
448
  }
401
- return Math.abs(v.overlapPercent - g.overlapPercent) <= 1 ? v.centerDistance - g.centerDistance : g.overlapPercent - v.overlapPercent;
449
+ return Math.abs(a.overlapPercent - v.overlapPercent) <= 1 ? a.centerDistance - v.centerDistance : v.overlapPercent - a.overlapPercent;
402
450
  });
403
451
  return [
404
- ...s.map((v) => v.node),
405
- ...i.map((v) => v.node)
452
+ ...i.map((a) => a.node),
453
+ ...c.map((a) => a.node)
406
454
  ];
407
- }, _e = (n, e) => {
408
- const { pointerPosition: t, keyboard: r } = T(), a = (e == null ? void 0 : e.moveStep) || 10;
455
+ }, Se = (n, e) => {
456
+ const { pointerPosition: t, keyboard: r } = T(), l = (e == null ? void 0 : e.moveStep) || 10;
409
457
  return {
410
- onKeyboardStart: (s) => {
411
- var v;
412
- S(s);
413
- const i = R(n.value);
414
- (v = n.value) == null || v.blur();
415
- const u = i.x + i.width / 2, d = i.y + i.height / 2;
458
+ onKeyboardStart: (i) => {
459
+ var a;
460
+ _(i);
461
+ const c = R(n.value);
462
+ (a = n.value) == null || a.blur();
463
+ const g = c.x + c.width / 2, u = c.y + c.height / 2;
416
464
  t.start.value = {
417
- x: u,
418
- y: d
465
+ x: g,
466
+ y: u
419
467
  }, t.current.value = {
420
- x: u,
421
- y: d
468
+ x: g,
469
+ y: u
422
470
  }, t.offset.pixel.value = {
423
- x: i.width / 2,
424
- y: i.height / 2
471
+ x: c.width / 2,
472
+ y: c.height / 2
425
473
  }, t.offset.percent.value = {
426
474
  x: 50,
427
475
  y: 50
@@ -429,18 +477,18 @@ const T = ie(() => {
429
477
  },
430
478
  onKeyboardMove: () => {
431
479
  if (!t.current.value) return;
432
- const s = t.current.value.x, i = t.current.value.y;
433
- let u = s, d = i;
434
- r.w.value && (d -= a), r.s.value && (d += a), r.a.value && (u -= a), r.d.value && (u += a), t.current.value = {
435
- x: u,
436
- y: d
480
+ const i = t.current.value.x, c = t.current.value.y;
481
+ let g = i, u = c;
482
+ r.w.value && (u -= l), r.s.value && (u += l), r.a.value && (g -= l), r.d.value && (g += l), t.current.value = {
483
+ x: g,
484
+ y: u
437
485
  };
438
486
  },
439
487
  onKeyboardEnd: () => {
440
488
  t.current.value = null, t.start.value = null, t.offset.pixel.value = null, t.offset.percent.value = null;
441
489
  }
442
490
  };
443
- }, De = (n) => {
491
+ }, _e = (n) => {
444
492
  const e = T();
445
493
  return {
446
494
  onPointerStart: (o) => {
@@ -448,11 +496,11 @@ const T = ie(() => {
448
496
  x: o.clientX,
449
497
  y: o.clientY
450
498
  };
451
- const { pixel: l, percent: c } = Le(n.value, {
499
+ const { pixel: s, percent: d } = Le(n.value, {
452
500
  x: o.clientX,
453
501
  y: o.clientY
454
502
  });
455
- e.pointerPosition.offset.pixel.value = l, e.pointerPosition.offset.percent.value = c;
503
+ e.pointerPosition.offset.pixel.value = s, e.pointerPosition.offset.percent.value = d;
456
504
  },
457
505
  onPointerMove: (o) => {
458
506
  e.pointerPosition.current.value = {
@@ -464,134 +512,134 @@ const T = ie(() => {
464
512
  e.pointerPosition.current.value = null, e.pointerPosition.start.value = null, e.pointerPosition.offset.pixel.value = null, e.pointerPosition.offset.percent.value = null;
465
513
  }
466
514
  };
467
- }, Ie = (n, e) => {
515
+ }, De = (n, e) => {
468
516
  var U, Z;
469
- const t = T(), { onPointerStart: r, onPointerMove: a, onPointerEnd: o } = De(n), { onKeyboardStart: l, onKeyboardMove: c, onKeyboardEnd: s } = _e(
517
+ const t = T(), { onPointerStart: r, onPointerMove: l, onPointerEnd: o } = _e(n), { onKeyboardStart: s, onKeyboardMove: d, onKeyboardEnd: i } = Se(
470
518
  n,
471
519
  e == null ? void 0 : e.keyboard
472
520
  );
473
- let i = null;
474
- const u = (f) => {
475
- var D, M;
476
- if (!f) return /* @__PURE__ */ new Map();
477
- const x = t.selectedElementsMap.value.has(f);
478
- if (t.selectedElementsMap.value.size > 0 && x) {
479
- const L = /* @__PURE__ */ new Map();
521
+ let c = null;
522
+ const g = (h) => {
523
+ var D, L;
524
+ if (!h) return /* @__PURE__ */ new Map();
525
+ const I = t.selectedElementsMap.value.has(h);
526
+ if (t.selectedElementsMap.value.size > 0 && I) {
527
+ const S = /* @__PURE__ */ new Map();
480
528
  return Array.from(t.selectedElementsMap.value.entries()).forEach(
481
- ([I, Y]) => {
529
+ ([A, Y]) => {
482
530
  var H, O;
483
- L.set(I, {
531
+ S.set(A, {
484
532
  ...Y,
485
533
  initialHTML: ((H = Y.node) == null ? void 0 : H.outerHTML) ?? "",
486
534
  initialRect: (O = Y.node) == null ? void 0 : O.getBoundingClientRect()
487
535
  });
488
536
  }
489
- ), L;
537
+ ), S;
490
538
  }
491
539
  t.selectedElementsMap.value.clear();
492
- const p = t.elementsMap.value.get(f);
493
- if (!p) return /* @__PURE__ */ new Map();
494
- const E = /* @__PURE__ */ new Map();
495
- return E.set(f, {
496
- ...p,
497
- initialHTML: ((D = p.node) == null ? void 0 : D.outerHTML) ?? "",
498
- initialRect: (M = p.node) == null ? void 0 : M.getBoundingClientRect()
499
- }), E;
500
- }, d = (f) => {
501
- if (!f)
540
+ const P = t.elementsMap.value.get(h);
541
+ if (!P) return /* @__PURE__ */ new Map();
542
+ const w = /* @__PURE__ */ new Map();
543
+ return w.set(h, {
544
+ ...P,
545
+ initialHTML: ((D = P.node) == null ? void 0 : D.outerHTML) ?? "",
546
+ initialRect: (L = P.node) == null ? void 0 : L.getBoundingClientRect()
547
+ }), w;
548
+ }, u = (h) => {
549
+ if (!h)
502
550
  return { element: null, zone: null };
503
- const x = Array.isArray(f) ? f : [f], p = Array.from(t.draggingElements.value.keys()), E = x.find((M) => {
504
- if (!t.visibleZones.value.has(M)) return !1;
505
- const L = t.zonesMap.value.get(M);
506
- return !(!L || p.some(
507
- (I) => I && (I === L.node || k(L.node, I))
508
- ) || L.groups.length && !!Array.from(
551
+ const I = Array.isArray(h) ? h : [h], P = Array.from(t.draggingElements.value.keys()), w = I.find((L) => {
552
+ if (!t.visibleZones.value.has(L)) return !1;
553
+ const S = t.zonesMap.value.get(L);
554
+ return !(!S || P.some(
555
+ (A) => A && (A === S.node || k(S.node, A))
556
+ ) || S.groups.length && !!Array.from(
509
557
  t.draggingElements.value.values()
510
- ).some((Y) => Y.groups.length ? !Y.groups.some((H) => L.groups.includes(H)) : !1));
558
+ ).some((Y) => Y.groups.length ? !Y.groups.some((H) => S.groups.includes(H)) : !1));
511
559
  });
512
- return E ? {
513
- element: x.find(
514
- (M) => t.visibleElements.value.has(M) && t.elementsMap.value.has(M) && !p.some(
515
- (L) => L && (L === M || k(
516
- M,
517
- L
518
- ) || k(L, M))
519
- ) && (M === E || k(
520
- M,
521
- E
560
+ return w ? {
561
+ element: I.find(
562
+ (L) => t.visibleElements.value.has(L) && t.elementsMap.value.has(L) && !P.some(
563
+ (S) => S && (S === L || k(
564
+ L,
565
+ S
566
+ ) || k(S, L))
567
+ ) && (L === w || k(
568
+ L,
569
+ w
522
570
  ))
523
571
  ) || null,
524
- zone: E
572
+ zone: w
525
573
  } : { element: null, zone: null };
526
- }, v = ((U = e == null ? void 0 : e.sensor) == null ? void 0 : U.setup) || Se, g = (f) => {
527
- var E, D, M, L, I, Y, H, O, j, J, X, Q;
528
- const x = t.hovered.element.value, p = t.hovered.zone.value;
529
- t.hovered.element.value = f.element, t.hovered.zone.value = f.zone, x && t.hovered.element.value !== x && ((M = (D = (E = t.elementsMap.value.get(x)) == null ? void 0 : E.events) == null ? void 0 : D.onLeave) == null || M.call(D, t), t.hovered.element.value && ((Y = (I = (L = t.elementsMap.value.get(t.hovered.element.value)) == null ? void 0 : L.events) == null ? void 0 : I.onHover) == null || Y.call(I, t))), p && t.hovered.zone.value !== p && ((j = (O = (H = t.zonesMap.value.get(p)) == null ? void 0 : H.events) == null ? void 0 : O.onLeave) == null || j.call(O, t), t.hovered.zone.value && ((Q = (X = (J = t.zonesMap.value.get(t.hovered.zone.value)) == null ? void 0 : J.events) == null ? void 0 : X.onHover) == null || Q.call(X, t)));
530
- }, m = Me(() => {
531
- const f = v(t), x = d(f);
532
- g(x);
533
- }, ((Z = e == null ? void 0 : e.sensor) == null ? void 0 : Z.throttle) ?? 0), h = () => {
534
- m(), i = requestAnimationFrame(h);
535
- }, z = () => h(), w = () => {
536
- i !== null && (cancelAnimationFrame(i), i = null);
574
+ }, a = ((U = e == null ? void 0 : e.sensor) == null ? void 0 : U.setup) || ze, v = (h) => {
575
+ var w, D, L, S, A, Y, H, O, j, J, X, Q;
576
+ const I = t.hovered.element.value, P = t.hovered.zone.value;
577
+ t.hovered.element.value = h.element, t.hovered.zone.value = h.zone, I && t.hovered.element.value !== I && ((L = (D = (w = t.elementsMap.value.get(I)) == null ? void 0 : w.events) == null ? void 0 : D.onLeave) == null || L.call(D, t), t.hovered.element.value && ((Y = (A = (S = t.elementsMap.value.get(t.hovered.element.value)) == null ? void 0 : S.events) == null ? void 0 : A.onHover) == null || Y.call(A, t))), P && t.hovered.zone.value !== P && ((j = (O = (H = t.zonesMap.value.get(P)) == null ? void 0 : H.events) == null ? void 0 : O.onLeave) == null || j.call(O, t), t.hovered.zone.value && ((Q = (X = (J = t.zonesMap.value.get(t.hovered.zone.value)) == null ? void 0 : J.events) == null ? void 0 : X.onHover) == null || Q.call(X, t)));
578
+ }, f = xe(() => {
579
+ const h = a(t), I = u(h);
580
+ v(I);
581
+ }, ((Z = e == null ? void 0 : e.sensor) == null ? void 0 : Z.throttle) ?? 0), m = () => {
582
+ f(), c = requestAnimationFrame(m);
583
+ }, y = () => m(), E = () => {
584
+ c !== null && (cancelAnimationFrame(c), c = null);
537
585
  };
538
586
  return {
539
- activate: (f) => {
540
- t.draggingElements.value = u(n.value), t.draggingElements.value.forEach(
541
- (x) => {
542
- var p, E;
543
- return (E = (p = x.events).onStart) == null ? void 0 : E.call(p, t);
587
+ activate: (h) => {
588
+ t.draggingElements.value = g(n.value), t.draggingElements.value.forEach(
589
+ (I) => {
590
+ var P, w;
591
+ return (w = (P = I.events).onStart) == null ? void 0 : w.call(P, t);
544
592
  }
545
- ), f instanceof PointerEvent ? r(f) : l(f), z();
593
+ ), h instanceof PointerEvent ? r(h) : s(h), y();
546
594
  },
547
- track: (f) => {
595
+ track: (h) => {
548
596
  t.draggingElements.value.forEach(
549
- (x) => {
550
- var p, E;
551
- return (E = (p = x.events).onMove) == null ? void 0 : E.call(p, t);
597
+ (I) => {
598
+ var P, w;
599
+ return (w = (P = I.events).onMove) == null ? void 0 : w.call(P, t);
552
600
  }
553
- ), f instanceof KeyboardEvent ? c() : a(f);
601
+ ), h instanceof KeyboardEvent ? d() : l(h);
554
602
  },
555
- deactivate: (f = !0) => {
556
- var x, p;
557
- if (o(), s(), f) {
603
+ deactivate: (h = !0) => {
604
+ var I, P;
605
+ if (o(), i(), h) {
558
606
  if (t.hovered.zone.value) {
559
- const E = t.zonesMap.value.get(t.hovered.zone.value);
560
- (p = E == null ? void 0 : (x = E.events).onDrop) == null || p.call(x, t);
607
+ const w = t.zonesMap.value.get(t.hovered.zone.value);
608
+ (P = w == null ? void 0 : (I = w.events).onDrop) == null || P.call(I, t);
561
609
  } else
562
610
  t.draggingElements.value.forEach(
563
- (E) => {
564
- var D, M;
565
- return (M = (D = E.events).onEnd) == null ? void 0 : M.call(D, t);
611
+ (w) => {
612
+ var D, L;
613
+ return (L = (D = w.events).onEnd) == null ? void 0 : L.call(D, t);
566
614
  }
567
615
  );
568
616
  t.selectedElementsMap.value.clear();
569
617
  }
570
- t.draggingElements.value.clear(), t.hovered.zone.value = null, t.hovered.element.value = null, w();
618
+ t.draggingElements.value.clear(), t.hovered.zone.value = null, t.hovered.element.value = null, E();
571
619
  }
572
620
  };
573
- }, be = ie(() => {
574
- let n = "", e = "", t = "", r = null, a = null, o = null, l = null, c = null;
575
- const { activeContainer: s } = T(), i = () => {
576
- const g = document.body;
577
- n = g.style.userSelect, g.style.userSelect = "none", window.addEventListener("contextmenu", S), window.addEventListener("selectstart", S), window.addEventListener("touchstart", S), window.addEventListener("touchmove", S);
621
+ }, Ae = ie(() => {
622
+ let n = "", e = "", t = "", r = null, l = null, o = null, s = null, d = null;
623
+ const { activeContainer: i } = T(), c = () => {
624
+ const v = document.body;
625
+ n = v.style.userSelect, v.style.userSelect = "none", window.addEventListener("contextmenu", _), window.addEventListener("selectstart", _), window.addEventListener("touchstart", _), window.addEventListener("touchmove", _);
626
+ }, g = () => {
627
+ const v = document.body;
628
+ v.style.userSelect = n, v.style.touchAction = e, v.style.overscrollBehavior = t, window.removeEventListener("contextmenu", _), window.removeEventListener("selectstart", _), window.removeEventListener("touchstart", _), window.removeEventListener("touchmove", _);
578
629
  }, u = () => {
579
- const g = document.body;
580
- g.style.userSelect = n, g.style.touchAction = e, g.style.overscrollBehavior = t, window.removeEventListener("contextmenu", S), window.removeEventListener("selectstart", S), window.removeEventListener("touchstart", S), window.removeEventListener("touchmove", S);
581
- }, d = () => {
582
- r && (document.removeEventListener("pointermove", r), r = null), a && (document.removeEventListener("pointerup", a), a = null), o && (o = null), l && (document.removeEventListener("wheel", l), l = null), c && (document.removeEventListener("keydown", c), document.removeEventListener("keypress", c), document.removeEventListener("keyup", c), c = null);
630
+ r && (document.removeEventListener("pointermove", r), r = null), l && (document.removeEventListener("pointerup", l), l = null), o && (o = null), s && (document.removeEventListener("wheel", s), s = null), d && (document.removeEventListener("keydown", d), document.removeEventListener("keypress", d), document.removeEventListener("keyup", d), d = null);
583
631
  };
584
632
  return {
585
- handleDragStart: (g, m, h) => {
586
- d(), g.target.blur(), h != null && h.container && (s.component.value = Ee(h.container));
587
- const { activate: z, track: w, deactivate: _ } = Ie(m, h);
588
- a = () => {
589
- s.component.value = null, u(), _(!0), d();
633
+ handleDragStart: (v, f, m) => {
634
+ u(), v.target.blur(), m != null && m.container && (i.component.value = ye(m.container));
635
+ const { activate: y, track: E, deactivate: x } = De(f, m);
636
+ l = () => {
637
+ i.component.value = null, g(), x(!0), u();
590
638
  }, o = () => {
591
- s.component.value = null, u(), _(!1), d();
592
- }, r = (P) => w(P), l = (P) => w(P), c = (P) => {
593
- P.type === "keyup" && (P.code === "Escape" && (o == null || o()), P.code === "Enter" && (a == null || a())), w(P);
594
- }, i(), z(g), document.addEventListener("pointermove", r), document.addEventListener("pointerup", a), document.addEventListener("wheel", l), document.addEventListener("keydown", c), document.addEventListener("keypress", c), document.addEventListener("keyup", c);
639
+ i.component.value = null, g(), x(!1), u();
640
+ }, r = (p) => E(p), s = (p) => E(p), d = (p) => {
641
+ p.type === "keyup" && (p.code === "Escape" && (o == null || o()), p.code === "Enter" && (l == null || l())), E(p);
642
+ }, c(), y(v), document.addEventListener("pointermove", r), document.addEventListener("pointerup", l), document.addEventListener("wheel", s), document.addEventListener("keydown", d), document.addEventListener("keypress", d), document.addEventListener("keyup", d);
595
643
  }
596
644
  };
597
645
  }), Te = (n) => {
@@ -599,86 +647,86 @@ const T = ie(() => {
599
647
  id: e,
600
648
  elementRef: t,
601
649
  isDragging: r,
602
- isOvered: a,
650
+ isOvered: l,
603
651
  isAllowed: o,
604
- registerElement: l,
605
- unregisterElement: c
606
- } = ze(n), { pointerPosition: s } = T(), { handleDragStart: i } = be(), u = (d) => i(d, t, n);
607
- return q(l), G(c), {
608
- pointerPosition: s,
652
+ registerElement: s,
653
+ unregisterElement: d
654
+ } = Ie(n), { pointerPosition: i } = T(), { handleDragStart: c } = Ae(), g = (u) => c(u, t, n);
655
+ return q(s), G(d), {
656
+ pointerPosition: i,
609
657
  elementRef: t,
610
658
  isDragging: r,
611
- isOvered: a,
659
+ isOvered: l,
612
660
  isAllowed: o,
613
- handleDragStart: u,
661
+ handleDragStart: g,
614
662
  id: e
615
663
  };
616
- }, ke = (n) => {
664
+ }, be = (n) => {
617
665
  const {
618
666
  zonesMap: e,
619
667
  hovered: t,
620
668
  draggingElements: r,
621
- isDragging: a,
669
+ isDragging: l,
622
670
  handleDropZoneIntersection: o
623
- } = T(), l = K(null), c = C(() => t.zone.value === l.value), s = C(() => {
624
- if (!l.value || !a.value) return !1;
625
- const d = e.value.get(l.value);
626
- return d != null && d.groups.length ? !Array.from(r.value.values()).some((v) => v.groups.length ? !v.groups.some(
627
- (g) => d.groups.includes(g)
671
+ } = T(), s = K(null), d = C(() => t.zone.value === s.value), i = C(() => {
672
+ if (!s.value || !l.value) return !1;
673
+ const u = e.value.get(s.value);
674
+ return u != null && u.groups.length ? !Array.from(r.value.values()).some((a) => a.groups.length ? !a.groups.some(
675
+ (v) => u.groups.includes(v)
628
676
  ) : !1) : !0;
629
677
  });
630
- return { elementRef: l, registerZone: () => {
631
- if (!l.value) throw new Error("elementRef is not set");
632
- o("add", l.value), e.value.set(l.value, {
633
- node: l.value,
678
+ return { elementRef: s, registerZone: () => {
679
+ if (!s.value) throw new Error("elementRef is not set");
680
+ o("add", s.value), e.value.set(s.value, {
681
+ node: s.value,
634
682
  groups: (n == null ? void 0 : n.groups) ?? [],
635
683
  events: (n == null ? void 0 : n.events) ?? {},
636
684
  data: (n == null ? void 0 : n.data) ?? void 0
637
- }), l.value.setAttribute("data-dnd-droppable", "true");
685
+ }), s.value.setAttribute("data-dnd-droppable", "true");
638
686
  }, unregisterZone: () => {
639
- l.value && (o("remove", l.value), e.value.delete(l.value));
640
- }, isOvered: c, isAllowed: s };
687
+ s.value && (o("remove", s.value), e.value.delete(s.value));
688
+ }, isOvered: d, isAllowed: i };
641
689
  }, Ye = (n) => {
642
- const { elementRef: e, registerZone: t, unregisterZone: r, isOvered: a, isAllowed: o } = ke(n);
643
- return q(t), G(r), { elementRef: e, isOvered: a, isAllowed: o };
690
+ const { elementRef: e, registerZone: t, unregisterZone: r, isOvered: l, isAllowed: o } = be(n);
691
+ return q(t), G(r), { elementRef: e, isOvered: l, isAllowed: o };
644
692
  }, Ve = (n) => {
645
693
  const { selectedElementsMap: e, elementsMap: t } = T(), r = C(
646
694
  () => n.value ? e.value.has(n.value) : !1
647
- ), a = C(() => {
695
+ ), l = C(() => {
648
696
  if (!n.value) return !1;
649
- for (const [i, u] of e.value.entries())
650
- if (i && k(i, n.value))
697
+ for (const [c, g] of e.value.entries())
698
+ if (c && k(c, n.value))
651
699
  return !0;
652
700
  return !1;
653
701
  }), o = C(() => {
654
702
  if (!n.value) return !1;
655
- for (const [i, u] of e.value.entries())
656
- if (i && k(n.value, i))
703
+ for (const [c, g] of e.value.entries())
704
+ if (c && k(n.value, c))
657
705
  return !0;
658
706
  return !1;
659
- }), l = () => {
707
+ }), s = () => {
660
708
  n.value && e.value.delete(n.value);
661
- }, c = () => {
709
+ }, d = () => {
662
710
  if (!n.value) return;
663
- const i = t.value.get(n.value);
664
- if (i) {
665
- if (a.value)
666
- for (const [u, d] of [...e.value.entries()])
667
- u && k(u, n.value) && e.value.delete(u);
711
+ const c = t.value.get(n.value);
712
+ if (c) {
713
+ if (l.value)
714
+ for (const [g, u] of [...e.value.entries()])
715
+ g && k(g, n.value) && e.value.delete(g);
668
716
  if (o.value)
669
- for (const [u, d] of [...e.value.entries()])
670
- u && k(n.value, u) && e.value.delete(u);
671
- e.value.set(n.value, i);
717
+ for (const [g, u] of [...e.value.entries()])
718
+ g && k(n.value, g) && e.value.delete(g);
719
+ e.value.set(n.value, c);
672
720
  }
673
721
  };
674
722
  return {
675
- handleUnselect: l,
676
- handleSelect: c,
723
+ handleUnselect: s,
724
+ handleSelect: d,
677
725
  handleToggleSelect: () => {
678
- n.value && (e.value.has(n.value) ? l() : c());
726
+ n.value && (e.value.has(n.value) ? s() : d());
679
727
  },
680
728
  isSelected: r,
681
- isParentOfSelected: a
729
+ isParentOfSelected: l
682
730
  };
683
731
  };
684
732
  export {
@@ -686,7 +734,7 @@ export {
686
734
  Ke as default,
687
735
  R as getBoundingBox,
688
736
  T as useDnDStore,
689
- we as useDragContainer,
737
+ Me as useDragContainer,
690
738
  Te as useDraggable,
691
739
  Ye as useDroppable,
692
740
  Ve as useSelection