@visulima/tui-kit 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/accordion.js +1 -1
  3. package/dist/alert.js +1 -1
  4. package/dist/animate-presence.js +1 -1
  5. package/dist/approval-prompt.js +1 -1
  6. package/dist/area-chart.js +1 -1
  7. package/dist/badge.js +1 -1
  8. package/dist/bar-chart.js +1 -1
  9. package/dist/big-text.js +1 -1
  10. package/dist/blink-dot.js +1 -1
  11. package/dist/breadcrumb.js +1 -1
  12. package/dist/button.js +1 -1
  13. package/dist/calendar.js +1 -1
  14. package/dist/card.js +1 -1
  15. package/dist/checkbox-group.js +1 -1
  16. package/dist/checkbox.js +1 -1
  17. package/dist/code.js +2 -2
  18. package/dist/collapsible.js +1 -1
  19. package/dist/color-picker.js +1 -1
  20. package/dist/command-block.js +4 -4
  21. package/dist/command-palette.js +1 -1
  22. package/dist/confirm-dialog.js +1 -1
  23. package/dist/confirm-input.js +1 -1
  24. package/dist/console-overlay.js +1 -1
  25. package/dist/content-switcher.js +1 -1
  26. package/dist/controlled-scroll-view.d.ts +43 -3
  27. package/dist/controlled-scroll-view.js +1 -1
  28. package/dist/data-grid.js +1 -1
  29. package/dist/date-picker.js +1 -1
  30. package/dist/definition-list.js +1 -1
  31. package/dist/dialog.d.ts +1 -1
  32. package/dist/dialog.js +1 -1
  33. package/dist/diff-view.js +1 -1
  34. package/dist/digits.js +1 -1
  35. package/dist/directory-tree.js +1 -1
  36. package/dist/divider.js +1 -1
  37. package/dist/drawer.js +1 -1
  38. package/dist/file-change.js +1 -1
  39. package/dist/file-picker-entry.d.ts +92 -2
  40. package/dist/file-picker-entry.js +1 -1
  41. package/dist/form.js +1 -1
  42. package/dist/gauge.js +1 -1
  43. package/dist/gradient.js +1 -1
  44. package/dist/grid.js +1 -1
  45. package/dist/heading.js +1 -1
  46. package/dist/heatmap.js +1 -1
  47. package/dist/help.js +1 -1
  48. package/dist/histogram.js +1 -1
  49. package/dist/image.js +1 -1
  50. package/dist/index.d.ts +25 -9
  51. package/dist/index.js +1 -1
  52. package/dist/json.js +1 -1
  53. package/dist/kbd.js +1 -1
  54. package/dist/line-chart.js +1 -1
  55. package/dist/link.js +1 -1
  56. package/dist/loading-indicator.js +1 -1
  57. package/dist/log.js +1 -1
  58. package/dist/markdown.js +1 -1
  59. package/dist/masked-input.js +1 -1
  60. package/dist/menu.js +1 -1
  61. package/dist/message-bubble.js +1 -1
  62. package/dist/model-badge.js +1 -1
  63. package/dist/model-selector.js +1 -1
  64. package/dist/multi-progress.js +1 -1
  65. package/dist/multi-select.js +1 -1
  66. package/dist/notification-badge.js +1 -1
  67. package/dist/number-input.js +1 -1
  68. package/dist/operation-tree.js +1 -1
  69. package/dist/option-list.js +1 -1
  70. package/dist/ordered-list.js +1 -1
  71. package/dist/packem_shared/ControlledScrollView-soZtm3m7.js +1 -0
  72. package/dist/packem_shared/FilePicker-KGAg6v5x.js +1 -0
  73. package/dist/packem_shared/ScrollBar-arHRP6OT.js +1 -0
  74. package/dist/packem_shared/ScrollBarBox-C8wZ_Slk.js +1 -0
  75. package/dist/packem_shared/ScrollList-BCqHHps6.js +1 -0
  76. package/dist/packem_shared/ScrollView-Dt5E9Yl7.js +1 -0
  77. package/dist/packem_shared/TreeNodeMap-BK7nRlt0.js +1 -0
  78. package/dist/packem_shared/TreeView-BEZAFOfr.js +1 -0
  79. package/dist/packem_shared/controlled-scroll-view-BHCYjiKa.js +1 -0
  80. package/dist/packem_shared/line-chart-BqOUjZTt.js +1 -0
  81. package/dist/packem_shared/treeViewTheme-DuCcyBDe.js +1 -0
  82. package/dist/packem_shared/useTreeView-Dt_iWxVs.js +1 -0
  83. package/dist/packem_shared/useTreeViewState-aHwNZhIE.js +1 -0
  84. package/dist/packem_shared/{variant-config-BJqpNo7H.js → variant-config-BnAmf1rP.js} +1 -1
  85. package/dist/paginator.js +1 -1
  86. package/dist/paragraph.js +1 -1
  87. package/dist/path-input.js +1 -1
  88. package/dist/pie-chart.js +1 -1
  89. package/dist/placeholder.js +1 -1
  90. package/dist/popover.js +1 -1
  91. package/dist/progress-bar.js +1 -1
  92. package/dist/progress-circle.js +1 -1
  93. package/dist/qr-code.js +1 -1
  94. package/dist/radio-group.js +1 -1
  95. package/dist/scatter-plot.js +1 -1
  96. package/dist/scroll-bar-box.d.ts +13 -3
  97. package/dist/scroll-bar-box.js +1 -1
  98. package/dist/scroll-bar.d.ts +18 -3
  99. package/dist/scroll-bar.js +1 -1
  100. package/dist/scroll-list.d.ts +12 -3
  101. package/dist/scroll-list.js +1 -1
  102. package/dist/scroll-view.d.ts +98 -3
  103. package/dist/scroll-view.js +1 -1
  104. package/dist/search-input.js +1 -1
  105. package/dist/select-input-indicator.js +1 -1
  106. package/dist/select-input-item.js +1 -1
  107. package/dist/select-input.js +1 -1
  108. package/dist/shimmer-text.js +1 -1
  109. package/dist/sidebar.js +1 -1
  110. package/dist/slider.js +1 -1
  111. package/dist/sparkline.js +1 -1
  112. package/dist/spinner.js +1 -1
  113. package/dist/status-line.js +1 -1
  114. package/dist/status-message.js +1 -1
  115. package/dist/stepper.js +1 -1
  116. package/dist/stopwatch.js +1 -1
  117. package/dist/streaming-text.js +1 -1
  118. package/dist/switch.js +1 -1
  119. package/dist/tab.js +1 -1
  120. package/dist/table.js +1 -1
  121. package/dist/tabs.js +1 -1
  122. package/dist/tag-input.js +1 -1
  123. package/dist/tag.js +1 -1
  124. package/dist/text-input.js +1 -1
  125. package/dist/textarea.js +2 -2
  126. package/dist/thinking-block.js +1 -1
  127. package/dist/time-picker.js +1 -1
  128. package/dist/timer.js +1 -1
  129. package/dist/toast.js +1 -1
  130. package/dist/token-usage.js +1 -1
  131. package/dist/tool-call.js +1 -1
  132. package/dist/tooltip.js +1 -1
  133. package/dist/transition.js +1 -1
  134. package/dist/tree-select.js +1 -1
  135. package/dist/tree-view-entry.d.ts +314 -4
  136. package/dist/tree-view-entry.js +1 -1
  137. package/dist/unordered-list.js +1 -1
  138. package/dist/use-linked-scroll.d.ts +1 -1
  139. package/dist/use-linked-scroll.js +1 -1
  140. package/package.json +7 -7
  141. package/dist/packem_shared/ControlledScrollView-BzlbIUph.js +0 -1
  142. package/dist/packem_shared/FilePicker-V5H2fb-v.js +0 -1
  143. package/dist/packem_shared/ScrollBar-C9i3z3Ft.js +0 -1
  144. package/dist/packem_shared/ScrollBarBox-DZEC8YnV.js +0 -1
  145. package/dist/packem_shared/ScrollList-Djtb2vVy.js +0 -1
  146. package/dist/packem_shared/ScrollView-ESxpl6Hy.js +0 -1
  147. package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
  148. package/dist/packem_shared/TreeView-q0l446NV.js +0 -1
  149. package/dist/packem_shared/controlled-scroll-view-DerVKKv6.js +0 -1
  150. package/dist/packem_shared/controlled-scroll-view.d-D3kZZzjI.d.ts +0 -43
  151. package/dist/packem_shared/file-picker.d-CH7pccC7.d.ts +0 -92
  152. package/dist/packem_shared/line-chart-BbhMhcZg.js +0 -1
  153. package/dist/packem_shared/scroll-bar-box.d-CpTYEcTZ.d.ts +0 -13
  154. package/dist/packem_shared/scroll-bar.d-B4sD1hBR.d.ts +0 -18
  155. package/dist/packem_shared/scroll-list.d-CPCF0RwC.d.ts +0 -12
  156. package/dist/packem_shared/scroll-view.d-GZcgAHl4.d.ts +0 -98
  157. package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
  158. package/dist/packem_shared/use-tree-view.d-DeMQ6G2r.d.ts +0 -314
  159. package/dist/packem_shared/useTreeView-D0JEqT6W.js +0 -1
  160. package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
