Skip to content
D
Documentation

Svg — interfaces o–s

reference
10 min readUpdated

Interfaces O–S

Import these from @grafloria/renderer.

Interfaces

OptimizerLabel

A label awaiting placement.

ts
interface OptimizerLabel

Properties

NameTypeDefaultDescription
idstring
anchorPointOn-path anchor the label hangs off (world).
offsetPointThe offset the AUTHOR asked for — the preferred placement, and the fallback.
widthnumberBox size used for collision tests.
heightnumber
autoOffsetbooleanOpt-in to the collision search. Off ⇒ offset is returned verbatim.
normalPointUnit normal of the path at anchor — the axis the search pushes along.
ts
interface OptimizerLink

Properties

NameTypeDefaultDescription
idstring
pointsPoint[]The ROUTED polyline for this frame (post parallel-separation / self-loop).
jumps?{ mode: DetectionMode; threshold: number; }Jump config, if this link draws jumps at all.
labelsOptimizerLabel[]

OptimizerNode

A node, as far as the optimizer cares: an obstacle with an id.

ts
interface OptimizerNode

Properties

NameTypeDefaultDescription
idstring
rectOptimizerRect

OptimizerRect

ts
interface OptimizerRect

Properties

NameTypeDefaultDescription
xnumber
ynumber
widthnumber
heightnumber

OptimizerStats

Per-frame work counters — the incrementality is only real if these are 0 on a quiet frame.

ts
interface OptimizerStats

Properties

NameTypeDefaultDescription
dirtyLinksnumberLinks whose geometry changed this frame.
jumpsRecomputednumberLinks whose jump set was recomputed (dirty ones + their grid neighbours).
jumpsReusednumberLinks that served their jump set from cache.
labelsPlacednumberLabels whose placement was searched.
labelsReusednumberLabels served from cache.
segmentTestsnumberSegment-pair intersection tests actually performed.

OutlineSpec

An SVG element type plus the geometry props for one outline instance.

ts
interface OutlineSpec

Properties

NameTypeDefaultDescription
elVNodeType
geomRecord<string, number | string>
verts?ShapePoint[]Polygon shapes expose their vertices so boundaryPoint can reuse them.

OutlineTransform

Transform applied to a shape outline. The same primitive drives every render site: body = {}, selection = { grow: padding }, shadow = { dx, dy }.

ts
interface OutlineTransform

Properties

NameTypeDefaultDescription
grow?numberExpand the outline outward by this many px (selection highlight padding).
dx?numberTranslate the outline (drop-shadow offset).
dy?number
radius?numberCorner radius for rect (rx). Emitted only when truthy unless radiusAlways.
radiusY?booleanAlso emit ry (= radius). Selection/body want rx+ry; shadow wants rx only.
radiusAlways?booleanEmit rx even when radius is 0 (shadow keeps rx: borderRadius ?? 4).

PagedSvgResult

ts
interface PagedSvgResult

Properties

NameTypeDefaultDescription
pagesArray<Page & { svg: string }>
columnsnumber
rowsnumber
warningsstring[]

PanelBadge

A count / status badge pinned to a corner.

ts
interface PanelBadge

Properties

NameTypeDefaultDescription
textstring
corner?PanelCorner
fill?string
textColor?string

PanelHeader

A header band across the top of the node (ERD/UML title row).

ts
interface PanelHeader

Properties

NameTypeDefaultDescription
text?string
lines?string[]STACKED header lines — the UML classifier convention of a «stereotype» over the name. Wins over text when present; the band grows to hold every line, and each line is fitted to the band width (shrunk, never clipped: «enumeration» over a 120px card used to paint "umeration» Enumera" cut off at both edges).
height?numberBand height in px. Default 22, or 16/line + 4 when lines stack.
fill?string
textColor?string

PanelIcon

A small icon — a raster href, an emoji/text glyph, or a built-in line icon — pinned to a corner.

ts
interface PanelIcon

Properties

