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