@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/index39.js CHANGED
@@ -1,236 +1,164 @@
1
- import { createComponent as he } from "solid-js/web";
2
- import { createContext as me, createSignal as a, createMemo as N, useContext as we } from "solid-js";
3
- import { deferNonBlocking as I } from "./index68.js";
4
- const V = me();
5
- function Q(r, p) {
6
- if (!p) return [];
7
- const x = r.toLowerCase(), w = p.toLowerCase(), h = [];
8
- let g = 0;
9
- for (const S of w) {
10
- const m = x.indexOf(S, g);
11
- if (m === -1) return null;
12
- h.push(m), g = m + 1;
13
- }
14
- return h;
15
- }
16
- function Ce(r) {
17
- const [p, x] = a(r.initialPath ?? "/"), [w, h] = a(/* @__PURE__ */ new Set()), [g, S] = a(r.initialViewMode ?? "list"), [m, j] = a({
18
- field: "name",
19
- direction: "asc"
20
- }), [M, O] = a(/* @__PURE__ */ new Set(["/"])), [R, D] = a(!1), [G, k] = a(null), [v, b] = a(""), [H, B] = a(!1), [z, P] = a([]);
21
- let u = null, C = {
22
- top: 0,
23
- left: 0
24
- };
25
- const A = () => r.files, c = (e) => {
26
- const t = (e ?? "").trim();
27
- return t === "" ? "/" : t;
28
- }, T = (e) => {
29
- const t = c(e);
30
- if (t === "/") return "/";
31
- const n = t.split("/").filter(Boolean);
32
- return n.pop(), n.length ? "/" + n.join("/") : "/";
33
- }, J = (e, t) => {
34
- const n = z();
35
- if (n.length === 0) return e;
36
- let s = [...e];
37
- const d = c(t);
38
- for (const o of n)
39
- switch (o.type) {
40
- case "remove": {
41
- const l = new Set(o.paths.map(c));
42
- s = s.filter((i) => !l.has(c(i.path)));
43
- break;
44
- }
45
- case "update": {
46
- const l = c(o.oldPath), i = s.findIndex((f) => c(f.path) === l);
47
- if (i !== -1) {
48
- const f = o.updates.path ?? s[i].path;
49
- T(f) === d ? s[i] = {
50
- ...s[i],
51
- ...o.updates
52
- } : s.splice(i, 1);
53
- } else {
54
- const f = o.updates.path;
55
- f && T(f);
56
- }
57
- break;
58
- }
59
- case "insert": {
60
- c(o.parentPath) === d && (s.some((i) => c(i.path) === c(o.item.path)) || s.push(o.item));
61
- break;
1
+ import { delegateEvents as j, createComponent as i, template as b, insert as n, addEventListener as y, memo as S, effect as z, className as $, setStyleProperty as I } from "solid-js/web";
2
+ import { createSignal as V, onMount as W, onCleanup as _, Show as a } from "solid-js";
3
+ import { cn as F } from "./index68.js";
4
+ import { FileBrowserProvider as D, useFileBrowser as K } from "./index40.js";
5
+ import { DirectoryTree as N } from "./index41.js";
6
+ import { FileListView as T } from "./index42.js";
7
+ import { FileGridView as p } from "./index43.js";
8
+ import { FileBrowserToolbar as q } from "./index46.js";
9
+ import { FileContextMenu as A } from "./index44.js";
10
+ var G = /* @__PURE__ */ b('<div class="border-b border-border">'), Q = /* @__PURE__ */ b('<button type=button class="flex items-center justify-center w-5 h-5 rounded cursor-pointer hover:bg-sidebar-accent/80 transition-colors"aria-label="Close sidebar"><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 class="w-3.5 h-3.5"><path d="M18 6 6 18"></path><path d="m6 6 12 12">'), H = /* @__PURE__ */ b('<div class="absolute inset-0 bg-background/60 backdrop-blur-sm z-[9]">'), J = /* @__PURE__ */ b('<div><div class="flex flex-1 min-h-0 relative"><aside><div class="h-full flex flex-col"><div class="flex items-center justify-between px-3 py-2 border-b border-sidebar-border"><span class="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60">Explorer</span></div><div class="flex-1 min-h-0 overflow-auto py-1"></div></div></aside><div class="flex-1 min-w-0 flex flex-col"><div class="flex-1 min-h-0"></div><div class="flex items-center justify-between px-3 py-1 border-t border-border text-[10px] text-muted-foreground"><span> items</span><span class="truncate max-w-[200px]">');
11
+ function le(e) {
12
+ return i(D, {
13
+ get files() {
14
+ return e.files;
15
+ },
16
+ get initialPath() {
17
+ return e.initialPath;
18
+ },
19
+ get initialViewMode() {
20
+ return e.initialViewMode;
21
+ },
22
+ get onNavigate() {
23
+ return e.onNavigate;
24
+ },
25
+ get onSelect() {
26
+ return e.onSelect;
27
+ },
28
+ get onOpen() {
29
+ return e.onOpen;
30
+ },
31
+ get children() {
32
+ return i(R, {
33
+ get class() {
34
+ return e.class;
35
+ },
36
+ get header() {
37
+ return e.header;
38
+ },
39
+ get sidebarWidth() {
40
+ return e.sidebarWidth;
41
+ },
42
+ get hideSidebarOnMobile() {
43
+ return e.hideSidebarOnMobile;
44
+ },
45
+ get contextMenuCallbacks() {
46
+ return e.contextMenuCallbacks;
47
+ },
48
+ get customContextMenuItems() {
49
+ return e.customContextMenuItems;
50
+ },
51
+ get overrideContextMenuItems() {
52
+ return e.overrideContextMenuItems;
53
+ },
54
+ get hideContextMenuItems() {
55
+ return e.hideContextMenuItems;
62
56
  }
63
- }
64
- return s;
65
- }, K = N(() => {
66
- const e = /* @__PURE__ */ new Map(), t = (s) => {
67
- var d;
68
- for (const o of s)
69
- o.type === "folder" && (e.set(c(o.path), o.children ?? []), (d = o.children) != null && d.length && t(o.children));
70
- }, n = A();
71
- return e.set("/", n), t(n), e;
72
- }), U = N(() => {
73
- const e = c(p());
74
- let t = K().get(e) ?? [];
75
- t = J(t, e);
76
- const n = v().trim();
77
- n && (t = t.filter((o) => Q(o.name, n) !== null));
78
- const s = m();
79
- return [...t].sort((o, l) => {
80
- var f, F;
81
- if (o.type !== l.type)
82
- return o.type === "folder" ? -1 : 1;
83
- let i = 0;
84
- switch (s.field) {
85
- case "name":
86
- i = o.name.localeCompare(l.name);
87
- break;
88
- case "size":
89
- i = (o.size ?? 0) - (l.size ?? 0);
90
- break;
91
- case "modifiedAt":
92
- i = (((f = o.modifiedAt) == null ? void 0 : f.getTime()) ?? 0) - (((F = l.modifiedAt) == null ? void 0 : F.getTime()) ?? 0);
93
- break;
94
- case "type":
95
- i = (o.extension ?? "").localeCompare(l.extension ?? "");
96
- break;
97
- }
98
- return s.direction === "asc" ? i : -i;
99
- });
100
- }), y = (e) => {
101
- var s;
102
- const t = c(e);
103
- x(t), h(/* @__PURE__ */ new Set()), b(""), B(!1);
104
- const n = r.onSelect;
105
- I(() => n == null ? void 0 : n([])), (s = r.onNavigate) == null || s.call(r, t);
106
- }, W = () => {
107
- const e = p();
108
- if (e === "/" || e === "") return;
109
- const t = e.split("/").filter(Boolean);
110
- t.pop(), y(t.length ? "/" + t.join("/") : "/");
111
- }, E = (e) => {
112
- e.type === "folder" && (y(e.path), O((t) => {
113
- const n = new Set(t);
114
- return n.add(e.path), n;
115
- }));
116
- }, X = (e, t = !1) => {
117
- const n = w(), s = t ? new Set(n) : /* @__PURE__ */ new Set();
118
- t ? s.has(e) ? s.delete(e) : s.add(e) : (s.clear(), s.add(e)), h(s);
119
- const d = U().filter((l) => s.has(l.id)), o = r.onSelect;
120
- I(() => o == null ? void 0 : o(d));
121
- }, Y = () => {
122
- h(/* @__PURE__ */ new Set());
123
- const e = r.onSelect;
124
- I(() => e == null ? void 0 : e([]));
125
- }, Z = (e) => w().has(e), _ = (e) => {
126
- O((t) => {
127
- const n = new Set(t);
128
- return n.has(e) ? n.delete(e) : n.add(e), n;
129
- });
130
- }, $ = (e) => M().has(e), ee = () => D((e) => !e), te = (e) => k(e), ne = () => k(null), oe = (e) => {
131
- b(e);
132
- }, se = (e) => {
133
- const t = v().trim();
134
- if (!t) return null;
135
- const n = Q(e, t);
136
- return n ? {
137
- matchedIndices: n
138
- } : null;
139
- }, re = (e) => {
140
- var t;
141
- e.type === "folder" ? E(e) : (t = r.onOpen) == null || t.call(r, e);
142
- }, ie = (e) => {
143
- e.length !== 0 && P((t) => [...t, {
144
- type: "remove",
145
- paths: e
146
- }]);
147
- }, ce = (e, t) => {
148
- P((n) => [...n, {
149
- type: "update",
150
- oldPath: e,
151
- updates: t
152
- }]);
153
- }, le = (e, t) => {
154
- P((n) => [...n, {
155
- type: "insert",
156
- parentPath: e,
157
- item: t
158
- }]);
159
- }, ae = () => {
160
- P([]);
161
- }, de = () => {
162
- P([]);
163
- }, fe = () => z().length > 0, ue = (e) => {
164
- u = e;
165
- }, L = () => u ? {
166
- top: u.scrollTop,
167
- left: u.scrollLeft
168
- } : {
169
- top: 0,
170
- left: 0
171
- }, q = (e) => {
172
- u && (u.scrollTop = e.top, u.scrollLeft = e.left);
173
- }, pe = {
174
- currentPath: p,
175
- setCurrentPath: y,
176
- navigateUp: W,
177
- navigateTo: E,
178
- selectedItems: () => w(),
179
- selectItem: X,
180
- clearSelection: Y,
181
- isSelected: Z,
182
- viewMode: g,
183
- setViewMode: S,
184
- sortConfig: m,
185
- setSortConfig: j,
186
- expandedFolders: M,
187
- toggleFolder: _,
188
- isExpanded: $,
189
- files: A,
190
- currentFiles: U,
191
- filterQuery: v,
192
- setFilterQuery: oe,
193
- isFilterActive: H,
194
- setFilterActive: B,
195
- getFilterMatch: se,
196
- sidebarCollapsed: R,
197
- toggleSidebar: ee,
198
- contextMenu: G,
199
- showContextMenu: te,
200
- hideContextMenu: ne,
201
- openItem: re,
202
- // Optimistic updates
203
- optimisticRemove: ie,
204
- optimisticUpdate: ce,
205
- optimisticInsert: le,
206
- clearOptimisticUpdates: ae,
207
- rollbackOptimisticUpdates: de,
208
- hasOptimisticUpdates: fe,
209
- // Scroll position management
210
- setScrollContainer: ue,
211
- getScrollPosition: L,
212
- setScrollPosition: q,
213
- saveScrollPosition: () => (C = L(), C),
214
- restoreScrollPosition: () => {
215
- requestAnimationFrame(() => {
216
- q(C);
217
57
  });
218
58
  }
219
- };
220
- return he(V.Provider, {
221
- value: pe,
222
- get children() {
223
- return r.children;
224
- }
225
59
  });
226
60
  }
227
- function ye() {
228
- const r = we(V);
229
- if (!r)
230
- throw new Error("useFileBrowser must be used within a FileBrowserProvider");
231
- return r;
61
+ function R(e) {
62
+ const r = K(), [m, v] = V(!1), x = () => e.sidebarWidth ?? 220;
63
+ let h;
64
+ W(() => {
65
+ const o = window.matchMedia("(max-width: 767px)"), s = o.matches;
66
+ v(s), s && e.hideSidebarOnMobile !== !1 && !r.sidebarCollapsed() && r.toggleSidebar();
67
+ const d = (l) => {
68
+ v(l.matches), l.matches && e.hideSidebarOnMobile !== !1 && !r.sidebarCollapsed() && r.toggleSidebar();
69
+ };
70
+ o.addEventListener("change", d), _(() => o.removeEventListener("change", d));
71
+ const u = (l) => {
72
+ (l.metaKey || l.ctrlKey) && l.key === "f" && (l.preventDefault(), r.setFilterActive(!0), setTimeout(() => h == null ? void 0 : h.focus(), 50));
73
+ };
74
+ document.addEventListener("keydown", u), _(() => document.removeEventListener("keydown", u));
75
+ });
76
+ const E = () => !r.sidebarCollapsed() || !m();
77
+ return (() => {
78
+ var o = J(), s = o.firstChild, d = s.firstChild, u = d.firstChild, l = u.firstChild;
79
+ l.firstChild;
80
+ var B = l.nextSibling, g = d.nextSibling, f = g.firstChild, L = f.nextSibling, c = L.firstChild, O = c.firstChild, P = c.nextSibling;
81
+ return n(o, i(a, {
82
+ get when() {
83
+ return e.header;
84
+ },
85
+ get children() {
86
+ var t = G();
87
+ return n(t, () => e.header), t;
88
+ }
89
+ }), s), n(l, i(a, {
90
+ get when() {
91
+ return m();
92
+ },
93
+ get children() {
94
+ var t = Q();
95
+ return y(t, "click", r.toggleSidebar, !0), t;
96
+ }
97
+ }), null), n(B, i(N, {})), n(s, i(a, {
98
+ get when() {
99
+ return S(() => !!m())() && !r.sidebarCollapsed();
100
+ },
101
+ get children() {
102
+ var t = H();
103
+ return y(t, "click", r.toggleSidebar, !0), t;
104
+ }
105
+ }), g), n(g, i(q, {
106
+ filterInputRef: (t) => h = t
107
+ }), f), n(f, i(a, {
108
+ get when() {
109
+ return r.viewMode() === "list";
110
+ },
111
+ get fallback() {
112
+ return i(p, {});
113
+ },
114
+ get children() {
115
+ return i(T, {});
116
+ }
117
+ })), n(c, () => r.currentFiles().length, O), n(c, i(a, {
118
+ get when() {
119
+ return r.filterQuery().trim();
120
+ },
121
+ get children() {
122
+ return [" ", "(filtered)"];
123
+ }
124
+ }), null), n(c, i(a, {
125
+ get when() {
126
+ return r.selectedItems().size > 0;
127
+ },
128
+ get children() {
129
+ return [" · ", S(() => r.selectedItems().size), " selected"];
130
+ }
131
+ }), null), n(P, () => r.currentPath()), n(o, i(A, {
132
+ get callbacks() {
133
+ return e.contextMenuCallbacks;
134
+ },
135
+ get customItems() {
136
+ return e.customContextMenuItems;
137
+ },
138
+ get overrideItems() {
139
+ return e.overrideContextMenuItems;
140
+ },
141
+ get hideItems() {
142
+ return e.hideContextMenuItems;
143
+ }
144
+ }), null), z((t) => {
145
+ var w = F("flex flex-col h-full min-h-0 bg-background", "border border-border rounded-lg overflow-hidden", "shadow-sm", e.class), C = F(
146
+ "flex-shrink-0 border-r border-border bg-sidebar",
147
+ "transition-all duration-200 ease-out",
148
+ "overflow-hidden",
149
+ // Mobile overlay
150
+ m() && !r.sidebarCollapsed() && "absolute inset-y-0 left-0 z-10 shadow-lg"
151
+ ), M = E() ? `${x()}px` : "0px", k = `${x()}px`;
152
+ return w !== t.e && $(o, t.e = w), C !== t.t && $(d, t.t = C), M !== t.a && I(d, "width", t.a = M), k !== t.o && I(u, "width", t.o = k), t;
153
+ }, {
154
+ e: void 0,
155
+ t: void 0,
156
+ a: void 0,
157
+ o: void 0
158
+ }), o;
159
+ })();
232
160
  }
161
+ j(["click"]);
233
162
  export {
234
- Ce as FileBrowserProvider,
235
- ye as useFileBrowser
163
+ le as FileBrowser
236
164
  };
package/dist/index4.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { delegateEvents as b, template as c, insert as n, effect as d, className as s, setStyleProperty as u, memo as f } from "solid-js/web";
2
2
  import "solid-js";
3
- import { cn as o } from "./index67.js";
3
+ import { cn as o } from "./index68.js";
4
4
  var m = /* @__PURE__ */ c('<aside><div class="flex-1 overflow-auto overscroll-contain">'), v = /* @__PURE__ */ c("<div>"), x = /* @__PURE__ */ c("<section><div class=flex-1>"), h = /* @__PURE__ */ c('<div class="flex items-center justify-between px-2.5 py-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60"><span>'), $ = /* @__PURE__ */ c('<button type=button><span class="flex-1 truncate text-left">'), g = /* @__PURE__ */ c('<span class="flex-shrink-0 w-4 h-4 opacity-60">');
5
5
  function S(e) {
6
6
  return (() => {