Expand description
oino-ui — wire types and the ratatui-mirroring builder for the Oino
extension UI protocol v2 (docs/dev/v2/specs/ui-protocol.md).
This crate is the single serde-only definition of the protocol: node trees
(§4), the entry registry envelopes (§6.1, §9.2), patch ops (§4.7), validation
limits and the OUS v1 gate (§4.8), the plain-text fallback (§10) and — behind
the schema feature — the normative JSON Schema (Appendix A). It builds for
wasm32-wasip2 (deps: serde, serde_json only, §11).
use oino_ui::prelude::*;
let list = List::new(["first", "second"])
.highlight_symbol("› ")
.on_activate("open");
let node: Node = Layout::vertical([Constraint::Length(1), Constraint::Fill(1)])
.children([Paragraph::new("Tasks").into(), list.into()])
.into();
let json = serde_json::to_value(&node).unwrap_or_default();
assert_eq!(json["t"], "Layout");Re-exports§
pub use layout::Constraint;pub use layout::Direction;pub use layout::Flex;pub use layout::Layout;pub use layout::Margin;pub use node::ActionId;pub use node::Common;pub use node::IntoNode;pub use node::Key;pub use node::Node;pub use node::Unknown;pub use node::WithCommon;pub use style::Color;pub use style::Modifier;pub use style::Modifiers;pub use style::Style;pub use style::Stylize;pub use text::Alignment;pub use text::Line;pub use text::Span;pub use text::Text;
Modules§
- extras
- GUI-extra nodes (§4.5.2): DIRECTION §5’s list of nodes ratatui has no equivalent for.
- layout
- Layout node (§4.3):
Layout,Direction,Constraint,FlexandMargin. - limits
- Limits and validation (§4.8). Core runs
validateon every producer call (≤ 1 ms for a 256 KiB tree): limits, duplicate sibling keys, action-id syntax, the v1 gate, with soft diagnostics for unknown colour tokens. - node
- The
Nodeenum (§4.1): one variant per node kind, serde tag"t", common props and the tolerantUnknowncatch-all. - patch
- Patch ops (§4.7): the
NodeOpwire types plus the referencediff/applypair (apply(old, diff(old, new)) == new, §4.7). - plain
- Plain-text fallback (§10):
to_lines(node, width)renders a tree for clients without a v2 renderer. Char-count based wrapping (nounicode-widthdependency — this crate stays serde-only per §11); wide chars may render slightly narrow. - prelude
- Everything an extension author usually wants (§11): node kinds, the prelude
types and the
Stylizehelpers. - settings
- Settings schema dialect OSS-2 (§7) — wire types and semantics.
- slot
- Placements, slots and the entry registry wire types (§6.1, §9.2, §4.6).
- style
- Colour tokens (§5), modifiers and
Styleplus the ratatui-mirroringStylizetrait. - text
- ratatui text model (§4.2):
Span,Line,TextandAlignment. - widgets
- ratatui widget nodes (§4.5.1).