NameTypeDefaultDescription
href?string
glyph?stringEmoji or short glyph, used when href is absent.
name?stringA built-in line icon, used when there is no href or glyph: one of {@link BUILTIN_ICONS} (cloud, database, disk, internet, server — Mermaid architecture-beta's own). Drawn as our paths in the node's ink; an unknown name draws nothing.
size?numberBox size in px. Default 18.
corner?PanelCornerCorner to pin to. Default 'tl'.

PanelImage

A raster image slot below the header (data: URI strongly preferred).

ts
interface PanelImage

Properties

NameTypeDefaultDescription
hrefstring
height?numberSlot height in px. Default 48.

PanelRenderContext

Style inputs the host renderer supplies (theme-derived, CSS-mode aware).

ts
interface PanelRenderContext

Properties

NameTypeDefaultDescription
nodeIdstringNode id — used for stable child keys.
fontSizenumber
headerFillstring
headerTextColorstring
bodyTextColorstring
badgeFillstring
badgeTextColorstring

PanelRow

A stacked body text row (ERD field / UML member).

ts
interface PanelRow

Properties

NameTypeDefaultDescription
textstring
align?'start' | 'middle' | 'end'

PanelSpec

The composite-panel spec stored at node.metadata.panel.

ts
interface PanelSpec

Properties

NameTypeDefaultDescription
header?PanelHeader
image?PanelImage
icon?PanelIcon
badges?PanelBadge[]
rows?PanelRow[]
rowHeight?numberPer-row height in px. Default 18.

PathShapeOptions

Options for {@link registerPathShape}.

By default the boundary point (smart-connection attachment) and the port anchors are DERIVED from the path outline by sampling — so a custom silhouette attaches links to its real edge, not its bounding box. Supply portAnchor / boundaryPoint to override the sampled geometry with exact analytic anchors (the same override seam the built-in triangle uses for its apex/base points).

ts
interface PathShapeOptions

Properties

NameTypeDefaultDescription
viewBox?PathViewBoxReference box for a STATIC path string (default 0 0 1 1 — unit box).
portAnchor?ShapeDefinition['portAnchor']Exact port anchors, bypassing outline sampling.
boundaryPoint?ShapeDefinition['boundaryPoint']Exact smart-connection boundary, bypassing outline sampling.
innerRect?ShapeDefinition['innerRect']Label box; defaults to the padded bounding box.
sampleSteps?numberCurve subdivision when sampling the outline (default 24).

PathViewBox

The author's declared reference box for a STATIC path string.

ts
interface PathViewBox

Properties

NameTypeDefaultDescription
xnumber
ynumber
wnumber
hnumber

PortGlyphInput

ts
interface PortGlyphInput

Properties

NameTypeDefaultDescription
xnumberNode-local anchor: the port's position. The glyph is CENTRED on it.
ynumber
shape?PortShapeSpecResolved glyph spec. Undefined → a circle of radius (the legacy glyph).
radiusnumberThe circle radius the interaction config asks for, and the size fallback.
propsRecord<string, unknown>Presentation attributes (fill/stroke/…) already merged from theme+group+port.

PortLabelGeometry

ts
interface PortLabelGeometry

Properties

NameTypeDefaultDescription
xnumber
ynumber
rotationnumberTotal rotation in degrees (0 when the label is horizontal).
align'start' | 'middle' | 'end'
valign'top' | 'middle' | 'bottom'

PortLabelInput

ts
interface PortLabelInput

Properties

NameTypeDefaultDescription
specPortLabelSpec
xnumberNode-local anchor of the port's glyph.
ynumber
hwnumberHalf-extents of the glyph box — the label clears the glyph, not its centre.
hhnumber
side'left' | 'right' | 'top' | 'bottom'The port's side: the outward normal.
widthnumberNode box, for the radial layout's centre and for inside clamping.
heightnumber
nudge?numberVertical nudge applied by collision resolution (see nudgePortLabels).
fontSizenumber
fontFamily?string
color?string
className?string

PortLayoutInput

ts
interface PortLayoutInput

Properties

NameTypeDefaultDescription
widthnumberNode-local box the ports live in.
heightnumber
side'left' | 'right' | 'top' | 'bottom'The port's side (after group inheritance).
ranknumberThis port's rank among the ports sharing its LAYOUT SCOPE, and the scope size.
countnumber
shapeTypestringThe node's shape type — the shape strategy needs it.
rotation?numberThe node's rotation in degrees (for compensateRotation).

Rect

ts
interface Rect

Properties

NameTypeDefaultDescription
xnumber
ynumber
widthnumber
heightnumber

RouteMemoStats

ts
interface RouteMemoStats

Properties

NameTypeDefaultDescription
routednumberlinks whose route had to be computed this frame
reusednumberlinks served from the previous frame's route

RouteSolverBridgeOptions

ts
interface RouteSolverBridgeOptions

Properties

NameTypeDefaultDescription
port?SolverPortA real Worker (or anything satisfying SolverPort). Omit to run the solver INLINE — same protocol, same code, same answers, just on this thread. The bridge does not construct a Worker itself: that would bake one bundler's URL scheme into the renderer, which is the mistake the old LayoutWorkerPool made.
solver?SolverOptions
onRoutesReady?() => void"I have better routes than the ones you painted." Ask for a re-render.

RouteSolverStats

ts
interface RouteSolverStats

Properties

NameTypeDefaultDescription
submittednumber
appliednumber
discardednumberanswers thrown away because the world had moved on under them
supersedednumber

SelfLoopSpec

ts
interface SelfLoopSpec

Properties

NameTypeDefaultDescription
rectFanoutRectWorld rect of the node both ends live on.
startFanoutPointSource attachment point (world, on the node outline).
endFanoutPointTarget attachment point (world, on the node outline).
sourceSideFanoutSide
targetSideFanoutSide
sizenumberHow far the loop bulges away from the node body (px).
widthnumberLateral span used when the two ends coincide (or nearly do).

ShapePoint

ts
interface ShapePoint

Properties

NameTypeDefaultDescription
xnumber
ynumber

ShapeRect

Node bounding box in WORLD coordinates (used by boundaryPoint).

ts
interface ShapeRect

Properties

NameTypeDefaultDescription
xnumber
ynumber
wnumber
hnumber

SpotInput

ts
interface SpotInput

Properties

NameTypeDefaultDescription
xnumberWorld position of the port's anchor (its glyph centre).
ynumber
hwnumberGlyph half-extents — a spot names a corner/edge of THIS box.
hhnumber
sideSideThe port's side: the default direction, and the default spot.

Was this page helpful?

Svg — interfaces o–s — Grafloria