Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] General improvements for default styles management #2471

Open
4 tasks
tbouffard opened this issue Jan 20, 2023 · 0 comments
Open
4 tasks

[FEAT] General improvements for default styles management #2471

tbouffard opened this issue Jan 20, 2023 · 0 comments
Labels
BPMN diagram styling Change the standard rendering: stroke color, thickness enhancement New feature or request
Milestone

Comments

@tbouffard
Copy link
Member

tbouffard commented Jan 20, 2023

Is your feature request related to a problem? Please describe.
This is a top level issue to discuss ways we could introduce to easily manage several use cases related to BPMN styles and themes.

Currently in version 0.29.1, we let users customize the styles and theme with hacks:

  • changing defaults (like colors) require to update bpmn-visualization internals (by changing the StyleDefault enum)
  • redefining styles implies calling mxGraph native code and knowing when to call it (after lib initialization)
  • changing the theme dynamically require extending the BpmnVisualization class and calling mxGraph native code (see the Hacktoberfest demo or the bpm-visualization "load diagram" demo)

Describe the solution you'd like

List of use cases

Note: a lot of use cases are mentioned in #953, in particular live style changes done for the November 2020 POC (#869)

  • Setting the defaults
  • Change the default style configuration
  • Define various BPMN Themes
  • Apply style configuration change or a BPMN Theme to the rendering
  • Reset rendering to the default styles/theme

Possible implementation

Introduce a new "style" API

methods:

  • configure((style: mxStyleSheet) => void): void
  • reset(options): void
  • setDefaults: at lib initialization (see [FEAT] Provide a way to configure the defaults of the BPMN renderer #1993). No real need at runtime, if required, this can be done using the "configure" methods (except of overlays defaults, but is there a real need for that?).
  • refreshRendering: to apply style changes done with the "configure" method

configure:

  • avoid class extension or calling mxGraph native code
  • if we move to maxGraph (see refactor: [POC] Replace mxGraph with maxGraph 0.1.0 #2366), there will be some minor breaking changes for implementor
  • calling this method doesn't change the rendering
  • the passed function parameter can update all or some styles
  • the method can be called several times

reset / resetStyleDefinitions / resetToDefaults:

  • facilitate switch to another Theme
  • reset use the defaults defined by the user

possible implementation (see also #2458)

  • call styleSheet.styles and remove all entries. How do we do for defaultVertex and defaultEdge ?
  • recreate all default styles with StyleConfigurator
  • check if mxGraph provides an API for that

To check: what will happen to elements that received specific style changes with #1030 and #2468? Probably removed

Alternative: enrich some existing options

Changing the initial default may be done using the GlobalOptions or LoadOptions, see #1993

Existing issues that can benefit from the decision taken here

  1. BPMN diagram styling enhancement
  2. BPMN diagram styling enhancement
  3. BPMN diagram styling enhancement
  4. refactoring
@tbouffard tbouffard added enhancement New feature or request BPMN diagram styling Change the standard rendering: stroke color, thickness labels Jan 20, 2023
@tbouffard tbouffard added this to the Extensions milestone Jan 20, 2023
@tbouffard tbouffard changed the title [FEAT] General improvements for styles management [FEAT] General improvements for default styles management Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BPMN diagram styling Change the standard rendering: stroke color, thickness enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant