vernacular-ai/elm-flow-chart/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 3.0.0 is there; its commit 800ffb3eb22a is from 2019-06-07 00:08 UTC, before the version was published (2019-06-07 00:09 UTC); every file Elm uses matches a copy in a Lamdera package cache from 2021-02-13, from before the change; 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/3.0.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
** Initiaze the flowchart **


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

List of events to subscribe

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 : { m | fcModel : Model msg } -> Sub msg

subscriptions

Update

FCEventConfig msg
-> Msg
-> { m | fcModel : Model msg }
-> ( { m | fcModel : Model msg }, Cmd msg )
** Update the flowchart **
{ m | fcModel : Model msg }
-> (FCNode -> { m | fcModel : Model msg } -> Html Msg)
-> List (Attribute Msg)
-> Html msg
** Display the flowchart **


- model -> Model holding flowchart Model
- nodeMap -> function which gives node's html. For example:


    nodeMap : FCNode -> Model -> Html FlowChart.Msg
    nodeMap fcNode model =
        div
            [ A.style "width" "100%"
            , A.style "height" "100%"
            , A.style "background-color" "white"
            ]
            [ text fcNode.id ]


- fcChartStyle -> css attributes for flowchart

Functionalities

FCNode
-> { m | fcModel : Model msg }
-> { m | fcModel : Model msg }

add node to canvas

    addNode fcNode Model
String
-> { m | fcModel : Model msg }
-> { m | fcModel : Model msg }

remove node from canvas

    removeNode "node-id" Model
Model msg
-> { position : Vector2
, nodes : List FCNode
, links : List FCLink
}

Get current flowchart state i.e position of canvas, nodes and links

    getFCState FlowChart.Model
{ position : Vector2
, nodes : List FCNode
, links : List FCLink
}
-> Model msg
-> Model msg
Set flowchart state i.e will override position of canvas, nodes and links