|
| 1 | +# examples |
| 2 | + |
| 3 | +This directory contains runnable example applications that exercise different |
| 4 | +features of libs. If any of these examples are not working, please open an issue |
| 5 | +with information about your terminal, shell, operating system and any other |
| 6 | +information that could be pertinent to reproducing the issue. |
| 7 | + |
| 8 | +> [!NOTE] |
| 9 | +> Run the commands in this document from the repository root. |
| 10 | +
|
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +Build the generated WebAssembly bundle before running the examples: |
| 14 | + |
| 15 | +```sh |
| 16 | +make |
| 17 | +``` |
| 18 | + |
| 19 | +## Keyboard |
| 20 | + |
| 21 | +Path: `examples/keyboard/index.ts` |
| 22 | + |
| 23 | +Run it with: |
| 24 | + |
| 25 | +```sh |
| 26 | +deno run examples/keyboard/index.ts |
| 27 | +``` |
| 28 | + |
| 29 | +What it shows: |
| 30 | + |
| 31 | +- raw keyboard input decoded into structured key events |
| 32 | +- progressive keyboard protocol support |
| 33 | +- pointer tracking and hover/click-driven UI updates |
| 34 | +- terminal mode configuration such as alternate buffer, hidden cursor, and mouse |
| 35 | + reporting |
| 36 | + |
| 37 | +Related files: |
| 38 | + |
| 39 | +- `examples/keyboard/use-input.ts` wraps the input parser as a stream of decoded |
| 40 | + events |
| 41 | +- `examples/keyboard/use-stdin.ts` adapts stdin into a byte stream for the demo |
| 42 | + |
| 43 | +## Inline Regions |
| 44 | + |
| 45 | +Path: `examples/inline-regions/index.ts` |
| 46 | + |
| 47 | +Run it with: |
| 48 | + |
| 49 | +```sh |
| 50 | +deno run examples/inline-regions/index.ts |
| 51 | +``` |
| 52 | + |
| 53 | +What it shows: |
| 54 | + |
| 55 | +- rendering animated regions into normal terminal scrollback |
| 56 | +- querying cursor position with DSR to place later frames correctly |
| 57 | +- updating a previously allocated region without taking over the whole screen |
| 58 | +- small animated demos including a spinner, a progress bar, and a nyan-cat-style |
| 59 | + sequence |
| 60 | + |
| 61 | +This example is useful if you want to embed transient or animated UI output into |
| 62 | +a normal command-line workflow instead of switching to a full-screen alternate |
| 63 | +buffer interface. |
0 commit comments