Skip to main content

Module tree

Module tree 

Source
Expand description

The Studio’s tree: the file browser’s folders and files and the Logic column’s Syntax Tree are both drawn by it, so they read alike.

Tree holds the geometry, the lines’ snapping to the device-pixel grid and the chevron’s look; TreeNode draws one node — the line it hangs from, its row, its parts while it is open. Each user walks its own data and gives every node its row’s content.

A tree answers the keyboard as the WAI-ARIA tree pattern says: it is one tab stop, on the selected row (or the row its user marks when none is), the arrows walk the rows a reader sees, Home and End reach the ends, Right opens a node and then enters it, Left closes it and then climbs to its parent, and Enter or Space press the row. next_row decides each key from the rows’ shapes alone.

Re-exports§

pub use Tree_completions::Component::Tree;
pub use TreeNode_completions::Component::TreeNode;

Structs§

RowShape
A row as the keys see it.
TreeNodeProps
Properties for the TreeNode component.
TreeProps
Properties for the Tree component.

Enums§

TreeKey
A key the tree answers.
TreeMove
What a key does from a row.

Constants§

TREE_STYLE
The tree’s geometry is one step. Its first line stands --tree-step from the tree’s edge, every level’s line one step further in, and every branch runs one step, from its parent’s line to its own; a row’s first glyph (a node’s chevron, else the first thing in its row) sits --tree-gap past the end of its branch. Every length snaps to whole device pixels (--dp, one device pixel in CSS pixels, is set from the page’s device pixel ratio), and the tree’s content starts on a device pixel wherever the layout puts the tree (--dp-nudge-x/-y, under one device pixel, pad it onto the grid), so each line covers whole screen pixels at any zoom and all read at one weight, --tree-hair: about 1.5px and never under two device pixels. A tree sets how far its content stands from its top and bottom with --tree-pad-top and --tree-pad-bottom (the Studio’s inset by default), each held to whole device pixels.

Functions§

Tree
A tree, its nodes drawn inside it. kind names it and its parts: the tree is the element of class {kind} (marked data-tree), and each node, row and open node’s parts carry {kind}-node, {kind}-item and {kind}-children beside the shared classes. The file browser’s tree is file-tree.
TreeNode
One node of a Tree: the line it hangs from (below the top level), its row — its branch, its chevron if it has parts, then row — and its parts, children, while it is open.
next_row
What key does from row at of rows, the rows a reader sees in order.
tree_key
The key a keyboard event names, if the tree answers it.