A component's configured declarations (spec/01 §1.2), built by new/2 from its
declarations/1 answer, every key checked, every fault at once.
No atom is made from a name: names are strings, and an observation spelled as a string is matched against the vocabulary's atoms.
Summary
Types
A default action (spec/01 §1.6): an event sets one of the component's bindable parameters.
A field of an event an action reads (spec/01 §1.6).
Functions
Whether the declarations name an event.
Whether a term is one of the five event paths.
The five event paths an action may read (spec/01 §1.6), key and field standing for
any non-empty string.
The keys, in the order of spec/01 §1.2's table.
The declarations from an answer (a keyword list or a map with atom keys) for a component
module, which isolation: :contained is checked against.
Types
@type action() :: %{on: String.t(), set: String.t(), value: event_path()}
A default action (spec/01 §1.6): an event sets one of the component's bindable parameters.
@type event_path() :: {:event, :value | :identity | [:value | :identity | :row | String.t()]}
A field of an event an action reads (spec/01 §1.6).
@type t() :: %Macaw.Component.Declarations{ access: String.t() | nil, actions: [action()], announces: [String.t()], events: [String.t()], isolation: :pure | :contained, local: %{required(String.t()) => Macaw.Component.State.type()}, observes: [atom()], proxy_routes: [Macaw.Component.Proxy.route()], reading: :glance | :scan | :read, requests: [String.t()], shortcuts: [%{key: String.t(), action: String.t(), description: String.t()}], slots: %{required(String.t()) => Macaw.Component.Slot.t()}, stylesheets: [String.t()], words: non_neg_integer() | nil, writes: %{required(String.t()) => Macaw.Component.State.type()} }
Functions
Whether the declarations name an event.
Whether a term is one of the five event paths.
iex> Macaw.Component.Declarations.event_path?({:event, [:value, "sort"]})
true
iex> Macaw.Component.Declarations.event_path?({:event, [:value]})
false
@spec event_paths() :: [event_path(), ...]
The five event paths an action may read (spec/01 §1.6), key and field standing for
any non-empty string.
iex> length(Macaw.Component.Declarations.event_paths())
5
@spec keys() :: [atom(), ...]
The keys, in the order of spec/01 §1.2's table.
@spec new(keyword() | map(), module() | nil) :: {:ok, t()} | {:error, [Macaw.Component.fault(), ...]}
The declarations from an answer (a keyword list or a map with atom keys) for a component
module, which isolation: :contained is checked against.
iex> {:ok, d} = Macaw.Component.Declarations.new([events: ["open"], reading: :scan], nil)
iex> {d.events, d.reading, d.isolation}
{["open"], :scan, :pure}