# `Athanor.Editor.State`
[🔗](https://github.com/Arsenalist/athanor/blob/v0.1.0-beta.7/lib/athanor/editor/state.ex#L1)

Internal state struct owned by `Athanor.Editor.Live`.

Encapsulates the assigns the library manages on behalf of the consumer:

- `content`: the editor's node tree, persisted at `editor_content.content`
  in the canonical Athanor shape `%{"content" => [nodes...]}`
- `metadata`: flat map persisted at `editor_content.metadata` (page-level
  fields edited via the `page_settings_component:` form)
- `selected_component_id`: id of the currently-selected node (right
  sidebar shows that node's config when set)
- `column_picker`: `nil | {parent_id, zone_name}` — drives the
  zone-picker modal opened by `Athanor.Components.Columns`'
  per-zone "Add Component" button
- `preview_viewport`: `:desktop | :tablet | :mobile` — applied as
  max-width class on the canvas wrapper
- `show_components_panel`: boolean — toggles the left sidebar
- `ctx`: `Athanor.Ctx` with editor-mode fields populated
  (`edit_mode?: true`, `add_component_callback`, `select_component_callback`)

# `t`

```elixir
@type t() :: %Athanor.Editor.State{
  asset_request: Athanor.Editor.AssetRequest.t() | nil,
  column_picker: {String.t(), String.t()} | nil,
  content: map(),
  ctx: Athanor.Ctx.t() | nil,
  metadata: map(),
  preview_viewport: viewport(),
  selected_component_id: String.t() | nil,
  show_components_panel: boolean()
}
```

# `viewport`

```elixir
@type viewport() :: :desktop | :tablet | :mobile
```

# `new`

Build a default state. Useful for tests and as the seed value the
Editor LV macro uses before `load/3` fills in real values.

# `new`

Build a state with overrides. Unknown keys raise `KeyError`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
