PhiaUiDesign.Catalog.FamilyResolver (phia_ui v0.1.17)

Copy Markdown View Source

Detects composable component families by analyzing which components share the same module and have naming prefix patterns.

For example: card, card_header, card_title, card_content, card_footer all belong to the "card" family.

Summary

Functions

Get the family for a specific component. Returns nil if the component is standalone (no family).

Resolve all component families from the registry.

Get the typical children for a component family. Returns an ordered list suitable for auto-scaffolding.

Types

family()

@type family() :: %{
  root: atom(),
  root_name: String.t(),
  module: module(),
  children: [atom()],
  tier: atom()
}

Functions

family_for(component_key)

@spec family_for(atom()) :: family() | nil

Get the family for a specific component. Returns nil if the component is standalone (no family).

resolve_families()

@spec resolve_families() :: [family()]

Resolve all component families from the registry.

Returns families where a root component has 1+ child components in the same module with matching name prefix.

scaffold_order(root_key)

@spec scaffold_order(atom()) :: [atom()]

Get the typical children for a component family. Returns an ordered list suitable for auto-scaffolding.