@floegence/floe-webapp-core 0.8.2 → 0.8.4
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/FileBrowser.d.ts +3 -1
- package/dist/components/file-browser/FileBrowserContext.d.ts +3 -1
- package/dist/components/file-browser/index.d.ts +1 -1
- package/dist/components/file-browser/types.d.ts +11 -0
- package/dist/index40.js +14 -11
- package/dist/index41.js +174 -152
- package/dist/index42.js +17 -17
- package/dist/index43.js +263 -121
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
2
|
import { type FileContextMenuProps } from './FileContextMenu';
|
|
3
|
-
import type { FileItem, ViewMode, ContextMenuCallbacks, ContextMenuItem } from './types';
|
|
3
|
+
import type { FileItem, ViewMode, ContextMenuCallbacks, ContextMenuItem, FileListColumnRatios } from './types';
|
|
4
4
|
export interface FileBrowserProps {
|
|
5
5
|
/** File tree data */
|
|
6
6
|
files: FileItem[];
|
|
@@ -8,6 +8,8 @@ export interface FileBrowserProps {
|
|
|
8
8
|
initialPath?: string;
|
|
9
9
|
/** Initial view mode */
|
|
10
10
|
initialViewMode?: ViewMode;
|
|
11
|
+
/** Initial list view column ratios (for resizable columns) */
|
|
12
|
+
initialListColumnRatios?: FileListColumnRatios;
|
|
11
13
|
/** Callback when navigation occurs */
|
|
12
14
|
onNavigate?: (path: string) => void;
|
|
13
15
|
/** Callback when selection changes */
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
|
-
import type { FileItem, ViewMode, FileBrowserContextValue } from './types';
|
|
2
|
+
import type { FileItem, ViewMode, FileListColumnRatios, FileBrowserContextValue } from './types';
|
|
3
3
|
export interface FileBrowserProviderProps {
|
|
4
4
|
children: JSX.Element;
|
|
5
5
|
files: FileItem[];
|
|
6
6
|
initialPath?: string;
|
|
7
7
|
initialViewMode?: ViewMode;
|
|
8
|
+
/** Initial list view column ratios (for resizable columns) */
|
|
9
|
+
initialListColumnRatios?: FileListColumnRatios;
|
|
8
10
|
/** Label for the root/home directory in breadcrumb (default: 'Root') */
|
|
9
11
|
homeLabel?: string;
|
|
10
12
|
onNavigate?: (path: string) => void;
|
|
@@ -7,4 +7,4 @@ export { FileContextMenu, type FileContextMenuProps, type BuiltinContextMenuActi
|
|
|
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';
|
|
10
|
-
export type { FileItem, ViewMode, SortField, SortDirection, SortConfig, FileBrowserContextValue, ContextMenuActionType, ContextMenuItem, ContextMenuEvent, ContextMenuCallbacks, OptimisticUpdateType, OptimisticRemove, OptimisticUpdate, OptimisticInsert, OptimisticOperation, ScrollPosition, } from './types';
|
|
10
|
+
export type { FileItem, ViewMode, SortField, SortDirection, SortConfig, FileListColumnRatios, FileBrowserContextValue, ContextMenuActionType, ContextMenuItem, ContextMenuEvent, ContextMenuCallbacks, OptimisticUpdateType, OptimisticRemove, OptimisticUpdate, OptimisticInsert, OptimisticOperation, ScrollPosition, } from './types';
|
|
@@ -26,6 +26,15 @@ export interface SortConfig {
|
|
|
26
26
|
field: SortField;
|
|
27
27
|
direction: SortDirection;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* List view column width ratios (sum to ~1.0).
|
|
31
|
+
* Used for user-adjustable column resizing and persistence.
|
|
32
|
+
*/
|
|
33
|
+
export interface FileListColumnRatios {
|
|
34
|
+
name: number;
|
|
35
|
+
modifiedAt: number;
|
|
36
|
+
size: number;
|
|
37
|
+
}
|
|
29
38
|
/**
|
|
30
39
|
* Built-in context menu action types
|
|
31
40
|
*/
|
|
@@ -142,6 +151,8 @@ export interface FileBrowserContextValue {
|
|
|
142
151
|
setViewMode: (mode: ViewMode) => void;
|
|
143
152
|
sortConfig: Accessor<SortConfig>;
|
|
144
153
|
setSortConfig: (config: SortConfig) => void;
|
|
154
|
+
listColumnRatios: Accessor<FileListColumnRatios>;
|
|
155
|
+
setListColumnRatios: (ratios: FileListColumnRatios) => void;
|
|
145
156
|
expandedFolders: Accessor<Set<string>>;
|
|
146
157
|
toggleFolder: (path: string) => void;
|
|
147
158
|
isExpanded: (path: string) => boolean;
|
package/dist/index40.js
CHANGED
|
@@ -4,10 +4,10 @@ import { cn as F } from "./index69.js";
|
|
|
4
4
|
import { FileBrowserProvider as D, useFileBrowser as K } from "./index41.js";
|
|
5
5
|
import { DirectoryTree as N } from "./index42.js";
|
|
6
6
|
import { FileListView as T } from "./index43.js";
|
|
7
|
-
import { FileGridView as
|
|
7
|
+
import { FileGridView as R } from "./index44.js";
|
|
8
8
|
import { FileBrowserToolbar as q } from "./index47.js";
|
|
9
9
|
import { FileContextMenu as A } from "./index45.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">'),
|
|
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">'), p = /* @__PURE__ */ b('<div class="absolute inset-0 bg-background/60 backdrop-blur-sm z-[9]">'), H = /* @__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
11
|
function le(e) {
|
|
12
12
|
return i(D, {
|
|
13
13
|
get files() {
|
|
@@ -19,6 +19,9 @@ function le(e) {
|
|
|
19
19
|
get initialViewMode() {
|
|
20
20
|
return e.initialViewMode;
|
|
21
21
|
},
|
|
22
|
+
get initialListColumnRatios() {
|
|
23
|
+
return e.initialListColumnRatios;
|
|
24
|
+
},
|
|
22
25
|
get onNavigate() {
|
|
23
26
|
return e.onNavigate;
|
|
24
27
|
},
|
|
@@ -29,7 +32,7 @@ function le(e) {
|
|
|
29
32
|
return e.onOpen;
|
|
30
33
|
},
|
|
31
34
|
get children() {
|
|
32
|
-
return i(
|
|
35
|
+
return i(J, {
|
|
33
36
|
get class() {
|
|
34
37
|
return e.class;
|
|
35
38
|
},
|
|
@@ -58,7 +61,7 @@ function le(e) {
|
|
|
58
61
|
}
|
|
59
62
|
});
|
|
60
63
|
}
|
|
61
|
-
function
|
|
64
|
+
function J(e) {
|
|
62
65
|
const r = K(), [m, v] = V(!1), x = () => e.sidebarWidth ?? 220;
|
|
63
66
|
let h;
|
|
64
67
|
W(() => {
|
|
@@ -73,11 +76,11 @@ function R(e) {
|
|
|
73
76
|
};
|
|
74
77
|
document.addEventListener("keydown", u), _(() => document.removeEventListener("keydown", u));
|
|
75
78
|
});
|
|
76
|
-
const
|
|
79
|
+
const L = () => !r.sidebarCollapsed() || !m();
|
|
77
80
|
return (() => {
|
|
78
|
-
var o =
|
|
81
|
+
var o = H(), s = o.firstChild, d = s.firstChild, u = d.firstChild, l = u.firstChild;
|
|
79
82
|
l.firstChild;
|
|
80
|
-
var
|
|
83
|
+
var E = l.nextSibling, g = d.nextSibling, f = g.firstChild, B = f.nextSibling, c = B.firstChild, O = c.firstChild, P = c.nextSibling;
|
|
81
84
|
return n(o, i(a, {
|
|
82
85
|
get when() {
|
|
83
86
|
return e.header;
|
|
@@ -94,12 +97,12 @@ function R(e) {
|
|
|
94
97
|
var t = Q();
|
|
95
98
|
return y(t, "click", r.toggleSidebar, !0), t;
|
|
96
99
|
}
|
|
97
|
-
}), null), n(
|
|
100
|
+
}), null), n(E, i(N, {})), n(s, i(a, {
|
|
98
101
|
get when() {
|
|
99
102
|
return S(() => !!m())() && !r.sidebarCollapsed();
|
|
100
103
|
},
|
|
101
104
|
get children() {
|
|
102
|
-
var t =
|
|
105
|
+
var t = p();
|
|
103
106
|
return y(t, "click", r.toggleSidebar, !0), t;
|
|
104
107
|
}
|
|
105
108
|
}), g), n(g, i(q, {
|
|
@@ -109,7 +112,7 @@ function R(e) {
|
|
|
109
112
|
return r.viewMode() === "list";
|
|
110
113
|
},
|
|
111
114
|
get fallback() {
|
|
112
|
-
return i(
|
|
115
|
+
return i(R, {});
|
|
113
116
|
},
|
|
114
117
|
get children() {
|
|
115
118
|
return i(T, {});
|
|
@@ -148,7 +151,7 @@ function R(e) {
|
|
|
148
151
|
"overflow-hidden",
|
|
149
152
|
// Mobile overlay
|
|
150
153
|
m() && !r.sidebarCollapsed() && "absolute inset-y-0 left-0 z-10 shadow-lg"
|
|
151
|
-
), M =
|
|
154
|
+
), M = L() ? `${x()}px` : "0px", k = `${x()}px`;
|
|
152
155
|
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
156
|
}, {
|
|
154
157
|
e: void 0,
|
package/dist/index41.js
CHANGED
|
@@ -1,237 +1,259 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { createComponent as Fe } from "solid-js/web";
|
|
2
|
+
import { createContext as ye, createSignal as a, createEffect as Ae, createMemo as q, useContext as Ie } from "solid-js";
|
|
3
|
+
import { useResolvedFloeConfig as Me } from "./index53.js";
|
|
4
|
+
import { deferNonBlocking as A } from "./index70.js";
|
|
5
|
+
const D = ye(), g = {
|
|
6
|
+
name: 0.65,
|
|
7
|
+
modifiedAt: 0.2,
|
|
8
|
+
size: 0.15
|
|
9
|
+
}, Q = "fileBrowser:listColumnRatios";
|
|
10
|
+
function V(s) {
|
|
11
|
+
const w = Number.isFinite(s.name) ? s.name : g.name, r = Number.isFinite(s.modifiedAt) ? s.modifiedAt : g.modifiedAt, h = Number.isFinite(s.size) ? s.size : g.size, S = Math.max(0, w), f = Math.max(0, r), p = Math.max(0, h), d = S + f + p;
|
|
12
|
+
return d <= 0 ? g : {
|
|
13
|
+
name: S / d,
|
|
14
|
+
modifiedAt: f / d,
|
|
15
|
+
size: p / d
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function j(s, w) {
|
|
19
|
+
if (!w) return [];
|
|
20
|
+
const r = s.toLowerCase(), h = w.toLowerCase(), S = [];
|
|
21
|
+
let f = 0;
|
|
22
|
+
for (const p of h) {
|
|
23
|
+
const d = r.indexOf(p, f);
|
|
24
|
+
if (d === -1) return null;
|
|
25
|
+
S.push(d), f = d + 1;
|
|
13
26
|
}
|
|
14
|
-
return
|
|
27
|
+
return S;
|
|
15
28
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
29
|
+
function ke(s) {
|
|
30
|
+
const w = Me(), r = (e) => {
|
|
31
|
+
const t = (e ?? "").trim();
|
|
32
|
+
return t === "" ? "/" : t;
|
|
33
|
+
}, [h, S] = a(r(s.initialPath ?? "/")), [f, p] = a(/* @__PURE__ */ new Set()), [d, G] = a(s.initialViewMode ?? "list"), [I, K] = a({
|
|
18
34
|
field: "name",
|
|
19
35
|
direction: "asc"
|
|
20
|
-
}), [M,
|
|
21
|
-
|
|
36
|
+
}), Y = V(w.persist.load(Q, s.initialListColumnRatios ?? g)), [M, H] = a(Y), [L, z] = a(/* @__PURE__ */ new Set(["/"])), [J, W] = a(!1), [X, O] = a(null), [P, b] = a(""), [Z, R] = a(!1);
|
|
37
|
+
Ae(() => {
|
|
38
|
+
w.persist.debouncedSave(Q, M());
|
|
39
|
+
});
|
|
40
|
+
const $ = () => s.homeLabel ?? "Root", [T, x] = a([]);
|
|
41
|
+
let C = null, v = {
|
|
22
42
|
top: 0,
|
|
23
43
|
left: 0
|
|
24
44
|
};
|
|
25
|
-
const
|
|
26
|
-
const t = (e
|
|
27
|
-
return t === "" ? "/" : t;
|
|
28
|
-
}, L = (e) => {
|
|
29
|
-
const t = c(e);
|
|
45
|
+
const k = () => s.files, B = (e) => {
|
|
46
|
+
const t = r(e);
|
|
30
47
|
if (t === "/") return "/";
|
|
31
48
|
const n = t.split("/").filter(Boolean);
|
|
32
49
|
return n.pop(), n.length ? "/" + n.join("/") : "/";
|
|
33
|
-
},
|
|
34
|
-
const n =
|
|
50
|
+
}, ee = (e, t) => {
|
|
51
|
+
const n = T();
|
|
35
52
|
if (n.length === 0) return e;
|
|
36
|
-
let
|
|
37
|
-
const
|
|
53
|
+
let i = [...e];
|
|
54
|
+
const u = r(t);
|
|
38
55
|
for (const o of n)
|
|
39
56
|
switch (o.type) {
|
|
40
57
|
case "remove": {
|
|
41
|
-
const l = new Set(o.paths.map(
|
|
42
|
-
|
|
58
|
+
const l = new Set(o.paths.map(r));
|
|
59
|
+
i = i.filter((c) => !l.has(r(c.path)));
|
|
43
60
|
break;
|
|
44
61
|
}
|
|
45
62
|
case "update": {
|
|
46
|
-
const l =
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
...
|
|
63
|
+
const l = r(o.oldPath), c = i.findIndex((m) => r(m.path) === l);
|
|
64
|
+
if (c !== -1) {
|
|
65
|
+
const m = o.updates.path ?? i[c].path;
|
|
66
|
+
B(m) === u ? i[c] = {
|
|
67
|
+
...i[c],
|
|
51
68
|
...o.updates
|
|
52
|
-
} :
|
|
69
|
+
} : i.splice(c, 1);
|
|
53
70
|
} else {
|
|
54
|
-
const
|
|
55
|
-
|
|
71
|
+
const m = o.updates.path;
|
|
72
|
+
m && B(m);
|
|
56
73
|
}
|
|
57
74
|
break;
|
|
58
75
|
}
|
|
59
76
|
case "insert": {
|
|
60
|
-
|
|
77
|
+
r(o.parentPath) === u && (i.some((c) => r(c.path) === r(o.item.path)) || i.push(o.item));
|
|
61
78
|
break;
|
|
62
79
|
}
|
|
63
80
|
}
|
|
64
|
-
return
|
|
65
|
-
},
|
|
66
|
-
const e = /* @__PURE__ */ new Map(), t = (
|
|
67
|
-
var
|
|
68
|
-
for (const o of
|
|
69
|
-
o.type === "folder" && (e.set(
|
|
70
|
-
}, n =
|
|
81
|
+
return i;
|
|
82
|
+
}, te = q(() => {
|
|
83
|
+
const e = /* @__PURE__ */ new Map(), t = (i) => {
|
|
84
|
+
var u;
|
|
85
|
+
for (const o of i)
|
|
86
|
+
o.type === "folder" && (e.set(r(o.path), o.children ?? []), (u = o.children) != null && u.length && t(o.children));
|
|
87
|
+
}, n = k();
|
|
71
88
|
return e.set("/", n), t(n), e;
|
|
72
|
-
}),
|
|
73
|
-
const e =
|
|
74
|
-
let t =
|
|
75
|
-
t =
|
|
76
|
-
const n =
|
|
77
|
-
n && (t = t.filter((o) =>
|
|
78
|
-
const
|
|
89
|
+
}), N = q(() => {
|
|
90
|
+
const e = r(h());
|
|
91
|
+
let t = te().get(e) ?? [];
|
|
92
|
+
t = ee(t, e);
|
|
93
|
+
const n = P().trim();
|
|
94
|
+
n && (t = t.filter((o) => j(o.name, n) !== null));
|
|
95
|
+
const i = I();
|
|
79
96
|
return [...t].sort((o, l) => {
|
|
80
|
-
var
|
|
97
|
+
var m, y;
|
|
81
98
|
if (o.type !== l.type)
|
|
82
99
|
return o.type === "folder" ? -1 : 1;
|
|
83
|
-
let
|
|
84
|
-
switch (
|
|
100
|
+
let c = 0;
|
|
101
|
+
switch (i.field) {
|
|
85
102
|
case "name":
|
|
86
|
-
|
|
103
|
+
c = o.name.localeCompare(l.name);
|
|
87
104
|
break;
|
|
88
105
|
case "size":
|
|
89
|
-
|
|
106
|
+
c = (o.size ?? 0) - (l.size ?? 0);
|
|
90
107
|
break;
|
|
91
108
|
case "modifiedAt":
|
|
92
|
-
|
|
109
|
+
c = (((m = o.modifiedAt) == null ? void 0 : m.getTime()) ?? 0) - (((y = l.modifiedAt) == null ? void 0 : y.getTime()) ?? 0);
|
|
93
110
|
break;
|
|
94
111
|
case "type":
|
|
95
|
-
|
|
112
|
+
c = (o.extension ?? "").localeCompare(l.extension ?? "");
|
|
96
113
|
break;
|
|
97
114
|
}
|
|
98
|
-
return
|
|
115
|
+
return i.direction === "asc" ? c : -c;
|
|
99
116
|
});
|
|
100
|
-
}),
|
|
101
|
-
var
|
|
102
|
-
const t =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
}), F = (e) => {
|
|
118
|
+
var i;
|
|
119
|
+
const t = r(e);
|
|
120
|
+
if (t === h()) return;
|
|
121
|
+
S(t), p(/* @__PURE__ */ new Set()), b(""), R(!1);
|
|
122
|
+
const n = s.onSelect;
|
|
123
|
+
A(() => n == null ? void 0 : n([])), (i = s.onNavigate) == null || i.call(s, t);
|
|
124
|
+
}, ne = (e) => {
|
|
125
|
+
H(V(e));
|
|
126
|
+
}, oe = () => {
|
|
107
127
|
const e = h();
|
|
108
128
|
if (e === "/" || e === "") return;
|
|
109
129
|
const t = e.split("/").filter(Boolean);
|
|
110
|
-
t.pop(),
|
|
111
|
-
},
|
|
112
|
-
e.type === "folder" && (
|
|
130
|
+
t.pop(), F(t.length ? "/" + t.join("/") : "/");
|
|
131
|
+
}, E = (e) => {
|
|
132
|
+
e.type === "folder" && (F(e.path), z((t) => {
|
|
113
133
|
const n = new Set(t);
|
|
114
134
|
return n.add(e.path), n;
|
|
115
135
|
}));
|
|
116
|
-
},
|
|
117
|
-
const n =
|
|
118
|
-
t ?
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
},
|
|
136
|
+
}, se = (e, t = !1) => {
|
|
137
|
+
const n = f(), i = t ? new Set(n) : /* @__PURE__ */ new Set();
|
|
138
|
+
t ? i.has(e) ? i.delete(e) : i.add(e) : (i.clear(), i.add(e)), p(i);
|
|
139
|
+
const u = N().filter((l) => i.has(l.id)), o = s.onSelect;
|
|
140
|
+
A(() => o == null ? void 0 : o(u));
|
|
141
|
+
}, ie = () => {
|
|
122
142
|
p(/* @__PURE__ */ new Set());
|
|
123
|
-
const e =
|
|
124
|
-
|
|
125
|
-
},
|
|
126
|
-
|
|
143
|
+
const e = s.onSelect;
|
|
144
|
+
A(() => e == null ? void 0 : e([]));
|
|
145
|
+
}, re = (e) => f().has(e), ce = (e) => {
|
|
146
|
+
z((t) => {
|
|
127
147
|
const n = new Set(t);
|
|
128
148
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
129
149
|
});
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
const t =
|
|
150
|
+
}, le = (e) => L().has(e), ae = () => W((e) => !e), de = (e) => O(e), fe = () => O(null), ue = (e) => {
|
|
151
|
+
b(e);
|
|
152
|
+
}, me = (e) => {
|
|
153
|
+
const t = P().trim();
|
|
134
154
|
if (!t) return null;
|
|
135
|
-
const n =
|
|
155
|
+
const n = j(e, t);
|
|
136
156
|
return n ? {
|
|
137
157
|
matchedIndices: n
|
|
138
158
|
} : null;
|
|
139
|
-
},
|
|
159
|
+
}, he = (e) => {
|
|
140
160
|
var t;
|
|
141
|
-
e.type === "folder" ?
|
|
142
|
-
},
|
|
143
|
-
e.length !== 0 &&
|
|
161
|
+
e.type === "folder" ? E(e) : (t = s.onOpen) == null || t.call(s, e);
|
|
162
|
+
}, pe = (e) => {
|
|
163
|
+
e.length !== 0 && x((t) => [...t, {
|
|
144
164
|
type: "remove",
|
|
145
165
|
paths: e
|
|
146
166
|
}]);
|
|
147
|
-
},
|
|
148
|
-
|
|
167
|
+
}, we = (e, t) => {
|
|
168
|
+
x((n) => [...n, {
|
|
149
169
|
type: "update",
|
|
150
170
|
oldPath: e,
|
|
151
171
|
updates: t
|
|
152
172
|
}]);
|
|
153
|
-
},
|
|
154
|
-
|
|
173
|
+
}, Se = (e, t) => {
|
|
174
|
+
x((n) => [...n, {
|
|
155
175
|
type: "insert",
|
|
156
176
|
parentPath: e,
|
|
157
177
|
item: t
|
|
158
178
|
}]);
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
},
|
|
166
|
-
top:
|
|
167
|
-
left:
|
|
179
|
+
}, Ce = () => {
|
|
180
|
+
x([]);
|
|
181
|
+
}, xe = () => {
|
|
182
|
+
x([]);
|
|
183
|
+
}, ge = () => T().length > 0, Pe = (e) => {
|
|
184
|
+
C = e;
|
|
185
|
+
}, U = () => C ? {
|
|
186
|
+
top: C.scrollTop,
|
|
187
|
+
left: C.scrollLeft
|
|
168
188
|
} : {
|
|
169
189
|
top: 0,
|
|
170
190
|
left: 0
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
},
|
|
191
|
+
}, _ = (e) => {
|
|
192
|
+
C && (C.scrollTop = e.top, C.scrollLeft = e.left);
|
|
193
|
+
}, ve = {
|
|
174
194
|
currentPath: h,
|
|
175
|
-
setCurrentPath:
|
|
176
|
-
navigateUp:
|
|
177
|
-
navigateTo:
|
|
178
|
-
homeLabel:
|
|
179
|
-
selectedItems: () =>
|
|
180
|
-
selectItem:
|
|
181
|
-
clearSelection:
|
|
182
|
-
isSelected:
|
|
183
|
-
viewMode:
|
|
184
|
-
setViewMode:
|
|
185
|
-
sortConfig:
|
|
186
|
-
setSortConfig:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
195
|
+
setCurrentPath: F,
|
|
196
|
+
navigateUp: oe,
|
|
197
|
+
navigateTo: E,
|
|
198
|
+
homeLabel: $,
|
|
199
|
+
selectedItems: () => f(),
|
|
200
|
+
selectItem: se,
|
|
201
|
+
clearSelection: ie,
|
|
202
|
+
isSelected: re,
|
|
203
|
+
viewMode: d,
|
|
204
|
+
setViewMode: G,
|
|
205
|
+
sortConfig: I,
|
|
206
|
+
setSortConfig: K,
|
|
207
|
+
listColumnRatios: M,
|
|
208
|
+
setListColumnRatios: ne,
|
|
209
|
+
expandedFolders: L,
|
|
210
|
+
toggleFolder: ce,
|
|
211
|
+
isExpanded: le,
|
|
212
|
+
files: k,
|
|
213
|
+
currentFiles: N,
|
|
214
|
+
filterQuery: P,
|
|
215
|
+
setFilterQuery: ue,
|
|
216
|
+
isFilterActive: Z,
|
|
217
|
+
setFilterActive: R,
|
|
218
|
+
getFilterMatch: me,
|
|
219
|
+
sidebarCollapsed: J,
|
|
220
|
+
toggleSidebar: ae,
|
|
221
|
+
contextMenu: X,
|
|
222
|
+
showContextMenu: de,
|
|
223
|
+
hideContextMenu: fe,
|
|
224
|
+
openItem: he,
|
|
203
225
|
// Optimistic updates
|
|
204
|
-
optimisticRemove:
|
|
205
|
-
optimisticUpdate:
|
|
206
|
-
optimisticInsert:
|
|
207
|
-
clearOptimisticUpdates:
|
|
208
|
-
rollbackOptimisticUpdates:
|
|
209
|
-
hasOptimisticUpdates:
|
|
226
|
+
optimisticRemove: pe,
|
|
227
|
+
optimisticUpdate: we,
|
|
228
|
+
optimisticInsert: Se,
|
|
229
|
+
clearOptimisticUpdates: Ce,
|
|
230
|
+
rollbackOptimisticUpdates: xe,
|
|
231
|
+
hasOptimisticUpdates: ge,
|
|
210
232
|
// Scroll position management
|
|
211
|
-
setScrollContainer:
|
|
212
|
-
getScrollPosition:
|
|
213
|
-
setScrollPosition:
|
|
214
|
-
saveScrollPosition: () => (
|
|
233
|
+
setScrollContainer: Pe,
|
|
234
|
+
getScrollPosition: U,
|
|
235
|
+
setScrollPosition: _,
|
|
236
|
+
saveScrollPosition: () => (v = U(), v),
|
|
215
237
|
restoreScrollPosition: () => {
|
|
216
238
|
requestAnimationFrame(() => {
|
|
217
|
-
|
|
239
|
+
_(v);
|
|
218
240
|
});
|
|
219
241
|
}
|
|
220
242
|
};
|
|
221
|
-
return
|
|
222
|
-
value:
|
|
243
|
+
return Fe(D.Provider, {
|
|
244
|
+
value: ve,
|
|
223
245
|
get children() {
|
|
224
|
-
return
|
|
246
|
+
return s.children;
|
|
225
247
|
}
|
|
226
248
|
});
|
|
227
249
|
}
|
|
228
|
-
function
|
|
229
|
-
const
|
|
230
|
-
if (!
|
|
250
|
+
function Be() {
|
|
251
|
+
const s = Ie(D);
|
|
252
|
+
if (!s)
|
|
231
253
|
throw new Error("useFileBrowser must be used within a FileBrowserProvider");
|
|
232
|
-
return
|
|
254
|
+
return s;
|
|
233
255
|
}
|
|
234
256
|
export {
|
|
235
|
-
|
|
236
|
-
|
|
257
|
+
ke as FileBrowserProvider,
|
|
258
|
+
Be as useFileBrowser
|
|
237
259
|
};
|