update docs
This commit is contained in:
+5
-63
@@ -4,8 +4,7 @@ Complete API documentation for Clojure TUI.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [tui.core](#tuicore) - Full async runtime
|
||||
- [tui.simple](#tuisimple) - Sync runtime (Babashka)
|
||||
- [tui.core](#tuicore) - Main runtime
|
||||
- [tui.render](#tuirender) - Hiccup rendering
|
||||
- [tui.input](#tuiinput) - Key input parsing
|
||||
- [tui.terminal](#tuiterminal) - Terminal control
|
||||
@@ -15,7 +14,7 @@ Complete API documentation for Clojure TUI.
|
||||
|
||||
## tui.core
|
||||
|
||||
Full-featured async runtime using core.async. Use this when you need timers, async commands, or background operations.
|
||||
Main runtime using core.async. Provides timers, async commands, background operations, and responsive layout support.
|
||||
|
||||
### run
|
||||
|
||||
@@ -31,7 +30,7 @@ Run a TUI application synchronously (blocks until quit).
|
||||
|-----|------|----------|-------------|
|
||||
| `:init` | any | Yes | Initial model value |
|
||||
| `:update` | function | Yes | `(fn [model msg] [new-model cmd])` |
|
||||
| `:view` | function | Yes | `(fn [model] hiccup)` |
|
||||
| `:view` | function | Yes | `(fn [model size] hiccup)` where size is `{:width w :height h}` |
|
||||
| `:init-cmd` | command | No | Initial command to execute |
|
||||
| `:fps` | integer | No | Frames per second (default: 60) |
|
||||
| `:alt-screen` | boolean | No | Use alternate screen (default: true) |
|
||||
@@ -48,7 +47,7 @@ Run a TUI application synchronously (blocks until quit).
|
||||
(if (tui/key= msg "q")
|
||||
[model tui/quit]
|
||||
[model nil]))
|
||||
:view (fn [{:keys [count]}]
|
||||
:view (fn [{:keys [count]} _size]
|
||||
[:text (str "Count: " count)])
|
||||
:fps 30
|
||||
:alt-screen true})
|
||||
@@ -238,62 +237,6 @@ Re-exported from `tui.render`. Render hiccup to ANSI string.
|
||||
|
||||
---
|
||||
|
||||
## tui.simple
|
||||
|
||||
Synchronous runtime compatible with Babashka. Same API as `tui.core` but without async commands.
|
||||
|
||||
### run
|
||||
|
||||
```clojure
|
||||
(run options)
|
||||
```
|
||||
|
||||
Run a TUI application synchronously.
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Key | Type | Required | Description |
|
||||
|-----|------|----------|-------------|
|
||||
| `:init` | any | Yes | Initial model value |
|
||||
| `:update` | function | Yes | `(fn [model msg] [new-model cmd])` |
|
||||
| `:view` | function | Yes | `(fn [model] hiccup)` |
|
||||
| `:alt-screen` | boolean | No | Use alternate screen (default: true) |
|
||||
|
||||
**Returns:** Final model value after quit
|
||||
|
||||
**Example:**
|
||||
|
||||
```clojure
|
||||
(require '[tui.simple :as tui])
|
||||
|
||||
(tui/run {:init 0
|
||||
:update (fn [model msg]
|
||||
(cond
|
||||
(tui/key= msg "q") [model tui/quit]
|
||||
(tui/key= msg "k") [(inc model) nil]
|
||||
:else [model nil]))
|
||||
:view (fn [count]
|
||||
[:text (str "Count: " count)])})
|
||||
```
|
||||
|
||||
### quit
|
||||
|
||||
Same as `tui.core/quit`.
|
||||
|
||||
### key=
|
||||
|
||||
Same as `tui.core/key=`.
|
||||
|
||||
### key-str
|
||||
|
||||
Same as `tui.core/key-str`.
|
||||
|
||||
### render
|
||||
|
||||
Re-exported from `tui.render`.
|
||||
|
||||
---
|
||||
|
||||
## tui.render
|
||||
|
||||
Converts hiccup data structures to ANSI-formatted strings.
|
||||
@@ -715,8 +658,7 @@ The function must:
|
||||
|
||||
| Namespace | Purpose |
|
||||
|-----------|---------|
|
||||
| `tui.core` | Full async runtime with all features |
|
||||
| `tui.simple` | Sync runtime for Babashka |
|
||||
| `tui.core` | Main runtime with Elm architecture and async commands |
|
||||
| `tui.render` | Hiccup to ANSI rendering |
|
||||
| `tui.input` | Key input parsing |
|
||||
| `tui.terminal` | Low-level terminal control |
|
||||
|
||||
Reference in New Issue
Block a user