Skip to main content

Crate mobiler_ui

Crate mobiler_ui 

Source
Expand description

Mobiler’s fixed UI wire ABI.

These types are the stable contract between any Mobiler app’s Rust core and the native shell. Because they never change per app, a single shell is built once and renders any Mobiler app — the shell only ever knows these types, never an app’s domain events or widgets.

  • The core emits a Widget tree (the ViewModel).
  • The shell sends back an Action (the Event).
  • App domain events ride inside actions as opaque ActionTokens that the shell round-trips without interpreting.

Style is expressed as intent tokens (e.g. TextStyle, Tone); the shell maps each to a concrete look (font, color, dp), so dark mode and theme come for free on the native side.

Structs§

Caption
One subtitle/caption track for a Widget::Video. url points at a WebVTT (.vtt) file, language is a BCP-47 tag (e.g. "en"), label is the human-readable menu entry, and default_on selects it by default. Sidecar tracks work on web (<track>) and Android (Media3 subtitle configuration); on iOS only captions already embedded in an HLS manifest are selectable (AVPlayer can’t attach a sidecar VTT to an MP4 — a documented v1 gap).
ChartBracket
A right-side bracket annotation spanning [y0, y1] with a label note (e.g. a ceiling band).
ChartLegendItem
One legend entry (swatch + name) for a Widget::RegionChart.
ChartRefLine
A horizontal reference line across a Widget::RegionChart at value, with a right-edge label chip. dashed draws it dashed (e.g. a “max insured” ceiling) vs solid (a target).
ChartRegion
One rectangle in a Widget::RegionChart, spanning [x0, x1] horizontally and [y0, y1] vertically in the chart’s domain. label is centered inside (empty = none); vertical rotates it 90° for narrow columns. color overrides the auto-assigned palette slot.
ChartSeries
One named data series in a Widget::Chart. Cartesian styles plot values across the chart’s x-axis labels; circular styles (pie/donut/rings/gauge) collapse the series to a single magnitude (values summed). color overrides the auto-assigned palette slot; goal is the denominator for Rings/Gauge progress (ignored by the other styles).
ChartTick
An x-axis tick on a Widget::RegionChart at domain position at, labelled label. Ticks are irregular (the app places them), so shells position them by fraction, not even spacing.
Fab
A floating action button anchored over the scaffold body (the raised primary action).
MapMarker
A pin on a Widget::Map. id is echoed back when the marker is tapped (Action::Input { id: "{map_id}.marker", value: Text(marker.id) }).
Rgb
A 24-bit RGB color. Used for a theme’s brand/seed color — the one place an app supplies an arbitrary color (everything else is intent tokens).
Segment
One option in a Widget::Segmented control (mirrors Tab). selected marks the active segment; tapping sends on_select.
Sheet
A modal bottom sheet anchored over the scaffold body (a scrim behind, a panel rising from the bottom). Present (Some) ⇒ open; tapping the scrim/handle sends on_dismiss.
SwipeButton
One revealed action in a SwipeAction row (swipe to reveal, tap to fire).
Tab
A bottom-navigation tab. selected marks the active one; tapping sends on_select. icon (optional) renders above the label for an icon tab bar.
Theme
App branding as data — the visual twin of dark_mode. Set on a Widget::Scaffold (theme: None = the framework defaults, i.e. no visual change). The shell maps these to its native theming: seed → the brand/primary color (Android M3 scheme / iOS tint / web --primary), plus a global corner, spacing, and font choice.

Enums§

A11yRole
Accessibility role for Widget::A11y — the control type announced to a screen reader. Maps best-effort per platform: iOS accessibility traits, Android semantics role / heading(), web ARIA role.
Action
What the shell sends back to the core. Fixed across all apps.
BoxAlign
ButtonStyle
Button emphasis. Tonal is the quieter filled secondary (M3 filled-tonal).
CardStyle
ChartStyle
How a Chart draws its series.
Corner
Global corner-radius scale. Medium ≈ the current (un-themed) look.
Density
Global density. Comfortable ≈ the current (un-themed) look; Compact tightens spacing. Large is for hurried / wet / gloved hands: bigger controls (56 buttons & segmented, 48 chips & calendar days, 56 icon-button targets), 16 control labels, ≥ 12 between adjacent tappables. Body text stays on the platform’s font-scale setting.
FieldKind
What a Widget::TextField accepts — selects the on-screen keyboard, secure (masked) entry, and single- vs multi-line layout in one axis.
FontFamily
A finite, cross-platform font family (maps to each platform’s nearest system font design — no bundled font files). System ≈ the current look.
Icon
A finite icon set (maps to Material icons / SF Symbols / web glyphs per shell). Grouped: editing, navigation/chrome, content, and domain icons.
ImageRatio
ImageShape
InputValue
A value produced by an input widget at runtime.
ProjectColor
Project-identity colors (distinct from semantic Tone). Concrete RGB decided in the render layer.
Spacing
TextStyle
Tone
Semantic status color (distinct from brand/identity color).
Widget
The app-agnostic widget tree the shell renders. Fixed across all apps.

Type Aliases§

ActionToken
An opaque, serialized app event (e.g. JSON of the app’s domain action).