@aiquants/directory-tree 3.6.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DirectoryTree.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +881 -800
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/DirectoryTree.spec.md +4 -1
- package/src/DirectoryTree.tsx +154 -9
- package/src/types.ts +8 -0
package/dist/index.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { VirtualScroll as
|
|
1
|
+
import xr, { useRef as ne, useEffect as me, useCallback as F, memo as ot, useState as ce, useMemo as Z, useLayoutEffect as br, Fragment as vr, useTransition as gr } from "react";
|
|
2
|
+
import { VirtualScroll as wr, ScrollBar as kr } from "@aiquants/virtualscroll";
|
|
3
3
|
import { twMerge as _ } from "tailwind-merge";
|
|
4
|
-
import { FolderIcon as
|
|
5
|
-
import { FileMd as
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
if (
|
|
10
|
-
|
|
4
|
+
import { FolderIcon as Sr, ChevronDownIcon as Ir, ChevronRightIcon as Er } from "@heroicons/react/24/solid";
|
|
5
|
+
import { FileMd as Mt, FilePdf as Dt, FileXls as Ot, FileCsv as Ft, FileDoc as Lt, FilePpt as $t, FileImage as Ht, FileAudio as Wt, FileVideo as Bt, FileZip as zt, FileCode as Yt, FileText as Gt, FileIcon as Nr } from "@phosphor-icons/react";
|
|
6
|
+
var ze = { exports: {} }, Ce = {};
|
|
7
|
+
var Vt;
|
|
8
|
+
function jr() {
|
|
9
|
+
if (Vt) return Ce;
|
|
10
|
+
Vt = 1;
|
|
11
11
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
12
|
-
function a(n, r,
|
|
13
|
-
var
|
|
14
|
-
if (
|
|
15
|
-
|
|
12
|
+
function a(n, r, l) {
|
|
13
|
+
var c = null;
|
|
14
|
+
if (l !== void 0 && (c = "" + l), r.key !== void 0 && (c = "" + r.key), "key" in r) {
|
|
15
|
+
l = {};
|
|
16
16
|
for (var u in r)
|
|
17
|
-
u !== "key" && (
|
|
18
|
-
} else
|
|
19
|
-
return r =
|
|
17
|
+
u !== "key" && (l[u] = r[u]);
|
|
18
|
+
} else l = r;
|
|
19
|
+
return r = l.ref, {
|
|
20
20
|
$$typeof: e,
|
|
21
21
|
type: n,
|
|
22
|
-
key:
|
|
22
|
+
key: c,
|
|
23
23
|
ref: r !== void 0 ? r : null,
|
|
24
|
-
props:
|
|
24
|
+
props: l
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return Ce.Fragment = t, Ce.jsx = a, Ce.jsxs = a, Ce;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
return
|
|
29
|
+
var _e = {};
|
|
30
|
+
var Ut;
|
|
31
|
+
function Rr() {
|
|
32
|
+
return Ut || (Ut = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
33
33
|
function e(s) {
|
|
34
34
|
if (s == null) return null;
|
|
35
35
|
if (typeof s == "function")
|
|
36
|
-
return s.$$typeof ===
|
|
36
|
+
return s.$$typeof === $ ? null : s.displayName || s.name || null;
|
|
37
37
|
if (typeof s == "string") return s;
|
|
38
38
|
switch (s) {
|
|
39
|
-
case
|
|
39
|
+
case y:
|
|
40
40
|
return "Fragment";
|
|
41
|
-
case
|
|
41
|
+
case R:
|
|
42
42
|
return "Profiler";
|
|
43
43
|
case k:
|
|
44
44
|
return "StrictMode";
|
|
45
|
-
case
|
|
45
|
+
case L:
|
|
46
46
|
return "Suspense";
|
|
47
|
-
case
|
|
47
|
+
case P:
|
|
48
48
|
return "SuspenseList";
|
|
49
|
-
case
|
|
49
|
+
case Q:
|
|
50
50
|
return "Activity";
|
|
51
51
|
}
|
|
52
52
|
if (typeof s == "object")
|
|
53
53
|
switch (typeof s.tag == "number" && console.error(
|
|
54
54
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
55
55
|
), s.$$typeof) {
|
|
56
|
-
case
|
|
56
|
+
case f:
|
|
57
57
|
return "Portal";
|
|
58
|
-
case
|
|
58
|
+
case S:
|
|
59
59
|
return s.displayName || "Context";
|
|
60
60
|
case N:
|
|
61
61
|
return (s._context.displayName || "Context") + ".Consumer";
|
|
62
|
-
case
|
|
63
|
-
var
|
|
64
|
-
return s = s.displayName, s || (s =
|
|
65
|
-
case
|
|
66
|
-
return
|
|
67
|
-
case
|
|
68
|
-
|
|
62
|
+
case p:
|
|
63
|
+
var m = s.render;
|
|
64
|
+
return s = s.displayName, s || (s = m.displayName || m.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
|
|
65
|
+
case O:
|
|
66
|
+
return m = s.displayName || null, m !== null ? m : e(s.type) || "Memo";
|
|
67
|
+
case K:
|
|
68
|
+
m = s._payload, s = s._init;
|
|
69
69
|
try {
|
|
70
|
-
return e(s(
|
|
70
|
+
return e(s(m));
|
|
71
71
|
} catch {
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -79,74 +79,74 @@ function xr() {
|
|
|
79
79
|
function a(s) {
|
|
80
80
|
try {
|
|
81
81
|
t(s);
|
|
82
|
-
var
|
|
82
|
+
var m = !1;
|
|
83
83
|
} catch {
|
|
84
|
-
|
|
84
|
+
m = !0;
|
|
85
85
|
}
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
var
|
|
89
|
-
return
|
|
90
|
-
|
|
86
|
+
if (m) {
|
|
87
|
+
m = console;
|
|
88
|
+
var T = m.error, A = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
|
|
89
|
+
return T.call(
|
|
90
|
+
m,
|
|
91
91
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
92
|
-
|
|
92
|
+
A
|
|
93
93
|
), t(s);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
function n(s) {
|
|
97
|
-
if (s ===
|
|
98
|
-
if (typeof s == "object" && s !== null && s.$$typeof ===
|
|
97
|
+
if (s === y) return "<>";
|
|
98
|
+
if (typeof s == "object" && s !== null && s.$$typeof === K)
|
|
99
99
|
return "<...>";
|
|
100
100
|
try {
|
|
101
|
-
var
|
|
102
|
-
return
|
|
101
|
+
var m = e(s);
|
|
102
|
+
return m ? "<" + m + ">" : "<...>";
|
|
103
103
|
} catch {
|
|
104
104
|
return "<...>";
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
function r() {
|
|
108
|
-
var s =
|
|
108
|
+
var s = J.A;
|
|
109
109
|
return s === null ? null : s.getOwner();
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function l() {
|
|
112
112
|
return Error("react-stack-top-frame");
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
if (
|
|
116
|
-
var
|
|
117
|
-
if (
|
|
114
|
+
function c(s) {
|
|
115
|
+
if (ee.call(s, "key")) {
|
|
116
|
+
var m = Object.getOwnPropertyDescriptor(s, "key").get;
|
|
117
|
+
if (m && m.isReactWarning) return !1;
|
|
118
118
|
}
|
|
119
119
|
return s.key !== void 0;
|
|
120
120
|
}
|
|
121
|
-
function u(s,
|
|
122
|
-
function
|
|
121
|
+
function u(s, m) {
|
|
122
|
+
function T() {
|
|
123
123
|
B || (B = !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
|
+
m
|
|
126
126
|
));
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
get:
|
|
128
|
+
T.isReactWarning = !0, Object.defineProperty(s, "key", {
|
|
129
|
+
get: T,
|
|
130
130
|
configurable: !0
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function j() {
|
|
134
134
|
var s = e(this.type);
|
|
135
|
-
return
|
|
135
|
+
return G[s] || (G[s] = !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
|
)), s = this.props.ref, s !== void 0 ? s : null;
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
var
|
|
139
|
+
function v(s, m, T, A, se, le) {
|
|
140
|
+
var b = T.ref;
|
|
141
141
|
return s = {
|
|
142
|
-
$$typeof:
|
|
142
|
+
$$typeof: E,
|
|
143
143
|
type: s,
|
|
144
|
-
key:
|
|
145
|
-
props:
|
|
146
|
-
_owner:
|
|
147
|
-
}, (
|
|
144
|
+
key: m,
|
|
145
|
+
props: T,
|
|
146
|
+
_owner: A
|
|
147
|
+
}, (b !== void 0 ? b : null) !== null ? Object.defineProperty(s, "ref", {
|
|
148
148
|
enumerable: !1,
|
|
149
|
-
get:
|
|
149
|
+
get: j
|
|
150
150
|
}) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
151
151
|
configurable: !1,
|
|
152
152
|
enumerable: !1,
|
|
@@ -161,109 +161,109 @@ function xr() {
|
|
|
161
161
|
configurable: !1,
|
|
162
162
|
enumerable: !1,
|
|
163
163
|
writable: !0,
|
|
164
|
-
value:
|
|
164
|
+
value: se
|
|
165
165
|
}), Object.defineProperty(s, "_debugTask", {
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
168
168
|
writable: !0,
|
|
169
|
-
value:
|
|
169
|
+
value: le
|
|
170
170
|
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
171
171
|
}
|
|
172
|
-
function d(s,
|
|
173
|
-
var
|
|
174
|
-
if (
|
|
175
|
-
if (
|
|
176
|
-
if (
|
|
177
|
-
for (
|
|
178
|
-
|
|
179
|
-
Object.freeze && Object.freeze(
|
|
172
|
+
function d(s, m, T, A, se, le) {
|
|
173
|
+
var b = m.children;
|
|
174
|
+
if (b !== void 0)
|
|
175
|
+
if (A)
|
|
176
|
+
if (I(b)) {
|
|
177
|
+
for (A = 0; A < b.length; A++)
|
|
178
|
+
h(b[A]);
|
|
179
|
+
Object.freeze && Object.freeze(b);
|
|
180
180
|
} else
|
|
181
181
|
console.error(
|
|
182
182
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
183
183
|
);
|
|
184
|
-
else
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
var
|
|
188
|
-
return
|
|
184
|
+
else h(b);
|
|
185
|
+
if (ee.call(m, "key")) {
|
|
186
|
+
b = e(s);
|
|
187
|
+
var z = Object.keys(m).filter(function(V) {
|
|
188
|
+
return V !== "key";
|
|
189
189
|
});
|
|
190
|
-
|
|
190
|
+
A = 0 < z.length ? "{key: someKey, " + z.join(": ..., ") + ": ...}" : "{key: someKey}", C[b + A] || (z = 0 < z.length ? "{" + z.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
191
191
|
`A props object containing a "key" prop is being spread into JSX:
|
|
192
192
|
let props = %s;
|
|
193
193
|
<%s {...props} />
|
|
194
194
|
React keys must be passed directly to JSX without using spread:
|
|
195
195
|
let props = %s;
|
|
196
196
|
<%s key={someKey} {...props} />`,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
),
|
|
197
|
+
A,
|
|
198
|
+
b,
|
|
199
|
+
z,
|
|
200
|
+
b
|
|
201
|
+
), C[b + A] = !0);
|
|
202
202
|
}
|
|
203
|
-
if (
|
|
204
|
-
|
|
205
|
-
for (var
|
|
206
|
-
|
|
207
|
-
} else
|
|
208
|
-
return
|
|
209
|
-
|
|
203
|
+
if (b = null, T !== void 0 && (a(T), b = "" + T), c(m) && (a(m.key), b = "" + m.key), "key" in m) {
|
|
204
|
+
T = {};
|
|
205
|
+
for (var H in m)
|
|
206
|
+
H !== "key" && (T[H] = m[H]);
|
|
207
|
+
} else T = m;
|
|
208
|
+
return b && u(
|
|
209
|
+
T,
|
|
210
210
|
typeof s == "function" ? s.displayName || s.name || "Unknown" : s
|
|
211
|
-
),
|
|
211
|
+
), v(
|
|
212
212
|
s,
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
b,
|
|
214
|
+
T,
|
|
215
215
|
r(),
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
se,
|
|
217
|
+
le
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
g(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof ===
|
|
220
|
+
function h(s) {
|
|
221
|
+
g(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === K && (s._payload.status === "fulfilled" ? g(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
|
|
222
222
|
}
|
|
223
223
|
function g(s) {
|
|
224
|
-
return typeof s == "object" && s !== null && s.$$typeof ===
|
|
224
|
+
return typeof s == "object" && s !== null && s.$$typeof === E;
|
|
225
225
|
}
|
|
226
|
-
var
|
|
226
|
+
var w = xr, E = /* @__PURE__ */ Symbol.for("react.transitional.element"), f = /* @__PURE__ */ Symbol.for("react.portal"), y = /* @__PURE__ */ Symbol.for("react.fragment"), k = /* @__PURE__ */ Symbol.for("react.strict_mode"), R = /* @__PURE__ */ Symbol.for("react.profiler"), N = /* @__PURE__ */ Symbol.for("react.consumer"), S = /* @__PURE__ */ Symbol.for("react.context"), p = /* @__PURE__ */ Symbol.for("react.forward_ref"), L = /* @__PURE__ */ Symbol.for("react.suspense"), P = /* @__PURE__ */ Symbol.for("react.suspense_list"), O = /* @__PURE__ */ Symbol.for("react.memo"), K = /* @__PURE__ */ Symbol.for("react.lazy"), Q = /* @__PURE__ */ Symbol.for("react.activity"), $ = /* @__PURE__ */ Symbol.for("react.client.reference"), J = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, I = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
227
227
|
return null;
|
|
228
228
|
};
|
|
229
|
-
|
|
229
|
+
w = {
|
|
230
230
|
react_stack_bottom_frame: function(s) {
|
|
231
231
|
return s();
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
var B,
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
)(),
|
|
238
|
-
|
|
239
|
-
var
|
|
234
|
+
var B, G = {}, de = w.react_stack_bottom_frame.bind(
|
|
235
|
+
w,
|
|
236
|
+
l
|
|
237
|
+
)(), ue = Y(n(l)), C = {};
|
|
238
|
+
_e.Fragment = y, _e.jsx = function(s, m, T) {
|
|
239
|
+
var A = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
240
240
|
return d(
|
|
241
241
|
s,
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
m,
|
|
243
|
+
T,
|
|
244
244
|
!1,
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
A ? Error("react-stack-top-frame") : de,
|
|
246
|
+
A ? Y(n(s)) : ue
|
|
247
247
|
);
|
|
248
|
-
},
|
|
249
|
-
var
|
|
248
|
+
}, _e.jsxs = function(s, m, T) {
|
|
249
|
+
var A = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
250
250
|
return d(
|
|
251
251
|
s,
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
m,
|
|
253
|
+
T,
|
|
254
254
|
!0,
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
A ? Error("react-stack-top-frame") : de,
|
|
256
|
+
A ? Y(n(s)) : ue
|
|
257
257
|
);
|
|
258
258
|
};
|
|
259
|
-
})()),
|
|
259
|
+
})()), _e;
|
|
260
260
|
}
|
|
261
|
-
var
|
|
262
|
-
function
|
|
263
|
-
return
|
|
261
|
+
var Xt;
|
|
262
|
+
function Tr() {
|
|
263
|
+
return Xt || (Xt = 1, process.env.NODE_ENV === "production" ? ze.exports = jr() : ze.exports = Rr()), ze.exports;
|
|
264
264
|
}
|
|
265
|
-
var i =
|
|
266
|
-
const
|
|
265
|
+
var i = Tr();
|
|
266
|
+
const Ye = 18, Ge = 12, Jt = 10, D = {
|
|
267
267
|
container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[3px] pr-[2px]",
|
|
268
268
|
containerPending: "opacity-70",
|
|
269
269
|
entry: "directory-tree-entry flex items-center cursor-pointer relative select-none text-xs leading-tight py-0.5",
|
|
@@ -282,14 +282,14 @@ const Le = 18, $e = 12, Lt = 10, O = {
|
|
|
282
282
|
name: _("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 text-xs font-normal", "text-gray-700", "dark:text-gray-200"),
|
|
283
283
|
nameDirectory: "directory-tree-name--directory font-medium",
|
|
284
284
|
nameSelected: _("directory-tree-name--selected text-blue-800 font-semibold", "dark:text-blue-300")
|
|
285
|
-
},
|
|
285
|
+
}, Ee = (e) => {
|
|
286
286
|
if (!e) return "";
|
|
287
287
|
const t = e.split("?")[0].split("#")[0].split("/").pop() || e, a = t.lastIndexOf(".");
|
|
288
288
|
return a <= 0 ? "" : t.slice(a + 1).toLowerCase();
|
|
289
|
-
},
|
|
290
|
-
const
|
|
291
|
-
return !(a && e) || n ? /* @__PURE__ */ i.jsx("span", { className:
|
|
292
|
-
},
|
|
289
|
+
}, Qt = ({ isDirectory: e, isExpanded: t, showExpandIcons: a, useCanvasExpandIcons: n, expandIconSize: r }) => {
|
|
290
|
+
const l = r ? { width: r, height: r } : void 0, c = r ? "" : "h-4 w-4";
|
|
291
|
+
return !(a && e) || n ? /* @__PURE__ */ i.jsx("span", { className: c, style: l, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(Ir, { className: c, style: l }) : /* @__PURE__ */ i.jsx(Er, { className: c, style: l });
|
|
292
|
+
}, st = (e, t) => {
|
|
293
293
|
if (e == null || typeof e == "boolean") return null;
|
|
294
294
|
if (typeof e == "function")
|
|
295
295
|
return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`), null;
|
|
@@ -297,7 +297,7 @@ const Le = 18, $e = 12, Lt = 10, O = {
|
|
|
297
297
|
if ("then" in e)
|
|
298
298
|
return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`), null;
|
|
299
299
|
if (Array.isArray(e)) {
|
|
300
|
-
const n = e.map((r) =>
|
|
300
|
+
const n = e.map((r) => st(r, t)).filter(Boolean);
|
|
301
301
|
return n.length ? n : null;
|
|
302
302
|
}
|
|
303
303
|
const a = e.type;
|
|
@@ -305,559 +305,570 @@ const Le = 18, $e = 12, Lt = 10, O = {
|
|
|
305
305
|
return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`), null;
|
|
306
306
|
}
|
|
307
307
|
return e;
|
|
308
|
-
},
|
|
309
|
-
const n = (t || (a ?
|
|
308
|
+
}, Pr = (e, t, a) => {
|
|
309
|
+
const n = (t || (a ? Ee(a) : "")).toLowerCase(), r = (e || "").toLowerCase();
|
|
310
310
|
if (r && r !== "application/octet-stream") {
|
|
311
311
|
if (r === "text/markdown" || r === "text/x-markdown")
|
|
312
|
-
return /* @__PURE__ */ i.jsx(
|
|
312
|
+
return /* @__PURE__ */ i.jsx(Mt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
|
|
313
313
|
if (r === "application/pdf")
|
|
314
|
-
return /* @__PURE__ */ i.jsx(
|
|
314
|
+
return /* @__PURE__ */ i.jsx(Dt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
|
|
315
315
|
if (r.includes("excel") || r.includes("spreadsheet") || r.includes("google-apps.spreadsheet"))
|
|
316
|
-
return /* @__PURE__ */ i.jsx(
|
|
316
|
+
return /* @__PURE__ */ i.jsx(Ot, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
|
|
317
317
|
if (r === "text/csv" || r === "text/tab-separated-values")
|
|
318
|
-
return /* @__PURE__ */ i.jsx(
|
|
318
|
+
return /* @__PURE__ */ i.jsx(Ft, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
|
|
319
319
|
if (r.includes("word") || r.includes("msword") || r.includes("wordprocessingml") || r.includes("google-apps.document") || r === "application/rtf")
|
|
320
|
-
return /* @__PURE__ */ i.jsx(
|
|
320
|
+
return /* @__PURE__ */ i.jsx(Lt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
|
|
321
321
|
if (r.includes("powerpoint") || r.includes("presentation") || r.includes("google-apps.presentation"))
|
|
322
|
-
return /* @__PURE__ */ i.jsx(
|
|
322
|
+
return /* @__PURE__ */ i.jsx($t, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
|
|
323
323
|
if (r.startsWith("image/"))
|
|
324
|
-
return /* @__PURE__ */ i.jsx(
|
|
324
|
+
return /* @__PURE__ */ i.jsx(Ht, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
|
|
325
325
|
if (r.startsWith("audio/"))
|
|
326
|
-
return /* @__PURE__ */ i.jsx(
|
|
326
|
+
return /* @__PURE__ */ i.jsx(Wt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
|
|
327
327
|
if (r.startsWith("video/"))
|
|
328
|
-
return /* @__PURE__ */ i.jsx(
|
|
328
|
+
return /* @__PURE__ */ i.jsx(Bt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
|
|
329
329
|
if (r.includes("zip") || r.includes("tar") || r.includes("compressed") || r.includes("archive"))
|
|
330
|
-
return /* @__PURE__ */ i.jsx(
|
|
330
|
+
return /* @__PURE__ */ i.jsx(zt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
|
|
331
331
|
if (r === "application/json" || r.includes("javascript") || r.includes("typescript") || r.includes("xml") || r.startsWith("text/html") || r.startsWith("text/css") || r.includes("x-python") || r.includes("x-sh") || r.includes("x-go") || r.includes("x-rust"))
|
|
332
|
-
return /* @__PURE__ */ i.jsx(
|
|
332
|
+
return /* @__PURE__ */ i.jsx(Yt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
|
|
333
333
|
if (r.startsWith("text/"))
|
|
334
|
-
return /* @__PURE__ */ i.jsx(
|
|
334
|
+
return /* @__PURE__ */ i.jsx(Gt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
|
|
335
335
|
}
|
|
336
336
|
if (n) {
|
|
337
337
|
if (n === "md" || n === "markdown" || n === "mdx")
|
|
338
|
-
return /* @__PURE__ */ i.jsx(
|
|
338
|
+
return /* @__PURE__ */ i.jsx(Mt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
|
|
339
339
|
if (n === "pdf")
|
|
340
|
-
return /* @__PURE__ */ i.jsx(
|
|
340
|
+
return /* @__PURE__ */ i.jsx(Dt, { className: "h-4 w-4 text-red-500 dark:text-red-400" });
|
|
341
341
|
if (["xls", "xlsx", "xlsm", "xlsb", "ods"].includes(n))
|
|
342
|
-
return /* @__PURE__ */ i.jsx(
|
|
342
|
+
return /* @__PURE__ */ i.jsx(Ot, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
|
|
343
343
|
if (["csv", "tsv"].includes(n))
|
|
344
|
-
return /* @__PURE__ */ i.jsx(
|
|
344
|
+
return /* @__PURE__ */ i.jsx(Ft, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" });
|
|
345
345
|
if (["doc", "docx", "rtf", "odt"].includes(n))
|
|
346
|
-
return /* @__PURE__ */ i.jsx(
|
|
346
|
+
return /* @__PURE__ */ i.jsx(Lt, { className: "h-4 w-4 text-blue-600 dark:text-blue-400" });
|
|
347
347
|
if (["ppt", "pptx", "odp"].includes(n))
|
|
348
|
-
return /* @__PURE__ */ i.jsx(
|
|
348
|
+
return /* @__PURE__ */ i.jsx($t, { className: "h-4 w-4 text-orange-500 dark:text-orange-400" });
|
|
349
349
|
if (["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "bmp", "tiff", "avif"].includes(n))
|
|
350
|
-
return /* @__PURE__ */ i.jsx(
|
|
350
|
+
return /* @__PURE__ */ i.jsx(Ht, { className: "h-4 w-4 text-teal-500 dark:text-teal-400" });
|
|
351
351
|
if (["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"].includes(n))
|
|
352
|
-
return /* @__PURE__ */ i.jsx(
|
|
352
|
+
return /* @__PURE__ */ i.jsx(Yt, { className: "h-4 w-4 text-purple-500 dark:text-purple-400" });
|
|
353
353
|
if (["mp3", "wav", "ogg", "m4a", "flac", "aac", "wma"].includes(n))
|
|
354
|
-
return /* @__PURE__ */ i.jsx(
|
|
354
|
+
return /* @__PURE__ */ i.jsx(Wt, { className: "h-4 w-4 text-pink-500 dark:text-pink-400" });
|
|
355
355
|
if (["mp4", "webm", "mov", "avi", "mkv", "wmv", "flv"].includes(n))
|
|
356
|
-
return /* @__PURE__ */ i.jsx(
|
|
356
|
+
return /* @__PURE__ */ i.jsx(Bt, { className: "h-4 w-4 text-violet-500 dark:text-violet-400" });
|
|
357
357
|
if (["zip", "tar", "gz", "7z", "rar", "tgz", "bz2"].includes(n))
|
|
358
|
-
return /* @__PURE__ */ i.jsx(
|
|
358
|
+
return /* @__PURE__ */ i.jsx(zt, { className: "h-4 w-4 text-amber-500 dark:text-amber-400" });
|
|
359
359
|
if (["txt", "log"].includes(n))
|
|
360
|
-
return /* @__PURE__ */ i.jsx(
|
|
360
|
+
return /* @__PURE__ */ i.jsx(Gt, { className: "h-4 w-4 text-gray-500 dark:text-gray-400" });
|
|
361
361
|
}
|
|
362
|
-
return /* @__PURE__ */ i.jsx(
|
|
363
|
-
},
|
|
364
|
-
const { entry: a, isDirectory: n, isExpanded: r, extension:
|
|
362
|
+
return /* @__PURE__ */ i.jsx(Nr, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
|
|
363
|
+
}, er = (e, t) => {
|
|
364
|
+
const { entry: a, isDirectory: n, isExpanded: r, extension: l, mimeType: c } = e;
|
|
365
365
|
let u;
|
|
366
|
-
const
|
|
367
|
-
return a.icon !== void 0 ? u = a.icon : n ? u = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(
|
|
368
|
-
},
|
|
366
|
+
const j = c || a.mimeType;
|
|
367
|
+
return a.icon !== void 0 ? u = a.icon : n ? u = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(Sr, { className: "h-4 w-4" }) : l && t?.fileByExtension?.[l] ? u = t.fileByExtension[l] : u = t?.file || Pr(j, l, a.name), st(typeof u == "function" ? u(e) : u, a.absolutePath);
|
|
368
|
+
}, Cr = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), tr = (e) => {
|
|
369
369
|
if (!e)
|
|
370
370
|
return;
|
|
371
371
|
const t = Object.entries(e).filter(([, a]) => a != null);
|
|
372
372
|
if (t.length !== 0)
|
|
373
|
-
return Object.fromEntries(t.map(([a, n]) => [`data-${
|
|
374
|
-
},
|
|
375
|
-
const
|
|
373
|
+
return Object.fromEntries(t.map(([a, n]) => [`data-${Cr(a)}`, String(n)]));
|
|
374
|
+
}, _r = 500, rr = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: n, selectionMode: r, onSelectionChange: l, onEntryClick: c, toggleDirectory: u, onToggleDirectoryRecursive: j }) => {
|
|
375
|
+
const v = ne(null);
|
|
376
376
|
return me(
|
|
377
377
|
() => () => {
|
|
378
|
-
|
|
378
|
+
v.current && window.clearTimeout(v.current);
|
|
379
379
|
},
|
|
380
380
|
[]
|
|
381
|
-
),
|
|
381
|
+
), F(
|
|
382
382
|
(d) => {
|
|
383
|
-
d.stopPropagation(), r !== "none" && !t &&
|
|
384
|
-
let
|
|
385
|
-
|
|
383
|
+
d.stopPropagation(), r !== "none" && !t && l && l(e, !n);
|
|
384
|
+
let h = !1;
|
|
385
|
+
c({
|
|
386
386
|
entry: e,
|
|
387
387
|
isDirectory: t,
|
|
388
388
|
isExpanded: a,
|
|
389
389
|
preventDefault: () => {
|
|
390
|
-
|
|
390
|
+
h = !0;
|
|
391
391
|
}
|
|
392
|
-
}), !(!t ||
|
|
393
|
-
u(e.absolutePath),
|
|
394
|
-
},
|
|
392
|
+
}), !(!t || h) && (v.current ? (window.clearTimeout(v.current), v.current = null, j(e)) : v.current = window.setTimeout(() => {
|
|
393
|
+
u(e.absolutePath), v.current = null;
|
|
394
|
+
}, _r));
|
|
395
395
|
},
|
|
396
|
-
[t, e, a,
|
|
396
|
+
[t, e, a, j, u, c, r, l, n]
|
|
397
397
|
);
|
|
398
|
-
},
|
|
398
|
+
}, nr = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", qt = (e, t) => e.children !== void 0 && t(e.absolutePath), sr = (e, t) => ({
|
|
399
399
|
width: e,
|
|
400
400
|
gridTemplateColumns: t
|
|
401
|
-
}),
|
|
401
|
+
}), ar = ot(
|
|
402
402
|
({
|
|
403
403
|
entry: e,
|
|
404
404
|
indentLevel: t,
|
|
405
405
|
positionInSet: a,
|
|
406
406
|
setSize: n,
|
|
407
407
|
rowIndex: r,
|
|
408
|
-
isSelectedForAria:
|
|
409
|
-
rowHeight:
|
|
408
|
+
isSelectedForAria: l,
|
|
409
|
+
rowHeight: c,
|
|
410
410
|
isDirOpen: u,
|
|
411
|
-
columns:
|
|
412
|
-
numericTemplate:
|
|
411
|
+
columns: j,
|
|
412
|
+
numericTemplate: v,
|
|
413
413
|
numericTotal: d,
|
|
414
|
-
nameWidth:
|
|
414
|
+
nameWidth: h,
|
|
415
415
|
rowClassName: g,
|
|
416
|
-
selection: { onEntryClick:
|
|
417
|
-
expansion: { toggleDirectory:
|
|
418
|
-
visual: { iconOverrides:
|
|
416
|
+
selection: { onEntryClick: w, selectedPath: E, mode: f = "none", selectedItems: y, onSelectionChange: k },
|
|
417
|
+
expansion: { toggleDirectory: R, onToggleDirectoryRecursive: N },
|
|
418
|
+
visual: { iconOverrides: S, showExpandIcons: p = !0, showDirectoryIcons: L = !0, showFileIcons: P = !0, useCanvasExpandIcons: O = !1, expandIconSize: K, indentSize: Q = Ge, highlightStyles: $ }
|
|
419
419
|
}) => {
|
|
420
|
-
const [
|
|
421
|
-
if (
|
|
422
|
-
if (B) return
|
|
423
|
-
} else if (B ||
|
|
424
|
-
return
|
|
420
|
+
const [J, ee] = ce(!1), I = e.children !== void 0, Y = I && u(e.absolutePath), B = e.absolutePath === E, G = !I && !!y?.has(e.absolutePath), de = I ? void 0 : Ee(e.name) || Ee(e.relativePath) || Ee(e.absolutePath), ue = rr({ entry: e, isDirectory: I, isExpanded: Y, isItemSelected: G, selectionMode: f, onSelectionChange: k, onEntryClick: w, toggleDirectory: R, onToggleDirectoryRecursive: N }), C = J ? $?.hoverClassName !== void 0 ? $.hoverClassName : D.entryHover : "", s = (() => {
|
|
421
|
+
if (I) {
|
|
422
|
+
if (B) return $?.directorySelectedClassName !== void 0 ? $.directorySelectedClassName : D.entrySelected;
|
|
423
|
+
} else if (B || G)
|
|
424
|
+
return $?.itemSelectedClassName !== void 0 ? $.itemSelectedClassName : _(B && D.entrySelected, G && D.entryItemSelected);
|
|
425
425
|
return "";
|
|
426
|
-
})(),
|
|
427
|
-
...
|
|
428
|
-
...
|
|
429
|
-
...!
|
|
426
|
+
})(), m = typeof g == "function" ? g(e) : g, T = _("dt-grid-row cursor-pointer select-none", C, s, m, e.className), A = _(D.expandIcon, (B || G) && D.expandIconSelected), se = _(D.typeIcon, (B || G) && D.typeIconSelected), le = _("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", I && D.nameDirectory, (B || G) && D.nameSelected), b = Qt({ isDirectory: I, isExpanded: Y, showExpandIcons: p, useCanvasExpandIcons: O, expandIconSize: K }), z = (I ? L : P) ? er({ entry: e, isDirectory: I, isExpanded: Y, isSelected: B, isItemSelected: G, extension: de, mimeType: e.mimeType }, S) : null, H = { indentLevel: t, isDirectory: I, isExpanded: Y }, [V, ...Ne] = j, ye = V?.render ? V.render(e, H) : e.label ?? e.name, ge = {
|
|
427
|
+
...J ? $?.hoverStyle : {},
|
|
428
|
+
...I && B ? $?.directorySelectedStyle : {},
|
|
429
|
+
...!I && (B || G) ? $?.itemSelectedStyle : {}
|
|
430
430
|
};
|
|
431
431
|
return /* @__PURE__ */ i.jsxs(
|
|
432
432
|
"div",
|
|
433
433
|
{
|
|
434
|
-
className:
|
|
435
|
-
style: { height:
|
|
434
|
+
className: T,
|
|
435
|
+
style: { height: c, ...ge, ...e.style },
|
|
436
436
|
role: "row",
|
|
437
|
-
"aria-expanded":
|
|
437
|
+
"aria-expanded": I ? Y : void 0,
|
|
438
438
|
"aria-level": t + 1,
|
|
439
439
|
"aria-posinset": a,
|
|
440
440
|
"aria-setsize": n,
|
|
441
441
|
"aria-rowindex": r,
|
|
442
|
-
"aria-selected":
|
|
443
|
-
...
|
|
444
|
-
"data-entry-type":
|
|
445
|
-
"data-entry-expanded":
|
|
442
|
+
"aria-selected": f === "none" ? void 0 : l,
|
|
443
|
+
...tr(e.data),
|
|
444
|
+
"data-entry-type": I ? "directory" : "file",
|
|
445
|
+
"data-entry-expanded": I ? String(Y) : void 0,
|
|
446
446
|
"data-entry-selected": B ? "true" : void 0,
|
|
447
|
-
"data-entry-item-selected":
|
|
448
|
-
onClick:
|
|
449
|
-
onMouseEnter: () =>
|
|
450
|
-
onMouseLeave: () =>
|
|
451
|
-
onKeyDown: (
|
|
447
|
+
"data-entry-item-selected": G ? "true" : void 0,
|
|
448
|
+
onClick: ue,
|
|
449
|
+
onMouseEnter: () => ee(!0),
|
|
450
|
+
onMouseLeave: () => ee(!1),
|
|
451
|
+
onKeyDown: (ae) => ae.key === "Enter" && ue(ae),
|
|
452
452
|
tabIndex: 0,
|
|
453
453
|
children: [
|
|
454
|
-
/* @__PURE__ */ i.jsxs("div", { className: _("dt-grid-name-cell",
|
|
455
|
-
(
|
|
456
|
-
(
|
|
457
|
-
/* @__PURE__ */ i.jsx("span", { className:
|
|
454
|
+
/* @__PURE__ */ i.jsxs("div", { className: _("dt-grid-name-cell", V?.className), role: "gridcell", style: { width: h, paddingLeft: Math.max(0, t * Q) }, children: [
|
|
455
|
+
(p || O) && /* @__PURE__ */ i.jsx("span", { className: A, children: b }),
|
|
456
|
+
(I ? L : P) && /* @__PURE__ */ i.jsx("span", { className: se, children: z }),
|
|
457
|
+
/* @__PURE__ */ i.jsx("span", { className: le, children: ye })
|
|
458
458
|
] }),
|
|
459
|
-
|
|
459
|
+
Ne.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: sr(d, v), children: Ne.map((ae) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", nr(ae.align), ae.className), role: "gridcell", children: ae.render ? ae.render(e, H) : null }, ae.key)) }) })
|
|
460
460
|
]
|
|
461
461
|
}
|
|
462
462
|
);
|
|
463
463
|
},
|
|
464
464
|
(e, t) => {
|
|
465
465
|
if (e.entry !== t.entry) return !1;
|
|
466
|
-
const a =
|
|
466
|
+
const a = qt(e.entry, e.isDirOpen), n = qt(t.entry, t.isDirOpen);
|
|
467
467
|
return e.indentLevel === t.indentLevel && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.rowIndex === t.rowIndex && e.isSelectedForAria === t.isSelectedForAria && e.rowHeight === t.rowHeight && a === n && e.columns === t.columns && e.numericTemplate === t.numericTemplate && e.numericTotal === t.numericTotal && e.nameWidth === t.nameWidth && e.rowClassName === t.rowClassName && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual === t.visual;
|
|
468
468
|
}
|
|
469
469
|
);
|
|
470
|
-
|
|
471
|
-
const
|
|
470
|
+
ar.displayName = "DirectoryTreeGridRow";
|
|
471
|
+
const or = ({
|
|
472
472
|
kind: e,
|
|
473
473
|
columns: t,
|
|
474
474
|
numericTemplate: a,
|
|
475
475
|
numericTotal: n,
|
|
476
476
|
nameWidth: r,
|
|
477
|
-
scrollBarWidth:
|
|
478
|
-
className:
|
|
477
|
+
scrollBarWidth: l,
|
|
478
|
+
className: c,
|
|
479
479
|
nameContent: u,
|
|
480
|
-
renderCell:
|
|
480
|
+
renderCell: j
|
|
481
481
|
}) => {
|
|
482
|
-
const [, ...
|
|
483
|
-
return /* @__PURE__ */ i.jsxs("div", { className: _(
|
|
482
|
+
const [, ...v] = t, d = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", h = e === "header" ? "dt-grid-header" : "dt-grid-footer", g = e === "header" ? "columnheader" : "gridcell";
|
|
483
|
+
return /* @__PURE__ */ i.jsxs("div", { className: _(h, "text-gray-600 dark:text-gray-300", c), role: "row", children: [
|
|
484
484
|
/* @__PURE__ */ i.jsx("div", { className: _(d, "px-1", t[0]?.className), role: g, style: { width: r }, children: u }),
|
|
485
|
-
|
|
486
|
-
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width:
|
|
485
|
+
v.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: sr(n, a), children: v.map((w) => /* @__PURE__ */ i.jsx("div", { className: _("dt-grid-cell", nr(w.align), w.className), role: g, children: j(w) }, w.key)) }) }),
|
|
486
|
+
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: l }, "aria-hidden": "true" })
|
|
487
487
|
] });
|
|
488
|
-
},
|
|
488
|
+
}, Ar = ({ columns: e, className: t, ...a }) => /* @__PURE__ */ i.jsx(or, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (n) => n.header ?? null, ...a }), Zt = (e, t) => typeof e == "function" ? e(t) : e ?? null, Mr = ({ columns: e, allEntries: t, className: a, ...n }) => /* @__PURE__ */ i.jsx(or, { kind: "footer", columns: e, className: a, nameContent: Zt(e[0]?.footer, t), renderCell: (r) => Zt(r.footer, t), ...n }), Dr = 240, lr = 96, ir = 12, at = (e, t) => {
|
|
489
489
|
const a = e?.width;
|
|
490
490
|
return typeof a == "number" && Number.isFinite(a) && a > 0 ? a : t;
|
|
491
|
-
},
|
|
492
|
-
const n =
|
|
493
|
-
return { nameWidth: n, numericTotal: r, numericVisible:
|
|
494
|
-
},
|
|
491
|
+
}, Or = (e) => e.slice(1).map((t) => `${at(t, lr)}px`).join(" "), Fr = ({ measuredWidth: e, columns: t, scrollBarWidth: a = ir }) => {
|
|
492
|
+
const n = at(t[0], Dr), r = t.slice(1).reduce((j, v) => j + at(v, lr), 0), l = Number.isFinite(e) && e > 0 ? e : 0, c = Math.max(0, l - n - Math.max(0, a)), u = Math.max(0, r - c);
|
|
493
|
+
return { nameWidth: n, numericTotal: r, numericVisible: c, maxHScroll: u };
|
|
494
|
+
}, nt = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, Lr = (e) => {
|
|
495
495
|
const t = [], a = (n) => {
|
|
496
496
|
for (const r of n)
|
|
497
497
|
t.push(r), r.children && r.children.length > 0 && a(r.children);
|
|
498
498
|
};
|
|
499
499
|
return a(e), t;
|
|
500
|
-
},
|
|
500
|
+
}, $r = (e, t) => {
|
|
501
501
|
const a = e.length - 1;
|
|
502
502
|
if (a <= 0) return 0;
|
|
503
|
-
let n = 0, r = a - 1,
|
|
503
|
+
let n = 0, r = a - 1, l = 0;
|
|
504
504
|
for (; n <= r; ) {
|
|
505
|
-
const
|
|
506
|
-
e[
|
|
505
|
+
const c = n + r >>> 1;
|
|
506
|
+
e[c] <= t ? (l = c, n = c + 1) : r = c - 1;
|
|
507
507
|
}
|
|
508
|
-
return
|
|
509
|
-
},
|
|
508
|
+
return l;
|
|
509
|
+
}, Hr = (e, t, a) => {
|
|
510
510
|
if (a <= 0 || e.length === 0 || t.length !== e.length + 1)
|
|
511
511
|
return null;
|
|
512
|
-
const n =
|
|
512
|
+
const n = $r(t, a), r = e[n];
|
|
513
513
|
return r ? {
|
|
514
514
|
path: r.entry.absolutePath,
|
|
515
515
|
offsetInViewport: a - t[n]
|
|
516
516
|
} : null;
|
|
517
|
-
},
|
|
517
|
+
}, Wr = (e, t, a) => {
|
|
518
518
|
if (t.length === 0 || a.length !== t.length + 1)
|
|
519
519
|
return null;
|
|
520
520
|
for (let n = 0; n < t.length; n++)
|
|
521
521
|
if (t[n].entry.absolutePath === e.path)
|
|
522
522
|
return Math.max(0, a[n] + e.offsetInViewport);
|
|
523
523
|
return null;
|
|
524
|
-
},
|
|
524
|
+
}, Br = (e, t, a) => {
|
|
525
525
|
const n = [];
|
|
526
526
|
for (let r = t; r < a; r++) {
|
|
527
|
-
const
|
|
528
|
-
if (!(!
|
|
529
|
-
for (const
|
|
530
|
-
n.push(
|
|
527
|
+
const l = e[r];
|
|
528
|
+
if (!(!l || l.length === 0))
|
|
529
|
+
for (const c of l)
|
|
530
|
+
n.push(c);
|
|
531
531
|
}
|
|
532
532
|
return n;
|
|
533
|
-
},
|
|
533
|
+
}, zr = (e, t, a) => {
|
|
534
534
|
const n = [];
|
|
535
535
|
for (let r = t; r < a; r++) {
|
|
536
|
-
const
|
|
537
|
-
if (!(!
|
|
538
|
-
for (const
|
|
539
|
-
n.push(
|
|
536
|
+
const l = e[r];
|
|
537
|
+
if (!(!l || l.length === 0))
|
|
538
|
+
for (const c of l)
|
|
539
|
+
n.push(c);
|
|
540
540
|
}
|
|
541
541
|
return n;
|
|
542
|
-
},
|
|
543
|
-
const r = Math.max(1, Math.floor(t * n)),
|
|
544
|
-
(e.width !== r || e.height !==
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
},
|
|
542
|
+
}, Yr = (e, t, a, n) => {
|
|
543
|
+
const r = Math.max(1, Math.floor(t * n)), l = Math.max(1, Math.floor(a * n));
|
|
544
|
+
(e.width !== r || e.height !== l) && (e.width = r, e.height = l);
|
|
545
|
+
const c = e.style;
|
|
546
|
+
c.width !== `${t}px` && (c.width = `${t}px`), c.height !== `${a}px` && (c.height = `${a}px`);
|
|
547
|
+
}, Gr = (e, t, a) => {
|
|
548
548
|
e.lineWidth = a, e.beginPath();
|
|
549
549
|
for (const n of t)
|
|
550
550
|
e.moveTo(n.x1, n.y1), e.lineTo(n.x2, n.y2);
|
|
551
551
|
e.stroke();
|
|
552
|
-
},
|
|
552
|
+
}, Vr = (e, t) => {
|
|
553
553
|
const a = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
554
554
|
if (!a)
|
|
555
555
|
return null;
|
|
556
556
|
let n = a[1];
|
|
557
557
|
n.length === 3 && (n = n.split("").map((u) => u + u).join(""));
|
|
558
|
-
const r = Number.parseInt(n.slice(0, 2), 16),
|
|
559
|
-
return `rgba(${r}, ${
|
|
560
|
-
},
|
|
558
|
+
const r = Number.parseInt(n.slice(0, 2), 16), l = Number.parseInt(n.slice(2, 4), 16), c = Number.parseInt(n.slice(4, 6), 16);
|
|
559
|
+
return `rgba(${r}, ${l}, ${c}, ${t})`;
|
|
560
|
+
}, Ur = (e, t, a, n) => {
|
|
561
561
|
if (t.length === 0)
|
|
562
562
|
return;
|
|
563
|
-
const r =
|
|
563
|
+
const r = Vr(a, 0.14), l = e.strokeStyle, c = e.fillStyle, u = e.lineWidth, j = e.lineCap, v = e.lineJoin;
|
|
564
564
|
e.strokeStyle = a, e.lineCap = "round", e.lineJoin = "round";
|
|
565
565
|
for (const d of t) {
|
|
566
|
-
const
|
|
567
|
-
r && (e.fillStyle = r, e.beginPath(), e.arc(d.centerX, d.centerY,
|
|
566
|
+
const h = n ?? d.size, g = Math.max(0, h / 2), w = Math.max(1, Math.round(h * 0.08)), E = Math.max(1, Math.round(h * 0.14)), f = Math.max(0, g - w * 0.8), y = Math.max(0, f * 0.55);
|
|
567
|
+
r && (e.fillStyle = r, e.beginPath(), e.arc(d.centerX, d.centerY, f, 0, Math.PI * 2), e.fill()), e.lineWidth = w, e.beginPath(), e.arc(d.centerX, d.centerY, Math.max(0, g - w * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = E, e.beginPath(), e.moveTo(d.centerX - y, d.centerY), e.lineTo(d.centerX + y, d.centerY), e.stroke(), d.isExpanded || (e.beginPath(), e.moveTo(d.centerX, d.centerY - y), e.lineTo(d.centerX, d.centerY + y), e.stroke());
|
|
568
568
|
}
|
|
569
|
-
e.strokeStyle =
|
|
570
|
-
},
|
|
571
|
-
const
|
|
569
|
+
e.strokeStyle = l, e.fillStyle = c, e.lineWidth = u, e.lineCap = j, e.lineJoin = v;
|
|
570
|
+
}, cr = ot(({ segmentsByItem: e, glyphsByItem: t, itemHeight: a, width: n, viewportHeight: r, scrollPosition: l, color: c = "#a0aec0", strokeWidth: u = 1, renderStartIndex: j, renderEndIndex: v, lookaheadEndIndex: d, devicePixelRatio: h, expandGlyphColor: g, expandGlyphSize: w }) => {
|
|
571
|
+
const E = ne(null), f = ne(null), y = ne({
|
|
572
572
|
segmentsByItem: e,
|
|
573
573
|
glyphsByItem: t,
|
|
574
574
|
itemHeight: a,
|
|
575
575
|
width: n,
|
|
576
576
|
viewportHeight: r,
|
|
577
|
-
scrollPosition:
|
|
578
|
-
color:
|
|
577
|
+
scrollPosition: l,
|
|
578
|
+
color: c,
|
|
579
579
|
strokeWidth: u,
|
|
580
|
-
renderStartIndex:
|
|
581
|
-
renderEndIndex:
|
|
580
|
+
renderStartIndex: j,
|
|
581
|
+
renderEndIndex: v,
|
|
582
582
|
lookaheadEndIndex: d,
|
|
583
|
-
devicePixelRatio:
|
|
583
|
+
devicePixelRatio: h,
|
|
584
584
|
expandGlyphColor: g,
|
|
585
|
-
expandGlyphSize:
|
|
586
|
-
}), k =
|
|
587
|
-
|
|
588
|
-
const N =
|
|
585
|
+
expandGlyphSize: w
|
|
586
|
+
}), k = F(() => {
|
|
587
|
+
f.current = null;
|
|
588
|
+
const N = E.current;
|
|
589
589
|
if (!N)
|
|
590
590
|
return;
|
|
591
|
-
const
|
|
592
|
-
if (!
|
|
591
|
+
const S = N.getContext("2d");
|
|
592
|
+
if (!S)
|
|
593
593
|
return;
|
|
594
|
-
const
|
|
595
|
-
if (
|
|
596
|
-
|
|
594
|
+
const p = y.current;
|
|
595
|
+
if (p.width <= 0 || p.viewportHeight <= 0) {
|
|
596
|
+
S.clearRect(0, 0, N.width, N.height);
|
|
597
597
|
return;
|
|
598
598
|
}
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
const
|
|
602
|
-
if (typeof
|
|
603
|
-
const
|
|
604
|
-
return Math.max(Math.min(
|
|
599
|
+
const L = Number.isFinite(p.devicePixelRatio ?? NaN) ? p.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
|
|
600
|
+
Yr(N, p.width, p.viewportHeight, L);
|
|
601
|
+
const P = p.segmentsByItem.length, O = typeof p.renderStartIndex == "number" && Number.isFinite(p.renderStartIndex) ? Math.max(0, Math.floor(p.renderStartIndex)) : Math.max(0, Math.floor(p.scrollPosition / p.itemHeight)), K = Math.min(P, Math.ceil((p.scrollPosition + p.viewportHeight) / p.itemHeight)), Q = (() => {
|
|
602
|
+
if (typeof p.renderEndIndex == "number" && Number.isFinite(p.renderEndIndex)) {
|
|
603
|
+
const I = Math.floor(p.renderEndIndex);
|
|
604
|
+
return Math.max(Math.min(P, I + 1), O);
|
|
605
605
|
}
|
|
606
|
-
return Math.max(
|
|
607
|
-
})(),
|
|
608
|
-
if (typeof
|
|
609
|
-
const
|
|
610
|
-
return Math.max(
|
|
606
|
+
return Math.max(K, O);
|
|
607
|
+
})(), $ = (() => {
|
|
608
|
+
if (typeof p.lookaheadEndIndex == "number" && Number.isFinite(p.lookaheadEndIndex)) {
|
|
609
|
+
const I = Math.floor(p.lookaheadEndIndex), Y = Math.min(P, I + 1);
|
|
610
|
+
return Math.max(Y, Q);
|
|
611
611
|
}
|
|
612
|
-
return Math.max(
|
|
613
|
-
})(),
|
|
614
|
-
|
|
615
|
-
}, []),
|
|
616
|
-
|
|
612
|
+
return Math.max(K, Q);
|
|
613
|
+
})(), J = Br(p.segmentsByItem, O, $), ee = zr(p.glyphsByItem, O, $);
|
|
614
|
+
S.save(), S.scale(L, L), S.clearRect(0, 0, p.width, p.viewportHeight), S.translate(0, -p.scrollPosition), S.strokeStyle = p.color, Gr(S, J, p.strokeWidth), Ur(S, ee, p.expandGlyphColor ?? p.color, p.expandGlyphSize), S.restore();
|
|
615
|
+
}, []), R = F(() => {
|
|
616
|
+
f.current === null && (f.current = window.requestAnimationFrame(k));
|
|
617
617
|
}, [k]);
|
|
618
618
|
return me(() => {
|
|
619
|
-
|
|
619
|
+
y.current = {
|
|
620
620
|
segmentsByItem: e,
|
|
621
621
|
glyphsByItem: t,
|
|
622
622
|
itemHeight: a,
|
|
623
623
|
width: n,
|
|
624
624
|
viewportHeight: r,
|
|
625
|
-
scrollPosition:
|
|
626
|
-
color:
|
|
625
|
+
scrollPosition: l,
|
|
626
|
+
color: c,
|
|
627
627
|
strokeWidth: u,
|
|
628
|
-
renderStartIndex:
|
|
629
|
-
renderEndIndex:
|
|
628
|
+
renderStartIndex: j,
|
|
629
|
+
renderEndIndex: v,
|
|
630
630
|
lookaheadEndIndex: d,
|
|
631
|
-
devicePixelRatio:
|
|
631
|
+
devicePixelRatio: h,
|
|
632
632
|
expandGlyphColor: g,
|
|
633
|
-
expandGlyphSize:
|
|
634
|
-
},
|
|
635
|
-
}, [e, t, a, n, r,
|
|
636
|
-
|
|
637
|
-
}, []), /* @__PURE__ */ i.jsx("canvas", { ref:
|
|
633
|
+
expandGlyphSize: w
|
|
634
|
+
}, R();
|
|
635
|
+
}, [e, t, a, n, r, l, c, u, j, v, d, h, g, w, R]), me(() => () => {
|
|
636
|
+
f.current !== null && (window.cancelAnimationFrame(f.current), f.current = null);
|
|
637
|
+
}, []), /* @__PURE__ */ i.jsx("canvas", { ref: E, className: "pointer-events-none absolute top-0 left-0 z-0" });
|
|
638
638
|
});
|
|
639
|
-
|
|
640
|
-
const
|
|
639
|
+
cr.displayName = "TreeLineCanvas";
|
|
640
|
+
const Xr = {
|
|
641
641
|
msOverflowStyle: "none",
|
|
642
642
|
scrollbarWidth: "none"
|
|
643
|
-
},
|
|
643
|
+
}, Jr = () => {
|
|
644
644
|
let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
|
|
645
645
|
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));
|
|
646
|
-
},
|
|
647
|
-
const
|
|
646
|
+
}, qr = (e, t, a, n, r) => {
|
|
647
|
+
const l = [], c = [];
|
|
648
648
|
let u = 0;
|
|
649
|
-
const
|
|
650
|
-
const g = r ? [...
|
|
651
|
-
for (let
|
|
652
|
-
const
|
|
653
|
-
let N = d,
|
|
654
|
-
n && (N = d - 1,
|
|
655
|
-
id:
|
|
656
|
-
name:
|
|
657
|
-
absolutePath:
|
|
649
|
+
const j = (v, d, h) => {
|
|
650
|
+
const g = r ? [...v].sort(r) : v;
|
|
651
|
+
for (let w = 0; w < g.length; w++) {
|
|
652
|
+
const E = g[w], f = w === g.length - 1, y = [...h, f], k = E.children !== void 0, R = k && t(E.absolutePath, E.relativePath);
|
|
653
|
+
let N = d, S = y, p = h;
|
|
654
|
+
n && (N = d - 1, S = y.slice(1), p = h.slice(1)), l.push({ entry: E, indentLevel: N, depth: d, positionInSet: w + 1, setSize: g.length, parentIsLast: S }), a && (N > u && (u = N), c.push({
|
|
655
|
+
id: E.absolutePath,
|
|
656
|
+
name: E.name,
|
|
657
|
+
absolutePath: E.absolutePath,
|
|
658
658
|
indentLevel: N,
|
|
659
|
-
isLastChild:
|
|
659
|
+
isLastChild: f,
|
|
660
660
|
isDirectory: k,
|
|
661
|
-
isExpanded:
|
|
662
|
-
ancestorIsLast: [...
|
|
661
|
+
isExpanded: R,
|
|
662
|
+
ancestorIsLast: [...p],
|
|
663
663
|
hideLines: n && d === 0
|
|
664
|
-
})), k &&
|
|
664
|
+
})), k && R && E.children && j(E.children, d + 1, y);
|
|
665
665
|
}
|
|
666
666
|
};
|
|
667
|
-
return
|
|
668
|
-
},
|
|
667
|
+
return j(e, 0, []), { flatItems: l, lineItems: c, maxIndent: u };
|
|
668
|
+
}, Kt = (e, t) => {
|
|
669
669
|
const a = e.length - 1;
|
|
670
670
|
if (a <= 0) return 0;
|
|
671
|
-
let n = 0, r = a - 1,
|
|
671
|
+
let n = 0, r = a - 1, l = 0;
|
|
672
672
|
for (; n <= r; ) {
|
|
673
|
-
const
|
|
674
|
-
e[
|
|
673
|
+
const c = n + r >>> 1;
|
|
674
|
+
e[c] <= t ? (l = c, n = c + 1) : r = c - 1;
|
|
675
675
|
}
|
|
676
|
-
return
|
|
677
|
-
},
|
|
678
|
-
const
|
|
679
|
-
return { renderStart:
|
|
680
|
-
},
|
|
676
|
+
return l;
|
|
677
|
+
}, Zr = (e, t, a, n, r, l) => {
|
|
678
|
+
const c = n?.renderStart ?? Math.max(0, Kt(l, r)), u = t > 0 ? Kt(l, r + t) + a : c + a, j = e > 0 ? Math.min(e - 1, Math.max(c, u)) : c, v = n?.renderEnd ?? j, d = e > 0 ? Math.min(e - 1, v + a) : v;
|
|
679
|
+
return { renderStart: c, renderEnd: v, lookaheadEnd: d };
|
|
680
|
+
}, Kr = (e, t, a, n, r, l) => {
|
|
681
681
|
if (e.length === 0)
|
|
682
682
|
return { segmentsByItem: [], glyphsByItem: [] };
|
|
683
|
-
const
|
|
683
|
+
const c = Array.from({ length: e.length }, () => []), u = Array.from({ length: e.length }, () => []), j = (d) => r ? typeof l == "number" && Number.isFinite(l) && l > 0 ? l : Math.max(8, Math.min(n * 0.9, d * 0.7)) : 0, v = 3;
|
|
684
684
|
for (let d = 0; d < e.length; d++) {
|
|
685
|
-
const
|
|
686
|
-
if (
|
|
685
|
+
const h = e[d];
|
|
686
|
+
if (h.hideLines)
|
|
687
687
|
continue;
|
|
688
|
-
const g = [],
|
|
689
|
-
for (let
|
|
690
|
-
if (
|
|
688
|
+
const g = [], w = t[d] ?? 0, E = a[d] ?? 0, f = E + w / 2, y = j(w), k = y > 0 ? y / 2 + 2 : n / 1.5;
|
|
689
|
+
for (let S = 0; S < h.indentLevel; S++) {
|
|
690
|
+
if (h.ancestorIsLast[S] ?? !1)
|
|
691
691
|
continue;
|
|
692
|
-
let
|
|
693
|
-
for (let
|
|
694
|
-
const
|
|
695
|
-
if (
|
|
696
|
-
|
|
692
|
+
let L = !1;
|
|
693
|
+
for (let P = d; P < e.length; P++) {
|
|
694
|
+
const O = e[P];
|
|
695
|
+
if (O.indentLevel > S && O.ancestorIsLast.length > S && !O.ancestorIsLast[S]) {
|
|
696
|
+
L = !0;
|
|
697
697
|
break;
|
|
698
698
|
}
|
|
699
|
-
if (
|
|
699
|
+
if (P > d && O.indentLevel === S)
|
|
700
700
|
break;
|
|
701
701
|
}
|
|
702
|
-
if (
|
|
703
|
-
const
|
|
702
|
+
if (L) {
|
|
703
|
+
const P = S * n + n / 2 + v;
|
|
704
704
|
g.push({
|
|
705
|
-
key: `${
|
|
706
|
-
x1:
|
|
707
|
-
y1:
|
|
708
|
-
x2:
|
|
709
|
-
y2:
|
|
705
|
+
key: `${h.id}-ancestor-${S}`,
|
|
706
|
+
x1: P,
|
|
707
|
+
y1: E,
|
|
708
|
+
x2: P,
|
|
709
|
+
y2: E + w,
|
|
710
710
|
itemIndex: d
|
|
711
711
|
});
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
|
-
const
|
|
715
|
-
if (
|
|
716
|
-
key: `${
|
|
714
|
+
const R = h.indentLevel * n, N = R + n / 2 + v;
|
|
715
|
+
if (h.isDirectory ? g.push({
|
|
716
|
+
key: `${h.id}-connector-top`,
|
|
717
717
|
x1: N,
|
|
718
|
-
y1:
|
|
718
|
+
y1: E,
|
|
719
719
|
x2: N,
|
|
720
|
-
y2:
|
|
720
|
+
y2: f - k,
|
|
721
721
|
itemIndex: d
|
|
722
722
|
}) : g.push({
|
|
723
|
-
key: `${
|
|
723
|
+
key: `${h.id}-connector-top`,
|
|
724
724
|
x1: N,
|
|
725
|
-
y1:
|
|
725
|
+
y1: E,
|
|
726
726
|
x2: N,
|
|
727
|
-
y2:
|
|
727
|
+
y2: f,
|
|
728
728
|
itemIndex: d
|
|
729
|
-
}), !
|
|
730
|
-
key: `${
|
|
729
|
+
}), !h.isDirectory && h.isLastChild && g.push({
|
|
730
|
+
key: `${h.id}-connector-horizontal`,
|
|
731
731
|
x1: N,
|
|
732
|
-
y1:
|
|
733
|
-
x2:
|
|
734
|
-
y2:
|
|
732
|
+
y1: f,
|
|
733
|
+
x2: R + n + v,
|
|
734
|
+
y2: f,
|
|
735
735
|
itemIndex: d
|
|
736
|
-
}),
|
|
737
|
-
key: `${
|
|
736
|
+
}), h.isLastChild || (h.isDirectory ? g.push({
|
|
737
|
+
key: `${h.id}-connector-bottom`,
|
|
738
738
|
x1: N,
|
|
739
|
-
y1:
|
|
739
|
+
y1: f + k,
|
|
740
740
|
x2: N,
|
|
741
|
-
y2:
|
|
741
|
+
y2: E + w,
|
|
742
742
|
itemIndex: d
|
|
743
743
|
}) : g.push({
|
|
744
|
-
key: `${
|
|
744
|
+
key: `${h.id}-connector-bottom`,
|
|
745
745
|
x1: N,
|
|
746
|
-
y1:
|
|
746
|
+
y1: f,
|
|
747
747
|
x2: N,
|
|
748
|
-
y2:
|
|
748
|
+
y2: E + w,
|
|
749
749
|
itemIndex: d
|
|
750
|
-
})),
|
|
751
|
-
const
|
|
750
|
+
})), c[d] = g, r && h.isDirectory) {
|
|
751
|
+
const S = y, p = N, L = f;
|
|
752
752
|
u[d] = [
|
|
753
753
|
{
|
|
754
|
-
key: `${
|
|
754
|
+
key: `${h.id}-glyph`,
|
|
755
755
|
itemIndex: d,
|
|
756
|
-
centerX:
|
|
757
|
-
centerY:
|
|
758
|
-
size:
|
|
759
|
-
isExpanded:
|
|
756
|
+
centerX: p,
|
|
757
|
+
centerY: L,
|
|
758
|
+
size: S,
|
|
759
|
+
isExpanded: h.isExpanded
|
|
760
760
|
}
|
|
761
761
|
];
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
|
-
return { segmentsByItem:
|
|
765
|
-
},
|
|
764
|
+
return { segmentsByItem: c, glyphsByItem: u };
|
|
765
|
+
}, lt = ot(
|
|
766
766
|
({
|
|
767
767
|
entry: e,
|
|
768
768
|
indentLevel: t,
|
|
769
769
|
depth: a,
|
|
770
770
|
positionInSet: n,
|
|
771
771
|
setSize: r,
|
|
772
|
-
isSelectedForAria:
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
772
|
+
isSelectedForAria: l,
|
|
773
|
+
flatIndex: c,
|
|
774
|
+
isActive: u,
|
|
775
|
+
registerRowRef: j,
|
|
776
|
+
onNavigationKeyDown: v,
|
|
777
|
+
rowHeight: d,
|
|
778
|
+
isDirOpen: h,
|
|
779
|
+
parentIsLast: g,
|
|
780
|
+
renderChildren: w = !0,
|
|
781
|
+
expansion: { toggleDirectory: E, onToggleDirectoryRecursive: f },
|
|
782
|
+
selection: { onEntryClick: y, selectedPath: k, mode: R = "none", selectedItems: N, onSelectionChange: S },
|
|
779
783
|
visual: {
|
|
780
|
-
iconOverrides:
|
|
781
|
-
showExpandIcons:
|
|
782
|
-
showDirectoryIcons:
|
|
783
|
-
showFileIcons:
|
|
784
|
-
useCanvasExpandIcons:
|
|
785
|
-
expandIconSize:
|
|
786
|
-
typeIconSize:
|
|
787
|
-
fontSize:
|
|
788
|
-
indentSize:
|
|
789
|
-
highlightStyles:
|
|
790
|
-
entryClassName:
|
|
791
|
-
entryStyle:
|
|
792
|
-
nameClassName:
|
|
793
|
-
nameStyle:
|
|
794
|
-
directoryNameClassName:
|
|
795
|
-
directoryNameStyle:
|
|
796
|
-
fileNameClassName:
|
|
797
|
-
fileNameStyle:
|
|
784
|
+
iconOverrides: p,
|
|
785
|
+
showExpandIcons: L = !0,
|
|
786
|
+
showDirectoryIcons: P = !0,
|
|
787
|
+
showFileIcons: O = !0,
|
|
788
|
+
useCanvasExpandIcons: K = !1,
|
|
789
|
+
expandIconSize: Q,
|
|
790
|
+
typeIconSize: $,
|
|
791
|
+
fontSize: J,
|
|
792
|
+
indentSize: ee = Ge,
|
|
793
|
+
highlightStyles: I,
|
|
794
|
+
entryClassName: Y,
|
|
795
|
+
entryStyle: B,
|
|
796
|
+
nameClassName: G,
|
|
797
|
+
nameStyle: de,
|
|
798
|
+
directoryNameClassName: ue,
|
|
799
|
+
directoryNameStyle: C,
|
|
800
|
+
fileNameClassName: s,
|
|
801
|
+
fileNameStyle: m
|
|
798
802
|
}
|
|
799
803
|
}) => {
|
|
800
|
-
const [
|
|
804
|
+
const [T, A] = ce(null), [se, le] = ce(!1), b = e.children !== void 0, z = b && h(e.absolutePath), H = e.absolutePath === k, V = !b && N?.has(e.absolutePath), Ne = b ? void 0 : Ee(e.name) || Ee(e.relativePath) || Ee(e.absolutePath);
|
|
801
805
|
me(() => {
|
|
802
|
-
A(
|
|
803
|
-
}, [
|
|
804
|
-
const
|
|
805
|
-
if (
|
|
806
|
-
if (
|
|
807
|
-
return
|
|
808
|
-
} else if (
|
|
809
|
-
return
|
|
806
|
+
A(z && e.children ? e.children : null);
|
|
807
|
+
}, [z, e.children]);
|
|
808
|
+
const ye = rr({ entry: e, isDirectory: b, isExpanded: z, isItemSelected: !!V, selectionMode: R, onSelectionChange: S, onEntryClick: y, toggleDirectory: E, onToggleDirectoryRecursive: f }), ge = se ? I?.hoverClassName !== void 0 ? I.hoverClassName : D.entryHover : "", ae = (() => {
|
|
809
|
+
if (b) {
|
|
810
|
+
if (H)
|
|
811
|
+
return I?.directorySelectedClassName !== void 0 ? I.directorySelectedClassName : D.entrySelected;
|
|
812
|
+
} else if (H || V)
|
|
813
|
+
return I?.itemSelectedClassName !== void 0 ? I.itemSelectedClassName : _(H && D.entrySelected, V && D.entryItemSelected);
|
|
810
814
|
return "";
|
|
811
|
-
})(),
|
|
812
|
-
...
|
|
813
|
-
...
|
|
814
|
-
...!
|
|
815
|
-
},
|
|
816
|
-
return /* @__PURE__ */ i.jsxs(
|
|
815
|
+
})(), Ve = _(D.entry, ge, ae, Y, e.className), je = _(D.expandIcon, (H || V) && D.expandIconSelected), Ae = _(D.typeIcon, (H || V) && D.typeIconSelected), Me = _(D.name, G, b && D.nameDirectory, b && ue, !b && s, (H || V) && D.nameSelected), De = Qt({ isDirectory: b, isExpanded: z, showExpandIcons: L, useCanvasExpandIcons: K, expandIconSize: Q }), Oe = (b ? P : O) ? er({ entry: e, isDirectory: b, isExpanded: z, isSelected: H, isItemSelected: !!V, extension: Ne, mimeType: e.mimeType }, p) : null, Fe = {
|
|
816
|
+
...se ? I?.hoverStyle : {},
|
|
817
|
+
...b && H ? I?.directorySelectedStyle : {},
|
|
818
|
+
...!b && (H || V) ? I?.itemSelectedStyle : {}
|
|
819
|
+
}, ie = tr(e.data), Le = $ ? { width: $, height: $ } : void 0, he = J ? { fontSize: typeof J == "number" ? `${J}px` : J } : void 0;
|
|
820
|
+
return /* @__PURE__ */ i.jsxs(vr, { children: [
|
|
817
821
|
/* @__PURE__ */ i.jsxs(
|
|
818
822
|
"div",
|
|
819
823
|
{
|
|
820
|
-
className:
|
|
824
|
+
className: Ve,
|
|
821
825
|
style: {
|
|
822
|
-
paddingLeft: `${Math.max(0, t *
|
|
823
|
-
transform: t < 0 ? `translateX(${t *
|
|
824
|
-
width: t < 0 ? `calc(100% + ${Math.abs(t *
|
|
825
|
-
height: `${
|
|
826
|
-
...
|
|
827
|
-
...
|
|
828
|
-
...
|
|
826
|
+
paddingLeft: `${Math.max(0, t * ee)}px`,
|
|
827
|
+
transform: t < 0 ? `translateX(${t * ee}px)` : void 0,
|
|
828
|
+
width: t < 0 ? `calc(100% + ${Math.abs(t * ee)}px)` : void 0,
|
|
829
|
+
height: `${d}px`,
|
|
830
|
+
...he,
|
|
831
|
+
...Fe,
|
|
832
|
+
...B,
|
|
829
833
|
...e.style
|
|
830
834
|
},
|
|
831
|
-
...
|
|
832
|
-
"data-entry-type":
|
|
833
|
-
"data-entry-expanded":
|
|
834
|
-
"data-entry-selected":
|
|
835
|
-
"data-entry-item-selected":
|
|
836
|
-
onClick:
|
|
837
|
-
onMouseEnter: () =>
|
|
838
|
-
onMouseLeave: () =>
|
|
839
|
-
|
|
840
|
-
|
|
835
|
+
...ie,
|
|
836
|
+
"data-entry-type": b ? "directory" : "file",
|
|
837
|
+
"data-entry-expanded": b ? String(z) : void 0,
|
|
838
|
+
"data-entry-selected": H ? "true" : void 0,
|
|
839
|
+
"data-entry-item-selected": V ? "true" : void 0,
|
|
840
|
+
onClick: ye,
|
|
841
|
+
onMouseEnter: () => le(!0),
|
|
842
|
+
onMouseLeave: () => le(!1),
|
|
843
|
+
ref: (te) => j(c, te),
|
|
844
|
+
onKeyDown: (te) => {
|
|
845
|
+
if (te.key === "Enter" || te.key === " ") {
|
|
846
|
+
te.preventDefault(), ye(te);
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
v(te, c);
|
|
850
|
+
},
|
|
851
|
+
tabIndex: u ? 0 : -1,
|
|
841
852
|
role: "treeitem",
|
|
842
|
-
"aria-expanded":
|
|
853
|
+
"aria-expanded": b ? z : void 0,
|
|
843
854
|
"aria-level": a + 1,
|
|
844
855
|
"aria-posinset": n,
|
|
845
856
|
"aria-setsize": r,
|
|
846
|
-
"aria-selected":
|
|
847
|
-
"aria-label": `${e.name} (${
|
|
857
|
+
"aria-selected": R === "none" ? void 0 : l,
|
|
858
|
+
"aria-label": `${e.name} (${b ? "directory" : "file"})`,
|
|
848
859
|
children: [
|
|
849
|
-
(
|
|
850
|
-
(
|
|
860
|
+
(L || K) && /* @__PURE__ */ i.jsx("span", { className: je, children: De }),
|
|
861
|
+
(b ? P : O) && /* @__PURE__ */ i.jsx("span", { className: Ae, style: Le, children: Oe }),
|
|
851
862
|
/* @__PURE__ */ i.jsx(
|
|
852
863
|
"span",
|
|
853
864
|
{
|
|
854
|
-
className:
|
|
865
|
+
className: Me,
|
|
855
866
|
style: {
|
|
856
|
-
...
|
|
857
|
-
...
|
|
858
|
-
...
|
|
867
|
+
...he,
|
|
868
|
+
...de,
|
|
869
|
+
...b ? C : m
|
|
859
870
|
},
|
|
860
|
-
"data-entry-type":
|
|
871
|
+
"data-entry-type": b ? "directory" : "file",
|
|
861
872
|
"data-entry-role": "name",
|
|
862
873
|
children: e.label ?? e.name
|
|
863
874
|
}
|
|
@@ -865,487 +876,557 @@ const Dr = {
|
|
|
865
876
|
]
|
|
866
877
|
}
|
|
867
878
|
),
|
|
868
|
-
|
|
869
|
-
|
|
879
|
+
z && T && w && /* @__PURE__ */ i.jsx("fieldset", { children: T.map((te, oe) => /* @__PURE__ */ i.jsx(
|
|
880
|
+
lt,
|
|
870
881
|
{
|
|
871
|
-
entry:
|
|
882
|
+
entry: te,
|
|
872
883
|
indentLevel: t + 1,
|
|
873
884
|
depth: a + 1,
|
|
874
|
-
positionInSet:
|
|
875
|
-
setSize:
|
|
876
|
-
isSelectedForAria:
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
885
|
+
positionInSet: oe + 1,
|
|
886
|
+
setSize: T.length,
|
|
887
|
+
isSelectedForAria: !!N?.has(te.absolutePath),
|
|
888
|
+
flatIndex: -1,
|
|
889
|
+
isActive: !1,
|
|
890
|
+
registerRowRef: j,
|
|
891
|
+
onNavigationKeyDown: v,
|
|
892
|
+
rowHeight: d,
|
|
893
|
+
isDirOpen: h,
|
|
894
|
+
parentIsLast: [...g, oe === T.length - 1],
|
|
895
|
+
expansion: { toggleDirectory: E, onToggleDirectoryRecursive: f },
|
|
896
|
+
selection: { onEntryClick: y, selectedPath: k, mode: R, selectedItems: N, onSelectionChange: S },
|
|
882
897
|
visual: {
|
|
883
|
-
iconOverrides:
|
|
884
|
-
showExpandIcons:
|
|
885
|
-
showDirectoryIcons:
|
|
886
|
-
showFileIcons:
|
|
887
|
-
useCanvasExpandIcons:
|
|
888
|
-
expandIconSize:
|
|
889
|
-
highlightStyles:
|
|
890
|
-
entryClassName:
|
|
891
|
-
entryStyle:
|
|
892
|
-
nameClassName:
|
|
893
|
-
nameStyle:
|
|
894
|
-
directoryNameClassName:
|
|
895
|
-
directoryNameStyle:
|
|
896
|
-
fileNameClassName:
|
|
897
|
-
fileNameStyle:
|
|
898
|
+
iconOverrides: p,
|
|
899
|
+
showExpandIcons: L,
|
|
900
|
+
showDirectoryIcons: P,
|
|
901
|
+
showFileIcons: O,
|
|
902
|
+
useCanvasExpandIcons: K,
|
|
903
|
+
expandIconSize: Q,
|
|
904
|
+
highlightStyles: I,
|
|
905
|
+
entryClassName: Y,
|
|
906
|
+
entryStyle: B,
|
|
907
|
+
nameClassName: G,
|
|
908
|
+
nameStyle: de,
|
|
909
|
+
directoryNameClassName: ue,
|
|
910
|
+
directoryNameStyle: C,
|
|
911
|
+
fileNameClassName: s,
|
|
912
|
+
fileNameStyle: m
|
|
898
913
|
}
|
|
899
914
|
},
|
|
900
|
-
|
|
915
|
+
te.absolutePath
|
|
901
916
|
)) })
|
|
902
917
|
] }, e.absolutePath);
|
|
903
918
|
},
|
|
904
919
|
(e, t) => {
|
|
905
920
|
if (e.entry !== t.entry) return !1;
|
|
906
|
-
const a = e.entry.children !== void 0, n = t.entry.children !== void 0, r = a && e.isDirOpen(e.entry.absolutePath),
|
|
921
|
+
const a = e.entry.children !== void 0, n = t.entry.children !== void 0, r = a && e.isDirOpen(e.entry.absolutePath), l = n && t.isDirOpen(t.entry.absolutePath);
|
|
907
922
|
return e.indentLevel === t.indentLevel && // 位置情報は aria として描画されるため、変化したら再描画が必要
|
|
908
|
-
e.depth === t.depth && e.positionInSet === t.positionInSet && e.setSize === t.setSize && e.isSelectedForAria === t.isSelectedForAria && e.rowHeight === t.rowHeight && r ===
|
|
923
|
+
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 && r === l && e.selection.selectedPath === t.selection.selectedPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual.iconOverrides === t.visual.iconOverrides && e.visual.showExpandIcons === t.visual.showExpandIcons && e.visual.showDirectoryIcons === t.visual.showDirectoryIcons && e.visual.showFileIcons === t.visual.showFileIcons && e.visual.useCanvasExpandIcons === t.visual.useCanvasExpandIcons && e.visual.expandIconSize === t.visual.expandIconSize && e.visual.highlightStyles === t.visual.highlightStyles && e.visual.entryClassName === t.visual.entryClassName && e.visual.entryStyle === t.visual.entryStyle && e.visual.nameClassName === t.visual.nameClassName && e.visual.nameStyle === t.visual.nameStyle && e.visual.directoryNameClassName === t.visual.directoryNameClassName && e.visual.directoryNameStyle === t.visual.directoryNameStyle && e.visual.fileNameClassName === t.visual.fileNameClassName && e.visual.fileNameStyle === t.visual.fileNameStyle && e.parentIsLast.length === t.parentIsLast.length && e.parentIsLast.every((c, u) => c === t.parentIsLast[u]);
|
|
909
924
|
}
|
|
910
925
|
);
|
|
911
|
-
|
|
912
|
-
const
|
|
926
|
+
lt.displayName = "DirectoryEntryItem";
|
|
927
|
+
const dr = (e) => {
|
|
913
928
|
const t = [];
|
|
914
929
|
if (e.children)
|
|
915
930
|
for (const a of e.children)
|
|
916
|
-
a.type === "directory" && (t.push(a.absolutePath), t.push(...
|
|
931
|
+
a.type === "directory" && (t.push(a.absolutePath), t.push(...dr(a)));
|
|
917
932
|
return t;
|
|
918
|
-
},
|
|
933
|
+
}, sn = ({
|
|
919
934
|
entries: e,
|
|
920
|
-
expansion: { toggle: t, isExpanded: a, expandMultiple: n, collapseMultiple: r, isPending:
|
|
921
|
-
selection: { onEntryClick:
|
|
935
|
+
expansion: { toggle: t, isExpanded: a, expandMultiple: n, collapseMultiple: r, isPending: l, alwaysExpanded: c = !1, doubleClickAction: u = "recursive" },
|
|
936
|
+
selection: { onEntryClick: j, selectedPath: v, mode: d = "none", selectedItems: h, onSelectionChange: g },
|
|
922
937
|
visual: {
|
|
923
|
-
className:
|
|
924
|
-
style:
|
|
925
|
-
ariaLabel:
|
|
926
|
-
ariaLabelledBy:
|
|
938
|
+
className: w,
|
|
939
|
+
style: E,
|
|
940
|
+
ariaLabel: f,
|
|
941
|
+
ariaLabelledBy: y,
|
|
927
942
|
lineColor: k = "#A0AEC0",
|
|
928
|
-
showTreeLines:
|
|
943
|
+
showTreeLines: R = !0,
|
|
929
944
|
showExpandIcons: N = !0,
|
|
930
|
-
showDirectoryIcons:
|
|
931
|
-
showFileIcons:
|
|
932
|
-
iconOverrides:
|
|
933
|
-
expandIconSize:
|
|
934
|
-
itemHeight:
|
|
935
|
-
removeRootIndent:
|
|
936
|
-
highlightStyles:
|
|
937
|
-
entryClassName:
|
|
938
|
-
entryStyle:
|
|
939
|
-
nameClassName:
|
|
940
|
-
nameStyle:
|
|
941
|
-
directoryNameClassName:
|
|
945
|
+
showDirectoryIcons: S = !0,
|
|
946
|
+
showFileIcons: p = !0,
|
|
947
|
+
iconOverrides: L,
|
|
948
|
+
expandIconSize: P,
|
|
949
|
+
itemHeight: O = Ye,
|
|
950
|
+
removeRootIndent: K = !1,
|
|
951
|
+
highlightStyles: Q,
|
|
952
|
+
entryClassName: $,
|
|
953
|
+
entryStyle: J,
|
|
954
|
+
nameClassName: ee,
|
|
955
|
+
nameStyle: I,
|
|
956
|
+
directoryNameClassName: Y,
|
|
942
957
|
directoryNameStyle: B,
|
|
943
|
-
fileNameClassName:
|
|
944
|
-
fileNameStyle:
|
|
958
|
+
fileNameClassName: G,
|
|
959
|
+
fileNameStyle: de
|
|
945
960
|
} = {},
|
|
946
|
-
virtualScroll:
|
|
947
|
-
grid:
|
|
961
|
+
virtualScroll: ue,
|
|
962
|
+
grid: C,
|
|
948
963
|
sort: s
|
|
949
964
|
}) => {
|
|
950
|
-
const
|
|
951
|
-
overscanCount:
|
|
952
|
-
className:
|
|
953
|
-
background:
|
|
954
|
-
onScroll:
|
|
955
|
-
onRangeChange:
|
|
956
|
-
initialScrollIndex:
|
|
957
|
-
initialScrollOffset:
|
|
958
|
-
callbackThrottleMs:
|
|
959
|
-
contentInsets:
|
|
960
|
-
onItemFocus:
|
|
961
|
-
viewportHeightOverride:
|
|
962
|
-
scrollBarOptions:
|
|
963
|
-
behaviorOptions:
|
|
964
|
-
preserveScrollAnchor:
|
|
965
|
-
getItemKey:
|
|
965
|
+
const m = C !== void 0, [T, A] = ce(!1), se = ne(null), le = ne(null), b = ne(null), [z, H] = ce(0), [V, Ne] = ce(0), [ye, ge] = ce(0), [ae, Ve] = ce(null), {
|
|
966
|
+
overscanCount: je = 15,
|
|
967
|
+
className: Ae,
|
|
968
|
+
background: Me,
|
|
969
|
+
onScroll: De,
|
|
970
|
+
onRangeChange: Oe,
|
|
971
|
+
initialScrollIndex: Fe,
|
|
972
|
+
initialScrollOffset: ie,
|
|
973
|
+
callbackThrottleMs: Le = 5,
|
|
974
|
+
contentInsets: he,
|
|
975
|
+
onItemFocus: te,
|
|
976
|
+
viewportHeightOverride: oe,
|
|
977
|
+
scrollBarOptions: Ue,
|
|
978
|
+
behaviorOptions: it,
|
|
979
|
+
preserveScrollAnchor: ct = !1,
|
|
980
|
+
getItemKey: ur,
|
|
966
981
|
// 素通しの pass-through。型で受け付けているものは実際に転送する
|
|
967
982
|
// (`role="tree"` は本コンポーネント自身のコンテナに付くため contentProps とは別要素で衝突しない)
|
|
968
|
-
testId:
|
|
969
|
-
contentProps:
|
|
970
|
-
} =
|
|
971
|
-
(
|
|
972
|
-
|
|
983
|
+
testId: dt,
|
|
984
|
+
contentProps: Xe
|
|
985
|
+
} = ue ?? {}, ut = Z(() => m ? { role: "rowgroup", ...Xe } : Xe, [m, Xe]), [$e, Je] = ce(typeof ie == "number" ? ie : 0), qe = ne(typeof ie == "number" ? ie : 0), ft = F(
|
|
986
|
+
(o, x) => {
|
|
987
|
+
qe.current = o, Je(o), De?.(o, x);
|
|
973
988
|
},
|
|
974
|
-
[
|
|
975
|
-
),
|
|
976
|
-
(
|
|
977
|
-
const { renderingStartIndex:
|
|
978
|
-
|
|
989
|
+
[De]
|
|
990
|
+
), mt = F(
|
|
991
|
+
(o) => {
|
|
992
|
+
const { renderingStartIndex: x, renderingEndIndex: M } = o;
|
|
993
|
+
Ve((W) => W && W.renderStart === x && W.renderEnd === M ? W : { renderStart: x, renderEnd: M }), Oe?.(o);
|
|
979
994
|
},
|
|
980
|
-
[
|
|
995
|
+
[Oe]
|
|
981
996
|
);
|
|
982
997
|
me(() => {
|
|
983
|
-
typeof
|
|
984
|
-
}, [
|
|
985
|
-
|
|
998
|
+
typeof ie == "number" && Je(ie);
|
|
999
|
+
}, [ie]), me(() => {
|
|
1000
|
+
A(!0), Jr();
|
|
986
1001
|
}, []), me(() => {
|
|
987
|
-
const
|
|
988
|
-
if (
|
|
989
|
-
const
|
|
990
|
-
|
|
1002
|
+
const o = se.current, x = m ? le.current : o, M = () => {
|
|
1003
|
+
if (o) {
|
|
1004
|
+
const X = o.clientWidth;
|
|
1005
|
+
Ne((re) => Math.abs(re - X) > 1 ? X : re);
|
|
991
1006
|
}
|
|
992
|
-
if (typeof
|
|
993
|
-
|
|
994
|
-
else if (
|
|
995
|
-
const
|
|
996
|
-
|
|
1007
|
+
if (typeof oe == "number")
|
|
1008
|
+
H((X) => Math.abs(X - oe) > 1 ? oe : X);
|
|
1009
|
+
else if (x) {
|
|
1010
|
+
const X = x.clientHeight;
|
|
1011
|
+
H((re) => Math.abs(re - X) > 1 ? X : re);
|
|
997
1012
|
}
|
|
998
1013
|
};
|
|
999
|
-
if (!(
|
|
1000
|
-
|
|
1001
|
-
const
|
|
1002
|
-
return
|
|
1003
|
-
}, [
|
|
1004
|
-
const
|
|
1014
|
+
if (!(o || x)) return H(0);
|
|
1015
|
+
M();
|
|
1016
|
+
const W = new ResizeObserver(M);
|
|
1017
|
+
return o && W.observe(o), x && x !== o && W.observe(x), () => W.disconnect();
|
|
1018
|
+
}, [oe, m]);
|
|
1019
|
+
const xe = typeof oe == "number" ? oe : z, fe = F((o) => c || (T ? a(o) : !1), [T, a, c]), ht = _(D.container, l && D.containerPending, w), pt = Z(
|
|
1005
1020
|
() => ({
|
|
1006
|
-
...
|
|
1007
|
-
...
|
|
1008
|
-
...typeof
|
|
1021
|
+
...Xr,
|
|
1022
|
+
...E ?? {},
|
|
1023
|
+
...typeof oe == "number" ? { height: oe, minHeight: oe } : {}
|
|
1009
1024
|
}),
|
|
1010
|
-
[
|
|
1011
|
-
),
|
|
1012
|
-
(
|
|
1013
|
-
const
|
|
1014
|
-
if (
|
|
1015
|
-
if (
|
|
1016
|
-
if (
|
|
1017
|
-
console.warn(`[DirectoryTree] Unknown double click action: ${
|
|
1025
|
+
[E, oe]
|
|
1026
|
+
), Ze = F(
|
|
1027
|
+
(o, x) => {
|
|
1028
|
+
const M = [o.absolutePath, ...dr(o)], W = x || u;
|
|
1029
|
+
if (M.every((pe) => fe(pe))) return r(M);
|
|
1030
|
+
if (M.every((pe) => !fe(pe)) || W === "recursive") return n(M);
|
|
1031
|
+
if (W === "toggle") return r(M);
|
|
1032
|
+
console.warn(`[DirectoryTree] Unknown double click action: ${W}. No action taken.`);
|
|
1018
1033
|
},
|
|
1019
|
-
[
|
|
1020
|
-
),
|
|
1021
|
-
() =>
|
|
1022
|
-
const
|
|
1023
|
-
return { ...
|
|
1034
|
+
[fe, n, r, u]
|
|
1035
|
+
), yt = m ? !1 : K, { flatItems: we, lineItems: Ke, maxIndent: xt } = Z(() => qr(e, fe, R, yt, s), [e, fe, R, yt, s]), U = Z(
|
|
1036
|
+
() => we.map((o, x) => {
|
|
1037
|
+
const M = typeof O == "function" ? O(o.entry, x) : O;
|
|
1038
|
+
return { ...o, rowHeight: Number.isFinite(M) && M > 0 ? M : Ye };
|
|
1024
1039
|
}),
|
|
1025
|
-
[
|
|
1026
|
-
),
|
|
1027
|
-
const
|
|
1028
|
-
|
|
1029
|
-
for (let
|
|
1030
|
-
|
|
1031
|
-
return
|
|
1032
|
-
}, [
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
+
[we, O]
|
|
1041
|
+
), be = Z(() => U.map((o) => o.rowHeight), [U]), ke = Z(() => {
|
|
1042
|
+
const o = new Array(be.length + 1);
|
|
1043
|
+
o[0] = 0;
|
|
1044
|
+
for (let x = 0; x < be.length; x++)
|
|
1045
|
+
o[x + 1] = o[x] + be[x];
|
|
1046
|
+
return o;
|
|
1047
|
+
}, [be]), bt = F((o) => U[o]?.rowHeight ?? Ye, [U]), fr = F((o) => U[o]?.entry.absolutePath ?? o, [U]), vt = ur ?? fr, gt = ne(we);
|
|
1048
|
+
gt.current = we;
|
|
1049
|
+
const wt = ne(fe);
|
|
1050
|
+
wt.current = fe;
|
|
1051
|
+
const Qe = ne(t);
|
|
1052
|
+
Qe.current = t;
|
|
1053
|
+
const [kt, St] = ce(0), et = ne(/* @__PURE__ */ new Map()), tt = ne(null), It = F((o, x) => {
|
|
1054
|
+
x ? (et.current.set(o, x), tt.current === o && (tt.current = null, x.focus())) : et.current.delete(o);
|
|
1055
|
+
}, []), Se = F((o) => {
|
|
1056
|
+
St(o);
|
|
1057
|
+
const x = et.current.get(o);
|
|
1058
|
+
if (x) {
|
|
1059
|
+
x.focus();
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
tt.current = o, b.current?.scrollToIndex(o);
|
|
1063
|
+
}, []);
|
|
1064
|
+
me(() => {
|
|
1065
|
+
St((o) => we.length === 0 ? 0 : Math.min(o, we.length - 1));
|
|
1066
|
+
}, [we.length]);
|
|
1067
|
+
const Et = F(
|
|
1068
|
+
(o, x) => {
|
|
1069
|
+
const M = gt.current, W = M.length - 1;
|
|
1070
|
+
if (W < 0) return;
|
|
1071
|
+
const X = M[x], re = X?.entry.children !== void 0, pe = re && wt.current(X.entry.absolutePath);
|
|
1072
|
+
switch (o.key) {
|
|
1073
|
+
case "ArrowDown":
|
|
1074
|
+
o.preventDefault(), Se(Math.min(x + 1, W));
|
|
1075
|
+
break;
|
|
1076
|
+
case "ArrowUp":
|
|
1077
|
+
o.preventDefault(), Se(Math.max(x - 1, 0));
|
|
1078
|
+
break;
|
|
1079
|
+
case "Home":
|
|
1080
|
+
o.preventDefault(), Se(0);
|
|
1081
|
+
break;
|
|
1082
|
+
case "End":
|
|
1083
|
+
o.preventDefault(), Se(W);
|
|
1084
|
+
break;
|
|
1085
|
+
case "ArrowRight":
|
|
1086
|
+
o.preventDefault(), re && !pe ? Qe.current(X.entry.absolutePath) : re && x < W && Se(x + 1);
|
|
1087
|
+
break;
|
|
1088
|
+
case "ArrowLeft": {
|
|
1089
|
+
if (o.preventDefault(), re && pe) {
|
|
1090
|
+
Qe.current(X.entry.absolutePath);
|
|
1091
|
+
break;
|
|
1092
|
+
}
|
|
1093
|
+
const Pe = X?.depth ?? 0;
|
|
1094
|
+
for (let Ie = x - 1; Ie >= 0; Ie--)
|
|
1095
|
+
if (M[Ie].depth < Pe) {
|
|
1096
|
+
Se(Ie);
|
|
1097
|
+
break;
|
|
1098
|
+
}
|
|
1099
|
+
break;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
},
|
|
1103
|
+
[Se]
|
|
1104
|
+
), He = Z(
|
|
1105
|
+
() => !R || Ke.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : Kr(Ke, be, ke, Ge, R, P ?? Jt),
|
|
1106
|
+
[Ke, be, ke, R, P]
|
|
1107
|
+
), We = Z(() => !R || e.length === 0 ? 0 : (xt + 2) * Ge, [e.length, xt, R]), { renderStart: Nt, renderEnd: jt, lookaheadEnd: Rt } = Z(
|
|
1108
|
+
() => Zr(U.length, xe, je, ae, $e, ke),
|
|
1109
|
+
[U.length, xe, je, ae, $e, ke]
|
|
1110
|
+
), rt = Z(() => !R || We <= 0 || xe <= 0 || He.segmentsByItem.length === 0 ? null : /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ i.jsx("div", { className: "absolute top-0 left-0", style: { width: We, height: xe }, children: /* @__PURE__ */ i.jsx(
|
|
1111
|
+
cr,
|
|
1040
1112
|
{
|
|
1041
|
-
segmentsByItem:
|
|
1042
|
-
glyphsByItem:
|
|
1043
|
-
itemHeight:
|
|
1044
|
-
width:
|
|
1045
|
-
viewportHeight:
|
|
1046
|
-
scrollPosition:
|
|
1113
|
+
segmentsByItem: He.segmentsByItem,
|
|
1114
|
+
glyphsByItem: He.glyphsByItem,
|
|
1115
|
+
itemHeight: be[0] ?? Ye,
|
|
1116
|
+
width: We,
|
|
1117
|
+
viewportHeight: xe,
|
|
1118
|
+
scrollPosition: $e,
|
|
1047
1119
|
color: k,
|
|
1048
1120
|
expandGlyphColor: k,
|
|
1049
|
-
expandGlyphSize:
|
|
1050
|
-
renderStartIndex:
|
|
1051
|
-
renderEndIndex:
|
|
1052
|
-
lookaheadEndIndex:
|
|
1121
|
+
expandGlyphSize: P ?? Jt,
|
|
1122
|
+
renderStartIndex: Nt,
|
|
1123
|
+
renderEndIndex: jt,
|
|
1124
|
+
lookaheadEndIndex: Rt
|
|
1053
1125
|
}
|
|
1054
|
-
) }) }), [
|
|
1055
|
-
|
|
1056
|
-
const
|
|
1057
|
-
if (
|
|
1126
|
+
) }) }), [We, xe, Nt, jt, Rt, $e, He, k, R, P, be]), Tt = F((o) => U[o], [U]), Pt = ne(null);
|
|
1127
|
+
br(() => {
|
|
1128
|
+
const o = Pt.current;
|
|
1129
|
+
if (Pt.current = { items: U, offsets: ke }, !ct || !o || o.items === U)
|
|
1058
1130
|
return;
|
|
1059
|
-
const
|
|
1060
|
-
if (!
|
|
1131
|
+
const x = b.current, M = typeof he == "number" ? he : he?.top ?? 0, W = x ? x.getScrollPosition() : qe.current, X = W - M, re = Hr(o.items, o.offsets, X);
|
|
1132
|
+
if (!re)
|
|
1061
1133
|
return;
|
|
1062
|
-
const
|
|
1063
|
-
if (
|
|
1134
|
+
const pe = Wr(re, U, ke);
|
|
1135
|
+
if (pe === null)
|
|
1064
1136
|
return;
|
|
1065
|
-
const
|
|
1066
|
-
if (Math.abs(
|
|
1137
|
+
const Pe = pe + M;
|
|
1138
|
+
if (Math.abs(Pe - W) < 1)
|
|
1067
1139
|
return;
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1070
|
-
}, [
|
|
1071
|
-
const
|
|
1140
|
+
const Ie = x?.scrollTo(Pe) ?? Pe;
|
|
1141
|
+
qe.current = Ie, Je(Ie);
|
|
1142
|
+
}, [U, ke, ct, he]);
|
|
1143
|
+
const ve = C?.columns, Re = C?.scrollBarWidth ?? Ue?.width ?? ir, q = Z(() => ve ? Fr({ measuredWidth: V, columns: ve, scrollBarWidth: Re }) : null, [ve, V, Re]), Be = Z(() => ve ? Or(ve) : "", [ve]), mr = Z(() => C?.showFooter && ve ? Lr(e) : [], [C?.showFooter, ve, e]), Te = q?.maxHScroll ?? 0;
|
|
1072
1144
|
me(() => {
|
|
1073
|
-
|
|
1074
|
-
}, [
|
|
1075
|
-
const
|
|
1076
|
-
() => ({ iconOverrides:
|
|
1077
|
-
[
|
|
1078
|
-
),
|
|
1145
|
+
ge((o) => nt(o, Te));
|
|
1146
|
+
}, [Te]);
|
|
1147
|
+
const Ct = F((o) => ge((x) => nt(x + o, Te)), [Te]), _t = Z(
|
|
1148
|
+
() => ({ iconOverrides: L, showExpandIcons: N, showDirectoryIcons: S, showFileIcons: p, useCanvasExpandIcons: R, expandIconSize: P, highlightStyles: Q }),
|
|
1149
|
+
[L, N, S, p, R, P, Q]
|
|
1150
|
+
), At = Z(
|
|
1079
1151
|
() => /* @__PURE__ */ i.jsx(
|
|
1080
|
-
|
|
1152
|
+
wr,
|
|
1081
1153
|
{
|
|
1082
|
-
ref:
|
|
1083
|
-
itemCount:
|
|
1084
|
-
getItem:
|
|
1085
|
-
getItemHeight:
|
|
1086
|
-
getItemKey:
|
|
1087
|
-
testId:
|
|
1088
|
-
contentProps:
|
|
1089
|
-
viewportSize:
|
|
1090
|
-
overscanCount:
|
|
1091
|
-
onScroll:
|
|
1092
|
-
onRangeChange:
|
|
1093
|
-
className:
|
|
1094
|
-
onWheelHorizontal:
|
|
1154
|
+
ref: b,
|
|
1155
|
+
itemCount: U.length,
|
|
1156
|
+
getItem: Tt,
|
|
1157
|
+
getItemHeight: bt,
|
|
1158
|
+
getItemKey: vt,
|
|
1159
|
+
testId: dt,
|
|
1160
|
+
contentProps: ut,
|
|
1161
|
+
viewportSize: xe,
|
|
1162
|
+
overscanCount: je,
|
|
1163
|
+
onScroll: ft,
|
|
1164
|
+
onRangeChange: mt,
|
|
1165
|
+
className: Ae,
|
|
1166
|
+
onWheelHorizontal: m ? Ct : void 0,
|
|
1095
1167
|
background: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
1096
|
-
|
|
1168
|
+
m && q ? (
|
|
1097
1169
|
// Clip the connector-line canvas to the frozen name column so deep trees never bleed into the numeric region.
|
|
1098
|
-
/* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width:
|
|
1099
|
-
) :
|
|
1100
|
-
|
|
1170
|
+
/* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: q.nameWidth }, "aria-hidden": "true", children: rt })
|
|
1171
|
+
) : rt,
|
|
1172
|
+
Me
|
|
1101
1173
|
] }),
|
|
1102
|
-
initialScrollIndex:
|
|
1103
|
-
initialScrollOffset:
|
|
1104
|
-
onItemFocus:
|
|
1105
|
-
callbackThrottleMs:
|
|
1106
|
-
contentInsets:
|
|
1107
|
-
scrollBarOptions:
|
|
1108
|
-
behaviorOptions:
|
|
1109
|
-
children: (
|
|
1110
|
-
|
|
1174
|
+
initialScrollIndex: Fe,
|
|
1175
|
+
initialScrollOffset: ie,
|
|
1176
|
+
onItemFocus: te,
|
|
1177
|
+
callbackThrottleMs: Le,
|
|
1178
|
+
contentInsets: he,
|
|
1179
|
+
scrollBarOptions: Ue,
|
|
1180
|
+
behaviorOptions: it,
|
|
1181
|
+
children: (o, x) => o ? m && C && q ? /* @__PURE__ */ i.jsx(
|
|
1182
|
+
ar,
|
|
1111
1183
|
{
|
|
1112
|
-
entry:
|
|
1113
|
-
indentLevel:
|
|
1114
|
-
positionInSet:
|
|
1115
|
-
setSize:
|
|
1116
|
-
rowIndex:
|
|
1117
|
-
isSelectedForAria:
|
|
1118
|
-
rowHeight:
|
|
1119
|
-
isDirOpen:
|
|
1120
|
-
columns:
|
|
1121
|
-
numericTemplate:
|
|
1122
|
-
numericTotal:
|
|
1123
|
-
nameWidth:
|
|
1124
|
-
rowClassName:
|
|
1125
|
-
selection: { onEntryClick:
|
|
1126
|
-
expansion: { toggleDirectory: t, onToggleDirectoryRecursive:
|
|
1127
|
-
visual:
|
|
1184
|
+
entry: o.entry,
|
|
1185
|
+
indentLevel: o.indentLevel,
|
|
1186
|
+
positionInSet: o.positionInSet,
|
|
1187
|
+
setSize: o.setSize,
|
|
1188
|
+
rowIndex: x + (C.showHeader ?? !0 ? 2 : 1),
|
|
1189
|
+
isSelectedForAria: !!h?.has(o.entry.absolutePath),
|
|
1190
|
+
rowHeight: o.rowHeight,
|
|
1191
|
+
isDirOpen: fe,
|
|
1192
|
+
columns: C.columns,
|
|
1193
|
+
numericTemplate: Be,
|
|
1194
|
+
numericTotal: q.numericTotal,
|
|
1195
|
+
nameWidth: q.nameWidth,
|
|
1196
|
+
rowClassName: C.rowClassName,
|
|
1197
|
+
selection: { onEntryClick: j, selectedPath: v ?? null, mode: d, selectedItems: h, onSelectionChange: g },
|
|
1198
|
+
expansion: { toggleDirectory: t, onToggleDirectoryRecursive: Ze },
|
|
1199
|
+
visual: _t
|
|
1128
1200
|
},
|
|
1129
|
-
|
|
1201
|
+
o.entry.absolutePath
|
|
1130
1202
|
) : /* @__PURE__ */ i.jsx(
|
|
1131
|
-
|
|
1203
|
+
lt,
|
|
1132
1204
|
{
|
|
1133
|
-
entry:
|
|
1134
|
-
indentLevel:
|
|
1135
|
-
depth:
|
|
1136
|
-
positionInSet:
|
|
1137
|
-
setSize:
|
|
1138
|
-
isSelectedForAria:
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1205
|
+
entry: o.entry,
|
|
1206
|
+
indentLevel: o.indentLevel,
|
|
1207
|
+
depth: o.depth,
|
|
1208
|
+
positionInSet: o.positionInSet,
|
|
1209
|
+
setSize: o.setSize,
|
|
1210
|
+
isSelectedForAria: !!h?.has(o.entry.absolutePath),
|
|
1211
|
+
flatIndex: x,
|
|
1212
|
+
isActive: x === kt,
|
|
1213
|
+
registerRowRef: It,
|
|
1214
|
+
onNavigationKeyDown: Et,
|
|
1215
|
+
rowHeight: o.rowHeight,
|
|
1216
|
+
isDirOpen: fe,
|
|
1217
|
+
parentIsLast: o.parentIsLast,
|
|
1142
1218
|
renderChildren: !1,
|
|
1143
|
-
expansion: { toggleDirectory: t, onToggleDirectoryRecursive:
|
|
1144
|
-
selection: { onEntryClick:
|
|
1219
|
+
expansion: { toggleDirectory: t, onToggleDirectoryRecursive: Ze },
|
|
1220
|
+
selection: { onEntryClick: j, selectedPath: v ?? null, mode: d, selectedItems: h, onSelectionChange: g },
|
|
1145
1221
|
visual: {
|
|
1146
|
-
iconOverrides:
|
|
1222
|
+
iconOverrides: L,
|
|
1147
1223
|
showExpandIcons: N,
|
|
1148
|
-
showDirectoryIcons:
|
|
1149
|
-
showFileIcons:
|
|
1150
|
-
useCanvasExpandIcons:
|
|
1151
|
-
expandIconSize:
|
|
1152
|
-
highlightStyles:
|
|
1153
|
-
entryClassName:
|
|
1154
|
-
entryStyle:
|
|
1155
|
-
nameClassName:
|
|
1156
|
-
nameStyle:
|
|
1157
|
-
directoryNameClassName:
|
|
1224
|
+
showDirectoryIcons: S,
|
|
1225
|
+
showFileIcons: p,
|
|
1226
|
+
useCanvasExpandIcons: R,
|
|
1227
|
+
expandIconSize: P,
|
|
1228
|
+
highlightStyles: Q,
|
|
1229
|
+
entryClassName: $,
|
|
1230
|
+
entryStyle: J,
|
|
1231
|
+
nameClassName: ee,
|
|
1232
|
+
nameStyle: I,
|
|
1233
|
+
directoryNameClassName: Y,
|
|
1158
1234
|
directoryNameStyle: B,
|
|
1159
|
-
fileNameClassName:
|
|
1160
|
-
fileNameStyle:
|
|
1235
|
+
fileNameClassName: G,
|
|
1236
|
+
fileNameStyle: de
|
|
1161
1237
|
}
|
|
1162
1238
|
},
|
|
1163
|
-
|
|
1239
|
+
o.entry.absolutePath
|
|
1164
1240
|
) : null
|
|
1165
1241
|
}
|
|
1166
1242
|
),
|
|
1167
1243
|
[
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
ft,
|
|
1172
|
-
nt,
|
|
1173
|
-
st,
|
|
1174
|
-
fe,
|
|
1175
|
-
Se,
|
|
1176
|
-
at,
|
|
1177
|
-
ot,
|
|
1178
|
-
Re,
|
|
1179
|
-
p,
|
|
1244
|
+
U.length,
|
|
1245
|
+
Tt,
|
|
1246
|
+
bt,
|
|
1180
1247
|
vt,
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1248
|
+
dt,
|
|
1249
|
+
ut,
|
|
1250
|
+
kt,
|
|
1251
|
+
It,
|
|
1252
|
+
Et,
|
|
1253
|
+
xe,
|
|
1254
|
+
je,
|
|
1255
|
+
ft,
|
|
1256
|
+
mt,
|
|
1257
|
+
Ae,
|
|
1258
|
+
m,
|
|
1259
|
+
Ct,
|
|
1260
|
+
q,
|
|
1261
|
+
rt,
|
|
1262
|
+
Me,
|
|
1192
1263
|
Fe,
|
|
1264
|
+
ie,
|
|
1265
|
+
te,
|
|
1266
|
+
Le,
|
|
1193
1267
|
he,
|
|
1194
|
-
|
|
1195
|
-
|
|
1268
|
+
Ue,
|
|
1269
|
+
it,
|
|
1270
|
+
C,
|
|
1271
|
+
Be,
|
|
1272
|
+
fe,
|
|
1273
|
+
j,
|
|
1274
|
+
v,
|
|
1196
1275
|
d,
|
|
1197
|
-
|
|
1276
|
+
h,
|
|
1198
1277
|
g,
|
|
1199
1278
|
t,
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1279
|
+
Ze,
|
|
1280
|
+
_t,
|
|
1281
|
+
L,
|
|
1203
1282
|
N,
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
I,
|
|
1207
|
-
C,
|
|
1208
|
-
F,
|
|
1209
|
-
H,
|
|
1210
|
-
q,
|
|
1211
|
-
K,
|
|
1283
|
+
S,
|
|
1284
|
+
p,
|
|
1212
1285
|
R,
|
|
1213
|
-
|
|
1214
|
-
|
|
1286
|
+
P,
|
|
1287
|
+
Q,
|
|
1288
|
+
$,
|
|
1289
|
+
J,
|
|
1290
|
+
ee,
|
|
1291
|
+
I,
|
|
1215
1292
|
Y,
|
|
1216
|
-
|
|
1293
|
+
B,
|
|
1294
|
+
G,
|
|
1295
|
+
de
|
|
1217
1296
|
]
|
|
1218
1297
|
);
|
|
1219
|
-
if (!(
|
|
1220
|
-
return /* @__PURE__ */ i.jsx("div", { ref:
|
|
1221
|
-
const
|
|
1298
|
+
if (!(C && q))
|
|
1299
|
+
return /* @__PURE__ */ i.jsx("div", { ref: se, className: ht, style: pt, role: "tree", "aria-label": y ? void 0 : f, "aria-labelledby": y, "aria-multiselectable": d === "multiple" ? !0 : void 0, children: At });
|
|
1300
|
+
const hr = C.showHeader ?? !0, pr = C.showFooter ?? !1, yr = { ...pt, "--dt-hscroll": `${ye}px` };
|
|
1222
1301
|
return /* @__PURE__ */ i.jsxs(
|
|
1223
1302
|
"div",
|
|
1224
1303
|
{
|
|
1225
|
-
ref:
|
|
1226
|
-
className: _(
|
|
1227
|
-
style:
|
|
1304
|
+
ref: se,
|
|
1305
|
+
className: _(ht, "dt-grid"),
|
|
1306
|
+
style: yr,
|
|
1228
1307
|
role: "treegrid",
|
|
1229
|
-
"aria-label":
|
|
1230
|
-
"aria-labelledby":
|
|
1308
|
+
"aria-label": y ? void 0 : f,
|
|
1309
|
+
"aria-labelledby": y,
|
|
1231
1310
|
"aria-multiselectable": d === "multiple" ? !0 : void 0,
|
|
1232
|
-
"aria-rowcount":
|
|
1311
|
+
"aria-rowcount": U.length + (C.showHeader ?? !0 ? 1 : 0),
|
|
1233
1312
|
children: [
|
|
1234
|
-
|
|
1235
|
-
/* @__PURE__ */ i.jsx("div", {
|
|
1236
|
-
|
|
1237
|
-
|
|
1313
|
+
hr && // biome-ignore lint/a11y/useSemanticElements: 仮想スクロールの treegrid は絶対配置行を使うため native table 要素にできない。ARIA ロールで意味を提供する
|
|
1314
|
+
/* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Ar, { columns: C.columns, numericTemplate: Be, numericTotal: q.numericTotal, nameWidth: q.nameWidth, scrollBarWidth: Re, className: C.headerClassName }) }),
|
|
1315
|
+
/* @__PURE__ */ i.jsx("div", { ref: le, className: "dt-grid-body", children: At }),
|
|
1316
|
+
Te > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
|
|
1317
|
+
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: q.nameWidth }, "aria-hidden": "true" }),
|
|
1238
1318
|
/* @__PURE__ */ i.jsx(
|
|
1239
|
-
|
|
1319
|
+
kr,
|
|
1240
1320
|
{
|
|
1241
1321
|
horizontal: !0,
|
|
1242
|
-
contentSize:
|
|
1243
|
-
viewportSize:
|
|
1244
|
-
scrollPosition:
|
|
1245
|
-
scrollBarWidth:
|
|
1246
|
-
onScroll: (
|
|
1247
|
-
const
|
|
1248
|
-
return
|
|
1322
|
+
contentSize: q.numericTotal,
|
|
1323
|
+
viewportSize: q.numericVisible,
|
|
1324
|
+
scrollPosition: ye,
|
|
1325
|
+
scrollBarWidth: Re,
|
|
1326
|
+
onScroll: (o) => {
|
|
1327
|
+
const x = typeof o == "function" ? o(ye) : o, M = nt(x, Te);
|
|
1328
|
+
return ge(M), M;
|
|
1249
1329
|
}
|
|
1250
1330
|
}
|
|
1251
1331
|
),
|
|
1252
|
-
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width:
|
|
1332
|
+
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: Re }, "aria-hidden": "true" })
|
|
1253
1333
|
] }),
|
|
1254
|
-
|
|
1334
|
+
pr && // biome-ignore lint/a11y/useSemanticElements: 同上 (フッタ行も絶対配置レイアウトの一部)
|
|
1335
|
+
/* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Mr, { columns: C.columns, numericTemplate: Be, numericTotal: q.numericTotal, nameWidth: q.nameWidth, scrollBarWidth: Re, allEntries: mr, className: C.footerClassName }) })
|
|
1255
1336
|
]
|
|
1256
1337
|
}
|
|
1257
1338
|
);
|
|
1258
|
-
},
|
|
1259
|
-
const [a, n] =
|
|
1339
|
+
}, an = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
|
|
1340
|
+
const [a, n] = gr(), [r, l] = ce(() => {
|
|
1260
1341
|
if (typeof window < "u" && t)
|
|
1261
1342
|
try {
|
|
1262
|
-
const
|
|
1263
|
-
if (
|
|
1264
|
-
const
|
|
1265
|
-
return new Set(
|
|
1343
|
+
const f = window.localStorage.getItem(t);
|
|
1344
|
+
if (f) {
|
|
1345
|
+
const y = JSON.parse(f);
|
|
1346
|
+
return new Set(y);
|
|
1266
1347
|
}
|
|
1267
|
-
} catch (
|
|
1268
|
-
console.error("[useDirectoryTreeState] Error reading from localStorage",
|
|
1348
|
+
} catch (f) {
|
|
1349
|
+
console.error("[useDirectoryTreeState] Error reading from localStorage", f);
|
|
1269
1350
|
}
|
|
1270
1351
|
return e;
|
|
1271
|
-
}),
|
|
1352
|
+
}), c = F((f) => {
|
|
1272
1353
|
n(() => {
|
|
1273
|
-
|
|
1274
|
-
const k = new Set(
|
|
1275
|
-
return
|
|
1354
|
+
l((y) => {
|
|
1355
|
+
const k = new Set(y);
|
|
1356
|
+
return f(k), k;
|
|
1276
1357
|
});
|
|
1277
1358
|
});
|
|
1278
|
-
}, []), u =
|
|
1279
|
-
(
|
|
1280
|
-
|
|
1281
|
-
for (const
|
|
1282
|
-
|
|
1359
|
+
}, []), u = F(
|
|
1360
|
+
(f, y) => {
|
|
1361
|
+
c((k) => {
|
|
1362
|
+
for (const R of f)
|
|
1363
|
+
y(k, R);
|
|
1283
1364
|
});
|
|
1284
1365
|
},
|
|
1285
|
-
[
|
|
1366
|
+
[c]
|
|
1286
1367
|
);
|
|
1287
1368
|
me(() => {
|
|
1288
1369
|
if (t && typeof window < "u")
|
|
1289
1370
|
try {
|
|
1290
1371
|
window.localStorage.setItem(t, JSON.stringify(Array.from(r)));
|
|
1291
|
-
} catch (
|
|
1292
|
-
console.warn(`Error setting localStorage key "${t}":`,
|
|
1372
|
+
} catch (f) {
|
|
1373
|
+
console.warn(`Error setting localStorage key "${t}":`, f);
|
|
1293
1374
|
}
|
|
1294
1375
|
}, [r, t]);
|
|
1295
|
-
const
|
|
1296
|
-
(
|
|
1297
|
-
u([
|
|
1298
|
-
|
|
1376
|
+
const j = F(
|
|
1377
|
+
(f) => {
|
|
1378
|
+
u([f], (y, k) => {
|
|
1379
|
+
y.has(k) ? y.delete(k) : y.add(k);
|
|
1299
1380
|
});
|
|
1300
1381
|
},
|
|
1301
1382
|
[u]
|
|
1302
|
-
),
|
|
1303
|
-
(
|
|
1304
|
-
u([
|
|
1305
|
-
|
|
1383
|
+
), v = F(
|
|
1384
|
+
(f) => {
|
|
1385
|
+
u([f], (y, k) => {
|
|
1386
|
+
y.add(k);
|
|
1306
1387
|
});
|
|
1307
1388
|
},
|
|
1308
1389
|
[u]
|
|
1309
|
-
), d =
|
|
1310
|
-
(
|
|
1311
|
-
u([
|
|
1312
|
-
|
|
1390
|
+
), d = F(
|
|
1391
|
+
(f) => {
|
|
1392
|
+
u([f], (y, k) => {
|
|
1393
|
+
y.delete(k);
|
|
1313
1394
|
});
|
|
1314
1395
|
},
|
|
1315
1396
|
[u]
|
|
1316
|
-
),
|
|
1317
|
-
(
|
|
1318
|
-
u(
|
|
1319
|
-
|
|
1397
|
+
), h = F(
|
|
1398
|
+
(f) => {
|
|
1399
|
+
u(f, (y, k) => {
|
|
1400
|
+
y.delete(k);
|
|
1320
1401
|
});
|
|
1321
1402
|
},
|
|
1322
1403
|
[u]
|
|
1323
|
-
), g =
|
|
1324
|
-
(
|
|
1325
|
-
u(
|
|
1326
|
-
|
|
1404
|
+
), g = F(
|
|
1405
|
+
(f) => {
|
|
1406
|
+
u(f, (y, k) => {
|
|
1407
|
+
y.add(k);
|
|
1327
1408
|
});
|
|
1328
1409
|
},
|
|
1329
1410
|
[u]
|
|
1330
|
-
),
|
|
1331
|
-
|
|
1332
|
-
|
|
1411
|
+
), w = F(() => {
|
|
1412
|
+
c((f) => {
|
|
1413
|
+
f.clear();
|
|
1333
1414
|
});
|
|
1334
|
-
}, [
|
|
1415
|
+
}, [c]), E = F((f) => r.has(f), [r]);
|
|
1335
1416
|
return {
|
|
1336
1417
|
expanded: r,
|
|
1337
|
-
toggle:
|
|
1338
|
-
expand:
|
|
1418
|
+
toggle: j,
|
|
1419
|
+
expand: v,
|
|
1339
1420
|
collapse: d,
|
|
1340
|
-
collapseMultiple:
|
|
1421
|
+
collapseMultiple: h,
|
|
1341
1422
|
expandMultiple: g,
|
|
1342
|
-
collapseAll:
|
|
1343
|
-
isExpanded:
|
|
1423
|
+
collapseAll: w,
|
|
1424
|
+
isExpanded: E,
|
|
1344
1425
|
isPending: a
|
|
1345
1426
|
};
|
|
1346
1427
|
};
|
|
1347
1428
|
export {
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1429
|
+
sn as DirectoryTree,
|
|
1430
|
+
D as directoryTreeClasses,
|
|
1431
|
+
an as useDirectoryTreeState
|
|
1351
1432
|
};
|