@visulima/tui 1.0.0-alpha.3 → 1.0.0-alpha.5

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 (250) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/LICENSE.md +140 -0
  3. package/README.md +3 -3
  4. package/dist/core/index.d.ts +58 -5
  5. package/dist/ink/index.d.ts +6592 -294
  6. package/dist/ink/index.js +1 -1
  7. package/dist/packem_shared/{Histogram-cgAjY5AJ.js → Histogram-CB6XcmZW.js} +1 -1
  8. package/dist/packem_shared/input.d-Bfq7oc06.d.ts +90 -0
  9. package/dist/packem_shared/render.d-CNIzVQTh.d.ts +1257 -0
  10. package/dist/react/index.d.ts +519 -8
  11. package/dist/testing/index.d.ts +274 -135
  12. package/package.json +15 -16
  13. package/dist/core/app.d.ts +0 -50
  14. package/dist/core/cell.d.ts +0 -33
  15. package/dist/core/inline.d.ts +0 -22
  16. package/dist/core/input.d.ts +0 -18
  17. package/dist/core/native-binding.d.ts +0 -22
  18. package/dist/ink/ansi-to-cell.d.ts +0 -5
  19. package/dist/ink/ansi-tokenizer.d.ts +0 -38
  20. package/dist/ink/canvas/braille.d.ts +0 -22
  21. package/dist/ink/canvas/buffer.d.ts +0 -67
  22. package/dist/ink/clipboard.d.ts +0 -29
  23. package/dist/ink/color-matrix.d.ts +0 -49
  24. package/dist/ink/color-utils.d.ts +0 -30
  25. package/dist/ink/colorize.d.ts +0 -4
  26. package/dist/ink/components/accessibility-context.d.ts +0 -4
  27. package/dist/ink/components/accordion.d.ts +0 -52
  28. package/dist/ink/components/alert.d.ts +0 -30
  29. package/dist/ink/components/animate-presence.d.ts +0 -15
  30. package/dist/ink/components/animation-context.d.ts +0 -10
  31. package/dist/ink/components/app-context.d.ts +0 -38
  32. package/dist/ink/components/app.d.ts +0 -19
  33. package/dist/ink/components/approval-prompt.d.ts +0 -55
  34. package/dist/ink/components/area-chart.d.ts +0 -54
  35. package/dist/ink/components/background-context.d.ts +0 -5
  36. package/dist/ink/components/badge.d.ts +0 -27
  37. package/dist/ink/components/bar-chart.d.ts +0 -57
  38. package/dist/ink/components/big-text.d.ts +0 -71
  39. package/dist/ink/components/blink-dot.d.ts +0 -30
  40. package/dist/ink/components/box.d.ts +0 -58
  41. package/dist/ink/components/breadcrumb.d.ts +0 -28
  42. package/dist/ink/components/button.d.ts +0 -38
  43. package/dist/ink/components/calendar.d.ts +0 -60
  44. package/dist/ink/components/canvas.d.ts +0 -38
  45. package/dist/ink/components/card.d.ts +0 -46
  46. package/dist/ink/components/chart-utils.d.ts +0 -54
  47. package/dist/ink/components/checkbox.d.ts +0 -39
  48. package/dist/ink/components/code.d.ts +0 -46
  49. package/dist/ink/components/collapsible.d.ts +0 -43
  50. package/dist/ink/components/command-block.d.ts +0 -38
  51. package/dist/ink/components/command-palette.d.ts +0 -72
  52. package/dist/ink/components/confirm-dialog.d.ts +0 -63
  53. package/dist/ink/components/confirm-input.d.ts +0 -40
  54. package/dist/ink/components/console-overlay.d.ts +0 -52
  55. package/dist/ink/components/content-switcher.d.ts +0 -49
  56. package/dist/ink/components/cursor-context.d.ts +0 -12
  57. package/dist/ink/components/cursor.d.ts +0 -43
  58. package/dist/ink/components/date-picker.d.ts +0 -53
  59. package/dist/ink/components/definition-list.d.ts +0 -37
  60. package/dist/ink/components/dialog.d.ts +0 -93
  61. package/dist/ink/components/diff-view.d.ts +0 -71
  62. package/dist/ink/components/divider.d.ts +0 -40
  63. package/dist/ink/components/error-boundary.d.ts +0 -17
  64. package/dist/ink/components/error-overview.d.ts +0 -6
  65. package/dist/ink/components/file-picker/file-picker.d.ts +0 -58
  66. package/dist/ink/components/file-picker/types.d.ts +0 -35
  67. package/dist/ink/components/file-picker/use-file-system.d.ts +0 -16
  68. package/dist/ink/components/focus-context.d.ts +0 -17
  69. package/dist/ink/components/form.d.ts +0 -74
  70. package/dist/ink/components/gauge.d.ts +0 -75
  71. package/dist/ink/components/gradient.d.ts +0 -38
  72. package/dist/ink/components/heading.d.ts +0 -27
  73. package/dist/ink/components/heatmap.d.ts +0 -51
  74. package/dist/ink/components/help.d.ts +0 -44
  75. package/dist/ink/components/histogram.d.ts +0 -52
  76. package/dist/ink/components/kbd.d.ts +0 -27
  77. package/dist/ink/components/line-chart.d.ts +0 -94
  78. package/dist/ink/components/link.d.ts +0 -34
  79. package/dist/ink/components/loading-indicator.d.ts +0 -24
  80. package/dist/ink/components/markdown.d.ts +0 -34
  81. package/dist/ink/components/masked-input.d.ts +0 -41
  82. package/dist/ink/components/menu.d.ts +0 -70
  83. package/dist/ink/components/message-bubble.d.ts +0 -35
  84. package/dist/ink/components/model-badge.d.ts +0 -32
  85. package/dist/ink/components/multi-select.d.ts +0 -63
  86. package/dist/ink/components/newline.d.ts +0 -12
  87. package/dist/ink/components/operation-tree.d.ts +0 -46
  88. package/dist/ink/components/option-list.d.ts +0 -41
  89. package/dist/ink/components/ordered-list.d.ts +0 -30
  90. package/dist/ink/components/paginator.d.ts +0 -59
  91. package/dist/ink/components/paragraph.d.ts +0 -31
  92. package/dist/ink/components/placeholder.d.ts +0 -47
  93. package/dist/ink/components/progress-bar.d.ts +0 -51
  94. package/dist/ink/components/radio-group.d.ts +0 -62
  95. package/dist/ink/components/scatter-plot.d.ts +0 -23
  96. package/dist/ink/components/scroll/controlled-scroll-view.d.ts +0 -43
  97. package/dist/ink/components/scroll/index.d.ts +0 -10
  98. package/dist/ink/components/scroll/scroll-bar-box.d.ts +0 -15
  99. package/dist/ink/components/scroll/scroll-bar.d.ts +0 -20
  100. package/dist/ink/components/scroll/scroll-list.d.ts +0 -12
  101. package/dist/ink/components/scroll/scroll-view.d.ts +0 -98
  102. package/dist/ink/components/scroll/use-state-ref.d.ts +0 -8
  103. package/dist/ink/components/search-input.d.ts +0 -46
  104. package/dist/ink/components/select-input-indicator.d.ts +0 -36
  105. package/dist/ink/components/select-input-item.d.ts +0 -43
  106. package/dist/ink/components/select-input.d.ts +0 -96
  107. package/dist/ink/components/shimmer-text.d.ts +0 -39
  108. package/dist/ink/components/slider.d.ts +0 -92
  109. package/dist/ink/components/spacer.d.ts +0 -7
  110. package/dist/ink/components/sparkline.d.ts +0 -30
  111. package/dist/ink/components/spinner.d.ts +0 -40
  112. package/dist/ink/components/static-render.d.ts +0 -40
  113. package/dist/ink/components/static.d.ts +0 -24
  114. package/dist/ink/components/status-line.d.ts +0 -30
  115. package/dist/ink/components/status-message.d.ts +0 -26
  116. package/dist/ink/components/stderr-context.d.ts +0 -16
  117. package/dist/ink/components/stdin-context.d.ts +0 -29
  118. package/dist/ink/components/stdout-context.d.ts +0 -16
  119. package/dist/ink/components/stepper.d.ts +0 -42
  120. package/dist/ink/components/stopwatch.d.ts +0 -42
  121. package/dist/ink/components/streaming-text.d.ts +0 -38
  122. package/dist/ink/components/switch.d.ts +0 -46
  123. package/dist/ink/components/tab.d.ts +0 -25
  124. package/dist/ink/components/table.d.ts +0 -80
  125. package/dist/ink/components/tabs.d.ts +0 -104
  126. package/dist/ink/components/tag.d.ts +0 -30
  127. package/dist/ink/components/text-input.d.ts +0 -48
  128. package/dist/ink/components/text.d.ts +0 -63
  129. package/dist/ink/components/textarea.d.ts +0 -62
  130. package/dist/ink/components/timer.d.ts +0 -50
  131. package/dist/ink/components/toast.d.ts +0 -41
  132. package/dist/ink/components/tooltip.d.ts +0 -36
  133. package/dist/ink/components/transform.d.ts +0 -16
  134. package/dist/ink/components/transition.d.ts +0 -53
  135. package/dist/ink/components/tree-view/theme.d.ts +0 -24
  136. package/dist/ink/components/tree-view/tree-node-map.d.ts +0 -72
  137. package/dist/ink/components/tree-view/tree-view-node.d.ts +0 -29
  138. package/dist/ink/components/tree-view/tree-view.d.ts +0 -89
  139. package/dist/ink/components/tree-view/types.d.ts +0 -55
  140. package/dist/ink/components/tree-view/use-tree-view-state.d.ts +0 -135
  141. package/dist/ink/components/tree-view/use-tree-view.d.ts +0 -26
  142. package/dist/ink/components/unordered-list.d.ts +0 -35
  143. package/dist/ink/components/variant-config.d.ts +0 -10
  144. package/dist/ink/cursor-helpers.d.ts +0 -35
  145. package/dist/ink/data-limited-lru-map.d.ts +0 -21
  146. package/dist/ink/devtools-window-polyfill.d.ts +0 -1
  147. package/dist/ink/devtools.d.ts +0 -1
  148. package/dist/ink/dom.d.ts +0 -214
  149. package/dist/ink/get-max-width.d.ts +0 -3
  150. package/dist/ink/highlighter.d.ts +0 -28
  151. package/dist/ink/hooks/use-animation.d.ts +0 -41
  152. package/dist/ink/hooks/use-app.d.ts +0 -6
  153. package/dist/ink/hooks/use-box-metrics.d.ts +0 -58
  154. package/dist/ink/hooks/use-clipboard.d.ts +0 -29
  155. package/dist/ink/hooks/use-color-blindness.d.ts +0 -33
  156. package/dist/ink/hooks/use-console-capture.d.ts +0 -43
  157. package/dist/ink/hooks/use-cursor.d.ts +0 -12
  158. package/dist/ink/hooks/use-focus-manager.d.ts +0 -42
  159. package/dist/ink/hooks/use-focus.d.ts +0 -30
  160. package/dist/ink/hooks/use-form.d.ts +0 -70
  161. package/dist/ink/hooks/use-hotkey.d.ts +0 -37
  162. package/dist/ink/hooks/use-input.d.ts +0 -149
  163. package/dist/ink/hooks/use-interval.d.ts +0 -25
  164. package/dist/ink/hooks/use-is-screen-reader-enabled.d.ts +0 -6
  165. package/dist/ink/hooks/use-key-bindings.d.ts +0 -59
  166. package/dist/ink/hooks/use-key-chord.d.ts +0 -26
  167. package/dist/ink/hooks/use-linked-scroll.d.ts +0 -41
  168. package/dist/ink/hooks/use-paste.d.ts +0 -44
  169. package/dist/ink/hooks/use-persistent-state.d.ts +0 -56
  170. package/dist/ink/hooks/use-scroll-acceleration.d.ts +0 -47
  171. package/dist/ink/hooks/use-scroll-input.d.ts +0 -34
  172. package/dist/ink/hooks/use-stderr.d.ts +0 -6
  173. package/dist/ink/hooks/use-stdin.d.ts +0 -7
  174. package/dist/ink/hooks/use-stdout.d.ts +0 -6
  175. package/dist/ink/hooks/use-stopwatch.d.ts +0 -38
  176. package/dist/ink/hooks/use-terminal-palette.d.ts +0 -19
  177. package/dist/ink/hooks/use-text-buffer.d.ts +0 -42
  178. package/dist/ink/hooks/use-text-selection.d.ts +0 -45
  179. package/dist/ink/hooks/use-timeout.d.ts +0 -24
  180. package/dist/ink/hooks/use-timer.d.ts +0 -47
  181. package/dist/ink/hooks/use-window-size.d.ts +0 -18
  182. package/dist/ink/ime-utils.d.ts +0 -25
  183. package/dist/ink/ink.d.ts +0 -190
  184. package/dist/ink/input-parser.d.ts +0 -10
  185. package/dist/ink/input-utils.d.ts +0 -16
  186. package/dist/ink/instances.d.ts +0 -3
  187. package/dist/ink/kitty-keyboard.d.ts +0 -23
  188. package/dist/ink/layout.d.ts +0 -26
  189. package/dist/ink/log-update-native.d.ts +0 -14
  190. package/dist/ink/log-update.d.ts +0 -21
  191. package/dist/ink/measure-element.d.ts +0 -147
  192. package/dist/ink/measure-text.d.ts +0 -56
  193. package/dist/ink/mouse/ansi-parser.d.ts +0 -37
  194. package/dist/ink/mouse/constants.d.ts +0 -14
  195. package/dist/ink/mouse/fullscreen.d.ts +0 -8
  196. package/dist/ink/mouse/index.d.ts +0 -20
  197. package/dist/ink/mouse/is-intersecting.d.ts +0 -18
  198. package/dist/ink/mouse/mouse-context.d.ts +0 -36
  199. package/dist/ink/mouse/mouse-provider.d.ts +0 -11
  200. package/dist/ink/mouse/use-element-position.d.ts +0 -29
  201. package/dist/ink/mouse/use-mouse-action.d.ts +0 -7
  202. package/dist/ink/mouse/use-mouse-position.d.ts +0 -7
  203. package/dist/ink/mouse/use-mouse.d.ts +0 -7
  204. package/dist/ink/mouse/use-on-mouse-click.d.ts +0 -14
  205. package/dist/ink/mouse/use-on-mouse-hover.d.ts +0 -8
  206. package/dist/ink/mouse/use-on-mouse-state.d.ts +0 -11
  207. package/dist/ink/output.d.ts +0 -75
  208. package/dist/ink/parse-keypress.d.ts +0 -22
  209. package/dist/ink/reconciler.d.ts +0 -3
  210. package/dist/ink/region.d.ts +0 -99
  211. package/dist/ink/render-background.d.ts +0 -4
  212. package/dist/ink/render-border.d.ts +0 -4
  213. package/dist/ink/render-node-to-output.d.ts +0 -38
  214. package/dist/ink/render-scrollbar.d.ts +0 -9
  215. package/dist/ink/render-sticky.d.ts +0 -44
  216. package/dist/ink/render-to-string.d.ts +0 -37
  217. package/dist/ink/render.d.ts +0 -191
  218. package/dist/ink/renderer.d.ts +0 -17
  219. package/dist/ink/resize-observer.d.ts +0 -44
  220. package/dist/ink/sanitize-ansi.d.ts +0 -2
  221. package/dist/ink/scroll.d.ts +0 -23
  222. package/dist/ink/selection.d.ts +0 -70
  223. package/dist/ink/squash-text-nodes.d.ts +0 -18
  224. package/dist/ink/style-flags.d.ts +0 -17
  225. package/dist/ink/styled-line-factory.d.ts +0 -25
  226. package/dist/ink/styled-line-serializer.d.ts +0 -18
  227. package/dist/ink/styled-line.d.ts +0 -119
  228. package/dist/ink/styles.d.ts +0 -369
  229. package/dist/ink/terminal-palette.d.ts +0 -25
  230. package/dist/ink/text-wrap.d.ts +0 -10
  231. package/dist/ink/token-to-elements.d.ts +0 -22
  232. package/dist/ink/utils/format-time.d.ts +0 -4
  233. package/dist/ink/utils.d.ts +0 -9
  234. package/dist/ink/wrap-text.d.ts +0 -3
  235. package/dist/ink/write-synchronized.d.ts +0 -4
  236. package/dist/react/devtools.d.ts +0 -27
  237. package/dist/react/focus.d.ts +0 -39
  238. package/dist/react/hooks.d.ts +0 -238
  239. package/dist/react/layout.d.ts +0 -33
  240. package/dist/react/react.d.ts +0 -57
  241. package/dist/react/reconciler.d.ts +0 -4
  242. package/dist/react/render-to-string.d.ts +0 -21
  243. package/dist/react/renderer.d.ts +0 -2
  244. package/dist/react/scene.d.ts +0 -3
  245. package/dist/react/static.d.ts +0 -39
  246. package/dist/react/styles.d.ts +0 -83
  247. package/dist/react/text-width.d.ts +0 -20
  248. package/dist/testing/keys.d.ts +0 -89
  249. package/dist/testing/screen.d.ts +0 -35
  250. package/dist/testing/wait-for.d.ts +0 -20
