@visulima/tui 1.0.8 → 2.0.1

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 (336) 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 +26 -27
  6. package/dist/components/canvas.d.ts +26 -31
  7. package/dist/components/canvas.js +1 -1
  8. package/dist/components/cursor.d.ts +40 -46
  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 +6 -0
  12. package/dist/components/error-overview.js +1 -0
  13. package/dist/components/newline.d.ts +6 -8
  14. package/dist/components/spacer.d.ts +4 -4
  15. package/dist/components/static-render.d.ts +10 -42
  16. package/dist/components/static.d.ts +13 -14
  17. package/dist/components/text.d.ts +34 -48
  18. package/dist/components/transform.d.ts +7 -11
  19. package/dist/core/index.d.ts +11 -12
  20. package/dist/core/index.js +1 -1
  21. package/dist/ink/canvas/index.d.ts +24 -0
  22. package/dist/ink/canvas/index.js +1 -0
  23. package/dist/ink/hooks/use-animation.d.ts +22 -22
  24. package/dist/ink/hooks/use-app.d.ts +3 -34
  25. package/dist/ink/hooks/use-app.js +1 -1
  26. package/dist/ink/hooks/use-box-metrics.d.ts +17 -18
  27. package/dist/ink/hooks/use-clipboard.d.ts +16 -16
  28. package/dist/ink/hooks/use-color-blindness.d.ts +16 -16
  29. package/dist/ink/hooks/use-console-capture.d.ts +19 -19
  30. package/dist/ink/hooks/use-cursor.d.ts +7 -7
  31. package/dist/ink/hooks/use-focus-manager.d.ts +25 -25
  32. package/dist/ink/hooks/use-focus.d.ts +14 -18
  33. package/dist/ink/hooks/use-form.d.ts +32 -32
  34. package/dist/ink/hooks/use-hotkey.d.ts +17 -17
  35. package/dist/ink/hooks/use-input.d.ts +92 -92
  36. package/dist/ink/hooks/use-input.js +2 -2
  37. package/dist/ink/hooks/use-interval.d.ts +14 -14
  38. package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +3 -3
  39. package/dist/ink/hooks/use-key-bindings.d.ts +32 -32
  40. package/dist/ink/hooks/use-key-chord.d.ts +15 -15
  41. package/dist/ink/hooks/use-paste.d.ts +38 -38
  42. package/dist/ink/hooks/use-paste.js +1 -1
  43. package/dist/ink/hooks/use-persistent-state.d.ts +46 -46
  44. package/dist/ink/hooks/use-persistent-state.js +2 -2
  45. package/dist/ink/hooks/use-scroll-acceleration.d.ts +24 -24
  46. package/dist/ink/hooks/use-scroll-input.d.ts +15 -15
  47. package/dist/ink/hooks/use-stderr.d.ts +6 -6
  48. package/dist/ink/hooks/use-stderr.js +1 -1
  49. package/dist/ink/hooks/use-stdin.d.ts +10 -10
  50. package/dist/ink/hooks/use-stdin.js +1 -1
  51. package/dist/ink/hooks/use-stdout.d.ts +6 -6
  52. package/dist/ink/hooks/use-stdout.js +1 -1
  53. package/dist/ink/hooks/use-stopwatch.d.ts +12 -12
  54. package/dist/ink/hooks/use-terminal-palette.d.ts +11 -11
  55. package/dist/ink/hooks/use-text-buffer.d.ts +2 -2
  56. package/dist/ink/hooks/use-text-selection.d.ts +19 -20
  57. package/dist/ink/hooks/use-timeout.d.ts +11 -11
  58. package/dist/ink/hooks/use-timer.d.ts +19 -19
  59. package/dist/ink/hooks/use-window-size.d.ts +8 -8
  60. package/dist/ink/hooks/use-window-size.js +1 -1
  61. package/dist/ink/index.d.ts +110 -123
  62. package/dist/ink/index.js +1 -1
  63. package/dist/ink/mouse/use-element-position.d.ts +7 -8
  64. package/dist/ink/mouse/use-mouse-action.d.ts +1 -1
  65. package/dist/ink/mouse/use-mouse-position.d.ts +1 -1
  66. package/dist/ink/mouse/use-mouse.d.ts +1 -1
  67. package/dist/ink/mouse/use-on-mouse-click.d.ts +4 -5
  68. package/dist/ink/mouse/use-on-mouse-hover.d.ts +3 -4
  69. package/dist/ink/mouse/use-on-mouse-state.d.ts +3 -4
  70. package/dist/ink/public/cursor.d.ts +47 -0
  71. package/dist/ink/public/cursor.js +1 -0
  72. package/dist/ink/public/dom.d.ts +6 -0
  73. package/dist/ink/public/dom.js +0 -0
  74. package/dist/ink/public/highlighter.d.ts +44 -0
  75. package/dist/ink/public/highlighter.js +1 -0
  76. package/dist/ink/public/input.d.ts +14 -0
  77. package/dist/ink/public/input.js +1 -0
  78. package/dist/ink/public/styles.d.ts +4 -0
  79. package/dist/ink/public/styles.js +0 -0
  80. package/dist/ink/public/utils.d.ts +5 -0
  81. package/dist/ink/public/utils.js +1 -0
  82. package/dist/packem_chunks/devtools.js +1 -1
  83. package/dist/packem_shared/{DevTools-k6uiVzqv.js → DevTools-BxD3PYAN.js} +1 -1
  84. package/dist/packem_shared/InputParser-CiBitCva.js +2 -0
  85. package/dist/packem_shared/MouseProvider-DOcWCRVq.js +1 -0
  86. package/dist/packem_shared/{Renderer-DsskdkUd.js → Renderer-BeS49FNq.js} +1 -1
  87. package/dist/packem_shared/TuiApp-CCVaiKbf.js +1 -0
  88. package/dist/packem_shared/app-context-DTm1_XBA.js +1 -0
  89. package/dist/packem_shared/app-context.d-DMLw5Nxy.d.ts +56 -0
  90. package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
  91. package/dist/packem_shared/buffer.d-CttIC480.d.ts +67 -0
  92. package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +1 -0
  93. package/dist/packem_shared/clipboard.d-nDPQkZ2H.d.ts +23 -0
  94. package/dist/packem_shared/color-matrix.d-sTqnJ23h.d.ts +50 -0
  95. package/dist/packem_shared/{braille-ch3O5D7I.js → createBrailleGrid-BTOQrujS.js} +1 -1
  96. package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +1 -0
  97. package/dist/packem_shared/{createInlineLoop-BT40Wpmx.js → createInlineLoop-DnEvE2eM.js} +1 -1
  98. package/dist/packem_shared/disposeHighlighter-D9OkrhwX.js +1 -0
  99. package/dist/packem_shared/{dom.d-B4kXbaVY.d.ts → dom.d-CLGlidfI.d.ts} +140 -154
  100. package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +1 -0
  101. package/dist/packem_shared/index-Dl9I2_QH.js +75 -0
  102. package/dist/packem_shared/input.d-Bb8pWHvp.d.ts +172 -0
  103. package/dist/packem_shared/{input-utils-BSWCb4F_.js → isControlCharacter-uDgBe_32.js} +1 -1
  104. package/dist/packem_shared/load-native-root-binding-CxJnHcac.js +1 -0
  105. package/dist/packem_shared/{mouse-context.d-BfL9xGk_.d.ts → mouse-context.d-W-nszUps.d.ts} +8 -8
  106. package/dist/packem_shared/reconciler-DkwOtC5B.js +1 -0
  107. package/dist/packem_shared/render-CuCo-R-l.js +24 -0
  108. package/dist/packem_shared/{render-DFZ8NHlG.js → render-DtQd8qQq.js} +1 -1
  109. package/dist/packem_shared/render.d-DjQhFsiN.d.ts +435 -0
  110. package/dist/packem_shared/{renderToString-DwXFY8Qh.js → renderToString-B1LgWcJe.js} +1 -1
  111. package/dist/packem_shared/{renderToString-L_bpw4OQ.js → renderToString-DkTmJPaS.js} +1 -1
  112. package/dist/packem_shared/renderToken-DjiQ6dfv.js +1 -0
  113. package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +2 -0
  114. package/dist/packem_shared/{renderer-k-xShm1P.js → renderer-Cs0KEr1o.js} +4 -4
  115. package/dist/packem_shared/{selection.d-CI3_p8wg.d.ts → selection.d-BSAWa4ey.d.ts} +16 -16
  116. package/dist/packem_shared/stderr-context-CR2LLec6.js +1 -0
  117. package/dist/packem_shared/stdin-context-BjMA9Sbi.js +1 -0
  118. package/dist/packem_shared/stdout-context-DAAlQct2.js +1 -0
  119. package/dist/packem_shared/styles.d-CKGQFfm4.d.ts +485 -0
  120. package/dist/packem_shared/{terminal-palette.d-D2SQjfn-.d.ts → terminal-palette.d-JbWHISW-.d.ts} +7 -7
  121. package/dist/packem_shared/utils-CVgM8kTn.js +1 -0
  122. package/dist/react/index.d.ts +160 -179
  123. package/dist/react/index.js +1 -1
  124. package/dist/testing/index.d.ts +152 -152
  125. package/dist/testing/index.js +1 -1
  126. package/index.js +52 -52
  127. package/package.json +49 -384
  128. package/dist/components/accordion.d.ts +0 -59
  129. package/dist/components/accordion.js +0 -1
  130. package/dist/components/alert.d.ts +0 -26
  131. package/dist/components/alert.js +0 -1
  132. package/dist/components/animate-presence.d.ts +0 -18
  133. package/dist/components/animate-presence.js +0 -1
  134. package/dist/components/approval-prompt.d.ts +0 -65
  135. package/dist/components/approval-prompt.js +0 -1
  136. package/dist/components/area-chart.d.ts +0 -66
  137. package/dist/components/area-chart.js +0 -1
  138. package/dist/components/badge.d.ts +0 -22
  139. package/dist/components/badge.js +0 -1
  140. package/dist/components/bar-chart.d.ts +0 -67
  141. package/dist/components/bar-chart.js +0 -1
  142. package/dist/components/big-text.d.ts +0 -81
  143. package/dist/components/big-text.js +0 -1
  144. package/dist/components/blink-dot.d.ts +0 -36
  145. package/dist/components/blink-dot.js +0 -1
  146. package/dist/components/breadcrumb.d.ts +0 -33
  147. package/dist/components/breadcrumb.js +0 -1
  148. package/dist/components/button.d.ts +0 -45
  149. package/dist/components/button.js +0 -1
  150. package/dist/components/calendar.d.ts +0 -72
  151. package/dist/components/calendar.js +0 -1
  152. package/dist/components/card.d.ts +0 -57
  153. package/dist/components/card.js +0 -1
  154. package/dist/components/checkbox.d.ts +0 -48
  155. package/dist/components/checkbox.js +0 -1
  156. package/dist/components/code.d.ts +0 -48
  157. package/dist/components/code.js +0 -2
  158. package/dist/components/collapsible.d.ts +0 -53
  159. package/dist/components/collapsible.js +0 -1
  160. package/dist/components/command-block.d.ts +0 -47
  161. package/dist/components/command-block.js +0 -4
  162. package/dist/components/command-palette.d.ts +0 -82
  163. package/dist/components/command-palette.js +0 -1
  164. package/dist/components/confirm-dialog.d.ts +0 -75
  165. package/dist/components/confirm-dialog.js +0 -1
  166. package/dist/components/confirm-input.d.ts +0 -38
  167. package/dist/components/confirm-input.js +0 -1
  168. package/dist/components/console-overlay.d.ts +0 -54
  169. package/dist/components/console-overlay.js +0 -1
  170. package/dist/components/content-switcher.d.ts +0 -57
  171. package/dist/components/content-switcher.js +0 -1
  172. package/dist/components/controlled-scroll-view.d.ts +0 -61
  173. package/dist/components/controlled-scroll-view.js +0 -1
  174. package/dist/components/date-picker.d.ts +0 -65
  175. package/dist/components/date-picker.js +0 -1
  176. package/dist/components/definition-list.d.ts +0 -44
  177. package/dist/components/definition-list.js +0 -1
  178. package/dist/components/dialog.d.ts +0 -117
  179. package/dist/components/dialog.js +0 -1
  180. package/dist/components/diff-view.d.ts +0 -85
  181. package/dist/components/diff-view.js +0 -1
  182. package/dist/components/divider.d.ts +0 -49
  183. package/dist/components/divider.js +0 -1
  184. package/dist/components/file-picker-entry.d.ts +0 -104
  185. package/dist/components/file-picker-entry.js +0 -1
  186. package/dist/components/form.d.ts +0 -81
  187. package/dist/components/form.js +0 -1
  188. package/dist/components/gauge.d.ts +0 -87
  189. package/dist/components/gauge.js +0 -1
  190. package/dist/components/gradient.d.ts +0 -42
  191. package/dist/components/gradient.js +0 -1
  192. package/dist/components/heading.d.ts +0 -33
  193. package/dist/components/heading.js +0 -1
  194. package/dist/components/heatmap.d.ts +0 -62
  195. package/dist/components/heatmap.js +0 -1
  196. package/dist/components/help.d.ts +0 -52
  197. package/dist/components/help.js +0 -1
  198. package/dist/components/histogram.d.ts +0 -62
  199. package/dist/components/histogram.js +0 -1
  200. package/dist/components/kbd.d.ts +0 -31
  201. package/dist/components/kbd.js +0 -1
  202. package/dist/components/line-chart.d.ts +0 -109
  203. package/dist/components/line-chart.js +0 -1
  204. package/dist/components/link.d.ts +0 -38
  205. package/dist/components/link.js +0 -1
  206. package/dist/components/loading-indicator.d.ts +0 -29
  207. package/dist/components/loading-indicator.js +0 -1
  208. package/dist/components/markdown.d.ts +0 -40
  209. package/dist/components/markdown.js +0 -1
  210. package/dist/components/masked-input.d.ts +0 -50
  211. package/dist/components/masked-input.js +0 -1
  212. package/dist/components/menu.d.ts +0 -78
  213. package/dist/components/menu.js +0 -1
  214. package/dist/components/message-bubble.d.ts +0 -43
  215. package/dist/components/message-bubble.js +0 -1
  216. package/dist/components/model-badge.d.ts +0 -39
  217. package/dist/components/model-badge.js +0 -1
  218. package/dist/components/multi-select.d.ts +0 -65
  219. package/dist/components/multi-select.js +0 -1
  220. package/dist/components/operation-tree.d.ts +0 -49
  221. package/dist/components/operation-tree.js +0 -1
  222. package/dist/components/option-list.d.ts +0 -47
  223. package/dist/components/option-list.js +0 -1
  224. package/dist/components/ordered-list.d.ts +0 -24
  225. package/dist/components/ordered-list.js +0 -1
  226. package/dist/components/paginator.d.ts +0 -69
  227. package/dist/components/paginator.js +0 -1
  228. package/dist/components/paragraph.d.ts +0 -38
  229. package/dist/components/paragraph.js +0 -1
  230. package/dist/components/placeholder.d.ts +0 -55
  231. package/dist/components/placeholder.js +0 -1
  232. package/dist/components/progress-bar.d.ts +0 -56
  233. package/dist/components/progress-bar.js +0 -1
  234. package/dist/components/radio-group.d.ts +0 -74
  235. package/dist/components/radio-group.js +0 -1
  236. package/dist/components/scatter-plot.d.ts +0 -35
  237. package/dist/components/scatter-plot.js +0 -1
  238. package/dist/components/scroll-bar-box.d.ts +0 -37
  239. package/dist/components/scroll-bar-box.js +0 -1
  240. package/dist/components/scroll-bar.d.ts +0 -25
  241. package/dist/components/scroll-bar.js +0 -1
  242. package/dist/components/scroll-list.d.ts +0 -20
  243. package/dist/components/scroll-list.js +0 -1
  244. package/dist/components/scroll-view.d.ts +0 -10
  245. package/dist/components/scroll-view.js +0 -1
  246. package/dist/components/search-input.d.ts +0 -55
  247. package/dist/components/search-input.js +0 -1
  248. package/dist/components/select-input-indicator.d.ts +0 -32
  249. package/dist/components/select-input-indicator.js +0 -1
  250. package/dist/components/select-input-item.d.ts +0 -41
  251. package/dist/components/select-input-item.js +0 -1
  252. package/dist/components/select-input.d.ts +0 -110
  253. package/dist/components/select-input.js +0 -1
  254. package/dist/components/shimmer-text.d.ts +0 -47
  255. package/dist/components/shimmer-text.js +0 -1
  256. package/dist/components/slider.d.ts +0 -103
  257. package/dist/components/slider.js +0 -1
  258. package/dist/components/sparkline.d.ts +0 -35
  259. package/dist/components/sparkline.js +0 -1
  260. package/dist/components/spinner.d.ts +0 -17
  261. package/dist/components/spinner.js +0 -1
  262. package/dist/components/status-line.d.ts +0 -37
  263. package/dist/components/status-line.js +0 -1
  264. package/dist/components/status-message.d.ts +0 -21
  265. package/dist/components/status-message.js +0 -1
  266. package/dist/components/stepper.d.ts +0 -48
  267. package/dist/components/stepper.js +0 -1
  268. package/dist/components/stopwatch.d.ts +0 -49
  269. package/dist/components/stopwatch.js +0 -1
  270. package/dist/components/streaming-text.d.ts +0 -46
  271. package/dist/components/streaming-text.js +0 -1
  272. package/dist/components/switch.d.ts +0 -55
  273. package/dist/components/switch.js +0 -1
  274. package/dist/components/tab.d.ts +0 -19
  275. package/dist/components/tab.js +0 -1
  276. package/dist/components/table.d.ts +0 -119
  277. package/dist/components/table.js +0 -1
  278. package/dist/components/tabs.d.ts +0 -107
  279. package/dist/components/tabs.js +0 -1
  280. package/dist/components/tag.d.ts +0 -35
  281. package/dist/components/tag.js +0 -1
  282. package/dist/components/text-input.d.ts +0 -48
  283. package/dist/components/text-input.js +0 -1
  284. package/dist/components/textarea.d.ts +0 -68
  285. package/dist/components/textarea.js +0 -2
  286. package/dist/components/timer.d.ts +0 -59
  287. package/dist/components/timer.js +0 -1
  288. package/dist/components/toast.d.ts +0 -49
  289. package/dist/components/toast.js +0 -1
  290. package/dist/components/tooltip.d.ts +0 -43
  291. package/dist/components/tooltip.js +0 -1
  292. package/dist/components/transition.d.ts +0 -74
  293. package/dist/components/transition.js +0 -1
  294. package/dist/components/tree-view-entry.d.ts +0 -357
  295. package/dist/components/tree-view-entry.js +0 -1
  296. package/dist/components/unordered-list.d.ts +0 -30
  297. package/dist/components/unordered-list.js +0 -1
  298. package/dist/ink/hooks/use-linked-scroll.d.ts +0 -49
  299. package/dist/ink/hooks/use-linked-scroll.js +0 -1
  300. package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +0 -1
  301. package/dist/packem_shared/FilePicker-BLS9nOPz.js +0 -1
  302. package/dist/packem_shared/InputParser-CtwkCbrQ.js +0 -2
  303. package/dist/packem_shared/MouseProvider-DUqQ3Eaa.js +0 -1
  304. package/dist/packem_shared/ScrollBar-qa1IzDDv.js +0 -1
  305. package/dist/packem_shared/ScrollBarBox-DchESZWv.js +0 -1
  306. package/dist/packem_shared/ScrollList-BBAnRsrC.js +0 -1
  307. package/dist/packem_shared/ScrollView-CHAo7Epj.js +0 -1
  308. package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
  309. package/dist/packem_shared/TreeView-BsvLCsf0.js +0 -1
  310. package/dist/packem_shared/TuiApp-BPL8v1i1.js +0 -1
  311. package/dist/packem_shared/app-context-BVpKlG1z.js +0 -1
  312. package/dist/packem_shared/buffer.d-EJkZr8uH.d.ts +0 -39
  313. package/dist/packem_shared/clipboard.d-D6lZTQ21.d.ts +0 -23
  314. package/dist/packem_shared/color-matrix.d-DSXLsB64.d.ts +0 -50
  315. package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +0 -1
  316. package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +0 -12
  317. package/dist/packem_shared/format-time-fjoQHMxD.js +0 -1
  318. package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
  319. package/dist/packem_shared/line-chart-C7CUrvVs.js +0 -1
  320. package/dist/packem_shared/load-native-root-binding-DDikxNox.js +0 -1
  321. package/dist/packem_shared/reconciler-CFyBVf7l.js +0 -1
  322. package/dist/packem_shared/render-CuQecTAs.js +0 -24
  323. package/dist/packem_shared/render.d-CBnYBDk2.d.ts +0 -417
  324. package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +0 -2
  325. package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +0 -119
  326. package/dist/packem_shared/stderr-context-Bvnik0hL.js +0 -1
  327. package/dist/packem_shared/stdin-context-88AhuztD.js +0 -1
  328. package/dist/packem_shared/stdout-context-BnblEPez.js +0 -1
  329. package/dist/packem_shared/styles.d-cMo36xQz.d.ts +0 -396
  330. package/dist/packem_shared/token-to-elements-D6J6-P2A.js +0 -1
  331. package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
  332. package/dist/packem_shared/useTreeView-D5ifGwG3.js +0 -1
  333. package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
  334. package/dist/packem_shared/utils-Bup8lyK8.js +0 -1
  335. package/dist/packem_shared/variant-config-BJqpNo7H.js +0 -1
  336. package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +0 -2
