@visulima/tui 1.0.0-alpha.4 → 1.0.0-alpha.6

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 (249) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE.md +140 -0
  3. package/dist/core/index.d.ts +58 -5
  4. package/dist/ink/index.d.ts +6592 -294
  5. package/dist/ink/index.js +1 -1
  6. package/dist/packem_shared/{Histogram-cgAjY5AJ.js → Histogram-CB6XcmZW.js} +1 -1
  7. package/dist/packem_shared/input.d-Bfq7oc06.d.ts +90 -0
  8. package/dist/packem_shared/render.d-BR3gA-N8.d.ts +1257 -0
  9. package/dist/react/index.d.ts +519 -8
  10. package/dist/testing/index.d.ts +274 -135
  11. package/package.json +16 -17
  12. package/dist/core/app.d.ts +0 -50
  13. package/dist/core/cell.d.ts +0 -33
  14. package/dist/core/inline.d.ts +0 -22
  15. package/dist/core/input.d.ts +0 -18
  16. package/dist/core/native-binding.d.ts +0 -22
  17. package/dist/ink/ansi-to-cell.d.ts +0 -5
  18. package/dist/ink/ansi-tokenizer.d.ts +0 -38
  19. package/dist/ink/canvas/braille.d.ts +0 -22
  20. package/dist/ink/canvas/buffer.d.ts +0 -67
  21. package/dist/ink/clipboard.d.ts +0 -29
  22. package/dist/ink/color-matrix.d.ts +0 -49
  23. package/dist/ink/color-utils.d.ts +0 -30
  24. package/dist/ink/colorize.d.ts +0 -4
  25. package/dist/ink/components/accessibility-context.d.ts +0 -4
  26. package/dist/ink/components/accordion.d.ts +0 -52
  27. package/dist/ink/components/alert.d.ts +0 -30
  28. package/dist/ink/components/animate-presence.d.ts +0 -15
  29. package/dist/ink/components/animation-context.d.ts +0 -10
  30. package/dist/ink/components/app-context.d.ts +0 -38
  31. package/dist/ink/components/app.d.ts +0 -19
  32. package/dist/ink/components/approval-prompt.d.ts +0 -55
  33. package/dist/ink/components/area-chart.d.ts +0 -54
  34. package/dist/ink/components/background-context.d.ts +0 -5
  35. package/dist/ink/components/badge.d.ts +0 -27
  36. package/dist/ink/components/bar-chart.d.ts +0 -57
  37. package/dist/ink/components/big-text.d.ts +0 -71
  38. package/dist/ink/components/blink-dot.d.ts +0 -30
  39. package/dist/ink/components/box.d.ts +0 -58
  40. package/dist/ink/components/breadcrumb.d.ts +0 -28
  41. package/dist/ink/components/button.d.ts +0 -38
  42. package/dist/ink/components/calendar.d.ts +0 -60
  43. package/dist/ink/components/canvas.d.ts +0 -38
  44. package/dist/ink/components/card.d.ts +0 -46
  45. package/dist/ink/components/chart-utils.d.ts +0 -54
  46. package/dist/ink/components/checkbox.d.ts +0 -39
  47. package/dist/ink/components/code.d.ts +0 -46
  48. package/dist/ink/components/collapsible.d.ts +0 -43
  49. package/dist/ink/components/command-block.d.ts +0 -38
  50. package/dist/ink/components/command-palette.d.ts +0 -72
  51. package/dist/ink/components/confirm-dialog.d.ts +0 -63
  52. package/dist/ink/components/confirm-input.d.ts +0 -40
  53. package/dist/ink/components/console-overlay.d.ts +0 -52
  54. package/dist/ink/components/content-switcher.d.ts +0 -49
  55. package/dist/ink/components/cursor-context.d.ts +0 -12
  56. package/dist/ink/components/cursor.d.ts +0 -43
  57. package/dist/ink/components/date-picker.d.ts +0 -53
  58. package/dist/ink/components/definition-list.d.ts +0 -37
  59. package/dist/ink/components/dialog.d.ts +0 -93
  60. package/dist/ink/components/diff-view.d.ts +0 -71
  61. package/dist/ink/components/divider.d.ts +0 -40
  62. package/dist/ink/components/error-boundary.d.ts +0 -17
  63. package/dist/ink/components/error-overview.d.ts +0 -6
  64. package/dist/ink/components/file-picker/file-picker.d.ts +0 -58
  65. package/dist/ink/components/file-picker/types.d.ts +0 -35
  66. package/dist/ink/components/file-picker/use-file-system.d.ts +0 -16
  67. package/dist/ink/components/focus-context.d.ts +0 -17
  68. package/dist/ink/components/form.d.ts +0 -74
  69. package/dist/ink/components/gauge.d.ts +0 -75
  70. package/dist/ink/components/gradient.d.ts +0 -38
  71. package/dist/ink/components/heading.d.ts +0 -27
  72. package/dist/ink/components/heatmap.d.ts +0 -51
  73. package/dist/ink/components/help.d.ts +0 -44
  74. package/dist/ink/components/histogram.d.ts +0 -52
  75. package/dist/ink/components/kbd.d.ts +0 -27
  76. package/dist/ink/components/line-chart.d.ts +0 -94
  77. package/dist/ink/components/link.d.ts +0 -34
  78. package/dist/ink/components/loading-indicator.d.ts +0 -24
  79. package/dist/ink/components/markdown.d.ts +0 -34
  80. package/dist/ink/components/masked-input.d.ts +0 -41
  81. package/dist/ink/components/menu.d.ts +0 -70
  82. package/dist/ink/components/message-bubble.d.ts +0 -35
  83. package/dist/ink/components/model-badge.d.ts +0 -32
  84. package/dist/ink/components/multi-select.d.ts +0 -63
  85. package/dist/ink/components/newline.d.ts +0 -12
  86. package/dist/ink/components/operation-tree.d.ts +0 -46
  87. package/dist/ink/components/option-list.d.ts +0 -41
  88. package/dist/ink/components/ordered-list.d.ts +0 -30
  89. package/dist/ink/components/paginator.d.ts +0 -59
  90. package/dist/ink/components/paragraph.d.ts +0 -31
  91. package/dist/ink/components/placeholder.d.ts +0 -47
  92. package/dist/ink/components/progress-bar.d.ts +0 -51
  93. package/dist/ink/components/radio-group.d.ts +0 -62
  94. package/dist/ink/components/scatter-plot.d.ts +0 -23
  95. package/dist/ink/components/scroll/controlled-scroll-view.d.ts +0 -43
  96. package/dist/ink/components/scroll/index.d.ts +0 -10
  97. package/dist/ink/components/scroll/scroll-bar-box.d.ts +0 -15
  98. package/dist/ink/components/scroll/scroll-bar.d.ts +0 -20
  99. package/dist/ink/components/scroll/scroll-list.d.ts +0 -12
  100. package/dist/ink/components/scroll/scroll-view.d.ts +0 -98
  101. package/dist/ink/components/scroll/use-state-ref.d.ts +0 -8
  102. package/dist/ink/components/search-input.d.ts +0 -46
  103. package/dist/ink/components/select-input-indicator.d.ts +0 -36
  104. package/dist/ink/components/select-input-item.d.ts +0 -43
  105. package/dist/ink/components/select-input.d.ts +0 -96
  106. package/dist/ink/components/shimmer-text.d.ts +0 -39
  107. package/dist/ink/components/slider.d.ts +0 -92
  108. package/dist/ink/components/spacer.d.ts +0 -7
  109. package/dist/ink/components/sparkline.d.ts +0 -30
  110. package/dist/ink/components/spinner.d.ts +0 -40
  111. package/dist/ink/components/static-render.d.ts +0 -40
  112. package/dist/ink/components/static.d.ts +0 -24
  113. package/dist/ink/components/status-line.d.ts +0 -30
  114. package/dist/ink/components/status-message.d.ts +0 -26
  115. package/dist/ink/components/stderr-context.d.ts +0 -16
  116. package/dist/ink/components/stdin-context.d.ts +0 -29
  117. package/dist/ink/components/stdout-context.d.ts +0 -16
  118. package/dist/ink/components/stepper.d.ts +0 -42
  119. package/dist/ink/components/stopwatch.d.ts +0 -42
  120. package/dist/ink/components/streaming-text.d.ts +0 -38
  121. package/dist/ink/components/switch.d.ts +0 -46
  122. package/dist/ink/components/tab.d.ts +0 -25
  123. package/dist/ink/components/table.d.ts +0 -80
  124. package/dist/ink/components/tabs.d.ts +0 -104
  125. package/dist/ink/components/tag.d.ts +0 -30
  126. package/dist/ink/components/text-input.d.ts +0 -48
  127. package/dist/ink/components/text.d.ts +0 -63
  128. package/dist/ink/components/textarea.d.ts +0 -62
  129. package/dist/ink/components/timer.d.ts +0 -50
  130. package/dist/ink/components/toast.d.ts +0 -41
  131. package/dist/ink/components/tooltip.d.ts +0 -36
  132. package/dist/ink/components/transform.d.ts +0 -16
  133. package/dist/ink/components/transition.d.ts +0 -53
  134. package/dist/ink/components/tree-view/theme.d.ts +0 -24
  135. package/dist/ink/components/tree-view/tree-node-map.d.ts +0 -72
  136. package/dist/ink/components/tree-view/tree-view-node.d.ts +0 -29
  137. package/dist/ink/components/tree-view/tree-view.d.ts +0 -89
  138. package/dist/ink/components/tree-view/types.d.ts +0 -55
  139. package/dist/ink/components/tree-view/use-tree-view-state.d.ts +0 -135
  140. package/dist/ink/components/tree-view/use-tree-view.d.ts +0 -26
  141. package/dist/ink/components/unordered-list.d.ts +0 -35
  142. package/dist/ink/components/variant-config.d.ts +0 -10
  143. package/dist/ink/cursor-helpers.d.ts +0 -35
  144. package/dist/ink/data-limited-lru-map.d.ts +0 -21
  145. package/dist/ink/devtools-window-polyfill.d.ts +0 -1
  146. package/dist/ink/devtools.d.ts +0 -1
  147. package/dist/ink/dom.d.ts +0 -214
  148. package/dist/ink/get-max-width.d.ts +0 -3
  149. package/dist/ink/highlighter.d.ts +0 -28
  150. package/dist/ink/hooks/use-animation.d.ts +0 -41
  151. package/dist/ink/hooks/use-app.d.ts +0 -6
  152. package/dist/ink/hooks/use-box-metrics.d.ts +0 -58
  153. package/dist/ink/hooks/use-clipboard.d.ts +0 -29
  154. package/dist/ink/hooks/use-color-blindness.d.ts +0 -33
  155. package/dist/ink/hooks/use-console-capture.d.ts +0 -43
  156. package/dist/ink/hooks/use-cursor.d.ts +0 -12
  157. package/dist/ink/hooks/use-focus-manager.d.ts +0 -42
  158. package/dist/ink/hooks/use-focus.d.ts +0 -30
  159. package/dist/ink/hooks/use-form.d.ts +0 -70
  160. package/dist/ink/hooks/use-hotkey.d.ts +0 -37
  161. package/dist/ink/hooks/use-input.d.ts +0 -149
  162. package/dist/ink/hooks/use-interval.d.ts +0 -25
  163. package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +0 -6
  164. package/dist/ink/hooks/use-key-bindings.d.ts +0 -59
  165. package/dist/ink/hooks/use-key-chord.d.ts +0 -26
  166. package/dist/ink/hooks/use-linked-scroll.d.ts +0 -41
  167. package/dist/ink/hooks/use-paste.d.ts +0 -44
  168. package/dist/ink/hooks/use-persistent-state.d.ts +0 -56
  169. package/dist/ink/hooks/use-scroll-acceleration.d.ts +0 -47
  170. package/dist/ink/hooks/use-scroll-input.d.ts +0 -34
  171. package/dist/ink/hooks/use-stderr.d.ts +0 -6
  172. package/dist/ink/hooks/use-stdin.d.ts +0 -7
  173. package/dist/ink/hooks/use-stdout.d.ts +0 -6
  174. package/dist/ink/hooks/use-stopwatch.d.ts +0 -38
  175. package/dist/ink/hooks/use-terminal-palette.d.ts +0 -19
  176. package/dist/ink/hooks/use-text-buffer.d.ts +0 -42
  177. package/dist/ink/hooks/use-text-selection.d.ts +0 -45
  178. package/dist/ink/hooks/use-timeout.d.ts +0 -24
  179. package/dist/ink/hooks/use-timer.d.ts +0 -47
  180. package/dist/ink/hooks/use-window-size.d.ts +0 -18
  181. package/dist/ink/ime-utils.d.ts +0 -25
  182. package/dist/ink/ink.d.ts +0 -190
  183. package/dist/ink/input-parser.d.ts +0 -10
  184. package/dist/ink/input-utils.d.ts +0 -16
  185. package/dist/ink/instances.d.ts +0 -3
  186. package/dist/ink/kitty-keyboard.d.ts +0 -23
  187. package/dist/ink/layout.d.ts +0 -26
  188. package/dist/ink/log-update-native.d.ts +0 -14
  189. package/dist/ink/log-update.d.ts +0 -21
  190. package/dist/ink/measure-element.d.ts +0 -147
  191. package/dist/ink/measure-text.d.ts +0 -56
  192. package/dist/ink/mouse/ansi-parser.d.ts +0 -37
  193. package/dist/ink/mouse/constants.d.ts +0 -14
  194. package/dist/ink/mouse/fullscreen.d.ts +0 -8
  195. package/dist/ink/mouse/index.d.ts +0 -20
  196. package/dist/ink/mouse/is-intersecting.d.ts +0 -18
  197. package/dist/ink/mouse/mouse-context.d.ts +0 -36
  198. package/dist/ink/mouse/mouse-provider.d.ts +0 -11
  199. package/dist/ink/mouse/use-element-position.d.ts +0 -29
  200. package/dist/ink/mouse/use-mouse-action.d.ts +0 -7
  201. package/dist/ink/mouse/use-mouse-position.d.ts +0 -7
  202. package/dist/ink/mouse/use-mouse.d.ts +0 -7
  203. package/dist/ink/mouse/use-on-mouse-click.d.ts +0 -14
  204. package/dist/ink/mouse/use-on-mouse-hover.d.ts +0 -8
  205. package/dist/ink/mouse/use-on-mouse-state.d.ts +0 -11
  206. package/dist/ink/output.d.ts +0 -75
  207. package/dist/ink/parse-keypress.d.ts +0 -22
  208. package/dist/ink/reconciler.d.ts +0 -3
  209. package/dist/ink/region.d.ts +0 -99
  210. package/dist/ink/render-background.d.ts +0 -4
  211. package/dist/ink/render-border.d.ts +0 -4
  212. package/dist/ink/render-node-to-output.d.ts +0 -38
  213. package/dist/ink/render-scrollbar.d.ts +0 -9
  214. package/dist/ink/render-sticky.d.ts +0 -44
  215. package/dist/ink/render-to-string.d.ts +0 -37
  216. package/dist/ink/render.d.ts +0 -191
  217. package/dist/ink/renderer.d.ts +0 -17
  218. package/dist/ink/resize-observer.d.ts +0 -44
  219. package/dist/ink/sanitize-ansi.d.ts +0 -2
  220. package/dist/ink/scroll.d.ts +0 -23
  221. package/dist/ink/selection.d.ts +0 -70
  222. package/dist/ink/squash-text-nodes.d.ts +0 -18
  223. package/dist/ink/style-flags.d.ts +0 -17
  224. package/dist/ink/styled-line-factory.d.ts +0 -25
  225. package/dist/ink/styled-line-serializer.d.ts +0 -18
  226. package/dist/ink/styled-line.d.ts +0 -119
  227. package/dist/ink/styles.d.ts +0 -369
  228. package/dist/ink/terminal-palette.d.ts +0 -25
  229. package/dist/ink/text-wrap.d.ts +0 -10
  230. package/dist/ink/token-to-elements.d.ts +0 -22
  231. package/dist/ink/utils/format-time.d.ts +0 -4
  232. package/dist/ink/utils.d.ts +0 -9
  233. package/dist/ink/wrap-text.d.ts +0 -3
  234. package/dist/ink/write-synchronized.d.ts +0 -4
  235. package/dist/react/devtools.d.ts +0 -27
  236. package/dist/react/focus.d.ts +0 -39
  237. package/dist/react/hooks.d.ts +0 -238
  238. package/dist/react/layout.d.ts +0 -33
  239. package/dist/react/react.d.ts +0 -57
  240. package/dist/react/reconciler.d.ts +0 -4
  241. package/dist/react/render-to-string.d.ts +0 -21
  242. package/dist/react/renderer.d.ts +0 -2
  243. package/dist/react/scene.d.ts +0 -3
  244. package/dist/react/static.d.ts +0 -39
  245. package/dist/react/styles.d.ts +0 -83
  246. package/dist/react/text-width.d.ts +0 -20
  247. package/dist/testing/keys.d.ts +0 -89
  248. package/dist/testing/screen.d.ts +0 -35
  249. package/dist/testing/wait-for.d.ts +0 -20
