@floegence/floe-webapp-core 0.3.0 → 0.3.2

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,8 +1,10 @@
1
1
  import type { JSX } from 'solid-js';
2
2
  export interface FileBrowserToolbarProps {
3
3
  class?: string;
4
+ /** Reference to focus the filter input */
5
+ filterInputRef?: (el: HTMLInputElement) => void;
4
6
  }
5
7
  /**
6
- * Toolbar with navigation, breadcrumb, and view mode toggle
8
+ * Toolbar with navigation, breadcrumb, filter, and view mode toggle
7
9
  */
8
10
  export declare function FileBrowserToolbar(props: FileBrowserToolbarProps): JSX.Element;
@@ -1,4 +1,14 @@
1
- import type { ContextMenuItem, ContextMenuCallbacks } from './types';
1
+ import type { ContextMenuItem, ContextMenuCallbacks, FileItem, ContextMenuActionType } from './types';
2
+ /**
3
+ * 内置菜单项的 action type(不包含 'custom')
4
+ */
5
+ export type BuiltinContextMenuAction = Exclude<ContextMenuActionType, 'custom'>;
6
+ /**
7
+ * hideItems 支持静态数组或动态函数。
8
+ * - 静态数组:直接列出要隐藏的 action types
9
+ * - 动态函数:根据右键目标 items 动态决定要隐藏的 action types
10
+ */
11
+ export type HideItemsValue = BuiltinContextMenuAction[] | ((targetItems: FileItem[]) => BuiltinContextMenuAction[]);
2
12
  export interface FileContextMenuProps {
3
13
  /** Custom menu items to add (will be merged with defaults) */
4
14
  customItems?: ContextMenuItem[];
@@ -6,8 +16,17 @@ export interface FileContextMenuProps {
6
16
  overrideItems?: ContextMenuItem[];
7
17
  /** Callbacks for built-in actions */
8
18
  callbacks?: ContextMenuCallbacks;
9
- /** Items to hide from default menu */
10
- hideItems?: Array<'duplicate' | 'ask-agent' | 'copy-to' | 'move-to' | 'delete' | 'rename'>;
19
+ /**
20
+ * Items to hide from default menu.
21
+ * Can be a static array or a function that receives target items and returns the array.
22
+ *
23
+ * @example Static array
24
+ * hideItems={['ask-agent', 'duplicate']}
25
+ *
26
+ * @example Dynamic function (e.g., hide non-atomic operations for folders)
27
+ * hideItems={(items) => items.some(i => i.type === 'folder') ? ['duplicate', 'copy-to'] : []}
28
+ */
29
+ hideItems?: HideItemsValue;
11
30
  }
12
31
  /**
13
32
  * Context menu for file browser items
@@ -3,7 +3,7 @@ export { FileBrowserProvider, useFileBrowser, type FileBrowserProviderProps } fr
3
3
  export { DirectoryTree, type DirectoryTreeProps } from './DirectoryTree';
4
4
  export { FileListView, type FileListViewProps } from './FileListView';
5
5
  export { FileGridView, type FileGridViewProps } from './FileGridView';
6
- export { FileContextMenu, type FileContextMenuProps } from './FileContextMenu';
6
+ export { FileContextMenu, type FileContextMenuProps, type BuiltinContextMenuAction, type HideItemsValue } from './FileContextMenu';
7
7
  export { Breadcrumb, type BreadcrumbProps } from './Breadcrumb';
8
8
  export { FileBrowserToolbar, type FileBrowserToolbarProps } from './FileBrowserToolbar';
9
9
  export { FolderIcon, FolderOpenIcon, FileIcon, CodeFileIcon, ImageFileIcon, DocumentFileIcon, ConfigFileIcon, StyleFileIcon, getFileIcon, } from './FileIcons';
@@ -75,6 +75,13 @@ export interface ContextMenuCallbacks {
75
75
  onDelete?: (items: FileItem[]) => void;
76
76
  onRename?: (item: FileItem) => void;
77
77
  }
78
+ /**
79
+ * Filter match info for highlighting
80
+ */
81
+ export interface FilterMatchInfo {
82
+ /** Matched character indices in the name */
83
+ matchedIndices: number[];
84
+ }
78
85
  /**
79
86
  * File browser context value for internal state management
80
87
  */
@@ -96,6 +103,11 @@ export interface FileBrowserContextValue {
96
103
  isExpanded: (path: string) => boolean;
97
104
  files: Accessor<FileItem[]>;
98
105
  currentFiles: Accessor<FileItem[]>;
106
+ filterQuery: Accessor<string>;
107
+ setFilterQuery: (query: string) => void;
108
+ isFilterActive: Accessor<boolean>;
109
+ setFilterActive: (active: boolean) => void;
110
+ getFilterMatch: (name: string) => FilterMatchInfo | null;
99
111
  sidebarCollapsed: Accessor<boolean>;
100
112
  toggleSidebar: () => void;
101
113
  contextMenu: Accessor<ContextMenuEvent | null>;
package/dist/index38.js CHANGED
@@ -1,15 +1,15 @@
1
- import { delegateEvents as P, createComponent as i, template as b, insert as n, addEventListener as S, memo as k, effect as j, className as $, setStyleProperty as I } from "solid-js/web";
2
- import { createSignal as z, onMount as L, onCleanup as V, Show as a } from "solid-js";
3
- import { cn as _ } from "./index67.js";
4
- import { FileBrowserProvider as W, useFileBrowser as N } from "./index39.js";
5
- import { DirectoryTree as T } from "./index40.js";
6
- import { FileListView as p } from "./index41.js";
7
- import { FileGridView as q } from "./index42.js";
8
- import { FileBrowserToolbar as D } from "./index45.js";
9
- import { FileContextMenu as G } from "./index43.js";
10
- var A = /* @__PURE__ */ b('<div class="border-b border-border">'), H = /* @__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">'), J = /* @__PURE__ */ b('<div class="absolute inset-0 bg-background/60 backdrop-blur-sm z-[9]">'), K = /* @__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 ne(e) {
12
- return i(W, {
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 "./index67.js";
4
+ import { FileBrowserProvider as D, useFileBrowser as K } from "./index39.js";
5
+ import { DirectoryTree as N } from "./index40.js";
6
+ import { FileListView as T } from "./index41.js";
7
+ import { FileGridView as p } from "./index42.js";
8
+ import { FileBrowserToolbar as q } from "./index45.js";
9
+ import { FileContextMenu as A } from "./index43.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
13
  get files() {
14
14
  return e.files;
15
15
  },
@@ -29,7 +29,7 @@ function ne(e) {
29
29
  return e.onOpen;
30
30
  },
31
31
  get children() {
32
- return i(Q, {
32
+ return i(R, {
33
33
  get class() {
34
34
  return e.class;
35
35
  },
@@ -58,63 +58,77 @@ function ne(e) {
58
58
  }
59
59
  });
60
60
  }
61
- function Q(e) {
62
- const r = N(), [u, f] = z(!1), x = () => e.sidebarWidth ?? 220;
63
- L(() => {
64
- const l = window.matchMedia("(max-width: 767px)"), d = l.matches;
65
- f(d), d && e.hideSidebarOnMobile !== !1 && !r.sidebarCollapsed() && r.toggleSidebar();
66
- const o = (s) => {
67
- f(s.matches), s.matches && e.hideSidebarOnMobile !== !1 && !r.sidebarCollapsed() && r.toggleSidebar();
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();
68
69
  };
69
- l.addEventListener("change", o), V(() => l.removeEventListener("change", o));
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));
70
75
  });
71
- const y = () => !r.sidebarCollapsed() || !u();
76
+ const E = () => !r.sidebarCollapsed() || !m();
72
77
  return (() => {
73
- var l = K(), d = l.firstChild, o = d.firstChild, s = o.firstChild, h = s.firstChild;
74
- h.firstChild;
75
- var F = h.nextSibling, m = o.nextSibling, g = m.firstChild, B = g.nextSibling, c = B.firstChild, O = c.firstChild, E = c.nextSibling;
76
- return n(l, i(a, {
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, {
77
82
  get when() {
78
83
  return e.header;
79
84
  },
80
85
  get children() {
81
- var t = A();
86
+ var t = G();
82
87
  return n(t, () => e.header), t;
83
88
  }
84
- }), d), n(h, i(a, {
89
+ }), s), n(l, i(a, {
85
90
  get when() {
86
- return u();
91
+ return m();
87
92
  },
88
93
  get children() {
89
- var t = H();
90
- return S(t, "click", r.toggleSidebar, !0), t;
94
+ var t = Q();
95
+ return y(t, "click", r.toggleSidebar, !0), t;
91
96
  }
92
- }), null), n(F, i(T, {})), n(d, i(a, {
97
+ }), null), n(B, i(N, {})), n(s, i(a, {
93
98
  get when() {
94
- return k(() => !!u())() && !r.sidebarCollapsed();
99
+ return S(() => !!m())() && !r.sidebarCollapsed();
95
100
  },
96
101
  get children() {
97
- var t = J();
98
- return S(t, "click", r.toggleSidebar, !0), t;
102
+ var t = H();
103
+ return y(t, "click", r.toggleSidebar, !0), t;
99
104
  }
100
- }), m), n(m, i(D, {}), g), n(g, i(a, {
105
+ }), g), n(g, i(q, {
106
+ filterInputRef: (t) => h = t
107
+ }), f), n(f, i(a, {
101
108
  get when() {
102
109
  return r.viewMode() === "list";
103
110
  },
104
111
  get fallback() {
105
- return i(q, {});
112
+ return i(p, {});
106
113
  },
107
114
  get children() {
108
- return i(p, {});
115
+ return i(T, {});
109
116
  }
110
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, {
111
125
  get when() {
112
126
  return r.selectedItems().size > 0;
113
127
  },
114
128
  get children() {
115
- return [" · ", k(() => r.selectedItems().size), " selected"];
129
+ return [" · ", S(() => r.selectedItems().size), " selected"];
116
130
  }
117
- }), null), n(E, () => r.currentPath()), n(l, i(G, {
131
+ }), null), n(P, () => r.currentPath()), n(o, i(A, {
118
132
  get callbacks() {
119
133
  return e.contextMenuCallbacks;
120
134
  },
@@ -127,24 +141,24 @@ function Q(e) {
127
141
  get hideItems() {
128
142
  return e.hideContextMenuItems;
129
143
  }
130
- }), null), j((t) => {
131
- var v = _("flex flex-col h-full min-h-0 bg-background", "border border-border rounded-lg overflow-hidden", "shadow-sm", e.class), w = _(
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(
132
146
  "flex-shrink-0 border-r border-border bg-sidebar",
133
147
  "transition-all duration-200 ease-out",
134
148
  "overflow-hidden",
135
149
  // Mobile overlay
136
- u() && !r.sidebarCollapsed() && "absolute inset-y-0 left-0 z-10 shadow-lg"
137
- ), C = y() ? `${x()}px` : "0px", M = `${x()}px`;
138
- return v !== t.e && $(l, t.e = v), w !== t.t && $(o, t.t = w), C !== t.a && I(o, "width", t.a = C), M !== t.o && I(s, "width", t.o = M), t;
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;
139
153
  }, {
140
154
  e: void 0,
141
155
  t: void 0,
142
156
  a: void 0,
143
157
  o: void 0
144
- }), l;
158
+ }), o;
145
159
  })();
146
160
  }
147
- P(["click"]);
161
+ j(["click"]);
148
162
  export {
149
- ne as FileBrowser
163
+ le as FileBrowser
150
164
  };
package/dist/index39.js CHANGED
@@ -1,116 +1,145 @@
1
- import { createComponent as j } from "solid-js/web";
2
- import { createContext as O, createSignal as l, createMemo as P, useContext as U } from "solid-js";
3
- import { deferNonBlocking as m } from "./index68.js";
4
- const y = O();
5
- function Z(o) {
6
- const [a, B] = l(o.initialPath ?? "/"), [d, f] = l(/* @__PURE__ */ new Set()), [b, k] = l(o.initialViewMode ?? "list"), [w, p] = l({
1
+ import { createComponent as D } from "solid-js/web";
2
+ import { createContext as G, createSignal as i, createMemo as A, useContext as H } from "solid-js";
3
+ import { deferNonBlocking as F } from "./index68.js";
4
+ const Q = G();
5
+ function E(o, l) {
6
+ if (!l) return [];
7
+ const w = o.toLowerCase(), u = l.toLowerCase(), a = [];
8
+ let m = 0;
9
+ for (const g of u) {
10
+ const d = w.indexOf(g, m);
11
+ if (d === -1) return null;
12
+ a.push(d), m = d + 1;
13
+ }
14
+ return a;
15
+ }
16
+ function re(o) {
17
+ const [l, w] = i(o.initialPath ?? "/"), [u, a] = i(/* @__PURE__ */ new Set()), [m, g] = i(o.initialViewMode ?? "list"), [d, T] = i({
7
18
  field: "name",
8
19
  direction: "asc"
9
- }), [x, g] = l(/* @__PURE__ */ new Set(["/"])), [z, E] = l(!1), [A, S] = l(null), C = () => o.files, u = (e) => {
20
+ }), [y, M] = i(/* @__PURE__ */ new Set(["/"])), [V, q] = i(!1), [L, v] = i(null), [x, I] = i(""), [N, P] = i(!1), B = () => o.files, C = (e) => {
10
21
  const t = (e ?? "").trim();
11
22
  return t === "" ? "/" : t;
12
- }, T = P(() => {
13
- const e = /* @__PURE__ */ new Map(), t = (c) => {
14
- var r;
15
- for (const s of c)
16
- s.type === "folder" && (e.set(u(s.path), s.children ?? []), (r = s.children) != null && r.length && t(s.children));
17
- }, n = C();
23
+ }, O = A(() => {
24
+ const e = /* @__PURE__ */ new Map(), t = (r) => {
25
+ var h;
26
+ for (const s of r)
27
+ s.type === "folder" && (e.set(C(s.path), s.children ?? []), (h = s.children) != null && h.length && t(s.children));
28
+ }, n = B();
18
29
  return e.set("/", n), t(n), e;
19
- }), M = P(() => {
20
- const e = u(a()), t = T().get(e) ?? [], n = w();
21
- return [...t].sort((r, s) => {
22
- var F, I;
23
- if (r.type !== s.type)
24
- return r.type === "folder" ? -1 : 1;
25
- let i = 0;
26
- switch (n.field) {
30
+ }), z = A(() => {
31
+ const e = C(l());
32
+ let t = O().get(e) ?? [];
33
+ const n = x().trim();
34
+ n && (t = t.filter((s) => E(s.name, n) !== null));
35
+ const r = d();
36
+ return [...t].sort((s, c) => {
37
+ var k, p;
38
+ if (s.type !== c.type)
39
+ return s.type === "folder" ? -1 : 1;
40
+ let f = 0;
41
+ switch (r.field) {
27
42
  case "name":
28
- i = r.name.localeCompare(s.name);
43
+ f = s.name.localeCompare(c.name);
29
44
  break;
30
45
  case "size":
31
- i = (r.size ?? 0) - (s.size ?? 0);
46
+ f = (s.size ?? 0) - (c.size ?? 0);
32
47
  break;
33
48
  case "modifiedAt":
34
- i = (((F = r.modifiedAt) == null ? void 0 : F.getTime()) ?? 0) - (((I = s.modifiedAt) == null ? void 0 : I.getTime()) ?? 0);
49
+ f = (((k = s.modifiedAt) == null ? void 0 : k.getTime()) ?? 0) - (((p = c.modifiedAt) == null ? void 0 : p.getTime()) ?? 0);
35
50
  break;
36
51
  case "type":
37
- i = (r.extension ?? "").localeCompare(s.extension ?? "");
52
+ f = (s.extension ?? "").localeCompare(c.extension ?? "");
38
53
  break;
39
54
  }
40
- return n.direction === "asc" ? i : -i;
55
+ return r.direction === "asc" ? f : -f;
41
56
  });
42
- }), h = (e) => {
43
- var c;
44
- const t = u(e);
45
- B(t), f(/* @__PURE__ */ new Set());
57
+ }), S = (e) => {
58
+ var r;
59
+ const t = C(e);
60
+ w(t), a(/* @__PURE__ */ new Set()), I(""), P(!1);
46
61
  const n = o.onSelect;
47
- m(() => n == null ? void 0 : n([])), (c = o.onNavigate) == null || c.call(o, t);
48
- }, V = () => {
49
- const e = a();
62
+ F(() => n == null ? void 0 : n([])), (r = o.onNavigate) == null || r.call(o, t);
63
+ }, j = () => {
64
+ const e = l();
50
65
  if (e === "/" || e === "") return;
51
66
  const t = e.split("/").filter(Boolean);
52
- t.pop(), h(t.length ? "/" + t.join("/") : "/");
53
- }, v = (e) => {
54
- e.type === "folder" && (h(e.path), g((t) => {
67
+ t.pop(), S(t.length ? "/" + t.join("/") : "/");
68
+ }, b = (e) => {
69
+ e.type === "folder" && (S(e.path), M((t) => {
55
70
  const n = new Set(t);
56
71
  return n.add(e.path), n;
57
72
  }));
58
- }, N = {
59
- currentPath: a,
60
- setCurrentPath: h,
61
- navigateUp: V,
62
- navigateTo: v,
63
- selectedItems: () => d(),
73
+ }, U = {
74
+ currentPath: l,
75
+ setCurrentPath: S,
76
+ navigateUp: j,
77
+ navigateTo: b,
78
+ selectedItems: () => u(),
64
79
  selectItem: (e, t = !1) => {
65
- const n = d(), c = t ? new Set(n) : /* @__PURE__ */ new Set();
66
- t ? c.has(e) ? c.delete(e) : c.add(e) : (c.clear(), c.add(e)), f(c);
67
- const r = M().filter((i) => c.has(i.id)), s = o.onSelect;
68
- m(() => s == null ? void 0 : s(r));
80
+ const n = u(), r = t ? new Set(n) : /* @__PURE__ */ new Set();
81
+ t ? r.has(e) ? r.delete(e) : r.add(e) : (r.clear(), r.add(e)), a(r);
82
+ const h = z().filter((c) => r.has(c.id)), s = o.onSelect;
83
+ F(() => s == null ? void 0 : s(h));
69
84
  },
70
85
  clearSelection: () => {
71
- f(/* @__PURE__ */ new Set());
86
+ a(/* @__PURE__ */ new Set());
72
87
  const e = o.onSelect;
73
- m(() => e == null ? void 0 : e([]));
88
+ F(() => e == null ? void 0 : e([]));
74
89
  },
75
- isSelected: (e) => d().has(e),
76
- viewMode: b,
77
- setViewMode: k,
78
- sortConfig: w,
79
- setSortConfig: p,
80
- expandedFolders: x,
90
+ isSelected: (e) => u().has(e),
91
+ viewMode: m,
92
+ setViewMode: g,
93
+ sortConfig: d,
94
+ setSortConfig: T,
95
+ expandedFolders: y,
81
96
  toggleFolder: (e) => {
82
- g((t) => {
97
+ M((t) => {
83
98
  const n = new Set(t);
84
99
  return n.has(e) ? n.delete(e) : n.add(e), n;
85
100
  });
86
101
  },
87
- isExpanded: (e) => x().has(e),
88
- files: C,
89
- currentFiles: M,
90
- sidebarCollapsed: z,
91
- toggleSidebar: () => E((e) => !e),
92
- contextMenu: A,
93
- showContextMenu: (e) => S(e),
94
- hideContextMenu: () => S(null),
102
+ isExpanded: (e) => y().has(e),
103
+ files: B,
104
+ currentFiles: z,
105
+ filterQuery: x,
106
+ setFilterQuery: (e) => {
107
+ I(e);
108
+ },
109
+ isFilterActive: N,
110
+ setFilterActive: P,
111
+ getFilterMatch: (e) => {
112
+ const t = x().trim();
113
+ if (!t) return null;
114
+ const n = E(e, t);
115
+ return n ? {
116
+ matchedIndices: n
117
+ } : null;
118
+ },
119
+ sidebarCollapsed: V,
120
+ toggleSidebar: () => q((e) => !e),
121
+ contextMenu: L,
122
+ showContextMenu: (e) => v(e),
123
+ hideContextMenu: () => v(null),
95
124
  openItem: (e) => {
96
125
  var t;
97
- e.type === "folder" ? v(e) : (t = o.onOpen) == null || t.call(o, e);
126
+ e.type === "folder" ? b(e) : (t = o.onOpen) == null || t.call(o, e);
98
127
  }
99
128
  };
100
- return j(y.Provider, {
101
- value: N,
129
+ return D(Q.Provider, {
130
+ value: U,
102
131
  get children() {
103
132
  return o.children;
104
133
  }
105
134
  });
106
135
  }
107
- function _() {
108
- const o = U(y);
136
+ function ie() {
137
+ const o = H(Q);
109
138
  if (!o)
110
139
  throw new Error("useFileBrowser must be used within a FileBrowserProvider");
111
140
  return o;
112
141
  }
113
142
  export {
114
- Z as FileBrowserProvider,
115
- _ as useFileBrowser
143
+ re as FileBrowserProvider,
144
+ ie as useFileBrowser
116
145
  };