@deepseek-harness-tui/dsh-tui 0.5.0

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 (638) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +235 -0
  3. package/bin/dsh-tui.js +95 -0
  4. package/cordis.patch.yml +218 -0
  5. package/cordis.yml +185 -0
  6. package/lib/invariant.js +28 -0
  7. package/lib/types/activityPrefs.d.ts +29 -0
  8. package/lib/types/activityPrefs.d.ts.map +1 -0
  9. package/lib/types/activityPrefs.js +60 -0
  10. package/lib/types/bootstrap/state.d.ts +13 -0
  11. package/lib/types/bootstrap/state.d.ts.map +1 -0
  12. package/lib/types/bootstrap/state.js +12 -0
  13. package/lib/types/cc/cliHighlight.d.ts +20 -0
  14. package/lib/types/cc/cliHighlight.d.ts.map +1 -0
  15. package/lib/types/cc/cliHighlight.js +53 -0
  16. package/lib/types/cc/figures.d.ts +59 -0
  17. package/lib/types/cc/figures.d.ts.map +1 -0
  18. package/lib/types/cc/figures.js +69 -0
  19. package/lib/types/cc/format.d.ts +26 -0
  20. package/lib/types/cc/format.d.ts.map +1 -0
  21. package/lib/types/cc/format.js +55 -0
  22. package/lib/types/cc/hash.d.ts +25 -0
  23. package/lib/types/cc/hash.d.ts.map +1 -0
  24. package/lib/types/cc/hash.js +41 -0
  25. package/lib/types/cc/hyperlink.d.ts +21 -0
  26. package/lib/types/cc/hyperlink.d.ts.map +1 -0
  27. package/lib/types/cc/hyperlink.js +31 -0
  28. package/lib/types/cc/markdown.d.ts +43 -0
  29. package/lib/types/cc/markdown.d.ts.map +1 -0
  30. package/lib/types/cc/markdown.js +345 -0
  31. package/lib/types/cc/spinnerVerbs.d.ts +3 -0
  32. package/lib/types/cc/spinnerVerbs.d.ts.map +1 -0
  33. package/lib/types/cc/spinnerVerbs.js +190 -0
  34. package/lib/types/cc/terminal.d.ts +15 -0
  35. package/lib/types/cc/terminal.d.ts.map +1 -0
  36. package/lib/types/cc/terminal.js +84 -0
  37. package/lib/types/channel.d.ts +672 -0
  38. package/lib/types/channel.d.ts.map +1 -0
  39. package/lib/types/channel.js +2427 -0
  40. package/lib/types/childStderr.d.ts +63 -0
  41. package/lib/types/childStderr.d.ts.map +1 -0
  42. package/lib/types/childStderr.js +161 -0
  43. package/lib/types/commands.d.ts +55 -0
  44. package/lib/types/commands.d.ts.map +1 -0
  45. package/lib/types/commands.js +101 -0
  46. package/lib/types/components/ActivityLine.d.ts +29 -0
  47. package/lib/types/components/ActivityLine.d.ts.map +1 -0
  48. package/lib/types/components/ActivityLine.js +47 -0
  49. package/lib/types/components/ActivityPicker.d.ts +13 -0
  50. package/lib/types/components/ActivityPicker.d.ts.map +1 -0
  51. package/lib/types/components/ActivityPicker.js +24 -0
  52. package/lib/types/components/CommandSuggestions.d.ts +14 -0
  53. package/lib/types/components/CommandSuggestions.d.ts.map +1 -0
  54. package/lib/types/components/CommandSuggestions.js +33 -0
  55. package/lib/types/components/FileSuggestions.d.ts +12 -0
  56. package/lib/types/components/FileSuggestions.d.ts.map +1 -0
  57. package/lib/types/components/FileSuggestions.js +26 -0
  58. package/lib/types/components/GoalTodoPanel.d.ts +13 -0
  59. package/lib/types/components/GoalTodoPanel.d.ts.map +1 -0
  60. package/lib/types/components/GoalTodoPanel.js +57 -0
  61. package/lib/types/components/HelpMenu.d.ts +12 -0
  62. package/lib/types/components/HelpMenu.d.ts.map +1 -0
  63. package/lib/types/components/HelpMenu.js +12 -0
  64. package/lib/types/components/HistorySearchDialog.d.ts +16 -0
  65. package/lib/types/components/HistorySearchDialog.d.ts.map +1 -0
  66. package/lib/types/components/HistorySearchDialog.js +31 -0
  67. package/lib/types/components/InterruptedByUser.d.ts +7 -0
  68. package/lib/types/components/InterruptedByUser.d.ts.map +1 -0
  69. package/lib/types/components/InterruptedByUser.js +9 -0
  70. package/lib/types/components/LoadedContextPanel.d.ts +20 -0
  71. package/lib/types/components/LoadedContextPanel.d.ts.map +1 -0
  72. package/lib/types/components/LoadedContextPanel.js +30 -0
  73. package/lib/types/components/LogoV2.d.ts +23 -0
  74. package/lib/types/components/LogoV2.d.ts.map +1 -0
  75. package/lib/types/components/LogoV2.js +95 -0
  76. package/lib/types/components/Markdown.d.ts +24 -0
  77. package/lib/types/components/Markdown.d.ts.map +1 -0
  78. package/lib/types/components/Markdown.js +106 -0
  79. package/lib/types/components/MarkdownTable.d.ts +17 -0
  80. package/lib/types/components/MarkdownTable.d.ts.map +1 -0
  81. package/lib/types/components/MarkdownTable.js +272 -0
  82. package/lib/types/components/MessageList.d.ts +41 -0
  83. package/lib/types/components/MessageList.d.ts.map +1 -0
  84. package/lib/types/components/MessageList.js +303 -0
  85. package/lib/types/components/ModelPicker.d.ts +14 -0
  86. package/lib/types/components/ModelPicker.d.ts.map +1 -0
  87. package/lib/types/components/ModelPicker.js +15 -0
  88. package/lib/types/components/PresetPicker.d.ts +17 -0
  89. package/lib/types/components/PresetPicker.d.ts.map +1 -0
  90. package/lib/types/components/PresetPicker.js +25 -0
  91. package/lib/types/components/PromptInput.d.ts +67 -0
  92. package/lib/types/components/PromptInput.d.ts.map +1 -0
  93. package/lib/types/components/PromptInput.js +778 -0
  94. package/lib/types/components/ResumePicker.d.ts +15 -0
  95. package/lib/types/components/ResumePicker.d.ts.map +1 -0
  96. package/lib/types/components/ResumePicker.js +34 -0
  97. package/lib/types/components/RewindPicker.d.ts +14 -0
  98. package/lib/types/components/RewindPicker.d.ts.map +1 -0
  99. package/lib/types/components/RewindPicker.js +23 -0
  100. package/lib/types/components/SearchBox.d.ts +20 -0
  101. package/lib/types/components/SearchBox.d.ts.map +1 -0
  102. package/lib/types/components/SearchBox.js +33 -0
  103. package/lib/types/components/Select.d.ts +22 -0
  104. package/lib/types/components/Select.d.ts.map +1 -0
  105. package/lib/types/components/Select.js +19 -0
  106. package/lib/types/components/Spinner/GlimmerMessage.d.ts +19 -0
  107. package/lib/types/components/Spinner/GlimmerMessage.d.ts.map +1 -0
  108. package/lib/types/components/Spinner/GlimmerMessage.js +78 -0
  109. package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts +31 -0
  110. package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts.map +1 -0
  111. package/lib/types/components/Spinner/SpinnerAnimationRow.js +162 -0
  112. package/lib/types/components/Spinner/SpinnerGlyph.d.ts +16 -0
  113. package/lib/types/components/Spinner/SpinnerGlyph.d.ts.map +1 -0
  114. package/lib/types/components/Spinner/SpinnerGlyph.js +36 -0
  115. package/lib/types/components/Spinner/spinnerMode.d.ts +6 -0
  116. package/lib/types/components/Spinner/spinnerMode.d.ts.map +1 -0
  117. package/lib/types/components/Spinner/spinnerMode.js +1 -0
  118. package/lib/types/components/Spinner/spinnerUtils.d.ts +41 -0
  119. package/lib/types/components/Spinner/spinnerUtils.d.ts.map +1 -0
  120. package/lib/types/components/Spinner/spinnerUtils.js +104 -0
  121. package/lib/types/components/Spinner/useStalledAnimation.d.ts +16 -0
  122. package/lib/types/components/Spinner/useStalledAnimation.d.ts.map +1 -0
  123. package/lib/types/components/Spinner/useStalledAnimation.js +71 -0
  124. package/lib/types/components/StreamingMarkdown.d.ts +12 -0
  125. package/lib/types/components/StreamingMarkdown.d.ts.map +1 -0
  126. package/lib/types/components/StreamingMarkdown.js +39 -0
  127. package/lib/types/components/ThemePicker.d.ts +22 -0
  128. package/lib/types/components/ThemePicker.d.ts.map +1 -0
  129. package/lib/types/components/ThemePicker.js +51 -0
  130. package/lib/types/components/ThinkingToggle.d.ts +17 -0
  131. package/lib/types/components/ThinkingToggle.d.ts.map +1 -0
  132. package/lib/types/components/ThinkingToggle.js +30 -0
  133. package/lib/types/components/ToolUseLoader.d.ts +13 -0
  134. package/lib/types/components/ToolUseLoader.d.ts.map +1 -0
  135. package/lib/types/components/ToolUseLoader.js +17 -0
  136. package/lib/types/components/Whale.d.ts +22 -0
  137. package/lib/types/components/Whale.d.ts.map +1 -0
  138. package/lib/types/components/Whale.js +78 -0
  139. package/lib/types/components/WorkingSpinner.d.ts +26 -0
  140. package/lib/types/components/WorkingSpinner.d.ts.map +1 -0
  141. package/lib/types/components/WorkingSpinner.js +68 -0
  142. package/lib/types/components/activityFrames.d.ts +31 -0
  143. package/lib/types/components/activityFrames.d.ts.map +1 -0
  144. package/lib/types/components/activityFrames.js +83 -0
  145. package/lib/types/components/bigfont.d.ts +28 -0
  146. package/lib/types/components/bigfont.d.ts.map +1 -0
  147. package/lib/types/components/bigfont.js +91 -0
  148. package/lib/types/components/design-system/Byline.d.ts +14 -0
  149. package/lib/types/components/design-system/Byline.d.ts.map +1 -0
  150. package/lib/types/components/design-system/Byline.js +17 -0
  151. package/lib/types/components/design-system/Divider.d.ts +40 -0
  152. package/lib/types/components/design-system/Divider.d.ts.map +1 -0
  153. package/lib/types/components/design-system/Divider.js +24 -0
  154. package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +19 -0
  155. package/lib/types/components/design-system/KeyboardShortcutHint.d.ts.map +1 -0
  156. package/lib/types/components/design-system/KeyboardShortcutHint.js +14 -0
  157. package/lib/types/components/design-system/ListItem.d.ts +36 -0
  158. package/lib/types/components/design-system/ListItem.d.ts.map +1 -0
  159. package/lib/types/components/design-system/ListItem.js +48 -0
  160. package/lib/types/components/design-system/LoadingState.d.ts +19 -0
  161. package/lib/types/components/design-system/LoadingState.d.ts.map +1 -0
  162. package/lib/types/components/design-system/LoadingState.js +22 -0
  163. package/lib/types/components/design-system/Pane.d.ts +17 -0
  164. package/lib/types/components/design-system/Pane.d.ts.map +1 -0
  165. package/lib/types/components/design-system/Pane.js +15 -0
  166. package/lib/types/components/design-system/ProgressBar.d.ts +22 -0
  167. package/lib/types/components/design-system/ProgressBar.d.ts.map +1 -0
  168. package/lib/types/components/design-system/ProgressBar.js +27 -0
  169. package/lib/types/components/design-system/StatusIcon.d.ts +15 -0
  170. package/lib/types/components/design-system/StatusIcon.d.ts.map +1 -0
  171. package/lib/types/components/design-system/StatusIcon.js +20 -0
  172. package/lib/types/components/design-system/ThemeProvider.d.ts +11 -0
  173. package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -0
  174. package/lib/types/components/design-system/ThemeProvider.js +135 -0
  175. package/lib/types/components/design-system/ThemedBox.d.ts +37 -0
  176. package/lib/types/components/design-system/ThemedBox.d.ts.map +1 -0
  177. package/lib/types/components/design-system/ThemedBox.js +26 -0
  178. package/lib/types/components/design-system/ThemedText.d.ts +56 -0
  179. package/lib/types/components/design-system/ThemedText.d.ts.map +1 -0
  180. package/lib/types/components/design-system/ThemedText.js +45 -0
  181. package/lib/types/components/messages/AssistantTextMessage.d.ts +18 -0
  182. package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -0
  183. package/lib/types/components/messages/AssistantTextMessage.js +15 -0
  184. package/lib/types/components/messages/AssistantThinkingMessage.d.ts +23 -0
  185. package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -0
  186. package/lib/types/components/messages/AssistantThinkingMessage.js +23 -0
  187. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +23 -0
  188. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -0
  189. package/lib/types/components/messages/AssistantToolUseMessage.js +220 -0
  190. package/lib/types/components/messages/MessageMetadata.d.ts +15 -0
  191. package/lib/types/components/messages/MessageMetadata.d.ts.map +1 -0
  192. package/lib/types/components/messages/MessageMetadata.js +20 -0
  193. package/lib/types/components/messages/UserPromptMessage.d.ts +19 -0
  194. package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -0
  195. package/lib/types/components/messages/UserPromptMessage.js +15 -0
  196. package/lib/types/components/questions/AskUserQuestionPanel.d.ts +39 -0
  197. package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -0
  198. package/lib/types/components/questions/AskUserQuestionPanel.js +228 -0
  199. package/lib/types/components/shimmer.d.ts +35 -0
  200. package/lib/types/components/shimmer.d.ts.map +1 -0
  201. package/lib/types/components/shimmer.js +43 -0
  202. package/lib/types/components/whaleFrames.d.ts +25 -0
  203. package/lib/types/components/whaleFrames.d.ts.map +1 -0
  204. package/lib/types/components/whaleFrames.js +419 -0
  205. package/lib/types/customTheme.d.ts +104 -0
  206. package/lib/types/customTheme.d.ts.map +1 -0
  207. package/lib/types/customTheme.js +268 -0
  208. package/lib/types/effortPrefs.d.ts +22 -0
  209. package/lib/types/effortPrefs.d.ts.map +1 -0
  210. package/lib/types/effortPrefs.js +45 -0
  211. package/lib/types/history.d.ts +24 -0
  212. package/lib/types/history.d.ts.map +1 -0
  213. package/lib/types/history.js +75 -0
  214. package/lib/types/hooks/useBlink.d.ts +11 -0
  215. package/lib/types/hooks/useBlink.d.ts.map +1 -0
  216. package/lib/types/hooks/useBlink.js +20 -0
  217. package/lib/types/i18n.d.ts +926 -0
  218. package/lib/types/i18n.d.ts.map +1 -0
  219. package/lib/types/i18n.js +356 -0
  220. package/lib/types/index.d.ts +70 -0
  221. package/lib/types/index.d.ts.map +1 -0
  222. package/lib/types/index.js +31 -0
  223. package/lib/types/ink/Ansi.d.ts +11 -0
  224. package/lib/types/ink/Ansi.d.ts.map +1 -0
  225. package/lib/types/ink/Ansi.js +269 -0
  226. package/lib/types/ink/bidi.d.ts +18 -0
  227. package/lib/types/ink/bidi.d.ts.map +1 -0
  228. package/lib/types/ink/bidi.js +119 -0
  229. package/lib/types/ink/clearTerminal.d.ts +22 -0
  230. package/lib/types/ink/clearTerminal.d.ts.map +1 -0
  231. package/lib/types/ink/clearTerminal.js +72 -0
  232. package/lib/types/ink/colorize.d.ts +33 -0
  233. package/lib/types/ink/colorize.d.ts.map +1 -0
  234. package/lib/types/ink/colorize.js +213 -0
  235. package/lib/types/ink/components/AlternateScreen.d.ts +22 -0
  236. package/lib/types/ink/components/AlternateScreen.d.ts.map +1 -0
  237. package/lib/types/ink/components/AlternateScreen.js +74 -0
  238. package/lib/types/ink/components/App.d.ts +73 -0
  239. package/lib/types/ink/components/App.d.ts.map +1 -0
  240. package/lib/types/ink/components/App.js +597 -0
  241. package/lib/types/ink/components/AppContext.d.ts +15 -0
  242. package/lib/types/ink/components/AppContext.d.ts.map +1 -0
  243. package/lib/types/ink/components/AppContext.js +11 -0
  244. package/lib/types/ink/components/Box.d.ts +49 -0
  245. package/lib/types/ink/components/Box.d.ts.map +1 -0
  246. package/lib/types/ink/components/Box.js +153 -0
  247. package/lib/types/ink/components/Button.d.ts +37 -0
  248. package/lib/types/ink/components/Button.d.ts.map +1 -0
  249. package/lib/types/ink/components/Button.js +166 -0
  250. package/lib/types/ink/components/ClockContext.d.ts +10 -0
  251. package/lib/types/ink/components/ClockContext.d.ts.map +1 -0
  252. package/lib/types/ink/components/ClockContext.js +108 -0
  253. package/lib/types/ink/components/CursorDeclarationContext.d.ts +30 -0
  254. package/lib/types/ink/components/CursorDeclarationContext.d.ts.map +1 -0
  255. package/lib/types/ink/components/CursorDeclarationContext.js +6 -0
  256. package/lib/types/ink/components/ErrorOverview.d.ts +7 -0
  257. package/lib/types/ink/components/ErrorOverview.d.ts.map +1 -0
  258. package/lib/types/ink/components/ErrorOverview.js +49 -0
  259. package/lib/types/ink/components/Link.d.ts +8 -0
  260. package/lib/types/ink/components/Link.d.ts.map +1 -0
  261. package/lib/types/ink/components/Link.js +33 -0
  262. package/lib/types/ink/components/Newline.d.ts +13 -0
  263. package/lib/types/ink/components/Newline.d.ts.map +1 -0
  264. package/lib/types/ink/components/Newline.js +29 -0
  265. package/lib/types/ink/components/NoSelect.d.ts +20 -0
  266. package/lib/types/ink/components/NoSelect.d.ts.map +1 -0
  267. package/lib/types/ink/components/NoSelect.js +56 -0
  268. package/lib/types/ink/components/RawAnsi.d.ts +17 -0
  269. package/lib/types/ink/components/RawAnsi.d.ts.map +1 -0
  270. package/lib/types/ink/components/RawAnsi.js +45 -0
  271. package/lib/types/ink/components/ScrollBox.d.ts +78 -0
  272. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -0
  273. package/lib/types/ink/components/ScrollBox.js +174 -0
  274. package/lib/types/ink/components/Spacer.d.ts +6 -0
  275. package/lib/types/ink/components/Spacer.d.ts.map +1 -0
  276. package/lib/types/ink/components/Spacer.js +19 -0
  277. package/lib/types/ink/components/StdinContext.d.ts +32 -0
  278. package/lib/types/ink/components/StdinContext.d.ts.map +1 -0
  279. package/lib/types/ink/components/StdinContext.js +16 -0
  280. package/lib/types/ink/components/TerminalFocusContext.d.ts +11 -0
  281. package/lib/types/ink/components/TerminalFocusContext.d.ts.map +1 -0
  282. package/lib/types/ink/components/TerminalFocusContext.js +45 -0
  283. package/lib/types/ink/components/TerminalSizeContext.d.ts +6 -0
  284. package/lib/types/ink/components/TerminalSizeContext.d.ts.map +1 -0
  285. package/lib/types/ink/components/TerminalSizeContext.js +3 -0
  286. package/lib/types/ink/components/Text.d.ts +56 -0
  287. package/lib/types/ink/components/Text.d.ts.map +1 -0
  288. package/lib/types/ink/components/Text.js +194 -0
  289. package/lib/types/ink/constants.d.ts +3 -0
  290. package/lib/types/ink/constants.d.ts.map +1 -0
  291. package/lib/types/ink/constants.js +2 -0
  292. package/lib/types/ink/cursor.d.ts +11 -0
  293. package/lib/types/ink/cursor.d.ts.map +1 -0
  294. package/lib/types/ink/cursor.js +1 -0
  295. package/lib/types/ink/devtools.d.ts +7 -0
  296. package/lib/types/ink/devtools.d.ts.map +1 -0
  297. package/lib/types/ink/devtools.js +1 -0
  298. package/lib/types/ink/dom.d.ts +178 -0
  299. package/lib/types/ink/dom.d.ts.map +1 -0
  300. package/lib/types/ink/dom.js +424 -0
  301. package/lib/types/ink/events/click-event.d.ts +32 -0
  302. package/lib/types/ink/events/click-event.d.ts.map +1 -0
  303. package/lib/types/ink/events/click-event.js +36 -0
  304. package/lib/types/ink/events/dispatcher.d.ts +63 -0
  305. package/lib/types/ink/events/dispatcher.d.ts.map +1 -0
  306. package/lib/types/ink/events/dispatcher.js +194 -0
  307. package/lib/types/ink/events/emitter.d.ts +20 -0
  308. package/lib/types/ink/events/emitter.d.ts.map +1 -0
  309. package/lib/types/ink/events/emitter.js +43 -0
  310. package/lib/types/ink/events/event-handlers.d.ts +47 -0
  311. package/lib/types/ink/events/event-handlers.d.ts.map +1 -0
  312. package/lib/types/ink/events/event-handlers.js +30 -0
  313. package/lib/types/ink/events/event.d.ts +19 -0
  314. package/lib/types/ink/events/event.d.ts.map +1 -0
  315. package/lib/types/ink/events/event.js +22 -0
  316. package/lib/types/ink/events/focus-event.d.ts +19 -0
  317. package/lib/types/ink/events/focus-event.d.ts.map +1 -0
  318. package/lib/types/ink/events/focus-event.js +21 -0
  319. package/lib/types/ink/events/input-event.d.ts +53 -0
  320. package/lib/types/ink/events/input-event.d.ts.map +1 -0
  321. package/lib/types/ink/events/input-event.js +180 -0
  322. package/lib/types/ink/events/keyboard-event.d.ts +40 -0
  323. package/lib/types/ink/events/keyboard-event.d.ts.map +1 -0
  324. package/lib/types/ink/events/keyboard-event.js +65 -0
  325. package/lib/types/ink/events/paste-event.d.ts +11 -0
  326. package/lib/types/ink/events/paste-event.d.ts.map +1 -0
  327. package/lib/types/ink/events/paste-event.js +13 -0
  328. package/lib/types/ink/events/resize-event.d.ts +13 -0
  329. package/lib/types/ink/events/resize-event.d.ts.map +1 -0
  330. package/lib/types/ink/events/resize-event.js +16 -0
  331. package/lib/types/ink/events/terminal-event.d.ts +112 -0
  332. package/lib/types/ink/events/terminal-event.d.ts.map +1 -0
  333. package/lib/types/ink/events/terminal-event.js +131 -0
  334. package/lib/types/ink/events/terminal-focus-event.d.ts +21 -0
  335. package/lib/types/ink/events/terminal-focus-event.d.ts.map +1 -0
  336. package/lib/types/ink/events/terminal-focus-event.js +18 -0
  337. package/lib/types/ink/focus.d.ts +74 -0
  338. package/lib/types/ink/focus.d.ts.map +1 -0
  339. package/lib/types/ink/focus.js +188 -0
  340. package/lib/types/ink/frame.d.ts +119 -0
  341. package/lib/types/ink/frame.d.ts.map +1 -0
  342. package/lib/types/ink/frame.js +43 -0
  343. package/lib/types/ink/get-max-width.d.ts +20 -0
  344. package/lib/types/ink/get-max-width.d.ts.map +1 -0
  345. package/lib/types/ink/get-max-width.js +25 -0
  346. package/lib/types/ink/hit-test.d.ts +47 -0
  347. package/lib/types/ink/hit-test.d.ts.map +1 -0
  348. package/lib/types/ink/hit-test.js +126 -0
  349. package/lib/types/ink/hooks/use-animation-frame.d.ts +27 -0
  350. package/lib/types/ink/hooks/use-animation-frame.d.ts.map +1 -0
  351. package/lib/types/ink/hooks/use-animation-frame.js +48 -0
  352. package/lib/types/ink/hooks/use-app.d.ts +8 -0
  353. package/lib/types/ink/hooks/use-app.d.ts.map +1 -0
  354. package/lib/types/ink/hooks/use-app.js +8 -0
  355. package/lib/types/ink/hooks/use-copy-on-select.d.ts +22 -0
  356. package/lib/types/ink/hooks/use-copy-on-select.d.ts.map +1 -0
  357. package/lib/types/ink/hooks/use-copy-on-select.js +40 -0
  358. package/lib/types/ink/hooks/use-declared-cursor.d.ts +31 -0
  359. package/lib/types/ink/hooks/use-declared-cursor.d.ts.map +1 -0
  360. package/lib/types/ink/hooks/use-declared-cursor.js +65 -0
  361. package/lib/types/ink/hooks/use-input.d.ts +41 -0
  362. package/lib/types/ink/hooks/use-input.d.ts.map +1 -0
  363. package/lib/types/ink/hooks/use-input.js +73 -0
  364. package/lib/types/ink/hooks/use-interval.d.ts +23 -0
  365. package/lib/types/ink/hooks/use-interval.d.ts.map +1 -0
  366. package/lib/types/ink/hooks/use-interval.js +58 -0
  367. package/lib/types/ink/hooks/use-search-highlight.d.ts +34 -0
  368. package/lib/types/ink/hooks/use-search-highlight.d.ts.map +1 -0
  369. package/lib/types/ink/hooks/use-search-highlight.js +35 -0
  370. package/lib/types/ink/hooks/use-selection.d.ts +44 -0
  371. package/lib/types/ink/hooks/use-selection.d.ts.map +1 -0
  372. package/lib/types/ink/hooks/use-selection.js +64 -0
  373. package/lib/types/ink/hooks/use-stdin.d.ts +8 -0
  374. package/lib/types/ink/hooks/use-stdin.d.ts.map +1 -0
  375. package/lib/types/ink/hooks/use-stdin.js +8 -0
  376. package/lib/types/ink/hooks/use-tab-status.d.ts +18 -0
  377. package/lib/types/ink/hooks/use-tab-status.d.ts.map +1 -0
  378. package/lib/types/ink/hooks/use-tab-status.js +58 -0
  379. package/lib/types/ink/hooks/use-terminal-focus.d.ts +11 -0
  380. package/lib/types/ink/hooks/use-terminal-focus.d.ts.map +1 -0
  381. package/lib/types/ink/hooks/use-terminal-focus.js +15 -0
  382. package/lib/types/ink/hooks/use-terminal-size.d.ts +6 -0
  383. package/lib/types/ink/hooks/use-terminal-size.d.ts.map +1 -0
  384. package/lib/types/ink/hooks/use-terminal-size.js +12 -0
  385. package/lib/types/ink/hooks/use-terminal-title.d.ts +14 -0
  386. package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -0
  387. package/lib/types/ink/hooks/use-terminal-title.js +30 -0
  388. package/lib/types/ink/hooks/use-terminal-viewport.d.ts +32 -0
  389. package/lib/types/ink/hooks/use-terminal-viewport.d.ts.map +1 -0
  390. package/lib/types/ink/hooks/use-terminal-viewport.js +79 -0
  391. package/lib/types/ink/ink.d.ts +370 -0
  392. package/lib/types/ink/ink.d.ts.map +1 -0
  393. package/lib/types/ink/ink.js +1665 -0
  394. package/lib/types/ink/instances.d.ts +10 -0
  395. package/lib/types/ink/instances.d.ts.map +1 -0
  396. package/lib/types/ink/instances.js +13 -0
  397. package/lib/types/ink/layout/engine.d.ts +7 -0
  398. package/lib/types/ink/layout/engine.d.ts.map +1 -0
  399. package/lib/types/ink/layout/engine.js +8 -0
  400. package/lib/types/ink/layout/geometry.d.ts +86 -0
  401. package/lib/types/ink/layout/geometry.d.ts.map +1 -0
  402. package/lib/types/ink/layout/geometry.js +95 -0
  403. package/lib/types/ink/layout/node.d.ts +151 -0
  404. package/lib/types/ink/layout/node.d.ts.map +1 -0
  405. package/lib/types/ink/layout/node.js +72 -0
  406. package/lib/types/ink/layout/yoga.d.ts +69 -0
  407. package/lib/types/ink/layout/yoga.d.ts.map +1 -0
  408. package/lib/types/ink/layout/yoga.js +249 -0
  409. package/lib/types/ink/line-width-cache.d.ts +9 -0
  410. package/lib/types/ink/line-width-cache.d.ts.map +1 -0
  411. package/lib/types/ink/line-width-cache.js +45 -0
  412. package/lib/types/ink/log-update.d.ts +57 -0
  413. package/lib/types/ink/log-update.d.ts.map +1 -0
  414. package/lib/types/ink/log-update.js +710 -0
  415. package/lib/types/ink/measure-element.d.ts +19 -0
  416. package/lib/types/ink/measure-element.d.ts.map +1 -0
  417. package/lib/types/ink/measure-element.js +10 -0
  418. package/lib/types/ink/measure-text.d.ts +13 -0
  419. package/lib/types/ink/measure-text.d.ts.map +1 -0
  420. package/lib/types/ink/measure-text.js +38 -0
  421. package/lib/types/ink/node-cache.d.ts +33 -0
  422. package/lib/types/ink/node-cache.d.ts.map +1 -0
  423. package/lib/types/ink/node-cache.js +42 -0
  424. package/lib/types/ink/optimizer.d.ts +18 -0
  425. package/lib/types/ink/optimizer.d.ts.map +1 -0
  426. package/lib/types/ink/optimizer.js +83 -0
  427. package/lib/types/ink/output.d.ts +200 -0
  428. package/lib/types/ink/output.d.ts.map +1 -0
  429. package/lib/types/ink/output.js +663 -0
  430. package/lib/types/ink/parse-keypress.d.ts +132 -0
  431. package/lib/types/ink/parse-keypress.d.ts.map +1 -0
  432. package/lib/types/ink/parse-keypress.js +707 -0
  433. package/lib/types/ink/reconciler.d.ts +43 -0
  434. package/lib/types/ink/reconciler.d.ts.map +1 -0
  435. package/lib/types/ink/reconciler.js +413 -0
  436. package/lib/types/ink/render-border.d.ts +36 -0
  437. package/lib/types/ink/render-border.d.ts.map +1 -0
  438. package/lib/types/ink/render-border.js +143 -0
  439. package/lib/types/ink/render-node-to-output.d.ts +93 -0
  440. package/lib/types/ink/render-node-to-output.d.ts.map +1 -0
  441. package/lib/types/ink/render-node-to-output.js +1290 -0
  442. package/lib/types/ink/render-to-screen.d.ts +65 -0
  443. package/lib/types/ink/render-to-screen.d.ts.map +1 -0
  444. package/lib/types/ink/render-to-screen.js +189 -0
  445. package/lib/types/ink/renderer.d.ts +24 -0
  446. package/lib/types/ink/renderer.d.ts.map +1 -0
  447. package/lib/types/ink/renderer.js +136 -0
  448. package/lib/types/ink/root.d.ts +91 -0
  449. package/lib/types/ink/root.d.ts.map +1 -0
  450. package/lib/types/ink/root.js +93 -0
  451. package/lib/types/ink/screen.d.ts +443 -0
  452. package/lib/types/ink/screen.d.ts.map +1 -0
  453. package/lib/types/ink/screen.js +1295 -0
  454. package/lib/types/ink/searchHighlight.d.ts +25 -0
  455. package/lib/types/ink/searchHighlight.d.ts.map +1 -0
  456. package/lib/types/ink/searchHighlight.js +82 -0
  457. package/lib/types/ink/selection.d.ts +323 -0
  458. package/lib/types/ink/selection.d.ts.map +1 -0
  459. package/lib/types/ink/selection.js +881 -0
  460. package/lib/types/ink/squash-text-nodes.d.ts +30 -0
  461. package/lib/types/ink/squash-text-nodes.d.ts.map +1 -0
  462. package/lib/types/ink/squash-text-nodes.js +63 -0
  463. package/lib/types/ink/stringWidth.d.ts +11 -0
  464. package/lib/types/ink/stringWidth.d.ts.map +1 -0
  465. package/lib/types/ink/stringWidth.js +209 -0
  466. package/lib/types/ink/styles.d.ts +324 -0
  467. package/lib/types/ink/styles.d.ts.map +1 -0
  468. package/lib/types/ink/styles.js +307 -0
  469. package/lib/types/ink/supports-hyperlinks.d.ts +20 -0
  470. package/lib/types/ink/supports-hyperlinks.d.ts.map +1 -0
  471. package/lib/types/ink/supports-hyperlinks.js +44 -0
  472. package/lib/types/ink/tabstops.d.ts +9 -0
  473. package/lib/types/ink/tabstops.d.ts.map +1 -0
  474. package/lib/types/ink/tabstops.js +46 -0
  475. package/lib/types/ink/terminal-focus-state.d.ts +35 -0
  476. package/lib/types/ink/terminal-focus-state.d.ts.map +1 -0
  477. package/lib/types/ink/terminal-focus-state.js +57 -0
  478. package/lib/types/ink/terminal-querier.d.ts +161 -0
  479. package/lib/types/ink/terminal-querier.d.ts.map +1 -0
  480. package/lib/types/ink/terminal-querier.js +204 -0
  481. package/lib/types/ink/terminal.d.ts +80 -0
  482. package/lib/types/ink/terminal.d.ts.map +1 -0
  483. package/lib/types/ink/terminal.js +268 -0
  484. package/lib/types/ink/termio/ansi.d.ts +75 -0
  485. package/lib/types/ink/termio/ansi.d.ts.map +1 -0
  486. package/lib/types/ink/termio/ansi.js +79 -0
  487. package/lib/types/ink/termio/csi.d.ts +253 -0
  488. package/lib/types/ink/termio/csi.d.ts.map +1 -0
  489. package/lib/types/ink/termio/csi.js +347 -0
  490. package/lib/types/ink/termio/dec.d.ts +61 -0
  491. package/lib/types/ink/termio/dec.d.ts.map +1 -0
  492. package/lib/types/ink/termio/dec.js +76 -0
  493. package/lib/types/ink/termio/esc.d.ts +15 -0
  494. package/lib/types/ink/termio/esc.d.ts.map +1 -0
  495. package/lib/types/ink/termio/esc.js +57 -0
  496. package/lib/types/ink/termio/osc.d.ts +208 -0
  497. package/lib/types/ink/termio/osc.d.ts.map +1 -0
  498. package/lib/types/ink/termio/osc.js +466 -0
  499. package/lib/types/ink/termio/parser.d.ts +46 -0
  500. package/lib/types/ink/termio/parser.d.ts.map +1 -0
  501. package/lib/types/ink/termio/parser.js +366 -0
  502. package/lib/types/ink/termio/sgr.d.ts +17 -0
  503. package/lib/types/ink/termio/sgr.d.ts.map +1 -0
  504. package/lib/types/ink/termio/sgr.js +300 -0
  505. package/lib/types/ink/termio/tokenize.d.ts +50 -0
  506. package/lib/types/ink/termio/tokenize.d.ts.map +1 -0
  507. package/lib/types/ink/termio/tokenize.js +266 -0
  508. package/lib/types/ink/termio/types.d.ts +211 -0
  509. package/lib/types/ink/termio/types.d.ts.map +1 -0
  510. package/lib/types/ink/termio/types.js +68 -0
  511. package/lib/types/ink/termio.d.ts +25 -0
  512. package/lib/types/ink/termio.d.ts.map +1 -0
  513. package/lib/types/ink/termio.js +24 -0
  514. package/lib/types/ink/truncateToWidth.d.ts +7 -0
  515. package/lib/types/ink/truncateToWidth.d.ts.map +1 -0
  516. package/lib/types/ink/truncateToWidth.js +18 -0
  517. package/lib/types/ink/useTerminalNotification.d.ts +45 -0
  518. package/lib/types/ink/useTerminalNotification.d.ts.map +1 -0
  519. package/lib/types/ink/useTerminalNotification.js +70 -0
  520. package/lib/types/ink/warn.d.ts +7 -0
  521. package/lib/types/ink/warn.d.ts.map +1 -0
  522. package/lib/types/ink/warn.js +15 -0
  523. package/lib/types/ink/widest-line.d.ts +7 -0
  524. package/lib/types/ink/widest-line.d.ts.map +1 -0
  525. package/lib/types/ink/widest-line.js +19 -0
  526. package/lib/types/ink/wrap-text.d.ts +10 -0
  527. package/lib/types/ink/wrap-text.d.ts.map +1 -0
  528. package/lib/types/ink/wrap-text.js +61 -0
  529. package/lib/types/ink/wrapAnsi.d.ts +18 -0
  530. package/lib/types/ink/wrapAnsi.d.ts.map +1 -0
  531. package/lib/types/ink/wrapAnsi.js +16 -0
  532. package/lib/types/invariant.d.ts +20 -0
  533. package/lib/types/invariant.d.ts.map +1 -0
  534. package/lib/types/invariant.js +26 -0
  535. package/lib/types/modelPrefs.d.ts +37 -0
  536. package/lib/types/modelPrefs.d.ts.map +1 -0
  537. package/lib/types/modelPrefs.js +66 -0
  538. package/lib/types/modelRoute.d.ts +79 -0
  539. package/lib/types/modelRoute.d.ts.map +1 -0
  540. package/lib/types/modelRoute.js +96 -0
  541. package/lib/types/native-ts/yoga-layout/enums.d.ts +183 -0
  542. package/lib/types/native-ts/yoga-layout/enums.d.ts.map +1 -0
  543. package/lib/types/native-ts/yoga-layout/enums.js +150 -0
  544. package/lib/types/native-ts/yoga-layout/index.d.ts +788 -0
  545. package/lib/types/native-ts/yoga-layout/index.d.ts.map +1 -0
  546. package/lib/types/native-ts/yoga-layout/index.js +2571 -0
  547. package/lib/types/packaged-skills.d.ts +10 -0
  548. package/lib/types/packaged-skills.d.ts.map +1 -0
  549. package/lib/types/packaged-skills.js +63 -0
  550. package/lib/types/plugin.d.ts +33 -0
  551. package/lib/types/plugin.d.ts.map +1 -0
  552. package/lib/types/plugin.js +454 -0
  553. package/lib/types/presetPrefs.d.ts +29 -0
  554. package/lib/types/presetPrefs.d.ts.map +1 -0
  555. package/lib/types/presetPrefs.js +61 -0
  556. package/lib/types/presets.d.ts +110 -0
  557. package/lib/types/presets.d.ts.map +1 -0
  558. package/lib/types/presets.js +114 -0
  559. package/lib/types/questions.d.ts +97 -0
  560. package/lib/types/questions.d.ts.map +1 -0
  561. package/lib/types/questions.js +201 -0
  562. package/lib/types/screens/Chat.d.ts +23 -0
  563. package/lib/types/screens/Chat.d.ts.map +1 -0
  564. package/lib/types/screens/Chat.js +1263 -0
  565. package/lib/types/screens/StatusLine.d.ts +16 -0
  566. package/lib/types/screens/StatusLine.d.ts.map +1 -0
  567. package/lib/types/screens/StatusLine.js +105 -0
  568. package/lib/types/screens/StatusMetrics.d.ts +87 -0
  569. package/lib/types/screens/StatusMetrics.d.ts.map +1 -0
  570. package/lib/types/screens/StatusMetrics.js +252 -0
  571. package/lib/types/sessionHistory.d.ts +32 -0
  572. package/lib/types/sessionHistory.d.ts.map +1 -0
  573. package/lib/types/sessionHistory.js +87 -0
  574. package/lib/types/theme.d.ts +115 -0
  575. package/lib/types/theme.d.ts.map +1 -0
  576. package/lib/types/theme.js +300 -0
  577. package/lib/types/themePrefs.d.ts +28 -0
  578. package/lib/types/themePrefs.d.ts.map +1 -0
  579. package/lib/types/themePrefs.js +59 -0
  580. package/lib/types/ui.d.ts +28 -0
  581. package/lib/types/ui.d.ts.map +1 -0
  582. package/lib/types/ui.js +25 -0
  583. package/lib/types/update.d.ts +76 -0
  584. package/lib/types/update.d.ts.map +1 -0
  585. package/lib/types/update.js +203 -0
  586. package/lib/types/utils/clipboard.d.ts +43 -0
  587. package/lib/types/utils/clipboard.d.ts.map +1 -0
  588. package/lib/types/utils/clipboard.js +82 -0
  589. package/lib/types/utils/debug.d.ts +8 -0
  590. package/lib/types/utils/debug.d.ts.map +1 -0
  591. package/lib/types/utils/debug.js +12 -0
  592. package/lib/types/utils/earlyInput.d.ts +7 -0
  593. package/lib/types/utils/earlyInput.d.ts.map +1 -0
  594. package/lib/types/utils/earlyInput.js +6 -0
  595. package/lib/types/utils/env.d.ts +10 -0
  596. package/lib/types/utils/env.d.ts.map +1 -0
  597. package/lib/types/utils/env.js +9 -0
  598. package/lib/types/utils/envUtils.d.ts +8 -0
  599. package/lib/types/utils/envUtils.d.ts.map +1 -0
  600. package/lib/types/utils/envUtils.js +13 -0
  601. package/lib/types/utils/execFileNoThrow.d.ts +34 -0
  602. package/lib/types/utils/execFileNoThrow.d.ts.map +1 -0
  603. package/lib/types/utils/execFileNoThrow.js +31 -0
  604. package/lib/types/utils/fullscreen.d.ts +8 -0
  605. package/lib/types/utils/fullscreen.d.ts.map +1 -0
  606. package/lib/types/utils/fullscreen.js +10 -0
  607. package/lib/types/utils/intl.d.ts +7 -0
  608. package/lib/types/utils/intl.d.ts.map +1 -0
  609. package/lib/types/utils/intl.js +9 -0
  610. package/lib/types/utils/loaded-context.d.ts +20 -0
  611. package/lib/types/utils/loaded-context.d.ts.map +1 -0
  612. package/lib/types/utils/loaded-context.js +36 -0
  613. package/lib/types/utils/log.d.ts +7 -0
  614. package/lib/types/utils/log.d.ts.map +1 -0
  615. package/lib/types/utils/log.js +9 -0
  616. package/lib/types/utils/mentions.d.ts +30 -0
  617. package/lib/types/utils/mentions.d.ts.map +1 -0
  618. package/lib/types/utils/mentions.js +72 -0
  619. package/lib/types/utils/narration.d.ts +11 -0
  620. package/lib/types/utils/narration.d.ts.map +1 -0
  621. package/lib/types/utils/narration.js +16 -0
  622. package/lib/types/utils/semver.d.ts +9 -0
  623. package/lib/types/utils/semver.d.ts.map +1 -0
  624. package/lib/types/utils/semver.js +24 -0
  625. package/lib/types/utils/sliceAnsi.d.ts +12 -0
  626. package/lib/types/utils/sliceAnsi.d.ts.map +1 -0
  627. package/lib/types/utils/sliceAnsi.js +79 -0
  628. package/lib/types/working-activity.d.ts +19 -0
  629. package/lib/types/working-activity.d.ts.map +1 -0
  630. package/lib/types/working-activity.js +18 -0
  631. package/package.json +141 -0
  632. package/skills/audit/SKILL.md +24 -0
  633. package/skills/bug/SKILL.md +27 -0
  634. package/skills/pr-comments/SKILL.md +20 -0
  635. package/skills/practice/SKILL.md +22 -0
  636. package/skills/release-notes/SKILL.md +25 -0
  637. package/skills/review/SKILL.md +25 -0
  638. package/skills/vuln-check/SKILL.md +25 -0
