@caspeco/casper-ui-library 10.0.0 → 10.0.2

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,114 +1,114 @@
1
- import { WeakStore as Pe, reactive as te } from "../state/dist/index.js";
2
- import { Plugin as he, resolveCustomizable as re } from "../abstract/index.js";
3
- import { closestCorners as Se, defaultCollisionDetection as De } from "../collision/dist/index.js";
4
- import { Droppable as Ee, Draggable as Ge, Scroller as ke, Feedback as Te } from "./index.js";
5
- import { isKeyboardEvent as ne, DOMRectangle as ie, getVisibleBoundingRectangle as je, scrollIntoViewIfNeeded as Ce, ProxiedElements as Me, getComputedStyles as Ae, computeTranslate as se, prefersReducedMotion as Re, getWindow as ze, animateTransform as We } from "./utilities.js";
6
- import { Rectangle as oe } from "../geometry/dist/index.js";
7
- import { effect as $e, batch as m, untracked as ae } from "../../@preact/signals-core/dist/signals-core.module.js";
8
- var Be = Object.create, be = Object.defineProperty, Le = Object.defineProperties, Ne = Object.getOwnPropertyDescriptor, Ve = Object.getOwnPropertyDescriptors, J = Object.getOwnPropertySymbols, ve = Object.prototype.hasOwnProperty, _e = Object.prototype.propertyIsEnumerable, qe = (e, t) => (t = Symbol[e]) ? t : /* @__PURE__ */ Symbol.for("Symbol." + e), N = (e) => {
1
+ import { WeakStore as Ge, reactive as ne } from "../state/dist/index.js";
2
+ import { Plugin as _e, resolveCustomizable as ie } from "../abstract/index.js";
3
+ import { closestCorners as ke, defaultCollisionDetection as Te } from "../collision/dist/index.js";
4
+ import { Droppable as je, Draggable as Ce, Scroller as Me, Feedback as Re } from "./index.js";
5
+ import { isKeyboardEvent as oe, DOMRectangle as se, getVisibleBoundingRectangle as ze, scrollIntoViewIfNeeded as Ae, ProxiedElements as We, getComputedStyles as Be, computeTranslate as ae, prefersReducedMotion as $e, getWindow as Le, animateTransform as Ke } from "./utilities.js";
6
+ import { Rectangle as le } from "../geometry/dist/index.js";
7
+ import { effect as Ne, batch as w, untracked as de } from "../../@preact/signals-core/dist/signals-core.module.js";
8
+ var Ve = Object.create, xe = Object.defineProperty, qe = Object.defineProperties, Fe = Object.getOwnPropertyDescriptor, He = Object.getOwnPropertyDescriptors, F = Object.getOwnPropertySymbols, ye = Object.prototype.hasOwnProperty, Ie = Object.prototype.propertyIsEnumerable, Je = (e, t) => (t = Symbol[e]) ? t : /* @__PURE__ */ Symbol.for("Symbol." + e), $ = (e) => {
9
9
  throw TypeError(e);
10
- }, U = (e, t, r) => t in e ? be(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, le = (e, t) => {
10
+ }, X = (e, t, r) => t in e ? xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, J = (e, t) => {
11
11
  for (var r in t || (t = {}))
12
- ve.call(t, r) && U(e, r, t[r]);
13
- if (J)
14
- for (var r of J(t))
15
- _e.call(t, r) && U(e, r, t[r]);
12
+ ye.call(t, r) && X(e, r, t[r]);
13
+ if (F)
14
+ for (var r of F(t))
15
+ Ie.call(t, r) && X(e, r, t[r]);
16
16
  return e;
17
- }, de = (e, t) => Le(e, Ve(t)), Fe = (e, t) => {
17
+ }, Q = (e, t) => qe(e, He(t)), Qe = (e, t) => {
18
18
  var r = {};
19
- for (var i in e)
20
- ve.call(e, i) && t.indexOf(i) < 0 && (r[i] = e[i]);
21
- if (e != null && J)
22
- for (var i of J(e))
23
- t.indexOf(i) < 0 && _e.call(e, i) && (r[i] = e[i]);
19
+ for (var n in e)
20
+ ye.call(e, n) && t.indexOf(n) < 0 && (r[n] = e[n]);
21
+ if (e != null && F)
22
+ for (var n of F(e))
23
+ t.indexOf(n) < 0 && Ie.call(e, n) && (r[n] = e[n]);
24
24
  return r;
25
- }, Ke = (e) => {
25
+ }, Ue = (e) => {
26
26
  var t;
27
- return [, , , Be((t = void 0) != null ? t : null)];
28
- }, xe = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], W = (e) => e !== void 0 && typeof e != "function" ? N("Function expected") : e, He = (e, t, r, i, o) => ({ kind: xe[e], name: t, metadata: i, addInitializer: (p) => r._ ? N("Already initialized") : o.push(W(p || null)) }), Je = (e, t) => U(t, qe("metadata"), e[3]), q = (e, t, r, i) => {
29
- for (var o = 0, p = e[t >> 1], n = p && p.length; o < n; o++) t & 1 ? p[o].call(r) : i = p[o].call(r, i);
30
- return i;
31
- }, ye = (e, t, r, i, o, p) => {
32
- for (var n, s, _, b, h, g = t & 7, a = !1, c = !1, f = e.length + 1, v = xe[g + 5], y = e[f - 1] = [], w = e[f] || (e[f] = []), I = (o = o.prototype, Ne({ get [r]() {
33
- return $(this, p);
34
- }, set [r](d) {
35
- return k(this, p, d);
36
- } }, r)), P = i.length - 1; P >= 0; P--)
37
- b = He(g, r, _ = {}, e[3], w), b.static = a, b.private = c, h = b.access = { has: (d) => r in d }, h.get = (d) => d[r], h.set = (d, l) => d[r] = l, s = (0, i[P])({ get: I.get, set: I.set }, b), _._ = 1, s === void 0 ? W(s) && (I[v] = s) : typeof s != "object" || s === null ? N("Object expected") : (W(n = s.get) && (I.get = n), W(n = s.set) && (I.set = n), W(n = s.init) && y.unshift(n));
38
- return I && be(o, r, I), o;
39
- }, Ie = (e, t, r) => t.has(e) || N("Cannot " + r), $ = (e, t, r) => (Ie(e, t, "read from private field"), t.get(e)), z = (e, t, r) => t.has(e) ? N("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), k = (e, t, r, i) => (Ie(e, t, "write to private field"), t.set(e, r), r);
40
- function D(e) {
41
- return e instanceof ee || e instanceof we;
27
+ return [, , , Ve((t = void 0) != null ? t : null)];
28
+ }, Oe = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], z = (e) => e !== void 0 && typeof e != "function" ? $("Function expected") : e, Xe = (e, t, r, n, a) => ({ kind: Oe[e], name: t, metadata: n, addInitializer: (i) => r._ ? $("Already initialized") : a.push(z(i || null)) }), Ye = (e, t) => X(t, Je("metadata"), e[3]), L = (e, t, r, n) => {
29
+ for (var a = 0, i = e[t >> 1], o = i && i.length; a < o; a++) t & 1 ? i[a].call(r) : n = i[a].call(r, n);
30
+ return n;
31
+ }, Pe = (e, t, r, n, a, i) => {
32
+ for (var o, l, h, v, c, u = t & 7, _ = !1, b = !1, g = e.length + 1, f = Oe[u + 5], O = e[g - 1] = [], x = e[g] || (e[g] = []), I = (a = a.prototype, Fe({ get [r]() {
33
+ return A(this, i);
34
+ }, set [r](p) {
35
+ return G(this, i, p);
36
+ } }, r)), d = n.length - 1; d >= 0; d--)
37
+ v = Xe(u, r, h = {}, e[3], x), v.static = _, v.private = b, c = v.access = { has: (p) => r in p }, c.get = (p) => p[r], c.set = (p, s) => p[r] = s, l = (0, n[d])({ get: I.get, set: I.set }, v), h._ = 1, l === void 0 ? z(l) && (I[f] = l) : typeof l != "object" || l === null ? $("Object expected") : (z(o = l.get) && (I.get = o), z(o = l.set) && (I.set = o), z(o = l.init) && O.unshift(o));
38
+ return I && xe(a, r, I), a;
39
+ }, we = (e, t, r) => t.has(e) || $("Cannot " + r), A = (e, t, r) => (we(e, t, "read from private field"), t.get(e)), R = (e, t, r) => t.has(e) ? $("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), G = (e, t, r, n) => (we(e, t, "write to private field"), t.set(e, r), r);
40
+ function m(e) {
41
+ return e instanceof te || e instanceof De;
42
42
  }
43
- function ht(e) {
44
- return D(e.source) && D(e.target);
43
+ function yt(e) {
44
+ return m(e.source) && m(e.target);
45
45
  }
46
- var F = 10, Qe = class extends he {
46
+ var K = 10, Ze = class extends _e {
47
47
  constructor(e) {
48
48
  super(e);
49
- const t = $e(() => {
50
- const { dragOperation: i } = e;
51
- if (ne(i.activatorEvent) && D(i.source) && i.status.initialized) {
52
- const o = e.registry.plugins.get(ke);
53
- if (o)
54
- return o.disable(), () => o.enable();
49
+ const t = Ne(() => {
50
+ const { dragOperation: n } = e;
51
+ if (oe(n.activatorEvent) && m(n.source) && n.status.initialized) {
52
+ const a = e.registry.plugins.get(Me);
53
+ if (a)
54
+ return a.disable(), () => a.enable();
55
55
  }
56
56
  }), r = e.monitor.addEventListener(
57
57
  "dragmove",
58
- (i, o) => {
58
+ (n, a) => {
59
59
  queueMicrotask(() => {
60
- if (this.disabled || i.defaultPrevented || !i.nativeEvent)
60
+ if (this.disabled || n.defaultPrevented || !n.nativeEvent)
61
61
  return;
62
- const { dragOperation: p } = o;
63
- if (!ne(i.nativeEvent) || !D(p.source) || !p.shape)
62
+ const { dragOperation: i } = a;
63
+ if (!oe(n.nativeEvent) || !m(i.source) || !i.shape)
64
64
  return;
65
- const { actions: n, collisionObserver: s, registry: _ } = o, { by: b } = i;
66
- if (!b)
65
+ const { actions: o, collisionObserver: l, registry: h } = a, { by: v } = n;
66
+ if (!v)
67
67
  return;
68
- const h = Ue(b), { source: g, target: a } = p, { center: c } = p.shape.current, f = [], v = [];
69
- m(() => {
70
- for (const l of _.droppables) {
71
- const { id: u } = l;
72
- if (!l.accepts(g) || u === a?.id && D(l) || !l.element)
68
+ const c = et(v), { source: u, target: _ } = i, { center: b } = i.shape.current, g = [], f = [];
69
+ w(() => {
70
+ for (const s of h.droppables) {
71
+ const { id: y } = s;
72
+ if (!s.accepts(u) || y === _?.id && m(s) || !s.element)
73
73
  continue;
74
- let x = l.shape;
75
- const O = new ie(l.element, {
76
- getBoundingClientRect: (M) => je(M, void 0, 0.2)
74
+ let P = s.shape;
75
+ const S = new se(s.element, {
76
+ getBoundingClientRect: (C) => ze(C, void 0, 0.2)
77
77
  });
78
- !O.height || !O.width || (h == "down" && c.y + F < O.center.y || h == "up" && c.y - F > O.center.y || h == "left" && c.x - F > O.center.x || h == "right" && c.x + F < O.center.x) && (f.push(l), l.shape = O, v.push(() => l.shape = x));
78
+ !S.height || !S.width || (c == "down" && b.y + K < S.center.y || c == "up" && b.y - K > S.center.y || c == "left" && b.x - K > S.center.x || c == "right" && b.x + K < S.center.x) && (g.push(s), s.shape = S, f.push(() => s.shape = P));
79
79
  }
80
- }), i.preventDefault(), s.disable();
81
- const y = s.computeCollisions(
82
- f,
83
- Se
80
+ }), n.preventDefault(), l.disable();
81
+ const O = l.computeCollisions(
82
+ g,
83
+ ke
84
84
  );
85
- m(() => v.forEach((l) => l()));
86
- const [w] = y;
87
- if (!w)
85
+ w(() => f.forEach((s) => s()));
86
+ const [x] = O;
87
+ if (!x)
88
88
  return;
89
- const { id: I } = w, { index: P, group: d } = g.sortable;
90
- n.setDropTarget(I).then(() => {
91
- const { source: l, target: u, shape: x } = p;
92
- if (!l || !D(l) || !x)
89
+ const { id: I } = x, { index: d, group: p } = u.sortable;
90
+ o.setDropTarget(I).then(() => {
91
+ const { source: s, target: y, shape: P } = i;
92
+ if (!s || !m(s) || !P)
93
93
  return;
94
94
  const {
95
- index: O,
96
- group: M,
97
- target: E
98
- } = l.sortable, S = P !== O || d !== M, A = S ? E : u?.element;
99
- if (!A) return;
100
- Ce(A);
101
- const V = new ie(A);
102
- if (!V)
95
+ index: S,
96
+ group: C,
97
+ target: M
98
+ } = s.sortable, E = d !== S || p !== C, H = E ? M : y?.element;
99
+ if (!H) return;
100
+ Ae(H);
101
+ const re = new se(H);
102
+ if (!re)
103
103
  return;
104
- const R = oe.delta(
105
- V,
106
- oe.from(x.current.boundingRectangle),
107
- l.alignment
104
+ const Ee = le.delta(
105
+ re,
106
+ le.from(P.current.boundingRectangle),
107
+ s.alignment
108
108
  );
109
- n.move({
110
- by: R
111
- }), S ? n.setDropTarget(l.id).then(() => s.enable()) : s.enable();
109
+ o.move({
110
+ by: Ee
111
+ }), E ? o.setDropTarget(s.id).then(() => l.enable()) : l.enable();
112
112
  });
113
113
  });
114
114
  }
@@ -118,7 +118,7 @@ var F = 10, Qe = class extends he {
118
118
  };
119
119
  }
120
120
  };
121
- function Ue(e) {
121
+ function et(e) {
122
122
  const { x: t, y: r } = e;
123
123
  if (t > 0)
124
124
  return "right";
@@ -129,101 +129,108 @@ function Ue(e) {
129
129
  if (r < 0)
130
130
  return "up";
131
131
  }
132
- var Xe = Object.defineProperty, Ye = Object.defineProperties, Ze = Object.getOwnPropertyDescriptors, ce = Object.getOwnPropertySymbols, et = Object.prototype.hasOwnProperty, tt = Object.prototype.propertyIsEnumerable, ue = (e, t, r) => t in e ? Xe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, T = (e, t) => {
132
+ var tt = Object.defineProperty, rt = Object.defineProperties, nt = Object.getOwnPropertyDescriptors, ce = Object.getOwnPropertySymbols, it = Object.prototype.hasOwnProperty, ot = Object.prototype.propertyIsEnumerable, ue = (e, t, r) => t in e ? tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, k = (e, t) => {
133
133
  for (var r in t || (t = {}))
134
- et.call(t, r) && ue(e, r, t[r]);
134
+ it.call(t, r) && ue(e, r, t[r]);
135
135
  if (ce)
136
136
  for (var r of ce(t))
137
- tt.call(t, r) && ue(e, r, t[r]);
137
+ ot.call(t, r) && ue(e, r, t[r]);
138
138
  return e;
139
- }, j = (e, t) => Ye(e, Ze(t));
140
- function rt(e, t, r) {
139
+ }, T = (e, t) => rt(e, nt(t));
140
+ function st(e, t, r) {
141
141
  if (t === r)
142
142
  return e;
143
- const i = e.slice();
144
- return i.splice(r, 0, i.splice(t, 1)[0]), i;
143
+ const n = e.slice();
144
+ return n.splice(r, 0, n.splice(t, 1)[0]), n;
145
145
  }
146
- function Q(e) {
146
+ function N(e, t) {
147
+ const r = String(t);
148
+ return Object.prototype.hasOwnProperty.call(e, r) ? r : void 0;
149
+ }
150
+ function U(e) {
147
151
  return "initialIndex" in e && typeof e.initialIndex == "number" && "index" in e && typeof e.index == "number";
148
152
  }
149
- function nt(e, t, r) {
150
- var i, o, p;
151
- const { source: n, target: s, canceled: _ } = t.operation;
152
- if (!n || !s || _)
153
+ function at(e, t, r) {
154
+ var n, a;
155
+ const { source: i, target: o, canceled: l } = t.operation;
156
+ if (!i || !o || l)
153
157
  return "preventDefault" in t && t.preventDefault(), e;
154
- const b = (d, l) => d === l || typeof d == "object" && "id" in d && d.id === l;
158
+ const h = (d, p) => d === p || d !== null && typeof d == "object" && "id" in d && d.id === p;
155
159
  if (Array.isArray(e)) {
156
- const d = e.findIndex((u) => b(u, n.id)), l = e.findIndex((u) => b(u, s.id));
157
- if (d === -1 || l === -1) {
158
- if (Q(n)) {
159
- const u = n.initialIndex, x = n.index;
160
- return u === x || u < 0 || u >= e.length ? ("preventDefault" in t && t.preventDefault(), e) : r(e, u, x);
160
+ const d = e.findIndex((s) => h(s, i.id)), p = e.findIndex((s) => h(s, o.id));
161
+ if (d === -1 || p === -1) {
162
+ if (U(i)) {
163
+ const s = i.initialIndex, y = i.index;
164
+ return s === y || s < 0 || s >= e.length ? ("preventDefault" in t && t.preventDefault(), e) : r(e, s, y);
161
165
  }
162
166
  return e;
163
167
  }
164
- if (!_ && "index" in n && typeof n.index == "number") {
165
- const u = n.index;
166
- if (u !== d)
167
- return r(e, d, u);
168
+ if (!l && "index" in i && typeof i.index == "number") {
169
+ const s = i.index;
170
+ if (s !== d)
171
+ return r(e, d, s);
168
172
  }
169
- return r(e, d, l);
173
+ return r(e, d, p);
170
174
  }
171
- const h = Object.entries(e);
172
- let g = -1, a, c = -1, f;
173
- for (const [d, l] of h)
174
- if (g === -1 && (g = l.findIndex((u) => b(u, n.id)), g !== -1 && (a = d)), c === -1 && (c = l.findIndex((u) => b(u, s.id)), c !== -1 && (f = d)), g !== -1 && c !== -1)
175
+ const v = Object.entries(e);
176
+ let c = -1, u, _ = -1, b;
177
+ for (const [d, p] of v)
178
+ if (c === -1 && (c = p.findIndex((s) => h(s, i.id)), c !== -1 && (u = d)), _ === -1 && (_ = p.findIndex((s) => h(s, o.id)), _ !== -1 && (b = d)), c !== -1 && _ !== -1)
175
179
  break;
176
- if (g === -1 && Q(n)) {
177
- const d = n.initialGroup, l = n.initialIndex, u = n.group, x = n.index;
178
- if (d == null || u == null || !(d in e) || !(u in e) || d === u && l === x)
180
+ if (c === -1 && U(i)) {
181
+ const d = i.initialGroup == null ? void 0 : N(e, i.initialGroup), p = i.initialIndex, s = i.group == null ? void 0 : N(e, i.group), y = i.index;
182
+ if (d == null || s == null || d === s && p === y)
179
183
  return "preventDefault" in t && t.preventDefault(), e;
180
- if (d === u)
181
- return j(T({}, e), {
182
- [d]: r(e[d], l, x)
184
+ if (d === s)
185
+ return T(k({}, e), {
186
+ [d]: r(e[d], p, y)
183
187
  });
184
- const O = e[d][l];
185
- return j(T({}, e), {
188
+ const P = e[d][p];
189
+ return T(k({}, e), {
186
190
  [d]: [
187
- ...e[d].slice(0, l),
188
- ...e[d].slice(l + 1)
191
+ ...e[d].slice(0, p),
192
+ ...e[d].slice(p + 1)
189
193
  ],
190
- [u]: [
191
- ...e[u].slice(0, x),
192
- O,
193
- ...e[u].slice(x)
194
+ [s]: [
195
+ ...e[s].slice(0, y),
196
+ P,
197
+ ...e[s].slice(y)
194
198
  ]
195
199
  });
196
200
  }
197
- if (!n.manager) return e;
198
- const { dragOperation: v } = n.manager, y = (o = (i = v.shape) == null ? void 0 : i.current.center) != null ? o : v.position.current;
199
- if (f == null && s.id in e) {
200
- const d = s.shape && y.y > s.shape.center.y ? e[s.id].length : 0;
201
- f = s.id, c = d;
202
- }
203
- if (a == null || f == null || a === f && g === c) {
204
- if (a != null && a === f && g === c && Q(n)) {
205
- const d = n.group != null && n.group !== a, l = n.index !== g;
206
- if (d || l) {
207
- const u = (p = n.group) != null ? p : a;
208
- if (u in e) {
209
- if (a === u)
210
- return j(T({}, e), {
211
- [a]: r(
212
- e[a],
213
- g,
214
- n.index
201
+ if (!i.manager) return e;
202
+ const { dragOperation: g } = i.manager, f = (a = (n = g.shape) == null ? void 0 : n.current.center) != null ? a : g.position.current;
203
+ if (b == null) {
204
+ const d = N(e, o.id);
205
+ if (d != null) {
206
+ const p = o.shape && f.y > o.shape.center.y ? e[d].length : 0;
207
+ b = d, _ = p;
208
+ }
209
+ }
210
+ if (u == null || b == null || u === b && c === _) {
211
+ if (u != null && u === b && c === _ && U(i)) {
212
+ const d = i.group == null ? void 0 : N(e, i.group), p = i.group != null && d !== u, s = i.index !== c;
213
+ if (p || s) {
214
+ const y = i.group == null ? u : d;
215
+ if (y != null) {
216
+ if (u === y)
217
+ return T(k({}, e), {
218
+ [u]: r(
219
+ e[u],
220
+ c,
221
+ i.index
215
222
  )
216
223
  });
217
- const x = e[a][g];
218
- return j(T({}, e), {
219
- [a]: [
220
- ...e[a].slice(0, g),
221
- ...e[a].slice(g + 1)
222
- ],
224
+ const P = e[u][c];
225
+ return T(k({}, e), {
223
226
  [u]: [
224
- ...e[u].slice(0, n.index),
225
- x,
226
- ...e[u].slice(n.index)
227
+ ...e[u].slice(0, c),
228
+ ...e[u].slice(c + 1)
229
+ ],
230
+ [y]: [
231
+ ...e[y].slice(0, i.index),
232
+ P,
233
+ ...e[y].slice(i.index)
227
234
  ]
228
235
  });
229
236
  }
@@ -231,98 +238,109 @@ function nt(e, t, r) {
231
238
  }
232
239
  return "preventDefault" in t && t.preventDefault(), e;
233
240
  }
234
- if (a === f)
235
- return j(T({}, e), {
236
- [a]: r(e[a], g, c)
241
+ if (u === b)
242
+ return T(k({}, e), {
243
+ [u]: r(e[u], c, _)
237
244
  });
238
- const I = s.shape && Math.round(y.y) > Math.round(s.shape.center.y) ? 1 : 0, P = e[a][g];
239
- return j(T({}, e), {
240
- [a]: [
241
- ...e[a].slice(0, g),
242
- ...e[a].slice(g + 1)
245
+ const x = o.shape && Math.round(f.y) > Math.round(o.shape.center.y) ? 1 : 0, I = e[u][c];
246
+ return T(k({}, e), {
247
+ [u]: [
248
+ ...e[u].slice(0, c),
249
+ ...e[u].slice(c + 1)
243
250
  ],
244
- [f]: [
245
- ...e[f].slice(0, c + I),
246
- P,
247
- ...e[f].slice(c + I)
251
+ [b]: [
252
+ ...e[b].slice(0, _ + x),
253
+ I,
254
+ ...e[b].slice(_ + x)
248
255
  ]
249
256
  });
250
257
  }
251
- function it(e, t) {
252
- return nt(e, t, rt);
258
+ function lt(e, t) {
259
+ return at(e, t, st);
253
260
  }
254
- var pe = "__default__", st = class extends he {
261
+ function pe(e) {
262
+ const t = /* @__PURE__ */ new Map();
263
+ for (const [, r] of e)
264
+ for (const n of r)
265
+ t.set(n.id, n.index);
266
+ return t;
267
+ }
268
+ function ge(e, t, r) {
269
+ var n;
270
+ for (const [a, i] of t)
271
+ for (const o of i) {
272
+ const l = e.get(o.id);
273
+ if (o.index !== l || o.group !== a || !((n = r.get(a)) != null && n.has(o)))
274
+ return !0;
275
+ }
276
+ return !1;
277
+ }
278
+ var fe = "__default__", dt = class extends _e {
255
279
  constructor(e) {
256
280
  super(e);
257
281
  const t = () => {
258
- const i = /* @__PURE__ */ new Map();
259
- for (const o of e.registry.droppables)
260
- if (o instanceof ee) {
261
- const { sortable: p } = o, { group: n } = p;
262
- let s = i.get(n);
263
- s || (s = /* @__PURE__ */ new Set(), i.set(n, s)), s.add(p);
282
+ const n = /* @__PURE__ */ new Map();
283
+ for (const a of e.registry.droppables)
284
+ if (a instanceof te) {
285
+ const { sortable: i } = a, { group: o } = i;
286
+ let l = n.get(o);
287
+ l || (l = /* @__PURE__ */ new Set(), n.set(o, l)), l.add(i);
264
288
  }
265
- for (const [o, p] of i)
266
- i.set(o, new Set(K(p)));
267
- return i;
289
+ return n;
268
290
  }, r = [
269
- e.monitor.addEventListener("dragover", (i, o) => {
291
+ e.monitor.addEventListener("dragover", (n, a) => {
270
292
  if (this.disabled)
271
293
  return;
272
- const { dragOperation: p } = o, { source: n, target: s } = p;
273
- if (!D(n) || !D(s) || n.sortable === s.sortable)
294
+ const { dragOperation: i } = a, { source: o, target: l } = i;
295
+ if (!m(o) || !m(l) || o.sortable === l.sortable)
274
296
  return;
275
- const _ = t(), b = n.sortable.group === s.sortable.group, h = _.get(n.sortable.group), g = b ? h : _.get(s.sortable.group);
276
- !h || !g || queueMicrotask(() => {
277
- i.defaultPrevented || o.renderer.rendering.then(() => {
278
- var a, c, f;
279
- const v = t();
280
- for (const [E, S] of _.entries()) {
281
- const A = Array.from(S).entries();
282
- for (const [V, R] of A)
283
- if (R.index !== V || R.group !== E || !((a = v.get(E)) != null && a.has(R)))
284
- return;
285
- }
286
- const y = n.sortable.element, w = s.sortable.element;
287
- if (!w || !y || !b && s.id === n.sortable.group)
297
+ const h = t(), v = pe(h), c = o.sortable.group === l.sortable.group, u = h.get(o.sortable.group), _ = c ? u : h.get(l.sortable.group);
298
+ !u || !_ || queueMicrotask(() => {
299
+ n.defaultPrevented || a.renderer.rendering.then(() => {
300
+ var b, g;
301
+ const f = t();
302
+ if (ge(v, h, f))
303
+ return;
304
+ const O = o.sortable.element, x = l.sortable.element;
305
+ if (!x || !O || !c && l.id === o.sortable.group)
288
306
  return;
289
- const I = K(h), P = b ? I : K(g), d = (c = n.sortable.group) != null ? c : pe, l = (f = s.sortable.group) != null ? f : pe, u = {
290
- [d]: I,
291
- [l]: P
292
- }, x = it(u, i);
293
- if (u === x) return;
294
- const O = x[l].indexOf(n.sortable), M = x[l].indexOf(s.sortable);
295
- o.collisionObserver.disable(), ge(y, O, w, M), m(() => {
296
- for (const [E, S] of x[d].entries())
297
- S.index = E;
298
- if (!b)
299
- for (const [E, S] of x[l].entries())
300
- S.group = s.sortable.group, S.index = E;
301
- }), o.actions.setDropTarget(n.id).then(() => o.collisionObserver.enable());
307
+ const I = V(u), d = c ? I : V(_), p = (b = o.sortable.group) != null ? b : fe, s = (g = l.sortable.group) != null ? g : fe, y = {
308
+ [p]: I,
309
+ [s]: d
310
+ }, P = lt(y, n);
311
+ if (y === P) return;
312
+ const S = P[s].indexOf(o.sortable), C = P[s].indexOf(l.sortable);
313
+ a.collisionObserver.disable(), be(O, S, x, C), w(() => {
314
+ for (const [M, E] of P[p].entries())
315
+ E.index = M;
316
+ if (!c)
317
+ for (const [M, E] of P[s].entries())
318
+ E.group = l.sortable.group, E.index = M;
319
+ }), a.actions.setDropTarget(o.id).then(() => a.collisionObserver.enable());
302
320
  });
303
321
  });
304
322
  }),
305
- e.monitor.addEventListener("dragend", (i, o) => {
306
- if (!i.canceled)
323
+ e.monitor.addEventListener("dragend", (n, a) => {
324
+ if (!n.canceled)
307
325
  return;
308
- const { dragOperation: p } = o, { source: n } = p;
309
- D(n) && (n.sortable.initialIndex === n.sortable.index && n.sortable.initialGroup === n.sortable.group || queueMicrotask(() => {
310
- const s = t(), _ = s.get(
311
- n.sortable.initialGroup
326
+ const { dragOperation: i } = a, { source: o } = i;
327
+ m(o) && (o.sortable.initialIndex === o.sortable.index && o.sortable.initialGroup === o.sortable.group || queueMicrotask(() => {
328
+ const l = t(), h = pe(l), v = l.get(
329
+ o.sortable.initialGroup
312
330
  );
313
- _ && o.renderer.rendering.then(() => {
314
- for (const [c, f] of s.entries()) {
315
- const v = Array.from(f).entries();
316
- for (const [y, w] of v)
317
- if (w.index !== y || w.group !== c)
318
- return;
319
- }
320
- const b = K(_), h = n.sortable.element, g = b[n.sortable.initialIndex], a = g?.element;
321
- !g || !a || !h || (ge(h, g.index, a, n.index), m(() => {
322
- for (const [c, f] of s.entries()) {
323
- const v = Array.from(f).values();
324
- for (const y of v)
325
- y.index = y.initialIndex, y.group = y.initialGroup;
331
+ v && a.renderer.rendering.then(() => {
332
+ const c = t();
333
+ if (ge(h, l, c))
334
+ return;
335
+ const u = V(v), _ = V(
336
+ v,
337
+ ut
338
+ ), b = o.sortable.element, g = _.indexOf(o.sortable), f = u[g], O = f?.element;
339
+ !f || !O || !b || (be(b, f.index, O, o.index), w(() => {
340
+ for (const x of l.values()) {
341
+ const I = Array.from(x).values();
342
+ for (const d of I)
343
+ d.index = d.initialIndex, d.group = d.initialGroup;
326
344
  }
327
345
  }));
328
346
  });
@@ -330,55 +348,71 @@ var pe = "__default__", st = class extends he {
330
348
  })
331
349
  ];
332
350
  this.destroy = () => {
333
- for (const i of r)
334
- i();
351
+ for (const n of r)
352
+ n();
335
353
  };
336
354
  }
337
355
  };
338
- function ge(e, t, r, i) {
339
- const o = i < t ? "afterend" : "beforebegin";
340
- r.insertAdjacentElement(o, e);
356
+ function be(e, t, r, n) {
357
+ const a = n < t ? "afterend" : "beforebegin";
358
+ r.insertAdjacentElement(a, e);
341
359
  }
342
- function ot(e, t) {
360
+ function ct(e, t) {
343
361
  return e.index - t.index;
344
362
  }
345
- function K(e) {
346
- return Array.from(e).sort(ot);
363
+ function ut(e, t) {
364
+ return e.initialIndex - t.initialIndex;
365
+ }
366
+ function V(e, t = ct) {
367
+ return Array.from(e).sort(t);
347
368
  }
348
- var fe = [
349
- Qe,
350
- st
351
- ], at = {
369
+ var he = [
370
+ Ze,
371
+ dt
372
+ ], pt = {
352
373
  duration: 250,
353
374
  easing: "cubic-bezier(0.25, 1, 0.5, 1)",
354
375
  idle: !1
355
- }, H = new Pe(), Oe, me, G, X, B, L, Y, C;
356
- me = [te], Oe = [te];
357
- var Z = class {
376
+ };
377
+ function ve(e) {
378
+ var t, r;
379
+ return typeof e == "boolean" ? {
380
+ draggable: e,
381
+ droppable: e
382
+ } : {
383
+ draggable: (t = e?.draggable) != null ? t : !1,
384
+ droppable: (r = e?.droppable) != null ? r : !1
385
+ };
386
+ }
387
+ var q = new Ge(), Se, me, D, Y, W, B, Z, j;
388
+ me = [ne], Se = [ne];
389
+ var ee = class {
358
390
  constructor(e, t) {
359
- z(this, X, q(G, 8, this)), q(G, 11, this), z(this, B), z(this, L), z(this, Y, q(G, 12, this)), q(G, 15, this), z(this, C), this.register = () => (m(() => {
360
- var a, c;
361
- (a = this.manager) == null || a.registry.register(this.droppable), (c = this.manager) == null || c.registry.register(this.draggable);
391
+ R(this, Y, L(D, 8, this)), L(D, 11, this), R(this, W), R(this, B), R(this, Z, L(D, 12, this)), L(D, 15, this), R(this, j), this.register = () => (w(() => {
392
+ var g, f;
393
+ (g = this.manager) == null || g.registry.register(this.droppable), (f = this.manager) == null || f.registry.register(this.draggable);
362
394
  }), () => this.unregister()), this.unregister = () => {
363
- m(() => {
364
- var a, c;
365
- (a = this.manager) == null || a.registry.unregister(this.droppable), (c = this.manager) == null || c.registry.unregister(this.draggable);
395
+ w(() => {
396
+ var g, f;
397
+ (g = this.manager) == null || g.registry.unregister(this.droppable), (f = this.manager) == null || f.registry.unregister(this.draggable);
366
398
  });
367
399
  }, this.destroy = () => {
368
- m(() => {
400
+ w(() => {
369
401
  this.droppable.destroy(), this.draggable.destroy();
370
402
  });
371
403
  };
372
404
  var r = e, {
373
- effects: i = () => [],
374
- group: o,
375
- index: p,
376
- sensors: n,
377
- type: s,
378
- transition: _ = at,
379
- plugins: b
380
- } = r, h = Fe(r, [
405
+ effects: n = () => [],
406
+ disabled: a,
407
+ group: i,
408
+ index: o,
409
+ sensors: l,
410
+ type: h,
411
+ transition: v = pt,
412
+ plugins: c
413
+ } = r, u = Qe(r, [
381
414
  "effects",
415
+ "disabled",
382
416
  "group",
383
417
  "index",
384
418
  "sensors",
@@ -386,78 +420,83 @@ var Z = class {
386
420
  "transition",
387
421
  "plugins"
388
422
  ]);
389
- const g = re(b, fe);
390
- this.droppable = new ee(h, t, this), this.draggable = new we(
391
- de(le({}, h), {
392
- plugins: g,
423
+ const _ = ie(c, he), b = ve(a);
424
+ this.droppable = new te(
425
+ Q(J({}, u), { disabled: b.droppable }),
426
+ t,
427
+ this
428
+ ), this.draggable = new De(
429
+ Q(J({}, u), {
430
+ disabled: b.draggable,
431
+ plugins: _,
393
432
  effects: () => [
394
433
  () => {
395
- var a, c, f;
396
- const v = (a = this.manager) == null ? void 0 : a.dragOperation.status;
397
- v?.initializing && this.id === ((f = (c = this.manager) == null ? void 0 : c.dragOperation.source) == null ? void 0 : f.id) && H.clear(this.manager), v?.dragging && H.set(
434
+ var g, f, O;
435
+ const x = (g = this.manager) == null ? void 0 : g.dragOperation.status;
436
+ x?.initializing && this.id === ((O = (f = this.manager) == null ? void 0 : f.dragOperation.source) == null ? void 0 : O.id) && q.clear(this.manager), x?.dragging && q.set(
398
437
  this.manager,
399
438
  this.id,
400
- ae(() => ({
439
+ de(() => ({
401
440
  initialIndex: this.index,
402
441
  initialGroup: this.group
403
442
  }))
404
443
  );
405
444
  },
406
445
  () => {
407
- const { index: a, group: c, manager: f } = this, v = $(this, L), y = $(this, B);
408
- (a !== v || c !== y) && (k(this, L, a), k(this, B, c), this.animate());
446
+ const { index: g, group: f, manager: O } = this, x = A(this, B), I = A(this, W);
447
+ (g !== x || f !== I) && (G(this, B, g), G(this, W, f), this.animate());
409
448
  },
410
449
  () => {
411
- var a, c;
412
- const { target: f } = this, { isDragSource: v } = this.draggable;
413
- ((c = (a = this.draggable.pluginConfig(Te)) == null ? void 0 : a.feedback) != null ? c : "default") === "move" && v && (this.droppable.disabled = !f);
450
+ var g, f;
451
+ const { target: O } = this, { isDragSource: x } = this.draggable;
452
+ ((f = (g = this.draggable.pluginConfig(Re)) == null ? void 0 : g.feedback) != null ? f : "default") === "move" && x && (this.droppable.disabled = !O);
414
453
  },
415
- ...i()
454
+ ...n()
416
455
  ],
417
- type: s,
418
- sensors: n
456
+ type: h,
457
+ sensors: l
419
458
  }),
420
459
  t,
421
460
  this
422
- ), k(this, C, h.element), this.manager = t, this.index = p, k(this, L, p), this.group = o, k(this, B, o), this.type = s, this.transition = _;
461
+ ), G(this, j, u.element), this.manager = t, this.index = o, G(this, B, o), this.group = i, G(this, W, i), this.type = h, this.transition = v;
423
462
  }
424
463
  get initialIndex() {
425
464
  var e, t;
426
- return (t = (e = H.get(this.manager, this.id)) == null ? void 0 : e.initialIndex) != null ? t : this.index;
465
+ return (t = (e = q.get(this.manager, this.id)) == null ? void 0 : e.initialIndex) != null ? t : this.index;
427
466
  }
428
467
  get initialGroup() {
429
468
  var e, t;
430
- return (t = (e = H.get(this.manager, this.id)) == null ? void 0 : e.initialGroup) != null ? t : this.group;
469
+ return (t = (e = q.get(this.manager, this.id)) == null ? void 0 : e.initialGroup) != null ? t : this.group;
431
470
  }
432
471
  animate() {
433
- ae(() => {
472
+ de(() => {
434
473
  const { manager: e, transition: t } = this, { shape: r } = this.droppable;
435
474
  if (!e) return;
436
- const { idle: i } = e.dragOperation.status;
437
- !r || !t || i && !t.idle || e.renderer.rendering.then(() => {
438
- const { element: o } = this;
439
- if (!o)
475
+ const { idle: n } = e.dragOperation.status;
476
+ !r || !t || n && !t.idle || e.renderer.rendering.then(() => {
477
+ const { element: a } = this;
478
+ if (!a)
440
479
  return;
441
- for (const h of o.getAnimations())
442
- "transitionProperty" in h && (h.transitionProperty === "transform" || h.transitionProperty === "translate" || h.transitionProperty === "scale") && h.cancel();
443
- const p = this.refreshShape();
444
- if (!p)
480
+ for (const c of a.getAnimations())
481
+ "transitionProperty" in c && (c.transitionProperty === "transform" || c.transitionProperty === "translate" || c.transitionProperty === "scale") && c.cancel();
482
+ const i = this.refreshShape();
483
+ if (!i)
445
484
  return;
446
- const n = {
447
- x: r.boundingRectangle.left - p.boundingRectangle.left,
448
- y: r.boundingRectangle.top - p.boundingRectangle.top
449
- }, { translate: s } = Ae(o), _ = se(o, s, !1), b = se(o, s);
450
- if (n.x || n.y) {
451
- const h = Re(ze(o)) ? de(le({}, t), { duration: 0 }) : t;
452
- We({
453
- element: o,
485
+ const o = {
486
+ x: r.boundingRectangle.left - i.boundingRectangle.left,
487
+ y: r.boundingRectangle.top - i.boundingRectangle.top
488
+ }, { translate: l } = Be(a), h = ae(a, l, !1), v = ae(a, l);
489
+ if (o.x || o.y) {
490
+ const c = $e(Le(a)) ? Q(J({}, t), { duration: 0 }) : t;
491
+ Ke({
492
+ element: a,
454
493
  keyframes: {
455
494
  translate: [
456
- `${_.x + n.x}px ${_.y + n.y}px ${_.z}`,
457
- `${b.x}px ${b.y}px ${b.z}`
495
+ `${h.x + o.x}px ${h.y + o.y}px ${h.z}`,
496
+ `${v.x}px ${v.y}px ${v.z}`
458
497
  ]
459
498
  },
460
- options: h
499
+ options: c
461
500
  }).then(() => {
462
501
  e.dragOperation.status.dragging || (this.droppable.shape = void 0);
463
502
  });
@@ -469,21 +508,21 @@ var Z = class {
469
508
  return this.draggable.manager;
470
509
  }
471
510
  set manager(e) {
472
- m(() => {
511
+ w(() => {
473
512
  this.draggable.manager = e, this.droppable.manager = e;
474
513
  });
475
514
  }
476
515
  set element(e) {
477
- m(() => {
478
- const t = $(this, C), r = this.droppable.element, i = this.draggable.element;
479
- (!r || r === t) && (this.droppable.element = e), (!i || i === t) && (this.draggable.element = e), k(this, C, e);
516
+ w(() => {
517
+ const t = A(this, j), r = this.droppable.element, n = this.draggable.element;
518
+ (!r || r === t) && (this.droppable.element = e), (!n || n === t) && (this.draggable.element = e), G(this, j, e);
480
519
  });
481
520
  }
482
521
  get element() {
483
522
  var e, t;
484
- const r = $(this, C);
523
+ const r = A(this, j);
485
524
  if (r)
486
- return (t = (e = Me.get(r)) != null ? e : r) != null ? t : this.droppable.element;
525
+ return (t = (e = We.get(r)) != null ? e : r) != null ? t : this.droppable.element;
487
526
  }
488
527
  set target(e) {
489
528
  this.droppable.element = e;
@@ -498,18 +537,20 @@ var Z = class {
498
537
  return this.draggable.element;
499
538
  }
500
539
  get disabled() {
501
- return this.draggable.disabled && this.droppable.disabled;
540
+ const { disabled: e } = this.draggable, { disabled: t } = this.droppable;
541
+ return e === t ? e : { draggable: e, droppable: t };
502
542
  }
503
543
  set plugins(e) {
504
- this.draggable.plugins = re(e, fe);
544
+ this.draggable.plugins = ie(e, he);
505
545
  }
506
546
  set disabled(e) {
507
- m(() => {
508
- this.droppable.disabled = e, this.draggable.disabled = e;
547
+ const t = ve(e);
548
+ w(() => {
549
+ this.droppable.disabled = t.droppable, this.draggable.disabled = t.draggable;
509
550
  });
510
551
  }
511
552
  set data(e) {
512
- m(() => {
553
+ w(() => {
513
554
  this.droppable.data = e, this.draggable.data = e;
514
555
  });
515
556
  }
@@ -532,7 +573,7 @@ var Z = class {
532
573
  this.droppable.collisionPriority = e;
533
574
  }
534
575
  set collisionDetector(e) {
535
- this.droppable.collisionDetector = e ?? De;
576
+ this.droppable.collisionDetector = e ?? Te;
536
577
  }
537
578
  set alignment(e) {
538
579
  this.draggable.alignment = e;
@@ -541,7 +582,7 @@ var Z = class {
541
582
  return this.draggable.alignment;
542
583
  }
543
584
  set type(e) {
544
- m(() => {
585
+ w(() => {
545
586
  this.droppable.type = e, this.draggable.type = e;
546
587
  });
547
588
  }
@@ -585,16 +626,16 @@ var Z = class {
585
626
  return this.droppable.accepts(e);
586
627
  }
587
628
  };
588
- G = Ke();
589
- X = /* @__PURE__ */ new WeakMap();
590
- B = /* @__PURE__ */ new WeakMap();
591
- L = /* @__PURE__ */ new WeakMap();
629
+ D = Ue();
592
630
  Y = /* @__PURE__ */ new WeakMap();
593
- C = /* @__PURE__ */ new WeakMap();
594
- ye(G, 4, "index", me, Z, X);
595
- ye(G, 4, "group", Oe, Z, Y);
596
- Je(G, Z);
597
- var we = class extends Ge {
631
+ W = /* @__PURE__ */ new WeakMap();
632
+ B = /* @__PURE__ */ new WeakMap();
633
+ Z = /* @__PURE__ */ new WeakMap();
634
+ j = /* @__PURE__ */ new WeakMap();
635
+ Pe(D, 4, "index", me, ee, Y);
636
+ Pe(D, 4, "group", Se, ee, Z);
637
+ Ye(D, ee);
638
+ var De = class extends Ce {
598
639
  constructor(e, t, r) {
599
640
  super(e, t), this.sortable = r;
600
641
  }
@@ -610,7 +651,7 @@ var we = class extends Ge {
610
651
  get initialGroup() {
611
652
  return this.sortable.initialGroup;
612
653
  }
613
- }, ee = class extends Ee {
654
+ }, te = class extends je {
614
655
  constructor(e, t, r) {
615
656
  super(e, t), this.sortable = r;
616
657
  }
@@ -622,12 +663,12 @@ var we = class extends Ge {
622
663
  }
623
664
  };
624
665
  export {
625
- st as OptimisticSortingPlugin,
626
- Z as Sortable,
627
- we as SortableDraggable,
628
- ee as SortableDroppable,
629
- Qe as SortableKeyboardPlugin,
630
- at as defaultSortableTransition,
631
- D as isSortable,
632
- ht as isSortableOperation
666
+ dt as OptimisticSortingPlugin,
667
+ ee as Sortable,
668
+ De as SortableDraggable,
669
+ te as SortableDroppable,
670
+ Ze as SortableKeyboardPlugin,
671
+ pt as defaultSortableTransition,
672
+ m as isSortable,
673
+ yt as isSortableOperation
633
674
  };