package/dist/drawer.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as s,jsx as r}from"react/jsx-runtime";import e from"@visulima/tui/components/box";import m from"@visulima/tui/components/text";import a from"@visulima/tui/hooks/use-input";import{useCallback as h}from"react";function j({accentColor:i="blue",children:u,isOpen:t,onClose:n,side:l="right",size:c=32,title:o}){const f=h((b,p)=>{p.escape&&n?.()},[n]);if(a(f,{isActive:t}),!t)return null;const d=l==="left"||l==="right";return s(e,{borderColor:i,borderStyle:"round",flexDirection:"column",height:d?void 0:c,paddingX:1,width:d?c:void 0,children:[o===void 0?void 0:s(e,{justifyContent:"space-between",children:[r(m,{bold:!0,color:i,children:o}),r(m,{dimColor:!0,children:"esc"})]}),r(e,{flexDirection:"column",marginTop:o===void 0?0:1,children:u})]})}export{j as Drawer,j as default};
1
+ import{jsxs as c,jsx as o}from"react/jsx-runtime";import i from"@visulima/tui/components/box";import m from"@visulima/tui/components/text";import h from"@visulima/tui/hooks/use-input";import{useCallback as s}from"react";function D({accentColor:e="blue",children:f,isOpen:t,onClose:n,side:d="right",size:l=32,title:r}){const p=s((x,a)=>{a.escape&&n?.()},[n]);if(h(p,{isActive:t}),!t)return null;const u=d==="left"||d==="right";return c(i,{borderColor:e,borderStyle:"round",flexDirection:"column",height:u?void 0:l,paddingX:1,width:u?l:void 0,children:[r===void 0?void 0:c(i,{justifyContent:"space-between",children:[o(m,{bold:!0,color:e,children:r}),o(m,{dimColor:!0,children:"esc"})]}),o(i,{flexDirection:"column",marginTop:r===void 0?0:1,children:f})]})}export{D as Drawer,D as default};
@@ -1 +1 @@
1
- import{jsxs as c,jsx as r}from"react/jsx-runtime";import m from"@visulima/tui/components/box";import e from"@visulima/tui/components/text";const u={added:{color:"green",mark:"A"},deleted:{color:"red",mark:"D"},modified:{color:"yellow",mark:"M"},renamed:{color:"blue",mark:"R"}};function k({additions:l=0,barWidth:o=10,deletions:t=0,path:h,status:s="modified"}){const n=u[s],d=l+t,i=d===0?0:Math.round(l/d*o),a=d===0?0:Math.min(o-i,Math.round(t/d*o));return c(m,{gap:1,children:[r(e,{bold:!0,color:n.color,children:n.mark}),r(e,{children:h}),r(e,{color:"green",children:`+${l}`}),r(e,{color:"red",children:`-${t}`}),c(m,{children:[r(e,{color:"green",children:"▰".repeat(i)}),r(e,{color:"red",children:"▰".repeat(a)}),r(e,{dimColor:!0,children:"▱".repeat(Math.max(0,o-i-a))})]})]})}export{k as FileChange,k as default};
1
+ import{jsxs as a,jsx as r}from"react/jsx-runtime";import i from"@visulima/tui/components/box";import e from"@visulima/tui/components/text";const p={added:{color:"green",mark:"A"},deleted:{color:"red",mark:"D"},modified:{color:"yellow",mark:"M"},renamed:{color:"blue",mark:"R"}};function M({additions:c=0,barWidth:o=10,deletions:n=0,path:h,status:u="modified"}){const t=p[u],l=c+n,m=l===0?0:Math.round(c/l*o),d=l===0?0:Math.min(o-m,Math.round(n/l*o));return a(i,{gap:1,children:[r(e,{bold:!0,color:t.color,children:t.mark}),r(e,{children:h}),r(e,{color:"green",children:`+${c}`}),r(e,{color:"red",children:`-${n}`}),a(i,{children:[r(e,{color:"green",children:"▰".repeat(m)}),r(e,{color:"red",children:"▰".repeat(d)}),r(e,{dimColor:!0,children:"▱".repeat(Math.max(0,o-m-d))})]})]})}export{M as FileChange,M as default};
@@ -1,2 +1,92 @@
1
- export { type F as FileEntry, a as FilePicker, type b as FilePickerFilter, type P as FilePickerProps, a as default } from "./packem_shared/file-picker.d-CH7pccC7.js";
2
- import 'react';
1
+ import { ReactElement } from 'react';
2
+ /**
3
+ * A single entry (file or directory) returned by the file system hook.
4
+ */
5
+ type FileEntry = {
6
+ readonly isDirectory: boolean;
7
+ readonly isHidden: boolean;
8
+ readonly name: string;
9
+ readonly path: string;
10
+ readonly permissions: string;
11
+ readonly size: number;
12
+ };
13
+ /**
14
+ * Filter options for the file picker.
15
+ */
16
+ type FilePickerFilter = {
17
+ /**
18
+ * Allowed file extensions (e.g. `[".ts", ".tsx"]`). Empty or omitted means all.
19
+ */
20
+ readonly extensions?: ReadonlyArray<string>;
21
+ /**
22
+ * Whether to include directories in the list.
23
+ * @default true
24
+ */
25
+ readonly showDirectories?: boolean;
26
+ /**
27
+ * Whether to include regular files in the list.
28
+ * @default true
29
+ */
30
+ readonly showFiles?: boolean;
31
+ /**
32
+ * Whether to include hidden files (names starting with `.`).
33
+ * @default false
34
+ */
35
+ readonly showHidden?: boolean;
36
+ };
37
+ type Props = {
38
+ /**
39
+ * Color for the focused item highlight.
40
+ * @default "cyan"
41
+ */
42
+ readonly accentColor?: string;
43
+ /**
44
+ * Color for directory entries.
45
+ * @default "blue"
46
+ */
47
+ readonly directoryColor?: string;
48
+ /**
49
+ * Color for file entries.
50
+ * @default "white"
51
+ */
52
+ readonly fileColor?: string;
53
+ /**
54
+ * File filter options.
55
+ */
56
+ readonly filter?: FilePickerFilter;
57
+ /**
58
+ * Starting directory path.
59
+ * @default process.cwd()
60
+ */
61
+ readonly initialPath?: string;
62
+ /**
63
+ * Whether keyboard navigation is active.
64
+ * @default true
65
+ */
66
+ readonly isFocused?: boolean;
67
+ /**
68
+ * Maximum number of visible items (viewport height).
69
+ * @default 10
70
+ */
71
+ readonly limit?: number;
72
+ /**
73
+ * Called when escape is pressed.
74
+ */
75
+ readonly onCancel?: () => void;
76
+ /**
77
+ * Called when a file is selected (enter on a file entry).
78
+ */
79
+ readonly onSelect?: (entry: FileEntry) => void;
80
+ /**
81
+ * Show file permissions column.
82
+ * @default false
83
+ */
84
+ readonly showPermissions?: boolean;
85
+ /**
86
+ * Show file size column.
87
+ * @default false
88
+ */
89
+ readonly showSize?: boolean;
90
+ };
91
+ declare const FilePicker: ({ accentColor, directoryColor, fileColor, filter, initialPath, isFocused, limit, onCancel, onSelect, showPermissions, showSize }: Props) => ReactElement;
92
+ export { type FileEntry, FilePicker, type FilePickerFilter, type Props as FilePickerProps, FilePicker as default };
@@ -1 +1 @@
1
- import{default as f,default as l}from"./packem_shared/FilePicker-V5H2fb-v.js";export{f as FilePicker,l as default};
1
+ import{default as f,default as l}from"./packem_shared/FilePicker-KGAg6v5x.js";export{f as FilePicker,l as default};
package/dist/form.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as m,jsx as r}from"react/jsx-runtime";import o from"@visulima/tui/components/box";import i from"@visulima/tui/components/text";const a=({children:e,description:d,error:l,isDisabled:n=!1,label:c,required:t=!1})=>m(o,{flexDirection:"column",marginBottom:1,children:[m(o,{children:[r(i,{bold:!0,dimColor:n,children:c}),t?r(i,{color:"red",children:" *"}):void 0]}),r(o,{marginTop:0,children:e}),l===void 0?d===void 0?void 0:r(i,{dimColor:!0,children:d}):r(i,{color:"red",children:l})]}),b=Object.assign(({accentColor:e="blue",bordered:d=!0,children:l,description:n,footer:c,title:t,width:h})=>{const s=m(o,{flexDirection:"column",children:[t===void 0?void 0:r(o,{marginBottom:1,children:r(i,{bold:!0,color:e,children:t})}),n===void 0?void 0:r(o,{marginBottom:1,children:r(i,{dimColor:!0,children:n})}),r(o,{flexDirection:"column",children:l}),c===void 0?void 0:r(o,{marginTop:1,children:c})]});return d?r(o,{borderColor:e,borderStyle:"round",flexDirection:"column",paddingX:1,paddingY:1,width:h,children:s}):r(o,{flexDirection:"column",width:h,children:s})},{Field:a});export{b as Form,a as FormField,b as default};
1
+ import{jsxs as t,jsx as o}from"react/jsx-runtime";import r from"@visulima/tui/components/box";import i from"@visulima/tui/components/text";const a=({children:e,description:d,error:l,isDisabled:n=!1,label:c,required:m=!1})=>t(r,{flexDirection:"column",marginBottom:1,children:[t(r,{children:[o(i,{bold:!0,dimColor:n,children:c}),m?o(i,{color:"red",children:" *"}):void 0]}),o(r,{marginTop:0,children:e}),l===void 0?d===void 0?void 0:o(i,{dimColor:!0,children:d}):o(i,{color:"red",children:l})]}),s=Object.assign(({accentColor:e="blue",bordered:d=!0,children:l,description:n,footer:c,title:m,width:u})=>{const h=t(r,{flexDirection:"column",children:[m===void 0?void 0:o(r,{marginBottom:1,children:o(i,{bold:!0,color:e,children:m})}),n===void 0?void 0:o(r,{marginBottom:1,children:o(i,{dimColor:!0,children:n})}),o(r,{flexDirection:"column",children:l}),c===void 0?void 0:o(r,{marginTop:1,children:c})]});return d?o(r,{borderColor:e,borderStyle:"round",flexDirection:"column",paddingX:1,paddingY:1,width:u,children:h}):o(r,{flexDirection:"column",width:u,children:h})},{Field:a});export{s as Form,a as FormField,s as default};
package/dist/gauge.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as j,jsx as l}from"react/jsx-runtime";import{createBrailleGrid as U}from"@visulima/tui/canvas";import c from"@visulima/tui/components/box";import W from"@visulima/tui/components/canvas";import p from"@visulima/tui/components/text";import{useMemo as q}from"react";const X={large:{cols:40,rows:10},medium:{cols:24,rows:6},small:{cols:16,rows:4}},_=.9,T=2,Y=r=>String(Math.round(r)),z=(r,u,d,e)=>{const t=u+(d-u)*e;for(const f of r)if(t<=f.max)return f;return r[r.length-1]};function io({backgroundColor:r="gray",formatValue:u=Y,label:d,max:e=100,min:t=0,showLegend:f=!1,showValue:C=!0,size:b="medium",thresholds:i,value:P}){const{cols:A,rows:E}=X[b],I=Math.max(t,Math.min(e,P)),F=e-t||1,M=(I-t)/F,s=q(()=>{if(!(i===void 0||i.length===0))return[...i].toSorted((o,h)=>o.max-h.max)},[i]),D=q(()=>{if(s!==void 0)return z(s,t,e,M)},[s,t,e,M]),G=u(I);return j(c,{flexDirection:"column",children:[l(W,{draw:o=>{o.clear();const h=o.width*2,L=o.height*4,x=h/2,v=L-1,H=h/2-1,J=L-1,g=Math.max(1,Math.min(H,J)),y=new Map,S=n=>{const a=y.get(n);if(a!==void 0)return a;const m=U(o.width,o.height);return y.set(n,m),m},V=Math.max(32,Math.round(Math.PI*g)*T);for(let n=0;n<=V;n+=1){const a=n/V,m=Math.PI*(1-a),Q=Math.round(x+g*Math.cos(m)),R=Math.round(v-g*Math.sin(m));let w;a>M?w=r:s?w=z(s,t,e,a)?.color??"cyan":w="cyan",S(w).plotPoint(Q,R)}const k=g*_,B=Math.PI*(1-M),K=Math.round(x+k*Math.cos(B)),N=Math.round(v-k*Math.sin(B)),O=D?.color??"white";S(O).plotLine(Math.round(x),Math.round(v),K,N);for(const[n,a]of y)a.flush(o,{color:n})},height:E,version:[P,t,e,b,i,r],width:A}),C||d?j(c,{flexDirection:"column",children:[d===void 0?void 0:l(c,{justifyContent:"center",children:l(p,{dimColor:!0,children:d})}),C?l(c,{justifyContent:"center",children:l(p,{bold:!0,color:D?.color??"white",children:G})}):void 0]}):void 0,f&&i&&i.length>0?l(c,{gap:2,justifyContent:"center",marginTop:1,children:i.map((o,h)=>j(c,{gap:1,children:[l(p,{color:o.color,children:"●"}),l(p,{dimColor:!0,children:o.label??`≤ ${o.max}`})]},h))}):void 0]})}export{io as Gauge,io as default};
1
+ import{jsxs as C,jsx as s}from"react/jsx-runtime";import{createBrailleGrid as K}from"@visulima/tui/canvas";import d from"@visulima/tui/components/box";import Q from"@visulima/tui/components/canvas";import v from"@visulima/tui/components/text";import{useMemo as L}from"react";const U={large:{cols:40,rows:10},medium:{cols:24,rows:6},small:{cols:16,rows:4}},V=.9,Y=2,b=n=>String(Math.round(n)),B=(n,f,l,r)=>{const t=f+(l-f)*r;for(const g of n)if(t<=g.max)return g;return n[n.length-1]};function so({backgroundColor:n="gray",formatValue:f=b,label:l,max:r=100,min:t=0,showLegend:g=!1,showValue:E=!0,size:P="medium",thresholds:e,value:S}){const{cols:D,rows:F}=U[P],I=Math.max(t,Math.min(r,S)),N=r-t||1,m=(I-t)/N,u=L(()=>{if(!(e===void 0||e.length===0))return[...e].toSorted((o,a)=>o.max-a.max)},[e]),R=L(()=>{if(u!==void 0)return B(u,t,r,m)},[u,t,r,m]),H=f(I);return C(d,{flexDirection:"column",children:[s(Q,{draw:o=>{o.clear();const a=o.width*2,T=o.height*4,x=a/2,y=T-1,O=a/2-1,W=T-1,p=Math.max(1,Math.min(O,W)),w=new Map,j=i=>{const c=w.get(i);if(c!==void 0)return c;const h=K(o.width,o.height);return w.set(i,h),h},A=Math.max(32,Math.round(Math.PI*p)*Y);for(let i=0;i<=A;i+=1){const c=i/A,h=Math.PI*(1-c),q=Math.round(x+p*Math.cos(h)),J=Math.round(y-p*Math.sin(h));let M;c>m?M=n:u?M=B(u,t,r,c)?.color??"cyan":M="cyan",j(M).plotPoint(q,J)}const G=p*V,_=Math.PI*(1-m),X=Math.round(x+G*Math.cos(_)),Z=Math.round(y-G*Math.sin(_)),$=R?.color??"white";j($).plotLine(Math.round(x),Math.round(y),X,Z);for(const[i,c]of w)c.flush(o,{color:i})},height:F,version:[S,t,r,P,e,n],width:D}),E||l?C(d,{flexDirection:"column",children:[l===void 0?void 0:s(d,{justifyContent:"center",children:s(v,{dimColor:!0,children:l})}),E?s(d,{justifyContent:"center",children:s(v,{bold:!0,color:R?.color??"white",children:H})}):void 0]}):void 0,g&&e&&e.length>0?s(d,{gap:2,justifyContent:"center",marginTop:1,children:e.map((o,a)=>C(d,{gap:1,children:[s(v,{color:o.color,children:"●"}),s(v,{dimColor:!0,children:o.label??`≤ ${o.max}`})]},a))}):void 0]})}export{so as Gauge,so as default};
package/dist/gradient.js CHANGED
@@ -1 +1 @@
1
- import{jsx as s,Fragment as B}from"react/jsx-runtime";import{strip as F}from"@visulima/ansi";import{multilineGradient as k}from"@visulima/colorize/gradient";import C from"@visulima/tui/components/box";import S from"@visulima/tui/components/text";import b from"@visulima/tui/components/transform";import{useMemo as M,Children as g,isValidElement as T,cloneElement as y}from"react";const O={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"]},cristal:{colors:["#bdfff3","#4ac29a"]},fruit:{colors:["#ff4e50","#f9d423"]},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"]},mind:{colors:["#473b7b","#3584a7","#30d2be"]},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"]},pastel:{colors:["#74ebd5","#74ecd5"],options:{hsvSpin:"long",interpolation:"hsv"}},rainbow:{colors:["#ff0000","#ff0100"],options:{hsvSpin:"long",interpolation:"hsv"}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"]},summer:{colors:["#fdbb2d","#22c1c3"]},teen:{colors:["#77a1d3","#79cbca","#e684ae"]},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}}},j=o=>{let t=!1;const n=u=>{g.forEach(u,i=>{if(t||!T(i))return;if(i.type===C){t=!0;return}const f=i.props;Object.hasOwn(f,"children")&&n(f.children)})};return n(o),t},x=o=>Object.hasOwn(o,"children"),G=o=>typeof o=="string"||typeof o=="number",N=o=>o==null||typeof o=="boolean";function J({children:o,colors:t,name:n}){if(n&&t)throw new Error("The `name` and `colors` props are mutually exclusive");if(!n&&!t)throw new Error("Either `name` or `colors` prop must be provided");const u=M(()=>n?k(O[n].colors,O[n].options):k(t??[]),[n,t]),i=h=>u(F(h)),f=g.count(o);if(G(o))return s(b,{transform:i,children:o});if(f===1&&!j(o))return s(b,{transform:i,children:o});const m=h=>{const c=[];let l="",v=0;const w=()=>{const r=`gradient-node-${String(v)}`;return v+=1,r},a=(r,e)=>{c.push(s(b,{transform:i,children:r},e))},E=()=>{if(l==="")return;const r=l;l="",a(s(S,{children:r}),w())};return g.forEach(h,r=>{if(!N(r)){if(G(r)){l+=String(r);return}if(E(),T(r)){const e=r.key??w(),p=r.props;if(r.type===S){a(r,e);return}if(r.type===C){if(x(p)){const d=p.children;c.push(y(r,{key:e},m(d)));return}c.push(y(r,{key:e}));return}if(x(p)){const d=p.children;if(!j(d)){a(r,e);return}c.push(y(r,{key:e},m(d)));return}a(r,e);return}c.push(r)}}),E(),c};return s(B,{children:m(o)})}export{J as Gradient,J as default};
1
+ import{jsx as f,Fragment as j}from"react/jsx-runtime";import{strip as B}from"@visulima/ansi";import{multilineGradient as w}from"@visulima/colorize/gradient";import P from"@visulima/tui/components/box";import C from"@visulima/tui/components/text";import h from"@visulima/tui/components/transform";import{useMemo as F,Children as x,isValidElement as S,cloneElement as y}from"react";const E={atlas:{colors:["#feac5e","#c779d0","#4bc0c8"]},cristal:{colors:["#bdfff3","#4ac29a"]},fruit:{colors:["#ff4e50","#f9d423"]},instagram:{colors:["#833ab4","#fd1d1d","#fcb045"]},mind:{colors:["#473b7b","#3584a7","#30d2be"]},morning:{colors:["#ff5f6d","#ffc371"],options:{interpolation:"hsv"}},passion:{colors:["#f43b47","#453a94"]},pastel:{colors:["#74ebd5","#74ecd5"],options:{hsvSpin:"long",interpolation:"hsv"}},rainbow:{colors:["#ff0000","#ff0100"],options:{hsvSpin:"long",interpolation:"hsv"}},retro:{colors:["#3f51b1","#5a55ae","#7b5fac","#8f6aae","#a86aa4","#cc6b8e","#f18271","#f3a469","#f7c978"]},summer:{colors:["#fdbb2d","#22c1c3"]},teen:{colors:["#77a1d3","#79cbca","#e684ae"]},vice:{colors:["#5ee7df","#b490ca"],options:{interpolation:"hsv"}}},k=o=>{let e=!1;const t=d=>{x.forEach(d,s=>{if(e||!S(s))return;if(s.type===P){e=!0;return}const a=s.props;Object.hasOwn(a,"children")&&t(a.children)})};return t(o),e},G=o=>Object.hasOwn(o,"children"),O=o=>typeof o=="string"||typeof o=="number",K=o=>o==null||typeof o=="boolean";function q({children:o,colors:e,name:t}){if(t&&e)throw new Error("The `name` and `colors` props are mutually exclusive");if(!t&&!e)throw new Error("Either `name` or `colors` prop must be provided");const d=F(()=>t?w(E[t].colors,E[t].options):w(e??[]),[t,e]),s=b=>d(B(b)),a=x.count(o);if(O(o))return f(h,{transform:s,children:o});if(a===1&&!k(o))return f(h,{transform:s,children:o});const m=b=>{const i=[];let c="",g=0;const v=()=>{const r=`gradient-node-${String(g)}`;return g+=1,r},p=(r,n)=>{i.push(f(h,{transform:s,children:r},n))},T=()=>{if(c==="")return;const r=c;c="",p(f(C,{children:r}),v())};return x.forEach(b,r=>{if(!K(r)){if(O(r)){c+=String(r);return}if(T(),S(r)){const n=r.key??v(),l=r.props;if(r.type===C){p(r,n);return}if(r.type===P){if(G(l)){const u=l.children;i.push(y(r,{key:n},m(u)));return}i.push(y(r,{key:n}));return}if(G(l)){const u=l.children;if(!k(u)){p(r,n);return}i.push(y(r,{key:n},m(u)));return}p(r,n);return}i.push(r)}}),T(),i};return f(j,{children:m(o)})}export{q as Gradient,q as default};
package/dist/grid.js CHANGED
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import n from"@visulima/tui/components/box";import{Children as u}from"react";function G({children:e,columnGap:a=1,columns:m=2,columnWidth:c,rowGap:h=0}){const i=u.toArray(e),l=[],t=Math.max(1,m);for(let r=0;r<i.length;r+=t)l.push(i.slice(r,r+t));return o(n,{flexDirection:"column",gap:h,children:l.map((r,p)=>o(n,{gap:a,children:r.map((d,f)=>o(n,{flexShrink:0,width:c,children:d},f))},p))})}export{G as Grid,G as default};
1
+ import{jsx as o}from"react/jsx-runtime";import n from"@visulima/tui/components/box";import{Children as f}from"react";function w({children:l,columnGap:c=1,columns:m=2,columnWidth:a,rowGap:h=0}){const t=f.toArray(l),e=[],i=Math.max(1,m);for(let r=0;r<t.length;r+=i)e.push(t.slice(r,r+i));return o(n,{flexDirection:"column",gap:h,children:e.map((r,p)=>o(n,{gap:c,children:r.map((s,d)=>o(n,{flexShrink:0,width:a,children:s},d))},p))})}export{w as Grid,w as default};
package/dist/heading.js CHANGED
@@ -1 +1 @@
1
- import{jsx as l,jsxs as t}from"react/jsx-runtime";import c from"@visulima/tui/components/box";import d from"@visulima/tui/components/text";const a={1:"blueBright",2:"cyanBright",3:"magentaBright",4:"yellowBright",5:"green",6:"white"},h={1:"# ",2:"## ",3:"### ",4:"#### ",5:"##### ",6:"###### "};function g({children:e,color:o,level:r=1,underline:i=!1}){const n=o??a[r];return l(c,{flexDirection:"column",children:t(d,{bold:r<=2,color:n,underline:i,children:[h[r],e]})})}export{g as Heading,g as default};
1
+ import{jsx as n,jsxs as c}from"react/jsx-runtime";import l from"@visulima/tui/components/box";import s from"@visulima/tui/components/text";const m={1:"blueBright",2:"cyanBright",3:"magentaBright",4:"yellowBright",5:"green",6:"white"},a={1:"# ",2:"## ",3:"### ",4:"#### ",5:"##### ",6:"###### "};function d({children:r,color:t,level:o=1,underline:e=!1}){const i=t??m[o];return n(l,{flexDirection:"column",children:c(s,{bold:o<=2,color:i,underline:e,children:[a[o],r]})})}export{d as Heading,d as default};
package/dist/heatmap.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as M,jsx as c}from"react/jsx-runtime";import m from"@visulima/tui/components/box";import k from"@visulima/tui/components/canvas";import C from"@visulima/tui/components/text";import{useMemo as A}from"react";const E=["#0b1e4f","#1f3b96","#3258c8","#4e84ec","#78b0ff"];function I({cellWidth:s=2,character:L="█",columnLabels:p,data:t,max:l,min:d,palette:x=E,rowLabels:g,textColor:W}){const{cols:w,colWidth:f,extent:j,rows:u}=A(()=>{const e=t.length,r=t.reduce((n,o)=>Math.max(n,o.length),0);let i=d??1/0,a=l??-1/0;if(d===void 0||l===void 0)for(const n of t)for(const o of n)d===void 0&&o<i&&(i=o),l===void 0&&o>a&&(a=o);return{cols:r,colWidth:s,extent:{max:a,min:i},rows:e}},[t,d,l,s]),D=w*f,H=u;return M(m,{children:[g===void 0?void 0:c(m,{flexDirection:"column",marginRight:1,children:Array.from({length:u},(e,r)=>c(C,{dimColor:!0,children:g[r]??""},r))}),M(m,{flexDirection:"column",children:[c(k,{draw:e=>{e.clear();const{max:r,min:i}=j,a=r-i||1,n=x.length-1;for(let o=0;o<u;o+=1)for(let h=0;h<w;h+=1){const b=t[o]?.[h],R=b===void 0?void 0:x[Math.max(0,Math.min(n,Math.round((b-i)/a*n)))];for(let v=0;v<f;v+=1)e.setCell(h*f+v,o,L,{background:R,color:W})}},height:H,version:[t,x,s,d,l],width:D}),p===void 0?void 0:c(m,{children:p.map((e,r)=>c(m,{width:f,children:c(C,{dimColor:!0,wrap:"truncate-end",children:e})},r))})]})]})}export{I as Heatmap,I as default};
1
+ import{jsxs as M,jsx as f}from"react/jsx-runtime";import h from"@visulima/tui/components/box";import I from"@visulima/tui/components/canvas";import T from"@visulima/tui/components/text";import{useMemo as _}from"react";const k=["#0b1e4f","#1f3b96","#3258c8","#4e84ec","#78b0ff"];function R({cellWidth:d=2,character:y="█",columnLabels:w,data:r,max:l,min:e,palette:a=k,rowLabels:x,textColor:A}){const{cols:v,colWidth:m,extent:D,rows:g}=_(()=>{const n=r.length,t=r.reduce((i,o)=>Math.max(i,o.length),0);let c=e??1/0,s=l??-1/0;if(e===void 0||l===void 0)for(const i of r)for(const o of i)e===void 0&&o<c&&(c=o),l===void 0&&o>s&&(s=o);return{cols:t,colWidth:d,extent:{max:s,min:c},rows:n}},[r,e,l,d]),E=v*m,b=g;return M(h,{children:[x===void 0?void 0:f(h,{flexDirection:"column",marginRight:1,children:Array.from({length:g},(n,t)=>f(T,{dimColor:!0,children:x[t]??""},t))}),M(h,{flexDirection:"column",children:[f(I,{draw:n=>{n.clear();const{max:t,min:c}=D,s=t-c||1,i=a.length-1;for(let o=0;o<g;o+=1)for(let u=0;u<v;u+=1){const C=r[o]?.[u],j=C===void 0?void 0:a[Math.max(0,Math.min(i,Math.round((C-c)/s*i)))];for(let p=0;p<m;p+=1)n.setCell(u*m+p,o,y,{background:j,color:A})}},height:b,version:[r,a,d,e,l],width:E}),w===void 0?void 0:f(h,{children:w.map((n,t)=>f(h,{width:m,children:f(T,{dimColor:!0,wrap:"truncate-end",children:n})},t))})]})]})}export{R as Heatmap,R as default};
package/dist/help.js CHANGED
@@ -1 +1 @@
1
- import{jsx as e,jsxs as m}from"react/jsx-runtime";import u from"@visulima/tui/components/box";import i from"@visulima/tui/components/text";import x from"@visulima/tui/hooks/use-window-size";const f={backspace:"backspace",delete:"del",downArrow:"↓",end:"end",escape:"esc",home:"home",leftArrow:"←",pageDown:"pgdn",pageUp:"pgup",return:"enter",rightArrow:"→",tab:"tab",upArrow:"↑"};function y(r){const o=r.indexOf("+");if(o!==-1){const n=r.slice(0,o),t=r.slice(o+1);return`${n}+${f[t]??t}`}return f[r]??r}function C(r){return(typeof r=="string"?[r]:r).map(o=>y(o)).join("/")}function B({bindings:r,descriptionColor:o,keyColor:n="cyan",maxColumns:t=3,mode:s="short",separator:l=" · "}){const{columns:p}=x();return s==="full"?$(r,{columns:p,descriptionColor:o,keyColor:n,maxColumns:t}):b(r,{columns:p,descriptionColor:o,keyColor:n,separator:l})}function b(r,o){const n=[];let t=0;for(const[s,l]of r.entries()){const p=C(l.key),d=`${p} ${l.description}`,c=(s>0?o.separator.length:0)+d.length;if(t+c>o.columns&&n.length>0)break;s>0&&n.push(e(i,{dimColor:!0,children:o.separator},`sep-${s}`)),n.push(m(u,{children:[e(i,{color:o.keyColor,children:p}),e(i,{children:" "}),o.descriptionColor?e(i,{color:o.descriptionColor,children:l.description}):e(i,{dimColor:!0,children:l.description})]},`pair-${s}`)),t+=c}return e(u,{flexDirection:"row",children:n})}function $(r,o){const n=new Map;for(const d of r){const c=d.group??"";n.has(c)||n.set(c,[]),n.get(c).push(d)}const t=[...n.entries()],s=Math.min(o.maxColumns,t.length||1),l=Math.floor(o.columns/s),p=[];for(const[d,[c,g]]of t.entries()){const a=[];c&&a.push(e(i,{bold:!0,children:c},"title"));for(const[k,h]of g.entries()){const w=C(h.key);a.push(m(u,{children:[e(i,{color:o.keyColor,children:w}),e(i,{children:" "}),o.descriptionColor?e(i,{color:o.descriptionColor,children:h.description}):e(i,{dimColor:!0,children:h.description})]},`b-${k}`))}p.push(e(u,{flexDirection:"column",width:l,children:a},`col-${d}`))}return e(u,{flexDirection:"row",children:p})}export{B as Help,B as default};
1
+ import{jsx as n,jsxs as g}from"react/jsx-runtime";import h from"@visulima/tui/components/box";import i from"@visulima/tui/components/text";import y from"@visulima/tui/hooks/use-window-size";const m={backspace:"backspace",delete:"del",downArrow:"↓",end:"end",escape:"esc",home:"home",leftArrow:"←",pageDown:"pgdn",pageUp:"pgup",return:"enter",rightArrow:"→",tab:"tab",upArrow:"↑"};function k(e){const r=e.indexOf("+");if(r!==-1){const o=e.slice(0,r),t=e.slice(r+1);return`${o}+${m[t]??t}`}return m[e]??e}function x(e){return(typeof e=="string"?[e]:e).map(o=>k(o)).join("/")}function M({bindings:e,descriptionColor:r,keyColor:o="cyan",maxColumns:t=3,mode:c="short",separator:s=" · "}){const{columns:l}=y();return c==="full"?$(e,{columns:l,descriptionColor:r,keyColor:o,maxColumns:t}):C(e,{columns:l,descriptionColor:r,keyColor:o,separator:s})}function C(e,r){const o=[];let t=0;for(const[c,s]of e.entries()){const l=x(s.key),u=`${l} ${s.description}`,a=(c>0?r.separator.length:0)+u.length;if(t+a>r.columns&&o.length>0)break;c>0&&o.push(n(i,{dimColor:!0,children:r.separator},`sep-${c}`)),o.push(g(h,{children:[n(i,{color:r.keyColor,children:l}),n(i,{children:" "}),r.descriptionColor?n(i,{color:r.descriptionColor,children:s.description}):n(i,{dimColor:!0,children:s.description})]},`pair-${c}`)),t+=a}return n(h,{flexDirection:"row",children:o})}function $(e,r){const o=new Map;for(const u of e){const d=u.group??"";o.has(d)||o.set(d,[]),o.get(d).push(u)}const t=[...o.entries()],c=Math.min(r.maxColumns,t.length||1),s=Math.floor(r.columns/c),l=[];for(const[u,[d,a]]of t.entries()){const f=[];d&&f.push(n(i,{bold:!0,children:d},"title"));for(const[b,p]of a.entries()){const w=x(p.key);f.push(g(h,{children:[n(i,{color:r.keyColor,children:w}),n(i,{children:" "}),r.descriptionColor?n(i,{color:r.descriptionColor,children:p.description}):n(i,{dimColor:!0,children:p.description})]},`b-${b}`))}l.push(n(h,{flexDirection:"column",width:s,children:f},`col-${u}`))}return n(h,{flexDirection:"row",children:l})}export{M as Help,M as default};
package/dist/histogram.js CHANGED
@@ -1 +1 @@
1
- import{jsx as g}from"react/jsx-runtime";import{useMemo as d}from"react";import{BarChart as b}from"./bar-chart.js";const p=(l,t,o)=>{if(o<=0||l>=t)return[l,t];const s=(t-l)/o;return Array.from({length:o+1},(n,r)=>l+r*s)},c=(l,t)=>{if(t.length<2)return[];const o=Array.from({length:t.length-1}).fill(0),s=t[0],n=t[t.length-1];for(const r of l)if(!(r<s||r>n))for(let e=0;e<t.length-1;e+=1){const a=e===t.length-2,h=t[e+1];if(r<h||a&&r<=h){o[e]=(o[e]??0)+1;break}}return o.map((r,e)=>{const a=t[e],h=t[e+1];return{count:r,label:`${Math.round(a)}-${Math.round(h)}`}})};function x({bins:l=10,color:t,data:o,height:s=10,max:n,min:r,showValues:e=!1,thresholds:a,width:h}){const m=d(()=>{if(a&&a.length>=2)return c(o,a);if(o.length===0)return[];let i=r??1/0,f=n??-1/0;if(r===void 0||n===void 0)for(const u of o)r===void 0&&u<i&&(i=u),n===void 0&&u>f&&(f=u);return i===f?[{count:o.length,label:i.toString()}]:c(o,p(i,f,l))},[o,a,l,r,n]);return g(b,{data:m.map(i=>({color:t,label:i.label,value:i.count})),height:s,orientation:"vertical",showLabels:!0,showValues:e,width:h})}export{x as Histogram,x as default};
1
+ import{jsx as B}from"react/jsx-runtime";import{useMemo as w}from"react";import{BarChart as b}from"./bar-chart.js";const y=(r,n,t)=>{if(t<=0||r>=n)return[r,n];const l=(n-r)/t;return Array.from({length:t+1},(e,o)=>r+o*l)},m=(r,n)=>{if(n.length<2)return[];const t=Array.from({length:n.length-1}).fill(0),l=n[0],e=n[n.length-1];for(const o of r)if(!(o<l||o>e))for(let u=0;u<n.length-1;u+=1){const f=u===n.length-2,c=n[u+1];if(o<c||f&&o<=c){t[u]=(t[u]??0)+1;break}}return t.map((o,u)=>{const f=n[u],c=n[u+1];return{count:o,label:`${Math.round(f)}-${Math.round(c)}`}})};function I({bins:r=10,color:n,data:t,height:l=10,max:e,min:o,showValues:u=!1,thresholds:f,width:c}){const p=w(()=>{if(f&&f.length>=2)return m(t,f);if(t.length===0)return[];let i=o??1/0,a=e??-1/0;if(o===void 0||e===void 0)for(const g of t)o===void 0&&g<i&&(i=g),e===void 0&&g>a&&(a=g);return i===a?[{count:t.length,label:i.toString()}]:m(t,y(i,a,r))},[t,f,r,o,e]);return B(b,{data:p.map(i=>({color:n,label:i.label,value:i.count})),height:l,orientation:"vertical",showLabels:!0,showValues:u,width:c})}export{I as Histogram,I as default};
package/dist/image.js CHANGED
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import f from"@visulima/tui/components/box";import h from"@visulima/tui/components/text";const p="▀",a="▄";function y({emptyChar:u=" ",pixels:e}){let c=0;for(const o of e)c=Math.max(c,o.length);const s=[];for(let o=0;o<e.length;o+=2){const d=e[o]??[],m=e[o+1]??[],i=[];for(let r=0;r<c;r+=1){const n=d[r],l=m[r];if(n===void 0&&l===void 0){i.push(t(h,{children:u},r));continue}if(n===void 0){i.push(t(h,{color:l,children:a},r));continue}i.push(t(h,{backgroundColor:l,color:n,children:p},r))}s.push(t(f,{children:i},o))}return t(f,{flexDirection:"column",children:s})}export{y as Image,y as default};
1
+ import{jsx as n}from"react/jsx-runtime";import f from"@visulima/tui/components/box";import s from"@visulima/tui/components/text";const p="▀",a="▄";function v({emptyChar:d=" ",pixels:r}){let e=0;for(const o of r)e=Math.max(e,o.length);const h=[];for(let o=0;o<r.length;o+=2){const m=r[o]??[],u=r[o+1]??[],c=[];for(let t=0;t<e;t+=1){const l=m[t],i=u[t];if(l===void 0&&i===void 0){c.push(n(s,{children:d},t));continue}if(l===void 0){c.push(n(s,{color:i,children:a},t));continue}c.push(n(s,{backgroundColor:i,color:l,children:p},t))}h.push(n(f,{children:c},o))}return n(f,{flexDirection:"column",children:h})}export{v as Image,v as default};
package/dist/index.d.ts CHANGED
@@ -1,4 +1,20 @@
1
- export { Accordion, type AccordionItem, type AccordionProps } from "./accordion.js";
1
+ export { Accordion,
2
+ /**
3
+ * Barrel for `@visulima/tui-kit`.
4
+ *
5
+ * Consumers should import each component from its own subpath
6
+ * (`@visulima/tui-kit/gauge`) so they only pay for what they use.
7
+ * This barrel exists as a maintenance index and type-coverage aid.
8
+ */
9
+ type AccordionItem,
10
+ /**
11
+ * Barrel for `@visulima/tui-kit`.
12
+ *
13
+ * Consumers should import each component from its own subpath
14
+ * (`@visulima/tui-kit/gauge`) so they only pay for what they use.
15
+ * This barrel exists as a maintenance index and type-coverage aid.
16
+ */
17
+ type AccordionProps } from "./accordion.js";
2
18
  export { Alert, type AlertProps, type AlertVariant } from "./alert.js";
