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