@visulima/tui-kit 1.0.3 → 1.0.5
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/CHANGELOG.md +15 -0
- package/dist/accordion.js +1 -1
- package/dist/alert.js +1 -1
- package/dist/animate-presence.js +1 -1
- package/dist/approval-prompt.js +1 -1
- package/dist/area-chart.js +1 -1
- package/dist/badge.js +1 -1
- package/dist/bar-chart.js +1 -1
- package/dist/big-text.js +1 -1
- package/dist/blink-dot.js +1 -1
- package/dist/breadcrumb.js +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.js +1 -1
- package/dist/checkbox-group.js +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/code.js +2 -2
- package/dist/collapsible.js +1 -1
- package/dist/color-picker.js +1 -1
- package/dist/command-block.js +4 -4
- package/dist/command-palette.js +1 -1
- package/dist/confirm-dialog.js +1 -1
- package/dist/confirm-input.js +1 -1
- package/dist/console-overlay.js +1 -1
- package/dist/content-switcher.js +1 -1
- package/dist/controlled-scroll-view.d.ts +43 -3
- package/dist/controlled-scroll-view.js +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/date-picker.js +1 -1
- package/dist/definition-list.js +1 -1
- package/dist/dialog.d.ts +1 -1
- package/dist/dialog.js +1 -1
- package/dist/diff-view.js +1 -1
- package/dist/digits.js +1 -1
- package/dist/directory-tree.js +1 -1
- package/dist/divider.js +1 -1
- package/dist/drawer.js +1 -1
- package/dist/file-change.js +1 -1
- package/dist/file-picker-entry.d.ts +92 -2
- package/dist/file-picker-entry.js +1 -1
- package/dist/form.js +1 -1
- package/dist/gauge.js +1 -1
- package/dist/gradient.js +1 -1
- package/dist/grid.js +1 -1
- package/dist/heading.js +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/help.js +1 -1
- package/dist/histogram.js +1 -1
- package/dist/image.js +1 -1
- package/dist/index.d.ts +25 -9
- package/dist/index.js +1 -1
- package/dist/json.js +1 -1
- package/dist/kbd.js +1 -1
- package/dist/line-chart.js +1 -1
- package/dist/link.js +1 -1
- package/dist/loading-indicator.js +1 -1
- package/dist/log.js +1 -1
- package/dist/markdown.js +1 -1
- package/dist/masked-input.js +1 -1
- package/dist/menu.js +1 -1
- package/dist/message-bubble.js +1 -1
- package/dist/model-badge.js +1 -1
- package/dist/model-selector.js +1 -1
- package/dist/multi-progress.js +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/notification-badge.js +1 -1
- package/dist/number-input.js +1 -1
- package/dist/operation-tree.js +1 -1
- package/dist/option-list.js +1 -1
- package/dist/ordered-list.js +1 -1
- package/dist/packem_shared/ControlledScrollView-soZtm3m7.js +1 -0
- package/dist/packem_shared/FilePicker-KGAg6v5x.js +1 -0
- package/dist/packem_shared/ScrollBar-arHRP6OT.js +1 -0
- package/dist/packem_shared/ScrollBarBox-C8wZ_Slk.js +1 -0
- package/dist/packem_shared/ScrollList-BCqHHps6.js +1 -0
- package/dist/packem_shared/ScrollView-Dt5E9Yl7.js +1 -0
- package/dist/packem_shared/TreeNodeMap-BK7nRlt0.js +1 -0
- package/dist/packem_shared/TreeView-BEZAFOfr.js +1 -0
- package/dist/packem_shared/controlled-scroll-view-BHCYjiKa.js +1 -0
- package/dist/packem_shared/line-chart-BqOUjZTt.js +1 -0
- package/dist/packem_shared/treeViewTheme-DuCcyBDe.js +1 -0
- package/dist/packem_shared/useTreeView-Dt_iWxVs.js +1 -0
- package/dist/packem_shared/useTreeViewState-aHwNZhIE.js +1 -0
- package/dist/packem_shared/{variant-config-BJqpNo7H.js → variant-config-BnAmf1rP.js} +1 -1
- package/dist/paginator.js +1 -1
- package/dist/paragraph.js +1 -1
- package/dist/path-input.js +1 -1
- package/dist/pie-chart.js +1 -1
- package/dist/placeholder.js +1 -1
- package/dist/popover.js +1 -1
- package/dist/progress-bar.js +1 -1
- package/dist/progress-circle.js +1 -1
- package/dist/qr-code.js +1 -1
- package/dist/radio-group.js +1 -1
- package/dist/scatter-plot.js +1 -1
- package/dist/scroll-bar-box.d.ts +13 -3
- package/dist/scroll-bar-box.js +1 -1
- package/dist/scroll-bar.d.ts +18 -3
- package/dist/scroll-bar.js +1 -1
- package/dist/scroll-list.d.ts +12 -3
- package/dist/scroll-list.js +1 -1
- package/dist/scroll-view.d.ts +98 -3
- package/dist/scroll-view.js +1 -1
- package/dist/search-input.js +1 -1
- package/dist/select-input-indicator.js +1 -1
- package/dist/select-input-item.js +1 -1
- package/dist/select-input.js +1 -1
- package/dist/shimmer-text.js +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/slider.js +1 -1
- package/dist/sparkline.js +1 -1
- package/dist/spinner.js +1 -1
- package/dist/status-line.js +1 -1
- package/dist/status-message.js +1 -1
- package/dist/stepper.js +1 -1
- package/dist/stopwatch.js +1 -1
- package/dist/streaming-text.js +1 -1
- package/dist/switch.js +1 -1
- package/dist/tab.js +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.js +1 -1
- package/dist/tag-input.js +1 -1
- package/dist/tag.js +1 -1
- package/dist/text-input.js +1 -1
- package/dist/textarea.js +2 -2
- package/dist/thinking-block.js +1 -1
- package/dist/time-picker.js +1 -1
- package/dist/timer.js +1 -1
- package/dist/toast.js +1 -1
- package/dist/token-usage.js +1 -1
- package/dist/tool-call.js +1 -1
- package/dist/tooltip.js +1 -1
- package/dist/transition.js +1 -1
- package/dist/tree-select.js +1 -1
- package/dist/tree-view-entry.d.ts +314 -4
- package/dist/tree-view-entry.js +1 -1
- package/dist/unordered-list.js +1 -1
- package/dist/use-linked-scroll.d.ts +1 -1
- package/dist/use-linked-scroll.js +1 -1
- package/package.json +8 -8
- package/dist/packem_shared/ControlledScrollView-BzlbIUph.js +0 -1
- package/dist/packem_shared/FilePicker-V5H2fb-v.js +0 -1
- package/dist/packem_shared/ScrollBar-C9i3z3Ft.js +0 -1
- package/dist/packem_shared/ScrollBarBox-DZEC8YnV.js +0 -1
- package/dist/packem_shared/ScrollList-Djtb2vVy.js +0 -1
- package/dist/packem_shared/ScrollView-ESxpl6Hy.js +0 -1
- package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
- package/dist/packem_shared/TreeView-q0l446NV.js +0 -1
- package/dist/packem_shared/controlled-scroll-view-DerVKKv6.js +0 -1
- package/dist/packem_shared/controlled-scroll-view.d-D3kZZzjI.d.ts +0 -43
- package/dist/packem_shared/file-picker.d-CH7pccC7.d.ts +0 -92
- package/dist/packem_shared/line-chart-BbhMhcZg.js +0 -1
- package/dist/packem_shared/scroll-bar-box.d-CpTYEcTZ.d.ts +0 -13
- package/dist/packem_shared/scroll-bar.d-B4sD1hBR.d.ts +0 -18
- package/dist/packem_shared/scroll-list.d-CPCF0RwC.d.ts +0 -12
- package/dist/packem_shared/scroll-view.d-GZcgAHl4.d.ts +0 -98
- package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
- package/dist/packem_shared/use-tree-view.d-DeMQ6G2r.d.ts +0 -314
- package/dist/packem_shared/useTreeView-D0JEqT6W.js +0 -1
- package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## @visulima/tui-kit [1.0.5](https://github.com/visulima/visulima/compare/%40visulima%2Ftui-kit%401.0.4...%40visulima%2Ftui-kit%401.0.5) (2026-08-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Dependencies
|
|
5
|
+
|
|
6
|
+
* **@visulima/ansi:** upgraded to 4.2.0
|
|
7
|
+
* **@visulima/tui:** upgraded to 4.0.2
|
|
8
|
+
|
|
9
|
+
## @visulima/tui-kit [1.0.4](https://github.com/visulima/visulima/compare/%40visulima%2Ftui-kit%401.0.3...%40visulima%2Ftui-kit%401.0.4) (2026-08-17)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* **@visulima/tui:** upgraded to 4.0.1
|
|
15
|
+
|
|
1
16
|
## @visulima/tui-kit [1.0.3](https://github.com/visulima/visulima/compare/%40visulima%2Ftui-kit%401.0.2...%40visulima%2Ftui-kit%401.0.3) (2026-08-08)
|
|
2
17
|
|
|
3
18
|
|
package/dist/accordion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as m,jsxs as
|
|
1
|
+
import{jsx as m,jsxs as x}from"react/jsx-runtime";import f from"@visulima/tui/components/box";import A from"@visulima/tui/components/text";import B from"@visulima/tui/hooks/use-focus";import O from"@visulima/tui/hooks/use-input";import{useState as I,useRef as R,useCallback as a}from"react";function q({accentColor:F="blue",allowMultiple:l=!1,autoFocus:j=!1,defaultExpanded:c,isDisabled:s=!1,items:i}){const{isFocused:u}=B({autoFocus:j,isActive:!s}),[v,C]=I(()=>c===void 0||c.length===0?[]:l?c:c.slice(0,1)),[d,h]=I(0),t=R(d);t.current=d;const g=a(r=>{C(e=>{const n=e.includes(r);return l?n?e.filter(o=>o!==r):[...e,r]:n?[]:[r]})},[l]);return O(a((r,e)=>{if(!u)return;const n=i.length;if((e.downArrow||r==="j")&&t.current<n-1)h(t.current+1);else if((e.upArrow||r==="k")&&t.current>0)h(t.current-1);else if(e.return||r===" "){const o=i[t.current];o&&g(o.id)}},[u,i,g]),{isActive:!s&&u}),m(f,{flexDirection:"column",children:i.map((r,e)=>{const n=v.includes(r.id),o=u&&e===d,p=o?F:void 0;return x(f,{flexDirection:"column",children:[x(f,{children:[x(A,{color:p,dimColor:s,children:[o?"▸ ":" ",n?"▼ ":"▶ "]}),m(A,{bold:o,color:p,dimColor:s,children:r.title})]}),n?m(f,{flexDirection:"column",marginBottom:1,marginLeft:4,children:r.content}):void 0]},r.id)})})}export{q as Accordion,q as default};
|
package/dist/alert.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as l,jsx as r}from"react/jsx-runtime";import o from"@visulima/tui/components/box";import e from"@visulima/tui/components/text";import{V as f}from"./packem_shared/variant-config-BnAmf1rP.js";function a({children:d,title:i,variant:t}){const{color:n,icon:c}=f[t];return l(o,{borderColor:n,borderStyle:"round",flexGrow:1,gap:1,paddingX:1,children:[r(o,{flexShrink:0,children:r(e,{color:n,children:c})}),l(o,{flexDirection:"column",flexGrow:1,flexShrink:1,gap:1,minWidth:0,children:[i?r(e,{bold:!0,children:i}):void 0,r(e,{children:d})]})]})}export{a as Alert,a as default};
|
package/dist/animate-presence.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as w}from"react/jsx-runtime";import h from"@visulima/tui/components/box";import{useState as x,Children as m,isValidElement as p,useEffect as E,useCallback as g,cloneElement as y}from"react";const l=r=>{const{key:s}=r;if(s!==null)return s},i=r=>r.type?.isAnimatable===!0?!0:typeof r.props=="object"&&r.props!==null&&"show"in r.props;function A({children:r}){const[s,a]=x(()=>{const e=[];return m.forEach(r,t=>{if(!p(t))return;const n=l(t);n!==void 0&&e.push({element:(i(t),t),key:n,show:!0})}),e});E(()=>{const e=new Map;m.forEach(r,t=>{if(!p(t))return;const n=l(t);n!==void 0&&e.set(n,(i(t),t))}),a(t=>{const n=[],c=new Set;let u=!1;for(const o of t)if(e.has(o.key)){const f=e.get(o.key);(!o.show||o.element!==f)&&(u=!0),n.push({element:f,key:o.key,show:!0}),c.add(o.key)}else o.show&&(u=!0),n.push({...o,show:!1});for(const[o,f]of e)c.has(o)||(u=!0,n.push({element:f,key:o,show:!0}));return u?n:t})},[r]);const k=g(e=>{a(t=>t.filter(n=>n.key!==e))},[]);return w(h,{flexDirection:"column",children:s.map(e=>{if(!i(e.element))return y(e.element,{key:e.key});const t=e.element.props.onExit;return y(e.element,{key:e.key,onExit:()=>{t?.(),k(e.key)},show:e.show})})})}export{A as AnimatePresence,A as default};
|
package/dist/approval-prompt.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as t,jsx as o}from"react/jsx-runtime";import n from"@visulima/tui/components/box";import e from"@visulima/tui/components/text";import S from"@visulima/tui/hooks/use-focus";import I from"@visulima/tui/hooks/use-input";import{useCallback as x}from"react";const C={high:"red",low:"green",medium:"yellow"},R={high:"HIGH RISK",low:"LOW RISK",medium:"MEDIUM RISK"},A=r=>{if(r===null)return"null";if(typeof r=="string")return r;if(typeof r=="number"||typeof r=="boolean")return String(r);try{return JSON.stringify(r)}catch{return String(r)}};function k({accentColor:r,autoFocus:y=!0,children:a,description:s,isDisabled:f=!1,onDecision:i,params:p,risk:h="medium",tool:b}){const d=C[h],m=r??d,{isFocused:w}=S({autoFocus:y,isActive:!f});I(x((l,c)=>{const u=l.toLowerCase();if(u==="y"||c.return){i("allow-once");return}if(u==="a"){i("allow-always");return}(u==="n"||c.escape)&&i("deny")},[i]),{isActive:!f&&w});const g=p===void 0?[]:Object.entries(p);return t(n,{borderColor:d,borderStyle:"round",flexDirection:"column",paddingX:1,children:[t(n,{children:[t(e,{backgroundColor:d,color:"black",children:[" ",R[h]," "]}),t(e,{children:[" ",o(e,{bold:!0,children:b})]})]}),s===void 0?void 0:o(n,{marginTop:1,children:o(e,{children:s})}),g.length===0?void 0:o(n,{flexDirection:"column",marginTop:1,children:g.map(([l,c])=>t(n,{children:[t(e,{color:"cyan",children:[l,"="]}),o(e,{wrap:"truncate-end",children:A(c)})]},l))}),a===void 0?void 0:o(n,{marginTop:1,children:a}),o(n,{marginTop:1,children:t(e,{children:["Allow? [",o(e,{bold:!0,color:m,children:"y"}),"es /"," ",o(e,{bold:!0,color:m,children:"a"}),"lways /"," ",o(e,{bold:!0,color:m,children:"n"}),"o ]"]})})]})}export{k as ApprovalPrompt,k as default};
|
package/dist/area-chart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as A,jsx as d}from"react/jsx-runtime";import{createBrailleGrid as _}from"@visulima/tui/canvas";import u from"@visulima/tui/components/box";import b from"@visulima/tui/components/canvas";import C from"@visulima/tui/components/text";import{useMemo as v}from"react";import{t as F,p as w,c as G,D as S,a as x}from"./packem_shared/line-chart-BqOUjZTt.js";const V=S,X={heavy:"▓",light:"░",medium:"▒"};function k({axisColor:I="gray",fillDensity:T="medium",height:y=10,maxY:f,minY:m,palette:h=V,series:M,showLegend:L=!0,width:g=40}){const n=v(()=>{const o=M.map((e,c)=>({color:w(e,c,h),points:F(e.data),series:e})),i=G(o);return{list:o,xMax:i.xMax===Number.NEGATIVE_INFINITY?1:i.xMax,xMin:i.xMin===Number.POSITIVE_INFINITY?0:i.xMin,yMax:f??(i.yMax===Number.NEGATIVE_INFINITY?1:i.yMax),yMin:m??(i.yMin===Number.POSITIVE_INFINITY?0:i.yMin)}},[M,h,m,f]),N=X[T];return A(u,{flexDirection:"column",children:[d(b,{draw:o=>{o.clear();const i=o.width*2,e=o.height*4,c={xMax:n.xMax,xMin:n.xMin,yMax:n.yMax,yMin:n.yMin};for(const{color:s,points:a}of n.list)if(a.length!==0)for(let l=0;l<o.width;l+=1){let r;for(const t of a){const{px:p,py:P}=x(t,c,i,e);if(Math.floor(p/2)===l){const E=Math.floor(P/4);(r===void 0||E<r)&&(r=E)}}if(r!==void 0)for(let t=r+1;t<o.height;t+=1)o.setCell(l,t,N,{color:s,dim:!0})}for(let s=0;s<o.width;s+=2)o.setCell(s,o.height-1,"·",{color:I,dim:!0});for(const{color:s,points:a}of n.list){if(a.length===0)continue;const l=_(o.width,o.height);let r=x(a[0],c,i,e);l.plotPoint(r.px,r.py);for(let t=1;t<a.length;t+=1){const p=x(a[t],c,i,e);l.plotLine(r.px,r.py,p.px,p.py),r=p}l.flush(o,{bold:!0,color:s})}},height:y,version:[M,g,y,m,f,T,I,h],width:g}),L?d(u,{gap:2,marginTop:1,children:n.list.map(({color:o,series:i},e)=>A(u,{gap:1,children:[d(C,{color:o,children:N}),d(C,{children:i.label??`Series ${e+1}`})]},`${e}:${i.label??""}`))}):void 0]})}export{k as AreaChart,k as default};
|
package/dist/badge.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as a,jsx as n}from"react/jsx-runtime";import r from"@visulima/tui/components/text";function m({children:o,color:t="magenta"}){const e=typeof o=="string"?o.toUpperCase():o;return a(r,{backgroundColor:t,children:[" ",n(r,{color:"black",children:e})," "]})}export{m as Badge,m as default};
|
package/dist/bar-chart.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as C}from"react/jsx-runtime";import e from"@visulima/tui/components/box";import S from"@visulima/tui/components/canvas";import p from"@visulima/tui/components/text";import{useMemo as T}from"react";const W=["cyan","magenta","yellow","green","blue","red"],k=(r,i)=>{if(i!==void 0)return i;if(r.length===0)return 0;let c=r[0].value;for(let a=1;a<r.length;a+=1){const{value:d}=r[a];d>c&&(c=d)}return c},b=(r,i,c)=>c.color??i[r%i.length]??"cyan";function F({data:r,height:i=10,max:c,orientation:a="vertical",palette:d=W,showLabels:w=!0,showValues:g=!1,width:E}){const f=T(()=>k(r,c),[r,c]);if(a==="horizontal"){const l=E??24;return o(e,{flexDirection:"column",children:r.map((n,m)=>{const v=f===0?0:n.value/f,u=b(m,d,n);return C(e,{gap:1,children:[w&&n.label!==void 0?o(e,{flexShrink:0,minWidth:8,children:o(p,{dimColor:!0,wrap:"truncate-end",children:n.label})}):void 0,o(e,{flexGrow:1,flexShrink:1,children:o(S,{draw:s=>{s.clear(),s.drawHBar(0,0,l,v,{color:u})},height:1,version:[n.value,f,u,l],width:l})}),g?o(e,{flexShrink:0,children:o(p,{children:String(n.value)})}):void 0]},m)})})}const t=2,h=1,B=E??Math.max(r.length*(t+h),1);return C(e,{flexDirection:"column",children:[o(S,{draw:l=>{l.clear(),r.forEach((n,m)=>{const v=f===0?0:n.value/f,u=b(m,d,n),s=m*(t+h);for(let x=0;x<t;x+=1)l.drawVBar(s+x,0,i,v,{color:u})})},height:i,version:[r,f,d,t,h,i],width:B}),g?o(e,{children:r.map((l,n)=>o(e,{width:t+h,children:o(p,{dimColor:!0,children:String(l.value).padEnd(t+h," ")})},n))}):void 0,w?o(e,{children:r.map((l,n)=>o(e,{width:t+h,children:o(p,{dimColor:!0,wrap:"truncate-end",children:(l.label??"").padEnd(t+h," ")})},n))}):void 0]})}export{F as BarChart,F as default};
|
package/dist/big-text.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as p}from"react/jsx-runtime";import u from"@visulima/tui/components/text";import a from"cfonts";import{useMemo as c}from"react";const l={align:"left",backgroundColor:"transparent",colors:["system"],font:"block",letterSpacing:1,lineHeight:1,maxLength:0,space:!0};function h({align:r,backgroundColor:t,colors:e,font:o,letterSpacing:n,lineHeight:s,maxLength:m,space:f,text:i}){const d=c(()=>a.render(i,{...l,align:r,backgroundColor:t,colors:e,font:o,letterSpacing:n,lineHeight:s,maxLength:m,space:f}),[i,r,t,e,o,n,s,m,f]);return p(u,{children:d&&d.string})}export{h as BigText,h as default};
|
package/dist/blink-dot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import a from"@visulima/tui/components/text";import f from"@visulima/tui/hooks/use-animation";function p({character:t="●",color:o="red",interval:e=800,isActive:r=!0}){const{frame:n}=f({interval:Math.max(1,Math.floor(e/2)),isActive:r}),i=!r||n%2===0;return m(a,{color:o,children:i?t:" "})}export{p as BlinkDot,p as default};
|
package/dist/breadcrumb.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as a,jsxs as o,Fragment as c}from"react/jsx-runtime";import m from"@visulima/tui/components/box";import d from"@visulima/tui/components/text";import{Fragment as s}from"react";function b({currentColor:i="blue",items:n,separator:t="›"}){return a(m,{children:n.map((r,e)=>{const l=e===n.length-1;return o(s,{children:[e>0?o(d,{dimColor:!0,children:[" ",t," "]}):void 0,o(d,{bold:l,color:l?i:void 0,dimColor:!l,children:[r.icon===void 0?void 0:o(c,{children:[r.icon," "]}),r.label]})]},r.key??r.label)})})}export{b as Breadcrumb,b as default};
|
package/dist/button.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as n,jsxs as s}from"react/jsx-runtime";import l from"@visulima/tui/components/box";import m from"@visulima/tui/components/text";import g from"@visulima/tui/hooks/use-focus";import x from"@visulima/tui/hooks/use-input";import{useCallback as y}from"react";const b="round",k=(o,u,i,t)=>{if(!i){if(o==="primary"&&u)return"black";if(u)return t}};function R({accentColor:o="blue",autoFocus:u=!1,children:i,isDisabled:t=!1,onPress:f,variant:e="primary"}){const{isFocused:r}=g({autoFocus:u,isActive:!t});x(y((p,c)=>{r&&(c.return||p===" ")&&f?.()},[r,f]),{isActive:!t&&r});const d=k(e,r,t,o);return e==="ghost"?n(l,{paddingX:1,children:s(m,{bold:r,color:d,dimColor:t,children:[r?"▸ ":" ",i]})}):n(l,{backgroundColor:e==="primary"&&r?o:void 0,borderColor:e==="outline"?r?o:"gray":e==="secondary"||r?o:void 0,borderStyle:b,paddingX:1,children:n(m,{bold:r,color:d,dimColor:t,children:i})})}export{R as Button,R as default};
|
package/dist/calendar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as T,jsx as i}from"react/jsx-runtime";import h from"@visulima/tui/components/box";import F from"@visulima/tui/components/text";import y from"@visulima/tui/hooks/use-focus";import H from"@visulima/tui/hooks/use-input";import{useMemo as C,useState as K,useRef as U,useCallback as E}from"react";const X=["January","February","March","April","May","June","July","August","September","October","November","December"],O=["Su","Mo","Tu","We","Th","Fr","Sa"],p=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),R=(e,o)=>{const s=e.getFullYear(),l=e.getMonth()+o,f=new Date(s,l+1,0).getDate(),a=Math.min(e.getDate(),f);return new Date(s,l,a)},j=(e,o)=>e.getFullYear()===o.getFullYear()&&e.getMonth()===o.getMonth()&&e.getDate()===o.getDate(),x=(e,o,s)=>o!==void 0&&e<p(o)||s!==void 0&&e>p(s),q=(e,o,s)=>{const a=(new Date(e,o,1).getDay()-s+7)%7,M=new Date(e,o+1,0).getDate(),c=[];for(let r=0;r<a;r+=1)c.push(void 0);for(let r=1;r<=M;r+=1)c.push(new Date(e,o,r));for(;c.length%7!==0;)c.push(void 0);const D=[];for(let r=0;r<c.length;r+=7)D.push(c.slice(r,r+7));return D};function ee({accentColor:e="blue",autoFocus:o=!1,defaultValue:s,firstDayOfWeek:l=1,isDisabled:f=!1,maxDate:a,minDate:M,onChange:c,onSubmit:D,selectedColor:r="green",value:m}){const{isFocused:w}=y({autoFocus:o,isActive:!f}),Y=C(()=>p(new Date),[]),J=p(m??s??Y),[N,B]=K(J),u=m?p(m):N,b=U(u);b.current=u;const I=C(()=>[...O.slice(l),...O.slice(0,l)],[l]),L=C(()=>q(u.getFullYear(),u.getMonth(),l),[u,l]),g=E(d=>{const n=p(d);x(n,M,a)||(m===void 0&&B(n),c?.(n))},[m,c,M,a]);H(E((d,n)=>{if(!w)return;const{current:t}=b;n.leftArrow?g(new Date(t.getFullYear(),t.getMonth(),t.getDate()-1)):n.rightArrow?g(new Date(t.getFullYear(),t.getMonth(),t.getDate()+1)):n.upArrow?g(new Date(t.getFullYear(),t.getMonth(),t.getDate()-7)):n.downArrow?g(new Date(t.getFullYear(),t.getMonth(),t.getDate()+7)):n.pageUp?g(R(t,-1)):n.pageDown?g(R(t,1)):n.return&&D?.(t)},[w,g,D]),{isActive:!f&&w});const _=`${X[u.getMonth()]} ${u.getFullYear()}`;return T(h,{borderColor:w?e:void 0,borderStyle:"round",flexDirection:"column",paddingX:1,children:[i(h,{justifyContent:"center",children:i(F,{bold:!0,color:e,children:_})}),i(h,{marginTop:1,children:I.map(d=>i(h,{width:3,children:i(F,{dimColor:!0,children:d.padEnd(2," ")})},d))}),L.map((d,n)=>i(h,{children:d.map((t,A)=>{if(t===void 0)return i(h,{width:3,children:i(F,{children:" "})},A);const v=j(t,Y),S=j(t,u),$=x(t,M,a);return i(h,{width:3,children:T(F,{backgroundColor:S&&w?e:void 0,bold:v,color:S&&w?"black":v?r:void 0,dimColor:$||f,children:[String(t.getDate()).padStart(2," ")," "]})},A)})},n))]})}export{ee as Calendar,ee as default};
|
package/dist/card.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as r,jsx as i}from"react/jsx-runtime";import o from"@visulima/tui/components/box";import
|
|
1
|
+
import{jsxs as r,jsx as i}from"react/jsx-runtime";import o from"@visulima/tui/components/box";import l from"@visulima/tui/components/text";import{Divider as u}from"./divider.js";function C({borderColor:v,borderStyle:t="round",children:a,footer:m,headerRight:n,subtitle:d,title:e,titleColor:f,width:c}){return r(o,{borderColor:v,borderStyle:t,flexDirection:"column",paddingX:1,width:c,children:[e!==void 0||d!==void 0||n!==void 0?r(o,{flexDirection:"column",marginBottom:1,children:[r(o,{justifyContent:"space-between",children:[i(o,{children:e===void 0?void 0:i(l,{bold:!0,color:f,children:e})}),n===void 0?void 0:i(o,{children:n})]}),d===void 0?void 0:i(l,{dimColor:!0,children:d})]}):void 0,i(o,{flexDirection:"column",children:a}),m===void 0?void 0:r(o,{flexDirection:"column",marginTop:1,children:[i(u,{dimColor:!0,length:typeof c=="number"?Math.max(1,c-4):void 0}),i(o,{marginTop:1,children:m})]})]})}export{C as Card,C as default};
|
package/dist/checkbox-group.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as p}from"react/jsx-runtime";import m from"@visulima/tui/components/box";import v from"@visulima/tui/components/text";import M from"@visulima/tui/hooks/use-focus";import R from"@visulima/tui/hooks/use-input";import{useState as S,useMemo as T,useRef as B,useCallback as H}from"react";const G=[];function j(a,n){return n===0?0:(a%n+n)%n}function K({accentColor:a="blue",autoFocus:n=!1,defaultValue:E=G,isDisabled:b=!1,onChange:x,onSubmit:g,options:s,value:d}){const{isFocused:w}=M({autoFocus:n,isActive:!b}),C=d!==void 0,[A,F]=S(E),c=T(()=>new Set(d??A),[d,A]),[f,D]=S(0),k=B(x);k.current=x;const h=H(r=>{const i=s.map(e=>e.value).filter(e=>r.has(e));return C||F(i),k.current?.(i),i},[C,s]),I=H((r,i)=>{if(i.upArrow){D(e=>j(e-1,s.length));return}if(i.downArrow){D(e=>j(e+1,s.length));return}if(r===" "){const e=s[f];if(e===void 0||e.isDisabled)return;const l=new Set(c);l.has(e.value)?l.delete(e.value):l.add(e.value),h(l);return}if(r==="a"){const e=s.filter(t=>!t.isDisabled),l=e.every(t=>c.has(t.value)),u=new Set(s.filter(t=>t.isDisabled&&c.has(t.value)).map(t=>t.value));if(!l)for(const t of e)u.add(t.value);h(u);return}i.return&&g?.(s.map(e=>e.value).filter(e=>c.has(e)))},[c,f,h,g,s]);return R(I,{isActive:w&&!b}),o(m,{flexDirection:"column",children:s.map((r,i)=>{const e=w&&i===f,l=c.has(r.value),u=l?"◉":"◯",L=!r.isDisabled&&(l||e)?a:void 0;return p(m,{children:[o(v,{color:e?a:void 0,children:e?"❯ ":" "}),p(v,{color:L,dimColor:r.isDisabled,children:[u," ",r.label]}),r.description===void 0?void 0:o(m,{marginLeft:1,children:o(v,{dimColor:!0,children:r.description})})]},i)})})}export{K as CheckboxGroup,K as default};
|
package/dist/checkbox.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as f,jsx as x}from"react/jsx-runtime";import a from"@visulima/tui/components/box";import m from"@visulima/tui/components/text";import E from"@visulima/tui/hooks/use-focus";import I from"@visulima/tui/hooks/use-input";import{useState as k,useCallback as N}from"react";const h="☒",j="☐";function B({accentColor:c="blue",autoFocus:u=!1,children:i,defaultChecked:l=!1,isChecked:r,isDisabled:t=!1,onChange:n}){const{isFocused:o}=E({autoFocus:u,isActive:!t}),[p,d]=k(l),e=r??p;return I(N((C,v)=>{if(o&&(v.return||C===" ")){const s=!e;r===void 0&&d(s),n?.(s)}},[o,e,r,n]),{isActive:!t&&o}),f(a,{gap:1,children:[f(m,{color:o?c:void 0,dimColor:t,children:[o?"▸ ":" ",e?h:j]}),i===void 0?void 0:x(m,{color:o?c:void 0,dimColor:t,children:i})]})}export{B as Checkbox,B as default};
|
package/dist/code.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
2
|
-
`),
|
|
1
|
+
import{jsx as p,jsxs as h}from"react/jsx-runtime";import m from"@visulima/tui/components/box";import x from"@visulima/tui/components/text";import{resolveLanguage as v,isLanguageSupported as T,getHighlighter as y,getCachedTokens as C,tokenLinesToElements as j}from"@visulima/tui/highlighter";import{useState as E,useRef as H,useEffect as R}from"react";function q({code:o,highlightLines:f,language:l,showLineNumbers:i=!1,startLine:s=1,theme:c="github-dark-default"}){const[a,u]=E(null),e=H(!1);R(()=>{e.current=!1;const t=l?v(l):"text";if(t!=="text"&&!T(t)){u(null);return}return(async()=>{try{const r=await y(t==="text"?[]:[t],c),n=C(r,o,t,c);e.current||u(n.tokens)}catch{e.current||u(null)}})(),()=>{e.current=!0}},[o,l,c]);const k={highlightLines:f,showLineNumbers:i,startLine:s};if(a)return j(a,k);const d=o.split(`
|
|
2
|
+
`),S=i?String(s+d.length-1).length:0;return p(m,{flexDirection:"column",children:d.map((t,r)=>{const n=s+r,g=f?.has(n)??!1;return h(m,{children:[i?h(x,{color:g?"yellow":void 0,dimColor:!g,children:[String(n).padStart(S)," "]}):void 0,p(x,{children:t})]},r)})})}export{q as Code,q as default};
|
package/dist/collapsible.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as f,jsx as i}from"react/jsx-runtime";import l from"@visulima/tui/components/box";import s from"@visulima/tui/components/text";import j from"@visulima/tui/hooks/use-focus";import A from"@visulima/tui/hooks/use-input";import{useState as F,useCallback as I}from"react";function w({accentColor:n="blue",autoFocus:u=!1,children:d,defaultOpen:a=!1,isDisabled:o=!1,isOpen:e,onToggle:c,title:p}){const{isFocused:r}=j({autoFocus:u,isActive:!o}),[x,v]=F(a),t=e??x;return A(I((h,C)=>{if(C.return||h===" "){const m=!t;e===void 0&&v(m),c?.(m)}},[t,e,c]),{isActive:!o&&r}),f(l,{flexDirection:"column",children:[f(l,{children:[i(s,{color:r?n:void 0,dimColor:o,children:t?"▼ ":"▶ "}),i(s,{bold:r,color:r?n:void 0,dimColor:o,children:p})]}),t?i(l,{flexDirection:"column",marginLeft:2,children:d}):void 0]})}export{w as Collapsible,w as default};
|
package/dist/color-picker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as C,jsx as
|
|
1
|
+
import{jsxs as C,jsx as c}from"react/jsx-runtime";import h from"@visulima/tui/components/box";import l from"@visulima/tui/components/text";import _ from"@visulima/tui/hooks/use-focus";import y from"@visulima/tui/hooks/use-input";import{useState as H,useRef as S,useCallback as p}from"react";const U=["black","red","green","yellow","blue","magenta","cyan","white","gray","redBright","greenBright","yellowBright","blueBright","magentaBright","cyanBright","whiteBright"];function q(u,i){return i===0?0:(u%i+i)%i}function Q({accentColor:u="blue",autoFocus:i=!1,columns:T=8,defaultValue:E,isDisabled:m=!1,onChange:a,onSubmit:x,palette:r=U,showName:F=!0,swatch:M="██",value:d}){const{isFocused:v}=_({autoFocus:i,isActive:!m}),g=d!==void 0,t=Math.max(1,T),b=Math.max(0,r.indexOf(d??E)),[j,L]=H(b),e=g?Math.max(0,r.indexOf(d)):j,w=S(a);w.current=a;const s=p(n=>{if(r.length===0)return;const o=q(e+n,r.length);g||L(o),w.current?.(r[o])},[e,g,r]),O=p((n,o)=>{o.leftArrow?s(-1):o.rightArrow?s(1):o.upArrow?s(-t):o.downArrow?s(t):o.return&&x?.(r[e])},[t,e,s,x,r]);y(O,{isActive:v&&!m});const A=[];for(let n=0;n<r.length;n+=t)A.push(r.slice(n,n+t));return C(h,{flexDirection:"column",children:[A.map((n,o)=>c(h,{children:n.map((P,B)=>{const R=o*t+B,f=v&&R===e;return C(h,{children:[c(l,{color:f?u:void 0,children:f?"[":" "}),c(l,{color:P,dimColor:m,children:M}),c(l,{color:f?u:void 0,children:f?"]":" "})]},B)})},o)),F?c(h,{marginTop:1,children:c(l,{dimColor:!0,children:String(r[e]??"")})}):void 0]})}export{Q as ColorPicker,Q as default};
|
package/dist/command-block.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as
|
|
2
|
-
`);if(
|
|
3
|
-
`),
|
|
4
|
-
… ${
|
|
1
|
+
import{jsxs as c,jsx as e}from"react/jsx-runtime";import l from"@visulima/tui/components/box";import i from"@visulima/tui/components/text";import{Spinner as g}from"./spinner.js";const p={error:"red",idle:"gray",running:"cyan",success:"green"},a=r=>r<1e3?`${Math.round(r)}ms`:`${(r/1e3).toFixed(2)}s`,S=r=>r==="running"?e(g,{type:"dots"}):{error:"✖",idle:"$",success:"✔"}[r],v=(r,n)=>{if(!Number.isFinite(n))return r;const o=r.split(`
|
|
2
|
+
`);if(o.length<=n)return r;const t=o.slice(0,n).join(`
|
|
3
|
+
`),d=o.length-n;return`${t}
|
|
4
|
+
… ${d} more line${d===1?"":"s"}`};function O({command:r,cwd:n,durationMs:o,exitCode:t,maxOutputRows:d=12,output:s,status:f="idle"}){const u=p[f],m=S(f),h=[];return o!==void 0&&h.push(c(i,{dimColor:!0,children:[" ",a(o)]},"duration")),t!==void 0&&f!=="running"&&h.push(c(i,{color:t===0?"green":"red",children:[" ","exit"," ",t]},"exit")),c(l,{borderColor:u,borderStyle:"round",flexDirection:"column",paddingX:1,children:[c(l,{children:[e(i,{color:u,children:m}),e(i,{children:" "}),e(l,{flexGrow:1,flexShrink:1,minWidth:0,children:e(i,{bold:!0,wrap:"truncate-end",children:r})}),n===void 0?void 0:c(i,{dimColor:!0,children:[" ","@",n]}),h.length===0?void 0:e(l,{flexShrink:0,children:h})]}),s===void 0?void 0:e(l,{flexDirection:"column",marginTop:1,children:typeof s=="string"?e(i,{children:v(s,d)}):s})]})}export{O as CommandBlock,O as default};
|
package/dist/command-palette.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as u,jsx as n}from"react/jsx-runtime";import s from"@visulima/tui/components/box";import o from"@visulima/tui/components/text";import k from"@visulima/tui/hooks/use-focus";import y from"@visulima/tui/hooks/use-input";import{isInsertableInput as F}from"@visulima/tui/input";import{useState as M,useRef as T,useMemo as A,useEffect as D,useCallback as L}from"react";const R=(h,p)=>{if(h.length===0)return 1;const x=[p.label,p.description??"",...p.keywords??[]].map(i=>i.toLowerCase()).filter(i=>i.length>0),a=h.toLowerCase();let d=0;for(const i of x){if(i.includes(a)){const f=i.indexOf(a);d=Math.max(d,100-f);continue}let m=0,g=0;for(const f of a){const c=i.indexOf(f,m);if(c===-1){g=0;break}g+=1,m=c+1}g===a.length&&(d=Math.max(d,20))}return d};function P({accentColor:h="cyan",autoFocus:p=!0,commands:x,emptyText:a="No results",limit:d=8,onCancel:i,onSelect:m,placeholder:g="Type a command or search..."}){const{isFocused:f}=k({autoFocus:p}),[c,I]=M(""),[v,b]=M(0),w=T(v);w.current=v;const l=A(()=>{const e=x.map(r=>({command:r,score:R(c,r)})).filter(({score:r})=>r>0);return e.sort((r,t)=>t.score-r.score),e.slice(0,d).map(({command:r})=>r)},[x,c,d]);return D(()=>{const e=Math.max(0,l.length-1);w.current>e&&(w.current=e,b(e))},[l]),y(L((e,r)=>{if(f){if(r.escape){i?.();return}if(r.downArrow){if(l.length===0)return;b(t=>Math.min(l.length-1,t+1));return}if(r.upArrow){b(t=>Math.max(0,t-1));return}if(r.return){const t=l[w.current];t&&m(t.id,c);return}if(r.backspace||r.delete){I(t=>t.slice(0,-1)),b(0);return}F(e,r)&&(I(t=>t+e),b(0))}},[f,l,c,m,i]),{isActive:f}),u(s,{borderColor:h,borderStyle:"round",flexDirection:"column",paddingX:1,children:[u(s,{children:[n(o,{color:h,children:"❯"}),u(o,{children:[" ",c.length===0?n(o,{dimColor:!0,children:g}):c]}),n(o,{inverse:!0,children:" "})]}),n(s,{marginTop:1,children:u(o,{dimColor:!0,children:[l.length," of ",x.length]})}),n(s,{flexDirection:"column",marginTop:1,children:l.length===0?n(o,{dimColor:!0,children:a}):l.map((e,r)=>{const t=r===v,C=t?h:void 0;return u(s,{flexDirection:"column",children:[u(s,{children:[n(o,{color:C,children:t?"▸ ":" "}),e.icon===void 0?void 0:u(o,{color:C,children:[e.icon," "]}),n(s,{flexGrow:1,flexShrink:1,minWidth:0,children:n(o,{bold:t,color:C,wrap:"truncate-end",children:e.label})}),e.hotkey===void 0?void 0:n(s,{flexShrink:0,children:u(o,{dimColor:!0,children:[" ",e.hotkey]})})]}),e.description===void 0?void 0:n(s,{marginLeft:2,children:n(o,{dimColor:!0,wrap:"truncate-end",children:e.description})})]},e.id)})})]})}export{P as CommandPalette,P as default};
|
package/dist/confirm-dialog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as b,jsx as o}from"react/jsx-runtime";import
|
|
1
|
+
import{jsxs as b,jsx as o}from"react/jsx-runtime";import t from"@visulima/tui/components/box";import s from"@visulima/tui/components/text";import A from"@visulima/tui/hooks/use-focus";import B from"@visulima/tui/hooks/use-input";import{useState as j,useCallback as y}from"react";const O={danger:"red",info:"blue",warning:"yellow"},g=({color:n,isFocused:r,label:e})=>o(t,{backgroundColor:r?n:void 0,borderColor:r?n:void 0,borderStyle:"round",paddingX:1,children:o(s,{bold:r,color:r?"black":void 0,children:e})});function E({autoFocus:n=!0,cancelLabel:r="Cancel",children:e,confirmLabel:p="Confirm",defaultFocus:v="confirm",isDisabled:u=!1,onCancel:f,onConfirm:m,title:a,tone:x="info",width:h}){const[i,C]=j(v),l=O[x],{isFocused:w}=A({autoFocus:n,isActive:!u});return B(y((c,d)=>{if(d.leftArrow||d.rightArrow||c==="h"||c==="l"){C(i==="confirm"?"cancel":"confirm");return}if(d.return){i==="confirm"?m():f();return}if(d.escape||c==="n"){f();return}c==="y"&&m()},[i,m,f]),{isActive:!u&&w}),b(t,{borderColor:l,borderStyle:"round",flexDirection:"column",paddingX:1,paddingY:1,width:h,children:[a===void 0?void 0:o(t,{marginBottom:1,children:o(s,{bold:!0,color:l,children:a})}),e===void 0?void 0:o(t,{flexDirection:"column",marginBottom:1,children:typeof e=="string"?o(s,{children:e}):e}),b(t,{gap:2,justifyContent:"flex-end",children:[o(g,{color:l,isFocused:i==="cancel",label:r}),o(g,{color:l,isFocused:i==="confirm",label:p})]})]})}export{E as ConfirmDialog,E as default};
|
package/dist/confirm-input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i,jsxs as x}from"react/jsx-runtime";import p from"@visulima/tui/components/box";import l from"@visulima/tui/components/text";import T from"@visulima/tui/hooks/use-input";import{useRef as m,useCallback as a}from"react";function k({defaultChoice:r="confirm",isDisabled:n=!1,onCancel:o,onConfirm:c,submitOnEnter:f=!0}){const e=m(c);e.current=c;const t=m(o);return t.current=o,T(a((s,u)=>{if(s.toLowerCase()==="y"){e.current();return}if(s.toLowerCase()==="n"){t.current();return}u.return&&f&&(r==="confirm"?e.current():t.current())},[f,r]),{isActive:!n}),i(p,{children:x(l,{dimColor:n,children:[r==="confirm"?"Y":"y","/",r==="cancel"?"N":"n"]})})}export{k as ConfirmInput,k as default};
|
package/dist/console-overlay.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s,jsxs as d}from"react/jsx-runtime";import c from"@visulima/tui/components/box";import l from"@visulima/tui/components/text";import p from"@visulima/tui/hooks/use-console-capture";import{useMemo as g}from"react";const f={debug:"gray",error:"red",info:"blue",log:"white",warn:"yellow"},b={debug:"DBG",error:"ERR",info:"INF",log:"LOG",warn:"WRN"},v=t=>{const r=new Date(t),e=String(r.getHours()).padStart(2,"0"),i=String(r.getMinutes()).padStart(2,"0"),n=String(r.getSeconds()).padStart(2,"0");return`${e}:${i}:${n}`};function E({dock:t="bottom",filter:r,height:e=8,maxEntries:i=200,showLevel:n=!0,showTimestamp:u=!0}){const{entries:m}=p({filter:r,maxEntries:i}),a=g(()=>m.slice(-e),[m,e]);return s(c,{borderBottom:t==="top",borderBottomColor:"gray",borderTop:t==="bottom",borderTopColor:"gray",flexDirection:"column",height:e+1,children:a.length===0?s(l,{dimColor:!0,children:"Console output will appear here..."}):a.map(o=>d(c,{children:[u?d(l,{dimColor:!0,children:["[",v(o.timestamp),"]"," "]}):void 0,n?d(l,{color:f[o.level],children:[b[o.level]," "]}):void 0,s(l,{color:o.level==="error"?"red":o.level==="warn"?"yellow":void 0,children:o.message})]},o.id))})}export{E as ConsoleOverlay,E as default};
|
package/dist/content-switcher.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as f,jsx as x,Fragment as M}from"react/jsx-runtime";import s from"@visulima/tui/components/box";import w from"@visulima/tui/components/text";import C from"@visulima/tui/hooks/use-focus";import F from"@visulima/tui/hooks/use-input";import{useState as j,useMemo as S,useCallback as v}from"react";function H({accentColor:g="blue",autoFocus:I=!1,defaultValue:b,isDisabled:o=!1,onChange:a,options:e,value:i}){const{isFocused:d}=C({autoFocus:I,isActive:!o}),A=b??e[0]?.id,[l,k]=j(A),m=i??l,n=S(()=>{if(m===void 0)return 0;const r=e.findIndex(t=>t.id===m);return Math.max(r,0)},[e,m]),u=v(r=>{const t=e[r];if(!t)return;const c=i??l;t.id!==c&&(i===void 0&&k(t.id),a?.(t.id))},[e,i,l,a]);F(v((r,t)=>{d&&(t.leftArrow||r==="h"?u(Math.max(0,n-1)):(t.rightArrow||r==="l")&&u(Math.min(e.length-1,n+1)))},[d,n,e.length,u]),{isActive:!o&&d});const h=e[n];return f(s,{flexDirection:"column",children:[x(s,{children:e.map((r,t)=>{const c=t===n;return f(w,{backgroundColor:c?g:void 0,color:c?"black":void 0,dimColor:o&&!c,children:[" ",r.icon===void 0?void 0:f(M,{children:[r.icon," "]}),r.label," "]},r.id)})}),h===void 0?void 0:x(s,{flexDirection:"column",marginTop:1,children:h.content})]})}export{H as ContentSwitcher,H as default};
|
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
|
|
1
|
+
import { Props } from '@visulima/tui/components/box';
|
|
2
|
+
import React, { ReactNode, Ref } from 'react';
|
|
3
|
+
interface ControlledScrollViewProps extends Props {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
debug?: boolean;
|
|
6
|
+
onContentHeightChange?: (height: number, previousHeight: number) => void;
|
|
7
|
+
onItemHeightChange?: (index: number, height: number, previousHeight: number) => void;
|
|
8
|
+
onViewportSizeChange?: (size: {
|
|
9
|
+
height: number;
|
|
10
|
+
width: number;
|
|
11
|
+
}, previousSize: {
|
|
12
|
+
height: number;
|
|
13
|
+
width: number;
|
|
14
|
+
}) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Number of extra items to render above/below the viewport when virtualized.
|
|
17
|
+
* @default 3
|
|
18
|
+
*/
|
|
19
|
+
overscan?: number;
|
|
20
|
+
scrollOffset: number;
|
|
21
|
+
/**
|
|
22
|
+
* Only render items visible in the viewport plus overscan.
|
|
23
|
+
* Items must be measured first (first render always renders all items).
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
virtualize?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface ControlledScrollViewRef {
|
|
29
|
+
getBottomOffset: () => number;
|
|
30
|
+
getContentHeight: () => number;
|
|
31
|
+
getItemHeight: (index: number) => number;
|
|
32
|
+
getItemPosition: (index: number) => {
|
|
33
|
+
height: number;
|
|
34
|
+
top: number;
|
|
35
|
+
} | null;
|
|
36
|
+
getViewportHeight: () => number;
|
|
37
|
+
remeasure: () => void;
|
|
38
|
+
remeasureItem: (index: number) => void;
|
|
39
|
+
}
|
|
40
|
+
declare const ControlledScrollView: ({ children, debug, onContentHeightChange, onItemHeightChange, onViewportSizeChange, overscan, ref, scrollOffset, virtualize, ...boxProps }: ControlledScrollViewProps & {
|
|
41
|
+
ref?: Ref<ControlledScrollViewRef>;
|
|
42
|
+
}) => React.JSX.Element;
|
|
43
|
+
export { ControlledScrollView, type ControlledScrollViewProps, type ControlledScrollViewRef };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as r}from"./packem_shared/controlled-scroll-view-
|
|
1
|
+
import{C as r}from"./packem_shared/controlled-scroll-view-BHCYjiKa.js";export{r as ControlledScrollView};
|
package/dist/data-grid.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as
|
|
1
|
+
import{jsxs as k,jsx as f}from"react/jsx-runtime";import h from"@visulima/tui/components/box";import a from"@visulima/tui/components/text";import B from"@visulima/tui/hooks/use-focus";import E from"@visulima/tui/hooks/use-input";import{useState as w,useMemo as j,useCallback as G}from"react";function g(i,o){return o===0?0:(i%o+o)%o}const p=(i,o)=>i.render?i.render(o):String(o[i.key]??""),D=(i,o,n)=>i.length>=o?i.slice(0,o):n==="right"?i.padStart(o):i.padEnd(o);function O({accentColor:i="blue",autoFocus:o=!1,columns:n,data:c,onSelect:y}){const{isFocused:m}=B({autoFocus:o}),[v,C]=w(0),[N,A]=w(0),[d,F]=w(void 0),S=j(()=>n.map(e=>{if(e.width!==void 0)return e.width;let t=e.header.length+2;for(const r of c)t=Math.max(t,p(e,r).length);return t}),[n,c]),l=j(()=>{if(d===void 0)return c;const e=n.find(r=>r.key===d.key);if(e===void 0)return c;const t=d.direction==="asc"?1:-1;return[...c].toSorted((r,s)=>{const u=p(e,r),b=p(e,s),x=Number(u),R=Number(b),$=u.length>0&&b.length>0&&!Number.isNaN(x)&&!Number.isNaN(R);return t*($?x-R:u.localeCompare(b))})},[n,c,d]),M=G((e,t)=>{if(t.upArrow)C(r=>g(r-1,l.length));else if(t.downArrow)C(r=>g(r+1,l.length));else if(t.leftArrow)A(r=>g(r-1,n.length));else if(t.rightArrow)A(r=>g(r+1,n.length));else if(e==="s"){const r=n[N];r!==void 0&&F(s=>s?.key===r.key&&s.direction==="asc"?{direction:"desc",key:r.key}:{direction:"asc",key:r.key})}else if(t.return){const r=l[v];r!==void 0&&y?.(r)}},[N,n,y,v,l]);E(M,{isActive:m});const T=e=>d?.key!==e?"":d.direction==="asc"?" ▲":" ▼";return k(h,{flexDirection:"column",children:[k(h,{children:[f(a,{children:" "}),n.map((e,t)=>f(h,{marginRight:1,children:f(a,{bold:!0,color:m&&t===N?i:void 0,children:D(`${e.header}${T(e.key)}`,S[t],e.align??"left")})},e.key))]}),l.map((e,t)=>{const r=m&&t===v;return k(h,{children:[f(a,{color:r?i:void 0,children:r?"❯":" "}),n.map((s,u)=>f(h,{marginRight:1,children:f(a,{color:r?i:void 0,dimColor:!r,children:D(p(s,e),S[u],s.align??"left")})},s.key))]},t)})]})}export{O as DataGrid,O as default};
|
package/dist/date-picker.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as g,jsx as
|
|
1
|
+
import{jsxs as g,jsx as t}from"react/jsx-runtime";import n from"@visulima/tui/components/box";import s from"@visulima/tui/components/text";import I from"@visulima/tui/hooks/use-focus";import v from"@visulima/tui/hooks/use-input";import{useState as x,useCallback as h}from"react";import{Calendar as $}from"./calendar.js";const j=r=>{const l=r.getFullYear(),u=String(r.getMonth()+1).padStart(2,"0"),c=String(r.getDate()).padStart(2,"0");return`${l}-${u}-${c}`};function M({accentColor:r="blue",autoFocus:l=!1,defaultValue:u,formatValue:c=j,isDisabled:a=!1,maxDate:b,minDate:F,onChange:S,placeholder:k="Pick a date",value:d}){const{isFocused:e}=I({autoFocus:l,isActive:!a}),[o,m]=x(!1),[y,A]=x(u),f=d??y;v(h((i,p)=>{!e||o||(p.return||i===" ")&&m(!0)},[e,o]),{isActive:!a&&e&&!o}),v(h((i,p)=>{p.escape&&m(!1)},[]),{isActive:!a&&e&&o});const C=h(i=>{d===void 0&&A(i),m(!1),S?.(i)},[d,S]);return g(n,{flexDirection:"column",children:[g(n,{borderColor:e?r:void 0,borderStyle:"round",paddingX:1,children:[t(s,{color:r,children:"📅 "}),f===void 0?t(s,{dimColor:!0,children:k}):t(s,{bold:!0,children:c(f)}),e&&!o?t(n,{marginLeft:1,children:t(s,{dimColor:!0,children:"(Enter to open)"})}):void 0]}),o?t(n,{marginTop:1,children:t($,{accentColor:r,autoFocus:!0,defaultValue:f,maxDate:b,minDate:F,onSubmit:C})}):void 0]})}export{M as DatePicker,M as default};
|
package/dist/definition-list.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as r,jsxs as d}from"react/jsx-runtime";import n from"@visulima/tui/components/box";import e from"@visulima/tui/components/text";function u({columnGap:t=2,items:l,layout:f="inline",termColor:o="cyan",termWidth:h}){return f==="stacked"?r(n,{flexDirection:"column",gap:1,children:l.map((i,c)=>d(n,{flexDirection:"column",children:[r(e,{bold:!0,color:o,children:i.term}),r(e,{children:i.description})]},i.key??c))}):r(n,{flexDirection:"column",children:l.map((i,c)=>d(n,{gap:t,children:[r(n,{flexShrink:0,width:h,children:r(e,{color:o,children:i.term})}),r(n,{flexGrow:1,flexShrink:1,children:r(e,{children:i.description})})]},i.key??c))})}export{u as DefinitionList,u as default};
|
package/dist/dialog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
+
import { ScrollViewRef } from "./scroll-view.js";
|
|
2
3
|
import '@visulima/tui/components/box';
|
|
3
|
-
import { b as ScrollViewRef } from "./packem_shared/scroll-view.d-GZcgAHl4.js";
|
|
4
4
|
type Props = {
|
|
5
5
|
/**
|
|
6
6
|
* Background color for the dialog. Defaults to the detected terminal
|
package/dist/dialog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as o,jsxs as C}from"react/jsx-runtime";import l from"@visulima/tui/components/box";import D from"@visulima/tui/components/text";import T from"@visulima/tui/hooks/use-terminal-palette";import z from"@visulima/tui/hooks/use-window-size";import{useRef as I}from"react";import{ScrollView as L}from"./packem_shared/ScrollView-Dt5E9Yl7.js";const A=({backgroundColor:f,borderColor:r="cyan",borderStyle:h="round",children:d,columns:g,footer:c,maxHeight:e=.8,paddingX:n=2,paddingY:b=1,rows:x,scrollbarStyle:w="block",scrollRef:k,title:t,visible:p=!0,width:S=60})=>{const s=z(),{isLoading:y,palette:R}=T(),M=I(null),j=k??M;if(!p)return null;const a=g??(s.columns||80),i=x??(s.rows||24),m=f??(y?"black":R?.background??"black"),B=e<=1?Math.floor(i*e):Math.min(e,i-2),u=typeof t=="string"?o(l,{marginBottom:1,children:o(D,{bold:!0,color:r,children:t})}):t??null;return o(l,{alignItems:"center",height:i,justifyContent:"center",position:"absolute",width:a,children:C(l,{backgroundColor:m,borderBackgroundColor:m,borderColor:r,borderStyle:h,flexDirection:"column",maxHeight:B,opaque:!0,paddingY:b,width:Math.min(S,a-4),children:[u!=null&&o(l,{flexShrink:0,paddingX:n,children:u}),o(L,{flexGrow:1,flexShrink:1,paddingX:n,ref:j,scrollbar:!0,scrollbarColor:r,scrollbarStyle:w,children:d}),c!=null&&o(l,{alignItems:"center",flexDirection:"column",flexShrink:0,marginTop:1,paddingX:n,children:c})]})})};export{A as Dialog,A as default};
|
package/dist/diff-view.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as s,jsxs as p,Fragment as P}from"react/jsx-runtime";import g from"@visulima/tui/components/box";import h from"@visulima/tui/components/text";import{resolveLanguage as E,isLanguageSupported as W,getHighlighter as M,getCachedTokens as _,renderTokenLine as $}from"@visulima/tui/highlighter";import B from"@visulima/tui/hooks/use-window-size";import{createPatch as F,parsePatch as T,diffWords as V,diffChars as j}from"diff";import{useMemo as x,useState as A,useRef as R,useEffect as z}from"react";const v=(i,r,n,l)=>{if(!r||n===void 0||n<1||n>r.length)return l?s(h,{color:l,children:i}):s(h,{dimColor:!0,children:i});const o=r[n-1];return!o||o.length===0?l?s(h,{color:l,children:i}):s(h,{dimColor:!0,children:i}):$(o)},y=(i,r,n)=>{const[l,o]=A(null),u=R(!1);return z(()=>{if(u.current=!1,!r){o(null);return}const e=E(r);if(!W(e)){o(null);return}return(async()=>{try{const f=await M([e],n),c=_(f,i,e,n);u.current||o(c.tokens)}catch{u.current||o(null)}})(),()=>{u.current=!0}},[i,r,n]),l},G=(i,r,n="chars")=>{const l=T(i),o=[];for(const u of l)for(const e of u.hunks){const f=`@@ -${e.oldStart},${e.oldLines} +${e.newStart},${e.newLines} @@`,c=[];let a=e.oldStart,d=e.newStart;for(const N of e.lines)N.startsWith("\\")||(N.startsWith("+")?c.push({content:N.slice(1),newLineNum:d++,type:"add"}):N.startsWith("-")?c.push({content:N.slice(1),oldLineNum:a++,type:"del"}):c.push({content:N.slice(1),newLineNum:d++,oldLineNum:a++,type:"context"}));if(r){const N=U(c);for(const[L,t]of N)if(c[L].type==="del"&&c[t].type==="add"){const m=H(c[L].content,c[t].content,n);c[L].inlineDiff=m??void 0,c[L].pairedIndex=t,c[t].inlineDiff=m??void 0,c[t].pairedIndex=L}}o.push({header:f,lines:c})}return o},I=500,H=(i,r,n="chars")=>{if(i.length>I||r.length>I)return null;const l=n==="words"?V(i,r):j(i,r),o=[],u=[];for(const e of l)e.removed?o.push({highlight:!0,value:e.value}):e.added?u.push({highlight:!0,value:e.value}):(o.push({highlight:!1,value:e.value}),u.push({highlight:!1,value:e.value}));return{addParts:u,delParts:o}},D=(i,r,n)=>s(P,{children:i.map((l,o)=>l.highlight?s(h,{backgroundColor:n,color:"white",children:l.value},o):s(h,{color:r,children:l.value},o))}),U=i=>{const r=new Map;let n=0;for(;n<i.length;){const l=n;for(;n<i.length&&i[n].type==="del";)n++;const o=n,u=n;for(;n<i.length&&i[n].type==="add";)n++;const e=n,f=o-l,c=e-u,a=Math.min(f,c);for(let d=0;d<a;d++)r.set(l+d,u+d),r.set(u+d,l+d);n===l&&n++}return r};function X({hunks:i,newHighlighted:r,oldHighlighted:n,showLineNumbers:l}){return s(g,{flexDirection:"column",children:i.map((o,u)=>p(g,{flexDirection:"column",children:[u>0?s(g,{marginBottom:0,marginTop:0,children:s(h,{dimColor:!0,children:"···"})}):void 0,s(h,{color:"cyan",dimColor:!0,children:o.header}),o.lines.map((e,f)=>{let c,a,d;switch(e.type){case"add":{a="+",d="green",c=e.inlineDiff?D(e.inlineDiff.addParts,"green","green"):v(e.content,r,e.newLineNum,"green");break}case"del":{a="-",d="red",c=e.inlineDiff?D(e.inlineDiff.delParts,"red","red"):v(e.content,n,e.oldLineNum,"red");break}default:{a=" ",d=void 0,c=v(e.content,n,e.oldLineNum);break}}return p(g,{children:[l?p(h,{color:d,dimColor:e.type==="context",children:[String(e.oldLineNum??"").padStart(4)," ",String(e.newLineNum??"").padStart(4)," "]}):void 0,s(h,{color:d,children:a}),c]},f)})]},u))})}function q({hunks:i,newHighlighted:r,oldHighlighted:n,showLineNumbers:l,width:o}){const u=Math.floor(o/2)-1;return s(g,{flexDirection:"column",children:i.map((e,f)=>{const c=f>0?s(g,{marginBottom:0,marginTop:0,children:s(h,{dimColor:!0,children:"···"})}):void 0,a=[],d=[];for(let L=0;L<e.lines.length;L++){const t=e.lines[L];switch(t.type){case"add":{t.pairedIndex===void 0&&(a.push({content:s(h,{dimColor:!0})}),d.push({content:v(t.content,r,t.newLineNum,"green"),lineNum:t.newLineNum}));break}case"context":{a.push({content:v(t.content,n,t.oldLineNum),lineNum:t.oldLineNum}),d.push({content:v(t.content,r,t.newLineNum),lineNum:t.newLineNum});break}case"del":{if(t.pairedIndex===void 0)a.push({content:v(t.content,n,t.oldLineNum,"red"),lineNum:t.oldLineNum}),d.push({content:s(h,{dimColor:!0})});else{const m=e.lines[t.pairedIndex];a.push({content:t.inlineDiff?D(t.inlineDiff.delParts,"red","red"):v(t.content,n,t.oldLineNum,"red"),lineNum:t.oldLineNum}),d.push({content:m.inlineDiff?D(m.inlineDiff.addParts,"green","green"):v(m.content,r,m.newLineNum,"green"),lineNum:m.newLineNum})}break}}}const N=Math.max(a.length,d.length);return p(g,{flexDirection:"column",children:[c,s(h,{color:"cyan",dimColor:!0,children:e.header}),Array.from({length:N},(L,t)=>{const m=a[t],w=d[t];return p(g,{flexDirection:"row",children:[p(g,{width:u,children:[l?p(h,{dimColor:!0,children:[String(m?.lineNum??"").padStart(4)," "]}):void 0,m?.content]}),s(h,{dimColor:!0,children:"│"}),p(g,{width:u,children:[l?p(h,{dimColor:!0,children:[String(w?.lineNum??"").padStart(4)," "]}):void 0,w?.content]})]},t)})]},f)})})}function ee({context:i=3,diff:r,inlineDiff:n=!0,inlineDiffMode:l="chars",language:o,mode:u="unified",newLabel:e="new",newText:f="",oldLabel:c="old",oldText:a="",showLineNumbers:d=!0,theme:N="github-dark-default"}){const{columns:L}=B(),t=y(a,o,N),m=y(f,o,N),w=x(()=>r||F("file",a,f,c,e,{context:i}),[r,a,f,c,e,i]),S=x(()=>G(w,n,l),[w,n,l]);if(S.every(k=>k.lines.length===0))return s(g,{children:s(h,{dimColor:!0,children:"No differences found."})});const C=p(g,{flexDirection:"column",children:[p(h,{color:"red",dimColor:!0,children:["---"," ",c]}),p(h,{color:"green",dimColor:!0,children:["+++"," ",e]})]});return u==="split"?p(g,{flexDirection:"column",children:[C,s(q,{hunks:S,newHighlighted:m,oldHighlighted:t,showLineNumbers:d,width:L??80})]}):p(g,{flexDirection:"column",children:[C,s(X,{hunks:S,newHighlighted:m,oldHighlighted:t,showLineNumbers:d})]})}export{ee as DiffView,ee as default};
|
package/dist/digits.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as n}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as n}from"react/jsx-runtime";import p from"@visulima/tui/components/box";import f from"@visulima/tui/components/text";const x={" ":[" "," "," "],0:[" ▄ ","█ █","▀▄▀"],1:[" ▄ "," █ "," ▪ "],2:["▄▄ "," ▄▀","▀▄▄"],3:["▄▄ "," ▄▀","▄▄▀"],4:[" ","█▄█"," █"],5:["▄▄▄","█▄ ","▄▄▀"],6:[" ▄ ","█▄ ","▀▄▀"],7:["▄▄▄"," █"," █ "],8:[" ▄ ","▄▀▄","▀▄▀"],9:[" ▄ ","▀▄█"," ▄▀"],"-":[" "," ─ "," "],".":[" "," "," ▪ "],":":[" "," ▪ "," ▪ "]},h=[" "," ? "," "];function g({color:c="cyan",gap:e=1,value:s}){const a=String(s),i=" ".repeat(Math.max(0,e)),r=[];for(const t of a)r.push(t);const m=[0,1,2].map(t=>r.map(o=>(x[o]??h)[t]).join(i));return n(p,{flexDirection:"column",children:m.map((t,o)=>n(f,{color:c,children:t},o))})}export{g as Digits,g as default};
|
package/dist/directory-tree.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as w,jsxs as A}from"react/jsx-runtime";import E from"@visulima/tui/components/box";import g from"@visulima/tui/components/text";import C from"@visulima/tui/hooks/use-focus";import T from"@visulima/tui/hooks/use-input";import{useState as b,useMemo as B,useCallback as D}from"react";function $(i,t){return t===0?0:(i%t+t)%t}function H(i,t){return i?t?"▾ 📁":"▸ 📁":" 📄"}const F=(i,t,u,d,l,f)=>{for(const c of i){const a=`${d}/${c.name}`,h=[...l,c.name];f.push({depth:u,id:a,node:c,path:h}),c.type==="directory"&&c.children!==void 0&&t.has(a)&&F(c.children,t,u+1,a,h,f)}},S=(i,t,u)=>{for(const d of i){const l=`${t}/${d.name}`;d.type==="directory"&&d.children!==void 0&&(u.add(l),S(d.children,l,u))}};function K({accentColor:i="blue",autoFocus:t=!1,defaultExpanded:u=!1,directoryColor:d="cyan",nodes:l,onSelect:f}){const{isFocused:c}=C({autoFocus:t}),[a,h]=b(()=>{if(!u)return new Set;const r=new Set;return S(l,"",r),r}),[m,v]=b(0),p=B(()=>{const r=[];return F(l,a,0,"",[],r),r},[a,l]),y=D((r,e)=>{h(n=>{const o=new Set(n);return e??!o.has(r)?o.add(r):o.delete(r),o})},[]),j=D((r,e)=>{const n=p[m];if(e.upArrow){v(s=>$(s-1,p.length));return}if(e.downArrow){v(s=>$(s+1,p.length));return}if(n===void 0)return;const o=n.node.type==="directory";if(o&&n.node.children!==void 0&&(r===" "||e.rightArrow||e.leftArrow)){let s;e.rightArrow?s=!0:e.leftArrow&&(s=!1),y(n.id,s);return}e.return&&!o&&f?.(n.path)},[m,f,p,y]);return T(j,{isActive:c}),w(E,{flexDirection:"column",children:p.map((r,e)=>{const n=c&&e===m,o=r.node.type==="directory",x=a.has(r.id),s=H(o,x);return A(E,{children:[w(g,{color:n?i:void 0,children:n?"❯":" "}),w(g,{children:" ".repeat(r.depth)}),A(g,{color:o?d:void 0,children:[s," ",r.node.name]})]},r.id)})})}export{K as DirectoryTree,K as default};
|