# `Macaw.Registry`
[🔗](https://github.com/dcoai/macaw/blob/v0.1.3/lib/macaw/registry.ex#L1)

A host's registry of components (spec/12 §1.1): built from the packages the host enables,
and nothing else.

    registry = Macaw.Registry.new!([Macaw.Builtin])
    {:ok, Macaw.Builtin.Table} = Macaw.Registry.component(registry, "macaw.table")

Closed by default: `new([])` holds nothing, and a component whose package isn't listed is
unknown though its module is loaded. Names are matched by spelling; no atom is made from a
document's name. Two components of one name across packages fail at boot, naming both.

# `t`

```elixir
@type t() :: %Macaw.Registry{
  components: %{required(String.t()) =&gt; module()},
  packages: [module()]
}
```

# `component`

```elixir
@spec component(t(), String.t() | atom()) :: {:ok, module()} | :error
```

A component by name, a string or an atom read as its spelling: `{:ok, module}` or `:error`.

# `components`

```elixir
@spec components(t()) :: [{String.t(), module()}]
```

Every component, `{name, module}`, in name order.

# `hooks`

```elixir
@spec hooks(t()) :: {:ok, map()} | {:error, [Macaw.Layers.Fault.t(), ...]}
```

Every hook of the registry's packages (`Macaw.Component.Package.hooks/1`).

# `new`

```elixir
@spec new([module()]) :: {:ok, t()} | {:error, [Macaw.Layers.Fault.t(), ...]}
```

The registry of the listed packages: `{:ok, registry}`, or every fault at once, a
package's own at `[package]` and a name two packages share as `{:duplicate, name,
[{module, package}, {module, package}]}`.

# `new!`

```elixir
@spec new!([module()]) :: t()
```

The registry of the listed packages, or an `ArgumentError` with every fault: a host's boot.

# `packages`

```elixir
@spec packages(t()) :: [module()]
```

The packages, as given, each once.

---

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