Skip to content

warpui_core: TUI element library (text, column, container, child_view, event_handler)#12634

Open
zachbai wants to merge 4 commits into
masterfrom
zb/tui-backend/03b-tui-elements
Open

warpui_core: TUI element library (text, column, container, child_view, event_handler)#12634
zachbai wants to merge 4 commits into
masterfrom
zb/tui-backend/03b-tui-elements

Conversation

@zachbai

@zachbai zachbai commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Description

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

zachbai commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

@zachbai zachbai changed the base branch from zb/tui-backend/03a-tui-seam to graphite-base/12634 June 15, 2026 07:25
@zachbai zachbai force-pushed the graphite-base/12634 branch from e30ebf4 to f85df3c Compare June 15, 2026 07:25
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from a096d97 to d2989fd Compare June 15, 2026 07:25
@zachbai zachbai changed the base branch from graphite-base/12634 to zb/tui-backend/03a-tui-seam June 15, 2026 07:25
@zachbai zachbai changed the base branch from zb/tui-backend/03a-tui-seam to graphite-base/12634 June 15, 2026 19:58
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from d2989fd to 33719f7 Compare June 15, 2026 19:59
@zachbai zachbai force-pushed the graphite-base/12634 branch from f85df3c to f02f2af Compare June 15, 2026 19:59
@zachbai zachbai changed the base branch from graphite-base/12634 to zb/tui-backend/03a-tui-seam June 15, 2026 19:59
@zachbai zachbai changed the base branch from zb/tui-backend/03a-tui-seam to graphite-base/12634 June 15, 2026 21:45
@zachbai zachbai force-pushed the graphite-base/12634 branch from f02f2af to 73c3649 Compare June 15, 2026 21:45
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 33719f7 to dbe7255 Compare June 15, 2026 21:45
@zachbai zachbai changed the base branch from graphite-base/12634 to zb/tui-backend/03a-tui-seam June 15, 2026 21:45
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from 73c3649 to c459ffb Compare June 15, 2026 22:42
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from dbe7255 to 7402b63 Compare June 15, 2026 22:42
@zachbai zachbai changed the base branch from zb/tui-backend/03a-tui-seam to graphite-base/12634 June 15, 2026 22:51
@zachbai zachbai force-pushed the graphite-base/12634 branch from c459ffb to 878719b Compare June 15, 2026 22:51
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 7402b63 to 2b8f634 Compare June 15, 2026 22:51
@zachbai zachbai changed the base branch from graphite-base/12634 to zb/tui-backend/03a-tui-seam June 15, 2026 22:51
@zachbai zachbai changed the base branch from zb/tui-backend/03a-tui-seam to graphite-base/12634 June 15, 2026 23:59
@zachbai zachbai force-pushed the graphite-base/12634 branch from 878719b to b0ddbff Compare June 15, 2026 23:59
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 2b8f634 to 6f914f0 Compare June 15, 2026 23:59
@zachbai zachbai changed the base branch from graphite-base/12634 to zb/tui-backend/03a-tui-seam June 15, 2026 23:59
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from b0ddbff to 4d98812 Compare June 16, 2026 21:02
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 6f914f0 to 8f0d783 Compare June 16, 2026 21:02
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from 4d98812 to 4cfc5f6 Compare June 17, 2026 23:04
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch 2 times, most recently from 14b05a4 to 0dbf678 Compare June 17, 2026 23:21
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from 4cfc5f6 to 898f32e Compare June 17, 2026 23:21
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 0dbf678 to 53736a1 Compare June 17, 2026 23:59
zachbai added a commit that referenced this pull request Jun 18, 2026
…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>
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 53736a1 to eaa0508 Compare June 18, 2026 00:26
@zachbai zachbai force-pushed the zb/tui-backend/03a-tui-seam branch from 5712979 to 54d124c Compare June 18, 2026 00:26
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from eaa0508 to 01cd3c6 Compare June 18, 2026 00:53
@kevinyang372 kevinyang372 mentioned this pull request Jun 18, 2026
4 tasks
zachbai added a commit that referenced this pull request Jun 19, 2026
## 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>
Base automatically changed from zb/tui-backend/03a-tui-seam to master June 19, 2026 23:56
…, 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>
@zachbai zachbai force-pushed the zb/tui-backend/03b-tui-elements branch from 01cd3c6 to a09fa6e Compare June 19, 2026 23:57
@zachbai zachbai requested a review from kevinyang372 June 19, 2026 23:57
@zachbai zachbai marked this pull request as ready for review June 19, 2026 23:57
@oz-for-oss

oz-for-oss Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

@zachbai

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.rs appears to be added without a matching #[cfg(test)] module include in mod.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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 [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)].

Suggested change
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants