@floegence/floe-webapp-core 0.33.4 → 0.33.6

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.
@@ -30,6 +30,8 @@ export interface FileBrowserProps {
30
30
  class?: string;
31
31
  /** Custom header content */
32
32
  header?: JSX.Element;
33
+ /** Actions rendered on the right side of the Explorer sidebar header */
34
+ sidebarHeaderActions?: JSX.Element;
33
35
  /** Sidebar width in pixels */
34
36
  sidebarWidth?: number;
35
37
  /** Persisted sidebar width storage key (defaults to a shared user preference key) */
@@ -1,20 +1,20 @@
1
- import { createComponent as n, insert as l, addEventListener as P, use as L, memo as w, effect as T, className as W, setStyleProperty as B, template as m, delegateEvents as G } from "solid-js/web";
2
- import { onMount as H, onCleanup as Q, createEffect as q, Show as a } from "solid-js";
3
- import { cn as K } from "../../utils/cn.js";
4
- import { useLayout as J } from "../../context/LayoutContext.js";
5
- import { useFileBrowserDrag as U } from "../../context/FileBrowserDragContext.js";
6
- import { deferAfterPaint as X } from "../../utils/defer.js";
7
- import { FileBrowserProvider as Y, useFileBrowser as Z } from "./FileBrowserContext.js";
8
- import { ResizeHandle as p } from "../layout/ResizeHandle.js";
9
- import { DirectoryTree as ee } from "./DirectoryTree.js";
10
- import { FileListView as te } from "./FileListView.js";
11
- import { FileGridView as re } from "./FileGridView.js";
12
- import { FileBrowserToolbar as ie } from "./FileBrowserToolbar.js";
13
- import { FileContextMenu as ne } from "./FileContextMenu.js";
14
- import { DragPreview as le } from "./DragPreview.js";
15
- var ae = /* @__PURE__ */ m('<div class="border-b border-border">'), oe = /* @__PURE__ */ m('<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">'), se = /* @__PURE__ */ m('<div class="absolute inset-0 bg-background/60 backdrop-blur-sm z-[9]">'), de = /* @__PURE__ */ m('<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]">');
16
- function De(e) {
17
- return n(Y, {
1
+ import { createComponent as n, insert as i, use as P, memo as _, effect as k, className as z, template as w, delegateEvents as W } from "solid-js/web";
2
+ import { onMount as A, onCleanup as K, createEffect as L, Show as u } from "solid-js";
3
+ import { cn as B } from "../../utils/cn.js";
4
+ import { useLayout as O } from "../../context/LayoutContext.js";
5
+ import { useFileBrowserDrag as E } from "../../context/FileBrowserDragContext.js";
6
+ import { deferAfterPaint as V } from "../../utils/defer.js";
7
+ import { FileBrowserProvider as H, useFileBrowser as N } from "./FileBrowserContext.js";
8
+ import { SidebarPane as T } from "../layout/SidebarPane.js";
9
+ import { DirectoryTree as j } from "./DirectoryTree.js";
10
+ import { FileListView as G } from "./FileListView.js";
11
+ import { FileGridView as Q } from "./FileGridView.js";
12
+ import { FileBrowserToolbar as q } from "./FileBrowserToolbar.js";
13
+ import { FileContextMenu as J } from "./FileContextMenu.js";
14
+ import { DragPreview as U } from "./DragPreview.js";
15
+ var X = /* @__PURE__ */ w('<div class="border-b border-border">'), Y = /* @__PURE__ */ w('<div><div class="flex flex-1 min-h-0 relative"><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]">');
16
+ function me(e) {
17
+ return n(H, {
18
18
  get files() {
19
19
  return e.files;
20
20
  },
@@ -55,13 +55,16 @@ function De(e) {
55
55
  return e.onOpen;
56
56
  },
57
57
  get children() {
58
- return n(ue, {
58
+ return n(Z, {
59
59
  get class() {
60
60
  return e.class;
61
61
  },
62
62
  get header() {
63
63
  return e.header;
64
64
  },
65
+ get sidebarHeaderActions() {
66
+ return e.sidebarHeaderActions;
67
+ },
65
68
  get sidebarResizable() {
66
69
  return e.sidebarResizable;
67
70
  },
@@ -93,129 +96,124 @@ function De(e) {
93
96
  }
94
97
  });
95
98
  }
96
- function ue(e) {
97
- const r = Z(), O = J(), d = U(), o = () => O.isMobile(), C = () => r.sidebarWidth(), E = () => e.sidebarResizable ?? !0, s = () => (e.enableDragDrop ?? !0) && !!d, u = () => e.instanceId ?? `filebrowser-${Math.random().toString(36).slice(2, 9)}`;
98
- let M, I = null, S = null;
99
- H(() => {
100
- if (!d || !s()) return;
101
- const i = {
102
- instanceId: u(),
103
- currentPath: r.currentPath,
104
- files: r.files,
99
+ function Z(e) {
100
+ const t = N(), I = O(), o = E(), f = () => I.isMobile(), M = () => t.sidebarWidth(), S = () => e.sidebarResizable ?? !0, a = () => (e.enableDragDrop ?? !0) && !!o, s = () => e.instanceId ?? `filebrowser-${Math.random().toString(36).slice(2, 9)}`;
101
+ let h, C = null, x = null;
102
+ A(() => {
103
+ if (!o || !a()) return;
104
+ const r = {
105
+ instanceId: s(),
106
+ currentPath: t.currentPath,
107
+ files: t.files,
105
108
  onDragMove: e.onDragMove,
106
- getScrollContainer: () => I,
107
- getSidebarScrollContainer: () => S,
108
- optimisticRemove: r.optimisticRemove,
109
- optimisticInsert: r.optimisticInsert
109
+ getScrollContainer: () => C,
110
+ getSidebarScrollContainer: () => x,
111
+ optimisticRemove: t.optimisticRemove,
112
+ optimisticInsert: t.optimisticInsert
110
113
  };
111
- d.registerInstance(i);
112
- }), Q(() => {
113
- d && s() && d.unregisterInstance(u());
114
+ o.registerInstance(r);
115
+ }), K(() => {
116
+ o && a() && o.unregisterInstance(s());
114
117
  });
115
- let y = !1, f = !1;
116
- q(() => {
117
- const i = o();
118
- if (!y) {
119
- y = !0, f = i, i && e.hideSidebarOnMobile !== !1 && !r.sidebarCollapsed() && r.toggleSidebar();
118
+ let v = !1, g = !1;
119
+ L(() => {
120
+ const r = f();
121
+ if (!v) {
122
+ v = !0, g = r, r && e.hideSidebarOnMobile !== !1 && !t.sidebarCollapsed() && t.toggleSidebar();
120
123
  return;
121
124
  }
122
- !f && i && e.hideSidebarOnMobile !== !1 && !r.sidebarCollapsed() && r.toggleSidebar(), f = i;
125
+ !g && r && e.hideSidebarOnMobile !== !1 && !t.sidebarCollapsed() && t.toggleSidebar(), g = r;
123
126
  });
124
- const j = (i) => {
125
- (i.metaKey || i.ctrlKey) && i.key.toLowerCase() === "f" && (i.preventDefault(), r.setFilterActive(!0), X(() => M?.focus()));
126
- }, D = () => !r.sidebarCollapsed() || !o();
127
+ const D = (r) => {
128
+ (r.metaKey || r.ctrlKey) && r.key.toLowerCase() === "f" && (r.preventDefault(), t.setFilterActive(!0), V(() => h?.focus()));
129
+ }, y = () => !t.sidebarCollapsed() || !f();
127
130
  return (() => {
128
- var i = de(), h = i.firstChild, c = h.firstChild, k = c.firstChild, v = k.firstChild;
129
- v.firstChild;
130
- var $ = v.nextSibling, x = c.nextSibling, b = x.firstChild, V = b.nextSibling, g = V.firstChild, A = g.firstChild, N = g.nextSibling;
131
- return i.$$keydown = j, l(i, n(a, {
131
+ var r = Y(), m = r.firstChild, b = m.firstChild, c = b.firstChild, R = c.nextSibling, d = R.firstChild, $ = d.firstChild, F = d.nextSibling;
132
+ return r.$$keydown = D, i(r, n(u, {
132
133
  get when() {
133
134
  return e.header;
134
135
  },
135
136
  get children() {
136
- var t = ae();
137
- return l(t, () => e.header), t;
137
+ var l = X();
138
+ return i(l, () => e.header), l;
138
139
  }
139
- }), h), l(v, n(a, {
140
- get when() {
141
- return o();
140
+ }), m), i(m, n(T, {
141
+ title: "Explorer",
142
+ get width() {
143
+ return M();
142
144
  },
143
- get children() {
144
- var t = oe();
145
- return P(t, "click", r.toggleSidebar, !0), t;
146
- }
147
- }), null), L((t) => {
148
- S = t;
149
- }, $), l($, n(ee, {
150
- get instanceId() {
151
- return u();
145
+ get open() {
146
+ return y();
152
147
  },
153
- get enableDragDrop() {
154
- return s();
155
- }
156
- })), l(c, n(a, {
157
- get when() {
158
- return w(() => !!(E() && D()))() && !o();
148
+ get headerActions() {
149
+ return e.sidebarHeaderActions;
159
150
  },
151
+ get resizable() {
152
+ return S();
153
+ },
154
+ onResize: (l) => {
155
+ t.setSidebarWidth(t.sidebarWidth() + l);
156
+ },
157
+ get onClose() {
158
+ return t.toggleSidebar;
159
+ },
160
+ bodyRef: (l) => {
161
+ x = l;
162
+ },
163
+ bodyClass: "py-1",
160
164
  get children() {
161
- return n(p, {
162
- direction: "horizontal",
163
- onResize: (t) => {
164
- r.setSidebarWidth(r.sidebarWidth() + t);
165
+ return n(j, {
166
+ get instanceId() {
167
+ return s();
168
+ },
169
+ get enableDragDrop() {
170
+ return a();
165
171
  }
166
172
  });
167
173
  }
168
- }), null), l(h, n(a, {
174
+ }), b), i(b, n(q, {
175
+ filterInputRef: (l) => h = l
176
+ }), c), P((l) => {
177
+ C = l;
178
+ }, c), i(c, n(u, {
169
179
  get when() {
170
- return w(() => !!o())() && !r.sidebarCollapsed();
171
- },
172
- get children() {
173
- var t = se();
174
- return P(t, "click", r.toggleSidebar, !0), t;
175
- }
176
- }), x), l(x, n(ie, {
177
- filterInputRef: (t) => M = t
178
- }), b), L((t) => {
179
- I = t;
180
- }, b), l(b, n(a, {
181
- get when() {
182
- return r.viewMode() === "list";
180
+ return t.viewMode() === "list";
183
181
  },
184
182
  get fallback() {
185
- return n(re, {
183
+ return n(Q, {
186
184
  get instanceId() {
187
- return u();
185
+ return s();
188
186
  },
189
187
  get enableDragDrop() {
190
- return s();
188
+ return a();
191
189
  }
192
190
  });
193
191
  },
194
192
  get children() {
195
- return n(te, {
193
+ return n(G, {
196
194
  get instanceId() {
197
- return u();
195
+ return s();
198
196
  },
199
197
  get enableDragDrop() {
200
- return s();
198
+ return a();
201
199
  }
202
200
  });
203
201
  }
204
- })), l(g, () => r.currentFiles().length, A), l(g, n(a, {
202
+ })), i(d, () => t.currentFiles().length, $), i(d, n(u, {
205
203
  get when() {
206
- return r.filterQueryApplied().trim();
204
+ return t.filterQueryApplied().trim();
207
205
  },
208
206
  get children() {
209
207
  return [" ", "(filtered)"];
210
208
  }
211
- }), null), l(g, n(a, {
209
+ }), null), i(d, n(u, {
212
210
  get when() {
213
- return r.selectedItems().size > 0;
211
+ return t.selectedItems().size > 0;
214
212
  },
215
213
  get children() {
216
- return [" · ", w(() => r.selectedItems().size), " selected"];
214
+ return [" · ", _(() => t.selectedItems().size), " selected"];
217
215
  }
218
- }), null), l(N, () => r.currentPath()), l(i, n(ne, {
216
+ }), null), i(F, () => t.currentPath()), i(r, n(J, {
219
217
  get callbacks() {
220
218
  return e.contextMenuCallbacks;
221
219
  },
@@ -228,31 +226,17 @@ function ue(e) {
228
226
  get hideItems() {
229
227
  return e.hideContextMenuItems;
230
228
  }
231
- }), null), l(i, n(a, {
229
+ }), null), i(r, n(u, {
232
230
  get when() {
233
- return s();
231
+ return a();
234
232
  },
235
233
  get children() {
236
- return n(le, {});
234
+ return n(U, {});
237
235
  }
238
- }), null), T((t) => {
239
- var _ = K("flex flex-col h-full min-h-0 bg-background", "border border-border rounded-lg overflow-hidden", "shadow-sm", e.class), R = K(
240
- "flex-shrink-0 border-r border-border bg-sidebar relative",
241
- "transition-all duration-200 ease-out",
242
- "overflow-hidden",
243
- // Mobile overlay
244
- o() && !r.sidebarCollapsed() && "absolute inset-y-0 left-0 z-10 shadow-lg"
245
- ), z = D() ? `${C()}px` : "0px", F = `${C()}px`;
246
- return _ !== t.e && W(i, t.e = _), R !== t.t && W(c, t.t = R), z !== t.a && B(c, "width", t.a = z), F !== t.o && B(k, "width", t.o = F), t;
247
- }, {
248
- e: void 0,
249
- t: void 0,
250
- a: void 0,
251
- o: void 0
252
- }), i;
236
+ }), null), k(() => z(r, B("flex flex-col h-full min-h-0 bg-background", "border border-border rounded-lg overflow-hidden", "shadow-sm", e.class))), r;
253
237
  })();
254
238
  }
255
- G(["keydown", "click"]);
239
+ W(["keydown"]);
256
240
  export {
257
- De as FileBrowser
241
+ me as FileBrowser
258
242
  };
@@ -0,0 +1,19 @@
1
+ import { type JSX } from 'solid-js';
2
+ export interface SidebarPaneProps {
3
+ children: JSX.Element;
4
+ title?: JSX.Element;
5
+ headerActions?: JSX.Element;
6
+ width?: number;
7
+ open?: boolean;
8
+ resizable?: boolean;
9
+ onResize?: (delta: number) => void;
10
+ onClose?: () => void;
11
+ mobileOverlay?: boolean;
12
+ mobileBackdrop?: boolean;
13
+ class?: string;
14
+ innerClass?: string;
15
+ bodyClass?: string;
16
+ backdropClass?: string;
17
+ bodyRef?: (el: HTMLDivElement) => void;
18
+ }
19
+ export declare function SidebarPane(props: SidebarPaneProps): JSX.Element;
@@ -0,0 +1,68 @@
1
+ import { insert as i, createComponent as o, use as M, effect as k, className as a, setStyleProperty as C, template as s, delegateEvents as S } from "solid-js/web";
2
+ import { Show as l } from "solid-js";
3
+ import { useLayout as j } from "../../context/LayoutContext.js";
4
+ import { cn as d } from "../../utils/cn.js";
5
+ import { ResizeHandle as A } from "./ResizeHandle.js";
6
+ var O = /* @__PURE__ */ s('<div class="min-w-0 flex items-center gap-1.5">'), P = /* @__PURE__ */ s('<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">'), E = /* @__PURE__ */ s('<div class="flex min-w-0 items-center gap-1.5">'), H = /* @__PURE__ */ s('<aside><div><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"></span></div><div>'), L = /* @__PURE__ */ s("<div>");
7
+ function I(e) {
8
+ const z = j(), v = () => z.isMobile(), m = () => e.width ?? 240, c = () => e.open ?? !0, u = () => v() && e.mobileOverlay !== !1 && c(), w = () => u() && typeof e.onClose == "function", _ = () => u() && e.mobileBackdrop !== !1 && typeof e.onClose == "function", R = () => e.resizable && c() && !v() && typeof e.onResize == "function";
9
+ return [(() => {
10
+ var n = H(), h = n.firstChild, f = h.firstChild, B = f.firstChild, b = f.nextSibling;
11
+ return i(B, () => e.title), i(f, o(l, {
12
+ get when() {
13
+ return e.headerActions || w();
14
+ },
15
+ get children() {
16
+ var t = E();
17
+ return i(t, o(l, {
18
+ get when() {
19
+ return e.headerActions;
20
+ },
21
+ get children() {
22
+ var r = O();
23
+ return i(r, () => e.headerActions), r;
24
+ }
25
+ }), null), i(t, o(l, {
26
+ get when() {
27
+ return w();
28
+ },
29
+ get children() {
30
+ var r = P();
31
+ return r.$$click = () => e.onClose?.(), r;
32
+ }
33
+ }), null), t;
34
+ }
35
+ }), null), M((t) => e.bodyRef?.(t), b), i(b, () => e.children), i(n, o(l, {
36
+ get when() {
37
+ return R();
38
+ },
39
+ get children() {
40
+ return o(A, {
41
+ direction: "horizontal",
42
+ onResize: (t) => e.onResize?.(t)
43
+ });
44
+ }
45
+ }), null), k((t) => {
46
+ var r = d("flex-shrink-0 border-r border-border bg-sidebar relative", "transition-all duration-200 ease-out", "overflow-hidden", u() && "absolute inset-y-0 left-0 z-10 shadow-lg", e.class), g = c() ? `${m()}px` : "0px", x = d("h-full flex flex-col", e.innerClass), y = `${m()}px`, $ = d("flex-1 min-h-0 overflow-auto", e.bodyClass);
47
+ return r !== t.e && a(n, t.e = r), g !== t.t && C(n, "width", t.t = g), x !== t.a && a(h, t.a = x), y !== t.o && C(h, "width", t.o = y), $ !== t.i && a(b, t.i = $), t;
48
+ }, {
49
+ e: void 0,
50
+ t: void 0,
51
+ a: void 0,
52
+ o: void 0,
53
+ i: void 0
54
+ }), n;
55
+ })(), o(l, {
56
+ get when() {
57
+ return _();
58
+ },
59
+ get children() {
60
+ var n = L();
61
+ return n.$$click = () => e.onClose?.(), k(() => a(n, d("absolute inset-0 bg-background/60 backdrop-blur-sm z-[9]", e.backdropClass))), n;
62
+ }
63
+ })];
64
+ }
65
+ S(["click"]);
66
+ export {
67
+ I as SidebarPane
68
+ };
@@ -6,5 +6,6 @@ export { TopBarIconButton, type TopBarIconButtonProps } from './TopBarIconButton
6
6
  export { BottomBar, BottomBarItem, StatusIndicator, type BottomBarProps, type BottomBarItemProps, type StatusIndicatorProps } from './BottomBar';
7
7
  export { MobileTabBar, type MobileTabBarItem, type MobileTabBarProps } from './MobileTabBar';
8
8
  export { ResizeHandle, type ResizeHandleProps } from './ResizeHandle';
9
+ export { SidebarPane, type SidebarPaneProps } from './SidebarPane';
9
10
  export { Panel, PanelHeader, PanelContent, type PanelProps, type PanelHeaderProps, type PanelContentProps } from './Panel';
10
11
  export { KeepAliveStack, type KeepAliveStackProps, type KeepAliveView } from './KeepAliveStack';