Scratch38-S0015
A bunch of TypeScript code to help me build simple TUIs; things that look like:

I have tried to keep the different components separate from each other as much as possible so that you can mix and match the parts that are useful.
Major components
- inputeventparser has functions for parsing escape sequences from the terminal.
- TextRaster2 defines a common representation of styled terminal text.
- tuiappframework3 takes care of TUI application lifecycle management stuff.
- components2 defines a component layout and ārenderingā system and several predefined component classes.
- tuidemo3.ts uses all of the above to demonstrate how this library can be used.
There are also various vestigial bits, like SpanMan,
which was a cool idea but turned out to not be especially useful under the
āpure functions that return TextRaster2sā regime.
Things this library does not have
- Mouse input handling
- Any routing of input to ācomponentsā; the components defined by components2 are output-only, and do not themselves handle input.
TUIAppFramework3
To run demonstration, try one of:
deno run --check=all src/demo/ts/tuidemo3.ts helpdeno run --check=all src/demo/ts/tuidemo3.ts boxes- Box layout demo!
deno run --check=all src/demo/ts/tuidemo3.ts hellodeno run --check=all src/demo/ts/tuidemo3.ts clockdeno run --check=all --allow-read src\demo\ts\tuidemo3.ts wc README.md CHANGELOG.txtdeno run --check=all src\demo\ts\tuidemo3.ts wc -- This one reads data from stdin; recommendation is to pipe in a file
- You can also type text in but it will ālook messyā and youāll have to manually send EOF (Ctrl+z on Windows, Ctrl+d on Unixen) or Ctrl+c to quit.
deno run --check=all src\demo\ts\tuidemo3.ts status-mockup- Device status dashboard mockup
Pass --capture-input before the subcommand if you want to be able to hit āqā to quit
instead of having to control+c.
Other stuff
For reading characters and escape codes as sent by terminals, use toCharishes from escapeparser.ts,
which will give you an AsyncIterable<Charish>, where Charish is either a number (for a regular character)
or an object representing the data contained in an escape sequence.
See charishdemo.ts for example.
Streams of charishes can in turn be translated into āinput eventsā. See eventreader.ts for example.
Thereās also some stuff about box drawing buried in here.
This project is currently ājust a bunch of codeā, isnāt very well organized, and may change drastically between versions.
See DEVLOG.md for stream of consciousness as I try to figure out what Iām trying to build.