JSPM

@choo-choo/core

0.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 23
  • Score
    100M100P100Q90368F
  • License MIT

IR, manual builder and SVG renderer for choo-choo railroad diagrams.

Package Exports

  • @choo-choo/core
  • @choo-choo/core/styles.css

Readme

@choo-choo/core

IR, manual builder and SVG renderer for Choo Choo railroad diagrams.

Zero runtime dependencies. SSR-safe: the renderer emits an SVG string and never touches the DOM.

Install

npm install @choo-choo/core

Example

import { diagram, sequence, terminal, render } from "@choo-choo/core";

const ir = diagram(sequence(terminal("return")));
const svg = render(ir);

render returns an SVG string — inject it from your framework of choice, or use one of the prebuilt bindings: @choo-choo/react, @choo-choo/vue, @choo-choo/astro, @choo-choo/vanilla.

To build diagrams from a grammar source instead of by hand, combine core with a grammar parser: @choo-choo/parser-ebnf, @choo-choo/parser-antlr, @choo-choo/parser-peg.

Learn more

License

MIT