@floegence/floe-webapp-core 0.35.47 → 0.35.49

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,103 +1,105 @@
1
- import { addEventListener as se, use as U, insert as M, createComponent as D, effect as z, setStyleProperty as B, className as p, template as y, spread as de, mergeProps as ue, memo as ge, delegateEvents as me } from "solid-js/web";
2
- import { createSignal as te, createMemo as Q, createEffect as ee, onCleanup as ne, Show as O, For as re, untrack as fe } from "solid-js";
3
- import { cn as A } from "../../utils/cn.js";
4
- import { useResizeObserver as he } from "../../hooks/useResizeObserver.js";
5
- import { useVirtualWindow as ve } from "../../hooks/useVirtualWindow.js";
6
- import { useFileBrowser as ie } from "./FileBrowserContext.js";
7
- import { useFileBrowserDrag as xe } from "../../context/FileBrowserDragContext.js";
8
- import { FileItemIcon as Ie } from "./FileIcons.js";
9
- import { createLongPressContextMenuHandlers as be } from "./longPressContextMenu.js";
10
- import { fileBrowserTouchTargetAttrs as we } from "./touchInteractionGuard.js";
11
- import { createItemContextMenuEvent as Ce } from "./contextMenuEvent.js";
12
- var De = /* @__PURE__ */ y('<mark class="bg-warning/40 text-inherit rounded-sm">'), ye = /* @__PURE__ */ y('<div class="grid gap-2">'), Te = /* @__PURE__ */ y('<div><div class=p-3><div class="w-full h-0"aria-hidden=true>'), Me = /* @__PURE__ */ y('<span>No files matching "<!>"'), Pe = /* @__PURE__ */ y('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), Se = /* @__PURE__ */ y('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), _e = /* @__PURE__ */ y("<span>This folder is empty"), Fe = /* @__PURE__ */ y('<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__ */ y("<button type=button><div></div><span></span><div>");
13
- function ke(e) {
14
- const r = Q(() => {
1
+ import { addEventListener as te, use as z, insert as y, createComponent as D, effect as N, setStyleProperty as Y, className as H, style as ue, template as S, spread as ge, mergeProps as me, memo as fe, delegateEvents as he } from "solid-js/web";
2
+ import { createSignal as ie, createMemo as W, createEffect as ne, onCleanup as oe, Show as q, For as ae, untrack as ve } from "solid-js";
3
+ import { cn as p } from "../../utils/cn.js";
4
+ import { useResizeObserver as xe } from "../../hooks/useResizeObserver.js";
5
+ import { useVirtualWindow as Ie } from "../../hooks/useVirtualWindow.js";
6
+ import { useFileBrowser as le } from "./FileBrowserContext.js";
7
+ import { useFileBrowserDrag as we } from "../../context/FileBrowserDragContext.js";
8
+ import { FileItemIcon as be } from "./FileIcons.js";
9
+ import { createLongPressContextMenuHandlers as Ce } from "./longPressContextMenu.js";
10
+ import { fileBrowserTouchTargetAttrs as De } from "./touchInteractionGuard.js";
11
+ import { createItemContextMenuEvent as Se } from "./contextMenuEvent.js";
12
+ import { createFileBrowserMarqueeSelection as ye, FILE_BROWSER_MARQUEE_OVERLAY_CLASS as Me } from "./useFileBrowserMarqueeSelection.js";
13
+ import { isPrimaryModKeyPressed as re } from "../../utils/keybind.js";
14
+ var Te = /* @__PURE__ */ S('<mark class="bg-warning/40 text-inherit rounded-sm">'), Pe = /* @__PURE__ */ S('<div class="grid gap-2">'), _e = /* @__PURE__ */ S('<div><div class=p-3><div class="w-full h-0"aria-hidden=true>'), Ee = /* @__PURE__ */ S('<span>No files matching "<!>"'), Fe = /* @__PURE__ */ S('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), Le = /* @__PURE__ */ S('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), Re = /* @__PURE__ */ S("<span>This folder is empty"), $e = /* @__PURE__ */ S("<div>"), ke = /* @__PURE__ */ S('<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">'), Ae = /* @__PURE__ */ S("<button type=button><div></div><span></span><div>");
15
+ function pe(e) {
16
+ const r = W(() => {
15
17
  if (!e.match || e.match.matchedIndices.length === 0)
16
18
  return [{
17
19
  text: e.name,
18
20
  highlight: !1
19
21
  }];
20
- const l = [], T = new Set(e.match.matchedIndices);
21
- let w = "", g = !1;
22
- for (let s = 0; s < e.name.length; s++) {
23
- const h = T.has(s);
24
- s === 0 ? (g = h, w = e.name[s]) : h === g ? w += e.name[s] : (l.push({
25
- text: w,
22
+ const s = [], M = new Set(e.match.matchedIndices);
23
+ let C = "", g = !1;
24
+ for (let d = 0; d < e.name.length; d++) {
25
+ const v = M.has(d);
26
+ d === 0 ? (g = v, C = e.name[d]) : v === g ? C += e.name[d] : (s.push({
27
+ text: C,
26
28
  highlight: g
27
- }), w = e.name[s], g = h);
29
+ }), C = e.name[d], g = v);
28
30
  }
29
- return w && l.push({
30
- text: w,
31
+ return C && s.push({
32
+ text: C,
31
33
  highlight: g
32
- }), l;
34
+ }), s;
33
35
  });
34
- return D(re, {
36
+ return D(ae, {
35
37
  get each() {
36
38
  return r();
37
39
  },
38
- children: (l) => D(O, {
40
+ children: (s) => D(q, {
39
41
  get when() {
40
- return l.highlight;
42
+ return s.highlight;
41
43
  },
42
44
  get fallback() {
43
- return ge(() => l.text);
45
+ return fe(() => s.text);
44
46
  },
45
47
  get children() {
46
- var T = De();
47
- return M(T, () => l.text), T;
48
+ var M = Te();
49
+ return y(M, () => s.text), M;
48
50
  }
49
51
  })
50
52
  });
51
53
  }
52
- function Ye(e) {
53
- const r = ie(), l = xe(), T = () => (e.enableDragDrop ?? !0) && !!l, w = () => e.instanceId ?? "default", g = 112, s = 8, h = 180, P = 2, L = 6, [m, N] = te(null), Y = he(m), v = Q(() => {
54
- const n = Y()?.width ?? 0;
55
- if (n <= 0) return P;
56
- const d = Math.floor((n + s) / (h + s));
57
- return Math.max(P, Math.min(L, d));
58
- }), F = () => g + s, c = ve({
59
- count: () => Math.ceil(r.currentFiles().length / Math.max(1, v())),
54
+ function Ke(e) {
55
+ const r = le(), s = we(), M = () => (e.enableDragDrop ?? !0) && !!s, C = () => e.instanceId ?? "default", g = 112, d = 8, v = 180, T = 2, R = 6, [m, V] = ie(null), U = xe(m), x = W(() => {
56
+ const n = U()?.width ?? 0;
57
+ if (n <= 0) return T;
58
+ const l = Math.floor((n + d) / (v + d));
59
+ return Math.max(T, Math.min(R, l));
60
+ }), F = () => g + d, c = Ie({
61
+ count: () => Math.ceil(r.currentFiles().length / Math.max(1, x())),
60
62
  itemSize: F,
61
63
  overscan: 2
62
- }), j = () => c.range().start * v(), $ = () => Math.min(r.currentFiles().length, c.range().end * v()), R = Q(() => r.currentFiles().slice(j(), $())), E = /* @__PURE__ */ new Map(), H = (n, d) => {
63
- if (d) {
64
- E.set(n, d);
64
+ }), Q = () => c.range().start * x(), $ = () => Math.min(r.currentFiles().length, c.range().end * x()), k = W(() => r.currentFiles().slice(Q(), $())), P = /* @__PURE__ */ new Map(), B = (n, l) => {
65
+ if (l) {
66
+ P.set(n, l);
65
67
  return;
66
68
  }
67
- E.delete(n);
69
+ P.delete(n);
68
70
  };
69
- let x = null, k = P, I = 0;
70
- ee(() => {
71
- const n = v();
72
- if (!x) {
73
- k = n;
71
+ let f = null, L = T, I = 0;
72
+ ne(() => {
73
+ const n = x();
74
+ if (!f) {
75
+ L = n;
74
76
  return;
75
77
  }
76
- if (n === k) return;
77
- const d = F(), a = Math.floor(x.scrollTop / Math.max(1, d)) * Math.max(1, k), i = Math.floor(a / Math.max(1, n));
78
- x.scrollTop = i * d, c.onScroll(), k = n;
78
+ if (n === L) return;
79
+ const l = F(), o = Math.floor(f.scrollTop / Math.max(1, l)) * Math.max(1, L), i = Math.floor(o / Math.max(1, n));
80
+ f.scrollTop = i * l, c.onScroll(), L = n;
79
81
  });
80
- const X = (n) => {
81
- if (!x) return;
82
- const b = Math.floor(n / Math.max(1, v())) * F(), a = b + F(), i = x.scrollTop, C = i + x.clientHeight;
82
+ const O = (n) => {
83
+ if (!f) return;
84
+ const b = Math.floor(n / Math.max(1, x())) * F(), o = b + F(), i = f.scrollTop, w = i + f.clientHeight;
83
85
  if (b < i) {
84
- x.scrollTop = b, c.onScroll();
86
+ f.scrollTop = b, c.onScroll();
85
87
  return;
86
88
  }
87
- a > C && (x.scrollTop = Math.max(0, a - x.clientHeight), c.onScroll());
89
+ o > w && (f.scrollTop = Math.max(0, o - f.clientHeight), c.onScroll());
88
90
  };
89
- return ee(() => {
90
- const n = r.revealRequest(), d = r.currentFiles();
91
- if (v(), R(), !n) return;
92
- const b = d.findIndex((C) => C.id === n.targetId);
91
+ ne(() => {
92
+ const n = r.revealRequest(), l = r.currentFiles();
93
+ if (x(), k(), !n) return;
94
+ const b = l.findIndex((w) => w.id === n.targetId);
93
95
  if (b < 0) return;
94
- if (!E.get(n.targetId)) {
95
- X(b);
96
+ if (!P.get(n.targetId)) {
97
+ O(b);
96
98
  return;
97
99
  }
98
100
  typeof cancelAnimationFrame == "function" && I && (cancelAnimationFrame(I), I = 0);
99
101
  const i = () => {
100
- r.revealRequest()?.requestId === n.requestId && (E.get(n.targetId)?.scrollIntoView({
102
+ r.revealRequest()?.requestId === n.requestId && (P.get(n.targetId)?.scrollIntoView({
101
103
  block: "nearest",
102
104
  inline: "nearest"
103
105
  }), r.selectItem(n.targetId, !1), r.consumeRevealRequest(n.requestId));
@@ -109,98 +111,115 @@ function Ye(e) {
109
111
  return;
110
112
  }
111
113
  queueMicrotask(i);
112
- }), ne(() => {
114
+ }), oe(() => {
113
115
  typeof cancelAnimationFrame == "function" && I && cancelAnimationFrame(I);
114
- }), (() => {
115
- var n = Te(), d = n.firstChild, b = d.firstChild;
116
- return se(n, "scroll", c.onScroll), U((a) => {
117
- x = a, c.scrollRef(a), r.setScrollContainer(a);
118
- }, n), U((a) => N(a), b), M(d, D(O, {
116
+ });
117
+ const A = ye({
118
+ getContainer: () => f,
119
+ getVisibleItemIdsInOrder: () => r.currentFiles().map((n) => n.id),
120
+ getElementForId: (n) => P.get(n) ?? null,
121
+ getSelectedIds: () => [...r.selectedItems()],
122
+ replaceSelection: (n, l) => r.replaceSelection(n, l),
123
+ clearSelection: r.clearSelection
124
+ });
125
+ return (() => {
126
+ var n = _e(), l = n.firstChild, b = l.firstChild;
127
+ return te(n, "pointerdown", A.onPointerDown, !0), te(n, "scroll", c.onScroll), z((o) => {
128
+ f = o, c.scrollRef(o), r.setScrollContainer(o);
129
+ }, n), z((o) => V(o), b), y(l, D(q, {
119
130
  get when() {
120
131
  return r.currentFiles().length > 0;
121
132
  },
122
133
  get fallback() {
123
134
  return (() => {
124
- var a = Se();
125
- return M(a, D(O, {
135
+ var o = Le();
136
+ return y(o, D(q, {
126
137
  get when() {
127
138
  return r.filterQueryApplied().trim();
128
139
  },
129
140
  get fallback() {
130
- return _e();
141
+ return Re();
131
142
  },
132
143
  get children() {
133
144
  return [(() => {
134
- var i = Me(), C = i.firstChild, S = C.nextSibling;
135
- return S.nextSibling, M(i, () => r.filterQueryApplied(), S), i;
145
+ var i = Ee(), w = i.firstChild, _ = w.nextSibling;
146
+ return _.nextSibling, y(i, () => r.filterQueryApplied(), _), i;
136
147
  })(), (() => {
137
- var i = Pe();
148
+ var i = Fe();
138
149
  return i.$$click = () => r.setFilterQuery(""), i;
139
150
  })()];
140
151
  }
141
- })), a;
152
+ })), o;
142
153
  })();
143
154
  },
144
155
  get children() {
145
- var a = ye();
146
- return M(a, D(re, {
156
+ var o = Pe();
157
+ return y(o, D(ae, {
147
158
  get each() {
148
- return R();
159
+ return k();
149
160
  },
150
- children: (i) => D(Le, {
161
+ children: (i) => D(He, {
151
162
  item: i,
152
163
  get instanceId() {
153
- return w();
164
+ return C();
154
165
  },
155
166
  get enableDragDrop() {
156
- return T();
167
+ return M();
157
168
  },
158
- dragContext: l,
159
- registerTile: H
169
+ dragContext: s,
170
+ registerTile: B
160
171
  })
161
- })), z((i) => {
162
- var C = `repeat(${v()}, minmax(0, 1fr))`, S = `${c.paddingTop()}px`, q = `${c.paddingBottom()}px`;
163
- return C !== i.e && B(a, "grid-template-columns", i.e = C), S !== i.t && B(a, "padding-top", i.t = S), q !== i.a && B(a, "padding-bottom", i.a = q), i;
172
+ })), N((i) => {
173
+ var w = `repeat(${x()}, minmax(0, 1fr))`, _ = `${c.paddingTop()}px`, X = `${c.paddingBottom()}px`;
174
+ return w !== i.e && Y(o, "grid-template-columns", i.e = w), _ !== i.t && Y(o, "padding-top", i.t = _), X !== i.a && Y(o, "padding-bottom", i.a = X), i;
164
175
  }, {
165
176
  e: void 0,
166
177
  t: void 0,
167
178
  a: void 0
168
- }), a;
179
+ }), o;
169
180
  }
170
- }), null), z(() => p(n, A("h-full min-h-0 overflow-auto", e.class))), n;
181
+ }), null), y(n, D(q, {
182
+ get when() {
183
+ return A.overlayStyle();
184
+ },
185
+ children: (o) => (() => {
186
+ var i = $e();
187
+ return H(i, Me), N((w) => ue(i, o(), w)), i;
188
+ })()
189
+ }), null), N(() => H(n, p("relative h-full min-h-0 overflow-auto", e.class))), n;
171
190
  })();
172
191
  }
173
- function Le(e) {
174
- const r = ie(), l = () => r.isSelected(e.item.id), T = () => r.getFilterMatchForId(e.item.id), w = fe(() => e.item), g = be(r, w, {
192
+ function He(e) {
193
+ const r = le(), s = () => r.isSelected(e.item.id), M = () => r.getFilterMatchForId(e.item.id), C = ve(() => e.item), g = Ce(r, C, {
175
194
  source: "grid"
176
195
  });
177
- let s, h = null, P = 0, L = 0, m = !1;
178
- const N = 5, Y = 500;
179
- let v = null;
180
- const [F, V] = te(!1), c = () => s === "touch" || s === "pen", j = () => e.item.type === "folder", $ = () => j() && e.enableDragDrop && e.dragContext, R = () => {
196
+ let d, v = null, T = 0, R = 0, m = !1;
197
+ const V = 5, U = 500;
198
+ let x = null;
199
+ const [F, j] = ie(!1), c = () => d === "touch" || d === "pen", Q = () => e.item.type === "folder", $ = () => Q() && e.enableDragDrop && e.dragContext, k = () => {
181
200
  if (!$() || !e.dragContext) return !1;
182
201
  const t = e.dragContext.dragState();
183
202
  return t.isDragging ? e.dragContext.canDropOn(t.draggedItems, e.item.path, e.item, e.instanceId) : !1;
184
- }, E = () => {
203
+ }, P = () => {
185
204
  if (!e.dragContext) return !1;
186
205
  const t = e.dragContext.dragState();
187
- return t.isDragging ? t.draggedItems.some((o) => o.item.id === e.item.id) : !1;
188
- }, H = () => {
189
- v !== null && (clearTimeout(v), v = null);
190
- }, x = () => {
191
- typeof document > "u" || (document.removeEventListener("pointermove", n, !0), document.removeEventListener("pointerup", d, !0), document.removeEventListener("pointercancel", b, !0));
192
- }, k = () => {
193
- typeof document > "u" || (document.addEventListener("pointermove", n, !0), document.addEventListener("pointerup", d, !0), document.addEventListener("pointercancel", b, !0));
206
+ return t.isDragging ? t.draggedItems.some((a) => a.item.id === e.item.id) : !1;
207
+ }, B = () => {
208
+ x !== null && (clearTimeout(x), x = null);
209
+ }, f = () => {
210
+ typeof document > "u" || (document.removeEventListener("pointermove", A, !0), document.removeEventListener("pointerup", n, !0), document.removeEventListener("pointercancel", l, !0));
211
+ }, L = () => {
212
+ typeof document > "u" || (document.addEventListener("pointermove", A, !0), document.addEventListener("pointerup", n, !0), document.addEventListener("pointercancel", l, !0));
194
213
  }, I = (t) => {
195
- H(), x(), m && e.dragContext && e.dragContext.endDrag(t), h = null, m = !1;
214
+ B(), f(), m && e.dragContext && e.dragContext.endDrag(t), v = null, m = !1;
196
215
  };
197
- ne(() => {
216
+ oe(() => {
198
217
  e.registerTile(e.item.id, null), I(!1);
199
218
  });
200
- const X = (t, o) => {
219
+ const O = (t, a) => {
201
220
  if (!e.enableDragDrop || !e.dragContext || m) return;
202
- m = !0, l() || r.selectItem(e.item.id, !1);
203
- const f = r.getSelectedItemsList(), u = (f.length > 0 && l() ? f : [e.item]).map((G) => ({
221
+ m = !0, s() || r.selectItem(e.item.id, !1);
222
+ const h = r.getSelectedItemsList(), u = (h.length > 0 && s() ? h : [e.item]).map((G) => ({
204
223
  item: G,
205
224
  sourceInstanceId: e.instanceId,
206
225
  sourcePath: r.currentPath()
@@ -210,42 +229,42 @@ function Le(e) {
210
229
  navigator.vibrate(50);
211
230
  } catch {
212
231
  }
213
- e.dragContext.startDrag(u, t, o);
214
- }, n = (t) => {
215
- if (h !== t.pointerId) return;
216
- const o = t.clientX - P, f = t.clientY - L, _ = Math.sqrt(o * o + f * f);
217
- if (c() && !m && _ > 10) {
232
+ e.dragContext.startDrag(u, t, a);
233
+ }, A = (t) => {
234
+ if (v !== t.pointerId) return;
235
+ const a = t.clientX - T, h = t.clientY - R, E = Math.sqrt(a * a + h * h);
236
+ if (c() && !m && E > 10) {
218
237
  I(!1);
219
238
  return;
220
239
  }
221
- !c() && !m && _ > N && X(t.clientX, t.clientY), m && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
222
- }, d = (t) => {
223
- h === t.pointerId && (g.onPointerUp(), I(!0));
240
+ !c() && !m && E > V && O(t.clientX, t.clientY), m && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
241
+ }, n = (t) => {
242
+ v === t.pointerId && (g.onPointerUp(), I(!0));
243
+ }, l = (t) => {
244
+ v === t.pointerId && (g.onPointerCancel(), I(!1));
224
245
  }, b = (t) => {
225
- h === t.pointerId && (g.onPointerCancel(), I(!1));
226
- }, a = (t) => {
227
- s = t.pointerType, g.onPointerDown(t), !(t.pointerType === "mouse" && t.button !== 0) && (!e.enableDragDrop || !e.dragContext || (h = t.pointerId, P = t.clientX, L = t.clientY, m = !1, k(), c() && (H(), v = setTimeout(() => {
228
- h !== null && !m && X(P, L);
229
- }, Y))));
246
+ d = t.pointerType, g.onPointerDown(t), !(t.pointerType === "mouse" && t.button !== 0) && (!e.enableDragDrop || !e.dragContext || (v = t.pointerId, T = t.clientX, R = t.clientY, m = !1, L(), c() && (B(), x = setTimeout(() => {
247
+ v !== null && !m && O(T, R);
248
+ }, U))));
249
+ }, o = (t) => {
250
+ d = t.pointerType, g.onPointerMove(t);
230
251
  }, i = (t) => {
231
- s = t.pointerType, g.onPointerMove(t);
232
- }, C = (t) => {
233
252
  if (!$() || !e.dragContext) return;
234
- const o = e.dragContext.dragState();
235
- if (!o.isDragging) return;
236
- V(!0);
237
- const f = e.dragContext.canDropOn(o.draggedItems, e.item.path, e.item, e.instanceId), u = t.currentTarget?.getBoundingClientRect() ?? null;
253
+ const a = e.dragContext.dragState();
254
+ if (!a.isDragging) return;
255
+ j(!0);
256
+ const h = e.dragContext.canDropOn(a.draggedItems, e.item.path, e.item, e.instanceId), u = t.currentTarget?.getBoundingClientRect() ?? null;
238
257
  e.dragContext.setDropTarget({
239
258
  instanceId: e.instanceId,
240
259
  targetPath: e.item.path,
241
260
  targetItem: e.item
242
- }, f, u);
243
- }, S = (t) => {
261
+ }, h, u);
262
+ }, w = (t) => {
244
263
  if (!e.dragContext) return;
245
- V(!1);
246
- const o = e.dragContext.dragState();
247
- o.isDragging && o.dropTarget?.targetPath === e.item.path && e.dragContext.setDropTarget(null, !1);
248
- }, q = (t) => {
264
+ j(!1);
265
+ const a = e.dragContext.dragState();
266
+ a.isDragging && a.dropTarget?.targetPath === e.item.path && e.dragContext.setDropTarget(null, !1);
267
+ }, _ = (t) => {
249
268
  if (m) {
250
269
  m = !1;
251
270
  return;
@@ -255,81 +274,85 @@ function Le(e) {
255
274
  r.openItem(e.item);
256
275
  return;
257
276
  }
258
- r.selectItem(e.item.id, t.metaKey || t.ctrlKey);
277
+ if (t.shiftKey) {
278
+ r.selectRangeTo(e.item.id, re(t));
279
+ return;
280
+ }
281
+ r.selectItem(e.item.id, re(t));
259
282
  }
260
- }, ae = () => {
283
+ }, X = () => {
261
284
  c() || r.openItem(e.item);
262
- }, oe = (t) => {
285
+ }, ce = (t) => {
263
286
  if (t.preventDefault(), t.stopPropagation(), c()) return;
264
- l() || r.selectItem(e.item.id, !1);
265
- const o = r.getSelectedItemsList(), f = o.length > 0 ? o : [e.item];
266
- r.showContextMenu(Ce({
287
+ r.ensureContextMenuSelection(e.item.id);
288
+ const a = r.getSelectedItemsList(), h = a.length > 0 ? a : [e.item];
289
+ r.showContextMenu(Se({
267
290
  x: t.clientX,
268
291
  y: t.clientY,
269
292
  triggerItem: e.item,
270
- items: f,
293
+ items: h,
271
294
  source: "grid"
272
295
  }));
273
- }, le = () => e.dragContext?.dragState(), ce = () => le()?.isDragging ?? !1, K = () => F() && ce() && $();
296
+ }, se = () => e.dragContext?.dragState(), de = () => se()?.isDragging ?? !1, K = () => F() && de() && $();
274
297
  return (() => {
275
- var t = Ee(), o = t.firstChild, f = o.nextSibling, _ = f.nextSibling;
276
- return U((u) => {
298
+ var t = Ae(), a = t.firstChild, h = a.nextSibling, E = h.nextSibling;
299
+ return z((u) => {
277
300
  e.registerTile(e.item.id, u);
278
- }, t), de(t, ue({
301
+ }, t), ge(t, me({
279
302
  get "data-file-browser-item-id"() {
280
303
  return e.item.id;
281
304
  },
282
305
  get "data-file-browser-item-path"() {
283
306
  return e.item.path;
284
307
  }
285
- }, we, {
308
+ }, De, {
286
309
  get title() {
287
310
  return e.item.name;
288
311
  },
289
- onClick: q,
290
- onDblClick: ae,
291
- onContextMenu: oe,
292
- onPointerDown: a,
293
- onPointerMove: i,
294
- onPointerEnter: C,
295
- onPointerLeave: S,
312
+ onClick: _,
313
+ onDblClick: X,
314
+ onContextMenu: ce,
315
+ onPointerDown: b,
316
+ onPointerMove: o,
317
+ onPointerEnter: i,
318
+ onPointerLeave: w,
296
319
  get class() {
297
- return A(
320
+ return p(
298
321
  "group relative flex flex-col items-center gap-2 p-3 rounded-lg cursor-pointer h-28",
299
322
  "transition-all duration-150 ease-out",
300
323
  "hover:bg-accent/50 hover:scale-[1.02]",
301
324
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
302
325
  "active:scale-[0.98]",
303
- l() && "bg-accent ring-2 ring-primary/50",
326
+ s() && "bg-accent ring-2 ring-primary/50",
304
327
  // Drag state styling - being dragged items become translucent and shrink
305
- E() && "opacity-40 scale-90",
328
+ P() && "opacity-40 scale-90",
306
329
  // Drop target styling - enhanced visual feedback for folders
307
- K() && R() && ["bg-primary/15 ring-2 ring-primary/60", "scale-105 shadow-lg shadow-primary/15"],
308
- K() && !R() && ["bg-destructive/10 ring-2 ring-dashed ring-destructive/50"]
330
+ K() && k() && ["bg-primary/15 ring-2 ring-primary/60", "scale-105 shadow-lg shadow-primary/15"],
331
+ K() && !k() && ["bg-destructive/10 ring-2 ring-dashed ring-destructive/50"]
309
332
  );
310
333
  }
311
- }), !1, !0), M(t, D(O, {
334
+ }), !1, !0), y(t, D(q, {
312
335
  get when() {
313
- return l();
336
+ return s();
314
337
  },
315
338
  get children() {
316
- return Fe();
339
+ return ke();
317
340
  }
318
- }), o), M(o, D(Ie, {
341
+ }), a), y(a, D(be, {
319
342
  get item() {
320
343
  return e.item;
321
344
  },
322
345
  class: "w-8 h-8"
323
- })), M(f, D(ke, {
346
+ })), y(h, D(pe, {
324
347
  get name() {
325
348
  return e.item.name;
326
349
  },
327
350
  get match() {
328
- return T();
351
+ return M();
329
352
  }
330
- })), z((u) => {
331
- var G = A("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"), W = A("block w-full min-w-0 truncate px-1 text-xs text-center", "transition-colors duration-150", l() && "font-medium"), J = A("absolute inset-0 rounded-lg opacity-0 transition-opacity duration-300", "group-hover:opacity-100", "pointer-events-none"), Z = 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%)";
332
- return G !== u.e && p(o, u.e = G), W !== u.t && p(f, u.t = W), J !== u.a && p(_, u.a = J), Z !== u.o && B(_, "background", u.o = Z), u;
353
+ })), N((u) => {
354
+ var G = p("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"), J = p("block w-full min-w-0 truncate px-1 text-xs text-center", "transition-colors duration-150", s() && "font-medium"), Z = p("absolute inset-0 rounded-lg opacity-0 transition-opacity duration-300", "group-hover:opacity-100", "pointer-events-none"), ee = 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%)";
355
+ return G !== u.e && H(a, u.e = G), J !== u.t && H(h, u.t = J), Z !== u.a && H(E, u.a = Z), ee !== u.o && Y(E, "background", u.o = ee), u;
333
356
  }, {
334
357
  e: void 0,
335
358
  t: void 0,
@@ -338,7 +361,7 @@ function Le(e) {
338
361
  }), t;
339
362
  })();
340
363
  }
341
- me(["click"]);
364
+ he(["pointerdown", "click"]);
342
365
  export {
343
- Ye as FileGridView
366
+ Ke as FileGridView
344
367
  };