@visulima/tui 1.0.7 → 2.0.0

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 (279) 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 +3 -4
  6. package/dist/components/canvas.d.ts +2 -2
  7. package/dist/components/canvas.js +1 -1
  8. package/dist/components/cursor.d.ts +3 -4
  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 +8 -0
  12. package/dist/components/error-overview.js +1 -0
  13. package/dist/components/static-render.d.ts +3 -4
  14. package/dist/components/static.d.ts +1 -2
  15. package/dist/components/text.d.ts +1 -2
  16. package/dist/core/index.d.ts +1 -2
  17. package/dist/core/index.js +1 -1
  18. package/dist/ink/canvas/index.d.ts +24 -0
  19. package/dist/ink/canvas/index.js +1 -0
  20. package/dist/ink/hooks/use-app.d.ts +1 -32
  21. package/dist/ink/hooks/use-app.js +1 -1
  22. package/dist/ink/hooks/use-box-metrics.d.ts +3 -4
  23. package/dist/ink/hooks/use-cursor.d.ts +1 -1
  24. package/dist/ink/hooks/use-input.js +2 -2
  25. package/dist/ink/hooks/use-paste.js +1 -1
  26. package/dist/ink/hooks/use-persistent-state.js +2 -2
  27. package/dist/ink/hooks/use-text-selection.d.ts +4 -5
  28. package/dist/ink/hooks/use-window-size.js +1 -1
  29. package/dist/ink/index.d.ts +7 -7
  30. package/dist/ink/index.js +1 -1
  31. package/dist/ink/mouse/use-element-position.d.ts +3 -4
  32. package/dist/ink/mouse/use-on-mouse-click.d.ts +3 -4
  33. package/dist/ink/mouse/use-on-mouse-hover.d.ts +3 -4
  34. package/dist/ink/mouse/use-on-mouse-state.d.ts +3 -4
  35. package/dist/ink/public/cursor.d.ts +47 -0
  36. package/dist/ink/public/cursor.js +1 -0
  37. package/dist/ink/public/dom.d.ts +6 -0
  38. package/dist/ink/public/dom.js +0 -0
  39. package/dist/ink/public/highlighter.d.ts +54 -0
  40. package/dist/ink/public/highlighter.js +1 -0
  41. package/dist/ink/public/input.d.ts +14 -0
  42. package/dist/ink/public/input.js +1 -0
  43. package/dist/ink/public/styles.d.ts +4 -0
  44. package/dist/ink/public/styles.js +0 -0
  45. package/dist/ink/public/utils.d.ts +5 -0
  46. package/dist/ink/public/utils.js +1 -0
  47. package/dist/packem_chunks/devtools.js +1 -1
  48. package/dist/packem_shared/{DevTools-k6uiVzqv.js → DevTools-D9tfChBc.js} +1 -1
  49. package/dist/packem_shared/InputParser-CiBitCva.js +2 -0
  50. package/dist/packem_shared/TuiApp-DjIgv5Sk.js +1 -0
  51. package/dist/packem_shared/app-context-DTm1_XBA.js +1 -0
  52. package/dist/packem_shared/app-context.d-CG88lgkg.d.ts +56 -0
  53. package/dist/packem_shared/boxes-DyY_LXCi.js +1 -0
  54. package/dist/packem_shared/{buffer.d-EJkZr8uH.d.ts → buffer.d-j_dP5JyC.d.ts} +29 -1
  55. package/dist/packem_shared/buildCursorOnlySequence-CerkmjWt.js +1 -0
  56. package/dist/packem_shared/{braille-ch3O5D7I.js → createBrailleGrid-BTOQrujS.js} +1 -1
  57. package/dist/packem_shared/createCanvasBuffer-CL6sAM-A.js +1 -0
  58. package/dist/packem_shared/disposeHighlighter-D9OkrhwX.js +1 -0
  59. package/dist/packem_shared/{dom.d-B4kXbaVY.d.ts → dom.d-g-nsYquD.d.ts} +3 -4
  60. package/dist/packem_shared/formatDuration-Bdx4ZgRh.js +1 -0
  61. package/dist/packem_shared/index-Dl9I2_QH.js +75 -0
  62. package/dist/packem_shared/input.d-D-Yxqha8.d.ts +172 -0
  63. package/dist/packem_shared/{input-utils-BSWCb4F_.js → isControlCharacter-uDgBe_32.js} +1 -1
  64. package/dist/packem_shared/{reconciler-CFyBVf7l.js → reconciler-DhUGYWCr.js} +1 -1
  65. package/dist/packem_shared/render-D7aV_hO1.js +24 -0
  66. package/dist/packem_shared/{render-DFZ8NHlG.js → render-DMcWfI6-.js} +1 -1
  67. package/dist/packem_shared/{render.d-CBnYBDk2.d.ts → render.d-BvfwvSCx.d.ts} +20 -2
  68. package/dist/packem_shared/{renderToString-L_bpw4OQ.js → renderToString-DkTmJPaS.js} +1 -1
  69. package/dist/packem_shared/{renderToString-DwXFY8Qh.js → renderToString-DqLFFPvO.js} +1 -1
  70. package/dist/packem_shared/renderToken-DjiQ6dfv.js +1 -0
  71. package/dist/packem_shared/renderTreeToBuffer-BpSD0sBJ.js +2 -0
  72. package/dist/packem_shared/{renderer-k-xShm1P.js → renderer-Cs0KEr1o.js} +4 -4
  73. package/dist/packem_shared/{selection.d-CI3_p8wg.d.ts → selection.d-KWphH--_.d.ts} +1 -1
  74. package/dist/packem_shared/{styles.d-cMo36xQz.d.ts → styles.d-D7iZuNC-.d.ts} +97 -1
  75. package/dist/packem_shared/utils-C8l_3Dzw.js +1 -0
  76. package/dist/react/index.d.ts +1 -2
  77. package/dist/react/index.js +1 -1
  78. package/dist/testing/index.d.ts +5 -5
  79. package/dist/testing/index.js +1 -1
  80. package/index.js +26 -26
  81. package/package.json +49 -384
  82. package/dist/components/accordion.d.ts +0 -59
  83. package/dist/components/accordion.js +0 -1
  84. package/dist/components/alert.d.ts +0 -26
  85. package/dist/components/alert.js +0 -1
  86. package/dist/components/animate-presence.d.ts +0 -18
  87. package/dist/components/animate-presence.js +0 -1
  88. package/dist/components/approval-prompt.d.ts +0 -65
  89. package/dist/components/approval-prompt.js +0 -1
  90. package/dist/components/area-chart.d.ts +0 -66
  91. package/dist/components/area-chart.js +0 -1
  92. package/dist/components/badge.d.ts +0 -22
  93. package/dist/components/badge.js +0 -1
  94. package/dist/components/bar-chart.d.ts +0 -67
  95. package/dist/components/bar-chart.js +0 -1
  96. package/dist/components/big-text.d.ts +0 -81
  97. package/dist/components/big-text.js +0 -1
  98. package/dist/components/blink-dot.d.ts +0 -36
  99. package/dist/components/blink-dot.js +0 -1
  100. package/dist/components/breadcrumb.d.ts +0 -33
  101. package/dist/components/breadcrumb.js +0 -1
  102. package/dist/components/button.d.ts +0 -45
  103. package/dist/components/button.js +0 -1
  104. package/dist/components/calendar.d.ts +0 -72
  105. package/dist/components/calendar.js +0 -1
  106. package/dist/components/card.d.ts +0 -57
  107. package/dist/components/card.js +0 -1
  108. package/dist/components/checkbox.d.ts +0 -48
  109. package/dist/components/checkbox.js +0 -1
  110. package/dist/components/code.d.ts +0 -48
  111. package/dist/components/code.js +0 -2
  112. package/dist/components/collapsible.d.ts +0 -53
  113. package/dist/components/collapsible.js +0 -1
  114. package/dist/components/command-block.d.ts +0 -47
  115. package/dist/components/command-block.js +0 -4
  116. package/dist/components/command-palette.d.ts +0 -82
  117. package/dist/components/command-palette.js +0 -1
  118. package/dist/components/confirm-dialog.d.ts +0 -75
  119. package/dist/components/confirm-dialog.js +0 -1
  120. package/dist/components/confirm-input.d.ts +0 -38
  121. package/dist/components/confirm-input.js +0 -1
  122. package/dist/components/console-overlay.d.ts +0 -54
  123. package/dist/components/console-overlay.js +0 -1
  124. package/dist/components/content-switcher.d.ts +0 -57
  125. package/dist/components/content-switcher.js +0 -1
  126. package/dist/components/controlled-scroll-view.d.ts +0 -61
  127. package/dist/components/controlled-scroll-view.js +0 -1
  128. package/dist/components/date-picker.d.ts +0 -65
  129. package/dist/components/date-picker.js +0 -1
  130. package/dist/components/definition-list.d.ts +0 -44
  131. package/dist/components/definition-list.js +0 -1
  132. package/dist/components/dialog.d.ts +0 -117
  133. package/dist/components/dialog.js +0 -1
  134. package/dist/components/diff-view.d.ts +0 -85
  135. package/dist/components/diff-view.js +0 -1
  136. package/dist/components/divider.d.ts +0 -49
  137. package/dist/components/divider.js +0 -1
  138. package/dist/components/file-picker-entry.d.ts +0 -104
  139. package/dist/components/file-picker-entry.js +0 -1
  140. package/dist/components/form.d.ts +0 -81
  141. package/dist/components/form.js +0 -1
  142. package/dist/components/gauge.d.ts +0 -87
  143. package/dist/components/gauge.js +0 -1
  144. package/dist/components/gradient.d.ts +0 -42
  145. package/dist/components/gradient.js +0 -1
  146. package/dist/components/heading.d.ts +0 -33
  147. package/dist/components/heading.js +0 -1
  148. package/dist/components/heatmap.d.ts +0 -62
  149. package/dist/components/heatmap.js +0 -1
  150. package/dist/components/help.d.ts +0 -52
  151. package/dist/components/help.js +0 -1
  152. package/dist/components/histogram.d.ts +0 -62
  153. package/dist/components/histogram.js +0 -1
  154. package/dist/components/kbd.d.ts +0 -31
  155. package/dist/components/kbd.js +0 -1
  156. package/dist/components/line-chart.d.ts +0 -109
  157. package/dist/components/line-chart.js +0 -1
  158. package/dist/components/link.d.ts +0 -38
  159. package/dist/components/link.js +0 -1
  160. package/dist/components/loading-indicator.d.ts +0 -29
  161. package/dist/components/loading-indicator.js +0 -1
  162. package/dist/components/markdown.d.ts +0 -40
  163. package/dist/components/markdown.js +0 -1
  164. package/dist/components/masked-input.d.ts +0 -50
  165. package/dist/components/masked-input.js +0 -1
  166. package/dist/components/menu.d.ts +0 -78
  167. package/dist/components/menu.js +0 -1
  168. package/dist/components/message-bubble.d.ts +0 -43
  169. package/dist/components/message-bubble.js +0 -1
  170. package/dist/components/model-badge.d.ts +0 -39
  171. package/dist/components/model-badge.js +0 -1
  172. package/dist/components/multi-select.d.ts +0 -65
  173. package/dist/components/multi-select.js +0 -1
  174. package/dist/components/operation-tree.d.ts +0 -49
  175. package/dist/components/operation-tree.js +0 -1
  176. package/dist/components/option-list.d.ts +0 -47
  177. package/dist/components/option-list.js +0 -1
  178. package/dist/components/ordered-list.d.ts +0 -24
  179. package/dist/components/ordered-list.js +0 -1
  180. package/dist/components/paginator.d.ts +0 -69
  181. package/dist/components/paginator.js +0 -1
  182. package/dist/components/paragraph.d.ts +0 -38
  183. package/dist/components/paragraph.js +0 -1
  184. package/dist/components/placeholder.d.ts +0 -55
  185. package/dist/components/placeholder.js +0 -1
  186. package/dist/components/progress-bar.d.ts +0 -56
  187. package/dist/components/progress-bar.js +0 -1
  188. package/dist/components/radio-group.d.ts +0 -74
  189. package/dist/components/radio-group.js +0 -1
  190. package/dist/components/scatter-plot.d.ts +0 -35
  191. package/dist/components/scatter-plot.js +0 -1
  192. package/dist/components/scroll-bar-box.d.ts +0 -37
  193. package/dist/components/scroll-bar-box.js +0 -1
  194. package/dist/components/scroll-bar.d.ts +0 -25
  195. package/dist/components/scroll-bar.js +0 -1
  196. package/dist/components/scroll-list.d.ts +0 -20
  197. package/dist/components/scroll-list.js +0 -1
  198. package/dist/components/scroll-view.d.ts +0 -10
  199. package/dist/components/scroll-view.js +0 -1
  200. package/dist/components/search-input.d.ts +0 -55
  201. package/dist/components/search-input.js +0 -1
  202. package/dist/components/select-input-indicator.d.ts +0 -32
  203. package/dist/components/select-input-indicator.js +0 -1
  204. package/dist/components/select-input-item.d.ts +0 -41
  205. package/dist/components/select-input-item.js +0 -1
  206. package/dist/components/select-input.d.ts +0 -110
  207. package/dist/components/select-input.js +0 -1
  208. package/dist/components/shimmer-text.d.ts +0 -47
  209. package/dist/components/shimmer-text.js +0 -1
  210. package/dist/components/slider.d.ts +0 -103
  211. package/dist/components/slider.js +0 -1
  212. package/dist/components/sparkline.d.ts +0 -35
  213. package/dist/components/sparkline.js +0 -1
  214. package/dist/components/spinner.d.ts +0 -17
  215. package/dist/components/spinner.js +0 -1
  216. package/dist/components/status-line.d.ts +0 -37
  217. package/dist/components/status-line.js +0 -1
  218. package/dist/components/status-message.d.ts +0 -21
  219. package/dist/components/status-message.js +0 -1
  220. package/dist/components/stepper.d.ts +0 -48
  221. package/dist/components/stepper.js +0 -1
  222. package/dist/components/stopwatch.d.ts +0 -49
  223. package/dist/components/stopwatch.js +0 -1
  224. package/dist/components/streaming-text.d.ts +0 -46
  225. package/dist/components/streaming-text.js +0 -1
  226. package/dist/components/switch.d.ts +0 -55
  227. package/dist/components/switch.js +0 -1
  228. package/dist/components/tab.d.ts +0 -19
  229. package/dist/components/tab.js +0 -1
  230. package/dist/components/table.d.ts +0 -119
  231. package/dist/components/table.js +0 -1
  232. package/dist/components/tabs.d.ts +0 -107
  233. package/dist/components/tabs.js +0 -1
  234. package/dist/components/tag.d.ts +0 -35
  235. package/dist/components/tag.js +0 -1
  236. package/dist/components/text-input.d.ts +0 -48
  237. package/dist/components/text-input.js +0 -1
  238. package/dist/components/textarea.d.ts +0 -68
  239. package/dist/components/textarea.js +0 -2
  240. package/dist/components/timer.d.ts +0 -59
  241. package/dist/components/timer.js +0 -1
  242. package/dist/components/toast.d.ts +0 -49
  243. package/dist/components/toast.js +0 -1
  244. package/dist/components/tooltip.d.ts +0 -43
  245. package/dist/components/tooltip.js +0 -1
  246. package/dist/components/transition.d.ts +0 -74
  247. package/dist/components/transition.js +0 -1
  248. package/dist/components/tree-view-entry.d.ts +0 -357
  249. package/dist/components/tree-view-entry.js +0 -1
  250. package/dist/components/unordered-list.d.ts +0 -30
  251. package/dist/components/unordered-list.js +0 -1
  252. package/dist/ink/hooks/use-linked-scroll.d.ts +0 -49
  253. package/dist/ink/hooks/use-linked-scroll.js +0 -1
  254. package/dist/packem_shared/ControlledScrollView-Cn4byU2n.js +0 -1
  255. package/dist/packem_shared/FilePicker-BLS9nOPz.js +0 -1
  256. package/dist/packem_shared/InputParser-CtwkCbrQ.js +0 -2
  257. package/dist/packem_shared/ScrollBar-qa1IzDDv.js +0 -1
  258. package/dist/packem_shared/ScrollBarBox-DchESZWv.js +0 -1
  259. package/dist/packem_shared/ScrollList-BBAnRsrC.js +0 -1
  260. package/dist/packem_shared/ScrollView-CHAo7Epj.js +0 -1
  261. package/dist/packem_shared/TreeNodeMap-cJlYqckB.js +0 -1
  262. package/dist/packem_shared/TreeView-BsvLCsf0.js +0 -1
  263. package/dist/packem_shared/TuiApp-BPL8v1i1.js +0 -1
  264. package/dist/packem_shared/app-context-BVpKlG1z.js +0 -1
  265. package/dist/packem_shared/controlled-scroll-view-BVg7ywNW.js +0 -1
  266. package/dist/packem_shared/cursor-helpers.d-BONB9tky.d.ts +0 -12
  267. package/dist/packem_shared/format-time-fjoQHMxD.js +0 -1
  268. package/dist/packem_shared/input.d-CgxV2e8U.d.ts +0 -90
  269. package/dist/packem_shared/line-chart-C7CUrvVs.js +0 -1
  270. package/dist/packem_shared/render-CuQecTAs.js +0 -24
  271. package/dist/packem_shared/renderTreeToBuffer-C8lS0lJ2.js +0 -2
  272. package/dist/packem_shared/scroll-view.d-DtpsgHLg.d.ts +0 -119
  273. package/dist/packem_shared/token-to-elements-D6J6-P2A.js +0 -1
  274. package/dist/packem_shared/treeViewTheme-Dq3ekRAC.js +0 -1
  275. package/dist/packem_shared/useTreeView-D5ifGwG3.js +0 -1
  276. package/dist/packem_shared/useTreeViewState-BiTJakkh.js +0 -1
  277. package/dist/packem_shared/utils-Bup8lyK8.js +0 -1
  278. package/dist/packem_shared/variant-config-BJqpNo7H.js +0 -1
  279. package/dist/packem_shared/variant-config.d-D5NnrrQK.d.ts +0 -2
