Macaw.Page.Validated (macaw v0.6.0)

Copy Markdown View Source

A page that passed its static pass (spec/06 §1.2): %Macaw.Page.Validated{page, stack, regions, plan, targets, navigations}.

  • page, the page;
  • stack, its stacked template, Macaw.Template.stack/2's %Macaw.Template.Stacked{} (spec/06 §2);
  • regions, each filled region's validated surfaces in flow order, %{region => [%Macaw.Surface.Validated{}]};
  • plan, the union of its components' declarations: observes, every observation they can emit (spec/10 §5); stylesheets, every stylesheet path its layouts and components serve from 'self' (spec/10 §1); proxy_routes, every route they proxy media through; each list once per entry, in order;
  • targets, the pages its navigate actions go to, by name, the page itself among them (spec/06 §5);
  • navigations, each cell with navigate actions by its instance id, %{instance => [%{index: i, on: event, navigate: page, params: params}]}, built here once, so Macaw.Page.steps/2 reads the one cell an event names;
  • graph, the page's DAG, a Macaw.Page.Graph (spec/03 §6): its sources, its derived sources (derived:) and its surfaces' state and exports as nodes, its bindings as edges, acyclic;
  • surfaces, every surface the page holds, its containers' panes among them, in page order (spec/05 §5.1): Macaw.Page.surfaces/1's answer. The plan, the navigations and the page params state reads are read over them, so a pane counts as any surface.
  • index, the surfaces found by what names them, built here once, so rendering a page's containers searches no list (spec/05 §5.2, #414): surfaces, each entry by its surface's name; panes, each pane's entry by {surface, cell, pane}; and initial, each surface's state at its initial values, Macaw.State.new/1's answer, for a surface rendered with no state given.

How an observation reaches the host, and the policy header itself, are the web's (#167); the page gives the plans.

Summary

Types

One surface the page holds, as Macaw.Page.surfaces/1 answers it.

t()

Types

entry()

@type entry() :: %{
  surface: String.t(),
  validated: Macaw.Surface.Validated.t(),
  at: [term(), ...],
  depth: pos_integer(),
  container: nil | %{surface: String.t(), cell: String.t(), pane: String.t()}
}

One surface the page holds, as Macaw.Page.surfaces/1 answers it.

plan()

@type plan() :: %{
  observes: [atom()],
  stylesheets: [String.t()],
  proxy_routes: [term()]
}

t()

@type t() :: %Macaw.Page.Validated{
  graph: Macaw.Page.Graph.t() | nil,
  index: %{
    surfaces: %{required(String.t()) => entry()},
    panes: %{required({String.t(), String.t(), String.t()}) => entry()},
    initial: %{
      required(String.t()) =>
        {:ok, Macaw.State.t()} | {:error, [Macaw.Base.Fault.t(), ...]}
    }
  },
  navigations: %{required(String.t()) => [map()]},
  page: Macaw.Page.t(),
  plan: plan(),
  regions: %{required(String.t()) => [Macaw.Surface.Validated.t()]},
  stack: term(),
  surfaces: [entry()],
  targets: %{required(String.t()) => Macaw.Page.t()}
}