Skip to main content

Module validate

Module validate 

Source
Expand description

The check every batch an app sends passes before the UI host touches a widget.

The UI host builds every window of a workspace from what each app sends. A batch that makes it build a widget wrongly, or work without bound, takes the workspace’s windows down with it. So every message is checked, once, in the host’s own copy:

  • Valid by type. A described component’s node (ui.ListRow) names a component of the toolkit’s catalogue; each of its props is one the description declares (or a sizing argument every node takes, or the companion of a prop it declares, such as value:as saying which kind of text value holds), holding a value of the declared type; each event and binding is one it declares. A primitive of the language (stack, list) is one the host builds.
  • Bounded. Strings, keys, paths, props, depth and the rows of one message are limited, and each window’s trees together hold at most PatchLimits::nodes nodes (the host counts them as it applies patches: one window’s budget is its own).
  • Only its own trees. A connection is one window of one app; its patches name nodes by key paths in the trees it sent, and a path that names no node is refused when applied.

Structs§

PatchLimits
What one window may make its UI host hold and do.
Refused
Why a batch was refused: what was wrong, and where.
Validator
Checks batches against a toolkit’s catalogue and a window’s limits.

Constants§

COMPONENT_PREFIX
The prefix of a described component’s kind: ui.ListRow.
NODE_ARGS
The sizing and placement arguments every node takes (fill, min: 12.rem, at), as the language’s prims::NODE_ARGS names them.
PART
The kind of a node holding the content of a component’s named part.
PRIMITIVES
Every primitive of the language a view may send: the layouts, controls and blocks the host builds itself, and part, a component’s named part. A primitive’s props are the language’s arguments, which the host reads by name, each as the type it takes, ignoring what it does not read; so what is checked of them is that the primitive is one the host builds and that every value is bounded.

Functions§

fits
Whether value is one of the type ty, as the host reads it into a widget: text shows any value as text, a whole number is a number, an Option holds nothing or a value.
offered_event
The event an action offered in the prop prop fires: actions.2 for the third of actions. Its node gives it what the action runs, as it gives its declared events.
offers
Whether event is one an action offered in a prop of the component fires (offered_event): the host binds such an event to the action it runs.
primitive
Whether kind is a primitive the host builds.