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.
A node's inside (0.4): where the decoration draws a node's inside
(Decoration.inside), the tree draws nothing of the node but that and
its ports: no box, no label, no words, no swatch, no note. The inside
is a HATS tree in the node's own coordinates, its box's top left at
0,0, placed by a g.flow-inside translated to the box. It is for a node
the caller sized (Picture.fixed), such as a table of rows, whose
inside only the caller knows how to draw; the tree still places it,
keys it, and tells its gestures.
The keyboard (0.5): a mark the decoration calls a button
(Decoration.button) can be reached by the Tab key and says what it is
to a screen reader (tabindex="0", role="button", and the name given
as its aria-label); the others are as they were. HATS tells clicks and
the pointer and no keys, so pressing a button is the page's to arrange
once: Hylograph.Flow.Render.Keys.pressByKeys makes Enter and Space on
a focused button a click on it, which is then told as any click is.
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.
Legibility (0.7; treeWith and its Dress, none of it drawn by tree
or treeLabelled unless said):
- a ribbon that runs against the flow carries marks of its direction
along it, and no other ribbon does (
Dress.marks); - a ribbon drawn broader than it is (
Ink.Least) is dashed and has the classflow-not-to-scalein any tree, and withDress.marksa break mark across its middle; - a closed group's bar shows its seams (
Dress.seams, which the unfolding engine'sseamsgives): a line across the bar where two parts divide, and beside a part that only receives a wall on the side nothing leaves by, beside one that only gives a wall on the side nothing enters by; - a group's name is a heading (
Dress.headings): a closed top-level group's name stands over the start of its bar, where its outline's name stands when it is open, in the same letters, so the name is in one place closed and open; and the labels of the nodes inside an open group are lighter and smaller than it; - a group that has several outlines (the unfolding engine's tied outlines: one for each run of its members) has its name on each and a tie drawn from each to the next.
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][data-run]
> rect.flow-outline-box, rect.flow-outline-tab, text.flow-outline-label[.flow-group-name]
g.flow-ties? > path.flow-tie[data-group] (where a group has several outlines)
g.flow-marks? > path.flow-direction[data-edge] | path.flow-scale-break[data-edge] (Dress.marks)
(in a node, Dress.seams:) rect.flow-seam*, rect.flow-only[data-only=receives|gives][data-part]*
(Dress.headings:) text.flow-label.flow-group-name on a closed top-level group; .flow-part-name on a part's label
g.flow-edges > path.flow-edge.flow-ribbon|.flow-polyline|.flow-spline
.flow-band|.flow-hairline[.flow-backward][.flow-swept][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]*
| g.flow-node.flow-drawn > g.flow-inside[transform] > (the caller's),
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
#Bands Source
data BandsHow a ribbon that is a band is drawn (0.5).
Stroked: one path along its centre line, stroked as broad as the ribbon is, as since 0.1. Right where a ribbon runs nearly straight along the flow. Where it slants it is too thin, and its ends are not flat on its nodes, because a stroke is broad across the line and not across the flow: a ribbon 200 pixels broad that shifts 150 across in a run of 90 bulges past both nodes.Swept: the area the ribbon's span on its source sweeps to its span on its target (Route.sweptPath), filled and not stroked: flat on both nodes, and as broad across the flow all the way as the ribbon is. Its colour is then itsfill, which is what a stylesheet must set. A band turned back to close a cycle, which runs both ways along the flow, is stroked either way; so is a ribbon too thin to be drawn as a band (3 pixels or less), which is a line.
Constructors
Instances
#Labels Source
data LabelsWhere a node's label is written (0.6; treeLabelled).
Within: in its box, as since 0.1.Beside least: beside its box, for a node that is a thin bar and as broad as its ribbons, no more (the unfolding engine's): after it along the flow where the picture has room and before it where it has not, left to right; over it, or under it in the first row, top-down. In the ink's colour, since it is on the paper. A node less thanleastpixels across the flow has no label drawn (its mark has the classflow-unlabelled): labels beside bars that touch would run into one another. And a step is then a bar with square corners, so that parts that stand with no gap between them tile.
Constructors
Instances
#Decoration Source
type Decoration wire = { bands :: Bands, button :: Pointed -> Maybe String, edge :: Edge wire -> Line, inside :: Node -> Maybe Tree, node :: Node -> Mark, notify :: Gesture -> Pointed -> Effect Unit }inside (0.4): a node's inside, drawn by the caller in the node's own
coordinates, for the nodes it draws; see the module's header.
button (0.5): the marks that are buttons for the keyboard, each with
the name it is announced by; Nothing for a mark that is none.
bands (0.5): how a ribbon that is a band is drawn.
#plainDecoration Source
plainDecoration :: forall wire. Decoration wireEach node under its own label, nothing else said, gestures ignored, no inside drawn by the caller, no mark a button, bands stroked.
#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.
#treeLabelled Source
treeLabelled :: forall wire. Labels -> Decoration wire -> Layout wire -> TreeThe tree with each node's label written where it is told (0.6):
tree is treeLabelled Within. (Not a field of Decoration, so that
no decoration written out whole before 0.6 has to change.)
#plainDress Source
plainDress :: DressLabels within their boxes, and nothing of 0.7's: tree's own dress.
- Modules
- Hylograph.
Flow. Render. Columns - Hylograph.
Flow. Render. Continuity - Hylograph.
Flow. Render. Engine - Hylograph.
Flow. Render. Internal. Bands - Hylograph.
Flow. Render. Keys - Hylograph.
Flow. Render. Laws - Hylograph.
Flow. Render. Layout - Hylograph.
Flow. Render. Measures - Hylograph.
Flow. Render. Motion - Hylograph.
Flow. Render. Present - Hylograph.
Flow. Render. Reshape - Hylograph.
Flow. Render. Route - Hylograph.
Flow. Render. Sankey - Hylograph.
Flow. Render. Signal - Hylograph.
Flow. Render. Text - Hylograph.
Flow. Render. Transition - Hylograph.
Flow. Render. Tree - Hylograph.
Flow. Render. Unfold