Macaw.Component.Assigns (macaw_component v0.13.0)

Copy Markdown View Source

The assigns a component renders with (spec/02 §1): context, settings, declarations, drawn, deliveries, value, prepared and held, and nothing else. Nothing else reaches a component: not the viewer, not another component, not the page.

Summary

Functions

The eight keys, in order.

The assigns from a keyword list or a map: {:ok, assigns}, or every fault at once, a missing key :required and one it doesn't know :unknown_key. A pure component's value is nil; a contained one's deliveries is %{}. prepared, the data the placement prepared (Macaw.Component.prepare/3), may be left out: it is nil, as it is for a component without prepare/2. held, the rows the host already holds by {scope, version} (spec/02 §1.2), may be left out too: it is nil, and a map otherwise ({[:held], :bad_value}).

Functions

keys()

@spec keys() :: [atom(), ...]

The eight keys, in order.

new(attrs)

@spec new(keyword() | map()) ::
  {:ok, map()} | {:error, [Macaw.Component.fault(), ...]}

The assigns from a keyword list or a map: {:ok, assigns}, or every fault at once, a missing key :required and one it doesn't know :unknown_key. A pure component's value is nil; a contained one's deliveries is %{}. prepared, the data the placement prepared (Macaw.Component.prepare/3), may be left out: it is nil, as it is for a component without prepare/2. held, the rows the host already holds by {scope, version} (spec/02 §1.2), may be left out too: it is nil, and a map otherwise ({[:held], :bad_value}).