termio.ts
ink/termio.ts
43
Lines
1036
Bytes
4
Exports
4
Imports
10
Keywords
What this is
This page documents one file from the repository and includes its full source so you can read it without leaving the docs site.
Beginner explanation
This file is one piece of the larger system. Its name, directory, imports, and exports show where it fits. Start by reading the exports and related files first.
How it is used
Start from the exports list and related files. Those are the easiest clues for where this file fits into the system.
Expert explanation
Architecturally, this file intersects with ui-flow. It contains 43 lines, 4 detected imports, and 4 detected exports.
Important relationships
Detected exports
ParsercolorsEqualdefaultStylestylesEqual
Keywords
parsertermiostyletypesansisemanticactionsparsetextescape
Detected imports
./termio.js./termio/parser.js./termio/types.js./termio/types.js
Source notes
This page embeds the full file contents. Small or leaf files are still indexed honestly instead of being over-explained.
Full source
/**
* ANSI Parser Module
*
* A semantic ANSI escape sequence parser inspired by ghostty, tmux, and iTerm2.
*
* Key features:
* - Semantic output: produces structured actions, not string tokens
* - Streaming: can parse input incrementally via Parser class
* - Style tracking: maintains text style state across parse calls
* - Comprehensive: supports SGR, CSI, OSC, ESC sequences
*
* Usage:
*
* ```typescript
* import { Parser } from './termio.js'
*
* const parser = new Parser()
* const actions = parser.feed('\x1b[31mred\x1b[0m')
* // => [{ type: 'text', graphemes: [...], style: { fg: { type: 'named', name: 'red' }, ... } }]
* ```
*/
// Parser
export { Parser } from './termio/parser.js'
// Types
export type {
Action,
Color,
CursorAction,
CursorDirection,
EraseAction,
Grapheme,
LinkAction,
ModeAction,
NamedColor,
ScrollAction,
TextSegment,
TextStyle,
TitleAction,
UnderlineStyle,
} from './termio/types.js'
export { colorsEqual, defaultStyle, stylesEqual } from './termio/types.js'