-
-
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, sequenceDiagram refactor, config normalization, many tweaks #1523
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…ping enabled and disabled
PR 1482 redux
msgModel generated during calculation of loop bounds simplifies draw messages loop
noteModel generated during calculation of loop bounds
addition: bounds.init will clear models addition: added loop model widths id instead of using title as the id removed parseMessage debug message addition: added configuration labelBoxWidth and labelBoxHeight for loop label box width/height change: adjusted svgDraw drawText to support anchor and valign and whether to output a tspan change: drawText returns an array regardless of array size change: hardcoded label width/height uses conf.labelBoxWidth and conf.labelBoxHeight change: Math.round() on many of the calculations to clean up bounds values change: getTextObj anchor, width, height start as undefined
Updated config to match a conversation knut and i had about the relationship between global, site, and integrator configuration (Will update docs) Renamed wrapEnabled to wrap Poor man's caching for calculateTextDimensions, wrapLabel, and breakString (actually makes a huge difference)
Missed `activationWidth` new configuration option for sequence diagrams
Feature/1483 long messages
…fying the sequence object take into account width of message over single actor for actors' max message width
Fixed config *font helpers
math is hard sometimes?
…Key calculations done in this particular branch. This will be normalized with the memoize PR about to be created.
conf.messageFont() would have a different cacheKey based on the cache…
Fixed a few of the text rendering issues
Feature/1483 long messages
…to feature/1483_long_messages
Ensure a minimum amount of space between wrapped / non-wrapped title text and the next element
Feature/1483 long messages
Merging changes from develop into feature/1483_long_messages
updated parseMessage to set wrap: true when breaks are detected
added hasBreaks and splitBreaks to common.js
…cle is the contrast color
Fixed dark theme (sequenceDiagram) sequenceNumbers color
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📑 Summary
This PR is much larger than I would typically expect.
Reworked directives
Directives
%%{...}%%
are now processed inmermaidAPI
. The default/base directive isinit
orinitialize
. There is another directive to supportwrap
or wrapping. The init directive's purpose is essentially to give some control to the graph implementor. This control is guarded by a single field:secure
. The graph implementor can direct config changes to any keys in the configuration except those defined in thesecure
array. By default the secure array consists of:['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
. The init directive cannot make changes to those keys in the configuration as they are reserved for the site/host/owner. Further, the site/host/owner is able to expand thesecure
array to further lock down which keys cannot be modified by graph implementors by simply modifying the secure array in the options object passed tomermaidAPI.initialize()
. The configuration resolved by the init directive is passed tomermaidAPI.reinitialize()
. This function applies the configuration defensively with respect to the site configuration.Config normalization
Configuration has changed quite a bit as well. There are now three main states of configuration:
global default, site, and current
. The global default configuration is the basic configuration shipped with mermaid. Site operators may set their own base configuration (called site configuration) which will likely be based on the global configuration with various site-specific changes. This site configuration become the base configuration available to graph implementors. This gives graph implementors freedom to make various changes to the configuration without breaking the site owners core configuration. Thesecure
key defines fields that graph implementors may not change. (Directives attempting to make changes to those keys simply drop the attempted change). Sneaky attempts to update the config are also blocked defensively.The hope is that site owners and graph implementors will be able to configure graphs within the parameters defined by the site owner.