@kingkoo1985/ink 6.6.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 (225) hide show
  1. package/build/colorize.d.ts +4 -0
  2. package/build/colorize.js +59 -0
  3. package/build/colorize.js.map +1 -0
  4. package/build/components/AccessibilityContext.d.ts +3 -0
  5. package/build/components/AccessibilityContext.js +5 -0
  6. package/build/components/AccessibilityContext.js.map +1 -0
  7. package/build/components/App.d.ts +68 -0
  8. package/build/components/App.js +290 -0
  9. package/build/components/App.js.map +1 -0
  10. package/build/components/AppContext.d.ts +52 -0
  11. package/build/components/AppContext.js +16 -0
  12. package/build/components/AppContext.js.map +1 -0
  13. package/build/components/BackgroundContext.d.ts +4 -0
  14. package/build/components/BackgroundContext.js +3 -0
  15. package/build/components/BackgroundContext.js.map +1 -0
  16. package/build/components/Box.d.ts +171 -0
  17. package/build/components/Box.js +40 -0
  18. package/build/components/Box.js.map +1 -0
  19. package/build/components/ErrorOverview.d.ts +6 -0
  20. package/build/components/ErrorOverview.js +84 -0
  21. package/build/components/ErrorOverview.js.map +1 -0
  22. package/build/components/FocusContext.d.ts +16 -0
  23. package/build/components/FocusContext.js +16 -0
  24. package/build/components/FocusContext.js.map +1 -0
  25. package/build/components/Newline.d.ts +13 -0
  26. package/build/components/Newline.js +8 -0
  27. package/build/components/Newline.js.map +1 -0
  28. package/build/components/Spacer.d.ts +7 -0
  29. package/build/components/Spacer.js +11 -0
  30. package/build/components/Spacer.js.map +1 -0
  31. package/build/components/Static.d.ts +24 -0
  32. package/build/components/Static.js +29 -0
  33. package/build/components/Static.js.map +1 -0
  34. package/build/components/StaticRender.d.ts +8 -0
  35. package/build/components/StaticRender.js +19 -0
  36. package/build/components/StaticRender.js.map +1 -0
  37. package/build/components/StderrContext.d.ts +15 -0
  38. package/build/components/StderrContext.js +12 -0
  39. package/build/components/StderrContext.js.map +1 -0
  40. package/build/components/StdinContext.d.ts +22 -0
  41. package/build/components/StdinContext.js +16 -0
  42. package/build/components/StdinContext.js.map +1 -0
  43. package/build/components/StdoutContext.d.ts +15 -0
  44. package/build/components/StdoutContext.js +12 -0
  45. package/build/components/StdoutContext.js.map +1 -0
  46. package/build/components/Text.d.ts +63 -0
  47. package/build/components/Text.js +50 -0
  48. package/build/components/Text.js.map +1 -0
  49. package/build/components/Transform.d.ts +16 -0
  50. package/build/components/Transform.js +15 -0
  51. package/build/components/Transform.js.map +1 -0
  52. package/build/data-limited-lru-map.d.ts +20 -0
  53. package/build/data-limited-lru-map.js +65 -0
  54. package/build/data-limited-lru-map.js.map +1 -0
  55. package/build/debug-log.d.ts +2 -0
  56. package/build/debug-log.js +44 -0
  57. package/build/debug-log.js.map +1 -0
  58. package/build/devtools-window-polyfill.d.ts +1 -0
  59. package/build/devtools-window-polyfill.js +65 -0
  60. package/build/devtools-window-polyfill.js.map +1 -0
  61. package/build/devtools.d.ts +1 -0
  62. package/build/devtools.js +8 -0
  63. package/build/devtools.js.map +1 -0
  64. package/build/dom.d.ts +114 -0
  65. package/build/dom.js +169 -0
  66. package/build/dom.js.map +1 -0
  67. package/build/get-max-width.d.ts +3 -0
  68. package/build/get-max-width.js +10 -0
  69. package/build/get-max-width.js.map +1 -0
  70. package/build/hooks/use-app.d.ts +5 -0
  71. package/build/hooks/use-app.js +8 -0
  72. package/build/hooks/use-app.js.map +1 -0
  73. package/build/hooks/use-focus-manager.d.ts +28 -0
  74. package/build/hooks/use-focus-manager.js +17 -0
  75. package/build/hooks/use-focus-manager.js.map +1 -0
  76. package/build/hooks/use-focus.d.ts +29 -0
  77. package/build/hooks/use-focus.js +42 -0
  78. package/build/hooks/use-focus.js.map +1 -0
  79. package/build/hooks/use-input.d.ts +93 -0
  80. package/build/hooks/use-input.js +92 -0
  81. package/build/hooks/use-input.js.map +1 -0
  82. package/build/hooks/use-is-screen-reader-enabled.d.ts +5 -0
  83. package/build/hooks/use-is-screen-reader-enabled.js +11 -0
  84. package/build/hooks/use-is-screen-reader-enabled.js.map +1 -0
  85. package/build/hooks/use-stderr.d.ts +5 -0
  86. package/build/hooks/use-stderr.js +8 -0
  87. package/build/hooks/use-stderr.js.map +1 -0
  88. package/build/hooks/use-stdin.d.ts +5 -0
  89. package/build/hooks/use-stdin.js +8 -0
  90. package/build/hooks/use-stdin.js.map +1 -0
  91. package/build/hooks/use-stdout.d.ts +5 -0
  92. package/build/hooks/use-stdout.js +8 -0
  93. package/build/hooks/use-stdout.js.map +1 -0
  94. package/build/index.d.ts +38 -0
  95. package/build/index.js +27 -0
  96. package/build/index.js.map +1 -0
  97. package/build/ink.d.ts +110 -0
  98. package/build/ink.js +576 -0
  99. package/build/ink.js.map +1 -0
  100. package/build/instances.d.ts +3 -0
  101. package/build/instances.js +8 -0
  102. package/build/instances.js.map +1 -0
  103. package/build/layout.d.ts +18 -0
  104. package/build/layout.js +54 -0
  105. package/build/layout.js.map +1 -0
  106. package/build/log-update.d.ts +28 -0
  107. package/build/log-update.js +529 -0
  108. package/build/log-update.js.map +1 -0
  109. package/build/measure-element.d.ts +119 -0
  110. package/build/measure-element.js +825 -0
  111. package/build/measure-element.js.map +1 -0
  112. package/build/measure-text.d.ts +50 -0
  113. package/build/measure-text.js +237 -0
  114. package/build/measure-text.js.map +1 -0
  115. package/build/output.d.ts +242 -0
  116. package/build/output.js +607 -0
  117. package/build/output.js.map +1 -0
  118. package/build/parse-keypress.d.ts +14 -0
  119. package/build/parse-keypress.js +225 -0
  120. package/build/parse-keypress.js.map +1 -0
  121. package/build/reconciler.d.ts +4 -0
  122. package/build/reconciler.js +326 -0
  123. package/build/reconciler.js.map +1 -0
  124. package/build/render-background.d.ts +4 -0
  125. package/build/render-background.js +37 -0
  126. package/build/render-background.js.map +1 -0
  127. package/build/render-border.d.ts +4 -0
  128. package/build/render-border.js +81 -0
  129. package/build/render-border.js.map +1 -0
  130. package/build/render-cached.d.ts +18 -0
  131. package/build/render-cached.js +66 -0
  132. package/build/render-cached.js.map +1 -0
  133. package/build/render-container.d.ts +27 -0
  134. package/build/render-container.js +169 -0
  135. package/build/render-container.js.map +1 -0
  136. package/build/render-node-to-output.d.ts +32 -0
  137. package/build/render-node-to-output.js +177 -0
  138. package/build/render-node-to-output.js.map +1 -0
  139. package/build/render-screen-reader.d.ts +5 -0
  140. package/build/render-screen-reader.js +54 -0
  141. package/build/render-screen-reader.js.map +1 -0
  142. package/build/render-scrollbar.d.ts +23 -0
  143. package/build/render-scrollbar.js +70 -0
  144. package/build/render-scrollbar.js.map +1 -0
  145. package/build/render-sticky.d.ts +53 -0
  146. package/build/render-sticky.js +317 -0
  147. package/build/render-sticky.js.map +1 -0
  148. package/build/render-text-node.d.ts +20 -0
  149. package/build/render-text-node.js +155 -0
  150. package/build/render-text-node.js.map +1 -0
  151. package/build/render.d.ts +165 -0
  152. package/build/render.js +60 -0
  153. package/build/render.js.map +1 -0
  154. package/build/renderer.d.ts +24 -0
  155. package/build/renderer.js +292 -0
  156. package/build/renderer.js.map +1 -0
  157. package/build/replay.d.ts +59 -0
  158. package/build/replay.js +128 -0
  159. package/build/replay.js.map +1 -0
  160. package/build/resize-observer.d.ts +24 -0
  161. package/build/resize-observer.js +102 -0
  162. package/build/resize-observer.js.map +1 -0
  163. package/build/scroll.d.ts +11 -0
  164. package/build/scroll.js +123 -0
  165. package/build/scroll.js.map +1 -0
  166. package/build/selection.d.ts +52 -0
  167. package/build/selection.js +359 -0
  168. package/build/selection.js.map +1 -0
  169. package/build/serialization.d.ts +25 -0
  170. package/build/serialization.js +224 -0
  171. package/build/serialization.js.map +1 -0
  172. package/build/squash-text-nodes.d.ts +16 -0
  173. package/build/squash-text-nodes.js +58 -0
  174. package/build/squash-text-nodes.js.map +1 -0
  175. package/build/styled-line.d.ts +58 -0
  176. package/build/styled-line.js +629 -0
  177. package/build/styled-line.js.map +1 -0
  178. package/build/styles.d.ts +286 -0
  179. package/build/styles.js +257 -0
  180. package/build/styles.js.map +1 -0
  181. package/build/terminal-buffer.d.ts +57 -0
  182. package/build/terminal-buffer.js +507 -0
  183. package/build/terminal-buffer.js.map +1 -0
  184. package/build/text-wrap.d.ts +12 -0
  185. package/build/text-wrap.js +154 -0
  186. package/build/text-wrap.js.map +1 -0
  187. package/build/tokenize.d.ts +47 -0
  188. package/build/tokenize.js +419 -0
  189. package/build/tokenize.js.map +1 -0
  190. package/build/vertical-gap.d.ts +17 -0
  191. package/build/vertical-gap.js +20 -0
  192. package/build/vertical-gap.js.map +1 -0
  193. package/build/worker/animation-controller.d.ts +72 -0
  194. package/build/worker/animation-controller.js +128 -0
  195. package/build/worker/animation-controller.js.map +1 -0
  196. package/build/worker/ansi-utils.d.ts +16 -0
  197. package/build/worker/ansi-utils.js +40 -0
  198. package/build/worker/ansi-utils.js.map +1 -0
  199. package/build/worker/canvas.d.ts +49 -0
  200. package/build/worker/canvas.js +90 -0
  201. package/build/worker/canvas.js.map +1 -0
  202. package/build/worker/compositor.d.ts +33 -0
  203. package/build/worker/compositor.js +308 -0
  204. package/build/worker/compositor.js.map +1 -0
  205. package/build/worker/platform.d.ts +15 -0
  206. package/build/worker/platform.js +19 -0
  207. package/build/worker/platform.js.map +1 -0
  208. package/build/worker/render-worker.d.ts +112 -0
  209. package/build/worker/render-worker.js +944 -0
  210. package/build/worker/render-worker.js.map +1 -0
  211. package/build/worker/scene-manager.d.ts +26 -0
  212. package/build/worker/scene-manager.js +109 -0
  213. package/build/worker/scene-manager.js.map +1 -0
  214. package/build/worker/scroll-optimizer.d.ts +32 -0
  215. package/build/worker/scroll-optimizer.js +110 -0
  216. package/build/worker/scroll-optimizer.js.map +1 -0
  217. package/build/worker/terminal-writer.d.ts +116 -0
  218. package/build/worker/terminal-writer.js +708 -0
  219. package/build/worker/terminal-writer.js.map +1 -0
  220. package/build/worker/worker-entry.d.ts +6 -0
  221. package/build/worker/worker-entry.js +130 -0
  222. package/build/worker/worker-entry.js.map +1 -0
  223. package/license +9 -0
  224. package/package.json +208 -0
  225. package/readme.md +2353 -0
