DiagramBuilder
A dependency-free fluent builder that turns code into Beck YAML — or a fenced ```beck Markdown block. Walk any model (an Aspire app graph, an EF model, a service registry) into one and emit a diagram.
Methods
Create a builder, optionally with a diagram title.
Set the diagram title.
Set the muted second heading line.
Set the layout direction — TB (default), BT, LR, or RL.
Set the theme: Auto (default), Light, or Dark.
Enable or disable the flow animation.
Loop the flow (default) or play it through once.
Tune layout spacing: rank gap (along the flow), node gap (across), and corner radius in px.
Add a node and configure it via NodeBuilder — title, kind, icon, accent, link, and more.
The terse overload: add a node with a title and an optional kind.
Add a labelled, boxed cluster. Members may be node ids or other group ids — groups nest to any depth.
Connect two nodes (or groups). Configure label, style, curve, kind, color, and arrowheads.
Script the animation. Omit it and Beck auto-derives a flow from the edges.
Render the diagram as Beck YAML. Throws if an edge endpoint isn't a declared node or group id.
Render as a fenced ```beck Markdown block — the client renders it on any page.
Example
NodeBuilder
Configures a single node inside a Node(id, n => …) callback. Every method returns the same builder, so calls chain. Unset fields fall back to the node kind's defaults.
Methods
Set the display title (defaults to the id).
Set the muted subtitle line.
Set a named icon key or raw inline <svg> markup.
Set the archetype (default Service) — picks an icon, accent, and shape.
Set the visual weight: Solid, Subtle, or Ghost.
Set the initial status-pill text.
Set the accent to a semantic token (follows the theme).
Set the accent to a raw CSS colour (a hex string, say).
Fix the card width in px (prevents reflow on a status change).
Force the node into a specific layout rank.
Tie-break the node's order within its rank.
Assign the node to a group inline (alternative to group members).
Make the card a link. Pass "_blank" to open in a new tab.
Override the card background (a raw CSS colour).
Override the card text colour (a raw CSS colour).
EdgeBuilder
Configures one edge inside an Edge(from, to, e => …) callback. Endpoints may be node ids or group ids.
Methods
Set the edge label.
Set the line style: Solid or Dashed.
Set the routing curve: StepRound (default), Straight, or S.
Set the semantic kind (defaults colour + style): Data, Control, Async, Dependency.
Set the stroke to a semantic token.
Set the stroke to a raw CSS colour.
Toggle the arrowhead (default on). false draws none.
Choose which ends carry an arrowhead — e.g. ArrowEnds.Both.
Pin the edge's exit side on the source node.
Pin the edge's entry side on the target node.
GroupBuilder
Configures a labelled, boxed cluster inside a Group(id, g => …) callback. Members may be node ids or other group ids, so groups nest.
Methods
Set the group label (defaults to the id).
Add member node (or group) ids.
Add a single member id.
Tint the box + label with a semantic token.
Tint the box + label with a raw CSS colour.
FlowBuilder
Scripts the animation timeline inside a Flow(f => …) callback — packets, status changes, and effects, played in order. Without an explicit flow the engine auto-derives one from the edges.
Methods
Repeat count: -1 loops forever (default), 0 plays once.
Delay between repeats, in seconds.
Send a packet along an edge, optionally via waypoints, with a colour and label.
Set a node's status-pill text (persists until changed).
Briefly highlight a node.
Pulse a node — a ripple on arrival.
Persistently recolour an edge (and its arrowhead) until the next reset.
Continuous flowing dashes along an edge (ongoing traffic), until reset.
Leave a node visibly busy (a breathing glow) until Idle or reset.
Clear a node's Working state.
A failure beat: red shake + flash, with optional status text.
A named seek label, so the handle's seek(label) can jump here.
Pause for a number of seconds.
Reset the diagram to its initial state.
Run a group of steps simultaneously.
Example
BeckAssets
Locations and snippets for wiring the Beck client into an ASP.NET Core host. The package serves the prebuilt engine as a static web asset, so a consumer only includes one script in the page head.
Members
The static web asset path the client is served at — /_content/Beck/beck.global.js. Root-relative, so it resolves from any page depth and survives sub-path deploys.
A ready-to-inject <script defer> tag for the page head — e.g. via a Pennington AdditionalHtmlHeadContent.
<beck-diagram>
A custom element that renders a Beck diagram in light DOM, so it adopts the host page's styles and palette. Put the YAML in a <script type="application/yaml"> child, or point src at a YAML file. The engine also hydrates any fenced ```beck code block automatically — which is what ToFence() emits — so most pages never touch the element directly.
Authoring more than a snippet? The Generate diagrams from your code guide walks your real model into the full builder and keeps the diagram in sync in CI.