@aiquants/directory-tree 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import ke, { memo as Te, useRef as he, useState as W, useEffect as ee, useCallback as N, Fragment as Ie, useMemo as le, useTransition as Re } from "react";
2
- import { VirtualScroll as Ce } from "@aiquants/virtualscroll";
3
- import { ChevronDownIcon as je, ChevronRightIcon as $e, FolderIcon as Oe, DocumentTextIcon as Le } from "@heroicons/react/24/solid";
4
- import { FileIcon as Ne } from "@phosphor-icons/react";
5
- import { twMerge as R } from "tailwind-merge";
6
- var ce = { exports: {} }, Q = {};
1
+ import Ie, { memo as Ce, useRef as ve, useState as H, useEffect as ne, useCallback as F, Fragment as je, useMemo as fe, useTransition as $e } from "react";
2
+ import { VirtualScroll as Oe } from "@aiquants/virtualscroll";
3
+ import { ChevronDownIcon as Ne, ChevronRightIcon as Le, FolderIcon as Ae, DocumentTextIcon as De } from "@heroicons/react/24/solid";
4
+ import { FileIcon as Pe } from "@phosphor-icons/react";
5
+ import { twMerge as P } from "tailwind-merge";
6
+ var he = { exports: {} }, ee = {};
7
7
  /**
8
8
  * @license React
9
9
  * react-jsx-runtime.production.js
@@ -13,29 +13,29 @@ var ce = { exports: {} }, Q = {};
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
15
  */
