File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33export type LJStateMachine = {
44 className : string ;
5- initialTransitions : { to : string ; toCondition ?: string | null } [ ] ;
5+ initialTransitions : { to : string ; toCondition ?: string | null ; constructorSignature ?: string | null } [ ] ;
66 states : string [ ] ;
77 transitions : { from : string ; to : string ; label : string ; fromCondition ?: string | null ; toCondition ?: string | null } [ ] ;
88 errorContext : LJStateMachineErrorContext | null ;
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export function createMermaidDiagram(
3535
3636 // initial transitions
3737 sm . initialTransitions . forEach ( transition => {
38- const label = getInitialTransitionLabel ( transition . toCondition , showConditions ) ;
38+ const label = getInitialTransitionLabel ( transition . constructorSignature , transition . toCondition , showConditions ) ;
3939 lines . push ( ` [*] --> ${ transition . to } ${ label ? ` : ${ label } ` : '' } ` ) ;
4040 } ) ;
4141
@@ -89,8 +89,12 @@ function getTransitionLabel(
8989 ] . filter ( Boolean ) . join ( '<br/>' ) ;
9090}
9191
92- function getInitialTransitionLabel ( toCondition ?: string | null , showConditions = false ) : string {
93- return showConditions ? getConditionLabel ( 'post' , toCondition ) : '' ;
92+ function getInitialTransitionLabel ( constructorSignature ?: string | null , toCondition ?: string | null ,
93+ showConditions = false ) : string {
94+ return [
95+ constructorSignature ? escapeMermaidLabel ( constructorSignature ) : '' ,
96+ showConditions ? getConditionLabel ( 'post' , toCondition ) : '' ,
97+ ] . filter ( Boolean ) . join ( '<br/>' ) ;
9498}
9599
96100function getConditionLabel ( kind : 'pre' | 'post' , cond ?: string | null ) : string {
You can’t perform that action at this time.
0 commit comments