@@ -1,22 +0,0 @@
1
- import type { CanvasContext, CellStyle } from "./buffer.d.ts";
2
- export type BrailleGrid = {
3
- readonly cellHeight: number;
4
- readonly cellWidth: number;
5
- readonly clear: () => void;
6
- /**
7
- * Flush the accumulated pixels into the canvas, one braille character per
8
- * dirtied cell. Pass a color via `style` to apply it uniformly (mixing
9
- * colors across overlapping series requires a separate grid per series).
10
- */
11
- readonly flush: (context: CanvasContext, style?: CellStyle) => void;
12
- readonly pixelHeight: number;
13
- readonly pixelWidth: number;
14
- readonly plotLine: (x0: number, y0: number, x1: number, y1: number) => void;
15
- readonly plotPoint: (x: number, y: number) => void;
16
- };
17
- /**
18
- * Accumulator for braille-rendered charts. Tracks which sub-pixels are lit
19
- * and emits a braille character per dirtied cell on `flush`. Designed to be
20
- * allocated per chart render and thrown away.
21
- */
22
- export declare const createBrailleGrid: (cellWidth: number, cellHeight: number) => BrailleGrid;
@@ -1,67 +0,0 @@
1
- export type CanvasColor = number | string | undefined;
2
- export type CellStyle = {
3
- readonly background?: CanvasColor;
4
- readonly bold?: boolean;
5
- readonly color?: CanvasColor;
6
- readonly dim?: boolean;
7
- };
8
- /**
9
- * Reverse of the encoder. 0 → undefined; any other id returns the original
10
- * CanvasColor (preserving number vs string distinction).
11
- */
12
- type ColorDecoder = (id: number) => CanvasColor;
13
- export type CanvasContext = {
14
- /**
15
- * Clear every cell back to space + default style.
16
- */
17
- readonly clear: () => void;
18
- /**
19
- * Draw a horizontal bar using fractional block glyphs (▏▎▍▌▋▊▉█).
20
- * `fillRatio` in [0, 1] determines the filled portion.
21
- */
22
- readonly drawHBar: (x: number, y: number, w: number, fillRatio: number, style?: CellStyle) => void;
23
- /**
24
- * Draw a filled rectangle using a single character.
25
- */
26
- readonly drawRect: (x: number, y: number, w: number, h: number, char: number | string, style?: CellStyle) => void;
27
- /**
28
- * Render a string left-to-right starting at (x, y). Non-printable or
29
- * multi-byte codepoints are preserved but advance the cursor by 1 cell.
30
- */
31
- readonly drawText: (x: number, y: number, text: string, style?: CellStyle) => void;
32
- /**
33
- * Draw a vertical bar using fractional block glyphs (▁▂▃▄▅▆▇█).
34
- * `fillRatio` in [0, 1] determines the filled portion.
35
- */
36
- readonly drawVBar: (x: number, y: number, h: number, fillRatio: number, style?: CellStyle) => void;
37
- readonly height: number;
38
- /**
39
- * Set a single cell at (x, y). Out-of-bounds writes are silently ignored.
40
- */
41
- readonly setCell: (x: number, y: number, char: number | string, style?: CellStyle) => void;
42
- readonly width: number;
43
- };
44
- export type CanvasBuffer = {
45
- readonly bg: Int32Array;
46
- readonly chars: Uint32Array;
47
- readonly colorDecoder: ColorDecoder;
48
- readonly context: CanvasContext;
49
- readonly dirty: Uint8Array;
50
- readonly fg: Int32Array;
51
- readonly height: number;
52
- readonly styles: Uint32Array;
53
- readonly width: number;
54
- };
55
- /**
56
- * Allocate a canvas buffer and return a context that mutates it in place.
57
- * The buffer is typed-array backed; all mutations O(1) per cell with no
58
- * object allocation.
59
- */
60
- export declare const createCanvasBuffer: (width: number, height: number) => CanvasBuffer;
61
- /**
62
- * Serialize a buffer row into an ANSI string, coalescing adjacent cells that
63
- * share the same style. Call directly when you need to re-emit rows; row
64
- * caching lives one level up in Canvas.tsx.
65
- */
66
- export declare const serializeRow: (buffer: CanvasBuffer, row: number) => string;
67
- export {};
@@ -1,29 +0,0 @@
1
- /**
2
- * OSC 52 clipboard protocol utilities.
3
- *
4
- * OSC 52 allows terminal applications to read/write the system clipboard
5
- * via escape sequences. Format: ESC ] 52 ; <target> ; <base64-data> BEL
6
- * @see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
7
- */
8
- import type { Writable } from "node:stream";
9
- /**
10
- * Clipboard targets as defined by the OSC 52 spec.
11
- * - `c` — system clipboard
12
- * - `p` — primary selection (X11 only)
13
- * - `s` — secondary selection (X11 only)
14
- */
15
- export type ClipboardTarget = "c" | "p" | "s";
16
- /**
17
- * Check whether the current terminal likely supports OSC 52.
18
- *
19
- * Detection is best-effort based on `TERM_PROGRAM` and other env vars.
20
- * Returns `true` for known-supported terminals, `false` otherwise.
21
- */
22
- export declare const isOsc52Supported: () => boolean;
23
- export declare const writeOsc52: (stream: Writable, text: string, target?: ClipboardTarget) => void;
24
- /**
25
- * Clear the clipboard via OSC 52.
26
- * @param stream The writable stream to write the escape sequence to.
27
- * @param target The clipboard target. Defaults to `"c"`.
28
- */
29
- export declare const clearOsc52: (stream: Writable, target?: ClipboardTarget) => void;
@@ -1,49 +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
- export type ColorMatrix = readonly [readonly [number, number, number], readonly [number, number, number], readonly [number, number, number]];
12
- export type ColorBlindnessType = "achromatopsia" | "deuteranopia" | "protanopia" | "tritanopia";
13
- /**
14
- * Simulation matrices — show how colors appear to users with color vision deficiency.
15
- */
16
- export 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
- export declare const COLOR_BLINDNESS_COMPENSATION: Record<Exclude<ColorBlindnessType, "achromatopsia">, ColorMatrix>;
27
- /**
28
- * Identity matrix (no transformation).
29
- */
30
- export 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
- export declare const applyColorMatrix: (r: number, g: number, b: number, matrix: ColorMatrix) => [number, number, number];
40
- export declare const hexToRgb: (hex: string) => [number, number, number] | null;
41
- /**
42
- * Convert RGB components to a hex color string.
43
- */
44
- export 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
- export declare const transformHexColor: (hex: string, matrix: ColorMatrix) => string;
@@ -1,30 +0,0 @@
1
- /**
2
- * Shared color lookup tables and parsing utilities.
3
- *
4
- * Used by styled-line-serializer.ts, styled-line-factory.ts, and output.ts
5
- * to avoid triplicate color mapping code.
6
- */
7
- /** Standard ANSI color names to 0-7 index */
8
- export declare const NAMED_COLORS: Readonly<Record<string, number>>;
9
- /** Bright ANSI color names to 8-15 index */
10
- export declare const BRIGHT_COLORS: Readonly<Record<string, number>>;
11
- /**
12
- * Parse a color string into an ANSI 256-color index (0-255).
13
- * Returns 255 (default) for unrecognized colors.
14
- */
15
- export declare const colorToAnsi256: (color: string) => number;
16
- /**
17
- * Convert a color string to SGR parameter array for escape sequences.
18
- * @param color the color string to convert
19
- * @param isFg true for foreground (30-based), false for background (40-based)
20
- */
21
- export declare const colorToSgrParams: (color: string, isFg: boolean) => number[];
22
- /**
23
- * Convert a color string to a raw ANSI escape code string.
24
- */
25
- export declare const colorToAnsiCode: (color: string, isFg: boolean) => string | undefined;
26
- /**
27
- * Convert an ANSI 256-color index to a named color string.
28
- * Standard colors (0-7) use names; everything else uses ansi256(N).
29
- */
30
- export declare const ansi256ToColorName: (index: number) => string;
@@ -1,4 +0,0 @@
1
- type ColorType = "foreground" | "background";
2
- declare const colorize: (string_: string, color: string | undefined, type: ColorType) => string;
3
- export declare const getBackgroundColorEscape: (color: string) => string | undefined;
4
- export default colorize;
@@ -1,4 +0,0 @@
1
- import type { Context } from "react";
2
- export declare const accessibilityContext: Context<{
3
- isScreenReaderEnabled: boolean;
4
- }>;
@@ -1,52 +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 AccordionItem = {
5
- /**
6
- * Content rendered when the item is expanded.
7
- */
8
- readonly content: ReactNode;
9
- /**
10
- * Unique identifier.
11
- */
12
- readonly id: string;
13
- /**
14
- * Header label.
15
- */
16
- readonly title: ReactNode;
17
- };
18
- export type Props = {
19
- /**
20
- * Accent color for the focused header.
21
- * @default "blue"
22
- */
23
- readonly accentColor?: LiteralUnion<AnsiColors, string>;
24
- /**
25
- * When true, multiple panels can be open at once.
26
- * @default false
27
- */
28
- readonly allowMultiple?: boolean;
29
- /**
30
- * Auto-focus the first item on mount.
31
- */
32
- readonly autoFocus?: boolean;
33
- /**
34
- * Initially open item ids.
35
- */
36
- readonly defaultExpanded?: ReadonlyArray<string>;
37
- /**
38
- * Disable interaction.
39
- */
40
- readonly isDisabled?: boolean;
41
- /**
42
- * List of panels.
43
- */
44
- readonly items: ReadonlyArray<AccordionItem>;
45
- };
46
- /**
47
- * Keyboard-navigable accordion. Use arrow keys to move between panels and
48
- * Enter / Space to toggle.
49
- * @param props See {@link Props}.
50
- * @returns A `ReactElement` rendering the accordion column.
51
- */
52
- export default function Accordion({ accentColor, allowMultiple, autoFocus, defaultExpanded, isDisabled, items, }: Props): ReactElement;
@@ -1,30 +0,0 @@
1
- /**
2
- * Alert component for Ink.
3
- *
4
- * Inspired by ink-ui Alert 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 AlertVariant = Variant;
13
- export type Props = {
14
- /**
15
- * Alert message content.
16
- */
17
- readonly children: ReactNode;
18
- /**
19
- * Optional heading displayed above the message.
20
- */
21
- readonly title?: string;
22
- /**
23
- * Determines the border color and icon.
24
- */
25
- readonly variant: AlertVariant;
26
- };
27
- /**
28
- * Renders a bordered alert box with a variant-specific icon, optional title, and message.
29
- */
30
- export default function Alert({ children, title, variant }: Props): ReactElement;
@@ -1,15 +0,0 @@
1
- import type { ReactElement, ReactNode } from "react";
2
- export type Props = {
3
- /**
4
- * Keyed children. Any child that accepts a `show: boolean` prop and calls
5
- * `onExit` when its exit transition finishes (such as `&lt;Transition />`) is
6
- * orchestrated automatically. Other children render as-is.
7
- */
8
- readonly children: ReactNode;
9
- };
10
- /**
11
- * Orchestrates enter / exit animations for keyed children. Wrap a dynamic
12
- * list of `&lt;Transition />` (or any component accepting `show` + `onExit`) to
13
- * keep outgoing children mounted until their exit animation finishes.
14
- */
15
- export default function AnimatePresence({ children }: Props): ReactElement;
@@ -1,10 +0,0 @@
1
- import type { Context } from "react";
2
- type AnimationContextValue = {
3
- readonly renderThrottleMs: number;
4
- readonly subscribe: (callback: (currentTime: number) => void, interval: number) => {
5
- readonly startTime: number;
6
- readonly unsubscribe: () => void;
7
- };
8
- };
9
- declare const animationContext: Context<AnimationContextValue>;
10
- export default animationContext;
@@ -1,38 +0,0 @@
1
- import type { Context } from "react";
2
- export type Props = {
3
- /**
4
- * Exit (unmount) the whole Ink app.
5
- *
6
- * - `exit()` — resolves `waitUntilExit()` with `undefined`.
7
- * - `exit(new Error('…'))` — rejects `waitUntilExit()` with the error.
8
- * - `exit(value)` — resolves `waitUntilExit()` with `value`.
9
- */
10
- readonly exit: (errorOrResult?: Error | unknown) => void;
11
- /**
12
- * Returns a promise that settles after pending render output is flushed to stdout.
13
- * @example
14
- * ```jsx
15
- * import {useEffect} from 'react';
16
- * import {useApp} from 'ink';
17
-
18
- const Example = () => {
19
- const {waitUntilRenderFlush} = useApp();
20
-
21
- useEffect(() => {
22
- void (async () => {
23
- await waitUntilRenderFlush();
24
- runNextCommand();
25
- })();
26
- }, [waitUntilRenderFlush]);
27
-
28
- return …;
29
- };
30
- ```
31
- */
32
- readonly waitUntilRenderFlush: () => Promise<void>;
33
- };
34
- /**
35
- * `AppContext` is a React context that exposes lifecycle methods for the app.
36
- */
37
- declare const AppContext: Context<Props>;
38
- export default AppContext;
@@ -1,19 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import React from "react";
3
- import type { CursorPosition } from "../log-update.d.ts";
4
- type Props = {
5
- readonly children: ReactNode;
6
- readonly exitOnCtrlC: boolean;
7
- readonly interactive: boolean;
8
- readonly onExit: (errorOrResult?: unknown) => void;
9
- readonly onWaitUntilRenderFlush: () => Promise<void>;
10
- readonly renderThrottleMs: number;
11
- readonly setCursorPosition: (position: CursorPosition | undefined) => void;
12
- readonly stderr: NodeJS.WriteStream;
13
- readonly stdin: NodeJS.ReadStream;
14
- readonly stdout: NodeJS.WriteStream;
15
- readonly writeToStderr: (data: string) => void;
16
- readonly writeToStdout: (data: string) => void;
17
- };
18
- declare const _default: React.FC<Props>;
19
- export default _default;
@@ -1,55 +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 ApprovalRisk = "high" | "low" | "medium";
5
- export type ApprovalDecision = "allow-always" | "allow-once" | "deny";
6
- export type Props = {
7
- /**
8
- * Accent color for the highlighted option letters. Overrides the risk color.
9
- */
10
- readonly accentColor?: LiteralUnion<AnsiColors, string>;
11
- /**
12
- * Auto-focus the prompt on mount. Set to `false` if a parent already
13
- * owns focus and routes input to this component.
14
- * @default true
15
- */
16
- readonly autoFocus?: boolean;
17
- /**
18
- * Optional body rendered between the header and the prompt line (e.g. a
19
- * rendered diff or command preview).
20
- */
21
- readonly children?: ReactNode;
22
- /**
23
- * Accessible description of what approving will do.
24
- */
25
- readonly description?: string;
26
- /**
27
- * Disable input; use when a parent manages focus and input routing.
28
- */
29
- readonly isDisabled?: boolean;
30
- /**
31
- * Resolution callback. Called once the user answers.
32
- */
33
- readonly onDecision: (decision: ApprovalDecision) => void;
34
- /**
35
- * Params shown as a compact key=value preview.
36
- */
37
- readonly params?: Readonly<Record<string, unknown>>;
38
- /**
39
- * Severity badge; controls the border color.
40
- * @default "medium"
41
- */
42
- readonly risk?: ApprovalRisk;
43
- /**
44
- * Name of the tool / action under review.
45
- */
46
- readonly tool: string;
47
- };
48
- /**
49
- * Three-way approval prompt for tool calls. Resolves via `onDecision`:
50
- * `y` / Enter → allow-once, `a` → allow-always, `n` / Esc → deny.
51
- * @param props See {@link Props}.
52
- * @returns A bordered `ReactElement` containing the risk banner, params
53
- * preview, optional body, and the prompt line.
54
- */
55
- export default function ApprovalPrompt({ accentColor, autoFocus, children, description, isDisabled, onDecision, params, risk, tool, }: Props): ReactElement;
@@ -1,54 +0,0 @@
1
- import type { AnsiColors } from "@visulima/colorize";
2
- import type { ReactElement } from "react";
3
- import type { LiteralUnion } from "type-fest";
4
- import type { LineSeries } from "./line-chart.d.ts";
5
- export type Props = {
6
- /**
7
- * Axis label color.
8
- * @default "gray"
9
- */
10
- readonly axisColor?: LiteralUnion<AnsiColors, string>;
11
- /**
12
- * Density of the shaded fill below each line.
13
- * - `light` → `░`
14
- * - `medium` → `▒` (default)
15
- * - `heavy` → `▓`
16
- */
17
- readonly fillDensity?: "heavy" | "light" | "medium";
18
- /**
19
- * Chart body height in character rows.
20
- * @default 10
21
- */
22
- readonly height?: number;
23
- /**
24
- * Upper bound for the y-axis.
25
- */
26
- readonly maxY?: number;
27
- /**
28
- * Lower bound for the y-axis.
29
- */
30
- readonly minY?: number;
31
- /**
32
- * Fallback palette.
33
- */
34
- readonly palette?: ReadonlyArray<LiteralUnion<AnsiColors, string>>;
35
- /**
36
- * Series to plot.
37
- */
38
- readonly series: ReadonlyArray<LineSeries>;
39
- /**
40
- * Render the legend below the plot.
41
- * @default true
42
- */
43
- readonly showLegend?: boolean;
44
- /**
45
- * Chart body width in character columns.
46
- * @default 40
47
- */
48
- readonly width?: number;
49
- };
50
- /**
51
- * Area chart: line chart with the area between the line and the baseline
52
- * filled with shaded blocks.
53
- */
54
- export default function AreaChart({ axisColor, fillDensity, height, maxY, minY, palette, series, showLegend, width, }: Props): ReactElement;
@@ -1,5 +0,0 @@
1
- import type { AnsiColors } from "@visulima/colorize";
2
- import type { Context } from "react";
3
- import type { LiteralUnion } from "type-fest";
4
- export type BackgroundColor = LiteralUnion<AnsiColors, string>;
5
- export declare const backgroundContext: Context<BackgroundColor | undefined>;
@@ -1,27 +0,0 @@
1
- /**
2
- * Badge component for Ink.
3
- *
4
- * Inspired by ink-ui Badge 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 { AnsiColors } from "@visulima/colorize";
11
- import type { ReactElement, ReactNode } from "react";
12
- import type { LiteralUnion } from "type-fest";
13
- export type Props = {
14
- /**
15
- * Label content. Strings are automatically uppercased.
16
- */
17
- readonly children: ReactNode;
18
- /**
19
- * Background color for the badge.
20
- * @default "magenta"
21
- */
22
- readonly color?: LiteralUnion<AnsiColors, string>;
23
- };
24
- /**
25
- * Renders an uppercase colored label badge, useful for status indicators.
26
- */
27
- export default function Badge({ children, color }: Props): ReactElement;
@@ -1,57 +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 BarDatum = {
5
- /**
6
- * Per-bar color override. Falls back to the chart-level palette.
7
- */
8
- readonly color?: LiteralUnion<AnsiColors, string>;
9
- readonly label?: string;
10
- readonly value: number;
11
- };
12
- export type Props = {
13
- /**
14
- * Bars to render.
15
- */
16
- readonly data: ReadonlyArray<BarDatum>;
17
- /**
18
- * Total height of the plot area in character rows.
19
- * @default 10
20
- */
21
- readonly height?: number;
22
- /**
23
- * Optional upper bound for the axis. When omitted the chart uses the
24
- * largest value in `data`.
25
- */
26
- readonly max?: number;
27
- /**
28
- * Orientation of the bars.
29
- * @default "vertical"
30
- */
31
- readonly orientation?: "horizontal" | "vertical";
32
- /**
33
- * Fallback palette cycled through when a bar does not provide its own color.
34
- * @default ["cyan", "magenta", "yellow", "green", "blue", "red"]
35
- */
36
- readonly palette?: ReadonlyArray<LiteralUnion<AnsiColors, string>>;
37
- /**
38
- * Render labels underneath vertical bars (or to the left of horizontal bars).
39
- * @default true
40
- */
41
- readonly showLabels?: boolean;
42
- /**
43
- * Render numeric values next to each bar.
44
- * @default false
45
- */
46
- readonly showValues?: boolean;
47
- /**
48
- * Total width of the plot area in character columns. Defaults to
49
- * `data.length * 3` for vertical charts, or `24` for horizontal.
50
- */
51
- readonly width?: number;
52
- };
53
- /**
54
- * Bar chart rendered on top of `Canvas`. Uses fractional block glyphs for
55
- * sub-cell precision (▁▂▃▄▅▆▇█ vertical, ▏▎▍▌▋▊▉█ horizontal).
56
- */
57
- export default function BarChart({ data, height, max: maxOverride, orientation, palette, showLabels, showValues, width: widthOverride, }: Props): ReactElement;
@@ -1,71 +0,0 @@
1
- import type { ReactElement } from "react";
2
- /**
3
- * Available CFonts font faces.
4
- */
5
- type Font = "3d" | "block" | "chrome" | "grid" | "huge" | "pallet" | "shade" | "simple" | "simple3d" | "simpleBlock" | "slick" | "tiny";
6
- /**
7
- * Horizontal text alignment.
8
- */
9
- type Align = "center" | "left" | "right";
10
- /**
11
- * Terminal background color names supported by CFonts.
12
- */
13
- type BackgroundColor = "black" | "blue" | "cyan" | "green" | "magenta" | "red" | "transparent" | "white" | "yellow";
14
- type Props = {
15
- /**
16
- * Horizontal alignment of the text.
17
- * @default "left"
18
- */
19
- readonly align?: Align;
20
- /**
21
- * Background color.
22
- * @default "transparent"
23
- */
24
- readonly backgroundColor?: BackgroundColor;
25
- /**
26
- * Colors to use for the font. Accepts color names, hex values, or `"system"` for terminal default.
27
- * @default ["system"]
28
- */
29
- readonly colors?: string[];
30
- /**
31
- * Font face to use.
32
- * @default "block"
33
- * @see https://github.com/dominikwilkowski/cfonts#supported-fonts
34
- */
35
- readonly font?: Font;
36
- /**
37
- * Letter spacing.
38
- * @default 1
39
- */
40
- readonly letterSpacing?: number;
41
- /**
42
- * Line height.
43
- * @default 1
44
- */
45
- readonly lineHeight?: number;
46
- /**
47
- * Maximum character length per line. `0` means no limit.
48
- * @default 0
49
- */
50
- readonly maxLength?: number;
51
- /**
52
- * Whether to add an empty line on top and at the bottom of the output.
53
- * @default true
54
- */
55
- readonly space?: boolean;
56
- /**
57
- * The text to render in a large font.
58
- */
59
- readonly text: string;
60
- };
61
- /**
62
- * Render large terminal text using CFonts.
63
- * @example
64
- * ```tsx
65
- * import { BigText } from "@visulima/tui/ink";
66
- *
67
- * <BigText text="Hello" font="block" />
68
- * ```
69
- */
70
- export default function BigText({ align, backgroundColor, colors, font, letterSpacing, lineHeight, maxLength, space, text }: Props): ReactElement;
71
- export type { Align, BackgroundColor, Font, Props };