11class ThemeBpmnVisualization extends bpmnvisu . BpmnVisualization {
2- _theme ;
32
43 constructor ( options , theme ) {
54 super ( options ) ;
6- this . _theme = theme ;
7- this . _configureStyle ( ) ;
5+ this . _configureStyle ( theme ) ;
86 }
97
10- _configureStyle ( ) {
8+ _configureStyle ( theme ) {
119 const styleSheet = this . graph . getStylesheet ( ) ; // mxStylesheet
1210
11+ theme . default . fontFamily ??= 'Inter, Helvetica, sans-serif' ;
12+ configureStyle ( styleSheet . getDefaultVertexStyle ( ) , theme . default ) ;
13+ configureStyle ( styleSheet . getDefaultEdgeStyle ( ) , theme . default ) ;
14+
1315 // START EVENT
14- configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . EVENT_START ] , this . _theme . startEvent ) ;
16+ configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . EVENT_START ] , theme . startEvent ) ;
1517
1618 // END EVENT
17- configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . EVENT_END ] , this . _theme . endEvent ) ;
19+ configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . EVENT_END ] , theme . endEvent ) ;
1820
1921 // USER TASK
20- configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . TASK_USER ] , this . _theme . userTask ) ;
22+ configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . TASK_USER ] , theme . userTask ) ;
2123
2224 // EXCLUSIVE GATEWAY
23- configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . GATEWAY_EXCLUSIVE ] , this . _theme . exclusiveGateway ) ;
25+ configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . GATEWAY_EXCLUSIVE ] , theme . exclusiveGateway ) ;
2426
2527 // CALL ACTIVITY
26- configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . CALL_ACTIVITY ] , this . _theme . callActivity ) ;
28+ configureStyle ( styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . CALL_ACTIVITY ] , theme . callActivity ) ;
2729
2830 // POOL
2931 const style = styleSheet . styles [ bpmnvisu . ShapeBpmnElementKind . POOL ] ;
30- const themePool = this . _theme . pool ;
32+ const themePool = theme . pool ;
33+ themePool . fontSize ??= 16 ;
3134 configureStyle ( style , themePool ) ;
3235 style [ StyleIdentifiers . STYLE_FILLCOLOR ] = themePool . labelFill ;
3336 style [ StyleIdentifiers . STYLE_SWIMLANE_FILLCOLOR ] = themePool . swimlaneFill ;
34- style [ StyleIdentifiers . STYLE_FONTSIZE ] = themePool . fontSize ?? 16 ;
3537 }
3638
3739}
@@ -40,13 +42,22 @@ function configureStyle(style, themeElement) {
4042 if ( themeElement . fill ) {
4143 style [ StyleIdentifiers . STYLE_FILLCOLOR ] = themeElement . fill ;
4244 }
45+
4346 if ( themeElement . font ) {
4447 style [ StyleIdentifiers . STYLE_FONTCOLOR ] = themeElement . font ;
4548 }
49+ if ( themeElement . fontFamily ) {
50+ style [ StyleIdentifiers . STYLE_FONTFAMILY ] = themeElement . fontFamily ;
51+ }
52+ if ( themeElement . fontSize ) {
53+ style [ StyleIdentifiers . STYLE_FONTSIZE ] = themeElement . fontSize ;
54+ }
55+
4656 if ( themeElement . gradient ) {
4757 style [ StyleIdentifiers . STYLE_GRADIENT_DIRECTION ] = themeElement . gradientDirection ?? Directions . DIRECTION_WEST ;
4858 style [ StyleIdentifiers . STYLE_GRADIENTCOLOR ] = themeElement . gradient ;
4959 }
60+
5061 if ( themeElement . stroke ) {
5162 style [ StyleIdentifiers . STYLE_STROKECOLOR ] = themeElement . stroke ;
5263 }
0 commit comments