strata_component
strata_component packages collaborative state and behavior behind a typed,
headless contract. It targets Erlang and JavaScript.
Use a component definition to package:
- a stable component kind and version;
- typed config encoding and decoding;
- initial document creation;
- local messages and typed outputs;
- replicated Strata event handling; and
- ownership of a root document and its descendants.
The host owns the shared strata_client.Connection, transport,
authentication, presence, lifecycle, event routing, and UI adapters. Local
updates can emit outputs. Replicated events cannot emit outputs. This rule
prevents another client from repeating the originating action.
Public surface
Section titled “Public surface”The strata_component module provides:
Definition(root, context, config, model, message, output);definitionfor validated component construction;kind,version,encode_config, anddecode_config;initial_document,init,update, andreceive;owned_document_ids;Status,ComponentError,Init,Update, andReceive.
The strata_component/port module provides:
OutputPort(output, payload);InputPort(message, input);Binding(output, message, payload, input, config);output_port,input_port,binding, androute;- config and metadata accessors;
PortError.
An output port selects a payload from a component output. An input port converts an input value into a component message. A binding maps between the two payload types with codec-backed configuration. The Gleam compiler checks the source output, mapping, target input, and component message types.
The package does not include runtime component discovery, a type-erased binding catalog, or a persisted connection graph.
Read Components and Bindings for host and routing guidance. Read the generated API reference for every public type and function.
Source:
packages/strata_component.