bpmn-visualization-js
bpmn-visualization-js copied to clipboard
[FEAT] Reduce the mxGraph stylesheet duplications to simplify custom configuration
Is your feature request related to a problem? Please describe. In v0.29.1, the configuration of some BPMN elements is duplicated. For instance, for each kinds of event, we create a specific mxGraph style. All styles are the same. So if we want to change the style in an application, we have to do it for all event kinds instead of doing it once. This is also the case for tasks, activities and gateways.
See the examples repository or https://github.com/process-analytics/bpmn-visualization-js/issues/2306#issuecomment-1284950255 to see how this is currently managed. We provide convenient functions to get the list of gateway or event kinds for instance, but the duplication is here.
Describe the solution you'd like
We could introduce "type styles" like we do for CSS class names or with edge additional mxGraph styles.
The shared configuration will be defined in the "type styles" and the specific configuration the the "kind styles".
For instance, for events, we could introduce a bpmnEvent
style (name to be defined) in addition to the already existing "event kind" styles.
When inserting the cell in the mxGraph model, we will need to add the "type styles" to the list of style.
Additional context We can also apply it to Pool and Lane to share their style configuration, by introducing a "container style" for instance (use the same wording as for CSS class names). This will also probably the time to document all registered mxGraph styles and CSS class names, and how this can be extended (link to examples)