···11# clayterm
2233-A low-level, platform-independent terminal renderer and event parser for JavaScript. You can use clayterm directly, or as the foundation for your own framework.
33+A low-level, platform-independent terminal renderer and event parser for
44+JavaScript. You can use clayterm directly, or as the foundation for your own
55+framework.
4657## Features
6877-**Declarative terminal UI** โ Build terminal interfaces the same way you'd
88-build a web page. Clayterm uses [Clay](https://github.com/nicbarker/clay) under
99-the hood, giving you flexbox-like layout, pointer detection, and scroll
1010-containers โ all rendered to the terminal as box-drawing characters and ANSI
1111-escape sequences.
99+**Declarative terminal UI** โ Build terminal interfaces the same way you'd build
1010+a web page. Clayterm uses [Clay](https://github.com/nicbarker/clay) under the
1111+hood, giving you flexbox-like layout, pointer detection, and scroll containers โ
1212+all rendered to the terminal as box-drawing characters and ANSI escape
1313+sequences.
12141315**Zero I/O** โ Clayterm never reads stdin or writes stdout. You feed it bytes
1416and get bytes back. This makes it trivially embeddable in any framework, any
1517runtime, any event loop. There are no opinions about how you do I/O, just pure
1618computation.
17191818-**Runs everywhere** โ The entire engine is compiled to WebAssembly, so
1919-clayterm will run anywhere JavaScript runs with no native
2020-dependencies, and no build step for consumers.
2020+**Runs everywhere** โ The entire engine is compiled to WebAssembly, so clayterm
2121+will run anywhere JavaScript runs with no native dependencies, and no build step
2222+for consumers.
21232224### Demo
2325···25272628#### Keyboard Events
27292828-The input parser decodes raw terminal bytes into structured events.
2929-Here you can see each key event as the string "hello world" is typed.
3030+The input parser decodes raw terminal bytes into structured events. Here you can
3131+see each key event as the string "hello world" is typed.
30323133
32343335#### Pointer Events
34363535-Here we see hover styles applied to UI elements in response to the
3636-pointer state. Clay drives the hit testing; no manual coordinate math
3737-required.
3737+Here we see hover styles applied to UI elements in response to the pointer
3838+state. Clay drives the hit testing; no manual coordinate math required.
38393940
4040-41414242## Architecture
43434444-Clayterm does not do any I/O itself. On the ouput side, it converts UI elements into a raw sequence of bytes and pointer events, and on the input side, it converts a stream of raw bytes into structured events.
4444+Clayterm does not do any I/O itself. On the ouput side, it converts UI elements
4545+into a raw sequence of bytes and pointer events, and on the input side, it
4646+converts a stream of raw bytes into structured events.
45474648### Output
4749···126128 layout: { padding: { left: 1, right: 1 } },
127129 border: {
128130 color: rgba(0, 255, 0),
129129- left: 1, right: 1, top: 1, bottom: 1,
131131+ left: 1,
132132+ right: 1,
133133+ top: 1,
134134+ bottom: 1,
130135 },
131136 cornerRadius: { tl: 1, tr: 1, bl: 1, br: 1 },
132137 }),