-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Directives slight rework, utils enhancements, mermaidAPI enhancements, SequenceDiagram tweaks #1482
Conversation
Merging upstream develop
# Conflicts: # dist/mermaid.core.js # dist/mermaid.core.js.map # dist/mermaid.js # dist/mermaid.js.map # dist/mermaid.min.js # dist/mermaid.min.js.map # src/config.js # src/mermaidAPI.js
Fixed default config clobbering issues
Fixed default config clobbering issues Updated/corrected sequenceDiagram.spec to set the config using mermaidAPI Enabled freeze on mermaidAPI to protect defaultConfig
…sing actor widths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of goodies in here. Code wise it is good. The config refactoring has been overdue for a while so it is good that it is happening.
As a reviewer it is easier to review several smaller PRs then one large which also make writing the release notes easier.
Also good with the new tests, both the unit tests and rendering tests.
I noticed this change:
diagram.attr('style', 'max-width:' + width + 'px;');
to
diagram.attr('style', 'max-width:100%;');
This will change the behaviour of the useMaxWidth so that small diagrams become larger. The old version keeps the small diagram in the original size but changes the size of diagrams that are too large. I will change that back.
Also I noticed the return parser in mermaidAPI.parse, thats a good idea. We could perhaps have only one switch case for the the diagram type resulting in a parser and a renderer etc. Lots of text improvements for sequenceDiagrams, specifically it was good to break out the text functions from sequence diagram as they are usefull for other diagrams for instance in the new dagre-wrapper.
Thanks for a thurough job!
Percy found some unintended side effects: |
The wrap concept is elegant but when it is not present it needs to be rendered in a good way by default. If we release this as is, there would be diagrams out there, authored by end users, breaking with the new version. Ideally eitherPerhaps wrapping could be default behavior? I registered an issue for this: #1483 |
@chrismoran-bkt I really hope you take the time and effort to make a PR for this as it would be a waste not to get these changes in. I have moved the changes from the PR into a feature branch to avoid having next release depending on a pontential PR. Also if you make a PR point it to the feature branch. |
On it. 😉
|
Let me know what you think of #1484 |
📑 Summary
Slight refactor for sequenceDiagram db/renderer
freeze
to mermaidAPI to protect a new exporteddefaultConfig
reset
to revert any modifications to the current config back to thedefaultConfig
initialize
to merge user config into mermaidAPI current config without losing the defaultConfiginitialize
to update each renderer configdetectType
) to the proper config-object-name for the graph type in scope. Example:will correctly set the
config
property of the initialization object tosequence
effectively resulting in the following object to be sent tomermaidAPI.initialize()
which, when combined with the new assignWithDepth functionality will properly update the current config of the mermaidAPI (without losing other defaults) as well as updating the sequenceRenderer config
%%{init: { 'config': {..}}}%%
directive and their config will correctly be converted to the properly-named config for the graph they are describing without losing the default config in the process.' delimited string for wrapping long strings
useMaxWidth
was not properly using the max widthIf i missed a test please let me know. I tried to be thorough.
Resolves #1473