@floegence/floe-webapp-core 0.11.5 → 0.11.7

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.
@@ -28,6 +28,14 @@ export interface FileBrowserProps {
28
28
  sidebarResizable?: boolean;
29
29
  /** Hide sidebar on mobile by default */
30
30
  hideSidebarOnMobile?: boolean;
31
+ /**
32
+ * Persistence key prefix for storing UI state (viewMode, sortConfig, expandedFolders, sidebarCollapsed).
33
+ * When set, these states will be persisted to localStorage.
34
+ * Each instance should use a unique key to avoid conflicts.
35
+ */
36
+ persistenceKey?: string;
37
+ /** Label for the root/home directory in breadcrumb (default: 'Root') */
38
+ homeLabel?: string;
31
39
  /** Context menu callbacks for built-in actions */
32
40
  contextMenuCallbacks?: ContextMenuCallbacks;
33
41
  /** Custom context menu items to add */
@@ -14,6 +14,12 @@ export interface FileBrowserProviderProps {
14
14
  * When omitted, a shared key is used (acts like a user preference).
15
15
  */
16
16
  sidebarWidthStorageKey?: string;
17
+ /**
18
+ * 持久化存储 key 前缀,用于区分不同实例的持久化数据。
19
+ * 设置后会持久化 viewMode、sortConfig、expandedFolders、sidebarCollapsed。
20
+ * 若不设置则不持久化这些状态。
21
+ */
22
+ persistenceKey?: string;
17
23
  /** Label for the root/home directory in breadcrumb (default: 'Root') */
18
24
  homeLabel?: string;
19
25
  onNavigate?: (path: string) => void;
package/dist/index102.js CHANGED
@@ -1,19 +1,25 @@
1
- import { createSignal as c, onMount as u, onCleanup as h } from "solid-js";
2
- function b(o) {
3
- const [r, i] = c(null);
4
- return u(() => {
5
- const t = o();
6
- if (!t) return;
7
- const n = new ResizeObserver((s) => {
8
- const e = s[0];
9
- e && i({
10
- width: e.contentRect.width,
11
- height: e.contentRect.height
1
+ import { createSignal as h, createEffect as g, onCleanup as s } from "solid-js";
2
+ function w(c) {
3
+ const [d, n] = h(null);
4
+ return g(() => {
5
+ const e = c();
6
+ if (!e) return;
7
+ const r = e.getBoundingClientRect();
8
+ if (n({ width: r.width, height: r.height }), typeof ResizeObserver > "u") {
9
+ const t = () => n({ width: e.getBoundingClientRect().width, height: e.getBoundingClientRect().height });
10
+ typeof window < "u" && (window.addEventListener("resize", t), s(() => window.removeEventListener("resize", t)));
11
+ return;
12
+ }
13
+ const o = new ResizeObserver((t) => {
14
+ const i = t[0];
15
+ i && n({
16
+ width: i.contentRect.width,
17
+ height: i.contentRect.height
12
18
  });
13
19
  });
14
- n.observe(t), h(() => n.disconnect());
15
- }), r;
20
+ o.observe(e), s(() => o.disconnect());
21
+ }), d;
16
22
  }
17
23
  export {
18
- b as useResizeObserver
24
+ w as useResizeObserver
19
25
  };
package/dist/index44.js CHANGED
@@ -1,17 +1,17 @@
1
- import { delegateEvents as j, createComponent as l, insert as n, addEventListener as I, memo as g, effect as E, className as _, setStyleProperty as z, template as u } from "solid-js/web";
1
+ import { delegateEvents as j, createComponent as n, insert as l, addEventListener as I, memo as g, effect as E, className as _, setStyleProperty as z, template as u } from "solid-js/web";
2
2
  import { createEffect as V, Show as o } from "solid-js";
3
3
  import { cn as F } from "./index106.js";
4
4
  import { useLayout as D } from "./index92.js";
5
5
  import { FileBrowserProvider as N, useFileBrowser as T } from "./index45.js";
6
6
  import { ResizeHandle as A } from "./index8.js";
7
- import { DirectoryTree as p } from "./index46.js";
8
- import { FileListView as G } from "./index47.js";
9
- import { FileGridView as H } from "./index48.js";
10
- import { FileBrowserToolbar as Q } from "./index51.js";
11
- import { FileContextMenu as q } from "./index49.js";
12
- var J = /* @__PURE__ */ u('<div class="border-b border-border">'), U = /* @__PURE__ */ u('<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">'), X = /* @__PURE__ */ u('<div class="absolute inset-0 bg-background/60 backdrop-blur-sm z-[9]">'), Y = /* @__PURE__ */ u('<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]">');
7
+ import { DirectoryTree as G } from "./index46.js";
8
+ import { FileListView as H } from "./index47.js";
9
+ import { FileGridView as Q } from "./index48.js";
10
+ import { FileBrowserToolbar as q } from "./index51.js";
11
+ import { FileContextMenu as J } from "./index49.js";
12
+ var U = /* @__PURE__ */ u('<div class="border-b border-border">'), X = /* @__PURE__ */ u('<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">'), Y = /* @__PURE__ */ u('<div class="absolute inset-0 bg-background/60 backdrop-blur-sm z-[9]">'), Z = /* @__PURE__ */ u('<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]">');
13
13
  function ce(e) {
14
- return l(N, {
14
+ return n(N, {
15
15
  get files() {
16
16
  return e.files;
17
17
  },
@@ -30,6 +30,12 @@ function ce(e) {
30
30
  get sidebarWidthStorageKey() {
31
31
  return e.sidebarWidthStorageKey;
32
32
  },
33
+ get persistenceKey() {
34
+ return e.persistenceKey;
35
+ },
36
+ get homeLabel() {
37
+ return e.homeLabel;
38
+ },
33
39
  get onNavigate() {
34
40
  return e.onNavigate;
35
41
  },
@@ -40,7 +46,7 @@ function ce(e) {
40
46
  return e.onOpen;
41
47
  },
42
48
  get children() {
43
- return l(Z, {
49
+ return n(p, {
44
50
  get class() {
45
51
  return e.class;
46
52
  },
@@ -69,8 +75,8 @@ function ce(e) {
69
75
  }
70
76
  });
71
77
  }
72
- function Z(e) {
73
- const r = T(), R = D(), d = () => R.isMobile(), v = () => r.sidebarWidth(), W = () => e.sidebarResizable ?? !0;
78
+ function p(e) {
79
+ const r = T(), R = D(), d = () => R.isMobile(), v = () => r.sidebarWidth(), L = () => e.sidebarResizable ?? !0;
74
80
  let x, w = !1, c = !1;
75
81
  V(() => {
76
82
  const i = d();
@@ -80,76 +86,76 @@ function Z(e) {
80
86
  }
81
87
  !c && i && e.hideSidebarOnMobile !== !1 && !r.sidebarCollapsed() && r.toggleSidebar(), c = i;
82
88
  });
83
- const B = (i) => {
89
+ const W = (i) => {
84
90
  (i.metaKey || i.ctrlKey) && i.key.toLowerCase() === "f" && (i.preventDefault(), r.setFilterActive(!0), setTimeout(() => x?.focus(), 50));
85
91
  }, C = () => !r.sidebarCollapsed() || !d();
86
92
  return (() => {
87
- var i = Y(), b = i.firstChild, s = b.firstChild, M = s.firstChild, f = M.firstChild;
93
+ var i = Z(), b = i.firstChild, s = b.firstChild, M = s.firstChild, f = M.firstChild;
88
94
  f.firstChild;
89
- var L = f.nextSibling, h = s.nextSibling, m = h.firstChild, O = m.nextSibling, a = O.firstChild, K = a.firstChild, P = a.nextSibling;
90
- return i.$$keydown = B, n(i, l(o, {
95
+ var K = f.nextSibling, h = s.nextSibling, m = h.firstChild, B = m.nextSibling, a = B.firstChild, O = a.firstChild, P = a.nextSibling;
96
+ return i.$$keydown = W, l(i, n(o, {
91
97
  get when() {
92
98
  return e.header;
93
99
  },
94
100
  get children() {
95
- var t = J();
96
- return n(t, () => e.header), t;
101
+ var t = U();
102
+ return l(t, () => e.header), t;
97
103
  }
98
- }), b), n(f, l(o, {
104
+ }), b), l(f, n(o, {
99
105
  get when() {
100
106
  return d();
101
107
  },
102
108
  get children() {
103
- var t = U();
109
+ var t = X();
104
110
  return I(t, "click", r.toggleSidebar, !0), t;
105
111
  }
106
- }), null), n(L, l(p, {})), n(s, l(o, {
112
+ }), null), l(K, n(G, {})), l(s, n(o, {
107
113
  get when() {
108
- return g(() => !!(W() && C()))() && !d();
114
+ return g(() => !!(L() && C()))() && !d();
109
115
  },
110
116
  get children() {
111
- return l(A, {
117
+ return n(A, {
112
118
  direction: "horizontal",
113
119
  onResize: (t) => {
114
120
  r.setSidebarWidth(r.sidebarWidth() + t);
115
121
  }
116
122
  });
117
123
  }
118
- }), null), n(b, l(o, {
124
+ }), null), l(b, n(o, {
119
125
  get when() {
120
126
  return g(() => !!d())() && !r.sidebarCollapsed();
121
127
  },
122
128
  get children() {
123
- var t = X();
129
+ var t = Y();
124
130
  return I(t, "click", r.toggleSidebar, !0), t;
125
131
  }
126
- }), h), n(h, l(Q, {
132
+ }), h), l(h, n(q, {
127
133
  filterInputRef: (t) => x = t
128
- }), m), n(m, l(o, {
134
+ }), m), l(m, n(o, {
129
135
  get when() {
130
136
  return r.viewMode() === "list";
131
137
  },
132
138
  get fallback() {
133
- return l(H, {});
139
+ return n(Q, {});
134
140
  },
135
141
  get children() {
136
- return l(G, {});
142
+ return n(H, {});
137
143
  }
138
- })), n(a, () => r.currentFiles().length, K), n(a, l(o, {
144
+ })), l(a, () => r.currentFiles().length, O), l(a, n(o, {
139
145
  get when() {
140
146
  return r.filterQueryApplied().trim();
141
147
  },
142
148
  get children() {
143
149
  return [" ", "(filtered)"];
144
150
  }
145
- }), null), n(a, l(o, {
151
+ }), null), l(a, n(o, {
146
152
  get when() {
147
153
  return r.selectedItems().size > 0;
148
154
  },
149
155
  get children() {
150
156
  return [" · ", g(() => r.selectedItems().size), " selected"];
151
157
  }
152
- }), null), n(P, () => r.currentPath()), n(i, l(q, {
158
+ }), null), l(P, () => r.currentPath()), l(i, n(J, {
153
159
  get callbacks() {
154
160
  return e.contextMenuCallbacks;
155
161
  },