A2UICore.Resolution.Node (A2UICore v0.1.1)

Copy Markdown View Source

One mounted position of a resolved component tree.

A node is one component rendered in one data scope: a template component that is instantiated for three items is three nodes. Its props hold what a renderer needs:

state says what the position holds:

  • :resolved — the component's definition is here and its type is in the catalog;
  • :pending — a parent refers to a component that has not arrived;
  • :unknown_type — the definition names a type the catalog lacks;
  • :cyclic — the component is referenced by one of its own descendants; the repeated reference is cut here.

Placeholders (:pending, :unknown_type, :cyclic) have no props and no children.

ref is the node's identity: it never changes while the position keeps the same component, and a node that is replaced (a placeholder that gets its definition, a component whose type changed) gets a new one. instance_id is a readable, deterministic name for the position.

busy is true while a property waits for the response to an agent function call (see A2UICore.Resolution.NodeResolver); the property is nil meanwhile.

Summary

Functions

True for the states that hold no definition of their own.

Types

state()

(since 0.1.0)
@type state() :: :resolved | :pending | :unknown_type | :cyclic

t()

(since 0.1.0)
@type t() :: %A2UICore.Resolution.Node{
  busy: boolean(),
  catalog_id: String.t() | nil,
  children: [pos_integer()],
  component_id: String.t(),
  data_path: String.t(),
  edge: String.t() | nil,
  instance_id: String.t(),
  occurrence: pos_integer(),
  parent: pos_integer() | nil,
  props: map(),
  ref: pos_integer(),
  state: state(),
  type: String.t() | nil
}

Functions

placeholder?(node)

(since 0.1.0)
@spec placeholder?(t()) :: boolean()

True for the states that hold no definition of their own.