@aiquants/directory-tree 3.2.0 → 3.4.0
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/DirectoryTree.d.ts +24 -0
- package/dist/DirectoryTree.d.ts.map +1 -0
- package/dist/DirectoryTreeGrid.d.ts +67 -0
- package/dist/DirectoryTreeGrid.d.ts.map +1 -0
- package/dist/TreeLine.d.ts +9 -0
- package/dist/TreeLine.d.ts.map +1 -0
- package/dist/cli.server.d.ts +2 -0
- package/dist/cli.server.d.ts.map +1 -0
- package/dist/entryRendering.d.ts +55 -0
- package/dist/entryRendering.d.ts.map +1 -0
- package/dist/gridUtils.d.ts +47 -0
- package/dist/gridUtils.d.ts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +807 -799
- package/dist/logger.d.ts +98 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/scrollAnchor.d.ts +39 -0
- package/dist/scrollAnchor.d.ts.map +1 -0
- package/dist/src/DirectoryTree.d.ts.map +1 -1
- package/dist/src/entryRendering.d.ts +0 -5
- package/dist/src/entryRendering.d.ts.map +1 -1
- package/dist/src/types.d.ts +0 -11
- package/dist/src/types.d.ts.map +1 -1
- package/dist/styles/directory-tree.standalone.css +1 -1
- package/dist/types.d.ts +645 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/useDirectoryTreeState.d.ts +15 -0
- package/dist/useDirectoryTreeState.d.ts.map +1 -0
- package/dist/useEntryInteraction.d.ts +20 -0
- package/dist/useEntryInteraction.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/DirectoryTree.spec.md +51 -2
- package/src/DirectoryTree.tsx +36 -11
- package/src/DirectoryTreeGrid.tsx +6 -3
- package/src/entryRendering.tsx +20 -61
- package/src/index.ts +1 -0
- package/src/types.ts +49 -4
package/dist/index.js
CHANGED
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { VirtualScroll as
|
|
1
|
+
import tr, { useRef as ce, useEffect as de, useCallback as B, memo as ze, useState as ne, useMemo as q, useLayoutEffect as rr, Fragment as nr, useTransition as sr } from "react";
|
|
2
|
+
import { VirtualScroll as ar, ScrollBar as or } from "@aiquants/virtualscroll";
|
|
3
3
|
import { twMerge as M } from "tailwind-merge";
|
|
4
|
-
import { FolderIcon as
|
|
5
|
-
import { FileMd as
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
if (
|
|
10
|
-
|
|
4
|
+
import { FolderIcon as lr, ChevronDownIcon as ir, ChevronRightIcon as cr } from "@heroicons/react/24/solid";
|
|
5
|
+
import { FileMd as bt, FilePdf as gt, FileXls as wt, FileCsv as kt, FileDoc as Nt, FilePpt as Et, FileImage as It, FileAudio as St, FileVideo as jt, FileZip as Tt, FileCode as Rt, FileText as Ct, FileIcon as dr } from "@phosphor-icons/react";
|
|
6
|
+
var Me = { exports: {} }, Ie = {};
|
|
7
|
+
var Pt;
|
|
8
|
+
function ur() {
|
|
9
|
+
if (Pt) return Ie;
|
|
10
|
+
Pt = 1;
|
|
11
11
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
12
|
-
function a(
|
|
12
|
+
function a(s, r, o) {
|
|
13
13
|
var l = null;
|
|
14
14
|
if (o !== void 0 && (l = "" + o), r.key !== void 0 && (l = "" + r.key), "key" in r) {
|
|
15
15
|
o = {};
|
|
16
|
-
for (var
|
|
17
|
-
|
|
16
|
+
for (var u in r)
|
|
17
|
+
u !== "key" && (o[u] = r[u]);
|
|
18
18
|
} else o = r;
|
|
19
19
|
return r = o.ref, {
|
|
20
20
|
$$typeof: e,
|
|
21
|
-
type:
|
|
21
|
+
type: s,
|
|
22
22
|
key: l,
|
|
23
23
|
ref: r !== void 0 ? r : null,
|
|
24
24
|
props: o
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return Ie.Fragment = t, Ie.jsx = a, Ie.jsxs = a, Ie;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
return
|
|
33
|
-
function e(
|
|
34
|
-
if (
|
|
35
|
-
if (typeof
|
|
36
|
-
return
|
|
37
|
-
if (typeof
|
|
38
|
-
switch (
|
|
29
|
+
var Se = {};
|
|
30
|
+
var _t;
|
|
31
|
+
function mr() {
|
|
32
|
+
return _t || (_t = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
33
|
+
function e(n) {
|
|
34
|
+
if (n == null) return null;
|
|
35
|
+
if (typeof n == "function")
|
|
36
|
+
return n.$$typeof === Y ? null : n.displayName || n.name || null;
|
|
37
|
+
if (typeof n == "string") return n;
|
|
38
|
+
switch (n) {
|
|
39
39
|
case f:
|
|
40
40
|
return "Fragment";
|
|
41
|
-
case
|
|
41
|
+
case D:
|
|
42
42
|
return "Profiler";
|
|
43
43
|
case v:
|
|
44
44
|
return "StrictMode";
|
|
45
|
-
case
|
|
45
|
+
case j:
|
|
46
46
|
return "Suspense";
|
|
47
|
-
case
|
|
47
|
+
case T:
|
|
48
48
|
return "SuspenseList";
|
|
49
|
-
case
|
|
49
|
+
case P:
|
|
50
50
|
return "Activity";
|
|
51
51
|
}
|
|
52
|
-
if (typeof
|
|
53
|
-
switch (typeof
|
|
52
|
+
if (typeof n == "object")
|
|
53
|
+
switch (typeof n.tag == "number" && console.error(
|
|
54
54
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
55
|
-
),
|
|
56
|
-
case
|
|
55
|
+
), n.$$typeof) {
|
|
56
|
+
case m:
|
|
57
57
|
return "Portal";
|
|
58
|
+
case b:
|
|
59
|
+
return n.displayName || "Context";
|
|
58
60
|
case N:
|
|
59
|
-
return
|
|
60
|
-
case
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return
|
|
65
|
-
case
|
|
66
|
-
|
|
67
|
-
case I:
|
|
68
|
-
y = s._payload, s = s._init;
|
|
61
|
+
return (n._context.displayName || "Context") + ".Consumer";
|
|
62
|
+
case h:
|
|
63
|
+
var p = n.render;
|
|
64
|
+
return n = n.displayName, n || (n = p.displayName || p.name || "", n = n !== "" ? "ForwardRef(" + n + ")" : "ForwardRef"), n;
|
|
65
|
+
case L:
|
|
66
|
+
return p = n.displayName || null, p !== null ? p : e(n.type) || "Memo";
|
|
67
|
+
case U:
|
|
68
|
+
p = n._payload, n = n._init;
|
|
69
69
|
try {
|
|
70
|
-
return e(
|
|
70
|
+
return e(n(p));
|
|
71
71
|
} catch {
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
-
function t(
|
|
77
|
-
return "" +
|
|
76
|
+
function t(n) {
|
|
77
|
+
return "" + n;
|
|
78
78
|
}
|
|
79
|
-
function a(
|
|
79
|
+
function a(n) {
|
|
80
80
|
try {
|
|
81
|
-
t(
|
|
82
|
-
var
|
|
81
|
+
t(n);
|
|
82
|
+
var p = !1;
|
|
83
83
|
} catch {
|
|
84
|
-
|
|
84
|
+
p = !0;
|
|
85
85
|
}
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
var
|
|
89
|
-
return
|
|
90
|
-
|
|
86
|
+
if (p) {
|
|
87
|
+
p = console;
|
|
88
|
+
var I = p.error, _ = typeof Symbol == "function" && Symbol.toStringTag && n[Symbol.toStringTag] || n.constructor.name || "Object";
|
|
89
|
+
return I.call(
|
|
90
|
+
p,
|
|
91
91
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
92
92
|
_
|
|
93
|
-
), t(
|
|
93
|
+
), t(n);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
function n
|
|
97
|
-
if (
|
|
98
|
-
if (typeof
|
|
96
|
+
function s(n) {
|
|
97
|
+
if (n === f) return "<>";
|
|
98
|
+
if (typeof n == "object" && n !== null && n.$$typeof === U)
|
|
99
99
|
return "<...>";
|
|
100
100
|
try {
|
|
101
|
-
var
|
|
102
|
-
return
|
|
101
|
+
var p = e(n);
|
|
102
|
+
return p ? "<" + p + ">" : "<...>";
|
|
103
103
|
} catch {
|
|
104
104
|
return "<...>";
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
function r() {
|
|
108
|
-
var
|
|
109
|
-
return
|
|
108
|
+
var n = F.A;
|
|
109
|
+
return n === null ? null : n.getOwner();
|
|
110
110
|
}
|
|
111
111
|
function o() {
|
|
112
112
|
return Error("react-stack-top-frame");
|
|
113
113
|
}
|
|
114
|
-
function l(
|
|
115
|
-
if (
|
|
116
|
-
var
|
|
117
|
-
if (
|
|
114
|
+
function l(n) {
|
|
115
|
+
if (W.call(n, "key")) {
|
|
116
|
+
var p = Object.getOwnPropertyDescriptor(n, "key").get;
|
|
117
|
+
if (p && p.isReactWarning) return !1;
|
|
118
118
|
}
|
|
119
|
-
return
|
|
119
|
+
return n.key !== void 0;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
function
|
|
123
|
-
|
|
121
|
+
function u(n, p) {
|
|
122
|
+
function I() {
|
|
123
|
+
se || (se = !0, console.error(
|
|
124
124
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
125
|
-
|
|
125
|
+
p
|
|
126
126
|
));
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
get:
|
|
128
|
+
I.isReactWarning = !0, Object.defineProperty(n, "key", {
|
|
129
|
+
get: I,
|
|
130
130
|
configurable: !0
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
function w() {
|
|
134
|
-
var
|
|
135
|
-
return
|
|
134
|
+
var n = e(this.type);
|
|
135
|
+
return ae[n] || (ae[n] = !0, console.error(
|
|
136
136
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
137
|
-
)),
|
|
137
|
+
)), n = this.props.ref, n !== void 0 ? n : null;
|
|
138
138
|
}
|
|
139
|
-
function x(
|
|
140
|
-
var
|
|
141
|
-
return
|
|
142
|
-
$$typeof:
|
|
143
|
-
type:
|
|
144
|
-
key:
|
|
145
|
-
props:
|
|
139
|
+
function x(n, p, I, _, Q, ee) {
|
|
140
|
+
var C = I.ref;
|
|
141
|
+
return n = {
|
|
142
|
+
$$typeof: k,
|
|
143
|
+
type: n,
|
|
144
|
+
key: p,
|
|
145
|
+
props: I,
|
|
146
146
|
_owner: _
|
|
147
|
-
}, (
|
|
147
|
+
}, (C !== void 0 ? C : null) !== null ? Object.defineProperty(n, "ref", {
|
|
148
148
|
enumerable: !1,
|
|
149
149
|
get: w
|
|
150
|
-
}) : Object.defineProperty(
|
|
150
|
+
}) : Object.defineProperty(n, "ref", { enumerable: !1, value: null }), n._store = {}, Object.defineProperty(n._store, "validated", {
|
|
151
151
|
configurable: !1,
|
|
152
152
|
enumerable: !1,
|
|
153
153
|
writable: !0,
|
|
154
154
|
value: 0
|
|
155
|
-
}), Object.defineProperty(
|
|
155
|
+
}), Object.defineProperty(n, "_debugInfo", {
|
|
156
156
|
configurable: !1,
|
|
157
157
|
enumerable: !1,
|
|
158
158
|
writable: !0,
|
|
159
159
|
value: null
|
|
160
|
-
}), Object.defineProperty(
|
|
160
|
+
}), Object.defineProperty(n, "_debugStack", {
|
|
161
161
|
configurable: !1,
|
|
162
162
|
enumerable: !1,
|
|
163
163
|
writable: !0,
|
|
164
164
|
value: Q
|
|
165
|
-
}), Object.defineProperty(
|
|
165
|
+
}), Object.defineProperty(n, "_debugTask", {
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
168
168
|
writable: !0,
|
|
169
|
-
value:
|
|
170
|
-
}), Object.freeze && (Object.freeze(
|
|
169
|
+
value: ee
|
|
170
|
+
}), Object.freeze && (Object.freeze(n.props), Object.freeze(n)), n;
|
|
171
171
|
}
|
|
172
|
-
function c(
|
|
173
|
-
var
|
|
174
|
-
if (
|
|
172
|
+
function c(n, p, I, _, Q, ee) {
|
|
173
|
+
var C = p.children;
|
|
174
|
+
if (C !== void 0)
|
|
175
175
|
if (_)
|
|
176
|
-
if (
|
|
177
|
-
for (_ = 0; _ <
|
|
178
|
-
|
|
179
|
-
Object.freeze && Object.freeze(
|
|
176
|
+
if (Z(C)) {
|
|
177
|
+
for (_ = 0; _ < C.length; _++)
|
|
178
|
+
y(C[_]);
|
|
179
|
+
Object.freeze && Object.freeze(C);
|
|
180
180
|
} else
|
|
181
181
|
console.error(
|
|
182
182
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
183
183
|
);
|
|
184
|
-
else
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
var
|
|
188
|
-
return
|
|
184
|
+
else y(C);
|
|
185
|
+
if (W.call(p, "key")) {
|
|
186
|
+
C = e(n);
|
|
187
|
+
var K = Object.keys(p).filter(function(G) {
|
|
188
|
+
return G !== "key";
|
|
189
189
|
});
|
|
190
|
-
_ = 0 <
|
|
190
|
+
_ = 0 < K.length ? "{key: someKey, " + K.join(": ..., ") + ": ...}" : "{key: someKey}", $[C + _] || (K = 0 < K.length ? "{" + K.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
191
191
|
`A props object containing a "key" prop is being spread into JSX:
|
|
192
192
|
let props = %s;
|
|
193
193
|
<%s {...props} />
|
|
@@ -195,78 +195,78 @@ React keys must be passed directly to JSX without using spread:
|
|
|
195
195
|
let props = %s;
|
|
196
196
|
<%s key={someKey} {...props} />`,
|
|
197
197
|
_,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
),
|
|
198
|
+
C,
|
|
199
|
+
K,
|
|
200
|
+
C
|
|
201
|
+
), $[C + _] = !0);
|
|
202
202
|
}
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
for (var
|
|
206
|
-
|
|
207
|
-
} else
|
|
208
|
-
return
|
|
209
|
-
|
|
210
|
-
typeof
|
|
203
|
+
if (C = null, I !== void 0 && (a(I), C = "" + I), l(p) && (a(p.key), C = "" + p.key), "key" in p) {
|
|
204
|
+
I = {};
|
|
205
|
+
for (var oe in p)
|
|
206
|
+
oe !== "key" && (I[oe] = p[oe]);
|
|
207
|
+
} else I = p;
|
|
208
|
+
return C && u(
|
|
209
|
+
I,
|
|
210
|
+
typeof n == "function" ? n.displayName || n.name || "Unknown" : n
|
|
211
211
|
), x(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
n,
|
|
213
|
+
C,
|
|
214
|
+
I,
|
|
215
215
|
r(),
|
|
216
216
|
Q,
|
|
217
|
-
|
|
217
|
+
ee
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
|
|
220
|
+
function y(n) {
|
|
221
|
+
E(n) ? n._store && (n._store.validated = 1) : typeof n == "object" && n !== null && n.$$typeof === U && (n._payload.status === "fulfilled" ? E(n._payload.value) && n._payload.value._store && (n._payload.value._store.validated = 1) : n._store && (n._store.validated = 1));
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
return typeof
|
|
223
|
+
function E(n) {
|
|
224
|
+
return typeof n == "object" && n !== null && n.$$typeof === k;
|
|
225
225
|
}
|
|
226
|
-
var
|
|
226
|
+
var g = tr, k = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), f = /* @__PURE__ */ Symbol.for("react.fragment"), v = /* @__PURE__ */ Symbol.for("react.strict_mode"), D = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), b = /* @__PURE__ */ Symbol.for("react.context"), h = /* @__PURE__ */ Symbol.for("react.forward_ref"), j = /* @__PURE__ */ Symbol.for("react.suspense"), T = /* @__PURE__ */ Symbol.for("react.suspense_list"), L = /* @__PURE__ */ Symbol.for("react.memo"), U = /* @__PURE__ */ Symbol.for("react.lazy"), P = /* @__PURE__ */ Symbol.for("react.activity"), Y = /* @__PURE__ */ Symbol.for("react.client.reference"), F = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, W = Object.prototype.hasOwnProperty, Z = Array.isArray, z = console.createTask ? console.createTask : function() {
|
|
227
227
|
return null;
|
|
228
228
|
};
|
|
229
|
-
|
|
230
|
-
react_stack_bottom_frame: function(
|
|
231
|
-
return
|
|
229
|
+
g = {
|
|
230
|
+
react_stack_bottom_frame: function(n) {
|
|
231
|
+
return n();
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
var
|
|
235
|
-
|
|
234
|
+
var se, ae = {}, A = g.react_stack_bottom_frame.bind(
|
|
235
|
+
g,
|
|
236
236
|
o
|
|
237
|
-
)(),
|
|
238
|
-
|
|
239
|
-
var _ = 1e4 >
|
|
237
|
+
)(), R = z(s(o)), $ = {};
|
|
238
|
+
Se.Fragment = f, Se.jsx = function(n, p, I) {
|
|
239
|
+
var _ = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
240
240
|
return c(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
241
|
+
n,
|
|
242
|
+
p,
|
|
243
|
+
I,
|
|
244
244
|
!1,
|
|
245
|
-
_ ? Error("react-stack-top-frame") :
|
|
246
|
-
_ ?
|
|
245
|
+
_ ? Error("react-stack-top-frame") : A,
|
|
246
|
+
_ ? z(s(n)) : R
|
|
247
247
|
);
|
|
248
|
-
},
|
|
249
|
-
var _ = 1e4 >
|
|
248
|
+
}, Se.jsxs = function(n, p, I) {
|
|
249
|
+
var _ = 1e4 > F.recentlyCreatedOwnerStacks++;
|
|
250
250
|
return c(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
n,
|
|
252
|
+
p,
|
|
253
|
+
I,
|
|
254
254
|
!0,
|
|
255
|
-
_ ? Error("react-stack-top-frame") :
|
|
256
|
-
_ ?
|
|
255
|
+
_ ? Error("react-stack-top-frame") : A,
|
|
256
|
+
_ ? z(s(n)) : R
|
|
257
257
|
);
|
|
258
258
|
};
|
|
259
|
-
})()),
|
|
259
|
+
})()), Se;
|
|
260
260
|
}
|
|
261
|
-
var
|
|
262
|
-
function
|
|
263
|
-
return
|
|
261
|
+
var Mt;
|
|
262
|
+
function fr() {
|
|
263
|
+
return Mt || (Mt = 1, process.env.NODE_ENV === "production" ? Me.exports = ur() : Me.exports = mr()), Me.exports;
|
|
264
264
|
}
|
|
265
|
-
var i =
|
|
266
|
-
const
|
|
267
|
-
container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[
|
|
265
|
+
var i = fr();
|
|
266
|
+
const Ae = 18, Oe = 12, At = 10, O = {
|
|
267
|
+
container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[3px] pr-[2px]",
|
|
268
268
|
containerPending: "opacity-70",
|
|
269
|
-
entry: "directory-tree-entry flex items-center cursor-pointer relative select-none",
|
|
269
|
+
entry: "directory-tree-entry flex items-center cursor-pointer relative select-none text-xs leading-tight py-0.5",
|
|
270
270
|
// ホバー時のスタイル(ライト/ダークモード対応)
|
|
271
271
|
entryHover: M("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
|
|
272
272
|
// 選択時のスタイル(ライト/ダークモード対応)
|
|
@@ -274,22 +274,22 @@ const _e = 20, ke = 16, Pt = 12, A = {
|
|
|
274
274
|
// アイテム選択時のスタイル(ライト/ダークモード対応)
|
|
275
275
|
entryItemSelected: M("directory-tree-entry--item-selected bg-blue-400/20 shadow-[0_0_0_1px_rgba(59,130,246,0.3)]", "dark:bg-blue-400/25 dark:shadow-[0_0_0_1px_rgba(96,165,250,0.4)]"),
|
|
276
276
|
// アイコンのスタイル
|
|
277
|
-
expandIcon: M("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
277
|
+
expandIcon: M("directory-tree-expand-icon w-3.5 h-3.5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
278
278
|
expandIconSelected: M("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
|
|
279
|
-
typeIcon: M("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
279
|
+
typeIcon: M("directory-tree-type-icon w-3.5 h-3.5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
280
280
|
typeIconSelected: M("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
|
|
281
281
|
// テキストのスタイル
|
|
282
|
-
name: M("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1", "text-gray-700", "dark:text-gray-200"),
|
|
283
|
-
nameDirectory: "directory-tree-name--directory",
|
|
284
|
-
nameSelected: M("directory-tree-name--selected text-blue-800 font-
|
|
282
|
+
name: M("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 text-xs font-normal", "text-gray-700", "dark:text-gray-200"),
|
|
283
|
+
nameDirectory: "directory-tree-name--directory font-medium",
|
|
284
|
+
nameSelected: M("directory-tree-name--selected text-blue-800 font-semibold", "dark:text-blue-300")
|
|
285
285
|
}, xe = (e) => {
|
|
286
286
|
if (!e) return "";
|
|
287
287
|
const t = e.split("?")[0].split("#")[0].split("/").pop() || e, a = t.lastIndexOf(".");
|
|
288
288
|
return a <= 0 ? "" : t.slice(a + 1).toLowerCase();
|
|
289
|
-
},
|
|
289
|
+
}, Ft = ({ isDirectory: e, isExpanded: t, showExpandIcons: a, useCanvasExpandIcons: s, expandIconSize: r }) => {
|
|
290
290
|
const o = r ? { width: r, height: r } : void 0, l = r ? "" : "h-4 w-4";
|
|
291
|
-
return !(a && e) ||
|
|
292
|
-
},
|
|
291
|
+
return !(a && e) || s ? /* @__PURE__ */ i.jsx("span", { className: l, style: o, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(ir, { className: l, style: o }) : /* @__PURE__ */ i.jsx(cr, { className: l, style: o });
|
|
292
|
+
}, Ve = (e, t) => {
|
|
293
293
|
if (e == null || typeof e == "boolean") return null;
|
|
294
294
|
if (typeof e == "function")
|
|
295
295
|
return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`), null;
|
|
@@ -297,539 +297,543 @@ const _e = 20, ke = 16, Pt = 12, A = {
|
|
|
297
297
|
if ("then" in e)
|
|
298
298
|
return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`), null;
|
|
299
299
|
if (Array.isArray(e)) {
|
|
300
|
-
const
|
|
301
|
-
return
|
|
300
|
+
const s = e.map((r) => Ve(r, t)).filter(Boolean);
|
|
301
|
+
return s.length ? s : null;
|
|
302
302
|
}
|
|
303
303
|
const a = e.type;
|
|
304
304
|
if (a && a.$$typeof === /* @__PURE__ */ Symbol.for("react.lazy"))
|
|
305
305
|
return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`), null;
|
|
306
306
|
}
|
|
307
307
|
return e;
|
|
308
|
-
},
|
|
309
|
-
const
|
|
308
|
+
}, hr = (e, t, a) => {
|
|
309
|
+
const s = (t || (a ? xe(a) : "")).toLowerCase(), r = (e || "").toLowerCase();
|
|
310
310
|
if (r && r !== "application/octet-stream") {
|
|
311
311
|
if (r === "text/markdown" || r === "text/x-markdown")
|
|
312
|
-
return /* @__PURE__ */ i.jsx(
|
|
312
|
+
return /* @__PURE__ */ i.jsx(bt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
|
|
313
313
|
if (r === "application/pdf")
|
|
314
|
-
return /* @__PURE__ */ i.jsx(
|
|
314
|
+
return /* @__PURE__ */ i.jsx(gt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
|
|
315
315
|
if (r.includes("excel") || r.includes("spreadsheet") || r.includes("google-apps.spreadsheet"))
|
|
316
|
-
return /* @__PURE__ */ i.jsx(
|
|
316
|
+
return /* @__PURE__ */ i.jsx(wt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
|
|
317
317
|
if (r === "text/csv" || r === "text/tab-separated-values")
|
|
318
|
-
return /* @__PURE__ */ i.jsx(
|
|
318
|
+
return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
|
|
319
319
|
if (r.includes("word") || r.includes("msword") || r.includes("wordprocessingml") || r.includes("google-apps.document") || r === "application/rtf")
|
|
320
|
-
return /* @__PURE__ */ i.jsx(
|
|
320
|
+
return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
|
|
321
321
|
if (r.includes("powerpoint") || r.includes("presentation") || r.includes("google-apps.presentation"))
|
|
322
|
-
return /* @__PURE__ */ i.jsx(
|
|
322
|
+
return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
|
|
323
323
|
if (r.startsWith("image/"))
|
|
324
|
-
return /* @__PURE__ */ i.jsx(
|
|
324
|
+
return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
|
|
325
325
|
if (r.startsWith("audio/"))
|
|
326
|
-
return /* @__PURE__ */ i.jsx(
|
|
326
|
+
return /* @__PURE__ */ i.jsx(St, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
|
|
327
327
|
if (r.startsWith("video/"))
|
|
328
|
-
return /* @__PURE__ */ i.jsx(
|
|
328
|
+
return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
|
|
329
329
|
if (r.includes("zip") || r.includes("tar") || r.includes("compressed") || r.includes("archive"))
|
|
330
|
-
return /* @__PURE__ */ i.jsx(
|
|
330
|
+
return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
|
|
331
331
|
if (r === "application/json" || r.includes("javascript") || r.includes("typescript") || r.includes("xml") || r.startsWith("text/html") || r.startsWith("text/css") || r.includes("x-python") || r.includes("x-sh") || r.includes("x-go") || r.includes("x-rust"))
|
|
332
|
-
return /* @__PURE__ */ i.jsx(
|
|
332
|
+
return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
|
|
333
333
|
if (r.startsWith("text/"))
|
|
334
|
-
return /* @__PURE__ */ i.jsx(
|
|
334
|
+
return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
|
|
335
335
|
}
|
|
336
|
-
if (
|
|
337
|
-
if (
|
|
338
|
-
return /* @__PURE__ */ i.jsx(
|
|
339
|
-
if (
|
|
340
|
-
return /* @__PURE__ */ i.jsx(
|
|
341
|
-
if (["xls", "xlsx", "xlsm", "xlsb", "ods"].includes(
|
|
342
|
-
return /* @__PURE__ */ i.jsx(
|
|
343
|
-
if (["csv", "tsv"].includes(
|
|
344
|
-
return /* @__PURE__ */ i.jsx(
|
|
345
|
-
if (["doc", "docx", "rtf", "odt"].includes(
|
|
346
|
-
return /* @__PURE__ */ i.jsx(
|
|
347
|
-
if (["ppt", "pptx", "odp"].includes(
|
|
348
|
-
return /* @__PURE__ */ i.jsx(
|
|
349
|
-
if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "bmp", "tiff", "avif"].includes(
|
|
350
|
-
return /* @__PURE__ */ i.jsx(
|
|
351
|
-
if (["js", "mjs", "cjs", "ts", "tsx", "jsx", "json", "html", "htm", "css", "scss", "py", "go", "rs", "c", "cpp", "h", "hpp", "sh", "bash", "yaml", "yml", "sql", "xml", "toml"].includes(
|
|
352
|
-
|
|
353
|
-
))
|
|
354
|
-
return /* @__PURE__ */ i.jsx(
|
|
355
|
-
if (["
|
|
356
|
-
return /* @__PURE__ */ i.jsx(
|
|
357
|
-
if (["
|
|
358
|
-
return /* @__PURE__ */ i.jsx(
|
|
359
|
-
if (["
|
|
360
|
-
return /* @__PURE__ */ i.jsx(
|
|
361
|
-
if (["txt", "log"].includes(n))
|
|
362
|
-
return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
|
|
336
|
+
if (s) {
|
|
337
|
+
if (s === "md" || s === "markdown" || s === "mdx")
|
|
338
|
+
return /* @__PURE__ */ i.jsx(bt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
|
|
339
|
+
if (s === "pdf")
|
|
340
|
+
return /* @__PURE__ */ i.jsx(gt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
|
|
341
|
+
if (["xls", "xlsx", "xlsm", "xlsb", "ods"].includes(s))
|
|
342
|
+
return /* @__PURE__ */ i.jsx(wt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
|
|
343
|
+
if (["csv", "tsv"].includes(s))
|
|
344
|
+
return /* @__PURE__ */ i.jsx(kt, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
|
|
345
|
+
if (["doc", "docx", "rtf", "odt"].includes(s))
|
|
346
|
+
return /* @__PURE__ */ i.jsx(Nt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
|
|
347
|
+
if (["ppt", "pptx", "odp"].includes(s))
|
|
348
|
+
return /* @__PURE__ */ i.jsx(Et, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
|
|
349
|
+
if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "bmp", "tiff", "avif"].includes(s))
|
|
350
|
+
return /* @__PURE__ */ i.jsx(It, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
|
|
351
|
+
if (["js", "mjs", "cjs", "ts", "tsx", "jsx", "json", "html", "htm", "css", "scss", "py", "go", "rs", "c", "cpp", "h", "hpp", "sh", "bash", "yaml", "yml", "sql", "xml", "toml"].includes(s))
|
|
352
|
+
return /* @__PURE__ */ i.jsx(Rt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
|
|
353
|
+
if (["mp3", "wav", "ogg", "m4a", "flac", "aac", "wma"].includes(s))
|
|
354
|
+
return /* @__PURE__ */ i.jsx(St, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
|
|
355
|
+
if (["mp4", "webm", "mov", "avi", "mkv", "wmv", "flv"].includes(s))
|
|
356
|
+
return /* @__PURE__ */ i.jsx(jt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
|
|
357
|
+
if (["zip", "tar", "gz", "7z", "rar", "tgz", "bz2"].includes(s))
|
|
358
|
+
return /* @__PURE__ */ i.jsx(Tt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
|
|
359
|
+
if (["txt", "log"].includes(s))
|
|
360
|
+
return /* @__PURE__ */ i.jsx(Ct, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
|
|
363
361
|
}
|
|
364
|
-
return /* @__PURE__ */ i.jsx(
|
|
365
|
-
},
|
|
366
|
-
const { entry: a, isDirectory:
|
|
367
|
-
let
|
|
362
|
+
return /* @__PURE__ */ i.jsx(dr, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
|
|
363
|
+
}, $t = (e, t) => {
|
|
364
|
+
const { entry: a, isDirectory: s, isExpanded: r, extension: o, mimeType: l } = e;
|
|
365
|
+
let u;
|
|
368
366
|
const w = l || a.mimeType;
|
|
369
|
-
return a.icon !== void 0 ?
|
|
370
|
-
},
|
|
371
|
-
const x =
|
|
372
|
-
return
|
|
367
|
+
return a.icon !== void 0 ? u = a.icon : s ? u = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(lr, { className: "h-4 w-4" }) : o && t?.fileByExtension?.[o] ? u = t.fileByExtension[o] : u = t?.file || hr(w, o, a.name), Ve(typeof u == "function" ? u(e) : u, a.absolutePath);
|
|
368
|
+
}, pr = 500, Ht = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: s, selectionMode: r, onSelectionChange: o, onEntryClick: l, toggleDirectory: u, onToggleDirectoryRecursive: w }) => {
|
|
369
|
+
const x = ce(null);
|
|
370
|
+
return de(
|
|
373
371
|
() => () => {
|
|
374
372
|
x.current && window.clearTimeout(x.current);
|
|
375
373
|
},
|
|
376
374
|
[]
|
|
377
375
|
), B(
|
|
378
376
|
(c) => {
|
|
379
|
-
c.stopPropagation(), r !== "none" && !t && o && o(e, !
|
|
380
|
-
let
|
|
377
|
+
c.stopPropagation(), r !== "none" && !t && o && o(e, !s);
|
|
378
|
+
let y = !1;
|
|
381
379
|
l({
|
|
382
380
|
entry: e,
|
|
383
381
|
isDirectory: t,
|
|
384
382
|
isExpanded: a,
|
|
385
383
|
preventDefault: () => {
|
|
386
|
-
|
|
384
|
+
y = !0;
|
|
387
385
|
}
|
|
388
|
-
}), !(!t ||
|
|
389
|
-
|
|
390
|
-
},
|
|
386
|
+
}), !(!t || y) && (x.current ? (window.clearTimeout(x.current), x.current = null, w(e)) : x.current = window.setTimeout(() => {
|
|
387
|
+
u(e.absolutePath), x.current = null;
|
|
388
|
+
}, pr));
|
|
391
389
|
},
|
|
392
|
-
[t, e, a, w,
|
|
390
|
+
[t, e, a, w, u, l, r, o, s]
|
|
393
391
|
);
|
|
394
|
-
},
|
|
392
|
+
}, Wt = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", Ot = (e, t) => e.children !== void 0 && t(e.absolutePath), Bt = (e, t) => ({
|
|
395
393
|
width: e,
|
|
396
394
|
gridTemplateColumns: t
|
|
397
|
-
}),
|
|
395
|
+
}), Yt = ze(
|
|
398
396
|
({
|
|
399
397
|
entry: e,
|
|
400
398
|
indentLevel: t,
|
|
401
399
|
rowHeight: a,
|
|
402
|
-
isDirOpen:
|
|
400
|
+
isDirOpen: s,
|
|
403
401
|
columns: r,
|
|
404
402
|
numericTemplate: o,
|
|
405
403
|
numericTotal: l,
|
|
406
|
-
nameWidth:
|
|
404
|
+
nameWidth: u,
|
|
407
405
|
rowClassName: w,
|
|
408
|
-
selection: { onEntryClick: x, selectedPath: c, mode:
|
|
409
|
-
expansion: { toggleDirectory:
|
|
410
|
-
visual: { iconOverrides: f, showExpandIcons: v = !0, showDirectoryIcons:
|
|
406
|
+
selection: { onEntryClick: x, selectedPath: c, mode: y = "none", selectedItems: E, onSelectionChange: g },
|
|
407
|
+
expansion: { toggleDirectory: k, onToggleDirectoryRecursive: m },
|
|
408
|
+
visual: { iconOverrides: f, showExpandIcons: v = !0, showDirectoryIcons: D = !0, showFileIcons: N = !0, useCanvasExpandIcons: b = !1, expandIconSize: h, indentSize: j = Oe, highlightStyles: T }
|
|
411
409
|
}) => {
|
|
412
|
-
const [
|
|
413
|
-
if (
|
|
414
|
-
if (
|
|
415
|
-
} else if (
|
|
416
|
-
return
|
|
410
|
+
const [L, U] = ne(!1), P = e.children !== void 0, Y = P && s(e.absolutePath), F = e.absolutePath === c, W = !P && !!E?.has(e.absolutePath), Z = P ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath), z = Ht({ entry: e, isDirectory: P, isExpanded: Y, isItemSelected: W, selectionMode: y, onSelectionChange: g, onEntryClick: x, toggleDirectory: k, onToggleDirectoryRecursive: m }), se = L ? T?.hoverClassName !== void 0 ? T.hoverClassName : O.entryHover : "", ae = (() => {
|
|
411
|
+
if (P) {
|
|
412
|
+
if (F) return T?.directorySelectedClassName !== void 0 ? T.directorySelectedClassName : O.entrySelected;
|
|
413
|
+
} else if (F || W)
|
|
414
|
+
return T?.itemSelectedClassName !== void 0 ? T.itemSelectedClassName : M(F && O.entrySelected, W && O.entryItemSelected);
|
|
417
415
|
return "";
|
|
418
|
-
})(),
|
|
419
|
-
|
|
420
|
-
...
|
|
421
|
-
...!
|
|
416
|
+
})(), A = typeof w == "function" ? w(e) : w, R = M("dt-grid-row cursor-pointer select-none", se, ae, A, e.className), $ = M(O.expandIcon, (F || W) && O.expandIconSelected), n = M(O.typeIcon, (F || W) && O.typeIconSelected), p = M("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", P && O.nameDirectory, (F || W) && O.nameSelected), I = Ft({ isDirectory: P, isExpanded: Y, showExpandIcons: v, useCanvasExpandIcons: b, expandIconSize: h }), _ = (P ? D : N) ? $t({ entry: e, isDirectory: P, isExpanded: Y, isSelected: F, isItemSelected: W, extension: Z, mimeType: e.mimeType }, f) : null, Q = { indentLevel: t, isDirectory: P, isExpanded: Y }, [ee, ...C] = r, K = ee?.render ? ee.render(e, Q) : e.label ?? e.name, oe = {
|
|
417
|
+
...L ? T?.hoverStyle : {},
|
|
418
|
+
...P && F ? T?.directorySelectedStyle : {},
|
|
419
|
+
...!P && (F || W) ? T?.itemSelectedStyle : {}
|
|
422
420
|
};
|
|
423
421
|
return /* @__PURE__ */ i.jsxs(
|
|
424
422
|
"div",
|
|
425
423
|
{
|
|
426
|
-
className:
|
|
427
|
-
style: { height: a, ...
|
|
424
|
+
className: R,
|
|
425
|
+
style: { height: a, ...oe, ...e.style },
|
|
428
426
|
role: "row",
|
|
429
|
-
"aria-expanded":
|
|
427
|
+
"aria-expanded": P ? Y : void 0,
|
|
430
428
|
"aria-level": t + 1,
|
|
431
|
-
"data-entry-type":
|
|
432
|
-
"data-entry-expanded":
|
|
433
|
-
"data-entry-selected":
|
|
434
|
-
"data-entry-item-selected":
|
|
435
|
-
onClick:
|
|
436
|
-
onMouseEnter: () =>
|
|
437
|
-
onMouseLeave: () =>
|
|
438
|
-
onKeyDown: (
|
|
429
|
+
"data-entry-type": P ? "directory" : "file",
|
|
430
|
+
"data-entry-expanded": P ? String(Y) : void 0,
|
|
431
|
+
"data-entry-selected": F ? "true" : void 0,
|
|
432
|
+
"data-entry-item-selected": W ? "true" : void 0,
|
|
433
|
+
onClick: z,
|
|
434
|
+
onMouseEnter: () => U(!0),
|
|
435
|
+
onMouseLeave: () => U(!1),
|
|
436
|
+
onKeyDown: (G) => G.key === "Enter" && z(G),
|
|
439
437
|
tabIndex: 0,
|
|
440
438
|
children: [
|
|
441
|
-
/* @__PURE__ */ i.jsxs("div", { className: M("dt-grid-name-cell",
|
|
442
|
-
(v ||
|
|
443
|
-
(
|
|
444
|
-
/* @__PURE__ */ i.jsx("span", { className:
|
|
439
|
+
/* @__PURE__ */ i.jsxs("div", { className: M("dt-grid-name-cell", ee?.className), role: "gridcell", style: { width: u, paddingLeft: Math.max(0, t * j) }, children: [
|
|
440
|
+
(v || b) && /* @__PURE__ */ i.jsx("span", { className: $, children: I }),
|
|
441
|
+
(P ? D : N) && /* @__PURE__ */ i.jsx("span", { className: n, children: _ }),
|
|
442
|
+
/* @__PURE__ */ i.jsx("span", { className: p, children: K })
|
|
445
443
|
] }),
|
|
446
|
-
|
|
444
|
+
C.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Bt(l, o), children: C.map((G) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", Wt(G.align), G.className), role: "gridcell", children: G.render ? G.render(e, Q) : null }, G.key)) }) })
|
|
447
445
|
]
|
|
448
446
|
}
|
|
449
447
|
);
|
|
450
448
|
},
|
|
451
449
|
(e, t) => {
|
|
452
450
|
if (e.entry !== t.entry) return !1;
|
|
453
|
-
const a =
|
|
454
|
-
return e.indentLevel === t.indentLevel && e.rowHeight === t.rowHeight && a ===
|
|
451
|
+
const a = Ot(e.entry, e.isDirOpen), s = Ot(t.entry, t.isDirOpen);
|
|
452
|
+
return e.indentLevel === t.indentLevel && e.rowHeight === t.rowHeight && a === s && e.columns === t.columns && e.numericTemplate === t.numericTemplate && e.numericTotal === t.numericTotal && e.nameWidth === t.nameWidth && e.rowClassName === t.rowClassName && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual === t.visual;
|
|
455
453
|
}
|
|
456
454
|
);
|
|
457
|
-
|
|
458
|
-
const
|
|
455
|
+
Yt.displayName = "DirectoryTreeGridRow";
|
|
456
|
+
const Gt = ({
|
|
459
457
|
kind: e,
|
|
460
458
|
columns: t,
|
|
461
459
|
numericTemplate: a,
|
|
462
|
-
numericTotal:
|
|
460
|
+
numericTotal: s,
|
|
463
461
|
nameWidth: r,
|
|
464
462
|
scrollBarWidth: o,
|
|
465
463
|
className: l,
|
|
466
|
-
nameContent:
|
|
464
|
+
nameContent: u,
|
|
467
465
|
renderCell: w
|
|
468
466
|
}) => {
|
|
469
|
-
const [, ...x] = t, c = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer",
|
|
470
|
-
return /* @__PURE__ */ i.jsxs("div", { className: M(
|
|
471
|
-
/* @__PURE__ */ i.jsx("div", { className: M(c, "px-1", t[0]?.className), role:
|
|
472
|
-
x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style:
|
|
467
|
+
const [, ...x] = t, c = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", y = e === "header" ? "dt-grid-header" : "dt-grid-footer", E = e === "header" ? "columnheader" : "gridcell";
|
|
468
|
+
return /* @__PURE__ */ i.jsxs("div", { className: M(y, "text-gray-600 dark:text-gray-300", l), role: "row", children: [
|
|
469
|
+
/* @__PURE__ */ i.jsx("div", { className: M(c, "px-1", t[0]?.className), role: E, style: { width: r }, children: u }),
|
|
470
|
+
x.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: Bt(s, a), children: x.map((g) => /* @__PURE__ */ i.jsx("div", { className: M("dt-grid-cell", Wt(g.align), g.className), role: E, children: w(g) }, g.key)) }) }),
|
|
473
471
|
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: o }, "aria-hidden": "true" })
|
|
474
472
|
] });
|
|
475
|
-
},
|
|
473
|
+
}, yr = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(Gt, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (s) => s.header ?? null, ...a }), Dt = (e, t) => typeof e == "function" ? e(t) : e ?? null, xr = ({ columns: e, allEntries: t, className: a, ...s }) => /* @__PURE__ */ i.jsx(Gt, { kind: "footer", columns: e, className: a, nameContent: Dt(e[0]?.footer, t), renderCell: (r) => Dt(r.footer, t), ...s }), vr = 240, Vt = 96, Ut = 12, Ue = (e, t) => {
|
|
476
474
|
const a = e?.width;
|
|
477
475
|
return typeof a == "number" && Number.isFinite(a) && a > 0 ? a : t;
|
|
478
|
-
},
|
|
479
|
-
const
|
|
480
|
-
return { nameWidth:
|
|
481
|
-
},
|
|
482
|
-
const t = [], a = (
|
|
483
|
-
for (const r of
|
|
476
|
+
}, br = (e) => e.slice(1).map((t) => `${Ue(t, Vt)}px`).join(" "), gr = ({ measuredWidth: e, columns: t, scrollBarWidth: a = Ut }) => {
|
|
477
|
+
const s = Ue(t[0], vr), r = t.slice(1).reduce((w, x) => w + Ue(x, Vt), 0), o = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, o - s - Math.max(0, a)), u = Math.max(0, r - l);
|
|
478
|
+
return { nameWidth: s, numericTotal: r, numericVisible: l, maxHScroll: u };
|
|
479
|
+
}, Ge = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, wr = (e) => {
|
|
480
|
+
const t = [], a = (s) => {
|
|
481
|
+
for (const r of s)
|
|
484
482
|
t.push(r), r.children && r.children.length > 0 && a(r.children);
|
|
485
483
|
};
|
|
486
484
|
return a(e), t;
|
|
487
|
-
},
|
|
485
|
+
}, kr = (e, t) => {
|
|
488
486
|
const a = e.length - 1;
|
|
489
487
|
if (a <= 0) return 0;
|
|
490
|
-
let
|
|
491
|
-
for (;
|
|
492
|
-
const l =
|
|
493
|
-
e[l] <= t ? (o = l,
|
|
488
|
+
let s = 0, r = a - 1, o = 0;
|
|
489
|
+
for (; s <= r; ) {
|
|
490
|
+
const l = s + r >>> 1;
|
|
491
|
+
e[l] <= t ? (o = l, s = l + 1) : r = l - 1;
|
|
494
492
|
}
|
|
495
493
|
return o;
|
|
496
|
-
},
|
|
494
|
+
}, Nr = (e, t, a) => {
|
|
497
495
|
if (a <= 0 || e.length === 0 || t.length !== e.length + 1)
|
|
498
496
|
return null;
|
|
499
|
-
const
|
|
497
|
+
const s = kr(t, a), r = e[s];
|
|
500
498
|
return r ? {
|
|
501
499
|
path: r.entry.absolutePath,
|
|
502
|
-
offsetInViewport: a - t[
|
|
500
|
+
offsetInViewport: a - t[s]
|
|
503
501
|
} : null;
|
|
504
|
-
},
|
|
502
|
+
}, Er = (e, t, a) => {
|
|
505
503
|
if (t.length === 0 || a.length !== t.length + 1)
|
|
506
504
|
return null;
|
|
507
|
-
for (let
|
|
508
|
-
if (t[
|
|
509
|
-
return Math.max(0, a[
|
|
505
|
+
for (let s = 0; s < t.length; s++)
|
|
506
|
+
if (t[s].entry.absolutePath === e.path)
|
|
507
|
+
return Math.max(0, a[s] + e.offsetInViewport);
|
|
510
508
|
return null;
|
|
511
|
-
},
|
|
512
|
-
const
|
|
509
|
+
}, Ir = (e, t, a) => {
|
|
510
|
+
const s = [];
|
|
513
511
|
for (let r = t; r < a; r++) {
|
|
514
512
|
const o = e[r];
|
|
515
513
|
if (!(!o || o.length === 0))
|
|
516
514
|
for (const l of o)
|
|
517
|
-
|
|
515
|
+
s.push(l);
|
|
518
516
|
}
|
|
519
|
-
return
|
|
520
|
-
},
|
|
521
|
-
const
|
|
517
|
+
return s;
|
|
518
|
+
}, Sr = (e, t, a) => {
|
|
519
|
+
const s = [];
|
|
522
520
|
for (let r = t; r < a; r++) {
|
|
523
521
|
const o = e[r];
|
|
524
522
|
if (!(!o || o.length === 0))
|
|
525
523
|
for (const l of o)
|
|
526
|
-
|
|
524
|
+
s.push(l);
|
|
527
525
|
}
|
|
528
|
-
return
|
|
529
|
-
},
|
|
530
|
-
const r = Math.max(1, Math.floor(t *
|
|
526
|
+
return s;
|
|
527
|
+
}, jr = (e, t, a, s) => {
|
|
528
|
+
const r = Math.max(1, Math.floor(t * s)), o = Math.max(1, Math.floor(a * s));
|
|
531
529
|
(e.width !== r || e.height !== o) && (e.width = r, e.height = o);
|
|
532
530
|
const l = e.style;
|
|
533
531
|
l.width !== `${t}px` && (l.width = `${t}px`), l.height !== `${a}px` && (l.height = `${a}px`);
|
|
534
|
-
},
|
|
532
|
+
}, Tr = (e, t, a) => {
|
|
535
533
|
e.lineWidth = a, e.beginPath();
|
|
536
|
-
for (const
|
|
537
|
-
e.moveTo(
|
|
534
|
+
for (const s of t)
|
|
535
|
+
e.moveTo(s.x1, s.y1), e.lineTo(s.x2, s.y2);
|
|
538
536
|
e.stroke();
|
|
539
|
-
},
|
|
537
|
+
}, Rr = (e, t) => {
|
|
540
538
|
const a = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
541
539
|
if (!a)
|
|
542
540
|
return null;
|
|
543
|
-
let
|
|
544
|
-
|
|
545
|
-
const r = Number.parseInt(
|
|
541
|
+
let s = a[1];
|
|
542
|
+
s.length === 3 && (s = s.split("").map((u) => u + u).join(""));
|
|
543
|
+
const r = Number.parseInt(s.slice(0, 2), 16), o = Number.parseInt(s.slice(2, 4), 16), l = Number.parseInt(s.slice(4, 6), 16);
|
|
546
544
|
return `rgba(${r}, ${o}, ${l}, ${t})`;
|
|
547
|
-
},
|
|
545
|
+
}, Cr = (e, t, a, s) => {
|
|
548
546
|
if (t.length === 0)
|
|
549
547
|
return;
|
|
550
|
-
const r =
|
|
548
|
+
const r = Rr(a, 0.14), o = e.strokeStyle, l = e.fillStyle, u = e.lineWidth, w = e.lineCap, x = e.lineJoin;
|
|
551
549
|
e.strokeStyle = a, e.lineCap = "round", e.lineJoin = "round";
|
|
552
550
|
for (const c of t) {
|
|
553
|
-
const
|
|
554
|
-
r && (e.fillStyle = r, e.beginPath(), e.arc(c.centerX, c.centerY,
|
|
551
|
+
const y = s ?? c.size, E = Math.max(0, y / 2), g = Math.max(1, Math.round(y * 0.08)), k = Math.max(1, Math.round(y * 0.14)), m = Math.max(0, E - g * 0.8), f = Math.max(0, m * 0.55);
|
|
552
|
+
r && (e.fillStyle = r, e.beginPath(), e.arc(c.centerX, c.centerY, m, 0, Math.PI * 2), e.fill()), e.lineWidth = g, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, E - g * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = k, e.beginPath(), e.moveTo(c.centerX - f, c.centerY), e.lineTo(c.centerX + f, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - f), e.lineTo(c.centerX, c.centerY + f), e.stroke());
|
|
555
553
|
}
|
|
556
|
-
e.strokeStyle = o, e.fillStyle = l, e.lineWidth =
|
|
557
|
-
},
|
|
558
|
-
const
|
|
554
|
+
e.strokeStyle = o, e.fillStyle = l, e.lineWidth = u, e.lineCap = w, e.lineJoin = x;
|
|
555
|
+
}, zt = ze(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: s, viewportHeight: r, scrollPosition: o, color: l = "#a0aec0", strokeWidth: u = 1, renderStartIndex: w, renderEndIndex: x, lookaheadEndIndex: c, devicePixelRatio: y, expandGlyphColor: E, expandGlyphSize: g }) => {
|
|
556
|
+
const k = ce(null), m = ce(null), f = ce({
|
|
559
557
|
segmentsByItem: e,
|
|
560
558
|
glyphsByItem: t,
|
|
561
559
|
itemHeight: a,
|
|
562
|
-
width:
|
|
560
|
+
width: s,
|
|
563
561
|
viewportHeight: r,
|
|
564
562
|
scrollPosition: o,
|
|
565
563
|
color: l,
|
|
566
|
-
strokeWidth:
|
|
564
|
+
strokeWidth: u,
|
|
567
565
|
renderStartIndex: w,
|
|
568
566
|
renderEndIndex: x,
|
|
569
567
|
lookaheadEndIndex: c,
|
|
570
|
-
devicePixelRatio:
|
|
571
|
-
expandGlyphColor:
|
|
572
|
-
expandGlyphSize:
|
|
568
|
+
devicePixelRatio: y,
|
|
569
|
+
expandGlyphColor: E,
|
|
570
|
+
expandGlyphSize: g
|
|
573
571
|
}), v = B(() => {
|
|
574
|
-
|
|
575
|
-
const
|
|
576
|
-
if (!g)
|
|
577
|
-
return;
|
|
578
|
-
const N = g.getContext("2d");
|
|
572
|
+
m.current = null;
|
|
573
|
+
const N = k.current;
|
|
579
574
|
if (!N)
|
|
580
575
|
return;
|
|
581
|
-
const
|
|
582
|
-
if (
|
|
583
|
-
|
|
576
|
+
const b = N.getContext("2d");
|
|
577
|
+
if (!b)
|
|
578
|
+
return;
|
|
579
|
+
const h = f.current;
|
|
580
|
+
if (h.width <= 0 || h.viewportHeight <= 0) {
|
|
581
|
+
b.clearRect(0, 0, N.width, N.height);
|
|
584
582
|
return;
|
|
585
583
|
}
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
const
|
|
589
|
-
if (typeof
|
|
590
|
-
const
|
|
591
|
-
return Math.max(Math.min(
|
|
584
|
+
const j = Number.isFinite(h.devicePixelRatio ?? NaN) ? h.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
|
|
585
|
+
jr(N, h.width, h.viewportHeight, j);
|
|
586
|
+
const T = h.segmentsByItem.length, L = typeof h.renderStartIndex == "number" && Number.isFinite(h.renderStartIndex) ? Math.max(0, Math.floor(h.renderStartIndex)) : Math.max(0, Math.floor(h.scrollPosition / h.itemHeight)), U = Math.min(T, Math.ceil((h.scrollPosition + h.viewportHeight) / h.itemHeight)), P = (() => {
|
|
587
|
+
if (typeof h.renderEndIndex == "number" && Number.isFinite(h.renderEndIndex)) {
|
|
588
|
+
const Z = Math.floor(h.renderEndIndex);
|
|
589
|
+
return Math.max(Math.min(T, Z + 1), L);
|
|
592
590
|
}
|
|
593
|
-
return Math.max(
|
|
594
|
-
})(),
|
|
595
|
-
if (typeof
|
|
596
|
-
const
|
|
597
|
-
return Math.max(
|
|
591
|
+
return Math.max(U, L);
|
|
592
|
+
})(), Y = (() => {
|
|
593
|
+
if (typeof h.lookaheadEndIndex == "number" && Number.isFinite(h.lookaheadEndIndex)) {
|
|
594
|
+
const Z = Math.floor(h.lookaheadEndIndex), z = Math.min(T, Z + 1);
|
|
595
|
+
return Math.max(z, P);
|
|
598
596
|
}
|
|
599
|
-
return Math.max(
|
|
600
|
-
})(),
|
|
601
|
-
|
|
602
|
-
}, []),
|
|
603
|
-
|
|
597
|
+
return Math.max(U, P);
|
|
598
|
+
})(), F = Ir(h.segmentsByItem, L, Y), W = Sr(h.glyphsByItem, L, Y);
|
|
599
|
+
b.save(), b.scale(j, j), b.clearRect(0, 0, h.width, h.viewportHeight), b.translate(0, -h.scrollPosition), b.strokeStyle = h.color, Tr(b, F, h.strokeWidth), Cr(b, W, h.expandGlyphColor ?? h.color, h.expandGlyphSize), b.restore();
|
|
600
|
+
}, []), D = B(() => {
|
|
601
|
+
m.current === null && (m.current = window.requestAnimationFrame(v));
|
|
604
602
|
}, [v]);
|
|
605
|
-
return
|
|
603
|
+
return de(() => {
|
|
606
604
|
f.current = {
|
|
607
605
|
segmentsByItem: e,
|
|
608
606
|
glyphsByItem: t,
|
|
609
607
|
itemHeight: a,
|
|
610
|
-
width:
|
|
608
|
+
width: s,
|
|
611
609
|
viewportHeight: r,
|
|
612
610
|
scrollPosition: o,
|
|
613
611
|
color: l,
|
|
614
|
-
strokeWidth:
|
|
612
|
+
strokeWidth: u,
|
|
615
613
|
renderStartIndex: w,
|
|
616
614
|
renderEndIndex: x,
|
|
617
615
|
lookaheadEndIndex: c,
|
|
618
|
-
devicePixelRatio:
|
|
619
|
-
expandGlyphColor:
|
|
620
|
-
expandGlyphSize:
|
|
621
|
-
},
|
|
622
|
-
}, [e, t, a,
|
|
623
|
-
|
|
624
|
-
}, []), /* @__PURE__ */ i.jsx("canvas", { ref:
|
|
616
|
+
devicePixelRatio: y,
|
|
617
|
+
expandGlyphColor: E,
|
|
618
|
+
expandGlyphSize: g
|
|
619
|
+
}, D();
|
|
620
|
+
}, [e, t, a, s, r, o, l, u, w, x, c, y, E, g, D]), de(() => () => {
|
|
621
|
+
m.current !== null && (window.cancelAnimationFrame(m.current), m.current = null);
|
|
622
|
+
}, []), /* @__PURE__ */ i.jsx("canvas", { ref: k, className: "pointer-events-none absolute top-0 left-0 z-0" });
|
|
625
623
|
});
|
|
626
|
-
|
|
627
|
-
const
|
|
624
|
+
zt.displayName = "TreeLineCanvas";
|
|
625
|
+
const Pr = {
|
|
628
626
|
msOverflowStyle: "none",
|
|
629
627
|
scrollbarWidth: "none"
|
|
630
|
-
},
|
|
628
|
+
}, _r = () => {
|
|
631
629
|
let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
|
|
632
630
|
e || (e = document.createElement("style"), e.id = "directory-tree-webkit-scrollbar-hide", e.textContent = ".directory-tree-container::-webkit-scrollbar { display: none; }", document.head.appendChild(e));
|
|
633
|
-
},
|
|
634
|
-
const
|
|
635
|
-
let
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
631
|
+
}, Mr = (e, t, a, s, r) => {
|
|
632
|
+
const o = [], l = [];
|
|
633
|
+
let u = 0;
|
|
634
|
+
const w = (x, c, y) => {
|
|
635
|
+
const E = r ? [...x].sort(r) : x;
|
|
636
|
+
for (let g = 0; g < E.length; g++) {
|
|
637
|
+
const k = E[g], m = g === E.length - 1, f = [...y, m], v = k.children !== void 0, D = v && t(k.absolutePath, k.relativePath);
|
|
638
|
+
let N = c, b = f, h = y;
|
|
639
|
+
s && (N = c - 1, b = f.slice(1), h = y.slice(1)), o.push({ entry: k, indentLevel: N, parentIsLast: b }), a && (N > u && (u = N), l.push({
|
|
640
|
+
id: k.absolutePath,
|
|
641
|
+
name: k.name,
|
|
642
|
+
absolutePath: k.absolutePath,
|
|
643
|
+
indentLevel: N,
|
|
644
|
+
isLastChild: m,
|
|
645
|
+
isDirectory: v,
|
|
646
|
+
isExpanded: D,
|
|
647
|
+
ancestorIsLast: [...h],
|
|
648
|
+
hideLines: s && c === 0
|
|
649
|
+
})), v && D && k.children && w(k.children, c + 1, f);
|
|
651
650
|
}
|
|
652
651
|
};
|
|
653
|
-
return
|
|
654
|
-
},
|
|
652
|
+
return w(e, 0, []), { flatItems: o, lineItems: l, maxIndent: u };
|
|
653
|
+
}, Lt = (e, t) => {
|
|
655
654
|
const a = e.length - 1;
|
|
656
655
|
if (a <= 0) return 0;
|
|
657
|
-
let
|
|
658
|
-
for (;
|
|
659
|
-
const l =
|
|
660
|
-
e[l] <= t ? (o = l,
|
|
656
|
+
let s = 0, r = a - 1, o = 0;
|
|
657
|
+
for (; s <= r; ) {
|
|
658
|
+
const l = s + r >>> 1;
|
|
659
|
+
e[l] <= t ? (o = l, s = l + 1) : r = l - 1;
|
|
661
660
|
}
|
|
662
661
|
return o;
|
|
663
|
-
},
|
|
664
|
-
const l =
|
|
662
|
+
}, Ar = (e, t, a, s, r, o) => {
|
|
663
|
+
const l = s?.renderStart ?? Math.max(0, Lt(o, r)), u = t > 0 ? Lt(o, r + t) + a : l + a, w = e > 0 ? Math.min(e - 1, Math.max(l, u)) : l, x = s?.renderEnd ?? w, c = e > 0 ? Math.min(e - 1, x + a) : x;
|
|
665
664
|
return { renderStart: l, renderEnd: x, lookaheadEnd: c };
|
|
666
|
-
},
|
|
665
|
+
}, Or = (e, t, a, s, r, o) => {
|
|
667
666
|
if (e.length === 0)
|
|
668
667
|
return { segmentsByItem: [], glyphsByItem: [] };
|
|
669
|
-
const l = Array.from({ length: e.length }, () => []),
|
|
668
|
+
const l = Array.from({ length: e.length }, () => []), u = Array.from({ length: e.length }, () => []), w = (c) => r ? typeof o == "number" && Number.isFinite(o) && o > 0 ? o : Math.max(8, Math.min(s * 0.9, c * 0.7)) : 0, x = 3;
|
|
670
669
|
for (let c = 0; c < e.length; c++) {
|
|
671
|
-
const
|
|
672
|
-
if (
|
|
670
|
+
const y = e[c];
|
|
671
|
+
if (y.hideLines)
|
|
673
672
|
continue;
|
|
674
|
-
const
|
|
675
|
-
for (let
|
|
676
|
-
if (
|
|
673
|
+
const E = [], g = t[c] ?? 0, k = a[c] ?? 0, m = k + g / 2, f = w(g), v = f > 0 ? f / 2 + 2 : s / 1.5;
|
|
674
|
+
for (let b = 0; b < y.indentLevel; b++) {
|
|
675
|
+
if (y.ancestorIsLast[b] ?? !1)
|
|
677
676
|
continue;
|
|
678
|
-
let
|
|
679
|
-
for (let
|
|
680
|
-
const
|
|
681
|
-
if (
|
|
682
|
-
|
|
677
|
+
let j = !1;
|
|
678
|
+
for (let T = c; T < e.length; T++) {
|
|
679
|
+
const L = e[T];
|
|
680
|
+
if (L.indentLevel > b && L.ancestorIsLast.length > b && !L.ancestorIsLast[b]) {
|
|
681
|
+
j = !0;
|
|
683
682
|
break;
|
|
684
683
|
}
|
|
685
|
-
if (
|
|
684
|
+
if (T > c && L.indentLevel === b)
|
|
686
685
|
break;
|
|
687
686
|
}
|
|
688
|
-
if (
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
key: `${
|
|
692
|
-
x1:
|
|
693
|
-
y1:
|
|
694
|
-
x2:
|
|
695
|
-
y2:
|
|
687
|
+
if (j) {
|
|
688
|
+
const T = b * s + s / 2 + x;
|
|
689
|
+
E.push({
|
|
690
|
+
key: `${y.id}-ancestor-${b}`,
|
|
691
|
+
x1: T,
|
|
692
|
+
y1: k,
|
|
693
|
+
x2: T,
|
|
694
|
+
y2: k + g,
|
|
696
695
|
itemIndex: c
|
|
697
696
|
});
|
|
698
697
|
}
|
|
699
698
|
}
|
|
700
|
-
const
|
|
701
|
-
if (
|
|
702
|
-
key: `${
|
|
703
|
-
x1:
|
|
704
|
-
y1:
|
|
705
|
-
x2:
|
|
706
|
-
y2:
|
|
699
|
+
const D = y.indentLevel * s, N = D + s / 2 + x;
|
|
700
|
+
if (y.isDirectory ? E.push({
|
|
701
|
+
key: `${y.id}-connector-top`,
|
|
702
|
+
x1: N,
|
|
703
|
+
y1: k,
|
|
704
|
+
x2: N,
|
|
705
|
+
y2: m - v,
|
|
707
706
|
itemIndex: c
|
|
708
|
-
}) :
|
|
709
|
-
key: `${
|
|
710
|
-
x1:
|
|
711
|
-
y1:
|
|
712
|
-
x2:
|
|
713
|
-
y2:
|
|
707
|
+
}) : E.push({
|
|
708
|
+
key: `${y.id}-connector-top`,
|
|
709
|
+
x1: N,
|
|
710
|
+
y1: k,
|
|
711
|
+
x2: N,
|
|
712
|
+
y2: m,
|
|
714
713
|
itemIndex: c
|
|
715
|
-
}), !
|
|
716
|
-
key: `${
|
|
717
|
-
x1:
|
|
718
|
-
y1:
|
|
719
|
-
x2:
|
|
720
|
-
y2:
|
|
714
|
+
}), !y.isDirectory && y.isLastChild && E.push({
|
|
715
|
+
key: `${y.id}-connector-horizontal`,
|
|
716
|
+
x1: N,
|
|
717
|
+
y1: m,
|
|
718
|
+
x2: D + s + x,
|
|
719
|
+
y2: m,
|
|
721
720
|
itemIndex: c
|
|
722
|
-
}),
|
|
723
|
-
key: `${
|
|
724
|
-
x1:
|
|
725
|
-
y1:
|
|
726
|
-
x2:
|
|
727
|
-
y2:
|
|
721
|
+
}), y.isLastChild || (y.isDirectory ? E.push({
|
|
722
|
+
key: `${y.id}-connector-bottom`,
|
|
723
|
+
x1: N,
|
|
724
|
+
y1: m + v,
|
|
725
|
+
x2: N,
|
|
726
|
+
y2: k + g,
|
|
728
727
|
itemIndex: c
|
|
729
|
-
}) :
|
|
730
|
-
key: `${
|
|
731
|
-
x1:
|
|
732
|
-
y1:
|
|
733
|
-
x2:
|
|
734
|
-
y2:
|
|
728
|
+
}) : E.push({
|
|
729
|
+
key: `${y.id}-connector-bottom`,
|
|
730
|
+
x1: N,
|
|
731
|
+
y1: m,
|
|
732
|
+
x2: N,
|
|
733
|
+
y2: k + g,
|
|
735
734
|
itemIndex: c
|
|
736
|
-
})), l[c] =
|
|
737
|
-
const
|
|
738
|
-
|
|
735
|
+
})), l[c] = E, r && y.isDirectory) {
|
|
736
|
+
const b = f, h = N, j = m;
|
|
737
|
+
u[c] = [
|
|
739
738
|
{
|
|
740
|
-
key: `${
|
|
739
|
+
key: `${y.id}-glyph`,
|
|
741
740
|
itemIndex: c,
|
|
742
|
-
centerX:
|
|
743
|
-
centerY:
|
|
744
|
-
size:
|
|
745
|
-
isExpanded:
|
|
741
|
+
centerX: h,
|
|
742
|
+
centerY: j,
|
|
743
|
+
size: b,
|
|
744
|
+
isExpanded: y.isExpanded
|
|
746
745
|
}
|
|
747
746
|
];
|
|
748
747
|
}
|
|
749
748
|
}
|
|
750
|
-
return { segmentsByItem: l, glyphsByItem:
|
|
751
|
-
},
|
|
749
|
+
return { segmentsByItem: l, glyphsByItem: u };
|
|
750
|
+
}, Xe = ze(
|
|
752
751
|
({
|
|
753
752
|
entry: e,
|
|
754
753
|
indentLevel: t,
|
|
755
754
|
rowHeight: a,
|
|
756
|
-
isDirOpen:
|
|
755
|
+
isDirOpen: s,
|
|
757
756
|
parentIsLast: r,
|
|
758
757
|
renderChildren: o = !0,
|
|
759
|
-
expansion: { toggleDirectory: l, onToggleDirectoryRecursive:
|
|
760
|
-
selection: { onEntryClick: w, selectedPath: x, mode: c = "none", selectedItems:
|
|
758
|
+
expansion: { toggleDirectory: l, onToggleDirectoryRecursive: u },
|
|
759
|
+
selection: { onEntryClick: w, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: E },
|
|
761
760
|
visual: {
|
|
762
|
-
iconOverrides:
|
|
763
|
-
showExpandIcons:
|
|
764
|
-
showDirectoryIcons:
|
|
761
|
+
iconOverrides: g,
|
|
762
|
+
showExpandIcons: k = !0,
|
|
763
|
+
showDirectoryIcons: m = !0,
|
|
765
764
|
showFileIcons: f = !0,
|
|
766
765
|
useCanvasExpandIcons: v = !1,
|
|
767
|
-
expandIconSize:
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
766
|
+
expandIconSize: D,
|
|
767
|
+
typeIconSize: N,
|
|
768
|
+
fontSize: b,
|
|
769
|
+
indentSize: h = Oe,
|
|
770
|
+
highlightStyles: j,
|
|
771
|
+
entryClassName: T,
|
|
772
|
+
entryStyle: L,
|
|
773
|
+
nameClassName: U,
|
|
774
|
+
nameStyle: P,
|
|
775
|
+
directoryNameClassName: Y,
|
|
776
|
+
directoryNameStyle: F,
|
|
777
|
+
fileNameClassName: W,
|
|
778
|
+
fileNameStyle: Z
|
|
777
779
|
}
|
|
778
780
|
}) => {
|
|
779
|
-
const [
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
}, [
|
|
783
|
-
const
|
|
784
|
-
if (
|
|
785
|
-
if (
|
|
786
|
-
return
|
|
787
|
-
} else if (
|
|
788
|
-
return
|
|
781
|
+
const [z, se] = ne(null), [ae, A] = ne(!1), R = e.children !== void 0, $ = R && s(e.absolutePath), n = e.absolutePath === x, p = !R && y?.has(e.absolutePath), I = R ? void 0 : xe(e.name) || xe(e.relativePath) || xe(e.absolutePath);
|
|
782
|
+
de(() => {
|
|
783
|
+
se($ && e.children ? e.children : null);
|
|
784
|
+
}, [$, e.children]);
|
|
785
|
+
const _ = Ht({ entry: e, isDirectory: R, isExpanded: $, isItemSelected: !!p, selectionMode: c, onSelectionChange: E, onEntryClick: w, toggleDirectory: l, onToggleDirectoryRecursive: u }), Q = ae ? j?.hoverClassName !== void 0 ? j.hoverClassName : O.entryHover : "", ee = (() => {
|
|
786
|
+
if (R) {
|
|
787
|
+
if (n)
|
|
788
|
+
return j?.directorySelectedClassName !== void 0 ? j.directorySelectedClassName : O.entrySelected;
|
|
789
|
+
} else if (n || p)
|
|
790
|
+
return j?.itemSelectedClassName !== void 0 ? j.itemSelectedClassName : M(n && O.entrySelected, p && O.entryItemSelected);
|
|
789
791
|
return "";
|
|
790
|
-
})(),
|
|
791
|
-
...
|
|
792
|
-
...
|
|
793
|
-
...!
|
|
794
|
-
};
|
|
795
|
-
return /* @__PURE__ */ i.jsxs(
|
|
792
|
+
})(), C = M(O.entry, Q, ee, T, e.className), K = M(O.expandIcon, (n || p) && O.expandIconSelected), oe = M(O.typeIcon, (n || p) && O.typeIconSelected), G = M(O.name, U, R && O.nameDirectory, R && Y, !R && W, (n || p) && O.nameSelected), Ne = Ft({ isDirectory: R, isExpanded: $, showExpandIcons: k, useCanvasExpandIcons: v, expandIconSize: D }), je = (R ? m : f) ? $t({ entry: e, isDirectory: R, isExpanded: $, isSelected: n, isItemSelected: !!p, extension: I, mimeType: e.mimeType }, g) : null, De = {
|
|
793
|
+
...ae ? j?.hoverStyle : {},
|
|
794
|
+
...R && n ? j?.directorySelectedStyle : {},
|
|
795
|
+
...!R && (n || p) ? j?.itemSelectedStyle : {}
|
|
796
|
+
}, ve = N ? { width: N, height: N } : void 0, Ee = b ? { fontSize: typeof b == "number" ? `${b}px` : b } : void 0;
|
|
797
|
+
return /* @__PURE__ */ i.jsxs(nr, { children: [
|
|
796
798
|
/* @__PURE__ */ i.jsxs(
|
|
797
799
|
"div",
|
|
798
800
|
{
|
|
799
|
-
className:
|
|
801
|
+
className: C,
|
|
800
802
|
style: {
|
|
801
|
-
paddingLeft: `${Math.max(0, t *
|
|
802
|
-
transform: t < 0 ? `translateX(${t *
|
|
803
|
-
width: t < 0 ? `calc(100% + ${Math.abs(t *
|
|
803
|
+
paddingLeft: `${Math.max(0, t * h)}px`,
|
|
804
|
+
transform: t < 0 ? `translateX(${t * h}px)` : void 0,
|
|
805
|
+
width: t < 0 ? `calc(100% + ${Math.abs(t * h)}px)` : void 0,
|
|
804
806
|
height: `${a}px`,
|
|
805
|
-
...
|
|
806
|
-
...
|
|
807
|
+
...Ee,
|
|
808
|
+
...De,
|
|
809
|
+
...L,
|
|
807
810
|
...e.style
|
|
808
811
|
},
|
|
809
|
-
"data-entry-type":
|
|
810
|
-
"data-entry-expanded":
|
|
811
|
-
"data-entry-selected":
|
|
812
|
-
"data-entry-item-selected":
|
|
813
|
-
onClick:
|
|
814
|
-
onMouseEnter: () =>
|
|
815
|
-
onMouseLeave: () =>
|
|
816
|
-
onKeyDown: (
|
|
812
|
+
"data-entry-type": R ? "directory" : "file",
|
|
813
|
+
"data-entry-expanded": R ? String($) : void 0,
|
|
814
|
+
"data-entry-selected": n ? "true" : void 0,
|
|
815
|
+
"data-entry-item-selected": p ? "true" : void 0,
|
|
816
|
+
onClick: _,
|
|
817
|
+
onMouseEnter: () => A(!0),
|
|
818
|
+
onMouseLeave: () => A(!1),
|
|
819
|
+
onKeyDown: (ue) => ue.key === "Enter" && _(ue),
|
|
817
820
|
tabIndex: 0,
|
|
818
821
|
role: "treeitem",
|
|
819
|
-
"aria-expanded":
|
|
820
|
-
"aria-label": `${e.name} (${
|
|
822
|
+
"aria-expanded": R ? $ : void 0,
|
|
823
|
+
"aria-label": `${e.name} (${R ? "directory" : "file"})`,
|
|
821
824
|
children: [
|
|
822
|
-
(
|
|
823
|
-
(
|
|
825
|
+
(k || v) && /* @__PURE__ */ i.jsx("span", { className: K, children: Ne }),
|
|
826
|
+
(R ? m : f) && /* @__PURE__ */ i.jsx("span", { className: oe, style: ve, children: je }),
|
|
824
827
|
/* @__PURE__ */ i.jsx(
|
|
825
828
|
"span",
|
|
826
829
|
{
|
|
827
|
-
className:
|
|
830
|
+
className: G,
|
|
828
831
|
style: {
|
|
829
|
-
|
|
830
|
-
...
|
|
832
|
+
...Ee,
|
|
833
|
+
...P,
|
|
834
|
+
...R ? F : Z
|
|
831
835
|
},
|
|
832
|
-
"data-entry-type":
|
|
836
|
+
"data-entry-type": R ? "directory" : "file",
|
|
833
837
|
"data-entry-role": "name",
|
|
834
838
|
children: e.label ?? e.name
|
|
835
839
|
}
|
|
@@ -837,447 +841,451 @@ const jr = {
|
|
|
837
841
|
]
|
|
838
842
|
}
|
|
839
843
|
),
|
|
840
|
-
|
|
841
|
-
|
|
844
|
+
$ && z && o && /* @__PURE__ */ i.jsx("fieldset", { children: z.map((ue, Te) => /* @__PURE__ */ i.jsx(
|
|
845
|
+
Xe,
|
|
842
846
|
{
|
|
843
|
-
entry:
|
|
847
|
+
entry: ue,
|
|
844
848
|
indentLevel: t + 1,
|
|
845
849
|
rowHeight: a,
|
|
846
|
-
isDirOpen:
|
|
847
|
-
parentIsLast: [...r,
|
|
848
|
-
expansion: { toggleDirectory: l, onToggleDirectoryRecursive:
|
|
849
|
-
selection: { onEntryClick: w, selectedPath: x, mode: c, selectedItems:
|
|
850
|
+
isDirOpen: s,
|
|
851
|
+
parentIsLast: [...r, Te === z.length - 1],
|
|
852
|
+
expansion: { toggleDirectory: l, onToggleDirectoryRecursive: u },
|
|
853
|
+
selection: { onEntryClick: w, selectedPath: x, mode: c, selectedItems: y, onSelectionChange: E },
|
|
850
854
|
visual: {
|
|
851
|
-
iconOverrides:
|
|
852
|
-
showExpandIcons:
|
|
853
|
-
showDirectoryIcons:
|
|
855
|
+
iconOverrides: g,
|
|
856
|
+
showExpandIcons: k,
|
|
857
|
+
showDirectoryIcons: m,
|
|
854
858
|
showFileIcons: f,
|
|
855
859
|
useCanvasExpandIcons: v,
|
|
856
|
-
expandIconSize:
|
|
857
|
-
highlightStyles:
|
|
858
|
-
entryClassName:
|
|
859
|
-
entryStyle:
|
|
860
|
-
nameClassName:
|
|
861
|
-
nameStyle:
|
|
862
|
-
directoryNameClassName:
|
|
863
|
-
directoryNameStyle:
|
|
864
|
-
fileNameClassName:
|
|
865
|
-
fileNameStyle:
|
|
860
|
+
expandIconSize: D,
|
|
861
|
+
highlightStyles: j,
|
|
862
|
+
entryClassName: T,
|
|
863
|
+
entryStyle: L,
|
|
864
|
+
nameClassName: U,
|
|
865
|
+
nameStyle: P,
|
|
866
|
+
directoryNameClassName: Y,
|
|
867
|
+
directoryNameStyle: F,
|
|
868
|
+
fileNameClassName: W,
|
|
869
|
+
fileNameStyle: Z
|
|
866
870
|
}
|
|
867
871
|
},
|
|
868
|
-
|
|
872
|
+
ue.absolutePath
|
|
869
873
|
)) })
|
|
870
874
|
] }, e.absolutePath);
|
|
871
875
|
},
|
|
872
876
|
(e, t) => {
|
|
873
877
|
if (e.entry !== t.entry) return !1;
|
|
874
|
-
const a = e.entry.children !== void 0,
|
|
875
|
-
return e.indentLevel === t.indentLevel && e.rowHeight === t.rowHeight && r === o && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual.iconOverrides === t.visual.iconOverrides && e.visual.showExpandIcons === t.visual.showExpandIcons && e.visual.showDirectoryIcons === t.visual.showDirectoryIcons && e.visual.showFileIcons === t.visual.showFileIcons && e.visual.useCanvasExpandIcons === t.visual.useCanvasExpandIcons && e.visual.expandIconSize === t.visual.expandIconSize && e.visual.highlightStyles === t.visual.highlightStyles && e.visual.entryClassName === t.visual.entryClassName && e.visual.entryStyle === t.visual.entryStyle && e.visual.nameClassName === t.visual.nameClassName && e.visual.nameStyle === t.visual.nameStyle && e.visual.directoryNameClassName === t.visual.directoryNameClassName && e.visual.directoryNameStyle === t.visual.directoryNameStyle && e.visual.fileNameClassName === t.visual.fileNameClassName && e.visual.fileNameStyle === t.visual.fileNameStyle && e.parentIsLast.length === t.parentIsLast.length && e.parentIsLast.every((l,
|
|
878
|
+
const a = e.entry.children !== void 0, s = t.entry.children !== void 0, r = a && e.isDirOpen(e.entry.absolutePath), o = s && t.isDirOpen(t.entry.absolutePath);
|
|
879
|
+
return e.indentLevel === t.indentLevel && e.rowHeight === t.rowHeight && r === o && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual.iconOverrides === t.visual.iconOverrides && e.visual.showExpandIcons === t.visual.showExpandIcons && e.visual.showDirectoryIcons === t.visual.showDirectoryIcons && e.visual.showFileIcons === t.visual.showFileIcons && e.visual.useCanvasExpandIcons === t.visual.useCanvasExpandIcons && e.visual.expandIconSize === t.visual.expandIconSize && e.visual.highlightStyles === t.visual.highlightStyles && e.visual.entryClassName === t.visual.entryClassName && e.visual.entryStyle === t.visual.entryStyle && e.visual.nameClassName === t.visual.nameClassName && e.visual.nameStyle === t.visual.nameStyle && e.visual.directoryNameClassName === t.visual.directoryNameClassName && e.visual.directoryNameStyle === t.visual.directoryNameStyle && e.visual.fileNameClassName === t.visual.fileNameClassName && e.visual.fileNameStyle === t.visual.fileNameStyle && e.parentIsLast.length === t.parentIsLast.length && e.parentIsLast.every((l, u) => l === t.parentIsLast[u]);
|
|
876
880
|
}
|
|
877
881
|
);
|
|
878
|
-
|
|
879
|
-
const
|
|
882
|
+
Xe.displayName = "DirectoryEntryItem";
|
|
883
|
+
const Xt = (e) => {
|
|
880
884
|
const t = [];
|
|
881
885
|
if (e.children)
|
|
882
886
|
for (const a of e.children)
|
|
883
|
-
a.type === "directory" && (t.push(a.absolutePath), t.push(...
|
|
887
|
+
a.type === "directory" && (t.push(a.absolutePath), t.push(...Xt(a)));
|
|
884
888
|
return t;
|
|
885
|
-
},
|
|
889
|
+
}, Wr = ({
|
|
886
890
|
entries: e,
|
|
887
|
-
expansion: { toggle: t, isExpanded: a, expandMultiple:
|
|
888
|
-
selection: { onEntryClick: w, selectedPath: x, mode: c = "none", selectedItems:
|
|
891
|
+
expansion: { toggle: t, isExpanded: a, expandMultiple: s, collapseMultiple: r, isPending: o, alwaysExpanded: l = !1, doubleClickAction: u = "recursive" },
|
|
892
|
+
selection: { onEntryClick: w, selectedPath: x, mode: c = "none", selectedItems: y, onSelectionChange: E },
|
|
889
893
|
visual: {
|
|
890
|
-
className:
|
|
891
|
-
style:
|
|
892
|
-
lineColor:
|
|
894
|
+
className: g,
|
|
895
|
+
style: k,
|
|
896
|
+
lineColor: m = "#A0AEC0",
|
|
893
897
|
showTreeLines: f = !0,
|
|
894
898
|
showExpandIcons: v = !0,
|
|
895
|
-
showDirectoryIcons:
|
|
896
|
-
showFileIcons:
|
|
897
|
-
iconOverrides:
|
|
898
|
-
expandIconSize:
|
|
899
|
-
itemHeight:
|
|
900
|
-
removeRootIndent:
|
|
901
|
-
highlightStyles:
|
|
902
|
-
entryClassName:
|
|
903
|
-
entryStyle:
|
|
904
|
-
nameClassName:
|
|
905
|
-
nameStyle:
|
|
906
|
-
directoryNameClassName:
|
|
907
|
-
directoryNameStyle:
|
|
908
|
-
fileNameClassName:
|
|
909
|
-
fileNameStyle:
|
|
899
|
+
showDirectoryIcons: D = !0,
|
|
900
|
+
showFileIcons: N = !0,
|
|
901
|
+
iconOverrides: b,
|
|
902
|
+
expandIconSize: h,
|
|
903
|
+
itemHeight: j = Ae,
|
|
904
|
+
removeRootIndent: T = !1,
|
|
905
|
+
highlightStyles: L,
|
|
906
|
+
entryClassName: U,
|
|
907
|
+
entryStyle: P,
|
|
908
|
+
nameClassName: Y,
|
|
909
|
+
nameStyle: F,
|
|
910
|
+
directoryNameClassName: W,
|
|
911
|
+
directoryNameStyle: Z,
|
|
912
|
+
fileNameClassName: z,
|
|
913
|
+
fileNameStyle: se
|
|
910
914
|
} = {},
|
|
911
|
-
virtualScroll:
|
|
912
|
-
grid:
|
|
915
|
+
virtualScroll: ae,
|
|
916
|
+
grid: A,
|
|
917
|
+
sort: R
|
|
913
918
|
}) => {
|
|
914
|
-
const
|
|
915
|
-
overscanCount:
|
|
916
|
-
className:
|
|
917
|
-
background:
|
|
918
|
-
onScroll:
|
|
919
|
-
onRangeChange:
|
|
920
|
-
initialScrollIndex:
|
|
921
|
-
initialScrollOffset:
|
|
922
|
-
callbackThrottleMs:
|
|
923
|
-
contentInsets:
|
|
924
|
-
onItemFocus:
|
|
925
|
-
viewportHeightOverride:
|
|
926
|
-
scrollBarOptions:
|
|
919
|
+
const $ = A !== void 0, [n, p] = ne(!1), I = ce(null), _ = ce(null), Q = ce(null), [ee, C] = ne(0), [K, oe] = ne(0), [G, Ne] = ne(0), [je, De] = ne(null), {
|
|
920
|
+
overscanCount: ve = 15,
|
|
921
|
+
className: Ee,
|
|
922
|
+
background: ue,
|
|
923
|
+
onScroll: Te,
|
|
924
|
+
onRangeChange: Je,
|
|
925
|
+
initialScrollIndex: qe,
|
|
926
|
+
initialScrollOffset: le,
|
|
927
|
+
callbackThrottleMs: Ze = 5,
|
|
928
|
+
contentInsets: be,
|
|
929
|
+
onItemFocus: Ke,
|
|
930
|
+
viewportHeightOverride: re,
|
|
931
|
+
scrollBarOptions: Le,
|
|
927
932
|
behaviorOptions: Qe,
|
|
928
|
-
preserveScrollAnchor:
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
933
|
+
preserveScrollAnchor: et = !1,
|
|
934
|
+
getItemKey: Jt
|
|
935
|
+
} = ae ?? {}, [Re, Fe] = ne(typeof le == "number" ? le : 0), $e = ce(typeof le == "number" ? le : 0), tt = B(
|
|
936
|
+
(d, S) => {
|
|
937
|
+
$e.current = d, Fe(d), Te?.(d, S);
|
|
932
938
|
},
|
|
933
|
-
[
|
|
934
|
-
),
|
|
935
|
-
(
|
|
936
|
-
const { renderingStartIndex:
|
|
937
|
-
|
|
939
|
+
[Te]
|
|
940
|
+
), rt = B(
|
|
941
|
+
(d) => {
|
|
942
|
+
const { renderingStartIndex: S, renderingEndIndex: H } = d;
|
|
943
|
+
De((J) => J && J.renderStart === S && J.renderEnd === H ? J : { renderStart: S, renderEnd: H }), Je?.(d);
|
|
938
944
|
},
|
|
939
|
-
[
|
|
945
|
+
[Je]
|
|
940
946
|
);
|
|
941
|
-
|
|
942
|
-
typeof
|
|
943
|
-
}, [
|
|
944
|
-
|
|
945
|
-
}, []),
|
|
946
|
-
const
|
|
947
|
-
if (
|
|
948
|
-
const
|
|
949
|
-
|
|
947
|
+
de(() => {
|
|
948
|
+
typeof le == "number" && Fe(le);
|
|
949
|
+
}, [le]), de(() => {
|
|
950
|
+
p(!0), _r();
|
|
951
|
+
}, []), de(() => {
|
|
952
|
+
const d = I.current, S = $ ? _.current : d, H = () => {
|
|
953
|
+
if (d) {
|
|
954
|
+
const te = d.clientWidth;
|
|
955
|
+
oe((ie) => Math.abs(ie - te) > 1 ? te : ie);
|
|
950
956
|
}
|
|
951
|
-
if (typeof
|
|
952
|
-
|
|
953
|
-
else if (
|
|
954
|
-
const
|
|
955
|
-
|
|
957
|
+
if (typeof re == "number")
|
|
958
|
+
C((te) => Math.abs(te - re) > 1 ? re : te);
|
|
959
|
+
else if (S) {
|
|
960
|
+
const te = S.clientHeight;
|
|
961
|
+
C((ie) => Math.abs(ie - te) > 1 ? te : ie);
|
|
956
962
|
}
|
|
957
963
|
};
|
|
958
|
-
if (!(
|
|
959
|
-
|
|
960
|
-
const
|
|
961
|
-
return
|
|
962
|
-
}, [
|
|
963
|
-
const
|
|
964
|
+
if (!(d || S)) return C(0);
|
|
965
|
+
H();
|
|
966
|
+
const J = new ResizeObserver(H);
|
|
967
|
+
return d && J.observe(d), S && S !== d && J.observe(S), () => J.disconnect();
|
|
968
|
+
}, [re, $]);
|
|
969
|
+
const me = typeof re == "number" ? re : ee, fe = B((d) => l || (n ? a(d) : !1), [n, a, l]), nt = M(O.container, o && O.containerPending, g), st = q(
|
|
964
970
|
() => ({
|
|
965
|
-
...
|
|
966
|
-
...
|
|
967
|
-
...typeof
|
|
971
|
+
...Pr,
|
|
972
|
+
...k ?? {},
|
|
973
|
+
...typeof re == "number" ? { height: re, minHeight: re } : {}
|
|
968
974
|
}),
|
|
969
|
-
[
|
|
970
|
-
),
|
|
971
|
-
(
|
|
972
|
-
const
|
|
973
|
-
if (
|
|
974
|
-
if (
|
|
975
|
-
if (
|
|
976
|
-
console.warn(`[DirectoryTree] Unknown double click action: ${
|
|
975
|
+
[k, re]
|
|
976
|
+
), He = B(
|
|
977
|
+
(d, S) => {
|
|
978
|
+
const H = [d.absolutePath, ...Xt(d)], J = S || u;
|
|
979
|
+
if (H.every((ke) => fe(ke))) return r(H);
|
|
980
|
+
if (H.every((ke) => !fe(ke)) || J === "recursive") return s(H);
|
|
981
|
+
if (J === "toggle") return r(H);
|
|
982
|
+
console.warn(`[DirectoryTree] Unknown double click action: ${J}. No action taken.`);
|
|
977
983
|
},
|
|
978
|
-
[
|
|
979
|
-
),
|
|
980
|
-
() =>
|
|
981
|
-
const
|
|
982
|
-
return { ...
|
|
984
|
+
[fe, s, r, u]
|
|
985
|
+
), at = $ ? !1 : T, { flatItems: ot, lineItems: We, maxIndent: lt } = q(() => Mr(e, fe, f, at, R), [e, fe, f, at, R]), V = q(
|
|
986
|
+
() => ot.map((d, S) => {
|
|
987
|
+
const H = typeof j == "function" ? j(d.entry, S) : j;
|
|
988
|
+
return { ...d, rowHeight: Number.isFinite(H) && H > 0 ? H : Ae };
|
|
983
989
|
}),
|
|
984
|
-
[
|
|
985
|
-
),
|
|
986
|
-
const
|
|
987
|
-
|
|
988
|
-
for (let
|
|
989
|
-
|
|
990
|
-
return
|
|
991
|
-
}, [
|
|
992
|
-
() => !f ||
|
|
993
|
-
[
|
|
994
|
-
),
|
|
995
|
-
() =>
|
|
996
|
-
[
|
|
997
|
-
),
|
|
998
|
-
|
|
990
|
+
[ot, j]
|
|
991
|
+
), he = q(() => V.map((d) => d.rowHeight), [V]), ye = q(() => {
|
|
992
|
+
const d = new Array(he.length + 1);
|
|
993
|
+
d[0] = 0;
|
|
994
|
+
for (let S = 0; S < he.length; S++)
|
|
995
|
+
d[S + 1] = d[S] + he[S];
|
|
996
|
+
return d;
|
|
997
|
+
}, [he]), it = B((d) => V[d]?.rowHeight ?? Ae, [V]), qt = B((d) => V[d]?.entry.absolutePath ?? d, [V]), ct = Jt ?? qt, Ce = q(
|
|
998
|
+
() => !f || We.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : Or(We, he, ye, Oe, f, h ?? At),
|
|
999
|
+
[We, he, ye, f, h]
|
|
1000
|
+
), Pe = q(() => !f || e.length === 0 ? 0 : (lt + 2) * Oe, [e.length, lt, f]), { renderStart: dt, renderEnd: ut, lookaheadEnd: mt } = q(
|
|
1001
|
+
() => Ar(V.length, me, ve, je, Re, ye),
|
|
1002
|
+
[V.length, me, ve, je, Re, ye]
|
|
1003
|
+
), Be = q(() => !f || Pe <= 0 || me <= 0 || Ce.segmentsByItem.length === 0 ? null : /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ i.jsx("div", { className: "absolute top-0 left-0", style: { width: Pe, height: me }, children: /* @__PURE__ */ i.jsx(
|
|
1004
|
+
zt,
|
|
999
1005
|
{
|
|
1000
|
-
segmentsByItem:
|
|
1001
|
-
glyphsByItem:
|
|
1002
|
-
itemHeight:
|
|
1003
|
-
width:
|
|
1004
|
-
viewportHeight:
|
|
1005
|
-
scrollPosition:
|
|
1006
|
-
color:
|
|
1007
|
-
expandGlyphColor:
|
|
1008
|
-
expandGlyphSize:
|
|
1009
|
-
renderStartIndex:
|
|
1010
|
-
renderEndIndex:
|
|
1011
|
-
lookaheadEndIndex:
|
|
1006
|
+
segmentsByItem: Ce.segmentsByItem,
|
|
1007
|
+
glyphsByItem: Ce.glyphsByItem,
|
|
1008
|
+
itemHeight: he[0] ?? Ae,
|
|
1009
|
+
width: Pe,
|
|
1010
|
+
viewportHeight: me,
|
|
1011
|
+
scrollPosition: Re,
|
|
1012
|
+
color: m,
|
|
1013
|
+
expandGlyphColor: m,
|
|
1014
|
+
expandGlyphSize: h ?? At,
|
|
1015
|
+
renderStartIndex: dt,
|
|
1016
|
+
renderEndIndex: ut,
|
|
1017
|
+
lookaheadEndIndex: mt
|
|
1012
1018
|
}
|
|
1013
|
-
) }) }), [
|
|
1014
|
-
|
|
1015
|
-
const
|
|
1016
|
-
if (
|
|
1019
|
+
) }) }), [Pe, me, dt, ut, mt, Re, Ce, m, f, h, he]), ft = B((d) => V[d], [V]), ht = ce(null);
|
|
1020
|
+
rr(() => {
|
|
1021
|
+
const d = ht.current;
|
|
1022
|
+
if (ht.current = { items: V, offsets: ye }, !et || !d || d.items === V)
|
|
1017
1023
|
return;
|
|
1018
|
-
const
|
|
1019
|
-
if (!
|
|
1024
|
+
const S = Q.current, H = typeof be == "number" ? be : be?.top ?? 0, J = S ? S.getScrollPosition() : $e.current, te = J - H, ie = Nr(d.items, d.offsets, te);
|
|
1025
|
+
if (!ie)
|
|
1020
1026
|
return;
|
|
1021
|
-
const
|
|
1022
|
-
if (
|
|
1027
|
+
const ke = Er(ie, V, ye);
|
|
1028
|
+
if (ke === null)
|
|
1023
1029
|
return;
|
|
1024
|
-
const
|
|
1025
|
-
if (Math.abs(
|
|
1030
|
+
const Ye = ke + H;
|
|
1031
|
+
if (Math.abs(Ye - J) < 1)
|
|
1026
1032
|
return;
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
-
}, [
|
|
1030
|
-
const
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
}, [
|
|
1034
|
-
const
|
|
1035
|
-
() => ({ iconOverrides:
|
|
1036
|
-
[
|
|
1037
|
-
),
|
|
1033
|
+
const vt = S?.scrollTo(Ye) ?? Ye;
|
|
1034
|
+
$e.current = vt, Fe(vt);
|
|
1035
|
+
}, [V, ye, et, be]);
|
|
1036
|
+
const pe = A?.columns, ge = A?.scrollBarWidth ?? Le?.width ?? Ut, X = q(() => pe ? gr({ measuredWidth: K, columns: pe, scrollBarWidth: ge }) : null, [pe, K, ge]), _e = q(() => pe ? br(pe) : "", [pe]), Zt = q(() => A?.showFooter && pe ? wr(e) : [], [A?.showFooter, pe, e]), we = X?.maxHScroll ?? 0;
|
|
1037
|
+
de(() => {
|
|
1038
|
+
Ne((d) => Ge(d, we));
|
|
1039
|
+
}, [we]);
|
|
1040
|
+
const pt = B((d) => Ne((S) => Ge(S + d, we)), [we]), yt = q(
|
|
1041
|
+
() => ({ iconOverrides: b, showExpandIcons: v, showDirectoryIcons: D, showFileIcons: N, useCanvasExpandIcons: f, expandIconSize: h, highlightStyles: L }),
|
|
1042
|
+
[b, v, D, N, f, h, L]
|
|
1043
|
+
), xt = q(
|
|
1038
1044
|
() => /* @__PURE__ */ i.jsx(
|
|
1039
|
-
|
|
1045
|
+
ar,
|
|
1040
1046
|
{
|
|
1041
|
-
ref:
|
|
1042
|
-
itemCount:
|
|
1043
|
-
getItem:
|
|
1044
|
-
getItemHeight:
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1047
|
+
ref: Q,
|
|
1048
|
+
itemCount: V.length,
|
|
1049
|
+
getItem: ft,
|
|
1050
|
+
getItemHeight: it,
|
|
1051
|
+
getItemKey: ct,
|
|
1052
|
+
viewportSize: me,
|
|
1053
|
+
overscanCount: ve,
|
|
1054
|
+
onScroll: tt,
|
|
1055
|
+
onRangeChange: rt,
|
|
1056
|
+
className: Ee,
|
|
1057
|
+
onWheelHorizontal: $ ? pt : void 0,
|
|
1051
1058
|
background: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
1052
|
-
|
|
1059
|
+
$ && X ? (
|
|
1053
1060
|
// Clip the connector-line canvas to the frozen name column so deep trees never bleed into the numeric region.
|
|
1054
|
-
/* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width:
|
|
1055
|
-
) :
|
|
1056
|
-
|
|
1061
|
+
/* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: X.nameWidth }, "aria-hidden": "true", children: Be })
|
|
1062
|
+
) : Be,
|
|
1063
|
+
ue
|
|
1057
1064
|
] }),
|
|
1058
|
-
initialScrollIndex:
|
|
1059
|
-
initialScrollOffset:
|
|
1060
|
-
onItemFocus:
|
|
1061
|
-
callbackThrottleMs:
|
|
1062
|
-
contentInsets:
|
|
1063
|
-
scrollBarOptions:
|
|
1065
|
+
initialScrollIndex: qe,
|
|
1066
|
+
initialScrollOffset: le,
|
|
1067
|
+
onItemFocus: Ke,
|
|
1068
|
+
callbackThrottleMs: Ze,
|
|
1069
|
+
contentInsets: be,
|
|
1070
|
+
scrollBarOptions: Le,
|
|
1064
1071
|
behaviorOptions: Qe,
|
|
1065
|
-
children: (
|
|
1066
|
-
|
|
1072
|
+
children: (d) => d ? $ && A && X ? /* @__PURE__ */ i.jsx(
|
|
1073
|
+
Yt,
|
|
1067
1074
|
{
|
|
1068
|
-
entry:
|
|
1069
|
-
indentLevel:
|
|
1070
|
-
rowHeight:
|
|
1071
|
-
isDirOpen:
|
|
1072
|
-
columns:
|
|
1073
|
-
numericTemplate:
|
|
1074
|
-
numericTotal:
|
|
1075
|
-
nameWidth:
|
|
1076
|
-
rowClassName:
|
|
1077
|
-
selection: { onEntryClick: w, selectedPath: x ?? null, mode: c, selectedItems:
|
|
1078
|
-
expansion: { toggleDirectory: t, onToggleDirectoryRecursive:
|
|
1079
|
-
visual:
|
|
1075
|
+
entry: d.entry,
|
|
1076
|
+
indentLevel: d.indentLevel,
|
|
1077
|
+
rowHeight: d.rowHeight,
|
|
1078
|
+
isDirOpen: fe,
|
|
1079
|
+
columns: A.columns,
|
|
1080
|
+
numericTemplate: _e,
|
|
1081
|
+
numericTotal: X.numericTotal,
|
|
1082
|
+
nameWidth: X.nameWidth,
|
|
1083
|
+
rowClassName: A.rowClassName,
|
|
1084
|
+
selection: { onEntryClick: w, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: E },
|
|
1085
|
+
expansion: { toggleDirectory: t, onToggleDirectoryRecursive: He },
|
|
1086
|
+
visual: yt
|
|
1080
1087
|
},
|
|
1081
|
-
|
|
1088
|
+
d.entry.absolutePath
|
|
1082
1089
|
) : /* @__PURE__ */ i.jsx(
|
|
1083
|
-
|
|
1090
|
+
Xe,
|
|
1084
1091
|
{
|
|
1085
|
-
entry:
|
|
1086
|
-
indentLevel:
|
|
1087
|
-
rowHeight:
|
|
1088
|
-
isDirOpen:
|
|
1089
|
-
parentIsLast:
|
|
1092
|
+
entry: d.entry,
|
|
1093
|
+
indentLevel: d.indentLevel,
|
|
1094
|
+
rowHeight: d.rowHeight,
|
|
1095
|
+
isDirOpen: fe,
|
|
1096
|
+
parentIsLast: d.parentIsLast,
|
|
1090
1097
|
renderChildren: !1,
|
|
1091
|
-
expansion: { toggleDirectory: t, onToggleDirectoryRecursive:
|
|
1092
|
-
selection: { onEntryClick: w, selectedPath: x ?? null, mode: c, selectedItems:
|
|
1098
|
+
expansion: { toggleDirectory: t, onToggleDirectoryRecursive: He },
|
|
1099
|
+
selection: { onEntryClick: w, selectedPath: x ?? null, mode: c, selectedItems: y, onSelectionChange: E },
|
|
1093
1100
|
visual: {
|
|
1094
|
-
iconOverrides:
|
|
1101
|
+
iconOverrides: b,
|
|
1095
1102
|
showExpandIcons: v,
|
|
1096
|
-
showDirectoryIcons:
|
|
1097
|
-
showFileIcons:
|
|
1103
|
+
showDirectoryIcons: D,
|
|
1104
|
+
showFileIcons: N,
|
|
1098
1105
|
useCanvasExpandIcons: f,
|
|
1099
|
-
expandIconSize:
|
|
1100
|
-
highlightStyles:
|
|
1101
|
-
entryClassName:
|
|
1102
|
-
entryStyle:
|
|
1103
|
-
nameClassName:
|
|
1104
|
-
nameStyle:
|
|
1105
|
-
directoryNameClassName:
|
|
1106
|
-
directoryNameStyle:
|
|
1107
|
-
fileNameClassName:
|
|
1108
|
-
fileNameStyle:
|
|
1106
|
+
expandIconSize: h,
|
|
1107
|
+
highlightStyles: L,
|
|
1108
|
+
entryClassName: U,
|
|
1109
|
+
entryStyle: P,
|
|
1110
|
+
nameClassName: Y,
|
|
1111
|
+
nameStyle: F,
|
|
1112
|
+
directoryNameClassName: W,
|
|
1113
|
+
directoryNameStyle: Z,
|
|
1114
|
+
fileNameClassName: z,
|
|
1115
|
+
fileNameStyle: se
|
|
1109
1116
|
}
|
|
1110
1117
|
},
|
|
1111
|
-
|
|
1118
|
+
d.entry.absolutePath
|
|
1112
1119
|
) : null
|
|
1113
1120
|
}
|
|
1114
1121
|
),
|
|
1115
1122
|
[
|
|
1116
|
-
|
|
1117
|
-
ut,
|
|
1118
|
-
lt,
|
|
1119
|
-
ue,
|
|
1120
|
-
Se,
|
|
1121
|
-
et,
|
|
1122
|
-
tt,
|
|
1123
|
-
Ge,
|
|
1124
|
-
F,
|
|
1123
|
+
V.length,
|
|
1125
1124
|
ft,
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
Je,
|
|
1130
|
-
oe,
|
|
1131
|
-
Ze,
|
|
1132
|
-
qe,
|
|
1125
|
+
it,
|
|
1126
|
+
ct,
|
|
1127
|
+
me,
|
|
1133
1128
|
ve,
|
|
1134
|
-
|
|
1129
|
+
tt,
|
|
1130
|
+
rt,
|
|
1131
|
+
Ee,
|
|
1132
|
+
$,
|
|
1133
|
+
pt,
|
|
1134
|
+
X,
|
|
1135
|
+
Be,
|
|
1136
|
+
ue,
|
|
1137
|
+
qe,
|
|
1138
|
+
le,
|
|
1139
|
+
Ke,
|
|
1140
|
+
Ze,
|
|
1141
|
+
be,
|
|
1142
|
+
Le,
|
|
1135
1143
|
Qe,
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1144
|
+
A,
|
|
1145
|
+
_e,
|
|
1146
|
+
fe,
|
|
1139
1147
|
w,
|
|
1140
1148
|
x,
|
|
1141
1149
|
c,
|
|
1142
|
-
|
|
1143
|
-
|
|
1150
|
+
y,
|
|
1151
|
+
E,
|
|
1144
1152
|
t,
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1153
|
+
He,
|
|
1154
|
+
yt,
|
|
1155
|
+
b,
|
|
1148
1156
|
v,
|
|
1149
|
-
O,
|
|
1150
|
-
g,
|
|
1151
|
-
f,
|
|
1152
|
-
p,
|
|
1153
1157
|
D,
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1158
|
+
N,
|
|
1159
|
+
f,
|
|
1160
|
+
h,
|
|
1157
1161
|
L,
|
|
1158
|
-
|
|
1159
|
-
|
|
1162
|
+
U,
|
|
1163
|
+
P,
|
|
1164
|
+
Y,
|
|
1165
|
+
F,
|
|
1166
|
+
W,
|
|
1160
1167
|
Z,
|
|
1161
|
-
|
|
1168
|
+
z,
|
|
1169
|
+
se
|
|
1162
1170
|
]
|
|
1163
1171
|
);
|
|
1164
|
-
if (!(
|
|
1165
|
-
return /* @__PURE__ */ i.jsx("div", { ref:
|
|
1166
|
-
const
|
|
1167
|
-
return /* @__PURE__ */ i.jsxs("div", { ref:
|
|
1168
|
-
|
|
1169
|
-
/* @__PURE__ */ i.jsx("div", { ref:
|
|
1170
|
-
|
|
1171
|
-
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width:
|
|
1172
|
+
if (!(A && X))
|
|
1173
|
+
return /* @__PURE__ */ i.jsx("div", { ref: I, className: nt, style: st, role: "tree", children: xt });
|
|
1174
|
+
const Kt = A.showHeader ?? !0, Qt = A.showFooter ?? !1, er = { ...st, "--dt-hscroll": `${G}px` };
|
|
1175
|
+
return /* @__PURE__ */ i.jsxs("div", { ref: I, className: M(nt, "dt-grid"), style: er, role: "treegrid", children: [
|
|
1176
|
+
Kt && /* @__PURE__ */ i.jsx(yr, { columns: A.columns, numericTemplate: _e, numericTotal: X.numericTotal, nameWidth: X.nameWidth, scrollBarWidth: ge, className: A.headerClassName }),
|
|
1177
|
+
/* @__PURE__ */ i.jsx("div", { ref: _, className: "dt-grid-body", children: xt }),
|
|
1178
|
+
we > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
|
|
1179
|
+
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: X.nameWidth }, "aria-hidden": "true" }),
|
|
1172
1180
|
/* @__PURE__ */ i.jsx(
|
|
1173
|
-
|
|
1181
|
+
or,
|
|
1174
1182
|
{
|
|
1175
1183
|
horizontal: !0,
|
|
1176
|
-
contentSize:
|
|
1177
|
-
viewportSize:
|
|
1178
|
-
scrollPosition:
|
|
1179
|
-
scrollBarWidth:
|
|
1180
|
-
onScroll: (
|
|
1181
|
-
const
|
|
1182
|
-
return
|
|
1184
|
+
contentSize: X.numericTotal,
|
|
1185
|
+
viewportSize: X.numericVisible,
|
|
1186
|
+
scrollPosition: G,
|
|
1187
|
+
scrollBarWidth: ge,
|
|
1188
|
+
onScroll: (d) => {
|
|
1189
|
+
const S = typeof d == "function" ? d(G) : d, H = Ge(S, we);
|
|
1190
|
+
return Ne(H), H;
|
|
1183
1191
|
}
|
|
1184
1192
|
}
|
|
1185
1193
|
),
|
|
1186
|
-
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width:
|
|
1194
|
+
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: ge }, "aria-hidden": "true" })
|
|
1187
1195
|
] }),
|
|
1188
|
-
|
|
1196
|
+
Qt && /* @__PURE__ */ i.jsx(xr, { columns: A.columns, numericTemplate: _e, numericTotal: X.numericTotal, nameWidth: X.nameWidth, scrollBarWidth: ge, allEntries: Zt, className: A.footerClassName })
|
|
1189
1197
|
] });
|
|
1190
|
-
},
|
|
1191
|
-
const [a,
|
|
1198
|
+
}, Br = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
|
|
1199
|
+
const [a, s] = sr(), [r, o] = ne(() => {
|
|
1192
1200
|
if (typeof window < "u" && t)
|
|
1193
1201
|
try {
|
|
1194
|
-
const
|
|
1195
|
-
if (
|
|
1196
|
-
const f = JSON.parse(
|
|
1202
|
+
const m = window.localStorage.getItem(t);
|
|
1203
|
+
if (m) {
|
|
1204
|
+
const f = JSON.parse(m);
|
|
1197
1205
|
return new Set(f);
|
|
1198
1206
|
}
|
|
1199
|
-
} catch (
|
|
1200
|
-
console.error("[useDirectoryTreeState] Error reading from localStorage",
|
|
1207
|
+
} catch (m) {
|
|
1208
|
+
console.error("[useDirectoryTreeState] Error reading from localStorage", m);
|
|
1201
1209
|
}
|
|
1202
1210
|
return e;
|
|
1203
|
-
}), l = B((
|
|
1204
|
-
|
|
1211
|
+
}), l = B((m) => {
|
|
1212
|
+
s(() => {
|
|
1205
1213
|
o((f) => {
|
|
1206
1214
|
const v = new Set(f);
|
|
1207
|
-
return
|
|
1215
|
+
return m(v), v;
|
|
1208
1216
|
});
|
|
1209
1217
|
});
|
|
1210
|
-
}, []),
|
|
1211
|
-
(
|
|
1218
|
+
}, []), u = B(
|
|
1219
|
+
(m, f) => {
|
|
1212
1220
|
l((v) => {
|
|
1213
|
-
for (const
|
|
1214
|
-
f(v,
|
|
1221
|
+
for (const D of m)
|
|
1222
|
+
f(v, D);
|
|
1215
1223
|
});
|
|
1216
1224
|
},
|
|
1217
1225
|
[l]
|
|
1218
1226
|
);
|
|
1219
|
-
|
|
1227
|
+
de(() => {
|
|
1220
1228
|
if (t && typeof window < "u")
|
|
1221
1229
|
try {
|
|
1222
1230
|
window.localStorage.setItem(t, JSON.stringify(Array.from(r)));
|
|
1223
|
-
} catch (
|
|
1224
|
-
console.warn(`Error setting localStorage key "${t}":`,
|
|
1231
|
+
} catch (m) {
|
|
1232
|
+
console.warn(`Error setting localStorage key "${t}":`, m);
|
|
1225
1233
|
}
|
|
1226
1234
|
}, [r, t]);
|
|
1227
1235
|
const w = B(
|
|
1228
|
-
(
|
|
1229
|
-
|
|
1236
|
+
(m) => {
|
|
1237
|
+
u([m], (f, v) => {
|
|
1230
1238
|
f.has(v) ? f.delete(v) : f.add(v);
|
|
1231
1239
|
});
|
|
1232
1240
|
},
|
|
1233
|
-
[
|
|
1241
|
+
[u]
|
|
1234
1242
|
), x = B(
|
|
1235
|
-
(
|
|
1236
|
-
|
|
1243
|
+
(m) => {
|
|
1244
|
+
u([m], (f, v) => {
|
|
1237
1245
|
f.add(v);
|
|
1238
1246
|
});
|
|
1239
1247
|
},
|
|
1240
|
-
[
|
|
1248
|
+
[u]
|
|
1241
1249
|
), c = B(
|
|
1242
|
-
(
|
|
1243
|
-
|
|
1250
|
+
(m) => {
|
|
1251
|
+
u([m], (f, v) => {
|
|
1244
1252
|
f.delete(v);
|
|
1245
1253
|
});
|
|
1246
1254
|
},
|
|
1247
|
-
[
|
|
1248
|
-
),
|
|
1249
|
-
(
|
|
1250
|
-
|
|
1255
|
+
[u]
|
|
1256
|
+
), y = B(
|
|
1257
|
+
(m) => {
|
|
1258
|
+
u(m, (f, v) => {
|
|
1251
1259
|
f.delete(v);
|
|
1252
1260
|
});
|
|
1253
1261
|
},
|
|
1254
|
-
[
|
|
1255
|
-
),
|
|
1256
|
-
(
|
|
1257
|
-
|
|
1262
|
+
[u]
|
|
1263
|
+
), E = B(
|
|
1264
|
+
(m) => {
|
|
1265
|
+
u(m, (f, v) => {
|
|
1258
1266
|
f.add(v);
|
|
1259
1267
|
});
|
|
1260
1268
|
},
|
|
1261
|
-
[
|
|
1262
|
-
),
|
|
1263
|
-
l((
|
|
1264
|
-
|
|
1269
|
+
[u]
|
|
1270
|
+
), g = B(() => {
|
|
1271
|
+
l((m) => {
|
|
1272
|
+
m.clear();
|
|
1265
1273
|
});
|
|
1266
|
-
}, [l]),
|
|
1274
|
+
}, [l]), k = B((m) => r.has(m), [r]);
|
|
1267
1275
|
return {
|
|
1268
1276
|
expanded: r,
|
|
1269
1277
|
toggle: w,
|
|
1270
1278
|
expand: x,
|
|
1271
1279
|
collapse: c,
|
|
1272
|
-
collapseMultiple:
|
|
1273
|
-
expandMultiple:
|
|
1274
|
-
collapseAll:
|
|
1275
|
-
isExpanded:
|
|
1280
|
+
collapseMultiple: y,
|
|
1281
|
+
expandMultiple: E,
|
|
1282
|
+
collapseAll: g,
|
|
1283
|
+
isExpanded: k,
|
|
1276
1284
|
isPending: a
|
|
1277
1285
|
};
|
|
1278
1286
|
};
|
|
1279
1287
|
export {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1288
|
+
Wr as DirectoryTree,
|
|
1289
|
+
O as directoryTreeClasses,
|
|
1290
|
+
Br as useDirectoryTreeState
|
|
1283
1291
|
};
|