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