# `JobyKit.Manifest`
[🔗](https://github.com/jobycorp/joby_kit/blob/v0.2.0/lib/joby_kit/manifest.ex#L1)

Behaviour and DSL for declaring a JobyKit design-system manifest.

A host module `use`s this behaviour and registers its component inventory
with the `category/2` and `component/3` macros. At compile time, the
callbacks `entries/0`, `by_category/0`, `categories/0`, `category_label/1`,
`category_description/1`, and `fetch/2` are generated automatically.

## Example

    defmodule MyAppWeb.DesignManifest do
      use JobyKit.Manifest

      category :core,
        label: "Core wrappers",
        description: "One Bardo wrapper per daisyUI primitive."

      category :composite,
        label: "Generic composites",
        description: "Multi-primitive patterns reused across domains."

      component MyAppWeb.CoreComponents, :button,
        category: :core,
        daisy_basis: "btn",
        summary: "Text button family.",
        preview: &MyAppWeb.DesignPreviews.button/1

      component MyAppWeb.UIComponents, :listing_card,
        category: :composite,
        summary: "Navigable directory entry.",
        preview: &MyAppWeb.DesignPreviews.listing_card/1
    end

## Entry shape

Each entry returned by `entries/0` is a map with these keys:

  * `:module` — the module the component is defined in
  * `:function` — the component function name
  * `:category` — `:core`, `:composite`, `:domain`, or any custom atom
  * `:label` — human-readable label
  * `:daisy_basis` — daisy class(es) the wrapper composes (or `nil`)
  * `:summary` — one-line description
  * `:anchor` — page anchor for cross-linking (or `nil`)
  * `:preview` — optional 1-arity function returning HEEX
  * `:attrs` — list of attr maps introspected from the component
  * `:slots` — list of slot maps introspected from the component
  * `:line` — source line of the component definition (or `nil`)
  * `:data_component` — the canonical "Module.function" string for
    the `data-component` attribute on the rendered element
  * `:source` — relative source path (or `nil`)

# `attr_meta`

```elixir
@type attr_meta() :: %{
  name: String.t(),
  type: String.t(),
  required: boolean(),
  default: term() | nil,
  values: [String.t()] | nil,
  doc: String.t() | nil
}
```

# `category_spec`

```elixir
@type category_spec() :: {atom(), keyword()}
```

# `entry`

```elixir
@type entry() :: %{
  module: module(),
  function: atom(),
  category: atom(),
  label: String.t(),
  daisy_basis: String.t() | nil,
  summary: String.t() | nil,
  anchor: String.t() | nil,
  preview: (map() -&gt; Phoenix.LiveView.Rendered.t()) | nil,
  attrs: [attr_meta()],
  slots: [slot_meta()],
  line: integer() | nil,
  data_component: String.t(),
  source: String.t() | nil
}
```

# `slot_meta`

```elixir
@type slot_meta() :: %{name: String.t(), required: boolean(), doc: String.t() | nil}
```

# `by_category`

```elixir
@callback by_category() :: [{atom(), [entry()]}]
```

# `categories`

```elixir
@callback categories() :: [atom()]
```

# `category_description`

```elixir
@callback category_description(atom()) :: String.t()
```

# `category_label`

```elixir
@callback category_label(atom()) :: String.t()
```

# `entries`

```elixir
@callback entries() :: [entry()]
```

# `fetch`

```elixir
@callback fetch(module(), atom()) :: entry() | nil
```

# `category`
*macro* 

Register a category. Pass `:label` (human-readable) and `:description`
(one-line) in `opts`.

    category :core,
      label: "Core wrappers",
      description: "One wrapper per daisyUI primitive."

# `component`
*macro* 

Register a component.

## Options

  * `:category` — required atom matching one of the declared categories
  * `:label` — defaults to the function name capitalized
  * `:daisy_basis` — daisy class(es) the wrapper composes
  * `:summary` — one-line description
  * `:anchor` — page anchor (defaults to `nil`; the page derives one)
  * `:preview` — optional 1-arity function returning HEEX

# `enrich`

Enrich raw component registrations with introspected attrs/slots/source.

Called at runtime by the generated `entries/0` callback. Applied to each
`{module, function, opts}` registration in declaration order.

---

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