主题
Interface: CommonLayoutPaintContext<PreparedLayout, MeasureResult>
Defined in: packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts:47
Extends
CommonLayoutRenderContext<PreparedLayout>
Type Parameters
PreparedLayout
PreparedLayout = unknown
MeasureResult
MeasureResult = CommonLayoutMeasure
Properties
element
element:
D3Selection<SVGElement>
Defined in: packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts:41
Inherited from
CommonLayoutRenderContext.element
helpers?
optionalhelpers:object
Defined in: packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts:42
common
common:
object
common.evaluate()
evaluate: (
val?) =>boolean
Converts a string/boolean into a boolean
Parameters
val?
String or boolean to convert
string | boolean | null
Returns
boolean
The result from the input
common.getMax()
getMax: (...
values) =>number
Wrapper around Math.max which removes non-numeric values Returns the larger of a set of supplied numeric expressions.
Parameters
values
...number[]
Numeric expressions to be evaluated
Returns
number
The smaller value
common.getMin()
getMin: (...
values) =>number
Wrapper around Math.min which removes non-numeric values Returns the smaller of a set of supplied numeric expressions.
Parameters
values
...number[]
Numeric expressions to be evaluated
Returns
number
The smaller value
common.getRows()
getRows: (
s?) =>string[]
Gets the rows of lines in a string
Parameters
s?
string
The string to check the lines for
Returns
string[]
The rows in that string
common.getUrl()
getUrl: (
useAbsolute) =>string
Gets the current URL
Parameters
useAbsolute
boolean
Whether to return the absolute URL or not
Returns
string
The current URL
common.hasBreaks()
hasBreaks: (
text) =>boolean
Whether or not a text has any line breaks
Parameters
text
string
The text to test
Returns
boolean
Whether or not the text has breaks
common.lineBreakRegex
lineBreakRegex:
RegExp
common.removeScript()
removeScript: (
txt) =>string
Removes script tags from a text
Parameters
txt
string
The text to sanitize
Returns
string
The safer text
common.sanitizeText()
sanitizeText: (
text,config) =>string
Parameters
text
string
config
Returns
string
common.sanitizeTextOrArray()
sanitizeTextOrArray: (
a,config) =>string|string[]
Parameters
a
string | string[] | string[][]
config
Returns
string | string[]
common.splitBreaks()
splitBreaks: (
text) =>string[]
Splits on
tags
Parameters
text
string
Text to split
Returns
string[]
List of lines as strings
getConfig()
getConfig: () =>
MermaidConfig
getConfig
| Function | Description | Type | Return Values |
|---|---|---|---|
| getConfig | Obtains the currentConfig | Get Request | Any Values from current Config |
Notes: Avoid calling this function repeatedly. Instead, store the result in a variable and use it, and pass it down to function calls.
Returns
The currentConfig
insertCluster()
insertCluster: (
elem,node) =>Promise<any>
Parameters
elem
any
node
ClusterNode
Shape defaults to 'rect'
Returns
Promise<any>
insertEdge()
insertEdge: (
elem,edge,clusterDb,diagramType,startNode,endNode,diagramId,skipIntersect) =>object
Parameters
elem
any
edge
any
clusterDb
any
diagramType
any
startNode
any
endNode
any
diagramId
any
skipIntersect
boolean = false
Returns
object
originalPath
originalPath:
any
updatedPath
updatedPath:
any
insertEdgeLabel()
insertEdgeLabel: (
elem,edge) =>Promise<SVGGElement>
Parameters
elem
any
edge
any
Returns
Promise<SVGGElement>
insertMarkers()
insertMarkers: (
elem,markerArray,type,id) =>void
Parameters
elem
any
markerArray
any
type
any
id
any
Returns
void
insertNode()
insertNode: (
elem,node,renderOptions) =>Promise<Selection<SVGGElement,unknown,Element|null,unknown> |D3Selection<SVGAElement>>
Parameters
elem
node
NonClusterNode
renderOptions
ShapeRenderOptions
Returns
Promise<Selection<SVGGElement, unknown, Element | null, unknown> | D3Selection<SVGAElement>>
interpolateToCurve()
interpolateToCurve: (
interpolate,defaultCurve) =>CurveFactory
Returns a d3 curve given a curve name
Parameters
interpolate
The interpolation name
string | undefined
defaultCurve
CurveFactory
The default curve to return
Returns
CurveFactory
The curve factory to use
labelHelper()
labelHelper: <
T>(parent,node,_classes?) =>Promise<{bbox:DOMRect;halfPadding:number;label:Selection<SVGGElement,unknown,Element|null,unknown>;shapeSvg:Selection<SVGGElement,unknown,Element|null,unknown>; }>
Type Parameters
T
T extends SVGGraphicsElement
Parameters
parent
D3Selection<T>
node
Node
_classes?
string
Returns
Promise<{ bbox: DOMRect; halfPadding: number; label: Selection<SVGGElement, unknown, Element | null, unknown>; shapeSvg: Selection<SVGGElement, unknown, Element | null, unknown>; }>
log
log:
Record<LogLevel, {(...data):void; (message?, ...optionalParams):void; }>
positionEdgeLabel()
positionEdgeLabel: (
edge,paths) =>void
Parameters
edge
any
paths
any
Returns
void
Inherited from
CommonLayoutRenderContext.helpers
measure
measure:
MeasureResult
Defined in: packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts:51
options?
optionaloptions:RenderOptions
Defined in: packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts:43
Inherited from
CommonLayoutRenderContext.options
preparedLayout?
optionalpreparedLayout:PreparedLayout
Defined in: packages/mermaid/src/rendering-util/layout-algorithms/common/index.ts:44