GenerateDiffParams
Defined in: src/types/index.ts:1399
Parameters for generateDiff, comparing two ASL definitions into an SVG diff.
Extends
Section titled “Extends”Properties
Section titled “Properties”after: string | AslDefinition;Defined in: src/types/index.ts:1401
The new (head) ASL definition
backgroundColor?
Section titled “backgroundColor?”backgroundColor?: string;Defined in: src/types/index.ts:578
Background color for PNG export
Default
Section titled “Default”'transparent'Inherited from
Section titled “Inherited from”DiagramOptions.backgroundColor
before
Section titled “before”before: string | AslDefinition;Defined in: src/types/index.ts:1404
The old (base) ASL definition
cache?
Section titled “cache?”cache?: LayoutCache;Defined in: src/types/index.ts:1412
Optional layout cache from createLayoutCache. When passed, a definition already
laid out under the same layout-affecting options reuses that layout instead of
re-running dagre. The diff’s colours are not part of the key, so a re-render of
the same pair hits. Omitted, nothing is cached.
catchHandling?
Section titled “catchHandling?”catchHandling?: CatchHandling;Defined in: src/types/index.ts:586
How to treat per-state Catch (error-handler) branches. ‘show’ (default) renders them; ‘hide’ drops error edges and handler-only nodes so the happy path reads clearly on large machines.
Default
Section titled “Default”'show'Inherited from
Section titled “Inherited from”catchLabelStyle?
Section titled “catchLabelStyle?”catchLabelStyle?: CatchLabelStyle;Defined in: src/types/index.ts:592
Style for Catch block edge labels: ‘error-type’ shows error names, ‘catch-number’ shows “Catch #N”
Default
Section titled “Default”'error-type'Inherited from
Section titled “Inherited from”DiagramOptions.catchLabelStyle
collapse?
Section titled “collapse?”collapse?: boolean | string[];Defined in: src/types/index.ts:602
Collapse Parallel/Map containers into a placeholder node so dagre lays out a
smaller graph — hiding a container’s children shrinks the diagram instead of
leaving an empty bounding box behind. true collapses every container; a
string array collapses only the named containers (names that don’t resolve to
an existing container are ignored).
Default
Section titled “Default”undefined (no collapsing)Inherited from
Section titled “Inherited from”collapseControls?
Section titled “collapseControls?”collapseControls?: boolean;Defined in: src/types/index.ts:614
Draw a collapse control in every open container’s header and an expand control
on every collapsed placeholder, each tagged data-sfn-collapse-target="<id>",
for the interactive viewer’s per-container collapse.
Only useful for interactive output — generateHtml sets it for itself when it
embeds the in-browser relayout. It stays off by default so static SVG and PNG
export carry no controls.
Default
Section titled “Default”falseInherited from
Section titled “Inherited from”DiagramOptions.collapseControls
customColors?
Section titled “customColors?”customColors?: Partial<Record<StateType, Partial<NodeStyle>>>;Defined in: src/types/index.ts:623
Per-state-type fill and stroke, applied on top of the theme. Only fill and
stroke are drawn; shape and strokeWidth here have no effect (use
nodeOverrides). In Mermaid output a value that can’t be drawn on one style line
(a line break, ;, {, }, or a comma outside rgb()/hsl() syntax) is left
out with a %% comment, and the theme’s colour shows instead.
Inherited from
Section titled “Inherited from”diagramDescription?
Section titled “diagramDescription?”diagramDescription?: string;Defined in: src/types/index.ts:629
Accessible description for the diagram, rendered as the root <svg>’s <desc>.
Falls back to a state/transition count summary when omitted.
Inherited from
Section titled “Inherited from”DiagramOptions.diagramDescription
diagramTitle?
Section titled “diagramTitle?”diagramTitle?: string;Defined in: src/types/index.ts:637
Accessible name for the diagram, rendered as the root <svg>’s <title> and
aria-label. generateSvg defaults it from the ASL definition’s top-level
Comment when omitted.
Default
Section titled “Default”'AWS Step Functions state machine diagram'Inherited from
Section titled “Inherited from”edgeHitAreas?
Section titled “edgeHitAreas?”edgeHitAreas?: boolean;Defined in: src/types/index.ts:648
Render an invisible, thicker hit area beneath every edge so pointer events land on a comfortable target rather than on the drawn stroke, which is 1.5–2px wide.
Only useful for interactive output — generateHtml and the sfn-diagram/element
custom element set it themselves so edges are clickable in the viewer. It stays
off by default so static SVG and PNG export carry no extra paths.
Default
Section titled “Default”falseInherited from
Section titled “Inherited from”edgeOverrides?
Section titled “edgeOverrides?”edgeOverrides?: Record<string, EdgeStyleOverride>;Defined in: src/types/index.ts:803
Per-edge style overrides. Merged on top of the edge’s computed style — only specified fields are overridden. Used by the execution overlay to highlight taken transitions and dim untaken ones.
Two key shapes are accepted:
GraphEdge.id—${from}->${to}#${type}#${ordinal}, e.g.Route->Work#choice#1. Targets exactly one edge. Prefer this.${from}->${to}— legacy, broad-matches every edge between that pair. Kept for backwards compatibility; 2.0 keeps it too.
When both match an edge, the qualified key is merged on top of the bare one.
from and to are node ids, so a state name holding a character XML 1.0 forbids
appears with U+FFFD in its place; read the key off the rendered data-edge-id.
Example
Section titled “Example”{ 'Route->Work': { strokeWidth: 2 }, // both branches 'Route->Work#choice#1': { stroke: '#d13212' }, // only the second rule}Inherited from
Section titled “Inherited from”edgeStyle?
Section titled “edgeStyle?”edgeStyle?: EdgePathStyle;Defined in: src/types/index.ts:654
Style of edge paths: straight, curved, or orthogonal
Default
Section titled “Default”'curved'Inherited from
Section titled “Inherited from”format?
Section titled “format?”format?: DiagramFormat;Defined in: src/types/index.ts:657
Output format for the diagram
Inherited from
Section titled “Inherited from”iconPosition?
Section titled “iconPosition?”iconPosition?: IconPosition;Defined in: src/types/index.ts:663
Position of AWS service icons relative to node label
Default
Section titled “Default”'left'Inherited from
Section titled “Inherited from”iconResolver?
Section titled “iconResolver?”iconResolver?: (service) => string | null;Defined in: src/types/index.ts:666
Custom function to resolve icon URLs for services
Parameters
Section titled “Parameters”service
Section titled “service”string
Returns
Section titled “Returns”string | null
Inherited from
Section titled “Inherited from”iconSize?
Section titled “iconSize?”iconSize?: number;Defined in: src/types/index.ts:672
Size of AWS service icons in pixels
Default
Section titled “Default”24Inherited from
Section titled “Inherited from”idPrefix?
Section titled “idPrefix?”idPrefix?: string;Defined in: src/types/index.ts:696
String prepended to every id the SVG emits (the arrowhead <marker> ids) and to
every url(#...) reference to one. Ids are document-global, so two SVGs inlined
in one HTML page must not share them, or the second diagram’s edges resolve to
the first diagram’s markers.
By default each render prefixes its marker ids with sfn- and eight hex digits
hashed from the rest of its output (sfn-1a2b3c4d-arrowhead-normal), so different
diagrams on one page never share ids and re-rendering the same input gives the
same ids. Two renders of the same definition with the same options get the same
prefix, so pass your own to tell such copies apart. '' gives bare ids.
Letters, digits, _, -, ., : and non-whitespace non-ASCII characters only,
so React’s useId() values work as-is; anything else throws. The prefix is
prepended verbatim, so end it with a separator ('orders-'). Has no effect on
Mermaid output or on layout.
Default
Section titled “Default”a hash-derived sfn-xxxxxxxx- prefix
Example
Section titled “Example”generateSvg({ aslDefinition, idPrefix: 'orders-' }); // id="orders-arrowhead-normal"generateSvg({ aslDefinition, idPrefix: '' }); // id="arrowhead-normal"Inherited from
Section titled “Inherited from”includeComments?
Section titled “includeComments?”includeComments?: boolean;Defined in: src/types/index.ts:704
Whether to use state comments as node labels. In SVG and PNG output a label wider
than its node is cut short with …; the full text stays in the node’s <title>
tooltip.
Default
Section titled “Default”trueInherited from
Section titled “Inherited from”DiagramOptions.includeComments
layout?
Section titled “layout?”layout?: LayoutDirection;Defined in: src/types/index.ts:707
Graph layout direction: TB (top-bottom), LR (left-right), RL (right-left), BT (bottom-top)
Inherited from
Section titled “Inherited from”nodeAnnotations?
Section titled “nodeAnnotations?”nodeAnnotations?: Record<string, string>;Defined in: src/types/index.ts:810
Extra annotation text rendered below a node’s label, keyed by graph node id -
the state name for every state whose name is unique across the machine. For a nested state whose name repeats elsewhere in the machine the id is qualified by its scope, so read it off the rendered data-state-id rather than assuming the bare name. A character XML 1.0 forbids in a name becomes U+FFFD in its id, so read those off data-state-id too.
Used by the execution overlay to show per-state duration and retry counts.
Inherited from
Section titled “Inherited from”DiagramOptions.nodeAnnotations
nodeHeight?
Section titled “nodeHeight?”nodeHeight?: number;Defined in: src/types/index.ts:713
Height of each state node in pixels
Default
Section titled “Default”60Inherited from
Section titled “Inherited from”nodeOverrides?
Section titled “nodeOverrides?”nodeOverrides?: Record<string, Partial<NodeStyle>>;Defined in: src/types/index.ts:778
Per-node style overrides keyed by graph node id, which is the state name for
every state whose name is unique across the machine. For a nested state whose name repeats elsewhere in the machine the id is qualified by its scope, so read it off the rendered data-state-id rather than assuming the bare name. A character XML 1.0 forbids in a name becomes U+FFFD in its id, so read those off data-state-id too.
Merged on top of the node’s computed style — only specified fields are overridden.
Inherited from
Section titled “Inherited from”nodeSeparation?
Section titled “nodeSeparation?”nodeSeparation?: number;Defined in: src/types/index.ts:719
Horizontal separation between nodes in pixels
Default
Section titled “Default”50Inherited from
Section titled “Inherited from”nodeWidth?
Section titled “nodeWidth?”nodeWidth?: number;Defined in: src/types/index.ts:726
Width of each state node in pixels. Names and Comments wider than this are
truncated with …, so widen nodes for long labels.
Default
Section titled “Default”120Inherited from
Section titled “Inherited from”padding?
Section titled “padding?”padding?: number;Defined in: src/types/index.ts:732
Padding around the diagram in pixels
Default
Section titled “Default”20Inherited from
Section titled “Inherited from”rankSeparation?
Section titled “rankSeparation?”rankSeparation?: number;Defined in: src/types/index.ts:738
Vertical separation between ranks in pixels
Default
Section titled “Default”50Inherited from
Section titled “Inherited from”showIcons?
Section titled “showIcons?”showIcons?: boolean;Defined in: src/types/index.ts:744
Whether to display AWS service icons on Task state nodes
Default
Section titled “Default”falseInherited from
Section titled “Inherited from”showStateTypes?
Section titled “showStateTypes?”showStateTypes?: boolean;Defined in: src/types/index.ts:750
Whether to display state type labels on nodes
Default
Section titled “Default”falseInherited from
Section titled “Inherited from”showVariables?
Section titled “showVariables?”showVariables?: boolean;Defined in: src/types/index.ts:758
Whether to annotate nodes with the variables they assign via ASL Assign.
Shown as $var1, $var2 beneath the node label. States that assign nothing
are unaffected.
Default
Section titled “Default”trueInherited from
Section titled “Inherited from”stylePreset?
Section titled “stylePreset?”stylePreset?: StylePreset;Defined in: src/types/index.ts:764
Visual style preset: ‘aws-standard’ uses rectangles (AWS parity), ‘enhanced’ uses shapes for visual distinction
Default
Section titled “Default”'aws-standard'Inherited from
Section titled “Inherited from”theme?
Section titled “theme?”theme?: ThemeOption;Defined in: src/types/index.ts:771
Color theme: ‘light’, ‘dark’, ‘auto’, or a custom theme object. 'auto' repaints
in the dark palette under prefers-color-scheme: dark and renders as light in
PNG and Mermaid output; see ThemeOption.