@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.
- package/LICENSE +21 -0
- package/README.md +235 -0
- package/bin/dsh-tui.js +95 -0
- package/cordis.patch.yml +218 -0
- package/cordis.yml +185 -0
- package/lib/invariant.js +28 -0
- package/lib/types/activityPrefs.d.ts +29 -0
- package/lib/types/activityPrefs.d.ts.map +1 -0
- package/lib/types/activityPrefs.js +60 -0
- package/lib/types/bootstrap/state.d.ts +13 -0
- package/lib/types/bootstrap/state.d.ts.map +1 -0
- package/lib/types/bootstrap/state.js +12 -0
- package/lib/types/cc/cliHighlight.d.ts +20 -0
- package/lib/types/cc/cliHighlight.d.ts.map +1 -0
- package/lib/types/cc/cliHighlight.js +53 -0
- package/lib/types/cc/figures.d.ts +59 -0
- package/lib/types/cc/figures.d.ts.map +1 -0
- package/lib/types/cc/figures.js +69 -0
- package/lib/types/cc/format.d.ts +26 -0
- package/lib/types/cc/format.d.ts.map +1 -0
- package/lib/types/cc/format.js +55 -0
- package/lib/types/cc/hash.d.ts +25 -0
- package/lib/types/cc/hash.d.ts.map +1 -0
- package/lib/types/cc/hash.js +41 -0
- package/lib/types/cc/hyperlink.d.ts +21 -0
- package/lib/types/cc/hyperlink.d.ts.map +1 -0
- package/lib/types/cc/hyperlink.js +31 -0
- package/lib/types/cc/markdown.d.ts +43 -0
- package/lib/types/cc/markdown.d.ts.map +1 -0
- package/lib/types/cc/markdown.js +345 -0
- package/lib/types/cc/spinnerVerbs.d.ts +3 -0
- package/lib/types/cc/spinnerVerbs.d.ts.map +1 -0
- package/lib/types/cc/spinnerVerbs.js +190 -0
- package/lib/types/cc/terminal.d.ts +15 -0
- package/lib/types/cc/terminal.d.ts.map +1 -0
- package/lib/types/cc/terminal.js +84 -0
- package/lib/types/channel.d.ts +672 -0
- package/lib/types/channel.d.ts.map +1 -0
- package/lib/types/channel.js +2427 -0
- package/lib/types/childStderr.d.ts +63 -0
- package/lib/types/childStderr.d.ts.map +1 -0
- package/lib/types/childStderr.js +161 -0
- package/lib/types/commands.d.ts +55 -0
- package/lib/types/commands.d.ts.map +1 -0
- package/lib/types/commands.js +101 -0
- package/lib/types/components/ActivityLine.d.ts +29 -0
- package/lib/types/components/ActivityLine.d.ts.map +1 -0
- package/lib/types/components/ActivityLine.js +47 -0
- package/lib/types/components/ActivityPicker.d.ts +13 -0
- package/lib/types/components/ActivityPicker.d.ts.map +1 -0
- package/lib/types/components/ActivityPicker.js +24 -0
- package/lib/types/components/CommandSuggestions.d.ts +14 -0
- package/lib/types/components/CommandSuggestions.d.ts.map +1 -0
- package/lib/types/components/CommandSuggestions.js +33 -0
- package/lib/types/components/FileSuggestions.d.ts +12 -0
- package/lib/types/components/FileSuggestions.d.ts.map +1 -0
- package/lib/types/components/FileSuggestions.js +26 -0
- package/lib/types/components/GoalTodoPanel.d.ts +13 -0
- package/lib/types/components/GoalTodoPanel.d.ts.map +1 -0
- package/lib/types/components/GoalTodoPanel.js +57 -0
- package/lib/types/components/HelpMenu.d.ts +12 -0
- package/lib/types/components/HelpMenu.d.ts.map +1 -0
- package/lib/types/components/HelpMenu.js +12 -0
- package/lib/types/components/HistorySearchDialog.d.ts +16 -0
- package/lib/types/components/HistorySearchDialog.d.ts.map +1 -0
- package/lib/types/components/HistorySearchDialog.js +31 -0
- package/lib/types/components/InterruptedByUser.d.ts +7 -0
- package/lib/types/components/InterruptedByUser.d.ts.map +1 -0
- package/lib/types/components/InterruptedByUser.js +9 -0
- package/lib/types/components/LoadedContextPanel.d.ts +20 -0
- package/lib/types/components/LoadedContextPanel.d.ts.map +1 -0
- package/lib/types/components/LoadedContextPanel.js +30 -0
- package/lib/types/components/LogoV2.d.ts +23 -0
- package/lib/types/components/LogoV2.d.ts.map +1 -0
- package/lib/types/components/LogoV2.js +95 -0
- package/lib/types/components/Markdown.d.ts +24 -0
- package/lib/types/components/Markdown.d.ts.map +1 -0
- package/lib/types/components/Markdown.js +106 -0
- package/lib/types/components/MarkdownTable.d.ts +17 -0
- package/lib/types/components/MarkdownTable.d.ts.map +1 -0
- package/lib/types/components/MarkdownTable.js +272 -0
- package/lib/types/components/MessageList.d.ts +41 -0
- package/lib/types/components/MessageList.d.ts.map +1 -0
- package/lib/types/components/MessageList.js +303 -0
- package/lib/types/components/ModelPicker.d.ts +14 -0
- package/lib/types/components/ModelPicker.d.ts.map +1 -0
- package/lib/types/components/ModelPicker.js +15 -0
- package/lib/types/components/PresetPicker.d.ts +17 -0
- package/lib/types/components/PresetPicker.d.ts.map +1 -0
- package/lib/types/components/PresetPicker.js +25 -0
- package/lib/types/components/PromptInput.d.ts +67 -0
- package/lib/types/components/PromptInput.d.ts.map +1 -0
- package/lib/types/components/PromptInput.js +778 -0
- package/lib/types/components/ResumePicker.d.ts +15 -0
- package/lib/types/components/ResumePicker.d.ts.map +1 -0
- package/lib/types/components/ResumePicker.js +34 -0
- package/lib/types/components/RewindPicker.d.ts +14 -0
- package/lib/types/components/RewindPicker.d.ts.map +1 -0
- package/lib/types/components/RewindPicker.js +23 -0
- package/lib/types/components/SearchBox.d.ts +20 -0
- package/lib/types/components/SearchBox.d.ts.map +1 -0
- package/lib/types/components/SearchBox.js +33 -0
- package/lib/types/components/Select.d.ts +22 -0
- package/lib/types/components/Select.d.ts.map +1 -0
- package/lib/types/components/Select.js +19 -0
- package/lib/types/components/Spinner/GlimmerMessage.d.ts +19 -0
- package/lib/types/components/Spinner/GlimmerMessage.d.ts.map +1 -0
- package/lib/types/components/Spinner/GlimmerMessage.js +78 -0
- package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts +31 -0
- package/lib/types/components/Spinner/SpinnerAnimationRow.d.ts.map +1 -0
- package/lib/types/components/Spinner/SpinnerAnimationRow.js +162 -0
- package/lib/types/components/Spinner/SpinnerGlyph.d.ts +16 -0
- package/lib/types/components/Spinner/SpinnerGlyph.d.ts.map +1 -0
- package/lib/types/components/Spinner/SpinnerGlyph.js +36 -0
- package/lib/types/components/Spinner/spinnerMode.d.ts +6 -0
- package/lib/types/components/Spinner/spinnerMode.d.ts.map +1 -0
- package/lib/types/components/Spinner/spinnerMode.js +1 -0
- package/lib/types/components/Spinner/spinnerUtils.d.ts +41 -0
- package/lib/types/components/Spinner/spinnerUtils.d.ts.map +1 -0
- package/lib/types/components/Spinner/spinnerUtils.js +104 -0
- package/lib/types/components/Spinner/useStalledAnimation.d.ts +16 -0
- package/lib/types/components/Spinner/useStalledAnimation.d.ts.map +1 -0
- package/lib/types/components/Spinner/useStalledAnimation.js +71 -0
- package/lib/types/components/StreamingMarkdown.d.ts +12 -0
- package/lib/types/components/StreamingMarkdown.d.ts.map +1 -0
- package/lib/types/components/StreamingMarkdown.js +39 -0
- package/lib/types/components/ThemePicker.d.ts +22 -0
- package/lib/types/components/ThemePicker.d.ts.map +1 -0
- package/lib/types/components/ThemePicker.js +51 -0
- package/lib/types/components/ThinkingToggle.d.ts +17 -0
- package/lib/types/components/ThinkingToggle.d.ts.map +1 -0
- package/lib/types/components/ThinkingToggle.js +30 -0
- package/lib/types/components/ToolUseLoader.d.ts +13 -0
- package/lib/types/components/ToolUseLoader.d.ts.map +1 -0
- package/lib/types/components/ToolUseLoader.js +17 -0
- package/lib/types/components/Whale.d.ts +22 -0
- package/lib/types/components/Whale.d.ts.map +1 -0
- package/lib/types/components/Whale.js +78 -0
- package/lib/types/components/WorkingSpinner.d.ts +26 -0
- package/lib/types/components/WorkingSpinner.d.ts.map +1 -0
- package/lib/types/components/WorkingSpinner.js +68 -0
- package/lib/types/components/activityFrames.d.ts +31 -0
- package/lib/types/components/activityFrames.d.ts.map +1 -0
- package/lib/types/components/activityFrames.js +83 -0
- package/lib/types/components/bigfont.d.ts +28 -0
- package/lib/types/components/bigfont.d.ts.map +1 -0
- package/lib/types/components/bigfont.js +91 -0
- package/lib/types/components/design-system/Byline.d.ts +14 -0
- package/lib/types/components/design-system/Byline.d.ts.map +1 -0
- package/lib/types/components/design-system/Byline.js +17 -0
- package/lib/types/components/design-system/Divider.d.ts +40 -0
- package/lib/types/components/design-system/Divider.d.ts.map +1 -0
- package/lib/types/components/design-system/Divider.js +24 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts +19 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.d.ts.map +1 -0
- package/lib/types/components/design-system/KeyboardShortcutHint.js +14 -0
- package/lib/types/components/design-system/ListItem.d.ts +36 -0
- package/lib/types/components/design-system/ListItem.d.ts.map +1 -0
- package/lib/types/components/design-system/ListItem.js +48 -0
- package/lib/types/components/design-system/LoadingState.d.ts +19 -0
- package/lib/types/components/design-system/LoadingState.d.ts.map +1 -0
- package/lib/types/components/design-system/LoadingState.js +22 -0
- package/lib/types/components/design-system/Pane.d.ts +17 -0
- package/lib/types/components/design-system/Pane.d.ts.map +1 -0
- package/lib/types/components/design-system/Pane.js +15 -0
- package/lib/types/components/design-system/ProgressBar.d.ts +22 -0
- package/lib/types/components/design-system/ProgressBar.d.ts.map +1 -0
- package/lib/types/components/design-system/ProgressBar.js +27 -0
- package/lib/types/components/design-system/StatusIcon.d.ts +15 -0
- package/lib/types/components/design-system/StatusIcon.d.ts.map +1 -0
- package/lib/types/components/design-system/StatusIcon.js +20 -0
- package/lib/types/components/design-system/ThemeProvider.d.ts +11 -0
- package/lib/types/components/design-system/ThemeProvider.d.ts.map +1 -0
- package/lib/types/components/design-system/ThemeProvider.js +135 -0
- package/lib/types/components/design-system/ThemedBox.d.ts +37 -0
- package/lib/types/components/design-system/ThemedBox.d.ts.map +1 -0
- package/lib/types/components/design-system/ThemedBox.js +26 -0
- package/lib/types/components/design-system/ThemedText.d.ts +56 -0
- package/lib/types/components/design-system/ThemedText.d.ts.map +1 -0
- package/lib/types/components/design-system/ThemedText.js +45 -0
- package/lib/types/components/messages/AssistantTextMessage.d.ts +18 -0
- package/lib/types/components/messages/AssistantTextMessage.d.ts.map +1 -0
- package/lib/types/components/messages/AssistantTextMessage.js +15 -0
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts +23 -0
- package/lib/types/components/messages/AssistantThinkingMessage.d.ts.map +1 -0
- package/lib/types/components/messages/AssistantThinkingMessage.js +23 -0
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts +23 -0
- package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -0
- package/lib/types/components/messages/AssistantToolUseMessage.js +220 -0
- package/lib/types/components/messages/MessageMetadata.d.ts +15 -0
- package/lib/types/components/messages/MessageMetadata.d.ts.map +1 -0
- package/lib/types/components/messages/MessageMetadata.js +20 -0
- package/lib/types/components/messages/UserPromptMessage.d.ts +19 -0
- package/lib/types/components/messages/UserPromptMessage.d.ts.map +1 -0
- package/lib/types/components/messages/UserPromptMessage.js +15 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts +39 -0
- package/lib/types/components/questions/AskUserQuestionPanel.d.ts.map +1 -0
- package/lib/types/components/questions/AskUserQuestionPanel.js +228 -0
- package/lib/types/components/shimmer.d.ts +35 -0
- package/lib/types/components/shimmer.d.ts.map +1 -0
- package/lib/types/components/shimmer.js +43 -0
- package/lib/types/components/whaleFrames.d.ts +25 -0
- package/lib/types/components/whaleFrames.d.ts.map +1 -0
- package/lib/types/components/whaleFrames.js +419 -0
- package/lib/types/customTheme.d.ts +104 -0
- package/lib/types/customTheme.d.ts.map +1 -0
- package/lib/types/customTheme.js +268 -0
- package/lib/types/effortPrefs.d.ts +22 -0
- package/lib/types/effortPrefs.d.ts.map +1 -0
- package/lib/types/effortPrefs.js +45 -0
- package/lib/types/history.d.ts +24 -0
- package/lib/types/history.d.ts.map +1 -0
- package/lib/types/history.js +75 -0
- package/lib/types/hooks/useBlink.d.ts +11 -0
- package/lib/types/hooks/useBlink.d.ts.map +1 -0
- package/lib/types/hooks/useBlink.js +20 -0
- package/lib/types/i18n.d.ts +926 -0
- package/lib/types/i18n.d.ts.map +1 -0
- package/lib/types/i18n.js +356 -0
- package/lib/types/index.d.ts +70 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +31 -0
- package/lib/types/ink/Ansi.d.ts +11 -0
- package/lib/types/ink/Ansi.d.ts.map +1 -0
- package/lib/types/ink/Ansi.js +269 -0
- package/lib/types/ink/bidi.d.ts +18 -0
- package/lib/types/ink/bidi.d.ts.map +1 -0
- package/lib/types/ink/bidi.js +119 -0
- package/lib/types/ink/clearTerminal.d.ts +22 -0
- package/lib/types/ink/clearTerminal.d.ts.map +1 -0
- package/lib/types/ink/clearTerminal.js +72 -0
- package/lib/types/ink/colorize.d.ts +33 -0
- package/lib/types/ink/colorize.d.ts.map +1 -0
- package/lib/types/ink/colorize.js +213 -0
- package/lib/types/ink/components/AlternateScreen.d.ts +22 -0
- package/lib/types/ink/components/AlternateScreen.d.ts.map +1 -0
- package/lib/types/ink/components/AlternateScreen.js +74 -0
- package/lib/types/ink/components/App.d.ts +73 -0
- package/lib/types/ink/components/App.d.ts.map +1 -0
- package/lib/types/ink/components/App.js +597 -0
- package/lib/types/ink/components/AppContext.d.ts +15 -0
- package/lib/types/ink/components/AppContext.d.ts.map +1 -0
- package/lib/types/ink/components/AppContext.js +11 -0
- package/lib/types/ink/components/Box.d.ts +49 -0
- package/lib/types/ink/components/Box.d.ts.map +1 -0
- package/lib/types/ink/components/Box.js +153 -0
- package/lib/types/ink/components/Button.d.ts +37 -0
- package/lib/types/ink/components/Button.d.ts.map +1 -0
- package/lib/types/ink/components/Button.js +166 -0
- package/lib/types/ink/components/ClockContext.d.ts +10 -0
- package/lib/types/ink/components/ClockContext.d.ts.map +1 -0
- package/lib/types/ink/components/ClockContext.js +108 -0
- package/lib/types/ink/components/CursorDeclarationContext.d.ts +30 -0
- package/lib/types/ink/components/CursorDeclarationContext.d.ts.map +1 -0
- package/lib/types/ink/components/CursorDeclarationContext.js +6 -0
- package/lib/types/ink/components/ErrorOverview.d.ts +7 -0
- package/lib/types/ink/components/ErrorOverview.d.ts.map +1 -0
- package/lib/types/ink/components/ErrorOverview.js +49 -0
- package/lib/types/ink/components/Link.d.ts +8 -0
- package/lib/types/ink/components/Link.d.ts.map +1 -0
- package/lib/types/ink/components/Link.js +33 -0
- package/lib/types/ink/components/Newline.d.ts +13 -0
- package/lib/types/ink/components/Newline.d.ts.map +1 -0
- package/lib/types/ink/components/Newline.js +29 -0
- package/lib/types/ink/components/NoSelect.d.ts +20 -0
- package/lib/types/ink/components/NoSelect.d.ts.map +1 -0
- package/lib/types/ink/components/NoSelect.js +56 -0
- package/lib/types/ink/components/RawAnsi.d.ts +17 -0
- package/lib/types/ink/components/RawAnsi.d.ts.map +1 -0
- package/lib/types/ink/components/RawAnsi.js +45 -0
- package/lib/types/ink/components/ScrollBox.d.ts +78 -0
- package/lib/types/ink/components/ScrollBox.d.ts.map +1 -0
- package/lib/types/ink/components/ScrollBox.js +174 -0
- package/lib/types/ink/components/Spacer.d.ts +6 -0
- package/lib/types/ink/components/Spacer.d.ts.map +1 -0
- package/lib/types/ink/components/Spacer.js +19 -0
- package/lib/types/ink/components/StdinContext.d.ts +32 -0
- package/lib/types/ink/components/StdinContext.d.ts.map +1 -0
- package/lib/types/ink/components/StdinContext.js +16 -0
- package/lib/types/ink/components/TerminalFocusContext.d.ts +11 -0
- package/lib/types/ink/components/TerminalFocusContext.d.ts.map +1 -0
- package/lib/types/ink/components/TerminalFocusContext.js +45 -0
- package/lib/types/ink/components/TerminalSizeContext.d.ts +6 -0
- package/lib/types/ink/components/TerminalSizeContext.d.ts.map +1 -0
- package/lib/types/ink/components/TerminalSizeContext.js +3 -0
- package/lib/types/ink/components/Text.d.ts +56 -0
- package/lib/types/ink/components/Text.d.ts.map +1 -0
- package/lib/types/ink/components/Text.js +194 -0
- package/lib/types/ink/constants.d.ts +3 -0
- package/lib/types/ink/constants.d.ts.map +1 -0
- package/lib/types/ink/constants.js +2 -0
- package/lib/types/ink/cursor.d.ts +11 -0
- package/lib/types/ink/cursor.d.ts.map +1 -0
- package/lib/types/ink/cursor.js +1 -0
- package/lib/types/ink/devtools.d.ts +7 -0
- package/lib/types/ink/devtools.d.ts.map +1 -0
- package/lib/types/ink/devtools.js +1 -0
- package/lib/types/ink/dom.d.ts +178 -0
- package/lib/types/ink/dom.d.ts.map +1 -0
- package/lib/types/ink/dom.js +424 -0
- package/lib/types/ink/events/click-event.d.ts +32 -0
- package/lib/types/ink/events/click-event.d.ts.map +1 -0
- package/lib/types/ink/events/click-event.js +36 -0
- package/lib/types/ink/events/dispatcher.d.ts +63 -0
- package/lib/types/ink/events/dispatcher.d.ts.map +1 -0
- package/lib/types/ink/events/dispatcher.js +194 -0
- package/lib/types/ink/events/emitter.d.ts +20 -0
- package/lib/types/ink/events/emitter.d.ts.map +1 -0
- package/lib/types/ink/events/emitter.js +43 -0
- package/lib/types/ink/events/event-handlers.d.ts +47 -0
- package/lib/types/ink/events/event-handlers.d.ts.map +1 -0
- package/lib/types/ink/events/event-handlers.js +30 -0
- package/lib/types/ink/events/event.d.ts +19 -0
- package/lib/types/ink/events/event.d.ts.map +1 -0
- package/lib/types/ink/events/event.js +22 -0
- package/lib/types/ink/events/focus-event.d.ts +19 -0
- package/lib/types/ink/events/focus-event.d.ts.map +1 -0
- package/lib/types/ink/events/focus-event.js +21 -0
- package/lib/types/ink/events/input-event.d.ts +53 -0
- package/lib/types/ink/events/input-event.d.ts.map +1 -0
- package/lib/types/ink/events/input-event.js +180 -0
- package/lib/types/ink/events/keyboard-event.d.ts +40 -0
- package/lib/types/ink/events/keyboard-event.d.ts.map +1 -0
- package/lib/types/ink/events/keyboard-event.js +65 -0
- package/lib/types/ink/events/paste-event.d.ts +11 -0
- package/lib/types/ink/events/paste-event.d.ts.map +1 -0
- package/lib/types/ink/events/paste-event.js +13 -0
- package/lib/types/ink/events/resize-event.d.ts +13 -0
- package/lib/types/ink/events/resize-event.d.ts.map +1 -0
- package/lib/types/ink/events/resize-event.js +16 -0
- package/lib/types/ink/events/terminal-event.d.ts +112 -0
- package/lib/types/ink/events/terminal-event.d.ts.map +1 -0
- package/lib/types/ink/events/terminal-event.js +131 -0
- package/lib/types/ink/events/terminal-focus-event.d.ts +21 -0
- package/lib/types/ink/events/terminal-focus-event.d.ts.map +1 -0
- package/lib/types/ink/events/terminal-focus-event.js +18 -0
- package/lib/types/ink/focus.d.ts +74 -0
- package/lib/types/ink/focus.d.ts.map +1 -0
- package/lib/types/ink/focus.js +188 -0
- package/lib/types/ink/frame.d.ts +119 -0
- package/lib/types/ink/frame.d.ts.map +1 -0
- package/lib/types/ink/frame.js +43 -0
- package/lib/types/ink/get-max-width.d.ts +20 -0
- package/lib/types/ink/get-max-width.d.ts.map +1 -0
- package/lib/types/ink/get-max-width.js +25 -0
- package/lib/types/ink/hit-test.d.ts +47 -0
- package/lib/types/ink/hit-test.d.ts.map +1 -0
- package/lib/types/ink/hit-test.js +126 -0
- package/lib/types/ink/hooks/use-animation-frame.d.ts +27 -0
- package/lib/types/ink/hooks/use-animation-frame.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-animation-frame.js +48 -0
- package/lib/types/ink/hooks/use-app.d.ts +8 -0
- package/lib/types/ink/hooks/use-app.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-app.js +8 -0
- package/lib/types/ink/hooks/use-copy-on-select.d.ts +22 -0
- package/lib/types/ink/hooks/use-copy-on-select.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-copy-on-select.js +40 -0
- package/lib/types/ink/hooks/use-declared-cursor.d.ts +31 -0
- package/lib/types/ink/hooks/use-declared-cursor.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-declared-cursor.js +65 -0
- package/lib/types/ink/hooks/use-input.d.ts +41 -0
- package/lib/types/ink/hooks/use-input.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-input.js +73 -0
- package/lib/types/ink/hooks/use-interval.d.ts +23 -0
- package/lib/types/ink/hooks/use-interval.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-interval.js +58 -0
- package/lib/types/ink/hooks/use-search-highlight.d.ts +34 -0
- package/lib/types/ink/hooks/use-search-highlight.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-search-highlight.js +35 -0
- package/lib/types/ink/hooks/use-selection.d.ts +44 -0
- package/lib/types/ink/hooks/use-selection.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-selection.js +64 -0
- package/lib/types/ink/hooks/use-stdin.d.ts +8 -0
- package/lib/types/ink/hooks/use-stdin.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-stdin.js +8 -0
- package/lib/types/ink/hooks/use-tab-status.d.ts +18 -0
- package/lib/types/ink/hooks/use-tab-status.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-tab-status.js +58 -0
- package/lib/types/ink/hooks/use-terminal-focus.d.ts +11 -0
- package/lib/types/ink/hooks/use-terminal-focus.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-focus.js +15 -0
- package/lib/types/ink/hooks/use-terminal-size.d.ts +6 -0
- package/lib/types/ink/hooks/use-terminal-size.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-size.js +12 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts +14 -0
- package/lib/types/ink/hooks/use-terminal-title.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-title.js +30 -0
- package/lib/types/ink/hooks/use-terminal-viewport.d.ts +32 -0
- package/lib/types/ink/hooks/use-terminal-viewport.d.ts.map +1 -0
- package/lib/types/ink/hooks/use-terminal-viewport.js +79 -0
- package/lib/types/ink/ink.d.ts +370 -0
- package/lib/types/ink/ink.d.ts.map +1 -0
- package/lib/types/ink/ink.js +1665 -0
- package/lib/types/ink/instances.d.ts +10 -0
- package/lib/types/ink/instances.d.ts.map +1 -0
- package/lib/types/ink/instances.js +13 -0
- package/lib/types/ink/layout/engine.d.ts +7 -0
- package/lib/types/ink/layout/engine.d.ts.map +1 -0
- package/lib/types/ink/layout/engine.js +8 -0
- package/lib/types/ink/layout/geometry.d.ts +86 -0
- package/lib/types/ink/layout/geometry.d.ts.map +1 -0
- package/lib/types/ink/layout/geometry.js +95 -0
- package/lib/types/ink/layout/node.d.ts +151 -0
- package/lib/types/ink/layout/node.d.ts.map +1 -0
- package/lib/types/ink/layout/node.js +72 -0
- package/lib/types/ink/layout/yoga.d.ts +69 -0
- package/lib/types/ink/layout/yoga.d.ts.map +1 -0
- package/lib/types/ink/layout/yoga.js +249 -0
- package/lib/types/ink/line-width-cache.d.ts +9 -0
- package/lib/types/ink/line-width-cache.d.ts.map +1 -0
- package/lib/types/ink/line-width-cache.js +45 -0
- package/lib/types/ink/log-update.d.ts +57 -0
- package/lib/types/ink/log-update.d.ts.map +1 -0
- package/lib/types/ink/log-update.js +710 -0
- package/lib/types/ink/measure-element.d.ts +19 -0
- package/lib/types/ink/measure-element.d.ts.map +1 -0
- package/lib/types/ink/measure-element.js +10 -0
- package/lib/types/ink/measure-text.d.ts +13 -0
- package/lib/types/ink/measure-text.d.ts.map +1 -0
- package/lib/types/ink/measure-text.js +38 -0
- package/lib/types/ink/node-cache.d.ts +33 -0
- package/lib/types/ink/node-cache.d.ts.map +1 -0
- package/lib/types/ink/node-cache.js +42 -0
- package/lib/types/ink/optimizer.d.ts +18 -0
- package/lib/types/ink/optimizer.d.ts.map +1 -0
- package/lib/types/ink/optimizer.js +83 -0
- package/lib/types/ink/output.d.ts +200 -0
- package/lib/types/ink/output.d.ts.map +1 -0
- package/lib/types/ink/output.js +663 -0
- package/lib/types/ink/parse-keypress.d.ts +132 -0
- package/lib/types/ink/parse-keypress.d.ts.map +1 -0
- package/lib/types/ink/parse-keypress.js +707 -0
- package/lib/types/ink/reconciler.d.ts +43 -0
- package/lib/types/ink/reconciler.d.ts.map +1 -0
- package/lib/types/ink/reconciler.js +413 -0
- package/lib/types/ink/render-border.d.ts +36 -0
- package/lib/types/ink/render-border.d.ts.map +1 -0
- package/lib/types/ink/render-border.js +143 -0
- package/lib/types/ink/render-node-to-output.d.ts +93 -0
- package/lib/types/ink/render-node-to-output.d.ts.map +1 -0
- package/lib/types/ink/render-node-to-output.js +1290 -0
- package/lib/types/ink/render-to-screen.d.ts +65 -0
- package/lib/types/ink/render-to-screen.d.ts.map +1 -0
- package/lib/types/ink/render-to-screen.js +189 -0
- package/lib/types/ink/renderer.d.ts +24 -0
- package/lib/types/ink/renderer.d.ts.map +1 -0
- package/lib/types/ink/renderer.js +136 -0
- package/lib/types/ink/root.d.ts +91 -0
- package/lib/types/ink/root.d.ts.map +1 -0
- package/lib/types/ink/root.js +93 -0
- package/lib/types/ink/screen.d.ts +443 -0
- package/lib/types/ink/screen.d.ts.map +1 -0
- package/lib/types/ink/screen.js +1295 -0
- package/lib/types/ink/searchHighlight.d.ts +25 -0
- package/lib/types/ink/searchHighlight.d.ts.map +1 -0
- package/lib/types/ink/searchHighlight.js +82 -0
- package/lib/types/ink/selection.d.ts +323 -0
- package/lib/types/ink/selection.d.ts.map +1 -0
- package/lib/types/ink/selection.js +881 -0
- package/lib/types/ink/squash-text-nodes.d.ts +30 -0
- package/lib/types/ink/squash-text-nodes.d.ts.map +1 -0
- package/lib/types/ink/squash-text-nodes.js +63 -0
- package/lib/types/ink/stringWidth.d.ts +11 -0
- package/lib/types/ink/stringWidth.d.ts.map +1 -0
- package/lib/types/ink/stringWidth.js +209 -0
- package/lib/types/ink/styles.d.ts +324 -0
- package/lib/types/ink/styles.d.ts.map +1 -0
- package/lib/types/ink/styles.js +307 -0
- package/lib/types/ink/supports-hyperlinks.d.ts +20 -0
- package/lib/types/ink/supports-hyperlinks.d.ts.map +1 -0
- package/lib/types/ink/supports-hyperlinks.js +44 -0
- package/lib/types/ink/tabstops.d.ts +9 -0
- package/lib/types/ink/tabstops.d.ts.map +1 -0
- package/lib/types/ink/tabstops.js +46 -0
- package/lib/types/ink/terminal-focus-state.d.ts +35 -0
- package/lib/types/ink/terminal-focus-state.d.ts.map +1 -0
- package/lib/types/ink/terminal-focus-state.js +57 -0
- package/lib/types/ink/terminal-querier.d.ts +161 -0
- package/lib/types/ink/terminal-querier.d.ts.map +1 -0
- package/lib/types/ink/terminal-querier.js +204 -0
- package/lib/types/ink/terminal.d.ts +80 -0
- package/lib/types/ink/terminal.d.ts.map +1 -0
- package/lib/types/ink/terminal.js +268 -0
- package/lib/types/ink/termio/ansi.d.ts +75 -0
- package/lib/types/ink/termio/ansi.d.ts.map +1 -0
- package/lib/types/ink/termio/ansi.js +79 -0
- package/lib/types/ink/termio/csi.d.ts +253 -0
- package/lib/types/ink/termio/csi.d.ts.map +1 -0
- package/lib/types/ink/termio/csi.js +347 -0
- package/lib/types/ink/termio/dec.d.ts +61 -0
- package/lib/types/ink/termio/dec.d.ts.map +1 -0
- package/lib/types/ink/termio/dec.js +76 -0
- package/lib/types/ink/termio/esc.d.ts +15 -0
- package/lib/types/ink/termio/esc.d.ts.map +1 -0
- package/lib/types/ink/termio/esc.js +57 -0
- package/lib/types/ink/termio/osc.d.ts +208 -0
- package/lib/types/ink/termio/osc.d.ts.map +1 -0
- package/lib/types/ink/termio/osc.js +466 -0
- package/lib/types/ink/termio/parser.d.ts +46 -0
- package/lib/types/ink/termio/parser.d.ts.map +1 -0
- package/lib/types/ink/termio/parser.js +366 -0
- package/lib/types/ink/termio/sgr.d.ts +17 -0
- package/lib/types/ink/termio/sgr.d.ts.map +1 -0
- package/lib/types/ink/termio/sgr.js +300 -0
- package/lib/types/ink/termio/tokenize.d.ts +50 -0
- package/lib/types/ink/termio/tokenize.d.ts.map +1 -0
- package/lib/types/ink/termio/tokenize.js +266 -0
- package/lib/types/ink/termio/types.d.ts +211 -0
- package/lib/types/ink/termio/types.d.ts.map +1 -0
- package/lib/types/ink/termio/types.js +68 -0
- package/lib/types/ink/termio.d.ts +25 -0
- package/lib/types/ink/termio.d.ts.map +1 -0
- package/lib/types/ink/termio.js +24 -0
- package/lib/types/ink/truncateToWidth.d.ts +7 -0
- package/lib/types/ink/truncateToWidth.d.ts.map +1 -0
- package/lib/types/ink/truncateToWidth.js +18 -0
- package/lib/types/ink/useTerminalNotification.d.ts +45 -0
- package/lib/types/ink/useTerminalNotification.d.ts.map +1 -0
- package/lib/types/ink/useTerminalNotification.js +70 -0
- package/lib/types/ink/warn.d.ts +7 -0
- package/lib/types/ink/warn.d.ts.map +1 -0
- package/lib/types/ink/warn.js +15 -0
- package/lib/types/ink/widest-line.d.ts +7 -0
- package/lib/types/ink/widest-line.d.ts.map +1 -0
- package/lib/types/ink/widest-line.js +19 -0
- package/lib/types/ink/wrap-text.d.ts +10 -0
- package/lib/types/ink/wrap-text.d.ts.map +1 -0
- package/lib/types/ink/wrap-text.js +61 -0
- package/lib/types/ink/wrapAnsi.d.ts +18 -0
- package/lib/types/ink/wrapAnsi.d.ts.map +1 -0
- package/lib/types/ink/wrapAnsi.js +16 -0
- package/lib/types/invariant.d.ts +20 -0
- package/lib/types/invariant.d.ts.map +1 -0
- package/lib/types/invariant.js +26 -0
- package/lib/types/modelPrefs.d.ts +37 -0
- package/lib/types/modelPrefs.d.ts.map +1 -0
- package/lib/types/modelPrefs.js +66 -0
- package/lib/types/modelRoute.d.ts +79 -0
- package/lib/types/modelRoute.d.ts.map +1 -0
- package/lib/types/modelRoute.js +96 -0
- package/lib/types/native-ts/yoga-layout/enums.d.ts +183 -0
- package/lib/types/native-ts/yoga-layout/enums.d.ts.map +1 -0
- package/lib/types/native-ts/yoga-layout/enums.js +150 -0
- package/lib/types/native-ts/yoga-layout/index.d.ts +788 -0
- package/lib/types/native-ts/yoga-layout/index.d.ts.map +1 -0
- package/lib/types/native-ts/yoga-layout/index.js +2571 -0
- package/lib/types/packaged-skills.d.ts +10 -0
- package/lib/types/packaged-skills.d.ts.map +1 -0
- package/lib/types/packaged-skills.js +63 -0
- package/lib/types/plugin.d.ts +33 -0
- package/lib/types/plugin.d.ts.map +1 -0
- package/lib/types/plugin.js +454 -0
- package/lib/types/presetPrefs.d.ts +29 -0
- package/lib/types/presetPrefs.d.ts.map +1 -0
- package/lib/types/presetPrefs.js +61 -0
- package/lib/types/presets.d.ts +110 -0
- package/lib/types/presets.d.ts.map +1 -0
- package/lib/types/presets.js +114 -0
- package/lib/types/questions.d.ts +97 -0
- package/lib/types/questions.d.ts.map +1 -0
- package/lib/types/questions.js +201 -0
- package/lib/types/screens/Chat.d.ts +23 -0
- package/lib/types/screens/Chat.d.ts.map +1 -0
- package/lib/types/screens/Chat.js +1263 -0
- package/lib/types/screens/StatusLine.d.ts +16 -0
- package/lib/types/screens/StatusLine.d.ts.map +1 -0
- package/lib/types/screens/StatusLine.js +105 -0
- package/lib/types/screens/StatusMetrics.d.ts +87 -0
- package/lib/types/screens/StatusMetrics.d.ts.map +1 -0
- package/lib/types/screens/StatusMetrics.js +252 -0
- package/lib/types/sessionHistory.d.ts +32 -0
- package/lib/types/sessionHistory.d.ts.map +1 -0
- package/lib/types/sessionHistory.js +87 -0
- package/lib/types/theme.d.ts +115 -0
- package/lib/types/theme.d.ts.map +1 -0
- package/lib/types/theme.js +300 -0
- package/lib/types/themePrefs.d.ts +28 -0
- package/lib/types/themePrefs.d.ts.map +1 -0
- package/lib/types/themePrefs.js +59 -0
- package/lib/types/ui.d.ts +28 -0
- package/lib/types/ui.d.ts.map +1 -0
- package/lib/types/ui.js +25 -0
- package/lib/types/update.d.ts +76 -0
- package/lib/types/update.d.ts.map +1 -0
- package/lib/types/update.js +203 -0
- package/lib/types/utils/clipboard.d.ts +43 -0
- package/lib/types/utils/clipboard.d.ts.map +1 -0
- package/lib/types/utils/clipboard.js +82 -0
- package/lib/types/utils/debug.d.ts +8 -0
- package/lib/types/utils/debug.d.ts.map +1 -0
- package/lib/types/utils/debug.js +12 -0
- package/lib/types/utils/earlyInput.d.ts +7 -0
- package/lib/types/utils/earlyInput.d.ts.map +1 -0
- package/lib/types/utils/earlyInput.js +6 -0
- package/lib/types/utils/env.d.ts +10 -0
- package/lib/types/utils/env.d.ts.map +1 -0
- package/lib/types/utils/env.js +9 -0
- package/lib/types/utils/envUtils.d.ts +8 -0
- package/lib/types/utils/envUtils.d.ts.map +1 -0
- package/lib/types/utils/envUtils.js +13 -0
- package/lib/types/utils/execFileNoThrow.d.ts +34 -0
- package/lib/types/utils/execFileNoThrow.d.ts.map +1 -0
- package/lib/types/utils/execFileNoThrow.js +31 -0
- package/lib/types/utils/fullscreen.d.ts +8 -0
- package/lib/types/utils/fullscreen.d.ts.map +1 -0
- package/lib/types/utils/fullscreen.js +10 -0
- package/lib/types/utils/intl.d.ts +7 -0
- package/lib/types/utils/intl.d.ts.map +1 -0
- package/lib/types/utils/intl.js +9 -0
- package/lib/types/utils/loaded-context.d.ts +20 -0
- package/lib/types/utils/loaded-context.d.ts.map +1 -0
- package/lib/types/utils/loaded-context.js +36 -0
- package/lib/types/utils/log.d.ts +7 -0
- package/lib/types/utils/log.d.ts.map +1 -0
- package/lib/types/utils/log.js +9 -0
- package/lib/types/utils/mentions.d.ts +30 -0
- package/lib/types/utils/mentions.d.ts.map +1 -0
- package/lib/types/utils/mentions.js +72 -0
- package/lib/types/utils/narration.d.ts +11 -0
- package/lib/types/utils/narration.d.ts.map +1 -0
- package/lib/types/utils/narration.js +16 -0
- package/lib/types/utils/semver.d.ts +9 -0
- package/lib/types/utils/semver.d.ts.map +1 -0
- package/lib/types/utils/semver.js +24 -0
- package/lib/types/utils/sliceAnsi.d.ts +12 -0
- package/lib/types/utils/sliceAnsi.d.ts.map +1 -0
- package/lib/types/utils/sliceAnsi.js +79 -0
- package/lib/types/working-activity.d.ts +19 -0
- package/lib/types/working-activity.d.ts.map +1 -0
- package/lib/types/working-activity.js +18 -0
- package/package.json +141 -0
- package/skills/audit/SKILL.md +24 -0
- package/skills/bug/SKILL.md +27 -0
- package/skills/pr-comments/SKILL.md +20 -0
- package/skills/practice/SKILL.md +22 -0
- package/skills/release-notes/SKILL.md +25 -0
- package/skills/review/SKILL.md +25 -0
- package/skills/vuln-check/SKILL.md +25 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSI (Control Sequence Introducer) Types
|
|
3
|
+
*
|
|
4
|
+
* Enums and types for CSI command parameters.
|
|
5
|
+
*/
|
|
6
|
+
import { ESC, ESC_TYPE, SEP } from './ansi.js';
|
|
7
|
+
/** CSI introducer prefix: ESC followed by `[`. */
|
|
8
|
+
export const CSI_PREFIX = ESC + String.fromCharCode(ESC_TYPE.CSI);
|
|
9
|
+
/**
|
|
10
|
+
* CSI parameter byte ranges
|
|
11
|
+
*/
|
|
12
|
+
export const CSI_RANGE = {
|
|
13
|
+
PARAM_START: 0x30,
|
|
14
|
+
PARAM_END: 0x3f,
|
|
15
|
+
INTERMEDIATE_START: 0x20,
|
|
16
|
+
INTERMEDIATE_END: 0x2f,
|
|
17
|
+
FINAL_START: 0x40,
|
|
18
|
+
FINAL_END: 0x7e,
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Check if a byte is a CSI parameter byte.
|
|
22
|
+
* @param byte - the byte value to check.
|
|
23
|
+
* @returns true when the byte is in the parameter range (0x30-0x3F).
|
|
24
|
+
*/
|
|
25
|
+
export function isCSIParam(byte) {
|
|
26
|
+
return byte >= CSI_RANGE.PARAM_START && byte <= CSI_RANGE.PARAM_END;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Check if a byte is a CSI intermediate byte.
|
|
30
|
+
* @param byte - the byte value to check.
|
|
31
|
+
* @returns true when the byte is in the intermediate range (0x20-0x2F).
|
|
32
|
+
*/
|
|
33
|
+
export function isCSIIntermediate(byte) {
|
|
34
|
+
return (byte >= CSI_RANGE.INTERMEDIATE_START && byte <= CSI_RANGE.INTERMEDIATE_END);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Check if a byte is a CSI final byte (@ through ~).
|
|
38
|
+
* @param byte - the byte value to check.
|
|
39
|
+
* @returns true when the byte is in the final range (0x40-0x7E).
|
|
40
|
+
*/
|
|
41
|
+
export function isCSIFinal(byte) {
|
|
42
|
+
return byte >= CSI_RANGE.FINAL_START && byte <= CSI_RANGE.FINAL_END;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Generate a CSI sequence: ESC [ p1;p2;...;pN final.
|
|
46
|
+
* With a single argument it is treated as the raw body; with multiple
|
|
47
|
+
* arguments the last is the final byte and the rest are parameters joined
|
|
48
|
+
* by semicolons.
|
|
49
|
+
* @param args - the sequence parts.
|
|
50
|
+
* @returns the complete CSI sequence string.
|
|
51
|
+
*/
|
|
52
|
+
export function csi(...args) {
|
|
53
|
+
if (args.length === 0)
|
|
54
|
+
return CSI_PREFIX;
|
|
55
|
+
if (args.length === 1)
|
|
56
|
+
return `${CSI_PREFIX}${args[0]}`;
|
|
57
|
+
const params = args.slice(0, -1);
|
|
58
|
+
const final = args[args.length - 1];
|
|
59
|
+
return `${CSI_PREFIX}${params.join(SEP)}${final}`;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* CSI final bytes - the command identifier
|
|
63
|
+
*/
|
|
64
|
+
export const CSI = {
|
|
65
|
+
// Cursor movement
|
|
66
|
+
CUU: 0x41, // A - Cursor Up
|
|
67
|
+
CUD: 0x42, // B - Cursor Down
|
|
68
|
+
CUF: 0x43, // C - Cursor Forward
|
|
69
|
+
CUB: 0x44, // D - Cursor Back
|
|
70
|
+
CNL: 0x45, // E - Cursor Next Line
|
|
71
|
+
CPL: 0x46, // F - Cursor Previous Line
|
|
72
|
+
CHA: 0x47, // G - Cursor Horizontal Absolute
|
|
73
|
+
CUP: 0x48, // H - Cursor Position
|
|
74
|
+
CHT: 0x49, // I - Cursor Horizontal Tab
|
|
75
|
+
VPA: 0x64, // d - Vertical Position Absolute
|
|
76
|
+
HVP: 0x66, // f - Horizontal Vertical Position
|
|
77
|
+
// Erase
|
|
78
|
+
ED: 0x4a, // J - Erase in Display
|
|
79
|
+
EL: 0x4b, // K - Erase in Line
|
|
80
|
+
ECH: 0x58, // X - Erase Character
|
|
81
|
+
// Insert/Delete
|
|
82
|
+
IL: 0x4c, // L - Insert Lines
|
|
83
|
+
DL: 0x4d, // M - Delete Lines
|
|
84
|
+
ICH: 0x40, // @ - Insert Characters
|
|
85
|
+
DCH: 0x50, // P - Delete Characters
|
|
86
|
+
// Scroll
|
|
87
|
+
SU: 0x53, // S - Scroll Up
|
|
88
|
+
SD: 0x54, // T - Scroll Down
|
|
89
|
+
// Modes
|
|
90
|
+
SM: 0x68, // h - Set Mode
|
|
91
|
+
RM: 0x6c, // l - Reset Mode
|
|
92
|
+
// SGR
|
|
93
|
+
SGR: 0x6d, // m - Select Graphic Rendition
|
|
94
|
+
// Other
|
|
95
|
+
DSR: 0x6e, // n - Device Status Report
|
|
96
|
+
DECSCUSR: 0x71, // q - Set Cursor Style (with space intermediate)
|
|
97
|
+
DECSTBM: 0x72, // r - Set Top and Bottom Margins
|
|
98
|
+
SCOSC: 0x73, // s - Save Cursor Position
|
|
99
|
+
SCORC: 0x75, // u - Restore Cursor Position
|
|
100
|
+
CBT: 0x5a, // Z - Cursor Backward Tabulation
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Erase in Display regions (ED command parameter)
|
|
104
|
+
*/
|
|
105
|
+
export const ERASE_DISPLAY = ['toEnd', 'toStart', 'all', 'scrollback'];
|
|
106
|
+
/**
|
|
107
|
+
* Erase in Line regions (EL command parameter)
|
|
108
|
+
*/
|
|
109
|
+
export const ERASE_LINE_REGION = ['toEnd', 'toStart', 'all'];
|
|
110
|
+
/**
|
|
111
|
+
* Cursor style lookup table for DECSCUSR parameter 0-6, pairing each cursor
|
|
112
|
+
* shape with its blinking flag.
|
|
113
|
+
*/
|
|
114
|
+
export const CURSOR_STYLES = [
|
|
115
|
+
{ style: 'block', blinking: true }, // 0 - default
|
|
116
|
+
{ style: 'block', blinking: true }, // 1
|
|
117
|
+
{ style: 'block', blinking: false }, // 2
|
|
118
|
+
{ style: 'underline', blinking: true }, // 3
|
|
119
|
+
{ style: 'underline', blinking: false }, // 4
|
|
120
|
+
{ style: 'bar', blinking: true }, // 5
|
|
121
|
+
{ style: 'bar', blinking: false }, // 6
|
|
122
|
+
];
|
|
123
|
+
// Cursor movement generators
|
|
124
|
+
/**
|
|
125
|
+
* Move cursor up n lines (CSI n A).
|
|
126
|
+
* @param n - number of lines to move; defaults to 1.
|
|
127
|
+
* @returns the CSI sequence, or an empty string when n is 0.
|
|
128
|
+
*/
|
|
129
|
+
export function cursorUp(n = 1) {
|
|
130
|
+
return n === 0 ? '' : csi(n, 'A');
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Move cursor down n lines (CSI n B).
|
|
134
|
+
* @param n - number of lines to move; defaults to 1.
|
|
135
|
+
* @returns the CSI sequence, or an empty string when n is 0.
|
|
136
|
+
*/
|
|
137
|
+
export function cursorDown(n = 1) {
|
|
138
|
+
return n === 0 ? '' : csi(n, 'B');
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Move cursor forward n columns (CSI n C).
|
|
142
|
+
* @param n - number of columns to move; defaults to 1.
|
|
143
|
+
* @returns the CSI sequence, or an empty string when n is 0.
|
|
144
|
+
*/
|
|
145
|
+
export function cursorForward(n = 1) {
|
|
146
|
+
return n === 0 ? '' : csi(n, 'C');
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Move cursor back n columns (CSI n D).
|
|
150
|
+
* @param n - number of columns to move; defaults to 1.
|
|
151
|
+
* @returns the CSI sequence, or an empty string when n is 0.
|
|
152
|
+
*/
|
|
153
|
+
export function cursorBack(n = 1) {
|
|
154
|
+
return n === 0 ? '' : csi(n, 'D');
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Move cursor to column n (1-indexed) (CSI n G).
|
|
158
|
+
* @param col - the 1-indexed target column.
|
|
159
|
+
* @returns the CSI sequence.
|
|
160
|
+
*/
|
|
161
|
+
export function cursorTo(col) {
|
|
162
|
+
return csi(col, 'G');
|
|
163
|
+
}
|
|
164
|
+
/** Move cursor to column 1 (CSI G) */
|
|
165
|
+
export const CURSOR_LEFT = csi('G');
|
|
166
|
+
/**
|
|
167
|
+
* Move cursor to row, col (1-indexed) (CSI row ; col H).
|
|
168
|
+
* @param row - the 1-indexed target row.
|
|
169
|
+
* @param col - the 1-indexed target column.
|
|
170
|
+
* @returns the CSI sequence.
|
|
171
|
+
*/
|
|
172
|
+
export function cursorPosition(row, col) {
|
|
173
|
+
return csi(row, col, 'H');
|
|
174
|
+
}
|
|
175
|
+
/** Move cursor to home position (CSI H) */
|
|
176
|
+
export const CURSOR_HOME = csi('H');
|
|
177
|
+
/**
|
|
178
|
+
* Move cursor relative to current position.
|
|
179
|
+
* Positive x = right, negative x = left.
|
|
180
|
+
* Positive y = down, negative y = up.
|
|
181
|
+
* @param x - horizontal delta in columns.
|
|
182
|
+
* @param y - vertical delta in rows.
|
|
183
|
+
* @returns the concatenated CSI sequences, or an empty string when both deltas are 0.
|
|
184
|
+
*/
|
|
185
|
+
export function cursorMove(x, y) {
|
|
186
|
+
let result = '';
|
|
187
|
+
// Horizontal first (matches ansi-escapes behavior)
|
|
188
|
+
if (x < 0) {
|
|
189
|
+
result += cursorBack(-x);
|
|
190
|
+
}
|
|
191
|
+
else if (x > 0) {
|
|
192
|
+
result += cursorForward(x);
|
|
193
|
+
}
|
|
194
|
+
// Then vertical
|
|
195
|
+
if (y < 0) {
|
|
196
|
+
result += cursorUp(-y);
|
|
197
|
+
}
|
|
198
|
+
else if (y > 0) {
|
|
199
|
+
result += cursorDown(y);
|
|
200
|
+
}
|
|
201
|
+
return result;
|
|
202
|
+
}
|
|
203
|
+
// Save/restore cursor position
|
|
204
|
+
/** Save cursor position (CSI s) */
|
|
205
|
+
export const CURSOR_SAVE = csi('s');
|
|
206
|
+
/** Restore cursor position (CSI u) */
|
|
207
|
+
export const CURSOR_RESTORE = csi('u');
|
|
208
|
+
// Erase generators
|
|
209
|
+
/**
|
|
210
|
+
* Erase from cursor to end of line (CSI K).
|
|
211
|
+
* @returns the CSI sequence.
|
|
212
|
+
*/
|
|
213
|
+
export function eraseToEndOfLine() {
|
|
214
|
+
return csi('K');
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Erase from cursor to start of line (CSI 1 K).
|
|
218
|
+
* @returns the CSI sequence.
|
|
219
|
+
*/
|
|
220
|
+
export function eraseToStartOfLine() {
|
|
221
|
+
return csi(1, 'K');
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Erase entire line (CSI 2 K).
|
|
225
|
+
* @returns the CSI sequence.
|
|
226
|
+
*/
|
|
227
|
+
export function eraseLine() {
|
|
228
|
+
return csi(2, 'K');
|
|
229
|
+
}
|
|
230
|
+
/** Erase entire line - constant form */
|
|
231
|
+
export const ERASE_LINE = csi(2, 'K');
|
|
232
|
+
/**
|
|
233
|
+
* Erase from cursor to end of screen (CSI J).
|
|
234
|
+
* @returns the CSI sequence.
|
|
235
|
+
*/
|
|
236
|
+
export function eraseToEndOfScreen() {
|
|
237
|
+
return csi('J');
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Erase from cursor to start of screen (CSI 1 J).
|
|
241
|
+
* @returns the CSI sequence.
|
|
242
|
+
*/
|
|
243
|
+
export function eraseToStartOfScreen() {
|
|
244
|
+
return csi(1, 'J');
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Erase entire screen (CSI 2 J).
|
|
248
|
+
* @returns the CSI sequence.
|
|
249
|
+
*/
|
|
250
|
+
export function eraseScreen() {
|
|
251
|
+
return csi(2, 'J');
|
|
252
|
+
}
|
|
253
|
+
/** Erase entire screen - constant form */
|
|
254
|
+
export const ERASE_SCREEN = csi(2, 'J');
|
|
255
|
+
/** Erase scrollback buffer (CSI 3 J) */
|
|
256
|
+
export const ERASE_SCROLLBACK = csi(3, 'J');
|
|
257
|
+
/**
|
|
258
|
+
* Erase n lines starting from the cursor line, moving the cursor up.
|
|
259
|
+
* This erases each line and moves up, ending at column 1.
|
|
260
|
+
* @param n - the number of lines to erase.
|
|
261
|
+
* @returns the combined erase and cursor sequences, or an empty string when
|
|
262
|
+
* n is 0 or negative.
|
|
263
|
+
*/
|
|
264
|
+
export function eraseLines(n) {
|
|
265
|
+
if (n <= 0)
|
|
266
|
+
return '';
|
|
267
|
+
let result = '';
|
|
268
|
+
for (let i = 0; i < n; i++) {
|
|
269
|
+
result += ERASE_LINE;
|
|
270
|
+
if (i < n - 1) {
|
|
271
|
+
result += cursorUp(1);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
result += CURSOR_LEFT;
|
|
275
|
+
return result;
|
|
276
|
+
}
|
|
277
|
+
/** Reset all SGR attributes (CSI 0 m). Erase/scroll sequences fill blank
|
|
278
|
+
* cells with the CURRENT background color (BCE) — prefix this before any
|
|
279
|
+
* such sequence that must not inherit a possibly-stuck background (e.g.
|
|
280
|
+
* after a truncated frame left a colored SGR active). */
|
|
281
|
+
export const SGR_RESET = csi(0, 'm');
|
|
282
|
+
// Scroll
|
|
283
|
+
/**
|
|
284
|
+
* Scroll up n lines (CSI n S).
|
|
285
|
+
* @param n - number of lines to scroll; defaults to 1.
|
|
286
|
+
* @returns the CSI sequence, or an empty string when n is 0.
|
|
287
|
+
*/
|
|
288
|
+
export function scrollUp(n = 1) {
|
|
289
|
+
return n === 0 ? '' : csi(n, 'S');
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Scroll down n lines (CSI n T).
|
|
293
|
+
* @param n - number of lines to scroll; defaults to 1.
|
|
294
|
+
* @returns the CSI sequence, or an empty string when n is 0.
|
|
295
|
+
*/
|
|
296
|
+
export function scrollDown(n = 1) {
|
|
297
|
+
return n === 0 ? '' : csi(n, 'T');
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Set scroll region (DECSTBM, CSI top;bottom r). 1-indexed, inclusive.
|
|
301
|
+
* @param top - the 1-indexed first row of the region.
|
|
302
|
+
* @param bottom - the 1-indexed last row of the region.
|
|
303
|
+
* @returns the CSI sequence.
|
|
304
|
+
*/
|
|
305
|
+
export function setScrollRegion(top, bottom) {
|
|
306
|
+
return csi(top, bottom, 'r');
|
|
307
|
+
}
|
|
308
|
+
/** Reset scroll region to full screen (DECSTBM, CSI r). Homes the cursor. */
|
|
309
|
+
export const RESET_SCROLL_REGION = csi('r');
|
|
310
|
+
// Bracketed paste markers (input from terminal, not output)
|
|
311
|
+
// These are sent by the terminal to delimit pasted content when
|
|
312
|
+
// bracketed paste mode is enabled (via DEC mode 2004)
|
|
313
|
+
/** Sent by terminal before pasted content (CSI 200 ~) */
|
|
314
|
+
export const PASTE_START = csi('200~');
|
|
315
|
+
/** Sent by terminal after pasted content (CSI 201 ~) */
|
|
316
|
+
export const PASTE_END = csi('201~');
|
|
317
|
+
// Focus event markers (input from terminal, not output)
|
|
318
|
+
// These are sent by the terminal when focus changes while
|
|
319
|
+
// focus events mode is enabled (via DEC mode 1004)
|
|
320
|
+
/** Sent by terminal when it gains focus (CSI I) */
|
|
321
|
+
export const FOCUS_IN = csi('I');
|
|
322
|
+
/** Sent by terminal when it loses focus (CSI O) */
|
|
323
|
+
export const FOCUS_OUT = csi('O');
|
|
324
|
+
// Kitty keyboard protocol (CSI u)
|
|
325
|
+
// Enables enhanced key reporting with modifier information
|
|
326
|
+
// See: https://sw.kovidgoyal.net/kitty/keyboard-protocol/
|
|
327
|
+
/**
|
|
328
|
+
* Enable Kitty keyboard protocol with basic modifier reporting
|
|
329
|
+
* CSI > 1 u - pushes mode with flags=1 (disambiguate escape codes)
|
|
330
|
+
* This makes Shift+Enter send CSI 13;2 u instead of just CR
|
|
331
|
+
*/
|
|
332
|
+
export const ENABLE_KITTY_KEYBOARD = csi('>1u');
|
|
333
|
+
/**
|
|
334
|
+
* Disable Kitty keyboard protocol
|
|
335
|
+
* CSI < u - pops the keyboard mode stack
|
|
336
|
+
*/
|
|
337
|
+
export const DISABLE_KITTY_KEYBOARD = csi('<u');
|
|
338
|
+
/**
|
|
339
|
+
* Enable xterm modifyOtherKeys level 2.
|
|
340
|
+
* tmux accepts this (not the kitty stack) to enable extended keys — when
|
|
341
|
+
* extended-keys-format is csi-u, tmux then emits keys in kitty format.
|
|
342
|
+
*/
|
|
343
|
+
export const ENABLE_MODIFY_OTHER_KEYS = csi('>4;2m');
|
|
344
|
+
/**
|
|
345
|
+
* Disable xterm modifyOtherKeys (reset to default).
|
|
346
|
+
*/
|
|
347
|
+
export const DISABLE_MODIFY_OTHER_KEYS = csi('>4m');
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DEC (Digital Equipment Corporation) Private Mode Sequences
|
|
3
|
+
*
|
|
4
|
+
* DEC private modes use CSI ? N h (set) and CSI ? N l (reset) format.
|
|
5
|
+
* These are terminal-specific extensions to the ANSI standard.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* DEC private mode numbers
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEC: {
|
|
11
|
+
readonly CURSOR_VISIBLE: 25;
|
|
12
|
+
readonly ALT_SCREEN: 47;
|
|
13
|
+
readonly ALT_SCREEN_CLEAR: 1049;
|
|
14
|
+
readonly MOUSE_NORMAL: 1000;
|
|
15
|
+
readonly MOUSE_BUTTON: 1002;
|
|
16
|
+
readonly MOUSE_ANY: 1003;
|
|
17
|
+
readonly MOUSE_SGR: 1006;
|
|
18
|
+
readonly FOCUS_EVENTS: 1004;
|
|
19
|
+
readonly BRACKETED_PASTE: 2004;
|
|
20
|
+
readonly SYNCHRONIZED_UPDATE: 2026;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Generate a CSI ? N h sequence to set a DEC private mode.
|
|
24
|
+
* @param mode - the DEC private mode number.
|
|
25
|
+
* @returns the CSI sequence.
|
|
26
|
+
*/
|
|
27
|
+
export declare function decset(mode: number): string;
|
|
28
|
+
/**
|
|
29
|
+
* Generate a CSI ? N l sequence to reset a DEC private mode.
|
|
30
|
+
* @param mode - the DEC private mode number.
|
|
31
|
+
* @returns the CSI sequence.
|
|
32
|
+
*/
|
|
33
|
+
export declare function decreset(mode: number): string;
|
|
34
|
+
/** Enable synchronized output updates (DECSET 2026). */
|
|
35
|
+
export declare const BSU: string;
|
|
36
|
+
/** Disable synchronized output updates (DECRESET 2026). */
|
|
37
|
+
export declare const ESU: string;
|
|
38
|
+
/** Enable bracketed paste mode (DECSET 2004). */
|
|
39
|
+
export declare const EBP: string;
|
|
40
|
+
/** Disable bracketed paste mode (DECRESET 2004). */
|
|
41
|
+
export declare const DBP: string;
|
|
42
|
+
/** Enable focus event reporting (DECSET 1004). */
|
|
43
|
+
export declare const EFE: string;
|
|
44
|
+
/** Disable focus event reporting (DECRESET 1004). */
|
|
45
|
+
export declare const DFE: string;
|
|
46
|
+
/** Show the cursor (DECSET 25). */
|
|
47
|
+
export declare const SHOW_CURSOR: string;
|
|
48
|
+
/** Hide the cursor (DECRESET 25). */
|
|
49
|
+
export declare const HIDE_CURSOR: string;
|
|
50
|
+
/** Enter the alternate screen, clearing it (DECSET 1049). */
|
|
51
|
+
export declare const ENTER_ALT_SCREEN: string;
|
|
52
|
+
/** Exit the alternate screen (DECRESET 1049). */
|
|
53
|
+
export declare const EXIT_ALT_SCREEN: string;
|
|
54
|
+
/**
|
|
55
|
+
* Enable full mouse tracking: modes 1000 (click/release/wheel), 1002 (drag),
|
|
56
|
+
* 1003 (hover), and 1006 (SGR format).
|
|
57
|
+
*/
|
|
58
|
+
export declare const ENABLE_MOUSE_TRACKING: string;
|
|
59
|
+
/** Disable all mouse tracking modes enabled by ENABLE_MOUSE_TRACKING. */
|
|
60
|
+
export declare const DISABLE_MOUSE_TRACKING: string;
|
|
61
|
+
//# sourceMappingURL=dec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dec.d.ts","sourceRoot":"","sources":["../../../../src/ink/termio/dec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;GAEG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;CAWN,CAAA;AAEV;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAID,wDAAwD;AACxD,eAAO,MAAM,GAAG,QAAkC,CAAA;AAElD,2DAA2D;AAC3D,eAAO,MAAM,GAAG,QAAoC,CAAA;AAEpD,iDAAiD;AACjD,eAAO,MAAM,GAAG,QAA8B,CAAA;AAE9C,oDAAoD;AACpD,eAAO,MAAM,GAAG,QAAgC,CAAA;AAEhD,kDAAkD;AAClD,eAAO,MAAM,GAAG,QAA2B,CAAA;AAE3C,qDAAqD;AACrD,eAAO,MAAM,GAAG,QAA6B,CAAA;AAE7C,mCAAmC;AACnC,eAAO,MAAM,WAAW,QAA6B,CAAA;AAErD,qCAAqC;AACrC,eAAO,MAAM,WAAW,QAA+B,CAAA;AAEvD,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,QAA+B,CAAA;AAE5D,iDAAiD;AACjD,eAAO,MAAM,eAAe,QAAiC,CAAA;AAK7D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAIX,CAAA;AAEvB,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,QAIP,CAAA"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DEC (Digital Equipment Corporation) Private Mode Sequences
|
|
3
|
+
*
|
|
4
|
+
* DEC private modes use CSI ? N h (set) and CSI ? N l (reset) format.
|
|
5
|
+
* These are terminal-specific extensions to the ANSI standard.
|
|
6
|
+
*/
|
|
7
|
+
import { csi } from './csi.js';
|
|
8
|
+
/**
|
|
9
|
+
* DEC private mode numbers
|
|
10
|
+
*/
|
|
11
|
+
export const DEC = {
|
|
12
|
+
CURSOR_VISIBLE: 25,
|
|
13
|
+
ALT_SCREEN: 47,
|
|
14
|
+
ALT_SCREEN_CLEAR: 1049,
|
|
15
|
+
MOUSE_NORMAL: 1000,
|
|
16
|
+
MOUSE_BUTTON: 1002,
|
|
17
|
+
MOUSE_ANY: 1003,
|
|
18
|
+
MOUSE_SGR: 1006,
|
|
19
|
+
FOCUS_EVENTS: 1004,
|
|
20
|
+
BRACKETED_PASTE: 2004,
|
|
21
|
+
SYNCHRONIZED_UPDATE: 2026,
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Generate a CSI ? N h sequence to set a DEC private mode.
|
|
25
|
+
* @param mode - the DEC private mode number.
|
|
26
|
+
* @returns the CSI sequence.
|
|
27
|
+
*/
|
|
28
|
+
export function decset(mode) {
|
|
29
|
+
return csi(`?${mode}h`);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Generate a CSI ? N l sequence to reset a DEC private mode.
|
|
33
|
+
* @param mode - the DEC private mode number.
|
|
34
|
+
* @returns the CSI sequence.
|
|
35
|
+
*/
|
|
36
|
+
export function decreset(mode) {
|
|
37
|
+
return csi(`?${mode}l`);
|
|
38
|
+
}
|
|
39
|
+
// Pre-generated sequences for common modes
|
|
40
|
+
/** Enable synchronized output updates (DECSET 2026). */
|
|
41
|
+
export const BSU = decset(DEC.SYNCHRONIZED_UPDATE);
|
|
42
|
+
/** Disable synchronized output updates (DECRESET 2026). */
|
|
43
|
+
export const ESU = decreset(DEC.SYNCHRONIZED_UPDATE);
|
|
44
|
+
/** Enable bracketed paste mode (DECSET 2004). */
|
|
45
|
+
export const EBP = decset(DEC.BRACKETED_PASTE);
|
|
46
|
+
/** Disable bracketed paste mode (DECRESET 2004). */
|
|
47
|
+
export const DBP = decreset(DEC.BRACKETED_PASTE);
|
|
48
|
+
/** Enable focus event reporting (DECSET 1004). */
|
|
49
|
+
export const EFE = decset(DEC.FOCUS_EVENTS);
|
|
50
|
+
/** Disable focus event reporting (DECRESET 1004). */
|
|
51
|
+
export const DFE = decreset(DEC.FOCUS_EVENTS);
|
|
52
|
+
/** Show the cursor (DECSET 25). */
|
|
53
|
+
export const SHOW_CURSOR = decset(DEC.CURSOR_VISIBLE);
|
|
54
|
+
/** Hide the cursor (DECRESET 25). */
|
|
55
|
+
export const HIDE_CURSOR = decreset(DEC.CURSOR_VISIBLE);
|
|
56
|
+
/** Enter the alternate screen, clearing it (DECSET 1049). */
|
|
57
|
+
export const ENTER_ALT_SCREEN = decset(DEC.ALT_SCREEN_CLEAR);
|
|
58
|
+
/** Exit the alternate screen (DECRESET 1049). */
|
|
59
|
+
export const EXIT_ALT_SCREEN = decreset(DEC.ALT_SCREEN_CLEAR);
|
|
60
|
+
// Mouse tracking: 1000 reports button press/release/wheel, 1002 adds drag
|
|
61
|
+
// events (button-motion), 1003 adds all-motion (no button held — for
|
|
62
|
+
// hover), 1006 uses SGR format (CSI < btn;col;row M/m) instead of legacy
|
|
63
|
+
// X10 bytes. Combined: wheel + click/drag for selection + hover.
|
|
64
|
+
/**
|
|
65
|
+
* Enable full mouse tracking: modes 1000 (click/release/wheel), 1002 (drag),
|
|
66
|
+
* 1003 (hover), and 1006 (SGR format).
|
|
67
|
+
*/
|
|
68
|
+
export const ENABLE_MOUSE_TRACKING = decset(DEC.MOUSE_NORMAL) +
|
|
69
|
+
decset(DEC.MOUSE_BUTTON) +
|
|
70
|
+
decset(DEC.MOUSE_ANY) +
|
|
71
|
+
decset(DEC.MOUSE_SGR);
|
|
72
|
+
/** Disable all mouse tracking modes enabled by ENABLE_MOUSE_TRACKING. */
|
|
73
|
+
export const DISABLE_MOUSE_TRACKING = decreset(DEC.MOUSE_SGR) +
|
|
74
|
+
decreset(DEC.MOUSE_ANY) +
|
|
75
|
+
decreset(DEC.MOUSE_BUTTON) +
|
|
76
|
+
decreset(DEC.MOUSE_NORMAL);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESC Sequence Parser
|
|
3
|
+
*
|
|
4
|
+
* Handles simple escape sequences: ESC + one or two characters
|
|
5
|
+
*/
|
|
6
|
+
import type { Action } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Parse a simple ESC sequence.
|
|
9
|
+
*
|
|
10
|
+
* @param chars - Characters after ESC (not including ESC itself).
|
|
11
|
+
* @returns the semantic action for the sequence, or null when the sequence
|
|
12
|
+
* is empty or deliberately ignored (tab stop set, charset selection).
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseEsc(chars: string): Action | null;
|
|
15
|
+
//# sourceMappingURL=esc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esc.d.ts","sourceRoot":"","sources":["../../../../src/ink/termio/esc.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAqDrD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESC Sequence Parser
|
|
3
|
+
*
|
|
4
|
+
* Handles simple escape sequences: ESC + one or two characters
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Parse a simple ESC sequence.
|
|
8
|
+
*
|
|
9
|
+
* @param chars - Characters after ESC (not including ESC itself).
|
|
10
|
+
* @returns the semantic action for the sequence, or null when the sequence
|
|
11
|
+
* is empty or deliberately ignored (tab stop set, charset selection).
|
|
12
|
+
*/
|
|
13
|
+
export function parseEsc(chars) {
|
|
14
|
+
if (chars.length === 0)
|
|
15
|
+
return null;
|
|
16
|
+
const first = chars[0];
|
|
17
|
+
// Full reset (RIS)
|
|
18
|
+
if (first === 'c') {
|
|
19
|
+
return { type: 'reset' };
|
|
20
|
+
}
|
|
21
|
+
// Cursor save (DECSC)
|
|
22
|
+
if (first === '7') {
|
|
23
|
+
return { type: 'cursor', action: { type: 'save' } };
|
|
24
|
+
}
|
|
25
|
+
// Cursor restore (DECRC)
|
|
26
|
+
if (first === '8') {
|
|
27
|
+
return { type: 'cursor', action: { type: 'restore' } };
|
|
28
|
+
}
|
|
29
|
+
// Index - move cursor down (IND)
|
|
30
|
+
if (first === 'D') {
|
|
31
|
+
return {
|
|
32
|
+
type: 'cursor',
|
|
33
|
+
action: { type: 'move', direction: 'down', count: 1 },
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// Reverse index - move cursor up (RI)
|
|
37
|
+
if (first === 'M') {
|
|
38
|
+
return {
|
|
39
|
+
type: 'cursor',
|
|
40
|
+
action: { type: 'move', direction: 'up', count: 1 },
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
// Next line (NEL)
|
|
44
|
+
if (first === 'E') {
|
|
45
|
+
return { type: 'cursor', action: { type: 'nextLine', count: 1 } };
|
|
46
|
+
}
|
|
47
|
+
// Horizontal tab set (HTS)
|
|
48
|
+
if (first === 'H') {
|
|
49
|
+
return null; // Tab stop, not commonly needed
|
|
50
|
+
}
|
|
51
|
+
// Charset selection (ESC ( X, ESC ) X, etc.) - silently ignore
|
|
52
|
+
if ('()'.includes(first) && chars.length >= 2) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
// Unknown
|
|
56
|
+
return { type: 'unknown', sequence: `\x1b${chars}` };
|
|
57
|
+
}
|