@@ -0,0 +1,171 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { type Except } from 'type-fest';
3
+ import { type Styles } from '../styles.js';
4
+ import { type DOMElement } from '../dom.js';
5
+ export type Props = Except<Styles, 'textWrap'> & {
6
+ /**
7
+ A label for the element for screen readers.
8
+ */
9
+ readonly 'aria-label'?: string;
10
+ /**
11
+ Hide the element from screen readers.
12
+ */
13
+ readonly 'aria-hidden'?: boolean;
14
+ /**
15
+ The role of the element.
16
+ */
17
+ readonly 'aria-role'?: 'button' | 'checkbox' | 'combobox' | 'list' | 'listbox' | 'listitem' | 'menu' | 'menuitem' | 'option' | 'progressbar' | 'radio' | 'radiogroup' | 'tab' | 'tablist' | 'table' | 'textbox' | 'timer' | 'toolbar';
18
+ /**
19
+ The state of the element.
20
+ */
21
+ readonly 'aria-state'?: {
22
+ readonly busy?: boolean;
23
+ readonly checked?: boolean;
24
+ readonly disabled?: boolean;
25
+ readonly expanded?: boolean;
26
+ readonly multiline?: boolean;
27
+ readonly multiselectable?: boolean;
28
+ readonly readonly?: boolean;
29
+ readonly required?: boolean;
30
+ readonly selected?: boolean;
31
+ };
32
+ /**
33
+ * Make the element opaque even if no background color is specified.
34
+ */
35
+ readonly opaque?: boolean;
36
+ /**
37
+ * Make the element sticky.
38
+ */
39
+ readonly sticky?: boolean | 'top' | 'bottom';
40
+ /**
41
+ * Content to render when the element is sticky.
42
+ */
43
+ readonly stickyChildren?: ReactNode;
44
+ /**
45
+ * Whether to render scrollbars if the element is scrollable.
46
+ * @default true
47
+ */
48
+ readonly scrollbar?: boolean;
49
+ /**
50
+ * Keep the scrollback history stable when content shrinks.
51
+ * Only applies when `overflowToBackbuffer` is also enabled.
52
+ * @default false
53
+ */
54
+ readonly stableScrollback?: boolean;
55
+ };
56
+ /**
57
+ `<Box>` is an essential Ink component to build your layout. It's like `<div style="display: flex">` in the browser.
58
+ */
59
+ declare const Box: React.ForwardRefExoticComponent<{
60
+ readonly position?: "absolute" | "relative" | undefined;
61
+ readonly columnGap?: number | undefined;
62
+ readonly rowGap?: number | undefined;
63
+ readonly gap?: number | undefined;
64
+ readonly margin?: number | undefined;
65
+ readonly marginX?: number | undefined;
66
+ readonly marginY?: number | undefined;
67
+ readonly marginTop?: number | undefined;
68
+ readonly marginBottom?: number | undefined;
69
+ readonly marginLeft?: number | undefined;
70
+ readonly marginRight?: number | undefined;
71
+ readonly padding?: number | undefined;
72
+ readonly paddingX?: number | undefined;
73
+ readonly paddingY?: number | undefined;
74
+ readonly paddingTop?: number | undefined;
75
+ readonly paddingBottom?: number | undefined;
76
+ readonly paddingLeft?: number | undefined;
77
+ readonly paddingRight?: number | undefined;
78
+ readonly flexGrow?: number | undefined;
79
+ readonly flexShrink?: number | undefined;
80
+ readonly flexDirection?: "row" | "column" | "row-reverse" | "column-reverse" | undefined;
81
+ readonly flexBasis?: number | string | undefined;
82
+ readonly flexWrap?: "nowrap" | "wrap" | "wrap-reverse" | undefined;
83
+ readonly alignItems?: "flex-start" | "center" | "flex-end" | "stretch" | undefined;
84
+ readonly alignSelf?: "flex-start" | "center" | "flex-end" | "auto" | undefined;
85
+ readonly justifyContent?: "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | "center" | undefined;
86
+ readonly width?: number | string | undefined;
87
+ readonly height?: number | string | undefined;
88
+ readonly minWidth?: number | string | undefined;
89
+ readonly minHeight?: number | string | undefined;
90
+ readonly maxWidth?: number | string | undefined;
91
+ readonly maxHeight?: number | string | undefined;
92
+ readonly display?: "flex" | "none" | undefined;
93
+ readonly borderStyle?: (keyof import("cli-boxes").Boxes | import("cli-boxes").BoxStyle) | undefined;
94
+ readonly borderTop?: boolean | undefined;
95
+ readonly borderBottom?: boolean | undefined;
96
+ readonly borderLeft?: boolean | undefined;
97
+ readonly borderRight?: boolean | undefined;
98
+ readonly borderColor?: import("type-fest").LiteralUnion<import("ansi-styles").ForegroundColorName, string> | undefined;
99
+ readonly borderTopColor?: import("type-fest").LiteralUnion<import("ansi-styles").ForegroundColorName, string> | undefined;
100
+ readonly borderBottomColor?: import("type-fest").LiteralUnion<import("ansi-styles").ForegroundColorName, string> | undefined;
101
+ readonly borderLeftColor?: import("type-fest").LiteralUnion<import("ansi-styles").ForegroundColorName, string> | undefined;
102
+ readonly borderRightColor?: import("type-fest").LiteralUnion<import("ansi-styles").ForegroundColorName, string> | undefined;
103
+ readonly borderDimColor?: boolean | undefined;
104
+ readonly borderTopDimColor?: boolean | undefined;
105
+ readonly borderBottomDimColor?: boolean | undefined;
106
+ readonly borderLeftDimColor?: boolean | undefined;
107
+ readonly borderRightDimColor?: boolean | undefined;
108
+ readonly overflow?: "visible" | "hidden" | "scroll" | undefined;
109
+ readonly overflowX?: "visible" | "hidden" | "scroll" | undefined;
110
+ readonly overflowY?: "visible" | "hidden" | "scroll" | undefined;
111
+ readonly overflowToBackbuffer?: boolean | undefined;
112
+ readonly stableScrollback?: boolean | undefined;
113
+ readonly backgroundColor?: import("type-fest").LiteralUnion<import("ansi-styles").ForegroundColorName, string> | undefined;
114
+ readonly scrollTop?: number | undefined;
115
+ readonly scrollLeft?: number | undefined;
116
+ readonly scrollbarThumbColor?: import("type-fest").LiteralUnion<import("ansi-styles").ForegroundColorName, string> | undefined;
117
+ readonly userSelect?: "auto" | "none" | "text" | "all" | undefined;
118
+ } & {
119
+ /**
120
+ A label for the element for screen readers.
121
+ */
122
+ readonly 'aria-label'?: string;
123
+ /**
124
+ Hide the element from screen readers.
125
+ */
126
+ readonly 'aria-hidden'?: boolean;
127
+ /**
128
+ The role of the element.
129
+ */
130
+ readonly 'aria-role'?: "button" | "checkbox" | "combobox" | "list" | "listbox" | "listitem" | "menu" | "menuitem" | "option" | "progressbar" | "radio" | "radiogroup" | "tab" | "tablist" | "table" | "textbox" | "timer" | "toolbar";
131
+ /**
132
+ The state of the element.
133
+ */
134
+ readonly 'aria-state'?: {
135
+ readonly busy?: boolean;
136
+ readonly checked?: boolean;
137
+ readonly disabled?: boolean;
138
+ readonly expanded?: boolean;
139
+ readonly multiline?: boolean;
140
+ readonly multiselectable?: boolean;
141
+ readonly readonly?: boolean;
142
+ readonly required?: boolean;
143
+ readonly selected?: boolean;
144
+ };
145
+ /**
146
+ * Make the element opaque even if no background color is specified.
147
+ */
148
+ readonly opaque?: boolean;
149
+ /**
150
+ * Make the element sticky.
151
+ */
152
+ readonly sticky?: boolean | "top" | "bottom";
153
+ /**
154
+ * Content to render when the element is sticky.
155
+ */
156
+ readonly stickyChildren?: ReactNode;
157
+ /**
158
+ * Whether to render scrollbars if the element is scrollable.
159
+ * @default true
160
+ */
161
+ readonly scrollbar?: boolean;
162
+ /**
163
+ * Keep the scrollback history stable when content shrinks.
164
+ * Only applies when `overflowToBackbuffer` is also enabled.
165
+ * @default false
166
+ */
167
+ readonly stableScrollback?: boolean;
168
+ } & {
169
+ children?: ReactNode | undefined;
170
+ } & React.RefAttributes<DOMElement>>;
171
+ export default Box;
@@ -0,0 +1,40 @@
1
+ import React, { forwardRef, useContext, } from 'react';
2
+ import { accessibilityContext } from './AccessibilityContext.js';
3
+ import { backgroundContext } from './BackgroundContext.js';
4
+ /**
5
+ `<Box>` is an essential Ink component to build your layout. It's like `<div style="display: flex">` in the browser.
6
+ */
7
+ const Box = forwardRef(({ children, stickyChildren, backgroundColor, 'aria-label': ariaLabel, 'aria-hidden': ariaHidden, 'aria-role': role, 'aria-state': ariaState, sticky, opaque, scrollbar = true, stableScrollback = false, ...style }, ref) => {
8
+ const { isScreenReaderEnabled } = useContext(accessibilityContext);
9
+ const label = ariaLabel ? React.createElement("ink-text", null, ariaLabel) : undefined;
10
+ if (isScreenReaderEnabled && ariaHidden) {
11
+ return null;
12
+ }
13
+ const boxElement = (React.createElement("ink-box", { ref: ref, style: {
14
+ flexWrap: 'nowrap',
15
+ flexDirection: 'row',
16
+ flexGrow: 0,
17
+ flexShrink: 1,
18
+ ...style,
19
+ backgroundColor,
20
+ stableScrollback,
21
+ overflowX: style.overflowX ?? style.overflow ?? 'visible',
22
+ overflowY: style.overflowY ?? style.overflow ?? 'visible',
23
+ }, internal_accessibility: {
24
+ role,
25
+ state: ariaState,
26
+ }, sticky: sticky, opaque: opaque, scrollbar: scrollbar, stableScrollback: stableScrollback },
27
+ isScreenReaderEnabled && label ? label : children,
28
+ sticky && stickyChildren && !isScreenReaderEnabled && (React.createElement("ink-box", { internalStickyAlternate: true, style: {
29
+ position: 'absolute',
30
+ ...style,
31
+ } }, stickyChildren))));
32
+ // If this Box has a background color, provide it to children via context
33
+ if (backgroundColor) {
34
+ return (React.createElement(backgroundContext.Provider, { value: backgroundColor }, boxElement));
35
+ }
36
+ return boxElement;
37
+ });
38
+ Box.displayName = 'Box';
39
+ export default Box;
40
+ //# sourceMappingURL=Box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Box.js","sourceRoot":"","sources":["../../src/components/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACb,UAAU,EACV,UAAU,GAGV,MAAM,OAAO,CAAC;AAIf,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAC,iBAAiB,EAAC,MAAM,wBAAwB,CAAC;AAgFzD;;EAEE;AACF,MAAM,GAAG,GAAG,UAAU,CACrB,CACC,EACC,QAAQ,EACR,cAAc,EACd,eAAe,EACf,YAAY,EAAE,SAAS,EACvB,aAAa,EAAE,UAAU,EACzB,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,SAAS,EACvB,MAAM,EACN,MAAM,EACN,SAAS,GAAG,IAAI,EAChB,gBAAgB,GAAG,KAAK,EACxB,GAAG,KAAK,EACR,EACD,GAAG,EACF,EAAE;IACH,MAAM,EAAC,qBAAqB,EAAC,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,sCAAW,SAAS,CAAY,CAAC,CAAC,CAAC,SAAS,CAAC;IACvE,IAAI,qBAAqB,IAAI,UAAU,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,UAAU,GAAG,CAClB,iCACC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE;YACN,QAAQ,EAAE,QAAQ;YAClB,aAAa,EAAE,KAAK;YACpB,QAAQ,EAAE,CAAC;YACX,UAAU,EAAE,CAAC;YACb,GAAG,KAAK;YACR,eAAe;YACf,gBAAgB;YAChB,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,QAAQ,IAAI,SAAS;YACzD,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,QAAQ,IAAI,SAAS;SACzD,EACD,sBAAsB,EAAE;YACvB,IAAI;YACJ,KAAK,EAAE,SAAS;SAChB,EACD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB;QAEjC,qBAAqB,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ;QACjD,MAAM,IAAI,cAAc,IAAI,CAAC,qBAAqB,IAAI,CACtD,iCACC,uBAAuB,QACvB,KAAK,EAAE;gBACN,QAAQ,EAAE,UAAU;gBACpB,GAAG,KAAK;aACR,IAEA,cAAc,CACN,CACV,CACQ,CACV,CAAC;IAEF,yEAAyE;IACzE,IAAI,eAAe,EAAE,CAAC;QACrB,OAAO,CACN,oBAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,eAAe,IAChD,UAAU,CACiB,CAC7B,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC,CACD,CAAC;AAEF,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC;AAExB,eAAe,GAAG,CAAC"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ type Props = {
3
+ readonly error: Error;
4
+ };
5
+ export default function ErrorOverview({ error }: Props): React.JSX.Element;
6
+ export {};
@@ -0,0 +1,84 @@
1
+ import * as fs from 'node:fs';
2
+ import { cwd } from 'node:process';
3
+ import React from 'react';
4
+ import StackUtils from 'stack-utils';
5
+ import codeExcerpt from 'code-excerpt';
6
+ import Box from './Box.js';
7
+ import Text from './Text.js';
8
+ // Error's source file is reported as file:///home/user/file.js
9
+ // This function removes the file://[cwd] part
10
+ const cleanupPath = (path) => {
11
+ return path?.replace(`file://${cwd()}/`, '');
12
+ };
13
+ const stackUtils = new StackUtils({
14
+ cwd: cwd(),
15
+ internals: StackUtils.nodeInternals(),
16
+ });
17
+ export default function ErrorOverview({ error }) {
18
+ const stack = error.stack ? error.stack.split('\n').slice(1) : undefined;
19
+ const origin = stack ? stackUtils.parseLine(stack[0]) : undefined;
20
+ const filePath = cleanupPath(origin?.file);
21
+ let excerpt;
22
+ let lineWidth = 0;
23
+ if (filePath && origin?.line && fs.existsSync(filePath)) {
24
+ const sourceCode = fs.readFileSync(filePath, 'utf8');
25
+ excerpt = codeExcerpt(sourceCode, origin.line);
26
+ if (excerpt) {
27
+ for (const { line } of excerpt) {
28
+ lineWidth = Math.max(lineWidth, String(line).length);
29
+ }
30
+ }
31
+ }
32
+ return (React.createElement(Box, { flexDirection: "column", padding: 1 },
33
+ React.createElement(Box, null,
34
+ React.createElement(Text, { backgroundColor: "red", color: "white" },
35
+ ' ',
36
+ "ERROR",
37
+ ' '),
38
+ React.createElement(Text, null,
39
+ " ",
40
+ error.message)),
41
+ origin && filePath && (React.createElement(Box, { marginTop: 1 },
42
+ React.createElement(Text, { dimColor: true },
43
+ filePath,
44
+ ":",
45
+ origin.line,
46
+ ":",
47
+ origin.column))),
48
+ origin && excerpt && (React.createElement(Box, { marginTop: 1, flexDirection: "column" }, excerpt.map(({ line, value }) => (React.createElement(Box, { key: line },
49
+ React.createElement(Box, { width: lineWidth + 1 },
50
+ React.createElement(Text, { dimColor: line !== origin.line, backgroundColor: line === origin.line ? 'red' : undefined, color: line === origin.line ? 'white' : undefined, "aria-label": line === origin.line
51
+ ? `Line ${line}, error`
52
+ : `Line ${line}` },
53
+ String(line).padStart(lineWidth, ' '),
54
+ ":")),
55
+ React.createElement(Text, { key: line, backgroundColor: line === origin.line ? 'red' : undefined, color: line === origin.line ? 'white' : undefined }, ' ' + value)))))),
56
+ error.stack && (React.createElement(Box, { marginTop: 1, flexDirection: "column" }, error.stack
57
+ .split('\n')
58
+ .slice(1)
59
+ .map(line => {
60
+ const parsedLine = stackUtils.parseLine(line);
61
+ // If the line from the stack cannot be parsed, we print out the unparsed line.
62
+ if (!parsedLine) {
63
+ return (React.createElement(Box, { key: line },
64
+ React.createElement(Text, { dimColor: true }, "- "),
65
+ React.createElement(Text, { dimColor: true, bold: true },
66
+ line,
67
+ "\\t",
68
+ ' ')));
69
+ }
70
+ return (React.createElement(Box, { key: line },
71
+ React.createElement(Text, { dimColor: true }, "- "),
72
+ React.createElement(Text, { dimColor: true, bold: true }, parsedLine.function),
73
+ React.createElement(Text, { dimColor: true, color: "gray", "aria-label": `at ${cleanupPath(parsedLine.file) ?? ''} line ${parsedLine.line} column ${parsedLine.column}` },
74
+ ' ',
75
+ "(",
76
+ cleanupPath(parsedLine.file) ?? '',
77
+ ":",
78
+ parsedLine.line,
79
+ ":",
80
+ parsedLine.column,
81
+ ")")));
82
+ })))));
83
+ }
84
+ //# sourceMappingURL=ErrorOverview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorOverview.js","sourceRoot":"","sources":["../../src/components/ErrorOverview.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,GAAG,EAAC,MAAM,cAAc,CAAC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,WAA+B,MAAM,cAAc,CAAC;AAC3D,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,+DAA+D;AAC/D,8CAA8C;AAC9C,MAAM,WAAW,GAAG,CAAC,IAAwB,EAAsB,EAAE;IACpE,OAAO,IAAI,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CACE,CACN,CACI,CACN,CAAC;AACH,CAAC"}
@@ -0,0 +1,16 @@
1
+ export type Props = {
2
+ readonly activeId?: string;
3
+ readonly add: (id: string, options: {
4
+ autoFocus: boolean;
5
+ }) => void;
6
+ readonly remove: (id: string) => void;
7
+ readonly activate: (id: string) => void;
8
+ readonly deactivate: (id: string) => void;
9
+ readonly enableFocus: () => void;
10
+ readonly disableFocus: () => void;
11
+ readonly focusNext: () => void;
12
+ readonly focusPrevious: () => void;
13
+ readonly focus: (id: string) => void;
14
+ };
15
+ declare const FocusContext: import("react").Context<Props>;
16
+ export default FocusContext;
@@ -0,0 +1,16 @@
1
+ import { createContext } from 'react';
2
+ const FocusContext = createContext({
3
+ activeId: undefined,
4
+ add() { },
5
+ remove() { },
6
+ activate() { },
7
+ deactivate() { },
8
+ enableFocus() { },
9
+ disableFocus() { },
10
+ focusNext() { },
11
+ focusPrevious() { },
12
+ focus() { },
13
+ });
14
+ FocusContext.displayName = 'InternalFocusContext';
15
+ export default FocusContext;
16
+ //# sourceMappingURL=FocusContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FocusContext.js","sourceRoot":"","sources":["../../src/components/FocusContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAepC,MAAM,YAAY,GAAG,aAAa,CAAQ;IACzC,QAAQ,EAAE,SAAS;IACnB,GAAG,KAAI,CAAC;IACR,MAAM,KAAI,CAAC;IACX,QAAQ,KAAI,CAAC;IACb,UAAU,KAAI,CAAC;IACf,WAAW,KAAI,CAAC;IAChB,YAAY,KAAI,CAAC;IACjB,SAAS,KAAI,CAAC;IACd,aAAa,KAAI,CAAC;IAClB,KAAK,KAAI,CAAC;CACV,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAElD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export type Props = {
3
+ /**
4
+ Number of newlines to insert.
5
+
6
+ @default 1
7
+ */
8
+ readonly count?: number;
9
+ };
10
+ /**
11
+ Adds one or more newline (`\n`) characters. Must be used within `<Text>` components.
12
+ */
13
+ export default function Newline({ count }: Props): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ /**
3
+ Adds one or more newline (`\n`) characters. Must be used within `<Text>` components.
4
+ */
5
+ export default function Newline({ count = 1 }) {
6
+ return React.createElement("ink-text", null, '\n'.repeat(count));
7
+ }
8
+ //# sourceMappingURL=Newline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Newline.js","sourceRoot":"","sources":["../../src/components/Newline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B;;EAEE;AACF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAAC,KAAK,GAAG,CAAC,EAAQ;IACjD,OAAO,sCAAW,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAY,CAAC;AAClD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ A flexible space that expands along the major axis of its containing layout.
4
+
5
+ It's useful as a shortcut for filling all the available space between elements.
6
+ */
7
+ export default function Spacer(): React.JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import Box from './Box.js';
3
+ /**
4
+ A flexible space that expands along the major axis of its containing layout.
5
+
6
+ It's useful as a shortcut for filling all the available space between elements.
7
+ */
8
+ export default function Spacer() {
9
+ return React.createElement(Box, { flexGrow: 1 });
10
+ }
11
+ //# sourceMappingURL=Spacer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Spacer.js","sourceRoot":"","sources":["../../src/components/Spacer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B;;;;EAIE;AACF,MAAM,CAAC,OAAO,UAAU,MAAM;IAC7B,OAAO,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,GAAI,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,24 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { type Styles } from '../styles.js';
3
+ export type Props<T> = {
4
+ /**
5
+ Array of items of any type to render using the function you pass as a component child.
6
+ */
7
+ readonly items: T[];
8
+ /**
9
+ Styles to apply to a container of child elements. See <Box> for supported properties.
10
+ */
11
+ readonly style?: Styles;
12
+ /**
13
+ Function that is called to render every item in the `items` array. The first argument is the item itself, and the second argument is the index of that item in the `items` array. Note that a `key` must be assigned to the root component.
14
+ */
15
+ readonly children: (item: T, index: number) => ReactNode;
16
+ };
17
+ /**
18
+ `<Static>` component permanently renders its output above everything else. It's useful for displaying activity like completed tasks or logs—things that don't change after they're rendered (hence the name "Static").
19
+
20
+ It's preferred to use `<Static>` for use cases like these when you can't know or control the number of items that need to be rendered.
21
+
22
+ For example, [Tap](https://github.com/tapjs/node-tap) uses `<Static>` to display a list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it to display a list of generated pages while still displaying a live progress bar.
23
+ */
24
+ export default function Static<T>(props: Props<T>): React.JSX.Element;
@@ -0,0 +1,29 @@
1
+ import React, { useMemo, useState, useLayoutEffect } from 'react';
2
+ /**
3
+ `<Static>` component permanently renders its output above everything else. It's useful for displaying activity like completed tasks or logs—things that don't change after they're rendered (hence the name "Static").
4
+
5
+ It's preferred to use `<Static>` for use cases like these when you can't know or control the number of items that need to be rendered.
6
+
7
+ For example, [Tap](https://github.com/tapjs/node-tap) uses `<Static>` to display a list of completed tests. [Gatsby](https://github.com/gatsbyjs/gatsby) uses it to display a list of generated pages while still displaying a live progress bar.
8
+ */
9
+ export default function Static(props) {
10
+ const { items, children: render, style: customStyle } = props;
11
+ const [index, setIndex] = useState(0);
12
+ const itemsToRender = useMemo(() => {
13
+ return items.slice(index);
14
+ }, [items, index]);
15
+ useLayoutEffect(() => {
16
+ setIndex(items.length);
17
+ }, [items.length]);
18
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
19
+ const children = itemsToRender.map((item, itemIndex) => {
20
+ return render(item, index + itemIndex);
21
+ });
22
+ const style = useMemo(() => ({
23
+ position: 'absolute',
24
+ flexDirection: 'column',
25
+ ...customStyle,
26
+ }), [customStyle]);
27
+ return (React.createElement("ink-box", { internal_static: true, style: style }, children));
28
+ }
29
+ //# sourceMappingURL=Static.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Static.js","sourceRoot":"","sources":["../../src/components/Static.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAiB,MAAM,OAAO,CAAC;AAoBhF;;;;;;EAME;AACF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAI,KAAe;IAChD,MAAM,EAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAC,GAAG,KAAK,CAAC;IAC5D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEtC,MAAM,aAAa,GAAQ,OAAO,CAAC,GAAG,EAAE;QACvC,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAEnB,eAAe,CAAC,GAAG,EAAE;QACpB,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnB,qEAAqE;IACrE,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;QACtD,OAAO,MAAM,CAAC,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAW,OAAO,CAC5B,GAAG,EAAE,CAAC,CAAC;QACN,QAAQ,EAAE,UAAU;QACpB,aAAa,EAAE,QAAQ;QACvB,GAAG,WAAW;KACd,CAAC,EACF,CAAC,WAAW,CAAC,CACb,CAAC;IAEF,OAAO,CACN,iCAAS,eAAe,QAAC,KAAK,EAAE,KAAK,IACnC,QAAQ,CACA,CACV,CAAC;AACH,CAAC"}
@@ -0,0 +1,8 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { type Styles } from '../styles.js';
3
+ export type Props = {
4
+ readonly children: ReactNode;
5
+ readonly width: number;
6
+ readonly style?: Styles;
7
+ };
8
+ export default function StaticRender({ children, width, style }: Props): React.JSX.Element;
@@ -0,0 +1,19 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { renderToStatic } from '../render-node-to-output.js';
3
+ export default function StaticRender({ children, width, style }) {
4
+ const ref = useRef(null);
5
+ useEffect(() => {
6
+ const node = ref.current;
7
+ return () => {
8
+ if (node) {
9
+ node.cachedRender = undefined;
10
+ }
11
+ };
12
+ }, []);
13
+ return (React.createElement("ink-static-render", { ref: ref, style: { ...style, width }, internalOnBeforeRender: (node) => {
14
+ if (node && !node.cachedRender) {
15
+ renderToStatic(node);
16
+ }
17
+ } }, children));
18
+ }
19
+ //# sourceMappingURL=StaticRender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StaticRender.js","sourceRoot":"","sources":["../../src/components/StaticRender.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,MAAM,EAAE,SAAS,EAAiB,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAS3D,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAQ;IACnE,MAAM,GAAG,GAAG,MAAM,CAAa,IAAI,CAAC,CAAC;IAErC,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC;QACzB,OAAO,GAAG,EAAE;YACX,IAAI,IAAI,EAAE,CAAC;gBACV,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;YAC/B,CAAC;QACF,CAAC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACN,2CACC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,EAAC,GAAG,KAAK,EAAE,KAAK,EAAC,EACxB,sBAAsB,EAAE,CAAC,IAAgB,EAAE,EAAE;YAC5C,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;gBAChC,cAAc,CAAC,IAAI,CAAC,CAAC;YACtB,CAAC;QACF,CAAC,IAEA,QAAQ,CACU,CACpB,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ export type Props = {
2
+ /**
3
+ Stderr stream passed to `render()` in `options.stderr` or `process.stderr` by default.
4
+ */
5
+ readonly stderr: NodeJS.WriteStream;
6
+ /**
7
+ Write any string to stderr while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `<Static>`, except it can't accept components; it only works with strings.
8
+ */
9
+ readonly write: (data: string) => void;
10
+ };
11
+ /**
12
+ `StderrContext` is a React context that exposes the stderr stream.
13
+ */
14
+ declare const StderrContext: import("react").Context<Props>;
15
+ export default StderrContext;
@@ -0,0 +1,12 @@
1
+ import process from 'node:process';
2
+ import { createContext } from 'react';
3
+ /**
4
+ `StderrContext` is a React context that exposes the stderr stream.
5
+ */
6
+ const StderrContext = createContext({
7
+ stderr: process.stderr,
8
+ write() { },
9
+ });
10
+ StderrContext.displayName = 'InternalStderrContext';
11
+ export default StderrContext;
12
+ //# sourceMappingURL=StderrContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StderrContext.js","sourceRoot":"","sources":["../../src/components/StderrContext.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAcpC;;EAEE;AAEF,MAAM,aAAa,GAAG,aAAa,CAAQ;IAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,KAAK,KAAI,CAAC;CACV,CAAC,CAAC;AAEH,aAAa,CAAC,WAAW,GAAG,uBAAuB,CAAC;AAEpD,eAAe,aAAa,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { EventEmitter } from 'node:events';
2
+ export type Props = {
3
+ /**
4
+ The stdin stream passed to `render()` in `options.stdin`, or `process.stdin` by default. Useful if your app needs to handle user input.
5
+ */
6
+ readonly stdin: NodeJS.ReadStream;
7
+ /**
8
+ Ink exposes this function via own `<StdinContext>` to be able to handle Ctrl+C, that's why you should use Ink's `setRawMode` instead of `process.stdin.setRawMode`. If the `stdin` stream passed to Ink does not support setRawMode, this function does nothing.
9
+ */
10
+ readonly setRawMode: (value: boolean) => void;
11
+ /**
12
+ A boolean flag determining if the current `stdin` supports `setRawMode`. A component using `setRawMode` might want to use `isRawModeSupported` to nicely fall back in environments where raw mode is not supported.
13
+ */
14
+ readonly isRawModeSupported: boolean;
15
+ readonly internal_exitOnCtrlC: boolean;
16
+ readonly internal_eventEmitter: EventEmitter;
17
+ };
18
+ /**
19
+ `StdinContext` is a React context that exposes the input stream.
20
+ */
21
+ declare const StdinContext: import("react").Context<Props>;
22
+ export default StdinContext;
@@ -0,0 +1,16 @@
1
+ import { EventEmitter } from 'node:events';
2
+ import process from 'node:process';
3
+ import { createContext } from 'react';
4
+ /**
5
+ `StdinContext` is a React context that exposes the input stream.
6
+ */
7
+ const StdinContext = createContext({
8
+ stdin: process.stdin,
9
+ internal_eventEmitter: new EventEmitter(),
10
+ setRawMode() { },
11
+ isRawModeSupported: false,
12
+ internal_exitOnCtrlC: true,
13
+ });
14
+ StdinContext.displayName = 'InternalStdinContext';
15
+ export default StdinContext;
16
+ //# sourceMappingURL=StdinContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StdinContext.js","sourceRoot":"","sources":["../../src/components/StdinContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AACzC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAuBpC;;EAEE;AAEF,MAAM,YAAY,GAAG,aAAa,CAAQ;IACzC,KAAK,EAAE,OAAO,CAAC,KAAK;IAEpB,qBAAqB,EAAE,IAAI,YAAY,EAAE;IACzC,UAAU,KAAI,CAAC;IACf,kBAAkB,EAAE,KAAK;IAEzB,oBAAoB,EAAE,IAAI;CAC1B,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,GAAG,sBAAsB,CAAC;AAElD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,15 @@
1
+ export type Props = {
2
+ /**
3
+ Stdout stream passed to `render()` in `options.stdout` or `process.stdout` by default.
4
+ */
5
+ readonly stdout: NodeJS.WriteStream;
6
+ /**
7
+ Write any string to stdout while preserving Ink's output. It's useful when you want to display external information outside of Ink's rendering and ensure there's no conflict between the two. It's similar to `<Static>`, except it can't accept components; it only works with strings.
8
+ */
9
+ readonly write: (data: string) => void;
10
+ };
11
+ /**
12
+ `StdoutContext` is a React context that exposes the stdout stream where Ink renders your app.
13
+ */
14
+ declare const StdoutContext: import("react").Context<Props>;
15
+ export default StdoutContext;
@@ -0,0 +1,12 @@
1
+ import process from 'node:process';
2
+ import { createContext } from 'react';
3
+ /**
4
+ `StdoutContext` is a React context that exposes the stdout stream where Ink renders your app.
5
+ */
6
+ const StdoutContext = createContext({
7
+ stdout: process.stdout,
8
+ write() { },
9
+ });
10
+ StdoutContext.displayName = 'InternalStdoutContext';
11
+ export default StdoutContext;
12
+ //# sourceMappingURL=StdoutContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StdoutContext.js","sourceRoot":"","sources":["../../src/components/StdoutContext.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAcpC;;EAEE;AAEF,MAAM,aAAa,GAAG,aAAa,CAAQ;IAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,KAAK,KAAI,CAAC;CACV,CAAC,CAAC;AAEH,aAAa,CAAC,WAAW,GAAG,uBAAuB,CAAC;AAEpD,eAAe,aAAa,CAAC"}