@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,248 +1,264 @@
1
- import { addEventListener as se, use as de, insert as C, createComponent as v, effect as X, setStyleProperty as R, className as T, template as x, Dynamic as ge, setAttribute as ue, memo as me, delegateEvents as fe } from "solid-js/web";
2
- import { createMemo as z, Show as p, For as W, untrack as he, createSignal as ve, onCleanup as xe } from "solid-js";
3
- import { cn as _ } from "../../utils/cn.js";
4
- import { useMediaQuery as M } from "../../hooks/useMediaQuery.js";
5
- import { useVirtualWindow as be } from "../../hooks/useVirtualWindow.js";
6
- import { useFileBrowser as J } from "./FileBrowserContext.js";
7
- import { useFileBrowserDrag as De } from "../../context/FileBrowserDragContext.js";
8
- import { FolderIcon as Ce, getFileIcon as Ie } from "./FileIcons.js";
9
- import { createLongPressContextMenuHandlers as we } from "./longPressContextMenu.js";
10
- var ye = /* @__PURE__ */ x('<mark class="bg-warning/40 text-inherit rounded-sm">'), Pe = /* @__PURE__ */ x('<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-2">'), Se = /* @__PURE__ */ x("<div><div class=p-3>"), $e = /* @__PURE__ */ x('<span>No files matching "<!>"'), Te = /* @__PURE__ */ x('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), _e = /* @__PURE__ */ x('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), Le = /* @__PURE__ */ x("<span>This folder is empty"), ke = /* @__PURE__ */ x('<div class="absolute top-1.5 right-1.5 w-4 h-4 rounded-full bg-primary flex items-center justify-center"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=3 stroke-linecap=round stroke-linejoin=round class="w-2.5 h-2.5 text-primary-foreground"><polyline points="20 6 9 17 4 12">'), Ee = /* @__PURE__ */ x("<button type=button><div></div><span></span><div>");
1
+ import { addEventListener as de, use as q, insert as w, createComponent as b, effect as Y, setStyleProperty as G, className as L, template as D, Dynamic as ge, setAttribute as ue, memo as me, delegateEvents as fe } from "solid-js/web";
2
+ import { createSignal as J, createMemo as j, createEffect as he, Show as p, For as Z, untrack as ve, onCleanup as xe } from "solid-js";
3
+ import { cn as k } from "../../utils/cn.js";
4
+ import { useResizeObserver as be } from "../../hooks/useResizeObserver.js";
5
+ import { useVirtualWindow as De } from "../../hooks/useVirtualWindow.js";
6
+ import { useFileBrowser as ee } from "./FileBrowserContext.js";
7
+ import { useFileBrowserDrag as Ce } from "../../context/FileBrowserDragContext.js";
8
+ import { FolderIcon as Ie, getFileIcon as we } from "./FileIcons.js";
9
+ import { createLongPressContextMenuHandlers as ye } from "./longPressContextMenu.js";
10
+ var Se = /* @__PURE__ */ D('<mark class="bg-warning/40 text-inherit rounded-sm">'), Me = /* @__PURE__ */ D('<div class="grid gap-2">'), Pe = /* @__PURE__ */ D('<div><div class=p-3><div class="w-full h-0"aria-hidden=true>'), _e = /* @__PURE__ */ D('<span>No files matching "<!>"'), $e = /* @__PURE__ */ D('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), Te = /* @__PURE__ */ D('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), Ee = /* @__PURE__ */ D("<span>This folder is empty"), Le = /* @__PURE__ */ D('<div class="absolute top-1.5 right-1.5 w-4 h-4 rounded-full bg-primary flex items-center justify-center"><svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=3 stroke-linecap=round stroke-linejoin=round class="w-2.5 h-2.5 text-primary-foreground"><polyline points="20 6 9 17 4 12">'), ke = /* @__PURE__ */ D("<button type=button><div></div><span></span><div>");
11
11
  function Fe(e) {
12
- const n = z(() => {
12
+ const n = j(() => {
13
13
  if (!e.match || e.match.matchedIndices.length === 0)
14
14
  return [{
15
15
  text: e.name,
16
16
  highlight: !1
17
17
  }];
18
- const i = [], b = new Set(e.match.matchedIndices);
19
- let m = "", s = !1;
20
- for (let l = 0; l < e.name.length; l++) {
21
- const g = b.has(l);
22
- l === 0 ? (s = g, m = e.name[l]) : g === s ? m += e.name[l] : (i.push({
23
- text: m,
24
- highlight: s
25
- }), m = e.name[l], s = g);
18
+ const o = [], C = new Set(e.match.matchedIndices);
19
+ let h = "", u = !1;
20
+ for (let c = 0; c < e.name.length; c++) {
21
+ const f = C.has(c);
22
+ c === 0 ? (u = f, h = e.name[c]) : f === u ? h += e.name[c] : (o.push({
23
+ text: h,
24
+ highlight: u
25
+ }), h = e.name[c], u = f);
26
26
  }
27
- return m && i.push({
28
- text: m,
29
- highlight: s
30
- }), i;
27
+ return h && o.push({
28
+ text: h,
29
+ highlight: u
30
+ }), o;
31
31
  });
32
- return v(W, {
32
+ return b(Z, {
33
33
  get each() {
34
34
  return n();
35
35
  },
36
- children: (i) => v(p, {
36
+ children: (o) => b(p, {
37
37
  get when() {
38
- return i.highlight;
38
+ return o.highlight;
39
39
  },
40
40
  get fallback() {
41
- return me(() => i.text);
41
+ return me(() => o.text);
42
42
  },
43
43
  get children() {
44
- var b = ye();
45
- return C(b, () => i.text), b;
44
+ var C = Se();
45
+ return w(C, () => o.text), C;
46
46
  }
47
47
  })
48
48
  });
49
49
  }
50
- function Ue(e) {
51
- const n = J(), i = De(), b = () => (e.enableDragDrop ?? !0) && !!i, m = () => e.instanceId ?? "default", s = M("(min-width: 640px)"), l = M("(min-width: 768px)"), g = M("(min-width: 1024px)"), S = M("(min-width: 1280px)"), I = () => S() ? 6 : g() ? 5 : l() ? 4 : s() ? 3 : 2, d = 112, H = 8, D = be({
52
- count: () => Math.ceil(n.currentFiles().length / Math.max(1, I())),
53
- itemSize: () => d + H,
50
+ function je(e) {
51
+ const n = ee(), o = Ce(), C = () => (e.enableDragDrop ?? !0) && !!o, h = () => e.instanceId ?? "default", u = 112, c = 8, f = 180, y = 2, T = 6, [m, A] = J(null), O = be(m), v = j(() => {
52
+ const d = O()?.width ?? 0;
53
+ if (d <= 0) return y;
54
+ const x = Math.floor((d + c) / (f + c));
55
+ return Math.max(y, Math.min(T, x));
56
+ }), F = () => u + c, s = De({
57
+ count: () => Math.ceil(n.currentFiles().length / Math.max(1, v())),
58
+ itemSize: F,
54
59
  overscan: 2
55
- }), L = () => D.range().start * I(), f = () => Math.min(n.currentFiles().length, D.range().end * I()), G = z(() => n.currentFiles().slice(L(), f()));
56
- return (() => {
57
- var h = Se(), k = h.firstChild;
58
- return se(h, "scroll", D.onScroll), de((u) => {
59
- D.scrollRef(u), n.setScrollContainer(u);
60
- }, h), C(k, v(p, {
60
+ }), B = () => s.range().start * v(), E = () => Math.min(n.currentFiles().length, s.range().end * v()), H = j(() => n.currentFiles().slice(B(), E()));
61
+ let $ = null, S = y;
62
+ return he(() => {
63
+ const d = v();
64
+ if (!$) {
65
+ S = d;
66
+ return;
67
+ }
68
+ if (d === S) return;
69
+ const x = F(), a = Math.floor($.scrollTop / Math.max(1, x)) * Math.max(1, S), r = Math.floor(a / Math.max(1, d));
70
+ $.scrollTop = r * x, s.onScroll(), S = d;
71
+ }), (() => {
72
+ var d = Pe(), x = d.firstChild, M = x.firstChild;
73
+ return de(d, "scroll", s.onScroll), q((a) => {
74
+ $ = a, s.scrollRef(a), n.setScrollContainer(a);
75
+ }, d), q((a) => A(a), M), w(x, b(p, {
61
76
  get when() {
62
77
  return n.currentFiles().length > 0;
63
78
  },
64
79
  get fallback() {
65
80
  return (() => {
66
- var u = _e();
67
- return C(u, v(p, {
81
+ var a = Te();
82
+ return w(a, b(p, {
68
83
  get when() {
69
84
  return n.filterQueryApplied().trim();
70
85
  },
71
86
  get fallback() {
72
- return Le();
87
+ return Ee();
73
88
  },
74
89
  get children() {
75
90
  return [(() => {
76
- var a = $e(), P = a.firstChild, w = P.nextSibling;
77
- return w.nextSibling, C(a, () => n.filterQueryApplied(), w), a;
91
+ var r = _e(), P = r.firstChild, I = P.nextSibling;
92
+ return I.nextSibling, w(r, () => n.filterQueryApplied(), I), r;
78
93
  })(), (() => {
79
- var a = Te();
80
- return a.$$click = () => n.setFilterQuery(""), a;
94
+ var r = $e();
95
+ return r.$$click = () => n.setFilterQuery(""), r;
81
96
  })()];
82
97
  }
83
- })), u;
98
+ })), a;
84
99
  })();
85
100
  },
86
101
  get children() {
87
- var u = Pe();
88
- return C(u, v(W, {
102
+ var a = Me();
103
+ return w(a, b(Z, {
89
104
  get each() {
90
- return G();
105
+ return H();
91
106
  },
92
- children: (a) => v(Me, {
93
- item: a,
107
+ children: (r) => b(He, {
108
+ item: r,
94
109
  get instanceId() {
95
- return m();
110
+ return h();
96
111
  },
97
112
  get enableDragDrop() {
98
- return b();
113
+ return C();
99
114
  },
100
- dragContext: i
115
+ dragContext: o
101
116
  })
102
- })), X((a) => {
103
- var P = `${D.paddingTop()}px`, w = `${D.paddingBottom()}px`;
104
- return P !== a.e && R(u, "padding-top", a.e = P), w !== a.t && R(u, "padding-bottom", a.t = w), a;
117
+ })), Y((r) => {
118
+ var P = `repeat(${v()}, minmax(0, 1fr))`, I = `${s.paddingTop()}px`, R = `${s.paddingBottom()}px`;
119
+ return P !== r.e && G(a, "grid-template-columns", r.e = P), I !== r.t && G(a, "padding-top", r.t = I), R !== r.a && G(a, "padding-bottom", r.a = R), r;
105
120
  }, {
106
121
  e: void 0,
107
- t: void 0
108
- }), u;
122
+ t: void 0,
123
+ a: void 0
124
+ }), a;
109
125
  }
110
- })), X(() => T(h, _("h-full min-h-0 overflow-auto", e.class))), h;
126
+ }), null), Y(() => L(d, k("h-full min-h-0 overflow-auto", e.class))), d;
111
127
  })();
112
128
  }
113
- function Me(e) {
114
- const n = J(), i = () => n.isSelected(e.item.id), b = () => n.getFilterMatchForId(e.item.id), m = he(() => e.item), s = we(n, m);
115
- let l, g = null, S = 0, I = 0, d = !1;
116
- const H = 5, A = 500;
117
- let $ = null;
118
- const [D, L] = ve(!1), f = () => l === "touch" || l === "pen", G = () => e.item.type === "folder", h = () => G() && e.enableDragDrop && e.dragContext, k = () => {
119
- if (!h() || !e.dragContext) return !1;
129
+ function He(e) {
130
+ const n = ee(), o = () => n.isSelected(e.item.id), C = () => n.getFilterMatchForId(e.item.id), h = ve(() => e.item), u = ye(n, h);
131
+ let c, f = null, y = 0, T = 0, m = !1;
132
+ const A = 5, O = 500;
133
+ let v = null;
134
+ const [F, N] = J(!1), s = () => c === "touch" || c === "pen", B = () => e.item.type === "folder", E = () => B() && e.enableDragDrop && e.dragContext, H = () => {
135
+ if (!E() || !e.dragContext) return !1;
120
136
  const t = e.dragContext.dragState();
121
137
  return t.isDragging ? e.dragContext.canDropOn(t.draggedItems, e.item.path, e.item, e.instanceId) : !1;
122
- }, u = () => {
138
+ }, $ = () => {
123
139
  if (!e.dragContext) return !1;
124
140
  const t = e.dragContext.dragState();
125
- return t.isDragging ? t.draggedItems.some((r) => r.item.id === e.item.id) : !1;
126
- }, a = () => {
127
- $ !== null && (clearTimeout($), $ = null);
128
- }, P = () => {
129
- typeof document > "u" || (document.removeEventListener("pointermove", Y, !0), document.removeEventListener("pointerup", O, !0), document.removeEventListener("pointercancel", U, !0));
130
- }, w = () => {
131
- typeof document > "u" || (document.addEventListener("pointermove", Y, !0), document.addEventListener("pointerup", O, !0), document.addEventListener("pointercancel", U, !0));
132
- }, E = (t) => {
133
- a(), P(), d && e.dragContext && e.dragContext.endDrag(t), g = null, d = !1;
141
+ return t.isDragging ? t.draggedItems.some((i) => i.item.id === e.item.id) : !1;
142
+ }, S = () => {
143
+ v !== null && (clearTimeout(v), v = null);
144
+ }, d = () => {
145
+ typeof document > "u" || (document.removeEventListener("pointermove", r, !0), document.removeEventListener("pointerup", P, !0), document.removeEventListener("pointercancel", I, !0));
146
+ }, x = () => {
147
+ typeof document > "u" || (document.addEventListener("pointermove", r, !0), document.addEventListener("pointerup", P, !0), document.addEventListener("pointercancel", I, !0));
148
+ }, M = (t) => {
149
+ S(), d(), m && e.dragContext && e.dragContext.endDrag(t), f = null, m = !1;
134
150
  };
135
151
  xe(() => {
136
- E(!1);
152
+ M(!1);
137
153
  });
138
- const B = (t, r) => {
139
- if (!e.enableDragDrop || !e.dragContext || d) return;
140
- d = !0, i() || n.selectItem(e.item.id, !1);
141
- const c = n.getSelectedItemsList(), o = (c.length > 0 && i() ? c : [e.item]).map((F) => ({
142
- item: F,
154
+ const a = (t, i) => {
155
+ if (!e.enableDragDrop || !e.dragContext || m) return;
156
+ m = !0, o() || n.selectItem(e.item.id, !1);
157
+ const g = n.getSelectedItemsList(), l = (g.length > 0 && o() ? g : [e.item]).map((X) => ({
158
+ item: X,
143
159
  sourceInstanceId: e.instanceId,
144
160
  sourcePath: n.currentPath()
145
161
  }));
146
- if (f() && "vibrate" in navigator)
162
+ if (s() && "vibrate" in navigator)
147
163
  try {
148
164
  navigator.vibrate(50);
149
165
  } catch {
150
166
  }
151
- e.dragContext.startDrag(o, t, r);
152
- }, Y = (t) => {
153
- if (g !== t.pointerId) return;
154
- const r = t.clientX - S, c = t.clientY - I, y = Math.sqrt(r * r + c * c);
155
- if (f() && !d && y > 10) {
156
- E(!1);
167
+ e.dragContext.startDrag(l, t, i);
168
+ }, r = (t) => {
169
+ if (f !== t.pointerId) return;
170
+ const i = t.clientX - y, g = t.clientY - T, _ = Math.sqrt(i * i + g * g);
171
+ if (s() && !m && _ > 10) {
172
+ M(!1);
157
173
  return;
158
174
  }
159
- !f() && !d && y > H && B(t.clientX, t.clientY), d && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
160
- }, O = (t) => {
161
- g === t.pointerId && (s.onPointerUp(), E(!0));
162
- }, U = (t) => {
163
- g === t.pointerId && (s.onPointerCancel(), E(!1));
164
- }, Z = (t) => {
165
- l = t.pointerType, s.onPointerDown(t), !(t.pointerType === "mouse" && t.button !== 0) && (!e.enableDragDrop || !e.dragContext || (g = t.pointerId, S = t.clientX, I = t.clientY, d = !1, w(), f() && (a(), $ = setTimeout(() => {
166
- g !== null && !d && B(S, I);
167
- }, A))));
168
- }, ee = (t) => {
169
- l = t.pointerType, s.onPointerMove(t);
175
+ !s() && !m && _ > A && a(t.clientX, t.clientY), m && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
176
+ }, P = (t) => {
177
+ f === t.pointerId && (u.onPointerUp(), M(!0));
178
+ }, I = (t) => {
179
+ f === t.pointerId && (u.onPointerCancel(), M(!1));
180
+ }, R = (t) => {
181
+ c = t.pointerType, u.onPointerDown(t), !(t.pointerType === "mouse" && t.button !== 0) && (!e.enableDragDrop || !e.dragContext || (f = t.pointerId, y = t.clientX, T = t.clientY, m = !1, x(), s() && (S(), v = setTimeout(() => {
182
+ f !== null && !m && a(y, T);
183
+ }, O))));
170
184
  }, te = (t) => {
171
- if (!h() || !e.dragContext) return;
172
- const r = e.dragContext.dragState();
173
- if (!r.isDragging) return;
174
- L(!0);
175
- const c = e.dragContext.canDropOn(r.draggedItems, e.item.path, e.item, e.instanceId), o = t.currentTarget?.getBoundingClientRect() ?? null;
185
+ c = t.pointerType, u.onPointerMove(t);
186
+ }, ne = (t) => {
187
+ if (!E() || !e.dragContext) return;
188
+ const i = e.dragContext.dragState();
189
+ if (!i.isDragging) return;
190
+ N(!0);
191
+ const g = e.dragContext.canDropOn(i.draggedItems, e.item.path, e.item, e.instanceId), l = t.currentTarget?.getBoundingClientRect() ?? null;
176
192
  e.dragContext.setDropTarget({
177
193
  instanceId: e.instanceId,
178
194
  targetPath: e.item.path,
179
195
  targetItem: e.item
180
- }, c, o);
181
- }, ne = (t) => {
182
- if (!e.dragContext) return;
183
- L(!1);
184
- const r = e.dragContext.dragState();
185
- r.isDragging && r.dropTarget?.targetPath === e.item.path && e.dragContext.setDropTarget(null, !1);
196
+ }, g, l);
186
197
  }, re = (t) => {
187
- if (d) {
188
- d = !1;
198
+ if (!e.dragContext) return;
199
+ N(!1);
200
+ const i = e.dragContext.dragState();
201
+ i.isDragging && i.dropTarget?.targetPath === e.item.path && e.dragContext.setDropTarget(null, !1);
202
+ }, ie = (t) => {
203
+ if (m) {
204
+ m = !1;
189
205
  return;
190
206
  }
191
- if (!s.consumeClickSuppression(t)) {
192
- if (f()) {
207
+ if (!u.consumeClickSuppression(t)) {
208
+ if (s()) {
193
209
  n.openItem(e.item);
194
210
  return;
195
211
  }
196
212
  n.selectItem(e.item.id, t.metaKey || t.ctrlKey);
197
213
  }
198
- }, ie = () => {
199
- f() || n.openItem(e.item);
200
- }, ae = (t) => {
201
- if (t.preventDefault(), t.stopPropagation(), f()) return;
202
- i() || n.selectItem(e.item.id, !1);
203
- const r = n.getSelectedItemsList(), c = r.length > 0 ? r : [e.item];
214
+ }, ae = () => {
215
+ s() || n.openItem(e.item);
216
+ }, oe = (t) => {
217
+ if (t.preventDefault(), t.stopPropagation(), s()) return;
218
+ o() || n.selectItem(e.item.id, !1);
219
+ const i = n.getSelectedItemsList(), g = i.length > 0 ? i : [e.item];
204
220
  n.showContextMenu({
205
221
  x: t.clientX,
206
222
  y: t.clientY,
207
- items: c
223
+ items: g
208
224
  });
209
- }, oe = () => e.item.type === "folder" ? Ce : Ie(e.item.extension), le = () => e.dragContext?.dragState(), ce = () => le()?.isDragging ?? !1, j = () => D() && ce() && h();
225
+ }, le = () => e.item.type === "folder" ? Ie : we(e.item.extension), ce = () => e.dragContext?.dragState(), se = () => ce()?.isDragging ?? !1, U = () => F() && se() && E();
210
226
  return (() => {
211
- var t = Ee(), r = t.firstChild, c = r.nextSibling, y = c.nextSibling;
212
- return t.addEventListener("pointerleave", ne), t.addEventListener("pointerenter", te), t.$$pointermove = ee, t.$$pointerdown = Z, t.$$contextmenu = ae, t.$$dblclick = ie, t.$$click = re, C(t, v(p, {
227
+ var t = ke(), i = t.firstChild, g = i.nextSibling, _ = g.nextSibling;
228
+ return t.addEventListener("pointerleave", re), t.addEventListener("pointerenter", ne), t.$$pointermove = te, t.$$pointerdown = R, t.$$contextmenu = oe, t.$$dblclick = ae, t.$$click = ie, w(t, b(p, {
213
229
  get when() {
214
- return i();
230
+ return o();
215
231
  },
216
232
  get children() {
217
- return ke();
233
+ return Le();
218
234
  }
219
- }), r), C(r, v(ge, {
235
+ }), i), w(i, b(ge, {
220
236
  get component() {
221
- return oe();
237
+ return le();
222
238
  },
223
239
  class: "w-8 h-8"
224
- })), C(c, v(Fe, {
240
+ })), w(g, b(Fe, {
225
241
  get name() {
226
242
  return e.item.name;
227
243
  },
228
244
  get match() {
229
- return b();
245
+ return C();
230
246
  }
231
- })), X((o) => {
232
- var F = _(
247
+ })), Y((l) => {
248
+ var X = k(
233
249
  "group relative flex flex-col items-center gap-2 p-3 rounded-lg cursor-pointer h-28",
234
250
  "transition-all duration-150 ease-out",
235
251
  "hover:bg-accent/50 hover:scale-[1.02]",
236
252
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
237
253
  "active:scale-[0.98]",
238
- i() && "bg-accent ring-2 ring-primary/50",
254
+ o() && "bg-accent ring-2 ring-primary/50",
239
255
  // Drag state styling - being dragged items become translucent and shrink
240
- u() && "opacity-40 scale-90",
256
+ $() && "opacity-40 scale-90",
241
257
  // Drop target styling - enhanced visual feedback for folders
242
- j() && k() && ["bg-primary/15 ring-2 ring-primary/60", "scale-105 shadow-lg shadow-primary/15"],
243
- j() && !k() && ["bg-destructive/10 ring-2 ring-dashed ring-destructive/50"]
244
- ), N = _("w-12 h-12 flex items-center justify-center rounded-lg", "transition-transform duration-200", "group-hover:scale-110", e.item.type === "folder" ? "bg-warning/10" : "bg-muted/50"), Q = _("text-xs text-center line-clamp-2 w-full px-1", "transition-colors duration-150", i() && "font-medium"), V = e.item.name, K = _("absolute inset-0 rounded-lg opacity-0 transition-opacity duration-300", "group-hover:opacity-100", "pointer-events-none"), q = e.item.type === "folder" ? "radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--warning) 8%, transparent), transparent 70%)" : "radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--primary) 5%, transparent), transparent 70%)";
245
- return F !== o.e && T(t, o.e = F), N !== o.t && T(r, o.t = N), Q !== o.a && T(c, o.a = Q), V !== o.o && ue(c, "title", o.o = V), K !== o.i && T(y, o.i = K), q !== o.n && R(y, "background", o.n = q), o;
258
+ U() && H() && ["bg-primary/15 ring-2 ring-primary/60", "scale-105 shadow-lg shadow-primary/15"],
259
+ U() && !H() && ["bg-destructive/10 ring-2 ring-dashed ring-destructive/50"]
260
+ ), V = k("w-12 h-12 flex items-center justify-center rounded-lg", "transition-transform duration-200", "group-hover:scale-110", e.item.type === "folder" ? "bg-warning/10" : "bg-muted/50"), z = k("text-xs text-center line-clamp-2 w-full px-1", "transition-colors duration-150", o() && "font-medium"), Q = e.item.name, K = k("absolute inset-0 rounded-lg opacity-0 transition-opacity duration-300", "group-hover:opacity-100", "pointer-events-none"), W = e.item.type === "folder" ? "radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--warning) 8%, transparent), transparent 70%)" : "radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--primary) 5%, transparent), transparent 70%)";
261
+ return X !== l.e && L(t, l.e = X), V !== l.t && L(i, l.t = V), z !== l.a && L(g, l.a = z), Q !== l.o && ue(g, "title", l.o = Q), K !== l.i && L(_, l.i = K), W !== l.n && G(_, "background", l.n = W), l;
246
262
  }, {
247
263
  e: void 0,
248
264
  t: void 0,
@@ -255,5 +271,5 @@ function Me(e) {
255
271
  }
256
272
  fe(["click", "dblclick", "contextmenu", "pointerdown", "pointermove"]);
257
273
  export {
258
- Ue as FileGridView
274
+ je as FileGridView
259
275
  };
@@ -1,113 +1,81 @@
1
- import { createComponent as f, Portal as P, insert as T, template as D, use as M } from "solid-js/web";
2
- import { createMemo as s, createEffect as x, onCleanup as B, Show as I } from "solid-js";
3
- import { lockBodyStyle as O } from "../../utils/bodyStyleLock.js";
4
- import { deferNonBlocking as A } from "../../utils/defer.js";
5
- import { Launchpad as F } from "./Launchpad.js";
6
- var H = /* @__PURE__ */ D("<div role=dialog aria-modal=true tabindex=-1>");
7
- function y(n) {
8
- const c = ["a[href]", "button:not([disabled])", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])", '[tabindex]:not([tabindex="-1"])', '[contenteditable="true"]'].join(",");
9
- return Array.from(n.querySelectorAll(c)).filter((u) => u instanceof HTMLElement);
10
- }
11
- function N(n) {
12
- let c;
13
- const u = s(() => n.onOpenChange), w = s(() => n.onSelect), i = () => u()(!1), L = s(() => n.items.map((t) => ({
14
- ...t,
1
+ import { createComponent as c, Portal as f, insert as h, template as g, use as k } from "solid-js/web";
2
+ import { createMemo as n, Show as C } from "solid-js";
3
+ import { deferNonBlocking as S } from "../../utils/defer.js";
4
+ import { useOverlayMask as v } from "../../hooks/useOverlayMask.js";
5
+ import { Launchpad as y } from "./Launchpad.js";
6
+ var O = /* @__PURE__ */ g("<div role=dialog aria-modal=true tabindex=-1>");
7
+ function F(t) {
8
+ let r;
9
+ const a = n(() => t.onOpenChange), u = n(() => t.onSelect), l = () => a()(!1);
10
+ v({
11
+ open: () => t.open,
12
+ root: () => r,
13
+ onClose: l,
14
+ lockBodyScroll: !0,
15
+ trapFocus: !0,
16
+ closeOnEscape: !0,
17
+ blockHotkeys: !0,
18
+ // Launchpad uses wheel deltas for pagination, so we block default scrolling unconditionally.
19
+ blockWheel: "all",
20
+ // iOS: prevent touch scroll bleed (Launchpad is full-screen and does not need native scrolling).
21
+ blockTouchMove: "all",
22
+ autoFocus: {
23
+ selector: ".launchpad-search input"
24
+ },
25
+ restoreFocus: !0
26
+ });
27
+ const s = n(() => t.items.map((e) => ({
28
+ ...e,
15
29
  onClick: void 0
16
- }))), k = s(() => n.additionalItems?.map((t) => ({
17
- ...t,
30
+ }))), i = n(() => t.additionalItems?.map((e) => ({
31
+ ...e,
18
32
  onClick: void 0
19
- }))), C = (t) => {
20
- const o = n.closeOnSelect;
21
- return typeof o == "function" ? o(t) : o !== !1;
22
- }, S = (t) => {
23
- C(t) && i();
24
- const o = w();
25
- o && A(() => o(t));
33
+ }))), m = (e) => {
34
+ const o = t.closeOnSelect;
35
+ return typeof o == "function" ? o(e) : o !== !1;
36
+ }, d = (e) => {
37
+ m(e) && l();
38
+ const o = u();
39
+ o && S(() => o(e));
26
40
  };
27
- return x(() => {
28
- if (!n.open || typeof document > "u") return;
29
- const t = document.activeElement instanceof HTMLElement ? document.activeElement : null, o = O({
30
- overflow: "hidden"
31
- });
32
- setTimeout(() => {
33
- const e = c;
34
- if (!e) return;
35
- const r = e.querySelector(".launchpad-search input");
36
- if (r) {
37
- r.focus();
38
- return;
39
- }
40
- (y(e)[0] ?? e).focus();
41
- }, 0);
42
- const m = (e) => {
43
- if (e.key !== "Tab") return;
44
- const r = c;
45
- if (!r) return;
46
- const a = y(r);
47
- if (!a.length) {
48
- e.preventDefault(), r.focus();
49
- return;
50
- }
51
- const d = a[0], b = a[a.length - 1], l = document.activeElement instanceof HTMLElement ? document.activeElement : null;
52
- e.shiftKey ? (l === d || !l || !r.contains(l)) && (e.preventDefault(), b.focus()) : l === b && (e.preventDefault(), d.focus());
53
- }, v = (e) => {
54
- e.key === "Escape" && (e.preventDefault(), e.stopImmediatePropagation(), i());
55
- }, h = (e) => {
56
- e.stopPropagation();
57
- }, p = (e) => {
58
- e.cancelable && e.preventDefault();
59
- }, g = (e) => {
60
- e.stopPropagation();
61
- }, E = (e) => {
62
- e.cancelable && e.preventDefault();
63
- };
64
- document.addEventListener("keydown", m, !0), window.addEventListener("keydown", v, !0), document.addEventListener("keydown", h), document.addEventListener("wheel", p, {
65
- capture: !0,
66
- passive: !1
67
- }), document.addEventListener("wheel", g), document.addEventListener("touchmove", E, {
68
- capture: !0,
69
- passive: !1
70
- }), B(() => {
71
- document.removeEventListener("keydown", m, !0), window.removeEventListener("keydown", v, !0), document.removeEventListener("keydown", h), document.removeEventListener("wheel", p, !0), document.removeEventListener("wheel", g), document.removeEventListener("touchmove", E, !0), o(), t?.focus();
72
- });
73
- }), f(I, {
41
+ return c(C, {
74
42
  get when() {
75
- return n.open;
43
+ return t.open;
76
44
  },
77
45
  get children() {
78
- return f(P, {
46
+ return c(f, {
79
47
  get children() {
80
- var t = H(), o = c;
81
- return typeof o == "function" ? M(o, t) : c = t, T(t, f(F, {
48
+ var e = O(), o = r;
49
+ return typeof o == "function" ? k(o, e) : r = e, h(e, c(y, {
82
50
  get items() {
83
- return L();
51
+ return s();
84
52
  },
85
53
  get additionalItems() {
86
- return k();
54
+ return i();
87
55
  },
88
56
  get itemsPerPage() {
89
- return n.itemsPerPage;
57
+ return t.itemsPerPage;
90
58
  },
91
59
  get columns() {
92
- return n.columns;
60
+ return t.columns;
93
61
  },
94
62
  get showSearch() {
95
- return n.showSearch;
63
+ return t.showSearch;
96
64
  },
97
65
  get class() {
98
- return n.class;
66
+ return t.class;
99
67
  },
100
68
  get style() {
101
- return n.style;
69
+ return t.style;
102
70
  },
103
- onItemClick: S,
104
- onClose: i
105
- })), t;
71
+ onItemClick: d,
72
+ onClose: l
73
+ })), e;
106
74
  }
107
75
  });
108
76
  }
109
77
  });
110
78
  }
111
79
  export {
112
- N as LaunchpadModal
80
+ F as LaunchpadModal
113
81
  };