Skip to main content

Crate termwright_ratatui

Crate termwright_ratatui 

Source
Expand description

Author intent for custom Ratatui widgets, without replacing their render.

Annotated implements Ratatui’s ordinary Widget and StatefulWidget traits and delegates to the wrapped widget exactly once. The zero-config build probe still owns geometry, frame boundaries, collection state and occlusion. This crate can add role, name, description, test id, application-domain JSON, descriptive actions, relationships and an explicit stable semantic key.

use ratatui::{buffer::Buffer, layout::Rect, widgets::Widget};
use termwright_ratatui::{Action, Annotate, Role, Semantics};

struct Deploy;
impl Widget for Deploy {
    fn render(self, area: Rect, buffer: &mut Buffer) {
        "Deploy".render(area, buffer);
    }
}

let widget = Deploy.annotated(
    Semantics::new()
        .role(Role::Button)
        .name("Deploy")
        .test_id("deploy-release")
        .semantic_key("deployment-control")
        .action(Action::Activate)
        .domain("deploymentStatus", "ready"),
);
widget.render(area, &mut buffer);

Macros§

json
Construct a serde_json::Value from a JSON literal.

Structs§

Annotated
A widget paired with author intent.
EvidenceContext
Immutable coordinates identifying the provider observation being requested.
EvidenceRegistration
Handle whose disposal marks a negotiated provider as lost.
PointerEvidenceObservation
Exact production pointer-router facts returned for one revision.
ProviderPointerRegion
Pointer-only application region; never layout or clipping geometry.
ProviderPointerSpan
One canonical half-open pointer row run.
ProviderRect
Zero-based viewport cell rectangle.
Semantics
Author intent attached to one immediate-mode render call.

Enums§

Action
A descriptive capability hint: a diagnostic, never a callback endpoint.
EvidenceMethod
Method used to produce a known observation.
Role
A semantic role. ARIA-aligned and closed: unknown roles fail validation.
Value
Represents any valid JSON value.

Constants§

RATATUI_VERSION
Exact Ratatui release whose traits this SDK implements.

Traits§

Annotate
Extension trait for idiomatic widget.annotated(semantics) construction.
PointerEvidenceProvider
Closed application provider family for production pointer evidence.

Functions§

register_pointer_evidence_provider
Register a production evidence provider in the process-wide registry.

Type Aliases§

PointerHitTest
Thread-safe production pointer hit-test in (column, row) order.