3
19
  export { AnimatePresence, type AnimatePresenceProps } from "./animate-presence.js";
4
20
  export { type ApprovalDecision, ApprovalPrompt, type ApprovalPromptProps, type ApprovalRisk } from "./approval-prompt.js";
@@ -32,7 +48,6 @@ export { type DirectoryNode, DirectoryTree, type DirectoryTreeProps } from "./di
32
48
  export { Divider, type DividerProps } from "./divider.js";
33
49
  export { Drawer, type DrawerProps } from "./drawer.js";
34
50
  export { FileChange, type FileChangeProps, type FileChangeStatus } from "./file-change.js";
35
- export { type F as FileEntry, a as FilePicker, type b as FilePickerFilter, type P as FilePickerProps } from "./packem_shared/file-picker.d-CH7pccC7.js";
36
51
  export { Form, FormField, type FormFieldProps, type FormProps } from "./form.js";
37
52
  export { Gauge, type GaugeProps, type GaugeSize, type GaugeThreshold } from "./gauge.js";
38
53
  export { Gradient, type GradientColors, type GradientName, type GradientProps } from "./gradient.js";
@@ -72,11 +87,6 @@ export { ProgressCircle, type ProgressCircleProps } from "./progress-circle.js";
72
87
  export { QrCode, type Props as QrCodeProps } from "./qr-code.js";
