feat: add system widgets and a persistent native Console with bare assignments
Verify Tessera GUI / verify (push) Failing after 7m17s

This commit is contained in:
2026-10-20 18:36:48 +08:00
parent 1d4b1d3c86
commit 53e8d7b287
15 changed files with 1549 additions and 245 deletions
+60
View File
@@ -0,0 +1,60 @@
# Tessera System UI
An internal Rust widget library for Tessera's own management windows and developer
tools. It is independent of Endor's `ui` global, `UiNode`, AST and VM. Guest scripts
cannot construct or control these management widgets. Only geometry, font shaping
and display-list rendering are shared with the page renderer.
## Modules
- `interaction.rs`: stable semantic widget IDs, hit testing, pointer capture,
release-inside activation, drag-out cancellation, keyboard focus traversal,
Enter/Space activation, disabled controls and cursor roles.
- `theme.rs`: neutral/error/success colors, accent presets, readable custom accents
and shared idle/hover/pressed/selected colors.
- `widgets.rs`: button, tab, toggle, text field chrome, selectable row, color swatch,
splitter and scrollbar thumb. Text is clipped to its widget bounds. Hover, pressed,
selection, keyboard focus and disabled states compose consistently.
- `mod.rs`: public interface used by management surfaces.
## Frame contract
All widget coordinates are logical pixels. Build a `Ui<Action>` from the current
`Theme` and a clone of retained `Interaction`. Actions are host-defined, `Hash`able
values; IDs come from semantic action keys, never screen coordinates or changing
labels. Explicit decoration IDs are scoped by widget kind and region.
```rust,ignore
let mut ui = Ui::new(Theme::new(accent), interaction.clone());
ui.button(bounds, Action::Refresh,
Button::new("Refresh").enabled(can_refresh));
ui.button(tab_bounds, Action::SelectTab(Tab::Sources),
Button::new("Sources").role(Role::Tab).selected(is_sources));
ui.text_field(input_bounds, Action::FocusEditor, editor_focused);
```
Store `ui.targets` with the newly produced layout and render `ui.list` through the
native display-list backend. Reconcile retained interaction against the new targets;
request one more redraw when a target moves, disappears or changes enabled state.
This settles hover under a stationary pointer after a layout change without a timer
or continuous rendering loop. Preserve clipping and scale every primitive, including
focus outlines, when converting logical coordinates to physical pixels.
Dispatch pointer movement, press and release to `Interaction`. Press establishes
capture; a button action is returned only when released inside the same enabled
widget. Text fields focus on press, while drag handles perform host-side resizing
or scrolling during capture. Pointer exit clears hover, focus loss cancels all
capture, and disabled targets block click-through to controls behind them.
Tab / Shift-Tab traverse enabled controls; Enter / Space activate a focused button
on key release. The host's editor keeps plain Tab for indentation and Shift-Tab for
leaving the editor. Rows and drag handles are excluded from Tab traversal. Text
editing, clipboard and IME remain host adapters; the widget layer owns their chrome
and focus presentation. `src/clipboard.rs` guarantees UTF-8 for macOS clipboard
subprocesses, independent of Finder's locale.
Tessera's developer tools are the first consumer. Domain actions, HTTP calls,
source navigation and Console execution remain in `developer_tools.rs`; none of
those concepts enter this library. The library currently renders synchronously
with immediate state feedback; it is not an Endor component implementation, an
OS accessibility bridge or a separately published Cargo crate.