@elench/testkit 0.1.114 → 0.1.116

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 (212) hide show
  1. package/README.md +33 -8
  2. package/lib/cli/args.mjs +3 -3
  3. package/lib/cli/assistant/app.mjs +4 -2
  4. package/lib/cli/assistant/session.mjs +5 -1
  5. package/lib/cli/assistant/state.mjs +1 -2
  6. package/lib/cli/command-flags.mjs +4 -0
  7. package/lib/cli/commands/db/schema/refresh.mjs +21 -0
  8. package/lib/cli/commands/db/schema/verify.mjs +27 -0
  9. package/lib/cli/components/blocks/run-tree.mjs +7 -2
  10. package/lib/cli/components/hooks/use-element-layout.mjs +63 -0
  11. package/lib/cli/components/hooks/use-spinner-frame.mjs +26 -0
  12. package/lib/cli/entrypoint.mjs +1 -0
  13. package/lib/cli/operations/db/schema/refresh/operation.mjs +56 -0
  14. package/lib/cli/operations/db/{snapshot/capture → schema/verify}/operation.mjs +6 -27
  15. package/lib/cli/operations/run/operation.mjs +1 -0
  16. package/lib/cli/renderers/db-schema/text.mjs +7 -0
  17. package/lib/config/database.mjs +64 -0
  18. package/lib/config-api/index.d.ts +16 -1
  19. package/lib/config-api/index.mjs +31 -16
  20. package/lib/database/fingerprint.mjs +2 -0
  21. package/lib/database/index.mjs +142 -104
  22. package/lib/database/schema-source.mjs +295 -0
  23. package/lib/database/template-steps.mjs +158 -38
  24. package/lib/runner/orchestrator.mjs +4 -3
  25. package/lib/runner/template-steps.mjs +12 -1
  26. package/lib/runner/template.mjs +16 -1
  27. package/node_modules/@alcalzone/ansi-tokenize/README.md +0 -5
  28. package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.d.ts +8 -0
  29. package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js +10 -8
  30. package/node_modules/@alcalzone/ansi-tokenize/build/ansiCodes.js.map +1 -1
  31. package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.d.ts +1 -5
  32. package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js +9 -45
  33. package/node_modules/@alcalzone/ansi-tokenize/build/tokenize.js.map +1 -1
  34. package/node_modules/@alcalzone/ansi-tokenize/package.json +1 -1
  35. package/node_modules/@elench/next-analysis/package.json +1 -1
  36. package/node_modules/@elench/testkit-bridge/package.json +2 -2
  37. package/node_modules/@elench/testkit-protocol/package.json +1 -1
  38. package/node_modules/@elench/ts-analysis/package.json +1 -1
  39. package/node_modules/cli-boxes/index.d.ts +95 -90
  40. package/node_modules/cli-boxes/index.js +5 -2
  41. package/node_modules/cli-boxes/package.json +6 -13
  42. package/node_modules/cli-boxes/readme.md +15 -3
  43. package/node_modules/cli-truncate/index.d.ts +1 -1
  44. package/node_modules/cli-truncate/package.json +4 -4
  45. package/node_modules/cli-truncate/readme.md +1 -0
  46. package/node_modules/es-toolkit/CHANGELOG.md +801 -0
  47. package/node_modules/es-toolkit/src/compat/_internal/Equals.d.ts +1 -0
  48. package/node_modules/es-toolkit/src/compat/_internal/IsWritable.d.ts +3 -0
  49. package/node_modules/es-toolkit/src/compat/_internal/MutableList.d.ts +4 -0
  50. package/node_modules/es-toolkit/src/compat/_internal/RejectReadonly.d.ts +4 -0
  51. package/node_modules/esprima/ChangeLog +235 -0
  52. package/node_modules/ink/build/apply-styles.js +175 -0
  53. package/node_modules/ink/build/build-layout.js +77 -0
  54. package/node_modules/ink/build/calculate-wrapped-text.js +53 -0
  55. package/node_modules/ink/build/components/App.d.ts +1 -4
  56. package/node_modules/ink/build/components/App.js +22 -142
  57. package/node_modules/ink/build/components/App.js.map +1 -1
  58. package/node_modules/ink/build/components/AppContext.d.ts +3 -23
  59. package/node_modules/ink/build/components/AppContext.js +4 -7
  60. package/node_modules/ink/build/components/AppContext.js.map +1 -1
  61. package/node_modules/ink/build/components/Box.d.ts +3 -16
  62. package/node_modules/ink/build/components/Color.js +62 -0
  63. package/node_modules/ink/build/components/Cursor.d.ts +83 -0
  64. package/node_modules/ink/build/components/Cursor.js +53 -0
  65. package/node_modules/ink/build/components/Cursor.js.map +1 -0
  66. package/node_modules/ink/build/components/ErrorBoundary.d.ts +2 -2
  67. package/node_modules/ink/build/components/ErrorOverview.js +6 -6
  68. package/node_modules/ink/build/components/ErrorOverview.js.map +1 -1
  69. package/node_modules/ink/build/components/Static.js.map +1 -1
  70. package/node_modules/ink/build/components/StdinContext.d.ts +1 -7
  71. package/node_modules/ink/build/components/StdinContext.js +0 -1
  72. package/node_modules/ink/build/components/StdinContext.js.map +1 -1
  73. package/node_modules/ink/build/components/Text.d.ts +1 -1
  74. package/node_modules/ink/build/components/Text.js +1 -1
  75. package/node_modules/ink/build/components/Text.js.map +1 -1
  76. package/node_modules/ink/build/components/Transform.d.ts +1 -1
  77. package/node_modules/ink/build/devtools-window-polyfill.js +4 -7
  78. package/node_modules/ink/build/devtools-window-polyfill.js.map +1 -1
  79. package/node_modules/ink/build/devtools.js +6 -31
  80. package/node_modules/ink/build/devtools.js.map +1 -1
  81. package/node_modules/ink/build/dom.d.ts +1 -5
  82. package/node_modules/ink/build/dom.js +1 -20
  83. package/node_modules/ink/build/dom.js.map +1 -1
  84. package/node_modules/ink/build/experimental/apply-style.js +140 -0
  85. package/node_modules/ink/build/experimental/dom.js +123 -0
  86. package/node_modules/ink/build/experimental/output.js +91 -0
  87. package/node_modules/ink/build/experimental/reconciler.js +141 -0
  88. package/node_modules/ink/build/experimental/renderer.js +81 -0
  89. package/node_modules/ink/build/hooks/use-app.d.ts +1 -1
  90. package/node_modules/ink/build/hooks/use-app.js +1 -1
  91. package/node_modules/ink/build/hooks/use-cursor.d.ts +1 -1
  92. package/node_modules/ink/build/hooks/use-cursor.js +1 -1
  93. package/node_modules/ink/build/hooks/use-focus-manager.d.ts +2 -17
  94. package/node_modules/ink/build/hooks/use-focus-manager.js +1 -2
  95. package/node_modules/ink/build/hooks/use-focus-manager.js.map +1 -1
  96. package/node_modules/ink/build/hooks/use-focus.d.ts +1 -2
  97. package/node_modules/ink/build/hooks/use-focus.js +4 -5
  98. package/node_modules/ink/build/hooks/use-focus.js.map +1 -1
  99. package/node_modules/ink/build/hooks/use-input.d.ts +1 -2
  100. package/node_modules/ink/build/hooks/use-input.js +80 -82
  101. package/node_modules/ink/build/hooks/use-input.js.map +1 -1
  102. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.d.ts +1 -2
  103. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js +1 -2
  104. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js.map +1 -1
  105. package/node_modules/ink/build/hooks/use-stderr.d.ts +1 -1
  106. package/node_modules/ink/build/hooks/use-stderr.js +1 -1
  107. package/node_modules/ink/build/hooks/use-stdin.d.ts +2 -4
  108. package/node_modules/ink/build/hooks/use-stdin.js +1 -2
  109. package/node_modules/ink/build/hooks/use-stdin.js.map +1 -1
  110. package/node_modules/ink/build/hooks/use-stdout.d.ts +1 -1
  111. package/node_modules/ink/build/hooks/use-stdout.js +1 -1
  112. package/node_modules/ink/build/hooks/useInput.js +38 -0
  113. package/node_modules/ink/build/index.d.ts +1 -8
  114. package/node_modules/ink/build/index.js +0 -4
  115. package/node_modules/ink/build/index.js.map +1 -1
  116. package/node_modules/ink/build/ink.d.ts +3 -48
  117. package/node_modules/ink/build/ink.js +155 -325
  118. package/node_modules/ink/build/ink.js.map +1 -1
  119. package/node_modules/ink/build/input-parser.d.ts +1 -4
  120. package/node_modules/ink/build/input-parser.js +30 -70
  121. package/node_modules/ink/build/input-parser.js.map +1 -1
  122. package/node_modules/ink/build/instance.js +205 -0
  123. package/node_modules/ink/build/layout.d.ts +7 -0
  124. package/node_modules/ink/build/layout.js +33 -0
  125. package/node_modules/ink/build/layout.js.map +1 -0
  126. package/node_modules/ink/build/log-update.d.ts +0 -1
  127. package/node_modules/ink/build/log-update.js +1 -13
  128. package/node_modules/ink/build/log-update.js.map +1 -1
  129. package/node_modules/ink/build/measure-element.d.ts +0 -4
  130. package/node_modules/ink/build/measure-element.js +0 -4
  131. package/node_modules/ink/build/measure-element.js.map +1 -1
  132. package/node_modules/ink/build/options.d.ts +52 -0
  133. package/node_modules/ink/build/options.js +2 -0
  134. package/node_modules/ink/build/options.js.map +1 -0
  135. package/node_modules/ink/build/output.js +0 -25
  136. package/node_modules/ink/build/output.js.map +1 -1
  137. package/node_modules/ink/build/parse-keypress.d.ts +3 -1
  138. package/node_modules/ink/build/parse-keypress.js +17 -19
  139. package/node_modules/ink/build/parse-keypress.js.map +1 -1
  140. package/node_modules/ink/build/reconciler.js +27 -46
  141. package/node_modules/ink/build/reconciler.js.map +1 -1
  142. package/node_modules/ink/build/render-border.js +18 -29
  143. package/node_modules/ink/build/render-border.js.map +1 -1
  144. package/node_modules/ink/build/render-to-string.js +1 -2
  145. package/node_modules/ink/build/render-to-string.js.map +1 -1
  146. package/node_modules/ink/build/render.d.ts +2 -57
  147. package/node_modules/ink/build/render.js +11 -18
  148. package/node_modules/ink/build/render.js.map +1 -1
  149. package/node_modules/ink/build/screen-reader-update.d.ts +13 -0
  150. package/node_modules/ink/build/screen-reader-update.js +38 -0
  151. package/node_modules/ink/build/screen-reader-update.js.map +1 -0
  152. package/node_modules/ink/build/styles.d.ts +16 -78
  153. package/node_modules/ink/build/styles.js +31 -102
  154. package/node_modules/ink/build/styles.js.map +1 -1
  155. package/node_modules/ink/build/utils.d.ts +2 -9
  156. package/node_modules/ink/build/utils.js +3 -18
  157. package/node_modules/ink/build/utils.js.map +1 -1
  158. package/node_modules/ink/build/wrap-text.js +0 -7
  159. package/node_modules/ink/build/wrap-text.js.map +1 -1
  160. package/node_modules/ink/build/write-synchronized.d.ts +1 -1
  161. package/node_modules/ink/build/write-synchronized.js +2 -4
  162. package/node_modules/ink/build/write-synchronized.js.map +1 -1
  163. package/node_modules/ink/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  164. package/node_modules/ink/node_modules/emoji-regex/README.md +107 -0
  165. package/node_modules/ink/node_modules/emoji-regex/index.d.ts +3 -0
  166. package/node_modules/ink/node_modules/emoji-regex/index.js +4 -0
  167. package/node_modules/ink/node_modules/emoji-regex/index.mjs +4 -0
  168. package/node_modules/ink/node_modules/emoji-regex/package.json +45 -0
  169. package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/index.d.ts +1 -1
  170. package/node_modules/ink/node_modules/wrap-ansi/index.js +222 -0
  171. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.d.ts +39 -0
  172. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/index.js +82 -0
  173. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/license +9 -0
  174. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/package.json +64 -0
  175. package/node_modules/ink/node_modules/wrap-ansi/node_modules/string-width/readme.md +66 -0
  176. package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/package.json +11 -11
  177. package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/readme.md +0 -2
  178. package/node_modules/ink/package.json +98 -34
  179. package/node_modules/ink/readme.md +48 -554
  180. package/node_modules/slice-ansi/index.d.ts +1 -1
  181. package/node_modules/slice-ansi/index.js +89 -146
  182. package/node_modules/slice-ansi/package.json +5 -5
  183. package/node_modules/slice-ansi/readme.md +0 -1
  184. package/node_modules/slice-ansi/tokenize-ansi.js +1 -1
  185. package/package.json +14 -10
  186. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts +188 -0
  187. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
  188. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js +293 -0
  189. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
  190. package/packages/testkit-bridge/node_modules/@elench/testkit-protocol/package.json +25 -0
  191. package/lib/cli/commands/db/snapshot/capture.mjs +0 -26
  192. package/lib/cli/renderers/db-snapshot-capture/text.mjs +0 -3
  193. package/node_modules/@alcalzone/ansi-tokenize/build/consts.d.ts +0 -17
  194. package/node_modules/@alcalzone/ansi-tokenize/build/consts.js +0 -28
  195. package/node_modules/@alcalzone/ansi-tokenize/build/consts.js.map +0 -1
  196. package/node_modules/ink/build/components/AnimationContext.d.ts +0 -9
  197. package/node_modules/ink/build/components/AnimationContext.js +0 -13
  198. package/node_modules/ink/build/components/AnimationContext.js.map +0 -1
  199. package/node_modules/ink/build/hooks/use-animation.d.ts +0 -49
  200. package/node_modules/ink/build/hooks/use-animation.js +0 -87
  201. package/node_modules/ink/build/hooks/use-animation.js.map +0 -1
  202. package/node_modules/ink/build/hooks/use-box-metrics.d.ts +0 -59
  203. package/node_modules/ink/build/hooks/use-box-metrics.js +0 -88
  204. package/node_modules/ink/build/hooks/use-box-metrics.js.map +0 -1
  205. package/node_modules/ink/build/hooks/use-paste.d.ts +0 -35
  206. package/node_modules/ink/build/hooks/use-paste.js +0 -62
  207. package/node_modules/ink/build/hooks/use-paste.js.map +0 -1
  208. package/node_modules/ink/build/hooks/use-window-size.d.ts +0 -18
  209. package/node_modules/ink/build/hooks/use-window-size.js +0 -22
  210. package/node_modules/ink/build/hooks/use-window-size.js.map +0 -1
  211. package/node_modules/wrap-ansi/index.js +0 -468
  212. /package/node_modules/{wrap-ansi → ink/node_modules/wrap-ansi}/license +0 -0
