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

The package side of the registry (spec/03): what a package provides, read the same way
by every host. A package is a module with `__members__/0`; its components are the
members that use `Macaw.Component`, each registering through its static declarations.

Enabling packages, the boot-time duplicate check across them and resolving names in
documents are the host's.

# `component`

```elixir
@type component() :: %{
  name: String.t(),
  module: module(),
  kinds: [Macaw.Component.kind(), ...],
  hooks: %{required(String.t()) =&gt; String.t()},
  assets: [String.t()]
}
```

# `check`

```elixir
@spec check(module()) :: :ok | {:error, [Macaw.Component.fault(), ...]}
```

`:ok` when `components/1` answers `{:ok, _}`, else its faults.

# `components`

```elixir
@spec components(module()) ::
  {:ok, [component()]} | {:error, [Macaw.Component.fault(), ...]}
```

A package's components, in member order, each with its static declarations; members of
other behaviors are skipped. Every fault at once: `:not_a_package`, `{:not_loaded,
member}`, and `{:duplicate, name, [module, module]}` for two components of one name.

# `hooks`

```elixir
@spec hooks([module()]) ::
  {:ok, %{required(String.t()) =&gt; {module(), String.t()}}}
  | {:error, [Macaw.Component.fault(), ...]}
```

Every hook of the components of the listed packages, `%{hook_name => {package, path}}`,
from which a host generates the one module that registers them in its `LiveSocket`. Two
hooks of one name are `{:duplicate_hook, name, [component, component]}`; a package's own
faults are reported at `[package]`.

---

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