warpui_core: TUI element library (text, column, container, child_view, event_handler)#12634
warpui_core: TUI element library (text, column, container, child_view, event_handler)#12634zachbai wants to merge 4 commits into
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
e30ebf4 to
f85df3c
Compare
a096d97 to
d2989fd
Compare
d2989fd to
33719f7
Compare
f85df3c to
f02f2af
Compare
f02f2af to
73c3649
Compare
33719f7 to
dbe7255
Compare
73c3649 to
c459ffb
Compare
dbe7255 to
7402b63
Compare
c459ffb to
878719b
Compare
7402b63 to
2b8f634
Compare
878719b to
b0ddbff
Compare
2b8f634 to
6f914f0
Compare
b0ddbff to
4d98812
Compare
6f914f0 to
8f0d783
Compare
4d98812 to
4cfc5f6
Compare
14b05a4 to
0dbf678
Compare
4cfc5f6 to
898f32e
Compare
0dbf678 to
53736a1
Compare
…ain (#12413) ## Description First PR in a stack that adds an optional TUI backend to `warpui`. This PR is **only** the backend-neutral groundwork — no TUI code, no behavioral change. Today the view responder chain (focus/blur, action dispatch, ancestor walks) is derived from the **GUI presenter's** layout-time parent map. This PR moves that ownership into `AppContext` so any backend can drive it: - New `AppContext.view_parents` — a per-window child→parent view map. - Fed from two sources: creation-time structural parentage (`record_view_parent`) and the active backend's render pass (`report_view_embeddings`). - Walked by `view_ancestors` / `view_parent_map`; all responder-chain / focus / dispatch sites now read this map instead of `presenter.ancestors()`. - The GUI presenter is updated to feed `report_view_embeddings`, so GUI behavior is unchanged. This is a behavior-preserving, GUI-only refactor. The TUI presenter feeds the same map later in the stack (#12601). **Reviewing (3 files):** `app.rs` is the substance — the map, its accessors, and the call-site swaps. `presenter.rs` wires the GUI render pass to report embeddings. The test swaps `presenter.ancestors()` → `ctx.view_ancestors()`. ## Stack `master` → **#12413 (this)** → #12633 → #12634 → #12601 ## Testing - [x] `cargo check -p warpui_core -p warp -p warpui` clean; `cargo nextest -p warpui_core` 279 passed / 7 skipped. - No manual run: no behavioral change. ## Agent Mode - [x] Warp Agent Mode CHANGELOG-NONE --------- Co-authored-by: Oz <oz-agent@warp.dev>
53736a1 to
eaa0508
Compare
5712979 to
54d124c
Compare
eaa0508 to
01cd3c6
Compare
## Description * Add `tui` cargo feature flag * Add `TuiElement` interface which diverges from gui `Element` * Add TUI-specific mirrors of `View` traits and APIs; these depend on `TuiElement` * Abstract out `AnyView to wrapper "router" `StoredView` enum which delegates to `AnyView`/`AnyTuiView` wrapper * Implement initial `Tui` presenter types - event context, presentation context * Move all existing GUI elements to re-exported GUI submodule of elements ## Stack #12413 → **#12633 (this)** → #12634 → #12601 ## Testing - [x] `cargo check -p warpui_core -p warp -p warpui` clean in **both** default and `--features tui`. - [x] `cargo nextest -p warpui_core`: 286/7 (default), 311/7 (`--features tui`). ## Agent Mode - [x] Warp Agent Mode CHANGELOG-NONE --------- Co-authored-by: Oz <oz-agent@warp.dev>
…, event_handler) Adds the concrete TuiElement implementors the TUI views compose: TuiText, TuiColumn, TuiContainer, TuiChildView, and TuiEventHandler (each with its own tests), and wires them into elements/tui/mod.rs. TuiChildView consumes the seam (render_tui_view + TuiEventContext::set_origin_view) added in the prior slice. Co-Authored-By: Oz <oz-agent@warp.dev>
01cd3c6 to
a09fa6e
Compare
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds the initial TUI element library pieces under crates/warpui_core/src/elements/tui/: text, column, container, child view embedding, event handling, exports, and focused unit tests. The change is additive and behind the tui feature; no approved spec context was provided, and the supplemental security pass found no security-specific issues.
Concerns
mod_test.rsappears to be added without a matching#[cfg(test)]module include inmod.rs, so that test file will not be compiled or run.
Verdict
Found: 0 critical, 0 important, 1 suggestions
Approve with nits
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| pub use event::{TuiDispatchEventResult, TuiEventContext, TuiEventDispatchResult}; | ||
| pub use event_handler::TuiEventHandler; | ||
| pub use geometry::{TuiConstraint, TuiRect, TuiSize}; | ||
| pub use text::TuiText; |
There was a problem hiding this comment.
💡 [SUGGESTION] mod_test.rs is added in this PR, but this module does not include it, so cargo test will not compile or run that test file. Wire it up under #[cfg(test)].
| pub use text::TuiText; | |
| pub use text::TuiText; | |
| #[cfg(test)] | |
| #[path = "mod_test.rs"] | |
| mod tests; |
The release compilation check failed because the call site in collect_transferable_subtree (app.rs) invokes child_view_ids on a &StoredView, but the StoredView enum had no inherent delegator for it. Add one alongside the other neutral-hook delegators, returning the GUI view's child ids and an empty list for TUI views. Co-Authored-By: Oz <oz-agent@warp.dev>
Rename `elements/tui/mod_test.rs` to `mod_tests.rs` to satisfy the CI test-file naming check (`_tests.rs`, not `_test.rs`) and wire it into `mod.rs` via the standard `#[path]` include like sibling test modules. Co-Authored-By: Oz <oz-agent@warp.dev>
The TUI element test files (child_view_tests, container_tests, event_handler_tests) use `()` as a no-op TuiElement placeholder child, but no such impl existed, breaking the lib-test build once the StoredView child_view_ids delegator unblocked compilation. Add a #[cfg(test)] no-op `impl TuiElement for ()` (matching the existing #[cfg(test)] helper convention) and unify tui_view_tests.rs onto it, removing the duplicate `TuiEmpty` placeholder that had missing type imports. Co-Authored-By: Oz <oz-agent@warp.dev>

Description
Adds basic
TuiElements. Not particularly consequential given @kevinyang372 is quickly following up with re-implementation atopratatui.