@aiquants/directory-tree 1.0.1 → 1.2.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/directory-tree.css +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +428 -452
- package/dist/index.js.map +1 -1
- package/dist/src/DirectoryTree.d.ts +2 -2
- package/dist/src/DirectoryTree.d.ts.map +1 -1
- package/dist/src/TreeLine.d.ts +1 -1
- package/dist/src/TreeLine.d.ts.map +1 -1
- package/dist/src/types.d.ts +3 -0
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { VirtualScroll as
|
|
3
|
-
import { ChevronDownIcon as
|
|
4
|
-
import { FileIcon as
|
|
5
|
-
import { twMerge as
|
|
6
|
-
var
|
|
1
|
+
import Ie, { memo as Ce, useRef as ve, useState as H, useEffect as ne, useCallback as F, Fragment as je, useMemo as fe, useTransition as $e } from "react";
|
|
2
|
+
import { VirtualScroll as Oe } from "@aiquants/virtualscroll";
|
|
3
|
+
import { ChevronDownIcon as Ne, ChevronRightIcon as Le, FolderIcon as Ae, DocumentTextIcon as De } from "@heroicons/react/24/solid";
|
|
4
|
+
import { FileIcon as Pe } from "@phosphor-icons/react";
|
|
5
|
+
import { twMerge as P } from "tailwind-merge";
|
|
6
|
+
var he = { exports: {} }, ee = {};
|
|
7
7
|
/**
|
|
8
8
|
* @license React
|
|
9
9
|
* react-jsx-runtime.production.js
|
|
@@ -13,29 +13,29 @@ var ce = { exports: {} }, Q = {};
|
|
|
13
13
|
* This source code is licensed under the MIT license found in the
|
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
|
15
15
|
*/
|
|
16
|
-
var
|
|
17
|
-
function
|
|
18
|
-
if (
|
|
19
|
-
|
|
16
|
+
var Ee;
|
|
17
|
+
function Me() {
|
|
18
|
+
if (Ee) return ee;
|
|
19
|
+
Ee = 1;
|
|
20
20
|
var t = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
|
|
21
|
-
function u(
|
|
22
|
-
var
|
|
23
|
-
if (i !== void 0 && (
|
|
21
|
+
function u(l, s, i) {
|
|
22
|
+
var m = null;
|
|
23
|
+
if (i !== void 0 && (m = "" + i), s.key !== void 0 && (m = "" + s.key), "key" in s) {
|
|
24
24
|
i = {};
|
|
25
25
|
for (var p in s)
|
|
26
26
|
p !== "key" && (i[p] = s[p]);
|
|
27
27
|
} else i = s;
|
|
28
28
|
return s = i.ref, {
|
|
29
29
|
$$typeof: t,
|
|
30
|
-
type:
|
|
31
|
-
key:
|
|
30
|
+
type: l,
|
|
31
|
+
key: m,
|
|
32
32
|
ref: s !== void 0 ? s : null,
|
|
33
33
|
props: i
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
return
|
|
36
|
+
return ee.Fragment = r, ee.jsx = u, ee.jsxs = u, ee;
|
|
37
37
|
}
|
|
38
|
-
var
|
|
38
|
+
var te = {};
|
|
39
39
|
/**
|
|
40
40
|
* @license React
|
|
41
41
|
* react-jsx-runtime.development.js
|
|
@@ -45,47 +45,47 @@ var K = {};
|
|
|
45
45
|
* This source code is licensed under the MIT license found in the
|
|
46
46
|
* LICENSE file in the root directory of this source tree.
|
|
47
47
|
*/
|
|
48
|
-
var
|
|
49
|
-
function
|
|
50
|
-
return
|
|
48
|
+
var xe;
|
|
49
|
+
function Fe() {
|
|
50
|
+
return xe || (xe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
51
51
|
function t(e) {
|
|
52
52
|
if (e == null) return null;
|
|
53
53
|
if (typeof e == "function")
|
|
54
|
-
return e.$$typeof ===
|
|
54
|
+
return e.$$typeof === N ? null : e.displayName || e.name || null;
|
|
55
55
|
if (typeof e == "string") return e;
|
|
56
56
|
switch (e) {
|
|
57
|
-
case
|
|
57
|
+
case E:
|
|
58
58
|
return "Fragment";
|
|
59
|
-
case
|
|
59
|
+
case d:
|
|
60
60
|
return "Profiler";
|
|
61
|
-
case
|
|
61
|
+
case Y:
|
|
62
62
|
return "StrictMode";
|
|
63
|
-
case
|
|
63
|
+
case V:
|
|
64
64
|
return "Suspense";
|
|
65
|
-
case
|
|
65
|
+
case I:
|
|
66
66
|
return "SuspenseList";
|
|
67
|
-
case
|
|
67
|
+
case C:
|
|
68
68
|
return "Activity";
|
|
69
69
|
}
|
|
70
70
|
if (typeof e == "object")
|
|
71
71
|
switch (typeof e.tag == "number" && console.error(
|
|
72
72
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
73
73
|
), e.$$typeof) {
|
|
74
|
-
case
|
|
74
|
+
case o:
|
|
75
75
|
return "Portal";
|
|
76
|
-
case
|
|
76
|
+
case S:
|
|
77
77
|
return e.displayName || "Context";
|
|
78
|
-
case
|
|
78
|
+
case v:
|
|
79
79
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
80
|
-
case
|
|
81
|
-
var
|
|
82
|
-
return e = e.displayName, e || (e =
|
|
83
|
-
case
|
|
84
|
-
return
|
|
85
|
-
case
|
|
86
|
-
|
|
80
|
+
case O:
|
|
81
|
+
var n = e.render;
|
|
82
|
+
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
83
|
+
case x:
|
|
84
|
+
return n = e.displayName || null, n !== null ? n : t(e.type) || "Memo";
|
|
85
|
+
case z:
|
|
86
|
+
n = e._payload, e = e._init;
|
|
87
87
|
try {
|
|
88
|
-
return t(e(
|
|
88
|
+
return t(e(n));
|
|
89
89
|
} catch {
|
|
90
90
|
}
|
|
91
91
|
}
|
|
@@ -97,74 +97,74 @@ function De() {
|
|
|
97
97
|
function u(e) {
|
|
98
98
|
try {
|
|
99
99
|
r(e);
|
|
100
|
-
var
|
|
100
|
+
var n = !1;
|
|
101
101
|
} catch {
|
|
102
|
-
|
|
102
|
+
n = !0;
|
|
103
103
|
}
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
var
|
|
107
|
-
return
|
|
108
|
-
|
|
104
|
+
if (n) {
|
|
105
|
+
n = console;
|
|
106
|
+
var f = n.error, g = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
107
|
+
return f.call(
|
|
108
|
+
n,
|
|
109
109
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
110
|
-
|
|
110
|
+
g
|
|
111
111
|
), r(e);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
if (e ===
|
|
116
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
114
|
+
function l(e) {
|
|
115
|
+
if (e === E) return "<>";
|
|
116
|
+
if (typeof e == "object" && e !== null && e.$$typeof === z)
|
|
117
117
|
return "<...>";
|
|
118
118
|
try {
|
|
119
|
-
var
|
|
120
|
-
return
|
|
119
|
+
var n = t(e);
|
|
120
|
+
return n ? "<" + n + ">" : "<...>";
|
|
121
121
|
} catch {
|
|
122
122
|
return "<...>";
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
function s() {
|
|
126
|
-
var e =
|
|
126
|
+
var e = G.A;
|
|
127
127
|
return e === null ? null : e.getOwner();
|
|
128
128
|
}
|
|
129
129
|
function i() {
|
|
130
130
|
return Error("react-stack-top-frame");
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
if (
|
|
134
|
-
var
|
|
135
|
-
if (
|
|
132
|
+
function m(e) {
|
|
133
|
+
if (ae.call(e, "key")) {
|
|
134
|
+
var n = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
135
|
+
if (n && n.isReactWarning) return !1;
|
|
136
136
|
}
|
|
137
137
|
return e.key !== void 0;
|
|
138
138
|
}
|
|
139
|
-
function p(e,
|
|
140
|
-
function
|
|
141
|
-
|
|
139
|
+
function p(e, n) {
|
|
140
|
+
function f() {
|
|
141
|
+
oe || (oe = !0, console.error(
|
|
142
142
|
"%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)",
|
|
143
|
-
|
|
143
|
+
n
|
|
144
144
|
));
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
get:
|
|
146
|
+
f.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
147
|
+
get: f,
|
|
148
148
|
configurable: !0
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function R() {
|
|
152
152
|
var e = t(this.type);
|
|
153
|
-
return
|
|
153
|
+
return se[e] || (se[e] = !0, console.error(
|
|
154
154
|
"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."
|
|
155
155
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
var
|
|
157
|
+
function D(e, n, f, g, U, Q) {
|
|
158
|
+
var y = f.ref;
|
|
159
159
|
return e = {
|
|
160
|
-
$$typeof:
|
|
160
|
+
$$typeof: b,
|
|
161
161
|
type: e,
|
|
162
|
-
key:
|
|
163
|
-
props:
|
|
164
|
-
_owner:
|
|
165
|
-
}, (
|
|
162
|
+
key: n,
|
|
163
|
+
props: f,
|
|
164
|
+
_owner: g
|
|
165
|
+
}, (y !== void 0 ? y : null) !== null ? Object.defineProperty(e, "ref", {
|
|
166
166
|
enumerable: !1,
|
|
167
|
-
get:
|
|
167
|
+
get: R
|
|
168
168
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
169
169
|
configurable: !1,
|
|
170
170
|
enumerable: !1,
|
|
@@ -179,69 +179,69 @@ function De() {
|
|
|
179
179
|
configurable: !1,
|
|
180
180
|
enumerable: !1,
|
|
181
181
|
writable: !0,
|
|
182
|
-
value:
|
|
182
|
+
value: U
|
|
183
183
|
}), Object.defineProperty(e, "_debugTask", {
|
|
184
184
|
configurable: !1,
|
|
185
185
|
enumerable: !1,
|
|
186
186
|
writable: !0,
|
|
187
|
-
value:
|
|
187
|
+
value: Q
|
|
188
188
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
189
189
|
}
|
|
190
|
-
function
|
|
191
|
-
var
|
|
192
|
-
if (
|
|
193
|
-
if (
|
|
194
|
-
if (
|
|
195
|
-
for (
|
|
196
|
-
|
|
197
|
-
Object.freeze && Object.freeze(
|
|
190
|
+
function $(e, n, f, g, U, Q) {
|
|
191
|
+
var y = n.children;
|
|
192
|
+
if (y !== void 0)
|
|
193
|
+
if (g)
|
|
194
|
+
if (J(y)) {
|
|
195
|
+
for (g = 0; g < y.length; g++)
|
|
196
|
+
w(y[g]);
|
|
197
|
+
Object.freeze && Object.freeze(y);
|
|
198
198
|
} else
|
|
199
199
|
console.error(
|
|
200
200
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
201
201
|
);
|
|
202
|
-
else
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
var
|
|
206
|
-
return
|
|
202
|
+
else w(y);
|
|
203
|
+
if (ae.call(n, "key")) {
|
|
204
|
+
y = t(e);
|
|
205
|
+
var j = Object.keys(n).filter(function(me) {
|
|
206
|
+
return me !== "key";
|
|
207
207
|
});
|
|
208
|
-
|
|
208
|
+
g = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", ie[y + g] || (j = 0 < j.length ? "{" + j.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
209
209
|
`A props object containing a "key" prop is being spread into JSX:
|
|
210
210
|
let props = %s;
|
|
211
211
|
<%s {...props} />
|
|
212
212
|
React keys must be passed directly to JSX without using spread:
|
|
213
213
|
let props = %s;
|
|
214
214
|
<%s key={someKey} {...props} />`,
|
|
215
|
-
y,
|
|
216
215
|
g,
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
216
|
+
y,
|
|
217
|
+
j,
|
|
218
|
+
y
|
|
219
|
+
), ie[y + g] = !0);
|
|
220
220
|
}
|
|
221
|
-
if (
|
|
222
|
-
|
|
223
|
-
for (var
|
|
224
|
-
|
|
225
|
-
} else
|
|
226
|
-
return
|
|
227
|
-
|
|
221
|
+
if (y = null, f !== void 0 && (u(f), y = "" + f), m(n) && (u(n.key), y = "" + n.key), "key" in n) {
|
|
222
|
+
f = {};
|
|
223
|
+
for (var X in n)
|
|
224
|
+
X !== "key" && (f[X] = n[X]);
|
|
225
|
+
} else f = n;
|
|
226
|
+
return y && p(
|
|
227
|
+
f,
|
|
228
228
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
229
|
-
),
|
|
229
|
+
), D(
|
|
230
230
|
e,
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
y,
|
|
232
|
+
f,
|
|
233
233
|
s(),
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
U,
|
|
235
|
+
Q
|
|
236
236
|
);
|
|
237
237
|
}
|
|
238
|
-
function T(e) {
|
|
239
|
-
w(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === Y && (e._payload.status === "fulfilled" ? w(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
240
|
-
}
|
|
241
238
|
function w(e) {
|
|
242
|
-
|
|
239
|
+
T(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === z && (e._payload.status === "fulfilled" ? T(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
240
|
+
}
|
|
241
|
+
function T(e) {
|
|
242
|
+
return typeof e == "object" && e !== null && e.$$typeof === b;
|
|
243
243
|
}
|
|
244
|
-
var a =
|
|
244
|
+
var a = Ie, b = Symbol.for("react.transitional.element"), o = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), Y = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), v = Symbol.for("react.consumer"), S = Symbol.for("react.context"), O = Symbol.for("react.forward_ref"), V = Symbol.for("react.suspense"), I = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), z = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), N = Symbol.for("react.client.reference"), G = a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ae = Object.prototype.hasOwnProperty, J = Array.isArray, Z = console.createTask ? console.createTask : function() {
|
|
245
245
|
return null;
|
|
246
246
|
};
|
|
247
247
|
a = {
|
|
@@ -249,422 +249,398 @@ React keys must be passed directly to JSX without using spread:
|
|
|
249
249
|
return e();
|
|
250
250
|
}
|
|
251
251
|
};
|
|
252
|
-
var
|
|
252
|
+
var oe, se = {}, le = a.react_stack_bottom_frame.bind(
|
|
253
253
|
a,
|
|
254
254
|
i
|
|
255
|
-
)(),
|
|
256
|
-
|
|
257
|
-
var
|
|
258
|
-
return
|
|
255
|
+
)(), ce = Z(l(i)), ie = {};
|
|
256
|
+
te.Fragment = E, te.jsx = function(e, n, f) {
|
|
257
|
+
var g = 1e4 > G.recentlyCreatedOwnerStacks++;
|
|
258
|
+
return $(
|
|
259
259
|
e,
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
n,
|
|
261
|
+
f,
|
|
262
262
|
!1,
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
g ? Error("react-stack-top-frame") : le,
|
|
264
|
+
g ? Z(l(e)) : ce
|
|
265
265
|
);
|
|
266
|
-
},
|
|
267
|
-
var
|
|
268
|
-
return
|
|
266
|
+
}, te.jsxs = function(e, n, f) {
|
|
267
|
+
var g = 1e4 > G.recentlyCreatedOwnerStacks++;
|
|
268
|
+
return $(
|
|
269
269
|
e,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
n,
|
|
271
|
+
f,
|
|
272
272
|
!0,
|
|
273
|
-
|
|
274
|
-
|
|
273
|
+
g ? Error("react-stack-top-frame") : le,
|
|
274
|
+
g ? Z(l(e)) : ce
|
|
275
275
|
);
|
|
276
276
|
};
|
|
277
|
-
})()),
|
|
277
|
+
})()), te;
|
|
278
278
|
}
|
|
279
|
-
var
|
|
280
|
-
function
|
|
281
|
-
return
|
|
279
|
+
var we;
|
|
280
|
+
function Ye() {
|
|
281
|
+
return we || (we = 1, process.env.NODE_ENV === "production" ? he.exports = Me() : he.exports = Fe()), he.exports;
|
|
282
282
|
}
|
|
283
|
-
var
|
|
284
|
-
const
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
283
|
+
var h = Ye();
|
|
284
|
+
const Ve = ({ items: t, itemHeight: r, width: u, segmentWidth: l, color: s = "#a0aec0", strokeWidth: i = 1, renderFromY: m = 0, renderHeight: p, renderStartIndex: R, renderEndIndex: D, lookaheadEndIndex: $ }) => {
|
|
285
|
+
const w = [], T = p ?? t.length * r, a = typeof R == "number" && Number.isFinite(R) ? Math.max(0, Math.floor(R)) : Math.max(0, Math.floor(m / r)), b = Math.min(t.length, Math.ceil((m + T) / r)), o = (() => {
|
|
286
|
+
if (typeof D == "number" && Number.isFinite(D)) {
|
|
287
|
+
const d = Math.floor(D);
|
|
288
|
+
return Math.max(Math.min(t.length, d + 1), a);
|
|
289
|
+
}
|
|
290
|
+
return Math.max(b, a);
|
|
291
|
+
})(), E = (() => {
|
|
292
|
+
if (typeof $ == "number" && Number.isFinite($)) {
|
|
293
|
+
const d = Math.floor($), v = Math.min(t.length, d + 1);
|
|
294
|
+
return Math.max(v, o);
|
|
295
|
+
}
|
|
296
|
+
return Math.max(b, o);
|
|
297
|
+
})();
|
|
298
|
+
for (let d = a; d < o; d++) {
|
|
299
|
+
const v = t[d], S = d * r, O = S + r / 2;
|
|
300
|
+
for (let x = 0; x < v.indentLevel; x++) {
|
|
301
|
+
const z = x * l + l / 2;
|
|
302
|
+
let C = !1;
|
|
303
|
+
for (let N = d; N < E; N++) {
|
|
304
|
+
if (t[N].indentLevel > x && t[N].ancestorIsLast.length > x && !t[N].ancestorIsLast[x]) {
|
|
305
|
+
C = !0;
|
|
294
306
|
break;
|
|
295
307
|
}
|
|
296
|
-
if (t[
|
|
308
|
+
if (t[N].indentLevel === x && N > d)
|
|
297
309
|
break;
|
|
298
310
|
}
|
|
299
|
-
|
|
311
|
+
C && v.ancestorIsLast.length > x && !v.ancestorIsLast[x] && w.push(`M ${z},${S} L ${z},${S + r}`);
|
|
300
312
|
}
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
const x =
|
|
304
|
-
|
|
313
|
+
const V = v.indentLevel * l, I = V + l / 2;
|
|
314
|
+
if (v.isDirectory) {
|
|
315
|
+
const x = l / 1.5;
|
|
316
|
+
w.push(`M ${I},${S} L ${I},${O - x}`);
|
|
305
317
|
} else
|
|
306
|
-
|
|
307
|
-
if (
|
|
308
|
-
if (
|
|
309
|
-
const x =
|
|
310
|
-
|
|
318
|
+
w.push(`M ${I},${S} L ${I},${O}`);
|
|
319
|
+
if (v.isDirectory || v.isLastChild && w.push(`M ${I},${O} L ${V + l},${O}`), !v.isLastChild)
|
|
320
|
+
if (v.isDirectory) {
|
|
321
|
+
const x = l / 1.5;
|
|
322
|
+
w.push(`M ${I},${O + x} L ${I},${S + r}`);
|
|
311
323
|
} else
|
|
312
|
-
|
|
324
|
+
w.push(`M ${I},${O} L ${I},${S + r}`);
|
|
313
325
|
}
|
|
314
|
-
const
|
|
315
|
-
return /* @__PURE__ */
|
|
326
|
+
const Y = t.length * r;
|
|
327
|
+
return /* @__PURE__ */ h.jsxs(
|
|
316
328
|
"svg",
|
|
317
329
|
{
|
|
318
330
|
width: u,
|
|
319
|
-
height: p ??
|
|
320
|
-
viewBox: `0 ${
|
|
331
|
+
height: p ?? Y,
|
|
332
|
+
viewBox: `0 ${m} ${u} ${p ?? Y}`,
|
|
321
333
|
fill: "none",
|
|
322
334
|
xmlns: "http://www.w3.org/2000/svg",
|
|
323
335
|
className: "pointer-events-none absolute top-0 left-0 z-0 opacity-75",
|
|
324
336
|
children: [
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
|
|
337
|
+
/* @__PURE__ */ h.jsx("title", { children: "Tree Lines" }),
|
|
338
|
+
w.map((d, v) => /* @__PURE__ */ h.jsx("path", { d, stroke: s, strokeWidth: i, strokeLinecap: "round", strokeLinejoin: "round" }, `path-${t[a + v]?.id || v}-${a + v}`))
|
|
327
339
|
]
|
|
328
340
|
}
|
|
329
341
|
);
|
|
330
|
-
},
|
|
331
|
-
container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden",
|
|
342
|
+
}, A = {
|
|
343
|
+
container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[5px] pr-[1px] pr-[3px]",
|
|
332
344
|
containerPending: "opacity-70",
|
|
333
345
|
entry: "flex items-center cursor-pointer relative select-none",
|
|
334
346
|
// ホバー時のスタイル(ライト/ダークモード対応)
|
|
335
|
-
entryHover:
|
|
336
|
-
"hover:bg-gray-400/15",
|
|
337
|
-
"dark:hover:bg-gray-200/10"
|
|
338
|
-
),
|
|
347
|
+
entryHover: P("hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
|
|
339
348
|
// 選択時のスタイル(ライト/ダークモード対応)
|
|
340
|
-
entrySelected:
|
|
341
|
-
"bg-blue-400/10",
|
|
342
|
-
"dark:bg-blue-400/15"
|
|
343
|
-
),
|
|
349
|
+
entrySelected: P("bg-blue-400/10", "dark:bg-blue-400/15"),
|
|
344
350
|
// アイテム選択時のスタイル(ライト/ダークモード対応)
|
|
345
|
-
entryItemSelected:
|
|
346
|
-
"bg-blue-400/20 shadow-[0_0_0_1px_rgba(59,130,246,0.3)]",
|
|
347
|
-
"dark:bg-blue-400/25 dark:shadow-[0_0_0_1px_rgba(96,165,250,0.4)]"
|
|
348
|
-
),
|
|
351
|
+
entryItemSelected: P("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)]"),
|
|
349
352
|
// アイコンのスタイル
|
|
350
|
-
expandIcon:
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
),
|
|
355
|
-
expandIconSelected: R(
|
|
356
|
-
"text-blue-700",
|
|
357
|
-
"dark:text-blue-400"
|
|
358
|
-
),
|
|
359
|
-
typeIcon: R(
|
|
360
|
-
"w-5 h-5 flex-shrink-0 flex items-center justify-center",
|
|
361
|
-
"text-gray-500",
|
|
362
|
-
"dark:text-gray-400"
|
|
363
|
-
),
|
|
364
|
-
typeIconSelected: R(
|
|
365
|
-
"text-blue-700",
|
|
366
|
-
"dark:text-blue-400"
|
|
367
|
-
),
|
|
353
|
+
expandIcon: P("w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
354
|
+
expandIconSelected: P("text-blue-700", "dark:text-blue-400"),
|
|
355
|
+
typeIcon: P("w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
356
|
+
typeIconSelected: P("text-blue-700", "dark:text-blue-400"),
|
|
368
357
|
// テキストのスタイル
|
|
369
|
-
name:
|
|
370
|
-
"overflow-hidden text-ellipsis whitespace-nowrap ml-1",
|
|
371
|
-
"text-gray-700",
|
|
372
|
-
"dark:text-gray-200"
|
|
373
|
-
),
|
|
358
|
+
name: P("overflow-hidden text-ellipsis whitespace-nowrap ml-1", "text-gray-700", "dark:text-gray-200"),
|
|
374
359
|
nameDirectory: "font-bold",
|
|
375
|
-
nameSelected:
|
|
376
|
-
|
|
377
|
-
"dark:text-blue-300"
|
|
378
|
-
)
|
|
379
|
-
}, xe = {
|
|
360
|
+
nameSelected: P("text-blue-800 font-medium", "dark:text-blue-300")
|
|
361
|
+
}, Se = {
|
|
380
362
|
msOverflowStyle: "none",
|
|
381
|
-
/* IE and Edge */
|
|
382
363
|
scrollbarWidth: "none"
|
|
383
|
-
|
|
384
|
-
}, Fe = () => {
|
|
364
|
+
}, ze = () => {
|
|
385
365
|
let t = document.getElementById("directory-tree-webkit-scrollbar-hide");
|
|
386
366
|
t || (t = document.createElement("style"), t.id = "directory-tree-webkit-scrollbar-hide", t.textContent = ".directory-tree-container::-webkit-scrollbar { display: none; }", document.head.appendChild(t));
|
|
387
|
-
},
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
), Ve = (t = !1) => R(
|
|
393
|
-
_.expandIcon,
|
|
394
|
-
t && _.expandIconSelected
|
|
395
|
-
), ze = (t = !1) => R(
|
|
396
|
-
_.typeIcon,
|
|
397
|
-
t && _.typeIconSelected
|
|
398
|
-
), Ue = (t = !1, r = !1) => R(
|
|
399
|
-
_.name,
|
|
400
|
-
t && _.nameDirectory,
|
|
401
|
-
r && _.nameSelected
|
|
402
|
-
), Je = Ce, We = (t) => t.slice((t.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(), be = Te(
|
|
403
|
-
({
|
|
404
|
-
entry: t,
|
|
405
|
-
indentLevel: r,
|
|
406
|
-
isDirOpen: u,
|
|
407
|
-
onFileSelect: c,
|
|
408
|
-
toggleDirectory: s,
|
|
409
|
-
onToggleDirectoryRecursive: i,
|
|
410
|
-
selectedPath: f,
|
|
411
|
-
parentIsLast: p,
|
|
412
|
-
renderChildren: E = !0,
|
|
413
|
-
selectionMode: k = "none",
|
|
414
|
-
selectedItems: C,
|
|
415
|
-
onSelectionChange: T
|
|
416
|
-
}) => {
|
|
417
|
-
const w = he(null), [a, l] = W(null);
|
|
418
|
-
ee(() => () => {
|
|
419
|
-
w.current && window.clearTimeout(w.current);
|
|
367
|
+
}, Ue = (t = !1, r = !1, u = !1) => P(A.entry, t && A.entryHover, r && A.entrySelected, u && A.entryItemSelected), Be = (t = !1) => P(A.expandIcon, t && A.expandIconSelected), Je = (t = !1) => P(A.typeIcon, t && A.typeIconSelected), We = (t = !1, r = !1) => P(A.name, t && A.nameDirectory, r && A.nameSelected), qe = Oe, He = (t) => t.slice((t.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(), ye = Ce(
|
|
368
|
+
({ entry: t, indentLevel: r, isDirOpen: u, onFileSelect: l, toggleDirectory: s, onToggleDirectoryRecursive: i, selectedPath: m, parentIsLast: p, renderChildren: R = !0, selectionMode: D = "none", selectedItems: $, onSelectionChange: w }) => {
|
|
369
|
+
const T = ve(null), [a, b] = H(null);
|
|
370
|
+
ne(() => () => {
|
|
371
|
+
T.current && window.clearTimeout(T.current);
|
|
420
372
|
}, []);
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
}) :
|
|
426
|
-
}, [
|
|
427
|
-
const
|
|
428
|
-
(
|
|
429
|
-
|
|
430
|
-
s(t.absolutePath, t.relativePath),
|
|
431
|
-
}, 500) :
|
|
373
|
+
const o = t.children !== void 0, E = o && u(t.absolutePath, t.relativePath), Y = t.absolutePath === m, d = !o && $?.has(t.absolutePath);
|
|
374
|
+
ne(() => {
|
|
375
|
+
E && t.children ? Promise.resolve().then(() => {
|
|
376
|
+
b(t.children ?? []);
|
|
377
|
+
}) : b(null);
|
|
378
|
+
}, [E, t.children]);
|
|
379
|
+
const v = F(
|
|
380
|
+
(C) => {
|
|
381
|
+
C.stopPropagation(), D !== "none" && !o && w && w(t.absolutePath, !d), o ? T.current ? (window.clearTimeout(T.current), T.current = null, i(t)) : T.current = window.setTimeout(() => {
|
|
382
|
+
s(t.absolutePath, t.relativePath), T.current = null;
|
|
383
|
+
}, 500) : l(t.absolutePath, t.relativePath);
|
|
432
384
|
},
|
|
433
|
-
[
|
|
434
|
-
), [
|
|
435
|
-
return /* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
385
|
+
[o, t, i, s, l, D, w, d]
|
|
386
|
+
), [S, O] = H(!1), V = Ue(S, Y, d), I = Be(Y || d), x = Je(Y || d), z = We(o, Y || d);
|
|
387
|
+
return /* @__PURE__ */ h.jsxs(je, { children: [
|
|
388
|
+
/* @__PURE__ */ h.jsxs(
|
|
437
389
|
"div",
|
|
438
390
|
{
|
|
439
|
-
className:
|
|
391
|
+
className: V,
|
|
440
392
|
style: {
|
|
441
|
-
paddingLeft: `${r *
|
|
442
|
-
height: `${
|
|
393
|
+
paddingLeft: `${r * ge}px`,
|
|
394
|
+
height: `${re}px`
|
|
443
395
|
},
|
|
444
|
-
onClick:
|
|
445
|
-
onMouseEnter: () =>
|
|
446
|
-
onMouseLeave: () =>
|
|
447
|
-
onKeyDown: (
|
|
448
|
-
|
|
396
|
+
onClick: v,
|
|
397
|
+
onMouseEnter: () => O(!0),
|
|
398
|
+
onMouseLeave: () => O(!1),
|
|
399
|
+
onKeyDown: (C) => {
|
|
400
|
+
C.key === "Enter" && v(C);
|
|
449
401
|
},
|
|
450
402
|
tabIndex: 0,
|
|
451
403
|
role: "treeitem",
|
|
452
|
-
"aria-expanded":
|
|
453
|
-
"aria-label": `${t.name} (${
|
|
404
|
+
"aria-expanded": o ? E : void 0,
|
|
405
|
+
"aria-label": `${t.name} (${o ? "directory" : "file"})`,
|
|
454
406
|
children: [
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
/* @__PURE__ */
|
|
457
|
-
switch (
|
|
407
|
+
/* @__PURE__ */ h.jsx("span", { className: I, children: o ? E ? /* @__PURE__ */ h.jsx(Ne, { className: "h-4 w-4" }) : /* @__PURE__ */ h.jsx(Le, { className: "h-4 w-4" }) : /* @__PURE__ */ h.jsx("span", { className: "w-4" }) }),
|
|
408
|
+
/* @__PURE__ */ h.jsx("span", { className: x, children: o ? /* @__PURE__ */ h.jsx(Ae, { className: "h-4 w-4" }) : (() => {
|
|
409
|
+
switch (He(t.name)) {
|
|
458
410
|
case "md":
|
|
459
|
-
return /* @__PURE__ */
|
|
411
|
+
return /* @__PURE__ */ h.jsx(De, { className: "h-4 w-4" });
|
|
460
412
|
default:
|
|
461
|
-
return /* @__PURE__ */
|
|
413
|
+
return /* @__PURE__ */ h.jsx(Pe, { className: "h-4 w-4" });
|
|
462
414
|
}
|
|
463
415
|
})() }),
|
|
464
|
-
/* @__PURE__ */
|
|
416
|
+
/* @__PURE__ */ h.jsx("span", { className: z, children: t.name })
|
|
465
417
|
]
|
|
466
418
|
}
|
|
467
419
|
),
|
|
468
|
-
|
|
469
|
-
|
|
420
|
+
E && a && R && /* @__PURE__ */ h.jsx("fieldset", { children: a.map((C, N) => /* @__PURE__ */ h.jsx(
|
|
421
|
+
ye,
|
|
470
422
|
{
|
|
471
|
-
entry:
|
|
423
|
+
entry: C,
|
|
472
424
|
indentLevel: r + 1,
|
|
473
425
|
isDirOpen: u,
|
|
474
|
-
onFileSelect:
|
|
426
|
+
onFileSelect: l,
|
|
475
427
|
toggleDirectory: s,
|
|
476
428
|
onToggleDirectoryRecursive: i,
|
|
477
|
-
selectedPath:
|
|
478
|
-
parentIsLast: [...p,
|
|
479
|
-
selectionMode:
|
|
480
|
-
selectedItems:
|
|
481
|
-
onSelectionChange:
|
|
429
|
+
selectedPath: m,
|
|
430
|
+
parentIsLast: [...p, N === (a || []).length - 1],
|
|
431
|
+
selectionMode: D,
|
|
432
|
+
selectedItems: $,
|
|
433
|
+
onSelectionChange: w
|
|
482
434
|
},
|
|
483
|
-
|
|
435
|
+
C.absolutePath
|
|
484
436
|
)) })
|
|
485
437
|
] }, t.absolutePath);
|
|
486
438
|
},
|
|
487
439
|
(t, r) => {
|
|
488
440
|
if (t.entry.absolutePath !== r.entry.absolutePath || t.entry.relativePath !== r.entry.relativePath || t.entry.name !== r.entry.name || t.entry.type !== r.entry.type || t.entry.children === void 0 != (r.entry.children === void 0))
|
|
489
441
|
return !1;
|
|
490
|
-
const u = t.entry.children !== void 0,
|
|
442
|
+
const u = t.entry.children !== void 0, l = r.entry.children !== void 0, s = u && t.isDirOpen(t.entry.absolutePath, t.entry.relativePath), i = l && r.isDirOpen(r.entry.absolutePath, r.entry.relativePath);
|
|
491
443
|
if (t.indentLevel !== r.indentLevel || s !== i || t.selectedPath !== r.selectedPath || t.onFileSelect !== r.onFileSelect || // onFileSelect はメモ化されていることを期待
|
|
492
444
|
t.toggleDirectory !== r.toggleDirectory || // toggleDirectory はメモ化されていることを期待
|
|
493
445
|
t.onToggleDirectoryRecursive !== r.onToggleDirectoryRecursive || t.selectionMode !== r.selectionMode || t.selectedItems !== r.selectedItems || t.onSelectionChange !== r.onSelectionChange || t.parentIsLast.length !== r.parentIsLast.length)
|
|
494
446
|
return !1;
|
|
495
|
-
for (let
|
|
496
|
-
if (t.parentIsLast[
|
|
447
|
+
for (let m = 0; m < t.parentIsLast.length; m++)
|
|
448
|
+
if (t.parentIsLast[m] !== r.parentIsLast[m])
|
|
497
449
|
return !1;
|
|
498
450
|
return !0;
|
|
499
451
|
}
|
|
500
452
|
);
|
|
501
|
-
|
|
502
|
-
const
|
|
453
|
+
ye.displayName = "DirectoryEntryItem";
|
|
454
|
+
const re = 20, ge = 16, _e = (t) => {
|
|
503
455
|
const r = [];
|
|
504
456
|
if (t.children)
|
|
505
457
|
for (const u of t.children)
|
|
506
|
-
u.type === "directory" && (r.push(u.absolutePath), r.push(...
|
|
458
|
+
u.type === "directory" && (r.push(u.absolutePath), r.push(..._e(u)));
|
|
507
459
|
return r;
|
|
508
|
-
},
|
|
509
|
-
const
|
|
510
|
-
return s.children && s.children.length > 0 && r(s.absolutePath, s.relativePath) ? [
|
|
511
|
-
}),
|
|
460
|
+
}, ke = (t, r, u = [], l = 0) => t.flatMap((s, i) => {
|
|
461
|
+
const m = i === t.length - 1, p = [...u, m], R = { entry: s, indentLevel: l, parentIsLast: p };
|
|
462
|
+
return s.children && s.children.length > 0 && r(s.absolutePath, s.relativePath) ? [R, ...ke(s.children, r, p, l + 1)] : [R];
|
|
463
|
+
}), et = ({
|
|
512
464
|
entries: t,
|
|
513
465
|
onFileSelect: r,
|
|
514
466
|
className: u,
|
|
515
|
-
style:
|
|
467
|
+
style: l,
|
|
516
468
|
selectedPath: s,
|
|
517
469
|
toggle: i,
|
|
518
|
-
isExpanded:
|
|
470
|
+
isExpanded: m,
|
|
519
471
|
expandMultiple: p,
|
|
520
|
-
collapseMultiple:
|
|
521
|
-
isPending:
|
|
522
|
-
doubleClickAction:
|
|
523
|
-
selectionMode:
|
|
524
|
-
selectedItems:
|
|
472
|
+
collapseMultiple: R,
|
|
473
|
+
isPending: D,
|
|
474
|
+
doubleClickAction: $ = "recursive",
|
|
475
|
+
selectionMode: w = "none",
|
|
476
|
+
selectedItems: T,
|
|
525
477
|
onSelectionChange: a,
|
|
526
|
-
lineColor:
|
|
527
|
-
virtualScrollOptions:
|
|
478
|
+
lineColor: b = "#A0AEC0",
|
|
479
|
+
virtualScrollOptions: o
|
|
528
480
|
}) => {
|
|
529
|
-
const [
|
|
530
|
-
overscanCount:
|
|
531
|
-
className:
|
|
532
|
-
background:
|
|
533
|
-
onScroll:
|
|
534
|
-
onRangeChange:
|
|
535
|
-
initialScrollIndex:
|
|
536
|
-
initialScrollOffset:
|
|
537
|
-
tapScrollCircleOptions:
|
|
538
|
-
scrollBarWidth:
|
|
539
|
-
enableThumbDrag:
|
|
540
|
-
enableTrackClick:
|
|
541
|
-
enableArrowButtons:
|
|
542
|
-
enablePointerDrag:
|
|
543
|
-
inertiaOptions:
|
|
544
|
-
} =
|
|
545
|
-
(
|
|
546
|
-
|
|
481
|
+
const [E, Y] = H(!1), d = ve(null), v = ve(null), [S, O] = H(0), [V, I] = H(null), {
|
|
482
|
+
overscanCount: x,
|
|
483
|
+
className: z,
|
|
484
|
+
background: C,
|
|
485
|
+
onScroll: N,
|
|
486
|
+
onRangeChange: G,
|
|
487
|
+
initialScrollIndex: ae,
|
|
488
|
+
initialScrollOffset: J,
|
|
489
|
+
tapScrollCircleOptions: Z,
|
|
490
|
+
scrollBarWidth: oe,
|
|
491
|
+
enableThumbDrag: se,
|
|
492
|
+
enableTrackClick: le,
|
|
493
|
+
enableArrowButtons: ce,
|
|
494
|
+
enablePointerDrag: ie,
|
|
495
|
+
inertiaOptions: e
|
|
496
|
+
} = o ?? {}, n = typeof J == "number" ? J : 0, [f, g] = H(n), U = typeof x == "number" ? x : 10, Q = F(
|
|
497
|
+
(c, _) => {
|
|
498
|
+
g(c), N?.(c, _);
|
|
499
|
+
},
|
|
500
|
+
[N]
|
|
501
|
+
), y = F(
|
|
502
|
+
(c, _, L, k, M, W) => {
|
|
503
|
+
I((B) => B && B.renderStart === c && B.renderEnd === _ ? B : { renderStart: c, renderEnd: _ }), G?.(c, _, L, k, M, W);
|
|
547
504
|
},
|
|
548
|
-
[
|
|
505
|
+
[G]
|
|
549
506
|
);
|
|
550
|
-
|
|
551
|
-
typeof
|
|
552
|
-
}, [
|
|
553
|
-
if (
|
|
554
|
-
|
|
555
|
-
const
|
|
556
|
-
for (const
|
|
557
|
-
|
|
507
|
+
ne(() => {
|
|
508
|
+
typeof J == "number" && g(J);
|
|
509
|
+
}, [J]), ne(() => {
|
|
510
|
+
if (Y(!0), ze(), d.current) {
|
|
511
|
+
O(d.current.clientHeight);
|
|
512
|
+
const c = new ResizeObserver((_) => {
|
|
513
|
+
for (const L of _)
|
|
514
|
+
O(L.contentRect.height);
|
|
558
515
|
});
|
|
559
|
-
return
|
|
516
|
+
return c.observe(d.current), () => c.disconnect();
|
|
560
517
|
}
|
|
561
518
|
}, []);
|
|
562
|
-
const
|
|
563
|
-
(
|
|
564
|
-
[
|
|
565
|
-
),
|
|
566
|
-
(
|
|
567
|
-
const
|
|
568
|
-
|
|
519
|
+
const j = F(
|
|
520
|
+
(c) => E ? m(c) : !1,
|
|
521
|
+
[E, m]
|
|
522
|
+
), X = D ? `${A.container} ${A.containerPending}` : A.container, me = F(
|
|
523
|
+
(c, _) => {
|
|
524
|
+
const L = _e(c), k = [c.absolutePath, ...L], M = _ || $;
|
|
525
|
+
k.every((B) => j(B)) ? R(k) : k.every((K) => !j(K)) || M === "recursive" ? p(k) : M === "toggle" ? R(k) : console.warn(`[DirectoryTree] Unknown double click action: ${M}. No action taken.`);
|
|
569
526
|
},
|
|
570
|
-
[
|
|
571
|
-
),
|
|
527
|
+
[j, p, R, $]
|
|
528
|
+
), ue = fe(() => {
|
|
572
529
|
if (t.length === 0)
|
|
573
530
|
return [];
|
|
574
|
-
const
|
|
575
|
-
function
|
|
576
|
-
|
|
577
|
-
const
|
|
578
|
-
id:
|
|
579
|
-
name:
|
|
580
|
-
absolutePath:
|
|
581
|
-
indentLevel:
|
|
582
|
-
isLastChild:
|
|
583
|
-
isDirectory:
|
|
584
|
-
isExpanded:
|
|
585
|
-
ancestorIsLast: [...
|
|
531
|
+
const c = [];
|
|
532
|
+
function _(L, k, M) {
|
|
533
|
+
L.forEach((W, B) => {
|
|
534
|
+
const K = W.children !== void 0, be = W.absolutePath, pe = K && j(be), Te = {
|
|
535
|
+
id: be,
|
|
536
|
+
name: W.name,
|
|
537
|
+
absolutePath: be,
|
|
538
|
+
indentLevel: k,
|
|
539
|
+
isLastChild: B === L.length - 1,
|
|
540
|
+
isDirectory: K,
|
|
541
|
+
isExpanded: pe,
|
|
542
|
+
ancestorIsLast: [...M]
|
|
586
543
|
// 祖先の状態をコピーして渡す
|
|
587
544
|
};
|
|
588
|
-
|
|
545
|
+
c.push(Te), K && pe && W.children && _(W.children, k + 1, [...M, B === L.length - 1]);
|
|
589
546
|
});
|
|
590
547
|
}
|
|
591
|
-
return
|
|
592
|
-
}, [t,
|
|
548
|
+
return _(t, 0, []), c;
|
|
549
|
+
}, [t, j]), q = fe(() => ke(t, j), [t, j]), de = fe(() => {
|
|
593
550
|
if (t.length === 0)
|
|
594
551
|
return 0;
|
|
595
|
-
let
|
|
596
|
-
for (const
|
|
597
|
-
|
|
598
|
-
return (
|
|
599
|
-
}, [
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
552
|
+
let c = 0;
|
|
553
|
+
for (const _ of ue)
|
|
554
|
+
_.indentLevel > c && (c = _.indentLevel);
|
|
555
|
+
return (c + 2) * ge;
|
|
556
|
+
}, [ue, t]), Re = fe(() => {
|
|
557
|
+
if (de <= 0 || S <= 0)
|
|
558
|
+
return null;
|
|
559
|
+
const c = V?.renderStart ?? Math.max(0, Math.floor(f / re)), _ = S > 0 ? Math.ceil(S / re) + U : U, L = q.length > 0 ? Math.min(q.length - 1, c + _) : c, k = V?.renderEnd ?? L, M = q.length > 0 ? Math.min(q.length - 1, k + U) : k;
|
|
560
|
+
return /* @__PURE__ */ h.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ h.jsx("div", { className: "absolute top-0 left-0", style: { width: de, height: S }, children: /* @__PURE__ */ h.jsx(
|
|
561
|
+
Ve,
|
|
604
562
|
{
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
}
|
|
563
|
+
items: ue,
|
|
564
|
+
itemHeight: re,
|
|
565
|
+
width: de,
|
|
566
|
+
segmentWidth: ge,
|
|
567
|
+
color: b,
|
|
568
|
+
renderFromY: f,
|
|
569
|
+
renderHeight: S,
|
|
570
|
+
renderStartIndex: c,
|
|
571
|
+
renderEndIndex: k,
|
|
572
|
+
lookaheadEndIndex: M
|
|
573
|
+
}
|
|
574
|
+
) }) });
|
|
575
|
+
}, [de, S, V, f, U, q.length, ue, b]);
|
|
576
|
+
return t.length === 0 ? /* @__PURE__ */ h.jsx("div", { className: `${X} ${u || ""}`, style: { ...l, ...Se } }) : /* @__PURE__ */ h.jsx("div", { ref: d, className: `${X} ${u || ""}`, style: { ...l, ...Se }, role: "tree", children: /* @__PURE__ */ h.jsx(
|
|
577
|
+
qe,
|
|
578
|
+
{
|
|
579
|
+
ref: v,
|
|
580
|
+
itemCount: q.length,
|
|
581
|
+
getItem: (c) => q[c],
|
|
582
|
+
getItemHeight: () => re,
|
|
583
|
+
viewportSize: S,
|
|
584
|
+
overscanCount: U,
|
|
585
|
+
onScroll: Q,
|
|
586
|
+
onRangeChange: y,
|
|
587
|
+
className: z,
|
|
588
|
+
background: /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
|
|
589
|
+
Re,
|
|
590
|
+
C
|
|
591
|
+
] }),
|
|
592
|
+
initialScrollIndex: ae,
|
|
593
|
+
initialScrollOffset: J,
|
|
594
|
+
tapScrollCircleOptions: Z,
|
|
595
|
+
scrollBarWidth: oe,
|
|
596
|
+
enableThumbDrag: se,
|
|
597
|
+
enableTrackClick: le,
|
|
598
|
+
enableArrowButtons: ce,
|
|
599
|
+
enablePointerDrag: ie,
|
|
600
|
+
inertiaOptions: e,
|
|
601
|
+
children: (c, _) => {
|
|
602
|
+
if (!c)
|
|
603
|
+
return null;
|
|
604
|
+
const { entry: L, indentLevel: k, parentIsLast: M } = c;
|
|
605
|
+
return /* @__PURE__ */ h.jsx(
|
|
606
|
+
ye,
|
|
607
|
+
{
|
|
608
|
+
entry: L,
|
|
609
|
+
indentLevel: k,
|
|
610
|
+
isDirOpen: j,
|
|
611
|
+
onFileSelect: r,
|
|
612
|
+
toggleDirectory: i,
|
|
613
|
+
onToggleDirectoryRecursive: me,
|
|
614
|
+
selectedPath: s,
|
|
615
|
+
parentIsLast: M,
|
|
616
|
+
renderChildren: !1,
|
|
617
|
+
selectionMode: w,
|
|
618
|
+
selectedItems: T,
|
|
619
|
+
onSelectionChange: a
|
|
620
|
+
},
|
|
621
|
+
L.absolutePath
|
|
622
|
+
);
|
|
647
623
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
},
|
|
624
|
+
}
|
|
625
|
+
) });
|
|
626
|
+
}, tt = ({
|
|
651
627
|
initialExpanded: t = /* @__PURE__ */ new Set(),
|
|
652
628
|
storageKey: r
|
|
653
629
|
} = {}) => {
|
|
654
|
-
const [u,
|
|
630
|
+
const [u, l] = $e(), [s, i] = H(() => {
|
|
655
631
|
if (typeof window < "u" && r)
|
|
656
632
|
try {
|
|
657
633
|
const a = window.localStorage.getItem(r);
|
|
658
634
|
if (a) {
|
|
659
|
-
const
|
|
660
|
-
return new Set(
|
|
635
|
+
const b = JSON.parse(a);
|
|
636
|
+
return new Set(b);
|
|
661
637
|
}
|
|
662
638
|
} catch (a) {
|
|
663
639
|
console.error("[useDirectoryTreeState] Error reading from localStorage", a);
|
|
664
640
|
}
|
|
665
641
|
return t;
|
|
666
642
|
});
|
|
667
|
-
|
|
643
|
+
ne(() => {
|
|
668
644
|
if (r && typeof window < "u")
|
|
669
645
|
try {
|
|
670
646
|
window.localStorage.setItem(r, JSON.stringify(Array.from(s)));
|
|
@@ -672,70 +648,70 @@ const ie = 20, me = 16, we = (t) => {
|
|
|
672
648
|
console.warn(`Error setting localStorage key "${r}":`, a);
|
|
673
649
|
}
|
|
674
650
|
}, [s, r]);
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
i((
|
|
678
|
-
const
|
|
679
|
-
return
|
|
651
|
+
const m = F((a) => {
|
|
652
|
+
l(() => {
|
|
653
|
+
i((b) => {
|
|
654
|
+
const o = new Set(b);
|
|
655
|
+
return o.has(a) ? o.delete(a) : o.add(a), o;
|
|
680
656
|
});
|
|
681
657
|
});
|
|
682
|
-
}, []), p =
|
|
683
|
-
|
|
684
|
-
i((
|
|
685
|
-
const
|
|
686
|
-
return
|
|
658
|
+
}, []), p = F((a) => {
|
|
659
|
+
l(() => {
|
|
660
|
+
i((b) => {
|
|
661
|
+
const o = new Set(b);
|
|
662
|
+
return o.has(a) || o.add(a), o;
|
|
687
663
|
});
|
|
688
664
|
});
|
|
689
|
-
}, []),
|
|
690
|
-
|
|
691
|
-
i((
|
|
692
|
-
const
|
|
693
|
-
return
|
|
665
|
+
}, []), R = F((a) => {
|
|
666
|
+
l(() => {
|
|
667
|
+
i((b) => {
|
|
668
|
+
const o = new Set(b);
|
|
669
|
+
return o.has(a) && o.delete(a), o;
|
|
694
670
|
});
|
|
695
671
|
});
|
|
696
|
-
}, []),
|
|
697
|
-
|
|
698
|
-
i((
|
|
699
|
-
const
|
|
700
|
-
for (const
|
|
701
|
-
|
|
702
|
-
return
|
|
672
|
+
}, []), D = F((a) => {
|
|
673
|
+
l(() => {
|
|
674
|
+
i((b) => {
|
|
675
|
+
const o = new Set(b);
|
|
676
|
+
for (const E of a)
|
|
677
|
+
o.has(E) && o.delete(E);
|
|
678
|
+
return o;
|
|
703
679
|
});
|
|
704
680
|
});
|
|
705
|
-
}, []),
|
|
706
|
-
|
|
707
|
-
i((
|
|
708
|
-
const
|
|
709
|
-
for (const
|
|
710
|
-
|
|
711
|
-
return
|
|
681
|
+
}, []), $ = F((a) => {
|
|
682
|
+
l(() => {
|
|
683
|
+
i((b) => {
|
|
684
|
+
const o = new Set(b);
|
|
685
|
+
for (const E of a)
|
|
686
|
+
o.has(E) || o.add(E);
|
|
687
|
+
return o;
|
|
712
688
|
});
|
|
713
689
|
});
|
|
714
|
-
}, []),
|
|
715
|
-
|
|
690
|
+
}, []), w = F(() => {
|
|
691
|
+
l(() => {
|
|
716
692
|
i(/* @__PURE__ */ new Set());
|
|
717
693
|
});
|
|
718
|
-
}, []),
|
|
694
|
+
}, []), T = F((a) => s.has(a), [s]);
|
|
719
695
|
return {
|
|
720
696
|
expanded: s,
|
|
721
|
-
toggle:
|
|
697
|
+
toggle: m,
|
|
722
698
|
expand: p,
|
|
723
|
-
collapse:
|
|
724
|
-
collapseMultiple:
|
|
725
|
-
expandMultiple:
|
|
726
|
-
collapseAll:
|
|
727
|
-
isExpanded:
|
|
699
|
+
collapse: R,
|
|
700
|
+
collapseMultiple: D,
|
|
701
|
+
expandMultiple: $,
|
|
702
|
+
collapseAll: w,
|
|
703
|
+
isExpanded: T,
|
|
728
704
|
isPending: u
|
|
729
705
|
};
|
|
730
706
|
};
|
|
731
707
|
export {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
708
|
+
et as DirectoryTree,
|
|
709
|
+
Ve as TreeLine,
|
|
710
|
+
A as directoryTreeClasses,
|
|
711
|
+
Ue as getEntryClasses,
|
|
712
|
+
Be as getExpandIconClasses,
|
|
713
|
+
We as getNameClasses,
|
|
714
|
+
Je as getTypeIconClasses,
|
|
715
|
+
tt as useDirectoryTreeState
|
|
740
716
|
};
|
|
741
717
|
//# sourceMappingURL=index.js.map
|