@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,48 +0,0 @@
1
- import { ReactElement } from 'react';
2
- type Props = {
3
- /** @default "" */
4
- readonly defaultValue?: string;
5
- /**
6
- * When true, all input is ignored and text is dimmed.
7
- * @default false
8
- */
9
- readonly isDisabled?: boolean;
10
- /**
11
- * When true, renders asterisks instead of the actual characters.
12
- * @default false
13
- */
14
- readonly mask?: boolean;
15
- /**
16
- * Fires on every keystroke with the updated text.
17
- */
18
- readonly onChange?: (value: string) => void;
19
- /**
20
- * Fires when the user presses Enter.
21
- */
22
- readonly onSubmit?: (value: string) => void;
23
- /**
24
- * Greyed-out text shown when the input is empty.
25
- */
26
- readonly placeholder?: string;
27
- /**
28
- * Autocomplete candidates. The first case-sensitive prefix match is shown
29
- * dimmed after the current input. Press right-arrow or Enter to accept.
30
- */
31
- readonly suggestions?: ReadonlyArray<string>;
32
- };
33
- /**
34
- * A single-line text input with cursor navigation, optional placeholder,
35
- * autocomplete suggestions, and password masking.
36
- *
37
- * Supports arrow keys, Home/End, Ctrl+A/E, Ctrl+U/K/W, Backspace, Delete.
38
- */
39
- declare function TextInput({
40
- defaultValue,
41
- isDisabled,
42
- mask,
43
- onChange,
44
- onSubmit,
45
- placeholder,
46
- suggestions
47
- }: Props): ReactElement;
48
- export { Props, TextInput, type Props as TextInputProps, TextInput as default };
@@ -1 +0,0 @@
1
- import{jsx as f,jsxs as w}from"react/jsx-runtime";import{useState as q,useRef as k,useCallback as L}from"react";import N from"../ink/hooks/use-input.js";import{i as O}from"../packem_shared/input-utils-BSWCb4F_.js";import{Box as I}from"./box.js";import{Text as h}from"./text.js";const P=/\S+\s*$/,S=(n,r)=>n.length===0||!r?void 0:r.find(t=>t.startsWith(n))?.slice(n.length)??void 0,y=-1,T=(n,r,t,e)=>r.leftArrow?Math.max(0,t-1):r.home||r.ctrl&&n==="a"?0:r.end||r.ctrl&&n==="e"?e:y,V=(n,r,t,e)=>{if(r.backspace&&e>0)return[t.slice(0,e-1)+t.slice(e),e-1];if(r.delete&&e<t.length)return[t.slice(0,e)+t.slice(e+1),e];if(r.ctrl&&n==="u")return[t.slice(e),0];if(r.ctrl&&n==="k")return[t.slice(0,e),e];if(r.ctrl&&n==="w"){const m=t.slice(0,e).replace(P,"");return[m+t.slice(e),m.length]}};function U({defaultValue:n="",isDisabled:r=!1,mask:t=!1,onChange:e,onSubmit:m,placeholder:x,suggestions:b}){const[o,v]=q(n),[d,u]=q(n.length),A=k(o);A.current=o;const M=k(d);M.current=d;const g=k(e);g.current=e;const j=k(m);j.current=m;const B=S(o,b),z=L((p,a)=>{const{current:s}=M,c=A.current;if(a.return){const i=S(c,b),l=i?c+i:c;i&&(v(l),u(l.length),g.current?.(l)),j.current?.(l);return}if(a.escape)return;if(a.rightArrow){const i=S(c,b);if(s===c.length&&i){const l=c+i;v(l),u(l.length),g.current?.(l);return}u(Math.min(c.length,s+1));return}const D=T(p,a,s,c.length);if(D!==y){u(D);return}const R=V(p,a,c,s);if(R){const[i,l]=R;v(i),u(l),g.current?.(i);return}if(O(p,a)){const i=c.slice(0,s)+p+c.slice(s);v(i),u(s+p.length),g.current?.(i)}},[b]);N(z,{isActive:!r});const C=t?"*".repeat(o.length):o,E=C.slice(0,d),F=C[d],H=C.slice(d+1);return r?f(I,{children:f(h,{dimColor:!0,children:C||x||""})}):o.length===0&&x?w(I,{children:[f(h,{dimColor:!0,inverse:!0,children:x[0]}),f(h,{dimColor:!0,children:x.slice(1)})]}):w(I,{children:[w(h,{children:[E,f(h,{inverse:!0,children:F??" "}),H]}),B?f(h,{dimColor:!0,children:B}):void 0]})}export{U as TextInput,U as default};
@@ -1,68 +0,0 @@
1
- import { ReactElement } from 'react';
2
- type Props = {
3
- /** @default "" */
4
- readonly defaultValue?: string;
5
- /**
6
- * When true, all input is ignored and text is dimmed.
7
- * @default false
8
- */
9
- readonly isDisabled?: boolean;
10
- /**
11
- * When true, the component responds to keyboard input.
12
- * @default true
13
- */
14
- readonly isFocused?: boolean;
15
- /**
16
- * Maximum visible rows before viewport scrolling kicks in.
17
- * When set, the textarea will grow from `rows` to `maxRows` before scrolling.
18
- */
19
- readonly maxRows?: number;
20
- /**
21
- * Fires on every edit with the updated text.
22
- */
23
- readonly onChange?: (value: string) => void;
24
- /**
25
- * Fires when the user presses Meta+Enter or Ctrl+Enter.
26
- */
27
- readonly onSubmit?: (value: string) => void;
28
- /**
29
- * Greyed-out text shown when the textarea is empty.
30
- */
31
- readonly placeholder?: string;
32
- /**
33
- * Number of visible rows (viewport height).
34
- * @default 5
35
- */
36
- readonly rows?: number;
37
- /**
38
- * Show line numbers in the left gutter.
39
- * @default false
40
- */
41
- readonly showLineNumbers?: boolean;
42
- /**
43
- * Number of spaces inserted for a Tab key press.
44
- * @default 2
45
- */
46
- readonly tabSize?: number;
47
- };
48
- /**
49
- * A multi-line text input with cursor navigation, selection, clipboard, undo/redo,
50
- * paste support, and viewport scrolling.
51
- *
52
- * ```tsx
53
- * &lt;Textarea defaultValue="Hello\nWorld" rows={10} onChange={setValue} onSubmit={handleSubmit} />
54
- * ```
55
- */
56
- declare function Textarea({
57
- defaultValue,
58
- isDisabled,
59
- isFocused,
60
- maxRows,
61
- onChange,
62
- onSubmit,
63
- placeholder,
64
- rows,
65
- showLineNumbers,
66
- tabSize
67
- }: Props): ReactElement;
68
- export { Props, Textarea, type Props as TextareaProps, Textarea as default };
@@ -1,2 +0,0 @@
1
- import{jsx as l,jsxs as m,Fragment as x}from"react/jsx-runtime";import{useRef as T,useState as I,useEffect as B,useMemo as W,useCallback as F}from"react";import G from"../ink/hooks/use-clipboard.js";import H from"../ink/hooks/use-input.js";import N from"../ink/hooks/use-paste.js";import O from"../ink/hooks/use-text-buffer.js";import{i as P}from"../packem_shared/input-utils-BSWCb4F_.js";import{Box as C}from"./box.js";import{Text as o}from"./text.js";const Q=(i,c)=>c.line<i.line||c.line===i.line&&c.col<i.col?{endCol:i.col,endLine:i.line,startCol:c.col,startLine:c.line}:{endCol:c.col,endLine:c.line,startCol:i.col,startLine:i.line};function rr({defaultValue:i="",isDisabled:c=!1,isFocused:g=!0,maxRows:d,onChange:v,onSubmit:h,placeholder:p,rows:a=5,showLineNumbers:f=!1,tabSize:L=2}){const n=O(i),S=T(n);S.current=n;const{copy:u}=G(),[s,A]=I(0),E=T(v);E.current=v;const k=T(h);k.current=h;const D=T(i);B(()=>{n.value!==D.current&&(D.current=n.value,E.current?.(n.value))},[n.value]);const w=W(()=>d?Math.min(Math.max(a,n.lines.length),d):a,[a,d,n.lines.length]);B(()=>{A(t=>n.cursor.line<t?n.cursor.line:n.cursor.line>=t+w?n.cursor.line-w+1:t)},[n.cursor.line,w]);const M=F((t,r)=>{const e=S.current;if(r.return&&(r.meta||r.ctrl)){k.current?.(e.value);return}if(r.return){e.newline();return}if(r.escape){e.clearSelection();return}if(r.tab){e.insert(" ".repeat(L));return}if(r.ctrl&&t==="z"){e.undo();return}if(r.ctrl&&(t==="y"||r.shift&&t==="Z")){e.redo();return}if(r.ctrl&&t==="c"&&e.hasSelection()){u(e.getSelectedText());return}if(r.ctrl&&(t==="A"||t==="a"&&r.shift)){e.selectAll();return}if(r.upArrow){e.moveCursor("up",r.shift);return}if(r.downArrow){e.moveCursor("down",r.shift);return}if(r.leftArrow){e.moveCursor("left",r.shift);return}if(r.rightArrow){e.moveCursor("right",r.shift);return}if(r.home){r.ctrl?e.moveToStart(r.shift):e.moveToLineStart(r.shift);return}if(r.end){r.ctrl?e.moveToEnd(r.shift):e.moveToLineEnd(r.shift);return}if(r.ctrl&&t==="a"){e.moveToLineStart(r.shift);return}if(r.ctrl&&t==="e"){e.moveToLineEnd(r.shift);return}if(r.backspace){e.deleteBack();return}if(r.delete){e.deleteForward();return}if(r.ctrl&&t==="u"){e.deleteToLineStart();return}if(r.ctrl&&t==="k"){e.deleteToLineEnd();return}if(r.ctrl&&t==="w"){e.deleteWord();return}P(t,r)&&(e.hasSelection()?e.replaceSelection(t):e.insert(t))},[u,L]);H(M,{isActive:g&&!c});const R=F(t=>{const r=S.current;r.hasSelection()?r.replaceSelection(t):r.insert(t)},[]);N(R,{isActive:g&&!c});const z=n.lines.slice(s,s+w),b=f?String(n.lines.length).length+1:0,j=n.anchor?Q(n.cursor,n.anchor):null;if(c)return l(C,{flexDirection:"column",children:z.map((t,r)=>{const e=s+r;return m(C,{children:[f?m(o,{dimColor:!0,children:[String(e+1).padStart(b)," "]}):void 0,l(o,{dimColor:!0,children:t||(e===0&&p?p:"")})]},e)})});if(n.value.length===0&&p){const t=p.split(`
2
- `).slice(0,w);return l(C,{flexDirection:"column",children:t.map((r,e)=>m(C,{children:[f?m(o,{dimColor:!0,children:[String(e+1).padStart(b)," "]}):void 0,e===0?m(o,{children:[l(o,{dimColor:!0,inverse:!0,children:r[0]??" "}),l(o,{dimColor:!0,children:r.slice(1)})]}):l(o,{dimColor:!0,children:r})]},e))})}return l(C,{flexDirection:"column",children:z.map((t,r)=>{const e=s+r,y=e===n.cursor.line;return m(C,{children:[f?m(o,{dimColor:!y,children:[String(e+1).padStart(b)," "]}):void 0,l(o,{children:U(t,e,n.cursor,j)})]},e)})})}function U(i,c,g,d){const v=c===g.line,h=v?g.col:-1,p=d&&c>=d.startLine&&c<=d.endLine;if(!p&&!v)return l(x,{children:i});if(!p){const u=i.slice(0,h),s=i[h],A=i.slice(h+1);return m(x,{children:[u,l(o,{inverse:!0,children:s??" "}),A]})}const a=c===d.startLine?d.startCol:0,f=c===d.endLine?d.endCol:i.length,L=i.slice(0,a),n=i.slice(a,f),S=i.slice(f);if(v&&(h<a||h>=f)){const u=[];let s=0;return h<a?(u.push(l(o,{children:i.slice(0,h)},s++)),u.push(l(o,{inverse:!0,children:i[h]??" "},s++)),u.push(l(o,{children:i.slice(h+1,a)},s++)),u.push(l(o,{inverse:!0,children:n},s++)),u.push(l(o,{children:S},s++))):(u.push(l(o,{children:L},s++)),u.push(l(o,{inverse:!0,children:n},s++)),u.push(l(o,{children:i.slice(f,h)},s++)),u.push(l(o,{inverse:!0,children:i[h]??" "},s++)),u.push(l(o,{children:i.slice(h+1)},s++))),l(x,{children:u})}return m(x,{children:[L,l(o,{inverse:!0,children:n}),S]})}export{rr as Textarea,rr as default};
@@ -1,59 +0,0 @@
1
- import { Ref, ReactElement } from 'react';
2
- import { UseTimerResult } from "../ink/hooks/use-timer.js";
3
- type TimerRef = Omit<UseTimerResult, "isFinished" | "isRunning" | "remaining">;
4
- type Props = {
5
- /**
6
- * Whether to start the timer immediately.
7
- * @default false
8
- */
9
- readonly autoStart?: boolean;
10
- /**
11
- * Make the rendered text bold.
12
- */
13
- readonly bold?: boolean;
14
- /**
15
- * Text color for the rendered time.
16
- */
17
- readonly color?: string;
18
- /**
19
- * Total countdown duration in milliseconds.
20
- */
21
- readonly duration: number;
22
- /**
23
- * Custom formatter for the remaining time.
24
- * Receives remaining milliseconds, returns a display string.
25
- * @default formatDuration (MM:SS or HH:MM:SS)
26
- */
27
- readonly format?: (remaining: number) => string;
28
- /**
29
- * Tick interval in milliseconds.
30
- * @default 1000
31
- */
32
- readonly interval?: number;
33
- /**
34
- * Called once when the timer reaches zero.
35
- */
36
- readonly onTimeout?: () => void;
37
- readonly ref?: Ref<TimerRef>;
38
- };
39
- /**
40
- * A countdown timer component.
41
- *
42
- * Exposes `start`, `stop`, `toggle`, and `reset` methods via ref.
43
- *
44
- * ```tsx
45
- * const ref = useRef&lt;TimerRef>(null);
46
- * &lt;Timer ref={ref} duration={60_000} autoStart />
47
- * ```
48
- */
49
- declare const Timer: ({
50
- autoStart,
51
- bold,
52
- color,
53
- duration,
54
- format,
55
- interval,
56
- onTimeout,
57
- ref
58
- }: Props) => ReactElement;
59
- export { Props, Timer, type Props as TimerProps, TimerRef, Timer as default };
@@ -1 +0,0 @@
1
- import{jsx as l}from"react/jsx-runtime";import{useImperativeHandle as f}from"react";import p from"../ink/hooks/use-timer.js";import{f as u}from"../packem_shared/format-time-fjoQHMxD.js";import{Text as d}from"./text.js";const b=({autoStart:o,bold:r,color:e,duration:a,format:i=u,interval:m,onTimeout:s,ref:n})=>{const t=p({autoStart:o,duration:a,interval:m,onTimeout:s});return f(n,()=>({reset:t.reset,start:t.start,stop:t.stop,toggle:t.toggle}),[t.reset,t.start,t.stop,t.toggle]),l(d,{bold:r,color:e,children:i(t.remaining)})};export{b as Timer,b as default};
@@ -1,49 +0,0 @@
1
- import { ReactNode, ReactElement } from 'react';
2
- import { V as Variant } from "../packem_shared/variant-config.d-D5NnrrQK.js";
3
- type ToastVariant = Variant;
4
- type Props = {
5
- /**
6
- * Toast body.
7
- */
8
- readonly children: ReactNode;
9
- /**
10
- * Milliseconds to display before auto-dismissing. Use `0` to disable.
11
- * @default 4000
12
- */
13
- readonly duration?: number;
14
- /**
15
- * Called after the toast dismisses itself.
16
- */
17
- readonly onDismiss?: () => void;
18
- /**
19
- * Optional title rendered before the body.
20
- */
21
- readonly title?: string;
22
- /**
23
- * Visual variant determining the icon and border color.
24
- * @default "info"
25
- */
26
- readonly variant?: ToastVariant;
27
- /**
28
- * Manually control visibility. When provided, `duration` is ignored.
29
- */
30
- readonly visible?: boolean;
31
- /**
32
- * Optional width override.
33
- */
34
- readonly width?: number;
35
- };
36
- /**
37
- * Ephemeral notification. Disappears automatically after `duration` ms.
38
- * @returns A bordered `ReactElement` while visible; `null` once dismissed.
39
- */
40
- declare function Toast({
41
- children,
42
- duration,
43
- onDismiss,
44
- title,
45
- variant,
46
- visible,
47
- width
48
- }: Props): ReactElement | null;
49
- export { Props, Toast, type Props as ToastProps, ToastVariant, Toast as default };
@@ -1 +0,0 @@
1
- import{jsxs as c,jsx as t}from"react/jsx-runtime";import{useState as v,useRef as T,useEffect as w}from"react";import{Box as u}from"./box.js";import{Text as i}from"./text.js";import{o as g}from"../packem_shared/variant-config-BJqpNo7H.js";function B({children:f,duration:r=4e3,onDismiss:n,title:l,variant:m="info",visible:o,width:a}){const[p,h]=v(!0),e=o??p,d=T(n);if(d.current=n,w(()=>{if(o!==void 0||r<=0||!e)return;const b=setTimeout(()=>{h(!1),d.current?.()},r);return()=>{clearTimeout(b)}},[r,o,e]),!e)return null;const{color:s,icon:x}=g[m];return c(u,{borderColor:s,borderStyle:"round",gap:1,paddingX:1,width:a,children:[t(i,{color:s,children:x}),c(u,{flexDirection:"column",flexGrow:1,children:[l===void 0?void 0:t(i,{bold:!0,children:l}),t(i,{children:f})]})]})}export{B as Toast,B as default};
@@ -1,43 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- type TooltipPlacement = "bottom" | "left" | "right" | "top";
5
- type Props = {
6
- /**
7
- * The element the tooltip is attached to.
8
- */
9
- readonly children: ReactNode;
10
- /**
11
- * Border color.
12
- * @default "gray"
13
- */
14
- readonly color?: LiteralUnion<AnsiColors, string>;
15
- /**
16
- * Tooltip body content.
17
- */
18
- readonly content: ReactNode;
19
- /**
20
- * Controls whether the tooltip is rendered.
21
- * @default true
22
- */
23
- readonly isVisible?: boolean;
24
- /**
25
- * Relative position. Terminal rendering does not support floating layers,
26
- * so the tooltip is placed inline next to (or above / below) the anchor.
27
- * @default "right"
28
- */
29
- readonly placement?: TooltipPlacement;
30
- };
31
- /**
32
- * Renders supplementary text next to an anchor. Because terminals don't have
33
- * a floating-layer concept, the tooltip lives inline in the layout. Hide it
34
- * by toggling `isVisible`.
35
- */
36
- declare function Tooltip({
37
- children,
38
- color,
39
- content,
40
- isVisible,
41
- placement
42
- }: Props): ReactElement;
43
- export { Props, Tooltip, TooltipPlacement, type Props as TooltipProps, Tooltip as default };
@@ -1 +0,0 @@
1
- import{jsx as o,jsxs as f}from"react/jsx-runtime";import{Box as t}from"./box.js";import{Text as a}from"./text.js";const m={bottom:{flexDirection:"column",orderFirst:!1},left:{flexDirection:"row",orderFirst:!0},right:{flexDirection:"row",orderFirst:!1},top:{flexDirection:"column",orderFirst:!0}};function p({children:c,color:i="gray",content:r,isVisible:s=!0,placement:e="right"}){const{flexDirection:d,orderFirst:n}=m[e],l=s?o(t,{borderColor:i,borderStyle:"round",flexShrink:0,marginLeft:e==="right"?1:0,marginRight:e==="left"?1:0,paddingX:1,children:typeof r=="string"?o(a,{color:i,children:r}):r}):void 0;return f(t,{alignItems:"center",flexDirection:d,children:[n?l:void 0,o(t,{children:c}),n?void 0:l]})}export{p as Tooltip,p as default};
@@ -1,74 +0,0 @@
1
- import { ReactNode, ReactElement } from 'react';
2
- type TransitionPreset = "fade" | "reveal" | "slide-down" | "slide-left" | "slide-right" | "slide-up";
3
- type TransitionPhase = "entered" | "entering" | "exited" | "exiting";
4
- type Props = {
5
- /**
6
- * Content to animate.
7
- */
8
- readonly children: ReactNode;
9
- /**
10
- * For slide presets, how many characters of offset to animate across.
11
- * For the `reveal` preset, the maximum row count to scale through.
12
- * @default 4
13
- */
14
- readonly distance?: number;
15
- /**
16
- * Duration of both enter and exit transitions, in milliseconds.
17
- * @default 240
18
- */
19
- readonly duration?: number;
20
- /**
21
- * Called once the exit animation finishes (i.e. the component has fully
22
- * transitioned out). AnimatePresence uses this to unmount the wrapper.
23
- */
24
- readonly onExit?: () => void;
25
- /**
26
- * Animation preset controlling how the content appears/disappears.
27
- * @default "fade"
28
- */
29
- readonly preset?: TransitionPreset;
30
- /**
31
- * Controls the target phase. `true` drives towards `entered`, `false`
32
- * drives towards `exited`. Flip the value to trigger animation.
33
- * @default true
34
- */
35
- readonly show?: boolean;
36
- /**
37
- * Tick interval in milliseconds. Lower values yield smoother animation
38
- * at the cost of CPU.
39
- * @default 30
40
- */
41
- readonly tickInterval?: number;
42
- };
43
- type TransitionComponent = ((props: Props) => ReactElement | null) & {
44
- isAnimatable: true;
45
- };
46
- /**
47
- * Animate a child's entry and exit using a TUI-friendly preset. Drive via
48
- * `show`; the component toggles between enter and exit, fires `onExit` once
49
- * the exit animation completes.
50
- *
51
- * **Fade preset note:** `dimColor` is only applied when the child is a plain
52
- * string. Non-string children (Box trees, other components) pass through
53
- * untouched during the transition — wrap them in `&lt;Text>` if you need the
54
- * fade effect.
55
- * @returns A `ReactElement` rendering the transitioning child, or `null`
56
- * once a hidden transition has fully completed.
57
- */
58
- declare function Transition({
59
- children,
60
- distance,
61
- duration,
62
- onExit,
63
- preset,
64
- show,
65
- tickInterval
66
- }: Props): ReactElement | null;
67
- /**
68
- * Static marker used by `AnimatePresence` to recognize Transition children
69
- * even when the consumer hasn't explicitly passed a `show` prop. Consumers
70
- * can apply the same marker to their own wrappers (`MyWrapper.isAnimatable
71
- * = true`) to opt them into animation orchestration.
72
- */
73
- declare const TransitionWithMarker: TransitionComponent;
74
- export { Props, Transition, TransitionPhase, TransitionPreset, type Props as TransitionProps, TransitionWithMarker as default };
@@ -1 +0,0 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useState as w,useRef as d,useEffect as D}from"react";import{Box as c}from"./box.js";import{Text as b}from"./text.js";const j=(t,r)=>t>=1?e(c,{children:r}):t<=0?e(c,{}):e(c,{children:typeof r=="string"?e(b,{dimColor:t<.7,children:r}):r}),y=(t,r)=>Math.max(0,Math.min(r,Math.round((1-t)*r))),f=(t,r)=>(i,u,h)=>{const n=y(i,h);return i>=1?e(c,{children:u}):i<=0?e(c,{}):t==="x"?e(c,{paddingLeft:r===1?n:0,paddingRight:r===-1?n:0,children:u}):e(c,{flexDirection:"column",paddingBottom:r===-1?n:0,paddingTop:r===1?n:0,children:u})},A=(t,r,i)=>{if(t>=1)return e(c,{children:r});if(t<=0)return e(c,{});const u=Math.max(0,Math.min(i,Math.round(t*i)));return e(c,{flexDirection:"column",height:u,overflowY:"hidden",children:r})},C={fade:j,reveal:A,"slide-down":f("y",-1),"slide-left":f("x",-1),"slide-right":f("x",1),"slide-up":f("y",1)},O=(t,r)=>t?r>=1?"entered":"entering":r<=0?"exited":"exiting";function K({children:t,distance:r=4,duration:i=240,onExit:u,preset:h="fade",show:n=!0,tickInterval:g=30}){const[m,I]=w(n?1:0),x=d(n?1:0),M=d(Date.now()),s=d(n?1:0),a=d(!n),p=d(u);p.current=u;const[k,B]=w(0);if(D(()=>{const o=n?1:0;x.current!==o&&(x.current=o,M.current=Date.now(),s.current=m,a.current=!1,B(l=>l+1))},[n]),D(()=>{const o=x.current;if(s.current===o){o===0&&!a.current&&(a.current=!0,p.current?.());return}const l=setInterval(()=>{const R=Date.now()-M.current,v=i<=0?1:Math.min(1,R/i),T=s.current+(o-s.current)*v;I(T),v>=1&&(clearInterval(l),o===0&&!a.current&&(a.current=!0,p.current?.()))},g);return()=>{clearInterval(l)}},[k,i,g]),O(n,m)==="exited"&&!n)return null;const E=C[h];return E(m,t,r)}const Y=Object.assign(K,{isAnimatable:!0});export{K as Transition,Y as default};