Module

Hylograph.Flow.Render.Tree

Package
purescript-hylograph-flow-render
Repository
afcondon/purescript-hylograph-flow-render

A layout as a HATS tree: one SVG, edges under nodes.

An item (what holds a value) is an open box; a step (what computes) is a filled lozenge. An edge is one stroked path, as wide as the layout says: a hairline in a plain picture, a band in a Sankey; an edge turned back to close a cycle is dashed where it is a hairline.

Everything else about an element is the caller's: its label, a short note beside the label, a class and a colour (Decoration), and whatever an Overlay knows of it (withOverlay). Clicks and the pointer's coming and going are told to the caller by element.

What is drawn, for a stylesheet or a test to find:

svg.flow
  g.flow-edges > path.flow-edge[.flow-backward][data-edge][data-from][data-to]
  g.flow-nodes > g.flow-node.flow-item|.flow-step[data-key]
                   > rect.flow-box, rect.flow-swatch?, text.flow-label, text.flow-note?

#Mark Source

type Mark = { className :: String, colour :: Maybe String, label :: String, note :: Maybe String }

A node's dress. note: a few letters beside the label (an operation, a count). className: added to the node's classes. colour: a step's fill, an item's swatch; Nothing for the ink.

#Line Source

type Line = { className :: String, colour :: Maybe String }

An edge's dress.

#Gesture Source

#Pointed Source

data Pointed

What a gesture was made on. A node is its element. An edge is a wire where it is exactly one (Both, and any edge between a drawn item and a drawn step); otherwise it is the path it stands for, with the undrawn elements it passes through.

Constructors

Instances

#Decoration Source

type Decoration wire = { edge :: Edge wire -> Line, node :: Node -> Mark, notify :: Gesture -> Pointed -> Effect Unit }

#plainDecoration Source

plainDecoration :: forall wire. Decoration wire

Each node under its own label, nothing else said, gestures ignored.

#withOverlay Source

withOverlay :: forall a wire. Overlay a -> (a -> Mark -> Mark) -> (a -> Line -> Line) -> Decoration wire -> Decoration wire

A decoration changed by what an overlay knows: of a node, by its key; of an edge that is one wire, by the wire's.

#pointedBy Source

pointedBy :: forall wire. Edge wire -> Pointed

What an edge is, for a gesture or an overlay: the wire it is, where it stands for one wire, by the identity the edge carries.

#keyName Source

keyName :: ElementKey -> String

An element's key as one string, for data-key and for HATS's keys. A closed group's step is group: and the group's id where a source's step is step: and its name, so a step and a group never share a key. Inside a wire's key the step and the port are written as they read (stepLabel, portLabel).

#tree Source

tree :: forall wire. Decoration wire -> Layout wire -> Tree