@visulima/tui 1.0.7 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/LICENSE.md +54 -2444
  3. package/MIGRATION-GUIDE.md +164 -0
  4. package/README.md +15 -12
  5. package/dist/components/box.d.ts +3 -4
  6. package/dist/components/canvas.d.ts +2 -2
  7. package/dist/components/canvas.js +1 -1
  8. package/dist/components/cursor.d.ts +3 -4
  9. package/dist/components/error-boundary.d.ts +16 -0
  10. package/dist/components/error-boundary.js +1 -0
  11. package/dist/components/error-overview.d.ts +8 -0
  12. package/dist/components/error-overview.js +1 -0
  13. package/dist/components/static-render.d.ts +3 -4
  14. package/dist/components/static.d.ts +1 -2
  15. package/dist/components/text.d.ts +1 -2
  16. package/dist/core/index.d.ts +1 -2
  17. package/dist/core/index.js +1 -1
  18. package/dist/ink/canvas/index.d.ts +24 -0
  19. package/dist/ink/canvas/index.js +1 -0
  20. package/dist/ink/hooks/use-app.d.ts +1 -32
  21. package/dist/ink/hooks/use-app.js +1 -1
  22. package/dist/ink/hooks/use-box-metrics.d.ts +3 -4
  23. package/dist/ink/hooks/use-cursor.d.ts +1 -1
  24. package/dist/ink/hooks/use-input.js +2 -2
  25. package/dist/ink/hooks/use-paste.js +1 -1
  26. package/dist/ink/hooks/use-persistent-state.js +2 -2
  27. package/dist/ink/hooks/use-text-selection.d.ts +4 -5
  28. package/dist/ink/hooks/use-window-size.js +1 -1
  29. package/dist/ink/index.d.ts +7 -7
  30. package/dist/ink/index.js +1 -1
  31. package/dist/ink/mouse/use-element-position.d.ts +3 -4
  32. package/dist/ink/mouse/use-on-mouse-click.d.ts +3 -4
  33. package/dist/ink/mouse/use-on-mouse-hover.d.ts +3 -4
  34. package/dist/ink/mouse/use-on-mouse-state.d.ts +3 -4
  35. package/dist/ink/public/cursor.d.ts +47 -0
  36. package/dist/ink/public/cursor.js +1 -0
  37. package/dist/ink/public/dom.d.ts +6 -0
  38. package/dist/ink/public/dom.js +0 -0
  39. package/dist/ink/public/highlighter.d.ts +54 -0
  40. package/dist/ink/public/highlighter.js +1 -0
  41. package/dist/ink/public/input.d.ts +14 -0
  42. package/dist/ink/public/input.js +1 -0
  43. package/dist/ink/public/styles.d.ts +4 -0
  44. package/dist/ink/public/styles.js +0 -0
  45. package/dist/ink/public/utils.d.ts +5 -0
  46. package/dist/ink/public/utils.js +1 -0
  47. package/dist/packem_chunks/devtools.js +1 -1
  48. package/dist/packem_shared/{DevTools-k6uiVzqv.js → DevTools-D9tfChBc.js} +1 -1
  49. package/dist/packem_shared/InputParser-CiBitCva.js +2 -0
  50. package/dist/packem_shared/TuiApp-DjIgv5Sk.js +1 -0
  51. package/dist/packem_shared/app-context-DTm1_XBA.js +1 -0
  52. package/dist/packem_shared/app-context.d-CG88lgkg.d.ts +56 -0
  53. package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
  54. package/dist/packem_shared/{buffer.d-EJkZr8uH.d.ts → buffer.d-j_dP5JyC.d.ts} +29 -1
  55. package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +1 -0
  56. package/dist/packem_shared/{braille-ch3O5D7I.js → createBrailleGrid-BTOQrujS.js} +1 -1
  57. package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +1 -0
  58. package/dist/packem_shared/disposeHighlighter-D9OkrhwX.js +1 -0
  59. package/dist/packem_shared/{dom.d-B4kXbaVY.d.ts → dom.d-g-nsYquD.d.ts} +3 -4
  60. package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +1 -0
  61. package/dist/packem_shared/index-Dl9I2_QH.js +75 -0
  62. package/dist/packem_shared/input.d-D-Yxqha8.d.ts +172 -0
  63. package/dist/packem_shared/{input-utils-BSWCb4F_.js → isControlCharacter-uDgBe_32.js} +1 -1
  64. package/dist/packem_shared/{reconciler-CFyBVf7l.js → reconciler-DhUGYWCr.js} +1 -1
  65. package/dist/packem_shared/render-D7aV_hO1.js +24 -0
  66. package/dist/packem_shared/{render-DFZ8NHlG.js → render-DMcWfI6-.js} +1 -1
  67. package/dist/packem_shared/{render.d-CBnYBDk2.d.ts → render.d-BvfwvSCx.d.ts} +20 -2
  68. package/dist/packem_shared/{renderToString-L_bpw4OQ.js → renderToString-DkTmJPaS.js} +1 -1
  69. package/dist/packem_shared/{renderToString-DwXFY8Qh.js → renderToString-DqLFFPvO.js} +1 -1
  70. package/dist/packem_shared/renderToken-DjiQ6dfv.js +1 -0
  71. package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +2 -0
  72. package/dist/packem_shared/{renderer-k-xShm1P.js → renderer-Cs0KEr1o.js} +4 -4
  73. package/dist/packem_shared/{selection.d-CI3_p8wg.d.ts → selection.d-KWphH--_.d.ts} +1 -1
  74. package/dist/packem_shared/{styles.d-cMo36xQz.d.ts → styles.d-D7iZuNC-.d.ts} +97 -1
  75. package/dist/packem_shared/utils-C8l_3Dzw.js +1 -0
  76. package/dist/react/index.d.ts +1 -2
  77. package/dist/react/index.js +1 -1
  78. package/dist/testing/index.d.ts +5 -5
  79. package/dist/testing/index.js +1 -1
  80. package/index.js +26 -26
  81. package/package.json +49 -384
  82. package/dist/components/accordion.d.ts +0 -59
  83. package/dist/components/accordion.js +0 -1
  84. package/dist/components/alert.d.ts +0 -26
  85. package/dist/components/alert.js +0 -1
  86. package/dist/components/animate-presence.d.ts +0 -18
  87. package/dist/components/animate-presence.js +0 -1
  88. package/dist/components/approval-prompt.d.ts +0 -65
  89. package/dist/components/approval-prompt.js +0 -1
  90. package/dist/components/area-chart.d.ts +0 -66
  91. package/dist/components/area-chart.js +0 -1
  92. package/dist/components/badge.d.ts +0 -22
  93. package/dist/components/badge.js +0 -1
  94. package/dist/components/bar-chart.d.ts +0 -67
  95. package/dist/components/bar-chart.js +0 -1
  96. package/dist/components/big-text.d.ts +0 -81
  97. package/dist/components/big-text.js +0 -1
  98. package/dist/components/blink-dot.d.ts +0 -36
  99. package/dist/components/blink-dot.js +0 -1
  100. package/dist/components/breadcrumb.d.ts +0 -33
  101. package/dist/components/breadcrumb.js +0 -1
  102. package/dist/components/button.d.ts +0 -45
  103. package/dist/components/button.js +0 -1
  104. package/dist/components/calendar.d.ts +0 -72
  105. package/dist/components/calendar.js +0 -1
  106. package/dist/components/card.d.ts +0 -57
  107. package/dist/components/card.js +0 -1
  108. package/dist/components/checkbox.d.ts +0 -48
  109. package/dist/components/checkbox.js +0 -1
  110. package/dist/components/code.d.ts +0 -48
  111. package/dist/components/code.js +0 -2
  112. package/dist/components/collapsible.d.ts +0 -53
  113. package/dist/components/collapsible.js +0 -1
  114. package/dist/components/command-block.d.ts +0 -47
  115. package/dist/components/command-block.js +0 -4
  116. package/dist/components/command-palette.d.ts +0 -82
  117. package/dist/components/command-palette.js +0 -1
  118. package/dist/components/confirm-dialog.d.ts +0 -75
  119. package/dist/components/confirm-dialog.js +0 -1
  120. package/dist/components/confirm-input.d.ts +0 -38
  121. package/dist/components/confirm-input.js +0 -1
  122. package/dist/components/console-overlay.d.ts +0 -54
  123. package/dist/components/console-overlay.js +0 -1
  124. package/dist/components/content-switcher.d.ts +0 -57
  125. package/dist/components/content-switcher.js +0 -1
  126. package/dist/components/controlled-scroll-view.d.ts +0 -61
  127. package/dist/components/controlled-scroll-view.js +0 -1
  128. package/dist/components/date-picker.d.ts +0 -65
  129. package/dist/components/date-picker.js +0 -1
  130. package/dist/components/definition-list.d.ts +0 -44
  131. package/dist/components/definition-list.js +0 -1
  132. package/dist/components/dialog.d.ts +0 -117
  133. package/dist/components/dialog.js +0 -1
  134. package/dist/components/diff-view.d.ts +0 -85
  135. package/dist/components/diff-view.js +0 -1
  136. package/dist/components/divider.d.ts +0 -49
  137. package/dist/components/divider.js +0 -1
  138. package/dist/components/file-picker-entry.d.ts +0 -104
  139. package/dist/components/file-picker-entry.js +0 -1
  140. package/dist/components/form.d.ts +0 -81
  141. package/dist/components/form.js +0 -1
  142. package/dist/components/gauge.d.ts +0 -87
  143. package/dist/components/gauge.js +0 -1
  144. package/dist/components/gradient.d.ts +0 -42
  145. package/dist/components/gradient.js +0 -1
  146. package/dist/components/heading.d.ts +0 -33
  147. package/dist/components/heading.js +0 -1
  148. package/dist/components/heatmap.d.ts +0 -62
  149. package/dist/components/heatmap.js +0 -1
  150. package/dist/components/help.d.ts +0 -52
  151. package/dist/components/help.js +0 -1
  152. package/dist/components/histogram.d.ts +0 -62
  153. package/dist/components/histogram.js +0 -1
  154. package/dist/components/kbd.d.ts +0 -31
  155. package/dist/components/kbd.js +0 -1
  156. package/dist/components/line-chart.d.ts +0 -109
  157. package/dist/components/line-chart.js +0 -1
  158. package/dist/components/link.d.ts +0 -38
  159. package/dist/components/link.js +0 -1
  160. package/dist/components/loading-indicator.d.ts +0 -29
  161. package/dist/components/loading-indicator.js +0 -1
  162. package/dist/components/markdown.d.ts +0 -40
  163. package/dist/components/markdown.js +0 -1
  164. package/dist/components/masked-input.d.ts +0 -50
  165. package/dist/components/masked-input.js +0 -1
  166. package/dist/components/menu.d.ts +0 -78
  167. package/dist/components/menu.js +0 -1
  168. package/dist/components/message-bubble.d.ts +0 -43
  169. package/dist/components/message-bubble.js +0 -1
  170. package/dist/components/model-badge.d.ts +0 -39
  171. package/dist/components/model-badge.js +0 -1
  172. package/dist/components/multi-select.d.ts +0 -65
  173. package/dist/components/multi-select.js +0 -1
  174. package/dist/components/operation-tree.d.ts +0 -49
  175. package/dist/components/operation-tree.js +0 -1
  176. package/dist/components/option-list.d.ts +0 -47
  177. package/dist/components/option-list.js +0 -1
  178. package/dist/components/ordered-list.d.ts +0 -24
  179. package/dist/components/ordered-list.js +0 -1
  180. package/dist/components/paginator.d.ts +0 -69
  181. package/dist/components/paginator.js +0 -1
  182. package/dist/components/paragraph.d.ts +0 -38
  183. package/dist/components/paragraph.js +0 -1
  184. package/dist/components/placeholder.d.ts +0 -55
  185. package/dist/components/placeholder.js +0 -1
  186. package/dist/components/progress-bar.d.ts +0 -56
  187. package/dist/components/progress-bar.js +0 -1
  188. package/dist/components/radio-group.d.ts +0 -74
  189. package/dist/components/radio-group.js +0 -1
  190. package/dist/components/scatter-plot.d.ts +0 -35
  191. package/dist/components/scatter-plot.js +0 -1
  192. package/dist/components/scroll-bar-box.d.ts +0 -37
  193. package/dist/components/scroll-bar-box.js +0 -1
  194. package/dist/components/scroll-bar.d.ts +0 -25
  195. package/dist/components/scroll-bar.js +0 -1
  196. package/dist/components/scroll-list.d.ts +0 -20
  197. package/dist/components/scroll-list.js +0 -1
  198. package/dist/components/scroll-view.d.ts +0 -10
  199. package/dist/components/scroll-view.js +0 -1
  200. package/dist/components/search-input.d.ts +0 -55
  201. package/dist/components/search-input.js +0 -1
  202. package/dist/components/select-input-indicator.d.ts +0 -32
  203. package/dist/components/select-input-indicator.js +0 -1
  204. package/dist/components/select-input-item.d.ts +0 -41
  205. package/dist/components/select-input-item.js +0 -1
  206. package/dist/components/select-input.d.ts +0 -110
  207. package/dist/components/select-input.js +0 -1
  208. package/dist/components/shimmer-text.d.ts +0 -47
  209. package/dist/components/shimmer-text.js +0 -1
  210. package/dist/components/slider.d.ts +0 -103
  211. package/dist/components/slider.js +0 -1
  212. package/dist/components/sparkline.d.ts +0 -35
  213. package/dist/components/sparkline.js +0 -1
  214. package/dist/components/spinner.d.ts +0 -17
  215. package/dist/components/spinner.js +0 -1
  216. package/dist/components/status-line.d.ts +0 -37
  217. package/dist/components/status-line.js +0 -1
  218. package/dist/components/status-message.d.ts +0 -21
  219. package/dist/components/status-message.js +0 -1
  220. package/dist/components/stepper.d.ts +0 -48
  221. package/dist/components/stepper.js +0 -1
  222. package/dist/components/stopwatch.d.ts +0 -49
  223. package/dist/components/stopwatch.js +0 -1
  224. package/dist/components/streaming-text.d.ts +0 -46
  225. package/dist/components/streaming-text.js +0 -1
  226. package/dist/components/switch.d.ts +0 -55
  227. package/dist/components/switch.js +0 -1
  228. package/dist/components/tab.d.ts +0 -19
  229. package/dist/components/tab.js +0 -1
  230. package/dist/components/table.d.ts +0 -119
  231. package/dist/components/table.js +0 -1
  232. package/dist/components/tabs.d.ts +0 -107
  233. package/dist/components/tabs.js +0 -1
  234. package/dist/components/tag.d.ts +0 -35
  235. package/dist/components/tag.js +0 -1
  236. package/dist/components/text-input.d.ts +0 -48
  237. package/dist/components/text-input.js +0 -1
  238. package/dist/components/textarea.d.ts +0 -68
  239. package/dist/components/textarea.js +0 -2
  240. package/dist/components/timer.d.ts +0 -59
  241. package/dist/components/timer.js +0 -1
  242. package/dist/components/toast.d.ts +0 -49
  243. package/dist/components/toast.js +0 -1
  244. package/dist/components/tooltip.d.ts +0 -43
  245. package/dist/components/tooltip.js +0 -1
  246. package/dist/components/transition.d.ts +0 -74
  247. package/dist/components/transition.js +0 -1
  248. package/dist/components/tree-view-entry.d.ts +0 -357
  249. package/dist/components/tree-view-entry.js +0 -1
  250. package/dist/components/unordered-list.d.ts +0 -30
  251. package/dist/components/unordered-list.js +0 -1
  252. package/dist/ink/hooks/use-linked-scroll.d.ts +0 -49
  253. package/dist/ink/hooks/use-linked-scroll.js +0 -1
  254. package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +0 -1
  255. package/dist/packem_shared/FilePicker-BLS9nOPz.js +0 -1
  256. package/dist/packem_shared/InputParser-CtwkCbrQ.js +0 -2
  257. package/dist/packem_shared/ScrollBar-qa1IzDDv.js +0 -1
  258. package/dist/packem_shared/ScrollBarBox-DchESZWv.js +0 -1
  259. package/dist/packem_shared/ScrollList-BBAnRsrC.js +0 -1
  260. package/dist/packem_shared/ScrollView-CHAo7Epj.js +0 -1
  261. package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
  262. package/dist/packem_shared/TreeView-BsvLCsf0.js +0 -1
  263. package/dist/packem_shared/TuiApp-BPL8v1i1.js +0 -1
  264. package/dist/packem_shared/app-context-BVpKlG1z.js +0 -1
  265. package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +0 -1
  266. package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +0 -12
  267. package/dist/packem_shared/format-time-fjoQHMxD.js +0 -1
  268. package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
  269. package/dist/packem_shared/line-chart-C7CUrvVs.js +0 -1
  270. package/dist/packem_shared/render-CuQecTAs.js +0 -24
  271. package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +0 -2
  272. package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +0 -119
  273. package/dist/packem_shared/token-to-elements-D6J6-P2A.js +0 -1
  274. package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
  275. package/dist/packem_shared/useTreeView-D5ifGwG3.js +0 -1
  276. package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
  277. package/dist/packem_shared/utils-Bup8lyK8.js +0 -1
  278. package/dist/packem_shared/variant-config-BJqpNo7H.js +0 -1
  279. package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +0 -2
