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