@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.
- package/dist/components/file-browser/FileBrowserToolbar.d.ts +3 -1
- package/dist/components/file-browser/FileContextMenu.d.ts +22 -3
- package/dist/components/file-browser/index.d.ts +1 -1
- package/dist/components/file-browser/types.d.ts +12 -0
- package/dist/index38.js +62 -48
- package/dist/index39.js +99 -70
- package/dist/index41.js +145 -77
- package/dist/index42.js +121 -56
- package/dist/index43.js +54 -46
- package/dist/index45.js +91 -40
- package/dist/index55.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
/**
|
|
10
|
-
|
|
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
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { FileBrowserProvider as
|
|
5
|
-
import { DirectoryTree as
|
|
6
|
-
import { FileListView as
|
|
7
|
-
import { FileGridView as
|
|
8
|
-
import { FileBrowserToolbar as
|
|
9
|
-
import { FileContextMenu as
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
return i(
|
|
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(
|
|
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
|
|
62
|
-
const r =
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
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
|
|
76
|
+
const E = () => !r.sidebarCollapsed() || !m();
|
|
72
77
|
return (() => {
|
|
73
|
-
var
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
return n(
|
|
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 =
|
|
86
|
+
var t = G();
|
|
82
87
|
return n(t, () => e.header), t;
|
|
83
88
|
}
|
|
84
|
-
}),
|
|
89
|
+
}), s), n(l, i(a, {
|
|
85
90
|
get when() {
|
|
86
|
-
return
|
|
91
|
+
return m();
|
|
87
92
|
},
|
|
88
93
|
get children() {
|
|
89
|
-
var t =
|
|
90
|
-
return
|
|
94
|
+
var t = Q();
|
|
95
|
+
return y(t, "click", r.toggleSidebar, !0), t;
|
|
91
96
|
}
|
|
92
|
-
}), null), n(
|
|
97
|
+
}), null), n(B, i(N, {})), n(s, i(a, {
|
|
93
98
|
get when() {
|
|
94
|
-
return
|
|
99
|
+
return S(() => !!m())() && !r.sidebarCollapsed();
|
|
95
100
|
},
|
|
96
101
|
get children() {
|
|
97
|
-
var t =
|
|
98
|
-
return
|
|
102
|
+
var t = H();
|
|
103
|
+
return y(t, "click", r.toggleSidebar, !0), t;
|
|
99
104
|
}
|
|
100
|
-
}),
|
|
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(
|
|
112
|
+
return i(p, {});
|
|
106
113
|
},
|
|
107
114
|
get children() {
|
|
108
|
-
return i(
|
|
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 [" · ",
|
|
129
|
+
return [" · ", S(() => r.selectedItems().size), " selected"];
|
|
116
130
|
}
|
|
117
|
-
}), null), n(
|
|
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),
|
|
131
|
-
var
|
|
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
|
-
|
|
137
|
-
),
|
|
138
|
-
return
|
|
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
|
-
}),
|
|
158
|
+
}), o;
|
|
145
159
|
})();
|
|
146
160
|
}
|
|
147
|
-
|
|
161
|
+
j(["click"]);
|
|
148
162
|
export {
|
|
149
|
-
|
|
163
|
+
le as FileBrowser
|
|
150
164
|
};
|
package/dist/index39.js
CHANGED
|
@@ -1,116 +1,145 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { deferNonBlocking as
|
|
4
|
-
const
|
|
5
|
-
function
|
|
6
|
-
|
|
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
|
-
}), [
|
|
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
|
-
},
|
|
13
|
-
const e = /* @__PURE__ */ new Map(), t = (
|
|
14
|
-
var
|
|
15
|
-
for (const s of
|
|
16
|
-
s.type === "folder" && (e.set(
|
|
17
|
-
}, n =
|
|
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
|
-
}),
|
|
20
|
-
const e =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
43
|
+
f = s.name.localeCompare(c.name);
|
|
29
44
|
break;
|
|
30
45
|
case "size":
|
|
31
|
-
|
|
46
|
+
f = (s.size ?? 0) - (c.size ?? 0);
|
|
32
47
|
break;
|
|
33
48
|
case "modifiedAt":
|
|
34
|
-
|
|
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
|
-
|
|
52
|
+
f = (s.extension ?? "").localeCompare(c.extension ?? "");
|
|
38
53
|
break;
|
|
39
54
|
}
|
|
40
|
-
return
|
|
55
|
+
return r.direction === "asc" ? f : -f;
|
|
41
56
|
});
|
|
42
|
-
}),
|
|
43
|
-
var
|
|
44
|
-
const t =
|
|
45
|
-
|
|
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
|
-
|
|
48
|
-
},
|
|
49
|
-
const e =
|
|
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(),
|
|
53
|
-
},
|
|
54
|
-
e.type === "folder" && (
|
|
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
|
-
},
|
|
59
|
-
currentPath:
|
|
60
|
-
setCurrentPath:
|
|
61
|
-
navigateUp:
|
|
62
|
-
navigateTo:
|
|
63
|
-
selectedItems: () =>
|
|
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 =
|
|
66
|
-
t ?
|
|
67
|
-
const
|
|
68
|
-
|
|
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
|
-
|
|
86
|
+
a(/* @__PURE__ */ new Set());
|
|
72
87
|
const e = o.onSelect;
|
|
73
|
-
|
|
88
|
+
F(() => e == null ? void 0 : e([]));
|
|
74
89
|
},
|
|
75
|
-
isSelected: (e) =>
|
|
76
|
-
viewMode:
|
|
77
|
-
setViewMode:
|
|
78
|
-
sortConfig:
|
|
79
|
-
setSortConfig:
|
|
80
|
-
expandedFolders:
|
|
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
|
-
|
|
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) =>
|
|
88
|
-
files:
|
|
89
|
-
currentFiles:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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" ?
|
|
126
|
+
e.type === "folder" ? b(e) : (t = o.onOpen) == null || t.call(o, e);
|
|
98
127
|
}
|
|
99
128
|
};
|
|
100
|
-
return
|
|
101
|
-
value:
|
|
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 =
|
|
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
|
-
|
|
115
|
-
|
|
143
|
+
re as FileBrowserProvider,
|
|
144
|
+
ie as useFileBrowser
|
|
116
145
|
};
|