@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 { AnsiColors } from '@visulima/colorize';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- type Props = {
5
- /**
6
- * Accent color when focused.
7
- * @default "blue"
8
- */
9
- readonly accentColor?: LiteralUnion<AnsiColors, string>;
10
- /**
11
- * Auto-focus when mounted if nothing else is focused.
12
- */
13
- readonly autoFocus?: boolean;
14
- /**
15
- * Label rendered next to the checkbox.
16
- */
17
- readonly children?: ReactNode;
18
- /**
19
- * Initial checked state when uncontrolled.
20
- * @default false
21
- */
22
- readonly defaultChecked?: boolean;
23
- /**
24
- * Controlled checked state. When provided, `onChange` should update the parent.
25
- */
26
- readonly isChecked?: boolean;
27
- /**
28
- * Disable input and dim the label.
29
- */
30
- readonly isDisabled?: boolean;
31
- /**
32
- * Fired when the checkbox toggles.
33
- */
34
- readonly onChange?: (checked: boolean) => void;
35
- };
36
- /**
37
- * Focusable checkbox. Toggles with Space or Enter.
38
- */
39
- declare function Checkbox({
40
- accentColor,
41
- autoFocus,
42
- children,
43
- defaultChecked,
44
- isChecked,
45
- isDisabled,
46
- onChange
47
- }: Props): ReactElement;
48
- export { Checkbox, type Props as CheckboxProps, Props, Checkbox as default };
@@ -1 +0,0 @@
1
- import{jsxs as d,jsx as v}from"react/jsx-runtime";import{useState as C,useCallback as x}from"react";import b from"../ink/hooks/use-focus.js";import k from"../ink/hooks/use-input.js";import{Box as F}from"./box.js";import{Text as l}from"./text.js";const g="☒",j="☐";function q({accentColor:s="blue",autoFocus:m=!1,children:c,defaultChecked:n=!1,isChecked:i,isDisabled:e=!1,onChange:t}){const{isFocused:o}=b({autoFocus:m,isActive:!e}),[u,f]=C(n),r=i??u;return k(x((h,p)=>{if(o&&(p.return||h===" ")){const a=!r;i===void 0&&f(a),t?.(a)}},[o,r,i,t]),{isActive:!e&&o}),d(F,{gap:1,children:[d(l,{color:o?s:void 0,dimColor:e,children:[o?"▸ ":" ",r?g:j]}),c===void 0?void 0:v(l,{color:o?s:void 0,dimColor:e,children:c})]})}export{q as Checkbox,q as default};
@@ -1,48 +0,0 @@
1
- import { ReactElement } from 'react';
2
- type Props = {
3
- /**
4
- * The source code string to highlight.
5
- */
6
- readonly code: string;
7
- /**
8
- * Set of line numbers to visually emphasize.
9
- */
10
- readonly highlightLines?: ReadonlySet<number>;
11
- /**
12
- * Programming language for syntax highlighting.
13
- * Falls back to plain text if the language is unknown.
14
- */
15
- readonly language?: string;
16
- /**
17
- * Whether to show line numbers in the gutter.
18
- * @default false
19
- */
20
- readonly showLineNumbers?: boolean;
21
- /**
22
- * Starting line number (useful for code excerpts).
23
- * @default 1
24
- */
25
- readonly startLine?: number;
26
- /**
27
- * Shiki theme name.
28
- * @default "github-dark-default"
29
- */
30
- readonly theme?: string;
31
- };
32
- /**
33
- * Render source code with syntax highlighting.
34
- *
35
- * ```tsx
36
- * &lt;Code code="const x = 42;" language="typescript" />
37
- * &lt;Code code={source} language="python" showLineNumbers />
38
- * ```
39
- */
40
- declare function Code({
41
- code,
42
- highlightLines,
43
- language,
44
- showLineNumbers,
45
- startLine,
46
- theme
47
- }: Props): ReactElement;
48
- export { Code, type Props as CodeProps, Props, Code as default };
@@ -1,2 +0,0 @@
1
- import{jsx as m,jsxs as d}from"react/jsx-runtime";import{useState as w,useRef as S,useEffect as T}from"react";import{r as b,i as v,w as y,g as C,t as j}from"../packem_shared/token-to-elements-D6J6-P2A.js";import{Box as p}from"./box.js";import{Text as x}from"./text.js";function q({code:o,highlightLines:c,language:s,showLineNumbers:i=!1,startLine:a=1,theme:l="github-dark-default"}){const[f,u]=w(null),t=S(!1);T(()=>{t.current=!1;const e=s?b(s):"text";if(e!=="text"&&!v(e)){u(null);return}return(async()=>{try{const r=await y(e==="text"?[]:[e],l),n=C(r,o,e,l);t.current||u(n.tokens)}catch{t.current||u(null)}})(),()=>{t.current=!0}},[o,s,l]);const L={highlightLines:c,showLineNumbers:i,startLine:a};if(f)return j(f,L);const h=o.split(`
2
- `),k=i?String(a+h.length-1).length:0;return m(p,{flexDirection:"column",children:h.map((e,r)=>{const n=a+r,g=c?.has(n)??!1;return d(p,{children:[i?d(x,{color:g?"yellow":void 0,dimColor:!g,children:[String(n).padStart(k)," "]}):void 0,m(x,{children:e})]},r)})})}export{q as Code,q as default};
@@ -1,53 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- type Props = {
5
- /**
6
- * Accent color when the header is focused.
7
- * @default "blue"
8
- */
9
- readonly accentColor?: LiteralUnion<AnsiColors, string>;
10
- /**
11
- * Auto-focus the collapsible on mount.
12
- */
13
- readonly autoFocus?: boolean;
14
- /**
15
- * Child content rendered when open.
16
- */
17
- readonly children: ReactNode;
18
- /**
19
- * Whether the section starts expanded.
20
- * @default false
21
- */
22
- readonly defaultOpen?: boolean;
23
- /**
24
- * Disable interaction.
25
- */
26
- readonly isDisabled?: boolean;
27
- /**
28
- * Controlled open state.
29
- */
30
- readonly isOpen?: boolean;
31
- /**
32
- * Called when the user toggles the section.
33
- */
34
- readonly onToggle?: (isOpen: boolean) => void;
35
- /**
36
- * Header label.
37
- */
38
- readonly title: ReactNode;
39
- };
40
- /**
41
- * Focusable section that can be expanded or collapsed.
42
- */
43
- declare function Collapsible({
44
- accentColor,
45
- autoFocus,
46
- children,
47
- defaultOpen,
48
- isDisabled,
49
- isOpen,
50
- onToggle,
51
- title
52
- }: Props): ReactElement;
53
- export { Collapsible, type Props as CollapsibleProps, Props, Collapsible as default };
@@ -1 +0,0 @@
1
- import{jsxs as a,jsx as l}from"react/jsx-runtime";import{useState as C,useCallback as g}from"react";import D from"../ink/hooks/use-focus.js";import F from"../ink/hooks/use-input.js";import{Box as t}from"./box.js";import{Text as d}from"./text.js";function L({accentColor:c="blue",autoFocus:m=!1,children:f,defaultOpen:u=!1,isDisabled:o=!1,isOpen:r,onToggle:s,title:p}){const{isFocused:e}=D({autoFocus:m,isActive:!o}),[x,b]=C(u),i=r??x;return F(g((h,v)=>{if(v.return||h===" "){const n=!i;r===void 0&&b(n),s?.(n)}},[i,r,s]),{isActive:!o&&e}),a(t,{flexDirection:"column",children:[a(t,{children:[l(d,{color:e?c:void 0,dimColor:o,children:i?"▼ ":"▶ "}),l(d,{bold:e,color:e?c:void 0,dimColor:o,children:p})]}),i?l(t,{flexDirection:"column",marginLeft:2,children:f}):void 0]})}export{L as Collapsible,L as default};
@@ -1,47 +0,0 @@
1
- import { ReactNode, ReactElement } from 'react';
2
- type CommandStatus = "error" | "idle" | "running" | "success";
3
- type Props = {
4
- /**
5
- * Shell command rendered in the header.
6
- */
7
- readonly command: string;
8
- /**
9
- * Optional working directory shown after the command name.
10
- */
11
- readonly cwd?: string;
12
- /**
13
- * Duration in ms; shown when finished.
14
- */
15
- readonly durationMs?: number;
16
- /**
17
- * Exit code of the completed command.
18
- */
19
- readonly exitCode?: number;
20
- /**
21
- * Max output rows rendered before truncation. Use `Infinity` to disable.
22
- */
23
- readonly maxOutputRows?: number;
24
- /**
25
- * Command output. Either a string (rendered as-is) or arbitrary children.
26
- */
27
- readonly output?: ReactNode;
28
- /**
29
- * Lifecycle state. Controls the header icon and color.
30
- * @default "idle"
31
- */
32
- readonly status?: CommandStatus;
33
- };
34
- /**
35
- * Renders a shell command with its output and a status header. Designed for
36
- * coding-agent UIs that stream terminal operations.
37
- */
38
- declare function CommandBlock({
39
- command,
40
- cwd,
41
- durationMs,
42
- exitCode,
43
- maxOutputRows,
44
- output,
45
- status
46
- }: Props): ReactElement;
47
- export { CommandBlock, type Props as CommandBlockProps, CommandStatus, Props, CommandBlock as default };
@@ -1,4 +0,0 @@
1
- import{jsxs as d,jsx as e}from"react/jsx-runtime";import{Box as l}from"./box.js";import{Spinner as p}from"./spinner.js";import{Text as n}from"./text.js";const f={error:"red",idle:"gray",running:"cyan",success:"green"},x=r=>r<1e3?`${Math.round(r)}ms`:`${(r/1e3).toFixed(2)}s`,g=r=>r==="running"?e(p,{type:"dots"}):{error:"✖",idle:"$",success:"✔"}[r],v=(r,i)=>{if(!Number.isFinite(i))return r;const o=r.split(`
2
- `);if(o.length<=i)return r;const t=o.slice(0,i).join(`
3
- `),s=o.length-i;return`${t}
4
- … ${s} more line${s===1?"":"s"}`};function b({command:r,cwd:i,durationMs:o,exitCode:t,maxOutputRows:s=12,output:c,status:m="idle"}){const h=f[m],a=g(m),u=[];return o!==void 0&&u.push(d(n,{dimColor:!0,children:[" ",x(o)]},"duration")),t!==void 0&&m!=="running"&&u.push(d(n,{color:t===0?"green":"red",children:[" ","exit"," ",t]},"exit")),d(l,{borderColor:h,borderStyle:"round",flexDirection:"column",paddingX:1,children:[d(l,{children:[e(n,{color:h,children:a}),e(n,{children:" "}),e(l,{flexGrow:1,flexShrink:1,minWidth:0,children:e(n,{bold:!0,wrap:"truncate-end",children:r})}),i===void 0?void 0:d(n,{dimColor:!0,children:[" ","@",i]}),u.length===0?void 0:e(l,{flexShrink:0,children:u})]}),c===void 0?void 0:e(l,{flexDirection:"column",marginTop:1,children:typeof c=="string"?e(n,{children:v(c,s)}):c})]})}export{b as CommandBlock,b as default};
@@ -1,82 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- type CommandEntry = {
5
- /**
6
- * Optional description rendered under the label.
7
- */
8
- readonly description?: string;
9
- /**
10
- * Optional hotkey rendered on the right.
11
- */
12
- readonly hotkey?: string;
13
- /**
14
- * Optional icon rendered before the label.
15
- */
16
- readonly icon?: ReactNode;
17
- /**
18
- * Stable identifier returned by `onSelect`.
19
- */
20
- readonly id: string;
21
- /**
22
- * Optional keywords to boost matching (not displayed).
23
- */
24
- readonly keywords?: ReadonlyArray<string>;
25
- /**
26
- * Label shown in the list (and used as the primary match target).
27
- */
28
- readonly label: string;
29
- };
30
- type Props = {
31
- /**
32
- * Accent color for the border and focused row.
33
- * @default "cyan"
34
- */
35
- readonly accentColor?: LiteralUnion<AnsiColors, string>;
36
- /**
37
- * Auto-focus the palette on mount.
38
- */
39
- readonly autoFocus?: boolean;
40
- /**
41
- * Available commands to search.
42
- */
43
- readonly commands: ReadonlyArray<CommandEntry>;
44
- /**
45
- * Empty-state text when nothing matches.
46
- * @default "No results"
47
- */
48
- readonly emptyText?: string;
49
- /**
50
- * Max rows rendered in the list.
51
- * @default 8
52
- */
53
- readonly limit?: number;
54
- /**
55
- * Called when the user presses Escape.
56
- */
57
- readonly onCancel?: () => void;
58
- /**
59
- * Called when the user picks a command with Enter.
60
- */
61
- readonly onSelect: (id: string, query: string) => void;
62
- /**
63
- * Placeholder inside the search field.
64
- * @default "Type a command or search..."
65
- */
66
- readonly placeholder?: string;
67
- };
68
- /**
69
- * Ctrl-P style fuzzy command finder. Features a search input, ranked results,
70
- * keyboard navigation, and Esc to cancel.
71
- */
72
- declare function CommandPalette({
73
- accentColor,
74
- autoFocus,
75
- commands,
76
- emptyText,
77
- limit,
78
- onCancel,
79
- onSelect,
80
- placeholder
81
- }: Props): ReactElement;
82
- export { CommandEntry, CommandPalette, type Props as CommandPaletteProps, Props, CommandPalette as default };
@@ -1 +0,0 @@
1
- import{jsxs as a,jsx as n}from"react/jsx-runtime";import{useState as y,useRef as M,useMemo as T,useEffect as S,useCallback as F}from"react";import A from"../ink/hooks/use-focus.js";import D from"../ink/hooks/use-input.js";import{i as L}from"../packem_shared/input-utils-BSWCb4F_.js";import{Box as d}from"./box.js";import{Text as t}from"./text.js";const j=(m,f)=>{if(m.length===0)return 1;const p=[f.label,f.description??"",...f.keywords??[]].map(i=>i.toLowerCase()).filter(i=>i.length>0),h=m.toLowerCase();let s=0;for(const i of p){if(i.includes(h)){const u=i.indexOf(h);s=Math.max(s,100-u);continue}let x=0,g=0;for(const u of h){const c=i.indexOf(u,x);if(c===-1){g=0;break}g+=1,x=c+1}g===h.length&&(s=Math.max(s,20))}return s};function P({accentColor:m="cyan",autoFocus:f=!0,commands:p,emptyText:h="No results",limit:s=8,onCancel:i,onSelect:x,placeholder:g="Type a command or search..."}){const{isFocused:u}=A({autoFocus:f}),[c,v]=y(""),[w,C]=y(0),b=M(w);b.current=w;const l=T(()=>{const e=p.map(r=>({command:r,score:j(c,r)})).filter(({score:r})=>r>0);return e.sort((r,o)=>o.score-r.score),e.slice(0,s).map(({command:r})=>r)},[p,c,s]);return S(()=>{const e=Math.max(0,l.length-1);b.current>e&&(b.current=e,C(e))},[l]),D(F((e,r)=>{if(u){if(r.escape){i?.();return}if(r.downArrow){if(l.length===0)return;C(o=>Math.min(l.length-1,o+1));return}if(r.upArrow){C(o=>Math.max(0,o-1));return}if(r.return){const o=l[b.current];o&&x(o.id,c);return}if(r.backspace||r.delete){v(o=>o.slice(0,-1)),C(0);return}L(e,r)&&(v(o=>o+e),C(0))}},[u,l,c,x,i]),{isActive:u}),a(d,{borderColor:m,borderStyle:"round",flexDirection:"column",paddingX:1,children:[a(d,{children:[n(t,{color:m,children:"❯"}),a(t,{children:[" ",c.length===0?n(t,{dimColor:!0,children:g}):c]}),n(t,{inverse:!0,children:" "})]}),n(d,{marginTop:1,children:a(t,{dimColor:!0,children:[l.length," of ",p.length]})}),n(d,{flexDirection:"column",marginTop:1,children:l.length===0?n(t,{dimColor:!0,children:h}):l.map((e,r)=>{const o=r===w,k=o?m:void 0;return a(d,{flexDirection:"column",children:[a(d,{children:[n(t,{color:k,children:o?"▸ ":" "}),e.icon===void 0?void 0:a(t,{color:k,children:[e.icon," "]}),n(d,{flexGrow:1,flexShrink:1,minWidth:0,children:n(t,{bold:o,color:k,wrap:"truncate-end",children:e.label})}),e.hotkey===void 0?void 0:n(d,{flexShrink:0,children:a(t,{dimColor:!0,children:[" ",e.hotkey]})})]}),e.description===void 0?void 0:n(d,{marginLeft:2,children:n(t,{dimColor:!0,wrap:"truncate-end",children:e.description})})]},e.id)})})]})}export{P as CommandPalette,P as default};
@@ -1,75 +0,0 @@
1
- import { ReactNode, ReactElement } from 'react';
2
- type ConfirmTone = "danger" | "info" | "warning";
3
- type Props = {
4
- /**
5
- * Auto-focus the dialog on mount. Set `false` if a parent already owns
6
- * focus and routes input here.
7
- * @default true
8
- */
9
- readonly autoFocus?: boolean;
10
- /**
11
- * Label for the cancel button.
12
- * @default "Cancel"
13
- */
14
- readonly cancelLabel?: string;
15
- /**
16
- * Body content (rendered between title and buttons).
17
- */
18
- readonly children?: ReactNode;
19
- /**
20
- * Label for the confirm button.
21
- * @default "Confirm"
22
- */
23
- readonly confirmLabel?: string;
24
- /**
25
- * Default button when opening the dialog.
26
- * @default "confirm"
27
- */
28
- readonly defaultFocus?: "cancel" | "confirm";
29
- /**
30
- * Disable input.
31
- */
32
- readonly isDisabled?: boolean;
33
- /**
34
- * Fired when the user declines.
35
- */
36
- readonly onCancel: () => void;
37
- /**
38
- * Fired when the user confirms.
39
- */
40
- readonly onConfirm: () => void;
41
- /**
42
- * Heading rendered at the top of the dialog.
43
- */
44
- readonly title?: string;
45
- /**
46
- * Controls the border color.
47
- * @default "info"
48
- */
49
- readonly tone?: ConfirmTone;
50
- /**
51
- * Dialog width.
52
- */
53
- readonly width?: number;
54
- };
55
- /**
56
- * Full-width modal-style confirm/cancel prompt. Unlike `ConfirmInput`, this
57
- * renders a visible two-button UI: ← / → to toggle focus, Enter to activate,
58
- * y/n as shortcuts, Esc to cancel.
59
- * @returns A bordered `ReactElement` with optional title, body, and two
60
- * buttons (cancel / confirm).
61
- */
62
- declare function ConfirmDialog({
63
- autoFocus,
64
- cancelLabel,
65
- children,
66
- confirmLabel,
67
- defaultFocus,
68
- isDisabled,
69
- onCancel,
70
- onConfirm,
71
- title,
72
- tone,
73
- width
74
- }: Props): ReactElement;
75
- export { ConfirmDialog, type Props as ConfirmDialogProps, ConfirmTone, Props, ConfirmDialog as default };
@@ -1 +0,0 @@
1
- import{jsxs as b,jsx as o}from"react/jsx-runtime";import{useState as w,useCallback as y}from"react";import k from"../ink/hooks/use-focus.js";import A from"../ink/hooks/use-input.js";import{Box as n}from"./box.js";import{Text as f}from"./text.js";const D={danger:"red",info:"blue",warning:"yellow"},p=({color:l,isFocused:r,label:i})=>o(n,{backgroundColor:r?l:void 0,borderColor:r?l:void 0,borderStyle:"round",paddingX:1,children:o(f,{bold:r,color:r?"black":void 0,children:i})});function X({autoFocus:l=!0,cancelLabel:r="Cancel",children:i,confirmLabel:h="Confirm",defaultFocus:g="confirm",isDisabled:u=!1,onCancel:a,onConfirm:s,title:m,tone:v="info",width:C}){const[e,x]=w(g),c=D[v],{isFocused:F}=k({autoFocus:l,isActive:!u});return A(y((t,d)=>{if(d.leftArrow||d.rightArrow||t==="h"||t==="l"){x(e==="confirm"?"cancel":"confirm");return}if(d.return){e==="confirm"?s():a();return}if(d.escape||t==="n"){a();return}t==="y"&&s()},[e,s,a]),{isActive:!u&&F}),b(n,{borderColor:c,borderStyle:"round",flexDirection:"column",paddingX:1,paddingY:1,width:C,children:[m===void 0?void 0:o(n,{marginBottom:1,children:o(f,{bold:!0,color:c,children:m})}),i===void 0?void 0:o(n,{flexDirection:"column",marginBottom:1,children:typeof i=="string"?o(f,{children:i}):i}),b(n,{gap:2,justifyContent:"flex-end",children:[o(p,{color:c,isFocused:e==="cancel",label:r}),o(p,{color:c,isFocused:e==="confirm",label:h})]})]})}export{X as ConfirmDialog,X as default};
@@ -1,38 +0,0 @@
1
- import { ReactElement } from 'react';
2
- type Props = {
3
- /**
4
- * The default action when pressing Enter without typing Y or N.
5
- * @default "confirm"
6
- */
7
- readonly defaultChoice?: "cancel" | "confirm";
8
- /**
9
- * Whether the input is disabled.
10
- * @default false
11
- */
12
- readonly isDisabled?: boolean;
13
- /**
14
- * Called when the user cancels (presses N).
15
- */
16
- readonly onCancel: () => void;
17
- /**
18
- * Called when the user confirms (presses Y).
19
- */
20
- readonly onConfirm: () => void;
21
- /**
22
- * Whether pressing Enter submits the default choice.
23
- * @default true
24
- */
25
- readonly submitOnEnter?: boolean;
26
- };
27
- /**
28
- * Renders a Y/N confirmation prompt. Shows "Y/n" when default is confirm,
29
- * or "y/N" when default is cancel.
30
- */
31
- declare function ConfirmInput({
32
- defaultChoice,
33
- isDisabled,
34
- onCancel,
35
- onConfirm,
36
- submitOnEnter
37
- }: Props): ReactElement;
38
- export { ConfirmInput, type Props as ConfirmInputProps, Props, ConfirmInput as default };
@@ -1 +0,0 @@
1
- import{jsx as m,jsxs as a}from"react/jsx-runtime";import{useRef as u,useCallback as l}from"react";import p from"../ink/hooks/use-input.js";import{Box as C}from"./box.js";import{Text as d}from"./text.js";function w({defaultChoice:r="confirm",isDisabled:o=!1,onCancel:t,onConfirm:i,submitOnEnter:c=!0}){const e=u(i);e.current=i;const n=u(t);return n.current=t,p(l((s,f)=>{if(s.toLowerCase()==="y"){e.current();return}if(s.toLowerCase()==="n"){n.current();return}f.return&&c&&(r==="confirm"?e.current():n.current())},[c,r]),{isActive:!o}),m(C,{children:a(d,{dimColor:o,children:[r==="confirm"?"Y":"y","/",r==="cancel"?"N":"n"]})})}export{w as ConfirmInput,w as default};
@@ -1,54 +0,0 @@
1
- import { ReactElement } from 'react';
2
- import { ConsoleLevel } from "../ink/hooks/use-console-capture.js";
3
- type ConsoleOverlayDock = "bottom" | "top";
4
- type Props = {
5
- /**
6
- * Dock position within the parent container.
7
- * @default "bottom"
8
- */
9
- readonly dock?: ConsoleOverlayDock;
10
- /**
11
- * Which console levels to capture.
12
- * @default ["log", "info", "warn", "error", "debug"]
13
- */
14
- readonly filter?: ReadonlyArray<ConsoleLevel>;
15
- /**
16
- * Visible height in rows.
17
- * @default 8
18
- */
19
- readonly height?: number;
20
- /**
21
- * Maximum entries to keep in the buffer.
22
- * @default 200
23
- */
24
- readonly maxEntries?: number;
25
- /**
26
- * Show the log level label.
27
- * @default true
28
- */
29
- readonly showLevel?: boolean;
30
- /**
31
- * Show timestamps on each entry.
32
- * @default true
33
- */
34
- readonly showTimestamp?: boolean;
35
- };
36
- /**
37
- * A dockable console overlay that captures and displays console output.
38
- *
39
- * ```tsx
40
- * &lt;Box flexDirection="column" height="100%">
41
- * &lt;Box flexGrow={1}>{mainContent}&lt;/Box>
42
- * &lt;ConsoleOverlay dock="bottom" height={6} />
43
- * &lt;/Box>
44
- * ```
45
- */
46
- declare function ConsoleOverlay({
47
- dock,
48
- filter,
49
- height,
50
- maxEntries,
51
- showLevel,
52
- showTimestamp
53
- }: Props): ReactElement;
54
- export { ConsoleOverlay, ConsoleOverlayDock, type Props as ConsoleOverlayProps, Props, ConsoleOverlay as default };
@@ -1 +0,0 @@
1
- import{jsx as a,jsxs as d}from"react/jsx-runtime";import{useMemo as c}from"react";import g from"../ink/hooks/use-console-capture.js";import{Box as p}from"./box.js";import{Text as l}from"./text.js";const h={debug:"gray",error:"red",info:"blue",log:"white",warn:"yellow"},f={debug:"DBG",error:"ERR",info:"INF",log:"LOG",warn:"WRN"},b=t=>{const r=new Date(t),o=String(r.getHours()).padStart(2,"0"),i=String(r.getMinutes()).padStart(2,"0"),n=String(r.getSeconds()).padStart(2,"0");return`${o}:${i}:${n}`};function y({dock:t="bottom",filter:r,height:o=8,maxEntries:i=200,showLevel:n=!0,showTimestamp:u=!0}){const{entries:m}=g({filter:r,maxEntries:i}),s=c(()=>m.slice(-o),[m,o]);return a(p,{borderBottom:t==="top",borderBottomColor:"gray",borderTop:t==="bottom",borderTopColor:"gray",flexDirection:"column",height:o+1,children:s.length===0?a(l,{dimColor:!0,children:"Console output will appear here..."}):s.map(e=>d(p,{children:[u?d(l,{dimColor:!0,children:["[",b(e.timestamp),"]"," "]}):void 0,n?d(l,{color:h[e.level],children:[f[e.level]," "]}):void 0,a(l,{color:e.level==="error"?"red":e.level==="warn"?"yellow":void 0,children:e.message})]},e.id))})}export{y as ConsoleOverlay,y as default};
@@ -1,57 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- type ContentSwitcherOption = {
5
- readonly content: ReactNode;
6
- readonly icon?: ReactNode;
7
- readonly id: string;
8
- readonly label: string;
9
- };
10
- type Props = {
11
- /**
12
- * Accent color for the selected segment.
13
- * @default "blue"
14
- */
15
- readonly accentColor?: LiteralUnion<AnsiColors, string>;
16
- /**
17
- * Auto-focus the switcher on mount.
18
- */
19
- readonly autoFocus?: boolean;
20
- /**
21
- * Initial selected id (uncontrolled).
22
- */
23
- readonly defaultValue?: string;
24
- /**
25
- * Disable input.
26
- */
27
- readonly isDisabled?: boolean;
28
- /**
29
- * Called when the selection changes.
30
- */
31
- readonly onChange?: (id: string) => void;
32
- /**
33
- * Segments to toggle between.
34
- */
35
- readonly options: ReadonlyArray<ContentSwitcherOption>;
36
- /**
37
- * Controlled selected id.
38
- */
39
- readonly value?: string;
40
- };
41
- /**
42
- * Segmented control that flips between mutually exclusive content. More
43
- * compact than `Tabs`: the selected segment is highlighted as a pill, and
44
- * only the active segment's content is rendered.
45
- * @returns A `ReactElement` with a segmented header row and the active
46
- * panel's content beneath it.
47
- */
48
- declare function ContentSwitcher({
49
- accentColor,
50
- autoFocus,
51
- defaultValue,
52
- isDisabled,
53
- onChange,
54
- options,
55
- value
56
- }: Props): ReactElement;
57
- export { ContentSwitcher, ContentSwitcherOption, type Props as ContentSwitcherProps, Props, ContentSwitcher as default };
@@ -1 +0,0 @@
1
- import{jsxs as u,jsx as v,Fragment as k}from"react/jsx-runtime";import{useState as w,useMemo as F,useCallback as p}from"react";import M from"../ink/hooks/use-focus.js";import D from"../ink/hooks/use-input.js";import{Box as m}from"./box.js";import{Text as j}from"./text.js";function $({accentColor:x="blue",autoFocus:g=!1,defaultValue:b,isDisabled:l=!1,onChange:f,options:r,value:t}){const{isFocused:a}=M({autoFocus:g,isActive:!l}),C=b??r[0]?.id,[c,A]=w(C),d=t??c,n=F(()=>{if(d===void 0)return 0;const o=r.findIndex(i=>i.id===d);return Math.max(o,0)},[r,d]),s=p(o=>{const i=r[o];if(!i)return;const e=t??c;i.id!==e&&(t===void 0&&A(i.id),f?.(i.id))},[r,t,c,f]);D(p((o,i)=>{a&&(i.leftArrow||o==="h"?s(Math.max(0,n-1)):(i.rightArrow||o==="l")&&s(Math.min(r.length-1,n+1)))},[a,n,r.length,s]),{isActive:!l&&a});const h=r[n];return u(m,{flexDirection:"column",children:[v(m,{children:r.map((o,i)=>{const e=i===n;return u(j,{backgroundColor:e?x:void 0,color:e?"black":void 0,dimColor:l&&!e,children:[" ",o.icon===void 0?void 0:u(k,{children:[o.icon," "]}),o.label," "]},o.id)})}),h===void 0?void 0:v(m,{flexDirection:"column",marginTop:1,children:h.content})]})}export{$ as ContentSwitcher,$ as default};
@@ -1,61 +0,0 @@
1
- import React, { ReactNode, Ref } from 'react';
2
- import { BoxProps as Props } from "./box.js";
3
- import 'type-fest';
4
- import "../packem_shared/dom.d-B4kXbaVY.js";
5
- import 'yoga-layout';
6
- import "../packem_shared/cursor-helpers.d-BONB9tky.js";
7
- import '@visulima/colorize';
8
- import 'cli-boxes';
9
- import "../packem_shared/styles.d-cMo36xQz.js";
10
- interface ControlledScrollViewProps extends Props {
11
- children?: ReactNode;
12
- debug?: boolean;
13
- onContentHeightChange?: (height: number, previousHeight: number) => void;
14
- onItemHeightChange?: (index: number, height: number, previousHeight: number) => void;
15
- onViewportSizeChange?: (size: {
16
- height: number;
17
- width: number;
18
- }, previousSize: {
19
- height: number;
20
- width: number;
21
- }) => void;
22
- /**
23
- * Number of extra items to render above/below the viewport when virtualized.
24
- * @default 3
25
- */
26
- overscan?: number;
27
- scrollOffset: number;
28
- /**
29
- * Only render items visible in the viewport plus overscan.
30
- * Items must be measured first (first render always renders all items).
31
- * @default false
32
- */
33
- virtualize?: boolean;
34
- }
35
- interface ControlledScrollViewRef {
36
- getBottomOffset: () => number;
37
- getContentHeight: () => number;
38
- getItemHeight: (index: number) => number;
39
- getItemPosition: (index: number) => {
40
- height: number;
41
- top: number;
42
- } | null;
43
- getViewportHeight: () => number;
44
- remeasure: () => void;
45
- remeasureItem: (index: number) => void;
46
- }
47
- declare const ControlledScrollView: ({
48
- children,
49
- debug,
50
- onContentHeightChange,
51
- onItemHeightChange,
52
- onViewportSizeChange,
53
- overscan,
54
- ref,
55
- scrollOffset,
56
- virtualize,
57
- ...boxProps
58
- }: ControlledScrollViewProps & {
59
- ref?: Ref<ControlledScrollViewRef>;
60
- }) => React.JSX.Element;
61
- export { ControlledScrollView, type ControlledScrollViewProps, type ControlledScrollViewRef };
@@ -1 +0,0 @@
1
- import{C as r}from"../packem_shared/controlled-scroll-view-BVg7ywNW.js";export{r as ControlledScrollView};