@@ -1,10 +1,9 @@
1
- import { useEffect, useEffectEvent } from 'react';
1
+ import { useEffect } from 'react';
2
2
  import parseKeypress, { nonAlphanumericKeys } from '../parse-keypress.js';
3
3
  import reconciler from '../reconciler.js';
4
- import { useStdinContext } from './use-stdin.js';
4
+ import useStdin from './use-stdin.js';
5
5
  /**
6
- A React hook that returns `void` and handles user input.
7
- It's a more convenient alternative to using `StdinContext` and listening for `data` events. The callback you pass to `useInput` is called for each character when the user enters any input. However, if the user pastes text and it's more than one character, the callback will be called only once, and the whole string will be passed as `input`.
6
+ This hook is used for handling user input. It's a more convenient alternative to using `StdinContext` and listening for `data` events. The callback you pass to `useInput` is called for each character when the user enters any input. However, if the user pastes text and it's more than one character, the callback will be called only once, and the whole string will be passed as `input`.
8
7
 
9
8
  ```
10
9
  import {useInput} from 'ink';
@@ -26,7 +25,7 @@ const UserInput = () => {
26
25
  */
27
26
  const useInput = (inputHandler, options = {}) => {
28
27
  // eslint-disable-next-line @typescript-eslint/naming-convention
29
- const { setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = useStdinContext();
28
+ const { stdin, setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = useStdin();
30
29
  useEffect(() => {
31
30
  if (options.isActive === false) {
32
31
  return;
@@ -36,91 +35,90 @@ const useInput = (inputHandler, options = {}) => {
36
35
  setRawMode(false);
37
36
  };
38
37
  }, [options.isActive, setRawMode]);
39
- const handleData = useEffectEvent((data) => {
40
- const keypress = parseKeypress(data);
41
- const key = {
42
- upArrow: keypress.name === 'up',
43
- downArrow: keypress.name === 'down',
44
- leftArrow: keypress.name === 'left',
45
- rightArrow: keypress.name === 'right',
46
- pageDown: keypress.name === 'pagedown',
47
- pageUp: keypress.name === 'pageup',
48
- home: keypress.name === 'home',
49
- end: keypress.name === 'end',
50
- return: keypress.name === 'return',
51
- escape: keypress.name === 'escape',
52
- ctrl: keypress.ctrl,
53
- shift: keypress.shift,
54
- tab: keypress.name === 'tab',
55
- backspace: keypress.name === 'backspace',
56
- delete: keypress.name === 'delete',
57
- meta: keypress.meta,
58
- // Kitty keyboard protocol modifiers
59
- super: keypress.super ?? false,
60
- hyper: keypress.hyper ?? false,
61
- capsLock: keypress.capsLock ?? false,
62
- numLock: keypress.numLock ?? false,
63
- eventType: keypress.eventType,
64
- };
65
- let input;
66
- if (keypress.isKittyProtocol) {
67
- // Use text-as-codepoints field for printable keys (needed when
68
- // reportAllKeysAsEscapeCodes flag is enabled), suppress non-printable
69
- if (keypress.isPrintable) {
70
- input = keypress.text ?? keypress.name;
38
+ useEffect(() => {
39
+ if (options.isActive === false) {
40
+ return;
41
+ }
42
+ const handleData = (data) => {
43
+ const keypress = parseKeypress(data);
44
+ const key = {
45
+ upArrow: keypress.name === 'up',
46
+ downArrow: keypress.name === 'down',
47
+ leftArrow: keypress.name === 'left',
48
+ rightArrow: keypress.name === 'right',
49
+ pageDown: keypress.name === 'pagedown',
50
+ pageUp: keypress.name === 'pageup',
51
+ home: keypress.name === 'home',
52
+ end: keypress.name === 'end',
53
+ return: keypress.name === 'return',
54
+ escape: keypress.name === 'escape',
55
+ ctrl: keypress.ctrl,
56
+ shift: keypress.shift,
57
+ tab: keypress.name === 'tab',
58
+ backspace: keypress.name === 'backspace',
59
+ delete: keypress.name === 'delete',
60
+ // `parseKeypress` parses \u001B\u001B[A (meta + up arrow) as meta = false
61
+ // but with option = true, so we need to take this into account here
62
+ // to avoid breaking changes in Ink.
63
+ // TODO(vadimdemedes): consider removing this in the next major version.
64
+ meta: keypress.meta || keypress.name === 'escape' || keypress.option,
65
+ // Kitty keyboard protocol modifiers
66
+ super: keypress.super ?? false,
67
+ hyper: keypress.hyper ?? false,
68
+ capsLock: keypress.capsLock ?? false,
69
+ numLock: keypress.numLock ?? false,
70
+ eventType: keypress.eventType,
71
+ };
72
+ let input;
73
+ if (keypress.isKittyProtocol) {
74
+ // Use text-as-codepoints field for printable keys (needed when
75
+ // reportAllKeysAsEscapeCodes flag is enabled), suppress non-printable
76
+ if (keypress.isPrintable) {
77
+ input = keypress.text ?? keypress.name;
78
+ }
79
+ else if (keypress.ctrl && keypress.name.length === 1) {
80
+ // Ctrl+letter via codepoint 1-26 form: not printable text, but
81
+ // the letter name must flow through so handlers (e.g. exitOnCtrlC
82
+ // checking `input === 'c' && key.ctrl`) still work.
83
+ input = keypress.name;
84
+ }
85
+ else {
86
+ input = '';
87
+ }
71
88
  }
72
- else if (keypress.ctrl && keypress.name.length === 1) {
73
- // Ctrl+letter via codepoint 1-26 form: not printable text, but
74
- // the letter name must flow through so handlers (e.g. exitOnCtrlC
75
- // checking `input === 'c' && key.ctrl`) still work.
89
+ else if (keypress.ctrl) {
76
90
  input = keypress.name;
77
91
  }
78
92
  else {
93
+ input = keypress.sequence;
94
+ }
95
+ if (!keypress.isKittyProtocol &&
96
+ nonAlphanumericKeys.includes(keypress.name)) {
79
97
  input = '';
80
98
  }
81
- }
82
- else if (keypress.ctrl) {
83
- // Keypress.name is guaranteed non-undefined by parseKeypress,
84
- // but guard defensively since a TypeError here would crash the
85
- // entire Ink app (see https://github.com/vadimdemedes/ink/issues/901).
86
- input = keypress.name ?? '';
87
- }
88
- else {
89
- input = keypress.sequence;
90
- }
91
- if (!keypress.isKittyProtocol &&
92
- nonAlphanumericKeys.includes(keypress.name)) {
93
- input = '';
94
- }
95
- // Strip escape prefix from broken/incomplete sequences that
96
- // parseKeypress did not fully resolve (e.g. a flushed "\u001B[").
97
- if (input.startsWith('\u001B')) {
98
- input = input.slice(1);
99
- }
100
- if (input.length === 1 && /[A-Z]/.test(input)) {
101
- key.shift = true;
102
- }
103
- // If app is supposed to exit on Ctrl+C, skip input listeners.
104
- if (input === 'c' && key.ctrl && internal_exitOnCtrlC) {
105
- return;
106
- }
107
- // Use discreteUpdates to assign DiscreteEventPriority to state
108
- // updates from keyboard input, ensuring they are processed at the
109
- // highest priority in concurrent mode.
110
- // @ts-expect-error Types require 5 arguments (fn, a, b, c, d) but only fn is needed at runtime.
111
- reconciler.discreteUpdates(() => {
112
- inputHandler(input, key);
113
- });
114
- });
115
- useEffect(() => {
116
- if (options.isActive === false) {
117
- return;
118
- }
119
- internal_eventEmitter.on('input', handleData);
99
+ // Strip meta if it's still remaining after `parseKeypress`
100
+ // TODO(vadimdemedes): remove this in the next major version.
101
+ if (input.startsWith('\u001B')) {
102
+ input = input.slice(1);
103
+ }
104
+ if (input.length === 1 &&
105
+ typeof input[0] === 'string' &&
106
+ /[A-Z]/.test(input[0])) {
107
+ key.shift = true;
108
+ }
109
+ // If app is not supposed to exit on Ctrl+C, then let input listener handle it
110
+ if (!(input === 'c' && key.ctrl) || !internal_exitOnCtrlC) {
111
+ // @ts-expect-error TypeScript types for `batchedUpdates` require an argument, but React's codebase doesn't provide it and it works without it as expected.
112
+ reconciler.batchedUpdates(() => {
113
+ inputHandler(input, key);
114
+ });
115
+ }
116
+ };
117
+ internal_eventEmitter?.on('input', handleData);
120
118
  return () => {
121
- internal_eventEmitter.removeListener('input', handleData);
119
+ internal_eventEmitter?.removeListener('input', handleData);
122
120
  };
123
- }, [options.isActive, internal_eventEmitter]);
121
+ }, [options.isActive, stdin, internal_exitOnCtrlC, inputHandler]);
124
122
  };
125
123
  export default useInput;
126
124
  //# sourceMappingURL=use-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-input.js","sourceRoot":"","sources":["../../src/hooks/use-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,cAAc,EAAC,MAAM,OAAO,CAAC;AAChD,OAAO,aAAa,EAAE,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AACxE,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAqI/C;;;;;;;;;;;;;;;;;;;;;EAqBE;AACF,MAAM,QAAQ,GAAG,CAAC,YAAqB,EAAE,UAAmB,EAAE,EAAE,EAAE;IACjE,gEAAgE;IAChE,MAAM,EAAC,UAAU,EAAE,oBAAoB,EAAE,qBAAqB,EAAC,GAC9D,eAAe,EAAE,CAAC;IAEnB,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAChC,OAAO;QACR,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,CAAC;QAEjB,OAAO,GAAG,EAAE;YACX,UAAU,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAEnC,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,IAAY,EAAE,EAAE;QAClD,MAAM,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QAErC,MAAM,GAAG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AO,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ;gBAC5B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EACrB,CAAC;gBACF,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;YAClB,CAAC;YAED,8EAA8E;YAC9E,IAAI,CAAC,CAAC,KAAK,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;gBAC3D,2JAA2J;gBAC3J,UAAU,CAAC,cAAc,CAAC,GAAG,EAAE;oBAC9B,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;gBAC1B,CAAC,CAAC,CAAC;YACJ,CAAC;QACF,CAAC,CAAC;QAEF,qBAAqB,EAAE,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAE/C,OAAO,GAAG,EAAE;YACX,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC5D,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,EAAE,oBAAoB,EAAE,YAAY,CAAC,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,6 +1,5 @@
1
1
  /**
2
- A React hook that returns whether a screen reader is enabled.
3
- This is useful when you want to render different output for screen readers.
2
+ Returns whether a screen reader is enabled. This is useful when you want to render different output for screen readers.
4
3
  */
5
4
  declare const useIsScreenReaderEnabled: () => boolean;
6
5
  export default useIsScreenReaderEnabled;
@@ -1,8 +1,7 @@
1
1
  import { useContext } from 'react';
2
2
  import { accessibilityContext } from '../components/AccessibilityContext.js';
3
3
  /**
4
- A React hook that returns whether a screen reader is enabled.
5
- This is useful when you want to render different output for screen readers.
4
+ Returns whether a screen reader is enabled. This is useful when you want to render different output for screen readers.
6
5
  */
7
6
  const useIsScreenReaderEnabled = () => {
8
7
  const { isScreenReaderEnabled } = useContext(accessibilityContext);
@@ -1 +1 @@
1
- {"version":3,"file":"use-is-screen-reader-enabled.js","sourceRoot":"","sources":["../../src/hooks/use-is-screen-reader-enabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,EAAC,oBAAoB,EAAC,MAAM,uCAAuC,CAAC;AAE3E;;;EAGE;AACF,MAAM,wBAAwB,GAAG,GAAY,EAAE;IAC9C,MAAM,EAAC,qBAAqB,EAAC,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACjE,OAAO,qBAAqB,CAAC;AAC9B,CAAC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
1
+ {"version":3,"file":"use-is-screen-reader-enabled.js","sourceRoot":"","sources":["../../src/hooks/use-is-screen-reader-enabled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,EAAC,oBAAoB,EAAC,MAAM,uCAAuC,CAAC;AAE3E;;EAEE;AACF,MAAM,wBAAwB,GAAG,GAAY,EAAE;IAC9C,MAAM,EAAC,qBAAqB,EAAC,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACjE,OAAO,qBAAqB,CAAC;AAC9B,CAAC,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- A React hook that returns the stderr stream.
2
+ `useStderr` is a React hook that exposes the stderr stream.
3
3
  */
4
4
  declare const useStderr: () => import("../components/StderrContext.js").Props;
5
5
  export default useStderr;
@@ -1,7 +1,7 @@
1
1
  import { useContext } from 'react';
2
2
  import StderrContext from '../components/StderrContext.js';
3
3
  /**
4
- A React hook that returns the stderr stream.
4
+ `useStderr` is a React hook that exposes the stderr stream.
5
5
  */
6
6
  const useStderr = () => useContext(StderrContext);
7
7
  export default useStderr;
@@ -1,7 +1,5 @@
1
- import { type PublicProps, type Props } from '../components/StdinContext.js';
2
1
  /**
3
- A React hook that returns the stdin stream and stdin-related utilities.
2
+ `useStdin` is a React hook that exposes the stdin stream.
4
3
  */
5
- declare const useStdin: () => PublicProps;
6
- export declare const useStdinContext: () => Props;
4
+ declare const useStdin: () => import("../components/StdinContext.js").Props;
7
5
  export default useStdin;
@@ -1,9 +1,8 @@
1
1
  import { useContext } from 'react';
2
2
  import StdinContext from '../components/StdinContext.js';
3
3
  /**
4
- A React hook that returns the stdin stream and stdin-related utilities.
4
+ `useStdin` is a React hook that exposes the stdin stream.
5
5
  */
6
6
  const useStdin = () => useContext(StdinContext);
7
- export const useStdinContext = () => useContext(StdinContext);
8
7
  export default useStdin;
9
8
  //# sourceMappingURL=use-stdin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-stdin.js","sourceRoot":"","sources":["../../src/hooks/use-stdin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,YAGN,MAAM,+BAA+B,CAAC;AAEvC;;EAEE;AACF,MAAM,QAAQ,GAAG,GAAgB,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAE7D,MAAM,CAAC,MAAM,eAAe,GAAG,GAAU,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAErE,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"use-stdin.js","sourceRoot":"","sources":["../../src/hooks/use-stdin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AACjC,OAAO,YAAY,MAAM,+BAA+B,CAAC;AAEzD;;EAEE;AACF,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;AAChD,eAAe,QAAQ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- A React hook that returns the stdout stream where Ink renders your app.
2
+ `useStdout` is a React hook that exposes the stdout stream where Ink renders your app.
3
3
  */
4
4
  declare const useStdout: () => import("../components/StdoutContext.js").Props;
5
5
  export default useStdout;
@@ -1,7 +1,7 @@
1
1
  import { useContext } from 'react';
2
2
  import StdoutContext from '../components/StdoutContext.js';
3
3
  /**
4
- A React hook that returns the stdout stream where Ink renders your app.
4
+ `useStdout` is a React hook that exposes the stdout stream where Ink renders your app.
5
5
  */
6
6
  const useStdout = () => useContext(StdoutContext);
7
7
  export default useStdout;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _ = require("..");
11
+
12
+ var _default = inputHandler => {
13
+ const {
14
+ stdin,
15
+ setRawMode
16
+ } = (0, _react.useContext)(_.StdinContext);
17
+ (0, _react.useLayoutEffect)(() => {
18
+ setRawMode(true);
19
+ return () => setRawMode(false);
20
+ }, [setRawMode]);
21
+ (0, _react.useLayoutEffect)(() => {
22
+ const handleData = data => {
23
+ const input = String(data);
24
+ const meta = {
25
+ up: input === '\u001B[A',
26
+ down: input === '\u001B[B',
27
+ left: input === '\u001B[D',
28
+ right: input === '\u001B[C'
29
+ };
30
+ inputHandler(input, meta);
31
+ };
32
+
33
+ stdin.on('data', handleData);
34
+ return () => stdin.off('data', handleData);
35
+ }, [stdin, inputHandler]);
36
+ };
37
+
38
+ exports.default = _default;
@@ -7,7 +7,7 @@ export { default as Box } from './components/Box.js';
7
7
  export type { Props as TextProps } from './components/Text.js';
8
8
  export { default as Text } from './components/Text.js';
9
9
  export type { Props as AppProps } from './components/AppContext.js';
10
- export type { PublicProps as StdinProps } from './components/StdinContext.js';
10
+ export type { Props as StdinProps } from './components/StdinContext.js';
11
11
  export type { Props as StdoutProps } from './components/StdoutContext.js';
12
12
  export type { Props as StderrProps } from './components/StderrContext.js';
13
13
  export type { Props as StaticProps } from './components/Static.js';
@@ -19,7 +19,6 @@ export { default as Newline } from './components/Newline.js';
19
19
  export { default as Spacer } from './components/Spacer.js';
20
20
  export type { Key } from './hooks/use-input.js';
21
21
  export { default as useInput } from './hooks/use-input.js';
22
- export { default as usePaste } from './hooks/use-paste.js';
23
22
  export { default as useApp } from './hooks/use-app.js';
24
23
  export { default as useStdin } from './hooks/use-stdin.js';
25
24
  export { default as useStdout } from './hooks/use-stdout.js';
@@ -28,12 +27,6 @@ export { default as useFocus } from './hooks/use-focus.js';
28
27
  export { default as useFocusManager } from './hooks/use-focus-manager.js';
29
28
  export { default as useIsScreenReaderEnabled } from './hooks/use-is-screen-reader-enabled.js';
30
29
  export { default as useCursor } from './hooks/use-cursor.js';
31
- export type { AnimationResult } from './hooks/use-animation.js';
32
- export { default as useAnimation } from './hooks/use-animation.js';
33
- export type { WindowSize } from './hooks/use-window-size.js';
34
- export { default as useWindowSize } from './hooks/use-window-size.js';
35
- export type { BoxMetrics, UseBoxMetricsResult } from './hooks/use-box-metrics.js';
36
- export { default as useBoxMetrics } from './hooks/use-box-metrics.js';
37
30
  export type { CursorPosition } from './log-update.js';
38
31
  export { default as measureElement } from './measure-element.js';
39
32
  export type { DOMElement } from './dom.js';
@@ -7,7 +7,6 @@ export { default as Transform } from './components/Transform.js';
7
7
  export { default as Newline } from './components/Newline.js';
8
8
  export { default as Spacer } from './components/Spacer.js';
9
9
  export { default as useInput } from './hooks/use-input.js';
10
- export { default as usePaste } from './hooks/use-paste.js';
11
10
  export { default as useApp } from './hooks/use-app.js';
12
11
  export { default as useStdin } from './hooks/use-stdin.js';
13
12
  export { default as useStdout } from './hooks/use-stdout.js';
@@ -16,9 +15,6 @@ export { default as useFocus } from './hooks/use-focus.js';
16
15
  export { default as useFocusManager } from './hooks/use-focus-manager.js';
17
16
  export { default as useIsScreenReaderEnabled } from './hooks/use-is-screen-reader-enabled.js';
18
17
  export { default as useCursor } from './hooks/use-cursor.js';
19
- export { default as useAnimation } from './hooks/use-animation.js';
20
- export { default as useWindowSize } from './hooks/use-window-size.js';
21
- export { default as useBoxMetrics } from './hooks/use-box-metrics.js';
22
18
  export { default as measureElement } from './measure-element.js';
23
19
  export { kittyFlags, kittyModifiers } from './kit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C3D,OAAO,EAAC,OAAO,IAAI,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAC,OAAO,IAAI,eAAe,EAAC,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAC,OAAO,IAAI,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AAC5F,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAC,OAAO,IAAI,cAAc,EAAC,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAC,UAAU,EAAE,cAAc,EAAC,MAAM,qBAAqB,CAAC"}
@@ -30,45 +30,13 @@ export type Options = {
30
30
  - `useTransition` and `useDeferredValue` are fully functional
31
31
  - Updates can be interrupted for higher priority work
32
32
 
33
- Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change the rendering mode or create a fresh instance.
33
+ Note: Concurrent mode changes the timing of renders. Some tests may need to use `act()` to properly await updates. The `concurrent` option only takes effect on the first render for a given stdout. If you need to change the rendering mode, call `unmount()` first.
34
34
 
35
35
  @default false
36
36
  @experimental
37
37
  */
38
38
  concurrent?: boolean;
39
39
  kittyKeyboard?: KittyKeyboardOptions;
40
- /**
41
- Override automatic interactive mode detection.
42
-
43
- By default, Ink detects whether the environment is interactive based on CI detection (via [`is-in-ci`](https://github.com/sindresorhus/is-in-ci)) and `stdout.isTTY`. Most users should not need to set this.
44
-
45
- When non-interactive, Ink disables ANSI erase sequences, cursor manipulation, synchronized output, resize handling, and kitty keyboard auto-detection, writing only the final frame at unmount.
46
-
47
- Set to `false` to force non-interactive mode or `true` to force interactive mode when the automatic detection doesn't suit your use case.
48
-
49
- Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
50
-
51
- @default true (false if in CI or `stdout.isTTY` is falsy)
52
-
53
- @see {@link RenderOptions.interactive}
54
- */
55
- interactive?: boolean;
56
- /**
57
- Render the app in the terminal's alternate screen buffer. When enabled, the app renders on a separate screen, and the original terminal content is restored when the app exits. This is the same mechanism used by programs like vim, htop, and less.
58
-
59
- Note: The terminal's scrollback buffer is not available while in the alternate screen. This is standard terminal behavior; programs like vim use the alternate screen specifically to avoid polluting the user's scrollback history.
60
-
61
- Note: Ink intentionally treats alternate-screen teardown output as disposable. It does not preserve or replay teardown-time frames, hook writes, or `console.*` output after restoring the primary screen.
62
-
63
- Only works in interactive mode. Ignored when `interactive` is `false` or in a non-interactive environment (CI, piped stdout).
64
-
65
- Note: Reusing the same stdout across multiple `render()` calls without unmounting is unsupported. Call `unmount()` first if you need to change this option or create a fresh instance.
66
-
67
- @default false
68
-
69
- @see {@link RenderOptions.alternateScreen}
70
- */
71
- alternateScreen?: boolean;
72
40
  };
73
41
  export default class Ink {
74
42
  /**
@@ -80,9 +48,6 @@ export default class Ink {
80
48
  private cursorPosition;
81
49
  private readonly throttledLog;
82
50
  private readonly isScreenReaderEnabled;
83
- private readonly interactive;
84
- private readonly renderThrottleMs;
85
- private alternateScreen;
86
51
  private isUnmounted;
87
52
  private isUnmounting;
88
53
  private lastOutput;
@@ -92,7 +57,7 @@ export default class Ink {
92
57
  private readonly container;
93
58
  private readonly rootNode;
94
59
  private fullStaticOutput;
95
- private readonly exitPromise;
60
+ private exitPromise?;
96
61
  private exitResult;
97
62
  private beforeExitHandler?;
98
63
  private restoreConsole?;
@@ -101,8 +66,8 @@ export default class Ink {
101
66
  private hasPendingThrottledRender;
102
67
  private kittyProtocolEnabled;
103
68
  private cancelKittyDetection?;
104
- private nextRenderCommit?;
105
69
  constructor(options: Options);
70
+ getTerminalWidth: () => number;
106
71
  resized: () => void;
107
72
  resolveExitPromise: (result?: unknown) => void;
108
73
  rejectExitPromise: (reason?: Error) => void;
@@ -117,18 +82,8 @@ export default class Ink {
117
82
  writeToStderr(data: string): void;
118
83
  unmount(error?: Error | number | null): void;
119
84
  waitUntilExit(): Promise<unknown>;
120
- waitUntilRenderFlush(): Promise<void>;
121
85
  clear(): void;
122
86
  patchConsole(): void;
123
- private setAlternateScreen;
124
- private resolveInteractiveOption;
125
- private resolveAlternateScreenOption;
126
- private shouldSync;
127
- private writeBestEffort;
128
- private awaitExit;
129
- private hasPendingConcurrentWork;
130
- private awaitNextRender;
131
- private renderInteractiveFrame;
132
87
  private initKittyKeyboard;
133
88
  private confirmKittySupport;
134
89
  private enableKittyProtocol;