lightspeed/component/nested_lifecycle
First-class nested LiveView lifecycle primitives for M55.
Types
Child lifecycle status in one nested tree.
pub type ChildLifecycle {
Mounted
Suspended
Failed(reason: String)
Terminated
}
Constructors
-
Mounted -
Suspended -
Failed(reason: String) -
Terminated
One child runtime record.
pub type ChildNode {
ChildNode(
id: String,
identity: String,
lifecycle: ChildLifecycle,
mount_count: Int,
update_count: Int,
fingerprint: String,
)
}
Constructors
-
ChildNode( id: String, identity: String, lifecycle: ChildLifecycle, mount_count: Int, update_count: Int, fingerprint: String, )
Event scope for authority-safe routing.
pub type EventScope {
ParentScope
ChildScope(child_id: String)
}
Constructors
-
ParentScope -
ChildScope(child_id: String)
Event routing decision.
pub type RouteDecision {
RoutedToParent
RoutedToChild(child_id: String)
Rejected(reason: String)
}
Constructors
-
RoutedToParent -
RoutedToChild(child_id: String) -
Rejected(reason: String)
Runtime
opaqueNested parent/child runtime.
pub opaque type Runtime
One scoped inbound event.
pub type ScopedEvent {
ScopedEvent(scope: EventScope, name: String, payload: String)
}
Constructors
-
ScopedEvent(scope: EventScope, name: String, payload: String)
Values
pub fn authority_invariants(runtime: Runtime) -> Bool
True when no authority invariants were violated.
pub fn authority_violations(runtime: Runtime) -> List(String)
Authority violation labels in execution order.
pub fn child(
runtime: Runtime,
child_id: String,
) -> option.Option(ChildNode)
One child by id.
pub fn child_lifecycle_label(lifecycle: ChildLifecycle) -> String
Child lifecycle label.
pub fn fail_child(
runtime: Runtime,
child_id: String,
reason: String,
) -> #(Runtime, List(diff.Patch))
Fail one child subtree while keeping siblings alive.
pub fn lifecycle_events(runtime: Runtime) -> List(String)
Lifecycle events in execution order.
pub fn mount_child(
runtime: Runtime,
child_id: String,
fingerprint: String,
html: String,
) -> #(Runtime, List(diff.Patch))
Mount a child boundary with stable identity.
pub fn patches(runtime: Runtime) -> List(diff.Patch)
All emitted patches in execution order.
pub fn resume_child(
runtime: Runtime,
child_id: String,
) -> Runtime
Resume one suspended child subtree.
pub fn route_decision_label(decision: RouteDecision) -> String
Routing decision label.
pub fn route_event(
runtime: Runtime,
scoped: ScopedEvent,
) -> #(Runtime, RouteDecision)
Route one scoped event.
pub fn routed_events(runtime: Runtime) -> List(String)
Routed event labels in execution order.
pub fn scoped_event(
scope: EventScope,
name: String,
payload: String,
) -> ScopedEvent
Build one scoped event.
pub fn stable_child_identity(runtime: Runtime) -> Bool
True when child identity contracts are stable and unique.
pub fn start(
parent_id: String,
route: String,
) -> #(Runtime, List(diff.Patch))
Start one parent runtime.
pub fn subtree_isolated(
runtime: Runtime,
failed_child_id: String,
) -> Bool
True when one failed subtree does not corrupt siblings or parent mounts.
pub fn terminate_child(
runtime: Runtime,
child_id: String,
) -> #(Runtime, List(diff.Patch))
Terminate one child subtree.
pub fn update_child(
runtime: Runtime,
child_id: String,
html: String,
) -> #(Runtime, List(diff.Patch))
Update one mounted child without remounting the parent.