@@ -1 +0,0 @@
1
- import{jsxs as N,jsx as I}from"react/jsx-runtime";import{useMemo as u}from"react";import{c as d}from"./braille-ch3O5D7I.js";import{Box as h}from"../components/box.js";import{Canvas as f}from"../components/canvas.js";import{Text as y}from"../components/text.js";const T=["cyan","magenta","yellow","green","blue","red"],g=e=>e.length===0?[]:typeof e[0]=="number"?e.map((o,t)=>({x:t,y:o})):e,E=(e,o,t)=>e.color??t[o%t.length]??"cyan",b=e=>{let o=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const{points:x}of e)for(const n of x)n.x<o&&(o=n.x),n.x>t&&(t=n.x),n.y<r&&(r=n.y),n.y>s&&(s=n.y);return{xMax:t,xMin:o,yMax:s,yMin:r}},Y=T,M=(e,o,t,r)=>{const s=o.xMax-o.xMin||1,x=o.yMax-o.yMin||1,n=(e.x-o.xMin)/s,c=(e.y-o.yMin)/x;return{px:Math.max(0,Math.min(t-1,Math.round(n*(t-1)))),py:Math.max(0,Math.min(r-1,Math.round((1-c)*(r-1))))}},_=(e,o,t)=>{e.clear();const{axisColor:r,seriesList:s}=t,x=Math.max(1,e.width*2),n=Math.max(1,e.height*4);for(let c=0;c<e.width;c+=2)e.setCell(c,e.height-1,"·",{color:r,dim:!0});for(const{color:c,points:m}of s){if(m.length===0)continue;const l=d(e.width,e.height);if(o==="scatter")for(const i of m){const a=M(i,t,x,n);l.plotPoint(a.px,a.py)}else{let i=M(m[0],t,x,n);l.plotPoint(i.px,i.py);for(let a=1;a<m.length;a+=1){const p=M(m[a],t,x,n);l.plotLine(i.px,i.py,p.px,p.py),i=p}}l.flush(e,{color:c})}};function L({axisColor:e="gray",height:o=10,maxY:t,minY:r,palette:s=Y,series:x,showLegend:n=!0,width:c=40}){const m=u(()=>{const l=x.map((a,p)=>({color:E(a,p,s),points:g(a.data),series:a})),i=b(l);return{axisColor:e,palette:s,seriesList:l,xMax:i.xMax===Number.NEGATIVE_INFINITY?1:i.xMax,xMin:i.xMin===Number.POSITIVE_INFINITY?0:i.xMin,yMax:t??(i.yMax===Number.NEGATIVE_INFINITY?1:i.yMax),yMin:r??(i.yMin===Number.POSITIVE_INFINITY?0:i.yMin)}},[x,e,s,r,t]);return N(h,{flexDirection:"column",children:[I(f,{draw:l=>{_(l,"line",m)},height:o,version:[x,c,o,r,t,e,s],width:c}),n?I(h,{gap:2,marginTop:1,children:m.seriesList.map(({color:l,series:i},a)=>N(h,{gap:1,children:[I(y,{color:l,children:"●"}),I(y,{children:i.label??`Series ${a+1}`})]},`${a}:${i.label??""}`))}):void 0]})}export{T as D,M as a,b as c,_ as d,L as h,E as p,g as t};
@@ -1,24 +0,0 @@
1
- import{createRequire as we}from"node:module";import{jsxs as W,jsx as x}from"react/jsx-runtime";import{cursorShow as nt,setMode as Vt,BracketedPasteMode as Xt,resetMode as Zt,cursorUp as yt,cursorTo as Ct,cursorHide as q,cursorDown as Te,setCursorStyle as Re,eraseLines as j,cursorNextLine as Se,eraseLineEnd as Ee,createDecMode as Oe,ALT_SCREEN_ON as Pe,clearScreenAndHomeCursor as Ne,ALT_SCREEN_OFF as ke}from"@visulima/ansi";import{wordWrap as De}from"@visulima/string";import Jt from"is-in-ci";import Le from"patch-console";import{ConcurrentRoot as Ie,LegacyRoot as We}from"react-reconciler/constants.js";import{onExit as $e}from"signal-exit";import A from"yoga-layout";import{a as Me}from"./accessibility-context-DDyHTwmA.js";import{PureComponent as Ae,useState as ct,useRef as $,useCallback as y,useEffect as vt,useMemo as F}from"react";import{e as Be}from"./animation-context-DW3p-vpk.js";import{t as He}from"./app-context-BVpKlG1z.js";import{o as Ue}from"./cursor-context-CFviBqPX.js";import{parseStacktrace as Ye}from"@visulima/error/stacktrace";import je from"code-excerpt";import{Box as _}from"../components/box.js";import{Text as M}from"../components/text.js";import{o as qe}from"./focus-context-CsT69klR.js";import{t as ze}from"./stderr-context-Bvnik0hL.js";import{e as Ge}from"./stdin-context-88AhuztD.js";import{t as Ve}from"./stdout-context-BnblEPez.js";import{I as Xe,_ as Ze,r as Je,H as Qe}from"./renderer-k-xShm1P.js";import{c as ti,e as ei}from"./dom-rphpG0kf.js";import{resolveFlags as ii}from"./kittyFlags-g8ALyoCU.js";import{p as ri}from"./load-native-root-binding-DDikxNox.js";import{a as si}from"./measure-text-B7juNq4Y.js";import{j as L,c as oi}from"./reconciler-CFyBVf7l.js";import{measureAndExtractObservers as ni}from"./ResizeObserver-BI9bDy-j.js";import{calculateScroll as ui}from"./calculateScroll-D4Y_JR4H.js";import{g as X}from"./utils-Bup8lyK8.js";const be=we(import.meta.url),Q=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ot=e=>{if(typeof Q<"u"&&Q.versions&&Q.versions.node){const[t,i]=Q.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return Q.getBuiltinModule(e)}return be(e)},k=Q,{cwd:ye}=k,{Stream:xe}=ot("node:stream"),{Buffer:Ht}=ot("node:buffer"),{Console:Ce}=ot("node:console"),{EventEmitter:_e}=ot("node:events"),{existsSync:Ke,readFileSync:Fe}=ot("node:fs"),Qt="\x1B[200~",Ut="\x1B[201~",ai=e=>e>=48&&e<=63,li=e=>e>=32&&e<=47,te=e=>e>=64&&e<=126,di=(e,t,i)=>{const r=t+i+1;let o=r;for(;o<e.length;o++){const u=e.codePointAt(o);if(u===void 0)return"pending";if(!(ai(u)||li(u))&&!(u===91&&o===r))return te(u)?{nextIndex:o+1,sequence:e.slice(t,o+1)}:void 0}return"pending"},ci=(e,t,i)=>{const r=t+i+2;if(r>e.length)return"pending";const o=e.codePointAt(r-1);if(!(o===void 0||!te(o)))return{nextIndex:r,sequence:e.slice(t,r)}},Kt=(e,t,i)=>{const r=e[t+i];if(r===void 0)return"pending";if(r==="[")return di(e,t,i);if(r==="O")return ci(e,t,i)},hi=(e,t)=>{const i=e.codePointAt(t+1),r=i!==void 0&&i>65535?2:1,o=t+1+r;return{nextIndex:o,sequence:e.slice(t,o)}},fi=(e,t)=>{if(t===e.length-1)return"pending";if(e[t+1]==="\x1B"){if(t+2>=e.length)return"pending";const r=Kt(e,t,2);return r==="pending"?"pending":r||{nextIndex:t+2,sequence:e.slice(t,t+2)}}const i=Kt(e,t,1);return i==="pending"?"pending":i||hi(e,t)},Ft=(e,t)=>{let i=0;for(let r=0;r<e.length;r++){const o=e[r];(o===""||o==="\b")&&(r>i&&t.push(e.slice(i,r)),t.push(o),i=r+1)}i<e.length&&t.push(e.slice(i))},pi=e=>{const t=[];let i=0;const r=o=>({events:t,pending:e.slice(o)});for(;i<e.length;){const o=e.indexOf("\x1B",i);if(o===-1)return Ft(e.slice(i),t),{events:t,pending:""};o>i&&Ft(e.slice(i,o),t);const u=fi(e,o);if(u==="pending")return r(o);if(u.sequence===Qt){const l=u.nextIndex,n=e.indexOf(Ut,l);if(n===-1)return r(o);t.push({paste:e.slice(l,n)}),i=n+Ut.length;continue}t.push(u.sequence),i=u.nextIndex}return{events:t,pending:""}},mi=()=>{let e="";return{flushPendingEscape(){if(!e.startsWith("\x1B"))return;const t=e;return e="",t},hasPendingEscape(){return e.startsWith("\x1B")&&!e.startsWith(Qt)&&e!=="\x1B[200"},push(t){const i=pi(e+t);return e=i.pending,i.events},reset(){e=""}}},wt=e=>{if(!e)return e;const t=ye();return e.replace(`file://${t}/`,"").replace(`${t}/`,"")};function gi({error:e}){const t=Ye(e),i=new Map,r=t.map(s=>{const a=!s.methodName&&!s.file?`raw:${s.raw}`:`${wt(s.file)??""}:${s.line}:${s.column}:${s.methodName??""}`,p=i.get(a)??0;return i.set(a,p+1),{key:`${a}#${p}`,trace:s}}),o=t[0],u=wt(o?.file);let l,n=0;if(u&&o?.line&&Ke(u)){const s=Fe(u,"utf8");if(l=je(s,o.line),l)for(const{line:a}of l)n=Math.max(n,String(a).length)}return W(_,{flexDirection:"column",padding:1,children:[W(_,{children:[W(M,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),W(M,{children:[" ",e.message]})]}),o&&u?x(_,{marginTop:1,children:W(M,{dimColor:!0,children:[u,":",o.line,":",o.column]})}):null,o&&l?x(_,{flexDirection:"column",marginTop:1,children:l.map(({line:s,value:a})=>W(_,{children:[x(_,{width:n+1,children:W(M,{"aria-label":s===o.line?`Line ${s}, error`:`Line ${s}`,backgroundColor:s===o.line?"red":void 0,color:s===o.line?"white":void 0,dimColor:s!==o.line,children:[String(s).padStart(n," "),":"]})}),x(M,{backgroundColor:s===o.line?"red":void 0,color:s===o.line?"white":void 0,children:` ${a}`})]},`excerpt-${s}`))}):null,t.length>0?x(_,{flexDirection:"column",marginTop:1,children:r.map(({key:s,trace:a})=>{const p=wt(a.file)??"";return!a.methodName&&!a.file?W(_,{children:[x(M,{dimColor:!0,children:"- "}),x(M,{bold:!0,dimColor:!0,children:a.raw})]},s):W(_,{children:[x(M,{dimColor:!0,children:"- "}),x(M,{bold:!0,dimColor:!0,children:a.methodName??"<anonymous>"}),W(M,{"aria-label":`at ${p} line ${a.line} column ${a.column}`,color:"gray",dimColor:!0,children:[" ","(",p,":",a.line,":",a.column,")"]})]},s)})}):null]})}class vi extends Ae{static displayName="InternalErrorBoundary";static getDerivedStateFromError(t){return{error:t}}state={error:void 0};componentDidCatch(t){this.props.onError(t)}render(){return this.state.error?x(gi,{error:this.state.error}):this.props.children}}const wi=" ",bi="\x1B[Z",yi="\x1B",xi=Vt(Xt),Yt=Zt(Xt),ee=({children:e,exitOnCtrlC:t,interactive:i,onExit:r,onWaitUntilRenderFlush:o,renderThrottleMs:u,setCursorPosition:l,stderr:n,stdin:s,stdout:a,writeToStderr:p,writeToStdout:w})=>{const[g,d]=ct(!0),[h,v]=ct(void 0),[,b]=ct([]),P=$(0),T=$(new Map),D=$(void 0),N=$(0),I=$(!1),E=$(0),[S]=ct(()=>{const c=new _e;return c.setMaxListeners(1/0),c}),K=$(void 0),R=$(void 0);R.current??=mi();const B=$(void 0),Tt=$(!1),ae=20,z=y(()=>{B.current&&(clearTimeout(B.current),B.current=void 0)},[]),G=y(()=>{D.current&&(clearTimeout(D.current),D.current=void 0)},[]),ut=y(()=>{if(G(),T.current.size===0)return;let c=Number.POSITIVE_INFINITY;for(const f of T.current.values())c=Math.min(c,f.nextDueTime);const m=Math.max(0,c-performance.now());D.current=setTimeout(()=>{D.current=void 0;const f=performance.now(),C=[...T.current.values()];for(const O of C){if(f<O.nextDueTime)continue;O.callback(f);const ge=f-O.startTime,ve=Math.floor(ge/O.interval)+1;O.nextDueTime=O.startTime+ve*O.interval}ut()},m)},[G]),Rt=y((c,m)=>{const f=performance.now();return T.current.set(c,{callback:c,interval:m,nextDueTime:f+m,startTime:f}),ut(),{startTime:f,unsubscribe(){if(T.current.delete(c),T.current.size===0){G();return}ut()}}},[G,ut]);vt(()=>()=>{G()},[G]);const H=s.isTTY,St=y(()=>{K.current&&(s.removeListener("readable",K.current),K.current=void 0)},[s]),at=y(()=>{R.current?.reset(),z(),St()},[z,St]),V=y(()=>{I.current=!1,s.setRawMode(!1),s.unref(),N.current=0,at()},[s,at]),et=y(c=>{H&&(N.current>0||I.current)&&V(),r(c)},[H,V,r]),Et=y(c=>{if(c.includes("")&&t){et();return}c===yi&&g&&v(m=>{if(!m)return m})},[t,et,g]),it=y(c=>{Et(c),S.emit("input",c)},[Et,S]),Ot=y(()=>{z(),B.current=setTimeout(()=>{B.current=void 0;const c=R.current.flushPendingEscape();c&&it(c)},ae)},[z,it]),gt=y(()=>{z();let c;for(;(c=s.read())!==null;){const m=R.current.push(c);for(const f of m)if(typeof f=="string")it(f);else{if(S.listenerCount("paste")===0){Tt.current||(Tt.current=!0,p(`Warning: useInput() received bracketed paste because no usePaste() handler is active. This fallback is deprecated and will be removed in the next major version. Migrate paste handling to usePaste().
2
- `)),it(f.paste);continue}S.emit("paste",f.paste)}}R.current.hasPendingEscape()&&Ot()},[s,it,z,Ot,p,S]),Pt=y(()=>{K.current||(K.current=gt,s.addListener("readable",gt))},[s,gt]),Nt=y(c=>{if(!H)throw s===k.stdin?new Error(`Raw mode is not supported on the current process.stdin, which Ink uses as input stream by default.
3
- Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`):new Error(`Raw mode is not supported on the stdin provided to Ink.
4
- Read about how to prevent this error on https://github.com/vadimdemedes/ink/#israwmodesupported`);if(s.setEncoding("utf8"),c){if(N.current===0){const m=I.current;I.current=!1,m||(s.ref(),s.setRawMode(!0)),Pt()}N.current++;return}N.current!==0&&--N.current===0&&(at(),I.current=!0,queueMicrotask(()=>{I.current&&V()}))},[H,s,Pt,at,V]),kt=y(c=>{if(a.isTTY){if(c){E.current===0&&a.write(xi),E.current++;return}E.current!==0&&--E.current===0&&a.write(Yt)}},[a]),Dt=y((c,m)=>{const f=c.findIndex(C=>C.id===m);for(let C=f+1;C<c.length;C++){const O=c[C];if(O?.isActive)return O.id}},[]),Lt=y((c,m)=>{const f=c.findIndex(C=>C.id===m);for(let C=f-1;C>=0;C--){const O=c[C];if(O?.isActive)return O.id}},[]),lt=y(()=>{b(c=>(v(m=>{const f=c.find(C=>C.isActive)?.id;return Dt(c,m)??f}),c))},[Dt]),dt=y(()=>{b(c=>(v(m=>{const f=c.findLast(C=>C.isActive)?.id;return Lt(c,m)??f}),c))},[Lt]);vt(()=>{const c=f=>{!g||P.current===0||(f===wi&&lt(),f===bi&&dt())};S.on("input",c);const m=S;return()=>{m.off("input",c)}},[g,lt,dt,S]);const It=y(()=>{d(!0)},[]),Wt=y(()=>{d(!1)},[]),$t=y(c=>{b(m=>(m.some(f=>f?.id===c)&&v(c),m))},[]),Mt=y((c,{autoFocus:m})=>{b(f=>(P.current=f.length+1,[...f,{id:c,isActive:!0}])),m&&v(f=>f||c)},[]),_t=y(c=>{v(m=>{if(m!==c)return m}),b(m=>{const f=m.filter(C=>C.id!==c);return P.current=f.length,f})},[]),At=y(c=>{b(m=>m.map(f=>f.id!==c?f:{id:c,isActive:!0}))},[]),Bt=y(c=>{v(m=>{if(m!==c)return m}),b(m=>m.map(f=>f.id!==c?f:{id:c,isActive:!1}))},[]);vt(()=>()=>{const c=!a.destroyed&&!a.writableEnded;i&&c&&a.write(nt),H&&(N.current>0||I.current)&&V(),E.current>0&&(a.isTTY&&c&&a.write(Yt),E.current=0)},[a,H,V,i]);const le=F(()=>({exit:et,waitUntilRenderFlush:o}),[et,o]),de=F(()=>({internal_eventEmitter:S,internal_exitOnCtrlC:t,isRawModeSupported:H,setBracketedPasteMode:kt,setRawMode:Nt,stdin:s}),[s,Nt,kt,H,t,S]),ce=F(()=>({stdout:a,write:w}),[a,w]),he=F(()=>({stderr:n,write:p}),[n,p]),fe=F(()=>({setCursorPosition:l}),[l]),pe=F(()=>({activate:At,activeId:h,add:Mt,deactivate:Bt,disableFocus:Wt,enableFocus:It,focus:$t,focusNext:lt,focusPrevious:dt,remove:_t}),[h,Mt,_t,At,Bt,It,Wt,lt,dt,$t]),me=F(()=>({renderThrottleMs:u,subscribe:Rt}),[Rt,u]);return x(He.Provider,{value:le,children:x(Ge.Provider,{value:de,children:x(Ve.Provider,{value:ce,children:x(ze.Provider,{value:he,children:x(qe.Provider,{value:pe,children:x(Be.Provider,{value:me,children:x(Ue.Provider,{value:fe,children:x(vi,{onError:et,children:e})})})})})})})})};ee.displayName="InternalApp";const Ci=(e,t,i)=>{if(i<=0||!e.yogaNode)return"";const{yogaNode:r}=e,o=r.getComputedBorder(A.EDGE_LEFT),u=r.getComputedBorder(A.EDGE_RIGHT),l=r.getComputedBorder(A.EDGE_TOP),n=r.getComputedPadding(A.EDGE_LEFT),s=r.getComputedPadding(A.EDGE_RIGHT),a=r.getComputedPadding(A.EDGE_TOP),p=Math.round(r.getComputedWidth()-o-u-n-s);if(p<=0)return"";const w=new Xe({height:i,width:p}),g=-(e.internal_scrollState?.scrollLeft??0)-o-n,d=-t-l-a;for(const h of e.childNodes)Ze(h,w,{absoluteOffsetX:g,absoluteOffsetY:d,offsetX:g,offsetY:d,skipStaticElements:!1});return w.get().output},xt=new WeakMap,Ti={bar:6,"blinking-bar":5,"blinking-block":1,"blinking-underline":3,block:2,default:0,underline:4},jt=e=>Re(Ti[e]),ft=(e,t)=>e?.x!==t?.x||e?.y!==t?.y,tt=(e,t)=>{if(!t)return"";const i=e-t.y;return(i>0?yt(i):"")+Ct(t.x)+nt},ie=(e,t)=>{if(!t)return"";const i=e-1-t.y;return(i>0?Te(i):"")+Ct(0)},re=e=>{const t=e.cursorWasShown?q:"",i=ie(e.previousLineCount,e.previousCursorPosition),r=tt(e.visibleLineCount,e.cursorPosition);return t+i+r},pt=(e,t,i)=>e?q+ie(t,i):"",Z=e=>e??"default",se=()=>{let e,t;return{consumeDelta:()=>{if(Z(t)===Z(e))return"";const i=Z(t);return e=t,jt(i)},consumeRestoreOnDone:()=>{const i=Z(e)!=="default";return e=void 0,t=void 0,i?jt("default"):""},isDirty:()=>Z(t)!==Z(e),setPending:i=>{t=i}}},st=(e,t)=>t.endsWith(`
5
- `)?e.length-1:e.length,oe=e=>e.rows||1/0,mt=(e,t)=>Math.min(e,oe(t)),Ri=(e,{showCursor:t=!1}={})=>{let i=0,r="",o=!1,u,l=!1,n,s=!1;const a=se(),p=()=>l?u:void 0,w=(d,h)=>{const v=ft(h,n);return d!==r||v||a.isDirty()},g=d=>{!t&&!o&&(e.write(q),o=!0);const h=p();l=!1;const v=ft(h,n);if(!w(d,h))return!1;const b=a.consumeDelta(),P=d.split(`
6
- `),T=st(P,d),D=tt(T,h);if(d===r&&v)e.write(b+re({cursorPosition:h,cursorWasShown:s,previousCursorPosition:n,previousLineCount:i,visibleLineCount:T}));else if(d===r&&b!=="")e.write(b);else{r=d;const N=pt(s,i,n);e.write(b+N+j(mt(i,e))+d+D),i=P.length}return n=h?{...h}:void 0,s=h!==void 0,!0};return g.clear=()=>{const d=pt(s,i,n);e.write(d+j(mt(i,e))),r="",i=0,n=void 0,s=!1},g.done=()=>{r="",i=0,n=void 0,s=!1;const d=a.consumeRestoreOnDone();d!==""&&e.write(d),t||(e.write(nt),o=!1)},g.reset=()=>{r="",i=0,n=void 0,s=!1},g.sync=d=>{const h=l?u:void 0;l=!1;const v=d.split(`
7
- `);r=d,i=v.length;const b=a.consumeDelta();b!==""&&e.write(b),!h&&s&&e.write(q),h&&e.write(tt(st(v,d),h)),n=h?{...h}:void 0,s=h!==void 0},g.setCursorPosition=d=>{u=d,l=!0},g.setCursorShape=a.setPending,g.isCursorDirty=()=>l||a.isDirty(),g.willRender=d=>w(d,p()),g},Si=(e,{showCursor:t=!1}={})=>{let i=[],r="",o=!1,u,l=!1,n,s=!1;const a=se(),p=()=>l?u:void 0,w=(d,h)=>{const v=ft(h,n);return d!==r||v||a.isDirty()},g=d=>{!t&&!o&&(e.write(q),o=!0);const h=p();l=!1;const v=ft(h,n);if(!w(d,h))return!1;const b=a.consumeDelta(),P=d.split(`
8
- `),T=st(P,d),D=st(i,r);if(d===r&&v)return e.write(b+re({cursorPosition:h,cursorWasShown:s,previousCursorPosition:n,previousLineCount:i.length,visibleLineCount:T})),n=h?{...h}:void 0,s=h!==void 0,!0;if(d===r&&b!=="")return e.write(b),!0;const N=pt(s,i.length,n);if(d===`
9
- `||r.length===0){const R=tt(T,h);return e.write(b+N+j(mt(i.length,e))+d+R),s=h!==void 0,n=h?{...h}:void 0,r=d,i=P,!0}const I=d.endsWith(`
10
- `),E=[b,N],S=oe(e);if(T<D){const R=r.endsWith(`
11
- `)?1:0;E.push(j(Math.min(D-T+R,S)),yt(Math.min(T,S-1)))}else E.push(yt(Math.min(D-1,S-1)));for(let R=0;R<T;R++){const B=R===T-1;if(P[R]===i[R]){(!B||I)&&E.push(Se());continue}E.push(Ct(0)+P[R]+Ee+(B&&!I?"":`
12
- `))}const K=tt(T,h);return E.push(K),e.write(E.join("")),s=h!==void 0,n=h?{...h}:void 0,r=d,i=P,!0};return g.clear=()=>{const d=pt(s,i.length,n);e.write(d+j(mt(i.length,e))),r="",i=[],n=void 0,s=!1},g.done=()=>{r="",i=[],n=void 0,s=!1;const d=a.consumeRestoreOnDone();d!==""&&e.write(d),t||(e.write(nt),o=!1)},g.reset=()=>{r="",i=[],n=void 0,s=!1},g.sync=d=>{const h=l?u:void 0;l=!1;const v=d.split(`
13
- `);r=d,i=v;const b=a.consumeDelta();b!==""&&e.write(b),!h&&s&&e.write(q),h&&e.write(tt(st(v,d),h)),n=h?{...h}:void 0,s=h!==void 0},g.setCursorPosition=d=>{u=d,l=!0},g.setCursorShape=a.setPending,g.isCursorDirty=()=>l||a.isDirty(),g.willRender=d=>w(d,p()),g},Ei=(e,{incremental:t=!1,showCursor:i=!1}={})=>t?Si(e,{showCursor:i}):Ri(e,{showCursor:i}),Oi={create:Ei},ne=Oe(2026),Y=Vt(ne),U=Zt(ne);function Pi(e,t){return"isTTY"in e&&e.isTTY&&(t??!Jt)}let J;const Ni=()=>{if(J!==!1){if(J!==void 0)return J;try{return J=ri(import.meta.url).Renderer,J}catch{J=!1;return}}},ki=e=>{const t=Ni();if(!t)return;let i,r=0,o=0;const u=(l,n)=>{(!i||r!==l||o!==n)&&(i?i.resize(l,n):i=new t(l,n),r=l,o=n)};return{clear(){if(i){const l=new Uint32Array(r*o*2),n=65535;for(let s=0;s<l.length;s+=2)l[s]=32,l[s+1]=n;i.render(l)}},destroy(){i=void 0},render(l,n,s){if(u(n,s),!!i){e.isTTY&&i.writeRaw(Y);try{i.render(l)}finally{e.isTTY&&i.writeRaw(U)}}},resize(l,n){u(l,n)}}};function qt(e,t=0,i={}){const r=i.leading??!0,o=i.trailing??!0;let u,l,n,s;const a=()=>{if(l===void 0)return;const h=l;l=void 0,s=e(...h)},p=()=>{u!==void 0&&(clearTimeout(u),u=void 0)},w=()=>{u=void 0,o&&a(),l=void 0,n=void 0},g=()=>{p(),u=setTimeout(w,t)},d=function(...h){const v=Date.now();if(n??=v,v-n>=t)return l=h,a(),n=v,g(),s;l=h;const b=u===void 0;return g(),r&&b&&a(),s};return d.cancel=()=>{p(),l=void 0,n=void 0},d.flush=()=>(p(),a(),n=void 0,s),d}console.Console||(console.Console=Ce);const rt=()=>{},zt=async()=>new Promise(e=>{setImmediate(e)}),Di=27,Li=91,Ii=63,Wi=117,$i=48,Mi=57,_i=e=>e>=$i&&e<=Mi,ue=(e,t)=>{if(e[t]!==Di||e[t+1]!==Li||e[t+2]!==Ii)return;let i=t+3;const r=i;for(;i<e.length&&_i(e[i]);)i++;if(i!==r){if(i===e.length)return{state:"partial"};if(e[i]===Wi)return{endIndex:i,state:"complete"}}},Ai=e=>{for(let t=0;t<e.length;t++)if(ue(e,t)?.state==="complete")return!0;return!1},Bi=e=>{const t=[];let i=0;for(;i<e.length;){const r=ue(e,i);if(r?.state==="complete"){i=r.endIndex+1;continue}if(r?.state==="partial")break;t.push(e[i]),i++}return t},Hi=({isTty:e,isUnmounting:t,isWindows:i,nextOutputHeight:r,previousOutputHeight:o,viewportRows:u})=>{if(!e)return!1;const l=o>0,n=o>=u,s=r>=u,a=o>u,p=r>u,w=n&&r<u;return a||p&&l||w||t&&n||i&&(s||n)},bt=e=>e instanceof Error||Object.prototype.toString.call(e)==="[object Error]",Gt=e=>{const t=!e.destroyed&&!e.writableEnded&&(e.writable??!0),i=e._writableState!==void 0||e.writableLength!==void 0;return{canWriteToStdout:t,hasWritableState:i}},ht=(e,t)=>{if(!e||typeof e.flush!="function")return;const i=e;t?i.flush():typeof i.cancel=="function"&&i.cancel()};class Ui{isConcurrent;options;log;manualCursorPosition;renderedCursorPosition;renderedCursorRequested;throttledLog;isScreenReaderEnabled;interactive;renderThrottleMs;alternateScreen;isUnmounted;isUnmounting;lastOutput;lastOutputToRender;lastOutputHeight;lastTerminalWidth;nativeLog;useNativeRenderer;container;rootNode;fullStaticOutput;backbufferNode;backbufferMultiWarned=!1;exitPromise;exitResult;beforeExitHandler;restoreConsole;unsubscribeResize;throttledOnRender;hasPendingThrottledRender=!1;kittyProtocolEnabled=!1;cancelKittyDetection;nextRenderCommit;deferredInitDone=!1;constructor(t){this.options=t,this.rootNode=ti("ink-root"),this.rootNode.onComputeLayout=this.calculateLayout,this.isScreenReaderEnabled=t.isScreenReaderEnabled??k.env.INK_SCREEN_READER==="true",this.interactive=this.resolveInteractiveOption(t.interactive),this.alternateScreen=!1;const i=t.debug||this.isScreenReaderEnabled,r=t.maxFps??30,o=r>0?Math.max(1,Math.ceil(1e3/r)):0;this.renderThrottleMs=i?0:o;const u=i?this.onRender:(()=>{const n=qt(this.onRender,o,{leading:!0,trailing:!0});return this.throttledOnRender=n,()=>{this.hasPendingThrottledRender=!0,n()}})();if(i&&(this.throttledOnRender=void 0),t.standardReactLayoutTiming){let n=!1;const s=()=>{n||(n=!0,queueMicrotask(()=>{n=!1,this.onRender()}))};this.rootNode.onRender=s,this.rootNode.onImmediateRender=s}else this.rootNode.onRender=u,this.rootNode.onImmediateRender=this.onRender;this.rootNode.onStaticChange=this.handleStaticChange,this.log=Oi.create(t.stdout,{incremental:t.incrementalRendering}),this.useNativeRenderer=t.useNativeRenderer??!1,this.useNativeRenderer&&(this.nativeLog=ki(t.stdout),this.nativeLog||(this.useNativeRenderer=!1)),this.manualCursorPosition=void 0,this.renderedCursorPosition=void 0,this.renderedCursorRequested=!1,this.throttledLog=i?this.log:qt(n=>{const s=this.log.willRender(n),a=this.shouldSync();a&&s&&this.options.stdout.write(Y),this.log(n),a&&s&&this.options.stdout.write(U)},void 0,{leading:!0,trailing:!0}),this.isUnmounted=!1,this.isUnmounting=!1,this.isConcurrent=t.concurrent??!1,this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.lastTerminalWidth=X(this.options.stdout).columns,this.fullStaticOutput="";const l=t.concurrent?Ie:We;this.container=L.createContainer(this.rootNode,l,null,!1,null,"id",()=>{},()=>{},()=>{},()=>{}),this.unsubscribeExit=$e(this.unmount,{alwaysLast:!1}),this.setAlternateScreen(!!t.alternateScreen),t.patchConsole&&this.patchConsole(),this.interactive&&(t.stdout.on("resize",this.resized),this.unsubscribeResize=()=>{t.stdout.off("resize",this.resized)}),this.initImmediateKittyKeyboard(),k.env.DEV==="true"&&L.injectIntoDevTools(),this.exitPromise=new Promise((n,s)=>{this.resolveExitPromise=n,this.rejectExitPromise=s}),this.exitPromise.catch(rt)}runDeferredInit(){this.deferredInitDone||(this.deferredInitDone=!0,this.initDeferredKittyKeyboard())}resized=()=>{const t=X(this.options.stdout).columns;t<this.lastTerminalWidth&&(this.log.clear(),this.lastOutput="",this.lastOutputToRender=""),si(),this.calculateLayout(),ei(this.rootNode),this.onRender(),this.lastTerminalWidth=t};resolveExitPromise=()=>{};rejectExitPromise=()=>{};unsubscribeExit=()=>{};handleAppExit=t=>{if(!(this.isUnmounted||this.isUnmounting)){if(bt(t)){this.unmount(t);return}this.exitResult=t,this.unmount()}};getActiveCursorPosition=()=>this.renderedCursorRequested?this.renderedCursorPosition:this.manualCursorPosition;setCursorPosition=t=>{this.manualCursorPosition=t,this.log.setCursorPosition(this.getActiveCursorPosition())};restoreLastOutput=()=>{this.interactive&&(this.log.setCursorPosition(this.getActiveCursorPosition()),this.log(this.lastOutputToRender||`${this.lastOutput}
14
- `))};calculateLayout=()=>{const t=r=>{const o=new Map;this.calculateScrollAndTriggerObservers(r,o);for(const[u,l]of o)u.internalTrigger(l)};this.backbufferNode=void 0,this.prepareYogaTree(this.rootNode,t);const i=X(this.options.stdout).columns;this.rootNode.yogaNode.setWidth(i),this.rootNode.yogaNode.calculateLayout(void 0,void 0,A.DIRECTION_LTR),t(this.rootNode)};calculateScrollAndTriggerObservers(t,i){if(t.nodeName==="ink-box"){const{style:r}=t,o=r.overflow??"visible",u=r.overflowX??o,l=r.overflowY??o;u==="scroll"||l==="scroll"?(ui(t),r.overflowToBackbuffer&&(this.backbufferNode&&this.backbufferNode!==t&&!this.backbufferMultiWarned&&(this.backbufferMultiWarned=!0,console.warn("[@visulima/tui] Multiple scrollable regions have `overflowToBackbuffer` enabled; only one is supported. The last one in render order wins.")),this.backbufferNode=t)):t.internal_scrollState&&delete t.internal_scrollState}if(ni(t,i),!t.internal_static)for(const r of t.childNodes)r.nodeName!=="#text"&&this.calculateScrollAndTriggerObservers(r,i)}recalculateLayout(){this.markAllTextNodesDirty(this.rootNode),this.calculateLayout(),this.onRender()}prepareYogaTree(t,i){if(t.isYogaTreeDetached&&!t.cachedRender&&t.yogaNode){for(t.yogaNode.setWidthAuto(),t.yogaNode.setHeightAuto(),oi(t.yogaNode,t.style);t.yogaNode.getChildCount()>0;)t.yogaNode.getChild(0).remove();let r=0;for(const o of t.childNodes){const u=o;o.nodeName!=="#text"&&u.yogaNode&&(t.yogaNode.insertChild(u.yogaNode,r),r++)}t.isYogaTreeDetached=!1,this.markAllTextNodesDirty(t)}for(const r of t.childNodes)r.nodeName!=="#text"&&this.prepareYogaTree(r,i);if(t.nodeName==="ink-static-render"&&!t.cachedRender){const r=X(this.options.stdout).columns,{width:o}=t.style;t.yogaNode&&(t.yogaNode.setWidth(typeof o=="number"?o:r),t.yogaNode.calculateLayout(void 0,void 0,A.DIRECTION_LTR)),i(t),Je(t,{skipStaticElements:!1}),t.internal_onRendered?.()}}markAllTextNodesDirty(t){if(!t.cachedRender){t.nodeName==="ink-text"&&t.yogaNode&&t.yogaNode.markDirty();for(const i of t.childNodes)i.nodeName!=="#text"&&this.markAllTextNodesDirty(i)}}handleStaticChange=()=>{this.fullStaticOutput=""};computeBackbufferOutput(){const t=this.backbufferNode;if(!t?.internal_scrollState||!this.interactive||!this.options.stdout.isTTY||this.alternateScreen||this.isScreenReaderEnabled||this.options.debug)return"";const i=Math.round(t.internal_scrollState.scrollTop),r=t.yogaNode?.getComputedPadding(A.EDGE_TOP)??0,o=Math.max(0,i-Math.round(r)),u=t.internal_maxPushedScrollTop??0,{maxScrollbackLength:l}=t.style,n=l===void 0?u:Math.max(u,o-Math.max(0,l)),s=o-n;if(s<=0)return"";const a=Ci(t,n,s);return a===""?"":(t.internal_maxPushedScrollTop=o,`${a}\x1B[0m
15
- `)}onRender=()=>{if(this.hasPendingThrottledRender=!1,this.isUnmounted)return;this.deferredInitDone||this.runDeferredInit(),this.nextRenderCommit&&(this.nextRenderCommit.resolve(),this.nextRenderCommit=void 0);const t=Qe(this.rootNode,this.isScreenReaderEnabled,{useNativeRenderer:this.useNativeRenderer}),{cursorPosition:i,cursorRequested:r,cursorShape:o,output:u,outputBuffer:l,outputHeight:n,outputWidth:s,staticOutput:a}=t;this.renderedCursorRequested=r,this.renderedCursorPosition=i,this.log.setCursorShape(r?o:void 0);const p=this.computeBackbufferOutput();if(this.useNativeRenderer&&this.nativeLog&&l&&s){a&&a!==`
16
- `&&this.options.stdout.write(a),p&&this.options.stdout.write(p),this.nativeLog.render(l,s,n),this.lastOutputHeight=n;return}r&&this.log.setCursorPosition(this.getActiveCursorPosition());const w=a&&a!==`
17
- `;if(this.options.debug){w&&(this.fullStaticOutput+=a),this.lastOutput=u,this.lastOutputToRender=u,this.lastOutputHeight=n,this.options.stdout.write(this.fullStaticOutput+u);return}if(!this.interactive){w&&this.options.stdout.write(a),this.lastOutput=u,this.lastOutputToRender=`${u}
18
- `,this.lastOutputHeight=n;return}if(this.isScreenReaderEnabled){const g=this.shouldSync();if(g&&this.options.stdout.write(Y),w){const v=this.lastOutputHeight>0?j(this.lastOutputHeight):"";this.options.stdout.write(v+a),this.lastOutputHeight=0}if(u===this.lastOutput&&!w){g&&this.options.stdout.write(U);return}const d=X(this.options.stdout).columns,h=De(u,{trim:!1,width:d,wrapMode:"BREAK_WORDS"}).replace(/\n$/,"");if(w)this.options.stdout.write(h);else{const v=this.lastOutputHeight>0?j(this.lastOutputHeight):"";this.options.stdout.write(v+h)}this.lastOutput=u,this.lastOutputToRender=h,this.lastOutputHeight=h===""?0:h.split(`
19
- `).length,g&&this.options.stdout.write(U);return}w&&(this.fullStaticOutput+=a),this.renderInteractiveFrame(u,n,w?a:"",p)};accessibilityContextValue;render(t){this.accessibilityContextValue??={isScreenReaderEnabled:this.isScreenReaderEnabled};const i=x(Me.Provider,{value:this.accessibilityContextValue,children:x(ee,{exitOnCtrlC:this.options.exitOnCtrlC,interactive:this.interactive,onExit:this.handleAppExit,onWaitUntilRenderFlush:this.waitUntilRenderFlush,renderThrottleMs:this.renderThrottleMs,setCursorPosition:this.setCursorPosition,stderr:this.options.stderr,stdin:this.options.stdin,stdout:this.options.stdout,writeToStderr:this.writeToStderr,writeToStdout:this.writeToStdout,children:t})});this.options.concurrent?L.updateContainer(i,this.container,null,rt):(L.updateContainerSync(i,this.container,null,rt),L.flushSyncWork())}writeToStdout=t=>{if(this.isUnmounted)return;if(this.options.debug){this.options.stdout.write(t+this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stdout.write(t);return}const i=this.shouldSync();i&&this.options.stdout.write(Y),this.log.clear(),this.options.stdout.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(U)};writeToStderr=t=>{if(this.isUnmounted)return;if(this.options.debug){this.options.stderr.write(t),this.options.stdout.write(this.fullStaticOutput+this.lastOutput);return}if(!this.interactive){this.options.stderr.write(t);return}const i=this.shouldSync();i&&this.options.stdout.write(Y),this.log.clear(),this.options.stderr.write(t),this.restoreLastOutput(),i&&this.options.stdout.write(U)};unmount=t=>{if(this.isUnmounted||this.isUnmounting)return;this.isUnmounting=!0,this.beforeExitHandler&&(k.off("beforeExit",this.beforeExitHandler),this.beforeExitHandler=void 0);const i=this.options.stdout,{canWriteToStdout:r,hasWritableState:o}=Gt(i);ht(this.throttledOnRender,r),r&&!this.alternateScreen&&(!this.throttledOnRender||!this.hasPendingThrottledRender&&this.fullStaticOutput==="")&&(this.calculateLayout(),this.onRender()),this.isUnmounted=!0,this.unsubscribeExit(),ht(this.throttledLog,r),typeof this.restoreConsole=="function"&&this.restoreConsole();const u=()=>{typeof this.unsubscribeResize=="function"&&this.unsubscribeResize(),this.cancelKittyDetection&&this.cancelKittyDetection(),r&&(this.kittyProtocolEnabled&&this.writeBestEffort(this.options.stdout,"\x1B[<u"),this.alternateScreen?(this.log.clear(),this.log.done(),this.lastOutput="",this.lastOutputToRender="",this.lastOutputHeight=0,this.fullStaticOutput="",this.writeBestEffort(this.options.stdout,ke),this.writeBestEffort(this.options.stdout,nt),this.alternateScreen=!1):this.interactive?this.options.debug||this.log.done():this.options.stdout.write(this.options.debug?`
20
- `:`${this.lastOutput}
21
- `)),this.kittyProtocolEnabled=!1,xt.delete(this.options.stdout);const{exitResult:n}=this,s=()=>{bt(t)?this.rejectExitPromise(t):this.resolveExitPromise(n)};t!==void 0&&!bt(t)?s():r&&o?this.options.stdout.write("",s):setImmediate(s)},l=L;this.options.concurrent?(L.updateContainerSync(null,this.container,null,rt),L.flushSyncWork(),l.flushPassiveEffects?.(),u()):(L.updateContainerSync(null,this.container,null,rt),L.flushSyncWork(),u())};async waitUntilExit(){return this.beforeExitHandler||(this.beforeExitHandler=()=>{this.unmount()},k.on("beforeExit",this.beforeExitHandler)),this.exitPromise}async waitUntilRenderFlush(){if(this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(await zt(),this.isUnmounted||this.isUnmounting){await this.awaitExit();return}if(this.isConcurrent&&this.hasPendingConcurrentWork()&&(await Promise.race([this.awaitNextRender(),this.awaitExit()]),this.isUnmounted||this.isUnmounting)){this.nextRenderCommit=void 0,await this.awaitExit();return}L.flushSyncWork();const t=this.options.stdout,{canWriteToStdout:i,hasWritableState:r}=Gt(t);if(ht(this.throttledOnRender,i),ht(this.throttledLog,i),i&&r){await new Promise(o=>{this.options.stdout.write("",()=>{o()})});return}await zt()}clear(){this.interactive&&!this.options.debug&&(this.log.clear(),this.log.sync(this.lastOutputToRender||`${this.lastOutput}
22
- `))}patchConsole(){this.options.debug||(this.restoreConsole=Le((t,i)=>{t==="stdout"&&this.writeToStdout(i),t==="stderr"&&(i.startsWith("The above error occurred")||this.writeToStderr(i))}))}setAlternateScreen(t){this.alternateScreen=this.resolveAlternateScreenOption(t,this.interactive),this.alternateScreen&&(this.writeBestEffort(this.options.stdout,Pe),this.writeBestEffort(this.options.stdout,q))}resolveInteractiveOption(t){return t??(!Jt&&!!this.options.stdout.isTTY)}resolveAlternateScreenOption(t,i){return!!t&&i&&!!this.options.stdout.isTTY}shouldSync(){return Pi(this.options.stdout,this.interactive)}writeBestEffort(t,i){try{t.write(i)}catch{}}async awaitExit(){try{await this.exitPromise}catch{}}hasPendingConcurrentWork(){const t=this.container;return(t.pendingLanes??0)!==0&&t.callbackNode!==void 0&&t.callbackNode!==null}async awaitNextRender(){if(!this.nextRenderCommit){let t;const i=new Promise(r=>{t=r});this.nextRenderCommit={promise:i,resolve:t}}return this.nextRenderCommit.promise}renderInteractiveFrame(t,i,r,o=""){const u=r+o,l=u!=="",n=this.options.stdout.isTTY,s=n?X(this.options.stdout).rows:24,a=n&&i>=s,p=a?t:`${t}
23
- `,w=k.platform==="win32",g=n&&w&&(a||this.lastOutputHeight>=s);if(Hi({isTty:n,isUnmounting:this.isUnmounting,isWindows:w,nextOutputHeight:i,previousOutputHeight:this.lastOutputHeight,viewportRows:s})){if(this.options.incrementalRendering&&!g){l&&(this.log.clear(),this.options.stdout.write(u)),(t!==this.lastOutput||this.log.isCursorDirty()||l)&&this.throttledLog(p),this.lastOutput=t,this.lastOutputToRender=p,this.lastOutputHeight=i;return}const d=this.shouldSync();d&&this.options.stdout.write(Y),this.options.stdout.write(Ne+this.fullStaticOutput+o+t),this.lastOutput=t,this.lastOutputToRender=p,this.lastOutputHeight=i,this.log.sync(p),d&&this.options.stdout.write(U);return}if(l){const d=this.shouldSync();d&&this.options.stdout.write(Y),this.log.clear(),this.options.stdout.write(u),this.log(p),d&&this.options.stdout.write(U)}else(t!==this.lastOutput||this.log.isCursorDirty())&&this.throttledLog(p);this.lastOutput=t,this.lastOutputToRender=p,this.lastOutputHeight=i}initImmediateKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="enabled")return;const i=t.flags??["disambiguateEscapeCodes"];this.options.stdin.isTTY&&this.options.stdout.isTTY&&this.enableKittyProtocol(i)}initDeferredKittyKeyboard(){if(!this.options.kittyKeyboard)return;const t=this.options.kittyKeyboard;if((t.mode??"auto")!=="auto")return;const i=t.flags??["disambiguateEscapeCodes"];!this.interactive||!this.options.stdin.isTTY||!this.options.stdout.isTTY||this.confirmKittySupport(i)}confirmKittySupport(t){const{stdin:i,stdout:r}=this.options;let o=[];const u=()=>{this.cancelKittyDetection=void 0,clearTimeout(n),i.removeListener("data",l);const s=Bi(o);o=[],s.length>0&&i.unshift(Ht.from(s))},l=s=>{const a=typeof s=="string"?Ht.from(s):s;for(const p of a)o.push(p);Ai(o)&&(u(),this.isUnmounted||this.enableKittyProtocol(t))};i.on("data",l);const n=setTimeout(u,200);this.cancelKittyDetection=u,r.write("\x1B[?u")}enableKittyProtocol(t){this.options.stdout.write(`\x1B[>${ii(t)}u`),this.kittyProtocolEnabled=!0}}const xr=(e,t)=>{const i={alternateScreen:!1,concurrent:!1,debug:!1,exitOnCtrlC:!0,incrementalRendering:!1,maxFps:30,patchConsole:!0,stderr:k.stderr,stdin:k.stdin,stdout:k.stdout,...Ki(t)},r=Fi(i.stdout,()=>new Ui(i));return r.render(e),{cleanup(){r.unmount()},clear(){r.clear()},rerender(o){r.render(o)},rootNode:r.rootNode,unmount(){r.unmount()},waitUntilExit(){return r.waitUntilExit()},waitUntilRenderFlush(){return r.waitUntilRenderFlush()}}},Ki=(e={})=>e instanceof xe?{stdin:k.stdin,stdout:e}:e,Fi=(e,t)=>{const i=xt.get(e);if(i===void 0){const r=t();return xt.set(e,r),r}return k.stderr.write(`Warning: render() was called again for the same stdout before the previous Ink instance was unmounted. Reusing stdout across multiple render() calls is unsupported. Call unmount() first.
24
- `),i};export{xr as default};
@@ -1,2 +0,0 @@
1
- import q from"cli-boxes";import{resolveColor as O}from"./NAMED_COLORS-82DpREQV.js";import{a as z}from"./text-width-e49vlbQH.js";const D=1114112,E=9608,F=9600,H=9604;function k(o){const t=o?.borderStyle?1:0;return{bottom:o?.borderBottom===!1?0:t,left:o?.borderLeft===!1?0:t,right:o?.borderRight===!1?0:t,top:o?.borderTop===!1?0:t}}function I(o){let t=0;for(const i of o.children){const b=i.getLayout(),e=b.top+b.height;e>t&&(t=e)}const n=o._style,l=n?.paddingBottom??n?.paddingY??n?.padding??0;return t+l}function N(o,t,n,l,i,b,e,m,_,R,p,u){const r=k(u),a=m-r.top-r.bottom,d=u.scrollTop??0,g=I(o),M=a;if(g<=M||a<=0)return;const s=a*2,y=Math.max(2,Math.round(M/g*s)),f=g-M,x=s-y,A=f>0?Math.round(d/f*x):0,c=typeof u.scrollbarThumbColor=="string"?O(u.scrollbarThumbColor):_,h=i+e-1-r.right,w=R<<16|65280|c;for(let B=0;B<a;B++){const T=B*2,Y=T+1,S=T>=A&&T<A+y,L=Y>=A&&Y<A+y;if(!S&&!L)continue;let v=E;S&&!L?v=F:!S&&L&&(v=H),C(t,n,l,h,b+r.top+B,v,w,p)}}function V(o,t,n,l,i,b,e,m,_,R,p,u,r,a){const d=k(a),g=a.scrollTop??0,M=b+d.top;for(const s of o.children){if(!s._style?.sticky)continue;const y=s.getLayout();if(y.top>=g)continue;const f=s.parent;if(f&&f!==o){const w=f.getLayout();if(w.top+w.height<=g)continue}const x=M,A=s.fg===255?_:s.fg,c=s.bg===255?R:s.bg,h=s.styles===0?p:s.styles;X(s,t,n,l,i-y.left,x-y.top,A,c,h,u,r)}}function Q(o,t,n,l){for(let e=0;e<t.length;e+=2)t[e]=32,t[e+1]=65535;const i=[],b={x0:0,x1:n,y0:0,y1:l};try{X(o,t,n,l,0,0,o.fg,o.bg,o.styles,i,b);for(const e of i)W(e.node,t,n,l,e.absX,e.absY,e.w,e.h,e.fg,e.bg,e.styles,e.clip)}catch(e){console.error("Renderer Error:",e)}}function C(o,t,n,l,i,b,e,m){if(l<m.x0||l>=m.x1||i<m.y0||i>=m.y1||l<0||l>=t||i<0||i>=n)return;const _=(i*t+l)*2;o[_]=b,o[_+1]=e}function W(o,t,n,l,i,b,e,m,_,R,p,u){if(!o._style?.borderStyle||e<=0||m<=0)return;const r=q[o._style.borderStyle],a=o._style.borderColor===void 0?_:O(o._style.borderColor),d=p<<16|R<<8|a,g=o._style.borderTop!==!1,M=o._style.borderBottom!==!1,s=o._style.borderLeft!==!1,y=o._style.borderRight!==!1,f=M&&(m>1||!g);if(g)for(let c=0;c<e;c++){let h;e===1?h=s&&y?r.left:s?r.topLeft:y?r.topRight:r.top:c===0&&s?h=r.topLeft:c===e-1&&y?h=r.topRight:h=r.top,C(t,n,l,i+c,b,h.codePointAt(0),d,u)}if(f)for(let c=0;c<e;c++){let h;e===1?h=s&&y?r.left:s?r.bottomLeft:y?r.bottomRight:r.bottom:c===0&&s?h=r.bottomLeft:c===e-1&&y?h=r.bottomRight:h=r.bottom,C(t,n,l,i+c,b+m-1,h.codePointAt(0),d,u)}const x=g?1:0,A=f?m-1:m;for(let c=x;c<A;c++)s&&C(t,n,l,i,b+c,r.left.codePointAt(0),d,u),y&&C(t,n,l,i+e-1,b+c,r.right.codePointAt(0),d,u)}function U(o){if(o._hidden)return"";if(o.text!==void 0)return o.text;const t=o.children.map(U).join("");return typeof o.transform=="function"?o.transform(t,0):t}function j(o,t,n,l,i,b,e,m,_,R){if(e<=0||m<=0)return;let p=0,u=0;for(const r of o){if(r===`
2
- `){p=0,u++;continue}const a=r.codePointAt(0)??32,d=z(r);if(p+d>e&&(p=0,u++),u>=m)break;if(d>e){C(t,n,l,i+p,b+u,32,_,R),p+=1;continue}C(t,n,l,i+p,b+u,a,_,R),d===2&&p+1<e&&C(t,n,l,i+p+1,b+u,D,_,R),p+=d}}function X(o,t,n,l,i,b,e,m,_,R,p){if(o._hidden)return;const u=o.getLayout(),r=Math.round(i+u.left),a=Math.round(b+u.top),d=Math.round(u.width),g=Math.round(u.height),M=o.fg===255?e:o.fg,s=o.bg===255?m:o.bg,y=o.styles===0?_:o.styles,f={x0:Math.max(p.x0,r),x1:Math.min(p.x1,r+d),y0:Math.max(p.y0,a),y1:Math.min(p.y1,a+g)};if(f.x0>=f.x1||f.y0>=f.y1)return;if(typeof o.transform=="function"){const L=U(o),v=o.transform(L,0),P=y<<16|s<<8|M;j(v,t,n,l,r,a,d,g,P,f);return}if(o.text===void 0){if(s!==255||y!==0){const L=y<<16|s<<8|M;for(let v=0;v<g;v++)for(let P=0;P<d;P++)C(t,n,l,r+P,a+v,32,L,f)}o._style?.borderStyle&&R.push({absX:r,absY:a,bg:s,clip:f,fg:M,h:g,node:o,styles:y,w:d})}else{const L=y<<16|s<<8|M;if(o.bg!==255)for(let v=0;v<g;v++)for(let P=0;P<d;P++)C(t,n,l,r+P,a+v,32,L,f);j(o.text,t,n,l,r,a,d,g,L,f)}const x=o._style,A=x?.overflow??"visible",c=x?.overflowX??A,h=x?.overflowY??A,w=c==="hidden"||c==="scroll",B=h==="hidden"||h==="scroll";let T=f,Y=0,S=0;if(w||B){const L=k(x);T={x0:w?Math.max(f.x0,r+L.left):f.x0,x1:w?Math.min(f.x1,r+d-L.right):f.x1,y0:B?Math.max(f.y0,a+L.top):f.y0,y1:B?Math.min(f.y1,a+g-L.bottom):f.y1},h==="scroll"&&typeof x?.scrollTop=="number"&&(S=-x.scrollTop),c==="scroll"&&typeof x?.scrollLeft=="number"&&(Y=-x.scrollLeft)}for(const L of o.children)L._style?.internalStickyAlternate||X(L,t,n,l,r+Y,a+S,M,s,y,R,T);(h==="scroll"||c==="scroll")&&x?.scrollbar!==!1&&N(o,t,n,l,r,a,d,g,M,y,f,x),h==="scroll"&&typeof x?.scrollTop=="number"&&V(o,t,n,l,r,a,d,g,M,s,y,R,T,x)}export{Q as renderTreeToBuffer};
@@ -1,119 +0,0 @@
1
- import React, { ReactNode, Ref } from 'react';
2
- import { BoxProps as Props } from "../components/box.js";
3
- interface ScrollViewProps extends Props {
4
- children?: ReactNode;
5
- debug?: boolean;
6
- /**
7
- * Auto-scroll to bottom when content grows and user is at/near the bottom.
8
- * Pauses when user scrolls away from bottom; resumes when they return.
9
- * @default false
10
- */
11
- followOutput?: boolean;
12
- /**
13
- * Number of lines from bottom that still counts as "at bottom" for followOutput.
14
- * @default 3
15
- */
16
- followThreshold?: number;
17
- /**
18
- * Enable built-in keyboard navigation (arrows, page up/down, home/end, ctrl+u/d).
19
- * When enabled, the component becomes focusable.
20
- * @default false
21
- */
22
- keyboard?: boolean;
23
- onContentHeightChange?: (height: number, previousHeight: number) => void;
24
- onItemHeightChange?: (index: number, height: number, previousHeight: number) => void;
25
- /**
26
- * Fires when scrolled within `reachThreshold` lines of the end.
27
- * Only fires once per entry into the threshold zone.
28
- */
29
- onReachEnd?: () => void;
30
- /**
31
- * Fires when scrolled within `reachThreshold` lines of the start.
32
- * Only fires once per entry into the threshold zone.
33
- */
34
- onReachStart?: () => void;
35
- onScroll?: (scrollOffset: number) => void;
36
- onViewportSizeChange?: (size: {
37
- height: number;
38
- width: number;
39
- }, previousSize: {
40
- height: number;
41
- width: number;
42
- }) => void;
43
- /**
44
- * Number of extra items to render above/below the viewport when virtualized.
45
- * @default 3
46
- */
47
- overscan?: number;
48
- /**
49
- * Distance in lines from the edge to trigger onReachEnd/onReachStart.
50
- * @default 5
51
- */
52
- reachThreshold?: number;
53
- /**
54
- * Show a scrollbar track when content overflows the viewport.
55
- * @default false
56
- */
57
- scrollbar?: boolean;
58
- /**
59
- * Color of the scrollbar thumb and track.
60
- */
61
- scrollbarColor?: string;
62
- /**
63
- * Scrollbar visual style.
64
- * @default "line"
65
- */
66
- scrollbarStyle?: "arrow" | "block" | "bold" | "classic" | "dots" | "double" | "doubleSingle" | "line" | "round" | "single" | "singleDouble" | "thick";
67
- /**
68
- * Enable vim-style keybindings (j/k/g/G/u/d). Requires `keyboard` to be true.
69
- * @default false
70
- */
71
- vimBindings?: boolean;
72
- /**
73
- * Only render items visible in the viewport plus overscan. Requires items to be measured first.
74
- * @default false
75
- */
76
- virtualize?: boolean;
77
- }
78
- interface ScrollViewRef {
79
- getBottomOffset: () => number;
80
- getContentHeight: () => number;
81
- getItemHeight: (index: number) => number;
82
- getItemPosition: (index: number) => {
83
- height: number;
84
- top: number;
85
- } | null;
86
- getScrollOffset: () => number;
87
- getViewportHeight: () => number;
88
- remeasure: () => void;
89
- remeasureItem: (index: number) => void;
90
- scrollBy: (delta: number) => void;
91
- scrollTo: (offset: number) => void;
92
- scrollToBottom: () => void;
93
- scrollToTop: () => void;
94
- }
95
- declare const ScrollView: ({
96
- children,
97
- debug,
98
- followOutput,
99
- followThreshold,
100
- keyboard,
101
- onContentHeightChange,
102
- onItemHeightChange,
103
- onReachEnd,
104
- onReachStart,
105
- onScroll,
106
- onViewportSizeChange,
107
- overscan,
108
- reachThreshold,
109
- ref,
110
- scrollbar,
111
- scrollbarColor,
112
- scrollbarStyle: scrollbarStyleProp,
113
- vimBindings,
114
- virtualize,
115
- ...boxProps
116
- }: ScrollViewProps & {
117
- ref?: Ref<ScrollViewRef>;
118
- }) => React.JSX.Element;
119
- export { ScrollView as S, ScrollViewProps as a, ScrollViewRef as b };
@@ -1 +0,0 @@
1
- import{jsx as c,jsxs as k,Fragment as j}from"react/jsx-runtime";import{Box as f}from"../components/box.js";import{Text as d}from"../components/text.js";const w={bash:()=>import("@shikijs/langs/bash"),c:()=>import("@shikijs/langs/c"),clojure:()=>import("@shikijs/langs/clojure"),cpp:()=>import("@shikijs/langs/cpp"),csharp:()=>import("@shikijs/langs/csharp"),css:()=>import("@shikijs/langs/css"),dart:()=>import("@shikijs/langs/dart"),diff:()=>import("@shikijs/langs/diff"),dockerfile:()=>import("@shikijs/langs/dockerfile"),elixir:()=>import("@shikijs/langs/elixir"),erlang:()=>import("@shikijs/langs/erlang"),go:()=>import("@shikijs/langs/go"),graphql:()=>import("@shikijs/langs/graphql"),groovy:()=>import("@shikijs/langs/groovy"),haskell:()=>import("@shikijs/langs/haskell"),html:()=>import("@shikijs/langs/html"),java:()=>import("@shikijs/langs/java"),javascript:()=>import("@shikijs/langs/javascript"),json:()=>import("@shikijs/langs/json"),jsonc:()=>import("@shikijs/langs/jsonc"),jsx:()=>import("@shikijs/langs/jsx"),kotlin:()=>import("@shikijs/langs/kotlin"),less:()=>import("@shikijs/langs/less"),lua:()=>import("@shikijs/langs/lua"),makefile:()=>import("@shikijs/langs/makefile"),markdown:()=>import("@shikijs/langs/markdown"),mdx:()=>import("@shikijs/langs/mdx"),nginx:()=>import("@shikijs/langs/nginx"),objc:()=>import("@shikijs/langs/objc"),perl:()=>import("@shikijs/langs/perl"),php:()=>import("@shikijs/langs/php"),powershell:()=>import("@shikijs/langs/powershell"),prisma:()=>import("@shikijs/langs/prisma"),python:()=>import("@shikijs/langs/python"),r:()=>import("@shikijs/langs/r"),ruby:()=>import("@shikijs/langs/ruby"),rust:()=>import("@shikijs/langs/rust"),scala:()=>import("@shikijs/langs/scala"),scss:()=>import("@shikijs/langs/scss"),shell:()=>import("@shikijs/langs/shell"),sql:()=>import("@shikijs/langs/sql"),svelte:()=>import("@shikijs/langs/svelte"),swift:()=>import("@shikijs/langs/swift"),text:()=>Promise.resolve({name:"text",patterns:[],repository:{},scopeName:"source.text"}),toml:()=>import("@shikijs/langs/toml"),tsx:()=>import("@shikijs/langs/tsx"),typescript:()=>import("@shikijs/langs/typescript"),vue:()=>import("@shikijs/langs/vue"),xml:()=>import("@shikijs/langs/xml"),yaml:()=>import("@shikijs/langs/yaml"),zig:()=>import("@shikijs/langs/zig")},L={"c#":"csharp","c++":"cpp",docker:"dockerfile",gql:"graphql",hs:"haskell",js:"javascript",kt:"kotlin",md:"markdown","objective-c":"objc",ps1:"powershell",py:"python",rb:"ruby",rs:"rust",sh:"bash",ts:"typescript",yml:"yaml",zsh:"bash"},$={"catppuccin-frappe":()=>import("@shikijs/themes/catppuccin-frappe"),"catppuccin-latte":()=>import("@shikijs/themes/catppuccin-latte"),"catppuccin-macchiato":()=>import("@shikijs/themes/catppuccin-macchiato"),"catppuccin-mocha":()=>import("@shikijs/themes/catppuccin-mocha"),"dark-plus":()=>import("@shikijs/themes/dark-plus"),dracula:()=>import("@shikijs/themes/dracula"),"github-dark":()=>import("@shikijs/themes/github-dark"),"github-dark-default":()=>import("@shikijs/themes/github-dark-default"),"github-dark-dimmed":()=>import("@shikijs/themes/github-dark-dimmed"),"github-light":()=>import("@shikijs/themes/github-light"),"github-light-default":()=>import("@shikijs/themes/github-light-default"),"light-plus":()=>import("@shikijs/themes/light-plus"),"min-dark":()=>import("@shikijs/themes/min-dark"),"min-light":()=>import("@shikijs/themes/min-light"),monokai:()=>import("@shikijs/themes/monokai"),nord:()=>import("@shikijs/themes/nord"),"one-dark-pro":()=>import("@shikijs/themes/one-dark-pro"),"one-light":()=>import("@shikijs/themes/one-light"),poimandres:()=>import("@shikijs/themes/poimandres"),"rose-pine":()=>import("@shikijs/themes/rose-pine"),"rose-pine-dawn":()=>import("@shikijs/themes/rose-pine-dawn"),"rose-pine-moon":()=>import("@shikijs/themes/rose-pine-moon"),"slack-dark":()=>import("@shikijs/themes/slack-dark"),"slack-ochin":()=>import("@shikijs/themes/slack-ochin"),"solarized-dark":()=>import("@shikijs/themes/solarized-dark"),"solarized-light":()=>import("@shikijs/themes/solarized-light"),"tokyo-night":()=>import("@shikijs/themes/tokyo-night"),"vitesse-dark":()=>import("@shikijs/themes/vitesse-dark"),"vitesse-light":()=>import("@shikijs/themes/vitesse-light")};let h;const m=new Map,n=new Map,T=50,a=new Map,C=(o,r,t)=>`${o.length}:${o}\0${r}\0${t}`,H=(o,r,t,e)=>{const i=C(r,t,e);if(a.has(i)){const p=a.get(i);return a.delete(i),a.set(i,p),p}const s=o.codeToTokens(r,{lang:t,theme:e});if(a.set(i,s),a.size>T){const p=a.keys().next().value;p!==void 0&&a.delete(p)}return s},S=async()=>{const[o,r]=await Promise.all([import("shiki/core"),import("shiki/engine/javascript")]),{createHighlighterCore:t}=o,{createJavaScriptRegexEngine:e}=r;return await t({engine:e(),langs:[],themes:[import("@shikijs/themes/github-dark-default")]})},y=o=>{const r=o.toLowerCase();return L[r]??r},J=o=>y(o)in w,z=async(o,r)=>{const t=y(r);if(!(t==="text"||(o.getLoadedLanguages?.()??[]).includes(t))){if(!m.has(t)){const e=(async()=>{try{const i=w[t];i&&await o.loadLanguage(await i())}catch(i){throw m.delete(t),i}})();m.set(t,e)}await m.get(t)}},q=async(o,r)=>{if((o.getLoadedThemes?.()??[]).includes(r))return;const t=$[r];if(t){if(!n.has(r)){const e=(async()=>{try{await o.loadTheme(await t())}catch(i){throw n.delete(r),i}})();n.set(r,e)}await n.get(r)}},R=async(o=[],r)=>{h||(h=S());const t=await h,e=o.map(i=>z(t,i));return r&&r!=="github-dark-default"&&e.push(q(t,r)),await Promise.all(e),t},M=1,P=2,E=4,N=8,b=(o,r)=>{const t=o.fontStyle??0;return c(d,{backgroundColor:o.bgColor,bold:(t&P)!==0,color:o.color,italic:(t&M)!==0,strikethrough:(t&N)!==0,underline:(t&E)!==0,children:o.content},r)},A=o=>c(j,{children:o.map((r,t)=>b(r,t))}),G=(o,r={})=>{const{highlightLines:t,showLineNumbers:e=!1,startLine:i=1}=r,s=e?String(i+o.length-1).length:0;return c(f,{flexDirection:"column",children:o.map((p,g)=>{const u=i+g,l=t?.has(u)??!1;return k(f,{children:[e?k(d,{color:l?"yellow":void 0,dimColor:!l,children:[String(u).padStart(s)," "]}):void 0,c(d,{backgroundColor:l?"#3a3a00":void 0,children:p.length>0?p.map((x,v)=>b(x,v)):""})]},g)})})};export{A as a,H as g,J as i,y as r,G as t,R as w};
@@ -1 +0,0 @@
1
- const c={styles:{container:()=>({flexDirection:"column"}),expandIndicator:e=>({color:"gray"}),focusIndicator:()=>({color:"blue"}),indent:({depth:e})=>({width:(e??0)*2}),label:({isFocused:e,isSelected:n})=>{let o;return n&&(o="green"),e&&(o="blue"),{color:o}},loadingIndicator:()=>({color:"yellow"}),node:({isFocused:e})=>({gap:1,paddingLeft:e?0:2}),selectedIndicator:()=>({color:"green"})}};export{c as theme};
@@ -1 +0,0 @@
1
- import{useRef as s,useCallback as g}from"react";import I from"../ink/hooks/use-input.js";function C({isDisabled:h=!1,loadChildren:d,onLoadError:i,selectionMode:f,state:e}){const u=s(new Set),n=s(e);n.current=e;const a=s(d);a.current=d;const l=s(i);l.current=i;const p=g(async t=>{if(u.current.has(t))return;const r=a.current;if(!r)return;const o=n.current.nodeMap.get(t);if(!(!o||o.childrenIds.length>0)){u.current.add(t),n.current.setLoading(t,!0);try{const c=await r(o.node);n.current.insertChildren(t,c),n.current.expandNode(t)}catch(c){const x=c instanceof Error?c:new Error(String(c));n.current.setChildrenError(t),l.current?.(t,x)}finally{n.current.setLoading(t,!1),u.current.delete(t)}}},[]);I((t,r)=>{if(r.downArrow){e.focusNext();return}if(r.upArrow){e.focusPrevious();return}if(r.rightArrow){if(e.focusedId&&e.expandedIds.has(e.focusedId))e.focusFirstChild();else if(e.focusedId){if(d){const o=e.nodeMap.get(e.focusedId);if(o&&o.hasChildren&&o.childrenIds.length===0){p(e.focusedId).catch(()=>{});return}}e.expand()}return}if(r.leftArrow){e.focusedId&&e.expandedIds.has(e.focusedId)?e.collapse():e.focusParent();return}if(r.return){f==="none"?e.toggleExpanded():e.select();return}if(t===" "){f==="multiple"?e.select():e.toggleExpanded();return}if(t==="\x1B[H"||t==="\x1B[1~"||t==="\x1BOH"){e.focusFirst();return}(t==="\x1B[F"||t==="\x1B[4~"||t==="\x1BOF")&&e.focusLast()},{isActive:!h})}export{C as useTreeView};
@@ -1 +0,0 @@
1
- import{useReducer as H,useState as J,useRef as v,useEffect as b,useMemo as K,useCallback as l}from"react";import{TreeNodeMap as Q}from"./TreeNodeMap-cJlYqckB.js";function p(e){const t=new Map;for(const[d,s]of e.entries())t.set(s,d);return t}function f(e,t){if(e.visibleNodeCount>=e.visibleIds.length)return{viewportFromIndex:0,viewportToIndex:e.visibleIds.length};let d=e.viewportFromIndex,s=e.viewportToIndex;return t>=s&&(s=t+1,d=s-e.visibleNodeCount),t<d&&(d=t,s=d+e.visibleNodeCount),{viewportFromIndex:Math.max(0,d),viewportToIndex:Math.min(e.visibleIds.length,s)}}function w(e,t){if(e.visibleNodeCount>=t.length)return{viewportFromIndex:0,viewportToIndex:t.length};const d=e.focusedId?t.indexOf(e.focusedId):-1;if(d<0)return{viewportFromIndex:0,viewportToIndex:Math.min(e.visibleNodeCount,t.length)};let s=Math.min(e.viewportToIndex,t.length),o=Math.max(0,s-e.visibleNodeCount);return d>=s&&(s=d+1,o=s-e.visibleNodeCount),d<o&&(o=d,s=o+e.visibleNodeCount),{viewportFromIndex:Math.max(0,o),viewportToIndex:Math.min(t.length,s)}}function x(e,t){switch(t.type){case"collapse":return e.focusedId?x(e,{nodeId:e.focusedId,type:"collapse-node"}):e;case"collapse-all":{const d=new Set,s=e.nodeMap.getVisibleIds(d);return{...e,expandedIds:d,focusedId:s[0],previousExpandedIds:e.expandedIds,viewportFromIndex:0,viewportToIndex:Math.min(e.visibleNodeCount,s.length),visibleIdIndex:p(s),visibleIds:s}}case"collapse-node":{const{nodeId:d}=t;if(!e.expandedIds.has(d))return e;const s=new Set(e.expandedIds);s.delete(d);const o=e.nodeMap.getVisibleIds(s);let r=e.focusedId;return r!==void 0&&r!==d&&e.nodeMap.isDescendantOf(r,d)&&(r=d),{...e,expandedIds:s,focusedId:r,previousExpandedIds:e.expandedIds,visibleIdIndex:p(o),visibleIds:o,...w({...e,focusedId:r},o)}}case"expand":return e.focusedId?x(e,{nodeId:e.focusedId,type:"expand-node"}):e;case"expand-all":{const d=new Set;for(const[o,r]of e.nodeMap.entries())r.hasChildren&&d.add(o);const s=e.nodeMap.getVisibleIds(d);return{...e,expandedIds:d,previousExpandedIds:e.expandedIds,visibleIdIndex:p(s),visibleIds:s,...w({...e},s)}}case"expand-node":{const{nodeId:d}=t;if(!e.nodeMap.get(d)?.hasChildren||e.expandedIds.has(d))return e;const s=new Set(e.expandedIds);s.add(d);const o=e.nodeMap.getVisibleIds(s);return{...e,expandedIds:s,previousExpandedIds:e.expandedIds,visibleIdIndex:p(o),visibleIds:o,...w({...e},o)}}case"focus-first":return e.visibleIds.length===0?e:{...e,focusedId:e.visibleIds[0],viewportFromIndex:0,viewportToIndex:Math.min(e.visibleNodeCount,e.visibleIds.length)};case"focus-first-child":{if(!e.focusedId)return e;const d=e.nodeMap.get(e.focusedId);if(!d||d.childrenIds.length===0||!e.expandedIds.has(e.focusedId))return e;const s=d.childrenIds[0],o=e.visibleIdIndex.get(s)??-1;return o<0?e:{...e,focusedId:s,...f(e,o)}}case"focus-last":{if(e.visibleIds.length===0)return e;const d=e.visibleIds.length-1;return{...e,focusedId:e.visibleIds[d],...f(e,d)}}case"focus-next":{if(!e.focusedId)return e;const d=e.visibleIdIndex.get(e.focusedId)??-1;if(d<0||d>=e.visibleIds.length-1)return e;const s=e.visibleIds[d+1];return{...e,focusedId:s,...f(e,d+1)}}case"focus-parent":{if(!e.focusedId)return e;const d=e.nodeMap.get(e.focusedId);if(!d?.parentId)return e;const s=e.visibleIdIndex.get(d.parentId)??-1;return s<0?e:{...e,focusedId:d.parentId,...f(e,s)}}case"focus-previous":{if(!e.focusedId)return e;const d=e.visibleIdIndex.get(e.focusedId)??-1;if(d<=0)return e;const s=e.visibleIds[d-1];return{...e,focusedId:s,...f(e,d-1)}}case"insert-children":{if(!e.nodeMap.get(t.parentId))return e;const d=e.nodeMap.withChildren(t.parentId,t.children),s=d.getVisibleIds(e.expandedIds);return{...e,nodeMap:d,visibleIdIndex:p(s),visibleIds:s}}case"reset":return t.state;case"select":{if(!e.focusedId||e.selectionMode==="none")return e;if(e.selectionMode==="single"){const s=new Set([e.focusedId]);return{...e,previousSelectedIds:e.selectedIds,selectedIds:s}}const d=new Set(e.selectedIds);return d.has(e.focusedId)?d.delete(e.focusedId):d.add(e.focusedId),{...e,previousSelectedIds:e.selectedIds,selectedIds:d}}case"set-children-error":{const d=new Set(e.loadingIds);return d.delete(t.nodeId),{...e,loadingIds:d}}case"set-loading":{const d=new Set(e.loadingIds);return t.isLoading?d.add(t.nodeId):d.delete(t.nodeId),{...e,loadingIds:d}}case"toggle-expanded":return e.focusedId?e.expandedIds.has(e.focusedId)?x(e,{type:"collapse"}):x(e,{type:"expand"}):e;default:return e}}function y({data:e,defaultExpanded:t,defaultSelected:d,selectionMode:s,visibleNodeCount:o}){const r=new Q(e);let I;if(t==="all"){I=new Set;for(const[h,g]of r.entries())g.hasChildren&&I.add(h)}else t?I=new Set(t):I=new Set;const c=r.getVisibleIds(I),n=s!=="none"&&d?new Set(d):new Set,i=Math.min(o,c.length);return{expandedIds:I,focusedId:c[0],loadingIds:new Set,nodeMap:r,previousExpandedIds:I,previousSelectedIds:n,selectedIds:n,selectionMode:s,viewportFromIndex:0,viewportToIndex:i,visibleIdIndex:p(c),visibleIds:c,visibleNodeCount:o}}function Y({data:e,defaultExpanded:t,defaultSelected:d,onExpandChange:s,onFocusChange:o,onSelectChange:r,selectionMode:I="none",visibleNodeCount:c=1/0}){const[n,i]=H(x,{data:e,defaultExpanded:t,defaultSelected:d,selectionMode:I,visibleNodeCount:c},y),[h,g]=J(e);e!==h&&(i({state:y({data:e,defaultExpanded:t,defaultSelected:d,selectionMode:I,visibleNodeCount:c}),type:"reset"}),g(e));const M=v(o);M.current=o;const m=v(s);m.current=s;const S=v(r);S.current=r;const C=v(!0);b(()=>{if(C.current){C.current=!1;return}n.focusedId&&M.current?.(n.focusedId)},[n.focusedId]),b(()=>{n.expandedIds!==n.previousExpandedIds&&m.current?.(n.expandedIds)},[n.expandedIds,n.previousExpandedIds]),b(()=>{n.selectedIds!==n.previousSelectedIds&&S.current?.(n.selectedIds)},[n.selectedIds,n.previousSelectedIds]);const N=K(()=>n.visibleIds.slice(n.viewportFromIndex,n.viewportToIndex).map(a=>{const u=n.nodeMap.get(a);return{node:u.node,state:{depth:u.depth,hasChildren:u.hasChildren,isExpanded:n.expandedIds.has(a),isFocused:a===n.focusedId,isLoading:n.loadingIds.has(a),isSelected:n.selectedIds.has(a)}}}),[n.visibleIds,n.viewportFromIndex,n.viewportToIndex,n.focusedId,n.expandedIds,n.selectedIds,n.nodeMap,n.loadingIds]),F=l(()=>{i({type:"focus-next"})},[]),T=l(()=>{i({type:"focus-previous"})},[]),E=l(()=>{i({type:"focus-first"})},[]),V=l(()=>{i({type:"focus-last"})},[]),L=l(()=>{i({type:"expand"})},[]),D=l(a=>{i({nodeId:a,type:"expand-node"})},[]),A=l(()=>{i({type:"collapse"})},[]),O=l(a=>{i({nodeId:a,type:"collapse-node"})},[]),P=l(()=>{i({type:"toggle-expanded"})},[]),R=l(()=>{i({type:"expand-all"})},[]),k=l(()=>{i({type:"collapse-all"})},[]),U=l(()=>{i({type:"select"})},[]),j=l(()=>{i({type:"focus-parent"})},[]),q=l(()=>{i({type:"focus-first-child"})},[]),z=l((a,u)=>{i({isLoading:u,nodeId:a,type:"set-loading"})},[]),B=l(a=>{i({nodeId:a,type:"set-children-error"})},[]),G=l((a,u)=>{i({children:u,parentId:a,type:"insert-children"})},[]);return{collapse:A,collapseAll:k,collapseNode:O,expand:L,expandAll:R,expandedIds:n.expandedIds,expandNode:D,focusedId:n.focusedId,focusFirst:E,focusFirstChild:q,focusLast:V,focusNext:F,focusParent:j,focusPrevious:T,hasScrollDown:n.viewportToIndex<n.visibleIds.length,hasScrollUp:n.viewportFromIndex>0,insertChildren:G,loadingIds:n.loadingIds,nodeMap:n.nodeMap,select:U,selectedIds:n.selectedIds,setChildrenError:B,setLoading:z,toggleExpanded:P,viewportFromIndex:n.viewportFromIndex,viewportNodes:N,viewportToIndex:n.viewportToIndex,visibleCount:n.visibleIds.length}}export{y as createDefaultState,x as reducer,Y as useTreeViewState};
@@ -1 +0,0 @@
1
- import t from"terminal-size";const e=n=>{const{columns:o,rows:s}=n;if(o&&s)return{columns:o,rows:s};const r=t();return{columns:o||r.columns||80,rows:s||r.rows||24}};export{e as g};
@@ -1 +0,0 @@
1
- const o={error:{color:"red",icon:"✖"},info:{color:"blue",icon:"ℹ"},success:{color:"green",icon:"✔"},warning:{color:"yellow",icon:"⚠"}};export{o};
@@ -1,2 +0,0 @@
1
- type Variant = "error" | "info" | "success" | "warning";
2
- export { Variant as V };