<t-flow>
Live elements laid out as a graph of what feeds what. Each child is a node. An arrow runs from one node to another when the second reads a variable the first defines, so the arrows come from the page itself.
Range noise ±
Nobody wrote down the arrows. The code cell (folded, open it with its arrow) reads the
beacons, your position and the noise, and the chart and the sentence read its fixes. The
spec only adds captions, widths and the fold.
Nodes and ids
Every child element is a node, apart from <script>, <style> and the elements that show
nothing (<t-var>, <t-let>, <t-fetch>). A node can be anything: a paragraph, a chart, a
code cell, or a whole <div> of them. Even another <t-flow> works as a single node.
The spec names a node by its id. That's its id attribute if it has one. Otherwise it's the
one variable it defines, so above the paragraph with <t-num name="noise"> is noise, and
the <div> with eight <t-var>s needs id="map". Failing both, it's n0, n1, … by position.
Arrows
An arrow runs from A to B when something in B reads a variable that something in A defines.
It also looks through formulas that no node defines, so a <t-let> between the two still
links them. When a longer path already connects two nodes, the direct arrow between them is
left out. edgeLabels: true writes the variables each arrow carries next to it:
Length
Gravity
edges changes the arrows. An entry for an arrow that's already there restyles it, and any
other entry adds one:
| Entry | Does |
|---|---|
["a", "b"] | Adds an arrow from a to b. |
["a", "b", "label"] | Adds one with a label, or labels the one that's there. |
["a", "b", { … }] | Adds or restyles one: label, color, dashed, exit, enter. |
["a", "b", false] | Drops the inferred arrow. |
infer: false turns inference off, and then only the arrows in edges are drawn. If the
arrows go round in a circle, an error says which nodes are involved, and you can break the
circle with false.
Ports
An arrow leaves the far side of a node and lands on the near side of the next one, spread
out with the arrows that share that side. exit and enter pick the sides yourself:
"top", "bottom", "left" or "right", or a side and a position along it from 0 to 1,
like ["right", 0.25]. An arrow with ports is routed around the other nodes.
Layout
Nodes sit in rows, one below the deepest node that feeds them. direction: "right" lays the
rows out as columns, left to right. A few keys move nodes around:
row: non a node pushes it down to at least rown(counting from 0), and the nodes it feeds move down with it.beside: "id"puts a node in the same row asid, right after it.beside: ["id", "before"]puts it right before. An arrow between the two joins their facing sides.align: "left"(or"right";"top"or"bottom"going right) puts every row on one grid, so the first node of each row shares a column and a chain down it gets straight arrows. The default,"center", centers each row on its own.
Mass
Spring
Amplitude
Captions, notes and widths
label puts a caption under a node. note puts text beside it with a short arrow, and the
text can have bold and $math$. width sets how wide the node is, in pixels or any CSS
length. Charts and code cells take whatever width they get, so give them one.
Folding
fold: true gives a node a small button in its corner, which shows when you hover over it.
The button folds the node into a pill with just its caption, and the rest of the diagram
moves up to fill the gap. fold: "closed" starts it folded.
groups draws a dashed frame around several nodes, with a tab that folds them all into one
pill. Arrows in and out of the group land on the pill. A group has to include every node on a
path between two of its own nodes, since the pill replaces all of them.
Length
Gravity
From JavaScript
el.edges lists the arrows as [from, to] pairs of node ids. el.upstream(id) and
el.downstream(id) list the nodes that feed id and that id feeds, directly or not.
Spec keys
The spec goes in a <script type="text/plain"> inside the element. It's one JavaScript
expression, written like JSON, and every key is optional.
| Key | Description |
|---|---|
direction | "down" (the default) or "right". |
align | "center" (the default), "left" or "right"; going right, "top" or "bottom". See Layout. |
nodes | Options per node, by id: label, note, width, fold, row, beside. A string is short for { label }. |
edges | Arrows to add, restyle or drop. See Arrows. |
groups | A list of { label, nodes, collapsed }. See Folding. |
infer | false draws only the arrows in edges. |
edgeLabels | true labels the inferred arrows with the variables they carry. |
The look comes from custom properties on .tangle-flow: --tangle-flow-edge (the arrows),
--tangle-flow-note, --tangle-flow-bg (behind crossings and pills),
--tangle-flow-layer-gap and --tangle-flow-node-gap.