Sign in

    moonrockz/diagrams-svg/data-tree-layout does not have a README file

    Box

    pub struct Box {
    node : String
    kind : Kind
    box : Rect
    divider : Double?
    rows : ReadOnlyArray[Row]
    label : Label?
    highlighted : Bool
    depth : Int
    } derive(Eq,
    Debug
    )

    One box: a container with its rows, or a scalar root.

    Box::equal

    fn Box::equal(Box, Box) -> Bool

    Box::not_equal

    fn Box::not_equal(x : Box, y : Box) -> Bool

    Box::to_repr

    Connector

    pub struct Connector {
    entry : String
    source : String
    target : String
    points : ReadOnlyArray[Point]
    } derive(Eq,
    Debug
    )

    A drawn connector from a row to the box of its nested container. The points are the start, the end of the straight part, two curve controls and the end.

    Connector::equal

    fn Connector::equal(Connector, Connector) -> Bool

    Connector::not_equal

    fn Connector::not_equal(x : Connector, y : Connector) -> Bool

    Connector::path

    fn Connector::path(self : Connector) -> String

    The SVG path data of the connector.

    Connector::samples

    fn Connector::samples(self : Connector, count? : Int) -> Array[Point]

    Sample points along the connector, for checks.

    Finding

    pub struct Finding {
    rule : Rule
    identities : ReadOnlyArray[String]
    message : String
    } derive(Eq,
    Debug
    )

    Finding::equal

    fn Finding::equal(Finding, Finding) -> Bool

    Finding::not_equal

    fn Finding::not_equal(x : Finding, y : Finding) -> Bool

    Finding::to_repr

    Geometry

    pub struct Geometry {
    tree :
    DataTree

    width : Int
    height : Int
    title : Label?
    boxes : ReadOnlyArray[Box]
    connectors : ReadOnlyArray[Connector]
    } derive(Eq,
    Debug
    )

    The measured geometry of one data view.

    Geometry::equal

    fn Geometry::equal(Geometry, Geometry) -> Bool

    Geometry::not_equal

    fn Geometry::not_equal(x : Geometry, y : Geometry) -> Bool

    Geometry::to_repr

    Ink

    pub(all) enum Ink {
    Key
    Index
    Text
    Number
    Boolean
    Null
    Container
    Title
    } derive(Eq,
    Debug
    )

    The ink of a label. Each scalar kind has its own ink.

    Ink::equal

    fn Ink::equal(Ink, Ink) -> Bool

    Ink::not_equal

    fn Ink::not_equal(x : Ink, y : Ink) -> Bool

    Ink::to_repr

    Ink::token

    fn Ink::token(self : Ink) -> String

    The theme token of the ink: text, muted or a family ink.

    Kind

    pub(all) enum Kind {
    Object
    Array
    String
    Number
    Boolean
    Null
    } derive(Eq,
    Debug
    )

    The kind of a value, as written in the data-type attribute.

    Kind::equal

    fn Kind::equal(Kind, Kind) -> Bool

    Kind::name

    fn Kind::name(self : Kind) -> String

    Kind::not_equal

    fn Kind::not_equal(x : Kind, y : Kind) -> Bool

    Kind::to_repr

    Label

    pub struct Label {
    lines : ReadOnlyArray[String]
    box : Rect
    size : Double
    weight : Int
    ink : Ink
    } derive(Eq,
    Debug
    )

    One measured label. lines are the wrapped lines; with the line breaks that wrapping replaced, they give the complete text.

    Label::equal

    fn Label::equal(Label, Label) -> Bool

    Label::not_equal

    fn Label::not_equal(x : Label, y : Label) -> Bool

    Label::to_repr

    Limits

    pub struct Limits {
    nodes : Int
    depth : Int
    work : Int
    width : Int
    output_units : Int
    minimum_approach : Double
    } derive(Eq,
    Debug
    )

    Explicit bounds for structured-data layout and painting.

    Limits::equal

    fn Limits::equal(Limits, Limits) -> Bool

    Limits::new

    fn Limits::new(nodes? : Int, depth? : Int, work? : Int, width? : Int, output_units? : Int, minimum_approach? : Double) -> Limits

    Limits::not_equal

    fn Limits::not_equal(x : Limits, y : Limits) -> Bool

    Limits::to_repr

    Limits::with_minimum_approach

    fn Limits::with_minimum_approach(self : Limits, minimum_approach : Double) -> Limits

    Point

    pub(all) struct Point {
    x : Double
    y : Double
    } derive(Eq,
    Debug
    )

    Point::equal

    fn Point::equal(Point, Point) -> Bool

    Point::not_equal

    fn Point::not_equal(x : Point, y : Point) -> Bool

    Point::to_repr

    Rect

    pub(all) struct Rect {
    x : Double
    y : Double
    width : Double
    height : Double
    } derive(Eq,
    Debug
    )

    Rect::bottom

    fn Rect::bottom(self : Rect) -> Double

    Rect::contains

    fn Rect::contains(self : Rect, other : Rect, tolerance? : Double) -> Bool

    Rect::equal

    fn Rect::equal(Rect, Rect) -> Bool

    Rect::not_equal

    fn Rect::not_equal(x : Rect, y : Rect) -> Bool

    Rect::overlaps

    fn Rect::overlaps(self : Rect, other : Rect) -> Bool

    Rect::right

    fn Rect::right(self : Rect) -> Double

    Rect::to_repr

    Result

    pub struct Result {
    geometry : Geometry?
    diagnostics : ReadOnlyArray[
    Diagnostic
    ]
    }

    Row

    pub struct Row {
    entry : String
    node : String
    kind : Kind
    box : Rect
    key : Label?
    value : Label?
    highlighted : Bool
    port : Point?
    } derive(Eq,
    Debug
    )

    One member row of a container box.

    Row::equal

    fn Row::equal(Row, Row) -> Bool

    Row::not_equal

    fn Row::not_equal(x : Row, y : Row) -> Bool

    Row::to_repr

    Rule

    pub(all) enum Rule {
    Overlap
    Fit
    Size
    Contrast
    Containment
    Endpoint
    Limit
    } derive(Eq,
    Debug
    )

    The rule that a legibility finding breaks.

    Rule::equal

    fn Rule::equal(Rule, Rule) -> Bool

    Rule::not_equal

    fn Rule::not_equal(x : Rule, y : Rule) -> Bool

    Rule::to_repr

    check

    fn check(geometry : Geometry, palette :
    Palette
    , work_limit? : Int) -> ReadOnlyArray[Finding]

    Check measured data geometry independently of its painter: row bounds, label clearance and fit, overlaps, connector attachment and crossings, text size and the contrast of every label on its background, including highlighted rows. The check is bounded by work_limit.

    display_text

    fn display_text(value :
    Value
    ) -> String

    The visible text of a value. Text and number lexemes are exact. Booleans and null have a mark, so they do not look like text with the same letters. A row of a nested container shows {…} or […], or {} or [] when the container is empty.

    highlight_background

    The background of a highlighted row: the cloud family fill over the box fill.

    ink_of

    fn ink_of(kind : Kind) -> Ink

    The ink of a scalar or container value.

    label_clearance

    let label_clearance : Double

    The smallest space between a label and the edge of its row.

    layout

    Measured data geometry. Each container is a box with ordered rows; arrays show the position of each row. A nested container is a separate box in the next column, joined by a connector from its row. Inline scalars stay in their row, with no connector. Empty containers and a scalar root are visible boxes. Layout is iterative and every bound is explicit; exhaustion gives a diagnostic and no geometry.

    palette

    The palette for data views. Each ink that a data label uses gets a shade with 4.5:1 contrast on the box fill and on the highlight background.

    svg_number

    fn svg_number(value : Double) -> String

    Canonical coordinates have at most three fractional digits and never use exponent notation.

    text_width

    fn text_width(line : String, size? : Int, weight? : Int) -> Double

    The measured width of one line of text.