Athanor.AutoEditorForm (Athanor v0.1.0-beta.5)

Copy Markdown View Source

Auto-generated editor form for components that declare fields/0.

Mounted by Athanor.Renderer when a component's fields/0 is non-empty. Wraps Athanor.Components.EditorFormShell with two tabs (Component + Formatting). The Component tab is filled by Athanor.Fields.render/1; the Formatting tab is the shared formatting surface.

Owns the LC state every editor form needs:

  • active_tab — "component" | "formatting"

  • open_sections — MapSet of expanded formatting collapsibles
  • formatting_form — Phoenix form for the formatting tab
  • props — current component prop map

Single replacement for the hand-written *.EditorForm LCs of Step 4. After Phase 5-7, Heading.EditorForm, Button.EditorForm, and Divider.EditorForm are deleted; their components declare fields/0 and this LC handles them all.

Summary

Functions

Calls module.resolve_data(old, new) if the module exports it, otherwise returns new unchanged. Exposed publicly so tests can verify the cascade without socket plumbing.

Type coercion with access to the field's previous value.

Functions

apply_resolve_data(module, old, new)

Calls module.resolve_data(old, new) if the module exports it, otherwise returns new unchanged. Exposed publicly so tests can verify the cascade without socket plumbing.

coerce(raw, type, old)

Type coercion with access to the field's previous value.

Used for :asset, whose paste-a-URL fallback wraps a bare URL string into an asset descriptor map while preserving opaque extras (alt, dimensions, …) when the URL is unchanged. All other types ignore old and delegate to coerce/2.