@aiquants/directory-tree 1.14.0 → 1.15.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,12 +1,12 @@
1
- import Fe, { memo as je, useRef as le, useCallback as j, useEffect as Q, useState as te, useMemo as se, Fragment as Ye, useTransition as Be } from "react";
1
+ import Fe, { memo as je, useRef as se, useCallback as j, useEffect as q, useState as ee, useMemo as ae, Fragment as Ye, useTransition as Be } from "react";
2
2
  import { VirtualScroll as He } from "@aiquants/virtualscroll";
3
3
  import { FolderIcon as We, DocumentTextIcon as Xe, ChevronDownIcon as Ve, ChevronRightIcon as Je } from "@heroicons/react/24/solid";
4
4
  import { FileIcon as Ge } from "@phosphor-icons/react";
5
- import { twMerge as A } from "tailwind-merge";
6
- var be = { exports: {} }, de = {};
5
+ import { twMerge as $ } from "tailwind-merge";
6
+ var ye = { exports: {} }, ce = {};
7
7
  var _e;
8
8
  function ze() {
9
- if (_e) return de;
9
+ if (_e) return ce;
10
10
  _e = 1;
11
11
  var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
12
12
  function o(l, n, a) {
@@ -24,16 +24,16 @@ function ze() {
24
24
  props: a
25
25
  };
26
26
  }
27
- return de.Fragment = r, de.jsx = o, de.jsxs = o, de;
27
+ return ce.Fragment = r, ce.jsx = o, ce.jsxs = o, ce;
28
28
  }
29
- var fe = {};
29
+ var ue = {};
30
30
  var Pe;