@@ -0,0 +1,27 @@
1
+ import type { DOMElement } from '../dom.js';
2
+ /**
3
+ * Hook for synchronized animations that pause when offscreen.
4
+ *
5
+ * Returns a ref to attach to the animated element and the current animation time.
6
+ * All instances share the same clock, so animations stay in sync.
7
+ * The clock only runs when at least one keepAlive subscriber exists.
8
+ *
9
+ * Pass `null` to pause — unsubscribes from the clock so no ticks fire.
10
+ * Time freezes at the last value and resumes from the current clock time
11
+ * when a number is passed again.
12
+ *
13
+ * @param intervalMs - How often to update, or null to pause
14
+ * @returns [ref, time] - Ref to attach to element, elapsed time in ms
15
+ *
16
+ * @example
17
+ * function Spinner() {
18
+ * const [ref, time] = useAnimationFrame(120)
19
+ * const frame = Math.floor(time / 120) % FRAMES.length
20
+ * return <Box ref={ref}>{FRAMES[frame]}</Box>
21
+ * }
22
+ *
23
+ * The clock automatically slows when the terminal is blurred,
24
+ * so consumers don't need to handle focus state.
25
+ */
26
+ export declare function useAnimationFrame(intervalMs?: number | null): [ref: (element: DOMElement | null) => void, time: number];
27
+ //# sourceMappingURL=use-animation-frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-animation-frame.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-animation-frame.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAG3C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,GAAE,MAAM,GAAG,IAAS,GAC7B,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAyB3D"}
@@ -0,0 +1,48 @@
1
+ import { useContext, useEffect, useState } from 'react';
2
+ import { ClockContext } from '../components/ClockContext.js';
3
+ import { useTerminalViewport } from './use-terminal-viewport.js';
4
+ /**
5
+ * Hook for synchronized animations that pause when offscreen.
6
+ *
7
+ * Returns a ref to attach to the animated element and the current animation time.
8
+ * All instances share the same clock, so animations stay in sync.
9
+ * The clock only runs when at least one keepAlive subscriber exists.
10
+ *
11
+ * Pass `null` to pause — unsubscribes from the clock so no ticks fire.
12
+ * Time freezes at the last value and resumes from the current clock time
13
+ * when a number is passed again.
14
+ *
15
+ * @param intervalMs - How often to update, or null to pause
16
+ * @returns [ref, time] - Ref to attach to element, elapsed time in ms
17
+ *
18
+ * @example
19
+ * function Spinner() {
20
+ * const [ref, time] = useAnimationFrame(120)
21
+ * const frame = Math.floor(time / 120) % FRAMES.length
22
+ * return <Box ref={ref}>{FRAMES[frame]}</Box>
23
+ * }
24
+ *
25
+ * The clock automatically slows when the terminal is blurred,
26
+ * so consumers don't need to handle focus state.
27
+ */
28
+ export function useAnimationFrame(intervalMs = 16) {
29
+ const clock = useContext(ClockContext);
30
+ const [viewportRef, { isVisible }] = useTerminalViewport();
31
+ const [time, setTime] = useState(() => clock?.now() ?? 0);
32
+ const active = isVisible && intervalMs !== null;
33
+ useEffect(() => {
34
+ if (!clock || !active)
35
+ return;
36
+ let lastUpdate = clock.now();
37
+ const onChange = () => {
38
+ const now = clock.now();
39
+ if (now - lastUpdate >= intervalMs) {
40
+ lastUpdate = now;
41
+ setTime(now);
42
+ }
43
+ };
44
+ // keepAlive: true — visible animations drive the clock
45
+ return clock.subscribe(onChange, true);
46
+ }, [clock, intervalMs, active]);
47
+ return [viewportRef, time];
48
+ }
@@ -0,0 +1,8 @@
1
+ import { type Props } from '../components/AppContext.js';
2
+ /**
3
+ * React hook exposing the manual app-exit function from `AppContext`.
4
+ * @returns the `AppContext` value, whose `exit` function unmounts the app.
5
+ */
6
+ declare const useApp: () => Props;
7
+ export default useApp;
8
+ //# sourceMappingURL=use-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-app.ts"],"names":[],"mappings":"AACA,OAAmB,EAAE,KAAK,KAAK,EAAE,MAAM,6BAA6B,CAAA;AAEpE;;;GAGG;AACH,QAAA,MAAM,MAAM,QAAO,KAA+B,CAAA;AAClD,eAAe,MAAM,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { useContext } from 'react';
2
+ import AppContext from '../components/AppContext.js';
3
+ /**
4
+ * React hook exposing the manual app-exit function from `AppContext`.
5
+ * @returns the `AppContext` value, whose `exit` function unmounts the app.
6
+ */
7
+ const useApp = () => useContext(AppContext);
8
+ export default useApp;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copy-on-select: when a drag finishes (or a double/triple click, or a
3
+ * shift+arrow extension, lands a selection), copy the selected text to the
4
+ * clipboard — OSC 52 plus the native-utility fallback — then clear the
5
+ * highlight so the copy reads as a completed action.
6
+ *
7
+ * Implemented as a subscription rather than a mouse-release hook so every
8
+ * path that settles a selection (release, lost-release recovery, focus-out
9
+ * recovery, multi-click, keyboard extension) funnels through the same
10
+ * `notifySelectionChange` and fires the copy exactly once per settle.
11
+ *
12
+ * No-op outside fullscreen: without mouse tracking no selection can ever
13
+ * exist, and `useSelection` returns stubs when there is no Ink instance.
14
+ * Mount once near the app root (e.g. Chat) — the copy itself is gated on
15
+ * `hasSelection`, so an always-mounted hook costs one no-op callback per
16
+ * selection notification.
17
+ * @param onCopied - called with the copied text after each successful copy
18
+ * (e.g. to show a toast). Stored in a ref, so an inline closure is fine
19
+ * and never re-subscribes.
20
+ */
21
+ export declare function useCopyOnSelect(onCopied?: (text: string) => void): void;
22
+ //# sourceMappingURL=use-copy-on-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-copy-on-select.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-copy-on-select.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAevE"}
@@ -0,0 +1,40 @@
1
+ import { useEffect, useRef } from 'react';
2
+ import { hasSelection } from '../selection.js';
3
+ import { useSelection } from './use-selection.js';
4
+ /**
5
+ * Copy-on-select: when a drag finishes (or a double/triple click, or a
6
+ * shift+arrow extension, lands a selection), copy the selected text to the
7
+ * clipboard — OSC 52 plus the native-utility fallback — then clear the
8
+ * highlight so the copy reads as a completed action.
9
+ *
10
+ * Implemented as a subscription rather than a mouse-release hook so every
11
+ * path that settles a selection (release, lost-release recovery, focus-out
12
+ * recovery, multi-click, keyboard extension) funnels through the same
13
+ * `notifySelectionChange` and fires the copy exactly once per settle.
14
+ *
15
+ * No-op outside fullscreen: without mouse tracking no selection can ever
16
+ * exist, and `useSelection` returns stubs when there is no Ink instance.
17
+ * Mount once near the app root (e.g. Chat) — the copy itself is gated on
18
+ * `hasSelection`, so an always-mounted hook costs one no-op callback per
19
+ * selection notification.
20
+ * @param onCopied - called with the copied text after each successful copy
21
+ * (e.g. to show a toast). Stored in a ref, so an inline closure is fine
22
+ * and never re-subscribes.
23
+ */
24
+ export function useCopyOnSelect(onCopied) {
25
+ const { subscribe, getState, copySelection } = useSelection();
26
+ const onCopiedRef = useRef(onCopied);
27
+ onCopiedRef.current = onCopied;
28
+ useEffect(() => {
29
+ return subscribe(() => {
30
+ const state = getState();
31
+ // Mid-drag notifications (every motion event) skip the copy; the
32
+ // release notification arrives with isDragging already cleared.
33
+ if (state && !state.isDragging && hasSelection(state)) {
34
+ const text = copySelection();
35
+ if (text)
36
+ onCopiedRef.current?.(text);
37
+ }
38
+ });
39
+ }, [subscribe, getState, copySelection]);
40
+ }
@@ -0,0 +1,31 @@
1
+ import type { DOMElement } from '../dom.js';
2
+ /**
3
+ * Declares where the terminal cursor should be parked after each frame.
4
+ *
5
+ * Terminal emulators render IME preedit text at the physical cursor
6
+ * position, and screen readers / screen magnifiers track the native
7
+ * cursor — so parking it at the text input's caret makes CJK input
8
+ * appear inline and lets accessibility tools follow the input.
9
+ *
10
+ * Returns a ref callback to attach to the Box that contains the input.
11
+ * The declared (line, column) is interpreted relative to that Box's
12
+ * nodeCache rect (populated by renderNodeToOutput).
13
+ *
14
+ * Timing: Both ref attach and useLayoutEffect fire in React's layout
15
+ * phase — after resetAfterCommit calls scheduleRender. scheduleRender
16
+ * defers onRender via queueMicrotask, so onRender runs AFTER layout
17
+ * effects commit and reads the fresh declaration on the first frame
18
+ * (no one-keystroke lag). Test env uses onImmediateRender (synchronous,
19
+ * no microtask), so tests compensate by calling ink.onRender()
20
+ * explicitly after render.
21
+ * @param options - the declared cursor target: `line` and `column` give the
22
+ * position relative to the node, `active` controls whether the declaration
23
+ * is set or cleared.
24
+ * @returns a ref callback to attach to the Box that contains the input.
25
+ */
26
+ export declare function useDeclaredCursor(options: {
27
+ line: number;
28
+ column: number;
29
+ active: boolean;
30
+ }): (element: DOMElement | null) => void;
31
+ //# sourceMappingURL=use-declared-cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-declared-cursor.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-declared-cursor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;CAChB,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAyCvC"}
@@ -0,0 +1,65 @@
1
+ import { useCallback, useContext, useLayoutEffect, useRef } from 'react';
2
+ import CursorDeclarationContext from '../components/CursorDeclarationContext.js';
3
+ /**
4
+ * Declares where the terminal cursor should be parked after each frame.
5
+ *
6
+ * Terminal emulators render IME preedit text at the physical cursor
7
+ * position, and screen readers / screen magnifiers track the native
8
+ * cursor — so parking it at the text input's caret makes CJK input
9
+ * appear inline and lets accessibility tools follow the input.
10
+ *
11
+ * Returns a ref callback to attach to the Box that contains the input.
12
+ * The declared (line, column) is interpreted relative to that Box's
13
+ * nodeCache rect (populated by renderNodeToOutput).
14
+ *
15
+ * Timing: Both ref attach and useLayoutEffect fire in React's layout
16
+ * phase — after resetAfterCommit calls scheduleRender. scheduleRender
17
+ * defers onRender via queueMicrotask, so onRender runs AFTER layout
18
+ * effects commit and reads the fresh declaration on the first frame
19
+ * (no one-keystroke lag). Test env uses onImmediateRender (synchronous,
20
+ * no microtask), so tests compensate by calling ink.onRender()
21
+ * explicitly after render.
22
+ * @param options - the declared cursor target: `line` and `column` give the
23
+ * position relative to the node, `active` controls whether the declaration
24
+ * is set or cleared.
25
+ * @returns a ref callback to attach to the Box that contains the input.
26
+ */
27
+ export function useDeclaredCursor(options) {
28
+ const { line, column, active } = options;
29
+ const setCursorDeclaration = useContext(CursorDeclarationContext);
30
+ const nodeRef = useRef(null);
31
+ const setNode = useCallback((node) => {
32
+ nodeRef.current = node;
33
+ }, []);
34
+ // When active, set unconditionally. When inactive, clear conditionally
35
+ // (only if the currently-declared node is ours). The node-identity check
36
+ // handles two hazards:
37
+ // 1. A memo()ized active instance elsewhere (e.g. the search input in
38
+ // a memo'd Footer) doesn't re-render this commit — an inactive
39
+ // instance re-rendering here must not clobber it.
40
+ // 2. Sibling handoff (menu focus moving between list items) — when
41
+ // focus moves opposite to sibling order, the newly-inactive item's
42
+ // effect runs AFTER the newly-active item's set. Without the node
43
+ // check it would clobber.
44
+ // No dep array: must re-declare every commit so the active instance
45
+ // re-claims the declaration after another instance's unmount-cleanup or
46
+ // sibling handoff nulls it.
47
+ useLayoutEffect(() => {
48
+ const node = nodeRef.current;
49
+ if (active && node) {
50
+ setCursorDeclaration({ relativeX: column, relativeY: line, node });
51
+ }
52
+ else {
53
+ setCursorDeclaration(null, node);
54
+ }
55
+ });
56
+ // Clear on unmount (conditionally — another instance may own by then).
57
+ // Separate effect with empty deps so cleanup only fires once — not on
58
+ // every line/column change, which would transiently null between commits.
59
+ useLayoutEffect(() => {
60
+ return () => {
61
+ setCursorDeclaration(null, nodeRef.current);
62
+ };
63
+ }, [setCursorDeclaration]);
64
+ return setNode;
65
+ }
@@ -0,0 +1,41 @@
1
+ import type { InputEvent, Key } from '../events/input-event.js';
2
+ type Handler = (input: string, key: Key, event: InputEvent) => void;
3
+ type Options = {
4
+ /**
5
+ * Enable or disable capturing of user input.
6
+ * Useful when there are multiple useInput hooks used at once to avoid handling the same input several times.
7
+ *
8
+ * @default true
9
+ */
10
+ isActive?: boolean;
11
+ };
12
+ /**
13
+ * This hook is used for handling user input.
14
+ * It's a more convenient alternative to using `StdinContext` and listening to `data` events.
15
+ * The callback you pass to `useInput` is called for each character when user enters any input.
16
+ * However, if 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`.
17
+ *
18
+ * ```
19
+ * import {useInput} from 'ink';
20
+ *
21
+ * const UserInput = () => {
22
+ * useInput((input, key) => {
23
+ * if (input === 'q') {
24
+ * // Exit program
25
+ * }
26
+ *
27
+ * if (key.leftArrow) {
28
+ * // Left arrow key pressed
29
+ * }
30
+ * });
31
+ *
32
+ * return …
33
+ * };
34
+ * ```
35
+ * @param inputHandler - called for each user input with the input string,
36
+ * parsed key flags, and the originating event.
37
+ * @param options - hook options; `isActive: false` disables input capture.
38
+ */
39
+ declare const useInput: (inputHandler: Handler, options?: Options) => void;
40
+ export default useInput;
41
+ //# sourceMappingURL=use-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-input.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-input.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAG/D,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;AAEnE,KAAK,OAAO,GAAG;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,QAAQ,GAAI,cAAc,OAAO,EAAE,UAAS,OAAY,KAAG,IAgDhE,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -0,0 +1,73 @@
1
+ import { useEffect, useLayoutEffect } from 'react';
2
+ import { useEventCallback } from 'usehooks-ts';
3
+ import useStdin from './use-stdin.js';
4
+ /**
5
+ * This hook is used for handling user input.
6
+ * It's a more convenient alternative to using `StdinContext` and listening to `data` events.
7
+ * The callback you pass to `useInput` is called for each character when user enters any input.
8
+ * However, if 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`.
9
+ *
10
+ * ```
11
+ * import {useInput} from 'ink';
12
+ *
13
+ * const UserInput = () => {
14
+ * useInput((input, key) => {
15
+ * if (input === 'q') {
16
+ * // Exit program
17
+ * }
18
+ *
19
+ * if (key.leftArrow) {
20
+ * // Left arrow key pressed
21
+ * }
22
+ * });
23
+ *
24
+ * return …
25
+ * };
26
+ * ```
27
+ * @param inputHandler - called for each user input with the input string,
28
+ * parsed key flags, and the originating event.
29
+ * @param options - hook options; `isActive: false` disables input capture.
30
+ */
31
+ const useInput = (inputHandler, options = {}) => {
32
+ const { setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = useStdin();
33
+ // useLayoutEffect (not useEffect) so that raw mode is enabled synchronously
34
+ // during React's commit phase, before render() returns. With useEffect, raw
35
+ // mode setup is deferred to the next event loop tick via React's scheduler,
36
+ // leaving the terminal in cooked mode — keystrokes echo and the cursor is
37
+ // visible until the effect fires.
38
+ useLayoutEffect(() => {
39
+ if (options.isActive === false) {
40
+ return;
41
+ }
42
+ setRawMode(true);
43
+ return () => {
44
+ setRawMode(false);
45
+ };
46
+ }, [options.isActive, setRawMode]);
47
+ // Register the listener once on mount so its slot in the EventEmitter's
48
+ // listener array is stable. If isActive were in the effect's deps, the
49
+ // listener would re-append on false→true, moving it behind listeners
50
+ // that registered while it was inactive — breaking
51
+ // stopImmediatePropagation() ordering. useEventCallback keeps the
52
+ // reference stable while reading latest isActive/inputHandler from
53
+ // closure (it syncs via useLayoutEffect, so it's compiler-safe).
54
+ const handleData = useEventCallback((event) => {
55
+ if (options.isActive === false) {
56
+ return;
57
+ }
58
+ const { input, key } = event;
59
+ // If app is not supposed to exit on Ctrl+C, then let input listener handle it
60
+ // Note: discreteUpdates is called at the App level when emitting events,
61
+ // so all listeners are already within a high-priority update context.
62
+ if (!(input === 'c' && key.ctrl) || !internal_exitOnCtrlC) {
63
+ inputHandler(input, key, event);
64
+ }
65
+ });
66
+ useEffect(() => {
67
+ internal_eventEmitter?.on('input', handleData);
68
+ return () => {
69
+ internal_eventEmitter?.removeListener('input', handleData);
70
+ };
71
+ }, [internal_eventEmitter, handleData]);
72
+ };
73
+ export default useInput;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Returns the clock time, updating at the given interval.
3
+ * Subscribes as non-keepAlive — won't keep the clock alive on its own,
4
+ * but updates whenever a keepAlive subscriber (e.g. the spinner)
5
+ * is driving the clock.
6
+ *
7
+ * Use this to drive pure time-based computations (shimmer position,
8
+ * frame index) from the shared clock.
9
+ * @param intervalMs - the minimum interval between updates, in milliseconds.
10
+ * @returns the current clock time in milliseconds.
11
+ */
12
+ export declare function useAnimationTimer(intervalMs: number): number;
13
+ /**
14
+ * Interval hook backed by the shared Clock.
15
+ *
16
+ * Unlike `useInterval` from `usehooks-ts` (which creates its own setInterval),
17
+ * this piggybacks on the single shared clock so all timers consolidate into
18
+ * one wake-up. Pass `null` for intervalMs to pause.
19
+ * @param callback - invoked each time the interval elapses.
20
+ * @param intervalMs - the interval in milliseconds, or null to pause.
21
+ */
22
+ export declare function useInterval(callback: () => void, intervalMs: number | null): void;
23
+ //# sourceMappingURL=use-interval.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-interval.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-interval.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAqB5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,IAAI,EACpB,UAAU,EAAE,MAAM,GAAG,IAAI,GACxB,IAAI,CAqBN"}
@@ -0,0 +1,58 @@
1
+ import { useContext, useEffect, useRef, useState } from 'react';
2
+ import { ClockContext } from '../components/ClockContext.js';
3
+ /**
4
+ * Returns the clock time, updating at the given interval.
5
+ * Subscribes as non-keepAlive — won't keep the clock alive on its own,
6
+ * but updates whenever a keepAlive subscriber (e.g. the spinner)
7
+ * is driving the clock.
8
+ *
9
+ * Use this to drive pure time-based computations (shimmer position,
10
+ * frame index) from the shared clock.
11
+ * @param intervalMs - the minimum interval between updates, in milliseconds.
12
+ * @returns the current clock time in milliseconds.
13
+ */
14
+ export function useAnimationTimer(intervalMs) {
15
+ const clock = useContext(ClockContext);
16
+ const [time, setTime] = useState(() => clock?.now() ?? 0);
17
+ useEffect(() => {
18
+ if (!clock)
19
+ return;
20
+ let lastUpdate = clock.now();
21
+ const onChange = () => {
22
+ const now = clock.now();
23
+ if (now - lastUpdate >= intervalMs) {
24
+ lastUpdate = now;
25
+ setTime(now);
26
+ }
27
+ };
28
+ return clock.subscribe(onChange, false);
29
+ }, [clock, intervalMs]);
30
+ return time;
31
+ }
32
+ /**
33
+ * Interval hook backed by the shared Clock.
34
+ *
35
+ * Unlike `useInterval` from `usehooks-ts` (which creates its own setInterval),
36
+ * this piggybacks on the single shared clock so all timers consolidate into
37
+ * one wake-up. Pass `null` for intervalMs to pause.
38
+ * @param callback - invoked each time the interval elapses.
39
+ * @param intervalMs - the interval in milliseconds, or null to pause.
40
+ */
41
+ export function useInterval(callback, intervalMs) {
42
+ const callbackRef = useRef(callback);
43
+ callbackRef.current = callback;
44
+ const clock = useContext(ClockContext);
45
+ useEffect(() => {
46
+ if (!clock || intervalMs === null)
47
+ return;
48
+ let lastUpdate = clock.now();
49
+ const onChange = () => {
50
+ const now = clock.now();
51
+ if (now - lastUpdate >= intervalMs) {
52
+ lastUpdate = now;
53
+ callbackRef.current();
54
+ }
55
+ };
56
+ return clock.subscribe(onChange, false);
57
+ }, [clock, intervalMs]);
58
+ }
@@ -0,0 +1,34 @@
1
+ import type { DOMElement } from '../dom.js';
2
+ import type { MatchPosition } from '../render-to-screen.js';
3
+ /**
4
+ * Set the search highlight query on the Ink instance. Non-empty → all
5
+ * visible occurrences are inverted on the next frame (SGR 7, screen-buffer
6
+ * overlay, same damage machinery as selection). Empty → clears.
7
+ *
8
+ * This is a screen-space highlight — it matches the RENDERED text, not the
9
+ * source message text. Works for anything visible (bash output, file paths,
10
+ * error messages) regardless of where it came from in the message tree. A
11
+ * query that matched in source but got truncated/ellipsized in rendering
12
+ * won't highlight; that's acceptable — we highlight what you see.
13
+ * @returns an object controlling the search highlight: `setQuery` sets the
14
+ * query, `scanElement` scans a DOM subtree for matches, and `setPositions`
15
+ * drives the position-based highlight.
16
+ */
17
+ export declare function useSearchHighlight(): {
18
+ setQuery: (query: string) => void;
19
+ /** Paint an existing DOM subtree (from the MAIN tree) to a fresh
20
+ * Screen at its natural height, scan. Element-relative positions
21
+ * (row 0 = element top). Zero context duplication — the element
22
+ * IS the one built with all real providers. */
23
+ scanElement: (el: DOMElement) => MatchPosition[];
24
+ /** Position-based CURRENT highlight. Every frame writes yellow at
25
+ * positions[currentIdx] + rowOffset. The scan-highlight (inverse on
26
+ * all matches) still runs — this overlays on top. rowOffset tracks
27
+ * scroll; positions stay stable (message-relative). null clears. */
28
+ setPositions: (state: {
29
+ positions: MatchPosition[];
30
+ rowOffset: number;
31
+ currentIdx: number;
32
+ } | null) => void;
33
+ };
34
+ //# sourceMappingURL=use-search-highlight.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-search-highlight.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-search-highlight.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,IAAI;IACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC;;;oDAGgD;IAChD,WAAW,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,aAAa,EAAE,CAAA;IAChD;;;yEAGqE;IACrE,YAAY,EAAE,CACZ,KAAK,EAAE;QACL,SAAS,EAAE,aAAa,EAAE,CAAA;QAC1B,SAAS,EAAE,MAAM,CAAA;QACjB,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,KACL,IAAI,CAAA;CACV,CAiBA"}
@@ -0,0 +1,35 @@
1
+ import { useContext, useMemo } from 'react';
2
+ import StdinContext from '../components/StdinContext.js';
3
+ import instances from '../instances.js';
4
+ /**
5
+ * Set the search highlight query on the Ink instance. Non-empty → all
6
+ * visible occurrences are inverted on the next frame (SGR 7, screen-buffer
7
+ * overlay, same damage machinery as selection). Empty → clears.
8
+ *
9
+ * This is a screen-space highlight — it matches the RENDERED text, not the
10
+ * source message text. Works for anything visible (bash output, file paths,
11
+ * error messages) regardless of where it came from in the message tree. A
12
+ * query that matched in source but got truncated/ellipsized in rendering
13
+ * won't highlight; that's acceptable — we highlight what you see.
14
+ * @returns an object controlling the search highlight: `setQuery` sets the
15
+ * query, `scanElement` scans a DOM subtree for matches, and `setPositions`
16
+ * drives the position-based highlight.
17
+ */
18
+ export function useSearchHighlight() {
19
+ useContext(StdinContext); // anchor to App subtree for hook rules
20
+ const ink = instances.get(process.stdout);
21
+ return useMemo(() => {
22
+ if (!ink) {
23
+ return {
24
+ setQuery: () => { },
25
+ scanElement: () => [],
26
+ setPositions: () => { },
27
+ };
28
+ }
29
+ return {
30
+ setQuery: (query) => ink.setSearchHighlight(query),
31
+ scanElement: (el) => ink.scanElementSubtree(el),
32
+ setPositions: state => ink.setSearchPositions(state),
33
+ };
34
+ }, [ink]);
35
+ }
@@ -0,0 +1,44 @@
1
+ import { type FocusMove, type SelectionState } from '../selection.js';
2
+ /**
3
+ * Access to text selection operations on the Ink instance (fullscreen only).
4
+ * Returns no-op functions when fullscreen mode is disabled.
5
+ * @returns an object of selection operations bound to the Ink instance:
6
+ * copy, clear, query, subscribe, and scroll/keyboard manipulation.
7
+ */
8
+ export declare function useSelection(): {
9
+ copySelection: () => string;
10
+ /** Copy without clearing the highlight (for copy-on-select). */
11
+ copySelectionNoClear: () => string;
12
+ clearSelection: () => void;
13
+ hasSelection: () => boolean;
14
+ /** Read the raw mutable selection state (for drag-to-scroll). */
15
+ getState: () => SelectionState | null;
16
+ /** Subscribe to selection mutations (start/update/finish/clear). */
17
+ subscribe: (cb: () => void) => () => void;
18
+ /** Shift the anchor row by dRow, clamped to [minRow, maxRow]. */
19
+ shiftAnchor: (dRow: number, minRow: number, maxRow: number) => void;
20
+ /** Shift anchor AND focus by dRow (keyboard scroll: whole selection
21
+ * tracks content). Clamped points get col reset to the full-width edge
22
+ * since their content was captured by captureScrolledRows. Reads
23
+ * screen.width from the ink instance for the col-reset boundary. */
24
+ shiftSelection: (dRow: number, minRow: number, maxRow: number) => void;
25
+ /** Keyboard selection extension (shift+arrow): move focus, anchor fixed.
26
+ * Left/right wrap across rows; up/down clamp at viewport edges. */
27
+ moveFocus: (move: FocusMove) => void;
28
+ /** Capture text from rows about to scroll out of the viewport (call
29
+ * BEFORE scrollBy so the screen buffer still has the outgoing rows). */
30
+ captureScrolledRows: (firstRow: number, lastRow: number, side: 'above' | 'below') => void;
31
+ /** Set the selection highlight bg color (theme-piping; solid bg
32
+ * replaces the old SGR-7 inverse so syntax highlighting stays readable
33
+ * under selection). Call once on mount + whenever theme changes. */
34
+ setSelectionBgColor: (color: string) => void;
35
+ };
36
+ /**
37
+ * Reactive selection-exists state. Re-renders the caller when a text
38
+ * selection is created or cleared. Always returns false outside
39
+ * fullscreen mode (selection is only available in alt-screen).
40
+ * @returns true when a text selection currently exists; false outside
41
+ * fullscreen mode.
42
+ */
43
+ export declare function useHasSelection(): boolean;
44
+ //# sourceMappingURL=use-selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-selection.d.ts","sourceRoot":"","sources":["../../../../src/ink/hooks/use-selection.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,cAAc,EAEpB,MAAM,iBAAiB,CAAA;AAExB;;;;;GAKG;AACH,wBAAgB,YAAY,IAAI;IAC9B,aAAa,EAAE,MAAM,MAAM,CAAA;IAC3B,gEAAgE;IAChE,oBAAoB,EAAE,MAAM,MAAM,CAAA;IAClC,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,YAAY,EAAE,MAAM,OAAO,CAAA;IAC3B,iEAAiE;IACjE,QAAQ,EAAE,MAAM,cAAc,GAAG,IAAI,CAAA;IACrC,oEAAoE;IACpE,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAA;IACzC,iEAAiE;IACjE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACnE;;;yEAGqE;IACrE,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACtE;wEACoE;IACpE,SAAS,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;IACpC;6EACyE;IACzE,mBAAmB,EAAE,CACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,OAAO,GAAG,OAAO,KACpB,IAAI,CAAA;IACT;;yEAEqE;IACrE,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC7C,CA0CA;AAKD;;;;;;GAMG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAOzC"}