···2121will run anywhere JavaScript runs with no native dependencies, and no build step
2222for consumers.
23232424-### Demo
2424+### Examples
25252626The application in this demo uses Clayterm for all layout and input parsing
2727···3030The input parser decodes raw terminal bytes into structured events. Here you can
3131see each key event as the string "hello world" is typed.
32323333-
3333+
34343535#### Pointer Events
36363737Here we see hover styles applied to UI elements in response to the pointer
3838state. Clay drives the hit testing; no manual coordinate math required.
39394040-
4040+
41414242## Architecture
4343
···2121 type PointerEvent,
2222 rgba,
2323 text,
2424-} from "../mod.ts";
2424+} from "../../mod.ts";
2525import {
2626 alternateBuffer,
2727 cursor,
···2929 progressiveInput,
3030 type Setting,
3131 settings,
3232-} from "../settings.ts";
3232+} from "../../settings.ts";
3333import { useInput } from "./use-input.ts";
3434import { useStdin } from "./use-stdin.ts";
3535
+1-1
demo/use-input.ts
examples/keyboard/use-input.ts
···1111 suspend,
1212 until,
1313} from "effection";
1414-import { createInput, type InputEvent, type InputOptions } from "../mod.ts";
1414+import { createInput, type InputEvent, type InputOptions } from "../../mod.ts";
15151616function nothing() {
1717 return suspend() as unknown as Operation<
demo/use-stdin.ts
examples/keyboard/use-stdin.ts
-1
deno.json
···77 "fmt:check": "deno fmt --check && clang-format --dry-run --Werror src/*.c src/*.h",
88 "build:npm": "deno run -A tasks/build-npm.ts",
99 "build:jsr": "deno run -A tasks/build-jsr.ts",
1010- "demo": "deno run demo/keyboard.ts",
1110 "bench": "deno run -A bench/mod.ts"
1211 },
1312 "imports": {
+63
examples/README.md
···11+# examples
22+33+This directory contains runnable example applications that exercise different
44+features of libs. If any of these examples are not working, please open an issue
55+with information about your terminal, shell, operating system and any other
66+information that could be pertinent to reproducing the issue.
77+88+> [!NOTE]
99+> Run the commands in this document from the repository root.
1010+1111+## Prerequisites
1212+1313+Build the generated WebAssembly bundle before running the examples:
1414+1515+```sh
1616+make
1717+```
1818+1919+## Keyboard
2020+2121+Path: `examples/keyboard/index.ts`
2222+2323+Run it with:
2424+2525+```sh
2626+deno run examples/keyboard/index.ts
2727+```
2828+2929+What it shows:
3030+3131+- raw keyboard input decoded into structured key events
3232+- progressive keyboard protocol support
3333+- pointer tracking and hover/click-driven UI updates
3434+- terminal mode configuration such as alternate buffer, hidden cursor, and mouse
3535+ reporting
3636+3737+Related files:
3838+3939+- `examples/keyboard/use-input.ts` wraps the input parser as a stream of decoded
4040+ events
4141+- `examples/keyboard/use-stdin.ts` adapts stdin into a byte stream for the demo
4242+4343+## Inline Regions
4444+4545+Path: `examples/inline-regions/index.ts`
4646+4747+Run it with:
4848+4949+```sh
5050+deno run examples/inline-regions/index.ts
5151+```
5252+5353+What it shows:
5454+5555+- rendering animated regions into normal terminal scrollback
5656+- querying cursor position with DSR to place later frames correctly
5757+- updating a previously allocated region without taking over the whole screen
5858+- small animated demos including a spinner, a progress bar, and a nyan-cat-style
5959+ sequence
6060+6161+This example is useful if you want to embed transient or animated UI output into
6262+a normal command-line workflow instead of switching to a full-screen alternate
6363+buffer interface.