@@ -1,35 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- type Props = {
5
- /**
6
- * Color applied to the chart glyphs.
7
- */
8
- readonly color?: LiteralUnion<AnsiColors, string>;
9
- /**
10
- * Data points to plot. Values may be any real numbers.
11
- */
12
- readonly data: ReadonlyArray<number>;
13
- /**
14
- * Optional fixed maximum for the vertical scale.
15
- * When omitted the maximum data value is used.
16
- */
17
- readonly max?: number;
18
- /**
19
- * Optional fixed minimum for the vertical scale.
20
- * When omitted the minimum data value is used.
21
- */
22
- readonly min?: number;
23
- };
24
- /**
25
- * Inline bar chart using Unicode block glyphs.
26
- * @returns A `ReactElement` containing the glyph string, or `null` when
27
- * `data` is empty.
28
- */
29
- declare function Sparkline({
30
- color,
31
- data,
32
- max,
33
- min
34
- }: Props): ReactElement | null;
35
- export { Props, Sparkline, type Props as SparklineProps, Sparkline as default };
@@ -1 +0,0 @@
1
- import{jsx as f}from"react/jsx-runtime";import{useMemo as s}from"react";import{Text as c}from"./text.js";const e="▁▂▃▄▅▆▇█",I=(m,t,o)=>{if(o===0)return e[0];const r=(m-t)/o,n=Math.max(0,Math.min(e.length-1,Math.floor(r*e.length)));return e[n]},h=(m,t,o)=>{let r=t??Number.POSITIVE_INFINITY,n=o??Number.NEGATIVE_INFINITY;if(t===void 0||o===void 0)for(const i of m)t===void 0&&i<r&&(r=i),o===void 0&&i>n&&(n=i);return{max:n,min:r}};function p({color:m,data:t,max:o,min:r}){const n=s(()=>{if(t.length===0)return"";const{max:i,min:a}=h(t,r,o),l=i-a;return t.map(u=>I(u,a,l)).join("")},[t,r,o]);return n.length===0?null:f(c,{color:m,children:n})}export{p as Sparkline,p as default};
@@ -1,17 +0,0 @@
1
- import { SpinnerName } from '@visulima/spinner';
2
- import { ReactElement } from 'react';
3
- type Props = {
4
- /**
5
- * Type of a spinner.
6
- * Accepts any preset from `@visulima/spinner` (cli-spinners + custom frame sets).
7
- * @default "dots"
8
- */
9
- readonly type?: SpinnerName;
10
- };
11
- /**
12
- * Spinner component that renders an animated loading indicator.
13
- */
14
- declare function Spinner({
15
- type
16
- }: Props): ReactElement;
17
- export { Props, Spinner, type Props as SpinnerProps, Spinner as default };
@@ -1 +0,0 @@
1
- import{jsx as i}from"react/jsx-runtime";import{getSpinner as e}from"@visulima/spinner";import m from"../ink/hooks/use-animation.js";import{Text as p}from"./text.js";function d({type:n="dots"}){const r=e(n)??e("dots"),t=r?.frames??[" "],{frame:o}=m({interval:r?.interval??80});return i(p,{children:t[o%t.length]})}export{d as Spinner,d as default};
@@ -1,37 +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
- * Background color spanning the whole row.
7
- */
8
- readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
9
- /**
10
- * Content rendered in the center. Optional.
11
- */
12
- readonly center?: ReactNode;
13
- /**
14
- * Default foreground for text rendered inside the row.
15
- */
16
- readonly color?: LiteralUnion<AnsiColors, string>;
17
- /**
18
- * Content rendered flush-left.
19
- */
20
- readonly left?: ReactNode;
21
- /**
22
- * Content rendered flush-right.
23
- */
24
- readonly right?: ReactNode;
25
- };
26
- /**
27
- * Full-width status bar with left / center / right slots. Typically pinned to
28
- * the bottom of the UI.
29
- */
30
- declare function StatusLine({
31
- backgroundColor,
32
- center,
33
- color,
34
- left,
35
- right
36
- }: Props): ReactElement;
37
- export { Props, StatusLine, type Props as StatusLineProps, StatusLine as default };
@@ -1 +0,0 @@
1
- import{jsxs as l,jsx as t}from"react/jsx-runtime";import{Box as i}from"./box.js";import{Text as c}from"./text.js";const e=(r,o)=>{if(r!==void 0)return typeof r=="string"||typeof r=="number"?t(c,{color:o,children:r}):r};function u({backgroundColor:r,center:o,color:n,left:d,right:f}){return l(i,{backgroundColor:r,paddingX:1,width:"100%",children:[t(i,{flexGrow:1,flexShrink:1,minWidth:0,children:e(d,n)}),o===void 0?void 0:t(i,{flexGrow:0,flexShrink:0,justifyContent:"center",children:e(o,n)}),t(i,{flexGrow:1,flexShrink:1,justifyContent:"flex-end",minWidth:0,children:e(f,n)})]})}export{u as StatusLine,u as default};
@@ -1,21 +0,0 @@
1
- import { ReactNode, ReactElement } from 'react';
2
- import { V as Variant } from "../packem_shared/variant-config.d-D5NnrrQK.js";
3
- type StatusMessageVariant = Variant;
4
- type Props = {
5
- /**
6
- * Message content.
7
- */
8
- readonly children: ReactNode;
9
- /**
10
- * Determines the icon and color of the status message.
11
- */
12
- readonly variant: StatusMessageVariant;
13
- };
14
- /**
15
- * Renders a status notification with a colored icon and message text.
16
- */
17
- declare function StatusMessage({
18
- children,
19
- variant
20
- }: Props): ReactElement;
21
- export { Props, StatusMessage, type Props as StatusMessageProps, StatusMessageVariant, StatusMessage as default };
@@ -1 +0,0 @@
1
- import{jsxs as n,jsx as o}from"react/jsx-runtime";import{Box as e}from"./box.js";import{Text as r}from"./text.js";import{o as c}from"../packem_shared/variant-config-BJqpNo7H.js";function d({children:s,variant:t}){const{color:a,icon:i}=c[t];return n(e,{gap:1,children:[o(r,{color:a,children:i}),o(r,{children:s})]})}export{d as StatusMessage,d as default};
@@ -1,48 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- type StepStatus = "active" | "completed" | "error" | "pending";
5
- type StepperStep = {
6
- readonly description?: string;
7
- readonly key?: string;
8
- readonly label: ReactNode;
9
- readonly status?: StepStatus;
10
- };
11
- type Props = {
12
- /**
13
- * Color used for active and completed steps.
14
- * @default "blue"
15
- */
16
- readonly accentColor?: LiteralUnion<AnsiColors, string>;
17
- /**
18
- * Index of the current step (used when steps do not provide a status).
19
- * @default 0
20
- */
21
- readonly activeIndex?: number;
22
- /**
23
- * Color used for errors.
24
- * @default "red"
25
- */
26
- readonly errorColor?: LiteralUnion<AnsiColors, string>;
27
- /**
28
- * Orientation of the stepper.
29
- * @default "horizontal"
30
- */
31
- readonly orientation?: "horizontal" | "vertical";
32
- /**
33
- * List of steps.
34
- */
35
- readonly steps: ReadonlyArray<StepperStep>;
36
- };
37
- /**
38
- * Step indicator for multi-stage flows.
39
- * @returns A `ReactElement` rendering the steps horizontally or vertically.
40
- */
41
- declare function Stepper({
42
- accentColor,
43
- activeIndex,
44
- errorColor,
45
- orientation,
46
- steps
47
- }: Props): ReactElement;
48
- export { Props, StepStatus, Stepper, type Props as StepperProps, StepperStep, Stepper as default };
@@ -1 +0,0 @@
1
- import{jsx as i,jsxs as d}from"react/jsx-runtime";import{Fragment as v}from"react";import{Box as n}from"./box.js";import{Text as l}from"./text.js";const h={active:"●",completed:"✔",error:"✖",pending:"○"},u=(t,c,m)=>t.status!==void 0?t.status:c<m?"completed":c===m?"active":"pending";function k({accentColor:t="blue",activeIndex:c=0,errorColor:m="red",orientation:g="horizontal",steps:a}){return g==="vertical"?i(n,{flexDirection:"column",children:a.map((r,o)=>{const e=u(r,o,c),p=o===a.length-1,s=e==="error"?m:e==="pending"?void 0:t;return d(n,{flexDirection:"column",children:[d(n,{children:[d(l,{color:s,dimColor:e==="pending",children:[h[e]," "]}),i(l,{bold:e==="active",color:s,dimColor:e==="pending",children:r.label})]}),r.description===void 0?void 0:i(n,{marginLeft:2,children:i(l,{dimColor:!0,children:r.description})}),p?void 0:i(n,{marginLeft:0,children:i(l,{dimColor:!0,children:"│"})})]},r.key??o)})}):i(n,{children:a.map((r,o)=>{const e=u(r,o,c),p=e==="error"?m:e==="pending"?void 0:t,s=o===a.length-1;return d(v,{children:[d(n,{children:[d(l,{color:p,dimColor:e==="pending",children:[h[e]," "]}),i(l,{bold:e==="active",color:p,dimColor:e==="pending",children:r.label})]}),s?void 0:i(l,{dimColor:!0,children:" ── "})]},r.key??o)})})}export{k as Stepper,k as default};
@@ -1,49 +0,0 @@
1
- import { Ref, ReactElement } from 'react';
2
- import { UseStopwatchResult } from "../ink/hooks/use-stopwatch.js";
3
- type StopwatchRef = Omit<UseStopwatchResult, "elapsed" | "isRunning" | "laps">;
4
- type Props = {
5
- /**
6
- * Whether to start counting immediately.
7
- * @default false
8
- */
9
- readonly autoStart?: boolean;
10
- /**
11
- * Make the rendered text bold.
12
- */
13
- readonly bold?: boolean;
14
- /**
15
- * Text color for the rendered time.
16
- */
17
- readonly color?: string;
18
- /**
19
- * Custom formatter for the elapsed time.
20
- * Receives elapsed milliseconds, returns a display string.
21
- * @default formatDuration (MM:SS or HH:MM:SS)
22
- */
23
- readonly format?: (elapsed: number) => string;
24
- /**
25
- * Tick interval in milliseconds.
26
- * @default 1000
27
- */
28
- readonly interval?: number;
29
- readonly ref?: Ref<StopwatchRef>;
30
- };
31
- /**
32
- * A count-up stopwatch component.
33
- *
34
- * Exposes `start`, `stop`, `toggle`, `reset`, and `lap` methods via ref.
35
- *
36
- * ```tsx
37
- * const ref = useRef&lt;StopwatchRef>(null);
38
- * &lt;Stopwatch ref={ref} autoStart />
39
- * ```
40
- */
41
- declare const Stopwatch: ({
42
- autoStart,
43
- bold,
44
- color,
45
- format,
46
- interval,
47
- ref
48
- }: Props) => ReactElement;
49
- export { Props, Stopwatch, type Props as StopwatchProps, StopwatchRef, Stopwatch as default };
@@ -1 +0,0 @@
1
- import{jsx as p}from"react/jsx-runtime";import{useImperativeHandle as m}from"react";import f from"../ink/hooks/use-stopwatch.js";import{f as i}from"../packem_shared/format-time-fjoQHMxD.js";import{Text as n}from"./text.js";const x=({autoStart:o,bold:r,color:a,format:e=i,interval:s,ref:l})=>{const t=f({autoStart:o,interval:s});return m(l,()=>({lap:t.lap,reset:t.reset,start:t.start,stop:t.stop,toggle:t.toggle}),[t.lap,t.reset,t.start,t.stop,t.toggle]),p(n,{bold:r,color:a,children:e(t.elapsed)})};export{x as Stopwatch,x as default};
@@ -1,46 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- type Props = {
5
- /**
6
- * Color applied to the streamed output.
7
- */
8
- readonly color?: LiteralUnion<AnsiColors, string>;
9
- /**
10
- * Glyph rendered at the streaming caret while characters are still being revealed.
11
- * @default "▊" (left three quarters block)
12
- */
13
- readonly cursor?: string;
14
- /**
15
- * Milliseconds between characters.
16
- * @default 20
17
- */
18
- readonly interval?: number;
19
- /**
20
- * Called exactly once per `text` value, after the full text has been revealed.
21
- */
22
- readonly onComplete?: () => void;
23
- /**
24
- * Whether to display the cursor after streaming completes.
25
- * @default false
26
- */
27
- readonly showCursorWhenDone?: boolean;
28
- /**
29
- * Full text to stream into the output.
30
- */
31
- readonly text: string;
32
- };
33
- /**
34
- * Typewriter animation that reveals text one character at a time.
35
- * Automatically resets and replays when `text` changes. `onComplete`
36
- * fires exactly once per `text` value once it is fully revealed.
37
- */
38
- declare function StreamingText({
39
- color,
40
- cursor,
41
- interval,
42
- onComplete,
43
- showCursorWhenDone,
44
- text
45
- }: Props): ReactElement;
46
- export { Props, StreamingText, type Props as StreamingTextProps, StreamingText as default };
@@ -1 +0,0 @@
1
- import{jsxs as g}from"react/jsx-runtime";import{useState as T,useRef as c,useEffect as l}from"react";import{Text as d}from"./text.js";function k({color:f,cursor:i="▊",interval:o=20,onComplete:n,showCursorWhenDone:a=!1,text:r}){const[t,s]=T(0),u=c(n),e=c(!1);u.current=n,l(()=>{s(0),e.current=!1},[r]),l(()=>{if(t>=r.length){e.current||(e.current=!0,u.current?.());return}const p=setTimeout(()=>{s(x=>Math.min(r.length,x+1))},o);return()=>{clearTimeout(p)}},[t,r,o]);const m=!(t>=r.length)||a,h=r.slice(0,t);return g(d,{color:f,children:[h,m?i:""]})}export{k as StreamingText,k as default};
@@ -1,55 +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 for the on state.
7
- * @default "green"
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
- * Optional label rendered after the switch.
16
- */
17
- readonly children?: ReactNode;
18
- /**
19
- * Initial value when uncontrolled.
20
- */
21
- readonly defaultValue?: boolean;
22
- /**
23
- * Disable input and dim the switch.
24
- */
25
- readonly isDisabled?: boolean;
26
- /**
27
- * Labels displayed inside the switch track.
28
- * @default ["off", "on"]
29
- */
30
- readonly labels?: readonly [string, string];
31
- /**
32
- * Fired when the switch is toggled.
33
- */
34
- readonly onChange?: (value: boolean) => void;
35
- /**
36
- * Controlled value. Pair with `onChange` to update the parent.
37
- */
38
- readonly value?: boolean;
39
- };
40
- /**
41
- * Focusable on/off switch. Toggles with Space or Enter.
42
- * @returns A `ReactElement` rendering two labeled segments plus an optional
43
- * trailing label.
44
- */
45
- declare function Switch({
46
- accentColor,
47
- autoFocus,
48
- children,
49
- defaultValue,
50
- isDisabled,
51
- labels,
52
- onChange,
53
- value
54
- }: Props): ReactElement;
55
- export { Props, Switch, type Props as SwitchProps, Switch as default };
@@ -1 +0,0 @@
1
- import{jsxs as l,jsx as x}from"react/jsx-runtime";import{useState as F,useCallback as $}from"react";import j from"../ink/hooks/use-focus.js";import y from"../ink/hooks/use-input.js";import{Box as u}from"./box.js";import{Text as a}from"./text.js";const A=["off","on"];function V({accentColor:e="green",autoFocus:f=!1,children:n,defaultValue:m=!1,isDisabled:r=!1,labels:s=A,onChange:t,value:c}){const{isFocused:i}=j({autoFocus:f,isActive:!r}),[v,b]=F(m),o=c??v;y($((h,k)=>{if(i&&(k.return||h===" ")){const d=!o;c===void 0&&b(d),t?.(d)}},[i,o,c,t]),{isActive:!r&&i});const p=s[0],C=s[1],g=i?e:void 0;return l(u,{gap:1,children:[l(u,{gap:0,children:[l(a,{backgroundColor:o?void 0:"gray",color:o?void 0:"black",dimColor:r,children:[" ",p," "]}),l(a,{backgroundColor:o?e:void 0,color:o?"black":void 0,dimColor:r,children:[" ",C," "]})]}),n===void 0?void 0:x(a,{color:g,dimColor:r,children:n})]})}export{V as Switch,V as default};
@@ -1,19 +0,0 @@
1
- import { ReactNode, ReactElement } from 'react';
2
- type Props = {
3
- /**
4
- * Tab content to render when the tab is active.
5
- */
6
- readonly children: ReactNode;
7
- /**
8
- * Unique name identifying this tab.
9
- */
10
- readonly name: string;
11
- };
12
- /**
13
- * A single tab within a Tabs container.
14
- * The `name` prop identifies the tab; `children` is rendered when active.
15
- */
16
- declare function Tab({
17
- children
18
- }: Props): ReactElement;
19
- export { Props, Tab, type Props as TabProps, Tab as default };
@@ -1 +0,0 @@
1
- import{jsx as e,Fragment as n}from"react/jsx-runtime";function a({children:r}){return e(n,{children:r})}export{a as Tab,a as default};
@@ -1,119 +0,0 @@
1
- import { ReactElement } from 'react';
2
- interface BorderComponent {
3
- char: string;
4
- width: number;
5
- }
6
- /**
7
- * Represents the style of the border for a table or grid.
8
- */
9
- interface BorderStyle {
10
- /** Box vertical character. */
11
- bodyJoin: BorderComponent;
12
- /** Box vertical character. */
13
- bodyLeft: BorderComponent;
14
- /** Box vertical character. */
15
- bodyRight: BorderComponent;
16
- /** Box horizontal character. */
17
- bottomBody: BorderComponent;
18
- /** Box bottom join character. */
19
- bottomJoin: BorderComponent;
20
- /** Box bottom left character. */
21
- bottomLeft: BorderComponent;
22
- /** Box bottom right character. */
23
- bottomRight: BorderComponent;
24
- /** Box horizontal character. */
25
- joinBody: BorderComponent;
26
- /** Box horizontal join character. */
27
- joinJoin: BorderComponent;
28
- /** Box left join character. */
29
- joinLeft: BorderComponent;
30
- /** Box right join character. */
31
- joinRight: BorderComponent;
32
- /** Box horizontal character. */
33
- topBody: BorderComponent;
34
- /** Box top join character. */
35
- topJoin: BorderComponent;
36
- /** Box top left character. */
37
- topLeft: BorderComponent;
38
- /** Box top right character. */
39
- topRight: BorderComponent;
40
- }
41
- /** Base style properties applicable globally */
42
- type HorizontalAlignment = "center" | "left" | "right";
43
- /**
44
- * Scalar value that can be displayed in a table cell.
45
- */
46
- type Scalar = bigint | boolean | number | string | null | undefined;
47
- /**
48
- * Dictionary with scalar values, representing a single row of data.
49
- */
50
- type ScalarDict = Record<string, Scalar>;
51
- /**
52
- * Configuration for a single table column.
53
- */
54
- type ColumnConfig<T extends ScalarDict> = {
55
- /**
56
- * Horizontal alignment of cell content.
57
- */
58
- readonly align?: HorizontalAlignment;
59
- /**
60
- * Custom header label. Defaults to the key name.
61
- */
62
- readonly header?: string;
63
- /**
64
- * Key from the data object to display in this column.
65
- */
66
- readonly key: keyof T & string;
67
- /**
68
- * Fixed width for this column in characters.
69
- */
70
- readonly width?: number;
71
- };
72
- type Props<T extends ScalarDict> = {
73
- /**
74
- * Border style preset name or a custom `BorderStyle` object from `@visulima/tabular`.
75
- * @default "default"
76
- */
77
- readonly borderStyle?: "ascii" | "block" | "default" | "dots" | "double" | "markdown" | "minimal" | "none" | "rounded" | "thick" | BorderStyle;
78
- /**
79
- * Columns to display and their order.
80
- * Accepts simple key strings or `ColumnConfig` objects for advanced control.
81
- * If omitted, all keys from the first data item are used.
82
- */
83
- readonly columns?: ((keyof T & string) | ColumnConfig<T>)[];
84
- /**
85
- * Array of objects to display as rows.
86
- */
87
- readonly data: T[];
88
- /**
89
- * Format a cell value before rendering. Return a string to display in the cell.
90
- */
91
- readonly formatCell?: (value: Scalar, column: keyof T & string, rowIndex: number) => string;
92
- /**
93
- * Format a header label before rendering. Return a string to display as the column header.
94
- */
95
- readonly formatHeader?: (column: keyof T & string) => string;
96
- /**
97
- * Maximum width of the table in characters. Columns will be truncated or wrapped to fit.
98
- */
99
- readonly maxWidth?: number;
100
- /**
101
- * Cell padding (left and right) in characters.
102
- * @default 1
103
- */
104
- readonly padding?: number;
105
- /**
106
- * Whether to show the header row.
107
- * @default true
108
- */
109
- readonly showHeader?: boolean;
110
- /** Placeholder shown in place of `null` or `undefined` cell values. Defaults to an empty string. */
111
- readonly skeleton?: string;
112
- /**
113
- * Enable word wrap instead of truncation when cells exceed their width.
114
- * @default false
115
- */
116
- readonly wordWrap?: boolean;
117
- };
118
- declare const Table: <T extends ScalarDict>(props: Props<T>) => ReactElement;
119
- export { type ColumnConfig, type Props, type Scalar, type ScalarDict, Table, type ColumnConfig as TableColumnConfig, type Props as TableProps, type Scalar as TableScalar, type ScalarDict as TableScalarDict, Table as default };
@@ -1 +0,0 @@
1
- import{jsx as y}from"react/jsx-runtime";import{Table as _}from"@visulima/tabular";import{THICK_BORDER as g,ROUNDED_BORDER as b,NO_BORDER as w,MINIMAL_BORDER as S,MARKDOWN_BORDER as W,DOUBLE_BORDER as x,DOTS_BORDER as C,DEFAULT_BORDER as E,BLOCK_BORDER as H,ASCII_BORDER as I}from"@visulima/tabular/style";import{useMemo as L}from"react";import{Text as M}from"./text.js";const N={ascii:I,block:H,default:E,dots:C,double:x,markdown:W,minimal:S,none:w,rounded:b,thick:g},T=t=>typeof t=="string"?{key:t}:t,A=({borderStyle:t="default",columns:d,data:a,formatCell:n,formatHeader:m,maxWidth:f,padding:i=1,showHeader:s=!0,skeleton:u="",wordWrap:D=!1})=>{const h=L(()=>{if(a.length===0)return"";let r;if(d?r=d.map(e=>T(e)):r=Object.keys(a[0]).map(e=>({key:e})),r.length===0)return"";const k=typeof t=="string"?N[t]??E:t,O=r.map(e=>e.width),B=O.some(e=>e!==void 0),R=new _({columnWidths:B?O:void 0,maxWidth:f,showHeader:s,style:{border:k,paddingLeft:i,paddingRight:i},wordWrap:D});if(s){const e=r.map(o=>{const l=o.header??o.key;return m?m(o.key):l});R.setHeaders(e)}for(const[e,o]of a.entries()){const l=r.map(c=>{const p=o[c.key];return n?n(p,c.key,e):p==null?u:String(p)});R.addRow(l)}return R.toString()},[t,d,a,n,m,f,i,s,u,D]);return y(M,{children:h})},q=A;export{q as Table,q as default};
@@ -1,107 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- import { Props as Props$1 } from "./tab.js";
5
- /**
6
- * Keyboard navigation configuration for Tabs.
7
- */
8
- type KeyMap = {
9
- /**
10
- * Key names that move to the next tab.
11
- * Defaults to `["rightArrow"]` for row layouts and `["downArrow"]` for column layouts.
12
- */
13
- readonly next?: ReadonlyArray<string>;
14
- /**
15
- * Key names that move to the previous tab.
16
- * Defaults to `["leftArrow"]` for row layouts and `["upArrow"]` for column layouts.
17
- */
18
- readonly previous?: ReadonlyArray<string>;
19
- /**
20
- * Whether Meta/Cmd + 1–9 jumps to a specific tab.
21
- * @default true
22
- */
23
- readonly useNumbers?: boolean;
24
- /**
25
- * Whether the Tab key cycles through tabs (only when `isFocused` is not managed by Ink).
26
- * @default true
27
- */
28
- readonly useTab?: boolean;
29
- };
30
- /**
31
- * Color customization for active tab styling.
32
- */
33
- type TabColors = {
34
- readonly activeTab?: {
35
- readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
36
- readonly color?: LiteralUnion<AnsiColors, string>;
37
- };
38
- };
39
- type Props = {
40
- /**
41
- * Tab elements to render.
42
- */
43
- readonly children: ReactNode;
44
- /**
45
- * Active tab colors. When `isFocused` is `false`, the active tab uses gray.
46
- */
47
- readonly colors?: TabColors;
48
- /**
49
- * Name of the tab to select initially (uncontrolled mode).
50
- * Ignored when `value` is provided.
51
- */
52
- readonly defaultValue?: string;
53
- /**
54
- * Layout direction for the tab bar.
55
- * @default "row"
56
- */
57
- readonly flexDirection?: "column" | "column-reverse" | "row" | "row-reverse";
58
- /**
59
- * Whether the tabs are focused and respond to keyboard input.
60
- * - `true`: focused, uses active colors.
61
- * - `false`: unfocused, uses gray active color, ignores input.
62
- * - `undefined`/`null`: always active (focus not managed by Ink).
63
- * @default undefined
64
- */
65
- readonly isFocused?: boolean | null;
66
- /**
67
- * Custom keyboard mappings.
68
- */
69
- readonly keyMap?: KeyMap;
70
- /**
71
- * Called when the active tab changes.
72
- */
73
- readonly onChange: (name: string, activeTab: ReactElement<Props$1>) => void;
74
- /**
75
- * Whether to display 1-based index numbers before each tab name.
76
- * @default true
77
- */
78
- readonly showIndex?: boolean;
79
- /**
80
- * Controlled active tab name. When provided, the component is controlled —
81
- * the parent owns the active tab state and must update it via `onChange`.
82
- * When omitted, the component manages its own state (uncontrolled mode).
83
- */
84
- readonly value?: string;
85
- /**
86
- * Width of the container Box. Also determines the separator width in column layouts.
87
- */
88
- readonly width?: number | string;
89
- };
90
- /**
91
- * Tabbed navigation component. Renders a row or column of tabs with keyboard
92
- * navigation (arrow keys, Tab, number keys) and calls `onChange` when the
93
- * active tab changes.
94
- */
95
- declare function Tabs({
96
- children,
97
- colors: colorsProp,
98
- defaultValue,
99
- flexDirection,
100
- isFocused,
101
- keyMap: keyMapProp,
102
- onChange,
103
- showIndex,
104
- value,
105
- width
106
- }: Props): ReactElement;
107
- export { KeyMap, Props, TabColors, Tabs, type KeyMap as TabsKeyMap, type Props as TabsProps, Tabs as default };
@@ -1 +0,0 @@
1
- import{jsx as y,jsxs as A}from"react/jsx-runtime";import{useRef as I,useState as U,useCallback as d,useEffect as X,useMemo as j,Children as Y}from"react";import Z from"../ink/hooks/use-input.js";import{Box as M}from"./box.js";import{Text as D}from"./text.js";const _=/^\d$/u,G=e=>e!=null&&typeof e=="object"&&"props"in e&&"name"in e.props,H=e=>{const t=[];for(const n of Y.toArray(e))G(n)&&t.push(n);return t},E=(e,t)=>e.some(n=>t[n]),J=(e,t,n)=>e?t?{backgroundColor:n?.activeTab?.backgroundColor??"green",color:n?.activeTab?.color??"black"}:{backgroundColor:"gray",color:"black"}:{backgroundColor:void 0,color:void 0};function nr({children:e,colors:t,defaultValue:n,flexDirection:f="row",isFocused:b,keyMap:u,onChange:T,showIndex:F=!0,value:x,width:v}){const s=H(e),c=s.length,p=I(s);p.current=s;const l=f==="column"||f==="column-reverse",g=x!==void 0,[L,O]=U(()=>{const r=x??n;if(r==null||c===0)return 0;const o=s.findIndex(i=>i.props.name===r);return o===-1?0:o}),h=g?Math.max(0,s.findIndex(r=>r.props.name===x)):L,P=d(()=>{},[]),a=g?P:O,m=I(T);m.current=T,X(()=>{if(g)return;const r=p.current[h];r&&m.current(r.props.name,r)},[]);const B=j(()=>u?.previous??[l?"upArrow":"leftArrow"],[u?.previous,l]),N=j(()=>u?.next??[l?"downArrow":"rightArrow"],[u?.next,l]),R=u?.useNumbers??!0,S=u?.useTab??!0,k=I(h);k.current=h;const V=d(r=>{a(r);const o=p.current[r];o&&m.current(o.props.name,o)},[a]),C=d(()=>{const r=(k.current+1)%c;a(r);const o=p.current[r];o&&m.current(o.props.name,o)},[c,a]),w=d(()=>{const r=(k.current-1+c)%c;a(r);const o=p.current[r];o&&m.current(o.props.name,o)},[c,a]);Z(d((r,o)=>{if(E(B,o)){w();return}if(E(N,o)){C();return}if(o.tab&&S&&b==null){o.shift?w():C();return}if(R&&o.meta&&_.test(r)){const i=r==="0"?9:Number.parseInt(r,10)-1;i<c&&V(i)}},[B,N,S,R,b,w,C,c,V]),{isActive:b!==!1});const $=typeof v=="number"?v:6,Q=j(()=>l?"─".repeat($):" | ",[l,$]);return y(M,{flexDirection:f,width:v,children:s.map((r,o)=>{const{name:i}=r.props,q=J(h===o,b!==!1,t);let z=null;return F&&(z=A(D,{color:"grey",children:[o+1,"."," "]})),A(M,{flexDirection:f,children:[o!==0&&y(D,{color:"dim",children:Q}),A(M,{children:[z,y(D,{backgroundColor:q.backgroundColor,color:q.color,children:r})]})]},i)})})}export{nr as Tabs,nr as default};
@@ -1,35 +0,0 @@
1
- import { AnsiColors } from '@visulima/colorize';
2
- import { ReactNode, ReactElement } from 'react';
3
- import { LiteralUnion } from 'type-fest';
4
- type TagVariant = "outline" | "solid" | "subtle";
5
- type Props = {
6
- /**
7
- * Tag content.
8
- */
9
- readonly children: ReactNode;
10
- /**
11
- * Base color.
12
- * @default "blue"
13
- */
14
- readonly color?: LiteralUnion<AnsiColors, string>;
15
- /**
16
- * Optional symbol rendered before the label (e.g. `●`, `✔`, `★`).
17
- */
18
- readonly icon?: ReactNode;
19
- /**
20
- * Visual style.
21
- * @default "subtle"
22
- */
23
- readonly variant?: TagVariant;
24
- };
25
- /**
26
- * Render a short pill-shaped label.
27
- * @returns A `ReactElement` rendering the tag in the requested variant.
28
- */
29
- declare function Tag({
30
- children,
31
- color,
32
- icon,
33
- variant
34
- }: Props): ReactElement;
35
- export { Props, Tag, type Props as TagProps, TagVariant, Tag as default };
@@ -1 +0,0 @@
1
- import{jsx as e,jsxs as r,Fragment as l}from"react/jsx-runtime";import{Box as a}from"./box.js";import{Text as n}from"./text.js";function u({children:d,color:i="blue",icon:o,variant:c="subtle"}){return c==="outline"?e(a,{borderColor:i,borderStyle:"round",paddingX:1,children:r(n,{color:i,children:[o===void 0?void 0:r(l,{children:[o," "]}),d]})}):c==="solid"?r(n,{backgroundColor:i,color:"black",children:[" ",o===void 0?void 0:r(l,{children:[o," "]}),d," "]}):r(n,{color:i,children:[o===void 0?void 0:r(l,{children:[o," "]}),d]})}export{u as Tag,u as default};