@floegence/floe-webapp-core 0.26.2 → 0.26.5

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,219 +1,259 @@
1
- import { createComponent as c, spread as W, mergeProps as D, insert as a, effect as b, className as g, setAttribute as k, memo as re, template as f, use as oe, delegateEvents as ne } from "solid-js/web";
2
- import { splitProps as F, Show as m, createSignal as y, untrack as le, createEffect as _, For as se, onCleanup as ie } from "solid-js";
1
+ import { createComponent as u, spread as Z, mergeProps as ee, insert as c, effect as g, className as p, setStyleProperty as G, memo as J, use as K, setAttribute as C, template as h, delegateEvents as we } from "solid-js/web";
2
+ import { splitProps as te, Show as m, createSignal as b, untrack as Q, createEffect as z, For as xe, onCleanup as Y } from "solid-js";
3
3
  import { cn as v } from "../../utils/cn.js";
4
- import { deferAfterPaint as C } from "../../utils/defer.js";
5
- import { useViewActivation as de } from "../../context/ViewActivationContext.js";
6
- import { X as ae, Plus as ce, ChevronRight as ue } from "../icons/index.js";
7
- var ve = /* @__PURE__ */ f('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m15 18-6-6 6-6">'), fe = /* @__PURE__ */ f('<button type=button aria-label="Scroll left">'), he = /* @__PURE__ */ f('<button type=button aria-label="Add new tab">'), be = /* @__PURE__ */ f('<button type=button aria-label="Scroll right">'), ge = /* @__PURE__ */ f("<div><div>"), me = /* @__PURE__ */ f("<span class=flex-shrink-0>"), pe = /* @__PURE__ */ f("<button type=button>"), we = /* @__PURE__ */ f('<div role=tab><span class="truncate max-w-32">'), xe = /* @__PURE__ */ f("<div role=tabpanel>");
8
- const ye = (p) => (() => {
9
- var t = ve();
10
- return b(() => k(t, "class", p.class)), t;
4
+ import { deferAfterPaint as $ } from "../../utils/defer.js";
5
+ import { useViewActivation as ye } from "../../context/ViewActivationContext.js";
6
+ import { X as ke, Plus as $e, ChevronRight as Ce } from "../icons/index.js";
7
+ var Se = /* @__PURE__ */ h('<svg xmlns=http://www.w3.org/2000/svg width=24 height=24 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m15 18-6-6 6-6">'), Ae = /* @__PURE__ */ h('<button type=button aria-label="Scroll left">'), Ie = /* @__PURE__ */ h('<div class="pointer-events-none absolute bottom-0 left-0 z-10 h-0.5 bg-primary transition-[transform,width] duration-200 ease-out will-change-transform motion-reduce:transition-none">'), ze = /* @__PURE__ */ h('<button type=button aria-label="Add new tab">'), Re = /* @__PURE__ */ h('<button type=button aria-label="Scroll right">'), Le = /* @__PURE__ */ h("<div><div>"), _e = /* @__PURE__ */ h("<span class=flex-shrink-0>"), Ue = /* @__PURE__ */ h("<button type=button>"), Ee = /* @__PURE__ */ h('<div role=tab><span class="truncate max-w-32">'), Pe = /* @__PURE__ */ h("<div role=tabpanel>");
8
+ const Oe = (w) => (() => {
9
+ var t = Se();
10
+ return g(() => C(t, "class", w.class)), t;
11
11
  })();
12
- function ze(p) {
13
- const [t, A] = F(p, ["items", "activeId", "defaultActiveId", "onChange", "onActiveIdChange", "onClose", "onAdd", "showAdd", "closable", "size", "variant", "class"]);
14
- let i;
15
- const L = (() => {
12
+ function Xe(w) {
13
+ const [t, R] = te(w, ["items", "activeId", "defaultActiveId", "onChange", "onActiveIdChange", "onClose", "onAdd", "showAdd", "closable", "size", "variant", "class"]);
14
+ let d;
15
+ const j = (() => {
16
16
  try {
17
- return de();
17
+ return ye();
18
18
  } catch {
19
19
  return null;
20
20
  }
21
- })(), S = () => L ? L.active() : !0;
22
- let I = !1;
23
- const R = () => t.activeId !== void 0, N = () => t.onChange ?? t.onActiveIdChange, [U, V] = y(le(() => t.defaultActiveId ?? t.items[0]?.id ?? "")), E = () => R() ? t.activeId : U(), [X, O] = y(E());
24
- _(() => {
25
- O(E());
21
+ })(), x = () => j ? j.active() : !0;
22
+ let L = !1;
23
+ const [re, ne] = b(0), [oe, le] = b(0), [B, _] = b(!1), U = /* @__PURE__ */ new Map();
24
+ let E = !1;
25
+ const S = () => (t.variant ?? "default") === "underline", M = (r) => {
26
+ if (!d || !S()) return !1;
27
+ const o = U.get(r);
28
+ if (!o) return !1;
29
+ const s = d.getBoundingClientRect(), e = o.getBoundingClientRect(), n = e.left - s.left + d.scrollLeft, a = e.width;
30
+ return ne(n), le(a), _(a > 0), a > 0;
31
+ }, se = () => {
32
+ if (!S()) {
33
+ _(!1);
34
+ return;
35
+ }
36
+ M(P()) || _(!1);
37
+ }, A = () => {
38
+ E || (E = !0, $(() => {
39
+ E = !1, Q(() => {
40
+ x() && se();
41
+ });
42
+ }));
43
+ }, T = () => t.activeId !== void 0, ie = () => t.onChange ?? t.onActiveIdChange, [de, ae] = b(Q(() => t.defaultActiveId ?? t.items[0]?.id ?? "")), V = () => T() ? t.activeId : de(), [P, W] = b(V());
44
+ z(() => {
45
+ W(V());
46
+ }), z(() => {
47
+ x() && (t.variant, P(), A());
26
48
  });
27
- const [P, q] = y(!1), [j, G] = y(!1), [T, J] = y(!1), K = () => {
28
- if (!i) return;
49
+ const [X, ce] = b(!1), [F, ue] = b(!1), [H, fe] = b(!1), ve = () => {
50
+ if (!d) return;
29
51
  const {
30
52
  scrollLeft: r,
31
- scrollWidth: n,
32
- clientWidth: l
33
- } = i, e = n > l;
34
- J(e), q(r > 0), G(r + l < n - 1);
35
- }, $ = () => {
36
- I || (I = !0, C(() => {
37
- I = !1, S() && K();
53
+ scrollWidth: o,
54
+ clientWidth: s
55
+ } = d, e = o > s;
56
+ fe(e), ce(r > 0), ue(r + s < o - 1);
57
+ }, I = () => {
58
+ L || (L = !0, $(() => {
59
+ L = !1, x() && ve();
38
60
  }));
39
- }, Q = () => {
40
- i && i.scrollBy({
61
+ }, he = () => {
62
+ d && d.scrollBy({
41
63
  left: -150,
42
64
  behavior: "smooth"
43
65
  });
44
- }, Y = () => {
45
- i && i.scrollBy({
66
+ }, be = () => {
67
+ d && d.scrollBy({
46
68
  left: 150,
47
69
  behavior: "smooth"
48
70
  });
49
71
  };
50
- _(() => {
51
- if (!i || !S()) return;
52
- $();
53
- const r = () => $();
54
- i.addEventListener("scroll", r);
55
- const n = () => $();
56
- let l;
57
- typeof ResizeObserver < "u" ? (l = new ResizeObserver(n), l.observe(i)) : typeof window < "u" && window.addEventListener("resize", n), ie(() => {
58
- i?.removeEventListener("scroll", r), l?.disconnect(), typeof window < "u" && window.removeEventListener("resize", n);
72
+ z(() => {
73
+ if (!d || !x()) return;
74
+ I(), A();
75
+ const r = () => I();
76
+ d.addEventListener("scroll", r);
77
+ const o = () => {
78
+ I(), A();
79
+ };
80
+ let s;
81
+ typeof ResizeObserver < "u" ? (s = new ResizeObserver(o), s.observe(d)) : typeof window < "u" && window.addEventListener("resize", o), Y(() => {
82
+ d?.removeEventListener("scroll", r), s?.disconnect(), typeof window < "u" && window.removeEventListener("resize", o);
59
83
  });
60
- }), _(() => {
61
- S() && (t.items.length, $());
84
+ }), z(() => {
85
+ x() && (t.items.length, I(), A());
62
86
  });
63
- const B = (r, n) => {
64
- if (n) return;
65
- const l = N();
66
- if (O(r), R() || V(r), l) {
87
+ const D = (r, o) => {
88
+ if (o) return;
89
+ const s = ie();
90
+ if (W(r), S() && M(r), T() || ae(r), s) {
67
91
  const e = r;
68
- C(() => l(e));
92
+ $(() => s(e));
69
93
  }
70
- }, Z = (r, n) => {
94
+ }, ge = (r, o) => {
71
95
  r.stopPropagation();
72
- const l = t.onClose;
73
- if (!l) return;
74
- const e = n;
75
- C(() => l(e));
76
- }, z = {
96
+ const s = t.onClose;
97
+ if (!s) return;
98
+ const e = o;
99
+ $(() => s(e));
100
+ }, O = {
77
101
  sm: "h-7 px-2 text-[11px]",
78
102
  md: "h-8 px-3 text-xs"
79
- }, ee = (r, n) => {
80
- const l = "inline-flex items-center gap-1.5 font-medium transition-colors duration-150 whitespace-nowrap", e = n ? "cursor-not-allowed opacity-50" : "cursor-pointer";
103
+ }, me = (r, o) => {
104
+ const s = "inline-flex items-center gap-1.5 font-medium transition-colors duration-150 whitespace-nowrap", e = o ? "cursor-not-allowed opacity-50" : "cursor-pointer";
81
105
  return {
82
- default: v(l, e, z[t.size ?? "md"], "rounded-t border-b-2", r ? "border-primary text-foreground bg-background" : "border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50", n && "hover:bg-transparent hover:text-muted-foreground"),
83
- card: v(l, e, z[t.size ?? "md"], "rounded-t border border-b-0", r ? "border-border bg-background text-foreground -mb-px z-10" : "border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50", n && "hover:bg-transparent hover:text-muted-foreground"),
84
- underline: v(l, e, z[t.size ?? "md"], "border-b-2 -mb-px", r ? "border-primary text-foreground" : "border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground/50", n && "hover:border-transparent hover:text-muted-foreground")
106
+ default: v(s, e, O[t.size ?? "md"], "rounded-t border-b-2", r ? "border-primary text-foreground bg-background" : "border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50", o && "hover:bg-transparent hover:text-muted-foreground"),
107
+ card: v(s, e, O[t.size ?? "md"], "rounded-t border border-b-0", r ? "border-border bg-background text-foreground -mb-px z-10" : "border-transparent text-muted-foreground hover:text-foreground hover:bg-muted/50", o && "hover:bg-transparent hover:text-muted-foreground"),
108
+ underline: v(s, e, O[t.size ?? "md"], "border-b-2 -mb-px", r ? B() ? "border-transparent text-foreground" : "border-primary text-foreground" : "border-transparent text-muted-foreground hover:text-foreground hover:border-muted-foreground/50", o && "hover:border-transparent hover:text-muted-foreground")
85
109
  }[t.variant ?? "default"];
86
- }, te = {
110
+ }, pe = {
87
111
  default: "border-b border-border",
88
112
  card: "border-b border-border",
89
113
  underline: "border-b border-border"
90
114
  };
91
115
  return (() => {
92
- var r = ge(), n = r.firstChild;
93
- W(r, D({
116
+ var r = Le(), o = r.firstChild;
117
+ Z(r, ee({
94
118
  get class() {
95
- return v("relative flex items-center gap-0.5", te[t.variant ?? "default"], t.class);
119
+ return v("relative flex items-center gap-0.5", pe[t.variant ?? "default"], t.class);
96
120
  }
97
- }, A), !1, !0), a(r, c(m, {
121
+ }, R), !1, !0), c(r, u(m, {
98
122
  get when() {
99
- return T();
123
+ return H();
100
124
  },
101
125
  get children() {
102
- var e = fe();
103
- return e.$$click = Q, a(e, c(ye, {
126
+ var e = Ae();
127
+ return e.$$click = he, c(e, u(Oe, {
104
128
  class: "w-4 h-4"
105
- })), b((s) => {
106
- var h = !P(), d = v("flex-shrink-0 flex items-center justify-center", "w-6 h-6 rounded cursor-pointer", "transition-all duration-150", P() ? "text-muted-foreground hover:text-foreground hover:bg-muted/80 opacity-100" : "opacity-0 pointer-events-none");
107
- return h !== s.e && (e.disabled = s.e = h), d !== s.t && g(e, s.t = d), s;
129
+ })), g((n) => {
130
+ var a = !X(), i = v("flex-shrink-0 flex items-center justify-center", "w-6 h-6 rounded cursor-pointer", "transition-all duration-150", X() ? "text-muted-foreground hover:text-foreground hover:bg-muted/80 opacity-100" : "opacity-0 pointer-events-none");
131
+ return a !== n.e && (e.disabled = n.e = a), i !== n.t && p(e, n.t = i), n;
132
+ }, {
133
+ e: void 0,
134
+ t: void 0
135
+ }), e;
136
+ }
137
+ }), o);
138
+ var s = d;
139
+ return typeof s == "function" ? K(s, o) : d = o, c(o, u(m, {
140
+ get when() {
141
+ return J(() => !!S())() && B();
142
+ },
143
+ get children() {
144
+ var e = Ie();
145
+ return g((n) => {
146
+ var a = `translate3d(${re()}px, 0, 0)`, i = `${oe()}px`;
147
+ return a !== n.e && G(e, "transform", n.e = a), i !== n.t && G(e, "width", n.t = i), n;
108
148
  }, {
109
149
  e: void 0,
110
150
  t: void 0
111
151
  }), e;
112
152
  }
113
- }), n);
114
- var l = i;
115
- return typeof l == "function" ? oe(l, n) : i = n, a(n, c(se, {
153
+ }), null), c(o, u(xe, {
116
154
  get each() {
117
155
  return t.items;
118
156
  },
119
157
  children: (e) => {
120
- const s = () => e.id === X(), h = () => e.closable ?? t.closable ?? !1;
158
+ const n = () => e.id === P(), a = () => e.closable ?? t.closable ?? !1;
121
159
  return (() => {
122
- var d = we(), M = d.firstChild;
123
- return d.$$keydown = (o) => {
124
- (o.key === "Enter" || o.key === " ") && (o.preventDefault(), B(e.id, e.disabled));
125
- }, d.$$click = () => B(e.id, e.disabled), a(d, c(m, {
160
+ var i = Ee(), N = i.firstChild;
161
+ return i.$$keydown = (l) => {
162
+ (l.key === "Enter" || l.key === " ") && (l.preventDefault(), D(e.id, e.disabled));
163
+ }, i.$$click = () => D(e.id, e.disabled), K((l) => {
164
+ U.set(e.id, l), Y(() => U.delete(e.id));
165
+ }, i), c(i, u(m, {
126
166
  get when() {
127
167
  return e.icon;
128
168
  },
129
169
  get children() {
130
- var o = me();
131
- return a(o, () => e.icon), o;
170
+ var l = _e();
171
+ return c(l, () => e.icon), l;
132
172
  }
133
- }), M), a(M, () => e.label), a(d, c(m, {
173
+ }), N), c(N, () => e.label), c(i, u(m, {
134
174
  get when() {
135
- return re(() => !!h())() && !e.disabled;
175
+ return J(() => !!a())() && !e.disabled;
136
176
  },
137
177
  get children() {
138
- var o = pe();
139
- return o.$$click = (u) => Z(u, e.id), a(o, c(ae, {
178
+ var l = Ue();
179
+ return l.$$click = (f) => ge(f, e.id), c(l, u(ke, {
140
180
  class: "w-3 h-3"
141
- })), b((u) => {
142
- var w = v("flex-shrink-0 flex items-center justify-center", "w-5 h-5 rounded cursor-pointer", "bg-transparent text-muted-foreground", "hover:bg-red-500 hover:text-white", "transition-colors duration-150", "ml-1.5"), x = `Close ${e.label}`;
143
- return w !== u.e && g(o, u.e = w), x !== u.t && k(o, "aria-label", u.t = x), u;
181
+ })), g((f) => {
182
+ var y = v("flex-shrink-0 flex items-center justify-center", "w-5 h-5 rounded cursor-pointer", "bg-transparent text-muted-foreground", "hover:bg-red-500 hover:text-white", "transition-colors duration-150", "ml-1.5"), k = `Close ${e.label}`;
183
+ return y !== f.e && p(l, f.e = y), k !== f.t && C(l, "aria-label", f.t = k), f;
144
184
  }, {
145
185
  e: void 0,
146
186
  t: void 0
147
- }), o;
187
+ }), l;
148
188
  }
149
- }), null), b((o) => {
150
- var u = ee(s(), e.disabled), w = s(), x = e.disabled, H = e.disabled ? -1 : 0;
151
- return u !== o.e && g(d, o.e = u), w !== o.t && k(d, "aria-selected", o.t = w), x !== o.a && k(d, "aria-disabled", o.a = x), H !== o.o && k(d, "tabindex", o.o = H), o;
189
+ }), null), g((l) => {
190
+ var f = me(n(), e.disabled), y = n(), k = e.disabled, q = e.disabled ? -1 : 0;
191
+ return f !== l.e && p(i, l.e = f), y !== l.t && C(i, "aria-selected", l.t = y), k !== l.a && C(i, "aria-disabled", l.a = k), q !== l.o && C(i, "tabindex", l.o = q), l;
152
192
  }, {
153
193
  e: void 0,
154
194
  t: void 0,
155
195
  a: void 0,
156
196
  o: void 0
157
- }), d;
197
+ }), i;
158
198
  })();
159
199
  }
160
- })), a(r, c(m, {
200
+ }), null), c(r, u(m, {
161
201
  get when() {
162
202
  return t.showAdd;
163
203
  },
164
204
  get children() {
165
- var e = he();
205
+ var e = ze();
166
206
  return e.$$click = () => {
167
- const s = t.onAdd;
168
- s && C(() => s());
169
- }, a(e, c(ce, {
207
+ const n = t.onAdd;
208
+ n && $(() => n());
209
+ }, c(e, u($e, {
170
210
  get class() {
171
211
  return t.size === "sm" ? "w-3.5 h-3.5" : "w-4 h-4";
172
212
  }
173
- })), b(() => g(e, v("flex-shrink-0 flex items-center justify-center", "rounded hover:bg-muted/80 cursor-pointer", "text-muted-foreground hover:text-foreground", "transition-colors duration-150", t.size === "sm" ? "w-6 h-6" : "w-7 h-7"))), e;
213
+ })), g(() => p(e, v("flex-shrink-0 flex items-center justify-center", "rounded hover:bg-muted/80 cursor-pointer", "text-muted-foreground hover:text-foreground", "transition-colors duration-150", t.size === "sm" ? "w-6 h-6" : "w-7 h-7"))), e;
174
214
  }
175
- }), null), a(r, c(m, {
215
+ }), null), c(r, u(m, {
176
216
  get when() {
177
- return T();
217
+ return H();
178
218
  },
179
219
  get children() {
180
- var e = be();
181
- return e.$$click = Y, a(e, c(ue, {
220
+ var e = Re();
221
+ return e.$$click = be, c(e, u(Ce, {
182
222
  class: "w-4 h-4"
183
- })), b((s) => {
184
- var h = !j(), d = v("flex-shrink-0 flex items-center justify-center", "w-6 h-6 rounded cursor-pointer", "transition-all duration-150", j() ? "text-muted-foreground hover:text-foreground hover:bg-muted/80 opacity-100" : "opacity-0 pointer-events-none");
185
- return h !== s.e && (e.disabled = s.e = h), d !== s.t && g(e, s.t = d), s;
223
+ })), g((n) => {
224
+ var a = !F(), i = v("flex-shrink-0 flex items-center justify-center", "w-6 h-6 rounded cursor-pointer", "transition-all duration-150", F() ? "text-muted-foreground hover:text-foreground hover:bg-muted/80 opacity-100" : "opacity-0 pointer-events-none");
225
+ return a !== n.e && (e.disabled = n.e = a), i !== n.t && p(e, n.t = i), n;
186
226
  }, {
187
227
  e: void 0,
188
228
  t: void 0
189
229
  }), e;
190
230
  }
191
- }), null), b(() => g(n, v(
192
- "flex-1 flex items-end gap-0.5 overflow-x-auto",
231
+ }), null), g(() => p(o, v(
232
+ "relative flex-1 flex items-end gap-0.5 overflow-x-auto",
193
233
  "scrollbar-none",
194
234
  // Hide scrollbar for all browsers
195
235
  "[&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]"
196
236
  ))), r;
197
237
  })();
198
238
  }
199
- function _e(p) {
200
- const [t, A] = F(p, ["active", "keepMounted", "class", "children"]);
201
- return c(m, {
239
+ function Fe(w) {
240
+ const [t, R] = te(w, ["active", "keepMounted", "class", "children"]);
241
+ return u(m, {
202
242
  get when() {
203
243
  return t.keepMounted || t.active;
204
244
  },
205
245
  get children() {
206
- var i = xe();
207
- return W(i, D({
246
+ var d = Pe();
247
+ return Z(d, ee({
208
248
  get class() {
209
249
  return v(!t.active && t.keepMounted && "hidden", t.class);
210
250
  }
211
- }, A), !1, !0), a(i, () => t.children), i;
251
+ }, R), !1, !0), c(d, () => t.children), d;
212
252
  }
213
253
  });
214
254
  }
215
- ne(["click", "keydown"]);
255
+ we(["click", "keydown"]);
216
256
  export {
217
- _e as TabPanel,
218
- ze as Tabs
257
+ Fe as TabPanel,
258
+ Xe as Tabs
219
259
  };
@@ -1,77 +1,77 @@
1
- import { createEffect as B, onCleanup as G } from "solid-js";
1
+ import { createEffect as q, onCleanup as G } from "solid-js";
2
2
  import { useDeck as z } from "../context/DeckContext.js";
3
- import { applyDragDelta as R } from "../utils/gridLayout.js";
4
- import { getGridConfigFromElement as N } from "../components/deck/DeckGrid.js";
5
- import { lockBodyStyle as O } from "../utils/bodyStyleLock.js";
6
- function V() {
3
+ import { applyDragDelta as N } from "../utils/gridLayout.js";
4
+ import { getGridConfigFromElement as O } from "../components/deck/DeckGrid.js";
5
+ import { lockBodyStyle as U } from "../utils/bodyStyleLock.js";
6
+ function Z() {
7
7
  const p = z();
8
- let c = null, m = 0, f = 0, L = 0, g = 0, l = 0, P = 0, A = 0, F = 0, a = null, v = null, T = null, y = null, n = null, I = 0, k = 0, w = null;
8
+ let c = null, m = 0, f = 0, L = 0, g = 0, i = 0, P = 0, A = 0, F = 0, a = null, v = null, T = null, y = null, n = null, b = null, k = 0, C = 0, w = null;
9
9
  const M = (t) => {
10
10
  if (!t) {
11
11
  y?.(), y = null;
12
12
  return;
13
13
  }
14
- y?.(), y = O({ cursor: "grabbing", "user-select": "none" });
15
- }, C = () => {
16
- c !== null && (a !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(a), a = null), c = null, v = null, T = null, n = null, w = null, M(!1), p.endDrag(!0));
17
- }, X = () => {
14
+ y?.(), y = U({ cursor: "grabbing", "user-select": "none" });
15
+ }, H = () => {
16
+ c !== null && (a !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(a), a = null), c = null, v = null, T = null, n = null, b = null, w = null, M(!1), p.endDrag(!0));
17
+ }, Y = () => {
18
18
  if (!n) return;
19
- const t = n.getBoundingClientRect(), e = 48, d = 24, s = l - t.top, o = t.bottom - l;
19
+ const t = b ?? n.getBoundingClientRect(), e = 48, d = 24, s = i - t.top, o = t.bottom - i;
20
20
  let r = 0;
21
21
  if (s < e ? r = -Math.ceil((e - s) / e * d) : o < e && (r = Math.ceil((e - o) / e * d)), r === 0) return;
22
- const i = n.scrollTop, h = Math.max(0, Math.min(i + r, n.scrollHeight - n.clientHeight));
23
- h !== i && (n.scrollTop = h);
24
- }, Y = () => {
22
+ const l = n.scrollTop, h = Math.max(0, Math.min(l + r, n.scrollHeight - n.clientHeight));
23
+ h !== l && (n.scrollTop = h);
24
+ }, B = () => {
25
25
  if (a !== null || typeof requestAnimationFrame > "u") return;
26
26
  const t = () => {
27
27
  if (c === null) {
28
28
  a = null;
29
29
  return;
30
30
  }
31
- x(), a = requestAnimationFrame(t);
31
+ X(), a = requestAnimationFrame(t);
32
32
  };
33
33
  a = requestAnimationFrame(t);
34
- }, H = (t) => {
34
+ }, S = (t) => {
35
35
  const e = t.target;
36
36
  if (e.closest('button, input, select, textarea, [role="button"], a') || e.closest("[data-widget-resize-handle]")) return;
37
37
  const o = e.closest("[data-widget-drag-handle]");
38
38
  if (!o || t.pointerType === "mouse" && t.button !== 0) return;
39
39
  const r = o.dataset.widgetDragHandle;
40
40
  if (!r) return;
41
- const i = o.closest(".deck-grid");
42
- if (!i) return;
43
- t.preventDefault(), t.stopPropagation(), c = t.pointerId, m = t.clientX, f = t.clientY, g = m, l = f, P = m, A = f, v = r, T = o, n = i, L = i.scrollTop, F = L, M(!0);
44
- const u = p.activeLayout()?.widgets.find((b) => b.id === r);
41
+ const l = o.closest(".deck-grid");
42
+ if (!l) return;
43
+ t.preventDefault(), t.stopPropagation(), c = t.pointerId, m = t.clientX, f = t.clientY, g = m, i = f, P = m, A = f, v = r, T = o, n = l, b = l.getBoundingClientRect(), L = l.scrollTop, F = L, M(!0);
44
+ const u = p.activeLayout()?.widgets.find((I) => I.id === r);
45
45
  w = u ? { ...u.position } : null;
46
- const E = window.getComputedStyle(i);
47
- I = parseFloat(E.paddingLeft) || 0, k = parseFloat(E.paddingRight) || 0, p.startDrag(r, m, f), o.setPointerCapture(t.pointerId), Y();
48
- }, S = (t) => {
49
- c !== t.pointerId || !v || (g = t.clientX, l = t.clientY, typeof requestAnimationFrame > "u" && x());
50
- }, x = () => {
46
+ const E = window.getComputedStyle(l);
47
+ k = parseFloat(E.paddingLeft) || 0, C = parseFloat(E.paddingRight) || 0, p.startDrag(r, m, f), o.setPointerCapture(t.pointerId), B();
48
+ }, x = (t) => {
49
+ c !== t.pointerId || !v || (g = t.clientX, i = t.clientY, typeof requestAnimationFrame > "u" && X());
50
+ }, X = () => {
51
51
  if (!v || !n || !w) return;
52
- X();
52
+ Y();
53
53
  const t = n.scrollTop;
54
- if (g === P && l === A && t === F) return;
55
- P = g, A = l, F = t;
56
- const e = g - m, d = l - f + (t - L), { cols: s, rowHeight: o, gap: r } = N(n), i = n.clientWidth - I - k, h = r * (s - 1), u = (i - h) / s;
54
+ if (g === P && i === A && t === F) return;
55
+ P = g, A = i, F = t;
56
+ const e = g - m, d = i - f + (t - L), { cols: s, rowHeight: o, gap: r } = O(n), l = n.clientWidth - k - C, h = r * (s - 1), u = (l - h) / s;
57
57
  if (!Number.isFinite(u) || u <= 0) return;
58
- const E = o + r, b = Math.round(e / u), W = Math.round(d / E), q = R(w, b, W, s);
59
- p.updateDrag(q, { x: e, y: d });
58
+ const E = o + r, I = Math.round(e / u), R = Math.round(d / E), W = N(w, I, R, s);
59
+ p.updateDrag(W, { x: e, y: d });
60
60
  }, D = (t) => {
61
61
  if (c === t.pointerId) {
62
62
  try {
63
63
  T?.releasePointerCapture(t.pointerId);
64
64
  } catch {
65
65
  }
66
- C();
66
+ H();
67
67
  }
68
68
  };
69
- B(() => {
70
- p.editMode() && (typeof document > "u" || (document.addEventListener("pointerdown", H, !0), document.addEventListener("pointermove", S, !0), document.addEventListener("pointerup", D, !0), document.addEventListener("pointercancel", D, !0), G(() => {
71
- C(), document.removeEventListener("pointerdown", H, !0), document.removeEventListener("pointermove", S, !0), document.removeEventListener("pointerup", D, !0), document.removeEventListener("pointercancel", D, !0);
69
+ q(() => {
70
+ p.editMode() && (typeof document > "u" || (document.addEventListener("pointerdown", S, !0), document.addEventListener("pointermove", x, !0), document.addEventListener("pointerup", D, !0), document.addEventListener("pointercancel", D, !0), G(() => {
71
+ H(), document.removeEventListener("pointerdown", S, !0), document.removeEventListener("pointermove", x, !0), document.removeEventListener("pointerup", D, !0), document.removeEventListener("pointercancel", D, !0);
72
72
  })));
73
73
  });
74
74
  }
75
75
  export {
76
- V as useDeckDrag
76
+ Z as useDeckDrag
77
77
  };