73
88
  export { RadioGroup, type Props as RadioGroupProps, type RadioOption } from "./radio-group.js";
74
89
  export { ScatterPlot, type Props as ScatterPlotProps } from "./scatter-plot.js";
75
- export { C as ControlledScrollView, type a as ControlledScrollViewProps, type b as ControlledScrollViewRef } from "./packem_shared/controlled-scroll-view.d-D3kZZzjI.js";
76
- export { S as ScrollBar, type a as ScrollBarPlacement, type b as ScrollBarProps, type c as ScrollBarStyle } from "./packem_shared/scroll-bar.d-B4sD1hBR.js";
77
- export { S as ScrollBarBox, type a as ScrollBarBoxProps } from "./packem_shared/scroll-bar-box.d-CpTYEcTZ.js";
78
- export { type S as ScrollAlignment, a as ScrollList, type b as ScrollListProps, type c as ScrollListRef } from "./packem_shared/scroll-list.d-CPCF0RwC.js";
79
- export { S as ScrollView, type a as ScrollViewProps, type b as ScrollViewRef } from "./packem_shared/scroll-view.d-GZcgAHl4.js";
80
90
  export { SearchInput, type Props as SearchInputProps } from "./search-input.js";
81
91
  export { SelectInput, type SelectInputEntry, type Item as SelectInputItemType, type Props as SelectInputProps, type SelectInputSeparator } from "./select-input.js";
82
92
  export { SelectInputIndicator, type Props as SelectInputIndicatorProps } from "./select-input-indicator.js";
@@ -108,14 +118,19 @@ export { ToolCall, type Props as ToolCallProps, type ToolCallStatus } from "./to
108
118
  export { Tooltip, type TooltipPlacement, type Props as TooltipProps } from "./tooltip.js";
109
119
  export { default as Transition, type TransitionPhase, type TransitionPreset, type Props as TransitionProps } from "./transition.js";
110
120
  export { TreeSelect, type TreeSelectNode, type Props as TreeSelectProps } from "./tree-select.js";
111
- export { type A as AsyncChildrenFunction, type F as FlatNode, type S as SelectionMode, type T as TreeNode, a as TreeNodeMap, type b as TreeNodeRendererProps, type c as TreeNodeState, d as TreeView, type P as TreeViewProps, type e as TreeViewState, type f as TreeViewTheme, type U as UseTreeViewProps, type g as UseTreeViewStateProps, t as treeViewTheme, u as useTreeView, h as useTreeViewState } from "./packem_shared/use-tree-view.d-DeMQ6G2r.js";
112
121
  export { UnorderedList, type UnorderedListEntry, type Props as UnorderedListProps } from "./unordered-list.js";
122
+ export { type AsyncChildrenFunction, type FlatNode, type SelectionMode, type TreeNode, TreeNodeMap, type TreeNodeRendererProps, type TreeNodeState, TreeView, type TreeViewProps, type TreeViewState, type TreeViewTheme, type UseTreeViewProps, type UseTreeViewStateProps, treeViewTheme, useTreeView, useTreeViewState } from "./tree-view-entry.js";
123
+ export { ControlledScrollView, type ControlledScrollViewProps, type ControlledScrollViewRef } from "./controlled-scroll-view.js";
124
+ export { type FileEntry, FilePicker, type FilePickerFilter, type FilePickerProps } from "./file-picker-entry.js";
125
+ export { type ScrollAlignment, ScrollList, type ScrollListProps, type ScrollListRef } from "./scroll-list.js";
126
+ export { ScrollBar, type ScrollBarPlacement, type ScrollBarProps, type ScrollBarStyle } from "./scroll-bar.js";
127
+ export { ScrollBarBox, type ScrollBarBoxProps } from "./scroll-bar-box.js";
128
+ export { ScrollView, type ScrollViewProps, type ScrollViewRef } from "./scroll-view.js";
113
129
  import '@visulima/colorize';
114
130
  import 'react';
115
131
  import 'type-fest';
116
132
  import "./packem_shared/variant-config.d-D5NnrrQK.js";
117
133
  import '@visulima/tui/hooks/use-console-capture';
118
- import '@visulima/tui/components/box';
119
134
  import '@visulima/colorize/gradient';
120
135
  import '@visulima/tui/hooks/use-key-bindings';
121
136
  import '@visulima/tui/canvas';
@@ -123,3 +138,4 @@ import '@visulima/spinner';
123
138
  import '@visulima/tui/components/text';
124
139
  import '@visulima/tui/hooks/use-stopwatch';
125
140
  import '@visulima/tui/hooks/use-timer';
