@floegence/floe-webapp-core 0.4.0 → 0.6.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.
Files changed (87) hide show
  1. package/dist/components/ui/Dialog.d.ts +3 -0
  2. package/dist/components/ui/DirectoryPicker.d.ts +31 -0
  3. package/dist/components/ui/index.d.ts +1 -0
  4. package/dist/index.js +193 -191
  5. package/dist/index10.js +2 -2
  6. package/dist/index11.js +4 -4
  7. package/dist/index12.js +5 -5
  8. package/dist/index13.js +3 -3
  9. package/dist/index14.js +4 -4
  10. package/dist/index15.js +5 -5
  11. package/dist/index16.js +5 -5
  12. package/dist/index17.js +4 -4
  13. package/dist/index18.js +6 -6
  14. package/dist/index19.js +2 -2
  15. package/dist/index2.js +6 -6
  16. package/dist/index20.js +2 -2
  17. package/dist/index21.js +1 -1
  18. package/dist/index22.js +8 -5
  19. package/dist/index23.js +3 -3
  20. package/dist/index24.js +3 -3
  21. package/dist/index25.js +1 -1
  22. package/dist/index26.js +5 -5
  23. package/dist/index27.js +1 -1
  24. package/dist/index28.js +3 -3
  25. package/dist/index29.js +362 -81
  26. package/dist/index3.js +2 -2
  27. package/dist/index30.js +87 -37
  28. package/dist/index31.js +37 -66
  29. package/dist/index32.js +69 -278
  30. package/dist/index33.js +278 -152
  31. package/dist/index34.js +147 -24
  32. package/dist/index35.js +26 -45
  33. package/dist/index36.js +45 -10
  34. package/dist/index37.js +10 -27
  35. package/dist/index38.js +27 -159
  36. package/dist/index39.js +156 -228
  37. package/dist/index4.js +1 -1
  38. package/dist/index40.js +228 -125
  39. package/dist/index41.js +110 -176
  40. package/dist/index42.js +149 -122
  41. package/dist/index43.js +161 -183
  42. package/dist/index44.js +185 -145
  43. package/dist/index45.js +143 -114
  44. package/dist/index46.js +119 -47
  45. package/dist/index47.js +50 -48
  46. package/dist/index48.js +40 -30
  47. package/dist/index49.js +33 -44
  48. package/dist/index5.js +4 -4
  49. package/dist/index50.js +49 -25
  50. package/dist/index51.js +21 -169
  51. package/dist/index52.js +169 -36
  52. package/dist/index53.js +38 -64
  53. package/dist/index54.js +63 -93
  54. package/dist/index55.js +86 -111
  55. package/dist/index56.js +114 -131
  56. package/dist/index57.js +131 -32
  57. package/dist/index58.js +29 -425
  58. package/dist/index59.js +433 -36
  59. package/dist/index6.js +2 -2
  60. package/dist/index60.js +31 -12
  61. package/dist/index61.js +19 -13
  62. package/dist/index62.js +13 -10
  63. package/dist/index63.js +10 -16
  64. package/dist/index64.js +16 -10
  65. package/dist/index65.js +10 -8
  66. package/dist/index66.js +8 -61
  67. package/dist/index67.js +61 -5
  68. package/dist/index68.js +5 -11
  69. package/dist/index69.js +10 -25
  70. package/dist/index7.js +2 -2
  71. package/dist/index70.js +24 -30
  72. package/dist/index71.js +31 -90
  73. package/dist/index72.js +90 -26
  74. package/dist/index73.js +24 -43
  75. package/dist/index74.js +45 -13
  76. package/dist/index75.js +14 -35
  77. package/dist/index76.js +33 -62
  78. package/dist/index77.js +61 -81
  79. package/dist/index78.js +84 -14
  80. package/dist/index79.js +12 -2261
  81. package/dist/index8.js +2 -2
  82. package/dist/index80.js +2262 -6
  83. package/dist/index81.js +7 -39
  84. package/dist/index82.js +42 -0
  85. package/dist/index9.js +1 -1
  86. package/dist/styles.css +1 -1
  87. package/package.json +1 -1
