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