Skip to main content

Crate stipple_core

Crate stipple_core 

Source
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:

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.
LayoutStyle
Layout properties common to every element.
SizeOverride
Fixed-size overrides for an element. None means “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.
ElementKind
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 offsets in 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. The y picks the line and the x the column within it; returns the boundary whose x is closest. Returns None if node has no text or no font.
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::Full by the caller.
layout
Lay el out within bounds, producing a retained LayoutNode tree with absolute bounds, decorations, text content, and action handles.
measure
Natural (desired) size of el given the avail space and active font.
paint
Paint a laid-out tree into scene, parents before children.
paint_focus
Overlay focus affordances for the focused element: a ring around its bounds, a selection highlight behind any selected text range, and a caret bar at the text’s caret index (or its end when no caret is set). No-op if focused isn’t in the tree.
paint_hover
Overlay a highlight (typically translucent) on the hovered tappable element, matching its corner radius. No-op if hovered isn’t in the tree.
render_view
Build view, lay it out to fill size logical pixels, and paint it into a fresh Scene. Text is rendered with font (pass None to skip text). Interaction handles on the elements are ignored (use layout + hit_test directly to route events).
set_clipboard_text
Replace the clipboard text (the in-process mirror).