@@ -1,30 +0,0 @@
1
- import type { AnsiColors } from "@visulima/colorize";
2
- import type { ReactElement, ReactNode } from "react";
3
- import type { LiteralUnion } from "type-fest";
4
- export 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
- export default function StatusLine({ backgroundColor, center, color, left, right }: Props): ReactElement;
@@ -1,26 +0,0 @@
1
- /**
2
- * Status message component for Ink.
3
- *
4
- * Inspired by ink-ui StatusMessage by Vadim Demedes.
5
- * @see https://github.com/vadimdemedes/ink-ui
6
- *
7
- * MIT License
8
- * Copyright (c) Vadym Demedes (github.com/vadimdemedes)
9
- */
10
- import type { ReactElement, ReactNode } from "react";
11
- import type { Variant } from "./variant-config.d.ts";
12
- export type StatusMessageVariant = Variant;
13
- export type Props = {
14
- /**
15
- * Message content.
16
- */
17
- readonly children: ReactNode;
18
- /**
19
- * Determines the icon and color of the status message.
20
- */
21
- readonly variant: StatusMessageVariant;
22
- };
23
- /**
24
- * Renders a status notification with a colored icon and message text.
25
- */
26
- export default function StatusMessage({ children, variant }: Props): ReactElement;
@@ -1,16 +0,0 @@
1
- import type { Context } from "react";
2
- export type Props = {
3
- /**
4
- * Stderr stream passed to `render()` in `options.stderr` or `process.stderr` by default.
5
- */
6
- readonly stderr: NodeJS.WriteStream;
7
- /**
8
- * Write any string to stderr while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `&lt;Static>`, except it can't accept components; it only works with strings.
9
- */
10
- readonly write: (data: string) => void;
11
- };
12
- /**
13
- * `StderrContext` is a React context that exposes the stderr stream.
14
- */
15
- declare const StderrContext: Context<Props>;
16
- export default StderrContext;
@@ -1,29 +0,0 @@
1
- import { EventEmitter } from "node:events";
2
- import type { Context } from "react";
3
- export type PublicProps = {
4
- /**
5
- * A boolean flag determining if the current `stdin` supports `setRawMode`. A component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.
6
- */
7
- readonly isRawModeSupported: boolean;
8
- /**
9
- * Ink exposes this function via own `&lt;StdinContext>` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`. If the `stdin` stream passed to Ink does not support setRawMode, this function does nothing.
10
- */
11
- readonly setRawMode: (value: boolean) => void;
12
- /**
13
- * The stdin stream passed to `render()` in `options.stdin`, or `process.stdin` by default. Useful if your app needs to handle user input.
14
- */
15
- readonly stdin: NodeJS.ReadStream;
16
- };
17
- export type Props = PublicProps & {
18
- readonly internal_eventEmitter: EventEmitter;
19
- readonly internal_exitOnCtrlC: boolean;
20
- /**
21
- * Enable or disable bracketed paste mode on the terminal. When enabled, pasted text is wrapped in escape sequences that allow it to be distinguished from typed input.
22
- */
23
- readonly setBracketedPasteMode: (value: boolean) => void;
24
- };
25
- /**
26
- * `StdinContext` is a React context that exposes the input stream.
27
- */
28
- declare const StdinContext: Context<Props>;
29
- export default StdinContext;
@@ -1,16 +0,0 @@
1
- import type { Context } from "react";
2
- export type Props = {
3
- /**
4
- * Stdout stream passed to `render()` in `options.stdout` or `process.stdout` by default.
5
- */
6
- readonly stdout: NodeJS.WriteStream;
7
- /**
8
- * Write any string to stdout while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `&lt;Static>`, except it can't accept components; it only works with strings.
9
- */
10
- readonly write: (data: string) => void;
11
- };
12
- /**
13
- * `StdoutContext` is a React context that exposes the stdout stream where Ink renders your app.
14
- */
15
- declare const StdoutContext: Context<Props>;
16
- export default StdoutContext;
@@ -1,42 +0,0 @@
1
- import type { AnsiColors } from "@visulima/colorize";
2
- import type { ReactElement, ReactNode } from "react";
3
- import type { LiteralUnion } from "type-fest";
4
- export type StepStatus = "active" | "completed" | "error" | "pending";
5
- export type StepperStep = {
6
- readonly description?: string;
7
- readonly key?: string;
8
- readonly label: ReactNode;
9
- readonly status?: StepStatus;
10
- };
11
- export 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
- * @param props See {@link Props}.
40
- * @returns A `ReactElement` rendering the steps horizontally or vertically.
41
- */
42
- export default function Stepper({ accentColor, activeIndex, errorColor, orientation, steps }: Props): ReactElement;
@@ -1,42 +0,0 @@
1
- import type { ReactElement, Ref } from "react";
2
- import type { UseStopwatchResult } from "../hooks/use-stopwatch.d.ts";
3
- export type StopwatchRef = Omit<UseStopwatchResult, "elapsed" | "isRunning" | "laps">;
4
- export 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: ({ autoStart, bold, color, format, interval, ref }: Props) => ReactElement;
42
- export default Stopwatch;
@@ -1,38 +0,0 @@
1
- import type { AnsiColors } from "@visulima/colorize";
2
- import type { ReactElement } from "react";
3
- import type { LiteralUnion } from "type-fest";
4
- export type Props = {
5
- /**
6
- * Color applied to the streamed output.
7
- */
8
- readonly color?: LiteralUnion<AnsiColors, string>;
9
- /**
10
- * Optional cursor character rendered while streaming.
11
- * @default "▊"
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
- export default function StreamingText({ color, cursor, interval, onComplete, showCursorWhenDone, text }: Props): ReactElement;
@@ -1,46 +0,0 @@
1
- import type { AnsiColors } from "@visulima/colorize";
2
- import type { ReactElement, ReactNode } from "react";
3
- import type { LiteralUnion } from "type-fest";
4
- export 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
- * @param props See {@link Props}.
43
- * @returns A `ReactElement` rendering two labeled segments plus an optional
44
- * trailing label.
45
- */
46
- export default function Switch({ accentColor, autoFocus, children, defaultValue, isDisabled, labels, onChange, value, }: Props): ReactElement;
@@ -1,25 +0,0 @@
1
- /**
2
- * Tab component for Ink.
3
- *
4
- * Inspired by ink-tab by Julien Deniau.
5
- * @see https://github.com/jdeniau/ink-tab
6
- *
7
- * MIT License
8
- * Copyright (c) Julien Deniau (github.com/jdeniau)
9
- */
10
- import type { ReactElement, ReactNode } from "react";
11
- export type Props = {
12
- /**
13
- * Tab content to render when the tab is active.
14
- */
15
- readonly children: ReactNode;
16
- /**
17
- * Unique name identifying this tab.
18
- */
19
- readonly name: string;
20
- };
21
- /**
22
- * A single tab within a Tabs container.
23
- * The `name` prop identifies the tab; `children` is rendered when active.
24
- */
25
- export default function Tab({ children }: Props): ReactElement;
@@ -1,80 +0,0 @@
1
- import type { BorderStyle, HorizontalAlignment } from "@visulima/tabular";
2
- import type { ReactElement } from "react";
3
- /**
4
- * Scalar value that can be displayed in a table cell.
5
- */
6
- type Scalar = bigint | boolean | number | string | null | undefined;
7
- /**
8
- * Dictionary with scalar values, representing a single row of data.
9
- */
10
- type ScalarDict = Record<string, Scalar>;
11
- /**
12
- * Configuration for a single table column.
13
- */
14
- type ColumnConfig<T extends ScalarDict> = {
15
- /**
16
- * Horizontal alignment of cell content.
17
- */
18
- readonly align?: HorizontalAlignment;
19
- /**
20
- * Custom header label. Defaults to the key name.
21
- */
22
- readonly header?: string;
23
- /**
24
- * Key from the data object to display in this column.
25
- */
26
- readonly key: keyof T & string;
27
- /**
28
- * Fixed width for this column in characters.
29
- */
30
- readonly width?: number;
31
- };
32
- type Props<T extends ScalarDict> = {
33
- /**
34
- * Border style preset name or a custom `BorderStyle` object from `@visulima/tabular`.
35
- * @default "default"
36
- */
37
- readonly borderStyle?: "ascii" | "block" | "default" | "dots" | "double" | "markdown" | "minimal" | "none" | "rounded" | "thick" | BorderStyle;
38
- /**
39
- * Columns to display and their order.
40
- * Accepts simple key strings or `ColumnConfig` objects for advanced control.
41
- * If omitted, all keys from the first data item are used.
42
- */
43
- readonly columns?: ((keyof T & string) | ColumnConfig<T>)[];
44
- /**
45
- * Array of objects to display as rows.
46
- */
47
- readonly data: T[];
48
- /**
49
- * Format a cell value before rendering. Return a string to display in the cell.
50
- */
51
- readonly formatCell?: (value: Scalar, column: keyof T & string, rowIndex: number) => string;
52
- /**
53
- * Format a header label before rendering. Return a string to display as the column header.
54
- */
55
- readonly formatHeader?: (column: keyof T & string) => string;
56
- /**
57
- * Maximum width of the table in characters. Columns will be truncated or wrapped to fit.
58
- */
59
- readonly maxWidth?: number;
60
- /**
61
- * Cell padding (left and right) in characters.
62
- * @default 1
63
- */
64
- readonly padding?: number;
65
- /**
66
- * Whether to show the header row.
67
- * @default true
68
- */
69
- readonly showHeader?: boolean;
70
- /** Placeholder shown in place of `null` or `undefined` cell values. Defaults to an empty string. */
71
- readonly skeleton?: string;
72
- /**
73
- * Enable word wrap instead of truncation when cells exceed their width.
74
- * @default false
75
- */
76
- readonly wordWrap?: boolean;
77
- };
78
- declare const _default: <T extends ScalarDict>(props: Props<T>) => ReactElement;
79
- export default _default;
80
- export type { ColumnConfig, Props, Scalar, ScalarDict };
@@ -1,104 +0,0 @@
1
- /**
2
- * Tabs component for Ink.
3
- *
4
- * Inspired by ink-tab by Julien Deniau.
5
- * @see https://github.com/jdeniau/ink-tab
6
- *
7
- * MIT License
8
- * Copyright (c) Julien Deniau (github.com/jdeniau)
9
- */
10
- import type { AnsiColors } from "@visulima/colorize";
11
- import type { ReactElement, ReactNode } from "react";
12
- import type { LiteralUnion } from "type-fest";
13
- import type { Props as TabProps } from "./tab.d.ts";
14
- /**
15
- * Keyboard navigation configuration for Tabs.
16
- */
17
- export type KeyMap = {
18
- /**
19
- * Key names that move to the next tab.
20
- * Defaults to `["rightArrow"]` for row layouts and `["downArrow"]` for column layouts.
21
- */
22
- readonly next?: ReadonlyArray<string>;
23
- /**
24
- * Key names that move to the previous tab.
25
- * Defaults to `["leftArrow"]` for row layouts and `["upArrow"]` for column layouts.
26
- */
27
- readonly previous?: ReadonlyArray<string>;
28
- /**
29
- * Whether Meta/Cmd + 1–9 jumps to a specific tab.
30
- * @default true
31
- */
32
- readonly useNumbers?: boolean;
33
- /**
34
- * Whether the Tab key cycles through tabs (only when `isFocused` is not managed by Ink).
35
- * @default true
36
- */
37
- readonly useTab?: boolean;
38
- };
39
- /**
40
- * Color customization for active tab styling.
41
- */
42
- export type TabColors = {
43
- readonly activeTab?: {
44
- readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
45
- readonly color?: LiteralUnion<AnsiColors, string>;
46
- };
47
- };
48
- export type Props = {
49
- /**
50
- * Tab elements to render.
51
- */
52
- readonly children: ReactNode;
53
- /**
54
- * Active tab colors. When `isFocused` is `false`, the active tab uses gray.
55
- */
56
- readonly colors?: TabColors;
57
- /**
58
- * Name of the tab to select initially (uncontrolled mode).
59
- * Ignored when `value` is provided.
60
- */
61
- readonly defaultValue?: string;
62
- /**
63
- * Layout direction for the tab bar.
64
- * @default "row"
65
- */
66
- readonly flexDirection?: "column" | "column-reverse" | "row" | "row-reverse";
67
- /**
68
- * Whether the tabs are focused and respond to keyboard input.
69
- * - `true`: focused, uses active colors.
70
- * - `false`: unfocused, uses gray active color, ignores input.
71
- * - `undefined`/`null`: always active (focus not managed by Ink).
72
- * @default undefined
73
- */
74
- readonly isFocused?: boolean | null;
75
- /**
76
- * Custom keyboard mappings.
77
- */
78
- readonly keyMap?: KeyMap;
79
- /**
80
- * Called when the active tab changes.
81
- */
82
- readonly onChange: (name: string, activeTab: ReactElement<TabProps>) => void;
83
- /**
84
- * Whether to display 1-based index numbers before each tab name.
85
- * @default true
86
- */
87
- readonly showIndex?: boolean;
88
- /**
89
- * Controlled active tab name. When provided, the component is controlled —
90
- * the parent owns the active tab state and must update it via `onChange`.
91
- * When omitted, the component manages its own state (uncontrolled mode).
92
- */
93
- readonly value?: string;
94
- /**
95
- * Width of the container Box. Also determines the separator width in column layouts.
96
- */
97
- readonly width?: number | string;
98
- };
99
- /**
100
- * Tabbed navigation component. Renders a row or column of tabs with keyboard
101
- * navigation (arrow keys, Tab, number keys) and calls `onChange` when the
102
- * active tab changes.
103
- */
104
- export default function Tabs({ children, colors: colorsProp, defaultValue, flexDirection, isFocused, keyMap: keyMapProp, onChange, showIndex, value, width, }: Props): ReactElement;
@@ -1,30 +0,0 @@
1
- import type { AnsiColors } from "@visulima/colorize";
2
- import type { ReactElement, ReactNode } from "react";
3
- import type { LiteralUnion } from "type-fest";
4
- export type TagVariant = "outline" | "solid" | "subtle";
5
- export 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
- * @param props See {@link Props}.
28
- * @returns A `ReactElement` rendering the tag in the requested variant.
29
- */
30
- export default function Tag({ children, color, icon, variant }: Props): ReactElement;
@@ -1,48 +0,0 @@
1
- /**
2
- * Text input component for Ink.
3
- *
4
- * Inspired by ink-ui TextInput by Vadim Demedes and ink-text-input by Sindre Sorhus.
5
- * @see https://github.com/vadimdemedes/ink-ui
6
- *
7
- * MIT License
8
- * Copyright (c) Vadym Demedes (github.com/vadimdemedes)
9
- */
10
- import type { ReactElement } from "react";
11
- export type Props = {
12
- /** @default "" */
13
- readonly defaultValue?: string;
14
- /**
15
- * When true, all input is ignored and text is dimmed.
16
- * @default false
17
- */
18
- readonly isDisabled?: boolean;
19
- /**
20
- * When true, renders asterisks instead of the actual characters.
21
- * @default false
22
- */
23
- readonly mask?: boolean;
24
- /**
25
- * Fires on every keystroke with the updated text.
26
- */
27
- readonly onChange?: (value: string) => void;
28
- /**
29
- * Fires when the user presses Enter.
30
- */
31
- readonly onSubmit?: (value: string) => void;
32
- /**
33
- * Greyed-out text shown when the input is empty.
34
- */
35
- readonly placeholder?: string;
36
- /**
37
- * Autocomplete candidates. The first case-sensitive prefix match is shown
38
- * dimmed after the current input. Press right-arrow or Enter to accept.
39
- */
40
- readonly suggestions?: ReadonlyArray<string>;
41
- };
42
- /**
43
- * A single-line text input with cursor navigation, optional placeholder,
44
- * autocomplete suggestions, and password masking.
45
- *
46
- * Supports arrow keys, Home/End, Ctrl+A/E, Ctrl+U/K/W, Backspace, Delete.
47
- */
48
- export default function TextInput({ defaultValue, isDisabled, mask, onChange, onSubmit, placeholder, suggestions }: Props): ReactElement;
@@ -1,63 +0,0 @@
1
- import type { AnsiColors } from "@visulima/colorize";
2
- import type { ReactElement, ReactNode } from "react";
3
- import type { LiteralUnion } from "type-fest";
4
- import type { Styles } from "../styles.d.ts";
5
- export type Props = {
6
- /**
7
- * Hide the element from screen readers.
8
- */
9
- readonly "aria-hidden"?: boolean;
10
- /**
11
- * A label for the element for screen readers.
12
- */
13
- readonly "aria-label"?: string;
14
- /**
15
- * Same as `color`, but for the background.
16
- */
17
- readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
18
- /**
19
- * Make the text bold.
20
- */
21
- readonly bold?: boolean;
22
- readonly children?: ReactNode;
23
- /**
24
- * Change text color. Ink uses @visulima/colorize under the hood, so all its functionality is supported.
25
- */
26
- readonly color?: LiteralUnion<AnsiColors, string>;
27
- /**
28
- * Dim the color (make it less bright).
29
- */
30
- readonly dimColor?: boolean;
31
- /**
32
- * Inverse background and foreground colors.
33
- */
34
- readonly inverse?: boolean;
35
- /**
36
- * Make the text italic.
37
- */
38
- readonly italic?: boolean;
39
- /**
40
- * Make the text crossed out with a line.
41
- */
42
- readonly strikethrough?: boolean;
43
- /**
44
- * Make the text underlined.
45
- */
46
- readonly underline?: boolean;
47
- /**
48
- * Controls how text wraps when it exceeds the container width.
49
- *
50
- * - `wrap` (default) — Wrap at word boundaries; break inside words only when a single word exceeds the width.
51
- * - `wrap-anywhere` — Break at any character boundary, even when a whitespace break exists earlier.
52
- * - `wrap-preserve-words` — Wrap at word boundaries; never break inside words (long words may overflow).
53
- * - `wrap-strict` — Enforce exact width; always break at the column limit.
54
- * - `truncate` / `truncate-end` — Truncate at the end with an ellipsis.
55
- * - `truncate-start` — Truncate at the start with an ellipsis.
56
- * - `truncate-middle` — Truncate in the middle with an ellipsis.
57
- */
58
- readonly wrap?: Styles["textWrap"];
59
- };
60
- /**
61
- * This component can display text and change its style to make it bold, underlined, italic, or strikethrough.
62
- */
63
- export default function Text({ "aria-hidden": ariaHidden, "aria-label": ariaLabel, backgroundColor, bold, children, color, dimColor, inverse, italic, strikethrough, underline, wrap, }: Props): ReactElement | null;