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.
The tree draws a Layout (Hylograph.Flow.Render.Engine) and does not
know which engine made it: every engine's layout is drawn by this one
function.
An item (what holds a value) is an open box; a step (what computes) is
a filled lozenge. An edge is one stroked path along its route
(Route.svgPath): a ribbon as its ink says (a band as broad as it is,
or a hairline down its middle), a polyline or a spline as a hairline; an
edge turned back to close a cycle is dashed where it is a hairline. A
port the engine placed is a small square on its node's side, open for
an input and filled for an output, over the edges, so that an edge's
end is seen to meet it.
The layout's direction is the root's data-direction. A node's words
are set from its left side where the flow runs left to right (its
edges enter and leave by its ends, and the words read along it), and
about its middle where the flow runs top-down (its edges enter and
leave above and below its middle); an item's swatch is along the side
the flow enters by.
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.
A closed group (Hylograph.Flow.Grouping.collapse) is a step and, where
it provides anything, a summary item, and is drawn as any step and any
item are. Whether it should look otherwise is the caller's to say too:
withGroups changes the marks of a group's step and summary, by group.
An open group, where the layout was told of groups, is an outline under
everything else: a quiet box round its members with its name in a strip
at the top. The name is what takes gestures (a tab behind it, as wide
as the name), told as PointedGroup, so a page can shut a group by a
click on its name; the box itself takes none, and what is inside it is
reached through it.
Words: where the layout set a node's words (Picture.words), those
lines are drawn, the title's and then the detail's, and the mark's
label is not used; its note stands at the right of the first line.
Where it did not, the mark's label is written on one line, as in 0.2.
What is drawn, for a stylesheet or a test to find:
svg.flow[data-direction=left-to-right|top-down]
g.flow-outlines > g.flow-outline[data-group][data-depth]
> rect.flow-outline-box, rect.flow-outline-tab, text.flow-outline-label
g.flow-edges > path.flow-edge.flow-ribbon|.flow-polyline|.flow-spline
.flow-band|.flow-hairline[.flow-backward][data-edge][data-from][data-to]
g.flow-nodes > g.flow-node.flow-item|.flow-step[.flow-lettered][data-key]
> rect.flow-box, rect.flow-swatch?, text.flow-label,
text.flow-label-more*, text.flow-detail*, text.flow-note?,
rect.flow-port.flow-port-in|.flow-port-out[data-port]*
#Pointed Source
data PointedWhat 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. An open group's outline is its group.
Constructors
PointedElement ElementKeyPointedPath { from :: ElementKey, to :: ElementKey, via :: Array ElementKey }PointedGroup GroupId
Instances
#plainDecoration Source
plainDecoration :: forall wire. Decoration wireEach 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 wireA decoration changed by what an overlay knows: of a node, by its key; of an edge that is one wire, by the wire's.
#withGroups Source
withGroups :: forall wire. (GroupId -> Mark -> Mark) -> Decoration wire -> Decoration wireA decoration changed for closed groups: the mark of a group's step and
of its summary item, by the group. (A click on either is told as any
click is, by its element; groupOf says which group that is, for a
page that opens a group where it stands.)
#groupOf Source
groupOf :: ElementKey -> Maybe GroupIdThe closed group an element is: its step or its summary item.
#keyName Source
keyName :: ElementKey -> StringAn 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;
likewise a closed group's summary item is summary: and the group's id
where a source's item is item: and its name. Inside a wire's key the
item, the step and the port are written as they read (itemLabel,
stepLabel, portLabel).
#directionName Source
directionName :: Direction -> StringA direction as the root's data-direction says it.