@@ -1,417 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { D as DOMElement } from "./dom.d-B4kXbaVY.js";
3
- import 'node:stream';
4
- import { a as CursorPosition } from "./cursor-helpers.d-BONB9tky.js";
5
- declare const kittyFlags: {
6
- readonly disambiguateEscapeCodes: 1;
7
- readonly reportAllKeysAsEscapeCodes: 8;
8
- readonly reportAlternateKeys: 4;
9
- readonly reportAssociatedText: 16;
10
- readonly reportEventTypes: 2;
11
- };
12
- type KittyFlagName = keyof typeof kittyFlags;
13
- declare const kittyModifiers: {
14
- readonly alt: 2;
15
- readonly capsLock: 64;
16
- readonly ctrl: 4;
17
- readonly hyper: 16;
18
- readonly meta: 32;
19
- readonly numLock: 128;
20
- readonly shift: 1;
21
- readonly super: 8;
22
- };
23
- type KittyKeyboardOptions = {
24
- flags?: KittyFlagName[];
25
- mode?: "auto" | "enabled" | "disabled";
26
- };
27
- /**
28
- * Performance metrics for a render operation.
29
- */
30
- type RenderMetrics = {
31
- /**
32
- * Time spent rendering in milliseconds.
33
- */
34
- renderTime: number;
35
- };
36
- type Options = {
37
- /**
38
- * Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
39
- *
40
- * Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
41
- *
42
- * Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
43
- *
44
- Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
45
-
46
- Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
47
-
48
- @default false
49
-
50
- @see {@link RenderOptions.alternateScreen}
51
- */
52
- alternateScreen?: boolean;
53
- /**
54
- * Enable React Concurrent Rendering mode.
55
- *
56
- * When enabled:
57
- * - Suspense boundaries work correctly with async data
58
- * - `useTransition` and `useDeferredValue` are fully functional
59
- - Updates can be interrupted for higher priority work
60
-
61
- Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
62
-
63
- @default false
64
- @experimental
65
- */
66
- concurrent?: boolean;
67
- debug: boolean;
68
- exitOnCtrlC: boolean;
69
- incrementalRendering?: boolean;
70
- /**
71
- * Override automatic interactive mode detection.
72
- *
73
- * By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
74
- *
75
- * When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
76
- *
77
- Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
78
-
79
- Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
80
-
81
- @default true (false if in CI or `stdout.isTTY` is falsy)
82
-
83
- @see {@link RenderOptions.interactive}
84
- */
85
- interactive?: boolean;
86
- isScreenReaderEnabled?: boolean;
87
- kittyKeyboard?: KittyKeyboardOptions;
88
- maxFps?: number;
89
- onRender?: (metrics: RenderMetrics) => void;
90
- patchConsole: boolean;
91
- standardReactLayoutTiming?: boolean;
92
- stderr: NodeJS.WriteStream;
93
- stdin: NodeJS.ReadStream;
94
- stdout: NodeJS.WriteStream;
95
- /**
96
- * Whether to track text selection state during rendering.
97
- *
98
- * @default false
99
- */
100
- trackSelection?: boolean;
101
- /**
102
- * Use the native Rust cell-diff renderer instead of ANSI string-based log-update.
103
- * Produces a Uint32Array buffer that the Rust renderer diffs cell-by-cell,
104
- * generating minimal ANSI escape sequences. Significantly reduces GC pressure
105
- * and improves rendering performance for complex UIs.
106
- *
107
- * Falls back to the string-based path if native bindings are not available.
108
- * @default false
109
- */
110
- useNativeRenderer?: boolean;
111
- waitUntilExit?: () => Promise<unknown>;
112
- };
113
- declare class Ink {
114
- /**
115
- * Whether this instance is using concurrent rendering mode.
116
- */
117
- readonly isConcurrent: boolean;
118
- private readonly options;
119
- private readonly log;
120
- private manualCursorPosition;
121
- private renderedCursorPosition;
122
- private renderedCursorRequested;
123
- private readonly throttledLog;
124
- private readonly isScreenReaderEnabled;
125
- private readonly interactive;
126
- private readonly renderThrottleMs;
127
- private alternateScreen;
128
- private isUnmounted;
129
- private isUnmounting;
130
- private lastOutput;
131
- private lastOutputToRender;
132
- private lastOutputHeight;
133
- private lastTerminalWidth;
134
- private readonly nativeLog;
135
- private readonly useNativeRenderer;
136
- private readonly container;
137
- readonly rootNode: DOMElement;
138
- private fullStaticOutput;
139
- private backbufferNode;
140
- private backbufferMultiWarned;
141
- private readonly exitPromise!;
142
- private exitResult;
143
- private beforeExitHandler?;
144
- private restoreConsole?;
145
- private unsubscribeResize?;
146
- private readonly throttledOnRender?;
147
- private hasPendingThrottledRender;
148
- private kittyProtocolEnabled;
149
- private cancelKittyDetection?;
150
- private nextRenderCommit?;
151
- private deferredInitDone;
152
- constructor(options: Options);
153
- /**
154
- * Perform deferred initialization on the first render frame.
155
- * Kitty keyboard auto-detection is deferred here because the CSI ? u
156
- * query sets up a synchronous stdin listener with a 200ms timeout.
157
- * "enabled" mode runs immediately in the constructor (it's just a write).
158
- */
159
- private runDeferredInit;
160
- resized: () => void;
161
- resolveExitPromise: (result?: unknown) => void;
162
- rejectExitPromise: (reason?: Error) => void;
163
- unsubscribeExit: () => void;
164
- handleAppExit: (errorOrResult?: unknown) => void;
165
- getActiveCursorPosition: () => CursorPosition | undefined;
166
- setCursorPosition: (position: CursorPosition | undefined) => void;
167
- restoreLastOutput: () => void;
168
- calculateLayout: () => void;
169
- private calculateScrollAndTriggerObservers;
170
- /**
171
- * Force a full layout recalculation by marking all text nodes dirty.
172
- * Useful when the string width function changes or terminal font changes.
173
- */
174
- recalculateLayout(): void;
175
- /**
176
- * Walks the DOM tree before Yoga layout to handle StaticRender nodes.
177
- *
178
- * - Re-attach Yoga children if a cached render was invalidated.
179
- * - Pre-render ink-static-render nodes that don't have a cached render yet.
180
- */
181
- private prepareYogaTree;
182
- private markAllTextNodesDirty;
183
- handleStaticChange: () => void;
184
- /**
185
- * Compute the slice of lines that newly scrolled off the top of the single
186
- * `overflowToBackbuffer` region and have not yet been flushed into the
187
- * terminal's real scrollback. Advances the monotonic
188
- * `internal_maxPushedScrollTop` bookkeeping so each line is emitted exactly
189
- * once and scrolling back up is a no-op. Returns a newline-terminated
190
- * string to write above the live frame, or "" when there is nothing to do.
191
- *
192
- * No-op outside inline mode (alternate-screen / non-TTY / non-interactive /
193
- * screen-reader / debug), since terminal scrollback only exists for an
194
- * inline, in-place-updated live region. Debug mode is excluded because it
195
- * re-dumps the full grid every frame and never writes this slice — running
196
- * it there would advance the monotonic pointer past lines that were never
197
- * emitted.
198
- */
199
- private computeBackbufferOutput;
200
- onRender: () => void;
201
- private accessibilityContextValue;
202
- render(node: ReactNode): void;
203
- writeToStdout: (data: string) => void;
204
- writeToStderr: (data: string) => void;
205
- unmount: (error?: Error | number | null) => void;
206
- waitUntilExit(): Promise<unknown>;
207
- waitUntilRenderFlush(): Promise<void>;
208
- clear(): void;
209
- patchConsole(): void;
210
- private setAlternateScreen;
211
- private resolveInteractiveOption;
212
- private resolveAlternateScreenOption;
213
- private shouldSync;
214
- private writeBestEffort;
215
- private awaitExit;
216
- private hasPendingConcurrentWork;
217
- private awaitNextRender;
218
- private renderInteractiveFrame;
219
- /**
220
- * Handle kitty keyboard "enabled" mode immediately (just a stdout.write).
221
- * Called from the constructor.
222
- */
223
- private initImmediateKittyKeyboard;
224
- /**
225
- * Handle kitty keyboard "auto" mode detection. Deferred to first render
226
- * because the CSI ? u query sets up a stdin listener with a 200ms timeout.
227
- */
228
- private initDeferredKittyKeyboard;
229
- private confirmKittySupport;
230
- private enableKittyProtocol;
231
- }
232
- type RenderOptions = {
233
- /**
234
- * Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
235
- *
236
- * Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
237
- *
238
- * Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
239
- *
240
- * Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
241
- *
242
- *Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
243
- * @default false
244
- */
245
- alternateScreen?: boolean;
246
- /**
247
- * Enable React Concurrent Rendering mode.
248
- *
249
- * When enabled:
250
- * - Suspense boundaries work correctly with async data
251
- * - `useTransition` and `useDeferredValue` are fully functional
252
- * - Updates can be interrupted for higher priority work
253
- *
254
- *Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
255
- * @default false
256
- */
257
- concurrent?: boolean;
258
- /**
259
- * If true, each update will be rendered as separate output, without replacing the previous one.
260
- * @default false
261
- */
262
- debug?: boolean;
263
- /**
264
- * Configure whether Ink should listen for Ctrl+C keyboard input and exit the app. This is needed in case `process.stdin` is in raw mode, because then Ctrl+C is ignored by default and the process is expected to handle it manually.
265
- * @default true
266
- */
267
- exitOnCtrlC?: boolean;
268
- /**
269
- * Enable incremental rendering mode which only updates changed lines instead of redrawing the entire output.
270
- *This can reduce flickering and improve performance for frequently updating UIs.
271
- * @default false
272
- */
273
- incrementalRendering?: boolean;
274
- /**
275
- * Override automatic interactive mode detection.
276
- *
277
- * By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
278
- *
279
- * When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
280
- *
281
- * Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
282
- *
283
- *Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
284
- * @default true (false if in CI or `stdout.isTTY` is falsy)
285
- */
286
- interactive?: boolean;
287
- /**
288
- * Enable screen reader support. See https://github.com/vadimdemedes/ink/blob/master/readme.md#screen-reader-support
289
- * @default process.env['INK_SCREEN_READER'] === 'true'
290
- */
291
- isScreenReaderEnabled?: boolean;
292
- /**
293
- * Configure kitty keyboard protocol support for enhanced keyboard input.
294
- * Enables additional modifiers (super, hyper, capsLock, numLock) and
295
- *disambiguated key events in terminals that support the protocol.
296
- * @see https://sw.kovidgoyal.net/kitty/keyboard-protocol/
297
- */
298
- kittyKeyboard?: KittyKeyboardOptions;
299
- /**
300
- * Maximum frames per second for render updates.
301
- * This controls how frequently the UI can update to prevent excessive re-rendering.
302
- *Higher values allow more frequent updates but may impact performance.
303
- * @default 30
304
- */
305
- maxFps?: number;
306
- /**
307
- * Runs the given callback after each render and re-render with render metrics.
308
- *
309
- * Note: this callback runs after Ink commits a frame, but it does not wait for `stdout`/`stderr` stream callbacks.
310
- * To run code after output is flushed, use `waitUntilRenderFlush()`.
311
- */
312
- onRender?: (metrics: RenderMetrics) => void;
313
- /**
314
- * Patch console methods to ensure console output doesn't mix with Ink's output.
315
- *
316
- *Note: Once unmount starts, Ink restores the native console before React cleanup runs. Teardown-time `console.*` output then follows the normal console behavior instead of being rerouted through Ink.
317
- * @default true
318
- */
319
- patchConsole?: boolean;
320
- /**
321
- * If true, Ink defers frame output until after React's commit phase completes,
322
- * ensuring `useLayoutEffect` hooks run before the frame is written to the terminal.
323
- *
324
- * This eliminates the one-frame flicker when components measure layout
325
- * (e.g., scroll position, element size) in `useLayoutEffect` and adjust state.
326
- *
327
- * **Warning:** Incompatible with the `&lt;Static>` component, which relies on
328
- * immediate render timing to append output.
329
- * @default false
330
- */
331
- standardReactLayoutTiming?: boolean;
332
- /**
333
- * Error stream.
334
- * @default process.stderr
335
- */
336
- stderr?: NodeJS.WriteStream;
337
- /**
338
- * Input stream where app will listen for input.
339
- * @default process.stdin
340
- */
341
- stdin?: NodeJS.ReadStream;
342
- /**
343
- * Output stream where the app will be rendered.
344
- * @default process.stdout
345
- */
346
- stdout?: NodeJS.WriteStream;
347
- /**
348
- * Use the native Rust cell-diff renderer for terminal output.
349
- * Produces a Uint32Array buffer that the Rust renderer diffs cell-by-cell,
350
- * generating minimal ANSI escape sequences. Reduces GC pressure and
351
- * improves rendering performance for complex UIs.
352
- *
353
- * Falls back to string-based rendering if native bindings are not available.
354
- * @default false
355
- */
356
- useNativeRenderer?: boolean;
357
- };
358
- type Instance = {
359
- /**
360
- * Unmount the current app and remove the internal Ink instance for this stdout.
361
- *
362
- * This is mostly useful for advanced cases where you need `render()` to create a fresh instance for the same stream without leaving terminal state such as the alternate screen behind.
363
- */
364
- cleanup: () => void;
365
- /**
366
- * Clear output.
367
- */
368
- clear: () => void;
369
- /**
370
- * Replace the previous root node with a new one or update props of the current root node.
371
- */
372
- rerender: Ink["render"];
373
- /**
374
- * The root DOM element of the rendered tree.
375
- * Useful for programmatic DOM inspection and advanced measurement.
376
- */
377
- rootNode: DOMElement;
378
- /**
379
- * Manually unmount the whole Ink app.
380
- */
381
- unmount: Ink["unmount"];
382
- /**
383
- * Returns a promise that settles when the app is unmounted.
384
- *
385
- * It resolves with the value passed to `exit(value)` and rejects with the error passed to `exit(error)`.
386
- *When `unmount()` is called manually, it settles after unmount-related stdout writes complete.
387
- * @example
388
- * ```jsx
389
- * const {unmount, waitUntilExit} = render(<MyApp />);
390
- *
391
- * setTimeout(unmount, 1000);
392
- *
393
- * await waitUntilExit(); // resolves after `unmount()` is called
394
- * ```
395
- */
396
- waitUntilExit: Ink["waitUntilExit"];
397
- /**
398
- * Returns a promise that settles after pending render output is flushed to stdout.
399
- *
400
- *This can be used after `rerender()` when you need to run code only after the frame is written.
401
- * @example
402
- * ```jsx
403
- * const {rerender, waitUntilRenderFlush} = render(<MyApp step="loading" />);
404
- *
405
- * rerender(<MyApp step="ready" />);
406
- * await waitUntilRenderFlush(); // output for "ready" is flushed
407
- *
408
- * runNextCommand();
409
- * ```
410
- */
411
- waitUntilRenderFlush: Ink["waitUntilRenderFlush"];
412
- };
413
- /**
414
- * Mount a component and render the output.
415
- */
416
- declare const render: (node: ReactNode, options?: NodeJS.WriteStream | RenderOptions) => Instance;
417
- export { Instance as I, KittyFlagName as K, RenderOptions as R, KittyKeyboardOptions as a, kittyModifiers as b, kittyFlags as k, render as r };
@@ -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{createRequire as e}from"node:module";import{createContext as s}from"react";const i=e(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,t=r,o=s({stderr:t.stderr,write(){}});o.displayName="InternalStderrContext";export{o as t};
@@ -1 +0,0 @@
1
- import{createRequire as o}from"node:module";import{createContext as d}from"react";const r=o(import.meta.url),e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=n=>{if(typeof e<"u"&&e.versions&&e.versions.node){const[t,s]=e.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return e.getBuiltinModule(n)}return r(n)},{EventEmitter:a}=i("node:events"),c=e,l=d({internal_eventEmitter:new a,internal_exitOnCtrlC:!0,isRawModeSupported:!1,setBracketedPasteMode(){},setRawMode(){},stdin:c.stdin});l.displayName="InternalStdinContext";export{l as e};
@@ -1 +0,0 @@
1
- import{createRequire as e}from"node:module";import{createContext as s}from"react";const i=e(import.meta.url),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,o=t,r=s({stdout:o.stdout,write(){}});r.displayName="InternalStdoutContext";export{r as t};