AshSDUI.View (ash_sdui v0.2.0)

Copy Markdown View Source

Generic intermediate representation for an Ash-backed UI view.

A view resolves resource metadata, query state, bindings, and user intents into a compact runtime model.

Summary

Functions

Resolves a resource or standalone UI module into a generic view model.

Renders a view through the existing recipe system.

Renders a view through the existing recipe system or raises.

Renders a view to a renderable tree.

Types

mode()

@type mode() :: :index | :show | :new | :edit | atom()

t()

@type t() :: %AshSDUI.View{
  action: atom() | nil,
  assigns: map(),
  bindings: [AshSDUI.Binding.t()],
  context: AshSDUI.Context.t(),
  fields: [AshSDUI.View.Field.t()],
  intents: [AshSDUI.Intent.t()],
  mode: mode(),
  name: atom(),
  nested_forms: [AshSDUI.View.NestedForm.t()],
  queries: [AshSDUI.Query.t()],
  recipe: atom(),
  refresh: term(),
  relationships: [term()],
  resource: module(),
  state: AshSDUI.View.State.t() | nil,
  ui: module(),
  workflow: term()
}

Functions

resolve(ui, mode, opts \\ [])

@spec resolve(module(), mode(), keyword()) :: {:ok, t()} | {:error, term()}

Resolves a resource or standalone UI module into a generic view model.

This is the primary entry point for generated UIs.

to_layout(view, opts \\ [])

@spec to_layout(
  t(),
  keyword()
) :: {:ok, AshSDUI.Layout.Node.t()} | {:error, term()}

Renders a view through the existing recipe system.

to_layout!(view, opts \\ [])

@spec to_layout!(
  t(),
  keyword()
) :: AshSDUI.Layout.Node.t()

Renders a view through the existing recipe system or raises.

to_tree(view, opts \\ [])

@spec to_tree(
  t(),
  keyword()
) :: {:ok, AshSDUI.Renderer.TreeNode.t()} | {:error, term()}

Renders a view to a renderable tree.