31
31
  function Ue() {
32
32
  return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && (function() {
33
33
  function e(t) {
34
34
  if (t == null) return null;
35
35
  if (typeof t == "function")
36
- return t.$$typeof === G ? null : t.displayName || t.name || null;
36
+ return t.$$typeof === V ? null : t.displayName || t.name || null;
37
37
  if (typeof t == "string") return t;
38
38
  switch (t) {
39
39
  case s:
@@ -64,7 +64,7 @@ function Ue() {
64
64
  return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
65
65
  case N:
66
66
  return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
67
- case M:
67
+ case O:
68
68
  f = t._payload, t = t._init;
69
69
  try {
70
70
  return e(t(f));
@@ -95,7 +95,7 @@ function Ue() {
95
95
  }
96
96
  function l(t) {
97
97
  if (t === s) return "<>";
98
- if (typeof t == "object" && t !== null && t.$$typeof === M)
98
+ if (typeof t == "object" && t !== null && t.$$typeof === O)
99
99
  return "<...>";
100
100
  try {
101
101
  var f = e(t);
@@ -105,7 +105,7 @@ function Ue() {
105
105
  }
106
106
  }
107
107
  function n() {
108
- var t = B.A;
108
+ var t = H.A;
109
109
  return t === null ? null : t.getOwner();
110
110
  }
111
111
  function a() {
@@ -120,7 +120,7 @@ function Ue() {
120
120
  }
121
121
  function m(t, f) {
122
122
  function I() {
123
- z || (z = !0, console.error(
123
+ J || (J = !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
  f
126
126
  ));
@@ -132,14 +132,14 @@ function Ue() {
132
132
  }
133
133
  function v() {
134
134
  var t = e(this.type);
135
- return re[t] || (re[t] = !0, console.error(
135
+ return te[t] || (te[t] = !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
  )), t = this.props.ref, t !== void 0 ? t : null;
138
138
  }
139
- function y(t, f, I, P, oe, O) {
139
+ function y(t, f, I, P, ne, A) {
140
140
  var T = I.ref;
141
141
  return t = {
142
- $$typeof: w,
142
+ $$typeof: k,
143
143
  type: t,
144
144
  key: f,
145
145
  props: I,
@@ -161,19 +161,19 @@ function Ue() {
161
161
  configurable: !1,
162
162
  enumerable: !1,
163
163
  writable: !0,
164
- value: oe
164
+ value: ne
165
165
  }), Object.defineProperty(t, "_debugTask", {
166
166
  configurable: !1,
167
167
  enumerable: !1,
168
168
  writable: !0,
169
- value: O
169
+ value: A
170
170
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
171
171
  }
172
- function c(t, f, I, P, oe, O) {
172
+ function c(t, f, I, P, ne, A) {
173
173
  var T = f.children;
174
174
  if (T !== void 0)
175
175
  if (P)
176
- if (H(T)) {
176
+ if (W(T)) {
177
177
  for (P = 0; P < T.length; P++)
178
178
  b(T[P]);
179
179
  Object.freeze && Object.freeze(T);
@@ -184,10 +184,10 @@ function Ue() {
184
184
  else b(T);
185
185
  if (Y.call(f, "key")) {
186
186
  T = e(t);
187
- var U = Object.keys(f).filter(function(me) {
188
- return me !== "key";
187
+ var G = Object.keys(f).filter(function(fe) {
188
+ return fe !== "key";
189
189
  });
190
- P = 0 < U.length ? "{key: someKey, " + U.join(": ..., ") + ": ...}" : "{key: someKey}", K[T + P] || (U = 0 < U.length ? "{" + U.join(": ..., ") + ": ...}" : "{}", console.error(
190
+ P = 0 < G.length ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}", Z[T + P] || (G = 0 < G.length ? "{" + G.join(": ..., ") + ": ...}" : "{}", console.error(
191
191
  `A props object containing a "key" prop is being spread into JSX:
192
192
  let props = %s;
193
193
  <%s {...props} />
@@ -196,14 +196,14 @@ React keys must be passed directly to JSX without using spread:
196
196
  <%s key={someKey} {...props} />`,
197
197
  P,
198
198
  T,
199
- U,
199
+ G,
200
200
  T
201
- ), K[T + P] = !0);
201
+ ), Z[T + P] = !0);
202
202
  }
203
203
  if (T = null, I !== void 0 && (o(I), T = "" + I), i(f) && (o(f.key), T = "" + f.key), "key" in f) {
204
204
  I = {};
205
- for (var q in f)
206
- q !== "key" && (I[q] = f[q]);
205
+ for (var z in f)
206
+ z !== "key" && (I[z] = f[z]);
207
207
  } else I = f;
208
208
  return T && m(
209
209
  I,
@@ -213,17 +213,17 @@ React keys must be passed directly to JSX without using spread:
213
213
  T,
214
214
  I,
215
215
  n(),
216
- oe,
217
- O
216
+ ne,
217
+ A
218
218
  );
219
219
  }
220
220
  function b(t) {
221
- p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === M && (t._payload.status === "fulfilled" ? p(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
221
+ p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === O && (t._payload.status === "fulfilled" ? p(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
222
222
  }
223
223
  function p(t) {
224
- return typeof t == "object" && t !== null && t.$$typeof === w;
224
+ return typeof t == "object" && t !== null && t.$$typeof === k;
225
225
  }
226
- var g = Fe, w = Symbol.for("react.transitional.element"), u = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), h = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), x = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), F = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), N = Symbol.for("react.memo"), M = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), G = Symbol.for("react.client.reference"), B = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, H = Array.isArray, X = console.createTask ? console.createTask : function() {
226
+ var g = Fe, k = Symbol.for("react.transitional.element"), u = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), h = Symbol.for("react.strict_mode"), R = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), x = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), F = Symbol.for("react.suspense"), E = Symbol.for("react.suspense_list"), N = Symbol.for("react.memo"), O = Symbol.for("react.lazy"), C = Symbol.for("react.activity"), V = Symbol.for("react.client.reference"), H = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, W = Array.isArray, X = console.createTask ? console.createTask : function() {
227
227
  return null;
228
228
  };
229
229
  g = {
@@ -231,36 +231,36 @@ React keys must be passed directly to JSX without using spread:
231
231
  return t();
232
232
  }
233
233
  };
234
- var z, re = {}, ne = g.react_stack_bottom_frame.bind(
234
+ var J, te = {}, re = g.react_stack_bottom_frame.bind(
235
235
  g,
236
236
  a
237
- )(), $ = X(l(a)), K = {};
238
- fe.Fragment = s, fe.jsx = function(t, f, I) {
239
- var P = 1e4 > B.recentlyCreatedOwnerStacks++;
237
+ )(), D = X(l(a)), Z = {};
238
+ ue.Fragment = s, ue.jsx = function(t, f, I) {
239
+ var P = 1e4 > H.recentlyCreatedOwnerStacks++;
240
240
  return c(
241
241
  t,
242
242
  f,
243
243
  I,
244
244
  !1,
245
- P ? Error("react-stack-top-frame") : ne,
246
- P ? X(l(t)) : $
245
+ P ? Error("react-stack-top-frame") : re,
246
+ P ? X(l(t)) : D
247
247
  );
248
- }, fe.jsxs = function(t, f, I) {
249
- var P = 1e4 > B.recentlyCreatedOwnerStacks++;
248
+ }, ue.jsxs = function(t, f, I) {
249
+ var P = 1e4 > H.recentlyCreatedOwnerStacks++;
250
250
  return c(
251
251
  t,
252
252
  f,
253
253
  I,
254
254
  !0,
255
- P ? Error("react-stack-top-frame") : ne,
256
- P ? X(l(t)) : $
255
+ P ? Error("react-stack-top-frame") : re,
256
+ P ? X(l(t)) : D
257
257
  );
258
258
  };
259
- })()), fe;
259
+ })()), ue;
260
260
  }
261
261
  var Te;
262
262
  function qe() {
263
- return Te || (Te = 1, process.env.NODE_ENV === "production" ? be.exports = ze() : be.exports = Ue()), be.exports;
263
+ return Te || (Te = 1, process.env.NODE_ENV === "production" ? ye.exports = ze() : ye.exports = Ue()), ye.exports;
264
264
  }
265
265
  var S = qe();
266
266
  const Ze = (e, r, o) => {
@@ -305,12 +305,12 @@ const Ze = (e, r, o) => {
305
305
  const n = tt(o, 0.14), a = e.strokeStyle, i = e.fillStyle, m = e.lineWidth, v = e.lineCap, y = e.lineJoin;
306
306
  e.strokeStyle = o, e.lineCap = "round", e.lineJoin = "round";
307
307
  for (const c of r) {
308
- const b = l ?? c.size, p = Math.max(0, b / 2), g = Math.max(1, Math.round(b * 0.08)), w = Math.max(1, Math.round(b * 0.14)), u = Math.max(0, p - g * 0.8), s = Math.max(0, u * 0.55);
309
- n && (e.fillStyle = n, e.beginPath(), e.arc(c.centerX, c.centerY, u, 0, Math.PI * 2), e.fill()), e.lineWidth = g, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, p - g * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = w, e.beginPath(), e.moveTo(c.centerX - s, c.centerY), e.lineTo(c.centerX + s, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - s), e.lineTo(c.centerX, c.centerY + s), e.stroke());
308
+ const b = l ?? c.size, p = Math.max(0, b / 2), g = Math.max(1, Math.round(b * 0.08)), k = Math.max(1, Math.round(b * 0.14)), u = Math.max(0, p - g * 0.8), s = Math.max(0, u * 0.55);
309
+ n && (e.fillStyle = n, e.beginPath(), e.arc(c.centerX, c.centerY, u, 0, Math.PI * 2), e.fill()), e.lineWidth = g, e.beginPath(), e.arc(c.centerX, c.centerY, Math.max(0, p - g * 0.3), 0, Math.PI * 2), e.stroke(), e.lineWidth = k, e.beginPath(), e.moveTo(c.centerX - s, c.centerY), e.lineTo(c.centerX + s, c.centerY), e.stroke(), c.isExpanded || (e.beginPath(), e.moveTo(c.centerX, c.centerY - s), e.lineTo(c.centerX, c.centerY + s), e.stroke());
310
310
  }
311
311
  e.strokeStyle = a, e.fillStyle = i, e.lineWidth = m, e.lineCap = v, e.lineJoin = y;
312
312
  }, Ce = je(({ segmentsByItem: e, glyphsByItem: r, itemHeight: o, width: l, viewportHeight: n, scrollPosition: a, color: i = "#a0aec0", strokeWidth: m = 1, renderStartIndex: v, renderEndIndex: y, lookaheadEndIndex: c, devicePixelRatio: b, expandGlyphColor: p, expandGlyphSize: g }) => {
313
- const w = le(null), u = le(null), s = le({
313
+ const k = se(null), u = se(null), s = se({
314
314
  segmentsByItem: e,
315
315
  glyphsByItem: r,
316
316
  itemHeight: o,
@@ -327,7 +327,7 @@ const Ze = (e, r, o) => {
327
327
  expandGlyphSize: g
328
328
  }), h = j(() => {
329
329
  u.current = null;
330
- const _ = w.current;
330
+ const _ = k.current;
331
331
  if (!_)
332
332
  return;
333
333
  const x = _.getContext("2d");
@@ -340,24 +340,24 @@ const Ze = (e, r, o) => {
340
340
  }
341
341
  const F = Number.isFinite(d.devicePixelRatio ?? NaN) ? d.devicePixelRatio : typeof window < "u" && window.devicePixelRatio || 1;
342
342
  Ke(_, d.width, d.viewportHeight, F);
343
- const E = d.segmentsByItem.length, N = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)), M = Math.min(E, Math.ceil((d.scrollPosition + d.viewportHeight) / d.itemHeight)), C = (() => {
343
+ const E = d.segmentsByItem.length, N = typeof d.renderStartIndex == "number" && Number.isFinite(d.renderStartIndex) ? Math.max(0, Math.floor(d.renderStartIndex)) : Math.max(0, Math.floor(d.scrollPosition / d.itemHeight)), O = Math.min(E, Math.ceil((d.scrollPosition + d.viewportHeight) / d.itemHeight)), C = (() => {
344
344
  if (typeof d.renderEndIndex == "number" && Number.isFinite(d.renderEndIndex)) {
345
- const H = Math.floor(d.renderEndIndex);
346
- return Math.max(Math.min(E, H + 1), N);
345
+ const W = Math.floor(d.renderEndIndex);
346
+ return Math.max(Math.min(E, W + 1), N);
347
347
  }
348
- return Math.max(M, N);
349
- })(), G = (() => {
348
+ return Math.max(O, N);
349
+ })(), V = (() => {
350
350
  if (typeof d.lookaheadEndIndex == "number" && Number.isFinite(d.lookaheadEndIndex)) {
351
- const H = Math.floor(d.lookaheadEndIndex), X = Math.min(E, H + 1);
351
+ const W = Math.floor(d.lookaheadEndIndex), X = Math.min(E, W + 1);
352
352
  return Math.max(X, C);
353
353
  }
354
- return Math.max(M, C);
355
- })(), B = Ze(d.segmentsByItem, N, G), Y = Qe(d.glyphsByItem, N, G);
356
- x.save(), x.scale(F, F), x.clearRect(0, 0, d.width, d.viewportHeight), x.translate(0, -d.scrollPosition), x.strokeStyle = d.color, et(x, B, d.strokeWidth), rt(x, Y, d.expandGlyphColor ?? d.color, d.expandGlyphSize), x.restore();
354
+ return Math.max(O, C);
355
+ })(), H = Ze(d.segmentsByItem, N, V), Y = Qe(d.glyphsByItem, N, V);
356
+ x.save(), x.scale(F, F), x.clearRect(0, 0, d.width, d.viewportHeight), x.translate(0, -d.scrollPosition), x.strokeStyle = d.color, et(x, H, d.strokeWidth), rt(x, Y, d.expandGlyphColor ?? d.color, d.expandGlyphSize), x.restore();
357
357
  }, []), R = j(() => {
358
358
  u.current === null && (u.current = window.requestAnimationFrame(h));
359
359
  }, [h]);
360
- return Q(() => {
360
+ return q(() => {
361
361
  s.current = {
362
362
  segmentsByItem: e,
363
363
  glyphsByItem: r,
@@ -374,9 +374,9 @@ const Ze = (e, r, o) => {
374
374
  expandGlyphColor: p,
375
375
  expandGlyphSize: g
376
376
  }, R();
377
- }, [e, r, o, l, n, a, i, m, v, y, c, b, p, g, R]), Q(() => () => {
377
+ }, [e, r, o, l, n, a, i, m, v, y, c, b, p, g, R]), q(() => () => {
378
378
  u.current !== null && (window.cancelAnimationFrame(u.current), u.current = null);
379
- }, []), /* @__PURE__ */ S.jsx("canvas", { ref: w, className: "pointer-events-none absolute top-0 left-0 z-0" });
379
+ }, []), /* @__PURE__ */ S.jsx("canvas", { ref: k, className: "pointer-events-none absolute top-0 left-0 z-0" });
380
380
  });
381
381
  Ce.displayName = "TreeLineCanvas";
382
382
  const L = {
@@ -384,20 +384,20 @@ const L = {
384
384
  containerPending: "opacity-70",
385
385
  entry: "directory-tree-entry flex items-center cursor-pointer relative select-none",
386
386
  // ホバー時のスタイル(ライト/ダークモード対応)
387
- entryHover: A("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
387
+ entryHover: $("directory-tree-entry--hover hover:bg-gray-400/15", "dark:hover:bg-gray-200/10"),
388
388
  // 選択時のスタイル(ライト/ダークモード対応)
389
- entrySelected: A("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
389
+ entrySelected: $("directory-tree-entry--selected bg-blue-400/10", "dark:bg-blue-400/15"),
390
390
  // アイテム選択時のスタイル(ライト/ダークモード対応)
391
- 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)]"),
391
+ entryItemSelected: $("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)]"),
392
392
  // アイコンのスタイル
393
- 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"),
394
- expandIconSelected: A("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
395
- 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"),
396
- typeIconSelected: A("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
393
+ expandIcon: $("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
394
+ expandIconSelected: $("directory-tree-expand-icon--selected text-blue-700", "dark:text-blue-400"),
395
+ typeIcon: $("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center", "text-gray-500", "dark:text-gray-400"),
396
+ typeIconSelected: $("directory-tree-type-icon--selected text-blue-700", "dark:text-blue-400"),
397
397
  // テキストのスタイル
398
- name: A("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1", "text-gray-700", "dark:text-gray-200"),
398
+ name: $("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1", "text-gray-700", "dark:text-gray-200"),
399
399
  nameDirectory: "directory-tree-name--directory",
400
- nameSelected: A("directory-tree-name--selected text-blue-800 font-medium", "dark:text-blue-300")
400
+ nameSelected: $("directory-tree-name--selected text-blue-800 font-medium", "dark:text-blue-300")
401
401
  }, nt = {
402
402
  msOverflowStyle: "none",
403
403
  scrollbarWidth: "none"
@@ -409,9 +409,9 @@ const L = {
409
409
  let i = 0;
410
410
  const m = (v, y, c) => {
411
411
  for (let b = 0; b < v.length; b++) {
412
- const p = v[b], g = b === v.length - 1, w = [...c, g], u = p.children !== void 0, s = u && r(p.absolutePath, p.relativePath);
413
- let h = y, R = w, _ = c;
414
- l && (h = y - 1, R = w.slice(1), _ = c.slice(1)), n.push({ entry: p, indentLevel: h, parentIsLast: R }), o && (h > i && (i = h), a.push({
412
+ const p = v[b], g = b === v.length - 1, k = [...c, g], u = p.children !== void 0, s = u && r(p.absolutePath, p.relativePath);
413
+ let h = y, R = k, _ = c;
414
+ l && (h = y - 1, R = k.slice(1), _ = c.slice(1)), n.push({ entry: p, indentLevel: h, parentIsLast: R }), o && (h > i && (i = h), a.push({
415
415
  id: p.absolutePath,
416
416
  name: p.name,
417
417
  absolutePath: p.absolutePath,
@@ -421,12 +421,12 @@ const L = {
421
421
  isExpanded: s,
422
422
  ancestorIsLast: [..._],
423
423
  hideLines: l && y === 0
424
- })), u && s && p.children && m(p.children, y + 1, w);
424
+ })), u && s && p.children && m(p.children, y + 1, k);
425
425
  }
426
426
  };
427
427
  return m(e, 0, []), { flatItems: n, lineItems: a, maxIndent: i };
428
428
  }, st = (e, r, o, l, n) => {
429
- const a = l?.renderStart ?? Math.max(0, Math.floor(n / ie)), i = r > 0 ? Math.ceil(r / ie) + o : o, m = e > 0 ? Math.min(e - 1, a + i) : a, v = l?.renderEnd ?? m, y = e > 0 ? Math.min(e - 1, v + o) : v;
429
+ const a = l?.renderStart ?? Math.max(0, Math.floor(n / le)), i = r > 0 ? Math.ceil(r / le) + o : o, m = e > 0 ? Math.min(e - 1, a + i) : a, v = l?.renderEnd ?? m, y = e > 0 ? Math.min(e - 1, v + o) : v;
430
430
  return { renderStart: a, renderEnd: v, lookaheadEnd: y };
431
431
  }, lt = ({ isDirectory: e, isExpanded: r, showExpandIcons: o, useCanvasExpandIcons: l, expandIconSize: n }) => {
432
432
  const a = n ? { width: n, height: n } : void 0, i = n ? "" : "h-4 w-4";
@@ -439,7 +439,7 @@ const L = {
439
439
  const c = e[y];
440
440
  if (c.hideLines)
441
441
  continue;
442
- const b = [], p = y * r, g = p + r / 2, w = m > 0 ? m / 2 + 2 : o / 1.5;
442
+ const b = [], p = y * r, g = p + r / 2, k = m > 0 ? m / 2 + 2 : o / 1.5;
443
443
  for (let h = 0; h < c.indentLevel; h++) {
444
444
  if (c.ancestorIsLast[h] ?? !1)
445
445
  continue;
@@ -471,7 +471,7 @@ const L = {
471
471
  x1: s,
472
472
  y1: p,
473
473
  x2: s,
474
- y2: g - w,
474
+ y2: g - k,
475
475
  itemIndex: y
476
476
  }) : b.push({
477
477
  key: `${c.id}-connector-top`,
@@ -490,7 +490,7 @@ const L = {
490
490
  }), c.isLastChild || (c.isDirectory ? b.push({
491
491
  key: `${c.id}-connector-bottom`,
492
492
  x1: s,
493
- y1: g + w,
493
+ y1: g + k,
494
494
  x2: s,
495
495
  y2: p + r,
496
496
  itemIndex: y
@@ -545,78 +545,78 @@ const L = {
545
545
  renderChildren: n = !0,
546
546
  expansion: { toggleDirectory: a, onToggleDirectoryRecursive: i },
547
547
  selection: { onFileSelect: m, selectedPath: v, mode: y = "none", selectedItems: c, onSelectionChange: b },
548
- visual: { iconOverrides: p, showExpandIcons: g = !0, showDirectoryIcons: w = !0, showFileIcons: u = !0, useCanvasExpandIcons: s = !1, expandIconSize: h }
548
+ visual: { iconOverrides: p, showExpandIcons: g = !0, showDirectoryIcons: k = !0, showFileIcons: u = !0, useCanvasExpandIcons: s = !1, expandIconSize: h }
549
549
  }) => {
550
- const R = le(null), [_, x] = te(null), [d, F] = te(!1);
551
- Q(
550
+ const R = se(null), [_, x] = ee(null), [d, F] = ee(!1);
551
+ q(
552
552
  () => () => {
553
553
  R.current && window.clearTimeout(R.current);
554
554
  },
555
555
  []
556
556
  );
557
- const E = e.children !== void 0, N = E && o(e.absolutePath, e.relativePath), M = e.absolutePath === v, C = !E && c?.has(e.absolutePath), G = E ? void 0 : it(e.name);
558
- Q(() => {
557
+ const E = e.children !== void 0, N = E && o(e.absolutePath, e.relativePath), O = e.absolutePath === v, C = !E && c?.has(e.absolutePath), V = E ? void 0 : it(e.name);
558
+ q(() => {
559
559
  x(N && e.children ? e.children : null);
560
560
  }, [N, e.children]);
561
- const B = j(
562
- ($) => {
563
- if ($.stopPropagation(), y !== "none" && !E && b && b(e.absolutePath, !C), !E) return m(e.absolutePath, e.relativePath);
561
+ const H = j(
562
+ (D) => {
563
+ if (D.stopPropagation(), y !== "none" && !E && b && b(e.absolutePath, !C), !E) return m(e.absolutePath, e.relativePath);
564
564
  R.current ? (window.clearTimeout(R.current), R.current = null, i(e)) : R.current = window.setTimeout(() => {
565
565
  a(e.absolutePath, e.relativePath), R.current = null;
566
566
  }, 500);
567
567
  },
568
568
  [E, e, i, a, m, y, b, C]
569
- ), Y = A(L.entry, d && L.entryHover, M && L.entrySelected, C && L.entryItemSelected, e.className), H = A(L.expandIcon, (M || C) && L.expandIconSelected), X = A(L.typeIcon, (M || C) && L.typeIconSelected), z = A(L.name, E && L.nameDirectory, (M || C) && L.nameSelected), re = lt({ isDirectory: E, isExpanded: N, showExpandIcons: g, useCanvasExpandIcons: s, expandIconSize: h }), ne = (E ? w : u) ? ut({ entry: e, isDirectory: E, isExpanded: N, isSelected: M, isItemSelected: !!C, extension: G }, p) : null;
569
+ ), Y = $(L.entry, d && L.entryHover, O && L.entrySelected, C && L.entryItemSelected, e.className), W = $(L.expandIcon, (O || C) && L.expandIconSelected), X = $(L.typeIcon, (O || C) && L.typeIconSelected), J = $(L.name, E && L.nameDirectory, (O || C) && L.nameSelected), te = lt({ isDirectory: E, isExpanded: N, showExpandIcons: g, useCanvasExpandIcons: s, expandIconSize: h }), re = (E ? k : u) ? ut({ entry: e, isDirectory: E, isExpanded: N, isSelected: O, isItemSelected: !!C, extension: V }, p) : null;
570
570
  return /* @__PURE__ */ S.jsxs(Ye, { children: [
571
571
  /* @__PURE__ */ S.jsxs(
572
572
  "div",
573
573
  {
574
574
  className: Y,
575
575
  style: {
576
- paddingLeft: `${Math.max(0, r * he)}px`,
577
- transform: r < 0 ? `translateX(${r * he}px)` : void 0,
578
- width: r < 0 ? `calc(100% + ${Math.abs(r * he)}px)` : void 0,
579
- height: `${ie}px`,
576
+ paddingLeft: `${Math.max(0, r * de)}px`,
577
+ transform: r < 0 ? `translateX(${r * de}px)` : void 0,
578
+ width: r < 0 ? `calc(100% + ${Math.abs(r * de)}px)` : void 0,
579
+ height: `${le}px`,
580
580
  ...e.style
581
581
  },
582
582
  "data-entry-type": E ? "directory" : "file",
583
583
  "data-entry-expanded": E ? String(N) : void 0,
584
- "data-entry-selected": M ? "true" : void 0,
584
+ "data-entry-selected": O ? "true" : void 0,
585
585
  "data-entry-item-selected": C ? "true" : void 0,
586
- onClick: B,
586
+ onClick: H,
587
587
  onMouseEnter: () => F(!0),
588
588
  onMouseLeave: () => F(!1),
589
- onKeyDown: ($) => $.key === "Enter" && B($),
589
+ onKeyDown: (D) => D.key === "Enter" && H(D),
590
590
  tabIndex: 0,
591
591
  role: "treeitem",
592
592
  "aria-expanded": E ? N : void 0,
593
593
  "aria-label": `${e.name} (${E ? "directory" : "file"})`,
594
594
  children: [
595
- (g || s) && /* @__PURE__ */ S.jsx("span", { className: H, children: re }),
596
- (E ? w : u) && /* @__PURE__ */ S.jsx("span", { className: X, children: ne }),
597
- /* @__PURE__ */ S.jsx("span", { className: z, "data-entry-type": E ? "directory" : "file", "data-entry-role": "name", children: e.label ?? e.name })
595
+ (g || s) && /* @__PURE__ */ S.jsx("span", { className: W, children: te }),
596
+ (E ? k : u) && /* @__PURE__ */ S.jsx("span", { className: X, children: re }),
597
+ /* @__PURE__ */ S.jsx("span", { className: J, "data-entry-type": E ? "directory" : "file", "data-entry-role": "name", children: e.label ?? e.name })
598
598
  ]
599
599
  }
600
600
  ),
601
- N && _ && n && /* @__PURE__ */ S.jsx("fieldset", { children: _.map(($, K) => /* @__PURE__ */ S.jsx(
601
+ N && _ && n && /* @__PURE__ */ S.jsx("fieldset", { children: _.map((D, Z) => /* @__PURE__ */ S.jsx(
602
602
  xe,
603
603
  {
604
- entry: $,
604
+ entry: D,
605
605
  indentLevel: r + 1,
606
606
  isDirOpen: o,
607
- parentIsLast: [...l, K === _.length - 1],
607
+ parentIsLast: [...l, Z === _.length - 1],
608
608
  expansion: { toggleDirectory: a, onToggleDirectoryRecursive: i },
609
609
  selection: { onFileSelect: m, selectedPath: v, mode: y, selectedItems: c, onSelectionChange: b },
610
610
  visual: {
611
611
  iconOverrides: p,
612
612
  showExpandIcons: g,
613
- showDirectoryIcons: w,
613
+ showDirectoryIcons: k,
614
614
  showFileIcons: u,
615
615
  useCanvasExpandIcons: s,
616
616
  expandIconSize: h
617
617
  }
618
618
  },
619
- $.absolutePath
619
+ D.absolutePath
620
620
  )) })
621
621
  ] }, e.absolutePath);
622
622
  },
@@ -627,7 +627,7 @@ const L = {
627
627
  }
628
628
  );
629
629
  xe.displayName = "DirectoryEntryItem";
630
- const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
630
+ const le = 20, dt = () => le, de = 16, Ne = 12, Me = (e) => {
631
631
  const r = [];
632
632
  if (e.children)
633
633
  for (const o of e.children)
@@ -637,83 +637,84 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
637
637
  entries: e,
638
638
  expansion: { toggle: r, isExpanded: o, expandMultiple: l, collapseMultiple: n, isPending: a, alwaysExpanded: i = !1, doubleClickAction: m = "recursive" },
639
639
  selection: { onFileSelect: v, selectedPath: y, mode: c = "none", selectedItems: b, onSelectionChange: p },
640
- visual: { className: g, style: w, lineColor: u = "#A0AEC0", showTreeLines: s = !0, showExpandIcons: h = !0, showDirectoryIcons: R = !0, showFileIcons: _ = !0, iconOverrides: x, expandIconSize: d, removeRootIndent: F = !1 } = {},
640
+ visual: { className: g, style: k, lineColor: u = "#A0AEC0", showTreeLines: s = !0, showExpandIcons: h = !0, showDirectoryIcons: R = !0, showFileIcons: _ = !0, iconOverrides: x, expandIconSize: d, removeRootIndent: F = !1 } = {},
641
641
  virtualScroll: E
642
642
  }) => {
643
- const [N, M] = te(!1), C = le(null), G = le(null), [B, Y] = te(0), [H, X] = te(null), {
644
- overscanCount: z = 15,
645
- className: re,
646
- background: ne,
647
- onScroll: $,
648
- onRangeChange: K,
643
+ const [N, O] = ee(!1), C = se(null), V = se(null), [H, Y] = ee(0), [W, X] = ee(null), {
644
+ overscanCount: J = 15,
645
+ className: te,
646
+ background: re,
647
+ onScroll: D,
648
+ onRangeChange: Z,
649
649
  initialScrollIndex: t,
650
650
  initialScrollOffset: f,
651
651
  callbackThrottleMs: I = 5,
652
652
  contentInsets: P,
653
- onItemFocus: oe,
654
- viewportHeightOverride: O,
653
+ onItemFocus: ne,
654
+ viewportHeightOverride: A,
655
655
  scrollBarOptions: T,
656
- behaviorOptions: U
657
- } = E ?? {}, [q, me] = te(typeof f == "number" ? f : 0), Oe = j(
658
- (k, V) => {
659
- me(k), $?.(k, V);
656
+ behaviorOptions: G
657
+ } = E ?? {}, [z, fe] = ee(typeof f == "number" ? f : 0), Oe = j(
658
+ (w, U) => {
659
+ fe(w), D?.(w, U);
660
660
  },
661
- [$]
661
+ [D]
662
662
  ), Ae = j(
663
- (k, V, W, D, J, ue) => {
664
- X((Z) => Z && Z.renderStart === k && Z.renderEnd === V ? Z : { renderStart: k, renderEnd: V }), K?.(k, V, W, D, J, ue);
663
+ (w) => {
664
+ const { renderingStartIndex: U, renderingEndIndex: B } = w;
665
+ X((M) => M && M.renderStart === U && M.renderEnd === B ? M : { renderStart: U, renderEnd: B }), Z?.(w);
665
666
  },
666
- [K]
667
+ [Z]
667
668
  );
668
- Q(() => {
669
- typeof f == "number" && me(f);
670
- }, [f]), Q(() => {
671
- M(!0), ot();
672
- }, []), Q(() => {
673
- if (typeof O == "number") {
674
- Y((D) => Math.abs(D - O) > 1 ? O : D);
669
+ q(() => {
670
+ typeof f == "number" && fe(f);
671
+ }, [f]), q(() => {
672
+ O(!0), ot();
673
+ }, []), q(() => {
674
+ if (typeof A == "number") {
675
+ Y((M) => Math.abs(M - A) > 1 ? A : M);
675
676
  return;
676
677
  }
677
- const k = C.current;
678
- if (!k) return Y(0);
678
+ const w = C.current;
679
+ if (!w) return Y(0);
679
680
  (() => {
680
- const D = k.clientHeight;
681
- Y((J) => Math.abs(J - D) > 1 ? D : J);
681
+ const M = w.clientHeight;
682
+ Y((K) => Math.abs(K - M) > 1 ? M : K);
682
683
  })();
683
- const W = new ResizeObserver((D) => {
684
- for (const J of D)
685
- J.target === k && Y((ue) => Math.abs(ue - J.contentRect.height) > 1 ? J.contentRect.height : ue);
684
+ const B = new ResizeObserver((M) => {
685
+ for (const K of M)
686
+ K.target === w && Y((be) => Math.abs(be - K.contentRect.height) > 1 ? K.contentRect.height : be);
686
687
  });
687
- return W.observe(k), () => W.disconnect();
688
- }, [O]);
689
- const ee = typeof O == "number" ? O : B, ae = j((k, V) => i || (N ? o(k) : !1), [N, o, i]), Ee = A(L.container, a && L.containerPending, g), Ie = se(
688
+ return B.observe(w), () => B.disconnect();
689
+ }, [A]);
690
+ const Q = typeof A == "number" ? A : H, oe = j((w, U) => i || (N ? o(w) : !1), [N, o, i]), Ee = $(L.container, a && L.containerPending, g), Ie = ae(
690
691
  () => ({
691
692
  ...nt,
692
- ...w ?? {},
693
- ...typeof O == "number" ? { height: O, minHeight: O } : {}
693
+ ...k ?? {},
694
+ ...typeof A == "number" ? { height: A, minHeight: A } : {}
694
695
  }),
695
- [w, O]
696
+ [k, A]
696
697
  ), $e = j(
697
- (k, V) => {
698
- const W = [k.absolutePath, ...Me(k)], D = V || m;
699
- if (W.every((Z) => ae(Z))) return n(W);
700
- if (W.every((Z) => !ae(Z)) || D === "recursive") return l(W);
701
- if (D === "toggle") return n(W);
702
- console.warn(`[DirectoryTree] Unknown double click action: ${D}. No action taken.`);
698
+ (w, U) => {
699
+ const B = [w.absolutePath, ...Me(w)], M = U || m;
700
+ if (B.every((ge) => oe(ge))) return n(B);
701
+ if (B.every((ge) => !oe(ge)) || M === "recursive") return l(B);
702
+ if (M === "toggle") return n(B);
703
+ console.warn(`[DirectoryTree] Unknown double click action: ${M}. No action taken.`);
703
704
  },
704
- [ae, l, n, m]
705
- ), { flatItems: ce, lineItems: ge, maxIndent: ke } = se(() => at(e, ae, s, F), [e, ae, s, F]), ye = se(
706
- () => !s || ge.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : ct(ge, ie, he, s, d ?? Ne),
707
- [ge, s, d]
708
- ), pe = se(() => !s || e.length === 0 ? 0 : (ke + 2) * he, [e.length, ke, s]), { renderStart: we, renderEnd: Se, lookaheadEnd: Re } = se(() => st(ce.length, ee, z, H, q), [ce.length, ee, z, H, q]), De = se(() => !s || pe <= 0 || ee <= 0 || ye.segmentsByItem.length === 0 ? null : /* @__PURE__ */ S.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ S.jsx("div", { className: "absolute top-0 left-0", style: { width: pe, height: ee }, children: /* @__PURE__ */ S.jsx(
705
+ [oe, l, n, m]
706
+ ), { flatItems: ie, lineItems: pe, maxIndent: ke } = ae(() => at(e, oe, s, F), [e, oe, s, F]), he = ae(
707
+ () => !s || pe.length === 0 ? { segmentsByItem: [], glyphsByItem: [] } : ct(pe, le, de, s, d ?? Ne),
708
+ [pe, s, d]
709
+ ), me = ae(() => !s || e.length === 0 ? 0 : (ke + 2) * de, [e.length, ke, s]), { renderStart: we, renderEnd: Se, lookaheadEnd: Re } = ae(() => st(ie.length, Q, J, W, z), [ie.length, Q, J, W, z]), De = ae(() => !s || me <= 0 || Q <= 0 || he.segmentsByItem.length === 0 ? null : /* @__PURE__ */ S.jsx("div", { className: "pointer-events-none absolute inset-0 z-0", "aria-hidden": "true", children: /* @__PURE__ */ S.jsx("div", { className: "absolute top-0 left-0", style: { width: me, height: Q }, children: /* @__PURE__ */ S.jsx(
709
710
  Ce,
710
711
  {
711
- segmentsByItem: ye.segmentsByItem,
712
- glyphsByItem: ye.glyphsByItem,
713
- itemHeight: ie,
714
- width: pe,
715
- viewportHeight: ee,
716
- scrollPosition: q,
712
+ segmentsByItem: he.segmentsByItem,
713
+ glyphsByItem: he.glyphsByItem,
714
+ itemHeight: le,
715
+ width: me,
716
+ viewportHeight: Q,
717
+ scrollPosition: z,
717
718
  color: u,
718
719
  expandGlyphColor: u,
719
720
  expandGlyphSize: d ?? Ne,
@@ -721,37 +722,37 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
721
722
  renderEndIndex: Se,
722
723
  lookaheadEndIndex: Re
723
724
  }
724
- ) }) }), [pe, ee, we, Se, Re, q, ye, u, s, d]), Le = j((k) => ce[k], [ce]);
725
+ ) }) }), [me, Q, we, Se, Re, z, he, u, s, d]), Le = j((w) => ie[w], [ie]);
725
726
  return e.length === 0 ? /* @__PURE__ */ S.jsx("div", { className: Ee, style: Ie }) : /* @__PURE__ */ S.jsx("div", { ref: C, className: Ee, style: Ie, role: "tree", children: /* @__PURE__ */ S.jsx(
726
727
  He,
727
728
  {
728
- ref: G,
729
- itemCount: ce.length,
729
+ ref: V,
730
+ itemCount: ie.length,
730
731
  getItem: Le,
731
732
  getItemHeight: dt,
732
- viewportSize: ee,
733
- overscanCount: z,
733
+ viewportSize: Q,
734
+ overscanCount: J,
734
735
  onScroll: Oe,
735
736
  onRangeChange: Ae,
736
- className: re,
737
+ className: te,
737
738
  background: /* @__PURE__ */ S.jsxs(S.Fragment, { children: [
738
739
  De,
739
- ne
740
+ re
740
741
  ] }),
741
742
  initialScrollIndex: t,
742
743
  initialScrollOffset: f,
743
- onItemFocus: oe,
744
+ onItemFocus: ne,
744
745
  callbackThrottleMs: I,
745
746
  contentInsets: P,
746
747
  scrollBarOptions: T,
747
- behaviorOptions: U,
748
- children: (k) => k && /* @__PURE__ */ S.jsx(
748
+ behaviorOptions: G,
749
+ children: (w) => w && /* @__PURE__ */ S.jsx(
749
750
  xe,
750
751
  {
751
- entry: k.entry,
752
- indentLevel: k.indentLevel,
753
- isDirOpen: ae,
754
- parentIsLast: k.parentIsLast,
752
+ entry: w.entry,
753
+ indentLevel: w.indentLevel,
754
+ isDirOpen: oe,
755
+ parentIsLast: w.parentIsLast,
755
756
  renderChildren: !1,
756
757
  expansion: { toggleDirectory: r, onToggleDirectoryRecursive: $e },
757
758
  selection: { onFileSelect: v, selectedPath: y ?? null, mode: c, selectedItems: b, onSelectionChange: p },
@@ -764,12 +765,12 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
764
765
  expandIconSize: d
765
766
  }
766
767
  },
767
- k.entry.absolutePath
768
+ w.entry.absolutePath
768
769
  )
769
770
  }
770
771
  ) });
771
772
  }, gt = ({ initialExpanded: e = /* @__PURE__ */ new Set(), storageKey: r } = {}) => {
772
- const [o, l] = Be(), [n, a] = te(() => {
773
+ const [o, l] = Be(), [n, a] = ee(() => {
773
774
  if (typeof window < "u" && r)
774
775
  try {
775
776
  const u = window.localStorage.getItem(r);
@@ -797,7 +798,7 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
797
798
  },
798
799
  [i]
799
800
  );
800
- Q(() => {
801
+ q(() => {
801
802
  if (r && typeof window < "u")
802
803
  try {
803
804
  window.localStorage.setItem(r, JSON.stringify(Array.from(n)));
@@ -844,7 +845,7 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
844
845
  i((u) => {
845
846
  u.clear();
846
847
  });
847
- }, [i]), w = j((u) => n.has(u), [n]);
848
+ }, [i]), k = j((u) => n.has(u), [n]);
848
849
  return {
849
850
  expanded: n,
850
851
  toggle: v,
@@ -853,7 +854,7 @@ const ie = 20, dt = () => ie, he = 16, Ne = 12, Me = (e) => {
853
854
  collapseMultiple: b,
854
855
  expandMultiple: p,
855
856
  collapseAll: g,
856
- isExpanded: w,
857
+ isExpanded: k,
857
858
  isPending: o
858
859
  };
859
860
  };