#dot #graphviz #compile-time #graph #macro #validation #dot-ix

macro dot_ix_static_check_macros

Compile time validation macros for dot_ix

10 releases (breaking)

0.8.1 Sep 27, 2024
0.7.0 Jun 30, 2024
0.5.0 Mar 30, 2024

#31 in #graphviz

Download history 142/week @ 2024-06-24 96/week @ 2024-07-01 9/week @ 2024-07-15 74/week @ 2024-07-29 142/week @ 2024-08-05 33/week @ 2024-08-12 10/week @ 2024-08-19 29/week @ 2024-08-26 7/week @ 2024-09-09 30/week @ 2024-09-16 203/week @ 2024-09-23 29/week @ 2024-09-30 32/week @ 2024-10-07

295 downloads per month
Used in 5 crates (via dot_ix_model)

MIT/Apache

20KB
182 lines

✒️ dot_ix

Crates.io docs.rs CI Coverage Status

🚧 This is very much a work in progress

Try it yourself: (demo_1, demo_2)

Example

Original Concept

https://user-images.githubusercontent.com/2993230/253878816-0729970f-651f-45ef-a986-470f383b8018.mp4

Usage

Add the following to Cargo.toml

dot_ix = "0.8.1"

# Enables the `FlexDiag` web component.
dot_ix = { version = "0.8.1", features = ["flex_diag"] }

# Enables server side dot generation.
# Requires graphviz `dot` to be installed server side.
dot_ix = { version = "0.8.1", features = ["server_side_graphviz"] }

Development

cargo install cargo-leptos

# Then, one of:
# * client side rendering -- uses WASM compiled graphviz to generate the graph.
cargo leptos watch
# * server side rendering -- runs `dot` on the server to generate the graph.
#   Requires `graphviz` to be installed.
cargo leptos watch --features "server_side_graphviz" -v

For server side rendering, the "server_side_graphviz" feature needs to be passed in separately because that feature still needs to be enabled for the lib compilation, i.e.

  • server side rendering:
    • lib features: "server_side_graphviz"
    • bin features: "ssr,server_side_graphviz"
  • client side rendering:
    • lib features: ""
    • bin features: ""

To Do

🦜 Feel free to do any of these -- this project isn't my main focus, but I should be responsive in reviewing / merging things.

  • Split crate into multiple subcrates.
  • Split app::info_graph::InfoGraph into smaller components.
  • Get rid of main.scss and replace with tailwind classes.
  • Inline styles in SVG.
  • Inline font in SVG styles.
  • Change rt/into_graphviz_dot_src/info_graph.rs to write to a buffer, instead of individual strings.
  • Take each node with a "type".
  • Take in tailwindcss classes to attach to node types.
  • Take in theme / merge with default theme.
  • Split dot_ix library from the web app, so it can be embedded in other apps.
  • GitHub Actions / automated testing / releasing / publishing.
  • Playground: Render pre-written graphs
    • Graph in URL
    • Link to gist

Dependencies

~240–680KB
~16K SLoC