@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,147 +0,0 @@
1
- import type { DOMElement, DOMNode } from "./dom.d.ts";
2
- type Output = {
3
- /**
4
- * Element height.
5
- */
6
- height: number;
7
- /**
8
- * Element width.
9
- */
10
- width: number;
11
- /**
12
- * Element X position relative to Ink output origin.
13
- */
14
- x: number;
15
- /**
16
- * Element Y position relative to Ink output origin.
17
- */
18
- y: number;
19
- };
20
- /**
21
- * Measure the dimensions of a particular `<Box>` element.
22
- * Returns an object with `x`, `y`, `width` and `height` properties.
23
- */
24
- declare const measureElement: (node: DOMElement) => Output;
25
- export default measureElement;
26
- /**
27
- * Get an element's inner width (excluding borders).
28
- */
29
- export declare const getInnerWidth: (node: DOMElement) => number;
30
- /**
31
- * Get an element's inner height (excluding borders).
32
- */
33
- export declare const getInnerHeight: (node: DOMElement) => number;
34
- /**
35
- * Get an element's position and dimensions relative to the root,
36
- * accounting for scroll offsets of ancestor elements.
37
- */
38
- export declare const getBoundingBox: (node: DOMElement) => {
39
- height: number;
40
- width: number;
41
- x: number;
42
- y: number;
43
- };
44
- /**
45
- * Get how much scroll height was added by stableScrollback.
46
- */
47
- export declare const getAddedScrollHeight: (node: DOMElement) => number;
48
- export type ScrollbarBoundingBox = {
49
- height: number;
50
- thumb: {
51
- end: number;
52
- endHalf: number;
53
- height: number;
54
- start: number;
55
- startHalf: number;
56
- width: number;
57
- x: number;
58
- y: number;
59
- };
60
- width: number;
61
- x: number;
62
- y: number;
63
- };
64
- export declare const calculateScrollbarThumb: (options: {
65
- axis: "horizontal" | "vertical";
66
- clientDimension: number;
67
- scrollbarDimension: number;
68
- scrollDimension: number;
69
- scrollPosition: number;
70
- }) => {
71
- endIndex: number;
72
- startIndex: number;
73
- thumbEndHalf: number;
74
- thumbStartHalf: number;
75
- };
76
- export declare const calculateScrollbarLayout: (options: {
77
- axis: "horizontal" | "vertical";
78
- clientDimension: number;
79
- hasOppositeScrollbar: boolean;
80
- height: number;
81
- marginBottom: number;
82
- marginRight: number;
83
- scrollDimension: number;
84
- scrollPosition: number;
85
- width: number;
86
- x: number;
87
- y: number;
88
- }) => ScrollbarBoundingBox | undefined;
89
- /**
90
- * Get the bounding box of the vertical scrollbar.
91
- */
92
- export declare const getVerticalScrollbarBoundingBox: (node: DOMElement, offset?: {
93
- x: number;
94
- y: number;
95
- }) => ScrollbarBoundingBox | undefined;
96
- /**
97
- * Get the bounding box of the horizontal scrollbar.
98
- */
99
- export declare const getHorizontalScrollbarBoundingBox: (node: DOMElement, offset?: {
100
- x: number;
101
- y: number;
102
- }) => ScrollbarBoundingBox | undefined;
103
- /**
104
- * Get the top position of a node relative to a given ancestor.
105
- * Returns undefined if the ancestor is not in the node's parent chain.
106
- *
107
- * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
108
- */
109
- export declare const getRelativeTop: (node: DOMElement, ancestor?: DOMElement) => number | undefined;
110
- /**
111
- * Get the left position of a node relative to a given ancestor.
112
- * Returns undefined if the ancestor is not in the node's parent chain.
113
- *
114
- * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
115
- */
116
- export declare const getRelativeLeft: (node: DOMElement, ancestor?: DOMElement) => number | undefined;
117
- /**
118
- * A text fragment from the layout tree with its position and dimensions.
119
- * Used by `processLayout` for text extraction and selection.
120
- *
121
- * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
122
- */
123
- export type TextFragment = {
124
- height: number;
125
- node: DOMElement;
126
- text: string;
127
- visualX: number;
128
- visualY: number;
129
- width: number;
130
- x: number;
131
- y: number;
132
- };
133
- /**
134
- * Get the text content of a DOM node (text node value or squashed children).
135
- */
136
- export declare const getText: (node: DOMNode) => string;
137
- /**
138
- * Walk the layout tree to collect all text fragments in document order,
139
- * with their positions adjusted for borders and flex layout.
140
- *
141
- * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
142
- */
143
- export declare const collectSortedFragments: (node: DOMNode) => {
144
- fragments: TextFragment[];
145
- removedHorizontal: number;
146
- removedVertical: number;
147
- };
@@ -1,56 +0,0 @@
1
- import { StyledLine } from "./styled-line.d.ts";
2
- export type StringWidthFunction = (text: string) => number;
3
- type Output = {
4
- height: number;
5
- width: number;
6
- };
7
- /**
8
- * Enable or disable the StyledLine tokenization cache at runtime.
9
- * Disabling clears the existing cache.
10
- */
11
- export declare const setEnableStyledLineCache: (enabled: boolean) => void;
12
- /**
13
- * Clear only the StyledLine tokenization cache.
14
- */
15
- export declare const clearStyledLineCache: () => void;
16
- /**
17
- * Replace the string width function used for text measurement.
18
- * Useful for terminals with non-standard character widths.
19
- * Clears the measurement cache when called.
20
- */
21
- export declare const setStringWidthFunction: (function_: StringWidthFunction) => void;
22
- /**
23
- * Clear the string width measurement cache. Call this if the terminal
24
- * environment changes in a way that affects character widths.
25
- */
26
- export declare const clearStringWidthCache: () => void;
27
- /**
28
- * Get the visual width of a single character, with caching and error handling.
29
- *
30
- * Ported from jacob314/ink fork (Google LLC, Apache-2.0).
31
- */
32
- export declare const inkCharacterWidth: (text: string) => number;
33
- declare const measureText: (text: string) => Output;
34
- export default measureText;
35
- /**
36
- * Convert a text string to a StyledLine, with caching.
37
- * Uses the direct text → StyledLine pipeline (handles combining chars,
38
- * tabs, regional indicators, ANSI codes, etc.) without intermediate
39
- * StyledChar objects.
40
- */
41
- export declare const toStyledLine: (text: string) => StyledLine;
42
- /**
43
- * Get the total visual width of a StyledLine.
44
- */
45
- export declare const styledLineWidth: (line: StyledLine) => number;
46
- /**
47
- * Split a StyledLine by newline characters into multiple StyledLines.
48
- */
49
- export declare const splitStyledLineByNewline: (line: StyledLine) => StyledLine[];
50
- /**
51
- * Measure the dimensions of a StyledLine (width of widest line, height in lines).
52
- */
53
- export declare const measureStyledLine: (line: StyledLine) => {
54
- height: number;
55
- width: number;
56
- };
@@ -1,37 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- *
5
- * Rewritten to use a unified SGR 1006 parser with full button support.
6
- */
7
- import type { MouseButton } from "./mouse-context.d.ts";
8
- type SgrMouseEvent = {
9
- action: "press" | "release";
10
- button: MouseButton;
11
- type: "click";
12
- x: number;
13
- y: number;
14
- } | {
15
- action: "press" | "release";
16
- button: MouseButton;
17
- type: "drag";
18
- x: number;
19
- y: number;
20
- } | {
21
- type: "move";
22
- x: number;
23
- y: number;
24
- } | {
25
- direction: "scrolldown" | "scrollup";
26
- type: "scroll";
27
- x: number;
28
- y: number;
29
- };
30
- /**
31
- * Parse an SGR 1006 mouse escape sequence into a structured event.
32
- *
33
- * Returns `undefined` if the input is not a valid SGR mouse sequence.
34
- */
35
- declare const parseSgrMouse: (input: string) => SgrMouseEvent | undefined;
36
- export { parseSgrMouse };
37
- export type { SgrMouseEvent };
@@ -1,14 +0,0 @@
1
- type AnsiCodeKey = "alternateScroll" | "mouseButton" | "mouseDrag" | "mouseFocus" | "mouseHighlight" | "mouseMotion" | "mouseMotionOthers" | "mousePixelMode" | "mouseSGR" | "mouseUtf8" | "mouseX10";
2
- declare const ANSI_CODES: Record<AnsiCodeKey, {
3
- off: string;
4
- on: string;
5
- }>;
6
- /**
7
- * Unified SGR 1006 mouse sequence pattern.
8
- *
9
- * Captures: (buttonCode) (x) (y) (M|m)
10
- * - M = press/motion, m = release
11
- * - Button code includes modifier bits (shift=+4, meta=+8, ctrl=+16)
12
- */
13
- declare const SGR_MOUSE_PATTERN: RegExp;
14
- export { ANSI_CODES, SGR_MOUSE_PATTERN };
@@ -1,8 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { PropsWithChildren } from "react";
6
- import React from "react";
7
- declare const Fullscreen: ({ children }: PropsWithChildren) => React.JSX.Element;
8
- export default Fullscreen;
@@ -1,20 +0,0 @@
1
- /**
2
- * Mouse tracking for terminal UIs.
3
- *
4
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
5
- * Copyright Zeno Jiricek, licensed under Apache-2.0
6
- */
7
- export type { SgrMouseEvent } from "./ansi-parser.d.ts";
8
- export { parseSgrMouse } from "./ansi-parser.d.ts";
9
- export { default as Fullscreen } from "./fullscreen.d.ts";
10
- export { default as isIntersecting } from "./is-intersecting.d.ts";
11
- export type { MouseAction, MouseButton, MouseClickAction, MouseContextShape, MouseDragAction, MouseEvents, MousePosition, MouseScrollAction, } from "./mouse-context.d.ts";
12
- export { default as MouseProvider } from "./mouse-provider.d.ts";
13
- export { useElementDimensions, useElementPosition } from "./use-element-position.d.ts";
14
- export { default as useMouseContext } from "./use-mouse.d.ts";
15
- export { default as useMouseAction } from "./use-mouse-action.d.ts";
16
- export { default as useMousePosition } from "./use-mouse-position.d.ts";
17
- export type { UseOnMouseClickOptions } from "./use-on-mouse-click.d.ts";
18
- export { useOnMouseClick } from "./use-on-mouse-click.d.ts";
19
- export { default as useOnMouseHover } from "./use-on-mouse-hover.d.ts";
20
- export { default as useOnMouseState } from "./use-on-mouse-state.d.ts";
@@ -1,18 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { MousePosition } from "./mouse-context.d.ts";
6
- /**
7
- * Determines if the mouse position is intersecting with the element's layout bounds.
8
- */
9
- declare const isIntersecting: ({ element, mouse: { x, y }, }: {
10
- element: {
11
- height: number;
12
- left: number;
13
- top: number;
14
- width: number;
15
- };
16
- mouse: MousePosition;
17
- }) => boolean;
18
- export default isIntersecting;
@@ -1,36 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { EventEmitter } from "node:events";
6
- import type { Context } from "react";
7
- type MousePosition = {
8
- x: number;
9
- y: number;
10
- };
11
- type MouseButton = "left" | "middle" | "right";
12
- type MouseClickAction = "press" | "release" | null;
13
- type MouseScrollAction = "scrolldown" | "scrollup" | null;
14
- type MouseDragAction = "dragging" | null;
15
- type MouseAction = MouseClickAction | MouseDragAction | MouseScrollAction;
16
- /**
17
- * Internal event emitter for mouse state changes.
18
- *
19
- * Events:
20
- * - "position" (position: MousePosition)
21
- * - "click" (position: MousePosition, action: MouseClickAction, button: MouseButton)
22
- * - "scroll" (position: MousePosition, direction: MouseScrollAction)
23
- * - "drag" (position: MousePosition, action: MouseDragAction, button: MouseButton)
24
- */
25
- type MouseEvents = EventEmitter;
26
- type MouseContextShape = {
27
- readonly button: MouseButton | null;
28
- readonly click: MouseClickAction;
29
- readonly drag: MouseDragAction;
30
- readonly events: MouseEvents;
31
- readonly position: MousePosition;
32
- readonly scroll: MouseScrollAction;
33
- };
34
- declare const MouseContext: Context<MouseContextShape | null>;
35
- export { MouseContext };
36
- export type { MouseAction, MouseButton, MouseClickAction, MouseContextShape, MouseDragAction, MouseEvents, MousePosition, MouseScrollAction };
@@ -1,11 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- *
5
- * Rewritten to integrate with the ink input pipeline instead of
6
- * listening on process.stdin directly.
7
- */
8
- import type { PropsWithChildren } from "react";
9
- import React from "react";
10
- declare const MouseProvider: ({ children }: PropsWithChildren) => React.JSX.Element;
11
- export default MouseProvider;
@@ -1,29 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { RefObject } from "react";
6
- import type { DOMElement } from "../dom.d.ts";
7
- declare const getElementPosition: (node: DOMElement | null) => {
8
- left: number;
9
- top: number;
10
- } | undefined;
11
- declare const getElementDimensions: (node: DOMElement | null) => {
12
- height: number;
13
- width: number;
14
- } | undefined;
15
- /**
16
- * Stateful hook to provide the absolute position of the referenced element.
17
- */
18
- declare const useElementPosition: (ref: RefObject<DOMElement | null>, deps?: unknown[]) => {
19
- left: number;
20
- top: number;
21
- };
22
- /**
23
- * Stateful hook to provide the dimensions of the referenced element.
24
- */
25
- declare const useElementDimensions: (ref: RefObject<DOMElement | null>, deps?: unknown[]) => {
26
- height: number;
27
- width: number;
28
- };
29
- export { getElementDimensions, getElementPosition, useElementDimensions, useElementPosition };
@@ -1,7 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { MouseClickAction, MouseDragAction, MouseScrollAction } from "./mouse-context.d.ts";
6
- declare const useMouseAction: () => MouseClickAction | MouseDragAction | MouseScrollAction | null;
7
- export default useMouseAction;
@@ -1,7 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { MousePosition } from "./mouse-context.d.ts";
6
- declare const useMousePosition: () => MousePosition;
7
- export default useMousePosition;
@@ -1,7 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { MouseContextShape } from "./mouse-context.d.ts";
6
- declare const useMouseContext: () => MouseContextShape;
7
- export default useMouseContext;
@@ -1,14 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { RefObject } from "react";
6
- import type { DOMElement } from "../dom.d.ts";
7
- import type { MouseButton } from "./mouse-context.d.ts";
8
- type UseOnMouseClickOptions = {
9
- /** Filter to only respond to a specific mouse button. Defaults to all buttons. */
10
- button?: MouseButton;
11
- };
12
- declare const useOnMouseClick: (ref: RefObject<DOMElement | null>, onChange: (clicking: boolean, button?: MouseButton) => void, options?: UseOnMouseClickOptions) => void;
13
- export { useOnMouseClick };
14
- export type { UseOnMouseClickOptions };
@@ -1,8 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { RefObject } from "react";
6
- import type { DOMElement } from "../dom.d.ts";
7
- declare const useOnMouseHover: (ref: RefObject<DOMElement | null>, onChange: (event: boolean) => void) => void;
8
- export default useOnMouseHover;
@@ -1,11 +0,0 @@
1
- /**
2
- * Ported from `\@zenobius/ink-mouse` (https://github.com/zenobi-us/ink-mouse)
3
- * Copyright Zeno Jiricek, licensed under Apache-2.0
4
- */
5
- import type { RefObject } from "react";
6
- import type { DOMElement } from "../dom.d.ts";
7
- declare const useOnMouseState: (ref: RefObject<DOMElement | null>) => {
8
- clicking: boolean;
9
- hovering: boolean;
10
- };
11
- export default useOnMouseState;
@@ -1,75 +0,0 @@
1
- import type { Region } from "./region.d.ts";
2
- import type { OutputTransformer } from "./render-node-to-output.d.ts";
3
- import { StyledLine } from "./styled-line.d.ts";
4
- /**
5
- * "Virtual" output class — immediate-write model.
6
- *
7
- * Writes go directly to the StyledLine grid instead of being queued
8
- * as operations and replayed later. This eliminates the operation queue
9
- * allocation and iteration overhead.
10
- */
11
- type Options = {
12
- caches?: OutputCaches;
13
- height: number;
14
- width: number;
15
- };
16
- type Clip = {
17
- x1: number | undefined;
18
- x2: number | undefined;
19
- y1: number | undefined;
20
- y2: number | undefined;
21
- };
22
- type OutputCachesOptions = {
23
- maxEntries?: number;
24
- pruneToFactor?: number;
25
- };
26
- export declare class OutputCaches {
27
- widths: Map<string, number>;
28
- blockWidths: Map<string, number>;
29
- styledLines: Map<string, StyledLine>;
30
- lines: Map<string, string[]>;
31
- private readonly maxEntries;
32
- private readonly pruneToFactor;
33
- constructor(options?: OutputCachesOptions);
34
- getStyledLine(line: string): StyledLine;
35
- getStringWidth(text: string): number;
36
- getWidestLine(text: string): number;
37
- getLines(text: string): string[];
38
- private hasAnsiControlMarker;
39
- private setCacheEntry;
40
- private pruneCache;
41
- }
42
- export default class Output {
43
- width: number;
44
- height: number;
45
- private readonly caches;
46
- private grid;
47
- private readonly clipStack;
48
- private readonly previousLines;
49
- private readonly previousRenderedLines;
50
- private lineMemoizationEnabled;
51
- private memoizationProbeCountdown;
52
- constructor(options: Options);
53
- reset(width: number, height: number): void;
54
- startChildRegion(absX: number, absY: number, width: number, height: number): void;
55
- endChildRegion(): void;
56
- write(x: number, y: number, text: string, options: {
57
- transformers: OutputTransformer[];
58
- }): void;
59
- writeStyledLine(x: number, y: number, line: StyledLine): void;
60
- getRootLines(): ReadonlyArray<StyledLine>;
61
- getCurrentClip(): Clip | undefined;
62
- addRegionTree(region: Region, x: number, y: number): void;
63
- private writeStyledLineToRow;
64
- get(): {
65
- height: number;
66
- output: string;
67
- };
68
- getBuffer(): {
69
- buffer: Uint32Array;
70
- height: number;
71
- };
72
- private createGrid;
73
- private disableLineMemoization;
74
- }
75
- export {};
@@ -1,22 +0,0 @@
1
- import { Buffer } from "node:buffer";
2
- export declare const nonAlphanumericKeys: string[];
3
- type ParsedKey = {
4
- capsLock?: boolean;
5
- code?: string;
6
- ctrl: boolean;
7
- eventType?: "press" | "repeat" | "release";
8
- hyper?: boolean;
9
- isKittyProtocol?: boolean;
10
- isPrintable?: boolean;
11
- meta: boolean;
12
- name: string;
13
- numLock?: boolean;
14
- option: boolean;
15
- raw: string | undefined;
16
- sequence: string;
17
- shift: boolean;
18
- super?: boolean;
19
- text?: string;
20
- };
21
- declare const parseKeypress: (s?: Buffer | string) => ParsedKey;
22
- export default parseKeypress;
@@ -1,3 +0,0 @@
1
- import createReconciler from "react-reconciler";
2
- declare const reconcilerInstance: ReturnType<typeof createReconciler>;
3
- export default reconcilerInstance;
@@ -1,99 +0,0 @@
1
- /**
2
- * Region-based hierarchical output model.
3
- *
4
- * A Region represents a rectangular area of terminal output with its own
5
- * line buffer, scroll state, and child regions. Regions form a tree that
6
- * is composited into the final screen buffer via flattenRegion().
7
- *
8
- * This enables:
9
- * - Incremental rendering (only changed regions are re-composited)
10
- * - Render caching (cachedRender stores a Region for unchanged subtrees)
11
- * - Dirty tracking (terminal buffer only writes changed lines)
12
- *
13
- * Ported from jacob314/ink (Google LLC, Apache-2.0).
14
- */
15
- import type { StyledLine } from "./styled-line.d.ts";
16
- export type Region = {
17
- backgroundColor?: string;
18
- borderBottom?: number;
19
- borderTop?: number;
20
- cachedStickyHeaders?: StickyHeader[];
21
- /** Child regions (nested content areas) */
22
- children: Region[];
23
- /** Cursor position within this region */
24
- cursorPosition?: {
25
- col: number;
26
- row: number;
27
- };
28
- height: number;
29
- /** Unique identifier for this region (used for dirty tracking) */
30
- id: number | string;
31
- isHorizontallyScrollable?: boolean;
32
- /** Whether this region supports scrolling */
33
- isScrollable: boolean;
34
- isVerticallyScrollable?: boolean;
35
- /** Content buffer — StyledLine per row, relative to (0,0) of this region */
36
- readonly lines: ReadonlyArray<StyledLine>;
37
- marginBottom?: number;
38
- marginRight?: number;
39
- /** DOM node reference for debugging/caching */
40
- nodeId?: number;
41
- opaque?: boolean;
42
- /** Layout properties */
43
- overflowToBackbuffer?: boolean;
44
- scrollbarThumbColor?: string;
45
- scrollbarVisible?: boolean;
46
- scrollHeight?: number;
47
- scrollLeft?: number;
48
- /** Scroll state */
49
- scrollTop?: number;
50
- scrollWidth?: number;
51
- /** Selectable text spans for text selection */
52
- selectableSpans: SelectableSpan[];
53
- selectableText?: string;
54
- /** Whether the scrollback position is stable */
55
- stableScrollback?: boolean;
56
- /** Sticky headers for this region */
57
- stickyHeaders: StickyHeader[];
58
- /** Trimmed output (trailing spaces removed) for final rendering */
59
- readonly styledOutput: ReadonlyArray<StyledLine>;
60
- /** Dimensions */
61
- width: number;
62
- /** Position relative to parent region */
63
- x: number;
64
- y: number;
65
- };
66
- export type SelectableSpan = {
67
- endX: number;
68
- startX: number;
69
- text: string;
70
- y: number;
71
- };
72
- export type StickyHeader = {
73
- /** Lines in the natural (scrolling) position */
74
- lines: ReadonlyArray<StyledLine>;
75
- /** Height of the header in lines */
76
- maxHeaderHeight: number;
77
- /** Natural row offset relative to content start */
78
- naturalRow: number;
79
- /** Node ID for identification */
80
- nodeId: number;
81
- /** Lines in the stuck (fixed) position */
82
- stuckLines?: ReadonlyArray<StyledLine>;
83
- /** Stuck X position relative to region */
84
- x: number;
85
- /** Stuck Y position relative to region */
86
- y: number;
87
- };
88
- export type RegionNode = {
89
- children: RegionNode[];
90
- id: number | string;
91
- };
92
- /**
93
- * Compare two region trees for structural equality (same IDs in same order).
94
- */
95
- export declare const treesEqual: (a: RegionNode, b: RegionNode) => boolean;
96
- /**
97
- * Extract selectable text from a list of selectable spans.
98
- */
99
- export declare const extractSelectableText: (spans: ReadonlyArray<SelectableSpan>) => string;
@@ -1,4 +0,0 @@
1
- import type { DOMNode } from "./dom.d.ts";
2
- import type Output from "./output.d.ts";
3
- declare const renderBackground: (x: number, y: number, node: DOMNode, output: Output) => void;
4
- export default renderBackground;
@@ -1,4 +0,0 @@
1
- import type { DOMNode } from "./dom.d.ts";
2
- import type Output from "./output.d.ts";
3
- declare const renderBorder: (x: number, y: number, node: DOMNode, output: Output) => void;
4
- export default renderBorder;