xyaman/runes
WIP - Zig TUI Library. https://xyaman.github.io/runes/
be3713ff04e7db3584669e679253ef388e426dc6Tested with Zig version
0.15.1(release)
Runes is a lightweight UI framework written in Zig, designed for composable, responsive terminal or graphical interfaces. It provides a structured approach to building interactive applications through a hierarchy of layout and widget abstractions.
Documentation (auto-generated): https://xyaman.github.io/runes/
| Concept | Description |
|---|---|
| Rune | A single drawable cell (the smallest visual unit). |
| Runestone | A canvas or buffer containing a grid of Runes, representing the current screen. |
| Forge | The top-level session or application controller that manages the render and input loop. |
Inscriptions are UI components that can measure, render, and handle input.
Each inscription can be drawn onto a Runestone at a specific position.
pub fn measure(self: *Self) common.Size { ... }
pub fn inscribe(self: *Self, stone: *Runestone, x: usize, y: usize) !void { ... }
pub fn handleInput(self: *Self, event: mibu.events.Event) !bool { ... }
Runes provides flexible layout behavior through Stacks, similar to CSS Flexbox. Each layout can arrange widgets using one of two modes:
| Mode | Description |
|---|---|
| Factor | Positions and sizes elements proportionally based on available space (responsive). |
| Sequential | Places each element immediately after the previous one, allowing a fixed gap between them. |
Stack
.factor and .sequential layout modes.List