jcberentsen / elm-wiring-diagrams / Diagram.Svg.Config

Configure how to convert Layout Labels to Strings for Svg output


type alias Config a msg =
Internal.Svg.Config.Config a msg

Preliminary way to control how labels turn into String for SVG

forStringLabels : Config String msg

Simple starting config when labels are already String

initWithLabelToString : (a -> String) -> Config a msg

Init needs a labelToString function

default : Config a msg

Simple starting config. All labels will render as a dot

Use the Config modifiers to shape your intended Config

withLabelToString : (a -> String) -> Config a msg -> Config a msg

Configure a function to label a cell holding an a

The string will be displayed in the Svg boxes

withTextAttributes : List (Svg.Attribute msg) -> Config a msg -> Config a msg

Overload attributes for all cell label texts

withTextAttributesFunction : (a -> List (Svg.Attribute msg)) -> Config a msg -> Config a msg

Overload attributes for any cell label text

You supply a function that looks at the label and decides which attributes to use

withCellAttributes : List (Svg.Attribute msg) -> Config a msg -> Config a msg

Overload attributes for all cell boxes

These are the inner boxes with labels.

Only style colors, fonts.

Avoid modifying geometry, as this will likely mess up the layout

withCellAttributesFunction : (Maybe a -> List (Svg.Attribute msg)) -> Config a msg -> Config a msg

Overload attributes for each cell

You supply a function that looks at the label and decides which attributes to use

Only style colors, fonts.

Avoid modifying geometry, as this will likely mess up the layout

withCellWrappingFunction : (Maybe a -> List (Svg msg) -> Svg msg) -> Config a msg -> Config a msg

Overload cell wrapping

Lets you configure how a list of inner Svg elements will be wrapped.

This allows you to set up onClick event attributes or using Svg.a for hyperlinking when the inner svg is clicked.

Control label positions

withLabelPositionFunction : LabelPositionFunction a -> Config a msg -> Config a msg

Control the position of labels within boxes The LabelPositionFunction must give positions that are inside the given box.


type alias LabelPositionFunction a =
Internal.Svg.Config.LabelPositionFunction a

Type of a function that can determine a text position within a box

This can be used for centering and aligning labels towards edges or corners,

centered : LabelPositionFunction a

LabelPositionFunction for centering labels in box

bottomLeft : LabelPositionFunction a

LabelPositionFunction for placing labels in lower left corner