@aiquants/directory-tree 3.11.0 → 3.11.2
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 +2 -21
- package/dist/DirectoryTreeGrid.d.ts +3 -17
- package/dist/TreeLine.d.ts +2 -8
- package/dist/cli.server.d.ts +0 -1
- package/dist/entryRendering.d.ts +2 -42
- package/dist/gridUtils.d.ts +1 -30
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +3 -14
- package/dist/index.js +101 -101
- package/dist/logger.d.ts +0 -63
- package/dist/scrollAnchor.d.ts +0 -28
- package/dist/styles/directory-tree.standalone.css +1 -1
- package/dist/types.d.ts +3 -497
- package/dist/useDirectoryTreeState.d.ts +1 -14
- package/dist/useEntryInteraction.d.ts +2 -8
- package/package.json +6 -7
- package/dist/DirectoryTree.d.ts.map +0 -1
- package/dist/DirectoryTreeGrid.d.ts.map +0 -1
- package/dist/TreeLine.d.ts.map +0 -1
- package/dist/cli.server.d.ts.map +0 -1
- package/dist/entryRendering.d.ts.map +0 -1
- package/dist/gridUtils.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/scrollAnchor.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/useDirectoryTreeState.d.ts.map +0 -1
- package/dist/useEntryInteraction.d.ts.map +0 -1
- package/src/DirectoryTree.tsx +0 -1257
- package/src/DirectoryTreeGrid.tsx +0 -285
- package/src/TreeLine.tsx +0 -300
- package/src/cli.server.ts +0 -38
- package/src/entryRendering.tsx +0 -299
- package/src/gridUtils.ts +0 -88
- package/src/index.ts +0 -32
- package/src/logger.ts +0 -162
- package/src/scrollAnchor.spec.ts +0 -105
- package/src/scrollAnchor.ts +0 -86
- package/src/styles/components.entry.css +0 -10
- package/src/styles/directory-tree.css +0 -87
- package/src/styles/standalone.entry.css +0 -12
- package/src/types.ts +0 -761
- package/src/useDirectoryTreeState.ts +0 -133
- package/src/useEntryInteraction.ts +0 -74
- package/src/virtualScrollOptionsSeal.spec.ts +0 -43
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import br, { useRef as ne, useEffect as he, useCallback as F, memo as ot, useState as
|
|
1
|
+
import * as le from "react";
|
|
2
|
+
import br, { useRef as ne, useEffect as he, useCallback as F, memo as ot, useState as ce, useMemo as K, useLayoutEffect as gr, Fragment as wr, useTransition as kr } from "react";
|
|
3
3
|
import { VirtualScroll as Er, ScrollBar as Sr } from "@aiquants/virtualscroll";
|
|
4
4
|
import { twMerge as A } from "tailwind-merge";
|
|
5
5
|
import { FileMd as Dt, FilePdf as Ot, FileXls as Ft, FileCsv as Lt, FileDoc as $t, FilePpt as Ht, FileImage as Wt, FileAudio as Bt, FileVideo as zt, FileZip as Yt, FileCode as Gt, FileText as Vt, FileIcon as Nr } from "@phosphor-icons/react";
|
|
@@ -136,7 +136,7 @@ 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
|
)), a = this.props.ref, a !== void 0 ? a : null;
|
|
138
138
|
}
|
|
139
|
-
function b(a, m, T, M, se,
|
|
139
|
+
function b(a, m, T, M, se, ie) {
|
|
140
140
|
var v = T.ref;
|
|
141
141
|
return a = {
|
|
142
142
|
$$typeof: N,
|
|
@@ -166,10 +166,10 @@ function Rr() {
|
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
168
168
|
writable: !0,
|
|
169
|
-
value:
|
|
169
|
+
value: ie
|
|
170
170
|
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
171
171
|
}
|
|
172
|
-
function d(a, m, T, M, se,
|
|
172
|
+
function d(a, m, T, M, se, ie) {
|
|
173
173
|
var v = m.children;
|
|
174
174
|
if (v !== void 0)
|
|
175
175
|
if (M)
|
|
@@ -214,7 +214,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
214
214
|
T,
|
|
215
215
|
r(),
|
|
216
216
|
se,
|
|
217
|
-
|
|
217
|
+
ie
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
function h(a) {
|
|
@@ -231,10 +231,10 @@ React keys must be passed directly to JSX without using spread:
|
|
|
231
231
|
return a();
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
var B, G = {},
|
|
234
|
+
var B, G = {}, de = w.react_stack_bottom_frame.bind(
|
|
235
235
|
w,
|
|
236
236
|
l
|
|
237
|
-
)(),
|
|
237
|
+
)(), ue = Y(n(l)), P = {};
|
|
238
238
|
_e.Fragment = y, _e.jsx = function(a, m, T) {
|
|
239
239
|
var M = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
240
240
|
return d(
|
|
@@ -242,8 +242,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
242
242
|
m,
|
|
243
243
|
T,
|
|
244
244
|
!1,
|
|
245
|
-
M ? Error("react-stack-top-frame") :
|
|
246
|
-
M ? Y(n(a)) :
|
|
245
|
+
M ? Error("react-stack-top-frame") : de,
|
|
246
|
+
M ? Y(n(a)) : ue
|
|
247
247
|
);
|
|
248
248
|
}, _e.jsxs = function(a, m, T) {
|
|
249
249
|
var M = 1e4 > J.recentlyCreatedOwnerStacks++;
|
|
@@ -252,8 +252,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
252
252
|
m,
|
|
253
253
|
T,
|
|
254
254
|
!0,
|
|
255
|
-
M ? Error("react-stack-top-frame") :
|
|
256
|
-
M ? Y(n(a)) :
|
|
255
|
+
M ? Error("react-stack-top-frame") : de,
|
|
256
|
+
M ? Y(n(a)) : ue
|
|
257
257
|
);
|
|
258
258
|
};
|
|
259
259
|
})()), _e;
|
|
@@ -268,7 +268,7 @@ function Tr({
|
|
|
268
268
|
titleId: t,
|
|
269
269
|
...s
|
|
270
270
|
}, n) {
|
|
271
|
-
return /* @__PURE__ */
|
|
271
|
+
return /* @__PURE__ */ le.createElement("svg", Object.assign({
|
|
272
272
|
xmlns: "http://www.w3.org/2000/svg",
|
|
273
273
|
viewBox: "0 0 24 24",
|
|
274
274
|
fill: "currentColor",
|
|
@@ -276,21 +276,21 @@ function Tr({
|
|
|
276
276
|
"data-slot": "icon",
|
|
277
277
|
ref: n,
|
|
278
278
|
"aria-labelledby": t
|
|
279
|
-
}, s), e ? /* @__PURE__ */
|
|
279
|
+
}, s), e ? /* @__PURE__ */ le.createElement("title", {
|
|
280
280
|
id: t
|
|
281
|
-
}, e) : null, /* @__PURE__ */
|
|
281
|
+
}, e) : null, /* @__PURE__ */ le.createElement("path", {
|
|
282
282
|
fillRule: "evenodd",
|
|
283
283
|
d: "M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z",
|
|
284
284
|
clipRule: "evenodd"
|
|
285
285
|
}));
|
|
286
286
|
}
|
|
287
|
-
const Cr = /* @__PURE__ */
|
|
287
|
+
const Cr = /* @__PURE__ */ le.forwardRef(Tr);
|
|
288
288
|
function Pr({
|
|
289
289
|
title: e,
|
|
290
290
|
titleId: t,
|
|
291
291
|
...s
|
|
292
292
|
}, n) {
|
|
293
|
-
return /* @__PURE__ */
|
|
293
|
+
return /* @__PURE__ */ le.createElement("svg", Object.assign({
|
|
294
294
|
xmlns: "http://www.w3.org/2000/svg",
|
|
295
295
|
viewBox: "0 0 24 24",
|
|
296
296
|
fill: "currentColor",
|
|
@@ -298,21 +298,21 @@ function Pr({
|
|
|
298
298
|
"data-slot": "icon",
|
|
299
299
|
ref: n,
|
|
300
300
|
"aria-labelledby": t
|
|
301
|
-
}, s), e ? /* @__PURE__ */
|
|
301
|
+
}, s), e ? /* @__PURE__ */ le.createElement("title", {
|
|
302
302
|
id: t
|
|
303
|
-
}, e) : null, /* @__PURE__ */
|
|
303
|
+
}, e) : null, /* @__PURE__ */ le.createElement("path", {
|
|
304
304
|
fillRule: "evenodd",
|
|
305
305
|
d: "M16.28 11.47a.75.75 0 0 1 0 1.06l-7.5 7.5a.75.75 0 0 1-1.06-1.06L14.69 12 7.72 5.03a.75.75 0 0 1 1.06-1.06l7.5 7.5Z",
|
|
306
306
|
clipRule: "evenodd"
|
|
307
307
|
}));
|
|
308
308
|
}
|
|
309
|
-
const _r = /* @__PURE__ */
|
|
309
|
+
const _r = /* @__PURE__ */ le.forwardRef(Pr);
|
|
310
310
|
function Ar({
|
|
311
311
|
title: e,
|
|
312
312
|
titleId: t,
|
|
313
313
|
...s
|
|
314
314
|
}, n) {
|
|
315
|
-
return /* @__PURE__ */
|
|
315
|
+
return /* @__PURE__ */ le.createElement("svg", Object.assign({
|
|
316
316
|
xmlns: "http://www.w3.org/2000/svg",
|
|
317
317
|
viewBox: "0 0 24 24",
|
|
318
318
|
fill: "currentColor",
|
|
@@ -320,13 +320,13 @@ function Ar({
|
|
|
320
320
|
"data-slot": "icon",
|
|
321
321
|
ref: n,
|
|
322
322
|
"aria-labelledby": t
|
|
323
|
-
}, s), e ? /* @__PURE__ */
|
|
323
|
+
}, s), e ? /* @__PURE__ */ le.createElement("title", {
|
|
324
324
|
id: t
|
|
325
|
-
}, e) : null, /* @__PURE__ */
|
|
325
|
+
}, e) : null, /* @__PURE__ */ le.createElement("path", {
|
|
326
326
|
d: "M19.5 21a3 3 0 0 0 3-3v-4.5a3 3 0 0 0-3-3h-15a3 3 0 0 0-3 3V18a3 3 0 0 0 3 3h15ZM1.5 10.146V6a3 3 0 0 1 3-3h5.379a2.25 2.25 0 0 1 1.59.659l2.122 2.121c.14.141.331.22.53.22H19.5a3 3 0 0 1 3 3v1.146A4.483 4.483 0 0 0 19.5 9h-15a4.483 4.483 0 0 0-3 1.146Z"
|
|
327
327
|
}));
|
|
328
328
|
}
|
|
329
|
-
const Mr = /* @__PURE__ */
|
|
329
|
+
const Mr = /* @__PURE__ */ le.forwardRef(Ar), Ge = 18, Ve = 12, Zt = 8, 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
332
|
entry: "directory-tree-entry flex items-center cursor-pointer relative select-none text-xs leading-tight py-0.5",
|
|
@@ -345,7 +345,7 @@ const Mr = /* @__PURE__ */ oe.forwardRef(Ar), Ge = 18, Ve = 12, Zt = 8, D = {
|
|
|
345
345
|
name: A("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1 text-xs font-normal", "text-gray-700", "dark:text-gray-200"),
|
|
346
346
|
nameDirectory: "directory-tree-name--directory font-medium",
|
|
347
347
|
nameSelected: A("directory-tree-name--selected text-blue-800 font-semibold", "dark:text-blue-300")
|
|
348
|
-
},
|
|
348
|
+
}, Ee = (e) => {
|
|
349
349
|
if (!e) return "";
|
|
350
350
|
const t = e.split("?")[0].split("#")[0].split("/").pop() || e, s = t.lastIndexOf(".");
|
|
351
351
|
return s <= 0 ? "" : t.slice(s + 1).toLowerCase();
|
|
@@ -369,7 +369,7 @@ const Mr = /* @__PURE__ */ oe.forwardRef(Ar), Ge = 18, Ve = 12, Zt = 8, D = {
|
|
|
369
369
|
}
|
|
370
370
|
return e;
|
|
371
371
|
}, Dr = (e, t, s) => {
|
|
372
|
-
const n = (t || (s ?
|
|
372
|
+
const n = (t || (s ? Ee(s) : "")).toLowerCase(), r = (e || "").toLowerCase();
|
|
373
373
|
if (r && r !== "application/octet-stream") {
|
|
374
374
|
if (r === "text/markdown" || r === "text/x-markdown")
|
|
375
375
|
return /* @__PURE__ */ i.jsx(Dt, { className: "h-4 w-4 text-sky-500 dark:text-sky-400" });
|
|
@@ -480,13 +480,13 @@ const Mr = /* @__PURE__ */ oe.forwardRef(Ar), Ge = 18, Ve = 12, Zt = 8, D = {
|
|
|
480
480
|
expansion: { toggleDirectory: j, onToggleDirectoryRecursive: I },
|
|
481
481
|
visual: { iconOverrides: E, showExpandIcons: p = !0, showDirectoryIcons: L = !0, showFileIcons: C = !0, useCanvasExpandIcons: O = !1, expandIconSize: Q, indentSize: ee = Ve, highlightStyles: $ }
|
|
482
482
|
}) => {
|
|
483
|
-
const [J, te] =
|
|
483
|
+
const [J, te] = ce(!1), S = e.children !== void 0, Y = S && u(e.absolutePath), B = e.absolutePath === N, G = !S && !!y?.has(e.absolutePath), de = S ? void 0 : Ee(e.name) || Ee(e.relativePath) || Ee(e.absolutePath), ue = nr({ entry: e, isDirectory: S, isExpanded: Y, isItemSelected: G, selectionMode: f, onSelectionChange: k, onEntryClick: w, toggleDirectory: j, onToggleDirectoryRecursive: I }), P = J ? $?.hoverClassName !== void 0 ? $.hoverClassName : D.entryHover : "", a = (() => {
|
|
484
484
|
if (S) {
|
|
485
485
|
if (B) return $?.directorySelectedClassName !== void 0 ? $.directorySelectedClassName : D.entrySelected;
|
|
486
486
|
} else if (B || G)
|
|
487
487
|
return $?.itemSelectedClassName !== void 0 ? $.itemSelectedClassName : A(B && D.entrySelected, G && D.entryItemSelected);
|
|
488
488
|
return "";
|
|
489
|
-
})(), m = typeof g == "function" ? g(e) : g, T = A("dt-grid-row cursor-pointer select-none", P, a, m, e.className), M = A(D.expandIcon, (B || G) && D.expandIconSelected), se = A(D.typeIcon, (B || G) && D.typeIconSelected),
|
|
489
|
+
})(), m = typeof g == "function" ? g(e) : g, T = A("dt-grid-row cursor-pointer select-none", P, a, m, e.className), M = A(D.expandIcon, (B || G) && D.expandIconSelected), se = A(D.typeIcon, (B || G) && D.typeIconSelected), ie = A("dt-grid-name-label ml-1", "text-gray-700 dark:text-gray-200", S && D.nameDirectory, (B || G) && D.nameSelected), v = er({ isDirectory: S, isExpanded: Y, showExpandIcons: p, useCanvasExpandIcons: O, expandIconSize: Q }), z = (S ? L : C) ? tr({ entry: e, isDirectory: S, isExpanded: Y, isSelected: B, isItemSelected: G, extension: de, mimeType: e.mimeType }, E) : null, H = { indentLevel: t, isDirectory: S, isExpanded: Y }, [V, ...Se] = R, pe = V?.render ? V.render(e, H) : e.label ?? e.name, be = {
|
|
490
490
|
...J ? $?.hoverStyle : {},
|
|
491
491
|
...S && B ? $?.directorySelectedStyle : {},
|
|
492
492
|
...!S && (B || G) ? $?.itemSelectedStyle : {}
|
|
@@ -495,7 +495,7 @@ const Mr = /* @__PURE__ */ oe.forwardRef(Ar), Ge = 18, Ve = 12, Zt = 8, D = {
|
|
|
495
495
|
"div",
|
|
496
496
|
{
|
|
497
497
|
className: T,
|
|
498
|
-
style: { height: c, ...
|
|
498
|
+
style: { height: c, ...be, ...e.style },
|
|
499
499
|
role: "row",
|
|
500
500
|
"aria-expanded": S ? Y : void 0,
|
|
501
501
|
"aria-level": t + 1,
|
|
@@ -508,18 +508,18 @@ const Mr = /* @__PURE__ */ oe.forwardRef(Ar), Ge = 18, Ve = 12, Zt = 8, D = {
|
|
|
508
508
|
"data-entry-expanded": S ? String(Y) : void 0,
|
|
509
509
|
"data-entry-selected": B ? "true" : void 0,
|
|
510
510
|
"data-entry-item-selected": G ? "true" : void 0,
|
|
511
|
-
onClick:
|
|
511
|
+
onClick: ue,
|
|
512
512
|
onMouseEnter: () => te(!0),
|
|
513
513
|
onMouseLeave: () => te(!1),
|
|
514
|
-
onKeyDown: (ae) => ae.key === "Enter" &&
|
|
514
|
+
onKeyDown: (ae) => ae.key === "Enter" && ue(ae),
|
|
515
515
|
tabIndex: 0,
|
|
516
516
|
children: [
|
|
517
517
|
/* @__PURE__ */ i.jsxs("div", { className: A("dt-grid-name-cell", V?.className), role: "gridcell", style: { width: h, paddingLeft: Math.max(0, t * ee) }, children: [
|
|
518
518
|
(p || O) && /* @__PURE__ */ i.jsx("span", { className: M, children: v }),
|
|
519
519
|
(S ? L : C) && /* @__PURE__ */ i.jsx("span", { className: se, children: z }),
|
|
520
|
-
/* @__PURE__ */ i.jsx("span", { className:
|
|
520
|
+
/* @__PURE__ */ i.jsx("span", { className: ie, children: pe })
|
|
521
521
|
] }),
|
|
522
|
-
|
|
522
|
+
Se.length > 0 && /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-viewport", children: /* @__PURE__ */ i.jsx("div", { className: "dt-grid-numeric-track", style: ar(d, b), children: Se.map((ae) => /* @__PURE__ */ i.jsx("div", { className: A("dt-grid-cell", sr(ae.align), ae.className), role: "gridcell", children: ae.render ? ae.render(e, H) : null }, ae.key)) }) })
|
|
523
523
|
]
|
|
524
524
|
}
|
|
525
525
|
);
|
|
@@ -857,25 +857,25 @@ const Qr = {
|
|
|
857
857
|
entryClassName: Y,
|
|
858
858
|
entryStyle: B,
|
|
859
859
|
nameClassName: G,
|
|
860
|
-
nameStyle:
|
|
861
|
-
directoryNameClassName:
|
|
860
|
+
nameStyle: de,
|
|
861
|
+
directoryNameClassName: ue,
|
|
862
862
|
directoryNameStyle: P,
|
|
863
863
|
fileNameClassName: a,
|
|
864
864
|
fileNameStyle: m
|
|
865
865
|
}
|
|
866
866
|
}) => {
|
|
867
|
-
const [T, M] =
|
|
867
|
+
const [T, M] = ce(null), [se, ie] = ce(!1), v = e.children !== void 0, z = v && h(e.absolutePath), H = e.absolutePath === k, V = !v && I?.has(e.absolutePath), Se = v ? void 0 : Ee(e.name) || Ee(e.relativePath) || Ee(e.absolutePath);
|
|
868
868
|
he(() => {
|
|
869
869
|
M(z && e.children ? e.children : null);
|
|
870
870
|
}, [z, e.children]);
|
|
871
|
-
const pe = nr({ entry: e, isDirectory: v, isExpanded: z, isItemSelected: !!V, selectionMode: j, onSelectionChange: E, onEntryClick: y, toggleDirectory: N, onToggleDirectoryRecursive: f }),
|
|
871
|
+
const pe = nr({ entry: e, isDirectory: v, isExpanded: z, isItemSelected: !!V, selectionMode: j, onSelectionChange: E, onEntryClick: y, toggleDirectory: N, onToggleDirectoryRecursive: f }), be = se ? S?.hoverClassName !== void 0 ? S.hoverClassName : D.entryHover : "", ae = (() => {
|
|
872
872
|
if (v) {
|
|
873
873
|
if (H)
|
|
874
874
|
return S?.directorySelectedClassName !== void 0 ? S.directorySelectedClassName : D.entrySelected;
|
|
875
875
|
} else if (H || V)
|
|
876
876
|
return S?.itemSelectedClassName !== void 0 ? S.itemSelectedClassName : A(H && D.entrySelected, V && D.entryItemSelected);
|
|
877
877
|
return "";
|
|
878
|
-
})(), Ue = A(D.entry,
|
|
878
|
+
})(), Ue = A(D.entry, be, ae, Y, e.className), Ne = A(D.expandIcon, (H || V) && D.expandIconSelected), Ae = A(D.typeIcon, (H || V) && D.typeIconSelected), Me = A(D.name, G, v && D.nameDirectory, v && ue, !v && a, (H || V) && D.nameSelected), De = er({ isDirectory: v, isExpanded: z, showExpandIcons: L, useCanvasExpandIcons: Q, expandIconSize: ee }), Oe = (v ? C : O) ? tr({ entry: e, isDirectory: v, isExpanded: z, isSelected: H, isItemSelected: !!V, extension: Se, mimeType: e.mimeType }, p) : null, Fe = {
|
|
879
879
|
...se ? S?.hoverStyle : {},
|
|
880
880
|
...v && H ? S?.directorySelectedStyle : {},
|
|
881
881
|
...!v && (H || V) ? S?.itemSelectedStyle : {}
|
|
@@ -901,8 +901,8 @@ const Qr = {
|
|
|
901
901
|
"data-entry-selected": H ? "true" : void 0,
|
|
902
902
|
"data-entry-item-selected": V ? "true" : void 0,
|
|
903
903
|
onClick: pe,
|
|
904
|
-
onMouseEnter: () =>
|
|
905
|
-
onMouseLeave: () =>
|
|
904
|
+
onMouseEnter: () => ie(!0),
|
|
905
|
+
onMouseLeave: () => ie(!1),
|
|
906
906
|
ref: (re) => R(c, re),
|
|
907
907
|
onKeyDown: (re) => {
|
|
908
908
|
if (re.key === "Enter" || re.key === " ") {
|
|
@@ -920,7 +920,7 @@ const Qr = {
|
|
|
920
920
|
"aria-selected": j === "none" ? void 0 : l,
|
|
921
921
|
"aria-label": `${e.name} (${v ? "directory" : "file"})`,
|
|
922
922
|
children: [
|
|
923
|
-
(L || Q) && /* @__PURE__ */ i.jsx("span", { className:
|
|
923
|
+
(L || Q) && /* @__PURE__ */ i.jsx("span", { className: Ne, children: De }),
|
|
924
924
|
(v ? C : O) && /* @__PURE__ */ i.jsx("span", { className: Ae, style: Le, children: Oe }),
|
|
925
925
|
/* @__PURE__ */ i.jsx(
|
|
926
926
|
"span",
|
|
@@ -928,7 +928,7 @@ const Qr = {
|
|
|
928
928
|
className: Me,
|
|
929
929
|
style: {
|
|
930
930
|
...Te,
|
|
931
|
-
...
|
|
931
|
+
...de,
|
|
932
932
|
...v ? P : m
|
|
933
933
|
},
|
|
934
934
|
"data-entry-type": v ? "directory" : "file",
|
|
@@ -968,8 +968,8 @@ const Qr = {
|
|
|
968
968
|
entryClassName: Y,
|
|
969
969
|
entryStyle: B,
|
|
970
970
|
nameClassName: G,
|
|
971
|
-
nameStyle:
|
|
972
|
-
directoryNameClassName:
|
|
971
|
+
nameStyle: de,
|
|
972
|
+
directoryNameClassName: ue,
|
|
973
973
|
directoryNameStyle: P,
|
|
974
974
|
fileNameClassName: a,
|
|
975
975
|
fileNameStyle: m
|
|
@@ -1019,14 +1019,14 @@ const ur = (e) => {
|
|
|
1019
1019
|
directoryNameClassName: Y,
|
|
1020
1020
|
directoryNameStyle: B,
|
|
1021
1021
|
fileNameClassName: G,
|
|
1022
|
-
fileNameStyle:
|
|
1022
|
+
fileNameStyle: de
|
|
1023
1023
|
} = {},
|
|
1024
|
-
virtualScroll:
|
|
1024
|
+
virtualScroll: ue,
|
|
1025
1025
|
grid: P,
|
|
1026
1026
|
sort: a
|
|
1027
1027
|
}) => {
|
|
1028
|
-
const m = P !== void 0, [T, M] =
|
|
1029
|
-
overscanCount:
|
|
1028
|
+
const m = P !== void 0, [T, M] = ce(!1), se = ne(null), ie = ne(null), v = ne(null), [z, H] = ce(0), [V, Se] = ce(0), [pe, be] = ce(0), [ae, Ue] = ce(null), {
|
|
1029
|
+
overscanCount: Ne = 15,
|
|
1030
1030
|
className: Ae,
|
|
1031
1031
|
background: Me,
|
|
1032
1032
|
onScroll: De,
|
|
@@ -1037,7 +1037,7 @@ const ur = (e) => {
|
|
|
1037
1037
|
callbackThrottleMs: Te = 5,
|
|
1038
1038
|
contentInsets: re,
|
|
1039
1039
|
onItemFocus: Ce,
|
|
1040
|
-
viewportHeightOverride:
|
|
1040
|
+
viewportHeightOverride: oe,
|
|
1041
1041
|
scrollBarOptions: Xe,
|
|
1042
1042
|
behaviorOptions: it,
|
|
1043
1043
|
preserveScrollAnchor: ct = !1,
|
|
@@ -1046,7 +1046,7 @@ const ur = (e) => {
|
|
|
1046
1046
|
// (`role="tree"` は本コンポーネント自身のコンテナに付くため contentProps とは別要素で衝突しない)
|
|
1047
1047
|
testId: dt,
|
|
1048
1048
|
contentProps: Je
|
|
1049
|
-
} =
|
|
1049
|
+
} = ue ?? {}, ut = K(() => m ? { role: "rowgroup", ...Je } : Je, [m, Je]), [$e, ft] = ce(typeof ye == "number" ? ye : 0), Ze = ne(typeof ye == "number" ? ye : 0), mt = F(
|
|
1050
1050
|
(o, x) => {
|
|
1051
1051
|
Ze.current = o, ft(o), De?.(o, x);
|
|
1052
1052
|
},
|
|
@@ -1061,13 +1061,13 @@ const ur = (e) => {
|
|
|
1061
1061
|
he(() => {
|
|
1062
1062
|
M(!0), en();
|
|
1063
1063
|
}, []), he(() => {
|
|
1064
|
-
const o = se.current, x = m ?
|
|
1064
|
+
const o = se.current, x = m ? ie.current : o, _ = () => {
|
|
1065
1065
|
if (o) {
|
|
1066
1066
|
const U = o.clientWidth;
|
|
1067
|
-
|
|
1067
|
+
Se((Z) => Math.abs(Z - U) > 1 ? U : Z);
|
|
1068
1068
|
}
|
|
1069
|
-
if (typeof
|
|
1070
|
-
H((U) => Math.abs(U -
|
|
1069
|
+
if (typeof oe == "number")
|
|
1070
|
+
H((U) => Math.abs(U - oe) > 1 ? oe : U);
|
|
1071
1071
|
else if (x) {
|
|
1072
1072
|
const U = x.clientHeight;
|
|
1073
1073
|
H((Z) => Math.abs(Z - U) > 1 ? U : Z);
|
|
@@ -1077,14 +1077,14 @@ const ur = (e) => {
|
|
|
1077
1077
|
_();
|
|
1078
1078
|
const W = new ResizeObserver(_);
|
|
1079
1079
|
return o && W.observe(o), x && x !== o && W.observe(x), () => W.disconnect();
|
|
1080
|
-
}, [
|
|
1081
|
-
const
|
|
1080
|
+
}, [oe, m]);
|
|
1081
|
+
const Ie = typeof oe == "number" ? oe : z, fe = F((o) => c || (T ? s(o) : !1), [T, s, c]), pt = A(D.container, l && D.containerPending, w), yt = K(
|
|
1082
1082
|
() => ({
|
|
1083
1083
|
...Qr,
|
|
1084
1084
|
...N ?? {},
|
|
1085
|
-
...typeof
|
|
1085
|
+
...typeof oe == "number" ? { height: oe, minHeight: oe } : {}
|
|
1086
1086
|
}),
|
|
1087
|
-
[N,
|
|
1087
|
+
[N, oe]
|
|
1088
1088
|
), qe = F(
|
|
1089
1089
|
(o, x) => {
|
|
1090
1090
|
const _ = [o.absolutePath, ...ur(o)], W = x || u;
|
|
@@ -1094,27 +1094,27 @@ const ur = (e) => {
|
|
|
1094
1094
|
console.warn(`[DirectoryTree] Unknown double click action: ${W}. No action taken.`);
|
|
1095
1095
|
},
|
|
1096
1096
|
[fe, n, r, u]
|
|
1097
|
-
), xt = m ? !1 : Q, { flatItems:
|
|
1098
|
-
() =>
|
|
1097
|
+
), xt = m ? !1 : Q, { flatItems: ge, lineItems: Ke, maxIndent: vt } = K(() => tn(e, fe, j, xt, a), [e, fe, j, xt, a]), X = K(
|
|
1098
|
+
() => ge.map((o, x) => {
|
|
1099
1099
|
const _ = typeof O == "function" ? O(o.entry, x) : O;
|
|
1100
1100
|
return { ...o, rowHeight: Number.isFinite(_) && _ > 0 ? _ : Ge };
|
|
1101
1101
|
}),
|
|
1102
|
-
[
|
|
1103
|
-
),
|
|
1104
|
-
const o = new Array(
|
|
1102
|
+
[ge, O]
|
|
1103
|
+
), xe = K(() => X.map((o) => o.rowHeight), [X]), we = K(() => {
|
|
1104
|
+
const o = new Array(xe.length + 1);
|
|
1105
1105
|
o[0] = 0;
|
|
1106
|
-
for (let x = 0; x <
|
|
1107
|
-
o[x + 1] = o[x] +
|
|
1106
|
+
for (let x = 0; x < xe.length; x++)
|
|
1107
|
+
o[x + 1] = o[x] + xe[x];
|
|
1108
1108
|
return o;
|
|
1109
|
-
}, [
|
|
1110
|
-
wt.current =
|
|
1109
|
+
}, [xe]), bt = F((o) => X[o]?.rowHeight ?? Ge, [X]), mr = F((o) => X[o]?.entry.absolutePath ?? o, [X]), gt = fr ?? mr, wt = ne(ge);
|
|
1110
|
+
wt.current = ge;
|
|
1111
1111
|
const kt = ne(fe);
|
|
1112
1112
|
kt.current = fe;
|
|
1113
1113
|
const Qe = ne(t);
|
|
1114
1114
|
Qe.current = t;
|
|
1115
|
-
const [Et, St] =
|
|
1115
|
+
const [Et, St] = ce(0), et = ne(/* @__PURE__ */ new Map()), tt = ne(null), Nt = F((o, x) => {
|
|
1116
1116
|
x ? (et.current.set(o, x), tt.current === o && (tt.current = null, x.focus())) : et.current.delete(o);
|
|
1117
|
-
}, []),
|
|
1117
|
+
}, []), ke = F((o) => {
|
|
1118
1118
|
St(o);
|
|
1119
1119
|
const x = et.current.get(o);
|
|
1120
1120
|
if (x) {
|
|
@@ -1124,8 +1124,8 @@ const ur = (e) => {
|
|
|
1124
1124
|
tt.current = o, v.current?.scrollToIndex(o);
|
|
1125
1125
|
}, []);
|
|
1126
1126
|
he(() => {
|
|
1127
|
-
St((o) =>
|
|
1128
|
-
}, [
|
|
1127
|
+
St((o) => ge.length === 0 ? 0 : Math.min(o, ge.length - 1));
|
|
1128
|
+
}, [ge.length]);
|
|
1129
1129
|
const It = F(
|
|
1130
1130
|
(o, x) => {
|
|
1131
1131
|
const _ = wt.current, W = _.length - 1;
|
|
@@ -1133,19 +1133,19 @@ const ur = (e) => {
|
|
|
1133
1133
|
const U = _[x], Z = U?.entry.children !== void 0, me = Z && kt.current(U.entry.absolutePath);
|
|
1134
1134
|
switch (o.key) {
|
|
1135
1135
|
case "ArrowDown":
|
|
1136
|
-
o.preventDefault(),
|
|
1136
|
+
o.preventDefault(), ke(Math.min(x + 1, W));
|
|
1137
1137
|
break;
|
|
1138
1138
|
case "ArrowUp":
|
|
1139
|
-
o.preventDefault(),
|
|
1139
|
+
o.preventDefault(), ke(Math.max(x - 1, 0));
|
|
1140
1140
|
break;
|
|
1141
1141
|
case "Home":
|
|
1142
|
-
o.preventDefault(),
|
|
1142
|
+
o.preventDefault(), ke(0);
|
|
1143
1143
|
break;
|
|
1144
1144
|
case "End":
|
|
1145
|
-
o.preventDefault(),
|
|
1145
|
+
o.preventDefault(), ke(W);
|
|
1146
1146
|
break;
|
|
1147
1147
|
case "ArrowRight":
|
|
1148
|
-
o.preventDefault(), Z && !me ? Qe.current(U.entry.absolutePath) : Z && x < W &&
|
|
1148
|
+
o.preventDefault(), Z && !me ? Qe.current(U.entry.absolutePath) : Z && x < W && ke(x + 1);
|
|
1149
1149
|
break;
|
|
1150
1150
|
case "ArrowLeft": {
|
|
1151
1151
|
if (o.preventDefault(), Z && me) {
|
|
@@ -1155,28 +1155,28 @@ const ur = (e) => {
|
|
|
1155
1155
|
const vr = U?.depth ?? 0;
|
|
1156
1156
|
for (let ze = x - 1; ze >= 0; ze--)
|
|
1157
1157
|
if (_[ze].depth < vr) {
|
|
1158
|
-
|
|
1158
|
+
ke(ze);
|
|
1159
1159
|
break;
|
|
1160
1160
|
}
|
|
1161
1161
|
break;
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
1164
|
},
|
|
1165
|
-
[
|
|
1165
|
+
[ke]
|
|
1166
1166
|
), He = K(
|
|
1167
|
-
() => !j || Ke.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : nn(Ke,
|
|
1168
|
-
[Ke,
|
|
1167
|
+
() => !j || Ke.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : nn(Ke, xe, we, Ve, j, C ?? Zt),
|
|
1168
|
+
[Ke, xe, we, j, C]
|
|
1169
1169
|
), We = K(() => !j || e.length === 0 ? 0 : (vt + 2) * Ve, [e.length, vt, j]), { renderStart: Rt, renderEnd: jt, lookaheadEnd: Tt } = K(
|
|
1170
|
-
() => rn(X.length,
|
|
1171
|
-
[X.length,
|
|
1172
|
-
), rt = K(() => !j || We <= 0 ||
|
|
1170
|
+
() => rn(X.length, Ie, Ne, ae, $e, we),
|
|
1171
|
+
[X.length, Ie, Ne, ae, $e, we]
|
|
1172
|
+
), rt = K(() => !j || We <= 0 || Ie <= 0 || He.segmentsByItem.length === 0 ? null : /* @__PURE__ */ i.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ i.jsx("div", { className: "absolute top-0 left-0", style: { width: We, height: Ie }, children: /* @__PURE__ */ i.jsx(
|
|
1173
1173
|
dr,
|
|
1174
1174
|
{
|
|
1175
1175
|
segmentsByItem: He.segmentsByItem,
|
|
1176
1176
|
glyphsByItem: He.glyphsByItem,
|
|
1177
|
-
itemHeight:
|
|
1177
|
+
itemHeight: xe[0] ?? Ge,
|
|
1178
1178
|
width: We,
|
|
1179
|
-
viewportHeight:
|
|
1179
|
+
viewportHeight: Ie,
|
|
1180
1180
|
scrollPosition: $e,
|
|
1181
1181
|
color: k,
|
|
1182
1182
|
expandGlyphColor: k,
|
|
@@ -1185,25 +1185,25 @@ const ur = (e) => {
|
|
|
1185
1185
|
renderEndIndex: jt,
|
|
1186
1186
|
lookaheadEndIndex: Tt
|
|
1187
1187
|
}
|
|
1188
|
-
) }) }), [We,
|
|
1188
|
+
) }) }), [We, Ie, Rt, jt, Tt, $e, He, k, j, C, xe]), Ct = F((o) => X[o], [X]), Pt = ne(null);
|
|
1189
1189
|
gr(() => {
|
|
1190
1190
|
const o = Pt.current;
|
|
1191
|
-
if (Pt.current = { items: X, offsets:
|
|
1191
|
+
if (Pt.current = { items: X, offsets: we }, !ct || !o || o.items === X)
|
|
1192
1192
|
return;
|
|
1193
1193
|
const x = v.current, _ = x?.getScrollPosition(), W = typeof _ == "number" && _ >= 0 ? _ : Ze.current, U = Gr(o.items, o.offsets, W);
|
|
1194
1194
|
if (!U)
|
|
1195
1195
|
return;
|
|
1196
|
-
const Z = Vr(U, X,
|
|
1196
|
+
const Z = Vr(U, X, we);
|
|
1197
1197
|
if (Z === null || Math.abs(Z - W) < 1)
|
|
1198
1198
|
return;
|
|
1199
1199
|
const me = x ? x.scrollTo(Z) : Z;
|
|
1200
1200
|
Ze.current = me, ft(me);
|
|
1201
|
-
}, [X,
|
|
1202
|
-
const
|
|
1201
|
+
}, [X, we, ct]);
|
|
1202
|
+
const ve = P?.columns, Re = P?.scrollBarWidth ?? Xe?.width ?? cr, q = K(() => ve ? Br({ measuredWidth: V, columns: ve, scrollBarWidth: Re }) : null, [ve, V, Re]), Be = K(() => ve ? Wr(ve) : "", [ve]), hr = K(() => P?.showFooter && ve ? zr(e) : [], [P?.showFooter, ve, e]), je = q?.maxHScroll ?? 0;
|
|
1203
1203
|
he(() => {
|
|
1204
|
-
|
|
1204
|
+
be((o) => nt(o, je));
|
|
1205
1205
|
}, [je]);
|
|
1206
|
-
const _t = F((o) =>
|
|
1206
|
+
const _t = F((o) => be((x) => nt(x + o, je)), [je]), At = K(
|
|
1207
1207
|
() => ({ iconOverrides: L, showExpandIcons: I, showDirectoryIcons: E, showFileIcons: p, useCanvasExpandIcons: j, expandIconSize: C, highlightStyles: ee }),
|
|
1208
1208
|
[L, I, E, p, j, C, ee]
|
|
1209
1209
|
), Mt = K(
|
|
@@ -1217,8 +1217,8 @@ const ur = (e) => {
|
|
|
1217
1217
|
getItemKey: gt,
|
|
1218
1218
|
testId: dt,
|
|
1219
1219
|
contentProps: ut,
|
|
1220
|
-
viewportSize:
|
|
1221
|
-
overscanCount:
|
|
1220
|
+
viewportSize: typeof oe == "number" ? oe : void 0,
|
|
1221
|
+
overscanCount: Ne,
|
|
1222
1222
|
onScroll: mt,
|
|
1223
1223
|
onRangeChange: ht,
|
|
1224
1224
|
className: Ae,
|
|
@@ -1293,7 +1293,7 @@ const ur = (e) => {
|
|
|
1293
1293
|
directoryNameClassName: Y,
|
|
1294
1294
|
directoryNameStyle: B,
|
|
1295
1295
|
fileNameClassName: G,
|
|
1296
|
-
fileNameStyle:
|
|
1296
|
+
fileNameStyle: de
|
|
1297
1297
|
}
|
|
1298
1298
|
},
|
|
1299
1299
|
o.entry.absolutePath
|
|
@@ -1310,8 +1310,8 @@ const ur = (e) => {
|
|
|
1310
1310
|
Et,
|
|
1311
1311
|
Nt,
|
|
1312
1312
|
It,
|
|
1313
|
-
|
|
1314
|
-
|
|
1313
|
+
oe,
|
|
1314
|
+
Ne,
|
|
1315
1315
|
mt,
|
|
1316
1316
|
ht,
|
|
1317
1317
|
Ae,
|
|
@@ -1353,7 +1353,7 @@ const ur = (e) => {
|
|
|
1353
1353
|
Y,
|
|
1354
1354
|
B,
|
|
1355
1355
|
G,
|
|
1356
|
-
|
|
1356
|
+
de
|
|
1357
1357
|
]
|
|
1358
1358
|
);
|
|
1359
1359
|
if (!(P && q))
|
|
@@ -1373,7 +1373,7 @@ const ur = (e) => {
|
|
|
1373
1373
|
children: [
|
|
1374
1374
|
pr && // biome-ignore lint/a11y/useSemanticElements: 仮想スクロールの treegrid は絶対配置行を使うため native table 要素にできない。ARIA ロールで意味を提供する
|
|
1375
1375
|
/* @__PURE__ */ i.jsx("div", { role: "rowgroup", children: /* @__PURE__ */ i.jsx(Lr, { columns: P.columns, numericTemplate: Be, numericTotal: q.numericTotal, nameWidth: q.nameWidth, scrollBarWidth: Re, className: P.headerClassName }) }),
|
|
1376
|
-
/* @__PURE__ */ i.jsx("div", { ref:
|
|
1376
|
+
/* @__PURE__ */ i.jsx("div", { ref: ie, className: "dt-grid-body", children: Mt }),
|
|
1377
1377
|
je > 0 && /* @__PURE__ */ i.jsxs("div", { className: "dt-grid-hscrollbar-row", children: [
|
|
1378
1378
|
/* @__PURE__ */ i.jsx("div", { className: "dt-grid-scrollbar-spacer", style: { width: q.nameWidth }, "aria-hidden": "true" }),
|
|
1379
1379
|
/* @__PURE__ */ i.jsx(
|
|
@@ -1386,7 +1386,7 @@ const ur = (e) => {
|
|
|
1386
1386
|
scrollBarWidth: Re,
|
|
1387
1387
|
onScroll: (o) => {
|
|
1388
1388
|
const x = typeof o == "function" ? o(pe) : o, _ = nt(x, je);
|
|
1389
|
-
return
|
|
1389
|
+
return be(_), _;
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
1392
|
),
|
|
@@ -1398,7 +1398,7 @@ const ur = (e) => {
|
|
|
1398
1398
|
}
|
|
1399
1399
|
);
|
|
1400
1400
|
}, dn = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: t } = {}) => {
|
|
1401
|
-
const [s, n] = kr(), [r, l] =
|
|
1401
|
+
const [s, n] = kr(), [r, l] = ce(() => {
|
|
1402
1402
|
if (typeof window < "u" && t)
|
|
1403
1403
|
try {
|
|
1404
1404
|
const f = window.localStorage.getItem(t);
|