@aiquants/directory-tree 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +110 -14
- package/dist/directory-tree.css +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +174 -173
- package/dist/src/DirectoryTree.d.ts.map +1 -1
- package/dist/src/cli.server.d.ts +2 -0
- package/dist/src/cli.server.d.ts.map +1 -0
- package/dist/src/logger.d.ts +97 -5
- package/dist/src/logger.d.ts.map +1 -1
- package/dist/styles/directory-tree.css +1 -1
- package/package.json +29 -29
- package/dist/src/cli.d.ts +0 -3
- package/dist/src/cli.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Fe, { memo as je, useRef as
|
|
1
|
+
import Fe, { memo as je, useRef as se, useCallback as j, useEffect as q, useState as ee, useMemo as ae, Fragment as Ye, useTransition as Be } from "react";
|
|
2
2
|
import { VirtualScroll as He } from "@aiquants/virtualscroll";
|
|
3
3
|
import { FolderIcon as We, DocumentTextIcon as Xe, ChevronDownIcon as Ve, ChevronRightIcon as Je } from "@heroicons/react/24/solid";
|
|
4
4
|
import { FileIcon as Ge } from "@phosphor-icons/react";
|
|
5
|
-
import { twMerge as
|
|
6
|
-
var
|
|
5
|
+
import { twMerge as $ } from "tailwind-merge";
|
|
6
|
+
var ye = { exports: {} }, ce = {};
|
|
7
7
|
var _e;
|
|
8
8
|
function ze() {
|
|
9
|
-
if (_e) return
|
|
9
|
+
if (_e) return ce;
|
|
10
10
|
_e = 1;
|
|
11
11
|
var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
|
|
12
12
|
function o(l, n, a) {
|
|
@@ -24,16 +24,16 @@ function ze() {
|
|
|
24
24
|
props: a
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return ce.Fragment = r, ce.jsx = o, ce.jsxs = o, ce;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var ue = {};
|
|
30
30
|
var Pe;
|
|
31
31
|
function Ue() {
|
|
32
32
|
return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
33
33
|
function e(t) {
|
|
34
34
|
if (t == null) return null;
|
|
35
35
|
if (typeof t == "function")
|
|
36
|
-
return t.$$typeof ===
|
|
36
|
+
return t.$$typeof === V ? null : t.displayName || t.name || null;
|
|
37
37
|
if (typeof t == "string") return t;
|
|
38
38
|
switch (t) {
|
|
39
39
|
case s:
|
|
@@ -64,7 +64,7 @@ function Ue() {
|
|
|
64
64
|
return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
65
65
|
case N:
|
|
66
66
|
return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
|
|
67
|
-
case
|
|
67
|
+
case O:
|
|
68
68
|
f = t._payload, t = t._init;
|
|
69
69
|
try {
|
|
70
70
|
return e(t(f));
|
|
@@ -95,7 +95,7 @@ function Ue() {
|
|
|
95
95
|
}
|
|
96
96
|
function l(t) {
|
|
97
97
|
if (t === s) return "<>";
|
|
98
|
-
if (typeof t == "object" && t !== null && t.$$typeof ===
|
|
98
|
+
if (typeof t == "object" && t !== null && t.$$typeof === O)
|
|
99
99
|
return "<...>";
|
|
100
100
|
try {
|
|
101
101
|
var f = e(t);
|
|
@@ -105,7 +105,7 @@ function Ue() {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
function n() {
|
|
108
|
-
var t =
|
|
108
|
+
var t = H.A;
|
|
109
109
|
return t === null ? null : t.getOwner();
|
|
110
110
|
}
|
|
111
111
|
function a() {
|
|
@@ -120,7 +120,7 @@ function Ue() {
|
|
|
120
120
|
}
|
|
121
121
|
function m(t, f) {
|
|
122
122
|
function I() {
|
|
123
|
-
|
|
123
|
+
J || (J = !0, console.error(
|
|
124
124
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
125
125
|
f
|
|
126
126
|
));
|
|
@@ -132,14 +132,14 @@ function Ue() {
|
|
|
132
132
|
}
|
|
133
133
|
function v() {
|
|
134
134
|
var t = e(this.type);
|
|
135
|
-
return
|
|
135
|
+
return te[t] || (te[t] = !0, console.error(
|
|
136
136
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
137
137
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
138
138
|
}
|
|
139
|
-
function y(t, f, I, P,
|
|
139
|
+
function y(t, f, I, P, ne, A) {
|
|
140
140
|
var T = I.ref;
|
|
141
141
|
return t = {
|
|
142
|
-
$$typeof:
|
|
142
|
+
$$typeof: k,
|
|
143
143
|
type: t,
|
|
144
144
|
key: f,
|
|
145
145
|
props: I,
|
|
@@ -161,19 +161,19 @@ function Ue() {
|
|
|
161
161
|
configurable: !1,
|
|
162
162
|
enumerable: !1,
|
|
163
163
|
writable: !0,
|
|
164
|
-
value:
|
|
164
|
+
value: ne
|
|
165
165
|
}), Object.defineProperty(t, "_debugTask", {
|
|
166
166
|
configurable: !1,
|
|
167
167
|
enumerable: !1,
|
|
168
168
|
writable: !0,
|
|
169
|
-
value:
|
|
169
|
+
value: A
|
|
170
170
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
171
171
|
}
|
|
172
|
-
function c(t, f, I, P,
|
|
172
|
+
function c(t, f, I, P, ne, A) {
|
|
173
173
|
var T = f.children;
|
|
174
174
|
if (T !== void 0)
|
|
175
175
|
if (P)
|
|
176
|
-
if (
|
|
176
|
+
if (W(T)) {
|
|
177
177
|
for (P = 0; P < T.length; P++)
|
|
178
178
|
b(T[P]);
|
|
179
179
|
Object.freeze && Object.freeze(T);
|
|
@@ -184,10 +184,10 @@ function Ue() {
|
|
|
184
184
|
else b(T);
|
|
185
185
|
if (Y.call(f, "key")) {
|
|
186
186
|
T = e(t);
|
|
187
|
-
var
|
|
188
|
-
return
|
|
187
|
+
var G = Object.keys(f).filter(function(fe) {
|
|
188
|
+
return fe !== "key";
|
|
189
189
|
});
|
|
190
|
-
P = 0 <
|
|
190
|
+
P = 0 < G.length ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}", Z[T + P] || (G = 0 < G.length ? "{" + G.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
191
191
|
`A props object containing a "key" prop is being spread into JSX:
|
|
192
192
|
let props = %s;
|
|
193
193
|
<%s {...props} />
|
|
@@ -196,14 +196,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
196
196
|
<%s key={someKey} {...props} />`,
|
|
197
197
|
P,
|
|
198
198
|
T,
|
|
199
|
-
|
|
199
|
+
G,
|
|
200
200
|
T
|
|
201
|
-
),
|
|
201
|
+
), Z[T + P] = !0);
|
|
202
202
|
}
|
|
203
203
|
if (T = null, I !== void 0 && (o(I), T = "" + I), i(f) && (o(f.key), T = "" + f.key), "key" in f) {
|
|
204
204
|
I = {};
|
|
205
|
-
for (var
|
|
206
|
-
|
|
205
|
+
for (var z in f)
|
|
206
|
+
z !== "key" && (I[z] = f[z]);
|
|
207
207
|
} else I = f;
|
|
208
208
|
return T && m(
|
|
209
209
|
I,
|
|
@@ -213,17 +213,17 @@ React keys must be passed directly to JSX without using spread:
|
|
|
213
213
|
T,
|
|
214
214
|
I,
|
|
215
215
|
n(),
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
ne,
|
|
217
|
+
A
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
function b(t) {
|
|
221
|
-
p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof ===
|
|
221
|
+
p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === O && (t._payload.status === "fulfilled" ? p(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
|
|
222
222
|
}
|
|
223
223
|
function p(t) {
|
|
224
|
-
return typeof t == "object" && t !== null && t.$$typeof ===
|
|
224
|
+
return typeof t == "object" && t !== null && t.$$typeof === k;
|
|
225
225
|
}
|
|
226
|
-
var g = Fe,
|
|
226
|
+
var g = Fe, k = Symbol.for("react.transitional.element"), u = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), h = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), x = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), F = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), N = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), V = Symbol.for("react.client.reference"), H = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, W = Array.isArray, X = console.createTask ? console.createTask : function() {
|
|
227
227
|
return null;
|
|
228
228
|
};
|
|
229
229
|
g = {
|
|
@@ -231,36 +231,36 @@ React keys must be passed directly to JSX without using spread:
|
|
|
231
231
|
return t();
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
var
|
|
234
|
+
var J, te = {}, re = g.react_stack_bottom_frame.bind(
|
|
235
235
|
g,
|
|
236
236
|
a
|
|
237
|
-
)(),
|
|
238
|
-
|
|
239
|
-
var P = 1e4 >
|
|
237
|
+
)(), D = X(l(a)), Z = {};
|
|
238
|
+
ue.Fragment = s, ue.jsx = function(t, f, I) {
|
|
239
|
+
var P = 1e4 > H.recentlyCreatedOwnerStacks++;
|
|
240
240
|
return c(
|
|
241
241
|
t,
|
|
242
242
|
f,
|
|
243
243
|
I,
|
|
244
244
|
!1,
|
|
245
|
-
P ? Error("react-stack-top-frame") :
|
|
246
|
-
P ? X(l(t)) :
|
|
245
|
+
P ? Error("react-stack-top-frame") : re,
|
|
246
|
+
P ? X(l(t)) : D
|
|
247
247
|
);
|
|
248
|
-
},
|
|
249
|
-
var P = 1e4 >
|
|
248
|
+
}, ue.jsxs = function(t, f, I) {
|
|
249
|
+
var P = 1e4 > H.recentlyCreatedOwnerStacks++;
|
|
250
250
|
return c(
|
|
251
251
|
t,
|
|
252
252
|
f,
|
|
253
253
|
I,
|
|
254
254
|
!0,
|
|
255
|
-
P ? Error("react-stack-top-frame") :
|
|
256
|
-
P ? X(l(t)) :
|
|
255
|
+
P ? Error("react-stack-top-frame") : re,
|
|
256
|
+
P ? X(l(t)) : D
|
|
257
257
|
);
|
|
258
258
|
};
|
|
259
|
-
})()),
|
|
259
|
+
})()), ue;
|
|
260
260
|
}
|
|
261
261
|
var Te;
|
|
262
262
|
function qe() {
|
|
263
|
-
return Te || (Te = 1, process.env.NODE_ENV === "production" ?
|
|
263
|
+
return Te || (Te = 1, process.env.NODE_ENV === "production" ? ye.exports = ze() : ye.exports = Ue()), ye.exports;
|
|
264
264
|
}
|
|
265
265
|
var S = qe();
|
|
266
266
|
const Ze = (e, r, o) => {
|
|
@@ -305,12 +305,12 @@ const Ze = (e, r, o) => {
|
|
|
305
305
|
const n = tt(o, 0.14), a = e.strokeStyle, i = e.fillStyle, m = e.lineWidth, v = e.lineCap, y = e.lineJoin;
|
|
306
306
|
e.strokeStyle = o, e.lineCap = "round", e.lineJoin = "round";
|
|
307
307
|
for (const c of r) {
|
|
308
|
-
const b = l ?? c.size, p = Math.max(0, b / 2), g = Math.max(1, Math.round(b * 0.08)),
|
|
309
|
-
n && (e.fillStyle = n, e.beginPath(), e.arc(c.centerX, c.centerY, u, 0, Math.PI * 2), e.fill()), e.lineWidth = g, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, p - g * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth =
|
|
308
|
+
const b = l ?? c.size, p = Math.max(0, b / 2), g = Math.max(1, Math.round(b * 0.08)), k = Math.max(1, Math.round(b * 0.14)), u = Math.max(0, p - g * 0.8), s = Math.max(0, u * 0.55);
|
|
309
|
+
n && (e.fillStyle = n, e.beginPath(), e.arc(c.centerX, c.centerY, u, 0, Math.PI * 2), e.fill()), e.lineWidth = g, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, p - g * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = k, e.beginPath(), e.moveTo(c.centerX - s, c.centerY), e.lineTo(c.centerX + s, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - s), e.lineTo(c.centerX, c.centerY + s), e.stroke());
|
|
310
310
|
}
|
|
311
311
|
e.strokeStyle = a, e.fillStyle = i, e.lineWidth = m, e.lineCap = v, e.lineJoin = y;
|
|
312
312
|
}, Ce = je(({ segmentsByItem: e, glyphsByItem: r, itemHeight: o, width: l, viewportHeight: n, scrollPosition: a, color: i = "#a0aec0", strokeWidth: m = 1, renderStartIndex: v, renderEndIndex: y, lookaheadEndIndex: c, devicePixelRatio: b, expandGlyphColor: p, expandGlyphSize: g }) => {
|
|
313
|
-
const
|
|
313
|
+
const k = se(null), u = se(null), s = se({
|
|
314
314
|
segmentsByItem: e,
|
|
315
315
|
glyphsByItem: r,
|
|
316
316
|
itemHeight: o,
|
|
@@ -327,7 +327,7 @@ const Ze = (e, r, o) => {
|
|
|
327
327
|
expandGlyphSize: g
|
|
328
328
|
}), h = j(() => {
|
|
329
329
|
u.current = null;
|
|
330
|
-
const _ =
|
|
330
|
+
const _ = k.current;
|
|
331
331
|
if (!_)
|
|
332
332
|
return;
|
|
333
333
|
const x = _.getContext("2d");
|
|
@@ -340,24 +340,24 @@ const Ze = (e, r, o) => {
|
|
|
340
340
|
}
|
|
341
341
|
const F = Number.isFinite(d.devicePixelRatio ?? NaN) ? d.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
|
|
342
342
|
Ke(_, d.width, d.viewportHeight, F);
|
|
343
|
-
const E = d.segmentsByItem.length, N = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)),
|
|
343
|
+
const E = d.segmentsByItem.length, N = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)), O = Math.min(E, Math.ceil((d.scrollPosition + d.viewportHeight) / d.itemHeight)), C = (() => {
|
|
344
344
|
if (typeof d.renderEndIndex == "number" && Number.isFinite(d.renderEndIndex)) {
|
|
345
|
-
const
|
|
346
|
-
return Math.max(Math.min(E,
|
|
345
|
+
const W = Math.floor(d.renderEndIndex);
|
|
346
|
+
return Math.max(Math.min(E, W + 1), N);
|
|
347
347
|
}
|
|
348
|
-
return Math.max(
|
|
349
|
-
})(),
|
|
348
|
+
return Math.max(O, N);
|
|
349
|
+
})(), V = (() => {
|
|
350
350
|
if (typeof d.lookaheadEndIndex == "number" && Number.isFinite(d.lookaheadEndIndex)) {
|
|
351
|
-
const
|
|
351
|
+
const W = Math.floor(d.lookaheadEndIndex), X = Math.min(E, W + 1);
|
|
352
352
|
return Math.max(X, C);
|
|
353
353
|
}
|
|
354
|
-
return Math.max(
|
|
355
|
-
})(),
|
|
356
|
-
x.save(), x.scale(F, F), x.clearRect(0, 0, d.width, d.viewportHeight), x.translate(0, -d.scrollPosition), x.strokeStyle = d.color, et(x,
|
|
354
|
+
return Math.max(O, C);
|
|
355
|
+
})(), H = Ze(d.segmentsByItem, N, V), Y = Qe(d.glyphsByItem, N, V);
|
|
356
|
+
x.save(), x.scale(F, F), x.clearRect(0, 0, d.width, d.viewportHeight), x.translate(0, -d.scrollPosition), x.strokeStyle = d.color, et(x, H, d.strokeWidth), rt(x, Y, d.expandGlyphColor ?? d.color, d.expandGlyphSize), x.restore();
|
|
357
357
|
}, []), R = j(() => {
|
|
358
358
|
u.current === null && (u.current = window.requestAnimationFrame(h));
|
|
359
359
|
}, [h]);
|
|
360
|
-
return
|
|
360
|
+
return q(() => {
|
|
361
361
|
s.current = {
|
|
362
362
|
segmentsByItem: e,
|
|
363
363
|
glyphsByItem: r,
|
|
@@ -374,9 +374,9 @@ const Ze = (e, r, o) => {
|
|
|
374
374
|
expandGlyphColor: p,
|
|
375
375
|
expandGlyphSize: g
|
|
376
376
|
}, R();
|
|
377
|
-
}, [e, r, o, l, n, a, i, m, v, y, c, b, p, g, R]),
|
|
377
|
+
}, [e, r, o, l, n, a, i, m, v, y, c, b, p, g, R]), q(() => () => {
|
|
378
378
|
u.current !== null && (window.cancelAnimationFrame(u.current), u.current = null);
|
|
379
|
-
}, []), /* @__PURE__ */ S.jsx("canvas", { ref:
|
|
379
|
+
}, []), /* @__PURE__ */ S.jsx("canvas", { ref: k, className: "pointer-events-none absolute top-0 left-0 z-0" });
|
|
380
380
|
});
|
|
381
381
|
Ce.displayName = "TreeLineCanvas";
|
|
382
382
|
const L = {
|
|
@@ -384,20 +384,20 @@ const L = {
|
|
|
384
384
|
containerPending: "opacity-70",
|
|
385
385
|
entry: "directory-tree-entry flex items-center cursor-pointer relative select-none",
|
|
386
386
|
// ホバー時のスタイル(ライト/ダークモード対応)
|
|
387
|
-
entryHover:
|
|
387
|
+
entryHover: $("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
|
|
388
388
|
// 選択時のスタイル(ライト/ダークモード対応)
|
|
389
|
-
entrySelected:
|
|
389
|
+
entrySelected: $("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
|
|
390
390
|
// アイテム選択時のスタイル(ライト/ダークモード対応)
|
|
391
|
-
entryItemSelected:
|
|
391
|
+
entryItemSelected: $("directory-tree-entry--item-selected bg-blue-400/20 shadow-[0_0_0_1px_rgba(59,130,246,0.3)]", "dark:bg-blue-400/25 dark:shadow-[0_0_0_1px_rgba(96,165,250,0.4)]"),
|
|
392
392
|
// アイコンのスタイル
|
|
393
|
-
expandIcon:
|
|
394
|
-
expandIconSelected:
|
|
395
|
-
typeIcon:
|
|
396
|
-
typeIconSelected:
|
|
393
|
+
expandIcon: $("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
394
|
+
expandIconSelected: $("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
|
|
395
|
+
typeIcon: $("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
|
|
396
|
+
typeIconSelected: $("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
|
|
397
397
|
// テキストのスタイル
|
|
398
|
-
name:
|
|
398
|
+
name: $("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1", "text-gray-700", "dark:text-gray-200"),
|
|
399
399
|
nameDirectory: "directory-tree-name--directory",
|
|
400
|
-
nameSelected:
|
|
400
|
+
nameSelected: $("directory-tree-name--selected text-blue-800 font-medium", "dark:text-blue-300")
|
|
401
401
|
}, nt = {
|
|
402
402
|
msOverflowStyle: "none",
|
|
403
403
|
scrollbarWidth: "none"
|
|
@@ -409,9 +409,9 @@ const L = {
|
|
|
409
409
|
let i = 0;
|
|
410
410
|
const m = (v, y, c) => {
|
|
411
411
|
for (let b = 0; b < v.length; b++) {
|
|
412
|
-
const p = v[b], g = b === v.length - 1,
|
|
413
|
-
let h = y, R =
|
|
414
|
-
l && (h = y - 1, R =
|
|
412
|
+
const p = v[b], g = b === v.length - 1, k = [...c, g], u = p.children !== void 0, s = u && r(p.absolutePath, p.relativePath);
|
|
413
|
+
let h = y, R = k, _ = c;
|
|
414
|
+
l && (h = y - 1, R = k.slice(1), _ = c.slice(1)), n.push({ entry: p, indentLevel: h, parentIsLast: R }), o && (h > i && (i = h), a.push({
|
|
415
415
|
id: p.absolutePath,
|
|
416
416
|
name: p.name,
|
|
417
417
|
absolutePath: p.absolutePath,
|
|
@@ -421,12 +421,12 @@ const L = {
|
|
|
421
421
|
isExpanded: s,
|
|
422
422
|
ancestorIsLast: [..._],
|
|
423
423
|
hideLines: l && y === 0
|
|
424
|
-
})), u && s && p.children && m(p.children, y + 1,
|
|
424
|
+
})), u && s && p.children && m(p.children, y + 1, k);
|
|
425
425
|
}
|
|
426
426
|
};
|
|
427
427
|
return m(e, 0, []), { flatItems: n, lineItems: a, maxIndent: i };
|
|
428
428
|
}, st = (e, r, o, l, n) => {
|
|
429
|
-
const a = l?.renderStart ?? Math.max(0, Math.floor(n /
|
|
429
|
+
const a = l?.renderStart ?? Math.max(0, Math.floor(n / le)), i = r > 0 ? Math.ceil(r / le) + o : o, m = e > 0 ? Math.min(e - 1, a + i) : a, v = l?.renderEnd ?? m, y = e > 0 ? Math.min(e - 1, v + o) : v;
|
|
430
430
|
return { renderStart: a, renderEnd: v, lookaheadEnd: y };
|
|
431
431
|
}, lt = ({ isDirectory: e, isExpanded: r, showExpandIcons: o, useCanvasExpandIcons: l, expandIconSize: n }) => {
|
|
432
432
|
const a = n ? { width: n, height: n } : void 0, i = n ? "" : "h-4 w-4";
|
|
@@ -439,7 +439,7 @@ const L = {
|
|
|
439
439
|
const c = e[y];
|
|
440
440
|
if (c.hideLines)
|
|
441
441
|
continue;
|
|
442
|
-
const b = [], p = y * r, g = p + r / 2,
|
|
442
|
+
const b = [], p = y * r, g = p + r / 2, k = m > 0 ? m / 2 + 2 : o / 1.5;
|
|
443
443
|
for (let h = 0; h < c.indentLevel; h++) {
|
|
444
444
|
if (c.ancestorIsLast[h] ?? !1)
|
|
445
445
|
continue;
|
|
@@ -471,7 +471,7 @@ const L = {
|
|
|
471
471
|
x1: s,
|
|
472
472
|
y1: p,
|
|
473
473
|
x2: s,
|
|
474
|
-
y2: g -
|
|
474
|
+
y2: g - k,
|
|
475
475
|
itemIndex: y
|
|
476
476
|
}) : b.push({
|
|
477
477
|
key: `${c.id}-connector-top`,
|
|
@@ -490,7 +490,7 @@ const L = {
|
|
|
490
490
|
}), c.isLastChild || (c.isDirectory ? b.push({
|
|
491
491
|
key: `${c.id}-connector-bottom`,
|
|
492
492
|
x1: s,
|
|
493
|
-
y1: g +
|
|
493
|
+
y1: g + k,
|
|
494
494
|
x2: s,
|
|
495
495
|
y2: p + r,
|
|
496
496
|
itemIndex: y
|
|
@@ -545,78 +545,78 @@ const L = {
|
|
|
545
545
|
renderChildren: n = !0,
|
|
546
546
|
expansion: { toggleDirectory: a, onToggleDirectoryRecursive: i },
|
|
547
547
|
selection: { onFileSelect: m, selectedPath: v, mode: y = "none", selectedItems: c, onSelectionChange: b },
|
|
548
|
-
visual: { iconOverrides: p, showExpandIcons: g = !0, showDirectoryIcons:
|
|
548
|
+
visual: { iconOverrides: p, showExpandIcons: g = !0, showDirectoryIcons: k = !0, showFileIcons: u = !0, useCanvasExpandIcons: s = !1, expandIconSize: h }
|
|
549
549
|
}) => {
|
|
550
|
-
const R =
|
|
551
|
-
|
|
550
|
+
const R = se(null), [_, x] = ee(null), [d, F] = ee(!1);
|
|
551
|
+
q(
|
|
552
552
|
() => () => {
|
|
553
553
|
R.current && window.clearTimeout(R.current);
|
|
554
554
|
},
|
|
555
555
|
[]
|
|
556
556
|
);
|
|
557
|
-
const E = e.children !== void 0, N = E && o(e.absolutePath, e.relativePath),
|
|
558
|
-
|
|
557
|
+
const E = e.children !== void 0, N = E && o(e.absolutePath, e.relativePath), O = e.absolutePath === v, C = !E && c?.has(e.absolutePath), V = E ? void 0 : it(e.name);
|
|
558
|
+
q(() => {
|
|
559
559
|
x(N && e.children ? e.children : null);
|
|
560
560
|
}, [N, e.children]);
|
|
561
|
-
const
|
|
562
|
-
(
|
|
563
|
-
if (
|
|
561
|
+
const H = j(
|
|
562
|
+
(D) => {
|
|
563
|
+
if (D.stopPropagation(), y !== "none" && !E && b && b(e.absolutePath, !C), !E) return m(e.absolutePath, e.relativePath);
|
|
564
564
|
R.current ? (window.clearTimeout(R.current), R.current = null, i(e)) : R.current = window.setTimeout(() => {
|
|
565
565
|
a(e.absolutePath, e.relativePath), R.current = null;
|
|
566
566
|
}, 500);
|
|
567
567
|
},
|
|
568
568
|
[E, e, i, a, m, y, b, C]
|
|
569
|
-
), Y =
|
|
569
|
+
), Y = $(L.entry, d && L.entryHover, O && L.entrySelected, C && L.entryItemSelected, e.className), W = $(L.expandIcon, (O || C) && L.expandIconSelected), X = $(L.typeIcon, (O || C) && L.typeIconSelected), J = $(L.name, E && L.nameDirectory, (O || C) && L.nameSelected), te = lt({ isDirectory: E, isExpanded: N, showExpandIcons: g, useCanvasExpandIcons: s, expandIconSize: h }), re = (E ? k : u) ? ut({ entry: e, isDirectory: E, isExpanded: N, isSelected: O, isItemSelected: !!C, extension: V }, p) : null;
|
|
570
570
|
return /* @__PURE__ */ S.jsxs(Ye, { children: [
|
|
571
571
|
/* @__PURE__ */ S.jsxs(
|
|
572
572
|
"div",
|
|
573
573
|
{
|
|
574
574
|
className: Y,
|
|
575
575
|
style: {
|
|
576
|
-
paddingLeft: `${Math.max(0, r *
|
|
577
|
-
transform: r < 0 ? `translateX(${r *
|
|
578
|
-
width: r < 0 ? `calc(100% + ${Math.abs(r *
|
|
579
|
-
height: `${
|
|
576
|
+
paddingLeft: `${Math.max(0, r * de)}px`,
|
|
577
|
+
transform: r < 0 ? `translateX(${r * de}px)` : void 0,
|
|
578
|
+
width: r < 0 ? `calc(100% + ${Math.abs(r * de)}px)` : void 0,
|
|
579
|
+
height: `${le}px`,
|
|
580
580
|
...e.style
|
|
581
581
|
},
|
|
582
582
|
"data-entry-type": E ? "directory" : "file",
|
|
583
583
|
"data-entry-expanded": E ? String(N) : void 0,
|
|
584
|
-
"data-entry-selected":
|
|
584
|
+
"data-entry-selected": O ? "true" : void 0,
|
|
585
585
|
"data-entry-item-selected": C ? "true" : void 0,
|
|
586
|
-
onClick:
|
|
586
|
+
onClick: H,
|
|
587
587
|
onMouseEnter: () => F(!0),
|
|
588
588
|
onMouseLeave: () => F(!1),
|
|
589
|
-
onKeyDown: (
|
|
589
|
+
onKeyDown: (D) => D.key === "Enter" && H(D),
|
|
590
590
|
tabIndex: 0,
|
|
591
591
|
role: "treeitem",
|
|
592
592
|
"aria-expanded": E ? N : void 0,
|
|
593
593
|
"aria-label": `${e.name} (${E ? "directory" : "file"})`,
|
|
594
594
|
children: [
|
|
595
|
-
(g || s) && /* @__PURE__ */ S.jsx("span", { className:
|
|
596
|
-
(E ?
|
|
597
|
-
/* @__PURE__ */ S.jsx("span", { className:
|
|
595
|
+
(g || s) && /* @__PURE__ */ S.jsx("span", { className: W, children: te }),
|
|
596
|
+
(E ? k : u) && /* @__PURE__ */ S.jsx("span", { className: X, children: re }),
|
|
597
|
+
/* @__PURE__ */ S.jsx("span", { className: J, "data-entry-type": E ? "directory" : "file", "data-entry-role": "name", children: e.label ?? e.name })
|
|
598
598
|
]
|
|
599
599
|
}
|
|
600
600
|
),
|
|
601
|
-
N && _ && n && /* @__PURE__ */ S.jsx("fieldset", { children: _.map((
|
|
601
|
+
N && _ && n && /* @__PURE__ */ S.jsx("fieldset", { children: _.map((D, Z) => /* @__PURE__ */ S.jsx(
|
|
602
602
|
xe,
|
|
603
603
|
{
|
|
604
|
-
entry:
|
|
604
|
+
entry: D,
|
|
605
605
|
indentLevel: r + 1,
|
|
606
606
|
isDirOpen: o,
|
|
607
|
-
parentIsLast: [...l,
|
|
607
|
+
parentIsLast: [...l, Z === _.length - 1],
|
|
608
608
|
expansion: { toggleDirectory: a, onToggleDirectoryRecursive: i },
|
|
609
609
|
selection: { onFileSelect: m, selectedPath: v, mode: y, selectedItems: c, onSelectionChange: b },
|
|
610
610
|
visual: {
|
|
611
611
|
iconOverrides: p,
|
|
612
612
|
showExpandIcons: g,
|
|
613
|
-
showDirectoryIcons:
|
|
613
|
+
showDirectoryIcons: k,
|
|
614
614
|
showFileIcons: u,
|
|
615
615
|
useCanvasExpandIcons: s,
|
|
616
616
|
expandIconSize: h
|
|
617
617
|
}
|
|
618
618
|
},
|
|
619
|
-
|
|
619
|
+
D.absolutePath
|
|
620
620
|
)) })
|
|
621
621
|
] }, e.absolutePath);
|
|
622
622
|
},
|
|
@@ -627,7 +627,7 @@ const L = {
|
|
|
627
627
|
}
|
|
628
628
|
);
|
|
629
629
|
xe.displayName = "DirectoryEntryItem";
|
|
630
|
-
const
|
|
630
|
+
const le = 20, dt = () => le, de = 16, Ne = 12, Me = (e) => {
|
|
631
631
|
const r = [];
|
|
632
632
|
if (e.children)
|
|
633
633
|
for (const o of e.children)
|
|
@@ -637,83 +637,84 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
|
|
|
637
637
|
entries: e,
|
|
638
638
|
expansion: { toggle: r, isExpanded: o, expandMultiple: l, collapseMultiple: n, isPending: a, alwaysExpanded: i = !1, doubleClickAction: m = "recursive" },
|
|
639
639
|
selection: { onFileSelect: v, selectedPath: y, mode: c = "none", selectedItems: b, onSelectionChange: p },
|
|
640
|
-
visual: { className: g, style:
|
|
640
|
+
visual: { className: g, style: k, lineColor: u = "#A0AEC0", showTreeLines: s = !0, showExpandIcons: h = !0, showDirectoryIcons: R = !0, showFileIcons: _ = !0, iconOverrides: x, expandIconSize: d, removeRootIndent: F = !1 } = {},
|
|
641
641
|
virtualScroll: E
|
|
642
642
|
}) => {
|
|
643
|
-
const [N,
|
|
644
|
-
overscanCount:
|
|
645
|
-
className:
|
|
646
|
-
background:
|
|
647
|
-
onScroll:
|
|
648
|
-
onRangeChange:
|
|
643
|
+
const [N, O] = ee(!1), C = se(null), V = se(null), [H, Y] = ee(0), [W, X] = ee(null), {
|
|
644
|
+
overscanCount: J = 15,
|
|
645
|
+
className: te,
|
|
646
|
+
background: re,
|
|
647
|
+
onScroll: D,
|
|
648
|
+
onRangeChange: Z,
|
|
649
649
|
initialScrollIndex: t,
|
|
650
650
|
initialScrollOffset: f,
|
|
651
651
|
callbackThrottleMs: I = 5,
|
|
652
652
|
contentInsets: P,
|
|
653
|
-
onItemFocus:
|
|
654
|
-
viewportHeightOverride:
|
|
653
|
+
onItemFocus: ne,
|
|
654
|
+
viewportHeightOverride: A,
|
|
655
655
|
scrollBarOptions: T,
|
|
656
|
-
behaviorOptions:
|
|
657
|
-
} = E ?? {}, [
|
|
658
|
-
(
|
|
659
|
-
|
|
656
|
+
behaviorOptions: G
|
|
657
|
+
} = E ?? {}, [z, fe] = ee(typeof f == "number" ? f : 0), Oe = j(
|
|
658
|
+
(w, U) => {
|
|
659
|
+
fe(w), D?.(w, U);
|
|
660
660
|
},
|
|
661
|
-
[
|
|
661
|
+
[D]
|
|
662
662
|
), Ae = j(
|
|
663
|
-
(
|
|
664
|
-
|
|
663
|
+
(w) => {
|
|
664
|
+
const { renderingStartIndex: U, renderingEndIndex: B } = w;
|
|
665
|
+
X((M) => M && M.renderStart === U && M.renderEnd === B ? M : { renderStart: U, renderEnd: B }), Z?.(w);
|
|
665
666
|
},
|
|
666
|
-
[
|
|
667
|
+
[Z]
|
|
667
668
|
);
|
|
668
|
-
|
|
669
|
-
typeof f == "number" &&
|
|
670
|
-
}, [f]),
|
|
671
|
-
|
|
672
|
-
}, []),
|
|
673
|
-
if (typeof
|
|
674
|
-
Y((
|
|
669
|
+
q(() => {
|
|
670
|
+
typeof f == "number" && fe(f);
|
|
671
|
+
}, [f]), q(() => {
|
|
672
|
+
O(!0), ot();
|
|
673
|
+
}, []), q(() => {
|
|
674
|
+
if (typeof A == "number") {
|
|
675
|
+
Y((M) => Math.abs(M - A) > 1 ? A : M);
|
|
675
676
|
return;
|
|
676
677
|
}
|
|
677
|
-
const
|
|
678
|
-
if (!
|
|
678
|
+
const w = C.current;
|
|
679
|
+
if (!w) return Y(0);
|
|
679
680
|
(() => {
|
|
680
|
-
const
|
|
681
|
-
Y((
|
|
681
|
+
const M = w.clientHeight;
|
|
682
|
+
Y((K) => Math.abs(K - M) > 1 ? M : K);
|
|
682
683
|
})();
|
|
683
|
-
const
|
|
684
|
-
for (const
|
|
685
|
-
|
|
684
|
+
const B = new ResizeObserver((M) => {
|
|
685
|
+
for (const K of M)
|
|
686
|
+
K.target === w && Y((be) => Math.abs(be - K.contentRect.height) > 1 ? K.contentRect.height : be);
|
|
686
687
|
});
|
|
687
|
-
return
|
|
688
|
-
}, [
|
|
689
|
-
const
|
|
688
|
+
return B.observe(w), () => B.disconnect();
|
|
689
|
+
}, [A]);
|
|
690
|
+
const Q = typeof A == "number" ? A : H, oe = j((w, U) => i || (N ? o(w) : !1), [N, o, i]), Ee = $(L.container, a && L.containerPending, g), Ie = ae(
|
|
690
691
|
() => ({
|
|
691
692
|
...nt,
|
|
692
|
-
...
|
|
693
|
-
...typeof
|
|
693
|
+
...k ?? {},
|
|
694
|
+
...typeof A == "number" ? { height: A, minHeight: A } : {}
|
|
694
695
|
}),
|
|
695
|
-
[
|
|
696
|
+
[k, A]
|
|
696
697
|
), $e = j(
|
|
697
|
-
(
|
|
698
|
-
const
|
|
699
|
-
if (
|
|
700
|
-
if (
|
|
701
|
-
if (
|
|
702
|
-
console.warn(`[DirectoryTree] Unknown double click action: ${
|
|
698
|
+
(w, U) => {
|
|
699
|
+
const B = [w.absolutePath, ...Me(w)], M = U || m;
|
|
700
|
+
if (B.every((ge) => oe(ge))) return n(B);
|
|
701
|
+
if (B.every((ge) => !oe(ge)) || M === "recursive") return l(B);
|
|
702
|
+
if (M === "toggle") return n(B);
|
|
703
|
+
console.warn(`[DirectoryTree] Unknown double click action: ${M}. No action taken.`);
|
|
703
704
|
},
|
|
704
|
-
[
|
|
705
|
-
), { flatItems:
|
|
706
|
-
() => !s ||
|
|
707
|
-
[
|
|
708
|
-
),
|
|
705
|
+
[oe, l, n, m]
|
|
706
|
+
), { flatItems: ie, lineItems: pe, maxIndent: ke } = ae(() => at(e, oe, s, F), [e, oe, s, F]), he = ae(
|
|
707
|
+
() => !s || pe.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : ct(pe, le, de, s, d ?? Ne),
|
|
708
|
+
[pe, s, d]
|
|
709
|
+
), me = ae(() => !s || e.length === 0 ? 0 : (ke + 2) * de, [e.length, ke, s]), { renderStart: we, renderEnd: Se, lookaheadEnd: Re } = ae(() => st(ie.length, Q, J, W, z), [ie.length, Q, J, W, z]), De = ae(() => !s || me <= 0 || Q <= 0 || he.segmentsByItem.length === 0 ? null : /* @__PURE__ */ S.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ S.jsx("div", { className: "absolute top-0 left-0", style: { width: me, height: Q }, children: /* @__PURE__ */ S.jsx(
|
|
709
710
|
Ce,
|
|
710
711
|
{
|
|
711
|
-
segmentsByItem:
|
|
712
|
-
glyphsByItem:
|
|
713
|
-
itemHeight:
|
|
714
|
-
width:
|
|
715
|
-
viewportHeight:
|
|
716
|
-
scrollPosition:
|
|
712
|
+
segmentsByItem: he.segmentsByItem,
|
|
713
|
+
glyphsByItem: he.glyphsByItem,
|
|
714
|
+
itemHeight: le,
|
|
715
|
+
width: me,
|
|
716
|
+
viewportHeight: Q,
|
|
717
|
+
scrollPosition: z,
|
|
717
718
|
color: u,
|
|
718
719
|
expandGlyphColor: u,
|
|
719
720
|
expandGlyphSize: d ?? Ne,
|
|
@@ -721,37 +722,37 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
|
|
|
721
722
|
renderEndIndex: Se,
|
|
722
723
|
lookaheadEndIndex: Re
|
|
723
724
|
}
|
|
724
|
-
) }) }), [
|
|
725
|
+
) }) }), [me, Q, we, Se, Re, z, he, u, s, d]), Le = j((w) => ie[w], [ie]);
|
|
725
726
|
return e.length === 0 ? /* @__PURE__ */ S.jsx("div", { className: Ee, style: Ie }) : /* @__PURE__ */ S.jsx("div", { ref: C, className: Ee, style: Ie, role: "tree", children: /* @__PURE__ */ S.jsx(
|
|
726
727
|
He,
|
|
727
728
|
{
|
|
728
|
-
ref:
|
|
729
|
-
itemCount:
|
|
729
|
+
ref: V,
|
|
730
|
+
itemCount: ie.length,
|
|
730
731
|
getItem: Le,
|
|
731
732
|
getItemHeight: dt,
|
|
732
|
-
viewportSize:
|
|
733
|
-
overscanCount:
|
|
733
|
+
viewportSize: Q,
|
|
734
|
+
overscanCount: J,
|
|
734
735
|
onScroll: Oe,
|
|
735
736
|
onRangeChange: Ae,
|
|
736
|
-
className:
|
|
737
|
+
className: te,
|
|
737
738
|
background: /* @__PURE__ */ S.jsxs(S.Fragment, { children: [
|
|
738
739
|
De,
|
|
739
|
-
|
|
740
|
+
re
|
|
740
741
|
] }),
|
|
741
742
|
initialScrollIndex: t,
|
|
742
743
|
initialScrollOffset: f,
|
|
743
|
-
onItemFocus:
|
|
744
|
+
onItemFocus: ne,
|
|
744
745
|
callbackThrottleMs: I,
|
|
745
746
|
contentInsets: P,
|
|
746
747
|
scrollBarOptions: T,
|
|
747
|
-
behaviorOptions:
|
|
748
|
-
children: (
|
|
748
|
+
behaviorOptions: G,
|
|
749
|
+
children: (w) => w && /* @__PURE__ */ S.jsx(
|
|
749
750
|
xe,
|
|
750
751
|
{
|
|
751
|
-
entry:
|
|
752
|
-
indentLevel:
|
|
753
|
-
isDirOpen:
|
|
754
|
-
parentIsLast:
|
|
752
|
+
entry: w.entry,
|
|
753
|
+
indentLevel: w.indentLevel,
|
|
754
|
+
isDirOpen: oe,
|
|
755
|
+
parentIsLast: w.parentIsLast,
|
|
755
756
|
renderChildren: !1,
|
|
756
757
|
expansion: { toggleDirectory: r, onToggleDirectoryRecursive: $e },
|
|
757
758
|
selection: { onFileSelect: v, selectedPath: y ?? null, mode: c, selectedItems: b, onSelectionChange: p },
|
|
@@ -764,12 +765,12 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
|
|
|
764
765
|
expandIconSize: d
|
|
765
766
|
}
|
|
766
767
|
},
|
|
767
|
-
|
|
768
|
+
w.entry.absolutePath
|
|
768
769
|
)
|
|
769
770
|
}
|
|
770
771
|
) });
|
|
771
772
|
}, gt = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: r } = {}) => {
|
|
772
|
-
const [o, l] = Be(), [n, a] =
|
|
773
|
+
const [o, l] = Be(), [n, a] = ee(() => {
|
|
773
774
|
if (typeof window < "u" && r)
|
|
774
775
|
try {
|
|
775
776
|
const u = window.localStorage.getItem(r);
|
|
@@ -797,7 +798,7 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
|
|
|
797
798
|
},
|
|
798
799
|
[i]
|
|
799
800
|
);
|
|
800
|
-
|
|
801
|
+
q(() => {
|
|
801
802
|
if (r && typeof window < "u")
|
|
802
803
|
try {
|
|
803
804
|
window.localStorage.setItem(r, JSON.stringify(Array.from(n)));
|
|
@@ -844,7 +845,7 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
|
|
|
844
845
|
i((u) => {
|
|
845
846
|
u.clear();
|
|
846
847
|
});
|
|
847
|
-
}, [i]),
|
|
848
|
+
}, [i]), k = j((u) => n.has(u), [n]);
|
|
848
849
|
return {
|
|
849
850
|
expanded: n,
|
|
850
851
|
toggle: v,
|
|
@@ -853,7 +854,7 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
|
|
|
853
854
|
collapseMultiple: b,
|
|
854
855
|
expandMultiple: p,
|
|
855
856
|
collapseAll: g,
|
|
856
|
-
isExpanded:
|
|
857
|
+
isExpanded: k,
|
|
857
858
|
isPending: o
|
|
858
859
|
};
|
|
859
860
|
};
|