package/dist/index41.js CHANGED
@@ -1,199 +1,133 @@
1
- import { delegateEvents as L, template as h, insert as s, createComponent as a, effect as S, className as F, Dynamic as A, memo as D, setStyleProperty as B } from "solid-js/web";
2
- import { Show as I, For as T, untrack as H, createMemo as N } from "solid-js";
3
- import { cn as y } from "./index67.js";
4
- import { useFileBrowser as z } from "./index39.js";
5
- import { FolderIcon as K, getFileIcon as Q } from "./index46.js";
6
- import { ChevronDown as U } from "./index32.js";
7
- import { createLongPressContextMenuHandlers as j } from "./index81.js";
8
- var E = /* @__PURE__ */ h("<span class=truncate>"), V = /* @__PURE__ */ h('<mark class="bg-warning/40 text-inherit rounded-sm">'), X = /* @__PURE__ */ h("<span>"), Y = /* @__PURE__ */ h('<div><div class="flex items-center border-b border-border text-[11px] text-muted-foreground font-medium"><button type=button class="group flex items-center flex-1 min-w-0 px-3 py-2 cursor-pointer hover:bg-muted/50 transition-colors">Name</button><button type=button class="group hidden sm:flex items-center w-32 px-3 py-2 cursor-pointer hover:bg-muted/50 transition-colors">Modified</button><button type=button class="group hidden md:flex items-center w-24 px-3 py-2 text-right justify-end cursor-pointer hover:bg-muted/50 transition-colors">Size</button></div><div class="flex-1 min-h-0 overflow-auto">'), q = /* @__PURE__ */ h('<span>No files matching "<!>"'), G = /* @__PURE__ */ h('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), J = /* @__PURE__ */ h('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), O = /* @__PURE__ */ h("<span>This folder is empty"), R = /* @__PURE__ */ h('<button type=button style=animation-fill-mode:backwards><div class="flex items-center gap-2 flex-1 min-w-0 px-3 py-1.5"><span class="flex-shrink-0 w-4 h-4"></span></div><div class="hidden sm:block w-32 px-3 py-1.5 text-muted-foreground truncate"></div><div class="hidden md:block w-24 px-3 py-1.5 text-right text-muted-foreground">');
9
- function W(n) {
10
- const i = N(() => {
11
- if (!n.match || n.match.matchedIndices.length === 0)
12
- return [{
13
- text: n.name,
14
- highlight: !1
15
- }];
16
- const l = [], d = new Set(n.match.matchedIndices);
17
- let c = "", o = !1;
18
- for (let e = 0; e < n.name.length; e++) {
19
- const r = d.has(e);
20
- e === 0 ? (o = r, c = n.name[e]) : r === o ? c += n.name[e] : (l.push({
21
- text: c,
22
- highlight: o
23
- }), c = n.name[e], o = r);
24
- }
25
- return c && l.push({
26
- text: c,
27
- highlight: o
28
- }), l;
29
- });
1
+ import { delegateEvents as U, template as x, insert as s, createComponent as o, effect as $, className as g, setAttribute as j, memo as k, setStyleProperty as B } from "solid-js/web";
2
+ import { createMemo as w, For as H, untrack as R, Show as b } from "solid-js";
3
+ import { cn as v } from "./index68.js";
4
+ import { useFileBrowser as T } from "./index40.js";
5
+ import { FolderOpenIcon as X, FolderIcon as Y } from "./index47.js";
6
+ import { ChevronRight as q } from "./index33.js";
7
+ import { createLongPressContextMenuHandlers as z } from "./index82.js";
8
+ var _ = /* @__PURE__ */ x("<div>"), G = /* @__PURE__ */ x("<button type=button>"), J = /* @__PURE__ */ x('<span class="ml-auto mr-2 text-[10px] text-muted-foreground/60 opacity-0 group-hover:opacity-100 transition-opacity">'), K = /* @__PURE__ */ x('<div class="flex flex-col"><div><button type=button><span class="flex-shrink-0 w-4 h-4"></span><span class=truncate>'), Q = /* @__PURE__ */ x('<span class="flex-shrink-0 w-3.5 h-3.5">');
9
+ function ie(n) {
10
+ const i = T(), r = w(() => i.files().filter((c) => c.type === "folder"));
30
11
  return (() => {
31
- var l = E();
32
- return s(l, a(T, {
33
- get each() {
34
- return i();
12
+ var c = _();
13
+ return c.$$contextmenu = (y) => y.preventDefault(), s(c, o(F, {
14
+ get items() {
15
+ return r();
35
16
  },
36
- children: (d) => a(I, {
37
- get when() {
38
- return d.highlight;
39
- },
40
- get fallback() {
41
- return D(() => d.text);
42
- },
43
- get children() {
44
- var c = V();
45
- return s(c, () => d.text), c;
46
- }
47
- })
48
- })), l;
17
+ depth: 0
18
+ })), $(() => g(c, v("flex flex-col", n.class))), c;
49
19
  })();
50
20
  }
51
- function ce(n) {
52
- const i = z(), l = (e) => {
53
- const r = i.sortConfig();
54
- i.setSortConfig({
55
- field: e,
56
- direction: r.field === e && r.direction === "asc" ? "desc" : "asc"
21
+ function F(n) {
22
+ const i = w(() => n.items.filter((r) => r.type === "folder"));
23
+ return o(H, {
24
+ get each() {
25
+ return i();
26
+ },
27
+ children: (r) => o(V, {
28
+ item: r,
29
+ get depth() {
30
+ return n.depth;
31
+ }
32
+ })
33
+ });
34
+ }
35
+ function V(n) {
36
+ const i = T(), r = () => i.isExpanded(n.item.path), c = () => i.currentPath() === n.item.path, y = R(() => n.item), f = z(i, y, {
37
+ selectOnOpen: !1
38
+ });
39
+ let u;
40
+ const M = () => u === "touch" || u === "pen", P = w(() => {
41
+ var e;
42
+ return ((e = n.item.children) == null ? void 0 : e.filter((d) => d.type === "folder").length) ?? 0;
43
+ }), m = () => P() > 0, D = (e) => {
44
+ u = e.pointerType, f.onPointerDown(e);
45
+ }, E = (e) => {
46
+ u = e.pointerType, f.onPointerMove(e);
47
+ }, S = (e) => {
48
+ u = e.pointerType, f.onPointerUp();
49
+ }, I = (e) => {
50
+ u = e.pointerType, f.onPointerCancel();
51
+ }, L = (e) => {
52
+ f.consumeClickSuppression(e) || i.setCurrentPath(n.item.path);
53
+ }, N = (e) => {
54
+ e.preventDefault(), e.stopPropagation(), !M() && i.showContextMenu({
55
+ x: e.clientX,
56
+ y: e.clientY,
57
+ items: [n.item]
57
58
  });
58
- }, d = (e) => e === void 0 ? "-" : e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`, c = (e) => e ? e.toLocaleDateString("en-US", {
59
- month: "short",
60
- day: "numeric",
61
- year: "numeric"
62
- }) : "-", o = (e) => {
63
- const r = () => i.sortConfig(), f = () => r().field === e.field;
64
- return (() => {
65
- var u = X();
66
- return s(u, a(U, {
67
- get class() {
68
- return y("w-3 h-3 transition-transform duration-150", f() && r().direction === "asc" && "rotate-180");
69
- }
70
- })), S(() => F(u, y("ml-1 transition-all duration-150", f() ? "opacity-100" : "opacity-0 group-hover:opacity-40"))), u;
71
- })();
59
+ }, O = () => {
60
+ m() && i.toggleFolder(n.item.path);
72
61
  };
73
62
  return (() => {
74
- var e = Y(), r = e.firstChild, f = r.firstChild;
75
- f.firstChild;
76
- var u = f.nextSibling;
77
- u.firstChild;
78
- var v = u.nextSibling;
79
- v.firstChild;
80
- var _ = r.nextSibling;
81
- return f.$$click = () => l("name"), s(f, a(o, {
82
- field: "name"
83
- }), null), u.$$click = () => l("modifiedAt"), s(u, a(o, {
84
- field: "modifiedAt"
85
- }), null), v.$$click = () => l("size"), s(v, a(o, {
86
- field: "size"
87
- }), null), s(_, a(I, {
63
+ var e = K(), d = e.firstChild, l = d.firstChild, C = l.firstChild, A = C.nextSibling;
64
+ return s(d, o(b, {
88
65
  get when() {
89
- return i.currentFiles().length > 0;
66
+ return m();
90
67
  },
91
68
  get fallback() {
92
- return (() => {
93
- var x = J();
94
- return s(x, a(I, {
95
- get when() {
96
- return i.filterQuery().trim();
97
- },
98
- get fallback() {
99
- return O();
100
- },
101
- get children() {
102
- return [(() => {
103
- var m = q(), w = m.firstChild, p = w.nextSibling;
104
- return p.nextSibling, s(m, () => i.filterQuery(), p), m;
105
- })(), (() => {
106
- var m = G();
107
- return m.$$click = () => i.setFilterQuery(""), m;
108
- })()];
109
- }
110
- })), x;
111
- })();
69
+ return Q();
112
70
  },
113
71
  get children() {
114
- return a(T, {
115
- get each() {
116
- return i.currentFiles();
117
- },
118
- children: (x, m) => a(Z, {
119
- item: x,
120
- formatSize: d,
121
- formatDate: c,
122
- get index() {
123
- return m();
124
- }
125
- })
126
- });
72
+ var t = G();
73
+ return t.$$click = O, s(t, o(q, {
74
+ class: "w-3 h-3 opacity-50"
75
+ })), $((a) => {
76
+ var h = v("flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center cursor-pointer", "transition-transform duration-150", r() && "rotate-90", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring"), p = r() ? "Collapse folder" : "Expand folder";
77
+ return h !== a.e && g(t, a.e = h), p !== a.t && j(t, "aria-label", a.t = p), a;
78
+ }, {
79
+ e: void 0,
80
+ t: void 0
81
+ }), t;
127
82
  }
128
- })), S(() => F(e, y("flex flex-col h-full min-h-0", n.class))), e;
129
- })();
130
- }
131
- function Z(n) {
132
- const i = z(), l = () => i.isSelected(n.item.id), d = () => i.getFilterMatch(n.item.name), c = H(() => n.item), o = j(i, c);
133
- let e;
134
- const r = () => e === "touch" || e === "pen", f = (t) => {
135
- e = t.pointerType, o.onPointerDown(t);
136
- }, u = (t) => {
137
- e = t.pointerType, o.onPointerMove(t);
138
- }, v = (t) => {
139
- e = t.pointerType, o.onPointerUp();
140
- }, _ = (t) => {
141
- e = t.pointerType, o.onPointerCancel();
142
- }, x = (t) => {
143
- if (!o.consumeClickSuppression(t)) {
144
- if (r()) {
145
- i.openItem(n.item);
146
- return;
83
+ }), l), l.addEventListener("pointercancel", I), l.$$pointerup = S, l.$$pointermove = E, l.$$pointerdown = D, l.$$contextmenu = N, l.$$click = L, s(C, o(b, {
84
+ get when() {
85
+ return k(() => !!m())() && r();
86
+ },
87
+ get fallback() {
88
+ return o(Y, {
89
+ class: "w-4 h-4"
90
+ });
91
+ },
92
+ get children() {
93
+ return o(X, {
94
+ class: "w-4 h-4"
95
+ });
147
96
  }
148
- i.selectItem(n.item.id, t.metaKey || t.ctrlKey);
149
- }
150
- }, m = () => {
151
- r() || i.openItem(n.item);
152
- }, w = (t) => {
153
- if (t.preventDefault(), t.stopPropagation(), r()) return;
154
- l() || i.selectItem(n.item.id, !1);
155
- const $ = i.selectedItems(), C = i.currentFiles(), b = $.size > 0 ? C.filter((k) => $.has(k.id)) : [n.item];
156
- i.showContextMenu({
157
- x: t.clientX,
158
- y: t.clientY,
159
- items: b
160
- });
161
- }, p = () => n.item.type === "folder" ? K : Q(n.item.extension);
162
- return (() => {
163
- var t = R(), $ = t.firstChild, C = $.firstChild, b = $.nextSibling, k = b.nextSibling;
164
- return t.addEventListener("pointercancel", _), t.$$pointerup = v, t.$$pointermove = u, t.$$pointerdown = f, t.$$contextmenu = w, t.$$dblclick = m, t.$$click = x, s(C, a(A, {
165
- get component() {
166
- return p();
97
+ })), s(A, () => n.item.name), s(l, o(b, {
98
+ get when() {
99
+ return m();
167
100
  },
168
- class: "w-4 h-4"
169
- })), s($, a(W, {
170
- get name() {
171
- return n.item.name;
101
+ get children() {
102
+ var t = J();
103
+ return s(t, P), t;
104
+ }
105
+ }), null), s(e, o(b, {
106
+ get when() {
107
+ return k(() => !!r())() && m();
172
108
  },
173
- get match() {
174
- return d();
109
+ get children() {
110
+ var t = _();
111
+ return s(t, o(F, {
112
+ get items() {
113
+ return n.item.children ?? [];
114
+ },
115
+ get depth() {
116
+ return n.depth + 1;
117
+ }
118
+ })), $(() => g(t, v("overflow-hidden transition-all duration-200", r() ? "opacity-100" : "opacity-0"))), t;
175
119
  }
176
- }), null), s(b, () => n.formatDate(n.item.modifiedAt)), s(k, (() => {
177
- var g = D(() => n.item.type === "folder");
178
- return () => g() ? "-" : n.formatSize(n.item.size);
179
- })()), S((g) => {
180
- var P = y(
181
- "group w-full flex items-center text-xs cursor-pointer",
182
- "transition-all duration-100",
183
- "hover:bg-accent/50",
184
- "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring",
185
- l() && "bg-accent text-accent-foreground",
186
- // Staggered animation on mount
187
- "animate-in fade-in slide-in-from-top-2"
188
- ), M = `${Math.min(n.index * 20, 200)}ms`;
189
- return P !== g.e && F(t, g.e = P), M !== g.t && B(t, "animation-delay", g.t = M), g;
120
+ }), null), $((t) => {
121
+ var a = v("group flex items-center w-full py-1 text-xs", "transition-all duration-100", "hover:bg-sidebar-accent/60", c() && "bg-sidebar-accent text-sidebar-accent-foreground font-medium"), h = `${8 + n.depth * 12}px`, p = v("flex items-center gap-1 flex-1 min-w-0 text-left cursor-pointer pl-1", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-sidebar-ring");
122
+ return a !== t.e && g(d, t.e = a), h !== t.t && B(d, "padding-left", t.t = h), p !== t.a && g(l, t.a = p), t;
190
123
  }, {
191
124
  e: void 0,
192
- t: void 0
193
- }), t;
125
+ t: void 0,
126
+ a: void 0
127
+ }), e;
194
128
  })();
195
129
  }
196
- L(["click", "dblclick", "contextmenu", "pointerdown", "pointermove", "pointerup"]);
130
+ U(["contextmenu", "click", "pointerdown", "pointermove", "pointerup"]);
197
131
  export {
198
- ce as FileListView
132
+ ie as DirectoryTree
199
133
  };
package/dist/index42.js CHANGED
@@ -1,172 +1,199 @@
1
- import { delegateEvents as z, template as m, insert as u, createComponent as s, effect as I, className as f, Dynamic as B, setStyleProperty as F, setAttribute as E, memo as G } from "solid-js/web";
2
- import { Show as p, For as P, untrack as K, createMemo as U } from "solid-js";
3
- import { cn as v } from "./index67.js";
4
- import { useFileBrowser as S } from "./index39.js";
5
- import { FolderIcon as A, getFileIcon as V } from "./index46.js";
6
- import { createLongPressContextMenuHandlers as X } from "./index81.js";
7
- var Y = /* @__PURE__ */ m('<mark class="bg-warning/40 text-inherit rounded-sm">'), q = /* @__PURE__ */ m('<div class="grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-2">'), J = /* @__PURE__ */ m("<div>"), O = /* @__PURE__ */ m('<span>No files matching "<!>"'), R = /* @__PURE__ */ m('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), W = /* @__PURE__ */ m('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), Z = /* @__PURE__ */ m("<span>This folder is empty"), ee = /* @__PURE__ */ m('<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">'), te = /* @__PURE__ */ m("<button type=button style=animation-fill-mode:backwards><div></div><span></span><div>");
8
- function ne(t) {
9
- const n = U(() => {
10
- if (!t.match || t.match.matchedIndices.length === 0)
1
+ import { delegateEvents as L, template as h, insert as s, createComponent as a, effect as S, className as F, Dynamic as A, memo as D, setStyleProperty as B } from "solid-js/web";
2
+ import { Show as I, For as T, untrack as H, createMemo as N } from "solid-js";
3
+ import { cn as y } from "./index68.js";
4
+ import { useFileBrowser as z } from "./index40.js";
5
+ import { FolderIcon as K, getFileIcon as Q } from "./index47.js";
6
+ import { ChevronDown as U } from "./index33.js";
7
+ import { createLongPressContextMenuHandlers as j } from "./index82.js";
8
+ var E = /* @__PURE__ */ h("<span class=truncate>"), V = /* @__PURE__ */ h('<mark class="bg-warning/40 text-inherit rounded-sm">'), X = /* @__PURE__ */ h("<span>"), Y = /* @__PURE__ */ h('<div><div class="flex items-center border-b border-border text-[11px] text-muted-foreground font-medium"><button type=button class="group flex items-center flex-1 min-w-0 px-3 py-2 cursor-pointer hover:bg-muted/50 transition-colors">Name</button><button type=button class="group hidden sm:flex items-center w-32 px-3 py-2 cursor-pointer hover:bg-muted/50 transition-colors">Modified</button><button type=button class="group hidden md:flex items-center w-24 px-3 py-2 text-right justify-end cursor-pointer hover:bg-muted/50 transition-colors">Size</button></div><div class="flex-1 min-h-0 overflow-auto">'), q = /* @__PURE__ */ h('<span>No files matching "<!>"'), G = /* @__PURE__ */ h('<button type=button class="px-2 py-1 rounded bg-muted hover:bg-muted/80 transition-colors">Clear Filter'), J = /* @__PURE__ */ h('<div class="flex flex-col items-center justify-center h-32 gap-2 text-xs text-muted-foreground">'), O = /* @__PURE__ */ h("<span>This folder is empty"), R = /* @__PURE__ */ h('<button type=button style=animation-fill-mode:backwards><div class="flex items-center gap-2 flex-1 min-w-0 px-3 py-1.5"><span class="flex-shrink-0 w-4 h-4"></span></div><div class="hidden sm:block w-32 px-3 py-1.5 text-muted-foreground truncate"></div><div class="hidden md:block w-24 px-3 py-1.5 text-right text-muted-foreground">');
9
+ function W(n) {
10
+ const i = N(() => {
11
+ if (!n.match || n.match.matchedIndices.length === 0)
11
12
  return [{
12
- text: t.name,
13
+ text: n.name,
13
14
  highlight: !1
14
15
  }];
15
- const o = [], c = new Set(t.match.matchedIndices);
16
- let i = "", a = !1;
17
- for (let r = 0; r < t.name.length; r++) {
18
- const d = c.has(r);
19
- r === 0 ? (a = d, i = t.name[r]) : d === a ? i += t.name[r] : (o.push({
20
- text: i,
21
- highlight: a
22
- }), i = t.name[r], a = d);
16
+ const l = [], d = new Set(n.match.matchedIndices);
17
+ let c = "", o = !1;
18
+ for (let e = 0; e < n.name.length; e++) {
19
+ const r = d.has(e);
20
+ e === 0 ? (o = r, c = n.name[e]) : r === o ? c += n.name[e] : (l.push({
21
+ text: c,
22
+ highlight: o
23
+ }), c = n.name[e], o = r);
23
24
  }
24
- return i && o.push({
25
- text: i,
26
- highlight: a
27
- }), o;
25
+ return c && l.push({
26
+ text: c,
27
+ highlight: o
28
+ }), l;
28
29
  });
29
- return s(P, {
30
- get each() {
31
- return n();
32
- },
33
- children: (o) => s(p, {
34
- get when() {
35
- return o.highlight;
36
- },
37
- get fallback() {
38
- return G(() => o.text);
30
+ return (() => {
31
+ var l = E();
32
+ return s(l, a(T, {
33
+ get each() {
34
+ return i();
39
35
  },
40
- get children() {
41
- var c = Y();
42
- return u(c, () => o.text), c;
43
- }
44
- })
45
- });
36
+ children: (d) => a(I, {
37
+ get when() {
38
+ return d.highlight;
39
+ },
40
+ get fallback() {
41
+ return D(() => d.text);
42
+ },
43
+ get children() {
44
+ var c = V();
45
+ return s(c, () => d.text), c;
46
+ }
47
+ })
48
+ })), l;
49
+ })();
46
50
  }
47
- function me(t) {
48
- const n = S();
51
+ function ce(n) {
52
+ const i = z(), l = (e) => {
53
+ const r = i.sortConfig();
54
+ i.setSortConfig({
55
+ field: e,
56
+ direction: r.field === e && r.direction === "asc" ? "desc" : "asc"
57
+ });
58
+ }, d = (e) => e === void 0 ? "-" : e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`, c = (e) => e ? e.toLocaleDateString("en-US", {
59
+ month: "short",
60
+ day: "numeric",
61
+ year: "numeric"
62
+ }) : "-", o = (e) => {
63
+ const r = () => i.sortConfig(), f = () => r().field === e.field;
64
+ return (() => {
65
+ var u = X();
66
+ return s(u, a(U, {
67
+ get class() {
68
+ return y("w-3 h-3 transition-transform duration-150", f() && r().direction === "asc" && "rotate-180");
69
+ }
70
+ })), S(() => F(u, y("ml-1 transition-all duration-150", f() ? "opacity-100" : "opacity-0 group-hover:opacity-40"))), u;
71
+ })();
72
+ };
49
73
  return (() => {
50
- var o = J();
51
- return u(o, s(p, {
74
+ var e = Y(), r = e.firstChild, f = r.firstChild;
75
+ f.firstChild;
76
+ var u = f.nextSibling;
77
+ u.firstChild;
78
+ var v = u.nextSibling;
79
+ v.firstChild;
80
+ var _ = r.nextSibling;
81
+ return f.$$click = () => l("name"), s(f, a(o, {
82
+ field: "name"
83
+ }), null), u.$$click = () => l("modifiedAt"), s(u, a(o, {
84
+ field: "modifiedAt"
85
+ }), null), v.$$click = () => l("size"), s(v, a(o, {
86
+ field: "size"
87
+ }), null), s(_, a(I, {
52
88
  get when() {
53
- return n.currentFiles().length > 0;
89
+ return i.currentFiles().length > 0;
54
90
  },
55
91
  get fallback() {
56
92
  return (() => {
57
- var c = W();
58
- return u(c, s(p, {
93
+ var x = J();
94
+ return s(x, a(I, {
59
95
  get when() {
60
- return n.filterQuery().trim();
96
+ return i.filterQuery().trim();
61
97
  },
62
98
  get fallback() {
63
- return Z();
99
+ return O();
64
100
  },
65
101
  get children() {
66
102
  return [(() => {
67
- var i = O(), a = i.firstChild, r = a.nextSibling;
68
- return r.nextSibling, u(i, () => n.filterQuery(), r), i;
103
+ var m = q(), w = m.firstChild, p = w.nextSibling;
104
+ return p.nextSibling, s(m, () => i.filterQuery(), p), m;
69
105
  })(), (() => {
70
- var i = R();
71
- return i.$$click = () => n.setFilterQuery(""), i;
106
+ var m = G();
107
+ return m.$$click = () => i.setFilterQuery(""), m;
72
108
  })()];
73
109
  }
74
- })), c;
110
+ })), x;
75
111
  })();
76
112
  },
77
113
  get children() {
78
- var c = q();
79
- return u(c, s(P, {
114
+ return a(T, {
80
115
  get each() {
81
- return n.currentFiles();
116
+ return i.currentFiles();
82
117
  },
83
- children: (i, a) => s(ie, {
84
- item: i,
118
+ children: (x, m) => a(Z, {
119
+ item: x,
120
+ formatSize: d,
121
+ formatDate: c,
85
122
  get index() {
86
- return a();
123
+ return m();
87
124
  }
88
125
  })
89
- })), c;
126
+ });
90
127
  }
91
- })), I(() => f(o, v("h-full min-h-0 overflow-auto p-3", t.class))), o;
128
+ })), S(() => F(e, y("flex flex-col h-full min-h-0", n.class))), e;
92
129
  })();
93
130
  }
94
- function ie(t) {
95
- const n = S(), o = () => n.isSelected(t.item.id), c = () => n.getFilterMatch(t.item.name), i = K(() => t.item), a = X(n, i);
96
- let r;
97
- const d = () => r === "touch" || r === "pen", M = (e) => {
98
- r = e.pointerType, a.onPointerDown(e);
99
- }, T = (e) => {
100
- r = e.pointerType, a.onPointerMove(e);
101
- }, D = (e) => {
102
- r = e.pointerType, a.onPointerUp();
103
- }, j = (e) => {
104
- r = e.pointerType, a.onPointerCancel();
105
- }, H = (e) => {
106
- if (!a.consumeClickSuppression(e)) {
107
- if (d()) {
108
- n.openItem(t.item);
131
+ function Z(n) {
132
+ const i = z(), l = () => i.isSelected(n.item.id), d = () => i.getFilterMatch(n.item.name), c = H(() => n.item), o = j(i, c);
133
+ let e;
134
+ const r = () => e === "touch" || e === "pen", f = (t) => {
135
+ e = t.pointerType, o.onPointerDown(t);
136
+ }, u = (t) => {
137
+ e = t.pointerType, o.onPointerMove(t);
138
+ }, v = (t) => {
139
+ e = t.pointerType, o.onPointerUp();
140
+ }, _ = (t) => {
141
+ e = t.pointerType, o.onPointerCancel();
142
+ }, x = (t) => {
143
+ if (!o.consumeClickSuppression(t)) {
144
+ if (r()) {
145
+ i.openItem(n.item);
109
146
  return;
110
147
  }
111
- n.selectItem(t.item.id, e.metaKey || e.ctrlKey);
148
+ i.selectItem(n.item.id, t.metaKey || t.ctrlKey);
112
149
  }
113
- }, L = () => {
114
- d() || n.openItem(t.item);
115
- }, N = (e) => {
116
- if (e.preventDefault(), e.stopPropagation(), d()) return;
117
- o() || n.selectItem(t.item.id, !1);
118
- const g = n.selectedItems(), h = n.currentFiles(), x = g.size > 0 ? h.filter((l) => g.has(l.id)) : [t.item];
119
- n.showContextMenu({
120
- x: e.clientX,
121
- y: e.clientY,
122
- items: x
150
+ }, m = () => {
151
+ r() || i.openItem(n.item);
152
+ }, w = (t) => {
153
+ if (t.preventDefault(), t.stopPropagation(), r()) return;
154
+ l() || i.selectItem(n.item.id, !1);
155
+ const $ = i.selectedItems(), C = i.currentFiles(), b = $.size > 0 ? C.filter((k) => $.has(k.id)) : [n.item];
156
+ i.showContextMenu({
157
+ x: t.clientX,
158
+ y: t.clientY,
159
+ items: b
123
160
  });
124
- }, Q = () => t.item.type === "folder" ? A : V(t.item.extension);
161
+ }, p = () => n.item.type === "folder" ? K : Q(n.item.extension);
125
162
  return (() => {
126
- var e = te(), g = e.firstChild, h = g.nextSibling, x = h.nextSibling;
127
- return e.addEventListener("pointercancel", j), e.$$pointerup = D, e.$$pointermove = T, e.$$pointerdown = M, e.$$contextmenu = N, e.$$dblclick = L, e.$$click = H, u(e, s(p, {
128
- get when() {
129
- return o();
130
- },
131
- get children() {
132
- return ee();
133
- }
134
- }), g), u(g, s(B, {
163
+ var t = R(), $ = t.firstChild, C = $.firstChild, b = $.nextSibling, k = b.nextSibling;
164
+ return t.addEventListener("pointercancel", _), t.$$pointerup = v, t.$$pointermove = u, t.$$pointerdown = f, t.$$contextmenu = w, t.$$dblclick = m, t.$$click = x, s(C, a(A, {
135
165
  get component() {
136
- return Q();
166
+ return p();
137
167
  },
138
- class: "w-8 h-8"
139
- })), u(h, s(ne, {
168
+ class: "w-4 h-4"
169
+ })), s($, a(W, {
140
170
  get name() {
141
- return t.item.name;
171
+ return n.item.name;
142
172
  },
143
173
  get match() {
144
- return c();
174
+ return d();
145
175
  }
146
- })), I((l) => {
147
- var y = v(
148
- "group relative flex flex-col items-center gap-2 p-3 rounded-lg cursor-pointer",
149
- "transition-all duration-150",
150
- "hover:bg-accent/50 hover:scale-[1.02]",
151
- "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
152
- "active:scale-[0.98]",
153
- o() && "bg-accent ring-2 ring-primary/50",
176
+ }), null), s(b, () => n.formatDate(n.item.modifiedAt)), s(k, (() => {
177
+ var g = D(() => n.item.type === "folder");
178
+ return () => g() ? "-" : n.formatSize(n.item.size);
179
+ })()), S((g) => {
180
+ var P = y(
181
+ "group w-full flex items-center text-xs cursor-pointer",
182
+ "transition-all duration-100",
183
+ "hover:bg-accent/50",
184
+ "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring",
185
+ l() && "bg-accent text-accent-foreground",
154
186
  // Staggered animation on mount
155
- "animate-in fade-in zoom-in-95"
156
- ), b = `${Math.min(t.index * 30, 300)}ms`, w = v("w-12 h-12 flex items-center justify-center rounded-lg", "transition-transform duration-200", "group-hover:scale-110", t.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"), k = t.item.name, _ = v("absolute inset-0 rounded-lg opacity-0 transition-opacity duration-300", "group-hover:opacity-100", "pointer-events-none"), C = t.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%)";
157
- return y !== l.e && f(e, l.e = y), b !== l.t && F(e, "animation-delay", l.t = b), w !== l.a && f(g, l.a = w), $ !== l.o && f(h, l.o = $), k !== l.i && E(h, "title", l.i = k), _ !== l.n && f(x, l.n = _), C !== l.s && F(x, "background", l.s = C), l;
187
+ "animate-in fade-in slide-in-from-top-2"
188
+ ), M = `${Math.min(n.index * 20, 200)}ms`;
189
+ return P !== g.e && F(t, g.e = P), M !== g.t && B(t, "animation-delay", g.t = M), g;
158
190
  }, {
159
191
  e: void 0,
160
- t: void 0,
161
- a: void 0,
162
- o: void 0,
163
- i: void 0,
164
- n: void 0,
165
- s: void 0
166
- }), e;
192
+ t: void 0
193
+ }), t;
167
194
  })();
168
195
  }
169
- z(["click", "dblclick", "contextmenu", "pointerdown", "pointermove", "pointerup"]);
196
+ L(["click", "dblclick", "contextmenu", "pointerdown", "pointermove", "pointerup"]);
170
197
  export {
171
- me as FileGridView
198
+ ce as FileListView
172
199
  };