AshUi.Patch.Table (ash_ui v0.1.0)

Copy Markdown View Source

Compiled patch table for one resource view: every dynamic position in the lowered view becomes a slot with a stable address, an evaluator, and the dependency field paths that invalidate it; the propagation index inverts dependencies to slot ids. Nested render(Resource, input) compiles the child resource's own table under an address prefix.

This is compile-derived data (internals of the compiled artifact), not model vocabulary: the view stays an Ash calculation; this table is its partial evaluation staged for change-driven patch emission.

Summary

Types

slot()

@type slot() :: %{
  id: term(),
  addr: String.t(),
  kind: :text | :attrs | :branch | :keyed_list | :child,
  deps: [atom()],
  eval: (AshUi.Expr.Scope.t() -> term()),
  meta: map()
}

t()

@type t() :: %AshUi.Patch.Table{
  children: %{required(String.t()) => t()},
  collection_slots: %{required(atom()) => [term()]},
  error_slots: term(),
  event_elements: %{required(String.t()) => map()},
  propagation: %{required(atom()) => [term()]},
  propagation_addresses: %{required(atom()) => MapSet.t(String.t())},
  resource: module() | nil,
  root: term(),
  root_slot_ids: [term()] | nil,
  skeleton: AshUi.Patch.Skeleton.t() | nil,
  slots: %{required(term()) => slot()},
  target: module(),
  view: atom()
}