@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
@@ -0,0 +1,164 @@
1
+ # Migration Guide
2
+
3
+ This guide documents breaking changes and migration steps for the `@visulima/tui` package.
4
+
5
+ ## Version 2.0.0
6
+
7
+ ### Breaking Changes Summary
8
+
9
+ - **Component library moved**: every non-primitive component now lives in `@visulima/tui-kit`
10
+ - **`ws` removed**: the DevTools bridge uses the platform-native `WebSocket`
11
+ - **Unchanged**: the renderer, every hook, and the layout/text primitives
12
+
13
+ `@visulima/tui` keeps the runtime — the Ink-compatible renderer, the hooks, and the primitives every component is built on. Its direct dependencies drop from 13 to 3 (`@visulima/colorize`, `scheduler`, `yoga-layout`). If you only use `render`, `Box`, `Text` and the hooks, a dependency bump is the whole migration.
14
+
15
+ ### Component library moved to `@visulima/tui-kit`
16
+
17
+ The 110+ higher-level components that lived under `@visulima/tui/components/*` moved to a new package, shipped both as an installable library and as a shadcn-style copy-paste registry.
18
+
19
+ #### Before (v1.x)
20
+
21
+ ```ts
22
+ import { Accordion } from "@visulima/tui/components/accordion";
23
+ import { Spinner } from "@visulima/tui/components/spinner";
24
+ ```
25
+
26
+ #### After (v2.x)
27
+
28
+ ```sh
29
+ pnpm add @visulima/tui-kit
30
+ ```
31
+
32
+ ```ts
33
+ import { Accordion } from "@visulima/tui-kit/accordion";
34
+ import { Spinner } from "@visulima/tui-kit/spinner";
35
+ ```
36
+
37
+ Or vendor the source into your own tree instead, with no runtime dependency on the library:
38
+
39
+ ```sh
40
+ npx shadcn@latest add https://visulima.com/r/spinner.json
41
+ ```
42
+
43
+ The CLI writes the component to `@/components/ui/*`, puts shared helpers in `@/lib/*`, and pulls in whatever that component depends on. The full index is at [`https://visulima.com/r/registry.json`](https://visulima.com/r/registry.json).
44
+
45
+ #### Primitives that did **not** move
46
+
47
+ These stay in `@visulima/tui` — leave their imports alone:
48
+
49
+ `box` · `canvas` · `cursor` · `error-boundary` · `error-overview` · `newline` · `spacer` · `static` · `static-render` · `text` · `transform`
50
+
51
+ ```ts
52
+ // Still correct after upgrading:
53
+ import { Box } from "@visulima/tui/components/box";
54
+ import { Text } from "@visulima/tui/components/text";
55
+ ```
56
+
57
+ #### Automating the rewrite
58
+
59
+ The rule is mechanical — `@visulima/tui/components/<x>` becomes `@visulima/tui-kit/<x>` unless `<x>` is one of the 11 primitives above. This rewrites every moved import in place; the negative lookahead is what skips the primitives:
60
+
61
+ ```sh
62
+ # From your project root. Requires ripgrep + perl.
63
+ PRIM='box|canvas|cursor|error-boundary|error-overview|newline|spacer|static|static-render|text|transform'
64
+ rg -l "@visulima/tui/components/" --glob '*.{ts,tsx}' \
65
+ | xargs perl -i -pe "s{\@visulima/tui/components/(?!($PRIM)[\"'/])}{\@visulima/tui-kit/}g"
66
+ ```
67
+
68
+ Without `perl`, two passes of your editor's regex find-and-replace do the same:
69
+
70
+ 1. Replace `@visulima/tui/components/` with `@visulima/tui-kit/` across the project.
71
+ 2. Undo the 11 that stayed: replace `@visulima/tui-kit/(box|canvas|cursor|error-boundary|error-overview|newline|spacer|static|static-render|text|transform)(["'/])` with `@visulima/tui/components/$1$2`. The trailing quote-or-slash matters — it stops `static` from also matching `static-render`, and `text` from matching `textarea`.
72
+
73
+ Run your type-checker afterwards either way. An unresolved import is a compile error, so nothing can rewrite silently wrong.
74
+
75
+ ### `ws` is no longer an optional peer
76
+
77
+ `ws` only ever backed the React DevTools bridge, which now uses the native `WebSocket` available on the supported Node versions (`^22.14.0 || >=24.10.0`).
78
+
79
+ - If you installed `ws` explicitly to make DevTools work, remove it.
80
+ - If you never used DevTools, this changes nothing.
81
+
82
+ The rest of the dependency slimming needs no action — those libraries were either inlined or turned into optional peers you only pay for when using the feature that needs them.
83
+
84
+ ### Why This Change?
85
+
86
+ The component library and the runtime have different audiences. Most consumers embed a renderer and a handful of primitives; they were paying for 110+ components and 13 dependencies to get them.
87
+
88
+ Splitting the two means:
89
+
90
+ - **A smaller install.** `@visulima/tui` now pulls 3 direct dependencies instead of 13.
91
+ - **Two ways to consume components.** `@visulima/tui-kit` is installable like any package, or copy-pasteable through its shadcn registry so you can own and edit the source.
92
+ - **Independent release cadence.** Component work no longer forces a version of the renderer, and vice versa.
93
+
94
+ ### Migration Steps
95
+
96
+ 1. Bump `@visulima/tui` to `2.0.0`.
97
+ 2. Add `@visulima/tui-kit` (or adopt the shadcn registry) if you use any non-primitive component.
98
+ 3. Run the import rewrite from [the section above](#automating-the-rewrite).
99
+ 4. Install the optional peers for any heavy component you use — see the table in the README (`BigText`, `Code`, `DiffView`, `Markdown`, `Table`).
100
+ 5. Drop any explicit `ws` dependency you added for DevTools.
101
+ 6. Run your type-checker.
102
+
103
+ ### Migration Issues & Solutions
104
+
105
+ #### 1. A primitive import stopped resolving
106
+
107
+ **Problem**: `Cannot find module '@visulima/tui-kit/text'` after a bulk find-and-replace.
108
+
109
+ **Solution**: The 11 primitives stayed in `@visulima/tui`. A blind replace catches them too — use the scripted rewrite above, whose lookahead skips them, or fix them up in a second pass.
110
+
111
+ #### 2. `static-render` or `textarea` rewritten to the wrong package
112
+
113
+ **Problem**: The second-pass regex turned `@visulima/tui-kit/static-render` into `@visulima/tui/components/static-render`, or did the same to `textarea`.
114
+
115
+ **Solution**: Anchor the pattern with the trailing quote-or-slash — `(box|…|text)(["'/])`. Without it, `static` also matches `static-render` and `text` also matches `textarea`, both of which genuinely moved to `@visulima/tui-kit`.
116
+
117
+ #### 3. A component throws about a missing dependency at runtime
118
+
119
+ **Problem**: `BigText`, `Code`, `DiffView`, `Markdown` or `Table` fails on a missing `cfonts`, `shiki`, `diff`, `marked` or `@visulima/tabular`.
120
+
121
+ **Solution**: Those are optional peers, installed only by the consumers that use them. Add the peers listed for that component in the README.
122
+
123
+ #### 4. DevTools stopped connecting
124
+
125
+ **Problem**: The React DevTools bridge does not attach after upgrading.
126
+
127
+ **Solution**: The bridge uses the native `WebSocket`, which needs Node `^22.14.0 || >=24.10.0`. Check your Node version; reinstalling `ws` will not help.
128
+
129
+ ### Verification Steps
130
+
131
+ 1. `pnpm type-check` (or `tsc --noEmit`) — an unresolved import is a compile error, so a mis-rewritten path cannot pass silently.
132
+ 2. `rg "@visulima/tui/components/" --glob '*.{ts,tsx}'` — every remaining hit should be one of the 11 primitives.
133
+ 3. Run your test suite, then the app itself: mount a screen and press a key to confirm input still routes.
134
+
135
+ ## Also in this release (not breaking)
136
+
137
+ ### `suspendTerminal()`
138
+
139
+ Hand the terminal to a child process — an editor, a pager, a shell — and restore the render afterwards:
140
+
141
+ ```tsx
142
+ import { useApp } from "@visulima/tui/hooks/use-app";
143
+
144
+ const { suspendTerminal } = useApp();
145
+
146
+ // Callback form — runs with the terminal released, then restores:
147
+ await suspendTerminal(async () => {
148
+ await runEditor();
149
+ });
150
+
151
+ // Disposable form — restores on scope exit:
152
+ {
153
+ await using _ = await suspendTerminal();
154
+ await runEditor();
155
+ }
156
+ ```
157
+
158
+ It releases the alternate screen and Kitty keyboard mode on suspend, and restores both with a full redraw on resume.
159
+
160
+ ### Keystrokes are no longer dropped on focus
161
+
162
+ `useInput` subscribed from a passive effect, which React flushes on its own schedule — after the commit, and potentially after the next I/O callback. A key arriving in that window reached the app, found no handler subscribed, and was discarded with no queue and no retry. In practice a keystroke typed immediately after a component mounted or took focus could be silently lost.
163
+
164
+ The subscription now happens in a layout effect, flushed synchronously with the commit, so a handler is always in place before the terminal can deliver the next key. No API change.
package/README.md CHANGED
@@ -40,13 +40,16 @@
40
40
 
41
41
  Based on [ratatat](https://github.com/geoffmiller/ratatat) by Geoff Miller.
42
42
 
43
+ > [!IMPORTANT]
44
+ > **Breaking change.** The component library (~110 components) moved to the companion package [`@visulima/tui-kit`](https://visulima.com/docs/packages/tui-kit) — installable or copy-pasteable via its shadcn registry. `@visulima/tui` now ships only the renderer, hooks, and layout/text primitives, and its runtime dependencies dropped from 13 to 3. See the [migration guide](https://visulima.com/docs/packages/tui/migration).
45
+
43
46
  ## Features
44
47
 
45
48
  - **Faster than Ink** on mount (1.3-2.3x), competitive on rerender
46
49
  - **Drop-in Ink-compatible** React API
47
50
  - **Native Rust diff engine** via NAPI for high-throughput rendering
48
51
  - **React hooks** for input, focus, clipboard, mouse, scroll, animation, and window size
49
- - **Rich component library** - Box, Text, Spinner, Select, TextInput, Tabs, ScrollView, and more
52
+ - **Layout & text primitives** - Box, Text, Static, Transform, and more; the full component library (inputs, charts, tables, 100+) ships in [`@visulima/tui-kit`](https://visulima.com/docs/packages/tui-kit)
50
53
  - **Cross-platform** native bindings (macOS, Linux glibc/musl, Windows x64/arm64)
51
54
  - **Server-side rendering** via `renderToString`
52
55
  - **Testing utilities** with mock streams and frame capture
@@ -67,12 +70,12 @@ pnpm add @visulima/tui react react-reconciler
67
70
 
68
71
  ### Component imports
69
72
 
70
- Every component lives at its own subpath under `@visulima/tui/components/<kebab-name>`. Hooks, `render`, and primitives stay on the bare `@visulima/tui` entry. This keeps the import graph small — you only pull in what you use, and heavy peer dependencies are loaded only when their component is imported.
73
+ `@visulima/tui` provides `render`, the hooks, and the layout/text primitives (`Box`, `Text`, …) at `@visulima/tui/components/<kebab-name>`. The higher-level component library lives in [`@visulima/tui-kit`](https://visulima.com/docs/packages/tui-kit), imported from `@visulima/tui-kit/<kebab-name>`.
71
74
 
72
75
  ```tsx
73
76
  import { Box } from "@visulima/tui/components/box";
74
77
  import { Text } from "@visulima/tui/components/text";
75
- import { Spinner } from "@visulima/tui/components/spinner";
78
+ import { Spinner } from "@visulima/tui-kit/spinner";
76
79
  import { useApp } from "@visulima/tui/hooks/use-app";
77
80
  import { useInput } from "@visulima/tui/hooks/use-input";
78
81
  import { render } from "@visulima/tui";
@@ -80,17 +83,17 @@ import { render } from "@visulima/tui";
80
83
 
81
84
  ### Optional peer dependencies
82
85
 
83
- A few components have heavy peer dependencies. Install only the peers for the components you use:
86
+ A few `@visulima/tui-kit` components have heavy peer dependencies. Install only the peers for the components you use:
84
87
 
85
- | Component | Subpath | Required peers |
86
- | ---------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------- |
87
- | `BigText` | `@visulima/tui/components/big-text` | `cfonts` |
88
- | `Code` | `@visulima/tui/components/code` | `shiki`, `@shikijs/langs`, `@shikijs/themes` |
89
- | `DiffView` | `@visulima/tui/components/diff-view` | `diff` (+ `shiki`, `@shikijs/langs`, `@shikijs/themes` for syntax highlighting) |
90
- | `Markdown` | `@visulima/tui/components/markdown` | `marked` (+ `shiki`, `@shikijs/langs`, `@shikijs/themes` for code blocks; `@visulima/tabular` for tables) |
91
- | `Table` | `@visulima/tui/components/table` | `@visulima/tabular` |
88
+ | Component | Subpath | Required peers |
89
+ | ---------- | ----------------------------- | --------------------------------------------------------------------------------------------------------- |
90
+ | `BigText` | `@visulima/tui-kit/big-text` | `cfonts` |
91
+ | `Code` | `@visulima/tui-kit/code` | `shiki`, `@shikijs/langs`, `@shikijs/themes` |
92
+ | `DiffView` | `@visulima/tui-kit/diff-view` | `diff` (+ `shiki`, `@shikijs/langs`, `@shikijs/themes` for syntax highlighting) |
93
+ | `Markdown` | `@visulima/tui-kit/markdown` | `marked` (+ `shiki`, `@shikijs/langs`, `@shikijs/themes` for code blocks; `@visulima/tabular` for tables) |
94
+ | `Table` | `@visulima/tui-kit/table` | `@visulima/tabular` |
92
95
 
93
- To enable the in-app React DevTools overlay (`DEV=true`), install `react-devtools-core` and `ws`.
96
+ To enable the in-app React DevTools overlay (`DEV=true`), install `react-devtools-core` (the bridge uses the native `WebSocket`, so no `ws` is needed).
94
97
 
95
98
  ## Quick Start
96
99
 
@@ -1,27 +1,26 @@
1
1
  import { ReactNode, PropsWithChildren, RefAttributes, ForwardRefExoticComponent } from 'react';
2
2
  import { Except } from 'type-fest';
3
- import { D as DOMElement } from "../packem_shared/dom.d-B4kXbaVY.js";
4
- import { S as Styles } from "../packem_shared/styles.d-cMo36xQz.js";
3
+ import { D as DOMElement } from "../packem_shared/dom.d-CLGlidfI.js";
4
+ import { S as Styles } from "../packem_shared/styles.d-CKGQFfm4.js";
5
5
  import 'yoga-layout';
6
- import "../packem_shared/cursor-helpers.d-BONB9tky.js";
6
+ import "../ink/public/cursor.js";
7
7
  import '@visulima/colorize';
8
- import 'cli-boxes';
9
8
  type Props = Except<Styles, "textWrap"> & {
10
9
  /**
11
- * Hide the element from screen readers.
12
- */
10
+ * Hide the element from screen readers.
11
+ */
13
12
  readonly "aria-hidden"?: boolean;
14
13
  /**
15
- * A label for the element for screen readers.
16
- */
14
+ * A label for the element for screen readers.
15
+ */
17
16
  readonly "aria-label"?: string;
18
17
  /**
19
- * The role of the element.
20
- */
18
+ * The role of the element.
19
+ */
21
20
  readonly "aria-role"?: "button" | "checkbox" | "combobox" | "list" | "listbox" | "listitem" | "menu" | "menuitem" | "option" | "progressbar" | "radio" | "radiogroup" | "tab" | "tablist" | "table" | "textbox" | "timer" | "toolbar";
22
21
  /**
23
- * The state of the element.
24
- */
22
+ * The state of the element.
23
+ */
25
24
  readonly "aria-state"?: {
26
25
  readonly busy?: boolean;
27
26
  readonly checked?: boolean;
@@ -34,29 +33,29 @@ type Props = Except<Styles, "textWrap"> & {
34
33
  readonly selected?: boolean;
35
34
  };
36
35
  /**
37
- * Whether this element is opaque (prevents rendering of covered content beneath it).
38
- * Useful for performance optimization with layered content.
39
- */
36
+ * Whether this element is opaque (prevents rendering of covered content beneath it).
37
+ * Useful for performance optimization with layered content.
38
+ */
40
39
  readonly opaque?: boolean;
41
40
  /**
42
- * Whether to render a scrollbar for this scrollable element.
43
- * Only applies when `overflow` is `'scroll'`. Defaults to `true`.
44
- */
41
+ * Whether to render a scrollbar for this scrollable element.
42
+ * Only applies when `overflow` is `'scroll'`. Defaults to `true`.
43
+ */
45
44
  readonly scrollbar?: boolean;
46
45
  /**
47
- * Makes this element sticky within its scroll container.
48
- * - `true` or `'top'`: pinned to the top during scroll
49
- * - `'bottom'`: pinned to the bottom during scroll
50
- */
46
+ * Makes this element sticky within its scroll container.
47
+ * - `true` or `'top'`: pinned to the top during scroll
48
+ * - `'bottom'`: pinned to the bottom during scroll
49
+ */
51
50
  readonly sticky?: boolean | "top" | "bottom";
52
51
  /**
53
- * Alternate content to render when this element is in its sticky (pinned) state.
54
- * Only applies when `sticky` is set. When omitted, the normal children are used.
55
- */
52
+ * Alternate content to render when this element is in its sticky (pinned) state.
53
+ * Only applies when `sticky` is set. When omitted, the normal children are used.
54
+ */
56
55
  readonly stickyChildren?: ReactNode;
57
56
  };
58
57
  /**
59
- * `&lt;Box>` is an essential Ink component to build your layout. It's like `&lt;div style="display: flex">` in the browser.
60
- */
58
+ * `&lt;Box>` is an essential Ink component to build your layout. It's like `&lt;div style="display: flex">` in the browser.
59
+ */
61
60
  declare const Box: ForwardRefExoticComponent<PropsWithChildren<Props> & RefAttributes<DOMElement>>;
62
61
  export { Box, type Props as BoxProps, Props, Box as default };
@@ -1,44 +1,39 @@
1
1
  import { ReactElement } from 'react';
2
- import { C as CanvasContext } from "../packem_shared/buffer.d-EJkZr8uH.js";
3
- export type { a as CanvasColor, b as CellStyle } from "../packem_shared/buffer.d-EJkZr8uH.js";
2
+ import { C as CanvasContext } from "../packem_shared/buffer.d-CttIC480.js";
3
+ export type { a as CanvasColor, b as CellStyle } from "../packem_shared/buffer.d-CttIC480.js";
4
4
  type Props = {
5
5
  /**
6
- * Imperative draw callback. Mutates the underlying typed-array buffer via
7
- * the provided `CanvasContext`. Runs in a `useMemo` keyed by `version` —
8
- * pass a stable reference (or hash) so the canvas only re-renders when
9
- * the input data truly changes.
10
- */
6
+ * Imperative draw callback. Mutates the underlying typed-array buffer via
7
+ * the provided `CanvasContext`. Runs in a `useMemo` keyed by `version` —
8
+ * pass a stable reference (or hash) so the canvas only re-renders when
9
+ * the input data truly changes.
10
+ */
11
11
  readonly draw: (context: CanvasContext) => void;
12
12
  /**
13
- * Number of rows (character cells vertically).
14
- */
13
+ * Number of rows (character cells vertically).
14
+ */
15
15
  readonly height: number;
16
16
  /**
17
- * Invalidation key — required so the memoization contract is explicit.
18
- * Re-runs `draw` and re-serializes only the rows the draw callback
19
- * dirtied. Pass the data you render (or a hash of it). Use a stable
20
- * value (e.g. a counter) when you intentionally want to redraw on
21
- * every render.
22
- */
17
+ * Invalidation key — required so the memoization contract is explicit.
18
+ * Re-runs `draw` and re-serializes only the rows the draw callback
19
+ * dirtied. Pass the data you render (or a hash of it). Use a stable
20
+ * value (e.g. a counter) when you intentionally want to redraw on
21
+ * every render.
22
+ */
23
23
  readonly version: unknown;
24
24
  /**
25
- * Number of columns (character cells horizontally).
26
- */
25
+ * Number of columns (character cells horizontally).
26
+ */
27
27
  readonly width: number;
28
28
  };
29
29
  /**
30
- * A fixed-size cell grid backed by typed arrays. Use the imperative `draw`
31
- * callback to paint. The canvas emits one `Text` child per row (not per cell)
32
- * and caches the ANSI output of each row: only rows marked dirty by the last
33
- * draw pass are re-serialized, and only when `version` changes.
34
- *
35
- * This is the foundation for chart/grid components that need more layout
36
- * control than `Text` alone.
37
- */
38
- declare function Canvas({
39
- draw,
40
- height,
41
- version,
42
- width
43
- }: Props): ReactElement;
30
+ * A fixed-size cell grid backed by typed arrays. Use the imperative `draw`
31
+ * callback to paint. The canvas emits one `Text` child per row (not per cell)
32
+ * and caches the ANSI output of each row: only rows marked dirty by the last
33
+ * draw pass are re-serialized, and only when `version` changes.
34
+ *
35
+ * This is the foundation for chart/grid components that need more layout
36
+ * control than `Text` alone.
37
+ */
38
+ declare function Canvas({ draw, height, version, width }: Props): ReactElement;
44
39
  export { Canvas, type CanvasContext, type Props as CanvasProps, Props, Canvas as default };
@@ -1 +1 @@
1
- import{jsx as $}from"react/jsx-runtime";import{useRef as k,useMemo as _,Fragment as j}from"react";import{a as D}from"../packem_shared/colorize-DU4YZkp3.js";import{Box as z}from"./box.js";import{Text as E}from"./text.js";const T=Math.trunc(1),I=2,A=32,F=0,H=()=>{const c=new Map,r=[void 0];return{decode:l=>r[l],encode:l=>{if(l===void 0)return F;const h=typeof l=="number"?`n:${l}`:`s:${l}`,u=c.get(h);if(u!==void 0)return u;const w=r.length;return r.push(l),c.set(h,w),w}}},C=[9601,9602,9603,9604,9605,9606,9607,9608],S=[9615,9614,9613,9612,9611,9610,9609,9608],U=9608,L=c=>{if(!c)return 0;let r=0;return c.bold&&(r|=T),c.dim&&(r|=I),r},P=c=>typeof c=="number"?c:c.codePointAt(0)??A,O=(c,r)=>{const l=Math.max(0,c*r),h=new Uint32Array(l),u=new Uint32Array(l),w=new Int32Array(l),x=new Int32Array(l),y=new Uint8Array(r),{decode:p,encode:m}=H();h.fill(A);const b=n=>{n>=0&&n<r&&(y[n]=1)},g=(n,t,s,i)=>{if(n<0||n>=c||t<0||t>=r)return;const e=t*c+n,d=P(s),a=m(i?.color),o=m(i?.background),f=L(i);h[e]===d&&u[e]===f&&w[e]===a&&x[e]===o||(h[e]=d,u[e]=f,w[e]=a,x[e]=o,y[t]=1)};return{bg:x,chars:h,colorDecoder:p,context:{clear:()=>{h.fill(A),u.fill(0),w.fill(0),x.fill(0),y.fill(1)},drawHBar:(n,t,s,i,e)=>{if(s<=0||t<0||t>=r)return;const d=Math.max(0,Math.min(1,i)),a=s*S.length,o=Math.round(d*a),f=Math.floor(o/S.length),B=o%S.length;for(let M=0;M<s;M+=1){const v=n+M;M<f?g(v,t,U,e):M===f&&B>0?g(v,t,S[B-1],e):g(v,t,A,e)}b(t)},drawRect:(n,t,s,i,e,d)=>{if(s<=0||i<=0)return;const a=P(e);for(let o=0;o<i;o+=1){for(let f=0;f<s;f+=1)g(n+f,t+o,a,d);b(t+o)}},drawText:(n,t,s,i)=>{if(t<0||t>=r||s.length===0)return;let e=0;for(const d of s)g(n+e,t,d,i),e+=1;b(t)},drawVBar:(n,t,s,i,e)=>{if(s<=0||n<0||n>=c)return;const d=Math.max(0,Math.min(1,i)),a=s*C.length,o=Math.round(d*a),f=Math.floor(o/C.length),B=o%C.length;for(let M=0;M<s;M+=1){const v=s-M-1,R=t+M;v<f?g(n,R,U,e):v===f&&B>0?g(n,R,C[B-1],e):g(n,R,A,e),b(R)}},height:r,setCell:g,width:c},dirty:y,fg:w,height:r,styles:u,width:c}},V=(c,r)=>{const{bg:l,chars:h,colorDecoder:u,fg:w,styles:x,width:y}=c,p=r*y;let m="",b=0,g=x[p],n=w[p],t=l[p];const s=i=>{let e="";for(let f=b;f<i;f+=1)e+=String.fromCodePoint(h[p+f]);const d=u(n),a=u(t);let o=e;d!==void 0&&(o=D(o,typeof d=="number"?String(d):d,"foreground")),a!==void 0&&(o=D(o,typeof a=="number"?String(a):a,"background")),(g&T)!==0&&(o=`\x1B[1m${o}\x1B[22m`),(g&I)!==0&&(o=`\x1B[2m${o}\x1B[22m`),m+=o};for(let i=1;i<y;i+=1){const e=x[p+i],d=w[p+i],a=l[p+i];(e!==g||d!==n||a!==t)&&(s(i),b=i,g=e,n=d,t=a)}return s(y),m};function Q({draw:c,height:r,version:l,width:h}){const u=k(void 0),w=k(void 0);(u.current?.width!==h||u.current.height!==r)&&(u.current=O(h,r),w.current={hasRendered:!1,lines:Array.from({length:r}).fill("")});const x=u.current,y=w.current,p=_(()=>{c(x.context);for(let m=0;m<x.height;m+=1)y.hasRendered&&x.dirty[m]===0||(y.lines[m]=V(x,m),x.dirty[m]=0);return y.hasRendered=!0,[...y.lines]},[l,h,r]);return $(z,{flexDirection:"column",flexShrink:0,height:r,width:h,children:p.map((m,b)=>$(j,{children:$(E,{wrap:"truncate-end",children:m})},b))})}export{Q as Canvas,Q as default};
1
+ import{jsx as a}from"react/jsx-runtime";import{useRef as d,useMemo as f,Fragment as m}from"react";import{createCanvasBuffer as p,serializeRow as x}from"../packem_shared/createCanvasBuffer-CL6sAM-A.js";import{Box as g}from"./box.js";import{Text as w}from"./text.js";function C({draw:h,height:r,version:c,width:n}){const i=d(void 0),s=d(void 0);(i.current?.width!==n||i.current.height!==r)&&(i.current=p(n,r),s.current={hasRendered:!1,lines:Array.from({length:r}).fill("")});const t=i.current,o=s.current,l=f(()=>{h(t.context);for(let e=0;e<t.height;e+=1)o.hasRendered&&t.dirty[e]===0||(o.lines[e]=x(t,e),t.dirty[e]=0);return o.hasRendered=!0,[...o.lines]},[c,n,r]);return a(g,{flexDirection:"column",flexShrink:0,height:r,width:n,children:l.map((e,u)=>a(m,{children:a(w,{wrap:"truncate-end",children:e})},u))})}export{C as Canvas,C as default};
@@ -1,62 +1,56 @@
1
1
  import React, { RefObject } from 'react';
2
- import { C as CursorShape } from "../packem_shared/cursor-helpers.d-BONB9tky.js";
3
- import { D as DOMElement } from "../packem_shared/dom.d-B4kXbaVY.js";
2
+ import { CursorShape } from "../ink/public/cursor.js";
3
+ import { D as DOMElement } from "../packem_shared/dom.d-CLGlidfI.js";
4
4
  import 'yoga-layout';
5
5
  import '@visulima/colorize';
6
- import 'cli-boxes';
7
- import "../packem_shared/styles.d-cMo36xQz.js";
6
+ import "../packem_shared/styles.d-CKGQFfm4.js";
8
7
  import 'type-fest';
9
8
  type Props = {
10
9
  /**
11
- * Optional reference to anchor cursor coordinates to a different element.
12
- * If omitted, `&lt;Cursor>` uses the parent container as anchor.
13
- * If `anchorRef` is set but currently unresolved, Ink hides the cursor for that frame.
14
- * If multiple `&lt;Cursor>` components are rendered in one frame, the last rendered one controls the terminal cursor position.
15
- */
10
+ * Optional reference to anchor cursor coordinates to a different element.
11
+ * If omitted, `&lt;Cursor>` uses the parent container as anchor.
12
+ * If `anchorRef` is set but currently unresolved, Ink hides the cursor for that frame.
13
+ * If multiple `&lt;Cursor>` components are rendered in one frame, the last rendered one controls the terminal cursor position.
14
+ */
16
15
  readonly anchorRef?: RefObject<DOMElement | null>;
17
16
  /**
18
- * Optional cursor shape (DECSCUSR). The shape is restored to the terminal
19
- * default on unmount, SIGINT, and unhandled React tree throws, so the
20
- * parent shell never inherits a leaked shape.
21
- *
22
- * Steady variants are non-blinking; `blinking-*` variants opt into blink.
23
- */
17
+ * Optional cursor shape (DECSCUSR). The shape is restored to the terminal
18
+ * default on unmount, SIGINT, and unhandled React tree throws, so the
19
+ * parent shell never inherits a leaked shape.
20
+ *
21
+ * Steady variants are non-blinking; `blinking-*` variants opt into blink.
22
+ */
24
23
  readonly shape?: CursorShape;
25
24
  /**
26
- * Horizontal offset from anchor content origin.
27
- */
25
+ * Horizontal offset from anchor content origin.
26
+ */
28
27
  readonly x?: number;
29
28
  /**
30
- * Vertical offset from anchor content origin.
31
- */
29
+ * Vertical offset from anchor content origin.
30
+ */
32
31
  readonly y?: number;
33
32
  };
34
33
  /**
35
- * Declaratively position the terminal cursor.
36
- * `&lt;Cursor>` must not be rendered inside `&lt;Text>`.
37
- *
38
- * **Inline mode** (no props): place `&lt;Cursor />` after a `&lt;Text>` node and the
39
- * cursor appears where that text ended — even when text wraps across lines.
40
- *
41
- * **Anchor mode**: pass `anchorRef` and/or `x`/`y` to position relative to
42
- * another element's content origin.
43
- * @example Inline mode — cursor follows text naturally
44
- * ```jsx
45
- * <Box>
46
- * <Text>{prompt + value}</Text>
47
- * <Cursor />
48
- * </Box>
49
- * ```
50
- * @example Anchor mode — offset from a referenced element
51
- * ```jsx
52
- * <Box ref={ref} />
53
- * <Cursor anchorRef={ref} x={5} />
54
- * ```
55
- */
56
- declare function Cursor({
57
- anchorRef,
58
- shape,
59
- x,
60
- y
61
- }: Props): React.JSX.Element;
34
+ * Declaratively position the terminal cursor.
35
+ * `&lt;Cursor>` must not be rendered inside `&lt;Text>`.
36
+ *
37
+ * **Inline mode** (no props): place `&lt;Cursor />` after a `&lt;Text>` node and the
38
+ * cursor appears where that text ended — even when text wraps across lines.
39
+ *
40
+ * **Anchor mode**: pass `anchorRef` and/or `x`/`y` to position relative to
41
+ * another element's content origin.
42
+ * @example Inline mode — cursor follows text naturally
43
+ * ```jsx
44
+ * <Box>
45
+ * <Text>{prompt + value}</Text>
46
+ * <Cursor />
47
+ * </Box>
48
+ * ```
49
+ * @example Anchor mode — offset from a referenced element
50
+ * ```jsx
51
+ * <Box ref={ref} />
52
+ * <Cursor anchorRef={ref} x={5} />
53
+ * ```
54
+ */
55
+ declare function Cursor({ anchorRef, shape, x, y }: Props): React.JSX.Element;
62
56
  export { Cursor, type Props as CursorProps, Props, Cursor as default };
@@ -0,0 +1,16 @@
1
+ import { ReactNode, PureComponent } from 'react';
2
+ type Props = {
3
+ readonly children: ReactNode;
4
+ readonly onError: (error: Error) => void;
5
+ };
6
+ type State = {
7
+ readonly error?: Error;
8
+ };
9
+ declare class ErrorBoundary extends PureComponent<Props, State> {
10
+ static displayName: string;
11
+ static getDerivedStateFromError(error: Error): State;
12
+ override state: State;
13
+ override componentDidCatch(error: Error): void;
14
+ override render(): ReactNode;
15
+ }
16
+ export { type Props as ErrorBoundaryProps, ErrorBoundary as default };
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import{PureComponent as e}from"react";import o from"./error-overview.js";class p extends e{static displayName="InternalErrorBoundary";static getDerivedStateFromError(r){return{error:r}}state={error:void 0};componentDidCatch(r){this.props.onError(r)}render(){return this.state.error?t(o,{error:this.state.error}):this.props.children}}export{p as default};
@@ -0,0 +1,6 @@
1
+ import { ReactElement } from 'react';
2
+ type Props = {
3
+ readonly error: Error;
4
+ };
5
+ declare function ErrorOverview({ error }: Props): ReactElement;
6
+ export { type Props as ErrorOverviewProps, ErrorOverview as default };
@@ -0,0 +1 @@
1
+ import{createRequire as $}from"node:module";import{jsxs as c,jsx as s}from"react/jsx-runtime";import{parseStacktrace as C}from"@visulima/error/stacktrace";import{Box as a}from"./box.js";import{Text as d}from"./text.js";let _;const w=n=>(_??=$(import.meta.url))(n),m=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,b=n=>{if(typeof m<"u"&&m.versions&&m.versions.node){const[r,t]=m.versions.node.split(".").map(Number);if(r>22||r===22&&t>=3||r===20&&t>=16)return m.getBuiltinModule(n)}return w(n)},{existsSync:v,readFileSync:x}=b("node:fs"),{cwd:y}=m,T=(n,r=2)=>n.replace(/^\t+/gm,t=>" ".repeat(t.length*r)),j=(n,r)=>{const t=[],u=n-r,o=n+r;for(let l=u;l<=o;l++)t.push(l);return t},k=(n,r,t={})=>{var u;if(typeof n!="string")throw new TypeError("Source code is missing.");if(!r||r<1)throw new TypeError("Line number must start from `1`.");const o=T(n).split(/\r?\n/);if(!(r>o.length))return j(r,(u=t.around)!==null&&u!==void 0?u:3).filter(l=>o[l-1]!==void 0).map(l=>({line:l,value:o[l-1]}))},g=n=>{if(!n)return n;const r=y();return n.replace(`file://${r}/`,"").replace(`${r}/`,"")};function B({error:n}){const r=C(n),t=new Map,u=r.map(e=>{const i=!e.methodName&&!e.file?`raw:${e.raw}`:`${g(e.file)??""}:${e.line}:${e.column}:${e.methodName??""}`,f=t.get(i)??0;return t.set(i,f+1),{key:`${i}#${f}`,trace:e}}),o=r[0],l=g(o?.file);let h,p=0;if(l&&o?.line&&v(l)){const e=x(l,"utf8");if(h=k(e,o.line),h)for(const{line:i}of h)p=Math.max(p,String(i).length)}return c(a,{flexDirection:"column",padding:1,children:[c(a,{children:[c(d,{backgroundColor:"red",color:"white",children:[" ","ERROR"," "]}),c(d,{children:[" ",n.message]})]}),o&&l?s(a,{marginTop:1,children:c(d,{dimColor:!0,children:[l,":",o.line,":",o.column]})}):null,o&&h?s(a,{flexDirection:"column",marginTop:1,children:h.map(({line:e,value:i})=>c(a,{children:[s(a,{width:p+1,children:c(d,{"aria-label":e===o.line?`Line ${e}, error`:`Line ${e}`,backgroundColor:e===o.line?"red":void 0,color:e===o.line?"white":void 0,dimColor:e!==o.line,children:[String(e).padStart(p," "),":"]})}),s(d,{backgroundColor:e===o.line?"red":void 0,color:e===o.line?"white":void 0,children:` ${i}`})]},`excerpt-${e}`))}):null,r.length>0?s(a,{flexDirection:"column",marginTop:1,children:u.map(({key:e,trace:i})=>{const f=g(i.file)??"";return!i.methodName&&!i.file?c(a,{children:[s(d,{dimColor:!0,children:"- "}),s(d,{bold:!0,dimColor:!0,children:i.raw})]},e):c(a,{children:[s(d,{dimColor:!0,children:"- "}),s(d,{bold:!0,dimColor:!0,children:i.methodName??"<anonymous>"}),c(d,{"aria-label":`at ${f} line ${i.line} column ${i.column}`,color:"gray",dimColor:!0,children:[" ","(",f,":",i.line,":",i.column,")"]})]},e)})}):null]})}export{B as default};
@@ -1,15 +1,13 @@
1
1
  import { ReactElement } from 'react';
2
2
  type Props = {
3
3
  /**
4
- * Number of newlines to insert.
5
- * @default 1
6
- */
4
+ * Number of newlines to insert.
5
+ * @default 1
6
+ */
7
7
  readonly count?: number;
8
8
  };
9
9
  /**
10
- * Adds one or more newline (`\n`) characters. Must be used within `&lt;Text>` components.
11
- */
12
- declare function Newline({
13
- count
14
- }: Props): ReactElement;
10
+ * Adds one or more newline (`\n`) characters. Must be used within `&lt;Text>` components.
11
+ */
12
+ declare function Newline({ count }: Props): ReactElement;
15
13
  export { Newline, type Props as NewlineProps, Props, Newline as default };
@@ -1,8 +1,8 @@
1
1
  import { ReactElement } from 'react';
2
2
  /**
3
- * A flexible space that expands along the major axis of its containing layout.
4
- *
5
- * It's useful as a shortcut for filling all the available space between elements.
6
- */
3
+ * A flexible space that expands along the major axis of its containing layout.
4
+ *
5
+ * It's useful as a shortcut for filling all the available space between elements.
6
+ */
7
7
  declare function Spacer(): ReactElement;
8
8
  export { Spacer, Spacer as default };