@floegence/floe-webapp-core 0.72.0 → 0.74.0

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