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