Expand description
Stipple’s runtime core.
Defines the declarative View trait, the Element IR that views build,
and the layout + paint passes (render_view) that turn a view into a
Scene ready for stipple-render to rasterize.
§Pipeline
build → layout → paint, with pointer events routed back through the laid-
out tree:
- a
View(or an app build closure with aCx) produces anElementtree, registeringon_taphandlers in the context; layoutturns it into a retainedLayoutNodetree;paintdraws that tree into aScene, andhit_testroutes pointer taps to the registeredHandlers.
Between frames, diff_trees reconciles the previously-presented
LayoutNode tree against the freshly built one to compute the changed
Damage region, so the platform re-presents only what moved rather than
the whole window.
Still ahead (ROADMAP.md Phase 1+): fine-grained per-node state so a rebuild can skip unchanged subtrees entirely, and richer gesture recognition.
Re-exports§
pub use a11y::AccessNode;pub use a11y::Role;pub use a11y::accessibility_tree;pub use runtime::ActionId;pub use runtime::Anchor;pub use runtime::ContextId;pub use runtime::Cx;pub use runtime::DragId;pub use runtime::FocusId;pub use runtime::Handlers;pub use runtime::KeyInput;pub use runtime::LayoutNode;pub use runtime::NodeContent;pub use runtime::OverlaySpec;pub use runtime::ScrollId;pub use runtime::TextPosId;pub use runtime::ViewportEvent;pub use runtime::ViewportId;pub use runtime::collect_focusables;pub use runtime::collect_viewports;pub use runtime::context_at;pub use runtime::drag_at;pub use runtime::find_action;pub use runtime::find_focus;pub use runtime::find_scroll;pub use runtime::find_text_pos;pub use runtime::first_text;pub use runtime::focus_at;pub use runtime::hit_test;pub use runtime::scroll_at;pub use runtime::text_pos_at;pub use runtime::viewport_at;
Modules§
- a11y
- Accessibility tree: a semantic view of the UI for assistive technologies.
- runtime
- The reactive runtime: interaction context, retained layout tree, and event dispatch.
Structs§
- BoxStyle
- The painted decoration of an element’s box: fill, corner radius, border. Applies to any element — a leaf bar, a button, or a container panel.
- Element
- A node in the element tree: layout properties, decoration, an optional interaction handle, and a kind.
- Font
- A loaded, shapeable font face.
- Layout
Style - Layout properties common to every element.
- Size
Override - Fixed-size overrides for an element.
Nonemeans “size to content / fill”.
Enums§
- Align
- Alignment of children along an axis.
- Axis
- A layout axis.
- Damage
- What changed between two frames, in logical pixels.
- Element
Kind - What an element arranges; all kinds share
Element::decoration.
Traits§
- View
- A piece of UI, described declaratively as a function of theme.
Functions§
- apply_
scroll - Apply scroll offsets to a laid-out tree: for each scroll container, clamp its
stored offset to the content overflow and shift its descendants up by that
amount (so the offset is the source of truth, re-applied each frame). Returns
nothing; clamps
offsetsin place so the app keeps valid values. - caret_
index_ at - Resolve a pointer position (logical pixels, absolute) to the nearest caret
byte index within
node’s first text leaf. Theypicks the line and thexthe column within it; returns the boundary whose x is closest. ReturnsNoneifnodehas no text or nofont. - clipboard_
text - The current clipboard text (the in-process mirror).
- diff_
trees - Diff a previously-presented tree against the freshly built one, returning the
damaged region. Pass trees laid out at the same root size; a size change
should be treated as
Damage::Fullby the caller. - layout
- Lay
elout withinbounds, producing a retainedLayoutNodetree with absolute bounds, decorations, text content, and action handles. - measure
- Natural (desired) size of
elgiven theavailspace and activefont. - paint
- Paint a laid-out tree into
scene, parents before children. - paint_
focus - Overlay focus affordances for the focused element: a
ringaround its bounds, aselectionhighlight behind any selected text range, and acaretbar at the text’s caret index (or its end when no caret is set). No-op iffocusedisn’t in the tree. - paint_
hover - Overlay a
highlight(typically translucent) on the hovered tappable element, matching its corner radius. No-op ifhoveredisn’t in the tree. - render_
view - Build
view, lay it out to fillsizelogical pixels, and paint it into a freshScene. Text is rendered withfont(passNoneto skip text). Interaction handles on the elements are ignored (uselayout+hit_testdirectly to route events). - set_
clipboard_ text - Replace the clipboard text (the in-process mirror).