@aiquants/directory-tree 2.0.0 → 2.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/README.md +25 -4
- package/dist/directory-tree.css +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +506 -444
- package/dist/src/DirectoryTree.d.ts +1 -1
- package/dist/src/DirectoryTree.d.ts.map +1 -1
- package/dist/src/types.d.ts +24 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/styles/directory-tree.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,6 +160,14 @@ The main component for rendering the directory tree.
|
|
|
160
160
|
| `expandIconSize` | `number` | No | - | Size of the expand icon |
|
|
161
161
|
| `removeRootIndent` | `boolean` | No | `false` | If true, removes the indentation and connector lines for root-level items |
|
|
162
162
|
| `highlightStyles` | `HighlightStyles` | No | - | Highlight styles configuration for hover and selection states |
|
|
163
|
+
| `entryClassName` | `string` | No | - | Additional CSS classes for each entry row |
|
|
164
|
+
| `entryStyle` | `React.CSSProperties` | No | - | Additional inline styles for each entry row |
|
|
165
|
+
| `nameClassName` | `string` | No | - | Additional CSS classes for the name label |
|
|
166
|
+
| `nameStyle` | `React.CSSProperties` | No | - | Additional inline styles for the name label |
|
|
167
|
+
| `directoryNameClassName` | `string` | No | - | Additional CSS classes specifically for directory names |
|
|
168
|
+
| `directoryNameStyle` | `React.CSSProperties` | No | - | Additional inline styles specifically for directory names |
|
|
169
|
+
| `fileNameClassName` | `string` | No | - | Additional CSS classes specifically for file names |
|
|
170
|
+
| `fileNameStyle` | `React.CSSProperties` | No | - | Additional inline styles specifically for file names |
|
|
163
171
|
|
|
164
172
|
### Virtual Scroll Options
|
|
165
173
|
|
|
@@ -262,21 +270,34 @@ function MyComponent() {
|
|
|
262
270
|
|
|
263
271
|
### Custom Styling
|
|
264
272
|
|
|
265
|
-
You can customize the appearance by
|
|
273
|
+
You can customize the appearance by passing custom classes or inline styles for specific elements like entry rows, name labels, directory names, or file names, avoiding arbitrary CSS selectors overrides:
|
|
266
274
|
|
|
267
275
|
```tsx
|
|
268
276
|
<DirectoryTree
|
|
269
277
|
visual={{
|
|
270
278
|
className: "custom-directory-tree",
|
|
271
|
-
style: { height: '400px' }
|
|
279
|
+
style: { height: '400px' },
|
|
280
|
+
|
|
281
|
+
// Style the entry rows (containers)
|
|
282
|
+
entryClassName: "rounded-md px-2 py-1 hover:bg-slate-100/50",
|
|
283
|
+
entryStyle: { transition: "background-color 0.2s" },
|
|
284
|
+
|
|
285
|
+
// Style the label text
|
|
286
|
+
nameClassName: "text-sm font-medium",
|
|
287
|
+
|
|
288
|
+
// Target directory or file names specifically
|
|
289
|
+
directoryNameClassName: "text-slate-800 dark:text-slate-100",
|
|
290
|
+
fileNameClassName: "text-slate-600 dark:text-slate-300",
|
|
272
291
|
}}
|
|
273
292
|
// ... other props
|
|
274
293
|
/>
|
|
275
294
|
```
|
|
276
295
|
|
|
296
|
+
Alternatively, you can customize components inside the container using global CSS classes:
|
|
297
|
+
|
|
277
298
|
```css
|
|
278
|
-
.custom-directory-tree {
|
|
279
|
-
/*
|
|
299
|
+
.custom-directory-tree .directory-tree-entry {
|
|
300
|
+
/* Custom styles for entry rows */
|
|
280
301
|
}
|
|
281
302
|
```
|
|
282
303
|
|
package/dist/directory-tree.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial}}}@layer theme{:root,:host{--color-amber-100:oklch(96.2% .059 95.617);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-900:oklch(42.1% .095 57.708);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-900:oklch(37.8% .077 168.94);--color-cyan-400:oklch(78.9% .154 211.53);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-800:oklch(39.8% .195 277.366);--color-indigo-900:oklch(35.9% .144 278.697);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--font-weight-medium:500;--font-weight-bold:700;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}@layer base;@layer components{@layer theme,base;@layer components.utilities{.aqvs-scroll-pane{display:flex;position:relative}.aqvs-scroll-pane-content{flex:1;height:100%;position:relative;overflow:hidden}.aqvs-tap-scroll-circle{touch-action:none;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;transition-property:transform;transition-duration:.1s;transition-timing-function:cubic-bezier(0,0,.2,1);display:flex;position:relative}.aqvs-tap-scroll-circle-visual-outer{border-radius:9999px;position:absolute;inset:0}.aqvs-tap-scroll-circle-gradient{background:linear-gradient(to bottom right,#1d4ed899,#60a5fa8c,#bfdbfe66);border-width:1px;border-color:#fff6;border-radius:9999px;position:absolute;inset:0;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-tap-scroll-circle-inner{border-radius:9999px;position:absolute;inset:18%}.aqvs-sample-visual-rod{background-color:#ffffffd9;border-width:1px;border-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-pupil{background-color:#fffc;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-highlight{background-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-scrollbar{z-index:50;cursor:default;-webkit-user-select:none;user-select:none;touch-action:none;background-color:#fff;position:relative}.aqvs-scrollbar-horizontal{flex-direction:row;align-items:stretch;display:flex}.aqvs-scrollbar-vertical{flex-direction:column;align-items:stretch;display:flex}.aqvs-scrollbar-tap-circle-wrapper{pointer-events:auto;transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);position:absolute}.aqvs-scrollbar-arrow-button{color:#313131;background-color:#e0e0e0;justify-content:center;align-items:center;font-size:.75rem;line-height:1rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);display:flex}.aqvs-scrollbar-arrow-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scrollbar-arrow-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scrollbar-arrow-button:disabled{cursor:not-allowed;opacity:.5}.aqvs-scrollbar-arrow-button:enabled:hover{background-color:#d4d4d4}.aqvs-scrollbar-track{background-color:#f5f5f5;flex:1;position:relative}.aqvs-scrollbar-overlay{pointer-events:none;position:absolute;inset:0}.aqvs-scrollbar-thumb-wrapper{touch-action:none;position:absolute}.aqvs-scrollbar-thumb{transform-origin:50%;background-color:#7f7f7f;transition:transform 80ms ease-out;position:absolute}.aqvs-scrollbar-thumb[data-thumb-state=disabled]{transition:none;transform:none}.aqvs-scrollbar-thumb[data-thumb-state=hover]{background-color:#5f5f5f}.aqvs-scrollbar-thumb[data-thumb-state=dragging]{background-color:#4f4f4f;transition:transform 60ms ease-out}.aqvs-scrollbar-thumb-horizontal{inset:1.5px 0}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=hover]{top:-.5px;bottom:-.5px;transform:scaleY(1.06)}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=dragging]{top:-.5px;bottom:-.5px;transform:scaleY(1.12)}.aqvs-scrollbar-thumb-vertical{inset:0 1.5px}.aqvs-scrollbar-thumb-vertical[data-thumb-state=hover]{left:-.5px;right:-.5px;transform:scaleX(1.06)}.aqvs-scrollbar-thumb-vertical[data-thumb-state=dragging]{left:-.5px;right:-.5px;transform:scaleX(1.12)}.aqvs-scroll-to-edge-button{pointer-events:auto;color:#fff;text-transform:uppercase;letter-spacing:.05em;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:#1f2937cc;border-radius:9999px;padding:.25rem 3rem;font-size:10px;font-weight:500;transition-property:transform,background-color;transition-duration:.15s;transform:none;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-scroll-to-edge-button:hover{background-color:#374151}.aqvs-scroll-to-edge-button:active{transform:scale(.95)}.aqvs-scroll-to-edge-overlay{pointer-events:none;z-index:10;transition-property:opacity;transition-duration:.5s;position:absolute;inset:0}.aqvs-scroll-to-edge-overlay[data-visible=true]{opacity:1}.aqvs-scroll-to-edge-overlay[data-visible=false]{opacity:0}.aqvs-scroll-to-edge-button-container{justify-content:center;display:flex;position:absolute;left:0;right:0}.aqvs-scroll-to-edge-button-container-top{top:.5rem}.aqvs-scroll-to-edge-button-container-bottom{bottom:.5rem}.aqvs-no-items-container{width:100%;position:absolute;top:0}.aqvs-no-items-text{text-align:center;color:#6b7280}.aqvs-item-container,.aqvs-bottom-inset,.aqvs-items-wrapper{width:100%;position:absolute}}@layer utilities;}@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.absolute{position:absolute}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.left-0{left:calc(var(--spacing) * 0)}.z-0{z-index:0}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.flex{display:flex}.hidden{display:none}.inline{display:inline}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-96{height:calc(var(--spacing) * 96)}.h-full{height:100%}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-full{width:100%}.flex-shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.overflow-hidden{overflow:hidden}.overflow-y-hidden{overflow-y:hidden}.rounded-lg{border-radius:var(--radius-lg)}.border{border-style:var(--tw-border-style);border-width:1px}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-400\/10{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-400\/10{background-color:color-mix(in oklab,var(--color-blue-400) 10%,transparent)}}.bg-blue-400\/20{background-color:#54a2ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-400\/20{background-color:color-mix(in oklab,var(--color-blue-400) 20%,transparent)}}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-yellow-50{background-color:var(--color-yellow-50)}.pr-\[3px\]{padding-right:3px}.pb-\[5px\]{padding-bottom:5px}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.text-blue-500{color:var(--color-blue-500)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-cyan-400{color:var(--color-cyan-400)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-700{color:var(--color-gray-700)}.text-indigo-800{color:var(--color-indigo-800)}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-600{color:var(--color-yellow-600)}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_1px_rgba\(59\,130\,246\,0\.3\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,#3b82f64d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.hover\:bg-gray-400\/15:hover{background-color:#99a1af26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-400\/15:hover{background-color:color-mix(in oklab,var(--color-gray-400) 15%,transparent)}}}@media(prefers-color-scheme:dark){.dark\:bg-amber-900\/20{background-color:#7b330633}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-900\/20{background-color:color-mix(in oklab,var(--color-amber-900) 20%,transparent)}}.dark\:bg-blue-400\/15{background-color:#54a2ff26}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-400\/15{background-color:color-mix(in oklab,var(--color-blue-400) 15%,transparent)}}.dark\:bg-blue-400\/25{background-color:#54a2ff40}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-400\/25{background-color:color-mix(in oklab,var(--color-blue-400) 25%,transparent)}}.dark\:bg-emerald-900\/20{background-color:#004e3b33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-900\/20{background-color:color-mix(in oklab,var(--color-emerald-900) 20%,transparent)}}.dark\:bg-gray-900{background-color:var(--color-gray-900)}.dark\:bg-indigo-900\/20{background-color:#312c8533}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-900\/20{background-color:color-mix(in oklab,var(--color-indigo-900) 20%,transparent)}}.dark\:bg-yellow-900\/20{background-color:#733e0a33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-yellow-900\/20{background-color:color-mix(in oklab,var(--color-yellow-900) 20%,transparent)}}.dark\:text-blue-300{color:var(--color-blue-300)}.dark\:text-blue-400{color:var(--color-blue-400)}.dark\:text-gray-200{color:var(--color-gray-200)}.dark\:text-gray-400{color:var(--color-gray-400)}.dark\:shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark\:shadow-\[0_0_0_1px_rgba\(96\,165\,250\,0\.4\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,#60a5fa66);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}@media(hover:hover){.dark\:hover\:bg-gray-200\/10:hover{background-color:#e5e7eb1a}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-gray-200\/10:hover{background-color:color-mix(in oklab,var(--color-gray-200) 10%,transparent)}}}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}
|
|
1
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-duration:initial}}}@layer theme{:root,:host{--color-amber-100:oklch(96.2% .059 95.617);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-600:oklch(68.1% .162 75.834);--color-yellow-900:oklch(42.1% .095 57.708);--color-emerald-100:oklch(95% .052 163.051);--color-emerald-900:oklch(37.8% .077 168.94);--color-cyan-400:oklch(78.9% .154 211.53);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-indigo-100:oklch(93% .034 272.788);--color-indigo-800:oklch(39.8% .195 277.366);--color-indigo-900:oklch(35.9% .144 278.697);--color-slate-100:oklch(96.8% .007 247.896);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-800:oklch(27.9% .041 260.031);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--font-weight-bold:700;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}}@layer base;@layer components{@layer theme,base;@layer components.utilities{.aqvs-scroll-pane{display:flex;position:relative}.aqvs-scroll-pane-content{flex:1;height:100%;position:relative;overflow:hidden}.aqvs-tap-scroll-circle{touch-action:none;-webkit-user-select:none;user-select:none;justify-content:center;align-items:center;transition-property:transform;transition-duration:.1s;transition-timing-function:cubic-bezier(0,0,.2,1);display:flex;position:relative}.aqvs-tap-scroll-circle-visual-outer{border-radius:9999px;position:absolute;inset:0}.aqvs-tap-scroll-circle-gradient{background:linear-gradient(to bottom right,#1d4ed899,#60a5fa8c,#bfdbfe66);border-width:1px;border-color:#fff6;border-radius:9999px;position:absolute;inset:0;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-tap-scroll-circle-inner{border-radius:9999px;position:absolute;inset:18%}.aqvs-sample-visual-rod{background-color:#ffffffd9;border-width:1px;border-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-pupil{background-color:#fffc;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-sample-visual-highlight{background-color:#ffffff80;border-radius:9999px;position:absolute;top:50%;left:50%}.aqvs-scrollbar{z-index:50;cursor:default;-webkit-user-select:none;user-select:none;touch-action:none;background-color:#fff;position:relative}.aqvs-scrollbar-horizontal{flex-direction:row;align-items:stretch;display:flex}.aqvs-scrollbar-vertical{flex-direction:column;align-items:stretch;display:flex}.aqvs-scrollbar-tap-circle-wrapper{pointer-events:auto;transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);position:absolute}.aqvs-scrollbar-arrow-button{color:#313131;background-color:#e0e0e0;justify-content:center;align-items:center;font-size:.75rem;line-height:1rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1);display:flex}.aqvs-scrollbar-arrow-button:focus{outline-offset:2px;outline:2px solid #0000}.aqvs-scrollbar-arrow-button:focus-visible{outline-offset:1px;outline:2px solid #60a5fa}.aqvs-scrollbar-arrow-button:disabled{cursor:not-allowed;opacity:.5}.aqvs-scrollbar-arrow-button:enabled:hover{background-color:#d4d4d4}.aqvs-scrollbar-track{background-color:#f5f5f5;flex:1;position:relative}.aqvs-scrollbar-overlay{pointer-events:none;position:absolute;inset:0}.aqvs-scrollbar-thumb-wrapper{touch-action:none;position:absolute}.aqvs-scrollbar-thumb{transform-origin:50%;background-color:#7f7f7f;transition:transform 80ms ease-out;position:absolute}.aqvs-scrollbar-thumb[data-thumb-state=disabled]{transition:none;transform:none}.aqvs-scrollbar-thumb[data-thumb-state=hover]{background-color:#5f5f5f}.aqvs-scrollbar-thumb[data-thumb-state=dragging]{background-color:#4f4f4f;transition:transform 60ms ease-out}.aqvs-scrollbar-thumb-horizontal{inset:1.5px 0}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=hover]{top:-.5px;bottom:-.5px;transform:scaleY(1.06)}.aqvs-scrollbar-thumb-horizontal[data-thumb-state=dragging]{top:-.5px;bottom:-.5px;transform:scaleY(1.12)}.aqvs-scrollbar-thumb-vertical{inset:0 1.5px}.aqvs-scrollbar-thumb-vertical[data-thumb-state=hover]{left:-.5px;right:-.5px;transform:scaleX(1.06)}.aqvs-scrollbar-thumb-vertical[data-thumb-state=dragging]{left:-.5px;right:-.5px;transform:scaleX(1.12)}.aqvs-scroll-to-edge-button{pointer-events:auto;color:#fff;text-transform:uppercase;letter-spacing:.05em;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:#1f2937cc;border-radius:9999px;padding:.25rem 3rem;font-size:10px;font-weight:500;transition-property:transform,background-color;transition-duration:.15s;transform:none;box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.aqvs-scroll-to-edge-button:hover{background-color:#374151}.aqvs-scroll-to-edge-button:active{transform:scale(.95)}.aqvs-scroll-to-edge-overlay{pointer-events:none;z-index:10;transition-property:opacity;transition-duration:.5s;position:absolute;inset:0}.aqvs-scroll-to-edge-overlay[data-visible=true]{opacity:1}.aqvs-scroll-to-edge-overlay[data-visible=false]{opacity:0}.aqvs-scroll-to-edge-button-container{justify-content:center;display:flex;position:absolute;left:0;right:0}.aqvs-scroll-to-edge-button-container-top{top:.5rem}.aqvs-scroll-to-edge-button-container-bottom{bottom:.5rem}.aqvs-no-items-container{width:100%;position:absolute;top:0}.aqvs-no-items-text{text-align:center;color:#6b7280}.aqvs-item-container,.aqvs-bottom-inset,.aqvs-items-wrapper{width:100%;position:absolute}}@layer utilities;}@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.absolute{position:absolute}.relative{position:relative}.static{position:static}.inset-0{inset:calc(var(--spacing) * 0)}.top-0{top:calc(var(--spacing) * 0)}.left-0{left:calc(var(--spacing) * 0)}.z-0{z-index:0}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.flex{display:flex}.hidden{display:none}.inline{display:inline}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-96{height:calc(var(--spacing) * 96)}.h-full{height:100%}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-full{width:100%}.flex-shrink-0{flex-shrink:0}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.overflow-hidden{overflow:hidden}.overflow-y-hidden{overflow-y:hidden}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.bg-amber-100{background-color:var(--color-amber-100)}.bg-blue-400\/10{background-color:#54a2ff1a}@supports (color:color-mix(in lab,red,red)){.bg-blue-400\/10{background-color:color-mix(in oklab,var(--color-blue-400) 10%,transparent)}}.bg-blue-400\/20{background-color:#54a2ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-400\/20{background-color:color-mix(in oklab,var(--color-blue-400) 20%,transparent)}}.bg-emerald-100{background-color:var(--color-emerald-100)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-indigo-100{background-color:var(--color-indigo-100)}.bg-yellow-50{background-color:var(--color-yellow-50)}.px-2{padding-inline:calc(var(--spacing) * 2)}.py-1{padding-block:calc(var(--spacing) * 1)}.pr-\[3px\]{padding-right:3px}.pb-\[5px\]{padding-bottom:5px}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.text-blue-500{color:var(--color-blue-500)}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-cyan-400{color:var(--color-cyan-400)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-700{color:var(--color-gray-700)}.text-indigo-800{color:var(--color-indigo-800)}.text-slate-600{color:var(--color-slate-600)}.text-slate-800{color:var(--color-slate-800)}.text-yellow-400{color:var(--color-yellow-400)}.text-yellow-500{color:var(--color-yellow-500)}.text-yellow-600{color:var(--color-yellow-600)}.opacity-70{opacity:.7}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_1px_rgba\(59\,130\,246\,0\.3\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,#3b82f64d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-300{--tw-duration:.3s;transition-duration:.3s}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.hover\:bg-gray-400\/15:hover{background-color:#99a1af26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-gray-400\/15:hover{background-color:color-mix(in oklab,var(--color-gray-400) 15%,transparent)}}.hover\:bg-slate-100\/50:hover{background-color:#f1f5f980}@supports (color:color-mix(in lab,red,red)){.hover\:bg-slate-100\/50:hover{background-color:color-mix(in oklab,var(--color-slate-100) 50%,transparent)}}}@media(prefers-color-scheme:dark){.dark\:bg-amber-900\/20{background-color:#7b330633}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-900\/20{background-color:color-mix(in oklab,var(--color-amber-900) 20%,transparent)}}.dark\:bg-blue-400\/15{background-color:#54a2ff26}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-400\/15{background-color:color-mix(in oklab,var(--color-blue-400) 15%,transparent)}}.dark\:bg-blue-400\/25{background-color:#54a2ff40}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-400\/25{background-color:color-mix(in oklab,var(--color-blue-400) 25%,transparent)}}.dark\:bg-emerald-900\/20{background-color:#004e3b33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-emerald-900\/20{background-color:color-mix(in oklab,var(--color-emerald-900) 20%,transparent)}}.dark\:bg-gray-900{background-color:var(--color-gray-900)}.dark\:bg-indigo-900\/20{background-color:#312c8533}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-900\/20{background-color:color-mix(in oklab,var(--color-indigo-900) 20%,transparent)}}.dark\:bg-yellow-900\/20{background-color:#733e0a33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-yellow-900\/20{background-color:color-mix(in oklab,var(--color-yellow-900) 20%,transparent)}}.dark\:text-blue-300{color:var(--color-blue-300)}.dark\:text-blue-400{color:var(--color-blue-400)}.dark\:text-gray-200{color:var(--color-gray-200)}.dark\:text-gray-400{color:var(--color-gray-400)}.dark\:text-slate-100{color:var(--color-slate-100)}.dark\:text-slate-300{color:var(--color-slate-300)}.dark\:shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.dark\:shadow-\[0_0_0_1px_rgba\(96\,165\,250\,0\.4\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,#60a5fa66);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}@media(hover:hover){.dark\:hover\:bg-gray-200\/10:hover{background-color:#e5e7eb1a}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-gray-200\/10:hover{background-color:color-mix(in oklab,var(--color-gray-200) 10%,transparent)}}}}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-duration{syntax:"*";inherits:false}
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react")
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),Xe=require("@aiquants/virtualscroll"),pe=require("@heroicons/react/24/solid"),Ve=require("@phosphor-icons/react"),$=require("tailwind-merge");var ye={exports:{}},ce={};var Te;function qe(){if(Te)return ce;Te=1;var e=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function a(l,n,s){var i=null;if(s!==void 0&&(i=""+s),n.key!==void 0&&(i=""+n.key),"key"in n){s={};for(var y in n)y!=="key"&&(s[y]=n[y])}else s=n;return n=s.ref,{$$typeof:e,type:l,key:i,ref:n!==void 0?n:null,props:s}}return ce.Fragment=r,ce.jsx=a,ce.jsxs=a,ce}var ue={};var Ne;function Je(){return Ne||(Ne=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===D?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case o:return"Fragment";case k:return"Profiler";case h:return"StrictMode";case F:return"Suspense";case V:return"SuspenseList";case U:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case u:return"Portal";case w:return t.displayName||"Context";case N:return(t._context.displayName||"Context")+".Consumer";case f:var m=t.render;return t=t.displayName,t||(t=m.displayName||m.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Y:return m=t.displayName||null,m!==null?m:e(t.type)||"Memo";case B:m=t._payload,t=t._init;try{return e(t(m))}catch{}}return null}function r(t){return""+t}function a(t){try{r(t);var m=!1}catch{m=!0}if(m){m=console;var x=m.error,R=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return x.call(m,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",R),r(t)}}function l(t){if(t===o)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===B)return"<...>";try{var m=e(t);return m?"<"+m+">":"<...>"}catch{return"<...>"}}function n(){var t=H.A;return t===null?null:t.getOwner()}function s(){return Error("react-stack-top-frame")}function i(t){if(Z.call(t,"key")){var m=Object.getOwnPropertyDescriptor(t,"key").get;if(m&&m.isReactWarning)return!1}return t.key!==void 0}function y(t,m){function x(){E||(E=!0,console.error("%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)",m))}x.isReactWarning=!0,Object.defineProperty(t,"key",{get:x,configurable:!0})}function S(){var t=e(this.type);return j[t]||(j[t]=!0,console.error("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.")),t=this.props.ref,t!==void 0?t:null}function p(t,m,x,R,G,K){var _=x.ref;return t={$$typeof:I,type:t,key:m,props:x,_owner:R},(_!==void 0?_:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:S}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:G}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function c(t,m,x,R,G,K){var _=m.children;if(_!==void 0)if(R)if(q(_)){for(R=0;R<_.length;R++)v(_[R]);Object.freeze&&Object.freeze(_)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else v(_);if(Z.call(m,"key")){_=e(t);var W=Object.keys(m).filter(function(le){return le!=="key"});R=0<W.length?"{key: someKey, "+W.join(": ..., ")+": ...}":"{key: someKey}",ne[_+R]||(W=0<W.length?"{"+W.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,I,E,V,E),q[E+I]=!0)}if(E=null,b!==void 0&&(s(b),E=""+b),c(y)&&(s(y.key),E=""+y.key),"key"in y){b={};for(var se in y)se!=="key"&&(b[se]=y[se])}else b=y;return E&&h(b,typeof t=="function"?t.displayName||t.name||"Unknown":t),p(t,E,b,n(),K,ne)}function v(t){g(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===M&&(t._payload.status==="fulfilled"?g(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function g(t){return typeof t=="object"&&t!==null&&t.$$typeof===T}var x=d,T=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),S=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),N=Symbol.for("react.client.reference"),H=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W=Object.prototype.hasOwnProperty,D=Array.isArray,B=console.createTask?console.createTask:function(){return null};x={react_stack_bottom_frame:function(t){return t()}};var U,X={},Z=x.react_stack_bottom_frame.bind(x,a)(),Q=B(l(a)),q={};le.Fragment=o,le.jsx=function(t,y,b){var I=1e4>H.recentlyCreatedOwnerStacks++;return i(t,y,b,!1,I?Error("react-stack-top-frame"):Z,I?B(l(t)):Q)},le.jsxs=function(t,y,b){var I=1e4>H.recentlyCreatedOwnerStacks++;return i(t,y,b,!0,I?Error("react-stack-top-frame"):Z,I?B(l(t)):Q)}})()),le}var _e;function Ye(){return _e||(_e=1,process.env.NODE_ENV==="production"?de.exports=Le():de.exports=Fe()),de.exports}var P=Ye();const Be=(e,r,s)=>{const l=[];for(let n=r;n<s;n++){const a=e[n];if(!(!a||a.length===0))for(const c of a)l.push(c)}return l},He=(e,r,s)=>{const l=[];for(let n=r;n<s;n++){const a=e[n];if(!(!a||a.length===0))for(const c of a)l.push(c)}return l},We=(e,r,s,l)=>{const n=Math.max(1,Math.floor(r*l)),a=Math.max(1,Math.floor(s*l));(e.width!==n||e.height!==a)&&(e.width=n,e.height=a);const c=e.style;c.width!==`${r}px`&&(c.width=`${r}px`),c.height!==`${s}px`&&(c.height=`${s}px`)},Xe=(e,r,s)=>{e.lineWidth=s,e.beginPath();for(const l of r)e.moveTo(l.x1,l.y1),e.lineTo(l.x2,l.y2);e.stroke()},Ve=(e,r)=>{const s=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!s)return null;let l=s[1];l.length===3&&(l=l.split("").map(h=>h+h).join(""));const n=Number.parseInt(l.slice(0,2),16),a=Number.parseInt(l.slice(2,4),16),c=Number.parseInt(l.slice(4,6),16);return`rgba(${n}, ${a}, ${c}, ${r})`},qe=(e,r,s,l)=>{if(r.length===0)return;const n=Ve(s,.14),a=e.strokeStyle,c=e.fillStyle,h=e.lineWidth,w=e.lineCap,p=e.lineJoin;e.strokeStyle=s,e.lineCap="round",e.lineJoin="round";for(const i of r){const v=l??i.size,g=Math.max(0,v/2),x=Math.max(1,Math.round(v*.08)),T=Math.max(1,Math.round(v*.14)),u=Math.max(0,g-x*.8),o=Math.max(0,u*.55);n&&(e.fillStyle=n,e.beginPath(),e.arc(i.centerX,i.centerY,u,0,Math.PI*2),e.fill()),e.lineWidth=x,e.beginPath(),e.arc(i.centerX,i.centerY,Math.max(0,g-x*.3),0,Math.PI*2),e.stroke(),e.lineWidth=T,e.beginPath(),e.moveTo(i.centerX-o,i.centerY),e.lineTo(i.centerX+o,i.centerY),e.stroke(),i.isExpanded||(e.beginPath(),e.moveTo(i.centerX,i.centerY-o),e.lineTo(i.centerX,i.centerY+o),e.stroke())}e.strokeStyle=a,e.fillStyle=c,e.lineWidth=h,e.lineCap=w,e.lineJoin=p},Ce=d.memo(({segmentsByItem:e,glyphsByItem:r,itemHeight:s,width:l,viewportHeight:n,scrollPosition:a,color:c="#a0aec0",strokeWidth:h=1,renderStartIndex:w,renderEndIndex:p,lookaheadEndIndex:i,devicePixelRatio:v,expandGlyphColor:g,expandGlyphSize:x})=>{const T=d.useRef(null),u=d.useRef(null),o=d.useRef({segmentsByItem:e,glyphsByItem:r,itemHeight:s,width:l,viewportHeight:n,scrollPosition:a,color:c,strokeWidth:h,renderStartIndex:w,renderEndIndex:p,lookaheadEndIndex:i,devicePixelRatio:v,expandGlyphColor:g,expandGlyphSize:x}),m=d.useCallback(()=>{u.current=null;const _=T.current;if(!_)return;const S=_.getContext("2d");if(!S)return;const f=o.current;if(f.width<=0||f.viewportHeight<=0){S.clearRect(0,0,_.width,_.height);return}const L=Number.isFinite(f.devicePixelRatio??NaN)?f.devicePixelRatio:typeof window<"u"&&window.devicePixelRatio||1;We(_,f.width,f.viewportHeight,L);const Y=f.segmentsByItem.length,k=typeof f.renderStartIndex=="number"&&Number.isFinite(f.renderStartIndex)?Math.max(0,Math.floor(f.renderStartIndex)):Math.max(0,Math.floor(f.scrollPosition/f.itemHeight)),M=Math.min(Y,Math.ceil((f.scrollPosition+f.viewportHeight)/f.itemHeight)),j=(()=>{if(typeof f.renderEndIndex=="number"&&Number.isFinite(f.renderEndIndex)){const D=Math.floor(f.renderEndIndex);return Math.max(Math.min(Y,D+1),k)}return Math.max(M,k)})(),N=(()=>{if(typeof f.lookaheadEndIndex=="number"&&Number.isFinite(f.lookaheadEndIndex)){const D=Math.floor(f.lookaheadEndIndex),B=Math.min(Y,D+1);return Math.max(B,j)}return Math.max(M,j)})(),H=Be(f.segmentsByItem,k,N),W=He(f.glyphsByItem,k,N);S.save(),S.scale(L,L),S.clearRect(0,0,f.width,f.viewportHeight),S.translate(0,-f.scrollPosition),S.strokeStyle=f.color,Xe(S,H,f.strokeWidth),qe(S,W,f.expandGlyphColor??f.color,f.expandGlyphSize),S.restore()},[]),R=d.useCallback(()=>{u.current===null&&(u.current=window.requestAnimationFrame(m))},[m]);return d.useEffect(()=>{o.current={segmentsByItem:e,glyphsByItem:r,itemHeight:s,width:l,viewportHeight:n,scrollPosition:a,color:c,strokeWidth:h,renderStartIndex:w,renderEndIndex:p,lookaheadEndIndex:i,devicePixelRatio:v,expandGlyphColor:g,expandGlyphSize:x},R()},[e,r,s,l,n,a,c,h,w,p,i,v,g,x,R]),d.useEffect(()=>()=>{u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null)},[]),P.jsx("canvas",{ref:T,className:"pointer-events-none absolute top-0 left-0 z-0"})});Ce.displayName="TreeLineCanvas";const A={container:"directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[5px] pr-[3px]",containerPending:"opacity-70",entry:"directory-tree-entry flex items-center cursor-pointer relative select-none",entryHover:$.twMerge("directory-tree-entry--hover hover:bg-gray-400/15","dark:hover:bg-gray-200/10"),entrySelected:$.twMerge("directory-tree-entry--selected bg-blue-400/10","dark:bg-blue-400/15"),entryItemSelected:$.twMerge("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)]"),expandIcon:$.twMerge("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),expandIconSelected:$.twMerge("directory-tree-expand-icon--selected text-blue-700","dark:text-blue-400"),typeIcon:$.twMerge("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),typeIconSelected:$.twMerge("directory-tree-type-icon--selected text-blue-700","dark:text-blue-400"),name:$.twMerge("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1","text-gray-700","dark:text-gray-200"),nameDirectory:"directory-tree-name--directory",nameSelected:$.twMerge("directory-tree-name--selected text-blue-800 font-medium","dark:text-blue-300")},Je={msOverflowStyle:"none",scrollbarWidth:"none"},Ge=()=>{let e=document.getElementById("directory-tree-webkit-scrollbar-hide");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))},ze=(e,r,s,l)=>{const n=[],a=[];let c=0;const h=(w,p,i)=>{for(let v=0;v<w.length;v++){const g=w[v],x=v===w.length-1,T=[...i,x],u=g.children!==void 0,o=u&&r(g.absolutePath,g.relativePath);let m=p,R=T,_=i;l&&(m=p-1,R=T.slice(1),_=i.slice(1)),n.push({entry:g,indentLevel:m,parentIsLast:R}),s&&(m>c&&(c=m),a.push({id:g.absolutePath,name:g.name,absolutePath:g.absolutePath,indentLevel:m,isLastChild:x,isDirectory:u,isExpanded:o,ancestorIsLast:[..._],hideLines:l&&p===0})),u&&o&&g.children&&h(g.children,p+1,T)}};return h(e,0,[]),{flatItems:n,lineItems:a,maxIndent:c}},Ue=(e,r,s,l,n)=>{const a=l?.renderStart??Math.max(0,Math.floor(n/re)),c=r>0?Math.ceil(r/re)+s:s,h=e>0?Math.min(e-1,a+c):a,w=l?.renderEnd??h,p=e>0?Math.min(e-1,w+s):w;return{renderStart:a,renderEnd:w,lookaheadEnd:p}},Ze=({isDirectory:e,isExpanded:r,showExpandIcons:s,useCanvasExpandIcons:l,expandIconSize:n})=>{const a=n?{width:n,height:n}:void 0,c=n?"":"h-4 w-4";return!(s&&e)||l?P.jsx("span",{className:c,style:a,"aria-hidden":"true"}):r?P.jsx(fe.ChevronDownIcon,{className:c,style:a}):P.jsx(fe.ChevronRightIcon,{className:c,style:a})},Qe=e=>e.slice((e.lastIndexOf(".")-1>>>0)+2).toLowerCase(),Ke=(e,r,s,l,n)=>{if(e.length===0)return{segmentsByItem:[],glyphsByItem:[]};const a=Array.from({length:e.length},()=>[]),c=Array.from({length:e.length},()=>[]),h=l?typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(8,Math.min(s*.9,r*.7)):0,w=3;for(let p=0;p<e.length;p++){const i=e[p];if(i.hideLines)continue;const v=[],g=p*r,x=g+r/2,T=h>0?h/2+2:s/1.5;for(let m=0;m<i.indentLevel;m++){if(i.ancestorIsLast[m]??!1)continue;let _=!1;for(let S=p;S<e.length;S++){const f=e[S];if(f.indentLevel>m&&f.ancestorIsLast.length>m&&!f.ancestorIsLast[m]){_=!0;break}if(S>p&&f.indentLevel===m)break}if(_){const S=m*s+s/2+w;v.push({key:`${i.id}-ancestor-${m}`,x1:S,y1:g,x2:S,y2:g+r,itemIndex:p})}}const u=i.indentLevel*s,o=u+s/2+w;if(i.isDirectory?v.push({key:`${i.id}-connector-top`,x1:o,y1:g,x2:o,y2:x-T,itemIndex:p}):v.push({key:`${i.id}-connector-top`,x1:o,y1:g,x2:o,y2:x,itemIndex:p}),!i.isDirectory&&i.isLastChild&&v.push({key:`${i.id}-connector-horizontal`,x1:o,y1:x,x2:u+s+w,y2:x,itemIndex:p}),i.isLastChild||(i.isDirectory?v.push({key:`${i.id}-connector-bottom`,x1:o,y1:x+T,x2:o,y2:g+r,itemIndex:p}):v.push({key:`${i.id}-connector-bottom`,x1:o,y1:x,x2:o,y2:g+r,itemIndex:p})),a[p]=v,l&&i.isDirectory){const m=h,R=o,_=x;c[p]=[{key:`${i.id}-glyph`,itemIndex:p,centerX:R,centerY:_,size:m,isExpanded:i.isExpanded}]}}return{segmentsByItem:a,glyphsByItem:c}},pe=(e,r)=>{if(e==null||typeof e=="boolean")return null;if(typeof e=="function")return console.warn(`[DirectoryTree] Function returned by renderer for "${r}". Return a node.`),null;if(typeof e=="object"){if("then"in e)return console.warn(`[DirectoryTree] Promise returned for "${r}". Not supported.`),null;if(Array.isArray(e)){const l=e.map(n=>pe(n,r)).filter(Boolean);return l.length?l:null}const s=e.type;if(s&&s.$$typeof===Symbol.for("react.lazy"))return console.warn(`[DirectoryTree] Lazy component for "${r}". Not supported.`),null}return e},et=(e,r)=>{const{entry:s,isDirectory:l,isExpanded:n,extension:a}=e;let c;return s.icon!==void 0?c=s.icon:l?c=n&&r?.directoryExpanded||r?.directory||P.jsx(fe.FolderIcon,{className:"h-4 w-4"}):a&&r?.fileByExtension?.[a]?c=r.fileByExtension[a]:c=r?.file||(a==="md"?P.jsx(fe.DocumentTextIcon,{className:"h-4 w-4"}):P.jsx(De.FileIcon,{className:"h-4 w-4"})),pe(typeof c=="function"?c(e):c,s.absolutePath)},be=d.memo(({entry:e,indentLevel:r,isDirOpen:s,parentIsLast:l,renderChildren:n=!0,expansion:{toggleDirectory:a,onToggleDirectoryRecursive:c},selection:{onEntryClick:h,selectedPath:w,mode:p="none",selectedItems:i,onSelectionChange:v},visual:{iconOverrides:g,showExpandIcons:x=!0,showDirectoryIcons:T=!0,showFileIcons:u=!0,useCanvasExpandIcons:o=!1,expandIconSize:m,highlightStyles:R}})=>{const _=d.useRef(null),[S,f]=d.useState(null),[L,Y]=d.useState(!1);d.useEffect(()=>()=>{_.current&&window.clearTimeout(_.current)},[]);const k=e.children!==void 0,M=k&&s(e.absolutePath),j=e.absolutePath===w,N=!k&&i?.has(e.absolutePath),H=k?void 0:Qe(e.name);d.useEffect(()=>{f(M&&e.children?e.children:null)},[M,e.children]);const W=d.useCallback(b=>{b.stopPropagation(),p!=="none"&&!k&&v&&v(e,!N);let I=!1;h({entry:e,isDirectory:k,isExpanded:M,preventDefault:()=>{I=!0}}),!(!k||I)&&(_.current?(window.clearTimeout(_.current),_.current=null,c(e)):_.current=window.setTimeout(()=>{a(e.absolutePath),_.current=null},500))},[k,e,M,c,a,h,p,v,N]),D=L?R?.hoverClassName!==void 0?R.hoverClassName:A.entryHover:"",B=(()=>{if(k){if(j)return R?.directorySelectedClassName!==void 0?R.directorySelectedClassName:A.entrySelected}else if(j||N)return R?.itemSelectedClassName!==void 0?R.itemSelectedClassName:$.twMerge(j&&A.entrySelected,N&&A.entryItemSelected);return""})(),U=$.twMerge(A.entry,D,B,e.className),X=$.twMerge(A.expandIcon,(j||N)&&A.expandIconSelected),Z=$.twMerge(A.typeIcon,(j||N)&&A.typeIconSelected),Q=$.twMerge(A.name,k&&A.nameDirectory,(j||N)&&A.nameSelected),q=Ze({isDirectory:k,isExpanded:M,showExpandIcons:x,useCanvasExpandIcons:o,expandIconSize:m}),t=(k?T:u)?et({entry:e,isDirectory:k,isExpanded:M,isSelected:j,isItemSelected:!!N,extension:H},g):null,y={...L?R?.hoverStyle:{},...k&&j?R?.directorySelectedStyle:{},...!k&&(j||N)?R?.itemSelectedStyle:{}};return P.jsxs(d.Fragment,{children:[P.jsxs("div",{className:U,style:{paddingLeft:`${Math.max(0,r*ce)}px`,transform:r<0?`translateX(${r*ce}px)`:void 0,width:r<0?`calc(100% + ${Math.abs(r*ce)}px)`:void 0,height:`${re}px`,...y,...e.style},"data-entry-type":k?"directory":"file","data-entry-expanded":k?String(M):void 0,"data-entry-selected":j?"true":void 0,"data-entry-item-selected":N?"true":void 0,onClick:W,onMouseEnter:()=>Y(!0),onMouseLeave:()=>Y(!1),onKeyDown:b=>b.key==="Enter"&&W(b),tabIndex:0,role:"treeitem","aria-expanded":k?M:void 0,"aria-label":`${e.name} (${k?"directory":"file"})`,children:[(x||o)&&P.jsx("span",{className:X,children:q}),(k?T:u)&&P.jsx("span",{className:Z,children:t}),P.jsx("span",{className:Q,"data-entry-type":k?"directory":"file","data-entry-role":"name",children:e.label??e.name})]}),M&&S&&n&&P.jsx("fieldset",{children:S.map((b,I)=>P.jsx(be,{entry:b,indentLevel:r+1,isDirOpen:s,parentIsLast:[...l,I===S.length-1],expansion:{toggleDirectory:a,onToggleDirectoryRecursive:c},selection:{onEntryClick:h,selectedPath:w,mode:p,selectedItems:i,onSelectionChange:v},visual:{iconOverrides:g,showExpandIcons:x,showDirectoryIcons:T,showFileIcons:u,useCanvasExpandIcons:o,expandIconSize:m,highlightStyles:R}},b.absolutePath))})]},e.absolutePath)},(e,r)=>{if(e.entry!==r.entry)return!1;const s=e.entry.children!==void 0,l=r.entry.children!==void 0,n=s&&e.isDirOpen(e.entry.absolutePath),a=l&&r.isDirOpen(r.entry.absolutePath);return e.indentLevel===r.indentLevel&&n===a&&e.selection.selectedPath===r.selection.selectedPath&&e.selection.mode===r.selection.mode&&e.selection.selectedItems===r.selection.selectedItems&&e.visual.iconOverrides===r.visual.iconOverrides&&e.visual.showExpandIcons===r.visual.showExpandIcons&&e.visual.showDirectoryIcons===r.visual.showDirectoryIcons&&e.visual.showFileIcons===r.visual.showFileIcons&&e.visual.useCanvasExpandIcons===r.visual.useCanvasExpandIcons&&e.visual.expandIconSize===r.visual.expandIconSize&&e.visual.highlightStyles===r.visual.highlightStyles&&e.parentIsLast.length===r.parentIsLast.length&&e.parentIsLast.every((c,h)=>c===r.parentIsLast[h])});be.displayName="DirectoryEntryItem";const re=20,tt=()=>re,ce=16,Te=12,Pe=e=>{const r=[];if(e.children)for(const s of e.children)s.type==="directory"&&(r.push(s.absolutePath),r.push(...Pe(s)));return r},rt=({entries:e,expansion:{toggle:r,isExpanded:s,expandMultiple:l,collapseMultiple:n,isPending:a,alwaysExpanded:c=!1,doubleClickAction:h="recursive"},selection:{onEntryClick:w,selectedPath:p,mode:i="none",selectedItems:v,onSelectionChange:g},visual:{className:x,style:T,lineColor:u="#A0AEC0",showTreeLines:o=!0,showExpandIcons:m=!0,showDirectoryIcons:R=!0,showFileIcons:_=!0,iconOverrides:S,expandIconSize:f,removeRootIndent:L=!1,highlightStyles:Y}={},virtualScroll:k})=>{const[M,j]=d.useState(!1),N=d.useRef(null),H=d.useRef(null),[W,D]=d.useState(0),[B,U]=d.useState(null),{overscanCount:X=15,className:Z,background:Q,onScroll:q,onRangeChange:t,initialScrollIndex:y,initialScrollOffset:b,callbackThrottleMs:I=5,contentInsets:K,onItemFocus:ne,viewportHeightOverride:E,scrollBarOptions:V,behaviorOptions:se}=k??{},[ee,ge]=d.useState(typeof b=="number"?b:0),Me=d.useCallback((C,G)=>{ge(C),q?.(C,G)},[q]),Ne=d.useCallback(C=>{const{renderingStartIndex:G,renderingEndIndex:F}=C;U(O=>O&&O.renderStart===G&&O.renderEnd===F?O:{renderStart:G,renderEnd:F}),t?.(C)},[t]);d.useEffect(()=>{typeof b=="number"&&ge(b)},[b]),d.useEffect(()=>{j(!0),Ge()},[]),d.useEffect(()=>{if(typeof E=="number"){D(O=>Math.abs(O-E)>1?E:O);return}const C=N.current;if(!C)return D(0);(()=>{const O=C.clientHeight;D(z=>Math.abs(z-O)>1?O:z)})();const F=new ResizeObserver(O=>{for(const z of O)z.target===C&&D(he=>Math.abs(he-z.contentRect.height)>1?z.contentRect.height:he)});return F.observe(C),()=>F.disconnect()},[E]);const J=typeof E=="number"?E:W,te=d.useCallback(C=>c||(M?s(C):!1),[M,s,c]),ve=$.twMerge(A.container,a&&A.containerPending,x),xe=d.useMemo(()=>({...Je,...T??{},...typeof E=="number"?{height:E,minHeight:E}:{}}),[T,E]),je=d.useCallback((C,G)=>{const F=[C.absolutePath,...Pe(C)],O=G||h;if(F.every(ye=>te(ye)))return n(F);if(F.every(ye=>!te(ye))||O==="recursive")return l(F);if(O==="toggle")return n(F);console.warn(`[DirectoryTree] Unknown double click action: ${O}. No action taken.`)},[te,l,n,h]),{flatItems:ae,lineItems:me,maxIndent:Ee}=d.useMemo(()=>ze(e,te,o,L),[e,te,o,L]),ie=d.useMemo(()=>!o||me.length===0?{segmentsByItem:[],glyphsByItem:[]}:Ke(me,re,ce,o,f??Te),[me,o,f]),ue=d.useMemo(()=>!o||e.length===0?0:(Ee+2)*ce,[e.length,Ee,o]),{renderStart:ke,renderEnd:we,lookaheadEnd:Se}=d.useMemo(()=>Ue(ae.length,J,X,B,ee),[ae.length,J,X,B,ee]),Oe=d.useMemo(()=>!o||ue<=0||J<=0||ie.segmentsByItem.length===0?null:P.jsx("div",{className:"pointer-events-none absolute inset-0 z-0","aria-hidden":"true",children:P.jsx("div",{className:"absolute top-0 left-0",style:{width:ue,height:J},children:P.jsx(Ce,{segmentsByItem:ie.segmentsByItem,glyphsByItem:ie.glyphsByItem,itemHeight:re,width:ue,viewportHeight:J,scrollPosition:ee,color:u,expandGlyphColor:u,expandGlyphSize:f??Te,renderStartIndex:ke,renderEndIndex:we,lookaheadEndIndex:Se})})}),[ue,J,ke,we,Se,ee,ie,u,o,f]),Ae=d.useCallback(C=>ae[C],[ae]);return e.length===0?P.jsx("div",{className:ve,style:xe}):P.jsx("div",{ref:N,className:ve,style:xe,role:"tree",children:P.jsx($e.VirtualScroll,{ref:H,itemCount:ae.length,getItem:Ae,getItemHeight:tt,viewportSize:J,overscanCount:X,onScroll:Me,onRangeChange:Ne,className:Z,background:P.jsxs(P.Fragment,{children:[Oe,Q]}),initialScrollIndex:y,initialScrollOffset:b,onItemFocus:ne,callbackThrottleMs:I,contentInsets:K,scrollBarOptions:V,behaviorOptions:se,children:C=>C&&P.jsx(be,{entry:C.entry,indentLevel:C.indentLevel,isDirOpen:te,parentIsLast:C.parentIsLast,renderChildren:!1,expansion:{toggleDirectory:r,onToggleDirectoryRecursive:je},selection:{onEntryClick:w,selectedPath:p??null,mode:i,selectedItems:v,onSelectionChange:g},visual:{iconOverrides:S,showExpandIcons:m,showDirectoryIcons:R,showFileIcons:_,useCanvasExpandIcons:o,expandIconSize:f,highlightStyles:Y}},C.entry.absolutePath)})})},nt=({initialExpanded:e=new Set,storageKey:r}={})=>{const[s,l]=d.useTransition(),[n,a]=d.useState(()=>{if(typeof window<"u"&&r)try{const u=window.localStorage.getItem(r);if(u){const o=JSON.parse(u);return new Set(o)}}catch(u){console.error("[useDirectoryTreeState] Error reading from localStorage",u)}return e}),c=d.useCallback(u=>{l(()=>{a(o=>{const m=new Set(o);return u(m),m})})},[]),h=d.useCallback((u,o)=>{c(m=>{for(const R of u)o(m,R)})},[c]);d.useEffect(()=>{if(r&&typeof window<"u")try{window.localStorage.setItem(r,JSON.stringify(Array.from(n)))}catch(u){console.warn(`Error setting localStorage key "${r}":`,u)}},[n,r]);const w=d.useCallback(u=>{h([u],(o,m)=>{o.has(m)?o.delete(m):o.add(m)})},[h]),p=d.useCallback(u=>{h([u],(o,m)=>{o.add(m)})},[h]),i=d.useCallback(u=>{h([u],(o,m)=>{o.delete(m)})},[h]),v=d.useCallback(u=>{h(u,(o,m)=>{o.delete(m)})},[h]),g=d.useCallback(u=>{h(u,(o,m)=>{o.add(m)})},[h]),x=d.useCallback(()=>{c(u=>{u.clear()})},[c]),T=d.useCallback(u=>n.has(u),[n]);return{expanded:n,toggle:w,expand:p,collapse:i,collapseMultiple:v,expandMultiple:g,collapseAll:x,isExpanded:T,isPending:s}};exports.DirectoryTree=rt;exports.directoryTreeClasses=A;exports.useDirectoryTreeState=nt;
|
|
6
|
+
<%s key={someKey} {...props} />`,R,_,W,_),ne[_+R]=!0)}if(_=null,x!==void 0&&(a(x),_=""+x),i(m)&&(a(m.key),_=""+m.key),"key"in m){x={};for(var Q in m)Q!=="key"&&(x[Q]=m[Q])}else x=m;return _&&y(x,typeof t=="function"?t.displayName||t.name||"Unknown":t),p(t,_,x,n(),G,K)}function v(t){b(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===B&&(t._payload.status==="fulfilled"?b(t._payload.value)&&t._payload.value._store&&(t._payload.value._store.validated=1):t._store&&(t._store.validated=1))}function b(t){return typeof t=="object"&&t!==null&&t.$$typeof===I}var g=d,I=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),w=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),V=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),B=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),D=Symbol.for("react.client.reference"),H=g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z=Object.prototype.hasOwnProperty,q=Array.isArray,J=console.createTask?console.createTask:function(){return null};g={react_stack_bottom_frame:function(t){return t()}};var E,j={},O=g.react_stack_bottom_frame.bind(g,s)(),P=J(l(s)),ne={};ue.Fragment=o,ue.jsx=function(t,m,x){var R=1e4>H.recentlyCreatedOwnerStacks++;return c(t,m,x,!1,R?Error("react-stack-top-frame"):O,R?J(l(t)):P)},ue.jsxs=function(t,m,x){var R=1e4>H.recentlyCreatedOwnerStacks++;return c(t,m,x,!0,R?Error("react-stack-top-frame"):O,R?J(l(t)):P)}})()),ue}var Pe;function Ge(){return Pe||(Pe=1,process.env.NODE_ENV==="production"?ye.exports=qe():ye.exports=Je()),ye.exports}var T=Ge();const ze=(e,r,a)=>{const l=[];for(let n=r;n<a;n++){const s=e[n];if(!(!s||s.length===0))for(const i of s)l.push(i)}return l},Ue=(e,r,a)=>{const l=[];for(let n=r;n<a;n++){const s=e[n];if(!(!s||s.length===0))for(const i of s)l.push(i)}return l},Ze=(e,r,a,l)=>{const n=Math.max(1,Math.floor(r*l)),s=Math.max(1,Math.floor(a*l));(e.width!==n||e.height!==s)&&(e.width=n,e.height=s);const i=e.style;i.width!==`${r}px`&&(i.width=`${r}px`),i.height!==`${a}px`&&(i.height=`${a}px`)},Qe=(e,r,a)=>{e.lineWidth=a,e.beginPath();for(const l of r)e.moveTo(l.x1,l.y1),e.lineTo(l.x2,l.y2);e.stroke()},Ke=(e,r)=>{const a=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!a)return null;let l=a[1];l.length===3&&(l=l.split("").map(y=>y+y).join(""));const n=Number.parseInt(l.slice(0,2),16),s=Number.parseInt(l.slice(2,4),16),i=Number.parseInt(l.slice(4,6),16);return`rgba(${n}, ${s}, ${i}, ${r})`},et=(e,r,a,l)=>{if(r.length===0)return;const n=Ke(a,.14),s=e.strokeStyle,i=e.fillStyle,y=e.lineWidth,S=e.lineCap,p=e.lineJoin;e.strokeStyle=a,e.lineCap="round",e.lineJoin="round";for(const c of r){const v=l??c.size,b=Math.max(0,v/2),g=Math.max(1,Math.round(v*.08)),I=Math.max(1,Math.round(v*.14)),u=Math.max(0,b-g*.8),o=Math.max(0,u*.55);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,b-g*.3),0,Math.PI*2),e.stroke(),e.lineWidth=I,e.beginPath(),e.moveTo(c.centerX-o,c.centerY),e.lineTo(c.centerX+o,c.centerY),e.stroke(),c.isExpanded||(e.beginPath(),e.moveTo(c.centerX,c.centerY-o),e.lineTo(c.centerX,c.centerY+o),e.stroke())}e.strokeStyle=s,e.fillStyle=i,e.lineWidth=y,e.lineCap=S,e.lineJoin=p},je=d.memo(({segmentsByItem:e,glyphsByItem:r,itemHeight:a,width:l,viewportHeight:n,scrollPosition:s,color:i="#a0aec0",strokeWidth:y=1,renderStartIndex:S,renderEndIndex:p,lookaheadEndIndex:c,devicePixelRatio:v,expandGlyphColor:b,expandGlyphSize:g})=>{const I=d.useRef(null),u=d.useRef(null),o=d.useRef({segmentsByItem:e,glyphsByItem:r,itemHeight:a,width:l,viewportHeight:n,scrollPosition:s,color:i,strokeWidth:y,renderStartIndex:S,renderEndIndex:p,lookaheadEndIndex:c,devicePixelRatio:v,expandGlyphColor:b,expandGlyphSize:g}),h=d.useCallback(()=>{u.current=null;const N=I.current;if(!N)return;const w=N.getContext("2d");if(!w)return;const f=o.current;if(f.width<=0||f.viewportHeight<=0){w.clearRect(0,0,N.width,N.height);return}const F=Number.isFinite(f.devicePixelRatio??NaN)?f.devicePixelRatio:typeof window<"u"&&window.devicePixelRatio||1;Ze(N,f.width,f.viewportHeight,F);const V=f.segmentsByItem.length,Y=typeof f.renderStartIndex=="number"&&Number.isFinite(f.renderStartIndex)?Math.max(0,Math.floor(f.renderStartIndex)):Math.max(0,Math.floor(f.scrollPosition/f.itemHeight)),B=Math.min(V,Math.ceil((f.scrollPosition+f.viewportHeight)/f.itemHeight)),U=(()=>{if(typeof f.renderEndIndex=="number"&&Number.isFinite(f.renderEndIndex)){const q=Math.floor(f.renderEndIndex);return Math.max(Math.min(V,q+1),Y)}return Math.max(B,Y)})(),D=(()=>{if(typeof f.lookaheadEndIndex=="number"&&Number.isFinite(f.lookaheadEndIndex)){const q=Math.floor(f.lookaheadEndIndex),J=Math.min(V,q+1);return Math.max(J,U)}return Math.max(B,U)})(),H=ze(f.segmentsByItem,Y,D),Z=Ue(f.glyphsByItem,Y,D);w.save(),w.scale(F,F),w.clearRect(0,0,f.width,f.viewportHeight),w.translate(0,-f.scrollPosition),w.strokeStyle=f.color,Qe(w,H,f.strokeWidth),et(w,Z,f.expandGlyphColor??f.color,f.expandGlyphSize),w.restore()},[]),k=d.useCallback(()=>{u.current===null&&(u.current=window.requestAnimationFrame(h))},[h]);return d.useEffect(()=>{o.current={segmentsByItem:e,glyphsByItem:r,itemHeight:a,width:l,viewportHeight:n,scrollPosition:s,color:i,strokeWidth:y,renderStartIndex:S,renderEndIndex:p,lookaheadEndIndex:c,devicePixelRatio:v,expandGlyphColor:b,expandGlyphSize:g},k()},[e,r,a,l,n,s,i,y,S,p,c,v,b,g,k]),d.useEffect(()=>()=>{u.current!==null&&(window.cancelAnimationFrame(u.current),u.current=null)},[]),T.jsx("canvas",{ref:I,className:"pointer-events-none absolute top-0 left-0 z-0"})});je.displayName="TreeLineCanvas";const A={container:"directory-tree-container relative h-full transition-opacity duration-300 overflow-y-hidden pb-[5px] pr-[3px]",containerPending:"opacity-70",entry:"directory-tree-entry flex items-center cursor-pointer relative select-none",entryHover:$.twMerge("directory-tree-entry--hover hover:bg-gray-400/15","dark:hover:bg-gray-200/10"),entrySelected:$.twMerge("directory-tree-entry--selected bg-blue-400/10","dark:bg-blue-400/15"),entryItemSelected:$.twMerge("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)]"),expandIcon:$.twMerge("directory-tree-expand-icon w-5 h-5 flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),expandIconSelected:$.twMerge("directory-tree-expand-icon--selected text-blue-700","dark:text-blue-400"),typeIcon:$.twMerge("directory-tree-type-icon w-5 h-5 flex-shrink-0 flex items-center justify-center","text-gray-500","dark:text-gray-400"),typeIconSelected:$.twMerge("directory-tree-type-icon--selected text-blue-700","dark:text-blue-400"),name:$.twMerge("directory-tree-name overflow-hidden text-ellipsis whitespace-nowrap ml-1","text-gray-700","dark:text-gray-200"),nameDirectory:"directory-tree-name--directory",nameSelected:$.twMerge("directory-tree-name--selected text-blue-800 font-medium","dark:text-blue-300")},tt={msOverflowStyle:"none",scrollbarWidth:"none"},rt=()=>{let e=document.getElementById("directory-tree-webkit-scrollbar-hide");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))},nt=(e,r,a,l)=>{const n=[],s=[];let i=0;const y=(S,p,c)=>{for(let v=0;v<S.length;v++){const b=S[v],g=v===S.length-1,I=[...c,g],u=b.children!==void 0,o=u&&r(b.absolutePath,b.relativePath);let h=p,k=I,N=c;l&&(h=p-1,k=I.slice(1),N=c.slice(1)),n.push({entry:b,indentLevel:h,parentIsLast:k}),a&&(h>i&&(i=h),s.push({id:b.absolutePath,name:b.name,absolutePath:b.absolutePath,indentLevel:h,isLastChild:g,isDirectory:u,isExpanded:o,ancestorIsLast:[...N],hideLines:l&&p===0})),u&&o&&b.children&&y(b.children,p+1,I)}};return y(e,0,[]),{flatItems:n,lineItems:s,maxIndent:i}},at=(e,r,a,l,n)=>{const s=l?.renderStart??Math.max(0,Math.floor(n/oe)),i=r>0?Math.ceil(r/oe)+a:a,y=e>0?Math.min(e-1,s+i):s,S=l?.renderEnd??y,p=e>0?Math.min(e-1,S+a):S;return{renderStart:s,renderEnd:S,lookaheadEnd:p}},st=({isDirectory:e,isExpanded:r,showExpandIcons:a,useCanvasExpandIcons:l,expandIconSize:n})=>{const s=n?{width:n,height:n}:void 0,i=n?"":"h-4 w-4";return!(a&&e)||l?T.jsx("span",{className:i,style:s,"aria-hidden":"true"}):r?T.jsx(pe.ChevronDownIcon,{className:i,style:s}):T.jsx(pe.ChevronRightIcon,{className:i,style:s})},ot=e=>e.slice((e.lastIndexOf(".")-1>>>0)+2).toLowerCase(),lt=(e,r,a,l,n)=>{if(e.length===0)return{segmentsByItem:[],glyphsByItem:[]};const s=Array.from({length:e.length},()=>[]),i=Array.from({length:e.length},()=>[]),y=l?typeof n=="number"&&Number.isFinite(n)&&n>0?n:Math.max(8,Math.min(a*.9,r*.7)):0,S=3;for(let p=0;p<e.length;p++){const c=e[p];if(c.hideLines)continue;const v=[],b=p*r,g=b+r/2,I=y>0?y/2+2:a/1.5;for(let h=0;h<c.indentLevel;h++){if(c.ancestorIsLast[h]??!1)continue;let N=!1;for(let w=p;w<e.length;w++){const f=e[w];if(f.indentLevel>h&&f.ancestorIsLast.length>h&&!f.ancestorIsLast[h]){N=!0;break}if(w>p&&f.indentLevel===h)break}if(N){const w=h*a+a/2+S;v.push({key:`${c.id}-ancestor-${h}`,x1:w,y1:b,x2:w,y2:b+r,itemIndex:p})}}const u=c.indentLevel*a,o=u+a/2+S;if(c.isDirectory?v.push({key:`${c.id}-connector-top`,x1:o,y1:b,x2:o,y2:g-I,itemIndex:p}):v.push({key:`${c.id}-connector-top`,x1:o,y1:b,x2:o,y2:g,itemIndex:p}),!c.isDirectory&&c.isLastChild&&v.push({key:`${c.id}-connector-horizontal`,x1:o,y1:g,x2:u+a+S,y2:g,itemIndex:p}),c.isLastChild||(c.isDirectory?v.push({key:`${c.id}-connector-bottom`,x1:o,y1:g+I,x2:o,y2:b+r,itemIndex:p}):v.push({key:`${c.id}-connector-bottom`,x1:o,y1:g,x2:o,y2:b+r,itemIndex:p})),s[p]=v,l&&c.isDirectory){const h=y,k=o,N=g;i[p]=[{key:`${c.id}-glyph`,itemIndex:p,centerX:k,centerY:N,size:h,isExpanded:c.isExpanded}]}}return{segmentsByItem:s,glyphsByItem:i}},Ee=(e,r)=>{if(e==null||typeof e=="boolean")return null;if(typeof e=="function")return console.warn(`[DirectoryTree] Function returned by renderer for "${r}". Return a node.`),null;if(typeof e=="object"){if("then"in e)return console.warn(`[DirectoryTree] Promise returned for "${r}". Not supported.`),null;if(Array.isArray(e)){const l=e.map(n=>Ee(n,r)).filter(Boolean);return l.length?l:null}const a=e.type;if(a&&a.$$typeof===Symbol.for("react.lazy"))return console.warn(`[DirectoryTree] Lazy component for "${r}". Not supported.`),null}return e},it=(e,r)=>{const{entry:a,isDirectory:l,isExpanded:n,extension:s}=e;let i;return a.icon!==void 0?i=a.icon:l?i=n&&r?.directoryExpanded||r?.directory||T.jsx(pe.FolderIcon,{className:"h-4 w-4"}):s&&r?.fileByExtension?.[s]?i=r.fileByExtension[s]:i=r?.file||(s==="md"?T.jsx(pe.DocumentTextIcon,{className:"h-4 w-4"}):T.jsx(Ve.FileIcon,{className:"h-4 w-4"})),Ee(typeof i=="function"?i(e):i,a.absolutePath)},xe=d.memo(({entry:e,indentLevel:r,isDirOpen:a,parentIsLast:l,renderChildren:n=!0,expansion:{toggleDirectory:s,onToggleDirectoryRecursive:i},selection:{onEntryClick:y,selectedPath:S,mode:p="none",selectedItems:c,onSelectionChange:v},visual:{iconOverrides:b,showExpandIcons:g=!0,showDirectoryIcons:I=!0,showFileIcons:u=!0,useCanvasExpandIcons:o=!1,expandIconSize:h,highlightStyles:k,entryClassName:N,entryStyle:w,nameClassName:f,nameStyle:F,directoryNameClassName:V,directoryNameStyle:Y,fileNameClassName:B,fileNameStyle:U}})=>{const D=d.useRef(null),[H,Z]=d.useState(null),[q,J]=d.useState(!1);d.useEffect(()=>()=>{D.current&&window.clearTimeout(D.current)},[]);const E=e.children!==void 0,j=E&&a(e.absolutePath),O=e.absolutePath===S,P=!E&&c?.has(e.absolutePath),ne=E?void 0:ot(e.name);d.useEffect(()=>{Z(j&&e.children?e.children:null)},[j,e.children]);const t=d.useCallback(L=>{L.stopPropagation(),p!=="none"&&!E&&v&&v(e,!P);let ae=!1;y({entry:e,isDirectory:E,isExpanded:j,preventDefault:()=>{ae=!0}}),!(!E||ae)&&(D.current?(window.clearTimeout(D.current),D.current=null,i(e)):D.current=window.setTimeout(()=>{s(e.absolutePath),D.current=null},500))},[E,e,j,i,s,y,p,v,P]),m=q?k?.hoverClassName!==void 0?k.hoverClassName:A.entryHover:"",x=(()=>{if(E){if(O)return k?.directorySelectedClassName!==void 0?k.directorySelectedClassName:A.entrySelected}else if(O||P)return k?.itemSelectedClassName!==void 0?k.itemSelectedClassName:$.twMerge(O&&A.entrySelected,P&&A.entryItemSelected);return""})(),R=$.twMerge(A.entry,m,x,N,e.className),G=$.twMerge(A.expandIcon,(O||P)&&A.expandIconSelected),K=$.twMerge(A.typeIcon,(O||P)&&A.typeIconSelected),_=$.twMerge(A.name,f,E&&A.nameDirectory,E&&V,!E&&B,(O||P)&&A.nameSelected),W=st({isDirectory:E,isExpanded:j,showExpandIcons:g,useCanvasExpandIcons:o,expandIconSize:h}),Q=(E?I:u)?it({entry:e,isDirectory:E,isExpanded:j,isSelected:O,isItemSelected:!!P,extension:ne},b):null,le={...q?k?.hoverStyle:{},...E&&O?k?.directorySelectedStyle:{},...!E&&(O||P)?k?.itemSelectedStyle:{}};return T.jsxs(d.Fragment,{children:[T.jsxs("div",{className:R,style:{paddingLeft:`${Math.max(0,r*de)}px`,transform:r<0?`translateX(${r*de}px)`:void 0,width:r<0?`calc(100% + ${Math.abs(r*de)}px)`:void 0,height:`${oe}px`,...le,...w,...e.style},"data-entry-type":E?"directory":"file","data-entry-expanded":E?String(j):void 0,"data-entry-selected":O?"true":void 0,"data-entry-item-selected":P?"true":void 0,onClick:t,onMouseEnter:()=>J(!0),onMouseLeave:()=>J(!1),onKeyDown:L=>L.key==="Enter"&&t(L),tabIndex:0,role:"treeitem","aria-expanded":E?j:void 0,"aria-label":`${e.name} (${E?"directory":"file"})`,children:[(g||o)&&T.jsx("span",{className:G,children:W}),(E?I:u)&&T.jsx("span",{className:K,children:Q}),T.jsx("span",{className:_,style:{...F,...E?Y:U},"data-entry-type":E?"directory":"file","data-entry-role":"name",children:e.label??e.name})]}),j&&H&&n&&T.jsx("fieldset",{children:H.map((L,ae)=>T.jsx(xe,{entry:L,indentLevel:r+1,isDirOpen:a,parentIsLast:[...l,ae===H.length-1],expansion:{toggleDirectory:s,onToggleDirectoryRecursive:i},selection:{onEntryClick:y,selectedPath:S,mode:p,selectedItems:c,onSelectionChange:v},visual:{iconOverrides:b,showExpandIcons:g,showDirectoryIcons:I,showFileIcons:u,useCanvasExpandIcons:o,expandIconSize:h,highlightStyles:k,entryClassName:N,entryStyle:w,nameClassName:f,nameStyle:F,directoryNameClassName:V,directoryNameStyle:Y,fileNameClassName:B,fileNameStyle:U}},L.absolutePath))})]},e.absolutePath)},(e,r)=>{if(e.entry!==r.entry)return!1;const a=e.entry.children!==void 0,l=r.entry.children!==void 0,n=a&&e.isDirOpen(e.entry.absolutePath),s=l&&r.isDirOpen(r.entry.absolutePath);return e.indentLevel===r.indentLevel&&n===s&&e.selection.selectedPath===r.selection.selectedPath&&e.selection.mode===r.selection.mode&&e.selection.selectedItems===r.selection.selectedItems&&e.visual.iconOverrides===r.visual.iconOverrides&&e.visual.showExpandIcons===r.visual.showExpandIcons&&e.visual.showDirectoryIcons===r.visual.showDirectoryIcons&&e.visual.showFileIcons===r.visual.showFileIcons&&e.visual.useCanvasExpandIcons===r.visual.useCanvasExpandIcons&&e.visual.expandIconSize===r.visual.expandIconSize&&e.visual.highlightStyles===r.visual.highlightStyles&&e.visual.entryClassName===r.visual.entryClassName&&e.visual.entryStyle===r.visual.entryStyle&&e.visual.nameClassName===r.visual.nameClassName&&e.visual.nameStyle===r.visual.nameStyle&&e.visual.directoryNameClassName===r.visual.directoryNameClassName&&e.visual.directoryNameStyle===r.visual.directoryNameStyle&&e.visual.fileNameClassName===r.visual.fileNameClassName&&e.visual.fileNameStyle===r.visual.fileNameStyle&&e.parentIsLast.length===r.parentIsLast.length&&e.parentIsLast.every((i,y)=>i===r.parentIsLast[y])});xe.displayName="DirectoryEntryItem";const oe=20,ct=()=>oe,de=16,Me=12,Oe=e=>{const r=[];if(e.children)for(const a of e.children)a.type==="directory"&&(r.push(a.absolutePath),r.push(...Oe(a)));return r},ut=({entries:e,expansion:{toggle:r,isExpanded:a,expandMultiple:l,collapseMultiple:n,isPending:s,alwaysExpanded:i=!1,doubleClickAction:y="recursive"},selection:{onEntryClick:S,selectedPath:p,mode:c="none",selectedItems:v,onSelectionChange:b},visual:{className:g,style:I,lineColor:u="#A0AEC0",showTreeLines:o=!0,showExpandIcons:h=!0,showDirectoryIcons:k=!0,showFileIcons:N=!0,iconOverrides:w,expandIconSize:f,removeRootIndent:F=!1,highlightStyles:V,entryClassName:Y,entryStyle:B,nameClassName:U,nameStyle:D,directoryNameClassName:H,directoryNameStyle:Z,fileNameClassName:q,fileNameStyle:J}={},virtualScroll:E})=>{const[j,O]=d.useState(!1),P=d.useRef(null),ne=d.useRef(null),[t,m]=d.useState(0),[x,R]=d.useState(null),{overscanCount:G=15,className:K,background:_,onScroll:W,onRangeChange:Q,initialScrollIndex:le,initialScrollOffset:L,callbackThrottleMs:ae=5,contentInsets:Ae,onItemFocus:$e,viewportHeightOverride:z,scrollBarOptions:De,behaviorOptions:Le}=E??{},[fe,Se]=d.useState(typeof L=="number"?L:0),Fe=d.useCallback((C,te)=>{Se(C),W?.(C,te)},[W]),Ye=d.useCallback(C=>{const{renderingStartIndex:te,renderingEndIndex:X}=C;R(M=>M&&M.renderStart===te&&M.renderEnd===X?M:{renderStart:te,renderEnd:X}),Q?.(C)},[Q]);d.useEffect(()=>{typeof L=="number"&&Se(L)},[L]),d.useEffect(()=>{O(!0),rt()},[]),d.useEffect(()=>{if(typeof z=="number"){m(M=>Math.abs(M-z)>1?z:M);return}const C=P.current;if(!C)return m(0);(()=>{const M=C.clientHeight;m(re=>Math.abs(re-M)>1?M:re)})();const X=new ResizeObserver(M=>{for(const re of M)re.target===C&&m(ve=>Math.abs(ve-re.contentRect.height)>1?re.contentRect.height:ve)});return X.observe(C),()=>X.disconnect()},[z]);const ee=typeof z=="number"?z:t,se=d.useCallback(C=>i||(j?a(C):!1),[j,a,i]),ke=$.twMerge(A.container,s&&A.containerPending,g),we=d.useMemo(()=>({...tt,...I??{},...typeof z=="number"?{height:z,minHeight:z}:{}}),[I,z]),Be=d.useCallback((C,te)=>{const X=[C.absolutePath,...Oe(C)],M=te||y;if(X.every(ge=>se(ge)))return n(X);if(X.every(ge=>!se(ge))||M==="recursive")return l(X);if(M==="toggle")return n(X);console.warn(`[DirectoryTree] Unknown double click action: ${M}. No action taken.`)},[se,l,n,y]),{flatItems:ie,lineItems:be,maxIndent:Ie}=d.useMemo(()=>nt(e,se,o,F),[e,se,o,F]),me=d.useMemo(()=>!o||be.length===0?{segmentsByItem:[],glyphsByItem:[]}:lt(be,oe,de,o,f??Me),[be,o,f]),he=d.useMemo(()=>!o||e.length===0?0:(Ie+2)*de,[e.length,Ie,o]),{renderStart:Re,renderEnd:_e,lookaheadEnd:Ce}=d.useMemo(()=>at(ie.length,ee,G,x,fe),[ie.length,ee,G,x,fe]),He=d.useMemo(()=>!o||he<=0||ee<=0||me.segmentsByItem.length===0?null:T.jsx("div",{className:"pointer-events-none absolute inset-0 z-0","aria-hidden":"true",children:T.jsx("div",{className:"absolute top-0 left-0",style:{width:he,height:ee},children:T.jsx(je,{segmentsByItem:me.segmentsByItem,glyphsByItem:me.glyphsByItem,itemHeight:oe,width:he,viewportHeight:ee,scrollPosition:fe,color:u,expandGlyphColor:u,expandGlyphSize:f??Me,renderStartIndex:Re,renderEndIndex:_e,lookaheadEndIndex:Ce})})}),[he,ee,Re,_e,Ce,fe,me,u,o,f]),We=d.useCallback(C=>ie[C],[ie]);return e.length===0?T.jsx("div",{className:ke,style:we}):T.jsx("div",{ref:P,className:ke,style:we,role:"tree",children:T.jsx(Xe.VirtualScroll,{ref:ne,itemCount:ie.length,getItem:We,getItemHeight:ct,viewportSize:ee,overscanCount:G,onScroll:Fe,onRangeChange:Ye,className:K,background:T.jsxs(T.Fragment,{children:[He,_]}),initialScrollIndex:le,initialScrollOffset:L,onItemFocus:$e,callbackThrottleMs:ae,contentInsets:Ae,scrollBarOptions:De,behaviorOptions:Le,children:C=>C&&T.jsx(xe,{entry:C.entry,indentLevel:C.indentLevel,isDirOpen:se,parentIsLast:C.parentIsLast,renderChildren:!1,expansion:{toggleDirectory:r,onToggleDirectoryRecursive:Be},selection:{onEntryClick:S,selectedPath:p??null,mode:c,selectedItems:v,onSelectionChange:b},visual:{iconOverrides:w,showExpandIcons:h,showDirectoryIcons:k,showFileIcons:N,useCanvasExpandIcons:o,expandIconSize:f,highlightStyles:V,entryClassName:Y,entryStyle:B,nameClassName:U,nameStyle:D,directoryNameClassName:H,directoryNameStyle:Z,fileNameClassName:q,fileNameStyle:J}},C.entry.absolutePath)})})},dt=({initialExpanded:e=new Set,storageKey:r}={})=>{const[a,l]=d.useTransition(),[n,s]=d.useState(()=>{if(typeof window<"u"&&r)try{const u=window.localStorage.getItem(r);if(u){const o=JSON.parse(u);return new Set(o)}}catch(u){console.error("[useDirectoryTreeState] Error reading from localStorage",u)}return e}),i=d.useCallback(u=>{l(()=>{s(o=>{const h=new Set(o);return u(h),h})})},[]),y=d.useCallback((u,o)=>{i(h=>{for(const k of u)o(h,k)})},[i]);d.useEffect(()=>{if(r&&typeof window<"u")try{window.localStorage.setItem(r,JSON.stringify(Array.from(n)))}catch(u){console.warn(`Error setting localStorage key "${r}":`,u)}},[n,r]);const S=d.useCallback(u=>{y([u],(o,h)=>{o.has(h)?o.delete(h):o.add(h)})},[y]),p=d.useCallback(u=>{y([u],(o,h)=>{o.add(h)})},[y]),c=d.useCallback(u=>{y([u],(o,h)=>{o.delete(h)})},[y]),v=d.useCallback(u=>{y(u,(o,h)=>{o.delete(h)})},[y]),b=d.useCallback(u=>{y(u,(o,h)=>{o.add(h)})},[y]),g=d.useCallback(()=>{i(u=>{u.clear()})},[i]),I=d.useCallback(u=>n.has(u),[n]);return{expanded:n,toggle:S,expand:p,collapse:c,collapseMultiple:v,expandMultiple:b,collapseAll:g,isExpanded:I,isPending:a}};exports.DirectoryTree=ut;exports.directoryTreeClasses=A;exports.useDirectoryTreeState=dt;
|