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