141
+ import '@visulima/tui/components/box';
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{Accordion as e}from"./accordion.js";import{Alert as p}from"./alert.js";import{AnimatePresence as f}from"./animate-presence.js";import{ApprovalPrompt as a}from"./approval-prompt.js";import{AreaChart as l}from"./area-chart.js";import{Badge as d}from"./badge.js";import{BarChart as c}from"./bar-chart.js";import{BigText as u}from"./big-text.js";import{BlinkDot as T}from"./blink-dot.js";import{Breadcrumb as h}from"./breadcrumb.js";import{Button as k}from"./button.js";import{Calendar as I}from"./calendar.js";import{Card as w}from"./card.js";import{Checkbox as L}from"./checkbox.js";import{CheckboxGroup as V}from"./checkbox-group.js";import{Code as A}from"./code.js";import{Collapsible as v}from"./collapsible.js";import{ColorPicker as O}from"./color-picker.js";import{CommandBlock as y}from"./command-block.js";import{CommandPalette as J}from"./command-palette.js";import{ConfirmDialog as Q}from"./confirm-dialog.js";import{ConfirmInput as j}from"./confirm-input.js";import{ConsoleOverlay as z}from"./console-overlay.js";import{ContentSwitcher as W}from"./content-switcher.js";import{DataGrid as Y}from"./data-grid.js";import{DatePicker as _}from"./date-picker.js";import{DefinitionList as rr}from"./definition-list.js";import{Dialog as er}from"./dialog.js";import{DiffView as pr}from"./diff-view.js";import{Digits as fr}from"./digits.js";import{DirectoryTree as ar}from"./directory-tree.js";import{Divider as lr}from"./divider.js";import{Drawer as dr}from"./drawer.js";import{FileChange as cr}from"./file-change.js";import{Form as ur,FormField as Sr}from"./form.js";import{Gauge as Cr}from"./gauge.js";import{Gradient as Pr}from"./gradient.js";import{Grid as Br}from"./grid.js";import{Heading as br}from"./heading.js";import{Heatmap as Dr}from"./heatmap.js";import{Help as Mr}from"./help.js";import{Histogram as Gr}from"./histogram.js";import{Image as Fr}from"./image.js";import{Json as Hr}from"./json.js";import{Kbd as Nr}from"./kbd.js";import{h as Ur}from"./packem_shared/line-chart-BbhMhcZg.js";import{Link as Kr}from"./link.js";import{LoadingIndicator as Rr}from"./loading-indicator.js";import{Log as qr}from"./log.js";import{Markdown as Er}from"./markdown.js";import{MaskedInput as Xr}from"./masked-input.js";import{Menu as Zr}from"./menu.js";import{MessageBubble as $r}from"./message-bubble.js";import{ModelBadge as oo}from"./model-badge.js";import{ModelSelector as to}from"./model-selector.js";import{MultiProgress as mo}from"./multi-progress.js";import{MultiSelect as xo}from"./multi-select.js";import{NotificationBadge as io}from"./notification-badge.js";import{NumberInput as no}from"./number-input.js";import{OperationTree as co}from"./operation-tree.js";import{OptionList as uo}from"./option-list.js";import{OrderedList as To}from"./ordered-list.js";import{Paginator as ho}from"./paginator.js";import{Paragraph as ko}from"./paragraph.js";import{PathInput as Io}from"./path-input.js";import{PieChart as wo}from"./pie-chart.js";import{Placeholder as Lo}from"./placeholder.js";import{Popover as Vo}from"./popover.js";import{ProgressBar as Ao}from"./progress-bar.js";import{ProgressCircle as vo}from"./progress-circle.js";import{QrCode as Oo}from"./qr-code.js";import{RadioGroup as yo}from"./radio-group.js";import{ScatterPlot as Jo}from"./scatter-plot.js";import{SearchInput as Qo}from"./search-input.js";import{SelectInput as jo}from"./select-input.js";import{SelectInputIndicator as zo}from"./select-input-indicator.js";import{SelectInputItem as Wo}from"./select-input-item.js";import{ShimmerText as Yo}from"./shimmer-text.js";import{Sidebar as _o}from"./sidebar.js";import{Slider as re}from"./slider.js";import{Sparkline as ee}from"./sparkline.js";import{Spinner as pe}from"./spinner.js";import{StatusLine as fe}from"./status-line.js";import{StatusMessage as ae}from"./status-message.js";import{Stepper as le}from"./stepper.js";import{Stopwatch as de}from"./stopwatch.js";import{StreamingText as ce}from"./streaming-text.js";import{Switch as ue}from"./switch.js";import{Tab as Te}from"./tab.js";import{Table as he}from"./table.js";import{Tabs as ke}from"./tabs.js";import{Tag as Ie}from"./tag.js";import{TagInput as we}from"./tag-input.js";import{TextInput as Le}from"./text-input.js";import{Textarea as Ve}from"./textarea.js";import{ThinkingBlock as Ae}from"./thinking-block.js";import{TimePicker as ve}from"./time-picker.js";import{Timer as Oe}from"./timer.js";import{Toast as ye}from"./toast.js";import{TokenUsage as Je}from"./token-usage.js";import{ToolCall as Qe}from"./tool-call.js";import{Tooltip as je}from"./tooltip.js";import{default as ze}from"./transition.js";import{TreeSelect as We}from"./tree-select.js";import{UnorderedList as Ye}from"./unordered-list.js";import{default as _e}from"./packem_shared/FilePicker-V5H2fb-v.js";import{C as rt}from"./packem_shared/controlled-scroll-view-DerVKKv6.js";import{ScrollBar as et}from"./packem_shared/ScrollBar-C9i3z3Ft.js";import{ScrollBarBox as pt}from"./packem_shared/ScrollBarBox-DZEC8YnV.js";import{ScrollList as ft}from"./packem_shared/ScrollList-Djtb2vVy.js";import{ScrollView as at}from"./packem_shared/ScrollView-ESxpl6Hy.js";import{TreeNodeMap as lt}from"./packem_shared/TreeNodeMap-cJlYqckB.js";import{TreeView as dt}from"./packem_shared/TreeView-q0l446NV.js";import{theme as ct}from"./packem_shared/treeViewTheme-Dq3ekRAC.js";import{useTreeView as ut}from"./packem_shared/useTreeView-D0JEqT6W.js";import{useTreeViewState as Tt}from"./packem_shared/useTreeViewState-BiTJakkh.js";export{e as Accordion,p as Alert,f as AnimatePresence,a as ApprovalPrompt,l as AreaChart,d as Badge,c as BarChart,u as BigText,T as BlinkDot,h as Breadcrumb,k as Button,I as Calendar,w as Card,L as Checkbox,V as CheckboxGroup,A as Code,v as Collapsible,O as ColorPicker,y as CommandBlock,J as CommandPalette,Q as ConfirmDialog,j as ConfirmInput,z as ConsoleOverlay,W as ContentSwitcher,rt as ControlledScrollView,Y as DataGrid,_ as DatePicker,rr as DefinitionList,er as Dialog,pr as DiffView,fr as Digits,ar as DirectoryTree,lr as Divider,dr as Drawer,cr as FileChange,_e as FilePicker,ur as Form,Sr as FormField,Cr as Gauge,Pr as Gradient,Br as Grid,br as Heading,Dr as Heatmap,Mr as Help,Gr as Histogram,Fr as Image,Hr as Json,Nr as Kbd,Ur as LineChart,Kr as Link,Rr as LoadingIndicator,qr as Log,Er as Markdown,Xr as MaskedInput,Zr as Menu,$r as MessageBubble,oo as ModelBadge,to as ModelSelector,mo as MultiProgress,xo as MultiSelect,io as NotificationBadge,no as NumberInput,co as OperationTree,uo as OptionList,To as OrderedList,ho as Paginator,ko as Paragraph,Io as PathInput,wo as PieChart,Lo as Placeholder,Vo as Popover,Ao as ProgressBar,vo as ProgressCircle,Oo as QrCode,yo as RadioGroup,Jo as ScatterPlot,et as ScrollBar,pt as ScrollBarBox,ft as ScrollList,at as ScrollView,Qo as SearchInput,jo as SelectInput,zo as SelectInputIndicator,Wo as SelectInputItem,Yo as ShimmerText,_o as Sidebar,re as Slider,ee as Sparkline,pe as Spinner,fe as StatusLine,ae as StatusMessage,le as Stepper,de as Stopwatch,ce as StreamingText,ue as Switch,Te as Tab,he as Table,ke as Tabs,Ie as Tag,we as TagInput,Le as TextInput,Ve as Textarea,Ae as ThinkingBlock,ve as TimePicker,Oe as Timer,ye as Toast,Je as TokenUsage,Qe as ToolCall,je as Tooltip,ze as Transition,lt as TreeNodeMap,We as TreeSelect,dt as TreeView,Ye as UnorderedList,ct as treeViewTheme,ut as useTreeView,Tt as useTreeViewState};
1
+ import{Accordion as e}from"./accordion.js";import{Alert as p}from"./alert.js";import{AnimatePresence as f}from"./animate-presence.js";import{ApprovalPrompt as a}from"./approval-prompt.js";import{AreaChart as l}from"./area-chart.js";import{Badge as d}from"./badge.js";import{BarChart as c}from"./bar-chart.js";import{BigText as u}from"./big-text.js";import{BlinkDot as T}from"./blink-dot.js";import{Breadcrumb as h}from"./breadcrumb.js";import{Button as k}from"./button.js";import{Calendar as I}from"./calendar.js";import{Card as w}from"./card.js";import{Checkbox as L}from"./checkbox.js";import{CheckboxGroup as V}from"./checkbox-group.js";import{Code as A}from"./code.js";import{Collapsible as v}from"./collapsible.js";import{ColorPicker as O}from"./color-picker.js";import{CommandBlock as y}from"./command-block.js";import{CommandPalette as J}from"./command-palette.js";import{ConfirmDialog as Q}from"./confirm-dialog.js";import{ConfirmInput as j}from"./confirm-input.js";import{ConsoleOverlay as z}from"./console-overlay.js";import{ContentSwitcher as W}from"./content-switcher.js";import{DataGrid as Y}from"./data-grid.js";import{DatePicker as _}from"./date-picker.js";import{DefinitionList as rr}from"./definition-list.js";import{Dialog as er}from"./dialog.js";import{DiffView as pr}from"./diff-view.js";import{Digits as fr}from"./digits.js";import{DirectoryTree as ar}from"./directory-tree.js";import{Divider as lr}from"./divider.js";import{Drawer as dr}from"./drawer.js";import{FileChange as cr}from"./file-change.js";import{Form as ur,FormField as Sr}from"./form.js";import{Gauge as Cr}from"./gauge.js";import{Gradient as Pr}from"./gradient.js";import{Grid as Br}from"./grid.js";import{Heading as br}from"./heading.js";import{Heatmap as Dr}from"./heatmap.js";import{Help as Mr}from"./help.js";import{Histogram as Gr}from"./histogram.js";import{Image as Fr}from"./image.js";import{Json as Hr}from"./json.js";import{Kbd as Nr}from"./kbd.js";import{L as Ur}from"./packem_shared/line-chart-BqOUjZTt.js";import{Link as Kr}from"./link.js";import{LoadingIndicator as Rr}from"./loading-indicator.js";import{Log as qr}from"./log.js";import{Markdown as Er}from"./markdown.js";import{MaskedInput as Xr}from"./masked-input.js";import{Menu as Zr}from"./menu.js";import{MessageBubble as $r}from"./message-bubble.js";import{ModelBadge as oo}from"./model-badge.js";import{ModelSelector as to}from"./model-selector.js";import{MultiProgress as mo}from"./multi-progress.js";import{MultiSelect as xo}from"./multi-select.js";import{NotificationBadge as io}from"./notification-badge.js";import{NumberInput as no}from"./number-input.js";import{OperationTree as co}from"./operation-tree.js";import{OptionList as uo}from"./option-list.js";import{OrderedList as To}from"./ordered-list.js";import{Paginator as ho}from"./paginator.js";import{Paragraph as ko}from"./paragraph.js";import{PathInput as Io}from"./path-input.js";import{PieChart as wo}from"./pie-chart.js";import{Placeholder as Lo}from"./placeholder.js";import{Popover as Vo}from"./popover.js";import{ProgressBar as Ao}from"./progress-bar.js";import{ProgressCircle as vo}from"./progress-circle.js";import{QrCode as Oo}from"./qr-code.js";import{RadioGroup as yo}from"./radio-group.js";import{ScatterPlot as Jo}from"./scatter-plot.js";import{SearchInput as Qo}from"./search-input.js";import{SelectInput as jo}from"./select-input.js";import{SelectInputIndicator as zo}from"./select-input-indicator.js";import{SelectInputItem as Wo}from"./select-input-item.js";import{ShimmerText as Yo}from"./shimmer-text.js";import{Sidebar as _o}from"./sidebar.js";import{Slider as re}from"./slider.js";import{Sparkline as ee}from"./sparkline.js";import{Spinner as pe}from"./spinner.js";import{StatusLine as fe}from"./status-line.js";import{StatusMessage as ae}from"./status-message.js";import{Stepper as le}from"./stepper.js";import{Stopwatch as de}from"./stopwatch.js";import{StreamingText as ce}from"./streaming-text.js";import{Switch as ue}from"./switch.js";import{Tab as Te}from"./tab.js";import{Table as he}from"./table.js";import{Tabs as ke}from"./tabs.js";import{Tag as Ie}from"./tag.js";import{TagInput as we}from"./tag-input.js";import{TextInput as Le}from"./text-input.js";import{Textarea as Ve}from"./textarea.js";import{ThinkingBlock as Ae}from"./thinking-block.js";import{TimePicker as ve}from"./time-picker.js";import{Timer as Oe}from"./timer.js";import{Toast as ye}from"./toast.js";import{TokenUsage as Je}from"./token-usage.js";import{ToolCall as Qe}from"./tool-call.js";import{Tooltip as je}from"./tooltip.js";import{default as ze}from"./transition.js";import{TreeSelect as We}from"./tree-select.js";import{UnorderedList as Ye}from"./unordered-list.js";import{default as _e}from"./packem_shared/FilePicker-KGAg6v5x.js";import{C as rt}from"./packem_shared/controlled-scroll-view-BHCYjiKa.js";import{ScrollBar as et}from"./packem_shared/ScrollBar-arHRP6OT.js";import{ScrollBarBox as pt}from"./packem_shared/ScrollBarBox-C8wZ_Slk.js";import{ScrollList as ft}from"./packem_shared/ScrollList-BCqHHps6.js";import{ScrollView as at}from"./packem_shared/ScrollView-Dt5E9Yl7.js";import{TreeNodeMap as lt}from"./packem_shared/TreeNodeMap-BK7nRlt0.js";import{TreeView as dt}from"./packem_shared/TreeView-BEZAFOfr.js";import{theme as ct}from"./packem_shared/treeViewTheme-DuCcyBDe.js";import{useTreeView as ut}from"./packem_shared/useTreeView-Dt_iWxVs.js";import{useTreeViewState as Tt}from"./packem_shared/useTreeViewState-aHwNZhIE.js";export{e as Accordion,p as Alert,f as AnimatePresence,a as ApprovalPrompt,l as AreaChart,d as Badge,c as BarChart,u as BigText,T as BlinkDot,h as Breadcrumb,k as Button,I as Calendar,w as Card,L as Checkbox,V as CheckboxGroup,A as Code,v as Collapsible,O as ColorPicker,y as CommandBlock,J as CommandPalette,Q as ConfirmDialog,j as ConfirmInput,z as ConsoleOverlay,W as ContentSwitcher,rt as ControlledScrollView,Y as DataGrid,_ as DatePicker,rr as DefinitionList,er as Dialog,pr as DiffView,fr as Digits,ar as DirectoryTree,lr as Divider,dr as Drawer,cr as FileChange,_e as FilePicker,ur as Form,Sr as FormField,Cr as Gauge,Pr as Gradient,Br as Grid,br as Heading,Dr as Heatmap,Mr as Help,Gr as Histogram,Fr as Image,Hr as Json,Nr as Kbd,Ur as LineChart,Kr as Link,Rr as LoadingIndicator,qr as Log,Er as Markdown,Xr as MaskedInput,Zr as Menu,$r as MessageBubble,oo as ModelBadge,to as ModelSelector,mo as MultiProgress,xo as MultiSelect,io as NotificationBadge,no as NumberInput,co as OperationTree,uo as OptionList,To as OrderedList,ho as Paginator,ko as Paragraph,Io as PathInput,wo as PieChart,Lo as Placeholder,Vo as Popover,Ao as ProgressBar,vo as ProgressCircle,Oo as QrCode,yo as RadioGroup,Jo as ScatterPlot,et as ScrollBar,pt as ScrollBarBox,ft as ScrollList,at as ScrollView,Qo as SearchInput,jo as SelectInput,zo as SelectInputIndicator,Wo as SelectInputItem,Yo as ShimmerText,_o as Sidebar,re as Slider,ee as Sparkline,pe as Spinner,fe as StatusLine,ae as StatusMessage,le as Stepper,de as Stopwatch,ce as StreamingText,ue as Switch,Te as Tab,he as Table,ke as Tabs,Ie as Tag,we as TagInput,Le as TextInput,Ve as Textarea,Ae as ThinkingBlock,ve as TimePicker,Oe as Timer,ye as Toast,Je as TokenUsage,Qe as ToolCall,je as Tooltip,ze as Transition,lt as TreeNodeMap,We as TreeSelect,dt as TreeView,Ye as UnorderedList,ct as treeViewTheme,ut as useTreeView,Tt as useTreeViewState};
package/dist/json.js CHANGED
@@ -1 +1 @@
1
- import{jsx as l,jsxs as $}from"react/jsx-runtime";import O from"@visulima/tui/components/box";import a from"@visulima/tui/components/text";import P from"@visulima/tui/hooks/use-focus";import V from"@visulima/tui/hooks/use-input";import{useMemo as I,useState as F,useCallback as N}from"react";const B={boolean:"yellow",bracket:"gray",key:"cyan",null:"gray",number:"green",string:"yellow"},D=e=>{if(e===null)return"null";if(Array.isArray(e))return"array";const o=typeof e;return o==="object"||o==="boolean"||o==="number"||o==="string"||o==="undefined"?o:"string"},C=e=>{const o=D(e);return o==="array"||o==="object"},M=e=>Array.isArray(e)?`[…${e.length}]`:`{…${Object.keys(e).length}}`,w=(e,o,d,c,s,y)=>{const i=C(e)&&(Array.isArray(e)?e.length>0:Object.keys(e).length>0);if(y.push({collapsible:i,depth:d,id:c,key:o,summary:i?M(e):void 0,value:e}),!(!i||s.has(c))){if(Array.isArray(e)){e.forEach((u,f)=>{w(u,String(f),d+1,`${c}.${f}`,s,y)});return}for(const[u,f]of Object.entries(e))w(f,u,d+1,`${c}.${u}`,s,y)}};function x(e,o){return o===0?0:(e%o+o)%o}function H({accentColor:e="blue",autoFocus:o=!1,collapseDepth:d=Number.POSITIVE_INFINITY,data:c,interactive:s=!0,theme:y}){const i={...B,...y},{isFocused:u}=P({autoFocus:o,isActive:s}),f=I(()=>{const r=new Set,n=(t,p,g)=>{if(!C(t))return;p>=d&&r.add(g);const m=Array.isArray(t)?t.map((v,k)=>[String(k),v]):Object.entries(t);for(const[v,k]of m)n(k,p+1,`${g}.${v}`)};return n(c,0,"$"),r},[d,c]),[h,J]=F(f),[A,S]=F(0),b=I(()=>{const r=[];return w(c,void 0,0,"$",h,r),r},[h,c]),j=N(r=>{J(n=>{const t=new Set(n);return t.has(r)?t.delete(r):t.add(r),t})},[]),T=N((r,n)=>{if(n.upArrow){S(m=>x(m-1,b.length));return}if(n.downArrow){S(m=>x(m+1,b.length));return}const t=b[A];if(!t?.collapsible)return;const p=n.rightArrow&&h.has(t.id),g=n.leftArrow&&!h.has(t.id);(r===" "||p||g)&&j(t.id)},[h,A,b,j]);V(T,{isActive:s&&u});const E=r=>{if(r.collapsible){const t=h.has(r.id)?"▸":"▾";return $(a,{color:i.bracket,children:[t," ",r.summary]})}const n=D(r.value);return n==="array"||n==="object"?l(a,{color:i.bracket,children:n==="array"?"[]":"{}"}):n==="string"?l(a,{color:i.string,children:JSON.stringify(r.value)}):n==="number"?l(a,{color:i.number,children:String(r.value)}):n==="boolean"?l(a,{color:i.boolean,children:String(r.value)}):l(a,{color:i.null,children:r.value===void 0?"undefined":"null"})};return l(O,{flexDirection:"column",children:b.map((r,n)=>{const t=s&&u&&n===A;return $(O,{children:[l(a,{color:t?e:void 0,children:t?"❯":" "}),l(a,{children:" ".repeat(r.depth)}),r.key===void 0?void 0:$(a,{color:i.key,children:[r.key,":"," "]}),E(r)]},r.id)})})}export{H as Json,H as default};
1
+ import{jsx as l,jsxs as j}from"react/jsx-runtime";import I from"@visulima/tui/components/box";import c from"@visulima/tui/components/text";import K from"@visulima/tui/hooks/use-focus";import M from"@visulima/tui/hooks/use-input";import{useMemo as C,useState as E,useCallback as T}from"react";const _={boolean:"yellow",bracket:"gray",key:"cyan",null:"gray",number:"green",string:"yellow"},N=n=>{if(n===null)return"null";if(Array.isArray(n))return"array";const t=typeof n;return t==="object"||t==="boolean"||t==="number"||t==="string"||t==="undefined"?t:"string"},V=n=>{const t=N(n);return t==="array"||t==="object"},B=n=>Array.isArray(n)?`[…${n.length}]`:`{…${Object.keys(n).length}}`,S=(n,t,f,s,u,m)=>{const i=V(n)&&(Array.isArray(n)?n.length>0:Object.keys(n).length>0);if(m.push({collapsible:i,depth:f,id:s,key:t,summary:i?B(n):void 0,value:n}),!(!i||u.has(s))){if(Array.isArray(n)){n.forEach((a,d)=>{S(a,String(d),f+1,`${s}.${d}`,u,m)});return}for(const[a,d]of Object.entries(n))S(d,a,f+1,`${s}.${a}`,u,m)}};function F(n,t){return t===0?0:(n%t+t)%t}function G({accentColor:n="blue",autoFocus:t=!1,collapseDepth:f=Number.POSITIVE_INFINITY,data:s,interactive:u=!0,theme:m}){const i={..._,...m},{isFocused:a}=K({autoFocus:t,isActive:u}),d=C(()=>{const r=new Set,o=(e,g,p)=>{if(!V(e))return;g>=f&&r.add(p);const b=Array.isArray(e)?e.map((k,$)=>[String($),k]):Object.entries(e);for(const[k,$]of b)o($,g+1,`${p}.${k}`)};return o(s,0,"$"),r},[f,s]),[y,w]=E(d),[A,x]=E(0),h=C(()=>{const r=[];return S(s,void 0,0,"$",y,r),r},[y,s]),O=T(r=>{w(o=>{const e=new Set(o);return e.has(r)?e.delete(r):e.add(r),e})},[]),H=T((r,o)=>{if(o.upArrow){x(b=>F(b-1,h.length));return}if(o.downArrow){x(b=>F(b+1,h.length));return}const e=h[A];if(!e?.collapsible)return;const g=o.rightArrow&&y.has(e.id),p=o.leftArrow&&!y.has(e.id);(r===" "||g||p)&&O(e.id)},[y,A,h,O]);M(H,{isActive:u&&a});const J=r=>{if(r.collapsible){const e=y.has(r.id)?"▸":"▾";return j(c,{color:i.bracket,children:[e," ",r.summary]})}const o=N(r.value);return o==="array"||o==="object"?l(c,{color:i.bracket,children:o==="array"?"[]":"{}"}):o==="string"?l(c,{color:i.string,children:JSON.stringify(r.value)}):o==="number"?l(c,{color:i.number,children:String(r.value)}):o==="boolean"?l(c,{color:i.boolean,children:String(r.value)}):l(c,{color:i.null,children:r.value===void 0?"undefined":"null"})};return l(I,{flexDirection:"column",children:h.map((r,o)=>{const e=u&&a&&o===A;return j(I,{children:[l(c,{color:e?n:void 0,children:e?"❯":" "}),l(c,{children:" ".repeat(r.depth)}),r.key===void 0?void 0:j(c,{color:i.key,children:[r.key,":"," "]}),J(r)]},r.id)})})}export{G as Json,G as default};
package/dist/kbd.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as e,jsx as l}from"react/jsx-runtime";import n from"@visulima/tui/components/box";import d from"@visulima/tui/components/text";function m({children:r,color:o="gray",variant:i="solid"}){return i==="solid"?e(d,{backgroundColor:o,color:"black",children:[" ",r," "]}):i==="outline"?l(n,{borderColor:o,borderStyle:"round",paddingX:1,children:l(d,{color:o,children:r})}):l(d,{dimColor:!0,children:r})}export{m as Kbd,m as default};
1
+ import{jsxs as i,jsx as t}from"react/jsx-runtime";import u from"@visulima/tui/components/box";import d from"@visulima/tui/components/text";function m({children:r,color:o="gray",variant:e="solid"}){return e==="solid"?i(d,{backgroundColor:o,color:"black",children:[" ",r," "]}):e==="outline"?t(u,{borderColor:o,borderStyle:"round",paddingX:1,children:t(d,{color:o,children:r})}):t(d,{dimColor:!0,children:r})}export{m as Kbd,m as default};
@@ -1 +1 @@
1
- import"react/jsx-runtime";import"@visulima/tui/canvas";import"@visulima/tui/components/box";import"@visulima/tui/components/canvas";import"@visulima/tui/components/text";import"react";import{h as s,h as n,d,a as h}from"./packem_shared/line-chart-BbhMhcZg.js";export{s as LineChart,n as default,d as drawSeriesOnCanvas,h as projectPoint};
1
+ import{L as r,L as s,d as t,a as n}from"./packem_shared/line-chart-BqOUjZTt.js";export{r as LineChart,s as default,t as drawSeriesOnCanvas,n as projectPoint};
package/dist/link.js CHANGED
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{hyperlink as u}from"@visulima/ansi";import c from"@visulima/tui/components/text";import f from"@visulima/tui/components/transform";import{useCallback as l}from"react";let n;const m=()=>{if(!process.stdout.isTTY)return!1;const o=process.env.TERM_PROGRAM??"",r=process.env.TERM_PROGRAM_VERSION??"";if(o==="iTerm.app")return Number.parseInt(r.split(".")[0]??"0",10)>=3;if(o==="WezTerm"||o==="ghostty")return!0;if(o==="vscode"){const s=r.split("."),t=Number.parseInt(s[0]??"0",10),p=Number.parseInt(s[1]??"0",10);return t>1||t===1&&p>=72}if(process.env.WT_SESSION)return!0;const e=process.env.VTE_VERSION;if(e){const s=Number.parseInt(e,10);return s>=5e3&&s!==5e3}return!1},a=()=>process.env.FORCE_HYPERLINK?process.env.FORCE_HYPERLINK!=="0":(n!==void 0||(n=m()),n);function T({children:o,fallback:r=!0,url:e}){const s=l(t=>a()?u(t,e):r===!1?t:typeof r=="function"?r(t,e):`${t} ${e}`,[r,e]);return i(f,{transform:s,children:i(c,{children:o})})}export{T as Link,T as default};
1
+ import{jsx as p}from"react/jsx-runtime";import{hyperlink as u}from"@visulima/ansi";import m from"@visulima/tui/components/text";import c from"@visulima/tui/components/transform";import{useCallback as f}from"react";let o;const a=()=>{if(!process.stdout.isTTY)return!1;const s=process.env.TERM_PROGRAM??"",e=process.env.TERM_PROGRAM_VERSION??"";if(s==="iTerm.app")return Number.parseInt(e.split(".")[0]??"0",10)>=3;if(s==="WezTerm"||s==="ghostty")return!0;if(s==="vscode"){const r=e.split("."),n=Number.parseInt(r[0]??"0",10),i=Number.parseInt(r[1]??"0",10);return n>1||n===1&&i>=72}if(process.env.WT_SESSION)return!0;const t=process.env.VTE_VERSION;if(t){const r=Number.parseInt(t,10);return r>=5e3&&r!==5e3}return!1},R=()=>process.env.FORCE_HYPERLINK?process.env.FORCE_HYPERLINK!=="0":(o!==void 0||(o=a()),o);function d({children:s,fallback:e=!0,url:t}){const r=f(n=>R()?u(n,t):e===!1?n:typeof e=="function"?e(n,t):`${n} ${t}`,[e,t]);return p(c,{transform:r,children:p(m,{children:s})})}export{d as Link,d as default};
@@ -1 +1 @@
1
- import{jsxs as c,jsx as o}from"react/jsx-runtime";import d from"@visulima/tui/components/box";import n from"@visulima/tui/components/text";import{Spinner as e}from"./spinner.js";function s({children:r,color:i="cyan",type:t="dots"}){return c(d,{gap:1,children:[o(n,{color:i,children:o(e,{type:t})}),r===void 0?void 0:o(n,{color:i,children:r})]})}export{s as LoadingIndicator,s as default};
1
+ import{jsxs as m,jsx as o}from"react/jsx-runtime";import d from"@visulima/tui/components/box";import t from"@visulima/tui/components/text";import{Spinner as p}from"./spinner.js";function x({children:r,color:i="cyan",type:n="dots"}){return m(d,{gap:1,children:[o(t,{color:i,children:o(p,{type:n})}),r===void 0?void 0:o(t,{color:i,children:r})]})}export{x as LoadingIndicator,x as default};
package/dist/log.js CHANGED
@@ -1 +1 @@
1
- import{jsx as e,jsxs as d}from"react/jsx-runtime";import r from"@visulima/tui/components/box";import n from"@visulima/tui/components/text";const h={debug:{color:"gray",label:"DBG"},error:{color:"red",label:"ERR"},info:{color:"blue",label:"INF"},success:{color:"green",label:"OK "},warn:{color:"yellow",label:"WRN"}};function p({entries:l,maxLines:i,showLevel:t=!0,showTimestamp:s=!0}){const a=i!==void 0&&l.length>i?l.slice(l.length-i):l;return e(r,{flexDirection:"column",children:a.map((o,m)=>{const c=h[o.level??"info"];return d(r,{children:[s&&o.timestamp!==void 0?e(r,{marginRight:1,children:e(n,{dimColor:!0,children:o.timestamp})}):void 0,t?e(r,{marginRight:1,children:e(n,{bold:!0,color:c.color,children:c.label})}):void 0,e(n,{children:o.message})]},m)})})}export{p as Log,p as default};
1
+ import{jsx as l,jsxs as u}from"react/jsx-runtime";import e from"@visulima/tui/components/box";import c from"@visulima/tui/components/text";const g={debug:{color:"gray",label:"DBG"},error:{color:"red",label:"ERR"},info:{color:"blue",label:"INF"},success:{color:"green",label:"OK "},warn:{color:"yellow",label:"WRN"}};function f({entries:o,maxLines:i,showLevel:d=!0,showTimestamp:n=!0}){const a=i!==void 0&&o.length>i?o.slice(o.length-i):o;return l(e,{flexDirection:"column",children:a.map((r,m)=>{const t=g[r.level??"info"];return u(e,{children:[n&&r.timestamp!==void 0?l(e,{marginRight:1,children:l(c,{dimColor:!0,children:r.timestamp})}):void 0,d?l(e,{marginRight:1,children:l(c,{bold:!0,color:t.color,children:t.label})}):void 0,l(c,{children:r.message})]},m)})})}export{f as Log,f as default};
package/dist/markdown.js CHANGED
@@ -1 +1 @@
1
- import{jsx as r,jsxs as x}from"react/jsx-runtime";import l from"@visulima/tui/components/box";import w from"@visulima/tui/components/newline";import m from"@visulima/tui/components/text";import D from"@visulima/tui/hooks/use-window-size";import{Lexer as F}from"marked";import k,{useMemo as b}from"react";import{Code as M}from"./code.js";import{Link as j}from"./link.js";import{OrderedList as v}from"./ordered-list.js";import{Table as E}from"./table.js";import{UnorderedList as q}from"./unordered-list.js";const A={1:"cyan",2:"green",3:"yellow",4:"blue",5:"magenta",6:"gray"};function p(c){return!c||c.length===0?null:c.map((a,t)=>{switch(a.type){case"br":return r(w,{},t);case"codespan":return x(m,{inverse:!0,children:[" ",a.text," "]},t);case"del":return r(m,{strikethrough:!0,children:p(a.tokens)},t);case"em":return r(m,{italic:!0,children:p(a.tokens)},t);case"escape":return r(k.Fragment,{children:a.text},t);case"image":{const e=a;return x(m,{dimColor:!0,children:["[image:"," ",e.text||e.href,"]"]},t)}case"link":{const e=a;return r(j,{url:e.href,children:p(e.tokens)??e.text},t)}case"strong":return r(m,{bold:!0,children:p(a.tokens)},t);case"text":return r(k.Fragment,{children:a.text},t);default:{const e="raw"in a?a.raw:"";return r(k.Fragment,{children:e},t)}}})}function T(c){return c.map(a=>{const t=a.tokens??[],e=t.find(i=>i.type==="text"),n=p(e?.tokens??t),h=t.find(i=>i.type==="list");return{children:h?T(h.items):void 0,label:n}})}function y(c,a,t){const e=[];for(const[n,h]of c.entries()){const i=h,s=n>0?1:0;switch(i.type){case"blockquote":{const o=i;e.push(r(l,{borderLeft:!0,borderLeftColor:"gray",marginTop:s,paddingLeft:1,children:r(l,{flexDirection:"column",children:y(o.tokens,a,t-3)})},n));break}case"code":{const o=i;e.push(r(l,{marginTop:s,children:r(M,{code:o.text,language:o.lang,theme:a})},n));break}case"heading":{const o=i,d=A[o.depth]??"white",g=`${"#".repeat(o.depth)} `;e.push(r(l,{marginTop:s,children:x(m,{bold:!0,color:d,children:[g,p(o.tokens)]})},n));break}case"hr":{e.push(r(l,{marginTop:s,children:r(m,{dimColor:!0,children:"─".repeat(Math.min(t,40))})},n));break}case"html":{const o=i.text.replaceAll(/<[^>]*>/g,"");o.trim()&&e.push(r(l,{marginTop:s,children:r(m,{dimColor:!0,children:o})},n));break}case"list":{const o=i,d=T(o.items);o.ordered?e.push(r(l,{marginTop:s,children:r(v,{items:d})},n)):e.push(r(l,{marginTop:s,children:r(q,{items:d})},n));break}case"paragraph":{const o=i;e.push(r(l,{marginTop:s,children:r(m,{wrap:"wrap",children:p(o.tokens)})},n));break}case"space":{e.push(r(w,{},n));break}case"table":{const o=i,d=(o.header??[]).map(u=>u.text),g=(o.rows??[]).map(u=>u.map(f=>f.text)).map(u=>{const f={};return d.forEach((L,C)=>{f[L]=u[C]??""}),f});e.push(r(l,{marginTop:s,children:r(E,{data:g})},n));break}default:{const o="raw"in i?i.raw:"",d="text"in i?i.text:o;d&&e.push(r(l,{marginTop:s,children:r(m,{children:d})},n));break}}}return e}function B(c,a){const t=F.lex(c);if(!a||c.length===0)return t;let e=0;for(const n of t)e+=n.raw?.length??0;if(e<c.length){const n=c.slice(e);n.trim().length>0&&t.push({raw:n,text:n,tokens:[{raw:n,text:n,type:"text"}],type:"paragraph"})}return t}function Q({children:c,codeTheme:a="github-dark-default",maxWidth:t,streaming:e=!1}){const{columns:n}=D(),h=t??n??80,i=b(()=>B(c,e),[c,e]),s=b(()=>y(i,a,h),[i,a,h]);return r(l,{flexDirection:"column",children:s})}export{Q as Markdown,Q as default};
1
+ import{jsx as t,jsxs as k}from"react/jsx-runtime";import h from"@visulima/tui/components/box";import w from"@visulima/tui/components/newline";import m from"@visulima/tui/components/text";import F from"@visulima/tui/hooks/use-window-size";import{Lexer as D}from"marked";import g,{useMemo as x}from"react";import{Code as M}from"./code.js";import{Link as O}from"./link.js";import{OrderedList as S}from"./ordered-list.js";import{Table as W}from"./table.js";import{UnorderedList as j}from"./unordered-list.js";const q={1:"cyan",2:"green",3:"yellow",4:"blue",5:"magenta",6:"gray"};function d(i){return!i||i.length===0?null:i.map((s,o)=>{switch(s.type){case"br":return t(w,{},o);case"codespan":return k(m,{inverse:!0,children:[" ",s.text," "]},o);case"del":return t(m,{strikethrough:!0,children:d(s.tokens)},o);case"em":return t(m,{italic:!0,children:d(s.tokens)},o);case"escape":return t(g.Fragment,{children:s.text},o);case"image":{const e=s;return k(m,{dimColor:!0,children:["[image:"," ",e.text||e.href,"]"]},o)}case"link":{const e=s;return t(O,{url:e.href,children:d(e.tokens)??e.text},o)}case"strong":return t(m,{bold:!0,children:d(s.tokens)},o);case"text":return t(g.Fragment,{children:s.text},o);default:{const e="raw"in s?s.raw:"";return t(g.Fragment,{children:e},o)}}})}function L(i){return i.map(s=>{const e=s.tokens??[],r=e.find(n=>n.type==="text"),u=d(r?.tokens??e),c=e.find(n=>n.type==="list");return{children:c?L(c.items):void 0,label:u}})}function y(i,s,o){const e=[];for(const[r,u]of i.entries()){const c=u,a=r>0?1:0;switch(c.type){case"blockquote":{const n=c;e.push(t(h,{borderLeft:!0,borderLeftColor:"gray",marginTop:a,paddingLeft:1,children:t(h,{flexDirection:"column",children:y(n.tokens,s,o-3)})},r));break}case"code":{const n=c;e.push(t(h,{marginTop:a,children:t(M,{code:n.text,language:n.lang,theme:s})},r));break}case"heading":{const n=c,l=q[n.depth]??"white",b=`${"#".repeat(n.depth)} `;e.push(t(h,{marginTop:a,children:k(m,{bold:!0,color:l,children:[b,d(n.tokens)]})},r));break}case"hr":{e.push(t(h,{marginTop:a,children:t(m,{dimColor:!0,children:"─".repeat(Math.min(o,40))})},r));break}case"html":{const l=c.text.replaceAll(/<[^>]*>/g,"");l.trim()&&e.push(t(h,{marginTop:a,children:t(m,{dimColor:!0,children:l})},r));break}case"list":{const n=c,l=L(n.items);n.ordered?e.push(t(h,{marginTop:a,children:t(S,{items:l})},r)):e.push(t(h,{marginTop:a,children:t(j,{items:l})},r));break}case"paragraph":{const n=c;e.push(t(h,{marginTop:a,children:t(m,{wrap:"wrap",children:d(n.tokens)})},r));break}case"space":{e.push(t(w,{},r));break}case"table":{const n=c,l=(n.header??[]).map(p=>p.text),C=(n.rows??[]).map(p=>p.map(f=>f.text)).map(p=>{const f={};return l.forEach((I,T)=>{f[I]=p[T]??""}),f});e.push(t(h,{marginTop:a,children:t(W,{data:C})},r));break}default:{const n="raw"in c?c.raw:"",l="text"in c?c.text:n;l&&e.push(t(h,{marginTop:a,children:t(m,{children:l})},r));break}}}return e}function v(i,s){const o=D.lex(i);if(!s||i.length===0)return o;let e=0;for(const r of o)e+=r.raw?.length??0;if(e<i.length){const r=i.slice(e);r.trim().length>0&&o.push({raw:r,text:r,tokens:[{raw:r,text:r,type:"text"}],type:"paragraph"})}return o}function K({children:i,codeTheme:s="github-dark-default",maxWidth:o,streaming:e=!1}){const{columns:r}=F(),u=o??r??80,c=x(()=>v(i,e),[i,e]),a=x(()=>y(c,s,u),[c,s,u]);return t(h,{flexDirection:"column",children:a})}export{K as Markdown,K as default};
@@ -1 +1 @@
1
- import{jsxs as S,jsx as C}from"react/jsx-runtime";import V from"@visulima/tui/components/box";import x from"@visulima/tui/components/text";import I from"@visulima/tui/hooks/use-input";import{useMemo as L,useState as b,useCallback as A}from"react";const T=(m,n)=>{const o=[];let s=0;for(const[l,i]of[...m].entries())i===n&&(o.push({maskColumn:l,rawPosition:s}),s+=1);return o},_=(m,n,o,s)=>{let l=0,i="";for(const f of n)if(f===o){const u=m[l];u===void 0?i+=s:(i+=u,l+=1)}else i+=f;return i};function F({defaultValue:m="",isDisabled:n=!1,mask:o,onChange:s,onSubmit:l,placeholderChar:i="_",token:f="#"}){const u=L(()=>T(o,f),[o,f]),h=u.length,M=m.slice(0,h),[e,v]=b(M),[t,d]=b(M.length),g=A((c,r)=>{v(c),d(Math.max(0,Math.min(h,r))),s?.(c)},[h,s]);I(A((c,r)=>{if(r.return){l?.(e);return}if(r.leftArrow){d(a=>Math.max(0,a-1));return}if(r.rightArrow){d(a=>Math.min(e.length,a+1));return}if(r.home||r.ctrl&&c==="a"){d(0);return}if(r.end||r.ctrl&&c==="e"){d(e.length);return}if(r.backspace){if(t===0)return;const a=e.slice(0,t-1)+e.slice(t);g(a,t-1);return}if(r.delete){if(t>=e.length)return;const a=e.slice(0,t)+e.slice(t+1);g(a,t);return}if(c.length!==1||e.length>=h)return;const P=e.slice(0,t)+c+e.slice(t);g(P,t+1)},[e,t,h,g,l]),{isActive:!n});const p=_(e,o,f,i),k=u[t]?.maskColumn??o.length,w=p.slice(0,k),j=p.charAt(k)||" ",D=p.slice(k+1);return S(V,{children:[C(x,{dimColor:n,children:w}),C(x,{dimColor:n,inverse:!n,children:j}),C(x,{dimColor:n,children:D})]})}export{F as MaskedInput,F as default};
1
+ import{jsxs as P,jsx as g}from"react/jsx-runtime";import R from"@visulima/tui/components/box";import w from"@visulima/tui/components/text";import V from"@visulima/tui/hooks/use-input";import{useMemo as _,useState as I,useCallback as A}from"react";const q=(f,n)=>{const o=[];let c=0;for(const[l,s]of[...f].entries())s===n&&(o.push({maskColumn:l,rawPosition:c}),c+=1);return o},z=(f,n,o,c)=>{let l=0,s="";for(const a of n)if(a===o){const m=f[l];m===void 0?s+=c:(s+=m,l+=1)}else s+=a;return s};function K({defaultValue:f="",isDisabled:n=!1,mask:o,onChange:c,onSubmit:l,placeholderChar:s="_",token:a="#"}){const m=_(()=>q(o,a),[o,a]),h=m.length,M=f.slice(0,h),[t,v]=I(M),[r,d]=I(M.length),x=A((i,e)=>{v(i),d(Math.max(0,Math.min(h,e))),c?.(i)},[h,c]);V(A((i,e)=>{if(e.return){l?.(t);return}if(e.leftArrow){d(u=>Math.max(0,u-1));return}if(e.rightArrow){d(u=>Math.min(t.length,u+1));return}if(e.home||e.ctrl&&i==="a"){d(0);return}if(e.end||e.ctrl&&i==="e"){d(t.length);return}if(e.backspace){if(r===0)return;const u=t.slice(0,r-1)+t.slice(r);x(u,r-1);return}if(e.delete){if(r>=t.length)return;const u=t.slice(0,r)+t.slice(r+1);x(u,r);return}if(i.length!==1||t.length>=h)return;const L=t.slice(0,r)+i+t.slice(r);x(L,r+1)},[t,r,h,x,l]),{isActive:!n});const C=z(t,o,a,s),p=m[r]?.maskColumn??o.length,j=C.slice(0,p),T=C.charAt(p)||" ",B=C.slice(p+1);return P(R,{children:[g(w,{dimColor:n,children:j}),g(w,{dimColor:n,inverse:!n,children:T}),g(w,{dimColor:n,children:B})]})}export{K as MaskedInput,K as default};
package/dist/menu.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as b,jsx as l}from"react/jsx-runtime";import m from"@visulima/tui/components/box";import f from"@visulima/tui/components/text";import A from"@visulima/tui/hooks/use-focus";import F from"@visulima/tui/hooks/use-input";import{useMemo as g,useState as j,useRef as y,useEffect as M,useCallback as $}from"react";const B=(t,r)=>{if(r&&r.length>0){const o=[];for(const i of r){i.title!==void 0&&o.push({kind:"section-header",sectionId:i.id,title:i.title});for(const d of i.items)o.push({item:d,kind:"item",sectionId:i.id})}return o}return(t??[]).map(o=>({item:o,kind:"item",sectionId:void 0}))},w=(t,r,o)=>{const i=t.length;if(i===0)return r;for(let d=1;d<=i;d+=1){const a=(r+o*d+i*d)%i,h=t[a];if(h?.kind==="item"&&!h.item.isDisabled)return a}return r},I=t=>{for(const[r,o]of t.entries())if(o.kind==="item"&&!o.item.isDisabled)return r;return 0};function W({accentColor:t="blue",autoFocus:r=!1,bordered:o=!0,items:i,onSelect:d,sections:a,title:h}){const{isFocused:p}=A({autoFocus:r}),n=g(()=>B(i,a),[i,a]),S=g(()=>I(n),[n]),[k,v]=j(S),u=y(k);u.current=k,M(()=>{const{current:c}=u,s=n[c];if(!(s?.kind==="item"&&!s.item.isDisabled)){const e=I(n);v(e),u.current=e}},[n]),F($((c,s)=>{if(p){if(s.downArrow||c==="j")v(w(n,u.current,1));else if(s.upArrow||c==="k")v(w(n,u.current,-1));else if(s.return){const e=n[u.current];e?.kind==="item"&&!e.item.isDisabled&&d(e.item.id)}}},[p,n,d]),{isActive:p});const x=b(m,{flexDirection:"column",children:[h===void 0?void 0:l(m,{marginBottom:1,children:l(f,{bold:!0,color:t,children:h})}),n.map((c,s)=>{if(c.kind==="section-header")return l(m,{marginTop:s===0?0:1,children:l(f,{dimColor:!0,children:c.title.toUpperCase()})},`header:${c.sectionId}`);const{item:e}=c,C=p&&s===k,D=C?t:void 0;return b(m,{children:[l(f,{color:D,dimColor:e.isDisabled,children:C?"▸ ":" "}),e.icon===void 0?void 0:b(f,{color:D,dimColor:e.isDisabled,children:[e.icon," "]}),l(m,{flexGrow:1,flexShrink:1,minWidth:0,children:l(f,{bold:C,color:D,dimColor:e.isDisabled,wrap:"truncate-end",children:e.label})}),e.hotkey===void 0?void 0:l(m,{flexShrink:0,children:b(f,{dimColor:!0,children:[" ",e.hotkey]})})]},`item:${e.id}`)})]});return o?l(m,{borderColor:p?t:void 0,borderStyle:"round",paddingX:1,children:x}):x}export{W as Menu,W as default};
1
+ import{jsxs as b,jsx as l}from"react/jsx-runtime";import u from"@visulima/tui/components/box";import a from"@visulima/tui/components/text";import j from"@visulima/tui/hooks/use-focus";import A from"@visulima/tui/hooks/use-input";import{useMemo as D,useState as R,useRef as S,useEffect as B,useCallback as E}from"react";const M=(o,r)=>{if(r&&r.length>0){const t=[];for(const i of r){i.title!==void 0&&t.push({kind:"section-header",sectionId:i.id,title:i.title});for(const d of i.items)t.push({item:d,kind:"item",sectionId:i.id})}return t}return(o??[]).map(t=>({item:t,kind:"item",sectionId:void 0}))},C=(o,r,t)=>{const i=o.length;if(i===0)return r;for(let d=1;d<=i;d+=1){const h=(r+t*d+i*d)%i,p=o[h];if(p?.kind==="item"&&!p.item.isDisabled)return h}return r},g=o=>{for(const[r,t]of o.entries())if(t.kind==="item"&&!t.item.isDisabled)return r;return 0};function U({accentColor:o="blue",autoFocus:r=!1,bordered:t=!0,items:i,onSelect:d,sections:h,title:p}){const{isFocused:x}=j({autoFocus:r}),n=D(()=>M(i,h),[i,h]),F=D(()=>g(n),[n]),[k,v]=R(F),f=S(k);f.current=k,B(()=>{const{current:s}=f,c=n[s];if(!(c?.kind==="item"&&!c.item.isDisabled)){const m=g(n);v(m),f.current=m}},[n]),A(E((s,c)=>{if(x){if(c.downArrow||s==="j")v(C(n,f.current,1));else if(c.upArrow||s==="k")v(C(n,f.current,-1));else if(c.return){const e=n[f.current];e?.kind==="item"&&!e.item.isDisabled&&d(e.item.id)}}},[x,n,d]),{isActive:x});const w=b(u,{flexDirection:"column",children:[p===void 0?void 0:l(u,{marginBottom:1,children:l(a,{bold:!0,color:o,children:p})}),n.map((s,c)=>{if(s.kind==="section-header")return l(u,{marginTop:c===0?0:1,children:l(a,{dimColor:!0,children:s.title.toUpperCase()})},`header:${s.sectionId}`);const{item:e}=s,m=x&&c===k,I=m?o:void 0;return b(u,{children:[l(a,{color:I,dimColor:e.isDisabled,children:m?"▸ ":" "}),e.icon===void 0?void 0:b(a,{color:I,dimColor:e.isDisabled,children:[e.icon," "]}),l(u,{flexGrow:1,flexShrink:1,minWidth:0,children:l(a,{bold:m,color:I,dimColor:e.isDisabled,wrap:"truncate-end",children:e.label})}),e.hotkey===void 0?void 0:l(u,{flexShrink:0,children:b(a,{dimColor:!0,children:[" ",e.hotkey]})})]},`item:${e.id}`)})]});return t?l(u,{borderColor:x?o:void 0,borderStyle:"round",paddingX:1,children:w}):w}export{U as Menu,U as default};
@@ -1 +1 @@
1
- import{jsxs as c,jsx as o}from"react/jsx-runtime";import i from"@visulima/tui/components/box";import l from"@visulima/tui/components/text";const f={assistant:{align:"flex-start",color:"blueBright",icon:""},system:{align:"flex-start",color:"gray",icon:""},tool:{align:"flex-start",color:"magentaBright",icon:""},user:{align:"flex-end",color:"greenBright",icon:""}};function p({children:r,color:a,flat:s=!1,label:e,meta:n,role:g="assistant"}){const d=f[g],t=a??d.color;return c(i,{alignSelf:d.align,flexDirection:"column",marginBottom:1,children:[e===void 0&&n===void 0?void 0:c(i,{gap:1,paddingX:1,children:[e===void 0?void 0:o(l,{bold:!0,color:t,children:e}),n===void 0?void 0:o(l,{dimColor:!0,children:n})]}),s?c(i,{paddingX:1,children:[o(l,{color:t,children:"│ "}),o(i,{flexDirection:"column",flexGrow:1,children:typeof r=="string"?o(l,{children:r}):r})]}):o(i,{borderColor:t,borderStyle:"round",flexDirection:"column",paddingX:1,children:typeof r=="string"?o(l,{children:r}):r})]})}export{p as MessageBubble,p as default};
1
+ import{jsxs as c,jsx as o}from"react/jsx-runtime";import i from"@visulima/tui/components/box";import t from"@visulima/tui/components/text";const f={assistant:{align:"flex-start",color:"blueBright",icon:""},system:{align:"flex-start",color:"gray",icon:""},tool:{align:"flex-start",color:"magentaBright",icon:""},user:{align:"flex-end",color:"greenBright",icon:""}};function p({children:r,color:d,flat:a=!1,label:n,meta:e,role:g="assistant"}){const s=f[g],l=d??s.color;return c(i,{alignSelf:s.align,flexDirection:"column",marginBottom:1,children:[n===void 0&&e===void 0?void 0:c(i,{gap:1,paddingX:1,children:[n===void 0?void 0:o(t,{bold:!0,color:l,children:n}),e===void 0?void 0:o(t,{dimColor:!0,children:e})]}),a?c(i,{paddingX:1,children:[o(t,{color:l,children:"│ "}),o(i,{flexDirection:"column",flexGrow:1,children:typeof r=="string"?o(t,{children:r}):r})]}):o(i,{borderColor:l,borderStyle:"round",flexDirection:"column",paddingX:1,children:typeof r=="string"?o(t,{children:r}):r})]})}export{p as MessageBubble,p as default};
@@ -1 +1 @@
1
- import{jsxs as o,jsx as l,Fragment as s}from"react/jsx-runtime";import u from"@visulima/tui/components/box";import r from"@visulima/tui/components/text";function g({color:d="magenta",icon:n,model:c,provider:t,variant:a="solid"}){const m=e=>{const i=n===void 0?void 0:o(s,{children:[n," "]});return a==="outline"?l(u,{borderColor:d,borderStyle:"round",paddingX:1,children:o(r,{color:d,children:[i,e]})}):a==="subtle"?o(r,{color:d,children:[i,e]}):o(r,{backgroundColor:d,color:"black",children:[" ",i,e," "]})};return t===void 0?m(c):o(u,{children:[l(r,{dimColor:!0,children:t}),l(r,{dimColor:!0,children:"/"}),m(c)]})}export{g as ModelBadge,g as default};
1
+ import{jsxs as r,jsx as n,Fragment as f}from"react/jsx-runtime";import m from"@visulima/tui/components/box";import e from"@visulima/tui/components/text";function g({color:d="magenta",icon:l,model:t,provider:u,variant:c="solid"}){const h=i=>{const o=l===void 0?void 0:r(f,{children:[l," "]});return c==="outline"?n(m,{borderColor:d,borderStyle:"round",paddingX:1,children:r(e,{color:d,children:[o,i]})}):c==="subtle"?r(e,{color:d,children:[o,i]}):r(e,{backgroundColor:d,color:"black",children:[" ",o,i," "]})};return u===void 0?h(t):r(m,{children:[n(e,{dimColor:!0,children:u}),n(e,{dimColor:!0,children:"/"}),h(t)]})}export{g as ModelBadge,g as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as M}from"react/jsx-runtime";import u from"@visulima/tui/components/box";import n from"@visulima/tui/components/text";import S from"@visulima/tui/hooks/use-focus";import j from"@visulima/tui/hooks/use-input";import{useState as x,useCallback as D}from"react";function C(c,i){return i===0?0:(c%i+i)%i}function V({accentColor:c="blue",autoFocus:i=!1,defaultValue:b,models:t,onSelect:m,value:a}){const{isFocused:f}=S({autoFocus:i}),s=a!==void 0,[g,w]=x(b),v=a??g,A=Math.max(0,t.findIndex(r=>r.id===v)),[l,h]=x(A),F=D((r,d)=>{if(d.upArrow){h(o=>C(o-1,t.length));return}if(d.downArrow){h(o=>C(o+1,t.length));return}if(d.return){const o=t[l];o!==void 0&&(s||w(o.id),m?.(o))}},[l,s,t,m]);return j(F,{isActive:f}),e(u,{flexDirection:"column",children:t.map((r,d)=>{const o=f&&d===l,p=r.id===v;return M(u,{gap:1,children:[e(n,{color:o?c:void 0,children:o?"❯":" "}),e(n,{color:p?c:void 0,children:p?"●":"○"}),e(n,{bold:o,children:r.name}),r.provider===void 0?void 0:e(n,{dimColor:!0,children:r.provider}),r.context===void 0?void 0:e(u,{marginLeft:1,children:e(n,{dimColor:!0,children:r.context})})]},r.id)})})}export{V as ModelSelector,V as default};
1
+ import{jsx as i,jsxs as j}from"react/jsx-runtime";import s from"@visulima/tui/components/box";import c from"@visulima/tui/components/text";import F from"@visulima/tui/hooks/use-focus";import M from"@visulima/tui/hooks/use-input";import{useState as m,useCallback as S}from"react";function I(d,n){return n===0?0:(d%n+n)%n}function q({accentColor:d="blue",autoFocus:n=!1,defaultValue:g,models:o,onSelect:f,value:l}){const{isFocused:a}=F({autoFocus:n}),p=l!==void 0,[w,A]=m(g),v=l??w,C=Math.max(0,o.findIndex(t=>t.id===v)),[u,h]=m(C),b=S((t,e)=>{if(e.upArrow){h(r=>I(r-1,o.length));return}if(e.downArrow){h(r=>I(r+1,o.length));return}if(e.return){const r=o[u];r!==void 0&&(p||A(r.id),f?.(r))}},[u,p,o,f]);return M(b,{isActive:a}),i(s,{flexDirection:"column",children:o.map((t,e)=>{const r=a&&e===u,x=t.id===v;return j(s,{gap:1,children:[i(c,{color:r?d:void 0,children:r?"❯":" "}),i(c,{color:x?d:void 0,children:x?"●":"○"}),i(c,{bold:r,children:t.name}),t.provider===void 0?void 0:i(c,{dimColor:!0,children:t.provider}),t.context===void 0?void 0:i(s,{marginLeft:1,children:i(c,{dimColor:!0,children:t.context})})]},t.id)})})}export{q as ModelSelector,q as default};
@@ -1 +1 @@
1
- import{jsx as r,jsxs as c}from"react/jsx-runtime";import l from"@visulima/tui/components/box";import i from"@visulima/tui/components/text";const p=t=>Math.max(0,Math.min(1,t));function b({barWidth:t=20,color:d="cyan",emptyChar:m="░",filledChar:s="█",items:n,showPercent:u=!0}){let o=0;for(const e of n)o=Math.max(o,e.label.length);return r(l,{flexDirection:"column",children:n.map((e,f)=>{const a=p(e.value),h=Math.round(a*t);return c(l,{gap:1,children:[r(l,{flexShrink:0,width:o,children:r(i,{children:e.label.padEnd(o)})}),c(l,{children:[r(i,{color:e.color??d,children:s.repeat(h)}),r(i,{dimColor:!0,children:m.repeat(Math.max(0,t-h))})]}),u?r(i,{dimColor:!0,children:`${Math.round(a*100)}%`}):void 0]},f)})})}export{b as MultiProgress,b as default};
1
+ import{jsx as r,jsxs as d}from"react/jsx-runtime";import t from"@visulima/tui/components/box";import n from"@visulima/tui/components/text";const x=e=>Math.max(0,Math.min(1,e));function b({barWidth:e=20,color:h="cyan",emptyChar:m="░",filledChar:u="█",items:a,showPercent:f=!0}){let l=0;for(const o of a)l=Math.max(l,o.label.length);return r(t,{flexDirection:"column",children:a.map((o,p)=>{const i=x(o.value),c=Math.round(i*e);return d(t,{gap:1,children:[r(t,{flexShrink:0,width:l,children:r(n,{children:o.label.padEnd(l)})}),d(t,{children:[r(n,{color:o.color??h,children:u.repeat(c)}),r(n,{dimColor:!0,children:m.repeat(Math.max(0,e-c))})]}),f?r(n,{dimColor:!0,children:`${Math.round(i*100)}%`}):void 0]},p)})})}export{b as MultiProgress,b as default};
@@ -1 +1 @@
1
- import{jsx as m,jsxs as R}from"react/jsx-runtime";import S from"@visulima/tui/components/box";import f from"@visulima/tui/components/text";import V from"@visulima/tui/hooks/use-input";import $ from"@visulima/tui/hooks/use-window-size";import{useReducer as T,useState as U,useRef as a,useMemo as W,useCallback as F}from"react";const Y=[],q=(o,u)=>{switch(u.type){case"focus":return{...o,focusedIndex:u.index};case"focus-next":{const i=o.focusedIndex+1,c=i>=o.visibleFrom+u.limit;return{...o,focusedIndex:i,visibleFrom:c?o.visibleFrom+1:o.visibleFrom}}case"focus-prev":{const i=o.focusedIndex-1,c=i<o.visibleFrom;return{...o,focusedIndex:i,visibleFrom:c?o.visibleFrom-1:o.visibleFrom}}default:return o}};function L({accentColor:o="blue",defaultColor:u,defaultValue:i=Y,isDisabled:c=!1,isFocused:v=!0,limit:g,onChange:C,onSubmit:I,options:t}){const{rows:A}=$(),l=Math.min(typeof g=="number"?g:A,t.length),[s,w]=T(q,{focusedIndex:0,visibleFrom:0}),[b,M]=U(i),j=a(b);j.current=b;const k=a(I);k.current=I;const p=a(C);p.current=C;const x=a(s);x.current=s;const E=W(()=>t.slice(s.visibleFrom,s.visibleFrom+l),[t,s.visibleFrom,l]),y=F(()=>{const e=t[x.current.focusedIndex]?.value;e&&M(r=>{const n=r.includes(e)?r.filter(d=>d!==e):[...r,e];return p.current?.(n),n})},[t]),D=F(()=>{M(e=>{const r=e.length===t.length?[]:t.map(n=>n.value);return p.current?.(r),r})},[t]);return V(F((e,r)=>{const{focusedIndex:n}=x.current;(r.downArrow||e==="j")&&n<t.length-1&&w({limit:l,type:"focus-next"}),(r.upArrow||e==="k")&&n>0&&w({limit:l,type:"focus-prev"}),e===" "&&y(),e==="a"&&D(),r.return&&k.current?.(j.current)},[t.length,l,y,D]),{isActive:!c&&v}),m(S,{flexDirection:"column",children:E.map((e,r)=>{const n=s.visibleFrom+r===s.focusedIndex,d=b.includes(e.value);let h=u;return d?h="green":n&&(h=o),R(S,{gap:1,children:[n?m(f,{color:o,dimColor:!v,children:"▸"}):m(f,{children:" "}),R(f,{color:h,dimColor:c,children:[d?"◼":"◻"," ",e.label]}),d?m(f,{color:"green",dimColor:!v,children:"✓"}):void 0]},e.key??e.value)})})}export{L as MultiSelect,L as default};
1
+ import{jsx as f,jsxs as j}from"react/jsx-runtime";import y from"@visulima/tui/components/box";import m from"@visulima/tui/components/text";import O from"@visulima/tui/hooks/use-input";import k from"@visulima/tui/hooks/use-window-size";import{useReducer as z,useState as B,useRef as x,useMemo as D,useCallback as g}from"react";const P=[],U=(r,i)=>{switch(i.type){case"focus":return{...r,focusedIndex:i.index};case"focus-next":{const o=r.focusedIndex+1,t=o>=r.visibleFrom+i.limit;return{...r,focusedIndex:o,visibleFrom:t?r.visibleFrom+1:r.visibleFrom}}case"focus-prev":{const o=r.focusedIndex-1,t=o<r.visibleFrom;return{...r,focusedIndex:o,visibleFrom:t?r.visibleFrom-1:r.visibleFrom}}default:return r}};function K({accentColor:r="blue",defaultColor:i,defaultValue:o=P,isDisabled:t=!1,isFocused:v=!0,limit:R,onChange:S,onSubmit:w,options:c}){const{rows:E}=k(),u=Math.min(typeof R=="number"?R:E,c.length),[s,p]=z(U,{focusedIndex:0,visibleFrom:0}),[b,A]=B(o),T=x(b);T.current=b;const C=x(w);C.current=w;const a=x(S);a.current=S;const h=x(s);h.current=s;const L=D(()=>c.slice(s.visibleFrom,s.visibleFrom+u),[c,s.visibleFrom,u]),M=g(()=>{const e=c[h.current.focusedIndex]?.value;e&&A(l=>{const n=l.includes(e)?l.filter(d=>d!==e):[...l,e];return a.current?.(n),n})},[c]),V=g(()=>{A(e=>{const l=e.length===c.length?[]:c.map(n=>n.value);return a.current?.(l),l})},[c]);return O(g((e,l)=>{const{focusedIndex:n}=h.current;(l.downArrow||e==="j")&&n<c.length-1&&p({limit:u,type:"focus-next"}),(l.upArrow||e==="k")&&n>0&&p({limit:u,type:"focus-prev"}),e===" "&&M(),e==="a"&&V(),l.return&&C.current?.(T.current)},[c.length,u,M,V]),{isActive:!t&&v}),f(y,{flexDirection:"column",children:L.map((e,l)=>{const d=s.visibleFrom+l===s.focusedIndex,I=b.includes(e.value);let F=i;return I?F="green":d&&(F=r),j(y,{gap:1,children:[d?f(m,{color:r,dimColor:!v,children:"▸"}):f(m,{children:" "}),j(m,{color:F,dimColor:t,children:[I?"◼":"◻"," ",e.label]}),I?f(m,{color:"green",dimColor:!v,children:"✓"}):void 0]},e.key??e.value)})})}export{K as MultiSelect,K as default};
@@ -1 +1 @@
1
- import{jsxs as s,jsx as t}from"react/jsx-runtime";import e from"@visulima/tui/components/box";import f from"@visulima/tui/components/text";function x({children:r,color:n="red",count:o,max:i=99,showZero:c=!1,textColor:d="white"}){const l=o>0||c,a=o>i?`${i}+`:String(o);return s(e,{children:[r,l?t(e,{marginLeft:r===void 0?0:1,children:t(f,{backgroundColor:n,color:d,children:` ${a} `})}):void 0]})}export{x as NotificationBadge,x as default};
1
+ import{jsxs as a,jsx as e}from"react/jsx-runtime";import t from"@visulima/tui/components/box";import c from"@visulima/tui/components/text";function x({children:r,color:l="red",count:o,max:i=99,showZero:n=!1,textColor:d="white"}){const f=o>0||n,s=o>i?`${i}+`:String(o);return a(t,{children:[r,f?e(t,{marginLeft:r===void 0?0:1,children:e(c,{backgroundColor:l,color:d,children:` ${s} `})}):void 0]})}export{x as NotificationBadge,x as default};