Shadix.Website.Components.Introspect (shadix v0.0.1)

Copy Markdown View Source

Derives configurator controls and props-table rows from a Phoenix function component's compile-time attr/slot metadata (module.__components__/0).

This is the single source of truth for "which props are editable" — the component declarations drive the docs UI, so they never drift.

Summary

Functions

Editable controls for the configurator. Excludes :global/:rest attrs and the universal identity/styling attrs (:class, :id).

Rows for the props reference table (all attrs incl. global, plus slots).

Types

control()

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

Functions

controls(module, function)

@spec controls(module(), atom()) :: [control()]

Editable controls for the configurator. Excludes :global/:rest attrs and the universal identity/styling attrs (:class, :id).

table_rows(module, function)

@spec table_rows(module(), atom()) :: [map()]

Rows for the props reference table (all attrs incl. global, plus slots).