ratatui_ruby 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.builds/ruby-3.2.yml +1 -1
- data/.builds/ruby-3.3.yml +1 -1
- data/.builds/ruby-3.4.yml +1 -1
- data/.builds/ruby-4.0.0.yml +1 -1
- data/AGENTS.md +4 -4
- data/CHANGELOG.md +35 -0
- data/README.md +26 -1
- data/doc/application_architecture.md +16 -16
- data/doc/application_testing.md +1 -1
- data/doc/contributors/architectural_overhaul/chat_conversations.md +4952 -0
- data/doc/contributors/architectural_overhaul/implementation_plan.md +60 -0
- data/doc/contributors/architectural_overhaul/task.md +37 -0
- data/doc/contributors/design/ruby_frontend.md +277 -81
- data/doc/contributors/design/rust_backend.md +349 -55
- data/doc/contributors/developing_examples.md +5 -5
- data/doc/contributors/index.md +7 -5
- data/doc/contributors/v1.0.0_blockers.md +1729 -0
- data/doc/index.md +11 -6
- data/doc/interactive_design.md +2 -2
- data/doc/quickstart.md +66 -97
- data/doc/v0.7.0_migration.md +236 -0
- data/doc/why.md +93 -0
- data/examples/app_all_events/README.md +6 -4
- data/examples/app_all_events/app.rb +1 -1
- data/examples/app_all_events/model/app_model.rb +1 -1
- data/examples/app_all_events/model/msg.rb +1 -1
- data/examples/app_all_events/update.rb +1 -1
- data/examples/app_all_events/view/app_view.rb +1 -1
- data/examples/app_all_events/view/controls_view.rb +1 -1
- data/examples/app_all_events/view/counts_view.rb +1 -1
- data/examples/app_all_events/view/live_view.rb +1 -1
- data/examples/app_all_events/view/log_view.rb +1 -1
- data/examples/app_color_picker/README.md +7 -5
- data/examples/app_color_picker/app.rb +1 -1
- data/examples/app_login_form/README.md +2 -0
- data/examples/app_stateful_interaction/README.md +2 -0
- data/examples/app_stateful_interaction/app.rb +1 -1
- data/examples/verify_quickstart_dsl/README.md +4 -3
- data/examples/verify_quickstart_dsl/app.rb +1 -1
- data/examples/verify_quickstart_layout/README.md +1 -1
- data/examples/verify_quickstart_lifecycle/README.md +3 -3
- data/examples/verify_quickstart_lifecycle/app.rb +2 -2
- data/examples/verify_readme_usage/README.md +1 -1
- data/examples/widget_barchart_demo/README.md +2 -1
- data/examples/widget_block_demo/README.md +2 -0
- data/examples/widget_box_demo/README.md +3 -3
- data/examples/widget_calendar_demo/README.md +3 -3
- data/examples/widget_calendar_demo/app.rb +5 -1
- data/examples/widget_canvas_demo/README.md +3 -3
- data/examples/widget_cell_demo/README.md +3 -3
- data/examples/widget_center_demo/README.md +3 -3
- data/examples/widget_chart_demo/README.md +3 -3
- data/examples/widget_gauge_demo/README.md +3 -3
- data/examples/widget_layout_split/README.md +3 -3
- data/examples/widget_line_gauge_demo/README.md +3 -3
- data/examples/widget_list_demo/README.md +3 -3
- data/examples/widget_map_demo/README.md +3 -3
- data/examples/widget_map_demo/app.rb +2 -2
- data/examples/widget_overlay_demo/README.md +36 -0
- data/examples/widget_popup_demo/README.md +3 -3
- data/examples/widget_ratatui_logo_demo/README.md +3 -3
- data/examples/widget_ratatui_logo_demo/app.rb +1 -1
- data/examples/widget_ratatui_mascot_demo/README.md +3 -3
- data/examples/widget_rect/README.md +3 -3
- data/examples/widget_render/README.md +3 -3
- data/examples/widget_render/app.rb +3 -3
- data/examples/widget_rich_text/README.md +3 -3
- data/examples/widget_scroll_text/README.md +3 -3
- data/examples/widget_scrollbar_demo/README.md +3 -3
- data/examples/widget_sparkline_demo/README.md +3 -3
- data/examples/widget_style_colors/README.md +3 -3
- data/examples/widget_table_demo/README.md +3 -3
- data/examples/widget_table_demo/app.rb +19 -4
- data/examples/widget_tabs_demo/README.md +3 -3
- data/examples/widget_text_width/README.md +3 -3
- data/examples/widget_text_width/app.rb +8 -1
- data/ext/ratatui_ruby/Cargo.lock +1 -1
- data/ext/ratatui_ruby/Cargo.toml +1 -1
- data/ext/ratatui_ruby/src/frame.rs +6 -5
- data/ext/ratatui_ruby/src/lib.rs +3 -2
- data/ext/ratatui_ruby/src/rendering.rs +22 -21
- data/ext/ratatui_ruby/src/text.rs +12 -3
- data/ext/ratatui_ruby/src/widgets/canvas.rs +5 -5
- data/ext/ratatui_ruby/src/widgets/table.rs +81 -36
- data/lib/ratatui_ruby/buffer/cell.rb +168 -0
- data/lib/ratatui_ruby/buffer.rb +15 -0
- data/lib/ratatui_ruby/frame.rb +8 -8
- data/lib/ratatui_ruby/layout/constraint.rb +95 -0
- data/lib/ratatui_ruby/layout/layout.rb +106 -0
- data/lib/ratatui_ruby/layout/rect.rb +118 -0
- data/lib/ratatui_ruby/layout.rb +19 -0
- data/lib/ratatui_ruby/list_state.rb +2 -2
- data/lib/ratatui_ruby/schema/layout.rb +1 -1
- data/lib/ratatui_ruby/schema/row.rb +66 -0
- data/lib/ratatui_ruby/schema/table.rb +10 -10
- data/lib/ratatui_ruby/schema/text.rb +27 -2
- data/lib/ratatui_ruby/style/style.rb +81 -0
- data/lib/ratatui_ruby/style.rb +15 -0
- data/lib/ratatui_ruby/table_state.rb +1 -1
- data/lib/ratatui_ruby/test_helper/snapshot.rb +24 -0
- data/lib/ratatui_ruby/test_helper/style_assertions.rb +1 -1
- data/lib/ratatui_ruby/tui/buffer_factories.rb +20 -0
- data/lib/ratatui_ruby/tui/canvas_factories.rb +44 -0
- data/lib/ratatui_ruby/tui/core.rb +38 -0
- data/lib/ratatui_ruby/tui/layout_factories.rb +74 -0
- data/lib/ratatui_ruby/tui/state_factories.rb +33 -0
- data/lib/ratatui_ruby/tui/style_factories.rb +20 -0
- data/lib/ratatui_ruby/tui/text_factories.rb +44 -0
- data/lib/ratatui_ruby/tui/widget_factories.rb +195 -0
- data/lib/ratatui_ruby/tui.rb +75 -0
- data/lib/ratatui_ruby/version.rb +1 -1
- data/lib/ratatui_ruby/widgets/bar_chart/bar.rb +47 -0
- data/lib/ratatui_ruby/widgets/bar_chart/bar_group.rb +25 -0
- data/lib/ratatui_ruby/widgets/bar_chart.rb +239 -0
- data/lib/ratatui_ruby/widgets/block.rb +192 -0
- data/lib/ratatui_ruby/widgets/calendar.rb +84 -0
- data/lib/ratatui_ruby/widgets/canvas.rb +231 -0
- data/lib/ratatui_ruby/widgets/cell.rb +47 -0
- data/lib/ratatui_ruby/widgets/center.rb +59 -0
- data/lib/ratatui_ruby/widgets/chart.rb +185 -0
- data/lib/ratatui_ruby/widgets/clear.rb +54 -0
- data/lib/ratatui_ruby/widgets/cursor.rb +42 -0
- data/lib/ratatui_ruby/widgets/gauge.rb +72 -0
- data/lib/ratatui_ruby/widgets/line_gauge.rb +80 -0
- data/lib/ratatui_ruby/widgets/list.rb +127 -0
- data/lib/ratatui_ruby/widgets/list_item.rb +43 -0
- data/lib/ratatui_ruby/widgets/overlay.rb +43 -0
- data/lib/ratatui_ruby/widgets/paragraph.rb +99 -0
- data/lib/ratatui_ruby/widgets/ratatui_logo.rb +31 -0
- data/lib/ratatui_ruby/widgets/ratatui_mascot.rb +36 -0
- data/lib/ratatui_ruby/widgets/row.rb +68 -0
- data/lib/ratatui_ruby/widgets/scrollbar.rb +143 -0
- data/lib/ratatui_ruby/widgets/shape/label.rb +68 -0
- data/lib/ratatui_ruby/widgets/sparkline.rb +134 -0
- data/lib/ratatui_ruby/widgets/table.rb +141 -0
- data/lib/ratatui_ruby/widgets/tabs.rb +85 -0
- data/lib/ratatui_ruby/widgets.rb +40 -0
- data/lib/ratatui_ruby.rb +23 -39
- data/sig/examples/app_all_events/view.rbs +1 -1
- data/sig/examples/app_all_events/view_state.rbs +1 -1
- data/sig/ratatui_ruby/schema/row.rbs +22 -0
- data/sig/ratatui_ruby/schema/table.rbs +1 -1
- data/sig/ratatui_ruby/schema/text.rbs +1 -0
- data/sig/ratatui_ruby/session.rbs +29 -49
- data/sig/ratatui_ruby/tui/buffer_factories.rbs +10 -0
- data/sig/ratatui_ruby/tui/canvas_factories.rbs +14 -0
- data/sig/ratatui_ruby/tui/core.rbs +14 -0
- data/sig/ratatui_ruby/tui/layout_factories.rbs +19 -0
- data/sig/ratatui_ruby/tui/state_factories.rbs +12 -0
- data/sig/ratatui_ruby/tui/style_factories.rbs +10 -0
- data/sig/ratatui_ruby/tui/text_factories.rbs +14 -0
- data/sig/ratatui_ruby/tui/widget_factories.rbs +39 -0
- data/sig/ratatui_ruby/tui.rbs +19 -0
- data/tasks/autodoc.rake +1 -35
- data/tasks/sourcehut.rake +4 -1
- metadata +62 -15
- data/doc/contributors/dwim_dx.md +0 -366
- data/doc/contributors/examples_audit/p1_high.md +0 -21
- data/doc/contributors/examples_audit/p2_moderate.md +0 -81
- data/doc/contributors/examples_audit.md +0 -41
- data/doc/images/app_analytics.png +0 -0
- data/doc/images/app_custom_widget.png +0 -0
- data/doc/images/app_mouse_events.png +0 -0
- data/doc/images/widget_table_flex.png +0 -0
- data/lib/ratatui_ruby/session/autodoc.rb +0 -482
- data/lib/ratatui_ruby/session.rb +0 -178
- data/tasks/autodoc/inventory.rb +0 -63
- data/tasks/autodoc/notice.rb +0 -26
- data/tasks/autodoc/rbs.rb +0 -38
- data/tasks/autodoc/rdoc.rb +0 -45
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e9da9703e1573d331115fd1635c1bf0564a6482c8d3d140c7b68230b56da8311
|
|
4
|
+
data.tar.gz: 41efa864847825eed6d28ee3b9292e923b3f3c97ce28841892a65123df72c16e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: efc0e59765a7cfea0108fa79335ae79d4b0bcdb2c9eff93f6e1f5d83dca04724484ce322b45a6d3e6d6cf45f80868a998c9684a8362c3e11b9e1ff02e30eade1
|
|
7
|
+
data.tar.gz: be4afb8fe1b4bf7ed1ed4757521f8b90f68ca11c101aa69b184eae2de6807a2efa8a59fc2c19d0c47d3ed28f6afd89c906ba6480e824146b2b4ea8e7bc7211fa
|
data/.builds/ruby-3.2.yml
CHANGED
data/.builds/ruby-3.3.yml
CHANGED
data/.builds/ruby-3.4.yml
CHANGED
data/.builds/ruby-4.0.0.yml
CHANGED
data/AGENTS.md
CHANGED
|
@@ -19,9 +19,9 @@ Architecture:
|
|
|
19
19
|
## Stability & Compatibility
|
|
20
20
|
|
|
21
21
|
- **Project Status:** Pre-1.0.
|
|
22
|
-
- **User Base:**
|
|
23
|
-
- **Breaking Changes:** Backward compatibility is **NOT** a priority
|
|
24
|
-
- **Requirement:** All breaking changes **MUST** be explicitly documented in the [CHANGELOG.md](CHANGELOG.md)'s **Unreleased** section to ensure transparency as the project evolves toward 1.0.
|
|
22
|
+
- **User Base:** First external users (as of 2026-01-03).
|
|
23
|
+
- **Breaking Changes:** Backward compatibility is **NOT YET** a priority. Since there are few external users, you are encouraged to refactor APIs for better ergonomics and performance even if it breaks existing code. This will when we ship v1.0.0.
|
|
24
|
+
- **Requirement:** All breaking changes **MUST** be explicitly documented in the [CHANGELOG.md](CHANGELOG.md)'s **Unreleased** section to ensure transparency as the project evolves toward 1.0. Migration guides **MUST** be included in `doc/` when we release a new minor version.
|
|
25
25
|
|
|
26
26
|
## 1. Standards
|
|
27
27
|
|
|
@@ -91,7 +91,7 @@ The project follows a standard Gem layout with an `ext/` directory for Rust code
|
|
|
91
91
|
|
|
92
92
|
## 4. Committing
|
|
93
93
|
|
|
94
|
-
- Who commits: DON'T stage (DON'T `git add`). DON'T commit. DO suggest a commit message
|
|
94
|
+
- Who commits: DON'T stage (DON'T `git add`) unless explicitly instructed. DON'T commit unless explicitly instructed. DO suggest a commit message when you finish, even if not instructed..
|
|
95
95
|
- When: Before reporting the task as complete to the user, suggest the commit message.
|
|
96
96
|
- What: Consider not what you remember, but EVERYTHING in the `git diff` and `git diff --cached`.
|
|
97
97
|
- **Format:**
|
data/CHANGELOG.md
CHANGED
|
@@ -18,6 +18,40 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
18
18
|
|
|
19
19
|
### Removed
|
|
20
20
|
|
|
21
|
+
## [0.7.0] - 2026-01-03
|
|
22
|
+
|
|
23
|
+
> [!WARNING]
|
|
24
|
+
> v0.7.0 contains significant breaking changes. See the [Migration Guide](doc/v0.7.0_migration.md) for upgrade instructions.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- **Rich Text in Table Cells**: `Table` cells (rows, header, footer) now accept `Text::Span` and `Text::Line` objects for per-character styling, matching List widget capabilities.
|
|
29
|
+
- **Row Wrapper**: New `Widgets::Row` class allows applying row-level styling (background color, style) and layout properties (height, top_margin, bottom_margin) to Table rows. Table rows can now be plain arrays or `Widgets::Row` objects.
|
|
30
|
+
- **Cell Wrapper**: New `Widgets::Cell` class wraps table cell content with optional cell-level styling. Distinct from `Buffer::Cell` which is for buffer inspection.
|
|
31
|
+
- **Line#width Method**: `Text::Line` now has a `width` instance method that calculates the display width in terminal cells using unicode-aware measurement. Useful for layout calculations with rich text.
|
|
32
|
+
- **render_rich_buffer**: New `TestHelper::Snapshot#render_rich_buffer` method returns the terminal buffer as an ANSI-encoded string with escape codes for colors and modifiers. Useful for debugging, custom assertions, or programmatic inspection beyond `assert_rich_snapshot`.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- **Namespace Restructure (Breaking)**: Classes reorganized to match Ratatui's module hierarchy. See [Migration Guide](doc/v0.7.0_migration.md) for details:
|
|
37
|
+
- `RatatuiRuby::Rect` → `RatatuiRuby::Layout::Rect`
|
|
38
|
+
- `RatatuiRuby::Constraint` → `RatatuiRuby::Layout::Constraint`
|
|
39
|
+
- `RatatuiRuby::Layout` → `RatatuiRuby::Layout::Layout`
|
|
40
|
+
- `RatatuiRuby::Style` → `RatatuiRuby::Style::Style`
|
|
41
|
+
- `RatatuiRuby::Paragraph` → `RatatuiRuby::Widgets::Paragraph`
|
|
42
|
+
- `RatatuiRuby::Block` → `RatatuiRuby::Widgets::Block`
|
|
43
|
+
- `RatatuiRuby::Table` → `RatatuiRuby::Widgets::Table`
|
|
44
|
+
- `RatatuiRuby::List` → `RatatuiRuby::Widgets::List`
|
|
45
|
+
- *(and all other widgets)*
|
|
46
|
+
- **Session → TUI Rename (Breaking)**: `RatatuiRuby::Session` renamed to `RatatuiRuby::TUI` to better reflect its role as a facade/DSL. The `TUI` class now uses explicit factory methods (no metaprogramming) for improved IDE autocomplete support.
|
|
47
|
+
- **Buffer::Cell vs Widgets::Cell (Breaking)**: `RatatuiRuby::Cell` (buffer inspection) renamed to `RatatuiRuby::Buffer::Cell`. New `RatatuiRuby::Widgets::Cell` added for table cell construction.
|
|
48
|
+
- **Text::Line style field (Breaking)**: `Text::Line` now accepts a `style:` parameter for line-level styling, matching Ratatui's `Line` struct which has `style`, `alignment`, and `spans` fields.
|
|
49
|
+
- **Table highlight_style → row_highlight_style (Breaking)**: `Table` parameter `highlight_style:` renamed to `row_highlight_style:` to match Ratatui's API naming convention.
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
### Removed
|
|
54
|
+
|
|
21
55
|
## [0.6.0] - 2026-01-03
|
|
22
56
|
|
|
23
57
|
### Added
|
|
@@ -322,6 +356,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
322
356
|
- **Testing Support**: Included `RatatuiRuby::TestHelper` and RSpec integration to make testing your TUI applications possible.
|
|
323
357
|
|
|
324
358
|
[Unreleased]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/HEAD
|
|
359
|
+
[0.7.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.7.0
|
|
325
360
|
[0.6.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.6.0
|
|
326
361
|
[0.5.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.5.0
|
|
327
362
|
[0.4.0]: https://git.sr.ht/~kerrick/ratatui_ruby/refs/v0.4.0
|
data/README.md
CHANGED
|
@@ -23,6 +23,8 @@ Mailing List: Announcements](https://img.shields.io/badge/mailing_list-announcem
|
|
|
23
23
|
> [!WARNING]
|
|
24
24
|
> **ratatui_ruby** is currently in **BETA**. The API may change between minor versions.
|
|
25
25
|
|
|
26
|
+
**[Why RatatuiRuby?](./doc/why.md)** — Native Rust performance, zero runtime overhead, and Ruby's expressiveness. [See how we compare](./doc/why.md) to CharmRuby, raw Rust, and Go.
|
|
27
|
+
|
|
26
28
|
Please join the **announce** mailing list at https://lists.sr.ht/~kerrick/ratatui_ruby-announce to stay up-to-date on new releases and announcements. See the [`trunk` branch](https://git.sr.ht/~kerrick/ratatui_ruby/tree/trunk) for pre-release updates.
|
|
27
29
|
|
|
28
30
|
|
|
@@ -92,12 +94,35 @@ end
|
|
|
92
94
|
```
|
|
93
95
|
<!-- SYNC:END -->
|
|
94
96
|
|
|
97
|
+

|
|
98
|
+
|
|
95
99
|
For a full tutorial, see [the Quickstart](./doc/quickstart.md). For an explanation of the application architecture, see [Application Architecture](./doc/application_architecture.md).
|
|
96
100
|
|
|
97
101
|
|
|
102
|
+
## Features
|
|
103
|
+
|
|
104
|
+
**ratatui_ruby** gives you 20+ widgets out of the box:
|
|
105
|
+
|
|
106
|
+
| Category | Widgets |
|
|
107
|
+
|----------|---------|
|
|
108
|
+
| **Data Display** | Table, List, Chart, Bar Chart, Sparkline, Calendar |
|
|
109
|
+
| **Layout** | Block, Tabs, Scrollbar, Center, Overlay, Clear |
|
|
110
|
+
| **Input** | Gauge, Line Gauge |
|
|
111
|
+
| **Text** | Paragraph, Rich Text (Spans + Lines), Cursor |
|
|
112
|
+
| **Canvas** | Shapes (Line, Circle, Rectangle, Map), Custom Drawing |
|
|
113
|
+
|
|
114
|
+
Plus: flexible layouts with constraints, full keyboard/mouse/paste/resize events, snapshot testing, and hex/RGB/256-color support.
|
|
115
|
+
|
|
116
|
+
|
|
98
117
|
## Documentation
|
|
99
118
|
|
|
100
|
-
|
|
119
|
+
| Resource | Description |
|
|
120
|
+
|----------|-------------|
|
|
121
|
+
| [Quickstart](./doc/quickstart.md) | Get running in 5 minutes |
|
|
122
|
+
| [Widget Gallery](./doc/quickstart.md#widget-demos) | Every widget with examples |
|
|
123
|
+
| [Application Architecture](./doc/application_architecture.md) | Patterns for scaling your app |
|
|
124
|
+
| [API Reference](./doc/index.md) | Full RDoc documentation |
|
|
125
|
+
| [Wiki](https://man.sr.ht/~kerrick/ratatui_ruby) | Guides and community resources |
|
|
101
126
|
|
|
102
127
|
|
|
103
128
|
## Contributing
|
|
@@ -44,7 +44,7 @@ Need granular control? You can initialize and restore the terminal yourself. Use
|
|
|
44
44
|
RatatuiRuby.init_terminal
|
|
45
45
|
begin
|
|
46
46
|
RatatuiRuby.draw do |frame|
|
|
47
|
-
frame.render_widget(RatatuiRuby::Paragraph.new(text: "Hello"), frame.area)
|
|
47
|
+
frame.render_widget(RatatuiRuby::Widgets::Paragraph.new(text: "Hello"), frame.area)
|
|
48
48
|
end
|
|
49
49
|
ensure
|
|
50
50
|
RatatuiRuby.restore_terminal
|
|
@@ -91,9 +91,9 @@ end
|
|
|
91
91
|
|
|
92
92
|
Writing UI trees involves nesting many widgets.
|
|
93
93
|
|
|
94
|
-
**The Problem:** Explicitly namespacing `RatatuiRuby::` for every widget (e.g., `RatatuiRuby::Paragraph.new`) is tedious. It creates visual noise that hides your layout structure.
|
|
94
|
+
**The Problem:** Explicitly namespacing `RatatuiRuby::` for every widget (e.g., `RatatuiRuby::Widgets::Paragraph.new`) is tedious. It creates visual noise that hides your layout structure.
|
|
95
95
|
|
|
96
|
-
**The Solution:** The
|
|
96
|
+
**The Solution:** The TUI API (`tui`) provides shorthand factories for every widget. It yields a TUI object to your block.
|
|
97
97
|
|
|
98
98
|
```ruby
|
|
99
99
|
RatatuiRuby.run do |tui|
|
|
@@ -147,31 +147,31 @@ RatatuiRuby.run do
|
|
|
147
147
|
loop do
|
|
148
148
|
RatatuiRuby.draw do |frame|
|
|
149
149
|
# Manual split
|
|
150
|
-
rects = RatatuiRuby::Layout.split(
|
|
150
|
+
rects = RatatuiRuby::Layout::Layout.split(
|
|
151
151
|
frame.area,
|
|
152
152
|
direction: :horizontal,
|
|
153
153
|
constraints: [
|
|
154
|
-
RatatuiRuby::Constraint.length(20),
|
|
155
|
-
RatatuiRuby::Constraint.min(0)
|
|
154
|
+
RatatuiRuby::Layout::Constraint.length(20),
|
|
155
|
+
RatatuiRuby::Layout::Constraint.min(0)
|
|
156
156
|
]
|
|
157
157
|
)
|
|
158
158
|
|
|
159
159
|
frame.render_widget(
|
|
160
|
-
RatatuiRuby::Paragraph.new(
|
|
160
|
+
RatatuiRuby::Widgets::Paragraph.new(
|
|
161
161
|
text: RatatuiRuby::Text::Line.new(spans: [
|
|
162
|
-
RatatuiRuby::Text::Span.new(content: "Side", style: RatatuiRuby::Style.new(fg: :blue)),
|
|
162
|
+
RatatuiRuby::Text::Span.new(content: "Side", style: RatatuiRuby::Style::Style.new(fg: :blue)),
|
|
163
163
|
RatatuiRuby::Text::Span.new(content: "bar")
|
|
164
164
|
]),
|
|
165
|
-
block: RatatuiRuby::Block.new(borders: [:all], title: "Nav")
|
|
165
|
+
block: RatatuiRuby::Widgets::Block.new(borders: [:all], title: "Nav")
|
|
166
166
|
),
|
|
167
167
|
rects[0]
|
|
168
168
|
)
|
|
169
169
|
|
|
170
170
|
frame.render_widget(
|
|
171
|
-
RatatuiRuby::Paragraph.new(
|
|
171
|
+
RatatuiRuby::Widgets::Paragraph.new(
|
|
172
172
|
text: "Main Content",
|
|
173
|
-
style: RatatuiRuby::Style.new(fg: :green),
|
|
174
|
-
block: RatatuiRuby::Block.new(borders: [:all], title: "Content")
|
|
173
|
+
style: RatatuiRuby::Style::Style.new(fg: :green),
|
|
174
|
+
block: RatatuiRuby::Widgets::Block.new(borders: [:all], title: "Content")
|
|
175
175
|
),
|
|
176
176
|
rects[1]
|
|
177
177
|
)
|
|
@@ -189,7 +189,7 @@ Building for Ruby 4.0's parallel future? Know which objects can travel between R
|
|
|
189
189
|
|
|
190
190
|
### Data Objects (Shareable)
|
|
191
191
|
|
|
192
|
-
These are deeply frozen and `Ractor.shareable?`. Include them in
|
|
192
|
+
These are deeply frozen and `Ractor.shareable?`. Include them in immutable Models/Messages freely:
|
|
193
193
|
|
|
194
194
|
| Object | Source |
|
|
195
195
|
|--------|--------|
|
|
@@ -203,7 +203,7 @@ These have side effects and are intentionally not shareable:
|
|
|
203
203
|
|
|
204
204
|
| Object | Valid Usage |
|
|
205
205
|
|--------|-------------|
|
|
206
|
-
| `
|
|
206
|
+
| `TUI` | Cache in `@tui` during run loop. Don't include in Models. |
|
|
207
207
|
| `Frame` | Pass to helpers during draw block. Invalid after block returns. |
|
|
208
208
|
|
|
209
209
|
```ruby
|
|
@@ -224,7 +224,7 @@ Simple scripts work well with valid linear code. Complex apps need structure.
|
|
|
224
224
|
|
|
225
225
|
We provide these reference architectures to inspire you:
|
|
226
226
|
|
|
227
|
-
###
|
|
227
|
+
### Model-View-Update
|
|
228
228
|
|
|
229
229
|
**Source:** [examples/app_all_events](../examples/app_all_events/README.md)
|
|
230
230
|
|
|
@@ -236,7 +236,7 @@ This pattern implements unidirectional data flow inspired by The Elm Architectur
|
|
|
236
236
|
|
|
237
237
|
Use this when you want predictable state management and easy-to-test logic.
|
|
238
238
|
|
|
239
|
-
###
|
|
239
|
+
### Component-Based
|
|
240
240
|
|
|
241
241
|
**Source:** [examples/app_color_picker](../examples/app_color_picker/README.md)
|
|
242
242
|
|
data/doc/application_testing.md
CHANGED
|
@@ -45,7 +45,7 @@ def test_rendering
|
|
|
45
45
|
# Uses default 80x24 terminal
|
|
46
46
|
with_test_terminal do
|
|
47
47
|
# 1. Instantiate your widget
|
|
48
|
-
widget = RatatuiRuby::Paragraph.new(text: "Hello World")
|
|
48
|
+
widget = RatatuiRuby::Widgets::Paragraph.new(text: "Hello World")
|
|
49
49
|
|
|
50
50
|
# 2. Render it using the Frame API
|
|
51
51
|
RatatuiRuby.draw do |frame|
|