@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,357 +0,0 @@
1
- import { BoxProps as Props$1 } from "./box.js";
2
- import { Props as Props$2 } from "./text.js";
3
- import { ReactNode, ReactElement } from 'react';
4
- import 'type-fest';
5
- import "../packem_shared/dom.d-B4kXbaVY.js";
6
- import 'yoga-layout';
7
- import "../packem_shared/cursor-helpers.d-BONB9tky.js";
8
- import '@visulima/colorize';
9
- import 'cli-boxes';
10
- import "../packem_shared/styles.d-cMo36xQz.js";
11
- type StyleFunctionProps = {
12
- readonly depth?: number;
13
- readonly hasChildren?: boolean;
14
- readonly isExpanded?: boolean;
15
- readonly isFocused?: boolean;
16
- readonly isLoading?: boolean;
17
- readonly isSelected?: boolean;
18
- };
19
- declare const theme: {
20
- styles: {
21
- container: () => Props$1;
22
- expandIndicator: (_props: StyleFunctionProps) => Props$2;
23
- focusIndicator: () => Props$2;
24
- indent: ({
25
- depth
26
- }: StyleFunctionProps) => Props$1;
27
- label: ({
28
- isFocused,
29
- isSelected
30
- }: StyleFunctionProps) => Props$2;
31
- loadingIndicator: () => Props$2;
32
- node: ({
33
- isFocused
34
- }: StyleFunctionProps) => Props$1;
35
- selectedIndicator: () => Props$2;
36
- };
37
- };
38
- type Theme = typeof theme;
39
- /**
40
- * A single node in the tree. Generic over the user's data shape.
41
- * The `id` field MUST be unique across the entire tree.
42
- */
43
- type TreeNode<T = Record<string, unknown>> = {
44
- /** Child nodes. Undefined or empty array means leaf node. */
45
- readonly children?: TreeNode<T>[];
46
- /** Arbitrary user data attached to this node. */
47
- readonly data?: T;
48
- /** Unique identifier for this node. Used as the key for all lookups. */
49
- readonly id: string;
50
- /**
51
- * Explicitly marks this node as a parent that can have children loaded
52
- * asynchronously via `loadChildren`. When true, the node shows an expand
53
- * indicator even if `children` is empty or undefined, and expanding it
54
- * triggers the `loadChildren` callback.
55
- */
56
- readonly isParent?: boolean;
57
- /** Display label. Used by the default renderer. */
58
- readonly label: string;
59
- };
60
- /**
61
- * For async/lazy loading: a function that resolves children on demand.
62
- */
63
- type AsyncChildrenFunction<T = Record<string, unknown>> = (node: TreeNode<T>) => Promise<TreeNode<T>[]>;
64
- /**
65
- * State passed to custom renderers and theme functions.
66
- */
67
- type TreeNodeState = {
68
- /** Depth of this node in the tree (root = 0). */
69
- readonly depth: number;
70
- /** Whether this node has children (or a lazy loader). */
71
- readonly hasChildren: boolean;
72
- /** Whether this node is expanded (children visible). */
73
- readonly isExpanded: boolean;
74
- /** Whether this node is currently focused (cursor is on it). */
75
- readonly isFocused: boolean;
76
- /** Whether children are currently loading (async mode). */
77
- readonly isLoading: boolean;
78
- /** Whether this node is selected (in select/multi-select mode). */
79
- readonly isSelected: boolean;
80
- };
81
- /**
82
- * Props received by a custom node renderer.
83
- */
84
- type TreeNodeRendererProps<T = Record<string, unknown>> = {
85
- /** The tree node data. */
86
- readonly node: TreeNode<T>;
87
- /** Current state of this node. */
88
- readonly state: TreeNodeState;
89
- };
90
- /**
91
- * Selection mode for the tree view.
92
- */
93
- type SelectionMode = "multiple" | "none" | "single";
94
- /**
95
- * A flattened representation of a tree node with navigation links.
96
- */
97
- type FlatNode<T = Record<string, unknown>> = {
98
- /** Ordered list of direct children IDs. */
99
- readonly childrenIds: ReadonlyArray<string>;
100
- /** Depth in the tree (0 for roots). */
101
- readonly depth: number;
102
- /** Index in the flattened DFS order (across ALL nodes, not just visible). */
103
- readonly flatIndex: number;
104
- /** Whether this node has children. */
105
- readonly hasChildren: boolean;
106
- /** Next sibling's ID, or undefined. */
107
- readonly nextSiblingId: string | undefined;
108
- /** The original tree node. */
109
- readonly node: TreeNode<T>;
110
- /** Parent's id, or undefined if root. */
111
- readonly parentId: string | undefined;
112
- /** Previous sibling's ID, or undefined. */
113
- readonly previousSiblingId: string | undefined;
114
- /** Total number of siblings (including this node). */
115
- readonly siblingCount: number;
116
- /** Zero-based index among siblings. */
117
- readonly siblingIndex: number;
118
- };
119
- /**
120
- * A flattened map of all tree nodes built via DFS traversal.
121
- * Stores parent/child/sibling links for O(1) navigation.
122
- */
123
- declare class TreeNodeMap<T = Record<string, unknown>> {
124
- /** All node IDs in DFS order. */
125
- readonly orderedIds: string[];
126
- /** Root-level node IDs. */
127
- readonly rootIds: string[];
128
- /** Map from node ID to FlatNode. */
129
- private readonly map;
130
- constructor(data: TreeNode<T>[]);
131
- /**
132
- * Iterate over all entries.
133
- */
134
- entries(): IterableIterator<[string, FlatNode<T>]>;
135
- /**
136
- * Get a flat node by ID.
137
- */
138
- get(id: string): FlatNode<T> | undefined;
139
- /**
140
- * Total number of nodes in the tree.
141
- */
142
- get size(): number;
143
- /**
144
- * Given a set of expanded node IDs, return the ordered list of
145
- * VISIBLE node IDs (i.e., a node is visible if all its ancestors
146
- * are expanded).
147
- *
148
- * Uses iterative DFS, skipping collapsed subtrees.
149
- */
150
- getVisibleIds(expandedIds: ReadonlySet<string>): string[];
151
- /**
152
- * Check if a node is a descendant of another node.
153
- */
154
- isDescendantOf(nodeId: string, ancestorId: string): boolean;
155
- /**
156
- * Insert dynamically-loaded children under a parent node.
157
- * Returns a new TreeNodeMap (immutable operation).
158
- *
159
- * Rebuilds the full tree from the current map state (not the original
160
- * input data), so successive calls for different parents are safe.
161
- */
162
- withChildren(parentId: string, children: TreeNode<T>[]): TreeNodeMap<T>;
163
- private buildFromData;
164
- }
165
- type Props<T = Record<string, unknown>> = {
166
- /**
167
- * Accessible label for the tree container.
168
- * Useful when multiple tree views are on screen.
169
- * @default "Tree view"
170
- */
171
- readonly ariaLabel?: string;
172
- /**
173
- * The tree data. Array of root-level nodes.
174
- *
175
- * **Important:** Must be referentially stable across renders (e.g. stored
176
- * in state or wrapped in `useMemo`). Passing a new array reference on
177
- * every render will reset focus, expansion, and selection state.
178
- */
179
- readonly data: TreeNode<T>[];
180
- /**
181
- * Set of node IDs that are expanded by default.
182
- * If not provided, all nodes start collapsed.
183
- */
184
- readonly defaultExpanded?: ReadonlySet<string> | "all";
185
- /**
186
- * Set of node IDs that are selected by default.
187
- */
188
- readonly defaultSelected?: ReadonlySet<string>;
189
- /**
190
- * When disabled, user input is ignored.
191
- * @default false
192
- */
193
- readonly isDisabled?: boolean;
194
- /**
195
- * Async function to load children on demand.
196
- */
197
- readonly loadChildren?: AsyncChildrenFunction<T>;
198
- /** Called when expanded set changes. */
199
- readonly onExpandChange?: (expandedIds: ReadonlySet<string>) => void;
200
- /** Called when the focused node changes. */
201
- readonly onFocusChange?: (nodeId: string) => void;
202
- /**
203
- * Called when `loadChildren` rejects. Receives the node ID and error.
204
- */
205
- readonly onLoadError?: (nodeId: string, error: Error) => void;
206
- /** Called when selection changes. */
207
- readonly onSelectChange?: (selectedIds: ReadonlySet<string>) => void;
208
- /**
209
- * Custom node renderer. Receives node + state, returns Ink JSX.
210
- */
211
- readonly renderNode?: (props: TreeNodeRendererProps<T>) => ReactNode;
212
- /**
213
- * Selection mode.
214
- * - "none": No selection behavior (default).
215
- * - "single": One node can be selected at a time.
216
- * - "multiple": Multiple nodes can be selected (checkboxes shown).
217
- * @default "none"
218
- */
219
- readonly selectionMode?: SelectionMode;
220
- /**
221
- * Number of visible nodes in the viewport (for virtualization).
222
- * @default Infinity (no virtualization)
223
- */
224
- readonly visibleNodeCount?: number;
225
- };
226
- /**
227
- * Renders an interactive tree view with keyboard navigation.
228
- *
229
- * ```tsx
230
- * &lt;TreeView
231
- * data={[
232
- * { id: "1", label: "Root", children: [
233
- * { id: "1.1", label: "Child" },
234
- * ]},
235
- * ]}
236
- * defaultExpanded="all"
237
- * />
238
- * ```
239
- */
240
- declare function TreeView<T = Record<string, unknown>>({
241
- ariaLabel,
242
- data,
243
- defaultExpanded,
244
- defaultSelected,
245
- isDisabled,
246
- loadChildren,
247
- onExpandChange,
248
- onFocusChange,
249
- onLoadError,
250
- onSelectChange,
251
- renderNode,
252
- selectionMode,
253
- visibleNodeCount
254
- }: Props<T>): ReactElement;
255
- type UseTreeViewStateProps<T = Record<string, unknown>> = {
256
- /** The tree data. Array of root-level nodes. */
257
- readonly data: TreeNode<T>[];
258
- /**
259
- * Set of node IDs that are expanded by default.
260
- * If not provided, all nodes start collapsed.
261
- */
262
- readonly defaultExpanded?: ReadonlySet<string> | "all";
263
- /**
264
- * Set of node IDs that are selected by default.
265
- */
266
- readonly defaultSelected?: ReadonlySet<string>;
267
- /** Called when expanded set changes. */
268
- readonly onExpandChange?: (expandedIds: ReadonlySet<string>) => void;
269
- /** Called when the focused node changes. */
270
- readonly onFocusChange?: (nodeId: string) => void;
271
- /** Called when selection changes. */
272
- readonly onSelectChange?: (selectedIds: ReadonlySet<string>) => void;
273
- /**
274
- * Selection mode.
275
- * @default "none"
276
- */
277
- readonly selectionMode?: SelectionMode;
278
- /**
279
- * Number of visible nodes in the viewport (for virtualization).
280
- * @default Infinity
281
- */
282
- readonly visibleNodeCount?: number;
283
- };
284
- type TreeViewState<T = Record<string, unknown>> = {
285
- readonly collapse: () => void;
286
- readonly collapseAll: () => void;
287
- readonly collapseNode: (nodeId: string) => void;
288
- readonly expand: () => void;
289
- readonly expandAll: () => void;
290
- readonly expandedIds: ReadonlySet<string>;
291
- readonly expandNode: (nodeId: string) => void;
292
- readonly focusedId: string | undefined;
293
- readonly focusFirst: () => void;
294
- readonly focusFirstChild: () => void;
295
- readonly focusLast: () => void;
296
- readonly focusNext: () => void;
297
- readonly focusParent: () => void;
298
- readonly focusPrevious: () => void;
299
- readonly hasScrollDown: boolean;
300
- readonly hasScrollUp: boolean;
301
- readonly insertChildren: (parentId: string, children: TreeNode<T>[]) => void;
302
- readonly loadingIds: ReadonlySet<string>;
303
- readonly nodeMap: TreeNodeMap<T>;
304
- readonly select: () => void;
305
- readonly selectedIds: ReadonlySet<string>;
306
- readonly setChildrenError: (nodeId: string) => void;
307
- readonly setLoading: (nodeId: string, isLoading: boolean) => void;
308
- readonly toggleExpanded: () => void;
309
- readonly viewportFromIndex: number;
310
- readonly viewportNodes: {
311
- node: TreeNode<T>;
312
- state: TreeNodeState;
313
- }[];
314
- readonly viewportToIndex: number;
315
- readonly visibleCount: number;
316
- };
317
- declare function useTreeViewState<T = Record<string, unknown>>({
318
- data,
319
- defaultExpanded,
320
- defaultSelected,
321
- onExpandChange,
322
- onFocusChange,
323
- onSelectChange,
324
- selectionMode,
325
- visibleNodeCount
326
- }: UseTreeViewStateProps<T>): TreeViewState<T>;
327
- type UseTreeViewProps<T = Record<string, unknown>> = {
328
- /**
329
- * When disabled, user input is ignored.
330
- * @default false
331
- */
332
- readonly isDisabled?: boolean;
333
- /**
334
- * Async function to load children on demand.
335
- */
336
- readonly loadChildren?: AsyncChildrenFunction<T>;
337
- /**
338
- * Called when `loadChildren` rejects.
339
- */
340
- readonly onLoadError?: (nodeId: string, error: Error) => void;
341
- /**
342
- * Selection mode.
343
- */
344
- readonly selectionMode: SelectionMode;
345
- /**
346
- * The tree view state from `useTreeViewState`.
347
- */
348
- readonly state: TreeViewState<T>;
349
- };
350
- declare function useTreeView<T>({
351
- isDisabled,
352
- loadChildren,
353
- onLoadError,
354
- selectionMode,
355
- state
356
- }: UseTreeViewProps<T>): void;
357
- export { type AsyncChildrenFunction, type FlatNode, type SelectionMode, type TreeNode, TreeNodeMap, type TreeNodeRendererProps, type TreeNodeState, TreeView, type Props as TreeViewProps, type TreeViewState, type Theme as TreeViewTheme, type UseTreeViewProps, type UseTreeViewStateProps, theme as treeViewTheme, useTreeView, useTreeViewState };
@@ -1 +0,0 @@
1
- import{theme as o}from"../packem_shared/treeViewTheme-Dq3ekRAC.js";import{TreeNodeMap as m}from"../packem_shared/TreeNodeMap-cJlYqckB.js";import{TreeView as f}from"../packem_shared/TreeView-BsvLCsf0.js";import{useTreeView as T}from"../packem_shared/useTreeView-D5ifGwG3.js";import{useTreeViewState as w}from"../packem_shared/useTreeViewState-BiTJakkh.js";export{m as TreeNodeMap,f as TreeView,o as treeViewTheme,T as useTreeView,w as useTreeViewState};
@@ -1,30 +0,0 @@
1
- import { ReactNode, ReactElement } from 'react';
2
- type UnorderedListEntry = {
3
- /**
4
- * Content of the list entry. Can be a string or nested list.
5
- */
6
- readonly children?: ReadonlyArray<UnorderedListEntry>;
7
- /**
8
- * Display text for this item.
9
- */
10
- readonly label: ReactNode;
11
- };
12
- type Props = {
13
- /**
14
- * Entries to render as a bullet list.
15
- */
16
- readonly items: ReadonlyArray<UnorderedListEntry>;
17
- /**
18
- * Custom bullet symbol(s). A string uses the same symbol at all depths.
19
- * An array cycles through symbols by nesting depth.
20
- */
21
- readonly marker?: ReadonlyArray<string> | string;
22
- };
23
- /**
24
- * Renders a bullet list with nesting support.
25
- */
26
- declare function UnorderedList({
27
- items,
28
- marker
29
- }: Props): ReactElement;
30
- export { Props, UnorderedList, UnorderedListEntry, type Props as UnorderedListProps, UnorderedList as default };
@@ -1 +0,0 @@
1
- import{jsx as o,jsxs as l}from"react/jsx-runtime";import{Box as t}from"./box.js";import{Text as c}from"./text.js";const a=["─","◦","▪"],f=r=>typeof r=="string"?[r]:Array.isArray(r)?r:a,s=(r,e,i)=>{const d=e[i%e.length]??"─";return o(t,{flexDirection:"column",children:r.map((n,m)=>l(t,{gap:1,children:[o(c,{dimColor:!0,children:d}),l(t,{flexDirection:"column",children:[o(c,{children:n.label}),n.children?s(n.children,e,i+1):void 0]})]},m))})};function x({items:r,marker:e}){const i=f(e);return s(r,i,0)}export{x as UnorderedList,x as default};
@@ -1,49 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { b as ScrollViewRef } from "../../packem_shared/scroll-view.d-DtpsgHLg.js";
3
- import "../../components/box.js";
4
- import 'type-fest';
5
- import "../../packem_shared/dom.d-B4kXbaVY.js";
6
- import 'yoga-layout';
7
- import "../../packem_shared/cursor-helpers.d-BONB9tky.js";
8
- import '@visulima/colorize';
9
- import 'cli-boxes';
10
- import "../../packem_shared/styles.d-cMo36xQz.js";
11
- type UseLinkedScrollReturn = {
12
- /**
13
- * Callback to pass to ScrollView's `onScroll` prop.
14
- * Broadcasts the scroll position to all linked instances.
15
- */
16
- onScroll: (scrollOffset: number) => void;
17
- /**
18
- * Ref to attach to the ScrollView component.
19
- * Used internally to call `scrollTo()` when other instances scroll.
20
- */
21
- ref: RefObject<ScrollViewRef | null>;
22
- };
23
- type LinkedScrollGroup = {
24
- /**
25
- * Hook that returns a ref and onScroll callback for linking a ScrollView
26
- * to this group. Call once per ScrollView instance.
27
- */
28
- useLinkedScroll: () => UseLinkedScrollReturn;
29
- };
30
- /**
31
- * Creates a linked scroll group that synchronizes scroll position
32
- * across multiple ScrollView instances.
33
- * @example
34
- * ```tsx
35
- * const group = createLinkedScrollGroup();
36
- *
37
- * const PanelA = () => {
38
- * const { ref, onScroll } = group.useLinkedScroll();
39
- * return <ScrollView ref={ref} onScroll={onScroll}>...</ScrollView>;
40
- * };
41
- *
42
- * const PanelB = () => {
43
- * const { ref, onScroll } = group.useLinkedScroll();
44
- * return <ScrollView ref={ref} onScroll={onScroll}>...</ScrollView>;
45
- * };
46
- * ```
47
- */
48
- declare const createLinkedScrollGroup: () => LinkedScrollGroup;
49
- export { LinkedScrollGroup, UseLinkedScrollReturn, createLinkedScrollGroup, createLinkedScrollGroup as default };
@@ -1 +0,0 @@
1
- import{useRef as s,useState as u,useEffect as a,useCallback as d}from"react";const S=()=>{const r=new Set;let t=!1;return{useLinkedScroll:()=>{const l=s(null),[,c]=u(0),f={ref:l,setOffset:()=>{c(e=>e+1)}},n=s(f);return n.current=f,a(()=>{const{current:e}=n;return r.add(e),()=>{r.delete(e)}},[]),{onScroll:d(e=>{if(!t){t=!0;try{for(const o of r)o.ref!==l&&o.ref.current?.scrollTo(e)}finally{t=!1}}},[]),ref:l}}}};export{S as createLinkedScrollGroup,S as default};
@@ -1 +0,0 @@
1
- import"react/jsx-runtime";import"react";import"./measure-element-D4M9iSYp.js";import"../components/box.js";import{C as l}from"./controlled-scroll-view-BVg7ywNW.js";export{l as ControlledScrollView};
@@ -1 +0,0 @@
1
- import{createRequire as A}from"node:module";import{jsxs as d,jsx as y}from"react/jsx-runtime";import{useState as g,useRef as G,useEffect as N,useCallback as $}from"react";import W from"../ink/hooks/use-input.js";import{Box as E}from"../components/box.js";import{Spinner as I}from"../components/spinner.js";import{Text as u}from"../components/text.js";const H=A(import.meta.url),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,U=e=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[i,a]=w.versions.node.split(".").map(Number);if(i>22||i===22&&a>=3||i===20&&a>=16)return w.getBuiltinModule(e)}return H(e)},{readdir:K,stat:J}=U("node:fs/promises"),{resolve:L,join:R,dirname:O,extname:Q}=U("node:path");function V(e){const i=a=>`${a&4?"r":"-"}${a&2?"w":"-"}${a&1?"x":"-"}`;return`${i(e>>6&7)}${i(e>>3&7)}${i(e&7)}`}function X(e,i){if(!(i.showHidden??!1)&&e.isHidden||!(i.showDirectories??!0)&&e.isDirectory||!(i.showFiles??!0)&&!e.isDirectory)return!1;if(i.extensions&&i.extensions.length>0&&!e.isDirectory){const a=Q(e.name);if(!i.extensions.includes(a))return!1}return!0}function Y(e){const{filter:i,initialPath:a}=e,[h,D]=g(()=>L(a)),[C,l]=g([]),[b,x]=g(!0),[j,v]=g(),[P,o]=g(0),M=G(i);M.current=i,N(()=>{let s=!1;return(async()=>{x(!0),v(void 0);try{const n=await K(h,{withFileTypes:!0}),_=await Promise.all(n.map(async r=>{try{return await J(R(h,r.name))}catch{return}})),T=n.map((r,t)=>{const F=R(h,r.name),S=r.isDirectory(),k=r.name.startsWith("."),B=_[t],q=B?.size??0,z=B?V(B.mode):"---------";return{isDirectory:S,isHidden:k,name:r.name,path:F,permissions:z,size:q}});if(s)return;const c=T.filter(r=>X(r,M.current));c.sort((r,t)=>r.isDirectory!==t.isDirectory?r.isDirectory?-1:1:r.name.localeCompare(t.name,void 0,{sensitivity:"base"})),l(c)}catch(n){s||(v(n instanceof Error?n.message:String(n)),l([]))}finally{s||x(!1)}})().catch(()=>{}),()=>{s=!0}},[h,P]);const m=$(s=>{D(L(s))},[]),f=$(()=>{D(s=>{const n=O(s);return n===s?s:n})},[]),p=$(()=>{o(s=>s+1)},[]);return{currentPath:h,entries:C,error:j,goUp:f,isLoading:b,navigateTo:m,refresh:p}}function Z(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}K`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)}M`:`${(e/(1024*1024*1024)).toFixed(1)}G`}const ee={},re=()=>process.cwd(),le=({accentColor:e="cyan",directoryColor:i="blue",fileColor:a="white",filter:h=ee,initialPath:D,isFocused:C=!0,limit:l=10,onCancel:b,onSelect:x,showPermissions:j=!1,showSize:v=!1})=>{const P=D??re(),o=Y({filter:h,initialPath:P}),[M,m]=g(0),f=Math.max(0,o.entries.length-1),p=Math.min(M,f);W($((c,r)=>{if(r.upArrow)m(t=>Math.max(0,t-1));else if(r.downArrow)m(t=>Math.min(f,t+1));else if(r.return){const t=o.entries[p];t&&(t.isDirectory?(o.navigateTo(t.path),m(0)):x?.(t))}else r.backspace||r.leftArrow?(o.goUp(),m(0)):r.escape?b?.():c==="."?o.refresh():r.pageUp?m(t=>Math.max(0,t-l)):r.pageDown?m(t=>Math.min(f,t+l)):r.home?m(0):r.end&&m(f)},[f,p,o,l,x,b]),{isActive:C});const s=Math.floor(l/2);let n=Math.max(0,p-s);const _=Math.min(o.entries.length,n+l);n=Math.max(0,_-l);const T=o.entries.slice(n,_);return d(E,{flexDirection:"column",children:[y(u,{bold:!0,dimColor:!0,children:o.currentPath}),o.isLoading&&d(E,{children:[y(I,{}),y(u,{children:" Loading..."})]}),o.error&&d(u,{color:"red",children:["Error:",o.error]}),!o.isLoading&&!o.error&&o.entries.length===0&&y(u,{dimColor:!0,children:"(empty directory)"}),T.map((c,r)=>{const t=n+r===p,F=c.isDirectory?"📁 ":"📄 ",S=c.isDirectory?i:a;return d(E,{children:[y(u,{color:t?e:void 0,children:t?"▸ ":" "}),y(u,{children:F}),d(u,{bold:c.isDirectory,color:t?e:S,children:[c.name,c.isDirectory?"/":""]}),v&&!c.isDirectory&&d(u,{dimColor:!0,children:[" ",Z(c.size)]}),j&&d(u,{dimColor:!0,children:[" ",c.permissions]})]},c.name)}),o.entries.length>l&&d(u,{dimColor:!0,children:[p+1,"/",o.entries.length]})]})};export{le as default};
@@ -1,2 +0,0 @@
1
- import{EventEmitter as l}from"tseep";class B extends l{constructor(t){super(),this.stdin=t}stdin;_boundHandleData=null;_pasteBuffer=null;start(){typeof this.stdin.setRawMode=="function"&&this.stdin.setRawMode(!0),this.stdin.resume(),this.stdin.setEncoding("utf8"),this._boundHandleData=this.handleData.bind(this),this.stdin.on("data",this._boundHandleData)}stop(){typeof this.stdin.setRawMode=="function"&&this.stdin.setRawMode(!1),this.stdin.pause(),this._boundHandleData&&(this.stdin.removeListener("data",this._boundHandleData),this._boundHandleData=null)}handleData(t){if(t===""){this.emit("exit");return}if(t.includes("\x1B[200~")||this._pasteBuffer!==null){if(this._pasteBuffer===null?this._pasteBuffer=t.replace("\x1B[200~",""):this._pasteBuffer+=t,this._pasteBuffer.includes("\x1B[201~")){const e=this._pasteBuffer.replace("\x1B[201~","");this._pasteBuffer=null,this.emit("paste",e),this.listenerCount("paste")===0&&this.emit("data",e)}return}if(t.length===1){const e=t.charCodeAt(0);if(e>=1&&e<=26&&e!==3&&e!==9&&e!==10&&e!==13){const s=String.fromCharCode(e+96);this.emit("ctrl",s),this.emit("data",t,{ctrl:!0});return}}if(t==="\x1B[A"){this.emit("keydown","up");return}if(t==="\x1B[B"){this.emit("keydown","down");return}if(t==="\x1B[C"){this.emit("keydown","right");return}if(t==="\x1B[D"){this.emit("keydown","left");return}if(t===" "){this.emit("keydown","tab");return}if(t==="\x1B[Z"){this.emit("keydown","shift-tab");return}if(t==="\x1B"){this.emit("keydown","escape");return}if(t==="\r"||t===`
2
- `){this.emit("keydown","enter");return}if(t===""){this.emit("keydown","backspace");return}if(t==="\x1B[3~"){this.emit("keydown","delete");return}if(t==="\x1B[5~"){this.emit("keydown","pageUp");return}if(t==="\x1B[6~"){this.emit("keydown","pageDown");return}if(t==="\x1B[H"||t==="\x1B[1~"){this.emit("keydown","home");return}if(t==="\x1B[F"||t==="\x1B[4~"){this.emit("keydown","end");return}if(t.length===2&&t[0]==="\x1B"){this.emit("meta",t[1]),this.emit("data",t,{meta:!0});return}if(t.startsWith("\x1B[<")){const e=t.match(/\u001B\[<(\d+);(\d+);(\d+)(M)/i);if(e){const s=Number.parseInt(e[1]),a=Number.parseInt(e[2])-1,d=Number.parseInt(e[3])-1,r=e[4]==="m",h=(s&4)!==0,u=(s&8)!==0,o=(s&16)!==0,n=s&-29;let i=null;if(n===0&&!r?i="left":n===1&&!r?i="middle":n===2&&!r?i="right":n===64?i="scrollUp":n===65&&(i="scrollDown"),i){const f={button:i,ctrl:o,meta:u,shift:h,x:a,y:d};this.emit("mouse",f),i==="left"&&this.emit("click",{x:a,y:d})}}return}this.emit("data",t)}}export{B as InputParser};
@@ -1 +0,0 @@
1
- import{createRequire as y}from"node:module";import{jsx as T}from"react/jsx-runtime";import{useRef as d,useReducer as R,useEffect as b,useMemo as j}from"react";import{useStdinContext as x}from"../ink/hooks/use-stdin.js";import w from"../ink/hooks/use-stdout.js";import{M as n,d as B}from"./ansi-parser-DlgLtOYO.js";import{o as E}from"./mouse-context-DaARgUu1.js";const v=y(import.meta.url),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_=e=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[t,i]=u.versions.node.split(".").map(Number);if(t>22||t===22&&i>=3||t===20&&i>=16)return u.getBuiltinModule(e)}return v(e)},{EventEmitter:h}=_("node:events"),M=u,q={button:null,click:null,drag:null,position:{x:0,y:0},scroll:null},S=(e,t)=>{switch(t.type){case"click":return{...e,button:t.button,click:t.click,position:t.position};case"click-reset":return{...e,button:null,click:null};case"drag":return{...e,button:t.button,drag:t.drag,position:t.position};case"move":return{...e,position:t.position};case"scroll":return{...e,position:t.position,scroll:t.scroll};case"scroll-reset":return{...e,scroll:null};default:return e}},z=({children:e})=>{const{internal_eventEmitter:t}=x(),{stdout:i}=w(),l=d(new h),[s,c]=R(S,q),p=d(void 0),m=d(void 0);b(()=>{const a=i.isTTY?i:M.stdout;return a.write(n.mouseButton.on+n.mouseMotion.on+n.mouseMotionOthers.on+n.mouseSGR.on),()=>{a.write(n.mouseSGR.off+n.mouseMotionOthers.off+n.mouseMotion.off+n.mouseButton.off)}},[i]),b(()=>{const a=k=>{const o=B(k);if(!o)return;const r={x:o.x,y:o.y};switch(l.current.emit("position",r),o.type){case"click":{c({button:o.button,click:o.action,position:r,type:"click"}),l.current.emit("click",r,o.action,o.button),clearTimeout(p.current),p.current=setTimeout(()=>{c({type:"click-reset"})},100);break}case"drag":{const f=o.action==="press"?"dragging":null;c({button:o.button,drag:f,position:r,type:"drag"}),l.current.emit("drag",r,f,o.button);break}case"move":{c({position:r,type:"move"});break}case"scroll":{c({position:r,scroll:o.direction,type:"scroll"}),l.current.emit("scroll",r,o.direction),clearTimeout(m.current),m.current=setTimeout(()=>{c({type:"scroll-reset"})},100);break}}};return t.on("input",a),()=>{t.off("input",a),clearTimeout(p.current),clearTimeout(m.current)}},[t]);const g=j(()=>({button:s.button,click:s.click,drag:s.drag,events:l.current,position:s.position,scroll:s.scroll}),[s]);return T(E,{value:g,children:e})};export{z as default};
@@ -1 +0,0 @@
1
- import{jsx as i,jsxs as I}from"react/jsx-runtime";import{useMemo as N}from"react";import{Box as H}from"../components/box.js";import{Text as p}from"../components/text.js";const S={arrow:{lowerThumb:"╽",thumb:"┃",track:"|",upperThumb:"╿"},block:{thumb:"█",track:"░"},bold:{lowerThumb:"╿",thumb:"│",track:"┃",upperThumb:"╽"},classic:{thumb:"┃",track:"|"},dots:{thumb:"●",track:"·"},double:{thumb:"┃",track:"║"},doubleSingle:{lowerThumb:"╽",thumb:"┃",track:"│",upperThumb:"╿"},line:{thumb:"│",track:" "},round:{lowerThumb:"╽",thumb:"┃",track:"│",upperThumb:"╿"},single:{lowerThumb:"╽",thumb:"┃",track:"│",upperThumb:"╿"},singleDouble:{thumb:"┃",track:"║"},thick:{thumb:"┃",track:"╏"}},B={arrow:{bottomLeft:"└",bottomRight:"┘",topLeft:"┌",topRight:"┐"},bold:{bottomLeft:"┗",bottomRight:"┛",topLeft:"┏",topRight:"┓"},classic:{bottomLeft:"+",bottomRight:"+",topLeft:"+",topRight:"+"},double:{bottomLeft:"╚",bottomRight:"╝",topLeft:"╔",topRight:"╗"},doubleSingle:{bottomLeft:"╘",bottomRight:"╛",topLeft:"╒",topRight:"╕"},round:{bottomLeft:"╰",bottomRight:"╯",topLeft:"╭",topRight:"╮"},single:{bottomLeft:"└",bottomRight:"┘",topLeft:"┌",topRight:"┐"},singleDouble:{bottomLeft:"╙",bottomRight:"╜",topLeft:"╓",topRight:"╖"}},Y=t=>S[typeof t=="string"?t:"single"]??S.single??{thumb:"┃",track:"│"},_=t=>B[typeof t=="string"?t:"single"]??B.single??{bottomLeft:"└",bottomRight:"┘",topLeft:"┌",topRight:"┐"},K=({autoHide:t=!1,color:m,contentHeight:L,dimColor:l,placement:n="right",scrollOffset:R,style:c,thumbChar:k,trackChar:x,viewportHeight:e})=>{const a=N(()=>{const r=Math.max(L,e);if(t&&r<=e)return null;const o=Y(c),f=k??o.thumb,q=x??o.track,w=e*2,v=Math.min(e/r,1),T=Math.max(2,Math.round(w*v)),M=r-e,A=M>0?Math.min(Math.max(R/M,0),1):0,E=w-T,s=Math.round(A*E),C=s+T,h=[];for(let b=0;b<e;b+=1){const D=b*2,y=b*2+1,g=D>=s&&D<C,d=y>=s&&y<C;g&&d?h.push(f):g&&!d?h.push(o.lowerThumb??f):!g&&d?h.push(o.upperThumb??f):h.push(q)}return h},[L,e,R,c,k,x,t]);if(a===null)return null;if(n==="inset")return i(H,{flexDirection:"column",flexShrink:0,width:1,children:a.map((r,o)=>i(p,{color:m,dimColor:l,children:r},o))});const u=_(c),j=n==="left"?u.topLeft:u.topRight,O=n==="left"?u.bottomLeft:u.bottomRight;return I(H,{flexDirection:"column",flexShrink:0,width:1,children:[i(p,{color:m,dimColor:l,children:j}),a.map((r,o)=>i(p,{color:m,dimColor:l,children:r},o)),i(p,{color:m,dimColor:l,children:O})]})};export{K as ScrollBar};
@@ -1 +0,0 @@
1
- import{jsxs as D,jsx as l}from"react/jsx-runtime";import{Box as b}from"../components/box.js";import{ScrollBar as a}from"./ScrollBar-qa1IzDDv.js";const S=({borderColor:r,borderDimColor:e,borderLeftColor:g,borderLeftDimColor:C,borderRightColor:p,borderRightDimColor:H,borderStyle:t="single",children:u,contentHeight:i,height:x,scrollBarAutoHide:h=!1,scrollBarPosition:w="right",scrollOffset:d,thumbChar:s,viewportHeight:c,...B})=>{const o=w==="left",f=o?"left":"right",m=o?g??r:p??r,n=o?C??e:H??e;return D(b,{flexDirection:"row",height:x,...B,children:[o&&l(a,{autoHide:h,color:m,contentHeight:i,dimColor:n,placement:f,scrollOffset:d,style:t,thumbChar:s,viewportHeight:c}),l(b,{borderColor:r,borderDimColor:e,borderLeft:!o,borderRight:o,borderStyle:t,flexGrow:1,overflow:"hidden",children:u}),!o&&l(a,{autoHide:h,color:m,contentHeight:i,dimColor:n,placement:f,scrollOffset:d,style:t,thumbChar:s,viewportHeight:c})]})};export{S as ScrollBarBox};
@@ -1 +0,0 @@
1
- import{jsx as Y}from"react/jsx-runtime";import{useRef as d,useState as K,useEffect as y,useCallback as g,useImperativeHandle as N}from"react";import Q from"../ink/hooks/use-scroll-input.js";import{C as U}from"./controlled-scroll-view-BVg7ywNW.js";const et=O=>{const{children:P,keyboard:A=!1,onContentHeightChange:V,onItemHeightChange:B,onScroll:T,onViewportSizeChange:b,overscan:E,ref:L,scrollAlignment:h="auto",selectedIndex:p,vimBindings:R=!1,virtualize:j,...q}=O,n=d(null),[s,D]=K(0),C=d(0);y(()=>{C.current=s},[s]);const o=g(t=>{t!==C.current&&(D(t),T?.(t))},[T]),a=d(p);a.current=p;const S=g(()=>{const t=a.current;if(t===void 0||t<0)return null;const e=n.current?.getItemPosition(t);if(!e)return null;const i=n.current?.getViewportHeight()??0,l=n.current?.getContentHeight()??0;let r=e.top+e.height-i,c=e.top;r>c&&([r,c]=[c,r]);const M=Math.max(0,l-i);return{max:Math.min(M,c),min:Math.max(0,r)}},[]),u=g(t=>{const e=n.current?.getContentHeight()??0,i=n.current?.getViewportHeight()??0,l=Math.max(0,e-i);let r=Math.max(0,Math.min(t,l));const c=S();return c&&(r=Math.max(c.min,Math.min(r,c.max))),r},[S]),m=g((t,e,i,l)=>{const r=n.current?.getItemPosition(t);if(!r)return e;const c=l??n.current?.getViewportHeight()??0,M=n.current?.getContentHeight()??0;let f=e;switch(i){case"bottom":{f=r.top+r.height-c;break}case"center":{f=r.top+r.height/2-c/2;break}case"top":{f=r.top;break}default:{const w=r.top+r.height;r.top<=e&&w>=e+c?f=e:r.top<e?f=r.top:w>e+c&&(f=w-c)}}const X=Math.max(0,M-c);return Math.max(0,Math.min(f,X))},[]);let H=s;p!==void 0&&p>=0&&(H=m(p,s,h)),y(()=>{H!==s&&o(H)},[H,s,o]);const k=g((t,e)=>{if(a.current!==void 0&&a.current>=0){const i=m(a.current,s,h,t.height);o(i)}b?.(t,e)},[b,m,s,h,o]),F=g((t,e,i)=>{const l=a.current;if(l!==void 0&&l>=0){if(t<l){const r=u(s+(e-i));o(r)}else if(t===l){const r=m(t,s,h);o(r)}}B?.(t,e,i)},[B,m,h,s,u,o]),G=g((t,e)=>{if(a.current!==void 0&&a.current>=0){const i=m(a.current,s,h);o(i)}V?.(t,e)},[V,m,s,h,o]),z=d(0),x=g(t=>{const e=C.current,i=u(e+t);o(i)},[u,o]),v=g(()=>{const t=n.current?.getContentHeight()??0,e=n.current?.getViewportHeight()??0,i=Math.max(0,t-e),l=u(i);o(l)},[u,o]),I=g(()=>{const t=u(0);o(t)},[u,o]),J=g(()=>z.current,[]);Q({getViewportHeight:J,isActive:A,scrollBy:x,scrollToBottom:v,scrollToTop:I,vimBindings:R}),N(L,()=>({getBottomOffset:()=>n.current?.getBottomOffset()??0,getContentHeight:()=>n.current?.getContentHeight()??0,getItemHeight:t=>n.current?.getItemHeight(t)??0,getItemPosition:t=>n.current?.getItemPosition(t)??null,getScrollOffset:()=>C.current,getViewportHeight:()=>n.current?.getViewportHeight()??0,remeasure:()=>n.current?.remeasure(),remeasureItem:t=>n.current?.remeasureItem(t),scrollBy:x,scrollTo:t=>{const e=u(t);o(e)},scrollToBottom:v,scrollToTop:I}),[u,o,x,v,I]);const W=g((t,e)=>{z.current=t.height,k(t,e)},[k]);return Y(U,{onContentHeightChange:G,onItemHeightChange:F,onViewportSizeChange:W,overscan:E,ref:n,scrollOffset:H,virtualize:j,...q,children:P})};export{et as ScrollList};
@@ -1 +0,0 @@
1
- import{jsxs as X,jsx as v}from"react/jsx-runtime";import{useRef as h,useState as q,useCallback as o,useImperativeHandle as _}from"react";import $ from"../ink/hooks/use-scroll-input.js";import{Box as ee}from"../components/box.js";import{f as re,C as E}from"./controlled-scroll-view-BVg7ywNW.js";import{ScrollBar as te}from"./ScrollBar-qa1IzDDv.js";const se=({children:I,debug:B=!1,followOutput:M=!1,followThreshold:T=3,keyboard:F=!1,onContentHeightChange:z,onItemHeightChange:y,onReachEnd:g,onReachStart:p,onScroll:V,onViewportSizeChange:N,overscan:O,reachThreshold:a=5,ref:W,scrollbar:Y=!1,scrollbarColor:Z,scrollbarStyle:J="line",vimBindings:K=!1,virtualize:G,...m})=>{const[d,k,n]=re(0),c=h(null),s=h(0),l=h(0),[P,L]=q(0),[x,Q]=q(0),C=h(!1),w=h(!1),i=o(()=>Math.max(0,s.current-l.current),[]),j=o(e=>{const t=i();g&&e>=t-a&&!C.current?(C.current=!0,g()):e<t-a&&(C.current=!1),p&&e<=a&&!w.current?(w.current=!0,p()):e>a&&(w.current=!1)},[g,p,a,i]),r=o(e=>{e!==n()&&(k(e),V?.(e),j(e))},[n,k,V,j]),A=o((e,t)=>{const u=n()>=i()-T;if(s.current=e,L(e),z?.(e,t),M&&u&&e>t){const f=Math.max(0,e-l.current);r(f)}else{const f=Math.max(0,e-l.current);n()>f&&r(f)}},[z,M,T,n,i,r]),D=o((e,t)=>{l.current=e.height,Q(e.height),N?.(e,t)},[N]),H=o(e=>{if(typeof e!="number"||Number.isNaN(e))return;const t=Math.max(0,s.current-l.current),u=Math.max(0,Math.min(n()+e,t));r(u)},[n,r]),R=o(e=>{if(typeof e!="number"||Number.isNaN(e))return;const t=Math.max(0,s.current-l.current),u=Math.max(0,Math.min(e,t));r(u)},[r]),b=o(()=>{const e=i();r(e)},[i,r]),S=o(()=>{r(0)},[r]),U=o(()=>l.current,[]);return $({getViewportHeight:U,isActive:F,scrollBy:H,scrollToBottom:b,scrollToTop:S,vimBindings:K}),_(W,()=>({getBottomOffset:i,getContentHeight:()=>s.current,getItemHeight:e=>c.current?.getItemHeight(e)??0,getItemPosition:e=>c.current?.getItemPosition(e)??null,getScrollOffset:n,getViewportHeight:()=>l.current,remeasure:()=>c.current?.remeasure(),remeasureItem:e=>c.current?.remeasureItem(e),scrollBy:H,scrollTo:R,scrollToBottom:b,scrollToTop:S}),[i,n,H,R,b,S]),Y&&P>x&&x>0?X(ee,{flexDirection:"row",flexGrow:m.flexGrow,flexShrink:m.flexShrink,overflow:"hidden",children:[v(E,{children:I,debug:B,onContentHeightChange:A,onItemHeightChange:y,onViewportSizeChange:D,overscan:O,ref:c,scrollOffset:d,virtualize:G,...m,flexGrow:1}),v(te,{color:Z,contentHeight:P,placement:"inset",scrollOffset:d,style:J,viewportHeight:x})]}):v(E,{children:I,debug:B,onContentHeightChange:A,onItemHeightChange:y,onViewportSizeChange:D,overscan:O,ref:c,scrollOffset:d,virtualize:G,...m})};export{se as ScrollView};
@@ -1 +0,0 @@
1
- class g{orderedIds;rootIds;map;constructor(i){this.map=new Map,this.orderedIds=[],this.rootIds=[],this.buildFromData(i)}entries(){return this.map.entries()}get(i){return this.map.get(i)}get size(){return this.map.size}getVisibleIds(i){const d=[],n=[];for(let e=this.rootIds.length-1;e>=0;e--)n.push(this.rootIds[e]);for(;n.length>0;){const e=n.pop();d.push(e);const s=this.map.get(e);if(s&&i.has(e)&&s.childrenIds.length>0)for(let t=s.childrenIds.length-1;t>=0;t--)n.push(s.childrenIds[t])}return d}isDescendantOf(i,d){let n=i;for(;n!==void 0;){const e=this.map.get(n);if(!e)return!1;if(e.parentId===d)return!0;n=e.parentId}return!1}withChildren(i,d){if(!this.map.get(i))return this;const n=s=>{const t=this.map.get(s);return s===i?{...t.node,children:d}:t.childrenIds.length>0?{...t.node,children:t.childrenIds.map(p=>n(p))}:t.node},e=this.rootIds.map(s=>n(s));return new g(e)}buildFromData(i){const d=[];for(let e=i.length-1;e>=0;e--)d.push({depth:0,node:i[e],parentId:void 0,siblingIndex:e,siblings:i});for(const e of i)this.rootIds.push(e.id);let n=0;for(;d.length>0;){const e=d.pop(),{depth:s,node:t,parentId:p,siblingIndex:o,siblings:l}=e;if(this.map.has(t.id))throw new Error(`TreeView: Duplicate node id '${t.id}' found. All node ids must be unique.`);const h=t.children??[],a=h.length>0||t.isParent===!0,u=h.map(r=>r.id),I=o>0?l[o-1].id:void 0,c=o<l.length-1?l[o+1].id:void 0,f={childrenIds:u,depth:s,flatIndex:n,hasChildren:a,nextSiblingId:c,node:t,parentId:p,previousSiblingId:I,siblingCount:l.length,siblingIndex:o};if(this.map.set(t.id,f),this.orderedIds.push(t.id),n++,a)for(let r=h.length-1;r>=0;r--)d.push({depth:s+1,node:h[r],parentId:t.id,siblingIndex:r,siblings:h})}}}export{g as TreeNodeMap};
@@ -1 +0,0 @@
1
- import{jsxs as b,jsx as a}from"react/jsx-runtime";import L from"../ink/hooks/use-is-screen-reader-enabled.js";import{Box as v}from"../components/box.js";import{Text as n}from"../components/text.js";import{theme as M}from"./treeViewTheme-Dq3ekRAC.js";import{useTreeView as y}from"./useTreeView-D5ifGwG3.js";import{useTreeViewState as j}from"./useTreeViewState-BiTJakkh.js";const V="❯",D="▾",k="▸",A="☒",P="☐",R="✔",B="⟳";function N(t,r,i,l){const{depth:c,hasChildren:m,isExpanded:o,isLoading:u,isSelected:x}=r,d=[t,`item ${i} of ${l}`];return c>0&&d.push(`depth ${c}`),m&&d.push(o?"expanded":"collapsed"),u&&d.push("loading"),x&&d.push("selected"),d.join(", ")}function F(t,r){const i={};return t.hasChildren&&(i.expanded=t.isExpanded),r!=="none"&&(i.selected=t.isSelected),Object.keys(i).length>0?i:void 0}function O({isScreenReaderEnabled:t,node:r,nodeState:i,selectionMode:l,siblingCount:c,siblingPosition:m,styles:o}){const{depth:u,hasChildren:x,isExpanded:d,isFocused:h,isLoading:s,isSelected:C}=i;let e=" ";s?e=B:x&&(e=d?D:k);const f=t?N(r.label,i,m,c):void 0;return b(v,{...o.node({isFocused:h}),"aria-role":"listitem","aria-state":F(i,l),children:[f&&a(n,{"aria-label":f}),h&&a(n,{...o.focusIndicator(),"aria-hidden":!0,children:V}),u>0&&a(v,{...o.indent({depth:u}),"aria-hidden":!0}),l==="multiple"&&a(n,{...o.selectedIndicator(),"aria-hidden":!0,children:C?A:P}),a(n,{...s?o.loadingIndicator():o.expandIndicator({isExpanded:d}),"aria-hidden":!0,children:e}),a(n,{...o.label({isFocused:h,isSelected:C}),children:r.label}),l==="single"&&C&&b(n,{...o.selectedIndicator(),"aria-hidden":!0,children:[" ",R]})]})}function Q({ariaLabel:t="Tree view",data:r,defaultExpanded:i,defaultSelected:l,isDisabled:c=!1,loadChildren:m,onExpandChange:o,onFocusChange:u,onLoadError:x,onSelectChange:d,renderNode:h,selectionMode:s="none",visibleNodeCount:C}){const e=j({data:r,defaultExpanded:i,defaultSelected:l,onExpandChange:o,onFocusChange:u,onSelectChange:d,selectionMode:s,visibleNodeCount:C});y({isDisabled:c,loadChildren:m,onLoadError:x,selectionMode:s,state:e});const{styles:f}=M,w=L();return b(v,{...f.container(),"aria-role":"list",children:[w&&a(n,{"aria-label":t}),e.hasScrollUp&&b(n,{"aria-label":`${e.viewportFromIndex} more items above`,dimColor:!0,children:[" ","↑",e.viewportFromIndex," ","more above"]}),e.viewportNodes.map(({node:p,state:g})=>{const S=e.nodeMap.get(p.id),E=S?S.siblingIndex+1:1,I=S?S.siblingCount:1;if(h){const T=w?N(p.label,g,E,I):void 0;return b(v,{"aria-role":"listitem","aria-state":F(g,s),children:[T&&a(n,{"aria-label":T}),h({node:p,state:g})]},p.id)}return a(O,{isScreenReaderEnabled:w,node:p,nodeState:g,selectionMode:s,siblingCount:I,siblingPosition:E,styles:f},p.id)}),e.hasScrollDown&&b(n,{"aria-label":`${e.visibleCount-e.viewportToIndex} more items below`,dimColor:!0,children:[" ","↓",e.visibleCount-e.viewportToIndex," ","more below"]})]})}export{Q as TreeView};
@@ -1 +0,0 @@
1
- import{createDecMode as h,setMode as n,resetMode as u}from"@visulima/ansi";import{EventEmitter as f}from"tseep";import{Renderer as i,TerminalGuard as o}from"./Renderer-DsskdkUd.js";const s=h(2026),d=n(s),w=u(s);class B extends f{renderer;terminal=null;backBuffer;width;height;isRunning=!1;stdoutBuffer=[];stderrBuffer=[];constructor(){super(),this.width=process.stdout.columns||80,this.height=process.stdout.rows||24,this.renderer=new i(this.width,this.height),this.backBuffer=new Uint32Array(this.width*this.height*2)}start(){this.isRunning||(this.terminal=new o(!0),this.isRunning=!0)}quit(){this.emit("quit")}stop(){this.isRunning=!1,this.terminal?.leave(),this.terminal=null,this.stdoutBuffer.length>0&&(process.stdout.write(this.stdoutBuffer.join("")),this.stdoutBuffer=[]),this.stderrBuffer.length>0&&(process.stderr.write(this.stderrBuffer.join("")),this.stderrBuffer=[])}writeStdout(t){this.isRunning?this.stdoutBuffer.push(t):process.stdout.write(t)}writeStderr(t){this.isRunning?this.stderrBuffer.push(t):process.stderr.write(t)}getBuffer(){return this.backBuffer}getSize(){return{height:this.height,width:this.width}}resize(t,e){this.width=t,this.height=e,this.renderer=new i(t,e),this.backBuffer=new Uint32Array(t*e*2)}beforeFlushListeners=[];onBeforeFlush(t){return this.beforeFlushListeners.push(t),()=>{this.beforeFlushListeners=this.beforeFlushListeners.filter(e=>e!==t)}}paintNow(t,e){if(this.isRunning){t(this.width,this.height),e(this.backBuffer,this.width,this.height);for(const r of this.beforeFlushListeners)r(this.backBuffer,this.width,this.height);this.renderer.writeRaw(d);try{this.renderer.render(this.backBuffer)}finally{this.renderer.writeRaw(w)}}}}export{B as TuiApp};
@@ -1 +0,0 @@
1
- import{createContext as t}from"react";const e=t({exit(){},async waitUntilRenderFlush(){}});e.displayName="InternalAppContext";export{e as t};
@@ -1,39 +0,0 @@
1
- type CanvasColor = number | string | undefined;
2
- type CellStyle = {
3
- readonly background?: CanvasColor;
4
- readonly bold?: boolean;
5
- readonly color?: CanvasColor;
6
- readonly dim?: boolean;
7
- };
8
- type CanvasContext = {
9
- /**
10
- * Clear every cell back to space + default style.
11
- */
12
- readonly clear: () => void;
13
- /**
14
- * Draw a horizontal bar using fractional block glyphs (▏▎▍▌▋▊▉█).
15
- * `fillRatio` in [0, 1] determines the filled portion.
16
- */
17
- readonly drawHBar: (x: number, y: number, w: number, fillRatio: number, style?: CellStyle) => void;
18
- /**
19
- * Draw a filled rectangle using a single character.
20
- */
21
- readonly drawRect: (x: number, y: number, w: number, h: number, char: number | string, style?: CellStyle) => void;
22
- /**
23
- * Render a string left-to-right starting at (x, y). Non-printable or
24
- * multi-byte codepoints are preserved but advance the cursor by 1 cell.
25
- */
26
- readonly drawText: (x: number, y: number, text: string, style?: CellStyle) => void;
27
- /**
28
- * Draw a vertical bar using fractional block glyphs (▁▂▃▄▅▆▇█).
29
- * `fillRatio` in [0, 1] determines the filled portion.
30
- */
31
- readonly drawVBar: (x: number, y: number, h: number, fillRatio: number, style?: CellStyle) => void;
32
- readonly height: number;
33
- /**
34
- * Set a single cell at (x, y). Out-of-bounds writes are silently ignored.
35
- */
36
- readonly setCell: (x: number, y: number, char: number | string, style?: CellStyle) => void;
37
- readonly width: number;
38
- };
39
- export { CanvasContext as C, CanvasColor as a, CellStyle as b };
@@ -1,23 +0,0 @@
1
- import { Writable } from 'node:stream';
2
- /**
3
- * Clipboard targets as defined by the OSC 52 spec.
4
- * - `c` — system clipboard
5
- * - `p` — primary selection (X11 only)
6
- * - `s` — secondary selection (X11 only)
7
- */
8
- type ClipboardTarget = "c" | "p" | "s";
9
- /**
10
- * Check whether the current terminal likely supports OSC 52.
11
- *
12
- * Detection is best-effort based on `TERM_PROGRAM` and other env vars.
13
- * Returns `true` for known-supported terminals, `false` otherwise.
14
- */
15
- declare const isOsc52Supported: () => boolean;
16
- declare const writeOsc52: (stream: Writable, text: string, target?: ClipboardTarget) => void;
17
- /**
18
- * Clear the clipboard via OSC 52.
19
- * @param stream The writable stream to write the escape sequence to.
20
- * @param target The clipboard target. Defaults to `"c"`.
21
- */
22
- declare const clearOsc52: (stream: Writable, target?: ClipboardTarget) => void;
23
- export { ClipboardTarget as C, clearOsc52 as c, isOsc52Supported as i, writeOsc52 as w };
@@ -1,50 +0,0 @@
1
- /**
2
- * Color matrix transforms for color blindness simulation and compensation.
3
- *
4
- * Matrices sourced from research by Brettel, Viénot, and Mollon (1997)
5
- * and Machado, Oliveira, and Fernandes (2009).
6
- * @see https://www.inf.ufrgs.br/~oliveira/pubs_files/CVD_Simulation/CVD_Simulation.html
7
- */
8
- /**
9
- * 3x3 color transformation matrix operating on linear RGB values (0-255).
10
- */
11
- type ColorMatrix = readonly [readonly [number, number, number], readonly [number, number, number], readonly [number, number, number]];
12
- type ColorBlindnessType = "achromatopsia" | "deuteranopia" | "protanopia" | "tritanopia";
13
- /**
14
- * Simulation matrices — show how colors appear to users with color vision deficiency.
15
- */
16
- declare const COLOR_BLINDNESS_SIMULATION: Record<ColorBlindnessType, ColorMatrix>;
17
- /**
18
- * Compensation matrices — shift colors into a distinguishable range for affected users.
19
- * These remap problematic colors to alternatives the user can perceive.
20
- */
21
- /**
22
- * Compensation matrices — enhance distinguishability for affected users
23
- * by redistributing the lost channel's energy into perceivable channels.
24
- * Based on Daltonization approach (Fidaner et al., 2005).
25
- */
26
- declare const COLOR_BLINDNESS_COMPENSATION: Record<Exclude<ColorBlindnessType, "achromatopsia">, ColorMatrix>;
27
- /**
28
- * Identity matrix (no transformation).
29
- */
30
- declare const IDENTITY_MATRIX: ColorMatrix;
31
- /**
32
- * Apply a 3x3 color matrix to an RGB triplet.
33
- * @param r Red channel (0-255)
34
- * @param g Green channel (0-255)
35
- * @param b Blue channel (0-255)
36
- * @param matrix The 3x3 transformation matrix
37
- * @returns Transformed [r, g, b] triplet, clamped to 0-255
38
- */
39
- declare const applyColorMatrix: (r: number, g: number, b: number, matrix: ColorMatrix) => [number, number, number];
40
- declare const hexToRgb: (hex: string) => [number, number, number] | null;
41
- /**
42
- * Convert RGB components to a hex color string.
43
- */
44
- declare const rgbToHex: (r: number, g: number, b: number) => string;
45
- /**
46
- * Transform a hex color through a color blindness simulation or compensation matrix.
47
- * Returns the original color if parsing fails.
48
- */
49
- declare const transformHexColor: (hex: string, matrix: ColorMatrix) => string;
50
- export { ColorBlindnessType as C, IDENTITY_MATRIX as I, ColorMatrix as a, COLOR_BLINDNESS_COMPENSATION as b, COLOR_BLINDNESS_SIMULATION as c, applyColorMatrix as d, hexToRgb as h, rgbToHex as r, transformHexColor as t };