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
Widgettree (theViewModel). - The shell sends back an
Action(theEvent). - 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.urlpoints at a WebVTT (.vtt) file,languageis a BCP-47 tag (e.g."en"),labelis the human-readable menu entry, anddefault_onselects 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). - Chart
Bracket - A right-side bracket annotation spanning
[y0, y1]with alabelnote (e.g. a ceiling band). - Chart
Legend Item - One legend entry (swatch + name) for a
Widget::RegionChart. - Chart
RefLine - A horizontal reference line across a
Widget::RegionChartatvalue, with a right-edgelabelchip.dasheddraws it dashed (e.g. a “max insured” ceiling) vs solid (a target). - Chart
Region - One rectangle in a
Widget::RegionChart, spanning[x0, x1]horizontally and[y0, y1]vertically in the chart’s domain.labelis centered inside (empty = none);verticalrotates it 90° for narrow columns.coloroverrides the auto-assigned palette slot. - Chart
Series - One named data series in a
Widget::Chart. Cartesian styles plotvaluesacross the chart’s x-axislabels; circular styles (pie/donut/rings/gauge) collapse the series to a single magnitude (valuessummed).coloroverrides the auto-assigned palette slot;goalis the denominator forRings/Gaugeprogress (ignored by the other styles). - Chart
Tick - An x-axis tick on a
Widget::RegionChartat domain positionat, labelledlabel. Ticks are irregular (the app places them), so shells position them by fraction, not even spacing. - Color
Roles - 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.idis 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::Segmentedcontrol (mirrorsTab).selectedmarks the active segment; tapping sendson_select. - Shapes
- A corner radius per component.
sheet_toprounds only the bottom sheet’s top corners (Pillthere is capped at 32 — a dome would clip the sheet’s content).buttonalso 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 sendson_dismiss. - Shell
Labels - 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. - Swipe
Button - One revealed action in a
SwipeActionrow (swipe to reveal, tap to fire). - Tab
- A bottom-navigation tab.
selectedmarks the active one; tapping sendson_select.icon(optional) renders above the label for an icon tab bar. - TabBadge
- A tab’s badge (ADR-0050). Both strings are finished by the core: the shells draw
textas-is and add no words. - Theme
- App branding as data — the visual twin of
dark_mode. Set on aWidget::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. - Tone
Pair - A tone’s soft background and its foreground.
- Type
Scale - The app’s type scale: one optional
TypeSpecper text style.titlealso sets the scaffold’s top-bar title andheadlinethe sheet titles. Sizes are sp/pt/px and still follow the platform’s text-size accessibility setting. - Type
Spec - One style’s size (sp/pt/px), weight (100..=900, rounded to the nearest 100) and font role.
Enums§
- A11y
Role - 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/Darkforce it;Systemfollows the OS live (the shell switches palette sets itself, no core round-trip). Set withwith_appearance. - BoxAlign
- Button
Style - Button emphasis.
Tonalis the quieter filled secondary (M3 filled-tonal). - Card
Style Dashed: no fill and a dashed outline (“empty, you can fill this”). BREAKING (Moj Termin design release): appended, so exhaustive matches need the case.- Chart
Style - How a
Chartdraws its series. - Corner
- Global corner-radius scale.
Medium≈ the current (un-themed) look. - Density
- Global density.
Comfortable≈ the current (un-themed) look;Compacttightens spacing.Largeis 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. - Family
Role - Which synced font a
TypeSpecuses underFontFamily::Custom(otherwise the theme’s system font). - Field
Kind - What a
Widget::TextFieldaccepts — selects the on-screen keyboard, secure (masked) entry, and single- vs multi-line layout in one axis. - Font
Family - A cross-platform font family.
System/Rounded/Serif/Monospacemap to each platform’s nearest system font design.Custom= the app’smobiler.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.
- Image
Ratio - Image
Shape - Input
Value - A value produced by an input widget at runtime.
- Project
Color - Project-identity colors (distinct from semantic
Tone). Concrete RGB decided in the render layer. - Radius
- A corner radius:
Dp(n)(dp/pt/px), orPill— fully round (half the component’s height), at any density. - Spacing
- Text
Style - Tone
- Semantic status color (distinct from brand/identity color).
- Widget
- The app-agnostic widget tree the shell renders. Fixed across all apps.
Type Aliases§
- Action
Token - An opaque, serialized app event (e.g. JSON of the app’s domain action).