65 lines
3.7 KiB
Markdown
65 lines
3.7 KiB
Markdown
# 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, borderless inline prompt target, 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. Paint and register splitters after pane content and
|
|
toolbars so neither their appearance nor their hit regions are obscured.
|
|
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. `inline_input` registers a text-input target without a
|
|
background or focus border; a terminal-style host draws its own caret in the same
|
|
scrollable stream as output. `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.
|