@floegence/floe-webapp-core 0.35.19 → 0.35.20

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,22 +1,22 @@
1
- import { createComponent as o, Portal as V, insert as l, Dynamic as j, effect as u, className as D, memo as B, template as a, setAttribute as A } from "solid-js/web";
2
- import { createSignal as F, createEffect as U, createMemo as d, Show as m, For as X } from "solid-js";
3
- import { Presence as G, Motion as W } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
1
+ import { createComponent as o, Portal as N, insert as a, effect as u, className as $, memo as V, template as l, setAttribute as A } from "solid-js/web";
2
+ import { createSignal as F, createEffect as j, createMemo as d, Show as m, For as B } from "solid-js";
3
+ import { Presence as U, Motion as X } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.11/node_modules/solid-motionone/dist/index.js";
4
4
  import { cn as f } from "../../utils/cn.js";
5
- import { useFileBrowserDrag as Y } from "../../context/FileBrowserDragContext.js";
6
- import { FolderIcon as q, getFileIcon as H } from "./FileIcons.js";
7
- var J = /* @__PURE__ */ a('<div class="text-[10px] text-muted-foreground pl-6">and <!> more...'), K = /* @__PURE__ */ a("<span>Drop to move"), $ = /* @__PURE__ */ a("<div>"), L = /* @__PURE__ */ a('<div class="flex items-center gap-2.5 text-xs text-foreground"><span class="flex-shrink-0 w-4 h-4"></span><span class="truncate font-medium">'), Q = /* @__PURE__ */ a("<span>Cannot drop here"), Z = /* @__PURE__ */ a('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="20 6 9 17 4 12">'), tt = /* @__PURE__ */ a('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><line x1=18 y1=6 x2=6 y2=18></line><line x1=6 y1=6 x2=18 y2=18>');
8
- const x = 3, P = 4, T = 4, et = 0.2;
9
- function dt() {
10
- const g = Y(), n = () => g?.dragState(), S = () => n()?.isDragging ?? !1, C = () => n()?.isDragEnding ?? !1, [c, h] = F(null), [s, w] = F(!1);
5
+ import { useFileBrowserDrag as G } from "../../context/FileBrowserDragContext.js";
6
+ import { FileItemIcon as W } from "./FileIcons.js";
7
+ var Y = /* @__PURE__ */ l('<div class="text-[10px] text-muted-foreground pl-6">and <!> more...'), q = /* @__PURE__ */ l("<span>Drop to move"), y = /* @__PURE__ */ l("<div>"), H = /* @__PURE__ */ l('<div class="flex items-center gap-2.5 text-xs text-foreground"><span class="flex-shrink-0 w-4 h-4"></span><span class="truncate font-medium">'), J = /* @__PURE__ */ l("<span>Cannot drop here"), K = /* @__PURE__ */ l('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="20 6 9 17 4 12">'), L = /* @__PURE__ */ l('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><line x1=18 y1=6 x2=6 y2=18></line><line x1=6 y1=6 x2=18 y2=18>');
8
+ const x = 3, P = 4, T = 4, Q = 0.2;
9
+ function at() {
10
+ const g = G(), n = () => g?.dragState(), S = () => n()?.isDragging ?? !1, C = () => n()?.isDragEnding ?? !1, [c, h] = F(null), [s, w] = F(!1);
11
11
  let _ = !1;
12
- U(() => {
12
+ j(() => {
13
13
  const t = S(), e = C();
14
14
  if (t && !e && !_ && (h(null), w(!1)), e && !_) {
15
15
  const r = n();
16
16
  if (r && r.draggedItems.length > 0) {
17
17
  const i = r.pointerPosition;
18
18
  h({
19
- items: r.draggedItems.map((y) => y.item),
19
+ items: r.draggedItems.map((D) => D.item),
20
20
  position: {
21
21
  x: i.x + P,
22
22
  y: i.y + T
@@ -52,17 +52,17 @@ function dt() {
52
52
  }), z = d(() => {
53
53
  const t = c();
54
54
  return t?.committed && t?.target ? t.target : b();
55
- }), M = d(() => c()?.committed ?? !1), p = () => n()?.isValidDrop ?? !1, O = () => !!n()?.dropTarget, I = () => O() && !c(), N = (t) => t.type === "folder" ? q : H(t.extension);
56
- return o(G, {
55
+ }), M = d(() => c()?.committed ?? !1), p = () => n()?.isValidDrop ?? !1, O = () => !!n()?.dropTarget, I = () => O() && !c();
56
+ return o(U, {
57
57
  get children() {
58
58
  return o(m, {
59
59
  get when() {
60
- return B(() => !!R())() && E().length > 0;
60
+ return V(() => !!R())() && E().length > 0;
61
61
  },
62
62
  get children() {
63
- return o(V, {
63
+ return o(N, {
64
64
  get children() {
65
- return o(W.div, {
65
+ return o(X.div, {
66
66
  get class() {
67
67
  return f("fixed top-0 left-0 pointer-events-none z-[9999]", "will-change-transform");
68
68
  },
@@ -81,7 +81,7 @@ function dt() {
81
81
  },
82
82
  get transition() {
83
83
  return {
84
- duration: s() ? et : 0,
84
+ duration: s() ? Q : 0,
85
85
  easing: "ease-out"
86
86
  };
87
87
  },
@@ -90,51 +90,49 @@ function dt() {
90
90
  },
91
91
  get children() {
92
92
  return [(() => {
93
- var t = $();
94
- return l(t, o(X, {
93
+ var t = y();
94
+ return a(t, o(B, {
95
95
  get each() {
96
96
  return E();
97
97
  },
98
98
  children: (e) => (() => {
99
- var r = L(), i = r.firstChild, y = i.nextSibling;
100
- return l(i, o(j, {
101
- get component() {
102
- return N(e);
103
- },
99
+ var r = H(), i = r.firstChild, D = i.nextSibling;
100
+ return a(i, o(W, {
101
+ item: e,
104
102
  class: "w-4 h-4"
105
- })), l(y, () => e.name), r;
103
+ })), a(D, () => e.name), r;
106
104
  })()
107
- }), null), l(t, o(m, {
105
+ }), null), a(t, o(m, {
108
106
  get when() {
109
107
  return k() > 0;
110
108
  },
111
109
  get children() {
112
- var e = J(), r = e.firstChild, i = r.nextSibling;
113
- return i.nextSibling, l(e, k, i), e;
110
+ var e = Y(), r = e.firstChild, i = r.nextSibling;
111
+ return i.nextSibling, a(e, k, i), e;
114
112
  }
115
- }), null), l(t, o(m, {
113
+ }), null), a(t, o(m, {
116
114
  get when() {
117
115
  return I();
118
116
  },
119
117
  get children() {
120
- var e = $();
121
- return l(e, o(m, {
118
+ var e = y();
119
+ return a(e, o(m, {
122
120
  get when() {
123
121
  return p();
124
122
  },
125
123
  get fallback() {
126
- return [o(nt, {
124
+ return [o(tt, {
127
125
  class: "w-3.5 h-3.5"
128
- }), Q()];
126
+ }), J()];
129
127
  },
130
128
  get children() {
131
- return [o(rt, {
129
+ return [o(Z, {
132
130
  class: "w-3.5 h-3.5"
133
- }), K()];
131
+ }), q()];
134
132
  }
135
- })), u(() => D(e, f("flex items-center gap-1.5 pt-1.5 mt-1 border-t border-border text-[11px] font-medium", "transition-colors duration-150", p() ? "text-success" : "text-error"))), e;
133
+ })), u(() => $(e, f("flex items-center gap-1.5 pt-1.5 mt-1 border-t border-border text-[11px] font-medium", "transition-colors duration-150", p() ? "text-success" : "text-error"))), e;
136
134
  }
137
- }), null), u(() => D(t, f(
135
+ }), null), u(() => $(t, f(
138
136
  "flex flex-col gap-1 p-2.5 rounded-lg",
139
137
  "bg-card border border-border",
140
138
  "shadow-md",
@@ -153,8 +151,8 @@ function dt() {
153
151
  return v() > 1;
154
152
  },
155
153
  get children() {
156
- var t = $();
157
- return l(t, v), u(() => D(t, f(
154
+ var t = y();
155
+ return a(t, v), u(() => $(t, f(
158
156
  "absolute -top-2 -right-2",
159
157
  "min-w-[20px] h-5 px-1.5 rounded-full",
160
158
  "bg-foreground text-background",
@@ -175,18 +173,18 @@ function dt() {
175
173
  }
176
174
  });
177
175
  }
178
- function rt(g) {
176
+ function Z(g) {
179
177
  return (() => {
180
- var n = Z();
178
+ var n = K();
181
179
  return u(() => A(n, "class", g.class)), n;
182
180
  })();
183
181
  }
184
- function nt(g) {
182
+ function tt(g) {
185
183
  return (() => {
186
- var n = tt();
184
+ var n = L();
187
185
  return u(() => A(n, "class", g.class)), n;
188
186
  })();
189
187
  }
190
188
  export {
191
- dt as DragPreview
189
+ at as DragPreview
192
190
  };
@@ -1,15 +1,15 @@
1
- import { addEventListener as se, use as W, insert as w, createComponent as b, effect as Y, setStyleProperty as X, className as G, template as C, spread as de, mergeProps as ge, Dynamic as ue, setAttribute as me, memo as fe, delegateEvents as he } from "solid-js/web";
2
- import { createSignal as q, createMemo as j, createEffect as ve, Show as A, For as J, untrack as xe, onCleanup as be } from "solid-js";
1
+ import { addEventListener as se, use as W, insert as w, createComponent as b, effect as Y, setStyleProperty as X, className as G, template as C, spread as ce, mergeProps as de, setAttribute as ge, memo as ue, delegateEvents as me } from "solid-js/web";
2
+ import { createSignal as q, createMemo as j, createEffect as fe, Show as A, For as J, untrack as he, onCleanup as ve } from "solid-js";
3
3
  import { cn as $ } from "../../utils/cn.js";
4
- import { useResizeObserver as Ce } from "../../hooks/useResizeObserver.js";
5
- import { useVirtualWindow as De } from "../../hooks/useVirtualWindow.js";
4
+ import { useResizeObserver as xe } from "../../hooks/useResizeObserver.js";
5
+ import { useVirtualWindow as be } from "../../hooks/useVirtualWindow.js";
6
6
  import { useFileBrowser as Z } from "./FileBrowserContext.js";
7
- import { useFileBrowserDrag as Ie } from "../../context/FileBrowserDragContext.js";
8
- import { FolderIcon as we, getFileIcon as ye } from "./FileIcons.js";
9
- import { createLongPressContextMenuHandlers as Pe } from "./longPressContextMenu.js";
10
- import { fileBrowserTouchTargetAttrs as Se } from "./touchInteractionGuard.js";
11
- var Me = /* @__PURE__ */ C('<mark class="bg-warning/40 text-inherit rounded-sm">'), Te = /* @__PURE__ */ C('<div class="grid gap-2">'), _e = /* @__PURE__ */ C('<div><div class=p-3><div class="w-full h-0"aria-hidden=true>'), Ee = /* @__PURE__ */ C('<span>No files matching "<!>"'), Le = /* @__PURE__ */ C('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), $e = /* @__PURE__ */ C('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), ke = /* @__PURE__ */ C("<span>This folder is empty"), Fe = /* @__PURE__ */ C('<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">'), He = /* @__PURE__ */ C("<button type=button><div></div><span></span><div>");
12
- function Re(e) {
7
+ import { useFileBrowserDrag as Ce } from "../../context/FileBrowserDragContext.js";
8
+ import { FileItemIcon as De } from "./FileIcons.js";
9
+ import { createLongPressContextMenuHandlers as Ie } from "./longPressContextMenu.js";
10
+ import { fileBrowserTouchTargetAttrs as we } from "./touchInteractionGuard.js";
11
+ var ye = /* @__PURE__ */ C('<mark class="bg-warning/40 text-inherit rounded-sm">'), Pe = /* @__PURE__ */ C('<div class="grid gap-2">'), Se = /* @__PURE__ */ C('<div><div class=p-3><div class="w-full h-0"aria-hidden=true>'), Me = /* @__PURE__ */ C('<span>No files matching "<!>"'), Te = /* @__PURE__ */ C('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), _e = /* @__PURE__ */ C('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), Ee = /* @__PURE__ */ C("<span>This folder is empty"), Le = /* @__PURE__ */ C('<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">'), $e = /* @__PURE__ */ C("<button type=button><div></div><span></span><div>");
12
+ function ke(e) {
13
13
  const n = j(() => {
14
14
  if (!e.match || e.match.matchedIndices.length === 0)
15
15
  return [{
@@ -39,60 +39,60 @@ function Re(e) {
39
39
  return o.highlight;
40
40
  },
41
41
  get fallback() {
42
- return fe(() => o.text);
42
+ return ue(() => o.text);
43
43
  },
44
44
  get children() {
45
- var D = Me();
45
+ var D = ye();
46
46
  return w(D, () => o.text), D;
47
47
  }
48
48
  })
49
49
  });
50
50
  }
51
- function ze(e) {
52
- const n = Z(), o = Ie(), D = () => (e.enableDragDrop ?? !0) && !!o, h = () => e.instanceId ?? "default", u = 112, l = 8, f = 180, y = 2, E = 6, [m, O] = q(null), p = Ce(m), v = j(() => {
53
- const s = p()?.width ?? 0;
54
- if (s <= 0) return y;
55
- const x = Math.floor((s + l) / (f + l));
51
+ function je(e) {
52
+ const n = Z(), o = Ce(), D = () => (e.enableDragDrop ?? !0) && !!o, h = () => e.instanceId ?? "default", u = 112, l = 8, f = 180, y = 2, E = 6, [m, O] = q(null), p = xe(m), v = j(() => {
53
+ const c = p()?.width ?? 0;
54
+ if (c <= 0) return y;
55
+ const x = Math.floor((c + l) / (f + l));
56
56
  return Math.max(y, Math.min(E, x));
57
- }), k = () => u + l, c = De({
57
+ }), k = () => u + l, s = be({
58
58
  count: () => Math.ceil(n.currentFiles().length / Math.max(1, v())),
59
59
  itemSize: k,
60
60
  overscan: 2
61
- }), N = () => c.range().start * v(), L = () => Math.min(n.currentFiles().length, c.range().end * v()), F = j(() => n.currentFiles().slice(N(), L()));
61
+ }), N = () => s.range().start * v(), L = () => Math.min(n.currentFiles().length, s.range().end * v()), F = j(() => n.currentFiles().slice(N(), L()));
62
62
  let _ = null, P = y;
63
- return ve(() => {
64
- const s = v();
63
+ return fe(() => {
64
+ const c = v();
65
65
  if (!_) {
66
- P = s;
66
+ P = c;
67
67
  return;
68
68
  }
69
- if (s === P) return;
70
- const x = k(), a = Math.floor(_.scrollTop / Math.max(1, x)) * Math.max(1, P), r = Math.floor(a / Math.max(1, s));
71
- _.scrollTop = r * x, c.onScroll(), P = s;
69
+ if (c === P) return;
70
+ const x = k(), a = Math.floor(_.scrollTop / Math.max(1, x)) * Math.max(1, P), r = Math.floor(a / Math.max(1, c));
71
+ _.scrollTop = r * x, s.onScroll(), P = c;
72
72
  }), (() => {
73
- var s = _e(), x = s.firstChild, S = x.firstChild;
74
- return se(s, "scroll", c.onScroll), W((a) => {
75
- _ = a, c.scrollRef(a), n.setScrollContainer(a);
76
- }, s), W((a) => O(a), S), w(x, b(A, {
73
+ var c = Se(), x = c.firstChild, S = x.firstChild;
74
+ return se(c, "scroll", s.onScroll), W((a) => {
75
+ _ = a, s.scrollRef(a), n.setScrollContainer(a);
76
+ }, c), W((a) => O(a), S), w(x, b(A, {
77
77
  get when() {
78
78
  return n.currentFiles().length > 0;
79
79
  },
80
80
  get fallback() {
81
81
  return (() => {
82
- var a = $e();
82
+ var a = _e();
83
83
  return w(a, b(A, {
84
84
  get when() {
85
85
  return n.filterQueryApplied().trim();
86
86
  },
87
87
  get fallback() {
88
- return ke();
88
+ return Ee();
89
89
  },
90
90
  get children() {
91
91
  return [(() => {
92
- var r = Ee(), M = r.firstChild, I = M.nextSibling;
92
+ var r = Me(), M = r.firstChild, I = M.nextSibling;
93
93
  return I.nextSibling, w(r, () => n.filterQueryApplied(), I), r;
94
94
  })(), (() => {
95
- var r = Le();
95
+ var r = Te();
96
96
  return r.$$click = () => n.setFilterQuery(""), r;
97
97
  })()];
98
98
  }
@@ -100,12 +100,12 @@ function ze(e) {
100
100
  })();
101
101
  },
102
102
  get children() {
103
- var a = Te();
103
+ var a = Pe();
104
104
  return w(a, b(J, {
105
105
  get each() {
106
106
  return F();
107
107
  },
108
- children: (r) => b(Xe, {
108
+ children: (r) => b(Fe, {
109
109
  item: r,
110
110
  get instanceId() {
111
111
  return h();
@@ -116,7 +116,7 @@ function ze(e) {
116
116
  dragContext: o
117
117
  })
118
118
  })), Y((r) => {
119
- var M = `repeat(${v()}, minmax(0, 1fr))`, I = `${c.paddingTop()}px`, H = `${c.paddingBottom()}px`;
119
+ var M = `repeat(${v()}, minmax(0, 1fr))`, I = `${s.paddingTop()}px`, H = `${s.paddingBottom()}px`;
120
120
  return M !== r.e && X(a, "grid-template-columns", r.e = M), I !== r.t && X(a, "padding-top", r.t = I), H !== r.a && X(a, "padding-bottom", r.a = H), r;
121
121
  }, {
122
122
  e: void 0,
@@ -124,15 +124,15 @@ function ze(e) {
124
124
  a: void 0
125
125
  }), a;
126
126
  }
127
- }), null), Y(() => G(s, $("h-full min-h-0 overflow-auto", e.class))), s;
127
+ }), null), Y(() => G(c, $("h-full min-h-0 overflow-auto", e.class))), c;
128
128
  })();
129
129
  }
130
- function Xe(e) {
131
- const n = Z(), o = () => n.isSelected(e.item.id), D = () => n.getFilterMatchForId(e.item.id), h = xe(() => e.item), u = Pe(n, h);
130
+ function Fe(e) {
131
+ const n = Z(), o = () => n.isSelected(e.item.id), D = () => n.getFilterMatchForId(e.item.id), h = he(() => e.item), u = Ie(n, h);
132
132
  let l, f = null, y = 0, E = 0, m = !1;
133
133
  const O = 5, p = 500;
134
134
  let v = null;
135
- const [k, B] = q(!1), c = () => l === "touch" || l === "pen", N = () => e.item.type === "folder", L = () => N() && e.enableDragDrop && e.dragContext, F = () => {
135
+ const [k, B] = q(!1), s = () => l === "touch" || l === "pen", N = () => e.item.type === "folder", L = () => N() && e.enableDragDrop && e.dragContext, F = () => {
136
136
  if (!L() || !e.dragContext) return !1;
137
137
  const t = e.dragContext.dragState();
138
138
  return t.isDragging ? e.dragContext.canDropOn(t.draggedItems, e.item.path, e.item, e.instanceId) : !1;
@@ -142,14 +142,14 @@ function Xe(e) {
142
142
  return t.isDragging ? t.draggedItems.some((i) => i.item.id === e.item.id) : !1;
143
143
  }, P = () => {
144
144
  v !== null && (clearTimeout(v), v = null);
145
- }, s = () => {
145
+ }, c = () => {
146
146
  typeof document > "u" || (document.removeEventListener("pointermove", r, !0), document.removeEventListener("pointerup", M, !0), document.removeEventListener("pointercancel", I, !0));
147
147
  }, x = () => {
148
148
  typeof document > "u" || (document.addEventListener("pointermove", r, !0), document.addEventListener("pointerup", M, !0), document.addEventListener("pointercancel", I, !0));
149
149
  }, S = (t) => {
150
- P(), s(), m && e.dragContext && e.dragContext.endDrag(t), f = null, m = !1;
150
+ P(), c(), m && e.dragContext && e.dragContext.endDrag(t), f = null, m = !1;
151
151
  };
152
- be(() => {
152
+ ve(() => {
153
153
  S(!1);
154
154
  });
155
155
  const a = (t, i) => {
@@ -160,7 +160,7 @@ function Xe(e) {
160
160
  sourceInstanceId: e.instanceId,
161
161
  sourcePath: n.currentPath()
162
162
  }));
163
- if (c() && "vibrate" in navigator)
163
+ if (s() && "vibrate" in navigator)
164
164
  try {
165
165
  navigator.vibrate(50);
166
166
  } catch {
@@ -169,17 +169,17 @@ function Xe(e) {
169
169
  }, r = (t) => {
170
170
  if (f !== t.pointerId) return;
171
171
  const i = t.clientX - y, g = t.clientY - E, T = Math.sqrt(i * i + g * g);
172
- if (c() && !m && T > 10) {
172
+ if (s() && !m && T > 10) {
173
173
  S(!1);
174
174
  return;
175
175
  }
176
- !c() && !m && T > O && a(t.clientX, t.clientY), m && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
176
+ !s() && !m && T > O && a(t.clientX, t.clientY), m && e.dragContext && e.dragContext.updateDrag(t.clientX, t.clientY);
177
177
  }, M = (t) => {
178
178
  f === t.pointerId && (u.onPointerUp(), S(!0));
179
179
  }, I = (t) => {
180
180
  f === t.pointerId && (u.onPointerCancel(), S(!1));
181
181
  }, H = (t) => {
182
- l = t.pointerType, u.onPointerDown(t), !(t.pointerType === "mouse" && t.button !== 0) && (!e.enableDragDrop || !e.dragContext || (f = t.pointerId, y = t.clientX, E = t.clientY, m = !1, x(), c() && (P(), v = setTimeout(() => {
182
+ l = t.pointerType, u.onPointerDown(t), !(t.pointerType === "mouse" && t.button !== 0) && (!e.enableDragDrop || !e.dragContext || (f = t.pointerId, y = t.clientX, E = t.clientY, m = !1, x(), s() && (P(), v = setTimeout(() => {
183
183
  f !== null && !m && a(y, E);
184
184
  }, p))));
185
185
  }, ee = (t) => {
@@ -206,16 +206,16 @@ function Xe(e) {
206
206
  return;
207
207
  }
208
208
  if (!u.consumeClickSuppression(t)) {
209
- if (c()) {
209
+ if (s()) {
210
210
  n.openItem(e.item);
211
211
  return;
212
212
  }
213
213
  n.selectItem(e.item.id, t.metaKey || t.ctrlKey);
214
214
  }
215
215
  }, ie = () => {
216
- c() || n.openItem(e.item);
216
+ s() || n.openItem(e.item);
217
217
  }, ae = (t) => {
218
- if (t.preventDefault(), t.stopPropagation(), c()) return;
218
+ if (t.preventDefault(), t.stopPropagation(), s()) return;
219
219
  o() || n.selectItem(e.item.id, !1);
220
220
  const i = n.getSelectedItemsList(), g = i.length > 0 ? i : [e.item];
221
221
  n.showContextMenu({
@@ -223,10 +223,10 @@ function Xe(e) {
223
223
  y: t.clientY,
224
224
  items: g
225
225
  });
226
- }, oe = () => e.item.type === "folder" ? we : ye(e.item.extension), le = () => e.dragContext?.dragState(), ce = () => le()?.isDragging ?? !1, U = () => k() && ce() && L();
226
+ }, oe = () => e.dragContext?.dragState(), le = () => oe()?.isDragging ?? !1, U = () => k() && le() && L();
227
227
  return (() => {
228
- var t = He(), i = t.firstChild, g = i.nextSibling, T = g.nextSibling;
229
- return de(t, ge(Se, {
228
+ var t = $e(), i = t.firstChild, g = i.nextSibling, T = g.nextSibling;
229
+ return ce(t, de(we, {
230
230
  onClick: re,
231
231
  onDblClick: ie,
232
232
  onContextMenu: ae,
@@ -254,14 +254,14 @@ function Xe(e) {
254
254
  return o();
255
255
  },
256
256
  get children() {
257
- return Fe();
257
+ return Le();
258
258
  }
259
- }), i), w(i, b(ue, {
260
- get component() {
261
- return oe();
259
+ }), i), w(i, b(De, {
260
+ get item() {
261
+ return e.item;
262
262
  },
263
263
  class: "w-8 h-8"
264
- })), w(g, b(Re, {
264
+ })), w(g, b(ke, {
265
265
  get name() {
266
266
  return e.item.name;
267
267
  },
@@ -270,7 +270,7 @@ function Xe(e) {
270
270
  }
271
271
  })), Y((d) => {
272
272
  var R = $("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"), V = $("text-xs text-center line-clamp-2 w-full px-1", "transition-colors duration-150", o() && "font-medium"), z = e.item.name, Q = $("absolute inset-0 rounded-lg opacity-0 transition-opacity duration-300", "group-hover:opacity-100", "pointer-events-none"), K = 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%)";
273
- return R !== d.e && G(i, d.e = R), V !== d.t && G(g, d.t = V), z !== d.a && me(g, "title", d.a = z), Q !== d.o && G(T, d.o = Q), K !== d.i && X(T, "background", d.i = K), d;
273
+ return R !== d.e && G(i, d.e = R), V !== d.t && G(g, d.t = V), z !== d.a && ge(g, "title", d.a = z), Q !== d.o && G(T, d.o = Q), K !== d.i && X(T, "background", d.i = K), d;
274
274
  }, {
275
275
  e: void 0,
276
276
  t: void 0,
@@ -280,7 +280,7 @@ function Xe(e) {
280
280
  }), t;
281
281
  })();
282
282
  }
283
- he(["click"]);
283
+ me(["click"]);
284
284
  export {
285
- ze as FileGridView
285
+ je as FileGridView
286
286
  };
@@ -1,15 +1,26 @@
1
- import { type JSX } from 'solid-js';
2
- interface FileIconProps {
1
+ import { type Component, type JSX } from 'solid-js';
2
+ import type { FileItem } from './types';
3
+ export interface FileIconProps {
3
4
  class?: string;
4
5
  }
6
+ type FileIconComponent = Component<FileIconProps>;
7
+ type ResolvableFileIcon = Pick<FileItem, 'name' | 'type' | 'extension' | 'icon'>;
8
+ export type FileItemIconRenderer = FileIconComponent | JSX.Element;
5
9
  export declare const FolderIcon: (props: FileIconProps) => JSX.Element;
6
10
  export declare const FolderOpenIcon: (props: FileIconProps) => JSX.Element;
7
11
  export declare const FileIcon: (props: FileIconProps) => JSX.Element;
8
12
  export declare const CodeFileIcon: (props: FileIconProps) => JSX.Element;
9
- export declare const ShellScriptFileIcon: (props: FileIconProps) => JSX.Element;
13
+ export declare const JavaScriptFileIcon: FileIconComponent;
14
+ export declare const TypeScriptFileIcon: FileIconComponent;
15
+ export declare const ShellScriptFileIcon: FileIconComponent;
10
16
  export declare const ImageFileIcon: (props: FileIconProps) => JSX.Element;
11
17
  export declare const DocumentFileIcon: (props: FileIconProps) => JSX.Element;
12
18
  export declare const ConfigFileIcon: (props: FileIconProps) => JSX.Element;
13
19
  export declare const StyleFileIcon: (props: FileIconProps) => JSX.Element;
14
- export declare function getFileIcon(extension?: string): (props: FileIconProps) => JSX.Element;
20
+ export declare function getFileIcon(extension?: string): FileIconComponent;
21
+ export declare function resolveFileItemIcon(item: ResolvableFileIcon): FileItemIconRenderer;
22
+ export declare function FileItemIcon(props: {
23
+ item: ResolvableFileIcon;
24
+ class?: string;
25
+ }): JSX.Element;
15
26
  export {};