Skip to content

Commit 5cd17a5

Browse files
authored
docs(tui): add package-level Scaladoc landing page (#103)
1 parent 6a45c30 commit 5cd17a5

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/**
2+
* TermFlow is an Elm-architecture TUI framework for Scala 3. An application
3+
* defines a model, a message type, and four functions (`init`, `update`,
4+
* `view`, `toMsg`); the runtime calls them in a loop and paints the rendered
5+
* virtual DOM to the terminal.
6+
*
7+
* == Core types ==
8+
*
9+
* Every TermFlow app works with the same small vocabulary:
10+
*
11+
* - [[termflow.tui.TuiApp]] — the trait your application extends. Wires
12+
* together `init` / `update` / `view` / `toMsg` and gives the runtime
13+
* enough structure to drive your program.
14+
* - [[termflow.tui.Tui]] — the `(Model, Cmd[Msg])` pair returned from
15+
* `init` and `update`. `Model.tui` lifts a model into a `Tui` with
16+
* `Cmd.NoCmd`; `Model.gCmd(msg)` lifts with a `GCmd(msg)`.
17+
* - [[termflow.tui.Cmd]] — imperative effects the runtime executes on your
18+
* behalf: send another message (`GCmd`), run a `Future` (`FCmd`), exit
19+
* (`Exit`), or report an error (`TermFlowErrorCmd`).
20+
* - [[termflow.tui.Sub]] — long-running sources of messages: keyboard
21+
* input, timers, terminal resize. Register with `RuntimeCtx.registerSub`
22+
* so the runtime cancels them on exit.
23+
* - [[termflow.tui.VNode]] — the virtual DOM that `view` produces. Text,
24+
* boxes, and inputs are positioned with `XCoord` / `YCoord` and styled
25+
* with [[termflow.tui.Style]] / [[termflow.tui.Color]].
26+
*
27+
* == Message loop ==
28+
*
29+
* The runtime starts by calling `init(ctx)` to build the first `Tui[Model,
30+
* Msg]`. `toMsg` turns each user-entered prompt line into a `Msg`;
31+
* subscription events (keyboard, timers, resize) are published as
32+
* `Cmd.GCmd(msg)` and dispatched straight to `update` without going through
33+
* `toMsg`. Either path lands at `update(model, msg, ctx)`, which produces
34+
* the next `Tui`. `view(model)` renders after every update and the
35+
* resulting `RootNode` is diffed and written to the terminal by
36+
* `AnsiRenderer`.
37+
*
38+
* == Pointers ==
39+
*
40+
* - Architecture overview: `docs/DESIGN.md`
41+
* - Rendering internals: `docs/RENDER_PIPELINE.md`
42+
* - Running the sample apps: `docs/RUN_EXAMPLES.md`
43+
*
44+
* == Sample apps ==
45+
*
46+
* The `termflow-sample` module contains runnable apps that exercise the
47+
* framework end-to-end. Small starting points:
48+
*
49+
* - `termflow.apps.task.RenderApp` — a minimal `TuiApp` wiring up
50+
* `init` / `update` / `view` / `toMsg`.
51+
* - `termflow.apps.echo.EchoApp` — prompt-line loop with a scrolling
52+
* history.
53+
* - `termflow.apps.tabs.TabsDemoApp` — a larger demo that composes
54+
* several `VNode` shapes.
55+
*
56+
* See `docs/RUN_EXAMPLES.md` for how to run them.
57+
*/
58+
package termflow.tui

0 commit comments

Comments
 (0)