Macaw.Frame.TextForms.PageFlow (macaw_frame v0.1.0)

Copy Markdown View Source

The pageFlow text form (spec/02 §11.3, spec/13 §7.5): a page's data flow walked as a nested list, source by source, read into the layered design diagrams.page_flow draws (Macaw.Frame.TextForms).

pageFlow TB
  source services
    input 1 -> derived busy
      slot rows -> cell notes.busy
    slot rows -> cell health.load
  state health.filter
    export -> export health.service
      input 0 -> derived busy
  • The header is pageFlow and its direction, TB (or TD), BT, LR or RL, TB by default: the layered step's direction.
  • A line names a node by its kind and its name, source services; the kinds are source, derived, state, export and cell, and the node's id is <kind>:<name>. A line indented under another is a node the other's binding feeds, the binding's label before an arrow, slot rows -> cell health.load (-> cell x for a binding of no label). A line at the outermost indent is an entry and takes no arrow. A node named again is the same node; its first line carries what it feeds.

Rows: nodes (id, kind, label) in order of first appearance, edges (source, target, label) in order. Faults, every one at once, at its line and column: {:direction, word}, {:expected, :kind} for a line whose first word is no kind, {:expected, :name} for a kind named alone, {:unexpected, "->"} for an arrow on an entry and {:expected, "->"} for an indented line of none.

print/1 walks the flow: each entry (a node no binding feeds, in node order, then any node no walk reached), and under each node, the first time it is written, every binding it feeds, in edge order, so each node and each edge is written once and a node fed twice is named again where its second binding reaches it. text/3 writes rows the same way, in whatever order they come.

Summary

Functions

The kinds of a page's nodes, in flow order.

Each kind's shape, as the layered step's shapes pairs.

The flow of nodes and edges rows (string-keyed, as the slots read them) written in this form under a header of direction ("TB", "LR", "BT" or "RL"): {:ok, text}, or :error for rows it can't write (a node of no kind, a name or label of a line break or an arrow).

Functions

kinds()

@spec kinds() :: [String.t(), ...]

The kinds of a page's nodes, in flow order.

shapes()

@spec shapes() :: [[String.t()]]

Each kind's shape, as the layered step's shapes pairs.

text(nodes, edges, direction \\ "TB")

@spec text([map()], [map()], String.t()) :: {:ok, String.t()} | :error

The flow of nodes and edges rows (string-keyed, as the slots read them) written in this form under a header of direction ("TB", "LR", "BT" or "RL"): {:ok, text}, or :error for rows it can't write (a node of no kind, a name or label of a line break or an arrow).