# `Macaw.Component.Declarations`
[🔗](https://github.com/dcoai/macaw_component/blob/v0.1.3/lib/macaw/component/declarations.ex#L1)

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.

# `t`

```elixir
@type t() :: %Macaw.Component.Declarations{
  access: String.t() | nil,
  announces: [String.t()],
  events: [String.t()],
  isolation: :pure | :contained,
  local: %{required(String.t()) =&gt; Macaw.Component.State.type()},
  observes: [atom()],
  proxy_routes: [Macaw.Component.Proxy.route()],
  reading: :glance | :scan | :read,
  shortcuts: [%{key: String.t(), action: String.t(), description: String.t()}],
  slots: %{required(String.t()) =&gt; Macaw.Component.Slot.t()},
  stylesheets: [String.t()],
  words: non_neg_integer() | nil,
  writes: %{required(String.t()) =&gt; Macaw.Component.State.type()}
}
```

# `emits?`

```elixir
@spec emits?(t(), String.t()) :: boolean()
```

Whether the declarations name an event.

# `keys`

```elixir
@spec keys() :: [atom(), ...]
```

The keys, in the order of spec/01 §1.2's table.

# `new`

```elixir
@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}

---

*Consult [api-reference.md](api-reference.md) for complete listing*
