@aiquants/directory-tree 3.7.1 → 3.8.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 +364 -366
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/DirectoryTree.tsx +18 -22
- package/src/types.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { VirtualScroll as
|
|
3
|
-
import { twMerge as
|
|
4
|
-
import { FolderIcon as
|
|
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
|
|
1
|
+
import br, { useRef as ne, useEffect as me, useCallback as F, memo as at, useState as le, useMemo as K, useLayoutEffect as vr, Fragment as gr, useTransition as wr } from "react";
|
|
2
|
+
import { VirtualScroll as kr, ScrollBar as Sr } from "@aiquants/virtualscroll";
|
|
3
|
+
import { twMerge as A } from "tailwind-merge";
|
|
4
|
+
import { FolderIcon as Ir, ChevronDownIcon as Er, ChevronRightIcon as Nr } 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 jr } from "@phosphor-icons/react";
|
|
6
6
|
var ze = { exports: {} }, Ce = {};
|
|
7
7
|
var Vt;
|
|
8
|
-
function
|
|
8
|
+
function Rr() {
|
|
9
9
|
if (Vt) return Ce;
|
|
10
10
|
Vt = 1;
|
|
11
11
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
@@ -26,9 +26,9 @@ function jr() {
|
|
|
26
26
|
}
|
|
27
27
|
return Ce.Fragment = t, Ce.jsx = a, Ce.jsxs = a, Ce;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var Pe = {};
|
|
30
30
|
var Ut;
|
|
31
|
-
function
|
|
31
|
+
function Tr() {
|
|
32
32
|
return Ut || (Ut = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
33
33
|
function e(s) {
|
|
34
34
|
if (s == null) return null;
|
|
@@ -44,9 +44,9 @@ function Rr() {
|
|
|
44
44
|
return "StrictMode";
|
|
45
45
|
case L:
|
|
46
46
|
return "Suspense";
|
|
47
|
-
case
|
|
47
|
+
case C:
|
|
48
48
|
return "SuspenseList";
|
|
49
|
-
case
|
|
49
|
+
case ee:
|
|
50
50
|
return "Activity";
|
|
51
51
|
}
|
|
52
52
|
if (typeof s == "object")
|
|
@@ -64,7 +64,7 @@ function Rr() {
|
|
|
64
64
|
return s = s.displayName, s || (s = m.displayName || m.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
|
|
65
65
|
case O:
|
|
66
66
|
return m = s.displayName || null, m !== null ? m : e(s.type) || "Memo";
|
|
67
|
-
case
|
|
67
|
+
case Q:
|
|
68
68
|
m = s._payload, s = s._init;
|
|
69
69
|
try {
|
|
70
70
|
return e(s(m));
|
|
@@ -85,17 +85,17 @@ function Rr() {
|
|
|
85
85
|
}
|
|
86
86
|
if (m) {
|
|
87
87
|
m = console;
|
|
88
|
-
var T = m.error,
|
|
88
|
+
var T = m.error, M = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
|
|
89
89
|
return T.call(
|
|
90
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
|
+
M
|
|
93
93
|
), t(s);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
function n(s) {
|
|
97
97
|
if (s === y) return "<>";
|
|
98
|
-
if (typeof s == "object" && s !== null && s.$$typeof ===
|
|
98
|
+
if (typeof s == "object" && s !== null && s.$$typeof === Q)
|
|
99
99
|
return "<...>";
|
|
100
100
|
try {
|
|
101
101
|
var m = e(s);
|
|
@@ -112,7 +112,7 @@ function Rr() {
|
|
|
112
112
|
return Error("react-stack-top-frame");
|
|
113
113
|
}
|
|
114
114
|
function c(s) {
|
|
115
|
-
if (
|
|
115
|
+
if (te.call(s, "key")) {
|
|
116
116
|
var m = Object.getOwnPropertyDescriptor(s, "key").get;
|
|
117
117
|
if (m && m.isReactWarning) return !1;
|
|
118
118
|
}
|
|
@@ -136,14 +136,14 @@ function Rr() {
|
|
|
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 v(s, m, T,
|
|
139
|
+
function v(s, m, T, M, se, oe) {
|
|
140
140
|
var b = T.ref;
|
|
141
141
|
return s = {
|
|
142
142
|
$$typeof: E,
|
|
143
143
|
type: s,
|
|
144
144
|
key: m,
|
|
145
145
|
props: T,
|
|
146
|
-
_owner:
|
|
146
|
+
_owner: M
|
|
147
147
|
}, (b !== void 0 ? b : null) !== null ? Object.defineProperty(s, "ref", {
|
|
148
148
|
enumerable: !1,
|
|
149
149
|
get: j
|
|
@@ -166,39 +166,39 @@ function Rr() {
|
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
168
168
|
writable: !0,
|
|
169
|
-
value:
|
|
169
|
+
value: oe
|
|
170
170
|
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
171
171
|
}
|
|
172
|
-
function d(s, m, T,
|
|
172
|
+
function d(s, m, T, M, se, oe) {
|
|
173
173
|
var b = m.children;
|
|
174
174
|
if (b !== void 0)
|
|
175
|
-
if (
|
|
175
|
+
if (M)
|
|
176
176
|
if (I(b)) {
|
|
177
|
-
for (
|
|
178
|
-
h(b[
|
|
177
|
+
for (M = 0; M < b.length; M++)
|
|
178
|
+
h(b[M]);
|
|
179
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
184
|
else h(b);
|
|
185
|
-
if (
|
|
185
|
+
if (te.call(m, "key")) {
|
|
186
186
|
b = e(s);
|
|
187
187
|
var z = Object.keys(m).filter(function(V) {
|
|
188
188
|
return V !== "key";
|
|
189
189
|
});
|
|
190
|
-
|
|
190
|
+
M = 0 < z.length ? "{key: someKey, " + z.join(": ..., ") + ": ...}" : "{key: someKey}", P[b + M] || (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
|
-
|
|
197
|
+
M,
|
|
198
198
|
b,
|
|
199
199
|
z,
|
|
200
200
|
b
|
|
201
|
-
),
|
|
201
|
+
), P[b + M] = !0);
|
|
202
202
|
}
|
|
203
203
|
if (b = null, T !== void 0 && (a(T), b = "" + T), c(m) && (a(m.key), b = "" + m.key), "key" in m) {
|
|
204
204
|
T = {};
|
|
@@ -214,16 +214,16 @@ React keys must be passed directly to JSX without using spread:
|
|
|
214
214
|
T,
|
|
215
215
|
r(),
|
|
216
216
|
se,
|
|
217
|
-
|
|
217
|
+
oe
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
function h(s) {
|
|
221
|
-
g(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof ===
|
|
221
|
+
g(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === Q && (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
224
|
return typeof s == "object" && s !== null && s.$$typeof === E;
|
|
225
225
|
}
|
|
226
|
-
var w =
|
|
226
|
+
var w = br, 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"), C = /* @__PURE__ */ Symbol.for("react.suspense_list"), O = /* @__PURE__ */ Symbol.for("react.memo"), Q = /* @__PURE__ */ Symbol.for("react.lazy"), ee = /* @__PURE__ */ Symbol.for("react.activity"), $ = /* @__PURE__ */ Symbol.for("react.client.reference"), J = w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, I = Array.isArray, Y = console.createTask ? console.createTask : function() {
|
|
227
227
|
return null;
|
|
228
228
|
};
|
|
229
229
|
w = {
|
|
@@ -231,65 +231,65 @@ React keys must be passed directly to JSX without using spread:
|
|
|
231
231
|
return s();
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
var B, G = {},
|
|
234
|
+
var B, G = {}, ie = w.react_stack_bottom_frame.bind(
|
|
235
235
|
w,
|
|
236
236
|
l
|
|
237
|
-
)(),
|
|
238
|
-
|
|
239
|
-
var
|
|
237
|
+
)(), ce = Y(n(l)), P = {};
|
|
238
|
+
Pe.Fragment = y, Pe.jsx = function(s, m, T) {
|
|
239
|
+
var M = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
240
240
|
return d(
|
|
241
241
|
s,
|
|
242
242
|
m,
|
|
243
243
|
T,
|
|
244
244
|
!1,
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
M ? Error("react-stack-top-frame") : ie,
|
|
246
|
+
M ? Y(n(s)) : ce
|
|
247
247
|
);
|
|
248
|
-
},
|
|
249
|
-
var
|
|
248
|
+
}, Pe.jsxs = function(s, m, T) {
|
|
249
|
+
var M = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
250
250
|
return d(
|
|
251
251
|
s,
|
|
252
252
|
m,
|
|
253
253
|
T,
|
|
254
254
|
!0,
|
|
255
|
-
|
|
256
|
-
|
|
255
|
+
M ? Error("react-stack-top-frame") : ie,
|
|
256
|
+
M ? Y(n(s)) : ce
|
|
257
257
|
);
|
|
258
258
|
};
|
|
259
|
-
})()),
|
|
259
|
+
})()), Pe;
|
|
260
260
|
}
|
|
261
261
|
var Xt;
|
|
262
|
-
function
|
|
263
|
-
return Xt || (Xt = 1, process.env.NODE_ENV === "production" ? ze.exports =
|
|
262
|
+
function Cr() {
|
|
263
|
+
return Xt || (Xt = 1, process.env.NODE_ENV === "production" ? ze.exports = Rr() : ze.exports = Tr()), ze.exports;
|
|
264
264
|
}
|
|
265
|
-
var i =
|
|
265
|
+
var i = Cr();
|
|
266
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",
|
|
270
270
|
// ホバー時のスタイル(ライト/ダークモード対応)
|
|
271
|
-
entryHover:
|
|
271
|
+
entryHover: A("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
|
|
272
272
|
// 選択時のスタイル(ライト/ダークモード対応)
|
|
273
|
-
entrySelected:
|
|
273
|
+
entrySelected: A("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
|
|
274
274
|
// アイテム選択時のスタイル(ライト/ダークモード対応)
|
|
275
|
-
entryItemSelected:
|
|
275
|
+
entryItemSelected: A("directory-tree-entry--item-selected bg-blue-400/20 shadow-[0_0_0_1px_rgba(59,130,246,0.3)]", "dark:bg-blue-400/25 dark:shadow-[0_0_0_1px_rgba(96,165,250,0.4)]"),
|
|
276
276
|
// アイコンのスタイル
|
|
277
|
-
expandIcon:
|
|
278
|
-
expandIconSelected:
|
|
279
|
-
typeIcon:
|
|
280
|
-
typeIconSelected:
|
|
277
|
+
expandIcon: A("directory-tree-expand-icon w-3.5 h-3.5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
278
|
+
expandIconSelected: A("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
|
|
279
|
+
typeIcon: A("directory-tree-type-icon w-3.5 h-3.5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
280
|
+
typeIconSelected: A("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
|
|
281
281
|
// テキストのスタイル
|
|
282
|
-
name:
|
|
282
|
+
name: A("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
|
-
nameSelected:
|
|
285
|
-
},
|
|
284
|
+
nameSelected: A("directory-tree-name--selected text-blue-800 font-semibold", "dark:text-blue-300")
|
|
285
|
+
}, Se = (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
289
|
}, Qt = ({ isDirectory: e, isExpanded: t, showExpandIcons: a, useCanvasExpandIcons: n, expandIconSize: r }) => {
|
|
290
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(
|
|
292
|
-
},
|
|
291
|
+
return !(a && e) || n ? /* @__PURE__ */ i.jsx("span", { className: c, style: l, "aria-hidden": "true" }) : t ? /* @__PURE__ */ i.jsx(Er, { className: c, style: l }) : /* @__PURE__ */ i.jsx(Nr, { className: c, style: l });
|
|
292
|
+
}, nt = (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 Ye = 18, Ge = 12, Jt = 10, D = {
|
|
|
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) => nt(r, t)).filter(Boolean);
|
|
301
301
|
return n.length ? n : null;
|
|
302
302
|
}
|
|
303
303
|
const a = e.type;
|
|
@@ -306,7 +306,7 @@ const Ye = 18, Ge = 12, Jt = 10, D = {
|
|
|
306
306
|
}
|
|
307
307
|
return e;
|
|
308
308
|
}, Pr = (e, t, a) => {
|
|
309
|
-
const n = (t || (a ?
|
|
309
|
+
const n = (t || (a ? Se(a) : "")).toLowerCase(), r = (e || "").toLowerCase();
|
|
310
310
|
if (r && r !== "application/octet-stream") {
|
|
311
311
|
if (r === "text/markdown" || r === "text/x-markdown")
|
|
312
312
|
return /* @__PURE__ */ i.jsx(Mt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
|
|
@@ -359,19 +359,19 @@ const Ye = 18, Ge = 12, Jt = 10, D = {
|
|
|
359
359
|
if (["txt", "log"].includes(n))
|
|
360
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(
|
|
362
|
+
return /* @__PURE__ */ i.jsx(jr, { className: "h-4 w-4 text-gray-400 dark:text-gray-400" });
|
|
363
363
|
}, er = (e, t) => {
|
|
364
364
|
const { entry: a, isDirectory: n, isExpanded: r, extension: l, mimeType: c } = e;
|
|
365
365
|
let u;
|
|
366
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(
|
|
368
|
-
},
|
|
367
|
+
return a.icon !== void 0 ? u = a.icon : n ? u = r && t?.directoryExpanded || t?.directory || /* @__PURE__ */ i.jsx(Ir, { className: "h-4 w-4" }) : l && t?.fileByExtension?.[l] ? u = t.fileByExtension[l] : u = t?.file || Pr(j, l, a.name), nt(typeof u == "function" ? u(e) : u, a.absolutePath);
|
|
368
|
+
}, _r = (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
|
-
},
|
|
373
|
+
return Object.fromEntries(t.map(([a, n]) => [`data-${_r(a)}`, String(n)]));
|
|
374
|
+
}, Ar = 500, rr = ({ entry: e, isDirectory: t, isExpanded: a, isItemSelected: n, selectionMode: r, onSelectionChange: l, onEntryClick: c, toggleDirectory: u, onToggleDirectoryRecursive: j }) => {
|
|
375
375
|
const v = ne(null);
|
|
376
376
|
return me(
|
|
377
377
|
() => () => {
|
|
@@ -391,14 +391,14 @@ const Ye = 18, Ge = 12, Jt = 10, D = {
|
|
|
391
391
|
}
|
|
392
392
|
}), !(!t || h) && (v.current ? (window.clearTimeout(v.current), v.current = null, j(e)) : v.current = window.setTimeout(() => {
|
|
393
393
|
u(e.absolutePath), v.current = null;
|
|
394
|
-
},
|
|
394
|
+
}, Ar));
|
|
395
395
|
},
|
|
396
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
|
-
}), ar =
|
|
401
|
+
}), ar = at(
|
|
402
402
|
({
|
|
403
403
|
entry: e,
|
|
404
404
|
indentLevel: t,
|
|
@@ -415,15 +415,15 @@ const Ye = 18, Ge = 12, Jt = 10, D = {
|
|
|
415
415
|
rowClassName: g,
|
|
416
416
|
selection: { onEntryClick: w, selectedPath: E, mode: f = "none", selectedItems: y, onSelectionChange: k },
|
|
417
417
|
expansion: { toggleDirectory: R, onToggleDirectoryRecursive: N },
|
|
418
|
-
visual: { iconOverrides: S, showExpandIcons: p = !0, showDirectoryIcons: L = !0, showFileIcons:
|
|
418
|
+
visual: { iconOverrides: S, showExpandIcons: p = !0, showDirectoryIcons: L = !0, showFileIcons: C = !0, useCanvasExpandIcons: O = !1, expandIconSize: Q, indentSize: ee = Ge, highlightStyles: $ }
|
|
419
419
|
}) => {
|
|
420
|
-
const [J,
|
|
420
|
+
const [J, te] = le(!1), I = e.children !== void 0, Y = I && u(e.absolutePath), B = e.absolutePath === E, G = !I && !!y?.has(e.absolutePath), ie = I ? void 0 : Se(e.name) || Se(e.relativePath) || Se(e.absolutePath), ce = rr({ entry: e, isDirectory: I, isExpanded: Y, isItemSelected: G, selectionMode: f, onSelectionChange: k, onEntryClick: w, toggleDirectory: R, onToggleDirectoryRecursive: N }), P = J ? $?.hoverClassName !== void 0 ? $.hoverClassName : D.entryHover : "", s = (() => {
|
|
421
421
|
if (I) {
|
|
422
422
|
if (B) return $?.directorySelectedClassName !== void 0 ? $.directorySelectedClassName : D.entrySelected;
|
|
423
423
|
} else if (B || G)
|
|
424
|
-
return $?.itemSelectedClassName !== void 0 ? $.itemSelectedClassName :
|
|
424
|
+
return $?.itemSelectedClassName !== void 0 ? $.itemSelectedClassName : A(B && D.entrySelected, G && D.entryItemSelected);
|
|
425
425
|
return "";
|
|
426
|
-
})(), m = typeof g == "function" ? g(e) : g, T =
|
|
426
|
+
})(), m = typeof g == "function" ? g(e) : g, T = A("dt-grid-row cursor-pointer select-none", P, s, m, e.className), M = A(D.expandIcon, (B || G) && D.expandIconSelected), se = A(D.typeIcon, (B || G) && D.typeIconSelected), oe = A("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: Q }), z = (I ? L : C) ? er({ entry: e, isDirectory: I, isExpanded: Y, isSelected: B, isItemSelected: G, extension: ie, mimeType: e.mimeType }, S) : null, H = { indentLevel: t, isDirectory: I, isExpanded: Y }, [V, ...Ie] = j, he = V?.render ? V.render(e, H) : e.label ?? e.name, ve = {
|
|
427
427
|
...J ? $?.hoverStyle : {},
|
|
428
428
|
...I && B ? $?.directorySelectedStyle : {},
|
|
429
429
|
...!I && (B || G) ? $?.itemSelectedStyle : {}
|
|
@@ -432,7 +432,7 @@ const Ye = 18, Ge = 12, Jt = 10, D = {
|
|
|
432
432
|
"div",
|
|
433
433
|
{
|
|
434
434
|
className: T,
|
|
435
|
-
style: { height: c, ...
|
|
435
|
+
style: { height: c, ...ve, ...e.style },
|
|
436
436
|
role: "row",
|
|
437
437
|
"aria-expanded": I ? Y : void 0,
|
|
438
438
|
"aria-level": t + 1,
|
|
@@ -445,18 +445,18 @@ const Ye = 18, Ge = 12, Jt = 10, D = {
|
|
|
445
445
|
"data-entry-expanded": I ? String(Y) : void 0,
|
|
446
446
|
"data-entry-selected": B ? "true" : void 0,
|
|
447
447
|
"data-entry-item-selected": G ? "true" : void 0,
|
|
448
|
-
onClick:
|
|
449
|
-
onMouseEnter: () =>
|
|
450
|
-
onMouseLeave: () =>
|
|
451
|
-
onKeyDown: (ae) => ae.key === "Enter" &&
|
|
448
|
+
onClick: ce,
|
|
449
|
+
onMouseEnter: () => te(!0),
|
|
450
|
+
onMouseLeave: () => te(!1),
|
|
451
|
+
onKeyDown: (ae) => ae.key === "Enter" && ce(ae),
|
|
452
452
|
tabIndex: 0,
|
|
453
453
|
children: [
|
|
454
|
-
/* @__PURE__ */ i.jsxs("div", { className:
|
|
455
|
-
(p || O) && /* @__PURE__ */ i.jsx("span", { className:
|
|
456
|
-
(I ? L :
|
|
457
|
-
/* @__PURE__ */ i.jsx("span", { className:
|
|
454
|
+
/* @__PURE__ */ i.jsxs("div", { className: A("dt-grid-name-cell", V?.className), role: "gridcell", style: { width: h, paddingLeft: Math.max(0, t * ee) }, children: [
|
|
455
|
+
(p || O) && /* @__PURE__ */ i.jsx("span", { className: M, children: b }),
|
|
456
|
+
(I ? L : C) && /* @__PURE__ */ i.jsx("span", { className: se, children: z }),
|
|
457
|
+
/* @__PURE__ */ i.jsx("span", { className: oe, children: he })
|
|
458
458
|
] }),
|
|
459
|
-
|
|
459
|
+
Ie.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: Ie.map((ae) => /* @__PURE__ */ i.jsx("div", { className: A("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
|
);
|
|
@@ -480,24 +480,24 @@ const or = ({
|
|
|
480
480
|
renderCell: j
|
|
481
481
|
}) => {
|
|
482
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:
|
|
484
|
-
/* @__PURE__ */ i.jsx("div", { className:
|
|
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:
|
|
483
|
+
return /* @__PURE__ */ i.jsxs("div", { className: A(h, "text-gray-600 dark:text-gray-300", c), role: "row", children: [
|
|
484
|
+
/* @__PURE__ */ i.jsx("div", { className: A(d, "px-1", t[0]?.className), role: g, style: { width: r }, children: u }),
|
|
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: A("dt-grid-cell", nr(w.align), w.className), role: g, children: j(w) }, w.key)) }) }),
|
|
486
486
|
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: l }, "aria-hidden": "true" })
|
|
487
487
|
] });
|
|
488
|
-
},
|
|
488
|
+
}, Mr = ({ 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, Dr = ({ 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 }), Or = 240, lr = 96, ir = 12, st = (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 =
|
|
491
|
+
}, Fr = (e) => e.slice(1).map((t) => `${st(t, lr)}px`).join(" "), Lr = ({ measuredWidth: e, columns: t, scrollBarWidth: a = ir }) => {
|
|
492
|
+
const n = st(t[0], Or), r = t.slice(1).reduce((j, v) => j + st(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
493
|
return { nameWidth: n, numericTotal: r, numericVisible: c, maxHScroll: u };
|
|
494
|
-
},
|
|
494
|
+
}, rt = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, $r = (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
|
+
}, Hr = (e, t) => {
|
|
501
501
|
const a = e.length - 1;
|
|
502
502
|
if (a <= 0) return 0;
|
|
503
503
|
let n = 0, r = a - 1, l = 0;
|
|
@@ -506,22 +506,22 @@ const or = ({
|
|
|
506
506
|
e[c] <= t ? (l = c, n = c + 1) : r = c - 1;
|
|
507
507
|
}
|
|
508
508
|
return l;
|
|
509
|
-
},
|
|
509
|
+
}, Wr = (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 = Hr(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
|
+
}, Br = (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
|
+
}, zr = (e, t, a) => {
|
|
525
525
|
const n = [];
|
|
526
526
|
for (let r = t; r < a; r++) {
|
|
527
527
|
const l = e[r];
|
|
@@ -530,7 +530,7 @@ const or = ({
|
|
|
530
530
|
n.push(c);
|
|
531
531
|
}
|
|
532
532
|
return n;
|
|
533
|
-
},
|
|
533
|
+
}, Yr = (e, t, a) => {
|
|
534
534
|
const n = [];
|
|
535
535
|
for (let r = t; r < a; r++) {
|
|
536
536
|
const l = e[r];
|
|
@@ -539,17 +539,17 @@ const or = ({
|
|
|
539
539
|
n.push(c);
|
|
540
540
|
}
|
|
541
541
|
return n;
|
|
542
|
-
},
|
|
542
|
+
}, Gr = (e, t, a, n) => {
|
|
543
543
|
const r = Math.max(1, Math.floor(t * n)), l = Math.max(1, Math.floor(a * n));
|
|
544
544
|
(e.width !== r || e.height !== l) && (e.width = r, e.height = l);
|
|
545
545
|
const c = e.style;
|
|
546
546
|
c.width !== `${t}px` && (c.width = `${t}px`), c.height !== `${a}px` && (c.height = `${a}px`);
|
|
547
|
-
},
|
|
547
|
+
}, Vr = (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
|
+
}, Ur = (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;
|
|
@@ -557,17 +557,17 @@ const or = ({
|
|
|
557
557
|
n.length === 3 && (n = n.split("").map((u) => u + u).join(""));
|
|
558
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
559
|
return `rgba(${r}, ${l}, ${c}, ${t})`;
|
|
560
|
-
},
|
|
560
|
+
}, Xr = (e, t, a, n) => {
|
|
561
561
|
if (t.length === 0)
|
|
562
562
|
return;
|
|
563
|
-
const r =
|
|
563
|
+
const r = Ur(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
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
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
569
|
e.strokeStyle = l, e.fillStyle = c, e.lineWidth = u, e.lineCap = j, e.lineJoin = v;
|
|
570
|
-
}, cr =
|
|
570
|
+
}, cr = at(({ 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
571
|
const E = ne(null), f = ne(null), y = ne({
|
|
572
572
|
segmentsByItem: e,
|
|
573
573
|
glyphsByItem: t,
|
|
@@ -597,21 +597,21 @@ const or = ({
|
|
|
597
597
|
return;
|
|
598
598
|
}
|
|
599
599
|
const L = Number.isFinite(p.devicePixelRatio ?? NaN) ? p.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
|
|
600
|
-
|
|
601
|
-
const
|
|
600
|
+
Gr(N, p.width, p.viewportHeight, L);
|
|
601
|
+
const C = 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)), Q = Math.min(C, Math.ceil((p.scrollPosition + p.viewportHeight) / p.itemHeight)), ee = (() => {
|
|
602
602
|
if (typeof p.renderEndIndex == "number" && Number.isFinite(p.renderEndIndex)) {
|
|
603
603
|
const I = Math.floor(p.renderEndIndex);
|
|
604
|
-
return Math.max(Math.min(
|
|
604
|
+
return Math.max(Math.min(C, I + 1), O);
|
|
605
605
|
}
|
|
606
|
-
return Math.max(
|
|
606
|
+
return Math.max(Q, O);
|
|
607
607
|
})(), $ = (() => {
|
|
608
608
|
if (typeof p.lookaheadEndIndex == "number" && Number.isFinite(p.lookaheadEndIndex)) {
|
|
609
|
-
const I = Math.floor(p.lookaheadEndIndex), Y = Math.min(
|
|
610
|
-
return Math.max(Y,
|
|
609
|
+
const I = Math.floor(p.lookaheadEndIndex), Y = Math.min(C, I + 1);
|
|
610
|
+
return Math.max(Y, ee);
|
|
611
611
|
}
|
|
612
|
-
return Math.max(
|
|
613
|
-
})(), J =
|
|
614
|
-
S.save(), S.scale(L, L), S.clearRect(0, 0, p.width, p.viewportHeight), S.translate(0, -p.scrollPosition), S.strokeStyle = p.color,
|
|
612
|
+
return Math.max(Q, ee);
|
|
613
|
+
})(), J = zr(p.segmentsByItem, O, $), te = Yr(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, Vr(S, J, p.strokeWidth), Xr(S, te, p.expandGlyphColor ?? p.color, p.expandGlyphSize), S.restore();
|
|
615
615
|
}, []), R = F(() => {
|
|
616
616
|
f.current === null && (f.current = window.requestAnimationFrame(k));
|
|
617
617
|
}, [k]);
|
|
@@ -637,13 +637,13 @@ const or = ({
|
|
|
637
637
|
}, []), /* @__PURE__ */ i.jsx("canvas", { ref: E, className: "pointer-events-none absolute top-0 left-0 z-0" });
|
|
638
638
|
});
|
|
639
639
|
cr.displayName = "TreeLineCanvas";
|
|
640
|
-
const
|
|
640
|
+
const Jr = {
|
|
641
641
|
msOverflowStyle: "none",
|
|
642
642
|
scrollbarWidth: "none"
|
|
643
|
-
},
|
|
643
|
+
}, qr = () => {
|
|
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
|
-
},
|
|
646
|
+
}, Zr = (e, t, a, n, r) => {
|
|
647
647
|
const l = [], c = [];
|
|
648
648
|
let u = 0;
|
|
649
649
|
const j = (v, d, h) => {
|
|
@@ -674,10 +674,10 @@ const Xr = {
|
|
|
674
674
|
e[c] <= t ? (l = c, n = c + 1) : r = c - 1;
|
|
675
675
|
}
|
|
676
676
|
return l;
|
|
677
|
-
},
|
|
677
|
+
}, Kr = (e, t, a, n, r, l) => {
|
|
678
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
679
|
return { renderStart: c, renderEnd: v, lookaheadEnd: d };
|
|
680
|
-
},
|
|
680
|
+
}, Qr = (e, t, a, n, r, l) => {
|
|
681
681
|
if (e.length === 0)
|
|
682
682
|
return { segmentsByItem: [], glyphsByItem: [] };
|
|
683
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;
|
|
@@ -690,22 +690,22 @@ const Xr = {
|
|
|
690
690
|
if (h.ancestorIsLast[S] ?? !1)
|
|
691
691
|
continue;
|
|
692
692
|
let L = !1;
|
|
693
|
-
for (let
|
|
694
|
-
const O = e[
|
|
693
|
+
for (let C = d; C < e.length; C++) {
|
|
694
|
+
const O = e[C];
|
|
695
695
|
if (O.indentLevel > S && O.ancestorIsLast.length > S && !O.ancestorIsLast[S]) {
|
|
696
696
|
L = !0;
|
|
697
697
|
break;
|
|
698
698
|
}
|
|
699
|
-
if (
|
|
699
|
+
if (C > d && O.indentLevel === S)
|
|
700
700
|
break;
|
|
701
701
|
}
|
|
702
702
|
if (L) {
|
|
703
|
-
const
|
|
703
|
+
const C = S * n + n / 2 + v;
|
|
704
704
|
g.push({
|
|
705
705
|
key: `${h.id}-ancestor-${S}`,
|
|
706
|
-
x1:
|
|
706
|
+
x1: C,
|
|
707
707
|
y1: E,
|
|
708
|
-
x2:
|
|
708
|
+
x2: C,
|
|
709
709
|
y2: E + w,
|
|
710
710
|
itemIndex: d
|
|
711
711
|
});
|
|
@@ -762,7 +762,7 @@ const Xr = {
|
|
|
762
762
|
}
|
|
763
763
|
}
|
|
764
764
|
return { segmentsByItem: c, glyphsByItem: u };
|
|
765
|
-
},
|
|
765
|
+
}, ot = at(
|
|
766
766
|
({
|
|
767
767
|
entry: e,
|
|
768
768
|
indentLevel: t,
|
|
@@ -783,70 +783,70 @@ const Xr = {
|
|
|
783
783
|
visual: {
|
|
784
784
|
iconOverrides: p,
|
|
785
785
|
showExpandIcons: L = !0,
|
|
786
|
-
showDirectoryIcons:
|
|
786
|
+
showDirectoryIcons: C = !0,
|
|
787
787
|
showFileIcons: O = !0,
|
|
788
|
-
useCanvasExpandIcons:
|
|
789
|
-
expandIconSize:
|
|
788
|
+
useCanvasExpandIcons: Q = !1,
|
|
789
|
+
expandIconSize: ee,
|
|
790
790
|
typeIconSize: $,
|
|
791
791
|
fontSize: J,
|
|
792
|
-
indentSize:
|
|
792
|
+
indentSize: te = Ge,
|
|
793
793
|
highlightStyles: I,
|
|
794
794
|
entryClassName: Y,
|
|
795
795
|
entryStyle: B,
|
|
796
796
|
nameClassName: G,
|
|
797
|
-
nameStyle:
|
|
798
|
-
directoryNameClassName:
|
|
799
|
-
directoryNameStyle:
|
|
797
|
+
nameStyle: ie,
|
|
798
|
+
directoryNameClassName: ce,
|
|
799
|
+
directoryNameStyle: P,
|
|
800
800
|
fileNameClassName: s,
|
|
801
801
|
fileNameStyle: m
|
|
802
802
|
}
|
|
803
803
|
}) => {
|
|
804
|
-
const [T,
|
|
804
|
+
const [T, M] = le(null), [se, oe] = le(!1), b = e.children !== void 0, z = b && h(e.absolutePath), H = e.absolutePath === k, V = !b && N?.has(e.absolutePath), Ie = b ? void 0 : Se(e.name) || Se(e.relativePath) || Se(e.absolutePath);
|
|
805
805
|
me(() => {
|
|
806
|
-
|
|
806
|
+
M(z && e.children ? e.children : null);
|
|
807
807
|
}, [z, e.children]);
|
|
808
|
-
const
|
|
808
|
+
const he = rr({ entry: e, isDirectory: b, isExpanded: z, isItemSelected: !!V, selectionMode: R, onSelectionChange: S, onEntryClick: y, toggleDirectory: E, onToggleDirectoryRecursive: f }), ve = se ? I?.hoverClassName !== void 0 ? I.hoverClassName : D.entryHover : "", ae = (() => {
|
|
809
809
|
if (b) {
|
|
810
810
|
if (H)
|
|
811
811
|
return I?.directorySelectedClassName !== void 0 ? I.directorySelectedClassName : D.entrySelected;
|
|
812
812
|
} else if (H || V)
|
|
813
|
-
return I?.itemSelectedClassName !== void 0 ? I.itemSelectedClassName :
|
|
813
|
+
return I?.itemSelectedClassName !== void 0 ? I.itemSelectedClassName : A(H && D.entrySelected, V && D.entryItemSelected);
|
|
814
814
|
return "";
|
|
815
|
-
})(), Ve =
|
|
815
|
+
})(), Ve = A(D.entry, ve, ae, Y, e.className), Ee = A(D.expandIcon, (H || V) && D.expandIconSelected), _e = A(D.typeIcon, (H || V) && D.typeIconSelected), Ae = A(D.name, G, b && D.nameDirectory, b && ce, !b && s, (H || V) && D.nameSelected), Me = Qt({ isDirectory: b, isExpanded: z, showExpandIcons: L, useCanvasExpandIcons: Q, expandIconSize: ee }), De = (b ? C : O) ? er({ entry: e, isDirectory: b, isExpanded: z, isSelected: H, isItemSelected: !!V, extension: Ie, mimeType: e.mimeType }, p) : null, Oe = {
|
|
816
816
|
...se ? I?.hoverStyle : {},
|
|
817
817
|
...b && H ? I?.directorySelectedStyle : {},
|
|
818
818
|
...!b && (H || V) ? I?.itemSelectedStyle : {}
|
|
819
|
-
},
|
|
820
|
-
return /* @__PURE__ */ i.jsxs(
|
|
819
|
+
}, pe = tr(e.data), Fe = $ ? { width: $, height: $ } : void 0, Re = J ? { fontSize: typeof J == "number" ? `${J}px` : J } : void 0;
|
|
820
|
+
return /* @__PURE__ */ i.jsxs(gr, { children: [
|
|
821
821
|
/* @__PURE__ */ i.jsxs(
|
|
822
822
|
"div",
|
|
823
823
|
{
|
|
824
824
|
className: Ve,
|
|
825
825
|
style: {
|
|
826
|
-
paddingLeft: `${Math.max(0, t *
|
|
827
|
-
transform: t < 0 ? `translateX(${t *
|
|
828
|
-
width: t < 0 ? `calc(100% + ${Math.abs(t *
|
|
826
|
+
paddingLeft: `${Math.max(0, t * te)}px`,
|
|
827
|
+
transform: t < 0 ? `translateX(${t * te}px)` : void 0,
|
|
828
|
+
width: t < 0 ? `calc(100% + ${Math.abs(t * te)}px)` : void 0,
|
|
829
829
|
height: `${d}px`,
|
|
830
|
-
...
|
|
831
|
-
...
|
|
830
|
+
...Re,
|
|
831
|
+
...Oe,
|
|
832
832
|
...B,
|
|
833
833
|
...e.style
|
|
834
834
|
},
|
|
835
|
-
...
|
|
835
|
+
...pe,
|
|
836
836
|
"data-entry-type": b ? "directory" : "file",
|
|
837
837
|
"data-entry-expanded": b ? String(z) : void 0,
|
|
838
838
|
"data-entry-selected": H ? "true" : void 0,
|
|
839
839
|
"data-entry-item-selected": V ? "true" : void 0,
|
|
840
|
-
onClick:
|
|
841
|
-
onMouseEnter: () =>
|
|
842
|
-
onMouseLeave: () =>
|
|
843
|
-
ref: (
|
|
844
|
-
onKeyDown: (
|
|
845
|
-
if (
|
|
846
|
-
|
|
840
|
+
onClick: he,
|
|
841
|
+
onMouseEnter: () => oe(!0),
|
|
842
|
+
onMouseLeave: () => oe(!1),
|
|
843
|
+
ref: (re) => j(c, re),
|
|
844
|
+
onKeyDown: (re) => {
|
|
845
|
+
if (re.key === "Enter" || re.key === " ") {
|
|
846
|
+
re.preventDefault(), he(re);
|
|
847
847
|
return;
|
|
848
848
|
}
|
|
849
|
-
v(
|
|
849
|
+
v(re, c);
|
|
850
850
|
},
|
|
851
851
|
tabIndex: u ? 0 : -1,
|
|
852
852
|
role: "treeitem",
|
|
@@ -857,16 +857,16 @@ const Xr = {
|
|
|
857
857
|
"aria-selected": R === "none" ? void 0 : l,
|
|
858
858
|
"aria-label": `${e.name} (${b ? "directory" : "file"})`,
|
|
859
859
|
children: [
|
|
860
|
-
(L ||
|
|
861
|
-
(b ?
|
|
860
|
+
(L || Q) && /* @__PURE__ */ i.jsx("span", { className: Ee, children: Me }),
|
|
861
|
+
(b ? C : O) && /* @__PURE__ */ i.jsx("span", { className: _e, style: Fe, children: De }),
|
|
862
862
|
/* @__PURE__ */ i.jsx(
|
|
863
863
|
"span",
|
|
864
864
|
{
|
|
865
|
-
className:
|
|
865
|
+
className: Ae,
|
|
866
866
|
style: {
|
|
867
|
-
...
|
|
868
|
-
...
|
|
869
|
-
...b ?
|
|
867
|
+
...Re,
|
|
868
|
+
...ie,
|
|
869
|
+
...b ? P : m
|
|
870
870
|
},
|
|
871
871
|
"data-entry-type": b ? "directory" : "file",
|
|
872
872
|
"data-entry-role": "name",
|
|
@@ -876,43 +876,43 @@ const Xr = {
|
|
|
876
876
|
]
|
|
877
877
|
}
|
|
878
878
|
),
|
|
879
|
-
z && T && w && /* @__PURE__ */ i.jsx("fieldset", { children: T.map((
|
|
880
|
-
|
|
879
|
+
z && T && w && /* @__PURE__ */ i.jsx("fieldset", { children: T.map((re, Te) => /* @__PURE__ */ i.jsx(
|
|
880
|
+
ot,
|
|
881
881
|
{
|
|
882
|
-
entry:
|
|
882
|
+
entry: re,
|
|
883
883
|
indentLevel: t + 1,
|
|
884
884
|
depth: a + 1,
|
|
885
|
-
positionInSet:
|
|
885
|
+
positionInSet: Te + 1,
|
|
886
886
|
setSize: T.length,
|
|
887
|
-
isSelectedForAria: !!N?.has(
|
|
887
|
+
isSelectedForAria: !!N?.has(re.absolutePath),
|
|
888
888
|
flatIndex: -1,
|
|
889
889
|
isActive: !1,
|
|
890
890
|
registerRowRef: j,
|
|
891
891
|
onNavigationKeyDown: v,
|
|
892
892
|
rowHeight: d,
|
|
893
893
|
isDirOpen: h,
|
|
894
|
-
parentIsLast: [...g,
|
|
894
|
+
parentIsLast: [...g, Te === T.length - 1],
|
|
895
895
|
expansion: { toggleDirectory: E, onToggleDirectoryRecursive: f },
|
|
896
896
|
selection: { onEntryClick: y, selectedPath: k, mode: R, selectedItems: N, onSelectionChange: S },
|
|
897
897
|
visual: {
|
|
898
898
|
iconOverrides: p,
|
|
899
899
|
showExpandIcons: L,
|
|
900
|
-
showDirectoryIcons:
|
|
900
|
+
showDirectoryIcons: C,
|
|
901
901
|
showFileIcons: O,
|
|
902
|
-
useCanvasExpandIcons:
|
|
903
|
-
expandIconSize:
|
|
902
|
+
useCanvasExpandIcons: Q,
|
|
903
|
+
expandIconSize: ee,
|
|
904
904
|
highlightStyles: I,
|
|
905
905
|
entryClassName: Y,
|
|
906
906
|
entryStyle: B,
|
|
907
907
|
nameClassName: G,
|
|
908
|
-
nameStyle:
|
|
909
|
-
directoryNameClassName:
|
|
910
|
-
directoryNameStyle:
|
|
908
|
+
nameStyle: ie,
|
|
909
|
+
directoryNameClassName: ce,
|
|
910
|
+
directoryNameStyle: P,
|
|
911
911
|
fileNameClassName: s,
|
|
912
912
|
fileNameStyle: m
|
|
913
913
|
}
|
|
914
914
|
},
|
|
915
|
-
|
|
915
|
+
re.absolutePath
|
|
916
916
|
)) })
|
|
917
917
|
] }, e.absolutePath);
|
|
918
918
|
},
|
|
@@ -923,14 +923,14 @@ const Xr = {
|
|
|
923
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]);
|
|
924
924
|
}
|
|
925
925
|
);
|
|
926
|
-
|
|
926
|
+
ot.displayName = "DirectoryEntryItem";
|
|
927
927
|
const dr = (e) => {
|
|
928
928
|
const t = [];
|
|
929
929
|
if (e.children)
|
|
930
930
|
for (const a of e.children)
|
|
931
931
|
a.type === "directory" && (t.push(a.absolutePath), t.push(...dr(a)));
|
|
932
932
|
return t;
|
|
933
|
-
},
|
|
933
|
+
}, an = ({
|
|
934
934
|
entries: e,
|
|
935
935
|
expansion: { toggle: t, isExpanded: a, expandMultiple: n, collapseMultiple: r, isPending: l, alwaysExpanded: c = !1, doubleClickAction: u = "recursive" },
|
|
936
936
|
selection: { onEntryClick: j, selectedPath: v, mode: d = "none", selectedItems: h, onSelectionChange: g },
|
|
@@ -945,262 +945,259 @@ const dr = (e) => {
|
|
|
945
945
|
showDirectoryIcons: S = !0,
|
|
946
946
|
showFileIcons: p = !0,
|
|
947
947
|
iconOverrides: L,
|
|
948
|
-
expandIconSize:
|
|
948
|
+
expandIconSize: C,
|
|
949
949
|
itemHeight: O = Ye,
|
|
950
|
-
removeRootIndent:
|
|
951
|
-
highlightStyles:
|
|
950
|
+
removeRootIndent: Q = !1,
|
|
951
|
+
highlightStyles: ee,
|
|
952
952
|
entryClassName: $,
|
|
953
953
|
entryStyle: J,
|
|
954
|
-
nameClassName:
|
|
954
|
+
nameClassName: te,
|
|
955
955
|
nameStyle: I,
|
|
956
956
|
directoryNameClassName: Y,
|
|
957
957
|
directoryNameStyle: B,
|
|
958
958
|
fileNameClassName: G,
|
|
959
|
-
fileNameStyle:
|
|
959
|
+
fileNameStyle: ie
|
|
960
960
|
} = {},
|
|
961
|
-
virtualScroll:
|
|
962
|
-
grid:
|
|
961
|
+
virtualScroll: ce,
|
|
962
|
+
grid: P,
|
|
963
963
|
sort: s
|
|
964
964
|
}) => {
|
|
965
|
-
const m =
|
|
966
|
-
overscanCount:
|
|
967
|
-
className:
|
|
968
|
-
background:
|
|
969
|
-
onScroll:
|
|
970
|
-
onRangeChange:
|
|
971
|
-
initialScrollIndex:
|
|
972
|
-
initialScrollOffset:
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
965
|
+
const m = P !== void 0, [T, M] = le(!1), se = ne(null), oe = ne(null), b = ne(null), [z, H] = le(0), [V, Ie] = le(0), [he, ve] = le(0), [ae, Ve] = le(null), {
|
|
966
|
+
overscanCount: Ee = 15,
|
|
967
|
+
className: _e,
|
|
968
|
+
background: Ae,
|
|
969
|
+
onScroll: Me,
|
|
970
|
+
onRangeChange: De,
|
|
971
|
+
initialScrollIndex: Oe,
|
|
972
|
+
initialScrollOffset: pe,
|
|
973
|
+
initialScrollAnchor: Fe,
|
|
974
|
+
callbackThrottleMs: Re = 5,
|
|
975
|
+
contentInsets: re,
|
|
976
|
+
onItemFocus: Te,
|
|
977
|
+
viewportHeightOverride: de,
|
|
977
978
|
scrollBarOptions: Ue,
|
|
978
|
-
behaviorOptions:
|
|
979
|
-
preserveScrollAnchor:
|
|
979
|
+
behaviorOptions: lt,
|
|
980
|
+
preserveScrollAnchor: it = !1,
|
|
980
981
|
getItemKey: ur,
|
|
981
982
|
// 素通しの pass-through。型で受け付けているものは実際に転送する
|
|
982
983
|
// (`role="tree"` は本コンポーネント自身のコンテナに付くため contentProps とは別要素で衝突しない)
|
|
983
|
-
testId:
|
|
984
|
+
testId: ct,
|
|
984
985
|
contentProps: Xe
|
|
985
|
-
} =
|
|
986
|
+
} = ce ?? {}, dt = K(() => m ? { role: "rowgroup", ...Xe } : Xe, [m, Xe]), [Le, ut] = le(typeof pe == "number" ? pe : 0), Je = ne(typeof pe == "number" ? pe : 0), ft = F(
|
|
986
987
|
(o, x) => {
|
|
987
|
-
|
|
988
|
+
Je.current = o, ut(o), Me?.(o, x);
|
|
988
989
|
},
|
|
989
|
-
[
|
|
990
|
+
[Me]
|
|
990
991
|
), mt = F(
|
|
991
992
|
(o) => {
|
|
992
|
-
const { renderingStartIndex: x, renderingEndIndex:
|
|
993
|
-
Ve((W) => W && W.renderStart === x && W.renderEnd ===
|
|
993
|
+
const { renderingStartIndex: x, renderingEndIndex: _ } = o;
|
|
994
|
+
Ve((W) => W && W.renderStart === x && W.renderEnd === _ ? W : { renderStart: x, renderEnd: _ }), De?.(o);
|
|
994
995
|
},
|
|
995
|
-
[
|
|
996
|
+
[De]
|
|
996
997
|
);
|
|
997
998
|
me(() => {
|
|
998
|
-
|
|
999
|
-
}, [ie]), me(() => {
|
|
1000
|
-
A(!0), Jr();
|
|
999
|
+
M(!0), qr();
|
|
1001
1000
|
}, []), me(() => {
|
|
1002
|
-
const o = se.current, x = m ?
|
|
1001
|
+
const o = se.current, x = m ? oe.current : o, _ = () => {
|
|
1003
1002
|
if (o) {
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1003
|
+
const U = o.clientWidth;
|
|
1004
|
+
Ie((q) => Math.abs(q - U) > 1 ? U : q);
|
|
1006
1005
|
}
|
|
1007
|
-
if (typeof
|
|
1008
|
-
H((
|
|
1006
|
+
if (typeof de == "number")
|
|
1007
|
+
H((U) => Math.abs(U - de) > 1 ? de : U);
|
|
1009
1008
|
else if (x) {
|
|
1010
|
-
const
|
|
1011
|
-
H((
|
|
1009
|
+
const U = x.clientHeight;
|
|
1010
|
+
H((q) => Math.abs(q - U) > 1 ? U : q);
|
|
1012
1011
|
}
|
|
1013
1012
|
};
|
|
1014
1013
|
if (!(o || x)) return H(0);
|
|
1015
|
-
|
|
1016
|
-
const W = new ResizeObserver(
|
|
1014
|
+
_();
|
|
1015
|
+
const W = new ResizeObserver(_);
|
|
1017
1016
|
return o && W.observe(o), x && x !== o && W.observe(x), () => W.disconnect();
|
|
1018
|
-
}, [
|
|
1019
|
-
const
|
|
1017
|
+
}, [de, m]);
|
|
1018
|
+
const ye = typeof de == "number" ? de : z, ue = F((o) => c || (T ? a(o) : !1), [T, a, c]), ht = A(D.container, l && D.containerPending, w), pt = K(
|
|
1020
1019
|
() => ({
|
|
1021
|
-
...
|
|
1020
|
+
...Jr,
|
|
1022
1021
|
...E ?? {},
|
|
1023
|
-
...typeof
|
|
1022
|
+
...typeof de == "number" ? { height: de, minHeight: de } : {}
|
|
1024
1023
|
}),
|
|
1025
|
-
[E,
|
|
1026
|
-
),
|
|
1024
|
+
[E, de]
|
|
1025
|
+
), qe = F(
|
|
1027
1026
|
(o, x) => {
|
|
1028
|
-
const
|
|
1029
|
-
if (
|
|
1030
|
-
if (
|
|
1031
|
-
if (W === "toggle") return r(
|
|
1027
|
+
const _ = [o.absolutePath, ...dr(o)], W = x || u;
|
|
1028
|
+
if (_.every((fe) => ue(fe))) return r(_);
|
|
1029
|
+
if (_.every((fe) => !ue(fe)) || W === "recursive") return n(_);
|
|
1030
|
+
if (W === "toggle") return r(_);
|
|
1032
1031
|
console.warn(`[DirectoryTree] Unknown double click action: ${W}. No action taken.`);
|
|
1033
1032
|
},
|
|
1034
|
-
[
|
|
1035
|
-
), yt = m ? !1 :
|
|
1036
|
-
() =>
|
|
1037
|
-
const
|
|
1038
|
-
return { ...o, rowHeight: Number.isFinite(
|
|
1033
|
+
[ue, n, r, u]
|
|
1034
|
+
), yt = m ? !1 : Q, { flatItems: ge, lineItems: Ze, maxIndent: xt } = K(() => Zr(e, ue, R, yt, s), [e, ue, R, yt, s]), X = K(
|
|
1035
|
+
() => ge.map((o, x) => {
|
|
1036
|
+
const _ = typeof O == "function" ? O(o.entry, x) : O;
|
|
1037
|
+
return { ...o, rowHeight: Number.isFinite(_) && _ > 0 ? _ : Ye };
|
|
1039
1038
|
}),
|
|
1040
|
-
[
|
|
1041
|
-
),
|
|
1042
|
-
const o = new Array(
|
|
1039
|
+
[ge, O]
|
|
1040
|
+
), xe = K(() => X.map((o) => o.rowHeight), [X]), we = K(() => {
|
|
1041
|
+
const o = new Array(xe.length + 1);
|
|
1043
1042
|
o[0] = 0;
|
|
1044
|
-
for (let x = 0; x <
|
|
1045
|
-
o[x + 1] = o[x] +
|
|
1043
|
+
for (let x = 0; x < xe.length; x++)
|
|
1044
|
+
o[x + 1] = o[x] + xe[x];
|
|
1046
1045
|
return o;
|
|
1047
|
-
}, [
|
|
1048
|
-
gt.current =
|
|
1049
|
-
const wt = ne(
|
|
1050
|
-
wt.current =
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
const [kt, St] =
|
|
1054
|
-
x ? (
|
|
1055
|
-
}, []),
|
|
1046
|
+
}, [xe]), bt = F((o) => X[o]?.rowHeight ?? Ye, [X]), fr = F((o) => X[o]?.entry.absolutePath ?? o, [X]), vt = ur ?? fr, gt = ne(ge);
|
|
1047
|
+
gt.current = ge;
|
|
1048
|
+
const wt = ne(ue);
|
|
1049
|
+
wt.current = ue;
|
|
1050
|
+
const Ke = ne(t);
|
|
1051
|
+
Ke.current = t;
|
|
1052
|
+
const [kt, St] = le(0), Qe = ne(/* @__PURE__ */ new Map()), et = ne(null), It = F((o, x) => {
|
|
1053
|
+
x ? (Qe.current.set(o, x), et.current === o && (et.current = null, x.focus())) : Qe.current.delete(o);
|
|
1054
|
+
}, []), ke = F((o) => {
|
|
1056
1055
|
St(o);
|
|
1057
|
-
const x =
|
|
1056
|
+
const x = Qe.current.get(o);
|
|
1058
1057
|
if (x) {
|
|
1059
1058
|
x.focus();
|
|
1060
1059
|
return;
|
|
1061
1060
|
}
|
|
1062
|
-
|
|
1061
|
+
et.current = o, b.current?.scrollToIndex(o);
|
|
1063
1062
|
}, []);
|
|
1064
1063
|
me(() => {
|
|
1065
|
-
St((o) =>
|
|
1066
|
-
}, [
|
|
1064
|
+
St((o) => ge.length === 0 ? 0 : Math.min(o, ge.length - 1));
|
|
1065
|
+
}, [ge.length]);
|
|
1067
1066
|
const Et = F(
|
|
1068
1067
|
(o, x) => {
|
|
1069
|
-
const
|
|
1068
|
+
const _ = gt.current, W = _.length - 1;
|
|
1070
1069
|
if (W < 0) return;
|
|
1071
|
-
const
|
|
1070
|
+
const U = _[x], q = U?.entry.children !== void 0, fe = q && wt.current(U.entry.absolutePath);
|
|
1072
1071
|
switch (o.key) {
|
|
1073
1072
|
case "ArrowDown":
|
|
1074
|
-
o.preventDefault(),
|
|
1073
|
+
o.preventDefault(), ke(Math.min(x + 1, W));
|
|
1075
1074
|
break;
|
|
1076
1075
|
case "ArrowUp":
|
|
1077
|
-
o.preventDefault(),
|
|
1076
|
+
o.preventDefault(), ke(Math.max(x - 1, 0));
|
|
1078
1077
|
break;
|
|
1079
1078
|
case "Home":
|
|
1080
|
-
o.preventDefault(),
|
|
1079
|
+
o.preventDefault(), ke(0);
|
|
1081
1080
|
break;
|
|
1082
1081
|
case "End":
|
|
1083
|
-
o.preventDefault(),
|
|
1082
|
+
o.preventDefault(), ke(W);
|
|
1084
1083
|
break;
|
|
1085
1084
|
case "ArrowRight":
|
|
1086
|
-
o.preventDefault(),
|
|
1085
|
+
o.preventDefault(), q && !fe ? Ke.current(U.entry.absolutePath) : q && x < W && ke(x + 1);
|
|
1087
1086
|
break;
|
|
1088
1087
|
case "ArrowLeft": {
|
|
1089
|
-
if (o.preventDefault(),
|
|
1090
|
-
|
|
1088
|
+
if (o.preventDefault(), q && fe) {
|
|
1089
|
+
Ke.current(U.entry.absolutePath);
|
|
1091
1090
|
break;
|
|
1092
1091
|
}
|
|
1093
|
-
const
|
|
1094
|
-
for (let
|
|
1095
|
-
if (
|
|
1096
|
-
|
|
1092
|
+
const xr = U?.depth ?? 0;
|
|
1093
|
+
for (let Be = x - 1; Be >= 0; Be--)
|
|
1094
|
+
if (_[Be].depth < xr) {
|
|
1095
|
+
ke(Be);
|
|
1097
1096
|
break;
|
|
1098
1097
|
}
|
|
1099
1098
|
break;
|
|
1100
1099
|
}
|
|
1101
1100
|
}
|
|
1102
1101
|
},
|
|
1103
|
-
[
|
|
1104
|
-
),
|
|
1105
|
-
() => !R ||
|
|
1106
|
-
[
|
|
1107
|
-
),
|
|
1108
|
-
() =>
|
|
1109
|
-
[
|
|
1110
|
-
),
|
|
1102
|
+
[ke]
|
|
1103
|
+
), $e = K(
|
|
1104
|
+
() => !R || Ze.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : Qr(Ze, xe, we, Ge, R, C ?? Jt),
|
|
1105
|
+
[Ze, xe, we, R, C]
|
|
1106
|
+
), He = K(() => !R || e.length === 0 ? 0 : (xt + 2) * Ge, [e.length, xt, R]), { renderStart: Nt, renderEnd: jt, lookaheadEnd: Rt } = K(
|
|
1107
|
+
() => Kr(X.length, ye, Ee, ae, Le, we),
|
|
1108
|
+
[X.length, ye, Ee, ae, Le, we]
|
|
1109
|
+
), tt = K(() => !R || He <= 0 || ye <= 0 || $e.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: He, height: ye }, children: /* @__PURE__ */ i.jsx(
|
|
1111
1110
|
cr,
|
|
1112
1111
|
{
|
|
1113
|
-
segmentsByItem:
|
|
1114
|
-
glyphsByItem:
|
|
1115
|
-
itemHeight:
|
|
1116
|
-
width:
|
|
1117
|
-
viewportHeight:
|
|
1118
|
-
scrollPosition:
|
|
1112
|
+
segmentsByItem: $e.segmentsByItem,
|
|
1113
|
+
glyphsByItem: $e.glyphsByItem,
|
|
1114
|
+
itemHeight: xe[0] ?? Ye,
|
|
1115
|
+
width: He,
|
|
1116
|
+
viewportHeight: ye,
|
|
1117
|
+
scrollPosition: Le,
|
|
1119
1118
|
color: k,
|
|
1120
1119
|
expandGlyphColor: k,
|
|
1121
|
-
expandGlyphSize:
|
|
1120
|
+
expandGlyphSize: C ?? Jt,
|
|
1122
1121
|
renderStartIndex: Nt,
|
|
1123
1122
|
renderEndIndex: jt,
|
|
1124
1123
|
lookaheadEndIndex: Rt
|
|
1125
1124
|
}
|
|
1126
|
-
) }) }), [
|
|
1127
|
-
|
|
1128
|
-
const o =
|
|
1129
|
-
if (
|
|
1130
|
-
return;
|
|
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)
|
|
1125
|
+
) }) }), [He, ye, Nt, jt, Rt, Le, $e, k, R, C, xe]), Tt = F((o) => X[o], [X]), Ct = ne(null);
|
|
1126
|
+
vr(() => {
|
|
1127
|
+
const o = Ct.current;
|
|
1128
|
+
if (Ct.current = { items: X, offsets: we }, !it || !o || o.items === X)
|
|
1133
1129
|
return;
|
|
1134
|
-
const
|
|
1135
|
-
if (
|
|
1130
|
+
const x = b.current, _ = x?.getScrollPosition(), W = typeof _ == "number" && _ >= 0 ? _ : Je.current, U = Wr(o.items, o.offsets, W);
|
|
1131
|
+
if (!U)
|
|
1136
1132
|
return;
|
|
1137
|
-
const
|
|
1138
|
-
if (Math.abs(
|
|
1133
|
+
const q = Br(U, X, we);
|
|
1134
|
+
if (q === null || Math.abs(q - W) < 1)
|
|
1139
1135
|
return;
|
|
1140
|
-
const
|
|
1141
|
-
|
|
1142
|
-
}, [
|
|
1143
|
-
const
|
|
1136
|
+
const fe = x ? x.scrollTo(q) : q;
|
|
1137
|
+
Je.current = fe, ut(fe);
|
|
1138
|
+
}, [X, we, it]);
|
|
1139
|
+
const be = P?.columns, Ne = P?.scrollBarWidth ?? Ue?.width ?? ir, Z = K(() => be ? Lr({ measuredWidth: V, columns: be, scrollBarWidth: Ne }) : null, [be, V, Ne]), We = K(() => be ? Fr(be) : "", [be]), mr = K(() => P?.showFooter && be ? $r(e) : [], [P?.showFooter, be, e]), je = Z?.maxHScroll ?? 0;
|
|
1144
1140
|
me(() => {
|
|
1145
|
-
|
|
1146
|
-
}, [
|
|
1147
|
-
const
|
|
1148
|
-
() => ({ iconOverrides: L, showExpandIcons: N, showDirectoryIcons: S, showFileIcons: p, useCanvasExpandIcons: R, expandIconSize:
|
|
1149
|
-
[L, N, S, p, R,
|
|
1150
|
-
), At =
|
|
1141
|
+
ve((o) => rt(o, je));
|
|
1142
|
+
}, [je]);
|
|
1143
|
+
const Pt = F((o) => ve((x) => rt(x + o, je)), [je]), _t = K(
|
|
1144
|
+
() => ({ iconOverrides: L, showExpandIcons: N, showDirectoryIcons: S, showFileIcons: p, useCanvasExpandIcons: R, expandIconSize: C, highlightStyles: ee }),
|
|
1145
|
+
[L, N, S, p, R, C, ee]
|
|
1146
|
+
), At = K(
|
|
1151
1147
|
() => /* @__PURE__ */ i.jsx(
|
|
1152
|
-
|
|
1148
|
+
kr,
|
|
1153
1149
|
{
|
|
1154
1150
|
ref: b,
|
|
1155
|
-
itemCount:
|
|
1151
|
+
itemCount: X.length,
|
|
1156
1152
|
getItem: Tt,
|
|
1157
1153
|
getItemHeight: bt,
|
|
1158
1154
|
getItemKey: vt,
|
|
1159
|
-
testId:
|
|
1160
|
-
contentProps:
|
|
1161
|
-
viewportSize:
|
|
1162
|
-
overscanCount:
|
|
1155
|
+
testId: ct,
|
|
1156
|
+
contentProps: dt,
|
|
1157
|
+
viewportSize: ye,
|
|
1158
|
+
overscanCount: Ee,
|
|
1163
1159
|
onScroll: ft,
|
|
1164
1160
|
onRangeChange: mt,
|
|
1165
|
-
className:
|
|
1166
|
-
onWheelHorizontal: m ?
|
|
1161
|
+
className: _e,
|
|
1162
|
+
onWheelHorizontal: m ? Pt : void 0,
|
|
1167
1163
|
background: /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
1168
|
-
m &&
|
|
1164
|
+
m && Z ? (
|
|
1169
1165
|
// Clip the connector-line canvas to the frozen name column so deep trees never bleed into the numeric region.
|
|
1170
|
-
/* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width:
|
|
1171
|
-
) :
|
|
1172
|
-
|
|
1166
|
+
/* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute top-0 left-0 z-0 h-full overflow-hidden", style: { width: Z.nameWidth }, "aria-hidden": "true", children: tt })
|
|
1167
|
+
) : tt,
|
|
1168
|
+
Ae
|
|
1173
1169
|
] }),
|
|
1174
|
-
initialScrollIndex:
|
|
1175
|
-
initialScrollOffset:
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1170
|
+
initialScrollIndex: Oe,
|
|
1171
|
+
initialScrollOffset: pe,
|
|
1172
|
+
initialScrollAnchor: Fe,
|
|
1173
|
+
onItemFocus: Te,
|
|
1174
|
+
callbackThrottleMs: Re,
|
|
1175
|
+
contentInsets: re,
|
|
1179
1176
|
scrollBarOptions: Ue,
|
|
1180
|
-
behaviorOptions:
|
|
1181
|
-
children: (o, x) => o ? m &&
|
|
1177
|
+
behaviorOptions: lt,
|
|
1178
|
+
children: (o, x) => o ? m && P && Z ? /* @__PURE__ */ i.jsx(
|
|
1182
1179
|
ar,
|
|
1183
1180
|
{
|
|
1184
1181
|
entry: o.entry,
|
|
1185
1182
|
indentLevel: o.indentLevel,
|
|
1186
1183
|
positionInSet: o.positionInSet,
|
|
1187
1184
|
setSize: o.setSize,
|
|
1188
|
-
rowIndex: x + (
|
|
1185
|
+
rowIndex: x + (P.showHeader ?? !0 ? 2 : 1),
|
|
1189
1186
|
isSelectedForAria: !!h?.has(o.entry.absolutePath),
|
|
1190
1187
|
rowHeight: o.rowHeight,
|
|
1191
|
-
isDirOpen:
|
|
1192
|
-
columns:
|
|
1193
|
-
numericTemplate:
|
|
1194
|
-
numericTotal:
|
|
1195
|
-
nameWidth:
|
|
1196
|
-
rowClassName:
|
|
1188
|
+
isDirOpen: ue,
|
|
1189
|
+
columns: P.columns,
|
|
1190
|
+
numericTemplate: We,
|
|
1191
|
+
numericTotal: Z.numericTotal,
|
|
1192
|
+
nameWidth: Z.nameWidth,
|
|
1193
|
+
rowClassName: P.rowClassName,
|
|
1197
1194
|
selection: { onEntryClick: j, selectedPath: v ?? null, mode: d, selectedItems: h, onSelectionChange: g },
|
|
1198
|
-
expansion: { toggleDirectory: t, onToggleDirectoryRecursive:
|
|
1195
|
+
expansion: { toggleDirectory: t, onToggleDirectoryRecursive: qe },
|
|
1199
1196
|
visual: _t
|
|
1200
1197
|
},
|
|
1201
1198
|
o.entry.absolutePath
|
|
1202
1199
|
) : /* @__PURE__ */ i.jsx(
|
|
1203
|
-
|
|
1200
|
+
ot,
|
|
1204
1201
|
{
|
|
1205
1202
|
entry: o.entry,
|
|
1206
1203
|
indentLevel: o.indentLevel,
|
|
@@ -1213,10 +1210,10 @@ const dr = (e) => {
|
|
|
1213
1210
|
registerRowRef: It,
|
|
1214
1211
|
onNavigationKeyDown: Et,
|
|
1215
1212
|
rowHeight: o.rowHeight,
|
|
1216
|
-
isDirOpen:
|
|
1213
|
+
isDirOpen: ue,
|
|
1217
1214
|
parentIsLast: o.parentIsLast,
|
|
1218
1215
|
renderChildren: !1,
|
|
1219
|
-
expansion: { toggleDirectory: t, onToggleDirectoryRecursive:
|
|
1216
|
+
expansion: { toggleDirectory: t, onToggleDirectoryRecursive: qe },
|
|
1220
1217
|
selection: { onEntryClick: j, selectedPath: v ?? null, mode: d, selectedItems: h, onSelectionChange: g },
|
|
1221
1218
|
visual: {
|
|
1222
1219
|
iconOverrides: L,
|
|
@@ -1224,16 +1221,16 @@ const dr = (e) => {
|
|
|
1224
1221
|
showDirectoryIcons: S,
|
|
1225
1222
|
showFileIcons: p,
|
|
1226
1223
|
useCanvasExpandIcons: R,
|
|
1227
|
-
expandIconSize:
|
|
1228
|
-
highlightStyles:
|
|
1224
|
+
expandIconSize: C,
|
|
1225
|
+
highlightStyles: ee,
|
|
1229
1226
|
entryClassName: $,
|
|
1230
1227
|
entryStyle: J,
|
|
1231
|
-
nameClassName:
|
|
1228
|
+
nameClassName: te,
|
|
1232
1229
|
nameStyle: I,
|
|
1233
1230
|
directoryNameClassName: Y,
|
|
1234
1231
|
directoryNameStyle: B,
|
|
1235
1232
|
fileNameClassName: G,
|
|
1236
|
-
fileNameStyle:
|
|
1233
|
+
fileNameStyle: ie
|
|
1237
1234
|
}
|
|
1238
1235
|
},
|
|
1239
1236
|
o.entry.absolutePath
|
|
@@ -1241,103 +1238,104 @@ const dr = (e) => {
|
|
|
1241
1238
|
}
|
|
1242
1239
|
),
|
|
1243
1240
|
[
|
|
1244
|
-
|
|
1241
|
+
X.length,
|
|
1245
1242
|
Tt,
|
|
1246
1243
|
bt,
|
|
1247
1244
|
vt,
|
|
1245
|
+
ct,
|
|
1248
1246
|
dt,
|
|
1249
|
-
ut,
|
|
1250
1247
|
kt,
|
|
1251
1248
|
It,
|
|
1252
1249
|
Et,
|
|
1253
|
-
|
|
1254
|
-
|
|
1250
|
+
ye,
|
|
1251
|
+
Ee,
|
|
1255
1252
|
ft,
|
|
1256
1253
|
mt,
|
|
1257
|
-
|
|
1254
|
+
_e,
|
|
1258
1255
|
m,
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1256
|
+
Pt,
|
|
1257
|
+
Z,
|
|
1258
|
+
tt,
|
|
1259
|
+
Ae,
|
|
1260
|
+
Oe,
|
|
1261
|
+
pe,
|
|
1263
1262
|
Fe,
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
he,
|
|
1263
|
+
Te,
|
|
1264
|
+
Re,
|
|
1265
|
+
re,
|
|
1268
1266
|
Ue,
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1267
|
+
lt,
|
|
1268
|
+
P,
|
|
1269
|
+
We,
|
|
1270
|
+
ue,
|
|
1273
1271
|
j,
|
|
1274
1272
|
v,
|
|
1275
1273
|
d,
|
|
1276
1274
|
h,
|
|
1277
1275
|
g,
|
|
1278
1276
|
t,
|
|
1279
|
-
|
|
1277
|
+
qe,
|
|
1280
1278
|
_t,
|
|
1281
1279
|
L,
|
|
1282
1280
|
N,
|
|
1283
1281
|
S,
|
|
1284
1282
|
p,
|
|
1285
1283
|
R,
|
|
1286
|
-
|
|
1287
|
-
|
|
1284
|
+
C,
|
|
1285
|
+
ee,
|
|
1288
1286
|
$,
|
|
1289
1287
|
J,
|
|
1290
|
-
|
|
1288
|
+
te,
|
|
1291
1289
|
I,
|
|
1292
1290
|
Y,
|
|
1293
1291
|
B,
|
|
1294
1292
|
G,
|
|
1295
|
-
|
|
1293
|
+
ie
|
|
1296
1294
|
]
|
|
1297
1295
|
);
|
|
1298
|
-
if (!(
|
|
1296
|
+
if (!(P && Z))
|
|
1299
1297
|
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 =
|
|
1298
|
+
const hr = P.showHeader ?? !0, pr = P.showFooter ?? !1, yr = { ...pt, "--dt-hscroll": `${he}px` };
|
|
1301
1299
|
return /* @__PURE__ */ i.jsxs(
|
|
1302
1300
|
"div",
|
|
1303
1301
|
{
|
|
1304
1302
|
ref: se,
|
|
1305
|
-
className:
|
|
1303
|
+
className: A(ht, "dt-grid"),
|
|
1306
1304
|
style: yr,
|
|
1307
1305
|
role: "treegrid",
|
|
1308
1306
|
"aria-label": y ? void 0 : f,
|
|
1309
1307
|
"aria-labelledby": y,
|
|
1310
1308
|
"aria-multiselectable": d === "multiple" ? !0 : void 0,
|
|
1311
|
-
"aria-rowcount":
|
|
1309
|
+
"aria-rowcount": X.length + (P.showHeader ?? !0 ? 1 : 0),
|
|
1312
1310
|
children: [
|
|
1313
1311
|
hr && // biome-ignore lint/a11y/useSemanticElements: 仮想スクロールの treegrid は絶対配置行を使うため native table 要素にできない。ARIA ロールで意味を提供する
|
|
1314
|
-
/* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(
|
|
1315
|
-
/* @__PURE__ */ i.jsx("div", { ref:
|
|
1316
|
-
|
|
1317
|
-
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width:
|
|
1312
|
+
/* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Mr, { columns: P.columns, numericTemplate: We, numericTotal: Z.numericTotal, nameWidth: Z.nameWidth, scrollBarWidth: Ne, className: P.headerClassName }) }),
|
|
1313
|
+
/* @__PURE__ */ i.jsx("div", { ref: oe, className: "dt-grid-body", children: At }),
|
|
1314
|
+
je > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
|
|
1315
|
+
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: Z.nameWidth }, "aria-hidden": "true" }),
|
|
1318
1316
|
/* @__PURE__ */ i.jsx(
|
|
1319
|
-
|
|
1317
|
+
Sr,
|
|
1320
1318
|
{
|
|
1321
1319
|
horizontal: !0,
|
|
1322
|
-
contentSize:
|
|
1323
|
-
viewportSize:
|
|
1324
|
-
scrollPosition:
|
|
1325
|
-
scrollBarWidth:
|
|
1320
|
+
contentSize: Z.numericTotal,
|
|
1321
|
+
viewportSize: Z.numericVisible,
|
|
1322
|
+
scrollPosition: he,
|
|
1323
|
+
scrollBarWidth: Ne,
|
|
1326
1324
|
onScroll: (o) => {
|
|
1327
|
-
const x = typeof o == "function" ? o(
|
|
1328
|
-
return
|
|
1325
|
+
const x = typeof o == "function" ? o(he) : o, _ = rt(x, je);
|
|
1326
|
+
return ve(_), _;
|
|
1329
1327
|
}
|
|
1330
1328
|
}
|
|
1331
1329
|
),
|
|
1332
|
-
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width:
|
|
1330
|
+
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: Ne }, "aria-hidden": "true" })
|
|
1333
1331
|
] }),
|
|
1334
1332
|
pr && // biome-ignore lint/a11y/useSemanticElements: 同上 (フッタ行も絶対配置レイアウトの一部)
|
|
1335
|
-
/* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(
|
|
1333
|
+
/* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Dr, { columns: P.columns, numericTemplate: We, numericTotal: Z.numericTotal, nameWidth: Z.nameWidth, scrollBarWidth: Ne, allEntries: mr, className: P.footerClassName }) })
|
|
1336
1334
|
]
|
|
1337
1335
|
}
|
|
1338
1336
|
);
|
|
1339
|
-
},
|
|
1340
|
-
const [a, n] =
|
|
1337
|
+
}, on = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
|
|
1338
|
+
const [a, n] = wr(), [r, l] = le(() => {
|
|
1341
1339
|
if (typeof window < "u" && t)
|
|
1342
1340
|
try {
|
|
1343
1341
|
const f = window.localStorage.getItem(t);
|
|
@@ -1426,7 +1424,7 @@ const dr = (e) => {
|
|
|
1426
1424
|
};
|
|
1427
1425
|
};
|
|
1428
1426
|
export {
|
|
1429
|
-
|
|
1427
|
+
an as DirectoryTree,
|
|
1430
1428
|
D as directoryTreeClasses,
|
|
1431
|
-
|
|
1429
|
+
on as useDirectoryTreeState
|
|
1432
1430
|
};
|