16
- var ge;
17
- function Ae() {
18
- if (ge) return Q;
19
- ge = 1;
16
+ var Ee;
17
+ function Me() {
18
+ if (Ee) return ee;
19
+ Ee = 1;
20
20
  var t = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
21
- function u(c, s, i) {
22
- var f = null;
23
- if (i !== void 0 && (f = "" + i), s.key !== void 0 && (f = "" + s.key), "key" in s) {
21
+ function u(l, s, i) {
22
+ var m = null;
23
+ if (i !== void 0 && (m = "" + i), s.key !== void 0 && (m = "" + s.key), "key" in s) {
24
24
  i = {};
25
25
  for (var p in s)
26
26
  p !== "key" && (i[p] = s[p]);
27
27
  } else i = s;
28
28
  return s = i.ref, {
29
29
  $$typeof: t,
30
- type: c,
31
- key: f,
30
+ type: l,
31
+ key: m,
32
32
  ref: s !== void 0 ? s : null,
33
33
  props: i
34
34
  };
35
35
  }
36
- return Q.Fragment = r, Q.jsx = u, Q.jsxs = u, Q;
36
+ return ee.Fragment = r, ee.jsx = u, ee.jsxs = u, ee;
37
37
  }
38
- var K = {};
38
+ var te = {};
39
39
  /**
40
40
  * @license React
41
41
  * react-jsx-runtime.development.js
@@ -45,47 +45,47 @@ var K = {};
45
45
  * This source code is licensed under the MIT license found in the
46
46
  * LICENSE file in the root directory of this source tree.
47
47
  */
48
- var pe;
49
- function De() {
50
- return pe || (pe = 1, process.env.NODE_ENV !== "production" && (function() {
48
+ var xe;
49
+ function Fe() {
50
+ return xe || (xe = 1, process.env.NODE_ENV !== "production" && (function() {
51
51
  function t(e) {
52
52
  if (e == null) return null;
53
53
  if (typeof e == "function")
54
- return e.$$typeof === q ? null : e.displayName || e.name || null;
54
+ return e.$$typeof === N ? null : e.displayName || e.name || null;
55
55
  if (typeof e == "string") return e;
56
56
  switch (e) {
57
- case d:
57
+ case E:
58
58
  return "Fragment";
59
- case m:
59
+ case d:
60
60
  return "Profiler";
61
- case O:
61
+ case Y:
62
62
  return "StrictMode";
63
- case S:
63
+ case V:
64
64
  return "Suspense";
65
- case B:
65
+ case I:
66
66
  return "SuspenseList";
67
- case j:
67
+ case C:
68
68
  return "Activity";
69
69
  }
70
70
  if (typeof e == "object")
71
71
  switch (typeof e.tag == "number" && console.error(
72
72
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
73
73
  ), e.$$typeof) {
74
- case n:
74
+ case o:
75
75
  return "Portal";
76
- case A:
76
+ case S:
77
77
  return e.displayName || "Context";
78
- case x:
78
+ case v:
79
79
  return (e._context.displayName || "Context") + ".Consumer";
80
- case D:
81
- var o = e.render;
82
- return e = e.displayName, e || (e = o.displayName || o.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
83
- case H:
84
- return o = e.displayName || null, o !== null ? o : t(e.type) || "Memo";
85
- case Y:
86
- o = e._payload, e = e._init;
80
+ case O:
81
+ var n = e.render;
82
+ return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
83
+ case x:
84
+ return n = e.displayName || null, n !== null ? n : t(e.type) || "Memo";
85
+ case z:
86
+ n = e._payload, e = e._init;
87
87
  try {
88
- return t(e(o));
88
+ return t(e(n));
89
89
  } catch {
90
90
  }
91
91
  }
@@ -97,74 +97,74 @@ function De() {
97
97
  function u(e) {
98
98
  try {
99
99
  r(e);
100
- var o = !1;
100
+ var n = !1;
101
101
  } catch {
102
- o = !0;
102
+ n = !0;
103
103
  }
104
- if (o) {
105
- o = console;
106
- var h = o.error, y = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
107
- return h.call(
108
- o,
104
+ if (n) {
105
+ n = console;
106
+ var f = n.error, g = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
107
+ return f.call(
108
+ n,
109
109
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
110
- y
110
+ g
111
111
  ), r(e);
112
112
  }
113
113
  }
114
- function c(e) {
115
- if (e === d) return "<>";
116
- if (typeof e == "object" && e !== null && e.$$typeof === Y)
114
+ function l(e) {
115
+ if (e === E) return "<>";
116
+ if (typeof e == "object" && e !== null && e.$$typeof === z)
117
117
  return "<...>";
118
118
  try {
119
- var o = t(e);
120
- return o ? "<" + o + ">" : "<...>";
119
+ var n = t(e);
120
+ return n ? "<" + n + ">" : "<...>";
121
121
  } catch {
122
122
  return "<...>";
123
123
  }
124
124
  }
125
125
  function s() {
126
- var e = P.A;
126
+ var e = G.A;
127
127
  return e === null ? null : e.getOwner();
128
128
  }
129
129
  function i() {
130
130
  return Error("react-stack-top-frame");
131
131
  }
132
- function f(e) {
133
- if (te.call(e, "key")) {
134
- var o = Object.getOwnPropertyDescriptor(e, "key").get;
135
- if (o && o.isReactWarning) return !1;
132
+ function m(e) {
133
+ if (ae.call(e, "key")) {
134
+ var n = Object.getOwnPropertyDescriptor(e, "key").get;
135
+ if (n && n.isReactWarning) return !1;
136
136
  }
137
137
  return e.key !== void 0;
138
138
  }
139
- function p(e, o) {
140
- function h() {
141
- re || (re = !0, console.error(
139
+ function p(e, n) {
140
+ function f() {
141
+ oe || (oe = !0, console.error(
142
142
  "%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)",
143
- o
143
+ n
144
144
  ));
145
145
  }
146
- h.isReactWarning = !0, Object.defineProperty(e, "key", {
147
- get: h,
146
+ f.isReactWarning = !0, Object.defineProperty(e, "key", {
147
+ get: f,
148
148
  configurable: !0
149
149
  });
150
150
  }
151
- function E() {
151
+ function R() {
152
152
  var e = t(this.type);
153
- return ne[e] || (ne[e] = !0, console.error(
153
+ return se[e] || (se[e] = !0, console.error(
154
154
  "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."
155
155
  )), e = this.props.ref, e !== void 0 ? e : null;
156
156
  }
157
- function k(e, o, h, y, I, U) {
158
- var g = h.ref;
157
+ function D(e, n, f, g, U, Q) {
158
+ var y = f.ref;
159
159
  return e = {
160
- $$typeof: l,
160
+ $$typeof: b,
161
161
  type: e,
162
- key: o,
163
- props: h,
164
- _owner: y
165
- }, (g !== void 0 ? g : null) !== null ? Object.defineProperty(e, "ref", {
162
+ key: n,
163
+ props: f,
164
+ _owner: g
165
+ }, (y !== void 0 ? y : null) !== null ? Object.defineProperty(e, "ref", {
166
166
  enumerable: !1,
167
- get: E
167
+ get: R
168
168
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
169
169
  configurable: !1,
170
170
  enumerable: !1,
@@ -179,69 +179,69 @@ function De() {
179
179
  configurable: !1,
180
180
  enumerable: !1,
181
181
  writable: !0,
182
- value: I
182
+ value: U
183
183
  }), Object.defineProperty(e, "_debugTask", {
184
184
  configurable: !1,
185
185
  enumerable: !1,
186
186
  writable: !0,
187
- value: U
187
+ value: Q
188
188
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
189
189
  }
190
- function C(e, o, h, y, I, U) {
191
- var g = o.children;
192
- if (g !== void 0)
193
- if (y)
194
- if (ue(g)) {
195
- for (y = 0; y < g.length; y++)
196
- T(g[y]);
197
- Object.freeze && Object.freeze(g);
190
+ function $(e, n, f, g, U, Q) {
191
+ var y = n.children;
192
+ if (y !== void 0)
193
+ if (g)
194
+ if (J(y)) {
195
+ for (g = 0; g < y.length; g++)
196
+ w(y[g]);
197
+ Object.freeze && Object.freeze(y);
198
198
  } else
199
199
  console.error(
200
200
  "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
201
201
  );
202
- else T(g);
203
- if (te.call(o, "key")) {
204
- g = t(e);
205
- var M = Object.keys(o).filter(function(de) {
206
- return de !== "key";
202
+ else w(y);
203
+ if (ae.call(n, "key")) {
204
+ y = t(e);
205
+ var j = Object.keys(n).filter(function(me) {
206
+ return me !== "key";
207
207
  });
208
- y = 0 < M.length ? "{key: someKey, " + M.join(": ..., ") + ": ...}" : "{key: someKey}", se[g + y] || (M = 0 < M.length ? "{" + M.join(": ..., ") + ": ...}" : "{}", console.error(
208
+ g = 0 < j.length ? "{key: someKey, " + j.join(": ..., ") + ": ...}" : "{key: someKey}", ie[y + g] || (j = 0 < j.length ? "{" + j.join(": ..., ") + ": ...}" : "{}", console.error(
209
209
  `A props object containing a "key" prop is being spread into JSX:
210
210
  let props = %s;
211
211
  <%s {...props} />
212
212
  React keys must be passed directly to JSX without using spread:
213
213
  let props = %s;
214
214
  <%s key={someKey} {...props} />`,
215
- y,
216
215
  g,
217
- M,
218
- g
219
- ), se[g + y] = !0);
216
+ y,
217
+ j,
218
+ y
219
+ ), ie[y + g] = !0);
220
220
  }
221
- if (g = null, h !== void 0 && (u(h), g = "" + h), f(o) && (u(o.key), g = "" + o.key), "key" in o) {
222
- h = {};
223
- for (var V in o)
224
- V !== "key" && (h[V] = o[V]);
225
- } else h = o;
226
- return g && p(
227
- h,
221
+ if (y = null, f !== void 0 && (u(f), y = "" + f), m(n) && (u(n.key), y = "" + n.key), "key" in n) {
222
+ f = {};
223
+ for (var X in n)
224
+ X !== "key" && (f[X] = n[X]);
225
+ } else f = n;
226
+ return y && p(
227
+ f,
228
228
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
229
- ), k(
229
+ ), D(
230
230
  e,
231
- g,
232
- h,
231
+ y,
232
+ f,
233
233
  s(),
234
- I,
235
- U
234
+ U,
235
+ Q
236
236
  );
237
237
  }
238
- function T(e) {
239
- w(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === Y && (e._payload.status === "fulfilled" ? w(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
240
- }
241
238
  function w(e) {
242
- return typeof e == "object" && e !== null && e.$$typeof === l;
239
+ T(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === z && (e._payload.status === "fulfilled" ? T(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
240
+ }
241
+ function T(e) {
242
+ return typeof e == "object" && e !== null && e.$$typeof === b;
243
243
  }
244
- var a = ke, l = Symbol.for("react.transitional.element"), n = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), O = Symbol.for("react.strict_mode"), m = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), A = Symbol.for("react.context"), D = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), B = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), Y = Symbol.for("react.lazy"), j = Symbol.for("react.activity"), q = Symbol.for("react.client.reference"), P = a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, te = Object.prototype.hasOwnProperty, ue = Array.isArray, G = console.createTask ? console.createTask : function() {
244
+ var a = Ie, b = Symbol.for("react.transitional.element"), o = Symbol.for("react.portal"), E = Symbol.for("react.fragment"), Y = Symbol.for("react.strict_mode"), d = Symbol.for("react.profiler"), v = Symbol.for("react.consumer"), S = Symbol.for("react.context"), O = Symbol.for("react.forward_ref"), V = Symbol.for("react.suspense"), I = Symbol.for("react.suspense_list"), x = Symbol.for("react.memo"), z = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), N = Symbol.for("react.client.reference"), G = a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ae = Object.prototype.hasOwnProperty, J = Array.isArray, Z = console.createTask ? console.createTask : function() {
245
245
  return null;
246
246
  };
247
247
  a = {
@@ -249,422 +249,458 @@ React keys must be passed directly to JSX without using spread:
249
249
  return e();
250
250
  }
251
251
  };
252
- var re, ne = {}, ae = a.react_stack_bottom_frame.bind(
252
+ var oe, se = {}, le = a.react_stack_bottom_frame.bind(
253
253
  a,
254
254
  i
255
- )(), oe = G(c(i)), se = {};
256
- K.Fragment = d, K.jsx = function(e, o, h) {
257
- var y = 1e4 > P.recentlyCreatedOwnerStacks++;
258
- return C(
255
+ )(), ce = Z(l(i)), ie = {};
256
+ te.Fragment = E, te.jsx = function(e, n, f) {
257
+ var g = 1e4 > G.recentlyCreatedOwnerStacks++;
258
+ return $(
259
259
  e,
260
- o,
261
- h,
260
+ n,
261
+ f,
262
262
  !1,
263
- y ? Error("react-stack-top-frame") : ae,
264
- y ? G(c(e)) : oe
263
+ g ? Error("react-stack-top-frame") : le,
264
+ g ? Z(l(e)) : ce
265
265
  );
266
- }, K.jsxs = function(e, o, h) {
267
- var y = 1e4 > P.recentlyCreatedOwnerStacks++;
268
- return C(
266
+ }, te.jsxs = function(e, n, f) {
267
+ var g = 1e4 > G.recentlyCreatedOwnerStacks++;
268
+ return $(
269
269
  e,
270
- o,
271
- h,
270
+ n,
271
+ f,
272
272
  !0,
273
- y ? Error("react-stack-top-frame") : ae,
274
- y ? G(c(e)) : oe
273
+ g ? Error("react-stack-top-frame") : le,
274
+ g ? Z(l(e)) : ce
275
275
  );
276
276
  };
277
- })()), K;
277
+ })()), te;
278
278
  }
279
- var Ee;
280
- function Pe() {
281
- return Ee || (Ee = 1, process.env.NODE_ENV === "production" ? ce.exports = Ae() : ce.exports = De()), ce.exports;
279
+ var we;
280
+ function Ye() {
281
+ return we || (we = 1, process.env.NODE_ENV === "production" ? he.exports = Me() : he.exports = Fe()), he.exports;
282
282
  }
283
- var b = Pe();
284
- const Me = ({ items: t, itemHeight: r, width: u, segmentWidth: c, color: s = "#a0aec0", strokeWidth: i = 1, renderFromY: f = 0, renderHeight: p }) => {
285
- const E = [], k = Math.max(0, Math.floor(f / r)), C = p ?? t.length * r, T = Math.min(t.length, Math.ceil((f + C) / r));
286
- for (let a = k; a < T; a++) {
287
- const l = t[a], n = a * r, d = n + r / 2;
288
- for (let x = 0; x < l.indentLevel; x++) {
289
- const A = x * c + c / 2;
290
- let D = !1;
291
- for (let S = a; S < t.length; S++) {
292
- if (t[S].indentLevel > x && t[S].ancestorIsLast.length > x && !t[S].ancestorIsLast[x]) {
293
- D = !0;
283
+ var h = Ye();
284
+ const Ve = ({ items: t, itemHeight: r, width: u, segmentWidth: l, color: s = "#a0aec0", strokeWidth: i = 1, renderFromY: m = 0, renderHeight: p, renderStartIndex: R, renderEndIndex: D, lookaheadEndIndex: $ }) => {
285
+ const w = [], T = p ?? t.length * r, a = typeof R == "number" && Number.isFinite(R) ? Math.max(0, Math.floor(R)) : Math.max(0, Math.floor(m / r)), b = Math.min(t.length, Math.ceil((m + T) / r)), o = (() => {
286
+ if (typeof D == "number" && Number.isFinite(D)) {
287
+ const d = Math.floor(D);
288
+ return Math.max(Math.min(t.length, d + 1), a);
289
+ }
290
+ return Math.max(b, a);
291
+ })(), E = (() => {
292
+ if (typeof $ == "number" && Number.isFinite($)) {
293
+ const d = Math.floor($), v = Math.min(t.length, d + 1);
294
+ return Math.max(v, o);
295
+ }
296
+ return Math.max(b, o);
297
+ })();
298
+ for (let d = a; d < o; d++) {
299
+ const v = t[d], S = d * r, O = S + r / 2;
300
+ for (let x = 0; x < v.indentLevel; x++) {
301
+ const z = x * l + l / 2;
302
+ let C = !1;
303
+ for (let N = d; N < E; N++) {
304
+ if (t[N].indentLevel > x && t[N].ancestorIsLast.length > x && !t[N].ancestorIsLast[x]) {
305
+ C = !0;
294
306
  break;
295
307
  }
296
- if (t[S].indentLevel === x && S > a)
308
+ if (t[N].indentLevel === x && N > d)
297
309
  break;
298
310
  }
299
- D && l.ancestorIsLast.length > x && !l.ancestorIsLast[x] && E.push(`M ${A},${n} L ${A},${n + r}`);
311
+ C && v.ancestorIsLast.length > x && !v.ancestorIsLast[x] && w.push(`M ${z},${S} L ${z},${S + r}`);
300
312
  }
301
- const O = l.indentLevel * c, m = O + c / 2;
302
- if (l.isDirectory) {
303
- const x = c / 1.5;
304
- E.push(`M ${m},${n} L ${m},${d - x}`);
313
+ const V = v.indentLevel * l, I = V + l / 2;
314
+ if (v.isDirectory) {
315
+ const x = l / 1.5;
316
+ w.push(`M ${I},${S} L ${I},${O - x}`);
305
317
  } else
306
- E.push(`M ${m},${n} L ${m},${d}`);
307
- if (l.isDirectory || l.isLastChild && E.push(`M ${m},${d} L ${O + c},${d}`), !l.isLastChild)
308
- if (l.isDirectory) {
309
- const x = c / 1.5;
310
- E.push(`M ${m},${d + x} L ${m},${n + r}`);
318
+ w.push(`M ${I},${S} L ${I},${O}`);
319
+ if (v.isDirectory || v.isLastChild && w.push(`M ${I},${O} L ${V + l},${O}`), !v.isLastChild)
320
+ if (v.isDirectory) {
321
+ const x = l / 1.5;
322
+ w.push(`M ${I},${O + x} L ${I},${S + r}`);
311
323
  } else
312
- E.push(`M ${m},${d} L ${m},${n + r}`);
324
+ w.push(`M ${I},${O} L ${I},${S + r}`);
313
325
  }
314
- const w = t.length * r;
315
- return /* @__PURE__ */ b.jsxs(
326
+ const Y = t.length * r;
327
+ return /* @__PURE__ */ h.jsxs(
316
328
  "svg",
317
329
  {
318
330
  width: u,
319
- height: p ?? w,
320
- viewBox: `0 ${f} ${u} ${p ?? w}`,
331
+ height: p ?? Y,
332
+ viewBox: `0 ${m} ${u} ${p ?? Y}`,
321
333
  fill: "none",
322
334
  xmlns: "http://www.w3.org/2000/svg",
323
335
  className: "pointer-events-none absolute top-0 left-0 z-0 opacity-75",
324
336
  children: [
325
- /* @__PURE__ */ b.jsx("title", { children: "Tree Lines" }),
326
- E.map((a, l) => /* @__PURE__ */ b.jsx("path", { d: a, stroke: s, strokeWidth: i, strokeLinecap: "round", strokeLinejoin: "round" }, `path-${t[k + l]?.id || l}-${k + l}`))
337
+ /* @__PURE__ */ h.jsx("title", { children: "Tree Lines" }),
338
+ w.map((d, v) => /* @__PURE__ */ h.jsx("path", { d, stroke: s, strokeWidth: i, strokeLinecap: "round", strokeLinejoin: "round" }, `path-${t[a + v]?.id || v}-${a + v}`))
327
339
  ]
328
340
  }
329
341
  );
330
- }, _ = {
331
- container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden",
342
+ }, A = {
343
+ container: "directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[5px]",
332
344
  containerPending: "opacity-70",
333
345
  entry: "flex items-center cursor-pointer relative select-none",
334
346
  // ホバー時のスタイル(ライト/ダークモード対応)
335
- entryHover: R(
347
+ entryHover: P(
336
348
  "hover:bg-gray-400/15",
337
349
  "dark:hover:bg-gray-200/10"
338
350
  ),
339
351
  // 選択時のスタイル(ライト/ダークモード対応)
340
- entrySelected: R(
352
+ entrySelected: P(
341
353
  "bg-blue-400/10",
342
354
  "dark:bg-blue-400/15"
343
355
  ),
344
356
  // アイテム選択時のスタイル(ライト/ダークモード対応)
345
- entryItemSelected: R(
357
+ entryItemSelected: P(
346
358
  "bg-blue-400/20 shadow-[0_0_0_1px_rgba(59,130,246,0.3)]",
347
359
  "dark:bg-blue-400/25 dark:shadow-[0_0_0_1px_rgba(96,165,250,0.4)]"
348
360
  ),
349
361
  // アイコンのスタイル
350
- expandIcon: R(
362
+ expandIcon: P(
351
363
  "w-5 h-5 flex-shrink-0 flex items-center justify-center",
352
364
  "text-gray-500",
353
365
  "dark:text-gray-400"
354
366
  ),
355
- expandIconSelected: R(
367
+ expandIconSelected: P(
356
368
  "text-blue-700",
357
369
  "dark:text-blue-400"
358
370
  ),
359
- typeIcon: R(
371
+ typeIcon: P(
360
372
  "w-5 h-5 flex-shrink-0 flex items-center justify-center",
361
373
  "text-gray-500",
362
374
  "dark:text-gray-400"
363
375
  ),
364
- typeIconSelected: R(
376
+ typeIconSelected: P(
365
377
  "text-blue-700",
366
378
  "dark:text-blue-400"
367
379
  ),
368
380
  // テキストのスタイル
369
- name: R(
381
+ name: P(
370
382
  "overflow-hidden text-ellipsis whitespace-nowrap ml-1",
371
383
  "text-gray-700",
372
384
  "dark:text-gray-200"
373
385
  ),
374
386
  nameDirectory: "font-bold",
375
- nameSelected: R(
387
+ nameSelected: P(
376
388
  "text-blue-800 font-medium",
377
389
  "dark:text-blue-300"
378
390
  )
379
- }, xe = {
391
+ }, Se = {
380
392
  msOverflowStyle: "none",
381
393
  /* IE and Edge */
382
394
  scrollbarWidth: "none"
383
395
  /* Firefox */
384
- }, Fe = () => {
396
+ }, ze = () => {
385
397
  let t = document.getElementById("directory-tree-webkit-scrollbar-hide");
386
398
  t || (t = document.createElement("style"), t.id = "directory-tree-webkit-scrollbar-hide", t.textContent = ".directory-tree-container::-webkit-scrollbar { display: none; }", document.head.appendChild(t));
387
- }, Ye = (t = !1, r = !1, u = !1) => R(
388
- _.entry,
389
- t && _.entryHover,
390
- r && _.entrySelected,
391
- u && _.entryItemSelected
392
- ), Ve = (t = !1) => R(
393
- _.expandIcon,
394
- t && _.expandIconSelected
395
- ), ze = (t = !1) => R(
396
- _.typeIcon,
397
- t && _.typeIconSelected
398
- ), Ue = (t = !1, r = !1) => R(
399
- _.name,
400
- t && _.nameDirectory,
401
- r && _.nameSelected
402
- ), Je = Ce, We = (t) => t.slice((t.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(), be = Te(
399
+ }, Ue = (t = !1, r = !1, u = !1) => P(
400
+ A.entry,
401
+ t && A.entryHover,
402
+ r && A.entrySelected,
403
+ u && A.entryItemSelected
404
+ ), Be = (t = !1) => P(
405
+ A.expandIcon,
406
+ t && A.expandIconSelected
407
+ ), Je = (t = !1) => P(
408
+ A.typeIcon,
409
+ t && A.typeIconSelected
410
+ ), We = (t = !1, r = !1) => P(
411
+ A.name,
412
+ t && A.nameDirectory,
413
+ r && A.nameSelected
414
+ ), qe = Oe, He = (t) => t.slice((t.lastIndexOf(".") - 1 >>> 0) + 2).toLowerCase(), ye = Ce(
403
415
  ({
404
416
  entry: t,
405
417
  indentLevel: r,
406
418
  isDirOpen: u,
407
- onFileSelect: c,
419
+ onFileSelect: l,
408
420
  toggleDirectory: s,
409
421
  onToggleDirectoryRecursive: i,
410
- selectedPath: f,
422
+ selectedPath: m,
411
423
  parentIsLast: p,
412
- renderChildren: E = !0,
413
- selectionMode: k = "none",
414
- selectedItems: C,
415
- onSelectionChange: T
424
+ renderChildren: R = !0,
425
+ selectionMode: D = "none",
426
+ selectedItems: $,
427
+ onSelectionChange: w
416
428
  }) => {
417
- const w = he(null), [a, l] = W(null);
418
- ee(() => () => {
419
- w.current && window.clearTimeout(w.current);
429
+ const T = ve(null), [a, b] = H(null);
430
+ ne(() => () => {
431
+ T.current && window.clearTimeout(T.current);
420
432
  }, []);
421
- const n = t.children !== void 0, d = n && u(t.absolutePath, t.relativePath), O = t.absolutePath === f, m = !n && C?.has(t.absolutePath);
422
- ee(() => {
423
- d && t.children ? Promise.resolve().then(() => {
424
- l(t.children ?? []);
425
- }) : l(null);
426
- }, [d, t.children]);
427
- const x = N(
428
- (j) => {
429
- j.stopPropagation(), k !== "none" && !n && T && T(t.absolutePath, !m), n ? w.current ? (window.clearTimeout(w.current), w.current = null, i(t)) : w.current = window.setTimeout(() => {
430
- s(t.absolutePath, t.relativePath), w.current = null;
431
- }, 500) : c(t.absolutePath, t.relativePath);
433
+ const o = t.children !== void 0, E = o && u(t.absolutePath, t.relativePath), Y = t.absolutePath === m, d = !o && $?.has(t.absolutePath);
434
+ ne(() => {
435
+ E && t.children ? Promise.resolve().then(() => {
436
+ b(t.children ?? []);
437
+ }) : b(null);
438
+ }, [E, t.children]);
439
+ const v = F(
440
+ (C) => {
441
+ C.stopPropagation(), D !== "none" && !o && w && w(t.absolutePath, !d), o ? T.current ? (window.clearTimeout(T.current), T.current = null, i(t)) : T.current = window.setTimeout(() => {
442
+ s(t.absolutePath, t.relativePath), T.current = null;
443
+ }, 500) : l(t.absolutePath, t.relativePath);
432
444
  },
433
- [n, t, i, s, c, k, T, m]
434
- ), [A, D] = W(!1), S = Ye(A, O, m), B = Ve(O || m), H = ze(O || m), Y = Ue(n, O || m);
435
- return /* @__PURE__ */ b.jsxs(Ie, { children: [
436
- /* @__PURE__ */ b.jsxs(
445
+ [o, t, i, s, l, D, w, d]
446
+ ), [S, O] = H(!1), V = Ue(S, Y, d), I = Be(Y || d), x = Je(Y || d), z = We(o, Y || d);
447
+ return /* @__PURE__ */ h.jsxs(je, { children: [
448
+ /* @__PURE__ */ h.jsxs(
437
449
  "div",
438
450
  {
439
- className: S,
451
+ className: V,
440
452
  style: {
441
- paddingLeft: `${r * me}px`,
442
- height: `${ie}px`
453
+ paddingLeft: `${r * ge}px`,
454
+ height: `${re}px`
443
455
  },
444
- onClick: x,
445
- onMouseEnter: () => D(!0),
446
- onMouseLeave: () => D(!1),
447
- onKeyDown: (j) => {
448
- j.key === "Enter" && x(j);
456
+ onClick: v,
457
+ onMouseEnter: () => O(!0),
458
+ onMouseLeave: () => O(!1),
459
+ onKeyDown: (C) => {
460
+ C.key === "Enter" && v(C);
449
461
  },
450
462
  tabIndex: 0,
451
463
  role: "treeitem",
452
- "aria-expanded": n ? d : void 0,
453
- "aria-label": `${t.name} (${n ? "directory" : "file"})`,
464
+ "aria-expanded": o ? E : void 0,
465
+ "aria-label": `${t.name} (${o ? "directory" : "file"})`,
454
466
  children: [
455
- /* @__PURE__ */ b.jsx("span", { className: B, children: n ? d ? /* @__PURE__ */ b.jsx(je, { className: "h-4 w-4" }) : /* @__PURE__ */ b.jsx($e, { className: "h-4 w-4" }) : /* @__PURE__ */ b.jsx("span", { className: "w-4" }) }),
456
- /* @__PURE__ */ b.jsx("span", { className: H, children: n ? /* @__PURE__ */ b.jsx(Oe, { className: "h-4 w-4" }) : (() => {
457
- switch (We(t.name)) {
467
+ /* @__PURE__ */ h.jsx("span", { className: I, children: o ? E ? /* @__PURE__ */ h.jsx(Ne, { className: "h-4 w-4" }) : /* @__PURE__ */ h.jsx(Le, { className: "h-4 w-4" }) : /* @__PURE__ */ h.jsx("span", { className: "w-4" }) }),
468
+ /* @__PURE__ */ h.jsx("span", { className: x, children: o ? /* @__PURE__ */ h.jsx(Ae, { className: "h-4 w-4" }) : (() => {
469
+ switch (He(t.name)) {
458
470
  case "md":
459
- return /* @__PURE__ */ b.jsx(Le, { className: "h-4 w-4" });
471
+ return /* @__PURE__ */ h.jsx(De, { className: "h-4 w-4" });
460
472
  default:
461
- return /* @__PURE__ */ b.jsx(Ne, { className: "h-4 w-4" });
473
+ return /* @__PURE__ */ h.jsx(Pe, { className: "h-4 w-4" });
462
474
  }
463
475
  })() }),
464
- /* @__PURE__ */ b.jsx("span", { className: Y, children: t.name })
476
+ /* @__PURE__ */ h.jsx("span", { className: z, children: t.name })
465
477
  ]
466
478
  }
467
479
  ),
468
- d && a && E && /* @__PURE__ */ b.jsx("fieldset", { children: a.map((j, q) => /* @__PURE__ */ b.jsx(
469
- be,
480
+ E && a && R && /* @__PURE__ */ h.jsx("fieldset", { children: a.map((C, N) => /* @__PURE__ */ h.jsx(
481
+ ye,
470
482
  {
471
- entry: j,
483
+ entry: C,
472
484
  indentLevel: r + 1,
473
485
  isDirOpen: u,
474
- onFileSelect: c,
486
+ onFileSelect: l,
475
487
  toggleDirectory: s,
476
488
  onToggleDirectoryRecursive: i,
477
- selectedPath: f,
478
- parentIsLast: [...p, q === (a || []).length - 1],
479
- selectionMode: k,
480
- selectedItems: C,
481
- onSelectionChange: T
489
+ selectedPath: m,
490
+ parentIsLast: [...p, N === (a || []).length - 1],
491
+ selectionMode: D,
492
+ selectedItems: $,
493
+ onSelectionChange: w
482
494
  },
483
- j.absolutePath
495
+ C.absolutePath
484
496
  )) })
485
497
  ] }, t.absolutePath);
486
498
  },
487
499
  (t, r) => {
488
500
  if (t.entry.absolutePath !== r.entry.absolutePath || t.entry.relativePath !== r.entry.relativePath || t.entry.name !== r.entry.name || t.entry.type !== r.entry.type || t.entry.children === void 0 != (r.entry.children === void 0))
489
501
  return !1;
490
- const u = t.entry.children !== void 0, c = r.entry.children !== void 0, s = u && t.isDirOpen(t.entry.absolutePath, t.entry.relativePath), i = c && r.isDirOpen(r.entry.absolutePath, r.entry.relativePath);
502
+ const u = t.entry.children !== void 0, l = r.entry.children !== void 0, s = u && t.isDirOpen(t.entry.absolutePath, t.entry.relativePath), i = l && r.isDirOpen(r.entry.absolutePath, r.entry.relativePath);
491
503
  if (t.indentLevel !== r.indentLevel || s !== i || t.selectedPath !== r.selectedPath || t.onFileSelect !== r.onFileSelect || // onFileSelect はメモ化されていることを期待
492
504
  t.toggleDirectory !== r.toggleDirectory || // toggleDirectory はメモ化されていることを期待
493
505
  t.onToggleDirectoryRecursive !== r.onToggleDirectoryRecursive || t.selectionMode !== r.selectionMode || t.selectedItems !== r.selectedItems || t.onSelectionChange !== r.onSelectionChange || t.parentIsLast.length !== r.parentIsLast.length)
494
506
  return !1;
495
- for (let f = 0; f < t.parentIsLast.length; f++)
496
- if (t.parentIsLast[f] !== r.parentIsLast[f])
507
+ for (let m = 0; m < t.parentIsLast.length; m++)
508
+ if (t.parentIsLast[m] !== r.parentIsLast[m])
497
509
  return !1;
498
510
  return !0;
499
511
  }
500
512
  );
501
- be.displayName = "DirectoryEntryItem";
502
- const ie = 20, me = 16, we = (t) => {
513
+ ye.displayName = "DirectoryEntryItem";
514
+ const re = 20, ge = 16, _e = (t) => {
503
515
  const r = [];
504
516
  if (t.children)
505
517
  for (const u of t.children)
506
- u.type === "directory" && (r.push(u.absolutePath), r.push(...we(u)));
518
+ u.type === "directory" && (r.push(u.absolutePath), r.push(..._e(u)));
507
519
  return r;
508
- }, Se = (t, r, u = [], c = 0) => t.flatMap((s, i) => {
509
- const f = i === t.length - 1, p = [...u, f], E = { entry: s, indentLevel: c, parentIsLast: p };
510
- return s.children && s.children.length > 0 && r(s.absolutePath, s.relativePath) ? [E, ...Se(s.children, r, p, c + 1)] : [E];
511
- }), Ze = ({
520
+ }, ke = (t, r, u = [], l = 0) => t.flatMap((s, i) => {
521
+ const m = i === t.length - 1, p = [...u, m], R = { entry: s, indentLevel: l, parentIsLast: p };
522
+ return s.children && s.children.length > 0 && r(s.absolutePath, s.relativePath) ? [R, ...ke(s.children, r, p, l + 1)] : [R];
523
+ }), et = ({
512
524
  entries: t,
513
525
  onFileSelect: r,
514
526
  className: u,
515
- style: c,
527
+ style: l,
516
528
  selectedPath: s,
517
529
  toggle: i,
518
- isExpanded: f,
530
+ isExpanded: m,
519
531
  expandMultiple: p,
520
- collapseMultiple: E,
521
- isPending: k,
522
- doubleClickAction: C = "recursive",
523
- selectionMode: T = "none",
524
- selectedItems: w,
532
+ collapseMultiple: R,
533
+ isPending: D,
534
+ doubleClickAction: $ = "recursive",
535
+ selectionMode: w = "none",
536
+ selectedItems: T,
525
537
  onSelectionChange: a,
526
- lineColor: l = "#A0AEC0",
527
- virtualScrollOptions: n
538
+ lineColor: b = "#A0AEC0",
539
+ virtualScrollOptions: o
528
540
  }) => {
529
- const [d, O] = W(!1), m = he(null), x = he(null), [A, D] = W(0), {
530
- overscanCount: S,
531
- className: B,
532
- background: H,
533
- onScroll: Y,
534
- onRangeChange: j,
535
- initialScrollIndex: q,
536
- initialScrollOffset: P,
537
- tapScrollCircleOptions: te,
538
- scrollBarWidth: ue,
539
- enableThumbDrag: G,
540
- enableTrackClick: re,
541
- enableArrowButtons: ne,
542
- enablePointerDrag: ae,
543
- inertiaOptions: oe
544
- } = n ?? {}, se = typeof P == "number" ? P : 0, [e, o] = W(se), h = typeof S == "number" ? S : 10, y = N(
545
- (v, $) => {
546
- o(v), Y?.(v, $);
541
+ const [E, Y] = H(!1), d = ve(null), v = ve(null), [S, O] = H(0), [V, I] = H(null), {
542
+ overscanCount: x,
543
+ className: z,
544
+ background: C,
545
+ onScroll: N,
546
+ onRangeChange: G,
547
+ initialScrollIndex: ae,
548
+ initialScrollOffset: J,
549
+ tapScrollCircleOptions: Z,
550
+ scrollBarWidth: oe,
551
+ enableThumbDrag: se,
552
+ enableTrackClick: le,
553
+ enableArrowButtons: ce,
554
+ enablePointerDrag: ie,
555
+ inertiaOptions: e
556
+ } = o ?? {}, n = typeof J == "number" ? J : 0, [f, g] = H(n), U = typeof x == "number" ? x : 10, Q = F(
557
+ (c, _) => {
558
+ g(c), N?.(c, _);
559
+ },
560
+ [N]
561
+ ), y = F(
562
+ (c, _, L, k, M, W) => {
563
+ I((B) => B && B.renderStart === c && B.renderEnd === _ ? B : { renderStart: c, renderEnd: _ }), G?.(c, _, L, k, M, W);
547
564
  },
548
- [Y]
565
+ [G]
549
566
  );
550
- ee(() => {
551
- typeof P == "number" && o(P);
552
- }, [P]), ee(() => {
553
- if (O(!0), Fe(), m.current) {
554
- D(m.current.clientHeight);
555
- const v = new ResizeObserver(($) => {
556
- for (const F of $)
557
- D(F.contentRect.height);
567
+ ne(() => {
568
+ typeof J == "number" && g(J);
569
+ }, [J]), ne(() => {
570
+ if (Y(!0), ze(), d.current) {
571
+ O(d.current.clientHeight);
572
+ const c = new ResizeObserver((_) => {
573
+ for (const L of _)
574
+ O(L.contentRect.height);
558
575
  });
559
- return v.observe(m.current), () => v.disconnect();
576
+ return c.observe(d.current), () => c.disconnect();
560
577
  }
561
578
  }, []);
562
- const I = N(
563
- (v) => d ? f(v) : !1,
564
- [d, f]
565
- ), U = k ? `${_.container} ${_.containerPending}` : _.container, g = N(
566
- (v, $) => {
567
- const F = we(v), L = [v.absolutePath, ...F], z = $ || C;
568
- L.every((X) => I(X)) ? E(L) : L.every((Z) => !I(Z)) || z === "recursive" ? p(L) : z === "toggle" ? E(L) : console.warn(`[DirectoryTree] Unknown double click action: ${z}. No action taken.`);
579
+ const j = F(
580
+ (c) => E ? m(c) : !1,
581
+ [E, m]
582
+ ), X = D ? `${A.container} ${A.containerPending}` : A.container, me = F(
583
+ (c, _) => {
584
+ const L = _e(c), k = [c.absolutePath, ...L], M = _ || $;
585
+ k.every((B) => j(B)) ? R(k) : k.every((K) => !j(K)) || M === "recursive" ? p(k) : M === "toggle" ? R(k) : console.warn(`[DirectoryTree] Unknown double click action: ${M}. No action taken.`);
569
586
  },
570
- [I, p, E, C]
571
- ), M = le(() => {
587
+ [j, p, R, $]
588
+ ), ue = fe(() => {
572
589
  if (t.length === 0)
573
590
  return [];
574
- const v = [];
575
- function $(F, L, z) {
576
- F.forEach((J, X) => {
577
- const Z = J.children !== void 0, fe = J.absolutePath, ye = Z && I(fe), _e = {
578
- id: fe,
579
- name: J.name,
580
- absolutePath: fe,
581
- indentLevel: L,
582
- isLastChild: X === F.length - 1,
583
- isDirectory: Z,
584
- isExpanded: ye,
585
- ancestorIsLast: [...z]
591
+ const c = [];
592
+ function _(L, k, M) {
593
+ L.forEach((W, B) => {
594
+ const K = W.children !== void 0, be = W.absolutePath, pe = K && j(be), Te = {
595
+ id: be,
596
+ name: W.name,
597
+ absolutePath: be,
598
+ indentLevel: k,
599
+ isLastChild: B === L.length - 1,
600
+ isDirectory: K,
601
+ isExpanded: pe,
602
+ ancestorIsLast: [...M]
586
603
  // 祖先の状態をコピーして渡す
587
604
  };
588
- v.push(_e), Z && ye && J.children && $(J.children, L + 1, [...z, X === F.length - 1]);
605
+ c.push(Te), K && pe && W.children && _(W.children, k + 1, [...M, B === L.length - 1]);
589
606
  });
590
607
  }
591
- return $(t, 0, []), v;
592
- }, [t, I]), V = le(() => Se(t, I), [t, I]), de = le(() => V.length * ie, [V]), ve = le(() => {
608
+ return _(t, 0, []), c;
609
+ }, [t, j]), q = fe(() => ke(t, j), [t, j]), de = fe(() => {
593
610
  if (t.length === 0)
594
611
  return 0;
595
- let v = 0;
596
- for (const $ of M)
597
- $.indentLevel > v && (v = $.indentLevel);
598
- return (v + 2) * me;
599
- }, [M, t]);
600
- return t.length === 0 ? /* @__PURE__ */ b.jsx("div", { className: `${U} ${u || ""}`, style: { ...c, ...xe } }) : /* @__PURE__ */ b.jsx("div", { ref: m, className: `${U} ${u || ""}`, style: { ...c, ...xe }, role: "tree", children: /* @__PURE__ */ b.jsxs("div", { className: "w-full", style: { position: "relative", height: `${de}px` }, children: [
601
- /* @__PURE__ */ b.jsx("div", { style: { position: "absolute", top: 0, left: 0, width: ve, height: `${A}px`, overflow: "hidden" }, children: /* @__PURE__ */ b.jsx(Me, { items: M, itemHeight: ie, width: ve, segmentWidth: me, color: l, "aria-hidden": "true", role: "presentation", renderFromY: e, renderHeight: A }) }),
602
- /* @__PURE__ */ b.jsx(
603
- Je,
612
+ let c = 0;
613
+ for (const _ of ue)
614
+ _.indentLevel > c && (c = _.indentLevel);
615
+ return (c + 2) * ge;
616
+ }, [ue, t]), Re = fe(() => {
617
+ if (de <= 0 || S <= 0)
618
+ return null;
619
+ const c = V?.renderStart ?? Math.max(0, Math.floor(f / re)), _ = S > 0 ? Math.ceil(S / re) + U : U, L = q.length > 0 ? Math.min(q.length - 1, c + _) : c, k = V?.renderEnd ?? L, M = q.length > 0 ? Math.min(q.length - 1, k + U) : k;
620
+ return /* @__PURE__ */ h.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ h.jsx("div", { className: "absolute top-0 left-0", style: { width: de, height: S }, children: /* @__PURE__ */ h.jsx(
621
+ Ve,
604
622
  {
605
- ref: x,
606
- itemCount: V.length,
607
- getItem: (v) => V[v],
608
- getItemHeight: () => ie,
609
- viewportSize: A,
610
- overscanCount: h,
611
- onScroll: y,
612
- onRangeChange: j,
613
- className: B,
614
- background: H,
615
- initialScrollIndex: q,
616
- initialScrollOffset: P,
617
- tapScrollCircleOptions: te,
618
- scrollBarWidth: ue,
619
- enableThumbDrag: G,
620
- enableTrackClick: re,
621
- enableArrowButtons: ne,
622
- enablePointerDrag: ae,
623
- inertiaOptions: oe,
624
- children: (v, $) => {
625
- if (!v)
626
- return null;
627
- const { entry: F, indentLevel: L, parentIsLast: z } = v;
628
- return /* @__PURE__ */ b.jsx(
629
- be,
630
- {
631
- entry: F,
632
- indentLevel: L,
633
- isDirOpen: I,
634
- onFileSelect: r,
635
- toggleDirectory: i,
636
- onToggleDirectoryRecursive: g,
637
- selectedPath: s,
638
- parentIsLast: z,
639
- renderChildren: !1,
640
- selectionMode: T,
641
- selectedItems: w,
642
- onSelectionChange: a
643
- },
644
- F.absolutePath
645
- );
646
- }
623
+ items: ue,
624
+ itemHeight: re,
625
+ width: de,
626
+ segmentWidth: ge,
627
+ color: b,
628
+ renderFromY: f,
629
+ renderHeight: S,
630
+ renderStartIndex: c,
631
+ renderEndIndex: k,
632
+ lookaheadEndIndex: M
633
+ }
634
+ ) }) });
635
+ }, [de, S, V, f, U, q.length, ue, b]);
636
+ return t.length === 0 ? /* @__PURE__ */ h.jsx("div", { className: `${X} ${u || ""}`, style: { ...l, ...Se } }) : /* @__PURE__ */ h.jsx("div", { ref: d, className: `${X} ${u || ""}`, style: { ...l, ...Se }, role: "tree", children: /* @__PURE__ */ h.jsx(
637
+ qe,
638
+ {
639
+ ref: v,
640
+ itemCount: q.length,
641
+ getItem: (c) => q[c],
642
+ getItemHeight: () => re,
643
+ viewportSize: S,
644
+ overscanCount: U,
645
+ onScroll: Q,
646
+ onRangeChange: y,
647
+ className: z,
648
+ background: /* @__PURE__ */ h.jsxs(h.Fragment, { children: [
649
+ Re,
650
+ C
651
+ ] }),
652
+ initialScrollIndex: ae,
653
+ initialScrollOffset: J,
654
+ tapScrollCircleOptions: Z,
655
+ scrollBarWidth: oe,
656
+ enableThumbDrag: se,
657
+ enableTrackClick: le,
658
+ enableArrowButtons: ce,
659
+ enablePointerDrag: ie,
660
+ inertiaOptions: e,
661
+ children: (c, _) => {
662
+ if (!c)
663
+ return null;
664
+ const { entry: L, indentLevel: k, parentIsLast: M } = c;
665
+ return /* @__PURE__ */ h.jsx(
666
+ ye,
667
+ {
668
+ entry: L,
669
+ indentLevel: k,
670
+ isDirOpen: j,
671
+ onFileSelect: r,
672
+ toggleDirectory: i,
673
+ onToggleDirectoryRecursive: me,
674
+ selectedPath: s,
675
+ parentIsLast: M,
676
+ renderChildren: !1,
677
+ selectionMode: w,
678
+ selectedItems: T,
679
+ onSelectionChange: a
680
+ },
681
+ L.absolutePath
682
+ );
647
683
  }
648
- )
649
- ] }) });
650
- }, Qe = ({
684
+ }
685
+ ) });
686
+ }, tt = ({
651
687
  initialExpanded: t = /* @__PURE__ */ new Set(),
652
688
  storageKey: r
653
689
  } = {}) => {
654
- const [u, c] = Re(), [s, i] = W(() => {
690
+ const [u, l] = $e(), [s, i] = H(() => {
655
691
  if (typeof window < "u" && r)
656
692
  try {
657
693
  const a = window.localStorage.getItem(r);
658
694
  if (a) {
659
- const l = JSON.parse(a);
660
- return new Set(l);
695
+ const b = JSON.parse(a);
696
+ return new Set(b);
661
697
  }
662
698
  } catch (a) {
663
699
  console.error("[useDirectoryTreeState] Error reading from localStorage", a);
664
700
  }
665
701
  return t;
666
702
  });
667
- ee(() => {
703
+ ne(() => {
668
704
  if (r && typeof window < "u")
669
705
  try {
670
706
  window.localStorage.setItem(r, JSON.stringify(Array.from(s)));
@@ -672,70 +708,70 @@ const ie = 20, me = 16, we = (t) => {
672
708
  console.warn(`Error setting localStorage key "${r}":`, a);
673
709
  }
674
710
  }, [s, r]);
675
- const f = N((a) => {
676
- c(() => {
677
- i((l) => {
678
- const n = new Set(l);
679
- return n.has(a) ? n.delete(a) : n.add(a), n;
711
+ const m = F((a) => {
712
+ l(() => {
713
+ i((b) => {
714
+ const o = new Set(b);
715
+ return o.has(a) ? o.delete(a) : o.add(a), o;
680
716
  });
681
717
  });
682
- }, []), p = N((a) => {
683
- c(() => {
684
- i((l) => {
685
- const n = new Set(l);
686
- return n.has(a) || n.add(a), n;
718
+ }, []), p = F((a) => {
719
+ l(() => {
720
+ i((b) => {
721
+ const o = new Set(b);
722
+ return o.has(a) || o.add(a), o;
687
723
  });
688
724
  });
689
- }, []), E = N((a) => {
690
- c(() => {
691
- i((l) => {
692
- const n = new Set(l);
693
- return n.has(a) && n.delete(a), n;
725
+ }, []), R = F((a) => {
726
+ l(() => {
727
+ i((b) => {
728
+ const o = new Set(b);
729
+ return o.has(a) && o.delete(a), o;
694
730
  });
695
731
  });
696
- }, []), k = N((a) => {
697
- c(() => {
698
- i((l) => {
699
- const n = new Set(l);
700
- for (const d of a)
701
- n.has(d) && n.delete(d);
702
- return n;
732
+ }, []), D = F((a) => {
733
+ l(() => {
734
+ i((b) => {
735
+ const o = new Set(b);
736
+ for (const E of a)
737
+ o.has(E) && o.delete(E);
738
+ return o;
703
739
  });
704
740
  });
705
- }, []), C = N((a) => {
706
- c(() => {
707
- i((l) => {
708
- const n = new Set(l);
709
- for (const d of a)
710
- n.has(d) || n.add(d);
711
- return n;
741
+ }, []), $ = F((a) => {
742
+ l(() => {
743
+ i((b) => {
744
+ const o = new Set(b);
745
+ for (const E of a)
746
+ o.has(E) || o.add(E);
747
+ return o;
712
748
  });
713
749
  });
714
- }, []), T = N(() => {
715
- c(() => {
750
+ }, []), w = F(() => {
751
+ l(() => {
716
752
  i(/* @__PURE__ */ new Set());
717
753
  });
718
- }, []), w = N((a) => s.has(a), [s]);
754
+ }, []), T = F((a) => s.has(a), [s]);
719
755
  return {
720
756
  expanded: s,
721
- toggle: f,
757
+ toggle: m,
722
758
  expand: p,
723
- collapse: E,
724
- collapseMultiple: k,
725
- expandMultiple: C,
726
- collapseAll: T,
727
- isExpanded: w,
759
+ collapse: R,
760
+ collapseMultiple: D,
761
+ expandMultiple: $,
762
+ collapseAll: w,
763
+ isExpanded: T,
728
764
  isPending: u
729
765
  };
730
766
  };
731
767
  export {
732
- Ze as DirectoryTree,
733
- Me as TreeLine,
734
- _ as directoryTreeClasses,
735
- Ye as getEntryClasses,
736
- Ve as getExpandIconClasses,
737
- Ue as getNameClasses,
738
- ze as getTypeIconClasses,
739
- Qe as useDirectoryTreeState
768
+ et as DirectoryTree,
769
+ Ve as TreeLine,
770
+ A as directoryTreeClasses,
771
+ Ue as getEntryClasses,
772
+ Be as getExpandIconClasses,
773
+ We as getNameClasses,
774
+ Je as getTypeIconClasses,
775
+ tt as useDirectoryTreeState
740
776
  };
741
777
  //# sourceMappingURL=index.js.map