jcberentsen/elm-wiring-diagrams

A package for rendering wiring-diagrams to SVG


License
BSD-3-Clause
Install
elm-package install jcberentsen/elm-wiring-diagrams 5.4.7

Documentation

elm-wiring-diagrams

elm-wiring-diagrams

Wiring diagrams

This is an experimental package for creating wiring diagrams, inspired by https://arxiv.org/pdf/2101.12046.pdf

Diagrams can be composed of boxes with ports. Boxes can be chained or put in parallel.

Diagrams are abstract, and needs to go through a Layout before rendering to Svg.

Example usage

Try out in Ellie:

https://ellie-app.com/fkhmBWKSmvVa1

module Main exposing (main)

import Cartesian as C exposing (before)

-- import modules for converting to svg and then to html
import Cartesian.Svg as Svg
import Diagram.Svg as Svg
-- Import some example diagrams
-- View source code:
-- https://github.com/jcberentsen/elm-wiring-diagrams/blob/main/src/Cartesian/Examples.elm
import Cartesian.Examples exposing (a,b,c)

svg = let diagram = a |> before b |> before c
  in Svg.view Svg.smallViewport [ Svg.fromDiagram diagram ]

main = svg

Tutorial in Ellie:

https://ellie-app.com/fjxck9J4ktPa1