Skip to main content

Module component

Module component 

Source
Expand description

Component descriptions: what each described toolkit widget takes and does, as data.

A description is generated from the widget’s Rust definition (#[derive(Component)] in the toolkit), so it cannot drift from the widget. It is read by everything that composes widgets without being Rust: tilolang reads the catalogue as its package ui, the generic host adapter builds widgets from it, and a serialized graph names component instances by it.

A description holds props (typed values), parts (child content, typed by what may go in it), events (data, never closures), bindings (two-way to a resource field, with the merge an edit is applied with), state (what the widget keeps between frames, which is lens state) and semantics (its accessibility role, and which props name it and the resource it shows). FORMAT_VERSION is the shape of this format; Catalogue::toolkit the toolkit version it was generated from.

Structs§

Binding
A two-way binding to a resource field or view state.
CaseDescription
One case of an EnumDescription, with its fields in order.
Catalogue
Every described component of one toolkit version.
Description
One described component.
EnumDescription
A closed set whose cases carry fields, as a tilolang enum with payloads reads it: the toolkit declares it once, and every prop of Type::Cases names it.
Event
Something that happens to a component. What it does is data: an action reference, invoked through the action API, or a view-state update; never a closure.
FieldDescription
One field of a CaseDescription.
File
A file a person handed the window: dropped on it, or chosen in a chooser. Its bytes are in the device’s content store, and the value is what the runtime’s File reads: its name, its media type, its size and the content address its bytes are at.
Offered
An action offered to the person, as a control shows it, and the event of the instance that choosing it fires. Every field is always written: the wire’s encoding is not self-describing.
Part
Child content a component takes.
Picture
A picture a component shows, by where its bytes are. The address is opaque to the toolkit: a window whose host holds a content store reads tilo-blob://<hash>, and any other address is fetched by the store the picture loads through.
Prop
A typed value a component takes.
Semantics
How assistive technology and tests see a component.
State
What a widget keeps between frames (scroll, selection, caret, expansion). It is lens state: personal, shown as presence, resumed on the person’s other devices.

Enums§

Accepts
What a part accepts.
Companion
What a companion says of the prop it completes.
Merge
How an edit through a binding is applied to what it is bound to.
Type
The type of a prop, an event’s value, a binding or a piece of state: the language’s types.
Value
A value of a Type, as an instance of a component holds it.

Constants§

FORMAT_VERSION
The version of the description format: a change to the shape of Description bumps it.
OPENS_PROP
The prop a component carries when its block gives such a part: the row offers to open into its document, which comes once it is open.
SHIPPED
The text of the shipped catalogue.

Functions§

catalogue
The catalogue of the toolkit this crate ships with, as the toolkit generated it (components.json; the toolkit’s tests fail while it is stale).
companion
The companion name is, and the prop it completes, when it is one: value:as says which kind of text value holds, and meta:time the time of day the day meta is due at.
first_line
The first line of a doc text.