A layer on a template (spec/06 §2.3): %Macaw.Template.Layer{name, on, regions, order, layout, params, disclosures, mask}, a fragment of a template holding only what it gives.
name, its name, andon, the template it stacks on, both required;regions, what it changes of each region by name, a region's keys but its name; a region the template lacks is added;order, the regions' order restated, andlayout, the layout restated, ornil;params, values of the template's params by name;disclosures,:openor:default, ornil;mask, the paths it drops from below before it stacks, or:all.
A layer is written in code with use Macaw.Template and layer/2, or built from its
keys by new/1. Macaw.Template.stack/2 stacks it.
iex> {:ok, layer} = Macaw.Template.Layer.new(name: :full_width, on: :site, regions: [sidebar: [hidden: true]])
iex> {layer.on, layer.regions}
{"site", %{"sidebar" => %{hidden: true}}}
Summary
Functions
Whether a term is a mask's path, read with its names spelled: {:ok, path} or :error.
The paths are [:regions], [:regions, region], [:regions, region, key],
[:params], [:params, param], [:order], [:layout] and [:disclosures].
A layer from a keyword list or a map with atom keys: {:ok, layer} or every fault at
once by path. name and on are :required or {:type, :name}; a region's key is
judged as Macaw.Region.new/1 judges it, at [:regions, region, key], its name
:unknown_key, and a region name that isn't one {:type, :name} at [:regions, region]; an order that isn't a list of names {:type, :order}; a layout as a
template's; a param name that isn't one {:type, :name}; disclosures
{:enum, [:default, :open]}; a mask's path that isn't one of a template's
{:type, :mask} at [:mask, i]; another key :unknown_key.
Types
Functions
Whether a term is a mask's path, read with its names spelled: {:ok, path} or :error.
The paths are [:regions], [:regions, region], [:regions, region, key],
[:params], [:params, param], [:order], [:layout] and [:disclosures].
iex> Macaw.Template.Layer.mask_path([:regions, :sidebar, :content])
{:ok, [:regions, "sidebar", :content]}
iex> Macaw.Template.Layer.mask_path([:regions, :sidebar, :name])
:error
@spec new(map() | keyword()) :: {:ok, t()} | {:error, [Macaw.Base.Fault.t(), ...]}
A layer from a keyword list or a map with atom keys: {:ok, layer} or every fault at
once by path. name and on are :required or {:type, :name}; a region's key is
judged as Macaw.Region.new/1 judges it, at [:regions, region, key], its name
:unknown_key, and a region name that isn't one {:type, :name} at [:regions, region]; an order that isn't a list of names {:type, :order}; a layout as a
template's; a param name that isn't one {:type, :name}; disclosures
{:enum, [:default, :open]}; a mask's path that isn't one of a template's
{:type, :mask} at [:mask, i]; another key :unknown_key.