@aiquants/directory-tree 5.0.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +90 -62
- package/dist/cli.js +3 -3
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +994 -954
- package/dist/palette.d.ts +125 -0
- package/dist/styles/directory-tree.standalone.css +1 -1
- package/dist/types.d.ts +2 -2
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,193 +1,193 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import { VIRTUAL_SCROLL_LABEL_KEYS as
|
|
4
|
-
import { twMerge as
|
|
5
|
-
import { FileIcon as
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
if (
|
|
10
|
-
|
|
1
|
+
import * as he from "react";
|
|
2
|
+
import pr, { useRef as Y, useEffect as De, useCallback as _, memo as Ft, useState as fe, useMemo as M, useLayoutEffect as In, useImperativeHandle as yr, useTransition as gr } from "react";
|
|
3
|
+
import { VIRTUAL_SCROLL_LABEL_KEYS as pt, VIRTUAL_SCROLL_LABEL_CATALOGS as kn, resolveVirtualScrollLocale as zn, resolveVirtualScrollLabels as br, VirtualScroll as vr, ScrollBar as Sr } from "@aiquants/virtualscroll";
|
|
4
|
+
import { twMerge as U } from "tailwind-merge";
|
|
5
|
+
import { FileIcon as wr, FileText as Er, FileCode as xr, FileZip as Rr, FileVideo as Ir, FileAudio as kr, FileImage as Nr, FilePpt as Tr, FileDoc as Pr, FileCsv as _r, FileXls as Cr, FilePdf as Or, FileMd as jr } from "@phosphor-icons/react";
|
|
6
|
+
var mt = { exports: {} }, qe = {};
|
|
7
|
+
var Nn;
|
|
8
|
+
function Ar() {
|
|
9
|
+
if (Nn) return qe;
|
|
10
|
+
Nn = 1;
|
|
11
11
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
12
|
-
function n(r,
|
|
12
|
+
function n(r, a, i) {
|
|
13
13
|
var l = null;
|
|
14
|
-
if (i !== void 0 && (l = "" + i),
|
|
14
|
+
if (i !== void 0 && (l = "" + i), a.key !== void 0 && (l = "" + a.key), "key" in a) {
|
|
15
15
|
i = {};
|
|
16
|
-
for (var d in
|
|
17
|
-
d !== "key" && (i[d] =
|
|
18
|
-
} else i =
|
|
19
|
-
return
|
|
16
|
+
for (var d in a)
|
|
17
|
+
d !== "key" && (i[d] = a[d]);
|
|
18
|
+
} else i = a;
|
|
19
|
+
return a = i.ref, {
|
|
20
20
|
$$typeof: e,
|
|
21
21
|
type: r,
|
|
22
22
|
key: l,
|
|
23
|
-
ref:
|
|
23
|
+
ref: a !== void 0 ? a : null,
|
|
24
24
|
props: i
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return qe.Fragment = t, qe.jsx = n, qe.jsxs = n, qe;
|
|
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 Qe = {};
|
|
30
|
+
var Tn;
|
|
31
|
+
function Lr() {
|
|
32
|
+
return Tn || (Tn = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
33
|
+
function e(o) {
|
|
34
|
+
if (o == null) return null;
|
|
35
|
+
if (typeof o == "function")
|
|
36
|
+
return o.$$typeof === z ? null : o.displayName || o.name || null;
|
|
37
|
+
if (typeof o == "string") return o;
|
|
38
|
+
switch (o) {
|
|
39
|
+
case w:
|
|
40
40
|
return "Fragment";
|
|
41
|
-
case
|
|
41
|
+
case F:
|
|
42
42
|
return "Profiler";
|
|
43
43
|
case v:
|
|
44
44
|
return "StrictMode";
|
|
45
|
-
case
|
|
45
|
+
case D:
|
|
46
46
|
return "Suspense";
|
|
47
47
|
case $:
|
|
48
48
|
return "SuspenseList";
|
|
49
49
|
case J:
|
|
50
50
|
return "Activity";
|
|
51
51
|
}
|
|
52
|
-
if (typeof
|
|
53
|
-
switch (typeof
|
|
52
|
+
if (typeof o == "object")
|
|
53
|
+
switch (typeof o.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
|
+
), o.$$typeof) {
|
|
56
|
+
case p:
|
|
57
57
|
return "Portal";
|
|
58
58
|
case C:
|
|
59
|
-
return
|
|
59
|
+
return o.displayName || "Context";
|
|
60
60
|
case P:
|
|
61
|
-
return (
|
|
62
|
-
case
|
|
63
|
-
var u =
|
|
64
|
-
return
|
|
61
|
+
return (o._context.displayName || "Context") + ".Consumer";
|
|
62
|
+
case g:
|
|
63
|
+
var u = o.render;
|
|
64
|
+
return o = o.displayName, o || (o = u.displayName || u.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
|
|
65
65
|
case O:
|
|
66
|
-
return u =
|
|
66
|
+
return u = o.displayName || null, u !== null ? u : e(o.type) || "Memo";
|
|
67
67
|
case Q:
|
|
68
|
-
u =
|
|
68
|
+
u = o._payload, o = o._init;
|
|
69
69
|
try {
|
|
70
|
-
return e(
|
|
70
|
+
return e(o(u));
|
|
71
71
|
} catch {
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
|
-
function t(
|
|
77
|
-
return "" +
|
|
76
|
+
function t(o) {
|
|
77
|
+
return "" + o;
|
|
78
78
|
}
|
|
79
|
-
function n(
|
|
79
|
+
function n(o) {
|
|
80
80
|
try {
|
|
81
|
-
t(
|
|
81
|
+
t(o);
|
|
82
82
|
var u = !1;
|
|
83
83
|
} catch {
|
|
84
84
|
u = !0;
|
|
85
85
|
}
|
|
86
86
|
if (u) {
|
|
87
87
|
u = console;
|
|
88
|
-
var
|
|
89
|
-
return
|
|
88
|
+
var I = u.error, E = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
|
|
89
|
+
return I.call(
|
|
90
90
|
u,
|
|
91
91
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
92
92
|
E
|
|
93
|
-
), t(
|
|
93
|
+
), t(o);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
function r(
|
|
97
|
-
if (
|
|
98
|
-
if (typeof
|
|
96
|
+
function r(o) {
|
|
97
|
+
if (o === w) return "<>";
|
|
98
|
+
if (typeof o == "object" && o !== null && o.$$typeof === Q)
|
|
99
99
|
return "<...>";
|
|
100
100
|
try {
|
|
101
|
-
var u = e(
|
|
101
|
+
var u = e(o);
|
|
102
102
|
return u ? "<" + u + ">" : "<...>";
|
|
103
103
|
} catch {
|
|
104
104
|
return "<...>";
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
var
|
|
109
|
-
return
|
|
107
|
+
function a() {
|
|
108
|
+
var o = B.A;
|
|
109
|
+
return o === null ? null : o.getOwner();
|
|
110
110
|
}
|
|
111
111
|
function i() {
|
|
112
112
|
return Error("react-stack-top-frame");
|
|
113
113
|
}
|
|
114
|
-
function l(
|
|
115
|
-
if (
|
|
116
|
-
var u = Object.getOwnPropertyDescriptor(
|
|
114
|
+
function l(o) {
|
|
115
|
+
if (me.call(o, "key")) {
|
|
116
|
+
var u = Object.getOwnPropertyDescriptor(o, "key").get;
|
|
117
117
|
if (u && u.isReactWarning) return !1;
|
|
118
118
|
}
|
|
119
|
-
return
|
|
119
|
+
return o.key !== void 0;
|
|
120
120
|
}
|
|
121
|
-
function d(
|
|
122
|
-
function
|
|
123
|
-
|
|
121
|
+
function d(o, u) {
|
|
122
|
+
function I() {
|
|
123
|
+
pe || (pe = !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
|
u
|
|
126
126
|
));
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
get:
|
|
128
|
+
I.isReactWarning = !0, Object.defineProperty(o, "key", {
|
|
129
|
+
get: I,
|
|
130
130
|
configurable: !0
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
var
|
|
135
|
-
return V[
|
|
133
|
+
function h() {
|
|
134
|
+
var o = e(this.type);
|
|
135
|
+
return V[o] || (V[o] = !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
|
+
)), o = this.props.ref, o !== void 0 ? o : null;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
var j =
|
|
141
|
-
return
|
|
142
|
-
$$typeof:
|
|
143
|
-
type:
|
|
139
|
+
function b(o, u, I, E, ve, k) {
|
|
140
|
+
var j = I.ref;
|
|
141
|
+
return o = {
|
|
142
|
+
$$typeof: y,
|
|
143
|
+
type: o,
|
|
144
144
|
key: u,
|
|
145
|
-
props:
|
|
145
|
+
props: I,
|
|
146
146
|
_owner: E
|
|
147
|
-
}, (j !== void 0 ? j : null) !== null ? Object.defineProperty(
|
|
147
|
+
}, (j !== void 0 ? j : null) !== null ? Object.defineProperty(o, "ref", {
|
|
148
148
|
enumerable: !1,
|
|
149
|
-
get:
|
|
150
|
-
}) : Object.defineProperty(
|
|
149
|
+
get: h
|
|
150
|
+
}) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
|
|
151
151
|
configurable: !1,
|
|
152
152
|
enumerable: !1,
|
|
153
153
|
writable: !0,
|
|
154
154
|
value: 0
|
|
155
|
-
}), Object.defineProperty(
|
|
155
|
+
}), Object.defineProperty(o, "_debugInfo", {
|
|
156
156
|
configurable: !1,
|
|
157
157
|
enumerable: !1,
|
|
158
158
|
writable: !0,
|
|
159
159
|
value: null
|
|
160
|
-
}), Object.defineProperty(
|
|
160
|
+
}), Object.defineProperty(o, "_debugStack", {
|
|
161
161
|
configurable: !1,
|
|
162
162
|
enumerable: !1,
|
|
163
163
|
writable: !0,
|
|
164
|
-
value:
|
|
165
|
-
}), Object.defineProperty(
|
|
164
|
+
value: ve
|
|
165
|
+
}), Object.defineProperty(o, "_debugTask", {
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
168
168
|
writable: !0,
|
|
169
|
-
value:
|
|
170
|
-
}), Object.freeze && (Object.freeze(
|
|
169
|
+
value: k
|
|
170
|
+
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function N(o, u, I, E, ve, k) {
|
|
173
173
|
var j = u.children;
|
|
174
174
|
if (j !== void 0)
|
|
175
175
|
if (E)
|
|
176
|
-
if (
|
|
176
|
+
if (W(j)) {
|
|
177
177
|
for (E = 0; E < j.length; E++)
|
|
178
|
-
|
|
178
|
+
x(j[E]);
|
|
179
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
|
-
j = e(
|
|
187
|
-
var ee = Object.keys(u).filter(function(
|
|
188
|
-
return
|
|
184
|
+
else x(j);
|
|
185
|
+
if (me.call(u, "key")) {
|
|
186
|
+
j = e(o);
|
|
187
|
+
var ee = Object.keys(u).filter(function(Ne) {
|
|
188
|
+
return Ne !== "key";
|
|
189
189
|
});
|
|
190
|
-
E = 0 < ee.length ? "{key: someKey, " + ee.join(": ..., ") + ": ...}" : "{key: someKey}",
|
|
190
|
+
E = 0 < ee.length ? "{key: someKey, " + ee.join(": ..., ") + ": ...}" : "{key: someKey}", be[j + E] || (ee = 0 < ee.length ? "{" + ee.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} />
|
|
@@ -198,77 +198,77 @@ React keys must be passed directly to JSX without using spread:
|
|
|
198
198
|
j,
|
|
199
199
|
ee,
|
|
200
200
|
j
|
|
201
|
-
),
|
|
201
|
+
), be[j + E] = !0);
|
|
202
202
|
}
|
|
203
|
-
if (j = null,
|
|
204
|
-
|
|
205
|
-
for (var
|
|
206
|
-
|
|
207
|
-
} else
|
|
203
|
+
if (j = null, I !== void 0 && (n(I), j = "" + I), l(u) && (n(u.key), j = "" + u.key), "key" in u) {
|
|
204
|
+
I = {};
|
|
205
|
+
for (var ye in u)
|
|
206
|
+
ye !== "key" && (I[ye] = u[ye]);
|
|
207
|
+
} else I = u;
|
|
208
208
|
return j && d(
|
|
209
|
-
|
|
210
|
-
typeof
|
|
211
|
-
),
|
|
212
|
-
|
|
209
|
+
I,
|
|
210
|
+
typeof o == "function" ? o.displayName || o.name || "Unknown" : o
|
|
211
|
+
), b(
|
|
212
|
+
o,
|
|
213
213
|
j,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
I,
|
|
215
|
+
a(),
|
|
216
|
+
ve,
|
|
217
|
+
k
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
|
|
220
|
+
function x(o) {
|
|
221
|
+
T(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === Q && (o._payload.status === "fulfilled" ? T(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
return typeof
|
|
223
|
+
function T(o) {
|
|
224
|
+
return typeof o == "object" && o !== null && o.$$typeof === y;
|
|
225
225
|
}
|
|
226
|
-
var
|
|
226
|
+
var m = pr, y = /* @__PURE__ */ Symbol.for("react.transitional.element"), p = /* @__PURE__ */ Symbol.for("react.portal"), w = /* @__PURE__ */ Symbol.for("react.fragment"), v = /* @__PURE__ */ Symbol.for("react.strict_mode"), F = /* @__PURE__ */ Symbol.for("react.profiler"), P = /* @__PURE__ */ Symbol.for("react.consumer"), C = /* @__PURE__ */ Symbol.for("react.context"), g = /* @__PURE__ */ Symbol.for("react.forward_ref"), D = /* @__PURE__ */ Symbol.for("react.suspense"), $ = /* @__PURE__ */ Symbol.for("react.suspense_list"), O = /* @__PURE__ */ Symbol.for("react.memo"), Q = /* @__PURE__ */ Symbol.for("react.lazy"), J = /* @__PURE__ */ Symbol.for("react.activity"), z = /* @__PURE__ */ Symbol.for("react.client.reference"), B = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, me = Object.prototype.hasOwnProperty, W = Array.isArray, oe = console.createTask ? console.createTask : function() {
|
|
227
227
|
return null;
|
|
228
228
|
};
|
|
229
|
-
|
|
230
|
-
react_stack_bottom_frame: function(
|
|
231
|
-
return
|
|
229
|
+
m = {
|
|
230
|
+
react_stack_bottom_frame: function(o) {
|
|
231
|
+
return o();
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
var
|
|
235
|
-
|
|
234
|
+
var pe, V = {}, X = m.react_stack_bottom_frame.bind(
|
|
235
|
+
m,
|
|
236
236
|
i
|
|
237
|
-
)(),
|
|
238
|
-
|
|
239
|
-
var E = 1e4 >
|
|
240
|
-
return
|
|
241
|
-
|
|
237
|
+
)(), xe = oe(r(i)), be = {};
|
|
238
|
+
Qe.Fragment = w, Qe.jsx = function(o, u, I) {
|
|
239
|
+
var E = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
240
|
+
return N(
|
|
241
|
+
o,
|
|
242
242
|
u,
|
|
243
|
-
|
|
243
|
+
I,
|
|
244
244
|
!1,
|
|
245
|
-
E ? Error("react-stack-top-frame") :
|
|
246
|
-
E ? oe(r(
|
|
245
|
+
E ? Error("react-stack-top-frame") : X,
|
|
246
|
+
E ? oe(r(o)) : xe
|
|
247
247
|
);
|
|
248
|
-
},
|
|
249
|
-
var E = 1e4 >
|
|
250
|
-
return
|
|
251
|
-
|
|
248
|
+
}, Qe.jsxs = function(o, u, I) {
|
|
249
|
+
var E = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
250
|
+
return N(
|
|
251
|
+
o,
|
|
252
252
|
u,
|
|
253
|
-
|
|
253
|
+
I,
|
|
254
254
|
!0,
|
|
255
|
-
E ? Error("react-stack-top-frame") :
|
|
256
|
-
E ? oe(r(
|
|
255
|
+
E ? Error("react-stack-top-frame") : X,
|
|
256
|
+
E ? oe(r(o)) : xe
|
|
257
257
|
);
|
|
258
258
|
};
|
|
259
|
-
})()),
|
|
259
|
+
})()), Qe;
|
|
260
260
|
}
|
|
261
|
-
var
|
|
262
|
-
function
|
|
263
|
-
return
|
|
261
|
+
var Pn;
|
|
262
|
+
function Dr() {
|
|
263
|
+
return Pn || (Pn = 1, process.env.NODE_ENV === "production" ? mt.exports = Ar() : mt.exports = Lr()), mt.exports;
|
|
264
264
|
}
|
|
265
|
-
var f =
|
|
266
|
-
function
|
|
265
|
+
var f = Dr();
|
|
266
|
+
function $r({
|
|
267
267
|
title: e,
|
|
268
268
|
titleId: t,
|
|
269
269
|
...n
|
|
270
270
|
}, r) {
|
|
271
|
-
return /* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ he.createElement("svg", Object.assign({
|
|
272
272
|
xmlns: "http://www.w3.org/2000/svg",
|
|
273
273
|
viewBox: "0 0 24 24",
|
|
274
274
|
fill: "currentColor",
|
|
@@ -276,21 +276,21 @@ function Ar({
|
|
|
276
276
|
"data-slot": "icon",
|
|
277
277
|
ref: r,
|
|
278
278
|
"aria-labelledby": t
|
|
279
|
-
}, n), e ? /* @__PURE__ */
|
|
279
|
+
}, n), e ? /* @__PURE__ */ he.createElement("title", {
|
|
280
280
|
id: t
|
|
281
|
-
}, e) : null, /* @__PURE__ */
|
|
281
|
+
}, e) : null, /* @__PURE__ */ he.createElement("path", {
|
|
282
282
|
fillRule: "evenodd",
|
|
283
283
|
d: "M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z",
|
|
284
284
|
clipRule: "evenodd"
|
|
285
285
|
}));
|
|
286
286
|
}
|
|
287
|
-
const
|
|
288
|
-
function
|
|
287
|
+
const Fr = /* @__PURE__ */ he.forwardRef($r);
|
|
288
|
+
function Mr({
|
|
289
289
|
title: e,
|
|
290
290
|
titleId: t,
|
|
291
291
|
...n
|
|
292
292
|
}, r) {
|
|
293
|
-
return /* @__PURE__ */
|
|
293
|
+
return /* @__PURE__ */ he.createElement("svg", Object.assign({
|
|
294
294
|
xmlns: "http://www.w3.org/2000/svg",
|
|
295
295
|
viewBox: "0 0 24 24",
|
|
296
296
|
fill: "currentColor",
|
|
@@ -298,21 +298,21 @@ function Dr({
|
|
|
298
298
|
"data-slot": "icon",
|
|
299
299
|
ref: r,
|
|
300
300
|
"aria-labelledby": t
|
|
301
|
-
}, n), e ? /* @__PURE__ */
|
|
301
|
+
}, n), e ? /* @__PURE__ */ he.createElement("title", {
|
|
302
302
|
id: t
|
|
303
|
-
}, e) : null, /* @__PURE__ */
|
|
303
|
+
}, e) : null, /* @__PURE__ */ he.createElement("path", {
|
|
304
304
|
fillRule: "evenodd",
|
|
305
305
|
d: "M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",
|
|
306
306
|
clipRule: "evenodd"
|
|
307
307
|
}));
|
|
308
308
|
}
|
|
309
|
-
const
|
|
310
|
-
function
|
|
309
|
+
const zr = /* @__PURE__ */ he.forwardRef(Mr);
|
|
310
|
+
function Hr({
|
|
311
311
|
title: e,
|
|
312
312
|
titleId: t,
|
|
313
313
|
...n
|
|
314
314
|
}, r) {
|
|
315
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ he.createElement("svg", Object.assign({
|
|
316
316
|
xmlns: "http://www.w3.org/2000/svg",
|
|
317
317
|
viewBox: "0 0 24 24",
|
|
318
318
|
fill: "currentColor",
|
|
@@ -320,41 +320,79 @@ function $r({
|
|
|
320
320
|
"data-slot": "icon",
|
|
321
321
|
ref: r,
|
|
322
322
|
"aria-labelledby": t
|
|
323
|
-
}, n), e ? /* @__PURE__ */
|
|
323
|
+
}, n), e ? /* @__PURE__ */ he.createElement("title", {
|
|
324
324
|
id: t
|
|
325
|
-
}, e) : null, /* @__PURE__ */
|
|
325
|
+
}, e) : null, /* @__PURE__ */ he.createElement("path", {
|
|
326
326
|
d: "M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"
|
|
327
327
|
}));
|
|
328
328
|
}
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
329
|
+
const Wr = /* @__PURE__ */ he.forwardRef(Hr), Br = {
|
|
330
|
+
icon: { light: "#6a7282", dark: "#99a1af" },
|
|
331
|
+
iconSelected: { light: "#1447e6", dark: "#51a2ff" },
|
|
332
|
+
checkedRing: { light: "#155dfc", dark: "#51a2ff" }
|
|
333
|
+
}, Jo = {
|
|
334
|
+
markdown: { light: "#0084d1", dark: "#00bcff" },
|
|
335
|
+
pdf: { light: "#e7000b", dark: "#ff6467" },
|
|
336
|
+
spreadsheet: { light: "#007a55", dark: "#00d492" },
|
|
337
|
+
csv: { light: "#007a55", dark: "#00d492" },
|
|
338
|
+
document: { light: "#155dfc", dark: "#51a2ff" },
|
|
339
|
+
presentation: { light: "#ca3500", dark: "#ff8904" },
|
|
340
|
+
image: { light: "#00786f", dark: "#00d5be" },
|
|
341
|
+
audio: { light: "#e60076", dark: "#fb64b6" },
|
|
342
|
+
video: { light: "#7f22fe", dark: "#a684ff" },
|
|
343
|
+
archive: { light: "#bb4d00", dark: "#ffb900" },
|
|
344
|
+
code: { light: "#9810fa", dark: "#c27aff" },
|
|
345
|
+
text: Br.icon
|
|
346
|
+
}, Hn = "#71829b", ce = {
|
|
347
|
+
rowHover: "hover:bg-[color:light-dark(#f3f4f6,#1e2939)]",
|
|
348
|
+
rowSelected: "bg-[color:light-dark(#eff6ff,#162456)]",
|
|
349
|
+
checkedRing: "inset-ring-1 inset-ring-[color:light-dark(#155dfc,#51a2ff)]",
|
|
350
|
+
name: "text-[color:light-dark(#364153,#e5e7eb)]",
|
|
351
|
+
nameSelected: "text-[color:light-dark(#193cb8,#bedbff)]",
|
|
352
|
+
gridEdge: "text-[color:light-dark(#4a5565,#d1d5dc)]",
|
|
353
|
+
icon: "text-[color:light-dark(#6a7282,#99a1af)]",
|
|
354
|
+
iconSelected: "text-[color:light-dark(#1447e6,#51a2ff)]"
|
|
355
|
+
}, ue = {
|
|
356
|
+
markdown: "text-[color:light-dark(#0084d1,#00bcff)]",
|
|
357
|
+
pdf: "text-[color:light-dark(#e7000b,#ff6467)]",
|
|
358
|
+
spreadsheet: "text-[color:light-dark(#007a55,#00d492)]",
|
|
359
|
+
csv: "text-[color:light-dark(#007a55,#00d492)]",
|
|
360
|
+
document: "text-[color:light-dark(#155dfc,#51a2ff)]",
|
|
361
|
+
presentation: "text-[color:light-dark(#ca3500,#ff8904)]",
|
|
362
|
+
image: "text-[color:light-dark(#00786f,#00d5be)]",
|
|
363
|
+
audio: "text-[color:light-dark(#e60076,#fb64b6)]",
|
|
364
|
+
video: "text-[color:light-dark(#7f22fe,#a684ff)]",
|
|
365
|
+
archive: "text-[color:light-dark(#bb4d00,#ffb900)]",
|
|
366
|
+
code: "text-[color:light-dark(#9810fa,#c27aff)]",
|
|
367
|
+
text: "text-[color:light-dark(#6a7282,#99a1af)]"
|
|
368
|
+
}, Wn = "text-[length:var(--dt-font-size-body,0.8125rem)]", Yr = `${Wn} leading-[max(var(--dt-line-height-body,1.25rem),1.5em)]`, Ot = 44, Gr = 12, Vr = 8, de = 14, Xr = 14, Bn = (e) => e === void 0 ? void 0 : { fontSize: typeof e == "number" ? `${e}px` : e }, ae = (e) => ({ width: e, height: e }), L = {
|
|
369
|
+
container: "directory-tree-container relative h-full overflow-y-hidden pb-[3px] pr-[2px]",
|
|
370
|
+
// 保留中も薄めない。薄めた文字と印は地と混ざり、配色表の組の対比 (文字 7:1・印 3:1) を割る
|
|
371
|
+
containerPending: "cursor-progress",
|
|
332
372
|
// 行は itemHeight の固定の箱で中身を縦の中央に置くため、上下の詰め物は行の高さを中身から奪うだけになる
|
|
333
373
|
// (行の中に置いたホストのボタンが行の高さいっぱいの的にならない)
|
|
334
|
-
entry: `directory-tree-entry flex items-center cursor-pointer relative select-none ${
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
//
|
|
338
|
-
|
|
339
|
-
// アイテム選択時のスタイル(ライト/ダークモード対応)
|
|
340
|
-
entryItemSelected: L("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)]"),
|
|
374
|
+
entry: `directory-tree-entry flex items-center cursor-pointer relative select-none ${Yr}`,
|
|
375
|
+
entryHover: `directory-tree-entry--hover ${ce.rowHover}`,
|
|
376
|
+
entrySelected: `directory-tree-entry--selected ${ce.rowSelected}`,
|
|
377
|
+
// 輪は行の内側に描く。外側の輪は、後に描く隣の行の不透明な地 (ホバーや選択) に覆われる
|
|
378
|
+
entryItemSelected: `directory-tree-entry--item-selected ${ce.rowSelected} ${ce.checkedRing}`,
|
|
341
379
|
// 箱の大きさはクラスでなく EXPAND_BOX_SIZE から行が付ける (ツリーラインのジオメトリが印を置く箱と同じ値を読むため)
|
|
342
|
-
expandIcon:
|
|
343
|
-
expandIconSelected:
|
|
380
|
+
expandIcon: `directory-tree-expand-icon flex-shrink-0 flex items-center justify-center ${ce.icon}`,
|
|
381
|
+
expandIconSelected: `directory-tree-expand-icon--selected ${ce.iconSelected}`,
|
|
344
382
|
// 箱の大きさはクラスでなく visual.typeIconSize から行が付ける (ツリーラインのジオメトリと同じ値を読むため)
|
|
345
|
-
typeIcon:
|
|
346
|
-
typeIconSelected:
|
|
383
|
+
typeIcon: `directory-tree-type-icon flex-shrink-0 flex items-center justify-center ${ce.icon}`,
|
|
384
|
+
typeIconSelected: `directory-tree-type-icon--selected ${ce.iconSelected}`,
|
|
347
385
|
// 文字の行の高さ (line-height) は行 (entry) の body の行を受け継ぐため、名前には文字の大きさだけを付ける
|
|
348
|
-
name:
|
|
386
|
+
name: `directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 ${Wn} font-normal ${ce.name}`,
|
|
349
387
|
nameDirectory: "directory-tree-name--directory font-medium",
|
|
350
|
-
nameSelected:
|
|
351
|
-
},
|
|
388
|
+
nameSelected: `directory-tree-name--selected font-semibold ${ce.nameSelected}`
|
|
389
|
+
}, Mt = (e) => {
|
|
352
390
|
const t = e.slice(e.lastIndexOf("/") + 1), n = t.lastIndexOf(".");
|
|
353
391
|
return n <= 0 ? "" : t.slice(n + 1).toLowerCase();
|
|
354
|
-
},
|
|
355
|
-
const i =
|
|
356
|
-
return !(n && e) || r ? /* @__PURE__ */ f.jsx("span", { className: l, style: i, "aria-hidden": "true" }) : t ? /* @__PURE__ */ f.jsx(
|
|
357
|
-
},
|
|
392
|
+
}, Kr = /^[a-z][a-z\d+.-]*:\/\//i, _n = (e) => Mt(Kr.test(e) ? e.split(/[?#]/, 1)[0] : e), Yn = (e) => Mt(e.name) || _n(e.relativePath) || _n(e.absolutePath), Gn = ({ isDirectory: e, isExpanded: t, showExpandIcons: n, useCanvasExpandIcons: r, expandIconSize: a }) => {
|
|
393
|
+
const i = a ? { width: a, height: a } : void 0, l = a ? "" : "h-4 w-4";
|
|
394
|
+
return !(n && e) || r ? /* @__PURE__ */ f.jsx("span", { className: l, style: i, "aria-hidden": "true" }) : t ? /* @__PURE__ */ f.jsx(Fr, { className: l, style: i }) : /* @__PURE__ */ f.jsx(zr, { className: l, style: i });
|
|
395
|
+
}, At = (e, t) => {
|
|
358
396
|
if (e == null || typeof e == "boolean") return null;
|
|
359
397
|
if (typeof e == "function")
|
|
360
398
|
return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`), null;
|
|
@@ -362,7 +400,7 @@ const Mr = /* @__PURE__ */ ue.forwardRef($r), Mn = "text-[length:var(--dt-font-s
|
|
|
362
400
|
if ("then" in e)
|
|
363
401
|
return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`), null;
|
|
364
402
|
if (Array.isArray(e)) {
|
|
365
|
-
const r = e.map((
|
|
403
|
+
const r = e.map((a) => At(a, t)).filter(Boolean);
|
|
366
404
|
return r.length ? r : null;
|
|
367
405
|
}
|
|
368
406
|
const n = e.type;
|
|
@@ -370,20 +408,20 @@ const Mr = /* @__PURE__ */ ue.forwardRef($r), Mn = "text-[length:var(--dt-font-s
|
|
|
370
408
|
return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`), null;
|
|
371
409
|
}
|
|
372
410
|
return e;
|
|
373
|
-
},
|
|
374
|
-
markdown: (e) => /* @__PURE__ */ f.jsx(
|
|
375
|
-
pdf: (e) => /* @__PURE__ */ f.jsx(
|
|
376
|
-
spreadsheet: (e) => /* @__PURE__ */ f.jsx(
|
|
377
|
-
csv: (e) => /* @__PURE__ */ f.jsx(
|
|
378
|
-
document: (e) => /* @__PURE__ */ f.jsx(
|
|
379
|
-
presentation: (e) => /* @__PURE__ */ f.jsx(
|
|
380
|
-
image: (e) => /* @__PURE__ */ f.jsx(
|
|
381
|
-
audio: (e) => /* @__PURE__ */ f.jsx(
|
|
382
|
-
video: (e) => /* @__PURE__ */ f.jsx(
|
|
383
|
-
archive: (e) => /* @__PURE__ */ f.jsx(
|
|
384
|
-
code: (e) => /* @__PURE__ */ f.jsx(
|
|
385
|
-
text: (e) => /* @__PURE__ */ f.jsx(
|
|
386
|
-
},
|
|
411
|
+
}, Ur = {
|
|
412
|
+
markdown: (e) => /* @__PURE__ */ f.jsx(jr, { className: ue.markdown, style: ae(e) }),
|
|
413
|
+
pdf: (e) => /* @__PURE__ */ f.jsx(Or, { className: ue.pdf, style: ae(e) }),
|
|
414
|
+
spreadsheet: (e) => /* @__PURE__ */ f.jsx(Cr, { className: ue.spreadsheet, style: ae(e) }),
|
|
415
|
+
csv: (e) => /* @__PURE__ */ f.jsx(_r, { className: ue.csv, style: ae(e) }),
|
|
416
|
+
document: (e) => /* @__PURE__ */ f.jsx(Pr, { className: ue.document, style: ae(e) }),
|
|
417
|
+
presentation: (e) => /* @__PURE__ */ f.jsx(Tr, { className: ue.presentation, style: ae(e) }),
|
|
418
|
+
image: (e) => /* @__PURE__ */ f.jsx(Nr, { className: ue.image, style: ae(e) }),
|
|
419
|
+
audio: (e) => /* @__PURE__ */ f.jsx(kr, { className: ue.audio, style: ae(e) }),
|
|
420
|
+
video: (e) => /* @__PURE__ */ f.jsx(Ir, { className: ue.video, style: ae(e) }),
|
|
421
|
+
archive: (e) => /* @__PURE__ */ f.jsx(Rr, { className: ue.archive, style: ae(e) }),
|
|
422
|
+
code: (e) => /* @__PURE__ */ f.jsx(xr, { className: ue.code, style: ae(e) }),
|
|
423
|
+
text: (e) => /* @__PURE__ */ f.jsx(Er, { className: ue.text, style: ae(e) })
|
|
424
|
+
}, Jr = {
|
|
387
425
|
markdown: ["md", "markdown", "mdx"],
|
|
388
426
|
pdf: ["pdf"],
|
|
389
427
|
spreadsheet: ["xls", "xlsx", "xlsm", "xlsb", "ods"],
|
|
@@ -396,7 +434,7 @@ const Mr = /* @__PURE__ */ ue.forwardRef($r), Mn = "text-[length:var(--dt-font-s
|
|
|
396
434
|
archive: ["zip", "tar", "gz", "7z", "rar", "tgz", "bz2"],
|
|
397
435
|
code: ["js", "mjs", "cjs", "ts", "tsx", "jsx", "json", "html", "htm", "css", "scss", "py", "go", "rs", "c", "cpp", "h", "hpp", "sh", "bash", "yaml", "yml", "sql", "xml", "toml"],
|
|
398
436
|
text: ["txt", "log"]
|
|
399
|
-
},
|
|
437
|
+
}, Zr = new Map(Object.entries(Jr).flatMap(([e, t]) => t.map((n) => [n, e]))), qr = /* @__PURE__ */ new Set(["", "application/octet-stream", "binary/octet-stream", "text/plain", "application/x-empty"]), Qr = (e) => (e ?? "").split(";", 1)[0].trim().toLowerCase(), eo = (e) => {
|
|
400
438
|
if (e === "text/markdown" || e === "text/x-markdown") return "markdown";
|
|
401
439
|
if (e === "application/pdf") return "pdf";
|
|
402
440
|
if (e.includes("excel") || e.includes("spreadsheet")) return "spreadsheet";
|
|
@@ -410,21 +448,21 @@ const Mr = /* @__PURE__ */ ue.forwardRef($r), Mn = "text-[length:var(--dt-font-s
|
|
|
410
448
|
if (e === "application/json" || e.includes("javascript") || e.includes("typescript") || e.includes("xml") || e.startsWith("text/html") || e.startsWith("text/css") || e.includes("x-python") || e.includes("x-sh") || e.includes("x-go") || e.includes("x-rust"))
|
|
411
449
|
return "code";
|
|
412
450
|
if (e.startsWith("text/")) return "text";
|
|
413
|
-
},
|
|
414
|
-
const
|
|
415
|
-
return
|
|
416
|
-
},
|
|
417
|
-
const { entry: r, isDirectory:
|
|
418
|
-
let
|
|
419
|
-
const
|
|
420
|
-
return r.icon !== void 0 ?
|
|
421
|
-
},
|
|
451
|
+
}, to = (e, t, n, r) => {
|
|
452
|
+
const a = Qr(e), i = eo(a), l = Zr.get((t || (n ? Mt(n) : "")).toLowerCase()), h = (qr.has(a) ? [l, i] : [i, l]).find((b) => b !== void 0);
|
|
453
|
+
return h === void 0 ? /* @__PURE__ */ f.jsx(wr, { className: ce.icon, style: ae(r) }) : Ur[h](r);
|
|
454
|
+
}, Vn = (e, t, n) => {
|
|
455
|
+
const { entry: r, isDirectory: a, isExpanded: i, extension: l, mimeType: d } = e;
|
|
456
|
+
let h;
|
|
457
|
+
const b = d || r.mimeType;
|
|
458
|
+
return r.icon !== void 0 ? h = r.icon : a ? h = i && t?.directoryExpanded || t?.directory || /* @__PURE__ */ f.jsx(Wr, { style: ae(n) }) : l && t?.fileByExtension?.[l] ? h = t.fileByExtension[l] : h = t?.file || to(b, l, r.name, n), At(typeof h == "function" ? h(e) : h, r.absolutePath);
|
|
459
|
+
}, no = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Xn = (e) => {
|
|
422
460
|
if (!e)
|
|
423
461
|
return;
|
|
424
462
|
const t = Object.entries(e).filter(([, n]) => n != null);
|
|
425
463
|
if (t.length !== 0)
|
|
426
|
-
return Object.fromEntries(t.map(([n, r]) => [`data-${
|
|
427
|
-
},
|
|
464
|
+
return Object.fromEntries(t.map(([n, r]) => [`data-${no(n)}`, String(r)]));
|
|
465
|
+
}, ro = [
|
|
428
466
|
// 塗り: 箱の大きさと位置を変えずに行の面・縁・指す形だけを描く (アウトラインと影は箱の外に描かれ、場所を取らない)
|
|
429
467
|
"color",
|
|
430
468
|
"background",
|
|
@@ -471,160 +509,160 @@ const Mr = /* @__PURE__ */ ue.forwardRef($r), Mn = "text-[length:var(--dt-font-s
|
|
|
471
509
|
"textDecorationThickness",
|
|
472
510
|
"textUnderlineOffset",
|
|
473
511
|
"textTransform"
|
|
474
|
-
],
|
|
512
|
+
], oo = ["color", "opacity"], so = "the row's box belongs to the tree (height: visual.itemHeight, indent: visual.indentSize, icons: visual.typeIconSize, text size: visual.fontSize)", ao = new Set(ro), io = new Set(oo), Cn = (e, t) => {
|
|
475
513
|
const n = t === void 0 ? e.option : `${e.option}.${t}`;
|
|
476
514
|
return e.absolutePath === void 0 ? n : `${n} of "${e.absolutePath}"`;
|
|
477
|
-
},
|
|
515
|
+
}, Kn = (e, t, n, r) => {
|
|
478
516
|
if (e !== void 0) {
|
|
479
517
|
if (typeof e != "object" || e === null)
|
|
480
|
-
throw new RangeError(`${
|
|
481
|
-
for (const [
|
|
482
|
-
if (i !== void 0 && !t.has(
|
|
483
|
-
throw new RangeError(`${
|
|
518
|
+
throw new RangeError(`${Cn(n, void 0)} must be an object of CSS properties or undefined, got ${e === null ? "null" : typeof e}.`);
|
|
519
|
+
for (const [a, i] of Object.entries(e))
|
|
520
|
+
if (i !== void 0 && !t.has(a))
|
|
521
|
+
throw new RangeError(`${Cn(n, a)} cannot be set: ${so}, so ${r}.`);
|
|
484
522
|
}
|
|
485
|
-
},
|
|
486
|
-
const
|
|
487
|
-
return
|
|
523
|
+
}, Ge = (e, t) => Kn(e, ao, t, "a row style accepts only paint and text properties (ROW_STYLE_PROPERTIES)"), lo = (e, t) => Kn(e, io, t, "the expand icon style accepts only the glyph's colour and opacity (EXPAND_ICON_STYLE_PROPERTIES), and the 14 px expand box is the tree's"), co = 500, Un = ({ entry: e, isDirectory: t, isExpanded: n, isItemSelected: r, selectionMode: a, onSelectionChange: i, onEntryClick: l, toggleDirectory: d, onToggleDirectoryRecursive: h }) => {
|
|
524
|
+
const b = Y(null);
|
|
525
|
+
return De(
|
|
488
526
|
() => () => {
|
|
489
|
-
|
|
527
|
+
b.current && window.clearTimeout(b.current);
|
|
490
528
|
},
|
|
491
529
|
[]
|
|
492
530
|
), _(
|
|
493
|
-
(
|
|
494
|
-
|
|
495
|
-
let
|
|
531
|
+
(N) => {
|
|
532
|
+
N.stopPropagation(), a !== "none" && !t && i && i(e, !r);
|
|
533
|
+
let x = !1;
|
|
496
534
|
l({
|
|
497
535
|
entry: e,
|
|
498
536
|
isDirectory: t,
|
|
499
537
|
isExpanded: n,
|
|
500
538
|
preventDefault: () => {
|
|
501
|
-
|
|
539
|
+
x = !0;
|
|
502
540
|
}
|
|
503
|
-
}), !(!t ||
|
|
504
|
-
d(e.absolutePath),
|
|
505
|
-
},
|
|
541
|
+
}), !(!t || x) && (b.current ? (window.clearTimeout(b.current), b.current = null, h(e)) : b.current = window.setTimeout(() => {
|
|
542
|
+
d(e.absolutePath), b.current = null;
|
|
543
|
+
}, co));
|
|
506
544
|
},
|
|
507
|
-
[t, e, n,
|
|
545
|
+
[t, e, n, h, d, l, a, i, r]
|
|
508
546
|
);
|
|
509
|
-
},
|
|
547
|
+
}, Jn = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", On = (e, t) => e.children !== void 0 && t(e.absolutePath), Zn = (e, t) => ({
|
|
510
548
|
width: e,
|
|
511
549
|
gridTemplateColumns: t
|
|
512
|
-
}),
|
|
550
|
+
}), qn = Ft(
|
|
513
551
|
({
|
|
514
552
|
entry: e,
|
|
515
553
|
indentLevel: t,
|
|
516
554
|
positionInSet: n,
|
|
517
555
|
setSize: r,
|
|
518
|
-
rowIndex:
|
|
556
|
+
rowIndex: a,
|
|
519
557
|
flatIndex: i,
|
|
520
558
|
onRowFocus: l,
|
|
521
559
|
onRowBlur: d,
|
|
522
|
-
isSelectedForAria:
|
|
523
|
-
rowHeight:
|
|
524
|
-
isDirOpen:
|
|
525
|
-
columns:
|
|
526
|
-
numericTemplate:
|
|
527
|
-
numericTotal:
|
|
528
|
-
nameWidth:
|
|
529
|
-
rowClassName:
|
|
530
|
-
selection: { onEntryClick:
|
|
531
|
-
expansion: { toggleDirectory:
|
|
532
|
-
visual: { iconOverrides: O, showExpandIcons: Q = !0, showDirectoryIcons: J = !0, showFileIcons:
|
|
560
|
+
isSelectedForAria: h,
|
|
561
|
+
rowHeight: b,
|
|
562
|
+
isDirOpen: N,
|
|
563
|
+
columns: x,
|
|
564
|
+
numericTemplate: T,
|
|
565
|
+
numericTotal: m,
|
|
566
|
+
nameWidth: y,
|
|
567
|
+
rowClassName: p,
|
|
568
|
+
selection: { onEntryClick: w, selectedPath: v, currentPath: F, mode: P = "none", selectedItems: C, onSelectionChange: g },
|
|
569
|
+
expansion: { toggleDirectory: D, onToggleDirectoryRecursive: $ },
|
|
570
|
+
visual: { iconOverrides: O, showExpandIcons: Q = !0, showDirectoryIcons: J = !0, showFileIcons: z = !0, useCanvasExpandIcons: B = !1, expandIconSize: me, typeIconSize: W, fontSize: oe, indentSize: pe, highlightStyles: V, expandIconClassName: X, expandIconStyle: xe }
|
|
533
571
|
}) => {
|
|
534
|
-
|
|
535
|
-
const [
|
|
572
|
+
Ge(e.style, { option: "entry.style", absolutePath: e.absolutePath });
|
|
573
|
+
const [be, o] = fe(!1), u = e.children !== void 0, I = u && N(e.absolutePath), E = e.absolutePath === v, ve = e.absolutePath === F, k = !u && !!C?.has(e.absolutePath), j = u ? void 0 : Yn(e), ee = Un({ entry: e, isDirectory: u, isExpanded: I, isItemSelected: k, selectionMode: P, onSelectionChange: g, onEntryClick: w, toggleDirectory: D, onToggleDirectoryRecursive: $ }), ye = be ? V?.hoverClassName !== void 0 ? V.hoverClassName : L.entryHover : "", Ne = (() => {
|
|
536
574
|
if (u) {
|
|
537
|
-
if (E) return V?.directorySelectedClassName !== void 0 ? V.directorySelectedClassName :
|
|
538
|
-
} else if (E ||
|
|
539
|
-
return V?.itemSelectedClassName !== void 0 ? V.itemSelectedClassName :
|
|
575
|
+
if (E) return V?.directorySelectedClassName !== void 0 ? V.directorySelectedClassName : L.entrySelected;
|
|
576
|
+
} else if (E || k)
|
|
577
|
+
return V?.itemSelectedClassName !== void 0 ? V.itemSelectedClassName : U(E && L.entrySelected, k && L.entryItemSelected);
|
|
540
578
|
return "";
|
|
541
|
-
})(), A = typeof
|
|
542
|
-
...
|
|
579
|
+
})(), A = typeof p == "function" ? p(e) : p, Se = U("dt-grid-row cursor-pointer select-none", ye, Ne, A, e.className), Z = U(L.expandIcon, X, (E || k) && L.expandIconSelected), $e = U(L.typeIcon, (E || k) && L.typeIconSelected), se = U("dt-grid-name-label ml-1", ce.name, u && L.nameDirectory, (E || k) && L.nameSelected), te = Gn({ isDirectory: u, isExpanded: I, showExpandIcons: Q, useCanvasExpandIcons: B, expandIconSize: me }), ie = (u ? J : z) ? Vn({ entry: e, isDirectory: u, isExpanded: I, isSelected: E, isItemSelected: k, extension: j, mimeType: e.mimeType }, O, W) : null, Te = { indentLevel: t, isDirectory: u, isExpanded: I }, [Oe, ...Pe] = x, Fe = Oe?.render ? Oe.render(e, Te) : e.label ?? e.name, Re = {
|
|
580
|
+
...be ? V?.hoverStyle : {},
|
|
543
581
|
...u && E ? V?.directorySelectedStyle : {},
|
|
544
|
-
...!u && (E ||
|
|
582
|
+
...!u && (E || k) ? V?.itemSelectedStyle : {}
|
|
545
583
|
};
|
|
546
584
|
return /* @__PURE__ */ f.jsxs(
|
|
547
585
|
"div",
|
|
548
586
|
{
|
|
549
|
-
className:
|
|
550
|
-
style: { ...
|
|
587
|
+
className: Se,
|
|
588
|
+
style: { ...Re, ...e.style, height: b },
|
|
551
589
|
role: "row",
|
|
552
|
-
"aria-expanded": u ?
|
|
590
|
+
"aria-expanded": u ? I : void 0,
|
|
553
591
|
"aria-level": t + 1,
|
|
554
592
|
"aria-posinset": n,
|
|
555
593
|
"aria-setsize": r,
|
|
556
|
-
"aria-rowindex":
|
|
557
|
-
"aria-selected": P === "none" ? void 0 :
|
|
558
|
-
"aria-current":
|
|
559
|
-
...
|
|
594
|
+
"aria-rowindex": a,
|
|
595
|
+
"aria-selected": P === "none" ? void 0 : h,
|
|
596
|
+
"aria-current": ve ? "page" : void 0,
|
|
597
|
+
...Xn(e.data),
|
|
560
598
|
"data-entry-type": u ? "directory" : "file",
|
|
561
|
-
"data-entry-expanded": u ? String(
|
|
599
|
+
"data-entry-expanded": u ? String(I) : void 0,
|
|
562
600
|
"data-entry-selected": E ? "true" : void 0,
|
|
563
|
-
"data-entry-item-selected":
|
|
601
|
+
"data-entry-item-selected": k ? "true" : void 0,
|
|
564
602
|
onClick: ee,
|
|
565
|
-
onMouseEnter: () =>
|
|
566
|
-
onMouseLeave: () =>
|
|
567
|
-
onFocus: (
|
|
568
|
-
onBlur: (
|
|
569
|
-
onKeyDown: (
|
|
570
|
-
if (
|
|
571
|
-
if (
|
|
572
|
-
|
|
603
|
+
onMouseEnter: () => o(!0),
|
|
604
|
+
onMouseLeave: () => o(!1),
|
|
605
|
+
onFocus: (G) => l(i, e.absolutePath, G.currentTarget),
|
|
606
|
+
onBlur: (G) => d(e.absolutePath, G.currentTarget),
|
|
607
|
+
onKeyDown: (G) => {
|
|
608
|
+
if (G.key === "Enter") {
|
|
609
|
+
if (G.repeat) {
|
|
610
|
+
G.preventDefault();
|
|
573
611
|
return;
|
|
574
612
|
}
|
|
575
|
-
ee(
|
|
613
|
+
ee(G);
|
|
576
614
|
}
|
|
577
615
|
},
|
|
578
616
|
tabIndex: 0,
|
|
579
617
|
children: [
|
|
580
|
-
/* @__PURE__ */ f.jsxs("div", { className:
|
|
581
|
-
(Q ||
|
|
582
|
-
(u ? J :
|
|
583
|
-
/* @__PURE__ */ f.jsx("span", { className: se, style:
|
|
618
|
+
/* @__PURE__ */ f.jsxs("div", { className: U("dt-grid-name-cell", Oe?.className), role: "gridcell", style: { width: y, paddingLeft: Math.max(0, t * pe) }, children: [
|
|
619
|
+
(Q || B) && /* @__PURE__ */ f.jsx("span", { className: Z, style: { ...xe, width: de, height: de }, children: te }),
|
|
620
|
+
(u ? J : z) && /* @__PURE__ */ f.jsx("span", { className: $e, style: { width: W, height: W }, children: ie }),
|
|
621
|
+
/* @__PURE__ */ f.jsx("span", { className: se, style: Bn(oe), children: Fe })
|
|
584
622
|
] }),
|
|
585
|
-
|
|
623
|
+
Pe.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-track", style: Zn(m, T), children: Pe.map((G) => /* @__PURE__ */ f.jsx("div", { className: U("dt-grid-cell", Jn(G.align), G.className), role: "gridcell", children: G.render ? G.render(e, Te) : null }, G.key)) }) })
|
|
586
624
|
]
|
|
587
625
|
}
|
|
588
626
|
);
|
|
589
627
|
},
|
|
590
628
|
(e, t) => {
|
|
591
629
|
if (e.entry !== t.entry) return !1;
|
|
592
|
-
const n =
|
|
630
|
+
const n = On(e.entry, e.isDirOpen), r = On(t.entry, t.isDirOpen);
|
|
593
631
|
return e.indentLevel === t.indentLevel && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.rowIndex === t.rowIndex && // 焦点の通知は行番号で行うため、番号が変われば描き直してハンドラへ新しい番号を渡す
|
|
594
632
|
e.flatIndex === t.flatIndex && e.isSelectedForAria === t.isSelectedForAria && e.rowHeight === t.rowHeight && n === r && 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.currentPath === t.selection.currentPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual === t.visual;
|
|
595
633
|
}
|
|
596
634
|
);
|
|
597
|
-
|
|
598
|
-
const
|
|
635
|
+
qn.displayName = "DirectoryTreeGridRow";
|
|
636
|
+
const Qn = ({
|
|
599
637
|
kind: e,
|
|
600
638
|
columns: t,
|
|
601
639
|
numericTemplate: n,
|
|
602
640
|
numericTotal: r,
|
|
603
|
-
nameWidth:
|
|
641
|
+
nameWidth: a,
|
|
604
642
|
scrollBarWidth: i,
|
|
605
643
|
className: l,
|
|
606
644
|
nameContent: d,
|
|
607
|
-
renderCell:
|
|
645
|
+
renderCell: h
|
|
608
646
|
}) => {
|
|
609
|
-
const [, ...
|
|
610
|
-
return /* @__PURE__ */ f.jsxs("div", { className:
|
|
611
|
-
/* @__PURE__ */ f.jsx("div", { className:
|
|
612
|
-
|
|
647
|
+
const [, ...b] = t, N = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", x = e === "header" ? "dt-grid-header" : "dt-grid-footer", T = e === "header" ? "columnheader" : "gridcell";
|
|
648
|
+
return /* @__PURE__ */ f.jsxs("div", { className: U(x, ce.gridEdge, l), role: "row", children: [
|
|
649
|
+
/* @__PURE__ */ f.jsx("div", { className: U(N, "px-1", t[0]?.className), role: T, style: { width: a }, children: d }),
|
|
650
|
+
b.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-track", style: Zn(r, n), children: b.map((m) => /* @__PURE__ */ f.jsx("div", { className: U("dt-grid-cell", Jn(m.align), m.className), role: T, children: h(m) }, m.key)) }) }),
|
|
613
651
|
/* @__PURE__ */ f.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: i }, "aria-hidden": "true" })
|
|
614
652
|
] });
|
|
615
|
-
},
|
|
653
|
+
}, uo = ({ columns: e, className: t, ...n }) => /* @__PURE__ */ f.jsx(Qn, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (r) => r.header ?? null, ...n }), jn = (e, t) => typeof e == "function" ? e(t) : e ?? null, fo = ({ columns: e, allEntries: t, className: n, ...r }) => /* @__PURE__ */ f.jsx(Qn, { kind: "footer", columns: e, className: n, nameContent: jn(e[0]?.footer, t), renderCell: (a) => jn(a.footer, t), ...r }), ho = 240, er = 96, tr = 12, Lt = (e, t) => {
|
|
616
654
|
const n = e?.width;
|
|
617
655
|
return typeof n == "number" && Number.isFinite(n) && n > 0 ? n : t;
|
|
618
|
-
},
|
|
619
|
-
const r =
|
|
620
|
-
return { nameWidth: r, numericTotal:
|
|
621
|
-
},
|
|
656
|
+
}, mo = (e) => e.slice(1).map((t) => `${Lt(t, er)}px`).join(" "), po = ({ measuredWidth: e, columns: t, scrollBarWidth: n = tr }) => {
|
|
657
|
+
const r = Lt(t[0], ho), a = t.slice(1).reduce((h, b) => h + Lt(b, er), 0), i = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, i - r - Math.max(0, n)), d = Math.max(0, a - l);
|
|
658
|
+
return { nameWidth: r, numericTotal: a, numericVisible: l, maxHScroll: d };
|
|
659
|
+
}, jt = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, yo = (e) => {
|
|
622
660
|
const t = [], n = (r) => {
|
|
623
|
-
for (const
|
|
624
|
-
t.push(
|
|
661
|
+
for (const a of r)
|
|
662
|
+
t.push(a), a.children && a.children.length > 0 && n(a.children);
|
|
625
663
|
};
|
|
626
664
|
return n(e), t;
|
|
627
|
-
},
|
|
665
|
+
}, nr = ["entryKindDirectory", "entryKindFile"], An = [...pt, ...nr], Dt = Object.freeze({
|
|
628
666
|
en: Object.freeze({
|
|
629
667
|
entryKindDirectory: "directory",
|
|
630
668
|
entryKindFile: "file"
|
|
@@ -633,45 +671,45 @@ const Jn = ({
|
|
|
633
671
|
entryKindDirectory: "ディレクトリ",
|
|
634
672
|
entryKindFile: "ファイル"
|
|
635
673
|
})
|
|
636
|
-
}),
|
|
637
|
-
en: Object.freeze({ ...
|
|
638
|
-
ja: Object.freeze({ ...
|
|
639
|
-
}),
|
|
674
|
+
}), go = Object.freeze({
|
|
675
|
+
en: Object.freeze({ ...kn.en, ...Dt.en }),
|
|
676
|
+
ja: Object.freeze({ ...kn.ja, ...Dt.ja })
|
|
677
|
+
}), Ln = (e) => typeof e == "string" ? JSON.stringify(e) : e === null ? "null" : typeof e, bo = (e) => {
|
|
640
678
|
const t = {};
|
|
641
679
|
let n = !1;
|
|
642
|
-
for (const r of
|
|
643
|
-
const
|
|
644
|
-
|
|
680
|
+
for (const r of pt) {
|
|
681
|
+
const a = Object.hasOwn(e, r) ? e[r] : void 0;
|
|
682
|
+
a !== void 0 && (t[r] = a, n = !0);
|
|
645
683
|
}
|
|
646
684
|
return n ? t : void 0;
|
|
647
|
-
},
|
|
648
|
-
const n =
|
|
685
|
+
}, vo = (e, t) => {
|
|
686
|
+
const n = zn(e);
|
|
649
687
|
if (t === void 0)
|
|
650
|
-
return
|
|
688
|
+
return go[n];
|
|
651
689
|
if (t === null || typeof t != "object")
|
|
652
|
-
throw new RangeError(`[directory-tree] labels must be an object; got ${
|
|
690
|
+
throw new RangeError(`[directory-tree] labels must be an object; got ${Ln(t)}`);
|
|
653
691
|
const r = Object.getPrototypeOf(t);
|
|
654
692
|
if (r !== Object.prototype && r !== null)
|
|
655
693
|
throw new RangeError(`[directory-tree] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t) ? "an array" : "an object with a non-plain prototype"}`);
|
|
656
694
|
for (const l of Object.keys(t))
|
|
657
|
-
if (!
|
|
658
|
-
throw new RangeError(`[directory-tree] labels.${l} is not a known label key; expected one of ${
|
|
659
|
-
const i = { ...
|
|
660
|
-
for (const l of
|
|
695
|
+
if (!An.includes(l))
|
|
696
|
+
throw new RangeError(`[directory-tree] labels.${l} is not a known label key; expected one of ${An.join(", ")}`);
|
|
697
|
+
const i = { ...br(n, bo(t)), ...Dt[n] };
|
|
698
|
+
for (const l of nr) {
|
|
661
699
|
const d = Object.hasOwn(t, l) ? t[l] : void 0;
|
|
662
700
|
if (d !== void 0) {
|
|
663
701
|
if (typeof d != "string" || d.trim() === "")
|
|
664
|
-
throw new RangeError(`[directory-tree] labels.${l} must be a non-blank string; got ${
|
|
702
|
+
throw new RangeError(`[directory-tree] labels.${l} must be a non-blank string; got ${Ln(d)}`);
|
|
665
703
|
i[l] = d;
|
|
666
704
|
}
|
|
667
705
|
}
|
|
668
706
|
return Object.freeze(i);
|
|
669
|
-
},
|
|
707
|
+
}, So = (e) => {
|
|
670
708
|
const t = {};
|
|
671
|
-
for (const n of
|
|
709
|
+
for (const n of pt)
|
|
672
710
|
t[n] = e[n];
|
|
673
711
|
return Object.freeze(t);
|
|
674
|
-
},
|
|
712
|
+
}, wo = () => {
|
|
675
713
|
let e = null;
|
|
676
714
|
return {
|
|
677
715
|
mark: (t) => {
|
|
@@ -682,212 +720,204 @@ const Jn = ({
|
|
|
682
720
|
},
|
|
683
721
|
landedOn: (t) => e?.includes(t) === !0
|
|
684
722
|
};
|
|
685
|
-
},
|
|
723
|
+
}, et = (e) => typeof e == "string" ? JSON.stringify(e) : String(e), $t = (e, t) => {
|
|
686
724
|
if (typeof t != "number" || !Number.isFinite(t) || t <= 0)
|
|
687
|
-
throw new RangeError(`[directory-tree] visual.${e} must be a finite number greater than 0 (px); got ${
|
|
725
|
+
throw new RangeError(`[directory-tree] visual.${e} must be a finite number greater than 0 (px); got ${et(t)}.`);
|
|
688
726
|
return t;
|
|
689
|
-
},
|
|
727
|
+
}, Eo = (e) => {
|
|
690
728
|
if (typeof e == "string" && e.trim() !== "" || typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
691
729
|
return e;
|
|
692
|
-
throw new RangeError(`[directory-tree] visual.fontSize must be a finite number greater than 0 (px) or a CSS font size that is not blank; got ${
|
|
693
|
-
},
|
|
694
|
-
indentSize: e === void 0 ?
|
|
695
|
-
typeIconSize: t === void 0 ?
|
|
696
|
-
fontSize: n === void 0 ? void 0 :
|
|
697
|
-
}),
|
|
730
|
+
throw new RangeError(`[directory-tree] visual.fontSize must be a finite number greater than 0 (px) or a CSS font size that is not blank; got ${et(e)}.`);
|
|
731
|
+
}, xo = ({ indentSize: e, typeIconSize: t, fontSize: n }) => ({
|
|
732
|
+
indentSize: e === void 0 ? Gr : $t("indentSize", e),
|
|
733
|
+
typeIconSize: t === void 0 ? Xr : $t("typeIconSize", t),
|
|
734
|
+
fontSize: n === void 0 ? void 0 : Eo(n)
|
|
735
|
+
}), Ro = ({ indentSize: e, removeRootIndent: t, hasExpandBox: n }) => t ? Math.max(0, e - (n ? de : 0)) : 0, Io = (e, t, n) => {
|
|
698
736
|
if (typeof e != "function")
|
|
699
|
-
return
|
|
737
|
+
return $t("itemHeight", e);
|
|
700
738
|
const r = e(t, n);
|
|
701
739
|
if (typeof r != "number" || !Number.isFinite(r) || r <= 0)
|
|
702
|
-
throw new RangeError(`[directory-tree] visual.itemHeight returned ${
|
|
740
|
+
throw new RangeError(`[directory-tree] visual.itemHeight returned ${et(r)} for ${JSON.stringify(t.absolutePath)} (row ${n}); it must return a finite number greater than 0 (px).`);
|
|
703
741
|
return r;
|
|
704
|
-
},
|
|
705
|
-
const r = t === void 0 ?
|
|
706
|
-
if (typeof r != "number" || !Number.isFinite(r) || r <= 0 || r >
|
|
707
|
-
throw new RangeError(`[directory-tree] visual.expandIconSize must be a finite number greater than 0 and at most ${
|
|
708
|
-
const { indentSize:
|
|
709
|
-
if (
|
|
742
|
+
}, ko = (e, t, n) => {
|
|
743
|
+
const r = t === void 0 ? Vr : t;
|
|
744
|
+
if (typeof r != "number" || !Number.isFinite(r) || r <= 0 || r > de)
|
|
745
|
+
throw new RangeError(`[directory-tree] visual.expandIconSize must be a finite number greater than 0 and at most ${de} (the expand box, px) while tree lines are drawn; got ${et(r)}.`);
|
|
746
|
+
const { indentSize: a, typeIconSize: i } = e, l = r / 2, d = de + i - r / 2;
|
|
747
|
+
if (a < l || a > d)
|
|
710
748
|
throw new RangeError(
|
|
711
|
-
`[directory-tree] visual.indentSize ${
|
|
749
|
+
`[directory-tree] visual.indentSize ${et(a)} does not fit the tree lines: with typeIconSize ${i} and an expand glyph of ${r} px it must be from ${l} (half the glyph) to ${d} (the ${de} px expand box + typeIconSize − half the glyph).`
|
|
712
750
|
);
|
|
713
|
-
return { indentSize:
|
|
714
|
-
},
|
|
751
|
+
return { indentSize: a, typeIconSize: i, glyphSize: r, originX: n };
|
|
752
|
+
}, No = ({ indentSize: e, typeIconSize: t, glyphSize: n }) => Math.min(Math.max(de + t / 2 - e, n / 2), de - n / 2), To = (e, t) => {
|
|
715
753
|
const n = e.length - 1;
|
|
716
754
|
if (n <= 0) return 0;
|
|
717
|
-
let r = 0,
|
|
718
|
-
for (; r <=
|
|
719
|
-
const l = r +
|
|
720
|
-
e[l] <= t ? (i = l, r = l + 1) :
|
|
755
|
+
let r = 0, a = n - 1, i = 0;
|
|
756
|
+
for (; r <= a; ) {
|
|
757
|
+
const l = r + a >>> 1;
|
|
758
|
+
e[l] <= t ? (i = l, r = l + 1) : a = l - 1;
|
|
721
759
|
}
|
|
722
760
|
return i;
|
|
723
|
-
},
|
|
761
|
+
}, Po = (e, t, n) => {
|
|
724
762
|
if (n <= 0 || e.length === 0 || t.length !== e.length + 1)
|
|
725
763
|
return null;
|
|
726
|
-
const r =
|
|
727
|
-
return
|
|
728
|
-
path:
|
|
764
|
+
const r = To(t, n), a = e[r];
|
|
765
|
+
return a ? {
|
|
766
|
+
path: a.entry.absolutePath,
|
|
729
767
|
offsetInViewport: n - t[r]
|
|
730
768
|
} : null;
|
|
731
|
-
},
|
|
769
|
+
}, _o = (e, t, n) => {
|
|
732
770
|
if (t.length === 0 || n.length !== t.length + 1)
|
|
733
771
|
return null;
|
|
734
772
|
for (let r = 0; r < t.length; r++)
|
|
735
773
|
if (t[r].entry.absolutePath === e.path)
|
|
736
774
|
return Math.max(0, n[r] + e.offsetInViewport);
|
|
737
775
|
return null;
|
|
738
|
-
},
|
|
776
|
+
}, Co = (e, t, n) => {
|
|
739
777
|
const r = [];
|
|
740
|
-
for (let
|
|
741
|
-
const i = e[
|
|
778
|
+
for (let a = t; a < n; a++) {
|
|
779
|
+
const i = e[a];
|
|
742
780
|
if (!(!i || i.length === 0))
|
|
743
781
|
for (const l of i)
|
|
744
782
|
r.push(l);
|
|
745
783
|
}
|
|
746
784
|
return r;
|
|
747
|
-
},
|
|
785
|
+
}, Oo = (e, t, n) => {
|
|
748
786
|
const r = [];
|
|
749
|
-
for (let
|
|
750
|
-
const i = e[
|
|
787
|
+
for (let a = t; a < n; a++) {
|
|
788
|
+
const i = e[a];
|
|
751
789
|
if (!(!i || i.length === 0))
|
|
752
790
|
for (const l of i)
|
|
753
791
|
r.push(l);
|
|
754
792
|
}
|
|
755
793
|
return r;
|
|
756
|
-
},
|
|
757
|
-
const
|
|
758
|
-
(e.width !==
|
|
794
|
+
}, jo = (e, t, n, r) => {
|
|
795
|
+
const a = Math.max(1, Math.floor(t * r)), i = Math.max(1, Math.floor(n * r));
|
|
796
|
+
(e.width !== a || e.height !== i) && (e.width = a, e.height = i);
|
|
759
797
|
const l = e.style;
|
|
760
798
|
l.width !== `${t}px` && (l.width = `${t}px`), l.height !== `${n}px` && (l.height = `${n}px`);
|
|
761
|
-
},
|
|
799
|
+
}, Ao = (e, t, n) => {
|
|
762
800
|
e.lineWidth = n, e.beginPath();
|
|
763
801
|
for (const r of t)
|
|
764
802
|
e.moveTo(r.x1, r.y1), e.lineTo(r.x2, r.y2);
|
|
765
803
|
e.stroke();
|
|
766
|
-
},
|
|
767
|
-
const n = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
768
|
-
if (!n)
|
|
769
|
-
return null;
|
|
770
|
-
let r = n[1];
|
|
771
|
-
r.length === 3 && (r = r.split("").map((d) => d + d).join(""));
|
|
772
|
-
const o = Number.parseInt(r.slice(0, 2), 16), i = Number.parseInt(r.slice(2, 4), 16), l = Number.parseInt(r.slice(4, 6), 16);
|
|
773
|
-
return `rgba(${o}, ${i}, ${l}, ${t})`;
|
|
774
|
-
}, Oo = (e, t, n, r) => {
|
|
804
|
+
}, Lo = (e, t, n, r) => {
|
|
775
805
|
if (t.length === 0)
|
|
776
806
|
return;
|
|
777
|
-
const
|
|
807
|
+
const a = e.strokeStyle, i = e.lineWidth, l = e.lineCap, d = e.lineJoin;
|
|
778
808
|
e.strokeStyle = n, e.lineCap = "round", e.lineJoin = "round";
|
|
779
|
-
for (const
|
|
780
|
-
const
|
|
781
|
-
|
|
809
|
+
for (const h of t) {
|
|
810
|
+
const b = r ?? h.size, N = Math.max(0, b / 2), x = Math.max(1, Math.round(b * 0.08)), T = Math.max(1, Math.round(b * 0.14)), m = Math.max(0, N - x * 0.8), y = Math.max(0, m * 0.55);
|
|
811
|
+
e.lineWidth = x, e.beginPath(), e.arc(h.centerX, h.centerY, Math.max(0, N - x * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = T, e.beginPath(), e.moveTo(h.centerX - y, h.centerY), e.lineTo(h.centerX + y, h.centerY), e.stroke(), h.isExpanded || (e.beginPath(), e.moveTo(h.centerX, h.centerY - y), e.lineTo(h.centerX, h.centerY + y), e.stroke());
|
|
782
812
|
}
|
|
783
|
-
e.strokeStyle =
|
|
784
|
-
},
|
|
785
|
-
const
|
|
813
|
+
e.strokeStyle = a, e.lineWidth = i, e.lineCap = l, e.lineJoin = d;
|
|
814
|
+
}, rr = Ft(({ segmentsByItem: e, glyphsByItem: t, itemHeight: n, width: r, viewportHeight: a, scrollPosition: i, color: l = Hn, strokeWidth: d = 1, renderStartIndex: h, renderEndIndex: b, lookaheadEndIndex: N, devicePixelRatio: x, expandGlyphColor: T, expandGlyphSize: m }) => {
|
|
815
|
+
const y = Y(null), p = Y(null), w = Y({
|
|
786
816
|
segmentsByItem: e,
|
|
787
817
|
glyphsByItem: t,
|
|
788
818
|
itemHeight: n,
|
|
789
819
|
width: r,
|
|
790
|
-
viewportHeight:
|
|
820
|
+
viewportHeight: a,
|
|
791
821
|
scrollPosition: i,
|
|
792
822
|
color: l,
|
|
793
823
|
strokeWidth: d,
|
|
794
|
-
renderStartIndex:
|
|
795
|
-
renderEndIndex:
|
|
796
|
-
lookaheadEndIndex:
|
|
797
|
-
devicePixelRatio:
|
|
798
|
-
expandGlyphColor:
|
|
799
|
-
expandGlyphSize:
|
|
824
|
+
renderStartIndex: h,
|
|
825
|
+
renderEndIndex: b,
|
|
826
|
+
lookaheadEndIndex: N,
|
|
827
|
+
devicePixelRatio: x,
|
|
828
|
+
expandGlyphColor: T,
|
|
829
|
+
expandGlyphSize: m
|
|
800
830
|
}), v = _(() => {
|
|
801
|
-
|
|
802
|
-
const P =
|
|
831
|
+
p.current = null;
|
|
832
|
+
const P = y.current;
|
|
803
833
|
if (!P)
|
|
804
834
|
return;
|
|
805
835
|
const C = P.getContext("2d");
|
|
806
836
|
if (!C)
|
|
807
837
|
return;
|
|
808
|
-
const
|
|
809
|
-
if (
|
|
838
|
+
const g = w.current;
|
|
839
|
+
if (g.width <= 0 || g.viewportHeight <= 0) {
|
|
810
840
|
C.clearRect(0, 0, P.width, P.height);
|
|
811
841
|
return;
|
|
812
842
|
}
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
const $ =
|
|
816
|
-
if (typeof
|
|
817
|
-
const
|
|
818
|
-
return Math.max(Math.min($,
|
|
843
|
+
const D = Number.isFinite(g.devicePixelRatio ?? NaN) ? g.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
|
|
844
|
+
jo(P, g.width, g.viewportHeight, D);
|
|
845
|
+
const $ = g.segmentsByItem.length, O = typeof g.renderStartIndex == "number" && Number.isFinite(g.renderStartIndex) ? Math.max(0, Math.floor(g.renderStartIndex)) : Math.max(0, Math.floor(g.scrollPosition / g.itemHeight)), Q = Math.min($, Math.ceil((g.scrollPosition + g.viewportHeight) / g.itemHeight)), J = (() => {
|
|
846
|
+
if (typeof g.renderEndIndex == "number" && Number.isFinite(g.renderEndIndex)) {
|
|
847
|
+
const W = Math.floor(g.renderEndIndex);
|
|
848
|
+
return Math.max(Math.min($, W + 1), O);
|
|
819
849
|
}
|
|
820
850
|
return Math.max(Q, O);
|
|
821
|
-
})(),
|
|
822
|
-
if (typeof
|
|
823
|
-
const
|
|
851
|
+
})(), z = (() => {
|
|
852
|
+
if (typeof g.lookaheadEndIndex == "number" && Number.isFinite(g.lookaheadEndIndex)) {
|
|
853
|
+
const W = Math.floor(g.lookaheadEndIndex), oe = Math.min($, W + 1);
|
|
824
854
|
return Math.max(oe, J);
|
|
825
855
|
}
|
|
826
856
|
return Math.max(Q, J);
|
|
827
|
-
})(),
|
|
828
|
-
C.save(), C.scale(
|
|
829
|
-
}, []),
|
|
830
|
-
|
|
857
|
+
})(), B = Co(g.segmentsByItem, O, z), me = Oo(g.glyphsByItem, O, z);
|
|
858
|
+
C.save(), C.scale(D, D), C.clearRect(0, 0, g.width, g.viewportHeight), C.translate(0, -g.scrollPosition), C.strokeStyle = g.color, Ao(C, B, g.strokeWidth), Lo(C, me, g.expandGlyphColor ?? g.color, g.expandGlyphSize), C.restore();
|
|
859
|
+
}, []), F = _(() => {
|
|
860
|
+
p.current === null && (p.current = window.requestAnimationFrame(v));
|
|
831
861
|
}, [v]);
|
|
832
|
-
return
|
|
833
|
-
|
|
862
|
+
return De(() => {
|
|
863
|
+
w.current = {
|
|
834
864
|
segmentsByItem: e,
|
|
835
865
|
glyphsByItem: t,
|
|
836
866
|
itemHeight: n,
|
|
837
867
|
width: r,
|
|
838
|
-
viewportHeight:
|
|
868
|
+
viewportHeight: a,
|
|
839
869
|
scrollPosition: i,
|
|
840
870
|
color: l,
|
|
841
871
|
strokeWidth: d,
|
|
842
|
-
renderStartIndex:
|
|
843
|
-
renderEndIndex:
|
|
844
|
-
lookaheadEndIndex:
|
|
845
|
-
devicePixelRatio:
|
|
846
|
-
expandGlyphColor:
|
|
847
|
-
expandGlyphSize:
|
|
848
|
-
},
|
|
849
|
-
}, [e, t, n, r,
|
|
850
|
-
|
|
851
|
-
}, []), /* @__PURE__ */ f.jsx("canvas", { ref:
|
|
872
|
+
renderStartIndex: h,
|
|
873
|
+
renderEndIndex: b,
|
|
874
|
+
lookaheadEndIndex: N,
|
|
875
|
+
devicePixelRatio: x,
|
|
876
|
+
expandGlyphColor: T,
|
|
877
|
+
expandGlyphSize: m
|
|
878
|
+
}, F();
|
|
879
|
+
}, [e, t, n, r, a, i, l, d, h, b, N, x, T, m, F]), De(() => () => {
|
|
880
|
+
p.current !== null && (window.cancelAnimationFrame(p.current), p.current = null);
|
|
881
|
+
}, []), /* @__PURE__ */ f.jsx("canvas", { ref: y, className: "pointer-events-none absolute top-0 left-0 z-0" });
|
|
852
882
|
});
|
|
853
|
-
|
|
854
|
-
const
|
|
883
|
+
rr.displayName = "TreeLineCanvas";
|
|
884
|
+
const Do = (e) => {
|
|
855
885
|
const t = /* @__PURE__ */ new Map();
|
|
856
886
|
for (let n = 0; n < e.length; n++) {
|
|
857
887
|
const r = e[n].entry.absolutePath;
|
|
858
888
|
t.has(r) || t.set(r, n);
|
|
859
889
|
}
|
|
860
890
|
return t;
|
|
861
|
-
},
|
|
862
|
-
const { anchor: n, selectionGeneration: r, selectedPath:
|
|
891
|
+
}, Dn = (e, t) => e.selectedPath === t ? e : { selectedPath: t, selectionGeneration: e.selectionGeneration + 1, anchor: e.anchor }, $o = (e, t) => ({ ...e, anchor: { path: t, selectionGeneration: e.selectionGeneration, focused: !0 } }), Fo = (e, t) => {
|
|
892
|
+
const { anchor: n, selectionGeneration: r, selectedPath: a } = t;
|
|
863
893
|
if (n !== null && (n.focused || n.selectionGeneration === r)) {
|
|
864
894
|
const i = e.get(n.path);
|
|
865
895
|
if (i !== void 0)
|
|
866
896
|
return i;
|
|
867
897
|
}
|
|
868
|
-
if (
|
|
869
|
-
const i = e.get(
|
|
898
|
+
if (a !== null) {
|
|
899
|
+
const i = e.get(a);
|
|
870
900
|
if (i !== void 0)
|
|
871
901
|
return i;
|
|
872
902
|
}
|
|
873
903
|
return 0;
|
|
874
|
-
},
|
|
904
|
+
}, Mo = {
|
|
875
905
|
msOverflowStyle: "none",
|
|
876
906
|
scrollbarWidth: "none"
|
|
877
|
-
},
|
|
907
|
+
}, zo = () => {
|
|
878
908
|
let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
|
|
879
909
|
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));
|
|
880
|
-
},
|
|
881
|
-
const t =
|
|
882
|
-
return n !== null &&
|
|
883
|
-
},
|
|
910
|
+
}, Ho = (e) => {
|
|
911
|
+
const t = Y(null), n = t.current;
|
|
912
|
+
return n !== null && pt.every((r) => n[r] === e[r]) ? n : (t.current = e, e);
|
|
913
|
+
}, $n = /* @__PURE__ */ new Set(["top", "bottom", "center", "nearest"]), Fn = (e) => {
|
|
884
914
|
const t = e?.align;
|
|
885
915
|
if (t === void 0)
|
|
886
916
|
return "top";
|
|
887
|
-
if (
|
|
888
|
-
throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[
|
|
917
|
+
if (!$n.has(t))
|
|
918
|
+
throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[...$n].join(", ")}.`);
|
|
889
919
|
return t;
|
|
890
|
-
},
|
|
920
|
+
}, Wo = {
|
|
891
921
|
position: "absolute",
|
|
892
922
|
width: 1,
|
|
893
923
|
height: 1,
|
|
@@ -897,228 +927,228 @@ const jo = (e) => {
|
|
|
897
927
|
overflow: "hidden",
|
|
898
928
|
clipPath: "inset(50%)",
|
|
899
929
|
whiteSpace: "nowrap"
|
|
900
|
-
},
|
|
930
|
+
}, Bo = (e, t, n, r, a) => {
|
|
901
931
|
const i = [], l = [];
|
|
902
932
|
let d = 0;
|
|
903
|
-
const
|
|
904
|
-
const
|
|
905
|
-
for (let
|
|
906
|
-
const
|
|
907
|
-
let P =
|
|
908
|
-
r && (P =
|
|
909
|
-
id:
|
|
910
|
-
name:
|
|
911
|
-
absolutePath:
|
|
933
|
+
const h = (b, N, x) => {
|
|
934
|
+
const T = a ? [...b].sort(a) : b;
|
|
935
|
+
for (let m = 0; m < T.length; m++) {
|
|
936
|
+
const y = T[m], p = m === T.length - 1, w = [...x, p], v = y.children !== void 0, F = v && t(y.absolutePath, y.relativePath);
|
|
937
|
+
let P = N, C = x;
|
|
938
|
+
r && (P = N - 1, C = x.slice(1)), i.push({ entry: y, indentLevel: P, depth: N, positionInSet: m + 1, setSize: T.length }), n && (P > d && (d = P), l.push({
|
|
939
|
+
id: y.absolutePath,
|
|
940
|
+
name: y.name,
|
|
941
|
+
absolutePath: y.absolutePath,
|
|
912
942
|
indentLevel: P,
|
|
913
|
-
isLastChild:
|
|
943
|
+
isLastChild: p,
|
|
914
944
|
isDirectory: v,
|
|
915
|
-
isExpanded:
|
|
945
|
+
isExpanded: F,
|
|
916
946
|
ancestorIsLast: [...C],
|
|
917
|
-
hideLines: r &&
|
|
918
|
-
})), v &&
|
|
947
|
+
hideLines: r && N === 0
|
|
948
|
+
})), v && F && y.children && h(y.children, N + 1, w);
|
|
919
949
|
}
|
|
920
950
|
};
|
|
921
|
-
return
|
|
922
|
-
},
|
|
951
|
+
return h(e, 0, []), { flatItems: i, lineItems: l, maxIndent: d };
|
|
952
|
+
}, Mn = (e, t) => {
|
|
923
953
|
const n = e.length - 1;
|
|
924
954
|
if (n <= 0) return 0;
|
|
925
|
-
let r = 0,
|
|
926
|
-
for (; r <=
|
|
927
|
-
const l = r +
|
|
928
|
-
e[l] <= t ? (i = l, r = l + 1) :
|
|
955
|
+
let r = 0, a = n - 1, i = 0;
|
|
956
|
+
for (; r <= a; ) {
|
|
957
|
+
const l = r + a >>> 1;
|
|
958
|
+
e[l] <= t ? (i = l, r = l + 1) : a = l - 1;
|
|
929
959
|
}
|
|
930
960
|
return i;
|
|
931
|
-
},
|
|
932
|
-
const l = r?.renderStart ?? Math.max(0,
|
|
933
|
-
return { renderStart: l, renderEnd:
|
|
934
|
-
},
|
|
961
|
+
}, Yo = (e, t, n, r, a, i) => {
|
|
962
|
+
const l = r?.renderStart ?? Math.max(0, Mn(i, a)), d = t > 0 ? Mn(i, a + t) + n : l + n, h = e > 0 ? Math.min(e - 1, Math.max(l, d)) : l, b = r?.renderEnd ?? h, N = e > 0 ? Math.min(e - 1, b + n) : b;
|
|
963
|
+
return { renderStart: l, renderEnd: b, lookaheadEnd: N };
|
|
964
|
+
}, Go = (e, t, n, r) => {
|
|
935
965
|
if (e.length === 0)
|
|
936
966
|
return { segmentsByItem: [], glyphsByItem: [] };
|
|
937
|
-
const { indentSize:
|
|
938
|
-
for (let
|
|
939
|
-
const
|
|
940
|
-
if (
|
|
941
|
-
|
|
967
|
+
const { indentSize: a, typeIconSize: i, glyphSize: l, originX: d } = r, h = Array.from({ length: e.length }, () => []), b = Array.from({ length: e.length }, () => []), N = d + No(r), x = (m) => m * a + N, T = l / 2 + 2;
|
|
968
|
+
for (let m = 0; m < e.length; m++) {
|
|
969
|
+
const y = e[m], p = t[m] ?? 0, w = n[m] ?? 0, v = w + p / 2, F = e[m + 1], P = v + i / 2, C = w + p, g = F !== void 0 && F.indentLevel === y.indentLevel + 1 && P < C ? { key: `${y.id}-connector-children`, x1: x(F.indentLevel), y1: P, x2: x(F.indentLevel), y2: C, itemIndex: m } : null;
|
|
970
|
+
if (y.hideLines) {
|
|
971
|
+
g !== null && (h[m] = [g]);
|
|
942
972
|
continue;
|
|
943
973
|
}
|
|
944
|
-
const
|
|
945
|
-
for (let O = 0; O <
|
|
946
|
-
if (
|
|
974
|
+
const D = [];
|
|
975
|
+
for (let O = 0; O < y.indentLevel; O++) {
|
|
976
|
+
if (y.ancestorIsLast[O] ?? !1)
|
|
947
977
|
continue;
|
|
948
978
|
let J = !1;
|
|
949
|
-
for (let
|
|
950
|
-
const
|
|
951
|
-
if (
|
|
979
|
+
for (let z = m; z < e.length; z++) {
|
|
980
|
+
const B = e[z];
|
|
981
|
+
if (B.indentLevel > O && B.ancestorIsLast.length > O && !B.ancestorIsLast[O]) {
|
|
952
982
|
J = !0;
|
|
953
983
|
break;
|
|
954
984
|
}
|
|
955
|
-
if (
|
|
985
|
+
if (z > m && B.indentLevel === O)
|
|
956
986
|
break;
|
|
957
987
|
}
|
|
958
988
|
if (J) {
|
|
959
|
-
const
|
|
960
|
-
|
|
961
|
-
key: `${
|
|
962
|
-
x1:
|
|
963
|
-
y1:
|
|
964
|
-
x2:
|
|
965
|
-
y2:
|
|
966
|
-
itemIndex:
|
|
989
|
+
const z = x(O);
|
|
990
|
+
D.push({
|
|
991
|
+
key: `${y.id}-ancestor-${O}`,
|
|
992
|
+
x1: z,
|
|
993
|
+
y1: w,
|
|
994
|
+
x2: z,
|
|
995
|
+
y2: w + p,
|
|
996
|
+
itemIndex: m
|
|
967
997
|
});
|
|
968
998
|
}
|
|
969
999
|
}
|
|
970
|
-
const $ =
|
|
971
|
-
|
|
972
|
-
key: `${
|
|
1000
|
+
const $ = x(y.indentLevel);
|
|
1001
|
+
m > 0 && D.push({
|
|
1002
|
+
key: `${y.id}-connector-top`,
|
|
973
1003
|
x1: $,
|
|
974
|
-
y1:
|
|
1004
|
+
y1: w,
|
|
975
1005
|
x2: $,
|
|
976
|
-
y2:
|
|
977
|
-
itemIndex:
|
|
978
|
-
}), !
|
|
979
|
-
key: `${
|
|
1006
|
+
y2: y.isDirectory ? v - T : v,
|
|
1007
|
+
itemIndex: m
|
|
1008
|
+
}), !y.isDirectory && y.isLastChild && D.push({
|
|
1009
|
+
key: `${y.id}-connector-horizontal`,
|
|
980
1010
|
x1: $,
|
|
981
1011
|
y1: v,
|
|
982
|
-
x2: d +
|
|
1012
|
+
x2: d + y.indentLevel * a + de,
|
|
983
1013
|
y2: v,
|
|
984
|
-
itemIndex:
|
|
985
|
-
}),
|
|
986
|
-
key: `${
|
|
1014
|
+
itemIndex: m
|
|
1015
|
+
}), y.isLastChild || (y.isDirectory ? D.push({
|
|
1016
|
+
key: `${y.id}-connector-bottom`,
|
|
987
1017
|
x1: $,
|
|
988
|
-
y1: v +
|
|
1018
|
+
y1: v + T,
|
|
989
1019
|
x2: $,
|
|
990
|
-
y2:
|
|
991
|
-
itemIndex:
|
|
992
|
-
}) :
|
|
993
|
-
key: `${
|
|
1020
|
+
y2: w + p,
|
|
1021
|
+
itemIndex: m
|
|
1022
|
+
}) : D.push({
|
|
1023
|
+
key: `${y.id}-connector-bottom`,
|
|
994
1024
|
x1: $,
|
|
995
1025
|
y1: v,
|
|
996
1026
|
x2: $,
|
|
997
|
-
y2:
|
|
998
|
-
itemIndex:
|
|
999
|
-
})),
|
|
1027
|
+
y2: w + p,
|
|
1028
|
+
itemIndex: m
|
|
1029
|
+
})), g !== null && D.push(g), h[m] = D, y.isDirectory && (b[m] = [
|
|
1000
1030
|
{
|
|
1001
|
-
key: `${
|
|
1002
|
-
itemIndex:
|
|
1031
|
+
key: `${y.id}-glyph`,
|
|
1032
|
+
itemIndex: m,
|
|
1003
1033
|
centerX: $,
|
|
1004
1034
|
centerY: v,
|
|
1005
1035
|
size: l,
|
|
1006
|
-
isExpanded:
|
|
1036
|
+
isExpanded: y.isExpanded
|
|
1007
1037
|
}
|
|
1008
1038
|
]);
|
|
1009
1039
|
}
|
|
1010
|
-
return { segmentsByItem:
|
|
1011
|
-
},
|
|
1040
|
+
return { segmentsByItem: h, glyphsByItem: b };
|
|
1041
|
+
}, or = Ft(
|
|
1012
1042
|
({
|
|
1013
1043
|
entry: e,
|
|
1014
1044
|
indentLevel: t,
|
|
1015
1045
|
originX: n,
|
|
1016
1046
|
depth: r,
|
|
1017
|
-
positionInSet:
|
|
1047
|
+
positionInSet: a,
|
|
1018
1048
|
setSize: i,
|
|
1019
1049
|
isSelectedForAria: l,
|
|
1020
1050
|
flatIndex: d,
|
|
1021
|
-
isActive:
|
|
1022
|
-
registerRowRef:
|
|
1023
|
-
onNavigationKeyDown:
|
|
1024
|
-
onRowFocus:
|
|
1025
|
-
onRowBlur:
|
|
1026
|
-
rowHeight:
|
|
1027
|
-
entryKindDirectory:
|
|
1028
|
-
entryKindFile:
|
|
1029
|
-
isDirOpen:
|
|
1030
|
-
expansion: { toggleDirectory: v, onToggleDirectoryRecursive:
|
|
1031
|
-
selection: { onEntryClick: P, selectedPath: C, currentPath:
|
|
1051
|
+
isActive: h,
|
|
1052
|
+
registerRowRef: b,
|
|
1053
|
+
onNavigationKeyDown: N,
|
|
1054
|
+
onRowFocus: x,
|
|
1055
|
+
onRowBlur: T,
|
|
1056
|
+
rowHeight: m,
|
|
1057
|
+
entryKindDirectory: y,
|
|
1058
|
+
entryKindFile: p,
|
|
1059
|
+
isDirOpen: w,
|
|
1060
|
+
expansion: { toggleDirectory: v, onToggleDirectoryRecursive: F },
|
|
1061
|
+
selection: { onEntryClick: P, selectedPath: C, currentPath: g, mode: D = "none", selectedItems: $, onSelectionChange: O },
|
|
1032
1062
|
visual: {
|
|
1033
1063
|
iconOverrides: Q,
|
|
1034
1064
|
showExpandIcons: J = !0,
|
|
1035
|
-
showDirectoryIcons:
|
|
1036
|
-
showFileIcons:
|
|
1037
|
-
useCanvasExpandIcons:
|
|
1038
|
-
expandIconSize:
|
|
1065
|
+
showDirectoryIcons: z = !0,
|
|
1066
|
+
showFileIcons: B = !0,
|
|
1067
|
+
useCanvasExpandIcons: me = !1,
|
|
1068
|
+
expandIconSize: W,
|
|
1039
1069
|
typeIconSize: oe,
|
|
1040
|
-
fontSize:
|
|
1070
|
+
fontSize: pe,
|
|
1041
1071
|
indentSize: V,
|
|
1042
|
-
highlightStyles:
|
|
1043
|
-
entryClassName:
|
|
1044
|
-
entryStyle:
|
|
1045
|
-
nameClassName:
|
|
1072
|
+
highlightStyles: X,
|
|
1073
|
+
entryClassName: xe,
|
|
1074
|
+
entryStyle: be,
|
|
1075
|
+
nameClassName: o,
|
|
1046
1076
|
nameStyle: u,
|
|
1047
|
-
directoryNameClassName:
|
|
1077
|
+
directoryNameClassName: I,
|
|
1048
1078
|
directoryNameStyle: E,
|
|
1049
|
-
fileNameClassName:
|
|
1050
|
-
fileNameStyle:
|
|
1079
|
+
fileNameClassName: ve,
|
|
1080
|
+
fileNameStyle: k,
|
|
1051
1081
|
expandIconClassName: j,
|
|
1052
1082
|
expandIconStyle: ee
|
|
1053
1083
|
}
|
|
1054
1084
|
}) => {
|
|
1055
|
-
|
|
1056
|
-
const [
|
|
1085
|
+
Ge(e.style, { option: "entry.style", absolutePath: e.absolutePath });
|
|
1086
|
+
const [ye, Ne] = fe(!1), A = e.children !== void 0, Se = A && w(e.absolutePath), Z = e.absolutePath === C, $e = e.absolutePath === g, se = !A && $?.has(e.absolutePath), te = _((ne) => b(d, ne), [b, d]), ie = A ? void 0 : Yn(e), Te = Un({ entry: e, isDirectory: A, isExpanded: Se, isItemSelected: !!se, selectionMode: D, onSelectionChange: O, onEntryClick: P, toggleDirectory: v, onToggleDirectoryRecursive: F }), Oe = ye ? X?.hoverClassName !== void 0 ? X.hoverClassName : L.entryHover : "", Pe = (() => {
|
|
1057
1087
|
if (A) {
|
|
1058
1088
|
if (Z)
|
|
1059
|
-
return
|
|
1089
|
+
return X?.directorySelectedClassName !== void 0 ? X.directorySelectedClassName : L.entrySelected;
|
|
1060
1090
|
} else if (Z || se)
|
|
1061
|
-
return
|
|
1091
|
+
return X?.itemSelectedClassName !== void 0 ? X.itemSelectedClassName : U(Z && L.entrySelected, se && L.entryItemSelected);
|
|
1062
1092
|
return "";
|
|
1063
|
-
})(),
|
|
1064
|
-
...
|
|
1065
|
-
...A && Z ?
|
|
1066
|
-
...!A && (Z || se) ?
|
|
1067
|
-
},
|
|
1093
|
+
})(), Fe = U(L.entry, Oe, Pe, xe, e.className), Re = U(L.expandIcon, j, (Z || se) && L.expandIconSelected), G = U(L.typeIcon, (Z || se) && L.typeIconSelected), Ve = U(L.name, o, A && L.nameDirectory, A && I, !A && ve, (Z || se) && L.nameSelected), tt = Gn({ isDirectory: A, isExpanded: Se, showExpandIcons: J && t >= 0, useCanvasExpandIcons: me, expandIconSize: W }), yt = (A ? z : B) ? Vn({ entry: e, isDirectory: A, isExpanded: Se, isSelected: Z, isItemSelected: !!se, extension: ie, mimeType: e.mimeType }, Q, oe) : null, Xe = {
|
|
1094
|
+
...ye ? X?.hoverStyle : {},
|
|
1095
|
+
...A && Z ? X?.directorySelectedStyle : {},
|
|
1096
|
+
...!A && (Z || se) ? X?.itemSelectedStyle : {}
|
|
1097
|
+
}, Ke = Xn(e.data), nt = { width: oe, height: oe }, rt = Bn(pe), we = n + t * V;
|
|
1068
1098
|
return /* @__PURE__ */ f.jsxs(
|
|
1069
1099
|
"div",
|
|
1070
1100
|
{
|
|
1071
|
-
className:
|
|
1101
|
+
className: Fe,
|
|
1072
1102
|
style: {
|
|
1073
|
-
...
|
|
1074
|
-
...
|
|
1075
|
-
...
|
|
1103
|
+
...rt,
|
|
1104
|
+
...Xe,
|
|
1105
|
+
...be,
|
|
1076
1106
|
...e.style,
|
|
1077
1107
|
// 箱の性質はホストのスタイルの後に書く。スプレッドは値が undefined のキーも写し、React はそれを空にするため、
|
|
1078
1108
|
// 前に書くと検査が通す { height: undefined } が行の高さを消す
|
|
1079
|
-
paddingLeft: `${Math.max(0,
|
|
1080
|
-
transform:
|
|
1081
|
-
width:
|
|
1082
|
-
height: `${
|
|
1109
|
+
paddingLeft: `${Math.max(0, we)}px`,
|
|
1110
|
+
transform: we < 0 ? `translateX(${we}px)` : void 0,
|
|
1111
|
+
width: we < 0 ? `calc(100% + ${-we}px)` : void 0,
|
|
1112
|
+
height: `${m}px`
|
|
1083
1113
|
},
|
|
1084
|
-
...
|
|
1114
|
+
...Ke,
|
|
1085
1115
|
"data-entry-type": A ? "directory" : "file",
|
|
1086
|
-
"data-entry-expanded": A ? String(
|
|
1116
|
+
"data-entry-expanded": A ? String(Se) : void 0,
|
|
1087
1117
|
"data-entry-selected": Z ? "true" : void 0,
|
|
1088
1118
|
"data-entry-item-selected": se ? "true" : void 0,
|
|
1089
|
-
onClick:
|
|
1090
|
-
onMouseEnter: () =>
|
|
1091
|
-
onMouseLeave: () =>
|
|
1092
|
-
onFocus: (ne) =>
|
|
1093
|
-
onBlur: (ne) =>
|
|
1119
|
+
onClick: Te,
|
|
1120
|
+
onMouseEnter: () => Ne(!0),
|
|
1121
|
+
onMouseLeave: () => Ne(!1),
|
|
1122
|
+
onFocus: (ne) => x(d, e.absolutePath, ne.currentTarget),
|
|
1123
|
+
onBlur: (ne) => T(e.absolutePath, ne.currentTarget),
|
|
1094
1124
|
ref: te,
|
|
1095
1125
|
onKeyDown: (ne) => {
|
|
1096
1126
|
if (ne.key === "Enter" || ne.key === " ") {
|
|
1097
|
-
ne.preventDefault(), ne.repeat ||
|
|
1127
|
+
ne.preventDefault(), ne.repeat || Te(ne);
|
|
1098
1128
|
return;
|
|
1099
1129
|
}
|
|
1100
|
-
|
|
1130
|
+
N(ne, d);
|
|
1101
1131
|
},
|
|
1102
|
-
tabIndex:
|
|
1132
|
+
tabIndex: h ? 0 : -1,
|
|
1103
1133
|
role: "treeitem",
|
|
1104
|
-
"aria-expanded": A ?
|
|
1134
|
+
"aria-expanded": A ? Se : void 0,
|
|
1105
1135
|
"aria-level": r + 1,
|
|
1106
|
-
"aria-posinset":
|
|
1136
|
+
"aria-posinset": a,
|
|
1107
1137
|
"aria-setsize": i,
|
|
1108
|
-
"aria-selected":
|
|
1109
|
-
"aria-current":
|
|
1110
|
-
"aria-label": `${e.name} (${A ?
|
|
1138
|
+
"aria-selected": D === "none" ? void 0 : l,
|
|
1139
|
+
"aria-current": $e ? "page" : void 0,
|
|
1140
|
+
"aria-label": `${e.name} (${A ? y : p})`,
|
|
1111
1141
|
children: [
|
|
1112
|
-
(J ||
|
|
1113
|
-
(A ?
|
|
1142
|
+
(J || me) && /* @__PURE__ */ f.jsx("span", { className: Re, style: { ...ee, width: de, height: de }, children: tt }),
|
|
1143
|
+
(A ? z : B) && /* @__PURE__ */ f.jsx("span", { className: G, style: nt, children: yt }),
|
|
1114
1144
|
/* @__PURE__ */ f.jsx(
|
|
1115
1145
|
"span",
|
|
1116
1146
|
{
|
|
1117
|
-
className:
|
|
1147
|
+
className: Ve,
|
|
1118
1148
|
style: {
|
|
1119
|
-
...
|
|
1149
|
+
...rt,
|
|
1120
1150
|
...u,
|
|
1121
|
-
...A ? E :
|
|
1151
|
+
...A ? E : k
|
|
1122
1152
|
},
|
|
1123
1153
|
"data-entry-type": A ? "directory" : "file",
|
|
1124
1154
|
"data-entry-role": "name",
|
|
@@ -1131,634 +1161,644 @@ const jo = (e) => {
|
|
|
1131
1161
|
},
|
|
1132
1162
|
(e, t) => {
|
|
1133
1163
|
if (e.entry !== t.entry) return !1;
|
|
1134
|
-
const n = e.entry.children !== void 0, r = t.entry.children !== void 0,
|
|
1164
|
+
const n = e.entry.children !== void 0, r = t.entry.children !== void 0, a = n && e.isDirOpen(e.entry.absolutePath), i = r && t.isDirOpen(t.entry.absolutePath);
|
|
1135
1165
|
return e.indentLevel === t.indentLevel && e.originX === t.originX && // 位置情報は aria として描画されるため、変化したら再描画が必要
|
|
1136
1166
|
e.depth === t.depth && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.isSelectedForAria === t.isSelectedForAria && e.flatIndex === t.flatIndex && e.isActive === t.isActive && e.rowHeight === t.rowHeight && // 種別語はアクセシブルネームとして描画されるため、ロケール / 上書きの変更で再描画が必要
|
|
1137
|
-
e.entryKindDirectory === t.entryKindDirectory && e.entryKindFile === t.entryKindFile &&
|
|
1167
|
+
e.entryKindDirectory === t.entryKindDirectory && e.entryKindFile === t.entryKindFile && a === i && e.selection.selectedPath === t.selection.selectedPath && e.selection.currentPath === t.selection.currentPath && 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.typeIconSize === t.visual.typeIconSize && e.visual.fontSize === t.visual.fontSize && e.visual.indentSize === t.visual.indentSize && 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.visual.expandIconClassName === t.visual.expandIconClassName && e.visual.expandIconStyle === t.visual.expandIconStyle;
|
|
1138
1168
|
}
|
|
1139
1169
|
);
|
|
1140
|
-
|
|
1141
|
-
const
|
|
1170
|
+
or.displayName = "DirectoryEntryItem";
|
|
1171
|
+
const sr = (e) => {
|
|
1142
1172
|
const t = [];
|
|
1143
1173
|
if (e.children)
|
|
1144
1174
|
for (const n of e.children)
|
|
1145
|
-
n.type === "directory" && (t.push(n.absolutePath), t.push(...
|
|
1175
|
+
n.type === "directory" && (t.push(n.absolutePath), t.push(...sr(n)));
|
|
1146
1176
|
return t;
|
|
1147
|
-
},
|
|
1177
|
+
}, Zo = ({
|
|
1148
1178
|
entries: e,
|
|
1149
|
-
expansion: { toggle: t, isExpanded: n, expandMultiple: r, collapseMultiple:
|
|
1150
|
-
selection: { onEntryClick:
|
|
1179
|
+
expansion: { toggle: t, isExpanded: n, expandMultiple: r, collapseMultiple: a, isPending: i, alwaysExpanded: l = !1, doubleClickAction: d = "recursive" },
|
|
1180
|
+
selection: { onEntryClick: h, selectedPath: b, currentPath: N, mode: x = "none", selectedItems: T, onSelectionChange: m },
|
|
1151
1181
|
visual: {
|
|
1152
|
-
className:
|
|
1153
|
-
style:
|
|
1154
|
-
ariaLabel:
|
|
1182
|
+
className: y,
|
|
1183
|
+
style: p,
|
|
1184
|
+
ariaLabel: w,
|
|
1155
1185
|
ariaLabelledBy: v,
|
|
1156
|
-
lineColor:
|
|
1186
|
+
lineColor: F = Hn,
|
|
1157
1187
|
showTreeLines: P = !0,
|
|
1158
1188
|
showExpandIcons: C = !0,
|
|
1159
|
-
showDirectoryIcons:
|
|
1160
|
-
showFileIcons:
|
|
1189
|
+
showDirectoryIcons: g = !0,
|
|
1190
|
+
showFileIcons: D = !0,
|
|
1161
1191
|
iconOverrides: $,
|
|
1162
1192
|
expandIconSize: O,
|
|
1163
1193
|
typeIconSize: Q,
|
|
1164
1194
|
fontSize: J,
|
|
1165
|
-
indentSize:
|
|
1166
|
-
itemHeight:
|
|
1167
|
-
removeRootIndent:
|
|
1168
|
-
highlightStyles:
|
|
1195
|
+
indentSize: z,
|
|
1196
|
+
itemHeight: B = Ot,
|
|
1197
|
+
removeRootIndent: me = !1,
|
|
1198
|
+
highlightStyles: W,
|
|
1169
1199
|
entryClassName: oe,
|
|
1170
|
-
entryStyle:
|
|
1200
|
+
entryStyle: pe,
|
|
1171
1201
|
nameClassName: V,
|
|
1172
|
-
nameStyle:
|
|
1173
|
-
directoryNameClassName:
|
|
1174
|
-
directoryNameStyle:
|
|
1175
|
-
fileNameClassName:
|
|
1202
|
+
nameStyle: X,
|
|
1203
|
+
directoryNameClassName: xe,
|
|
1204
|
+
directoryNameStyle: be,
|
|
1205
|
+
fileNameClassName: o,
|
|
1176
1206
|
fileNameStyle: u,
|
|
1177
|
-
expandIconClassName:
|
|
1207
|
+
expandIconClassName: I,
|
|
1178
1208
|
expandIconStyle: E
|
|
1179
1209
|
} = {},
|
|
1180
|
-
virtualScroll:
|
|
1181
|
-
grid:
|
|
1210
|
+
virtualScroll: ve,
|
|
1211
|
+
grid: k,
|
|
1182
1212
|
sort: j,
|
|
1183
1213
|
locale: ee,
|
|
1184
|
-
labels:
|
|
1185
|
-
ref:
|
|
1214
|
+
labels: ye,
|
|
1215
|
+
ref: Ne
|
|
1186
1216
|
}) => {
|
|
1187
|
-
const A =
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
}, [
|
|
1191
|
-
const
|
|
1192
|
-
overscanCount:
|
|
1217
|
+
const A = zn(ee), Se = M(() => vo(ee, ye), [ee, ye]), Z = Ho(So(Se)), { entryKindDirectory: $e, entryKindFile: se } = Se, te = M(() => xo({ indentSize: z, typeIconSize: Q, fontSize: J }), [z, Q, J]);
|
|
1218
|
+
M(() => {
|
|
1219
|
+
Ge(pe, { option: "visual.entryStyle" }), Ge(W?.hoverStyle, { option: "visual.highlightStyles.hoverStyle" }), Ge(W?.directorySelectedStyle, { option: "visual.highlightStyles.directorySelectedStyle" }), Ge(W?.itemSelectedStyle, { option: "visual.highlightStyles.itemSelectedStyle" }), lo(E, { option: "visual.expandIconStyle" });
|
|
1220
|
+
}, [pe, W, E]);
|
|
1221
|
+
const ie = k !== void 0, [Te, Oe] = fe(!1), Pe = Y(null), Fe = Y(null), Re = Y(null), [G, Ve] = fe(0), [tt, yt] = fe(0), [Xe, Ke] = fe(0), [nt, rt] = fe(null), {
|
|
1222
|
+
overscanCount: we = 15,
|
|
1193
1223
|
className: ne,
|
|
1194
|
-
background:
|
|
1195
|
-
onScroll:
|
|
1196
|
-
onRangeChange:
|
|
1197
|
-
onScrollAdjust:
|
|
1198
|
-
liveRegion:
|
|
1199
|
-
initialScrollIndex:
|
|
1200
|
-
initialScrollOffset:
|
|
1201
|
-
initialScrollAnchor:
|
|
1202
|
-
callbackThrottleMs:
|
|
1203
|
-
contentInsets:
|
|
1204
|
-
onItemFocus:
|
|
1205
|
-
viewportHeightOverride:
|
|
1206
|
-
scrollBarOptions:
|
|
1207
|
-
behaviorOptions:
|
|
1208
|
-
preserveScrollAnchor:
|
|
1209
|
-
getItemKey:
|
|
1224
|
+
background: zt,
|
|
1225
|
+
onScroll: Ht,
|
|
1226
|
+
onRangeChange: Wt,
|
|
1227
|
+
onScrollAdjust: Bt,
|
|
1228
|
+
liveRegion: Yt,
|
|
1229
|
+
initialScrollIndex: Gt,
|
|
1230
|
+
initialScrollOffset: Me,
|
|
1231
|
+
initialScrollAnchor: Vt,
|
|
1232
|
+
callbackThrottleMs: Xt = 5,
|
|
1233
|
+
contentInsets: Kt,
|
|
1234
|
+
onItemFocus: Ut,
|
|
1235
|
+
viewportHeightOverride: le,
|
|
1236
|
+
scrollBarOptions: gt,
|
|
1237
|
+
behaviorOptions: Jt,
|
|
1238
|
+
preserveScrollAnchor: Zt = !1,
|
|
1239
|
+
getItemKey: ar,
|
|
1210
1240
|
// 素通しの pass-through。型で受け付けているものは実際に転送する
|
|
1211
|
-
testId:
|
|
1212
|
-
contentProps:
|
|
1213
|
-
} =
|
|
1214
|
-
() =>
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1241
|
+
testId: qt,
|
|
1242
|
+
contentProps: bt
|
|
1243
|
+
} = ve ?? {}, Qt = M(
|
|
1244
|
+
() => ie ? { ...bt, role: "rowgroup" } : {
|
|
1245
|
+
...bt,
|
|
1246
|
+
role: "tree",
|
|
1247
|
+
"aria-label": v ? void 0 : w,
|
|
1248
|
+
"aria-labelledby": v,
|
|
1249
|
+
"aria-multiselectable": x === "multiple" ? !0 : void 0,
|
|
1250
|
+
"aria-busy": i ? !0 : void 0
|
|
1251
|
+
},
|
|
1252
|
+
[ie, bt, w, v, x, i]
|
|
1253
|
+
), en = M(() => ({ ...Jt, enableKeyboardNavigation: !1 }), [Jt]), [ot, tn] = fe(typeof Me == "number" ? Me : 0), vt = Y(typeof Me == "number" ? Me : 0), nn = _(
|
|
1254
|
+
(s, c) => {
|
|
1255
|
+
vt.current = s, tn(s), Ht?.(s, c);
|
|
1219
1256
|
},
|
|
1220
|
-
[
|
|
1221
|
-
),
|
|
1222
|
-
(
|
|
1223
|
-
const { renderingStartIndex: c, renderingEndIndex:
|
|
1224
|
-
|
|
1257
|
+
[Ht]
|
|
1258
|
+
), rn = _(
|
|
1259
|
+
(s) => {
|
|
1260
|
+
const { renderingStartIndex: c, renderingEndIndex: S } = s;
|
|
1261
|
+
rt((R) => R && R.renderStart === c && R.renderEnd === S ? R : { renderStart: c, renderEnd: S }), Wt?.(s);
|
|
1225
1262
|
},
|
|
1226
|
-
[
|
|
1263
|
+
[Wt]
|
|
1227
1264
|
);
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
}, []),
|
|
1231
|
-
const
|
|
1232
|
-
if (
|
|
1233
|
-
const H =
|
|
1234
|
-
|
|
1265
|
+
De(() => {
|
|
1266
|
+
Oe(!0), zo();
|
|
1267
|
+
}, []), De(() => {
|
|
1268
|
+
const s = Pe.current, c = ie ? Fe.current : s, S = () => {
|
|
1269
|
+
if (s) {
|
|
1270
|
+
const H = s.clientWidth;
|
|
1271
|
+
yt((q) => Math.abs(q - H) > 1 ? H : q);
|
|
1235
1272
|
}
|
|
1236
|
-
if (typeof
|
|
1237
|
-
|
|
1273
|
+
if (typeof le == "number")
|
|
1274
|
+
Ve((H) => Math.abs(H - le) > 1 ? le : H);
|
|
1238
1275
|
else if (c) {
|
|
1239
1276
|
const H = c.clientHeight;
|
|
1240
|
-
|
|
1277
|
+
Ve((q) => Math.abs(q - H) > 1 ? H : q);
|
|
1241
1278
|
}
|
|
1242
1279
|
};
|
|
1243
|
-
if (!(
|
|
1244
|
-
|
|
1245
|
-
const
|
|
1246
|
-
return
|
|
1247
|
-
}, [
|
|
1248
|
-
const
|
|
1280
|
+
if (!(s || c)) return Ve(0);
|
|
1281
|
+
S();
|
|
1282
|
+
const R = new ResizeObserver(S);
|
|
1283
|
+
return s && R.observe(s), c && c !== s && R.observe(c), () => R.disconnect();
|
|
1284
|
+
}, [le, ie]);
|
|
1285
|
+
const ze = typeof le == "number" ? le : G, Ee = _((s) => l || (Te ? n(s) : !1), [Te, n, l]), on = U(L.container, i && L.containerPending, y), sn = M(
|
|
1249
1286
|
() => ({
|
|
1250
|
-
...
|
|
1251
|
-
...
|
|
1252
|
-
...typeof
|
|
1287
|
+
...Mo,
|
|
1288
|
+
...p ?? {},
|
|
1289
|
+
...typeof le == "number" ? { height: le, minHeight: le } : {}
|
|
1253
1290
|
}),
|
|
1254
|
-
[
|
|
1255
|
-
),
|
|
1256
|
-
(
|
|
1257
|
-
const
|
|
1258
|
-
if (
|
|
1259
|
-
if (
|
|
1260
|
-
if (
|
|
1261
|
-
console.warn(`[DirectoryTree] Unknown double click action: ${
|
|
1291
|
+
[p, le]
|
|
1292
|
+
), St = _(
|
|
1293
|
+
(s, c) => {
|
|
1294
|
+
const S = [s.absolutePath, ...sr(s)], R = c || d;
|
|
1295
|
+
if (S.every((ke) => Ee(ke))) return a(S);
|
|
1296
|
+
if (S.every((ke) => !Ee(ke)) || R === "recursive") return r(S);
|
|
1297
|
+
if (R === "toggle") return a(S);
|
|
1298
|
+
console.warn(`[DirectoryTree] Unknown double click action: ${R}. No action taken.`);
|
|
1262
1299
|
},
|
|
1263
|
-
[
|
|
1264
|
-
),
|
|
1265
|
-
const
|
|
1266
|
-
|
|
1267
|
-
for (let c = 0; c <
|
|
1268
|
-
|
|
1269
|
-
return
|
|
1270
|
-
}, [
|
|
1271
|
-
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
const
|
|
1277
|
-
|
|
1278
|
-
const
|
|
1279
|
-
|
|
1280
|
-
const
|
|
1281
|
-
|
|
1282
|
-
const
|
|
1283
|
-
|
|
1284
|
-
const
|
|
1285
|
-
const c =
|
|
1286
|
-
return !c || c.getViewportSize() <= 0 ? !1 : (c.scrollToIndex(
|
|
1287
|
-
}, []),
|
|
1288
|
-
(
|
|
1289
|
-
const c =
|
|
1300
|
+
[Ee, r, a, d]
|
|
1301
|
+
), wt = ie ? !1 : me, { flatItems: je, lineItems: Et, maxIndent: an } = M(() => Bo(e, Ee, P, wt, j), [e, Ee, P, wt, j]), st = Ro({ indentSize: te.indentSize, removeRootIndent: wt, hasExpandBox: C || P }), ge = M(() => P ? ko(te, O, st) : null, [P, te, O, st]), K = M(() => je.map((s, c) => ({ ...s, rowHeight: Io(B, s.entry, c) })), [je, B]), _e = M(() => K.map((s) => s.rowHeight), [K]), Ae = M(() => {
|
|
1302
|
+
const s = new Array(_e.length + 1);
|
|
1303
|
+
s[0] = 0;
|
|
1304
|
+
for (let c = 0; c < _e.length; c++)
|
|
1305
|
+
s[c + 1] = s[c] + _e[c];
|
|
1306
|
+
return s;
|
|
1307
|
+
}, [_e]), ln = _((s) => K[s]?.rowHeight ?? Ot, [K]), ir = _((s) => K[s]?.entry.absolutePath ?? s, [K]), cn = ar ?? ir, He = b ?? null, xt = N ?? null, [dn, Ue] = fe(() => ({ selectedPath: He, selectionGeneration: 0, anchor: null })), Rt = Dn(dn, He);
|
|
1308
|
+
Rt !== dn && Ue((s) => Dn(s, He));
|
|
1309
|
+
const at = M(() => Do(je), [je]), We = M(() => Fo(at, Rt), [at, Rt]), Je = Y(/* @__PURE__ */ new Map()), it = Y(null), [lt] = fe(wo), Ze = Y(null), [lr, un] = fe(!0), It = Y(je);
|
|
1310
|
+
It.current = je;
|
|
1311
|
+
const fn = Y(Ee);
|
|
1312
|
+
fn.current = Ee;
|
|
1313
|
+
const kt = Y(t);
|
|
1314
|
+
kt.current = t;
|
|
1315
|
+
const hn = Y(at);
|
|
1316
|
+
hn.current = at;
|
|
1317
|
+
const Nt = Y(We);
|
|
1318
|
+
Nt.current = We;
|
|
1319
|
+
const mn = Y(Ut);
|
|
1320
|
+
mn.current = Ut;
|
|
1321
|
+
const Le = _((s) => {
|
|
1322
|
+
const c = Re.current;
|
|
1323
|
+
return !c || c.getViewportSize() <= 0 ? !1 : (c.scrollToIndex(s, { align: "nearest" }), !0);
|
|
1324
|
+
}, []), Ie = _(
|
|
1325
|
+
(s) => {
|
|
1326
|
+
const c = Je.current.get(s);
|
|
1290
1327
|
if (c === void 0) {
|
|
1291
|
-
|
|
1328
|
+
Ze.current = s, Le(s) || (Ze.current = null);
|
|
1292
1329
|
return;
|
|
1293
1330
|
}
|
|
1294
|
-
|
|
1331
|
+
Ze.current = null, Le(s), c.focus({ preventScroll: !0 });
|
|
1295
1332
|
},
|
|
1296
|
-
[
|
|
1297
|
-
),
|
|
1333
|
+
[Le]
|
|
1334
|
+
), pn = _((s, c) => {
|
|
1298
1335
|
if (c)
|
|
1299
|
-
|
|
1336
|
+
Je.current.set(s, c), Ze.current === s ? (Ze.current = null, c.focus({ preventScroll: !0 })) : c.contains(c.ownerDocument.activeElement) && Ue((S) => S.anchor === null ? S : { ...S, anchor: { ...S.anchor, focused: !0 } });
|
|
1300
1337
|
else {
|
|
1301
|
-
const
|
|
1302
|
-
|
|
1338
|
+
const S = Je.current.get(s);
|
|
1339
|
+
Je.current.delete(s), S?.contains(S.ownerDocument.activeElement) && Ue((R) => R.anchor === null ? R : { ...R, anchor: { ...R.anchor, focused: !1 } });
|
|
1303
1340
|
}
|
|
1304
|
-
|
|
1341
|
+
s === Nt.current && un(c !== null);
|
|
1305
1342
|
}, []);
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
}, [
|
|
1309
|
-
const
|
|
1310
|
-
(
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1343
|
+
In(() => {
|
|
1344
|
+
un(Je.current.has(We));
|
|
1345
|
+
}, [We]);
|
|
1346
|
+
const Tt = _(
|
|
1347
|
+
(s, c, S) => {
|
|
1348
|
+
const R = it.current === S;
|
|
1349
|
+
it.current = null, R || (Ue((H) => $o(H, c)), lt.landedOn(S) || Le(s)), mn.current?.(s);
|
|
1313
1350
|
},
|
|
1314
|
-
[
|
|
1315
|
-
),
|
|
1316
|
-
const { ownerDocument:
|
|
1317
|
-
if (!
|
|
1318
|
-
|
|
1351
|
+
[Le, lt]
|
|
1352
|
+
), ct = _((s) => lt.mark(s.nativeEvent), [lt]), Pt = _((s, c) => {
|
|
1353
|
+
const { ownerDocument: S } = c;
|
|
1354
|
+
if (!S.hasFocus() && c.contains(S.activeElement)) {
|
|
1355
|
+
it.current = c;
|
|
1319
1356
|
return;
|
|
1320
1357
|
}
|
|
1321
|
-
|
|
1322
|
-
}, []),
|
|
1323
|
-
(
|
|
1324
|
-
const
|
|
1325
|
-
if (!Number.isInteger(
|
|
1326
|
-
throw new RangeError(`[directory-tree] scrollToIndex: ${String(
|
|
1327
|
-
if (
|
|
1328
|
-
|
|
1358
|
+
it.current = null, Ue((R) => R.anchor !== null && R.anchor.path === s ? { ...R, anchor: { ...R.anchor, focused: !1 } } : R);
|
|
1359
|
+
}, []), cr = _(() => Ie(Nt.current), [Ie]), _t = _(
|
|
1360
|
+
(s, c) => {
|
|
1361
|
+
const S = Fn(c), R = It.current.length;
|
|
1362
|
+
if (!Number.isInteger(s) || s < 0 || s >= R)
|
|
1363
|
+
throw new RangeError(`[directory-tree] scrollToIndex: ${String(s)} is not a row index (${R === 0 ? "the tree has no rows" : `expected an integer in 0..${String(R - 1)}`}).`);
|
|
1364
|
+
if (S === "nearest") {
|
|
1365
|
+
Le(s);
|
|
1329
1366
|
return;
|
|
1330
1367
|
}
|
|
1331
|
-
|
|
1368
|
+
Re.current?.scrollToIndex(s, { align: S });
|
|
1332
1369
|
},
|
|
1333
|
-
[
|
|
1370
|
+
[Le]
|
|
1334
1371
|
);
|
|
1335
|
-
|
|
1336
|
-
|
|
1372
|
+
yr(
|
|
1373
|
+
Ne,
|
|
1337
1374
|
() => ({
|
|
1338
|
-
scrollToIndex:
|
|
1339
|
-
scrollToPath: (
|
|
1340
|
-
|
|
1341
|
-
const
|
|
1342
|
-
return
|
|
1375
|
+
scrollToIndex: _t,
|
|
1376
|
+
scrollToPath: (s, c) => {
|
|
1377
|
+
Fn(c);
|
|
1378
|
+
const S = hn.current.get(s);
|
|
1379
|
+
return S === void 0 ? !1 : (_t(S, c), !0);
|
|
1343
1380
|
},
|
|
1344
|
-
getScrollAnchor: () =>
|
|
1381
|
+
getScrollAnchor: () => Re.current?.getScrollAnchor() ?? null
|
|
1345
1382
|
}),
|
|
1346
|
-
[
|
|
1383
|
+
[_t]
|
|
1347
1384
|
);
|
|
1348
|
-
const
|
|
1349
|
-
(
|
|
1350
|
-
if (
|
|
1385
|
+
const yn = _(
|
|
1386
|
+
(s, c) => {
|
|
1387
|
+
if (s.altKey || s.ctrlKey || s.metaKey)
|
|
1351
1388
|
return;
|
|
1352
|
-
const
|
|
1353
|
-
if (
|
|
1354
|
-
const H =
|
|
1355
|
-
switch (
|
|
1389
|
+
const S = It.current, R = S.length - 1;
|
|
1390
|
+
if (R < 0) return;
|
|
1391
|
+
const H = S[c], q = H?.entry.children !== void 0, ke = q && fn.current(H.entry.absolutePath);
|
|
1392
|
+
switch (s.key) {
|
|
1356
1393
|
case "ArrowDown":
|
|
1357
|
-
|
|
1394
|
+
s.preventDefault(), Ie(Math.min(c + 1, R));
|
|
1358
1395
|
break;
|
|
1359
1396
|
case "ArrowUp":
|
|
1360
|
-
|
|
1397
|
+
s.preventDefault(), Ie(Math.max(c - 1, 0));
|
|
1361
1398
|
break;
|
|
1362
1399
|
case "Home":
|
|
1363
|
-
|
|
1400
|
+
s.preventDefault(), Ie(0);
|
|
1364
1401
|
break;
|
|
1365
1402
|
case "End":
|
|
1366
|
-
|
|
1403
|
+
s.preventDefault(), Ie(R);
|
|
1367
1404
|
break;
|
|
1368
1405
|
case "ArrowRight":
|
|
1369
|
-
|
|
1406
|
+
s.preventDefault(), q && !ke ? kt.current(H.entry.absolutePath) : q && c < R && S[c + 1].depth > H.depth && Ie(c + 1);
|
|
1370
1407
|
break;
|
|
1371
1408
|
case "ArrowLeft": {
|
|
1372
|
-
if (
|
|
1373
|
-
|
|
1409
|
+
if (s.preventDefault(), q && ke) {
|
|
1410
|
+
kt.current(H.entry.absolutePath);
|
|
1374
1411
|
break;
|
|
1375
1412
|
}
|
|
1376
|
-
const
|
|
1377
|
-
for (let
|
|
1378
|
-
if (
|
|
1379
|
-
|
|
1413
|
+
const mr = H?.depth ?? 0;
|
|
1414
|
+
for (let ht = c - 1; ht >= 0; ht--)
|
|
1415
|
+
if (S[ht].depth < mr) {
|
|
1416
|
+
Ie(ht);
|
|
1380
1417
|
break;
|
|
1381
1418
|
}
|
|
1382
1419
|
break;
|
|
1383
1420
|
}
|
|
1384
1421
|
}
|
|
1385
1422
|
},
|
|
1386
|
-
[
|
|
1387
|
-
),
|
|
1388
|
-
() =>
|
|
1389
|
-
[
|
|
1390
|
-
),
|
|
1391
|
-
|
|
1423
|
+
[Ie]
|
|
1424
|
+
), dt = M(() => ge === null || Et.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : Go(Et, _e, Ae, ge), [Et, _e, Ae, ge]), ut = M(() => ge === null || e.length === 0 ? 0 : ge.originX + an * ge.indentSize + de + ge.typeIconSize, [e.length, an, ge]), { renderStart: gn, renderEnd: bn, lookaheadEnd: vn } = M(
|
|
1425
|
+
() => Yo(K.length, ze, we, nt, ot, Ae),
|
|
1426
|
+
[K.length, ze, we, nt, ot, Ae]
|
|
1427
|
+
), Ct = M(() => ge === null || ut <= 0 || ze <= 0 || dt.segmentsByItem.length === 0 ? null : /* @__PURE__ */ f.jsx("div", { className: "pointer-events-none absolute inset-0 z-1", "aria-hidden": "true", children: /* @__PURE__ */ f.jsx("div", { className: "absolute top-0 left-0", style: { width: ut, height: ze }, children: /* @__PURE__ */ f.jsx(
|
|
1428
|
+
rr,
|
|
1392
1429
|
{
|
|
1393
|
-
segmentsByItem:
|
|
1394
|
-
glyphsByItem:
|
|
1395
|
-
itemHeight:
|
|
1396
|
-
width:
|
|
1397
|
-
viewportHeight:
|
|
1398
|
-
scrollPosition:
|
|
1399
|
-
color:
|
|
1400
|
-
expandGlyphColor:
|
|
1401
|
-
expandGlyphSize:
|
|
1402
|
-
renderStartIndex:
|
|
1403
|
-
renderEndIndex:
|
|
1404
|
-
lookaheadEndIndex:
|
|
1430
|
+
segmentsByItem: dt.segmentsByItem,
|
|
1431
|
+
glyphsByItem: dt.glyphsByItem,
|
|
1432
|
+
itemHeight: _e[0] ?? Ot,
|
|
1433
|
+
width: ut,
|
|
1434
|
+
viewportHeight: ze,
|
|
1435
|
+
scrollPosition: ot,
|
|
1436
|
+
color: F,
|
|
1437
|
+
expandGlyphColor: F,
|
|
1438
|
+
expandGlyphSize: ge.glyphSize,
|
|
1439
|
+
renderStartIndex: gn,
|
|
1440
|
+
renderEndIndex: bn,
|
|
1441
|
+
lookaheadEndIndex: vn
|
|
1405
1442
|
}
|
|
1406
|
-
) }) }), [
|
|
1407
|
-
|
|
1408
|
-
const
|
|
1409
|
-
if (
|
|
1443
|
+
) }) }), [ut, ze, gn, bn, vn, ot, dt, F, ge, _e]), Sn = _((s) => K[s], [K]), wn = Y(null);
|
|
1444
|
+
In(() => {
|
|
1445
|
+
const s = wn.current;
|
|
1446
|
+
if (wn.current = { items: K, offsets: Ae }, !Zt || !s || s.items === K)
|
|
1410
1447
|
return;
|
|
1411
|
-
const c =
|
|
1448
|
+
const c = Re.current, S = c?.getScrollPosition(), R = typeof S == "number" && S >= 0 ? S : vt.current, H = Po(s.items, s.offsets, R);
|
|
1412
1449
|
if (!H)
|
|
1413
1450
|
return;
|
|
1414
|
-
const q =
|
|
1415
|
-
if (q === null || Math.abs(q -
|
|
1451
|
+
const q = _o(H, K, Ae);
|
|
1452
|
+
if (q === null || Math.abs(q - R) < 1)
|
|
1416
1453
|
return;
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
}, [
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
}, [
|
|
1424
|
-
const
|
|
1454
|
+
const ke = c ? c.scrollTo(q) : q;
|
|
1455
|
+
vt.current = ke, tn(ke);
|
|
1456
|
+
}, [K, Ae, Zt]);
|
|
1457
|
+
const Ce = k?.columns, Be = k?.scrollBarWidth ?? gt?.width ?? tr, re = M(() => Ce ? po({ measuredWidth: tt, columns: Ce, scrollBarWidth: Be }) : null, [Ce, tt, Be]), ft = M(() => Ce ? mo(Ce) : "", [Ce]), dr = M(() => k?.showFooter && Ce ? yo(e) : [], [k?.showFooter, Ce, e]), Ye = re?.maxHScroll ?? 0;
|
|
1458
|
+
De(() => {
|
|
1459
|
+
Ke((s) => jt(s, Ye));
|
|
1460
|
+
}, [Ye]);
|
|
1461
|
+
const En = _((s) => Ke((c) => jt(c + s, Ye)), [Ye]), xn = M(
|
|
1425
1462
|
() => ({
|
|
1426
1463
|
iconOverrides: $,
|
|
1427
1464
|
showExpandIcons: C,
|
|
1428
|
-
showDirectoryIcons:
|
|
1429
|
-
showFileIcons:
|
|
1465
|
+
showDirectoryIcons: g,
|
|
1466
|
+
showFileIcons: D,
|
|
1430
1467
|
useCanvasExpandIcons: P,
|
|
1431
1468
|
expandIconSize: O,
|
|
1432
1469
|
typeIconSize: te.typeIconSize,
|
|
1433
1470
|
fontSize: te.fontSize,
|
|
1434
1471
|
indentSize: te.indentSize,
|
|
1435
|
-
highlightStyles:
|
|
1436
|
-
expandIconClassName:
|
|
1472
|
+
highlightStyles: W,
|
|
1473
|
+
expandIconClassName: I,
|
|
1437
1474
|
expandIconStyle: E
|
|
1438
1475
|
}),
|
|
1439
|
-
[$, C,
|
|
1440
|
-
),
|
|
1476
|
+
[$, C, g, D, P, O, te, W, I, E]
|
|
1477
|
+
), Rn = M(
|
|
1441
1478
|
() => /* @__PURE__ */ f.jsx(
|
|
1442
|
-
|
|
1479
|
+
vr,
|
|
1443
1480
|
{
|
|
1444
|
-
ref:
|
|
1445
|
-
itemCount:
|
|
1446
|
-
getItem:
|
|
1447
|
-
getItemHeight:
|
|
1448
|
-
getItemKey:
|
|
1449
|
-
testId:
|
|
1450
|
-
contentProps:
|
|
1481
|
+
ref: Re,
|
|
1482
|
+
itemCount: K.length,
|
|
1483
|
+
getItem: Sn,
|
|
1484
|
+
getItemHeight: ln,
|
|
1485
|
+
getItemKey: cn,
|
|
1486
|
+
testId: qt,
|
|
1487
|
+
contentProps: Qt,
|
|
1451
1488
|
locale: A,
|
|
1452
1489
|
labels: Z,
|
|
1453
|
-
viewportSize: typeof
|
|
1454
|
-
overscanCount:
|
|
1455
|
-
onScroll:
|
|
1456
|
-
onRangeChange:
|
|
1457
|
-
onScrollAdjust:
|
|
1458
|
-
liveRegion:
|
|
1490
|
+
viewportSize: typeof le == "number" ? le : void 0,
|
|
1491
|
+
overscanCount: we,
|
|
1492
|
+
onScroll: nn,
|
|
1493
|
+
onRangeChange: rn,
|
|
1494
|
+
onScrollAdjust: Bt,
|
|
1495
|
+
liveRegion: Yt,
|
|
1459
1496
|
className: ne,
|
|
1460
|
-
onWheelHorizontal:
|
|
1497
|
+
onWheelHorizontal: ie ? En : void 0,
|
|
1461
1498
|
background: /* @__PURE__ */ f.jsxs(f.Fragment, { children: [
|
|
1462
|
-
|
|
1499
|
+
ie && re ? (
|
|
1463
1500
|
// Clip the connector-line canvas to the frozen name column so deep trees never bleed into the numeric region.
|
|
1464
|
-
/* @__PURE__ */ f.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-
|
|
1465
|
-
) :
|
|
1466
|
-
|
|
1501
|
+
/* @__PURE__ */ f.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-1 h-full overflow-hidden", style: { width: re.nameWidth }, "aria-hidden": "true", children: Ct })
|
|
1502
|
+
) : Ct,
|
|
1503
|
+
zt
|
|
1467
1504
|
] }),
|
|
1468
|
-
initialScrollIndex:
|
|
1469
|
-
initialScrollOffset:
|
|
1470
|
-
initialScrollAnchor:
|
|
1471
|
-
callbackThrottleMs:
|
|
1472
|
-
contentInsets:
|
|
1473
|
-
scrollBarOptions:
|
|
1474
|
-
behaviorOptions:
|
|
1475
|
-
children: (
|
|
1476
|
-
|
|
1505
|
+
initialScrollIndex: Gt,
|
|
1506
|
+
initialScrollOffset: Me,
|
|
1507
|
+
initialScrollAnchor: Vt,
|
|
1508
|
+
callbackThrottleMs: Xt,
|
|
1509
|
+
contentInsets: Kt,
|
|
1510
|
+
scrollBarOptions: gt,
|
|
1511
|
+
behaviorOptions: en,
|
|
1512
|
+
children: (s, c) => s ? ie && k && re ? /* @__PURE__ */ f.jsx(
|
|
1513
|
+
qn,
|
|
1477
1514
|
{
|
|
1478
|
-
entry:
|
|
1479
|
-
indentLevel:
|
|
1480
|
-
positionInSet:
|
|
1481
|
-
setSize:
|
|
1482
|
-
rowIndex: c + (
|
|
1515
|
+
entry: s.entry,
|
|
1516
|
+
indentLevel: s.indentLevel,
|
|
1517
|
+
positionInSet: s.positionInSet,
|
|
1518
|
+
setSize: s.setSize,
|
|
1519
|
+
rowIndex: c + (k.showHeader ?? !0 ? 2 : 1),
|
|
1483
1520
|
flatIndex: c,
|
|
1484
|
-
onRowFocus:
|
|
1485
|
-
onRowBlur:
|
|
1486
|
-
isSelectedForAria: !!
|
|
1487
|
-
rowHeight:
|
|
1488
|
-
isDirOpen:
|
|
1489
|
-
columns:
|
|
1490
|
-
numericTemplate:
|
|
1521
|
+
onRowFocus: Tt,
|
|
1522
|
+
onRowBlur: Pt,
|
|
1523
|
+
isSelectedForAria: !!T?.has(s.entry.absolutePath),
|
|
1524
|
+
rowHeight: s.rowHeight,
|
|
1525
|
+
isDirOpen: Ee,
|
|
1526
|
+
columns: k.columns,
|
|
1527
|
+
numericTemplate: ft,
|
|
1491
1528
|
numericTotal: re.numericTotal,
|
|
1492
1529
|
nameWidth: re.nameWidth,
|
|
1493
|
-
rowClassName:
|
|
1494
|
-
selection: { onEntryClick:
|
|
1495
|
-
expansion: { toggleDirectory: t, onToggleDirectoryRecursive:
|
|
1496
|
-
visual:
|
|
1530
|
+
rowClassName: k.rowClassName,
|
|
1531
|
+
selection: { onEntryClick: h, selectedPath: He, currentPath: xt, mode: x, selectedItems: T, onSelectionChange: m },
|
|
1532
|
+
expansion: { toggleDirectory: t, onToggleDirectoryRecursive: St },
|
|
1533
|
+
visual: xn
|
|
1497
1534
|
},
|
|
1498
|
-
|
|
1535
|
+
s.entry.absolutePath
|
|
1499
1536
|
) : /* @__PURE__ */ f.jsx(
|
|
1500
|
-
|
|
1537
|
+
or,
|
|
1501
1538
|
{
|
|
1502
|
-
entry:
|
|
1503
|
-
indentLevel:
|
|
1504
|
-
originX:
|
|
1505
|
-
depth:
|
|
1506
|
-
positionInSet:
|
|
1507
|
-
setSize:
|
|
1508
|
-
isSelectedForAria: !!
|
|
1539
|
+
entry: s.entry,
|
|
1540
|
+
indentLevel: s.indentLevel,
|
|
1541
|
+
originX: st,
|
|
1542
|
+
depth: s.depth,
|
|
1543
|
+
positionInSet: s.positionInSet,
|
|
1544
|
+
setSize: s.setSize,
|
|
1545
|
+
isSelectedForAria: !!T?.has(s.entry.absolutePath),
|
|
1509
1546
|
flatIndex: c,
|
|
1510
|
-
isActive: c ===
|
|
1511
|
-
registerRowRef:
|
|
1512
|
-
onNavigationKeyDown:
|
|
1513
|
-
onRowFocus:
|
|
1514
|
-
onRowBlur:
|
|
1515
|
-
rowHeight:
|
|
1516
|
-
entryKindDirectory:
|
|
1547
|
+
isActive: c === We,
|
|
1548
|
+
registerRowRef: pn,
|
|
1549
|
+
onNavigationKeyDown: yn,
|
|
1550
|
+
onRowFocus: Tt,
|
|
1551
|
+
onRowBlur: Pt,
|
|
1552
|
+
rowHeight: s.rowHeight,
|
|
1553
|
+
entryKindDirectory: $e,
|
|
1517
1554
|
entryKindFile: se,
|
|
1518
|
-
isDirOpen:
|
|
1519
|
-
expansion: { toggleDirectory: t, onToggleDirectoryRecursive:
|
|
1520
|
-
selection: { onEntryClick:
|
|
1555
|
+
isDirOpen: Ee,
|
|
1556
|
+
expansion: { toggleDirectory: t, onToggleDirectoryRecursive: St },
|
|
1557
|
+
selection: { onEntryClick: h, selectedPath: He, currentPath: xt, mode: x, selectedItems: T, onSelectionChange: m },
|
|
1521
1558
|
visual: {
|
|
1522
1559
|
iconOverrides: $,
|
|
1523
1560
|
showExpandIcons: C,
|
|
1524
|
-
showDirectoryIcons:
|
|
1525
|
-
showFileIcons:
|
|
1561
|
+
showDirectoryIcons: g,
|
|
1562
|
+
showFileIcons: D,
|
|
1526
1563
|
useCanvasExpandIcons: P,
|
|
1527
1564
|
expandIconSize: O,
|
|
1528
1565
|
typeIconSize: te.typeIconSize,
|
|
1529
1566
|
fontSize: te.fontSize,
|
|
1530
1567
|
indentSize: te.indentSize,
|
|
1531
|
-
highlightStyles:
|
|
1568
|
+
highlightStyles: W,
|
|
1532
1569
|
entryClassName: oe,
|
|
1533
|
-
entryStyle:
|
|
1570
|
+
entryStyle: pe,
|
|
1534
1571
|
nameClassName: V,
|
|
1535
|
-
nameStyle:
|
|
1536
|
-
directoryNameClassName:
|
|
1537
|
-
directoryNameStyle:
|
|
1538
|
-
fileNameClassName:
|
|
1572
|
+
nameStyle: X,
|
|
1573
|
+
directoryNameClassName: xe,
|
|
1574
|
+
directoryNameStyle: be,
|
|
1575
|
+
fileNameClassName: o,
|
|
1539
1576
|
fileNameStyle: u,
|
|
1540
|
-
expandIconClassName:
|
|
1577
|
+
expandIconClassName: I,
|
|
1541
1578
|
expandIconStyle: E
|
|
1542
1579
|
}
|
|
1543
1580
|
},
|
|
1544
|
-
|
|
1581
|
+
s.entry.absolutePath
|
|
1545
1582
|
) : null
|
|
1546
1583
|
}
|
|
1547
1584
|
),
|
|
1548
1585
|
[
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1586
|
+
K.length,
|
|
1587
|
+
Sn,
|
|
1588
|
+
ln,
|
|
1589
|
+
cn,
|
|
1590
|
+
qt,
|
|
1591
|
+
Qt,
|
|
1555
1592
|
A,
|
|
1556
1593
|
Z,
|
|
1557
|
-
|
|
1594
|
+
$e,
|
|
1558
1595
|
se,
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
Nt,
|
|
1596
|
+
We,
|
|
1597
|
+
pn,
|
|
1598
|
+
yn,
|
|
1563
1599
|
Tt,
|
|
1564
|
-
ie,
|
|
1565
|
-
ve,
|
|
1566
|
-
en,
|
|
1567
|
-
tn,
|
|
1568
|
-
Wt,
|
|
1569
|
-
Ht,
|
|
1570
|
-
ne,
|
|
1571
|
-
le,
|
|
1572
|
-
Sn,
|
|
1573
|
-
re,
|
|
1574
1600
|
Pt,
|
|
1575
|
-
|
|
1601
|
+
le,
|
|
1602
|
+
we,
|
|
1603
|
+
nn,
|
|
1604
|
+
rn,
|
|
1576
1605
|
Bt,
|
|
1577
|
-
Fe,
|
|
1578
1606
|
Yt,
|
|
1607
|
+
ne,
|
|
1608
|
+
ie,
|
|
1609
|
+
En,
|
|
1610
|
+
re,
|
|
1611
|
+
Ct,
|
|
1612
|
+
zt,
|
|
1579
1613
|
Gt,
|
|
1580
|
-
Xt,
|
|
1581
|
-
pt,
|
|
1582
|
-
qt,
|
|
1583
|
-
T,
|
|
1584
|
-
dt,
|
|
1585
|
-
Se,
|
|
1586
|
-
b,
|
|
1587
1614
|
Me,
|
|
1588
|
-
|
|
1589
|
-
|
|
1615
|
+
Vt,
|
|
1616
|
+
Xt,
|
|
1617
|
+
Kt,
|
|
1618
|
+
gt,
|
|
1619
|
+
en,
|
|
1590
1620
|
k,
|
|
1621
|
+
ft,
|
|
1622
|
+
Ee,
|
|
1591
1623
|
h,
|
|
1624
|
+
He,
|
|
1625
|
+
xt,
|
|
1626
|
+
x,
|
|
1627
|
+
T,
|
|
1628
|
+
m,
|
|
1592
1629
|
t,
|
|
1593
|
-
|
|
1594
|
-
|
|
1630
|
+
St,
|
|
1631
|
+
xn,
|
|
1595
1632
|
$,
|
|
1596
1633
|
C,
|
|
1597
|
-
|
|
1598
|
-
|
|
1634
|
+
g,
|
|
1635
|
+
D,
|
|
1599
1636
|
P,
|
|
1600
1637
|
O,
|
|
1601
1638
|
te,
|
|
1602
|
-
|
|
1603
|
-
|
|
1639
|
+
st,
|
|
1640
|
+
W,
|
|
1604
1641
|
oe,
|
|
1605
|
-
|
|
1642
|
+
pe,
|
|
1606
1643
|
V,
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1644
|
+
X,
|
|
1645
|
+
xe,
|
|
1646
|
+
be,
|
|
1647
|
+
o,
|
|
1611
1648
|
u,
|
|
1612
|
-
|
|
1649
|
+
I,
|
|
1613
1650
|
E
|
|
1614
1651
|
]
|
|
1615
1652
|
);
|
|
1616
|
-
if (!(
|
|
1617
|
-
return /* @__PURE__ */ f.jsxs("div", { ref:
|
|
1618
|
-
|
|
1653
|
+
if (!(k && re))
|
|
1654
|
+
return /* @__PURE__ */ f.jsxs("div", { ref: Pe, className: on, style: sn, onPointerDownCapture: ct, onMouseDownCapture: ct, children: [
|
|
1655
|
+
je.length > 0 && !lr && // biome-ignore lint/a11y/noNoninteractiveTabindex: 停止点の行が描画窓の外で DOM に無い間だけ Tab を受け、受けた瞬間にその行へ焦点を渡す。これが無いとツリーに Tab で入れない
|
|
1619
1656
|
// biome-ignore lint/a11y/noStaticElementInteractions: 同上 (焦点の受け渡しだけを担い、要素自身は操作の対象ではない)
|
|
1620
|
-
/* @__PURE__ */ f.jsx("span", { tabIndex: 0, "data-directory-tree-tab-stop": "", style:
|
|
1621
|
-
|
|
1657
|
+
/* @__PURE__ */ f.jsx("span", { tabIndex: 0, "data-directory-tree-tab-stop": "", style: Wo, onFocus: cr }),
|
|
1658
|
+
Rn
|
|
1622
1659
|
] });
|
|
1623
|
-
const
|
|
1660
|
+
const ur = k.showHeader ?? !0, fr = k.showFooter ?? !1, hr = { ...sn, "--dt-hscroll": `${Xe}px` };
|
|
1624
1661
|
return /* @__PURE__ */ f.jsxs(
|
|
1625
1662
|
"div",
|
|
1626
1663
|
{
|
|
1627
|
-
ref:
|
|
1628
|
-
className:
|
|
1629
|
-
style:
|
|
1664
|
+
ref: Pe,
|
|
1665
|
+
className: U(on, "dt-grid"),
|
|
1666
|
+
style: hr,
|
|
1630
1667
|
role: "treegrid",
|
|
1631
|
-
"aria-label": v ? void 0 :
|
|
1668
|
+
"aria-label": v ? void 0 : w,
|
|
1632
1669
|
"aria-labelledby": v,
|
|
1633
|
-
"aria-multiselectable":
|
|
1634
|
-
"aria-
|
|
1635
|
-
|
|
1636
|
-
|
|
1670
|
+
"aria-multiselectable": x === "multiple" ? !0 : void 0,
|
|
1671
|
+
"aria-busy": i ? !0 : void 0,
|
|
1672
|
+
"aria-rowcount": K.length + (k.showHeader ?? !0 ? 1 : 0),
|
|
1673
|
+
onPointerDownCapture: ct,
|
|
1674
|
+
onMouseDownCapture: ct,
|
|
1637
1675
|
children: [
|
|
1638
|
-
|
|
1639
|
-
/* @__PURE__ */ f.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ f.jsx(
|
|
1640
|
-
/* @__PURE__ */ f.jsx("div", { ref:
|
|
1641
|
-
|
|
1676
|
+
ur && // biome-ignore lint/a11y/useSemanticElements: 仮想スクロールの treegrid は絶対配置行を使うため native table 要素にできない。ARIA ロールで意味を提供する
|
|
1677
|
+
/* @__PURE__ */ f.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ f.jsx(uo, { columns: k.columns, numericTemplate: ft, numericTotal: re.numericTotal, nameWidth: re.nameWidth, scrollBarWidth: Be, className: k.headerClassName }) }),
|
|
1678
|
+
/* @__PURE__ */ f.jsx("div", { ref: Fe, className: "dt-grid-body", children: Rn }),
|
|
1679
|
+
Ye > 0 && /* @__PURE__ */ f.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
|
|
1642
1680
|
/* @__PURE__ */ f.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: re.nameWidth }, "aria-hidden": "true" }),
|
|
1643
1681
|
/* @__PURE__ */ f.jsx(
|
|
1644
|
-
|
|
1682
|
+
Sr,
|
|
1645
1683
|
{
|
|
1646
1684
|
horizontal: !0,
|
|
1647
1685
|
contentSize: re.numericTotal,
|
|
1648
1686
|
viewportSize: re.numericVisible,
|
|
1649
|
-
scrollPosition:
|
|
1650
|
-
scrollBarWidth:
|
|
1687
|
+
scrollPosition: Xe,
|
|
1688
|
+
scrollBarWidth: Be,
|
|
1651
1689
|
locale: A,
|
|
1652
1690
|
labels: Z,
|
|
1653
|
-
onScroll: (
|
|
1654
|
-
const c = typeof
|
|
1655
|
-
return
|
|
1691
|
+
onScroll: (s) => {
|
|
1692
|
+
const c = typeof s == "function" ? s(Xe) : s, S = jt(c, Ye);
|
|
1693
|
+
return Ke(S), S;
|
|
1656
1694
|
}
|
|
1657
1695
|
}
|
|
1658
1696
|
),
|
|
1659
|
-
/* @__PURE__ */ f.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width:
|
|
1697
|
+
/* @__PURE__ */ f.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: Be }, "aria-hidden": "true" })
|
|
1660
1698
|
] }),
|
|
1661
|
-
|
|
1662
|
-
/* @__PURE__ */ f.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ f.jsx(
|
|
1699
|
+
fr && // biome-ignore lint/a11y/useSemanticElements: 同上 (フッタ行も絶対配置レイアウトの一部)
|
|
1700
|
+
/* @__PURE__ */ f.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ f.jsx(fo, { columns: k.columns, numericTemplate: ft, numericTotal: re.numericTotal, nameWidth: re.nameWidth, scrollBarWidth: Be, allEntries: dr, className: k.footerClassName }) })
|
|
1663
1701
|
]
|
|
1664
1702
|
}
|
|
1665
1703
|
);
|
|
1666
|
-
},
|
|
1667
|
-
const [n, r] =
|
|
1704
|
+
}, qo = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
|
|
1705
|
+
const [n, r] = gr(), [a, i] = fe(() => {
|
|
1668
1706
|
if (typeof window < "u" && t)
|
|
1669
1707
|
try {
|
|
1670
|
-
const
|
|
1671
|
-
if (
|
|
1672
|
-
const
|
|
1673
|
-
return new Set(
|
|
1708
|
+
const p = window.localStorage.getItem(t);
|
|
1709
|
+
if (p) {
|
|
1710
|
+
const w = JSON.parse(p);
|
|
1711
|
+
return new Set(w);
|
|
1674
1712
|
}
|
|
1675
|
-
} catch (
|
|
1676
|
-
console.error("[useDirectoryTreeState] Error reading from localStorage",
|
|
1713
|
+
} catch (p) {
|
|
1714
|
+
console.error("[useDirectoryTreeState] Error reading from localStorage", p);
|
|
1677
1715
|
}
|
|
1678
1716
|
return e;
|
|
1679
|
-
}), l = _((
|
|
1717
|
+
}), l = _((p) => {
|
|
1680
1718
|
r(() => {
|
|
1681
|
-
i((
|
|
1682
|
-
const v = new Set(
|
|
1683
|
-
return
|
|
1719
|
+
i((w) => {
|
|
1720
|
+
const v = new Set(w);
|
|
1721
|
+
return p(v), v;
|
|
1684
1722
|
});
|
|
1685
1723
|
});
|
|
1686
1724
|
}, []), d = _(
|
|
1687
|
-
(
|
|
1725
|
+
(p, w) => {
|
|
1688
1726
|
l((v) => {
|
|
1689
|
-
for (const
|
|
1690
|
-
|
|
1727
|
+
for (const F of p)
|
|
1728
|
+
w(v, F);
|
|
1691
1729
|
});
|
|
1692
1730
|
},
|
|
1693
1731
|
[l]
|
|
1694
1732
|
);
|
|
1695
|
-
|
|
1733
|
+
De(() => {
|
|
1696
1734
|
if (t && typeof window < "u")
|
|
1697
1735
|
try {
|
|
1698
|
-
window.localStorage.setItem(t, JSON.stringify(Array.from(
|
|
1699
|
-
} catch (
|
|
1700
|
-
console.warn(`Error setting localStorage key "${t}":`,
|
|
1736
|
+
window.localStorage.setItem(t, JSON.stringify(Array.from(a)));
|
|
1737
|
+
} catch (p) {
|
|
1738
|
+
console.warn(`Error setting localStorage key "${t}":`, p);
|
|
1701
1739
|
}
|
|
1702
|
-
}, [
|
|
1703
|
-
const
|
|
1704
|
-
(
|
|
1705
|
-
d([
|
|
1706
|
-
|
|
1740
|
+
}, [a, t]);
|
|
1741
|
+
const h = _(
|
|
1742
|
+
(p) => {
|
|
1743
|
+
d([p], (w, v) => {
|
|
1744
|
+
w.has(v) ? w.delete(v) : w.add(v);
|
|
1707
1745
|
});
|
|
1708
1746
|
},
|
|
1709
1747
|
[d]
|
|
1710
|
-
),
|
|
1711
|
-
(
|
|
1712
|
-
d([
|
|
1713
|
-
|
|
1748
|
+
), b = _(
|
|
1749
|
+
(p) => {
|
|
1750
|
+
d([p], (w, v) => {
|
|
1751
|
+
w.add(v);
|
|
1714
1752
|
});
|
|
1715
1753
|
},
|
|
1716
1754
|
[d]
|
|
1717
|
-
),
|
|
1718
|
-
(
|
|
1719
|
-
d([
|
|
1720
|
-
|
|
1755
|
+
), N = _(
|
|
1756
|
+
(p) => {
|
|
1757
|
+
d([p], (w, v) => {
|
|
1758
|
+
w.delete(v);
|
|
1721
1759
|
});
|
|
1722
1760
|
},
|
|
1723
1761
|
[d]
|
|
1724
|
-
),
|
|
1725
|
-
(
|
|
1726
|
-
d(
|
|
1727
|
-
|
|
1762
|
+
), x = _(
|
|
1763
|
+
(p) => {
|
|
1764
|
+
d(p, (w, v) => {
|
|
1765
|
+
w.delete(v);
|
|
1728
1766
|
});
|
|
1729
1767
|
},
|
|
1730
1768
|
[d]
|
|
1731
|
-
),
|
|
1732
|
-
(
|
|
1733
|
-
d(
|
|
1734
|
-
|
|
1769
|
+
), T = _(
|
|
1770
|
+
(p) => {
|
|
1771
|
+
d(p, (w, v) => {
|
|
1772
|
+
w.add(v);
|
|
1735
1773
|
});
|
|
1736
1774
|
},
|
|
1737
1775
|
[d]
|
|
1738
|
-
),
|
|
1739
|
-
l((
|
|
1740
|
-
|
|
1776
|
+
), m = _(() => {
|
|
1777
|
+
l((p) => {
|
|
1778
|
+
p.clear();
|
|
1741
1779
|
});
|
|
1742
|
-
}, [l]),
|
|
1780
|
+
}, [l]), y = _((p) => a.has(p), [a]);
|
|
1743
1781
|
return {
|
|
1744
|
-
expanded:
|
|
1745
|
-
toggle:
|
|
1746
|
-
expand:
|
|
1747
|
-
collapse:
|
|
1748
|
-
collapseMultiple:
|
|
1749
|
-
expandMultiple:
|
|
1750
|
-
collapseAll:
|
|
1751
|
-
isExpanded:
|
|
1782
|
+
expanded: a,
|
|
1783
|
+
toggle: h,
|
|
1784
|
+
expand: b,
|
|
1785
|
+
collapse: N,
|
|
1786
|
+
collapseMultiple: x,
|
|
1787
|
+
expandMultiple: T,
|
|
1788
|
+
collapseAll: m,
|
|
1789
|
+
isExpanded: y,
|
|
1752
1790
|
isPending: n
|
|
1753
1791
|
};
|
|
1754
1792
|
};
|
|
1755
1793
|
export {
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1794
|
+
go as DIRECTORY_TREE_LABEL_CATALOGS,
|
|
1795
|
+
An as DIRECTORY_TREE_LABEL_KEYS,
|
|
1796
|
+
Zo as DirectoryTree,
|
|
1797
|
+
oo as EXPAND_ICON_STYLE_PROPERTIES,
|
|
1798
|
+
Jo as FILE_ICON_PAIRS,
|
|
1799
|
+
Br as MARK_PAIRS,
|
|
1800
|
+
ro as ROW_STYLE_PROPERTIES,
|
|
1801
|
+
L as directoryTreeClasses,
|
|
1802
|
+
vo as resolveDirectoryTreeLabels,
|
|
1803
|
+
qo as useDirectoryTreeState
|
|
1764
1804
|
};
|