@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,119 +0,0 @@
1
- /**
2
- * Columnar data structure for a single line of styled terminal text.
3
- *
4
- * Instead of one heap-allocated object per visible character, StyledLine stores:
5
- *
6
- * - `text: string` — concatenated raw character values
7
- * - `charData: number[]` — per-character: 30-bit offset into text | 1-bit full-width flag
8
- * - `spans: StyleSpan[]` — run-length encoded style information
9
- *
10
- * For an 80-column line this reduces allocations from ~80 objects to
11
- * 1 string + 1 array + typically 1-5 span objects.
12
- *
13
- * Ported from jacob314/ink (Google LLC, Apache-2.0).
14
- * @license Apache-2.0
15
- * Copyright 2026 Google LLC
16
- * SPDX-License-Identifier: Apache-2.0
17
- */
18
- export type StyleSpan = {
19
- bgColor?: string;
20
- fgColor?: string;
21
- formatFlags: number;
22
- length: number;
23
- link?: string;
24
- };
25
- export declare class StyledLine {
26
- [Symbol.iterator]: () => Iterator<{
27
- bgColor?: string;
28
- fgColor?: string;
29
- formatFlags: number;
30
- fullWidth: boolean;
31
- hasStyles: boolean;
32
- link?: string;
33
- value: string;
34
- }>;
35
- length: number;
36
- private static readonly emptyCache;
37
- private text;
38
- private charData;
39
- private spans;
40
- private _cachedTrimmedLength?;
41
- static empty(length: number): StyledLine;
42
- getValue(index: number): string;
43
- /**
44
- * Get the raw text for a range of characters as a single string slice.
45
- * Much faster than calling getValue() per character.
46
- */
47
- getTextRange(start: number, end: number): string;
48
- getSpan(index: number): StyleSpan | undefined;
49
- getFullWidth(index: number): boolean;
50
- hasStyles(index: number): boolean;
51
- getFormatFlags(index: number): number;
52
- getFgColor(index: number): string | undefined;
53
- getBgColor(index: number): string | undefined;
54
- getLink(index: number): string | undefined;
55
- setInverted(index: number, inverted: boolean): void;
56
- setBackgroundColor(index: number, color: string | undefined): void;
57
- setForegroundColor(index: number, color: string | undefined): void;
58
- setChar(index: number, value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
59
- /**
60
- * Optimized setChar for same-length single-byte replacement.
61
- * Skips string rebuild and offset adjustment when old and new values
62
- * have the same byte length (the common case for ASCII overwrites on empty lines).
63
- */
64
- setCharFast(index: number, value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
65
- /**
66
- * Overwrite a range of this line with content from a source StyledLine.
67
- * More efficient than calling setChar() per character because it does
68
- * a single span split + rebuild instead of per-character span manipulation.
69
- * @param destinationStart — start index in this line
70
- * @param source — the StyledLine to copy from
71
- * @param srcStart — start index in source (default 0)
72
- * @param count — number of characters to copy (default: source.length)
73
- */
74
- writeFrom(destinationStart: number, source: StyledLine, srcStart?: number, count?: number): void;
75
- pushChar(value: string, formatFlags: number, fgColor?: string, bgColor?: string, link?: string): void;
76
- clone(): StyledLine;
77
- slice(start: number, end?: number): StyledLine;
78
- combine(...others: StyledLine[]): StyledLine;
79
- getTrimmedLength(): number;
80
- trimEnd(): StyledLine;
81
- equals(other: StyledLine): boolean;
82
- getText(): string;
83
- getSpans(): StyleSpan[];
84
- getValues(): string[];
85
- [Symbol.iterator](): Iterator<{
86
- bgColor?: string;
87
- fgColor?: string;
88
- formatFlags: number;
89
- fullWidth: boolean;
90
- hasStyles: boolean;
91
- link?: string;
92
- value: string;
93
- }>;
94
- /**
95
- * Split the span at `index` into a single-char span, apply the updater,
96
- * then merge adjacent spans. Shared by setInverted/setBackgroundColor/setForegroundColor.
97
- */
98
- private updateSpanAt;
99
- /**
100
- * Grow the line to at least `minWidth` columns, filling new cells with
101
- * empty strings (zero-width placeholders). This matches the behavior of
102
- * sparse JS arrays in the original ink Output where out-of-bounds writes
103
- * created gaps that produced no visible output.
104
- */
105
- ensureWidth(minWidth: number): void;
106
- private ensureInitialized;
107
- private splitSpansAt;
108
- /**
109
- * Try to apply a single-char style at `index` by matching or merging
110
- * with an adjacent span, avoiding splitSpansAt + mergeSpans.
111
- *
112
- * Returns true if the style was applied (or was already correct),
113
- * false if the caller must fall through to the split/update/merge path.
114
- *
115
- * Ported from jacob314/ink PR #123 (Google LLC, Apache-2.0).
116
- */
117
- private trySetStyleAtIndex;
118
- private mergeSpans;
119
- }
@@ -1,369 +0,0 @@
1
- import type { AnsiColors } from "@visulima/colorize";
2
- import type { Boxes, BoxStyle } from "cli-boxes";
3
- import type { LiteralUnion } from "type-fest";
4
- import type { Node as YogaNode } from "yoga-layout";
5
- export type Styles = {
6
- /**
7
- * It defines the alignment along the cross axis when there are multiple lines of flex items (when using flex-wrap).
8
- * See [align-content](https://css-tricks.com/almanac/properties/a/align-content/).
9
- */
10
- readonly alignContent?: "flex-start" | "flex-end" | "center" | "stretch" | "space-between" | "space-around" | "space-evenly";
11
- /**
12
- * The align-items property defines the default behavior for how items are laid out along the cross axis (perpendicular to the main axis).
13
- * See [align-items](https://css-tricks.com/almanac/properties/a/align-items/).
14
- */
15
- readonly alignItems?: "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
16
- /**
17
- * It makes possible to override the align-items value for specific flex items.
18
- * See [align-self](https://css-tricks.com/almanac/properties/a/align-self/).
19
- */
20
- readonly alignSelf?: "flex-start" | "center" | "flex-end" | "auto" | "stretch" | "baseline";
21
- /**
22
- * Defines the aspect ratio (width/height) for the element.
23
- *
24
- * Use it with at least one size constraint (`width`, `height`, `minHeight`, or `maxHeight`) so Ink can derive the missing dimension.
25
- */
26
- readonly aspectRatio?: number;
27
- /**
28
- * Background color for the element.
29
- *
30
- * Accepts the same values as `color` in the `&lt;Text>` component.
31
- */
32
- readonly backgroundColor?: LiteralUnion<AnsiColors, string>;
33
- /**
34
- * Change border background color. A shorthand for setting `borderTopBackgroundColor`, `borderRightBackgroundColor`, `borderBottomBackgroundColor`, and `borderLeftBackgroundColor`.
35
- */
36
- readonly borderBackgroundColor?: LiteralUnion<AnsiColors, string>;
37
- /**
38
- * Determines whether the bottom border is visible.
39
- * @default true
40
- */
41
- readonly borderBottom?: boolean;
42
- /**
43
- * Change the bottom border background color. Accepts the same values as `backgroundColor` in `Text` component.
44
- */
45
- readonly borderBottomBackgroundColor?: LiteralUnion<AnsiColors, string>;
46
- /**
47
- * Change the bottom border color. Accepts the same values as `color` in `Text` component.
48
- */
49
- readonly borderBottomColor?: LiteralUnion<AnsiColors, string>;
50
- /**
51
- * Dim the bottom border color.
52
- * @default false
53
- */
54
- readonly borderBottomDimColor?: boolean;
55
- /**
56
- * Text to display embedded in the bottom border line.
57
- * Rendered as: `└─ title ─────────┘`
58
- */
59
- readonly borderBottomTitle?: string;
60
- /**
61
- * Alignment of the bottom border title.
62
- * @default "left"
63
- */
64
- readonly borderBottomTitleAlignment?: "center" | "left" | "right";
65
- /**
66
- * Change border color. A shorthand for setting `borderTopColor`, `borderRightColor`, `borderBottomColor`, and `borderLeftColor`.
67
- */
68
- readonly borderColor?: LiteralUnion<AnsiColors, string>;
69
- /**
70
- * Dim the border color. A shorthand for setting `borderTopDimColor`, `borderBottomDimColor`, `borderLeftDimColor`, and `borderRightDimColor`.
71
- * @default false
72
- */
73
- readonly borderDimColor?: boolean;
74
- /**
75
- * Determines whether the left border is visible.
76
- * @default true
77
- */
78
- readonly borderLeft?: boolean;
79
- /**
80
- * Change the left border background color. Accepts the same values as `backgroundColor` in `Text` component.
81
- */
82
- readonly borderLeftBackgroundColor?: LiteralUnion<AnsiColors, string>;
83
- /**
84
- * Change the left border color. Accepts the same values as `color` in `Text` component.
85
- */
86
- readonly borderLeftColor?: LiteralUnion<AnsiColors, string>;
87
- /**
88
- * Dim the left border color.
89
- * @default false
90
- */
91
- readonly borderLeftDimColor?: boolean;
92
- /**
93
- * Determines whether the right border is visible.
94
- * @default true
95
- */
96
- readonly borderRight?: boolean;
97
- /**
98
- * Change the right border background color. Accepts the same values as `backgroundColor` in `Text` component.
99
- */
100
- readonly borderRightBackgroundColor?: LiteralUnion<AnsiColors, string>;
101
- /**
102
- * Change the right border color. Accepts the same values as `color` in `Text` component.
103
- */
104
- readonly borderRightColor?: LiteralUnion<AnsiColors, string>;
105
- /**
106
- * Dim the right border color.
107
- * @default false
108
- */
109
- readonly borderRightDimColor?: boolean;
110
- /**
111
- * Add a border with a specified style. If `borderStyle` is `undefined` (the default), no border will be added.
112
- */
113
- readonly borderStyle?: keyof Boxes | BoxStyle;
114
- /**
115
- * Determines whether the top border is visible.
116
- * @default true
117
- */
118
- readonly borderTop?: boolean;
119
- /**
120
- * Change the top border background color. Accepts the same values as `backgroundColor` in `Text` component.
121
- */
122
- readonly borderTopBackgroundColor?: LiteralUnion<AnsiColors, string>;
123
- /**
124
- * Change the top border color. Accepts the same values as `color` in `Text` component.
125
- */
126
- readonly borderTopColor?: LiteralUnion<AnsiColors, string>;
127
- /**
128
- * Dim the top border color.
129
- * @default false
130
- */
131
- readonly borderTopDimColor?: boolean;
132
- /**
133
- * Text to display on the right side of the top border line.
134
- * Rendered as: `┌─ title ──── rightTitle ─┐`
135
- */
136
- readonly borderTopRightTitle?: string;
137
- /**
138
- * Text to display embedded in the top border line.
139
- * Rendered as: `┌─ title ─────────┐`
140
- */
141
- readonly borderTopTitle?: string;
142
- /**
143
- * Alignment of the top border title.
144
- * @default "left"
145
- */
146
- readonly borderTopTitleAlignment?: "center" | "left" | "right";
147
- /**
148
- * Bottom offset for positioned elements.
149
- */
150
- readonly bottom?: number | string;
151
- /**
152
- * Size of the gap between an element's columns.
153
- */
154
- readonly columnGap?: number;
155
- /**
156
- * Set this property to `none` to hide the element.
157
- */
158
- readonly display?: "flex" | "none";
159
- /**
160
- * It specifies the initial size of the flex item, before any available space is distributed according to the flex factors.
161
- * See [flex-basis](https://css-tricks.com/almanac/properties/f/flex-basis/).
162
- */
163
- readonly flexBasis?: number | string;
164
- /**
165
- * It establishes the main-axis, thus defining the direction flex items are placed in the flex container.
166
- * See [flex-direction](https://css-tricks.com/almanac/properties/f/flex-direction/).
167
- */
168
- readonly flexDirection?: "row" | "column" | "row-reverse" | "column-reverse";
169
- /**
170
- * This property defines the ability for a flex item to grow if necessary.
171
- * See [flex-grow](https://css-tricks.com/almanac/properties/f/flex-grow/).
172
- */
173
- readonly flexGrow?: number;
174
- /**
175
- * It specifies the “flex shrink factor”, which determines how much the flex item will shrink relative to the rest of the flex items in the flex container when there isn’t enough space on the row.
176
- * See [flex-shrink](https://css-tricks.com/almanac/properties/f/flex-shrink/).
177
- */
178
- readonly flexShrink?: number;
179
- /**
180
- * It defines whether the flex items are forced in a single line or can be flowed into multiple lines. If set to multiple lines, it also defines the cross-axis which determines the direction new lines are stacked in.
181
- * See [flex-wrap](https://css-tricks.com/almanac/properties/f/flex-wrap/).
182
- */
183
- readonly flexWrap?: "nowrap" | "wrap" | "wrap-reverse";
184
- /**
185
- * Size of the gap between an element's columns and rows. A shorthand for `columnGap` and `rowGap`.
186
- */
187
- readonly gap?: number;
188
- /**
189
- * Height of the element in lines (rows). You can also set it as a percentage, which will calculate the height based on the height of the parent element.
190
- */
191
- readonly height?: number | string;
192
- /**
193
- * It defines the alignment along the main axis.
194
- * See [justify-content](https://css-tricks.com/almanac/properties/j/justify-content/).
195
- */
196
- readonly justifyContent?: "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "center";
197
- /**
198
- * Left offset for positioned elements.
199
- */
200
- readonly left?: number | string;
201
- /**
202
- * Margin on all sides. Equivalent to setting `marginTop`, `marginBottom`, `marginLeft`, and `marginRight`.
203
- */
204
- readonly margin?: number;
205
- /**
206
- * Bottom margin.
207
- */
208
- readonly marginBottom?: number;
209
- /**
210
- * Left margin.
211
- */
212
- readonly marginLeft?: number;
213
- /**
214
- * Right margin.
215
- */
216
- readonly marginRight?: number;
217
- /**
218
- * Top margin.
219
- */
220
- readonly marginTop?: number;
221
- /**
222
- * Horizontal margin. Equivalent to setting `marginLeft` and `marginRight`.
223
- */
224
- readonly marginX?: number;
225
- /**
226
- * Vertical margin. Equivalent to setting `marginTop` and `marginBottom`.
227
- */
228
- readonly marginY?: number;
229
- /**
230
- * Sets a maximum height of the element in lines (rows). You can also set it as a percentage, which will calculate the maximum height based on the height of the parent element.
231
- */
232
- readonly maxHeight?: number | string;
233
- /**
234
- * Sets a maximum width of the element.
235
- * Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
236
- */
237
- readonly maxWidth?: number | string;
238
- /**
239
- * Sets a minimum height of the element in lines (rows). You can also set it as a percentage, which will calculate the minimum height based on the height of the parent element.
240
- */
241
- readonly minHeight?: number | string;
242
- /**
243
- * Sets a minimum width of the element.
244
- * Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872.
245
- */
246
- readonly minWidth?: number | string;
247
- /**
248
- * Behavior for an element's overflow in both directions.
249
- * @default 'visible'
250
- */
251
- readonly overflow?: "visible" | "hidden" | "scroll";
252
- /**
253
- * If true, content that is scrolled out of the top of the box (when overflowY is 'scroll')
254
- * will be added to the terminal's scrollback history.
255
- *
256
- * Results are undefined if more than one scrollable region in the app has
257
- * overflowToBackbuffer enabled.
258
- *
259
- * Note: Scroll height tracking is implemented but actual backbuffer writes
260
- * require worker-based rendering (not yet ported).
261
- * @default false
262
- */
263
- readonly overflowToBackbuffer?: boolean;
264
- /**
265
- * Behavior for an element's overflow in the horizontal direction.
266
- * @default 'visible'
267
- */
268
- readonly overflowX?: "visible" | "hidden" | "scroll";
269
- /**
270
- * Behavior for an element's overflow in the vertical direction.
271
- * @default 'visible'
272
- */
273
- readonly overflowY?: "visible" | "hidden" | "scroll";
274
- /**
275
- * Padding on all sides. Equivalent to setting `paddingTop`, `paddingBottom`, `paddingLeft`, and `paddingRight`.
276
- */
277
- readonly padding?: number;
278
- /**
279
- * Bottom padding.
280
- */
281
- readonly paddingBottom?: number;
282
- /**
283
- * Left padding.
284
- */
285
- readonly paddingLeft?: number;
286
- /**
287
- * Right padding.
288
- */
289
- readonly paddingRight?: number;
290
- /**
291
- * Top padding.
292
- */
293
- readonly paddingTop?: number;
294
- /**
295
- * Horizontal padding. Equivalent to setting `paddingLeft` and `paddingRight`.
296
- */
297
- readonly paddingX?: number;
298
- /**
299
- * Vertical padding. Equivalent to setting `paddingTop` and `paddingBottom`.
300
- */
301
- readonly paddingY?: number;
302
- /**
303
- * Controls how the element is positioned.
304
- *
305
- * When `position` is `static`, `top`, `right`, `bottom`, and `left` are ignored.
306
- */
307
- readonly position?: "absolute" | "relative" | "static";
308
- /**
309
- * Right offset for positioned elements.
310
- */
311
- readonly right?: number | string;
312
- /**
313
- * Size of the gap between an element's rows.
314
- */
315
- readonly rowGap?: number;
316
- /**
317
- * Color of the scrollbar thumb when overflow is set to 'scroll'.
318
- */
319
- readonly scrollbarThumbColor?: LiteralUnion<AnsiColors, string>;
320
- /**
321
- * Horizontal scroll position (in columns). Only applies when overflowX or overflow is 'scroll'.
322
- */
323
- readonly scrollLeft?: number;
324
- /**
325
- * Vertical scroll position (in rows). Only applies when overflowY or overflow is 'scroll'.
326
- */
327
- readonly scrollTop?: number;
328
- /**
329
- * If true, and `overflowToBackbuffer` is also enabled, the `scrollHeight` of the box
330
- * will never decrease as long as the existing history remains valid.
331
- * This prevents the terminal's scrollback from being corrupted when content shrinks.
332
- *
333
- * Note: Scroll height tracking is implemented but actual backbuffer writes
334
- * require worker-based rendering (not yet ported).
335
- * @default false
336
- */
337
- readonly stableScrollback?: boolean;
338
- /**
339
- * Controls how text wraps when it exceeds the container width.
340
- *
341
- * - `wrap` (default) — Wrap at word boundaries; break inside words only when a single word exceeds the width.
342
- * - `wrap-anywhere` — Break at any character boundary, even when a whitespace break exists earlier.
343
- * - `wrap-preserve-words` — Wrap at word boundaries; never break inside words (long words may overflow).
344
- * - `wrap-strict` — Enforce exact width; always break at the column limit.
345
- * - `hard` — Alias for `wrap-strict`. Fills each line to the full column width, breaking words mid-word as needed.
346
- * - `truncate` / `truncate-end` — Truncate at the end with an ellipsis.
347
- * - `truncate-start` — Truncate at the start with an ellipsis.
348
- * - `truncate-middle` — Truncate in the middle with an ellipsis.
349
- */
350
- readonly textWrap?: "hard" | "wrap" | "wrap-anywhere" | "wrap-preserve-words" | "wrap-strict" | "end" | "middle" | "truncate-end" | "truncate" | "truncate-middle" | "truncate-start";
351
- /**
352
- * Top offset for positioned elements.
353
- */
354
- readonly top?: number | string;
355
- /**
356
- * Determines whether the user can select text within this element.
357
- * - `auto`: Default behavior, text is selectable.
358
- * - `none`: Text cannot be selected.
359
- * - `text`: Only text can be selected.
360
- * - `all`: All content is selected on click.
361
- */
362
- readonly userSelect?: "auto" | "none" | "text" | "all";
363
- /**
364
- * Width of the element in spaces. You can also set it as a percentage, which will calculate the width based on the width of the parent element.
365
- */
366
- readonly width?: number | string;
367
- };
368
- declare const styles: (node: YogaNode, style?: Styles, currentStyle?: Styles) => void;
369
- export default styles;
@@ -1,25 +0,0 @@
1
- /**
2
- * Terminal palette auto-detection via OSC escape sequences.
3
- *
4
- * Queries the terminal for its current 16-color palette, foreground,
5
- * background, and cursor colors using OSC 4/10/11/12 sequences.
6
- * @see https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands
7
- */
8
- import type { Writable } from "node:stream";
9
- export type TerminalPalette = {
10
- readonly background: string;
11
- readonly colors: ReadonlyArray<string>;
12
- readonly cursor: string;
13
- readonly foreground: string;
14
- };
15
- /**
16
- * Check if the terminal likely supports OSC palette queries.
17
- */
18
- export declare const isTerminalPaletteQuerySupported: () => boolean;
19
- /**
20
- * Query the terminal for its current color palette.
21
- * @param stdin Readable stream (typically process.stdin in raw mode)
22
- * @param stdout Writable stream (typically process.stdout)
23
- * @param timeout Per-query timeout in milliseconds (default: 500)
24
- */
25
- export declare const queryTerminalPalette: (stdin: NodeJS.ReadableStream, stdout: Writable, timeout?: number) => Promise<Partial<TerminalPalette>>;
@@ -1,10 +0,0 @@
1
- /**
2
- * StyledLine-based text wrapping and truncation.
3
- *
4
- * Operates directly on StyledLine objects to preserve ANSI styling through
5
- * wrap boundaries.
6
- *
7
- * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
8
- */
9
- import { StyledLine } from "./styled-line.d.ts";
10
- export declare const wrapOrTruncateStyledLine: (line: StyledLine, maxWidth: number, textWrap?: string) => StyledLine[];
@@ -1,22 +0,0 @@
1
- /**
2
- * Convert Shiki ThemedToken[][] to Ink React elements for terminal rendering.
3
- */
4
- import type { ReactElement } from "react";
5
- import type { ThemedToken } from "shiki";
6
- export type TokenRenderOptions = {
7
- readonly highlightLines?: ReadonlySet<number>;
8
- readonly showLineNumbers?: boolean;
9
- readonly startLine?: number;
10
- };
11
- /**
12
- * Render a single ThemedToken as a styled &lt;Text> element.
13
- */
14
- export declare const renderToken: (token: ThemedToken, key: number) => ReactElement;
15
- /**
16
- * Render a single line of tokens as inline React elements (no Box wrapper).
17
- */
18
- export declare const renderTokenLine: (tokens: ThemedToken[]) => ReactElement;
19
- /**
20
- * Convert Shiki token lines to Ink React elements with optional line numbers.
21
- */
22
- export declare const tokenLinesToElements: (lines: ThemedToken[][], options?: TokenRenderOptions) => ReactElement;
@@ -1,4 +0,0 @@
1
- /**
2
- * Format a duration in milliseconds to `MM:SS` or `HH:MM:SS` (when hours > 0).
3
- */
4
- export declare function formatDuration(ms: number): string;
@@ -1,9 +0,0 @@
1
- /**
2
- * Get the effective terminal dimensions from the given stdout stream.
3
- *
4
- * Falls back to `terminal-size` for columns in piped processes where `stdout.columns` is 0, and uses standard defaults (80×24) when dimensions cannot be determined.
5
- */
6
- export declare const getWindowSize: (stdout: NodeJS.WriteStream) => {
7
- columns: number;
8
- rows: number;
9
- };
@@ -1,3 +0,0 @@
1
- import type { Styles } from "./styles.d.ts";
2
- declare const wrapText: (text: string, maxWidth: number, wrapType: Styles["textWrap"]) => string;
3
- export default wrapText;
@@ -1,4 +0,0 @@
1
- import type { Writable } from "node:stream";
2
- export declare const bsu: string;
3
- export declare const esu: string;
4
- export declare function shouldSynchronize(stream: Writable, interactive?: boolean): boolean;
@@ -1,27 +0,0 @@
1
- /**
2
- * DevTools — optional development overlay for TUI apps.
3
- *
4
- * Wraps your app and renders a HUD in the bottom-right corner.
5
- * Render rate is measured from actual render events (not a timer guess).
6
- *
7
- * Usage:
8
- * import { DevTools } from '@visulima/tui/react'
9
- *
10
- * render(
11
- * &lt;DevTools>
12
- * &lt;MyApp />
13
- * &lt;/DevTools>
14
- * )
15
- *
16
- * Props:
17
- * enabled? boolean — show/hide without removing from tree (default: true)
18
- *
19
- * Future slots: render count, memory usage, custom metrics via props.
20
- */
21
- import React from "react";
22
- export interface DevToolsProps {
23
- children: React.ReactNode;
24
- /** Show/hide the HUD without unmounting (default: true) */
25
- enabled?: boolean;
26
- }
27
- export declare const DevTools: ({ children, enabled }: DevToolsProps) => React.ReactElement;
@@ -1,39 +0,0 @@
1
- import type { Context } from "react";
2
- import React from "react";
3
- export type FocusContextProps = {
4
- activate: (id: string) => void;
5
- activeId: string | undefined;
6
- add: (id: string, options: {
7
- autoFocus: boolean;
8
- }) => void;
9
- deactivate: (id: string) => void;
10
- disableFocus: () => void;
11
- enableFocus: () => void;
12
- focus: (id: string) => void;
13
- focusNext: () => void;
14
- focusPrevious: () => void;
15
- remove: (id: string) => void;
16
- };
17
- export declare const FocusContext: Context<FocusContextProps>;
18
- export declare const FocusProvider: React.FC<{
19
- children: React.ReactNode;
20
- }>;
21
- export type UseFocusOptions = {
22
- autoFocus?: boolean;
23
- id?: string;
24
- isActive?: boolean;
25
- };
26
- export type UseFocusResult = {
27
- focus: (id: string) => void;
28
- isFocused: boolean;
29
- };
30
- export declare const useFocus: ({ autoFocus, id: customId, isActive }?: UseFocusOptions) => UseFocusResult;
31
- export type UseFocusManagerResult = {
32
- activeId: string | undefined;
33
- disableFocus: () => void;
34
- enableFocus: () => void;
35
- focus: (id: string) => void;
36
- focusNext: () => void;
37
- focusPrevious: () => void;
38
- };
39
- export declare const useFocusManager: () => UseFocusManagerResult;