@aiquants/directory-tree 2.0.0 → 2.3.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/README.md +54 -11
- package/dist/directory-tree.css +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +679 -589
- package/dist/src/DirectoryTree.d.ts +1 -1
- package/dist/src/DirectoryTree.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/types.d.ts +57 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/styles/directory-tree.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { VirtualScroll as
|
|
3
|
-
import { FolderIcon as
|
|
4
|
-
import { FileIcon as
|
|
5
|
-
import { twMerge as
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
if (
|
|
10
|
-
|
|
1
|
+
import et, { memo as Ye, useRef as fe, useCallback as C, useEffect as oe, useState as ie, useMemo as ee, Fragment as tt, useTransition as rt } from "react";
|
|
2
|
+
import { VirtualScroll as nt } from "@aiquants/virtualscroll";
|
|
3
|
+
import { FolderIcon as ot, DocumentTextIcon as st, ChevronDownIcon as at, ChevronRightIcon as lt } from "@heroicons/react/24/solid";
|
|
4
|
+
import { FileIcon as it } from "@phosphor-icons/react";
|
|
5
|
+
import { twMerge as Y } from "tailwind-merge";
|
|
6
|
+
var xe = { exports: {} }, me = {};
|
|
7
|
+
var $e;
|
|
8
|
+
function ct() {
|
|
9
|
+
if ($e) return me;
|
|
10
|
+
$e = 1;
|
|
11
11
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
12
|
-
function
|
|
13
|
-
var
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
for (var m in
|
|
17
|
-
m !== "key" && (
|
|
18
|
-
} else
|
|
19
|
-
return
|
|
12
|
+
function a(n, o, l) {
|
|
13
|
+
var s = null;
|
|
14
|
+
if (l !== void 0 && (s = "" + l), o.key !== void 0 && (s = "" + o.key), "key" in o) {
|
|
15
|
+
l = {};
|
|
16
|
+
for (var m in o)
|
|
17
|
+
m !== "key" && (l[m] = o[m]);
|
|
18
|
+
} else l = o;
|
|
19
|
+
return o = l.ref, {
|
|
20
20
|
$$typeof: e,
|
|
21
|
-
type:
|
|
22
|
-
key:
|
|
23
|
-
ref:
|
|
24
|
-
props:
|
|
21
|
+
type: n,
|
|
22
|
+
key: s,
|
|
23
|
+
ref: o !== void 0 ? o : null,
|
|
24
|
+
props: l
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return me.Fragment = r, me.jsx = a, me.jsxs = a, me;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
return
|
|
29
|
+
var he = {};
|
|
30
|
+
var De;
|
|
31
|
+
function ut() {
|
|
32
|
+
return De || (De = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
33
33
|
function e(t) {
|
|
34
34
|
if (t == null) return null;
|
|
35
35
|
if (typeof t == "function")
|
|
36
|
-
return t.$$typeof ===
|
|
36
|
+
return t.$$typeof === q ? null : t.displayName || t.name || null;
|
|
37
37
|
if (typeof t == "string") return t;
|
|
38
38
|
switch (t) {
|
|
39
|
-
case
|
|
39
|
+
case u:
|
|
40
40
|
return "Fragment";
|
|
41
|
-
case
|
|
41
|
+
case j:
|
|
42
42
|
return "Profiler";
|
|
43
|
-
case
|
|
43
|
+
case p:
|
|
44
44
|
return "StrictMode";
|
|
45
|
-
case
|
|
45
|
+
case P:
|
|
46
46
|
return "Suspense";
|
|
47
|
-
case
|
|
47
|
+
case T:
|
|
48
48
|
return "SuspenseList";
|
|
49
|
-
case
|
|
49
|
+
case U:
|
|
50
50
|
return "Activity";
|
|
51
51
|
}
|
|
52
52
|
if (typeof t == "object")
|
|
53
53
|
switch (typeof t.tag == "number" && console.error(
|
|
54
54
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
55
55
|
), t.$$typeof) {
|
|
56
|
-
case
|
|
56
|
+
case i:
|
|
57
57
|
return "Portal";
|
|
58
|
-
case
|
|
58
|
+
case g:
|
|
59
59
|
return t.displayName || "Context";
|
|
60
|
-
case
|
|
60
|
+
case v:
|
|
61
61
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
62
62
|
case d:
|
|
63
|
-
var
|
|
64
|
-
return t = t.displayName, t || (t =
|
|
65
|
-
case
|
|
66
|
-
return
|
|
67
|
-
case
|
|
68
|
-
|
|
63
|
+
var f = t.render;
|
|
64
|
+
return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
65
|
+
case A:
|
|
66
|
+
return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
|
|
67
|
+
case X:
|
|
68
|
+
f = t._payload, t = t._init;
|
|
69
69
|
try {
|
|
70
|
-
return e(t(
|
|
70
|
+
return e(t(f));
|
|
71
71
|
} catch {
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -76,77 +76,77 @@ function qe() {
|
|
|
76
76
|
function r(t) {
|
|
77
77
|
return "" + t;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function a(t) {
|
|
80
80
|
try {
|
|
81
81
|
r(t);
|
|
82
|
-
var
|
|
82
|
+
var f = !1;
|
|
83
83
|
} catch {
|
|
84
|
-
|
|
84
|
+
f = !0;
|
|
85
85
|
}
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
var
|
|
89
|
-
return
|
|
90
|
-
|
|
86
|
+
if (f) {
|
|
87
|
+
f = console;
|
|
88
|
+
var x = f.error, k = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
89
|
+
return x.call(
|
|
90
|
+
f,
|
|
91
91
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
92
92
|
k
|
|
93
93
|
), r(t);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
if (t ===
|
|
98
|
-
if (typeof t == "object" && t !== null && t.$$typeof ===
|
|
96
|
+
function n(t) {
|
|
97
|
+
if (t === u) return "<>";
|
|
98
|
+
if (typeof t == "object" && t !== null && t.$$typeof === X)
|
|
99
99
|
return "<...>";
|
|
100
100
|
try {
|
|
101
|
-
var
|
|
102
|
-
return
|
|
101
|
+
var f = e(t);
|
|
102
|
+
return f ? "<" + f + ">" : "<...>";
|
|
103
103
|
} catch {
|
|
104
104
|
return "<...>";
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
var t =
|
|
107
|
+
function o() {
|
|
108
|
+
var t = $.A;
|
|
109
109
|
return t === null ? null : t.getOwner();
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function l() {
|
|
112
112
|
return Error("react-stack-top-frame");
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
if (
|
|
116
|
-
var
|
|
117
|
-
if (
|
|
114
|
+
function s(t) {
|
|
115
|
+
if (V.call(t, "key")) {
|
|
116
|
+
var f = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
117
|
+
if (f && f.isReactWarning) return !1;
|
|
118
118
|
}
|
|
119
119
|
return t.key !== void 0;
|
|
120
120
|
}
|
|
121
|
-
function m(t,
|
|
122
|
-
function
|
|
123
|
-
|
|
121
|
+
function m(t, f) {
|
|
122
|
+
function x() {
|
|
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
|
+
f
|
|
126
126
|
));
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
get:
|
|
128
|
+
x.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
129
|
+
get: x,
|
|
130
130
|
configurable: !0
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function R() {
|
|
134
134
|
var t = e(this.type);
|
|
135
|
-
return
|
|
135
|
+
return S[t] || (S[t] = !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
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
var
|
|
139
|
+
function w(t, f, x, k, te, Q) {
|
|
140
|
+
var _ = x.ref;
|
|
141
141
|
return t = {
|
|
142
|
-
$$typeof:
|
|
142
|
+
$$typeof: I,
|
|
143
143
|
type: t,
|
|
144
|
-
key:
|
|
145
|
-
props:
|
|
144
|
+
key: f,
|
|
145
|
+
props: x,
|
|
146
146
|
_owner: k
|
|
147
|
-
}, (
|
|
147
|
+
}, (_ !== void 0 ? _ : null) !== null ? Object.defineProperty(t, "ref", {
|
|
148
148
|
enumerable: !1,
|
|
149
|
-
get:
|
|
149
|
+
get: R
|
|
150
150
|
}) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
|
|
151
151
|
configurable: !1,
|
|
152
152
|
enumerable: !1,
|
|
@@ -166,28 +166,28 @@ function qe() {
|
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
168
168
|
writable: !0,
|
|
169
|
-
value:
|
|
169
|
+
value: Q
|
|
170
170
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
171
171
|
}
|
|
172
|
-
function c(t,
|
|
173
|
-
var
|
|
174
|
-
if (
|
|
172
|
+
function c(t, f, x, k, te, Q) {
|
|
173
|
+
var _ = f.children;
|
|
174
|
+
if (_ !== void 0)
|
|
175
175
|
if (k)
|
|
176
|
-
if (
|
|
177
|
-
for (k = 0; k <
|
|
178
|
-
|
|
179
|
-
Object.freeze && Object.freeze(
|
|
176
|
+
if (Z(_)) {
|
|
177
|
+
for (k = 0; k < _.length; k++)
|
|
178
|
+
h(_[k]);
|
|
179
|
+
Object.freeze && Object.freeze(_);
|
|
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 h(_);
|
|
185
|
+
if (V.call(f, "key")) {
|
|
186
|
+
_ = e(t);
|
|
187
|
+
var J = Object.keys(f).filter(function(ce) {
|
|
188
|
+
return ce !== "key";
|
|
189
189
|
});
|
|
190
|
-
k = 0 <
|
|
190
|
+
k = 0 < J.length ? "{key: someKey, " + J.join(": ..., ") + ": ...}" : "{key: someKey}", O[_ + k] || (J = 0 < J.length ? "{" + J.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,328 +195,337 @@ React keys must be passed directly to JSX without using spread:
|
|
|
195
195
|
let props = %s;
|
|
196
196
|
<%s key={someKey} {...props} />`,
|
|
197
197
|
k,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
),
|
|
198
|
+
_,
|
|
199
|
+
J,
|
|
200
|
+
_
|
|
201
|
+
), O[_ + k] = !0);
|
|
202
202
|
}
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
for (var
|
|
206
|
-
|
|
207
|
-
} else
|
|
208
|
-
return
|
|
209
|
-
|
|
203
|
+
if (_ = null, x !== void 0 && (a(x), _ = "" + x), s(f) && (a(f.key), _ = "" + f.key), "key" in f) {
|
|
204
|
+
x = {};
|
|
205
|
+
for (var re in f)
|
|
206
|
+
re !== "key" && (x[re] = f[re]);
|
|
207
|
+
} else x = f;
|
|
208
|
+
return _ && m(
|
|
209
|
+
x,
|
|
210
210
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
211
|
-
),
|
|
211
|
+
), w(
|
|
212
212
|
t,
|
|
213
|
+
_,
|
|
213
214
|
x,
|
|
214
|
-
|
|
215
|
-
n(),
|
|
215
|
+
o(),
|
|
216
216
|
te,
|
|
217
|
-
|
|
217
|
+
Q
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
|
|
220
|
+
function h(t) {
|
|
221
|
+
y(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === X && (t._payload.status === "fulfilled" ? y(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
return typeof t == "object" && t !== null && t.$$typeof ===
|
|
223
|
+
function y(t) {
|
|
224
|
+
return typeof t == "object" && t !== null && t.$$typeof === I;
|
|
225
225
|
}
|
|
226
|
-
var
|
|
226
|
+
var E = et, I = /* @__PURE__ */ Symbol.for("react.transitional.element"), i = /* @__PURE__ */ Symbol.for("react.portal"), u = /* @__PURE__ */ Symbol.for("react.fragment"), p = /* @__PURE__ */ Symbol.for("react.strict_mode"), j = /* @__PURE__ */ Symbol.for("react.profiler"), v = /* @__PURE__ */ Symbol.for("react.consumer"), g = /* @__PURE__ */ Symbol.for("react.context"), d = /* @__PURE__ */ Symbol.for("react.forward_ref"), P = /* @__PURE__ */ Symbol.for("react.suspense"), T = /* @__PURE__ */ Symbol.for("react.suspense_list"), A = /* @__PURE__ */ Symbol.for("react.memo"), X = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.activity"), q = /* @__PURE__ */ Symbol.for("react.client.reference"), $ = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, Z = Array.isArray, G = console.createTask ? console.createTask : function() {
|
|
227
227
|
return null;
|
|
228
228
|
};
|
|
229
|
-
|
|
229
|
+
E = {
|
|
230
230
|
react_stack_bottom_frame: function(t) {
|
|
231
231
|
return t();
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
var
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
)(),
|
|
238
|
-
|
|
239
|
-
var k = 1e4 >
|
|
234
|
+
var se, S = {}, D = E.react_stack_bottom_frame.bind(
|
|
235
|
+
E,
|
|
236
|
+
l
|
|
237
|
+
)(), L = G(n(l)), O = {};
|
|
238
|
+
he.Fragment = u, he.jsx = function(t, f, x) {
|
|
239
|
+
var k = 1e4 > $.recentlyCreatedOwnerStacks++;
|
|
240
240
|
return c(
|
|
241
241
|
t,
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
f,
|
|
243
|
+
x,
|
|
244
244
|
!1,
|
|
245
|
-
k ? Error("react-stack-top-frame") :
|
|
246
|
-
k ?
|
|
245
|
+
k ? Error("react-stack-top-frame") : D,
|
|
246
|
+
k ? G(n(t)) : L
|
|
247
247
|
);
|
|
248
|
-
},
|
|
249
|
-
var k = 1e4 >
|
|
248
|
+
}, he.jsxs = function(t, f, x) {
|
|
249
|
+
var k = 1e4 > $.recentlyCreatedOwnerStacks++;
|
|
250
250
|
return c(
|
|
251
251
|
t,
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
f,
|
|
253
|
+
x,
|
|
254
254
|
!0,
|
|
255
|
-
k ? Error("react-stack-top-frame") :
|
|
256
|
-
k ?
|
|
255
|
+
k ? Error("react-stack-top-frame") : D,
|
|
256
|
+
k ? G(n(t)) : L
|
|
257
257
|
);
|
|
258
258
|
};
|
|
259
|
-
})()),
|
|
259
|
+
})()), he;
|
|
260
260
|
}
|
|
261
|
-
var
|
|
262
|
-
function
|
|
263
|
-
return
|
|
261
|
+
var Le;
|
|
262
|
+
function dt() {
|
|
263
|
+
return Le || (Le = 1, process.env.NODE_ENV === "production" ? xe.exports = ct() : xe.exports = ut()), xe.exports;
|
|
264
264
|
}
|
|
265
|
-
var
|
|
266
|
-
const
|
|
267
|
-
const
|
|
268
|
-
for (let
|
|
269
|
-
const
|
|
270
|
-
if (!(!
|
|
271
|
-
for (const
|
|
272
|
-
|
|
265
|
+
var N = dt();
|
|
266
|
+
const ft = (e, r, a) => {
|
|
267
|
+
const n = [];
|
|
268
|
+
for (let o = r; o < a; o++) {
|
|
269
|
+
const l = e[o];
|
|
270
|
+
if (!(!l || l.length === 0))
|
|
271
|
+
for (const s of l)
|
|
272
|
+
n.push(s);
|
|
273
273
|
}
|
|
274
|
-
return
|
|
275
|
-
},
|
|
276
|
-
const
|
|
277
|
-
for (let
|
|
278
|
-
const
|
|
279
|
-
if (!(!
|
|
280
|
-
for (const
|
|
281
|
-
|
|
274
|
+
return n;
|
|
275
|
+
}, mt = (e, r, a) => {
|
|
276
|
+
const n = [];
|
|
277
|
+
for (let o = r; o < a; o++) {
|
|
278
|
+
const l = e[o];
|
|
279
|
+
if (!(!l || l.length === 0))
|
|
280
|
+
for (const s of l)
|
|
281
|
+
n.push(s);
|
|
282
282
|
}
|
|
283
|
-
return
|
|
284
|
-
},
|
|
285
|
-
const
|
|
286
|
-
(e.width !==
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
},
|
|
290
|
-
e.lineWidth =
|
|
291
|
-
for (const
|
|
292
|
-
e.moveTo(
|
|
283
|
+
return n;
|
|
284
|
+
}, ht = (e, r, a, n) => {
|
|
285
|
+
const o = Math.max(1, Math.floor(r * n)), l = Math.max(1, Math.floor(a * n));
|
|
286
|
+
(e.width !== o || e.height !== l) && (e.width = o, e.height = l);
|
|
287
|
+
const s = e.style;
|
|
288
|
+
s.width !== `${r}px` && (s.width = `${r}px`), s.height !== `${a}px` && (s.height = `${a}px`);
|
|
289
|
+
}, yt = (e, r, a) => {
|
|
290
|
+
e.lineWidth = a, e.beginPath();
|
|
291
|
+
for (const n of r)
|
|
292
|
+
e.moveTo(n.x1, n.y1), e.lineTo(n.x2, n.y2);
|
|
293
293
|
e.stroke();
|
|
294
|
-
},
|
|
295
|
-
const
|
|
296
|
-
if (!
|
|
294
|
+
}, pt = (e, r) => {
|
|
295
|
+
const a = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
296
|
+
if (!a)
|
|
297
297
|
return null;
|
|
298
|
-
let
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
return `rgba(${
|
|
302
|
-
},
|
|
298
|
+
let n = a[1];
|
|
299
|
+
n.length === 3 && (n = n.split("").map((m) => m + m).join(""));
|
|
300
|
+
const o = Number.parseInt(n.slice(0, 2), 16), l = Number.parseInt(n.slice(2, 4), 16), s = Number.parseInt(n.slice(4, 6), 16);
|
|
301
|
+
return `rgba(${o}, ${l}, ${s}, ${r})`;
|
|
302
|
+
}, bt = (e, r, a, n) => {
|
|
303
303
|
if (r.length === 0)
|
|
304
304
|
return;
|
|
305
|
-
const
|
|
306
|
-
e.strokeStyle =
|
|
305
|
+
const o = pt(a, 0.14), l = e.strokeStyle, s = e.fillStyle, m = e.lineWidth, R = e.lineCap, w = e.lineJoin;
|
|
306
|
+
e.strokeStyle = a, e.lineCap = "round", e.lineJoin = "round";
|
|
307
307
|
for (const c of r) {
|
|
308
|
-
const
|
|
309
|
-
|
|
308
|
+
const h = n ?? c.size, y = Math.max(0, h / 2), E = Math.max(1, Math.round(h * 0.08)), I = Math.max(1, Math.round(h * 0.14)), i = Math.max(0, y - E * 0.8), u = Math.max(0, i * 0.55);
|
|
309
|
+
o && (e.fillStyle = o, e.beginPath(), e.arc(c.centerX, c.centerY, i, 0, Math.PI * 2), e.fill()), e.lineWidth = E, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, y - E * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = I, e.beginPath(), e.moveTo(c.centerX - u, c.centerY), e.lineTo(c.centerX + u, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - u), e.lineTo(c.centerX, c.centerY + u), e.stroke());
|
|
310
310
|
}
|
|
311
|
-
e.strokeStyle =
|
|
312
|
-
},
|
|
313
|
-
const
|
|
311
|
+
e.strokeStyle = l, e.fillStyle = s, e.lineWidth = m, e.lineCap = R, e.lineJoin = w;
|
|
312
|
+
}, Be = Ye(({ segmentsByItem: e, glyphsByItem: r, itemHeight: a, width: n, viewportHeight: o, scrollPosition: l, color: s = "#a0aec0", strokeWidth: m = 1, renderStartIndex: R, renderEndIndex: w, lookaheadEndIndex: c, devicePixelRatio: h, expandGlyphColor: y, expandGlyphSize: E }) => {
|
|
313
|
+
const I = fe(null), i = fe(null), u = fe({
|
|
314
314
|
segmentsByItem: e,
|
|
315
315
|
glyphsByItem: r,
|
|
316
|
-
itemHeight:
|
|
317
|
-
width:
|
|
318
|
-
viewportHeight:
|
|
319
|
-
scrollPosition:
|
|
320
|
-
color:
|
|
316
|
+
itemHeight: a,
|
|
317
|
+
width: n,
|
|
318
|
+
viewportHeight: o,
|
|
319
|
+
scrollPosition: l,
|
|
320
|
+
color: s,
|
|
321
321
|
strokeWidth: m,
|
|
322
|
-
renderStartIndex:
|
|
323
|
-
renderEndIndex:
|
|
322
|
+
renderStartIndex: R,
|
|
323
|
+
renderEndIndex: w,
|
|
324
324
|
lookaheadEndIndex: c,
|
|
325
|
-
devicePixelRatio:
|
|
326
|
-
expandGlyphColor:
|
|
327
|
-
expandGlyphSize:
|
|
328
|
-
}),
|
|
329
|
-
|
|
330
|
-
const
|
|
331
|
-
if (!
|
|
325
|
+
devicePixelRatio: h,
|
|
326
|
+
expandGlyphColor: y,
|
|
327
|
+
expandGlyphSize: E
|
|
328
|
+
}), p = C(() => {
|
|
329
|
+
i.current = null;
|
|
330
|
+
const v = I.current;
|
|
331
|
+
if (!v)
|
|
332
332
|
return;
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
333
|
+
const g = v.getContext("2d");
|
|
334
|
+
if (!g)
|
|
335
335
|
return;
|
|
336
|
-
const d =
|
|
336
|
+
const d = u.current;
|
|
337
337
|
if (d.width <= 0 || d.viewportHeight <= 0) {
|
|
338
|
-
|
|
338
|
+
g.clearRect(0, 0, v.width, v.height);
|
|
339
339
|
return;
|
|
340
340
|
}
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
const
|
|
341
|
+
const P = Number.isFinite(d.devicePixelRatio ?? NaN) ? d.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
|
|
342
|
+
ht(v, d.width, d.viewportHeight, P);
|
|
343
|
+
const T = d.segmentsByItem.length, A = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)), X = Math.min(T, Math.ceil((d.scrollPosition + d.viewportHeight) / d.itemHeight)), U = (() => {
|
|
344
344
|
if (typeof d.renderEndIndex == "number" && Number.isFinite(d.renderEndIndex)) {
|
|
345
|
-
const
|
|
346
|
-
return Math.max(Math.min(
|
|
345
|
+
const Z = Math.floor(d.renderEndIndex);
|
|
346
|
+
return Math.max(Math.min(T, Z + 1), A);
|
|
347
347
|
}
|
|
348
|
-
return Math.max(
|
|
349
|
-
})(),
|
|
348
|
+
return Math.max(X, A);
|
|
349
|
+
})(), q = (() => {
|
|
350
350
|
if (typeof d.lookaheadEndIndex == "number" && Number.isFinite(d.lookaheadEndIndex)) {
|
|
351
|
-
const
|
|
352
|
-
return Math.max(
|
|
351
|
+
const Z = Math.floor(d.lookaheadEndIndex), G = Math.min(T, Z + 1);
|
|
352
|
+
return Math.max(G, U);
|
|
353
353
|
}
|
|
354
|
-
return Math.max(
|
|
355
|
-
})(),
|
|
356
|
-
|
|
357
|
-
}, []),
|
|
358
|
-
|
|
359
|
-
}, [
|
|
360
|
-
return
|
|
361
|
-
|
|
354
|
+
return Math.max(X, U);
|
|
355
|
+
})(), $ = ft(d.segmentsByItem, A, q), V = mt(d.glyphsByItem, A, q);
|
|
356
|
+
g.save(), g.scale(P, P), g.clearRect(0, 0, d.width, d.viewportHeight), g.translate(0, -d.scrollPosition), g.strokeStyle = d.color, yt(g, $, d.strokeWidth), bt(g, V, d.expandGlyphColor ?? d.color, d.expandGlyphSize), g.restore();
|
|
357
|
+
}, []), j = C(() => {
|
|
358
|
+
i.current === null && (i.current = window.requestAnimationFrame(p));
|
|
359
|
+
}, [p]);
|
|
360
|
+
return oe(() => {
|
|
361
|
+
u.current = {
|
|
362
362
|
segmentsByItem: e,
|
|
363
363
|
glyphsByItem: r,
|
|
364
|
-
itemHeight:
|
|
365
|
-
width:
|
|
366
|
-
viewportHeight:
|
|
367
|
-
scrollPosition:
|
|
368
|
-
color:
|
|
364
|
+
itemHeight: a,
|
|
365
|
+
width: n,
|
|
366
|
+
viewportHeight: o,
|
|
367
|
+
scrollPosition: l,
|
|
368
|
+
color: s,
|
|
369
369
|
strokeWidth: m,
|
|
370
|
-
renderStartIndex:
|
|
371
|
-
renderEndIndex:
|
|
370
|
+
renderStartIndex: R,
|
|
371
|
+
renderEndIndex: w,
|
|
372
372
|
lookaheadEndIndex: c,
|
|
373
|
-
devicePixelRatio:
|
|
374
|
-
expandGlyphColor:
|
|
375
|
-
expandGlyphSize:
|
|
376
|
-
},
|
|
377
|
-
}, [e, r,
|
|
378
|
-
|
|
379
|
-
}, []), /* @__PURE__ */
|
|
373
|
+
devicePixelRatio: h,
|
|
374
|
+
expandGlyphColor: y,
|
|
375
|
+
expandGlyphSize: E
|
|
376
|
+
}, j();
|
|
377
|
+
}, [e, r, a, n, o, l, s, m, R, w, c, h, y, E, j]), oe(() => () => {
|
|
378
|
+
i.current !== null && (window.cancelAnimationFrame(i.current), i.current = null);
|
|
379
|
+
}, []), /* @__PURE__ */ N.jsx("canvas", { ref: I, className: "pointer-events-none absolute top-0 left-0 z-0" });
|
|
380
380
|
});
|
|
381
|
-
|
|
382
|
-
const
|
|
381
|
+
Be.displayName = "TreeLineCanvas";
|
|
382
|
+
const W = {
|
|
383
383
|
container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[5px] pr-[3px]",
|
|
384
384
|
containerPending: "opacity-70",
|
|
385
385
|
entry: "directory-tree-entry flex items-center cursor-pointer relative select-none",
|
|
386
386
|
// ホバー時のスタイル(ライト/ダークモード対応)
|
|
387
|
-
entryHover:
|
|
387
|
+
entryHover: Y("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
|
|
388
388
|
// 選択時のスタイル(ライト/ダークモード対応)
|
|
389
|
-
entrySelected:
|
|
389
|
+
entrySelected: Y("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
|
|
390
390
|
// アイテム選択時のスタイル(ライト/ダークモード対応)
|
|
391
|
-
entryItemSelected:
|
|
391
|
+
entryItemSelected: Y("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)]"),
|
|
392
392
|
// アイコンのスタイル
|
|
393
|
-
expandIcon:
|
|
394
|
-
expandIconSelected:
|
|
395
|
-
typeIcon:
|
|
396
|
-
typeIconSelected:
|
|
393
|
+
expandIcon: Y("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
394
|
+
expandIconSelected: Y("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
|
|
395
|
+
typeIcon: Y("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
396
|
+
typeIconSelected: Y("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
|
|
397
397
|
// テキストのスタイル
|
|
398
|
-
name:
|
|
398
|
+
name: Y("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1", "text-gray-700", "dark:text-gray-200"),
|
|
399
399
|
nameDirectory: "directory-tree-name--directory",
|
|
400
|
-
nameSelected:
|
|
401
|
-
},
|
|
400
|
+
nameSelected: Y("directory-tree-name--selected text-blue-800 font-medium", "dark:text-blue-300")
|
|
401
|
+
}, vt = {
|
|
402
402
|
msOverflowStyle: "none",
|
|
403
403
|
scrollbarWidth: "none"
|
|
404
|
-
},
|
|
404
|
+
}, gt = () => {
|
|
405
405
|
let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
|
|
406
406
|
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));
|
|
407
|
-
},
|
|
408
|
-
const
|
|
409
|
-
let
|
|
410
|
-
const m = (
|
|
411
|
-
for (let
|
|
412
|
-
const
|
|
413
|
-
let
|
|
414
|
-
|
|
415
|
-
id:
|
|
416
|
-
name:
|
|
417
|
-
absolutePath:
|
|
418
|
-
indentLevel:
|
|
419
|
-
isLastChild:
|
|
420
|
-
isDirectory:
|
|
421
|
-
isExpanded:
|
|
422
|
-
ancestorIsLast: [...
|
|
423
|
-
hideLines:
|
|
424
|
-
})),
|
|
407
|
+
}, xt = (e, r, a, n) => {
|
|
408
|
+
const o = [], l = [];
|
|
409
|
+
let s = 0;
|
|
410
|
+
const m = (R, w, c) => {
|
|
411
|
+
for (let h = 0; h < R.length; h++) {
|
|
412
|
+
const y = R[h], E = h === R.length - 1, I = [...c, E], i = y.children !== void 0, u = i && r(y.absolutePath, y.relativePath);
|
|
413
|
+
let p = w, j = I, v = c;
|
|
414
|
+
n && (p = w - 1, j = I.slice(1), v = c.slice(1)), o.push({ entry: y, indentLevel: p, parentIsLast: j }), a && (p > s && (s = p), l.push({
|
|
415
|
+
id: y.absolutePath,
|
|
416
|
+
name: y.name,
|
|
417
|
+
absolutePath: y.absolutePath,
|
|
418
|
+
indentLevel: p,
|
|
419
|
+
isLastChild: E,
|
|
420
|
+
isDirectory: i,
|
|
421
|
+
isExpanded: u,
|
|
422
|
+
ancestorIsLast: [...v],
|
|
423
|
+
hideLines: n && w === 0
|
|
424
|
+
})), i && u && y.children && m(y.children, w + 1, I);
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
|
-
return m(e, 0, []), { flatItems:
|
|
428
|
-
},
|
|
429
|
-
const a =
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
427
|
+
return m(e, 0, []), { flatItems: o, lineItems: l, maxIndent: s };
|
|
428
|
+
}, Fe = (e, r) => {
|
|
429
|
+
const a = e.length - 1;
|
|
430
|
+
if (a <= 0) return 0;
|
|
431
|
+
let n = 0, o = a - 1, l = 0;
|
|
432
|
+
for (; n <= o; ) {
|
|
433
|
+
const s = n + o >>> 1;
|
|
434
|
+
e[s] <= r ? (l = s, n = s + 1) : o = s - 1;
|
|
435
|
+
}
|
|
436
|
+
return l;
|
|
437
|
+
}, Et = (e, r, a, n, o, l) => {
|
|
438
|
+
const s = n?.renderStart ?? Math.max(0, Fe(l, o)), m = r > 0 ? Fe(l, o + r) + a : s + a, R = e > 0 ? Math.min(e - 1, Math.max(s, m)) : s, w = n?.renderEnd ?? R, c = e > 0 ? Math.min(e - 1, w + a) : w;
|
|
439
|
+
return { renderStart: s, renderEnd: w, lookaheadEnd: c };
|
|
440
|
+
}, It = ({ isDirectory: e, isExpanded: r, showExpandIcons: a, useCanvasExpandIcons: n, expandIconSize: o }) => {
|
|
441
|
+
const l = o ? { width: o, height: o } : void 0, s = o ? "" : "h-4 w-4";
|
|
442
|
+
return !(a && e) || n ? /* @__PURE__ */ N.jsx("span", { className: s, style: l, "aria-hidden": "true" }) : r ? /* @__PURE__ */ N.jsx(at, { className: s, style: l }) : /* @__PURE__ */ N.jsx(lt, { className: s, style: l });
|
|
443
|
+
}, St = (e) => e.slice((e.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(), wt = (e, r, a, n, o, l) => {
|
|
435
444
|
if (e.length === 0)
|
|
436
445
|
return { segmentsByItem: [], glyphsByItem: [] };
|
|
437
|
-
const
|
|
438
|
-
for (let
|
|
439
|
-
const
|
|
440
|
-
if (
|
|
446
|
+
const s = Array.from({ length: e.length }, () => []), m = Array.from({ length: e.length }, () => []), R = (c) => o ? typeof l == "number" && Number.isFinite(l) && l > 0 ? l : Math.max(8, Math.min(n * 0.9, c * 0.7)) : 0, w = 3;
|
|
447
|
+
for (let c = 0; c < e.length; c++) {
|
|
448
|
+
const h = e[c];
|
|
449
|
+
if (h.hideLines)
|
|
441
450
|
continue;
|
|
442
|
-
const
|
|
443
|
-
for (let
|
|
444
|
-
if (
|
|
451
|
+
const y = [], E = r[c] ?? 0, I = a[c] ?? 0, i = I + E / 2, u = R(E), p = u > 0 ? u / 2 + 2 : n / 1.5;
|
|
452
|
+
for (let g = 0; g < h.indentLevel; g++) {
|
|
453
|
+
if (h.ancestorIsLast[g] ?? !1)
|
|
445
454
|
continue;
|
|
446
|
-
let
|
|
447
|
-
for (let
|
|
448
|
-
const
|
|
449
|
-
if (
|
|
450
|
-
|
|
455
|
+
let P = !1;
|
|
456
|
+
for (let T = c; T < e.length; T++) {
|
|
457
|
+
const A = e[T];
|
|
458
|
+
if (A.indentLevel > g && A.ancestorIsLast.length > g && !A.ancestorIsLast[g]) {
|
|
459
|
+
P = !0;
|
|
451
460
|
break;
|
|
452
461
|
}
|
|
453
|
-
if (
|
|
462
|
+
if (T > c && A.indentLevel === g)
|
|
454
463
|
break;
|
|
455
464
|
}
|
|
456
|
-
if (
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
key: `${
|
|
460
|
-
x1:
|
|
461
|
-
y1:
|
|
462
|
-
x2:
|
|
463
|
-
y2:
|
|
464
|
-
itemIndex:
|
|
465
|
+
if (P) {
|
|
466
|
+
const T = g * n + n / 2 + w;
|
|
467
|
+
y.push({
|
|
468
|
+
key: `${h.id}-ancestor-${g}`,
|
|
469
|
+
x1: T,
|
|
470
|
+
y1: I,
|
|
471
|
+
x2: T,
|
|
472
|
+
y2: I + E,
|
|
473
|
+
itemIndex: c
|
|
465
474
|
});
|
|
466
475
|
}
|
|
467
476
|
}
|
|
468
|
-
const
|
|
469
|
-
if (
|
|
470
|
-
key: `${
|
|
471
|
-
x1:
|
|
472
|
-
y1:
|
|
473
|
-
x2:
|
|
474
|
-
y2:
|
|
475
|
-
itemIndex:
|
|
476
|
-
}) :
|
|
477
|
-
key: `${
|
|
478
|
-
x1:
|
|
479
|
-
y1:
|
|
480
|
-
x2:
|
|
481
|
-
y2:
|
|
482
|
-
itemIndex:
|
|
483
|
-
}), !
|
|
484
|
-
key: `${
|
|
485
|
-
x1:
|
|
486
|
-
y1:
|
|
487
|
-
x2:
|
|
488
|
-
y2:
|
|
489
|
-
itemIndex:
|
|
490
|
-
}),
|
|
491
|
-
key: `${
|
|
492
|
-
x1:
|
|
493
|
-
y1:
|
|
494
|
-
x2:
|
|
495
|
-
y2:
|
|
496
|
-
itemIndex:
|
|
497
|
-
}) :
|
|
498
|
-
key: `${
|
|
499
|
-
x1:
|
|
500
|
-
y1:
|
|
501
|
-
x2:
|
|
502
|
-
y2:
|
|
503
|
-
itemIndex:
|
|
504
|
-
})),
|
|
505
|
-
const
|
|
506
|
-
|
|
477
|
+
const j = h.indentLevel * n, v = j + n / 2 + w;
|
|
478
|
+
if (h.isDirectory ? y.push({
|
|
479
|
+
key: `${h.id}-connector-top`,
|
|
480
|
+
x1: v,
|
|
481
|
+
y1: I,
|
|
482
|
+
x2: v,
|
|
483
|
+
y2: i - p,
|
|
484
|
+
itemIndex: c
|
|
485
|
+
}) : y.push({
|
|
486
|
+
key: `${h.id}-connector-top`,
|
|
487
|
+
x1: v,
|
|
488
|
+
y1: I,
|
|
489
|
+
x2: v,
|
|
490
|
+
y2: i,
|
|
491
|
+
itemIndex: c
|
|
492
|
+
}), !h.isDirectory && h.isLastChild && y.push({
|
|
493
|
+
key: `${h.id}-connector-horizontal`,
|
|
494
|
+
x1: v,
|
|
495
|
+
y1: i,
|
|
496
|
+
x2: j + n + w,
|
|
497
|
+
y2: i,
|
|
498
|
+
itemIndex: c
|
|
499
|
+
}), h.isLastChild || (h.isDirectory ? y.push({
|
|
500
|
+
key: `${h.id}-connector-bottom`,
|
|
501
|
+
x1: v,
|
|
502
|
+
y1: i + p,
|
|
503
|
+
x2: v,
|
|
504
|
+
y2: I + E,
|
|
505
|
+
itemIndex: c
|
|
506
|
+
}) : y.push({
|
|
507
|
+
key: `${h.id}-connector-bottom`,
|
|
508
|
+
x1: v,
|
|
509
|
+
y1: i,
|
|
510
|
+
x2: v,
|
|
511
|
+
y2: I + E,
|
|
512
|
+
itemIndex: c
|
|
513
|
+
})), s[c] = y, o && h.isDirectory) {
|
|
514
|
+
const g = u, d = v, P = i;
|
|
515
|
+
m[c] = [
|
|
507
516
|
{
|
|
508
|
-
key: `${
|
|
509
|
-
itemIndex:
|
|
510
|
-
centerX:
|
|
511
|
-
centerY:
|
|
512
|
-
size:
|
|
513
|
-
isExpanded:
|
|
517
|
+
key: `${h.id}-glyph`,
|
|
518
|
+
itemIndex: c,
|
|
519
|
+
centerX: d,
|
|
520
|
+
centerY: P,
|
|
521
|
+
size: g,
|
|
522
|
+
isExpanded: h.isExpanded
|
|
514
523
|
}
|
|
515
524
|
];
|
|
516
525
|
}
|
|
517
526
|
}
|
|
518
|
-
return { segmentsByItem:
|
|
519
|
-
},
|
|
527
|
+
return { segmentsByItem: s, glyphsByItem: m };
|
|
528
|
+
}, Re = (e, r) => {
|
|
520
529
|
if (e == null || typeof e == "boolean") return null;
|
|
521
530
|
if (typeof e == "function")
|
|
522
531
|
return console.warn(`[DirectoryTree] Function returned by renderer for "${r}". Return a node.`), null;
|
|
@@ -524,367 +533,448 @@ const $ = {
|
|
|
524
533
|
if ("then" in e)
|
|
525
534
|
return console.warn(`[DirectoryTree] Promise returned for "${r}". Not supported.`), null;
|
|
526
535
|
if (Array.isArray(e)) {
|
|
527
|
-
const
|
|
528
|
-
return
|
|
536
|
+
const n = e.map((o) => Re(o, r)).filter(Boolean);
|
|
537
|
+
return n.length ? n : null;
|
|
529
538
|
}
|
|
530
|
-
const
|
|
531
|
-
if (
|
|
539
|
+
const a = e.type;
|
|
540
|
+
if (a && a.$$typeof === /* @__PURE__ */ Symbol.for("react.lazy"))
|
|
532
541
|
return console.warn(`[DirectoryTree] Lazy component for "${r}". Not supported.`), null;
|
|
533
542
|
}
|
|
534
543
|
return e;
|
|
535
|
-
},
|
|
536
|
-
const { entry:
|
|
537
|
-
let
|
|
538
|
-
return
|
|
539
|
-
},
|
|
544
|
+
}, kt = (e, r) => {
|
|
545
|
+
const { entry: a, isDirectory: n, isExpanded: o, extension: l } = e;
|
|
546
|
+
let s;
|
|
547
|
+
return a.icon !== void 0 ? s = a.icon : n ? s = o && r?.directoryExpanded || r?.directory || /* @__PURE__ */ N.jsx(ot, { className: "h-4 w-4" }) : l && r?.fileByExtension?.[l] ? s = r.fileByExtension[l] : s = r?.file || (l === "md" ? /* @__PURE__ */ N.jsx(st, { className: "h-4 w-4" }) : /* @__PURE__ */ N.jsx(it, { className: "h-4 w-4" })), Re(typeof s == "function" ? s(e) : s, a.absolutePath);
|
|
548
|
+
}, _e = Ye(
|
|
540
549
|
({
|
|
541
550
|
entry: e,
|
|
542
551
|
indentLevel: r,
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
552
|
+
rowHeight: a,
|
|
553
|
+
isDirOpen: n,
|
|
554
|
+
parentIsLast: o,
|
|
555
|
+
renderChildren: l = !0,
|
|
556
|
+
expansion: { toggleDirectory: s, onToggleDirectoryRecursive: m },
|
|
557
|
+
selection: { onEntryClick: R, selectedPath: w, mode: c = "none", selectedItems: h, onSelectionChange: y },
|
|
558
|
+
visual: {
|
|
559
|
+
iconOverrides: E,
|
|
560
|
+
showExpandIcons: I = !0,
|
|
561
|
+
showDirectoryIcons: i = !0,
|
|
562
|
+
showFileIcons: u = !0,
|
|
563
|
+
useCanvasExpandIcons: p = !1,
|
|
564
|
+
expandIconSize: j,
|
|
565
|
+
highlightStyles: v,
|
|
566
|
+
entryClassName: g,
|
|
567
|
+
entryStyle: d,
|
|
568
|
+
nameClassName: P,
|
|
569
|
+
nameStyle: T,
|
|
570
|
+
directoryNameClassName: A,
|
|
571
|
+
directoryNameStyle: X,
|
|
572
|
+
fileNameClassName: U,
|
|
573
|
+
fileNameStyle: q
|
|
574
|
+
}
|
|
549
575
|
}) => {
|
|
550
|
-
const
|
|
551
|
-
|
|
576
|
+
const $ = fe(null), [V, Z] = ie(null), [G, se] = ie(!1);
|
|
577
|
+
oe(
|
|
552
578
|
() => () => {
|
|
553
|
-
|
|
579
|
+
$.current && window.clearTimeout($.current);
|
|
554
580
|
},
|
|
555
581
|
[]
|
|
556
582
|
);
|
|
557
|
-
const
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
}, [
|
|
561
|
-
const
|
|
562
|
-
(
|
|
563
|
-
|
|
564
|
-
let
|
|
565
|
-
|
|
583
|
+
const S = e.children !== void 0, D = S && n(e.absolutePath), L = e.absolutePath === w, O = !S && h?.has(e.absolutePath), t = S ? void 0 : St(e.name);
|
|
584
|
+
oe(() => {
|
|
585
|
+
Z(D && e.children ? e.children : null);
|
|
586
|
+
}, [D, e.children]);
|
|
587
|
+
const f = C(
|
|
588
|
+
(B) => {
|
|
589
|
+
B.stopPropagation(), c !== "none" && !S && y && y(e, !O);
|
|
590
|
+
let ue = !1;
|
|
591
|
+
R({
|
|
566
592
|
entry: e,
|
|
567
|
-
isDirectory:
|
|
568
|
-
isExpanded:
|
|
593
|
+
isDirectory: S,
|
|
594
|
+
isExpanded: D,
|
|
569
595
|
preventDefault: () => {
|
|
570
|
-
|
|
596
|
+
ue = !0;
|
|
571
597
|
}
|
|
572
|
-
}), !(!
|
|
573
|
-
|
|
598
|
+
}), !(!S || ue) && ($.current ? (window.clearTimeout($.current), $.current = null, m(e)) : $.current = window.setTimeout(() => {
|
|
599
|
+
s(e.absolutePath), $.current = null;
|
|
574
600
|
}, 500));
|
|
575
601
|
},
|
|
576
|
-
[
|
|
577
|
-
),
|
|
578
|
-
if (
|
|
579
|
-
if (
|
|
580
|
-
return
|
|
581
|
-
} else if (
|
|
582
|
-
return
|
|
583
|
-
j && $.entrySelected,
|
|
584
|
-
C && $.entryItemSelected
|
|
585
|
-
);
|
|
602
|
+
[S, e, D, m, s, R, c, y, O]
|
|
603
|
+
), x = G ? v?.hoverClassName !== void 0 ? v.hoverClassName : W.entryHover : "", k = (() => {
|
|
604
|
+
if (S) {
|
|
605
|
+
if (L)
|
|
606
|
+
return v?.directorySelectedClassName !== void 0 ? v.directorySelectedClassName : W.entrySelected;
|
|
607
|
+
} else if (L || O)
|
|
608
|
+
return v?.itemSelectedClassName !== void 0 ? v.itemSelectedClassName : Y(L && W.entrySelected, O && W.entryItemSelected);
|
|
586
609
|
return "";
|
|
587
|
-
})(),
|
|
588
|
-
...
|
|
589
|
-
...
|
|
590
|
-
...!
|
|
610
|
+
})(), te = Y(W.entry, x, k, g, e.className), Q = Y(W.expandIcon, (L || O) && W.expandIconSelected), _ = Y(W.typeIcon, (L || O) && W.typeIconSelected), J = Y(W.name, P, S && W.nameDirectory, S && A, !S && U, (L || O) && W.nameSelected), re = It({ isDirectory: S, isExpanded: D, showExpandIcons: I, useCanvasExpandIcons: p, expandIconSize: j }), ce = (S ? i : u) ? kt({ entry: e, isDirectory: S, isExpanded: D, isSelected: L, isItemSelected: !!O, extension: t }, E) : null, Ie = {
|
|
611
|
+
...G ? v?.hoverStyle : {},
|
|
612
|
+
...S && L ? v?.directorySelectedStyle : {},
|
|
613
|
+
...!S && (L || O) ? v?.itemSelectedStyle : {}
|
|
591
614
|
};
|
|
592
|
-
return /* @__PURE__ */
|
|
593
|
-
/* @__PURE__ */
|
|
615
|
+
return /* @__PURE__ */ N.jsxs(tt, { children: [
|
|
616
|
+
/* @__PURE__ */ N.jsxs(
|
|
594
617
|
"div",
|
|
595
618
|
{
|
|
596
|
-
className:
|
|
619
|
+
className: te,
|
|
597
620
|
style: {
|
|
598
|
-
paddingLeft: `${Math.max(0, r *
|
|
599
|
-
transform: r < 0 ? `translateX(${r *
|
|
600
|
-
width: r < 0 ? `calc(100% + ${Math.abs(r *
|
|
601
|
-
height: `${
|
|
602
|
-
...
|
|
621
|
+
paddingLeft: `${Math.max(0, r * ye)}px`,
|
|
622
|
+
transform: r < 0 ? `translateX(${r * ye}px)` : void 0,
|
|
623
|
+
width: r < 0 ? `calc(100% + ${Math.abs(r * ye)}px)` : void 0,
|
|
624
|
+
height: `${a}px`,
|
|
625
|
+
...Ie,
|
|
626
|
+
...d,
|
|
603
627
|
...e.style
|
|
604
628
|
},
|
|
605
|
-
"data-entry-type":
|
|
606
|
-
"data-entry-expanded":
|
|
607
|
-
"data-entry-selected":
|
|
608
|
-
"data-entry-item-selected":
|
|
609
|
-
onClick:
|
|
610
|
-
onMouseEnter: () =>
|
|
611
|
-
onMouseLeave: () =>
|
|
612
|
-
onKeyDown: (
|
|
629
|
+
"data-entry-type": S ? "directory" : "file",
|
|
630
|
+
"data-entry-expanded": S ? String(D) : void 0,
|
|
631
|
+
"data-entry-selected": L ? "true" : void 0,
|
|
632
|
+
"data-entry-item-selected": O ? "true" : void 0,
|
|
633
|
+
onClick: f,
|
|
634
|
+
onMouseEnter: () => se(!0),
|
|
635
|
+
onMouseLeave: () => se(!1),
|
|
636
|
+
onKeyDown: (B) => B.key === "Enter" && f(B),
|
|
613
637
|
tabIndex: 0,
|
|
614
638
|
role: "treeitem",
|
|
615
|
-
"aria-expanded":
|
|
616
|
-
"aria-label": `${e.name} (${
|
|
639
|
+
"aria-expanded": S ? D : void 0,
|
|
640
|
+
"aria-label": `${e.name} (${S ? "directory" : "file"})`,
|
|
617
641
|
children: [
|
|
618
|
-
(
|
|
619
|
-
(
|
|
620
|
-
/* @__PURE__ */
|
|
642
|
+
(I || p) && /* @__PURE__ */ N.jsx("span", { className: Q, children: re }),
|
|
643
|
+
(S ? i : u) && /* @__PURE__ */ N.jsx("span", { className: _, children: ce }),
|
|
644
|
+
/* @__PURE__ */ N.jsx(
|
|
645
|
+
"span",
|
|
646
|
+
{
|
|
647
|
+
className: J,
|
|
648
|
+
style: {
|
|
649
|
+
...T,
|
|
650
|
+
...S ? X : q
|
|
651
|
+
},
|
|
652
|
+
"data-entry-type": S ? "directory" : "file",
|
|
653
|
+
"data-entry-role": "name",
|
|
654
|
+
children: e.label ?? e.name
|
|
655
|
+
}
|
|
656
|
+
)
|
|
621
657
|
]
|
|
622
658
|
}
|
|
623
659
|
),
|
|
624
|
-
|
|
625
|
-
|
|
660
|
+
D && V && l && /* @__PURE__ */ N.jsx("fieldset", { children: V.map((B, ue) => /* @__PURE__ */ N.jsx(
|
|
661
|
+
_e,
|
|
626
662
|
{
|
|
627
|
-
entry:
|
|
663
|
+
entry: B,
|
|
628
664
|
indentLevel: r + 1,
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
665
|
+
rowHeight: a,
|
|
666
|
+
isDirOpen: n,
|
|
667
|
+
parentIsLast: [...o, ue === V.length - 1],
|
|
668
|
+
expansion: { toggleDirectory: s, onToggleDirectoryRecursive: m },
|
|
669
|
+
selection: { onEntryClick: R, selectedPath: w, mode: c, selectedItems: h, onSelectionChange: y },
|
|
633
670
|
visual: {
|
|
634
|
-
iconOverrides:
|
|
635
|
-
showExpandIcons:
|
|
636
|
-
showDirectoryIcons:
|
|
671
|
+
iconOverrides: E,
|
|
672
|
+
showExpandIcons: I,
|
|
673
|
+
showDirectoryIcons: i,
|
|
637
674
|
showFileIcons: u,
|
|
638
|
-
useCanvasExpandIcons:
|
|
639
|
-
expandIconSize:
|
|
640
|
-
highlightStyles:
|
|
675
|
+
useCanvasExpandIcons: p,
|
|
676
|
+
expandIconSize: j,
|
|
677
|
+
highlightStyles: v,
|
|
678
|
+
entryClassName: g,
|
|
679
|
+
entryStyle: d,
|
|
680
|
+
nameClassName: P,
|
|
681
|
+
nameStyle: T,
|
|
682
|
+
directoryNameClassName: A,
|
|
683
|
+
directoryNameStyle: X,
|
|
684
|
+
fileNameClassName: U,
|
|
685
|
+
fileNameStyle: q
|
|
641
686
|
}
|
|
642
687
|
},
|
|
643
|
-
|
|
688
|
+
B.absolutePath
|
|
644
689
|
)) })
|
|
645
690
|
] }, e.absolutePath);
|
|
646
691
|
},
|
|
647
692
|
(e, r) => {
|
|
648
693
|
if (e.entry !== r.entry) return !1;
|
|
649
|
-
const
|
|
650
|
-
return e.indentLevel === r.indentLevel &&
|
|
694
|
+
const a = e.entry.children !== void 0, n = r.entry.children !== void 0, o = a && e.isDirOpen(e.entry.absolutePath), l = n && r.isDirOpen(r.entry.absolutePath);
|
|
695
|
+
return e.indentLevel === r.indentLevel && e.rowHeight === r.rowHeight && o === l && e.selection.selectedPath === r.selection.selectedPath && e.selection.mode === r.selection.mode && e.selection.selectedItems === r.selection.selectedItems && e.visual.iconOverrides === r.visual.iconOverrides && e.visual.showExpandIcons === r.visual.showExpandIcons && e.visual.showDirectoryIcons === r.visual.showDirectoryIcons && e.visual.showFileIcons === r.visual.showFileIcons && e.visual.useCanvasExpandIcons === r.visual.useCanvasExpandIcons && e.visual.expandIconSize === r.visual.expandIconSize && e.visual.highlightStyles === r.visual.highlightStyles && e.visual.entryClassName === r.visual.entryClassName && e.visual.entryStyle === r.visual.entryStyle && e.visual.nameClassName === r.visual.nameClassName && e.visual.nameStyle === r.visual.nameStyle && e.visual.directoryNameClassName === r.visual.directoryNameClassName && e.visual.directoryNameStyle === r.visual.directoryNameStyle && e.visual.fileNameClassName === r.visual.fileNameClassName && e.visual.fileNameStyle === r.visual.fileNameStyle && e.parentIsLast.length === r.parentIsLast.length && e.parentIsLast.every((s, m) => s === r.parentIsLast[m]);
|
|
651
696
|
}
|
|
652
697
|
);
|
|
653
|
-
|
|
654
|
-
const
|
|
698
|
+
_e.displayName = "DirectoryEntryItem";
|
|
699
|
+
const Ee = 20, ye = 16, He = 12, We = (e) => {
|
|
655
700
|
const r = [];
|
|
656
701
|
if (e.children)
|
|
657
|
-
for (const
|
|
658
|
-
|
|
702
|
+
for (const a of e.children)
|
|
703
|
+
a.type === "directory" && (r.push(a.absolutePath), r.push(...We(a)));
|
|
659
704
|
return r;
|
|
660
|
-
},
|
|
705
|
+
}, Ct = ({
|
|
661
706
|
entries: e,
|
|
662
|
-
expansion: { toggle: r, isExpanded:
|
|
663
|
-
selection: { onEntryClick:
|
|
664
|
-
visual: {
|
|
665
|
-
|
|
707
|
+
expansion: { toggle: r, isExpanded: a, expandMultiple: n, collapseMultiple: o, isPending: l, alwaysExpanded: s = !1, doubleClickAction: m = "recursive" },
|
|
708
|
+
selection: { onEntryClick: R, selectedPath: w, mode: c = "none", selectedItems: h, onSelectionChange: y },
|
|
709
|
+
visual: {
|
|
710
|
+
className: E,
|
|
711
|
+
style: I,
|
|
712
|
+
lineColor: i = "#A0AEC0",
|
|
713
|
+
showTreeLines: u = !0,
|
|
714
|
+
showExpandIcons: p = !0,
|
|
715
|
+
showDirectoryIcons: j = !0,
|
|
716
|
+
showFileIcons: v = !0,
|
|
717
|
+
iconOverrides: g,
|
|
718
|
+
expandIconSize: d,
|
|
719
|
+
itemHeight: P = Ee,
|
|
720
|
+
removeRootIndent: T = !1,
|
|
721
|
+
highlightStyles: A,
|
|
722
|
+
entryClassName: X,
|
|
723
|
+
entryStyle: U,
|
|
724
|
+
nameClassName: q,
|
|
725
|
+
nameStyle: $,
|
|
726
|
+
directoryNameClassName: V,
|
|
727
|
+
directoryNameStyle: Z,
|
|
728
|
+
fileNameClassName: G,
|
|
729
|
+
fileNameStyle: se
|
|
730
|
+
} = {},
|
|
731
|
+
virtualScroll: S
|
|
666
732
|
}) => {
|
|
667
|
-
const [
|
|
668
|
-
overscanCount:
|
|
669
|
-
className:
|
|
670
|
-
background:
|
|
671
|
-
onScroll:
|
|
672
|
-
onRangeChange:
|
|
673
|
-
initialScrollIndex:
|
|
674
|
-
initialScrollOffset:
|
|
675
|
-
callbackThrottleMs:
|
|
676
|
-
contentInsets:
|
|
677
|
-
onItemFocus:
|
|
678
|
-
viewportHeightOverride:
|
|
679
|
-
scrollBarOptions:
|
|
680
|
-
behaviorOptions:
|
|
681
|
-
} =
|
|
682
|
-
(
|
|
683
|
-
|
|
733
|
+
const [D, L] = ie(!1), O = fe(null), t = fe(null), [f, x] = ie(0), [k, te] = ie(null), {
|
|
734
|
+
overscanCount: Q = 15,
|
|
735
|
+
className: _,
|
|
736
|
+
background: J,
|
|
737
|
+
onScroll: re,
|
|
738
|
+
onRangeChange: ce,
|
|
739
|
+
initialScrollIndex: Ie,
|
|
740
|
+
initialScrollOffset: B,
|
|
741
|
+
callbackThrottleMs: ue = 5,
|
|
742
|
+
contentInsets: Xe,
|
|
743
|
+
onItemFocus: Ve,
|
|
744
|
+
viewportHeightOverride: z,
|
|
745
|
+
scrollBarOptions: Ge,
|
|
746
|
+
behaviorOptions: Je
|
|
747
|
+
} = S ?? {}, [pe, Ne] = ie(typeof B == "number" ? B : 0), ze = C(
|
|
748
|
+
(b, F) => {
|
|
749
|
+
Ne(b), re?.(b, F);
|
|
684
750
|
},
|
|
685
|
-
[
|
|
686
|
-
),
|
|
687
|
-
(
|
|
688
|
-
const { renderingStartIndex:
|
|
689
|
-
|
|
751
|
+
[re]
|
|
752
|
+
), Ue = C(
|
|
753
|
+
(b) => {
|
|
754
|
+
const { renderingStartIndex: F, renderingEndIndex: H } = b;
|
|
755
|
+
te((M) => M && M.renderStart === F && M.renderEnd === H ? M : { renderStart: F, renderEnd: H }), ce?.(b);
|
|
690
756
|
},
|
|
691
|
-
[
|
|
757
|
+
[ce]
|
|
692
758
|
);
|
|
693
|
-
|
|
694
|
-
typeof
|
|
695
|
-
}, [
|
|
696
|
-
|
|
697
|
-
}, []),
|
|
698
|
-
if (typeof
|
|
699
|
-
|
|
759
|
+
oe(() => {
|
|
760
|
+
typeof B == "number" && Ne(B);
|
|
761
|
+
}, [B]), oe(() => {
|
|
762
|
+
L(!0), gt();
|
|
763
|
+
}, []), oe(() => {
|
|
764
|
+
if (typeof z == "number") {
|
|
765
|
+
x((M) => Math.abs(M - z) > 1 ? z : M);
|
|
700
766
|
return;
|
|
701
767
|
}
|
|
702
|
-
const
|
|
703
|
-
if (!
|
|
768
|
+
const b = O.current;
|
|
769
|
+
if (!b) return x(0);
|
|
704
770
|
(() => {
|
|
705
|
-
const
|
|
706
|
-
|
|
771
|
+
const M = b.clientHeight;
|
|
772
|
+
x((le) => Math.abs(le - M) > 1 ? M : le);
|
|
707
773
|
})();
|
|
708
|
-
const
|
|
709
|
-
for (const
|
|
710
|
-
|
|
774
|
+
const H = new ResizeObserver((M) => {
|
|
775
|
+
for (const le of M)
|
|
776
|
+
le.target === b && x((we) => Math.abs(we - le.contentRect.height) > 1 ? le.contentRect.height : we);
|
|
711
777
|
});
|
|
712
|
-
return
|
|
713
|
-
}, [
|
|
714
|
-
const
|
|
778
|
+
return H.observe(b), () => H.disconnect();
|
|
779
|
+
}, [z]);
|
|
780
|
+
const ae = typeof z == "number" ? z : f, de = C((b) => s || (D ? a(b) : !1), [D, a, s]), Te = Y(W.container, l && W.containerPending, E), Pe = ee(
|
|
715
781
|
() => ({
|
|
716
|
-
...
|
|
717
|
-
...
|
|
718
|
-
...typeof
|
|
782
|
+
...vt,
|
|
783
|
+
...I ?? {},
|
|
784
|
+
...typeof z == "number" ? { height: z, minHeight: z } : {}
|
|
719
785
|
}),
|
|
720
|
-
[
|
|
721
|
-
),
|
|
722
|
-
(
|
|
723
|
-
const
|
|
724
|
-
if (
|
|
725
|
-
if (
|
|
726
|
-
if (
|
|
727
|
-
console.warn(`[DirectoryTree] Unknown double click action: ${
|
|
786
|
+
[I, z]
|
|
787
|
+
), qe = C(
|
|
788
|
+
(b, F) => {
|
|
789
|
+
const H = [b.absolutePath, ...We(b)], M = F || m;
|
|
790
|
+
if (H.every((ke) => de(ke))) return o(H);
|
|
791
|
+
if (H.every((ke) => !de(ke)) || M === "recursive") return n(H);
|
|
792
|
+
if (M === "toggle") return o(H);
|
|
793
|
+
console.warn(`[DirectoryTree] Unknown double click action: ${M}. No action taken.`);
|
|
728
794
|
},
|
|
729
|
-
[
|
|
730
|
-
), { flatItems:
|
|
731
|
-
() =>
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
795
|
+
[de, n, o, m]
|
|
796
|
+
), { flatItems: Ce, lineItems: Se, maxIndent: je } = ee(() => xt(e, de, u, T), [e, de, u, T]), K = ee(
|
|
797
|
+
() => Ce.map((b, F) => {
|
|
798
|
+
const H = typeof P == "function" ? P(b.entry, F) : P;
|
|
799
|
+
return { ...b, rowHeight: Number.isFinite(H) && H > 0 ? H : Ee };
|
|
800
|
+
}),
|
|
801
|
+
[Ce, P]
|
|
802
|
+
), ne = ee(() => K.map((b) => b.rowHeight), [K]), be = ee(() => {
|
|
803
|
+
const b = new Array(ne.length + 1);
|
|
804
|
+
b[0] = 0;
|
|
805
|
+
for (let F = 0; F < ne.length; F++)
|
|
806
|
+
b[F + 1] = b[F] + ne[F];
|
|
807
|
+
return b;
|
|
808
|
+
}, [ne]), Ze = C((b) => K[b]?.rowHeight ?? Ee, [K]), ve = ee(
|
|
809
|
+
() => !u || Se.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : wt(Se, ne, be, ye, u, d ?? He),
|
|
810
|
+
[Se, ne, be, u, d]
|
|
811
|
+
), ge = ee(() => !u || e.length === 0 ? 0 : (je + 2) * ye, [e.length, je, u]), { renderStart: Ae, renderEnd: Oe, lookaheadEnd: Me } = ee(
|
|
812
|
+
() => Et(K.length, ae, Q, k, pe, be),
|
|
813
|
+
[K.length, ae, Q, k, pe, be]
|
|
814
|
+
), Qe = ee(() => !u || ge <= 0 || ae <= 0 || ve.segmentsByItem.length === 0 ? null : /* @__PURE__ */ N.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ N.jsx("div", { className: "absolute top-0 left-0", style: { width: ge, height: ae }, children: /* @__PURE__ */ N.jsx(
|
|
815
|
+
Be,
|
|
735
816
|
{
|
|
736
|
-
segmentsByItem:
|
|
737
|
-
glyphsByItem:
|
|
738
|
-
itemHeight:
|
|
739
|
-
width:
|
|
740
|
-
viewportHeight:
|
|
741
|
-
scrollPosition:
|
|
742
|
-
color:
|
|
743
|
-
expandGlyphColor:
|
|
744
|
-
expandGlyphSize: d ??
|
|
745
|
-
renderStartIndex:
|
|
746
|
-
renderEndIndex:
|
|
747
|
-
lookaheadEndIndex:
|
|
817
|
+
segmentsByItem: ve.segmentsByItem,
|
|
818
|
+
glyphsByItem: ve.glyphsByItem,
|
|
819
|
+
itemHeight: ne[0] ?? Ee,
|
|
820
|
+
width: ge,
|
|
821
|
+
viewportHeight: ae,
|
|
822
|
+
scrollPosition: pe,
|
|
823
|
+
color: i,
|
|
824
|
+
expandGlyphColor: i,
|
|
825
|
+
expandGlyphSize: d ?? He,
|
|
826
|
+
renderStartIndex: Ae,
|
|
827
|
+
renderEndIndex: Oe,
|
|
828
|
+
lookaheadEndIndex: Me
|
|
748
829
|
}
|
|
749
|
-
) }) }), [
|
|
750
|
-
return e.length === 0 ? /* @__PURE__ */
|
|
751
|
-
|
|
830
|
+
) }) }), [ge, ae, Ae, Oe, Me, pe, ve, i, u, d, ne]), Ke = C((b) => K[b], [K]);
|
|
831
|
+
return e.length === 0 ? /* @__PURE__ */ N.jsx("div", { className: Te, style: Pe }) : /* @__PURE__ */ N.jsx("div", { ref: O, className: Te, style: Pe, role: "tree", children: /* @__PURE__ */ N.jsx(
|
|
832
|
+
nt,
|
|
752
833
|
{
|
|
753
|
-
ref:
|
|
754
|
-
itemCount:
|
|
755
|
-
getItem:
|
|
756
|
-
getItemHeight:
|
|
757
|
-
viewportSize:
|
|
758
|
-
overscanCount:
|
|
759
|
-
onScroll:
|
|
760
|
-
onRangeChange:
|
|
761
|
-
className:
|
|
762
|
-
background: /* @__PURE__ */
|
|
763
|
-
|
|
764
|
-
|
|
834
|
+
ref: t,
|
|
835
|
+
itemCount: K.length,
|
|
836
|
+
getItem: Ke,
|
|
837
|
+
getItemHeight: Ze,
|
|
838
|
+
viewportSize: ae,
|
|
839
|
+
overscanCount: Q,
|
|
840
|
+
onScroll: ze,
|
|
841
|
+
onRangeChange: Ue,
|
|
842
|
+
className: _,
|
|
843
|
+
background: /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
|
|
844
|
+
Qe,
|
|
845
|
+
J
|
|
765
846
|
] }),
|
|
766
|
-
initialScrollIndex:
|
|
767
|
-
initialScrollOffset:
|
|
768
|
-
onItemFocus:
|
|
769
|
-
callbackThrottleMs:
|
|
770
|
-
contentInsets:
|
|
771
|
-
scrollBarOptions:
|
|
772
|
-
behaviorOptions:
|
|
773
|
-
children: (
|
|
774
|
-
|
|
847
|
+
initialScrollIndex: Ie,
|
|
848
|
+
initialScrollOffset: B,
|
|
849
|
+
onItemFocus: Ve,
|
|
850
|
+
callbackThrottleMs: ue,
|
|
851
|
+
contentInsets: Xe,
|
|
852
|
+
scrollBarOptions: Ge,
|
|
853
|
+
behaviorOptions: Je,
|
|
854
|
+
children: (b) => b && /* @__PURE__ */ N.jsx(
|
|
855
|
+
_e,
|
|
775
856
|
{
|
|
776
|
-
entry:
|
|
777
|
-
indentLevel:
|
|
778
|
-
|
|
779
|
-
|
|
857
|
+
entry: b.entry,
|
|
858
|
+
indentLevel: b.indentLevel,
|
|
859
|
+
rowHeight: b.rowHeight,
|
|
860
|
+
isDirOpen: de,
|
|
861
|
+
parentIsLast: b.parentIsLast,
|
|
780
862
|
renderChildren: !1,
|
|
781
|
-
expansion: { toggleDirectory: r, onToggleDirectoryRecursive:
|
|
782
|
-
selection: { onEntryClick:
|
|
863
|
+
expansion: { toggleDirectory: r, onToggleDirectoryRecursive: qe },
|
|
864
|
+
selection: { onEntryClick: R, selectedPath: w ?? null, mode: c, selectedItems: h, onSelectionChange: y },
|
|
783
865
|
visual: {
|
|
784
|
-
iconOverrides:
|
|
785
|
-
showExpandIcons:
|
|
786
|
-
showDirectoryIcons:
|
|
787
|
-
showFileIcons:
|
|
788
|
-
useCanvasExpandIcons:
|
|
866
|
+
iconOverrides: g,
|
|
867
|
+
showExpandIcons: p,
|
|
868
|
+
showDirectoryIcons: j,
|
|
869
|
+
showFileIcons: v,
|
|
870
|
+
useCanvasExpandIcons: u,
|
|
789
871
|
expandIconSize: d,
|
|
790
|
-
highlightStyles:
|
|
872
|
+
highlightStyles: A,
|
|
873
|
+
entryClassName: X,
|
|
874
|
+
entryStyle: U,
|
|
875
|
+
nameClassName: q,
|
|
876
|
+
nameStyle: $,
|
|
877
|
+
directoryNameClassName: V,
|
|
878
|
+
directoryNameStyle: Z,
|
|
879
|
+
fileNameClassName: G,
|
|
880
|
+
fileNameStyle: se
|
|
791
881
|
}
|
|
792
882
|
},
|
|
793
|
-
|
|
883
|
+
b.entry.absolutePath
|
|
794
884
|
)
|
|
795
885
|
}
|
|
796
886
|
) });
|
|
797
|
-
},
|
|
798
|
-
const [
|
|
887
|
+
}, jt = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: r } = {}) => {
|
|
888
|
+
const [a, n] = rt(), [o, l] = ie(() => {
|
|
799
889
|
if (typeof window < "u" && r)
|
|
800
890
|
try {
|
|
801
|
-
const
|
|
802
|
-
if (
|
|
803
|
-
const
|
|
804
|
-
return new Set(
|
|
891
|
+
const i = window.localStorage.getItem(r);
|
|
892
|
+
if (i) {
|
|
893
|
+
const u = JSON.parse(i);
|
|
894
|
+
return new Set(u);
|
|
805
895
|
}
|
|
806
|
-
} catch (
|
|
807
|
-
console.error("[useDirectoryTreeState] Error reading from localStorage",
|
|
896
|
+
} catch (i) {
|
|
897
|
+
console.error("[useDirectoryTreeState] Error reading from localStorage", i);
|
|
808
898
|
}
|
|
809
899
|
return e;
|
|
810
|
-
}),
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
return
|
|
900
|
+
}), s = C((i) => {
|
|
901
|
+
n(() => {
|
|
902
|
+
l((u) => {
|
|
903
|
+
const p = new Set(u);
|
|
904
|
+
return i(p), p;
|
|
815
905
|
});
|
|
816
906
|
});
|
|
817
|
-
}, []), m =
|
|
818
|
-
(
|
|
819
|
-
|
|
820
|
-
for (const
|
|
821
|
-
|
|
907
|
+
}, []), m = C(
|
|
908
|
+
(i, u) => {
|
|
909
|
+
s((p) => {
|
|
910
|
+
for (const j of i)
|
|
911
|
+
u(p, j);
|
|
822
912
|
});
|
|
823
913
|
},
|
|
824
|
-
[
|
|
914
|
+
[s]
|
|
825
915
|
);
|
|
826
|
-
|
|
916
|
+
oe(() => {
|
|
827
917
|
if (r && typeof window < "u")
|
|
828
918
|
try {
|
|
829
|
-
window.localStorage.setItem(r, JSON.stringify(Array.from(
|
|
830
|
-
} catch (
|
|
831
|
-
console.warn(`Error setting localStorage key "${r}":`,
|
|
919
|
+
window.localStorage.setItem(r, JSON.stringify(Array.from(o)));
|
|
920
|
+
} catch (i) {
|
|
921
|
+
console.warn(`Error setting localStorage key "${r}":`, i);
|
|
832
922
|
}
|
|
833
|
-
}, [
|
|
834
|
-
const
|
|
835
|
-
(
|
|
836
|
-
m([
|
|
837
|
-
|
|
923
|
+
}, [o, r]);
|
|
924
|
+
const R = C(
|
|
925
|
+
(i) => {
|
|
926
|
+
m([i], (u, p) => {
|
|
927
|
+
u.has(p) ? u.delete(p) : u.add(p);
|
|
838
928
|
});
|
|
839
929
|
},
|
|
840
930
|
[m]
|
|
841
|
-
),
|
|
842
|
-
(
|
|
843
|
-
m([
|
|
844
|
-
|
|
931
|
+
), w = C(
|
|
932
|
+
(i) => {
|
|
933
|
+
m([i], (u, p) => {
|
|
934
|
+
u.add(p);
|
|
845
935
|
});
|
|
846
936
|
},
|
|
847
937
|
[m]
|
|
848
|
-
), c =
|
|
849
|
-
(
|
|
850
|
-
m([
|
|
851
|
-
|
|
938
|
+
), c = C(
|
|
939
|
+
(i) => {
|
|
940
|
+
m([i], (u, p) => {
|
|
941
|
+
u.delete(p);
|
|
852
942
|
});
|
|
853
943
|
},
|
|
854
944
|
[m]
|
|
855
|
-
),
|
|
856
|
-
(
|
|
857
|
-
m(
|
|
858
|
-
|
|
945
|
+
), h = C(
|
|
946
|
+
(i) => {
|
|
947
|
+
m(i, (u, p) => {
|
|
948
|
+
u.delete(p);
|
|
859
949
|
});
|
|
860
950
|
},
|
|
861
951
|
[m]
|
|
862
|
-
),
|
|
863
|
-
(
|
|
864
|
-
m(
|
|
865
|
-
|
|
952
|
+
), y = C(
|
|
953
|
+
(i) => {
|
|
954
|
+
m(i, (u, p) => {
|
|
955
|
+
u.add(p);
|
|
866
956
|
});
|
|
867
957
|
},
|
|
868
958
|
[m]
|
|
869
|
-
),
|
|
870
|
-
|
|
871
|
-
|
|
959
|
+
), E = C(() => {
|
|
960
|
+
s((i) => {
|
|
961
|
+
i.clear();
|
|
872
962
|
});
|
|
873
|
-
}, [
|
|
963
|
+
}, [s]), I = C((i) => o.has(i), [o]);
|
|
874
964
|
return {
|
|
875
|
-
expanded:
|
|
876
|
-
toggle:
|
|
877
|
-
expand:
|
|
965
|
+
expanded: o,
|
|
966
|
+
toggle: R,
|
|
967
|
+
expand: w,
|
|
878
968
|
collapse: c,
|
|
879
|
-
collapseMultiple:
|
|
880
|
-
expandMultiple:
|
|
881
|
-
collapseAll:
|
|
882
|
-
isExpanded:
|
|
883
|
-
isPending:
|
|
969
|
+
collapseMultiple: h,
|
|
970
|
+
expandMultiple: y,
|
|
971
|
+
collapseAll: E,
|
|
972
|
+
isExpanded: I,
|
|
973
|
+
isPending: a
|
|
884
974
|
};
|
|
885
975
|
};
|
|
886
976
|
export {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
977
|
+
Ct as DirectoryTree,
|
|
978
|
+
W as directoryTreeClasses,
|
|
979
|
+
jt as useDirectoryTreeState
|
|
890
980
|
};
|