vernacular-ai/elm-flow-chart/2.1.0

NOTE: the latest version is 3.0.0

Renamed to skit-ai/elm-flow-chart. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as vernacular-ai/elm-flow-chart still install under that name. 4 versions of 4 come from the new location (see their notes).

Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/skit-ai/elm-flow-chart.

What we checked: The repo moved to github.com/skit-ai/elm-flow-chart and tag 2.1.0 is there; its commit 1e6c9e35153c is from 2019-05-22 14:01 UTC, before the version was published (2019-05-22 14:03 UTC); elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one (GitHub's zip no longer comes out byte for byte the same), so the contents were checked instead.

The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.

Details · package.elm-lang.org's zip: https://github.com/vernacular-ai/elm-flow-chart/zipball/2.1.0/

FlowChart

This library aims to provide a flow chart builder in Elm.

Definition

type alias Model msg =
{ position : Vector2
, nodes : Dict String FCNode
, links : Dict String Model
, currentlyDragging : DraggableTypes
, dragState : DragState
, targetMsg : Msg -> msg
, portConfig :
{ portSize : Vector2
, portColor : String
}
, linkConfig :
{ linkSize : Int
, linkColor : String
}
}

flowchart model

type Msg

flowchart message

type alias FCEvent msg =
FCEventConfig msg -> FCEventConfig msg

Event declaration for event config

type alias FCEventConfig msg =
FCEventConfig msg

Config for subscribing to events

    onCanvasClick -> when canvas is clicked
    onNodeClick FCNode -> when any node is clicked
    onLinkClick FCLink -> when any link is clicked

Subscriptions

init : FCCanvas -> (Msg -> msg) -> Model msg

init flowchart

init fcCanvas nodeMap
initEventConfig : List (FCEvent msg) -> FCEventConfig msg

pass list of events to subscribe to. Currently supported are : onCanvasClick, onNodeClick, onLinkClick

{ portSize : Vector2
, portColor : String
}

get default port config

portSize = Size of port in Vector2 (20, 20)
portColor = Color of port (grey)
{ linkSize : Int
, linkColor : String
}

get default link config

linkSize = stroke width of link (2px)
linkColor = Color of link (#6495ED)
subscriptions : Model msg -> Sub msg

subscriptions

Update

update : FCEventConfig msg -> Msg -> Model msg -> ( Model msg, Cmd msg )

call to update the canvas

view : Model msg -> (String -> Html Msg) -> List (Attribute Msg) -> Html msg

display the canvas

Functionalities

addNode : FCNode -> Model msg -> Model msg

add node to canvas

removeNode : String -> Model msg -> Model msg

remove node from canvas

    removeNode "node-id" FlowChartModel
saveFlowChart : String -> Model msg -> Cmd msg

save flowchart state as json file

    saveFlowChart "<path/to/file.json>" FlowChartModel
loadFlowChart : Model msg -> Cmd msg

load flowchart state from a json file. Will open a file selector dialog to select the file

    loadFlowChart FlowChartModel