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.
ColorRoles
Colour roles; every one optional (None = the shell’s current colour for that role).
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) }).
Palette
A light and a dark set of colour roles — the design’s tokens. See ColorRoles.
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).
Rgba
A colour with alpha (a: 0 = transparent, 255 = opaque).
Segment
One option in a Widget::Segmented control (mirrors Tab). selected marks the active segment; tapping sends on_select.
Shapes
A corner radius per component. sheet_top rounds only the bottom sheet’s top corners (Pill there is capped at 32 — a dome would clip the sheet’s content). button also shapes the confirm dialog’s buttons where the shell draws them (web, Android); iOS uses the system alert.
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.
ShellLabels
Text the shells draw themselves (back buttons, web list controls, dialog/picker defaults), in the app’s language. Set once on the scaffold with with_labels; every field is optional and falls back to the shell’s built-in English. A label passed to a specific call (confirm_with, Picker) still wins over these.
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.
TonePair
A tone’s soft background and its foreground.
TypeScale
The app’s type scale: one optional TypeSpec per text style. title also sets the scaffold’s top-bar title and headline the sheet titles. Sizes are sp/pt/px and still follow the platform’s text-size accessibility setting.
TypeSpec
One style’s size (sp/pt/px), weight (100..=900, rounded to the nearest 100) and font role.

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.
Appearance
How the scaffold picks light or dark. Light/Dark force it; System follows the OS live (the shell switches palette sets itself, no core round-trip). Set with with_appearance.
BoxAlign
ButtonStyle
Button emphasis. Tonal is the quieter filled secondary (M3 filled-tonal).
CardStyle
Dashed: no fill and a dashed outline (“empty, you can fill this”). BREAKING (Moj Termin design release): appended, so exhaustive matches need the case.
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.
FamilyRole
Which synced font a TypeSpec uses under FontFamily::Custom (otherwise the theme’s system font).
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 cross-platform font family. System/Rounded/Serif/Monospace map to each platform’s nearest system font design. Custom = the app’s mobiler.toml [fonts], synced into the shells by the CLI (mobiler fonts sync, also run by build/dev): the display family for titles and subtitles, the body family for the rest; a role without files falls back to the system font. 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.
Radius
A corner radius: Dp(n) (dp/pt/px), or Pill — fully round (half the component’s height), at any density.
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).