Expand description
Component patches: how a tilolang app’s window reaches the room’s UI host, and what the person did comes back.
The scene protocol carries pixels an app’s toolkit recorded. This one carries what a
tilolang app’s views are: trees of the toolkit’s described components
(tilo_ui_graph::component) and the language’s layout primitives, keyed by stable keys,
and the changes the runtime planned to them. The UI host (the room’s render service) holds
the widgets, lays them out, shapes text, draws and takes input; the app (its view
instances, in an app host) holds the data. So:
- The app sends its views (
ToUi): a level’s tree when it opens, the runtime’s patches to it after, the rows of virtual lists the host asked for, what bound controls show, and what the window says (a notice, the Ask bar). - The host sends what the person did (
ToApp): events of components (an action reference fired by key), edits through bindings (text as splices, so concurrent edits merge), the rows a list shows now, focus and composition. Typing shows in the host’s text field on the next frame; the app hears of it as a splice and never draws it.
Transport-agnostic. A side sends at most one batch per frame: its messages, in order,
encoded as one byte string (encode_batch, decode_batch). What carries the bytes is
the transport’s: a socket between processes with a sealed memfd for a large batch
(unix), a postMessage between a page and a worker in the browser (the bytes are an
ArrayBuffer transferred, not copied), or a queue in one process (local). Nothing here
needs a socket, a thread or a clock, so both ends build for wasm32.
Hostile until validated. A batch the UI host receives is decoded once into its own
memory and checked (validate) against the component descriptions and the window’s
budget before any widget is touched; a batch that fails is refused whole and the window
shows the platform’s error state, while the host and every other window keep running.
A connection is one window of one app: a patch can only name nodes of the trees that
window’s app sent.
Modules§
- diff
- The patches that bring one tree to another, by key.
- local
- A transport within one process: an app’s instance and its window side by side, as in a capture, a test, or a browser page that runs both. The batches are the bytes any transport carries, so what is validated and applied is exactly what a socket would deliver.
- rich
- Rich text as a window shows it (
Value::Rich). Rich text as a component shows it: paragraphs with their marks, and how each reference in them reads for the person reading. - unix
- The patch transport between processes: a
Channel(one batch a packet) for what fits a packet, and an immutable shared buffer (sealed_blob) riding along for a larger batch (a window’s first tree of a long list), so no batch is split or streamed. The receiver copies a batch out of the buffer once, into its own memory, before it reads it: the sender cannot change what the receiver validated. - validate
- The check every batch an app sends passes before the UI host touches a widget.
Structs§
- Actor
- Who acted, what the workspace calls them, and the colour it paints them in.
- Ask
- The Ask bar: trusted chrome naming who asks for what.
- Binding
- What a bound control edits, as the host needs to show and announce it.
- Call
Picture - One picture the call delivered for a tile: the tilo-video/1 object of a person’s camera or screen, as the call received it.
- Call
Shown - One picture a view’s call tiles show: a person’s camera or the screen they share.
- Event
- An event a node’s view gave it. What it does is the app’s: the host reports the event by
the node’s key and name, and the app applies the action reference its view attached. The
host knows only, when that action toggles a field of a resource (
pintogglespinned), which, so a header does not repeat a control that stands for it; and which action on which resource it runs, so a menu the system completes does not offer it twice. - File
- A file a node hands over (
Value::File): its name, media type, size and content address. 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’sFilereads: its name, its media type, its size and the content address its bytes are at. - Form
- An action waiting for its arguments: the form the window shows for what the invocation still needs. The app derives its fields from the action’s parameters (each control from the parameter’s type), keeps what the person typed as their lens state, and checks each value as the action takes it; the window presents the fields (a sheet over the window, a popover at the control it came from, a sheet from the foot of a narrow window) with the title, submit and cancel, and reports edits by field.
- Held
- The modifier keys held while the person pressed: what a tilolang press reads as
host.Press.commandis Ctrl, or ⌘ on a Mac. - Invocation
- An action one event runs, by the address the API runs it by: the resource and the action as the app publishes it there. That address is what the control says it does: nothing the window composes around it and no language changes it.
- Node
- A node of a view’s tree: a described component (
ui.ListRow), a primitive of the language (stack,row,list), aslotholding a component’s named slot, or afragment. - Offered
- An action a node offers (
Value::Action), as the toolkit holds one. 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. - Picture
- A picture a node shows (
Value::Picture): its address, and its accessible name. 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 readstilo-blob://<hash>, and any other address is fetched by the store the picture loads through. - Resource
Ref - A resource a node shows or an event carries: its id in the room, and its type.
- Unapplied
- Why
applycould not take a patch: it names a node the tree does not have.
Enums§
- Answer
- A person’s answer to the Ask bar.
- Call
Picture Source - Which of a person’s pictures a call tile shows.
- Front
- What brings the window’s content column to the front of a narrow window.
- Level
- One window’s two views: the app’s root, and the view of the resource
open(r)(or a row) went to, shown after it. - Notice
Kind - What kind of notice the window shows: the tone its icon and colour take.
- Patch
- One change of a level’s tree, against the tree the ones before it left. Paths are keys from the root’s children down; the root is the empty path.
- Prop
Type - The type a described component’s prop takes, as the catalogue declares it. The type of a prop, an event’s value, a binding or a piece of state: the language’s types.
- RowChange
- A change of a virtual list’s rows, against the rows the ones before it left.
- ToApp
- What the person did, as the window tells its app.
- ToUi
- What an app sends its window.
- Value
- A value a node holds: the language’s values as a view shows them. Formatting (a date the person’s way, a number with their separators) is the host’s, so values travel as they are.
- Words
- Words the window says: a phrase of the platform’s catalogue (the host says it in the person’s language), or text the app made (an error, an action’s label).
Constants§
- MAX_
BATCH_ BYTES - Largest batch either side sends or accepts.
- MAX_
CALL_ PICTURES - The most pictures one
ToUi::CallPicturescarries, and the most a tile set shows: what a call view draws at once (runtime_collab::native_media::MAX_SHOWN). - MAX_
CALL_ PICTURE_ BYTES - The largest a
CallPicture’s object is: one coded picture of a call (runtime_collab::native_media::MAX_PICTURE_BYTES). - MAX_
PAGE_ BYTES - Largest page request or answer one message carries: a page’s reading, its outline and a picture of it fit, and nothing a page could say grows a window without bound.
- VERSION
- The version both ends name. A newer end must still read this one’s messages.
Traits§
- Transport
- What carries one side’s batches to the other: a queue in one process, a socket and ring
between processes,
postMessagebetween a page and a worker. At most one batch a frame.
Functions§
- decode_
batch - The messages of a batch, read once into the receiver’s memory.
- description
- The description of the component a node of
kindis of (ui.BlockEditor): what its props are, which is the one list of them a host reads a node’s values by. - encode_
batch - One frame’s messages as the bytes a transport carries.
- is_
virtual_ list - Whether a node of
kindis a virtual list on the wire: aui.VirtualListor aui.TreeView, whose rows the app sends apart from the tree (ToUi::Rows) as the list shows them. Alistin a view’s content is drawn whole (a card’s is its preview), so its rows travel in the tree.