PhiaUiDesign.Catalog.Introspector (phia_ui v0.1.17)

Copy Markdown View Source

Introspects Phoenix component modules to extract attrs, slots, and metadata.

Uses Phoenix.Component's __components__/0 callback which returns component function metadata at runtime — always up-to-date, no stale JSON risk.

Summary

Functions

Get component info by registry key (atom).

Introspect ALL registered PhiaUI components by combining the registry with runtime module introspection.

Introspect a specific component function from a module.

Introspect a single Phoenix component module.

Types

attr_info()

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

component_info()

@type component_info() :: %{
  name: atom(),
  module: module(),
  attrs: [attr_info()],
  slots: [slot_info()],
  doc: String.t() | nil
}

slot_info()

@type slot_info() :: %{name: atom(), required: boolean(), doc: String.t() | nil}

Functions

get_component_info(component_key)

@spec get_component_info(atom()) :: map() | nil

Get component info by registry key (atom).

introspect_all()

@spec introspect_all() :: [map()]

Introspect ALL registered PhiaUI components by combining the registry with runtime module introspection.

introspect_component(module, func_name)

@spec introspect_component(module(), atom()) :: component_info() | nil

Introspect a specific component function from a module.

introspect_module(module)

@spec introspect_module(module()) :: [component_info()]

Introspect a single Phoenix component module.

Returns a list of component definitions with their attrs and slots. Uses __components__/0 which Phoenix.Component exposes on compiled modules.