Expand description
mitsuami core: the retained node tree, styles and units, layout, accessibility model, control flow and the backend contract.
See docs/ARCHITECTURE.md for the design.
Re-exports§
pub use a11y::A11yAction;pub use a11y::A11yNode;pub use a11y::A11yProps;pub use a11y::ActionError;pub use a11y::Role;pub use backend::AvailableSpace;pub use backend::Backend;pub use backend::EventSink;pub use backend::Key;pub use backend::MeasureRequest;pub use backend::NativeState;pub use backend::PlatformMetrics;pub use backend::SyntheticInput;pub use backend::TestHooks;pub use command::Command;pub use command::EventValue;pub use command::PointerEvent;pub use command::PointerKind;pub use command::UiEvent;pub use draw::Canvas;pub use draw::Color;pub use draw::DisplayList;pub use draw::Path;pub use draw::Shape;pub use geometry::Point;pub use geometry::Rect;pub use geometry::Size;pub use geometry::WindowSize;pub use style::Align;pub use style::Display;pub use style::FlexDirection;pub use style::GridPlacement;pub use style::Justify;pub use style::Style;pub use style::TextDirection;pub use style::Track;pub use style::repeat;pub use units::Length;pub use units::LengthExt;pub use units::Spacing;pub use mitsuami_reactive as reactive;
Modules§
- a11y
- Accessibility model. Every node carries semantics from day one. The test driver uses the same roles, names and actions as assistive technology.
- backend
- The contract every platform backend implements.
- command
- The data flowing between the core and a backend.
- draw
- The drawn tier of custom widgets: a small, platform-neutral 2D API.
- geometry
- services
- Platform services: clipboard, dialogs and the menu bar.
- style
- Layout style: the CSS flexbox / grid property set, in abstract units.
- task
- Async on the UI thread: a small executor driven by
Ui::tick, timers on a swappable clock, and a bridge for work done on other threads. - units
- Abstract units, resolved to logical units at layout time.
Macros§
- find_
prop - Finds a prop by pattern in a prop list.
Structs§
- Action
- An async operation and its state:
action. - AnyValue
- Any comparable, printable value: custom widget props and events.
- AnyView
- A type-erased
View. - Callback
- A component’s event, Vue’s
emit:on_change: Callback<f32>in a#[component]is set with@change=…and fired withon_change.call(v). The default does nothing. - Composed
- What a composed render gets: the props (reactive), a way to emit the widget’s events, and the accessible label the app gave the widget.
- Custom
- A custom widget in the view tree:
Custom::<Rating>::new(props), orRating::view(props)throughCustomView. - Custom
Props - The props of a custom widget, as carried by
Prop::Custom: the value plus the widget’s type-erased definition (semantics and renders). - Element
- A node description: kind, style, props (static or reactive), handlers,
semantics and children. Widgets wrap an
Elementand add typed methods. - For
- Keyed list rendering. Vue’s
v-forwith:key. - NodeId
- Stable identity of a node for the lifetime of a
Ui. - Node
Info - Snapshot of one native node, for inspection tools and tests.
- Opaque
- A platform-specific payload the core passes through without looking inside: a native render, a native view factory. Equal only to itself; printed as its label.
- Renderer
- A widget’s renders on the current platform: native, drawn or composed.
The first one present is used: native, then drawn, then composed. The
others stay available (for headless tests,
.drawn(),.composed()). - Resource
- Data loaded asynchronously:
resourceorresource_on. - Show
- Renders
thenwhilewhenis true, otherwise the optional fallback. Vue’sv-if/v-else. Switching branches disposes the old branch’s nodes and reactive state. - Slot
- The children a component receives: what goes between its tags. Pass it
on as children (
Column::new().children(children)); it builds once. - Ui
- Handle to a UI instance: one backend, its windows and their node trees. Cheap to clone; all clones share the same state.
- WeakUi
- Non-owning
Uihandle, for closures stored inside the tree itself.
Enums§
- Button
Variant - Semantic button variants, mapped to each platform’s native styles.
- Prop
- A property of a native widget. Which ones apply depends on the kind.
- Scroll
Axes - Scrolling directions of a
ScrollView. - Text
Style - Semantic text styles, mapped to each platform’s type ramp.
- Widget
Kind
Traits§
- Children
- Anything that can be a list of children: a view, a tuple of views, a
Vec, anOption, or(). - Custom
View Rating::view(props): shorthand forCustom::<Rating>::new(props).- Custom
Widget - The shared, platform-free definition of a custom widget.
- Drawn
- The drawn tier: measured, drawn and hit-tested in shared code.
- Element
Builder - Style, semantics and test hooks shared by every widget builder.
- Render
- Which render this platform uses. Implement it once, choosing per
platform with
platform!: - Store
- App-wide state, created once per app by
use_store. - View
- Something that can build itself into the node tree.
Functions§
- action
- Wraps
runso eachdispatchruns it as a task, tracking whether any ispendingand keeping thevalueof the latest one. - provide_
stores - Makes
use_storework in the current scope and below: the stores live as long as it.AppandTestAppcall it in their app scope. - resource
- Loads
fetch()now; again onResource::refetch. - resource_
on - Loads
fetch(source())now, and again whenever the signalssourcereads change. Vue’swatchplus a fetch; the future’s own reads aren’t tracked. - use_
store - The app’s instance of store
S, created on first use; or the oneprovided nearest to this scope, if any.