Behaviour and DSL for declaring a JobyKit design-system manifest.
A host module uses 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
endEntry 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 (ornil):summary— one-line description:anchor— page anchor for cross-linking (ornil):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 (ornil):data_component— the canonical "Module.function" string for thedata-componentattribute on the rendered element:source— relative source path (ornil)
Summary
Functions
Register a category. Pass :label (human-readable) and :description
(one-line) in opts.
Register a component.
Enrich raw component registrations with introspected attrs/slots/source.
Types
@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() -> Phoenix.LiveView.Rendered.t()) | nil, attrs: [attr_meta()], slots: [slot_meta()], line: integer() | nil, data_component: String.t(), source: String.t() | nil }
Callbacks
Functions
Register a category. Pass :label (human-readable) and :description
(one-line) in opts.
category :core,
label: "Core wrappers",
description: "One wrapper per daisyUI primitive."
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 tonil; the page derives one):preview— optional 1-arity function returning HEEX
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.