ui_app

module ui_appsource

The app services of pkg::alloy::ui (REFOCUS.md, R6e, question 9A): screens and history, numbers moving, dates in the locale, forms, requests, storage, file dialogs and drops, on the core's widgets and ui_controls'.

import pkg::alloy::ui;
import pkg::alloy::ui_app;

fn main() -> i32 {
    return app(&WindowConfig { .title = &"Notes", .app = &"notes" }, (ui) => {
        const notes = ui.persisted(&"notes", String::empty(), Write::text(), Read::text());
        return ui.add(Text { .text = copy notes.get(&ui) });
    });
}

Each keeps its state as an extension of the Ui (Extension), installed as it is first used, so a program not using one carries none of its code.

## How it was built

**R6f as built** (2026-10-26; REFOCUS.md, the portal and drops under ui_app): Files calls the window's install_files as it first gives the window something, so the portal's file chooser, the shell's dialogs, NSOpenPanel and the drop targets are linked only into programs asking for a dialog or laying out a DropArea; on Linux the settings portal's wish for less motion comes with them (or with pkg::alloy::ui_access), else reads as off.

**R6e as built** (2026-10-26): moved out of ui, whose notes of F11c, F11d, F11e, F12c, F12d, F12e and F13 tell how each was first built, with their notes here: screens.alloy (Navigator, ui.screens, the window's history, screens pushed and popped moving), animations.alloy (ui.animated), dates.alloy (Calendar, DatePicker, TimePicker, ui.today(), ui.locale() with CLDR's tables), forms.alloy, network.alloy (ui.send, ui.load), persisted.alloy (ui.store(), ui.persisted), files.alloy (ui.open_files, save_file, save_bytes, DropArea). Hooks became extensions: Navigation (Back, Alt+Left, Event::Navigated, the window's history as it is shown), Animations, Dates, Forms (a field's focus left), Requests (an owner going, the network's deadline, busy nodes, the page's inbox), KeptState (the store written after each event and as the window closes), Files (dialogs' results, drags and drops). The network's tasks run as the core's Service, started by the first request in the scope app gives its workers. on_drop on Column, Row and Stack became the DropArea widget, and ReplayConfig.responses the replay taking them.

**F11c as built** (2026-10-15; decisions/F11.md, "Screens", questions 5A and 6B), the part ui_app holds since R6e:

**F11d as built** (2026-10-15; decisions/F11.md, "Dates and times", questions 8A, 9A and 10A):

**F11e as built** (2026-10-15; decisions/F11.md, "Motion", questions 11A, 12A and 13A), the part ui_app holds since R6e:

**F12c as built** (2026-10-16; decisions/F12.md, "Waiting in ui", questions 4A, 7A and 8C):

**F12d as built** (2026-10-16; decisions/F12.md, "Storage", question 9A):

**F12e as built** (2026-10-16; decisions/F12.md, "Dates in the world", questions 10A-14A; std::time's zones and std::locale's notes have the rest):

**F13 as built** (2026-10-17; decisions/F13.md, decided as recommended, 1A-5A, 6B, 7A-10A; questions 11-13 then decided A):

fn replaysource

exp fn replay(
    config: &WindowConfig,
    options: ReplayConfig,
    responses: Vector<ScriptedResponse>,
    view: |=| (&var Ui) -> Element,
    events: &[Event]
) -> Replayed

Replays the app as replay does, every request answered from the responses, none by the network.

fn open_filessource

exp fn open_files(self ui: &var Ui, dialog: FileDialog, then: |=| (&var Ui, Vector<ChosenFile>))

Shows a dialog choosing files to open, then calls then with them, unless it was cancelled. On the web each file comes with its bytes.

fn save_filesource

exp fn save_file(self ui: &var Ui, dialog: FileDialog, then: |=| (&var Ui, ChosenFile))

Shows a dialog choosing where to save, then calls then with the file, unless it was cancelled; save_bytes writes it.

fn save_bytessource

exp fn save_bytes(self ui: &var Ui, file: &ChosenFile, bytes: &[u8]) -> bool

Writes the bytes into a file save_file gave (Window::save_bytes); whether it was written, or given to the page to write.

type DropAreasource

exp type DropArea : Widget = struct

Its children laid out as a stack's, taking files or text dropped on it, which on_drop is given at their point in its coordinates; while something dragged over the window would drop on it, it shows so.

Fields

exp children: &[Element] = &[]
exp on_drop: |=| (&var Ui, &Drop)
exp padding: Padding = Padding {}
exp align: Alignment = Alignment::Start
exp background: Ink = Ink::None
exp border: Ink = Ink::None
exp radius: f32 = 0.0
exp sizing: Sizing = Sizing {}

type Loadingsource

exp type Loading<T> = enum

What a resource load keeps holds now.

Variants

Waiting: Progress

the exchange under way, or none asked for

Done: T
Failed: Failure

type Failuresource

exp type Failure : Format = enum

Why a resource or a request failed.

Variants

Network: HttpError

nothing usable came back

Status: Response

the server answered, not with 2xx

Unreadable: String

the answer came, but read refused it: why

Functions

fn formatsource

exp fn format(self failure: &Failure, out: &var String)

The reason, as a sentence goes on after "failed: ".

type Stagesource

exp type Stage = enum

A Loading's variant alone: a key for switch.

Variants

Waiting
Done
Failed

type LoadOptionssource

exp type LoadOptions = struct

Fields

exp delay: Duration = Duration::from_nanoseconds(0)

wait this long after the request last changed: a search asked for as one stops typing

exp keep: bool = true

keep the last Done value readable while the next loads

exp owner: Option<Owner> = ::None

what the resource belongs to, going with it: None, what is made now

type Resourcesource

exp type Resource<T> = struct

Data a request gives, read into the program's type, in a signal (load).

Functions

type Pendingsource

exp type Pending = struct

A request send sent, until what came back is handled.

type ScriptedResponsesource

exp type ScriptedResponse = struct

A response replay gives a request for the URL, at the script's time; each answers one request, those for one URL in order. Until then the exchange's progress goes evenly from nothing to the body's length.

Fields

exp url: String
exp at: Duration
exp answer: std_result::Result<Response, HttpError>

Functions

fn ScriptedResponse::answeredsource

exp fn ScriptedResponse::answered(
    url: &[u8],
    at: Duration,
    status: u16,
    body: &[u8]
) -> ScriptedResponse

A response of the status and the body, at the time.

fn ScriptedResponse::failedsource

exp fn ScriptedResponse::failed(url: &[u8], at: Duration, error: HttpError) -> ScriptedResponse

The request failing at the time.

fn loadsource

exp fn load<T>(
    self ui: &var Ui,
    request: |=| (&Ui) -> Option<Request>,
    read: |=| (&Response) -> std_result::Result<T, String>,
    options: LoadOptions
) -> Resource<T>

The data the request gives, read by read, kept in a signal. The request function is a binding, run again when a signal it read changes, which cancels the exchange under way and starts the new one (after delay; the first starts at once); None leaves the resource waiting for nothing. Natively read runs with the exchange, off the UI thread. The exchange is cancelled when the owner goes.

const shows = ui.load(
    (ui) => ::Some(Request::get(&f"{API}/shows?q={encoded(&search.get(&ui).view())}".view())),
    (response) => read_shows(&response),
    LoadOptions { .delay = Duration::from_milliseconds(300) },
);
ui.switch((ui) => shows.stage(&ui), (ui, stage) => match (stage) { ... }, Keep::None);

fn statesource

exp fn state<T>(self r: &Resource<T>, ui: &Ui) -> &Loading<T>

What the resource holds now; read in a binding, which runs again when it changes.

fn stagesource

exp fn stage<T>(self r: &Resource<T>, ui: &Ui) -> Stage

Whether it waits, is done or failed: a key for switch, which changes only between those.

fn latestsource

exp fn latest<T>(self r: &Resource<T>, ui: &Ui) -> Option<&T>

The last Done value, kept while the next loads unless keep is false.

fn reloadsource

exp fn reload<T>(self r: &Resource<T>, ui: &var Ui)

Asks for the request again now, the exchange under way cancelled: "Try again", or pulling to refresh. A failure then is announced.

fn sendsource

exp fn send(
    self ui: &var Ui,
    request: Request,
    then: |=| (&var Ui, std_result::Result<Response, HttpError>)
) -> Pending

Sends the request; then runs as a handler with what came back. The exchange belongs to the owner of the element whose handler sent it and is cancelled when the owner goes (then then never runs). A failure, the request's or the server's, is announced.

fn sendsource

exp fn send(
    self ui: &var Ui,
    request: Request,
    then: |=| (&var Ui, std_result::Result<Response, HttpError>),
    options: HandlerOptions
) -> Pending

send with the options: a request belonging to their owner, as a payment whose answer counts after its screen went.

fn cancel_requestsource

exp fn cancel_request(self ui: &var Ui, pending: Pending)

Cancels the request: then never runs. Nothing once it finished.

fn progresssource

exp fn progress(self ui: &Ui, pending: Pending) -> Option<Progress>

How far the request has gone; None once it finished. Read in a binding, which runs again as more arrives, at most every 100 ms.

fn storesource

exp fn store(self ui: &var Ui) -> &var KeptStore

The app's store, named "app" under the app's name (WindowConfig.app, else its title), opened the first time it is asked for (std::storage). What a handler sets in it is written back once the event is handled, at most once a second, natively on a worker, and as the app ends; on the web each set reaches the page's localStorage at once. A Ui made on its own keeps it in memory.

fn persistedsource

exp fn persisted<T>(
    self ui: &var Ui,
    key: &[u8],
    initial: T,
    write: |=| (&T) -> Json,
    read: |=| (&Json) -> Option<T>
) -> Signal<T>

A signal holding what the app's store keeps under the key, read by read as the signal is made, and written back by write each time it changes. initial is its value when nothing is saved under the key or read refuses what is.

const dark = ui.persisted(&"dark", false, (on) => Json::bool(on), (j) => j.as_bool());

type Calendarsource

exp type Calendar : Widget = struct

A month as a grid of its days in weeks from first_weekday (the Ui's locale's unless set), the month and year above it in the locale's names between buttons going to the months before and after. One Tab stop: Left and Right move a day, Up and Down a week, Page Up and Page Down a month (with Shift a year), Home and End to the week's ends, the month following the focused day; Enter, Space or a click choose. The chosen day is filled in the primary color, today has a ring, days outside earliest and latest are muted and those available refuses struck through, neither chosen. To a screen reader a grid of days described by its month, announced as it changes.

Fields

exp date: Option<Date> = ::None

the chosen day

exp earliest: Option<Date> = ::None
exp latest: Option<Date> = ::None
exp available: |=| (&Date) -> bool = (d) => true
exp first_weekday: Option<Weekday> = ::None

the locale's

exp accessible: String = String::empty()
exp on_change: |=| (&var Ui, Date) = (ui, d) {}
exp enabled: bool = true
exp sizing: Sizing = Sizing {}

type DatePickersource

exp type DatePicker : Widget + Popup = struct

A field showing the chosen day as format writes it (the Ui's locale's medium date by default, "15 Oct 2026" in en-GB) or the placeholder, and a chevron, opening a Calendar of the same options in a popup below it by a click, Space, Enter or Down; choosing a day or Escape closes it. To a screen reader a button whose value is the day shown, expanded while the calendar is open.

Fields

exp date: Option<Date> = ::None
exp earliest: Option<Date> = ::None
exp latest: Option<Date> = ::None
exp available: |=| (&Date) -> bool = (d) => true
exp first_weekday: Option<Weekday> = ::None

the locale's

exp placeholder: String = String::empty()
exp accessible: String = String::empty()
exp format: Option<|=| (&Date) -> String> = ::None

the locale's

exp on_change: |=| (&var Ui, Date) = (ui, d) {}
exp clearable: bool = false

a "Clear" under its calendar, going back to no day (on_clear)

exp on_clear: |=| (&var Ui) = (ui) {}
exp enabled: bool = true
exp error: String = String::empty()

as a Select's

exp required: bool = false
exp sizing: Sizing = Sizing {}

type TimePickersource

exp type TimePicker : Widget + Popup = struct

A Select of the times from earliest to latest by step_minutes, written on the Ui's locale's clock (14:30, 2:30 PM), with its keys and type-ahead: typing "14" goes to 14:00. To a screen reader a combo box.

Fields

exp time: Option<TimeOfDay> = ::None
exp earliest: TimeOfDay = TimeOfDay { .hour = 0, .minute = 0 }
exp latest: TimeOfDay = TimeOfDay { .hour = 23, .minute = 59 }
exp step_minutes: u32 = 30
exp placeholder: String = String::empty()
exp accessible: String = String::empty()
exp on_change: |=| (&var Ui, TimeOfDay) = (ui, t) {}
exp enabled: bool = true
exp error: String = String::empty()

as a Select's

exp required: bool = false
exp sizing: Sizing = Sizing {}

fn todaysource

exp fn today(self ui: &Ui) -> Date

The day calendars take as today: the system's, unless set.

fn set_todaysource

exp fn set_today(self ui: &var Ui, day: Option<Date>)

Sets the day calendars take as today, for tests and goldens; None gives the system's again.

fn localesource

exp fn locale(self ui: &Ui) -> Locale

The locale calendars, pickers and the app's own dates follow: the one set, else the system's (question 14A). A binding reading it runs again when it changes (question 27B).

fn set_localesource

exp fn set_locale(self ui: &var Ui, locale: Option<Locale>)

Sets the app's locale, None giving the system's again; everything is laid out again in it, and the bindings that read it run again.

type Rulesource

exp type Rule<T> = |=| (&Ui, &T) -> Option<String>;

A check a field states: what is wrong with its value, or None. It may read the Ui (its locale, today) and other fields, and a binding showing the field's error follows what it reads.

Functions

type Parsersource

exp type Parser<T> = |=| (&Ui, &[u8]) -> std_result::Result<T, String>;

Reads a typed field's text into its value, or says what is wrong.

type FieldOptionssource

exp type FieldOptions<T> = struct

What a field is.

Fields

exp label: String

the label labelled shows, the summary's line, the trees'

exp hint: String = String::empty()

shown under the label, and said after the error

exp required: bool = false

must hold something: checked before the rules, and said to screen readers; an empty field not required is valid, gives no value and runs no rules

exp rules: &[Rule<T>] = &[]

checked in order once it holds something, the first message found being its error

type Verdictsource

exp type Verdict<T> = enum

What a field holds now.

Variants

Empty

nothing typed but spaces, or nothing picked

Valid: T
Invalid: String

type Wantedsource

exp type Wanted = enum

What a required field asks for while empty, which its message says.

Variants

Text

something typed

Pick

one of its choices

Check

a box checked

type Formsource

exp type Form = struct

A form: its fields, whether a submit was tried, a failure of the whole. A copyable handle, valid until its owner goes, as signals are.

Functions

type Fieldsource

exp type Field<T> = struct

A field of a form, giving a T: a copyable handle, valid until the owner that made it goes.

Fields

exp form: Form

Functions

type FormErrorsource

exp type FormError = struct

A field in error, as errors gives them.

Fields

exp label: String
exp message: String
exp element: Element

showing the field

type Rulessource

exp type Rules = struct

The built-in rules, each with an English message in the Ui's locale that said replaces.

Functions

type Parsesource

exp type Parse = struct

The built-in parsers, reading what the Ui's locale writes and ISO 8601.

Functions

type FormMessagessource

exp type FormMessages = struct

What forms say, each a function of the Ui (its locale) and what the message needs; the defaults are the English ones.

Fields

exp required: |=| (&Ui, Wanted) -> String = english_required
exp length: |=| (&Ui, u64, u64, u64) -> String = english_length

least, most, now

exp email: |=| (&Ui) -> String = english_email
exp shape: |=| (&Ui, &[u8]) -> String = english_shape

the example

exp integer: |=| (&Ui) -> String = english_integer
exp number: |=| (&Ui) -> String = english_number
exp between: |=| (&Ui, f64, f64) -> String = english_between
exp date: |=| (&Ui, &Date) -> String = english_date

an example day

exp time: |=| (&Ui, &TimeOfDay) -> String = english_time
exp optional: |=| (&Ui) -> String = english_optional

"(optional)"

exp summary: |=| (&Ui, u64) -> String = english_summary

"There is a problem" for 0, else "2 fields need attention"

fn formsource

exp fn form(self ui: &var Ui) -> Form

A new form, belonging to what is being made as a signal does.

fn textsource

exp fn text(
    self form: &Form,
    ui: &var Ui,
    text: String,
    options: FieldOptions<String>
) -> Field<String>

A field of text kept as typed.

fn parsedsource

exp fn parsed<T>(
    self form: &Form,
    ui: &var Ui,
    text: String,
    parse: Parser<T>,
    options: FieldOptions<T>
) -> Field<T>

A field of text read into a T by parse, whose message is the field's error when it fails.

fn pickedsource

exp fn picked<T>(
    self form: &Form,
    ui: &var Ui,
    value: Option<T>,
    options: FieldOptions<T>
) -> Field<T>

A field of a value picked rather than typed: a Select's, a DatePicker's, a Checkbox's (a required Field<bool> must be true).

fn on_submitsource

exp fn on_submit(self form: &Form, ui: &var Ui, then: |=| (&var Ui))

What a submit that passes runs, as a handler; set once the fields it reads are made.

fn submitsource

exp fn submit(self form: &Form, ui: &var Ui)

Checks every field shown (an element text_field or input made for it exists, in no hidden view). With some wrong, their errors show, the first in Tab order takes the focus, and screen readers are told at once ("2 fields need attention: Card number, Expiry."); else on_submit's function runs.

fn validsource

exp fn valid(self form: &Form, ui: &Ui) -> bool

Whether every field shown is valid; read in a binding, it follows them.

fn alivesource

exp fn alive(self form: &Form, ui: &Ui) -> bool

The fields shown in error, in Tab order, whether their errors show yet or not. Whether the form is still there: false once its owner went, as when a server answers after its screen closed.

fn errorssource

exp fn errors(self form: &Form, ui: &Ui) -> Vector<FormError>

fn refusesource

exp fn refuse(self form: &Form, ui: &var Ui, message: String)

The whole form refused, as by a server: the message is failure until the next submit, and screen readers say it at once.

fn failuresource

exp fn failure(self form: &Form, ui: &Ui) -> &String

What refuse said, empty when nothing was refused since the last submit; read in a binding.

fn resetsource

exp fn reset(self form: &Form, ui: &var Ui)

Nothing tried, left or refused any more, the texts and values kept: after a submit that passed on a form that stays, its texts cleared.

fn verdictsource

exp fn verdict<T>(self field: &Field<T>, ui: &Ui) -> Verdict<T>

What the field holds now, its error shown or not; read in a binding, it follows the field and what its rules read.

fn valuesource

exp fn value<T>(self field: &Field<T>, ui: &Ui) -> T

The field's value: after a submit that passed. Faults unless valid.

fn try_valuesource

exp fn try_value<T>(self field: &Field<T>, ui: &Ui) -> Option<T>

The field's value while valid.

fn errorsource

exp fn error<T>(
    self field: &Field<T>,
    ui: &Ui
) -> String

The message to show now: empty while valid, and until the field was left changed, the form submitted or a server refused it.

fn textsource

exp fn text<T>(self field: &Field<T>, ui: &Ui) -> &String

What is typed in the field.

fn editsource

exp fn edit<T>(self field: &Field<T>, ui: &var Ui, text: String)

Puts the text in the field: a text field's on_change. A server's refusal goes with it.

fn picksource

exp fn pick<T>(self field: &Field<T>, ui: &var Ui, value: Option<T>)

Picks the value, or none: a Select's or a DatePicker's on_change. The error shows from then on.

fn refusesource

exp fn refuse<T>(self field: &Field<T>, ui: &var Ui, message: String)

The server's verdict on what the field was sent with: shown at once, said to screen readers at once, the field focused when it is the first in error; its next change takes it away.

fn text_fieldsource

exp fn text_field<T>(self ui: &var Ui, field: Field<T>, look: TextField) -> Element

A TextField showing the field: its text, its error once shown, required, the label for screen readers unless look gives one, the hint said after the error, on_change editing the field and, on one line, Enter submitting the form; look gives the rest. A binding, recorded as the field's element.

fn inputsource

exp fn input<T, W: Widget>(self ui: &var Ui, field: Field<T>, options: |=| (&Ui) -> W) -> Element

Another widget showing the field, its options bound as bind binds them and the wiring the program's own (selected, error, required, on_change picking); its element recorded as the field's.

fn labelledsource

exp fn labelled<T>(self ui: &var Ui, field: Field<T>, input: Element) -> Element

The field's label above its element, "(optional)" after it when not required, its hint under the label and its error under the element in the theme's danger color, coming and going as it changes. A Checkbox keeps its own label: only the hint and the error are added.

fn form_summarysource

exp fn form_summary(self ui: &var Ui, form: Form) -> Element

An element showing nothing until a submit fails: then a panel, "There is a problem", the form's failure and a line for each field in error, a plain button focusing it, following the errors until none is left.

fn set_form_messagessource

exp fn set_form_messages(self ui: &var Ui, messages: FormMessages)

What forms say from now on, in the program's own words.

fn Rules::lengthsource

exp fn Rules::length(least: u64, most: u64) -> Rule<String>

The text, its spaces at either end aside, from least to most characters long, counted as a person counts them (grapheme clusters): "Use at least 10 characters (now 7)."

fn Rules::emailsource

exp fn Rules::email() -> Rule<String>

A valid email address (WHATWG's, as browsers check one) whose domain has a dot: "Enter an email address, like [email protected]."

fn Rules::shapesource

exp fn Rules::shape(shape: &[u8], like: &[u8]) -> Rule<String>

The text written in the shape, 9 standing for a digit, A for a letter and * for either, anything else for itself, like an example for the message: Rules::shape(&"99/99", &"12/29"), "Write it like 12/29."

fn saidsource

exp fn said<T>(self rule: &Rule<T>, message: &[u8]) -> Rule<T>

The rule, its message replaced: `Rules::length(1, 40).said(&"Keep the name to 40 characters.")`.

fn Rules::betweensource

exp fn Rules::between<T: Number>(
    least: T,
    most: T
) -> Rule<T>

The number from least to most: "Enter a number from 1 to 10."

fn Parse::integersource

exp fn Parse::integer() -> Parser<i64>

A whole number, in ASCII digits or another script's, its sign before it: "Enter a whole number."

fn Parse::numbersource

exp fn Parse::number() -> Parser<f64>

A number as the Ui's locale writes it, its groups or none (1 234,5 in French, 1,234.5 in English): "Enter a number, like 2.5."

fn Parse::datesource

exp fn Parse::date() -> Parser<Date>

A day in the Ui's locale's short date (21/11/2026 in British English) or ISO 8601: "Enter a date, like 21/11/2026." with today.

fn Parse::timesource

exp fn Parse::time() -> Parser<TimeOfDay>

A time of day on either clock, 14:30 or 2:30 pm: "Enter a time, like 14:30." on the locale's own.

type Pathssource

exp type Paths<R> = struct

How a navigator's routes show in the page's address, and are read from it: on the web the address follows the top screen (index.html#/events/42), and a page opened or reloaded at an address starts at that screen; elsewhere they are not used.

Fields

exp path: |=| (&R) -> String
exp parse: |=| (&[u8]) -> Option<R>

fn pushsource

exp fn push<R>(self nav: &Navigator<R>, ui: &var Ui, route: R)

Shows the route's screen over the current one, which is kept hidden.

fn backsource

exp fn back<R>(self nav: &Navigator<R>, ui: &var Ui) -> bool

Frees the top screen, showing the one under it as it was left, once on_leaving agrees; false at the first screen, which stays, or when it does not. The header's Back, the mouse's, Alt+Left and the browser's all come here.

fn on_leavingsource

exp fn on_leaving<R>(self nav: &Navigator<R>, ui: &var Ui, asks: |=| (&var Ui, R) -> bool)

Asks the function before going back from the top screen, with its route: true lets it go; false keeps it, as for a form or a cart left half done, the function asking the person (a dialog whose "Leave" then calls pop).

fn popsource

exp fn pop<R>(self nav: &Navigator<R>, ui: &var Ui) -> bool

Frees the top screen as back does, without asking on_leaving.

fn replacesource

exp fn replace<R>(self nav: &Navigator<R>, ui: &var Ui, route: R)

Shows the route's screen in place of the top one, which is freed.

fn resetsource

exp fn reset<R>(self nav: &Navigator<R>, ui: &var Ui, route: R)

Shows the route's screen alone, freeing every other.

fn currentsource

exp fn current<R>(self nav: &Navigator<R>, ui: &Ui) -> &R

The top screen's route; in a binding, recorded so the binding runs again when it changes.

fn depthsource

exp fn depth<R>(self nav: &Navigator<R>, ui: &Ui) -> u64

How many screens there are, 1 at the first; in a binding, recorded.

fn screenssource

exp fn screens<R>(
    self ui: &var Ui,
    nav: Navigator<R>,
    screen: |=| (&var Ui, &R) -> Element
) -> Element

An element showing the navigator's top screen, made by screen from its route when pushed and freed when taken off, on the theme's background; the screens under it are kept hidden, as switch keeps views. A screen shown gives the focus to its first element taking it, or, shown again, to the one that had it. Back comes from back, the mouse's Back button, Alt+Left (Command+[ on macOS) and on the web the browser's Back and Forward, to the deepest navigator on screen that can go back.

type Animatedsource

exp type Animated = struct

A number moving to its target over its motion, read in bindings as a signal is: a binding reading it runs again each frame while it moves. A copyable handle, valid until its owner goes.

Functions

fn animatedsource

exp fn animated(self ui: &var Ui, value: f32, motion: Motion) -> Animated

A number at the value, moving over the motion when given a target, belonging to what is being made as a signal does.

fn getsource

exp fn get(self a: &Animated, ui: &Ui) -> f32

Where the number is this frame; in a binding, recorded so the binding runs again as it moves.

fn setsource

exp fn set(self a: &Animated, ui: &var Ui, target: f32)

Moves the number to the target from where it is, its speed kept; under reduced motion, unless essential, it jumps there. (The design's to is a keyword: decisions/F11.md, question 21.)

fn jumpsource

exp fn jump(self a: &Animated, ui: &var Ui, value: f32)

Puts the number at the value at once.

fn targetsource

exp fn target(self a: &Animated, ui: &Ui) -> f32

Where the number is going, or is.