@aiquants/directory-tree 4.4.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -2
- package/dist/index.cjs +2 -2
- package/dist/index.js +290 -290
- package/dist/styles/directory-tree.standalone.css +1 -1
- package/dist/typeScale.d.ts +2 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as ue from "react";
|
|
2
|
-
import
|
|
3
|
-
import { VIRTUAL_SCROLL_LABEL_KEYS as ft, VIRTUAL_SCROLL_LABEL_CATALOGS as
|
|
2
|
+
import cn, { useRef as Y, useEffect as Ae, useCallback as P, memo as Lt, useState as de, useMemo as W, useLayoutEffect as Sr, useImperativeHandle as dn, useTransition as un } from "react";
|
|
3
|
+
import { VIRTUAL_SCROLL_LABEL_KEYS as ft, VIRTUAL_SCROLL_LABEL_CATALOGS as xr, resolveVirtualScrollLocale as Lr, resolveVirtualScrollLabels as fn, VirtualScroll as hn, ScrollBar as mn } from "@aiquants/virtualscroll";
|
|
4
4
|
import { twMerge as L } from "tailwind-merge";
|
|
5
|
-
import { FileIcon as
|
|
5
|
+
import { FileIcon as pn, FileText as yn, FileCode as gn, FileZip as bn, FileVideo as vn, FileAudio as wn, FileImage as Sn, FilePpt as xn, FileDoc as En, FileCsv as In, FileXls as Rn, FilePdf as Nn, FileMd as kn } from "@phosphor-icons/react";
|
|
6
6
|
var ut = { exports: {} }, Ue = {};
|
|
7
7
|
var Er;
|
|
8
|
-
function
|
|
8
|
+
function Tn() {
|
|
9
9
|
if (Er) return Ue;
|
|
10
10
|
Er = 1;
|
|
11
11
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
@@ -28,7 +28,7 @@ function kn() {
|
|
|
28
28
|
}
|
|
29
29
|
var Je = {};
|
|
30
30
|
var Ir;
|
|
31
|
-
function
|
|
31
|
+
function _n() {
|
|
32
32
|
return Ir || (Ir = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
33
33
|
function e(o) {
|
|
34
34
|
if (o == null) return null;
|
|
@@ -55,14 +55,14 @@ function Tn() {
|
|
|
55
55
|
), o.$$typeof) {
|
|
56
56
|
case m:
|
|
57
57
|
return "Portal";
|
|
58
|
-
case
|
|
58
|
+
case C:
|
|
59
59
|
return o.displayName || "Context";
|
|
60
|
-
case
|
|
60
|
+
case _:
|
|
61
61
|
return (o._context.displayName || "Context") + ".Consumer";
|
|
62
62
|
case y:
|
|
63
63
|
var u = o.render;
|
|
64
64
|
return o = o.displayName, o || (o = u.displayName || u.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
|
|
65
|
-
case
|
|
65
|
+
case j:
|
|
66
66
|
return u = o.displayName || null, u !== null ? u : e(o.type) || "Memo";
|
|
67
67
|
case Q:
|
|
68
68
|
u = o._payload, o = o._init;
|
|
@@ -169,7 +169,7 @@ function Tn() {
|
|
|
169
169
|
value: k
|
|
170
170
|
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function S(o, u, N, I, ye, k) {
|
|
173
173
|
var O = u.children;
|
|
174
174
|
if (O !== void 0)
|
|
175
175
|
if (I)
|
|
@@ -223,7 +223,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
223
223
|
function T(o) {
|
|
224
224
|
return typeof o == "object" && o !== null && o.$$typeof === g;
|
|
225
225
|
}
|
|
226
|
-
var h =
|
|
226
|
+
var h = cn, g = /* @__PURE__ */ Symbol.for("react.transitional.element"), m = /* @__PURE__ */ Symbol.for("react.portal"), p = /* @__PURE__ */ Symbol.for("react.fragment"), v = /* @__PURE__ */ Symbol.for("react.strict_mode"), z = /* @__PURE__ */ Symbol.for("react.profiler"), _ = /* @__PURE__ */ Symbol.for("react.consumer"), C = /* @__PURE__ */ Symbol.for("react.context"), y = /* @__PURE__ */ Symbol.for("react.forward_ref"), F = /* @__PURE__ */ Symbol.for("react.suspense"), M = /* @__PURE__ */ Symbol.for("react.suspense_list"), j = /* @__PURE__ */ Symbol.for("react.memo"), Q = /* @__PURE__ */ Symbol.for("react.lazy"), U = /* @__PURE__ */ Symbol.for("react.activity"), $ = /* @__PURE__ */ Symbol.for("react.client.reference"), B = h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, fe = Object.prototype.hasOwnProperty, J = Array.isArray, oe = console.createTask ? console.createTask : function() {
|
|
227
227
|
return null;
|
|
228
228
|
};
|
|
229
229
|
h = {
|
|
@@ -234,36 +234,36 @@ React keys must be passed directly to JSX without using spread:
|
|
|
234
234
|
var we, V = {}, X = h.react_stack_bottom_frame.bind(
|
|
235
235
|
h,
|
|
236
236
|
i
|
|
237
|
-
)(),
|
|
237
|
+
)(), Se = oe(n(i)), pe = {};
|
|
238
238
|
Je.Fragment = p, Je.jsx = function(o, u, N) {
|
|
239
239
|
var I = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
240
|
-
return
|
|
240
|
+
return S(
|
|
241
241
|
o,
|
|
242
242
|
u,
|
|
243
243
|
N,
|
|
244
244
|
!1,
|
|
245
245
|
I ? Error("react-stack-top-frame") : X,
|
|
246
|
-
I ? oe(n(o)) :
|
|
246
|
+
I ? oe(n(o)) : Se
|
|
247
247
|
);
|
|
248
248
|
}, Je.jsxs = function(o, u, N) {
|
|
249
249
|
var I = 1e4 > B.recentlyCreatedOwnerStacks++;
|
|
250
|
-
return
|
|
250
|
+
return S(
|
|
251
251
|
o,
|
|
252
252
|
u,
|
|
253
253
|
N,
|
|
254
254
|
!0,
|
|
255
255
|
I ? Error("react-stack-top-frame") : X,
|
|
256
|
-
I ? oe(n(o)) :
|
|
256
|
+
I ? oe(n(o)) : Se
|
|
257
257
|
);
|
|
258
258
|
};
|
|
259
259
|
})()), Je;
|
|
260
260
|
}
|
|
261
261
|
var Rr;
|
|
262
262
|
function Pn() {
|
|
263
|
-
return Rr || (Rr = 1, process.env.NODE_ENV === "production" ? ut.exports =
|
|
263
|
+
return Rr || (Rr = 1, process.env.NODE_ENV === "production" ? ut.exports = Tn() : ut.exports = _n()), ut.exports;
|
|
264
264
|
}
|
|
265
265
|
var f = Pn();
|
|
266
|
-
function
|
|
266
|
+
function Cn({
|
|
267
267
|
title: e,
|
|
268
268
|
titleId: t,
|
|
269
269
|
...r
|
|
@@ -284,8 +284,8 @@ function _n({
|
|
|
284
284
|
clipRule: "evenodd"
|
|
285
285
|
}));
|
|
286
286
|
}
|
|
287
|
-
const jn = /* @__PURE__ */ ue.forwardRef(
|
|
288
|
-
function
|
|
287
|
+
const jn = /* @__PURE__ */ ue.forwardRef(Cn);
|
|
288
|
+
function On({
|
|
289
289
|
title: e,
|
|
290
290
|
titleId: t,
|
|
291
291
|
...r
|
|
@@ -306,8 +306,8 @@ function Cn({
|
|
|
306
306
|
clipRule: "evenodd"
|
|
307
307
|
}));
|
|
308
308
|
}
|
|
309
|
-
const
|
|
310
|
-
function
|
|
309
|
+
const An = /* @__PURE__ */ ue.forwardRef(On);
|
|
310
|
+
function Ln({
|
|
311
311
|
title: e,
|
|
312
312
|
titleId: t,
|
|
313
313
|
...r
|
|
@@ -326,10 +326,10 @@ function An({
|
|
|
326
326
|
d: "M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"
|
|
327
327
|
}));
|
|
328
328
|
}
|
|
329
|
-
const
|
|
329
|
+
const Dn = /* @__PURE__ */ ue.forwardRef(Ln), Dr = "text-[length:var(--dt-font-size-body,0.8125rem)]", Fn = `${Dr} leading-[max(var(--dt-line-height-body,1.25rem),1.5em)]`, _t = 44, Mn = 12, zn = 8, ce = 14, $n = 14, Fr = (e) => e === void 0 ? void 0 : { fontSize: typeof e == "number" ? `${e}px` : e }, ae = (e) => ({ width: e, height: e }), D = {
|
|
330
330
|
container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[3px] pr-[2px]",
|
|
331
331
|
containerPending: "opacity-70",
|
|
332
|
-
entry:
|
|
332
|
+
entry: `directory-tree-entry flex items-center cursor-pointer relative select-none ${Fn} py-0.5`,
|
|
333
333
|
// ホバー時のスタイル(ライト/ダークモード対応)
|
|
334
334
|
entryHover: L("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
|
|
335
335
|
// 選択時のスタイル(ライト/ダークモード対応)
|
|
@@ -342,17 +342,17 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
342
342
|
// 箱の大きさはクラスでなく visual.typeIconSize から行が付ける (ツリーラインのジオメトリと同じ値を読むため)
|
|
343
343
|
typeIcon: L("directory-tree-type-icon flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
344
344
|
typeIconSelected: L("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
|
|
345
|
-
//
|
|
346
|
-
name: L(
|
|
345
|
+
// 文字の行の高さ (line-height) は行 (entry) の body の行を受け継ぐため、名前には文字の大きさだけを付ける
|
|
346
|
+
name: L(`directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 ${Dr} font-normal`, "text-gray-700", "dark:text-gray-200"),
|
|
347
347
|
nameDirectory: "directory-tree-name--directory font-medium",
|
|
348
348
|
nameSelected: L("directory-tree-name--selected text-blue-800 font-semibold", "dark:text-blue-300")
|
|
349
349
|
}, Dt = (e) => {
|
|
350
350
|
const t = e.slice(e.lastIndexOf("/") + 1), r = t.lastIndexOf(".");
|
|
351
351
|
return r <= 0 ? "" : t.slice(r + 1).toLowerCase();
|
|
352
|
-
},
|
|
352
|
+
}, Hn = /^[a-z][a-z\d+.-]*:\/\//i, Nr = (e) => Dt(Hn.test(e) ? e.split(/[?#]/, 1)[0] : e), Mr = (e) => Dt(e.name) || Nr(e.relativePath) || Nr(e.absolutePath), zr = ({ isDirectory: e, isExpanded: t, showExpandIcons: r, useCanvasExpandIcons: n, expandIconSize: a }) => {
|
|
353
353
|
const i = a ? { width: a, height: a } : void 0, l = a ? "" : "h-4 w-4";
|
|
354
|
-
return !(r && e) || n ? /* @__PURE__ */ f.jsx("span", { className: l, style: i, "aria-hidden": "true" }) : t ? /* @__PURE__ */ f.jsx(jn, { className: l, style: i }) : /* @__PURE__ */ f.jsx(
|
|
355
|
-
},
|
|
354
|
+
return !(r && e) || n ? /* @__PURE__ */ f.jsx("span", { className: l, style: i, "aria-hidden": "true" }) : t ? /* @__PURE__ */ f.jsx(jn, { className: l, style: i }) : /* @__PURE__ */ f.jsx(An, { className: l, style: i });
|
|
355
|
+
}, Ct = (e, t) => {
|
|
356
356
|
if (e == null || typeof e == "boolean") return null;
|
|
357
357
|
if (typeof e == "function")
|
|
358
358
|
return console.warn(`[DirectoryTree] Function returned by renderer for "${t}". Return a node.`), null;
|
|
@@ -360,7 +360,7 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
360
360
|
if ("then" in e)
|
|
361
361
|
return console.warn(`[DirectoryTree] Promise returned for "${t}". Not supported.`), null;
|
|
362
362
|
if (Array.isArray(e)) {
|
|
363
|
-
const n = e.map((a) =>
|
|
363
|
+
const n = e.map((a) => Ct(a, t)).filter(Boolean);
|
|
364
364
|
return n.length ? n : null;
|
|
365
365
|
}
|
|
366
366
|
const r = e.type;
|
|
@@ -368,20 +368,20 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
368
368
|
return console.warn(`[DirectoryTree] Lazy component for "${t}". Not supported.`), null;
|
|
369
369
|
}
|
|
370
370
|
return e;
|
|
371
|
-
},
|
|
372
|
-
markdown: (e) => /* @__PURE__ */ f.jsx(
|
|
373
|
-
pdf: (e) => /* @__PURE__ */ f.jsx(
|
|
374
|
-
spreadsheet: (e) => /* @__PURE__ */ f.jsx(
|
|
375
|
-
csv: (e) => /* @__PURE__ */ f.jsx(
|
|
376
|
-
document: (e) => /* @__PURE__ */ f.jsx(
|
|
371
|
+
}, Wn = {
|
|
372
|
+
markdown: (e) => /* @__PURE__ */ f.jsx(kn, { className: "text-sky-500 dark:text-sky-400", style: ae(e) }),
|
|
373
|
+
pdf: (e) => /* @__PURE__ */ f.jsx(Nn, { className: "text-red-500 dark:text-red-400", style: ae(e) }),
|
|
374
|
+
spreadsheet: (e) => /* @__PURE__ */ f.jsx(Rn, { className: "text-emerald-600 dark:text-emerald-400", style: ae(e) }),
|
|
375
|
+
csv: (e) => /* @__PURE__ */ f.jsx(In, { className: "text-emerald-600 dark:text-emerald-400", style: ae(e) }),
|
|
376
|
+
document: (e) => /* @__PURE__ */ f.jsx(En, { className: "text-blue-600 dark:text-blue-400", style: ae(e) }),
|
|
377
377
|
presentation: (e) => /* @__PURE__ */ f.jsx(xn, { className: "text-orange-500 dark:text-orange-400", style: ae(e) }),
|
|
378
|
-
image: (e) => /* @__PURE__ */ f.jsx(
|
|
379
|
-
audio: (e) => /* @__PURE__ */ f.jsx(
|
|
380
|
-
video: (e) => /* @__PURE__ */ f.jsx(
|
|
381
|
-
archive: (e) => /* @__PURE__ */ f.jsx(
|
|
382
|
-
code: (e) => /* @__PURE__ */ f.jsx(
|
|
383
|
-
text: (e) => /* @__PURE__ */ f.jsx(
|
|
384
|
-
},
|
|
378
|
+
image: (e) => /* @__PURE__ */ f.jsx(Sn, { className: "text-teal-500 dark:text-teal-400", style: ae(e) }),
|
|
379
|
+
audio: (e) => /* @__PURE__ */ f.jsx(wn, { className: "text-pink-500 dark:text-pink-400", style: ae(e) }),
|
|
380
|
+
video: (e) => /* @__PURE__ */ f.jsx(vn, { className: "text-violet-500 dark:text-violet-400", style: ae(e) }),
|
|
381
|
+
archive: (e) => /* @__PURE__ */ f.jsx(bn, { className: "text-amber-500 dark:text-amber-400", style: ae(e) }),
|
|
382
|
+
code: (e) => /* @__PURE__ */ f.jsx(gn, { className: "text-purple-500 dark:text-purple-400", style: ae(e) }),
|
|
383
|
+
text: (e) => /* @__PURE__ */ f.jsx(yn, { className: "text-gray-500 dark:text-gray-400", style: ae(e) })
|
|
384
|
+
}, Bn = {
|
|
385
385
|
markdown: ["md", "markdown", "mdx"],
|
|
386
386
|
pdf: ["pdf"],
|
|
387
387
|
spreadsheet: ["xls", "xlsx", "xlsm", "xlsb", "ods"],
|
|
@@ -394,7 +394,7 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
394
394
|
archive: ["zip", "tar", "gz", "7z", "rar", "tgz", "bz2"],
|
|
395
395
|
code: ["js", "mjs", "cjs", "ts", "tsx", "jsx", "json", "html", "htm", "css", "scss", "py", "go", "rs", "c", "cpp", "h", "hpp", "sh", "bash", "yaml", "yml", "sql", "xml", "toml"],
|
|
396
396
|
text: ["txt", "log"]
|
|
397
|
-
},
|
|
397
|
+
}, Yn = new Map(Object.entries(Bn).flatMap(([e, t]) => t.map((r) => [r, e]))), Gn = /* @__PURE__ */ new Set(["", "application/octet-stream", "binary/octet-stream", "text/plain", "application/x-empty"]), Vn = (e) => (e ?? "").split(";", 1)[0].trim().toLowerCase(), Xn = (e) => {
|
|
398
398
|
if (e === "text/markdown" || e === "text/x-markdown") return "markdown";
|
|
399
399
|
if (e === "application/pdf") return "pdf";
|
|
400
400
|
if (e.includes("excel") || e.includes("spreadsheet")) return "spreadsheet";
|
|
@@ -408,30 +408,30 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
408
408
|
if (e === "application/json" || e.includes("javascript") || e.includes("typescript") || e.includes("xml") || e.startsWith("text/html") || e.startsWith("text/css") || e.includes("x-python") || e.includes("x-sh") || e.includes("x-go") || e.includes("x-rust"))
|
|
409
409
|
return "code";
|
|
410
410
|
if (e.startsWith("text/")) return "text";
|
|
411
|
-
},
|
|
412
|
-
const a =
|
|
413
|
-
return b === void 0 ? /* @__PURE__ */ f.jsx(
|
|
414
|
-
},
|
|
411
|
+
}, Kn = (e, t, r, n) => {
|
|
412
|
+
const a = Vn(e), i = Xn(a), l = Yn.get((t || (r ? Dt(r) : "")).toLowerCase()), b = (Gn.has(a) ? [l, i] : [i, l]).find((w) => w !== void 0);
|
|
413
|
+
return b === void 0 ? /* @__PURE__ */ f.jsx(pn, { className: "text-gray-400 dark:text-gray-400", style: ae(n) }) : Wn[b](n);
|
|
414
|
+
}, $r = (e, t, r) => {
|
|
415
415
|
const { entry: n, isDirectory: a, isExpanded: i, extension: l, mimeType: d } = e;
|
|
416
416
|
let b;
|
|
417
417
|
const w = d || n.mimeType;
|
|
418
|
-
return n.icon !== void 0 ? b = n.icon : a ? b = i && t?.directoryExpanded || t?.directory || /* @__PURE__ */ f.jsx(
|
|
419
|
-
},
|
|
418
|
+
return n.icon !== void 0 ? b = n.icon : a ? b = i && t?.directoryExpanded || t?.directory || /* @__PURE__ */ f.jsx(Dn, { style: ae(r) }) : l && t?.fileByExtension?.[l] ? b = t.fileByExtension[l] : b = t?.file || Kn(w, l, n.name, r), Ct(typeof b == "function" ? b(e) : b, n.absolutePath);
|
|
419
|
+
}, Un = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Hr = (e) => {
|
|
420
420
|
if (!e)
|
|
421
421
|
return;
|
|
422
422
|
const t = Object.entries(e).filter(([, r]) => r != null);
|
|
423
423
|
if (t.length !== 0)
|
|
424
|
-
return Object.fromEntries(t.map(([r, n]) => [`data-${
|
|
425
|
-
},
|
|
424
|
+
return Object.fromEntries(t.map(([r, n]) => [`data-${Un(r)}`, String(n)]));
|
|
425
|
+
}, Jn = 500, Wr = ({ entry: e, isDirectory: t, isExpanded: r, isItemSelected: n, selectionMode: a, onSelectionChange: i, onEntryClick: l, toggleDirectory: d, onToggleDirectoryRecursive: b }) => {
|
|
426
426
|
const w = Y(null);
|
|
427
427
|
return Ae(
|
|
428
428
|
() => () => {
|
|
429
429
|
w.current && window.clearTimeout(w.current);
|
|
430
430
|
},
|
|
431
431
|
[]
|
|
432
|
-
),
|
|
433
|
-
(
|
|
434
|
-
|
|
432
|
+
), P(
|
|
433
|
+
(S) => {
|
|
434
|
+
S.stopPropagation(), a !== "none" && !t && i && i(e, !n);
|
|
435
435
|
let E = !1;
|
|
436
436
|
l({
|
|
437
437
|
entry: e,
|
|
@@ -442,14 +442,14 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
442
442
|
}
|
|
443
443
|
}), !(!t || E) && (w.current ? (window.clearTimeout(w.current), w.current = null, b(e)) : w.current = window.setTimeout(() => {
|
|
444
444
|
d(e.absolutePath), w.current = null;
|
|
445
|
-
},
|
|
445
|
+
}, Jn));
|
|
446
446
|
},
|
|
447
447
|
[t, e, r, b, d, l, a, i, n]
|
|
448
448
|
);
|
|
449
|
-
},
|
|
449
|
+
}, Br = (e) => e === "right" ? "dt-grid-cell--right" : e === "center" ? "dt-grid-cell--center" : "", kr = (e, t) => e.children !== void 0 && t(e.absolutePath), Yr = (e, t) => ({
|
|
450
450
|
width: e,
|
|
451
451
|
gridTemplateColumns: t
|
|
452
|
-
}),
|
|
452
|
+
}), Gr = Lt(
|
|
453
453
|
({
|
|
454
454
|
entry: e,
|
|
455
455
|
indentLevel: t,
|
|
@@ -461,23 +461,23 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
461
461
|
onRowBlur: d,
|
|
462
462
|
isSelectedForAria: b,
|
|
463
463
|
rowHeight: w,
|
|
464
|
-
isDirOpen:
|
|
464
|
+
isDirOpen: S,
|
|
465
465
|
columns: E,
|
|
466
466
|
numericTemplate: T,
|
|
467
467
|
numericTotal: h,
|
|
468
468
|
nameWidth: g,
|
|
469
469
|
rowClassName: m,
|
|
470
|
-
selection: { onEntryClick: p, selectedPath: v, currentPath: z, mode:
|
|
470
|
+
selection: { onEntryClick: p, selectedPath: v, currentPath: z, mode: _ = "none", selectedItems: C, onSelectionChange: y },
|
|
471
471
|
expansion: { toggleDirectory: F, onToggleDirectoryRecursive: M },
|
|
472
|
-
visual: { iconOverrides:
|
|
472
|
+
visual: { iconOverrides: j, showExpandIcons: Q = !0, showDirectoryIcons: U = !0, showFileIcons: $ = !0, useCanvasExpandIcons: B = !1, expandIconSize: fe, typeIconSize: J, fontSize: oe, indentSize: we, highlightStyles: V, expandIconClassName: X, expandIconStyle: Se }
|
|
473
473
|
}) => {
|
|
474
|
-
const [pe, o] = de(!1), u = e.children !== void 0, N = u &&
|
|
474
|
+
const [pe, o] = de(!1), u = e.children !== void 0, N = u && S(e.absolutePath), I = e.absolutePath === v, ye = e.absolutePath === z, k = !u && !!C?.has(e.absolutePath), O = u ? void 0 : Mr(e), ee = Wr({ entry: e, isDirectory: u, isExpanded: N, isItemSelected: k, selectionMode: _, onSelectionChange: y, onEntryClick: p, toggleDirectory: F, onToggleDirectoryRecursive: M }), he = pe ? V?.hoverClassName !== void 0 ? V.hoverClassName : D.entryHover : "", Re = (() => {
|
|
475
475
|
if (u) {
|
|
476
476
|
if (I) return V?.directorySelectedClassName !== void 0 ? V.directorySelectedClassName : D.entrySelected;
|
|
477
477
|
} else if (I || k)
|
|
478
478
|
return V?.itemSelectedClassName !== void 0 ? V.itemSelectedClassName : L(I && D.entrySelected, k && D.entryItemSelected);
|
|
479
479
|
return "";
|
|
480
|
-
})(), A = typeof m == "function" ? m(e) : m, ge = L("dt-grid-row cursor-pointer select-none", he, Re, A, e.className), Z = L(D.expandIcon, X, (I || k) && D.expandIconSelected), Le = L(D.typeIcon, (I || k) && D.typeIconSelected), se = L("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", u && D.nameDirectory, (I || k) && D.nameSelected), te =
|
|
480
|
+
})(), A = typeof m == "function" ? m(e) : m, ge = L("dt-grid-row cursor-pointer select-none", he, Re, A, e.className), Z = L(D.expandIcon, X, (I || k) && D.expandIconSelected), Le = L(D.typeIcon, (I || k) && D.typeIconSelected), se = L("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", u && D.nameDirectory, (I || k) && D.nameSelected), te = zr({ isDirectory: u, isExpanded: N, showExpandIcons: Q, useCanvasExpandIcons: B, expandIconSize: fe }), le = (u ? U : $) ? $r({ entry: e, isDirectory: u, isExpanded: N, isSelected: I, isItemSelected: k, extension: O, mimeType: e.mimeType }, j, J) : null, Ne = { indentLevel: t, isDirectory: u, isExpanded: N }, [Pe, ...ke] = E, De = Pe?.render ? Pe.render(e, Ne) : e.label ?? e.name, xe = {
|
|
481
481
|
...pe ? V?.hoverStyle : {},
|
|
482
482
|
...u && I ? V?.directorySelectedStyle : {},
|
|
483
483
|
...!u && (I || k) ? V?.itemSelectedStyle : {}
|
|
@@ -486,16 +486,16 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
486
486
|
"div",
|
|
487
487
|
{
|
|
488
488
|
className: ge,
|
|
489
|
-
style: { height: w, ...
|
|
489
|
+
style: { height: w, ...xe, ...e.style },
|
|
490
490
|
role: "row",
|
|
491
491
|
"aria-expanded": u ? N : void 0,
|
|
492
492
|
"aria-level": t + 1,
|
|
493
493
|
"aria-posinset": r,
|
|
494
494
|
"aria-setsize": n,
|
|
495
495
|
"aria-rowindex": a,
|
|
496
|
-
"aria-selected":
|
|
496
|
+
"aria-selected": _ === "none" ? void 0 : b,
|
|
497
497
|
"aria-current": ye ? "page" : void 0,
|
|
498
|
-
|
|
498
|
+
...Hr(e.data),
|
|
499
499
|
"data-entry-type": u ? "directory" : "file",
|
|
500
500
|
"data-entry-expanded": u ? String(N) : void 0,
|
|
501
501
|
"data-entry-selected": I ? "true" : void 0,
|
|
@@ -516,12 +516,12 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
516
516
|
},
|
|
517
517
|
tabIndex: 0,
|
|
518
518
|
children: [
|
|
519
|
-
/* @__PURE__ */ f.jsxs("div", { className: L("dt-grid-name-cell",
|
|
520
|
-
(Q || B) && /* @__PURE__ */ f.jsx("span", { className: Z, style: { width: ce, height: ce, ...
|
|
519
|
+
/* @__PURE__ */ f.jsxs("div", { className: L("dt-grid-name-cell", Pe?.className), role: "gridcell", style: { width: g, paddingLeft: Math.max(0, t * we) }, children: [
|
|
520
|
+
(Q || B) && /* @__PURE__ */ f.jsx("span", { className: Z, style: { width: ce, height: ce, ...Se }, children: te }),
|
|
521
521
|
(u ? U : $) && /* @__PURE__ */ f.jsx("span", { className: Le, style: { width: J, height: J }, children: le }),
|
|
522
|
-
/* @__PURE__ */ f.jsx("span", { className: se, style:
|
|
522
|
+
/* @__PURE__ */ f.jsx("span", { className: se, style: Fr(oe), children: De })
|
|
523
523
|
] }),
|
|
524
|
-
ke.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-track", style:
|
|
524
|
+
ke.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-track", style: Yr(h, T), children: ke.map((G) => /* @__PURE__ */ f.jsx("div", { className: L("dt-grid-cell", Br(G.align), G.className), role: "gridcell", children: G.render ? G.render(e, Ne) : null }, G.key)) }) })
|
|
525
525
|
]
|
|
526
526
|
}
|
|
527
527
|
);
|
|
@@ -533,8 +533,8 @@ const Ln = /* @__PURE__ */ ue.forwardRef(An), Pt = 44, Dn = 12, Fn = 8, ce = 14,
|
|
|
533
533
|
e.flatIndex === t.flatIndex && e.isSelectedForAria === t.isSelectedForAria && e.rowHeight === t.rowHeight && r === 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.currentPath === t.selection.currentPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual === t.visual;
|
|
534
534
|
}
|
|
535
535
|
);
|
|
536
|
-
|
|
537
|
-
const
|
|
536
|
+
Gr.displayName = "DirectoryTreeGridRow";
|
|
537
|
+
const Vr = ({
|
|
538
538
|
kind: e,
|
|
539
539
|
columns: t,
|
|
540
540
|
numericTemplate: r,
|
|
@@ -545,25 +545,25 @@ const Gr = ({
|
|
|
545
545
|
nameContent: d,
|
|
546
546
|
renderCell: b
|
|
547
547
|
}) => {
|
|
548
|
-
const [, ...w] = t,
|
|
548
|
+
const [, ...w] = t, S = e === "header" ? "dt-grid-name-header" : "dt-grid-name-footer", E = e === "header" ? "dt-grid-header" : "dt-grid-footer", T = e === "header" ? "columnheader" : "gridcell";
|
|
549
549
|
return /* @__PURE__ */ f.jsxs("div", { className: L(E, "text-gray-600 dark:text-gray-300", l), role: "row", children: [
|
|
550
|
-
/* @__PURE__ */ f.jsx("div", { className: L(
|
|
551
|
-
w.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-track", style:
|
|
550
|
+
/* @__PURE__ */ f.jsx("div", { className: L(S, "px-1", t[0]?.className), role: T, style: { width: a }, children: d }),
|
|
551
|
+
w.length > 0 && /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ f.jsx("div", { className: "dt-grid-numeric-track", style: Yr(n, r), children: w.map((h) => /* @__PURE__ */ f.jsx("div", { className: L("dt-grid-cell", Br(h.align), h.className), role: T, children: b(h) }, h.key)) }) }),
|
|
552
552
|
/* @__PURE__ */ f.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: i }, "aria-hidden": "true" })
|
|
553
553
|
] });
|
|
554
|
-
},
|
|
554
|
+
}, Zn = ({ columns: e, className: t, ...r }) => /* @__PURE__ */ f.jsx(Vr, { kind: "header", columns: e, className: t, nameContent: e[0]?.header ?? null, renderCell: (n) => n.header ?? null, ...r }), Tr = (e, t) => typeof e == "function" ? e(t) : e ?? null, qn = ({ columns: e, allEntries: t, className: r, ...n }) => /* @__PURE__ */ f.jsx(Vr, { kind: "footer", columns: e, className: r, nameContent: Tr(e[0]?.footer, t), renderCell: (a) => Tr(a.footer, t), ...n }), Qn = 240, Xr = 96, Kr = 12, jt = (e, t) => {
|
|
555
555
|
const r = e?.width;
|
|
556
556
|
return typeof r == "number" && Number.isFinite(r) && r > 0 ? r : t;
|
|
557
|
-
},
|
|
558
|
-
const n =
|
|
557
|
+
}, eo = (e) => e.slice(1).map((t) => `${jt(t, Xr)}px`).join(" "), to = ({ measuredWidth: e, columns: t, scrollBarWidth: r = Kr }) => {
|
|
558
|
+
const n = jt(t[0], Qn), a = t.slice(1).reduce((b, w) => b + jt(w, Xr), 0), i = Number.isFinite(e) && e > 0 ? e : 0, l = Math.max(0, i - n - Math.max(0, r)), d = Math.max(0, a - l);
|
|
559
559
|
return { nameWidth: n, numericTotal: a, numericVisible: l, maxHScroll: d };
|
|
560
|
-
},
|
|
560
|
+
}, Pt = (e, t) => !Number.isFinite(e) || e < 0 ? 0 : e > t ? t : e, ro = (e) => {
|
|
561
561
|
const t = [], r = (n) => {
|
|
562
562
|
for (const a of n)
|
|
563
563
|
t.push(a), a.children && a.children.length > 0 && r(a.children);
|
|
564
564
|
};
|
|
565
565
|
return r(e), t;
|
|
566
|
-
},
|
|
566
|
+
}, Ur = ["entryKindDirectory", "entryKindFile"], _r = [...ft, ...Ur], Ot = Object.freeze({
|
|
567
567
|
en: Object.freeze({
|
|
568
568
|
entryKindDirectory: "directory",
|
|
569
569
|
entryKindFile: "file"
|
|
@@ -572,10 +572,10 @@ const Gr = ({
|
|
|
572
572
|
entryKindDirectory: "ディレクトリ",
|
|
573
573
|
entryKindFile: "ファイル"
|
|
574
574
|
})
|
|
575
|
-
}),
|
|
576
|
-
en: Object.freeze({ ...
|
|
577
|
-
ja: Object.freeze({ ...
|
|
578
|
-
}),
|
|
575
|
+
}), no = Object.freeze({
|
|
576
|
+
en: Object.freeze({ ...xr.en, ...Ot.en }),
|
|
577
|
+
ja: Object.freeze({ ...xr.ja, ...Ot.ja })
|
|
578
|
+
}), Pr = (e) => typeof e == "string" ? JSON.stringify(e) : e === null ? "null" : typeof e, oo = (e) => {
|
|
579
579
|
const t = {};
|
|
580
580
|
let r = !1;
|
|
581
581
|
for (const n of ft) {
|
|
@@ -583,34 +583,34 @@ const Gr = ({
|
|
|
583
583
|
a !== void 0 && (t[n] = a, r = !0);
|
|
584
584
|
}
|
|
585
585
|
return r ? t : void 0;
|
|
586
|
-
},
|
|
586
|
+
}, so = (e, t) => {
|
|
587
587
|
const r = Lr(e);
|
|
588
588
|
if (t === void 0)
|
|
589
|
-
return
|
|
589
|
+
return no[r];
|
|
590
590
|
if (t === null || typeof t != "object")
|
|
591
|
-
throw new RangeError(`[directory-tree] labels must be an object; got ${
|
|
591
|
+
throw new RangeError(`[directory-tree] labels must be an object; got ${Pr(t)}`);
|
|
592
592
|
const n = Object.getPrototypeOf(t);
|
|
593
593
|
if (n !== Object.prototype && n !== null)
|
|
594
594
|
throw new RangeError(`[directory-tree] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t) ? "an array" : "an object with a non-plain prototype"}`);
|
|
595
595
|
for (const l of Object.keys(t))
|
|
596
|
-
if (!
|
|
597
|
-
throw new RangeError(`[directory-tree] labels.${l} is not a known label key; expected one of ${
|
|
598
|
-
const i = { ...
|
|
599
|
-
for (const l of
|
|
596
|
+
if (!_r.includes(l))
|
|
597
|
+
throw new RangeError(`[directory-tree] labels.${l} is not a known label key; expected one of ${_r.join(", ")}`);
|
|
598
|
+
const i = { ...fn(r, oo(t)), ...Ot[r] };
|
|
599
|
+
for (const l of Ur) {
|
|
600
600
|
const d = Object.hasOwn(t, l) ? t[l] : void 0;
|
|
601
601
|
if (d !== void 0) {
|
|
602
602
|
if (typeof d != "string" || d.trim() === "")
|
|
603
|
-
throw new RangeError(`[directory-tree] labels.${l} must be a non-blank string; got ${
|
|
603
|
+
throw new RangeError(`[directory-tree] labels.${l} must be a non-blank string; got ${Pr(d)}`);
|
|
604
604
|
i[l] = d;
|
|
605
605
|
}
|
|
606
606
|
}
|
|
607
607
|
return Object.freeze(i);
|
|
608
|
-
},
|
|
608
|
+
}, ao = (e) => {
|
|
609
609
|
const t = {};
|
|
610
610
|
for (const r of ft)
|
|
611
611
|
t[r] = e[r];
|
|
612
612
|
return Object.freeze(t);
|
|
613
|
-
},
|
|
613
|
+
}, lo = () => {
|
|
614
614
|
let e = null;
|
|
615
615
|
return {
|
|
616
616
|
mark: (t) => {
|
|
@@ -625,23 +625,23 @@ const Gr = ({
|
|
|
625
625
|
if (typeof t != "number" || !Number.isFinite(t) || t <= 0)
|
|
626
626
|
throw new RangeError(`[directory-tree] visual.${e} must be a finite number greater than 0 (px); got ${Ze(t)}.`);
|
|
627
627
|
return t;
|
|
628
|
-
},
|
|
628
|
+
}, io = (e) => {
|
|
629
629
|
if (typeof e == "string" && e.trim() !== "" || typeof e == "number" && Number.isFinite(e) && e > 0)
|
|
630
630
|
return e;
|
|
631
631
|
throw new RangeError(`[directory-tree] visual.fontSize must be a finite number greater than 0 (px) or a CSS font size that is not blank; got ${Ze(e)}.`);
|
|
632
|
-
},
|
|
633
|
-
indentSize: e === void 0 ?
|
|
634
|
-
typeIconSize: t === void 0 ?
|
|
635
|
-
fontSize: r === void 0 ? void 0 :
|
|
636
|
-
}),
|
|
632
|
+
}, co = ({ indentSize: e, typeIconSize: t, fontSize: r }) => ({
|
|
633
|
+
indentSize: e === void 0 ? Mn : At("indentSize", e),
|
|
634
|
+
typeIconSize: t === void 0 ? $n : At("typeIconSize", t),
|
|
635
|
+
fontSize: r === void 0 ? void 0 : io(r)
|
|
636
|
+
}), uo = ({ indentSize: e, removeRootIndent: t, hasExpandBox: r }) => t ? Math.max(0, e - (r ? ce : 0)) : 0, fo = (e, t, r) => {
|
|
637
637
|
if (typeof e != "function")
|
|
638
638
|
return At("itemHeight", e);
|
|
639
639
|
const n = e(t, r);
|
|
640
640
|
if (typeof n != "number" || !Number.isFinite(n) || n <= 0)
|
|
641
641
|
throw new RangeError(`[directory-tree] visual.itemHeight returned ${Ze(n)} for ${JSON.stringify(t.absolutePath)} (row ${r}); it must return a finite number greater than 0 (px).`);
|
|
642
642
|
return n;
|
|
643
|
-
},
|
|
644
|
-
const n = t === void 0 ?
|
|
643
|
+
}, ho = (e, t, r) => {
|
|
644
|
+
const n = t === void 0 ? zn : t;
|
|
645
645
|
if (typeof n != "number" || !Number.isFinite(n) || n <= 0 || n > ce)
|
|
646
646
|
throw new RangeError(`[directory-tree] visual.expandIconSize must be a finite number greater than 0 and at most ${ce} (the expand box, px) while tree lines are drawn; got ${Ze(n)}.`);
|
|
647
647
|
const { indentSize: a, typeIconSize: i } = e, l = n / 2, d = ce + i - n / 2;
|
|
@@ -650,7 +650,7 @@ const Gr = ({
|
|
|
650
650
|
`[directory-tree] visual.indentSize ${Ze(a)} does not fit the tree lines: with typeIconSize ${i} and an expand glyph of ${n} px it must be from ${l} (half the glyph) to ${d} (the ${ce} px expand box + typeIconSize − half the glyph).`
|
|
651
651
|
);
|
|
652
652
|
return { indentSize: a, typeIconSize: i, glyphSize: n, originX: r };
|
|
653
|
-
},
|
|
653
|
+
}, mo = ({ indentSize: e, typeIconSize: t, glyphSize: r }) => Math.min(Math.max(ce + t / 2 - e, r / 2), ce - r / 2), po = (e, t) => {
|
|
654
654
|
const r = e.length - 1;
|
|
655
655
|
if (r <= 0) return 0;
|
|
656
656
|
let n = 0, a = r - 1, i = 0;
|
|
@@ -659,22 +659,22 @@ const Gr = ({
|
|
|
659
659
|
e[l] <= t ? (i = l, n = l + 1) : a = l - 1;
|
|
660
660
|
}
|
|
661
661
|
return i;
|
|
662
|
-
},
|
|
662
|
+
}, yo = (e, t, r) => {
|
|
663
663
|
if (r <= 0 || e.length === 0 || t.length !== e.length + 1)
|
|
664
664
|
return null;
|
|
665
|
-
const n =
|
|
665
|
+
const n = po(t, r), a = e[n];
|
|
666
666
|
return a ? {
|
|
667
667
|
path: a.entry.absolutePath,
|
|
668
668
|
offsetInViewport: r - t[n]
|
|
669
669
|
} : null;
|
|
670
|
-
},
|
|
670
|
+
}, go = (e, t, r) => {
|
|
671
671
|
if (t.length === 0 || r.length !== t.length + 1)
|
|
672
672
|
return null;
|
|
673
673
|
for (let n = 0; n < t.length; n++)
|
|
674
674
|
if (t[n].entry.absolutePath === e.path)
|
|
675
675
|
return Math.max(0, r[n] + e.offsetInViewport);
|
|
676
676
|
return null;
|
|
677
|
-
},
|
|
677
|
+
}, bo = (e, t, r) => {
|
|
678
678
|
const n = [];
|
|
679
679
|
for (let a = t; a < r; a++) {
|
|
680
680
|
const i = e[a];
|
|
@@ -683,7 +683,7 @@ const Gr = ({
|
|
|
683
683
|
n.push(l);
|
|
684
684
|
}
|
|
685
685
|
return n;
|
|
686
|
-
},
|
|
686
|
+
}, vo = (e, t, r) => {
|
|
687
687
|
const n = [];
|
|
688
688
|
for (let a = t; a < r; a++) {
|
|
689
689
|
const i = e[a];
|
|
@@ -692,17 +692,17 @@ const Gr = ({
|
|
|
692
692
|
n.push(l);
|
|
693
693
|
}
|
|
694
694
|
return n;
|
|
695
|
-
},
|
|
695
|
+
}, wo = (e, t, r, n) => {
|
|
696
696
|
const a = Math.max(1, Math.floor(t * n)), i = Math.max(1, Math.floor(r * n));
|
|
697
697
|
(e.width !== a || e.height !== i) && (e.width = a, e.height = i);
|
|
698
698
|
const l = e.style;
|
|
699
699
|
l.width !== `${t}px` && (l.width = `${t}px`), l.height !== `${r}px` && (l.height = `${r}px`);
|
|
700
|
-
},
|
|
700
|
+
}, So = (e, t, r) => {
|
|
701
701
|
e.lineWidth = r, e.beginPath();
|
|
702
702
|
for (const n of t)
|
|
703
703
|
e.moveTo(n.x1, n.y1), e.lineTo(n.x2, n.y2);
|
|
704
704
|
e.stroke();
|
|
705
|
-
},
|
|
705
|
+
}, xo = (e, t) => {
|
|
706
706
|
const r = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());
|
|
707
707
|
if (!r)
|
|
708
708
|
return null;
|
|
@@ -710,17 +710,17 @@ const Gr = ({
|
|
|
710
710
|
n.length === 3 && (n = n.split("").map((d) => d + d).join(""));
|
|
711
711
|
const a = Number.parseInt(n.slice(0, 2), 16), i = Number.parseInt(n.slice(2, 4), 16), l = Number.parseInt(n.slice(4, 6), 16);
|
|
712
712
|
return `rgba(${a}, ${i}, ${l}, ${t})`;
|
|
713
|
-
},
|
|
713
|
+
}, Eo = (e, t, r, n) => {
|
|
714
714
|
if (t.length === 0)
|
|
715
715
|
return;
|
|
716
|
-
const a =
|
|
716
|
+
const a = xo(r, 0.14), i = e.strokeStyle, l = e.fillStyle, d = e.lineWidth, b = e.lineCap, w = e.lineJoin;
|
|
717
717
|
e.strokeStyle = r, e.lineCap = "round", e.lineJoin = "round";
|
|
718
|
-
for (const
|
|
719
|
-
const E = n ??
|
|
720
|
-
a && (e.fillStyle = a, e.beginPath(), e.arc(
|
|
718
|
+
for (const S of t) {
|
|
719
|
+
const E = n ?? S.size, T = Math.max(0, E / 2), h = Math.max(1, Math.round(E * 0.08)), g = Math.max(1, Math.round(E * 0.14)), m = Math.max(0, T - h * 0.8), p = Math.max(0, m * 0.55);
|
|
720
|
+
a && (e.fillStyle = a, e.beginPath(), e.arc(S.centerX, S.centerY, m, 0, Math.PI * 2), e.fill()), e.lineWidth = h, e.beginPath(), e.arc(S.centerX, S.centerY, Math.max(0, T - h * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = g, e.beginPath(), e.moveTo(S.centerX - p, S.centerY), e.lineTo(S.centerX + p, S.centerY), e.stroke(), S.isExpanded || (e.beginPath(), e.moveTo(S.centerX, S.centerY - p), e.lineTo(S.centerX, S.centerY + p), e.stroke());
|
|
721
721
|
}
|
|
722
722
|
e.strokeStyle = i, e.fillStyle = l, e.lineWidth = d, e.lineCap = b, e.lineJoin = w;
|
|
723
|
-
},
|
|
723
|
+
}, Jr = Lt(({ segmentsByItem: e, glyphsByItem: t, itemHeight: r, width: n, viewportHeight: a, scrollPosition: i, color: l = "#a0aec0", strokeWidth: d = 1, renderStartIndex: b, renderEndIndex: w, lookaheadEndIndex: S, devicePixelRatio: E, expandGlyphColor: T, expandGlyphSize: h }) => {
|
|
724
724
|
const g = Y(null), m = Y(null), p = Y({
|
|
725
725
|
segmentsByItem: e,
|
|
726
726
|
glyphsByItem: t,
|
|
@@ -732,40 +732,40 @@ const Gr = ({
|
|
|
732
732
|
strokeWidth: d,
|
|
733
733
|
renderStartIndex: b,
|
|
734
734
|
renderEndIndex: w,
|
|
735
|
-
lookaheadEndIndex:
|
|
735
|
+
lookaheadEndIndex: S,
|
|
736
736
|
devicePixelRatio: E,
|
|
737
737
|
expandGlyphColor: T,
|
|
738
738
|
expandGlyphSize: h
|
|
739
|
-
}), v =
|
|
739
|
+
}), v = P(() => {
|
|
740
740
|
m.current = null;
|
|
741
|
-
const
|
|
742
|
-
if (!
|
|
741
|
+
const _ = g.current;
|
|
742
|
+
if (!_)
|
|
743
743
|
return;
|
|
744
|
-
const
|
|
745
|
-
if (!
|
|
744
|
+
const C = _.getContext("2d");
|
|
745
|
+
if (!C)
|
|
746
746
|
return;
|
|
747
747
|
const y = p.current;
|
|
748
748
|
if (y.width <= 0 || y.viewportHeight <= 0) {
|
|
749
|
-
|
|
749
|
+
C.clearRect(0, 0, _.width, _.height);
|
|
750
750
|
return;
|
|
751
751
|
}
|
|
752
752
|
const F = Number.isFinite(y.devicePixelRatio ?? NaN) ? y.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
|
|
753
|
-
|
|
754
|
-
const M = y.segmentsByItem.length,
|
|
753
|
+
wo(_, y.width, y.viewportHeight, F);
|
|
754
|
+
const M = y.segmentsByItem.length, j = typeof y.renderStartIndex == "number" && Number.isFinite(y.renderStartIndex) ? Math.max(0, Math.floor(y.renderStartIndex)) : Math.max(0, Math.floor(y.scrollPosition / y.itemHeight)), Q = Math.min(M, Math.ceil((y.scrollPosition + y.viewportHeight) / y.itemHeight)), U = (() => {
|
|
755
755
|
if (typeof y.renderEndIndex == "number" && Number.isFinite(y.renderEndIndex)) {
|
|
756
756
|
const J = Math.floor(y.renderEndIndex);
|
|
757
|
-
return Math.max(Math.min(M, J + 1),
|
|
757
|
+
return Math.max(Math.min(M, J + 1), j);
|
|
758
758
|
}
|
|
759
|
-
return Math.max(Q,
|
|
759
|
+
return Math.max(Q, j);
|
|
760
760
|
})(), $ = (() => {
|
|
761
761
|
if (typeof y.lookaheadEndIndex == "number" && Number.isFinite(y.lookaheadEndIndex)) {
|
|
762
762
|
const J = Math.floor(y.lookaheadEndIndex), oe = Math.min(M, J + 1);
|
|
763
763
|
return Math.max(oe, U);
|
|
764
764
|
}
|
|
765
765
|
return Math.max(Q, U);
|
|
766
|
-
})(), B =
|
|
767
|
-
|
|
768
|
-
}, []), z =
|
|
766
|
+
})(), B = bo(y.segmentsByItem, j, $), fe = vo(y.glyphsByItem, j, $);
|
|
767
|
+
C.save(), C.scale(F, F), C.clearRect(0, 0, y.width, y.viewportHeight), C.translate(0, -y.scrollPosition), C.strokeStyle = y.color, So(C, B, y.strokeWidth), Eo(C, fe, y.expandGlyphColor ?? y.color, y.expandGlyphSize), C.restore();
|
|
768
|
+
}, []), z = P(() => {
|
|
769
769
|
m.current === null && (m.current = window.requestAnimationFrame(v));
|
|
770
770
|
}, [v]);
|
|
771
771
|
return Ae(() => {
|
|
@@ -780,24 +780,24 @@ const Gr = ({
|
|
|
780
780
|
strokeWidth: d,
|
|
781
781
|
renderStartIndex: b,
|
|
782
782
|
renderEndIndex: w,
|
|
783
|
-
lookaheadEndIndex:
|
|
783
|
+
lookaheadEndIndex: S,
|
|
784
784
|
devicePixelRatio: E,
|
|
785
785
|
expandGlyphColor: T,
|
|
786
786
|
expandGlyphSize: h
|
|
787
787
|
}, z();
|
|
788
|
-
}, [e, t, r, n, a, i, l, d, b, w,
|
|
788
|
+
}, [e, t, r, n, a, i, l, d, b, w, S, E, T, h, z]), Ae(() => () => {
|
|
789
789
|
m.current !== null && (window.cancelAnimationFrame(m.current), m.current = null);
|
|
790
790
|
}, []), /* @__PURE__ */ f.jsx("canvas", { ref: g, className: "pointer-events-none absolute top-0 left-0 z-0" });
|
|
791
791
|
});
|
|
792
|
-
|
|
793
|
-
const
|
|
792
|
+
Jr.displayName = "TreeLineCanvas";
|
|
793
|
+
const Io = (e) => {
|
|
794
794
|
const t = /* @__PURE__ */ new Map();
|
|
795
795
|
for (let r = 0; r < e.length; r++) {
|
|
796
796
|
const n = e[r].entry.absolutePath;
|
|
797
797
|
t.has(n) || t.set(n, r);
|
|
798
798
|
}
|
|
799
799
|
return t;
|
|
800
|
-
},
|
|
800
|
+
}, Cr = (e, t) => e.selectedPath === t ? e : { selectedPath: t, selectionGeneration: e.selectionGeneration + 1, anchor: e.anchor }, Ro = (e, t) => ({ ...e, anchor: { path: t, selectionGeneration: e.selectionGeneration, focused: !0 } }), No = (e, t) => {
|
|
801
801
|
const { anchor: r, selectionGeneration: n, selectedPath: a } = t;
|
|
802
802
|
if (r !== null && (r.focused || r.selectionGeneration === n)) {
|
|
803
803
|
const i = e.get(r.path);
|
|
@@ -810,23 +810,23 @@ const So = (e) => {
|
|
|
810
810
|
return i;
|
|
811
811
|
}
|
|
812
812
|
return 0;
|
|
813
|
-
},
|
|
813
|
+
}, ko = {
|
|
814
814
|
msOverflowStyle: "none",
|
|
815
815
|
scrollbarWidth: "none"
|
|
816
|
-
},
|
|
816
|
+
}, To = () => {
|
|
817
817
|
let e = document.getElementById("directory-tree-webkit-scrollbar-hide");
|
|
818
818
|
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));
|
|
819
|
-
},
|
|
819
|
+
}, _o = (e) => {
|
|
820
820
|
const t = Y(null), r = t.current;
|
|
821
821
|
return r !== null && ft.every((n) => r[n] === e[n]) ? r : (t.current = e, e);
|
|
822
|
-
},
|
|
822
|
+
}, jr = /* @__PURE__ */ new Set(["top", "bottom", "center", "nearest"]), Or = (e) => {
|
|
823
823
|
const t = e?.align;
|
|
824
824
|
if (t === void 0)
|
|
825
825
|
return "top";
|
|
826
|
-
if (!
|
|
827
|
-
throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[...
|
|
826
|
+
if (!jr.has(t))
|
|
827
|
+
throw new RangeError(`[directory-tree] Unsupported scroll alignment ${JSON.stringify(t)}; expected one of ${[...jr].join(", ")}.`);
|
|
828
828
|
return t;
|
|
829
|
-
},
|
|
829
|
+
}, Po = {
|
|
830
830
|
position: "absolute",
|
|
831
831
|
width: 1,
|
|
832
832
|
height: 1,
|
|
@@ -836,25 +836,25 @@ const So = (e) => {
|
|
|
836
836
|
overflow: "hidden",
|
|
837
837
|
clipPath: "inset(50%)",
|
|
838
838
|
whiteSpace: "nowrap"
|
|
839
|
-
},
|
|
839
|
+
}, Co = (e, t, r, n, a) => {
|
|
840
840
|
const i = [], l = [];
|
|
841
841
|
let d = 0;
|
|
842
|
-
const b = (w,
|
|
842
|
+
const b = (w, S, E) => {
|
|
843
843
|
const T = a ? [...w].sort(a) : w;
|
|
844
844
|
for (let h = 0; h < T.length; h++) {
|
|
845
845
|
const g = T[h], m = h === T.length - 1, p = [...E, m], v = g.children !== void 0, z = v && t(g.absolutePath, g.relativePath);
|
|
846
|
-
let
|
|
847
|
-
n && (
|
|
846
|
+
let _ = S, C = E;
|
|
847
|
+
n && (_ = S - 1, C = E.slice(1)), i.push({ entry: g, indentLevel: _, depth: S, positionInSet: h + 1, setSize: T.length }), r && (_ > d && (d = _), l.push({
|
|
848
848
|
id: g.absolutePath,
|
|
849
849
|
name: g.name,
|
|
850
850
|
absolutePath: g.absolutePath,
|
|
851
|
-
indentLevel:
|
|
851
|
+
indentLevel: _,
|
|
852
852
|
isLastChild: m,
|
|
853
853
|
isDirectory: v,
|
|
854
854
|
isExpanded: z,
|
|
855
|
-
ancestorIsLast: [...
|
|
856
|
-
hideLines: n &&
|
|
857
|
-
})), v && z && g.children && b(g.children,
|
|
855
|
+
ancestorIsLast: [...C],
|
|
856
|
+
hideLines: n && S === 0
|
|
857
|
+
})), v && z && g.children && b(g.children, S + 1, p);
|
|
858
858
|
}
|
|
859
859
|
};
|
|
860
860
|
return b(e, 0, []), { flatItems: i, lineItems: l, maxIndent: d };
|
|
@@ -867,37 +867,37 @@ const So = (e) => {
|
|
|
867
867
|
e[l] <= t ? (i = l, n = l + 1) : a = l - 1;
|
|
868
868
|
}
|
|
869
869
|
return i;
|
|
870
|
-
},
|
|
871
|
-
const l = n?.renderStart ?? Math.max(0, Ar(i, a)), d = t > 0 ? Ar(i, a + t) + r : l + r, b = e > 0 ? Math.min(e - 1, Math.max(l, d)) : l, w = n?.renderEnd ?? b,
|
|
872
|
-
return { renderStart: l, renderEnd: w, lookaheadEnd:
|
|
873
|
-
},
|
|
870
|
+
}, jo = (e, t, r, n, a, i) => {
|
|
871
|
+
const l = n?.renderStart ?? Math.max(0, Ar(i, a)), d = t > 0 ? Ar(i, a + t) + r : l + r, b = e > 0 ? Math.min(e - 1, Math.max(l, d)) : l, w = n?.renderEnd ?? b, S = e > 0 ? Math.min(e - 1, w + r) : w;
|
|
872
|
+
return { renderStart: l, renderEnd: w, lookaheadEnd: S };
|
|
873
|
+
}, Oo = (e, t, r, n) => {
|
|
874
874
|
if (e.length === 0)
|
|
875
875
|
return { segmentsByItem: [], glyphsByItem: [] };
|
|
876
|
-
const { indentSize: a, typeIconSize: i, glyphSize: l, originX: d } = n, b = Array.from({ length: e.length }, () => []), w = Array.from({ length: e.length }, () => []),
|
|
876
|
+
const { indentSize: a, typeIconSize: i, glyphSize: l, originX: d } = n, b = Array.from({ length: e.length }, () => []), w = Array.from({ length: e.length }, () => []), S = d + mo(n), E = (h) => h * a + S, T = l / 2 + 2;
|
|
877
877
|
for (let h = 0; h < e.length; h++) {
|
|
878
|
-
const g = e[h], m = t[h] ?? 0, p = r[h] ?? 0, v = p + m / 2, z = e[h + 1],
|
|
878
|
+
const g = e[h], m = t[h] ?? 0, p = r[h] ?? 0, v = p + m / 2, z = e[h + 1], _ = v + i / 2, C = p + m, y = z !== void 0 && z.indentLevel === g.indentLevel + 1 && _ < C ? { key: `${g.id}-connector-children`, x1: E(z.indentLevel), y1: _, x2: E(z.indentLevel), y2: C, itemIndex: h } : null;
|
|
879
879
|
if (g.hideLines) {
|
|
880
880
|
y !== null && (b[h] = [y]);
|
|
881
881
|
continue;
|
|
882
882
|
}
|
|
883
883
|
const F = [];
|
|
884
|
-
for (let
|
|
885
|
-
if (g.ancestorIsLast[
|
|
884
|
+
for (let j = 0; j < g.indentLevel; j++) {
|
|
885
|
+
if (g.ancestorIsLast[j] ?? !1)
|
|
886
886
|
continue;
|
|
887
887
|
let U = !1;
|
|
888
888
|
for (let $ = h; $ < e.length; $++) {
|
|
889
889
|
const B = e[$];
|
|
890
|
-
if (B.indentLevel >
|
|
890
|
+
if (B.indentLevel > j && B.ancestorIsLast.length > j && !B.ancestorIsLast[j]) {
|
|
891
891
|
U = !0;
|
|
892
892
|
break;
|
|
893
893
|
}
|
|
894
|
-
if ($ > h && B.indentLevel ===
|
|
894
|
+
if ($ > h && B.indentLevel === j)
|
|
895
895
|
break;
|
|
896
896
|
}
|
|
897
897
|
if (U) {
|
|
898
|
-
const $ = E(
|
|
898
|
+
const $ = E(j);
|
|
899
899
|
F.push({
|
|
900
|
-
key: `${g.id}-ancestor-${
|
|
900
|
+
key: `${g.id}-ancestor-${j}`,
|
|
901
901
|
x1: $,
|
|
902
902
|
y1: p,
|
|
903
903
|
x2: $,
|
|
@@ -947,7 +947,7 @@ const So = (e) => {
|
|
|
947
947
|
]);
|
|
948
948
|
}
|
|
949
949
|
return { segmentsByItem: b, glyphsByItem: w };
|
|
950
|
-
},
|
|
950
|
+
}, Zr = Lt(
|
|
951
951
|
({
|
|
952
952
|
entry: e,
|
|
953
953
|
indentLevel: t,
|
|
@@ -959,7 +959,7 @@ const So = (e) => {
|
|
|
959
959
|
flatIndex: d,
|
|
960
960
|
isActive: b,
|
|
961
961
|
registerRowRef: w,
|
|
962
|
-
onNavigationKeyDown:
|
|
962
|
+
onNavigationKeyDown: S,
|
|
963
963
|
onRowFocus: E,
|
|
964
964
|
onRowBlur: T,
|
|
965
965
|
rowHeight: h,
|
|
@@ -967,7 +967,7 @@ const So = (e) => {
|
|
|
967
967
|
entryKindFile: m,
|
|
968
968
|
isDirOpen: p,
|
|
969
969
|
expansion: { toggleDirectory: v, onToggleDirectoryRecursive: z },
|
|
970
|
-
selection: { onEntryClick:
|
|
970
|
+
selection: { onEntryClick: _, selectedPath: C, currentPath: y, mode: F = "none", selectedItems: M, onSelectionChange: j },
|
|
971
971
|
visual: {
|
|
972
972
|
iconOverrides: Q,
|
|
973
973
|
showExpandIcons: U = !0,
|
|
@@ -979,7 +979,7 @@ const So = (e) => {
|
|
|
979
979
|
fontSize: we,
|
|
980
980
|
indentSize: V,
|
|
981
981
|
highlightStyles: X,
|
|
982
|
-
entryClassName:
|
|
982
|
+
entryClassName: Se,
|
|
983
983
|
entryStyle: pe,
|
|
984
984
|
nameClassName: o,
|
|
985
985
|
nameStyle: u,
|
|
@@ -991,18 +991,18 @@ const So = (e) => {
|
|
|
991
991
|
expandIconStyle: ee
|
|
992
992
|
}
|
|
993
993
|
}) => {
|
|
994
|
-
const [he, Re] = de(!1), A = e.children !== void 0, ge = A && p(e.absolutePath), Z = e.absolutePath ===
|
|
994
|
+
const [he, Re] = de(!1), A = e.children !== void 0, ge = A && p(e.absolutePath), Z = e.absolutePath === C, Le = e.absolutePath === y, se = !A && M?.has(e.absolutePath), te = P((re) => w(d, re), [w, d]), le = A ? void 0 : Mr(e), Ne = Wr({ entry: e, isDirectory: A, isExpanded: ge, isItemSelected: !!se, selectionMode: F, onSelectionChange: j, onEntryClick: _, toggleDirectory: v, onToggleDirectoryRecursive: z }), Pe = he ? X?.hoverClassName !== void 0 ? X.hoverClassName : D.entryHover : "", ke = (() => {
|
|
995
995
|
if (A) {
|
|
996
996
|
if (Z)
|
|
997
997
|
return X?.directorySelectedClassName !== void 0 ? X.directorySelectedClassName : D.entrySelected;
|
|
998
998
|
} else if (Z || se)
|
|
999
999
|
return X?.itemSelectedClassName !== void 0 ? X.itemSelectedClassName : L(Z && D.entrySelected, se && D.entryItemSelected);
|
|
1000
1000
|
return "";
|
|
1001
|
-
})(), De = L(D.entry,
|
|
1001
|
+
})(), De = L(D.entry, Pe, ke, Se, e.className), xe = L(D.expandIcon, O, (Z || se) && D.expandIconSelected), G = L(D.typeIcon, (Z || se) && D.typeIconSelected), Be = L(D.name, o, A && D.nameDirectory, A && N, !A && ye, (Z || se) && D.nameSelected), qe = zr({ isDirectory: A, isExpanded: ge, showExpandIcons: U && t >= 0, useCanvasExpandIcons: fe, expandIconSize: J }), ht = (A ? $ : B) ? $r({ entry: e, isDirectory: A, isExpanded: ge, isSelected: Z, isItemSelected: !!se, extension: le, mimeType: e.mimeType }, Q, oe) : null, Ye = {
|
|
1002
1002
|
...he ? X?.hoverStyle : {},
|
|
1003
1003
|
...A && Z ? X?.directorySelectedStyle : {},
|
|
1004
1004
|
...!A && (Z || se) ? X?.itemSelectedStyle : {}
|
|
1005
|
-
}, Ge =
|
|
1005
|
+
}, Ge = Hr(e.data), Qe = { width: oe, height: oe }, et = Fr(we), be = r + t * V;
|
|
1006
1006
|
return /* @__PURE__ */ f.jsxs(
|
|
1007
1007
|
"div",
|
|
1008
1008
|
{
|
|
@@ -1033,7 +1033,7 @@ const So = (e) => {
|
|
|
1033
1033
|
re.preventDefault(), re.repeat || Ne(re);
|
|
1034
1034
|
return;
|
|
1035
1035
|
}
|
|
1036
|
-
|
|
1036
|
+
S(re, d);
|
|
1037
1037
|
},
|
|
1038
1038
|
tabIndex: b ? 0 : -1,
|
|
1039
1039
|
role: "treeitem",
|
|
@@ -1045,7 +1045,7 @@ const So = (e) => {
|
|
|
1045
1045
|
"aria-current": Le ? "page" : void 0,
|
|
1046
1046
|
"aria-label": `${e.name} (${A ? g : m})`,
|
|
1047
1047
|
children: [
|
|
1048
|
-
(U || fe) && /* @__PURE__ */ f.jsx("span", { className:
|
|
1048
|
+
(U || fe) && /* @__PURE__ */ f.jsx("span", { className: xe, style: { width: ce, height: ce, ...ee }, children: qe }),
|
|
1049
1049
|
(A ? $ : B) && /* @__PURE__ */ f.jsx("span", { className: G, style: Qe, children: ht }),
|
|
1050
1050
|
/* @__PURE__ */ f.jsx(
|
|
1051
1051
|
"span",
|
|
@@ -1073,40 +1073,40 @@ const So = (e) => {
|
|
|
1073
1073
|
e.entryKindDirectory === t.entryKindDirectory && e.entryKindFile === t.entryKindFile && a === i && e.selection.selectedPath === t.selection.selectedPath && e.selection.currentPath === t.selection.currentPath && e.selection.mode === t.selection.mode && e.selection.selectedItems === t.selection.selectedItems && e.visual.iconOverrides === t.visual.iconOverrides && e.visual.showExpandIcons === t.visual.showExpandIcons && e.visual.showDirectoryIcons === t.visual.showDirectoryIcons && e.visual.showFileIcons === t.visual.showFileIcons && e.visual.useCanvasExpandIcons === t.visual.useCanvasExpandIcons && e.visual.expandIconSize === t.visual.expandIconSize && e.visual.typeIconSize === t.visual.typeIconSize && e.visual.fontSize === t.visual.fontSize && e.visual.indentSize === t.visual.indentSize && e.visual.highlightStyles === t.visual.highlightStyles && e.visual.entryClassName === t.visual.entryClassName && e.visual.entryStyle === t.visual.entryStyle && e.visual.nameClassName === t.visual.nameClassName && e.visual.nameStyle === t.visual.nameStyle && e.visual.directoryNameClassName === t.visual.directoryNameClassName && e.visual.directoryNameStyle === t.visual.directoryNameStyle && e.visual.fileNameClassName === t.visual.fileNameClassName && e.visual.fileNameStyle === t.visual.fileNameStyle && e.visual.expandIconClassName === t.visual.expandIconClassName && e.visual.expandIconStyle === t.visual.expandIconStyle;
|
|
1074
1074
|
}
|
|
1075
1075
|
);
|
|
1076
|
-
|
|
1077
|
-
const
|
|
1076
|
+
Zr.displayName = "DirectoryEntryItem";
|
|
1077
|
+
const qr = (e) => {
|
|
1078
1078
|
const t = [];
|
|
1079
1079
|
if (e.children)
|
|
1080
1080
|
for (const r of e.children)
|
|
1081
|
-
r.type === "directory" && (t.push(r.absolutePath), t.push(...
|
|
1081
|
+
r.type === "directory" && (t.push(r.absolutePath), t.push(...qr(r)));
|
|
1082
1082
|
return t;
|
|
1083
|
-
},
|
|
1083
|
+
}, Mo = ({
|
|
1084
1084
|
entries: e,
|
|
1085
1085
|
expansion: { toggle: t, isExpanded: r, expandMultiple: n, collapseMultiple: a, isPending: i, alwaysExpanded: l = !1, doubleClickAction: d = "recursive" },
|
|
1086
|
-
selection: { onEntryClick: b, selectedPath: w, currentPath:
|
|
1086
|
+
selection: { onEntryClick: b, selectedPath: w, currentPath: S, mode: E = "none", selectedItems: T, onSelectionChange: h },
|
|
1087
1087
|
visual: {
|
|
1088
1088
|
className: g,
|
|
1089
1089
|
style: m,
|
|
1090
1090
|
ariaLabel: p,
|
|
1091
1091
|
ariaLabelledBy: v,
|
|
1092
1092
|
lineColor: z = "#A0AEC0",
|
|
1093
|
-
showTreeLines:
|
|
1094
|
-
showExpandIcons:
|
|
1093
|
+
showTreeLines: _ = !0,
|
|
1094
|
+
showExpandIcons: C = !0,
|
|
1095
1095
|
showDirectoryIcons: y = !0,
|
|
1096
1096
|
showFileIcons: F = !0,
|
|
1097
1097
|
iconOverrides: M,
|
|
1098
|
-
expandIconSize:
|
|
1098
|
+
expandIconSize: j,
|
|
1099
1099
|
typeIconSize: Q,
|
|
1100
1100
|
fontSize: U,
|
|
1101
1101
|
indentSize: $,
|
|
1102
|
-
itemHeight: B =
|
|
1102
|
+
itemHeight: B = _t,
|
|
1103
1103
|
removeRootIndent: fe = !1,
|
|
1104
1104
|
highlightStyles: J,
|
|
1105
1105
|
entryClassName: oe,
|
|
1106
1106
|
entryStyle: we,
|
|
1107
1107
|
nameClassName: V,
|
|
1108
1108
|
nameStyle: X,
|
|
1109
|
-
directoryNameClassName:
|
|
1109
|
+
directoryNameClassName: Se,
|
|
1110
1110
|
directoryNameStyle: pe,
|
|
1111
1111
|
fileNameClassName: o,
|
|
1112
1112
|
fileNameStyle: u,
|
|
@@ -1120,7 +1120,7 @@ const Zr = (e) => {
|
|
|
1120
1120
|
labels: he,
|
|
1121
1121
|
ref: Re
|
|
1122
1122
|
}) => {
|
|
1123
|
-
const A = Lr(ee), ge = W(() =>
|
|
1123
|
+
const A = Lr(ee), ge = W(() => so(ee, he), [ee, he]), Z = _o(ao(ge)), { entryKindDirectory: Le, entryKindFile: se } = ge, te = W(() => co({ indentSize: $, typeIconSize: Q, fontSize: U }), [$, Q, U]), le = k !== void 0, [Ne, Pe] = de(!1), ke = Y(null), De = Y(null), xe = Y(null), [G, Be] = de(0), [qe, ht] = de(0), [Ye, Ge] = de(0), [Qe, et] = de(null), {
|
|
1124
1124
|
overscanCount: be = 15,
|
|
1125
1125
|
className: re,
|
|
1126
1126
|
background: Ft,
|
|
@@ -1138,29 +1138,29 @@ const Zr = (e) => {
|
|
|
1138
1138
|
scrollBarOptions: mt,
|
|
1139
1139
|
behaviorOptions: Xt,
|
|
1140
1140
|
preserveScrollAnchor: Kt = !1,
|
|
1141
|
-
getItemKey:
|
|
1141
|
+
getItemKey: Qr,
|
|
1142
1142
|
// 素通しの pass-through。型で受け付けているものは実際に転送する
|
|
1143
1143
|
testId: Ut,
|
|
1144
1144
|
contentProps: pt
|
|
1145
1145
|
} = ye ?? {}, Jt = W(
|
|
1146
1146
|
() => le ? { ...pt, role: "rowgroup" } : { ...pt, role: "tree", "aria-label": v ? void 0 : p, "aria-labelledby": v, "aria-multiselectable": E === "multiple" ? !0 : void 0 },
|
|
1147
1147
|
[le, pt, p, v, E]
|
|
1148
|
-
), Zt = W(() => ({ ...Xt, enableKeyboardNavigation: !1 }), [Xt]), [tt, qt] = de(typeof Fe == "number" ? Fe : 0), yt = Y(typeof Fe == "number" ? Fe : 0), Qt =
|
|
1148
|
+
), Zt = W(() => ({ ...Xt, enableKeyboardNavigation: !1 }), [Xt]), [tt, qt] = de(typeof Fe == "number" ? Fe : 0), yt = Y(typeof Fe == "number" ? Fe : 0), Qt = P(
|
|
1149
1149
|
(s, c) => {
|
|
1150
1150
|
yt.current = s, qt(s), Mt?.(s, c);
|
|
1151
1151
|
},
|
|
1152
1152
|
[Mt]
|
|
1153
|
-
), er =
|
|
1153
|
+
), er = P(
|
|
1154
1154
|
(s) => {
|
|
1155
|
-
const { renderingStartIndex: c, renderingEndIndex:
|
|
1156
|
-
et((R) => R && R.renderStart === c && R.renderEnd ===
|
|
1155
|
+
const { renderingStartIndex: c, renderingEndIndex: x } = s;
|
|
1156
|
+
et((R) => R && R.renderStart === c && R.renderEnd === x ? R : { renderStart: c, renderEnd: x }), zt?.(s);
|
|
1157
1157
|
},
|
|
1158
1158
|
[zt]
|
|
1159
1159
|
);
|
|
1160
1160
|
Ae(() => {
|
|
1161
|
-
|
|
1161
|
+
Pe(!0), To();
|
|
1162
1162
|
}, []), Ae(() => {
|
|
1163
|
-
const s = ke.current, c = le ? De.current : s,
|
|
1163
|
+
const s = ke.current, c = le ? De.current : s, x = () => {
|
|
1164
1164
|
if (s) {
|
|
1165
1165
|
const H = s.clientWidth;
|
|
1166
1166
|
ht((q) => Math.abs(q - H) > 1 ? H : q);
|
|
@@ -1173,36 +1173,36 @@ const Zr = (e) => {
|
|
|
1173
1173
|
}
|
|
1174
1174
|
};
|
|
1175
1175
|
if (!(s || c)) return Be(0);
|
|
1176
|
-
|
|
1177
|
-
const R = new ResizeObserver(
|
|
1176
|
+
x();
|
|
1177
|
+
const R = new ResizeObserver(x);
|
|
1178
1178
|
return s && R.observe(s), c && c !== s && R.observe(c), () => R.disconnect();
|
|
1179
1179
|
}, [ie, le]);
|
|
1180
|
-
const Me = typeof ie == "number" ? ie : G, ve =
|
|
1180
|
+
const Me = typeof ie == "number" ? ie : G, ve = P((s) => l || (Ne ? r(s) : !1), [Ne, r, l]), tr = L(D.container, i && D.containerPending, g), rr = W(
|
|
1181
1181
|
() => ({
|
|
1182
|
-
...
|
|
1182
|
+
...ko,
|
|
1183
1183
|
...m ?? {},
|
|
1184
1184
|
...typeof ie == "number" ? { height: ie, minHeight: ie } : {}
|
|
1185
1185
|
}),
|
|
1186
1186
|
[m, ie]
|
|
1187
|
-
), gt =
|
|
1187
|
+
), gt = P(
|
|
1188
1188
|
(s, c) => {
|
|
1189
|
-
const
|
|
1190
|
-
if (
|
|
1191
|
-
if (
|
|
1192
|
-
if (R === "toggle") return a(
|
|
1189
|
+
const x = [s.absolutePath, ...qr(s)], R = c || d;
|
|
1190
|
+
if (x.every((Ie) => ve(Ie))) return a(x);
|
|
1191
|
+
if (x.every((Ie) => !ve(Ie)) || R === "recursive") return n(x);
|
|
1192
|
+
if (R === "toggle") return a(x);
|
|
1193
1193
|
console.warn(`[DirectoryTree] Unknown double click action: ${R}. No action taken.`);
|
|
1194
1194
|
},
|
|
1195
1195
|
[ve, n, a, d]
|
|
1196
|
-
), bt = le ? !1 : fe, { flatItems:
|
|
1196
|
+
), bt = le ? !1 : fe, { flatItems: Ce, lineItems: vt, maxIndent: nr } = W(() => Co(e, ve, _, bt, O), [e, ve, _, bt, O]), rt = uo({ indentSize: te.indentSize, removeRootIndent: bt, hasExpandBox: C || _ }), me = W(() => _ ? ho(te, j, rt) : null, [_, te, j, rt]), K = W(() => Ce.map((s, c) => ({ ...s, rowHeight: fo(B, s.entry, c) })), [Ce, B]), Te = W(() => K.map((s) => s.rowHeight), [K]), je = W(() => {
|
|
1197
1197
|
const s = new Array(Te.length + 1);
|
|
1198
1198
|
s[0] = 0;
|
|
1199
1199
|
for (let c = 0; c < Te.length; c++)
|
|
1200
1200
|
s[c + 1] = s[c] + Te[c];
|
|
1201
1201
|
return s;
|
|
1202
|
-
}, [Te]), or =
|
|
1203
|
-
|
|
1204
|
-
const nt = W(() =>
|
|
1205
|
-
|
|
1202
|
+
}, [Te]), or = P((s) => K[s]?.rowHeight ?? _t, [K]), en = P((s) => K[s]?.entry.absolutePath ?? s, [K]), sr = Qr ?? en, ze = w ?? null, wt = S ?? null, [ar, Ve] = de(() => ({ selectedPath: ze, selectionGeneration: 0, anchor: null })), St = Cr(ar, ze);
|
|
1203
|
+
St !== ar && Ve((s) => Cr(s, ze));
|
|
1204
|
+
const nt = W(() => Io(Ce), [Ce]), $e = W(() => No(nt, St), [nt, St]), Xe = Y(/* @__PURE__ */ new Map()), ot = Y(null), [st] = de(lo), Ke = Y(null), [tn, lr] = de(!0), xt = Y(Ce);
|
|
1205
|
+
xt.current = Ce;
|
|
1206
1206
|
const ir = Y(ve);
|
|
1207
1207
|
ir.current = ve;
|
|
1208
1208
|
const Et = Y(t);
|
|
@@ -1213,10 +1213,10 @@ const Zr = (e) => {
|
|
|
1213
1213
|
It.current = $e;
|
|
1214
1214
|
const dr = Y(Vt);
|
|
1215
1215
|
dr.current = Vt;
|
|
1216
|
-
const Oe =
|
|
1217
|
-
const c =
|
|
1216
|
+
const Oe = P((s) => {
|
|
1217
|
+
const c = xe.current;
|
|
1218
1218
|
return !c || c.getViewportSize() <= 0 ? !1 : (c.scrollToIndex(s, { align: "nearest" }), !0);
|
|
1219
|
-
}, []), Ee =
|
|
1219
|
+
}, []), Ee = P(
|
|
1220
1220
|
(s) => {
|
|
1221
1221
|
const c = Xe.current.get(s);
|
|
1222
1222
|
if (c === void 0) {
|
|
@@ -1226,64 +1226,64 @@ const Zr = (e) => {
|
|
|
1226
1226
|
Ke.current = null, Oe(s), c.focus({ preventScroll: !0 });
|
|
1227
1227
|
},
|
|
1228
1228
|
[Oe]
|
|
1229
|
-
), ur =
|
|
1229
|
+
), ur = P((s, c) => {
|
|
1230
1230
|
if (c)
|
|
1231
|
-
Xe.current.set(s, c), Ke.current === s ? (Ke.current = null, c.focus({ preventScroll: !0 })) : c.contains(c.ownerDocument.activeElement) && Ve((
|
|
1231
|
+
Xe.current.set(s, c), Ke.current === s ? (Ke.current = null, c.focus({ preventScroll: !0 })) : c.contains(c.ownerDocument.activeElement) && Ve((x) => x.anchor === null ? x : { ...x, anchor: { ...x.anchor, focused: !0 } });
|
|
1232
1232
|
else {
|
|
1233
|
-
const
|
|
1234
|
-
Xe.current.delete(s),
|
|
1233
|
+
const x = Xe.current.get(s);
|
|
1234
|
+
Xe.current.delete(s), x?.contains(x.ownerDocument.activeElement) && Ve((R) => R.anchor === null ? R : { ...R, anchor: { ...R.anchor, focused: !1 } });
|
|
1235
1235
|
}
|
|
1236
1236
|
s === It.current && lr(c !== null);
|
|
1237
1237
|
}, []);
|
|
1238
|
-
|
|
1238
|
+
Sr(() => {
|
|
1239
1239
|
lr(Xe.current.has($e));
|
|
1240
1240
|
}, [$e]);
|
|
1241
|
-
const Rt =
|
|
1242
|
-
(s, c,
|
|
1243
|
-
const R = ot.current ===
|
|
1244
|
-
ot.current = null, R || (Ve((H) =>
|
|
1241
|
+
const Rt = P(
|
|
1242
|
+
(s, c, x) => {
|
|
1243
|
+
const R = ot.current === x;
|
|
1244
|
+
ot.current = null, R || (Ve((H) => Ro(H, c)), st.landedOn(x) || Oe(s)), dr.current?.(s);
|
|
1245
1245
|
},
|
|
1246
1246
|
[Oe, st]
|
|
1247
|
-
), at =
|
|
1248
|
-
const { ownerDocument:
|
|
1249
|
-
if (!
|
|
1247
|
+
), at = P((s) => st.mark(s.nativeEvent), [st]), Nt = P((s, c) => {
|
|
1248
|
+
const { ownerDocument: x } = c;
|
|
1249
|
+
if (!x.hasFocus() && c.contains(x.activeElement)) {
|
|
1250
1250
|
ot.current = c;
|
|
1251
1251
|
return;
|
|
1252
1252
|
}
|
|
1253
1253
|
ot.current = null, Ve((R) => R.anchor !== null && R.anchor.path === s ? { ...R, anchor: { ...R.anchor, focused: !1 } } : R);
|
|
1254
|
-
}, []),
|
|
1254
|
+
}, []), rn = P(() => Ee(It.current), [Ee]), kt = P(
|
|
1255
1255
|
(s, c) => {
|
|
1256
|
-
const
|
|
1256
|
+
const x = Or(c), R = xt.current.length;
|
|
1257
1257
|
if (!Number.isInteger(s) || s < 0 || s >= R)
|
|
1258
1258
|
throw new RangeError(`[directory-tree] scrollToIndex: ${String(s)} is not a row index (${R === 0 ? "the tree has no rows" : `expected an integer in 0..${String(R - 1)}`}).`);
|
|
1259
|
-
if (
|
|
1259
|
+
if (x === "nearest") {
|
|
1260
1260
|
Oe(s);
|
|
1261
1261
|
return;
|
|
1262
1262
|
}
|
|
1263
|
-
|
|
1263
|
+
xe.current?.scrollToIndex(s, { align: x });
|
|
1264
1264
|
},
|
|
1265
1265
|
[Oe]
|
|
1266
1266
|
);
|
|
1267
|
-
|
|
1267
|
+
dn(
|
|
1268
1268
|
Re,
|
|
1269
1269
|
() => ({
|
|
1270
1270
|
scrollToIndex: kt,
|
|
1271
1271
|
scrollToPath: (s, c) => {
|
|
1272
1272
|
Or(c);
|
|
1273
|
-
const
|
|
1274
|
-
return
|
|
1273
|
+
const x = cr.current.get(s);
|
|
1274
|
+
return x === void 0 ? !1 : (kt(x, c), !0);
|
|
1275
1275
|
},
|
|
1276
|
-
getScrollAnchor: () =>
|
|
1276
|
+
getScrollAnchor: () => xe.current?.getScrollAnchor() ?? null
|
|
1277
1277
|
}),
|
|
1278
1278
|
[kt]
|
|
1279
1279
|
);
|
|
1280
|
-
const fr =
|
|
1280
|
+
const fr = P(
|
|
1281
1281
|
(s, c) => {
|
|
1282
1282
|
if (s.altKey || s.ctrlKey || s.metaKey)
|
|
1283
1283
|
return;
|
|
1284
|
-
const
|
|
1284
|
+
const x = xt.current, R = x.length - 1;
|
|
1285
1285
|
if (R < 0) return;
|
|
1286
|
-
const H =
|
|
1286
|
+
const H = x[c], q = H?.entry.children !== void 0, Ie = q && ir.current(H.entry.absolutePath);
|
|
1287
1287
|
switch (s.key) {
|
|
1288
1288
|
case "ArrowDown":
|
|
1289
1289
|
s.preventDefault(), Ee(Math.min(c + 1, R));
|
|
@@ -1298,16 +1298,16 @@ const Zr = (e) => {
|
|
|
1298
1298
|
s.preventDefault(), Ee(R);
|
|
1299
1299
|
break;
|
|
1300
1300
|
case "ArrowRight":
|
|
1301
|
-
s.preventDefault(), q && !Ie ? Et.current(H.entry.absolutePath) : q && c < R &&
|
|
1301
|
+
s.preventDefault(), q && !Ie ? Et.current(H.entry.absolutePath) : q && c < R && x[c + 1].depth > H.depth && Ee(c + 1);
|
|
1302
1302
|
break;
|
|
1303
1303
|
case "ArrowLeft": {
|
|
1304
1304
|
if (s.preventDefault(), q && Ie) {
|
|
1305
1305
|
Et.current(H.entry.absolutePath);
|
|
1306
1306
|
break;
|
|
1307
1307
|
}
|
|
1308
|
-
const
|
|
1308
|
+
const ln = H?.depth ?? 0;
|
|
1309
1309
|
for (let dt = c - 1; dt >= 0; dt--)
|
|
1310
|
-
if (
|
|
1310
|
+
if (x[dt].depth < ln) {
|
|
1311
1311
|
Ee(dt);
|
|
1312
1312
|
break;
|
|
1313
1313
|
}
|
|
@@ -1316,15 +1316,15 @@ const Zr = (e) => {
|
|
|
1316
1316
|
}
|
|
1317
1317
|
},
|
|
1318
1318
|
[Ee]
|
|
1319
|
-
), lt = W(() => me === null || vt.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } :
|
|
1320
|
-
() =>
|
|
1321
|
-
[K.length, Me, be, Qe, tt,
|
|
1319
|
+
), lt = W(() => me === null || vt.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : Oo(vt, Te, je, me), [vt, Te, je, me]), it = W(() => me === null || e.length === 0 ? 0 : me.originX + nr * me.indentSize + ce + me.typeIconSize, [e.length, nr, me]), { renderStart: hr, renderEnd: mr, lookaheadEnd: pr } = W(
|
|
1320
|
+
() => jo(K.length, Me, be, Qe, tt, je),
|
|
1321
|
+
[K.length, Me, be, Qe, tt, je]
|
|
1322
1322
|
), Tt = W(() => me === null || it <= 0 || Me <= 0 || lt.segmentsByItem.length === 0 ? null : /* @__PURE__ */ f.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ f.jsx("div", { className: "absolute top-0 left-0", style: { width: it, height: Me }, children: /* @__PURE__ */ f.jsx(
|
|
1323
|
-
|
|
1323
|
+
Jr,
|
|
1324
1324
|
{
|
|
1325
1325
|
segmentsByItem: lt.segmentsByItem,
|
|
1326
1326
|
glyphsByItem: lt.glyphsByItem,
|
|
1327
|
-
itemHeight: Te[0] ??
|
|
1327
|
+
itemHeight: Te[0] ?? _t,
|
|
1328
1328
|
width: it,
|
|
1329
1329
|
viewportHeight: Me,
|
|
1330
1330
|
scrollPosition: tt,
|
|
@@ -1335,32 +1335,32 @@ const Zr = (e) => {
|
|
|
1335
1335
|
renderEndIndex: mr,
|
|
1336
1336
|
lookaheadEndIndex: pr
|
|
1337
1337
|
}
|
|
1338
|
-
) }) }), [it, Me, hr, mr, pr, tt, lt, z, me, Te]), yr =
|
|
1339
|
-
|
|
1338
|
+
) }) }), [it, Me, hr, mr, pr, tt, lt, z, me, Te]), yr = P((s) => K[s], [K]), gr = Y(null);
|
|
1339
|
+
Sr(() => {
|
|
1340
1340
|
const s = gr.current;
|
|
1341
|
-
if (gr.current = { items: K, offsets:
|
|
1341
|
+
if (gr.current = { items: K, offsets: je }, !Kt || !s || s.items === K)
|
|
1342
1342
|
return;
|
|
1343
|
-
const c =
|
|
1343
|
+
const c = xe.current, x = c?.getScrollPosition(), R = typeof x == "number" && x >= 0 ? x : yt.current, H = yo(s.items, s.offsets, R);
|
|
1344
1344
|
if (!H)
|
|
1345
1345
|
return;
|
|
1346
|
-
const q =
|
|
1346
|
+
const q = go(H, K, je);
|
|
1347
1347
|
if (q === null || Math.abs(q - R) < 1)
|
|
1348
1348
|
return;
|
|
1349
1349
|
const Ie = c ? c.scrollTo(q) : q;
|
|
1350
1350
|
yt.current = Ie, qt(Ie);
|
|
1351
|
-
}, [K,
|
|
1352
|
-
const
|
|
1351
|
+
}, [K, je, Kt]);
|
|
1352
|
+
const _e = k?.columns, He = k?.scrollBarWidth ?? mt?.width ?? Kr, ne = W(() => _e ? to({ measuredWidth: qe, columns: _e, scrollBarWidth: He }) : null, [_e, qe, He]), ct = W(() => _e ? eo(_e) : "", [_e]), nn = W(() => k?.showFooter && _e ? ro(e) : [], [k?.showFooter, _e, e]), We = ne?.maxHScroll ?? 0;
|
|
1353
1353
|
Ae(() => {
|
|
1354
|
-
Ge((s) =>
|
|
1354
|
+
Ge((s) => Pt(s, We));
|
|
1355
1355
|
}, [We]);
|
|
1356
|
-
const br =
|
|
1356
|
+
const br = P((s) => Ge((c) => Pt(c + s, We)), [We]), vr = W(
|
|
1357
1357
|
() => ({
|
|
1358
1358
|
iconOverrides: M,
|
|
1359
|
-
showExpandIcons:
|
|
1359
|
+
showExpandIcons: C,
|
|
1360
1360
|
showDirectoryIcons: y,
|
|
1361
1361
|
showFileIcons: F,
|
|
1362
|
-
useCanvasExpandIcons:
|
|
1363
|
-
expandIconSize:
|
|
1362
|
+
useCanvasExpandIcons: _,
|
|
1363
|
+
expandIconSize: j,
|
|
1364
1364
|
typeIconSize: te.typeIconSize,
|
|
1365
1365
|
fontSize: te.fontSize,
|
|
1366
1366
|
indentSize: te.indentSize,
|
|
@@ -1368,12 +1368,12 @@ const Zr = (e) => {
|
|
|
1368
1368
|
expandIconClassName: N,
|
|
1369
1369
|
expandIconStyle: I
|
|
1370
1370
|
}),
|
|
1371
|
-
[M,
|
|
1371
|
+
[M, C, y, F, _, j, te, J, N, I]
|
|
1372
1372
|
), wr = W(
|
|
1373
1373
|
() => /* @__PURE__ */ f.jsx(
|
|
1374
|
-
|
|
1374
|
+
hn,
|
|
1375
1375
|
{
|
|
1376
|
-
ref:
|
|
1376
|
+
ref: xe,
|
|
1377
1377
|
itemCount: K.length,
|
|
1378
1378
|
getItem: yr,
|
|
1379
1379
|
getItemHeight: or,
|
|
@@ -1405,7 +1405,7 @@ const Zr = (e) => {
|
|
|
1405
1405
|
scrollBarOptions: mt,
|
|
1406
1406
|
behaviorOptions: Zt,
|
|
1407
1407
|
children: (s, c) => s ? le && k && ne ? /* @__PURE__ */ f.jsx(
|
|
1408
|
-
|
|
1408
|
+
Gr,
|
|
1409
1409
|
{
|
|
1410
1410
|
entry: s.entry,
|
|
1411
1411
|
indentLevel: s.indentLevel,
|
|
@@ -1429,7 +1429,7 @@ const Zr = (e) => {
|
|
|
1429
1429
|
},
|
|
1430
1430
|
s.entry.absolutePath
|
|
1431
1431
|
) : /* @__PURE__ */ f.jsx(
|
|
1432
|
-
|
|
1432
|
+
Zr,
|
|
1433
1433
|
{
|
|
1434
1434
|
entry: s.entry,
|
|
1435
1435
|
indentLevel: s.indentLevel,
|
|
@@ -1452,11 +1452,11 @@ const Zr = (e) => {
|
|
|
1452
1452
|
selection: { onEntryClick: b, selectedPath: ze, currentPath: wt, mode: E, selectedItems: T, onSelectionChange: h },
|
|
1453
1453
|
visual: {
|
|
1454
1454
|
iconOverrides: M,
|
|
1455
|
-
showExpandIcons:
|
|
1455
|
+
showExpandIcons: C,
|
|
1456
1456
|
showDirectoryIcons: y,
|
|
1457
1457
|
showFileIcons: F,
|
|
1458
|
-
useCanvasExpandIcons:
|
|
1459
|
-
expandIconSize:
|
|
1458
|
+
useCanvasExpandIcons: _,
|
|
1459
|
+
expandIconSize: j,
|
|
1460
1460
|
typeIconSize: te.typeIconSize,
|
|
1461
1461
|
fontSize: te.fontSize,
|
|
1462
1462
|
indentSize: te.indentSize,
|
|
@@ -1465,7 +1465,7 @@ const Zr = (e) => {
|
|
|
1465
1465
|
entryStyle: we,
|
|
1466
1466
|
nameClassName: V,
|
|
1467
1467
|
nameStyle: X,
|
|
1468
|
-
directoryNameClassName:
|
|
1468
|
+
directoryNameClassName: Se,
|
|
1469
1469
|
directoryNameStyle: pe,
|
|
1470
1470
|
fileNameClassName: o,
|
|
1471
1471
|
fileNameStyle: u,
|
|
@@ -1525,11 +1525,11 @@ const Zr = (e) => {
|
|
|
1525
1525
|
gt,
|
|
1526
1526
|
vr,
|
|
1527
1527
|
M,
|
|
1528
|
-
|
|
1528
|
+
C,
|
|
1529
1529
|
y,
|
|
1530
1530
|
F,
|
|
1531
|
-
|
|
1532
|
-
|
|
1531
|
+
_,
|
|
1532
|
+
j,
|
|
1533
1533
|
te,
|
|
1534
1534
|
rt,
|
|
1535
1535
|
J,
|
|
@@ -1537,7 +1537,7 @@ const Zr = (e) => {
|
|
|
1537
1537
|
we,
|
|
1538
1538
|
V,
|
|
1539
1539
|
X,
|
|
1540
|
-
|
|
1540
|
+
Se,
|
|
1541
1541
|
pe,
|
|
1542
1542
|
o,
|
|
1543
1543
|
u,
|
|
@@ -1547,18 +1547,18 @@ const Zr = (e) => {
|
|
|
1547
1547
|
);
|
|
1548
1548
|
if (!(k && ne))
|
|
1549
1549
|
return /* @__PURE__ */ f.jsxs("div", { ref: ke, className: tr, style: rr, onPointerDownCapture: at, onMouseDownCapture: at, children: [
|
|
1550
|
-
|
|
1550
|
+
Ce.length > 0 && !tn && // biome-ignore lint/a11y/noNoninteractiveTabindex: 停止点の行が描画窓の外で DOM に無い間だけ Tab を受け、受けた瞬間にその行へ焦点を渡す。これが無いとツリーに Tab で入れない
|
|
1551
1551
|
// biome-ignore lint/a11y/noStaticElementInteractions: 同上 (焦点の受け渡しだけを担い、要素自身は操作の対象ではない)
|
|
1552
|
-
/* @__PURE__ */ f.jsx("span", { tabIndex: 0, "data-directory-tree-tab-stop": "", style:
|
|
1552
|
+
/* @__PURE__ */ f.jsx("span", { tabIndex: 0, "data-directory-tree-tab-stop": "", style: Po, onFocus: rn }),
|
|
1553
1553
|
wr
|
|
1554
1554
|
] });
|
|
1555
|
-
const
|
|
1555
|
+
const on = k.showHeader ?? !0, sn = k.showFooter ?? !1, an = { ...rr, "--dt-hscroll": `${Ye}px` };
|
|
1556
1556
|
return /* @__PURE__ */ f.jsxs(
|
|
1557
1557
|
"div",
|
|
1558
1558
|
{
|
|
1559
1559
|
ref: ke,
|
|
1560
1560
|
className: L(tr, "dt-grid"),
|
|
1561
|
-
style:
|
|
1561
|
+
style: an,
|
|
1562
1562
|
role: "treegrid",
|
|
1563
1563
|
"aria-label": v ? void 0 : p,
|
|
1564
1564
|
"aria-labelledby": v,
|
|
@@ -1567,13 +1567,13 @@ const Zr = (e) => {
|
|
|
1567
1567
|
onPointerDownCapture: at,
|
|
1568
1568
|
onMouseDownCapture: at,
|
|
1569
1569
|
children: [
|
|
1570
|
-
|
|
1571
|
-
/* @__PURE__ */ f.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ f.jsx(
|
|
1570
|
+
on && // biome-ignore lint/a11y/useSemanticElements: 仮想スクロールの treegrid は絶対配置行を使うため native table 要素にできない。ARIA ロールで意味を提供する
|
|
1571
|
+
/* @__PURE__ */ f.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ f.jsx(Zn, { columns: k.columns, numericTemplate: ct, numericTotal: ne.numericTotal, nameWidth: ne.nameWidth, scrollBarWidth: He, className: k.headerClassName }) }),
|
|
1572
1572
|
/* @__PURE__ */ f.jsx("div", { ref: De, className: "dt-grid-body", children: wr }),
|
|
1573
1573
|
We > 0 && /* @__PURE__ */ f.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
|
|
1574
1574
|
/* @__PURE__ */ f.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: ne.nameWidth }, "aria-hidden": "true" }),
|
|
1575
1575
|
/* @__PURE__ */ f.jsx(
|
|
1576
|
-
|
|
1576
|
+
mn,
|
|
1577
1577
|
{
|
|
1578
1578
|
horizontal: !0,
|
|
1579
1579
|
contentSize: ne.numericTotal,
|
|
@@ -1583,20 +1583,20 @@ const Zr = (e) => {
|
|
|
1583
1583
|
locale: A,
|
|
1584
1584
|
labels: Z,
|
|
1585
1585
|
onScroll: (s) => {
|
|
1586
|
-
const c = typeof s == "function" ? s(Ye) : s,
|
|
1587
|
-
return Ge(
|
|
1586
|
+
const c = typeof s == "function" ? s(Ye) : s, x = Pt(c, We);
|
|
1587
|
+
return Ge(x), x;
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
1590
|
),
|
|
1591
1591
|
/* @__PURE__ */ f.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: He }, "aria-hidden": "true" })
|
|
1592
1592
|
] }),
|
|
1593
|
-
|
|
1594
|
-
/* @__PURE__ */ f.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ f.jsx(
|
|
1593
|
+
sn && // biome-ignore lint/a11y/useSemanticElements: 同上 (フッタ行も絶対配置レイアウトの一部)
|
|
1594
|
+
/* @__PURE__ */ f.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ f.jsx(qn, { columns: k.columns, numericTemplate: ct, numericTotal: ne.numericTotal, nameWidth: ne.nameWidth, scrollBarWidth: He, allEntries: nn, className: k.footerClassName }) })
|
|
1595
1595
|
]
|
|
1596
1596
|
}
|
|
1597
1597
|
);
|
|
1598
|
-
},
|
|
1599
|
-
const [r, n] =
|
|
1598
|
+
}, zo = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
|
|
1599
|
+
const [r, n] = un(), [a, i] = de(() => {
|
|
1600
1600
|
if (typeof window < "u" && t)
|
|
1601
1601
|
try {
|
|
1602
1602
|
const m = window.localStorage.getItem(t);
|
|
@@ -1608,14 +1608,14 @@ const Zr = (e) => {
|
|
|
1608
1608
|
console.error("[useDirectoryTreeState] Error reading from localStorage", m);
|
|
1609
1609
|
}
|
|
1610
1610
|
return e;
|
|
1611
|
-
}), l =
|
|
1611
|
+
}), l = P((m) => {
|
|
1612
1612
|
n(() => {
|
|
1613
1613
|
i((p) => {
|
|
1614
1614
|
const v = new Set(p);
|
|
1615
1615
|
return m(v), v;
|
|
1616
1616
|
});
|
|
1617
1617
|
});
|
|
1618
|
-
}, []), d =
|
|
1618
|
+
}, []), d = P(
|
|
1619
1619
|
(m, p) => {
|
|
1620
1620
|
l((v) => {
|
|
1621
1621
|
for (const z of m)
|
|
@@ -1632,51 +1632,51 @@ const Zr = (e) => {
|
|
|
1632
1632
|
console.warn(`Error setting localStorage key "${t}":`, m);
|
|
1633
1633
|
}
|
|
1634
1634
|
}, [a, t]);
|
|
1635
|
-
const b =
|
|
1635
|
+
const b = P(
|
|
1636
1636
|
(m) => {
|
|
1637
1637
|
d([m], (p, v) => {
|
|
1638
1638
|
p.has(v) ? p.delete(v) : p.add(v);
|
|
1639
1639
|
});
|
|
1640
1640
|
},
|
|
1641
1641
|
[d]
|
|
1642
|
-
), w =
|
|
1642
|
+
), w = P(
|
|
1643
1643
|
(m) => {
|
|
1644
1644
|
d([m], (p, v) => {
|
|
1645
1645
|
p.add(v);
|
|
1646
1646
|
});
|
|
1647
1647
|
},
|
|
1648
1648
|
[d]
|
|
1649
|
-
),
|
|
1649
|
+
), S = P(
|
|
1650
1650
|
(m) => {
|
|
1651
1651
|
d([m], (p, v) => {
|
|
1652
1652
|
p.delete(v);
|
|
1653
1653
|
});
|
|
1654
1654
|
},
|
|
1655
1655
|
[d]
|
|
1656
|
-
), E =
|
|
1656
|
+
), E = P(
|
|
1657
1657
|
(m) => {
|
|
1658
1658
|
d(m, (p, v) => {
|
|
1659
1659
|
p.delete(v);
|
|
1660
1660
|
});
|
|
1661
1661
|
},
|
|
1662
1662
|
[d]
|
|
1663
|
-
), T =
|
|
1663
|
+
), T = P(
|
|
1664
1664
|
(m) => {
|
|
1665
1665
|
d(m, (p, v) => {
|
|
1666
1666
|
p.add(v);
|
|
1667
1667
|
});
|
|
1668
1668
|
},
|
|
1669
1669
|
[d]
|
|
1670
|
-
), h =
|
|
1670
|
+
), h = P(() => {
|
|
1671
1671
|
l((m) => {
|
|
1672
1672
|
m.clear();
|
|
1673
1673
|
});
|
|
1674
|
-
}, [l]), g =
|
|
1674
|
+
}, [l]), g = P((m) => a.has(m), [a]);
|
|
1675
1675
|
return {
|
|
1676
1676
|
expanded: a,
|
|
1677
1677
|
toggle: b,
|
|
1678
1678
|
expand: w,
|
|
1679
|
-
collapse:
|
|
1679
|
+
collapse: S,
|
|
1680
1680
|
collapseMultiple: E,
|
|
1681
1681
|
expandMultiple: T,
|
|
1682
1682
|
collapseAll: h,
|
|
@@ -1685,10 +1685,10 @@ const Zr = (e) => {
|
|
|
1685
1685
|
};
|
|
1686
1686
|
};
|
|
1687
1687
|
export {
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1688
|
+
no as DIRECTORY_TREE_LABEL_CATALOGS,
|
|
1689
|
+
_r as DIRECTORY_TREE_LABEL_KEYS,
|
|
1690
|
+
Mo as DirectoryTree,
|
|
1691
1691
|
D as directoryTreeClasses,
|
|
1692
|
-
|
|
1693
|
-
|
|
1692
|
+
so as resolveDirectoryTreeLabels,
|
|
1693
|
+
zo as useDirectoryTreeState
|
|
1694
1694
|
};
|